summaryrefslogtreecommitdiff
path: root/tools/lguest
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2015-02-11 15:15:12 +1030
committerRusty Russell <rusty@rustcorp.com.au>2015-02-11 16:47:38 +1030
commit8e70946943961cf5bb9be3a0cf12bd0da7a7cb0d (patch)
treef0766130cf8b6873e7a9aa0e6586672e878945ff /tools/lguest
parent3e0e5f2640d3b8f8f958e72f1577f1e323e11da6 (diff)
lguest: add a dummy PCI host bridge.
Otherwise Linux fails to find the bus. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'tools/lguest')
-rw-r--r--tools/lguest/lguest.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c
index eafdaf2a14c4..c8930bc5ce99 100644
--- a/tools/lguest/lguest.c
+++ b/tools/lguest/lguest.c
@@ -1238,6 +1238,17 @@ static void handle_output(unsigned long addr)
* code.
*/
+/* Linux expects a PCI host bridge: ours is a dummy, and first on the bus. */
+static struct device pci_host_bridge;
+
+static void init_pci_host_bridge(void)
+{
+ pci_host_bridge.name = "PCI Host Bridge";
+ pci_host_bridge.config.class = 0x06; /* bridge */
+ pci_host_bridge.config.subclass = 0; /* host bridge */
+ devices.pci[0] = &pci_host_bridge;
+}
+
/* The IO ports used to read the PCI config space. */
#define PCI_CONFIG_ADDR 0xCF8
#define PCI_CONFIG_DATA 0xCFC
@@ -3007,6 +3018,9 @@ int main(int argc, char *argv[])
/* We always have a console device */
setup_console();
+ /* Initialize the (fake) PCI host bridge device. */
+ init_pci_host_bridge();
+
/* Now we load the kernel */
start = load_kernel(open_or_die(argv[optind+1], O_RDONLY));