debuggers.hg

view xen/arch/x86/ioport_emulate.c @ 16580:1936e6a79f85

x86: Fix management support on HP ProLiant systems.

Adds support to allow host-platform-specific handling of I/O port
traps. Specifically adds support to handle an HP ProLiant I/O port in a
special way.

Signed-off-by: Mike Garrett <michael.garrett@hp.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Dec 06 11:23:04 2007 +0000 (2007-12-06)
parents
children 35890b260971
line source
1 /******************************************************************************
2 * ioport_emulate.c
3 *
4 * Handle I/O port access quirks of various platforms.
5 */
7 #include <xen/config.h>
8 #include <xen/init.h>
9 #include <xen/sched.h>
10 #include <xen/dmi.h>
12 /* Function pointer used to handle platform specific I/O port emulation. */
13 extern void (*ioemul_handle_quirk)(
14 u8 opcode, char *io_emul_stub, struct cpu_user_regs *regs);
16 static void ioemul_handle_proliant_quirk(
17 u8 opcode, char *io_emul_stub, struct cpu_user_regs *regs)
18 {
19 uint16_t port = regs->edx;
20 uint8_t value = regs->eax;
22 if ( (opcode != 0xee) || (port != 0xcd4) || !(value & 0x80) )
23 return;
25 /* pushfw */
26 io_emul_stub[ 0] = 0x66;
27 io_emul_stub[ 1] = 0x9c;
28 /* cli */
29 io_emul_stub[ 2] = 0xfa;
30 /* out %al,%dx */
31 io_emul_stub[ 3] = 0xee;
32 /* 1: in %dx,%al */
33 io_emul_stub[ 4] = 0xec;
34 /* test $0x80,%al */
35 io_emul_stub[ 5] = 0xa8;
36 io_emul_stub[ 6] = 0x80;
37 /* jnz 1b */
38 io_emul_stub[ 7] = 0x75;
39 io_emul_stub[ 8] = 0xfb;
40 /* popfw */
41 io_emul_stub[ 9] = 0x66;
42 io_emul_stub[10] = 0x9d;
43 /* ret */
44 io_emul_stub[11] = 0xc3;
45 }
47 int __init proliant_quirk(struct dmi_system_id *d)
48 {
49 ioemul_handle_quirk = ioemul_handle_proliant_quirk;
50 return 0;
51 }
53 /* This table is the set of system-specific I/O emulation hooks. */
54 static struct dmi_system_id __initdata ioport_quirks_tbl[] = {
55 /*
56 * I/O emulation hook for certain HP ProLiant servers with
57 * 'special' SMM goodness.
58 */
59 {
60 .callback = proliant_quirk,
61 .ident = "HP ProLiant DL3xx",
62 .matches = {
63 DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
64 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL3"),
65 },
66 },
67 {
68 .callback = proliant_quirk,
69 .ident = "HP ProLiant DL5xx",
70 .matches = {
71 DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
72 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL5"),
73 },
74 },
75 {
76 .callback = proliant_quirk,
77 .ident = "HP ProLiant ML3xx",
78 .matches = {
79 DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
80 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant ML3"),
81 },
82 },
83 {
84 .callback = proliant_quirk,
85 .ident = "HP ProLiant ML5xx",
86 .matches = {
87 DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
88 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant ML5"),
89 },
90 },
91 {
92 .callback = proliant_quirk,
93 .ident = "HP ProLiant BL4xx",
94 .matches = {
95 DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
96 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL4"),
97 },
98 },
99 {
100 .callback = proliant_quirk,
101 .ident = "HP ProLiant BL6xx",
102 .matches = {
103 DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
104 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL6"),
105 },
106 },
107 { }
108 };
110 int __init ioport_quirks_init(void)
111 {
112 dmi_check_system(ioport_quirks_tbl);
113 return 0;
114 }
115 __initcall(ioport_quirks_init);
117 /*
118 * Local variables:
119 * mode: C
120 * c-set-style: "BSD"
121 * c-basic-offset: 4
122 * tab-width: 4
123 * indent-tabs-mode: nil
124 * End:
125 */