Wed Aug 24 10:27:23 2016 UTC ()
fix incorrect check in efi_getcfgtblhead().


(nonaka)
diff -r1.3 -r1.4 src/sys/arch/x86/x86/efi.c

cvs diff -r1.3 -r1.4 src/sys/arch/x86/x86/Attic/efi.c (expand / switch to unified diff)

--- src/sys/arch/x86/x86/Attic/efi.c 2016/06/10 07:50:15 1.3
+++ src/sys/arch/x86/x86/Attic/efi.c 2016/08/24 10:27:23 1.4
@@ -1,41 +1,41 @@ @@ -1,41 +1,41 @@
1/* $NetBSD: efi.c,v 1.3 2016/06/10 07:50:15 pgoyette Exp $ */ 1/* $NetBSD: efi.c,v 1.4 2016/08/24 10:27:23 nonaka Exp $ */
2/*- 2/*-
3 * Copyright (c) 2016 The NetBSD Foundation, Inc. 3 * Copyright (c) 2016 The NetBSD Foundation, Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
15 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 15 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 16 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE. 25 * POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27#include <sys/cdefs.h> 27#include <sys/cdefs.h>
28__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.3 2016/06/10 07:50:15 pgoyette Exp $"); 28__KERNEL_RCSID(0, "$NetBSD: efi.c,v 1.4 2016/08/24 10:27:23 nonaka Exp $");
29#include <sys/kmem.h> 29#include <sys/kmem.h>
30#include <sys/param.h> 30#include <sys/param.h>
31#include <sys/systm.h> 31#include <sys/systm.h>
32#include <sys/uuid.h> 32#include <sys/uuid.h>
33 33
34#include <uvm/uvm_extern.h> 34#include <uvm/uvm_extern.h>
35 35
36#include <machine/bootinfo.h> 36#include <machine/bootinfo.h>
37#include <x86/efi.h> 37#include <x86/efi.h>
38 38
39#include <dev/mm.h> 39#include <dev/mm.h>
40 40
41const struct uuid EFI_UUID_ACPI20 = { 41const struct uuid EFI_UUID_ACPI20 = {
@@ -137,28 +137,28 @@ efi_aprintuuid(const struct uuid * uuid) @@ -137,28 +137,28 @@ efi_aprintuuid(const struct uuid * uuid)
137 aprint_debug(" ACPI 1.0"); 137 aprint_debug(" ACPI 1.0");
138 } 138 }
139} 139}
140 140
141/* 141/*
142 * Return the VA of the cfgtbl. Must be freed using efi_relva(). 142 * Return the VA of the cfgtbl. Must be freed using efi_relva().
143 */ 143 */
144struct efi_cfgtbl * 144struct efi_cfgtbl *
145efi_getcfgtblhead(void) 145efi_getcfgtblhead(void)
146{ 146{
147 paddr_t pa; 147 paddr_t pa;
148 vaddr_t va; 148 vaddr_t va;
149 149
150 if (efi_cfgtblhead_va == NULL) 150 if (efi_cfgtblhead_va != NULL)
151 return NULL; 151 return efi_cfgtblhead_va;
152 152
153 pa = (paddr_t) efi_systbl_va->st_cfgtbl; 153 pa = (paddr_t) efi_systbl_va->st_cfgtbl;
154 aprint_debug("efi: cfgtbl at pa %" PRIxPADDR "\n", pa); 154 aprint_debug("efi: cfgtbl at pa %" PRIxPADDR "\n", pa);
155 va = efi_getva(pa); 155 va = efi_getva(pa);
156 aprint_debug("efi: cfgtbl mapped at va %" PRIxVADDR "\n", va); 156 aprint_debug("efi: cfgtbl mapped at va %" PRIxVADDR "\n", va);
157 efi_cfgtblhead_va = (struct efi_cfgtbl *) va; 157 efi_cfgtblhead_va = (struct efi_cfgtbl *) va;
158 efi_aprintcfgtbl(); 158 efi_aprintcfgtbl();
159 159
160 return efi_cfgtblhead_va; 160 return efi_cfgtblhead_va;
161} 161}
162 162
163/* 163/*
164 * Print the config tables. 164 * Print the config tables.