summaryrefslogtreecommitdiff
path: root/com32
diff options
context:
space:
mode:
authorhpa <hpa>2005-08-03 21:26:56 +0000
committerhpa <hpa>2005-08-03 21:26:56 +0000
commit1517373ef166666f6dfbeb878010d2d3517876d2 (patch)
tree43d250af03b7f6e591785fca43182105189a8df4 /com32
parent32bf33d0202a9f7ec4be37107e2de0662f1ad5ff (diff)
downloadsyslinux-1517373ef166666f6dfbeb878010d2d3517876d2.tar.gz
Actual implementation of the read/write through BIOS
Diffstat (limited to 'com32')
-rw-r--r--com32/lib/pci/readbios.c16
-rw-r--r--com32/lib/pci/writebios.c14
2 files changed, 30 insertions, 0 deletions
diff --git a/com32/lib/pci/readbios.c b/com32/lib/pci/readbios.c
new file mode 100644
index 00000000..92b4eeec
--- /dev/null
+++ b/com32/lib/pci/readbios.c
@@ -0,0 +1,16 @@
+#include <com32.h>
+#include <string.h>
+#include "pci/pci.h"
+
+uint32_t __pci_read_bios(uint32_t call, pciaddr_t a)
+{
+ com32sys_t rs;
+ memset(&rs, 0, sizeof rs);
+ rs.eax.w[0] = call;
+ rs.ebx.w[0] = a >> 8; /* bus:device:function */
+ rs.edi.b[0] = a; /* address:reg */
+ __intcall(0x1a, &rs, &rs);
+
+ return (rs.eflags.l & EFLAGS_CF) ? ~(uint32_t)0 : rs.ecx.l;
+}
+
diff --git a/com32/lib/pci/writebios.c b/com32/lib/pci/writebios.c
new file mode 100644
index 00000000..b8905590
--- /dev/null
+++ b/com32/lib/pci/writebios.c
@@ -0,0 +1,14 @@
+#include <com32.h>
+#include <string.h>
+#include "pci/pci.h"
+
+void __pci_write_bios(uint32_t call, uint32_t v, pciaddr_t a)
+{
+ com32sys_t rs;
+ memset(&rs, 0, sizeof rs);
+ rs.eax.w[0] = call;
+ rs.ebx.w[0] = a >> 8; /* bus:device:function */
+ rs.edi.b[0] = a; /* address:reg */
+ rs.ecx.l = v;
+ __intcall(0x1a, &rs, NULL);
+}