Re: [PATCH] Expanded PCI config space (against 2.6.3-rc4)

From: Matthew Wilcox
Date: Wed Feb 18 2004 - 11:29:28 EST


On Wed, Feb 18, 2004 at 11:14:09AM -0500, Brian Gerst wrote:
> Matthew Wilcox wrote:
> >@@ -55,8 +55,11 @@ struct pci_fixup pcibios_fixups[1];
> >
> > #define PCI_SAL_ADDRESS(seg, bus, devfn, reg) \
> > ((u64)(seg << 24) | (u64)(bus << 16) | \
> >- (u64)(devfn << 8) | (u64)(reg))
> >+ (u64)(devfn << 8) | (u64)(reg)), 0
> >
> >+#define PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg) \
> >+ ((u64)(seg << 28) | (u64)(bus << 20) | \
> >+ (u64)(devfn << 12) | (u64)(reg)), 1
> >
> > static int
> > pci_sal_read (int seg, int bus, int devfn, int reg, int len, u32 *value)
> >
> >
> >- result = ia64_sal_pci_config_read(PCI_SAL_ADDRESS(seg, bus, devfn,
> >reg), len, &data);
> >+ if ((seg < 256) && (reg < 256)) {
> >+ result = ia64_sal_pci_config_read(PCI_SAL_ADDRESS(seg, bus,
> >devfn, reg), len, &data);
> >+ } else {
> >+ result = ia64_sal_pci_config_read(PCI_SAL_EXT_ADDRESS(seg,
> >bus, devfn, reg), len, &data);
> >+ }
> >
>
> Having PCI_SAL_*ADDRESS() return 2 values is counter-intuituitive, since
> it looks like a normal function call. Just add the type flag to the
> ia64_sal_pci_config_* call directly.

um, it doesn't look like a normal function call. it looks like a
macro because it's all in upper case. if this were in a header file
or used more generally, i'd agree with you. but it's not, it's just a
convenience macro used in 4 places in this one file.

besides, i got this wrong the first time, and combining it all into the
one macro doesn't let me get it wrong.

--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/