iPXE
|
#include <ipxe/dma.h>
Go to the source code of this file.
Data Structures | |
struct | virtio_pci_cap |
struct | virtio_pci_notify_cap |
struct | virtio_pci_cfg_cap |
struct | virtio_pci_common_cfg |
struct | virtio_pci_region |
struct | virtio_pci_modern_device |
#define VIRTIO_PCI_HOST_FEATURES 0 |
Definition at line 7 of file virtio-pci.h.
#define VIRTIO_PCI_GUEST_FEATURES 4 |
Definition at line 10 of file virtio-pci.h.
#define VIRTIO_PCI_QUEUE_PFN 8 |
Definition at line 13 of file virtio-pci.h.
#define VIRTIO_PCI_QUEUE_NUM 12 |
Definition at line 16 of file virtio-pci.h.
#define VIRTIO_PCI_QUEUE_SEL 14 |
Definition at line 19 of file virtio-pci.h.
#define VIRTIO_PCI_QUEUE_NOTIFY 16 |
Definition at line 22 of file virtio-pci.h.
#define VIRTIO_PCI_STATUS 18 |
Definition at line 25 of file virtio-pci.h.
#define VIRTIO_PCI_ISR 19 |
Definition at line 30 of file virtio-pci.h.
#define VIRTIO_PCI_ISR_CONFIG 0x2 |
Definition at line 33 of file virtio-pci.h.
#define VIRTIO_PCI_CONFIG 20 |
Definition at line 37 of file virtio-pci.h.
#define VIRTIO_PCI_ABI_VERSION 0 |
Definition at line 40 of file virtio-pci.h.
#define VIRTIO_PCI_CAP_COMMON_CFG 1 /* Common configuration */ |
Definition at line 43 of file virtio-pci.h.
#define VIRTIO_PCI_CAP_NOTIFY_CFG 2 /* Notifications */ |
Definition at line 44 of file virtio-pci.h.
#define VIRTIO_PCI_CAP_ISR_CFG 3 /* ISR access */ |
Definition at line 45 of file virtio-pci.h.
#define VIRTIO_PCI_CAP_DEVICE_CFG 4 /* Device specific configuration */ |
Definition at line 46 of file virtio-pci.h.
#define VIRTIO_PCI_CAP_PCI_CFG 5 /* PCI configuration access */ |
Definition at line 47 of file virtio-pci.h.
#define __u8 uint8_t |
Definition at line 49 of file virtio-pci.h.
Definition at line 50 of file virtio-pci.h.
Definition at line 51 of file virtio-pci.h.
Definition at line 52 of file virtio-pci.h.
#define VIRTIO_PCI_REGION_TYPE_MASK 0x00000003 |
Definition at line 110 of file virtio-pci.h.
#define VIRTIO_PCI_REGION_MEMORY 0x00000001 |
Definition at line 112 of file virtio-pci.h.
#define VIRTIO_PCI_REGION_PORT 0x00000002 |
Definition at line 114 of file virtio-pci.h.
#define VIRTIO_PCI_REGION_PCI_CONFIG 0x00000003 |
Definition at line 116 of file virtio-pci.h.
#define COMMON_OFFSET | ( | field | ) | offsetof(struct virtio_pci_common_cfg, field) |
Definition at line 239 of file virtio-pci.h.
|
inlinestatic |
Definition at line 140 of file virtio-pci.h.
References inl(), ioaddr, and VIRTIO_PCI_HOST_FEATURES.
Referenced by virtnet_open_legacy(), and virtnet_probe_legacy().
|
inlinestatic |
Definition at line 145 of file virtio-pci.h.
References features, ioaddr, outl, and VIRTIO_PCI_GUEST_FEATURES.
Referenced by virtnet_open_legacy().
|
inlinestatic |
Definition at line 150 of file virtio-pci.h.
References inb(), ioaddr, len, offset, and VIRTIO_PCI_CONFIG.
Referenced by virtnet_probe_legacy().
|
inlinestatic |
|
inlinestatic |
Definition at line 165 of file virtio-pci.h.
References ioaddr, outb, status, and VIRTIO_PCI_STATUS.
Referenced by virtnet_open_legacy().
|
inlinestatic |
Definition at line 172 of file virtio-pci.h.
References inb(), ioaddr, and VIRTIO_PCI_ISR.
Referenced by virtnet_poll().
|
inlinestatic |
Definition at line 177 of file virtio-pci.h.
References inb(), ioaddr, outb, VIRTIO_PCI_ISR, and VIRTIO_PCI_STATUS.
Referenced by virtnet_close(), virtnet_open_legacy(), and virtnet_probe_legacy().
|
inlinestatic |
Definition at line 183 of file virtio-pci.h.
References ioaddr, outw, and VIRTIO_PCI_QUEUE_NOTIFY.
Referenced by vring_kick().
|
inlinestatic |
Definition at line 188 of file virtio-pci.h.
References ioaddr, outl, outw, VIRTIO_PCI_QUEUE_PFN, and VIRTIO_PCI_QUEUE_SEL.
void vp_free_vq | ( | struct vring_virtqueue * | vq | ) |
Definition at line 48 of file virtio-pci.c.
References dma_free(), vring_virtqueue::map, NULL, vring_virtqueue::queue, vring_virtqueue::queue_size, and vring_virtqueue::vdata.
Referenced by virtnet_free_virtqueues().
int vp_find_vq | ( | unsigned int | ioaddr, |
int | queue_index, | ||
struct vring_virtqueue * | vq, | ||
struct dma_device * | dma_dev, | ||
size_t | header_size | ||
) |
Definition at line 58 of file virtio-pci.c.
References DBG, vring::desc, vring_virtqueue::dma, dma(), inl(), inw(), ioaddr, vring_virtqueue::map, num, outl, outw, PAGE_SHIFT, vring_virtqueue::queue, vring_virtqueue::queue_index, rc, VIRTIO_PCI_QUEUE_NUM, VIRTIO_PCI_QUEUE_PFN, VIRTIO_PCI_QUEUE_SEL, vp_alloc_vq(), vring_virtqueue::vring, and vring_init().
Referenced by virtnet_open_legacy().
void vpm_iowrite8 | ( | struct virtio_pci_modern_device * | vdev, |
struct virtio_pci_region * | region, | ||
u8 | data, | ||
size_t | offset | ||
) |
Definition at line 119 of file virtio-pci.c.
References assert(), virtio_pci_region::base, CFG_POS, data, virtio_pci_region::flags, offset, outb, virtio_pci_modern_device::pci, pci_write_config_byte(), prep_pci_cfg_cap(), VIRTIO_PCI_REGION_MEMORY, VIRTIO_PCI_REGION_PCI_CONFIG, VIRTIO_PCI_REGION_PORT, VIRTIO_PCI_REGION_TYPE_MASK, and writeb().
Referenced by vpm_add_status(), and vpm_reset().
void vpm_iowrite16 | ( | struct virtio_pci_modern_device * | vdev, |
struct virtio_pci_region * | region, | ||
u16 | data, | ||
size_t | offset | ||
) |
Definition at line 139 of file virtio-pci.c.
References assert(), virtio_pci_region::base, CFG_POS, cpu_to_le16, data, virtio_pci_region::flags, offset, outw, virtio_pci_modern_device::pci, pci_write_config_word(), prep_pci_cfg_cap(), VIRTIO_PCI_REGION_MEMORY, VIRTIO_PCI_REGION_PCI_CONFIG, VIRTIO_PCI_REGION_PORT, VIRTIO_PCI_REGION_TYPE_MASK, and writew.
Referenced by vpm_find_vqs(), and vpm_notify().
void vpm_iowrite32 | ( | struct virtio_pci_modern_device * | vdev, |
struct virtio_pci_region * | region, | ||
u32 | data, | ||
size_t | offset | ||
) |
Definition at line 160 of file virtio-pci.c.
References assert(), virtio_pci_region::base, CFG_POS, cpu_to_le32, data, virtio_pci_region::flags, offset, outl, virtio_pci_modern_device::pci, pci_write_config_dword(), prep_pci_cfg_cap(), VIRTIO_PCI_REGION_MEMORY, VIRTIO_PCI_REGION_PCI_CONFIG, VIRTIO_PCI_REGION_PORT, VIRTIO_PCI_REGION_TYPE_MASK, and writel().
Referenced by vpm_get_features(), vpm_iowrite64(), and vpm_set_features().
|
inlinestatic |
Definition at line 220 of file virtio-pci.h.
References data, and vpm_iowrite32().
Referenced by vpm_find_vqs().
u8 vpm_ioread8 | ( | struct virtio_pci_modern_device * | vdev, |
struct virtio_pci_region * | region, | ||
size_t | offset | ||
) |
Definition at line 181 of file virtio-pci.c.
References assert(), virtio_pci_region::base, CFG_POS, data, virtio_pci_region::flags, inb(), offset, virtio_pci_modern_device::pci, pci_read_config_byte(), prep_pci_cfg_cap(), readb(), VIRTIO_PCI_REGION_MEMORY, VIRTIO_PCI_REGION_PCI_CONFIG, VIRTIO_PCI_REGION_PORT, and VIRTIO_PCI_REGION_TYPE_MASK.
Referenced by vpm_add_status(), vpm_get(), vpm_get_isr(), vpm_get_status(), and vpm_reset().
u16 vpm_ioread16 | ( | struct virtio_pci_modern_device * | vdev, |
struct virtio_pci_region * | region, | ||
size_t | offset | ||
) |
Definition at line 204 of file virtio-pci.c.
References assert(), virtio_pci_region::base, CFG_POS, data, virtio_pci_region::flags, inw(), le16_to_cpu, offset, virtio_pci_modern_device::pci, pci_read_config_word(), prep_pci_cfg_cap(), readw(), VIRTIO_PCI_REGION_MEMORY, VIRTIO_PCI_REGION_PCI_CONFIG, VIRTIO_PCI_REGION_PORT, and VIRTIO_PCI_REGION_TYPE_MASK.
Referenced by vpm_find_vqs().
u32 vpm_ioread32 | ( | struct virtio_pci_modern_device * | vdev, |
struct virtio_pci_region * | region, | ||
size_t | offset | ||
) |
Definition at line 227 of file virtio-pci.c.
References assert(), virtio_pci_region::base, CFG_POS, data, virtio_pci_region::flags, inl(), le32_to_cpu, offset, virtio_pci_modern_device::pci, pci_read_config_dword(), prep_pci_cfg_cap(), readl(), VIRTIO_PCI_REGION_MEMORY, VIRTIO_PCI_REGION_PCI_CONFIG, VIRTIO_PCI_REGION_PORT, and VIRTIO_PCI_REGION_TYPE_MASK.
Referenced by vpm_get_features().
|
inlinestatic |
Definition at line 241 of file virtio-pci.h.
References virtio_pci_modern_device::common, COMMON_OFFSET, mdelay(), vpm_ioread8(), and vpm_iowrite8().
Referenced by virtnet_close(), and virtnet_probe_modern().
|
inlinestatic |
Definition at line 248 of file virtio-pci.h.
References virtio_pci_modern_device::common, COMMON_OFFSET, and vpm_ioread8().
Referenced by virtnet_open_modern().
|
inlinestatic |
Definition at line 253 of file virtio-pci.h.
References virtio_pci_modern_device::common, COMMON_OFFSET, status, vpm_ioread8(), and vpm_iowrite8().
Referenced by virtnet_open_modern(), and virtnet_probe_modern().
|
inlinestatic |
Definition at line 261 of file virtio-pci.h.
References virtio_pci_modern_device::common, COMMON_OFFSET, vpm_ioread32(), and vpm_iowrite32().
Referenced by virtnet_open_modern(), and virtnet_probe_modern().
|
inlinestatic |
Definition at line 273 of file virtio-pci.h.
References virtio_pci_modern_device::common, COMMON_OFFSET, features, u32, and vpm_iowrite32().
Referenced by virtnet_open_modern().
|
inlinestatic |
Definition at line 285 of file virtio-pci.h.
References virtio_pci_modern_device::device, len, offset, and vpm_ioread8().
Referenced by virtnet_probe_modern().
|
inlinestatic |
Definition at line 295 of file virtio-pci.h.
References virtio_pci_modern_device::isr, and vpm_ioread8().
Referenced by virtnet_poll().
void vpm_notify | ( | struct virtio_pci_modern_device * | vdev, |
struct vring_virtqueue * | vq | ||
) |
Definition at line 354 of file virtio-pci.c.
References vring_virtqueue::notification, vring_virtqueue::queue_index, and vpm_iowrite16().
Referenced by vring_kick().
int vpm_find_vqs | ( | struct virtio_pci_modern_device * | vdev, |
unsigned | nvqs, | ||
struct vring_virtqueue * | vqs, | ||
struct dma_device * | dma_dev, | ||
size_t | header_size | ||
) |
Definition at line 360 of file virtio-pci.c.
References vring::avail, virtio_pci_modern_device::common, COMMON_OFFSET, DBG, vring::desc, vring_virtqueue::dma, dma(), EINVAL, ENOENT, vring_virtqueue::map, MAX_QUEUE_NUM, vring_virtqueue::notification, virtio_pci_modern_device::notify_cap_pos, offsetof, virtio_pci_modern_device::pci, pci_read_config_dword(), vring_virtqueue::queue, vring_virtqueue::queue_index, vring_virtqueue::queue_size, size, vring::used, virtio_pci_map_capability(), vp_alloc_vq(), vpm_ioread16(), vpm_iowrite16(), vpm_iowrite64(), vring_virtqueue::vring, and vring_init().
Referenced by virtnet_open_modern().
int virtio_pci_find_capability | ( | struct pci_device * | pci, |
uint8_t | cfg_type | ||
) |
Definition at line 250 of file virtio-pci.c.
References offsetof, PCI_CAP_ID_VNDR, pci_find_capability(), pci_find_next_capability(), pci_read_config_byte(), and type.
Referenced by virtnet_probe_modern().
int virtio_pci_map_capability | ( | struct pci_device * | pci, |
int | cap, | ||
size_t | minlen, | ||
u32 | align, | ||
u32 | start, | ||
u32 | size, | ||
struct virtio_pci_region * | region | ||
) |
Definition at line 276 of file virtio-pci.c.
References align, virtio_pci_region::bar, virtio_pci_region::base, base, DBG, EINVAL, virtio_pci_region::flags, length, virtio_pci_region::length, NULL, offset, offsetof, pci_bar_size(), pci_bar_start(), PCI_BASE_ADDRESS, PCI_BASE_ADDRESS_SPACE_IO, pci_ioremap(), pci_read_config_byte(), pci_read_config_dword(), size, start, VIRTIO_PCI_REGION_MEMORY, VIRTIO_PCI_REGION_PCI_CONFIG, and VIRTIO_PCI_REGION_PORT.
Referenced by virtnet_probe_modern(), and vpm_find_vqs().
void virtio_pci_unmap_capability | ( | struct virtio_pci_region * | region | ) |
Definition at line 346 of file virtio-pci.c.
References virtio_pci_region::base, virtio_pci_region::flags, iounmap(), VIRTIO_PCI_REGION_MEMORY, and VIRTIO_PCI_REGION_TYPE_MASK.
Referenced by virtnet_free_virtqueues(), virtnet_probe_modern(), and virtnet_remove().