diff options
author | Laurent Vivier <Laurent.Vivier@bull.net> | 2008-11-19 17:28:27 +0100 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2008-11-19 19:51:38 +0000 |
commit | d3d8f20626f9cdbf3f2dd5af4fea6a9e601b240f (patch) | |
tree | e4017ce0734e97a062535c3889894f18e9e1e335 /src/include | |
parent | fc49421c7ed4ae636fd0d93ef999b6b89907f451 (diff) | |
download | ipxe-d3d8f20626f9cdbf3f2dd5af4fea6a9e601b240f.tar.gz |
[virtio] Remove dependency on nic for virtio PCI functions
Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gpxe/virtio-pci.h | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/include/gpxe/virtio-pci.h b/src/include/gpxe/virtio-pci.h index ba0604d5..3fe1a801 100644 --- a/src/include/gpxe/virtio-pci.h +++ b/src/include/gpxe/virtio-pci.h @@ -37,58 +37,58 @@ /* Virtio ABI version, this must match exactly */ #define VIRTIO_PCI_ABI_VERSION 0 -static inline u32 vp_get_features(struct nic *nic) +static inline u32 vp_get_features(unsigned int ioaddr) { - return inl(nic->ioaddr + VIRTIO_PCI_HOST_FEATURES); + return inl(ioaddr + VIRTIO_PCI_HOST_FEATURES); } -static inline void vp_set_features(struct nic *nic, u32 features) +static inline void vp_set_features(unsigned int ioaddr, u32 features) { - outl(features, nic->ioaddr + VIRTIO_PCI_GUEST_FEATURES); + outl(features, ioaddr + VIRTIO_PCI_GUEST_FEATURES); } -static inline void vp_get(struct nic *nic, unsigned offset, +static inline void vp_get(unsigned int ioaddr, unsigned offset, void *buf, unsigned len) { u8 *ptr = buf; unsigned i; for (i = 0; i < len; i++) - ptr[i] = inb(nic->ioaddr + VIRTIO_PCI_CONFIG + offset + i); + ptr[i] = inb(ioaddr + VIRTIO_PCI_CONFIG + offset + i); } -static inline u8 vp_get_status(struct nic *nic) +static inline u8 vp_get_status(unsigned int ioaddr) { - return inb(nic->ioaddr + VIRTIO_PCI_STATUS); + return inb(ioaddr + VIRTIO_PCI_STATUS); } -static inline void vp_set_status(struct nic *nic, u8 status) +static inline void vp_set_status(unsigned int ioaddr, u8 status) { if (status == 0) /* reset */ return; - outb(status, nic->ioaddr + VIRTIO_PCI_STATUS); + outb(status, ioaddr + VIRTIO_PCI_STATUS); } -static inline void vp_reset(struct nic *nic) +static inline void vp_reset(unsigned int ioaddr) { - outb(0, nic->ioaddr + VIRTIO_PCI_STATUS); - (void)inb(nic->ioaddr + VIRTIO_PCI_ISR); + outb(0, ioaddr + VIRTIO_PCI_STATUS); + (void)inb(ioaddr + VIRTIO_PCI_ISR); } -static inline void vp_notify(struct nic *nic, int queue_index) +static inline void vp_notify(unsigned int ioaddr, int queue_index) { - outw(queue_index, nic->ioaddr + VIRTIO_PCI_QUEUE_NOTIFY); + outw(queue_index, ioaddr + VIRTIO_PCI_QUEUE_NOTIFY); } -static inline void vp_del_vq(struct nic *nic, int queue_index) +static inline void vp_del_vq(unsigned int ioaddr, int queue_index) { /* select the queue */ - outw(queue_index, nic->ioaddr + VIRTIO_PCI_QUEUE_SEL); + outw(queue_index, ioaddr + VIRTIO_PCI_QUEUE_SEL); /* deactivate the queue */ - outl(0, nic->ioaddr + VIRTIO_PCI_QUEUE_PFN); + outl(0, ioaddr + VIRTIO_PCI_QUEUE_PFN); } #endif /* _VIRTIO_PCI_H_ */ |