3 // Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
5 // This file may be distributed under the terms of the GNU GPLv3 license.
7 #include "util.h" // checksum
8 #include "config.h" // BUILD_BIOS_ADDR
9 #include "farptr.h" // SET_FARVAR
27 extern struct pnpheader PNPHEADER;
28 extern const char pnp_string[];
32 struct pnpheader PNPHEADER __aligned(16) VISIBLE16 = {
33 .signature = PNP_SIGNATURE,
35 .length = sizeof(PNPHEADER),
37 .prot_base = BUILD_BIOS_ADDR,
39 .prot_database = BUILD_BIOS_ADDR,
42 // We need a copy of this string in the 0xf000 segment, but we are not
43 // actually a PnP BIOS, so make sure it is *not* aligned, so OSes will
44 // not see it if they scan.
45 const char pnp_string[] __aligned(2) VISIBLE16 = " $PnP";
49 #define FUNCTION_NOT_SUPPORTED 0x82
51 // BBS - Get Version and Installation Check
53 handle_pnp60(u16 *args)
55 u16 version_ptr = args[1];
56 u16 version_seg = args[2];
57 SET_FARVAR(version_seg, *(u16*)(version_ptr+0), 0x0101);
62 handle_pnpXX(u16 *args)
64 return FUNCTION_NOT_SUPPORTED;
71 return FUNCTION_NOT_SUPPORTED;
74 dprintf(DEBUG_HDL_pnp, "pnp call arg1=%x\n", arg1);
77 case 0x60: return handle_pnp60(args);
78 default: return handle_pnpXX(args);
86 return (u32)pnp_string + 1 - BUILD_BIOS_ADDR;
87 return (u32)&PNPHEADER - BUILD_BIOS_ADDR;
91 extern void entry_pnp_real();
92 extern void entry_pnp_prot();
100 dprintf(3, "init PNPBIOS table\n");
102 PNPHEADER.real_ip = (u32)entry_pnp_real - BUILD_BIOS_ADDR;
103 PNPHEADER.prot_ip = (u32)entry_pnp_prot - BUILD_BIOS_ADDR;
104 PNPHEADER.checksum = -checksum((u8*)&PNPHEADER, sizeof(PNPHEADER));