Thank you for the test.  Let me update the diff.

On Thu, 20 Jul 2017 23:26:57 +0200
Theo Buehler <[email protected]> wrote:
> On Thu, Jul 20, 2017 at 08:44:53PM +0200, Theo Buehler wrote:
>> I tried to pxeboot into bsd.rd to install a snapshot with your diff
>> (with FDE on MBR) and this leads to a hang after password entry.
>> Therefore I didn't dare to install the bootloader, as I need this
>> machine for work.
>> 
>> More precisely, it looks like check_hibernate() doesn't return on a
>> normally rebooted machine:
>> 
>> probing: pc0 pxe![2.1] mem[630K 511M 518M 2471M 486M a20=on]
>> disk: hd0+ sr0*
>> net: mac aa:bb:cc:dd:ee:ff, ip 192.168.10.11, server 192.168.10.10
>> >> OpenBSD/amd64 PXEBOOT 3.28
>> Passphrase:
>> start check_hibernate()
>> _
>> 
>> 
>> and the machine hangs here.
>> 
>> I used the following simple modification of your diff:
> 
> Unfortunately, regular boot is also broken the same way as PXE boot with
> this diff. I made a fresh FDE on MBR install to a memory stick. After
> the install I rebooted from the memory stick, boot decrypts the volume
> but hangs in check_hibernate().
> 
> (with the same diff as in my previous mail):
> 
> Using drive 0, partition 3
> Loading......
> probing: pc0 mem[630K 511M 518M 2471M 486M a20=on]
> disk hd0+ hd1+ sr0* sr1*
>>> OpenBSD/amd64 BOOT 3.33
> Passphrase:
> start check_hibernate()

Index: sys/arch/amd64/stand/efiboot/efidev.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/efiboot/efidev.c,v
retrieving revision 1.26
diff -u -p -r1.26 efidev.c
--- sys/arch/amd64/stand/efiboot/efidev.c       16 May 2017 02:56:23 -0000      
1.26
+++ sys/arch/amd64/stand/efiboot/efidev.c       20 Jul 2017 23:37:58 -0000
@@ -625,6 +625,7 @@ efiopen(struct open_file *f, ...)
                        if (sr_getdisklabel(bv, &dip->disklabel))
                                return ERDLAB;
                        dip->bios_info.flags &= ~BDI_BADLABEL;
+                       check_hibernate(dip);
                }
 
                bv->sbv_part = part + 'a';
Index: sys/arch/amd64/stand/libsa/biosdev.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/libsa/biosdev.c,v
retrieving revision 1.30
diff -u -p -r1.30 biosdev.c
--- sys/arch/amd64/stand/libsa/biosdev.c        18 Sep 2016 15:13:10 -0000      
1.30
+++ sys/arch/amd64/stand/libsa/biosdev.c        20 Jul 2017 23:37:58 -0000
@@ -535,6 +535,7 @@ biosopen(struct open_file *f, ...)
                if (bv->sbv_diskinfo == NULL) {
                        dip = alloc(sizeof(struct diskinfo));
                        bzero(dip, sizeof(*dip));
+                       dip->strategy = biosstrategy;
                        bv->sbv_diskinfo = dip;
                        dip->sr_vol = bv;
                        dip->bios_info.flags |= BDI_BADLABEL;
@@ -548,6 +549,7 @@ biosopen(struct open_file *f, ...)
                        if (sr_getdisklabel(bv, &dip->disklabel))
                                return ERDLAB;
                        dip->bios_info.flags &= ~BDI_BADLABEL;
+                       check_hibernate(dip);
                }
 
                bv->sbv_part = part + 'a';
Index: sys/arch/amd64/stand/libsa/disk.h
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/libsa/disk.h,v
retrieving revision 1.5
diff -u -p -r1.5 disk.h
--- sys/arch/amd64/stand/libsa/disk.h   2 Sep 2015 01:52:26 -0000       1.5
+++ sys/arch/amd64/stand/libsa/disk.h   20 Jul 2017 23:37:58 -0000
@@ -59,4 +59,6 @@ extern struct disklist_lh disklist;
 
 void dump_diskinfo(void);
 
+void check_hibernate(struct diskinfo *);
+
 #endif /* _DISK_H */
Index: sys/arch/amd64/stand/libsa/diskprobe.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/stand/libsa/diskprobe.c,v
retrieving revision 1.19
diff -u -p -r1.19 diskprobe.c
--- sys/arch/amd64/stand/libsa/diskprobe.c      22 Jun 2017 01:26:28 -0000      
1.19
+++ sys/arch/amd64/stand/libsa/diskprobe.c      20 Jul 2017 23:37:58 -0000
@@ -55,7 +55,6 @@
 
 /* Local Prototypes */
 static int disksum(int);
-static void check_hibernate(struct diskinfo *);
 
 int bootdev_has_hibernate(void);               /* export for loadfile() */
 
@@ -176,6 +175,8 @@ hardprobe(void)
                dip->bsddev = dip->bios_info.bsd_dev =
                    MAKEBOOTDEV(type, 0, 0, bsdunit, RAW_PART);
                check_hibernate(dip);
+               if (dip->bios_info.flags & BDI_HIBVALID)
+                       printf("&");
 
                /* Add to queue of disks */
                TAILQ_INSERT_TAIL(&disklist, dip, list);
@@ -232,6 +233,8 @@ efi_hardprobe(void)
                dip->bsddev = dip->bios_info.bsd_dev =
                    MAKEBOOTDEV(type, 0, 0, bsdunit, RAW_PART);
                check_hibernate(dip);
