diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2007-06-25 16:19:48 -0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2007-06-29 02:58:20 -0400 |
commit | ab0f9ad34d1eb31bb13cc4218d7717f8a85b12ed (patch) | |
tree | aa4110045c5089ca0d498bdb32af29f3dfdf1d1a | |
parent | dfac6faf8f42d5a9dd6919d7a2a41ef91eb77b4f (diff) |
[POWERPC] Added indirect_type to handle variants of PCI ops
The generic PCI config ops indirect support for ppc32 covers only two
cases (implicit vs explicit) type 0/1 config cycles via set_cfg_type.
Added a indirect_type bit mask to handle other variants.
Added support for PCI-e extended registers and moved the cfg_type
handling into the bit mask for ARCH=powerpc. We can also use this to
handle indirect quirks.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/sysdev/indirect_pci.c | 22 | ||||
-rw-r--r-- | include/asm-ppc/pci-bridge.h | 10 |
2 files changed, 26 insertions, 6 deletions
diff --git a/arch/powerpc/sysdev/indirect_pci.c b/arch/powerpc/sysdev/indirect_pci.c index efe3cff8dcd1..3a1612253c60 100644 --- a/arch/powerpc/sysdev/indirect_pci.c +++ b/arch/powerpc/sysdev/indirect_pci.c | |||
@@ -33,22 +33,27 @@ indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset, | |||
33 | struct pci_controller *hose = bus->sysdata; | 33 | struct pci_controller *hose = bus->sysdata; |
34 | volatile void __iomem *cfg_data; | 34 | volatile void __iomem *cfg_data; |
35 | u8 cfg_type = 0; | 35 | u8 cfg_type = 0; |
36 | u32 bus_no; | 36 | u32 bus_no, reg; |
37 | 37 | ||
38 | if (ppc_md.pci_exclude_device) | 38 | if (ppc_md.pci_exclude_device) |
39 | if (ppc_md.pci_exclude_device(hose, bus->number, devfn)) | 39 | if (ppc_md.pci_exclude_device(hose, bus->number, devfn)) |
40 | return PCIBIOS_DEVICE_NOT_FOUND; | 40 | return PCIBIOS_DEVICE_NOT_FOUND; |
41 | 41 | ||
42 | if (hose->set_cfg_type) | 42 | if (hose->indirect_type & PPC_INDIRECT_TYPE_SET_CFG_TYPE) |
43 | if (bus->number != hose->first_busno) | 43 | if (bus->number != hose->first_busno) |
44 | cfg_type = 1; | 44 | cfg_type = 1; |
45 | 45 | ||
46 | bus_no = (bus->number == hose->first_busno) ? | 46 | bus_no = (bus->number == hose->first_busno) ? |
47 | hose->self_busno : bus->number; | 47 | hose->self_busno : bus->number; |
48 | 48 | ||
49 | if (hose->indirect_type & PPC_INDIRECT_TYPE_EXT_REG) | ||
50 | reg = ((offset & 0xf00) << 16) | (offset & 0xfc); | ||
51 | else | ||
52 | reg = offset & 0xfc; | ||
53 | |||
49 | PCI_CFG_OUT(hose->cfg_addr, | 54 | PCI_CFG_OUT(hose->cfg_addr, |
50 | (0x80000000 | (bus_no << 16) | 55 | (0x80000000 | (bus_no << 16) |
51 | | (devfn << 8) | ((offset & 0xfc) | cfg_type))); | 56 | | (devfn << 8) | reg | cfg_type)); |
52 | 57 | ||
53 | /* | 58 | /* |
54 | * Note: the caller has already checked that offset is | 59 | * Note: the caller has already checked that offset is |
@@ -76,22 +81,27 @@ indirect_write_config(struct pci_bus *bus, unsigned int devfn, int offset, | |||
76 | struct pci_controller *hose = bus->sysdata; | 81 | struct pci_controller *hose = bus->sysdata; |
77 | volatile void __iomem *cfg_data; | 82 | volatile void __iomem *cfg_data; |
78 | u8 cfg_type = 0; | 83 | u8 cfg_type = 0; |
79 | u32 bus_no; | 84 | u32 bus_no, reg; |
80 | 85 | ||
81 | if (ppc_md.pci_exclude_device) | 86 | if (ppc_md.pci_exclude_device) |
82 | if (ppc_md.pci_exclude_device(hose, bus->number, devfn)) | 87 | if (ppc_md.pci_exclude_device(hose, bus->number, devfn)) |
83 | return PCIBIOS_DEVICE_NOT_FOUND; | 88 | return PCIBIOS_DEVICE_NOT_FOUND; |
84 | 89 | ||
85 | if (hose->set_cfg_type) | 90 | if (hose->indirect_type & PPC_INDIRECT_TYPE_SET_CFG_TYPE) |
86 | if (bus->number != hose->first_busno) | 91 | if (bus->number != hose->first_busno) |
87 | cfg_type = 1; | 92 | cfg_type = 1; |
88 | 93 | ||
89 | bus_no = (bus->number == hose->first_busno) ? | 94 | bus_no = (bus->number == hose->first_busno) ? |
90 | hose->self_busno : bus->number; | 95 | hose->self_busno : bus->number; |
91 | 96 | ||
97 | if (hose->indirect_type & PPC_INDIRECT_TYPE_EXT_REG) | ||
98 | reg = ((offset & 0xf00) << 16) | (offset & 0xfc); | ||
99 | else | ||
100 | reg = offset & 0xfc; | ||
101 | |||
92 | PCI_CFG_OUT(hose->cfg_addr, | 102 | PCI_CFG_OUT(hose->cfg_addr, |
93 | (0x80000000 | (bus_no << 16) | 103 | (0x80000000 | (bus_no << 16) |
94 | | (devfn << 8) | ((offset & 0xfc) | cfg_type))); | 104 | | (devfn << 8) | reg | cfg_type)); |
95 | 105 | ||
96 | /* | 106 | /* |
97 | * Note: the caller has already checked that offset is | 107 | * Note: the caller has already checked that offset is |
diff --git a/include/asm-ppc/pci-bridge.h b/include/asm-ppc/pci-bridge.h index 70aab6691043..0dee56b839a4 100644 --- a/include/asm-ppc/pci-bridge.h +++ b/include/asm-ppc/pci-bridge.h | |||
@@ -65,9 +65,19 @@ struct pci_controller { | |||
65 | /* | 65 | /* |
66 | * If set, indirect method will set the cfg_type bit as | 66 | * If set, indirect method will set the cfg_type bit as |
67 | * needed to generate type 1 configuration transactions. | 67 | * needed to generate type 1 configuration transactions. |
68 | * use only on ARCH=ppc | ||
68 | */ | 69 | */ |
69 | int set_cfg_type; | 70 | int set_cfg_type; |
70 | 71 | ||
72 | /* | ||
73 | * Used for variants of PCI indirect handling and possible quirks: | ||
74 | * SET_CFG_TYPE - used on 4xx or any PHB that does explicit type0/1 | ||
75 | * EXT_REG - provides access to PCI-e extended registers | ||
76 | */ | ||
77 | #define PPC_INDIRECT_TYPE_SET_CFG_TYPE (0x00000001) | ||
78 | #define PPC_INDIRECT_TYPE_EXT_REG (0x00000002) | ||
79 | u32 indirect_type; | ||
80 | |||
71 | /* Currently, we limit ourselves to 1 IO range and 3 mem | 81 | /* Currently, we limit ourselves to 1 IO range and 3 mem |
72 | * ranges since the common pci_bus structure can't handle more | 82 | * ranges since the common pci_bus structure can't handle more |
73 | */ | 83 | */ |