nfsmb.c revision 165951
1#include <sys/cdefs.h> 2__FBSDID("$FreeBSD: head/sys/pci/nfsmb.c 165951 2007-01-11 19:56:24Z jhb $"); 3 4#include <sys/param.h> 5#include <sys/bus.h> 6#include <sys/kernel.h> 7#include <sys/lock.h> 8#include <sys/module.h> 9#include <sys/mutex.h> 10#include <sys/systm.h> 11 12#include <machine/bus.h> 13#include <machine/resource.h> 14#include <sys/rman.h> 15 16#include <dev/pci/pcivar.h> 17#include <dev/pci/pcireg.h> 18 19#include <dev/smbus/smbconf.h> 20#include "smbus_if.h" 21 22#define NFSMB_DEBUG(x) if (nfsmb_debug) (x) 23 24#ifdef DEBUG 25static int nfsmb_debug = 1; 26#else 27static int nfsmb_debug = 0; 28#endif 29 30/* NVIDIA nForce2/3/4 MCP */ 31#define NFSMB_VENDORID_NVIDIA 0x10de 32#define NFSMB_DEVICEID_NF2_SMB 0x0064 33#define NFSMB_DEVICEID_NF2_ULTRA_SMB 0x0084 34#define NFSMB_DEVICEID_NF3_PRO150_SMB 0x00d4 35#define NFSMB_DEVICEID_NF3_250GB_SMB 0x00e4 36#define NFSMB_DEVICEID_NF4_SMB 0x0052 37#define NFSMB_DEVICEID_NF4_04_SMB 0x0034 38#define NFSMB_DEVICEID_NF4_51_SMB 0x0264 39#define NFSMB_DEVICEID_NF4_55_SMB 0x0368 40 41/* PCI Configuration space registers */ 42#define NF2PCI_SMBASE_1 PCIR_BAR(4) 43#define NF2PCI_SMBASE_2 PCIR_BAR(5) 44 45/* 46 * ACPI 3.0, Chapter 12, SMBus Host Controller Interface. 47 */ 48#define SMB_PRTCL 0x00 /* protocol */ 49#define SMB_STS 0x01 /* status */ 50#define SMB_ADDR 0x02 /* address */ 51#define SMB_CMD 0x03 /* command */ 52#define SMB_DATA 0x04 /* 32 data registers */ 53#define SMB_BCNT 0x24 /* number of data bytes */ 54#define SMB_ALRM_A 0x25 /* alarm address */ 55#define SMB_ALRM_D 0x26 /* 2 bytes alarm data */ 56 57#define SMB_STS_DONE 0x80 58#define SMB_STS_ALRM 0x40 59#define SMB_STS_RES 0x20 60#define SMB_STS_STATUS 0x1f 61#define SMB_STS_OK 0x00 /* OK */ 62#define SMB_STS_UF 0x07 /* Unknown Failure */ 63#define SMB_STS_DANA 0x10 /* Device Address Not Acknowledged */ 64#define SMB_STS_DED 0x11 /* Device Error Detected */ 65#define SMB_STS_DCAD 0x12 /* Device Command Access Denied */ 66#define SMB_STS_UE 0x13 /* Unknown Error */ 67#define SMB_STS_DAD 0x17 /* Device Access Denied */ 68#define SMB_STS_T 0x18 /* Timeout */ 69#define SMB_STS_HUP 0x19 /* Host Unsupported Protocol */ 70#define SMB_STS_B 0x1A /* Busy */ 71#define SMB_STS_PEC 0x1F /* PEC (CRC-8) Error */ 72 73#define SMB_PRTCL_WRITE 0x00 74#define SMB_PRTCL_READ 0x01 75#define SMB_PRTCL_QUICK 0x02 76#define SMB_PRTCL_BYTE 0x04 77#define SMB_PRTCL_BYTE_DATA 0x06 78#define SMB_PRTCL_WORD_DATA 0x08 79#define SMB_PRTCL_BLOCK_DATA 0x0a 80#define SMB_PRTCL_PROC_CALL 0x0c 81#define SMB_PRTCL_BLOCK_PROC_CALL 0x0d 82#define SMB_PRTCL_PEC 0x80 83 84struct nfsmb_softc { 85 int rid; 86 struct resource *res; 87 bus_space_tag_t smbst; 88 bus_space_handle_t smbsh; 89 device_t smbus; 90 device_t subdev; 91 struct mtx lock; 92}; 93 94#define NFSMB_LOCK(nfsmb) mtx_lock(&(nfsmb)->lock) 95#define NFSMB_UNLOCK(nfsmb) mtx_unlock(&(nfsmb)->lock) 96#define NFSMB_LOCK_ASSERT(nfsmb) mtx_assert(&(nfsmb)->lock, MA_OWNED) 97 98#define NFSMB_SMBINB(nfsmb, register) \ 99 (bus_space_read_1(nfsmb->smbst, nfsmb->smbsh, register)) 100#define NFSMB_SMBOUTB(nfsmb, register, value) \ 101 (bus_space_write_1(nfsmb->smbst, nfsmb->smbsh, register, value)) 102 103static int nfsmb_detach(device_t dev); 104static int nfsmbsub_detach(device_t dev); 105 106static int 107nfsmbsub_probe(device_t dev) 108{ 109 110 device_set_desc(dev, "nForce2/3/4 MCP SMBus Controller"); 111 return (BUS_PROBE_DEFAULT); 112} 113 114static int 115nfsmb_probe(device_t dev) 116{ 117 u_int16_t vid; 118 u_int16_t did; 119 120 vid = pci_get_vendor(dev); 121 did = pci_get_device(dev); 122 123 if (vid == NFSMB_VENDORID_NVIDIA) { 124 switch(did) { 125 case NFSMB_DEVICEID_NF2_SMB: 126 case NFSMB_DEVICEID_NF2_ULTRA_SMB: 127 case NFSMB_DEVICEID_NF3_PRO150_SMB: 128 case NFSMB_DEVICEID_NF3_250GB_SMB: 129 case NFSMB_DEVICEID_NF4_SMB: 130 case NFSMB_DEVICEID_NF4_04_SMB: 131 case NFSMB_DEVICEID_NF4_51_SMB: 132 case NFSMB_DEVICEID_NF4_55_SMB: 133 device_set_desc(dev, "nForce2/3/4 MCP SMBus Controller"); 134 return (BUS_PROBE_DEFAULT); 135 } 136 } 137 138 return (ENXIO); 139} 140 141static int 142nfsmbsub_attach(device_t dev) 143{ 144 device_t parent; 145 struct nfsmb_softc *nfsmbsub_sc = device_get_softc(dev); 146 147 parent = device_get_parent(dev); 148 149 nfsmbsub_sc->rid = NF2PCI_SMBASE_2; 150 151 nfsmbsub_sc->res = bus_alloc_resource_any(parent, SYS_RES_IOPORT, 152 &nfsmbsub_sc->rid, RF_ACTIVE); 153 if (nfsmbsub_sc->res == NULL) { 154 /* Older incarnations of the device used non-standard BARs. */ 155 nfsmbsub_sc->rid = 0x54; 156 nfsmbsub_sc->res = bus_alloc_resource_any(parent, 157 SYS_RES_IOPORT, &nfsmbsub_sc->rid, RF_ACTIVE); 158 if (nfsmbsub_sc->res == NULL) { 159 device_printf(dev, "could not map i/o space\n"); 160 return (ENXIO); 161 } 162 } 163 nfsmbsub_sc->smbst = rman_get_bustag(nfsmbsub_sc->res); 164 nfsmbsub_sc->smbsh = rman_get_bushandle(nfsmbsub_sc->res); 165 mtx_init(&nfsmbsub_sc->lock, device_get_nameunit(dev), "nfsmb", 166 MTX_DEF); 167 168 nfsmbsub_sc->smbus = device_add_child(dev, "smbus", -1); 169 if (nfsmbsub_sc->smbus == NULL) { 170 nfsmbsub_detach(dev); 171 return (EINVAL); 172 } 173 174 bus_generic_attach(dev); 175 176 return (0); 177} 178 179static int 180nfsmb_attach(device_t dev) 181{ 182 struct nfsmb_softc *nfsmb_sc = device_get_softc(dev); 183 184 /* Allocate I/O space */ 185 nfsmb_sc->rid = NF2PCI_SMBASE_1; 186 187 nfsmb_sc->res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, 188 &nfsmb_sc->rid, RF_ACTIVE); 189 190 if (nfsmb_sc->res == NULL) { 191 /* Older incarnations of the device used non-standard BARs. */ 192 nfsmb_sc->rid = 0x50; 193 nfsmb_sc->res = bus_alloc_resource_any(dev, 194 SYS_RES_IOPORT, &nfsmb_sc->rid, RF_ACTIVE); 195 if (nfsmb_sc->res == NULL) { 196 device_printf(dev, "could not map i/o space\n"); 197 return (ENXIO); 198 } 199 } 200 201 nfsmb_sc->smbst = rman_get_bustag(nfsmb_sc->res); 202 nfsmb_sc->smbsh = rman_get_bushandle(nfsmb_sc->res); 203 mtx_init(&nfsmb_sc->lock, device_get_nameunit(dev), "nfsmb", MTX_DEF); 204 205 /* Allocate a new smbus device */ 206 nfsmb_sc->smbus = device_add_child(dev, "smbus", -1); 207 if (!nfsmb_sc->smbus) { 208 nfsmb_detach(dev); 209 return (EINVAL); 210 } 211 212 nfsmb_sc->subdev = NULL; 213 switch (pci_get_device(dev)) { 214 case NFSMB_DEVICEID_NF2_SMB: 215 case NFSMB_DEVICEID_NF2_ULTRA_SMB: 216 case NFSMB_DEVICEID_NF3_PRO150_SMB: 217 case NFSMB_DEVICEID_NF3_250GB_SMB: 218 case NFSMB_DEVICEID_NF4_SMB: 219 case NFSMB_DEVICEID_NF4_04_SMB: 220 case NFSMB_DEVICEID_NF4_51_SMB: 221 case NFSMB_DEVICEID_NF4_55_SMB: 222 /* Trying to add secondary device as slave */ 223 nfsmb_sc->subdev = device_add_child(dev, "nfsmb", -1); 224 if (!nfsmb_sc->subdev) { 225 nfsmb_detach(dev); 226 return (EINVAL); 227 } 228 break; 229 default: 230 break; 231 } 232 233 bus_generic_attach(dev); 234 235 return (0); 236} 237 238static int 239nfsmbsub_detach(device_t dev) 240{ 241 device_t parent; 242 struct nfsmb_softc *nfsmbsub_sc = device_get_softc(dev); 243 244 parent = device_get_parent(dev); 245 246 if (nfsmbsub_sc->smbus) { 247 device_delete_child(dev, nfsmbsub_sc->smbus); 248 nfsmbsub_sc->smbus = NULL; 249 } 250 mtx_destroy(&nfsmbsub_sc->lock); 251 if (nfsmbsub_sc->res) { 252 bus_release_resource(parent, SYS_RES_IOPORT, nfsmbsub_sc->rid, 253 nfsmbsub_sc->res); 254 nfsmbsub_sc->res = NULL; 255 } 256 return (0); 257} 258 259static int 260nfsmb_detach(device_t dev) 261{ 262 struct nfsmb_softc *nfsmb_sc = device_get_softc(dev); 263 264 if (nfsmb_sc->subdev) { 265 device_delete_child(dev, nfsmb_sc->subdev); 266 nfsmb_sc->subdev = NULL; 267 } 268 269 if (nfsmb_sc->smbus) { 270 device_delete_child(dev, nfsmb_sc->smbus); 271 nfsmb_sc->smbus = NULL; 272 } 273 274 mtx_destroy(&nfsmb_sc->lock); 275 if (nfsmb_sc->res) { 276 bus_release_resource(dev, SYS_RES_IOPORT, nfsmb_sc->rid, 277 nfsmb_sc->res); 278 nfsmb_sc->res = NULL; 279 } 280 281 return (0); 282} 283 284static int 285nfsmb_callback(device_t dev, int index, void *data) 286{ 287 int error = 0; 288 289 switch (index) { 290 case SMB_REQUEST_BUS: 291 case SMB_RELEASE_BUS: 292 break; 293 default: 294 error = EINVAL; 295 } 296 297 return (error); 298} 299 300static int 301nfsmb_wait(struct nfsmb_softc *sc) 302{ 303 u_char sts; 304 int error, count; 305 306 NFSMB_LOCK_ASSERT(sc); 307 if (NFSMB_SMBINB(sc, SMB_PRTCL) != 0) 308 { 309 count = 10000; 310 do { 311 DELAY(500); 312 } while (NFSMB_SMBINB(sc, SMB_PRTCL) != 0 && count--); 313 if (count == 0) 314 return (SMB_ETIMEOUT); 315 } 316 317 sts = NFSMB_SMBINB(sc, SMB_STS) & SMB_STS_STATUS; 318 NFSMB_DEBUG(printf("nfsmb: STS=0x%x\n", sts)); 319 320 switch (sts) { 321 case SMB_STS_OK: 322 error = SMB_ENOERR; 323 break; 324 case SMB_STS_DANA: 325 error = SMB_ENOACK; 326 break; 327 case SMB_STS_B: 328 error = SMB_EBUSY; 329 break; 330 case SMB_STS_T: 331 error = SMB_ETIMEOUT; 332 break; 333 case SMB_STS_DCAD: 334 case SMB_STS_DAD: 335 case SMB_STS_HUP: 336 error = SMB_ENOTSUPP; 337 break; 338 default: 339 error = SMB_EBUSERR; 340 break; 341 } 342 343 return (error); 344} 345 346static int 347nfsmb_quick(device_t dev, u_char slave, int how) 348{ 349 struct nfsmb_softc *sc = (struct nfsmb_softc *)device_get_softc(dev); 350 u_char protocol; 351 int error; 352 353 protocol = SMB_PRTCL_QUICK; 354 355 switch (how) { 356 case SMB_QWRITE: 357 protocol |= SMB_PRTCL_WRITE; 358 NFSMB_DEBUG(printf("nfsmb: QWRITE to 0x%x", slave)); 359 break; 360 case SMB_QREAD: 361 protocol |= SMB_PRTCL_READ; 362 NFSMB_DEBUG(printf("nfsmb: QREAD to 0x%x", slave)); 363 break; 364 default: 365 panic("%s: unknown QUICK command (%x)!", __func__, how); 366 } 367 368 NFSMB_LOCK(sc); 369 NFSMB_SMBOUTB(sc, SMB_ADDR, slave); 370 NFSMB_SMBOUTB(sc, SMB_PRTCL, protocol); 371 372 error = nfsmb_wait(sc); 373 374 NFSMB_DEBUG(printf(", error=0x%x\n", error)); 375 NFSMB_UNLOCK(sc); 376 377 return (error); 378} 379 380static int 381nfsmb_sendb(device_t dev, u_char slave, char byte) 382{ 383 struct nfsmb_softc *sc = (struct nfsmb_softc *)device_get_softc(dev); 384 int error; 385 386 NFSMB_LOCK(sc); 387 NFSMB_SMBOUTB(sc, SMB_CMD, byte); 388 NFSMB_SMBOUTB(sc, SMB_ADDR, slave); 389 NFSMB_SMBOUTB(sc, SMB_PRTCL, SMB_PRTCL_WRITE | SMB_PRTCL_BYTE); 390 391 error = nfsmb_wait(sc); 392 393 NFSMB_DEBUG(printf("nfsmb: SENDB to 0x%x, byte=0x%x, error=0x%x\n", slave, byte, error)); 394 NFSMB_UNLOCK(sc); 395 396 return (error); 397} 398 399static int 400nfsmb_recvb(device_t dev, u_char slave, char *byte) 401{ 402 struct nfsmb_softc *sc = (struct nfsmb_softc *)device_get_softc(dev); 403 int error; 404 405 NFSMB_LOCK(sc); 406 NFSMB_SMBOUTB(sc, SMB_ADDR, slave); 407 NFSMB_SMBOUTB(sc, SMB_PRTCL, SMB_PRTCL_READ | SMB_PRTCL_BYTE); 408 409 if ((error = nfsmb_wait(sc)) == SMB_ENOERR) 410 *byte = NFSMB_SMBINB(sc, SMB_DATA); 411 412 NFSMB_DEBUG(printf("nfsmb: RECVB from 0x%x, byte=0x%x, error=0x%x\n", slave, *byte, error)); 413 NFSMB_UNLOCK(sc); 414 415 return (error); 416} 417 418static int 419nfsmb_writeb(device_t dev, u_char slave, char cmd, char byte) 420{ 421 struct nfsmb_softc *sc = (struct nfsmb_softc *)device_get_softc(dev); 422 int error; 423 424 NFSMB_LOCK(sc); 425 NFSMB_SMBOUTB(sc, SMB_CMD, cmd); 426 NFSMB_SMBOUTB(sc, SMB_DATA, byte); 427 NFSMB_SMBOUTB(sc, SMB_ADDR, slave); 428 NFSMB_SMBOUTB(sc, SMB_PRTCL, SMB_PRTCL_WRITE | SMB_PRTCL_BYTE_DATA); 429 430 error = nfsmb_wait(sc); 431 432 NFSMB_DEBUG(printf("nfsmb: WRITEB to 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, byte, error)); 433 NFSMB_UNLOCK(sc); 434 435 return (error); 436} 437 438static int 439nfsmb_readb(device_t dev, u_char slave, char cmd, char *byte) 440{ 441 struct nfsmb_softc *sc = (struct nfsmb_softc *)device_get_softc(dev); 442 int error; 443 444 NFSMB_LOCK(sc); 445 NFSMB_SMBOUTB(sc, SMB_CMD, cmd); 446 NFSMB_SMBOUTB(sc, SMB_ADDR, slave); 447 NFSMB_SMBOUTB(sc, SMB_PRTCL, SMB_PRTCL_READ | SMB_PRTCL_BYTE_DATA); 448 449 if ((error = nfsmb_wait(sc)) == SMB_ENOERR) 450 *byte = NFSMB_SMBINB(sc, SMB_DATA); 451 452 NFSMB_DEBUG(printf("nfsmb: READB from 0x%x, cmd=0x%x, byte=0x%x, error=0x%x\n", slave, cmd, (unsigned char)*byte, error)); 453 NFSMB_UNLOCK(sc); 454 455 return (error); 456} 457 458static int 459nfsmb_writew(device_t dev, u_char slave, char cmd, short word) 460{ 461 struct nfsmb_softc *sc = (struct nfsmb_softc *)device_get_softc(dev); 462 int error; 463 464 NFSMB_LOCK(sc); 465 NFSMB_SMBOUTB(sc, SMB_CMD, cmd); 466 NFSMB_SMBOUTB(sc, SMB_DATA, word); 467 NFSMB_SMBOUTB(sc, SMB_DATA + 1, word >> 8); 468 NFSMB_SMBOUTB(sc, SMB_ADDR, slave); 469 NFSMB_SMBOUTB(sc, SMB_PRTCL, SMB_PRTCL_WRITE | SMB_PRTCL_WORD_DATA); 470 471 error = nfsmb_wait(sc); 472 473 NFSMB_DEBUG(printf("nfsmb: WRITEW to 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, word, error)); 474 NFSMB_UNLOCK(sc); 475 476 return (error); 477} 478 479static int 480nfsmb_readw(device_t dev, u_char slave, char cmd, short *word) 481{ 482 struct nfsmb_softc *sc = (struct nfsmb_softc *)device_get_softc(dev); 483 int error; 484 485 NFSMB_LOCK(sc); 486 NFSMB_SMBOUTB(sc, SMB_CMD, cmd); 487 NFSMB_SMBOUTB(sc, SMB_ADDR, slave); 488 NFSMB_SMBOUTB(sc, SMB_PRTCL, SMB_PRTCL_READ | SMB_PRTCL_WORD_DATA); 489 490 if ((error = nfsmb_wait(sc)) == SMB_ENOERR) 491 *word = NFSMB_SMBINB(sc, SMB_DATA) | 492 (NFSMB_SMBINB(sc, SMB_DATA + 1) << 8); 493 494 NFSMB_DEBUG(printf("nfsmb: READW from 0x%x, cmd=0x%x, word=0x%x, error=0x%x\n", slave, cmd, (unsigned short)*word, error)); 495 NFSMB_UNLOCK(sc); 496 497 return (error); 498} 499 500static int 501nfsmb_bwrite(device_t dev, u_char slave, char cmd, u_char count, char *buf) 502{ 503 struct nfsmb_softc *sc = (struct nfsmb_softc *)device_get_softc(dev); 504 u_char i; 505 int error; 506 507 if (count < 1 || count > 32) 508 return (SMB_EINVAL); 509 510 NFSMB_LOCK(sc); 511 NFSMB_SMBOUTB(sc, SMB_CMD, cmd); 512 NFSMB_SMBOUTB(sc, SMB_BCNT, count); 513 for (i = 0; i < count; i++) 514 NFSMB_SMBOUTB(sc, SMB_DATA + i, buf[i]); 515 NFSMB_SMBOUTB(sc, SMB_ADDR, slave); 516 NFSMB_SMBOUTB(sc, SMB_PRTCL, SMB_PRTCL_WRITE | SMB_PRTCL_BLOCK_DATA); 517 518 error = nfsmb_wait(sc); 519 520 NFSMB_DEBUG(printf("nfsmb: WRITEBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, count, cmd, error)); 521 NFSMB_UNLOCK(sc); 522 523 return (error); 524} 525 526static int 527nfsmb_bread(device_t dev, u_char slave, char cmd, u_char *count, char *buf) 528{ 529 struct nfsmb_softc *sc = (struct nfsmb_softc *)device_get_softc(dev); 530 u_char data, len, i; 531 int error; 532 533 if (*count < 1 || *count > 32) 534 return (SMB_EINVAL); 535 536 NFSMB_LOCK(sc); 537 NFSMB_SMBOUTB(sc, SMB_CMD, cmd); 538 NFSMB_SMBOUTB(sc, SMB_ADDR, slave); 539 NFSMB_SMBOUTB(sc, SMB_PRTCL, SMB_PRTCL_READ | SMB_PRTCL_BLOCK_DATA); 540 541 if ((error = nfsmb_wait(sc)) == SMB_ENOERR) { 542 len = NFSMB_SMBINB(sc, SMB_BCNT); 543 for (i = 0; i < len; i++) { 544 data = NFSMB_SMBINB(sc, SMB_DATA + i); 545 if (i < *count) 546 buf[i] = data; 547 } 548 *count = len; 549 } 550 551 NFSMB_DEBUG(printf("nfsmb: READBLK to 0x%x, count=0x%x, cmd=0x%x, error=0x%x", slave, *count, cmd, error)); 552 NFSMB_UNLOCK(sc); 553 554 return (error); 555} 556 557static device_method_t nfsmb_methods[] = { 558 /* Device interface */ 559 DEVMETHOD(device_probe, nfsmb_probe), 560 DEVMETHOD(device_attach, nfsmb_attach), 561 DEVMETHOD(device_detach, nfsmb_detach), 562 563 /* SMBus interface */ 564 DEVMETHOD(smbus_callback, nfsmb_callback), 565 DEVMETHOD(smbus_quick, nfsmb_quick), 566 DEVMETHOD(smbus_sendb, nfsmb_sendb), 567 DEVMETHOD(smbus_recvb, nfsmb_recvb), 568 DEVMETHOD(smbus_writeb, nfsmb_writeb), 569 DEVMETHOD(smbus_readb, nfsmb_readb), 570 DEVMETHOD(smbus_writew, nfsmb_writew), 571 DEVMETHOD(smbus_readw, nfsmb_readw), 572 DEVMETHOD(smbus_bwrite, nfsmb_bwrite), 573 DEVMETHOD(smbus_bread, nfsmb_bread), 574 575 { 0, 0 } 576}; 577 578static device_method_t nfsmbsub_methods[] = { 579 /* Device interface */ 580 DEVMETHOD(device_probe, nfsmbsub_probe), 581 DEVMETHOD(device_attach, nfsmbsub_attach), 582 DEVMETHOD(device_detach, nfsmbsub_detach), 583 584 /* SMBus interface */ 585 DEVMETHOD(smbus_callback, nfsmb_callback), 586 DEVMETHOD(smbus_quick, nfsmb_quick), 587 DEVMETHOD(smbus_sendb, nfsmb_sendb), 588 DEVMETHOD(smbus_recvb, nfsmb_recvb), 589 DEVMETHOD(smbus_writeb, nfsmb_writeb), 590 DEVMETHOD(smbus_readb, nfsmb_readb), 591 DEVMETHOD(smbus_writew, nfsmb_writew), 592 DEVMETHOD(smbus_readw, nfsmb_readw), 593 DEVMETHOD(smbus_bwrite, nfsmb_bwrite), 594 DEVMETHOD(smbus_bread, nfsmb_bread), 595 596 { 0, 0 } 597}; 598 599static devclass_t nfsmb_devclass; 600 601static driver_t nfsmb_driver = { 602 "nfsmb", 603 nfsmb_methods, 604 sizeof(struct nfsmb_softc), 605}; 606 607static driver_t nfsmbsub_driver = { 608 "nfsmb", 609 nfsmbsub_methods, 610 sizeof(struct nfsmb_softc), 611}; 612 613DRIVER_MODULE(nfsmb, pci, nfsmb_driver, nfsmb_devclass, 0, 0); 614DRIVER_MODULE(nfsmb, nfsmb, nfsmbsub_driver, nfsmb_devclass, 0, 0); 615DRIVER_MODULE(smbus, nfsmb, smbus_driver, smbus_devclass, 0, 0); 616 617MODULE_DEPEND(nfsmb, pci, 1, 1, 1); 618MODULE_DEPEND(nfsmb, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER); 619MODULE_VERSION(nfsmb, 1); 620