+               if (dip->bios_info.flags & BDI_HIBVALID)
+                       printf("&");
 
                /* Add to queue of disks */
                TAILQ_INSERT_TAIL(&disklist, dip, list);
@@ -472,7 +475,7 @@ bootdev_has_hibernate(void)
        return ((bootdev_dip->bios_info.flags & BDI_HIBVALID)? 1 : 0);
 }
 
-static void
+void
 check_hibernate(struct diskinfo *dip)
 {
        daddr_t sec;
@@ -489,9 +492,6 @@ check_hibernate(struct diskinfo *dip)
             (sizeof(union hibernate_info) / DEV_BSIZE);
 
        error = dip->strategy(dip, F_READ, (daddr32_t)sec, sizeof hib, &hib, 
NULL);
-       if (error == 0 && hib.magic == HIBERNATE_MAGIC) {
-               /* Hibernate present */
-               dip->bios_info.flags |= BDI_HIBVALID;
-               printf("&");
-       }
+       if (error == 0 && hib.magic == HIBERNATE_MAGIC)
+               dip->bios_info.flags |= BDI_HIBVALID; /* Hibernate present */
 }
Index: sys/arch/i386/stand/libsa/biosdev.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/stand/libsa/biosdev.c,v
retrieving revision 1.95
diff -u -p -r1.95 biosdev.c
--- sys/arch/i386/stand/libsa/biosdev.c 18 Sep 2016 15:13:10 -0000      1.95
+++ sys/arch/i386/stand/libsa/biosdev.c 20 Jul 2017 23:37:58 -0000
@@ -536,6 +536,7 @@ biosopen(struct open_file *f, ...)
                if (bv->sbv_diskinfo == NULL) {
                        dip = alloc(sizeof(struct diskinfo));
                        bzero(dip, sizeof(*dip));
+                       dip->strategy = biosstrategy;
                        bv->sbv_diskinfo = dip;
                        dip->sr_vol = bv;
                        dip->bios_info.flags |= BDI_BADLABEL;
@@ -549,6 +550,7 @@ biosopen(struct open_file *f, ...)
                        if (sr_getdisklabel(bv, &dip->disklabel))
                                return ERDLAB;
                        dip->bios_info.flags &= ~BDI_BADLABEL;
+                       check_hibernate(dip);
                }
 
                bv->sbv_part = part + 'a';
Index: sys/arch/i386/stand/libsa/disk.h
===================================================================
RCS file: /cvs/src/sys/arch/i386/stand/libsa/disk.h,v
retrieving revision 1.6
diff -u -p -r1.6 disk.h
--- sys/arch/i386/stand/libsa/disk.h    2 Sep 2015 04:09:24 -0000       1.6
+++ sys/arch/i386/stand/libsa/disk.h    20 Jul 2017 23:37:58 -0000
@@ -59,4 +59,6 @@ extern struct disklist_lh disklist;
 
 void dump_diskinfo(void);
 
+void check_hibernate(struct diskinfo *);
+
 #endif /* _DISK_H */
Index: sys/arch/i386/stand/libsa/diskprobe.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/stand/libsa/diskprobe.c,v
retrieving revision 1.43
diff -u -p -r1.43 diskprobe.c
--- sys/arch/i386/stand/libsa/diskprobe.c       22 Jun 2017 01:26:28 -0000      
1.43
+++ sys/arch/i386/stand/libsa/diskprobe.c       20 Jul 2017 23:37:58 -0000
@@ -55,7 +55,6 @@
 
 /* Local Prototypes */
 static int disksum(int);
-static void check_hibernate(struct diskinfo *);
 
 int bootdev_has_hibernate(void);               /* export for loadfile() */
 
@@ -176,6 +175,8 @@ hardprobe(void)
                dip->bsddev = dip->bios_info.bsd_dev =
                    MAKEBOOTDEV(type, 0, 0, bsdunit, RAW_PART);
                check_hibernate(dip);
+               if (dip->bios_info.flags & BDI_HIBVALID)
+                       printf("&");
 
                /* Add to queue of disks */
                TAILQ_INSERT_TAIL(&disklist, dip, list);
@@ -232,6 +233,8 @@ efi_hardprobe(void)
                dip->bsddev = dip->bios_info.bsd_dev =
                    MAKEBOOTDEV(type, 0, 0, bsdunit, RAW_PART);
                check_hibernate(dip);
+               if (dip->bios_info.flags & BDI_HIBVALID)
+                       printf("&");
 
                /* Add to queue of disks */
                TAILQ_INSERT_TAIL(&disklist, dip, list);
@@ -472,7 +475,7 @@ bootdev_has_hibernate(void)
        return ((bootdev_dip->bios_info.flags & BDI_HIBVALID)? 1 : 0);
 }
 
-static void
+void
 check_hibernate(struct diskinfo *dip)
 {
        daddr_t sec;
@@ -489,9 +492,6 @@ check_hibernate(struct diskinfo *dip)
             (sizeof(union hibernate_info) / DEV_BSIZE);
 
        error = dip->strategy(dip, F_READ, (daddr32_t)sec, sizeof hib, &hib, 
NULL);
-       if (error == 0 && hib.magic == HIBERNATE_MAGIC) {
-               /* Hibernate present */
-               dip->bios_info.flags |= BDI_HIBVALID;
-               printf("&");
-       }
+       if (error == 0 && hib.magic == HIBERNATE_MAGIC)
+               dip->bios_info.flags |= BDI_HIBVALID; /* Hibernate present */
 }

Reply via email to