Subject: Re: [PATCH 5/7] Enable MSI mappings for MPIC

From: Milton Miller <[email-masked]>
Date: Sat, 21 Apr 2007 18:16:55 -0500

On Apr 19, 2007, Michael Ellerman wrote:
> On some Apple machines the HT MSI mappings are not enabled by 
> firmware, so
> we need to do it by hand.
>

> +#ifdef CONFIG_PCI_MSI
> +static void __init mpic_scan_ht_msi(struct mpic *mpic, u8 __iomem 
> *devbase,
> +				    unsigned int devfn)
> +{
> +	u8 __iomem *base;
> +	u8 pos, flags;
> +	u64 addr = 0;
> +
> +	for (pos = readb(devbase + PCI_CAPABILITY_LIST); pos != 0;
> +	     pos = readb(devbase + pos + PCI_CAP_LIST_NEXT)) {
> +		u8 id = readb(devbase + pos + PCI_CAP_LIST_ID);
> +		if (id == PCI_CAP_ID_HT) {
> +			id = readb(devbase + pos + 3);
> +			if ((id & HT_5BIT_CAP_MASK) == HT_CAPTYPE_MSI_MAPPING)
>

This is just begging to be written in terms of 
pci_bus_find_ht_capability.  Well,
we have pci_bus_find_capability, and pci_find_ht_capability, I'm sure 
we could
create that.   It also means this and the other nearby functions want 
to be
written in terms of a struct pci_bus and config accessors.

milton