Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cc9881ce authored by Nathan Lynch's avatar Nathan Lynch Committed by Paul Mackerras
Browse files

[POWERPC] Demacrofy arch/powerpc/platforms/maple/pci.c



Noticed that the U3_*CFA macros have some typos:

#define U3_HT_CFA0(devfn, off)		\
		((((unsigned long)devfn) << 8) | offset)

(refers to offset rather than off)

#define U3_AGP_CFA0(devfn, off)	\
	((1 << (unsigned long)PCI_SLOT(dev_fn)) \
	| (((unsigned long)PCI_FUNC(dev_fn)) << 8) \

(refers to dev_fn rather than devfn)

Things happen to work, but there doesn't seem to be any reason these
shouldn't be functions.  Overall behavior should be unchanged.

Signed-off-by: default avatarNathan Lynch <ntl@pobox.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent d608df5c
Loading
Loading
Loading
Loading
+25 −19
Original line number Original line Diff line number Diff line
@@ -81,16 +81,20 @@ static void __init fixup_bus_range(struct device_node *bridge)
}
}




#define U3_AGP_CFA0(devfn, off)	\
static unsigned long u3_agp_cfa0(u8 devfn, u8 off)
	((1 << (unsigned long)PCI_SLOT(dev_fn)) \
{
	| (((unsigned long)PCI_FUNC(dev_fn)) << 8) \
	return (1 << (unsigned long)PCI_SLOT(devfn)) |
	| (((unsigned long)(off)) & 0xFCUL))
		((unsigned long)PCI_FUNC(devfn) << 8) |
		((unsigned long)off & 0xFCUL);
}


#define U3_AGP_CFA1(bus, devfn, off)	\
static unsigned long u3_agp_cfa1(u8 bus, u8 devfn, u8 off)
	((((unsigned long)(bus)) << 16) \
{
	|(((unsigned long)(devfn)) << 8) \
	return ((unsigned long)bus << 16) |
	|(((unsigned long)(off)) & 0xFCUL) \
		((unsigned long)devfn << 8) |
	|1UL)
		((unsigned long)off & 0xFCUL) |
		1UL;
}


static unsigned long u3_agp_cfg_access(struct pci_controller* hose,
static unsigned long u3_agp_cfg_access(struct pci_controller* hose,
				       u8 bus, u8 dev_fn, u8 offset)
				       u8 bus, u8 dev_fn, u8 offset)
@@ -100,9 +104,9 @@ static unsigned long u3_agp_cfg_access(struct pci_controller* hose,
	if (bus == hose->first_busno) {
	if (bus == hose->first_busno) {
		if (dev_fn < (11 << 3))
		if (dev_fn < (11 << 3))
			return 0;
			return 0;
		caddr = U3_AGP_CFA0(dev_fn, offset);
		caddr = u3_agp_cfa0(dev_fn, offset);
	} else
	} else
		caddr = U3_AGP_CFA1(bus, dev_fn, offset);
		caddr = u3_agp_cfa1(bus, dev_fn, offset);


	/* Uninorth will return garbage if we don't read back the value ! */
	/* Uninorth will return garbage if we don't read back the value ! */
	do {
	do {
@@ -184,13 +188,15 @@ static struct pci_ops u3_agp_pci_ops =
	u3_agp_write_config
	u3_agp_write_config
};
};


static unsigned long u3_ht_cfa0(u8 devfn, u8 off)
{
	return (devfn << 8) | off;
}


#define U3_HT_CFA0(devfn, off)		\
static unsigned long u3_ht_cfa1(u8 bus, u8 devfn, u8 off)
		((((unsigned long)devfn) << 8) | offset)
{
#define U3_HT_CFA1(bus, devfn, off)	\
	return u3_ht_cfa0(devfn, off) + (bus << 16) + 0x01000000UL;
		(U3_HT_CFA0(devfn, off) \
}
		+ (((unsigned long)bus) << 16) \
		+ 0x01000000UL)


static unsigned long u3_ht_cfg_access(struct pci_controller* hose,
static unsigned long u3_ht_cfg_access(struct pci_controller* hose,
				      u8 bus, u8 devfn, u8 offset)
				      u8 bus, u8 devfn, u8 offset)
@@ -198,9 +204,9 @@ static unsigned long u3_ht_cfg_access(struct pci_controller* hose,
	if (bus == hose->first_busno) {
	if (bus == hose->first_busno) {
		if (PCI_SLOT(devfn) == 0)
		if (PCI_SLOT(devfn) == 0)
			return 0;
			return 0;
		return ((unsigned long)hose->cfg_data) + U3_HT_CFA0(devfn, offset);
		return ((unsigned long)hose->cfg_data) + u3_ht_cfa0(devfn, offset);
	} else
	} else
		return ((unsigned long)hose->cfg_data) + U3_HT_CFA1(bus, devfn, offset);
		return ((unsigned long)hose->cfg_data) + u3_ht_cfa1(bus, devfn, offset);
}
}


static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,