Ticket #2998: bfe440x.4.diff
File bfe440x.4.diff, 2.9 KB (added by , 16 years ago) |
---|
-
src/add-ons/kernel/drivers/network/broadcom440x/dev/bfe/if_bfe.c
430 430 } 431 431 } 432 432 433 434 int bus_alloc_mem_resource_adipe(device_t dev, struct resource *res, int regid); 435 433 436 static int 434 437 bfe_attach(device_t dev) 435 438 { … … 444 447 445 448 sc->bfe_dev = dev; 446 449 450 { 451 int i=0; 452 char buf[1024]; unsigned bp=0; 453 while (bp < 1024 && i < 256) 454 { 455 if ((i & 0xf) == 0) 456 bp += snprintf(&buf[bp], 1024-bp, "(%02x)%08x:", i, pci_read_config(dev, i, 4)); 457 else 458 bp += snprintf(&buf[bp], 1024-bp, "%08x:", pci_read_config(dev, i, 4)); 459 i+=4; 460 } 461 dprintf("bfe: pci: %s\n", buf); 462 } 463 447 464 /* 448 465 * Map control/status registers. 449 466 */ 450 467 pci_enable_busmaster(dev); 468 //the following line means pci_set_command_bit(dev, PCI_command_memory); 469 pci_write_config(dev, 4, pci_read_config(dev, 4, 2) | 2, 2); 451 470 452 rid = PCIR_BAR(0); 453 sc->bfe_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 454 RF_ACTIVE); 471 472 rid = PCIR_BAR (0); 473 //sc->bfe_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 474 // RF_ACTIVE); 475 { 476 int result; 477 static struct resource BLERES; 478 sc->bfe_res = &BLERES; 479 result = bus_alloc_mem_resource_adipe(dev, sc->bfe_res, rid); 480 if (result < 0) 481 panic("ble"); 482 sc->bfe_res->r_type = SYS_RES_MEMORY; 483 } 455 484 if (sc->bfe_res == NULL) { 456 485 device_printf(dev, "couldn't map memory\n"); 457 486 error = ENXIO; 458 487 goto fail; 459 488 } 460 489 490 dprintf("bfe: rman_get_bushandle(sc->bfe_res) 0x%x\n", rman_get_bushandle(sc->bfe_res)); 491 461 492 /* Allocate interrupt */ 462 493 rid = 0; 463 494 … … 498 529 ifp->if_snd.ifq_drv_maxlen = BFE_TX_QLEN; 499 530 IFQ_SET_READY(&ifp->if_snd); 500 531 532 { 533 char buf[1024]; unsigned bp=0; 534 int i=0; 535 while ( i < 256 && bp < 1024 ) 536 { 537 unsigned v= CSR_READ_4(sc, i); 538 if ((i & 0xf) == 0) 539 bp += snprintf(&buf[bp], 1024-bp, "(%02x)%08x/", i, v); 540 else 541 bp += snprintf(&buf[bp], 1024-bp, "%08x/", v); 542 i += 4; 543 } 544 545 dprintf("bfe: attach: %s\n", buf); 546 } 547 501 548 bfe_get_config(sc); 502 549 503 550 /* Reset the chip and turn on the PHY */ … … 854 901 sc->bfe_enaddr[4] = eeprom[83]; 855 902 sc->bfe_enaddr[5] = eeprom[82]; 856 903 857 sc->bfe_phyaddr = eeprom[90] & 0x1f; 904 //sc->bfe_phyaddr = eeprom[90] & 0x1f; 905 sc->bfe_phyaddr = 30; 858 906 sc->bfe_mdc_port = (eeprom[90] >> 14) & 0x1; 859 907 860 908 sc->bfe_core_unit = 0; … … 1161 1209 bfe_read_eeprom(struct bfe_softc *sc, u_int8_t *data) 1162 1210 { 1163 1211 long i; 1212 char buf[2048]; 1213 unsigned bp=0; 1164 1214 u_int16_t *ptr = (u_int16_t *)data; 1165 1215 1166 1216 for(i = 0; i < 128; i += 2) 1217 { 1218 unsigned v; 1167 1219 ptr[i/2] = CSR_READ_4(sc, 4096 + i); 1220 v= ptr[i/2]; 1221 if (bp < 2048 && (i & 0xf) == 0) 1222 bp += snprintf(&buf[bp], 2048-bp, "(%02x)", i); 1223 if (bp < 2048) 1224 bp += snprintf(&buf[bp], 2048-bp, "%08x/", v); 1225 } 1226 dprintf("bfe: bfe_read_eeprom: %s\n", buf); 1168 1227 } 1169 1228 1170 1229 static int