Permalink
Browse files

drivers: add legacy virtio-blk driver

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
  • Loading branch information...
mcayland committed Jul 31, 2016
1 parent edaca74 commit e3db36b72261d9119da52db6aaea3023eae862b2
Showing with 769 additions and 1 deletion.
  1. +1 −0 drivers/build.xml
  2. +18 −0 drivers/pci.c
  3. +1 −1 drivers/pci_database.c
  4. +1 −0 drivers/pci_database.h
  5. +413 −0 drivers/virtio.c
  6. +331 −0 drivers/virtio.h
  7. +4 −0 include/drivers/drivers.h
View
@@ -26,6 +26,7 @@
<object source="usbhid.c" condition="USB_HID"/>
<object source="usbohci.c" condition="DRIVER_USB"/>
<object source="usbohci_rh.c" condition="DRIVER_USB"/>
<object source="virtio.c" condition="DRIVER_VIRTIO_BLK"/>
</library>
<dictionary name="openbios" target="forth">
View
@@ -582,6 +582,24 @@ int rtl8139_config_cb(const pci_config_t *config)
return eth_config_cb(config);
}
int virtio_blk_config_cb(const pci_config_t *config)
{
#ifdef CONFIG_DRIVER_VIRTIO_BLK
pci_addr addr;
uint8_t idx;
addr = PCI_ADDR(
PCI_BUS(config->dev),
PCI_DEV(config->dev),
PCI_FN(config->dev));
idx = (uint8_t)(pci_config_read16(addr, PCI_DEVICE_ID) & 0xff) - 1;
ob_virtio_init(config->path, "virtio-blk", arch->io_base, config->assigned[0] & ~0x0000000F, idx);
#endif
return 0;
}
static inline void pci_decode_pci_addr(pci_addr addr, int *flags,
int *space_code, uint32_t *mask)
{
View
@@ -52,7 +52,7 @@ static const pci_dev_t scsi_devices[] = {
NULL, "virtio-blk", NULL,
"pci1af4,1001\0pci1af4,1001\0pciclass,01018f\0",
0, 0, 0,
NULL, NULL,
virtio_blk_config_cb, NULL,
},
{
0xFFFF, 0xFFFF,
View
@@ -29,6 +29,7 @@ struct pci_dev_t {
};
extern int ide_config_cb2(const pci_config_t *config);
extern int virtio_blk_config_cb(const pci_config_t *config);
extern int eth_config_cb(const pci_config_t *config);
extern int macio_heathrow_config_cb(const pci_config_t *config);
extern int macio_keylargo_config_cb(const pci_config_t *config);
Oops, something went wrong.

0 comments on commit e3db36b

Please sign in to comment.