Initial support for the 8-bit NE2000 compatible boards.

This commit is contained in:
Oleg Farenyuk
2024-07-14 05:52:15 +03:00
parent c728f6cbf5
commit 234d06c620
4 changed files with 120 additions and 10 deletions

View File

@@ -37,15 +37,17 @@
#define NET_NE2000_H
enum {
NE2K_NONE = 0,
NE2K_NE1000 = 1, /* 8-bit ISA NE1000 */
NE2K_NE1000_COMPAT = 2, /* 8-bit ISA NE1000-Compatible */
NE2K_NE2000 = 3, /* 16-bit ISA NE2000 */
NE2K_NE2000_COMPAT = 4, /* 16-bit ISA NE2000-Compatible */
NE2K_ETHERNEXT_MC = 5, /* 16-bit MCA EtherNext/MC */
NE2K_RTL8019AS = 6, /* 16-bit ISA PnP Realtek 8019AS */
NE2K_DE220P = 7, /* 16-bit ISA PnP D-Link DE-220P */
NE2K_RTL8029AS = 8 /* 32-bit PCI Realtek 8029AS */
NE2K_NONE = 0,
NE2K_NE1000 = 1, /* 8-bit ISA NE1000 */
NE2K_NE1000_COMPAT = 2, /* 8-bit ISA NE1000-Compatible */
NE2K_NE2000 = 3, /* 16-bit ISA NE2000 */
NE2K_NE2000_COMPAT = 4, /* 16-bit ISA NE2000-Compatible */
NE2K_NE2000_COMPAT_8BIT = 5, /* 8-bit ISA NE2000-Compatible, like: https://github.com/skiselev/isa8_eth */
NE2K_ETHERNEXT_MC = 6, /* 16-bit MCA EtherNext/MC */
NE2K_RTL8019AS = 7, /* 16-bit ISA PnP Realtek 8019AS */
NE2K_DE220P = 8, /* 16-bit ISA PnP D-Link DE-220P */
NE2K_RTL8029AS = 9, /* 32-bit PCI Realtek 8029AS */
/* Check nic_init() if adding items after this point. */
};
#endif /*NET_NE2000_H*/

View File

@@ -211,6 +211,7 @@ extern const device_t ne1000_device;
extern const device_t ne1000_compat_device;
extern const device_t ne2000_device;
extern const device_t ne2000_compat_device;
extern const device_t ne2000_compat_8bit_device;
extern const device_t ethernext_mc_device;
extern const device_t rtl8019as_device;
extern const device_t de220p_device;

View File

