Ticket #2998: bfe440x.3.diff
File bfe440x.3.diff, 3.7 KB (added by , 16 years ago) |
---|
-
src/libs/compat/freebsd_network/bus.c
108 108 return 0; 109 109 } 110 110 111 int 112 bus_alloc_mem_resource_adipe(device_t dev, struct resource *res, int regid) 113 { 114 uint32 addr = pci_read_config(dev, regid, 4) & PCI_address_memory_32_mask; 115 uint32 size = 4 * 1024; /* XXX */ 116 void *virtualAddr; 111 117 118 dprintf("bfe: bus_alloc_mem_resource_adipe\n"); 119 120 res->r_mapped_area = map_mem(&virtualAddr, (void *)addr, size, 0, 121 "bus_alloc_resource(MEMORY)"); 122 if (res->r_mapped_area < B_OK) 123 return -1; 124 125 res->r_bustag = I386_BUS_SPACE_MEM; 126 res->r_bushandle = (bus_space_handle_t)virtualAddr; 127 return 0; 128 } 129 130 112 131 static int 113 132 bus_alloc_ioport_resource(device_t dev, struct resource *res, int regid) 114 133 { -
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); 451 468 452 rid = PCIR_BAR(0); 453 sc->bfe_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 454 RF_ACTIVE); 469 rid = PCIR_BAR (0); 470 //sc->bfe_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 471 // RF_ACTIVE); 472 { 473 int result; 474 static struct resource BLERES; 475 sc->bfe_res = &BLERES; 476 result = bus_alloc_mem_resource_adipe(dev, sc->bfe_res, rid); 477 if (result < 0) 478 panic("ble"); 479 sc->bfe_res->r_type = SYS_RES_MEMORY; 480 } 455 481 if (sc->bfe_res == NULL) { 456 482 device_printf(dev, "couldn't map memory\n"); 457 483 error = ENXIO; 458 484 goto fail; 459 485 } 460 486 487 dprintf("bfe: rman_get_bushandle(sc->bfe_res) 0x%x\n", rman_get_bushandle(sc->bfe_res)); 488 461 489 /* Allocate interrupt */ 462 490 rid = 0; 463 491 … … 498 526 ifp->if_snd.ifq_drv_maxlen = BFE_TX_QLEN; 499 527 IFQ_SET_READY(&ifp->if_snd); 500 528 529 { 530 char buf[1024]; unsigned bp=0; 531 int i=0; 532 while ( i < 256 && bp < 1024 ) 533 { 534 unsigned v= CSR_READ_4(sc, i); 535 if ((i & 0xf) == 0) 536 bp += snprintf(&buf[bp], 1024-bp, "(%02x)%08x/", i, v); 537 else 538 bp += snprintf(&buf[bp], 1024-bp, "%08x/", v); 539 i += 4; 540 } 541 542 dprintf("bfe: attach: %s\n", buf); 543 } 544 501 545 bfe_get_config(sc); 502 546 503 547 /* Reset the chip and turn on the PHY */ … … 854 898 sc->bfe_enaddr[4] = eeprom[83]; 855 899 sc->bfe_enaddr[5] = eeprom[82]; 856 900 857 sc->bfe_phyaddr = eeprom[90] & 0x1f; 901 //sc->bfe_phyaddr = eeprom[90] & 0x1f; 902 sc->bfe_phyaddr = 30; 858 903 sc->bfe_mdc_port = (eeprom[90] >> 14) & 0x1; 859 904 860 905 sc->bfe_core_unit = 0; … … 1161 1206 bfe_read_eeprom(struct bfe_softc *sc, u_int8_t *data) 1162 1207 { 1163 1208 long i; 1209 char buf[2048]; 1210 unsigned bp=0; 1164 1211 u_int16_t *ptr = (u_int16_t *)data; 1165 1212 1166 1213 for(i = 0; i < 128; i += 2) 1214 { 1215 unsigned v; 1167 1216 ptr[i/2] = CSR_READ_4(sc, 4096 + i); 1217 v= ptr[i/2]; 1218 if (bp < 2048 && (i & 0xf) == 0) 1219 bp += snprintf(&buf[bp], 2048-bp, "(%02x)", i); 1220 if (bp < 2048) 1221 bp += snprintf(&buf[bp], 2048-bp, "%08x/", v); 1222 } 1223 dprintf("bfe: bfe_read_eeprom: %s\n", buf); 1168 1224 } 1169 1225 1170 1226 static int