2 * Copyright (c) 2001 Alcove - Nicolas Souchu
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 #include <sys/cdefs.h>
28 __FBSDID("$FreeBSD$");
32 #include <sys/param.h>
33 #include <sys/kernel.h>
34 #include <sys/systm.h>
35 #include <sys/module.h>
39 #include <machine/bus.h>
40 #include <machine/clock.h> /* for DELAY */
41 #include <machine/resource.h>
45 #include <isa/isavar.h>
46 #include <isa/isa_common.h>
48 #include <dev/pci/pcivar.h>
49 #include <dev/pci/pcireg.h>
51 #include <dev/iicbus/iiconf.h>
52 #include <dev/iicbus/iicbus.h>
54 #include <dev/smbus/smbconf.h>
55 #include <dev/smbus/smbus.h>
60 #define VIAPM_DEBUG(x) if (viapm_debug) (x)
63 static int viapm_debug = 1;
65 static int viapm_debug = 0;
68 #define VIA_586B_PMU_ID 0x30401106
69 #define VIA_596A_PMU_ID 0x30501106
70 #define VIA_596B_PMU_ID 0x30511106
71 #define VIA_686A_PMU_ID 0x30571106
72 #define VIA_8233_PMU_ID 0x30741106
73 #define VIA_8233A_PMU_ID 0x31471106
74 #define VIA_8235_PMU_ID 0x31771106
76 #define VIAPM_INB(port) \
77 ((u_char)bus_space_read_1(viapm->st, viapm->sh, port))
78 #define VIAPM_OUTB(port,val) \
79 (bus_space_write_1(viapm->st, viapm->sh, port, (u_char)(val)))
81 #define VIAPM_TYP_UNKNOWN 0
82 #define VIAPM_TYP_586B_3040E 1
83 #define VIAPM_TYP_586B_3040F 2
84 #define VIAPM_TYP_596B 3
85 #define VIAPM_TYP_686A 4
86 #define VIAPM_TYP_8233 5
92 bus_space_handle_t sh;
95 struct resource *iores;
96 struct resource *irqres;
103 static devclass_t viapm_devclass;
104 static devclass_t viapropm_devclass;
107 * VT82C586B definitions
110 #define VIAPM_586B_REVID 0x08
112 #define VIAPM_586B_3040E_BASE 0x20
113 #define VIAPM_586B_3040E_ACTIV 0x4 /* 16 bits */
115 #define VIAPM_586B_3040F_BASE 0x48
116 #define VIAPM_586B_3040F_ACTIV 0x41 /* 8 bits */
118 #define VIAPM_586B_OEM_REV_E 0x00
119 #define VIAPM_586B_OEM_REV_F 0x01
120 #define VIAPM_586B_PROD_REV_A 0x10
122 #define VIAPM_586B_BA_MASK 0x0000ff00
124 #define GPIO_DIR 0x40
125 #define GPIO_VAL 0x42
126 #define EXTSMI_VAL 0x44
128 #define VIAPM_SCL 0x02 /* GPIO1_VAL */
129 #define VIAPM_SDA 0x04 /* GPIO2_VAL */
132 * VIAPRO common definitions
135 #define VIAPM_PRO_BA_MASK 0x0000fff0
136 #define VIAPM_PRO_SMBCTRL 0xd2
137 #define VIAPM_PRO_REVID 0xd6
140 * VT82C686A definitions
143 #define VIAPM_PRO_BASE 0x90
150 #define SMBHDATA0 0x5
151 #define SMBHDATA1 0x6
152 #define SMBHBLOCK 0x7
156 #define SMBSSDWCMD 0x9
157 #define SMBSEVENT 0xa
160 #define SMBHST_RESERVED 0xef /* reserved bits */
161 #define SMBHST_FAILED 0x10 /* failed bus transaction */
162 #define SMBHST_COLLID 0x08 /* bus collision */
163 #define SMBHST_ERROR 0x04 /* device error */
164 #define SMBHST_INTR 0x02 /* command completed */
165 #define SMBHST_BUSY 0x01 /* host busy */
167 #define SMBHCTRL_START 0x40 /* start command */
168 #define SMBHCTRL_PROTO 0x1c /* command protocol mask */
169 #define SMBHCTRL_QUICK 0x00
170 #define SMBHCTRL_SENDRECV 0x04
171 #define SMBHCTRL_BYTE 0x08
172 #define SMBHCTRL_WORD 0x0c
173 #define SMBHCTRL_BLOCK 0x14
174 #define SMBHCTRL_KILL 0x02 /* stop the current transaction */
175 #define SMBHCTRL_ENABLE 0x01 /* enable interrupts */
177 #define SMBSCTRL_ENABLE 0x01 /* enable slave */
181 * VIA8233 definitions
184 #define VIAPM_8233_BASE 0xD0
187 viapm_586b_probe(device_t dev)
189 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
194 switch (pci_get_devid(dev)) {
195 case VIA_586B_PMU_ID:
197 bzero(viapm, sizeof(struct viapm_softc));
199 l = pci_read_config(dev, VIAPM_586B_REVID, 1);
201 case VIAPM_586B_OEM_REV_E:
202 viapm->type = VIAPM_TYP_586B_3040E;
203 viapm->iorid = VIAPM_586B_3040E_BASE;
205 /* Activate IO block access */
206 s = pci_read_config(dev, VIAPM_586B_3040E_ACTIV, 2);
207 pci_write_config(dev, VIAPM_586B_3040E_ACTIV, s | 0x1, 2);
210 case VIAPM_586B_OEM_REV_F:
211 case VIAPM_586B_PROD_REV_A:
213 viapm->type = VIAPM_TYP_586B_3040F;
214 viapm->iorid = VIAPM_586B_3040F_BASE;
216 /* Activate IO block access */
217 c = pci_read_config(dev, VIAPM_586B_3040F_ACTIV, 1);
218 pci_write_config(dev, VIAPM_586B_3040F_ACTIV, c | 0x80, 1);
222 viapm->base = pci_read_config(dev, viapm->iorid, 4) &
226 * We have to set the I/O resources by hand because it is
227 * described outside the viapmope of the traditional maps
229 if (bus_set_resource(dev, SYS_RES_IOPORT, viapm->iorid,
231 device_printf(dev, "could not set bus resource\n");
234 device_set_desc(dev, "VIA VT82C586B Power Management Unit");
235 return (BUS_PROBE_DEFAULT);
246 viapm_pro_probe(device_t dev)
248 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
249 #ifdef VIAPM_BASE_ADDR
252 u_int32_t base_cfgreg;
255 switch (pci_get_devid(dev)) {
256 case VIA_596A_PMU_ID:
257 desc = "VIA VT82C596A Power Management Unit";
258 viapm->type = VIAPM_TYP_596B;
259 base_cfgreg = VIAPM_PRO_BASE;
262 case VIA_596B_PMU_ID:
263 desc = "VIA VT82C596B Power Management Unit";
264 viapm->type = VIAPM_TYP_596B;
265 base_cfgreg = VIAPM_PRO_BASE;
268 case VIA_686A_PMU_ID:
269 desc = "VIA VT82C686A Power Management Unit";
270 viapm->type = VIAPM_TYP_686A;
271 base_cfgreg = VIAPM_PRO_BASE;
274 case VIA_8233_PMU_ID:
275 case VIA_8233A_PMU_ID:
276 desc = "VIA VT8233 Power Management Unit";
277 viapm->type = VIAPM_TYP_UNKNOWN;
278 base_cfgreg = VIAPM_8233_BASE;
281 case VIA_8235_PMU_ID:
282 desc = "VIA VT8235 Power Management Unit";
283 viapm->type = VIAPM_TYP_UNKNOWN;
284 base_cfgreg = VIAPM_8233_BASE;
289 #ifdef VIAPM_BASE_ADDR
290 /* force VIAPM I/O base address */
292 /* enable the SMBus controller function */
293 l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1);
294 pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 1, 1);
296 /* write the base address */
297 pci_write_config(dev, base_cfgreg,
298 VIAPM_BASE_ADDR & VIAPM_PRO_BA_MASK, 4);
301 viapm->base = pci_read_config(dev, base_cfgreg, 4) & VIAPM_PRO_BA_MASK;
304 * We have to set the I/O resources by hand because it is
305 * described outside the viapmope of the traditional maps
307 viapm->iorid = base_cfgreg;
308 if (bus_set_resource(dev, SYS_RES_IOPORT, viapm->iorid,
310 device_printf(dev, "could not set bus resource 0x%x\n",
315 if (1 || bootverbose) {
316 device_printf(dev, "SMBus I/O base at 0x%x\n", viapm->base);
319 device_set_desc(dev, desc);
320 return (BUS_PROBE_DEFAULT);
330 viapm_pro_attach(device_t dev)
332 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
335 if (!(viapm->iores = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
336 &viapm->iorid, RF_ACTIVE))) {
337 device_printf(dev, "could not allocate bus space\n");
340 viapm->st = rman_get_bustag(viapm->iores);
341 viapm->sh = rman_get_bushandle(viapm->iores);
345 l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1);
346 pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 0x80, 1);
349 if (!(viapm->irqres = bus_alloc_resource(dev, SYS_RES_IRQ,
350 &viapm->irqrid, 9, 9, 1,
351 RF_SHAREABLE | RF_ACTIVE))) {
352 device_printf(dev, "could not allocate irq\n");
356 if (bus_setup_intr(dev, viapm->irqres, INTR_TYPE_MISC,
357 (driver_intr_t *) viasmb_intr, viapm, &viapm->irqih)) {
358 device_printf(dev, "could not setup irq\n");
363 if (1 | bootverbose) {
364 l = pci_read_config(dev, VIAPM_PRO_REVID, 1);
365 device_printf(dev, "SMBus revision code 0x%x\n", l);
368 viapm->smbus = device_add_child(dev, "smbus", -1);
370 /* probe and attach the smbus */
371 bus_generic_attach(dev);
373 /* disable slave function */
374 VIAPM_OUTB(SMBSCTRL, VIAPM_INB(SMBSCTRL) & ~SMBSCTRL_ENABLE);
376 /* enable the SMBus controller function */
377 l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1);
378 pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 1, 1);
381 /* enable interrupts */
382 VIAPM_OUTB(SMBHCTRL, VIAPM_INB(SMBHCTRL) | SMBHCTRL_ENABLE);
386 /* If this device is a PCI-ISA bridge, then attach an ISA bus. */
387 if ((pci_get_class(dev) == PCIC_BRIDGE) &&
388 (pci_get_subclass(dev) == PCIS_BRIDGE_ISA))
395 bus_release_resource(dev, SYS_RES_IOPORT, viapm->iorid, viapm->iores);
398 bus_release_resource(dev, SYS_RES_IRQ, viapm->irqrid, viapm->irqres);
405 viapm_586b_attach(device_t dev)
407 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
409 if (!(viapm->iores = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
410 &viapm->iorid, RF_ACTIVE | RF_SHAREABLE))) {
411 device_printf(dev, "could not allocate bus resource\n");
414 viapm->st = rman_get_bustag(viapm->iores);
415 viapm->sh = rman_get_bushandle(viapm->iores);
417 VIAPM_OUTB(GPIO_DIR, VIAPM_INB(GPIO_DIR) | VIAPM_SCL | VIAPM_SDA);
419 /* add generic bit-banging code */
420 if (!(viapm->iicbb = device_add_child(dev, "iicbb", -1)))
423 bus_generic_attach(dev);
429 bus_release_resource(dev, SYS_RES_IOPORT,
430 viapm->iorid, viapm->iores);
435 viapm_586b_detach(device_t dev)
437 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
440 bus_generic_detach(dev);
442 device_delete_child(dev, viapm->iicbb);
445 if (viapm->iores && (error = bus_release_resource(dev, SYS_RES_IOPORT,
446 viapm->iorid, viapm->iores)))
453 viapm_pro_detach(device_t dev)
455 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
458 bus_generic_detach(dev);
460 device_delete_child(dev, viapm->smbus);
463 if ((error = bus_release_resource(dev, SYS_RES_IOPORT,
464 viapm->iorid, viapm->iores)))
468 if ((error = bus_release_resource(dev, SYS_RES_IRQ,
469 viapm->irqrid, viapm->irqres))
477 viabb_callback(device_t dev, int index, caddr_t *data)
483 viabb_setscl(device_t dev, int ctrl)
485 struct viapm_softc *viapm = device_get_softc(dev);
488 val = VIAPM_INB(GPIO_VAL);
495 VIAPM_OUTB(GPIO_VAL, val);
501 viabb_setsda(device_t dev, int data)
503 struct viapm_softc *viapm = device_get_softc(dev);
506 val = VIAPM_INB(GPIO_VAL);
513 VIAPM_OUTB(GPIO_VAL, val);
519 viabb_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr)
522 viabb_setsda(dev, 1);
523 viabb_setscl(dev, 1);
525 return (IIC_ENOADDR);
529 viabb_getscl(device_t dev)
531 struct viapm_softc *viapm = device_get_softc(dev);
533 return ((VIAPM_INB(EXTSMI_VAL) & VIAPM_SCL) != 0);
537 viabb_getsda(device_t dev)
539 struct viapm_softc *viapm = device_get_softc(dev);
541 return ((VIAPM_INB(EXTSMI_VAL) & VIAPM_SDA) != 0);
545 viapm_abort(struct viapm_softc *viapm)
547 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_KILL);
554 viapm_clear(struct viapm_softc *viapm)
556 VIAPM_OUTB(SMBHST, SMBHST_FAILED | SMBHST_COLLID |
557 SMBHST_ERROR | SMBHST_INTR);
564 viapm_busy(struct viapm_softc *viapm)
568 sts = VIAPM_INB(SMBHST);
570 VIAPM_DEBUG(printf("viapm: idle? STS=0x%x\n", sts));
572 return (sts & SMBHST_BUSY);
576 * Poll the SMBus controller
579 viapm_wait(struct viapm_softc *viapm)
585 /* wait for command to complete and SMBus controller is idle */
588 sts = VIAPM_INB(SMBHST);
590 /* check if the controller is processing a command */
591 if (!(sts & SMBHST_BUSY) && (sts & SMBHST_INTR))
595 VIAPM_DEBUG(printf("viapm: SMBHST=0x%x\n", sts));
600 error |= SMB_ETIMEOUT;
602 if (sts & SMBHST_FAILED)
605 if (sts & SMBHST_COLLID)
608 if (sts & SMBHST_ERROR)
609 error |= SMB_EBUSERR;
611 if (error != SMB_ENOERR)
620 viasmb_callback(device_t dev, int index, caddr_t *data)
625 case SMB_REQUEST_BUS:
626 case SMB_RELEASE_BUS:
627 /* ok, bus allocation accepted */
637 viasmb_quick(device_t dev, u_char slave, int how)
639 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
643 if (viapm_busy(viapm))
648 VIAPM_DEBUG(printf("viapm: QWRITE to 0x%x", slave));
649 VIAPM_OUTB(SMBHADDR, slave & ~LSB);
652 VIAPM_DEBUG(printf("viapm: QREAD to 0x%x", slave));
653 VIAPM_OUTB(SMBHADDR, slave | LSB);
656 panic("%s: unknown QUICK command (%x)!", __func__, how);
659 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_QUICK);
661 error = viapm_wait(viapm);
667 viasmb_sendb(device_t dev, u_char slave, char byte)
669 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
673 if (viapm_busy(viapm))
676 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
677 VIAPM_OUTB(SMBHCMD, byte);
679 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_SENDRECV);
681 error = viapm_wait(viapm);
683 VIAPM_DEBUG(printf("viapm: SENDB to 0x%x, byte=0x%x, error=0x%x\n", slave, byte, error));
689 viasmb_recvb(device_t dev, u_char slave, char *byte)
691 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
695 if (viapm_busy(viapm))
698 VIAPM_OUTB(SMBHADDR, slave | LSB);
700 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_SENDRECV);
702 if ((error = viapm_wait(viapm)) == SMB_ENOERR)
703 *byte = VIAPM_INB(SMBHDATA0);
705 VIAPM_DEBUG(printf("viapm: RECVB from 0x%x, byte=0x%x, error=0x%x\n", slave, *byte, error));
711 viasmb_writeb(device_t dev, u_char slave, char cmd, char byte)
713 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
717 if (viapm_busy(viapm))
720 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
721 VIAPM_OUTB(SMBHCMD, cmd);
722 VIAPM_OUTB(SMBHDATA0, byte);
724 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BYTE);
726 error = viapm_wait(viapm);
728 VIAPM_DEBUG(printf("viapm: WRITEB to 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, byte, error));
734 viasmb_readb(device_t dev, u_char slave, char cmd, char *byte)
736 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
740 if (viapm_busy(viapm))
743 VIAPM_OUTB(SMBHADDR, slave | LSB);
744 VIAPM_OUTB(SMBHCMD, cmd);
746 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BYTE);
748 if ((error = viapm_wait(viapm)) == SMB_ENOERR)
749 *byte = VIAPM_INB(SMBHDATA0);
751 VIAPM_DEBUG(printf("viapm: READB from 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, *byte, error));
757 viasmb_writew(device_t dev, u_char slave, char cmd, short word)
759 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
763 if (viapm_busy(viapm))
766 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
767 VIAPM_OUTB(SMBHCMD, cmd);
768 VIAPM_OUTB(SMBHDATA0, word & 0x00ff);
769 VIAPM_OUTB(SMBHDATA1, (word & 0xff00) >> 8);
771 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_WORD);
773 error = viapm_wait(viapm);
775 VIAPM_DEBUG(printf("viapm: WRITEW to 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, word, error));
781 viasmb_readw(device_t dev, u_char slave, char cmd, short *word)
783 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
788 if (viapm_busy(viapm))
791 VIAPM_OUTB(SMBHADDR, slave | LSB);
792 VIAPM_OUTB(SMBHCMD, cmd);
794 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_WORD);
796 if ((error = viapm_wait(viapm)) == SMB_ENOERR) {
797 low = VIAPM_INB(SMBHDATA0);
798 high = VIAPM_INB(SMBHDATA1);
800 *word = ((high & 0xff) << 8) | (low & 0xff);
803 VIAPM_DEBUG(printf("viapm: READW from 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, *word, error));
809 viasmb_bwrite(device_t dev, u_char slave, char cmd, u_char count, char *buf)
811 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
812 u_char remain, len, i;
813 int error = SMB_ENOERR;
816 if (viapm_busy(viapm))
821 len = min(remain, 32);
823 VIAPM_OUTB(SMBHADDR, slave & ~LSB);
824 VIAPM_OUTB(SMBHCMD, cmd);
825 VIAPM_OUTB(SMBHDATA0, len);
826 i = VIAPM_INB(SMBHCTRL);
828 /* fill the 32-byte internal buffer */
829 for (i=0; i<len; i++) {
830 VIAPM_OUTB(SMBHBLOCK, buf[count-remain+i]);
833 VIAPM_OUTB(SMBHCMD, cmd);
834 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BLOCK);
836 if ((error = viapm_wait(viapm)) != SMB_ENOERR)
843 VIAPM_DEBUG(printf("viapm: WRITEBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, count, cmd, error));
850 viasmb_bread(device_t dev, u_char slave, char cmd, u_char count, char *buf)
852 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
853 u_char remain, len, i;
854 int error = SMB_ENOERR;
857 if (viapm_busy(viapm))
862 VIAPM_OUTB(SMBHADDR, slave | LSB);
863 VIAPM_OUTB(SMBHCMD, cmd);
864 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BLOCK);
866 if ((error = viapm_wait(viapm)) != SMB_ENOERR)
869 len = VIAPM_INB(SMBHDATA0);
870 i = VIAPM_INB(SMBHCTRL); /* reset counter */
872 len = min(len, remain);
874 /* read the 32-byte internal buffer */
875 for (i=0; i<len; i++) {
876 buf[count-remain+i] = VIAPM_INB(SMBHBLOCK);
883 VIAPM_DEBUG(printf("viapm: READBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, count, cmd, error));
888 static device_method_t viapm_methods[] = {
889 /* device interface */
890 DEVMETHOD(device_probe, viapm_586b_probe),
891 DEVMETHOD(device_attach, viapm_586b_attach),
892 DEVMETHOD(device_detach, viapm_586b_detach),
894 /* iicbb interface */
895 DEVMETHOD(iicbb_callback, viabb_callback),
896 DEVMETHOD(iicbb_setscl, viabb_setscl),
897 DEVMETHOD(iicbb_setsda, viabb_setsda),
898 DEVMETHOD(iicbb_getscl, viabb_getscl),
899 DEVMETHOD(iicbb_getsda, viabb_getsda),
900 DEVMETHOD(iicbb_reset, viabb_reset),
903 DEVMETHOD(bus_print_child, bus_generic_print_child),
904 DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
905 DEVMETHOD(bus_release_resource, bus_generic_release_resource),
906 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
907 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
908 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
909 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
914 static driver_t viapm_driver = {
917 sizeof(struct viapm_softc),
920 static device_method_t viapropm_methods[] = {
921 /* device interface */
922 DEVMETHOD(device_probe, viapm_pro_probe),
923 DEVMETHOD(device_attach, viapm_pro_attach),
924 DEVMETHOD(device_detach, viapm_pro_detach),
926 /* smbus interface */
927 DEVMETHOD(smbus_callback, viasmb_callback),
928 DEVMETHOD(smbus_quick, viasmb_quick),
929 DEVMETHOD(smbus_sendb, viasmb_sendb),
930 DEVMETHOD(smbus_recvb, viasmb_recvb),
931 DEVMETHOD(smbus_writeb, viasmb_writeb),
932 DEVMETHOD(smbus_readb, viasmb_readb),
933 DEVMETHOD(smbus_writew, viasmb_writew),
934 DEVMETHOD(smbus_readw, viasmb_readw),
935 DEVMETHOD(smbus_bwrite, viasmb_bwrite),
936 DEVMETHOD(smbus_bread, viasmb_bread),
939 DEVMETHOD(bus_print_child, bus_generic_print_child),
940 DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
941 DEVMETHOD(bus_release_resource, bus_generic_release_resource),
942 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
943 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
944 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
945 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
950 static driver_t viapropm_driver = {
953 sizeof(struct viapm_softc),
956 DRIVER_MODULE(viapm, pci, viapm_driver, viapm_devclass, 0, 0);
957 DRIVER_MODULE(viapropm, pci, viapropm_driver, viapropm_devclass, 0, 0);
959 MODULE_DEPEND(viapm, pci, 1, 1, 1);
960 MODULE_DEPEND(viapropm, pci, 1, 1, 1);
961 MODULE_DEPEND(viapm, iicbb, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER);
962 MODULE_DEPEND(viapropm, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER);
963 MODULE_VERSION(viapm, 1);
966 DRIVER_MODULE(isa, viapm, isa_driver, isa_devclass, 0, 0);
967 DRIVER_MODULE(isa, viapropm, isa_driver, isa_devclass, 0, 0);
968 MODULE_DEPEND(viapm, isa, 1, 1, 1);
969 MODULE_DEPEND(viapropm, isa, 1, 1, 1);