fix hang in USB interrupt (disabled for now)

This commit is contained in:
Markus Fröschle
2016-12-11 10:35:51 +00:00
parent 7161ed3b55
commit 8e768bc746
9 changed files with 145 additions and 127 deletions

View File

@@ -144,7 +144,7 @@ extern bool isr_execute_handler(int vector);
extern bool pic_interrupt_handler(void *arg1, void *arg2); extern bool pic_interrupt_handler(void *arg1, void *arg2);
extern bool xlbpci_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 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 gpt0_interrupt_handler(void *arg1, void *arg2);
extern bool irq5_handler(void *arg1, void *arg2); extern bool irq5_handler(void *arg1, void *arg2);
#endif /* _INTERRUPTS_H_ */ #endif /* _INTERRUPTS_H_ */

View File

@@ -12,7 +12,7 @@
#include "wait.h" #include "wait.h"
#include "video.h" #include "video.h"
#define RADEON_TILING // #define RADEON_TILING
//#include "radeon_theatre.h" //#include "radeon_theatre.h"

View File

@@ -34,7 +34,7 @@
#include "interrupts.h" #include "interrupts.h"
#include "wait.h" #include "wait.h"
#define DEBUG // #define DEBUG
#include "debug.h" #include "debug.h"
#define pci_config_wait() do { __asm__ __volatile("tpf" ::: "memory"); } while (0) #define pci_config_wait() do { __asm__ __volatile("tpf" ::: "memory"); } while (0)
@@ -48,25 +48,25 @@ static struct pci_class
char *description; char *description;
} pci_classes[] = } pci_classes[] =
{ {
{ 0x00, "device was built prior definition of the class code field" }, { 0x00, "device was built prior definition of the class code field" },
{ 0x01, "Mass Storage Controller" }, { 0x01, "Mass Storage Controller" },
{ 0x02, "Network Controller" }, { 0x02, "Network Controller" },
{ 0x03, "Display Controller" }, { 0x03, "Display Controller" },
{ 0x04, "Multimedia Controller" }, { 0x04, "Multimedia Controller" },
{ 0x05, "Memory Controller" }, { 0x05, "Memory Controller" },
{ 0x06, "Bridge Device" }, { 0x06, "Bridge Device" },
{ 0x07, "Simple Communication Controller" }, { 0x07, "Simple Communication Controller" },
{ 0x08, "Base System Peripherial" }, { 0x08, "Base System Peripherial" },
{ 0x09, "Input Device" }, { 0x09, "Input Device" },
{ 0x0a, "Docking Station" }, { 0x0a, "Docking Station" },
{ 0x0b, "Processor" }, { 0x0b, "Processor" },
{ 0x0c, "Serial Bus Controller" }, { 0x0c, "Serial Bus Controller" },
{ 0x0d, "Wireless Controller" }, { 0x0d, "Wireless Controller" },
{ 0x0e, "Intelligent I/O Controller" }, { 0x0e, "Intelligent I/O Controller" },
{ 0x0f, "Satellite Communication Controller" }, { 0x0f, "Satellite Communication Controller" },
{ 0x10, "Encryption/Decryption Controller" }, { 0x10, "Encryption/Decryption Controller" },
{ 0x11, "Data Acquisition and Signal Processing Controller" }, { 0x11, "Data Acquisition and Signal Processing Controller" },
{ 0xff, "Device does not fit any defined class" }, { 0xff, "Device does not fit any defined class" },
}; };
static int num_pci_classes = sizeof(pci_classes) / sizeof(struct pci_class); static int num_pci_classes = sizeof(pci_classes) / sizeof(struct pci_class);
@@ -509,22 +509,25 @@ static bool match_classcode(uint32_t handle, uint32_t classcode)
uint32_t value = swpl(pci_read_config_longword(handle, PCICCR)); uint32_t value = swpl(pci_read_config_longword(handle, PCICCR));
int i; 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 */ for (i = 0; i < 3; i++) /* loop through mask */
{ {
if ((find_mask >> i) & 1) if ((find_mask >> i) & 1)
{ {
dbg("compare 0x%02x against 0x%02x\r\n", value & 0xff, classcode & 0xff); //dbg("compare 0x%02x against 0x%02x\r\n", value & 0xff, classcode & 0xff);
if (! ((value & 0xff) == classcode & 0xff)) if ((value & 0xff) != (classcode & 0xff))
return false; return false;
else //dbg("match\r\n");
classcode >>= 8; classcode >>= 8;
} }
value >>= 8; value >>= 8;
//dbg("value=0x%08x\r\n", value);
} }
dbg("return true\r\n");
return true; return true;
} }
@@ -540,18 +543,21 @@ int32_t pci_find_classcode(uint32_t classcode, int index)
{ {
int i; int i;
uint32_t handle; uint32_t handle;
int n = 0; 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; return handle;
else else
n++; n++;
} while (n < index); }
}
dbg("not found\r\n");
return PCI_DEVICE_NOT_FOUND; return PCI_DEVICE_NOT_FOUND;
} }
@@ -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)); il = pci_read_config_byte(handle, PCI_LANESWAP_B(PCIIPR));
dbg("device requests interrupts on interrupt pin %d\r\n", il); 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 * enable device memory or I/O access
@@ -1039,11 +1045,11 @@ void init_eport(void)
/* configure IRQ1-7 pins on EPORT falling edge triggered */ /* configure IRQ1-7 pins on EPORT falling edge triggered */
MCF_EPORT_EPPAR = MCF_EPORT_EPPAR_EPPA7(MCF_EPORT_EPPAR_FALLING) | MCF_EPORT_EPPAR = MCF_EPORT_EPPAR_EPPA7(MCF_EPORT_EPPAR_FALLING) |
MCF_EPORT_EPPAR_EPPA6(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) | MCF_EPORT_EPPAR_EPPA5(MCF_EPORT_EPPAR_LEVEL) |
#elif defined(MACHINE_M5484LITE) #elif defined(MACHINE_M5484LITE)
MCF_EPORT_EPPAR_EPPA5(MCF_EPORT_EPPAR_FALLING) | 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_EPPA4(MCF_EPORT_EPPAR_FALLING) |
MCF_EPORT_EPPAR_EPPA3(MCF_EPORT_EPPAR_FALLING) | MCF_EPORT_EPPAR_EPPA3(MCF_EPORT_EPPAR_FALLING) |
MCF_EPORT_EPPAR_EPPA2(MCF_EPORT_EPPAR_FALLING) | MCF_EPORT_EPPAR_EPPA2(MCF_EPORT_EPPAR_FALLING) |

