isa_common.c (bea6af4d31e5d3cd38da885df2f7fbec57377d7a) | isa_common.c (cfa84f46316d500ad9b4a7d62b98b498134d2584) |
---|---|
1/*- 2 * Copyright (c) 1999 Doug Rabson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 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 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1999 Doug Rabson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 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 24 * SUCH DAMAGE. 25 * |
26 * $Id: isa_common.c,v 1.1 1999/05/22 15:18:23 dfr Exp $ | 26 * $Id: isa_common.c,v 1.2 1999/05/28 09:24:58 dfr Exp $ |
27 */ 28/* 29 * Modifications for Intel architecture by Garrett A. Wollman. 30 * Copyright 1998 Massachusetts Institute of Technology 31 * 32 * Permission to use, copy, modify, and distribute this software and 33 * its documentation for any purpose and without fee is hereby 34 * granted, provided that both the above copyright notice and this --- 239 unchanged lines hidden (view full) --- 274 *result = rle->start; 275 else 276 *result = -1; 277 break; 278 279 case ISA_IVAR_FLAGS: 280 *result = idev->id_flags; 281 break; | 27 */ 28/* 29 * Modifications for Intel architecture by Garrett A. Wollman. 30 * Copyright 1998 Massachusetts Institute of Technology 31 * 32 * Permission to use, copy, modify, and distribute this software and 33 * its documentation for any purpose and without fee is hereby 34 * granted, provided that both the above copyright notice and this --- 239 unchanged lines hidden (view full) --- 274 *result = rle->start; 275 else 276 *result = -1; 277 break; 278 279 case ISA_IVAR_FLAGS: 280 *result = idev->id_flags; 281 break; |
282 283 case ISA_IVAR_VENDORID: 284 *result = idev->id_vendorid; 285 break; 286 287 case ISA_IVAR_SERIAL: 288 *result = idev->id_serial; 289 break; 290 291 case ISA_IVAR_LOGICALID: 292 *result = idev->id_logicalid; 293 break; 294 295 case ISA_IVAR_COMPATID: 296 *result = idev->id_compatid; 297 break; 298 299 default: 300 return ENOENT; |
|
282 } | 301 } |
283 return ENOENT; | 302 303 return 0; |
284} 285 286static int 287isa_write_ivar(device_t bus, device_t dev, 288 int index, uintptr_t value) 289{ 290 struct isa_device* idev = DEVTOISA(dev); 291 --- 10 unchanged lines hidden (view full) --- 302 case ISA_IVAR_IRQ_1: 303 case ISA_IVAR_DRQ_0: 304 case ISA_IVAR_DRQ_1: 305 return EINVAL; 306 307 case ISA_IVAR_FLAGS: 308 idev->id_flags = value; 309 break; | 304} 305 306static int 307isa_write_ivar(device_t bus, device_t dev, 308 int index, uintptr_t value) 309{ 310 struct isa_device* idev = DEVTOISA(dev); 311 --- 10 unchanged lines hidden (view full) --- 322 case ISA_IVAR_IRQ_1: 323 case ISA_IVAR_DRQ_0: 324 case ISA_IVAR_DRQ_1: 325 return EINVAL; 326 327 case ISA_IVAR_FLAGS: 328 idev->id_flags = value; 329 break; |
330 331 case ISA_IVAR_VENDORID: 332 idev->id_vendorid = value; 333 break; 334 335 case ISA_IVAR_SERIAL: 336 idev->id_serial = value; 337 break; 338 339 case ISA_IVAR_LOGICALID: 340 idev->id_logicalid = value; 341 break; 342 343 case ISA_IVAR_COMPATID: 344 idev->id_compatid = value; 345 break; 346 |
|
310 default: 311 return (ENOENT); 312 } | 347 default: 348 return (ENOENT); 349 } |
350 |
|
313 return (0); 314} 315 316static int 317isa_set_resource(device_t dev, device_t child, int type, int rid, 318 u_long start, u_long count) 319{ 320 struct isa_device* idev = DEVTOISA(child); --- 23 unchanged lines hidden (view full) --- 344 return ENOENT; 345 346 *startp = rle->start; 347 *countp = rle->count; 348 349 return 0; 350} 351 | 351 return (0); 352} 353 354static int 355isa_set_resource(device_t dev, device_t child, int type, int rid, 356 u_long start, u_long count) 357{ 358 struct isa_device* idev = DEVTOISA(child); --- 23 unchanged lines hidden (view full) --- 382 return ENOENT; 383 384 *startp = rle->start; 385 *countp = rle->count; 386 387 return 0; 388} 389 |
390static void 391isa_delete_resource(device_t dev, device_t child, int type, int rid) 392{ 393 struct isa_device* idev = DEVTOISA(child); 394 struct resource_list *rl = &idev->id_resources; 395 resource_list_delete(rl, type, rid); 396} 397 |
|
352static device_method_t isa_methods[] = { 353 /* Device interface */ 354 DEVMETHOD(device_probe, isa_probe), 355 DEVMETHOD(device_attach, isa_attach), 356 DEVMETHOD(device_detach, bus_generic_detach), 357 DEVMETHOD(device_shutdown, bus_generic_shutdown), 358 DEVMETHOD(device_suspend, bus_generic_suspend), 359 DEVMETHOD(device_resume, bus_generic_resume), --- 8 unchanged lines hidden (view full) --- 368 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), 369 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), 370 DEVMETHOD(bus_setup_intr, isa_setup_intr), 371 DEVMETHOD(bus_teardown_intr, isa_teardown_intr), 372 373 /* ISA interface */ 374 DEVMETHOD(isa_set_resource, isa_set_resource), 375 DEVMETHOD(isa_get_resource, isa_get_resource), | 398static device_method_t isa_methods[] = { 399 /* Device interface */ 400 DEVMETHOD(device_probe, isa_probe), 401 DEVMETHOD(device_attach, isa_attach), 402 DEVMETHOD(device_detach, bus_generic_detach), 403 DEVMETHOD(device_shutdown, bus_generic_shutdown), 404 DEVMETHOD(device_suspend, bus_generic_suspend), 405 DEVMETHOD(device_resume, bus_generic_resume), --- 8 unchanged lines hidden (view full) --- 414 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), 415 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), 416 DEVMETHOD(bus_setup_intr, isa_setup_intr), 417 DEVMETHOD(bus_teardown_intr, isa_teardown_intr), 418 419 /* ISA interface */ 420 DEVMETHOD(isa_set_resource, isa_set_resource), 421 DEVMETHOD(isa_get_resource, isa_get_resource), |
422 DEVMETHOD(isa_delete_resource, isa_delete_resource), |
|
376 377 { 0, 0 } 378}; 379 380static driver_t isa_driver = { 381 "isa", 382 isa_methods, 383 1, /* no softc */ 384}; 385 386/* 387 * ISA can be attached to a PCI-ISA bridge or directly to the nexus. 388 */ 389DRIVER_MODULE(isa, isab, isa_driver, isa_devclass, 0, 0); 390#ifdef __i386__ 391DRIVER_MODULE(isa, nexus, isa_driver, isa_devclass, 0, 0); 392#endif | 423 424 { 0, 0 } 425}; 426 427static driver_t isa_driver = { 428 "isa", 429 isa_methods, 430 1, /* no softc */ 431}; 432 433/* 434 * ISA can be attached to a PCI-ISA bridge or directly to the nexus. 435 */ 436DRIVER_MODULE(isa, isab, isa_driver, isa_devclass, 0, 0); 437#ifdef __i386__ 438DRIVER_MODULE(isa, nexus, isa_driver, isa_devclass, 0, 0); 439#endif |