Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BD565C61DA4 for ; Thu, 23 Feb 2023 11:33:41 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 27FBB85AE9; Thu, 23 Feb 2023 12:33:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; secure) header.d=gmx.de header.i=xypron.glpk@gmx.de header.b="rFYNzbT/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 98CD385B05; Thu, 23 Feb 2023 12:33:37 +0100 (CET) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 394E485738 for ; Thu, 23 Feb 2023 12:33:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1677152013; i=xypron.glpk@gmx.de; bh=XKYUbQ1G6g8BlIvLxZw5tlygpsHGQqQkkTGsiHzWJWQ=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=rFYNzbT/lipid0Z5xfwKm0M2C6W7v0cywLYAYHyktTIzyl1NFAgxlVNW7gbmfdEk6 dPB6Y6GW6QDt7kcBe3/nSbLl/2p5zPMovawtufHjBkeUN2+75HR/2tyUvg9Of9Ui3f A3qp/H0tJEvJMIKvXvmprnyO6DAmSRJ3YM9KUndatWqztlGX1sfq1/LzCa89Bgabvu nn3c7sgB5MJUjYQxJMxCN36j+2iMCgcrFtY5tmTaPtjw1K+W97RIo2zGUVJoLxLs8k 5oSzWmNpMaGPljviSs7rCjAAad6XQsYK7onN7nJTc52zdpwGaSf05MCYGeG87B/q89 KeHz3279wGS9g== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.123.94] ([88.152.145.137]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mk0NU-1opWa43ljU-00kNoK; Thu, 23 Feb 2023 12:33:32 +0100 Message-ID: Date: Thu, 23 Feb 2023 12:33:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH v2 03/13] efi: Support a 64-bit frame buffer address To: Simon Glass Cc: Anatolij Gustschin , Bin Meng , U-Boot Mailing List References: <20230222191257.1307427-1-sjg@chromium.org> <20230222191257.1307427-4-sjg@chromium.org> Content-Language: en-US From: Heinrich Schuchardt In-Reply-To: <20230222191257.1307427-4-sjg@chromium.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:I1JHbOPOy8KqZxA2prLauKm52AC30E8PA7iR7zeq+60UT0MKxsf dnuLera16+8Cp58nMlW6ki1zBqNP2rFVrJynopY/gGF1JEz05PVD78OXGNQ2YbkFRvdvR8v NL20MEc84rdqzPsux92QB3fmno38tA68X+sjWKLCSVrIKfWUTNkA9HqlyP7JP5F202k7dWu Fi/c/5sXrlsraVnNmmV7Q== UI-OutboundReport: notjunk:1;M01:P0:xfHZZXiBoHk=;7+WkwcYWoUDwc2ZMG0sYBP8515z BOXmpAhI6+SSJAwhj1S+tbKnoiUUNaBPZ24E02k3RVSfCWFlyUOjLjOseSZv+A+8QRSfWkNVY wj2s6GFC88/DojJrFEPGobtsJXH9ZMSpcR8zwHvqrEc+o35UcbfBUctqCH8naKIo66CtFs9nU EKw+U/0CXBaDtQi2eY7eiR+enJbU75B0SqJHfuMhnLm4AdR+l/RzURX8+lnesOnflUjK3T79D PyONYoZAKdxvVy91EUdjwSBZMKCjahvbN8JZUb5ax+TTiuA4+scH/GG370iW6ztRhtLqLo6Et KTMqAZ6xI+d/f0GY6sswqnMoG1SjsdY/JMaFz56legpFy4EDu28DK/0MhfnW4w6aKSn2KYXJU ZO8yDegoIvpwdRfr8gRhgoVZJly7Fw40NWit/7RW6iTrDCQiyULkbYOCwldtRqx7kiigU1D1l vfBFSKYVAMHuE479/aSGCGDnF7uH7tvwbHB8xI0X9ZVWDhlg3lkifMk5qoK1c5qtVsKYRrGyP vV4nxnMg/IgzcglMXHenhAyxOfBSV87TyFX0cmDj8PT/t/SbRyDogpeKno59nsB6uRzt95hW/ +Jqu7yjDfluNO64BJM4MsOuHF86OQqLwA5ZdYnb3mZd8MPjFQ9mu5KdD+/M0053OTyOukgnvQ NnxWZ1iu9c82Pm89bzPJlgj0nYnHLrcXcrqTbEmmyOskfD1YOI25jU00+fwPBJ5ARpcOFDQz8 tdP3qsRI6EReZwBFQ/hDrUgv0D+QK0Q6QZYp0fkDxQwYDkW24TsWwxgcAoq98aHa40EIihN+p 86loiz5K7AHUvaAM46ZDP8/f3XlJhV34kAf6YnUsZrhbXOQUP5Db2sQMlmOqp7EJiib2GqDgE RvhZEvQK3jIfcaPz+efYS4PHV5Im7S/0oFynUwGUIG9QYy6wVPYDhaQrD6wFfn1NxlbkBVW2e M8Tp9R7f5LtJjGEywwNcrNngnAA= X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On 2/22/23 20:12, Simon Glass wrote: > The current vesa structure only provides a 32-bit value for the frame > buffer. Many modern machines use an address outside the range. > > It is still useful to have this common struct, but add a separate > frame-buffer address as well. > > Add a comment for vesa_setup_video_priv() while we are here. > > Signed-off-by: Simon Glass > --- > > (no changes since v1) > > arch/x86/lib/fsp/fsp_graphics.c | 2 +- > drivers/pci/pci_rom.c | 10 ++++++---- > drivers/video/coreboot.c | 2 +- > drivers/video/efi.c | 34 +++++++++++++++++++++------------ > include/vesa.h | 16 +++++++++++++++- > 5 files changed, 45 insertions(+), 19 deletions(-) > > diff --git a/arch/x86/lib/fsp/fsp_graphics.c b/arch/x86/lib/fsp/fsp_grap= hics.c > index b07c666caf7..2bcc49f6051 100644 > --- a/arch/x86/lib/fsp/fsp_graphics.c > +++ b/arch/x86/lib/fsp/fsp_graphics.c > @@ -106,7 +106,7 @@ static int fsp_video_probe(struct udevice *dev) > vesa->phys_base_ptr =3D dm_pci_read_bar32(dev, 2); > gd->fb_base =3D vesa->phys_base_ptr; > > - ret =3D vesa_setup_video_priv(vesa, uc_priv, plat); > + ret =3D vesa_setup_video_priv(vesa, vesa->phys_base_ptr, uc_priv, plat= ); > if (ret) > goto err; > > diff --git a/drivers/pci/pci_rom.c b/drivers/pci/pci_rom.c > index 47b6e6e5bcf..f0dfe631490 100644 > --- a/drivers/pci/pci_rom.c > +++ b/drivers/pci/pci_rom.c > @@ -325,7 +325,7 @@ err: > return ret; > } > > -int vesa_setup_video_priv(struct vesa_mode_info *vesa, > +int vesa_setup_video_priv(struct vesa_mode_info *vesa, u64 fb, > struct video_priv *uc_priv, > struct video_uc_plat *plat) > { > @@ -348,9 +348,9 @@ int vesa_setup_video_priv(struct vesa_mode_info *ves= a, > > /* Use double buffering if enabled */ > if (IS_ENABLED(CONFIG_VIDEO_COPY) && plat->base) > - plat->copy_base =3D vesa->phys_base_ptr; > + plat->copy_base =3D fb; > else > - plat->base =3D vesa->phys_base_ptr; > + plat->base =3D fb; > log_debug("base =3D %lx, copy_base =3D %lx\n", plat->base, plat->copy= _base); > plat->size =3D vesa->bytes_per_scanline * vesa->y_resolution; > > @@ -377,7 +377,9 @@ int vesa_setup_video(struct udevice *dev, int (*int1= 5_handler)(void)) > return ret; > } > > - ret =3D vesa_setup_video_priv(&mode_info.vesa, uc_priv, plat); > + ret =3D vesa_setup_video_priv(&mode_info.vesa, > + mode_info.vesa.phys_base_ptr, uc_priv, > + plat); > if (ret) { > if (ret =3D=3D -ENFILE) { > /* > diff --git a/drivers/video/coreboot.c b/drivers/video/coreboot.c > index d2d87c75c89..c586475e41e 100644 > --- a/drivers/video/coreboot.c > +++ b/drivers/video/coreboot.c > @@ -57,7 +57,7 @@ static int coreboot_video_probe(struct udevice *dev) > goto err; > } > > - ret =3D vesa_setup_video_priv(vesa, uc_priv, plat); > + ret =3D vesa_setup_video_priv(vesa, vesa->phys_base_ptr, uc_priv, plat= ); > if (ret) { > ret =3D log_msg_ret("setup", ret); > goto err; > diff --git a/drivers/video/efi.c b/drivers/video/efi.c > index 0479f207032..169637c2882 100644 > --- a/drivers/video/efi.c > +++ b/drivers/video/efi.c > @@ -5,6 +5,8 @@ > * EFI framebuffer driver based on GOP > */ > > +#define LOG_CATEGORY LOGC_EFI > + > #include > #include > #include > @@ -56,11 +58,12 @@ static void efi_find_pixel_bits(u32 mask, u8 *pos, u= 8 *size) > * Gets info from the graphics-output protocol > * > * @vesa: Place to put the mode information > + * @fbp: Returns the address of the frame buffer > * @infop: Returns a pointer to the mode info > * Returns: 0 if OK, -ENOSYS if boot services are not available, -ENOT= SUPP if > * the protocol is not supported by EFI > */ > -static int get_mode_info(struct vesa_mode_info *vesa, > +static int get_mode_info(struct vesa_mode_info *vesa, u64 *fbp, > struct efi_gop_mode_info **infop) > { > efi_guid_t efi_gop_guid =3D EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; > @@ -74,9 +77,13 @@ static int get_mode_info(struct vesa_mode_info *vesa, > ret =3D boot->locate_protocol(&efi_gop_guid, NULL, (void **)&gop); > if (ret) > return log_msg_ret("prot", -ENOTSUPP); > - > mode =3D gop->mode; > + log_debug("maxmode %u, mode %u, info %p, size %lx, fb %lx, fb_size %lx= \n", > + mode->max_mode, mode->mode, mode->info, mode->info_size, > + (ulong)mode->fb_base, (ulong)mode->fb_size); > + > vesa->phys_base_ptr =3D mode->fb_base; > + *fbp =3D mode->fb_base; > vesa->x_resolution =3D mode->info->width; > vesa->y_resolution =3D mode->info->height; > *infop =3D mode->info; > @@ -91,10 +98,11 @@ static int get_mode_info(struct vesa_mode_info *vesa= , > * it into a vesa structure. It also returns the mode information. > * > * @vesa: Place to put the mode information > + * @fbp: Returns the address of the frame buffer > * @infop: Returns a pointer to the mode info > * Returns: 0 if OK, -ve on error > */ > -static int get_mode_from_entry(struct vesa_mode_info *vesa, > +static int get_mode_from_entry(struct vesa_mode_info *vesa, u64 *fbp, > struct efi_gop_mode_info **infop) > { > struct efi_gop_mode *mode; > @@ -107,6 +115,7 @@ static int get_mode_from_entry(struct vesa_mode_info= *vesa, > return ret; > } > vesa->phys_base_ptr =3D mode->fb_base; > + *fbp =3D mode->fb_base; > vesa->x_resolution =3D mode->info->width; > vesa->y_resolution =3D mode->info->height; > *infop =3D mode->info; > @@ -114,16 +123,17 @@ static int get_mode_from_entry(struct vesa_mode_in= fo *vesa, > return 0; > } > > -static int save_vesa_mode(struct vesa_mode_info *vesa) > +static int save_vesa_mode(struct vesa_mode_info *vesa, u64 *fbp) > { > const struct efi_framebuffer *fbinfo; > struct efi_gop_mode_info *info; > int ret; > > + printf("start\n"); > if (IS_ENABLED(CONFIG_EFI_APP)) > - ret =3D get_mode_info(vesa, &info); > + ret =3D get_mode_info(vesa, fbp, &info); > else > - ret =3D get_mode_from_entry(vesa, &info); > + ret =3D get_mode_from_entry(vesa, fbp, &info); > if (ret) { > printf("EFI graphics output protocol not found (err=3D%dE)\n", > ret); > @@ -163,8 +173,7 @@ static int save_vesa_mode(struct vesa_mode_info *ves= a) > vesa->bytes_per_scanline =3D (info->pixels_per_scanline * > vesa->bits_per_pixel) / 8; > } else { > - debug("efi set unknown framebuffer format: %d\n", > - info->pixel_format); > + log_err("Unknown framebuffer format: %d\n", info->pixel_format); > return -EINVAL; > } > > @@ -176,19 +185,20 @@ static int efi_video_probe(struct udevice *dev) > struct video_uc_plat *plat =3D dev_get_uclass_plat(dev); > struct video_priv *uc_priv =3D dev_get_uclass_priv(dev); > struct vesa_mode_info *vesa =3D &mode_info.vesa; > + u64 fb; > int ret; > > /* Initialize vesa_mode_info structure */ > - ret =3D save_vesa_mode(vesa); > + ret =3D save_vesa_mode(vesa, &fb); > if (ret) > goto err; > > - ret =3D vesa_setup_video_priv(vesa, uc_priv, plat); > + ret =3D vesa_setup_video_priv(vesa, fb, uc_priv, plat); > if (ret) > goto err; > > - printf("Video: %dx%dx%d\n", uc_priv->xsize, uc_priv->ysize, > - vesa->bits_per_pixel); > + printf("Video: %dx%dx%d @ %lx\n", uc_priv->xsize, uc_priv->ysize, > + vesa->bits_per_pixel, (ulong)fb); > > return 0; > > diff --git a/include/vesa.h b/include/vesa.h > index a42c1796863..98112208114 100644 > --- a/include/vesa.h > +++ b/include/vesa.h > @@ -108,7 +108,21 @@ extern struct vesa_state mode_info; > > struct video_priv; > struct video_uc_plat; > -int vesa_setup_video_priv(struct vesa_mode_info *vesa, > + > +/** > + * vesa_setup_video_priv() - Set up a video device using VESA informati= on > + * > + * The vesa struct is used by various x86 drivers, so this is a common = function > + * to use it to set up the video. > + * > + * @vesa: Vesa information to use (vesa->phys_base_ptr is ignored) > + * @fb: Frame buffer address (since vesa->phys_base_ptr is only 32 bits= ) > + * @uc_priv: Video device's uclass-private information > + * @plat: Video devices's uclass-private platform data > + * @return 0 if OK, -ENXIO if the x resolution is 0, -EEPROTONOSUPPORT = if the %s/@return/Return:/g cf. https://docs.kernel.org/doc-guide/kernel-doc.html#return-values Best regards Heinrich > + * pixel format is not supported > + */ > +int vesa_setup_video_priv(struct vesa_mode_info *vesa, u64 fb, > struct video_priv *uc_priv, > struct video_uc_plat *plat); > int vesa_setup_video(struct udevice *dev, int (*int15_handler)(void));