mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-29 21:05:13 +00:00
b229cf92ee
Removed a device initialization optimization introduced in 20051216 where the _STA method was not run unless an _INI was also present for the same device. This optimization could cause problems because it could allow _INI methods to be run within a not-present device subtree (If a not-present device had no _INI, _STA would not be run, the not-present status would not be discovered, and the children of the device would be incorrectly traversed.) Implemented a new _STA optimization where namespace subtrees that do not contain _INI are identified and ignored during device initialization. Selectively running _STA can significantly improve boot time on large machines (with assistance from Len Brown.) Implemented support for the device initialization case where the returned _STA flags indicate a device not-present but functioning. In this case, _INI is not run, but the device children are examined for presence, as per the ACPI specification. Implemented an additional change to the IndexField support in order to conform to MS behavior. The value written to the Index Register is not simply a byte offset, it is a byte offset in units of the access width of the parent Index Field. (Fiodor Suietov) Defined and deployed a new OSL interface, acpi_os_validate_address(). This interface is called during the creation of all AML operation regions, and allows the host OS to exert control over what addresses it will allow the AML code to access. Operation Regions whose addresses are disallowed will cause a runtime exception when they are actually accessed (will not affect or abort table loading.) Defined and deployed a new OSL interface, acpi_os_validate_interface(). This interface allows the host OS to match the various "optional" interface/behavior strings for the _OSI predefined control method as appropriate (with assistance from Bjorn Helgaas.) Restructured and corrected various problems in the exception handling code paths within DsCallControlMethod and DsTerminateControlMethod in dsmethod (with assistance from Takayoshi Kochi.) Modified the Linux source converter to ignore quoted string literals while converting identifiers from mixed to lower case. This will correct problems with the disassembler and other areas where such strings must not be modified. The ACPI_FUNCTION_* macros no longer require quotes around the function name. This allows the Linux source converter to convert the names, now that the converter ignores quoted strings. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
176 lines
4.8 KiB
C
176 lines
4.8 KiB
C
/*
|
|
* acpi_system.c - ACPI System Driver ($Revision: 63 $)
|
|
*
|
|
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
|
|
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
|
|
*
|
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or (at
|
|
* your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
|
*
|
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
*/
|
|
|
|
#include <linux/proc_fs.h>
|
|
#include <linux/seq_file.h>
|
|
#include <linux/init.h>
|
|
#include <asm/uaccess.h>
|
|
|
|
#include <acpi/acpi_drivers.h>
|
|
|
|
#define _COMPONENT ACPI_SYSTEM_COMPONENT
|
|
ACPI_MODULE_NAME("acpi_system")
|
|
#define ACPI_SYSTEM_CLASS "system"
|
|
#define ACPI_SYSTEM_DRIVER_NAME "ACPI System Driver"
|
|
#define ACPI_SYSTEM_DEVICE_NAME "System"
|
|
#define ACPI_SYSTEM_FILE_INFO "info"
|
|
#define ACPI_SYSTEM_FILE_EVENT "event"
|
|
#define ACPI_SYSTEM_FILE_DSDT "dsdt"
|
|
#define ACPI_SYSTEM_FILE_FADT "fadt"
|
|
extern struct fadt_descriptor acpi_fadt;
|
|
|
|
/* --------------------------------------------------------------------------
|
|
FS Interface (/proc)
|
|
-------------------------------------------------------------------------- */
|
|
|
|
static int acpi_system_read_info(struct seq_file *seq, void *offset)
|
|
{
|
|
ACPI_FUNCTION_TRACE("acpi_system_read_info");
|
|
|
|
seq_printf(seq, "version: %x\n", ACPI_CA_VERSION);
|
|
return_VALUE(0);
|
|
}
|
|
|
|
static int acpi_system_info_open_fs(struct inode *inode, struct file *file)
|
|
{
|
|
return single_open(file, acpi_system_read_info, PDE(inode)->data);
|
|
}
|
|
|
|
static struct file_operations acpi_system_info_ops = {
|
|
.open = acpi_system_info_open_fs,
|
|
.read = seq_read,
|
|
.llseek = seq_lseek,
|
|
.release = single_release,
|
|
};
|
|
|
|
static ssize_t acpi_system_read_dsdt(struct file *, char __user *, size_t,
|
|
loff_t *);
|
|
|
|
static struct file_operations acpi_system_dsdt_ops = {
|
|
.read = acpi_system_read_dsdt,
|
|
};
|
|
|
|
static ssize_t
|
|
acpi_system_read_dsdt(struct file *file,
|
|
char __user * buffer, size_t count, loff_t * ppos)
|
|
{
|
|
acpi_status status = AE_OK;
|
|
struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL };
|
|
ssize_t res;
|
|
|
|
ACPI_FUNCTION_TRACE("acpi_system_read_dsdt");
|
|
|
|
status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt);
|
|
if (ACPI_FAILURE(status))
|
|
return_VALUE(-ENODEV);
|
|
|
|
res = simple_read_from_buffer(buffer, count, ppos,
|
|
dsdt.pointer, dsdt.length);
|
|
acpi_os_free(dsdt.pointer);
|
|
|
|
return_VALUE(res);
|
|
}
|
|
|
|
static ssize_t acpi_system_read_fadt(struct file *, char __user *, size_t,
|
|
loff_t *);
|
|
|
|
static struct file_operations acpi_system_fadt_ops = {
|
|
.read = acpi_system_read_fadt,
|
|
};
|
|
|
|
static ssize_t
|
|
acpi_system_read_fadt(struct file *file,
|
|
char __user * buffer, size_t count, loff_t * ppos)
|
|
{
|
|
acpi_status status = AE_OK;
|
|
struct acpi_buffer fadt = { ACPI_ALLOCATE_BUFFER, NULL };
|
|
ssize_t res;
|
|
|
|
ACPI_FUNCTION_TRACE("acpi_system_read_fadt");
|
|
|
|
status = acpi_get_table(ACPI_TABLE_ID_FADT, 1, &fadt);
|
|
if (ACPI_FAILURE(status))
|
|
return_VALUE(-ENODEV);
|
|
|
|
res = simple_read_from_buffer(buffer, count, ppos,
|
|
fadt.pointer, fadt.length);
|
|
acpi_os_free(fadt.pointer);
|
|
|
|
return_VALUE(res);
|
|
}
|
|
|
|
static int __init acpi_system_init(void)
|
|
{
|
|
struct proc_dir_entry *entry;
|
|
int error = 0;
|
|
char *name;
|
|
|
|
ACPI_FUNCTION_TRACE("acpi_system_init");
|
|
|
|
if (acpi_disabled)
|
|
return_VALUE(0);
|
|
|
|
/* 'info' [R] */
|
|
name = ACPI_SYSTEM_FILE_INFO;
|
|
entry = create_proc_entry(name, S_IRUGO, acpi_root_dir);
|
|
if (!entry)
|
|
goto Error;
|
|
else {
|
|
entry->proc_fops = &acpi_system_info_ops;
|
|
}
|
|
|
|
/* 'dsdt' [R] */
|
|
name = ACPI_SYSTEM_FILE_DSDT;
|
|
entry = create_proc_entry(name, S_IRUSR, acpi_root_dir);
|
|
if (entry)
|
|
entry->proc_fops = &acpi_system_dsdt_ops;
|
|
else
|
|
goto Error;
|
|
|
|
/* 'fadt' [R] */
|
|
name = ACPI_SYSTEM_FILE_FADT;
|
|
entry = create_proc_entry(name, S_IRUSR, acpi_root_dir);
|
|
if (entry)
|
|
entry->proc_fops = &acpi_system_fadt_ops;
|
|
else
|
|
goto Error;
|
|
|
|
Done:
|
|
return_VALUE(error);
|
|
|
|
Error:
|
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
|
"Unable to create '%s' proc fs entry\n", name));
|
|
|
|
remove_proc_entry(ACPI_SYSTEM_FILE_FADT, acpi_root_dir);
|
|
remove_proc_entry(ACPI_SYSTEM_FILE_DSDT, acpi_root_dir);
|
|
remove_proc_entry(ACPI_SYSTEM_FILE_INFO, acpi_root_dir);
|
|
|
|
error = -EFAULT;
|
|
goto Done;
|
|
}
|
|
|
|
subsys_initcall(acpi_system_init);
|