pxe: update to match the new fs_init interface
authorH. Peter Anvin <hpa@zytor.com>
Tue, 22 Dec 2009 20:10:43 +0000 (12:10 -0800)
committerH. Peter Anvin <hpa@zytor.com>
Tue, 22 Dec 2009 20:10:43 +0000 (12:10 -0800)
fs_init now takes a pointer to an array of filesystems, so provide it
as such.  Furthermore, fs_init needs to return a nonnegative value to
be considered successful.

Finally, handle the case of 64-bit partition offsets being passed in
to fs_init (in ebx:ecx in the disk-based derivatives.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core/fs.c
core/fs/pxe/pxe.c
core/pxelinux.asm

index 4c8c153..fc93685 100644 (file)
--- a/core/fs.c
+++ b/core/fs.c
@@ -166,22 +166,27 @@ void close_file(com32sys_t *regs)
  */
 void fs_init(com32sys_t *regs)
 {
+    sector_t part_offset = regs->ecx.l | ((sector_t)regs->ebx.l << 32);
     int blk_shift = -1;
+    struct device *dev = NULL;
     /* ops is a ptr list for several fs_ops */
     const struct fs_ops **ops = (const struct fs_ops **)regs->eax.l;
     
     while ((blk_shift < 0) && *ops) {
        /* set up the fs stucture */
        fs.fs_ops = *ops;
-       /* this is a total hack... */
-       if (fs.fs_ops->fs_flags & FS_NODEV)
-               fs.fs_dev = NULL;
-       else {
-               static struct device *dev;
 
+       /*
+        * This boldly assumes that we don't mix FS_NODEV filesystems
+        * with FS_DEV filesystems...
+        */
+       if (fs.fs_ops->fs_flags & FS_NODEV) {
+               fs.fs_dev = NULL;
+       } else {
                if (!dev)
                        dev = device_init(regs->edx.b[0], regs->edx.b[1],
-                               regs->ecx.l, regs->esi.w[0], regs->edi.w[0]);
+                                         part_offset,
+                                         regs->esi.w[0], regs->edi.w[0]);
                fs.fs_dev = dev;
        }
        /* invoke the fs-specific init code */
index 4d08191..0e6e227 100644 (file)
@@ -1293,7 +1293,7 @@ static const struct pxenv_t *memory_scan_for_pxenv_struct(void)
  * if if the API version is 2.1 or later 
  *
  */
-static void pxe_init(void)
+static int pxe_init(void)
 {
     extern void pxe_int1a(void);
     char plan = 'A';
@@ -1395,6 +1395,8 @@ static void pxe_init(void)
     data_seg = data_seg + ((data_len + 15) >> 4);
 
     real_base_mem = max(code_seg,data_seg) >> 6; /* Convert to kilobytes */
+
+    return 0;
 }                                  
 
 /*
index e5aed7c..c71b07b 100644 (file)
@@ -309,10 +309,18 @@ efi_csm_hack_size equ $-efi_csm_hack
 ;
 ; do fs initialize
 ;
-                extern pxe_fs_ops
-               mov eax,pxe_fs_ops
+               mov eax,ROOT_FS_OPS
                 pm_call fs_init
 
+               section .data
+               alignz 4
+ROOT_FS_OPS:
+                extern pxe_fs_ops
+               dd pxe_fs_ops
+               dd 0
+
+
+               section .text16
 ;
 ; Initialize the idle mechanism
 ;