fwcfg: Drop support
diff --git a/CONFIG.md b/CONFIG.md
index d348bf4d..0a80c26e 100644
--- a/CONFIG.md
+++ b/CONFIG.md
@@ -6,12 +6,6 @@ Limine scans for a config file on *the boot drive*. Every partition on the boot
is scanned sequentially (first partition first, last partition last) for the presence
of either a `/limine.cfg`, `/boot/limine.cfg`, or a `/EFI/BOOT/limine.cfg` file, in that order.
-If no config file is found in the aforementioned locations, Limine looks for the file on the fw_cfg
-interface called `opt/org.limine-bootloader.config`. If that is not present and the kernel is found at
-`opt/org.limine-bootloader.kernel`, Limine enters the so-called "simple mode", where the kernel is loaded from
-`opt/org.limine-bootloader.kernel`, and, (if present), the background is loaded from
-`opt/org.limine-bootloader.background`.
-
Once the file is located, Limine will use it as its config file. Other possible
candidates in subsequent partitions or directories are ignored.
@@ -168,7 +162,6 @@ A resource can be one of the following:
* `uuid` - Alias of `guid`.
* `fslabel` - The `root` is the name of the filesystem label of a partition.
* `tftp` - The `root` is the IP address of the tftp server to load the file from. If the root is left empty (`tftp:///...`) the file will be loaded from the server Limine booted from. This resource is only available when booting off PXE.
-* `fwcfg` - The `root` must be empty. The `path` refers to a fw_cfg filename to be loaded. The canonical place to put fw_cfg files is in the `opt/fqdn.<name>` namespace.
A URI can optionally be prefixed by a `$` character to indicate that the file
pointed to be the URI is a gzip-compressed payload to be uncompressed on the
diff --git a/GNUmakefile.in b/GNUmakefile.in
index ad96e4ca..825529c6 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -289,30 +289,6 @@ echfs-test:
$(BINDIR)/limine-deploy test.hdd
qemu-system-x86_64 -net none -smp 4 -hda test.hdd -debugcon stdio
-.PHONY: fwcfg-common fwcfg-test fwcfg-simple-test
-fwcfg-common:
- $(MAKE) test-clean
- $(MAKE) limine-bios
- $(MAKE) limine-deploy
- $(MAKE) -C test
- rm -rf test_image/
- mkdir -p test_image/boot
- cp -rv $(BINDIR)/* test_image/boot/
- xorriso -as mkisofs -b boot/limine-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table test_image/ -o test.iso
-
-fwcfg-simple-test:
- $(MAKE) fwcfg-common
- qemu-system-x86_64 -net none -smp 4 -cdrom test.iso -debugcon stdio \
- -fw_cfg opt/org.limine-bootloader.background,file=test/bg.bmp \
- -fw_cfg opt/org.limine-bootloader.kernel,file=test/test.elf
-
-fwcfg-test:
- $(MAKE) fwcfg-common
- qemu-system-x86_64 -net none -smp 4 -cdrom test.iso -debugcon stdio \
- -fw_cfg opt/org.limine-bootloader.config,file=test/limine-fwcfg.cfg \
- -fw_cfg opt/org.limine-bootloader.background,file=test/bg.bmp \
- -fw_cfg opt/org.limine-bootloader.kernel,file=test/test.elf
-
.PHONY: ext2-test
ext2-test:
$(MAKE) test-clean
diff --git a/common/drivers/fwcfg.h b/common/drivers/fwcfg.h
deleted file mode 100644
index c6048e11..00000000
--- a/common/drivers/fwcfg.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __DRIVERS__FWCFG_H__
-#define __DRIVERS__FWCFG_H__
-
-#include <stdint.h>
-#include <lib/blib.h>
-#include <lib/libc.h>
-
-bool fwcfg_open(struct file_handle *handle, const char *name);
-
-#endif
diff --git a/common/drivers/fwcfg.s2.c b/common/drivers/fwcfg.s2.c
deleted file mode 100644
index b20c7fa5..00000000
--- a/common/drivers/fwcfg.s2.c
+++ /dev/null
@@ -1,100 +0,0 @@
-#include <stdint.h>
-#include <lib/libc.h>
-#include <lib/print.h>
-#include <mm/pmm.h>
-#include <lib/blib.h>
-#include <sys/cpu.h>
-
-struct dma_descr {
- uint32_t control;
- uint32_t length;
- uint64_t address;
-};
-
-struct fw_cfg_file {
- uint32_t size;
- uint16_t select;
- uint16_t reserved;
- char name[56];
-};
-struct fw_cfg_files {
- uint32_t count;
- struct fw_cfg_file f[];
-};
-
-static uint16_t bswap16(uint16_t value) {
- uint8_t* value_ptr = (uint8_t*)&value;
- return value_ptr[0]<<8|value_ptr[1];
-}
-
-static uint32_t bswap32(uint32_t value) {
- uint8_t* value_ptr = (uint8_t*)&value;
- return value_ptr[0]<<24|value_ptr[1]<<16|value_ptr[2]<<8|value_ptr[3];
-}
-
-static void fwcfg_disp_read(uint16_t sel, uint32_t outsz, uint8_t* outbuf) {
- outw(0x510, sel);
- for (uint32_t i = 0;i < outsz;i++) outbuf[i] = inb(0x511);
-}
-
-static struct fw_cfg_files* filebuf = NULL;
-static const char* simple_mode_config =
- "TIMEOUT=0\n"
- ":simple mode config\n"
- "KERNEL_PATH=fwcfg:///opt/org.limine-bootloader.kernel";
-
-static const char* simple_mode_bg_config =
- "TIMEOUT=0\n"
- "GRAPHICS=yes\n"
- "THEME_BACKGROUND=50000000\n"
- "BACKGROUND_PATH=fwcfg:///opt/org.limine-bootloader.background\n"
- "BACKGROUND_STYLE=stretched\n"
- ":simple mode config\n"
- "KERNEL_PATH=fwcfg:///opt/org.limine-bootloader.kernel";
-
-static bool simple_mode = false;
-
-bool fwcfg_open(struct file_handle *handle, const char *name) {
- char sig[5] = { 0 };
- fwcfg_disp_read(/* signature */ 0x0000, 4, (uint8_t*)sig);
- if (strcmp(sig, "QEMU")) return false;
-
- uint32_t count;
- fwcfg_disp_read(0x0019, 4, (uint8_t*)&count);
- count = bswap32(count);
-
- if (!filebuf) {
- filebuf = (struct fw_cfg_files*)ext_mem_alloc(count * 64 + 4);
- fwcfg_disp_read(0x0019, count * 64 + 4, (uint8_t*)filebuf);
- }
-
- bool has_kernel = false, has_background = false;
- for (uint32_t i = 0;i < count;i++) {
- if (!strncmp(filebuf->f[i].name, name, 56)) {
- uint16_t sel = bswap16(filebuf->f[i].select);
- handle->size = bswap32(filebuf->f[i].size);
- handle->is_memfile = true;
- uint8_t* buf = (uint8_t*)(handle->fd = ext_mem_alloc(handle->size));
- fwcfg_disp_read(sel, handle->size, buf);
- return true;
- }
- if (!strncmp(filebuf->f[i].name, "opt/org.limine-bootloader.background", 56)) {
- has_background = true;
- }
- if (!strncmp(filebuf->f[i].name, "opt/org.limine-bootloader.kernel", 56)) {
- has_kernel = true;
- }
- }
-
- if (has_kernel && !strcmp(name, "opt/org.limine-bootloader.config")) {
- const char* conf = has_background ? simple_mode_bg_config : simple_mode_config;
- handle->size = strlen(conf);
- handle->is_memfile = true;
- char* buf = (char*)(handle->fd = ext_mem_alloc(handle->size + 1));
- strcpy(buf, conf);
- simple_mode = true;
- return true;
- }
-
- return false;
-}
diff --git a/common/lib/config.c b/common/lib/config.c
index 4e3f329e..7efc8991 100644
--- a/common/lib/config.c
+++ b/common/lib/config.c
@@ -23,8 +23,7 @@ int init_config_disk(struct volume *part) {
if ((f = fopen(part, "/limine.cfg")) == NULL
&& (f = fopen(part, "/boot/limine.cfg")) == NULL
- && (f = fopen(part, "/EFI/BOOT/limine.cfg")) == NULL
- && (f = uri_open("fwcfg:///opt/org.limine-bootloader.config")) == NULL) {
+ && (f = fopen(part, "/EFI/BOOT/limine.cfg")) == NULL) {
return -1;
}
diff --git a/common/lib/uri.c b/common/lib/uri.c
index 8a37a4e7..b2f765ab 100644
--- a/common/lib/uri.c
+++ b/common/lib/uri.c
@@ -8,7 +8,6 @@
#include <mm/pmm.h>
#include <lib/print.h>
#include <pxe/tftp.h>
-#include <drivers/fwcfg.h>
#include <tinf.h>
// A URI takes the form of: resource://root/path
@@ -142,15 +141,6 @@ static struct file_handle *uri_fslabel_dispatch(char *fslabel, char *path) {
return fopen(volume, path);
}
-static struct file_handle *uri_fwcfg_dispatch(char *path) {
- struct file_handle *ret = ext_mem_alloc(sizeof(struct file_handle));
- if (!fwcfg_open(ret, path)) {
- return NULL;
- }
-
- return ret;
-}
-
#if bios == 1
static struct file_handle *uri_tftp_dispatch(char *root, char *path) {
uint32_t ip;
@@ -231,12 +221,6 @@ struct file_handle *uri_open(char *uri) {
} else if (!strcmp(resource, "tftp")) {
ret = uri_tftp_dispatch(root, path);
#endif
- // note: fwcfg MUST be the last on the list due to fwcfg simple mode.
- } else if (!strcmp(resource, "fwcfg")) {
- if (*root != 0) {
- panic(true, "No root supported in an fwcfg:// uri!");
- }
- ret = uri_fwcfg_dispatch(path);
} else {
panic(true, "Resource `%s` not valid.", resource);
}
diff --git a/test/limine-fwcfg.cfg b/test/limine-fwcfg.cfg
deleted file mode 100644
index 4711e1db..00000000
--- a/test/limine-fwcfg.cfg
+++ /dev/null
@@ -1,28 +0,0 @@
-DEFAULT_ENTRY=1
-TIMEOUT=3
-GRAPHICS=yes
-VERBOSE=yes
-
-THEME_BACKGROUND=50000000
-
-BACKGROUND_PATH=fwcfg:///opt/org.limine-bootloader.background
-BACKGROUND_STYLE=stretched
-BACKDROP_COLOUR=008080
-
-:fwcfg:// test
-
-COMMENT=Test of the stivale2 boot protocol.
-
-# Let's use autodetection
-#PROTOCOL=stivale2
-RESOLUTION=800x600
-KERNEL_PATH=fwcfg:///opt/org.limine-bootloader.kernel
-KERNEL_CMDLINE=Woah! Another example!
-
-MODULE_PATH=fwcfg:///opt/org.limine-bootloader.background
-MODULE_STRING=yooooo
-
-# Test that the module string provided to the kernel will be
-# the module path since a module string is not specified.
-# (cc CONFIG.md stivale2.`MODULE_STRING` section)
-MODULE_PATH=fwcfg:///opt/org.limine-bootloader.background
