1 /* $OpenBSD: eisa_machdep.c,v 1.2 2008/07/25 21:11:14 miod Exp $ */ 2 /* $NetBSD: eisa_machdep.c,v 1.1 2000/07/29 23:18:47 thorpej Exp $ */ 3 4 /*- 5 * Copyright (c) 2000 The NetBSD Foundation, Inc. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to The NetBSD Foundation 9 * by Jason R. Thorpe. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33 #include <sys/param.h> 34 #include <sys/systm.h> 35 #include <sys/device.h> 36 #include <sys/malloc.h> 37 #include <sys/queue.h> 38 39 #include <machine/intr.h> 40 #include <machine/rpb.h> 41 42 #include <dev/eisa/eisareg.h> 43 #include <dev/eisa/eisavar.h> 44 45 int eisa_compute_maxslots(const char *); 46 47 #define EISA_SLOT_HEADER_SIZE 31 48 #define EISA_SLOT_INFO_OFFSET 20 49 50 #define EISA_FUNC_INFO_OFFSET 34 51 #define EISA_CONFIG_BLOCK_SIZE 320 52 53 #define ECUF_TYPE_STRING 0x01 54 #define ECUF_MEM_ENTRY 0x02 55 #define ECUF_IRQ_ENTRY 0x04 56 #define ECUF_DMA_ENTRY 0x08 57 #define ECUF_IO_ENTRY 0x10 58 #define ECUF_INIT_ENTRY 0x20 59 #define ECUF_DISABLED 0x80 60 61 #define ECUF_SELECTIONS_SIZE 26 62 #define ECUF_TYPE_STRING_SIZE 80 63 #define ECUF_MEM_ENTRY_SIZE 7 64 #define ECUF_IRQ_ENTRY_SIZE 2 65 #define ECUF_DMA_ENTRY_SIZE 2 66 #define ECUF_IO_ENTRY_SIZE 3 67 #define ECUF_INIT_ENTRY_SIZE 60 68 69 #define ECUF_MEM_ENTRY_CNT 9 70 #define ECUF_IRQ_ENTRY_CNT 7 71 #define ECUF_DMA_ENTRY_CNT 4 72 #define ECUF_IO_ENTRY_CNT 20 73 74 #define CBUFSIZE 512 75 76 /* 77 * EISA configuration space, as set up by the ECU, may be sparse. 78 */ 79 bus_size_t eisa_config_stride; 80 paddr_t eisa_config_addr; /* defaults to 0 */ 81 paddr_t eisa_config_header_addr; 82 83 struct ecu_mem { 84 SIMPLEQ_ENTRY(ecu_mem) ecum_list; 85 bus_addr_t ecum_addr; 86 bus_size_t ecum_size; 87 int ecum_isram; 88 int ecum_decode; 89 int ecum_unitsize; 90 }; 91 92 struct ecu_irq { 93 SIMPLEQ_ENTRY(ecu_irq) ecui_list; 94 int ecui_irq; 95 int ecui_ist; 96 int ecui_shared; 97 }; 98 99 struct ecu_dma { 100 SIMPLEQ_ENTRY(ecu_dma) ecud_list; 101 int ecud_drq; 102 int ecud_shared; 103 int ecud_size; 104 #define ECUD_SIZE_8BIT 0 105 #define ECUD_SIZE_16BIT 1 106 #define ECUD_SIZE_32BIT 2 107 #define ECUD_SIZE_RESERVED 3 108 int ecud_timing; 109 #define ECUD_TIMING_ISA 0 110 #define ECUD_TIMING_TYPEA 1 111 #define ECUD_TIMING_TYPEB 2 112 #define ECUD_TIMING_TYPEC 3 113 }; 114 115 struct ecu_io { 116 SIMPLEQ_ENTRY(ecu_io) ecuio_list; 117 bus_addr_t ecuio_addr; 118 bus_size_t ecuio_size; 119 int ecuio_shared; 120 }; 121 122 struct ecu_func { 123 SIMPLEQ_ENTRY(ecu_func) ecuf_list; 124 int ecuf_funcno; 125 u_int32_t ecuf_id; 126 u_int16_t ecuf_slot_info; 127 u_int16_t ecuf_cfg_ext; 128 u_int8_t ecuf_selections[ECUF_SELECTIONS_SIZE]; 129 u_int8_t ecuf_func_info; 130 u_int8_t ecuf_type_string[ECUF_TYPE_STRING_SIZE]; 131 u_int8_t ecuf_init[ECUF_INIT_ENTRY_SIZE]; 132 SIMPLEQ_HEAD(, ecu_mem) ecuf_mem; 133 SIMPLEQ_HEAD(, ecu_irq) ecuf_irq; 134 SIMPLEQ_HEAD(, ecu_dma) ecuf_dma; 135 SIMPLEQ_HEAD(, ecu_io) ecuf_io; 136 }; 137 138 struct ecu_data { 139 SIMPLEQ_ENTRY(ecu_data) ecud_list; 140 int ecud_slot; 141 u_int8_t ecud_eisaid[EISA_IDSTRINGLEN]; 142 u_int32_t ecud_offset; 143 144 /* General slot info. */ 145 u_int8_t ecud_slot_info; 146 u_int16_t ecud_ecu_major_rev; 147 u_int16_t ecud_ecu_minor_rev; 148 u_int16_t ecud_cksum; 149 u_int16_t ecud_ndevfuncs; 150 u_int8_t ecud_funcinfo; 151 u_int32_t ecud_comp_id; 152 153 /* The functions */ 154 SIMPLEQ_HEAD(, ecu_func) ecud_funcs; 155 }; 156 157 SIMPLEQ_HEAD(, ecu_data) ecu_data_list = 158 SIMPLEQ_HEAD_INITIALIZER(ecu_data_list); 159 160 static void 161 ecuf_init(struct ecu_func *ecuf) 162 { 163 164 memset(ecuf, 0, sizeof(*ecuf)); 165 SIMPLEQ_INIT(&ecuf->ecuf_mem); 166 SIMPLEQ_INIT(&ecuf->ecuf_irq); 167 SIMPLEQ_INIT(&ecuf->ecuf_dma); 168 SIMPLEQ_INIT(&ecuf->ecuf_io); 169 } 170 171 static void 172 eisa_parse_mem(struct ecu_func *ecuf, u_int8_t *dp) 173 { 174 struct ecu_mem *ecum; 175 int i; 176 177 for (i = 0; i < ECUF_MEM_ENTRY_CNT; i++) { 178 ecum = malloc(sizeof(*ecum), M_DEVBUF, M_ZERO|M_WAITOK); 179 if (ecum == NULL) 180 panic("%s: can't allocate memory for ecum", __func__); 181 182 ecum->ecum_isram = dp[0] & 0x1; 183 ecum->ecum_unitsize = dp[1] & 0x3; 184 ecum->ecum_decode = (dp[1] >> 2) & 0x3; 185 ecum->ecum_addr = (dp[2] | (dp[3] << 8) | (dp[4] << 16)) << 8; 186 ecum->ecum_size = (dp[5] | (dp[6] << 8)) << 10; 187 if (ecum->ecum_size == 0) 188 ecum->ecum_size = (1 << 26); 189 SIMPLEQ_INSERT_TAIL(&ecuf->ecuf_mem, ecum, ecum_list); 190 191 #ifdef EISA_DEBUG 192 printf("MEM 0x%lx 0x%lx %d %d %d\n", 193 ecum->ecum_addr, ecum->ecum_size, 194 ecum->ecum_isram, ecum->ecum_unitsize, 195 ecum->ecum_decode); 196 #endif 197 198 if ((dp[0] & 0x80) == 0) 199 break; 200 dp += ECUF_MEM_ENTRY_SIZE; 201 } 202 } 203 204 static void 205 eisa_parse_irq(struct ecu_func *ecuf, u_int8_t *dp) 206 { 207 struct ecu_irq *ecui; 208 int i; 209 210 for (i = 0; i < ECUF_IRQ_ENTRY_CNT; i++) { 211 ecui = malloc(sizeof(*ecui), M_DEVBUF, M_ZERO|M_WAITOK); 212 if (ecui == NULL) 213 panic("%s: can't allocate memory for ecui", __func__); 214 215 ecui->ecui_irq = dp[0] & 0xf; 216 ecui->ecui_ist = (dp[0] & 0x20) ? IST_LEVEL : IST_EDGE; 217 ecui->ecui_shared = (dp[0] & 0x40) ? 1 : 0; 218 SIMPLEQ_INSERT_TAIL(&ecuf->ecuf_irq, ecui, ecui_list); 219 220 #ifdef EISA_DEBUG 221 printf("IRQ %d %s%s\n", ecui->ecui_irq, 222 ecui->ecui_ist == IST_LEVEL ? "level" : "edge", 223 ecui->ecui_shared ? " shared" : ""); 224 #endif 225 226 if ((dp[0] & 0x80) == 0) 227 break; 228 dp += ECUF_IRQ_ENTRY_SIZE; 229 } 230 } 231 232 static void 233 eisa_parse_dma(struct ecu_func *ecuf, u_int8_t *dp) 234 { 235 struct ecu_dma *ecud; 236 int i; 237 238 for (i = 0; i < ECUF_DMA_ENTRY_CNT; i++) { 239 ecud = malloc(sizeof(*ecud), M_DEVBUF, M_ZERO|M_WAITOK); 240 if (ecud == NULL) 241 panic("%s: can't allocate memory for ecud", __func__); 242 243 ecud->ecud_drq = dp[0] & 0x7; 244 ecud->ecud_shared = dp[0] & 0x40; 245 ecud->ecud_size = (dp[1] >> 2) & 0x3; 246 ecud->ecud_timing = (dp[1] >> 4) & 0x3; 247 SIMPLEQ_INSERT_TAIL(&ecuf->ecuf_dma, ecud, ecud_list); 248 249 #ifdef EISA_DEBUG 250 printf("DRQ %d%s %d %d\n", ecud->ecud_drq, 251 ecud->ecud_shared ? " shared" : "", 252 ecud->ecud_size, ecud->ecud_timing); 253 #endif 254 255 if ((dp[0] & 0x80) == 0) 256 break; 257 dp += ECUF_DMA_ENTRY_SIZE; 258 } 259 } 260 261 static void 262 eisa_parse_io(struct ecu_func *ecuf, u_int8_t *dp) 263 { 264 struct ecu_io *ecuio; 265 int i; 266 267 for (i = 0; i < ECUF_IO_ENTRY_CNT; i++) { 268 ecuio = malloc(sizeof(*ecuio), M_DEVBUF, M_ZERO|M_WAITOK); 269 if (ecuio == NULL) 270 panic("%s: can't allocate memory for ecuio", __func__); 271 272 ecuio->ecuio_addr = dp[1] | (dp[2] << 8); 273 ecuio->ecuio_size = (dp[0] & 0x1f) + 1; 274 ecuio->ecuio_shared = (dp[0] & 0x40) ? 1 : 0; 275 276 #ifdef EISA_DEBUG 277 printf("IO 0x%lx 0x%lx%s\n", ecuio->ecuio_addr, 278 ecuio->ecuio_size, 279 ecuio->ecuio_shared ? " shared" : ""); 280 #endif 281 282 if ((dp[0] & 0x80) == 0) 283 break; 284 dp += ECUF_IO_ENTRY_SIZE; 285 } 286 } 287 288 static void 289 eisa_read_config_bytes(paddr_t addr, void *buf, size_t count) 290 { 291 const u_int8_t *src = (const u_int8_t *)ALPHA_PHYS_TO_K0SEG(addr); 292 u_int8_t *dst = buf; 293 294 for (; count != 0; count--) { 295 *dst++ = *src; 296 src += eisa_config_stride; 297 } 298 } 299 300 static void 301 eisa_read_config_word(paddr_t addr, u_int32_t *valp) 302 { 303 const u_int8_t *src = (const u_int8_t *)ALPHA_PHYS_TO_K0SEG(addr); 304 u_int32_t val = 0; 305 int i; 306 307 for (i = 0; i < sizeof(val); i++) { 308 val |= (u_int32_t)*src << (i * 8); 309 src += eisa_config_stride; 310 } 311 312 *valp = val; 313 } 314 315 static size_t 316 eisa_uncompress(void *cbufp, void *ucbufp, size_t count) 317 { 318 const u_int8_t *cbuf = cbufp; 319 u_int8_t *ucbuf = ucbufp; 320 u_int zeros = 0; 321 322 while (count--) { 323 if (zeros) { 324 zeros--; 325 *ucbuf++ = '\0'; 326 } else if (*cbuf == '\0') { 327 *ucbuf++ = *cbuf++; 328 zeros = *cbuf++ - 1; 329 } else 330 *ucbuf++ = *cbuf++; 331 } 332 333 return ((size_t)cbuf - (size_t)cbufp); 334 } 335 336 void 337 eisa_init(eisa_chipset_tag_t ec) 338 { 339 struct ecu_data *ecud; 340 paddr_t cfgaddr; 341 u_int32_t offset; 342 u_int8_t eisaid[EISA_IDSTRINGLEN]; 343 u_int8_t *cdata, *data; 344 u_int8_t *cdp, *dp; 345 struct ecu_func *ecuf; 346 int i, func; 347 348 /* 349 * Locate EISA configuration space. 350 */ 351 if (hwrpb->rpb_condat_off == 0UL || 352 (hwrpb->rpb_condat_off >> 63) != 0) { 353 printf(": WARNING: no EISA configuration space"); 354 return; 355 } 356 357 if (eisa_config_header_addr) { 358 printf("\n"); 359 panic("eisa_init: EISA config space already initialized"); 360 } 361 362 eisa_config_header_addr = hwrpb->rpb_condat_off; 363 if (eisa_config_stride == 0) 364 eisa_config_stride = 1; 365 366 #ifdef EISA_DEBUG 367 printf("\nEISA config header at 0x%lx\n", eisa_config_header_addr); 368 printf("EISA config at %p\n", eisa_config_addr); 369 printf("EISA config stride: %ld\n", eisa_config_stride); 370 #endif 371 372 /* 373 * Read SLOT 0 (motherboard) id, and decide how many (logical) 374 * slots there are. 375 */ 376 eisa_read_config_bytes(eisa_config_header_addr, eisaid, sizeof(eisaid)); 377 eisaid[EISA_IDSTRINGLEN - 1] = '\0'; /* sanity */ 378 ec->ec_maxslots = eisa_compute_maxslots((const char *)eisaid); 379 printf(": %s, %d slots", (const char *)eisaid, ec->ec_maxslots - 1); 380 381 /* 382 * Read the slot headers, and allocate config structures for 383 * valid slots. 384 */ 385 for (cfgaddr = eisa_config_header_addr, i = 0; 386 i < eisa_maxslots(ec); i++) { 387 eisa_read_config_bytes(cfgaddr, eisaid, sizeof(eisaid)); 388 eisaid[EISA_IDSTRINGLEN - 1] = '\0'; /* sanity */ 389 cfgaddr += sizeof(eisaid) * eisa_config_stride; 390 eisa_read_config_word(cfgaddr, &offset); 391 cfgaddr += sizeof(offset) * eisa_config_stride; 392 393 if (offset != 0 && offset != 0xffffffff) { 394 #ifdef EISA_DEBUG 395 printf("SLOT %d: offset 0x%08x eisaid %s\n", 396 i, offset, eisaid); 397 #endif 398 ecud = malloc(sizeof(*ecud), M_DEVBUF, M_ZERO|M_WAITOK); 399 if (ecud == NULL) 400 panic("%s: can't allocate memory for ecud", 401 __func__); 402 403 SIMPLEQ_INIT(&ecud->ecud_funcs); 404 405 ecud->ecud_slot = i; 406 memcpy(ecud->ecud_eisaid, eisaid, sizeof(eisaid)); 407 ecud->ecud_offset = offset; 408 SIMPLEQ_INSERT_TAIL(&ecu_data_list, ecud, ecud_list); 409 } 410 } 411 412 /* 413 * Now traverse the valid slots and read the info. 414 */ 415 416 cdata = malloc(CBUFSIZE, M_TEMP, M_ZERO|M_WAITOK); 417 if (cdata == NULL) 418 panic("%s: can't allocate memory for cdata", __func__); 419 data = malloc(CBUFSIZE, M_TEMP, M_ZERO|M_WAITOK); 420 if (data == NULL) 421 panic("%s: can't allocate memory for data", __func__); 422 423 SIMPLEQ_FOREACH(ecud, &ecu_data_list, ecud_list) { 424 cfgaddr = eisa_config_addr + ecud->ecud_offset; 425 #ifdef EISA_DEBUG 426 printf("Checking SLOT %d\n", ecud->ecud_slot); 427 printf("Reading config bytes at %p to cdata[0]\n", cfgaddr); 428 #endif 429 eisa_read_config_bytes(cfgaddr, &cdata[0], 1); 430 cfgaddr += eisa_config_stride; 431 432 for (i = 1; i < CBUFSIZE; cfgaddr += eisa_config_stride, i++) { 433 #ifdef EISA_DEBUG 434 printf("Reading config bytes at %p to cdata[%d]\n", 435 cfgaddr, i); 436 #endif 437 eisa_read_config_bytes(cfgaddr, &cdata[i], 1); 438 if (cdata[i - 1] == 0 && cdata[i] == 0) 439 break; 440 } 441 if (i == CBUFSIZE) { 442 /* assume this compressed data invalid */ 443 #ifdef EISA_DEBUG 444 printf("SLOT %d has invalid config\n", ecud->ecud_slot); 445 #endif 446 continue; 447 } 448 449 i++; /* index -> length */ 450 451 #ifdef EISA_DEBUG 452 printf("SLOT %d compressed data length %d:", 453 ecud->ecud_slot, i); 454 { 455 int j; 456 457 for (j = 0; j < i; j++) { 458 if ((j % 16) == 0) 459 printf("\n"); 460 printf("0x%02x ", cdata[j]); 461 } 462 printf("\n"); 463 } 464 #endif 465 466 cdp = cdata; 467 dp = data; 468 469 /* Uncompress the slot header. */ 470 cdp += eisa_uncompress(cdp, dp, EISA_SLOT_HEADER_SIZE); 471 #ifdef EISA_DEBUG 472 printf("SLOT %d uncompressed header data:", 473 ecud->ecud_slot); 474 { 475 int j; 476 477 for (j = 0; j < EISA_SLOT_HEADER_SIZE; j++) { 478 if ((j % 16) == 0) 479 printf("\n"); 480 printf("0x%02x ", dp[j]); 481 } 482 printf("\n"); 483 } 484 #endif 485 486 dp = &data[EISA_SLOT_INFO_OFFSET]; 487 ecud->ecud_slot_info = *dp++; 488 ecud->ecud_ecu_major_rev = *dp++; 489 ecud->ecud_ecu_minor_rev = *dp++; 490 memcpy(&ecud->ecud_cksum, dp, sizeof(ecud->ecud_cksum)); 491 dp += sizeof(ecud->ecud_cksum); 492 ecud->ecud_ndevfuncs = *dp++; 493 ecud->ecud_funcinfo = *dp++; 494 memcpy(&ecud->ecud_comp_id, dp, sizeof(ecud->ecud_comp_id)); 495 dp += sizeof(ecud->ecud_comp_id); 496 497 #ifdef EISA_DEBUG 498 printf("SLOT %d: ndevfuncs %d\n", ecud->ecud_slot, 499 ecud->ecud_ndevfuncs); 500 #endif 501 502 for (func = 0; func < ecud->ecud_ndevfuncs; func++) { 503 dp = data; 504 cdp += eisa_uncompress(cdp, dp, EISA_CONFIG_BLOCK_SIZE); 505 #ifdef EISA_DEBUG 506 printf("SLOT %d:%d uncompressed data:", 507 ecud->ecud_slot, func); 508 { 509 int j; 510 511 for (j = 0; i < EISA_CONFIG_BLOCK_SIZE; j++) { 512 if ((j % 16) == 0) 513 printf("\n"); 514 printf("0x%02x ", dp[j]); 515 } 516 printf("\n"); 517 } 518 #endif 519 520 /* Skip disabled functions. */ 521 if (dp[EISA_FUNC_INFO_OFFSET] & ECUF_DISABLED) { 522 #ifdef EISA_DEBUG 523 printf("SLOT %d:%d disabled\n", 524 ecud->ecud_slot, func); 525 #endif 526 continue; 527 } 528 #ifdef EISA_DEBUG 529 else 530 printf("SLOT %d:%d settings\n", 531 ecud->ecud_slot, func); 532 #endif 533 534 ecuf = malloc(sizeof(*ecuf), M_DEVBUF, M_WAITOK); 535 if (ecuf == NULL) 536 panic("%s: can't allocate memory for ecuf", 537 __func__); 538 ecuf_init(ecuf); 539 ecuf->ecuf_funcno = func; 540 SIMPLEQ_INSERT_TAIL(&ecud->ecud_funcs, ecuf, 541 ecuf_list); 542 543 memcpy(&ecuf->ecuf_id, dp, sizeof(ecuf->ecuf_id)); 544 dp += sizeof(ecuf->ecuf_id); 545 546 memcpy(&ecuf->ecuf_slot_info, dp, 547 sizeof(ecuf->ecuf_slot_info)); 548 dp += sizeof(ecuf->ecuf_slot_info); 549 550 memcpy(&ecuf->ecuf_cfg_ext, dp, 551 sizeof(ecuf->ecuf_cfg_ext)); 552 dp += sizeof(ecuf->ecuf_cfg_ext); 553 554 memcpy(&ecuf->ecuf_selections, dp, 555 sizeof(ecuf->ecuf_selections)); 556 dp += sizeof(ecuf->ecuf_selections); 557 558 memcpy(&ecuf->ecuf_func_info, dp, 559 sizeof(ecuf->ecuf_func_info)); 560 dp += sizeof(ecuf->ecuf_func_info); 561 562 if (ecuf->ecuf_func_info & ECUF_TYPE_STRING) 563 memcpy(ecuf->ecuf_type_string, dp, 564 sizeof(ecuf->ecuf_type_string)); 565 dp += sizeof(ecuf->ecuf_type_string); 566 567 if (ecuf->ecuf_func_info & ECUF_MEM_ENTRY) 568 eisa_parse_mem(ecuf, dp); 569 dp += ECUF_MEM_ENTRY_SIZE * ECUF_MEM_ENTRY_CNT; 570 571 if (ecuf->ecuf_func_info & ECUF_IRQ_ENTRY) 572 eisa_parse_irq(ecuf, dp); 573 dp += ECUF_IRQ_ENTRY_SIZE * ECUF_IRQ_ENTRY_CNT; 574 575 if (ecuf->ecuf_func_info & ECUF_DMA_ENTRY) 576 eisa_parse_dma(ecuf, dp); 577 dp += ECUF_DMA_ENTRY_SIZE * ECUF_DMA_ENTRY_CNT; 578 579 if (ecuf->ecuf_func_info & ECUF_IO_ENTRY) 580 eisa_parse_io(ecuf, dp); 581 dp += ECUF_IO_ENTRY_SIZE * ECUF_IO_ENTRY_CNT; 582 583 if (ecuf->ecuf_func_info & ECUF_INIT_ENTRY) 584 memcpy(ecuf->ecuf_init, dp, 585 sizeof(ecuf->ecuf_init)); 586 dp += sizeof(ecuf->ecuf_init); 587 } 588 } 589 590 free(cdata, M_TEMP); 591 free(data, M_TEMP); 592 } 593 594 /* 595 * Return the number of logical slots a motherboard supports, 596 * from its signature. 597 */ 598 int 599 eisa_compute_maxslots(const char *idstring) 600 { 601 int nslots; 602 603 if (strcmp(idstring, "DEC2400") == 0) /* Jensen */ 604 nslots = 1 + 6; 605 else if (strcmp(idstring, "DEC2A01") == 0) /* AS 2000/2100 */ 606 nslots = 1 + 8; 607 else if (strcmp(idstring, "DEC5000") == 0) /* AS 1000/600A */ 608 nslots = 1 + 8; 609 else if (strcmp(idstring, "DEC5100") == 0) /* AS 600 */ 610 nslots = 1 + 4; 611 else if (strcmp(idstring, "DEC5301") == 0) /* AS 800 */ 612 nslots = 1 + 3; 613 else if (strcmp(idstring, "DEC6000") == 0) /* AS 8200/8400 */ 614 nslots = 1 + 8; 615 else if (strcmp(idstring, "DEC6400") == 0) /* AS 4x00/1200 */ 616 nslots = 1 + 3; 617 else { 618 /* 619 * Unrecognized design. Not likely to happen, since 620 * Digital ECU will not recognize it either. 621 * But just in case the EISA configuration data badly 622 * fooled us, return the largest possible value. 623 */ 624 nslots = 1 + 8; 625 } 626 627 return nslots; 628 } 629