-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 181160 b: refs/heads/master c: 85b59f5 h: refs/heads/master v: v3
- Loading branch information
Paul Mundt
committed
Feb 1, 2010
1 parent
25a8179
commit ed9b27c
Showing
6 changed files
with
99 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: aee4467b5ce5047401efb4175b1360ec1734affc | ||
refs/heads/master: 85b59f5bb24aeca1a987cbb206e228bf630c8327 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#include <linux/pci.h> | ||
#include <linux/kernel.h> | ||
|
||
static int __init | ||
early_read_config_word(struct pci_channel *hose, | ||
int top_bus, int bus, int devfn, int offset, u16 *value) | ||
{ | ||
struct pci_dev fake_dev; | ||
struct pci_bus fake_bus; | ||
|
||
fake_dev.bus = &fake_bus; | ||
fake_dev.sysdata = hose; | ||
fake_dev.devfn = devfn; | ||
fake_bus.number = bus; | ||
fake_bus.sysdata = hose; | ||
fake_bus.ops = hose->pci_ops; | ||
|
||
if (bus != top_bus) | ||
/* Fake a parent bus structure. */ | ||
fake_bus.parent = &fake_bus; | ||
else | ||
fake_bus.parent = NULL; | ||
|
||
return pci_read_config_word(&fake_dev, offset, value); | ||
} | ||
|
||
int __init pci_is_66mhz_capable(struct pci_channel *hose, | ||
int top_bus, int current_bus) | ||
{ | ||
u32 pci_devfn; | ||
unsigned short vid; | ||
int cap66 = -1; | ||
u16 stat; | ||
|
||
printk(KERN_INFO "PCI: Checking 66MHz capabilities...\n"); | ||
|
||
for (pci_devfn = 0; pci_devfn < 0xff; pci_devfn++) { | ||
if (PCI_FUNC(pci_devfn)) | ||
continue; | ||
if (early_read_config_word(hose, top_bus, current_bus, | ||
pci_devfn, PCI_VENDOR_ID, &vid) != | ||
PCIBIOS_SUCCESSFUL) | ||
continue; | ||
if (vid == 0xffff) | ||
continue; | ||
|
||
/* check 66MHz capability */ | ||
if (cap66 < 0) | ||
cap66 = 1; | ||
if (cap66) { | ||
early_read_config_word(hose, top_bus, current_bus, | ||
pci_devfn, PCI_STATUS, &stat); | ||
if (!(stat & PCI_STATUS_66MHZ)) { | ||
printk(KERN_DEBUG | ||
"PCI: %02x:%02x not 66MHz capable.\n", | ||
current_bus, pci_devfn); | ||
cap66 = 0; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
return cap66 > 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters