# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1178910953 21600
# Node ID 4ca4374eabd530ad5c71b98bdafd958410f062e5
# Parent d6309cfd1fdd53c23fd8daf32afe67abb68b35d6
[IA64] get guest os type
This patch is to use GFW ACPI_OSI to identify guest OS type.
When ACPI_OSI gets OS type, it writes to a reserved port a
special val. then XEN can know the guest OS type.
NB. Linux returns true both for _OSI(linux) and _OSI(windows)
Signed-off-by: Zhang Xin <xing.z.zhang@xxxxxxxxx>
Signed-off-by: Anthony Xu <anthony.xu@xxxxxxxxx>
---
xen/arch/ia64/vmx/mmio.c | 20 ++++++++++++++++++++
xen/arch/ia64/vmx/vmx_init.c | 3 ++-
xen/include/asm-ia64/vmx_platform.h | 15 +++++++++++++++
3 files changed, 37 insertions(+), 1 deletion(-)
diff -r d6309cfd1fdd -r 4ca4374eabd5 xen/arch/ia64/vmx/mmio.c
--- a/xen/arch/ia64/vmx/mmio.c Fri May 11 13:09:12 2007 -0600
+++ b/xen/arch/ia64/vmx/mmio.c Fri May 11 13:15:53 2007 -0600
@@ -188,6 +188,21 @@ int vmx_ide_pio_intercept(ioreq_t *p, u6
#define TO_LEGACY_IO(pa) (((pa)>>12<<2)|((pa)&0x3))
+const char * guest_os_name[] = {
+ "Unknown",
+ "Windows 2003 server",
+ "Linux",
+};
+
+static inline void set_os_type(VCPU *v, u64 type)
+{
+ if (type > OS_BASE && type < OS_END) {
+ v->domain->arch.vmx_platform.gos_type = type;
+ gdprintk(XENLOG_INFO, "Guest OS : %s\n", guest_os_name[type -
OS_BASE]);
+ }
+}
+
+
static void legacy_io_access(VCPU *vcpu, u64 pa, u64 *val, size_t s, int dir)
{
struct vcpu *v = current;
@@ -210,6 +225,11 @@ static void legacy_io_access(VCPU *vcpu,
p->df = 0;
p->io_count++;
+
+ if (dir == IOREQ_WRITE && p->addr == OS_TYPE_PORT) {
+ set_os_type(v, *val);
+ return;
+ }
if (vmx_ide_pio_intercept(p, val))
return;
diff -r d6309cfd1fdd -r 4ca4374eabd5 xen/arch/ia64/vmx/vmx_init.c
--- a/xen/arch/ia64/vmx/vmx_init.c Fri May 11 13:09:12 2007 -0600
+++ b/xen/arch/ia64/vmx/vmx_init.c Fri May 11 13:15:53 2007 -0600
@@ -305,7 +305,8 @@ vmx_final_setup_guest(struct vcpu *v)
v->arch.privregs = (mapped_regs_t *)vpd;
vcpu_share_privregs_with_guest(v);
vpd->vpd_low.virt_env_vaddr = vm_buffer;
-
+
+ v->domain->arch.vmx_platform.gos_type = OS_UNKNOWN;
/* Per-domain vTLB and vhpt implementation. Now vmx domain will stick
* to this solution. Maybe it can be deferred until we know created
* one as vmx domain */
diff -r d6309cfd1fdd -r 4ca4374eabd5 xen/include/asm-ia64/vmx_platform.h
--- a/xen/include/asm-ia64/vmx_platform.h Fri May 11 13:09:12 2007 -0600
+++ b/xen/include/asm-ia64/vmx_platform.h Fri May 11 13:15:53 2007 -0600
@@ -22,8 +22,23 @@
#include <public/xen.h>
#include <public/hvm/params.h>
#include <asm/viosapic.h>
+
+
+/* Value of guest os type */
+#define OS_BASE 0xB0
+#define OS_UNKNOWN 0xB0
+#define OS_WINDOWS 0xB1
+#define OS_LINUX 0xB2
+#define OS_END 0xB3
+
+/* port guest Firmware use to indicate os type
+ * this port is used to trigger SMI on x86,
+ * it is not used on ia64 */
+#define OS_TYPE_PORT 0xB2
+
struct mmio_list;
typedef struct virtual_platform_def {
+ unsigned long gos_type;
unsigned long buffered_io_va;
spinlock_t buffered_io_lock;
unsigned long buffered_pio_va;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|