More sonarlint work

This commit is contained in:
Jasmine Iwanek
2023-06-09 23:46:54 -04:00
parent 0d1d069af4
commit ee695e71f9
218 changed files with 6282 additions and 3845 deletions

View File

@@ -58,6 +58,7 @@
#include <86box/network.h>
#include <86box/net_3c501.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) */
#define ELNK_MAX_LINKDOWN_REPORTED 3
@@ -192,7 +193,7 @@ typedef struct ELNK_INTR_STAT {
uint8_t unused : 5;
} EL_INTR_STAT;
typedef struct {
typedef struct threec501_t {
uint32_t base_address;
int base_irq;
uint32_t bios_addr;
@@ -390,6 +391,7 @@ padr_bcast(threec501_t *dev, const uint8_t *buf)
static uint8_t aBCAST[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
struct ether_header *hdr = (struct ether_header *) buf;
int result = (dev->RcvCmd.adr_match == EL_ADRM_BCAST) && !memcmp(hdr->ether_dhost, aBCAST, 6);
return result;
}
@@ -401,6 +403,7 @@ padr_mcast(threec501_t *dev, const uint8_t *buf)
{
struct ether_header *hdr = (struct ether_header *) buf;
int result = (dev->RcvCmd.adr_match == EL_ADRM_MCAST) && ETHER_IS_MULTICAST(hdr->ether_dhost);
return result;
}
@@ -692,7 +695,6 @@ elnkAsyncTransmit(threec501_t *dev)
#ifdef ENABLE_3COM501_LOG
threec501_log("3Com501: illegal giant frame (%u bytes) -> signalling error\n", cb);
#endif
;
}
} else {
/* Signal a transmit error pretending there was a collision. */
@@ -921,6 +923,9 @@ threec501_read(uint16_t addr, void *priv)
retval = dev->abPacketBuf[ELNK_GP(dev)];
dev->uGPBufPtr = (dev->uGPBufPtr + 1) & ELNK_GP_MASK;
break;
default:
break;
}
elnkUpdateIrq(dev);
@@ -1007,6 +1012,9 @@ threec501_write(uint16_t addr, uint8_t value, void *priv)
dev->abPacketBuf[ELNK_GP(dev)] = value;
dev->uGPBufPtr = (dev->uGPBufPtr + 1) & ELNK_GP_MASK;
break;
default:
break;
}
#ifdef ENABLE_3COM501_LOG
@@ -1068,7 +1076,7 @@ elnkR3TimerRestore(void *priv)
}
static void *
threec501_nic_init(const device_t *info)
threec501_nic_init(UNUSED(const device_t *info))
{
uint32_t mac;
threec501_t *dev;

View File

@@ -62,8 +62,9 @@
#include <86box/net_dp8390.h>
#include <86box/net_3c503.h>
#include <86box/bswap.h>
#include <86box/plat_unused.h>
typedef struct {
typedef struct threec503_t {
dp8390_t *dp8390;
mem_mapping_t ram_mapping;
uint32_t base_address;
@@ -129,6 +130,9 @@ threec503_interrupt(void *priv, int set)
case 5:
dev->regs.idcfr = 0x80;
break;
default:
break;
}
if (set)
@@ -174,6 +178,9 @@ threec503_set_drq(threec503_t *dev)
case 3:
dev->regs.idcfr = 4;
break;
default:
break;
}
}
@@ -223,6 +230,9 @@ threec503_nic_lo_read(uint16_t addr, void *priv)
case 0x03:
retval = 0xff;
break;
default:
break;
}
break;
@@ -237,6 +247,9 @@ threec503_nic_lo_read(uint16_t addr, void *priv)
case 0x03:
retval = 0xff;
break;
default:
break;
}
return retval;
@@ -272,6 +285,9 @@ threec503_nic_lo_write(uint16_t addr, uint8_t val, void *priv)
case 0x03:
break;
default:
break;
}
break;
@@ -279,6 +295,9 @@ threec503_nic_lo_write(uint16_t addr, uint8_t val, void *priv)
case 0x02:
case 0x03:
break;
default:
break;
}
threec503_log("3Com503: write addr %x, value %x\n", addr, val);
@@ -338,7 +357,6 @@ threec503_nic_hi_read(uint16_t addr, void *priv)
}
return dev->regs.bcfr;
break;
case 0x04:
switch (dev->bios_addr) {
@@ -357,10 +375,12 @@ threec503_nic_hi_read(uint16_t addr, void *priv)
case 0xc8000:
dev->regs.pcfr = 0x10;
break;
default:
break;
}
return dev->regs.pcfr;
break;
case 0x05:
return dev->regs.gacfr;
@@ -397,6 +417,9 @@ threec503_nic_hi_read(uint16_t addr, void *priv)
threec503_set_drq(dev);
return dp8390_chipmem_read(dev->dp8390, dev->regs.da++, 1);
default:
break;
}
return 0;
@@ -527,6 +550,9 @@ threec503_nic_hi_write(uint16_t addr, uint8_t val, void *priv)
dp8390_chipmem_write(dev->dp8390, dev->regs.da++, val, 1);
break;
default:
break;
}
}
@@ -543,7 +569,7 @@ threec503_nic_ioset(threec503_t *dev, uint16_t addr)
}
static void *
threec503_nic_init(const device_t *info)
threec503_nic_init(UNUSED(const device_t *info))
{
uint32_t mac;
threec503_t *dev;
@@ -605,7 +631,9 @@ threec503_nic_init(const device_t *info)
threec503_ram_read, NULL, NULL,
threec503_ram_write, NULL, NULL,
NULL, MEM_MAPPING_EXTERNAL, dev);
// mem_mapping_disable(&dev->ram_mapping);
#if 0
mem_mapping_disable(&dev->ram_mapping);
#endif
dev->regs.gacfr = 0x09; /* Start with RAM mapping enabled. */
/* Attach ourselves to the network module. */

