Improved debug messages.

Prevented find_pci_device() from being an endless loop.
This commit is contained in:
Michael Brown
2005-04-16 09:57:19 +00:00
parent 25d82dac7a
commit 211a607147

View File

@@ -73,7 +73,7 @@ static int fill_pci_device ( struct pci_device *pci ) {
pci_read_config_byte ( pci, PCI_INTERRUPT_LINE, &pci->irq ); pci_read_config_byte ( pci, PCI_INTERRUPT_LINE, &pci->irq );
} }
DBG ( "PCI found %hhx:%hhx.%d Class %hx: %hx:%hx (rev %hhx)\n", DBG ( "PCI found device %hhx:%hhx.%d Class %hx: %hx:%hx (rev %hhx)\n",
PCI_BUS ( pci->busdevfn ), PCI_DEV ( pci->busdevfn ), PCI_BUS ( pci->busdevfn ), PCI_DEV ( pci->busdevfn ),
PCI_FUNC ( pci->busdevfn ), pci->class, pci->vendor, pci->dev_id, PCI_FUNC ( pci->busdevfn ), pci->class, pci->vendor, pci->dev_id,
pci->revision ); pci->revision );
@@ -92,7 +92,7 @@ void adjust_pci_device ( struct pci_device *pci ) {
pci_read_config_word ( pci, PCI_COMMAND, &pci_command ); pci_read_config_word ( pci, PCI_COMMAND, &pci_command );
new_command = pci_command | PCI_COMMAND_MASTER | PCI_COMMAND_IO; new_command = pci_command | PCI_COMMAND_MASTER | PCI_COMMAND_IO;
if ( pci_command != new_command ) { if ( pci_command != new_command ) {
DBG ( "%hhx:%hhx.%d : PCI BIOS has not enabled this device! " DBG ( "PCI BIOS has not enabled device %hhx:%hhx.%d! "
"Updating PCI command %hX->%hX\n", "Updating PCI command %hX->%hX\n",
PCI_BUS ( pci->busdevfn ), PCI_DEV ( pci->busdevfn ), PCI_BUS ( pci->busdevfn ), PCI_DEV ( pci->busdevfn ),
PCI_FUNC ( pci->busdevfn ), pci_command, new_command ); PCI_FUNC ( pci->busdevfn ), pci_command, new_command );
@@ -100,8 +100,8 @@ void adjust_pci_device ( struct pci_device *pci ) {
} }
pci_read_config_byte ( pci, PCI_LATENCY_TIMER, &pci_latency); pci_read_config_byte ( pci, PCI_LATENCY_TIMER, &pci_latency);
if ( pci_latency < 32 ) { if ( pci_latency < 32 ) {
DBG ( "%hhx:%hhx.%d : PCI latency timer (CFLT) " DBG ( "PCI device %hhx:%hhx.%d latency timer is "
"is unreasonably low at %d. Setting to 32.\n", "unreasonably low at %d. Setting to 32.\n",
PCI_BUS ( pci->busdevfn ), PCI_DEV ( pci->busdevfn ), PCI_BUS ( pci->busdevfn ), PCI_DEV ( pci->busdevfn ),
PCI_FUNC ( pci->busdevfn ), pci_latency ); PCI_FUNC ( pci->busdevfn ), pci_latency );
pci_write_config_byte ( pci, PCI_LATENCY_TIMER, 32); pci_write_config_byte ( pci, PCI_LATENCY_TIMER, 32);
@@ -139,7 +139,8 @@ int find_pci_device ( struct pci_device *pci,
/* Iterate through all possible PCI bus:dev.fn combinations, /* Iterate through all possible PCI bus:dev.fn combinations,
* starting where we left off. * starting where we left off.
*/ */
for ( ; pci->busdevfn <= 0xffff ; pci->busdevfn++ ) { DBG ( "PCI searching for device matching driver %s\n", driver->name );
do {
/* If we've already used this device, skip it */ /* If we've already used this device, skip it */
if ( pci->already_tried ) { if ( pci->already_tried ) {
pci->already_tried = 0; pci->already_tried = 0;
@@ -157,8 +158,8 @@ int find_pci_device ( struct pci_device *pci,
/* If driver has a class, and class matches, use it */ /* If driver has a class, and class matches, use it */
if ( driver->class && if ( driver->class &&
( driver->class == pci->class ) ) { ( driver->class == pci->class ) ) {
DBG ( "Driver %s matches class %hx\n", DBG ( "PCI found class %hx matching driver %s\n",
driver->name, driver->class ); driver->class, driver->name );
pci->name = driver->name; pci->name = driver->name;
pci->already_tried = 1; pci->already_tried = 1;
return 1; return 1;
@@ -170,17 +171,16 @@ int find_pci_device ( struct pci_device *pci,
if ( ( pci->vendor == id->vendor ) && if ( ( pci->vendor == id->vendor ) &&
( pci->dev_id == id->dev_id ) ) { ( pci->dev_id == id->dev_id ) ) {
DBG ( "Device %s (driver %s) matches " DBG ( "PCI found ID %hx:%hx (device %s) "
"ID %hx:%hx\n", id->name, driver->name, "matching driver %s\n", id->vendor,
id->vendor, id->dev_id ); id->dev_id, id->name, driver->name );
pci->name = id->name; pci->name = id->name;
pci->already_tried = 1; pci->already_tried = 1;
return 1; return 1;
} }
} }
} while ( ++pci->busdevfn );
DBG ( "No match in driver %s\n", driver->name ); DBG ( "PCI failed to find device matching driver %s\n", driver->name );
}
/* No device found */ /* No device found */
return 0; return 0;