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 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_ */

View File

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

View File

@@ -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)
@@ -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
//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++)
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;
}
@@ -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

View File

@@ -11,6 +11,7 @@
* option any later version.
*/
#include <bas_types.h>
#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);
}

View File

@@ -36,8 +36,9 @@
#include "util.h"
#include "dma.h"
#include "pci.h"
#include <stdarg.h>
// // #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");

View File

@@ -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)
{

View File

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

View File

@@ -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] */