From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
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 [thread overview]
Message-ID: <ddf5372202e56c1c2888d7235c7749dd623c5911.1241106809.git.armbru@redhat.com> (raw)
In-Reply-To: <cover.1241106809.git.armbru@redhat.com>
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 <armbru@redhat.com>
---
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
next parent reply other threads:[~2009-04-30 16:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1241106809.git.armbru@redhat.com>
2009-04-30 16:03 ` Markus Armbruster [this message]
2009-05-01 17:27 ` [Qemu-devel] [PATCH 1/4] Confine use of global rtc_state to PC CMOS functions Blue Swirl
2009-05-04 13:54 ` Markus Armbruster
2009-05-05 16:22 ` Blue Swirl
2009-05-19 6:56 ` Markus Armbruster
2009-05-19 16:51 ` Blue Swirl
2009-05-19 16:57 ` Avi Kivity
2009-04-30 16:03 ` [Qemu-devel] [PATCH 2/4] Remove global floppy_controller Markus Armbruster
2009-05-01 17:31 ` Blue Swirl
2009-04-30 16:03 ` [Qemu-devel] [PATCH 3/4] Give parse_macaddr() external linkage Markus Armbruster
2009-04-30 16:03 ` [Qemu-devel] [PATCH 4/4] Machine description as data Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ddf5372202e56c1c2888d7235c7749dd623c5911.1241106809.git.armbru@redhat.com \
--to=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).