@@ -934,7 +934,8 @@ nic_init(const device_t *info)
if (dev->board != NE2K_ETHERNEXT_MC) {
dev->base_address = device_get_config_hex16("base");
dev->base_irq = device_get_config_int("irq");
if ((dev->board == NE2K_NE2000) || (dev->board == NE2K_NE2000_COMPAT)) {
if ((dev->board == NE2K_NE2000) || (dev->board == NE2K_NE2000_COMPAT) ||
(dev->board == NE2K_NE2000_COMPAT_8BIT) ) {
dev->bios_addr = device_get_config_hex20("bios_addr");
dev->has_bios = !!dev->bios_addr;
} else {
@@ -1008,6 +1009,16 @@ nic_init(const device_t *info)
dp8390_mem_alloc(dev->dp8390, 0x4000, 0x4000);
break;
case NE2K_NE2000_COMPAT_8BIT:
dev->maclocal[0] = 0x00; /* 00:86:B0 (86Box OID) */
dev->maclocal[1] = 0x86;
dev->maclocal[2] = 0xB0;
dev->is_8bit = 1;
rom = ROM_PATH_NE2000;
dp8390_set_defaults(dev->dp8390, DP8390_FLAG_EVEN_MAC | DP8390_FLAG_CHECK_CR | DP8390_FLAG_CLEAR_IRQ);
dp8390_mem_alloc(dev->dp8390, 0x4000, 0x4000);
break;
case NE2K_ETHERNEXT_MC:
dev->maclocal[0] = 0x00; /* 00:00:D8 (Networth Inc. OID) */
dev->maclocal[1] = 0x00;
@@ -1448,6 +1459,87 @@ static const device_config_t ne2000_compat_config[] = {
{ .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 = {
/* Source: board docs, https://github.com/skiselev/isa8_eth */
{ .description = "0x200", .value = 0x200 },
{ .description = "0x220", .value = 0x220 },
{ .description = "0x240", .value = 0x240 },
{ .description = "0x260", .value = 0x260 },
{ .description = "0x280", .value = 0x280 },
{ .description = "0x2a0", .value = 0x2a0 },
{ .description = "0x2c0", .value = 0x2c0 },
{ .description = "0x2e0", .value = 0x2e0 },
{ .description = "0x300", .value = 0x300 },
{ .description = "0x320", .value = 0x320 },
{ .description = "0x340", .value = 0x340 },
{ .description = "0x360", .value = 0x360 },
{ .description = "0x380", .value = 0x380 },
{ .description = "0x3a0", .value = 0x3a0 },
{ .description = "0x3c0", .value = 0x3c0 },
{ .description = "0x3e0", .value = 0x3e0 },
{ .description = "" }
},
},
{
.name = "irq",
.description = "IRQ",
.type = CONFIG_SELECTION,
.default_string = "",
.default_int = 3,
.file_filter = "",
.spinner = { 0 },
.selection = {
/* Source: board docs, https://github.com/skiselev/isa8_eth */
{ .description = "IRQ 2", .value = 2 },
{ .description = "IRQ 3", .value = 3 },
{ .description = "IRQ 4", .value = 4 },
{ .description = "IRQ 5", .value = 5 },
{ .description = "IRQ 9", .value = 9 },
{ .description = "" }
},
},
{
.name = "mac",
.description = "MAC Address",
.type = CONFIG_MAC,
.default_string = "",
.default_int = -1
},
{
.name = "bios_addr",
.description = "BIOS address",
.type = CONFIG_HEX20,
.default_string = "",
.default_int = 0,
.file_filter = "",
.spinner = { 0 },
.selection = {
/* Source: board docs, https://github.com/skiselev/isa8_eth */
{ .description = "Disabled", .value = 0x00000 },
{ .description = "C000", .value = 0xC0000 },
{ .description = "C400", .value = 0xC4000 },
{ .description = "C800", .value = 0xC8000 },
{ .description = "CC00", .value = 0xCC000 },
{ .description = "D000", .value = 0xD0000 },
{ .description = "D400", .value = 0xD4000 },
{ .description = "D800", .value = 0xD8000 },
{ .description = "DC00", .value = 0xDC000 },
{ .description = "" }
},
},
{ .name = "", .description = "", .type = CONFIG_END }
};
static const device_config_t rtl8019as_config[] = {
{
.name = "mac",
@@ -1545,6 +1637,20 @@ const device_t ne2000_compat_device = {
.config = ne2000_compat_config
};
const device_t ne2000_compat_8bit_device = {
.name = "NE2000 Compatible 8-bit",
.internal_name = "ne2k8",
.flags = DEVICE_ISA,
.local = NE2K_NE2000_COMPAT_8BIT,
.init = nic_init,
.close = nic_close,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = ne2000_compat_8bit_config
};
const device_t ethernext_mc_device = {
.name = "NetWorth EtherNext/MC",
.internal_name = "ethernextmc",

View File

@@ -115,6 +115,7 @@ static const device_t *net_cards[] = {
&de220p_device,
&ne1000_compat_device,
&ne2000_compat_device,
&ne2000_compat_8bit_device,
&ne1000_device,
&ne2000_device,
&pcnet_am79c960_eb_device,