summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/table.c
blob: de0f99a275a99f0cd08423d070a5bc0b1ee37f3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 *  table.c - ACPI tables, chipset, and errata handling
 *
 *  Copyright (C) 2000 Andrew Henroid
 *
 *  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/kernel.h>
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/pm.h>
#include <linux/acpi.h>
#include "acpi.h"
#include "driver.h"

#define _COMPONENT	OS_DEPENDENT
	MODULE_NAME	("table")

FADT_DESCRIPTOR acpi_fadt;

/*
 * Fetch the fadt information
 */
static int
acpi_fetch_fadt(void)
{
	ACPI_BUFFER buffer;

	memset(&acpi_fadt, 0, sizeof(acpi_fadt));
	buffer.pointer = &acpi_fadt;
	buffer.length = sizeof(acpi_fadt);
	if (!ACPI_SUCCESS(acpi_get_table(ACPI_TABLE_FADT, 1, &buffer))) {
		printk(KERN_ERR "ACPI: missing fadt\n");
		return -ENODEV;
	}

	return 0;
}

/*
 * Find and load ACPI tables
 */
int
acpi_find_and_load_tables(u64 rsdp)
{
	if (!ACPI_SUCCESS(acpi_load_tables(rsdp))) {
		printk(KERN_INFO "ACPI: System description table load failed\n");
		acpi_terminate();
		return -1;
	}

	if (acpi_fetch_fadt()) {
		acpi_terminate();
		return -1;
	}

	return 0;
}