Re: M7101

From: Ivan Kokshaysky
Date: Tue Feb 08 2005 - 06:14:58 EST


On Sun, Feb 06, 2005 at 03:06:11PM +0000, Matthew Wilcox wrote:
> Looks pretty good to me. For clarity, I'd change:
>
> - m7101 = pci_scan_single_device(dev->bus, 0x18);
> + m7101 = pci_scan_single_device(dev->bus, PCI_DEVFN(3, 0));

No, it's pretty broken regardless of the change. The integrated devices
on ALi southbridges (IDE, PMU, USB etc.) have programmable IDSELs,
so using hardcoded devfn is just dangerous. We must figure out what
the device number PMU will have before we turn it on.
Something like this:

// NOTE: These values are for m1543. Someone must verify whether
// they are the same for m1533 or not.
static char pmu_idsels[4] __devinitdata = { 28, 29, 14, 15 };

...

/* Get IDSEL mapping for PMU (bits 2-3 of 0x72). */
pci_read_config_byte(dev, 0x72, &val);
devnum = pmu_idsel[(val >> 2) & 3] - 11;
m7101 = pci_get_slot(dev->bus, PCI_DEVFN(devnum, 0));
if (m7101) {
/* Failure - there is another device with the same number. */
pci_dev_put(m7101);
return;
}

/* Enable PMU. */
...

m7101 = pci_scan_single_device(dev->bus, PCI_DEVFN(devnum, 0));
...

Ivan.
-
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/