aboutsummaryrefslogtreecommitdiffstats
path: root/memdisk
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-07-31 08:27:58 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-07-31 08:27:58 -0700
commit41909771e1bafa89f316d3cd75d3b3be4c9e56be (patch)
treef246291e55d43ee551e6da7d9657a61afd83d54d /memdisk
parenta243241a43b48a7cf0fbe47e54851bd8f2c2023e (diff)
downloadsyslinux.git-41909771e1bafa89f316d3cd75d3b3be4c9e56be.tar.gz
syslinux.git-41909771e1bafa89f316d3cd75d3b3be4c9e56be.tar.xz
syslinux.git-41909771e1bafa89f316d3cd75d3b3be4c9e56be.zip
memdisk: correct the types for the EDD DPT, and write a real onesyslinux-3.83-pre5
Fix the sizes of some of the fields in the EDD DPT. Write a real one to the best of our ability. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'memdisk')
-rw-r--r--memdisk/memdisk.inc23
-rw-r--r--memdisk/setup.c45
2 files changed, 41 insertions, 27 deletions
diff --git a/memdisk/memdisk.inc b/memdisk/memdisk.inc
index b4d45c44..cfba2dfc 100644
--- a/memdisk/memdisk.inc
+++ b/memdisk/memdisk.inc
@@ -945,12 +945,6 @@ Mover_dst2: db 0 ; High 8 bits of source addy
Mover_dummy2: dd 0, 0, 0, 0 ; More space for the BIOS
alignb 4, db 0
-Stack dd 0 ; Saved SS:ESP on invocation
- dw 0
-SavedAX dw 0 ; AX saved on invocation
-Recursive dw 0 ; Recursion counter
-
- alignb 4, db 0
MemDisk_Info equ $ ; Pointed to by installation check
MDI_Bytes dw MDI_Len ; Total bytes in MDI structure
MDI_Version db VERSION_MINOR, VERSION_MAJOR ; MEMDISK version
@@ -1008,21 +1002,26 @@ EDD_DPT:
.totalsize dd 0, 0 ; Filled in by installer
.bytespersec dw SECTORSIZE
.eddtable dw -1, -1 ; Invalid DPTE pointer
-.dpikey dw 0 ; Device Path Info magic (not impl.)
- ; Would be 0beddh if implemented
+.dpikey dw 0BEDDh ; Device Path Info magic
.dpilen db 2ch ; DPI len
.res1 db 0 ; Reserved
-.res2 db 0 ; Reserved
-.bustype equ 'PCI ' ; Host bus type (4 bytes, space padded)
-.inttype equ 'ATA ' ; Interface type (8 bytes, spc. padded)
+.res2 dw 0 ; Reserved
+.bustype equ 'MEM ' ; Host bus type (4 bytes, space padded)
+.inttype equ 'MEMORY ' ; Interface type (8 bytes, spc. padded)
.intpath dd 0, 0 ; Interface path
.devpath dd 0, 0, 0, 0 ; Device path
.res3 db 0 ; Reserved
-.chksum db 0 ; DPI checksum (not implemented)
+.chksum db 0 ; DPI checksum
%endif
; End patch area
+ alignb 4, db 0
+Stack dd 0 ; Saved SS:ESP on invocation
+ dw 0
+SavedAX dw 0 ; AX saved on invocation
+Recursive dw 0 ; Recursion counter
+
alignb 4, db 0 ; We *MUST* end on a dword boundary
E820Table equ $ ; The installer loads the E820 table here
diff --git a/memdisk/setup.c b/memdisk/setup.c
index 7af16108..013f3dfa 100644
--- a/memdisk/setup.c
+++ b/memdisk/setup.c
@@ -81,8 +81,9 @@ struct edd_dpt {
uint16_t bytespersec; /* Bytes/sector */
uint16_t dpte_off, dpte_seg; /* DPTE pointer */
uint16_t dpikey; /* Device Path Info magic */
+ uint8_t dpilen; /* Device Path Info length */
uint8_t res1; /* Reserved */
- uint8_t res2; /* Reserved */
+ uint16_t res2; /* Reserved */
uint8_t bustype[4]; /* Host bus type */
uint8_t inttype[8]; /* Interface type */
uint64_t intpath; /* Interface path */
@@ -717,6 +718,17 @@ static void relocate_rm_code(uint32_t newbase)
sti();
}
+static uint8_t checksum_buf(const void *buf, int count)
+{
+ const uint8_t *p = buf;
+ uint8_t c;
+
+ while (count--)
+ c += *p++;
+
+ return c;
+}
+
#define STACK_NEEDED 512 /* Number of bytes of stack */
struct real_mode_args rm_args;
@@ -896,20 +908,23 @@ void setup(const struct real_mode_args *rm_args_ptr)
/* Set up an EDD drive parameter table */
if (do_edd) {
- pptr->edd_dpt.sectors = geometry->sectors;
- /* The EDD spec has this as <= 15482880 sectors (1024x240x63);
- this seems to make very little sense. Try for something saner. */
- if (geometry->c <= 1024 && geometry->h <= 255 && geometry->s <= 63) {
- pptr->edd_dpt.c = geometry->c;
- pptr->edd_dpt.h = geometry->h;
- pptr->edd_dpt.s = geometry->s;
- pptr->edd_dpt.flags |= 0x0002; /* Geometry valid */
- }
- if (!(geometry->driveno & 0x80)) {
- /* Floppy drive. Mark it as a removable device with
- media change notification; media is present. */
- pptr->edd_dpt.flags |= 0x0014;
- }
+ pptr->edd_dpt.sectors = geometry->sectors;
+ /* The EDD spec has this as <= 15482880 sectors (1024x240x63);
+ this seems to make very little sense. Try for something saner. */
+ if (geometry->c <= 1024 && geometry->h <= 255 && geometry->s <= 63) {
+ pptr->edd_dpt.c = geometry->c;
+ pptr->edd_dpt.h = geometry->h;
+ pptr->edd_dpt.s = geometry->s;
+ pptr->edd_dpt.flags |= 0x0002; /* Geometry valid */
+ }
+ if (!(geometry->driveno & 0x80)) {
+ /* Floppy drive. Mark it as a removable device with
+ media change notification; media is present. */
+ pptr->edd_dpt.flags |= 0x0014;
+ }
+
+ pptr->edd_dpt.devpath[0] = pptr->diskbuf;
+ pptr->edd_dpt.chksum = -checksum_buf(&pptr->edd_dpt.dpikey, 73-30);
}
/* The size is given by hptr->total_size plus the size of the E820