View File

@@ -29,6 +29,7 @@
#include <86box/timer.h>
#include <86box/network.h>
#include <86box/net_dp8390.h>
#include <86box/plat_unused.h>
static void dp8390_tx(dp8390_t *dev, uint32_t val);
static int dp8390_rx_common(void *priv, uint8_t *buf, int io_len);
@@ -242,7 +243,7 @@ dp8390_write_cr(dp8390_t *dev, uint32_t val)
}
static void
dp8390_tx(dp8390_t *dev, uint32_t val)
dp8390_tx(dp8390_t *dev, UNUSED(uint32_t val))
{
dev->CR.tx_packet = 0;
dev->TSR.tx_ok = 1;
@@ -506,7 +507,7 @@ dp8390_page0_read(dp8390_t *dev, uint32_t off, unsigned int len)
}
void
dp8390_page0_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len)
dp8390_page0_write(dp8390_t *dev, uint32_t off, uint32_t val, UNUSED(unsigned len))
{
uint8_t val2;
@@ -697,7 +698,7 @@ dp8390_page0_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len)
/* Handle reads/writes to the first page of the DS8390 register file. */
uint32_t
dp8390_page1_read(dp8390_t *dev, uint32_t off, unsigned int len)
dp8390_page1_read(dp8390_t *dev, uint32_t off, UNUSED(unsigned int len))
{
dp8390_log("DP8390: Page1 read from register 0x%02x, len=%u\n",
off, len);
@@ -734,7 +735,7 @@ dp8390_page1_read(dp8390_t *dev, uint32_t off, unsigned int len)
}
void
dp8390_page1_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len)
dp8390_page1_write(dp8390_t *dev, uint32_t off, uint32_t val, UNUSED(unsigned len))
{
dp8390_log("DP8390: Page1 write to register 0x%02x, len=%u, value=0x%04x\n",
off, len, val);
@@ -778,7 +779,7 @@ dp8390_page1_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len)
/* Handle reads/writes to the second page of the DS8390 register file. */
uint32_t
dp8390_page2_read(dp8390_t *dev, uint32_t off, unsigned int len)
dp8390_page2_read(dp8390_t *dev, uint32_t off, UNUSED(unsigned int len))
{
dp8390_log("DP8390: Page2 read from register 0x%02x, len=%u\n",
off, len);
@@ -835,7 +836,7 @@ dp8390_page2_read(dp8390_t *dev, uint32_t off, unsigned int len)
}
void
dp8390_page2_write(dp8390_t *dev, uint32_t off, uint32_t val, unsigned len)
dp8390_page2_write(dp8390_t *dev, uint32_t off, uint32_t val, UNUSED(unsigned len))
{
/* Maybe all writes here should be BX_PANIC()'d, since they
affect internal operation, but let them through for now
@@ -999,7 +1000,7 @@ dp8390_soft_reset(dp8390_t *dev)
}
static void *
dp8390_init(const device_t *info)
dp8390_init(UNUSED(const device_t *info))
{
dp8390_t *dp8390 = (dp8390_t *) malloc(sizeof(dp8390_t));
memset(dp8390, 0, sizeof(dp8390_t));

View File

@@ -7,6 +7,7 @@
#endif
#include <86box/net_event.h>
#include <86box/plat_unused.h>
#ifndef _WIN32
static void
@@ -40,7 +41,7 @@ net_event_set(net_evt_t *event)
}
void
net_event_clear(net_evt_t *event)
net_event_clear(UNUSED(net_evt_t *event))
{
#ifdef _WIN32
/* Do nothing on WIN32 since we use an auto-reset event */

View File

@@ -68,6 +68,7 @@
#include <86box/net_ne2000.h>
#include <86box/bswap.h>
#include <86box/isapnp.h>
#include <86box/plat_unused.h>
/* ROM BIOS file paths. */
#define ROM_PATH_NE1000 "roms/network/ne1000/ne1000.rom"
@@ -93,28 +94,33 @@ static uint8_t rtl8019as_pnp_rom[] = {
0x79, 0x00 /* end tag, dummy checksum (filled in by isapnp_add_card) */
};
typedef struct {
typedef struct nic_t {
dp8390_t *dp8390;
const char *name;
int board;
int is_pci, is_mca, is_8bit;
int is_pci;
int is_mca;
int is_8bit;
uint32_t base_address;
int base_irq;
uint32_t bios_addr,
bios_size,
bios_mask;
int card; /* PCI card slot */
int has_bios, pad;
bar_t pci_bar[2];
uint8_t pci_regs[PCI_REGSIZE];
uint8_t eeprom[128]; /* for RTL8029AS */
rom_t bios_rom;
void *pnp_card;
uint8_t pnp_csnsav;
uint8_t maclocal[6]; /* configured MAC (local) address */
uint32_t bios_addr;
uint32_t bios_size;
uint32_t bios_mask;
int card; /* PCI card slot */
int has_bios;
int pad;
bar_t pci_bar[2];
uint8_t pci_regs[PCI_REGSIZE];
uint8_t eeprom[128]; /* for RTL8029AS */
rom_t bios_rom;
void *pnp_card;
uint8_t pnp_csnsav;
uint8_t maclocal[6]; /* configured MAC (local) address */
/* RTL8019AS/RTL8029AS registers */
uint8_t config0, config2, config3;
uint8_t config0;
uint8_t config2;
uint8_t config3;
uint8_t _9346cr;
uint32_t pad0;
@@ -308,7 +314,7 @@ asic_write(nic_t *dev, uint32_t off, uint32_t val, unsigned len)
/* Writes to this page are illegal. */
static uint32_t
page3_read(nic_t *dev, uint32_t off, unsigned int len)
page3_read(nic_t *dev, uint32_t off, UNUSED(unsigned int len))
{
if (dev->board >= NE2K_RTL8019AS)
switch (off) {
@@ -346,7 +352,7 @@ page3_read(nic_t *dev, uint32_t off, unsigned int len)
}
static void
page3_write(nic_t *dev, uint32_t off, uint32_t val, unsigned len)
page3_write(nic_t *dev, uint32_t off, uint32_t val, UNUSED(unsigned len))
{
if (dev->board >= NE2K_RTL8019AS) {
nelog(3, "%s: Page2 write to register 0x%02x, len=%u, value=0x%04x\n",
@@ -535,6 +541,9 @@ nic_pnp_read_vendor_reg(uint8_t ld, uint8_t reg, void *priv)
case 0xF5:
return dev->pnp_csnsav;
default:
break;
}
return 0x00;
@@ -623,7 +632,7 @@ nic_update_bios(nic_t *dev)
}
static uint8_t
nic_pci_read(int func, int addr, void *priv)
nic_pci_read(UNUSED(int func), int addr, void *priv)
{
nic_t *dev = (nic_t *) priv;
uint8_t ret = 0x00;
@@ -707,6 +716,9 @@ nic_pci_read(int func, int addr, void *priv)
case 0x3D: /* PCI_IPR */
ret = dev->pci_regs[addr];
break;
default:
break;
}
nelog(2, "%s: PCI_Read(%d, %04x) = %02x\n", dev->name, func, addr, ret);
@@ -715,7 +727,7 @@ nic_pci_read(int func, int addr, void *priv)
}
static void
nic_pci_write(int func, int addr, uint8_t val, void *priv)
nic_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv)
{
nic_t *dev = (nic_t *) priv;
uint8_t valxor;
@@ -737,7 +749,7 @@ nic_pci_write(int func, int addr, uint8_t val, void *priv)
case 0x10: /* PCI_BAR */
val &= 0xe0; /* 0xe0 acc to RTL DS */
val |= 0x01; /* re-enable IOIN bit */
/*FALLTHROUGH*/
[[fallthrough]];
case 0x11: /* PCI_BAR */
case 0x12: /* PCI_BAR */
@@ -767,7 +779,9 @@ nic_pci_write(int func, int addr, uint8_t val, void *priv)
case 0x32: /* PCI_ROMBAR */
case 0x33: /* PCI_ROMBAR */
dev->pci_bar[1].addr_regs[addr & 3] = val;
/* dev->pci_bar[1].addr_regs[1] &= dev->bios_mask; */
#if 0
dev->pci_bar[1].addr_regs[1] &= dev->bios_mask;
#endif
dev->pci_bar[1].addr &= 0xffff8001;
dev->bios_addr = dev->pci_bar[1].addr & 0xffff8000;
nic_update_bios(dev);
@@ -778,6 +792,9 @@ nic_pci_write(int func, int addr, uint8_t val, void *priv)
dev->base_irq = val;
dev->pci_regs[addr] = dev->base_irq;
return;
default:
break;
}
}
@@ -1000,6 +1017,9 @@ nic_init(const device_t *info)
dp8390_set_id(dev->dp8390, 0x50, (dev->board == NE2K_RTL8019AS) ? 0x70 : 0x43);
dp8390_mem_alloc(dev->dp8390, 0x4000, 0x8000);
break;
default:
break;
}
memcpy(dev->dp8390->physaddr, dev->maclocal, sizeof(dev->maclocal));

View File

@@ -37,6 +37,7 @@
#include <86box/timer.h>
#include <86box/network.h>
#include <86box/net_event.h>
#include <86box/plat_unused.h>
enum {
NET_EVENT_STOP = 0,
@@ -53,7 +54,7 @@ enum {
#define NULL_PKT_BATCH NET_QUEUE_LEN
typedef struct {
typedef struct net_null_t {
uint8_t mac_addr[6];
netcard_t *card;
thread_t *poll_tid;
@@ -158,7 +159,7 @@ net_null_thread(void *priv)
#endif
void *
net_null_init(const netcard_t *card, const uint8_t *mac_addr, void *priv, char *netdrv_errbuf)
net_null_init(const netcard_t *card, const uint8_t *mac_addr, UNUSED(void *priv), UNUSED(char *netdrv_errbuf))
{
net_null_log("Null Network: Init\n");

View File

@@ -247,7 +247,7 @@ net_pcap_in(void *pcap, uint8_t *bufp, int len)
if (pcap == NULL)
return;
f_pcap_sendpacket((void *) pcap, bufp, len);
f_pcap_sendpacket(pcap, bufp, len);
}
void
@@ -268,7 +268,7 @@ net_pcap_thread(void *priv)
HANDLE events[NET_EVENT_MAX];
events[NET_EVENT_STOP] = net_event_get_handle(&pcap->stop_event);
events[NET_EVENT_TX] = net_event_get_handle(&pcap->tx_event);
events[NET_EVENT_RX] = f_pcap_getevent((void *) pcap->pcap);
events[NET_EVENT_RX] = f_pcap_getevent(pcap->pcap);
bool run = true;
@@ -296,6 +296,9 @@ net_pcap_thread(void *priv)
case NET_EVENT_RX:
f_pcap_dispatch(pcap->pcap, PCAP_PKT_BATCH, net_pcap_rx_handler, (u_char *) pcap);
break;
default:
break;
}
}
@@ -467,22 +470,22 @@ net_pcap_init(const netcard_t *card, const uint8_t *mac_addr, void *priv, char *
return NULL;
}
if (f_pcap_setnonblock((void *) pcap->pcap, 1, errbuf) != 0)
if (f_pcap_setnonblock(pcap->pcap, 1, errbuf) != 0)
pcap_log("PCAP: failed nonblock %s\n", errbuf);
if (f_pcap_set_immediate_mode((void *) pcap->pcap, 1) != 0)
if (f_pcap_set_immediate_mode(pcap->pcap, 1) != 0)
pcap_log("PCAP: error setting immediate mode\n");
if (f_pcap_set_promisc((void *) pcap->pcap, 1) != 0)
if (f_pcap_set_promisc(pcap->pcap, 1) != 0)
pcap_log("PCAP: error enabling promiscuous mode\n");
if (f_pcap_set_snaplen((void *) pcap->pcap, NET_MAX_FRAME) != 0)
if (f_pcap_set_snaplen(pcap->pcap, NET_MAX_FRAME) != 0)
pcap_log("PCAP: error setting snaplen\n");
if (f_pcap_activate((void *) pcap->pcap) != 0) {
if (f_pcap_activate(pcap->pcap) != 0) {
snprintf(errbuf_prep, NET_DRV_ERRBUF_SIZE, "%s", (char *)f_pcap_geterr(pcap->pcap));
net_pcap_error(netdrv_errbuf, errbuf_prep);
f_pcap_close((void *) pcap->pcap);
f_pcap_close(pcap->pcap);
free(pcap);
return NULL;
}
@@ -494,18 +497,18 @@ net_pcap_init(const netcard_t *card, const uint8_t *mac_addr, void *priv, char *
"( ((ether dst ff:ff:ff:ff:ff:ff) or (ether dst %02x:%02x:%02x:%02x:%02x:%02x)) and not (ether src %02x:%02x:%02x:%02x:%02x:%02x) )",
mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5],
mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
if (f_pcap_compile((void *) pcap->pcap, &fp, filter_exp, 0, 0xffffffff) != -1) {
if (f_pcap_setfilter((void *) pcap->pcap, &fp) != 0) {
if (f_pcap_compile(pcap->pcap, &fp, filter_exp, 0, 0xffffffff) != -1) {
if (f_pcap_setfilter(pcap->pcap, &fp) != 0) {
snprintf(errbuf_prep, NET_DRV_ERRBUF_SIZE, "Error installing filter (%s)\n", filter_exp);
net_pcap_error(netdrv_errbuf, errbuf_prep);
f_pcap_close((void *) pcap->pcap);
f_pcap_close(pcap->pcap);
free(pcap);
return NULL;
}
} else {
snprintf(errbuf_prep, NET_DRV_ERRBUF_SIZE, "Could not compile filter (%s) : %s!\n", filter_exp, (char *)f_pcap_geterr((void *) pcap->pcap));
snprintf(errbuf_prep, NET_DRV_ERRBUF_SIZE, "Could not compile filter (%s) : %s!\n", filter_exp, (char *)f_pcap_geterr(pcap->pcap));
net_pcap_error(netdrv_errbuf, errbuf_prep);
f_pcap_close((void *) pcap->pcap);
f_pcap_close(pcap->pcap);
free(pcap);
return NULL;
}
@@ -554,7 +557,7 @@ net_pcap_close(void *priv)
f_pcap_sendqueue_destroy((void *) pcap->pcap_queue);
#endif
/* OK, now shut down Pcap itself. */
f_pcap_close((void *) pcap->pcap);
f_pcap_close(pcap->pcap);
net_event_close(&pcap->tx_event);
net_event_close(&pcap->stop_event);

View File

@@ -47,6 +47,7 @@
#include <86box/network.h>
#include <86box/net_pcnet.h>
#include <86box/bswap.h>
#include <86box/plat_unused.h>
/* PCI info. */
#define PCI_VENDID 0x1022 /* AMD */
@@ -744,11 +745,12 @@ static const uint32_t crctab[256] =
};
static __inline int
padr_match(nic_t *dev, const uint8_t *buf, int size)
padr_match(nic_t *dev, const uint8_t *buf, UNUSED(int size))
{
struct ether_header *hdr = (struct ether_header *) buf;
int result;
uint8_t padr[6];
padr[0] = dev->aCSR[12] & 0xff;
padr[1] = dev->aCSR[12] >> 8;
padr[2] = dev->aCSR[13] & 0xff;
@@ -768,19 +770,22 @@ padr_match(nic_t *dev, const uint8_t *buf, int size)
}
static __inline int
padr_bcast(nic_t *dev, const uint8_t *buf, size_t size)
padr_bcast(nic_t *dev, const uint8_t *buf, UNUSED(size_t size))
{
static uint8_t aBCAST[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
struct ether_header *hdr = (struct ether_header *) buf;
int result = !CSR_DRCVBC(dev) && !memcmp(hdr->ether_dhost, aBCAST, 6);
pcnet_log(3, "%s: padr_bcast result=%d\n", dev->name, result);
return result;
}
static int
ladr_match(nic_t *dev, const uint8_t *buf, size_t size)
ladr_match(nic_t *dev, const uint8_t *buf, UNUSED(size_t size))
{
struct ether_header *hdr = (struct ether_header *) buf;
if ((hdr->ether_dhost[0] & 0x01) && ((uint64_t *) &dev->aCSR[8])[0] != 0LL) {
int index;
uint8_t ladr[8];
@@ -861,6 +866,9 @@ pcnetSoftReset(nic_t *dev)
dev->aCSR[88] = 0x3003;
dev->aCSR[89] = 0x0262;
break;
default:
break;
}
dev->aCSR[94] = 0x0000;
@@ -1680,9 +1688,9 @@ pcnetPollRxTx(nic_t *dev)
}
static void
pcnetPollTimer(void *p)
pcnetPollTimer(void *priv)
{
nic_t *dev = (nic_t *) p;
nic_t *dev = (nic_t *) priv;
timer_advance_u64(&dev->timer, 2000 * TIMER_USEC);
@@ -2223,6 +2231,9 @@ pcnet_word_write(nic_t *dev, uint32_t addr, uint16_t val)
case 0x06:
pcnet_bcr_writew(dev, dev->u32RAP, val);
break;
default:
break;
}
}
}
@@ -2238,6 +2249,9 @@ pcnet_byte_read(nic_t *dev, uint32_t addr)
pcnetSoftReset(dev);
val = 0;
break;
default:
break;
}
}
@@ -2275,6 +2289,9 @@ pcnet_word_read(nic_t *dev, uint32_t addr)
case 0x06:
val = pcnet_bcr_readw(dev, dev->u32RAP);
break;
default:
break;
}
}
@@ -2302,6 +2319,9 @@ pcnet_dword_write(nic_t *dev, uint32_t addr, uint32_t val)
case 0x0c:
pcnet_bcr_writew(dev, dev->u32RAP, val & 0xffff);
break;
default:
break;
}
} else if ((addr & 0x0f) == 0) {
/* switch device to dword i/o mode */
@@ -2334,6 +2354,9 @@ pcnet_dword_read(nic_t *dev, uint32_t addr)
case 0x0c:
val = pcnet_bcr_readw(dev, dev->u32RAP);
break;
default:
break;
}
}
@@ -2540,9 +2563,9 @@ pcnet_ioset(nic_t *dev, uint16_t addr, int len)
}
static void
pcnet_pci_write(int func, int addr, uint8_t val, void *p)
pcnet_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv)
{
nic_t *dev = (nic_t *) p;
nic_t *dev = (nic_t *) priv;
uint8_t valxor;
pcnet_log(4, "%s: Write value %02X to register %02X\n", dev->name, val, addr & 0xff);
@@ -2616,13 +2639,16 @@ pcnet_pci_write(int func, int addr, uint8_t val, void *p)
dev->base_irq = val;
pcnet_pci_regs[addr] = val;
return;
default:
break;
}
}
static uint8_t
pcnet_pci_read(int func, int addr, void *p)
pcnet_pci_read(UNUSED(int func), int addr, void *priv)
{
nic_t *dev = (nic_t *) p;
nic_t *dev = (nic_t *) priv;
pcnet_log(4, "%s: Read to register %02X\n", dev->name, addr & 0xff);
@@ -2687,6 +2713,9 @@ pcnet_pci_read(int func, int addr, void *p)
return 0x06;
case 0x3F:
return 0xff;
default:
break;
}
return 0;

