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$");
30 #include <sys/param.h>
31 #include <sys/kernel.h>
32 #include <sys/systm.h>
33 #include <sys/module.h>
37 #include <machine/bus.h>
38 #include <machine/clock.h> /* for DELAY */
39 #include <machine/resource.h>
42 #include <dev/pci/pcivar.h>
43 #include <dev/pci/pcireg.h>
45 #include <dev/iicbus/iiconf.h>
46 #include <dev/iicbus/iicbus.h>
48 #include <dev/smbus/smbconf.h>
49 #include <dev/smbus/smbus.h>
54 #define VIAPM_DEBUG(x) if (viapm_debug) (x)
57 static int viapm_debug = 1;
59 static int viapm_debug = 0;
62 #define VIA_586B_PMU_ID 0x30401106
63 #define VIA_596A_PMU_ID 0x30501106
64 #define VIA_596B_PMU_ID 0x30511106
65 #define VIA_686A_PMU_ID 0x30571106
66 #define VIA_8233_PMU_ID 0x30741106
67 #define VIA_8233A_PMU_ID 0x31471106
69 #define VIAPM_INB(port) \
70 ((u_char)bus_space_read_1(viapm->st, viapm->sh, port))
71 #define VIAPM_OUTB(port,val) \
72 (bus_space_write_1(viapm->st, viapm->sh, port, (u_char)(val)))
74 #define VIAPM_TYP_UNKNOWN 0
75 #define VIAPM_TYP_586B_3040E 1
76 #define VIAPM_TYP_586B_3040F 2
77 #define VIAPM_TYP_596B 3
78 #define VIAPM_TYP_686A 4
79 #define VIAPM_TYP_8233 5
85 bus_space_handle_t sh;
88 struct resource *iores;
89 struct resource *irqres;
96 static devclass_t viapm_devclass;
97 static devclass_t viapropm_devclass;
100 * VT82C586B definitions
103 #define VIAPM_586B_REVID 0x08
105 #define VIAPM_586B_3040E_BASE 0x20
106 #define VIAPM_586B_3040E_ACTIV 0x4 /* 16 bits */
108 #define VIAPM_586B_3040F_BASE 0x48
109 #define VIAPM_586B_3040F_ACTIV 0x41 /* 8 bits */
111 #define VIAPM_586B_OEM_REV_E 0x00
112 #define VIAPM_586B_OEM_REV_F 0x01
113 #define VIAPM_586B_PROD_REV_A 0x10
115 #define VIAPM_586B_BA_MASK 0x0000ff00
117 #define GPIO_DIR 0x40
118 #define GPIO_VAL 0x42
119 #define EXTSMI_VAL 0x44
121 #define VIAPM_SCL 0x02 /* GPIO1_VAL */
122 #define VIAPM_SDA 0x04 /* GPIO2_VAL */
125 * VIAPRO common definitions
128 #define VIAPM_PRO_BA_MASK 0x0000fff0
129 #define VIAPM_PRO_SMBCTRL 0xd2
130 #define VIAPM_PRO_REVID 0xd6
133 * VT82C686A definitions
136 #define VIAPM_PRO_BASE 0x90
143 #define SMBHDATA0 0x5
144 #define SMBHDATA1 0x6
145 #define SMBHBLOCK 0x7
149 #define SMBSSDWCMD 0x9
150 #define SMBSEVENT 0xa
153 #define SMBHST_RESERVED 0xef /* reserved bits */
154 #define SMBHST_FAILED 0x10 /* failed bus transaction */
155 #define SMBHST_COLLID 0x08 /* bus collision */
156 #define SMBHST_ERROR 0x04 /* device error */
157 #define SMBHST_INTR 0x02 /* command completed */
158 #define SMBHST_BUSY 0x01 /* host busy */
160 #define SMBHCTRL_START 0x40 /* start command */
161 #define SMBHCTRL_PROTO 0x1c /* command protocol mask */
162 #define SMBHCTRL_QUICK 0x00
163 #define SMBHCTRL_SENDRECV 0x04
164 #define SMBHCTRL_BYTE 0x08
165 #define SMBHCTRL_WORD 0x0c
166 #define SMBHCTRL_BLOCK 0x14
167 #define SMBHCTRL_KILL 0x02 /* stop the current transaction */
168 #define SMBHCTRL_ENABLE 0x01 /* enable interrupts */
170 #define SMBSCTRL_ENABLE 0x01 /* enable slave */
174 * VIA8233 definitions
177 #define VIAPM_8233_BASE 0xD0
180 viapm_586b_probe(device_t dev)
182 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
187 switch (pci_get_devid(dev)) {
188 case VIA_586B_PMU_ID:
190 bzero(viapm, sizeof(struct viapm_softc));
192 l = pci_read_config(dev, VIAPM_586B_REVID, 1);
194 case VIAPM_586B_OEM_REV_E:
195 viapm->type = VIAPM_TYP_586B_3040E;
196 viapm->iorid = VIAPM_586B_3040E_BASE;
198 /* Activate IO block access */
199 s = pci_read_config(dev, VIAPM_586B_3040E_ACTIV, 2);
200 pci_write_config(dev, VIAPM_586B_3040E_ACTIV, s | 0x1, 2);
203 case VIAPM_586B_OEM_REV_F:
204 case VIAPM_586B_PROD_REV_A:
206 viapm->type = VIAPM_TYP_586B_3040F;
207 viapm->iorid = VIAPM_586B_3040F_BASE;
209 /* Activate IO block access */
210 c = pci_read_config(dev, VIAPM_586B_3040F_ACTIV, 1);
211 pci_write_config(dev, VIAPM_586B_3040F_ACTIV, c | 0x80, 1);
215 viapm->base = pci_read_config(dev, viapm->iorid, 4) &
219 * We have to set the I/O resources by hand because it is
220 * described outside the viapmope of the traditional maps
222 if (bus_set_resource(dev, SYS_RES_IOPORT, viapm->iorid,
224 device_printf(dev, "could not set bus resource\n");
227 device_set_desc(dev, "VIA VT82C586B Power Management Unit");
228 return (BUS_PROBE_DEFAULT);
239 viapm_pro_probe(device_t dev)
241 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
242 #ifdef VIAPM_BASE_ADDR
245 u_int32_t base_cfgreg;
248 switch (pci_get_devid(dev)) {
249 case VIA_596A_PMU_ID:
250 desc = "VIA VT82C596A Power Management Unit";
251 viapm->type = VIAPM_TYP_596B;
252 base_cfgreg = VIAPM_PRO_BASE;
255 case VIA_596B_PMU_ID:
256 desc = "VIA VT82C596B Power Management Unit";
257 viapm->type = VIAPM_TYP_596B;
258 base_cfgreg = VIAPM_PRO_BASE;
261 case VIA_686A_PMU_ID:
262 desc = "VIA VT82C686A Power Management Unit";
263 viapm->type = VIAPM_TYP_686A;
264 base_cfgreg = VIAPM_PRO_BASE;
267 case VIA_8233_PMU_ID:
268 case VIA_8233A_PMU_ID:
269 desc = "VIA VT8233 Power Management Unit";
270 viapm->type = VIAPM_TYP_UNKNOWN;
271 base_cfgreg = VIAPM_8233_BASE;
276 #ifdef VIAPM_BASE_ADDR
277 /* force VIAPM I/O base address */
279 /* enable the SMBus controller function */
280 l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1);
281 pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 1, 1);
283 /* write the base address */
284 pci_write_config(dev, base_cfgreg,
285 VIAPM_BASE_ADDR & VIAPM_PRO_BA_MASK, 4);
288 viapm->base = pci_read_config(dev, base_cfgreg, 4) & VIAPM_PRO_BA_MASK;
291 * We have to set the I/O resources by hand because it is
292 * described outside the viapmope of the traditional maps
294 viapm->iorid = base_cfgreg;
295 if (bus_set_resource(dev, SYS_RES_IOPORT, viapm->iorid,
297 device_printf(dev, "could not set bus resource 0x%x\n",
302 if (1 || bootverbose) {
303 device_printf(dev, "SMBus I/O base at 0x%x\n", viapm->base);
306 device_set_desc(dev, desc);
307 return (BUS_PROBE_DEFAULT);
317 viapm_pro_attach(device_t dev)
319 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
322 if (!(viapm->iores = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
323 &viapm->iorid, RF_ACTIVE))) {
324 device_printf(dev, "could not allocate bus space\n");
327 viapm->st = rman_get_bustag(viapm->iores);
328 viapm->sh = rman_get_bushandle(viapm->iores);
332 l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1);
333 pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 0x80, 1);
336 if (!(viapm->irqres = bus_alloc_resource(dev, SYS_RES_IRQ,
337 &viapm->irqrid, 9, 9, 1,
338 RF_SHAREABLE | RF_ACTIVE))) {
339 device_printf(dev, "could not allocate irq\n");
343 if (bus_setup_intr(dev, viapm->irqres, INTR_TYPE_MISC,
344 (driver_intr_t *) viasmb_intr, viapm, &viapm->irqih)) {
345 device_printf(dev, "could not setup irq\n");
350 if (1 | bootverbose) {
351 l = pci_read_config(dev, VIAPM_PRO_REVID, 1);
352 device_printf(dev, "SMBus revision code 0x%x\n", l);
355 viapm->smbus = device_add_child(dev, "smbus", -1);
357 /* probe and attach the smbus */
358 bus_generic_attach(dev);
360 /* disable slave function */
361 VIAPM_OUTB(SMBSCTRL, VIAPM_INB(SMBSCTRL) & ~SMBSCTRL_ENABLE);
363 /* enable the SMBus controller function */
364 l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1);
365 pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 1, 1);
368 /* enable interrupts */
369 VIAPM_OUTB(SMBHCTRL, VIAPM_INB(SMBHCTRL) | SMBHCTRL_ENABLE);
376 bus_release_resource(dev, SYS_RES_IOPORT, viapm->iorid, viapm->iores);
379 bus_release_resource(dev, SYS_RES_IRQ, viapm->irqrid, viapm->irqres);
386 viapm_586b_attach(device_t dev)
388 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
390 if (!(viapm->iores = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
391 &viapm->iorid, RF_ACTIVE | RF_SHAREABLE))) {
392 device_printf(dev, "could not allocate bus resource\n");
395 viapm->st = rman_get_bustag(viapm->iores);
396 viapm->sh = rman_get_bushandle(viapm->iores);
398 VIAPM_OUTB(GPIO_DIR, VIAPM_INB(GPIO_DIR) | VIAPM_SCL | VIAPM_SDA);
400 /* add generic bit-banging code */
401 if (!(viapm->iicbb = device_add_child(dev, "iicbb", -1)))
404 bus_generic_attach(dev);
410 bus_release_resource(dev, SYS_RES_IOPORT,
411 viapm->iorid, viapm->iores);
416 viapm_586b_detach(device_t dev)
418 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
421 bus_generic_detach(dev);
423 device_delete_child(dev, viapm->iicbb);
426 if (viapm->iores && (error = bus_release_resource(dev, SYS_RES_IOPORT,
427 viapm->iorid, viapm->iores)))
434 viapm_pro_detach(device_t dev)
436 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
439 bus_generic_detach(dev);
441 device_delete_child(dev, viapm->smbus);
444 if ((error = bus_release_resource(dev, SYS_RES_IOPORT,
445 viapm->iorid, viapm->iores)))
449 if ((error = bus_release_resource(dev, SYS_RES_IRQ,
450 viapm->irqrid, viapm->irqres))
458 viabb_callback(device_t dev, int index, caddr_t *data)
464 viabb_setscl(device_t dev, int ctrl)
466 struct viapm_softc *viapm = device_get_softc(dev);
469 val = VIAPM_INB(GPIO_VAL);
476 VIAPM_OUTB(GPIO_VAL, val);
482 viabb_setsda(device_t dev, int data)
484 struct viapm_softc *viapm = device_get_softc(dev);
487 val = VIAPM_INB(GPIO_VAL);
494 VIAPM_OUTB(GPIO_VAL, val);
500 viabb_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr)
503 viabb_setsda(dev, 1);
504 viabb_setscl(dev, 1);
506 return (IIC_ENOADDR);
510 viabb_getscl(device_t dev)
512 struct viapm_softc *viapm = device_get_softc(dev);
514 return ((VIAPM_INB(EXTSMI_VAL) & VIAPM_SCL) != 0);
518 viabb_getsda(device_t dev)
520 struct viapm_softc *viapm = device_get_softc(dev);
522 return ((VIAPM_INB(EXTSMI_VAL) & VIAPM_SDA) != 0);
526 viapm_abort(struct viapm_softc *viapm)
528 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_KILL);
535 viapm_clear(struct viapm_softc *viapm)
537 VIAPM_OUTB(SMBHST, SMBHST_FAILED | SMBHST_COLLID |
538 SMBHST_ERROR | SMBHST_INTR);
545 viapm_busy(struct viapm_softc *viapm)
549 sts = VIAPM_INB(SMBHST);
551 VIAPM_DEBUG(printf("viapm: idle? STS=0x%x\n", sts));
553 return (sts & SMBHST_BUSY);
557 * Poll the SMBus controller
560 viapm_wait(struct viapm_softc *viapm)
566 /* wait for command to complete and SMBus controller is idle */
569 sts = VIAPM_INB(SMBHST);
571 /* check if the controller is processing a command */
572 if (!(sts & SMBHST_BUSY) && (sts & SMBHST_INTR))
576 VIAPM_DEBUG(printf("viapm: SMBHST=0x%x\n", sts));
581 error |= SMB_ETIMEOUT;
583 if (sts & SMBHST_FAILED)
586 if (sts & SMBHST_COLLID)
589 if (sts & SMBHST_ERROR)
590 error |= SMB_EBUSERR;
592 if (error != SMB_ENOERR)
601 viasmb_callback(device_t dev, int index, caddr_t *data)
606 case SMB_REQUEST_BUS:
607 case SMB_RELEASE_BUS:
608 /* ok, bus allocation accepted */
618 viasmb_quick(device_t dev, u_char slave, int how)
620 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
624 if (viapm_busy(viapm))
629 VIAPM_DEBUG(printf("viapm: QWRITE to 0x%x", slave));
630 VIAPM_OUTB(SMBHADDR, slave & ~LSB);
633 VIAPM_DEBUG(printf("viapm: QREAD to 0x%x", slave));
634 VIAPM_OUTB(SMBHADDR, slave | LSB);
637 panic("%s: unknown QUICK command (%x)!", __func__, how);
640 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_QUICK);
642 error = viapm_wait(viapm);
648 viasmb_sendb(device_t dev, u_char slave, char byte)
650 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
654 if (viapm_busy(viapm))
657 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
658 VIAPM_OUTB(SMBHCMD, byte);
660 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_SENDRECV);
662 error = viapm_wait(viapm);
664 VIAPM_DEBUG(printf("viapm: SENDB to 0x%x, byte=0x%x, error=0x%x\n", slave, byte, error));
670 viasmb_recvb(device_t dev, u_char slave, char *byte)
672 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
676 if (viapm_busy(viapm))
679 VIAPM_OUTB(SMBHADDR, slave | LSB);
681 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_SENDRECV);
683 if ((error = viapm_wait(viapm)) == SMB_ENOERR)
684 *byte = VIAPM_INB(SMBHDATA0);
686 VIAPM_DEBUG(printf("viapm: RECVB from 0x%x, byte=0x%x, error=0x%x\n", slave, *byte, error));
692 viasmb_writeb(device_t dev, u_char slave, char cmd, char byte)
694 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
698 if (viapm_busy(viapm))
701 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
702 VIAPM_OUTB(SMBHCMD, cmd);
703 VIAPM_OUTB(SMBHDATA0, byte);
705 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BYTE);
707 error = viapm_wait(viapm);
709 VIAPM_DEBUG(printf("viapm: WRITEB to 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, byte, error));
715 viasmb_readb(device_t dev, u_char slave, char cmd, char *byte)
717 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
721 if (viapm_busy(viapm))
724 VIAPM_OUTB(SMBHADDR, slave | LSB);
725 VIAPM_OUTB(SMBHCMD, cmd);
727 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BYTE);
729 if ((error = viapm_wait(viapm)) == SMB_ENOERR)
730 *byte = VIAPM_INB(SMBHDATA0);
732 VIAPM_DEBUG(printf("viapm: READB from 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, *byte, error));
738 viasmb_writew(device_t dev, u_char slave, char cmd, short word)
740 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
744 if (viapm_busy(viapm))
747 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
748 VIAPM_OUTB(SMBHCMD, cmd);
749 VIAPM_OUTB(SMBHDATA0, word & 0x00ff);
750 VIAPM_OUTB(SMBHDATA1, (word & 0xff00) >> 8);
752 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_WORD);
754 error = viapm_wait(viapm);
756 VIAPM_DEBUG(printf("viapm: WRITEW to 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, word, error));
762 viasmb_readw(device_t dev, u_char slave, char cmd, short *word)
764 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
769 if (viapm_busy(viapm))
772 VIAPM_OUTB(SMBHADDR, slave | LSB);
773 VIAPM_OUTB(SMBHCMD, cmd);
775 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_WORD);
777 if ((error = viapm_wait(viapm)) == SMB_ENOERR) {
778 low = VIAPM_INB(SMBHDATA0);
779 high = VIAPM_INB(SMBHDATA1);
781 *word = ((high & 0xff) << 8) | (low & 0xff);
784 VIAPM_DEBUG(printf("viapm: READW from 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, *word, error));
790 viasmb_bwrite(device_t dev, u_char slave, char cmd, u_char count, char *buf)
792 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
793 u_char remain, len, i;
794 int error = SMB_ENOERR;
797 if (viapm_busy(viapm))
802 len = min(remain, 32);
804 VIAPM_OUTB(SMBHADDR, slave & ~LSB);
805 VIAPM_OUTB(SMBHCMD, cmd);
806 VIAPM_OUTB(SMBHDATA0, len);
807 i = VIAPM_INB(SMBHCTRL);
809 /* fill the 32-byte internal buffer */
810 for (i=0; i<len; i++) {
811 VIAPM_OUTB(SMBHBLOCK, buf[count-remain+i]);
814 VIAPM_OUTB(SMBHCMD, cmd);
815 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BLOCK);
817 if ((error = viapm_wait(viapm)) != SMB_ENOERR)
824 VIAPM_DEBUG(printf("viapm: WRITEBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, count, cmd, error));
831 viasmb_bread(device_t dev, u_char slave, char cmd, u_char count, char *buf)
833 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
834 u_char remain, len, i;
835 int error = SMB_ENOERR;
838 if (viapm_busy(viapm))
843 VIAPM_OUTB(SMBHADDR, slave | LSB);
844 VIAPM_OUTB(SMBHCMD, cmd);
845 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BLOCK);
847 if ((error = viapm_wait(viapm)) != SMB_ENOERR)
850 len = VIAPM_INB(SMBHDATA0);
851 i = VIAPM_INB(SMBHCTRL); /* reset counter */
853 len = min(len, remain);
855 /* read the 32-byte internal buffer */
856 for (i=0; i<len; i++) {
857 buf[count-remain+i] = VIAPM_INB(SMBHBLOCK);
864 VIAPM_DEBUG(printf("viapm: READBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, count, cmd, error));
869 static device_method_t viapm_methods[] = {
870 /* device interface */
871 DEVMETHOD(device_probe, viapm_586b_probe),
872 DEVMETHOD(device_attach, viapm_586b_attach),
873 DEVMETHOD(device_detach, viapm_586b_detach),
875 /* iicbb interface */
876 DEVMETHOD(iicbb_callback, viabb_callback),
877 DEVMETHOD(iicbb_setscl, viabb_setscl),
878 DEVMETHOD(iicbb_setsda, viabb_setsda),
879 DEVMETHOD(iicbb_getscl, viabb_getscl),
880 DEVMETHOD(iicbb_getsda, viabb_getsda),
881 DEVMETHOD(iicbb_reset, viabb_reset),
886 static driver_t viapm_driver = {
889 sizeof(struct viapm_softc),
892 static device_method_t viapropm_methods[] = {
893 /* device interface */
894 DEVMETHOD(device_probe, viapm_pro_probe),
895 DEVMETHOD(device_attach, viapm_pro_attach),
896 DEVMETHOD(device_detach, viapm_pro_detach),
898 /* smbus interface */
899 DEVMETHOD(smbus_callback, viasmb_callback),
900 DEVMETHOD(smbus_quick, viasmb_quick),
901 DEVMETHOD(smbus_sendb, viasmb_sendb),
902 DEVMETHOD(smbus_recvb, viasmb_recvb),
903 DEVMETHOD(smbus_writeb, viasmb_writeb),
904 DEVMETHOD(smbus_readb, viasmb_readb),
905 DEVMETHOD(smbus_writew, viasmb_writew),
906 DEVMETHOD(smbus_readw, viasmb_readw),
907 DEVMETHOD(smbus_bwrite, viasmb_bwrite),
908 DEVMETHOD(smbus_bread, viasmb_bread),
913 static driver_t viapropm_driver = {
916 sizeof(struct viapm_softc),
919 DRIVER_MODULE(viapm, pci, viapm_driver, viapm_devclass, 0, 0);
920 DRIVER_MODULE(viapropm, pci, viapropm_driver, viapropm_devclass, 0, 0);
922 MODULE_DEPEND(viapm, pci, 1, 1, 1);
923 MODULE_DEPEND(viaprom, pci, 1, 1, 1);
924 MODULE_DEPEND(viapm, iicbb, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER);
925 MODULE_DEPEND(viapropm, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER);
926 MODULE_VERSION(viapm, 1);