summaryrefslogtreecommitdiffstats
path: root/include/grub/i386/pc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/grub/i386/pc/apm.h48
-rw-r--r--include/grub/i386/pc/biosdisk.h109
-rw-r--r--include/grub/i386/pc/biosnum.h6
-rw-r--r--include/grub/i386/pc/boot.h73
-rw-r--r--include/grub/i386/pc/chainloader.h27
-rw-r--r--include/grub/i386/pc/console.h36
-rw-r--r--include/grub/i386/pc/int.h33
-rw-r--r--include/grub/i386/pc/int_types.h59
-rw-r--r--include/grub/i386/pc/kernel.h41
-rw-r--r--include/grub/i386/pc/memory.h63
-rw-r--r--include/grub/i386/pc/pxe.h292
-rw-r--r--include/grub/i386/pc/time.h24
-rw-r--r--include/grub/i386/pc/vbe.h232
-rw-r--r--include/grub/i386/pc/vesa_modes_table.h19
-rw-r--r--include/grub/i386/pci.h105
15 files changed, 1167 insertions, 0 deletions
diff --git a/include/grub/i386/pc/apm.h b/include/grub/i386/pc/apm.h
new file mode 100644
index 0000000..6d9e8c6
--- /dev/null
+++ b/include/grub/i386/pc/apm.h
@@ -0,0 +1,48 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_APM_MACHINE_HEADER
+#define GRUB_APM_MACHINE_HEADER 1
+
+#include <grub/types.h>
+
+struct grub_apm_info
+{
+ grub_uint16_t cseg;
+ grub_uint32_t offset;
+ grub_uint16_t cseg_16;
+ grub_uint16_t dseg;
+ grub_uint16_t flags;
+ grub_uint16_t cseg_len;
+ grub_uint16_t cseg_16_len;
+ grub_uint16_t dseg_len;
+ grub_uint16_t version;
+};
+
+enum
+ {
+ GRUB_APM_FLAGS_16BITPROTECTED_SUPPORTED = 1,
+ GRUB_APM_FLAGS_32BITPROTECTED_SUPPORTED = 2,
+ GRUB_APM_FLAGS_CPUIDLE_SLOWS_DOWN = 4,
+ GRUB_APM_FLAGS_DISABLED = 8,
+ GRUB_APM_FLAGS_DISENGAGED = 16,
+ };
+
+int grub_apm_get_info (struct grub_apm_info *info);
+
+#endif
diff --git a/include/grub/i386/pc/biosdisk.h b/include/grub/i386/pc/biosdisk.h
new file mode 100644
index 0000000..3d80716
--- /dev/null
+++ b/include/grub/i386/pc/biosdisk.h
@@ -0,0 +1,109 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2002,2005,2007,2008 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_BIOSDISK_MACHINE_HEADER
+#define GRUB_BIOSDISK_MACHINE_HEADER 1
+
+#include <grub/symbol.h>
+#include <grub/types.h>
+
+#define GRUB_BIOSDISK_FLAG_LBA 1
+#define GRUB_BIOSDISK_FLAG_CDROM 2
+
+#define GRUB_BIOSDISK_CDTYPE_NO_EMUL 0
+#define GRUB_BIOSDISK_CDTYPE_1_2_M 1
+#define GRUB_BIOSDISK_CDTYPE_1_44_M 2
+#define GRUB_BIOSDISK_CDTYPE_2_88_M 3
+#define GRUB_BIOSDISK_CDTYPE_HARDDISK 4
+
+#define GRUB_BIOSDISK_CDTYPE_MASK 0xF
+
+struct grub_biosdisk_data
+{
+ int drive;
+ unsigned long cylinders;
+ unsigned long heads;
+ unsigned long sectors;
+ unsigned long flags;
+};
+
+/* Drive Parameters. */
+struct grub_biosdisk_drp
+{
+ grub_uint16_t size;
+ grub_uint16_t flags;
+ grub_uint32_t cylinders;
+ grub_uint32_t heads;
+ grub_uint32_t sectors;
+ grub_uint64_t total_sectors;
+ grub_uint16_t bytes_per_sector;
+ /* ver 2.0 or higher */
+
+ union
+ {
+ grub_uint32_t EDD_configuration_parameters;
+
+ /* Pointer to the Device Parameter Table Extension (ver 3.0+). */
+ grub_uint32_t dpte_pointer;
+ };
+
+ /* ver 3.0 or higher */
+ grub_uint16_t signature_dpi;
+ grub_uint8_t length_dpi;
+ grub_uint8_t reserved[3];
+ grub_uint8_t name_of_host_bus[4];
+ grub_uint8_t name_of_interface_type[8];
+ grub_uint8_t interface_path[8];
+ grub_uint8_t device_path[16];
+ grub_uint8_t reserved2;
+ grub_uint8_t checksum;
+
+ /* XXX: This is necessary, because the BIOS of Thinkpad X20
+ writes a garbage to the tail of drive parameters,
+ regardless of a size specified in a caller. */
+ grub_uint8_t dummy[16];
+} GRUB_PACKED;
+
+struct grub_biosdisk_cdrp
+{
+ grub_uint8_t size;
+ grub_uint8_t media_type;
+ grub_uint8_t drive_no;
+ grub_uint8_t controller_no;
+ grub_uint32_t image_lba;
+ grub_uint16_t device_spec;
+ grub_uint16_t cache_seg;
+ grub_uint16_t load_seg;
+ grub_uint16_t length_sec512;
+ grub_uint8_t cylinders;
+ grub_uint8_t sectors;
+ grub_uint8_t heads;
+ grub_uint8_t dummy[16];
+} GRUB_PACKED;
+
+/* Disk Address Packet. */
+struct grub_biosdisk_dap
+{
+ grub_uint8_t length;
+ grub_uint8_t reserved;
+ grub_uint16_t blocks;
+ grub_uint32_t buffer;
+ grub_uint64_t block;
+} GRUB_PACKED;
+
+#endif /* ! GRUB_BIOSDISK_MACHINE_HEADER */
diff --git a/include/grub/i386/pc/biosnum.h b/include/grub/i386/pc/biosnum.h
new file mode 100644
index 0000000..29c8ecc
--- /dev/null
+++ b/include/grub/i386/pc/biosnum.h
@@ -0,0 +1,6 @@
+#ifndef GRUB_BIOSNUM_MACHINE_HEADER
+#define GRUB_BIOSNUM_MACHINE_HEADER 1
+
+extern int (*grub_get_root_biosnumber) (void);
+
+#endif
diff --git a/include/grub/i386/pc/boot.h b/include/grub/i386/pc/boot.h
new file mode 100644
index 0000000..a4d42ff
--- /dev/null
+++ b/include/grub/i386/pc/boot.h
@@ -0,0 +1,73 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 1999,2000,2002,2005,2006,2007,2008,2010 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_BOOT_MACHINE_HEADER
+#define GRUB_BOOT_MACHINE_HEADER 1
+
+#include <grub/offsets.h>
+
+/* The signature for bootloader. */
+#define GRUB_BOOT_MACHINE_SIGNATURE 0xaa55
+
+/* The offset of the start of BPB (BIOS Parameter Block). */
+#define GRUB_BOOT_MACHINE_BPB_START 0x3
+
+/* The offset of the end of BPB (BIOS Parameter Block). */
+#define GRUB_BOOT_MACHINE_BPB_END 0x5a
+
+/* The offset of KERNEL_SECTOR. */
+#define GRUB_BOOT_MACHINE_KERNEL_SECTOR 0x5c
+
+/* The offset of BOOT_DRIVE. */
+#define GRUB_BOOT_MACHINE_BOOT_DRIVE 0x64
+
+/* The offset of BOOT_DRIVE_CHECK. */
+#define GRUB_BOOT_MACHINE_DRIVE_CHECK 0x66
+
+/* The offset of a magic number used by Windows NT. */
+#define GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC 0x1b8
+
+/* The offset of the start of the partition table. */
+#define GRUB_BOOT_MACHINE_PART_START 0x1be
+
+/* The offset of the end of the partition table. */
+#define GRUB_BOOT_MACHINE_PART_END 0x1fe
+
+/* The stack segment. */
+#define GRUB_BOOT_MACHINE_STACK_SEG 0x2000
+
+/* The segment of disk buffer. The disk buffer MUST be 32K long and
+ cannot straddle a 64K boundary. */
+#define GRUB_BOOT_MACHINE_BUFFER_SEG 0x7000
+
+/* The flag for BIOS drive number to designate a hard disk vs. a
+ floppy. */
+#define GRUB_BOOT_MACHINE_BIOS_HD_FLAG 0x80
+
+/* The address where the kernel is loaded. */
+#define GRUB_BOOT_MACHINE_KERNEL_ADDR (GRUB_BOOT_MACHINE_KERNEL_SEG << 4)
+
+/* The size of a block list used in the kernel startup code. */
+#define GRUB_BOOT_MACHINE_LIST_SIZE 12
+
+#define GRUB_BOOT_MACHINE_PXE_DL 0x7f
+
+/* This is the blocklist used in the diskboot image. */
+#define grub_boot_blocklist grub_pc_bios_boot_blocklist
+
+#endif /* ! BOOT_MACHINE_HEADER */
diff --git a/include/grub/i386/pc/chainloader.h b/include/grub/i386/pc/chainloader.h
new file mode 100644
index 0000000..4776b18
--- /dev/null
+++ b/include/grub/i386/pc/chainloader.h
@@ -0,0 +1,27 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2004,2007 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_CHAINLOADER_MACHINE_HEADER
+#define GRUB_CHAINLOADER_MACHINE_HEADER 1
+
+#include <grub/dl.h>
+
+void
+grub_chainloader_patch_bpb (void *bs, grub_device_t dev, grub_uint8_t dl);
+
+#endif /* GRUB_CHAINLOADER_MACHINE_HEADER */
diff --git a/include/grub/i386/pc/console.h b/include/grub/i386/pc/console.h
new file mode 100644
index 0000000..191964f
--- /dev/null
+++ b/include/grub/i386/pc/console.h
@@ -0,0 +1,36 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2002,2005,2007,2008 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_CONSOLE_MACHINE_HEADER
+#define GRUB_CONSOLE_MACHINE_HEADER 1
+
+#ifndef ASM_FILE
+
+#include <grub/types.h>
+#include <grub/symbol.h>
+#include <grub/term.h>
+
+/* Initialize the console system. */
+void grub_console_init (void);
+
+/* Finish the console system. */
+void grub_console_fini (void);
+
+#endif
+
+#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */
diff --git a/include/grub/i386/pc/int.h b/include/grub/i386/pc/int.h
new file mode 100644
index 0000000..a601040
--- /dev/null
+++ b/include/grub/i386/pc/int.h
@@ -0,0 +1,33 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2009 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_INTERRUPT_MACHINE_HEADER
+#define GRUB_INTERRUPT_MACHINE_HEADER 1
+
+#include <grub/symbol.h>
+#include <grub/i386/pc/int_types.h>
+
+void EXPORT_FUNC (grub_bios_interrupt) (grub_uint8_t intno,
+ struct grub_bios_int_registers *regs)
+ __attribute__ ((regparm(3)));
+
+#ifdef GRUB_MACHINE_PCBIOS
+extern struct grub_i386_idt *EXPORT_VAR(grub_realidt);
+#endif
+
+#endif
diff --git a/include/grub/i386/pc/int_types.h b/include/grub/i386/pc/int_types.h
new file mode 100644
index 0000000..2c5a69b
--- /dev/null
+++ b/include/grub/i386/pc/int_types.h
@@ -0,0 +1,59 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2018 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_INTERRUPT_TYPES_MACHINE_HEADER
+#define GRUB_INTERRUPT_TYPES_MACHINE_HEADER 1
+
+#include <grub/types.h>
+
+#define GRUB_CPU_INT_FLAGS_CARRY 0x1
+#define GRUB_CPU_INT_FLAGS_PARITY 0x4
+#define GRUB_CPU_INT_FLAGS_ADJUST 0x10
+#define GRUB_CPU_INT_FLAGS_ZERO 0x40
+#define GRUB_CPU_INT_FLAGS_SIGN 0x80
+#define GRUB_CPU_INT_FLAGS_TRAP 0x100
+#define GRUB_CPU_INT_FLAGS_INTERRUPT 0x200
+#define GRUB_CPU_INT_FLAGS_DIRECTION 0x400
+#define GRUB_CPU_INT_FLAGS_OVERFLOW 0x800
+#ifdef GRUB_MACHINE_PCBIOS
+#define GRUB_CPU_INT_FLAGS_DEFAULT GRUB_CPU_INT_FLAGS_INTERRUPT
+#else
+#define GRUB_CPU_INT_FLAGS_DEFAULT 0
+#endif
+
+struct grub_bios_int_registers
+{
+ grub_uint32_t eax;
+ grub_uint16_t es;
+ grub_uint16_t ds;
+ grub_uint16_t flags;
+ grub_uint16_t dummy;
+ grub_uint32_t ebx;
+ grub_uint32_t ecx;
+ grub_uint32_t edi;
+ grub_uint32_t esi;
+ grub_uint32_t edx;
+};
+
+struct grub_i386_idt
+{
+ grub_uint16_t limit;
+ grub_uint32_t base;
+} GRUB_PACKED;
+
+#endif
diff --git a/include/grub/i386/pc/kernel.h b/include/grub/i386/pc/kernel.h
new file mode 100644
index 0000000..4f05b74
--- /dev/null
+++ b/include/grub/i386/pc/kernel.h
@@ -0,0 +1,41 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2002,2003,2007,2008 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef KERNEL_MACHINE_HEADER
+#define KERNEL_MACHINE_HEADER 1
+
+#include <grub/offsets.h>
+
+/* Enable LZMA compression */
+#define ENABLE_LZMA 1
+
+#ifndef ASM_FILE
+
+#include <grub/symbol.h>
+#include <grub/types.h>
+
+/* The total size of module images following the kernel. */
+extern grub_int32_t grub_total_module_size;
+
+extern grub_uint32_t EXPORT_VAR(grub_boot_device);
+
+extern void (*EXPORT_VAR(grub_pc_net_config)) (char **device, char **path);
+
+#endif /* ! ASM_FILE */
+
+#endif /* ! KERNEL_MACHINE_HEADER */
diff --git a/include/grub/i386/pc/memory.h b/include/grub/i386/pc/memory.h
new file mode 100644
index 0000000..d0c5c20
--- /dev/null
+++ b/include/grub/i386/pc/memory.h
@@ -0,0 +1,63 @@
+/* memory.h - describe the memory map */
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2002,2007,2008,2009 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_MEMORY_MACHINE_HEADER
+#define GRUB_MEMORY_MACHINE_HEADER 1
+
+#include <grub/symbol.h>
+#ifndef ASM_FILE
+#include <grub/types.h>
+#include <grub/err.h>
+#include <grub/memory.h>
+#endif
+
+#include <grub/i386/memory.h>
+#include <grub/i386/memory_raw.h>
+
+#include <grub/offsets.h>
+
+/* The area where GRUB is decompressed at early startup. */
+#define GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR 0x100000
+
+/* The address of a partition table passed to another boot loader. */
+#define GRUB_MEMORY_MACHINE_PART_TABLE_ADDR 0x7be
+
+/* The address where another boot loader is loaded. */
+#define GRUB_MEMORY_MACHINE_BOOT_LOADER_ADDR 0x7c00
+
+#define GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR 0x400
+
+#ifndef ASM_FILE
+
+/* See http://heim.ifi.uio.no/~stanisls/helppc/bios_data_area.html for a
+ description of the BIOS Data Area layout. */
+struct grub_machine_bios_data_area
+{
+ grub_uint8_t unused1[0x17];
+ grub_uint8_t keyboard_flag_lower; /* 0x17 */
+ grub_uint8_t unused2[0xf0 - 0x18];
+};
+
+grub_err_t grub_machine_mmap_register (grub_uint64_t start, grub_uint64_t size,
+ int type, int handle);
+grub_err_t grub_machine_mmap_unregister (int handle);
+
+#endif
+
+#endif /* ! GRUB_MEMORY_MACHINE_HEADER */
diff --git a/include/grub/i386/pc/pxe.h b/include/grub/i386/pc/pxe.h
new file mode 100644
index 0000000..66002bc
--- /dev/null
+++ b/include/grub/i386/pc/pxe.h
@@ -0,0 +1,292 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2008 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_CPU_PXE_H
+#define GRUB_CPU_PXE_H
+
+#include <grub/types.h>
+
+#define GRUB_PXENV_TFTP_OPEN 0x0020
+#define GRUB_PXENV_TFTP_CLOSE 0x0021
+#define GRUB_PXENV_TFTP_READ 0x0022
+#define GRUB_PXENV_TFTP_READ_FILE 0x0023
+#define GRUB_PXENV_TFTP_READ_FILE_PMODE 0x0024
+#define GRUB_PXENV_TFTP_GET_FSIZE 0x0025
+
+#define GRUB_PXENV_UDP_OPEN 0x0030
+#define GRUB_PXENV_UDP_CLOSE 0x0031
+#define GRUB_PXENV_UDP_READ 0x0032
+#define GRUB_PXENV_UDP_WRITE 0x0033
+
+#define GRUB_PXENV_START_UNDI 0x0000
+#define GRUB_PXENV_UNDI_STARTUP 0x0001
+#define GRUB_PXENV_UNDI_CLEANUP 0x0002
+#define GRUB_PXENV_UNDI_INITIALIZE 0x0003
+#define GRUB_PXENV_UNDI_RESET_NIC 0x0004
+#define GRUB_PXENV_UNDI_SHUTDOWN 0x0005
+#define GRUB_PXENV_UNDI_OPEN 0x0006
+#define GRUB_PXENV_UNDI_CLOSE 0x0007
+#define GRUB_PXENV_UNDI_TRANSMIT 0x0008
+#define GRUB_PXENV_UNDI_SET_MCAST_ADDR 0x0009
+#define GRUB_PXENV_UNDI_SET_STATION_ADDR 0x000A
+#define GRUB_PXENV_UNDI_SET_PACKET_FILTER 0x000B
+#define GRUB_PXENV_UNDI_GET_INFORMATION 0x000C
+#define GRUB_PXENV_UNDI_GET_STATISTICS 0x000D
+#define GRUB_PXENV_UNDI_CLEAR_STATISTICS 0x000E
+#define GRUB_PXENV_UNDI_INITIATE_DIAGS 0x000F
+#define GRUB_PXENV_UNDI_FORCE_INTERRUPT 0x0010
+#define GRUB_PXENV_UNDI_GET_MCAST_ADDR 0x0011
+#define GRUB_PXENV_UNDI_GET_NIC_TYPE 0x0012
+#define GRUB_PXENV_UNDI_GET_IFACE_INFO 0x0013
+#define GRUB_PXENV_UNDI_ISR 0x0014
+#define GRUB_PXENV_STOP_UNDI 0x0015
+#define GRUB_PXENV_UNDI_GET_STATE 0x0015
+
+#define GRUB_PXENV_UNLOAD_STACK 0x0070
+#define GRUB_PXENV_GET_CACHED_INFO 0x0071
+#define GRUB_PXENV_RESTART_DHCP 0x0072
+#define GRUB_PXENV_RESTART_TFTP 0x0073
+#define GRUB_PXENV_MODE_SWITCH 0x0074
+#define GRUB_PXENV_START_BASE 0x0075
+#define GRUB_PXENV_STOP_BASE 0x0076
+
+#define GRUB_PXENV_EXIT_SUCCESS 0x0000
+#define GRUB_PXENV_EXIT_FAILURE 0x0001
+
+#define GRUB_PXENV_STATUS_SUCCESS 0x00
+#define GRUB_PXENV_STATUS_FAILURE 0x01
+#define GRUB_PXENV_STATUS_BAD_FUNC 0x02
+#define GRUB_PXENV_STATUS_UNSUPPORTED 0x03
+#define GRUB_PXENV_STATUS_KEEP_UNDI 0x04
+#define GRUB_PXENV_STATUS_KEEP_ALL 0x05
+#define GRUB_PXENV_STATUS_OUT_OF_RESOURCES 0x06
+#define GRUB_PXENV_STATUS_ARP_TIMEOUT 0x11
+#define GRUB_PXENV_STATUS_UDP_CLOSED 0x18
+#define GRUB_PXENV_STATUS_UDP_OPEN 0x19
+#define GRUB_PXENV_STATUS_TFTP_CLOSED 0x1A
+#define GRUB_PXENV_STATUS_TFTP_OPEN 0x1B
+#define GRUB_PXENV_STATUS_MCOPY_PROBLEM 0x20
+#define GRUB_PXENV_STATUS_BIS_INTEGRITY_FAILURE 0x21
+#define GRUB_PXENV_STATUS_BIS_VALIDATE_FAILURE 0x22
+#define GRUB_PXENV_STATUS_BIS_INIT_FAILURE 0x23
+#define GRUB_PXENV_STATUS_BIS_SHUTDOWN_FAILURE 0x24
+#define GRUB_PXENV_STATUS_BIS_GBOA_FAILURE 0x25
+#define GRUB_PXENV_STATUS_BIS_FREE_FAILURE 0x26
+#define GRUB_PXENV_STATUS_BIS_GSI_FAILURE 0x27
+#define GRUB_PXENV_STATUS_BIS_BAD_CKSUM 0x28
+#define GRUB_PXENV_STATUS_TFTP_CANNOT_ARP_ADDRESS 0x30
+#define GRUB_PXENV_STATUS_TFTP_OPEN_TIMEOUT 0x32
+
+#define GRUB_PXENV_STATUS_TFTP_UNKNOWN_OPCODE 0x33
+#define GRUB_PXENV_STATUS_TFTP_READ_TIMEOUT 0x35
+#define GRUB_PXENV_STATUS_TFTP_ERROR_OPCODE 0x36
+#define GRUB_PXENV_STATUS_TFTP_CANNOT_OPEN_CONNECTION 0x38
+#define GRUB_PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION 0x39
+#define GRUB_PXENV_STATUS_TFTP_TOO_MANY_PACKAGES 0x3A
+#define GRUB_PXENV_STATUS_TFTP_FILE_NOT_FOUND 0x3B
+#define GRUB_PXENV_STATUS_TFTP_ACCESS_VIOLATION 0x3C
+#define GRUB_PXENV_STATUS_TFTP_NO_MCAST_ADDRESS 0x3D
+#define GRUB_PXENV_STATUS_TFTP_NO_FILESIZE 0x3E
+#define GRUB_PXENV_STATUS_TFTP_INVALID_PACKET_SIZE 0x3F
+#define GRUB_PXENV_STATUS_DHCP_TIMEOUT 0x51
+#define GRUB_PXENV_STATUS_DHCP_NO_IP_ADDRESS 0x52
+#define GRUB_PXENV_STATUS_DHCP_NO_BOOTFILE_NAME 0x53
+#define GRUB_PXENV_STATUS_DHCP_BAD_IP_ADDRESS 0x54
+#define GRUB_PXENV_STATUS_UNDI_INVALID_FUNCTION 0x60
+#define GRUB_PXENV_STATUS_UNDI_MEDIATEST_FAILED 0x61
+#define GRUB_PXENV_STATUS_UNDI_CANNOT_INIT_NIC_FOR_MCAST 0x62
+#define GRUB_PXENV_STATUS_UNDI_CANNOT_INITIALIZE_NIC 0x63
+#define GRUB_PXENV_STATUS_UNDI_CANNOT_INITIALIZE_PHY 0x64
+#define GRUB_PXENV_STATUS_UNDI_CANNOT_READ_CONFIG_DATA 0x65
+#define GRUB_PXENV_STATUS_UNDI_CANNOT_READ_INIT_DATA 0x66
+#define GRUB_PXENV_STATUS_UNDI_BAD_MAC_ADDRESS 0x67
+#define GRUB_PXENV_STATUS_UNDI_BAD_EEPROM_CHECKSUM 0x68
+#define GRUB_PXENV_STATUS_UNDI_ERROR_SETTING_ISR 0x69
+#define GRUB_PXENV_STATUS_UNDI_INVALID_STATE 0x6A
+#define GRUB_PXENV_STATUS_UNDI_TRANSMIT_ERROR 0x6B
+#define GRUB_PXENV_STATUS_UNDI_INVALID_PARAMETER 0x6C
+#define GRUB_PXENV_STATUS_BSTRAP_PROMPT_MENU 0x74
+#define GRUB_PXENV_STATUS_BSTRAP_MCAST_ADDR 0x76
+#define GRUB_PXENV_STATUS_BSTRAP_MISSING_LIST 0x77
+#define GRUB_PXENV_STATUS_BSTRAP_NO_RESPONSE 0x78
+#define GRUB_PXENV_STATUS_BSTRAP_FILE_TOO_BIG 0x79
+#define GRUB_PXENV_STATUS_BINL_CANCELED_BY_KEYSTROKE 0xA0
+#define GRUB_PXENV_STATUS_BINL_NO_PXE_SERVER 0xA1
+#define GRUB_PXENV_STATUS_NOT_AVAILABLE_IN_PMODE 0xA2
+#define GRUB_PXENV_STATUS_NOT_AVAILABLE_IN_RMODE 0xA3
+#define GRUB_PXENV_STATUS_BUSD_DEVICE_NOT_SUPPORTED 0xB0
+#define GRUB_PXENV_STATUS_LOADER_NO_FREE_BASE_MEMORY 0xC0
+#define GRUB_PXENV_STATUS_LOADER_NO_BC_ROMID 0xC1
+#define GRUB_PXENV_STATUS_LOADER_BAD_BC_ROMID 0xC2
+#define GRUB_PXENV_STATUS_LOADER_BAD_BC_RUNTIME_IMAGE 0xC3
+#define GRUB_PXENV_STATUS_LOADER_NO_UNDI_ROMID 0xC4
+#define GRUB_PXENV_STATUS_LOADER_BAD_UNDI_ROMID 0xC5
+#define GRUB_PXENV_STATUS_LOADER_BAD_UNDI_DRIVER_IMAGE 0xC6
+#define GRUB_PXENV_STATUS_LOADER_NO_PXE_STRUCT 0xC8
+#define GRUB_PXENV_STATUS_LOADER_NO_PXENV_STRUCT 0xC9
+#define GRUB_PXENV_STATUS_LOADER_UNDI_START 0xCA
+#define GRUB_PXENV_STATUS_LOADER_BC_START 0xCB
+
+#define GRUB_PXENV_PACKET_TYPE_DHCP_DISCOVER 1
+#define GRUB_PXENV_PACKET_TYPE_DHCP_ACK 2
+#define GRUB_PXENV_PACKET_TYPE_CACHED_REPLY 3
+
+#define GRUB_PXE_BOOTP_REQ 1
+#define GRUB_PXE_BOOTP_REP 2
+
+#define GRUB_PXE_BOOTP_BCAST 0x8000
+
+#if 1
+#define GRUB_PXE_BOOTP_SIZE (1024 + 236) /* DHCP extended vendor field size. */
+#else
+#define GRUB_PXE_BOOTP_SIZE (312 + 236) /* DHCP standard vendor field size. */
+#endif
+
+#define GRUB_PXE_TFTP_PORT 69
+
+#define GRUB_PXE_ERR_LEN 0xFFFFFFFF
+
+#ifndef ASM_FILE
+
+#define GRUB_PXE_SIGNATURE "PXENV+"
+
+struct grub_pxenv
+{
+ grub_uint8_t signature[6]; /* 'PXENV+'. */
+ grub_uint16_t version; /* MSB = major, LSB = minor. */
+ grub_uint8_t length; /* structure length. */
+ grub_uint8_t checksum; /* checksum pad. */
+ grub_uint32_t rm_entry; /* SEG:OFF to PXE entry point. */
+ grub_uint32_t pm_offset; /* Protected mode entry. */
+ grub_uint16_t pm_selector; /* Protected mode selector. */
+ grub_uint16_t stack_seg; /* Stack segment address. */
+ grub_uint16_t stack_size; /* Stack segment size (bytes). */
+ grub_uint16_t bc_code_seg; /* BC Code segment address. */
+ grub_uint16_t bc_code_size; /* BC Code segment size (bytes). */
+ grub_uint16_t bc_data_seg; /* BC Data segment address. */
+ grub_uint16_t bc_data_size; /* BC Data segment size (bytes). */
+ grub_uint16_t undi_data_seg; /* UNDI Data segment address. */
+ grub_uint16_t undi_data_size; /* UNDI Data segment size (bytes). */
+ grub_uint16_t undi_code_seg; /* UNDI Code segment address. */
+ grub_uint16_t undi_code_size; /* UNDI Code segment size (bytes). */
+ grub_uint32_t pxe_ptr; /* SEG:OFF to !PXE struct. */
+} GRUB_PACKED;
+
+struct grub_pxe_bangpxe
+{
+ grub_uint8_t signature[4];
+#define GRUB_PXE_BANGPXE_SIGNATURE "!PXE"
+ grub_uint8_t length;
+ grub_uint8_t chksum;
+ grub_uint8_t rev;
+ grub_uint8_t reserved;
+ grub_uint32_t undiromid;
+ grub_uint32_t baseromid;
+ grub_uint32_t rm_entry;
+} GRUB_PACKED;
+
+struct grub_pxenv_get_cached_info
+{
+ grub_uint16_t status;
+ grub_uint16_t packet_type;
+ grub_uint16_t buffer_size;
+ grub_uint32_t buffer;
+ grub_uint16_t buffer_limit;
+} GRUB_PACKED;
+
+struct grub_pxenv_tftp_open
+{
+ grub_uint16_t status;
+ grub_uint32_t server_ip;
+ grub_uint32_t gateway_ip;
+ grub_uint8_t filename[128];
+ grub_uint16_t tftp_port;
+ grub_uint16_t packet_size;
+} GRUB_PACKED;
+
+struct grub_pxenv_tftp_close
+{
+ grub_uint16_t status;
+} GRUB_PACKED;
+
+struct grub_pxenv_tftp_read
+{
+ grub_uint16_t status;
+ grub_uint16_t packet_number;
+ grub_uint16_t buffer_size;
+ grub_uint32_t buffer;
+} GRUB_PACKED;
+
+struct grub_pxenv_tftp_get_fsize
+{
+ grub_uint16_t status;
+ grub_uint32_t server_ip;
+ grub_uint32_t gateway_ip;
+ grub_uint8_t filename[128];
+ grub_uint32_t file_size;
+} GRUB_PACKED;
+
+struct grub_pxenv_udp_open
+{
+ grub_uint16_t status;
+ grub_uint32_t src_ip;
+} GRUB_PACKED;
+
+struct grub_pxenv_udp_close
+{
+ grub_uint16_t status;
+} GRUB_PACKED;
+
+struct grub_pxenv_udp_write
+{
+ grub_uint16_t status;
+ grub_uint32_t ip;
+ grub_uint32_t gateway;
+ grub_uint16_t src_port;
+ grub_uint16_t dst_port;
+ grub_uint16_t buffer_size;
+ grub_uint32_t buffer;
+} GRUB_PACKED;
+
+struct grub_pxenv_udp_read
+{
+ grub_uint16_t status;
+ grub_uint32_t src_ip;
+ grub_uint32_t dst_ip;
+ grub_uint16_t src_port;
+ grub_uint16_t dst_port;
+ grub_uint16_t buffer_size;
+ grub_uint32_t buffer;
+} GRUB_PACKED;
+
+struct grub_pxenv_unload_stack
+{
+ grub_uint16_t status;
+ grub_uint8_t reserved[10];
+} GRUB_PACKED;
+
+int EXPORT_FUNC(grub_pxe_call) (int func, void * data, grub_uint32_t pxe_rm_entry) __attribute__ ((regparm(3)));
+
+extern struct grub_pxe_bangpxe *grub_pxe_pxenv;
+
+void *
+grub_pxe_get_cached (grub_uint16_t type);
+
+#endif
+
+#endif /* GRUB_CPU_PXE_H */
diff --git a/include/grub/i386/pc/time.h b/include/grub/i386/pc/time.h
new file mode 100644
index 0000000..e93320f
--- /dev/null
+++ b/include/grub/i386/pc/time.h
@@ -0,0 +1,24 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2003,2004,2005,2007 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef KERNEL_MACHINE_TIME_HEADER
+#define KERNEL_MACHINE_TIME_HEADER 1
+
+#include <grub/symbol.h>
+
+#endif /* ! KERNEL_MACHINE_TIME_HEADER */
diff --git a/include/grub/i386/pc/vbe.h b/include/grub/i386/pc/vbe.h
new file mode 100644
index 0000000..f349b5c
--- /dev/null
+++ b/include/grub/i386/pc/vbe.h
@@ -0,0 +1,232 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_VBE_MACHINE_HEADER
+#define GRUB_VBE_MACHINE_HEADER 1
+
+#include <grub/video.h>
+
+/* Default video mode to be used. */
+#define GRUB_VBE_DEFAULT_VIDEO_MODE 0x101
+
+/* VBE status codes. */
+#define GRUB_VBE_STATUS_OK 0x004f
+
+#define GRUB_VBE_CAPABILITY_DACWIDTH (1 << 0)
+
+/* Bits from the GRUB_VBE "mode_attributes" field in the mode info struct. */
+#define GRUB_VBE_MODEATTR_SUPPORTED (1 << 0)
+#define GRUB_VBE_MODEATTR_RESERVED_1 (1 << 1)
+#define GRUB_VBE_MODEATTR_BIOS_TTY_OUTPUT_SUPPORT (1 << 2)
+#define GRUB_VBE_MODEATTR_COLOR (1 << 3)
+#define GRUB_VBE_MODEATTR_GRAPHICS (1 << 4)
+#define GRUB_VBE_MODEATTR_VGA_COMPATIBLE (1 << 5)
+#define GRUB_VBE_MODEATTR_VGA_WINDOWED_AVAIL (1 << 6)
+#define GRUB_VBE_MODEATTR_LFB_AVAIL (1 << 7)
+#define GRUB_VBE_MODEATTR_DOUBLE_SCAN_AVAIL (1 << 8)
+#define GRUB_VBE_MODEATTR_INTERLACED_AVAIL (1 << 9)
+#define GRUB_VBE_MODEATTR_TRIPLE_BUF_AVAIL (1 << 10)
+#define GRUB_VBE_MODEATTR_STEREO_AVAIL (1 << 11)
+#define GRUB_VBE_MODEATTR_DUAL_DISPLAY_START (1 << 12)
+
+/* Values for the GRUB_VBE memory_model field in the mode info struct. */
+#define GRUB_VBE_MEMORY_MODEL_TEXT 0x00
+#define GRUB_VBE_MEMORY_MODEL_CGA 0x01
+#define GRUB_VBE_MEMORY_MODEL_HERCULES 0x02
+#define GRUB_VBE_MEMORY_MODEL_PLANAR 0x03
+#define GRUB_VBE_MEMORY_MODEL_PACKED_PIXEL 0x04
+#define GRUB_VBE_MEMORY_MODEL_NONCHAIN4_256 0x05
+#define GRUB_VBE_MEMORY_MODEL_DIRECT_COLOR 0x06
+#define GRUB_VBE_MEMORY_MODEL_YUV 0x07
+
+/* Note:
+
+ Please refer to VESA BIOS Extension 3.0 Specification for more descriptive
+ meanings of following structures and how they should be used.
+
+ I have tried to maintain field name compatibility against specification
+ while following naming conventions used in GRUB. */
+
+typedef grub_uint32_t grub_vbe_farptr_t;
+typedef grub_uint32_t grub_vbe_physptr_t;
+typedef grub_uint32_t grub_vbe_status_t;
+
+struct grub_vbe_info_block
+{
+ grub_uint8_t signature[4];
+ grub_uint16_t version;
+
+ grub_vbe_farptr_t oem_string_ptr;
+ grub_uint32_t capabilities;
+ grub_vbe_farptr_t video_mode_ptr;
+ grub_uint16_t total_memory;
+
+ grub_uint16_t oem_software_rev;
+ grub_vbe_farptr_t oem_vendor_name_ptr;
+ grub_vbe_farptr_t oem_product_name_ptr;
+ grub_vbe_farptr_t oem_product_rev_ptr;
+
+ grub_uint8_t reserved[222];
+
+ grub_uint8_t oem_data[256];
+} GRUB_PACKED;
+
+struct grub_vbe_mode_info_block
+{
+ /* Mandatory information for all VBE revisions. */
+ grub_uint16_t mode_attributes;
+ grub_uint8_t win_a_attributes;
+ grub_uint8_t win_b_attributes;
+ grub_uint16_t win_granularity;
+ grub_uint16_t win_size;
+ grub_uint16_t win_a_segment;
+ grub_uint16_t win_b_segment;
+ grub_vbe_farptr_t win_func_ptr;
+ grub_uint16_t bytes_per_scan_line;
+
+ /* Mandatory information for VBE 1.2 and above. */
+ grub_uint16_t x_resolution;
+ grub_uint16_t y_resolution;
+ grub_uint8_t x_char_size;
+ grub_uint8_t y_char_size;
+ grub_uint8_t number_of_planes;
+ grub_uint8_t bits_per_pixel;
+ grub_uint8_t number_of_banks;
+ grub_uint8_t memory_model;
+ grub_uint8_t bank_size;
+ grub_uint8_t number_of_image_pages;
+ grub_uint8_t reserved;
+
+ /* Direct Color fields (required for direct/6 and YUV/7 memory models). */
+ grub_uint8_t red_mask_size;
+ grub_uint8_t red_field_position;
+ grub_uint8_t green_mask_size;
+ grub_uint8_t green_field_position;
+ grub_uint8_t blue_mask_size;
+ grub_uint8_t blue_field_position;
+ grub_uint8_t rsvd_mask_size;
+ grub_uint8_t rsvd_field_position;
+ grub_uint8_t direct_color_mode_info;
+
+ /* Mandatory information for VBE 2.0 and above. */
+ grub_vbe_physptr_t phys_base_addr;
+ grub_uint32_t reserved2;
+ grub_uint16_t reserved3;
+
+ /* Mandatory information for VBE 3.0 and above. */
+ grub_uint16_t lin_bytes_per_scan_line;
+ grub_uint8_t bnk_number_of_image_pages;
+ grub_uint8_t lin_number_of_image_pages;
+ grub_uint8_t lin_red_mask_size;
+ grub_uint8_t lin_red_field_position;
+ grub_uint8_t lin_green_mask_size;
+ grub_uint8_t lin_green_field_position;
+ grub_uint8_t lin_blue_mask_size;
+ grub_uint8_t lin_blue_field_position;
+ grub_uint8_t lin_rsvd_mask_size;
+ grub_uint8_t lin_rsvd_field_position;
+ grub_uint32_t max_pixel_clock;
+
+ /* Reserved field to make structure to be 256 bytes long, VESA BIOS
+ Extension 3.0 Specification says to reserve 189 bytes here but
+ that doesn't make structure to be 256 bytes. So additional one is
+ added here. */
+ grub_uint8_t reserved4[189 + 1];
+} GRUB_PACKED;
+
+struct grub_vbe_crtc_info_block
+{
+ grub_uint16_t horizontal_total;
+ grub_uint16_t horizontal_sync_start;
+ grub_uint16_t horizontal_sync_end;
+ grub_uint16_t vertical_total;
+ grub_uint16_t vertical_sync_start;
+ grub_uint16_t vertical_sync_end;
+ grub_uint8_t flags;
+ grub_uint32_t pixel_clock;
+ grub_uint16_t refresh_rate;
+ grub_uint8_t reserved[40];
+} GRUB_PACKED;
+
+struct grub_vbe_palette_data
+{
+ grub_uint8_t blue;
+ grub_uint8_t green;
+ grub_uint8_t red;
+ grub_uint8_t alignment;
+} GRUB_PACKED;
+
+struct grub_vbe_flat_panel_info
+{
+ grub_uint16_t horizontal_size;
+ grub_uint16_t vertical_size;
+ grub_uint16_t panel_type;
+ grub_uint8_t red_bpp;
+ grub_uint8_t green_bpp;
+ grub_uint8_t blue_bpp;
+ grub_uint8_t reserved_bpp;
+ grub_uint32_t reserved_offscreen_mem_size;
+ grub_vbe_farptr_t reserved_offscreen_mem_ptr;
+
+ grub_uint8_t reserved[14];
+} GRUB_PACKED;
+
+/* Prototypes for helper functions. */
+/* Call VESA BIOS 0x4f00 to get VBE Controller Information, return status. */
+grub_vbe_status_t
+grub_vbe_bios_get_controller_info (struct grub_vbe_info_block *controller_info);
+/* Call VESA BIOS 0x4f01 to get VBE Mode Information, return status. */
+grub_vbe_status_t
+grub_vbe_bios_get_mode_info (grub_uint32_t mode,
+ struct grub_vbe_mode_info_block *mode_info);
+/* Call VESA BIOS 0x4f03 to return current VBE Mode, return status. */
+grub_vbe_status_t
+grub_vbe_bios_get_mode (grub_uint32_t *mode);
+/* Call VESA BIOS 0x4f05 to set memory window, return status. */
+grub_vbe_status_t
+grub_vbe_bios_set_memory_window (grub_uint32_t window, grub_uint32_t position);
+/* Call VESA BIOS 0x4f05 to return memory window, return status. */
+grub_vbe_status_t
+grub_vbe_bios_get_memory_window (grub_uint32_t window,
+ grub_uint32_t *position);
+/* Call VESA BIOS 0x4f06 to set scanline length (in bytes), return status. */
+grub_vbe_status_t
+grub_vbe_bios_set_scanline_length (grub_uint32_t length);
+/* Call VESA BIOS 0x4f06 to return scanline length (in bytes), return status. */
+grub_vbe_status_t
+grub_vbe_bios_get_scanline_length (grub_uint32_t *length);
+/* Call VESA BIOS 0x4f07 to get display start, return status. */
+grub_vbe_status_t
+grub_vbe_bios_get_display_start (grub_uint32_t *x,
+ grub_uint32_t *y);
+
+grub_vbe_status_t grub_vbe_bios_getset_dac_palette_width (int set, int *width);
+
+#define grub_vbe_bios_get_dac_palette_width(width) grub_vbe_bios_getset_dac_palette_width(0, (width))
+#define grub_vbe_bios_set_dac_palette_width(width) grub_vbe_bios_getset_dac_palette_width(1, (width))
+
+grub_err_t grub_vbe_probe (struct grub_vbe_info_block *info_block);
+grub_err_t grub_vbe_get_video_mode (grub_uint32_t *mode);
+grub_err_t grub_vbe_get_video_mode_info (grub_uint32_t mode,
+ struct grub_vbe_mode_info_block *mode_info);
+grub_vbe_status_t
+grub_vbe_bios_get_pm_interface (grub_uint16_t *seg, grub_uint16_t *offset,
+ grub_uint16_t *length);
+
+
+#endif /* ! GRUB_VBE_MACHINE_HEADER */
diff --git a/include/grub/i386/pc/vesa_modes_table.h b/include/grub/i386/pc/vesa_modes_table.h
new file mode 100644
index 0000000..376ca37
--- /dev/null
+++ b/include/grub/i386/pc/vesa_modes_table.h
@@ -0,0 +1,19 @@
+#ifndef GRUB_VESA_MODE_TABLE_HEADER
+#define GRUB_VESA_MODE_TABLE_HEADER 1
+
+#include <grub/types.h>
+
+#define GRUB_VESA_MODE_TABLE_START 0x300
+#define GRUB_VESA_MODE_TABLE_END 0x373
+
+struct grub_vesa_mode_table_entry {
+ grub_uint16_t width;
+ grub_uint16_t height;
+ grub_uint8_t depth;
+};
+
+extern struct grub_vesa_mode_table_entry
+grub_vesa_mode_table[GRUB_VESA_MODE_TABLE_END
+ - GRUB_VESA_MODE_TABLE_START + 1];
+
+#endif
diff --git a/include/grub/i386/pci.h b/include/grub/i386/pci.h
new file mode 100644
index 0000000..dffeb56
--- /dev/null
+++ b/include/grub/i386/pci.h
@@ -0,0 +1,105 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2008,2009 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_CPU_PCI_H
+#define GRUB_CPU_PCI_H 1
+
+#include <grub/types.h>
+#include <grub/i386/io.h>
+
+#define GRUB_MACHINE_PCI_IO_BASE 0
+#define GRUB_PCI_ADDR_REG 0xcf8
+#define GRUB_PCI_DATA_REG 0xcfc
+#define GRUB_PCI_NUM_BUS 256
+#define GRUB_PCI_NUM_DEVICES 32
+
+static inline grub_uint32_t
+grub_pci_read (grub_pci_address_t addr)
+{
+ grub_outl (addr, GRUB_PCI_ADDR_REG);
+ return grub_inl (GRUB_PCI_DATA_REG);
+}
+
+static inline grub_uint16_t
+grub_pci_read_word (grub_pci_address_t addr)
+{
+ grub_outl (addr & ~3, GRUB_PCI_ADDR_REG);
+ return grub_inw (GRUB_PCI_DATA_REG + (addr & 3));
+}
+
+static inline grub_uint8_t
+grub_pci_read_byte (grub_pci_address_t addr)
+{
+ grub_outl (addr & ~3, GRUB_PCI_ADDR_REG);
+ return grub_inb (GRUB_PCI_DATA_REG + (addr & 3));
+}
+
+static inline void
+grub_pci_write (grub_pci_address_t addr, grub_uint32_t data)
+{
+ grub_outl (addr, GRUB_PCI_ADDR_REG);
+ grub_outl (data, GRUB_PCI_DATA_REG);
+}
+
+static inline void
+grub_pci_write_word (grub_pci_address_t addr, grub_uint16_t data)
+{
+ grub_outl (addr & ~3, GRUB_PCI_ADDR_REG);
+ grub_outw (data, GRUB_PCI_DATA_REG + (addr & 3));
+}
+
+static inline void
+grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data)
+{
+ grub_outl (addr & ~3, GRUB_PCI_ADDR_REG);
+ grub_outb (data, GRUB_PCI_DATA_REG + (addr & 3));
+}
+
+#ifndef GRUB_MACHINE_IEEE1275
+
+static inline volatile void *
+grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
+ grub_addr_t base,
+ grub_size_t size __attribute__ ((unused)))
+{
+ return (volatile void *) base;
+}
+
+static inline void
+grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
+ volatile void *mem __attribute__ ((unused)),
+ grub_size_t size __attribute__ ((unused)))
+{
+}
+
+#else
+
+volatile void *
+grub_pci_device_map_range (grub_pci_device_t dev,
+ grub_addr_t base,
+ grub_size_t size);
+
+void
+grub_pci_device_unmap_range (grub_pci_device_t dev,
+ volatile void *mem,
+ grub_size_t size);
+
+#endif
+
+
+#endif /* GRUB_CPU_PCI_H */