Merge branch 'master' into net-add-tap-backend

This commit is contained in:
Jasmine Iwanek
2025-06-26 22:11:10 -04:00
committed by GitHub
1154 changed files with 93967 additions and 44063 deletions

View File

@@ -41,7 +41,10 @@ pkg_check_modules(SLIRP REQUIRED IMPORTED_TARGET slirp)
target_link_libraries(86Box PkgConfig::SLIRP)
if(WIN32)
target_link_libraries(PkgConfig::SLIRP INTERFACE wsock32 ws2_32 iphlpapi iconv)
target_link_libraries(PkgConfig::SLIRP INTERFACE wsock32 ws2_32 iphlpapi)
if (NOT MSVC)
target_link_libraries(PkgConfig::SLIRP INTERFACE iconv)
endif()
if(STATIC_BUILD)
add_compile_definitions(LIBSLIRP_STATIC)
endif()

View File

@@ -56,7 +56,6 @@
#include <86box/thread.h>
#include <86box/timer.h>
#include <86box/network.h>
#include <86box/bswap.h>
#include <86box/plat_unused.h>
/* Maximum number of times we report a link down to the guest (failure to send frame) */
@@ -1080,8 +1079,7 @@ threec501_nic_init(UNUSED(const device_t *info))
uint32_t mac;
threec501_t *dev;
dev = malloc(sizeof(threec501_t));
memset(dev, 0x00, sizeof(threec501_t));
dev = calloc(1, sizeof(threec501_t));
dev->maclocal[0] = 0x02; /* 02:60:8C (3Com OID) */
dev->maclocal[1] = 0x60;
dev->maclocal[2] = 0x8C;
@@ -1156,30 +1154,31 @@ threec501_nic_close(void *priv)
static const device_config_t threec501_config[] = {
{
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = "",
.default_int = 0x300,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = NULL,
.default_int = 0x300,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "0x280", .value = 0x280 },
{ .description = "0x300", .value = 0x300 },
{ .description = "0x310", .value = 0x310 },
{ .description = "0x320", .value = 0x320 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 3,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 3,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "IRQ 2/9", .value = 9 },
{ .description = "IRQ 3", .value = 3 },
{ .description = "IRQ 4", .value = 4 },
@@ -1188,28 +1187,34 @@ static const device_config_t threec501_config[] = {
{ .description = "IRQ 7", .value = 7 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "dma",
.description = "DMA",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 3,
.file_filter = "",
.spinner = { 0 },
.selection = {
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 3,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "DMA 1", .value = 1 },
{ .description = "DMA 2", .value = 2 },
{ .description = "DMA 3", .value = 3 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
@@ -1222,7 +1227,7 @@ const device_t threec501_device = {
.init = threec501_nic_init,
.close = threec501_nic_close,
.reset = elnkR3Reset,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = threec501_config

View File

@@ -60,7 +60,6 @@
#include <86box/timer.h>
#include <86box/network.h>
#include <86box/net_dp8390.h>
#include <86box/bswap.h>
#include <86box/plat_unused.h>
typedef struct threec503_t {
@@ -573,8 +572,7 @@ threec503_nic_init(UNUSED(const device_t *info))
uint32_t mac;
threec503_t *dev;
dev = malloc(sizeof(threec503_t));
memset(dev, 0x00, sizeof(threec503_t));
dev = calloc(1, sizeof(threec503_t));
dev->maclocal[0] = 0x02; /* 02:60:8C (3Com OID) */
dev->maclocal[1] = 0x60;
dev->maclocal[2] = 0x8C;
@@ -656,14 +654,14 @@ threec503_nic_close(void *priv)
static const device_config_t threec503_config[] = {
// clang-format off
{
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = "",
.default_int = 0x300,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = NULL,
.default_int = 0x300,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "0x250", .value = 0x250 },
{ .description = "0x280", .value = 0x280 },
{ .description = "0x2a0", .value = 0x2a0 },
@@ -674,80 +672,83 @@ static const device_config_t threec503_config[] = {
{ .description = "0x350", .value = 0x350 },
{ .description = "", .value = 0 }
},
.bios = { { 0 } }
},
{
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 3,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 3,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "IRQ 2", .value = 2 },
{ .description = "IRQ 3", .value = 3 },
{ .description = "IRQ 4", .value = 4 },
{ .description = "IRQ 5", .value = 5 },
{ .description = "", .value = 0 }
},
.bios = { { 0 } }
},
{
.name = "dma",
.description = "DMA",
.type = CONFIG_SELECTION,
.name = "dma",
.description = "DMA",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 3,
.file_filter = "",
.spinner = { 0 },
.selection = {
.default_int = 3,
.file_filter = "",
.spinner = { 0 },
.selection = {
{ .description = "DMA 1", .value = 1 },
{ .description = "DMA 2", .value = 2 },
{ .description = "DMA 3", .value = 3 },
{ .description = "", .value = 0 }
},
.bios = { { 0 } }
},
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1,
.file_filter = "",
.spinner = { 0 },
.selection = {
{ .description = "", .value = 0 }
},
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{
.name = "bios_addr",
.description = "BIOS Address",
.type = CONFIG_HEX20,
.default_string = "",
.default_int = 0xCC000,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "bios_addr",
.description = "BIOS Address",
.type = CONFIG_HEX20,
.default_string = NULL,
.default_int = 0xCC000,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "DC00", .value = 0xDC000 },
{ .description = "D800", .value = 0xD8000 },
{ .description = "C800", .value = 0xC8000 },
{ .description = "CC00", .value = 0xCC000 },
{ .description = "", .value = 0 }
{ .description = "", .value = 0 }
},
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
// clang-format off
};
const device_t threec503_device = {
.name = "3Com EtherLink II",
.name = "3Com EtherLink II",
.internal_name = "3c503",
.flags = DEVICE_ISA,
.local = 0,
.init = threec503_nic_init,
.close = threec503_nic_close,
.reset = NULL,
{ .available = NULL },
.flags = DEVICE_ISA,
.local = 0,
.init = threec503_nic_init,
.close = threec503_nic_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = threec503_config
.force_redraw = NULL,
.config = threec503_config
};

View File

@@ -918,8 +918,7 @@ dp8390_set_defaults(dp8390_t *dev, uint8_t flags)
void
dp8390_mem_alloc(dp8390_t *dev, uint32_t start, uint32_t size)
{
dev->mem = (uint8_t *) malloc(size * sizeof(uint8_t));
memset(dev->mem, 0, size * sizeof(uint8_t));
dev->mem = (uint8_t *) calloc(size, sizeof(uint8_t));
dev->mem_start = start;
dev->mem_end = start + size;
dev->mem_size = size;
@@ -1007,8 +1006,7 @@ dp8390_soft_reset(dp8390_t *dev)
static void *
dp8390_init(UNUSED(const device_t *info))
{
dp8390_t *dp8390 = (dp8390_t *) malloc(sizeof(dp8390_t));
memset(dp8390, 0, sizeof(dp8390_t));
dp8390_t *dp8390 = (dp8390_t *) calloc(1, sizeof(dp8390_t));
/* Set values assuming WORD and only the clear IRQ flag -
- the NIC can then call dp8390_set_defaults() again to
@@ -1047,7 +1045,7 @@ const device_t dp8390_device = {
.init = dp8390_init,
.close = dp8390_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL

View File

@@ -277,7 +277,7 @@ const device_t nmc93cxx_device = {
.init = nmc93cxx_eeprom_init,
.close = nmc93cxx_eeprom_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL

View File

@@ -1133,7 +1133,7 @@ modem_dtr_callback_timer(void *priv)
}
void
modem_dtr_callback(serial_t *serial, int status, void *priv)
modem_dtr_callback(UNUSED(serial_t *serial), int status, void *priv)
{
modem_t *dev = (modem_t *) priv;
dev->dtrstate = !!status;
@@ -1177,9 +1177,15 @@ modem_process_telnet(modem_t *modem, uint8_t *data, uint32_t size)
uint8_t c = data[i];
if (modem->telClient.inIAC) {
if (modem->telClient.recCommand) {
modem_log("modem_process_telnet: received command %i, option %i\n", modem->telClient.command, c);
if ((c != 0) && (c != 1) && (c != 3)) {
if (modem->telClient.command > 250) {
/* Reject anything we don't recognize */
/* Reject anything we don't recognize */
if (modem->telClient.command == 251 || modem->telClient.command == 252) {
modem_data_mode_process_byte(modem, 0xff);
modem_data_mode_process_byte(modem, 254);
modem_data_mode_process_byte(modem, c); /* Don't do crap! */
} else if (modem->telClient.command == 253 || modem->telClient.command == 254) {
modem_data_mode_process_byte(modem, 0xff);
modem_data_mode_process_byte(modem, 252);
modem_data_mode_process_byte(modem, c); /* We won't do crap! */
@@ -1483,7 +1489,7 @@ modem_cmdpause_timer_callback(void *priv)
/* Initialize the device for use by the user. */
static void *
modem_init(const device_t *info)
modem_init(UNUSED(const device_t *info))
{
modem_t *modem = (modem_t *) calloc(1, sizeof(modem_t));
const char *phonebook_file = NULL;
@@ -1531,30 +1537,31 @@ modem_close(void *priv)
// clang-format off
static const device_config_t modem_config[] = {
{
.name = "port",
.description = "Serial Port",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 0,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "port",
.description = "Serial Port",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "COM1", .value = 0 },
{ .description = "COM2", .value = 1 },
{ .description = "COM3", .value = 2 },
{ .description = "COM4", .value = 3 },
{ .description = "" }
}
},
.bios = { { 0 } }
},
{
.name = "baudrate",
.description = "Baud Rate",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 115200,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
.name = "baudrate",
.description = "Baud Rate",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 115200,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "115200", .value = 115200 },
{ .description = "57600", .value = 57600 },
{ .description = "56000", .value = 56000 },
@@ -1569,32 +1576,44 @@ static const device_config_t modem_config[] = {
{ .description = "1200", .value = 1200 },
{ .description = "600", .value = 600 },
{ .description = "300", .value = 300 },
}
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "listen_port",
.description = "TCP/IP listening port",
.type = CONFIG_SPINNER,
.spinner =
{
.min = 0,
.name = "listen_port",
.description = "TCP/IP listening port",
.type = CONFIG_SPINNER,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = {
.min = 0,
.max = 32767
},
.default_int = 0
.selection = { { 0 } },
.bios = { { 0 } }
},
{
.name = "phonebook_file",
.description = "Phonebook File",
.type = CONFIG_FNAME,
.default_string = "",
.file_filter = "Text files (*.txt)|*.txt"
.name = "phonebook_file",
.description = "Phonebook File",
.type = CONFIG_FNAME,
.default_string = NULL,
.file_filter = "Text files (*.txt)|*.txt",
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{
.name = "telnet_mode",
.description = "Telnet emulation",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 0
.name = "telnet_mode",
.description = "Telnet emulation",
.type = CONFIG_BINARY,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
@@ -1608,7 +1627,7 @@ const device_t modem_device = {
.init = modem_init,
.close = modem_close,
.reset = NULL,
{ .poll = NULL },
.available = NULL,
.speed_changed = modem_speed_changed,
.force_redraw = NULL,
.config = modem_config

View File

@@ -66,7 +66,6 @@
#include <86box/network.h>
#include <86box/net_dp8390.h>
#include <86box/net_ne2000.h>
#include <86box/bswap.h>
#include <86box/isapnp.h>
#include <86box/plat_fallthrough.h>
#include <86box/plat_unused.h>
@@ -313,7 +312,7 @@ asic_write(nic_t *dev, uint32_t off, uint32_t val, unsigned len)
static uint32_t
page3_read(nic_t *dev, uint32_t off, UNUSED(unsigned int len))
{
if (dev->board >= NE2K_RTL8019AS)
if (dev->board >= NE2K_RTL8019AS_PNP)
switch (off) {
case 0x1: /* 9346CR */
return (dev->_9346cr);
@@ -328,7 +327,7 @@ page3_read(nic_t *dev, uint32_t off, UNUSED(unsigned int len))
return (dev->config3 & 0x46);
case 0x8: /* CSNSAV */
return ((dev->board == NE2K_RTL8019AS) ? dev->pnp_csnsav : 0x00);
return ((dev->board == NE2K_RTL8019AS_PNP) ? dev->pnp_csnsav : 0x00);
case 0xe: /* 8029ASID0 */
if (dev->board == NE2K_RTL8029AS)
@@ -351,7 +350,7 @@ page3_read(nic_t *dev, uint32_t off, UNUSED(unsigned int len))
static void
page3_write(nic_t *dev, uint32_t off, uint32_t val, UNUSED(unsigned len))
{
if (dev->board >= NE2K_RTL8019AS) {
if (dev->board >= NE2K_RTL8019AS_PNP) {
nelog(3, "%s: Page2 write to register 0x%02x, len=%u, value=0x%04x\n",
dev->name, off, len, val);
@@ -912,17 +911,15 @@ nic_init(const device_t *info)
{
uint32_t mac;
uint32_t mac_oui;
char *rom;
char *rom = NULL;
nic_t *dev;
int set_oui = 0;
dev = malloc(sizeof(nic_t));
memset(dev, 0x00, sizeof(nic_t));
dev = calloc(1, sizeof(nic_t));
dev->name = info->name;
dev->board = info->local;
rom = NULL;
if (dev->board >= NE2K_RTL8019AS) {
if (dev->board >= NE2K_RTL8019AS_PNP) {
dev->base_address = 0x340;
dev->base_irq = 12;
if (dev->board == NE2K_RTL8029AS) {
@@ -1045,18 +1042,18 @@ nic_init(const device_t *info)
dp8390_mem_alloc(dev->dp8390, 0x4000, 0x8000);
break;
case NE2K_RTL8019AS:
case NE2K_RTL8019AS_PNP:
case NE2K_RTL8029AS:
dev->is_pci = (dev->board == NE2K_RTL8029AS) ? 1 : 0;
dev->maclocal[0] = 0x00; /* 00:E0:4C (Realtek OID) */
dev->maclocal[1] = 0xE0;
dev->maclocal[2] = 0x4C;
rom = (dev->board == NE2K_RTL8019AS) ? ROM_PATH_RTL8019 : ROM_PATH_RTL8029;
rom = (dev->board == NE2K_RTL8019AS_PNP) ? ROM_PATH_RTL8019 : ROM_PATH_RTL8029;
if (dev->is_pci)
dp8390_set_defaults(dev->dp8390, DP8390_FLAG_EVEN_MAC);
else
dp8390_set_defaults(dev->dp8390, DP8390_FLAG_EVEN_MAC | DP8390_FLAG_CLEAR_IRQ);
dp8390_set_id(dev->dp8390, 0x50, (dev->board == NE2K_RTL8019AS) ? 0x70 : 0x43);
dp8390_set_id(dev->dp8390, 0x50, (dev->board == NE2K_RTL8019AS_PNP) ? 0x70 : 0x43);
dp8390_mem_alloc(dev->dp8390, 0x4000, 0x8000);
break;
@@ -1074,7 +1071,7 @@ nic_init(const device_t *info)
mac_oui = (((int) dev->maclocal[0]) << 16);
mac_oui |= (((int) dev->maclocal[1]) << 8);
mac_oui |= ((int) dev->maclocal[2]);
device_set_config_mac("mac", mac);
device_set_config_mac("mac_oui", mac_oui);
} else {
dev->maclocal[0] = (mac_oui >> 16) & 0xff;
dev->maclocal[1] = (mac_oui >> 8) & 0xff;
@@ -1093,13 +1090,13 @@ nic_init(const device_t *info)
* Make this device known to the I/O system.
* PnP and PCI devices start with address spaces inactive.
*/
if ((dev->board < NE2K_RTL8019AS) && (dev->board != NE2K_ETHERNEXT_MC))
if ((dev->board < NE2K_RTL8019AS_PNP) && (dev->board != NE2K_ETHERNEXT_MC))
nic_ioset(dev, dev->base_address);
/* Set up our BIOS ROM space, if any. */
nic_rom_init(dev, rom);
if (dev->board >= NE2K_RTL8019AS) {
if (dev->board >= NE2K_RTL8019AS_PNP) {
if (dev->is_pci) {
/*
* Configure the PCI space registers.
@@ -1147,7 +1144,7 @@ nic_init(const device_t *info)
pci_add_card(PCI_ADD_NORMAL, nic_pci_read, nic_pci_write, dev, &dev->pci_slot);
}
/* Initialize the RTL8029 EEPROM. */
/* Initialize the RTL80x9 EEPROM. */
memset(dev->eeprom, 0x00, sizeof(dev->eeprom));
if (dev->board == NE2K_RTL8029AS) {
@@ -1161,7 +1158,7 @@ nic_init(const device_t *info)
const char *pnp_rom_file = NULL;
int pnp_rom_len = 0x4a;
switch (dev->board) {
case NE2K_RTL8019AS:
case NE2K_RTL8019AS_PNP:
pnp_rom_file = "roms/network/rtl8019as/RTL8019A.BIN";
break;
@@ -1185,7 +1182,7 @@ nic_init(const device_t *info)
}
switch (info->local) {
case NE2K_RTL8019AS:
case NE2K_RTL8019AS_PNP:
case NE2K_DE220P:
dev->pnp_card = isapnp_add_card(pnp_rom, pnp_rom_len,
nic_pnp_config_changed, nic_pnp_csn_changed,
@@ -1237,14 +1234,14 @@ de220p_available(void)
// clang-format off
static const device_config_t ne1000_config[] = {
{
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = "",
.default_int = 0x300,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = NULL,
.default_int = 0x300,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
/* Source: Windows 95 .INF file. */
{ .description = "0x300", .value = 0x300 },
{ .description = "0x320", .value = 0x320 },
@@ -1252,16 +1249,17 @@ static const device_config_t ne1000_config[] = {
{ .description = "0x360", .value = 0x360 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 3,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 3,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
/* Source: Windows 95 .INF file. */
{ .description = "IRQ 2", .value = 2 },
{ .description = "IRQ 3", .value = 3 },
@@ -1270,27 +1268,32 @@ static const device_config_t ne1000_config[] = {
{ .description = "IRQ 9", .value = 9 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
static const device_config_t ne1000_compat_config[] = {
{
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = "",
.default_int = 0x300,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = NULL,
.default_int = 0x300,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
/* Source: Windows 95 .INF file. */
{ .description = "0x200", .value = 0x200 },
{ .description = "0x220", .value = 0x220 },
@@ -1310,16 +1313,17 @@ static const device_config_t ne1000_compat_config[] = {
{ .description = "0x3e0", .value = 0x3e0 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 3,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 3,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
/* Source: Windows 95 .INF file. */
{ .description = "IRQ 2", .value = 2 },
{ .description = "IRQ 3", .value = 3 },
@@ -1329,34 +1333,43 @@ static const device_config_t ne1000_compat_config[] = {
{ .description = "IRQ 9", .value = 9 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{
.name = "mac_oui",
.description = "MAC Address OUI",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac_oui",
.description = "MAC Address OUI",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
static const device_config_t ne2000_config[] = {
{
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = "",
.default_int = 0x300,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = NULL,
.default_int = 0x300,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
/* Source: Windows 95 .INF file. */
{ .description = "0x300", .value = 0x300 },
{ .description = "0x320", .value = 0x320 },
@@ -1364,16 +1377,17 @@ static const device_config_t ne2000_config[] = {
{ .description = "0x360", .value = 0x360 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 3,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 3,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
/* Source: Windows 95 .INF file. */
{ .description = "IRQ 2", .value = 2 },
{ .description = "IRQ 3", .value = 3 },
@@ -1382,43 +1396,49 @@ static const device_config_t ne2000_config[] = {
{ .description = "IRQ 9", .value = 9 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{
.name = "bios_addr",
.description = "BIOS Address",
.type = CONFIG_HEX20,
.default_string = "",
.default_int = 0,
.file_filter = "",
.spinner = { 0 },
.selection = {
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "Disabled", .value = 0x00000 },
{ .description = "D000", .value = 0xD0000 },
{ .description = "D800", .value = 0xD8000 },
{ .description = "C800", .value = 0xC8000 },
{ .description = "" }
},
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
static const device_config_t ne2000_compat_config[] = {
{
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = "",
.default_int = 0x300,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = NULL,
.default_int = 0x300,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
/* Source: Windows 95 .INF file. */
{ .description = "0x200", .value = 0x200 },
{ .description = "0x220", .value = 0x220 },
@@ -1438,16 +1458,17 @@ static const device_config_t ne2000_compat_config[] = {
{ .description = "0x3e0", .value = 0x3e0 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 10,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 10,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
/* Source: Windows 95 .INF file - not giving impossible IRQ's
such as 6, 8, or 13. */
{ .description = "IRQ 3", .value = 3 },
@@ -1462,50 +1483,60 @@ static const device_config_t ne2000_compat_config[] = {
{ .description = "IRQ 15", .value = 15 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{
.name = "mac_oui",
.description = "MAC Address OUI",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac_oui",
.description = "MAC Address OUI",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{
.name = "bios_addr",
.description = "BIOS Address",
.type = CONFIG_HEX20,
.default_string = "",
.default_int = 0,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "bios_addr",
.description = "BIOS Address",
.type = CONFIG_HEX20,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "Disabled", .value = 0x00000 },
{ .description = "D000", .value = 0xD0000 },
{ .description = "D800", .value = 0xD8000 },
{ .description = "C800", .value = 0xC8000 },
{ .description = "" }
},
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
static const device_config_t ne2000_compat_8bit_config[] = {
{
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = "",
.default_int = 0x320,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = NULL,
.default_int = 0x320,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
/* Source: board docs, https://github.com/skiselev/isa8_eth */
{ .description = "0x200", .value = 0x200 },
{ .description = "0x220", .value = 0x220 },
@@ -1525,16 +1556,17 @@ static const device_config_t ne2000_compat_8bit_config[] = {
{ .description = "0x3e0", .value = 0x3e0 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 3,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 3,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
/* Source: board docs, https://github.com/skiselev/isa8_eth */
{ .description = "IRQ 2", .value = 2 },
{ .description = "IRQ 3", .value = 3 },
@@ -1543,30 +1575,39 @@ static const device_config_t ne2000_compat_8bit_config[] = {
{ .description = "IRQ 9", .value = 9 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{
.name = "mac_oui",
.description = "MAC Address OUI",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac_oui",
.description = "MAC Address OUI",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{
.name = "bios_addr",
.description = "BIOS Address",
.type = CONFIG_HEX20,
.default_string = "",
.default_int = 0,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "bios_addr",
.description = "BIOS Address",
.type = CONFIG_HEX20,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
/* Source: board docs, https://github.com/skiselev/isa8_eth */
{ .description = "Disabled", .value = 0x00000 },
{ .description = "C000", .value = 0xC0000 },
@@ -1579,6 +1620,7 @@ static const device_config_t ne2000_compat_8bit_config[] = {
{ .description = "DC00", .value = 0xDC000 },
{ .description = "" }
},
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
@@ -1586,40 +1628,56 @@ static const device_config_t ne2000_compat_8bit_config[] = {
static const device_config_t rtl8019as_config[] = {
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
static const device_config_t rtl8029as_config[] = {
{
.name = "bios",
.description = "Enable BIOS",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 0
.name = "bios",
.description = "Enable BIOS",
.type = CONFIG_BINARY,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
static const device_config_t mca_mac_config[] = {
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
@@ -1633,7 +1691,7 @@ const device_t ne1000_device = {
.init = nic_init,
.close = nic_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = ne1000_config
@@ -1647,7 +1705,7 @@ const device_t ne1000_compat_device = {
.init = nic_init,
.close = nic_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = ne1000_compat_config
@@ -1656,12 +1714,12 @@ const device_t ne1000_compat_device = {
const device_t ne2000_device = {
.name = "Novell NE2000",
.internal_name = "novell_ne2k",
.flags = DEVICE_ISA | DEVICE_AT,
.flags = DEVICE_ISA16,
.local = NE2K_NE2000,
.init = nic_init,
.close = nic_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = ne2000_config
@@ -1670,12 +1728,12 @@ const device_t ne2000_device = {
const device_t ne2000_compat_device = {
.name = "NE2000 Compatible",
.internal_name = "ne2k",
.flags = DEVICE_ISA | DEVICE_AT,
.flags = DEVICE_ISA16,
.local = NE2K_NE2000_COMPAT,
.init = nic_init,
.close = nic_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = ne2000_compat_config
@@ -1689,7 +1747,7 @@ const device_t ne2000_compat_8bit_device = {
.init = nic_init,
.close = nic_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = ne2000_compat_8bit_config
@@ -1703,21 +1761,21 @@ const device_t ethernext_mc_device = {
.init = nic_init,
.close = nic_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = mca_mac_config
};
const device_t rtl8019as_device = {
const device_t rtl8019as_pnp_device = {
.name = "Realtek RTL8019AS",
.internal_name = "ne2kpnp",
.flags = DEVICE_ISA | DEVICE_AT,
.local = NE2K_RTL8019AS,
.flags = DEVICE_ISA16,
.local = NE2K_RTL8019AS_PNP,
.init = nic_init,
.close = nic_close,
.reset = NULL,
{ .available = rtl8019as_available },
.available = rtl8019as_available,
.speed_changed = NULL,
.force_redraw = NULL,
.config = rtl8019as_config
@@ -1726,12 +1784,12 @@ const device_t rtl8019as_device = {
const device_t de220p_device = {
.name = "D-Link DE-220P",
.internal_name = "de220p",
.flags = DEVICE_ISA | DEVICE_AT,
.flags = DEVICE_ISA16,
.local = NE2K_DE220P,
.init = nic_init,
.close = nic_close,
.reset = NULL,
{ .available = de220p_available },
.available = de220p_available,
.speed_changed = NULL,
.force_redraw = NULL,
.config = rtl8019as_config
@@ -1745,7 +1803,7 @@ const device_t rtl8029as_device = {
.init = nic_init,
.close = nic_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = rtl8029as_config

View File

@@ -218,8 +218,8 @@ net_null_close(void *priv)
}
const netdrv_t net_null_drv = {
&net_null_in_available,
&net_null_init,
&net_null_close,
NULL
.notify_in = &net_null_in_available,
.init = &net_null_init,
.close = &net_null_close,
.priv = NULL
};

View File

@@ -572,8 +572,8 @@ net_pcap_close(void *priv)
}
const netdrv_t net_pcap_drv = {
&net_pcap_in_available,
&net_pcap_init,
&net_pcap_close,
NULL
.notify_in = &net_pcap_in_available,
.init = &net_pcap_init,
.close = &net_pcap_close,
.priv = NULL
};

View File

@@ -46,9 +46,9 @@
#include <86box/thread.h>
#include <86box/network.h>
#include <86box/net_pcnet.h>
#include <86box/bswap.h>
#include <86box/plat_fallthrough.h>
#include <86box/plat_unused.h>
#include <86box/bswap.h>
/* PCI info. */
#define PCI_VENDID 0x1022 /* AMD */
@@ -2916,14 +2916,13 @@ pcnet_init(const device_t *info)
int c;
uint16_t checksum;
dev = malloc(sizeof(nic_t));
memset(dev, 0x00, sizeof(nic_t));
dev = calloc(1, sizeof(nic_t));
dev->name = info->name;
dev->board = info->local & 0xff;
dev->is_pci = !!(info->flags & DEVICE_PCI);
dev->is_vlb = !!(info->flags & DEVICE_VLB);
dev->is_isa = !!(info->flags & (DEVICE_ISA | DEVICE_AT));
dev->is_isa = !!(info->flags & (DEVICE_ISA16));
if (dev->is_pci || dev->is_vlb)
dev->transfer_size = 4;
@@ -3089,62 +3088,68 @@ pcnet_close(void *priv)
// clang-format off
static const device_config_t pcnet_pci_config[] = {
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
static const device_config_t pcnet_isa_config[] = {
{
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = "",
.default_int = 0x300,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = NULL,
.default_int = 0x300,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "0x300", .value = 0x300 },
{ .description = "0x320", .value = 0x320 },
{ .description = "0x340", .value = 0x340 },
{ .description = "0x360", .value = 0x360 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 3,
.file_filter = "",
.spinner = { 0 },
.selection = {
{ .description = "IRQ 3", .value = 3 },
{ .description = "IRQ 4", .value = 4 },
{ .description = "IRQ 5", .value = 5 },
{ .description = "IRQ 7", .value = 7 },
{ .description = "IRQ 9", .value = 9 },
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 3,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "IRQ 3", .value = 3 },
{ .description = "IRQ 4", .value = 4 },
{ .description = "IRQ 5", .value = 5 },
{ .description = "IRQ 7", .value = 7 },
{ .description = "IRQ 9", .value = 9 },
{ .description = "IRQ 10", .value = 10 },
{ .description = "IRQ 11", .value = 11 },
{ .description = "IRQ 12", .value = 12 },
{ .description = "IRQ 15", .value = 15 },
{ .description = "" }
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "dma",
.description = "DMA",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 5,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "dma",
.description = "DMA",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 5,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "DMA 0", .value = 0 },
{ .description = "DMA 3", .value = 3 },
{ .description = "DMA 5", .value = 5 },
@@ -3152,61 +3157,72 @@ static const device_config_t pcnet_isa_config[] = {
{ .description = "DMA 7", .value = 7 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
static const device_config_t pcnet_vlb_config[] = {
{
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = "",
.default_int = 0x300,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = NULL,
.default_int = 0x300,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "0x300", .value = 0x300 },
{ .description = "0x320", .value = 0x320 },
{ .description = "0x340", .value = 0x340 },
{ .description = "0x360", .value = 0x360 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 3,
.file_filter = "",
.spinner = { 0 },
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 3,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "IRQ 3", .value = 3 },
{ .description = "IRQ 4", .value = 4 },
{ .description = "IRQ 5", .value = 5 },
{ .description = "IRQ 7", .value = 7 },
{ .description = "IRQ 9", .value = 9 },
{ .description = "IRQ 3", .value = 3 },
{ .description = "IRQ 4", .value = 4 },
{ .description = "IRQ 5", .value = 5 },
{ .description = "IRQ 7", .value = 7 },
{ .description = "IRQ 9", .value = 9 },
{ .description = "IRQ 10", .value = 10 },
{ .description = "IRQ 11", .value = 11 },
{ .description = "IRQ 12", .value = 12 },
{ .description = "IRQ 15", .value = 15 },
{ .description = "" }
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
@@ -3215,12 +3231,12 @@ static const device_config_t pcnet_vlb_config[] = {
const device_t pcnet_am79c960_device = {
.name = "AMD PCnet-ISA",
.internal_name = "pcnetisa",
.flags = DEVICE_AT | DEVICE_ISA,
.flags = DEVICE_ISA16,
.local = DEV_AM79C960,
.init = pcnet_init,
.close = pcnet_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = pcnet_isa_config
@@ -3229,26 +3245,30 @@ const device_t pcnet_am79c960_device = {
const device_t pcnet_am79c960_eb_device = {
.name = "Racal Interlan EtherBlaster",
.internal_name = "pcnetracal",
.flags = DEVICE_AT | DEVICE_ISA,
.flags = DEVICE_ISA16,
.local = DEV_AM79C960_EB,
.init = pcnet_init,
.close = pcnet_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = pcnet_isa_config
};
/*
Used to be incorrectly called "AMD PCnet-VL" but the real name of the chip is "AMD PCnet-32" per the relevant datasheet.
https://theretroweb.com/chip/documentation/am79c965-66c24a7e6969d347126123.pdf
*/
const device_t pcnet_am79c960_vlb_device = {
.name = "AMD PCnet-VL",
.name = "AMD PCnet-32",
.internal_name = "pcnetvlb",
.flags = DEVICE_VLB,
.local = DEV_AM79C960_VLB,
.init = pcnet_init,
.close = pcnet_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = pcnet_vlb_config
@@ -3257,12 +3277,12 @@ const device_t pcnet_am79c960_vlb_device = {
const device_t pcnet_am79c961_device = {
.name = "AMD PCnet-ISA+",
.internal_name = "pcnetisaplus",
.flags = DEVICE_AT | DEVICE_ISA,
.flags = DEVICE_ISA16,
.local = DEV_AM79C961,
.init = pcnet_init,
.close = pcnet_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = pcnet_pci_config
@@ -3276,7 +3296,7 @@ const device_t pcnet_am79c970a_device = {
.init = pcnet_init,
.close = pcnet_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = pcnet_pci_config
@@ -3290,7 +3310,7 @@ const device_t pcnet_am79c973_device = {
.init = pcnet_init,
.close = pcnet_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = pcnet_pci_config
@@ -3304,7 +3324,7 @@ const device_t pcnet_am79c973_onboard_device = {
.init = pcnet_init,
.close = pcnet_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = pcnet_pci_config

View File

@@ -26,12 +26,12 @@
#include <stdarg.h>
#define HAVE_STDARG_H
#include <86box/86box.h>
#include <86box/timer.h>
#include <86box/lpt.h>
#include <86box/timer.h>
#include <86box/pit.h>
#include <86box/device.h>
#include <86box/thread.h>
#include <86box/timer.h>
#include <86box/network.h>
#include <86box/plat_unused.h>
@@ -445,8 +445,7 @@ plip_rx(void *priv, uint8_t *buf, int io_len)
static void *
plip_lpt_init(void *lpt)
{
plip_t *dev = (plip_t *) malloc(sizeof(plip_t));
memset(dev, 0, sizeof(plip_t));
plip_t *dev = (plip_t *) calloc(1, sizeof(plip_t));
plip_log(1, "PLIP: lpt_init()\n");
@@ -489,15 +488,18 @@ plip_close(void *priv)
}
const lpt_device_t lpt_plip_device = {
.name = "Parallel Line Internet Protocol",
.internal_name = "plip",
.init = plip_lpt_init,
.close = plip_close,
.write_data = plip_write_data,
.write_ctrl = plip_write_ctrl,
.read_data = NULL,
.read_status = plip_read_status,
.read_ctrl = NULL
.name = "Parallel Line Internet Protocol",
.internal_name = "plip",
.init = plip_lpt_init,
.close = plip_close,
.write_data = plip_write_data,
.write_ctrl = plip_write_ctrl,
.autofeed = NULL,
.strobe = NULL,
.read_status = plip_read_status,
.read_ctrl = NULL,
.epp_write_data = NULL,
.epp_request_read = NULL
};
const device_t plip_device = {
@@ -508,7 +510,7 @@ const device_t plip_device = {
.init = plip_net_init,
.close = NULL,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL

View File

@@ -28,6 +28,9 @@
#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#ifdef _MVC_VER
#include <stddef.h>
#endif
#include <time.h>
#define HAVE_STDARG_H
#include <86box/86box.h>
@@ -41,10 +44,10 @@
#include <86box/thread.h>
#include <86box/network.h>
#include <86box/net_eeprom_nmc93cxx.h>
#include <86box/bswap.h>
#include <86box/nvr.h>
#include "cpu.h"
#include <86box/plat_unused.h>
#include <86box/bswap.h>
#define PCI_PERIOD 30 /* 30 ns period = 33.333333 Mhz frequency */
@@ -531,14 +534,14 @@ rtl8139_write_buffer(RTL8139State *s, const void *buf, int size)
if (size > wrapped) {
dma_bm_write(s->RxBuf + s->RxBufAddr,
buf, size - wrapped, 1);
(uint8_t *) buf, size - wrapped, 1);
}
/* reset buffer pointer */
s->RxBufAddr = 0;
dma_bm_write(s->RxBuf + s->RxBufAddr,
buf + (size - wrapped), wrapped, 1);
(uint8_t *) buf + (size - wrapped), wrapped, 1);
s->RxBufAddr = wrapped;
@@ -1207,7 +1210,7 @@ rtl8139_CpCmd_read(RTL8139State *s)
}
static void
rtl8139_IntrMitigate_write(UNUSED(RTL8139State *s), uint32_t val)
rtl8139_IntrMitigate_write(UNUSED(RTL8139State *s), UNUSED(uint32_t val))
{
rtl8139_log("C+ IntrMitigate register write(w) val=0x%04x\n", val);
}
@@ -2546,6 +2549,12 @@ rtl8139_io_writeb(uint32_t addr, uint8_t val, void *priv)
break;
case RxConfig:
rtl8139_log("RxConfig write(b) val=0x%02x\n", val);
rtl8139_RxConfig_write(s,
(rtl8139_RxConfig_read(s) & 0xFFFFFF00) | val);
break;
default:
rtl8139_log("not implemented write(b) addr=0x%x val=0x%02x\n", addr, val);
break;
@@ -3148,7 +3157,7 @@ rtl8139_pci_read(UNUSED(int func), int addr, void *priv)
}
static void
rtl8139_pci_write(int func, int addr, uint8_t val, void *priv)
rtl8139_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv)
{
RTL8139State *s = (RTL8139State *) priv;
@@ -3312,11 +3321,15 @@ nic_close(void *priv)
// clang-format off
static const device_config_t rtl8139c_config[] = {
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
@@ -3330,7 +3343,7 @@ const device_t rtl8139c_plus_device = {
.init = nic_init,
.close = nic_close,
.reset = rtl8139_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = rtl8139c_config

View File

@@ -60,16 +60,19 @@ enum {
};
typedef struct net_slirp_t {
Slirp *slirp;
uint8_t mac_addr[6];
netcard_t *card; /* netcard attached to us */
thread_t *poll_tid;
net_evt_t tx_event;
net_evt_t stop_event;
netpkt_t pkt;
netpkt_t pkt_tx_v[SLIRP_PKT_BATCH];
Slirp * slirp;
uint8_t mac_addr[6];
netcard_t * card; /* netcard attached to us */
thread_t * poll_tid;
net_evt_t rx_event;
net_evt_t tx_event;
net_evt_t stop_event;
netpkt_t pkt;
netpkt_t pkt_tx_v[SLIRP_PKT_BATCH];
int during_tx;
int recv_on_tx;
#ifdef _WIN32
HANDLE sock_event;
HANDLE sock_event;
#else
uint32_t pfd_len;
uint32_t pfd_size;
@@ -133,7 +136,7 @@ net_slirp_clock_get_ns(UNUSED(void *opaque))
static void *
net_slirp_timer_new(SlirpTimerCb cb, void *cb_opaque, UNUSED(void *opaque))
{
pc_timer_t *timer = malloc(sizeof(pc_timer_t));
pc_timer_t *timer = calloc(1, sizeof(pc_timer_t));
timer_add(timer, cb, cb_opaque, 0);
return timer;
}
@@ -152,14 +155,22 @@ net_slirp_timer_mod(void *timer, int64_t expire_timer, UNUSED(void *opaque))
}
static void
#if SLIRP_CHECK_VERSION(4, 9, 0)
net_slirp_register_poll_socket(slirp_os_socket fd, void *opaque)
#else
net_slirp_register_poll_fd(int fd, void *opaque)
#endif
{
(void) fd;
(void) opaque;
}
static void
#if SLIRP_CHECK_VERSION(4, 9, 0)
net_slirp_unregister_poll_socket(slirp_os_socket fd, void *opaque)
#else
net_slirp_unregister_poll_fd(int fd, void *opaque)
#endif
{
(void) fd;
(void) opaque;
@@ -184,14 +195,22 @@ net_slirp_send_packet(const void *qp, size_t pkt_len, void *opaque)
memcpy(slirp->pkt.data, (uint8_t *) qp, pkt_len);
slirp->pkt.len = pkt_len;
network_rx_put_pkt(slirp->card, &slirp->pkt);
if (slirp->during_tx) {
network_rx_on_tx_put_pkt(slirp->card, &slirp->pkt);
slirp->recv_on_tx = 1;
} else
network_rx_put_pkt(slirp->card, &slirp->pkt);
return pkt_len;
}
#ifdef _WIN32
static int
# if SLIRP_CHECK_VERSION(4, 9, 0)
net_slirp_add_poll(slirp_os_socket fd, int events, void *opaque)
# else
net_slirp_add_poll(int fd, int events, void *opaque)
# endif
{
net_slirp_t *slirp = (net_slirp_t *) opaque;
long bitmask = 0;
@@ -209,7 +228,11 @@ net_slirp_add_poll(int fd, int events, void *opaque)
}
#else
static int
# if SLIRP_CHECK_VERSION(4, 9, 0)
net_slirp_add_poll(slirp_os_socket fd, int events, void *opaque)
# else
net_slirp_add_poll(int fd, int events, void *opaque)
# endif
{
net_slirp_t *slirp = (net_slirp_t *) opaque;
@@ -268,8 +291,12 @@ net_slirp_get_revents(int idx, void *opaque)
WSA_TO_POLL(FD_WRITE, SLIRP_POLL_OUT);
WSA_TO_POLL(FD_CONNECT, SLIRP_POLL_OUT);
WSA_TO_POLL(FD_OOB, SLIRP_POLL_PRI);
WSA_TO_POLL(FD_CLOSE, SLIRP_POLL_IN);
WSA_TO_POLL(FD_CLOSE, SLIRP_POLL_HUP);
if (ret == 0)
ret |= SLIRP_POLL_IN;
return ret;
}
#else
@@ -300,8 +327,13 @@ static const SlirpCb slirp_cb = {
.timer_new = net_slirp_timer_new,
.timer_free = net_slirp_timer_free,
.timer_mod = net_slirp_timer_mod,
#if SLIRP_CHECK_VERSION(4, 9, 0)
.register_poll_socket = net_slirp_register_poll_socket,
.unregister_poll_socket = net_slirp_unregister_poll_socket,
#else
.register_poll_fd = net_slirp_register_poll_fd,
.unregister_poll_fd = net_slirp_unregister_poll_fd,
#endif
.notify = net_slirp_notify
};
@@ -324,6 +356,21 @@ net_slirp_in_available(void *priv)
net_event_set(&slirp->tx_event);
}
static void
net_slirp_rx_deferred_packets(net_slirp_t *slirp)
{
int packets = 0;
if (slirp->recv_on_tx) {
do {
packets = network_rx_on_tx_popv(slirp->card, slirp->pkt_tx_v, SLIRP_PKT_BATCH);
for (int i = 0; i < packets; i++)
network_rx_put_pkt(slirp->card, &(slirp->pkt_tx_v[i]));
} while (packets > 0);
slirp->recv_on_tx = 0;
}
}
#ifdef _WIN32
static void
net_slirp_thread(void *priv)
@@ -340,7 +387,11 @@ net_slirp_thread(void *priv)
bool run = true;
while (run) {
uint32_t timeout = -1;
# if SLIRP_CHECK_VERSION(4, 9, 0)
slirp_pollfds_fill_socket(slirp->slirp, &timeout, net_slirp_add_poll, slirp);
# else
slirp_pollfds_fill(slirp->slirp, &timeout, net_slirp_add_poll, slirp);
# endif
if (timeout < 0)
timeout = INFINITE;
@@ -352,10 +403,13 @@ net_slirp_thread(void *priv)
case NET_EVENT_TX:
{
slirp->during_tx = 1;
int packets = network_tx_popv(slirp->card, slirp->pkt_tx_v, SLIRP_PKT_BATCH);
for (int i = 0; i < packets; i++) {
for (int i = 0; i < packets; i++)
net_slirp_in(slirp, slirp->pkt_tx_v[i].data, slirp->pkt_tx_v[i].len);
}
slirp->during_tx = 0;
net_slirp_rx_deferred_packets(slirp);
}
break;
@@ -384,7 +438,11 @@ net_slirp_thread(void *priv)
net_slirp_add_poll(net_event_get_fd(&slirp->stop_event), SLIRP_POLL_IN, slirp);
net_slirp_add_poll(net_event_get_fd(&slirp->tx_event), SLIRP_POLL_IN, slirp);
# if SLIRP_CHECK_VERSION(4, 9, 0)
slirp_pollfds_fill_socket(slirp->slirp, &timeout, net_slirp_add_poll, slirp);
# else
slirp_pollfds_fill(slirp->slirp, &timeout, net_slirp_add_poll, slirp);
# endif
int ret = poll(slirp->pfd, slirp->pfd_len, timeout);
@@ -398,10 +456,13 @@ net_slirp_thread(void *priv)
if (slirp->pfd[NET_EVENT_TX].revents & POLLIN) {
net_event_clear(&slirp->tx_event);
slirp->during_tx = 1;
int packets = network_tx_popv(slirp->card, slirp->pkt_tx_v, SLIRP_PKT_BATCH);
for (int i = 0; i < packets; i++) {
for (int i = 0; i < packets; i++)
net_slirp_in(slirp, slirp->pkt_tx_v[i].data, slirp->pkt_tx_v[i].len);
}
slirp->during_tx = 0;
net_slirp_rx_deferred_packets(slirp);
}
}
@@ -422,8 +483,7 @@ net_slirp_init(const netcard_t *card, const uint8_t *mac_addr, UNUSED(void *priv
#ifndef _WIN32
slirp->pfd_size = 16 * sizeof(struct pollfd);
slirp->pfd = malloc(slirp->pfd_size);
memset(slirp->pfd, 0, slirp->pfd_size);
slirp->pfd = calloc(1, slirp->pfd_size);
#endif
/* Set the IP addresses to use. */
@@ -433,10 +493,47 @@ net_slirp_init(const netcard_t *card, const uint8_t *mac_addr, UNUSED(void *priv
struct in_addr dhcp = { .s_addr = htonl(0x0a00000f | (slirp_card_num << 8)) }; /* 10.0.x.15 */
struct in_addr dns = { .s_addr = htonl(0x0a000003 | (slirp_card_num << 8)) }; /* 10.0.x.3 */
struct in_addr bind = { .s_addr = htonl(0x00000000) }; /* 0.0.0.0 */
struct in6_addr ipv6_dummy = { 0 }; /* contents don't matter; we're not using IPv6 */
const SlirpConfig slirp_config = {
#if SLIRP_CHECK_VERSION(4, 9, 0)
.version = 6,
#else
.version = 1,
#endif
.restricted = 0,
.in_enabled = 1,
.vnetwork = net,
.vnetmask = mask,
.vhost = host,
.in6_enabled = 0,
.vprefix_addr6 = { .s6_addr = { 0xfe, 0xc0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* fec0:: - unused */
.vprefix_len = 64,
.vhost6 = { .s6_addr = { 0xfe, 0xc0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x02 } }, /* fec0::2 - unused */
.vhostname = "86Box",
.tftp_server_name = NULL,
.tftp_path = NULL,
.bootfile = NULL,
.vdhcp_start = dhcp,
.vnameserver = dns,
.vnameserver6 = { .s6_addr = { 0xfe, 0xc0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x03 } }, /* fec0::3 - unused */
.vdnssearch = NULL,
.vdomainname = NULL,
.if_mtu = 0,
.if_mru = 0,
.disable_host_loopback = 0,
.enable_emu = 0,
#if SLIRP_CHECK_VERSION(4, 9, 0)
.outbound_addr = NULL,
.outbound_addr6 = NULL,
.disable_dns = 0,
.disable_dhcp = 0,
.mfr_id = 0,
.oob_eth_addr = { 0, 0, 0, 0, 0, 0 }
#endif
};
/* Initialize SLiRP. */
slirp->slirp = slirp_init(0, 1, net, mask, host, 0, ipv6_dummy, 0, ipv6_dummy, NULL, NULL, NULL, NULL, dhcp, dns, ipv6_dummy, NULL, NULL, &slirp_cb, slirp);
slirp->slirp = slirp_new(&slirp_config, &slirp_cb, slirp);
if (!slirp->slirp) {
slirp_log("SLiRP: initialization failed\n");
snprintf(netdrv_errbuf, NET_DRV_ERRBUF_SIZE, "SLiRP initialization failed");
@@ -478,6 +575,7 @@ net_slirp_init(const netcard_t *card, const uint8_t *mac_addr, UNUSED(void *priv
slirp->pkt_tx_v[i].data = calloc(1, NET_MAX_FRAME);
}
slirp->pkt.data = calloc(1, NET_MAX_FRAME);
net_event_init(&slirp->rx_event);
net_event_init(&slirp->tx_event);
net_event_init(&slirp->stop_event);
#ifdef _WIN32
@@ -532,8 +630,9 @@ net_slirp_close(void *priv)
slirp_log("SLiRP: waiting for thread to end...\n");
thread_wait(slirp->poll_tid);
net_event_close(&slirp->tx_event);
net_event_close(&slirp->stop_event);
net_event_close(&slirp->tx_event);
net_event_close(&slirp->rx_event);
slirp_cleanup(slirp->slirp);
for (int i = 0; i < SLIRP_PKT_BATCH; i++) {
free(slirp->pkt_tx_v[i].data);
@@ -544,7 +643,8 @@ net_slirp_close(void *priv)
}
const netdrv_t net_slirp_drv = {
&net_slirp_in_available,
&net_slirp_init,
&net_slirp_close
.notify_in = &net_slirp_in_available,
.init = &net_slirp_init,
.close = &net_slirp_close,
.priv = NULL
};

View File

@@ -32,9 +32,9 @@
#include <86box/thread.h>
#include <86box/network.h>
#include <86box/net_eeprom_nmc93cxx.h>
#include <86box/bswap.h>
#include <86box/plat_fallthrough.h>
#include <86box/plat_unused.h>
#include <86box/bswap.h>
#define ROM_PATH_DEC21140 "roms/network/dec21140/BIOS13502.BIN"
@@ -971,7 +971,8 @@ tulip_write(uint32_t addr, uint32_t data, void *opaque)
case CSR(7):
s->csr[7] = data;
tulip_update_int(s);
if (s->device_info->local)
tulip_update_int(s);
break;
case CSR(8):
@@ -1006,7 +1007,7 @@ tulip_write(uint32_t addr, uint32_t data, void *opaque)
case CSR(13):
s->csr[13] = data;
if (s->device_info->local == 3 && (data & 0x4)) {
if ((s->device_info->local == 3) && (data & 0x4)) {
s->csr[13] = 0x8f01;
s->csr[14] = 0xfffd;
s->csr[15] = 0;
@@ -1407,7 +1408,7 @@ nic_init(const device_t *info)
if (!s)
return NULL;
if (info->local && info->local != 3) {
if (info->local && (info->local != 3)) {
s->bios_addr = 0xD0000;
s->has_bios = device_get_config_int("bios");
} else {
@@ -1434,7 +1435,7 @@ nic_init(const device_t *info)
s->eeprom_data[2] = 0x14;
s->eeprom_data[3] = 0x21;
} else {
/*Subsystem Vendor ID*/
/*Subsystem Vendor ID*/
s->eeprom_data[0] = info->local ? 0x25 : 0x11;
s->eeprom_data[1] = 0x10;
@@ -1549,23 +1550,40 @@ nic_init(const device_t *info)
/*Block Count*/
s->eeprom_data[32] = 0x01;
/*Extended Format - Block Type 2 for 21142/21143*/
/*Extended Format - Block Type 3 for 21142/21143*/
/*Length (0:6) and Format Indicator (7)*/
s->eeprom_data[33] = 0x86;
s->eeprom_data[33] = 0x8d;
/*Block Type*/
s->eeprom_data[34] = 0x02;
s->eeprom_data[34] = 0x03;
/*Media Code (0:5), EXT (6), Reserved (7)*/
s->eeprom_data[35] = 0x01;
/*PHY Number*/
s->eeprom_data[35] = 0x00;
/*General Purpose Control*/
s->eeprom_data[36] = 0xff;
s->eeprom_data[37] = 0xff;
/*GPR Length*/
s->eeprom_data[36] = 0x00;
/*General Purpose Data*/
/*Reset Length*/
s->eeprom_data[37] = 0x00;
/*Media Capabilities*/
s->eeprom_data[38] = 0x00;
s->eeprom_data[39] = 0x00;
s->eeprom_data[39] = 0x78;
/*Nway Advertisement*/
s->eeprom_data[40] = 0xe0;
s->eeprom_data[41] = 0x01;
/*FDX Bit Map*/
s->eeprom_data[42] = 0x00;
s->eeprom_data[43] = 0x50;
/*TTM Bit Map*/
s->eeprom_data[44] = 0x00;
s->eeprom_data[45] = 0x18;
/*MII PHY Insertion/removal Indication*/
s->eeprom_data[46] = 0x00;
}
s->eeprom_data[126] = tulip_srom_crc(s->eeprom_data) & 0xff;
@@ -1608,7 +1626,7 @@ nic_init(const device_t *info)
checksum *= 2;
if (checksum > 65535)
checksum = checksum % 65535;
/* 3rd pair. */
checksum += (s->eeprom_data[4] * 256) | s->eeprom_data[5];
if (checksum > 65535)
@@ -1616,7 +1634,7 @@ nic_init(const device_t *info)
if (checksum >= 65535)
checksum = 0;
s->eeprom_data[6] = (checksum >> 8) & 0xFF;
s->eeprom_data[7] = checksum & 0xFF;
}
@@ -1664,29 +1682,41 @@ nic_close(void *priv)
// clang-format off
static const device_config_t dec_tulip_21143_config[] = {
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
static const device_config_t dec_tulip_21140_config[] = {
{
.name = "bios",
.description = "Enable BIOS",
.type = CONFIG_BINARY,
.default_string = "",
.default_int = 0
.name = "bios",
.description = "Enable BIOS",
.type = CONFIG_BINARY,
.default_string = NULL,
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
@@ -1700,7 +1730,7 @@ const device_t dec_tulip_device = {
.init = nic_init,
.close = nic_close,
.reset = tulip_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = dec_tulip_21143_config
@@ -1714,7 +1744,7 @@ const device_t dec_tulip_21140_device = {
.init = nic_init,
.close = nic_close,
.reset = tulip_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = dec_tulip_21140_config
@@ -1728,7 +1758,7 @@ const device_t dec_tulip_21140_vpc_device = {
.init = nic_init,
.close = nic_close,
.reset = tulip_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = dec_tulip_21140_config
@@ -1742,7 +1772,7 @@ const device_t dec_tulip_21040_device = {
.init = nic_init,
.close = nic_close,
.reset = tulip_reset,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = dec_tulip_21143_config

View File

@@ -302,9 +302,9 @@ void *net_vde_init(const netcard_t *card, const uint8_t *mac_addr, void *priv, c
// VDE Driver structure
//-
const netdrv_t net_vde_drv = {
&net_vde_in_available,
&net_vde_init,
&net_vde_close,
NULL
.notify_in = &net_vde_in_available,
.init = &net_vde_init,
.close = &net_vde_close,
.priv = NULL
};

View File

@@ -63,7 +63,6 @@
#include <86box/network.h>
#include <86box/net_dp8390.h>
#include <86box/net_wd8003.h>
#include <86box/bswap.h>
#include <86box/plat_fallthrough.h>
#include <86box/plat_unused.h>
@@ -651,8 +650,7 @@ wd_init(const device_t *info)
uint32_t mac;
wd_t *dev;
dev = malloc(sizeof(wd_t));
memset(dev, 0x00, sizeof(wd_t));
dev = calloc(1, sizeof(wd_t));
dev->name = info->name;
dev->board = info->local;
@@ -808,46 +806,48 @@ wd_close(void *priv)
// clang-format off
static const device_config_t wd8003_config[] = {
{
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = "",
.default_int = 0x300,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = NULL,
.default_int = 0x300,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "0x240", .value = 0x240 },
{ .description = "0x280", .value = 0x280 },
{ .description = "0x300", .value = 0x300 },
{ .description = "0x380", .value = 0x380 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 3,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 3,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "IRQ 2", .value = 2 },
{ .description = "IRQ 3", .value = 3 },
{ .description = "IRQ 5", .value = 5 },
{ .description = "IRQ 7", .value = 7 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "ram_addr",
.description = "RAM Address",
.type = CONFIG_HEX20,
.default_string = "",
.default_int = 0xD0000,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "ram_addr",
.description = "RAM Address",
.type = CONFIG_HEX20,
.default_string = NULL,
.default_int = 0xD0000,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "C800", .value = 0xC8000 },
{ .description = "CC00", .value = 0xCC000 },
{ .description = "D000", .value = 0xD0000 },
@@ -856,27 +856,32 @@ static const device_config_t wd8003_config[] = {
{ .description = "DC00", .value = 0xDC000 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
static const device_config_t wd8003eb_config[] = {
{
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = "",
.default_int = 0x280,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = NULL,
.default_int = 0x280,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "0x200", .value = 0x200 },
{ .description = "0x220", .value = 0x220 },
{ .description = "0x240", .value = 0x240 },
@@ -889,32 +894,34 @@ static const device_config_t wd8003eb_config[] = {
{ .description = "0x380", .value = 0x380 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 3,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 3,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "IRQ 2/9", .value = 9 },
{ .description = "IRQ 3", .value = 3 },
{ .description = "IRQ 4", .value = 4 },
{ .description = "IRQ 7", .value = 7 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "ram_addr",
.description = "RAM Address",
.type = CONFIG_HEX20,
.default_string = "",
.default_int = 0xD0000,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "ram_addr",
.description = "RAM Address",
.type = CONFIG_HEX20,
.default_string = NULL,
.default_int = 0xD0000,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "C000", .value = 0xC0000 },
{ .description = "C400", .value = 0xC4000 },
{ .description = "C800", .value = 0xC8000 },
@@ -925,27 +932,33 @@ static const device_config_t wd8003eb_config[] = {
{ .description = "DC00", .value = 0xDC000 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "ram_size",
.description = "RAM size",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 8192,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "ram_size",
.description = "RAM size",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 8192,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "8 KB", .value = 8192 },
{ .description = "32 KB", .value = 32768 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
@@ -954,14 +967,14 @@ static const device_config_t wd8003eb_config[] = {
http://www.stack.nl/~marcolz/network/wd80x3.html#WD8013EBT */
static const device_config_t wd8013_config[] = {
{
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = "",
.default_int = 0x280,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = NULL,
.default_int = 0x280,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "0x200", .value = 0x200 },
{ .description = "0x220", .value = 0x220 },
{ .description = "0x240", .value = 0x240 },
@@ -974,16 +987,17 @@ static const device_config_t wd8013_config[] = {
{ .description = "0x380", .value = 0x380 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 3,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 3,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "IRQ 2/9", .value = 9 },
{ .description = "IRQ 3", .value = 3 },
{ .description = "IRQ 4", .value = 4 },
@@ -994,16 +1008,17 @@ static const device_config_t wd8013_config[] = {
{ .description = "IRQ 15", .value = 15 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "ram_addr",
.description = "RAM Address",
.type = CONFIG_HEX20,
.default_string = "",
.default_int = 0xD0000,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "ram_addr",
.description = "RAM Address",
.type = CONFIG_HEX20,
.default_string = NULL,
.default_int = 0xD0000,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "C000", .value = 0xC0000 },
{ .description = "C400", .value = 0xC4000 },
{ .description = "C800", .value = 0xC8000 },
@@ -1014,63 +1029,78 @@ static const device_config_t wd8013_config[] = {
{ .description = "DC00", .value = 0xDC000 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "ram_size",
.description = "RAM size",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 16384,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "ram_size",
.description = "RAM size",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 16384,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "16 KB", .value = 16384 },
{ .description = "64 KB", .value = 65536 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
static const device_config_t wd8013epa_config[] = {
{
.name = "ram_size",
.description = "Initial RAM size",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 16384,
.file_filter = "",
.spinner = { 0 },
.selection = {
.name = "ram_size",
.description = "Initial RAM size",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = 16384,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "8 KB", .value = 8192 },
{ .description = "16 KB", .value = 16384 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
static const device_config_t mca_mac_config[] = {
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END }
};
@@ -1084,7 +1114,7 @@ const device_t wd8003e_device = {
.init = wd_init,
.close = wd_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = wd8003_config
@@ -1098,7 +1128,7 @@ const device_t wd8003eb_device = {
.init = wd_init,
.close = wd_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = wd8003eb_config
@@ -1112,7 +1142,7 @@ const device_t wd8013ebt_device = {
.init = wd_init,
.close = wd_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = wd8013_config
@@ -1126,7 +1156,7 @@ const device_t wd8003eta_device = {
.init = wd_init,
.close = wd_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = mca_mac_config
@@ -1140,7 +1170,7 @@ const device_t wd8003ea_device = {
.init = wd_init,
.close = wd_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = mca_mac_config
@@ -1154,7 +1184,7 @@ const device_t wd8013epa_device = {
.init = wd_init,
.close = wd_close,
.reset = NULL,
{ .available = NULL },
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = wd8013epa_config

View File

@@ -54,7 +54,9 @@
#include <stdlib.h>
#include <wchar.h>
#include <time.h>
#ifndef _MSC_VER
#include <sys/time.h>
#endif
#include <stdbool.h>
#define HAVE_STDARG_H
#include <86box/86box.h>
@@ -83,36 +85,43 @@ static const NETWORK_CARD net_cards[] = {
// clang-format off
{ &device_none },
{ &device_internal },
/* ISA */
{ &threec501_device },
{ &threec503_device },
{ &pcnet_am79c960_device },
{ &pcnet_am79c961_device },
{ &de220p_device },
{ &ne1000_compat_device },
{ &ne2000_compat_device },
{ &ne2000_compat_8bit_device },
{ &ne1000_device },
{ &ne2000_device },
{ &pcnet_am79c960_eb_device },
{ &rtl8019as_device },
{ &wd8003e_device },
{ &wd8003eb_device },
{ &wd8013ebt_device },
/* COM */
{ &modem_device },
/* LPT */
{ &plip_device },
/* ISA16 */
{ &pcnet_am79c960_device },
{ &pcnet_am79c961_device },
{ &de220p_device },
{ &ne2000_compat_device },
{ &ne2000_device },
{ &pcnet_am79c960_eb_device },
{ &rtl8019as_pnp_device },
/* MCA */
{ &ethernext_mc_device },
{ &wd8003eta_device },
{ &wd8003ea_device },
{ &wd8013epa_device },
/* VLB */
{ &pcnet_am79c960_vlb_device },
/* PCI */
{ &pcnet_am79c973_device },
{ &pcnet_am79c970a_device },
{ &dec_tulip_21140_device },
{ &dec_tulip_21040_device },
{ &dec_tulip_device },
{ &dec_tulip_21140_vpc_device },
{ &rtl8029as_device },
{ &rtl8139c_plus_device },
{ &dec_tulip_21140_device },
{ &dec_tulip_21140_vpc_device },
{ &dec_tulip_21040_device },
{ &pcnet_am79c960_vlb_device },
{ &modem_device },
{ NULL }
// clang-format on
};
@@ -430,7 +439,8 @@ network_rx_queue(void *priv)
bool activity = rx_bytes || tx_bytes;
bool led_on = card->led_timer & 0x80000000;
if ((activity && !led_on) || (card->led_timer & 0x7fffffff) >= 150000) {
ui_sb_update_icon(SB_NETWORK | card->card_num, activity);
ui_sb_update_icon(SB_NETWORK | card->card_num, !!(rx_bytes));
ui_sb_update_icon_write(SB_NETWORK | card->card_num, !!(tx_bytes));
card->led_timer = 0 | (activity << 31);
}
@@ -505,7 +515,7 @@ network_attach(void *card_drv, uint8_t *mac, NETRXCB rx, NETSETLINKSTATE set_lin
if(net_cards_conf[net_card_current].net_type != NET_TYPE_NONE) {
// We're here because of a failure
swprintf(tempmsg, sizeof_w(tempmsg), L"%ls:<br /><br />%s<br /><br />%ls", plat_get_string(STRING_NET_ERROR), net_drv_error, plat_get_string(STRING_NET_ERROR_DESC));
swprintf(tempmsg, sizeof_w(tempmsg), L"%ls:\n\n%s\n\n%ls", plat_get_string(STRING_NET_ERROR), net_drv_error, plat_get_string(STRING_NET_ERROR_DESC));
ui_msgbox(MBX_ERROR, tempmsg);
net_cards_conf[net_card_current].net_type = NET_TYPE_NONE;
}
@@ -581,6 +591,7 @@ void
network_reset(void)
{
ui_sb_update_icon(SB_NETWORK, 0);
ui_sb_update_icon_write(SB_NETWORK, 0);
#ifdef ENABLE_NETWORK_LOG
network_dump_mutex = thread_create_mutex();
@@ -647,6 +658,43 @@ network_rx_put(netcard_t *card, uint8_t *bufp, int len)
return ret;
}
int
network_rx_on_tx_popv(netcard_t *card, netpkt_t *pkt_vec, int vec_size)
{
int pkt_count = 0;
netqueue_t *queue = &card->queues[NET_QUEUE_RX_ON_TX];
for (int i = 0; i < vec_size; i++) {
if (!network_queue_get_swap(queue, pkt_vec))
break;
network_dump_packet(pkt_vec);
pkt_count++;
pkt_vec++;
}
return pkt_count;
}
int
network_rx_on_tx_put(netcard_t *card, uint8_t *bufp, int len)
{
int ret = 0;
ret = network_queue_put(&card->queues[NET_QUEUE_RX_ON_TX], bufp, len);
return ret;
}
int
network_rx_on_tx_put_pkt(netcard_t *card, netpkt_t *pkt)
{
int ret = 0;
ret = network_queue_put_swap(&card->queues[NET_QUEUE_RX_ON_TX], pkt);
return ret;
}
int
network_rx_put_pkt(netcard_t *card, netpkt_t *pkt)
{