fixed bug that prevented proper detection of FPGA load skip request
This commit is contained in:
@@ -23,14 +23,14 @@
|
|||||||
* Author: Markus Fröschle
|
* Author: Markus Fröschle
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <bas_types.h>
|
||||||
#include <stddef.h>
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "xhdi_sd.h"
|
#include "xhdi_sd.h"
|
||||||
#include "dma.h"
|
#include "dma.h"
|
||||||
#include "driver_vec.h"
|
#include "driver_vec.h"
|
||||||
#include "driver_mem.h"
|
#include "driver_mem.h"
|
||||||
#include "pci.h"
|
#include "pci.h"
|
||||||
|
#include "mmu.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* driver interface struct for the SD card BaS driver
|
* driver interface struct for the SD card BaS driver
|
||||||
@@ -56,19 +56,21 @@ static struct dma_driver_interface dma_interface =
|
|||||||
.dma_get_channel = dma_get_channel,
|
.dma_get_channel = dma_get_channel,
|
||||||
.dma_free_channel = dma_free_channel,
|
.dma_free_channel = dma_free_channel,
|
||||||
.dma_clear_channel = dma_clear_channel,
|
.dma_clear_channel = dma_clear_channel,
|
||||||
.MCD_startDma = MCD_startDma,
|
.MCD_startDma = (int (*)(long, int8_t *, unsigned int, int8_t *, unsigned int,
|
||||||
.MCD_dmaStatus = MCD_dmaStatus,
|
unsigned int, unsigned int, unsigned int, int,
|
||||||
.MCD_XferProgrQuery = MCD_XferProgrQuery,
|
unsigned int, unsigned int)) MCD_startDma,
|
||||||
.MCD_killDma = MCD_killDma,
|
.MCD_dmaStatus = (int32_t (*)(int32_t)) MCD_dmaStatus,
|
||||||
.MCD_continDma = MCD_continDma,
|
.MCD_XferProgrQuery = (int32_t (*)(int32_t, MCD_XferProg *)) MCD_XferProgrQuery,
|
||||||
.MCD_pauseDma = MCD_pauseDma,
|
.MCD_killDma = (int32_t (*)(int32_t)) MCD_killDma,
|
||||||
.MCD_resumeDma = MCD_resumeDma,
|
.MCD_continDma = (int32_t (*)(int32_t)) MCD_continDma,
|
||||||
.MCD_csumQuery = MCD_csumQuery,
|
.MCD_pauseDma = (int32_t (*)(int32_t)) MCD_pauseDma,
|
||||||
|
.MCD_resumeDma = (int32_t (*)(int32_t)) MCD_resumeDma,
|
||||||
|
.MCD_csumQuery = (int32_t (*)(int32_t, uint32_t *)) MCD_csumQuery,
|
||||||
.dma_malloc = driver_mem_alloc,
|
.dma_malloc = driver_mem_alloc,
|
||||||
.dma_free = driver_mem_free
|
.dma_free = driver_mem_free
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const struct fb_info *info_fb;
|
extern struct fb_info *info_fb;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* driver interface struct for the PCI_BIOS BaS driver
|
* driver interface struct for the PCI_BIOS BaS driver
|
||||||
@@ -130,6 +132,7 @@ static struct framebuffer_driver_interface framebuffer_interface =
|
|||||||
.framebuffer_info = &info_fb
|
.framebuffer_info = &info_fb
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static struct generic_interface interfaces[] =
|
static struct generic_interface interfaces[] =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@@ -166,6 +169,14 @@ static struct generic_interface interfaces[] =
|
|||||||
.revision = 1,
|
.revision = 1,
|
||||||
.interface.pci = &pci_interface,
|
.interface.pci = &pci_interface,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.type = MMU_DRIVER,
|
||||||
|
.name = "MMU",
|
||||||
|
.description = "BaS MMU driver",
|
||||||
|
.version = 0,
|
||||||
|
.revision = 1,
|
||||||
|
.interface.mmu = NULL,
|
||||||
|
},
|
||||||
/* insert new drivers here */
|
/* insert new drivers here */
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -173,6 +184,8 @@ static struct generic_interface interfaces[] =
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern void remove_handler(void); /* forward declaration */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* this is the driver table we expose to the OS
|
* this is the driver table we expose to the OS
|
||||||
*/
|
*/
|
||||||
@@ -180,14 +193,46 @@ static struct driver_table bas_drivers =
|
|||||||
{
|
{
|
||||||
.bas_version = MAJOR_VERSION,
|
.bas_version = MAJOR_VERSION,
|
||||||
.bas_revision = MINOR_VERSION,
|
.bas_revision = MINOR_VERSION,
|
||||||
.remove_handler = NULL,
|
.remove_handler = remove_handler,
|
||||||
.interfaces = { interfaces }
|
.interfaces = interfaces
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void remove_handler(void)
|
||||||
|
{
|
||||||
|
extern void std_exc_vec(void);
|
||||||
|
uint32_t *trap_0_vector = (uint32_t *) 0x80;
|
||||||
|
|
||||||
|
*trap_0_vector = (uint32_t) std_exc_vec;
|
||||||
|
}
|
||||||
|
|
||||||
void __attribute__((interrupt)) get_bas_drivers(void)
|
void __attribute__((interrupt)) get_bas_drivers(void)
|
||||||
{
|
{
|
||||||
__asm__ __volatile__(
|
__asm__ __volatile(
|
||||||
"move.l #%[drivers],d0\n\t"
|
/*
|
||||||
|
* sp should now point to the next instruction after the trap
|
||||||
|
* The trap itself is 2 bytes, the four bytes before that must
|
||||||
|
* read '_BAS' or we are not meant by this call
|
||||||
|
*/
|
||||||
|
" move.l a0,-(sp) \n\t" // save registers
|
||||||
|
" move.l d0,-(sp) \n\t"
|
||||||
|
" move.l 12(sp),a0 \n\t" // get return address
|
||||||
|
" move.l -6(a0),d0 \n\t" //
|
||||||
|
" cmp.l #0x5f424153,d0 \n\t" // is it '_BAS'?
|
||||||
|
" beq fetch_drivers \n\t" // yes
|
||||||
|
/*
|
||||||
|
* This seems indeed a "normal" trap #0. Better pass control to "normal" trap #0 processing
|
||||||
|
* If trap #0 isn't set to something sensible, we'll probably crash here, but this must be
|
||||||
|
* prevented on the caller side.
|
||||||
|
*/
|
||||||
|
" move.l (sp)+,d0 \n\t" // restore registers
|
||||||
|
" move.l (sp)+,a0 \n\t"
|
||||||
|
" move.l 0x80,-(sp) \n\t" // fetch vector
|
||||||
|
" rts \n\t" // and jump through it
|
||||||
|
|
||||||
|
"fetch_drivers: \n\t"
|
||||||
|
" move.l #%[drivers],d0 \n\t" // return driver struct in d0
|
||||||
|
" addq.l #4,sp \n\t" // adjust stack
|
||||||
|
" move.l (sp)+,a0 \n\t" // restore register
|
||||||
: /* no output */
|
: /* no output */
|
||||||
: [drivers] "o" (bas_drivers) /* input */
|
: [drivers] "o" (bas_drivers) /* input */
|
||||||
: /* clobber */
|
: /* clobber */
|
||||||
|
|||||||
@@ -31,13 +31,14 @@
|
|||||||
|
|
||||||
enum driver_type
|
enum driver_type
|
||||||
{
|
{
|
||||||
// BLOCKDEV_DRIVER,
|
BLOCKDEV_DRIVER,
|
||||||
// CHARDEV_DRIVER,
|
CHARDEV_DRIVER,
|
||||||
XHDI_DRIVER,
|
XHDI_DRIVER,
|
||||||
MCD_DRIVER,
|
MCD_DRIVER,
|
||||||
VIDEO_DRIVER,
|
VIDEO_DRIVER,
|
||||||
PCI_DRIVER,
|
PCI_DRIVER,
|
||||||
END_OF_DRIVERS, /* marks end of driver list */
|
MMU_DRIVER,
|
||||||
|
END_OF_DRIVERS = 0xffffffff /* marks end of driver list */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct generic_driver_interface
|
struct generic_driver_interface
|
||||||
@@ -206,7 +207,8 @@ struct framebuffer_driver_interface
|
|||||||
struct fb_info **framebuffer_info; /* pointer to an fb_info struct (defined in include/fb.h) */
|
struct fb_info **framebuffer_info; /* pointer to an fb_info struct (defined in include/fb.h) */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pci_bios_interface {
|
struct pci_bios_interface
|
||||||
|
{
|
||||||
uint32_t subjar;
|
uint32_t subjar;
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
/* Although we declare this functions as standard gcc functions (cdecl),
|
/* Although we declare this functions as standard gcc functions (cdecl),
|
||||||
@@ -259,6 +261,14 @@ struct pci_bios_interface {
|
|||||||
// int32_t reserved[2];
|
// int32_t reserved[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct mmu_driver_interface
|
||||||
|
{
|
||||||
|
int32_t (*map_page_locked)(uint32_t address, uint32_t length, int asid);
|
||||||
|
int32_t (*unlock_page)(uint32_t address, uint32_t length, int asid);
|
||||||
|
int32_t (*report_locked_pages)(uint32_t *num_itlb, uint32_t *num_dtlb);
|
||||||
|
uint32_t (*report_pagesize)(void);
|
||||||
|
};
|
||||||
|
|
||||||
union interface
|
union interface
|
||||||
{
|
{
|
||||||
struct generic_driver_interface *gdi;
|
struct generic_driver_interface *gdi;
|
||||||
@@ -266,6 +276,7 @@ union interface
|
|||||||
struct dma_driver_interface *dma;
|
struct dma_driver_interface *dma;
|
||||||
struct framebuffer_driver_interface *fb;
|
struct framebuffer_driver_interface *fb;
|
||||||
struct pci_bios_interface *pci;
|
struct pci_bios_interface *pci;
|
||||||
|
struct mmu_driver_interface *mmu;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct generic_interface
|
struct generic_interface
|
||||||
@@ -282,8 +293,8 @@ struct driver_table
|
|||||||
{
|
{
|
||||||
uint32_t bas_version;
|
uint32_t bas_version;
|
||||||
uint32_t bas_revision;
|
uint32_t bas_revision;
|
||||||
uint32_t (*remove_handler)(); /* calling this will disable the BaS' hook into trap #0 */
|
void (*remove_handler)(void); /* calling this will disable the BaS' hook into trap #0 */
|
||||||
struct generic_interface *interfaces[];
|
struct generic_interface *interfaces;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include "bas_printf.h"
|
#include "bas_printf.h"
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#define DBG_FECBD
|
//#define DBG_FECBD
|
||||||
#ifdef DBG_FECBD
|
#ifdef DBG_FECBD
|
||||||
#define dbg(format, arg...) do { xprintf("DEBUG: " format, ##arg); } while (0)
|
#define dbg(format, arg...) do { xprintf("DEBUG: " format, ##arg); } while (0)
|
||||||
#else
|
#else
|
||||||
|
|||||||
2
net/ip.c
2
net/ip.c
@@ -13,7 +13,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
||||||
#define IP_DEBUG
|
//#define IP_DEBUG
|
||||||
#if defined(IP_DEBUG)
|
#if defined(IP_DEBUG)
|
||||||
#define dbg(format, arg...) do { xprintf("DEBUG: %s(): " format, __FUNCTION__, ##arg); } while (0)
|
#define dbg(format, arg...) do { xprintf("DEBUG: %s(): " format, __FUNCTION__, ##arg); } while (0)
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -67,6 +67,7 @@
|
|||||||
#define MCF_PSC3_PSCRB_8BIT __MBAR+0x890C
|
#define MCF_PSC3_PSCRB_8BIT __MBAR+0x890C
|
||||||
#define MCF_PSC3_PSCTB_8BIT __MBAR+0x890C
|
#define MCF_PSC3_PSCTB_8BIT __MBAR+0x890C
|
||||||
|
|
||||||
|
.global _std_exc_vec
|
||||||
.global _vec_init
|
.global _vec_init
|
||||||
|
|
||||||
// interrupt sources
|
// interrupt sources
|
||||||
@@ -255,7 +256,7 @@ _vec_init:
|
|||||||
move.l a0,a2
|
move.l a0,a2
|
||||||
init_vec:
|
init_vec:
|
||||||
move.l #256,d0
|
move.l #256,d0
|
||||||
lea std_exc_vec(pc),a1 // standard vector
|
lea _std_exc_vec(pc),a1 // standard vector
|
||||||
init_vec_loop:
|
init_vec_loop:
|
||||||
move.l a1,(a2)+ // set standard vector for all exceptions
|
move.l a1,(a2)+ // set standard vector for all exceptions
|
||||||
subq.l #1,d0
|
subq.l #1,d0
|
||||||
@@ -325,7 +326,7 @@ init_vec_loop:
|
|||||||
* exception vector routines
|
* exception vector routines
|
||||||
*/
|
*/
|
||||||
vector_table_start:
|
vector_table_start:
|
||||||
std_exc_vec:
|
_std_exc_vec:
|
||||||
move.w #0x2700,sr // disable interrupt
|
move.w #0x2700,sr // disable interrupt
|
||||||
subq.l #8,a7
|
subq.l #8,a7
|
||||||
movem.l d0/a5,(sp) // save registers
|
movem.l d0/a5,(sp) // save registers
|
||||||
@@ -380,7 +381,7 @@ reset_vector:
|
|||||||
move.w #0x2700,sr // disable interrupt
|
move.w #0x2700,sr // disable interrupt
|
||||||
move.l #0x31415926,d0
|
move.l #0x31415926,d0
|
||||||
cmp.l 0x426,d0 // _resvalid: reset vector valid?
|
cmp.l 0x426,d0 // _resvalid: reset vector valid?
|
||||||
beq std_exc_vec // yes->
|
beq _std_exc_vec // yes->
|
||||||
jmp _rom_entry // no, cold start machine
|
jmp _rom_entry // no, cold start machine
|
||||||
|
|
||||||
access:
|
access:
|
||||||
@@ -417,7 +418,7 @@ access_mmu:
|
|||||||
addq.l #4,sp
|
addq.l #4,sp
|
||||||
|
|
||||||
movem.l (sp),d0-d1/a0-a2 // restore gcc scratch registers
|
movem.l (sp),d0-d1/a0-a2 // restore gcc scratch registers
|
||||||
lea 5*4(sp),sp
|
lea 5 * 4(sp),sp
|
||||||
|
|
||||||
move.l (sp)+,d0 // restore register
|
move.l (sp)+,d0 // restore register
|
||||||
|
|
||||||
@@ -425,7 +426,7 @@ access_mmu:
|
|||||||
|
|
||||||
bus_error:
|
bus_error:
|
||||||
move.l (sp)+,d0 // restore register
|
move.l (sp)+,d0 // restore register
|
||||||
bra std_exc_vec
|
bra _std_exc_vec
|
||||||
|
|
||||||
zero_divide:
|
zero_divide:
|
||||||
move.w #0x2700,sr // disable interrupt
|
move.w #0x2700,sr // disable interrupt
|
||||||
|
|||||||
@@ -87,13 +87,15 @@ bool init_fpga(void)
|
|||||||
volatile int32_t time, start, end;
|
volatile int32_t time, start, end;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
xprintf("FPGA load config (_FPGA_JTAG_LOADED = %x, _FPGA_JTAG_VALID = %x)...", _FPGA_JTAG_LOADED, _FPGA_JTAG_VALID);
|
xprintf("FPGA load config...\r\n");
|
||||||
|
xprintf("_FPGA_JTAG_LOADED = %x, _FPGA_JTAG_VALID = %x)\r\n", _FPGA_JTAG_LOADED, _FPGA_JTAG_VALID);
|
||||||
if (_FPGA_JTAG_LOADED == 1 && _FPGA_JTAG_VALID == VALID_JTAG)
|
if (_FPGA_JTAG_LOADED == 1 && _FPGA_JTAG_VALID == VALID_JTAG)
|
||||||
{
|
{
|
||||||
xprintf("detected _FPGA_JTAG_LOADED flag. Not overwriting FPGA config.\r\n");
|
xprintf("detected _FPGA_JTAG_LOADED flag. Not overwriting FPGA config.\r\n");
|
||||||
|
|
||||||
/* reset the flag so that next boot will load config again from flash */
|
/* reset the flag so that next boot will load config again from flash */
|
||||||
_FPGA_JTAG_LOADED = 0;
|
_FPGA_JTAG_LOADED = 0;
|
||||||
|
_FPGA_JTAG_VALID = 0;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user