I sent this accidentally (..and mangled) a few minutes ago, so, here
it is again.. allows iic(4)/spdmem(4) to attach on my laptop.
Works for me, let me know if there is a better way.
-Bryan.
Index: dev/pci/piixpm.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/piixpm.c,v
retrieving revision 1.35
diff -u -r1.35 piixpm.c
--- dev/pci/piixpm.c 9 Apr 2011 04:33:40 -0000 1.35
+++ dev/pci/piixpm.c 24 Apr 2011 03:16:31 -0000
@@ -115,6 +115,7 @@
struct piixpm_softc *sc = (struct piixpm_softc *)self;
struct pci_attach_args *pa = aux;
struct i2cbus_attach_args iba;
+ u_int8_t base_en_low, base_en_high;
pcireg_t base, conf;
pci_intr_handle_t ih;
const char *intrstr = NULL;
@@ -123,19 +124,33 @@
conf = pci_conf_read(pa->pa_pc, pa->pa_tag, PIIX_SMB_HOSTC);
DPRINTF((": conf 0x%08x", conf));
- if ((conf & PIIX_SMB_HOSTC_HSTEN) == 0) {
- printf(": SMBus disabled\n");
- return;
- }
-
/* Map I/O space */
sc->sc_iot = pa->pa_iot;
- base = pci_conf_read(pa->pa_pc, pa->pa_tag, PIIX_SMB_BASE) & 0xffff;
- if (PCI_MAPREG_IO_ADDR(base) == 0 ||
- bus_space_map(sc->sc_iot, PCI_MAPREG_IO_ADDR(base),
- PIIX_SMB_SIZE, 0, &sc->sc_ioh)) {
- printf(": can't map i/o space\n");
- return;
+ if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ATI &&
+ PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ATI_SBX00_SMB &&
+ PCI_REVISION(pa->pa_class) >= 0x40) {
+ /* SB800+ SMB configuration.. pio macros avoidable? */
+ outb(0xcd6, 0x2c);
+ base_en_low = inb(0xcd7);
+ outb(0xcd6, 0x2d);
+ base_en_high = inb(0xcd7);
+ base = ((base_en_high << 8) | base_en_low) & 0xffe0;
+ bus_space_map(sc->sc_iot, PCI_MAPREG_IO_ADDR(base),
+ PIIX_SMB_SIZE, 0, &sc->sc_ioh);
+ } else {
+ if ((conf & PIIX_SMB_HOSTC_HSTEN) == 0) {
+ printf(": SMBus disabled\n");
+ return;
+ }
+
+ base = pci_conf_read(pa->pa_pc, pa->pa_tag,
+ PIIX_SMB_BASE) & 0xffff;
+ if (PCI_MAPREG_IO_ADDR(base) == 0 ||
+ bus_space_map(sc->sc_iot, PCI_MAPREG_IO_ADDR(base),
+ PIIX_SMB_SIZE, 0, &sc->sc_ioh)) {
+ printf(": can't map i/o space\n");
+ return;
+ }
}
sc->sc_poll = 1;