提交 8cfaf453 编写于 作者: G Giuseppe Sacco 提交者: Ralf Baechle

[MIPS] IP32: Enable PCI bridges

Fixe MACE PCI addressing by adding the bus number parameter.
Remove check of the used slot since every slot should be valid.
Converted mkaddr from #define to inline function.
Signed-off-by: NGiuseppe Sacco <eppesuig@debian.org>
Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
上级 804b3f9a
...@@ -29,22 +29,20 @@ ...@@ -29,22 +29,20 @@
* 4 N/C * 4 N/C
*/ */
#define chkslot(_bus,_devfn) \ static inline int mkaddr(struct pci_bus *bus, unsigned int devfn,
do { \ unsigned int reg)
if ((_bus)->number > 0 || PCI_SLOT (_devfn) < 1 \ {
|| PCI_SLOT (_devfn) > 3) \ return ((bus->number & 0xff) << 16) |
return PCIBIOS_DEVICE_NOT_FOUND; \ (devfn & 0xff) << 8) |
} while (0) (reg & 0xfc);
}
#define mkaddr(_devfn, _reg) \
((((_devfn) & 0xffUL) << 8) | ((_reg) & 0xfcUL))
static int static int
mace_pci_read_config(struct pci_bus *bus, unsigned int devfn, mace_pci_read_config(struct pci_bus *bus, unsigned int devfn,
int reg, int size, u32 *val) int reg, int size, u32 *val)
{ {
chkslot(bus, devfn); mace->pci.config_addr = mkaddr(bus, devfn, reg);
mace->pci.config_addr = mkaddr(devfn, reg);
switch (size) { switch (size) {
case 1: case 1:
*val = mace->pci.config_data.b[(reg & 3) ^ 3]; *val = mace->pci.config_data.b[(reg & 3) ^ 3];
...@@ -66,8 +64,7 @@ static int ...@@ -66,8 +64,7 @@ static int
mace_pci_write_config(struct pci_bus *bus, unsigned int devfn, mace_pci_write_config(struct pci_bus *bus, unsigned int devfn,
int reg, int size, u32 val) int reg, int size, u32 val)
{ {
chkslot(bus, devfn); mace->pci.config_addr = mkaddr(bus, devfn, reg);
mace->pci.config_addr = mkaddr(devfn, reg);
switch (size) { switch (size) {
case 1: case 1:
mace->pci.config_data.b[(reg & 3) ^ 3] = val; mace->pci.config_data.b[(reg & 3) ^ 3] = val;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册