Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / tests / qtest / libqos / e1000e.h
blob30643c80949580975c99927565f47e05a4d59f9e
1 /*
2 * libqos driver framework
4 * Copyright (c) 2018 Emanuele Giuseppe Esposito <e.emanuelegiuseppe@gmail.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License version 2.1 as published by the Free Software Foundation.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>
19 #ifndef QGRAPH_E1000E_H
20 #define QGRAPH_E1000E_H
22 #include "qgraph.h"
23 #include "pci.h"
25 #define E1000E_RX0_MSG_ID (0)
26 #define E1000E_TX0_MSG_ID (1)
28 #define E1000E_ADDRESS { 0x52, 0x54, 0x00, 0x12, 0x34, 0x56 }
30 typedef struct QE1000E QE1000E;
31 typedef struct QE1000E_PCI QE1000E_PCI;
33 struct QE1000E {
34 uint64_t tx_ring;
35 uint64_t rx_ring;
38 struct QE1000E_PCI {
39 QOSGraphObject obj;
40 QPCIDevice pci_dev;
41 QPCIBar mac_regs;
42 QE1000E e1000e;
45 static inline void e1000e_macreg_write(QE1000E *d, uint32_t reg, uint32_t val)
47 QE1000E_PCI *d_pci = container_of(d, QE1000E_PCI, e1000e);
48 qpci_io_writel(&d_pci->pci_dev, d_pci->mac_regs, reg, val);
51 static inline uint32_t e1000e_macreg_read(QE1000E *d, uint32_t reg)
53 QE1000E_PCI *d_pci = container_of(d, QE1000E_PCI, e1000e);
54 return qpci_io_readl(&d_pci->pci_dev, d_pci->mac_regs, reg);
57 void e1000e_wait_isr(QE1000E *d, uint16_t msg_id);
58 void e1000e_tx_ring_push(QE1000E *d, void *descr);
59 void e1000e_rx_ring_push(QE1000E *d, void *descr);
61 #endif