diff options
author | Bogdano Arendartchuk <bogdano@mandriva.org> | 2009-08-31 17:01:39 +0000 |
---|---|---|
committer | Bogdano Arendartchuk <bogdano@mandriva.org> | 2009-08-31 17:01:39 +0000 |
commit | e67dbe7b7f1ac18ff3605c8a516779d3eb4eaf5b (patch) | |
tree | ae638c55ce9cec54f77460fbb4f27a250125fc8f /mdk-stage1 | |
parent | a99e3d7a286cbaa9724c17f877abf5bda5492e64 (diff) | |
download | drakx-backup-do-not-use-e67dbe7b7f1ac18ff3605c8a516779d3eb4eaf5b.tar drakx-backup-do-not-use-e67dbe7b7f1ac18ff3605c8a516779d3eb4eaf5b.tar.gz drakx-backup-do-not-use-e67dbe7b7f1ac18ff3605c8a516779d3eb4eaf5b.tar.bz2 drakx-backup-do-not-use-e67dbe7b7f1ac18ff3605c8a516779d3eb4eaf5b.tar.xz drakx-backup-do-not-use-e67dbe7b7f1ac18ff3605c8a516779d3eb4eaf5b.zip |
- load needed modules for known virtio devices, fixes #51804
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 | 55 | ||||
-rw-r--r-- | mdk-stage1/probing.h | 9 | ||||
-rw-r--r-- | mdk-stage1/stage1.c | 2 |
5 files changed, 69 insertions, 2 deletions
diff --git a/mdk-stage1/Makefile b/mdk-stage1/Makefile index 334511a31..067670198 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.40 +VERSION=1.41 PRODUCT=drakx-installer-binaries # diff --git a/mdk-stage1/NEWS b/mdk-stage1/NEWS index c010ca27a..55c4fa5c9 100644 --- a/mdk-stage1/NEWS +++ b/mdk-stage1/NEWS @@ -1,3 +1,6 @@ +1.41: +- load needed modules for known virtio devices, fixes #51804 + 1.39: - set uevent helper which will load firmware and do not set firmware timeout to 1 second (it will fail if firmware is not there) diff --git a/mdk-stage1/probing.c b/mdk-stage1/probing.c index 632827e34..4ca30fbe4 100644 --- a/mdk-stage1/probing.c +++ b/mdk-stage1/probing.c @@ -315,6 +315,54 @@ 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; + + entries = pci_probe(); + for (i = 0; i < entries.nb; i++) { + struct pciusb_entry *e = &entries.entries[i]; + if (e->vendor == VIRTIO_PCI_VENDOR) { + name = NULL; + options = NULL; + + switch (e->device) { + case VIRTIO_ID_PCI: + name = "virtio_pci"; + break; + 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 +371,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 +401,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 5b4c8d080..15dec7392 100644 --- a/mdk-stage1/probing.h +++ b/mdk-stage1/probing.h @@ -24,10 +24,17 @@ 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_PCI 0x1000 +#define VIRTIO_ID_NET 0x1001 +#define VIRTIO_ID_BLOCK 0x1002 +#define VIRTIO_ID_BALLOON 0x1005 + 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 8376e7e79..47473e9d7 100644 --- a/mdk-stage1/stage1.c +++ b/mdk-stage1/stage1.c @@ -426,6 +426,8 @@ int main(int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)) init_firmware_loader(); 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); |