From nobody Fri Sep 20 14:59:20 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4X9FsN2jHpz5XT43; Fri, 20 Sep 2024 14:59:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4X9FsN1qVlz4NkX; Fri, 20 Sep 2024 14:59:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726844360; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mbxXiAyCqBS0WvWYwRqkBtPKQ0Ec7CVNEipBvi1y2sE=; b=ICva4Nyrd6zDPBxXtPGN13QwAu3L3vXkzRYbouCR8ftcKx1J1izaOq7bngeXxdQgqy2C5B KbIKNqX6rXplIINTQsfi7+cEwvKHKMfB/ZXnoQjGOIwQGbnRf5/GdYPfF50Ky/hGwX2zXr 4Xr+qXakV1GIB6pTJZPWKIWDTKVf61SrOAHMZAi/ydqKO9sHGDnlMGCiorwDe8CrqWPQTh h9reUkvkn0xPK5P8hazwNRgEep4Sp7+AZi1CwLE5gJ/f9cWKU6kjzin8+bL20XO+tYD+nK i4gWUleD44gYa294a0xsMOU8vvvoheKLZ/FmQXZjjSkN0FeZjOSctj7V3hp2Tw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1726844360; a=rsa-sha256; cv=none; b=H7m2wd+kptOlZDvthH/K3JqCrQUHNorifenOMlnD7bI133QRoOIWKd8EvMEkJXq/ctGDGb JOJAKQMAh94OXZcwFulm8WBjXmvidIZ+eCGuT9iinloA0Acuggzc+o9KlqJMuDaJKsQwsq REFwAJgF9TrPAFWotwEXRDNJn00xp1m/GWwE8ShIaQzMP19Bch2fXLaJ6CaGvd3qL3fwen kS4As91NeSWa/P4LOKEoLZiBkq/ll6Ts4CRbwtAdVUxMI7oSz/FYx74nlhtsbWLt9e6iQJ GcUvLTIiknjM8WG4jhINEQx/PDhkak72mc60+qJrpzjxdpkQpv1rPnDQRiCnAg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726844360; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mbxXiAyCqBS0WvWYwRqkBtPKQ0Ec7CVNEipBvi1y2sE=; b=lfBHAjieK9bz1PKrGnoRg2LExEPKk1NsJNYjmR78q6xHLnlBLO0a7z7LDlmcno25Mj1Fqv iRTMrvUThYfawD76qUVJTQzKP6gInahsdcRo1Xdpb2Q0A7fn2ZP82V6IrLskp/bhxYCANO b2sB8HCNh4iBUjvty6c1HPLAl6DZG8ZQTODCaM/nnCOSRL5zpWu4jepD7F+3HjQTVRU79U k4fLbCwVgFSXtY6icm09Man3uiy3J7mj4eNYbF7g/kHZzqheZejfuF8FxReM/CuR2Wkis8 RXDIPTj2ZhQBHKsdaDm35MWrWI0stn3N51Bbybwb5uy1Z3kF1eXAApReABSeRw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4X9FsN0TpJzv7P; Fri, 20 Sep 2024 14:59:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48KExKDw046701; Fri, 20 Sep 2024 14:59:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48KExKxF046698; Fri, 20 Sep 2024 14:59:20 GMT (envelope-from git) Date: Fri, 20 Sep 2024 14:59:20 GMT Message-Id: <202409201459.48KExKxF046698@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 6818ff7797c6 - main - loader: Fix 32-bit compatibility List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6818ff7797c6a9ab104e5d7e91d4e422874bf50d Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6818ff7797c6a9ab104e5d7e91d4e422874bf50d commit 6818ff7797c6a9ab104e5d7e91d4e422874bf50d Author: Ahmad Khalifa AuthorDate: 2024-05-14 19:29:08 +0000 Commit: Warner Losh CommitDate: 2024-09-20 14:45:07 +0000 loader: Fix 32-bit compatibility main.c - Fix rsdp cast. framebuffer.c - - Use temp variable instead of directly passing pointer when EFI_PHYSICAL_ADDRESS is expected. Also fix FreePages cast. - Mask framebuffer address given to us by UEFI. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1098 --- stand/efi/loader/framebuffer.c | 21 +++++++++++++++------ stand/efi/loader/main.c | 3 ++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/stand/efi/loader/framebuffer.c b/stand/efi/loader/framebuffer.c index c954a2471340..ea4131b751c8 100644 --- a/stand/efi/loader/framebuffer.c +++ b/stand/efi/loader/framebuffer.c @@ -149,7 +149,16 @@ efifb_from_gop(struct efi_fb *efifb, EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *mode, { int result; - efifb->fb_addr = mode->FrameBufferBase; + /* + * The Asus EEEPC 1025C, and possibly others, + * require the address to be masked. + */ + efifb->fb_addr = +#ifdef __i386__ + mode->FrameBufferBase & 0xffffffff; +#else + mode->FrameBufferBase; +#endif efifb->fb_size = mode->FrameBufferSize; efifb->fb_height = info->VerticalResolution; efifb->fb_width = info->HorizontalResolution; @@ -555,6 +564,7 @@ efi_has_gop(void) int efi_find_framebuffer(teken_gfx_t *gfx_state) { + EFI_PHYSICAL_ADDRESS ptr; EFI_HANDLE *hlist; UINTN nhandles, i, hsize; struct efi_fb efifb; @@ -651,16 +661,15 @@ efi_find_framebuffer(teken_gfx_t *gfx_state) efifb.fb_mask_blue | efifb.fb_mask_reserved); if (gfx_state->tg_shadow_fb != NULL) - BS->FreePages((EFI_PHYSICAL_ADDRESS)gfx_state->tg_shadow_fb, + BS->FreePages((uintptr_t)gfx_state->tg_shadow_fb, gfx_state->tg_shadow_sz); gfx_state->tg_shadow_sz = EFI_SIZE_TO_PAGES(efifb.fb_height * efifb.fb_width * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData, - gfx_state->tg_shadow_sz, - (EFI_PHYSICAL_ADDRESS *)&gfx_state->tg_shadow_fb); - if (status != EFI_SUCCESS) - gfx_state->tg_shadow_fb = NULL; + gfx_state->tg_shadow_sz, &ptr); + gfx_state->tg_shadow_fb = status == EFI_SUCCESS ? + (uint32_t *)(uintptr_t)ptr : NULL; return (0); } diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index e4d62f2e940c..69fee3128569 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -920,7 +921,7 @@ acpi_detect(void) if ((rsdp = efi_get_table(&acpi)) == NULL) return; - sprintf(buf, "0x%016llx", (unsigned long long)rsdp); + sprintf(buf, "0x%016"PRIxPTR, (uintptr_t)rsdp); setenv("acpi.rsdp", buf, 1); revision = rsdp->Revision; if (revision == 0)