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.5 2005/02/17 13:59:36 joerg Exp $
31 #include <sys/param.h>
32 #include <sys/kernel.h>
33 #include <sys/systm.h>
34 #include <sys/module.h>
38 #include <machine/bus_pio.h>
39 #include <machine/bus_memio.h>
40 #include <machine/bus.h>
41 #include <machine/clock.h> /* for DELAY */
42 #include <machine/resource.h>
45 #include <bus/pci/pcivar.h>
46 #include <bus/pci/pcireg.h>
48 #include <bus/iicbus/iiconf.h>
49 #include <bus/iicbus/iicbus.h>
51 #include <bus/smbus/smbconf.h>
52 #include <bus/smbus/smbus.h>
57 #define VIAPM_DEBUG(x) if (viapm_debug) (x)
60 static int viapm_debug = 1;
62 static int viapm_debug = 0;
65 #define VIA_586B_PMU_ID 0x30401106
66 #define VIA_596A_PMU_ID 0x30501106
67 #define VIA_596B_PMU_ID 0x30511106
68 #define VIA_686A_PMU_ID 0x30571106
69 #define VIA_8233_PMU_ID 0x30741106
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 desc = "VIA VT8233 Power Management Unit";
271 viapm->type = VIAPM_TYP_UNKNOWN;
272 base_cfgreg = VIAPM_8233_BASE;
277 #ifdef VIAPM_BASE_ADDR
278 /* force VIAPM I/O base address */
280 /* enable the SMBus controller function */
281 l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1);
282 pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 1, 1);
284 /* write the base address */
285 pci_write_config(dev, base_cfgreg,
286 VIAPM_BASE_ADDR & VIAPM_PRO_BA_MASK, 4);
289 viapm->base = pci_read_config(dev, base_cfgreg, 4) & VIAPM_PRO_BA_MASK;
292 * We have to set the I/O resources by hand because it is
293 * described outside the viapmope of the traditional maps
295 viapm->iorid = base_cfgreg;
296 if (bus_set_resource(dev, SYS_RES_IOPORT, viapm->iorid,
298 device_printf(dev, "could not set bus resource 0x%x\n",
303 if (1 || bootverbose) {
304 device_printf(dev, "SMBus I/O base at 0x%x\n", viapm->base);
307 device_set_desc(dev, desc);
318 viapm_pro_attach(device_t dev)
320 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
323 if (!(viapm->iores = bus_alloc_resource(dev, SYS_RES_IOPORT,
324 &viapm->iorid, 0l, ~0l, 1, RF_ACTIVE))) {
325 device_printf(dev, "could not allocate bus space\n");
328 viapm->st = rman_get_bustag(viapm->iores);
329 viapm->sh = rman_get_bushandle(viapm->iores);
333 l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1);
334 pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 0x80, 1);
337 if (!(viapm->irqres = bus_alloc_resource(dev, SYS_RES_IRQ,
338 &viapm->irqrid, 9, 9, 1,
339 RF_SHAREABLE | RF_ACTIVE))) {
340 device_printf(dev, "could not allocate irq\n");
344 if (bus_setup_intr(dev, viapm->irqres, INTR_TYPE_MISC,
345 (driver_intr_t *) viasmb_intr, viapm, &viapm->irqih)) {
346 device_printf(dev, "could not setup irq\n");
351 if (1 | bootverbose) {
352 l = pci_read_config(dev, VIAPM_PRO_REVID, 1);
353 device_printf(dev, "SMBus revision code 0x%x\n", l);
356 viapm->smbus = device_add_child(dev, "smbus", -1);
358 /* probe and attach the smbus */
359 bus_generic_attach(dev);
361 /* disable slave function */
362 VIAPM_OUTB(SMBSCTRL, VIAPM_INB(SMBSCTRL) & ~SMBSCTRL_ENABLE);
364 /* enable the SMBus controller function */
365 l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1);
366 pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 1, 1);
369 /* enable interrupts */
370 VIAPM_OUTB(SMBHCTRL, VIAPM_INB(SMBHCTRL) | SMBHCTRL_ENABLE);
377 bus_release_resource(dev, SYS_RES_IOPORT, viapm->iorid, viapm->iores);
380 bus_release_resource(dev, SYS_RES_IRQ, viapm->irqrid, viapm->irqres);
387 viapm_586b_attach(device_t dev)
389 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
391 if (!(viapm->iores = bus_alloc_resource(dev, SYS_RES_IOPORT,
392 &viapm->iorid, 0ul, ~0ul, 1, RF_ACTIVE | RF_SHAREABLE))) {
393 device_printf(dev, "could not allocate bus resource\n");
396 viapm->st = rman_get_bustag(viapm->iores);
397 viapm->sh = rman_get_bushandle(viapm->iores);
399 VIAPM_OUTB(GPIO_DIR, VIAPM_INB(GPIO_DIR) | VIAPM_SCL | VIAPM_SDA);
401 /* add generic bit-banging code */
402 if (!(viapm->iicbb = device_add_child(dev, "iicbb", -1)))
405 bus_generic_attach(dev);
411 bus_release_resource(dev, SYS_RES_IOPORT,
412 viapm->iorid, viapm->iores);
417 viapm_586b_detach(device_t dev)
419 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
422 bus_generic_detach(dev);
424 device_delete_child(dev, viapm->iicbb);
427 if (viapm->iores && (error = bus_release_resource(dev, SYS_RES_IOPORT,
428 viapm->iorid, viapm->iores)))
435 viapm_pro_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->smbus);
445 if ((error = bus_release_resource(dev, SYS_RES_IOPORT,
446 viapm->iorid, viapm->iores)))
450 if ((error = bus_release_resource(dev, SYS_RES_IRQ,
451 viapm->irqrid, viapm->irqres))
459 viabb_callback(device_t dev, int index, caddr_t *data)
465 viabb_setscl(device_t dev, int ctrl)
467 struct viapm_softc *viapm = device_get_softc(dev);
470 val = VIAPM_INB(GPIO_VAL);
477 VIAPM_OUTB(GPIO_VAL, val);
483 viabb_setsda(device_t dev, int data)
485 struct viapm_softc *viapm = device_get_softc(dev);
488 val = VIAPM_INB(GPIO_VAL);
495 VIAPM_OUTB(GPIO_VAL, val);
501 viabb_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr)
504 viabb_setsda(dev, 1);
505 viabb_setscl(dev, 1);
507 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);
521 viabb_getsda(device_t dev)
523 struct viapm_softc *viapm = device_get_softc(dev);
525 return ((VIAPM_INB(EXTSMI_VAL) & VIAPM_SDA) != 0);
529 viabb_setlines(device_t dev, int ctrl, int data)
531 viabb_setscl(dev, ctrl);
532 viabb_setsda(dev, data);
538 viapm_abort(struct viapm_softc *viapm)
540 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_KILL);
547 viapm_clear(struct viapm_softc *viapm)
549 VIAPM_OUTB(SMBHST, SMBHST_FAILED | SMBHST_COLLID |
550 SMBHST_ERROR | SMBHST_INTR);
557 viapm_busy(struct viapm_softc *viapm)
561 sts = VIAPM_INB(SMBHST);
563 VIAPM_DEBUG(printf("viapm: idle? STS=0x%x\n", sts));
565 return (sts & SMBHST_BUSY);
569 * Poll the SMBus controller
572 viapm_wait(struct viapm_softc *viapm)
578 /* wait for command to complete and SMBus controller is idle */
581 sts = VIAPM_INB(SMBHST);
583 /* check if the controller is processing a command */
584 if (!(sts & SMBHST_BUSY) && (sts & SMBHST_INTR))
588 VIAPM_DEBUG(printf("viapm: SMBHST=0x%x\n", sts));
593 error |= SMB_ETIMEOUT;
595 if (sts & SMBHST_FAILED)
598 if (sts & SMBHST_COLLID)
601 if (sts & SMBHST_ERROR)
602 error |= SMB_EBUSERR;
604 if (error != SMB_ENOERR)
613 viasmb_callback(device_t dev, int index, caddr_t *data)
618 case SMB_REQUEST_BUS:
619 case SMB_RELEASE_BUS:
620 /* ok, bus allocation accepted */
630 viasmb_quick(device_t dev, u_char slave, int how)
632 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
636 if (viapm_busy(viapm))
641 VIAPM_DEBUG(printf("viapm: QWRITE to 0x%x", slave));
642 VIAPM_OUTB(SMBHADDR, slave & ~LSB);
645 VIAPM_DEBUG(printf("viapm: QREAD to 0x%x", slave));
646 VIAPM_OUTB(SMBHADDR, slave | LSB);
649 panic("%s: unknown QUICK command (%x)!", __func__, how);
652 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_QUICK);
654 error = viapm_wait(viapm);
660 viasmb_sendb(device_t dev, u_char slave, char byte)
662 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
666 if (viapm_busy(viapm))
669 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
670 VIAPM_OUTB(SMBHCMD, byte);
672 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_SENDRECV);
674 error = viapm_wait(viapm);
676 VIAPM_DEBUG(printf("viapm: SENDB to 0x%x, byte=0x%x, error=0x%x\n", slave, byte, error));
682 viasmb_recvb(device_t dev, u_char slave, char *byte)
684 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
688 if (viapm_busy(viapm))
691 VIAPM_OUTB(SMBHADDR, slave | LSB);
693 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_SENDRECV);
695 if ((error = viapm_wait(viapm)) == SMB_ENOERR)
696 *byte = VIAPM_INB(SMBHDATA0);
698 VIAPM_DEBUG(printf("viapm: RECVB from 0x%x, byte=0x%x, error=0x%x\n", slave, *byte, error));
704 viasmb_writeb(device_t dev, u_char slave, char cmd, char byte)
706 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
710 if (viapm_busy(viapm))
713 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
714 VIAPM_OUTB(SMBHCMD, cmd);
715 VIAPM_OUTB(SMBHDATA0, byte);
717 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BYTE);
719 error = viapm_wait(viapm);
721 VIAPM_DEBUG(printf("viapm: WRITEB to 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, byte, error));
727 viasmb_readb(device_t dev, u_char slave, char cmd, char *byte)
729 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
733 if (viapm_busy(viapm))
736 VIAPM_OUTB(SMBHADDR, slave | LSB);
737 VIAPM_OUTB(SMBHCMD, cmd);
739 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BYTE);
741 if ((error = viapm_wait(viapm)) == SMB_ENOERR)
742 *byte = VIAPM_INB(SMBHDATA0);
744 VIAPM_DEBUG(printf("viapm: READB from 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, *byte, error));
750 viasmb_writew(device_t dev, u_char slave, char cmd, short word)
752 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
756 if (viapm_busy(viapm))
759 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
760 VIAPM_OUTB(SMBHCMD, cmd);
761 VIAPM_OUTB(SMBHDATA0, word & 0x00ff);
762 VIAPM_OUTB(SMBHDATA1, (word & 0xff00) >> 8);
764 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_WORD);
766 error = viapm_wait(viapm);
768 VIAPM_DEBUG(printf("viapm: WRITEW to 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, word, error));
774 viasmb_readw(device_t dev, u_char slave, char cmd, short *word)
776 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
781 if (viapm_busy(viapm))
784 VIAPM_OUTB(SMBHADDR, slave | LSB);
785 VIAPM_OUTB(SMBHCMD, cmd);
787 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_WORD);
789 if ((error = viapm_wait(viapm)) == SMB_ENOERR) {
790 low = VIAPM_INB(SMBHDATA0);
791 high = VIAPM_INB(SMBHDATA1);
793 *word = ((high & 0xff) << 8) | (low & 0xff);
796 VIAPM_DEBUG(printf("viapm: READW from 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, *word, error));
802 viasmb_bwrite(device_t dev, u_char slave, char cmd, u_char count, char *buf)
804 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
805 u_char remain, len, i;
806 int error = SMB_ENOERR;
809 if (viapm_busy(viapm))
814 len = min(remain, 32);
816 VIAPM_OUTB(SMBHADDR, slave & ~LSB);
817 VIAPM_OUTB(SMBHCMD, cmd);
818 VIAPM_OUTB(SMBHDATA0, len);
819 i = VIAPM_INB(SMBHCTRL);
821 /* fill the 32-byte internal buffer */
822 for (i=0; i<len; i++) {
823 VIAPM_OUTB(SMBHBLOCK, buf[count-remain+i]);
826 VIAPM_OUTB(SMBHCMD, cmd);
827 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BLOCK);
829 if ((error = viapm_wait(viapm)) != SMB_ENOERR)
836 VIAPM_DEBUG(printf("viapm: WRITEBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, count, cmd, error));
843 viasmb_bread(device_t dev, u_char slave, char cmd, u_char count, char *buf)
845 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
846 u_char remain, len, i;
847 int error = SMB_ENOERR;
850 if (viapm_busy(viapm))
855 VIAPM_OUTB(SMBHADDR, slave | LSB);
856 VIAPM_OUTB(SMBHCMD, cmd);
857 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BLOCK);
859 if ((error = viapm_wait(viapm)) != SMB_ENOERR)
862 len = VIAPM_INB(SMBHDATA0);
863 i = VIAPM_INB(SMBHCTRL); /* reset counter */
865 len = min(len, remain);
867 /* read the 32-byte internal buffer */
868 for (i=0; i<len; i++) {
869 buf[count-remain+i] = VIAPM_INB(SMBHBLOCK);
876 VIAPM_DEBUG(printf("viapm: READBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, count, cmd, error));
881 static device_method_t viapm_methods[] = {
882 /* device interface */
883 DEVMETHOD(device_probe, viapm_586b_probe),
884 DEVMETHOD(device_attach, viapm_586b_attach),
885 DEVMETHOD(device_detach, viapm_586b_detach),
887 /* iicbb interface */
888 DEVMETHOD(iicbb_callback, viabb_callback),
889 DEVMETHOD(iicbb_setlines, viabb_setlines),
890 DEVMETHOD(iicbb_getdataline, viabb_getsda),
891 DEVMETHOD(iicbb_reset, viabb_reset),
896 static driver_t viapm_driver = {
899 sizeof(struct viapm_softc),
902 static device_method_t viapropm_methods[] = {
903 /* device interface */
904 DEVMETHOD(device_probe, viapm_pro_probe),
905 DEVMETHOD(device_attach, viapm_pro_attach),
906 DEVMETHOD(device_detach, viapm_pro_detach),
908 /* smbus interface */
909 DEVMETHOD(smbus_callback, viasmb_callback),
910 DEVMETHOD(smbus_quick, viasmb_quick),
911 DEVMETHOD(smbus_sendb, viasmb_sendb),
912 DEVMETHOD(smbus_recvb, viasmb_recvb),
913 DEVMETHOD(smbus_writeb, viasmb_writeb),
914 DEVMETHOD(smbus_readb, viasmb_readb),
915 DEVMETHOD(smbus_writew, viasmb_writew),
916 DEVMETHOD(smbus_readw, viasmb_readw),
917 DEVMETHOD(smbus_bwrite, viasmb_bwrite),
918 DEVMETHOD(smbus_bread, viasmb_bread),
923 static driver_t viapropm_driver = {
926 sizeof(struct viapm_softc),
929 DECLARE_DUMMY_MODULE(viapm);
930 DRIVER_MODULE(viapm, pci, viapm_driver, viapm_devclass, 0, 0);
931 DRIVER_MODULE(viapropm, pci, viapropm_driver, viapropm_devclass, 0, 0);
933 MODULE_DEPEND(viapm, iicbb, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER);
934 MODULE_DEPEND(viapropm, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER);
935 MODULE_VERSION(viapm, 1);