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
26 * $FreeBSD: src/sys/pci/viapm.c,v 1.10.2.3 2006/09/22 19:19:16 jhb Exp $
29 #include <sys/param.h>
30 #include <sys/kernel.h>
31 #include <sys/systm.h>
32 #include <sys/module.h>
37 #include <machine/clock.h> /* for DELAY */
39 #include <bus/pci/pcivar.h>
40 #include <bus/pci/pcireg.h>
42 #include <bus/iicbus/iiconf.h>
44 #include <bus/smbus/smbconf.h>
49 #define VIAPM_DEBUG(x) if (viapm_debug) (x)
52 static int viapm_debug = 1;
54 static int viapm_debug = 0;
57 #define VIA_586B_PMU_ID 0x30401106
58 #define VIA_596A_PMU_ID 0x30501106
59 #define VIA_596B_PMU_ID 0x30511106
60 #define VIA_686A_PMU_ID 0x30571106
61 #define VIA_8233_PMU_ID 0x30741106
62 #define VIA_8233A_PMU_ID 0x31471106
63 #define VIA_8235_PMU_ID 0x31771106
65 #define VIAPM_INB(port) \
66 ((u_char)bus_space_read_1(viapm->st, viapm->sh, port))
67 #define VIAPM_OUTB(port,val) \
68 (bus_space_write_1(viapm->st, viapm->sh, port, (u_char)(val)))
70 #define VIAPM_TYP_UNKNOWN 0
71 #define VIAPM_TYP_586B_3040E 1
72 #define VIAPM_TYP_586B_3040F 2
73 #define VIAPM_TYP_596B 3
74 #define VIAPM_TYP_686A 4
75 #define VIAPM_TYP_8233 5
81 bus_space_handle_t sh;
84 struct resource *iores;
85 struct resource *irqres;
92 static devclass_t viapm_devclass;
93 static devclass_t viapropm_devclass;
96 * VT82C586B definitions
99 #define VIAPM_586B_REVID 0x08
101 #define VIAPM_586B_3040E_BASE 0x20
102 #define VIAPM_586B_3040E_ACTIV 0x4 /* 16 bits */
104 #define VIAPM_586B_3040F_BASE 0x48
105 #define VIAPM_586B_3040F_ACTIV 0x41 /* 8 bits */
107 #define VIAPM_586B_OEM_REV_E 0x00
108 #define VIAPM_586B_OEM_REV_F 0x01
109 #define VIAPM_586B_PROD_REV_A 0x10
111 #define VIAPM_586B_BA_MASK 0x0000ff00
113 #define GPIO_DIR 0x40
114 #define GPIO_VAL 0x42
115 #define EXTSMI_VAL 0x44
117 #define VIAPM_SCL 0x02 /* GPIO1_VAL */
118 #define VIAPM_SDA 0x04 /* GPIO2_VAL */
121 * VIAPRO common definitions
124 #define VIAPM_PRO_BA_MASK 0x0000fff0
125 #define VIAPM_PRO_SMBCTRL 0xd2
126 #define VIAPM_PRO_REVID 0xd6
129 * VT82C686A definitions
132 #define VIAPM_PRO_BASE 0x90
139 #define SMBHDATA0 0x5
140 #define SMBHDATA1 0x6
141 #define SMBHBLOCK 0x7
145 #define SMBSSDWCMD 0x9
146 #define SMBSEVENT 0xa
149 #define SMBHST_RESERVED 0xef /* reserved bits */
150 #define SMBHST_FAILED 0x10 /* failed bus transaction */
151 #define SMBHST_COLLID 0x08 /* bus collision */
152 #define SMBHST_ERROR 0x04 /* device error */
153 #define SMBHST_INTR 0x02 /* command completed */
154 #define SMBHST_BUSY 0x01 /* host busy */
156 #define SMBHCTRL_START 0x40 /* start command */
157 #define SMBHCTRL_PROTO 0x1c /* command protocol mask */
158 #define SMBHCTRL_QUICK 0x00
159 #define SMBHCTRL_SENDRECV 0x04
160 #define SMBHCTRL_BYTE 0x08
161 #define SMBHCTRL_WORD 0x0c
162 #define SMBHCTRL_BLOCK 0x14
163 #define SMBHCTRL_KILL 0x02 /* stop the current transaction */
164 #define SMBHCTRL_ENABLE 0x01 /* enable interrupts */
166 #define SMBSCTRL_ENABLE 0x01 /* enable slave */
170 * VIA8233 definitions
173 #define VIAPM_8233_BASE 0xD0
176 viapm_586b_probe(device_t dev)
178 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
183 switch (pci_get_devid(dev)) {
184 case VIA_586B_PMU_ID:
186 bzero(viapm, sizeof(struct viapm_softc));
188 l = pci_read_config(dev, VIAPM_586B_REVID, 1);
190 case VIAPM_586B_OEM_REV_E:
191 viapm->type = VIAPM_TYP_586B_3040E;
192 viapm->iorid = VIAPM_586B_3040E_BASE;
194 /* Activate IO block access */
195 s = pci_read_config(dev, VIAPM_586B_3040E_ACTIV, 2);
196 pci_write_config(dev, VIAPM_586B_3040E_ACTIV, s | 0x1, 2);
199 case VIAPM_586B_OEM_REV_F:
200 case VIAPM_586B_PROD_REV_A:
202 viapm->type = VIAPM_TYP_586B_3040F;
203 viapm->iorid = VIAPM_586B_3040F_BASE;
205 /* Activate IO block access */
206 c = pci_read_config(dev, VIAPM_586B_3040F_ACTIV, 1);
207 pci_write_config(dev, VIAPM_586B_3040F_ACTIV, c | 0x80, 1);
211 viapm->base = pci_read_config(dev, viapm->iorid, 4) &
215 * We have to set the I/O resources by hand because it is
216 * described outside the viapmope of the traditional maps
218 if (bus_set_resource(dev, SYS_RES_IOPORT, viapm->iorid,
219 viapm->base, 256, -1)) {
220 device_printf(dev, "could not set bus resource\n");
223 device_set_desc(dev, "VIA VT82C586B Power Management Unit");
224 return (BUS_PROBE_DEFAULT);
235 viapm_pro_probe(device_t dev)
237 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
238 #ifdef VIAPM_BASE_ADDR
241 u_int32_t base_cfgreg;
244 switch (pci_get_devid(dev)) {
245 case VIA_596A_PMU_ID:
246 desc = "VIA VT82C596A Power Management Unit";
247 viapm->type = VIAPM_TYP_596B;
248 base_cfgreg = VIAPM_PRO_BASE;
251 case VIA_596B_PMU_ID:
252 desc = "VIA VT82C596B Power Management Unit";
253 viapm->type = VIAPM_TYP_596B;
254 base_cfgreg = VIAPM_PRO_BASE;
257 case VIA_686A_PMU_ID:
258 desc = "VIA VT82C686A Power Management Unit";
259 viapm->type = VIAPM_TYP_686A;
260 base_cfgreg = VIAPM_PRO_BASE;
263 case VIA_8233_PMU_ID:
264 case VIA_8233A_PMU_ID:
265 desc = "VIA VT8233 Power Management Unit";
266 viapm->type = VIAPM_TYP_UNKNOWN;
267 base_cfgreg = VIAPM_8233_BASE;
270 case VIA_8235_PMU_ID:
271 desc = "VIA VT8235 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,
298 viapm->base, 16, -1)) {
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);
309 return (BUS_PROBE_DEFAULT);
319 viapm_pro_attach(device_t dev)
321 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
327 if (!(viapm->iores = bus_alloc_resource(dev, SYS_RES_IOPORT,
328 &viapm->iorid, 0l, ~0l, 1, RF_ACTIVE))) {
329 device_printf(dev, "could not allocate bus space\n");
332 viapm->st = rman_get_bustag(viapm->iores);
333 viapm->sh = rman_get_bushandle(viapm->iores);
337 l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1);
338 pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 0x80, 1);
341 if (!(viapm->irqres = bus_alloc_resource(dev, SYS_RES_IRQ,
342 &viapm->irqrid, 9, 9, 1,
343 RF_SHAREABLE | RF_ACTIVE))) {
344 device_printf(dev, "could not allocate irq\n");
348 error = bus_setup_intr(dev, viapm->irqres, 0,
349 (driver_intr_t *) viasmb_intr, viapm,
350 &viapm->irqih, NULL);
352 device_printf(dev, "could not setup irq\n");
357 if (1 | bootverbose) {
358 l = pci_read_config(dev, VIAPM_PRO_REVID, 1);
359 device_printf(dev, "SMBus revision code 0x%x\n", l);
362 viapm->smbus = device_add_child(dev, "smbus", -1);
364 /* probe and attach the smbus */
365 bus_generic_attach(dev);
367 /* disable slave function */
368 VIAPM_OUTB(SMBSCTRL, VIAPM_INB(SMBSCTRL) & ~SMBSCTRL_ENABLE);
370 /* enable the SMBus controller function */
371 l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1);
372 pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 1, 1);
375 /* enable interrupts */
376 VIAPM_OUTB(SMBHCTRL, VIAPM_INB(SMBHCTRL) | SMBHCTRL_ENABLE);
383 bus_release_resource(dev, SYS_RES_IOPORT, viapm->iorid, viapm->iores);
386 bus_release_resource(dev, SYS_RES_IRQ, viapm->irqrid, viapm->irqres);
393 viapm_586b_attach(device_t dev)
395 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
397 if (!(viapm->iores = bus_alloc_resource(dev, SYS_RES_IOPORT,
398 &viapm->iorid, 0ul, ~0ul, 1, RF_ACTIVE | RF_SHAREABLE))) {
399 device_printf(dev, "could not allocate bus resource\n");
402 viapm->st = rman_get_bustag(viapm->iores);
403 viapm->sh = rman_get_bushandle(viapm->iores);
405 VIAPM_OUTB(GPIO_DIR, VIAPM_INB(GPIO_DIR) | VIAPM_SCL | VIAPM_SDA);
407 /* add generic bit-banging code */
408 if (!(viapm->iicbb = device_add_child(dev, "iicbb", -1)))
411 bus_generic_attach(dev);
417 bus_release_resource(dev, SYS_RES_IOPORT,
418 viapm->iorid, viapm->iores);
423 viapm_586b_detach(device_t dev)
425 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
428 bus_generic_detach(dev);
430 device_delete_child(dev, viapm->iicbb);
433 if (viapm->iores && (error = bus_release_resource(dev, SYS_RES_IOPORT,
434 viapm->iorid, viapm->iores)))
441 viapm_pro_detach(device_t dev)
443 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
446 bus_generic_detach(dev);
448 device_delete_child(dev, viapm->smbus);
451 if ((error = bus_release_resource(dev, SYS_RES_IOPORT,
452 viapm->iorid, viapm->iores)))
456 if ((error = bus_release_resource(dev, SYS_RES_IRQ,
457 viapm->irqrid, viapm->irqres))
465 viabb_callback(device_t dev, int index, caddr_t *data)
471 viabb_setscl(device_t dev, int ctrl)
473 struct viapm_softc *viapm = device_get_softc(dev);
476 val = VIAPM_INB(GPIO_VAL);
483 VIAPM_OUTB(GPIO_VAL, val);
489 viabb_setsda(device_t dev, int data)
491 struct viapm_softc *viapm = device_get_softc(dev);
494 val = VIAPM_INB(GPIO_VAL);
501 VIAPM_OUTB(GPIO_VAL, val);
507 viabb_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr)
510 viabb_setsda(dev, 1);
511 viabb_setscl(dev, 1);
513 return (IIC_ENOADDR);
517 viabb_getscl(device_t dev)
519 struct viapm_softc *viapm = device_get_softc(dev);
521 return ((VIAPM_INB(EXTSMI_VAL) & VIAPM_SCL) != 0);
525 viabb_getsda(device_t dev)
527 struct viapm_softc *viapm = device_get_softc(dev);
529 return ((VIAPM_INB(EXTSMI_VAL) & VIAPM_SDA) != 0);
533 viapm_abort(struct viapm_softc *viapm)
535 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_KILL);
542 viapm_clear(struct viapm_softc *viapm)
544 VIAPM_OUTB(SMBHST, SMBHST_FAILED | SMBHST_COLLID |
545 SMBHST_ERROR | SMBHST_INTR);
552 viapm_busy(struct viapm_softc *viapm)
556 sts = VIAPM_INB(SMBHST);
558 VIAPM_DEBUG(kprintf("viapm: idle? STS=0x%x\n", sts));
560 return (sts & SMBHST_BUSY);
564 * Poll the SMBus controller
567 viapm_wait(struct viapm_softc *viapm)
573 /* wait for command to complete and SMBus controller is idle */
576 sts = VIAPM_INB(SMBHST);
578 /* check if the controller is processing a command */
579 if (!(sts & SMBHST_BUSY) && (sts & SMBHST_INTR))
583 VIAPM_DEBUG(kprintf("viapm: SMBHST=0x%x\n", sts));
588 error |= SMB_ETIMEOUT;
590 if (sts & SMBHST_FAILED)
593 if (sts & SMBHST_COLLID)
596 if (sts & SMBHST_ERROR)
597 error |= SMB_EBUSERR;
599 if (error != SMB_ENOERR)
608 viasmb_callback(device_t dev, int index, caddr_t *data)
613 case SMB_REQUEST_BUS:
614 case SMB_RELEASE_BUS:
615 /* ok, bus allocation accepted */
625 viasmb_quick(device_t dev, u_char slave, int how)
627 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
631 if (viapm_busy(viapm))
636 VIAPM_DEBUG(kprintf("viapm: QWRITE to 0x%x", slave));
637 VIAPM_OUTB(SMBHADDR, slave & ~LSB);
640 VIAPM_DEBUG(kprintf("viapm: QREAD to 0x%x", slave));
641 VIAPM_OUTB(SMBHADDR, slave | LSB);
644 panic("%s: unknown QUICK command (%x)!", __func__, how);
647 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_QUICK);
649 error = viapm_wait(viapm);
655 viasmb_sendb(device_t dev, u_char slave, char byte)
657 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
661 if (viapm_busy(viapm))
664 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
665 VIAPM_OUTB(SMBHCMD, byte);
667 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_SENDRECV);
669 error = viapm_wait(viapm);
671 VIAPM_DEBUG(kprintf("viapm: SENDB to 0x%x, byte=0x%x, error=0x%x\n", slave, byte, error));
677 viasmb_recvb(device_t dev, u_char slave, char *byte)
679 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
683 if (viapm_busy(viapm))
686 VIAPM_OUTB(SMBHADDR, slave | LSB);
688 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_SENDRECV);
690 if ((error = viapm_wait(viapm)) == SMB_ENOERR)
691 *byte = VIAPM_INB(SMBHDATA0);
693 VIAPM_DEBUG(kprintf("viapm: RECVB from 0x%x, byte=0x%x, error=0x%x\n", slave, *byte, error));
699 viasmb_writeb(device_t dev, u_char slave, char cmd, char byte)
701 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
705 if (viapm_busy(viapm))
708 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
709 VIAPM_OUTB(SMBHCMD, cmd);
710 VIAPM_OUTB(SMBHDATA0, byte);
712 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BYTE);
714 error = viapm_wait(viapm);
716 VIAPM_DEBUG(kprintf("viapm: WRITEB to 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, byte, error));
722 viasmb_readb(device_t dev, u_char slave, char cmd, char *byte)
724 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
728 if (viapm_busy(viapm))
731 VIAPM_OUTB(SMBHADDR, slave | LSB);
732 VIAPM_OUTB(SMBHCMD, cmd);
734 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BYTE);
736 if ((error = viapm_wait(viapm)) == SMB_ENOERR)
737 *byte = VIAPM_INB(SMBHDATA0);
739 VIAPM_DEBUG(kprintf("viapm: READB from 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, *byte, error));
745 viasmb_writew(device_t dev, u_char slave, char cmd, short word)
747 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
751 if (viapm_busy(viapm))
754 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
755 VIAPM_OUTB(SMBHCMD, cmd);
756 VIAPM_OUTB(SMBHDATA0, word & 0x00ff);
757 VIAPM_OUTB(SMBHDATA1, (word & 0xff00) >> 8);
759 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_WORD);
761 error = viapm_wait(viapm);
763 VIAPM_DEBUG(kprintf("viapm: WRITEW to 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, word, error));
769 viasmb_readw(device_t dev, u_char slave, char cmd, short *word)
771 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
776 if (viapm_busy(viapm))
779 VIAPM_OUTB(SMBHADDR, slave | LSB);
780 VIAPM_OUTB(SMBHCMD, cmd);
782 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_WORD);
784 if ((error = viapm_wait(viapm)) == SMB_ENOERR) {
785 low = VIAPM_INB(SMBHDATA0);
786 high = VIAPM_INB(SMBHDATA1);
788 *word = ((high & 0xff) << 8) | (low & 0xff);
791 VIAPM_DEBUG(kprintf("viapm: READW from 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, *word, error));
797 viasmb_bwrite(device_t dev, u_char slave, char cmd, u_char count, char *buf)
799 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
803 if (count < 1 || count > 32)
807 if (viapm_busy(viapm))
810 VIAPM_OUTB(SMBHADDR, slave & ~LSB);
811 VIAPM_OUTB(SMBHCMD, cmd);
812 VIAPM_OUTB(SMBHDATA0, count);
813 i = VIAPM_INB(SMBHCTRL);
815 /* fill the 32-byte internal buffer */
816 for (i = 0; i < count; i++) {
817 VIAPM_OUTB(SMBHBLOCK, buf[i]);
820 VIAPM_OUTB(SMBHCMD, cmd);
821 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BLOCK);
823 error = viapm_wait(viapm);
825 VIAPM_DEBUG(kprintf("viapm: WRITEBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, count, cmd, error));
832 viasmb_bread(device_t dev, u_char slave, char cmd, u_char *count, char *buf)
834 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
838 if (*count < 1 || *count > 32)
842 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 /* read the 32-byte internal buffer */
856 for (i = 0; i < len; i++) {
857 data = VIAPM_INB(SMBHBLOCK);
865 VIAPM_DEBUG(kprintf("viapm: READBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, *count, cmd, error));
870 static device_method_t viapm_methods[] = {
871 /* device interface */
872 DEVMETHOD(device_probe, viapm_586b_probe),
873 DEVMETHOD(device_attach, viapm_586b_attach),
874 DEVMETHOD(device_detach, viapm_586b_detach),
876 /* iicbb interface */
877 DEVMETHOD(iicbb_callback, viabb_callback),
878 DEVMETHOD(iicbb_setscl, viabb_setscl),
879 DEVMETHOD(iicbb_setsda, viabb_setsda),
880 DEVMETHOD(iicbb_getscl, viabb_getscl),
881 DEVMETHOD(iicbb_getsda, viabb_getsda),
882 DEVMETHOD(iicbb_reset, viabb_reset),
885 DEVMETHOD(bus_print_child, bus_generic_print_child),
886 DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
887 DEVMETHOD(bus_release_resource, bus_generic_release_resource),
888 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
889 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
890 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
891 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
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),
921 DEVMETHOD(bus_print_child, bus_generic_print_child),
922 DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
923 DEVMETHOD(bus_release_resource, bus_generic_release_resource),
924 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
925 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
926 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
927 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
932 static driver_t viapropm_driver = {
935 sizeof(struct viapm_softc),
938 DECLARE_DUMMY_MODULE(viapm);
939 DRIVER_MODULE(viapm, pci, viapm_driver, viapm_devclass, NULL, NULL);
940 DRIVER_MODULE(viapropm, pci, viapropm_driver, viapropm_devclass, NULL, NULL);
941 DRIVER_MODULE(smbus, viapropm, smbus_driver, smbus_devclass, NULL, NULL);
943 MODULE_DEPEND(viapm, pci, 1, 1, 1);
944 MODULE_DEPEND(viapropm, pci, 1, 1, 1);
945 MODULE_DEPEND(viapm, iicbb, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER);
946 MODULE_DEPEND(viapropm, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER);
947 MODULE_VERSION(viapm, 1);