Hi,

On Wed, 17 Jun 2020 00:37:48 -0700
Johan Hattne <jo...@hattne.se> wrote:
> On 2020-05-29 17:01, Johan Hattne wrote:
>> 
>>> On May 28, 2020, at 20:38, YASUOKA Masahiko <yasu...@openbsd.org>
>>> wrote:
>>>
>>> Hi,
>>>
>>> On Thu, 28 May 2020 09:46:23 -0700
>>> Johan Hattne <jo...@hattne.se> wrote:
>>>>> On May 28, 2020, at 06:42, Nick Holland <n...@holland-consulting.net>
>>>>> wrote:
>>>>>
>>>>> On 2020-05-28 05:15, Johan Hattne wrote:
>>>>>> On 2020-05-28 00:56, Johan Hattne wrote:
>>>>>>> On 2020-05-28 00:43, YASUOKA Masahiko wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> On Wed, 27 May 2020 22:32:58 -0700
>>>>>>>> Johan Hattne <jo...@hattne.se> wrote:
>>>>>>>>> I've been trying to boot the 6.7 installation media from USB via EFI
>>>>>>>>> on a Dell PowerEdge R610.  The screen goes blank and then the thing
>>>>>>>>> resets (so no kernel output or anything).  I can boot the same stick
>>>>>>>>> via BIOS.
>>>>>>>>>
>>>>>>>>> I've been searching for a while without results.  Firmware settings
>>>>>>>>> look sane to me. Is this something anybody has seen before? Any hint
>>>>>>>>> on where I could even start looking for problems would be very much
>>>>>>>>> appreciated!
>>>>>>>>
>>>>>>>> I'd like you to try the diff attached with the following message.
>>>>>>>>
>>>>>>>> https://marc.info/?l=openbsd-tech&m=158280719421562&w=2
>>>>>>>
>>>>>>> Thanks a lot, Yasuoka! Is there any chance you could provide a
>>>>>>> compiled
>>>>>>> BOOTX64.EFI?  I don't have an amd64 build environment at the moment.
>>>>>>
>>>>>> After a bit of off-list discussion, Yasuoka concluded that above diff
>>>>>> won't help here.  To clarify the issue: there is no output at all
>>>>>> before
>>>>>> the machine resets, in particular there is no prompt from the EFI boot
>>>>>> program.
>>>>>>
>>>>>> // Johan
>>>>>>
>>>>>
>>>>> Have you tried firmware updates?
>>>>> That machine is many years old, I'd not be the slightest bit surprised
>>>>> if
>>>>> the firmware was buggy and didn't boot much of anything in EFI mode
>>>>> other
>>>>> than Windows and maybe Linux.
>>>>
>>>> Thanks, Nick!  The firmware is up to date.  And the machine does boot
>>>> e.g. NetBSD through EFI.
>>>
>>> Probing serial devices is one of the differences from NetBSD efiboot.
>>>
>>> diff --git a/sys/arch/amd64/stand/efiboot/conf.c
>>> b/sys/arch/amd64/stand/efiboot/conf.c
>>> index 3eb745d808d..8d385a4f198 100644
>>> --- a/sys/arch/amd64/stand/efiboot/conf.c
>>> +++ b/sys/arch/amd64/stand/efiboot/conf.c
>>> @@ -89,7 +89,7 @@ int ndevs = nitems(devsw);
>>>
>>> struct consdev constab[] = {
>>>     { efi_cons_probe, efi_cons_init, efi_cons_getc, efi_cons_putc },
>>> -   { efi_com_probe, efi_com_init, efi_com_getc, efi_com_putc },
>>> +   //{ efi_com_probe, efi_com_init, efi_com_getc, efi_com_putc },
>>>     { NULL }
>>> };
>>> struct consdev *cn_tab = constab;
>>>
>>> I put a compiled binary on https://yasuoka.net/~yasuoka/BOOTX64.EFI
>> Thanks a lot, Yasuoka!  The binary you compiled still exhibits the
>> same problem (it immediately resets the machine).
> 
> Another difference to NetBSD's efiboot is the way the heap is
> allocated: OpenBSD does AllocateMaxAddress, whereas NetBSD does
> AllocateAnyPages. Turns out the EFI on this machine fails with
> AllocateMaxAddress (so I guess Nick was right).  For what it's worth,
> the patch below allowed me to eventually boot the kernel through EFI.

Nice finding.

I remember that HEAP_LIMIT was for some machines.

  https://marc.info/?t=144254100000003&r=1&w=2

Do you have or can you take the result of "machine memory" on efiboot?

> Index: Makefile.common
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/stand/efi64/Makefile.common,v
> retrieving revision 1.5
> diff -u -p -r1.5 Makefile.common
> --- Makefile.common     5 Mar 2020 16:36:30 -0000       1.5
> +++ Makefile.common     17 Jun 2020 04:20:16 -0000
> @@ -7,8 +7,6 @@ EFIDIR=         ${S}/stand/efi
>  OBJCOPY?=      objcopy
>  OBJDUMP?=      objdump
> 
> -EFI_HEAP_LIMIT=        0xc00000
> -
>  LDFLAGS+= -nostdlib -T${.CURDIR}/../${LDSCRIPT} -Bsymbolic -shared
> 
>  COPTS+= -DEFIBOOT -DFWRANDOM -DNEEDS_HEAP_H -I${.CURDIR}/..
> @@ -69,7 +67,7 @@ ${PROG}: ${PROG.so}
>  .include <bsd.prog.mk>
>  CFLAGS+=       -Wno-pointer-sign
>  CPPFLAGS+=     -DSMALL -DSLOW -DNOBYFOUR -D__INTERNAL_LIBSA_CREAD
> -CPPFLAGS+=     -DHEAP_LIMIT=${EFI_HEAP_LIMIT} -DHIBERNATE
> +CPPFLAGS+=     -DHIBERNATE
> 
>  ${PROG.so}: ${OBJS}
>         ${LD} ${LDFLAGS} -o ${.TARGET}.tmp ${OBJS} ${LDADD}
> Index: efiboot.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/stand/efi64/efiboot.c,v
> retrieving revision 1.2
> diff -u -p -r1.2 efiboot.c
> --- efiboot.c   11 May 2019 19:14:41 -0000      1.2
> +++ efiboot.c   17 Jun 2020 04:20:16 -0000
> @@ -275,8 +275,7 @@ efi_heap_init(void)
>  {
>         EFI_STATUS       status;
> 
> -       heap = HEAP_LIMIT;
> -       status = EFI_CALL(BS->AllocatePages, AllocateMaxAddress,
> -       EfiLoaderData,
> + status = EFI_CALL(BS->AllocatePages, AllocateAnyPages,
> EfiLoaderData,
>             EFI_SIZE_TO_PAGES(heapsiz), &heap);
>         if (status != EFI_SUCCESS)
>                 panic("BS->AllocatePages()");
> 
> 
> Thanks again for all the help!
> 
> // Cheers; Johan

Reply via email to