Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86 x86: Rename x86/efi.c -> x86/efi_machdep.c.
details: https://anonhg.NetBSD.org/src/rev/a2451d9448d7
branches: trunk
changeset: 369751:a2451d9448d7
user: riastradh <riastradh%NetBSD.org@localhost>
date: Tue Aug 30 11:03:36 2022 +0000
description:
x86: Rename x86/efi.c -> x86/efi_machdep.c.
Avoid collision with dev/efi.c.
diffstat:
sys/arch/x86/conf/files.x86 | 4 +-
sys/arch/x86/x86/efi.c | 550 -----------------------------------------
sys/arch/x86/x86/efi_machdep.c | 550 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 552 insertions(+), 552 deletions(-)
diffs (truncated from 1126 to 300 lines):
diff -r a78c2da13b08 -r a2451d9448d7 sys/arch/x86/conf/files.x86
--- a/sys/arch/x86/conf/files.x86 Tue Aug 30 11:00:49 2022 +0000
+++ b/sys/arch/x86/conf/files.x86 Tue Aug 30 11:03:36 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.x86,v 1.122 2021/07/21 23:26:15 jmcneill Exp $
+# $NetBSD: files.x86,v 1.123 2022/08/30 11:03:36 riastradh Exp $
# options for MP configuration through the MP spec
defflag opt_mpbios.h MPBIOS MPDEBUG MPBIOS_SCANPCI
@@ -89,7 +89,7 @@
file arch/x86/x86/cpu_topology.c machdep
file arch/x86/x86/db_memrw.c ddb | kgdb
file arch/x86/x86/db_trace.c ddb
-file arch/x86/x86/efi.c machdep
+file arch/x86/x86/efi_machdep.c machdep
file arch/x86/x86/errata.c machdep
file arch/x86/x86/genfb_machdep.c machdep
file arch/x86/x86/identcpu.c machdep
diff -r a78c2da13b08 -r a2451d9448d7 sys/arch/x86/x86/efi.c
--- a/sys/arch/x86/x86/efi.c Tue Aug 30 11:00:49 2022 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,550 +0,0 @@
-/* $NetBSD: efi.c,v 1.22 2021/10/07 12:52:27 msaitoh Exp $ */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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>
-__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.22 2021/10/07 12:52:27 msaitoh Exp $");
-
-#include <sys/kmem.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/uuid.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/bootinfo.h>
-#include <x86/bus_defs.h>
-#include <x86/bus_funcs.h>
-#include <x86/efi.h>
-
-#include <dev/mm.h>
-#if NPCI > 0
-#include <dev/pci/pcivar.h> /* for pci_mapreg_map_enable_decode */
-#endif
-
-const struct uuid EFI_UUID_ACPI20 = EFI_TABLE_ACPI20;
-const struct uuid EFI_UUID_ACPI10 = EFI_TABLE_ACPI10;
-const struct uuid EFI_UUID_SMBIOS = EFI_TABLE_SMBIOS;
-const struct uuid EFI_UUID_SMBIOS3 = EFI_TABLE_SMBIOS3;
-
-static vaddr_t efi_getva(paddr_t);
-static void efi_relva(paddr_t, vaddr_t);
-struct efi_cfgtbl *efi_getcfgtblhead(void);
-void efi_aprintcfgtbl(void);
-void efi_aprintuuid(const struct uuid *);
-bool efi_uuideq(const struct uuid *, const struct uuid *);
-
-static bool efi_is32x64 = false;
-static paddr_t efi_systbl_pa;
-static struct efi_systbl *efi_systbl_va = NULL;
-static struct efi_cfgtbl *efi_cfgtblhead_va = NULL;
-static struct efi_e820memmap {
- struct btinfo_memmap bim;
- struct bi_memmap_entry entry[VM_PHYSSEG_MAX - 1];
-} efi_e820memmap;
-
-/*
- * Map a physical address (PA) to a newly allocated virtual address (VA).
- * The VA must be freed using efi_relva().
- */
-static vaddr_t
-efi_getva(paddr_t pa)
-{
- vaddr_t va;
- int rv;
-
- rv = _x86_memio_map(x86_bus_space_mem, pa,
- PAGE_SIZE, 0, (bus_space_handle_t *)&va);
- if (rv != 0) {
- aprint_debug("efi: unable to allocate va\n");
- return 0;
- }
-
- return va;
-}
-
-/*
- * Free a virtual address (VA) allocated using efi_getva().
- */
-static void
-efi_relva(paddr_t pa, vaddr_t va)
-{
- (void)_x86_memio_unmap(x86_bus_space_mem, (bus_space_handle_t)va,
- PAGE_SIZE, NULL);
-}
-
-/*
- * Test if 2 UUIDs matches.
- */
-bool
-efi_uuideq(const struct uuid * a, const struct uuid * b)
-{
- return !memcmp(a, b, sizeof(struct uuid));
-}
-
-/*
- * Print an UUID in a human-readable manner.
- */
-void
-efi_aprintuuid(const struct uuid * uuid)
-{
- int i;
-
- aprint_debug(" %08" PRIx32 "", uuid->time_low);
- aprint_debug("-%04" PRIx16 "", uuid->time_mid);
- aprint_debug("-%04" PRIx16 "", uuid->time_hi_and_version);
- aprint_debug("-%02" PRIx8 "", uuid->clock_seq_hi_and_reserved);
- aprint_debug("-%02" PRIx8 "", uuid->clock_seq_low);
- aprint_debug("-");
- for (i = 0; i < _UUID_NODE_LEN; i++) {
- aprint_debug("%02" PRIx8 "", uuid->node[i]);
- }
- /* If known, also print the human-readable name */
- if (efi_uuideq(uuid, &EFI_UUID_ACPI20)) {
- aprint_debug(" ACPI 2.0");
- } else if (efi_uuideq(uuid, &EFI_UUID_ACPI10)) {
- aprint_debug(" ACPI 1.0");
- } else if (efi_uuideq(uuid, &EFI_UUID_SMBIOS)) {
- aprint_debug(" SMBIOS");
- } else if (efi_uuideq(uuid, &EFI_UUID_SMBIOS3)) {
- aprint_debug(" SMBIOS3");
- }
-}
-
-/*
- * Return the VA of the cfgtbl. Must be freed using efi_relva().
- */
-struct efi_cfgtbl *
-efi_getcfgtblhead(void)
-{
- paddr_t pa;
- vaddr_t va;
-
- if (efi_cfgtblhead_va != NULL)
- return efi_cfgtblhead_va;
-
- if (efi_is32x64) {
-#if defined(__amd64__)
- struct efi_systbl32 *systbl32 = (void *) efi_systbl_va;
- pa = systbl32->st_cfgtbl;
-#elif defined(__i386__)
- struct efi_systbl64 *systbl64 = (void *) efi_systbl_va;
- if (systbl64->st_cfgtbl & 0xffffffff00000000ULL)
- return NULL;
- pa = (paddr_t) systbl64->st_cfgtbl;
-#endif
- } else
- pa = (paddr_t)(u_long) efi_systbl_va->st_cfgtbl;
- aprint_debug("efi: cfgtbl at pa %" PRIxPADDR "\n", pa);
- va = efi_getva(pa);
- aprint_debug("efi: cfgtbl mapped at va %" PRIxVADDR "\n", va);
- efi_cfgtblhead_va = (struct efi_cfgtbl *) va;
- efi_aprintcfgtbl();
-
- return efi_cfgtblhead_va;
-}
-
-/*
- * Print the config tables.
- */
-void
-efi_aprintcfgtbl(void)
-{
- struct efi_cfgtbl *ct;
- unsigned long count;
-
- if (efi_is32x64) {
-#if defined(__amd64__)
- struct efi_systbl32 *systbl32 = (void *) efi_systbl_va;
- struct efi_cfgtbl32 *ct32 = (void *) efi_cfgtblhead_va;
-
- count = systbl32->st_entries;
- aprint_debug("efi: %lu cfgtbl entries:\n", count);
- for (; count; count--, ct32++) {
- aprint_debug("efi: %08" PRIx32, ct32->ct_data);
- efi_aprintuuid(&ct32->ct_uuid);
- aprint_debug("\n");
- }
-#elif defined(__i386__)
- struct efi_systbl64 *systbl64 = (void *) efi_systbl_va;
- struct efi_cfgtbl64 *ct64 = (void *) efi_cfgtblhead_va;
- uint64_t count64 = systbl64->st_entries;
-
- aprint_debug("efi: %" PRIu64 " cfgtbl entries:\n", count64);
- for (; count64; count64--, ct64++) {
- aprint_debug("efi: %016" PRIx64, ct64->ct_data);
- efi_aprintuuid(&ct64->ct_uuid);
- aprint_debug("\n");
- }
-#endif
- return;
- }
-
- ct = efi_cfgtblhead_va;
- count = efi_systbl_va->st_entries;
- aprint_debug("efi: %lu cfgtbl entries:\n", count);
- for (; count; count--, ct++) {
- aprint_debug("efi: %p", ct->ct_data);
- efi_aprintuuid(&ct->ct_uuid);
- aprint_debug("\n");
- }
-}
-
-/*
- * Return the VA of the config table with the given UUID if found.
- * The VA must be freed using efi_relva().
- */
-void *
-efi_getcfgtbl(const struct uuid * uuid)
-{
- paddr_t pa;
- vaddr_t va;
-
- pa = efi_getcfgtblpa(uuid);
- if (pa == 0)
- return NULL;
- va = efi_getva(pa);
- return (void *) va;
-}
-
-/*
- * Return the PA of the first config table.
- */
-paddr_t
-efi_getcfgtblpa(const struct uuid * uuid)
-{
- struct efi_cfgtbl *ct;
- unsigned long count;
-
- if (efi_is32x64) {
-#if defined(__amd64__)
- struct efi_systbl32 *systbl32 = (void *) efi_systbl_va;
- struct efi_cfgtbl32 *ct32 = (void *) efi_cfgtblhead_va;
-
- count = systbl32->st_entries;
- for (; count; count--, ct32++)
- if (efi_uuideq(&ct32->ct_uuid, uuid))
- return ct32->ct_data;
-#elif defined(__i386__)
- struct efi_systbl64 *systbl64 = (void *) efi_systbl_va;
- struct efi_cfgtbl64 *ct64 = (void *) efi_cfgtblhead_va;
- uint64_t count64 = systbl64->st_entries;
-
- for (; count64; count64--, ct64++)
- if (efi_uuideq(&ct64->ct_uuid, uuid))
- if (!(ct64->ct_data & 0xffffffff00000000ULL))
- return ct64->ct_data;
-#endif
- return 0; /* Not found. */
- }
-
- ct = efi_cfgtblhead_va;
- count = efi_systbl_va->st_entries;
- for (; count; count--, ct++)
- if (efi_uuideq(&ct->ct_uuid, uuid))
- return (paddr_t)(u_long) ct->ct_data;
-
- return 0; /* Not found. */
-}
-
-/* Return the PA of the EFI System Table. */
-paddr_t
-efi_getsystblpa(void)
-{
- struct btinfo_efi *bi;
Home |
Main Index |
Thread Index |
Old Index