diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2006-08-16 08:04:14 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-08-24 23:27:35 -0400 |
commit | 6f3d5d3cc4b1447578ae8484166bbc34a64150c5 (patch) | |
tree | 3641fb3b82081252fcb67cb8d2c66eb4d877e25c /arch/powerpc/kernel/rtas_pci.c | |
parent | a0a428e30077fd64c39aadf5221cf2c7a14dc281 (diff) |
[POWERPC] Add a helper for calculating RTAS "config_addr" parameters
Several RTAS calls take a "config_addr" parameter, which is a particular
way of specifying a PCI busno, devfn and register number into a 32-bit word.
Currently these are open-coded, and I'll be adding another soon, replace
them with a helper that encapsulates the logic. Be more strict about masking
the busno too, just in case.
Booted on P5 LPAR.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/rtas_pci.c')
-rw-r--r-- | arch/powerpc/kernel/rtas_pci.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c index 5a798ac6aecf..b4a0de79c060 100644 --- a/arch/powerpc/kernel/rtas_pci.c +++ b/arch/powerpc/kernel/rtas_pci.c | |||
@@ -81,8 +81,7 @@ int rtas_read_config(struct pci_dn *pdn, int where, int size, u32 *val) | |||
81 | if (!config_access_valid(pdn, where)) | 81 | if (!config_access_valid(pdn, where)) |
82 | return PCIBIOS_BAD_REGISTER_NUMBER; | 82 | return PCIBIOS_BAD_REGISTER_NUMBER; |
83 | 83 | ||
84 | addr = ((where & 0xf00) << 20) | (pdn->busno << 16) | | 84 | addr = rtas_config_addr(pdn->busno, pdn->devfn, where); |
85 | (pdn->devfn << 8) | (where & 0xff); | ||
86 | buid = pdn->phb->buid; | 85 | buid = pdn->phb->buid; |
87 | if (buid) { | 86 | if (buid) { |
88 | ret = rtas_call(ibm_read_pci_config, 4, 2, &returnval, | 87 | ret = rtas_call(ibm_read_pci_config, 4, 2, &returnval, |
@@ -134,8 +133,7 @@ int rtas_write_config(struct pci_dn *pdn, int where, int size, u32 val) | |||
134 | if (!config_access_valid(pdn, where)) | 133 | if (!config_access_valid(pdn, where)) |
135 | return PCIBIOS_BAD_REGISTER_NUMBER; | 134 | return PCIBIOS_BAD_REGISTER_NUMBER; |
136 | 135 | ||
137 | addr = ((where & 0xf00) << 20) | (pdn->busno << 16) | | 136 | addr = rtas_config_addr(pdn->busno, pdn->devfn, where); |
138 | (pdn->devfn << 8) | (where & 0xff); | ||
139 | buid = pdn->phb->buid; | 137 | buid = pdn->phb->buid; |
140 | if (buid) { | 138 | if (buid) { |
141 | ret = rtas_call(ibm_write_pci_config, 5, 1, NULL, addr, | 139 | ret = rtas_call(ibm_write_pci_config, 5, 1, NULL, addr, |