working on USB device scan

This commit is contained in:
Markus Fröschle
2014-10-03 09:58:45 +00:00
parent b1c2026746
commit 342c3cd34a
8 changed files with 331 additions and 299 deletions

View File

@@ -33,7 +33,7 @@
#include "interrupts.h"
#include "wait.h"
//#define DEBUG_PCI
#define DEBUG_PCI
#ifdef DEBUG_PCI
#define dbg(format, arg...) do { xprintf("DEBUG: %s(): " format, __FUNCTION__, ##arg); } while (0)
#else
@@ -184,7 +184,7 @@ static int32_t pci_get_interrupt_cause(int32_t *handles)
return handle;
}
}
dbg("%s: no interrupt cause found\r\n");
dbg("no interrupt cause found\r\n");
return -1;
}
@@ -224,7 +224,7 @@ void irq5_handler(void)
newvalue = pci_call_interrupt_chain(handle, value);
if (newvalue == value)
{
dbg("%s: interrupt not handled!\r\n");
dbg("interrupt not handled!\r\n");
}
}
}
@@ -247,7 +247,7 @@ void irq7_handler(void)
newvalue = pci_call_interrupt_chain(handle, value);
if (newvalue == value)
{
dbg("%s: interrupt not handled!\r\n");
dbg("interrupt not handled!\r\n");
}
}
}
@@ -878,7 +878,7 @@ static void pci_device_config(uint16_t bus, uint16_t device, uint16_t function)
*/
struct pci_rd *rd = &descriptors[barnum];
dbg("%s: address = %08x\r\n", address);
dbg("address = %08x\r\n", address);
if (IS_PCI_MEM_BAR(address))
{
/* adjust base address to card's alignment requirements */
@@ -967,10 +967,10 @@ static void pci_device_config(uint16_t bus, uint16_t device, uint16_t function)
/* write it to PCIERBAR and enable ROM */
pci_write_config_longword(handle, PCIERBAR, swpl(address | 1));
dbg("%s: set PCIERBAR on device 0x%02x to 0x%08x\r\n", handle, address | 1);
dbg("set PCIERBAR on device 0x%02x to 0x%08x\r\n", handle, address | 1);
/* read value back just to be sure */
dbg("%s: PCIERBAR = %p\r\n", swpl(pci_read_config_longword(handle, PCIERBAR)));
dbg("PCIERBAR = %p\r\n", swpl(pci_read_config_longword(handle, PCIERBAR)));
rd->next = sizeof(struct pci_rd);
@@ -1224,8 +1224,10 @@ void init_pci(void)
/* initialize/clear resource descriptor table */
memset(&resource_descriptors, 0, NUM_CARDS * NUM_RESOURCES * sizeof(struct pci_rd));
/* initialize/clear handles array */
memset(handles, 0, NUM_CARDS * sizeof(int32_t));
/* initialize/clear interrupts array */
memset(interrupts, 0, MAX_INTERRUPTS * sizeof(struct pci_interrupt));
@@ -1233,7 +1235,7 @@ void init_pci(void)
* give devices a chance to come up befor attempting to configure them,
* necessary to properly detect the FireBee USB chip
*/
wait(400000);
wait(600000);
/*
* do normal initialization