xref: /openbmc/qemu/tests/qtest/libqos/e1000e.h (revision 1cf4323e)
1*1cf4323eSThomas Huth /*
2*1cf4323eSThomas Huth  * libqos driver framework
3*1cf4323eSThomas Huth  *
4*1cf4323eSThomas Huth  * Copyright (c) 2018 Emanuele Giuseppe Esposito <e.emanuelegiuseppe@gmail.com>
5*1cf4323eSThomas Huth  *
6*1cf4323eSThomas Huth  * This library is free software; you can redistribute it and/or
7*1cf4323eSThomas Huth  * modify it under the terms of the GNU Lesser General Public
8*1cf4323eSThomas Huth  * License version 2 as published by the Free Software Foundation.
9*1cf4323eSThomas Huth  *
10*1cf4323eSThomas Huth  * This library is distributed in the hope that it will be useful,
11*1cf4323eSThomas Huth  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*1cf4323eSThomas Huth  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13*1cf4323eSThomas Huth  * Lesser General Public License for more details.
14*1cf4323eSThomas Huth  *
15*1cf4323eSThomas Huth  * You should have received a copy of the GNU Lesser General Public
16*1cf4323eSThomas Huth  * License along with this library; if not, see <http://www.gnu.org/licenses/>
17*1cf4323eSThomas Huth  */
18*1cf4323eSThomas Huth 
19*1cf4323eSThomas Huth #ifndef QGRAPH_E1000E_H
20*1cf4323eSThomas Huth #define QGRAPH_E1000E_H
21*1cf4323eSThomas Huth 
22*1cf4323eSThomas Huth #include "libqos/qgraph.h"
23*1cf4323eSThomas Huth #include "pci.h"
24*1cf4323eSThomas Huth 
25*1cf4323eSThomas Huth #define E1000E_RX0_MSG_ID           (0)
26*1cf4323eSThomas Huth #define E1000E_TX0_MSG_ID           (1)
27*1cf4323eSThomas Huth #define E1000E_OTHER_MSG_ID         (2)
28*1cf4323eSThomas Huth 
29*1cf4323eSThomas Huth #define E1000E_TDLEN    (0x3808)
30*1cf4323eSThomas Huth #define E1000E_TDT      (0x3818)
31*1cf4323eSThomas Huth #define E1000E_RDLEN    (0x2808)
32*1cf4323eSThomas Huth #define E1000E_RDT      (0x2818)
33*1cf4323eSThomas Huth 
34*1cf4323eSThomas Huth typedef struct QE1000E QE1000E;
35*1cf4323eSThomas Huth typedef struct QE1000E_PCI QE1000E_PCI;
36*1cf4323eSThomas Huth 
37*1cf4323eSThomas Huth struct QE1000E {
38*1cf4323eSThomas Huth     uint64_t tx_ring;
39*1cf4323eSThomas Huth     uint64_t rx_ring;
40*1cf4323eSThomas Huth };
41*1cf4323eSThomas Huth 
42*1cf4323eSThomas Huth struct QE1000E_PCI {
43*1cf4323eSThomas Huth     QOSGraphObject obj;
44*1cf4323eSThomas Huth     QPCIDevice pci_dev;
45*1cf4323eSThomas Huth     QPCIBar mac_regs;
46*1cf4323eSThomas Huth     QE1000E e1000e;
47*1cf4323eSThomas Huth };
48*1cf4323eSThomas Huth 
49*1cf4323eSThomas Huth void e1000e_wait_isr(QE1000E *d, uint16_t msg_id);
50*1cf4323eSThomas Huth void e1000e_tx_ring_push(QE1000E *d, void *descr);
51*1cf4323eSThomas Huth void e1000e_rx_ring_push(QE1000E *d, void *descr);
52*1cf4323eSThomas Huth 
53*1cf4323eSThomas Huth #endif
54