aboutsummaryrefslogtreecommitdiff
path: root/src/pmm.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-07-26 19:33:13 -0400
committerKevin O'Connor <kevin@koconnor.net>2009-07-26 19:33:13 -0400
commite54ee3800df72c2742f486abf437e75c2b56182c (patch)
tree1cf4862f4819a6bd0dae0a7b05770fc3937b21f8 /src/pmm.c
parente773930ea4f37bca9334a157e86e70f14234888f (diff)
downloadseabios-e54ee3800df72c2742f486abf437e75c2b56182c.zip
seabios-e54ee3800df72c2742f486abf437e75c2b56182c.tar.gz
seabios-e54ee3800df72c2742f486abf437e75c2b56182c.tar.bz2
Add PMM stubs.
Add initial code for Post Memory Manager - it's just the stubs for now. Also, fix PnP entry point not clearing irqs and direction flags.
Diffstat (limited to 'src/pmm.c')
-rw-r--r--src/pmm.c117
1 files changed, 117 insertions, 0 deletions
diff --git a/src/pmm.c b/src/pmm.c
new file mode 100644
index 0000000..bf53e3b
--- /dev/null
+++ b/src/pmm.c
@@ -0,0 +1,117 @@
+// Post memory manager (PMM) calls
+//
+// Copyright (C) 2009 Kevin O'Connor <kevin@koconnor.net>
+//
+// This file may be distributed under the terms of the GNU LGPLv3 license.
+
+#include "util.h" // checksum
+#include "config.h" // BUILD_BIOS_ADDR
+
+struct pmmheader {
+ u32 signature;
+ u8 version;
+ u8 length;
+ u8 checksum;
+ u16 entry_offset;
+ u16 entry_seg;
+ u8 reserved[5];
+} PACKED;
+
+extern struct pmmheader PMMHEADER;
+
+#define PMM_SIGNATURE 0x4d4d5024 // $PMM
+
+#if CONFIG_PMM
+struct pmmheader PMMHEADER __aligned(16) VAR16EXPORT = {
+ .version = 0x01,
+ .length = sizeof(PMMHEADER),
+ .entry_seg = SEG_BIOS,
+};
+#endif
+
+#define FUNCTION_NOT_SUPPORTED 0xffffffff
+
+// PMM - allocate
+static u32
+handle_pmm00(u16 *args)
+{
+ u32 length = *(u32*)&args[1], handle = *(u32*)&args[3];
+ u16 flags = args[5];
+ dprintf(1, "pmm00: length=%x handle=%x flags=%x\n"
+ , length, handle, flags);
+ // XXX
+ return 0;
+}
+
+// PMM - find
+static u32
+handle_pmm01(u16 *args)
+{
+ u32 handle = *(u32*)&args[1];
+ dprintf(1, "pmm01: handle=%x\n", handle);
+ // XXX
+ return 0;
+}
+
+// PMM - deallocate
+static u32
+handle_pmm02(u16 *args)
+{
+ u32 buffer = *(u32*)&args[1];
+ dprintf(1, "pmm02: buffer=%x\n", buffer);
+ // XXX
+ return 0;
+}
+
+static u32
+handle_pmmXX(u16 *args)
+{
+ return FUNCTION_NOT_SUPPORTED;
+}
+
+u32 VISIBLE16
+handle_pmm(u16 *args)
+{
+ if (! CONFIG_PMM)
+ return FUNCTION_NOT_SUPPORTED;
+
+ u16 arg1 = args[0];
+ dprintf(DEBUG_HDL_pmm, "pmm call arg1=%x\n", arg1);
+
+ switch (arg1) {
+ case 0x00: return handle_pmm00(args);
+ case 0x01: return handle_pmm01(args);
+ case 0x02: return handle_pmm02(args);
+ default: return handle_pmmXX(args);
+ }
+}
+
+// romlayout.S
+extern void entry_pmm();
+
+void
+pmm_setup()
+{
+ if (! CONFIG_PMM)
+ return;
+
+ dprintf(3, "init PMM\n");
+
+ PMMHEADER.signature = PMM_SIGNATURE;
+ PMMHEADER.entry_offset = (u32)entry_pmm - BUILD_BIOS_ADDR;
+ PMMHEADER.checksum -= checksum(&PMMHEADER, sizeof(PMMHEADER));
+}
+
+void
+pmm_finalize()
+{
+ if (! CONFIG_PMM)
+ return;
+
+ dprintf(3, "finalize PMM\n");
+
+ PMMHEADER.signature = 0;
+ PMMHEADER.entry_offset = 0;
+
+ // XXX - zero low-memory allocations.
+}