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_pio.h>
38 #include <machine/bus_memio.h>
39 #include <machine/bus.h>
40 #include <machine/clock.h> /* for DELAY */
41 #include <machine/resource.h>
44 #include <dev/pci/pcivar.h>
45 #include <dev/pci/pcireg.h>
47 #include <dev/iicbus/iiconf.h>
48 #include <dev/iicbus/iicbus.h>
50 #include <dev/smbus/smbconf.h>
51 #include <dev/smbus/smbus.h>
56 #define VIAPM_DEBUG(x) if (viapm_debug) (x)
59 static int viapm_debug = 1;
61 static int viapm_debug = 0;
64 #define VIA_586B_PMU_ID 0x30401106
65 #define VIA_596A_PMU_ID 0x30501106
66 #define VIA_596B_PMU_ID 0x30511106
67 #define VIA_686A_PMU_ID 0x30571106
68 #define VIA_8233_PMU_ID 0x30741106
69 #define VIA_8233A_PMU_ID 0x31471106
71 #define VIAPM_INB(port) \
72 ((u_char)bus_space_read_1(viapm->st, viapm->sh, port))
73 #define VIAPM_OUTB(port,val) \
74 (bus_space_write_1(viapm->st, viapm->sh, port, (u_char)(val)))
76 #define VIAPM_TYP_UNKNOWN 0
77 #define VIAPM_TYP_586B_3040E 1
78 #define VIAPM_TYP_586B_3040F 2
79 #define VIAPM_TYP_596B 3
80 #define VIAPM_TYP_686A 4
81 #define VIAPM_TYP_8233 5
87 bus_space_handle_t sh;
90 struct resource *iores;
91 struct resource *irqres;
98 static devclass_t viapm_devclass;
99 static devclass_t viapropm_devclass;
102 * VT82C586B definitions
105 #define VIAPM_586B_REVID 0x08
107 #define VIAPM_586B_3040E_BASE 0x20
108 #define VIAPM_586B_3040E_ACTIV 0x4 /* 16 bits */
110 #define VIAPM_586B_3040F_BASE 0x48
111 #define VIAPM_586B_3040F_ACTIV 0x41 /* 8 bits */
113 #define VIAPM_586B_OEM_REV_E 0x00
114 #define VIAPM_586B_OEM_REV_F 0x01
115 #define VIAPM_586B_PROD_REV_A 0x10
117 #define VIAPM_586B_BA_MASK 0x0000ff00
119 #define GPIO_DIR 0x40
120 #define GPIO_VAL 0x42
121 #define EXTSMI_VAL 0x44
123 #define VIAPM_SCL 0x02 /* GPIO1_VAL */
124 #define VIAPM_SDA 0x04 /* GPIO2_VAL */
127 * VIAPRO common definitions
130 #define VIAPM_PRO_BA_MASK 0x0000fff0
131 #define VIAPM_PRO_SMBCTRL 0xd2
132 #define VIAPM_PRO_REVID 0xd6
135 * VT82C686A definitions
138 #define VIAPM_PRO_BASE 0x90
145 #define SMBHDATA0 0x5
146 #define SMBHDATA1 0x6
147 #define SMBHBLOCK 0x7
151 #define SMBSSDWCMD 0x9
152 #define SMBSEVENT 0xa
155 #define SMBHST_RESERVED 0xef /* reserved bits */
156 #define SMBHST_FAILED 0x10 /* failed bus transaction */
157 #define SMBHST_COLLID 0x08 /* bus collision */
158 #define SMBHST_ERROR 0x04 /* device error */
159 #define SMBHST_INTR 0x02 /* command completed */
160 #define SMBHST_BUSY 0x01 /* host busy */
162 #define SMBHCTRL_START 0x40 /* start command */
163 #define SMBHCTRL_PROTO 0x1c /* command protocol mask */
164 #define SMBHCTRL_QUICK 0x00
165 #define SMBHCTRL_SENDRECV 0x04
166 #define SMBHCTRL_BYTE 0x08
167 #define SMBHCTRL_WORD 0x0c
168 #define SMBHCTRL_BLOCK 0x14
169 #define SMBHCTRL_KILL 0x02 /* stop the current transaction */
170 #define SMBHCTRL_ENABLE 0x01 /* enable interrupts */
172 #define SMBSCTRL_ENABLE 0x01 /* enable slave */
176 * VIA8233 definitions
179 #define VIAPM_8233_BASE 0xD0
182 viapm_586b_probe(device_t dev)
184 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
189 switch (pci_get_devid(dev)) {
190 case VIA_586B_PMU_ID:
192 bzero(viapm, sizeof(struct viapm_softc));
194 l = pci_read_config(dev, VIAPM_586B_REVID, 1);
196 case VIAPM_586B_OEM_REV_E:
197 viapm->type = VIAPM_TYP_586B_3040E;
198 viapm->iorid = VIAPM_586B_3040E_BASE;
200 /* Activate IO block access */
201 s = pci_read_config(dev, VIAPM_586B_3040E_ACTIV, 2);
202 pci_write_config(dev, VIAPM_586B_3040E_ACTIV, s | 0x1, 2);
205 case VIAPM_586B_OEM_REV_F:
206 case VIAPM_586B_PROD_REV_A:
208 viapm->type = VIAPM_TYP_586B_3040F;
209 viapm->iorid = VIAPM_586B_3040F_BASE;
211 /* Activate IO block access */
212 c = pci_read_config(dev, VIAPM_586B_3040F_ACTIV, 1);
213 pci_write_config(dev, VIAPM_586B_3040F_ACTIV, c | 0x80, 1);
217 viapm->base = pci_read_config(dev, viapm->iorid, 4) &
221 * We have to set the I/O resources by hand because it is
222 * described outside the viapmope of the traditional maps
224 if (bus_set_resource(dev, SYS_RES_IOPORT, viapm->iorid,
226 device_printf(dev, "could not set bus resource\n");
229 device_set_desc(dev, "VIA VT82C586B Power Management Unit");
241 viapm_pro_probe(device_t dev)
243 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
244 #ifdef VIAPM_BASE_ADDR
247 u_int32_t base_cfgreg;
250 switch (pci_get_devid(dev)) {
251 case VIA_596A_PMU_ID:
252 desc = "VIA VT82C596A Power Management Unit";
253 viapm->type = VIAPM_TYP_596B;
254 base_cfgreg = VIAPM_PRO_BASE;
257 case VIA_596B_PMU_ID:
258 desc = "VIA VT82C596B Power Management Unit";
259 viapm->type = VIAPM_TYP_596B;
260 base_cfgreg = VIAPM_PRO_BASE;
263 case VIA_686A_PMU_ID:
264 desc = "VIA VT82C686A Power Management Unit";
265 viapm->type = VIAPM_TYP_686A;
266 base_cfgreg = VIAPM_PRO_BASE;
269 case VIA_8233_PMU_ID:
270 case VIA_8233A_PMU_ID:
271 desc = "VIA VT8233 Power Management Unit";
272 viapm->type = VIAPM_TYP_UNKNOWN;
273 base_cfgreg = VIAPM_8233_BASE;
278 #ifdef VIAPM_BASE_ADDR
279 /* force VIAPM I/O base address */
281 /* enable the SMBus controller function */
282 l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1);
283 pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 1, 1);
285 /* write the base address */
286 pci_write_config(dev, base_cfgreg,
287 VIAPM_BASE_ADDR & VIAPM_PRO_BA_MASK, 4);
290 viapm->base = pci_read_config(dev, base_cfgreg, 4) & VIAPM_PRO_BA_MASK;
293 * We have to set the I/O resources by hand because it is
294 * described outside the viapmope of the traditional maps
296 viapm->iorid = base_cfgreg;
297 if (bus_set_resource(dev, SYS_RES_IOPORT, viapm->iorid,
299 device_printf(dev, "could not set bus resource 0x%x\n",
304 if (1 || bootverbose) {
305 device_printf(dev, "SMBus I/O base at 0x%x\n", viapm->base);
308 device_set_desc(dev, desc);
319 viapm_pro_attach(device_t dev)
321 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
324 if (!(viapm->iores = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
325 &viapm->iorid, RF_ACTIVE))) {
326 device_printf(dev, "could not allocate bus space\n");
329 viapm->st = rman_get_bustag(viapm->iores);
330 viapm->sh = rman_get_bushandle(viapm->iores);
334 l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1);
335 pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 0x80, 1);
338 if (!(viapm->irqres = bus_alloc_resource(dev, SYS_RES_IRQ,
339 &viapm->irqrid, 9, 9, 1,
340 RF_SHAREABLE | RF_ACTIVE))) {
341 device_printf(dev, "could not allocate irq\n");
345 if (bus_setup_intr(dev, viapm->irqres, INTR_TYPE_MISC,
346 (driver_intr_t *) viasmb_intr, viapm, &viapm->irqih)) {
347 device_printf(dev, "could not setup irq\n");
352 if (1 | bootverbose) {
353 l = pci_read_config(dev, VIAPM_PRO_REVID, 1);
354 device_printf(dev, "SMBus revision code 0x%x\n", l);
357 viapm->smbus = device_add_child(dev, "smbus", -1);
359 /* probe and attach the smbus */
360 bus_generic_attach(dev);
362 /* disable slave function */
363 VIAPM_OUTB(SMBSCTRL, VIAPM_INB(SMBSCTRL) & ~SMBSCTRL_ENABLE);
365 /* enable the SMBus controller function */
366 l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1);
367 pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 1, 1);
370 /* enable interrupts */
371 VIAPM_OUTB(SMBHCTRL, VIAPM_INB(SMBHCTRL) | SMBHCTRL_ENABLE);
378 bus_release_resource(dev, SYS_RES_IOPORT, viapm->iorid, viapm->iores);
381 bus_release_resource(dev, SYS_RES_IRQ, viapm->irqrid, viapm->irqres);
388 viapm_586b_attach(device_t dev)
390 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
392 if (!(viapm->iores = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
393 &viapm->iorid, RF_ACTIVE | RF_SHAREABLE))) {
394 device_printf(dev, "could not allocate bus resource\n");
397 viapm->st = rman_get_bustag(viapm->iores);
398 viapm->sh = rman_get_bushandle(viapm->iores);
400 VIAPM_OUTB(GPIO_DIR, VIAPM_INB(GPIO_DIR) | VIAPM_SCL | VIAPM_SDA);
402 /* add generic bit-banging code */
403 if (!(viapm->iicbb = device_add_child(dev, "iicbb", -1)))
406 bus_generic_attach(dev);
412 bus_release_resource(dev, SYS_RES_IOPORT,
413 viapm->iorid, viapm->iores);
418 viapm_586b_detach(device_t dev)
420 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
423 bus_generic_detach(dev);
425 device_delete_child(dev, viapm->iicbb);
428 if (viapm->iores && (error = bus_release_resource(dev, SYS_RES_IOPORT,
429 viapm->iorid, viapm->iores)))
436 viapm_pro_detach(device_t dev)
438 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
441 bus_generic_detach(dev);
443 device_delete_child(dev, viapm->smbus);
446 if ((error = bus_release_resource(dev, SYS_RES_IOPORT,
447 viapm->iorid, viapm->iores)))
451 if ((error = bus_release_resource(dev, SYS_RES_IRQ,
452 viapm->irqrid, viapm->irqres))
460 viabb_callback(device_t dev, int index, caddr_t *data)
466 viabb_setscl(device_t dev, int ctrl)
468 struct viapm_softc *viapm = device_get_softc(dev);
471 val = VIAPM_INB(GPIO_VAL);
478 VIAPM_OUTB(GPIO_VAL, val);
484 viabb_setsda(device_t dev, int data)
486 struct viapm_softc *viapm = device_get_softc(dev);
489 val = VIAPM_INB(GPIO_VAL);
496 VIAPM_OUTB(GPIO_VAL, val);
502 viabb_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr)
505 viabb_setsda(dev, 1);
506 viabb_setscl(dev, 1);
508 return (IIC_ENOADDR);
512 viabb_getscl(device_t dev)
514 struct viapm_softc *viapm = device_get_softc(dev);
516 return ((VIAPM_INB(EXTSMI_VAL) & VIAPM_SCL) != 0);
520 viabb_getsda(device_t dev)
522 struct viapm_softc *viapm = device_get_softc(dev);
524 return ((VIAPM_INB(EXTSMI_VAL) & VIAPM_SDA) != 0);
528 viapm_abort(struct viapm_softc *viapm)
530 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_KILL);
537 viapm_clear(struct viapm_softc *viapm)
539 VIAPM_OUTB(SMBHST, SMBHST_FAILED | SMBHST_COLLID |
540 SMBHST_ERROR | SMBHST_INTR);
547 viapm_busy(struct viapm_softc *viapm)
551 sts = VIAPM_INB(SMBHST);
553 VIAPM_DEBUG(printf("viapm: idle? STS=0x%x\n", sts));
555 return (sts & SMBHST_BUSY);
559 * Poll the SMBus controller
562 viapm_wait(struct viapm_softc *viapm)
568 /* wait for command to complete and SMBus controller is idle */
571 sts = VIAPM_INB(SMBHST);
573 /* check if the controller is processing a command */
574 if (!(sts & SMBHST_BUSY) && (sts & SMBHST_INTR))
578 VIAPM_DEBUG(printf("viapm: SMBHST=0x%x\n", sts));
583 error |= SMB_ETIMEOUT;
585 if (sts & SMBHST_FAILED)
588 if (sts & SMBHST_COLLID)
591 if (sts & SMBHST_ERROR)
592 error |= SMB_EBUSERR;
594 if (error != SMB_ENOERR)
603 viasmb_callback(device_t dev, int index, caddr_t *data)
608 case SMB_REQUEST_BUS:
609 case SMB_RELEASE_BUS:
610 /* ok, bus allocation accepted */
620 viasmb_quick(device_t dev, u_char slave, int how)
622 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
626 if (viapm_busy(viapm))
631 VIAPM_DEBUG(printf("viapm: QWRITE to 0x%x", slave));
632 VIAPM_OUTB(SMBHADDR, slave & ~LSB);
635 VIAPM_DEBUG(printf("viapm: QREAD to 0x%x", slave));
636 VIAPM_OUTB(SMBHADDR, slave | LSB);
639 panic("%s: unknown QUICK command (%x)!", __func__, how);
642 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_QUICK);
644 error = viapm_wait(viapm);
650 viasmb_sendb(device_t dev, u_char slave, char byte)
652 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
656 if (viapm_busy(viapm))
659 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
660 VIAPM_OUTB(SMBHCMD, byte);
662 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_SENDRECV);
664 error = viapm_wait(viapm);
666 VIAPM_DEBUG(printf("viapm: SENDB to 0x%x, byte=0x%x, error=0x%x\n", slave, byte, error));
672 viasmb_recvb(device_t dev, u_char slave, char *byte)
674 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
678 if (viapm_busy(viapm))
681 VIAPM_OUTB(SMBHADDR, slave | LSB);
683 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_SENDRECV);
685 if ((error = viapm_wait(viapm)) == SMB_ENOERR)
686 *byte = VIAPM_INB(SMBHDATA0);
688 VIAPM_DEBUG(printf("viapm: RECVB from 0x%x, byte=0x%x, error=0x%x\n", slave, *byte, error));
694 viasmb_writeb(device_t dev, u_char slave, char cmd, char byte)
696 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
700 if (viapm_busy(viapm))
703 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
704 VIAPM_OUTB(SMBHCMD, cmd);
705 VIAPM_OUTB(SMBHDATA0, byte);
707 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BYTE);
709 error = viapm_wait(viapm);
711 VIAPM_DEBUG(printf("viapm: WRITEB to 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, byte, error));
717 viasmb_readb(device_t dev, u_char slave, char cmd, char *byte)
719 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
723 if (viapm_busy(viapm))
726 VIAPM_OUTB(SMBHADDR, slave | LSB);
727 VIAPM_OUTB(SMBHCMD, cmd);
729 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BYTE);
731 if ((error = viapm_wait(viapm)) == SMB_ENOERR)
732 *byte = VIAPM_INB(SMBHDATA0);
734 VIAPM_DEBUG(printf("viapm: READB from 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, *byte, error));
740 viasmb_writew(device_t dev, u_char slave, char cmd, short word)
742 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
746 if (viapm_busy(viapm))
749 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
750 VIAPM_OUTB(SMBHCMD, cmd);
751 VIAPM_OUTB(SMBHDATA0, word & 0x00ff);
752 VIAPM_OUTB(SMBHDATA1, (word & 0xff00) >> 8);
754 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_WORD);
756 error = viapm_wait(viapm);
758 VIAPM_DEBUG(printf("viapm: WRITEW to 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, word, error));
764 viasmb_readw(device_t dev, u_char slave, char cmd, short *word)
766 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
771 if (viapm_busy(viapm))
774 VIAPM_OUTB(SMBHADDR, slave | LSB);
775 VIAPM_OUTB(SMBHCMD, cmd);
777 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_WORD);
779 if ((error = viapm_wait(viapm)) == SMB_ENOERR) {
780 low = VIAPM_INB(SMBHDATA0);
781 high = VIAPM_INB(SMBHDATA1);
783 *word = ((high & 0xff) << 8) | (low & 0xff);
786 VIAPM_DEBUG(printf("viapm: READW from 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, *word, error));
792 viasmb_bwrite(device_t dev, u_char slave, char cmd, u_char count, char *buf)
794 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
795 u_char remain, len, i;
796 int error = SMB_ENOERR;
799 if (viapm_busy(viapm))
804 len = min(remain, 32);
806 VIAPM_OUTB(SMBHADDR, slave & ~LSB);
807 VIAPM_OUTB(SMBHCMD, cmd);
808 VIAPM_OUTB(SMBHDATA0, len);
809 i = VIAPM_INB(SMBHCTRL);
811 /* fill the 32-byte internal buffer */
812 for (i=0; i<len; i++) {
813 VIAPM_OUTB(SMBHBLOCK, buf[count-remain+i]);
816 VIAPM_OUTB(SMBHCMD, cmd);
817 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BLOCK);
819 if ((error = viapm_wait(viapm)) != SMB_ENOERR)
826 VIAPM_DEBUG(printf("viapm: WRITEBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, count, cmd, error));
833 viasmb_bread(device_t dev, u_char slave, char cmd, u_char count, char *buf)
835 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
836 u_char remain, len, i;
837 int error = SMB_ENOERR;
840 if (viapm_busy(viapm))
845 VIAPM_OUTB(SMBHADDR, slave | LSB);
846 VIAPM_OUTB(SMBHCMD, cmd);
847 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BLOCK);
849 if ((error = viapm_wait(viapm)) != SMB_ENOERR)
852 len = VIAPM_INB(SMBHDATA0);
853 i = VIAPM_INB(SMBHCTRL); /* reset counter */
855 len = min(len, remain);
857 /* read the 32-byte internal buffer */
858 for (i=0; i<len; i++) {
859 buf[count-remain+i] = VIAPM_INB(SMBHBLOCK);
866 VIAPM_DEBUG(printf("viapm: READBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, count, cmd, error));
871 static device_method_t viapm_methods[] = {
872 /* device interface */
873 DEVMETHOD(device_probe, viapm_586b_probe),
874 DEVMETHOD(device_attach, viapm_586b_attach),
875 DEVMETHOD(device_detach, viapm_586b_detach),
877 /* iicbb interface */
878 DEVMETHOD(iicbb_callback, viabb_callback),
879 DEVMETHOD(iicbb_setscl, viabb_setscl),
880 DEVMETHOD(iicbb_setsda, viabb_setsda),
881 DEVMETHOD(iicbb_getscl, viabb_getscl),
882 DEVMETHOD(iicbb_getsda, viabb_getsda),
883 DEVMETHOD(iicbb_reset, viabb_reset),
888 static driver_t viapm_driver = {
891 sizeof(struct viapm_softc),
894 static device_method_t viapropm_methods[] = {
895 /* device interface */
896 DEVMETHOD(device_probe, viapm_pro_probe),
897 DEVMETHOD(device_attach, viapm_pro_attach),
898 DEVMETHOD(device_detach, viapm_pro_detach),
900 /* smbus interface */
901 DEVMETHOD(smbus_callback, viasmb_callback),
902 DEVMETHOD(smbus_quick, viasmb_quick),
903 DEVMETHOD(smbus_sendb, viasmb_sendb),
904 DEVMETHOD(smbus_recvb, viasmb_recvb),
905 DEVMETHOD(smbus_writeb, viasmb_writeb),
906 DEVMETHOD(smbus_readb, viasmb_readb),
907 DEVMETHOD(smbus_writew, viasmb_writew),
908 DEVMETHOD(smbus_readw, viasmb_readw),
909 DEVMETHOD(smbus_bwrite, viasmb_bwrite),
910 DEVMETHOD(smbus_bread, viasmb_bread),
915 static driver_t viapropm_driver = {
918 sizeof(struct viapm_softc),
921 DRIVER_MODULE(viapm, pci, viapm_driver, viapm_devclass, 0, 0);
922 DRIVER_MODULE(viapropm, pci, viapropm_driver, viapropm_devclass, 0, 0);
924 MODULE_DEPEND(viapm, pci, 1, 1, 1);
925 MODULE_DEPEND(viaprom, pci, 1, 1, 1);
926 MODULE_DEPEND(viapm, iicbb, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER);
927 MODULE_DEPEND(viapropm, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER);
928 MODULE_VERSION(viapm, 1);