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$");
32 #include <sys/param.h>
33 #include <sys/kernel.h>
34 #include <sys/systm.h>
35 #include <sys/module.h>
39 #include <machine/bus.h>
40 #include <machine/resource.h>
44 #include <isa/isavar.h>
45 #include <isa/isa_common.h>
47 #include <dev/pci/pcivar.h>
48 #include <dev/pci/pcireg.h>
50 #include <dev/iicbus/iiconf.h>
52 #include <dev/smbus/smbconf.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
70 #define VIA_8233A_PMU_ID 0x31471106
71 #define VIA_8235_PMU_ID 0x31771106
73 #define VIAPM_INB(port) \
74 ((u_char)bus_space_read_1(viapm->st, viapm->sh, port))
75 #define VIAPM_OUTB(port,val) \
76 (bus_space_write_1(viapm->st, viapm->sh, port, (u_char)(val)))
78 #define VIAPM_TYP_UNKNOWN 0
79 #define VIAPM_TYP_586B_3040E 1
80 #define VIAPM_TYP_586B_3040F 2
81 #define VIAPM_TYP_596B 3
82 #define VIAPM_TYP_686A 4
83 #define VIAPM_TYP_8233 5
89 bus_space_handle_t sh;
92 struct resource *iores;
93 struct resource *irqres;
100 static devclass_t viapm_devclass;
101 static devclass_t viapropm_devclass;
104 * VT82C586B definitions
107 #define VIAPM_586B_REVID 0x08
109 #define VIAPM_586B_3040E_BASE 0x20
110 #define VIAPM_586B_3040E_ACTIV 0x4 /* 16 bits */
112 #define VIAPM_586B_3040F_BASE 0x48
113 #define VIAPM_586B_3040F_ACTIV 0x41 /* 8 bits */
115 #define VIAPM_586B_OEM_REV_E 0x00
116 #define VIAPM_586B_OEM_REV_F 0x01
117 #define VIAPM_586B_PROD_REV_A 0x10
119 #define VIAPM_586B_BA_MASK 0x0000ff00
121 #define GPIO_DIR 0x40
122 #define GPIO_VAL 0x42
123 #define EXTSMI_VAL 0x44
125 #define VIAPM_SCL 0x02 /* GPIO1_VAL */
126 #define VIAPM_SDA 0x04 /* GPIO2_VAL */
129 * VIAPRO common definitions
132 #define VIAPM_PRO_BA_MASK 0x0000fff0
133 #define VIAPM_PRO_SMBCTRL 0xd2
134 #define VIAPM_PRO_REVID 0xd6
137 * VT82C686A definitions
140 #define VIAPM_PRO_BASE 0x90
147 #define SMBHDATA0 0x5
148 #define SMBHDATA1 0x6
149 #define SMBHBLOCK 0x7
153 #define SMBSSDWCMD 0x9
154 #define SMBSEVENT 0xa
157 #define SMBHST_RESERVED 0xef /* reserved bits */
158 #define SMBHST_FAILED 0x10 /* failed bus transaction */
159 #define SMBHST_COLLID 0x08 /* bus collision */
160 #define SMBHST_ERROR 0x04 /* device error */
161 #define SMBHST_INTR 0x02 /* command completed */
162 #define SMBHST_BUSY 0x01 /* host busy */
164 #define SMBHCTRL_START 0x40 /* start command */
165 #define SMBHCTRL_PROTO 0x1c /* command protocol mask */
166 #define SMBHCTRL_QUICK 0x00
167 #define SMBHCTRL_SENDRECV 0x04
168 #define SMBHCTRL_BYTE 0x08
169 #define SMBHCTRL_WORD 0x0c
170 #define SMBHCTRL_BLOCK 0x14
171 #define SMBHCTRL_KILL 0x02 /* stop the current transaction */
172 #define SMBHCTRL_ENABLE 0x01 /* enable interrupts */
174 #define SMBSCTRL_ENABLE 0x01 /* enable slave */
178 * VIA8233 definitions
181 #define VIAPM_8233_BASE 0xD0
184 viapm_586b_probe(device_t dev)
186 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
191 switch (pci_get_devid(dev)) {
192 case VIA_586B_PMU_ID:
194 bzero(viapm, sizeof(struct viapm_softc));
196 l = pci_read_config(dev, VIAPM_586B_REVID, 1);
198 case VIAPM_586B_OEM_REV_E:
199 viapm->type = VIAPM_TYP_586B_3040E;
200 viapm->iorid = VIAPM_586B_3040E_BASE;
202 /* Activate IO block access */
203 s = pci_read_config(dev, VIAPM_586B_3040E_ACTIV, 2);
204 pci_write_config(dev, VIAPM_586B_3040E_ACTIV, s | 0x1, 2);
207 case VIAPM_586B_OEM_REV_F:
208 case VIAPM_586B_PROD_REV_A:
210 viapm->type = VIAPM_TYP_586B_3040F;
211 viapm->iorid = VIAPM_586B_3040F_BASE;
213 /* Activate IO block access */
214 c = pci_read_config(dev, VIAPM_586B_3040F_ACTIV, 1);
215 pci_write_config(dev, VIAPM_586B_3040F_ACTIV, c | 0x80, 1);
219 viapm->base = pci_read_config(dev, viapm->iorid, 4) &
223 * We have to set the I/O resources by hand because it is
224 * described outside the viapmope of the traditional maps
226 if (bus_set_resource(dev, SYS_RES_IOPORT, viapm->iorid,
228 device_printf(dev, "could not set bus resource\n");
231 device_set_desc(dev, "VIA VT82C586B Power Management Unit");
232 return (BUS_PROBE_DEFAULT);
243 viapm_pro_probe(device_t dev)
245 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
246 #ifdef VIAPM_BASE_ADDR
249 u_int32_t base_cfgreg;
252 switch (pci_get_devid(dev)) {
253 case VIA_596A_PMU_ID:
254 desc = "VIA VT82C596A Power Management Unit";
255 viapm->type = VIAPM_TYP_596B;
256 base_cfgreg = VIAPM_PRO_BASE;
259 case VIA_596B_PMU_ID:
260 desc = "VIA VT82C596B Power Management Unit";
261 viapm->type = VIAPM_TYP_596B;
262 base_cfgreg = VIAPM_PRO_BASE;
265 case VIA_686A_PMU_ID:
266 desc = "VIA VT82C686A Power Management Unit";
267 viapm->type = VIAPM_TYP_686A;
268 base_cfgreg = VIAPM_PRO_BASE;
271 case VIA_8233_PMU_ID:
272 case VIA_8233A_PMU_ID:
273 desc = "VIA VT8233 Power Management Unit";
274 viapm->type = VIAPM_TYP_UNKNOWN;
275 base_cfgreg = VIAPM_8233_BASE;
278 case VIA_8235_PMU_ID:
279 desc = "VIA VT8235 Power Management Unit";
280 viapm->type = VIAPM_TYP_UNKNOWN;
281 base_cfgreg = VIAPM_8233_BASE;
286 #ifdef VIAPM_BASE_ADDR
287 /* force VIAPM I/O base address */
289 /* enable the SMBus controller function */
290 l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1);
291 pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 1, 1);
293 /* write the base address */
294 pci_write_config(dev, base_cfgreg,
295 VIAPM_BASE_ADDR & VIAPM_PRO_BA_MASK, 4);
298 viapm->base = pci_read_config(dev, base_cfgreg, 4) & VIAPM_PRO_BA_MASK;
301 * We have to set the I/O resources by hand because it is
302 * described outside the viapmope of the traditional maps
304 viapm->iorid = base_cfgreg;
305 if (bus_set_resource(dev, SYS_RES_IOPORT, viapm->iorid,
307 device_printf(dev, "could not set bus resource 0x%x\n",
312 if (1 || bootverbose) {
313 device_printf(dev, "SMBus I/O base at 0x%x\n", viapm->base);
316 device_set_desc(dev, desc);
317 return (BUS_PROBE_DEFAULT);
327 viapm_pro_attach(device_t dev)
329 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
332 if (!(viapm->iores = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
333 &viapm->iorid, RF_ACTIVE))) {
334 device_printf(dev, "could not allocate bus space\n");
337 viapm->st = rman_get_bustag(viapm->iores);
338 viapm->sh = rman_get_bushandle(viapm->iores);
342 l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1);
343 pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 0x80, 1);
346 if (!(viapm->irqres = bus_alloc_resource(dev, SYS_RES_IRQ,
347 &viapm->irqrid, 9, 9, 1,
348 RF_SHAREABLE | RF_ACTIVE))) {
349 device_printf(dev, "could not allocate irq\n");
353 if (bus_setup_intr(dev, viapm->irqres, INTR_TYPE_MISC,
354 (driver_intr_t *) viasmb_intr, viapm, &viapm->irqih)) {
355 device_printf(dev, "could not setup irq\n");
360 if (1 | bootverbose) {
361 l = pci_read_config(dev, VIAPM_PRO_REVID, 1);
362 device_printf(dev, "SMBus revision code 0x%x\n", l);
365 viapm->smbus = device_add_child(dev, "smbus", -1);
367 /* probe and attach the smbus */
368 bus_generic_attach(dev);
370 /* disable slave function */
371 VIAPM_OUTB(SMBSCTRL, VIAPM_INB(SMBSCTRL) & ~SMBSCTRL_ENABLE);
373 /* enable the SMBus controller function */
374 l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1);
375 pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 1, 1);
378 /* enable interrupts */
379 VIAPM_OUTB(SMBHCTRL, VIAPM_INB(SMBHCTRL) | SMBHCTRL_ENABLE);
383 /* If this device is a PCI-ISA bridge, then attach an ISA bus. */
384 if ((pci_get_class(dev) == PCIC_BRIDGE) &&
385 (pci_get_subclass(dev) == PCIS_BRIDGE_ISA))
392 bus_release_resource(dev, SYS_RES_IOPORT, viapm->iorid, viapm->iores);
395 bus_release_resource(dev, SYS_RES_IRQ, viapm->irqrid, viapm->irqres);
402 viapm_586b_attach(device_t dev)
404 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
406 if (!(viapm->iores = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
407 &viapm->iorid, RF_ACTIVE | RF_SHAREABLE))) {
408 device_printf(dev, "could not allocate bus resource\n");
411 viapm->st = rman_get_bustag(viapm->iores);
412 viapm->sh = rman_get_bushandle(viapm->iores);
414 VIAPM_OUTB(GPIO_DIR, VIAPM_INB(GPIO_DIR) | VIAPM_SCL | VIAPM_SDA);
416 /* add generic bit-banging code */
417 if (!(viapm->iicbb = device_add_child(dev, "iicbb", -1)))
420 bus_generic_attach(dev);
426 bus_release_resource(dev, SYS_RES_IOPORT,
427 viapm->iorid, viapm->iores);
432 viapm_586b_detach(device_t dev)
434 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
437 bus_generic_detach(dev);
439 device_delete_child(dev, viapm->iicbb);
442 if (viapm->iores && (error = bus_release_resource(dev, SYS_RES_IOPORT,
443 viapm->iorid, viapm->iores)))
450 viapm_pro_detach(device_t dev)
452 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
455 bus_generic_detach(dev);
457 device_delete_child(dev, viapm->smbus);
460 if ((error = bus_release_resource(dev, SYS_RES_IOPORT,
461 viapm->iorid, viapm->iores)))
465 if ((error = bus_release_resource(dev, SYS_RES_IRQ,
466 viapm->irqrid, viapm->irqres))
474 viabb_callback(device_t dev, int index, caddr_t *data)
480 viabb_setscl(device_t dev, int ctrl)
482 struct viapm_softc *viapm = device_get_softc(dev);
485 val = VIAPM_INB(GPIO_VAL);
492 VIAPM_OUTB(GPIO_VAL, val);
498 viabb_setsda(device_t dev, int data)
500 struct viapm_softc *viapm = device_get_softc(dev);
503 val = VIAPM_INB(GPIO_VAL);
510 VIAPM_OUTB(GPIO_VAL, val);
516 viabb_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr)
519 viabb_setsda(dev, 1);
520 viabb_setscl(dev, 1);
522 return (IIC_ENOADDR);
526 viabb_getscl(device_t dev)
528 struct viapm_softc *viapm = device_get_softc(dev);
530 return ((VIAPM_INB(EXTSMI_VAL) & VIAPM_SCL) != 0);
534 viabb_getsda(device_t dev)
536 struct viapm_softc *viapm = device_get_softc(dev);
538 return ((VIAPM_INB(EXTSMI_VAL) & VIAPM_SDA) != 0);
542 viapm_abort(struct viapm_softc *viapm)
544 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_KILL);
551 viapm_clear(struct viapm_softc *viapm)
553 VIAPM_OUTB(SMBHST, SMBHST_FAILED | SMBHST_COLLID |
554 SMBHST_ERROR | SMBHST_INTR);
561 viapm_busy(struct viapm_softc *viapm)
565 sts = VIAPM_INB(SMBHST);
567 VIAPM_DEBUG(printf("viapm: idle? STS=0x%x\n", sts));
569 return (sts & SMBHST_BUSY);
573 * Poll the SMBus controller
576 viapm_wait(struct viapm_softc *viapm)
582 /* wait for command to complete and SMBus controller is idle */
585 sts = VIAPM_INB(SMBHST);
587 /* check if the controller is processing a command */
588 if (!(sts & SMBHST_BUSY) && (sts & SMBHST_INTR))
592 VIAPM_DEBUG(printf("viapm: SMBHST=0x%x\n", sts));
597 error |= SMB_ETIMEOUT;
599 if (sts & SMBHST_FAILED)
602 if (sts & SMBHST_COLLID)
605 if (sts & SMBHST_ERROR)
606 error |= SMB_EBUSERR;
608 if (error != SMB_ENOERR)
617 viasmb_callback(device_t dev, int index, caddr_t *data)
622 case SMB_REQUEST_BUS:
623 case SMB_RELEASE_BUS:
624 /* ok, bus allocation accepted */
634 viasmb_quick(device_t dev, u_char slave, int how)
636 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
640 if (viapm_busy(viapm))
645 VIAPM_DEBUG(printf("viapm: QWRITE to 0x%x", slave));
646 VIAPM_OUTB(SMBHADDR, slave & ~LSB);
649 VIAPM_DEBUG(printf("viapm: QREAD to 0x%x", slave));
650 VIAPM_OUTB(SMBHADDR, slave | LSB);
653 panic("%s: unknown QUICK command (%x)!", __func__, how);
656 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_QUICK);
658 error = viapm_wait(viapm);
664 viasmb_sendb(device_t dev, u_char slave, char byte)
666 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
670 if (viapm_busy(viapm))
673 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
674 VIAPM_OUTB(SMBHCMD, byte);
676 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_SENDRECV);
678 error = viapm_wait(viapm);
680 VIAPM_DEBUG(printf("viapm: SENDB to 0x%x, byte=0x%x, error=0x%x\n", slave, byte, error));
686 viasmb_recvb(device_t dev, u_char slave, char *byte)
688 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
692 if (viapm_busy(viapm))
695 VIAPM_OUTB(SMBHADDR, slave | LSB);
697 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_SENDRECV);
699 if ((error = viapm_wait(viapm)) == SMB_ENOERR)
700 *byte = VIAPM_INB(SMBHDATA0);
702 VIAPM_DEBUG(printf("viapm: RECVB from 0x%x, byte=0x%x, error=0x%x\n", slave, *byte, error));
708 viasmb_writeb(device_t dev, u_char slave, char cmd, char byte)
710 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
714 if (viapm_busy(viapm))
717 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
718 VIAPM_OUTB(SMBHCMD, cmd);
719 VIAPM_OUTB(SMBHDATA0, byte);
721 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BYTE);
723 error = viapm_wait(viapm);
725 VIAPM_DEBUG(printf("viapm: WRITEB to 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, byte, error));
731 viasmb_readb(device_t dev, u_char slave, char cmd, char *byte)
733 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
737 if (viapm_busy(viapm))
740 VIAPM_OUTB(SMBHADDR, slave | LSB);
741 VIAPM_OUTB(SMBHCMD, cmd);
743 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BYTE);
745 if ((error = viapm_wait(viapm)) == SMB_ENOERR)
746 *byte = VIAPM_INB(SMBHDATA0);
748 VIAPM_DEBUG(printf("viapm: READB from 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, *byte, error));
754 viasmb_writew(device_t dev, u_char slave, char cmd, short word)
756 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
760 if (viapm_busy(viapm))
763 VIAPM_OUTB(SMBHADDR, slave & ~ LSB);
764 VIAPM_OUTB(SMBHCMD, cmd);
765 VIAPM_OUTB(SMBHDATA0, word & 0x00ff);
766 VIAPM_OUTB(SMBHDATA1, (word & 0xff00) >> 8);
768 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_WORD);
770 error = viapm_wait(viapm);
772 VIAPM_DEBUG(printf("viapm: WRITEW to 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, word, error));
778 viasmb_readw(device_t dev, u_char slave, char cmd, short *word)
780 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
785 if (viapm_busy(viapm))
788 VIAPM_OUTB(SMBHADDR, slave | LSB);
789 VIAPM_OUTB(SMBHCMD, cmd);
791 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_WORD);
793 if ((error = viapm_wait(viapm)) == SMB_ENOERR) {
794 low = VIAPM_INB(SMBHDATA0);
795 high = VIAPM_INB(SMBHDATA1);
797 *word = ((high & 0xff) << 8) | (low & 0xff);
800 VIAPM_DEBUG(printf("viapm: READW from 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, *word, error));
806 viasmb_bwrite(device_t dev, u_char slave, char cmd, u_char count, char *buf)
808 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
812 if (count < 1 || count > 32)
816 if (viapm_busy(viapm))
819 VIAPM_OUTB(SMBHADDR, slave & ~LSB);
820 VIAPM_OUTB(SMBHCMD, cmd);
821 VIAPM_OUTB(SMBHDATA0, count);
822 i = VIAPM_INB(SMBHCTRL);
824 /* fill the 32-byte internal buffer */
825 for (i = 0; i < count; i++) {
826 VIAPM_OUTB(SMBHBLOCK, buf[i]);
829 VIAPM_OUTB(SMBHCMD, cmd);
830 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BLOCK);
832 error = viapm_wait(viapm);
834 VIAPM_DEBUG(printf("viapm: WRITEBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, count, cmd, error));
841 viasmb_bread(device_t dev, u_char slave, char cmd, u_char *count, char *buf)
843 struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev);
847 if (*count < 1 || *count > 32)
851 if (viapm_busy(viapm))
854 VIAPM_OUTB(SMBHADDR, slave | LSB);
855 VIAPM_OUTB(SMBHCMD, cmd);
856 VIAPM_OUTB(SMBHCTRL, SMBHCTRL_START | SMBHCTRL_BLOCK);
858 if ((error = viapm_wait(viapm)) != SMB_ENOERR)
861 len = VIAPM_INB(SMBHDATA0);
862 i = VIAPM_INB(SMBHCTRL); /* reset counter */
864 /* read the 32-byte internal buffer */
865 for (i = 0; i < len; i++) {
866 data = VIAPM_INB(SMBHBLOCK);
874 VIAPM_DEBUG(printf("viapm: READBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, *count, cmd, error));
879 static device_method_t viapm_methods[] = {
880 /* device interface */
881 DEVMETHOD(device_probe, viapm_586b_probe),
882 DEVMETHOD(device_attach, viapm_586b_attach),
883 DEVMETHOD(device_detach, viapm_586b_detach),
885 /* iicbb interface */
886 DEVMETHOD(iicbb_callback, viabb_callback),
887 DEVMETHOD(iicbb_setscl, viabb_setscl),
888 DEVMETHOD(iicbb_setsda, viabb_setsda),
889 DEVMETHOD(iicbb_getscl, viabb_getscl),
890 DEVMETHOD(iicbb_getsda, viabb_getsda),
891 DEVMETHOD(iicbb_reset, viabb_reset),
894 DEVMETHOD(bus_print_child, bus_generic_print_child),
895 DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
896 DEVMETHOD(bus_release_resource, bus_generic_release_resource),
897 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
898 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
899 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
900 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
905 static driver_t viapm_driver = {
908 sizeof(struct viapm_softc),
911 static device_method_t viapropm_methods[] = {
912 /* device interface */
913 DEVMETHOD(device_probe, viapm_pro_probe),
914 DEVMETHOD(device_attach, viapm_pro_attach),
915 DEVMETHOD(device_detach, viapm_pro_detach),
917 /* smbus interface */
918 DEVMETHOD(smbus_callback, viasmb_callback),
919 DEVMETHOD(smbus_quick, viasmb_quick),
920 DEVMETHOD(smbus_sendb, viasmb_sendb),
921 DEVMETHOD(smbus_recvb, viasmb_recvb),
922 DEVMETHOD(smbus_writeb, viasmb_writeb),
923 DEVMETHOD(smbus_readb, viasmb_readb),
924 DEVMETHOD(smbus_writew, viasmb_writew),
925 DEVMETHOD(smbus_readw, viasmb_readw),
926 DEVMETHOD(smbus_bwrite, viasmb_bwrite),
927 DEVMETHOD(smbus_bread, viasmb_bread),
930 DEVMETHOD(bus_print_child, bus_generic_print_child),
931 DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
932 DEVMETHOD(bus_release_resource, bus_generic_release_resource),
933 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
934 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
935 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
936 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
941 static driver_t viapropm_driver = {
944 sizeof(struct viapm_softc),
947 DRIVER_MODULE(viapm, pci, viapm_driver, viapm_devclass, 0, 0);
948 DRIVER_MODULE(viapropm, pci, viapropm_driver, viapropm_devclass, 0, 0);
949 DRIVER_MODULE(smbus, viapropm, smbus_driver, smbus_devclass, 0, 0);
951 MODULE_DEPEND(viapm, pci, 1, 1, 1);
952 MODULE_DEPEND(viapropm, pci, 1, 1, 1);
953 MODULE_DEPEND(viapm, iicbb, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER);
954 MODULE_DEPEND(viapropm, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER);
955 MODULE_VERSION(viapm, 1);
958 DRIVER_MODULE(isa, viapm, isa_driver, isa_devclass, 0, 0);
959 DRIVER_MODULE(isa, viapropm, isa_driver, isa_devclass, 0, 0);
960 MODULE_DEPEND(viapm, isa, 1, 1, 1);
961 MODULE_DEPEND(viapropm, isa, 1, 1, 1);