From ec2654fb299306941e80c4907b7a9798cb6c6f05 Mon Sep 17 00:00:00 2001 From: Isaku Yamahata Date: Fri, 14 May 2010 16:29:07 +0900 Subject: [PATCH] pc: remove global variable rtc_state by using qemu_irq. Remove the reference to the global variable, rtc_state, by passing function argument to cmos_init_hd(), cmos_init(). Signed-off-by: Isaku Yamahata Cc: Paolo Bonzini Acked-by: Gerd Hoffmann Cc: Blue Swirl Signed-off-by: Blue Swirl --- hw/pc.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 3b6da4a3e2..c88158ca2b 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -65,8 +65,6 @@ #define MAX_IDE_BUS 2 -static RTCState *rtc_state; - #define E820_NR_ENTRIES 16 struct e820_entry { @@ -207,9 +205,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(int type_ofs, int info_ofs, BlockDriverState *hd, + RTCState *s) { - RTCState *s = rtc_state; int cylinders, heads, sectors; bdrv_get_geometry_hint(hd, &cylinders, &heads, §ors); rtc_set_memory(s, type_ofs, 47); @@ -273,9 +271,8 @@ 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, const char *boot_device, DriveInfo **hd_table, - FDCtrl *floppy_controller) + FDCtrl *floppy_controller, RTCState *s) { - RTCState *s = rtc_state; int val; int fd0, fd1, nb; int i; @@ -350,9 +347,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]->bdrv); + cmos_init_hd(0x19, 0x1b, hd_table[0]->bdrv, s); if (hd_table[1]) - cmos_init_hd(0x1a, 0x24, hd_table[1]->bdrv); + cmos_init_hd(0x1a, 0x24, hd_table[1]->bdrv, s); val = 0; for (i = 0; i < 4; i++) { @@ -835,6 +832,7 @@ static void pc_init1(ram_addr_t ram_size, DriveInfo *fd[MAX_FD]; void *fw_cfg; FDCtrl *floppy_controller; + RTCState *rtc_state; PITState *pit; if (ram_size >= 0xe0000000 ) { @@ -1037,7 +1035,7 @@ static void pc_init1(ram_addr_t ram_size, floppy_controller = fdctrl_init_isa(fd); cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd, - floppy_controller); + floppy_controller, rtc_state); if (pci_enabled && usb_enabled) { usb_uhci_piix3_init(pci_bus, piix3_devfn + 2);