52 |
52 |
SysBusDevice busdev;
|
53 |
53 |
qemu_irq irq;
|
54 |
54 |
VLANClientState *vc;
|
|
55 |
NICConf conf;
|
55 |
56 |
|
56 |
57 |
uint32_t c_tx_pingpong;
|
57 |
58 |
uint32_t c_rx_pingpong;
|
58 |
59 |
unsigned int txbuf;
|
59 |
60 |
unsigned int rxbuf;
|
60 |
61 |
|
61 |
|
uint8_t macaddr[6];
|
62 |
62 |
uint32_t regs[R_MAX];
|
63 |
63 |
};
|
64 |
64 |
|
... | ... | |
125 |
125 |
if (s->regs[base + R_TX_CTRL0] & CTRL_I)
|
126 |
126 |
eth_pulse_irq(s);
|
127 |
127 |
} else if ((value & (CTRL_P | CTRL_S)) == (CTRL_P | CTRL_S)) {
|
128 |
|
memcpy(&s->macaddr[0], &s->regs[base], 6);
|
|
128 |
memcpy(&s->conf.macaddr.a[0], &s->regs[base], 6);
|
129 |
129 |
if (s->regs[base + R_TX_CTRL0] & CTRL_I)
|
130 |
130 |
eth_pulse_irq(s);
|
131 |
131 |
}
|
... | ... | |
175 |
175 |
int i;
|
176 |
176 |
|
177 |
177 |
/* DA filter. */
|
178 |
|
if (!(buf[0] & 0x80) && memcmp(&s->macaddr[0], buf, 6))
|
|
178 |
if (!(buf[0] & 0x80) && memcmp(&s->conf.macaddr.a[0], buf, 6))
|
179 |
179 |
return size;
|
180 |
180 |
|
181 |
181 |
if (s->regs[rxbase + R_RX_CTRL0] & CTRL_S) {
|
... | ... | |
204 |
204 |
static void eth_cleanup(VLANClientState *vc)
|
205 |
205 |
{
|
206 |
206 |
struct xlx_ethlite *s = vc->opaque;
|
207 |
|
qemu_free(s);
|
|
207 |
|
|
208 |
s->vc = NULL;
|
208 |
209 |
}
|
209 |
210 |
|
210 |
211 |
static int xilinx_ethlite_init(SysBusDevice *dev)
|
... | ... | |
218 |
219 |
regs = cpu_register_io_memory(eth_read, eth_write, s);
|
219 |
220 |
sysbus_init_mmio(dev, R_MAX * 4, regs);
|
220 |
221 |
|
221 |
|
qdev_get_macaddr(&dev->qdev, s->macaddr);
|
222 |
|
s->vc = qdev_get_vlan_client(&dev->qdev,
|
223 |
|
eth_can_rx, eth_rx, NULL, eth_cleanup, s);
|
|
222 |
qemu_macaddr_default_if_unset(&s->conf.macaddr);
|
|
223 |
s->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC,
|
|
224 |
s->conf.vlan, s->conf.peer,
|
|
225 |
dev->qdev.info->name, dev->qdev.id,
|
|
226 |
eth_can_rx, eth_rx, NULL,
|
|
227 |
NULL, eth_cleanup, s);
|
|
228 |
qemu_format_nic_info_str(s->vc, s->conf.macaddr.a);
|
224 |
229 |
return 0;
|
225 |
230 |
}
|
226 |
231 |
|
... | ... | |
231 |
236 |
.qdev.props = (Property[]) {
|
232 |
237 |
DEFINE_PROP_UINT32("txpingpong", struct xlx_ethlite, c_tx_pingpong, 1),
|
233 |
238 |
DEFINE_PROP_UINT32("rxpingpong", struct xlx_ethlite, c_rx_pingpong, 1),
|
|
239 |
DEFINE_NIC_PROPERTIES(struct xlx_ethlite, conf),
|
234 |
240 |
DEFINE_PROP_END_OF_LIST(),
|
235 |
241 |
}
|
236 |
242 |
};
|