@@ -324,7 +324,7 @@ struct TULIPState {
324
324
uint32_t mii_bitcnt ;
325
325
326
326
/* 21040 ROM read address. */
327
- uint32_t rom_read_addr ;
327
+ uint8_t rom_read_addr ;
328
328
329
329
uint32_t current_rx_desc ;
330
330
uint32_t current_tx_desc ;
@@ -670,7 +670,7 @@ static uint32_t
670
670
tulip_csr9_read (TULIPState * s )
671
671
{
672
672
if (s -> device_info -> local == 3 ) {
673
- return (( uint8_t * ) nmc93cxx_eeprom_data ( s -> eeprom )) [s -> rom_read_addr ++ ];
673
+ return s -> eeprom_data [s -> rom_read_addr ++ ];
674
674
}
675
675
if (s -> csr [9 ] & CSR9_SR ) {
676
676
if (nmc93cxx_eeprom_read (s -> eeprom )) {
@@ -717,7 +717,7 @@ tulip_read(uint32_t addr, void *opaque)
717
717
data = s -> csr [addr >> 3 ];
718
718
break ;
719
719
}
720
- // pclog("[%04X:%08X]: CSR9 read %02x, data = %08x.\n", CS, cpu_state.pc, addr, data);
720
+ pclog ("[%04X:%08X]: CSR9 read %02x, data = %08x.\n" , CS , cpu_state .pc , addr , data );
721
721
return data ;
722
722
}
723
723
@@ -906,7 +906,7 @@ tulip_write(uint32_t addr, uint32_t data, void *opaque)
906
906
TULIPState * s = opaque ;
907
907
addr &= 127 ;
908
908
909
- // pclog("[%04X:%08X]: Tulip Write >> 3: %02x, val=%08x.\n", CS, cpu_state.pc, addr >> 3, data);
909
+ pclog ("[%04X:%08X]: Tulip Write >> 3: %02x, val=%08x.\n" , CS , cpu_state .pc , addr >> 3 , data );
910
910
switch (addr ) {
911
911
case CSR (0 ):
912
912
s -> csr [0 ] = data ;
@@ -1266,11 +1266,11 @@ tulip_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv)
1266
1266
{
1267
1267
TULIPState * s = (TULIPState * ) priv ;
1268
1268
1269
- // pclog("PCI write=%02x, ret=%02x.\n", addr, val);
1269
+ pclog ("PCI write=%02x, ret=%02x.\n" , addr , val );
1270
1270
switch (addr ) {
1271
1271
case 0x04 :
1272
1272
s -> pci_conf [0x04 ] = val & 0x07 ;
1273
- // pclog("PCI write cmd: IOBase=%04x, MMIOBase=%08x, val=%02x.\n", s->PCIBase, s->MMIOBase, s->pci_conf[0x04]);
1273
+ pclog ("PCI write cmd: IOBase=%04x, MMIOBase=%08x, val=%02x.\n" , s -> PCIBase , s -> MMIOBase , s -> pci_conf [0x04 ]);
1274
1274
io_removehandler (s -> PCIBase , 128 ,
1275
1275
tulip_readb_io , tulip_readw_io , tulip_readl_io ,
1276
1276
tulip_writeb_io , tulip_writew_io , tulip_writel_io ,
@@ -1280,7 +1280,7 @@ tulip_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv)
1280
1280
tulip_readb_io , tulip_readw_io , tulip_readl_io ,
1281
1281
tulip_writeb_io , tulip_writew_io , tulip_writel_io ,
1282
1282
priv );
1283
- // pclog("PCI write cmd: IOBase=%04x, MMIOBase=%08x, val=%02x.\n", s->PCIBase, s->MMIOBase, s->pci_conf[0x04]);
1283
+ pclog ("PCI write cmd: IOBase=%04x, MMIOBase=%08x, val=%02x.\n" , s -> PCIBase , s -> MMIOBase , s -> pci_conf [0x04 ]);
1284
1284
mem_mapping_disable (& s -> memory );
1285
1285
if ((s -> MMIOBase != 0 ) && (val & PCI_COMMAND_MEM ))
1286
1286
mem_mapping_set_addr (& s -> memory , s -> MMIOBase , 128 );
@@ -1300,7 +1300,7 @@ tulip_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv)
1300
1300
tulip_pci_bar [0 ].addr &= 0xffffff80 ;
1301
1301
s -> PCIBase = tulip_pci_bar [0 ].addr ;
1302
1302
if (s -> pci_conf [0x4 ] & PCI_COMMAND_IO ) {
1303
- // pclog("PCI write=%02x, base=%04x, io?=%x.\n", addr, s->PCIBase, s->pci_conf[0x4] & PCI_COMMAND_IO);
1303
+ pclog ("PCI write=%02x, base=%04x, io?=%x.\n" , addr , s -> PCIBase , s -> pci_conf [0x4 ] & PCI_COMMAND_IO );
1304
1304
if (s -> PCIBase != 0 )
1305
1305
io_sethandler (s -> PCIBase , 128 ,
1306
1306
tulip_readb_io , tulip_readw_io , tulip_readl_io ,
@@ -1317,7 +1317,7 @@ tulip_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv)
1317
1317
tulip_pci_bar [1 ].addr &= 0xffffff80 ;
1318
1318
s -> MMIOBase = tulip_pci_bar [1 ].addr ;
1319
1319
if (s -> pci_conf [0x4 ] & PCI_COMMAND_MEM ) {
1320
- // pclog("PCI write=%02x, mmiobase=%08x, mmio?=%x.\n", addr, s->PCIBase, s->pci_conf[0x4] & PCI_COMMAND_MEM);
1320
+ pclog ("PCI write=%02x, mmiobase=%08x, mmio?=%x.\n" , addr , s -> PCIBase , s -> pci_conf [0x4 ] & PCI_COMMAND_MEM );
1321
1321
if (s -> MMIOBase != 0 )
1322
1322
mem_mapping_set_addr (& s -> memory , s -> MMIOBase , 128 );
1323
1323
}
@@ -1510,6 +1510,9 @@ nic_init(const device_t *info)
1510
1510
} else {
1511
1511
/* 21040 is supposed to only have MAC address in its serial ROM if Linux is correct. */
1512
1512
memset (s -> eeprom_data , 0 , sizeof (s -> eeprom_data ));
1513
+ /* See if we have a local MAC address configured. */
1514
+ mac = device_get_config_mac ("mac" , -1 );
1515
+ /*DEC OID*/
1513
1516
s -> eeprom_data [0 ] = 0x00 ;
1514
1517
s -> eeprom_data [1 ] = 0x00 ;
1515
1518
s -> eeprom_data [2 ] = 0xF8 ;
@@ -1529,14 +1532,16 @@ nic_init(const device_t *info)
1529
1532
}
1530
1533
}
1531
1534
1532
- params .nwords = 64 ;
1533
- params .default_content = (uint16_t * ) s -> eeprom_data ;
1534
- params .filename = filename ;
1535
- snprintf (filename , sizeof (filename ), "nmc93cxx_eeprom_%s_%d.nvr" , info -> internal_name , device_get_instance ());
1536
- s -> eeprom = device_add_parameters (& nmc93cxx_device , & params );
1537
- if (!s -> eeprom ) {
1538
- free (s );
1539
- return NULL ;
1535
+ if (info -> local != 3 ) {
1536
+ params .nwords = 64 ;
1537
+ params .default_content = (uint16_t * ) s -> eeprom_data ;
1538
+ params .filename = filename ;
1539
+ snprintf (filename , sizeof (filename ), "nmc93cxx_eeprom_%s_%d.nvr" , info -> internal_name , device_get_instance ());
1540
+ s -> eeprom = device_add_parameters (& nmc93cxx_device , & params );
1541
+ if (!s -> eeprom ) {
1542
+ free (s );
1543
+ return NULL ;
1544
+ }
1540
1545
}
1541
1546
1542
1547
tulip_pci_bar [0 ].addr_regs [0 ] = 1 ;
@@ -1551,11 +1556,11 @@ nic_init(const device_t *info)
1551
1556
tulip_pci_bar [2 ].addr = 0 ;
1552
1557
1553
1558
mem_mapping_disable (& s -> bios_rom .mapping );
1554
- eeprom_data = (uint8_t * ) & nmc93cxx_eeprom_data (s -> eeprom )[0 ];
1559
+ eeprom_data = (info -> local == 3 ) ? s -> eeprom_data : ( uint8_t * ) & nmc93cxx_eeprom_data (s -> eeprom )[0 ];
1555
1560
1556
1561
//pclog("EEPROM Data Format=%02x, Count=%02x, MAC=%02x:%02x:%02x:%02x:%02x:%02x.\n", eeprom_data[0x12], eeprom_data[0x13], eeprom_data[0x14], eeprom_data[0x15], eeprom_data[0x16], eeprom_data[0x17], eeprom_data[0x18], eeprom_data[0x19]);
1557
1562
memcpy (s -> mii_regs , tulip_mdi_default , sizeof (tulip_mdi_default ));
1558
- s -> nic = network_attach (s , & eeprom_data [20 ], tulip_receive , NULL );
1563
+ s -> nic = network_attach (s , & eeprom_data [( info -> local == 3 ) ? 0 : 20 ], tulip_receive , NULL );
1559
1564
pci_add_card (PCI_ADD_NORMAL , tulip_pci_read , tulip_pci_write , s , & s -> pci_slot );
1560
1565
tulip_reset (s );
1561
1566
return s ;
0 commit comments