2 * Copyright (c) 2001 Alcove - Nicolas Souchu
3 * Copyright (c) 2002 Nicolas Souchu
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * $FreeBSD: src/sys/pci/viapm.c,v 1.1.2.1 2002/04/19 05:52:15 nsouch Exp $
28 * $DragonFly: src/sys/dev/powermng/i386/viapm/viapm.c,v 1.10 2006/12/22 23:26:23 swildner Exp $
31 #include <sys/param.h>
32 #include <sys/kernel.h>
33 #include <sys/systm.h>
34 #include <sys/module.h>
39 #include <machine/clock.h> /* for DELAY */
41 #include <bus/pci/pcivar.h>
42 #include <bus/pci/pcireg.h>
44 #include <bus/iicbus/iiconf.h>
45 #include <bus/iicbus/iicbus.h>
47 #include <bus/smbus/smbconf.h>
48 #include <bus/smbus/smbus.h>
53 #define VIAPM_DEBUG(x) if (viapm_debug) (x)
56 static int viapm_debug = 1;
58 static int viapm_debug = 0;
61 #define VIA_586B_PMU_ID 0x30401106
62 #define VIA_596A_PMU_ID 0x30501106
63 #define VIA_596B_PMU_ID 0x30511106
64 #define VIA_686A_PMU_ID 0x30571106
65 #define VIA_8233_PMU_ID 0x30741106
67 #define VIAPM_INB(port) \
68 ((u_char)bus_space_read_1(viapm->st, viapm->sh, port))
69 #define VIAPM_OUTB(port,val) \
70 (bus_space_write_1(viapm->st, viapm->sh, port, (u_char)val))
72 #define VIAPM_TYP_UNKNOWN 0
73 #define VIAPM_TYP_586B_3040E 1
74 #define VIAPM_TYP_586B_3040F 2
75 #define VIAPM_TYP_596B 3
76 #define VIAPM_TYP_686A 4
77 #define VIAPM_TYP_8233 5
83 bus_space_handle_t sh;
86 struct resource *iores;
87 struct resource *irqres;
94 static devclass_t viapm_devclass;
95 static devclass_t viapropm_devclass;
98 * VT82C586B definitions
101 #define VIAPM_586B_REVID 0x08
103 #define VIAPM_586B_3040E_BASE 0x20
104 #define VIAPM_586B_3040E_ACTIV 0x4 /* 16 bits */
106 #define VIAPM_586B_3040F_BASE 0x48
107 #define VIAPM_586B_3040F_ACTIV 0x41 /* 8 bits */
109 #define VIAPM_586B_OEM_REV_E 0x00
110 #define VIAPM_586B_OEM_REV_F 0x01
111 #define VIAPM_586B_PROD_REV_A 0x10
113 #define VIAPM_586B_BA_MASK 0x0000ff00
115 #define GPIO_DIR 0x40
116 #define GPIO_VAL 0x42
117 #define EXTSMI_VAL 0x44
119 #define VIAPM_SCL 0x02 /* GPIO1_VAL */
120 #define VIAPM_SDA 0x04 /* GPIO2_VAL */
123 * VIAPRO common definitions
126 #define VIAPM_PRO_BA_MASK 0x0000fff0
127 #define VIAPM_PRO_SMBCTRL 0xd2
128 #define VIAPM_PRO_REVID 0xd6
131 * VT82C686A definitions
134 #define VIAPM_PRO_BASE 0x90
141 #define SMBHDATA0 0x5
142 #define SMBHDATA1 0x6
143 #define SMBHBLOCK 0x7
147 #define SMBSSDWCMD 0x9
148 #define SMBSEVENT 0xa
151 #define SMBHST_RESERVED 0xef /* reserved bits */
152 #define SMBHST_FAILED 0x10 /* failed bus transaction */
153 #define SMBHST_COLLID 0x08 /* bus collision */
154 #define SMBHST_ERROR 0x04 /* device error */
155 #define SMBHST_INTR 0x02 /* command completed */
156 #define SMBHST_BUSY 0x01 /* host busy */
158 #define SMBHCTRL_START 0x40 /* start command */
159 #define SMBHCTRL_PROTO 0x1c /* command protocol mask */
160 #define SMBHCTRL_QUICK 0x00
161 #define SMBHCTRL_SENDRECV 0x04
162 #define SMBHCTRL_BYTE 0x08
163 #define SMBHCTRL_WORD 0x0c
164 #define SMBHCTRL_BLOCK 0x14
165 #define SMBHCTRL_KILL 0x02 /* stop the current transaction */
166 #define SMBHCTRL_ENABLE 0x01 /* enable interrupts */
168 #define SMBSCTRL_ENABLE 0x01 /* enable slave */
172 * VIA8233 definitions
175 #define VIAPM_8233_BASE 0xD0
178 viapm_586b_probe(device_t dev)
180 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
185 switch (pci_get_devid(dev)) {
186 case VIA_586B_PMU_ID:
188 bzero(viapm, sizeof(struct viapm_softc));
190 l = pci_read_config(dev, VIAPM_586B_REVID, 1);
192 case VIAPM_586B_OEM_REV_E:
193 viapm->type = VIAPM_TYP_586B_3040E;
194 viapm->iorid = VIAPM_586B_3040E_BASE;
196 /* Activate IO block access */
197 s = pci_read_config(dev, VIAPM_586B_3040E_ACTIV, 2);
198 pci_write_config(dev, VIAPM_586B_3040E_ACTIV, s | 0x1, 2);
201 case VIAPM_586B_OEM_REV_F:
202 case VIAPM_586B_PROD_REV_A:
204 viapm->type = VIAPM_TYP_586B_3040F;
205 viapm->iorid = VIAPM_586B_3040F_BASE;
207 /* Activate IO block access */
208 c = pci_read_config(dev, VIAPM_586B_3040F_ACTIV, 1);
209 pci_write_config(dev, VIAPM_586B_3040F_ACTIV, c | 0x80, 1);
213 viapm->base = pci_read_config(dev, viapm->iorid, 4) &
217 * We have to set the I/O resources by hand because it is
218 * described outside the viapmope of the traditional maps
220 if (bus_set_resource(dev, SYS_RES_IOPORT, viapm->iorid,
222 device_printf(dev, "could not set bus resource\n");
225 device_set_desc(dev, "VIA VT82C586B Power Management Unit");
237 viapm_pro_probe(device_t dev)
239 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
240 #ifdef VIAPM_BASE_ADDR
243 u_int32_t base_cfgreg;
246 switch (pci_get_devid(dev)) {
247 case VIA_596A_PMU_ID:
248 desc = "VIA VT82C596A Power Management Unit";
249 viapm->type = VIAPM_TYP_596B;
250 base_cfgreg = VIAPM_PRO_BASE;
253 case VIA_596B_PMU_ID:
254 desc = "VIA VT82C596B Power Management Unit";
255 viapm->type = VIAPM_TYP_596B;
256 base_cfgreg = VIAPM_PRO_BASE;
259 case VIA_686A_PMU_ID:
260 desc = "VIA VT82C686A Power Management Unit";
261 viapm->type = VIAPM_TYP_686A;
262 base_cfgreg = VIAPM_PRO_BASE;
265 case VIA_8233_PMU_ID:
266 desc = "VIA VT8233 Power Management Unit";
267 viapm->type = VIAPM_TYP_UNKNOWN;
268 base_cfgreg = VIAPM_8233_BASE;
273 #ifdef VIAPM_BASE_ADDR
274 /* force VIAPM I/O base address */
276 /* enable the SMBus controller function */
277 l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1);
278 pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 1, 1);
280 /* write the base address */
281 pci_write_config(dev, base_cfgreg,
282 VIAPM_BASE_ADDR & VIAPM_PRO_BA_MASK, 4);
285 viapm->base = pci_read_config(dev, base_cfgreg, 4) & VIAPM_PRO_BA_MASK;
288 * We have to set the I/O resources by hand because it is
289 * described outside the viapmope of the traditional maps
291 viapm->iorid = base_cfgreg;
292 if (bus_set_resource(dev, SYS_RES_IOPORT, viapm->iorid,
294 device_printf(dev, "could not set bus resource 0x%x\n",
299 if (1 || bootverbose) {
300 device_printf(dev, "SMBus I/O base at 0x%x\n", viapm->base);
303 device_set_desc(dev, desc);
314 viapm_pro_attach(device_t dev)
316 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
322 if (!(viapm->iores = bus_alloc_resource(dev, SYS_RES_IOPORT,
323 &viapm->iorid, 0l, ~0l, 1, 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 error = bus_setup_intr(dev, viapm->irqres, 0,
344 (driver_intr_t *) viasmb_intr, viapm,
345 &viapm->irqih, NULL);
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(dev, SYS_RES_IOPORT,
393 &viapm->iorid, 0ul, ~0ul, 1, 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);
513 viabb_getscl(device_t dev)
515 struct viapm_softc *viapm = device_get_softc(dev);
517 return ((VIAPM_INB(EXTSMI_VAL) & VIAPM_SCL) != 0);
522 viabb_getsda(device_t dev)
524 struct viapm_softc *viapm = device_get_softc(dev);
526 return ((VIAPM_INB(EXTSMI_VAL) & VIAPM_SDA) != 0);
530 viabb_setlines(device_t dev, int ctrl, int data)
532 viabb_setscl(dev, ctrl);
533 viabb_setsda(dev, data);
539 viapm_abort(struct viapm_softc *viapm)
541 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_KILL);
548 viapm_clear(struct viapm_softc *viapm)
550 VIAPM_OUTB(SMBHST, SMBHST_FAILED | SMBHST_COLLID |
551 SMBHST_ERROR | SMBHST_INTR);
558 viapm_busy(struct viapm_softc *viapm)
562 sts = VIAPM_INB(SMBHST);
564 VIAPM_DEBUG(kprintf("viapm: idle? STS=0x%x\n", sts));
566 return (sts & SMBHST_BUSY);
570 * Poll the SMBus controller
573 viapm_wait(struct viapm_softc *viapm)
579 /* wait for command to complete and SMBus controller is idle */
582 sts = VIAPM_INB(SMBHST);
584 /* check if the controller is processing a command */
585 if (!(sts & SMBHST_BUSY) && (sts & SMBHST_INTR))
589 VIAPM_DEBUG(kprintf("viapm: SMBHST=0x%x\n", sts));
594 error |= SMB_ETIMEOUT;
596 if (sts & SMBHST_FAILED)
599 if (sts & SMBHST_COLLID)
602 if (sts & SMBHST_ERROR)
603 error |= SMB_EBUSERR;
605 if (error != SMB_ENOERR)
614 viasmb_callback(device_t dev, int index, caddr_t *data)
619 case SMB_REQUEST_BUS:
620 case SMB_RELEASE_BUS:
621 /* ok, bus allocation accepted */
631 viasmb_quick(device_t dev, u_char slave, int how)
633 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
637 if (viapm_busy(viapm))
642 VIAPM_DEBUG(kprintf("viapm: QWRITE to 0x%x", slave));
643 VIAPM_OUTB(SMBHADDR, slave & ~LSB);
646 VIAPM_DEBUG(kprintf("viapm: QREAD to 0x%x", slave));
647 VIAPM_OUTB(SMBHADDR, slave | LSB);
650 panic("%s: unknown QUICK command (%x)!", __func__, how);
653 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_QUICK);
655 error = viapm_wait(viapm);
661 viasmb_sendb(device_t dev, u_char slave, char byte)
663 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
667 if (viapm_busy(viapm))
670 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
671 VIAPM_OUTB(SMBHCMD, byte);
673 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_SENDRECV);
675 error = viapm_wait(viapm);
677 VIAPM_DEBUG(kprintf("viapm: SENDB to 0x%x, byte=0x%x, error=0x%x\n", slave, byte, error));
683 viasmb_recvb(device_t dev, u_char slave, char *byte)
685 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
689 if (viapm_busy(viapm))
692 VIAPM_OUTB(SMBHADDR, slave | LSB);
694 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_SENDRECV);
696 if ((error = viapm_wait(viapm)) == SMB_ENOERR)
697 *byte = VIAPM_INB(SMBHDATA0);
699 VIAPM_DEBUG(kprintf("viapm: RECVB from 0x%x, byte=0x%x, error=0x%x\n", slave, *byte, error));
705 viasmb_writeb(device_t dev, u_char slave, char cmd, char byte)
707 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
711 if (viapm_busy(viapm))
714 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
715 VIAPM_OUTB(SMBHCMD, cmd);
716 VIAPM_OUTB(SMBHDATA0, byte);
718 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BYTE);
720 error = viapm_wait(viapm);
722 VIAPM_DEBUG(kprintf("viapm: WRITEB to 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, byte, error));
728 viasmb_readb(device_t dev, u_char slave, char cmd, char *byte)
730 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
734 if (viapm_busy(viapm))
737 VIAPM_OUTB(SMBHADDR, slave | LSB);
738 VIAPM_OUTB(SMBHCMD, cmd);
740 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BYTE);
742 if ((error = viapm_wait(viapm)) == SMB_ENOERR)
743 *byte = VIAPM_INB(SMBHDATA0);
745 VIAPM_DEBUG(kprintf("viapm: READB from 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, *byte, error));
751 viasmb_writew(device_t dev, u_char slave, char cmd, short word)
753 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
757 if (viapm_busy(viapm))
760 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
761 VIAPM_OUTB(SMBHCMD, cmd);
762 VIAPM_OUTB(SMBHDATA0, word & 0x00ff);
763 VIAPM_OUTB(SMBHDATA1, (word & 0xff00) >> 8);
765 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_WORD);
767 error = viapm_wait(viapm);
769 VIAPM_DEBUG(kprintf("viapm: WRITEW to 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, word, error));
775 viasmb_readw(device_t dev, u_char slave, char cmd, short *word)
777 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
782 if (viapm_busy(viapm))
785 VIAPM_OUTB(SMBHADDR, slave | LSB);
786 VIAPM_OUTB(SMBHCMD, cmd);
788 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_WORD);
790 if ((error = viapm_wait(viapm)) == SMB_ENOERR) {
791 low = VIAPM_INB(SMBHDATA0);
792 high = VIAPM_INB(SMBHDATA1);
794 *word = ((high & 0xff) << 8) | (low & 0xff);
797 VIAPM_DEBUG(kprintf("viapm: READW from 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, *word, error));
803 viasmb_bwrite(device_t dev, u_char slave, char cmd, u_char count, char *buf)
805 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
806 u_char remain, len, i;
807 int error = SMB_ENOERR;
810 if (viapm_busy(viapm))
815 len = min(remain, 32);
817 VIAPM_OUTB(SMBHADDR, slave & ~LSB);
818 VIAPM_OUTB(SMBHCMD, cmd);
819 VIAPM_OUTB(SMBHDATA0, len);
820 i = VIAPM_INB(SMBHCTRL);
822 /* fill the 32-byte internal buffer */
823 for (i=0; i<len; i++) {
824 VIAPM_OUTB(SMBHBLOCK, buf[count-remain+i]);
827 VIAPM_OUTB(SMBHCMD, cmd);
828 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BLOCK);
830 if ((error = viapm_wait(viapm)) != SMB_ENOERR)
837 VIAPM_DEBUG(kprintf("viapm: WRITEBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, count, cmd, error));
844 viasmb_bread(device_t dev, u_char slave, char cmd, u_char count, char *buf)
846 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
847 u_char remain, len, i;
848 int error = SMB_ENOERR;
851 if (viapm_busy(viapm))
856 VIAPM_OUTB(SMBHADDR, slave | LSB);
857 VIAPM_OUTB(SMBHCMD, cmd);
858 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BLOCK);
860 if ((error = viapm_wait(viapm)) != SMB_ENOERR)
863 len = VIAPM_INB(SMBHDATA0);
864 i = VIAPM_INB(SMBHCTRL); /* reset counter */
866 len = min(len, remain);
868 /* read the 32-byte internal buffer */
869 for (i=0; i<len; i++) {
870 buf[count-remain+i] = VIAPM_INB(SMBHBLOCK);
877 VIAPM_DEBUG(kprintf("viapm: READBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, count, cmd, error));
882 static device_method_t viapm_methods[] = {
883 /* device interface */
884 DEVMETHOD(device_probe, viapm_586b_probe),
885 DEVMETHOD(device_attach, viapm_586b_attach),
886 DEVMETHOD(device_detach, viapm_586b_detach),
888 /* iicbb interface */
889 DEVMETHOD(iicbb_callback, viabb_callback),
890 DEVMETHOD(iicbb_setlines, viabb_setlines),
891 DEVMETHOD(iicbb_getdataline, viabb_getsda),
892 DEVMETHOD(iicbb_reset, viabb_reset),
897 static driver_t viapm_driver = {
900 sizeof(struct viapm_softc),
903 static device_method_t viapropm_methods[] = {
904 /* device interface */
905 DEVMETHOD(device_probe, viapm_pro_probe),
906 DEVMETHOD(device_attach, viapm_pro_attach),
907 DEVMETHOD(device_detach, viapm_pro_detach),
909 /* smbus interface */
910 DEVMETHOD(smbus_callback, viasmb_callback),
911 DEVMETHOD(smbus_quick, viasmb_quick),
912 DEVMETHOD(smbus_sendb, viasmb_sendb),
913 DEVMETHOD(smbus_recvb, viasmb_recvb),
914 DEVMETHOD(smbus_writeb, viasmb_writeb),
915 DEVMETHOD(smbus_readb, viasmb_readb),
916 DEVMETHOD(smbus_writew, viasmb_writew),
917 DEVMETHOD(smbus_readw, viasmb_readw),
918 DEVMETHOD(smbus_bwrite, viasmb_bwrite),
919 DEVMETHOD(smbus_bread, viasmb_bread),
924 static driver_t viapropm_driver = {
927 sizeof(struct viapm_softc),
930 DECLARE_DUMMY_MODULE(viapm);
931 DRIVER_MODULE(viapm, pci, viapm_driver, viapm_devclass, 0, 0);
932 DRIVER_MODULE(viapropm, pci, viapropm_driver, viapropm_devclass, 0, 0);
934 MODULE_DEPEND(viapm, iicbb, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER);
935 MODULE_DEPEND(viapropm, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER);
936 MODULE_VERSION(viapm, 1);