|
XenevaOS
|
#include <pcie.h>#include <Hal/AA64/aa64lowlevel.h>#include <Hal/AA64/gic.h>#include <Fs/Dev/devinput.h>#include <Fs/vfs.h>#include <Drivers/virtio.h>#include <Drivers/uart.h>#include <Mm/pmmngr.h>#include <Mm/kmalloc.h>#include <aucon.h>#include <Mm/vmmngr.h>#include <Hal/AA64/sched.h>#include <Net/aunet.h>#include <Net/ethernet.h>#include <string.h>
Classes | |
| struct | VirtioNetCfg |
Macros | |
| #define | VIRTIO_F_VERSION_1 (1ull << 32) |
| #define | RX_BUFFER_COUNT 8 |
| #define | TX_BUFFER_COUNT 8 |
| #define | TX_BUFFER_SIZE 2048 |
| #define | RX_BUFFER_SIZE 2048 |
| #define | VIRTIO_PCI_CAP_ID 0x09 |
| #define | VIRTIO_PCI_CAP_COMMON_CFG 1 |
| #define | VIRTIO_PCI_CAP_DEVICE_CFG 4 |
| #define | MAKE_IP(a, b, c, d) ((uint32_t)(d) << 24 | (uint32_t)(c) << 16 | (uint32_t)(b) << 8 | (uint32_t)(a)) |
Functions | |
| void | AuVirtioNetHandler (int spiNum) |
| AuVirtioNetHandler – interrupt handler for virtio-net-dev. | |
| void | AuVirtioNetNotifyQueue (struct VirtioCommonCfg *cfg, uint16_t queueIdx) |
| AuVirtioNetNotifyQueue – notify queue. | |
| void | AuVirtioNetRxinitialize (struct VirtioCommonCfg *common) |
| AuVirtioNetRxInitialize – initialize rx queue. | |
| void | AuVirtioNetTxinitialize (struct VirtioCommonCfg *common) |
| AuVirtioNetTxInitialize – initialize tx queue. | |
| void | AuVirtioNetInitialize (uint64_t device) |
| AuVirtioNetInitialize – initialize the virtio network device. | |
| AU_EXTERN AU_EXPORT int | AuDriverUnload () |
| AU_EXTERN AU_EXPORT int | AuDriverMain () |
Variables | |
| struct VirtioQueue * | rxqueue |
| struct VirtioQueue * | txqueue |
| volatile uint8_t * | notifyBase |
| uint32_t | notifyOffMultiplier |
| #define MAKE_IP | ( | a, | |
| b, | |||
| c, | |||
| d | |||
| ) | ((uint32_t)(d) << 24 | (uint32_t)(c) << 16 | (uint32_t)(b) << 8 | (uint32_t)(a)) |
| #define RX_BUFFER_COUNT 8 |
| #define RX_BUFFER_SIZE 2048 |
| #define TX_BUFFER_COUNT 8 |
| #define TX_BUFFER_SIZE 2048 |
| #define VIRTIO_F_VERSION_1 (1ull << 32) |
| #define VIRTIO_PCI_CAP_COMMON_CFG 1 |
| #define VIRTIO_PCI_CAP_DEVICE_CFG 4 |
| #define VIRTIO_PCI_CAP_ID 0x09 |
| void AuVirtioNetHandler | ( | int | spiNum | ) |
AuVirtioNetHandler – interrupt handler for virtio-net-dev.
| spiNum | – shared peripheral interrupt number passed by system |
| void AuVirtioNetInitialize | ( | uint64_t | device | ) |
AuVirtioNetInitialize – initialize the virtio network device.
| device | – device address passed by PCIe |
feature negotiation
enable RX+TX queue
| void AuVirtioNetNotifyQueue | ( | struct VirtioCommonCfg * | cfg, |
| uint16_t | queueIdx | ||
| ) |
AuVirtioNetNotifyQueue – notify queue.
| cfg | – Pointer to common queue |
| queueIdx | – queue number, zero – rx queue, one – tx queue |
| void AuVirtioNetRxinitialize | ( | struct VirtioCommonCfg * | common | ) |
AuVirtioNetRxInitialize – initialize rx queue.
| common | – pointer to virtio common config |
| void AuVirtioNetTxinitialize | ( | struct VirtioCommonCfg * | common | ) |
AuVirtioNetTxInitialize – initialize tx queue.
| common | – pointer to virtio common config |
| volatile uint8_t* notifyBase |
| uint32_t notifyOffMultiplier |
| struct VirtioQueue* rxqueue |
| struct VirtioQueue* txqueue |