5 #include <linux/types.h>
6 #include <linux/module.h>
8 #include <linux/linkage.h>
9 #include <linux/kernel.h>
10 #include <linux/device.h>
20 #include <asm/byteorder.h>
44 "pnp_bios_callfunc:\n"
49 " lcallw *pnp_bios_callpoint\n"
54 #define Q2_SET_SEL(cpu, selname, address, size) \
56 struct desc_struct *gdt = get_cpu_gdt_table((cpu)); \
57 set_desc_base(&gdt[(selname) >> 3], (u32)(address)); \
58 set_desc_limit(&gdt[(selname) >> 3], (size) - 1); \
81 void *ts1_base,
u32 ts1_size,
82 void *ts2_base,
u32 ts2_size)
93 if (pnp_bios_is_utter_crap)
97 save_desc_40 = get_cpu_gdt_table(cpu)[0x40 / 8];
98 get_cpu_gdt_table(cpu)[0x40 / 8] = bad_bios_desc;
109 __asm__ __volatile__(
"pushl %%ebp\n\t"
117 "movl %%esp, pnp_bios_fault_esp\n\t"
118 "movl $1f, pnp_bios_fault_eip\n\t"
127 "popl %%ebp\n\t":
"=a"(status)
128 :
"0"((func) | (((
u32) arg1) << 16)),
129 "b"((arg2) | (((
u32) arg3) << 16)),
130 "c"((arg4) | (((
u32) arg5) << 16)),
131 "d"((arg6) | (((
u32) arg7) << 16)),
132 "i"(PNP_CS32),
"i"(0)
134 spin_unlock_irqrestore(&pnp_bios_lock, flags);
136 get_cpu_gdt_table(cpu)[0x40 / 8] = save_desc_40;
140 if (pnp_bios_is_utter_crap) {
142 "PnPBIOS: Warning! Your PnP BIOS caused a fatal error. Attempting to continue\n");
144 "PnPBIOS: You may need to reboot with the \"pnpbios=off\" option to operate stably\n");
146 "PnPBIOS: Check with your vendor for an updated BIOS\n");
168 "PnPBIOS: %s: function not supported on this system\n",
191 "PnPBIOS: %s: no isapnp cards are installed on this system\n",
196 "PnPBIOS: %s: cannot determine the capabilities of the docking station\n",
201 "PnPBIOS: %s: unable to undock, the system does not have a battery\n",
206 "PnPBIOS: %s: could not dock due to resource conflicts\n",
235 #define PNP_GET_NUM_SYS_DEV_NODES 0x00
236 #define PNP_GET_SYS_DEV_NODE 0x01
237 #define PNP_SET_SYS_DEV_NODE 0x02
238 #define PNP_GET_EVENT 0x03
239 #define PNP_SEND_MESSAGE 0x04
240 #define PNP_GET_DOCKING_STATION_INFORMATION 0x05
241 #define PNP_SET_STATIC_ALLOCED_RES_INFO 0x09
242 #define PNP_GET_STATIC_ALLOCED_RES_INFO 0x0a
243 #define PNP_GET_APM_ID_TABLE 0x0b
244 #define PNP_GET_PNP_ISA_CONFIG_STRUC 0x40
245 #define PNP_GET_ESCD_INFO 0x41
246 #define PNP_READ_ESCD 0x42
247 #define PNP_WRITE_ESCD 0x43
259 PNP_TS1, PNP_DS, 0, 0, data,
267 int status = __pnp_bios_dev_node_info(data);
288 static int __pnp_bios_get_dev_node(
u8 *nodenum,
char boot,
298 tmp_nodenum = *nodenum;
300 boot ? 2 : 1, PNP_DS, 0, &tmp_nodenum,
301 sizeof(tmp_nodenum), data, 65536);
302 *nodenum = tmp_nodenum;
310 status = __pnp_bios_get_dev_node(nodenum, boot, data);
322 static int __pnp_bios_set_dev_node(
u8 nodenum,
char boot,
332 boot ? 2 : 1, PNP_DS, 0, 0, data, 65536,
NULL,
341 status = __pnp_bios_set_dev_node(nodenum, boot, data);
364 PNP_DS, 0, 0, 0, 0, data,
374 static int __pnp_bios_get_stat_res(
char *
info)
381 PNP_DS, 0, 0, 0, 0, info, 65536,
NULL, 0);
389 status = __pnp_bios_get_stat_res(info);
414 status = __pnp_bios_isapnp_config(data);
430 PNP_TS1, PNP_DS, data,
439 status = __pnp_bios_escd_info(data);
449 static int __pnp_bios_read_escd(
char *data,
u32 nvram_base)
455 status = call_pnp_bios(
PNP_READ_ESCD, 0, PNP_TS1, PNP_TS2, PNP_DS, 0, 0,
456 0, data, 65536,
__va(nvram_base), 65536);
464 status = __pnp_bios_read_escd(data, nvram_base);
475 pnp_bios_callpoint.offset = header->
fields.pm16offset;
476 pnp_bios_callpoint.segment = PNP_CS16;
482 set_desc_base(&gdt[GDT_ENTRY_PNPBIOS_CS32],
484 set_desc_base(&gdt[GDT_ENTRY_PNPBIOS_CS16],
485 (
unsigned long)
__va(header->
fields.pm16cseg));
486 set_desc_base(&gdt[GDT_ENTRY_PNPBIOS_DS],
487 (
unsigned long)
__va(header->
fields.pm16dseg));