View File

@@ -11,6 +11,7 @@
* option any later version. * option any later version.
*/ */
#include <bas_types.h> #include <bas_types.h>
#include "bas_string.h" #include "bas_string.h"
#include "bas_printf.h" #include "bas_printf.h"
@@ -27,13 +28,8 @@
#error "unknown machine!" #error "unknown machine!"
#endif #endif
//#define DBG_DM // #define DEBUG
#ifdef DBG_DM #include "debug.h"
#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)
extern long offscren_reserved(void); extern long offscren_reserved(void);
@@ -259,7 +255,7 @@ int32_t driver_mem_free(void *addr)
freeit(p, mpb); freeit(p, mpb);
set_ipl(level); set_ipl(level);
dbg("%s: driver_mem_free(0x%08X)\r\n", __FUNCTION__, addr); dbg("addr=0x%08X)\r\n", addr);
return(0); return(0);
} }
@@ -293,7 +289,7 @@ void *driver_mem_alloc(uint32_t amount)
ret = (void *) m->m_start; ret = (void *) m->m_start;
} }
set_ipl(level); 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; return ret;
} }
@@ -304,7 +300,7 @@ int driver_mem_init(void)
{ {
if (use_count == 0) 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); memset(driver_mem_buffer, 0, DRIVER_MEM_BUFFER_SIZE);
pmd.mp_mfl = pmd.mp_rover = &tab_md[0]; pmd.mp_mfl = pmd.mp_rover = &tab_md[0];
@@ -315,10 +311,10 @@ int driver_mem_init(void)
pmd.mp_mal = (MD *) NULL; pmd.mp_mal = (MD *) NULL;
memset(driver_mem_buffer, 0, tab_md[0].m_length); 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++; 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; return 0;
} }
@@ -335,7 +331,7 @@ void driver_mem_release(void)
#endif #endif
#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);
} }

View File

@@ -268,7 +268,7 @@ _std_exc_vec:
movem.l d0/a5,(sp) // save registers movem.l d0/a5,(sp) // save registers
move.w 8(sp),d0 // fetch vector move.w 8(sp),d0 // fetch vector
and.l #0x3fc,d0 // mask out vector number and.l #0x3fc,d0 // mask out vector number
//#define DBG_EXC // #define DBG_EXC
#ifdef DBG_EXC #ifdef DBG_EXC
// printout vector number of exception // printout vector number of exception

View File

@@ -36,8 +36,9 @@
#include "util.h" #include "util.h"
#include "dma.h" #include "dma.h"
#include "pci.h" #include "pci.h"
#include <stdarg.h>
// // #define DEBUG // #define DEBUG
#include "debug.h" #include "debug.h"
#ifndef MAX_ISR_ENTRY #ifndef MAX_ISR_ENTRY
@@ -434,14 +435,29 @@ bool pciarb_interrupt_handler(void *arg1, void *arg2)
return true; 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; 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 * 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) if (status & MCF_XLB_XARB_SR_AT)
err("address tenure timeout\r\n"); err("address tenure timeout\r\n");

View File

@@ -53,7 +53,7 @@
#include "usb.h" #include "usb.h"
#include "video.h" #include "video.h"
#define DEBUG // #define DEBUG
#include "debug.h" #include "debug.h"
#define UNUSED(x) (void)(x) /* Unused variable */ #define UNUSED(x) (void)(x) /* Unused variable */
@@ -592,7 +592,7 @@ void init_usb(void)
do 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); dbg("handle 0x%02x\r\n", handle);
if (handle > 0) if (handle > 0)
{ {

View File

@@ -54,7 +54,7 @@
#include "usb.h" #include "usb.h"
#include "usb_hub.h" #include "usb_hub.h"
// #define DEBUG #define DEBUG
#include "debug.h" #include "debug.h"
struct hci struct hci

View File

@@ -307,7 +307,7 @@ static const uint16_t dat_table[] =
0x0000, 0x0000, 0x1800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 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 */ 1, /* WORD font_id */
10, /* WORD point */ 10, /* WORD point */
"8x16 system font", /* BYTE name[32] */ "8x16 system font", /* BYTE name[32] */