OsdEnvironment.c revision 193530
167760Smsmith/*- 283181Smsmith * Copyright (c) 2000,2001 Michael Smith 367760Smsmith * Copyright (c) 2000 BSDi 467760Smsmith * All rights reserved. 567760Smsmith * 667760Smsmith * Redistribution and use in source and binary forms, with or without 767760Smsmith * modification, are permitted provided that the following conditions 867760Smsmith * are met: 967760Smsmith * 1. Redistributions of source code must retain the above copyright 1067760Smsmith * notice, this list of conditions and the following disclaimer. 1167760Smsmith * 2. Redistributions in binary form must reproduce the above copyright 1267760Smsmith * notice, this list of conditions and the following disclaimer in the 1367760Smsmith * documentation and/or other materials provided with the distribution. 1467760Smsmith * 1567760Smsmith * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1667760Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1767760Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1867760Smsmith * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1967760Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2067760Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2167760Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2267760Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2367760Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2467760Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2567760Smsmith * SUCH DAMAGE. 2667760Smsmith */ 2767760Smsmith 28118030Sobrien#include <sys/cdefs.h> 29118030Sobrien__FBSDID("$FreeBSD: head/sys/amd64/acpica/OsdEnvironment.c 193530 2009-06-05 18:44:36Z jkim $"); 30118030Sobrien 3167760Smsmith/* 3267760Smsmith * 6.1 : Environmental support 3367760Smsmith */ 34108026Smarcel#include <sys/types.h> 35167814Sjkim#include <sys/bus.h> 36108026Smarcel#include <sys/linker_set.h> 37108026Smarcel#include <sys/sysctl.h> 3867760Smsmith 39193530Sjkim#include <contrib/dev/acpica/include/acpi.h> 40193530Sjkim#include <contrib/dev/acpica/include/actables.h> 4167760Smsmith 42128990Snjlstatic u_long amd64_acpi_root; 43108026Smarcel 44115428SpeterSYSCTL_ULONG(_machdep, OID_AUTO, acpi_root, CTLFLAG_RD, &amd64_acpi_root, 0, 45119531Snjl "The physical address of the RSDP"); 46108026Smarcel 4767760SmsmithACPI_STATUS 4867760SmsmithAcpiOsInitialize(void) 4967760Smsmith{ 50108026Smarcel return(0); 5167760Smsmith} 5267760Smsmith 5367760SmsmithACPI_STATUS 5467760SmsmithAcpiOsTerminate(void) 5567760Smsmith{ 56108026Smarcel return(0); 5767760Smsmith} 5880071Smsmith 59167814SjkimACPI_PHYSICAL_ADDRESS 60167814SjkimAcpiOsGetRootPointer(void) 6180071Smsmith{ 62167814Sjkim u_long ptr; 63108026Smarcel 64167814Sjkim if (amd64_acpi_root == 0 && 65167814Sjkim (resource_long_value("acpi", 0, "rsdp", (long *)&ptr) == 0 || 66193530Sjkim AcpiFindRootPointer((ACPI_SIZE *)&ptr) == AE_OK) && 67167814Sjkim ptr != 0) 68167814Sjkim amd64_acpi_root = ptr; 69108026Smarcel 70167814Sjkim return (amd64_acpi_root); 7180071Smsmith} 72