2012-12-06 11:15:58 +00:00
|
|
|
#ifndef HW_PCNET_H
|
|
|
|
#define HW_PCNET_H 1
|
|
|
|
|
2009-10-21 13:25:33 +00:00
|
|
|
#define PCNET_IOPORT_SIZE 0x20
|
|
|
|
#define PCNET_PNPMMIO_SIZE 0x20
|
|
|
|
|
|
|
|
#define PCNET_LOOPTEST_CRC 1
|
|
|
|
#define PCNET_LOOPTEST_NOCRC 2
|
|
|
|
|
2012-12-17 17:19:49 +00:00
|
|
|
#include "exec/memory.h"
|
2009-10-21 13:25:33 +00:00
|
|
|
|
2011-09-26 17:01:44 +00:00
|
|
|
/* BUS CONFIGURATION REGISTERS */
|
|
|
|
#define BCR_MSRDA 0
|
|
|
|
#define BCR_MSWRA 1
|
|
|
|
#define BCR_MC 2
|
|
|
|
#define BCR_LNKST 4
|
|
|
|
#define BCR_LED1 5
|
|
|
|
#define BCR_LED2 6
|
|
|
|
#define BCR_LED3 7
|
|
|
|
#define BCR_FDC 9
|
|
|
|
#define BCR_BSBC 18
|
|
|
|
#define BCR_EECAS 19
|
|
|
|
#define BCR_SWS 20
|
|
|
|
#define BCR_PLAT 22
|
|
|
|
|
2012-02-29 14:37:43 +00:00
|
|
|
#define BCR_TMAULOOP(S) !!((S)->bcr[BCR_MC ] & 0x4000)
|
2011-09-26 17:01:44 +00:00
|
|
|
#define BCR_APROMWE(S) !!((S)->bcr[BCR_MC ] & 0x0100)
|
|
|
|
#define BCR_DWIO(S) !!((S)->bcr[BCR_BSBC] & 0x0080)
|
|
|
|
#define BCR_SSIZE32(S) !!((S)->bcr[BCR_SWS ] & 0x0100)
|
|
|
|
#define BCR_SWSTYLE(S) ((S)->bcr[BCR_SWS ] & 0x00FF)
|
|
|
|
|
2009-10-21 13:25:33 +00:00
|
|
|
typedef struct PCNetState_st PCNetState;
|
|
|
|
|
|
|
|
struct PCNetState_st {
|
2009-11-25 18:49:15 +00:00
|
|
|
NICState *nic;
|
2009-10-21 13:25:33 +00:00
|
|
|
NICConf conf;
|
|
|
|
QEMUTimer *poll_timer;
|
|
|
|
int rap, isr, lnkst;
|
|
|
|
uint32_t rdra, tdra;
|
|
|
|
uint8_t prom[16];
|
|
|
|
uint16_t csr[128];
|
|
|
|
uint16_t bcr[32];
|
pcnet: avoid structure holes spotted by pahole
Edited report from pahole on amd64 host:
struct PCNetState_st {
...
uint16_t bcr[32]; /* 340 64 */
/* XXX 4 bytes hole, try to pack */
...
int tx_busy; /* 4520 4 */
/* XXX 4 bytes hole, try to pack */
qemu_irq irq; /* 4528 8 */
void (*phys_mem_read)(void *, target_phys_addr_t, uint8_t *, int, int); /* 4536 8 */
/* --- cacheline 71 boundary (4544 bytes) --- */
void (*phys_mem_write)(void *, target_phys_addr_t, uint8_t *, int, int); /* 4544 8 */
void * dma_opaque; /* 4552 8 */
int looptest; /* 4560 4 */
/* size: 4568, cachelines: 72 */
/* sum members: 4556, holes: 2, sum holes: 8 */
/* padding: 4 */
/* last cacheline: 24 bytes */
}; /* definitions: 2 */
Fix by rearranging the structure to avoid padding.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-07 19:38:49 +00:00
|
|
|
int xmit_pos;
|
2009-10-21 13:25:33 +00:00
|
|
|
uint64_t timer;
|
2011-08-08 13:09:19 +00:00
|
|
|
MemoryRegion mmio;
|
2009-10-21 13:25:33 +00:00
|
|
|
uint8_t buffer[4096];
|
|
|
|
qemu_irq irq;
|
2012-10-23 10:30:10 +00:00
|
|
|
void (*phys_mem_read)(void *dma_opaque, hwaddr addr,
|
2009-10-21 13:25:33 +00:00
|
|
|
uint8_t *buf, int len, int do_bswap);
|
2012-10-23 10:30:10 +00:00
|
|
|
void (*phys_mem_write)(void *dma_opaque, hwaddr addr,
|
2009-10-21 13:25:33 +00:00
|
|
|
uint8_t *buf, int len, int do_bswap);
|
|
|
|
void *dma_opaque;
|
pcnet: avoid structure holes spotted by pahole
Edited report from pahole on amd64 host:
struct PCNetState_st {
...
uint16_t bcr[32]; /* 340 64 */
/* XXX 4 bytes hole, try to pack */
...
int tx_busy; /* 4520 4 */
/* XXX 4 bytes hole, try to pack */
qemu_irq irq; /* 4528 8 */
void (*phys_mem_read)(void *, target_phys_addr_t, uint8_t *, int, int); /* 4536 8 */
/* --- cacheline 71 boundary (4544 bytes) --- */
void (*phys_mem_write)(void *, target_phys_addr_t, uint8_t *, int, int); /* 4544 8 */
void * dma_opaque; /* 4552 8 */
int looptest; /* 4560 4 */
/* size: 4568, cachelines: 72 */
/* sum members: 4556, holes: 2, sum holes: 8 */
/* padding: 4 */
/* last cacheline: 24 bytes */
}; /* definitions: 2 */
Fix by rearranging the structure to avoid padding.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-07 19:38:49 +00:00
|
|
|
int tx_busy;
|
2009-10-21 13:25:33 +00:00
|
|
|
int looptest;
|
|
|
|
};
|
|
|
|
|
|
|
|
void pcnet_h_reset(void *opaque);
|
|
|
|
void pcnet_ioport_writew(void *opaque, uint32_t addr, uint32_t val);
|
|
|
|
uint32_t pcnet_ioport_readw(void *opaque, uint32_t addr);
|
2010-11-27 11:23:34 +00:00
|
|
|
void pcnet_ioport_writel(void *opaque, uint32_t addr, uint32_t val);
|
|
|
|
uint32_t pcnet_ioport_readl(void *opaque, uint32_t addr);
|
|
|
|
uint32_t pcnet_bcr_readw(PCNetState *s, uint32_t rap);
|
2012-07-24 15:35:13 +00:00
|
|
|
int pcnet_can_receive(NetClientState *nc);
|
|
|
|
ssize_t pcnet_receive(NetClientState *nc, const uint8_t *buf, size_t size_);
|
|
|
|
void pcnet_set_link_status(NetClientState *nc);
|
2009-10-21 13:25:33 +00:00
|
|
|
void pcnet_common_cleanup(PCNetState *d);
|
2009-11-25 18:49:15 +00:00
|
|
|
int pcnet_common_init(DeviceState *dev, PCNetState *s, NetClientInfo *info);
|
2009-10-19 16:02:13 +00:00
|
|
|
extern const VMStateDescription vmstate_pcnet;
|
2012-12-06 11:15:58 +00:00
|
|
|
|
|
|
|
#endif
|