diff options
author | Pascal Terjan <pterjan@mandriva.org> | 2009-09-17 13:02:47 +0000 |
---|---|---|
committer | Pascal Terjan <pterjan@mandriva.org> | 2009-09-17 13:02:47 +0000 |
commit | 4cdcc4bcf4ffbca300191150e86b1b50fe3278a7 (patch) | |
tree | 571f453459c43aececd595e0e674297d22b6dc74 /mdk-stage1 | |
parent | cab732cea44dae8c2f10f5b7fc928939acf99153 (diff) | |
download | drakx-4cdcc4bcf4ffbca300191150e86b1b50fe3278a7.tar drakx-4cdcc4bcf4ffbca300191150e86b1b50fe3278a7.tar.gz drakx-4cdcc4bcf4ffbca300191150e86b1b50fe3278a7.tar.bz2 drakx-4cdcc4bcf4ffbca300191150e86b1b50fe3278a7.tar.xz drakx-4cdcc4bcf4ffbca300191150e86b1b50fe3278a7.zip |
Handle virtio
Diffstat (limited to 'mdk-stage1')
-rw-r--r-- | mdk-stage1/Makefile | 2 | ||||
-rw-r--r-- | mdk-stage1/NEWS | 3 | ||||
-rw-r--r-- | mdk-stage1/probing.c | 59 | ||||
-rw-r--r-- | mdk-stage1/probing.h | 8 | ||||
-rw-r--r-- | mdk-stage1/stage1.c | 2 |
5 files changed, 72 insertions, 2 deletions
diff --git a/mdk-stage1/Makefile b/mdk-stage1/Makefile index 9058708bf..e3076ec0b 100644 --- a/mdk-stage1/Makefile +++ b/mdk-stage1/Makefile @@ -15,7 +15,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -VERSION=1.32 +VERSION=1.32.1 PRODUCT=drakx-installer-binaries # diff --git a/mdk-stage1/NEWS b/mdk-stage1/NEWS index ebc492548..c88d6af7d 100644 --- a/mdk-stage1/NEWS +++ b/mdk-stage1/NEWS @@ -1,3 +1,6 @@ +1.32.1: +- handle virtio + 1.32: - automatically find compressed stage2 with automatic=method:disk diff --git a/mdk-stage1/probing.c b/mdk-stage1/probing.c index 9dba6e6e8..334d0f7b7 100644 --- a/mdk-stage1/probing.c +++ b/mdk-stage1/probing.c @@ -315,6 +315,58 @@ void probe_pci_modules(enum driver_type type, char **pci_modules, unsigned int pciusb_free(&entries); } +/** Loads modules for known virtio devices + * + * virtio modules are not being loaded using the PCI probing mechanism + * because pcitable.gz does not have IDs for these devices. + * + * The possible correct solution for it is to fix the script which + * generates pcitable.gz to handle the virtio_device_id structure. + */ +void probe_virtio_modules(void) +{ + struct pciusb_entries entries; + int i; + char *name; + char *options; + int loaded_pci = 0; + + entries = pci_probe(); + for (i = 0; i < entries.nb; i++) { + struct pciusb_entry *e = &entries.entries[i]; + if (e->vendor == VIRTIO_PCI_VENDOR) { + if (!loaded_pci) { + log_message("loading virtio-pci"); + my_insmod("virtio_pci", ANY_DRIVER_TYPE, NULL, 0); + loaded_pci = 1; + } + + name = NULL; + options = NULL; + + switch (e->subdevice) { + case VIRTIO_ID_NET: + name = "virtio_net"; + options = "csum=0"; + break; + case VIRTIO_ID_BLOCK: + name = "virtio_blk"; + break; + case VIRTIO_ID_BALLOON: + name = "virtio_balloon"; + break; + default: + log_message("warning: unknown virtio device %04x", e->device); + } + if (name) { + log_message("virtio: loading %s", name); + my_insmod(name, ANY_DRIVER_TYPE, options, 0); + } + } + } + pciusb_free(&entries); +} + #ifdef ENABLE_USB void probe_that_type(enum driver_type type, enum media_bus bus) #else @@ -323,6 +375,7 @@ void probe_that_type(enum driver_type type, enum media_bus bus __attribute__ ((u { static int already_probed_usb_controllers = 0; static int already_loaded_usb_scsi = 0; + static int already_probed_virtio_devices = 0; /* ---- PCI probe ---------------------------------------------- */ if (bus != BUS_USB) { @@ -352,6 +405,12 @@ void probe_that_type(enum driver_type type, enum media_bus bus __attribute__ ((u probe_pci_modules(type, usb_controller_modules, usb_controller_modules_len); break; #endif + case VIRTIO_DEVICES: + if (already_probed_virtio_devices) + break; + probe_virtio_modules(); + already_probed_virtio_devices = 1; + break; default: break; } diff --git a/mdk-stage1/probing.h b/mdk-stage1/probing.h index bb185ef95..fe427f541 100644 --- a/mdk-stage1/probing.h +++ b/mdk-stage1/probing.h @@ -24,10 +24,16 @@ enum media_type { CDROM, DISK, FLOPPY, TAPE, UNKNOWN_MEDIA }; -enum driver_type { MEDIA_ADAPTERS, NETWORK_DEVICES, USB_CONTROLLERS, ANY_DRIVER_TYPE }; +enum driver_type { MEDIA_ADAPTERS, NETWORK_DEVICES, USB_CONTROLLERS, + VIRTIO_DEVICES, ANY_DRIVER_TYPE }; enum media_bus { BUS_IDE, BUS_SCSI, BUS_USB, BUS_PCMCIA, BUS_ANY }; +#define VIRTIO_PCI_VENDOR 0x1af4 +#define VIRTIO_ID_NET 0x0001 +#define VIRTIO_ID_BLOCK 0x0002 +#define VIRTIO_ID_BALLOON 0x0005 + void find_media(enum media_bus bus); void get_medias(enum media_type media, char *** names, char *** models, enum media_bus bus); char ** get_net_devices(void); diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c index cdc207bfd..63f9d2ed2 100644 --- a/mdk-stage1/stage1.c +++ b/mdk-stage1/stage1.c @@ -413,6 +413,8 @@ int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)) init_firmware_timeout(); init_frontend("Welcome to " DISTRIB_DESCR ", " __DATE__ " " __TIME__); + probe_that_type(VIRTIO_DEVICES, BUS_ANY); + /* load usb interface as soon as possible, helps usb mouse detection in stage2 */ probe_that_type(USB_CONTROLLERS, BUS_USB); |