summaryrefslogtreecommitdiffstats
path: root/grub-core/lib/i386/pc
diff options
context:
space:
mode:
Diffstat (limited to 'grub-core/lib/i386/pc')
-rw-r--r--grub-core/lib/i386/pc/biosnum.c47
-rw-r--r--grub-core/lib/i386/pc/vesa_modes_table.c127
2 files changed, 174 insertions, 0 deletions
diff --git a/grub-core/lib/i386/pc/biosnum.c b/grub-core/lib/i386/pc/biosnum.c
new file mode 100644
index 0000000..0f0e743
--- /dev/null
+++ b/grub-core/lib/i386/pc/biosnum.c
@@ -0,0 +1,47 @@
+/*
+ * 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/>.
+ */
+
+#include <grub/env.h>
+#include <grub/misc.h>
+#include <grub/disk.h>
+#include <grub/machine/biosnum.h>
+
+static int
+grub_get_root_biosnumber_default (void)
+{
+ const char *biosnum;
+ int ret = -1;
+ grub_device_t dev;
+
+ biosnum = grub_env_get ("biosnum");
+
+ if (biosnum)
+ return grub_strtoul (biosnum, 0, 0);
+
+ dev = grub_device_open (0);
+ if (dev && dev->disk && dev->disk->dev
+ && dev->disk->dev->id == GRUB_DISK_DEVICE_BIOSDISK_ID)
+ ret = (int) dev->disk->id;
+
+ if (dev)
+ grub_device_close (dev);
+
+ return ret;
+}
+
+int (*grub_get_root_biosnumber) (void) = grub_get_root_biosnumber_default;
diff --git a/grub-core/lib/i386/pc/vesa_modes_table.c b/grub-core/lib/i386/pc/vesa_modes_table.c
new file mode 100644
index 0000000..6dc4b7d
--- /dev/null
+++ b/grub-core/lib/i386/pc/vesa_modes_table.c
@@ -0,0 +1,127 @@
+
+#include <grub/i386/pc/vesa_modes_table.h>
+
+/* This is the reverse of the table in [linux]/Documentation/fb/vesafb.txt
+ plus a few more modes based on the table in
+ http://en.wikipedia.org/wiki/VESA_BIOS_Extensions */
+struct grub_vesa_mode_table_entry
+grub_vesa_mode_table[GRUB_VESA_MODE_TABLE_END
+ - GRUB_VESA_MODE_TABLE_START + 1] =
+ {
+ { 640, 400, 8 }, /* 0x300 */
+ { 640, 480, 8 }, /* 0x301 */
+ { 800, 600, 4 }, /* 0x302 */
+ { 800, 600, 8 }, /* 0x303 */
+ { 1024, 768, 4 }, /* 0x304 */
+ { 1024, 768, 8 }, /* 0x305 */
+ { 1280, 1024, 4 }, /* 0x306 */
+ { 1280, 1024, 8 }, /* 0x307 */
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 320, 200, 15 }, /* 0x30d */
+ { 320, 200, 16 }, /* 0x30e */
+ { 320, 200, 24 }, /* 0x30f */
+ { 640, 480, 15 }, /* 0x310 */
+ { 640, 480, 16 }, /* 0x311 */
+ { 640, 480, 24 }, /* 0x312 */
+ { 800, 600, 15 }, /* 0x313 */
+ { 800, 600, 16 }, /* 0x314 */
+ { 800, 600, 24 }, /* 0x315 */
+ { 1024, 768, 15 }, /* 0x316 */
+ { 1024, 768, 16 }, /* 0x317 */
+ { 1024, 768, 24 }, /* 0x318 */
+ { 1280, 1024, 15 }, /* 0x319 */
+ { 1280, 1024, 16 }, /* 0x31a */
+ { 1280, 1024, 24 }, /* 0x31b */
+ { 1600, 1200, 8 }, /* 0x31c */
+ { 1600, 1200, 15 }, /* 0x31d */
+ { 1600, 1200, 16 }, /* 0x31e */
+ { 1600, 1200, 24 }, /* 0x31f */
+ { 0, 0, 0 },
+ { 640, 400, 15 }, /* 0x321 */
+ { 640, 400, 16 }, /* 0x322 */
+ { 640, 400, 24 }, /* 0x323 */
+ { 640, 400, 32 }, /* 0x324 */
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 640, 480, 32 }, /* 0x329 */
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 896, 672, 8 }, /* 0x32f */
+ { 896, 672, 15 }, /* 0x330 */
+ { 896, 672, 16 }, /* 0x331 */
+ { 896, 672, 24 }, /* 0x332 */
+ { 896, 672, 32 }, /* 0x333 */
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 1600, 1200, 32 }, /* 0x342 */
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 0, 0, 0 },
+ { 1440, 900, 8 }, /* 0x360 */
+ { 1440, 900, 15 }, /* 0x361 */
+ { 1440, 900, 16 }, /* 0x362 */
+ { 1440, 900, 24 }, /* 0x363 */
+ { 1440, 900, 32 }, /* 0x364 */
+ { 1152, 720, 8 }, /* 0x365 */
+ { 1152, 720, 15 }, /* 0x366 */
+ { 1152, 720, 16 }, /* 0x367 */
+ { 1152, 720, 24 }, /* 0x368 */
+ { 1152, 720, 32 }, /* 0x369 */
+ { 1024, 640, 8 }, /* 0x36a */
+ { 1024, 640, 15 }, /* 0x36b */
+ { 1024, 640, 16 }, /* 0x36c */
+ { 1024, 640, 24 }, /* 0x36d */
+ { 1024, 640, 32 }, /* 0x36e */
+ { 800, 500, 8 }, /* 0x36f */
+ { 800, 500, 15 }, /* 0x370 */
+ { 800, 500, 16 }, /* 0x371 */
+ { 800, 500, 24 }, /* 0x372 */
+ { 800, 500, 32 }, /* 0x373 */
+ };