View File

@@ -35,6 +35,7 @@
#include <86box/timer.h>
#include <86box/network.h>
#include <86box/net_plip.h>
#include <86box/plat_unused.h>
enum {
PLIP_START = 0x00,
@@ -57,20 +58,28 @@ enum {
PLIP_END = 0x40
};
typedef struct
{
typedef struct plip_t {
uint8_t mac[6];
void *lpt;
pc_timer_t rx_timer;
pc_timer_t timeout_timer;
uint8_t status, ctrl;
uint8_t status;
uint8_t ctrl;
uint8_t state, ack, tx_checksum, tx_checksum_calc, *tx_pkt;
uint16_t tx_len, tx_ptr;
uint8_t state;
uint8_t ack;
uint8_t tx_checksum;
uint8_t tx_checksum_calc;
uint8_t *tx_pkt;
uint16_t tx_len;
uint16_t tx_ptr;
uint8_t *rx_pkt, rx_checksum, rx_return_state;
uint16_t rx_len, rx_ptr;
uint8_t *rx_pkt;
uint8_t rx_checksum;
uint8_t rx_return_state;
uint16_t rx_len;
uint16_t rx_ptr;
netcard_t *card;
} plip_t;
@@ -334,6 +343,9 @@ plip_write_data(uint8_t val, void *priv)
/* Disengage timeout timer. */
timer_disable(&dev->timeout_timer);
return;
default:
break;
}
/* Engage timeout timer unless otherwise specified. */
@@ -454,7 +466,7 @@ plip_lpt_init(void *lpt)
}
static void *
plip_net_init(const device_t *info)
plip_net_init(UNUSED(const device_t *info))
{
plip_log(1, "PLIP: net_init()");

View File

@@ -58,7 +58,7 @@ enum {
NET_EVENT_MAX
};
typedef struct {
typedef struct net_slirp_t {
Slirp *slirp;
uint8_t mac_addr[6];
netcard_t *card; /* netcard attached to us */
@@ -68,9 +68,10 @@ typedef struct {
netpkt_t pkt;
netpkt_t pkt_tx_v[SLIRP_PKT_BATCH];
#ifdef _WIN32
HANDLE sock_event;
HANDLE sock_event;
#else
uint32_t pfd_len, pfd_size;
uint32_t pfd_len;
uint32_t pfd_size;
struct pollfd *pfd;
#endif
} net_slirp_t;
@@ -94,19 +95,19 @@ slirp_log(const char *fmt, ...)
#endif
static void
net_slirp_guest_error(const char *msg, void *opaque)
net_slirp_guest_error(UNUSED(const char *msg), UNUSED(void *opaque))
{
slirp_log("SLiRP: guest_error(): %s\n", msg);
}
static int64_t
net_slirp_clock_get_ns(void *opaque)
net_slirp_clock_get_ns(UNUSED(void *opaque))
{
return (int64_t) ((double) tsc / cpuclock * 1000000000.0);
}
static void *
net_slirp_timer_new(SlirpTimerCb cb, void *cb_opaque, void *opaque)
net_slirp_timer_new(SlirpTimerCb cb, void *cb_opaque, UNUSED(void *opaque))
{
pc_timer_t *timer = malloc(sizeof(pc_timer_t));
timer_add(timer, cb, cb_opaque, 0);
@@ -114,14 +115,14 @@ net_slirp_timer_new(SlirpTimerCb cb, void *cb_opaque, void *opaque)
}
static void
net_slirp_timer_free(void *timer, void *opaque)
net_slirp_timer_free(void *timer, UNUSED(void *opaque))
{
timer_stop(timer);
free(timer);
}
static void
net_slirp_timer_mod(void *timer, int64_t expire_timer, void *opaque)
net_slirp_timer_mod(void *timer, int64_t expire_timer, UNUSED(void *opaque))
{
timer_on_auto(timer, expire_timer * 1000);
}
@@ -384,7 +385,7 @@ static int slirp_card_num = 2;
/* Initialize SLiRP for use. */
void *
net_slirp_init(const netcard_t *card, const uint8_t *mac_addr, void *priv, char *netdrv_errbuf)
net_slirp_init(const netcard_t *card, const uint8_t *mac_addr, UNUSED(void *priv), char *netdrv_errbuf)
{
slirp_log("SLiRP: initializing...\n");
net_slirp_t *slirp = calloc(1, sizeof(net_slirp_t));

View File

@@ -62,15 +62,15 @@ static volatile void *libvde_handle = NULL;
//+
// VDE connection structure
//-
typedef struct {
void *vdeconn; // VDEPLUG Connection
netcard_t *card; // NIC linked to
thread_t *poll_tid; // Polling thread
net_evt_t tx_event; // Packets to transmit event
net_evt_t stop_event; // Stop thread event
netpkt_t pkt; // Packet read/sent
netpkt_t pktv[VDE_PKT_BATCH]; // Packet queue
uint8_t mac_addr[6]; // MAC Address
typedef struct net_vde_t {
void *vdeconn; // VDEPLUG Connection
netcard_t *card; // NIC linked to
thread_t *poll_tid; // Polling thread
net_evt_t tx_event; // Packets to transmit event
net_evt_t stop_event; // Stop thread event
netpkt_t pkt; // Packet read/sent
netpkt_t pktv[VDE_PKT_BATCH]; // Packet queue
uint8_t mac_addr[6]; // MAC Address
} net_vde_t;
//+
@@ -221,7 +221,7 @@ void net_vde_close(void *priv) {
free(vde->pktv[i].data);
}
free(vde->pkt.data);
f_vde_close((void *) vde->vdeconn);
f_vde_close(vde->vdeconn);
net_event_close(&vde->tx_event);
net_event_close(&vde->stop_event);
free(vde);

View File

@@ -64,6 +64,7 @@
#include <86box/net_dp8390.h>
#include <86box/net_wd8003.h>
#include <86box/bswap.h>
#include <86box/plat_unused.h>
#include "cpu.h"
@@ -98,12 +99,14 @@
#define WE_ID_EXTRA_RAM 0x40
#define WE_ID_BUS_MCA 0x80
typedef struct {
typedef struct wd_t {
dp8390_t *dp8390;
mem_mapping_t ram_mapping;
uint32_t ram_addr, ram_size;
uint32_t ram_addr;
uint32_t ram_size;
uint8_t maclocal[6]; /* configured MAC (local) address */
uint8_t bit16, pad;
uint8_t bit16;
uint8_t pad;
int board;
const char *name;
uint32_t base_address;
@@ -113,11 +116,12 @@ typedef struct {
uint8_t pos_regs[8];
/* Memory for WD cards*/
uint8_t msr, /* Memory Select Register (MSR) */
icr, /* Interface Configuration Register (ICR) */
irr, /* Interrupt Request Register (IRR) */
laar, /* LA Address Register (read by Windows 98!) */
if_chip, board_chip;
uint8_t msr; /* Memory Select Register (MSR) */
uint8_t icr; /* Interface Configuration Register (ICR) */
uint8_t irr; /* Interrupt Request Register (IRR) */
uint8_t laar; /* LA Address Register (read by Windows 98!) */
uint8_t if_chip;
uint8_t board_chip;
} wd_t;
#ifdef ENABLE_WD_LOG
@@ -280,6 +284,9 @@ wd_smc_read(wd_t *dev, uint32_t off)
retval = 0xff - (checksum & 0xff);
break;
default:
break;
}
wdlog("%s: ASIC read addr=0x%02x, value=0x%04x\n",
@@ -602,6 +609,9 @@ wd_8013epa_mca_write(int port, uint8_t val, void *priv)
case 0x0c:
dev->irq = 14;
break;
default:
break;
}
if (dev->pos_regs[3] & 0x10)
@@ -629,7 +639,7 @@ wd_8013epa_mca_write(int port, uint8_t val, void *priv)
}
static uint8_t
wd_mca_feedb(void *priv)
wd_mca_feedb(UNUSED(void *priv))
{
return 1;
}
@@ -724,6 +734,7 @@ wd_init(const device_t *info)
/* Ethernet, MCA, 5x3 interface chip, RAM 16k */
case WD8003EA:
dev->board_chip = WE_ID_SOFT_CONFIG;
[[fallthrough]];
/* Ethernet, MCA, no interface chip, RAM 16k */
case WD8003ETA:
dev->board_chip |= WE_TYPE_WD8013EBT | WE_ID_BUS_MCA;
@@ -740,6 +751,9 @@ wd_init(const device_t *info)
dev->pos_regs[1] = 0x61;
dev->bit16 = 3;
break;
default:
break;
}
dev->irr |= WE_IRR_ENABLE_IRQ;