svn commit: r247447 - projects/uefi/sys/boot/amd64/efi

Benno Rice benno at FreeBSD.org
Thu Feb 28 05:18:17 UTC 2013


Author: benno
Date: Thu Feb 28 05:18:15 2013
New Revision: 247447
URL: http://svnweb.freebsd.org/changeset/base/247447

Log:
  Rename efifb.* to framebuffer.*, making it a bit more obvious what it's for.

Added:
  projects/uefi/sys/boot/amd64/efi/framebuffer.c
     - copied unchanged from r247446, projects/uefi/sys/boot/amd64/efi/efifb.c
  projects/uefi/sys/boot/amd64/efi/framebuffer.h
     - copied unchanged from r247446, projects/uefi/sys/boot/amd64/efi/efifb.h
Deleted:
  projects/uefi/sys/boot/amd64/efi/efifb.c
  projects/uefi/sys/boot/amd64/efi/efifb.h
Modified:
  projects/uefi/sys/boot/amd64/efi/Makefile
  projects/uefi/sys/boot/amd64/efi/efimd.c

Modified: projects/uefi/sys/boot/amd64/efi/Makefile
==============================================================================
--- projects/uefi/sys/boot/amd64/efi/Makefile	Thu Feb 28 05:02:53 2013	(r247446)
+++ projects/uefi/sys/boot/amd64/efi/Makefile	Thu Feb 28 05:18:15 2013	(r247447)
@@ -12,7 +12,7 @@ INTERNALPROG=
 # architecture-specific loader code
 SRCS=	main.c conf.c vers.c reloc.c elf64_freebsd.c
 SRCS+=	copy.c bootinfo.c bootinfo64.c autoload.c devicename.c efimd.c
-SRCS+=	efifb.c amd64_tramp.S start.S
+SRCS+=	framebuffer.c amd64_tramp.S start.S
 
 CFLAGS+=	-fPIC
 CFLAGS+=	-I.

Modified: projects/uefi/sys/boot/amd64/efi/efimd.c
==============================================================================
--- projects/uefi/sys/boot/amd64/efi/efimd.c	Thu Feb 28 05:02:53 2013	(r247446)
+++ projects/uefi/sys/boot/amd64/efi/efimd.c	Thu Feb 28 05:18:15 2013	(r247447)
@@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$");
 #include <machine/metadata.h>
 
 #include "bootstrap.h"
-#include "efifb.h"
+#include "framebuffer.h"
 
 static UINTN mapkey;
 

Copied: projects/uefi/sys/boot/amd64/efi/framebuffer.c (from r247446, projects/uefi/sys/boot/amd64/efi/efifb.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/uefi/sys/boot/amd64/efi/framebuffer.c	Thu Feb 28 05:18:15 2013	(r247447, copy of r247446, projects/uefi/sys/boot/amd64/efi/efifb.c)
@@ -0,0 +1,88 @@
+/*-
+ * Copyright (c) 2013 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Benno Rice under sponsorship from
+ * the FreeBSD Foundation.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stand.h>
+
+#include <efi.h>
+#include <efilib.h>
+
+#include <machine/efi.h>
+
+static EFI_GUID gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
+
+void
+efi_find_framebuffer(struct efi_header *efihdr)
+{
+	EFI_GRAPHICS_OUTPUT			*gop;
+	EFI_STATUS				status;
+	EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE	*mode;
+	EFI_GRAPHICS_OUTPUT_MODE_INFORMATION	*info;
+
+	status = BS->LocateProtocol(&gop_guid, NULL, (VOID **)&gop);
+	if (EFI_ERROR(status)) {
+		efihdr->fb.fb_present = 0;
+		return;
+	}
+
+	mode = gop->Mode;
+	info = gop->Mode->Info;
+
+	efihdr->fb.fb_present = 1;
+	efihdr->fb.fb_addr = mode->FrameBufferBase;
+	efihdr->fb.fb_size = mode->FrameBufferSize;
+	efihdr->fb.fb_height = info->VerticalResolution;
+	efihdr->fb.fb_width = info->HorizontalResolution;
+	efihdr->fb.fb_stride = info->PixelsPerScanLine;
+
+	switch (info->PixelFormat) {
+	case PixelRedGreenBlueReserved8BitPerColor:
+		efihdr->fb.fb_mask_red = 0x000000ff;
+		efihdr->fb.fb_mask_green = 0x0000ff00;
+		efihdr->fb.fb_mask_blue = 0x00ff0000;
+		efihdr->fb.fb_mask_reserved = 0xff000000;
+		break;
+	case PixelBlueGreenRedReserved8BitPerColor:
+		efihdr->fb.fb_mask_red = 0x00ff0000;
+		efihdr->fb.fb_mask_green = 0x0000ff00;
+		efihdr->fb.fb_mask_blue = 0x000000ff;
+		efihdr->fb.fb_mask_reserved = 0xff000000;
+		break;
+	case PixelBitMask:
+		efihdr->fb.fb_mask_red = info->PixelInformation.RedMask;
+		efihdr->fb.fb_mask_green = info->PixelInformation.GreenMask;
+		efihdr->fb.fb_mask_blue = info->PixelInformation.BlueMask;
+		efihdr->fb.fb_mask_reserved =
+		    info->PixelInformation.ReservedMask;
+		break;
+	default:
+		efihdr->fb.fb_present = 0;
+	}
+}

Copied: projects/uefi/sys/boot/amd64/efi/framebuffer.h (from r247446, projects/uefi/sys/boot/amd64/efi/efifb.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/uefi/sys/boot/amd64/efi/framebuffer.h	Thu Feb 28 05:18:15 2013	(r247447, copy of r247446, projects/uefi/sys/boot/amd64/efi/efifb.h)
@@ -0,0 +1,6 @@
+#ifndef	_EFIFB_H_
+#define	_EFIFB_H_
+
+void	efi_find_framebuffer(struct efi_header *efihdr);
+
+#endif /* _EFIFB_H_ */


More information about the svn-src-projects mailing list