diff --git a/bochs/.bochsrc b/bochs/.bochsrc index 9a4542ded..9459c83e3 100644 --- a/bochs/.bochsrc +++ b/bochs/.bochsrc @@ -860,9 +860,21 @@ private_colormap: enabled=0 #======================================================================= #pnic: enabled=1, mac=b0:c4:20:00:00:00, ethmod=vnet +#======================================================================= +# e1000: Intel(R) 82540EM Gigabit Ethernet adapter +# +# Example: +# e1000: enabled=1, mac=MACADDR, ethmod=MODULE, ethdev=DEVICE, script=SCRIPT +# +# The E1000 accepts the same syntax (for mac, ethmod, ethdev, script) and +# supports the same networking modules as the NE2000 adapter. In addition to +# this, it must be assigned to a PCI slot. +#======================================================================= +#e1000: enabled=1, mac=b0:c4:20:00:00:00, ethmod=vnet + #======================================================================= # KEYBOARD_MAPPING: -# This enables a remap of a physical localized keyboard to a +# This enables a remap of a physical localized keyboard to a # virtualized us keyboard, as the PC architecture expects. # If enabled, the keymap file must be specified. # diff --git a/bochs/.conf.everything b/bochs/.conf.everything index d70fe38f6..5fe71eedc 100644 --- a/bochs/.conf.everything +++ b/bochs/.conf.everything @@ -22,6 +22,7 @@ --enable-a20-pin \ --enable-instrumentation=instrument/example1 \ --enable-ne2000 \ + --enable-e1000 \ --enable-pci \ --enable-clgd54xx \ --enable-usb \ diff --git a/bochs/iodev/e1000.cc b/bochs/iodev/e1000.cc index 8fb13bc5d..b6e6b9a22 100644 --- a/bochs/iodev/e1000.cc +++ b/bochs/iodev/e1000.cc @@ -480,8 +480,60 @@ void bx_e1000_c::reset(unsigned type) void bx_e1000_c::register_state(void) { - bx_list_c *list = new bx_list_c(SIM->get_bochs_root(), "E1000", "E1000 State"); - // TODO + unsigned i; + char pname[4]; + + bx_list_c *list = new bx_list_c(SIM->get_bochs_root(), "e1000", "E1000 State", 9); + new bx_shadow_data_c(list, "mac_reg", (Bit8u*)BX_E1000_THIS s.mac_reg, 0x20000); + bx_list_c *phy = new bx_list_c(list, "phy_reg", "", 32); + for (i = 0; i < 32; i++) { + sprintf(pname, "0x%02x", i); + new bx_shadow_num_c(phy, pname, &BX_E1000_THIS s.phy_reg[i], BASE_HEX); + } + bx_list_c *eeprom = new bx_list_c(list, "eeprom_data", "", 64); + for (i = 0; i < 64; i++) { + sprintf(pname, "0x%02x", i); + new bx_shadow_num_c(eeprom, pname, &BX_E1000_THIS s.eeprom_data[i], BASE_HEX); + } + BXRS_DEC_PARAM_FIELD(list, rxbuf_size, BX_E1000_THIS s.rxbuf_size); + BXRS_DEC_PARAM_FIELD(list, rxbuf_min_shift, BX_E1000_THIS s.rxbuf_min_shift); + BXRS_PARAM_BOOL(list, check_rxov, BX_E1000_THIS s.check_rxov); + bx_list_c *tx = new bx_list_c(list, "tx", "", 22); + bx_list_c *header = new bx_list_c(tx, "header", "", 256); + for (i = 0; i < 256; i++) { + sprintf(pname, "0x%02x", i); + new bx_shadow_num_c(header, pname, &BX_E1000_THIS s.tx.header[i], BASE_HEX); + } + bx_list_c *vlh = new bx_list_c(tx, "vlan_header", "", 4); + for (i = 0; i < 4; i++) { + sprintf(pname, "0x%02x", i); + new bx_shadow_num_c(vlh, pname, &BX_E1000_THIS s.tx.vlan_header[i], BASE_HEX); + } + new bx_shadow_data_c(tx, "vlan_data", BX_E1000_THIS s.tx.vlan, 0x10004); + BXRS_DEC_PARAM_FIELD(tx, size, BX_E1000_THIS s.tx.size); + BXRS_DEC_PARAM_FIELD(tx, sum_needed, BX_E1000_THIS s.tx.sum_needed); + BXRS_DEC_PARAM_FIELD(tx, vlan_needed, BX_E1000_THIS s.tx.vlan_needed); + BXRS_DEC_PARAM_FIELD(tx, ipcss, BX_E1000_THIS s.tx.ipcss); + BXRS_DEC_PARAM_FIELD(tx, ipcso, BX_E1000_THIS s.tx.ipcso); + BXRS_DEC_PARAM_FIELD(tx, ipcse, BX_E1000_THIS s.tx.ipcse); + BXRS_DEC_PARAM_FIELD(tx, tucss, BX_E1000_THIS s.tx.tucss); + BXRS_DEC_PARAM_FIELD(tx, tucso, BX_E1000_THIS s.tx.tucso); + BXRS_DEC_PARAM_FIELD(tx, tucse, BX_E1000_THIS s.tx.tucse); + BXRS_DEC_PARAM_FIELD(tx, hdr_len, BX_E1000_THIS s.tx.hdr_len); + BXRS_DEC_PARAM_FIELD(tx, mss, BX_E1000_THIS s.tx.mss); + BXRS_DEC_PARAM_FIELD(tx, paylen, BX_E1000_THIS s.tx.paylen); + BXRS_DEC_PARAM_FIELD(tx, tso_frames, BX_E1000_THIS s.tx.tso_frames); + BXRS_DEC_PARAM_FIELD(tx, tse, BX_E1000_THIS s.tx.tse); + BXRS_DEC_PARAM_FIELD(tx, ip, BX_E1000_THIS s.tx.ip); + BXRS_DEC_PARAM_FIELD(tx, tcp, BX_E1000_THIS s.tx.tcp); + BXRS_DEC_PARAM_FIELD(tx, cptse, BX_E1000_THIS s.tx.cptse); + BXRS_HEX_PARAM_FIELD(tx, int_cause, BX_E1000_THIS s.tx.int_cause); + bx_list_c *eecds = new bx_list_c(list, "eecd_state", "", 5); + BXRS_DEC_PARAM_FIELD(eecds, val_in, BX_E1000_THIS s.eecd_state.val_in); + BXRS_DEC_PARAM_FIELD(eecds, bitnum_in, BX_E1000_THIS s.eecd_state.bitnum_in); + BXRS_DEC_PARAM_FIELD(eecds, bitnum_out, BX_E1000_THIS s.eecd_state.bitnum_out); + BXRS_DEC_PARAM_FIELD(eecds, reading, BX_E1000_THIS s.eecd_state.reading); + BXRS_HEX_PARAM_FIELD(eecds, old_eecd, BX_E1000_THIS s.eecd_state.old_eecd); register_pci_state(list); }