OsdEnvironment.c revision 193530
1228753Smm/*- 2228753Smm * Copyright (c) 2000,2001 Michael Smith 3228753Smm * Copyright (c) 2000 BSDi 4228753Smm * All rights reserved. 5228753Smm * 6228753Smm * Redistribution and use in source and binary forms, with or without 7228753Smm * modification, are permitted provided that the following conditions 8228753Smm * are met: 9228753Smm * 1. Redistributions of source code must retain the above copyright 10228753Smm * notice, this list of conditions and the following disclaimer. 11228753Smm * 2. Redistributions in binary form must reproduce the above copyright 12228753Smm * notice, this list of conditions and the following disclaimer in the 13228753Smm * documentation and/or other materials provided with the distribution. 14228753Smm * 15228753Smm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16228753Smm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17228753Smm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18228753Smm * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19228753Smm * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20228753Smm * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21228753Smm * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22228753Smm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23228753Smm * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24228753Smm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25228763Smm * SUCH DAMAGE. 26228753Smm */ 27228753Smm 28228753Smm#include <sys/cdefs.h> 29228753Smm__FBSDID("$FreeBSD: head/sys/ia64/acpica/OsdEnvironment.c 193530 2009-06-05 18:44:36Z jkim $"); 30228753Smm 31228753Smm#include <sys/types.h> 32228753Smm#include <sys/linker_set.h> 33228753Smm#include <sys/sysctl.h> 34228753Smm#include <machine/efi.h> 35228753Smm 36228753Smm#include <contrib/dev/acpica/include/acpi.h> 37228753Smm 38228753Smmstatic struct uuid acpi_root_uuid = EFI_TABLE_ACPI20; 39228753Smm 40228753Smmstatic u_long acpi_root_phys; 41228753Smm 42228753SmmSYSCTL_ULONG(_machdep, OID_AUTO, acpi_root, CTLFLAG_RD, &acpi_root_phys, 0, 43228753Smm "The physical address of the RSDP"); 44228753Smm 45228753SmmACPI_STATUS 46228753SmmAcpiOsInitialize(void) 47228753Smm{ 48228753Smm 49228753Smm return(AE_OK); 50228753Smm} 51228753Smm 52228753SmmACPI_STATUS 53228753SmmAcpiOsTerminate(void) 54228753Smm{ 55228753Smm 56228753Smm return(AE_OK); 57228753Smm} 58228753Smm 59228753SmmACPI_PHYSICAL_ADDRESS 60228753SmmAcpiOsGetRootPointer(void) 61228753Smm{ 62228753Smm void *acpi_root; 63232153Smm 64232153Smm if (acpi_root_phys == 0) { 65232153Smm acpi_root = efi_get_table(&acpi_root_uuid); 66228753Smm if (acpi_root == NULL) 67228753Smm return (0); 68228753Smm acpi_root_phys = IA64_RR_MASK((u_long)acpi_root); 69228753Smm } 70228753Smm 71228753Smm return (acpi_root_phys); 72228753Smm} 73228753Smm