xref: /openbmc/qemu/include/hw/net/dp8393x.h (revision dbdf841b)
1 /*
2  * QEMU NS SONIC DP8393x netcard
3  *
4  * Copyright (c) 2008-2009 Herve Poussineau
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef HW_NET_DP8393X_H
21 #define HW_NET_DP8393X_H
22 
23 #include "hw/sysbus.h"
24 #include "net/net.h"
25 #include "exec/memory.h"
26 
27 #define SONIC_REG_COUNT  0x40
28 
29 #define TYPE_DP8393X "dp8393x"
30 OBJECT_DECLARE_SIMPLE_TYPE(dp8393xState, DP8393X)
31 
32 struct dp8393xState {
33     SysBusDevice parent_obj;
34 
35     /* Hardware */
36     uint8_t it_shift;
37     bool big_endian;
38     bool last_rba_is_full;
39     qemu_irq irq;
40     int irq_level;
41     QEMUTimer *watchdog;
42     int64_t wt_last_update;
43     NICConf conf;
44     NICState *nic;
45     MemoryRegion mmio;
46 
47     /* Registers */
48     uint16_t cam[16][3];
49     uint16_t regs[SONIC_REG_COUNT];
50 
51     /* Temporaries */
52     uint8_t tx_buffer[0x10000];
53     int loopback_packet;
54 
55     /* Memory access */
56     MemoryRegion *dma_mr;
57     AddressSpace as;
58 };
59 
60 #endif
61