Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 94816
b: refs/heads/master
c: bb63b42
h: refs/heads/master
v: v3
  • Loading branch information
Yinghai Lu authored and Ingo Molnar committed Apr 26, 2008
1 parent 105962c commit c28f99e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 29 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: d2ebdf4bae4f1d7c30e71fd74f270ca4cda024fc
refs/heads/master: bb63b4219976d48ed6d22ac33c18be334fb5a78c
8 changes: 5 additions & 3 deletions trunk/arch/x86/pci/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ void __init pci_direct_init(int type)
{
if (type == 0)
return;
printk(KERN_INFO "PCI: Using configuration type %d\n", type);
printk(KERN_INFO "PCI: Using configuration type %d for base access\n",
type);
if (type == 1)
raw_pci_ops = &pci_direct_conf1;
else
Expand All @@ -275,8 +276,10 @@ int __init pci_direct_probe(void)
if (!region)
goto type2;

if (pci_check_type1())
if (pci_check_type1()) {
raw_pci_ops = &pci_direct_conf1;
return 1;
}
release_resource(region);

type2:
Expand All @@ -290,7 +293,6 @@ int __init pci_direct_probe(void)
goto fail2;

if (pci_check_type2()) {
printk(KERN_INFO "PCI: Using configuration type 2\n");
raw_pci_ops = &pci_direct_conf2;
return 2;
}
Expand Down
11 changes: 5 additions & 6 deletions trunk/arch/x86/pci/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
in the right sequence from here. */
static __init int pci_access_init(void)
{
int type __maybe_unused = 0;

#ifdef CONFIG_PCI_DIRECT
int type = 0;

type = pci_direct_probe();
#endif
pci_mmcfg_early_init(type);
if (raw_pci_ops)
return 0;
pci_mmcfg_early_init();

#ifdef CONFIG_PCI_BIOS
pci_pcbios_init();
#endif
Expand All @@ -26,7 +25,7 @@ static __init int pci_access_init(void)
#ifdef CONFIG_PCI_DIRECT
pci_direct_init(type);
#endif
if (!raw_pci_ops)
if (!raw_pci_ops && !raw_pci_ext_ops)
printk(KERN_ERR
"PCI: Fatal: No config space access function found\n");

Expand Down
32 changes: 15 additions & 17 deletions trunk/arch/x86/pci/mmconfig-shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static int __initdata pci_mmcfg_resources_inserted;
static const char __init *pci_mmcfg_e7520(void)
{
u32 win;
pci_direct_conf1.read(0, 0, PCI_DEVFN(0,0), 0xce, 2, &win);
raw_pci_ops->read(0, 0, PCI_DEVFN(0, 0), 0xce, 2, &win);

win = win & 0xf000;
if(win == 0x0000 || win == 0xf000)
Expand All @@ -53,7 +53,7 @@ static const char __init *pci_mmcfg_intel_945(void)

pci_mmcfg_config_num = 1;

pci_direct_conf1.read(0, 0, PCI_DEVFN(0,0), 0x48, 4, &pciexbar);
raw_pci_ops->read(0, 0, PCI_DEVFN(0, 0), 0x48, 4, &pciexbar);

/* Enable bit */
if (!(pciexbar & 1))
Expand Down Expand Up @@ -179,14 +179,17 @@ static int __init pci_mmcfg_check_hostbridge(void)
int i;
const char *name;

if (!raw_pci_ops)
return 0;

pci_mmcfg_config_num = 0;
pci_mmcfg_config = NULL;
name = NULL;

for (i = 0; !name && i < ARRAY_SIZE(pci_mmcfg_probes); i++) {
bus = pci_mmcfg_probes[i].bus;
devfn = pci_mmcfg_probes[i].devfn;
pci_direct_conf1.read(0, bus, devfn, 0, 4, &l);
raw_pci_ops->read(0, bus, devfn, 0, 4, &l);
vendor = l & 0xffff;
device = (l >> 16) & 0xffff;

Expand Down Expand Up @@ -304,7 +307,7 @@ static int __init is_acpi_reserved(unsigned long start, unsigned long end)
return mcfg_res.flags;
}

static void __init pci_mmcfg_reject_broken(int type, int early)
static void __init pci_mmcfg_reject_broken(int early)
{
typeof(pci_mmcfg_config[0]) *cfg;
int i;
Expand Down Expand Up @@ -342,8 +345,8 @@ static void __init pci_mmcfg_reject_broken(int type, int early)
" reserved in ACPI motherboard resources\n",
cfg->address);
/* Don't try to do this check unless configuration
type 1 is available. */
if (type == 1 && e820_all_mapped(cfg->address,
type 1 is available. how about type 2 ?*/
if (raw_pci_ops && e820_all_mapped(cfg->address,
cfg->address + size - 1,
E820_RESERVED)) {
printk(KERN_NOTICE
Expand All @@ -368,7 +371,7 @@ static void __init pci_mmcfg_reject_broken(int type, int early)

static int __initdata known_bridge;

void __init __pci_mmcfg_init(int type, int early)
void __init __pci_mmcfg_init(int early)
{
/* MMCONFIG disabled */
if ((pci_probe & PCI_PROBE_MMCONF) == 0)
Expand All @@ -382,14 +385,14 @@ void __init __pci_mmcfg_init(int type, int early)
if (known_bridge)
return;

if (early && type == 1) {
if (early) {
if (pci_mmcfg_check_hostbridge())
known_bridge = 1;
}

if (!known_bridge) {
acpi_table_parse(ACPI_SIG_MCFG, acpi_parse_mcfg);
pci_mmcfg_reject_broken(type, early);
pci_mmcfg_reject_broken(early);
}

if ((pci_mmcfg_config_num == 0) ||
Expand All @@ -410,19 +413,14 @@ void __init __pci_mmcfg_init(int type, int early)
}
}

void __init pci_mmcfg_early_init(int type)
void __init pci_mmcfg_early_init(void)
{
__pci_mmcfg_init(type, 1);
__pci_mmcfg_init(1);
}

void __init pci_mmcfg_late_init(void)
{
int type = 0;

if (pci_probe & PCI_PROBE_CONF1)
type = 1;

__pci_mmcfg_init(type, 0);
__pci_mmcfg_init(0);
}

static int __init pci_mmcfg_late_insert_resources(void)
Expand Down
4 changes: 2 additions & 2 deletions trunk/include/linux/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -1055,10 +1055,10 @@ extern unsigned long pci_cardbus_mem_size;
extern int pcibios_add_platform_entries(struct pci_dev *dev);

#ifdef CONFIG_PCI_MMCONFIG
extern void __init pci_mmcfg_early_init(int type);
extern void __init pci_mmcfg_early_init(void);
extern void __init pci_mmcfg_late_init(void);
#else
static inline void pci_mmcfg_early_init(int type) { }
static inline void pci_mmcfg_early_init(void) { }
static inline void pci_mmcfg_late_init(void) { }
#endif

Expand Down

0 comments on commit c28f99e

Please sign in to comment.