Commit 69d423da authored by Paul Mackerras's avatar Paul Mackerras Committed by Tom Rini

PPC32: allow for host bridges that have a type field in the addr word.

Some host bridges that use the indirect (addr and data registers)
method of access have a field that needs to be set to 0 for accesses
to the primary bus and 1 for accesses to subordinate buses.  This
change allows for that.
parent 55c34911
...@@ -27,13 +27,18 @@ indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset, ...@@ -27,13 +27,18 @@ indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
{ {
struct pci_controller *hose = bus->sysdata; struct pci_controller *hose = bus->sysdata;
volatile unsigned char *cfg_data; volatile unsigned char *cfg_data;
u8 cfg_type = 0;
if (ppc_md.pci_exclude_device) if (ppc_md.pci_exclude_device)
if (ppc_md.pci_exclude_device(bus->number, devfn)) if (ppc_md.pci_exclude_device(bus->number, devfn))
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
if (hose->set_cfg_type)
if (bus->number != hose->first_busno)
cfg_type = 1;
out_be32(hose->cfg_addr, out_be32(hose->cfg_addr,
((offset & 0xfc) << 24) | (devfn << 16) (((offset & 0xfc) | cfg_type) << 24) | (devfn << 16)
| ((bus->number - hose->bus_offset) << 8) | 0x80); | ((bus->number - hose->bus_offset) << 8) | 0x80);
/* /*
* Note: the caller has already checked that offset is * Note: the caller has already checked that offset is
...@@ -60,13 +65,18 @@ indirect_write_config(struct pci_bus *bus, unsigned int devfn, int offset, ...@@ -60,13 +65,18 @@ indirect_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
{ {
struct pci_controller *hose = bus->sysdata; struct pci_controller *hose = bus->sysdata;
volatile unsigned char *cfg_data; volatile unsigned char *cfg_data;
u8 cfg_type = 0;
if (ppc_md.pci_exclude_device) if (ppc_md.pci_exclude_device)
if (ppc_md.pci_exclude_device(bus->number, devfn)) if (ppc_md.pci_exclude_device(bus->number, devfn))
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
if (hose->set_cfg_type)
if (bus->number != hose->first_busno)
cfg_type = 1;
out_be32(hose->cfg_addr, out_be32(hose->cfg_addr,
((offset & 0xfc) << 24) | (devfn << 16) (((offset & 0xfc) | cfg_type) << 24) | (devfn << 16)
| ((bus->number - hose->bus_offset) << 8) | 0x80); | ((bus->number - hose->bus_offset) << 8) | 0x80);
/* /*
* Note: the caller has already checked that offset is * Note: the caller has already checked that offset is
......
...@@ -68,6 +68,11 @@ struct pci_controller { ...@@ -68,6 +68,11 @@ struct pci_controller {
struct pci_ops *ops; struct pci_ops *ops;
volatile unsigned int *cfg_addr; volatile unsigned int *cfg_addr;
volatile unsigned char *cfg_data; volatile unsigned char *cfg_data;
/*
* If set, indirect method will set the cfg_type bit as
* needed to generate type 1 configuration transactions.
*/
int set_cfg_type;
/* Currently, we limit ourselves to 1 IO range and 3 mem /* Currently, we limit ourselves to 1 IO range and 3 mem
* ranges since the common pci_bus structure can't handle more * ranges since the common pci_bus structure can't handle more
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment