svn commit: r247444 - projects/uefi/sys/boot/i386/efi
Benno Rice
benno at FreeBSD.org
Thu Feb 28 04:43:47 UTC 2013
Author: benno
Date: Thu Feb 28 04:43:44 2013
New Revision: 247444
URL: http://svnweb.freebsd.org/changeset/base/247444
Log:
Remove usage of i386_ prefixes and unneeded references to libi386.
Added:
projects/uefi/sys/boot/i386/efi/copy.c
- copied unchanged from r247443, projects/uefi/sys/boot/i386/efi/x86_efi_copy.c
projects/uefi/sys/boot/i386/efi/x86_efi.h
- copied, changed from r247443, projects/uefi/sys/boot/i386/efi/x86_efi_copy.h
Deleted:
projects/uefi/sys/boot/i386/efi/x86_efi_copy.c
projects/uefi/sys/boot/i386/efi/x86_efi_copy.h
Modified:
projects/uefi/sys/boot/i386/efi/Makefile
projects/uefi/sys/boot/i386/efi/autoload.c
projects/uefi/sys/boot/i386/efi/bootinfo.c
projects/uefi/sys/boot/i386/efi/bootinfo64.c
projects/uefi/sys/boot/i386/efi/devicename.c
projects/uefi/sys/boot/i386/efi/elf64_freebsd.c
projects/uefi/sys/boot/i386/efi/main.c
Modified: projects/uefi/sys/boot/i386/efi/Makefile
==============================================================================
--- projects/uefi/sys/boot/i386/efi/Makefile Thu Feb 28 04:16:47 2013 (r247443)
+++ projects/uefi/sys/boot/i386/efi/Makefile Thu Feb 28 04:43:44 2013 (r247444)
@@ -11,7 +11,7 @@ INTERNALPROG=
# architecture-specific loader code
SRCS= main.c conf.c vers.c reloc.c elf64_freebsd.c
-SRCS+= x86_efi_copy.c bootinfo.c bootinfo64.c autoload.c devicename.c efimd.c
+SRCS+= copy.c bootinfo.c bootinfo64.c autoload.c devicename.c efimd.c
SRCS+= efifb.c amd64_tramp.S start.S
CFLAGS+= -fPIC
Modified: projects/uefi/sys/boot/i386/efi/autoload.c
==============================================================================
--- projects/uefi/sys/boot/i386/efi/autoload.c Thu Feb 28 04:16:47 2013 (r247443)
+++ projects/uefi/sys/boot/i386/efi/autoload.c Thu Feb 28 04:43:44 2013 (r247444)
@@ -28,7 +28,7 @@
__FBSDID("$FreeBSD$");
int
-i386_autoload(void)
+x86_efi_autoload(void)
{
return (0);
Modified: projects/uefi/sys/boot/i386/efi/bootinfo.c
==============================================================================
--- projects/uefi/sys/boot/i386/efi/bootinfo.c Thu Feb 28 04:16:47 2013 (r247443)
+++ projects/uefi/sys/boot/i386/efi/bootinfo.c Thu Feb 28 04:43:44 2013 (r247444)
@@ -38,9 +38,7 @@ __FBSDID("$FreeBSD$");
#include <efilib.h>
#include "bootstrap.h"
-#include "libi386.h"
-
-#include "x86_efi_copy.h"
+#include "x86_efi.h"
/*
* Return a 'boothowto' value corresponding to the kernel arguments in
Modified: projects/uefi/sys/boot/i386/efi/bootinfo64.c
==============================================================================
--- projects/uefi/sys/boot/i386/efi/bootinfo64.c Thu Feb 28 04:16:47 2013 (r247443)
+++ projects/uefi/sys/boot/i386/efi/bootinfo64.c Thu Feb 28 04:43:44 2013 (r247444)
@@ -35,8 +35,7 @@ __FBSDID("$FreeBSD$");
#include <machine/psl.h>
#include <machine/specialreg.h>
#include "bootstrap.h"
-#include "libi386.h"
-#include "x86_efi_copy.h"
+#include "x86_efi.h"
/*
* Copy module-related data into the load area, where it can be
@@ -140,7 +139,7 @@ int
bi_load64(char *args, vm_offset_t *modulep, vm_offset_t *kernendp)
{
struct preloaded_file *xp, *kfp;
- struct i386_devdesc *rootdev;
+ struct devdesc *rootdev;
struct file_metadata *md;
vm_offset_t addr;
u_int64_t kernend;
@@ -157,14 +156,14 @@ bi_load64(char *args, vm_offset_t *modul
* MI code before launching the kernel.
*/
rootdevname = getenv("rootdev");
- i386_getdev((void **)(&rootdev), rootdevname, NULL);
+ x86_efi_getdev((void **)(&rootdev), rootdevname, NULL);
if (rootdev == NULL) { /* bad $rootdev/$currdev */
printf("can't determine root device\n");
return(EINVAL);
}
/* Try reading the /etc/fstab file to select the root device */
- getrootmount(i386_fmtdev((void *)rootdev));
+ getrootmount(x86_efi_fmtdev((void *)rootdev));
/* find the last module in the chain */
addr = 0;
Copied: projects/uefi/sys/boot/i386/efi/copy.c (from r247443, projects/uefi/sys/boot/i386/efi/x86_efi_copy.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/uefi/sys/boot/i386/efi/copy.c Thu Feb 28 04:43:44 2013 (r247444, copy of r247443, projects/uefi/sys/boot/i386/efi/x86_efi_copy.c)
@@ -0,0 +1,102 @@
+/*-
+ * 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 <sys/param.h>
+
+#include <stand.h>
+#include <bootstrap.h>
+
+#include <efi.h>
+#include <efilib.h>
+
+#define STAGE_PAGES 8192 /* 32MB */
+
+EFI_PHYSICAL_ADDRESS staging;
+int stage_offset_set = 0;
+ssize_t stage_offset;
+
+int
+x86_efi_copy_init(void)
+{
+ EFI_STATUS status;
+
+ status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData,
+ STAGE_PAGES, &staging);
+ if (EFI_ERROR(status)) {
+ printf("failed to allocate staging area: %d\n",
+ status & EFI_ERROR_MASK);
+ return (status);
+ }
+
+ return (0);
+}
+
+ssize_t
+x86_efi_copyin(const void *src, vm_offset_t dest, const size_t len)
+{
+
+ if (!stage_offset_set) {
+ stage_offset = (vm_offset_t)staging - dest;
+ stage_offset_set = 1;
+ }
+
+ bcopy(src, (void *)(dest + stage_offset), len);
+ return (len);
+}
+
+ssize_t
+x86_efi_copyout(const vm_offset_t src, void *dest, const size_t len)
+{
+
+ bcopy((void *)(src + stage_offset), dest, len);
+ return (len);
+}
+
+
+ssize_t
+x86_efi_readin(const int fd, vm_offset_t dest, const size_t len)
+{
+
+ return (read(fd, (void *)(dest + stage_offset), len));
+}
+
+void
+x86_efi_copy_finish(void)
+{
+ uint64_t *src, *dst, *last;
+
+ src = (uint64_t *)staging;
+ dst = (uint64_t *)(staging - stage_offset);
+ last = (uint64_t *)(staging + STAGE_PAGES * EFI_PAGE_SIZE);
+
+ while (src < last)
+ *dst++ = *src++;
+}
Modified: projects/uefi/sys/boot/i386/efi/devicename.c
==============================================================================
--- projects/uefi/sys/boot/i386/efi/devicename.c Thu Feb 28 04:16:47 2013 (r247443)
+++ projects/uefi/sys/boot/i386/efi/devicename.c Thu Feb 28 04:43:44 2013 (r247444)
@@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$");
#include <efi.h>
#include <efilib.h>
-static int i386_parsedev(struct devdesc **, const char *, const char **);
+static int x86_efi_parsedev(struct devdesc **, const char *, const char **);
/*
* Point (dev) at an allocated device specifier for the device matching the
@@ -44,7 +44,7 @@ static int i386_parsedev(struct devdesc
* use that. If not, use the default device.
*/
int
-i386_getdev(void **vdev, const char *devspec, const char **path)
+x86_efi_getdev(void **vdev, const char *devspec, const char **path)
{
struct devdesc **dev = (struct devdesc **)vdev;
int rv;
@@ -54,14 +54,14 @@ i386_getdev(void **vdev, const char *dev
* use the current device instead.
*/
if (devspec == NULL || *devspec == '/' || !strchr(devspec, ':')) {
- rv = i386_parsedev(dev, getenv("currdev"), NULL);
+ rv = x86_efi_parsedev(dev, getenv("currdev"), NULL);
if (rv == 0 && path != NULL)
*path = devspec;
return (rv);
}
/* Parse the device name off the beginning of the devspec. */
- return (i386_parsedev(dev, devspec, path));
+ return (x86_efi_parsedev(dev, devspec, path));
}
/*
@@ -78,7 +78,7 @@ i386_getdev(void **vdev, const char *dev
* fs<unit>:
*/
static int
-i386_parsedev(struct devdesc **dev, const char *devspec, const char **path)
+x86_efi_parsedev(struct devdesc **dev, const char *devspec, const char **path)
{
struct devdesc *idev;
struct devsw *dv;
@@ -132,7 +132,7 @@ i386_parsedev(struct devdesc **dev, cons
}
char *
-i386_fmtdev(void *vdev)
+x86_efi_fmtdev(void *vdev)
{
struct devdesc *dev = (struct devdesc *)vdev;
static char buf[32]; /* XXX device length constant? */
@@ -154,12 +154,12 @@ i386_fmtdev(void *vdev)
* Set currdev to suit the value being supplied in (value)
*/
int
-i386_setcurrdev(struct env_var *ev, int flags, const void *value)
+x86_efi_setcurrdev(struct env_var *ev, int flags, const void *value)
{
struct devdesc *ncurr;
int rv;
- rv = i386_parsedev(&ncurr, value, NULL);
+ rv = x86_efi_parsedev(&ncurr, value, NULL);
if (rv != 0)
return(rv);
Modified: projects/uefi/sys/boot/i386/efi/elf64_freebsd.c
==============================================================================
--- projects/uefi/sys/boot/i386/efi/elf64_freebsd.c Thu Feb 28 04:16:47 2013 (r247443)
+++ projects/uefi/sys/boot/i386/efi/elf64_freebsd.c Thu Feb 28 04:43:44 2013 (r247444)
@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
#include "actypes.h"
#include "actbl.h"
-#include "x86_efi_copy.h"
+#include "x86_efi.h"
static EFI_GUID acpi_guid = ACPI_TABLE_GUID;
static EFI_GUID acpi20_guid = ACPI_20_TABLE_GUID;
Modified: projects/uefi/sys/boot/i386/efi/main.c
==============================================================================
--- projects/uefi/sys/boot/i386/efi/main.c Thu Feb 28 04:16:47 2013 (r247443)
+++ projects/uefi/sys/boot/i386/efi/main.c Thu Feb 28 04:43:44 2013 (r247444)
@@ -36,9 +36,7 @@ __FBSDID("$FreeBSD$");
#include <efilib.h>
#include <bootstrap.h>
-#include "../libi386/libi386.h"
-
-#include "x86_efi_copy.h"
+#include "x86_efi.h"
extern char bootprog_name[];
extern char bootprog_rev[];
@@ -113,15 +111,15 @@ main(int argc, CHAR16 *argv[])
*/
BS->SetWatchdogTimer(0, 0, 0, NULL);
- env_setenv("currdev", EV_VOLATILE, i386_fmtdev(&currdev),
- i386_setcurrdev, env_nounset);
- env_setenv("loaddev", EV_VOLATILE, i386_fmtdev(&currdev), env_noset,
+ env_setenv("currdev", EV_VOLATILE, x86_efi_fmtdev(&currdev),
+ x86_efi_setcurrdev, env_nounset);
+ env_setenv("loaddev", EV_VOLATILE, x86_efi_fmtdev(&currdev), env_noset,
env_nounset);
setenv("LINES", "24", 1); /* optional */
- archsw.arch_autoload = i386_autoload;
- archsw.arch_getdev = i386_getdev;
+ archsw.arch_autoload = x86_efi_autoload;
+ archsw.arch_getdev = x86_efi_getdev;
archsw.arch_copyin = x86_efi_copyin;
archsw.arch_copyout = x86_efi_copyout;
archsw.arch_readin = x86_efi_readin;
Copied and modified: projects/uefi/sys/boot/i386/efi/x86_efi.h (from r247443, projects/uefi/sys/boot/i386/efi/x86_efi_copy.h)
==============================================================================
--- projects/uefi/sys/boot/i386/efi/x86_efi_copy.h Thu Feb 28 04:16:47 2013 (r247443, copy source)
+++ projects/uefi/sys/boot/i386/efi/x86_efi.h Thu Feb 28 04:43:44 2013 (r247444)
@@ -31,6 +31,12 @@
#ifndef _X86_EFI_COPY_H_
#define _X86_EFI_COPY_H_
+int x86_efi_autoload(void);
+
+int x86_efi_getdev(void **vdev, const char *devspec, const char **path);
+char *x86_efi_fmtdev(void *vdev);
+int x86_efi_setcurrdev(struct env_var *ev, int flags, const void *value);
+
int x86_efi_copy_init(void);
void x86_efi_copy_finish(void);
More information about the svn-src-projects
mailing list