[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/4] Confine use of global rtc_state to PC CMOS func
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PATCH 1/4] Confine use of global rtc_state to PC CMOS functions |
Date: |
Thu, 30 Apr 2009 18:03:45 +0200 |
Pass the state as argument to cmos_init() and cmos_init_hd().
cmos_init() still needs to save it in rtc_state for use by
cmos_set_s3_resume().
Signed-off-by: Markus Armbruster <address@hidden>
---
hw/pc.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 07b75f3..0e861ab 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -169,9 +169,9 @@ static int cmos_get_fd_drive_type(int fd0)
return val;
}
-static void cmos_init_hd(int type_ofs, int info_ofs, BlockDriverState *hd)
+static void cmos_init_hd(RTCState *s,
+ int type_ofs, int info_ofs, BlockDriverState *hd)
{
- RTCState *s = rtc_state;
int cylinders, heads, sectors;
bdrv_get_geometry_hint(hd, &cylinders, &heads, §ors);
rtc_set_memory(s, type_ofs, 47);
@@ -232,10 +232,10 @@ static int pc_boot_set(void *opaque, const char
*boot_device)
}
/* hd_table must contain 4 block drivers */
-static void cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
+static void cmos_init(RTCState *s,
+ ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
const char *boot_device, BlockDriverState **hd_table)
{
- RTCState *s = rtc_state;
int nbds, bds[3] = { 0, };
int val;
int fd0, fd1, nb;
@@ -324,9 +324,9 @@ static void cmos_init(ram_addr_t ram_size, ram_addr_t
above_4g_mem_size,
rtc_set_memory(s, 0x12, (hd_table[0] ? 0xf0 : 0) | (hd_table[1] ? 0x0f :
0));
if (hd_table[0])
- cmos_init_hd(0x19, 0x1b, hd_table[0]);
+ cmos_init_hd(s, 0x19, 0x1b, hd_table[0]);
if (hd_table[1])
- cmos_init_hd(0x1a, 0x24, hd_table[1]);
+ cmos_init_hd(s, 0x1a, 0x24, hd_table[1]);
val = 0;
for (i = 0; i < 4; i++) {
@@ -353,6 +353,7 @@ static void cmos_init(ram_addr_t ram_size, ram_addr_t
above_4g_mem_size,
}
}
rtc_set_memory(s, 0x39, val);
+ rtc_state = s; /* for cmos_set_s3_resume() */
}
void ioport_set_a20(int enable)
@@ -822,6 +823,7 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
int bios_size, isa_bios_size, oprom_area_size;
PCIBus *pci_bus;
int piix3_devfn = -1;
+ RTCState *rtc;
CPUState *env;
qemu_irq *cpu_irq;
qemu_irq *i8259;
@@ -990,9 +992,9 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
}
}
- rtc_state = rtc_init(0x70, i8259[8], 2000);
+ rtc = rtc_init(0x70, i8259[8], 2000);
- qemu_register_boot_set(pc_boot_set, rtc_state);
+ qemu_register_boot_set(pc_boot_set, rtc);
register_ioport_read(0x92, 1, 1, ioport92_read, NULL);
register_ioport_write(0x92, 1, 1, ioport92_write, NULL);
@@ -1071,7 +1073,7 @@ static void pc_init1(ram_addr_t ram_size, int
vga_ram_size,
}
floppy_controller = fdctrl_init(i8259[6], 2, 0, 0x3f0, fd);
- cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd);
+ cmos_init(rtc, below_4g_mem_size, above_4g_mem_size, boot_device, hd);
if (pci_enabled && usb_enabled) {
usb_uhci_piix3_init(pci_bus, piix3_devfn + 2);
--
1.6.0.6
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH 1/4] Confine use of global rtc_state to PC CMOS functions,
Markus Armbruster <=