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:
parent
8784dfa4bc
commit
58076497df
@ -324,9 +324,9 @@ static void mdio_cycle(struct qemu_mdio *bus)
|
||||
|
||||
#define TYPE_ETRAX_FS_ETH "etraxfs-eth"
|
||||
#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;
|
||||
|
||||
@ -354,9 +354,9 @@ struct fs_eth
|
||||
|
||||
/* 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;
|
||||
unsigned int phy_duplex;
|
||||
@ -387,7 +387,7 @@ static void eth_validate_duplex(struct fs_eth *eth)
|
||||
static uint64_t
|
||||
eth_read(void *opaque, hwaddr addr, unsigned int size)
|
||||
{
|
||||
struct fs_eth *eth = opaque;
|
||||
ETRAXFSEthState *eth = opaque;
|
||||
uint32_t r = 0;
|
||||
|
||||
addr >>= 2;
|
||||
@ -404,7 +404,7 @@ eth_read(void *opaque, hwaddr addr, unsigned int size)
|
||||
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 i = 0;
|
||||
@ -433,7 +433,7 @@ static void
|
||||
eth_write(void *opaque, hwaddr addr,
|
||||
uint64_t val64, unsigned int size)
|
||||
{
|
||||
struct fs_eth *eth = opaque;
|
||||
ETRAXFSEthState *eth = opaque;
|
||||
uint32_t value = val64;
|
||||
|
||||
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
|
||||
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. */
|
||||
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;
|
||||
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)
|
||||
{
|
||||
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_ma1 = eth->regs[RW_REC_CTRL] & 2;
|
||||
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. */
|
||||
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)
|
||||
{
|
||||
struct fs_eth *eth = opaque;
|
||||
ETRAXFSEthState *eth = opaque;
|
||||
|
||||
D(printf("%s buf=%p len=%d\n", __func__, 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)
|
||||
{
|
||||
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));
|
||||
eth->phy.link = !nc->link_down;
|
||||
}
|
||||
@ -583,7 +583,7 @@ static const MemoryRegionOps eth_ops = {
|
||||
|
||||
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. */
|
||||
eth->dma_out->client.push = NULL;
|
||||
@ -605,7 +605,7 @@ static NetClientInfo net_etraxfs_info = {
|
||||
static int fs_eth_init(SysBusDevice *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) {
|
||||
hw_error("Unconnected ETRAX-FS Ethernet MAC.\n");
|
||||
@ -632,10 +632,10 @@ static int fs_eth_init(SysBusDevice *sbd)
|
||||
}
|
||||
|
||||
static Property etraxfs_eth_properties[] = {
|
||||
DEFINE_PROP_UINT32("phyaddr", struct fs_eth, phyaddr, 1),
|
||||
DEFINE_PROP_PTR("dma_out", struct fs_eth, vdma_out),
|
||||
DEFINE_PROP_PTR("dma_in", struct fs_eth, vdma_in),
|
||||
DEFINE_NIC_PROPERTIES(struct fs_eth, conf),
|
||||
DEFINE_PROP_UINT32("phyaddr", ETRAXFSEthState, phyaddr, 1),
|
||||
DEFINE_PROP_PTR("dma_out", ETRAXFSEthState, vdma_out),
|
||||
DEFINE_PROP_PTR("dma_in", ETRAXFSEthState, vdma_in),
|
||||
DEFINE_NIC_PROPERTIES(ETRAXFSEthState, conf),
|
||||
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 = {
|
||||
.name = TYPE_ETRAX_FS_ETH,
|
||||
.parent = TYPE_SYS_BUS_DEVICE,
|
||||
.instance_size = sizeof(struct fs_eth),
|
||||
.instance_size = sizeof(ETRAXFSEthState),
|
||||
.class_init = etraxfs_eth_class_init,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user