diff options
author | sshwarts <sshwarts> | 2008-10-15 19:04:09 +0000 |
---|---|---|
committer | sshwarts <sshwarts> | 2008-10-15 19:04:09 +0000 |
commit | 52e32d674e0bd086f34f311ba68d459b5bd72ef9 (patch) | |
tree | b7a00d5c6330b9f4759ad43cff83e0c1cdb4e134 /bios | |
parent | bd786593f822307a2267da078af85abd1bcc35af (diff) |
QEMU UUID support - QEMU only is affected
Diffstat (limited to 'bios')
-rw-r--r-- | bios/rombios32.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/bios/rombios32.c b/bios/rombios32.c index 13300911..3410f3e7 100644 --- a/bios/rombios32.c +++ b/bios/rombios32.c @@ -393,8 +393,50 @@ int pm_sci_int; unsigned long bios_table_cur_addr; unsigned long bios_table_end_addr; +#ifdef BX_QEMU +#define QEMU_CFG_CTL_PORT 0x510 +#define QEMU_CFG_DATA_PORT 0x511 +#define QEMU_CFG_SIGNATURE 0x00 +#define QEMU_CFG_ID 0x01 +#define QEMU_CFG_UUID 0x02 + +int qemu_cfg_port; + +void qemu_cfg_select(int f) +{ + outw(QEMU_CFG_CTL_PORT, f); +} + +int qemu_cfg_port_probe() +{ + char *sig = "QEMU"; + int i; + + qemu_cfg_select(QEMU_CFG_SIGNATURE); + + for (i = 0; i < 4; i++) + if (inb(QEMU_CFG_DATA_PORT) != sig[i]) + return 0; + + return 1; +} + +void qemu_cfg_read(uint8_t *buf, int len) +{ + while (len--) + *(buf++) = inb(QEMU_CFG_DATA_PORT); +} +#endif + void uuid_probe(void) { +#ifdef BX_QEMU + if(qemu_cfg_port) { + qemu_cfg_select(QEMU_CFG_UUID); + qemu_cfg_read(bios_uuid, 16); + return; + } +#endif memset(bios_uuid, 0, 16); } @@ -1973,6 +2015,10 @@ void rombios32_init(void) { BX_INFO("Starting rombios32\n"); +#ifdef BX_QEMU + qemu_cfg_port = qemu_cfg_port_probe(); +#endif + ram_probe(); cpu_probe(); |