summaryrefslogtreecommitdiffstats
path: root/sys/i386/bios
diff options
context:
space:
mode:
authormdodd <mdodd@FreeBSD.org>2003-06-13 00:36:03 +0000
committermdodd <mdodd@FreeBSD.org>2003-06-13 00:36:03 +0000
commit12a43e4609e292a8de9cc82d3be51302f7b129e3 (patch)
treedad996fa25d3b0f354f02985398fee0f7d56b2d5 /sys/i386/bios
parent56787fa7b199f3e56307c941bd464b9fcfcde7d5 (diff)
downloadFreeBSD-src-12a43e4609e292a8de9cc82d3be51302f7b129e3.zip
FreeBSD-src-12a43e4609e292a8de9cc82d3be51302f7b129e3.tar.gz
Despite my best efforts the Linux way of doing this is the only
way that works correctly. - Remove unused function. - Move declaration of variables to .S file.
Diffstat (limited to 'sys/i386/bios')
-rw-r--r--sys/i386/bios/smapi.c13
-rw-r--r--sys/i386/bios/smapi_bios.S45
2 files changed, 20 insertions, 38 deletions
diff --git a/sys/i386/bios/smapi.c b/sys/i386/bios/smapi.c
index fd6b1fe..5b90896 100644
--- a/sys/i386/bios/smapi.c
+++ b/sys/i386/bios/smapi.c
@@ -67,9 +67,8 @@ struct smapi_softc {
struct smapi_bios_header *header;
};
-u_long smapi32_offset;
-u_short smapi32_segment;
-#define SMAPI32_SEGMENT 0x18
+extern u_long smapi32_offset;
+extern u_short smapi32_segment;
devclass_t smapi_devclass;
@@ -123,14 +122,8 @@ smapi_ioctl (dev, cmd, data, fflag, td)
error = 0;
break;
case SMAPIOCGFUNCTION:
-#if 1
- smapi32_segment = SMAPI32_SEGMENT;
smapi32_offset = sc->smapi32_entry;
- error = smapi32(
-#else
- error = smapi32_new(sc->smapi32_entry, SMAPI32_SEGMENT,
-#endif
- (struct smapi_bios_parameter *)data,
+ error = smapi32((struct smapi_bios_parameter *)data,
(struct smapi_bios_parameter *)data);
break;
default:
diff --git a/sys/i386/bios/smapi_bios.S b/sys/i386/bios/smapi_bios.S
index 3e24a4e..3a28005 100644
--- a/sys/i386/bios/smapi_bios.S
+++ b/sys/i386/bios/smapi_bios.S
@@ -3,11 +3,28 @@ __FBSDID("$FreeBSD$");
#include <machine/asmacros.h>
+/*
+ * This is cribbed from the Linux thinkpad-4.1 driver by
+ * Thomas Hood.
+ */
+
+ .align
+smapi32_entry: /* far pointer to SMAPI entry */
+ .globl smapi32_offset
+smapi32_offset: .long 0x00000000 /* set by caller */
+smapi32_segment: .word 0x0000 /* %cs stored here */
+
.text
/*
* smapi32(input_param, output_param)
* struct smapi_bios_parameter *input_parm;
* struct smapi_bios_parameter *output_parm;
+ *
+ * stack frame:
+ * 0x00 : saved ebp
+ * 0x04 : return EIP
+ * 0x08 : input_parm
+ * 0x0c : output_parm
*/
ENTRY(smapi32)
pushl %ebp /* Save frame */
@@ -24,31 +41,3 @@ ENTRY(smapi32)
leave
ret
-
-/*
- * smapi32(offset, segment, input_param, output_param)
- * u_int offset;
- * u_short segment;
- * struct smapi_bios_parameter *input_parm;
- * struct smapi_bios_parameter *output_parm;
- */
-ENTRY(smapi32_new)
- pushl %ebp /* Save frame */
- movl %esp,%ebp
-
- movl 0x08(%ebp),%eax
- movl %eax,smapi32_offset
- movw 0x0c(%ebp),%ax
- movw %ax,smapi32_segment
-
- pushl %ds
- pushl 0x20(%ebp) /* Output Param */
- pushl %ds
- pushl 0x10(%ebp) /* Input Param */
-
- movl $0,%eax
- movw %cs,smapi32_segment
- lcall *(smapi32_offset)
-
- leave
- ret
OpenPOWER on IntegriCloud