Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 102258
b: refs/heads/master
c: 15650a2
h: refs/heads/master
v: v3
  • Loading branch information
Jesse Barnes authored and Jesse Barnes committed Jun 16, 2008
1 parent 3426ac8 commit 39617f4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d8f3de0d2412bb91639cfefc5b3c79dbf3812212
refs/heads/master: 15650a2f644a2f15738cf22807c090d89328f500
26 changes: 21 additions & 5 deletions trunk/arch/x86/kernel/early-quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,18 @@ static struct chipset early_qrk[] __initdata = {
{}
};

static void __init check_dev_quirk(int num, int slot, int func)
/**
* check_dev_quirk - apply early quirks to a given PCI device
* @num: bus number
* @slot: slot number
* @func: PCI function
*
* Check the vendor & device ID against the early quirks table.
*
* If the device is single function, let early_quirks() know so we don't
* poke at this device again.
*/
static int __init check_dev_quirk(int num, int slot, int func)
{
u16 class;
u16 vendor;
Expand All @@ -144,7 +155,7 @@ static void __init check_dev_quirk(int num, int slot, int func)
class = read_pci_config_16(num, slot, func, PCI_CLASS_DEVICE);

if (class == 0xffff)
return;
return -1; /* no class, treat as single function */

vendor = read_pci_config_16(num, slot, func, PCI_VENDOR_ID);

Expand All @@ -167,7 +178,9 @@ static void __init check_dev_quirk(int num, int slot, int func)
type = read_pci_config_byte(num, slot, func,
PCI_HEADER_TYPE);
if (!(type & 0x80))
return;
return -1;

return 0;
}

void __init early_quirks(void)
Expand All @@ -180,6 +193,9 @@ void __init early_quirks(void)
/* Poor man's PCI discovery */
for (num = 0; num < 32; num++)
for (slot = 0; slot < 32; slot++)
for (func = 0; func < 8; func++)
check_dev_quirk(num, slot, func);
for (func = 0; func < 8; func++) {
/* Only probe function 0 on single fn devices */
if (check_dev_quirk(num, slot, func))
break;
}
}

0 comments on commit 39617f4

Please sign in to comment.