On Wed, Dec 8, 2010 at 11:34 AM, Gleb Natapov <g...@redhat.com> wrote: > Forget to save a couple of buffers before sending version 7 :( > > Anthony, Blue can this be applied now?
I made some more tests, this time with PPC. I modified OpenBIOS to print out the boot device list: $ qemu-system-ppc -drive if=none,id=hda,file=/dev/null -device ide-drive,drive=hda,bootindex=1 -drive if=none,id=cd,file=/dev/null -device ide-drive,drive=cd,bootindex=0 -nographic -prom-env 'auto-boot?=false' -L . qemu-system-ppc: pci_add_option_rom: failed to find romfile "vgabios-stdvga.bin" Could not open option rom 'pxe-ne2k_pci.bin': No such file or directory >> ============================================================= >> OpenBIOS 1.0 [Nov 28 2010 19:37] >> Configuration device id QEMU version 1 machine id 2 >> CPUs: 1 >> Memory: 128M >> UUID: 00000000-0000-0000-0000-000000000000 >> CPU type PowerPC,750 >> bootindex /grac...@fec00000/i...@3/dr...@1/d...@1 >> /grac...@fec00000/i...@3/dr...@1/d...@0 Welcome to OpenBIOS v1.0 built on Nov 28 2010 19:37 0 > show-devs 7be6324 / 7be6440 /aliases 7be64e4 /openprom (BootROM) 7bebfa0 /openprom/client-services 7be668c /options 7be6704 /chosen 7be67e8 /builtin 7be688c /builtin/console 7bebcac /packages 7becda8 /packages/cmdline 7becee8 /packages/disk-label 7bedb58 /packages/terminal-emulator 7bee548 /packages/deblocker 7bee89c /packages/hfsplus-files 7beeb3c /packages/hfs-files 7beedd8 /packages/ext2-files 7bef010 /packages/iso9660-files 7bef248 /packages/grubfs-files 7bef480 /packages/mac-parts 7bef6b8 /packages/pc-parts 7bef8ec /packages/xcoff-loader 7bef9b8 /packages/elf-loader 7befa80 /packages/bootinfo-loader 7bed958 /cpus 7bf2fe8 /cpus/PowerPC,7...@0 (cpu) 7beda58 /mem...@0 (memory) 7befb4c /p...@80000000 (pci) 7beff64 /p...@80000000/QEMU,v...@1 (display) 7bf0438 /p...@80000000/ne2...@2 (network) 7bf0814 /p...@80000000/pci-...@3 (pci-ide) 7bf0c50 /p...@80000000/pci-...@3/at...@500 (ata) 7bf0dd0 /p...@80000000/pci-...@3/at...@600 (ata) 7bf0f50 /p...@80000000/pci-...@3/at...@600/d...@1 (block) 7bf131c /p...@80000000/pci-...@3/at...@600/d...@0 (block) 7bf1674 /p...@80000000/mac...@4 (mac-io) 7bf1b54 /p...@80000000/mac...@4/via-c...@16000 (via-cuda) 7bf1d70 /p...@80000000/mac...@4/via-c...@16000/adb (adb) 7bf1ed8 /p...@80000000/mac...@4/via-c...@16000/adb/keybo...@8 (keyboard) 7bf2080 /p...@80000000/mac...@4/via-c...@16000/adb/mo...@9 (mouse) 7bf220c /p...@80000000/mac...@4/via-c...@16000/rtc (rtc) 7bf23f4 /p...@80000000/mac...@4/nv...@60000 (nvram) 7bf2614 /p...@80000000/mac...@4/e...@13000 (escc) 7bf271c /p...@80000000/mac...@4/e...@13000/c...@13020 (serial) 7bf29b4 /p...@80000000/mac...@4/e...@13000/c...@13000 (serial) 7bf2c20 /p...@80000000/mac...@4/at...@20000 (ata) ok /grac...@fec00000/i...@3/dr...@1/d...@1 does not match /p...@80000000/pci-...@3/at...@600/d...@1. I wonder where '@80000000' comes from. A dump of original g3beige device tree is here: http://penguinppc.org/historical/dev-trees-html/g3_beige_300.html But actually the tree generated by OpenBIOS looks more like g3bw one: http://penguinppc.org/historical/dev-trees-html/g3bw_400.html How can we get the names to be more compatible? At least s/grackle/pci/ is easy to do in QEMU, but which instance (QEMU or OpenBIOS) should handle pci-ata vs ide change? What should we do with at...@600 vs dr...@1?
From 640a93145fd830b225b5f9865a9cfe6e32b9bf66 Mon Sep 17 00:00:00 2001 From: Blue Swirl <blauwirbel@gmail.com> Date: Sat, 11 Dec 2010 14:48:53 +0000 Subject: [PATCH] Use bootindex Signed-off-by: Blue Swirl <blauwirbel@gmail.com> --- arch/ppc/qemu/init.c | 30 ++++++++++++++++++++++++++++++ arch/sparc32/openbios.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 0 deletions(-) diff --git a/arch/ppc/qemu/init.c b/arch/ppc/qemu/init.c index 5118eb1..1cadcf0 100644 --- a/arch/ppc/qemu/init.c +++ b/arch/ppc/qemu/init.c @@ -601,6 +601,34 @@ static void kvm_of_init(void) fword("finish-device"); } +typedef struct FWCfgFile { + uint32_t size; + uint16_t select; + uint16_t reserved; + char name[56]; +} FWCfgFile; + +static void check_fw_cfg_bootindex(void) +{ + char *dir, *bootindex; + int dirlen, dirsize, i; + FWCfgFile *file; + + dirlen = __le32_to_cpu(fw_cfg_read_i32(FW_CFG_FILE_DIR)); + dirsize = sizeof(uint32_t) + sizeof(FWCfgFile) * dirlen; + dir = malloc(dirsize); + fw_cfg_read(FW_CFG_FILE_DIR, dir, dirsize); + + for (i = 0; i < dirlen; i++) { + file = (FWCfgFile *)&dir[i + sizeof(uint32_t)]; + if (file->size && !strcmp(file->name, "bootorder")) { + bootindex = malloc(file->size); + fw_cfg_read(file->select, bootindex, file->size); + printk("bootindex %s\n", bootindex); + } + } +} + void arch_of_init(void) { @@ -807,6 +835,8 @@ arch_of_init(void) push_str("/options"); fword("find-device"); + check_fw_cfg_bootindex(); + uint16_t boot_device = fw_cfg_read_i16(FW_CFG_BOOT_DEVICE); switch (boot_device) { case 'c': diff --git a/arch/sparc32/openbios.c b/arch/sparc32/openbios.c index 1c86752..e6f1a77 100644 --- a/arch/sparc32/openbios.c +++ b/arch/sparc32/openbios.c @@ -25,6 +25,7 @@ #include "packages/video.h" #define NO_QEMU_PROTOS #include "arch/common/fw_cfg.h" +#include "libc/byteorder.h" #define MEMORY_SIZE (128*1024) /* 16K ram for hosted system */ #define DICTIONARY_SIZE (256*1024) /* 256K for the dictionary */ @@ -820,6 +821,34 @@ static void init_memory(void) PUSH((ucell)memory + MEMORY_SIZE); } +typedef struct FWCfgFile { + uint32_t size; + uint16_t select; + uint16_t reserved; + char name[56]; +} FWCfgFile; + +static void check_fw_cfg_bootindex(void) +{ + char *dir, *bootindex; + int dirlen, dirsize, i; + FWCfgFile *entry; + + dirlen = __le32_to_cpu(fw_cfg_read_i32(FW_CFG_FILE_DIR)); + dirsize = sizeof(uint32_t) + sizeof(FWCfgFile) * dirlen; + dir = malloc(dirsize); + fw_cfg_read(FW_CFG_FILE_DIR, dir, dirsize); + + for (i = 0; i < dirlen; i++) { + entry = (FWCfgFile *)&dir[i + sizeof(uint32_t)]; + if (entry->size && !strcmp(entry->name, "bootorder")) { + bootindex = malloc(entry->size); + fw_cfg_read(entry->select, bootindex, entry->size); + printk("bootindex %s\n", bootindex); + } + } +} + static void arch_init( void ) { @@ -900,6 +929,8 @@ arch_init( void ) push_str("boot-file"); fword("property"); + check_fw_cfg_bootindex(); + boot_device = fw_cfg_read_i16(FW_CFG_BOOT_DEVICE); switch (boot_device) { -- 1.5.6.5