summaryrefslogtreecommitdiffstats
path: root/hw/pc.c
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2010-05-14 16:29:07 +0900
committerBlue Swirl <blauwirbel@gmail.com>2010-05-15 15:40:34 +0000
commitec2654fb299306941e80c4907b7a9798cb6c6f05 (patch)
treef31c8802b7e234a7fa85455812076dda27892b4e /hw/pc.c
parent01b9e8c10e95446b2800b1403f1c3ff8defb54c5 (diff)
downloadhqemu-ec2654fb299306941e80c4907b7a9798cb6c6f05.zip
hqemu-ec2654fb299306941e80c4907b7a9798cb6c6f05.tar.gz
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 <yamahata@valinux.co.jp> Cc: Paolo Bonzini <bonzini@gnu.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/pc.c')
-rw-r--r--hw/pc.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/hw/pc.c b/hw/pc.c
index 3b6da4a..c88158c 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, &sectors);
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);
OpenPOWER on IntegriCloud