diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2015-02-10 23:45:12 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2015-02-11 01:17:38 -0500 |
commit | 8e70946943961cf5bb9be3a0cf12bd0da7a7cb0d (patch) | |
tree | f0766130cf8b6873e7a9aa0e6586672e878945ff | |
parent | 3e0e5f2640d3b8f8f958e72f1577f1e323e11da6 (diff) |
lguest: add a dummy PCI host bridge.
Otherwise Linux fails to find the bus.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r-- | tools/lguest/lguest.c | 14 |
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) | |||
1238 | * code. | 1238 | * code. |
1239 | */ | 1239 | */ |
1240 | 1240 | ||
1241 | /* Linux expects a PCI host bridge: ours is a dummy, and first on the bus. */ | ||
1242 | static struct device pci_host_bridge; | ||
1243 | |||
1244 | static void init_pci_host_bridge(void) | ||
1245 | { | ||
1246 | pci_host_bridge.name = "PCI Host Bridge"; | ||
1247 | pci_host_bridge.config.class = 0x06; /* bridge */ | ||
1248 | pci_host_bridge.config.subclass = 0; /* host bridge */ | ||
1249 | devices.pci[0] = &pci_host_bridge; | ||
1250 | } | ||
1251 | |||
1241 | /* The IO ports used to read the PCI config space. */ | 1252 | /* The IO ports used to read the PCI config space. */ |
1242 | #define PCI_CONFIG_ADDR 0xCF8 | 1253 | #define PCI_CONFIG_ADDR 0xCF8 |
1243 | #define PCI_CONFIG_DATA 0xCFC | 1254 | #define PCI_CONFIG_DATA 0xCFC |
@@ -3007,6 +3018,9 @@ int main(int argc, char *argv[]) | |||
3007 | /* We always have a console device */ | 3018 | /* We always have a console device */ |
3008 | setup_console(); | 3019 | setup_console(); |
3009 | 3020 | ||
3021 | /* Initialize the (fake) PCI host bridge device. */ | ||
3022 | init_pci_host_bridge(); | ||
3023 | |||
3010 | /* Now we load the kernel */ | 3024 | /* Now we load the kernel */ |
3011 | start = load_kernel(open_or_die(argv[optind+1], O_RDONLY)); | 3025 | start = load_kernel(open_or_die(argv[optind+1], O_RDONLY)); |
3012 | 3026 | ||