ia64/xen-unstable

view tools/ioemu/patches/domain-timeoffset @ 10808:b4d5a36e380b

[qemu] Initialize vga from within qemu for when the bios doesn't do so.
On xen/x86, vga bios is copied to 0xC0000 by guest firmware.
However on ia64 platform, native firmware depends on some
initialization vga state at power on and so does guest firmware.
That's why that vga bios initialization stub is required for vti
domain, to match platform requirement.

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
author chris@kneesaa.uk.xensource.com
date Wed Jul 26 15:20:30 2006 +0100 (2006-07-26)
parents 4c2a281cd1e7
children f3d6a5281617
line source
1 Index: ioemu/hw/mc146818rtc.c
2 ===================================================================
3 --- ioemu.orig/hw/mc146818rtc.c 2006-07-26 15:17:35.110819901 +0100
4 +++ ioemu/hw/mc146818rtc.c 2006-07-26 15:17:40.292255496 +0100
5 @@ -178,10 +178,27 @@
6 }
7 }
9 +static void send_timeoffset_msg(time_t delta)
10 +{
11 +
12 +/* This routine is used to inform another entity that the
13 + base time offset has changed. For instance, if you
14 + were using xenstore, you might want to write to the store
15 + at this point. Or, you might use some other method.
16 + Whatever you might choose, here's a hook point to implement it.
17 +
18 + One item of note is that this delta is in addition to
19 + any existing offset you might be already using. */
20 +
21 + return;
22 +}
23 +
24 static void rtc_set_time(RTCState *s)
25 {
26 struct tm *tm = &s->current_tm;
27 -
28 + time_t before, after;
29 +
30 + before = mktime(tm);
31 tm->tm_sec = from_bcd(s, s->cmos_data[RTC_SECONDS]);
32 tm->tm_min = from_bcd(s, s->cmos_data[RTC_MINUTES]);
33 tm->tm_hour = from_bcd(s, s->cmos_data[RTC_HOURS] & 0x7f);
34 @@ -193,6 +210,12 @@
35 tm->tm_mday = from_bcd(s, s->cmos_data[RTC_DAY_OF_MONTH]);
36 tm->tm_mon = from_bcd(s, s->cmos_data[RTC_MONTH]) - 1;
37 tm->tm_year = from_bcd(s, s->cmos_data[RTC_YEAR]) + 100;
38 +
39 + /* Compute, and send, the additional time delta
40 + We could compute the total time delta, but this is
41 + sufficient, and simple. */
42 + after = mktime(tm);
43 + send_timeoffset_msg(after-before);
44 }
46 static void rtc_copy_date(RTCState *s)
47 Index: ioemu/hw/pc.c
48 ===================================================================
49 --- ioemu.orig/hw/pc.c 2006-07-26 15:17:39.820306906 +0100
50 +++ ioemu/hw/pc.c 2006-07-26 15:17:40.293255388 +0100
51 @@ -151,7 +151,7 @@
52 }
54 /* hd_table must contain 4 block drivers */
55 -static void cmos_init(uint64_t ram_size, int boot_device, BlockDriverState **hd_table)
56 +static void cmos_init(uint64_t ram_size, int boot_device, BlockDriverState **hd_table, time_t timeoffset)
57 {
58 RTCState *s = rtc_state;
59 int val;
60 @@ -162,6 +162,7 @@
62 /* set the CMOS date */
63 time(&ti);
64 + ti += timeoffset;
65 if (rtc_utc)
66 tm = gmtime(&ti);
67 else
68 @@ -613,7 +614,7 @@
69 static void pc_init1(uint64_t ram_size, int vga_ram_size, int boot_device,
70 DisplayState *ds, const char **fd_filename, int snapshot,
71 const char *kernel_filename, const char *kernel_cmdline,
72 - const char *initrd_filename,
73 + const char *initrd_filename, time_t timeoffset,
74 int pci_enabled)
75 {
76 #ifndef NOBIOS
77 @@ -864,7 +865,7 @@
79 floppy_controller = fdctrl_init(6, 2, 0, 0x3f0, fd_table);
81 - cmos_init(ram_size, boot_device, bs_table);
82 + cmos_init(ram_size, boot_device, bs_table, timeoffset);
84 if (pci_enabled && usb_enabled) {
85 usb_uhci_init(pci_bus, usb_root_ports);
86 @@ -883,12 +884,13 @@
87 int snapshot,
88 const char *kernel_filename,
89 const char *kernel_cmdline,
90 - const char *initrd_filename)
91 + const char *initrd_filename,
92 + time_t timeoffset)
93 {
94 pc_init1(ram_size, vga_ram_size, boot_device,
95 ds, fd_filename, snapshot,
96 kernel_filename, kernel_cmdline,
97 - initrd_filename, 1);
98 + initrd_filename, timeoffset, 1);
99 }
101 static void pc_init_isa(uint64_t ram_size, int vga_ram_size, int boot_device,
102 @@ -896,12 +898,13 @@
103 int snapshot,
104 const char *kernel_filename,
105 const char *kernel_cmdline,
106 - const char *initrd_filename)
107 + const char *initrd_filename,
108 + time_t timeoffset)
109 {
110 pc_init1(ram_size, vga_ram_size, boot_device,
111 ds, fd_filename, snapshot,
112 kernel_filename, kernel_cmdline,
113 - initrd_filename, 0);
114 + initrd_filename, timeoffset, 0);
115 }
117 QEMUMachine pc_machine = {
118 Index: ioemu/vl.c
119 ===================================================================
120 --- ioemu.orig/vl.c 2006-07-26 15:17:40.169268893 +0100
121 +++ ioemu/vl.c 2006-07-26 15:17:40.296255061 +0100
122 @@ -164,6 +164,8 @@
124 int xc_handle;
126 +time_t timeoffset = 0;
127 +
128 char domain_name[1024] = { 'H','V', 'M', 'X', 'E', 'N', '-'};
129 extern int domid;
131 @@ -4799,6 +4801,7 @@
132 #endif
133 "-loadvm file start right away with a saved state (loadvm in monitor)\n"
134 "-vnc display start a VNC server on display\n"
135 + "-timeoffset time offset (in seconds) from local time\n"
136 "\n"
137 "During emulation, the following keys are useful:\n"
138 "ctrl-alt-f toggle full screen\n"
139 @@ -4889,6 +4892,7 @@
141 QEMU_OPTION_d,
142 QEMU_OPTION_vcpus,
143 + QEMU_OPTION_timeoffset,
144 };
146 typedef struct QEMUOption {
147 @@ -4967,6 +4971,7 @@
149 { "d", HAS_ARG, QEMU_OPTION_d },
150 { "vcpus", 1, QEMU_OPTION_vcpus },
151 + { "timeoffset", HAS_ARG, QEMU_OPTION_timeoffset },
152 { NULL },
153 };
155 @@ -5669,6 +5674,9 @@
156 vcpus = atoi(optarg);
157 fprintf(logfile, "qemu: the number of cpus is %d\n", vcpus);
158 break;
159 + case QEMU_OPTION_timeoffset:
160 + timeoffset = strtol(optarg, NULL, 0);
161 + break;
162 }
163 }
164 }
165 @@ -5992,7 +6000,8 @@
167 machine->init(ram_size, vga_ram_size, boot_device,
168 ds, fd_filename, snapshot,
169 - kernel_filename, kernel_cmdline, initrd_filename);
170 + kernel_filename, kernel_cmdline, initrd_filename,
171 + timeoffset);
173 gui_timer = qemu_new_timer(rt_clock, gui_update, NULL);
174 qemu_mod_timer(gui_timer, qemu_get_clock(rt_clock));
175 Index: ioemu/vl.h
176 ===================================================================
177 --- ioemu.orig/vl.h 2006-07-26 15:17:39.825306361 +0100
178 +++ ioemu/vl.h 2006-07-26 15:17:40.297254952 +0100
179 @@ -556,7 +556,7 @@
180 int boot_device,
181 DisplayState *ds, const char **fd_filename, int snapshot,
182 const char *kernel_filename, const char *kernel_cmdline,
183 - const char *initrd_filename);
184 + const char *initrd_filename, time_t timeoffset);
186 typedef struct QEMUMachine {
187 const char *name;