This helper is used by the EFI driver and we would like to use that on ARM. Move the helper function into its own file, separate from PCI ROMs, which are an x86 thing. Add a forward declaration for struct udevice so that the header can be included directly. Signed-off-by: Simon Glass <sjg@chromium.org>
43 lines
992 B
C
43 lines
992 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright (C) 2014 Google, Inc
|
|
*/
|
|
|
|
#include <errno.h>
|
|
#include <log.h>
|
|
#include <vesa.h>
|
|
#include <video.h>
|
|
|
|
int vesa_setup_video_priv(struct vesa_mode_info *vesa, u64 fb,
|
|
struct video_priv *uc_priv,
|
|
struct video_uc_plat *plat)
|
|
{
|
|
if (!vesa->x_resolution)
|
|
return log_msg_ret("No x resolution", -ENXIO);
|
|
uc_priv->xsize = vesa->x_resolution;
|
|
uc_priv->ysize = vesa->y_resolution;
|
|
uc_priv->line_length = vesa->bytes_per_scanline;
|
|
switch (vesa->bits_per_pixel) {
|
|
case 32:
|
|
case 24:
|
|
uc_priv->bpix = VIDEO_BPP32;
|
|
uc_priv->format = VIDEO_X8B8G8R8;
|
|
break;
|
|
case 16:
|
|
uc_priv->bpix = VIDEO_BPP16;
|
|
break;
|
|
default:
|
|
return -EPROTONOSUPPORT;
|
|
}
|
|
|
|
/* Use double buffering if enabled */
|
|
if (IS_ENABLED(CONFIG_VIDEO_COPY) && plat->base)
|
|
plat->copy_base = fb;
|
|
else
|
|
plat->base = fb;
|
|
log_debug("base = %lx, copy_base = %lx\n", plat->base, plat->copy_base);
|
|
plat->size = vesa->bytes_per_scanline * vesa->y_resolution;
|
|
|
|
return 0;
|
|
}
|