Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6595 serge 1
/*
2
 *  acpi_bus.c - ACPI Bus Driver ($Revision: 80 $)
3
 *
4
 *  Copyright (C) 2001, 2002 Paul Diefenbaugh 
5
 *
6
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7
 *
8
 *  This program is free software; you can redistribute it and/or modify
9
 *  it under the terms of the GNU General Public License as published by
10
 *  the Free Software Foundation; either version 2 of the License, or (at
11
 *  your option) any later version.
12
 *
13
 *  This program is distributed in the hope that it will be useful, but
14
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 *  General Public License for more details.
17
 *
18
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19
 */
20
 
21
#include 
22
#include 
23
#include 
24
#include 
25
#include 
26
#include 
27
#include 
28
#include 
29
 
30
#include "internal.h"
31
struct acpi_device *acpi_root;
32
#ifdef CONFIG_X86
33
#ifdef CONFIG_ACPI_CUSTOM_DSDT
34
static inline int set_copy_dsdt(const struct dmi_system_id *id)
35
{
36
	return 0;
37
}
38
#else
39
static int set_copy_dsdt(const struct dmi_system_id *id)
40
{
41
	printk(KERN_NOTICE "%s detected - "
42
		"force copy of DSDT to local memory\n", id->ident);
43
	acpi_gbl_copy_dsdt_locally = 1;
44
	return 0;
45
}
46
#endif
47
 
48
static struct dmi_system_id dsdt_dmi_table[] __initdata = {
49
	/*
50
	 * Invoke DSDT corruption work-around on all Toshiba Satellite.
51
	 * https://bugzilla.kernel.org/show_bug.cgi?id=14679
52
	 */
53
	{
54
	 .callback = set_copy_dsdt,
55
	 .ident = "TOSHIBA Satellite",
56
	 .matches = {
57
		DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
58
		DMI_MATCH(DMI_PRODUCT_NAME, "Satellite"),
59
		},
60
	},
61
	{}
62
};
63
#else
64
static struct dmi_system_id dsdt_dmi_table[] __initdata = {
65
	{}
66
};
67
#endif
68
/**
69
 * acpi_early_init - Initialize ACPICA and populate the ACPI namespace.
70
 *
71
 * The ACPI tables are accessible after this, but the handling of events has not
72
 * been initialized and the global lock is not available yet, so AML should not
73
 * be executed at this point.
74
 *
75
 * Doing this before switching the EFI runtime services to virtual mode allows
76
 * the EfiBootServices memory to be freed slightly earlier on boot.
77
 */
78
void __init acpi_early_init(void)
79
{
80
	acpi_status status;
81
 
82
	if (acpi_disabled)
83
		return;
84
 
85
	printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION);
86
 
87
	/* It's safe to verify table checksums during late stage */
88
	acpi_gbl_verify_table_checksum = TRUE;
89
 
90
	/* enable workarounds, unless strict ACPI spec. compliance */
91
	if (!acpi_strict)
92
		acpi_gbl_enable_interpreter_slack = TRUE;
93
 
94
	acpi_gbl_permanent_mmap = 1;
95
 
96
	/*
97
	 * If the machine falls into the DMI check table,
98
	 * DSDT will be copied to memory
99
	 */
100
	dmi_check_system(dsdt_dmi_table);
101
 
102
	status = acpi_reallocate_root_table();
103
	if (ACPI_FAILURE(status)) {
104
		printk(KERN_ERR PREFIX
105
		       "Unable to reallocate ACPI tables\n");
106
		goto error0;
107
	}
108
 
109
	status = acpi_initialize_subsystem();
110
	if (ACPI_FAILURE(status)) {
111
		printk(KERN_ERR PREFIX
112
		       "Unable to initialize the ACPI Interpreter\n");
113
		goto error0;
114
	}
115
 
116
	status = acpi_load_tables();
117
	if (ACPI_FAILURE(status)) {
118
		printk(KERN_ERR PREFIX
119
		       "Unable to load the System Description Tables\n");
120
		goto error0;
121
	}
122
 
123
#ifdef CONFIG_X86
124
	if (!acpi_ioapic) {
125
		/* compatible (0) means level (3) */
126
		if (!(acpi_sci_flags & ACPI_MADT_TRIGGER_MASK)) {
127
			acpi_sci_flags &= ~ACPI_MADT_TRIGGER_MASK;
128
			acpi_sci_flags |= ACPI_MADT_TRIGGER_LEVEL;
129
		}
130
		/* Set PIC-mode SCI trigger type */
131
		acpi_pic_sci_set_trigger(acpi_gbl_FADT.sci_interrupt,
132
					 (acpi_sci_flags & ACPI_MADT_TRIGGER_MASK) >> 2);
133
	} else {
134
		/*
135
		 * now that acpi_gbl_FADT is initialized,
136
		 * update it with result from INT_SRC_OVR parsing
137
		 */
138
		acpi_gbl_FADT.sci_interrupt = acpi_sci_override_gsi;
139
	}
140
#endif
141
	return;
142
 
143
 error0:
144
	disable_acpi();
145
}