diff --git a/include/interrupts.h b/include/interrupts.h index 5b6ebac..11325e3 100644 --- a/include/interrupts.h +++ b/include/interrupts.h @@ -144,7 +144,7 @@ extern bool isr_execute_handler(int vector); extern bool pic_interrupt_handler(void *arg1, void *arg2); extern bool xlbpci_interrupt_handler(void *arg1, void *arg2); extern bool pciarb_interrupt_handler(void *arg1, void *arg2); -extern bool xlbarb_interrupt_handler(void *arg1, void *arg2); +extern bool xlbarb_interrupt_handler(void *arg1, void *arg2, ...); extern bool gpt0_interrupt_handler(void *arg1, void *arg2); extern bool irq5_handler(void *arg1, void *arg2); #endif /* _INTERRUPTS_H_ */ diff --git a/include/radeonfb.h b/include/radeonfb.h index 5e2735b..89c3c7f 100644 --- a/include/radeonfb.h +++ b/include/radeonfb.h @@ -12,7 +12,7 @@ #include "wait.h" #include "video.h" -#define RADEON_TILING +// #define RADEON_TILING //#include "radeon_theatre.h" diff --git a/pci/pci.c b/pci/pci.c index 9aea459..1a970c5 100644 --- a/pci/pci.c +++ b/pci/pci.c @@ -34,7 +34,7 @@ #include "interrupts.h" #include "wait.h" -#define DEBUG +// #define DEBUG #include "debug.h" #define pci_config_wait() do { __asm__ __volatile("tpf" ::: "memory"); } while (0) @@ -48,25 +48,25 @@ static struct pci_class char *description; } pci_classes[] = { - { 0x00, "device was built prior definition of the class code field" }, - { 0x01, "Mass Storage Controller" }, - { 0x02, "Network Controller" }, - { 0x03, "Display Controller" }, - { 0x04, "Multimedia Controller" }, - { 0x05, "Memory Controller" }, - { 0x06, "Bridge Device" }, - { 0x07, "Simple Communication Controller" }, - { 0x08, "Base System Peripherial" }, - { 0x09, "Input Device" }, - { 0x0a, "Docking Station" }, - { 0x0b, "Processor" }, - { 0x0c, "Serial Bus Controller" }, - { 0x0d, "Wireless Controller" }, - { 0x0e, "Intelligent I/O Controller" }, - { 0x0f, "Satellite Communication Controller" }, - { 0x10, "Encryption/Decryption Controller" }, - { 0x11, "Data Acquisition and Signal Processing Controller" }, - { 0xff, "Device does not fit any defined class" }, +{ 0x00, "device was built prior definition of the class code field" }, +{ 0x01, "Mass Storage Controller" }, +{ 0x02, "Network Controller" }, +{ 0x03, "Display Controller" }, +{ 0x04, "Multimedia Controller" }, +{ 0x05, "Memory Controller" }, +{ 0x06, "Bridge Device" }, +{ 0x07, "Simple Communication Controller" }, +{ 0x08, "Base System Peripherial" }, +{ 0x09, "Input Device" }, +{ 0x0a, "Docking Station" }, +{ 0x0b, "Processor" }, +{ 0x0c, "Serial Bus Controller" }, +{ 0x0d, "Wireless Controller" }, +{ 0x0e, "Intelligent I/O Controller" }, +{ 0x0f, "Satellite Communication Controller" }, +{ 0x10, "Encryption/Decryption Controller" }, +{ 0x11, "Data Acquisition and Signal Processing Controller" }, +{ 0xff, "Device does not fit any defined class" }, }; static int num_pci_classes = sizeof(pci_classes) / sizeof(struct pci_class); @@ -303,10 +303,10 @@ uint8_t pci_read_config_byte(int32_t handle, int offset) /* initiate PCI configuration access to device */ MCF_PCI_PCICAR = MCF_PCI_PCICAR_E | /* enable configuration access special cycle */ - MCF_PCI_PCICAR_BUSNUM(PCI_BUS_FROM_HANDLE(handle)) | - MCF_PCI_PCICAR_DEVNUM(PCI_DEVICE_FROM_HANDLE(handle)) | /* device number, devices 0 - 9 are reserved */ - MCF_PCI_PCICAR_FUNCNUM(PCI_FUNCTION_FROM_HANDLE(handle)) | /* function number */ - MCF_PCI_PCICAR_DWORD(offset / 4); + MCF_PCI_PCICAR_BUSNUM(PCI_BUS_FROM_HANDLE(handle)) | + MCF_PCI_PCICAR_DEVNUM(PCI_DEVICE_FROM_HANDLE(handle)) | /* device number, devices 0 - 9 are reserved */ + MCF_PCI_PCICAR_FUNCNUM(PCI_FUNCTION_FROM_HANDLE(handle)) | /* function number */ + MCF_PCI_PCICAR_DWORD(offset / 4); NOP(); @@ -331,10 +331,10 @@ int32_t pci_write_config_longword(int32_t handle, int offset, uint32_t value) /* initiate PCI configuration access to device */ MCF_PCI_PCICAR = MCF_PCI_PCICAR_E | /* enable configuration access special cycle */ - MCF_PCI_PCICAR_BUSNUM(PCI_BUS_FROM_HANDLE(handle)) | - MCF_PCI_PCICAR_DEVNUM(PCI_DEVICE_FROM_HANDLE(handle)) | /* device number, devices 0 - 9 are reserved */ - MCF_PCI_PCICAR_FUNCNUM(PCI_FUNCTION_FROM_HANDLE(handle)) | /* function number */ - MCF_PCI_PCICAR_DWORD(offset / 4); + MCF_PCI_PCICAR_BUSNUM(PCI_BUS_FROM_HANDLE(handle)) | + MCF_PCI_PCICAR_DEVNUM(PCI_DEVICE_FROM_HANDLE(handle)) | /* device number, devices 0 - 9 are reserved */ + MCF_PCI_PCICAR_FUNCNUM(PCI_FUNCTION_FROM_HANDLE(handle)) | /* function number */ + MCF_PCI_PCICAR_DWORD(offset / 4); chip_errata_135(); NOP(); @@ -461,7 +461,7 @@ int32_t pci_find_device(uint16_t device_id, uint16_t vendor_id, int index) if (value != 0xffffffff) /* we have a device at this position */ { if (vendor_id == 0xffff || - (PCI_VENDOR_ID(value) == vendor_id && PCI_DEVICE_ID(value) == device_id)) + (PCI_VENDOR_ID(value) == vendor_id && PCI_DEVICE_ID(value) == device_id)) { if (n == index) { @@ -486,7 +486,7 @@ int32_t pci_find_device(uint16_t device_id, uint16_t vendor_id, int index) if (value != 0xffffffff) /* device found */ { if (vendor_id == 0xffff || - ((PCI_VENDOR_ID(value) == vendor_id) && (PCI_DEVICE_ID(value) == device_id))) + ((PCI_VENDOR_ID(value) == vendor_id) && (PCI_DEVICE_ID(value) == device_id))) { if (n == index) { @@ -509,22 +509,25 @@ static bool match_classcode(uint32_t handle, uint32_t classcode) uint32_t value = swpl(pci_read_config_longword(handle, PCICCR)); int i; - dbg("classcode=0x%08x, value=0x%08x\r\n", classcode, value); + classcode &= 0x00ffffff; + value >>= 8; /* shift away revision id */ - value >>= 8; /* shift away PCI revision id */ + //dbg("classcode=0x%08x, value=0x%08x\r\n", classcode, value); for (i = 0; i < 3; i++) /* loop through mask */ { if ((find_mask >> i) & 1) { - dbg("compare 0x%02x against 0x%02x\r\n", value & 0xff, classcode & 0xff); - if (! ((value & 0xff) == classcode & 0xff)) + //dbg("compare 0x%02x against 0x%02x\r\n", value & 0xff, classcode & 0xff); + if ((value & 0xff) != (classcode & 0xff)) return false; - else - classcode >>= 8; + //dbg("match\r\n"); + classcode >>= 8; } value >>= 8; + //dbg("value=0x%08x\r\n", value); } + dbg("return true\r\n"); return true; } @@ -540,18 +543,21 @@ int32_t pci_find_classcode(uint32_t classcode, int index) { int i; uint32_t handle; - int n = 0; - do + for (i = 0; (handle = handles[i]) != -1; i++) { - for (i = 0; (handle = handles[i]) != -1; i++) - if (match_classcode(handle, classcode) && n == index) + dbg("handle=0x%x, n=%d, index=%d\r\n", handle, n, index); + if (match_classcode(handle, classcode)) + { + if (n == index) return handle; else n++; - } while (n < index); + } + } + dbg("not found\r\n"); return PCI_DEVICE_NOT_FOUND; } @@ -840,7 +846,7 @@ static void pci_device_config(uint16_t bus, uint16_t device, uint16_t function) value = swpl(pci_read_config_longword(handle, PCIBAR0 + i)) & ~1; dbg("set PCIBAR%d on device 0x%02x to 0x%08x\r\n", - i / 4, handle, value); + i / 4, handle, value); /* fill resource descriptor */ rd->next = sizeof(struct pci_rd); @@ -944,9 +950,9 @@ static void pci_device_config(uint16_t bus, uint16_t device, uint16_t function) il = pci_read_config_byte(handle, PCI_LANESWAP_B(PCIIPR)); dbg("device requests interrupts on interrupt pin %d\r\n", il); - /* enable interrupt on PCI device */ + /* disable interrupt on PCI device */ - cr &= ~PCICR_INT_DISABLE; + cr |= PCICR_INT_DISABLE; /* * enable device memory or I/O access @@ -967,17 +973,17 @@ static void pci_bridge_config(uint16_t bus, uint16_t device, uint16_t function) dbg("handle=%d\r\n", handle); pci_write_config_longword(handle, PCIBISTR, MCF_PCI_PCICR1_CACHELINESIZE(8) | - MCF_PCI_PCICR1_LATTIMER(0x20)); + MCF_PCI_PCICR1_LATTIMER(0x20)); pci_write_config_longword(handle, PCIBAR0, swpl(0x40000000)); pci_write_config_longword(handle, PCIBAR1, 0x0); pci_write_config_word(handle, PCI_LANESWAP_W(PCICR), swpw( - (1 << 1) /* memory space */ - | (1 << 2) /* bus master */ - | (1 << 4) /* memory write and invalidate */ - | (1 << 6) /* parity errors */ - | (1 << 8) /* SERR */ - | (1 << 9) /* fast back-to-back */ - )); + (1 << 1) /* memory space */ + | (1 << 2) /* bus master */ + | (1 << 4) /* memory write and invalidate */ + | (1 << 6) /* parity errors */ + | (1 << 8) /* SERR */ + | (1 << 9) /* fast back-to-back */ + )); } /* @@ -1017,15 +1023,15 @@ void pci_scan(void) { /* configure memory and I/O for card */ pci_device_config(PCI_BUS_FROM_HANDLE(handle), - PCI_DEVICE_FROM_HANDLE(handle), - PCI_FUNCTION_FROM_HANDLE(handle)); + PCI_DEVICE_FROM_HANDLE(handle), + PCI_FUNCTION_FROM_HANDLE(handle)); } else { dbg("\r\n"); pci_bridge_config(PCI_BUS_FROM_HANDLE(handle), - PCI_DEVICE_FROM_HANDLE(handle), - PCI_FUNCTION_FROM_HANDLE(handle)); + PCI_DEVICE_FROM_HANDLE(handle), + PCI_FUNCTION_FROM_HANDLE(handle)); } dbg("\r\n"); handle = pci_find_device(0x0, 0xFFFF, ++index); @@ -1039,11 +1045,11 @@ void init_eport(void) /* configure IRQ1-7 pins on EPORT falling edge triggered */ MCF_EPORT_EPPAR = MCF_EPORT_EPPAR_EPPA7(MCF_EPORT_EPPAR_FALLING) | MCF_EPORT_EPPAR_EPPA6(MCF_EPORT_EPPAR_FALLING) | -#if defined(MACHINE_FIREBEE) /* irq5 level triggered on FireBee */ + #if defined(MACHINE_FIREBEE) /* irq5 level triggered on FireBee */ MCF_EPORT_EPPAR_EPPA5(MCF_EPORT_EPPAR_LEVEL) | -#elif defined(MACHINE_M5484LITE) + #elif defined(MACHINE_M5484LITE) MCF_EPORT_EPPAR_EPPA5(MCF_EPORT_EPPAR_FALLING) | -#endif /* MACHINE_FIREBEE */ + #endif /* MACHINE_FIREBEE */ MCF_EPORT_EPPAR_EPPA4(MCF_EPORT_EPPAR_FALLING) | MCF_EPORT_EPPAR_EPPA3(MCF_EPORT_EPPAR_FALLING) | MCF_EPORT_EPPAR_EPPA2(MCF_EPORT_EPPAR_FALLING) | @@ -1063,15 +1069,15 @@ void init_xlbus_arbiter(void) if (clock_ratio == 4) { MCF_XLB_XARB_CFG = MCF_XLB_XARB_CFG_BA | - MCF_XLB_XARB_CFG_DT | - MCF_XLB_XARB_CFG_AT | - MCF_XLB_XARB_CFG_PLDIS; + MCF_XLB_XARB_CFG_DT | + MCF_XLB_XARB_CFG_AT | + MCF_XLB_XARB_CFG_PLDIS; } else { MCF_XLB_XARB_CFG = MCF_XLB_XARB_CFG_BA | - MCF_XLB_XARB_CFG_DT | - MCF_XLB_XARB_CFG_AT; + MCF_XLB_XARB_CFG_DT | + MCF_XLB_XARB_CFG_AT; } MCF_XLB_XARB_ADRTO = 0x1fffff; @@ -1087,11 +1093,11 @@ void init_xlbus_arbiter(void) */ #if 0 MCF_XLB_XARB_PRIEN = MCF_XLB_XARB_PRIEN_M0 | /* activate programmed priority for Coldfire core */ - MCF_XLB_XARB_PRIEN_M2 | /* activate programmed priority for Multichannel DMA */ - MCF_XLB_XARB_PRIEN_M3; /* activate programmed priority for PCI target interface */ + MCF_XLB_XARB_PRIEN_M2 | /* activate programmed priority for Multichannel DMA */ + MCF_XLB_XARB_PRIEN_M3; /* activate programmed priority for PCI target interface */ MCF_XLB_XARB_PRI = MCF_XLB_XARB_PRI_M0P(7) | /* Coldfire core gets lowest */ - MCF_XLB_XARB_PRI_M2P(5) | /* Multichannel DMA mid priority */ - MCF_XLB_XARB_PRI_M3P(3); /* PCI target interface is highest priority */ + MCF_XLB_XARB_PRI_M2P(5) | /* Multichannel DMA mid priority */ + MCF_XLB_XARB_PRI_M3P(3); /* PCI target interface is highest priority */ #endif } @@ -1113,9 +1119,9 @@ void init_pci(void) * setup the PCI arbiter */ MCF_PCIARB_PACR = MCF_PCIARB_PACR_INTMPRI /* internal master priority: high */ - | MCF_PCIARB_PACR_EXTMPRI(0x0) /* external master priority: high */ - | MCF_PCIARB_PACR_INTMINTEN /* enable "internal master broken" interrupt */ - | MCF_PCIARB_PACR_EXTMINTEN(0x0f); /* enable "external master broken" interrupt */ + | MCF_PCIARB_PACR_EXTMPRI(0x0) /* external master priority: high */ + | MCF_PCIARB_PACR_INTMINTEN /* enable "internal master broken" interrupt */ + | MCF_PCIARB_PACR_EXTMINTEN(0x0f); /* enable "external master broken" interrupt */ #if defined(MACHINE_FIREBEE) MCF_PAD_PAR_PCIBG = MCF_PAD_PAR_PCIBG_PAR_PCIBG4_TBST | @@ -1142,31 +1148,31 @@ void init_pci(void) #endif /* MACHINE_FIREBEE */ MCF_PCI_PCISCR = MCF_PCI_PCISCR_M | /* memory access control enabled */ - MCF_PCI_PCISCR_B | /* bus master enabled */ - MCF_PCI_PCISCR_M | /* mem access enable */ - MCF_PCI_PCISCR_MA | /* clear master abort error */ - MCF_PCI_PCISCR_MW | /* memory write and invalidate enabled */ - MCF_PCI_PCISCR_PER; /* assert PERR on parity error */ + MCF_PCI_PCISCR_B | /* bus master enabled */ + MCF_PCI_PCISCR_M | /* mem access enable */ + MCF_PCI_PCISCR_MA | /* clear master abort error */ + MCF_PCI_PCISCR_MW | /* memory write and invalidate enabled */ + MCF_PCI_PCISCR_PER; /* assert PERR on parity error */ /* Setup burst parameters */ MCF_PCI_PCICR1 = MCF_PCI_PCICR1_CACHELINESIZE(8) | - MCF_PCI_PCICR1_LATTIMER(0x20); /* TODO: test increased latency timer */ + MCF_PCI_PCICR1_LATTIMER(0x20); /* TODO: test increased latency timer */ MCF_PCI_PCICR2 = MCF_PCI_PCICR2_MINGNT(1) | - MCF_PCI_PCICR2_MAXLAT(32); + MCF_PCI_PCICR2_MAXLAT(32); // MCF_PCI_PCICR2 = 0; /* this is what Linux does */ /* error signaling */ MCF_PCI_PCIICR = MCF_PCI_PCIICR_TAE | /* target abort enable */ - MCF_PCI_PCIICR_IAE; /* initiator abort enable */ + MCF_PCI_PCIICR_IAE; /* initiator abort enable */ // MCF_PCI_PCIICR = 0; /* this is what Linux does */ MCF_PCI_PCIGSCR |= MCF_PCI_PCIGSCR_SEE | /* system error interrupt enable */ - MCF_PCI_PCIGSCR_PEE; /* parity error interrupt enable */ + MCF_PCI_PCIGSCR_PEE; /* parity error interrupt enable */ /* Configure Initiator Windows */ /* @@ -1174,7 +1180,7 @@ void init_pci(void) * used for PCI memory access */ MCF_PCI_PCIIW0BTAR = ((PCI_MEMORY_OFFSET + ((PCI_MEMORY_SIZE - 1) >> 8)) & 0xffff0000) - | (PCI_MEMORY_OFFSET >> 16); + | (PCI_MEMORY_OFFSET >> 16); NOP(); dbg("PCIIW0BTAR=0x%08x\r\n", MCF_PCI_PCIIW0BTAR); @@ -1184,16 +1190,16 @@ void init_pci(void) * used for PCI I/O access */ MCF_PCI_PCIIW1BTAR = ((PCI_IO_OFFSET + ((PCI_IO_SIZE - 1) >> 8)) & 0xffff0000) - | (PCI_IO_OFFSET >> 16); + | (PCI_IO_OFFSET >> 16); NOP(); /* initiator window 2 base / translation address register */ MCF_PCI_PCIIW2BTAR = 0L; /* not used */ NOP(); /* initiator window configuration register */ MCF_PCI_PCIIWCR = MCF_PCI_PCIIWCR_WINCTRL0_MEMRDLINE | - MCF_PCI_PCIIWCR_WINCTRL1_IO | - MCF_PCI_PCIIWCR_WINCTRL0_E | - MCF_PCI_PCIIWCR_WINCTRL1_E; + MCF_PCI_PCIIWCR_WINCTRL1_IO | + MCF_PCI_PCIIWCR_WINCTRL0_E | + MCF_PCI_PCIIWCR_WINCTRL1_E; NOP(); /* @@ -1244,16 +1250,16 @@ void pci_print_device_abilities(int32_t handle) pci_write_config_word(handle, PCICSR, 0xffff); value = swpw(pci_read_config_word(handle, PCICSR)); dbg("IO: %1d MEM: %1d MSTR:%1d SPCC: %1d MEMW: %1d VGAS: %1d PERR: %1d STEP: %1d SERR: %1d FBTB: %1d\r\n", - value & PCICSR_IO ? 1 : 0, - value & PCICSR_MEMORY ? 1 : 0, - value & PCICSR_MASTER ? 1 : 0, - value & PCICSR_SPECIAL ? 1 : 0, - value & PCICSR_MEMWI ? 1 : 0, - value & PCICSR_VGA_SNOOP ? 1 : 0, - value & PCICSR_PERR ? 1 : 0, - value & PCICSR_STEPPING ? 1 : 0, - value & PCICSR_SERR ? 1 : 0, - value & PCICSR_FAST_BTOB_E ? 1 : 0); + value & PCICSR_IO ? 1 : 0, + value & PCICSR_MEMORY ? 1 : 0, + value & PCICSR_MASTER ? 1 : 0, + value & PCICSR_SPECIAL ? 1 : 0, + value & PCICSR_MEMWI ? 1 : 0, + value & PCICSR_VGA_SNOOP ? 1 : 0, + value & PCICSR_PERR ? 1 : 0, + value & PCICSR_STEPPING ? 1 : 0, + value & PCICSR_SERR ? 1 : 0, + value & PCICSR_FAST_BTOB_E ? 1 : 0); pci_write_config_word(handle, PCICSR, saved_value); } @@ -1264,15 +1270,15 @@ void pci_print_device_config(int32_t handle) value = swpw(pci_read_config_word(handle, PCICSR + 2)); dbg("66M: %1d UDF: %1d FB2B:%1d PERR: %1d TABR: %1d DABR: %1d SERR: %1d PPER: %1d\r\n", - value & PCICSR_66MHZ ? 1 : 0, - value & PCICSR_UDF ? 1 : 0, - value & PCICSR_FAST_BTOB ? 1 : 0, - value & PCICSR_DPARITY_ERROR ? 1 : 0, - value & PCICSR_T_ABORT_S ? 1 : 0, - value & PCICSR_T_ABORT_R ? 1 : 0, - value & PCICSR_M_ABORT_R ? 1 : 0, - value & PCICSR_S_ERROR_S ? 1 : 0, - value & PCICSR_PARITY_ERR ? 1 : 0); + value & PCICSR_66MHZ ? 1 : 0, + value & PCICSR_UDF ? 1 : 0, + value & PCICSR_FAST_BTOB ? 1 : 0, + value & PCICSR_DPARITY_ERROR ? 1 : 0, + value & PCICSR_T_ABORT_S ? 1 : 0, + value & PCICSR_T_ABORT_R ? 1 : 0, + value & PCICSR_M_ABORT_R ? 1 : 0, + value & PCICSR_S_ERROR_S ? 1 : 0, + value & PCICSR_PARITY_ERR ? 1 : 0); } #endif /* DEBUG_PCI */ diff --git a/sys/driver_mem.c b/sys/driver_mem.c index 680bd39..79e6d01 100644 --- a/sys/driver_mem.c +++ b/sys/driver_mem.c @@ -11,6 +11,7 @@ * option any later version. */ + #include #include "bas_string.h" #include "bas_printf.h" @@ -27,13 +28,8 @@ #error "unknown machine!" #endif -//#define DBG_DM -#ifdef DBG_DM -#define dbg(format, arg...) do { xprintf("DEBUG: %s(): " format, __FUNCTION__, ##arg); } while (0) -#else -#define dbg(format, arg...) do { ; } while (0) -#endif -#define err(format, arg...) do { xprintf("ERROR: %s(): " format, __FUNCTION__, ##arg); } while (0) +// #define DEBUG +#include "debug.h" extern long offscren_reserved(void); @@ -259,7 +255,7 @@ int32_t driver_mem_free(void *addr) freeit(p, mpb); set_ipl(level); - dbg("%s: driver_mem_free(0x%08X)\r\n", __FUNCTION__, addr); + dbg("addr=0x%08X)\r\n", addr); return(0); } @@ -293,7 +289,7 @@ void *driver_mem_alloc(uint32_t amount) ret = (void *) m->m_start; } set_ipl(level); - dbg("%s: driver_mem_alloc(%d) = 0x%08X\r\n", __FUNCTION__, amount, ret); + dbg("alloc(%d) = 0x%08X\r\n", amount, ret); return ret; } @@ -304,7 +300,7 @@ int driver_mem_init(void) { if (use_count == 0) { - dbg("%s: initialise driver_mem_buffer[] at %p, size 0x%x\r\n", __FUNCTION__, driver_mem_buffer, DRIVER_MEM_BUFFER_SIZE); + dbg("initialise driver_mem_buffer[] at %p, size 0x%x\r\n", driver_mem_buffer, DRIVER_MEM_BUFFER_SIZE); memset(driver_mem_buffer, 0, DRIVER_MEM_BUFFER_SIZE); pmd.mp_mfl = pmd.mp_rover = &tab_md[0]; @@ -315,10 +311,10 @@ int driver_mem_init(void) pmd.mp_mal = (MD *) NULL; memset(driver_mem_buffer, 0, tab_md[0].m_length); - dbg("%s: uncached driver memory buffer at 0x%08X size %d\r\n", __FUNCTION__, tab_md[0].m_start, tab_md[0].m_length); + dbg("uncached driver memory buffer at 0x%08X size %d\r\n", tab_md[0].m_start, tab_md[0].m_length); } use_count++; - dbg("%s: driver_mem now has a use count of %d\r\n", __FUNCTION__, use_count); + dbg("driver_mem now has a use count of %d\r\n", use_count); return 0; } @@ -335,7 +331,7 @@ void driver_mem_release(void) #endif #endif } - dbg("%s: driver_mem use count now %d\r\n", __FUNCTION__, use_count); + dbg("driver_mem use count now %d\r\n", use_count); } diff --git a/sys/exceptions.S b/sys/exceptions.S index 94f3f21..a6ee65c 100644 --- a/sys/exceptions.S +++ b/sys/exceptions.S @@ -268,7 +268,7 @@ _std_exc_vec: movem.l d0/a5,(sp) // save registers move.w 8(sp),d0 // fetch vector and.l #0x3fc,d0 // mask out vector number -//#define DBG_EXC +// #define DBG_EXC #ifdef DBG_EXC // printout vector number of exception diff --git a/sys/interrupts.c b/sys/interrupts.c index 6aa56bd..267b8f0 100644 --- a/sys/interrupts.c +++ b/sys/interrupts.c @@ -36,8 +36,9 @@ #include "util.h" #include "dma.h" #include "pci.h" +#include -// // #define DEBUG +// #define DEBUG #include "debug.h" #ifndef MAX_ISR_ENTRY @@ -434,14 +435,29 @@ bool pciarb_interrupt_handler(void *arg1, void *arg2) return true; } -bool xlbarb_interrupt_handler(void *arg1, void *arg2) +bool xlbarb_interrupt_handler(void *arg1, void *arg2, ...) { + va_list args; + int i; uint32_t status = MCF_XLB_XARB_SR; + dbg("arg1=0x%08x arg2=0x%08x\r\n", arg1, arg2); + va_start(args, arg2); + for (i = 0; i < 20; i++) + { + dbg("arg[%d]=0x%08x\r\n", i, va_arg(args, int)); + } + va_end(args); + /* * TODO: we should probably issue a bus error when this occors */ - err("XLB arbiter interrupt. XARB_ADRCAP=0x%08lx\r\n", MCF_XLB_XARB_ADRCAP); + err("XLB arbiter interrupt.\r\n"); + err("XARB_ADRCAP=0x%08lx\r\n", MCF_XLB_XARB_ADRCAP); + err("XARB_SIGCAP=0x%08lx\r\n", MCF_XLB_XARB_SIGCAP); + + MCF_XLB_XARB_ADRCAP = 0x0L; + MCF_XLB_XARB_SIGCAP = 0x0L; if (status & MCF_XLB_XARB_SR_AT) err("address tenure timeout\r\n"); diff --git a/sys/sysinit.c b/sys/sysinit.c index 653ab7e..078ce0f 100644 --- a/sys/sysinit.c +++ b/sys/sysinit.c @@ -53,7 +53,7 @@ #include "usb.h" #include "video.h" -#define DEBUG +// #define DEBUG #include "debug.h" #define UNUSED(x) (void)(x) /* Unused variable */ @@ -592,7 +592,7 @@ void init_usb(void) do { - handle = pci_find_classcode(PCI_CLASS_SERIAL_USB | PCI_FIND_BASE_CLASS | PCI_FIND_SUB_CLASS | PCI_FIND_PROG_IF, index++); + handle = pci_find_classcode(PCI_CLASS_SERIAL_USB | PCI_FIND_BASE_CLASS | PCI_FIND_SUB_CLASS, index++); dbg("handle 0x%02x\r\n", handle); if (handle > 0) { diff --git a/usb/usb.c b/usb/usb.c index acb8834..fce1923 100644 --- a/usb/usb.c +++ b/usb/usb.c @@ -54,7 +54,7 @@ #include "usb.h" #include "usb_hub.h" -// #define DEBUG +#define DEBUG #include "debug.h" struct hci diff --git a/video/fnt_st_8x16.c b/video/fnt_st_8x16.c index cc29ab5..1896aed 100644 --- a/video/fnt_st_8x16.c +++ b/video/fnt_st_8x16.c @@ -307,7 +307,7 @@ static const uint16_t dat_table[] = 0x0000, 0x0000, 0x1800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, }; -const struct font_head fnt_st_8x16 = { +static struct font_head fnt_st_8x16 = { 1, /* WORD font_id */ 10, /* WORD point */ "8x16 system font", /* BYTE name[32] */