diff options
author | Thierry Vignaud <tv@mageia.org> | 2013-03-30 23:26:28 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2013-03-30 23:26:28 +0000 |
commit | 606f2ec07f484cae4eb3f7abae92fcb43b0ed079 (patch) | |
tree | f06771185fc8a0be7dd49a29fba6a0c27b112ebd | |
parent | 8e202124f9e304a609a94deb21ebc40c04195c82 (diff) | |
download | ldetect-606f2ec07f484cae4eb3f7abae92fcb43b0ed079.tar ldetect-606f2ec07f484cae4eb3f7abae92fcb43b0ed079.tar.gz ldetect-606f2ec07f484cae4eb3f7abae92fcb43b0ed079.tar.bz2 ldetect-606f2ec07f484cae4eb3f7abae92fcb43b0ed079.tar.xz ldetect-606f2ec07f484cae4eb3f7abae92fcb43b0ed079.zip |
add support for detecting Xen blk & net controllers (mga#9546)
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | pci.c | 33 |
2 files changed, 35 insertions, 0 deletions
@@ -1,3 +1,5 @@ +- add support for detecting Xen blk & net controllers (mga#9546) + Version 0.12.5 - 14 January 2013, Thierry Vignaud - dynamically resize memory when reaching max devices limit (mga#8320) @@ -49,6 +49,37 @@ char* get_pci_description(int vendor_id, int device_id) { return buf; } +// fake two PCI controllers for xen +static detect_xen(struct pciusb_entries *r) { + struct stat sb; + if (stat("/sys/bus/xen", &sb) != 0) + return; + + struct pciusb_entry *e = &r->entries[r->nb++]; + pciusb_initialize(e); + asprintf(&e->text, "%s|%s", "XenSource, Inc.", "Block Frontend"); + e->class_id = 0x0106; // STORAGE_SATA + + e->vendor = 0x1a71; // XenSource + e->device = 0xfffa; // fake + e->subvendor = 0; + e->subdevice = 0; + e->class_id = 0x0106; + e->module = strdup("xen_blkfront"); + + e = &r->entries[r->nb++]; + pciusb_initialize(e); + asprintf(&e->text, "%s|%s", "XenSource, Inc.", "Network Frontend"); + e->class_id = 0x0200; // NETWORK_ETHERNET + + e->vendor = 0x1a71; // XenSource + e->device = 0xfffa; // fake + e->subvendor = 0; + e->subdevice = 0; + e->class_id = 0x0200; + e->module = strdup("xen_netfront"); +} + extern struct pciusb_entries pci_probe(void) { u8 buf[CONFIG_SPACE_SIZE]; struct pciusb_entries r; @@ -77,6 +108,8 @@ extern struct pciusb_entries pci_probe(void) { r.nb = 0; r.entries = malloc(sizeof(struct pciusb_entry) * MAX_DEVICES); + detect_xen(&r); + for (dev = pacc->devices; dev; dev = dev->next, r.nb++) { if (r.nb >= allocated) { allocated = r.nb*2; |