Skip to content

Commit

Permalink
[MIPS] IP32: Enable PCI bridges
Browse files Browse the repository at this point in the history
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: Giuseppe Sacco <eppesuig@debian.org>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Giuseppe Sacco authored and Ralf Baechle committed Oct 5, 2007
1 parent 804b3f9 commit 8cfaf45
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions arch/mips/pci/ops-mace.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,20 @@
* 4 N/C
*/

#define chkslot(_bus,_devfn) \
do { \
if ((_bus)->number > 0 || PCI_SLOT (_devfn) < 1 \
|| PCI_SLOT (_devfn) > 3) \
return PCIBIOS_DEVICE_NOT_FOUND; \
} while (0)
static inline int mkaddr(struct pci_bus *bus, unsigned int devfn,
unsigned int reg)
{
return ((bus->number & 0xff) << 16) |
(devfn & 0xff) << 8) |
(reg & 0xfc);
}

#define mkaddr(_devfn, _reg) \
((((_devfn) & 0xffUL) << 8) | ((_reg) & 0xfcUL))

static int
mace_pci_read_config(struct pci_bus *bus, unsigned int devfn,
int reg, int size, u32 *val)
{
chkslot(bus, devfn);
mace->pci.config_addr = mkaddr(devfn, reg);
mace->pci.config_addr = mkaddr(bus, devfn, reg);
switch (size) {
case 1:
*val = mace->pci.config_data.b[(reg & 3) ^ 3];
Expand All @@ -66,8 +64,7 @@ static int
mace_pci_write_config(struct pci_bus *bus, unsigned int devfn,
int reg, int size, u32 val)
{
chkslot(bus, devfn);
mace->pci.config_addr = mkaddr(devfn, reg);
mace->pci.config_addr = mkaddr(bus, devfn, reg);
switch (size) {
case 1:
mace->pci.config_data.b[(reg & 3) ^ 3] = val;
Expand Down

0 comments on commit 8cfaf45

Please sign in to comment.