exca.c (104601) | exca.c (110841) |
---|---|
1/* $FreeBSD: head/sys/dev/exca/exca.c 104601 2002-10-07 06:18:50Z imp $ */ | 1/* $FreeBSD: head/sys/dev/exca/exca.c 110841 2003-02-14 06:21:18Z imp $ */ |
2 3/* 4 * Copyright (c) 2002 M Warner Losh. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright --- 67 unchanged lines hidden (view full) --- 77#ifdef EXCA_DEBUG 78#define DEVPRINTF(dev, fmt, args...) device_printf((dev), (fmt), ## args) 79#define DPRINTF(fmt, args...) printf(fmt, ## args) 80#else 81#define DEVPRINTF(dev, fmt, args...) 82#define DPRINTF(fmt, args...) 83#endif 84 | 2 3/* 4 * Copyright (c) 2002 M Warner Losh. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright --- 67 unchanged lines hidden (view full) --- 77#ifdef EXCA_DEBUG 78#define DEVPRINTF(dev, fmt, args...) device_printf((dev), (fmt), ## args) 79#define DPRINTF(fmt, args...) printf(fmt, ## args) 80#else 81#define DEVPRINTF(dev, fmt, args...) 82#define DPRINTF(fmt, args...) 83#endif 84 |
85#if 0 86static const char *chip_names[] = 87{ 88 "CardBus socket", 89 "Intel i82365SL-A/B or clone", 90 "Intel i82365sl-DF step", 91 "VLSI chip", 92 "Cirrus Logic PD6710", 93 "Cirrus logic PD6722", 94 "Cirrus Logic PD6729", 95 "Vadem 365", 96 "Vadem 465", 97 "Vadem 468", 98 "Vadem 469", 99 "Ricoh RF5C296", 100 "Ricoh RF5C396", 101 "IBM clone", 102 "IBM KING PCMCIA Controller" 103}; 104#endif 105 106static exca_getb_fn exca_mem_getb; 107static exca_putb_fn exca_mem_putb; 108static exca_getb_fn exca_io_getb; 109static exca_putb_fn exca_io_putb; 110 |
|
85/* memory */ 86 87#define EXCA_MEMINFO(NUM) { \ 88 EXCA_SYSMEM_ADDR ## NUM ## _START_LSB, \ 89 EXCA_SYSMEM_ADDR ## NUM ## _START_MSB, \ 90 EXCA_SYSMEM_ADDR ## NUM ## _STOP_LSB, \ 91 EXCA_SYSMEM_ADDR ## NUM ## _STOP_MSB, \ 92 EXCA_SYSMEM_ADDR ## NUM ## _WIN, \ --- 15 unchanged lines hidden (view full) --- 108 EXCA_MEMINFO(0), 109 EXCA_MEMINFO(1), 110 EXCA_MEMINFO(2), 111 EXCA_MEMINFO(3), 112 EXCA_MEMINFO(4) 113}; 114#undef EXCA_MEMINFO 115 | 111/* memory */ 112 113#define EXCA_MEMINFO(NUM) { \ 114 EXCA_SYSMEM_ADDR ## NUM ## _START_LSB, \ 115 EXCA_SYSMEM_ADDR ## NUM ## _START_MSB, \ 116 EXCA_SYSMEM_ADDR ## NUM ## _STOP_LSB, \ 117 EXCA_SYSMEM_ADDR ## NUM ## _STOP_MSB, \ 118 EXCA_SYSMEM_ADDR ## NUM ## _WIN, \ --- 15 unchanged lines hidden (view full) --- 134 EXCA_MEMINFO(0), 135 EXCA_MEMINFO(1), 136 EXCA_MEMINFO(2), 137 EXCA_MEMINFO(3), 138 EXCA_MEMINFO(4) 139}; 140#undef EXCA_MEMINFO 141 |
142static uint8_t 143exca_mem_getb(struct exca_softc *sc, int reg) 144{ 145 return (bus_space_read_1(sc->bst, sc->bsh, sc->offset + reg)); 146} 147 148static void 149exca_mem_putb(struct exca_softc *sc, int reg, uint8_t val) 150{ 151 return (bus_space_write_1(sc->bst, sc->bsh, sc->offset + reg, val)); 152} 153 154static uint8_t 155exca_io_getb(struct exca_softc *sc, int reg) 156{ 157 bus_space_write_1(sc->bst, sc->bsh, EXCA_REG_INDEX, reg + sc->offset); 158 return (bus_space_read_1(sc->bst, sc->bsh, EXCA_REG_DATA)); 159} 160 161static void 162exca_io_putb(struct exca_softc *sc, int reg, uint8_t val) 163{ 164 bus_space_write_1(sc->bst, sc->bsh, EXCA_REG_INDEX, reg + sc->offset); 165 bus_space_write_1(sc->bst, sc->bsh, EXCA_REG_DATA, val); 166} 167 |
|
116/* 117 * Helper function. This will map the requested memory slot. We setup the 118 * map before we call this function. This is used to initially force the 119 * mapping, as well as later restore the mapping after it has been destroyed 120 * in some fashion (due to a power event typically). 121 */ 122static void 123exca_do_mem_map(struct exca_softc *sc, int win) 124{ 125 struct mem_map_index_st *map; 126 struct pccard_mem_handle *mem; 127 128 map = &mem_map_index[win]; 129 mem = &sc->mem[win]; | 168/* 169 * Helper function. This will map the requested memory slot. We setup the 170 * map before we call this function. This is used to initially force the 171 * mapping, as well as later restore the mapping after it has been destroyed 172 * in some fashion (due to a power event typically). 173 */ 174static void 175exca_do_mem_map(struct exca_softc *sc, int win) 176{ 177 struct mem_map_index_st *map; 178 struct pccard_mem_handle *mem; 179 180 map = &mem_map_index[win]; 181 mem = &sc->mem[win]; |
130 exca_write(sc, map->sysmem_start_lsb, | 182 exca_putb(sc, map->sysmem_start_lsb, |
131 (mem->addr >> EXCA_SYSMEM_ADDRX_SHIFT) & 0xff); | 183 (mem->addr >> EXCA_SYSMEM_ADDRX_SHIFT) & 0xff); |
132 exca_write(sc, map->sysmem_start_msb, | 184 exca_putb(sc, map->sysmem_start_msb, |
133 ((mem->addr >> (EXCA_SYSMEM_ADDRX_SHIFT + 8)) & 134 EXCA_SYSMEM_ADDRX_START_MSB_ADDR_MASK) | 0x80); 135 | 185 ((mem->addr >> (EXCA_SYSMEM_ADDRX_SHIFT + 8)) & 186 EXCA_SYSMEM_ADDRX_START_MSB_ADDR_MASK) | 0x80); 187 |
136 exca_write(sc, map->sysmem_stop_lsb, | 188 exca_putb(sc, map->sysmem_stop_lsb, |
137 ((mem->addr + mem->realsize - 1) >> 138 EXCA_SYSMEM_ADDRX_SHIFT) & 0xff); | 189 ((mem->addr + mem->realsize - 1) >> 190 EXCA_SYSMEM_ADDRX_SHIFT) & 0xff); |
139 exca_write(sc, map->sysmem_stop_msb, | 191 exca_putb(sc, map->sysmem_stop_msb, |
140 (((mem->addr + mem->realsize - 1) >> 141 (EXCA_SYSMEM_ADDRX_SHIFT + 8)) & 142 EXCA_SYSMEM_ADDRX_STOP_MSB_ADDR_MASK) | 143 EXCA_SYSMEM_ADDRX_STOP_MSB_WAIT2); 144 | 192 (((mem->addr + mem->realsize - 1) >> 193 (EXCA_SYSMEM_ADDRX_SHIFT + 8)) & 194 EXCA_SYSMEM_ADDRX_STOP_MSB_ADDR_MASK) | 195 EXCA_SYSMEM_ADDRX_STOP_MSB_WAIT2); 196 |
145 exca_write(sc, map->sysmem_win, | 197 exca_putb(sc, map->sysmem_win, |
146 (mem->addr >> EXCA_MEMREG_WIN_SHIFT) & 0xff); 147 | 198 (mem->addr >> EXCA_MEMREG_WIN_SHIFT) & 0xff); 199 |
148 exca_write(sc, map->cardmem_lsb, | 200 exca_putb(sc, map->cardmem_lsb, |
149 (mem->offset >> EXCA_CARDMEM_ADDRX_SHIFT) & 0xff); | 201 (mem->offset >> EXCA_CARDMEM_ADDRX_SHIFT) & 0xff); |
150 exca_write(sc, map->cardmem_msb, | 202 exca_putb(sc, map->cardmem_msb, |
151 ((mem->offset >> (EXCA_CARDMEM_ADDRX_SHIFT + 8)) & 152 EXCA_CARDMEM_ADDRX_MSB_ADDR_MASK) | 153 ((mem->kind == PCCARD_MEM_ATTR) ? 154 EXCA_CARDMEM_ADDRX_MSB_REGACTIVE_ATTR : 0)); 155 156 exca_setb(sc, EXCA_ADDRWIN_ENABLE, EXCA_ADDRWIN_ENABLE_MEMCS16 | 157 map->memenable); 158 159 DELAY(100); 160#ifdef EXCA_DEBUG 161 { 162 int r1, r2, r3, r4, r5, r6, r7; | 203 ((mem->offset >> (EXCA_CARDMEM_ADDRX_SHIFT + 8)) & 204 EXCA_CARDMEM_ADDRX_MSB_ADDR_MASK) | 205 ((mem->kind == PCCARD_MEM_ATTR) ? 206 EXCA_CARDMEM_ADDRX_MSB_REGACTIVE_ATTR : 0)); 207 208 exca_setb(sc, EXCA_ADDRWIN_ENABLE, EXCA_ADDRWIN_ENABLE_MEMCS16 | 209 map->memenable); 210 211 DELAY(100); 212#ifdef EXCA_DEBUG 213 { 214 int r1, r2, r3, r4, r5, r6, r7; |
163 r1 = exca_read(sc, map->sysmem_start_msb); 164 r2 = exca_read(sc, map->sysmem_start_lsb); 165 r3 = exca_read(sc, map->sysmem_stop_msb); 166 r4 = exca_read(sc, map->sysmem_stop_lsb); 167 r5 = exca_read(sc, map->cardmem_msb); 168 r6 = exca_read(sc, map->cardmem_lsb); 169 r7 = exca_read(sc, map->sysmem_win); | 215 r1 = exca_getb(sc, map->sysmem_start_msb); 216 r2 = exca_getb(sc, map->sysmem_start_lsb); 217 r3 = exca_getb(sc, map->sysmem_stop_msb); 218 r4 = exca_getb(sc, map->sysmem_stop_lsb); 219 r5 = exca_getb(sc, map->cardmem_msb); 220 r6 = exca_getb(sc, map->cardmem_lsb); 221 r7 = exca_getb(sc, map->sysmem_win); |
170 printf("exca_do_mem_map window %d: %02x%02x %02x%02x " 171 "%02x%02x %02x (%08x+%08x.%08x*%08lx)\n", 172 win, r1, r2, r3, r4, r5, r6, r7, 173 mem->addr, mem->size, mem->realsize, 174 mem->offset); 175 } 176#endif 177} --- 202 unchanged lines hidden (view full) --- 380exca_do_io_map(struct exca_softc *sc, int win) 381{ 382 struct io_map_index_st *map; 383 384 struct pccard_io_handle *io; 385 386 map = &io_map_index[win]; 387 io = &sc->io[win]; | 222 printf("exca_do_mem_map window %d: %02x%02x %02x%02x " 223 "%02x%02x %02x (%08x+%08x.%08x*%08lx)\n", 224 win, r1, r2, r3, r4, r5, r6, r7, 225 mem->addr, mem->size, mem->realsize, 226 mem->offset); 227 } 228#endif 229} --- 202 unchanged lines hidden (view full) --- 432exca_do_io_map(struct exca_softc *sc, int win) 433{ 434 struct io_map_index_st *map; 435 436 struct pccard_io_handle *io; 437 438 map = &io_map_index[win]; 439 io = &sc->io[win]; |
388 exca_write(sc, map->start_lsb, io->addr & 0xff); 389 exca_write(sc, map->start_msb, (io->addr >> 8) & 0xff); | 440 exca_putb(sc, map->start_lsb, io->addr & 0xff); 441 exca_putb(sc, map->start_msb, (io->addr >> 8) & 0xff); |
390 | 442 |
391 exca_write(sc, map->stop_lsb, (io->addr + io->size - 1) & 0xff); 392 exca_write(sc, map->stop_msb, ((io->addr + io->size - 1) >> 8) & 0xff); | 443 exca_putb(sc, map->stop_lsb, (io->addr + io->size - 1) & 0xff); 444 exca_putb(sc, map->stop_msb, ((io->addr + io->size - 1) >> 8) & 0xff); |
393 394 exca_clrb(sc, EXCA_IOCTL, map->ioctlmask); 395 exca_setb(sc, EXCA_IOCTL, map->ioctlbits[io->width]); 396 397 exca_setb(sc, EXCA_ADDRWIN_ENABLE, map->ioenable); 398#ifdef EXCA_DEBUG 399 { 400 int r1, r2, r3, r4; | 445 446 exca_clrb(sc, EXCA_IOCTL, map->ioctlmask); 447 exca_setb(sc, EXCA_IOCTL, map->ioctlbits[io->width]); 448 449 exca_setb(sc, EXCA_ADDRWIN_ENABLE, map->ioenable); 450#ifdef EXCA_DEBUG 451 { 452 int r1, r2, r3, r4; |
401 r1 = exca_read(sc, map->start_msb); 402 r2 = exca_read(sc, map->start_lsb); 403 r3 = exca_read(sc, map->stop_msb); 404 r4 = exca_read(sc, map->stop_lsb); | 453 r1 = exca_getb(sc, map->start_msb); 454 r2 = exca_getb(sc, map->start_lsb); 455 r3 = exca_getb(sc, map->stop_msb); 456 r4 = exca_getb(sc, map->stop_lsb); |
405 DPRINTF("exca_do_io_map window %d: %02x%02x %02x%02x " 406 "(%08x+%08x)\n", win, r1, r2, r3, r4, 407 io->addr, io->size); 408 } 409#endif 410} 411 412int --- 80 unchanged lines hidden (view full) --- 493 * for the busy state transitions, at least according to their datasheets, 494 * so we busy wait a while here.. 495 */ 496static void 497exca_wait_ready(struct exca_softc *sc) 498{ 499 int i; 500 DEVPRINTF(sc->dev, "exca_wait_ready: status 0x%02x\n", | 457 DPRINTF("exca_do_io_map window %d: %02x%02x %02x%02x " 458 "(%08x+%08x)\n", win, r1, r2, r3, r4, 459 io->addr, io->size); 460 } 461#endif 462} 463 464int --- 80 unchanged lines hidden (view full) --- 545 * for the busy state transitions, at least according to their datasheets, 546 * so we busy wait a while here.. 547 */ 548static void 549exca_wait_ready(struct exca_softc *sc) 550{ 551 int i; 552 DEVPRINTF(sc->dev, "exca_wait_ready: status 0x%02x\n", |
501 exca_read(sc, EXCA_IF_STATUS)); | 553 exca_getb(sc, EXCA_IF_STATUS)); |
502 for (i = 0; i < 10000; i++) { | 554 for (i = 0; i < 10000; i++) { |
503 if (exca_read(sc, EXCA_IF_STATUS) & EXCA_IF_STATUS_READY) | 555 if (exca_getb(sc, EXCA_IF_STATUS) & EXCA_IF_STATUS_READY) |
504 return; 505 DELAY(500); 506 } 507 device_printf(sc->dev, "ready never happened, status = %02x\n", | 556 return; 557 DELAY(500); 558 } 559 device_printf(sc->dev, "ready never happened, status = %02x\n", |
508 exca_read(sc, EXCA_IF_STATUS)); | 560 exca_getb(sc, EXCA_IF_STATUS)); |
509} 510 511/* 512 * Reset the card. Ideally, we'd do a lot of this via interrupts. 513 * However, many PC Cards will deassert the ready signal. This means 514 * that they are asserting an interrupt. This makes it hard to 515 * do anything but a busy wait here. One could argue that these 516 * such cards are broken, or that the bridge that allows this sort --- 8 unchanged lines hidden (view full) --- 525exca_reset(struct exca_softc *sc, device_t child) 526{ 527 int cardtype; 528 int win; 529 530 /* enable socket i/o */ 531 exca_setb(sc, EXCA_PWRCTL, EXCA_PWRCTL_OE); 532 | 561} 562 563/* 564 * Reset the card. Ideally, we'd do a lot of this via interrupts. 565 * However, many PC Cards will deassert the ready signal. This means 566 * that they are asserting an interrupt. This makes it hard to 567 * do anything but a busy wait here. One could argue that these 568 * such cards are broken, or that the bridge that allows this sort --- 8 unchanged lines hidden (view full) --- 577exca_reset(struct exca_softc *sc, device_t child) 578{ 579 int cardtype; 580 int win; 581 582 /* enable socket i/o */ 583 exca_setb(sc, EXCA_PWRCTL, EXCA_PWRCTL_OE); 584 |
533 exca_write(sc, EXCA_INTR, EXCA_INTR_ENABLE); | 585 exca_putb(sc, EXCA_INTR, EXCA_INTR_ENABLE); |
534 /* hold reset for 30ms */ 535 DELAY(30*1000); 536 /* clear the reset flag */ 537 exca_setb(sc, EXCA_INTR, EXCA_INTR_RESET); 538 /* wait 20ms as per pc card standard (r2.01) section 4.3.6 */ 539 DELAY(20*1000); 540 541 exca_wait_ready(sc); 542 543 /* disable all address windows */ | 586 /* hold reset for 30ms */ 587 DELAY(30*1000); 588 /* clear the reset flag */ 589 exca_setb(sc, EXCA_INTR, EXCA_INTR_RESET); 590 /* wait 20ms as per pc card standard (r2.01) section 4.3.6 */ 591 DELAY(20*1000); 592 593 exca_wait_ready(sc); 594 595 /* disable all address windows */ |
544 exca_write(sc, EXCA_ADDRWIN_ENABLE, 0); | 596 exca_putb(sc, EXCA_ADDRWIN_ENABLE, 0); |
545 546 CARD_GET_TYPE(child, &cardtype); 547 exca_setb(sc, EXCA_INTR, (cardtype == PCCARD_IFTYPE_IO) ? 548 EXCA_INTR_CARDTYPE_IO : EXCA_INTR_CARDTYPE_MEM); 549 DEVPRINTF(sc->dev, "card type is %s\n", 550 (cardtype == PCCARD_IFTYPE_IO) ? "io" : "mem"); 551 552 /* reinstall all the memory and io mappings */ --- 14 unchanged lines hidden (view full) --- 567{ 568 sc->dev = dev; 569 sc->memalloc = 0; 570 sc->ioalloc = 0; 571 sc->bst = bst; 572 sc->bsh = bsh; 573 sc->offset = offset; 574 sc->flags = 0; | 597 598 CARD_GET_TYPE(child, &cardtype); 599 exca_setb(sc, EXCA_INTR, (cardtype == PCCARD_IFTYPE_IO) ? 600 EXCA_INTR_CARDTYPE_IO : EXCA_INTR_CARDTYPE_MEM); 601 DEVPRINTF(sc->dev, "card type is %s\n", 602 (cardtype == PCCARD_IFTYPE_IO) ? "io" : "mem"); 603 604 /* reinstall all the memory and io mappings */ --- 14 unchanged lines hidden (view full) --- 619{ 620 sc->dev = dev; 621 sc->memalloc = 0; 622 sc->ioalloc = 0; 623 sc->bst = bst; 624 sc->bsh = bsh; 625 sc->offset = offset; 626 sc->flags = 0; |
627 sc->getb = exca_mem_getb; 628 sc->putb = exca_mem_putb; |
|
575} 576 577/* | 629} 630 631/* |
632 * Is this socket valid? 633 */ 634static int 635exca_valid_slot(struct exca_softc *exca) 636{ 637 uint8_t c; 638 639 /* 640 * see if there's a PCMCIA controller here 641 * Intel PCMCIA controllers use 0x82 and 0x83 642 * IBM clone chips use 0x88 and 0x89, apparently 643 */ 644 c = exca_getb(exca, EXCA_IDENT); 645 if ((c & EXCA_IDENT_IFTYPE_MASK) != EXCA_IDENT_IFTYPE_MEM_AND_IO) 646 return (0); 647 if ((c & EXCA_IDENT_ZERO) != 0) 648 return (0); 649 switch (c & EXCA_IDENT_REV_MASK) { 650 /* 651 * 82365 or clones. 652 */ 653 case EXCA_IDENT_REV_I82365SLR0: 654 case EXCA_IDENT_REV_I82365SLR1: 655 exca->chipset = EXCA_I82365; 656 /* 657 * Check for Vadem chips by unlocking their extra 658 * registers and looking for valid ID. Bit 3 in 659 * the ID register is normally 0, except when 660 * EXCA_VADEMREV is set. Other bridges appear 661 * to ignore this frobbing. 662 */ 663 bus_space_write_1(exca->bst, exca->bsh, EXCA_REG_INDEX, 664 EXCA_VADEM_COOKIE1); 665 bus_space_write_1(exca->bst, exca->bsh, EXCA_REG_INDEX, 666 EXCA_VADEM_COOKIE2); 667 exca_setb(exca, EXCA_VADEM_VMISC, EXCA_VADEM_REV); 668 c = exca_getb(exca, EXCA_IDENT); 669 if (c & 0x08) { 670 switch (c & 7) { 671 case 1: 672 exca->chipset = EXCA_VG365; 673 break; 674 case 2: 675 exca->chipset = EXCA_VG465; 676 break; 677 case 3: 678 exca->chipset = EXCA_VG468; 679 break; 680 default: 681 exca->chipset = EXCA_VG469; 682 break; 683 } 684 exca_clrb(exca, EXCA_VADEM_VMISC, EXCA_VADEM_REV); 685 break; 686 } 687 /* 688 * Check for RICOH RF5C[23]96 PCMCIA Controller 689 */ 690 c = exca_getb(exca, EXCA_RICOH_ID); 691 if (c == EXCA_RID_396) { 692 exca->chipset = EXCA_RF5C396; 693 break; 694 } else if (c == EXCA_RID_296) { 695 exca->chipset = EXCA_RF5C296; 696 break; 697 } 698 /* 699 * Check for Cirrus logic chips. 700 */ 701 exca_putb(exca, EXCA_CIRRUS_CHIP_INFO, 0); 702 c = exca_getb(exca, EXCA_CIRRUS_CHIP_INFO); 703 if ((c & EXCA_CIRRUS_CHIP_INFO_CHIP_ID) == 704 EXCA_CIRRUS_CHIP_INFO_CHIP_ID) { 705 c = exca_getb(exca, EXCA_CIRRUS_CHIP_INFO); 706 if ((c & EXCA_CIRRUS_CHIP_INFO_CHIP_ID) == 0) { 707 if (c & EXCA_CIRRUS_CHIP_INFO_SLOTS) 708 exca->chipset = EXCA_PD6722; 709 else 710 exca->chipset = EXCA_PD6710; 711 break; 712 } 713 } 714 break; 715 716 case EXCA_IDENT_REV_I82365SLDF: 717 /* 718 * Intel i82365sl-DF step or maybe a vlsi 82c146 719 * we detected the vlsi case earlier, so if the controller 720 * isn't set, we know it is a i82365sl step D. 721 */ 722 exca->chipset = EXCA_I82365SL_DF; 723 break; 724 case EXCA_IDENT_REV_IBM1: 725 case EXCA_IDENT_REV_IBM2: 726 exca->chipset = EXCA_IBM; 727 break; 728 case EXCA_IDENT_REV_IBM_KING: 729 exca->chipset = EXCA_IBM_KING; 730 break; 731 default: 732 return (0); 733 } 734 return (1); 735} 736 737/* |
|
578 * Probe the expected slots. We maybe should set the ID for each of these 579 * slots too while we're at it. But maybe that belongs to a separate 580 * function. 581 * | 738 * Probe the expected slots. We maybe should set the ID for each of these 739 * slots too while we're at it. But maybe that belongs to a separate 740 * function. 741 * |
582 * Callers must charantee that there are at least EXCA_NSLOTS (4) in 583 * the array that they pass the address of the first element in the 584 * "exca" parameter. | 742 * The caller must guarantee that at least EXCA_NSLOTS are present in exca. |
585 */ 586int | 743 */ 744int |
587exca_probe_slots(device_t dev, struct exca_softc *exca) | 745exca_probe_slots(device_t dev, struct exca_softc *exca, bus_space_tag_t iot, 746 bus_space_handle_t ioh) |
588{ | 747{ |
589 int rid; 590 struct resource *res; | |
591 int err; | 748 int err; |
592 bus_space_tag_t iot; 593 bus_space_handle_t ioh; | |
594 int i; 595 596 err = ENXIO; | 749 int i; 750 751 err = ENXIO; |
597 rid = 0; 598 res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, EXCA_IOSIZE, 599 RF_ACTIVE); 600 if (res == NULL) 601 return (ENXIO); 602 iot = rman_get_bustag(res); 603 ioh = rman_get_bushandle(res); 604 for (i = 0; i < EXCA_NSLOTS; i++) { | 752 for (i = 0; i < EXCA_NSLOTS; i++) { |
605 exca_init(&exca[i], dev, iot, ioh, i * EXCA_SOCKET_SIZE); | 753 exca_init(&exca[i], dev, iot, ioh, i * EXCA_SOCKET_SIZE); |
606 if (exca_is_pcic(&exca[i])) { | 754 exca->getb = exca_io_getb; 755 exca->putb = exca_io_putb; 756 if (exca_valid_slot(&exca[i])) |
607 err = 0; | 757 err = 0; |
608 exca[i].flags |= EXCA_SOCKET_PRESENT; 609 } | |
610 } | 758 } |
611 bus_release_resource(dev, SYS_RES_IOPORT, rid, res); | |
612 return (err); 613} 614 | 759 return (err); 760} 761 |
615int 616exca_is_pcic(struct exca_softc *sc) | 762static int 763exca_modevent(module_t mod, int cmd, void *arg) |
617{ | 764{ |
618 /* XXX */ 619 return (0); 620} 621 622static int exca_modevent(module_t mod, int cmd, void *arg) 623{ | |
624 return 0; 625} | 765 return 0; 766} |
767 |
|
626DEV_MODULE(exca, exca_modevent, NULL); 627MODULE_VERSION(exca, 1); | 768DEV_MODULE(exca, exca_modevent, NULL); 769MODULE_VERSION(exca, 1); |