etraxfs_eth: Rename fs_eth to ETRAXFSEthState

Also add a typedef.

Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Andreas Färber 2013-07-27 11:48:42 +02:00
parent 8784dfa4bc
commit 58076497df

View File

@ -324,9 +324,9 @@ static void mdio_cycle(struct qemu_mdio *bus)
#define TYPE_ETRAX_FS_ETH "etraxfs-eth" #define TYPE_ETRAX_FS_ETH "etraxfs-eth"
#define ETRAX_FS_ETH(obj) \ #define ETRAX_FS_ETH(obj) \
OBJECT_CHECK(struct fs_eth, (obj), TYPE_ETRAX_FS_ETH) OBJECT_CHECK(ETRAXFSEthState, (obj), TYPE_ETRAX_FS_ETH)
struct fs_eth typedef struct ETRAXFSEthState
{ {
SysBusDevice parent_obj; SysBusDevice parent_obj;
@ -354,9 +354,9 @@ struct fs_eth
/* PHY. */ /* PHY. */
struct qemu_phy phy; struct qemu_phy phy;
}; } ETRAXFSEthState;
static void eth_validate_duplex(struct fs_eth *eth) static void eth_validate_duplex(ETRAXFSEthState *eth)
{ {
struct qemu_phy *phy; struct qemu_phy *phy;
unsigned int phy_duplex; unsigned int phy_duplex;
@ -387,7 +387,7 @@ static void eth_validate_duplex(struct fs_eth *eth)
static uint64_t static uint64_t
eth_read(void *opaque, hwaddr addr, unsigned int size) eth_read(void *opaque, hwaddr addr, unsigned int size)
{ {
struct fs_eth *eth = opaque; ETRAXFSEthState *eth = opaque;
uint32_t r = 0; uint32_t r = 0;
addr >>= 2; addr >>= 2;
@ -404,7 +404,7 @@ eth_read(void *opaque, hwaddr addr, unsigned int size)
return r; return r;
} }
static void eth_update_ma(struct fs_eth *eth, int ma) static void eth_update_ma(ETRAXFSEthState *eth, int ma)
{ {
int reg; int reg;
int i = 0; int i = 0;
@ -433,7 +433,7 @@ static void
eth_write(void *opaque, hwaddr addr, eth_write(void *opaque, hwaddr addr,
uint64_t val64, unsigned int size) uint64_t val64, unsigned int size)
{ {
struct fs_eth *eth = opaque; ETRAXFSEthState *eth = opaque;
uint32_t value = val64; uint32_t value = val64;
addr >>= 2; addr >>= 2;
@ -477,7 +477,7 @@ eth_write(void *opaque, hwaddr addr,
/* The ETRAX FS has a groupt address table (GAT) which works like a k=1 bloom /* The ETRAX FS has a groupt address table (GAT) which works like a k=1 bloom
filter dropping group addresses we have not joined. The filter has 64 filter dropping group addresses we have not joined. The filter has 64
bits (m). The has function is a simple nible xor of the group addr. */ bits (m). The has function is a simple nible xor of the group addr. */
static int eth_match_groupaddr(struct fs_eth *eth, const unsigned char *sa) static int eth_match_groupaddr(ETRAXFSEthState *eth, const unsigned char *sa)
{ {
unsigned int hsh; unsigned int hsh;
int m_individual = eth->regs[RW_REC_CTRL] & 4; int m_individual = eth->regs[RW_REC_CTRL] & 4;
@ -528,7 +528,7 @@ static int eth_can_receive(NetClientState *nc)
static ssize_t eth_receive(NetClientState *nc, const uint8_t *buf, size_t size) static ssize_t eth_receive(NetClientState *nc, const uint8_t *buf, size_t size)
{ {
unsigned char sa_bcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; unsigned char sa_bcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
struct fs_eth *eth = qemu_get_nic_opaque(nc); ETRAXFSEthState *eth = qemu_get_nic_opaque(nc);
int use_ma0 = eth->regs[RW_REC_CTRL] & 1; int use_ma0 = eth->regs[RW_REC_CTRL] & 1;
int use_ma1 = eth->regs[RW_REC_CTRL] & 2; int use_ma1 = eth->regs[RW_REC_CTRL] & 2;
int r_bcast = eth->regs[RW_REC_CTRL] & 8; int r_bcast = eth->regs[RW_REC_CTRL] & 8;
@ -552,12 +552,12 @@ static ssize_t eth_receive(NetClientState *nc, const uint8_t *buf, size_t size)
/* FIXME: Find another way to pass on the fake csum. */ /* FIXME: Find another way to pass on the fake csum. */
etraxfs_dmac_input(eth->dma_in, (void *)buf, size + 4, 1); etraxfs_dmac_input(eth->dma_in, (void *)buf, size + 4, 1);
return size; return size;
} }
static int eth_tx_push(void *opaque, unsigned char *buf, int len, bool eop) static int eth_tx_push(void *opaque, unsigned char *buf, int len, bool eop)
{ {
struct fs_eth *eth = opaque; ETRAXFSEthState *eth = opaque;
D(printf("%s buf=%p len=%d\n", __func__, buf, len)); D(printf("%s buf=%p len=%d\n", __func__, buf, len));
qemu_send_packet(qemu_get_queue(eth->nic), buf, len); qemu_send_packet(qemu_get_queue(eth->nic), buf, len);
@ -566,7 +566,7 @@ static int eth_tx_push(void *opaque, unsigned char *buf, int len, bool eop)
static void eth_set_link(NetClientState *nc) static void eth_set_link(NetClientState *nc)
{ {
struct fs_eth *eth = qemu_get_nic_opaque(nc); ETRAXFSEthState *eth = qemu_get_nic_opaque(nc);
D(printf("%s %d\n", __func__, nc->link_down)); D(printf("%s %d\n", __func__, nc->link_down));
eth->phy.link = !nc->link_down; eth->phy.link = !nc->link_down;
} }
@ -583,7 +583,7 @@ static const MemoryRegionOps eth_ops = {
static void eth_cleanup(NetClientState *nc) static void eth_cleanup(NetClientState *nc)
{ {
struct fs_eth *eth = qemu_get_nic_opaque(nc); ETRAXFSEthState *eth = qemu_get_nic_opaque(nc);
/* Disconnect the client. */ /* Disconnect the client. */
eth->dma_out->client.push = NULL; eth->dma_out->client.push = NULL;
@ -605,7 +605,7 @@ static NetClientInfo net_etraxfs_info = {
static int fs_eth_init(SysBusDevice *sbd) static int fs_eth_init(SysBusDevice *sbd)
{ {
DeviceState *dev = DEVICE(sbd); DeviceState *dev = DEVICE(sbd);
struct fs_eth *s = ETRAX_FS_ETH(dev); ETRAXFSEthState *s = ETRAX_FS_ETH(dev);
if (!s->dma_out || !s->dma_in) { if (!s->dma_out || !s->dma_in) {
hw_error("Unconnected ETRAX-FS Ethernet MAC.\n"); hw_error("Unconnected ETRAX-FS Ethernet MAC.\n");
@ -632,10 +632,10 @@ static int fs_eth_init(SysBusDevice *sbd)
} }
static Property etraxfs_eth_properties[] = { static Property etraxfs_eth_properties[] = {
DEFINE_PROP_UINT32("phyaddr", struct fs_eth, phyaddr, 1), DEFINE_PROP_UINT32("phyaddr", ETRAXFSEthState, phyaddr, 1),
DEFINE_PROP_PTR("dma_out", struct fs_eth, vdma_out), DEFINE_PROP_PTR("dma_out", ETRAXFSEthState, vdma_out),
DEFINE_PROP_PTR("dma_in", struct fs_eth, vdma_in), DEFINE_PROP_PTR("dma_in", ETRAXFSEthState, vdma_in),
DEFINE_NIC_PROPERTIES(struct fs_eth, conf), DEFINE_NIC_PROPERTIES(ETRAXFSEthState, conf),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}; };
@ -651,7 +651,7 @@ static void etraxfs_eth_class_init(ObjectClass *klass, void *data)
static const TypeInfo etraxfs_eth_info = { static const TypeInfo etraxfs_eth_info = {
.name = TYPE_ETRAX_FS_ETH, .name = TYPE_ETRAX_FS_ETH,
.parent = TYPE_SYS_BUS_DEVICE, .parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(struct fs_eth), .instance_size = sizeof(ETRAXFSEthState),
.class_init = etraxfs_eth_class_init, .class_init = etraxfs_eth_class_init,
}; };