pnp.c (52241) | pnp.c (62947) |
---|---|
1/* 2 * Copyright (c) 1996, Sujal M. Patel 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) 1996, Sujal M. Patel 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 * $FreeBSD: head/sys/isa/pnp.c 52241 1999-10-14 21:03:03Z dfr $ | 26 * $FreeBSD: head/sys/isa/pnp.c 62947 2000-07-11 11:49:33Z tanimura $ |
27 * from: pnp.c,v 1.11 1999/05/06 22:11:19 peter Exp 28 */ 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/module.h> 34#include <sys/bus.h> --- 14 unchanged lines hidden (view full) --- 49 int ldn; /* Logical device on card */ 50}; 51 52struct pnp_quirk { 53 u_int32_t vendor_id; /* Vendor of the card */ 54 u_int32_t logical_id; /* ID of the device with quirk */ 55 int type; 56#define PNP_QUIRK_WRITE_REG 1 /* Need to write a pnp register */ | 27 * from: pnp.c,v 1.11 1999/05/06 22:11:19 peter Exp 28 */ 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/module.h> 34#include <sys/bus.h> --- 14 unchanged lines hidden (view full) --- 49 int ldn; /* Logical device on card */ 50}; 51 52struct pnp_quirk { 53 u_int32_t vendor_id; /* Vendor of the card */ 54 u_int32_t logical_id; /* ID of the device with quirk */ 55 int type; 56#define PNP_QUIRK_WRITE_REG 1 /* Need to write a pnp register */ |
57#define PNP_QUIRK_EXTRA_IO 2 /* Has extra io ports */ |
|
57 int arg1; 58 int arg2; 59}; 60 61struct pnp_quirk pnp_quirks[] = { 62 /* 63 * The Gravis UltraSound needs register 0xf2 to be set to 0xff 64 * to enable power. 65 * XXX need to know the logical device id. 66 */ 67 { 0x0100561e /* GRV0001 */, 0, 68 PNP_QUIRK_WRITE_REG, 0xf2, 0xff }, | 58 int arg1; 59 int arg2; 60}; 61 62struct pnp_quirk pnp_quirks[] = { 63 /* 64 * The Gravis UltraSound needs register 0xf2 to be set to 0xff 65 * to enable power. 66 * XXX need to know the logical device id. 67 */ 68 { 0x0100561e /* GRV0001 */, 0, 69 PNP_QUIRK_WRITE_REG, 0xf2, 0xff }, |
70 /* 71 * An emu8000 does not give us other than the first 72 * port. 73 */ 74 { 0x26008c0e /* SB16 */, 0x21008c0e, 75 PNP_QUIRK_EXTRA_IO, 0x400, 0x800 }, 76 { 0x42008c0e /* SB32(CTL0042) */, 0x21008c0e, 77 PNP_QUIRK_EXTRA_IO, 0x400, 0x800 }, 78 { 0x44008c0e /* SB32(CTL0044) */, 0x21008c0e, 79 PNP_QUIRK_EXTRA_IO, 0x400, 0x800 }, 80 { 0x49008c0e /* SB32(CTL0049) */, 0x21008c0e, 81 PNP_QUIRK_EXTRA_IO, 0x400, 0x800 }, 82 { 0xf1008c0e /* SB32(CTL00f1) */, 0x21008c0e, 83 PNP_QUIRK_EXTRA_IO, 0x400, 0x800 }, 84 { 0xc1008c0e /* SB64(CTL00c1) */, 0x22008c0e, 85 PNP_QUIRK_EXTRA_IO, 0x400, 0x800 }, 86 { 0xe4008c0e /* SB64(CTL00e4) */, 0x22008c0e, 87 PNP_QUIRK_EXTRA_IO, 0x400, 0x800 }, |
|
69 70 { 0 } 71}; 72 73#if 0 74/* 75 * these entries are initialized using the autoconfig menu 76 * The struct is invalid (and must be initialized) if the first --- 281 unchanged lines hidden (view full) --- 358 * Wake everyone up again, we are finished. 359 */ 360 pnp_write(PNP_CONFIG_CONTROL, PNP_CONFIG_CONTROL_WAIT_FOR_KEY); 361} 362 363/* 364 * Process quirks for a logical device.. The card must be in Config state. 365 */ | 88 89 { 0 } 90}; 91 92#if 0 93/* 94 * these entries are initialized using the autoconfig menu 95 * The struct is invalid (and must be initialized) if the first --- 281 unchanged lines hidden (view full) --- 377 * Wake everyone up again, we are finished. 378 */ 379 pnp_write(PNP_CONFIG_CONTROL, PNP_CONFIG_CONTROL_WAIT_FOR_KEY); 380} 381 382/* 383 * Process quirks for a logical device.. The card must be in Config state. 384 */ |
366static void 367pnp_check_quirks(u_int32_t vendor_id, u_int32_t logical_id, int ldn) | 385void 386pnp_check_quirks(u_int32_t vendor_id, u_int32_t logical_id, int ldn, struct isa_config *config) |
368{ 369 struct pnp_quirk *qp; 370 371 for (qp = &pnp_quirks[0]; qp->vendor_id; qp++) { 372 if (qp->vendor_id == vendor_id 373 && (qp->logical_id == 0 374 || qp->logical_id == logical_id)) { 375 switch (qp->type) { 376 case PNP_QUIRK_WRITE_REG: 377 pnp_write(PNP_SET_LDN, ldn); 378 pnp_write(qp->arg1, qp->arg2); 379 break; | 387{ 388 struct pnp_quirk *qp; 389 390 for (qp = &pnp_quirks[0]; qp->vendor_id; qp++) { 391 if (qp->vendor_id == vendor_id 392 && (qp->logical_id == 0 393 || qp->logical_id == logical_id)) { 394 switch (qp->type) { 395 case PNP_QUIRK_WRITE_REG: 396 pnp_write(PNP_SET_LDN, ldn); 397 pnp_write(qp->arg1, qp->arg2); 398 break; |
399 case PNP_QUIRK_EXTRA_IO: 400 if (config == NULL) 401 break; 402 if (qp->arg1 != 0) { 403 config->ic_nport++; 404 config->ic_port[config->ic_nport - 1] = config->ic_port[0]; 405 config->ic_port[config->ic_nport - 1].ir_start += qp->arg1; 406 config->ic_port[config->ic_nport - 1].ir_end += qp->arg1; 407 } 408 if (qp->arg2 != 0) { 409 config->ic_nport++; 410 config->ic_port[config->ic_nport - 1] = config->ic_port[0]; 411 config->ic_port[config->ic_nport - 1].ir_start += qp->arg2; 412 config->ic_port[config->ic_nport - 1].ir_end += qp->arg2; 413 } 414 break; |
|
380 } 381 } 382 } 383} 384 385/* 386 * Scan Resource Data for Logical Devices. 387 * --- 68 unchanged lines hidden (view full) --- 456 switch (PNP_SRES_NUM(tag)) { 457 case PNP_TAG_LOGICAL_DEVICE: 458 /* 459 * Parse the resources for the previous 460 * logical device (if any). 461 */ 462 if (startres) { 463 pnp_parse_resources(dev, startres, | 415 } 416 } 417 } 418} 419 420/* 421 * Scan Resource Data for Logical Devices. 422 * --- 68 unchanged lines hidden (view full) --- 491 switch (PNP_SRES_NUM(tag)) { 492 case PNP_TAG_LOGICAL_DEVICE: 493 /* 494 * Parse the resources for the previous 495 * logical device (if any). 496 */ 497 if (startres) { 498 pnp_parse_resources(dev, startres, |
464 resinfo - startres - 1); | 499 resinfo - startres - 1, 500 p->vendor_id, logical_id, ldn); |
465 dev = 0; 466 startres = 0; 467 } 468 469 /* 470 * A new logical device. Scan for end of 471 * resources. 472 */ 473 bcopy(resinfo, &logical_id, 4); | 501 dev = 0; 502 startres = 0; 503 } 504 505 /* 506 * A new logical device. Scan for end of 507 * resources. 508 */ 509 bcopy(resinfo, &logical_id, 4); |
474 pnp_check_quirks(p->vendor_id, logical_id, ldn); | 510 pnp_check_quirks(p->vendor_id, logical_id, ldn, NULL); |
475 compat_id = 0; 476 dev = BUS_ADD_CHILD(parent, ISA_ORDER_PNP, NULL, -1); 477 if (desc) 478 device_set_desc_copy(dev, desc); 479 isa_set_vendorid(dev, p->vendor_id); 480 isa_set_serial(dev, p->serial); 481 isa_set_logicalid(dev, logical_id); 482 csnldn = malloc(sizeof *csnldn, M_DEVBUF, M_NOWAIT); --- 14 unchanged lines hidden (view full) --- 497 case PNP_TAG_END: 498 if (!startres) { 499 device_printf(parent, 500 "malformed resources\n"); 501 scanning = 0; 502 break; 503 } 504 pnp_parse_resources(dev, startres, | 511 compat_id = 0; 512 dev = BUS_ADD_CHILD(parent, ISA_ORDER_PNP, NULL, -1); 513 if (desc) 514 device_set_desc_copy(dev, desc); 515 isa_set_vendorid(dev, p->vendor_id); 516 isa_set_serial(dev, p->serial); 517 isa_set_logicalid(dev, logical_id); 518 csnldn = malloc(sizeof *csnldn, M_DEVBUF, M_NOWAIT); --- 14 unchanged lines hidden (view full) --- 533 case PNP_TAG_END: 534 if (!startres) { 535 device_printf(parent, 536 "malformed resources\n"); 537 scanning = 0; 538 break; 539 } 540 pnp_parse_resources(dev, startres, |
505 resinfo - startres - 1); | 541 resinfo - startres - 1, 542 p->vendor_id, logical_id, ldn); |
506 dev = 0; 507 startres = 0; 508 scanning = 0; 509 break; 510 511 default: 512 /* Skip this resource */ 513 break; --- 255 unchanged lines hidden --- | 543 dev = 0; 544 startres = 0; 545 scanning = 0; 546 break; 547 548 default: 549 /* Skip this resource */ 550 break; --- 255 unchanged lines hidden --- |