diff options
author | Thomas Gleixner <tglx@tglx.tec.linutronix.de> | 2005-07-13 04:45:00 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@mtd.linutronix.de> | 2005-07-13 04:45:00 -0400 |
commit | 1b3035b7fcc72b6b36f2a3634dad832eb2453ce8 (patch) | |
tree | 728174d72943cc9b981a5843553551df62eddc41 /drivers | |
parent | a98a5d04f400ad112e59cadd739dbabf89417e60 (diff) | |
parent | c32511e2718618f0b53479eb36e07439aa363a74 (diff) |
Merge with rsync://fileserver/linux
Diffstat (limited to 'drivers')
298 files changed, 12458 insertions, 8316 deletions
diff --git a/drivers/Kconfig b/drivers/Kconfig index aed4a9b97c14..cecab0acc3fe 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig | |||
@@ -28,7 +28,7 @@ source "drivers/message/i2o/Kconfig" | |||
28 | 28 | ||
29 | source "drivers/macintosh/Kconfig" | 29 | source "drivers/macintosh/Kconfig" |
30 | 30 | ||
31 | source "net/Kconfig" | 31 | source "drivers/net/Kconfig" |
32 | 32 | ||
33 | source "drivers/isdn/Kconfig" | 33 | source "drivers/isdn/Kconfig" |
34 | 34 | ||
@@ -44,6 +44,8 @@ source "drivers/i2c/Kconfig" | |||
44 | 44 | ||
45 | source "drivers/w1/Kconfig" | 45 | source "drivers/w1/Kconfig" |
46 | 46 | ||
47 | source "drivers/hwmon/Kconfig" | ||
48 | |||
47 | source "drivers/misc/Kconfig" | 49 | source "drivers/misc/Kconfig" |
48 | 50 | ||
49 | source "drivers/media/Kconfig" | 51 | source "drivers/media/Kconfig" |
diff --git a/drivers/Makefile b/drivers/Makefile index 3167be54fedd..126a851d5653 100644 --- a/drivers/Makefile +++ b/drivers/Makefile | |||
@@ -52,6 +52,7 @@ obj-$(CONFIG_INPUT) += input/ | |||
52 | obj-$(CONFIG_I2O) += message/ | 52 | obj-$(CONFIG_I2O) += message/ |
53 | obj-$(CONFIG_I2C) += i2c/ | 53 | obj-$(CONFIG_I2C) += i2c/ |
54 | obj-$(CONFIG_W1) += w1/ | 54 | obj-$(CONFIG_W1) += w1/ |
55 | obj-$(CONFIG_HWMON) += hwmon/ | ||
55 | obj-$(CONFIG_PHONE) += telephony/ | 56 | obj-$(CONFIG_PHONE) += telephony/ |
56 | obj-$(CONFIG_MD) += md/ | 57 | obj-$(CONFIG_MD) += md/ |
57 | obj-$(CONFIG_BT) += bluetooth/ | 58 | obj-$(CONFIG_BT) += bluetooth/ |
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 86c52520ed34..986410e7b483 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -3,6 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | menu "ACPI (Advanced Configuration and Power Interface) Support" | 5 | menu "ACPI (Advanced Configuration and Power Interface) Support" |
6 | depends on PM | ||
6 | depends on !X86_VISWS | 7 | depends on !X86_VISWS |
7 | depends on !IA64_HP_SIM | 8 | depends on !IA64_HP_SIM |
8 | depends on IA64 || X86 | 9 | depends on IA64 || X86 |
@@ -48,7 +49,6 @@ config ACPI_BOOT | |||
48 | 49 | ||
49 | config ACPI_INTERPRETER | 50 | config ACPI_INTERPRETER |
50 | bool | 51 | bool |
51 | depends on !IA64_SGI_SN | ||
52 | default y | 52 | default y |
53 | 53 | ||
54 | if ACPI_INTERPRETER | 54 | if ACPI_INTERPRETER |
@@ -79,6 +79,14 @@ config ACPI_SLEEP_PROC_FS | |||
79 | depends on ACPI_SLEEP && PROC_FS | 79 | depends on ACPI_SLEEP && PROC_FS |
80 | default y | 80 | default y |
81 | 81 | ||
82 | config ACPI_SLEEP_PROC_SLEEP | ||
83 | bool "/proc/acpi/sleep (deprecated)" | ||
84 | depends on ACPI_SLEEP_PROC_FS | ||
85 | default n | ||
86 | ---help--- | ||
87 | Create /proc/acpi/sleep | ||
88 | Deprecated by /sys/power/state | ||
89 | |||
82 | config ACPI_AC | 90 | config ACPI_AC |
83 | tristate "AC Adapter" | 91 | tristate "AC Adapter" |
84 | depends on X86 | 92 | depends on X86 |
@@ -99,7 +107,6 @@ config ACPI_BATTERY | |||
99 | 107 | ||
100 | config ACPI_BUTTON | 108 | config ACPI_BUTTON |
101 | tristate "Button" | 109 | tristate "Button" |
102 | depends on !IA64_SGI_SN | ||
103 | default m | 110 | default m |
104 | help | 111 | help |
105 | This driver registers for events based on buttons, such as the | 112 | This driver registers for events based on buttons, such as the |
@@ -111,7 +118,6 @@ config ACPI_BUTTON | |||
111 | config ACPI_VIDEO | 118 | config ACPI_VIDEO |
112 | tristate "Video" | 119 | tristate "Video" |
113 | depends on EXPERIMENTAL | 120 | depends on EXPERIMENTAL |
114 | depends on !IA64_SGI_SN | ||
115 | default m | 121 | default m |
116 | help | 122 | help |
117 | This driver implement the ACPI Extensions For Display Adapters | 123 | This driver implement the ACPI Extensions For Display Adapters |
@@ -122,9 +128,17 @@ config ACPI_VIDEO | |||
122 | Note that this is an ref. implementation only. It may or may not work | 128 | Note that this is an ref. implementation only. It may or may not work |
123 | for your integrated video device. | 129 | for your integrated video device. |
124 | 130 | ||
131 | config ACPI_HOTKEY | ||
132 | tristate "Generic Hotkey" | ||
133 | depends on ACPI_INTERPRETER | ||
134 | depends on EXPERIMENTAL | ||
135 | depends on !IA64_SGI_SN | ||
136 | default m | ||
137 | help | ||
138 | ACPI generic hotkey | ||
139 | |||
125 | config ACPI_FAN | 140 | config ACPI_FAN |
126 | tristate "Fan" | 141 | tristate "Fan" |
127 | depends on !IA64_SGI_SN | ||
128 | default m | 142 | default m |
129 | help | 143 | help |
130 | This driver adds support for ACPI fan devices, allowing user-mode | 144 | This driver adds support for ACPI fan devices, allowing user-mode |
@@ -132,7 +146,6 @@ config ACPI_FAN | |||
132 | 146 | ||
133 | config ACPI_PROCESSOR | 147 | config ACPI_PROCESSOR |
134 | tristate "Processor" | 148 | tristate "Processor" |
135 | depends on !IA64_SGI_SN | ||
136 | default m | 149 | default m |
137 | help | 150 | help |
138 | This driver installs ACPI as the idle handler for Linux, and uses | 151 | This driver installs ACPI as the idle handler for Linux, and uses |
@@ -142,7 +155,6 @@ config ACPI_PROCESSOR | |||
142 | config ACPI_HOTPLUG_CPU | 155 | config ACPI_HOTPLUG_CPU |
143 | bool "Processor Hotplug (EXPERIMENTAL)" | 156 | bool "Processor Hotplug (EXPERIMENTAL)" |
144 | depends on ACPI_PROCESSOR && HOTPLUG_CPU && EXPERIMENTAL | 157 | depends on ACPI_PROCESSOR && HOTPLUG_CPU && EXPERIMENTAL |
145 | depends on !IA64_SGI_SN | ||
146 | select ACPI_CONTAINER | 158 | select ACPI_CONTAINER |
147 | default n | 159 | default n |
148 | ---help--- | 160 | ---help--- |
@@ -262,7 +274,6 @@ config ACPI_BLACKLIST_YEAR | |||
262 | 274 | ||
263 | config ACPI_DEBUG | 275 | config ACPI_DEBUG |
264 | bool "Debug Statements" | 276 | bool "Debug Statements" |
265 | depends on !IA64_SGI_SN | ||
266 | default n | 277 | default n |
267 | help | 278 | help |
268 | The ACPI driver can optionally report errors with a great deal | 279 | The ACPI driver can optionally report errors with a great deal |
@@ -271,7 +282,6 @@ config ACPI_DEBUG | |||
271 | 282 | ||
272 | config ACPI_BUS | 283 | config ACPI_BUS |
273 | bool | 284 | bool |
274 | depends on !IA64_SGI_SN | ||
275 | default y | 285 | default y |
276 | 286 | ||
277 | config ACPI_EC | 287 | config ACPI_EC |
@@ -285,17 +295,14 @@ config ACPI_EC | |||
285 | 295 | ||
286 | config ACPI_POWER | 296 | config ACPI_POWER |
287 | bool | 297 | bool |
288 | depends on !IA64_SGI_SN | ||
289 | default y | 298 | default y |
290 | 299 | ||
291 | config ACPI_PCI | 300 | config ACPI_PCI |
292 | bool | 301 | bool |
293 | depends on !IA64_SGI_SN | ||
294 | default PCI | 302 | default PCI |
295 | 303 | ||
296 | config ACPI_SYSTEM | 304 | config ACPI_SYSTEM |
297 | bool | 305 | bool |
298 | depends on !IA64_SGI_SN | ||
299 | default y | 306 | default y |
300 | help | 307 | help |
301 | This driver will enable your system to shut down using ACPI, and | 308 | This driver will enable your system to shut down using ACPI, and |
@@ -327,8 +334,13 @@ config ACPI_CONTAINER | |||
327 | depends on EXPERIMENTAL | 334 | depends on EXPERIMENTAL |
328 | default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU || ACPI_HOTPLUG_IO) | 335 | default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU || ACPI_HOTPLUG_IO) |
329 | ---help--- | 336 | ---help--- |
330 | This is the ACPI generic container driver which supports | 337 | This allows _physical_ insertion and removal of CPUs and memory. |
331 | ACPI0004, PNP0A05 and PNP0A06 devices | 338 | This can be useful, for example, on NUMA machines that support |
339 | ACPI based physical hotplug of nodes, or non-NUMA machines that | ||
340 | support physical cpu/memory hot-plug. | ||
341 | |||
342 | If one selects "m", this driver can be loaded with | ||
343 | "modprobe acpi_container". | ||
332 | 344 | ||
333 | config ACPI_HOTPLUG_MEMORY | 345 | config ACPI_HOTPLUG_MEMORY |
334 | tristate "Memory Hotplug" | 346 | tristate "Memory Hotplug" |
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 65c92e20566d..ad67e8f61e6c 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
@@ -36,13 +36,14 @@ processor-objs += processor_perflib.o | |||
36 | endif | 36 | endif |
37 | 37 | ||
38 | obj-$(CONFIG_ACPI_BUS) += sleep/ | 38 | obj-$(CONFIG_ACPI_BUS) += sleep/ |
39 | obj-$(CONFIG_ACPI_BUS) += bus.o | 39 | obj-$(CONFIG_ACPI_BUS) += bus.o glue.o |
40 | obj-$(CONFIG_ACPI_AC) += ac.o | 40 | obj-$(CONFIG_ACPI_AC) += ac.o |
41 | obj-$(CONFIG_ACPI_BATTERY) += battery.o | 41 | obj-$(CONFIG_ACPI_BATTERY) += battery.o |
42 | obj-$(CONFIG_ACPI_BUTTON) += button.o | 42 | obj-$(CONFIG_ACPI_BUTTON) += button.o |
43 | obj-$(CONFIG_ACPI_EC) += ec.o | 43 | obj-$(CONFIG_ACPI_EC) += ec.o |
44 | obj-$(CONFIG_ACPI_FAN) += fan.o | 44 | obj-$(CONFIG_ACPI_FAN) += fan.o |
45 | obj-$(CONFIG_ACPI_VIDEO) += video.o | 45 | obj-$(CONFIG_ACPI_VIDEO) += video.o |
46 | obj-$(CONFIG_ACPI_HOTKEY) += hotkey.o | ||
46 | obj-$(CONFIG_ACPI_PCI) += pci_root.o pci_link.o pci_irq.o pci_bind.o | 47 | obj-$(CONFIG_ACPI_PCI) += pci_root.o pci_link.o pci_irq.o pci_bind.o |
47 | obj-$(CONFIG_ACPI_POWER) += power.o | 48 | obj-$(CONFIG_ACPI_POWER) += power.o |
48 | obj-$(CONFIG_ACPI_PROCESSOR) += processor.o | 49 | obj-$(CONFIG_ACPI_PROCESSOR) += processor.o |
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index a75cb565caeb..a560b1e2da77 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c | |||
@@ -1204,6 +1204,10 @@ static int __init asus_acpi_init(void) | |||
1204 | if (acpi_disabled) | 1204 | if (acpi_disabled) |
1205 | return -ENODEV; | 1205 | return -ENODEV; |
1206 | 1206 | ||
1207 | if (!acpi_specific_hotkey_enabled){ | ||
1208 | printk(KERN_ERR "Using generic hotkey driver\n"); | ||
1209 | return -ENODEV; | ||
1210 | } | ||
1207 | asus_proc_dir = proc_mkdir(PROC_ASUS, acpi_root_dir); | 1211 | asus_proc_dir = proc_mkdir(PROC_ASUS, acpi_root_dir); |
1208 | if (!asus_proc_dir) { | 1212 | if (!asus_proc_dir) { |
1209 | printk(KERN_ERR "Asus ACPI: Unable to create /proc entry\n"); | 1213 | printk(KERN_ERR "Asus ACPI: Unable to create /proc entry\n"); |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 4edff1738579..d77c2307883c 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -212,6 +212,12 @@ acpi_bus_set_power ( | |||
212 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device is not power manageable\n")); | 212 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device is not power manageable\n")); |
213 | return_VALUE(-ENODEV); | 213 | return_VALUE(-ENODEV); |
214 | } | 214 | } |
215 | /* | ||
216 | * Get device's current power state if it's unknown | ||
217 | * This means device power state isn't initialized or previous setting failed | ||
218 | */ | ||
219 | if (device->power.state == ACPI_STATE_UNKNOWN) | ||
220 | acpi_bus_get_power(device->handle, &device->power.state); | ||
215 | if (state == device->power.state) { | 221 | if (state == device->power.state) { |
216 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", state)); | 222 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", state)); |
217 | return_VALUE(0); | 223 | return_VALUE(0); |
@@ -231,7 +237,7 @@ acpi_bus_set_power ( | |||
231 | * On transitions to a high-powered state we first apply power (via | 237 | * On transitions to a high-powered state we first apply power (via |
232 | * power resources) then evalute _PSx. Conversly for transitions to | 238 | * power resources) then evalute _PSx. Conversly for transitions to |
233 | * a lower-powered state. | 239 | * a lower-powered state. |
234 | */ | 240 | */ |
235 | if (state < device->power.state) { | 241 | if (state < device->power.state) { |
236 | if (device->power.flags.power_resources) { | 242 | if (device->power.flags.power_resources) { |
237 | result = acpi_power_transition(device, state); | 243 | result = acpi_power_transition(device, state); |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index ec4430e3053f..0f45d45f05a0 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -26,9 +26,6 @@ | |||
26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/types.h> | ||
30 | #include <linux/proc_fs.h> | ||
31 | #include <linux/seq_file.h> | ||
32 | #include <acpi/acpi_bus.h> | 29 | #include <acpi/acpi_bus.h> |
33 | #include <acpi/acpi_drivers.h> | 30 | #include <acpi/acpi_drivers.h> |
34 | 31 | ||
@@ -36,9 +33,6 @@ | |||
36 | #define ACPI_BUTTON_COMPONENT 0x00080000 | 33 | #define ACPI_BUTTON_COMPONENT 0x00080000 |
37 | #define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver" | 34 | #define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver" |
38 | #define ACPI_BUTTON_CLASS "button" | 35 | #define ACPI_BUTTON_CLASS "button" |
39 | #define ACPI_BUTTON_FILE_INFO "info" | ||
40 | #define ACPI_BUTTON_FILE_STATE "state" | ||
41 | #define ACPI_BUTTON_TYPE_UNKNOWN 0x00 | ||
42 | #define ACPI_BUTTON_NOTIFY_STATUS 0x80 | 36 | #define ACPI_BUTTON_NOTIFY_STATUS 0x80 |
43 | 37 | ||
44 | #define ACPI_BUTTON_SUBCLASS_POWER "power" | 38 | #define ACPI_BUTTON_SUBCLASS_POWER "power" |
@@ -70,8 +64,6 @@ MODULE_LICENSE("GPL"); | |||
70 | 64 | ||
71 | static int acpi_button_add (struct acpi_device *device); | 65 | static int acpi_button_add (struct acpi_device *device); |
72 | static int acpi_button_remove (struct acpi_device *device, int type); | 66 | static int acpi_button_remove (struct acpi_device *device, int type); |
73 | static int acpi_button_info_open_fs(struct inode *inode, struct file *file); | ||
74 | static int acpi_button_state_open_fs(struct inode *inode, struct file *file); | ||
75 | 67 | ||
76 | static struct acpi_driver acpi_button_driver = { | 68 | static struct acpi_driver acpi_button_driver = { |
77 | .name = ACPI_BUTTON_DRIVER_NAME, | 69 | .name = ACPI_BUTTON_DRIVER_NAME, |
@@ -90,187 +82,6 @@ struct acpi_button { | |||
90 | unsigned long pushed; | 82 | unsigned long pushed; |
91 | }; | 83 | }; |
92 | 84 | ||
93 | static struct file_operations acpi_button_info_fops = { | ||
94 | .open = acpi_button_info_open_fs, | ||
95 | .read = seq_read, | ||
96 | .llseek = seq_lseek, | ||
97 | .release = single_release, | ||
98 | }; | ||
99 | |||
100 | static struct file_operations acpi_button_state_fops = { | ||
101 | .open = acpi_button_state_open_fs, | ||
102 | .read = seq_read, | ||
103 | .llseek = seq_lseek, | ||
104 | .release = single_release, | ||
105 | }; | ||
106 | /* -------------------------------------------------------------------------- | ||
107 | FS Interface (/proc) | ||
108 | -------------------------------------------------------------------------- */ | ||
109 | |||
110 | static struct proc_dir_entry *acpi_button_dir; | ||
111 | |||
112 | static int acpi_button_info_seq_show(struct seq_file *seq, void *offset) | ||
113 | { | ||
114 | struct acpi_button *button = (struct acpi_button *) seq->private; | ||
115 | |||
116 | ACPI_FUNCTION_TRACE("acpi_button_info_seq_show"); | ||
117 | |||
118 | if (!button || !button->device) | ||
119 | return_VALUE(0); | ||
120 | |||
121 | seq_printf(seq, "type: %s\n", | ||
122 | acpi_device_name(button->device)); | ||
123 | |||
124 | return_VALUE(0); | ||
125 | } | ||
126 | |||
127 | static int acpi_button_info_open_fs(struct inode *inode, struct file *file) | ||
128 | { | ||
129 | return single_open(file, acpi_button_info_seq_show, PDE(inode)->data); | ||
130 | } | ||
131 | |||
132 | static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) | ||
133 | { | ||
134 | struct acpi_button *button = (struct acpi_button *) seq->private; | ||
135 | acpi_status status; | ||
136 | unsigned long state; | ||
137 | |||
138 | ACPI_FUNCTION_TRACE("acpi_button_state_seq_show"); | ||
139 | |||
140 | if (!button || !button->device) | ||
141 | return_VALUE(0); | ||
142 | |||
143 | status = acpi_evaluate_integer(button->handle,"_LID",NULL,&state); | ||
144 | if (ACPI_FAILURE(status)) { | ||
145 | seq_printf(seq, "state: unsupported\n"); | ||
146 | } | ||
147 | else{ | ||
148 | seq_printf(seq, "state: %s\n", (state ? "open" : "closed")); | ||
149 | } | ||
150 | |||
151 | return_VALUE(0); | ||
152 | } | ||
153 | |||
154 | static int acpi_button_state_open_fs(struct inode *inode, struct file *file) | ||
155 | { | ||
156 | return single_open(file, acpi_button_state_seq_show, PDE(inode)->data); | ||
157 | } | ||
158 | |||
159 | static int | ||
160 | acpi_button_add_fs ( | ||
161 | struct acpi_device *device) | ||
162 | { | ||
163 | struct proc_dir_entry *entry = NULL; | ||
164 | struct acpi_button *button = NULL; | ||
165 | |||
166 | ACPI_FUNCTION_TRACE("acpi_button_add_fs"); | ||
167 | |||
168 | if (!device || !acpi_driver_data(device)) | ||
169 | return_VALUE(-EINVAL); | ||
170 | |||
171 | button = acpi_driver_data(device); | ||
172 | |||
173 | switch (button->type) { | ||
174 | case ACPI_BUTTON_TYPE_POWER: | ||
175 | case ACPI_BUTTON_TYPE_POWERF: | ||
176 | entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER, | ||
177 | acpi_button_dir); | ||
178 | break; | ||
179 | case ACPI_BUTTON_TYPE_SLEEP: | ||
180 | case ACPI_BUTTON_TYPE_SLEEPF: | ||
181 | entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP, | ||
182 | acpi_button_dir); | ||
183 | break; | ||
184 | case ACPI_BUTTON_TYPE_LID: | ||
185 | entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID, | ||
186 | acpi_button_dir); | ||
187 | break; | ||
188 | } | ||
189 | |||
190 | if (!entry) | ||
191 | return_VALUE(-ENODEV); | ||
192 | entry->owner = THIS_MODULE; | ||
193 | |||
194 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry); | ||
195 | if (!acpi_device_dir(device)) | ||
196 | return_VALUE(-ENODEV); | ||
197 | acpi_device_dir(device)->owner = THIS_MODULE; | ||
198 | |||
199 | /* 'info' [R] */ | ||
200 | entry = create_proc_entry(ACPI_BUTTON_FILE_INFO, | ||
201 | S_IRUGO, acpi_device_dir(device)); | ||
202 | if (!entry) | ||
203 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
204 | "Unable to create '%s' fs entry\n", | ||
205 | ACPI_BUTTON_FILE_INFO)); | ||
206 | else { | ||
207 | entry->proc_fops = &acpi_button_info_fops; | ||
208 | entry->data = acpi_driver_data(device); | ||
209 | entry->owner = THIS_MODULE; | ||
210 | } | ||
211 | |||
212 | /* show lid state [R] */ | ||
213 | if (button->type == ACPI_BUTTON_TYPE_LID) { | ||
214 | entry = create_proc_entry(ACPI_BUTTON_FILE_STATE, | ||
215 | S_IRUGO, acpi_device_dir(device)); | ||
216 | if (!entry) | ||
217 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
218 | "Unable to create '%s' fs entry\n", | ||
219 | ACPI_BUTTON_FILE_INFO)); | ||
220 | else { | ||
221 | entry->proc_fops = &acpi_button_state_fops; | ||
222 | entry->data = acpi_driver_data(device); | ||
223 | entry->owner = THIS_MODULE; | ||
224 | } | ||
225 | } | ||
226 | |||
227 | return_VALUE(0); | ||
228 | } | ||
229 | |||
230 | |||
231 | static int | ||
232 | acpi_button_remove_fs ( | ||
233 | struct acpi_device *device) | ||
234 | { | ||
235 | struct acpi_button *button = NULL; | ||
236 | |||
237 | ACPI_FUNCTION_TRACE("acpi_button_remove_fs"); | ||
238 | |||
239 | button = acpi_driver_data(device); | ||
240 | if (acpi_device_dir(device)) { | ||
241 | if (button->type == ACPI_BUTTON_TYPE_LID) | ||
242 | remove_proc_entry(ACPI_BUTTON_FILE_STATE, | ||
243 | acpi_device_dir(device)); | ||
244 | remove_proc_entry(ACPI_BUTTON_FILE_INFO, | ||
245 | acpi_device_dir(device)); | ||
246 | |||
247 | remove_proc_entry(acpi_device_bid(device), | ||
248 | acpi_device_dir(device)->parent); | ||
249 | |||
250 | |||
251 | switch (button->type) { | ||
252 | case ACPI_BUTTON_TYPE_POWER: | ||
253 | case ACPI_BUTTON_TYPE_POWERF: | ||
254 | remove_proc_entry(ACPI_BUTTON_SUBCLASS_POWER, | ||
255 | acpi_button_dir); | ||
256 | break; | ||
257 | case ACPI_BUTTON_TYPE_SLEEP: | ||
258 | case ACPI_BUTTON_TYPE_SLEEPF: | ||
259 | remove_proc_entry(ACPI_BUTTON_SUBCLASS_SLEEP, | ||
260 | acpi_button_dir); | ||
261 | break; | ||
262 | case ACPI_BUTTON_TYPE_LID: | ||
263 | remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, | ||
264 | acpi_button_dir); | ||
265 | break; | ||
266 | } | ||
267 | acpi_device_dir(device) = NULL; | ||
268 | } | ||
269 | |||
270 | return_VALUE(0); | ||
271 | } | ||
272 | |||
273 | |||
274 | /* -------------------------------------------------------------------------- | 85 | /* -------------------------------------------------------------------------- |
275 | Driver Interface | 86 | Driver Interface |
276 | -------------------------------------------------------------------------- */ | 87 | -------------------------------------------------------------------------- */ |
@@ -310,8 +121,7 @@ acpi_button_notify_fixed ( | |||
310 | 121 | ||
311 | ACPI_FUNCTION_TRACE("acpi_button_notify_fixed"); | 122 | ACPI_FUNCTION_TRACE("acpi_button_notify_fixed"); |
312 | 123 | ||
313 | if (!button) | 124 | BUG_ON(!button); |
314 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
315 | 125 | ||
316 | acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button); | 126 | acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button); |
317 | 127 | ||
@@ -327,10 +137,6 @@ acpi_button_add ( | |||
327 | acpi_status status = AE_OK; | 137 | acpi_status status = AE_OK; |
328 | struct acpi_button *button = NULL; | 138 | struct acpi_button *button = NULL; |
329 | 139 | ||
330 | static struct acpi_device *power_button; | ||
331 | static struct acpi_device *sleep_button; | ||
332 | static struct acpi_device *lid_button; | ||
333 | |||
334 | ACPI_FUNCTION_TRACE("acpi_button_add"); | 140 | ACPI_FUNCTION_TRACE("acpi_button_add"); |
335 | 141 | ||
336 | if (!device) | 142 | if (!device) |
@@ -391,42 +197,6 @@ acpi_button_add ( | |||
391 | goto end; | 197 | goto end; |
392 | } | 198 | } |
393 | 199 | ||
394 | /* | ||
395 | * Ensure only one button of each type is used. | ||
396 | */ | ||
397 | switch (button->type) { | ||
398 | case ACPI_BUTTON_TYPE_POWER: | ||
399 | case ACPI_BUTTON_TYPE_POWERF: | ||
400 | if (!power_button) | ||
401 | power_button = device; | ||
402 | else { | ||
403 | kfree(button); | ||
404 | return_VALUE(-ENODEV); | ||
405 | } | ||
406 | break; | ||
407 | case ACPI_BUTTON_TYPE_SLEEP: | ||
408 | case ACPI_BUTTON_TYPE_SLEEPF: | ||
409 | if (!sleep_button) | ||
410 | sleep_button = device; | ||
411 | else { | ||
412 | kfree(button); | ||
413 | return_VALUE(-ENODEV); | ||
414 | } | ||
415 | break; | ||
416 | case ACPI_BUTTON_TYPE_LID: | ||
417 | if (!lid_button) | ||
418 | lid_button = device; | ||
419 | else { | ||
420 | kfree(button); | ||
421 | return_VALUE(-ENODEV); | ||
422 | } | ||
423 | break; | ||
424 | } | ||
425 | |||
426 | result = acpi_button_add_fs(device); | ||
427 | if (result) | ||
428 | goto end; | ||
429 | |||
430 | switch (button->type) { | 200 | switch (button->type) { |
431 | case ACPI_BUTTON_TYPE_POWERF: | 201 | case ACPI_BUTTON_TYPE_POWERF: |
432 | status = acpi_install_fixed_event_handler ( | 202 | status = acpi_install_fixed_event_handler ( |
@@ -470,7 +240,6 @@ acpi_button_add ( | |||
470 | 240 | ||
471 | end: | 241 | end: |
472 | if (result) { | 242 | if (result) { |
473 | acpi_button_remove_fs(device); | ||
474 | kfree(button); | 243 | kfree(button); |
475 | } | 244 | } |
476 | 245 | ||
@@ -511,8 +280,6 @@ acpi_button_remove (struct acpi_device *device, int type) | |||
511 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 280 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
512 | "Error removing notify handler\n")); | 281 | "Error removing notify handler\n")); |
513 | 282 | ||
514 | acpi_button_remove_fs(device); | ||
515 | |||
516 | kfree(button); | 283 | kfree(button); |
517 | 284 | ||
518 | return_VALUE(0); | 285 | return_VALUE(0); |
@@ -526,21 +293,14 @@ acpi_button_init (void) | |||
526 | 293 | ||
527 | ACPI_FUNCTION_TRACE("acpi_button_init"); | 294 | ACPI_FUNCTION_TRACE("acpi_button_init"); |
528 | 295 | ||
529 | acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); | ||
530 | if (!acpi_button_dir) | ||
531 | return_VALUE(-ENODEV); | ||
532 | acpi_button_dir->owner = THIS_MODULE; | ||
533 | |||
534 | result = acpi_bus_register_driver(&acpi_button_driver); | 296 | result = acpi_bus_register_driver(&acpi_button_driver); |
535 | if (result < 0) { | 297 | if (result < 0) { |
536 | remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); | ||
537 | return_VALUE(-ENODEV); | 298 | return_VALUE(-ENODEV); |
538 | } | 299 | } |
539 | 300 | ||
540 | return_VALUE(0); | 301 | return_VALUE(0); |
541 | } | 302 | } |
542 | 303 | ||
543 | |||
544 | static void __exit | 304 | static void __exit |
545 | acpi_button_exit (void) | 305 | acpi_button_exit (void) |
546 | { | 306 | { |
@@ -548,11 +308,8 @@ acpi_button_exit (void) | |||
548 | 308 | ||
549 | acpi_bus_unregister_driver(&acpi_button_driver); | 309 | acpi_bus_unregister_driver(&acpi_button_driver); |
550 | 310 | ||
551 | remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); | ||
552 | |||
553 | return_VOID; | 311 | return_VOID; |
554 | } | 312 | } |
555 | 313 | ||
556 | |||
557 | module_init(acpi_button_init); | 314 | module_init(acpi_button_init); |
558 | module_exit(acpi_button_exit); | 315 | module_exit(acpi_button_exit); |
diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c index 2779211be756..84193983d6ba 100644 --- a/drivers/acpi/dispatcher/dsfield.c +++ b/drivers/acpi/dispatcher/dsfield.c | |||
@@ -53,13 +53,20 @@ | |||
53 | #define _COMPONENT ACPI_DISPATCHER | 53 | #define _COMPONENT ACPI_DISPATCHER |
54 | ACPI_MODULE_NAME ("dsfield") | 54 | ACPI_MODULE_NAME ("dsfield") |
55 | 55 | ||
56 | /* Local prototypes */ | ||
57 | |||
58 | static acpi_status | ||
59 | acpi_ds_get_field_names ( | ||
60 | struct acpi_create_field_info *info, | ||
61 | struct acpi_walk_state *walk_state, | ||
62 | union acpi_parse_object *arg); | ||
63 | |||
56 | 64 | ||
57 | /******************************************************************************* | 65 | /******************************************************************************* |
58 | * | 66 | * |
59 | * FUNCTION: acpi_ds_create_buffer_field | 67 | * FUNCTION: acpi_ds_create_buffer_field |
60 | * | 68 | * |
61 | * PARAMETERS: Opcode - The opcode to be executed | 69 | * PARAMETERS: Op - Current parse op (create_xXField) |
62 | * Operands - List of operands for the opcode | ||
63 | * walk_state - Current state | 70 | * walk_state - Current state |
64 | * | 71 | * |
65 | * RETURN: Status | 72 | * RETURN: Status |
@@ -70,7 +77,7 @@ | |||
70 | * create_word_field_op, | 77 | * create_word_field_op, |
71 | * create_dword_field_op, | 78 | * create_dword_field_op, |
72 | * create_qword_field_op, | 79 | * create_qword_field_op, |
73 | * create_field_op (all of which define fields in buffers) | 80 | * create_field_op (all of which define a field in a buffer) |
74 | * | 81 | * |
75 | ******************************************************************************/ | 82 | ******************************************************************************/ |
76 | 83 | ||
@@ -119,7 +126,8 @@ acpi_ds_create_buffer_field ( | |||
119 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE; | 126 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE; |
120 | } | 127 | } |
121 | else { | 128 | else { |
122 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND; | 129 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | |
130 | ACPI_NS_ERROR_IF_FOUND; | ||
123 | } | 131 | } |
124 | 132 | ||
125 | /* | 133 | /* |
@@ -134,16 +142,16 @@ acpi_ds_create_buffer_field ( | |||
134 | } | 142 | } |
135 | } | 143 | } |
136 | 144 | ||
137 | /* We could put the returned object (Node) on the object stack for later, but | 145 | /* We could put the returned object (Node) on the object stack for later, |
138 | * for now, we will put it in the "op" object that the parser uses, so we | 146 | * but for now, we will put it in the "op" object that the parser uses, |
139 | * can get it again at the end of this scope | 147 | * so we can get it again at the end of this scope |
140 | */ | 148 | */ |
141 | op->common.node = node; | 149 | op->common.node = node; |
142 | 150 | ||
143 | /* | 151 | /* |
144 | * If there is no object attached to the node, this node was just created and | 152 | * If there is no object attached to the node, this node was just created |
145 | * we need to create the field object. Otherwise, this was a lookup of an | 153 | * and we need to create the field object. Otherwise, this was a lookup |
146 | * existing node and we don't want to create the field object again. | 154 | * of an existing node and we don't want to create the field object again. |
147 | */ | 155 | */ |
148 | obj_desc = acpi_ns_get_attached_object (node); | 156 | obj_desc = acpi_ns_get_attached_object (node); |
149 | if (obj_desc) { | 157 | if (obj_desc) { |
@@ -205,7 +213,7 @@ cleanup: | |||
205 | * | 213 | * |
206 | ******************************************************************************/ | 214 | ******************************************************************************/ |
207 | 215 | ||
208 | acpi_status | 216 | static acpi_status |
209 | acpi_ds_get_field_names ( | 217 | acpi_ds_get_field_names ( |
210 | struct acpi_create_field_info *info, | 218 | struct acpi_create_field_info *info, |
211 | struct acpi_walk_state *walk_state, | 219 | struct acpi_walk_state *walk_state, |
@@ -238,7 +246,8 @@ acpi_ds_get_field_names ( | |||
238 | + (acpi_integer) arg->common.value.size; | 246 | + (acpi_integer) arg->common.value.size; |
239 | 247 | ||
240 | if (position > ACPI_UINT32_MAX) { | 248 | if (position > ACPI_UINT32_MAX) { |
241 | ACPI_REPORT_ERROR (("Bit offset within field too large (> 0xFFFFFFFF)\n")); | 249 | ACPI_REPORT_ERROR (( |
250 | "Bit offset within field too large (> 0xFFFFFFFF)\n")); | ||
242 | return_ACPI_STATUS (AE_SUPPORT); | 251 | return_ACPI_STATUS (AE_SUPPORT); |
243 | } | 252 | } |
244 | 253 | ||
@@ -250,12 +259,15 @@ acpi_ds_get_field_names ( | |||
250 | 259 | ||
251 | /* | 260 | /* |
252 | * Get a new access_type and access_attribute -- to be used for all | 261 | * Get a new access_type and access_attribute -- to be used for all |
253 | * field units that follow, until field end or another access_as keyword. | 262 | * field units that follow, until field end or another access_as |
263 | * keyword. | ||
254 | * | 264 | * |
255 | * In field_flags, preserve the flag bits other than the ACCESS_TYPE bits | 265 | * In field_flags, preserve the flag bits other than the |
266 | * ACCESS_TYPE bits | ||
256 | */ | 267 | */ |
257 | info->field_flags = (u8) ((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | | 268 | info->field_flags = (u8) |
258 | ((u8) ((u32) arg->common.value.integer >> 8))); | 269 | ((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | |
270 | ((u8) ((u32) arg->common.value.integer >> 8))); | ||
259 | 271 | ||
260 | info->attribute = (u8) (arg->common.value.integer); | 272 | info->attribute = (u8) (arg->common.value.integer); |
261 | break; | 273 | break; |
@@ -267,7 +279,8 @@ acpi_ds_get_field_names ( | |||
267 | 279 | ||
268 | status = acpi_ns_lookup (walk_state->scope_info, | 280 | status = acpi_ns_lookup (walk_state->scope_info, |
269 | (char *) &arg->named.name, | 281 | (char *) &arg->named.name, |
270 | info->field_type, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, | 282 | info->field_type, ACPI_IMODE_EXECUTE, |
283 | ACPI_NS_DONT_OPEN_SCOPE, | ||
271 | walk_state, &info->field_node); | 284 | walk_state, &info->field_node); |
272 | if (ACPI_FAILURE (status)) { | 285 | if (ACPI_FAILURE (status)) { |
273 | ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); | 286 | ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); |
@@ -295,8 +308,9 @@ acpi_ds_get_field_names ( | |||
295 | + (acpi_integer) arg->common.value.size; | 308 | + (acpi_integer) arg->common.value.size; |
296 | 309 | ||
297 | if (position > ACPI_UINT32_MAX) { | 310 | if (position > ACPI_UINT32_MAX) { |
298 | ACPI_REPORT_ERROR (("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", | 311 | ACPI_REPORT_ERROR (( |
299 | (char *) &info->field_node->name)); | 312 | "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", |
313 | (char *) &info->field_node->name)); | ||
300 | return_ACPI_STATUS (AE_SUPPORT); | 314 | return_ACPI_STATUS (AE_SUPPORT); |
301 | } | 315 | } |
302 | 316 | ||
@@ -306,7 +320,8 @@ acpi_ds_get_field_names ( | |||
306 | 320 | ||
307 | default: | 321 | default: |
308 | 322 | ||
309 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid opcode in field list: %X\n", | 323 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
324 | "Invalid opcode in field list: %X\n", | ||
310 | arg->common.aml_opcode)); | 325 | arg->common.aml_opcode)); |
311 | return_ACPI_STATUS (AE_AML_BAD_OPCODE); | 326 | return_ACPI_STATUS (AE_AML_BAD_OPCODE); |
312 | } | 327 | } |
@@ -435,7 +450,8 @@ acpi_ds_init_field_objects ( | |||
435 | status = acpi_ns_lookup (walk_state->scope_info, | 450 | status = acpi_ns_lookup (walk_state->scope_info, |
436 | (char *) &arg->named.name, | 451 | (char *) &arg->named.name, |
437 | type, ACPI_IMODE_LOAD_PASS1, | 452 | type, ACPI_IMODE_LOAD_PASS1, |
438 | ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, | 453 | ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | |
454 | ACPI_NS_ERROR_IF_FOUND, | ||
439 | walk_state, &node); | 455 | walk_state, &node); |
440 | if (ACPI_FAILURE (status)) { | 456 | if (ACPI_FAILURE (status)) { |
441 | ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); | 457 | ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); |
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index b4d264dbbf67..d7790db50178 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c | |||
@@ -49,12 +49,21 @@ | |||
49 | #define _COMPONENT ACPI_DISPATCHER | 49 | #define _COMPONENT ACPI_DISPATCHER |
50 | ACPI_MODULE_NAME ("dsinit") | 50 | ACPI_MODULE_NAME ("dsinit") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static acpi_status | ||
55 | acpi_ds_init_one_object ( | ||
56 | acpi_handle obj_handle, | ||
57 | u32 level, | ||
58 | void *context, | ||
59 | void **return_value); | ||
60 | |||
52 | 61 | ||
53 | /******************************************************************************* | 62 | /******************************************************************************* |
54 | * | 63 | * |
55 | * FUNCTION: acpi_ds_init_one_object | 64 | * FUNCTION: acpi_ds_init_one_object |
56 | * | 65 | * |
57 | * PARAMETERS: obj_handle - Node | 66 | * PARAMETERS: obj_handle - Node for the object |
58 | * Level - Current nesting level | 67 | * Level - Current nesting level |
59 | * Context - Points to a init info struct | 68 | * Context - Points to a init info struct |
60 | * return_value - Not used | 69 | * return_value - Not used |
@@ -70,7 +79,7 @@ | |||
70 | * | 79 | * |
71 | ******************************************************************************/ | 80 | ******************************************************************************/ |
72 | 81 | ||
73 | acpi_status | 82 | static acpi_status |
74 | acpi_ds_init_one_object ( | 83 | acpi_ds_init_one_object ( |
75 | acpi_handle obj_handle, | 84 | acpi_handle obj_handle, |
76 | u32 level, | 85 | u32 level, |
@@ -105,7 +114,8 @@ acpi_ds_init_one_object ( | |||
105 | 114 | ||
106 | status = acpi_ds_initialize_region (obj_handle); | 115 | status = acpi_ds_initialize_region (obj_handle); |
107 | if (ACPI_FAILURE (status)) { | 116 | if (ACPI_FAILURE (status)) { |
108 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region %p [%4.4s] - Init failure, %s\n", | 117 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
118 | "Region %p [%4.4s] - Init failure, %s\n", | ||
109 | obj_handle, acpi_ut_get_node_name (obj_handle), | 119 | obj_handle, acpi_ut_get_node_name (obj_handle), |
110 | acpi_format_exception (status))); | 120 | acpi_format_exception (status))); |
111 | } | 121 | } |
@@ -118,8 +128,10 @@ acpi_ds_init_one_object ( | |||
118 | 128 | ||
119 | info->method_count++; | 129 | info->method_count++; |
120 | 130 | ||
121 | /* Print a dot for each method unless we are going to print the entire pathname */ | 131 | /* |
122 | 132 | * Print a dot for each method unless we are going to print | |
133 | * the entire pathname | ||
134 | */ | ||
123 | if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { | 135 | if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { |
124 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); | 136 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); |
125 | } | 137 | } |
@@ -140,7 +152,8 @@ acpi_ds_init_one_object ( | |||
140 | */ | 152 | */ |
141 | status = acpi_ds_parse_method (obj_handle); | 153 | status = acpi_ds_parse_method (obj_handle); |
142 | if (ACPI_FAILURE (status)) { | 154 | if (ACPI_FAILURE (status)) { |
143 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n", | 155 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
156 | "Method %p [%4.4s] - parse failure, %s\n", | ||
144 | obj_handle, acpi_ut_get_node_name (obj_handle), | 157 | obj_handle, acpi_ut_get_node_name (obj_handle), |
145 | acpi_format_exception (status))); | 158 | acpi_format_exception (status))); |
146 | 159 | ||
@@ -154,7 +167,8 @@ acpi_ds_init_one_object ( | |||
154 | * for every execution since there isn't much overhead | 167 | * for every execution since there isn't much overhead |
155 | */ | 168 | */ |
156 | acpi_ns_delete_namespace_subtree (obj_handle); | 169 | acpi_ns_delete_namespace_subtree (obj_handle); |
157 | acpi_ns_delete_namespace_by_owner (((struct acpi_namespace_node *) obj_handle)->object->method.owning_id); | 170 | acpi_ns_delete_namespace_by_owner ( |
171 | ((struct acpi_namespace_node *) obj_handle)->object->method.owning_id); | ||
158 | break; | 172 | break; |
159 | 173 | ||
160 | 174 | ||
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 9f0456cb9bb5..9fc3f4c033eb 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -153,12 +153,11 @@ acpi_ds_parse_method ( | |||
153 | /* | 153 | /* |
154 | * Parse the method, first pass | 154 | * Parse the method, first pass |
155 | * | 155 | * |
156 | * The first pass load is where newly declared named objects are | 156 | * The first pass load is where newly declared named objects are added into |
157 | * added into the namespace. Actual evaluation of | 157 | * the namespace. Actual evaluation of the named objects (what would be |
158 | * the named objects (what would be called a "second | 158 | * called a "second pass") happens during the actual execution of the |
159 | * pass") happens during the actual execution of the | 159 | * method so that operands to the named objects can take on dynamic |
160 | * method so that operands to the named objects can | 160 | * run-time values. |
161 | * take on dynamic run-time values. | ||
162 | */ | 161 | */ |
163 | status = acpi_ps_parse_aml (walk_state); | 162 | status = acpi_ps_parse_aml (walk_state); |
164 | if (ACPI_FAILURE (status)) { | 163 | if (ACPI_FAILURE (status)) { |
diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index f31d095f9833..f7998306f756 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c | |||
@@ -52,6 +52,29 @@ | |||
52 | #define _COMPONENT ACPI_DISPATCHER | 52 | #define _COMPONENT ACPI_DISPATCHER |
53 | ACPI_MODULE_NAME ("dsmthdat") | 53 | ACPI_MODULE_NAME ("dsmthdat") |
54 | 54 | ||
55 | /* Local prototypes */ | ||
56 | |||
57 | static void | ||
58 | acpi_ds_method_data_delete_value ( | ||
59 | u16 opcode, | ||
60 | u32 index, | ||
61 | struct acpi_walk_state *walk_state); | ||
62 | |||
63 | static acpi_status | ||
64 | acpi_ds_method_data_set_value ( | ||
65 | u16 opcode, | ||
66 | u32 index, | ||
67 | union acpi_operand_object *object, | ||
68 | struct acpi_walk_state *walk_state); | ||
69 | |||
70 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
71 | acpi_object_type | ||
72 | acpi_ds_method_data_get_type ( | ||
73 | u16 opcode, | ||
74 | u32 index, | ||
75 | struct acpi_walk_state *walk_state); | ||
76 | #endif | ||
77 | |||
55 | 78 | ||
56 | /******************************************************************************* | 79 | /******************************************************************************* |
57 | * | 80 | * |
@@ -62,8 +85,8 @@ | |||
62 | * RETURN: Status | 85 | * RETURN: Status |
63 | * | 86 | * |
64 | * DESCRIPTION: Initialize the data structures that hold the method's arguments | 87 | * DESCRIPTION: Initialize the data structures that hold the method's arguments |
65 | * and locals. The data struct is an array of NTEs for each. | 88 | * and locals. The data struct is an array of namespace nodes for |
66 | * This allows ref_of and de_ref_of to work properly for these | 89 | * each - this allows ref_of and de_ref_of to work properly for these |
67 | * special data types. | 90 | * special data types. |
68 | * | 91 | * |
69 | * NOTES: walk_state fields are initialized to zero by the | 92 | * NOTES: walk_state fields are initialized to zero by the |
@@ -92,7 +115,8 @@ acpi_ds_method_data_init ( | |||
92 | walk_state->arguments[i].name.integer |= (i << 24); | 115 | walk_state->arguments[i].name.integer |= (i << 24); |
93 | walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED; | 116 | walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED; |
94 | walk_state->arguments[i].type = ACPI_TYPE_ANY; | 117 | walk_state->arguments[i].type = ACPI_TYPE_ANY; |
95 | walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG; | 118 | walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | |
119 | ANOBJ_METHOD_ARG; | ||
96 | } | 120 | } |
97 | 121 | ||
98 | /* Init the method locals */ | 122 | /* Init the method locals */ |
@@ -104,7 +128,8 @@ acpi_ds_method_data_init ( | |||
104 | walk_state->local_variables[i].name.integer |= (i << 24); | 128 | walk_state->local_variables[i].name.integer |= (i << 24); |
105 | walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED; | 129 | walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED; |
106 | walk_state->local_variables[i].type = ACPI_TYPE_ANY; | 130 | walk_state->local_variables[i].type = ACPI_TYPE_ANY; |
107 | walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL; | 131 | walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | |
132 | ANOBJ_METHOD_LOCAL; | ||
108 | } | 133 | } |
109 | 134 | ||
110 | return_VOID; | 135 | return_VOID; |
@@ -198,15 +223,18 @@ acpi_ds_method_data_init_args ( | |||
198 | return_ACPI_STATUS (AE_OK); | 223 | return_ACPI_STATUS (AE_OK); |
199 | } | 224 | } |
200 | 225 | ||
201 | /* Copy passed parameters into the new method stack frame */ | 226 | /* Copy passed parameters into the new method stack frame */ |
202 | 227 | ||
203 | while ((index < ACPI_METHOD_NUM_ARGS) && (index < max_param_count) && params[index]) { | 228 | while ((index < ACPI_METHOD_NUM_ARGS) && |
229 | (index < max_param_count) && | ||
230 | params[index]) { | ||
204 | /* | 231 | /* |
205 | * A valid parameter. | 232 | * A valid parameter. |
206 | * Store the argument in the method/walk descriptor. | 233 | * Store the argument in the method/walk descriptor. |
207 | * Do not copy the arg in order to implement call by reference | 234 | * Do not copy the arg in order to implement call by reference |
208 | */ | 235 | */ |
209 | status = acpi_ds_method_data_set_value (AML_ARG_OP, index, params[index], walk_state); | 236 | status = acpi_ds_method_data_set_value (AML_ARG_OP, index, |
237 | params[index], walk_state); | ||
210 | if (ACPI_FAILURE (status)) { | 238 | if (ACPI_FAILURE (status)) { |
211 | return_ACPI_STATUS (status); | 239 | return_ACPI_STATUS (status); |
212 | } | 240 | } |
@@ -224,11 +252,13 @@ acpi_ds_method_data_init_args ( | |||
224 | * FUNCTION: acpi_ds_method_data_get_node | 252 | * FUNCTION: acpi_ds_method_data_get_node |
225 | * | 253 | * |
226 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 254 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
227 | * Index - which local_var or argument whose type | 255 | * Index - Which Local or Arg whose type to get |
228 | * to get | ||
229 | * walk_state - Current walk state object | 256 | * walk_state - Current walk state object |
257 | * Node - Where the node is returned. | ||
230 | * | 258 | * |
231 | * RETURN: Get the Node associated with a local or arg. | 259 | * RETURN: Status and node |
260 | * | ||
261 | * DESCRIPTION: Get the Node associated with a local or arg. | ||
232 | * | 262 | * |
233 | ******************************************************************************/ | 263 | ******************************************************************************/ |
234 | 264 | ||
@@ -249,7 +279,8 @@ acpi_ds_method_data_get_node ( | |||
249 | case AML_LOCAL_OP: | 279 | case AML_LOCAL_OP: |
250 | 280 | ||
251 | if (index > ACPI_METHOD_MAX_LOCAL) { | 281 | if (index > ACPI_METHOD_MAX_LOCAL) { |
252 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n", | 282 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
283 | "Local index %d is invalid (max %d)\n", | ||
253 | index, ACPI_METHOD_MAX_LOCAL)); | 284 | index, ACPI_METHOD_MAX_LOCAL)); |
254 | return_ACPI_STATUS (AE_AML_INVALID_INDEX); | 285 | return_ACPI_STATUS (AE_AML_INVALID_INDEX); |
255 | } | 286 | } |
@@ -262,7 +293,8 @@ acpi_ds_method_data_get_node ( | |||
262 | case AML_ARG_OP: | 293 | case AML_ARG_OP: |
263 | 294 | ||
264 | if (index > ACPI_METHOD_MAX_ARG) { | 295 | if (index > ACPI_METHOD_MAX_ARG) { |
265 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n", | 296 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
297 | "Arg index %d is invalid (max %d)\n", | ||
266 | index, ACPI_METHOD_MAX_ARG)); | 298 | index, ACPI_METHOD_MAX_ARG)); |
267 | return_ACPI_STATUS (AE_AML_INVALID_INDEX); | 299 | return_ACPI_STATUS (AE_AML_INVALID_INDEX); |
268 | } | 300 | } |
@@ -286,7 +318,7 @@ acpi_ds_method_data_get_node ( | |||
286 | * FUNCTION: acpi_ds_method_data_set_value | 318 | * FUNCTION: acpi_ds_method_data_set_value |
287 | * | 319 | * |
288 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 320 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
289 | * Index - which local_var or argument to get | 321 | * Index - Which Local or Arg to get |
290 | * Object - Object to be inserted into the stack entry | 322 | * Object - Object to be inserted into the stack entry |
291 | * walk_state - Current walk state object | 323 | * walk_state - Current walk state object |
292 | * | 324 | * |
@@ -297,7 +329,7 @@ acpi_ds_method_data_get_node ( | |||
297 | * | 329 | * |
298 | ******************************************************************************/ | 330 | ******************************************************************************/ |
299 | 331 | ||
300 | acpi_status | 332 | static acpi_status |
301 | acpi_ds_method_data_set_value ( | 333 | acpi_ds_method_data_set_value ( |
302 | u16 opcode, | 334 | u16 opcode, |
303 | u32 index, | 335 | u32 index, |
@@ -340,68 +372,16 @@ acpi_ds_method_data_set_value ( | |||
340 | 372 | ||
341 | /******************************************************************************* | 373 | /******************************************************************************* |
342 | * | 374 | * |
343 | * FUNCTION: acpi_ds_method_data_get_type | ||
344 | * | ||
345 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | ||
346 | * Index - which local_var or argument whose type | ||
347 | * to get | ||
348 | * walk_state - Current walk state object | ||
349 | * | ||
350 | * RETURN: Data type of current value of the selected Arg or Local | ||
351 | * | ||
352 | ******************************************************************************/ | ||
353 | #ifdef ACPI_FUTURE_USAGE | ||
354 | acpi_object_type | ||
355 | acpi_ds_method_data_get_type ( | ||
356 | u16 opcode, | ||
357 | u32 index, | ||
358 | struct acpi_walk_state *walk_state) | ||
359 | { | ||
360 | acpi_status status; | ||
361 | struct acpi_namespace_node *node; | ||
362 | union acpi_operand_object *object; | ||
363 | |||
364 | |||
365 | ACPI_FUNCTION_TRACE ("ds_method_data_get_type"); | ||
366 | |||
367 | |||
368 | /* Get the namespace node for the arg/local */ | ||
369 | |||
370 | status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node); | ||
371 | if (ACPI_FAILURE (status)) { | ||
372 | return_VALUE ((ACPI_TYPE_NOT_FOUND)); | ||
373 | } | ||
374 | |||
375 | /* Get the object */ | ||
376 | |||
377 | object = acpi_ns_get_attached_object (node); | ||
378 | if (!object) { | ||
379 | /* Uninitialized local/arg, return TYPE_ANY */ | ||
380 | |||
381 | return_VALUE (ACPI_TYPE_ANY); | ||
382 | } | ||
383 | |||
384 | /* Get the object type */ | ||
385 | |||
386 | return_VALUE (ACPI_GET_OBJECT_TYPE (object)); | ||
387 | } | ||
388 | #endif /* ACPI_FUTURE_USAGE */ | ||
389 | |||
390 | |||
391 | /******************************************************************************* | ||
392 | * | ||
393 | * FUNCTION: acpi_ds_method_data_get_value | 375 | * FUNCTION: acpi_ds_method_data_get_value |
394 | * | 376 | * |
395 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 377 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
396 | * Index - which local_var or argument to get | 378 | * Index - which local_var or argument to get |
397 | * walk_state - Current walk state object | 379 | * walk_state - Current walk state object |
398 | * *dest_desc - Ptr to Descriptor into which selected Arg | 380 | * dest_desc - Where Arg or Local value is returned |
399 | * or Local value should be copied | ||
400 | * | 381 | * |
401 | * RETURN: Status | 382 | * RETURN: Status |
402 | * | 383 | * |
403 | * DESCRIPTION: Retrieve value of selected Arg or Local from the method frame | 384 | * DESCRIPTION: Retrieve value of selected Arg or Local for this method |
404 | * at the current top of the method stack. | ||
405 | * Used only in acpi_ex_resolve_to_value(). | 385 | * Used only in acpi_ex_resolve_to_value(). |
406 | * | 386 | * |
407 | ******************************************************************************/ | 387 | ******************************************************************************/ |
@@ -467,14 +447,16 @@ acpi_ds_method_data_get_value ( | |||
467 | else switch (opcode) { | 447 | else switch (opcode) { |
468 | case AML_ARG_OP: | 448 | case AML_ARG_OP: |
469 | 449 | ||
470 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Arg[%d] at node %p\n", | 450 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
451 | "Uninitialized Arg[%d] at node %p\n", | ||
471 | index, node)); | 452 | index, node)); |
472 | 453 | ||
473 | return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG); | 454 | return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG); |
474 | 455 | ||
475 | case AML_LOCAL_OP: | 456 | case AML_LOCAL_OP: |
476 | 457 | ||
477 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at node %p\n", | 458 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
459 | "Uninitialized Local[%d] at node %p\n", | ||
478 | index, node)); | 460 | index, node)); |
479 | 461 | ||
480 | return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); | 462 | return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); |
@@ -506,12 +488,12 @@ acpi_ds_method_data_get_value ( | |||
506 | * | 488 | * |
507 | * RETURN: None | 489 | * RETURN: None |
508 | * | 490 | * |
509 | * DESCRIPTION: Delete the entry at Opcode:Index on the method stack. Inserts | 491 | * DESCRIPTION: Delete the entry at Opcode:Index. Inserts |
510 | * a null into the stack slot after the object is deleted. | 492 | * a null into the stack slot after the object is deleted. |
511 | * | 493 | * |
512 | ******************************************************************************/ | 494 | ******************************************************************************/ |
513 | 495 | ||
514 | void | 496 | static void |
515 | acpi_ds_method_data_delete_value ( | 497 | acpi_ds_method_data_delete_value ( |
516 | u16 opcode, | 498 | u16 opcode, |
517 | u32 index, | 499 | u32 index, |
@@ -562,7 +544,7 @@ acpi_ds_method_data_delete_value ( | |||
562 | * FUNCTION: acpi_ds_store_object_to_local | 544 | * FUNCTION: acpi_ds_store_object_to_local |
563 | * | 545 | * |
564 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 546 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
565 | * Index - which local_var or argument to set | 547 | * Index - Which Local or Arg to set |
566 | * obj_desc - Value to be stored | 548 | * obj_desc - Value to be stored |
567 | * walk_state - Current walk state | 549 | * walk_state - Current walk state |
568 | * | 550 | * |
@@ -651,19 +633,20 @@ acpi_ds_store_object_to_local ( | |||
651 | */ | 633 | */ |
652 | if (opcode == AML_ARG_OP) { | 634 | if (opcode == AML_ARG_OP) { |
653 | /* | 635 | /* |
654 | * Make sure that the object is the correct type. This may be overkill, but | 636 | * Make sure that the object is the correct type. This may be |
655 | * it is here because references were NS nodes in the past. Now they are | 637 | * overkill, butit is here because references were NS nodes in |
656 | * operand objects of type Reference. | 638 | * the past. Now they are operand objects of type Reference. |
657 | */ | 639 | */ |
658 | if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) { | 640 | if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) { |
659 | ACPI_REPORT_ERROR (("Invalid descriptor type while storing to method arg: [%s]\n", | 641 | ACPI_REPORT_ERROR (( |
660 | acpi_ut_get_descriptor_name (current_obj_desc))); | 642 | "Invalid descriptor type while storing to method arg: [%s]\n", |
643 | acpi_ut_get_descriptor_name (current_obj_desc))); | ||
661 | return_ACPI_STATUS (AE_AML_INTERNAL); | 644 | return_ACPI_STATUS (AE_AML_INTERNAL); |
662 | } | 645 | } |
663 | 646 | ||
664 | /* | 647 | /* |
665 | * If we have a valid reference object that came from ref_of(), do the | 648 | * If we have a valid reference object that came from ref_of(), |
666 | * indirect store | 649 | * do the indirect store |
667 | */ | 650 | */ |
668 | if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) && | 651 | if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) && |
669 | (current_obj_desc->reference.opcode == AML_REF_OF_OP)) { | 652 | (current_obj_desc->reference.opcode == AML_REF_OF_OP)) { |
@@ -713,3 +696,55 @@ acpi_ds_store_object_to_local ( | |||
713 | } | 696 | } |
714 | 697 | ||
715 | 698 | ||
699 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
700 | /******************************************************************************* | ||
701 | * | ||
702 | * FUNCTION: acpi_ds_method_data_get_type | ||
703 | * | ||
704 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | ||
705 | * Index - Which Local or Arg whose type to get | ||
706 | * walk_state - Current walk state object | ||
707 | * | ||
708 | * RETURN: Data type of current value of the selected Arg or Local | ||
709 | * | ||
710 | * DESCRIPTION: Get the type of the object stored in the Local or Arg | ||
711 | * | ||
712 | ******************************************************************************/ | ||
713 | |||
714 | acpi_object_type | ||
715 | acpi_ds_method_data_get_type ( | ||
716 | u16 opcode, | ||
717 | u32 index, | ||
718 | struct acpi_walk_state *walk_state) | ||
719 | { | ||
720 | acpi_status status; | ||
721 | struct acpi_namespace_node *node; | ||
722 | union acpi_operand_object *object; | ||
723 | |||
724 | |||
725 | ACPI_FUNCTION_TRACE ("ds_method_data_get_type"); | ||
726 | |||
727 | |||
728 | /* Get the namespace node for the arg/local */ | ||
729 | |||
730 | status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node); | ||
731 | if (ACPI_FAILURE (status)) { | ||
732 | return_VALUE ((ACPI_TYPE_NOT_FOUND)); | ||
733 | } | ||
734 | |||
735 | /* Get the object */ | ||
736 | |||
737 | object = acpi_ns_get_attached_object (node); | ||
738 | if (!object) { | ||
739 | /* Uninitialized local/arg, return TYPE_ANY */ | ||
740 | |||
741 | return_VALUE (ACPI_TYPE_ANY); | ||
742 | } | ||
743 | |||
744 | /* Get the object type */ | ||
745 | |||
746 | return_VALUE (ACPI_GET_OBJECT_TYPE (object)); | ||
747 | } | ||
748 | #endif | ||
749 | |||
750 | |||
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index eb8af4785bcb..bfbae4e4c667 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c | |||
@@ -52,9 +52,15 @@ | |||
52 | #define _COMPONENT ACPI_DISPATCHER | 52 | #define _COMPONENT ACPI_DISPATCHER |
53 | ACPI_MODULE_NAME ("dsobject") | 53 | ACPI_MODULE_NAME ("dsobject") |
54 | 54 | ||
55 | static acpi_status | ||
56 | acpi_ds_build_internal_object ( | ||
57 | struct acpi_walk_state *walk_state, | ||
58 | union acpi_parse_object *op, | ||
59 | union acpi_operand_object **obj_desc_ptr); | ||
60 | |||
55 | 61 | ||
56 | #ifndef ACPI_NO_METHOD_EXECUTION | 62 | #ifndef ACPI_NO_METHOD_EXECUTION |
57 | /***************************************************************************** | 63 | /******************************************************************************* |
58 | * | 64 | * |
59 | * FUNCTION: acpi_ds_build_internal_object | 65 | * FUNCTION: acpi_ds_build_internal_object |
60 | * | 66 | * |
@@ -67,9 +73,9 @@ | |||
67 | * DESCRIPTION: Translate a parser Op object to the equivalent namespace object | 73 | * DESCRIPTION: Translate a parser Op object to the equivalent namespace object |
68 | * Simple objects are any objects other than a package object! | 74 | * Simple objects are any objects other than a package object! |
69 | * | 75 | * |
70 | ****************************************************************************/ | 76 | ******************************************************************************/ |
71 | 77 | ||
72 | acpi_status | 78 | static acpi_status |
73 | acpi_ds_build_internal_object ( | 79 | acpi_ds_build_internal_object ( |
74 | struct acpi_walk_state *walk_state, | 80 | struct acpi_walk_state *walk_state, |
75 | union acpi_parse_object *op, | 81 | union acpi_parse_object *op, |
@@ -90,9 +96,11 @@ acpi_ds_build_internal_object ( | |||
90 | * Otherwise, go ahead and look it up now | 96 | * Otherwise, go ahead and look it up now |
91 | */ | 97 | */ |
92 | if (!op->common.node) { | 98 | if (!op->common.node) { |
93 | status = acpi_ns_lookup (walk_state->scope_info, op->common.value.string, | 99 | status = acpi_ns_lookup (walk_state->scope_info, |
100 | op->common.value.string, | ||
94 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | 101 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, |
95 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, | 102 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, |
103 | NULL, | ||
96 | (struct acpi_namespace_node **) &(op->common.node)); | 104 | (struct acpi_namespace_node **) &(op->common.node)); |
97 | 105 | ||
98 | if (ACPI_FAILURE (status)) { | 106 | if (ACPI_FAILURE (status)) { |
@@ -104,12 +112,14 @@ acpi_ds_build_internal_object ( | |||
104 | 112 | ||
105 | /* Create and init the internal ACPI object */ | 113 | /* Create and init the internal ACPI object */ |
106 | 114 | ||
107 | obj_desc = acpi_ut_create_internal_object ((acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type); | 115 | obj_desc = acpi_ut_create_internal_object ( |
116 | (acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type); | ||
108 | if (!obj_desc) { | 117 | if (!obj_desc) { |
109 | return_ACPI_STATUS (AE_NO_MEMORY); | 118 | return_ACPI_STATUS (AE_NO_MEMORY); |
110 | } | 119 | } |
111 | 120 | ||
112 | status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode, &obj_desc); | 121 | status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode, |
122 | &obj_desc); | ||
113 | if (ACPI_FAILURE (status)) { | 123 | if (ACPI_FAILURE (status)) { |
114 | acpi_ut_remove_reference (obj_desc); | 124 | acpi_ut_remove_reference (obj_desc); |
115 | return_ACPI_STATUS (status); | 125 | return_ACPI_STATUS (status); |
@@ -120,7 +130,7 @@ acpi_ds_build_internal_object ( | |||
120 | } | 130 | } |
121 | 131 | ||
122 | 132 | ||
123 | /***************************************************************************** | 133 | /******************************************************************************* |
124 | * | 134 | * |
125 | * FUNCTION: acpi_ds_build_internal_buffer_obj | 135 | * FUNCTION: acpi_ds_build_internal_buffer_obj |
126 | * | 136 | * |
@@ -134,7 +144,7 @@ acpi_ds_build_internal_object ( | |||
134 | * DESCRIPTION: Translate a parser Op package object to the equivalent | 144 | * DESCRIPTION: Translate a parser Op package object to the equivalent |
135 | * namespace object | 145 | * namespace object |
136 | * | 146 | * |
137 | ****************************************************************************/ | 147 | ******************************************************************************/ |
138 | 148 | ||
139 | acpi_status | 149 | acpi_status |
140 | acpi_ds_build_internal_buffer_obj ( | 150 | acpi_ds_build_internal_buffer_obj ( |
@@ -229,7 +239,7 @@ acpi_ds_build_internal_buffer_obj ( | |||
229 | } | 239 | } |
230 | 240 | ||
231 | 241 | ||
232 | /***************************************************************************** | 242 | /******************************************************************************* |
233 | * | 243 | * |
234 | * FUNCTION: acpi_ds_build_internal_package_obj | 244 | * FUNCTION: acpi_ds_build_internal_package_obj |
235 | * | 245 | * |
@@ -243,7 +253,7 @@ acpi_ds_build_internal_buffer_obj ( | |||
243 | * DESCRIPTION: Translate a parser Op package object to the equivalent | 253 | * DESCRIPTION: Translate a parser Op package object to the equivalent |
244 | * namespace object | 254 | * namespace object |
245 | * | 255 | * |
246 | ****************************************************************************/ | 256 | ******************************************************************************/ |
247 | 257 | ||
248 | acpi_status | 258 | acpi_status |
249 | acpi_ds_build_internal_package_obj ( | 259 | acpi_ds_build_internal_package_obj ( |
@@ -331,11 +341,12 @@ acpi_ds_build_internal_package_obj ( | |||
331 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { | 341 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { |
332 | /* Object (package or buffer) is already built */ | 342 | /* Object (package or buffer) is already built */ |
333 | 343 | ||
334 | obj_desc->package.elements[i] = ACPI_CAST_PTR (union acpi_operand_object, arg->common.node); | 344 | obj_desc->package.elements[i] = |
345 | ACPI_CAST_PTR (union acpi_operand_object, arg->common.node); | ||
335 | } | 346 | } |
336 | else { | 347 | else { |
337 | status = acpi_ds_build_internal_object (walk_state, arg, | 348 | status = acpi_ds_build_internal_object (walk_state, arg, |
338 | &obj_desc->package.elements[i]); | 349 | &obj_desc->package.elements[i]); |
339 | } | 350 | } |
340 | 351 | ||
341 | i++; | 352 | i++; |
@@ -348,7 +359,7 @@ acpi_ds_build_internal_package_obj ( | |||
348 | } | 359 | } |
349 | 360 | ||
350 | 361 | ||
351 | /***************************************************************************** | 362 | /******************************************************************************* |
352 | * | 363 | * |
353 | * FUNCTION: acpi_ds_create_node | 364 | * FUNCTION: acpi_ds_create_node |
354 | * | 365 | * |
@@ -360,7 +371,7 @@ acpi_ds_build_internal_package_obj ( | |||
360 | * | 371 | * |
361 | * DESCRIPTION: Create the object to be associated with a namespace node | 372 | * DESCRIPTION: Create the object to be associated with a namespace node |
362 | * | 373 | * |
363 | ****************************************************************************/ | 374 | ******************************************************************************/ |
364 | 375 | ||
365 | acpi_status | 376 | acpi_status |
366 | acpi_ds_create_node ( | 377 | acpi_ds_create_node ( |
@@ -392,7 +403,8 @@ acpi_ds_create_node ( | |||
392 | 403 | ||
393 | /* Build an internal object for the argument(s) */ | 404 | /* Build an internal object for the argument(s) */ |
394 | 405 | ||
395 | status = acpi_ds_build_internal_object (walk_state, op->common.value.arg, &obj_desc); | 406 | status = acpi_ds_build_internal_object (walk_state, op->common.value.arg, |
407 | &obj_desc); | ||
396 | if (ACPI_FAILURE (status)) { | 408 | if (ACPI_FAILURE (status)) { |
397 | return_ACPI_STATUS (status); | 409 | return_ACPI_STATUS (status); |
398 | } | 410 | } |
@@ -414,7 +426,7 @@ acpi_ds_create_node ( | |||
414 | #endif /* ACPI_NO_METHOD_EXECUTION */ | 426 | #endif /* ACPI_NO_METHOD_EXECUTION */ |
415 | 427 | ||
416 | 428 | ||
417 | /***************************************************************************** | 429 | /******************************************************************************* |
418 | * | 430 | * |
419 | * FUNCTION: acpi_ds_init_object_from_op | 431 | * FUNCTION: acpi_ds_init_object_from_op |
420 | * | 432 | * |
@@ -429,7 +441,7 @@ acpi_ds_create_node ( | |||
429 | * associated arguments. The namespace object is a more compact | 441 | * associated arguments. The namespace object is a more compact |
430 | * representation of the Op and its arguments. | 442 | * representation of the Op and its arguments. |
431 | * | 443 | * |
432 | ****************************************************************************/ | 444 | ******************************************************************************/ |
433 | 445 | ||
434 | acpi_status | 446 | acpi_status |
435 | acpi_ds_init_object_from_op ( | 447 | acpi_ds_init_object_from_op ( |
@@ -462,7 +474,8 @@ acpi_ds_init_object_from_op ( | |||
462 | /* | 474 | /* |
463 | * Defer evaluation of Buffer term_arg operand | 475 | * Defer evaluation of Buffer term_arg operand |
464 | */ | 476 | */ |
465 | obj_desc->buffer.node = (struct acpi_namespace_node *) walk_state->operands[0]; | 477 | obj_desc->buffer.node = (struct acpi_namespace_node *) |
478 | walk_state->operands[0]; | ||
466 | obj_desc->buffer.aml_start = op->named.data; | 479 | obj_desc->buffer.aml_start = op->named.data; |
467 | obj_desc->buffer.aml_length = op->named.length; | 480 | obj_desc->buffer.aml_length = op->named.length; |
468 | break; | 481 | break; |
@@ -473,7 +486,8 @@ acpi_ds_init_object_from_op ( | |||
473 | /* | 486 | /* |
474 | * Defer evaluation of Package term_arg operand | 487 | * Defer evaluation of Package term_arg operand |
475 | */ | 488 | */ |
476 | obj_desc->package.node = (struct acpi_namespace_node *) walk_state->operands[0]; | 489 | obj_desc->package.node = (struct acpi_namespace_node *) |
490 | walk_state->operands[0]; | ||
477 | obj_desc->package.aml_start = op->named.data; | 491 | obj_desc->package.aml_start = op->named.data; |
478 | obj_desc->package.aml_length = op->named.length; | 492 | obj_desc->package.aml_length = op->named.length; |
479 | break; | 493 | break; |
@@ -486,9 +500,10 @@ acpi_ds_init_object_from_op ( | |||
486 | /* | 500 | /* |
487 | * Resolve AML Constants here - AND ONLY HERE! | 501 | * Resolve AML Constants here - AND ONLY HERE! |
488 | * All constants are integers. | 502 | * All constants are integers. |
489 | * We mark the integer with a flag that indicates that it started life | 503 | * We mark the integer with a flag that indicates that it started |
490 | * as a constant -- so that stores to constants will perform as expected (noop). | 504 | * life as a constant -- so that stores to constants will perform |
491 | * (zero_op is used as a placeholder for optional target operands.) | 505 | * as expected (noop). zero_op is used as a placeholder for optional |
506 | * target operands. | ||
492 | */ | 507 | */ |
493 | obj_desc->common.flags = AOPOBJ_AML_CONSTANT; | 508 | obj_desc->common.flags = AOPOBJ_AML_CONSTANT; |
494 | 509 | ||
@@ -521,7 +536,8 @@ acpi_ds_init_object_from_op ( | |||
521 | 536 | ||
522 | default: | 537 | default: |
523 | 538 | ||
524 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown constant opcode %X\n", opcode)); | 539 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
540 | "Unknown constant opcode %X\n", opcode)); | ||
525 | status = AE_AML_OPERAND_TYPE; | 541 | status = AE_AML_OPERAND_TYPE; |
526 | break; | 542 | break; |
527 | } | 543 | } |
@@ -535,7 +551,8 @@ acpi_ds_init_object_from_op ( | |||
535 | 551 | ||
536 | 552 | ||
537 | default: | 553 | default: |
538 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", op_info->type)); | 554 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", |
555 | op_info->type)); | ||
539 | status = AE_AML_OPERAND_TYPE; | 556 | status = AE_AML_OPERAND_TYPE; |
540 | break; | 557 | break; |
541 | } | 558 | } |
@@ -570,8 +587,10 @@ acpi_ds_init_object_from_op ( | |||
570 | obj_desc->reference.offset = opcode - AML_LOCAL_OP; | 587 | obj_desc->reference.offset = opcode - AML_LOCAL_OP; |
571 | 588 | ||
572 | #ifndef ACPI_NO_METHOD_EXECUTION | 589 | #ifndef ACPI_NO_METHOD_EXECUTION |
573 | status = acpi_ds_method_data_get_node (AML_LOCAL_OP, obj_desc->reference.offset, | 590 | status = acpi_ds_method_data_get_node (AML_LOCAL_OP, |
574 | walk_state, (struct acpi_namespace_node **) &obj_desc->reference.object); | 591 | obj_desc->reference.offset, |
592 | walk_state, | ||
593 | (struct acpi_namespace_node **) &obj_desc->reference.object); | ||
575 | #endif | 594 | #endif |
576 | break; | 595 | break; |
577 | 596 | ||
@@ -584,8 +603,10 @@ acpi_ds_init_object_from_op ( | |||
584 | obj_desc->reference.offset = opcode - AML_ARG_OP; | 603 | obj_desc->reference.offset = opcode - AML_ARG_OP; |
585 | 604 | ||
586 | #ifndef ACPI_NO_METHOD_EXECUTION | 605 | #ifndef ACPI_NO_METHOD_EXECUTION |
587 | status = acpi_ds_method_data_get_node (AML_ARG_OP, obj_desc->reference.offset, | 606 | status = acpi_ds_method_data_get_node (AML_ARG_OP, |
588 | walk_state, (struct acpi_namespace_node **) &obj_desc->reference.object); | 607 | obj_desc->reference.offset, |
608 | walk_state, | ||
609 | (struct acpi_namespace_node **) &obj_desc->reference.object); | ||
589 | #endif | 610 | #endif |
590 | break; | 611 | break; |
591 | 612 | ||
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c index 5c987a0e7b75..ba13bca28bee 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/dispatcher/dsopcode.c | |||
@@ -54,12 +54,31 @@ | |||
54 | #define _COMPONENT ACPI_DISPATCHER | 54 | #define _COMPONENT ACPI_DISPATCHER |
55 | ACPI_MODULE_NAME ("dsopcode") | 55 | ACPI_MODULE_NAME ("dsopcode") |
56 | 56 | ||
57 | /* Local prototypes */ | ||
57 | 58 | ||
58 | /***************************************************************************** | 59 | static acpi_status |
60 | acpi_ds_execute_arguments ( | ||
61 | struct acpi_namespace_node *node, | ||
62 | struct acpi_namespace_node *scope_node, | ||
63 | u32 aml_length, | ||
64 | u8 *aml_start); | ||
65 | |||
66 | static acpi_status | ||
67 | acpi_ds_init_buffer_field ( | ||
68 | u16 aml_opcode, | ||
69 | union acpi_operand_object *obj_desc, | ||
70 | union acpi_operand_object *buffer_desc, | ||
71 | union acpi_operand_object *offset_desc, | ||
72 | union acpi_operand_object *length_desc, | ||
73 | union acpi_operand_object *result_desc); | ||
74 | |||
75 | |||
76 | /******************************************************************************* | ||
59 | * | 77 | * |
60 | * FUNCTION: acpi_ds_execute_arguments | 78 | * FUNCTION: acpi_ds_execute_arguments |
61 | * | 79 | * |
62 | * PARAMETERS: Node - Parent NS node | 80 | * PARAMETERS: Node - Object NS node |
81 | * scope_node - Parent NS node | ||
63 | * aml_length - Length of executable AML | 82 | * aml_length - Length of executable AML |
64 | * aml_start - Pointer to the AML | 83 | * aml_start - Pointer to the AML |
65 | * | 84 | * |
@@ -67,9 +86,9 @@ | |||
67 | * | 86 | * |
68 | * DESCRIPTION: Late (deferred) execution of region or field arguments | 87 | * DESCRIPTION: Late (deferred) execution of region or field arguments |
69 | * | 88 | * |
70 | ****************************************************************************/ | 89 | ******************************************************************************/ |
71 | 90 | ||
72 | acpi_status | 91 | static acpi_status |
73 | acpi_ds_execute_arguments ( | 92 | acpi_ds_execute_arguments ( |
74 | struct acpi_namespace_node *node, | 93 | struct acpi_namespace_node *node, |
75 | struct acpi_namespace_node *scope_node, | 94 | struct acpi_namespace_node *scope_node, |
@@ -162,7 +181,7 @@ acpi_ds_execute_arguments ( | |||
162 | } | 181 | } |
163 | 182 | ||
164 | 183 | ||
165 | /***************************************************************************** | 184 | /******************************************************************************* |
166 | * | 185 | * |
167 | * FUNCTION: acpi_ds_get_buffer_field_arguments | 186 | * FUNCTION: acpi_ds_get_buffer_field_arguments |
168 | * | 187 | * |
@@ -173,7 +192,7 @@ acpi_ds_execute_arguments ( | |||
173 | * DESCRIPTION: Get buffer_field Buffer and Index. This implements the late | 192 | * DESCRIPTION: Get buffer_field Buffer and Index. This implements the late |
174 | * evaluation of these field attributes. | 193 | * evaluation of these field attributes. |
175 | * | 194 | * |
176 | ****************************************************************************/ | 195 | ******************************************************************************/ |
177 | 196 | ||
178 | acpi_status | 197 | acpi_status |
179 | acpi_ds_get_buffer_field_arguments ( | 198 | acpi_ds_get_buffer_field_arguments ( |
@@ -208,7 +227,7 @@ acpi_ds_get_buffer_field_arguments ( | |||
208 | } | 227 | } |
209 | 228 | ||
210 | 229 | ||
211 | /***************************************************************************** | 230 | /******************************************************************************* |
212 | * | 231 | * |
213 | * FUNCTION: acpi_ds_get_buffer_arguments | 232 | * FUNCTION: acpi_ds_get_buffer_arguments |
214 | * | 233 | * |
@@ -219,7 +238,7 @@ acpi_ds_get_buffer_field_arguments ( | |||
219 | * DESCRIPTION: Get Buffer length and initializer byte list. This implements | 238 | * DESCRIPTION: Get Buffer length and initializer byte list. This implements |
220 | * the late evaluation of these attributes. | 239 | * the late evaluation of these attributes. |
221 | * | 240 | * |
222 | ****************************************************************************/ | 241 | ******************************************************************************/ |
223 | 242 | ||
224 | acpi_status | 243 | acpi_status |
225 | acpi_ds_get_buffer_arguments ( | 244 | acpi_ds_get_buffer_arguments ( |
@@ -255,7 +274,7 @@ acpi_ds_get_buffer_arguments ( | |||
255 | } | 274 | } |
256 | 275 | ||
257 | 276 | ||
258 | /***************************************************************************** | 277 | /******************************************************************************* |
259 | * | 278 | * |
260 | * FUNCTION: acpi_ds_get_package_arguments | 279 | * FUNCTION: acpi_ds_get_package_arguments |
261 | * | 280 | * |
@@ -266,7 +285,7 @@ acpi_ds_get_buffer_arguments ( | |||
266 | * DESCRIPTION: Get Package length and initializer byte list. This implements | 285 | * DESCRIPTION: Get Package length and initializer byte list. This implements |
267 | * the late evaluation of these attributes. | 286 | * the late evaluation of these attributes. |
268 | * | 287 | * |
269 | ****************************************************************************/ | 288 | ******************************************************************************/ |
270 | 289 | ||
271 | acpi_status | 290 | acpi_status |
272 | acpi_ds_get_package_arguments ( | 291 | acpi_ds_get_package_arguments ( |
@@ -353,17 +372,17 @@ acpi_ds_get_region_arguments ( | |||
353 | } | 372 | } |
354 | 373 | ||
355 | 374 | ||
356 | /***************************************************************************** | 375 | /******************************************************************************* |
357 | * | 376 | * |
358 | * FUNCTION: acpi_ds_initialize_region | 377 | * FUNCTION: acpi_ds_initialize_region |
359 | * | 378 | * |
360 | * PARAMETERS: Op - A valid region Op object | 379 | * PARAMETERS: obj_handle - Region namespace node |
361 | * | 380 | * |
362 | * RETURN: Status | 381 | * RETURN: Status |
363 | * | 382 | * |
364 | * DESCRIPTION: Front end to ev_initialize_region | 383 | * DESCRIPTION: Front end to ev_initialize_region |
365 | * | 384 | * |
366 | ****************************************************************************/ | 385 | ******************************************************************************/ |
367 | 386 | ||
368 | acpi_status | 387 | acpi_status |
369 | acpi_ds_initialize_region ( | 388 | acpi_ds_initialize_region ( |
@@ -382,7 +401,7 @@ acpi_ds_initialize_region ( | |||
382 | } | 401 | } |
383 | 402 | ||
384 | 403 | ||
385 | /***************************************************************************** | 404 | /******************************************************************************* |
386 | * | 405 | * |
387 | * FUNCTION: acpi_ds_init_buffer_field | 406 | * FUNCTION: acpi_ds_init_buffer_field |
388 | * | 407 | * |
@@ -390,16 +409,16 @@ acpi_ds_initialize_region ( | |||
390 | * obj_desc - buffer_field object | 409 | * obj_desc - buffer_field object |
391 | * buffer_desc - Host Buffer | 410 | * buffer_desc - Host Buffer |
392 | * offset_desc - Offset into buffer | 411 | * offset_desc - Offset into buffer |
393 | * Length - Length of field (CREATE_FIELD_OP only) | 412 | * length_desc - Length of field (CREATE_FIELD_OP only) |
394 | * Result - Where to store the result | 413 | * result_desc - Where to store the result |
395 | * | 414 | * |
396 | * RETURN: Status | 415 | * RETURN: Status |
397 | * | 416 | * |
398 | * DESCRIPTION: Perform actual initialization of a buffer field | 417 | * DESCRIPTION: Perform actual initialization of a buffer field |
399 | * | 418 | * |
400 | ****************************************************************************/ | 419 | ******************************************************************************/ |
401 | 420 | ||
402 | acpi_status | 421 | static acpi_status |
403 | acpi_ds_init_buffer_field ( | 422 | acpi_ds_init_buffer_field ( |
404 | u16 aml_opcode, | 423 | u16 aml_opcode, |
405 | union acpi_operand_object *obj_desc, | 424 | union acpi_operand_object *obj_desc, |
@@ -435,8 +454,10 @@ acpi_ds_init_buffer_field ( | |||
435 | * after resolution in acpi_ex_resolve_operands(). | 454 | * after resolution in acpi_ex_resolve_operands(). |
436 | */ | 455 | */ |
437 | if (ACPI_GET_DESCRIPTOR_TYPE (result_desc) != ACPI_DESC_TYPE_NAMED) { | 456 | if (ACPI_GET_DESCRIPTOR_TYPE (result_desc) != ACPI_DESC_TYPE_NAMED) { |
438 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination not a NS Node [%s]\n", | 457 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
439 | acpi_ps_get_opcode_name (aml_opcode), acpi_ut_get_descriptor_name (result_desc))); | 458 | "(%s) destination not a NS Node [%s]\n", |
459 | acpi_ps_get_opcode_name (aml_opcode), | ||
460 | acpi_ut_get_descriptor_name (result_desc))); | ||
440 | 461 | ||
441 | status = AE_AML_OPERAND_TYPE; | 462 | status = AE_AML_OPERAND_TYPE; |
442 | goto cleanup; | 463 | goto cleanup; |
@@ -452,9 +473,18 @@ acpi_ds_init_buffer_field ( | |||
452 | 473 | ||
453 | /* Offset is in bits, count is in bits */ | 474 | /* Offset is in bits, count is in bits */ |
454 | 475 | ||
476 | field_flags = AML_FIELD_ACCESS_BYTE; | ||
455 | bit_offset = offset; | 477 | bit_offset = offset; |
456 | bit_count = (u32) length_desc->integer.value; | 478 | bit_count = (u32) length_desc->integer.value; |
457 | field_flags = AML_FIELD_ACCESS_BYTE; | 479 | |
480 | /* Must have a valid (>0) bit count */ | ||
481 | |||
482 | if (bit_count == 0) { | ||
483 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
484 | "Attempt to create_field of length 0\n")); | ||
485 | status = AE_AML_OPERAND_VALUE; | ||
486 | goto cleanup; | ||
487 | } | ||
458 | break; | 488 | break; |
459 | 489 | ||
460 | case AML_CREATE_BIT_FIELD_OP: | 490 | case AML_CREATE_BIT_FIELD_OP: |
@@ -527,7 +557,8 @@ acpi_ds_init_buffer_field ( | |||
527 | 557 | ||
528 | /* | 558 | /* |
529 | * Initialize areas of the field object that are common to all fields | 559 | * Initialize areas of the field object that are common to all fields |
530 | * For field_flags, use LOCK_RULE = 0 (NO_LOCK), UPDATE_RULE = 0 (UPDATE_PRESERVE) | 560 | * For field_flags, use LOCK_RULE = 0 (NO_LOCK), |
561 | * UPDATE_RULE = 0 (UPDATE_PRESERVE) | ||
531 | */ | 562 | */ |
532 | status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0, | 563 | status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0, |
533 | bit_offset, bit_count); | 564 | bit_offset, bit_count); |
@@ -539,8 +570,8 @@ acpi_ds_init_buffer_field ( | |||
539 | 570 | ||
540 | /* Reference count for buffer_desc inherits obj_desc count */ | 571 | /* Reference count for buffer_desc inherits obj_desc count */ |
541 | 572 | ||
542 | buffer_desc->common.reference_count = (u16) (buffer_desc->common.reference_count + | 573 | buffer_desc->common.reference_count = (u16) |
543 | obj_desc->common.reference_count); | 574 | (buffer_desc->common.reference_count + obj_desc->common.reference_count); |
544 | 575 | ||
545 | 576 | ||
546 | cleanup: | 577 | cleanup: |
@@ -569,7 +600,7 @@ cleanup: | |||
569 | } | 600 | } |
570 | 601 | ||
571 | 602 | ||
572 | /***************************************************************************** | 603 | /******************************************************************************* |
573 | * | 604 | * |
574 | * FUNCTION: acpi_ds_eval_buffer_field_operands | 605 | * FUNCTION: acpi_ds_eval_buffer_field_operands |
575 | * | 606 | * |
@@ -581,7 +612,7 @@ cleanup: | |||
581 | * DESCRIPTION: Get buffer_field Buffer and Index | 612 | * DESCRIPTION: Get buffer_field Buffer and Index |
582 | * Called from acpi_ds_exec_end_op during buffer_field parse tree walk | 613 | * Called from acpi_ds_exec_end_op during buffer_field parse tree walk |
583 | * | 614 | * |
584 | ****************************************************************************/ | 615 | ******************************************************************************/ |
585 | 616 | ||
586 | acpi_status | 617 | acpi_status |
587 | acpi_ds_eval_buffer_field_operands ( | 618 | acpi_ds_eval_buffer_field_operands ( |
@@ -656,7 +687,7 @@ acpi_ds_eval_buffer_field_operands ( | |||
656 | } | 687 | } |
657 | 688 | ||
658 | 689 | ||
659 | /***************************************************************************** | 690 | /******************************************************************************* |
660 | * | 691 | * |
661 | * FUNCTION: acpi_ds_eval_region_operands | 692 | * FUNCTION: acpi_ds_eval_region_operands |
662 | * | 693 | * |
@@ -668,7 +699,7 @@ acpi_ds_eval_buffer_field_operands ( | |||
668 | * DESCRIPTION: Get region address and length | 699 | * DESCRIPTION: Get region address and length |
669 | * Called from acpi_ds_exec_end_op during op_region parse tree walk | 700 | * Called from acpi_ds_exec_end_op during op_region parse tree walk |
670 | * | 701 | * |
671 | ****************************************************************************/ | 702 | ******************************************************************************/ |
672 | 703 | ||
673 | acpi_status | 704 | acpi_status |
674 | acpi_ds_eval_region_operands ( | 705 | acpi_ds_eval_region_operands ( |
@@ -686,7 +717,8 @@ acpi_ds_eval_region_operands ( | |||
686 | 717 | ||
687 | 718 | ||
688 | /* | 719 | /* |
689 | * This is where we evaluate the address and length fields of the op_region declaration | 720 | * This is where we evaluate the address and length fields of the |
721 | * op_region declaration | ||
690 | */ | 722 | */ |
691 | node = op->common.node; | 723 | node = op->common.node; |
692 | 724 | ||
@@ -707,7 +739,8 @@ acpi_ds_eval_region_operands ( | |||
707 | 739 | ||
708 | /* Resolve the length and address operands to numbers */ | 740 | /* Resolve the length and address operands to numbers */ |
709 | 741 | ||
710 | status = acpi_ex_resolve_operands (op->common.aml_opcode, ACPI_WALK_OPERANDS, walk_state); | 742 | status = acpi_ex_resolve_operands (op->common.aml_opcode, |
743 | ACPI_WALK_OPERANDS, walk_state); | ||
711 | if (ACPI_FAILURE (status)) { | 744 | if (ACPI_FAILURE (status)) { |
712 | return_ACPI_STATUS (status); | 745 | return_ACPI_STATUS (status); |
713 | } | 746 | } |
@@ -736,7 +769,8 @@ acpi_ds_eval_region_operands ( | |||
736 | */ | 769 | */ |
737 | operand_desc = walk_state->operands[walk_state->num_operands - 2]; | 770 | operand_desc = walk_state->operands[walk_state->num_operands - 2]; |
738 | 771 | ||
739 | obj_desc->region.address = (acpi_physical_address) operand_desc->integer.value; | 772 | obj_desc->region.address = (acpi_physical_address) |
773 | operand_desc->integer.value; | ||
740 | acpi_ut_remove_reference (operand_desc); | 774 | acpi_ut_remove_reference (operand_desc); |
741 | 775 | ||
742 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", | 776 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", |
@@ -752,7 +786,7 @@ acpi_ds_eval_region_operands ( | |||
752 | } | 786 | } |
753 | 787 | ||
754 | 788 | ||
755 | /***************************************************************************** | 789 | /******************************************************************************* |
756 | * | 790 | * |
757 | * FUNCTION: acpi_ds_eval_data_object_operands | 791 | * FUNCTION: acpi_ds_eval_data_object_operands |
758 | * | 792 | * |
@@ -765,7 +799,7 @@ acpi_ds_eval_region_operands ( | |||
765 | * DESCRIPTION: Get the operands and complete the following data object types: | 799 | * DESCRIPTION: Get the operands and complete the following data object types: |
766 | * Buffer, Package. | 800 | * Buffer, Package. |
767 | * | 801 | * |
768 | ****************************************************************************/ | 802 | ******************************************************************************/ |
769 | 803 | ||
770 | acpi_status | 804 | acpi_status |
771 | acpi_ds_eval_data_object_operands ( | 805 | acpi_ds_eval_data_object_operands ( |
@@ -830,7 +864,7 @@ acpi_ds_eval_data_object_operands ( | |||
830 | 864 | ||
831 | if (ACPI_SUCCESS (status)) { | 865 | if (ACPI_SUCCESS (status)) { |
832 | /* | 866 | /* |
833 | * Return the object in the walk_state, unless the parent is a package -- | 867 | * Return the object in the walk_state, unless the parent is a package - |
834 | * in this case, the return object will be stored in the parse tree | 868 | * in this case, the return object will be stored in the parse tree |
835 | * for the package. | 869 | * for the package. |
836 | */ | 870 | */ |
@@ -988,7 +1022,8 @@ acpi_ds_exec_end_control_op ( | |||
988 | status = AE_CTRL_PENDING; | 1022 | status = AE_CTRL_PENDING; |
989 | } | 1023 | } |
990 | 1024 | ||
991 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] termination! Op=%p\n", op)); | 1025 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
1026 | "[WHILE_OP] termination! Op=%p\n",op)); | ||
992 | 1027 | ||
993 | /* Pop this control state and free it */ | 1028 | /* Pop this control state and free it */ |
994 | 1029 | ||
diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index 462c5d83e747..9613349ac31d 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c | |||
@@ -100,7 +100,6 @@ acpi_ds_clear_implicit_return ( | |||
100 | 100 | ||
101 | 101 | ||
102 | #ifndef ACPI_NO_METHOD_EXECUTION | 102 | #ifndef ACPI_NO_METHOD_EXECUTION |
103 | |||
104 | /******************************************************************************* | 103 | /******************************************************************************* |
105 | * | 104 | * |
106 | * FUNCTION: acpi_ds_do_implicit_return | 105 | * FUNCTION: acpi_ds_do_implicit_return |
@@ -205,7 +204,7 @@ acpi_ds_is_result_used ( | |||
205 | * NOTE: this is optional because the ASL language does not actually | 204 | * NOTE: this is optional because the ASL language does not actually |
206 | * support this behavior. | 205 | * support this behavior. |
207 | */ | 206 | */ |
208 | acpi_ds_do_implicit_return (walk_state->result_obj, walk_state, TRUE); | 207 | (void) acpi_ds_do_implicit_return (walk_state->result_obj, walk_state, TRUE); |
209 | 208 | ||
210 | /* | 209 | /* |
211 | * Now determine if the parent will use the result | 210 | * Now determine if the parent will use the result |
@@ -219,8 +218,9 @@ acpi_ds_is_result_used ( | |||
219 | (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { | 218 | (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { |
220 | /* No parent, the return value cannot possibly be used */ | 219 | /* No parent, the return value cannot possibly be used */ |
221 | 220 | ||
222 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "At Method level, result of [%s] not used\n", | 221 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
223 | acpi_ps_get_opcode_name (op->common.aml_opcode))); | 222 | "At Method level, result of [%s] not used\n", |
223 | acpi_ps_get_opcode_name (op->common.aml_opcode))); | ||
224 | return_VALUE (FALSE); | 224 | return_VALUE (FALSE); |
225 | } | 225 | } |
226 | 226 | ||
@@ -228,7 +228,8 @@ acpi_ds_is_result_used ( | |||
228 | 228 | ||
229 | parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode); | 229 | parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode); |
230 | if (parent_info->class == AML_CLASS_UNKNOWN) { | 230 | if (parent_info->class == AML_CLASS_UNKNOWN) { |
231 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", op)); | 231 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
232 | "Unknown parent opcode. Op=%p\n", op)); | ||
232 | return_VALUE (FALSE); | 233 | return_VALUE (FALSE); |
233 | } | 234 | } |
234 | 235 | ||
@@ -309,17 +310,19 @@ acpi_ds_is_result_used ( | |||
309 | 310 | ||
310 | 311 | ||
311 | result_used: | 312 | result_used: |
312 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n", | 313 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
313 | acpi_ps_get_opcode_name (op->common.aml_opcode), | 314 | "Result of [%s] used by Parent [%s] Op=%p\n", |
314 | acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); | 315 | acpi_ps_get_opcode_name (op->common.aml_opcode), |
316 | acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); | ||
315 | 317 | ||
316 | return_VALUE (TRUE); | 318 | return_VALUE (TRUE); |
317 | 319 | ||
318 | 320 | ||
319 | result_not_used: | 321 | result_not_used: |
320 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] not used by Parent [%s] Op=%p\n", | 322 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
321 | acpi_ps_get_opcode_name (op->common.aml_opcode), | 323 | "Result of [%s] not used by Parent [%s] Op=%p\n", |
322 | acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); | 324 | acpi_ps_get_opcode_name (op->common.aml_opcode), |
325 | acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); | ||
323 | 326 | ||
324 | return_VALUE (FALSE); | 327 | return_VALUE (FALSE); |
325 | } | 328 | } |
@@ -522,7 +525,8 @@ acpi_ds_create_operand ( | |||
522 | if ((walk_state->deferred_node) && | 525 | if ((walk_state->deferred_node) && |
523 | (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) && | 526 | (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) && |
524 | (arg_index != 0)) { | 527 | (arg_index != 0)) { |
525 | obj_desc = ACPI_CAST_PTR (union acpi_operand_object, walk_state->deferred_node); | 528 | obj_desc = ACPI_CAST_PTR ( |
529 | union acpi_operand_object, walk_state->deferred_node); | ||
526 | status = AE_OK; | 530 | status = AE_OK; |
527 | } | 531 | } |
528 | else /* All other opcodes */ { | 532 | else /* All other opcodes */ { |
@@ -565,7 +569,8 @@ acpi_ds_create_operand ( | |||
565 | * indicate this to the interpreter, set the | 569 | * indicate this to the interpreter, set the |
566 | * object to the root | 570 | * object to the root |
567 | */ | 571 | */ |
568 | obj_desc = ACPI_CAST_PTR (union acpi_operand_object, acpi_gbl_root_node); | 572 | obj_desc = ACPI_CAST_PTR ( |
573 | union acpi_operand_object, acpi_gbl_root_node); | ||
569 | status = AE_OK; | 574 | status = AE_OK; |
570 | } | 575 | } |
571 | else { | 576 | else { |
@@ -612,7 +617,8 @@ acpi_ds_create_operand ( | |||
612 | */ | 617 | */ |
613 | opcode = AML_ZERO_OP; /* Has no arguments! */ | 618 | opcode = AML_ZERO_OP; /* Has no arguments! */ |
614 | 619 | ||
615 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", arg)); | 620 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
621 | "Null namepath: Arg=%p\n", arg)); | ||
616 | } | 622 | } |
617 | else { | 623 | else { |
618 | opcode = arg->common.aml_opcode; | 624 | opcode = arg->common.aml_opcode; |
@@ -642,7 +648,8 @@ acpi_ds_create_operand ( | |||
642 | * Only error is underflow, and this indicates | 648 | * Only error is underflow, and this indicates |
643 | * a missing or null operand! | 649 | * a missing or null operand! |
644 | */ | 650 | */ |
645 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Missing or null operand, %s\n", | 651 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
652 | "Missing or null operand, %s\n", | ||
646 | acpi_format_exception (status))); | 653 | acpi_format_exception (status))); |
647 | return_ACPI_STATUS (status); | 654 | return_ACPI_STATUS (status); |
648 | } | 655 | } |
@@ -657,8 +664,8 @@ acpi_ds_create_operand ( | |||
657 | 664 | ||
658 | /* Initialize the new object */ | 665 | /* Initialize the new object */ |
659 | 666 | ||
660 | status = acpi_ds_init_object_from_op (walk_state, arg, | 667 | status = acpi_ds_init_object_from_op ( |
661 | opcode, &obj_desc); | 668 | walk_state, arg, opcode, &obj_desc); |
662 | if (ACPI_FAILURE (status)) { | 669 | if (ACPI_FAILURE (status)) { |
663 | acpi_ut_delete_object_desc (obj_desc); | 670 | acpi_ut_delete_object_desc (obj_desc); |
664 | return_ACPI_STATUS (status); | 671 | return_ACPI_STATUS (status); |
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index 2071a0d2bbbb..10f71318e23b 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c | |||
@@ -73,11 +73,13 @@ static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = { | |||
73 | acpi_ex_opcode_3A_1T_1R, | 73 | acpi_ex_opcode_3A_1T_1R, |
74 | acpi_ex_opcode_6A_0T_1R}; | 74 | acpi_ex_opcode_6A_0T_1R}; |
75 | 75 | ||
76 | |||
76 | /***************************************************************************** | 77 | /***************************************************************************** |
77 | * | 78 | * |
78 | * FUNCTION: acpi_ds_get_predicate_value | 79 | * FUNCTION: acpi_ds_get_predicate_value |
79 | * | 80 | * |
80 | * PARAMETERS: walk_state - Current state of the parse tree walk | 81 | * PARAMETERS: walk_state - Current state of the parse tree walk |
82 | * result_obj - if non-zero, pop result from result stack | ||
81 | * | 83 | * |
82 | * RETURN: Status | 84 | * RETURN: Status |
83 | * | 85 | * |
@@ -124,7 +126,8 @@ acpi_ds_get_predicate_value ( | |||
124 | } | 126 | } |
125 | 127 | ||
126 | if (!obj_desc) { | 128 | if (!obj_desc) { |
127 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No predicate obj_desc=%p State=%p\n", | 129 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
130 | "No predicate obj_desc=%p State=%p\n", | ||
128 | obj_desc, walk_state)); | 131 | obj_desc, walk_state)); |
129 | 132 | ||
130 | return_ACPI_STATUS (AE_AML_NO_OPERAND); | 133 | return_ACPI_STATUS (AE_AML_NO_OPERAND); |
@@ -197,7 +200,7 @@ cleanup: | |||
197 | * FUNCTION: acpi_ds_exec_begin_op | 200 | * FUNCTION: acpi_ds_exec_begin_op |
198 | * | 201 | * |
199 | * PARAMETERS: walk_state - Current state of the parse tree walk | 202 | * PARAMETERS: walk_state - Current state of the parse tree walk |
200 | * out_op - Return op if a new one is created | 203 | * out_op - Where to return op if a new one is created |
201 | * | 204 | * |
202 | * RETURN: Status | 205 | * RETURN: Status |
203 | * | 206 | * |
@@ -233,7 +236,8 @@ acpi_ds_exec_begin_op ( | |||
233 | walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); | 236 | walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); |
234 | 237 | ||
235 | if (acpi_ns_opens_scope (walk_state->op_info->object_type)) { | 238 | if (acpi_ns_opens_scope (walk_state->op_info->object_type)) { |
236 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", | 239 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
240 | "(%s) Popping scope for Op %p\n", | ||
237 | acpi_ut_get_type_name (walk_state->op_info->object_type), op)); | 241 | acpi_ut_get_type_name (walk_state->op_info->object_type), op)); |
238 | 242 | ||
239 | status = acpi_ds_scope_stack_pop (walk_state); | 243 | status = acpi_ds_scope_stack_pop (walk_state); |
@@ -297,11 +301,10 @@ acpi_ds_exec_begin_op ( | |||
297 | 301 | ||
298 | if (walk_state->walk_type == ACPI_WALK_METHOD) { | 302 | if (walk_state->walk_type == ACPI_WALK_METHOD) { |
299 | /* | 303 | /* |
300 | * Found a named object declaration during method | 304 | * Found a named object declaration during method execution; |
301 | * execution; we must enter this object into the | 305 | * we must enter this object into the namespace. The created |
302 | * namespace. The created object is temporary and | 306 | * object is temporary and will be deleted upon completion of |
303 | * will be deleted upon completion of the execution | 307 | * the execution of this method. |
304 | * of this method. | ||
305 | */ | 308 | */ |
306 | status = acpi_ds_load2_begin_op (walk_state, NULL); | 309 | status = acpi_ds_load2_begin_op (walk_state, NULL); |
307 | } | 310 | } |
@@ -338,8 +341,6 @@ acpi_ds_exec_begin_op ( | |||
338 | * FUNCTION: acpi_ds_exec_end_op | 341 | * FUNCTION: acpi_ds_exec_end_op |
339 | * | 342 | * |
340 | * PARAMETERS: walk_state - Current state of the parse tree walk | 343 | * PARAMETERS: walk_state - Current state of the parse tree walk |
341 | * Op - Op that has been just been completed in the | ||
342 | * walk; Arguments have now been evaluated. | ||
343 | * | 344 | * |
344 | * RETURN: Status | 345 | * RETURN: Status |
345 | * | 346 | * |
@@ -389,7 +390,7 @@ acpi_ds_exec_end_op ( | |||
389 | /* Decode the Opcode Class */ | 390 | /* Decode the Opcode Class */ |
390 | 391 | ||
391 | switch (op_class) { | 392 | switch (op_class) { |
392 | case AML_CLASS_ARGUMENT: /* constants, literals, etc. -- do nothing */ | 393 | case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */ |
393 | break; | 394 | break; |
394 | 395 | ||
395 | 396 | ||
@@ -417,12 +418,12 @@ acpi_ds_exec_end_op ( | |||
417 | /* Resolve all operands */ | 418 | /* Resolve all operands */ |
418 | 419 | ||
419 | status = acpi_ex_resolve_operands (walk_state->opcode, | 420 | status = acpi_ex_resolve_operands (walk_state->opcode, |
420 | &(walk_state->operands [walk_state->num_operands -1]), | 421 | &(walk_state->operands [walk_state->num_operands -1]), |
421 | walk_state); | 422 | walk_state); |
422 | if (ACPI_SUCCESS (status)) { | 423 | if (ACPI_SUCCESS (status)) { |
423 | ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | 424 | ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, |
424 | acpi_ps_get_opcode_name (walk_state->opcode), | 425 | acpi_ps_get_opcode_name (walk_state->opcode), |
425 | walk_state->num_operands, "after ex_resolve_operands"); | 426 | walk_state->num_operands, "after ex_resolve_operands"); |
426 | } | 427 | } |
427 | } | 428 | } |
428 | 429 | ||
@@ -506,7 +507,8 @@ acpi_ds_exec_end_op ( | |||
506 | if ((op->asl.parent) && | 507 | if ((op->asl.parent) && |
507 | ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) || | 508 | ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) || |
508 | (op->asl.parent->asl.aml_opcode == AML_VAR_PACKAGE_OP))) { | 509 | (op->asl.parent->asl.aml_opcode == AML_VAR_PACKAGE_OP))) { |
509 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method Reference in a Package, Op=%p\n", op)); | 510 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
511 | "Method Reference in a Package, Op=%p\n", op)); | ||
510 | op->common.node = (struct acpi_namespace_node *) op->asl.value.arg->asl.node->object; | 512 | op->common.node = (struct acpi_namespace_node *) op->asl.value.arg->asl.node->object; |
511 | acpi_ut_add_reference (op->asl.value.arg->asl.node->object); | 513 | acpi_ut_add_reference (op->asl.value.arg->asl.node->object); |
512 | return_ACPI_STATUS (AE_OK); | 514 | return_ACPI_STATUS (AE_OK); |
@@ -583,13 +585,15 @@ acpi_ds_exec_end_op ( | |||
583 | case AML_NAME_OP: | 585 | case AML_NAME_OP: |
584 | 586 | ||
585 | /* | 587 | /* |
586 | * Put the Node on the object stack (Contains the ACPI Name of | 588 | * Put the Node on the object stack (Contains the ACPI Name |
587 | * this object) | 589 | * of this object) |
588 | */ | 590 | */ |
589 | walk_state->operands[0] = (void *) op->common.parent->common.node; | 591 | walk_state->operands[0] = (void *) op->common.parent->common.node; |
590 | walk_state->num_operands = 1; | 592 | walk_state->num_operands = 1; |
591 | 593 | ||
592 | status = acpi_ds_create_node (walk_state, op->common.parent->common.node, op->common.parent); | 594 | status = acpi_ds_create_node (walk_state, |
595 | op->common.parent->common.node, | ||
596 | op->common.parent); | ||
593 | if (ACPI_FAILURE (status)) { | 597 | if (ACPI_FAILURE (status)) { |
594 | break; | 598 | break; |
595 | } | 599 | } |
@@ -600,7 +604,7 @@ acpi_ds_exec_end_op ( | |||
600 | case AML_INT_EVAL_SUBTREE_OP: | 604 | case AML_INT_EVAL_SUBTREE_OP: |
601 | 605 | ||
602 | status = acpi_ds_eval_data_object_operands (walk_state, op, | 606 | status = acpi_ds_eval_data_object_operands (walk_state, op, |
603 | acpi_ns_get_attached_object (op->common.parent->common.node)); | 607 | acpi_ns_get_attached_object (op->common.parent->common.node)); |
604 | break; | 608 | break; |
605 | 609 | ||
606 | default: | 610 | default: |
@@ -609,7 +613,7 @@ acpi_ds_exec_end_op ( | |||
609 | break; | 613 | break; |
610 | } | 614 | } |
611 | 615 | ||
612 | /* Done with this result state (Now that operand stack is built) */ | 616 | /* Done with result state (Now that operand stack is built) */ |
613 | 617 | ||
614 | status = acpi_ds_result_stack_pop (walk_state); | 618 | status = acpi_ds_result_stack_pop (walk_state); |
615 | if (ACPI_FAILURE (status)) { | 619 | if (ACPI_FAILURE (status)) { |
@@ -620,8 +624,7 @@ acpi_ds_exec_end_op ( | |||
620 | * If a result object was returned from above, push it on the | 624 | * If a result object was returned from above, push it on the |
621 | * current result stack | 625 | * current result stack |
622 | */ | 626 | */ |
623 | if (ACPI_SUCCESS (status) && | 627 | if (walk_state->result_obj) { |
624 | walk_state->result_obj) { | ||
625 | status = acpi_ds_result_push (walk_state->result_obj, walk_state); | 628 | status = acpi_ds_result_push (walk_state->result_obj, walk_state); |
626 | } | 629 | } |
627 | break; | 630 | break; |
@@ -654,7 +657,8 @@ acpi_ds_exec_end_op ( | |||
654 | 657 | ||
655 | case AML_TYPE_UNDEFINED: | 658 | case AML_TYPE_UNDEFINED: |
656 | 659 | ||
657 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Undefined opcode type Op=%p\n", op)); | 660 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
661 | "Undefined opcode type Op=%p\n", op)); | ||
658 | return_ACPI_STATUS (AE_NOT_IMPLEMENTED); | 662 | return_ACPI_STATUS (AE_NOT_IMPLEMENTED); |
659 | 663 | ||
660 | 664 | ||
@@ -709,13 +713,14 @@ cleanup: | |||
709 | status = acpi_gbl_exception_handler (status, | 713 | status = acpi_gbl_exception_handler (status, |
710 | walk_state->method_node->name.integer, walk_state->opcode, | 714 | walk_state->method_node->name.integer, walk_state->opcode, |
711 | walk_state->aml_offset, NULL); | 715 | walk_state->aml_offset, NULL); |
712 | acpi_ex_enter_interpreter (); | 716 | (void) acpi_ex_enter_interpreter (); |
713 | } | 717 | } |
714 | 718 | ||
715 | if (walk_state->result_obj) { | 719 | if (walk_state->result_obj) { |
716 | /* Break to debugger to display result */ | 720 | /* Break to debugger to display result */ |
717 | 721 | ||
718 | ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj, walk_state)); | 722 | ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj, |
723 | walk_state)); | ||
719 | 724 | ||
720 | /* | 725 | /* |
721 | * Delete the result op if and only if: | 726 | * Delete the result op if and only if: |
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 06d758679588..1ac197ccfc80 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c | |||
@@ -79,20 +79,23 @@ acpi_ds_init_callbacks ( | |||
79 | 79 | ||
80 | switch (pass_number) { | 80 | switch (pass_number) { |
81 | case 1: | 81 | case 1: |
82 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; | 82 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | |
83 | ACPI_PARSE_DELETE_TREE; | ||
83 | walk_state->descending_callback = acpi_ds_load1_begin_op; | 84 | walk_state->descending_callback = acpi_ds_load1_begin_op; |
84 | walk_state->ascending_callback = acpi_ds_load1_end_op; | 85 | walk_state->ascending_callback = acpi_ds_load1_end_op; |
85 | break; | 86 | break; |
86 | 87 | ||
87 | case 2: | 88 | case 2: |
88 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; | 89 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | |
90 | ACPI_PARSE_DELETE_TREE; | ||
89 | walk_state->descending_callback = acpi_ds_load2_begin_op; | 91 | walk_state->descending_callback = acpi_ds_load2_begin_op; |
90 | walk_state->ascending_callback = acpi_ds_load2_end_op; | 92 | walk_state->ascending_callback = acpi_ds_load2_end_op; |
91 | break; | 93 | break; |
92 | 94 | ||
93 | case 3: | 95 | case 3: |
94 | #ifndef ACPI_NO_METHOD_EXECUTION | 96 | #ifndef ACPI_NO_METHOD_EXECUTION |
95 | walk_state->parse_flags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE; | 97 | walk_state->parse_flags |= ACPI_PARSE_EXECUTE | |
98 | ACPI_PARSE_DELETE_TREE; | ||
96 | walk_state->descending_callback = acpi_ds_exec_begin_op; | 99 | walk_state->descending_callback = acpi_ds_exec_begin_op; |
97 | walk_state->ascending_callback = acpi_ds_exec_end_op; | 100 | walk_state->ascending_callback = acpi_ds_exec_end_op; |
98 | #endif | 101 | #endif |
@@ -111,8 +114,7 @@ acpi_ds_init_callbacks ( | |||
111 | * FUNCTION: acpi_ds_load1_begin_op | 114 | * FUNCTION: acpi_ds_load1_begin_op |
112 | * | 115 | * |
113 | * PARAMETERS: walk_state - Current state of the parse tree walk | 116 | * PARAMETERS: walk_state - Current state of the parse tree walk |
114 | * Op - Op that has been just been reached in the | 117 | * out_op - Where to return op if a new one is created |
115 | * walk; Arguments have not been evaluated yet. | ||
116 | * | 118 | * |
117 | * RETURN: Status | 119 | * RETURN: Status |
118 | * | 120 | * |
@@ -146,7 +148,8 @@ acpi_ds_load1_begin_op ( | |||
146 | #if 0 | 148 | #if 0 |
147 | if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || | 149 | if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || |
148 | (walk_state->op_info->class == AML_CLASS_CONTROL)) { | 150 | (walk_state->op_info->class == AML_CLASS_CONTROL)) { |
149 | acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n", walk_state->op_info->name); | 151 | acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n", |
152 | walk_state->op_info->name); | ||
150 | *out_op = op; | 153 | *out_op = op; |
151 | return (AE_CTRL_SKIP); | 154 | return (AE_CTRL_SKIP); |
152 | } | 155 | } |
@@ -191,7 +194,8 @@ acpi_ds_load1_begin_op ( | |||
191 | */ | 194 | */ |
192 | acpi_dm_add_to_external_list (path); | 195 | acpi_dm_add_to_external_list (path); |
193 | status = acpi_ns_lookup (walk_state->scope_info, path, object_type, | 196 | status = acpi_ns_lookup (walk_state->scope_info, path, object_type, |
194 | ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); | 197 | ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, |
198 | walk_state, &(node)); | ||
195 | } | 199 | } |
196 | #endif | 200 | #endif |
197 | if (ACPI_FAILURE (status)) { | 201 | if (ACPI_FAILURE (status)) { |
@@ -224,10 +228,12 @@ acpi_ds_load1_begin_op ( | |||
224 | * Name (DEB, 0) | 228 | * Name (DEB, 0) |
225 | * Scope (DEB) { ... } | 229 | * Scope (DEB) { ... } |
226 | * | 230 | * |
227 | * Note: silently change the type here. On the second pass, we will report a warning | 231 | * Note: silently change the type here. On the second pass, we will report |
232 | * a warning | ||
228 | */ | 233 | */ |
229 | 234 | ||
230 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | 235 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
236 | "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | ||
231 | path, acpi_ut_get_type_name (node->type))); | 237 | path, acpi_ut_get_type_name (node->type))); |
232 | 238 | ||
233 | node->type = ACPI_TYPE_ANY; | 239 | node->type = ACPI_TYPE_ANY; |
@@ -238,7 +244,8 @@ acpi_ds_load1_begin_op ( | |||
238 | 244 | ||
239 | /* All other types are an error */ | 245 | /* All other types are an error */ |
240 | 246 | ||
241 | ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", | 247 | ACPI_REPORT_ERROR (( |
248 | "Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", | ||
242 | acpi_ut_get_type_name (node->type), path)); | 249 | acpi_ut_get_type_name (node->type), path)); |
243 | 250 | ||
244 | return (AE_AML_OPERAND_TYPE); | 251 | return (AE_AML_OPERAND_TYPE); |
@@ -249,7 +256,8 @@ acpi_ds_load1_begin_op ( | |||
249 | default: | 256 | default: |
250 | 257 | ||
251 | /* | 258 | /* |
252 | * For all other named opcodes, we will enter the name into the namespace. | 259 | * For all other named opcodes, we will enter the name into |
260 | * the namespace. | ||
253 | * | 261 | * |
254 | * Setup the search flags. | 262 | * Setup the search flags. |
255 | * Since we are entering a name into the namespace, we do not want to | 263 | * Since we are entering a name into the namespace, we do not want to |
@@ -279,14 +287,16 @@ acpi_ds_load1_begin_op ( | |||
279 | acpi_ut_get_type_name (object_type))); | 287 | acpi_ut_get_type_name (object_type))); |
280 | } | 288 | } |
281 | else { | 289 | else { |
282 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Both Find or Create allowed\n", | 290 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
291 | "[%s] Both Find or Create allowed\n", | ||
283 | acpi_ut_get_type_name (object_type))); | 292 | acpi_ut_get_type_name (object_type))); |
284 | } | 293 | } |
285 | 294 | ||
286 | /* | 295 | /* |
287 | * Enter the named type into the internal namespace. We enter the name | 296 | * Enter the named type into the internal namespace. We enter the name |
288 | * as we go downward in the parse tree. Any necessary subobjects that involve | 297 | * as we go downward in the parse tree. Any necessary subobjects that |
289 | * arguments to the opcode must be created as we go back up the parse tree later. | 298 | * involve arguments to the opcode must be created as we go back up the |
299 | * parse tree later. | ||
290 | */ | 300 | */ |
291 | status = acpi_ns_lookup (walk_state->scope_info, path, object_type, | 301 | status = acpi_ns_lookup (walk_state->scope_info, path, object_type, |
292 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node)); | 302 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node)); |
@@ -335,8 +345,6 @@ acpi_ds_load1_begin_op ( | |||
335 | * FUNCTION: acpi_ds_load1_end_op | 345 | * FUNCTION: acpi_ds_load1_end_op |
336 | * | 346 | * |
337 | * PARAMETERS: walk_state - Current state of the parse tree walk | 347 | * PARAMETERS: walk_state - Current state of the parse tree walk |
338 | * Op - Op that has been just been completed in the | ||
339 | * walk; Arguments have now been evaluated. | ||
340 | * | 348 | * |
341 | * RETURN: Status | 349 | * RETURN: Status |
342 | * | 350 | * |
@@ -383,7 +391,9 @@ acpi_ds_load1_end_op ( | |||
383 | 391 | ||
384 | if (op->common.aml_opcode == AML_REGION_OP) { | 392 | if (op->common.aml_opcode == AML_REGION_OP) { |
385 | status = acpi_ex_create_region (op->named.data, op->named.length, | 393 | status = acpi_ex_create_region (op->named.data, op->named.length, |
386 | (acpi_adr_space_type) ((op->common.value.arg)->common.value.integer), walk_state); | 394 | (acpi_adr_space_type) |
395 | ((op->common.value.arg)->common.value.integer), | ||
396 | walk_state); | ||
387 | if (ACPI_FAILURE (status)) { | 397 | if (ACPI_FAILURE (status)) { |
388 | return (status); | 398 | return (status); |
389 | } | 399 | } |
@@ -394,7 +404,8 @@ acpi_ds_load1_end_op ( | |||
394 | /* For Name opcode, get the object type from the argument */ | 404 | /* For Name opcode, get the object type from the argument */ |
395 | 405 | ||
396 | if (op->common.value.arg) { | 406 | if (op->common.value.arg) { |
397 | object_type = (acpi_ps_get_opcode_info ((op->common.value.arg)->common.aml_opcode))->object_type; | 407 | object_type = (acpi_ps_get_opcode_info ( |
408 | (op->common.value.arg)->common.aml_opcode))->object_type; | ||
398 | op->common.node->type = (u8) object_type; | 409 | op->common.node->type = (u8) object_type; |
399 | } | 410 | } |
400 | } | 411 | } |
@@ -448,8 +459,7 @@ acpi_ds_load1_end_op ( | |||
448 | * FUNCTION: acpi_ds_load2_begin_op | 459 | * FUNCTION: acpi_ds_load2_begin_op |
449 | * | 460 | * |
450 | * PARAMETERS: walk_state - Current state of the parse tree walk | 461 | * PARAMETERS: walk_state - Current state of the parse tree walk |
451 | * Op - Op that has been just been reached in the | 462 | * out_op - Wher to return op if a new one is created |
452 | * walk; Arguments have not been evaluated yet. | ||
453 | * | 463 | * |
454 | * RETURN: Status | 464 | * RETURN: Status |
455 | * | 465 | * |
@@ -478,14 +488,20 @@ acpi_ds_load2_begin_op ( | |||
478 | if (op) { | 488 | if (op) { |
479 | /* We only care about Namespace opcodes here */ | 489 | /* We only care about Namespace opcodes here */ |
480 | 490 | ||
481 | if ((!(walk_state->op_info->flags & AML_NSOPCODE) && (walk_state->opcode != AML_INT_NAMEPATH_OP)) || | 491 | if ((!(walk_state->op_info->flags & AML_NSOPCODE) && |
492 | (walk_state->opcode != AML_INT_NAMEPATH_OP)) || | ||
482 | (!(walk_state->op_info->flags & AML_NAMED))) { | 493 | (!(walk_state->op_info->flags & AML_NAMED))) { |
494 | if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || | ||
495 | (walk_state->op_info->class == AML_CLASS_CONTROL)) { | ||
496 | ACPI_REPORT_WARNING (( | ||
497 | "Encountered executable code at module level, [%s]\n", | ||
498 | acpi_ps_get_opcode_name (walk_state->opcode))); | ||
499 | } | ||
483 | return_ACPI_STATUS (AE_OK); | 500 | return_ACPI_STATUS (AE_OK); |
484 | } | 501 | } |
485 | 502 | ||
486 | /* | 503 | /* Get the name we are going to enter or lookup in the namespace */ |
487 | * Get the name we are going to enter or lookup in the namespace | 504 | |
488 | */ | ||
489 | if (walk_state->opcode == AML_INT_NAMEPATH_OP) { | 505 | if (walk_state->opcode == AML_INT_NAMEPATH_OP) { |
490 | /* For Namepath op, get the path string */ | 506 | /* For Namepath op, get the path string */ |
491 | 507 | ||
@@ -528,21 +544,25 @@ acpi_ds_load2_begin_op ( | |||
528 | case AML_INT_NAMEPATH_OP: | 544 | case AML_INT_NAMEPATH_OP: |
529 | 545 | ||
530 | /* | 546 | /* |
531 | * The name_path is an object reference to an existing object. Don't enter the | 547 | * The name_path is an object reference to an existing object. |
532 | * name into the namespace, but look it up for use later | 548 | * Don't enter the name into the namespace, but look it up |
549 | * for use later. | ||
533 | */ | 550 | */ |
534 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, | 551 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, |
535 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); | 552 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, |
553 | walk_state, &(node)); | ||
536 | break; | 554 | break; |
537 | 555 | ||
538 | case AML_SCOPE_OP: | 556 | case AML_SCOPE_OP: |
539 | 557 | ||
540 | /* | 558 | /* |
541 | * The Path is an object reference to an existing object. Don't enter the | 559 | * The Path is an object reference to an existing object. |
542 | * name into the namespace, but look it up for use later | 560 | * Don't enter the name into the namespace, but look it up |
561 | * for use later. | ||
543 | */ | 562 | */ |
544 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, | 563 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, |
545 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); | 564 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, |
565 | walk_state, &(node)); | ||
546 | if (ACPI_FAILURE (status)) { | 566 | if (ACPI_FAILURE (status)) { |
547 | #ifdef _ACPI_ASL_COMPILER | 567 | #ifdef _ACPI_ASL_COMPILER |
548 | if (status == AE_NOT_FOUND) { | 568 | if (status == AE_NOT_FOUND) { |
@@ -582,7 +602,8 @@ acpi_ds_load2_begin_op ( | |||
582 | * Scope (DEB) { ... } | 602 | * Scope (DEB) { ... } |
583 | */ | 603 | */ |
584 | 604 | ||
585 | ACPI_REPORT_WARNING (("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | 605 | ACPI_REPORT_WARNING (( |
606 | "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | ||
586 | buffer_ptr, acpi_ut_get_type_name (node->type))); | 607 | buffer_ptr, acpi_ut_get_type_name (node->type))); |
587 | 608 | ||
588 | node->type = ACPI_TYPE_ANY; | 609 | node->type = ACPI_TYPE_ANY; |
@@ -593,7 +614,8 @@ acpi_ds_load2_begin_op ( | |||
593 | 614 | ||
594 | /* All other types are an error */ | 615 | /* All other types are an error */ |
595 | 616 | ||
596 | ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s]\n", | 617 | ACPI_REPORT_ERROR (( |
618 | "Invalid type (%s) for target of Scope operator [%4.4s]\n", | ||
597 | acpi_ut_get_type_name (node->type), buffer_ptr)); | 619 | acpi_ut_get_type_name (node->type), buffer_ptr)); |
598 | 620 | ||
599 | return (AE_AML_OPERAND_TYPE); | 621 | return (AE_AML_OPERAND_TYPE); |
@@ -621,8 +643,9 @@ acpi_ds_load2_begin_op ( | |||
621 | 643 | ||
622 | /* | 644 | /* |
623 | * Enter the named type into the internal namespace. We enter the name | 645 | * Enter the named type into the internal namespace. We enter the name |
624 | * as we go downward in the parse tree. Any necessary subobjects that involve | 646 | * as we go downward in the parse tree. Any necessary subobjects that |
625 | * arguments to the opcode must be created as we go back up the parse tree later. | 647 | * involve arguments to the opcode must be created as we go back up the |
648 | * parse tree later. | ||
626 | * | 649 | * |
627 | * Note: Name may already exist if we are executing a deferred opcode. | 650 | * Note: Name may already exist if we are executing a deferred opcode. |
628 | */ | 651 | */ |
@@ -635,7 +658,8 @@ acpi_ds_load2_begin_op ( | |||
635 | } | 658 | } |
636 | 659 | ||
637 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, | 660 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, |
638 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, walk_state, &(node)); | 661 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, |
662 | walk_state, &(node)); | ||
639 | break; | 663 | break; |
640 | } | 664 | } |
641 | 665 | ||
@@ -678,8 +702,6 @@ acpi_ds_load2_begin_op ( | |||
678 | * FUNCTION: acpi_ds_load2_end_op | 702 | * FUNCTION: acpi_ds_load2_end_op |
679 | * | 703 | * |
680 | * PARAMETERS: walk_state - Current state of the parse tree walk | 704 | * PARAMETERS: walk_state - Current state of the parse tree walk |
681 | * Op - Op that has been just been completed in the | ||
682 | * walk; Arguments have now been evaluated. | ||
683 | * | 705 | * |
684 | * RETURN: Status | 706 | * RETURN: Status |
685 | * | 707 | * |
@@ -738,7 +760,8 @@ acpi_ds_load2_end_op ( | |||
738 | 760 | ||
739 | /* Pop the scope stack */ | 761 | /* Pop the scope stack */ |
740 | 762 | ||
741 | if (acpi_ns_opens_scope (object_type) && (op->common.aml_opcode != AML_INT_METHODCALL_OP)) { | 763 | if (acpi_ns_opens_scope (object_type) && |
764 | (op->common.aml_opcode != AML_INT_METHODCALL_OP)) { | ||
742 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", | 765 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", |
743 | acpi_ut_get_type_name (object_type), op)); | 766 | acpi_ut_get_type_name (object_type), op)); |
744 | 767 | ||
@@ -803,7 +826,7 @@ acpi_ds_load2_end_op ( | |||
803 | case AML_INDEX_FIELD_OP: | 826 | case AML_INDEX_FIELD_OP: |
804 | 827 | ||
805 | status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node, | 828 | status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node, |
806 | walk_state); | 829 | walk_state); |
807 | break; | 830 | break; |
808 | 831 | ||
809 | case AML_BANK_FIELD_OP: | 832 | case AML_BANK_FIELD_OP: |
@@ -884,14 +907,16 @@ acpi_ds_load2_end_op ( | |||
884 | #ifndef ACPI_NO_METHOD_EXECUTION | 907 | #ifndef ACPI_NO_METHOD_EXECUTION |
885 | case AML_REGION_OP: | 908 | case AML_REGION_OP: |
886 | /* | 909 | /* |
887 | * The op_region is not fully parsed at this time. Only valid argument is the space_id. | 910 | * The op_region is not fully parsed at this time. Only valid |
888 | * (We must save the address of the AML of the address and length operands) | 911 | * argument is the space_id. (We must save the address of the |
912 | * AML of the address and length operands) | ||
889 | */ | 913 | */ |
890 | /* | 914 | /* |
891 | * If we have a valid region, initialize it | 915 | * If we have a valid region, initialize it |
892 | * Namespace is NOT locked at this point. | 916 | * Namespace is NOT locked at this point. |
893 | */ | 917 | */ |
894 | status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node), FALSE); | 918 | status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node), |
919 | FALSE); | ||
895 | if (ACPI_FAILURE (status)) { | 920 | if (ACPI_FAILURE (status)) { |
896 | /* | 921 | /* |
897 | * If AE_NOT_EXIST is returned, it is not fatal | 922 | * If AE_NOT_EXIST is returned, it is not fatal |
@@ -942,15 +967,16 @@ acpi_ds_load2_end_op ( | |||
942 | if (ACPI_SUCCESS (status)) { | 967 | if (ACPI_SUCCESS (status)) { |
943 | /* | 968 | /* |
944 | * Make sure that what we found is indeed a method | 969 | * Make sure that what we found is indeed a method |
945 | * We didn't search for a method on purpose, to see if the name would resolve | 970 | * We didn't search for a method on purpose, to see if the name |
971 | * would resolve | ||
946 | */ | 972 | */ |
947 | if (new_node->type != ACPI_TYPE_METHOD) { | 973 | if (new_node->type != ACPI_TYPE_METHOD) { |
948 | status = AE_AML_OPERAND_TYPE; | 974 | status = AE_AML_OPERAND_TYPE; |
949 | } | 975 | } |
950 | 976 | ||
951 | /* We could put the returned object (Node) on the object stack for later, but | 977 | /* We could put the returned object (Node) on the object stack for |
952 | * for now, we will put it in the "op" object that the parser uses, so we | 978 | * later, but for now, we will put it in the "op" object that the |
953 | * can get it again at the end of this scope | 979 | * parser uses, so we can get it again at the end of this scope |
954 | */ | 980 | */ |
955 | op->common.node = new_node; | 981 | op->common.node = new_node; |
956 | } | 982 | } |
diff --git a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/dispatcher/dswscope.c index 65f456151e25..21f4548ff323 100644 --- a/drivers/acpi/dispatcher/dswscope.c +++ b/drivers/acpi/dispatcher/dswscope.c | |||
@@ -50,14 +50,13 @@ | |||
50 | ACPI_MODULE_NAME ("dswscope") | 50 | ACPI_MODULE_NAME ("dswscope") |
51 | 51 | ||
52 | 52 | ||
53 | #define STACK_POP(head) head | ||
54 | |||
55 | |||
56 | /**************************************************************************** | 53 | /**************************************************************************** |
57 | * | 54 | * |
58 | * FUNCTION: acpi_ds_scope_stack_clear | 55 | * FUNCTION: acpi_ds_scope_stack_clear |
59 | * | 56 | * |
60 | * PARAMETERS: None | 57 | * PARAMETERS: walk_state - Current state |
58 | * | ||
59 | * RETURN: None | ||
61 | * | 60 | * |
62 | * DESCRIPTION: Pop (and free) everything on the scope stack except the | 61 | * DESCRIPTION: Pop (and free) everything on the scope stack except the |
63 | * root scope object (which remains at the stack top.) | 62 | * root scope object (which remains at the stack top.) |
@@ -80,7 +79,8 @@ acpi_ds_scope_stack_clear ( | |||
80 | walk_state->scope_info = scope_info->scope.next; | 79 | walk_state->scope_info = scope_info->scope.next; |
81 | 80 | ||
82 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 81 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
83 | "Popped object type (%s)\n", acpi_ut_get_type_name (scope_info->common.value))); | 82 | "Popped object type (%s)\n", |
83 | acpi_ut_get_type_name (scope_info->common.value))); | ||
84 | acpi_ut_delete_generic_state (scope_info); | 84 | acpi_ut_delete_generic_state (scope_info); |
85 | } | 85 | } |
86 | } | 86 | } |
@@ -90,8 +90,11 @@ acpi_ds_scope_stack_clear ( | |||
90 | * | 90 | * |
91 | * FUNCTION: acpi_ds_scope_stack_push | 91 | * FUNCTION: acpi_ds_scope_stack_push |
92 | * | 92 | * |
93 | * PARAMETERS: *Node, - Name to be made current | 93 | * PARAMETERS: Node - Name to be made current |
94 | * Type, - Type of frame being pushed | 94 | * Type - Type of frame being pushed |
95 | * walk_state - Current state | ||
96 | * | ||
97 | * RETURN: Status | ||
95 | * | 98 | * |
96 | * DESCRIPTION: Push the current scope on the scope stack, and make the | 99 | * DESCRIPTION: Push the current scope on the scope stack, and make the |
97 | * passed Node current. | 100 | * passed Node current. |
@@ -121,7 +124,8 @@ acpi_ds_scope_stack_push ( | |||
121 | /* Make sure object type is valid */ | 124 | /* Make sure object type is valid */ |
122 | 125 | ||
123 | if (!acpi_ut_valid_object_type (type)) { | 126 | if (!acpi_ut_valid_object_type (type)) { |
124 | ACPI_REPORT_WARNING (("ds_scope_stack_push: Invalid object type: 0x%X\n", type)); | 127 | ACPI_REPORT_WARNING (( |
128 | "ds_scope_stack_push: Invalid object type: 0x%X\n", type)); | ||
125 | } | 129 | } |
126 | 130 | ||
127 | /* Allocate a new scope object */ | 131 | /* Allocate a new scope object */ |
@@ -170,16 +174,11 @@ acpi_ds_scope_stack_push ( | |||
170 | * | 174 | * |
171 | * FUNCTION: acpi_ds_scope_stack_pop | 175 | * FUNCTION: acpi_ds_scope_stack_pop |
172 | * | 176 | * |
173 | * PARAMETERS: Type - The type of frame to be found | 177 | * PARAMETERS: walk_state - Current state |
174 | * | 178 | * |
175 | * DESCRIPTION: Pop the scope stack until a frame of the requested type | 179 | * RETURN: Status |
176 | * is found. | ||
177 | * | 180 | * |
178 | * RETURN: Count of frames popped. If no frame of the requested type | 181 | * DESCRIPTION: Pop the scope stack once. |
179 | * was found, the count is returned as a negative number and | ||
180 | * the scope stack is emptied (which sets the current scope | ||
181 | * to the root). If the scope stack was empty at entry, the | ||
182 | * function is a no-op and returns 0. | ||
183 | * | 182 | * |
184 | ***************************************************************************/ | 183 | ***************************************************************************/ |
185 | 184 | ||
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index e555b3fbd5e5..9cd3db652b31 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c | |||
@@ -50,67 +50,31 @@ | |||
50 | #define _COMPONENT ACPI_DISPATCHER | 50 | #define _COMPONENT ACPI_DISPATCHER |
51 | ACPI_MODULE_NAME ("dswstate") | 51 | ACPI_MODULE_NAME ("dswstate") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
53 | 54 | ||
54 | #ifdef ACPI_FUTURE_USAGE | 55 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
55 | |||
56 | /******************************************************************************* | ||
57 | * | ||
58 | * FUNCTION: acpi_ds_result_insert | ||
59 | * | ||
60 | * PARAMETERS: Object - Object to push | ||
61 | * Index - Where to insert the object | ||
62 | * walk_state - Current Walk state | ||
63 | * | ||
64 | * RETURN: Status | ||
65 | * | ||
66 | * DESCRIPTION: Insert an object onto this walk's result stack | ||
67 | * | ||
68 | ******************************************************************************/ | ||
69 | |||
70 | acpi_status | 56 | acpi_status |
71 | acpi_ds_result_insert ( | 57 | acpi_ds_result_insert ( |
72 | void *object, | 58 | void *object, |
73 | u32 index, | 59 | u32 index, |
74 | struct acpi_walk_state *walk_state) | 60 | struct acpi_walk_state *walk_state); |
75 | { | ||
76 | union acpi_generic_state *state; | ||
77 | |||
78 | 61 | ||
79 | ACPI_FUNCTION_NAME ("ds_result_insert"); | 62 | acpi_status |
80 | 63 | acpi_ds_obj_stack_delete_all ( | |
81 | 64 | struct acpi_walk_state *walk_state); | |
82 | state = walk_state->results; | ||
83 | if (!state) { | ||
84 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n", | ||
85 | walk_state)); | ||
86 | return (AE_NOT_EXIST); | ||
87 | } | ||
88 | |||
89 | if (index >= ACPI_OBJ_NUM_OPERANDS) { | ||
90 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
91 | "Index out of range: %X Obj=%p State=%p Num=%X\n", | ||
92 | index, object, walk_state, state->results.num_results)); | ||
93 | return (AE_BAD_PARAMETER); | ||
94 | } | ||
95 | |||
96 | if (!object) { | ||
97 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
98 | "Null Object! Index=%X Obj=%p State=%p Num=%X\n", | ||
99 | index, object, walk_state, state->results.num_results)); | ||
100 | return (AE_BAD_PARAMETER); | ||
101 | } | ||
102 | |||
103 | state->results.obj_desc [index] = object; | ||
104 | state->results.num_results++; | ||
105 | 65 | ||
106 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 66 | acpi_status |
107 | "Obj=%p [%s] State=%p Num=%X Cur=%X\n", | 67 | acpi_ds_obj_stack_pop_object ( |
108 | object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL", | 68 | union acpi_operand_object **object, |
109 | walk_state, state->results.num_results, walk_state->current_result)); | 69 | struct acpi_walk_state *walk_state); |
110 | 70 | ||
111 | return (AE_OK); | 71 | void * |
112 | } | 72 | acpi_ds_obj_stack_get_value ( |
73 | u32 index, | ||
74 | struct acpi_walk_state *walk_state); | ||
75 | #endif | ||
113 | 76 | ||
77 | #ifdef ACPI_FUTURE_USAGE | ||
114 | 78 | ||
115 | /******************************************************************************* | 79 | /******************************************************************************* |
116 | * | 80 | * |
@@ -178,7 +142,6 @@ acpi_ds_result_remove ( | |||
178 | 142 | ||
179 | #endif /* ACPI_FUTURE_USAGE */ | 143 | #endif /* ACPI_FUTURE_USAGE */ |
180 | 144 | ||
181 | |||
182 | /******************************************************************************* | 145 | /******************************************************************************* |
183 | * | 146 | * |
184 | * FUNCTION: acpi_ds_result_pop | 147 | * FUNCTION: acpi_ds_result_pop |
@@ -227,15 +190,18 @@ acpi_ds_result_pop ( | |||
227 | *object = state->results.obj_desc [index -1]; | 190 | *object = state->results.obj_desc [index -1]; |
228 | state->results.obj_desc [index -1] = NULL; | 191 | state->results.obj_desc [index -1] = NULL; |
229 | 192 | ||
230 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n", | 193 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
231 | *object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", | 194 | "Obj=%p [%s] Index=%X State=%p Num=%X\n", |
195 | *object, | ||
196 | (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", | ||
232 | (u32) index -1, walk_state, state->results.num_results)); | 197 | (u32) index -1, walk_state, state->results.num_results)); |
233 | 198 | ||
234 | return (AE_OK); | 199 | return (AE_OK); |
235 | } | 200 | } |
236 | } | 201 | } |
237 | 202 | ||
238 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state)); | 203 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
204 | "No result objects! State=%p\n", walk_state)); | ||
239 | return (AE_AML_NO_RETURN_VALUE); | 205 | return (AE_AML_NO_RETURN_VALUE); |
240 | } | 206 | } |
241 | 207 | ||
@@ -274,7 +240,8 @@ acpi_ds_result_pop_from_bottom ( | |||
274 | } | 240 | } |
275 | 241 | ||
276 | if (!state->results.num_results) { | 242 | if (!state->results.num_results) { |
277 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state)); | 243 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", |
244 | walk_state)); | ||
278 | return (AE_AML_NO_RETURN_VALUE); | 245 | return (AE_AML_NO_RETURN_VALUE); |
279 | } | 246 | } |
280 | 247 | ||
@@ -293,7 +260,8 @@ acpi_ds_result_pop_from_bottom ( | |||
293 | /* Check for a valid result object */ | 260 | /* Check for a valid result object */ |
294 | 261 | ||
295 | if (!*object) { | 262 | if (!*object) { |
296 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null operand! State=%p #Ops=%X, Index=%X\n", | 263 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
264 | "Null operand! State=%p #Ops=%X, Index=%X\n", | ||
297 | walk_state, state->results.num_results, (u32) index)); | 265 | walk_state, state->results.num_results, (u32) index)); |
298 | return (AE_AML_NO_RETURN_VALUE); | 266 | return (AE_AML_NO_RETURN_VALUE); |
299 | } | 267 | } |
@@ -344,7 +312,8 @@ acpi_ds_result_push ( | |||
344 | } | 312 | } |
345 | 313 | ||
346 | if (!object) { | 314 | if (!object) { |
347 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Object! Obj=%p State=%p Num=%X\n", | 315 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
316 | "Null Object! Obj=%p State=%p Num=%X\n", | ||
348 | object, walk_state, state->results.num_results)); | 317 | object, walk_state, state->results.num_results)); |
349 | return (AE_BAD_PARAMETER); | 318 | return (AE_BAD_PARAMETER); |
350 | } | 319 | } |
@@ -439,43 +408,6 @@ acpi_ds_result_stack_pop ( | |||
439 | 408 | ||
440 | /******************************************************************************* | 409 | /******************************************************************************* |
441 | * | 410 | * |
442 | * FUNCTION: acpi_ds_obj_stack_delete_all | ||
443 | * | ||
444 | * PARAMETERS: walk_state - Current Walk state | ||
445 | * | ||
446 | * RETURN: Status | ||
447 | * | ||
448 | * DESCRIPTION: Clear the object stack by deleting all objects that are on it. | ||
449 | * Should be used with great care, if at all! | ||
450 | * | ||
451 | ******************************************************************************/ | ||
452 | #ifdef ACPI_FUTURE_USAGE | ||
453 | acpi_status | ||
454 | acpi_ds_obj_stack_delete_all ( | ||
455 | struct acpi_walk_state *walk_state) | ||
456 | { | ||
457 | u32 i; | ||
458 | |||
459 | |||
460 | ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_delete_all", walk_state); | ||
461 | |||
462 | |||
463 | /* The stack size is configurable, but fixed */ | ||
464 | |||
465 | for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) { | ||
466 | if (walk_state->operands[i]) { | ||
467 | acpi_ut_remove_reference (walk_state->operands[i]); | ||
468 | walk_state->operands[i] = NULL; | ||
469 | } | ||
470 | } | ||
471 | |||
472 | return_ACPI_STATUS (AE_OK); | ||
473 | } | ||
474 | #endif /* ACPI_FUTURE_USAGE */ | ||
475 | |||
476 | |||
477 | /******************************************************************************* | ||
478 | * | ||
479 | * FUNCTION: acpi_ds_obj_stack_push | 411 | * FUNCTION: acpi_ds_obj_stack_push |
480 | * | 412 | * |
481 | * PARAMETERS: Object - Object to push | 413 | * PARAMETERS: Object - Object to push |
@@ -517,67 +449,6 @@ acpi_ds_obj_stack_push ( | |||
517 | } | 449 | } |
518 | 450 | ||
519 | 451 | ||
520 | #if 0 | ||
521 | /******************************************************************************* | ||
522 | * | ||
523 | * FUNCTION: acpi_ds_obj_stack_pop_object | ||
524 | * | ||
525 | * PARAMETERS: pop_count - Number of objects/entries to pop | ||
526 | * walk_state - Current Walk state | ||
527 | * | ||
528 | * RETURN: Status | ||
529 | * | ||
530 | * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT | ||
531 | * deleted by this routine. | ||
532 | * | ||
533 | ******************************************************************************/ | ||
534 | |||
535 | acpi_status | ||
536 | acpi_ds_obj_stack_pop_object ( | ||
537 | union acpi_operand_object **object, | ||
538 | struct acpi_walk_state *walk_state) | ||
539 | { | ||
540 | ACPI_FUNCTION_NAME ("ds_obj_stack_pop_object"); | ||
541 | |||
542 | |||
543 | /* Check for stack underflow */ | ||
544 | |||
545 | if (walk_state->num_operands == 0) { | ||
546 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
547 | "Missing operand/stack empty! State=%p #Ops=%X\n", | ||
548 | walk_state, walk_state->num_operands)); | ||
549 | *object = NULL; | ||
550 | return (AE_AML_NO_OPERAND); | ||
551 | } | ||
552 | |||
553 | /* Pop the stack */ | ||
554 | |||
555 | walk_state->num_operands--; | ||
556 | |||
557 | /* Check for a valid operand */ | ||
558 | |||
559 | if (!walk_state->operands [walk_state->num_operands]) { | ||
560 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
561 | "Null operand! State=%p #Ops=%X\n", | ||
562 | walk_state, walk_state->num_operands)); | ||
563 | *object = NULL; | ||
564 | return (AE_AML_NO_OPERAND); | ||
565 | } | ||
566 | |||
567 | /* Get operand and set stack entry to null */ | ||
568 | |||
569 | *object = walk_state->operands [walk_state->num_operands]; | ||
570 | walk_state->operands [walk_state->num_operands] = NULL; | ||
571 | |||
572 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", | ||
573 | *object, acpi_ut_get_object_type_name (*object), | ||
574 | walk_state, walk_state->num_operands)); | ||
575 | |||
576 | return (AE_OK); | ||
577 | } | ||
578 | #endif | ||
579 | |||
580 | |||
581 | /******************************************************************************* | 452 | /******************************************************************************* |
582 | * | 453 | * |
583 | * FUNCTION: acpi_ds_obj_stack_pop | 454 | * FUNCTION: acpi_ds_obj_stack_pop |
@@ -680,48 +551,6 @@ acpi_ds_obj_stack_pop_and_delete ( | |||
680 | 551 | ||
681 | /******************************************************************************* | 552 | /******************************************************************************* |
682 | * | 553 | * |
683 | * FUNCTION: acpi_ds_obj_stack_get_value | ||
684 | * | ||
685 | * PARAMETERS: Index - Stack index whose value is desired. Based | ||
686 | * on the top of the stack (index=0 == top) | ||
687 | * walk_state - Current Walk state | ||
688 | * | ||
689 | * RETURN: Status | ||
690 | * | ||
691 | * DESCRIPTION: Retrieve an object from this walk's object stack. Index must | ||
692 | * be within the range of the current stack pointer. | ||
693 | * | ||
694 | ******************************************************************************/ | ||
695 | #ifdef ACPI_FUTURE_USAGE | ||
696 | void * | ||
697 | acpi_ds_obj_stack_get_value ( | ||
698 | u32 index, | ||
699 | struct acpi_walk_state *walk_state) | ||
700 | { | ||
701 | |||
702 | ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_get_value", walk_state); | ||
703 | |||
704 | |||
705 | /* Can't do it if the stack is empty */ | ||
706 | |||
707 | if (walk_state->num_operands == 0) { | ||
708 | return_PTR (NULL); | ||
709 | } | ||
710 | |||
711 | /* or if the index is past the top of the stack */ | ||
712 | |||
713 | if (index > (walk_state->num_operands - (u32) 1)) { | ||
714 | return_PTR (NULL); | ||
715 | } | ||
716 | |||
717 | return_PTR (walk_state->operands[(acpi_native_uint)(walk_state->num_operands - 1) - | ||
718 | index]); | ||
719 | } | ||
720 | #endif /* ACPI_FUTURE_USAGE */ | ||
721 | |||
722 | |||
723 | /******************************************************************************* | ||
724 | * | ||
725 | * FUNCTION: acpi_ds_get_current_walk_state | 554 | * FUNCTION: acpi_ds_get_current_walk_state |
726 | * | 555 | * |
727 | * PARAMETERS: Thread - Get current active state for this Thread | 556 | * PARAMETERS: Thread - Get current active state for this Thread |
@@ -757,11 +586,11 @@ acpi_ds_get_current_walk_state ( | |||
757 | * FUNCTION: acpi_ds_push_walk_state | 586 | * FUNCTION: acpi_ds_push_walk_state |
758 | * | 587 | * |
759 | * PARAMETERS: walk_state - State to push | 588 | * PARAMETERS: walk_state - State to push |
760 | * walk_list - The list that owns the walk stack | 589 | * Thread - Thread state object |
761 | * | 590 | * |
762 | * RETURN: None | 591 | * RETURN: None |
763 | * | 592 | * |
764 | * DESCRIPTION: Place the walk_state at the head of the state list. | 593 | * DESCRIPTION: Place the Thread state at the head of the state list. |
765 | * | 594 | * |
766 | ******************************************************************************/ | 595 | ******************************************************************************/ |
767 | 596 | ||
@@ -784,9 +613,9 @@ acpi_ds_push_walk_state ( | |||
784 | * | 613 | * |
785 | * FUNCTION: acpi_ds_pop_walk_state | 614 | * FUNCTION: acpi_ds_pop_walk_state |
786 | * | 615 | * |
787 | * PARAMETERS: walk_list - The list that owns the walk stack | 616 | * PARAMETERS: Thread - Current thread state |
788 | * | 617 | * |
789 | * RETURN: A walk_state object popped from the stack | 618 | * RETURN: A walk_state object popped from the thread's stack |
790 | * | 619 | * |
791 | * DESCRIPTION: Remove and return the walkstate object that is at the head of | 620 | * DESCRIPTION: Remove and return the walkstate object that is at the head of |
792 | * the walk stack for the given walk list. NULL indicates that | 621 | * the walk stack for the given walk list. NULL indicates that |
@@ -814,7 +643,7 @@ acpi_ds_pop_walk_state ( | |||
814 | /* | 643 | /* |
815 | * Don't clear the NEXT field, this serves as an indicator | 644 | * Don't clear the NEXT field, this serves as an indicator |
816 | * that there is a parent WALK STATE | 645 | * that there is a parent WALK STATE |
817 | * NO: walk_state->Next = NULL; | 646 | * Do Not: walk_state->Next = NULL; |
818 | */ | 647 | */ |
819 | } | 648 | } |
820 | 649 | ||
@@ -826,7 +655,9 @@ acpi_ds_pop_walk_state ( | |||
826 | * | 655 | * |
827 | * FUNCTION: acpi_ds_create_walk_state | 656 | * FUNCTION: acpi_ds_create_walk_state |
828 | * | 657 | * |
829 | * PARAMETERS: Origin - Starting point for this walk | 658 | * PARAMETERS: owner_id - ID for object creation |
659 | * Origin - Starting point for this walk | ||
660 | * mth_desc - Method object | ||
830 | * Thread - Current thread state | 661 | * Thread - Current thread state |
831 | * | 662 | * |
832 | * RETURN: Pointer to the new walk state. | 663 | * RETURN: Pointer to the new walk state. |
@@ -896,8 +727,7 @@ acpi_ds_create_walk_state ( | |||
896 | * method_node - Control method NS node, if any | 727 | * method_node - Control method NS node, if any |
897 | * aml_start - Start of AML | 728 | * aml_start - Start of AML |
898 | * aml_length - Length of AML | 729 | * aml_length - Length of AML |
899 | * Params - Method args, if any | 730 | * Info - Method info block (params, etc.) |
900 | * return_obj_desc - Where to store a return object, if any | ||
901 | * pass_number - 1, 2, or 3 | 731 | * pass_number - 1, 2, or 3 |
902 | * | 732 | * |
903 | * RETURN: Status | 733 | * RETURN: Status |
@@ -931,7 +761,7 @@ acpi_ds_init_aml_walk ( | |||
931 | 761 | ||
932 | /* The next_op of the next_walk will be the beginning of the method */ | 762 | /* The next_op of the next_walk will be the beginning of the method */ |
933 | 763 | ||
934 | walk_state->next_op = NULL; | 764 | walk_state->next_op = NULL; |
935 | 765 | ||
936 | if (info) { | 766 | if (info) { |
937 | if (info->parameter_type == ACPI_PARAM_GPE) { | 767 | if (info->parameter_type == ACPI_PARAM_GPE) { |
@@ -939,8 +769,8 @@ acpi_ds_init_aml_walk ( | |||
939 | info->parameters); | 769 | info->parameters); |
940 | } | 770 | } |
941 | else { | 771 | else { |
942 | walk_state->params = info->parameters; | 772 | walk_state->params = info->parameters; |
943 | walk_state->caller_return_desc = &info->return_object; | 773 | walk_state->caller_return_desc = &info->return_object; |
944 | } | 774 | } |
945 | } | 775 | } |
946 | 776 | ||
@@ -964,7 +794,8 @@ acpi_ds_init_aml_walk ( | |||
964 | 794 | ||
965 | /* Init the method arguments */ | 795 | /* Init the method arguments */ |
966 | 796 | ||
967 | status = acpi_ds_method_data_init_args (walk_state->params, ACPI_METHOD_NUM_ARGS, walk_state); | 797 | status = acpi_ds_method_data_init_args (walk_state->params, |
798 | ACPI_METHOD_NUM_ARGS, walk_state); | ||
968 | if (ACPI_FAILURE (status)) { | 799 | if (ACPI_FAILURE (status)) { |
969 | return_ACPI_STATUS (status); | 800 | return_ACPI_STATUS (status); |
970 | } | 801 | } |
@@ -1031,12 +862,14 @@ acpi_ds_delete_walk_state ( | |||
1031 | } | 862 | } |
1032 | 863 | ||
1033 | if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { | 864 | if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { |
1034 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n", walk_state)); | 865 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n", |
866 | walk_state)); | ||
1035 | return; | 867 | return; |
1036 | } | 868 | } |
1037 | 869 | ||
1038 | if (walk_state->parser_state.scope) { | 870 | if (walk_state->parser_state.scope) { |
1039 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", walk_state)); | 871 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", |
872 | walk_state)); | ||
1040 | } | 873 | } |
1041 | 874 | ||
1042 | /* Always must free any linked control states */ | 875 | /* Always must free any linked control states */ |
@@ -1078,7 +911,7 @@ acpi_ds_delete_walk_state ( | |||
1078 | * | 911 | * |
1079 | * PARAMETERS: None | 912 | * PARAMETERS: None |
1080 | * | 913 | * |
1081 | * RETURN: Status | 914 | * RETURN: None |
1082 | * | 915 | * |
1083 | * DESCRIPTION: Purge the global state object cache. Used during subsystem | 916 | * DESCRIPTION: Purge the global state object cache. Used during subsystem |
1084 | * termination. | 917 | * termination. |
@@ -1098,3 +931,200 @@ acpi_ds_delete_walk_state_cache ( | |||
1098 | #endif | 931 | #endif |
1099 | 932 | ||
1100 | 933 | ||
934 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
935 | /******************************************************************************* | ||
936 | * | ||
937 | * FUNCTION: acpi_ds_result_insert | ||
938 | * | ||
939 | * PARAMETERS: Object - Object to push | ||
940 | * Index - Where to insert the object | ||
941 | * walk_state - Current Walk state | ||
942 | * | ||
943 | * RETURN: Status | ||
944 | * | ||
945 | * DESCRIPTION: Insert an object onto this walk's result stack | ||
946 | * | ||
947 | ******************************************************************************/ | ||
948 | |||
949 | acpi_status | ||
950 | acpi_ds_result_insert ( | ||
951 | void *object, | ||
952 | u32 index, | ||
953 | struct acpi_walk_state *walk_state) | ||
954 | { | ||
955 | union acpi_generic_state *state; | ||
956 | |||
957 | |||
958 | ACPI_FUNCTION_NAME ("ds_result_insert"); | ||
959 | |||
960 | |||
961 | state = walk_state->results; | ||
962 | if (!state) { | ||
963 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n", | ||
964 | walk_state)); | ||
965 | return (AE_NOT_EXIST); | ||
966 | } | ||
967 | |||
968 | if (index >= ACPI_OBJ_NUM_OPERANDS) { | ||
969 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
970 | "Index out of range: %X Obj=%p State=%p Num=%X\n", | ||
971 | index, object, walk_state, state->results.num_results)); | ||
972 | return (AE_BAD_PARAMETER); | ||
973 | } | ||
974 | |||
975 | if (!object) { | ||
976 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
977 | "Null Object! Index=%X Obj=%p State=%p Num=%X\n", | ||
978 | index, object, walk_state, state->results.num_results)); | ||
979 | return (AE_BAD_PARAMETER); | ||
980 | } | ||
981 | |||
982 | state->results.obj_desc [index] = object; | ||
983 | state->results.num_results++; | ||
984 | |||
985 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | ||
986 | "Obj=%p [%s] State=%p Num=%X Cur=%X\n", | ||
987 | object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL", | ||
988 | walk_state, state->results.num_results, walk_state->current_result)); | ||
989 | |||
990 | return (AE_OK); | ||
991 | } | ||
992 | |||
993 | |||
994 | /******************************************************************************* | ||
995 | * | ||
996 | * FUNCTION: acpi_ds_obj_stack_delete_all | ||
997 | * | ||
998 | * PARAMETERS: walk_state - Current Walk state | ||
999 | * | ||
1000 | * RETURN: Status | ||
1001 | * | ||
1002 | * DESCRIPTION: Clear the object stack by deleting all objects that are on it. | ||
1003 | * Should be used with great care, if at all! | ||
1004 | * | ||
1005 | ******************************************************************************/ | ||
1006 | |||
1007 | acpi_status | ||
1008 | acpi_ds_obj_stack_delete_all ( | ||
1009 | struct acpi_walk_state *walk_state) | ||
1010 | { | ||
1011 | u32 i; | ||
1012 | |||
1013 | |||
1014 | ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_delete_all", walk_state); | ||
1015 | |||
1016 | |||
1017 | /* The stack size is configurable, but fixed */ | ||
1018 | |||
1019 | for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) { | ||
1020 | if (walk_state->operands[i]) { | ||
1021 | acpi_ut_remove_reference (walk_state->operands[i]); | ||
1022 | walk_state->operands[i] = NULL; | ||
1023 | } | ||
1024 | } | ||
1025 | |||
1026 | return_ACPI_STATUS (AE_OK); | ||
1027 | } | ||
1028 | |||
1029 | |||
1030 | /******************************************************************************* | ||
1031 | * | ||
1032 | * FUNCTION: acpi_ds_obj_stack_pop_object | ||
1033 | * | ||
1034 | * PARAMETERS: Object - Where to return the popped object | ||
1035 | * walk_state - Current Walk state | ||
1036 | * | ||
1037 | * RETURN: Status | ||
1038 | * | ||
1039 | * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT | ||
1040 | * deleted by this routine. | ||
1041 | * | ||
1042 | ******************************************************************************/ | ||
1043 | |||
1044 | acpi_status | ||
1045 | acpi_ds_obj_stack_pop_object ( | ||
1046 | union acpi_operand_object **object, | ||
1047 | struct acpi_walk_state *walk_state) | ||
1048 | { | ||
1049 | ACPI_FUNCTION_NAME ("ds_obj_stack_pop_object"); | ||
1050 | |||
1051 | |||
1052 | /* Check for stack underflow */ | ||
1053 | |||
1054 | if (walk_state->num_operands == 0) { | ||
1055 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
1056 | "Missing operand/stack empty! State=%p #Ops=%X\n", | ||
1057 | walk_state, walk_state->num_operands)); | ||
1058 | *object = NULL; | ||
1059 | return (AE_AML_NO_OPERAND); | ||
1060 | } | ||
1061 | |||
1062 | /* Pop the stack */ | ||
1063 | |||
1064 | walk_state->num_operands--; | ||
1065 | |||
1066 | /* Check for a valid operand */ | ||
1067 | |||
1068 | if (!walk_state->operands [walk_state->num_operands]) { | ||
1069 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
1070 | "Null operand! State=%p #Ops=%X\n", | ||
1071 | walk_state, walk_state->num_operands)); | ||
1072 | *object = NULL; | ||
1073 | return (AE_AML_NO_OPERAND); | ||
1074 | } | ||
1075 | |||
1076 | /* Get operand and set stack entry to null */ | ||
1077 | |||
1078 | *object = walk_state->operands [walk_state->num_operands]; | ||
1079 | walk_state->operands [walk_state->num_operands] = NULL; | ||
1080 | |||
1081 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", | ||
1082 | *object, acpi_ut_get_object_type_name (*object), | ||
1083 | walk_state, walk_state->num_operands)); | ||
1084 | |||
1085 | return (AE_OK); | ||
1086 | } | ||
1087 | |||
1088 | |||
1089 | /******************************************************************************* | ||
1090 | * | ||
1091 | * FUNCTION: acpi_ds_obj_stack_get_value | ||
1092 | * | ||
1093 | * PARAMETERS: Index - Stack index whose value is desired. Based | ||
1094 | * on the top of the stack (index=0 == top) | ||
1095 | * walk_state - Current Walk state | ||
1096 | * | ||
1097 | * RETURN: Pointer to the requested operand | ||
1098 | * | ||
1099 | * DESCRIPTION: Retrieve an object from this walk's operand stack. Index must | ||
1100 | * be within the range of the current stack pointer. | ||
1101 | * | ||
1102 | ******************************************************************************/ | ||
1103 | |||
1104 | void * | ||
1105 | acpi_ds_obj_stack_get_value ( | ||
1106 | u32 index, | ||
1107 | struct acpi_walk_state *walk_state) | ||
1108 | { | ||
1109 | |||
1110 | ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_get_value", walk_state); | ||
1111 | |||
1112 | |||
1113 | /* Can't do it if the stack is empty */ | ||
1114 | |||
1115 | if (walk_state->num_operands == 0) { | ||
1116 | return_PTR (NULL); | ||
1117 | } | ||
1118 | |||
1119 | /* or if the index is past the top of the stack */ | ||
1120 | |||
1121 | if (index > (walk_state->num_operands - (u32) 1)) { | ||
1122 | return_PTR (NULL); | ||
1123 | } | ||
1124 | |||
1125 | return_PTR (walk_state->operands[(acpi_native_uint)(walk_state->num_operands - 1) - | ||
1126 | index]); | ||
1127 | } | ||
1128 | #endif | ||
1129 | |||
1130 | |||
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index fdf143b405be..8e665f2e3138 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/proc_fs.h> | 32 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
34 | #include <linux/interrupt.h> | ||
34 | #include <asm/io.h> | 35 | #include <asm/io.h> |
35 | #include <acpi/acpi_bus.h> | 36 | #include <acpi/acpi_bus.h> |
36 | #include <acpi/acpi_drivers.h> | 37 | #include <acpi/acpi_drivers.h> |
@@ -49,17 +50,19 @@ ACPI_MODULE_NAME ("acpi_ec") | |||
49 | 50 | ||
50 | #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ | 51 | #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ |
51 | #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ | 52 | #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ |
53 | #define ACPI_EC_FLAG_BURST 0x10 /* burst mode */ | ||
52 | #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ | 54 | #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ |
53 | 55 | ||
54 | #define ACPI_EC_EVENT_OBF 0x01 /* Output buffer full */ | 56 | #define ACPI_EC_EVENT_OBF 0x01 /* Output buffer full */ |
55 | #define ACPI_EC_EVENT_IBE 0x02 /* Input buffer empty */ | 57 | #define ACPI_EC_EVENT_IBE 0x02 /* Input buffer empty */ |
56 | 58 | ||
57 | #define ACPI_EC_UDELAY 100 /* Poll @ 100us increments */ | 59 | #define ACPI_EC_DELAY 50 /* Wait 50ms max. during EC ops */ |
58 | #define ACPI_EC_UDELAY_COUNT 1000 /* Wait 10ms max. during EC ops */ | ||
59 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ | 60 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ |
60 | 61 | ||
61 | #define ACPI_EC_COMMAND_READ 0x80 | 62 | #define ACPI_EC_COMMAND_READ 0x80 |
62 | #define ACPI_EC_COMMAND_WRITE 0x81 | 63 | #define ACPI_EC_COMMAND_WRITE 0x81 |
64 | #define ACPI_EC_BURST_ENABLE 0x82 | ||
65 | #define ACPI_EC_BURST_DISABLE 0x83 | ||
63 | #define ACPI_EC_COMMAND_QUERY 0x84 | 66 | #define ACPI_EC_COMMAND_QUERY 0x84 |
64 | 67 | ||
65 | static int acpi_ec_add (struct acpi_device *device); | 68 | static int acpi_ec_add (struct acpi_device *device); |
@@ -87,7 +90,11 @@ struct acpi_ec { | |||
87 | struct acpi_generic_address command_addr; | 90 | struct acpi_generic_address command_addr; |
88 | struct acpi_generic_address data_addr; | 91 | struct acpi_generic_address data_addr; |
89 | unsigned long global_lock; | 92 | unsigned long global_lock; |
90 | spinlock_t lock; | 93 | unsigned int expect_event; |
94 | atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort*/ | ||
95 | atomic_t pending_gpe; | ||
96 | struct semaphore sem; | ||
97 | wait_queue_head_t wait; | ||
91 | }; | 98 | }; |
92 | 99 | ||
93 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ | 100 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ |
@@ -100,42 +107,122 @@ static struct acpi_device *first_ec; | |||
100 | Transaction Management | 107 | Transaction Management |
101 | -------------------------------------------------------------------------- */ | 108 | -------------------------------------------------------------------------- */ |
102 | 109 | ||
103 | static int | 110 | static inline u32 acpi_ec_read_status(struct acpi_ec *ec) |
104 | acpi_ec_wait ( | ||
105 | struct acpi_ec *ec, | ||
106 | u8 event) | ||
107 | { | 111 | { |
108 | u32 acpi_ec_status = 0; | 112 | u32 status = 0; |
109 | u32 i = ACPI_EC_UDELAY_COUNT; | ||
110 | 113 | ||
111 | if (!ec) | 114 | acpi_hw_low_level_read(8, &status, &ec->status_addr); |
112 | return -EINVAL; | 115 | return status; |
116 | } | ||
117 | |||
118 | static int acpi_ec_wait(struct acpi_ec *ec, unsigned int event) | ||
119 | { | ||
120 | int result = 0; | ||
121 | |||
122 | ACPI_FUNCTION_TRACE("acpi_ec_wait"); | ||
113 | 123 | ||
114 | /* Poll the EC status register waiting for the event to occur. */ | 124 | ec->expect_event = event; |
125 | smp_mb(); | ||
126 | |||
127 | result = wait_event_interruptible_timeout(ec->wait, | ||
128 | !ec->expect_event, | ||
129 | msecs_to_jiffies(ACPI_EC_DELAY)); | ||
130 | |||
131 | ec->expect_event = 0; | ||
132 | smp_mb(); | ||
133 | |||
134 | if (result < 0){ | ||
135 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR," result = %d ", result)); | ||
136 | return_VALUE(result); | ||
137 | } | ||
138 | |||
139 | /* | ||
140 | * Verify that the event in question has actually happened by | ||
141 | * querying EC status. Do the check even if operation timed-out | ||
142 | * to make sure that we did not miss interrupt. | ||
143 | */ | ||
115 | switch (event) { | 144 | switch (event) { |
116 | case ACPI_EC_EVENT_OBF: | 145 | case ACPI_EC_EVENT_OBF: |
117 | do { | 146 | if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_OBF) |
118 | acpi_hw_low_level_read(8, &acpi_ec_status, &ec->status_addr); | 147 | return_VALUE(0); |
119 | if (acpi_ec_status & ACPI_EC_FLAG_OBF) | ||
120 | return 0; | ||
121 | udelay(ACPI_EC_UDELAY); | ||
122 | } while (--i>0); | ||
123 | break; | 148 | break; |
149 | |||
124 | case ACPI_EC_EVENT_IBE: | 150 | case ACPI_EC_EVENT_IBE: |
125 | do { | 151 | if (~acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) |
126 | acpi_hw_low_level_read(8, &acpi_ec_status, &ec->status_addr); | 152 | return_VALUE(0); |
127 | if (!(acpi_ec_status & ACPI_EC_FLAG_IBF)) | ||
128 | return 0; | ||
129 | udelay(ACPI_EC_UDELAY); | ||
130 | } while (--i>0); | ||
131 | break; | 153 | break; |
132 | default: | ||
133 | return -EINVAL; | ||
134 | } | 154 | } |
135 | 155 | ||
136 | return -ETIME; | 156 | return_VALUE(-ETIME); |
157 | } | ||
158 | |||
159 | |||
160 | |||
161 | static int | ||
162 | acpi_ec_enter_burst_mode ( | ||
163 | struct acpi_ec *ec) | ||
164 | { | ||
165 | u32 tmp = 0; | ||
166 | int status = 0; | ||
167 | |||
168 | ACPI_FUNCTION_TRACE("acpi_ec_enter_burst_mode"); | ||
169 | |||
170 | status = acpi_ec_read_status(ec); | ||
171 | if (status != -EINVAL && | ||
172 | !(status & ACPI_EC_FLAG_BURST)){ | ||
173 | ACPI_DEBUG_PRINT((ACPI_DB_INFO,"entering burst mode \n")); | ||
174 | acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->command_addr); | ||
175 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | ||
176 | if (status){ | ||
177 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | ||
178 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR," status = %d\n", status)); | ||
179 | return_VALUE(-EINVAL); | ||
180 | } | ||
181 | acpi_hw_low_level_read(8, &tmp, &ec->data_addr); | ||
182 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | ||
183 | if(tmp != 0x90 ) {/* Burst ACK byte*/ | ||
184 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"Ack failed \n")); | ||
185 | return_VALUE(-EINVAL); | ||
186 | } | ||
187 | } else | ||
188 | ACPI_DEBUG_PRINT((ACPI_DB_INFO,"already be in burst mode \n")); | ||
189 | atomic_set(&ec->leaving_burst , 0); | ||
190 | return_VALUE(0); | ||
137 | } | 191 | } |
138 | 192 | ||
193 | static int | ||
194 | acpi_ec_leave_burst_mode ( | ||
195 | struct acpi_ec *ec) | ||
196 | { | ||
197 | int status =0; | ||
198 | |||
199 | ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode"); | ||
200 | |||
201 | atomic_set(&ec->leaving_burst , 1); | ||
202 | status = acpi_ec_read_status(ec); | ||
203 | if (status != -EINVAL && | ||
204 | (status & ACPI_EC_FLAG_BURST)){ | ||
205 | ACPI_DEBUG_PRINT((ACPI_DB_INFO,"leaving burst mode\n")); | ||
206 | acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->command_addr); | ||
207 | status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); | ||
208 | if (status){ | ||
209 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | ||
210 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"------->wait fail\n")); | ||
211 | return_VALUE(-EINVAL); | ||
212 | } | ||
213 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | ||
214 | status = acpi_ec_read_status(ec); | ||
215 | if (status != -EINVAL && | ||
216 | (status & ACPI_EC_FLAG_BURST)) { | ||
217 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"------->status fail\n")); | ||
218 | return_VALUE(-EINVAL); | ||
219 | } | ||
220 | }else | ||
221 | ACPI_DEBUG_PRINT((ACPI_DB_INFO,"already be in Non-burst mode \n")); | ||
222 | ACPI_DEBUG_PRINT((ACPI_DB_INFO,"leaving burst mode\n")); | ||
223 | |||
224 | return_VALUE(0); | ||
225 | } | ||
139 | 226 | ||
140 | static int | 227 | static int |
141 | acpi_ec_read ( | 228 | acpi_ec_read ( |
@@ -143,16 +230,15 @@ acpi_ec_read ( | |||
143 | u8 address, | 230 | u8 address, |
144 | u32 *data) | 231 | u32 *data) |
145 | { | 232 | { |
146 | acpi_status status = AE_OK; | 233 | int status = 0; |
147 | int result = 0; | 234 | u32 glk; |
148 | unsigned long flags = 0; | ||
149 | u32 glk = 0; | ||
150 | 235 | ||
151 | ACPI_FUNCTION_TRACE("acpi_ec_read"); | 236 | ACPI_FUNCTION_TRACE("acpi_ec_read"); |
152 | 237 | ||
153 | if (!ec || !data) | 238 | if (!ec || !data) |
154 | return_VALUE(-EINVAL); | 239 | return_VALUE(-EINVAL); |
155 | 240 | ||
241 | retry: | ||
156 | *data = 0; | 242 | *data = 0; |
157 | 243 | ||
158 | if (ec->global_lock) { | 244 | if (ec->global_lock) { |
@@ -160,32 +246,50 @@ acpi_ec_read ( | |||
160 | if (ACPI_FAILURE(status)) | 246 | if (ACPI_FAILURE(status)) |
161 | return_VALUE(-ENODEV); | 247 | return_VALUE(-ENODEV); |
162 | } | 248 | } |
163 | 249 | ||
164 | spin_lock_irqsave(&ec->lock, flags); | 250 | WARN_ON(in_interrupt()); |
251 | down(&ec->sem); | ||
252 | |||
253 | if(acpi_ec_enter_burst_mode(ec)) | ||
254 | goto end; | ||
165 | 255 | ||
166 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->command_addr); | 256 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->command_addr); |
167 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 257 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
168 | if (result) | 258 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); |
259 | if (status) { | ||
169 | goto end; | 260 | goto end; |
261 | } | ||
170 | 262 | ||
171 | acpi_hw_low_level_write(8, address, &ec->data_addr); | 263 | acpi_hw_low_level_write(8, address, &ec->data_addr); |
172 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | 264 | status= acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); |
173 | if (result) | 265 | if (status){ |
266 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | ||
174 | goto end; | 267 | goto end; |
175 | 268 | } | |
176 | 269 | ||
177 | acpi_hw_low_level_read(8, data, &ec->data_addr); | 270 | acpi_hw_low_level_read(8, data, &ec->data_addr); |
271 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | ||
178 | 272 | ||
179 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n", | 273 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n", |
180 | *data, address)); | 274 | *data, address)); |
181 | 275 | ||
182 | end: | 276 | end: |
183 | spin_unlock_irqrestore(&ec->lock, flags); | 277 | acpi_ec_leave_burst_mode(ec); |
278 | up(&ec->sem); | ||
184 | 279 | ||
185 | if (ec->global_lock) | 280 | if (ec->global_lock) |
186 | acpi_release_global_lock(glk); | 281 | acpi_release_global_lock(glk); |
187 | 282 | ||
188 | return_VALUE(result); | 283 | if(atomic_read(&ec->leaving_burst) == 2){ |
284 | ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); | ||
285 | while(atomic_read(&ec->pending_gpe)){ | ||
286 | msleep(1); | ||
287 | } | ||
288 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | ||
289 | goto retry; | ||
290 | } | ||
291 | |||
292 | return_VALUE(status); | ||
189 | } | 293 | } |
190 | 294 | ||
191 | 295 | ||
@@ -195,49 +299,80 @@ acpi_ec_write ( | |||
195 | u8 address, | 299 | u8 address, |
196 | u8 data) | 300 | u8 data) |
197 | { | 301 | { |
198 | int result = 0; | 302 | int status = 0; |
199 | acpi_status status = AE_OK; | 303 | u32 glk; |
200 | unsigned long flags = 0; | 304 | u32 tmp; |
201 | u32 glk = 0; | ||
202 | 305 | ||
203 | ACPI_FUNCTION_TRACE("acpi_ec_write"); | 306 | ACPI_FUNCTION_TRACE("acpi_ec_write"); |
204 | 307 | ||
205 | if (!ec) | 308 | if (!ec) |
206 | return_VALUE(-EINVAL); | 309 | return_VALUE(-EINVAL); |
207 | 310 | retry: | |
208 | if (ec->global_lock) { | 311 | if (ec->global_lock) { |
209 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | 312 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); |
210 | if (ACPI_FAILURE(status)) | 313 | if (ACPI_FAILURE(status)) |
211 | return_VALUE(-ENODEV); | 314 | return_VALUE(-ENODEV); |
212 | } | 315 | } |
213 | 316 | ||
214 | spin_lock_irqsave(&ec->lock, flags); | 317 | WARN_ON(in_interrupt()); |
318 | down(&ec->sem); | ||
319 | |||
320 | if(acpi_ec_enter_burst_mode(ec)) | ||
321 | goto end; | ||
322 | |||
323 | status = acpi_ec_read_status(ec); | ||
324 | if (status != -EINVAL && | ||
325 | !(status & ACPI_EC_FLAG_BURST)){ | ||
326 | acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->command_addr); | ||
327 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | ||
328 | if (status) | ||
329 | goto end; | ||
330 | acpi_hw_low_level_read(8, &tmp, &ec->data_addr); | ||
331 | if(tmp != 0x90 ) /* Burst ACK byte*/ | ||
332 | goto end; | ||
333 | } | ||
334 | /*Now we are in burst mode*/ | ||
215 | 335 | ||
216 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->command_addr); | 336 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->command_addr); |
217 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 337 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
218 | if (result) | 338 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); |
339 | if (status){ | ||
219 | goto end; | 340 | goto end; |
341 | } | ||
220 | 342 | ||
221 | acpi_hw_low_level_write(8, address, &ec->data_addr); | 343 | acpi_hw_low_level_write(8, address, &ec->data_addr); |
222 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 344 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
223 | if (result) | 345 | if (status){ |
346 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | ||
224 | goto end; | 347 | goto end; |
348 | } | ||
225 | 349 | ||
226 | acpi_hw_low_level_write(8, data, &ec->data_addr); | 350 | acpi_hw_low_level_write(8, data, &ec->data_addr); |
227 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 351 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
228 | if (result) | 352 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); |
353 | if (status) | ||
229 | goto end; | 354 | goto end; |
230 | 355 | ||
231 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n", | 356 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n", |
232 | data, address)); | 357 | data, address)); |
233 | 358 | ||
234 | end: | 359 | end: |
235 | spin_unlock_irqrestore(&ec->lock, flags); | 360 | acpi_ec_leave_burst_mode(ec); |
361 | up(&ec->sem); | ||
236 | 362 | ||
237 | if (ec->global_lock) | 363 | if (ec->global_lock) |
238 | acpi_release_global_lock(glk); | 364 | acpi_release_global_lock(glk); |
239 | 365 | ||
240 | return_VALUE(result); | 366 | if(atomic_read(&ec->leaving_burst) == 2){ |
367 | ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); | ||
368 | while(atomic_read(&ec->pending_gpe)){ | ||
369 | msleep(1); | ||
370 | } | ||
371 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | ||
372 | goto retry; | ||
373 | } | ||
374 | |||
375 | return_VALUE(status); | ||
241 | } | 376 | } |
242 | 377 | ||
243 | /* | 378 | /* |
@@ -289,16 +424,13 @@ acpi_ec_query ( | |||
289 | struct acpi_ec *ec, | 424 | struct acpi_ec *ec, |
290 | u32 *data) | 425 | u32 *data) |
291 | { | 426 | { |
292 | int result = 0; | 427 | int status = 0; |
293 | acpi_status status = AE_OK; | 428 | u32 glk; |
294 | unsigned long flags = 0; | ||
295 | u32 glk = 0; | ||
296 | 429 | ||
297 | ACPI_FUNCTION_TRACE("acpi_ec_query"); | 430 | ACPI_FUNCTION_TRACE("acpi_ec_query"); |
298 | 431 | ||
299 | if (!ec || !data) | 432 | if (!ec || !data) |
300 | return_VALUE(-EINVAL); | 433 | return_VALUE(-EINVAL); |
301 | |||
302 | *data = 0; | 434 | *data = 0; |
303 | 435 | ||
304 | if (ec->global_lock) { | 436 | if (ec->global_lock) { |
@@ -307,29 +439,39 @@ acpi_ec_query ( | |||
307 | return_VALUE(-ENODEV); | 439 | return_VALUE(-ENODEV); |
308 | } | 440 | } |
309 | 441 | ||
442 | down(&ec->sem); | ||
443 | if(acpi_ec_enter_burst_mode(ec)) | ||
444 | goto end; | ||
310 | /* | 445 | /* |
311 | * Query the EC to find out which _Qxx method we need to evaluate. | 446 | * Query the EC to find out which _Qxx method we need to evaluate. |
312 | * Note that successful completion of the query causes the ACPI_EC_SCI | 447 | * Note that successful completion of the query causes the ACPI_EC_SCI |
313 | * bit to be cleared (and thus clearing the interrupt source). | 448 | * bit to be cleared (and thus clearing the interrupt source). |
314 | */ | 449 | */ |
315 | spin_lock_irqsave(&ec->lock, flags); | ||
316 | |||
317 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->command_addr); | 450 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->command_addr); |
318 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | 451 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); |
319 | if (result) | 452 | if (status){ |
453 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | ||
320 | goto end; | 454 | goto end; |
321 | 455 | } | |
456 | |||
322 | acpi_hw_low_level_read(8, data, &ec->data_addr); | 457 | acpi_hw_low_level_read(8, data, &ec->data_addr); |
458 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | ||
323 | if (!*data) | 459 | if (!*data) |
324 | result = -ENODATA; | 460 | status = -ENODATA; |
325 | 461 | ||
326 | end: | 462 | end: |
327 | spin_unlock_irqrestore(&ec->lock, flags); | 463 | acpi_ec_leave_burst_mode(ec); |
464 | up(&ec->sem); | ||
328 | 465 | ||
329 | if (ec->global_lock) | 466 | if (ec->global_lock) |
330 | acpi_release_global_lock(glk); | 467 | acpi_release_global_lock(glk); |
331 | 468 | ||
332 | return_VALUE(result); | 469 | if(atomic_read(&ec->leaving_burst) == 2){ |
470 | ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); | ||
471 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | ||
472 | status = -ENODATA; | ||
473 | } | ||
474 | return_VALUE(status); | ||
333 | } | 475 | } |
334 | 476 | ||
335 | 477 | ||
@@ -347,42 +489,29 @@ acpi_ec_gpe_query ( | |||
347 | void *ec_cxt) | 489 | void *ec_cxt) |
348 | { | 490 | { |
349 | struct acpi_ec *ec = (struct acpi_ec *) ec_cxt; | 491 | struct acpi_ec *ec = (struct acpi_ec *) ec_cxt; |
350 | u32 value = 0; | 492 | u32 value; |
351 | unsigned long flags = 0; | 493 | int result = -ENODATA; |
352 | static char object_name[5] = {'_','Q','0','0','\0'}; | 494 | static char object_name[5] = {'_','Q','0','0','\0'}; |
353 | const char hex[] = {'0','1','2','3','4','5','6','7', | 495 | const char hex[] = {'0','1','2','3','4','5','6','7', |
354 | '8','9','A','B','C','D','E','F'}; | 496 | '8','9','A','B','C','D','E','F'}; |
355 | 497 | ||
356 | ACPI_FUNCTION_TRACE("acpi_ec_gpe_query"); | 498 | ACPI_FUNCTION_TRACE("acpi_ec_gpe_query"); |
357 | 499 | ||
358 | if (!ec_cxt) | 500 | if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI) |
359 | goto end; | 501 | result = acpi_ec_query(ec, &value); |
360 | |||
361 | spin_lock_irqsave(&ec->lock, flags); | ||
362 | acpi_hw_low_level_read(8, &value, &ec->command_addr); | ||
363 | spin_unlock_irqrestore(&ec->lock, flags); | ||
364 | 502 | ||
365 | /* TBD: Implement asynch events! | 503 | if (result) |
366 | * NOTE: All we care about are EC-SCI's. Other EC events are | ||
367 | * handled via polling (yuck!). This is because some systems | ||
368 | * treat EC-SCIs as level (versus EDGE!) triggered, preventing | ||
369 | * a purely interrupt-driven approach (grumble, grumble). | ||
370 | */ | ||
371 | if (!(value & ACPI_EC_FLAG_SCI)) | ||
372 | goto end; | 504 | goto end; |
373 | 505 | ||
374 | if (acpi_ec_query(ec, &value)) | ||
375 | goto end; | ||
376 | |||
377 | object_name[2] = hex[((value >> 4) & 0x0F)]; | 506 | object_name[2] = hex[((value >> 4) & 0x0F)]; |
378 | object_name[3] = hex[(value & 0x0F)]; | 507 | object_name[3] = hex[(value & 0x0F)]; |
379 | 508 | ||
380 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name)); | 509 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name)); |
381 | 510 | ||
382 | acpi_evaluate_object(ec->handle, object_name, NULL, NULL); | 511 | acpi_evaluate_object(ec->handle, object_name, NULL, NULL); |
383 | 512 | end: | |
384 | end: | 513 | atomic_dec(&ec->pending_gpe); |
385 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | 514 | return; |
386 | } | 515 | } |
387 | 516 | ||
388 | static u32 | 517 | static u32 |
@@ -390,6 +519,7 @@ acpi_ec_gpe_handler ( | |||
390 | void *data) | 519 | void *data) |
391 | { | 520 | { |
392 | acpi_status status = AE_OK; | 521 | acpi_status status = AE_OK; |
522 | u32 value; | ||
393 | struct acpi_ec *ec = (struct acpi_ec *) data; | 523 | struct acpi_ec *ec = (struct acpi_ec *) data; |
394 | 524 | ||
395 | if (!ec) | 525 | if (!ec) |
@@ -397,13 +527,41 @@ acpi_ec_gpe_handler ( | |||
397 | 527 | ||
398 | acpi_disable_gpe(NULL, ec->gpe_bit, ACPI_ISR); | 528 | acpi_disable_gpe(NULL, ec->gpe_bit, ACPI_ISR); |
399 | 529 | ||
400 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 530 | value = acpi_ec_read_status(ec); |
401 | acpi_ec_gpe_query, ec); | ||
402 | 531 | ||
403 | if (status == AE_OK) | 532 | if((value & ACPI_EC_FLAG_IBF) && |
404 | return ACPI_INTERRUPT_HANDLED; | 533 | !(value & ACPI_EC_FLAG_BURST) && |
405 | else | 534 | (atomic_read(&ec->leaving_burst) == 0)) { |
406 | return ACPI_INTERRUPT_NOT_HANDLED; | 535 | /* |
536 | * the embedded controller disables | ||
537 | * burst mode for any reason other | ||
538 | * than the burst disable command | ||
539 | * to process critical event. | ||
540 | */ | ||
541 | atomic_set(&ec->leaving_burst , 2); /* block current pending transaction | ||
542 | and retry */ | ||
543 | wake_up(&ec->wait); | ||
544 | }else { | ||
545 | if ((ec->expect_event == ACPI_EC_EVENT_OBF && | ||
546 | (value & ACPI_EC_FLAG_OBF)) || | ||
547 | (ec->expect_event == ACPI_EC_EVENT_IBE && | ||
548 | !(value & ACPI_EC_FLAG_IBF))) { | ||
549 | ec->expect_event = 0; | ||
550 | wake_up(&ec->wait); | ||
551 | return ACPI_INTERRUPT_HANDLED; | ||
552 | } | ||
553 | } | ||
554 | |||
555 | if (value & ACPI_EC_FLAG_SCI){ | ||
556 | atomic_add(1, &ec->pending_gpe) ; | ||
557 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | ||
558 | acpi_ec_gpe_query, ec); | ||
559 | return status == AE_OK ? | ||
560 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; | ||
561 | } | ||
562 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_ISR); | ||
563 | return status == AE_OK ? | ||
564 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; | ||
407 | } | 565 | } |
408 | 566 | ||
409 | /* -------------------------------------------------------------------------- | 567 | /* -------------------------------------------------------------------------- |
@@ -421,10 +579,8 @@ acpi_ec_space_setup ( | |||
421 | * The EC object is in the handler context and is needed | 579 | * The EC object is in the handler context and is needed |
422 | * when calling the acpi_ec_space_handler. | 580 | * when calling the acpi_ec_space_handler. |
423 | */ | 581 | */ |
424 | if(function == ACPI_REGION_DEACTIVATE) | 582 | *return_context = (function != ACPI_REGION_DEACTIVATE) ? |
425 | *return_context = NULL; | 583 | handler_context : NULL; |
426 | else | ||
427 | *return_context = handler_context; | ||
428 | 584 | ||
429 | return AE_OK; | 585 | return AE_OK; |
430 | } | 586 | } |
@@ -441,7 +597,7 @@ acpi_ec_space_handler ( | |||
441 | { | 597 | { |
442 | int result = 0; | 598 | int result = 0; |
443 | struct acpi_ec *ec = NULL; | 599 | struct acpi_ec *ec = NULL; |
444 | u32 temp = 0; | 600 | u64 temp = *value; |
445 | acpi_integer f_v = 0; | 601 | acpi_integer f_v = 0; |
446 | int i = 0; | 602 | int i = 0; |
447 | 603 | ||
@@ -450,10 +606,9 @@ acpi_ec_space_handler ( | |||
450 | if ((address > 0xFF) || !value || !handler_context) | 606 | if ((address > 0xFF) || !value || !handler_context) |
451 | return_VALUE(AE_BAD_PARAMETER); | 607 | return_VALUE(AE_BAD_PARAMETER); |
452 | 608 | ||
453 | if(bit_width != 8) { | 609 | if (bit_width != 8 && acpi_strict) { |
454 | printk(KERN_WARNING PREFIX "acpi_ec_space_handler: bit_width should be 8\n"); | 610 | printk(KERN_WARNING PREFIX "acpi_ec_space_handler: bit_width should be 8\n"); |
455 | if (acpi_strict) | 611 | return_VALUE(AE_BAD_PARAMETER); |
456 | return_VALUE(AE_BAD_PARAMETER); | ||
457 | } | 612 | } |
458 | 613 | ||
459 | ec = (struct acpi_ec *) handler_context; | 614 | ec = (struct acpi_ec *) handler_context; |
@@ -461,11 +616,11 @@ acpi_ec_space_handler ( | |||
461 | next_byte: | 616 | next_byte: |
462 | switch (function) { | 617 | switch (function) { |
463 | case ACPI_READ: | 618 | case ACPI_READ: |
464 | result = acpi_ec_read(ec, (u8) address, &temp); | 619 | temp = 0; |
465 | *value = (acpi_integer) temp; | 620 | result = acpi_ec_read(ec, (u8) address, (u32 *)&temp); |
466 | break; | 621 | break; |
467 | case ACPI_WRITE: | 622 | case ACPI_WRITE: |
468 | result = acpi_ec_write(ec, (u8) address, (u8) *value); | 623 | result = acpi_ec_write(ec, (u8) address, (u8) temp); |
469 | break; | 624 | break; |
470 | default: | 625 | default: |
471 | result = -EINVAL; | 626 | result = -EINVAL; |
@@ -474,19 +629,18 @@ next_byte: | |||
474 | } | 629 | } |
475 | 630 | ||
476 | bit_width -= 8; | 631 | bit_width -= 8; |
477 | if(bit_width){ | 632 | if (bit_width) { |
478 | 633 | if (function == ACPI_READ) | |
479 | if(function == ACPI_READ) | 634 | f_v |= temp << 8 * i; |
480 | f_v |= (acpi_integer) (*value) << 8*i; | 635 | if (function == ACPI_WRITE) |
481 | if(function == ACPI_WRITE) | 636 | temp >>= 8; |
482 | (*value) >>=8; | ||
483 | i++; | 637 | i++; |
638 | address++; | ||
484 | goto next_byte; | 639 | goto next_byte; |
485 | } | 640 | } |
486 | 641 | ||
487 | 642 | if (function == ACPI_READ) { | |
488 | if(function == ACPI_READ){ | 643 | f_v |= temp << 8 * i; |
489 | f_v |= (acpi_integer) (*value) << 8*i; | ||
490 | *value = f_v; | 644 | *value = f_v; |
491 | } | 645 | } |
492 | 646 | ||
@@ -505,8 +659,6 @@ out: | |||
505 | default: | 659 | default: |
506 | return_VALUE(AE_OK); | 660 | return_VALUE(AE_OK); |
507 | } | 661 | } |
508 | |||
509 | |||
510 | } | 662 | } |
511 | 663 | ||
512 | 664 | ||
@@ -533,6 +685,7 @@ acpi_ec_read_info (struct seq_file *seq, void *offset) | |||
533 | (u32) ec->status_addr.address, (u32) ec->data_addr.address); | 685 | (u32) ec->status_addr.address, (u32) ec->data_addr.address); |
534 | seq_printf(seq, "use global lock: %s\n", | 686 | seq_printf(seq, "use global lock: %s\n", |
535 | ec->global_lock?"yes":"no"); | 687 | ec->global_lock?"yes":"no"); |
688 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | ||
536 | 689 | ||
537 | end: | 690 | end: |
538 | return_VALUE(0); | 691 | return_VALUE(0); |
@@ -555,7 +708,7 @@ static int | |||
555 | acpi_ec_add_fs ( | 708 | acpi_ec_add_fs ( |
556 | struct acpi_device *device) | 709 | struct acpi_device *device) |
557 | { | 710 | { |
558 | struct proc_dir_entry *entry = NULL; | 711 | struct proc_dir_entry *entry; |
559 | 712 | ||
560 | ACPI_FUNCTION_TRACE("acpi_ec_add_fs"); | 713 | ACPI_FUNCTION_TRACE("acpi_ec_add_fs"); |
561 | 714 | ||
@@ -606,9 +759,9 @@ static int | |||
606 | acpi_ec_add ( | 759 | acpi_ec_add ( |
607 | struct acpi_device *device) | 760 | struct acpi_device *device) |
608 | { | 761 | { |
609 | int result = 0; | 762 | int result; |
610 | acpi_status status = AE_OK; | 763 | acpi_status status; |
611 | struct acpi_ec *ec = NULL; | 764 | struct acpi_ec *ec; |
612 | unsigned long uid; | 765 | unsigned long uid; |
613 | 766 | ||
614 | ACPI_FUNCTION_TRACE("acpi_ec_add"); | 767 | ACPI_FUNCTION_TRACE("acpi_ec_add"); |
@@ -623,7 +776,10 @@ acpi_ec_add ( | |||
623 | 776 | ||
624 | ec->handle = device->handle; | 777 | ec->handle = device->handle; |
625 | ec->uid = -1; | 778 | ec->uid = -1; |
626 | spin_lock_init(&ec->lock); | 779 | atomic_set(&ec->pending_gpe, 0); |
780 | atomic_set(&ec->leaving_burst , 1); | ||
781 | init_MUTEX(&ec->sem); | ||
782 | init_waitqueue_head(&ec->wait); | ||
627 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); | 783 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); |
628 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); | 784 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); |
629 | acpi_driver_data(device) = ec; | 785 | acpi_driver_data(device) = ec; |
@@ -637,7 +793,7 @@ acpi_ec_add ( | |||
637 | if (ec_ecdt && ec_ecdt->uid == uid) { | 793 | if (ec_ecdt && ec_ecdt->uid == uid) { |
638 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, | 794 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, |
639 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); | 795 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); |
640 | 796 | ||
641 | acpi_remove_gpe_handler(NULL, ec_ecdt->gpe_bit, &acpi_ec_gpe_handler); | 797 | acpi_remove_gpe_handler(NULL, ec_ecdt->gpe_bit, &acpi_ec_gpe_handler); |
642 | 798 | ||
643 | kfree(ec_ecdt); | 799 | kfree(ec_ecdt); |
@@ -677,7 +833,7 @@ acpi_ec_remove ( | |||
677 | struct acpi_device *device, | 833 | struct acpi_device *device, |
678 | int type) | 834 | int type) |
679 | { | 835 | { |
680 | struct acpi_ec *ec = NULL; | 836 | struct acpi_ec *ec; |
681 | 837 | ||
682 | ACPI_FUNCTION_TRACE("acpi_ec_remove"); | 838 | ACPI_FUNCTION_TRACE("acpi_ec_remove"); |
683 | 839 | ||
@@ -732,8 +888,8 @@ static int | |||
732 | acpi_ec_start ( | 888 | acpi_ec_start ( |
733 | struct acpi_device *device) | 889 | struct acpi_device *device) |
734 | { | 890 | { |
735 | acpi_status status = AE_OK; | 891 | acpi_status status; |
736 | struct acpi_ec *ec = NULL; | 892 | struct acpi_ec *ec; |
737 | 893 | ||
738 | ACPI_FUNCTION_TRACE("acpi_ec_start"); | 894 | ACPI_FUNCTION_TRACE("acpi_ec_start"); |
739 | 895 | ||
@@ -789,8 +945,8 @@ acpi_ec_stop ( | |||
789 | struct acpi_device *device, | 945 | struct acpi_device *device, |
790 | int type) | 946 | int type) |
791 | { | 947 | { |
792 | acpi_status status = AE_OK; | 948 | acpi_status status; |
793 | struct acpi_ec *ec = NULL; | 949 | struct acpi_ec *ec; |
794 | 950 | ||
795 | ACPI_FUNCTION_TRACE("acpi_ec_stop"); | 951 | ACPI_FUNCTION_TRACE("acpi_ec_stop"); |
796 | 952 | ||
@@ -832,7 +988,6 @@ acpi_fake_ecdt_callback ( | |||
832 | status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->gpe_bit); | 988 | status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->gpe_bit); |
833 | if (ACPI_FAILURE(status)) | 989 | if (ACPI_FAILURE(status)) |
834 | return status; | 990 | return status; |
835 | spin_lock_init(&ec_ecdt->lock); | ||
836 | ec_ecdt->global_lock = TRUE; | 991 | ec_ecdt->global_lock = TRUE; |
837 | ec_ecdt->handle = handle; | 992 | ec_ecdt->handle = handle; |
838 | 993 | ||
@@ -890,7 +1045,7 @@ acpi_ec_get_real_ecdt(void) | |||
890 | acpi_status status; | 1045 | acpi_status status; |
891 | struct acpi_table_ecdt *ecdt_ptr; | 1046 | struct acpi_table_ecdt *ecdt_ptr; |
892 | 1047 | ||
893 | status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING, | 1048 | status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING, |
894 | (struct acpi_table_header **) &ecdt_ptr); | 1049 | (struct acpi_table_header **) &ecdt_ptr); |
895 | if (ACPI_FAILURE(status)) | 1050 | if (ACPI_FAILURE(status)) |
896 | return -ENODEV; | 1051 | return -ENODEV; |
@@ -905,11 +1060,12 @@ acpi_ec_get_real_ecdt(void) | |||
905 | return -ENOMEM; | 1060 | return -ENOMEM; |
906 | memset(ec_ecdt, 0, sizeof(struct acpi_ec)); | 1061 | memset(ec_ecdt, 0, sizeof(struct acpi_ec)); |
907 | 1062 | ||
1063 | init_MUTEX(&ec_ecdt->sem); | ||
1064 | init_waitqueue_head(&ec_ecdt->wait); | ||
908 | ec_ecdt->command_addr = ecdt_ptr->ec_control; | 1065 | ec_ecdt->command_addr = ecdt_ptr->ec_control; |
909 | ec_ecdt->status_addr = ecdt_ptr->ec_control; | 1066 | ec_ecdt->status_addr = ecdt_ptr->ec_control; |
910 | ec_ecdt->data_addr = ecdt_ptr->ec_data; | 1067 | ec_ecdt->data_addr = ecdt_ptr->ec_data; |
911 | ec_ecdt->gpe_bit = ecdt_ptr->gpe_bit; | 1068 | ec_ecdt->gpe_bit = ecdt_ptr->gpe_bit; |
912 | spin_lock_init(&ec_ecdt->lock); | ||
913 | /* use the GL just to be safe */ | 1069 | /* use the GL just to be safe */ |
914 | ec_ecdt->global_lock = TRUE; | 1070 | ec_ecdt->global_lock = TRUE; |
915 | ec_ecdt->uid = ecdt_ptr->uid; | 1071 | ec_ecdt->uid = ecdt_ptr->uid; |
@@ -978,7 +1134,7 @@ error: | |||
978 | 1134 | ||
979 | static int __init acpi_ec_init (void) | 1135 | static int __init acpi_ec_init (void) |
980 | { | 1136 | { |
981 | int result = 0; | 1137 | int result; |
982 | 1138 | ||
983 | ACPI_FUNCTION_TRACE("acpi_ec_init"); | 1139 | ACPI_FUNCTION_TRACE("acpi_ec_init"); |
984 | 1140 | ||
diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c index 2a213604ae51..dd3a72a869f4 100644 --- a/drivers/acpi/events/evevent.c +++ b/drivers/acpi/events/evevent.c | |||
@@ -47,6 +47,16 @@ | |||
47 | #define _COMPONENT ACPI_EVENTS | 47 | #define _COMPONENT ACPI_EVENTS |
48 | ACPI_MODULE_NAME ("evevent") | 48 | ACPI_MODULE_NAME ("evevent") |
49 | 49 | ||
50 | /* Local prototypes */ | ||
51 | |||
52 | static acpi_status | ||
53 | acpi_ev_fixed_event_initialize ( | ||
54 | void); | ||
55 | |||
56 | static u32 | ||
57 | acpi_ev_fixed_event_dispatch ( | ||
58 | u32 event); | ||
59 | |||
50 | 60 | ||
51 | /******************************************************************************* | 61 | /******************************************************************************* |
52 | * | 62 | * |
@@ -56,7 +66,7 @@ | |||
56 | * | 66 | * |
57 | * RETURN: Status | 67 | * RETURN: Status |
58 | * | 68 | * |
59 | * DESCRIPTION: Initialize global data structures for events. | 69 | * DESCRIPTION: Initialize global data structures for ACPI events (Fixed, GPE) |
60 | * | 70 | * |
61 | ******************************************************************************/ | 71 | ******************************************************************************/ |
62 | 72 | ||
@@ -78,9 +88,9 @@ acpi_ev_initialize_events ( | |||
78 | } | 88 | } |
79 | 89 | ||
80 | /* | 90 | /* |
81 | * Initialize the Fixed and General Purpose Events. This is | 91 | * Initialize the Fixed and General Purpose Events. This is done prior to |
82 | * done prior to enabling SCIs to prevent interrupts from | 92 | * enabling SCIs to prevent interrupts from occurring before the handlers are |
83 | * occurring before handers are installed. | 93 | * installed. |
84 | */ | 94 | */ |
85 | status = acpi_ev_fixed_event_initialize (); | 95 | status = acpi_ev_fixed_event_initialize (); |
86 | if (ACPI_FAILURE (status)) { | 96 | if (ACPI_FAILURE (status)) { |
@@ -161,7 +171,7 @@ acpi_ev_install_xrupt_handlers ( | |||
161 | * | 171 | * |
162 | ******************************************************************************/ | 172 | ******************************************************************************/ |
163 | 173 | ||
164 | acpi_status | 174 | static acpi_status |
165 | acpi_ev_fixed_event_initialize ( | 175 | acpi_ev_fixed_event_initialize ( |
166 | void) | 176 | void) |
167 | { | 177 | { |
@@ -180,7 +190,8 @@ acpi_ev_fixed_event_initialize ( | |||
180 | /* Enable the fixed event */ | 190 | /* Enable the fixed event */ |
181 | 191 | ||
182 | if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) { | 192 | if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) { |
183 | status = acpi_set_register (acpi_gbl_fixed_event_info[i].enable_register_id, | 193 | status = acpi_set_register ( |
194 | acpi_gbl_fixed_event_info[i].enable_register_id, | ||
184 | 0, ACPI_MTX_LOCK); | 195 | 0, ACPI_MTX_LOCK); |
185 | if (ACPI_FAILURE (status)) { | 196 | if (ACPI_FAILURE (status)) { |
186 | return (status); | 197 | return (status); |
@@ -200,7 +211,7 @@ acpi_ev_fixed_event_initialize ( | |||
200 | * | 211 | * |
201 | * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED | 212 | * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED |
202 | * | 213 | * |
203 | * DESCRIPTION: Checks the PM status register for fixed events | 214 | * DESCRIPTION: Checks the PM status register for active fixed events |
204 | * | 215 | * |
205 | ******************************************************************************/ | 216 | ******************************************************************************/ |
206 | 217 | ||
@@ -221,8 +232,10 @@ acpi_ev_fixed_event_detect ( | |||
221 | * Read the fixed feature status and enable registers, as all the cases | 232 | * Read the fixed feature status and enable registers, as all the cases |
222 | * depend on their values. Ignore errors here. | 233 | * depend on their values. Ignore errors here. |
223 | */ | 234 | */ |
224 | (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, &fixed_status); | 235 | (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, |
225 | (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, &fixed_enable); | 236 | &fixed_status); |
237 | (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, | ||
238 | &fixed_enable); | ||
226 | 239 | ||
227 | ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, | 240 | ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, |
228 | "Fixed Event Block: Enable %08X Status %08X\n", | 241 | "Fixed Event Block: Enable %08X Status %08X\n", |
@@ -259,7 +272,7 @@ acpi_ev_fixed_event_detect ( | |||
259 | * | 272 | * |
260 | ******************************************************************************/ | 273 | ******************************************************************************/ |
261 | 274 | ||
262 | u32 | 275 | static u32 |
263 | acpi_ev_fixed_event_dispatch ( | 276 | acpi_ev_fixed_event_dispatch ( |
264 | u32 event) | 277 | u32 event) |
265 | { | 278 | { |
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index 118d72ac7c76..081120b109ba 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c | |||
@@ -48,6 +48,12 @@ | |||
48 | #define _COMPONENT ACPI_EVENTS | 48 | #define _COMPONENT ACPI_EVENTS |
49 | ACPI_MODULE_NAME ("evgpe") | 49 | ACPI_MODULE_NAME ("evgpe") |
50 | 50 | ||
51 | /* Local prototypes */ | ||
52 | |||
53 | static void ACPI_SYSTEM_XFACE | ||
54 | acpi_ev_asynch_execute_gpe_method ( | ||
55 | void *context); | ||
56 | |||
51 | 57 | ||
52 | /******************************************************************************* | 58 | /******************************************************************************* |
53 | * | 59 | * |
@@ -335,8 +341,10 @@ acpi_ev_get_gpe_event_info ( | |||
335 | gpe_block = acpi_gbl_gpe_fadt_blocks[i]; | 341 | gpe_block = acpi_gbl_gpe_fadt_blocks[i]; |
336 | if (gpe_block) { | 342 | if (gpe_block) { |
337 | if ((gpe_number >= gpe_block->block_base_number) && | 343 | if ((gpe_number >= gpe_block->block_base_number) && |
338 | (gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) { | 344 | (gpe_number < gpe_block->block_base_number + |
339 | return (&gpe_block->event_info[gpe_number - gpe_block->block_base_number]); | 345 | (gpe_block->register_count * 8))) { |
346 | return (&gpe_block->event_info[gpe_number - | ||
347 | gpe_block->block_base_number]); | ||
340 | } | 348 | } |
341 | } | 349 | } |
342 | } | 350 | } |
@@ -437,7 +445,7 @@ acpi_ev_gpe_detect ( | |||
437 | "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n", | 445 | "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n", |
438 | gpe_register_info->base_gpe_number, status_reg, enable_reg)); | 446 | gpe_register_info->base_gpe_number, status_reg, enable_reg)); |
439 | 447 | ||
440 | /* First check if there is anything active at all in this register */ | 448 | /* Check if there is anything active at all in this register */ |
441 | 449 | ||
442 | enabled_status_byte = (u8) (status_reg & enable_reg); | 450 | enabled_status_byte = (u8) (status_reg & enable_reg); |
443 | if (!enabled_status_byte) { | 451 | if (!enabled_status_byte) { |
@@ -457,8 +465,8 @@ acpi_ev_gpe_detect ( | |||
457 | * or method. | 465 | * or method. |
458 | */ | 466 | */ |
459 | int_status |= acpi_ev_gpe_dispatch ( | 467 | int_status |= acpi_ev_gpe_dispatch ( |
460 | &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j], | 468 | &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j], |
461 | (u32) j + gpe_register_info->base_gpe_number); | 469 | (u32) j + gpe_register_info->base_gpe_number); |
462 | } | 470 | } |
463 | } | 471 | } |
464 | } | 472 | } |
@@ -523,7 +531,8 @@ acpi_ev_asynch_execute_gpe_method ( | |||
523 | * Take a snapshot of the GPE info for this level - we copy the | 531 | * Take a snapshot of the GPE info for this level - we copy the |
524 | * info to prevent a race condition with remove_handler/remove_block. | 532 | * info to prevent a race condition with remove_handler/remove_block. |
525 | */ | 533 | */ |
526 | ACPI_MEMCPY (&local_gpe_event_info, gpe_event_info, sizeof (struct acpi_gpe_event_info)); | 534 | ACPI_MEMCPY (&local_gpe_event_info, gpe_event_info, |
535 | sizeof (struct acpi_gpe_event_info)); | ||
527 | 536 | ||
528 | status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); | 537 | status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); |
529 | if (ACPI_FAILURE (status)) { | 538 | if (ACPI_FAILURE (status)) { |
@@ -534,7 +543,8 @@ acpi_ev_asynch_execute_gpe_method ( | |||
534 | * Must check for control method type dispatch one more | 543 | * Must check for control method type dispatch one more |
535 | * time to avoid race with ev_gpe_install_handler | 544 | * time to avoid race with ev_gpe_install_handler |
536 | */ | 545 | */ |
537 | if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD) { | 546 | if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == |
547 | ACPI_GPE_DISPATCH_METHOD) { | ||
538 | /* | 548 | /* |
539 | * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx | 549 | * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx |
540 | * control method that corresponds to this GPE | 550 | * control method that corresponds to this GPE |
@@ -553,7 +563,8 @@ acpi_ev_asynch_execute_gpe_method ( | |||
553 | } | 563 | } |
554 | } | 564 | } |
555 | 565 | ||
556 | if ((local_gpe_event_info.flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED) { | 566 | if ((local_gpe_event_info.flags & ACPI_GPE_XRUPT_TYPE_MASK) == |
567 | ACPI_GPE_LEVEL_TRIGGERED) { | ||
557 | /* | 568 | /* |
558 | * GPE is level-triggered, we clear the GPE status bit after | 569 | * GPE is level-triggered, we clear the GPE status bit after |
559 | * handling the event. | 570 | * handling the event. |
@@ -575,7 +586,7 @@ acpi_ev_asynch_execute_gpe_method ( | |||
575 | * | 586 | * |
576 | * FUNCTION: acpi_ev_gpe_dispatch | 587 | * FUNCTION: acpi_ev_gpe_dispatch |
577 | * | 588 | * |
578 | * PARAMETERS: gpe_event_info - info for this GPE | 589 | * PARAMETERS: gpe_event_info - Info for this GPE |
579 | * gpe_number - Number relative to the parent GPE block | 590 | * gpe_number - Number relative to the parent GPE block |
580 | * | 591 | * |
581 | * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED | 592 | * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED |
@@ -602,10 +613,12 @@ acpi_ev_gpe_dispatch ( | |||
602 | * If edge-triggered, clear the GPE status bit now. Note that | 613 | * If edge-triggered, clear the GPE status bit now. Note that |
603 | * level-triggered events are cleared after the GPE is serviced. | 614 | * level-triggered events are cleared after the GPE is serviced. |
604 | */ | 615 | */ |
605 | if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_EDGE_TRIGGERED) { | 616 | if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == |
617 | ACPI_GPE_EDGE_TRIGGERED) { | ||
606 | status = acpi_hw_clear_gpe (gpe_event_info); | 618 | status = acpi_hw_clear_gpe (gpe_event_info); |
607 | if (ACPI_FAILURE (status)) { | 619 | if (ACPI_FAILURE (status)) { |
608 | ACPI_REPORT_ERROR (("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", | 620 | ACPI_REPORT_ERROR (( |
621 | "acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", | ||
609 | acpi_format_exception (status), gpe_number)); | 622 | acpi_format_exception (status), gpe_number)); |
610 | return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); | 623 | return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); |
611 | } | 624 | } |
@@ -639,7 +652,8 @@ acpi_ev_gpe_dispatch ( | |||
639 | 652 | ||
640 | /* It is now safe to clear level-triggered events. */ | 653 | /* It is now safe to clear level-triggered events. */ |
641 | 654 | ||
642 | if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED) { | 655 | if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == |
656 | ACPI_GPE_LEVEL_TRIGGERED) { | ||
643 | status = acpi_hw_clear_gpe (gpe_event_info); | 657 | status = acpi_hw_clear_gpe (gpe_event_info); |
644 | if (ACPI_FAILURE (status)) { | 658 | if (ACPI_FAILURE (status)) { |
645 | ACPI_REPORT_ERROR (( | 659 | ACPI_REPORT_ERROR (( |
@@ -704,7 +718,6 @@ acpi_ev_gpe_dispatch ( | |||
704 | 718 | ||
705 | 719 | ||
706 | #ifdef ACPI_GPE_NOTIFY_CHECK | 720 | #ifdef ACPI_GPE_NOTIFY_CHECK |
707 | |||
708 | /******************************************************************************* | 721 | /******************************************************************************* |
709 | * TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED | 722 | * TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED |
710 | * | 723 | * |
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index 00d981f53c6a..84186a7d17b2 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c | |||
@@ -48,6 +48,39 @@ | |||
48 | #define _COMPONENT ACPI_EVENTS | 48 | #define _COMPONENT ACPI_EVENTS |
49 | ACPI_MODULE_NAME ("evgpeblk") | 49 | ACPI_MODULE_NAME ("evgpeblk") |
50 | 50 | ||
51 | /* Local prototypes */ | ||
52 | |||
53 | static acpi_status | ||
54 | acpi_ev_save_method_info ( | ||
55 | acpi_handle obj_handle, | ||
56 | u32 level, | ||
57 | void *obj_desc, | ||
58 | void **return_value); | ||
59 | |||
60 | static acpi_status | ||
61 | acpi_ev_match_prw_and_gpe ( | ||
62 | acpi_handle obj_handle, | ||
63 | u32 level, | ||
64 | void *info, | ||
65 | void **return_value); | ||
66 | |||
67 | static struct acpi_gpe_xrupt_info * | ||
68 | acpi_ev_get_gpe_xrupt_block ( | ||
69 | u32 interrupt_level); | ||
70 | |||
71 | static acpi_status | ||
72 | acpi_ev_delete_gpe_xrupt ( | ||
73 | struct acpi_gpe_xrupt_info *gpe_xrupt); | ||
74 | |||
75 | static acpi_status | ||
76 | acpi_ev_install_gpe_block ( | ||
77 | struct acpi_gpe_block_info *gpe_block, | ||
78 | u32 interrupt_level); | ||
79 | |||
80 | static acpi_status | ||
81 | acpi_ev_create_gpe_info_blocks ( | ||
82 | struct acpi_gpe_block_info *gpe_block); | ||
83 | |||
51 | 84 | ||
52 | /******************************************************************************* | 85 | /******************************************************************************* |
53 | * | 86 | * |
@@ -155,7 +188,7 @@ unlock_and_exit: | |||
155 | } | 188 | } |
156 | 189 | ||
157 | 190 | ||
158 | /****************************************************************************** | 191 | /******************************************************************************* |
159 | * | 192 | * |
160 | * FUNCTION: acpi_ev_delete_gpe_handlers | 193 | * FUNCTION: acpi_ev_delete_gpe_handlers |
161 | * | 194 | * |
@@ -190,7 +223,8 @@ acpi_ev_delete_gpe_handlers ( | |||
190 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { | 223 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { |
191 | gpe_event_info = &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j]; | 224 | gpe_event_info = &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j]; |
192 | 225 | ||
193 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) { | 226 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == |
227 | ACPI_GPE_DISPATCH_HANDLER) { | ||
194 | ACPI_MEM_FREE (gpe_event_info->dispatch.handler); | 228 | ACPI_MEM_FREE (gpe_event_info->dispatch.handler); |
195 | gpe_event_info->dispatch.handler = NULL; | 229 | gpe_event_info->dispatch.handler = NULL; |
196 | gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; | 230 | gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; |
@@ -471,7 +505,7 @@ acpi_ev_get_gpe_xrupt_block ( | |||
471 | ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block"); | 505 | ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block"); |
472 | 506 | ||
473 | 507 | ||
474 | /* No need for spin lock since we are not changing any list elements here */ | 508 | /* No need for lock since we are not changing any list elements here */ |
475 | 509 | ||
476 | next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; | 510 | next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; |
477 | while (next_gpe_xrupt) { | 511 | while (next_gpe_xrupt) { |
@@ -619,7 +653,7 @@ acpi_ev_install_gpe_block ( | |||
619 | goto unlock_and_exit; | 653 | goto unlock_and_exit; |
620 | } | 654 | } |
621 | 655 | ||
622 | /* Install the new block at the end of the list for this interrupt with lock */ | 656 | /* Install the new block at the end of the list with lock */ |
623 | 657 | ||
624 | acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); | 658 | acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); |
625 | if (gpe_xrupt_block->gpe_block_list_head) { | 659 | if (gpe_xrupt_block->gpe_block_list_head) { |
@@ -756,10 +790,12 @@ acpi_ev_create_gpe_info_blocks ( | |||
756 | * per register. Initialization to zeros is sufficient. | 790 | * per register. Initialization to zeros is sufficient. |
757 | */ | 791 | */ |
758 | gpe_event_info = ACPI_MEM_CALLOCATE ( | 792 | gpe_event_info = ACPI_MEM_CALLOCATE ( |
759 | ((acpi_size) gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH) * | 793 | ((acpi_size) gpe_block->register_count * |
794 | ACPI_GPE_REGISTER_WIDTH) * | ||
760 | sizeof (struct acpi_gpe_event_info)); | 795 | sizeof (struct acpi_gpe_event_info)); |
761 | if (!gpe_event_info) { | 796 | if (!gpe_event_info) { |
762 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not allocate the gpe_event_info table\n")); | 797 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
798 | "Could not allocate the gpe_event_info table\n")); | ||
763 | status = AE_NO_MEMORY; | 799 | status = AE_NO_MEMORY; |
764 | goto error_exit; | 800 | goto error_exit; |
765 | } | 801 | } |
@@ -899,7 +935,8 @@ acpi_ev_create_gpe_block ( | |||
899 | gpe_block->block_base_number = gpe_block_base_number; | 935 | gpe_block->block_base_number = gpe_block_base_number; |
900 | gpe_block->node = gpe_device; | 936 | gpe_block->node = gpe_device; |
901 | 937 | ||
902 | ACPI_MEMCPY (&gpe_block->block_address, gpe_block_address, sizeof (struct acpi_generic_address)); | 938 | ACPI_MEMCPY (&gpe_block->block_address, gpe_block_address, |
939 | sizeof (struct acpi_generic_address)); | ||
903 | 940 | ||
904 | /* Create the register_info and event_info sub-structures */ | 941 | /* Create the register_info and event_info sub-structures */ |
905 | 942 | ||
@@ -1061,8 +1098,9 @@ acpi_ev_gpe_initialize ( | |||
1061 | 1098 | ||
1062 | /* Install GPE Block 0 */ | 1099 | /* Install GPE Block 0 */ |
1063 | 1100 | ||
1064 | status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, &acpi_gbl_FADT->xgpe0_blk, | 1101 | status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, |
1065 | register_count0, 0, acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[0]); | 1102 | &acpi_gbl_FADT->xgpe0_blk, register_count0, 0, |
1103 | acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[0]); | ||
1066 | 1104 | ||
1067 | if (ACPI_FAILURE (status)) { | 1105 | if (ACPI_FAILURE (status)) { |
1068 | ACPI_REPORT_ERROR (( | 1106 | ACPI_REPORT_ERROR (( |
@@ -1094,8 +1132,9 @@ acpi_ev_gpe_initialize ( | |||
1094 | else { | 1132 | else { |
1095 | /* Install GPE Block 1 */ | 1133 | /* Install GPE Block 1 */ |
1096 | 1134 | ||
1097 | status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, &acpi_gbl_FADT->xgpe1_blk, | 1135 | status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, |
1098 | register_count1, acpi_gbl_FADT->gpe1_base, | 1136 | &acpi_gbl_FADT->xgpe1_blk, register_count1, |
1137 | acpi_gbl_FADT->gpe1_base, | ||
1099 | acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[1]); | 1138 | acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[1]); |
1100 | 1139 | ||
1101 | if (ACPI_FAILURE (status)) { | 1140 | if (ACPI_FAILURE (status)) { |
@@ -1109,7 +1148,7 @@ acpi_ev_gpe_initialize ( | |||
1109 | * space. However, GPE0 always starts at GPE number zero. | 1148 | * space. However, GPE0 always starts at GPE number zero. |
1110 | */ | 1149 | */ |
1111 | gpe_number_max = acpi_gbl_FADT->gpe1_base + | 1150 | gpe_number_max = acpi_gbl_FADT->gpe1_base + |
1112 | ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1); | 1151 | ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1); |
1113 | } | 1152 | } |
1114 | } | 1153 | } |
1115 | 1154 | ||
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index 2548efa7a45f..659e90956112 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c | |||
@@ -50,6 +50,35 @@ | |||
50 | ACPI_MODULE_NAME ("evmisc") | 50 | ACPI_MODULE_NAME ("evmisc") |
51 | 51 | ||
52 | 52 | ||
53 | #ifdef ACPI_DEBUG_OUTPUT | ||
54 | static const char *acpi_notify_value_names[] = | ||
55 | { | ||
56 | "Bus Check", | ||
57 | "Device Check", | ||
58 | "Device Wake", | ||
59 | "Eject request", | ||
60 | "Device Check Light", | ||
61 | "Frequency Mismatch", | ||
62 | "Bus Mode Mismatch", | ||
63 | "Power Fault" | ||
64 | }; | ||
65 | #endif | ||
66 | |||
67 | /* Local prototypes */ | ||
68 | |||
69 | static void ACPI_SYSTEM_XFACE | ||
70 | acpi_ev_notify_dispatch ( | ||
71 | void *context); | ||
72 | |||
73 | static void ACPI_SYSTEM_XFACE | ||
74 | acpi_ev_global_lock_thread ( | ||
75 | void *context); | ||
76 | |||
77 | static u32 | ||
78 | acpi_ev_global_lock_handler ( | ||
79 | void *context); | ||
80 | |||
81 | |||
53 | /******************************************************************************* | 82 | /******************************************************************************* |
54 | * | 83 | * |
55 | * FUNCTION: acpi_ev_is_notify_object | 84 | * FUNCTION: acpi_ev_is_notify_object |
@@ -98,20 +127,6 @@ acpi_ev_is_notify_object ( | |||
98 | * | 127 | * |
99 | ******************************************************************************/ | 128 | ******************************************************************************/ |
100 | 129 | ||
101 | #ifdef ACPI_DEBUG_OUTPUT | ||
102 | static const char *acpi_notify_value_names[] = | ||
103 | { | ||
104 | "Bus Check", | ||
105 | "Device Check", | ||
106 | "Device Wake", | ||
107 | "Eject request", | ||
108 | "Device Check Light", | ||
109 | "Frequency Mismatch", | ||
110 | "Bus Mode Mismatch", | ||
111 | "Power Fault" | ||
112 | }; | ||
113 | #endif | ||
114 | |||
115 | acpi_status | 130 | acpi_status |
116 | acpi_ev_queue_notify_request ( | 131 | acpi_ev_queue_notify_request ( |
117 | struct acpi_namespace_node *node, | 132 | struct acpi_namespace_node *node, |
@@ -128,9 +143,10 @@ acpi_ev_queue_notify_request ( | |||
128 | 143 | ||
129 | /* | 144 | /* |
130 | * For value 3 (Ejection Request), some device method may need to be run. | 145 | * For value 3 (Ejection Request), some device method may need to be run. |
131 | * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need to be run. | 146 | * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need |
147 | * to be run. | ||
132 | * For value 0x80 (Status Change) on the power button or sleep button, | 148 | * For value 0x80 (Status Change) on the power button or sleep button, |
133 | * initiate soft-off or sleep operation? | 149 | * initiate soft-off or sleep operation? |
134 | */ | 150 | */ |
135 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 151 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
136 | "Dispatching Notify(%X) on node %p\n", notify_value, node)); | 152 | "Dispatching Notify(%X) on node %p\n", notify_value, node)); |
@@ -140,8 +156,9 @@ acpi_ev_queue_notify_request ( | |||
140 | acpi_notify_value_names[notify_value])); | 156 | acpi_notify_value_names[notify_value])); |
141 | } | 157 | } |
142 | else { | 158 | else { |
143 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: 0x%2.2X **Device Specific**\n", | 159 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
144 | notify_value)); | 160 | "Notify value: 0x%2.2X **Device Specific**\n", |
161 | notify_value)); | ||
145 | } | 162 | } |
146 | 163 | ||
147 | /* Get the notify object attached to the NS Node */ | 164 | /* Get the notify object attached to the NS Node */ |
@@ -210,7 +227,7 @@ acpi_ev_queue_notify_request ( | |||
210 | * | 227 | * |
211 | * FUNCTION: acpi_ev_notify_dispatch | 228 | * FUNCTION: acpi_ev_notify_dispatch |
212 | * | 229 | * |
213 | * PARAMETERS: Context - To be passsed to the notify handler | 230 | * PARAMETERS: Context - To be passed to the notify handler |
214 | * | 231 | * |
215 | * RETURN: None. | 232 | * RETURN: None. |
216 | * | 233 | * |
@@ -219,7 +236,7 @@ acpi_ev_queue_notify_request ( | |||
219 | * | 236 | * |
220 | ******************************************************************************/ | 237 | ******************************************************************************/ |
221 | 238 | ||
222 | void ACPI_SYSTEM_XFACE | 239 | static void ACPI_SYSTEM_XFACE |
223 | acpi_ev_notify_dispatch ( | 240 | acpi_ev_notify_dispatch ( |
224 | void *context) | 241 | void *context) |
225 | { | 242 | { |
@@ -234,7 +251,8 @@ acpi_ev_notify_dispatch ( | |||
234 | 251 | ||
235 | /* | 252 | /* |
236 | * We will invoke a global notify handler if installed. | 253 | * We will invoke a global notify handler if installed. |
237 | * This is done _before_ we invoke the per-device handler attached to the device. | 254 | * This is done _before_ we invoke the per-device handler attached |
255 | * to the device. | ||
238 | */ | 256 | */ |
239 | if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { | 257 | if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { |
240 | /* Global system notification handler */ | 258 | /* Global system notification handler */ |
@@ -256,15 +274,17 @@ acpi_ev_notify_dispatch ( | |||
256 | /* Invoke the system handler first, if present */ | 274 | /* Invoke the system handler first, if present */ |
257 | 275 | ||
258 | if (global_handler) { | 276 | if (global_handler) { |
259 | global_handler (notify_info->notify.node, notify_info->notify.value, global_context); | 277 | global_handler (notify_info->notify.node, notify_info->notify.value, |
278 | global_context); | ||
260 | } | 279 | } |
261 | 280 | ||
262 | /* Now invoke the per-device handler, if present */ | 281 | /* Now invoke the per-device handler, if present */ |
263 | 282 | ||
264 | handler_obj = notify_info->notify.handler_obj; | 283 | handler_obj = notify_info->notify.handler_obj; |
265 | if (handler_obj) { | 284 | if (handler_obj) { |
266 | handler_obj->notify.handler (notify_info->notify.node, notify_info->notify.value, | 285 | handler_obj->notify.handler (notify_info->notify.node, |
267 | handler_obj->notify.context); | 286 | notify_info->notify.value, |
287 | handler_obj->notify.context); | ||
268 | } | 288 | } |
269 | 289 | ||
270 | /* All done with the info object */ | 290 | /* All done with the info object */ |
@@ -370,7 +390,8 @@ acpi_ev_global_lock_handler ( | |||
370 | ******************************************************************************/ | 390 | ******************************************************************************/ |
371 | 391 | ||
372 | acpi_status | 392 | acpi_status |
373 | acpi_ev_init_global_lock_handler (void) | 393 | acpi_ev_init_global_lock_handler ( |
394 | void) | ||
374 | { | 395 | { |
375 | acpi_status status; | 396 | acpi_status status; |
376 | 397 | ||
@@ -380,7 +401,7 @@ acpi_ev_init_global_lock_handler (void) | |||
380 | 401 | ||
381 | acpi_gbl_global_lock_present = TRUE; | 402 | acpi_gbl_global_lock_present = TRUE; |
382 | status = acpi_install_fixed_event_handler (ACPI_EVENT_GLOBAL, | 403 | status = acpi_install_fixed_event_handler (ACPI_EVENT_GLOBAL, |
383 | acpi_ev_global_lock_handler, NULL); | 404 | acpi_ev_global_lock_handler, NULL); |
384 | 405 | ||
385 | /* | 406 | /* |
386 | * If the global lock does not exist on this platform, the attempt | 407 | * If the global lock does not exist on this platform, the attempt |
@@ -433,8 +454,10 @@ acpi_ev_acquire_global_lock ( | |||
433 | 454 | ||
434 | acpi_gbl_global_lock_thread_count++; | 455 | acpi_gbl_global_lock_thread_count++; |
435 | 456 | ||
436 | /* If we (OS side vs. BIOS side) have the hardware lock already, we are done */ | 457 | /* |
437 | 458 | * If we (OS side vs. BIOS side) have the hardware lock already, | |
459 | * we are done | ||
460 | */ | ||
438 | if (acpi_gbl_global_lock_acquired) { | 461 | if (acpi_gbl_global_lock_acquired) { |
439 | return_ACPI_STATUS (AE_OK); | 462 | return_ACPI_STATUS (AE_OK); |
440 | } | 463 | } |
@@ -480,7 +503,8 @@ acpi_ev_acquire_global_lock ( | |||
480 | ******************************************************************************/ | 503 | ******************************************************************************/ |
481 | 504 | ||
482 | acpi_status | 505 | acpi_status |
483 | acpi_ev_release_global_lock (void) | 506 | acpi_ev_release_global_lock ( |
507 | void) | ||
484 | { | 508 | { |
485 | u8 pending = FALSE; | 509 | u8 pending = FALSE; |
486 | acpi_status status = AE_OK; | 510 | acpi_status status = AE_OK; |
@@ -490,7 +514,8 @@ acpi_ev_release_global_lock (void) | |||
490 | 514 | ||
491 | 515 | ||
492 | if (!acpi_gbl_global_lock_thread_count) { | 516 | if (!acpi_gbl_global_lock_thread_count) { |
493 | ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n")); | 517 | ACPI_REPORT_WARNING(( |
518 | "Cannot release HW Global Lock, it has not been acquired\n")); | ||
494 | return_ACPI_STATUS (AE_NOT_ACQUIRED); | 519 | return_ACPI_STATUS (AE_NOT_ACQUIRED); |
495 | } | 520 | } |
496 | 521 | ||
@@ -515,7 +540,8 @@ acpi_ev_release_global_lock (void) | |||
515 | * register | 540 | * register |
516 | */ | 541 | */ |
517 | if (pending) { | 542 | if (pending) { |
518 | status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1, ACPI_MTX_LOCK); | 543 | status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE, |
544 | 1, ACPI_MTX_LOCK); | ||
519 | } | 545 | } |
520 | 546 | ||
521 | return_ACPI_STATUS (status); | 547 | return_ACPI_STATUS (status); |
@@ -535,7 +561,8 @@ acpi_ev_release_global_lock (void) | |||
535 | ******************************************************************************/ | 561 | ******************************************************************************/ |
536 | 562 | ||
537 | void | 563 | void |
538 | acpi_ev_terminate (void) | 564 | acpi_ev_terminate ( |
565 | void) | ||
539 | { | 566 | { |
540 | acpi_native_uint i; | 567 | acpi_native_uint i; |
541 | acpi_status status; | 568 | acpi_status status; |
@@ -555,7 +582,8 @@ acpi_ev_terminate (void) | |||
555 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { | 582 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { |
556 | status = acpi_disable_event ((u32) i, 0); | 583 | status = acpi_disable_event ((u32) i, 0); |
557 | if (ACPI_FAILURE (status)) { | 584 | if (ACPI_FAILURE (status)) { |
558 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not disable fixed event %d\n", (u32) i)); | 585 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
586 | "Could not disable fixed event %d\n", (u32) i)); | ||
559 | } | 587 | } |
560 | } | 588 | } |
561 | 589 | ||
@@ -567,7 +595,8 @@ acpi_ev_terminate (void) | |||
567 | 595 | ||
568 | status = acpi_ev_remove_sci_handler (); | 596 | status = acpi_ev_remove_sci_handler (); |
569 | if (ACPI_FAILURE(status)) { | 597 | if (ACPI_FAILURE(status)) { |
570 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not remove SCI handler\n")); | 598 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
599 | "Could not remove SCI handler\n")); | ||
571 | } | 600 | } |
572 | } | 601 | } |
573 | 602 | ||
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c index 772342708a7a..a1d7276c5742 100644 --- a/drivers/acpi/events/evregion.c +++ b/drivers/acpi/events/evregion.c | |||
@@ -58,6 +58,22 @@ static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPA | |||
58 | ACPI_ADR_SPACE_PCI_CONFIG, | 58 | ACPI_ADR_SPACE_PCI_CONFIG, |
59 | ACPI_ADR_SPACE_DATA_TABLE}; | 59 | ACPI_ADR_SPACE_DATA_TABLE}; |
60 | 60 | ||
61 | /* Local prototypes */ | ||
62 | |||
63 | static acpi_status | ||
64 | acpi_ev_reg_run ( | ||
65 | acpi_handle obj_handle, | ||
66 | u32 level, | ||
67 | void *context, | ||
68 | void **return_value); | ||
69 | |||
70 | static acpi_status | ||
71 | acpi_ev_install_handler ( | ||
72 | acpi_handle obj_handle, | ||
73 | u32 level, | ||
74 | void *context, | ||
75 | void **return_value); | ||
76 | |||
61 | 77 | ||
62 | /******************************************************************************* | 78 | /******************************************************************************* |
63 | * | 79 | * |
@@ -179,8 +195,8 @@ acpi_ev_initialize_op_regions ( | |||
179 | * | 195 | * |
180 | * FUNCTION: acpi_ev_execute_reg_method | 196 | * FUNCTION: acpi_ev_execute_reg_method |
181 | * | 197 | * |
182 | * PARAMETERS: region_obj - Object structure | 198 | * PARAMETERS: region_obj - Region object |
183 | * Function - Passed to _REG: On (1) or Off (0) | 199 | * Function - Passed to _REG: On (1) or Off (0) |
184 | * | 200 | * |
185 | * RETURN: Status | 201 | * RETURN: Status |
186 | * | 202 | * |
@@ -323,14 +339,16 @@ acpi_ev_address_space_dispatch ( | |||
323 | if (!region_setup) { | 339 | if (!region_setup) { |
324 | /* No initialization routine, exit with error */ | 340 | /* No initialization routine, exit with error */ |
325 | 341 | ||
326 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No init routine for region(%p) [%s]\n", | 342 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
343 | "No init routine for region(%p) [%s]\n", | ||
327 | region_obj, acpi_ut_get_region_name (region_obj->region.space_id))); | 344 | region_obj, acpi_ut_get_region_name (region_obj->region.space_id))); |
328 | return_ACPI_STATUS (AE_NOT_EXIST); | 345 | return_ACPI_STATUS (AE_NOT_EXIST); |
329 | } | 346 | } |
330 | 347 | ||
331 | /* | 348 | /* |
332 | * We must exit the interpreter because the region setup will potentially | 349 | * We must exit the interpreter because the region |
333 | * execute control methods (e.g., _REG method for this region) | 350 | * setup will potentially execute control methods |
351 | * (e.g., _REG method for this region) | ||
334 | */ | 352 | */ |
335 | acpi_ex_exit_interpreter (); | 353 | acpi_ex_exit_interpreter (); |
336 | 354 | ||
@@ -621,7 +639,7 @@ acpi_ev_attach_region ( | |||
621 | * | 639 | * |
622 | ******************************************************************************/ | 640 | ******************************************************************************/ |
623 | 641 | ||
624 | acpi_status | 642 | static acpi_status |
625 | acpi_ev_install_handler ( | 643 | acpi_ev_install_handler ( |
626 | acpi_handle obj_handle, | 644 | acpi_handle obj_handle, |
627 | u32 level, | 645 | u32 level, |
@@ -848,7 +866,8 @@ acpi_ev_install_space_handler ( | |||
848 | if (handler_obj->address_space.handler == handler) { | 866 | if (handler_obj->address_space.handler == handler) { |
849 | /* | 867 | /* |
850 | * It is (relatively) OK to attempt to install the SAME | 868 | * It is (relatively) OK to attempt to install the SAME |
851 | * handler twice. This can easily happen with PCI_Config space. | 869 | * handler twice. This can easily happen |
870 | * with PCI_Config space. | ||
852 | */ | 871 | */ |
853 | status = AE_SAME_HANDLER; | 872 | status = AE_SAME_HANDLER; |
854 | goto unlock_and_exit; | 873 | goto unlock_and_exit; |
@@ -1011,7 +1030,7 @@ acpi_ev_execute_reg_methods ( | |||
1011 | * | 1030 | * |
1012 | ******************************************************************************/ | 1031 | ******************************************************************************/ |
1013 | 1032 | ||
1014 | acpi_status | 1033 | static acpi_status |
1015 | acpi_ev_reg_run ( | 1034 | acpi_ev_reg_run ( |
1016 | acpi_handle obj_handle, | 1035 | acpi_handle obj_handle, |
1017 | u32 level, | 1036 | u32 level, |
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c index 4983a3378be5..95bc09c73a6a 100644 --- a/drivers/acpi/events/evrgnini.c +++ b/drivers/acpi/events/evrgnini.c | |||
@@ -61,7 +61,7 @@ | |||
61 | * | 61 | * |
62 | * RETURN: Status | 62 | * RETURN: Status |
63 | * | 63 | * |
64 | * DESCRIPTION: Do any prep work for region handling, a nop for now | 64 | * DESCRIPTION: Setup a system_memory operation region |
65 | * | 65 | * |
66 | ******************************************************************************/ | 66 | ******************************************************************************/ |
67 | 67 | ||
@@ -115,7 +115,7 @@ acpi_ev_system_memory_region_setup ( | |||
115 | * | 115 | * |
116 | * RETURN: Status | 116 | * RETURN: Status |
117 | * | 117 | * |
118 | * DESCRIPTION: Do any prep work for region handling | 118 | * DESCRIPTION: Setup a IO operation region |
119 | * | 119 | * |
120 | ******************************************************************************/ | 120 | ******************************************************************************/ |
121 | 121 | ||
@@ -144,14 +144,14 @@ acpi_ev_io_space_region_setup ( | |||
144 | * | 144 | * |
145 | * FUNCTION: acpi_ev_pci_config_region_setup | 145 | * FUNCTION: acpi_ev_pci_config_region_setup |
146 | * | 146 | * |
147 | * PARAMETERS: Handle - Region we are interested in | 147 | * PARAMETERS: Handle - Region we are interested in |
148 | * Function - Start or stop | 148 | * Function - Start or stop |
149 | * handler_context - Address space handler context | 149 | * handler_context - Address space handler context |
150 | * region_context - Region specific context | 150 | * region_context - Region specific context |
151 | * | 151 | * |
152 | * RETURN: Status | 152 | * RETURN: Status |
153 | * | 153 | * |
154 | * DESCRIPTION: Do any prep work for region handling | 154 | * DESCRIPTION: Setup a PCI_Config operation region |
155 | * | 155 | * |
156 | * MUTEX: Assumes namespace is not locked | 156 | * MUTEX: Assumes namespace is not locked |
157 | * | 157 | * |
@@ -324,7 +324,7 @@ acpi_ev_pci_config_region_setup ( | |||
324 | * | 324 | * |
325 | * RETURN: Status | 325 | * RETURN: Status |
326 | * | 326 | * |
327 | * DESCRIPTION: Do any prep work for region handling | 327 | * DESCRIPTION: Setup a pci_bAR operation region |
328 | * | 328 | * |
329 | * MUTEX: Assumes namespace is not locked | 329 | * MUTEX: Assumes namespace is not locked |
330 | * | 330 | * |
@@ -355,7 +355,7 @@ acpi_ev_pci_bar_region_setup ( | |||
355 | * | 355 | * |
356 | * RETURN: Status | 356 | * RETURN: Status |
357 | * | 357 | * |
358 | * DESCRIPTION: Do any prep work for region handling | 358 | * DESCRIPTION: Setup a CMOS operation region |
359 | * | 359 | * |
360 | * MUTEX: Assumes namespace is not locked | 360 | * MUTEX: Assumes namespace is not locked |
361 | * | 361 | * |
@@ -386,7 +386,7 @@ acpi_ev_cmos_region_setup ( | |||
386 | * | 386 | * |
387 | * RETURN: Status | 387 | * RETURN: Status |
388 | * | 388 | * |
389 | * DESCRIPTION: Do any prep work for region handling | 389 | * DESCRIPTION: Default region initialization |
390 | * | 390 | * |
391 | ******************************************************************************/ | 391 | ******************************************************************************/ |
392 | 392 | ||
diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c index 46b31995c827..f3123c26ae98 100644 --- a/drivers/acpi/events/evsci.c +++ b/drivers/acpi/events/evsci.c | |||
@@ -49,6 +49,12 @@ | |||
49 | #define _COMPONENT ACPI_EVENTS | 49 | #define _COMPONENT ACPI_EVENTS |
50 | ACPI_MODULE_NAME ("evsci") | 50 | ACPI_MODULE_NAME ("evsci") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static u32 ACPI_SYSTEM_XFACE | ||
55 | acpi_ev_sci_xrupt_handler ( | ||
56 | void *context); | ||
57 | |||
52 | 58 | ||
53 | /******************************************************************************* | 59 | /******************************************************************************* |
54 | * | 60 | * |
@@ -146,7 +152,8 @@ acpi_ev_gpe_xrupt_handler ( | |||
146 | ******************************************************************************/ | 152 | ******************************************************************************/ |
147 | 153 | ||
148 | u32 | 154 | u32 |
149 | acpi_ev_install_sci_handler (void) | 155 | acpi_ev_install_sci_handler ( |
156 | void) | ||
150 | { | 157 | { |
151 | u32 status = AE_OK; | 158 | u32 status = AE_OK; |
152 | 159 | ||
@@ -180,7 +187,8 @@ acpi_ev_install_sci_handler (void) | |||
180 | ******************************************************************************/ | 187 | ******************************************************************************/ |
181 | 188 | ||
182 | acpi_status | 189 | acpi_status |
183 | acpi_ev_remove_sci_handler (void) | 190 | acpi_ev_remove_sci_handler ( |
191 | void) | ||
184 | { | 192 | { |
185 | acpi_status status; | 193 | acpi_status status; |
186 | 194 | ||
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index 0bfec10a5f1e..4092d47f6758 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c | |||
@@ -64,6 +64,7 @@ | |||
64 | * DESCRIPTION: Saves the pointer to the handler function | 64 | * DESCRIPTION: Saves the pointer to the handler function |
65 | * | 65 | * |
66 | ******************************************************************************/ | 66 | ******************************************************************************/ |
67 | |||
67 | #ifdef ACPI_FUTURE_USAGE | 68 | #ifdef ACPI_FUTURE_USAGE |
68 | acpi_status | 69 | acpi_status |
69 | acpi_install_exception_handler ( | 70 | acpi_install_exception_handler ( |
@@ -457,7 +458,8 @@ acpi_remove_notify_handler ( | |||
457 | /* Root Object */ | 458 | /* Root Object */ |
458 | 459 | ||
459 | if (device == ACPI_ROOT_OBJECT) { | 460 | if (device == ACPI_ROOT_OBJECT) { |
460 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing notify handler for ROOT object.\n")); | 461 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
462 | "Removing notify handler for ROOT object.\n")); | ||
461 | 463 | ||
462 | if (((handler_type & ACPI_SYSTEM_NOTIFY) && | 464 | if (((handler_type & ACPI_SYSTEM_NOTIFY) && |
463 | !acpi_gbl_system_notify.handler) || | 465 | !acpi_gbl_system_notify.handler) || |
@@ -564,8 +566,9 @@ EXPORT_SYMBOL(acpi_remove_notify_handler); | |||
564 | * | 566 | * |
565 | * FUNCTION: acpi_install_gpe_handler | 567 | * FUNCTION: acpi_install_gpe_handler |
566 | * | 568 | * |
567 | * PARAMETERS: gpe_number - The GPE number within the GPE block | 569 | * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT |
568 | * gpe_block - GPE block (NULL == FADT GPEs) | 570 | * defined GPEs) |
571 | * gpe_number - The GPE number within the GPE block | ||
569 | * Type - Whether this GPE should be treated as an | 572 | * Type - Whether this GPE should be treated as an |
570 | * edge- or level-triggered interrupt. | 573 | * edge- or level-triggered interrupt. |
571 | * Address - Address of the handler | 574 | * Address - Address of the handler |
@@ -662,8 +665,9 @@ EXPORT_SYMBOL(acpi_install_gpe_handler); | |||
662 | * | 665 | * |
663 | * FUNCTION: acpi_remove_gpe_handler | 666 | * FUNCTION: acpi_remove_gpe_handler |
664 | * | 667 | * |
665 | * PARAMETERS: gpe_number - The event to remove a handler | 668 | * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT |
666 | * gpe_block - GPE block (NULL == FADT GPEs) | 669 | * defined GPEs) |
670 | * gpe_number - The event to remove a handler | ||
667 | * Address - Address of the handler | 671 | * Address - Address of the handler |
668 | * | 672 | * |
669 | * RETURN: Status | 673 | * RETURN: Status |
@@ -766,7 +770,8 @@ EXPORT_SYMBOL(acpi_remove_gpe_handler); | |||
766 | * FUNCTION: acpi_acquire_global_lock | 770 | * FUNCTION: acpi_acquire_global_lock |
767 | * | 771 | * |
768 | * PARAMETERS: Timeout - How long the caller is willing to wait | 772 | * PARAMETERS: Timeout - How long the caller is willing to wait |
769 | * out_handle - A handle to the lock if acquired | 773 | * Handle - Where the handle to the lock is returned |
774 | * (if acquired) | ||
770 | * | 775 | * |
771 | * RETURN: Status | 776 | * RETURN: Status |
772 | * | 777 | * |
@@ -812,7 +817,7 @@ EXPORT_SYMBOL(acpi_acquire_global_lock); | |||
812 | * | 817 | * |
813 | * RETURN: Status | 818 | * RETURN: Status |
814 | * | 819 | * |
815 | * DESCRIPTION: Release the ACPI Global Lock | 820 | * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid. |
816 | * | 821 | * |
817 | ******************************************************************************/ | 822 | ******************************************************************************/ |
818 | 823 | ||
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index fa8d5f25be62..f337dc2cc569 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c | |||
@@ -64,7 +64,8 @@ | |||
64 | ******************************************************************************/ | 64 | ******************************************************************************/ |
65 | 65 | ||
66 | acpi_status | 66 | acpi_status |
67 | acpi_enable (void) | 67 | acpi_enable ( |
68 | void) | ||
68 | { | 69 | { |
69 | acpi_status status = AE_OK; | 70 | acpi_status status = AE_OK; |
70 | 71 | ||
@@ -91,7 +92,8 @@ acpi_enable (void) | |||
91 | return_ACPI_STATUS (status); | 92 | return_ACPI_STATUS (status); |
92 | } | 93 | } |
93 | 94 | ||
94 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Transition to ACPI mode successful\n")); | 95 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, |
96 | "Transition to ACPI mode successful\n")); | ||
95 | } | 97 | } |
96 | 98 | ||
97 | return_ACPI_STATUS (status); | 99 | return_ACPI_STATUS (status); |
@@ -106,12 +108,13 @@ acpi_enable (void) | |||
106 | * | 108 | * |
107 | * RETURN: Status | 109 | * RETURN: Status |
108 | * | 110 | * |
109 | * DESCRIPTION: Transfers the system into LEGACY mode. | 111 | * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode. |
110 | * | 112 | * |
111 | ******************************************************************************/ | 113 | ******************************************************************************/ |
112 | 114 | ||
113 | acpi_status | 115 | acpi_status |
114 | acpi_disable (void) | 116 | acpi_disable ( |
117 | void) | ||
115 | { | 118 | { |
116 | acpi_status status = AE_OK; | 119 | acpi_status status = AE_OK; |
117 | 120 | ||
@@ -125,7 +128,8 @@ acpi_disable (void) | |||
125 | } | 128 | } |
126 | 129 | ||
127 | if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) { | 130 | if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) { |
128 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in legacy (non-ACPI) mode\n")); | 131 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, |
132 | "System is already in legacy (non-ACPI) mode\n")); | ||
129 | } | 133 | } |
130 | else { | 134 | else { |
131 | /* Transition to LEGACY mode */ | 135 | /* Transition to LEGACY mode */ |
@@ -133,7 +137,8 @@ acpi_disable (void) | |||
133 | status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY); | 137 | status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY); |
134 | 138 | ||
135 | if (ACPI_FAILURE (status)) { | 139 | if (ACPI_FAILURE (status)) { |
136 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not exit ACPI mode to legacy mode")); | 140 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
141 | "Could not exit ACPI mode to legacy mode")); | ||
137 | return_ACPI_STATUS (status); | 142 | return_ACPI_STATUS (status); |
138 | } | 143 | } |
139 | 144 | ||
@@ -214,7 +219,7 @@ EXPORT_SYMBOL(acpi_enable_event); | |||
214 | * | 219 | * |
215 | * RETURN: Status | 220 | * RETURN: Status |
216 | * | 221 | * |
217 | * DESCRIPTION: Enable an ACPI event (general purpose) | 222 | * DESCRIPTION: Set the type of an individual GPE |
218 | * | 223 | * |
219 | ******************************************************************************/ | 224 | ******************************************************************************/ |
220 | 225 | ||
@@ -519,13 +524,12 @@ unlock_and_exit: | |||
519 | 524 | ||
520 | 525 | ||
521 | #ifdef ACPI_FUTURE_USAGE | 526 | #ifdef ACPI_FUTURE_USAGE |
522 | |||
523 | /******************************************************************************* | 527 | /******************************************************************************* |
524 | * | 528 | * |
525 | * FUNCTION: acpi_get_event_status | 529 | * FUNCTION: acpi_get_event_status |
526 | * | 530 | * |
527 | * PARAMETERS: Event - The fixed event | 531 | * PARAMETERS: Event - The fixed event |
528 | * Event Status - Where the current status of the event will | 532 | * event_status - Where the current status of the event will |
529 | * be returned | 533 | * be returned |
530 | * | 534 | * |
531 | * RETURN: Status | 535 | * RETURN: Status |
@@ -571,7 +575,7 @@ acpi_get_event_status ( | |||
571 | * PARAMETERS: gpe_device - Parent GPE Device | 575 | * PARAMETERS: gpe_device - Parent GPE Device |
572 | * gpe_number - GPE level within the GPE block | 576 | * gpe_number - GPE level within the GPE block |
573 | * Flags - Called from an ISR or not | 577 | * Flags - Called from an ISR or not |
574 | * Event Status - Where the current status of the event will | 578 | * event_status - Where the current status of the event will |
575 | * be returned | 579 | * be returned |
576 | * | 580 | * |
577 | * RETURN: Status | 581 | * RETURN: Status |
@@ -775,4 +779,5 @@ unlock_and_exit: | |||
775 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 779 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); |
776 | return_ACPI_STATUS (status); | 780 | return_ACPI_STATUS (status); |
777 | } | 781 | } |
782 | |||
778 | EXPORT_SYMBOL(acpi_remove_gpe_block); | 783 | EXPORT_SYMBOL(acpi_remove_gpe_block); |
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index ac3c061967f2..734b2f24af48 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c | |||
@@ -54,6 +54,14 @@ | |||
54 | #define _COMPONENT ACPI_EXECUTER | 54 | #define _COMPONENT ACPI_EXECUTER |
55 | ACPI_MODULE_NAME ("exconfig") | 55 | ACPI_MODULE_NAME ("exconfig") |
56 | 56 | ||
57 | /* Local prototypes */ | ||
58 | |||
59 | static acpi_status | ||
60 | acpi_ex_add_table ( | ||
61 | struct acpi_table_header *table, | ||
62 | struct acpi_namespace_node *parent_node, | ||
63 | union acpi_operand_object **ddb_handle); | ||
64 | |||
57 | 65 | ||
58 | /******************************************************************************* | 66 | /******************************************************************************* |
59 | * | 67 | * |
@@ -70,7 +78,7 @@ | |||
70 | * | 78 | * |
71 | ******************************************************************************/ | 79 | ******************************************************************************/ |
72 | 80 | ||
73 | acpi_status | 81 | static acpi_status |
74 | acpi_ex_add_table ( | 82 | acpi_ex_add_table ( |
75 | struct acpi_table_header *table, | 83 | struct acpi_table_header *table, |
76 | struct acpi_namespace_node *parent_node, | 84 | struct acpi_namespace_node *parent_node, |
@@ -95,10 +103,10 @@ acpi_ex_add_table ( | |||
95 | 103 | ||
96 | ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc)); | 104 | ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc)); |
97 | 105 | ||
98 | table_info.type = ACPI_TABLE_SSDT; | 106 | table_info.type = ACPI_TABLE_SSDT; |
99 | table_info.pointer = table; | 107 | table_info.pointer = table; |
100 | table_info.length = (acpi_size) table->length; | 108 | table_info.length = (acpi_size) table->length; |
101 | table_info.allocation = ACPI_MEM_ALLOCATED; | 109 | table_info.allocation = ACPI_MEM_ALLOCATED; |
102 | 110 | ||
103 | status = acpi_tb_install_table (&table_info); | 111 | status = acpi_tb_install_table (&table_info); |
104 | if (ACPI_FAILURE (status)) { | 112 | if (ACPI_FAILURE (status)) { |
@@ -226,11 +234,10 @@ acpi_ex_load_table_op ( | |||
226 | start_node = parent_node; | 234 | start_node = parent_node; |
227 | } | 235 | } |
228 | 236 | ||
229 | /* | 237 | /* Find the node referenced by the parameter_path_string */ |
230 | * Find the node referenced by the parameter_path_string | 238 | |
231 | */ | ||
232 | status = acpi_ns_get_node_by_path (operand[4]->string.pointer, start_node, | 239 | status = acpi_ns_get_node_by_path (operand[4]->string.pointer, start_node, |
233 | ACPI_NS_SEARCH_PARENT, ¶meter_node); | 240 | ACPI_NS_SEARCH_PARENT, ¶meter_node); |
234 | if (ACPI_FAILURE (status)) { | 241 | if (ACPI_FAILURE (status)) { |
235 | return_ACPI_STATUS (status); | 242 | return_ACPI_STATUS (status); |
236 | } | 243 | } |
@@ -248,7 +255,8 @@ acpi_ex_load_table_op ( | |||
248 | if (parameter_node) { | 255 | if (parameter_node) { |
249 | /* Store the parameter data into the optional parameter object */ | 256 | /* Store the parameter data into the optional parameter object */ |
250 | 257 | ||
251 | status = acpi_ex_store (operand[5], ACPI_CAST_PTR (union acpi_operand_object, parameter_node), | 258 | status = acpi_ex_store (operand[5], |
259 | ACPI_CAST_PTR (union acpi_operand_object, parameter_node), | ||
252 | walk_state); | 260 | walk_state); |
253 | if (ACPI_FAILURE (status)) { | 261 | if (ACPI_FAILURE (status)) { |
254 | (void) acpi_ex_unload_table (ddb_handle); | 262 | (void) acpi_ex_unload_table (ddb_handle); |
@@ -371,7 +379,8 @@ acpi_ex_load_op ( | |||
371 | goto cleanup; | 379 | goto cleanup; |
372 | } | 380 | } |
373 | 381 | ||
374 | table_ptr = ACPI_CAST_PTR (struct acpi_table_header, buffer_desc->buffer.pointer); | 382 | table_ptr = ACPI_CAST_PTR (struct acpi_table_header, |
383 | buffer_desc->buffer.pointer); | ||
375 | 384 | ||
376 | /* Sanity check the table length */ | 385 | /* Sanity check the table length */ |
377 | 386 | ||
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index df7ba1219bf6..97856c48bd74 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c | |||
@@ -50,6 +50,15 @@ | |||
50 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME ("exconvrt") | 51 | ACPI_MODULE_NAME ("exconvrt") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
54 | |||
55 | static u32 | ||
56 | acpi_ex_convert_to_ascii ( | ||
57 | acpi_integer integer, | ||
58 | u16 base, | ||
59 | u8 *string, | ||
60 | u8 max_length); | ||
61 | |||
53 | 62 | ||
54 | /******************************************************************************* | 63 | /******************************************************************************* |
55 | * | 64 | * |
@@ -115,9 +124,8 @@ acpi_ex_convert_to_integer ( | |||
115 | */ | 124 | */ |
116 | result = 0; | 125 | result = 0; |
117 | 126 | ||
118 | /* | 127 | /* String conversion is different than Buffer conversion */ |
119 | * String conversion is different than Buffer conversion | 128 | |
120 | */ | ||
121 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 129 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { |
122 | case ACPI_TYPE_STRING: | 130 | case ACPI_TYPE_STRING: |
123 | 131 | ||
@@ -168,9 +176,8 @@ acpi_ex_convert_to_integer ( | |||
168 | break; | 176 | break; |
169 | } | 177 | } |
170 | 178 | ||
171 | /* | 179 | /* Create a new integer */ |
172 | * Create a new integer | 180 | |
173 | */ | ||
174 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 181 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); |
175 | if (!return_desc) { | 182 | if (!return_desc) { |
176 | return_ACPI_STATUS (AE_NO_MEMORY); | 183 | return_ACPI_STATUS (AE_NO_MEMORY); |
@@ -251,7 +258,8 @@ acpi_ex_convert_to_buffer ( | |||
251 | * ASL/AML code that depends on the null being transferred to the new | 258 | * ASL/AML code that depends on the null being transferred to the new |
252 | * buffer. | 259 | * buffer. |
253 | */ | 260 | */ |
254 | return_desc = acpi_ut_create_buffer_object ((acpi_size) obj_desc->string.length + 1); | 261 | return_desc = acpi_ut_create_buffer_object ( |
262 | (acpi_size) obj_desc->string.length + 1); | ||
255 | if (!return_desc) { | 263 | if (!return_desc) { |
256 | return_ACPI_STATUS (AE_NO_MEMORY); | 264 | return_ACPI_STATUS (AE_NO_MEMORY); |
257 | } | 265 | } |
@@ -291,7 +299,7 @@ acpi_ex_convert_to_buffer ( | |||
291 | * | 299 | * |
292 | ******************************************************************************/ | 300 | ******************************************************************************/ |
293 | 301 | ||
294 | u32 | 302 | static u32 |
295 | acpi_ex_convert_to_ascii ( | 303 | acpi_ex_convert_to_ascii ( |
296 | acpi_integer integer, | 304 | acpi_integer integer, |
297 | u16 base, | 305 | u16 base, |
@@ -357,8 +365,9 @@ acpi_ex_convert_to_ascii ( | |||
357 | 365 | ||
358 | case 16: | 366 | case 16: |
359 | 367 | ||
360 | hex_length = ACPI_MUL_2 (data_width); /* 2 ascii hex chars per data byte */ | 368 | /* hex_length: 2 ascii hex chars per data byte */ |
361 | 369 | ||
370 | hex_length = ACPI_MUL_2 (data_width); | ||
362 | for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) { | 371 | for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) { |
363 | /* Get one hex digit, most significant digits first */ | 372 | /* Get one hex digit, most significant digits first */ |
364 | 373 | ||
@@ -475,7 +484,7 @@ acpi_ex_convert_to_string ( | |||
475 | /* Setup string length, base, and separator */ | 484 | /* Setup string length, base, and separator */ |
476 | 485 | ||
477 | switch (type) { | 486 | switch (type) { |
478 | case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string operator */ | 487 | case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string */ |
479 | /* | 488 | /* |
480 | * From ACPI: "If Data is a buffer, it is converted to a string of | 489 | * From ACPI: "If Data is a buffer, it is converted to a string of |
481 | * decimal values separated by commas." | 490 | * decimal values separated by commas." |
@@ -509,7 +518,7 @@ acpi_ex_convert_to_string ( | |||
509 | string_length = (obj_desc->buffer.length * 3); | 518 | string_length = (obj_desc->buffer.length * 3); |
510 | break; | 519 | break; |
511 | 520 | ||
512 | case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string operator */ | 521 | case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string */ |
513 | /* | 522 | /* |
514 | * From ACPI: "If Data is a buffer, it is converted to a string of | 523 | * From ACPI: "If Data is a buffer, it is converted to a string of |
515 | * hexadecimal values separated by commas." | 524 | * hexadecimal values separated by commas." |
@@ -530,9 +539,8 @@ acpi_ex_convert_to_string ( | |||
530 | return_ACPI_STATUS (AE_AML_STRING_LIMIT); | 539 | return_ACPI_STATUS (AE_AML_STRING_LIMIT); |
531 | } | 540 | } |
532 | 541 | ||
533 | /* | 542 | /* Create a new string object and string buffer */ |
534 | * Create a new string object and string buffer | 543 | |
535 | */ | ||
536 | return_desc = acpi_ut_create_string_object ((acpi_size) string_length); | 544 | return_desc = acpi_ut_create_string_object ((acpi_size) string_length); |
537 | if (!return_desc) { | 545 | if (!return_desc) { |
538 | return_ACPI_STATUS (AE_NO_MEMORY); | 546 | return_ACPI_STATUS (AE_NO_MEMORY); |
@@ -551,8 +559,10 @@ acpi_ex_convert_to_string ( | |||
551 | *new_buf++ = separator; /* each separated by a comma or space */ | 559 | *new_buf++ = separator; /* each separated by a comma or space */ |
552 | } | 560 | } |
553 | 561 | ||
554 | /* Null terminate the string (overwrites final comma/space from above) */ | 562 | /* |
555 | 563 | * Null terminate the string | |
564 | * (overwrites final comma/space from above) | ||
565 | */ | ||
556 | new_buf--; | 566 | new_buf--; |
557 | *new_buf = 0; | 567 | *new_buf = 0; |
558 | break; | 568 | break; |
@@ -645,7 +655,6 @@ acpi_ex_convert_to_target_type ( | |||
645 | 655 | ||
646 | 656 | ||
647 | case ACPI_TYPE_STRING: | 657 | case ACPI_TYPE_STRING: |
648 | |||
649 | /* | 658 | /* |
650 | * The operand must be a String. We can convert an | 659 | * The operand must be a String. We can convert an |
651 | * Integer or Buffer if necessary | 660 | * Integer or Buffer if necessary |
@@ -656,7 +665,6 @@ acpi_ex_convert_to_target_type ( | |||
656 | 665 | ||
657 | 666 | ||
658 | case ACPI_TYPE_BUFFER: | 667 | case ACPI_TYPE_BUFFER: |
659 | |||
660 | /* | 668 | /* |
661 | * The operand must be a Buffer. We can convert an | 669 | * The operand must be a Buffer. We can convert an |
662 | * Integer or String if necessary | 670 | * Integer or String if necessary |
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index d94c260dac6d..812cdcb2e370 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c | |||
@@ -55,7 +55,7 @@ | |||
55 | 55 | ||
56 | 56 | ||
57 | #ifndef ACPI_NO_METHOD_EXECUTION | 57 | #ifndef ACPI_NO_METHOD_EXECUTION |
58 | /***************************************************************************** | 58 | /******************************************************************************* |
59 | * | 59 | * |
60 | * FUNCTION: acpi_ex_create_alias | 60 | * FUNCTION: acpi_ex_create_alias |
61 | * | 61 | * |
@@ -65,7 +65,7 @@ | |||
65 | * | 65 | * |
66 | * DESCRIPTION: Create a new named alias | 66 | * DESCRIPTION: Create a new named alias |
67 | * | 67 | * |
68 | ****************************************************************************/ | 68 | ******************************************************************************/ |
69 | 69 | ||
70 | acpi_status | 70 | acpi_status |
71 | acpi_ex_create_alias ( | 71 | acpi_ex_create_alias ( |
@@ -140,8 +140,7 @@ acpi_ex_create_alias ( | |||
140 | * target node or the alias Node | 140 | * target node or the alias Node |
141 | */ | 141 | */ |
142 | status = acpi_ns_attach_object (alias_node, | 142 | status = acpi_ns_attach_object (alias_node, |
143 | acpi_ns_get_attached_object (target_node), | 143 | acpi_ns_get_attached_object (target_node), target_node->type); |
144 | target_node->type); | ||
145 | break; | 144 | break; |
146 | } | 145 | } |
147 | 146 | ||
@@ -151,7 +150,7 @@ acpi_ex_create_alias ( | |||
151 | } | 150 | } |
152 | 151 | ||
153 | 152 | ||
154 | /***************************************************************************** | 153 | /******************************************************************************* |
155 | * | 154 | * |
156 | * FUNCTION: acpi_ex_create_event | 155 | * FUNCTION: acpi_ex_create_event |
157 | * | 156 | * |
@@ -161,7 +160,7 @@ acpi_ex_create_alias ( | |||
161 | * | 160 | * |
162 | * DESCRIPTION: Create a new event object | 161 | * DESCRIPTION: Create a new event object |
163 | * | 162 | * |
164 | ****************************************************************************/ | 163 | ******************************************************************************/ |
165 | 164 | ||
166 | acpi_status | 165 | acpi_status |
167 | acpi_ex_create_event ( | 166 | acpi_ex_create_event ( |
@@ -185,7 +184,7 @@ acpi_ex_create_event ( | |||
185 | * that the event is created in an unsignalled state | 184 | * that the event is created in an unsignalled state |
186 | */ | 185 | */ |
187 | status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, | 186 | status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, |
188 | &obj_desc->event.semaphore); | 187 | &obj_desc->event.semaphore); |
189 | if (ACPI_FAILURE (status)) { | 188 | if (ACPI_FAILURE (status)) { |
190 | goto cleanup; | 189 | goto cleanup; |
191 | } | 190 | } |
@@ -193,7 +192,7 @@ acpi_ex_create_event ( | |||
193 | /* Attach object to the Node */ | 192 | /* Attach object to the Node */ |
194 | 193 | ||
195 | status = acpi_ns_attach_object ((struct acpi_namespace_node *) walk_state->operands[0], | 194 | status = acpi_ns_attach_object ((struct acpi_namespace_node *) walk_state->operands[0], |
196 | obj_desc, ACPI_TYPE_EVENT); | 195 | obj_desc, ACPI_TYPE_EVENT); |
197 | 196 | ||
198 | cleanup: | 197 | cleanup: |
199 | /* | 198 | /* |
@@ -205,7 +204,7 @@ cleanup: | |||
205 | } | 204 | } |
206 | 205 | ||
207 | 206 | ||
208 | /***************************************************************************** | 207 | /******************************************************************************* |
209 | * | 208 | * |
210 | * FUNCTION: acpi_ex_create_mutex | 209 | * FUNCTION: acpi_ex_create_mutex |
211 | * | 210 | * |
@@ -217,7 +216,7 @@ cleanup: | |||
217 | * | 216 | * |
218 | * Mutex (Name[0], sync_level[1]) | 217 | * Mutex (Name[0], sync_level[1]) |
219 | * | 218 | * |
220 | ****************************************************************************/ | 219 | ******************************************************************************/ |
221 | 220 | ||
222 | acpi_status | 221 | acpi_status |
223 | acpi_ex_create_mutex ( | 222 | acpi_ex_create_mutex ( |
@@ -267,20 +266,20 @@ cleanup: | |||
267 | } | 266 | } |
268 | 267 | ||
269 | 268 | ||
270 | /***************************************************************************** | 269 | /******************************************************************************* |
271 | * | 270 | * |
272 | * FUNCTION: acpi_ex_create_region | 271 | * FUNCTION: acpi_ex_create_region |
273 | * | 272 | * |
274 | * PARAMETERS: aml_start - Pointer to the region declaration AML | 273 | * PARAMETERS: aml_start - Pointer to the region declaration AML |
275 | * aml_length - Max length of the declaration AML | 274 | * aml_length - Max length of the declaration AML |
276 | * Operands - List of operands for the opcode | 275 | * region_space - space_iD for the region |
277 | * walk_state - Current state | 276 | * walk_state - Current state |
278 | * | 277 | * |
279 | * RETURN: Status | 278 | * RETURN: Status |
280 | * | 279 | * |
281 | * DESCRIPTION: Create a new operation region object | 280 | * DESCRIPTION: Create a new operation region object |
282 | * | 281 | * |
283 | ****************************************************************************/ | 282 | ******************************************************************************/ |
284 | 283 | ||
285 | acpi_status | 284 | acpi_status |
286 | acpi_ex_create_region ( | 285 | acpi_ex_create_region ( |
@@ -321,7 +320,7 @@ acpi_ex_create_region ( | |||
321 | } | 320 | } |
322 | 321 | ||
323 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n", | 322 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n", |
324 | acpi_ut_get_region_name (region_space), region_space)); | 323 | acpi_ut_get_region_name (region_space), region_space)); |
325 | 324 | ||
326 | /* Create the region descriptor */ | 325 | /* Create the region descriptor */ |
327 | 326 | ||
@@ -360,7 +359,7 @@ cleanup: | |||
360 | } | 359 | } |
361 | 360 | ||
362 | 361 | ||
363 | /***************************************************************************** | 362 | /******************************************************************************* |
364 | * | 363 | * |
365 | * FUNCTION: acpi_ex_create_table_region | 364 | * FUNCTION: acpi_ex_create_table_region |
366 | * | 365 | * |
@@ -370,7 +369,7 @@ cleanup: | |||
370 | * | 369 | * |
371 | * DESCRIPTION: Create a new data_table_region object | 370 | * DESCRIPTION: Create a new data_table_region object |
372 | * | 371 | * |
373 | ****************************************************************************/ | 372 | ******************************************************************************/ |
374 | 373 | ||
375 | acpi_status | 374 | acpi_status |
376 | acpi_ex_create_table_region ( | 375 | acpi_ex_create_table_region ( |
@@ -455,7 +454,7 @@ cleanup: | |||
455 | } | 454 | } |
456 | 455 | ||
457 | 456 | ||
458 | /***************************************************************************** | 457 | /******************************************************************************* |
459 | * | 458 | * |
460 | * FUNCTION: acpi_ex_create_processor | 459 | * FUNCTION: acpi_ex_create_processor |
461 | * | 460 | * |
@@ -467,7 +466,7 @@ cleanup: | |||
467 | * | 466 | * |
468 | * Processor (Name[0], cpu_iD[1], pblock_addr[2], pblock_length[3]) | 467 | * Processor (Name[0], cpu_iD[1], pblock_addr[2], pblock_length[3]) |
469 | * | 468 | * |
470 | ****************************************************************************/ | 469 | ******************************************************************************/ |
471 | 470 | ||
472 | acpi_status | 471 | acpi_status |
473 | acpi_ex_create_processor ( | 472 | acpi_ex_create_processor ( |
@@ -488,9 +487,8 @@ acpi_ex_create_processor ( | |||
488 | return_ACPI_STATUS (AE_NO_MEMORY); | 487 | return_ACPI_STATUS (AE_NO_MEMORY); |
489 | } | 488 | } |
490 | 489 | ||
491 | /* | 490 | /* Initialize the processor object from the operands */ |
492 | * Initialize the processor object from the operands | 491 | |
493 | */ | ||
494 | obj_desc->processor.proc_id = (u8) operand[1]->integer.value; | 492 | obj_desc->processor.proc_id = (u8) operand[1]->integer.value; |
495 | obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value; | 493 | obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value; |
496 | obj_desc->processor.length = (u8) operand[3]->integer.value; | 494 | obj_desc->processor.length = (u8) operand[3]->integer.value; |
@@ -507,7 +505,7 @@ acpi_ex_create_processor ( | |||
507 | } | 505 | } |
508 | 506 | ||
509 | 507 | ||
510 | /***************************************************************************** | 508 | /******************************************************************************* |
511 | * | 509 | * |
512 | * FUNCTION: acpi_ex_create_power_resource | 510 | * FUNCTION: acpi_ex_create_power_resource |
513 | * | 511 | * |
@@ -519,7 +517,7 @@ acpi_ex_create_processor ( | |||
519 | * | 517 | * |
520 | * power_resource (Name[0], system_level[1], resource_order[2]) | 518 | * power_resource (Name[0], system_level[1], resource_order[2]) |
521 | * | 519 | * |
522 | ****************************************************************************/ | 520 | ******************************************************************************/ |
523 | 521 | ||
524 | acpi_status | 522 | acpi_status |
525 | acpi_ex_create_power_resource ( | 523 | acpi_ex_create_power_resource ( |
@@ -555,10 +553,10 @@ acpi_ex_create_power_resource ( | |||
555 | acpi_ut_remove_reference (obj_desc); | 553 | acpi_ut_remove_reference (obj_desc); |
556 | return_ACPI_STATUS (status); | 554 | return_ACPI_STATUS (status); |
557 | } | 555 | } |
558 | |||
559 | #endif | 556 | #endif |
560 | 557 | ||
561 | /***************************************************************************** | 558 | |
559 | /******************************************************************************* | ||
562 | * | 560 | * |
563 | * FUNCTION: acpi_ex_create_method | 561 | * FUNCTION: acpi_ex_create_method |
564 | * | 562 | * |
@@ -570,7 +568,7 @@ acpi_ex_create_power_resource ( | |||
570 | * | 568 | * |
571 | * DESCRIPTION: Create a new method object | 569 | * DESCRIPTION: Create a new method object |
572 | * | 570 | * |
573 | ****************************************************************************/ | 571 | ******************************************************************************/ |
574 | 572 | ||
575 | acpi_status | 573 | acpi_status |
576 | acpi_ex_create_method ( | 574 | acpi_ex_create_method ( |
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index e2f7c32f28de..408500648114 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c | |||
@@ -51,23 +51,48 @@ | |||
51 | #define _COMPONENT ACPI_EXECUTER | 51 | #define _COMPONENT ACPI_EXECUTER |
52 | ACPI_MODULE_NAME ("exdump") | 52 | ACPI_MODULE_NAME ("exdump") |
53 | 53 | ||
54 | /* Local prototypes */ | ||
55 | |||
56 | #ifdef ACPI_FUTURE_USAGE | ||
57 | static void | ||
58 | acpi_ex_out_string ( | ||
59 | char *title, | ||
60 | char *value); | ||
61 | |||
62 | static void | ||
63 | acpi_ex_out_pointer ( | ||
64 | char *title, | ||
65 | void *value); | ||
66 | |||
67 | static void | ||
68 | acpi_ex_out_integer ( | ||
69 | char *title, | ||
70 | u32 value); | ||
71 | |||
72 | static void | ||
73 | acpi_ex_out_address ( | ||
74 | char *title, | ||
75 | acpi_physical_address value); | ||
76 | #endif /* ACPI_FUTURE_USAGE */ | ||
77 | |||
54 | 78 | ||
55 | /* | 79 | /* |
56 | * The following routines are used for debug output only | 80 | * The following routines are used for debug output only |
57 | */ | 81 | */ |
58 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 82 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
59 | 83 | ||
60 | /***************************************************************************** | 84 | /******************************************************************************* |
61 | * | 85 | * |
62 | * FUNCTION: acpi_ex_dump_operand | 86 | * FUNCTION: acpi_ex_dump_operand |
63 | * | 87 | * |
64 | * PARAMETERS: *obj_desc - Pointer to entry to be dumped | 88 | * PARAMETERS: *obj_desc - Pointer to entry to be dumped |
89 | * Depth - Current nesting depth | ||
65 | * | 90 | * |
66 | * RETURN: None | 91 | * RETURN: None |
67 | * | 92 | * |
68 | * DESCRIPTION: Dump an operand object | 93 | * DESCRIPTION: Dump an operand object |
69 | * | 94 | * |
70 | ****************************************************************************/ | 95 | ******************************************************************************/ |
71 | 96 | ||
72 | void | 97 | void |
73 | acpi_ex_dump_operand ( | 98 | acpi_ex_dump_operand ( |
@@ -86,9 +111,8 @@ acpi_ex_dump_operand ( | |||
86 | } | 111 | } |
87 | 112 | ||
88 | if (!obj_desc) { | 113 | if (!obj_desc) { |
89 | /* | 114 | /* This could be a null element of a package */ |
90 | * This could be a null element of a package | 115 | |
91 | */ | ||
92 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n")); | 116 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n")); |
93 | return; | 117 | return; |
94 | } | 118 | } |
@@ -117,6 +141,8 @@ acpi_ex_dump_operand ( | |||
117 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc)); | 141 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc)); |
118 | } | 142 | } |
119 | 143 | ||
144 | /* Decode object type */ | ||
145 | |||
120 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 146 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { |
121 | case ACPI_TYPE_LOCAL_REFERENCE: | 147 | case ACPI_TYPE_LOCAL_REFERENCE: |
122 | 148 | ||
@@ -274,7 +300,9 @@ acpi_ex_dump_operand ( | |||
274 | case ACPI_TYPE_STRING: | 300 | case ACPI_TYPE_STRING: |
275 | 301 | ||
276 | acpi_os_printf ("String length %X @ %p ", | 302 | acpi_os_printf ("String length %X @ %p ", |
277 | obj_desc->string.length, obj_desc->string.pointer); | 303 | obj_desc->string.length, |
304 | obj_desc->string.pointer); | ||
305 | |||
278 | acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX); | 306 | acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX); |
279 | acpi_os_printf ("\n"); | 307 | acpi_os_printf ("\n"); |
280 | break; | 308 | break; |
@@ -290,10 +318,13 @@ acpi_ex_dump_operand ( | |||
290 | 318 | ||
291 | acpi_os_printf ( | 319 | acpi_os_printf ( |
292 | "region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", | 320 | "region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", |
293 | obj_desc->field.bit_length, obj_desc->field.access_byte_width, | 321 | obj_desc->field.bit_length, |
322 | obj_desc->field.access_byte_width, | ||
294 | obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, | 323 | obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, |
295 | obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK, | 324 | obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK, |
296 | obj_desc->field.base_byte_offset, obj_desc->field.start_field_bit_offset); | 325 | obj_desc->field.base_byte_offset, |
326 | obj_desc->field.start_field_bit_offset); | ||
327 | |||
297 | acpi_ex_dump_operand (obj_desc->field.region_obj, depth+1); | 328 | acpi_ex_dump_operand (obj_desc->field.region_obj, depth+1); |
298 | break; | 329 | break; |
299 | 330 | ||
@@ -308,13 +339,15 @@ acpi_ex_dump_operand ( | |||
308 | 339 | ||
309 | acpi_os_printf ( | 340 | acpi_os_printf ( |
310 | "buffer_field: %X bits at byte %X bit %X of \n", | 341 | "buffer_field: %X bits at byte %X bit %X of \n", |
311 | obj_desc->buffer_field.bit_length, obj_desc->buffer_field.base_byte_offset, | 342 | obj_desc->buffer_field.bit_length, |
343 | obj_desc->buffer_field.base_byte_offset, | ||
312 | obj_desc->buffer_field.start_field_bit_offset); | 344 | obj_desc->buffer_field.start_field_bit_offset); |
313 | 345 | ||
314 | if (!obj_desc->buffer_field.buffer_obj) { | 346 | if (!obj_desc->buffer_field.buffer_obj) { |
315 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n")); | 347 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n")); |
316 | } | 348 | } |
317 | else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) != ACPI_TYPE_BUFFER) { | 349 | else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) != |
350 | ACPI_TYPE_BUFFER) { | ||
318 | acpi_os_printf ("*not a Buffer* \n"); | 351 | acpi_os_printf ("*not a Buffer* \n"); |
319 | } | 352 | } |
320 | else { | 353 | else { |
@@ -331,10 +364,10 @@ acpi_ex_dump_operand ( | |||
331 | 364 | ||
332 | case ACPI_TYPE_METHOD: | 365 | case ACPI_TYPE_METHOD: |
333 | 366 | ||
334 | acpi_os_printf ( | 367 | acpi_os_printf ("Method(%X) @ %p:%X\n", |
335 | "Method(%X) @ %p:%X\n", | ||
336 | obj_desc->method.param_count, | 368 | obj_desc->method.param_count, |
337 | obj_desc->method.aml_start, obj_desc->method.aml_length); | 369 | obj_desc->method.aml_start, |
370 | obj_desc->method.aml_length); | ||
338 | break; | 371 | break; |
339 | 372 | ||
340 | 373 | ||
@@ -379,7 +412,7 @@ acpi_ex_dump_operand ( | |||
379 | } | 412 | } |
380 | 413 | ||
381 | 414 | ||
382 | /***************************************************************************** | 415 | /******************************************************************************* |
383 | * | 416 | * |
384 | * FUNCTION: acpi_ex_dump_operands | 417 | * FUNCTION: acpi_ex_dump_operands |
385 | * | 418 | * |
@@ -393,7 +426,7 @@ acpi_ex_dump_operand ( | |||
393 | * | 426 | * |
394 | * DESCRIPTION: Dump the object stack | 427 | * DESCRIPTION: Dump the object stack |
395 | * | 428 | * |
396 | ****************************************************************************/ | 429 | ******************************************************************************/ |
397 | 430 | ||
398 | void | 431 | void |
399 | acpi_ex_dump_operands ( | 432 | acpi_ex_dump_operands ( |
@@ -441,10 +474,9 @@ acpi_ex_dump_operands ( | |||
441 | 474 | ||
442 | 475 | ||
443 | #ifdef ACPI_FUTURE_USAGE | 476 | #ifdef ACPI_FUTURE_USAGE |
444 | 477 | /******************************************************************************* | |
445 | /***************************************************************************** | ||
446 | * | 478 | * |
447 | * FUNCTION: acpi_ex_out* | 479 | * FUNCTION: acpi_ex_out* functions |
448 | * | 480 | * |
449 | * PARAMETERS: Title - Descriptive text | 481 | * PARAMETERS: Title - Descriptive text |
450 | * Value - Value to be displayed | 482 | * Value - Value to be displayed |
@@ -453,9 +485,9 @@ acpi_ex_dump_operands ( | |||
453 | * reduce the number of format strings required and keeps them | 485 | * reduce the number of format strings required and keeps them |
454 | * all in one place for easy modification. | 486 | * all in one place for easy modification. |
455 | * | 487 | * |
456 | ****************************************************************************/ | 488 | ******************************************************************************/ |
457 | 489 | ||
458 | void | 490 | static void |
459 | acpi_ex_out_string ( | 491 | acpi_ex_out_string ( |
460 | char *title, | 492 | char *title, |
461 | char *value) | 493 | char *value) |
@@ -463,7 +495,7 @@ acpi_ex_out_string ( | |||
463 | acpi_os_printf ("%20s : %s\n", title, value); | 495 | acpi_os_printf ("%20s : %s\n", title, value); |
464 | } | 496 | } |
465 | 497 | ||
466 | void | 498 | static void |
467 | acpi_ex_out_pointer ( | 499 | acpi_ex_out_pointer ( |
468 | char *title, | 500 | char *title, |
469 | void *value) | 501 | void *value) |
@@ -471,7 +503,7 @@ acpi_ex_out_pointer ( | |||
471 | acpi_os_printf ("%20s : %p\n", title, value); | 503 | acpi_os_printf ("%20s : %p\n", title, value); |
472 | } | 504 | } |
473 | 505 | ||
474 | void | 506 | static void |
475 | acpi_ex_out_integer ( | 507 | acpi_ex_out_integer ( |
476 | char *title, | 508 | char *title, |
477 | u32 value) | 509 | u32 value) |
@@ -479,7 +511,7 @@ acpi_ex_out_integer ( | |||
479 | acpi_os_printf ("%20s : %X\n", title, value); | 511 | acpi_os_printf ("%20s : %X\n", title, value); |
480 | } | 512 | } |
481 | 513 | ||
482 | void | 514 | static void |
483 | acpi_ex_out_address ( | 515 | acpi_ex_out_address ( |
484 | char *title, | 516 | char *title, |
485 | acpi_physical_address value) | 517 | acpi_physical_address value) |
@@ -493,16 +525,16 @@ acpi_ex_out_address ( | |||
493 | } | 525 | } |
494 | 526 | ||
495 | 527 | ||
496 | /***************************************************************************** | 528 | /******************************************************************************* |
497 | * | 529 | * |
498 | * FUNCTION: acpi_ex_dump_node | 530 | * FUNCTION: acpi_ex_dump_node |
499 | * | 531 | * |
500 | * PARAMETERS: *Node - Descriptor to dump | 532 | * PARAMETERS: *Node - Descriptor to dump |
501 | * Flags - Force display | 533 | * Flags - Force display if TRUE |
502 | * | 534 | * |
503 | * DESCRIPTION: Dumps the members of the given.Node | 535 | * DESCRIPTION: Dumps the members of the given.Node |
504 | * | 536 | * |
505 | ****************************************************************************/ | 537 | ******************************************************************************/ |
506 | 538 | ||
507 | void | 539 | void |
508 | acpi_ex_dump_node ( | 540 | acpi_ex_dump_node ( |
@@ -531,16 +563,16 @@ acpi_ex_dump_node ( | |||
531 | } | 563 | } |
532 | 564 | ||
533 | 565 | ||
534 | /***************************************************************************** | 566 | /******************************************************************************* |
535 | * | 567 | * |
536 | * FUNCTION: acpi_ex_dump_object_descriptor | 568 | * FUNCTION: acpi_ex_dump_object_descriptor |
537 | * | 569 | * |
538 | * PARAMETERS: *Object - Descriptor to dump | 570 | * PARAMETERS: *Object - Descriptor to dump |
539 | * Flags - Force display | 571 | * Flags - Force display if TRUE |
540 | * | 572 | * |
541 | * DESCRIPTION: Dumps the members of the object descriptor given. | 573 | * DESCRIPTION: Dumps the members of the object descriptor given. |
542 | * | 574 | * |
543 | ****************************************************************************/ | 575 | ******************************************************************************/ |
544 | 576 | ||
545 | void | 577 | void |
546 | acpi_ex_dump_object_descriptor ( | 578 | acpi_ex_dump_object_descriptor ( |
@@ -553,6 +585,10 @@ acpi_ex_dump_object_descriptor ( | |||
553 | ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor"); | 585 | ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor"); |
554 | 586 | ||
555 | 587 | ||
588 | if (!obj_desc) { | ||
589 | return_VOID; | ||
590 | } | ||
591 | |||
556 | if (!flags) { | 592 | if (!flags) { |
557 | if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) { | 593 | if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) { |
558 | return_VOID; | 594 | return_VOID; |
@@ -747,11 +783,17 @@ acpi_ex_dump_object_descriptor ( | |||
747 | case ACPI_TYPE_LOCAL_REFERENCE: | 783 | case ACPI_TYPE_LOCAL_REFERENCE: |
748 | 784 | ||
749 | acpi_ex_out_integer ("target_type", obj_desc->reference.target_type); | 785 | acpi_ex_out_integer ("target_type", obj_desc->reference.target_type); |
750 | acpi_ex_out_string ("Opcode", (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name); | 786 | acpi_ex_out_string ("Opcode", (acpi_ps_get_opcode_info ( |
787 | obj_desc->reference.opcode))->name); | ||
751 | acpi_ex_out_integer ("Offset", obj_desc->reference.offset); | 788 | acpi_ex_out_integer ("Offset", obj_desc->reference.offset); |
752 | acpi_ex_out_pointer ("obj_desc", obj_desc->reference.object); | 789 | acpi_ex_out_pointer ("obj_desc", obj_desc->reference.object); |
753 | acpi_ex_out_pointer ("Node", obj_desc->reference.node); | 790 | acpi_ex_out_pointer ("Node", obj_desc->reference.node); |
754 | acpi_ex_out_pointer ("Where", obj_desc->reference.where); | 791 | acpi_ex_out_pointer ("Where", obj_desc->reference.where); |
792 | |||
793 | if (obj_desc->reference.object) { | ||
794 | acpi_os_printf ("\nReferenced Object:\n"); | ||
795 | acpi_ex_dump_object_descriptor (obj_desc->reference.object, flags); | ||
796 | } | ||
755 | break; | 797 | break; |
756 | 798 | ||
757 | 799 | ||
@@ -788,6 +830,5 @@ acpi_ex_dump_object_descriptor ( | |||
788 | } | 830 | } |
789 | 831 | ||
790 | #endif /* ACPI_FUTURE_USAGE */ | 832 | #endif /* ACPI_FUTURE_USAGE */ |
791 | |||
792 | #endif | 833 | #endif |
793 | 834 | ||
diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c index be7f2124fa02..22c8fa480f60 100644 --- a/drivers/acpi/executer/exfield.c +++ b/drivers/acpi/executer/exfield.c | |||
@@ -120,8 +120,8 @@ acpi_ex_read_data_from_field ( | |||
120 | * Note: Smbus protocol value is passed in upper 16-bits of Function | 120 | * Note: Smbus protocol value is passed in upper 16-bits of Function |
121 | */ | 121 | */ |
122 | status = acpi_ex_access_region (obj_desc, 0, | 122 | status = acpi_ex_access_region (obj_desc, 0, |
123 | ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer), | 123 | ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer), |
124 | ACPI_READ | (obj_desc->field.attribute << 16)); | 124 | ACPI_READ | (obj_desc->field.attribute << 16)); |
125 | acpi_ex_release_global_lock (locked); | 125 | acpi_ex_release_global_lock (locked); |
126 | goto exit; | 126 | goto exit; |
127 | } | 127 | } |
@@ -196,6 +196,7 @@ exit: | |||
196 | * | 196 | * |
197 | * PARAMETERS: source_desc - Contains data to write | 197 | * PARAMETERS: source_desc - Contains data to write |
198 | * obj_desc - The named field | 198 | * obj_desc - The named field |
199 | * result_desc - Where the return value is returned, if any | ||
199 | * | 200 | * |
200 | * RETURN: Status | 201 | * RETURN: Status |
201 | * | 202 | * |
@@ -250,12 +251,15 @@ acpi_ex_write_data_to_field ( | |||
250 | if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) { | 251 | if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) { |
251 | ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n", | 252 | ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n", |
252 | acpi_ut_get_object_type_name (source_desc))); | 253 | acpi_ut_get_object_type_name (source_desc))); |
254 | |||
253 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 255 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); |
254 | } | 256 | } |
255 | 257 | ||
256 | if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) { | 258 | if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) { |
257 | ACPI_REPORT_ERROR (("SMBus write requires Buffer of length %X, found length %X\n", | 259 | ACPI_REPORT_ERROR (( |
260 | "SMBus write requires Buffer of length %X, found length %X\n", | ||
258 | ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length)); | 261 | ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length)); |
262 | |||
259 | return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); | 263 | return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); |
260 | } | 264 | } |
261 | 265 | ||
@@ -265,14 +269,16 @@ acpi_ex_write_data_to_field ( | |||
265 | } | 269 | } |
266 | 270 | ||
267 | buffer = buffer_desc->buffer.pointer; | 271 | buffer = buffer_desc->buffer.pointer; |
268 | ACPI_MEMCPY (buffer, source_desc->buffer.pointer, ACPI_SMBUS_BUFFER_SIZE); | 272 | ACPI_MEMCPY (buffer, source_desc->buffer.pointer, |
273 | ACPI_SMBUS_BUFFER_SIZE); | ||
269 | 274 | ||
270 | /* Lock entire transaction if requested */ | 275 | /* Lock entire transaction if requested */ |
271 | 276 | ||
272 | locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags); | 277 | locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags); |
273 | 278 | ||
274 | /* | 279 | /* |
275 | * Perform the write (returns status and perhaps data in the same buffer) | 280 | * Perform the write (returns status and perhaps data in the |
281 | * same buffer) | ||
276 | * Note: SMBus protocol type is passed in upper 16-bits of Function. | 282 | * Note: SMBus protocol type is passed in upper 16-bits of Function. |
277 | */ | 283 | */ |
278 | status = acpi_ex_access_region (obj_desc, 0, | 284 | status = acpi_ex_access_region (obj_desc, 0, |
@@ -284,9 +290,8 @@ acpi_ex_write_data_to_field ( | |||
284 | return_ACPI_STATUS (status); | 290 | return_ACPI_STATUS (status); |
285 | } | 291 | } |
286 | 292 | ||
287 | /* | 293 | /* Get a pointer to the data to be written */ |
288 | * Get a pointer to the data to be written | 294 | |
289 | */ | ||
290 | switch (ACPI_GET_OBJECT_TYPE (source_desc)) { | 295 | switch (ACPI_GET_OBJECT_TYPE (source_desc)) { |
291 | case ACPI_TYPE_INTEGER: | 296 | case ACPI_TYPE_INTEGER: |
292 | buffer = &source_desc->integer.value; | 297 | buffer = &source_desc->integer.value; |
@@ -314,7 +319,8 @@ acpi_ex_write_data_to_field ( | |||
314 | * the ACPI specification. | 319 | * the ACPI specification. |
315 | */ | 320 | */ |
316 | new_buffer = NULL; | 321 | new_buffer = NULL; |
317 | required_length = ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length); | 322 | required_length = ACPI_ROUND_BITS_UP_TO_BYTES ( |
323 | obj_desc->common_field.bit_length); | ||
318 | 324 | ||
319 | if (length < required_length) { | 325 | if (length < required_length) { |
320 | /* We need to create a new buffer */ | 326 | /* We need to create a new buffer */ |
@@ -338,6 +344,7 @@ acpi_ex_write_data_to_field ( | |||
338 | "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n", | 344 | "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n", |
339 | source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)), | 345 | source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)), |
340 | ACPI_GET_OBJECT_TYPE (source_desc), buffer, length)); | 346 | ACPI_GET_OBJECT_TYPE (source_desc), buffer, length)); |
347 | |||
341 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 348 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
342 | "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n", | 349 | "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n", |
343 | obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)), | 350 | obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)), |
diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c index 9d0f9d2e9061..3c2f89e00f78 100644 --- a/drivers/acpi/executer/exfldio.c +++ b/drivers/acpi/executer/exfldio.c | |||
@@ -52,12 +52,31 @@ | |||
52 | #define _COMPONENT ACPI_EXECUTER | 52 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME ("exfldio") | 53 | ACPI_MODULE_NAME ("exfldio") |
54 | 54 | ||
55 | /* Local prototypes */ | ||
56 | |||
57 | static acpi_status | ||
58 | acpi_ex_field_datum_io ( | ||
59 | union acpi_operand_object *obj_desc, | ||
60 | u32 field_datum_byte_offset, | ||
61 | acpi_integer *value, | ||
62 | u32 read_write); | ||
63 | |||
64 | static u8 | ||
65 | acpi_ex_register_overflow ( | ||
66 | union acpi_operand_object *obj_desc, | ||
67 | acpi_integer value); | ||
68 | |||
69 | static acpi_status | ||
70 | acpi_ex_setup_region ( | ||
71 | union acpi_operand_object *obj_desc, | ||
72 | u32 field_datum_byte_offset); | ||
73 | |||
55 | 74 | ||
56 | /******************************************************************************* | 75 | /******************************************************************************* |
57 | * | 76 | * |
58 | * FUNCTION: acpi_ex_setup_region | 77 | * FUNCTION: acpi_ex_setup_region |
59 | * | 78 | * |
60 | * PARAMETERS: *obj_desc - Field to be read or written | 79 | * PARAMETERS: obj_desc - Field to be read or written |
61 | * field_datum_byte_offset - Byte offset of this datum within the | 80 | * field_datum_byte_offset - Byte offset of this datum within the |
62 | * parent field | 81 | * parent field |
63 | * | 82 | * |
@@ -69,7 +88,7 @@ | |||
69 | * | 88 | * |
70 | ******************************************************************************/ | 89 | ******************************************************************************/ |
71 | 90 | ||
72 | acpi_status | 91 | static acpi_status |
73 | acpi_ex_setup_region ( | 92 | acpi_ex_setup_region ( |
74 | union acpi_operand_object *obj_desc, | 93 | union acpi_operand_object *obj_desc, |
75 | u32 field_datum_byte_offset) | 94 | u32 field_datum_byte_offset) |
@@ -127,9 +146,9 @@ acpi_ex_setup_region ( | |||
127 | * length of one field datum (access width) must fit within the region. | 146 | * length of one field datum (access width) must fit within the region. |
128 | * (Region length is specified in bytes) | 147 | * (Region length is specified in bytes) |
129 | */ | 148 | */ |
130 | if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset | 149 | if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset + |
131 | + field_datum_byte_offset | 150 | field_datum_byte_offset + |
132 | + obj_desc->common_field.access_byte_width)) { | 151 | obj_desc->common_field.access_byte_width)) { |
133 | if (acpi_gbl_enable_interpreter_slack) { | 152 | if (acpi_gbl_enable_interpreter_slack) { |
134 | /* | 153 | /* |
135 | * Slack mode only: We will go ahead and allow access to this | 154 | * Slack mode only: We will go ahead and allow access to this |
@@ -155,7 +174,8 @@ acpi_ex_setup_region ( | |||
155 | "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", | 174 | "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", |
156 | acpi_ut_get_node_name (obj_desc->common_field.node), | 175 | acpi_ut_get_node_name (obj_desc->common_field.node), |
157 | obj_desc->common_field.access_byte_width, | 176 | obj_desc->common_field.access_byte_width, |
158 | acpi_ut_get_node_name (rgn_desc->region.node), rgn_desc->region.length)); | 177 | acpi_ut_get_node_name (rgn_desc->region.node), |
178 | rgn_desc->region.length)); | ||
159 | } | 179 | } |
160 | 180 | ||
161 | /* | 181 | /* |
@@ -167,7 +187,8 @@ acpi_ex_setup_region ( | |||
167 | acpi_ut_get_node_name (obj_desc->common_field.node), | 187 | acpi_ut_get_node_name (obj_desc->common_field.node), |
168 | obj_desc->common_field.base_byte_offset, | 188 | obj_desc->common_field.base_byte_offset, |
169 | field_datum_byte_offset, obj_desc->common_field.access_byte_width, | 189 | field_datum_byte_offset, obj_desc->common_field.access_byte_width, |
170 | acpi_ut_get_node_name (rgn_desc->region.node), rgn_desc->region.length)); | 190 | acpi_ut_get_node_name (rgn_desc->region.node), |
191 | rgn_desc->region.length)); | ||
171 | 192 | ||
172 | return_ACPI_STATUS (AE_AML_REGION_LIMIT); | 193 | return_ACPI_STATUS (AE_AML_REGION_LIMIT); |
173 | } | 194 | } |
@@ -180,10 +201,10 @@ acpi_ex_setup_region ( | |||
180 | * | 201 | * |
181 | * FUNCTION: acpi_ex_access_region | 202 | * FUNCTION: acpi_ex_access_region |
182 | * | 203 | * |
183 | * PARAMETERS: *obj_desc - Field to be read | 204 | * PARAMETERS: obj_desc - Field to be read |
184 | * field_datum_byte_offset - Byte offset of this datum within the | 205 | * field_datum_byte_offset - Byte offset of this datum within the |
185 | * parent field | 206 | * parent field |
186 | * *Value - Where to store value (must at least | 207 | * Value - Where to store value (must at least |
187 | * the size of acpi_integer) | 208 | * the size of acpi_integer) |
188 | * Function - Read or Write flag plus other region- | 209 | * Function - Read or Write flag plus other region- |
189 | * dependent flags | 210 | * dependent flags |
@@ -226,9 +247,9 @@ acpi_ex_access_region ( | |||
226 | * 3) The current offset into the field | 247 | * 3) The current offset into the field |
227 | */ | 248 | */ |
228 | rgn_desc = obj_desc->common_field.region_obj; | 249 | rgn_desc = obj_desc->common_field.region_obj; |
229 | address = rgn_desc->region.address | 250 | address = rgn_desc->region.address + |
230 | + obj_desc->common_field.base_byte_offset | 251 | obj_desc->common_field.base_byte_offset + |
231 | + field_datum_byte_offset; | 252 | field_datum_byte_offset; |
232 | 253 | ||
233 | if ((function & ACPI_IO_MASK) == ACPI_READ) { | 254 | if ((function & ACPI_IO_MASK) == ACPI_READ) { |
234 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]")); | 255 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]")); |
@@ -249,7 +270,8 @@ acpi_ex_access_region ( | |||
249 | /* Invoke the appropriate address_space/op_region handler */ | 270 | /* Invoke the appropriate address_space/op_region handler */ |
250 | 271 | ||
251 | status = acpi_ev_address_space_dispatch (rgn_desc, function, | 272 | status = acpi_ev_address_space_dispatch (rgn_desc, function, |
252 | address, ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value); | 273 | address, |
274 | ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value); | ||
253 | 275 | ||
254 | if (ACPI_FAILURE (status)) { | 276 | if (ACPI_FAILURE (status)) { |
255 | if (status == AE_NOT_IMPLEMENTED) { | 277 | if (status == AE_NOT_IMPLEMENTED) { |
@@ -274,7 +296,7 @@ acpi_ex_access_region ( | |||
274 | * | 296 | * |
275 | * FUNCTION: acpi_ex_register_overflow | 297 | * FUNCTION: acpi_ex_register_overflow |
276 | * | 298 | * |
277 | * PARAMETERS: *obj_desc - Register(Field) to be written | 299 | * PARAMETERS: obj_desc - Register(Field) to be written |
278 | * Value - Value to be stored | 300 | * Value - Value to be stored |
279 | * | 301 | * |
280 | * RETURN: TRUE if value overflows the field, FALSE otherwise | 302 | * RETURN: TRUE if value overflows the field, FALSE otherwise |
@@ -287,7 +309,7 @@ acpi_ex_access_region ( | |||
287 | * | 309 | * |
288 | ******************************************************************************/ | 310 | ******************************************************************************/ |
289 | 311 | ||
290 | u8 | 312 | static u8 |
291 | acpi_ex_register_overflow ( | 313 | acpi_ex_register_overflow ( |
292 | union acpi_operand_object *obj_desc, | 314 | union acpi_operand_object *obj_desc, |
293 | acpi_integer value) | 315 | acpi_integer value) |
@@ -319,10 +341,10 @@ acpi_ex_register_overflow ( | |||
319 | * | 341 | * |
320 | * FUNCTION: acpi_ex_field_datum_io | 342 | * FUNCTION: acpi_ex_field_datum_io |
321 | * | 343 | * |
322 | * PARAMETERS: *obj_desc - Field to be read | 344 | * PARAMETERS: obj_desc - Field to be read |
323 | * field_datum_byte_offset - Byte offset of this datum within the | 345 | * field_datum_byte_offset - Byte offset of this datum within the |
324 | * parent field | 346 | * parent field |
325 | * *Value - Where to store value (must be 64 bits) | 347 | * Value - Where to store value (must be 64 bits) |
326 | * read_write - Read or Write flag | 348 | * read_write - Read or Write flag |
327 | * | 349 | * |
328 | * RETURN: Status | 350 | * RETURN: Status |
@@ -333,7 +355,7 @@ acpi_ex_register_overflow ( | |||
333 | * | 355 | * |
334 | ******************************************************************************/ | 356 | ******************************************************************************/ |
335 | 357 | ||
336 | acpi_status | 358 | static acpi_status |
337 | acpi_ex_field_datum_io ( | 359 | acpi_ex_field_datum_io ( |
338 | union acpi_operand_object *obj_desc, | 360 | union acpi_operand_object *obj_desc, |
339 | u32 field_datum_byte_offset, | 361 | u32 field_datum_byte_offset, |
@@ -350,7 +372,9 @@ acpi_ex_field_datum_io ( | |||
350 | if (read_write == ACPI_READ) { | 372 | if (read_write == ACPI_READ) { |
351 | if (!value) { | 373 | if (!value) { |
352 | local_value = 0; | 374 | local_value = 0; |
353 | value = &local_value; /* To support reads without saving return value */ | 375 | |
376 | /* To support reads without saving return value */ | ||
377 | value = &local_value; | ||
354 | } | 378 | } |
355 | 379 | ||
356 | /* Clear the entire return buffer first, [Very Important!] */ | 380 | /* Clear the entire return buffer first, [Very Important!] */ |
@@ -363,8 +387,10 @@ acpi_ex_field_datum_io ( | |||
363 | * | 387 | * |
364 | * buffer_field - Read/write from/to a Buffer | 388 | * buffer_field - Read/write from/to a Buffer |
365 | * region_field - Read/write from/to a Operation Region. | 389 | * region_field - Read/write from/to a Operation Region. |
366 | * bank_field - Write to a Bank Register, then read/write from/to an op_region | 390 | * bank_field - Write to a Bank Register, then read/write from/to an |
367 | * index_field - Write to an Index Register, then read/write from/to a Data Register | 391 | * operation_region |
392 | * index_field - Write to an Index Register, then read/write from/to a | ||
393 | * Data Register | ||
368 | */ | 394 | */ |
369 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 395 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { |
370 | case ACPI_TYPE_BUFFER_FIELD: | 396 | case ACPI_TYPE_BUFFER_FIELD: |
@@ -384,19 +410,20 @@ acpi_ex_field_datum_io ( | |||
384 | * Copy the data from the source buffer. | 410 | * Copy the data from the source buffer. |
385 | * Length is the field width in bytes. | 411 | * Length is the field width in bytes. |
386 | */ | 412 | */ |
387 | ACPI_MEMCPY (value, (obj_desc->buffer_field.buffer_obj)->buffer.pointer | 413 | ACPI_MEMCPY (value, |
388 | + obj_desc->buffer_field.base_byte_offset | 414 | (obj_desc->buffer_field.buffer_obj)->buffer.pointer + |
389 | + field_datum_byte_offset, | 415 | obj_desc->buffer_field.base_byte_offset + |
390 | obj_desc->common_field.access_byte_width); | 416 | field_datum_byte_offset, |
417 | obj_desc->common_field.access_byte_width); | ||
391 | } | 418 | } |
392 | else { | 419 | else { |
393 | /* | 420 | /* |
394 | * Copy the data to the target buffer. | 421 | * Copy the data to the target buffer. |
395 | * Length is the field width in bytes. | 422 | * Length is the field width in bytes. |
396 | */ | 423 | */ |
397 | ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer | 424 | ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer + |
398 | + obj_desc->buffer_field.base_byte_offset | 425 | obj_desc->buffer_field.base_byte_offset + |
399 | + field_datum_byte_offset, | 426 | field_datum_byte_offset, |
400 | value, obj_desc->common_field.access_byte_width); | 427 | value, obj_desc->common_field.access_byte_width); |
401 | } | 428 | } |
402 | 429 | ||
@@ -406,8 +433,10 @@ acpi_ex_field_datum_io ( | |||
406 | 433 | ||
407 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 434 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
408 | 435 | ||
409 | /* Ensure that the bank_value is not beyond the capacity of the register */ | 436 | /* |
410 | 437 | * Ensure that the bank_value is not beyond the capacity of | |
438 | * the register | ||
439 | */ | ||
411 | if (acpi_ex_register_overflow (obj_desc->bank_field.bank_obj, | 440 | if (acpi_ex_register_overflow (obj_desc->bank_field.bank_obj, |
412 | (acpi_integer) obj_desc->bank_field.value)) { | 441 | (acpi_integer) obj_desc->bank_field.value)) { |
413 | return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); | 442 | return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); |
@@ -445,8 +474,10 @@ acpi_ex_field_datum_io ( | |||
445 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 474 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
446 | 475 | ||
447 | 476 | ||
448 | /* Ensure that the index_value is not beyond the capacity of the register */ | 477 | /* |
449 | 478 | * Ensure that the index_value is not beyond the capacity of | |
479 | * the register | ||
480 | */ | ||
450 | if (acpi_ex_register_overflow (obj_desc->index_field.index_obj, | 481 | if (acpi_ex_register_overflow (obj_desc->index_field.index_obj, |
451 | (acpi_integer) obj_desc->index_field.value)) { | 482 | (acpi_integer) obj_desc->index_field.value)) { |
452 | return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); | 483 | return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); |
@@ -496,14 +527,16 @@ acpi_ex_field_datum_io ( | |||
496 | 527 | ||
497 | if (ACPI_SUCCESS (status)) { | 528 | if (ACPI_SUCCESS (status)) { |
498 | if (read_write == ACPI_READ) { | 529 | if (read_write == ACPI_READ) { |
499 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read %8.8X%8.8X, Width %d\n", | 530 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
500 | ACPI_FORMAT_UINT64 (*value), | 531 | "Value Read %8.8X%8.8X, Width %d\n", |
501 | obj_desc->common_field.access_byte_width)); | 532 | ACPI_FORMAT_UINT64 (*value), |
533 | obj_desc->common_field.access_byte_width)); | ||
502 | } | 534 | } |
503 | else { | 535 | else { |
504 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written %8.8X%8.8X, Width %d\n", | 536 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
505 | ACPI_FORMAT_UINT64 (*value), | 537 | "Value Written %8.8X%8.8X, Width %d\n", |
506 | obj_desc->common_field.access_byte_width)); | 538 | ACPI_FORMAT_UINT64 (*value), |
539 | obj_desc->common_field.access_byte_width)); | ||
507 | } | 540 | } |
508 | } | 541 | } |
509 | 542 | ||
@@ -515,8 +548,10 @@ acpi_ex_field_datum_io ( | |||
515 | * | 548 | * |
516 | * FUNCTION: acpi_ex_write_with_update_rule | 549 | * FUNCTION: acpi_ex_write_with_update_rule |
517 | * | 550 | * |
518 | * PARAMETERS: *obj_desc - Field to be set | 551 | * PARAMETERS: obj_desc - Field to be written |
519 | * Value - Value to store | 552 | * Mask - bitmask within field datum |
553 | * field_value - Value to write | ||
554 | * field_datum_byte_offset - Offset of datum within field | ||
520 | * | 555 | * |
521 | * RETURN: Status | 556 | * RETURN: Status |
522 | * | 557 | * |
@@ -689,7 +724,8 @@ acpi_ex_extract_from_field ( | |||
689 | /* Merge with previous datum if necessary */ | 724 | /* Merge with previous datum if necessary */ |
690 | 725 | ||
691 | merged_datum |= raw_datum << | 726 | merged_datum |= raw_datum << |
692 | (obj_desc->common_field.access_bit_width - obj_desc->common_field.start_field_bit_offset); | 727 | (obj_desc->common_field.access_bit_width - |
728 | obj_desc->common_field.start_field_bit_offset); | ||
693 | 729 | ||
694 | if (i == datum_count) { | 730 | if (i == datum_count) { |
695 | break; | 731 | break; |
@@ -707,7 +743,8 @@ acpi_ex_extract_from_field ( | |||
707 | 743 | ||
708 | /* Mask off any extra bits in the last datum */ | 744 | /* Mask off any extra bits in the last datum */ |
709 | 745 | ||
710 | buffer_tail_bits = obj_desc->common_field.bit_length % obj_desc->common_field.access_bit_width; | 746 | buffer_tail_bits = obj_desc->common_field.bit_length % |
747 | obj_desc->common_field.access_bit_width; | ||
711 | if (buffer_tail_bits) { | 748 | if (buffer_tail_bits) { |
712 | merged_datum &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); | 749 | merged_datum &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); |
713 | } | 750 | } |
@@ -791,7 +828,8 @@ acpi_ex_insert_into_field ( | |||
791 | /* Write merged datum to the target field */ | 828 | /* Write merged datum to the target field */ |
792 | 829 | ||
793 | merged_datum &= mask; | 830 | merged_datum &= mask; |
794 | status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum, field_offset); | 831 | status = acpi_ex_write_with_update_rule (obj_desc, mask, |
832 | merged_datum, field_offset); | ||
795 | if (ACPI_FAILURE (status)) { | 833 | if (ACPI_FAILURE (status)) { |
796 | return_ACPI_STATUS (status); | 834 | return_ACPI_STATUS (status); |
797 | } | 835 | } |
@@ -800,7 +838,8 @@ acpi_ex_insert_into_field ( | |||
800 | 838 | ||
801 | field_offset += obj_desc->common_field.access_byte_width; | 839 | field_offset += obj_desc->common_field.access_byte_width; |
802 | merged_datum = raw_datum >> | 840 | merged_datum = raw_datum >> |
803 | (obj_desc->common_field.access_bit_width - obj_desc->common_field.start_field_bit_offset); | 841 | (obj_desc->common_field.access_bit_width - |
842 | obj_desc->common_field.start_field_bit_offset); | ||
804 | mask = ACPI_INTEGER_MAX; | 843 | mask = ACPI_INTEGER_MAX; |
805 | 844 | ||
806 | if (i == datum_count) { | 845 | if (i == datum_count) { |
@@ -819,7 +858,8 @@ acpi_ex_insert_into_field ( | |||
819 | /* Mask off any extra bits in the last datum */ | 858 | /* Mask off any extra bits in the last datum */ |
820 | 859 | ||
821 | buffer_tail_bits = (obj_desc->common_field.bit_length + | 860 | buffer_tail_bits = (obj_desc->common_field.bit_length + |
822 | obj_desc->common_field.start_field_bit_offset) % obj_desc->common_field.access_bit_width; | 861 | obj_desc->common_field.start_field_bit_offset) % |
862 | obj_desc->common_field.access_bit_width; | ||
823 | if (buffer_tail_bits) { | 863 | if (buffer_tail_bits) { |
824 | mask &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); | 864 | mask &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); |
825 | } | 865 | } |
@@ -827,7 +867,8 @@ acpi_ex_insert_into_field ( | |||
827 | /* Write the last datum to the field */ | 867 | /* Write the last datum to the field */ |
828 | 868 | ||
829 | merged_datum &= mask; | 869 | merged_datum &= mask; |
830 | status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum, field_offset); | 870 | status = acpi_ex_write_with_update_rule (obj_desc, |
871 | mask, merged_datum, field_offset); | ||
831 | 872 | ||
832 | return_ACPI_STATUS (status); | 873 | return_ACPI_STATUS (status); |
833 | } | 874 | } |
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index b542dcd58c07..022f281345b8 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c | |||
@@ -139,8 +139,9 @@ acpi_ex_get_object_reference ( | |||
139 | reference_obj->reference.object = referenced_obj; | 139 | reference_obj->reference.object = referenced_obj; |
140 | *return_desc = reference_obj; | 140 | *return_desc = reference_obj; |
141 | 141 | ||
142 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p Type [%s], returning Reference %p\n", | 142 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
143 | obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc)); | 143 | "Object %p Type [%s], returning Reference %p\n", |
144 | obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc)); | ||
144 | 145 | ||
145 | return_ACPI_STATUS (AE_OK); | 146 | return_ACPI_STATUS (AE_OK); |
146 | } | 147 | } |
@@ -456,7 +457,7 @@ acpi_ex_do_math_op ( | |||
456 | return (integer0 * integer1); | 457 | return (integer0 * integer1); |
457 | 458 | ||
458 | 459 | ||
459 | case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */ | 460 | case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result)*/ |
460 | 461 | ||
461 | return (integer0 << integer1); | 462 | return (integer0 << integer1); |
462 | 463 | ||
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index 68c4bb1970a5..c3cb714d2cba 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c | |||
@@ -49,6 +49,13 @@ | |||
49 | #define _COMPONENT ACPI_EXECUTER | 49 | #define _COMPONENT ACPI_EXECUTER |
50 | ACPI_MODULE_NAME ("exmutex") | 50 | ACPI_MODULE_NAME ("exmutex") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static void | ||
55 | acpi_ex_link_mutex ( | ||
56 | union acpi_operand_object *obj_desc, | ||
57 | struct acpi_thread_state *thread); | ||
58 | |||
52 | 59 | ||
53 | /******************************************************************************* | 60 | /******************************************************************************* |
54 | * | 61 | * |
@@ -56,7 +63,7 @@ | |||
56 | * | 63 | * |
57 | * PARAMETERS: obj_desc - The mutex to be unlinked | 64 | * PARAMETERS: obj_desc - The mutex to be unlinked |
58 | * | 65 | * |
59 | * RETURN: Status | 66 | * RETURN: None |
60 | * | 67 | * |
61 | * DESCRIPTION: Remove a mutex from the "acquired_mutex" list | 68 | * DESCRIPTION: Remove a mutex from the "acquired_mutex" list |
62 | * | 69 | * |
@@ -92,16 +99,16 @@ acpi_ex_unlink_mutex ( | |||
92 | * | 99 | * |
93 | * FUNCTION: acpi_ex_link_mutex | 100 | * FUNCTION: acpi_ex_link_mutex |
94 | * | 101 | * |
95 | * PARAMETERS: obj_desc - The mutex to be linked | 102 | * PARAMETERS: obj_desc - The mutex to be linked |
96 | * list_head - head of the "acquired_mutex" list | 103 | * Thread - Current executing thread object |
97 | * | 104 | * |
98 | * RETURN: Status | 105 | * RETURN: None |
99 | * | 106 | * |
100 | * DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk | 107 | * DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk |
101 | * | 108 | * |
102 | ******************************************************************************/ | 109 | ******************************************************************************/ |
103 | 110 | ||
104 | void | 111 | static void |
105 | acpi_ex_link_mutex ( | 112 | acpi_ex_link_mutex ( |
106 | union acpi_operand_object *obj_desc, | 113 | union acpi_operand_object *obj_desc, |
107 | struct acpi_thread_state *thread) | 114 | struct acpi_thread_state *thread) |
@@ -132,8 +139,9 @@ acpi_ex_link_mutex ( | |||
132 | * | 139 | * |
133 | * FUNCTION: acpi_ex_acquire_mutex | 140 | * FUNCTION: acpi_ex_acquire_mutex |
134 | * | 141 | * |
135 | * PARAMETERS: time_desc - The 'time to delay' object descriptor | 142 | * PARAMETERS: time_desc - Timeout integer |
136 | * obj_desc - The object descriptor for this op | 143 | * obj_desc - Mutex object |
144 | * walk_state - Current method execution state | ||
137 | * | 145 | * |
138 | * RETURN: Status | 146 | * RETURN: Status |
139 | * | 147 | * |
@@ -161,7 +169,7 @@ acpi_ex_acquire_mutex ( | |||
161 | 169 | ||
162 | if (!walk_state->thread) { | 170 | if (!walk_state->thread) { |
163 | ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n", | 171 | ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n", |
164 | acpi_ut_get_node_name (obj_desc->mutex.node))); | 172 | acpi_ut_get_node_name (obj_desc->mutex.node))); |
165 | return_ACPI_STATUS (AE_AML_INTERNAL); | 173 | return_ACPI_STATUS (AE_AML_INTERNAL); |
166 | } | 174 | } |
167 | 175 | ||
@@ -170,8 +178,9 @@ acpi_ex_acquire_mutex ( | |||
170 | * mutex. This mechanism provides some deadlock prevention | 178 | * mutex. This mechanism provides some deadlock prevention |
171 | */ | 179 | */ |
172 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { | 180 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { |
173 | ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], incorrect sync_level\n", | 181 | ACPI_REPORT_ERROR (( |
174 | acpi_ut_get_node_name (obj_desc->mutex.node))); | 182 | "Cannot acquire Mutex [%4.4s], incorrect sync_level\n", |
183 | acpi_ut_get_node_name (obj_desc->mutex.node))); | ||
175 | return_ACPI_STATUS (AE_AML_MUTEX_ORDER); | 184 | return_ACPI_STATUS (AE_AML_MUTEX_ORDER); |
176 | } | 185 | } |
177 | 186 | ||
@@ -180,8 +189,10 @@ acpi_ex_acquire_mutex ( | |||
180 | if (obj_desc->mutex.owner_thread) { | 189 | if (obj_desc->mutex.owner_thread) { |
181 | /* Special case for Global Lock, allow all threads */ | 190 | /* Special case for Global Lock, allow all threads */ |
182 | 191 | ||
183 | if ((obj_desc->mutex.owner_thread->thread_id == walk_state->thread->thread_id) || | 192 | if ((obj_desc->mutex.owner_thread->thread_id == |
184 | (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore)) { | 193 | walk_state->thread->thread_id) || |
194 | (obj_desc->mutex.semaphore == | ||
195 | acpi_gbl_global_lock_semaphore)) { | ||
185 | /* | 196 | /* |
186 | * The mutex is already owned by this thread, | 197 | * The mutex is already owned by this thread, |
187 | * just increment the acquisition depth | 198 | * just increment the acquisition depth |
@@ -221,6 +232,7 @@ acpi_ex_acquire_mutex ( | |||
221 | * FUNCTION: acpi_ex_release_mutex | 232 | * FUNCTION: acpi_ex_release_mutex |
222 | * | 233 | * |
223 | * PARAMETERS: obj_desc - The object descriptor for this op | 234 | * PARAMETERS: obj_desc - The object descriptor for this op |
235 | * walk_state - Current method execution state | ||
224 | * | 236 | * |
225 | * RETURN: Status | 237 | * RETURN: Status |
226 | * | 238 | * |
@@ -278,8 +290,9 @@ acpi_ex_release_mutex ( | |||
278 | * equal to the current sync level | 290 | * equal to the current sync level |
279 | */ | 291 | */ |
280 | if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { | 292 | if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { |
281 | ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], incorrect sync_level\n", | 293 | ACPI_REPORT_ERROR (( |
282 | acpi_ut_get_node_name (obj_desc->mutex.node))); | 294 | "Cannot release Mutex [%4.4s], incorrect sync_level\n", |
295 | acpi_ut_get_node_name (obj_desc->mutex.node))); | ||
283 | return_ACPI_STATUS (AE_AML_MUTEX_ORDER); | 296 | return_ACPI_STATUS (AE_AML_MUTEX_ORDER); |
284 | } | 297 | } |
285 | 298 | ||
@@ -313,11 +326,11 @@ acpi_ex_release_mutex ( | |||
313 | * | 326 | * |
314 | * FUNCTION: acpi_ex_release_all_mutexes | 327 | * FUNCTION: acpi_ex_release_all_mutexes |
315 | * | 328 | * |
316 | * PARAMETERS: mutex_list - Head of the mutex list | 329 | * PARAMETERS: Thread - Current executing thread object |
317 | * | 330 | * |
318 | * RETURN: Status | 331 | * RETURN: Status |
319 | * | 332 | * |
320 | * DESCRIPTION: Release all mutexes in the list | 333 | * DESCRIPTION: Release all mutexes held by this thread |
321 | * | 334 | * |
322 | ******************************************************************************/ | 335 | ******************************************************************************/ |
323 | 336 | ||
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index 7911c533c265..639f0bd3f6d8 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c | |||
@@ -50,13 +50,17 @@ | |||
50 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME ("exnames") | 51 | ACPI_MODULE_NAME ("exnames") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
53 | 54 | ||
54 | /* AML Package Length encodings */ | 55 | static char * |
56 | acpi_ex_allocate_name_string ( | ||
57 | u32 prefix_count, | ||
58 | u32 num_name_segs); | ||
55 | 59 | ||
56 | #define ACPI_AML_PACKAGE_TYPE1 0x40 | 60 | static acpi_status |
57 | #define ACPI_AML_PACKAGE_TYPE2 0x4000 | 61 | acpi_ex_name_segment ( |
58 | #define ACPI_AML_PACKAGE_TYPE3 0x400000 | 62 | u8 **in_aml_address, |
59 | #define ACPI_AML_PACKAGE_TYPE4 0x40000000 | 63 | char *name_string); |
60 | 64 | ||
61 | 65 | ||
62 | /******************************************************************************* | 66 | /******************************************************************************* |
@@ -64,7 +68,7 @@ | |||
64 | * FUNCTION: acpi_ex_allocate_name_string | 68 | * FUNCTION: acpi_ex_allocate_name_string |
65 | * | 69 | * |
66 | * PARAMETERS: prefix_count - Count of parent levels. Special cases: | 70 | * PARAMETERS: prefix_count - Count of parent levels. Special cases: |
67 | * (-1) = root, 0 = none | 71 | * (-1)==root, 0==none |
68 | * num_name_segs - count of 4-character name segments | 72 | * num_name_segs - count of 4-character name segments |
69 | * | 73 | * |
70 | * RETURN: A pointer to the allocated string segment. This segment must | 74 | * RETURN: A pointer to the allocated string segment. This segment must |
@@ -75,7 +79,7 @@ | |||
75 | * | 79 | * |
76 | ******************************************************************************/ | 80 | ******************************************************************************/ |
77 | 81 | ||
78 | char * | 82 | static char * |
79 | acpi_ex_allocate_name_string ( | 83 | acpi_ex_allocate_name_string ( |
80 | u32 prefix_count, | 84 | u32 prefix_count, |
81 | u32 num_name_segs) | 85 | u32 num_name_segs) |
@@ -88,7 +92,7 @@ acpi_ex_allocate_name_string ( | |||
88 | 92 | ||
89 | 93 | ||
90 | /* | 94 | /* |
91 | * Allow room for all \ and ^ prefixes, all segments, and a multi_name_prefix. | 95 | * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix. |
92 | * Also, one byte for the null terminator. | 96 | * Also, one byte for the null terminator. |
93 | * This may actually be somewhat longer than needed. | 97 | * This may actually be somewhat longer than needed. |
94 | */ | 98 | */ |
@@ -107,7 +111,8 @@ acpi_ex_allocate_name_string ( | |||
107 | */ | 111 | */ |
108 | name_string = ACPI_MEM_ALLOCATE (size_needed); | 112 | name_string = ACPI_MEM_ALLOCATE (size_needed); |
109 | if (!name_string) { | 113 | if (!name_string) { |
110 | ACPI_REPORT_ERROR (("ex_allocate_name_string: Could not allocate size %d\n", size_needed)); | 114 | ACPI_REPORT_ERROR (( |
115 | "ex_allocate_name_string: Could not allocate size %d\n", size_needed)); | ||
111 | return_PTR (NULL); | 116 | return_PTR (NULL); |
112 | } | 117 | } |
113 | 118 | ||
@@ -152,15 +157,17 @@ acpi_ex_allocate_name_string ( | |||
152 | * | 157 | * |
153 | * FUNCTION: acpi_ex_name_segment | 158 | * FUNCTION: acpi_ex_name_segment |
154 | * | 159 | * |
155 | * PARAMETERS: interpreter_mode - Current running mode (load1/Load2/Exec) | 160 | * PARAMETERS: in_aml_address - Pointer to the name in the AML code |
161 | * name_string - Where to return the name. The name is appended | ||
162 | * to any existing string to form a namepath | ||
156 | * | 163 | * |
157 | * RETURN: Status | 164 | * RETURN: Status |
158 | * | 165 | * |
159 | * DESCRIPTION: Execute a name segment (4 bytes) | 166 | * DESCRIPTION: Extract an ACPI name (4 bytes) from the AML byte stream |
160 | * | 167 | * |
161 | ******************************************************************************/ | 168 | ******************************************************************************/ |
162 | 169 | ||
163 | acpi_status | 170 | static acpi_status |
164 | acpi_ex_name_segment ( | 171 | acpi_ex_name_segment ( |
165 | u8 **in_aml_address, | 172 | u8 **in_aml_address, |
166 | char *name_string) | 173 | char *name_string) |
@@ -223,10 +230,13 @@ acpi_ex_name_segment ( | |||
223 | status = AE_CTRL_PENDING; | 230 | status = AE_CTRL_PENDING; |
224 | } | 231 | } |
225 | else { | 232 | else { |
226 | /* Segment started with one or more valid characters, but fewer than 4 */ | 233 | /* |
227 | 234 | * Segment started with one or more valid characters, but fewer than | |
235 | * the required 4 | ||
236 | */ | ||
228 | status = AE_AML_BAD_NAME; | 237 | status = AE_AML_BAD_NAME; |
229 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad character %02x in name, at %p\n", | 238 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
239 | "Bad character %02x in name, at %p\n", | ||
230 | *aml_address, aml_address)); | 240 | *aml_address, aml_address)); |
231 | } | 241 | } |
232 | 242 | ||
@@ -239,11 +249,16 @@ acpi_ex_name_segment ( | |||
239 | * | 249 | * |
240 | * FUNCTION: acpi_ex_get_name_string | 250 | * FUNCTION: acpi_ex_get_name_string |
241 | * | 251 | * |
242 | * PARAMETERS: data_type - Data type to be associated with this name | 252 | * PARAMETERS: data_type - Object type to be associated with this |
253 | * name | ||
254 | * in_aml_address - Pointer to the namestring in the AML code | ||
255 | * out_name_string - Where the namestring is returned | ||
256 | * out_name_length - Length of the returned string | ||
243 | * | 257 | * |
244 | * RETURN: Status | 258 | * RETURN: Status, namestring and length |
245 | * | 259 | * |
246 | * DESCRIPTION: Get a name, including any prefixes. | 260 | * DESCRIPTION: Extract a full namepath from the AML byte stream, |
261 | * including any prefixes. | ||
247 | * | 262 | * |
248 | ******************************************************************************/ | 263 | ******************************************************************************/ |
249 | 264 | ||
@@ -286,7 +301,8 @@ acpi_ex_get_name_string ( | |||
286 | switch (*aml_address) { | 301 | switch (*aml_address) { |
287 | case AML_ROOT_PREFIX: | 302 | case AML_ROOT_PREFIX: |
288 | 303 | ||
289 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n", aml_address)); | 304 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n", |
305 | aml_address)); | ||
290 | 306 | ||
291 | /* | 307 | /* |
292 | * Remember that we have a root_prefix -- | 308 | * Remember that we have a root_prefix -- |
@@ -303,7 +319,8 @@ acpi_ex_get_name_string ( | |||
303 | /* Increment past possibly multiple parent prefixes */ | 319 | /* Increment past possibly multiple parent prefixes */ |
304 | 320 | ||
305 | do { | 321 | do { |
306 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n", aml_address)); | 322 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n", |
323 | aml_address)); | ||
307 | 324 | ||
308 | aml_address++; | 325 | aml_address++; |
309 | prefix_count++; | 326 | prefix_count++; |
@@ -321,13 +338,13 @@ acpi_ex_get_name_string ( | |||
321 | break; | 338 | break; |
322 | } | 339 | } |
323 | 340 | ||
324 | |||
325 | /* Examine first character of name for name segment prefix operator */ | 341 | /* Examine first character of name for name segment prefix operator */ |
326 | 342 | ||
327 | switch (*aml_address) { | 343 | switch (*aml_address) { |
328 | case AML_DUAL_NAME_PREFIX: | 344 | case AML_DUAL_NAME_PREFIX: |
329 | 345 | ||
330 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n", aml_address)); | 346 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n", |
347 | aml_address)); | ||
331 | 348 | ||
332 | aml_address++; | 349 | aml_address++; |
333 | name_string = acpi_ex_allocate_name_string (prefix_count, 2); | 350 | name_string = acpi_ex_allocate_name_string (prefix_count, 2); |
@@ -349,7 +366,8 @@ acpi_ex_get_name_string ( | |||
349 | 366 | ||
350 | case AML_MULTI_NAME_PREFIX_OP: | 367 | case AML_MULTI_NAME_PREFIX_OP: |
351 | 368 | ||
352 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n", aml_address)); | 369 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n", |
370 | aml_address)); | ||
353 | 371 | ||
354 | /* Fetch count of segments remaining in name path */ | 372 | /* Fetch count of segments remaining in name path */ |
355 | 373 | ||
@@ -368,7 +386,8 @@ acpi_ex_get_name_string ( | |||
368 | has_prefix = TRUE; | 386 | has_prefix = TRUE; |
369 | 387 | ||
370 | while (num_segments && | 388 | while (num_segments && |
371 | (status = acpi_ex_name_segment (&aml_address, name_string)) == AE_OK) { | 389 | (status = acpi_ex_name_segment (&aml_address, name_string)) == |
390 | AE_OK) { | ||
372 | num_segments--; | 391 | num_segments--; |
373 | } | 392 | } |
374 | 393 | ||
@@ -380,7 +399,8 @@ acpi_ex_get_name_string ( | |||
380 | /* null_name valid as of 8-12-98 ASL/AML Grammar Update */ | 399 | /* null_name valid as of 8-12-98 ASL/AML Grammar Update */ |
381 | 400 | ||
382 | if (prefix_count == ACPI_UINT32_MAX) { | 401 | if (prefix_count == ACPI_UINT32_MAX) { |
383 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "name_seg is \"\\\" followed by NULL\n")); | 402 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
403 | "name_seg is \"\\\" followed by NULL\n")); | ||
384 | } | 404 | } |
385 | 405 | ||
386 | /* Consume the NULL byte */ | 406 | /* Consume the NULL byte */ |
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index 8482aefaf38b..dbdf8262ba00 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c | |||
@@ -97,7 +97,8 @@ acpi_ex_opcode_0A_0T_1R ( | |||
97 | union acpi_operand_object *return_desc = NULL; | 97 | union acpi_operand_object *return_desc = NULL; |
98 | 98 | ||
99 | 99 | ||
100 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_0A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); | 100 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_0A_0T_1R", |
101 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
101 | 102 | ||
102 | 103 | ||
103 | /* Examine the AML opcode */ | 104 | /* Examine the AML opcode */ |
@@ -161,7 +162,8 @@ acpi_ex_opcode_1A_0T_0R ( | |||
161 | acpi_status status = AE_OK; | 162 | acpi_status status = AE_OK; |
162 | 163 | ||
163 | 164 | ||
164 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode)); | 165 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_0R", |
166 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
165 | 167 | ||
166 | 168 | ||
167 | /* Examine the AML opcode */ | 169 | /* Examine the AML opcode */ |
@@ -236,7 +238,8 @@ acpi_ex_opcode_1A_1T_0R ( | |||
236 | union acpi_operand_object **operand = &walk_state->operands[0]; | 238 | union acpi_operand_object **operand = &walk_state->operands[0]; |
237 | 239 | ||
238 | 240 | ||
239 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_0R", acpi_ps_get_opcode_name (walk_state->opcode)); | 241 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_0R", |
242 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
240 | 243 | ||
241 | 244 | ||
242 | /* Examine the AML opcode */ | 245 | /* Examine the AML opcode */ |
@@ -289,7 +292,8 @@ acpi_ex_opcode_1A_1T_1R ( | |||
289 | acpi_integer digit; | 292 | acpi_integer digit; |
290 | 293 | ||
291 | 294 | ||
292 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); | 295 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_1R", |
296 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
293 | 297 | ||
294 | 298 | ||
295 | /* Examine the AML opcode */ | 299 | /* Examine the AML opcode */ |
@@ -409,8 +413,10 @@ acpi_ex_opcode_1A_1T_1R ( | |||
409 | for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { | 413 | for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { |
410 | (void) acpi_ut_short_divide (digit, 10, &digit, &temp32); | 414 | (void) acpi_ut_short_divide (digit, 10, &digit, &temp32); |
411 | 415 | ||
412 | /* Insert the BCD digit that resides in the remainder from above */ | 416 | /* |
413 | 417 | * Insert the BCD digit that resides in the | |
418 | * remainder from above | ||
419 | */ | ||
414 | return_desc->integer.value |= (((acpi_integer) temp32) << | 420 | return_desc->integer.value |= (((acpi_integer) temp32) << |
415 | ACPI_MUL_4 (i)); | 421 | ACPI_MUL_4 (i)); |
416 | } | 422 | } |
@@ -445,7 +451,8 @@ acpi_ex_opcode_1A_1T_1R ( | |||
445 | 451 | ||
446 | /* Get the object reference, store it, and remove our reference */ | 452 | /* Get the object reference, store it, and remove our reference */ |
447 | 453 | ||
448 | status = acpi_ex_get_object_reference (operand[0], &return_desc2, walk_state); | 454 | status = acpi_ex_get_object_reference (operand[0], |
455 | &return_desc2, walk_state); | ||
449 | if (ACPI_FAILURE (status)) { | 456 | if (ACPI_FAILURE (status)) { |
450 | goto cleanup; | 457 | goto cleanup; |
451 | } | 458 | } |
@@ -482,10 +489,10 @@ acpi_ex_opcode_1A_1T_1R ( | |||
482 | 489 | ||
483 | if (!walk_state->result_obj) { | 490 | if (!walk_state->result_obj) { |
484 | /* | 491 | /* |
485 | * Normally, we would remove a reference on the Operand[0] parameter; | 492 | * Normally, we would remove a reference on the Operand[0] |
486 | * But since it is being used as the internal return object | 493 | * parameter; But since it is being used as the internal return |
487 | * (meaning we would normally increment it), the two cancel out, | 494 | * object (meaning we would normally increment it), the two |
488 | * and we simply don't do anything. | 495 | * cancel out, and we simply don't do anything. |
489 | */ | 496 | */ |
490 | walk_state->result_obj = operand[0]; | 497 | walk_state->result_obj = operand[0]; |
491 | walk_state->operands[0] = NULL; /* Prevent deletion */ | 498 | walk_state->operands[0] = NULL; /* Prevent deletion */ |
@@ -549,9 +556,8 @@ acpi_ex_opcode_1A_1T_1R ( | |||
549 | case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */ | 556 | case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */ |
550 | case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */ | 557 | case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */ |
551 | 558 | ||
552 | /* | 559 | /* These are two obsolete opcodes */ |
553 | * These are two obsolete opcodes | 560 | |
554 | */ | ||
555 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 561 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
556 | "%s is obsolete and not implemented\n", | 562 | "%s is obsolete and not implemented\n", |
557 | acpi_ps_get_opcode_name (walk_state->opcode))); | 563 | acpi_ps_get_opcode_name (walk_state->opcode))); |
@@ -568,9 +574,8 @@ acpi_ex_opcode_1A_1T_1R ( | |||
568 | } | 574 | } |
569 | 575 | ||
570 | if (ACPI_SUCCESS (status)) { | 576 | if (ACPI_SUCCESS (status)) { |
571 | /* | 577 | /* Store the return value computed above into the target object */ |
572 | * Store the return value computed above into the target object | 578 | |
573 | */ | ||
574 | status = acpi_ex_store (return_desc, operand[1], walk_state); | 579 | status = acpi_ex_store (return_desc, operand[1], walk_state); |
575 | } | 580 | } |
576 | 581 | ||
@@ -615,7 +620,8 @@ acpi_ex_opcode_1A_0T_1R ( | |||
615 | acpi_integer value; | 620 | acpi_integer value; |
616 | 621 | ||
617 | 622 | ||
618 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); | 623 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R", |
624 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
619 | 625 | ||
620 | 626 | ||
621 | /* Examine the AML opcode */ | 627 | /* Examine the AML opcode */ |
@@ -706,9 +712,9 @@ acpi_ex_opcode_1A_0T_1R ( | |||
706 | 712 | ||
707 | /* | 713 | /* |
708 | * Note: The operand is not resolved at this point because we want to | 714 | * Note: The operand is not resolved at this point because we want to |
709 | * get the associated object, not its value. For example, we don't want | 715 | * get the associated object, not its value. For example, we don't |
710 | * to resolve a field_unit to its value, we want the actual field_unit | 716 | * want to resolve a field_unit to its value, we want the actual |
711 | * object. | 717 | * field_unit object. |
712 | */ | 718 | */ |
713 | 719 | ||
714 | /* Get the type of the base object */ | 720 | /* Get the type of the base object */ |
@@ -738,7 +744,8 @@ acpi_ex_opcode_1A_0T_1R ( | |||
738 | 744 | ||
739 | /* Get the base object */ | 745 | /* Get the base object */ |
740 | 746 | ||
741 | status = acpi_ex_resolve_multiple (walk_state, operand[0], &type, &temp_desc); | 747 | status = acpi_ex_resolve_multiple (walk_state, |
748 | operand[0], &type, &temp_desc); | ||
742 | if (ACPI_FAILURE (status)) { | 749 | if (ACPI_FAILURE (status)) { |
743 | goto cleanup; | 750 | goto cleanup; |
744 | } | 751 | } |
@@ -818,8 +825,10 @@ acpi_ex_opcode_1A_0T_1R ( | |||
818 | 825 | ||
819 | /* Set Operand[0] to the value of the local/arg */ | 826 | /* Set Operand[0] to the value of the local/arg */ |
820 | 827 | ||
821 | status = acpi_ds_method_data_get_value (operand[0]->reference.opcode, | 828 | status = acpi_ds_method_data_get_value ( |
822 | operand[0]->reference.offset, walk_state, &temp_desc); | 829 | operand[0]->reference.opcode, |
830 | operand[0]->reference.offset, | ||
831 | walk_state, &temp_desc); | ||
823 | if (ACPI_FAILURE (status)) { | 832 | if (ACPI_FAILURE (status)) { |
824 | goto cleanup; | 833 | goto cleanup; |
825 | } | 834 | } |
@@ -852,21 +861,26 @@ acpi_ex_opcode_1A_0T_1R ( | |||
852 | case ACPI_TYPE_STRING: | 861 | case ACPI_TYPE_STRING: |
853 | 862 | ||
854 | /* | 863 | /* |
855 | * This is a deref_of (String). The string is a reference to a named ACPI object. | 864 | * This is a deref_of (String). The string is a reference |
865 | * to a named ACPI object. | ||
856 | * | 866 | * |
857 | * 1) Find the owning Node | 867 | * 1) Find the owning Node |
858 | * 2) Dereference the node to an actual object. Could be a Field, so we nee | 868 | * 2) Dereference the node to an actual object. Could be a |
859 | * to resolve the node to a value. | 869 | * Field, so we need to resolve the node to a value. |
860 | */ | 870 | */ |
861 | status = acpi_ns_get_node_by_path (operand[0]->string.pointer, | 871 | status = acpi_ns_get_node_by_path (operand[0]->string.pointer, |
862 | walk_state->scope_info->scope.node, ACPI_NS_SEARCH_PARENT, | 872 | walk_state->scope_info->scope.node, |
863 | ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &return_desc)); | 873 | ACPI_NS_SEARCH_PARENT, |
874 | ACPI_CAST_INDIRECT_PTR ( | ||
875 | struct acpi_namespace_node, &return_desc)); | ||
864 | if (ACPI_FAILURE (status)) { | 876 | if (ACPI_FAILURE (status)) { |
865 | goto cleanup; | 877 | goto cleanup; |
866 | } | 878 | } |
867 | 879 | ||
868 | status = acpi_ex_resolve_node_to_value ( | 880 | status = acpi_ex_resolve_node_to_value ( |
869 | ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &return_desc), walk_state); | 881 | ACPI_CAST_INDIRECT_PTR ( |
882 | struct acpi_namespace_node, &return_desc), | ||
883 | walk_state); | ||
870 | goto cleanup; | 884 | goto cleanup; |
871 | 885 | ||
872 | 886 | ||
@@ -883,14 +897,16 @@ acpi_ex_opcode_1A_0T_1R ( | |||
883 | /* | 897 | /* |
884 | * This is a deref_of (object_reference) | 898 | * This is a deref_of (object_reference) |
885 | * Get the actual object from the Node (This is the dereference). | 899 | * Get the actual object from the Node (This is the dereference). |
886 | * -- This case may only happen when a local_x or arg_x is dereferenced above. | 900 | * This case may only happen when a local_x or arg_x is |
901 | * dereferenced above. | ||
887 | */ | 902 | */ |
888 | return_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) operand[0]); | 903 | return_desc = acpi_ns_get_attached_object ( |
904 | (struct acpi_namespace_node *) operand[0]); | ||
889 | } | 905 | } |
890 | else { | 906 | else { |
891 | /* | 907 | /* |
892 | * This must be a reference object produced by either the Index() or | 908 | * This must be a reference object produced by either the |
893 | * ref_of() operator | 909 | * Index() or ref_of() operator |
894 | */ | 910 | */ |
895 | switch (operand[0]->reference.opcode) { | 911 | switch (operand[0]->reference.opcode) { |
896 | case AML_INDEX_OP: | 912 | case AML_INDEX_OP: |
@@ -931,8 +947,8 @@ acpi_ex_opcode_1A_0T_1R ( | |||
931 | case ACPI_TYPE_PACKAGE: | 947 | case ACPI_TYPE_PACKAGE: |
932 | 948 | ||
933 | /* | 949 | /* |
934 | * Return the referenced element of the package. We must add | 950 | * Return the referenced element of the package. We must |
935 | * another reference to the referenced object, however. | 951 | * add another reference to the referenced object, however. |
936 | */ | 952 | */ |
937 | return_desc = *(operand[0]->reference.where); | 953 | return_desc = *(operand[0]->reference.where); |
938 | if (!return_desc) { | 954 | if (!return_desc) { |
@@ -967,9 +983,11 @@ acpi_ex_opcode_1A_0T_1R ( | |||
967 | 983 | ||
968 | return_desc = operand[0]->reference.object; | 984 | return_desc = operand[0]->reference.object; |
969 | 985 | ||
970 | if (ACPI_GET_DESCRIPTOR_TYPE (return_desc) == ACPI_DESC_TYPE_NAMED) { | 986 | if (ACPI_GET_DESCRIPTOR_TYPE (return_desc) == |
987 | ACPI_DESC_TYPE_NAMED) { | ||
971 | 988 | ||
972 | return_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) return_desc); | 989 | return_desc = acpi_ns_get_attached_object ( |
990 | (struct acpi_namespace_node *) return_desc); | ||
973 | } | 991 | } |
974 | 992 | ||
975 | /* Add another reference to the object! */ | 993 | /* Add another reference to the object! */ |
diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index 8be4d80ceed5..7429032c2b6c 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c | |||
@@ -118,7 +118,7 @@ acpi_ex_opcode_2A_0T_0R ( | |||
118 | 118 | ||
119 | value = (u32) operand[1]->integer.value; | 119 | value = (u32) operand[1]->integer.value; |
120 | 120 | ||
121 | /* Notifies allowed on this object? */ | 121 | /* Are notifies allowed on this object? */ |
122 | 122 | ||
123 | if (!acpi_ev_is_notify_object (node)) { | 123 | if (!acpi_ev_is_notify_object (node)) { |
124 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 124 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
@@ -203,11 +203,12 @@ acpi_ex_opcode_2A_2T_1R ( | |||
203 | acpi_ps_get_opcode_name (walk_state->opcode)); | 203 | acpi_ps_get_opcode_name (walk_state->opcode)); |
204 | 204 | ||
205 | 205 | ||
206 | /* | 206 | /* Execute the opcode */ |
207 | * Execute the opcode | 207 | |
208 | */ | ||
209 | switch (walk_state->opcode) { | 208 | switch (walk_state->opcode) { |
210 | case AML_DIVIDE_OP: /* Divide (Dividend, Divisor, remainder_result quotient_result) */ | 209 | case AML_DIVIDE_OP: |
210 | |||
211 | /* Divide (Dividend, Divisor, remainder_result quotient_result) */ | ||
211 | 212 | ||
212 | return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 213 | return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); |
213 | if (!return_desc1) { | 214 | if (!return_desc1) { |
@@ -241,7 +242,6 @@ acpi_ex_opcode_2A_2T_1R ( | |||
241 | goto cleanup; | 242 | goto cleanup; |
242 | } | 243 | } |
243 | 244 | ||
244 | |||
245 | /* Store the results to the target reference operands */ | 245 | /* Store the results to the target reference operands */ |
246 | 246 | ||
247 | status = acpi_ex_store (return_desc2, operand[2], walk_state); | 247 | status = acpi_ex_store (return_desc2, operand[2], walk_state); |
@@ -295,7 +295,7 @@ acpi_ex_opcode_2A_1T_1R ( | |||
295 | { | 295 | { |
296 | union acpi_operand_object **operand = &walk_state->operands[0]; | 296 | union acpi_operand_object **operand = &walk_state->operands[0]; |
297 | union acpi_operand_object *return_desc = NULL; | 297 | union acpi_operand_object *return_desc = NULL; |
298 | u32 index; | 298 | acpi_integer index; |
299 | acpi_status status = AE_OK; | 299 | acpi_status status = AE_OK; |
300 | acpi_size length; | 300 | acpi_size length; |
301 | 301 | ||
@@ -304,9 +304,8 @@ acpi_ex_opcode_2A_1T_1R ( | |||
304 | acpi_ps_get_opcode_name (walk_state->opcode)); | 304 | acpi_ps_get_opcode_name (walk_state->opcode)); |
305 | 305 | ||
306 | 306 | ||
307 | /* | 307 | /* Execute the opcode */ |
308 | * Execute the opcode | 308 | |
309 | */ | ||
310 | if (walk_state->op_info->flags & AML_MATH) { | 309 | if (walk_state->op_info->flags & AML_MATH) { |
311 | /* All simple math opcodes (add, etc.) */ | 310 | /* All simple math opcodes (add, etc.) */ |
312 | 311 | ||
@@ -322,9 +321,8 @@ acpi_ex_opcode_2A_1T_1R ( | |||
322 | goto store_result_to_target; | 321 | goto store_result_to_target; |
323 | } | 322 | } |
324 | 323 | ||
325 | |||
326 | switch (walk_state->opcode) { | 324 | switch (walk_state->opcode) { |
327 | case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */ | 325 | case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */ |
328 | 326 | ||
329 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 327 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); |
330 | if (!return_desc) { | 328 | if (!return_desc) { |
@@ -341,18 +339,19 @@ acpi_ex_opcode_2A_1T_1R ( | |||
341 | break; | 339 | break; |
342 | 340 | ||
343 | 341 | ||
344 | case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */ | 342 | case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */ |
345 | 343 | ||
346 | status = acpi_ex_do_concatenate (operand[0], operand[1], | 344 | status = acpi_ex_do_concatenate (operand[0], operand[1], |
347 | &return_desc, walk_state); | 345 | &return_desc, walk_state); |
348 | break; | 346 | break; |
349 | 347 | ||
350 | 348 | ||
351 | case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */ | 349 | case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */ |
352 | 350 | ||
353 | /* | 351 | /* |
354 | * Input object is guaranteed to be a buffer at this point (it may have | 352 | * Input object is guaranteed to be a buffer at this point (it may have |
355 | * been converted.) Copy the raw buffer data to a new object of type String. | 353 | * been converted.) Copy the raw buffer data to a new object of |
354 | * type String. | ||
356 | */ | 355 | */ |
357 | 356 | ||
358 | /* | 357 | /* |
@@ -383,14 +382,16 @@ acpi_ex_opcode_2A_1T_1R ( | |||
383 | goto cleanup; | 382 | goto cleanup; |
384 | } | 383 | } |
385 | 384 | ||
386 | /* Copy the raw buffer data with no transform. NULL terminated already. */ | 385 | /* Copy the raw buffer data with no transform. NULL terminated already*/ |
387 | 386 | ||
388 | ACPI_MEMCPY (return_desc->string.pointer, | 387 | ACPI_MEMCPY (return_desc->string.pointer, |
389 | operand[0]->buffer.pointer, length); | 388 | operand[0]->buffer.pointer, length); |
390 | break; | 389 | break; |
391 | 390 | ||
392 | 391 | ||
393 | case AML_CONCAT_RES_OP: /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */ | 392 | case AML_CONCAT_RES_OP: |
393 | |||
394 | /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */ | ||
394 | 395 | ||
395 | status = acpi_ex_concat_template (operand[0], operand[1], | 396 | status = acpi_ex_concat_template (operand[0], operand[1], |
396 | &return_desc, walk_state); | 397 | &return_desc, walk_state); |
@@ -407,33 +408,33 @@ acpi_ex_opcode_2A_1T_1R ( | |||
407 | goto cleanup; | 408 | goto cleanup; |
408 | } | 409 | } |
409 | 410 | ||
410 | index = (u32) operand[1]->integer.value; | 411 | index = operand[1]->integer.value; |
412 | |||
413 | /* At this point, the Source operand is a Package, Buffer, or String */ | ||
411 | 414 | ||
412 | /* | ||
413 | * At this point, the Source operand is a Package, Buffer, or String | ||
414 | */ | ||
415 | if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) { | 415 | if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) { |
416 | /* Object to be indexed is a Package */ | 416 | /* Object to be indexed is a Package */ |
417 | 417 | ||
418 | if (index >= operand[0]->package.count) { | 418 | if (index >= operand[0]->package.count) { |
419 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 419 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
420 | "Index value (%X) beyond package end (%X)\n", | 420 | "Index value (%X%8.8X) beyond package end (%X)\n", |
421 | index, operand[0]->package.count)); | 421 | ACPI_FORMAT_UINT64 (index), operand[0]->package.count)); |
422 | status = AE_AML_PACKAGE_LIMIT; | 422 | status = AE_AML_PACKAGE_LIMIT; |
423 | goto cleanup; | 423 | goto cleanup; |
424 | } | 424 | } |
425 | 425 | ||
426 | return_desc->reference.target_type = ACPI_TYPE_PACKAGE; | 426 | return_desc->reference.target_type = ACPI_TYPE_PACKAGE; |
427 | return_desc->reference.object = operand[0]; | 427 | return_desc->reference.object = operand[0]; |
428 | return_desc->reference.where = &operand[0]->package.elements [index]; | 428 | return_desc->reference.where = &operand[0]->package.elements [ |
429 | index]; | ||
429 | } | 430 | } |
430 | else { | 431 | else { |
431 | /* Object to be indexed is a Buffer/String */ | 432 | /* Object to be indexed is a Buffer/String */ |
432 | 433 | ||
433 | if (index >= operand[0]->buffer.length) { | 434 | if (index >= operand[0]->buffer.length) { |
434 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 435 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
435 | "Index value (%X) beyond end of buffer (%X)\n", | 436 | "Index value (%X%8.8X) beyond end of buffer (%X)\n", |
436 | index, operand[0]->buffer.length)); | 437 | ACPI_FORMAT_UINT64 (index), operand[0]->buffer.length)); |
437 | status = AE_AML_BUFFER_LIMIT; | 438 | status = AE_AML_BUFFER_LIMIT; |
438 | goto cleanup; | 439 | goto cleanup; |
439 | } | 440 | } |
@@ -451,7 +452,7 @@ acpi_ex_opcode_2A_1T_1R ( | |||
451 | /* Complete the Index reference object */ | 452 | /* Complete the Index reference object */ |
452 | 453 | ||
453 | return_desc->reference.opcode = AML_INDEX_OP; | 454 | return_desc->reference.opcode = AML_INDEX_OP; |
454 | return_desc->reference.offset = index; | 455 | return_desc->reference.offset = (u32) index; |
455 | 456 | ||
456 | /* Store the reference to the Target */ | 457 | /* Store the reference to the Target */ |
457 | 458 | ||
@@ -536,22 +537,24 @@ acpi_ex_opcode_2A_0T_1R ( | |||
536 | goto cleanup; | 537 | goto cleanup; |
537 | } | 538 | } |
538 | 539 | ||
539 | /* | 540 | /* Execute the Opcode */ |
540 | * Execute the Opcode | 541 | |
541 | */ | 542 | if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) { |
542 | if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) /* logical_op (Operand0, Operand1) */ { | 543 | /* logical_op (Operand0, Operand1) */ |
544 | |||
543 | status = acpi_ex_do_logical_numeric_op (walk_state->opcode, | 545 | status = acpi_ex_do_logical_numeric_op (walk_state->opcode, |
544 | operand[0]->integer.value, operand[1]->integer.value, | 546 | operand[0]->integer.value, operand[1]->integer.value, |
545 | &logical_result); | 547 | &logical_result); |
546 | goto store_logical_result; | 548 | goto store_logical_result; |
547 | } | 549 | } |
548 | else if (walk_state->op_info->flags & AML_LOGICAL) /* logical_op (Operand0, Operand1) */ { | 550 | else if (walk_state->op_info->flags & AML_LOGICAL) { |
551 | /* logical_op (Operand0, Operand1) */ | ||
552 | |||
549 | status = acpi_ex_do_logical_op (walk_state->opcode, operand[0], | 553 | status = acpi_ex_do_logical_op (walk_state->opcode, operand[0], |
550 | operand[1], &logical_result); | 554 | operand[1], &logical_result); |
551 | goto store_logical_result; | 555 | goto store_logical_result; |
552 | } | 556 | } |
553 | 557 | ||
554 | |||
555 | switch (walk_state->opcode) { | 558 | switch (walk_state->opcode) { |
556 | case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */ | 559 | case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */ |
557 | 560 | ||
diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c index 29d0b167745d..23b068adbf58 100644 --- a/drivers/acpi/executer/exoparg3.c +++ b/drivers/acpi/executer/exoparg3.c | |||
@@ -97,11 +97,12 @@ acpi_ex_opcode_3A_0T_0R ( | |||
97 | acpi_status status = AE_OK; | 97 | acpi_status status = AE_OK; |
98 | 98 | ||
99 | 99 | ||
100 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode)); | 100 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_0T_0R", |
101 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
101 | 102 | ||
102 | 103 | ||
103 | switch (walk_state->opcode) { | 104 | switch (walk_state->opcode) { |
104 | case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ | 105 | case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ |
105 | 106 | ||
106 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 107 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
107 | "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", | 108 | "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", |
@@ -116,9 +117,8 @@ acpi_ex_opcode_3A_0T_0R ( | |||
116 | fatal->argument = (u32) operand[2]->integer.value; | 117 | fatal->argument = (u32) operand[2]->integer.value; |
117 | } | 118 | } |
118 | 119 | ||
119 | /* | 120 | /* Always signal the OS! */ |
120 | * Always signal the OS! | 121 | |
121 | */ | ||
122 | status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal); | 122 | status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal); |
123 | 123 | ||
124 | /* Might return while OS is shutting down, just continue */ | 124 | /* Might return while OS is shutting down, just continue */ |
@@ -162,21 +162,23 @@ acpi_ex_opcode_3A_1T_1R ( | |||
162 | union acpi_operand_object *return_desc = NULL; | 162 | union acpi_operand_object *return_desc = NULL; |
163 | char *buffer; | 163 | char *buffer; |
164 | acpi_status status = AE_OK; | 164 | acpi_status status = AE_OK; |
165 | acpi_native_uint index; | 165 | acpi_integer index; |
166 | acpi_size length; | 166 | acpi_size length; |
167 | 167 | ||
168 | 168 | ||
169 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); | 169 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_1T_1R", |
170 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
170 | 171 | ||
171 | 172 | ||
172 | switch (walk_state->opcode) { | 173 | switch (walk_state->opcode) { |
173 | case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */ | 174 | case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */ |
174 | 175 | ||
175 | /* | 176 | /* |
176 | * Create the return object. The Source operand is guaranteed to be | 177 | * Create the return object. The Source operand is guaranteed to be |
177 | * either a String or a Buffer, so just use its type. | 178 | * either a String or a Buffer, so just use its type. |
178 | */ | 179 | */ |
179 | return_desc = acpi_ut_create_internal_object (ACPI_GET_OBJECT_TYPE (operand[0])); | 180 | return_desc = acpi_ut_create_internal_object ( |
181 | ACPI_GET_OBJECT_TYPE (operand[0])); | ||
180 | if (!return_desc) { | 182 | if (!return_desc) { |
181 | status = AE_NO_MEMORY; | 183 | status = AE_NO_MEMORY; |
182 | goto cleanup; | 184 | goto cleanup; |
@@ -184,7 +186,7 @@ acpi_ex_opcode_3A_1T_1R ( | |||
184 | 186 | ||
185 | /* Get the Integer values from the objects */ | 187 | /* Get the Integer values from the objects */ |
186 | 188 | ||
187 | index = (acpi_native_uint) operand[1]->integer.value; | 189 | index = operand[1]->integer.value; |
188 | length = (acpi_size) operand[2]->integer.value; | 190 | length = (acpi_size) operand[2]->integer.value; |
189 | 191 | ||
190 | /* | 192 | /* |
@@ -197,7 +199,8 @@ acpi_ex_opcode_3A_1T_1R ( | |||
197 | 199 | ||
198 | if ((index + length) > | 200 | if ((index + length) > |
199 | operand[0]->string.length) { | 201 | operand[0]->string.length) { |
200 | length = (acpi_size) operand[0]->string.length - index; | 202 | length = (acpi_size) operand[0]->string.length - |
203 | (acpi_size) index; | ||
201 | } | 204 | } |
202 | 205 | ||
203 | /* Allocate a new buffer for the String/Buffer */ | 206 | /* Allocate a new buffer for the String/Buffer */ |
diff --git a/drivers/acpi/executer/exoparg6.c b/drivers/acpi/executer/exoparg6.c index d32624331626..17f81d42ee41 100644 --- a/drivers/acpi/executer/exoparg6.c +++ b/drivers/acpi/executer/exoparg6.c | |||
@@ -75,6 +75,14 @@ | |||
75 | * fully resolved operands. | 75 | * fully resolved operands. |
76 | !*/ | 76 | !*/ |
77 | 77 | ||
78 | /* Local prototypes */ | ||
79 | |||
80 | static u8 | ||
81 | acpi_ex_do_match ( | ||
82 | u32 match_op, | ||
83 | union acpi_operand_object *package_obj, | ||
84 | union acpi_operand_object *match_obj); | ||
85 | |||
78 | 86 | ||
79 | /******************************************************************************* | 87 | /******************************************************************************* |
80 | * | 88 | * |
@@ -92,7 +100,7 @@ | |||
92 | * | 100 | * |
93 | ******************************************************************************/ | 101 | ******************************************************************************/ |
94 | 102 | ||
95 | u8 | 103 | static u8 |
96 | acpi_ex_do_match ( | 104 | acpi_ex_do_match ( |
97 | u32 match_op, | 105 | u32 match_op, |
98 | union acpi_operand_object *package_obj, | 106 | union acpi_operand_object *package_obj, |
@@ -216,11 +224,12 @@ acpi_ex_opcode_6A_0T_1R ( | |||
216 | union acpi_operand_object **operand = &walk_state->operands[0]; | 224 | union acpi_operand_object **operand = &walk_state->operands[0]; |
217 | union acpi_operand_object *return_desc = NULL; | 225 | union acpi_operand_object *return_desc = NULL; |
218 | acpi_status status = AE_OK; | 226 | acpi_status status = AE_OK; |
219 | u32 index; | 227 | acpi_integer index; |
220 | union acpi_operand_object *this_element; | 228 | union acpi_operand_object *this_element; |
221 | 229 | ||
222 | 230 | ||
223 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_6A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); | 231 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_6A_0T_1R", |
232 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
224 | 233 | ||
225 | 234 | ||
226 | switch (walk_state->opcode) { | 235 | switch (walk_state->opcode) { |
@@ -241,9 +250,11 @@ acpi_ex_opcode_6A_0T_1R ( | |||
241 | 250 | ||
242 | /* Get the package start_index, validate against the package length */ | 251 | /* Get the package start_index, validate against the package length */ |
243 | 252 | ||
244 | index = (u32) operand[5]->integer.value; | 253 | index = operand[5]->integer.value; |
245 | if (index >= (u32) operand[0]->package.count) { | 254 | if (index >= operand[0]->package.count) { |
246 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index beyond package end\n")); | 255 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
256 | "Index (%X%8.8X) beyond package end (%X)\n", | ||
257 | ACPI_FORMAT_UINT64 (index), operand[0]->package.count)); | ||
247 | status = AE_AML_PACKAGE_LIMIT; | 258 | status = AE_AML_PACKAGE_LIMIT; |
248 | goto cleanup; | 259 | goto cleanup; |
249 | } | 260 | } |
@@ -314,13 +325,12 @@ acpi_ex_opcode_6A_0T_1R ( | |||
314 | 325 | ||
315 | default: | 326 | default: |
316 | 327 | ||
317 | ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", | 328 | ACPI_REPORT_ERROR (("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n", |
318 | walk_state->opcode)); | 329 | walk_state->opcode)); |
319 | status = AE_AML_BAD_OPCODE; | 330 | status = AE_AML_BAD_OPCODE; |
320 | goto cleanup; | 331 | goto cleanup; |
321 | } | 332 | } |
322 | 333 | ||
323 | |||
324 | walk_state->result_obj = return_desc; | 334 | walk_state->result_obj = return_desc; |
325 | 335 | ||
326 | 336 | ||
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c index 264ef3bba31b..c9e3c68b5549 100644 --- a/drivers/acpi/executer/exprep.c +++ b/drivers/acpi/executer/exprep.c | |||
@@ -52,8 +52,23 @@ | |||
52 | #define _COMPONENT ACPI_EXECUTER | 52 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME ("exprep") | 53 | ACPI_MODULE_NAME ("exprep") |
54 | 54 | ||
55 | /* Local prototypes */ | ||
56 | |||
57 | static u32 | ||
58 | acpi_ex_decode_field_access ( | ||
59 | union acpi_operand_object *obj_desc, | ||
60 | u8 field_flags, | ||
61 | u32 *return_byte_alignment); | ||
62 | |||
55 | 63 | ||
56 | #ifdef ACPI_UNDER_DEVELOPMENT | 64 | #ifdef ACPI_UNDER_DEVELOPMENT |
65 | |||
66 | static u32 | ||
67 | acpi_ex_generate_access ( | ||
68 | u32 field_bit_offset, | ||
69 | u32 field_bit_length, | ||
70 | u32 region_length); | ||
71 | |||
57 | /******************************************************************************* | 72 | /******************************************************************************* |
58 | * | 73 | * |
59 | * FUNCTION: acpi_ex_generate_access | 74 | * FUNCTION: acpi_ex_generate_access |
@@ -99,12 +114,14 @@ acpi_ex_generate_access ( | |||
99 | /* Round Field start offset and length to "minimal" byte boundaries */ | 114 | /* Round Field start offset and length to "minimal" byte boundaries */ |
100 | 115 | ||
101 | field_byte_offset = ACPI_DIV_8 (ACPI_ROUND_DOWN (field_bit_offset, 8)); | 116 | field_byte_offset = ACPI_DIV_8 (ACPI_ROUND_DOWN (field_bit_offset, 8)); |
102 | field_byte_end_offset = ACPI_DIV_8 (ACPI_ROUND_UP (field_bit_length + field_bit_offset, 8)); | 117 | field_byte_end_offset = ACPI_DIV_8 (ACPI_ROUND_UP (field_bit_length + |
118 | field_bit_offset, 8)); | ||
103 | field_byte_length = field_byte_end_offset - field_byte_offset; | 119 | field_byte_length = field_byte_end_offset - field_byte_offset; |
104 | 120 | ||
105 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 121 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
106 | "Bit length %d, Bit offset %d\n", | 122 | "Bit length %d, Bit offset %d\n", |
107 | field_bit_length, field_bit_offset)); | 123 | field_bit_length, field_bit_offset)); |
124 | |||
108 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 125 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
109 | "Byte Length %d, Byte Offset %d, End Offset %d\n", | 126 | "Byte Length %d, Byte Offset %d, End Offset %d\n", |
110 | field_byte_length, field_byte_offset, field_byte_end_offset)); | 127 | field_byte_length, field_byte_offset, field_byte_end_offset)); |
@@ -117,20 +134,26 @@ acpi_ex_generate_access ( | |||
117 | */ | 134 | */ |
118 | for (access_byte_width = 1; access_byte_width <= 8; access_byte_width <<= 1) { | 135 | for (access_byte_width = 1; access_byte_width <= 8; access_byte_width <<= 1) { |
119 | /* | 136 | /* |
120 | * 1) Round end offset up to next access boundary and make sure that this | 137 | * 1) Round end offset up to next access boundary and make sure that |
121 | * does not go beyond the end of the parent region. | 138 | * this does not go beyond the end of the parent region. |
122 | * 2) When the Access width is greater than the field_byte_length, we are done. | 139 | * 2) When the Access width is greater than the field_byte_length, we |
123 | * (This does not optimize for the perfectly aligned case yet). | 140 | * are done. (This does not optimize for the perfectly aligned |
141 | * case yet). | ||
124 | */ | 142 | */ |
125 | if (ACPI_ROUND_UP (field_byte_end_offset, access_byte_width) <= region_length) { | 143 | if (ACPI_ROUND_UP (field_byte_end_offset, access_byte_width) <= region_length) { |
126 | field_start_offset = ACPI_ROUND_DOWN (field_byte_offset, access_byte_width) / | 144 | field_start_offset = |
127 | access_byte_width; | 145 | ACPI_ROUND_DOWN (field_byte_offset, access_byte_width) / |
128 | field_end_offset = ACPI_ROUND_UP ((field_byte_length + field_byte_offset), | 146 | access_byte_width; |
129 | access_byte_width) / access_byte_width; | 147 | |
130 | accesses = field_end_offset - field_start_offset; | 148 | field_end_offset = |
149 | ACPI_ROUND_UP ((field_byte_length + field_byte_offset), | ||
150 | access_byte_width) / access_byte_width; | ||
151 | |||
152 | accesses = field_end_offset - field_start_offset; | ||
131 | 153 | ||
132 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 154 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
133 | "access_width %d end is within region\n", access_byte_width)); | 155 | "access_width %d end is within region\n", access_byte_width)); |
156 | |||
134 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 157 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
135 | "Field Start %d, Field End %d -- requires %d accesses\n", | 158 | "Field Start %d, Field End %d -- requires %d accesses\n", |
136 | field_start_offset, field_end_offset, accesses)); | 159 | field_start_offset, field_end_offset, accesses)); |
@@ -139,8 +162,8 @@ acpi_ex_generate_access ( | |||
139 | 162 | ||
140 | if (accesses <= 1) { | 163 | if (accesses <= 1) { |
141 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 164 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
142 | "Entire field can be accessed with one operation of size %d\n", | 165 | "Entire field can be accessed with one operation of size %d\n", |
143 | access_byte_width)); | 166 | access_byte_width)); |
144 | return_VALUE (access_byte_width); | 167 | return_VALUE (access_byte_width); |
145 | } | 168 | } |
146 | 169 | ||
@@ -155,15 +178,20 @@ acpi_ex_generate_access ( | |||
155 | } | 178 | } |
156 | else { | 179 | else { |
157 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 180 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
158 | "access_width %d end is NOT within region\n", access_byte_width)); | 181 | "access_width %d end is NOT within region\n", access_byte_width)); |
159 | if (access_byte_width == 1) { | 182 | if (access_byte_width == 1) { |
160 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 183 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
161 | "Field goes beyond end-of-region!\n")); | 184 | "Field goes beyond end-of-region!\n")); |
162 | return_VALUE (0); /* Field does not fit in the region at all */ | ||
163 | } | ||
164 | 185 | ||
165 | /* This width goes beyond the end-of-region, back off to previous access */ | 186 | /* Field does not fit in the region at all */ |
166 | 187 | ||
188 | return_VALUE (0); | ||
189 | } | ||
190 | |||
191 | /* | ||
192 | * This width goes beyond the end-of-region, back off to | ||
193 | * previous access | ||
194 | */ | ||
167 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 195 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
168 | "Backing off to previous optimal access width of %d\n", | 196 | "Backing off to previous optimal access width of %d\n", |
169 | minimum_access_width)); | 197 | minimum_access_width)); |
@@ -171,8 +199,10 @@ acpi_ex_generate_access ( | |||
171 | } | 199 | } |
172 | } | 200 | } |
173 | 201 | ||
174 | /* Could not read/write field with one operation, just use max access width */ | 202 | /* |
175 | 203 | * Could not read/write field with one operation, | |
204 | * just use max access width | ||
205 | */ | ||
176 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 206 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
177 | "Cannot access field in one operation, using width 8\n")); | 207 | "Cannot access field in one operation, using width 8\n")); |
178 | return_VALUE (8); | 208 | return_VALUE (8); |
@@ -184,8 +214,9 @@ acpi_ex_generate_access ( | |||
184 | * | 214 | * |
185 | * FUNCTION: acpi_ex_decode_field_access | 215 | * FUNCTION: acpi_ex_decode_field_access |
186 | * | 216 | * |
187 | * PARAMETERS: Access - Encoded field access bits | 217 | * PARAMETERS: obj_desc - Field object |
188 | * Length - Field length. | 218 | * field_flags - Encoded fieldflags (contains access bits) |
219 | * return_byte_alignment - Where the byte alignment is returned | ||
189 | * | 220 | * |
190 | * RETURN: Field granularity (8, 16, 32 or 64) and | 221 | * RETURN: Field granularity (8, 16, 32 or 64) and |
191 | * byte_alignment (1, 2, 3, or 4) | 222 | * byte_alignment (1, 2, 3, or 4) |
@@ -214,9 +245,10 @@ acpi_ex_decode_field_access ( | |||
214 | case AML_FIELD_ACCESS_ANY: | 245 | case AML_FIELD_ACCESS_ANY: |
215 | 246 | ||
216 | #ifdef ACPI_UNDER_DEVELOPMENT | 247 | #ifdef ACPI_UNDER_DEVELOPMENT |
217 | byte_alignment = acpi_ex_generate_access (obj_desc->common_field.start_field_bit_offset, | 248 | byte_alignment = |
218 | obj_desc->common_field.bit_length, | 249 | acpi_ex_generate_access (obj_desc->common_field.start_field_bit_offset, |
219 | 0xFFFFFFFF /* Temp until we pass region_length as param */); | 250 | obj_desc->common_field.bit_length, |
251 | 0xFFFFFFFF /* Temp until we pass region_length as parameter */); | ||
220 | bit_length = byte_alignment * 8; | 252 | bit_length = byte_alignment * 8; |
221 | #endif | 253 | #endif |
222 | 254 | ||
@@ -276,6 +308,7 @@ acpi_ex_decode_field_access ( | |||
276 | * field_flags - Access, lock_rule, and update_rule. | 308 | * field_flags - Access, lock_rule, and update_rule. |
277 | * The format of a field_flag is described | 309 | * The format of a field_flag is described |
278 | * in the ACPI specification | 310 | * in the ACPI specification |
311 | * field_attribute - Special attributes (not used) | ||
279 | * field_bit_position - Field start position | 312 | * field_bit_position - Field start position |
280 | * field_bit_length - Field length in number of bits | 313 | * field_bit_length - Field length in number of bits |
281 | * | 314 | * |
@@ -337,7 +370,7 @@ acpi_ex_prep_common_field_object ( | |||
337 | /* Setup width (access granularity) fields */ | 370 | /* Setup width (access granularity) fields */ |
338 | 371 | ||
339 | obj_desc->common_field.access_byte_width = (u8) | 372 | obj_desc->common_field.access_byte_width = (u8) |
340 | ACPI_DIV_8 (access_bit_width); /* 1, 2, 4, 8 */ | 373 | ACPI_DIV_8 (access_bit_width); /* 1, 2, 4, 8 */ |
341 | 374 | ||
342 | obj_desc->common_field.access_bit_width = (u8) access_bit_width; | 375 | obj_desc->common_field.access_bit_width = (u8) access_bit_width; |
343 | 376 | ||
@@ -380,11 +413,7 @@ acpi_ex_prep_common_field_object ( | |||
380 | * | 413 | * |
381 | * FUNCTION: acpi_ex_prep_field_value | 414 | * FUNCTION: acpi_ex_prep_field_value |
382 | * | 415 | * |
383 | * PARAMETERS: Node - Owning Node | 416 | * PARAMETERS: Info - Contains all field creation info |
384 | * region_node - Region in which field is being defined | ||
385 | * field_flags - Access, lock_rule, and update_rule. | ||
386 | * field_bit_position - Field start position | ||
387 | * field_bit_length - Field length in number of bits | ||
388 | * | 417 | * |
389 | * RETURN: Status | 418 | * RETURN: Status |
390 | * | 419 | * |
@@ -445,7 +474,7 @@ acpi_ex_prep_field_value ( | |||
445 | switch (info->field_type) { | 474 | switch (info->field_type) { |
446 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 475 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
447 | 476 | ||
448 | obj_desc->field.region_obj = acpi_ns_get_attached_object (info->region_node); | 477 | obj_desc->field.region_obj = acpi_ns_get_attached_object (info->region_node); |
449 | 478 | ||
450 | /* An additional reference for the container */ | 479 | /* An additional reference for the container */ |
451 | 480 | ||
@@ -461,8 +490,10 @@ acpi_ex_prep_field_value ( | |||
461 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 490 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
462 | 491 | ||
463 | obj_desc->bank_field.value = info->bank_value; | 492 | obj_desc->bank_field.value = info->bank_value; |
464 | obj_desc->bank_field.region_obj = acpi_ns_get_attached_object (info->region_node); | 493 | obj_desc->bank_field.region_obj = acpi_ns_get_attached_object ( |
465 | obj_desc->bank_field.bank_obj = acpi_ns_get_attached_object (info->register_node); | 494 | info->region_node); |
495 | obj_desc->bank_field.bank_obj = acpi_ns_get_attached_object ( | ||
496 | info->register_node); | ||
466 | 497 | ||
467 | /* An additional reference for the attached objects */ | 498 | /* An additional reference for the attached objects */ |
468 | 499 | ||
@@ -481,10 +512,13 @@ acpi_ex_prep_field_value ( | |||
481 | 512 | ||
482 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 513 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
483 | 514 | ||
484 | obj_desc->index_field.index_obj = acpi_ns_get_attached_object (info->register_node); | 515 | obj_desc->index_field.index_obj = acpi_ns_get_attached_object ( |
485 | obj_desc->index_field.data_obj = acpi_ns_get_attached_object (info->data_register_node); | 516 | info->register_node); |
517 | obj_desc->index_field.data_obj = acpi_ns_get_attached_object ( | ||
518 | info->data_register_node); | ||
486 | obj_desc->index_field.value = (u32) | 519 | obj_desc->index_field.value = (u32) |
487 | (info->field_bit_position / ACPI_MUL_8 (obj_desc->field.access_byte_width)); | 520 | (info->field_bit_position / ACPI_MUL_8 ( |
521 | obj_desc->field.access_byte_width)); | ||
488 | 522 | ||
489 | if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) { | 523 | if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) { |
490 | ACPI_REPORT_ERROR (("Null Index Object during field prep\n")); | 524 | ACPI_REPORT_ERROR (("Null Index Object during field prep\n")); |
diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 7cfd0684c70b..723aaef4bb4a 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c | |||
@@ -115,7 +115,6 @@ acpi_ex_system_memory_space_handler ( | |||
115 | return_ACPI_STATUS (AE_AML_OPERAND_VALUE); | 115 | return_ACPI_STATUS (AE_AML_OPERAND_VALUE); |
116 | } | 116 | } |
117 | 117 | ||
118 | |||
119 | #ifndef ACPI_MISALIGNED_TRANSFERS | 118 | #ifndef ACPI_MISALIGNED_TRANSFERS |
120 | /* | 119 | /* |
121 | * Hardware does not support non-aligned data transfers, we must verify | 120 | * Hardware does not support non-aligned data transfers, we must verify |
@@ -134,7 +133,8 @@ acpi_ex_system_memory_space_handler ( | |||
134 | */ | 133 | */ |
135 | if ((address < mem_info->mapped_physical_address) || | 134 | if ((address < mem_info->mapped_physical_address) || |
136 | (((acpi_integer) address + length) > | 135 | (((acpi_integer) address + length) > |
137 | ((acpi_integer) mem_info->mapped_physical_address + mem_info->mapped_length))) { | 136 | ((acpi_integer) |
137 | mem_info->mapped_physical_address + mem_info->mapped_length))) { | ||
138 | /* | 138 | /* |
139 | * The request cannot be resolved by the current memory mapping; | 139 | * The request cannot be resolved by the current memory mapping; |
140 | * Delete the existing mapping and create a new one. | 140 | * Delete the existing mapping and create a new one. |
@@ -150,7 +150,9 @@ acpi_ex_system_memory_space_handler ( | |||
150 | * Don't attempt to map memory beyond the end of the region, and | 150 | * Don't attempt to map memory beyond the end of the region, and |
151 | * constrain the maximum mapping size to something reasonable. | 151 | * constrain the maximum mapping size to something reasonable. |
152 | */ | 152 | */ |
153 | window_size = (acpi_size) ((mem_info->address + mem_info->length) - address); | 153 | window_size = (acpi_size) |
154 | ((mem_info->address + mem_info->length) - address); | ||
155 | |||
154 | if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) { | 156 | if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) { |
155 | window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE; | 157 | window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE; |
156 | } | 158 | } |
@@ -160,8 +162,9 @@ acpi_ex_system_memory_space_handler ( | |||
160 | status = acpi_os_map_memory (address, window_size, | 162 | status = acpi_os_map_memory (address, window_size, |
161 | (void **) &mem_info->mapped_logical_address); | 163 | (void **) &mem_info->mapped_logical_address); |
162 | if (ACPI_FAILURE (status)) { | 164 | if (ACPI_FAILURE (status)) { |
163 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X%8.8X, size %X\n", | 165 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
164 | ACPI_FORMAT_UINT64 (address), (u32) window_size)); | 166 | "Could not map memory at %8.8X%8.8X, size %X\n", |
167 | ACPI_FORMAT_UINT64 (address), (u32) window_size)); | ||
165 | mem_info->mapped_length = 0; | 168 | mem_info->mapped_length = 0; |
166 | return_ACPI_STATUS (status); | 169 | return_ACPI_STATUS (status); |
167 | } | 170 | } |
@@ -177,10 +180,12 @@ acpi_ex_system_memory_space_handler ( | |||
177 | * access | 180 | * access |
178 | */ | 181 | */ |
179 | logical_addr_ptr = mem_info->mapped_logical_address + | 182 | logical_addr_ptr = mem_info->mapped_logical_address + |
180 | ((acpi_integer) address - (acpi_integer) mem_info->mapped_physical_address); | 183 | ((acpi_integer) address - |
184 | (acpi_integer) mem_info->mapped_physical_address); | ||
181 | 185 | ||
182 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 186 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
183 | "system_memory %d (%d width) Address=%8.8X%8.8X\n", function, bit_width, | 187 | "system_memory %d (%d width) Address=%8.8X%8.8X\n", |
188 | function, bit_width, | ||
184 | ACPI_FORMAT_UINT64 (address))); | 189 | ACPI_FORMAT_UINT64 (address))); |
185 | 190 | ||
186 | /* | 191 | /* |
@@ -298,13 +303,15 @@ acpi_ex_system_io_space_handler ( | |||
298 | switch (function) { | 303 | switch (function) { |
299 | case ACPI_READ: | 304 | case ACPI_READ: |
300 | 305 | ||
301 | status = acpi_os_read_port ((acpi_io_address) address, &value32, bit_width); | 306 | status = acpi_os_read_port ((acpi_io_address) address, |
307 | &value32, bit_width); | ||
302 | *value = value32; | 308 | *value = value32; |
303 | break; | 309 | break; |
304 | 310 | ||
305 | case ACPI_WRITE: | 311 | case ACPI_WRITE: |
306 | 312 | ||
307 | status = acpi_os_write_port ((acpi_io_address) address, (u32) *value, bit_width); | 313 | status = acpi_os_write_port ((acpi_io_address) address, |
314 | (u32) *value, bit_width); | ||
308 | break; | 315 | break; |
309 | 316 | ||
310 | default: | 317 | default: |
@@ -375,12 +382,14 @@ acpi_ex_pci_config_space_handler ( | |||
375 | case ACPI_READ: | 382 | case ACPI_READ: |
376 | 383 | ||
377 | *value = 0; | 384 | *value = 0; |
378 | status = acpi_os_read_pci_configuration (pci_id, pci_register, value, bit_width); | 385 | status = acpi_os_read_pci_configuration (pci_id, pci_register, |
386 | value, bit_width); | ||
379 | break; | 387 | break; |
380 | 388 | ||
381 | case ACPI_WRITE: | 389 | case ACPI_WRITE: |
382 | 390 | ||
383 | status = acpi_os_write_pci_configuration (pci_id, pci_register, *value, bit_width); | 391 | status = acpi_os_write_pci_configuration (pci_id, pci_register, |
392 | *value, bit_width); | ||
384 | break; | 393 | break; |
385 | 394 | ||
386 | default: | 395 | default: |
@@ -505,8 +514,7 @@ acpi_ex_data_table_space_handler ( | |||
505 | 514 | ||
506 | logical_addr_ptr = ACPI_PHYSADDR_TO_PTR (address); | 515 | logical_addr_ptr = ACPI_PHYSADDR_TO_PTR (address); |
507 | 516 | ||
508 | 517 | /* Perform the memory read or write */ | |
509 | /* Perform the memory read or write */ | ||
510 | 518 | ||
511 | switch (function) { | 519 | switch (function) { |
512 | case ACPI_READ: | 520 | case ACPI_READ: |
diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c index 7936329a0e35..21d5c74fa309 100644 --- a/drivers/acpi/executer/exresnte.c +++ b/drivers/acpi/executer/exresnte.c | |||
@@ -210,15 +210,15 @@ acpi_ex_resolve_node_to_value ( | |||
210 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 210 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
211 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 211 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
212 | 212 | ||
213 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "field_read Node=%p source_desc=%p Type=%X\n", | 213 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
214 | "field_read Node=%p source_desc=%p Type=%X\n", | ||
214 | node, source_desc, entry_type)); | 215 | node, source_desc, entry_type)); |
215 | 216 | ||
216 | status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc); | 217 | status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc); |
217 | break; | 218 | break; |
218 | 219 | ||
219 | /* | 220 | /* For these objects, just return the object attached to the Node */ |
220 | * For these objects, just return the object attached to the Node | 221 | |
221 | */ | ||
222 | case ACPI_TYPE_MUTEX: | 222 | case ACPI_TYPE_MUTEX: |
223 | case ACPI_TYPE_METHOD: | 223 | case ACPI_TYPE_METHOD: |
224 | case ACPI_TYPE_POWER: | 224 | case ACPI_TYPE_POWER: |
@@ -233,12 +233,12 @@ acpi_ex_resolve_node_to_value ( | |||
233 | acpi_ut_add_reference (obj_desc); | 233 | acpi_ut_add_reference (obj_desc); |
234 | break; | 234 | break; |
235 | 235 | ||
236 | |||
237 | /* TYPE_ANY is untyped, and thus there is no object associated with it */ | 236 | /* TYPE_ANY is untyped, and thus there is no object associated with it */ |
238 | 237 | ||
239 | case ACPI_TYPE_ANY: | 238 | case ACPI_TYPE_ANY: |
240 | 239 | ||
241 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Untyped entry %p, no attached object!\n", | 240 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
241 | "Untyped entry %p, no attached object!\n", | ||
242 | node)); | 242 | node)); |
243 | 243 | ||
244 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ | 244 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ |
@@ -259,7 +259,8 @@ acpi_ex_resolve_node_to_value ( | |||
259 | default: | 259 | default: |
260 | /* No named references are allowed here */ | 260 | /* No named references are allowed here */ |
261 | 261 | ||
262 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported Reference opcode %X (%s)\n", | 262 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
263 | "Unsupported Reference opcode %X (%s)\n", | ||
263 | source_desc->reference.opcode, | 264 | source_desc->reference.opcode, |
264 | acpi_ps_get_opcode_name (source_desc->reference.opcode))); | 265 | acpi_ps_get_opcode_name (source_desc->reference.opcode))); |
265 | 266 | ||
@@ -268,11 +269,12 @@ acpi_ex_resolve_node_to_value ( | |||
268 | break; | 269 | break; |
269 | 270 | ||
270 | 271 | ||
271 | /* Default case is for unknown types */ | ||
272 | |||
273 | default: | 272 | default: |
274 | 273 | ||
275 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Node %p - Unknown object type %X\n", | 274 | /* Default case is for unknown types */ |
275 | |||
276 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
277 | "Node %p - Unknown object type %X\n", | ||
276 | node, entry_type)); | 278 | node, entry_type)); |
277 | 279 | ||
278 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 280 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); |
@@ -280,7 +282,7 @@ acpi_ex_resolve_node_to_value ( | |||
280 | } /* switch (entry_type) */ | 282 | } /* switch (entry_type) */ |
281 | 283 | ||
282 | 284 | ||
283 | /* Put the object descriptor on the stack */ | 285 | /* Return the object descriptor */ |
284 | 286 | ||
285 | *object_ptr = (void *) obj_desc; | 287 | *object_ptr = (void *) obj_desc; |
286 | return_ACPI_STATUS (status); | 288 | return_ACPI_STATUS (status); |
diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c index 7be604911156..3de45672379a 100644 --- a/drivers/acpi/executer/exresolv.c +++ b/drivers/acpi/executer/exresolv.c | |||
@@ -54,6 +54,13 @@ | |||
54 | #define _COMPONENT ACPI_EXECUTER | 54 | #define _COMPONENT ACPI_EXECUTER |
55 | ACPI_MODULE_NAME ("exresolv") | 55 | ACPI_MODULE_NAME ("exresolv") |
56 | 56 | ||
57 | /* Local prototypes */ | ||
58 | |||
59 | static acpi_status | ||
60 | acpi_ex_resolve_object_to_value ( | ||
61 | union acpi_operand_object **stack_ptr, | ||
62 | struct acpi_walk_state *walk_state); | ||
63 | |||
57 | 64 | ||
58 | /******************************************************************************* | 65 | /******************************************************************************* |
59 | * | 66 | * |
@@ -96,6 +103,11 @@ acpi_ex_resolve_to_value ( | |||
96 | if (ACPI_FAILURE (status)) { | 103 | if (ACPI_FAILURE (status)) { |
97 | return_ACPI_STATUS (status); | 104 | return_ACPI_STATUS (status); |
98 | } | 105 | } |
106 | |||
107 | if (!*stack_ptr) { | ||
108 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n")); | ||
109 | return_ACPI_STATUS (AE_AML_NO_OPERAND); | ||
110 | } | ||
99 | } | 111 | } |
100 | 112 | ||
101 | /* | 113 | /* |
@@ -120,18 +132,17 @@ acpi_ex_resolve_to_value ( | |||
120 | * | 132 | * |
121 | * FUNCTION: acpi_ex_resolve_object_to_value | 133 | * FUNCTION: acpi_ex_resolve_object_to_value |
122 | * | 134 | * |
123 | * PARAMETERS: stack_ptr - Pointer to a stack location that contains a | 135 | * PARAMETERS: stack_ptr - Pointer to an internal object |
124 | * ptr to an internal object. | ||
125 | * walk_state - Current method state | 136 | * walk_state - Current method state |
126 | * | 137 | * |
127 | * RETURN: Status | 138 | * RETURN: Status |
128 | * | 139 | * |
129 | * DESCRIPTION: Retrieve the value from an internal object. The Reference type | 140 | * DESCRIPTION: Retrieve the value from an internal object. The Reference type |
130 | * uses the associated AML opcode to determine the value. | 141 | * uses the associated AML opcode to determine the value. |
131 | * | 142 | * |
132 | ******************************************************************************/ | 143 | ******************************************************************************/ |
133 | 144 | ||
134 | acpi_status | 145 | static acpi_status |
135 | acpi_ex_resolve_object_to_value ( | 146 | acpi_ex_resolve_object_to_value ( |
136 | union acpi_operand_object **stack_ptr, | 147 | union acpi_operand_object **stack_ptr, |
137 | struct acpi_walk_state *walk_state) | 148 | struct acpi_walk_state *walk_state) |
@@ -159,7 +170,7 @@ acpi_ex_resolve_object_to_value ( | |||
159 | case AML_NAME_OP: | 170 | case AML_NAME_OP: |
160 | 171 | ||
161 | /* | 172 | /* |
162 | * Convert indirect name ptr to a direct name ptr. | 173 | * Convert name reference to a namespace node |
163 | * Then, acpi_ex_resolve_node_to_value can be used to get the value | 174 | * Then, acpi_ex_resolve_node_to_value can be used to get the value |
164 | */ | 175 | */ |
165 | temp_node = stack_desc->reference.object; | 176 | temp_node = stack_desc->reference.object; |
@@ -168,7 +179,7 @@ acpi_ex_resolve_object_to_value ( | |||
168 | 179 | ||
169 | acpi_ut_remove_reference (stack_desc); | 180 | acpi_ut_remove_reference (stack_desc); |
170 | 181 | ||
171 | /* Put direct name pointer onto stack and exit */ | 182 | /* Return the namespace node */ |
172 | 183 | ||
173 | (*stack_ptr) = temp_node; | 184 | (*stack_ptr) = temp_node; |
174 | break; | 185 | break; |
@@ -255,10 +266,19 @@ acpi_ex_resolve_object_to_value ( | |||
255 | 266 | ||
256 | break; | 267 | break; |
257 | 268 | ||
269 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ | ||
270 | |||
271 | /* Get the object pointed to by the namespace node */ | ||
272 | |||
273 | *stack_ptr = (stack_desc->reference.node)->object; | ||
274 | acpi_ut_add_reference (*stack_ptr); | ||
275 | acpi_ut_remove_reference (stack_desc); | ||
276 | break; | ||
258 | 277 | ||
259 | default: | 278 | default: |
260 | 279 | ||
261 | ACPI_REPORT_ERROR (("During resolve, Unknown Reference opcode %X (%s) in %p\n", | 280 | ACPI_REPORT_ERROR (( |
281 | "During resolve, Unknown Reference opcode %X (%s) in %p\n", | ||
262 | opcode, acpi_ps_get_opcode_name (opcode), stack_desc)); | 282 | opcode, acpi_ps_get_opcode_name (opcode), stack_desc)); |
263 | status = AE_AML_INTERNAL; | 283 | status = AE_AML_INTERNAL; |
264 | break; | 284 | break; |
@@ -278,9 +298,8 @@ acpi_ex_resolve_object_to_value ( | |||
278 | break; | 298 | break; |
279 | 299 | ||
280 | 300 | ||
281 | /* | 301 | /* These cases may never happen here, but just in case.. */ |
282 | * These cases may never happen here, but just in case.. | 302 | |
283 | */ | ||
284 | case ACPI_TYPE_BUFFER_FIELD: | 303 | case ACPI_TYPE_BUFFER_FIELD: |
285 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 304 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
286 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 305 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
@@ -333,9 +352,8 @@ acpi_ex_resolve_multiple ( | |||
333 | ACPI_FUNCTION_TRACE ("acpi_ex_resolve_multiple"); | 352 | ACPI_FUNCTION_TRACE ("acpi_ex_resolve_multiple"); |
334 | 353 | ||
335 | 354 | ||
336 | /* | 355 | /* Operand can be either a namespace node or an operand descriptor */ |
337 | * Operand can be either a namespace node or an operand descriptor | 356 | |
338 | */ | ||
339 | switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { | 357 | switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { |
340 | case ACPI_DESC_TYPE_OPERAND: | 358 | case ACPI_DESC_TYPE_OPERAND: |
341 | type = obj_desc->common.type; | 359 | type = obj_desc->common.type; |
@@ -357,10 +375,8 @@ acpi_ex_resolve_multiple ( | |||
357 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 375 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); |
358 | } | 376 | } |
359 | 377 | ||
378 | /* If type is anything other than a reference, we are done */ | ||
360 | 379 | ||
361 | /* | ||
362 | * If type is anything other than a reference, we are done | ||
363 | */ | ||
364 | if (type != ACPI_TYPE_LOCAL_REFERENCE) { | 380 | if (type != ACPI_TYPE_LOCAL_REFERENCE) { |
365 | goto exit; | 381 | goto exit; |
366 | } | 382 | } |
@@ -382,8 +398,9 @@ acpi_ex_resolve_multiple ( | |||
382 | /* All "References" point to a NS node */ | 398 | /* All "References" point to a NS node */ |
383 | 399 | ||
384 | if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { | 400 | if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { |
385 | ACPI_REPORT_ERROR (("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", | 401 | ACPI_REPORT_ERROR (( |
386 | node, acpi_ut_get_descriptor_name (node))); | 402 | "acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", |
403 | node, acpi_ut_get_descriptor_name (node))); | ||
387 | return_ACPI_STATUS (AE_AML_INTERNAL); | 404 | return_ACPI_STATUS (AE_AML_INTERNAL); |
388 | } | 405 | } |
389 | 406 | ||
@@ -440,8 +457,9 @@ acpi_ex_resolve_multiple ( | |||
440 | /* All "References" point to a NS node */ | 457 | /* All "References" point to a NS node */ |
441 | 458 | ||
442 | if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { | 459 | if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { |
443 | ACPI_REPORT_ERROR (("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", | 460 | ACPI_REPORT_ERROR (( |
444 | node, acpi_ut_get_descriptor_name (node))); | 461 | "acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", |
462 | node, acpi_ut_get_descriptor_name (node))); | ||
445 | return_ACPI_STATUS (AE_AML_INTERNAL); | 463 | return_ACPI_STATUS (AE_AML_INTERNAL); |
446 | } | 464 | } |
447 | 465 | ||
@@ -468,7 +486,7 @@ acpi_ex_resolve_multiple ( | |||
468 | 486 | ||
469 | if (return_desc) { | 487 | if (return_desc) { |
470 | status = acpi_ds_method_data_get_value (obj_desc->reference.opcode, | 488 | status = acpi_ds_method_data_get_value (obj_desc->reference.opcode, |
471 | obj_desc->reference.offset, walk_state, &obj_desc); | 489 | obj_desc->reference.offset, walk_state, &obj_desc); |
472 | if (ACPI_FAILURE (status)) { | 490 | if (ACPI_FAILURE (status)) { |
473 | return_ACPI_STATUS (status); | 491 | return_ACPI_STATUS (status); |
474 | } | 492 | } |
@@ -500,7 +518,8 @@ acpi_ex_resolve_multiple ( | |||
500 | 518 | ||
501 | default: | 519 | default: |
502 | 520 | ||
503 | ACPI_REPORT_ERROR (("acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", | 521 | ACPI_REPORT_ERROR (( |
522 | "acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", | ||
504 | obj_desc->reference.opcode)); | 523 | obj_desc->reference.opcode)); |
505 | return_ACPI_STATUS (AE_AML_INTERNAL); | 524 | return_ACPI_STATUS (AE_AML_INTERNAL); |
506 | } | 525 | } |
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index c92890220c32..d8b470eefe7a 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c | |||
@@ -52,6 +52,14 @@ | |||
52 | #define _COMPONENT ACPI_EXECUTER | 52 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME ("exresop") | 53 | ACPI_MODULE_NAME ("exresop") |
54 | 54 | ||
55 | /* Local prototypes */ | ||
56 | |||
57 | static acpi_status | ||
58 | acpi_ex_check_object_type ( | ||
59 | acpi_object_type type_needed, | ||
60 | acpi_object_type this_type, | ||
61 | void *object); | ||
62 | |||
55 | 63 | ||
56 | /******************************************************************************* | 64 | /******************************************************************************* |
57 | * | 65 | * |
@@ -67,7 +75,7 @@ | |||
67 | * | 75 | * |
68 | ******************************************************************************/ | 76 | ******************************************************************************/ |
69 | 77 | ||
70 | acpi_status | 78 | static acpi_status |
71 | acpi_ex_check_object_type ( | 79 | acpi_ex_check_object_type ( |
72 | acpi_object_type type_needed, | 80 | acpi_object_type type_needed, |
73 | acpi_object_type this_type, | 81 | acpi_object_type this_type, |
@@ -142,6 +150,7 @@ acpi_ex_resolve_operands ( | |||
142 | const struct acpi_opcode_info *op_info; | 150 | const struct acpi_opcode_info *op_info; |
143 | u32 this_arg_type; | 151 | u32 this_arg_type; |
144 | acpi_object_type type_needed; | 152 | acpi_object_type type_needed; |
153 | u16 target_op = 0; | ||
145 | 154 | ||
146 | 155 | ||
147 | ACPI_FUNCTION_TRACE_U32 ("ex_resolve_operands", opcode); | 156 | ACPI_FUNCTION_TRACE_U32 ("ex_resolve_operands", opcode); |
@@ -160,7 +169,8 @@ acpi_ex_resolve_operands ( | |||
160 | return_ACPI_STATUS (AE_AML_INTERNAL); | 169 | return_ACPI_STATUS (AE_AML_INTERNAL); |
161 | } | 170 | } |
162 | 171 | ||
163 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X [%s] required_operand_types=%8.8X \n", | 172 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
173 | "Opcode %X [%s] required_operand_types=%8.8X \n", | ||
164 | opcode, op_info->name, arg_types)); | 174 | opcode, op_info->name, arg_types)); |
165 | 175 | ||
166 | /* | 176 | /* |
@@ -187,7 +197,7 @@ acpi_ex_resolve_operands ( | |||
187 | switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { | 197 | switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { |
188 | case ACPI_DESC_TYPE_NAMED: | 198 | case ACPI_DESC_TYPE_NAMED: |
189 | 199 | ||
190 | /* Node */ | 200 | /* Namespace Node */ |
191 | 201 | ||
192 | object_type = ((struct acpi_namespace_node *) obj_desc)->type; | 202 | object_type = ((struct acpi_namespace_node *) obj_desc)->type; |
193 | break; | 203 | break; |
@@ -202,16 +212,16 @@ acpi_ex_resolve_operands ( | |||
202 | /* Check for bad acpi_object_type */ | 212 | /* Check for bad acpi_object_type */ |
203 | 213 | ||
204 | if (!acpi_ut_valid_object_type (object_type)) { | 214 | if (!acpi_ut_valid_object_type (object_type)) { |
205 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad operand object type [%X]\n", | 215 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
216 | "Bad operand object type [%X]\n", | ||
206 | object_type)); | 217 | object_type)); |
207 | 218 | ||
208 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 219 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); |
209 | } | 220 | } |
210 | 221 | ||
211 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { | 222 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { |
212 | /* | 223 | /* Decode the Reference */ |
213 | * Decode the Reference | 224 | |
214 | */ | ||
215 | op_info = acpi_ps_get_opcode_info (opcode); | 225 | op_info = acpi_ps_get_opcode_info (opcode); |
216 | if (op_info->class == AML_CLASS_UNKNOWN) { | 226 | if (op_info->class == AML_CLASS_UNKNOWN) { |
217 | return_ACPI_STATUS (AE_AML_BAD_OPCODE); | 227 | return_ACPI_STATUS (AE_AML_BAD_OPCODE); |
@@ -219,12 +229,17 @@ acpi_ex_resolve_operands ( | |||
219 | 229 | ||
220 | switch (obj_desc->reference.opcode) { | 230 | switch (obj_desc->reference.opcode) { |
221 | case AML_DEBUG_OP: | 231 | case AML_DEBUG_OP: |
232 | target_op = AML_DEBUG_OP; | ||
233 | |||
234 | /*lint -fallthrough */ | ||
235 | |||
222 | case AML_NAME_OP: | 236 | case AML_NAME_OP: |
223 | case AML_INDEX_OP: | 237 | case AML_INDEX_OP: |
224 | case AML_REF_OF_OP: | 238 | case AML_REF_OF_OP: |
225 | case AML_ARG_OP: | 239 | case AML_ARG_OP: |
226 | case AML_LOCAL_OP: | 240 | case AML_LOCAL_OP: |
227 | case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ | 241 | case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ |
242 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ | ||
228 | 243 | ||
229 | ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 244 | ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
230 | "Operand is a Reference, ref_opcode [%s]\n", | 245 | "Operand is a Reference, ref_opcode [%s]\n", |
@@ -254,10 +269,8 @@ acpi_ex_resolve_operands ( | |||
254 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 269 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); |
255 | } | 270 | } |
256 | 271 | ||
272 | /* Get one argument type, point to the next */ | ||
257 | 273 | ||
258 | /* | ||
259 | * Get one argument type, point to the next | ||
260 | */ | ||
261 | this_arg_type = GET_CURRENT_ARG_TYPE (arg_types); | 274 | this_arg_type = GET_CURRENT_ARG_TYPE (arg_types); |
262 | INCREMENT_ARG_LIST (arg_types); | 275 | INCREMENT_ARG_LIST (arg_types); |
263 | 276 | ||
@@ -271,26 +284,31 @@ acpi_ex_resolve_operands ( | |||
271 | if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) && | 284 | if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) && |
272 | (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) { | 285 | (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) { |
273 | /* | 286 | /* |
274 | * String found - the string references a named object and must be | 287 | * String found - the string references a named object and |
275 | * resolved to a node | 288 | * must be resolved to a node |
276 | */ | 289 | */ |
277 | goto next_operand; | 290 | goto next_operand; |
278 | } | 291 | } |
279 | 292 | ||
280 | /* Else not a string - fall through to the normal Reference case below */ | 293 | /* |
294 | * Else not a string - fall through to the normal Reference | ||
295 | * case below | ||
296 | */ | ||
281 | /*lint -fallthrough */ | 297 | /*lint -fallthrough */ |
282 | 298 | ||
283 | case ARGI_REFERENCE: /* References: */ | 299 | case ARGI_REFERENCE: /* References: */ |
284 | case ARGI_INTEGER_REF: | 300 | case ARGI_INTEGER_REF: |
285 | case ARGI_OBJECT_REF: | 301 | case ARGI_OBJECT_REF: |
286 | case ARGI_DEVICE_REF: | 302 | case ARGI_DEVICE_REF: |
287 | case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ | 303 | case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ |
288 | case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ | 304 | case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ |
289 | case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ | 305 | case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ |
290 | |||
291 | /* Need an operand of type ACPI_TYPE_LOCAL_REFERENCE */ | ||
292 | 306 | ||
293 | if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) /* Node (name) ptr OK as-is */ { | 307 | /* |
308 | * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE | ||
309 | * A Namespace Node is OK as-is | ||
310 | */ | ||
311 | if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) { | ||
294 | goto next_operand; | 312 | goto next_operand; |
295 | } | 313 | } |
296 | 314 | ||
@@ -300,11 +318,9 @@ acpi_ex_resolve_operands ( | |||
300 | return_ACPI_STATUS (status); | 318 | return_ACPI_STATUS (status); |
301 | } | 319 | } |
302 | 320 | ||
303 | if (AML_NAME_OP == obj_desc->reference.opcode) { | 321 | if (obj_desc->reference.opcode == AML_NAME_OP) { |
304 | /* | 322 | /* Convert a named reference to the actual named object */ |
305 | * Convert an indirect name ptr to direct name ptr and put | 323 | |
306 | * it on the stack | ||
307 | */ | ||
308 | temp_node = obj_desc->reference.object; | 324 | temp_node = obj_desc->reference.object; |
309 | acpi_ut_remove_reference (obj_desc); | 325 | acpi_ut_remove_reference (obj_desc); |
310 | (*stack_ptr) = temp_node; | 326 | (*stack_ptr) = temp_node; |
@@ -332,7 +348,6 @@ acpi_ex_resolve_operands ( | |||
332 | break; | 348 | break; |
333 | } | 349 | } |
334 | 350 | ||
335 | |||
336 | /* | 351 | /* |
337 | * Resolve this object to a value | 352 | * Resolve this object to a value |
338 | */ | 353 | */ |
@@ -392,7 +407,7 @@ acpi_ex_resolve_operands ( | |||
392 | /* | 407 | /* |
393 | * The more complex cases allow multiple resolved object types | 408 | * The more complex cases allow multiple resolved object types |
394 | */ | 409 | */ |
395 | case ARGI_INTEGER: /* Number */ | 410 | case ARGI_INTEGER: |
396 | 411 | ||
397 | /* | 412 | /* |
398 | * Need an operand of type ACPI_TYPE_INTEGER, | 413 | * Need an operand of type ACPI_TYPE_INTEGER, |
@@ -563,7 +578,7 @@ acpi_ex_resolve_operands ( | |||
563 | 578 | ||
564 | case ARGI_REGION_OR_FIELD: | 579 | case ARGI_REGION_OR_FIELD: |
565 | 580 | ||
566 | /* Need an operand of type ACPI_TYPE_REGION or a FIELD in a region */ | 581 | /* Need an operand of type REGION or a FIELD in a region */ |
567 | 582 | ||
568 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 583 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { |
569 | case ACPI_TYPE_REGION: | 584 | case ACPI_TYPE_REGION: |
@@ -614,6 +629,12 @@ acpi_ex_resolve_operands ( | |||
614 | break; | 629 | break; |
615 | } | 630 | } |
616 | 631 | ||
632 | if (target_op == AML_DEBUG_OP) { | ||
633 | /* Allow store of any object to the Debug object */ | ||
634 | |||
635 | break; | ||
636 | } | ||
637 | |||
617 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 638 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
618 | "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", | 639 | "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", |
619 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 640 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); |
@@ -652,8 +673,7 @@ next_operand: | |||
652 | if (GET_CURRENT_ARG_TYPE (arg_types)) { | 673 | if (GET_CURRENT_ARG_TYPE (arg_types)) { |
653 | stack_ptr--; | 674 | stack_ptr--; |
654 | } | 675 | } |
655 | 676 | } | |
656 | } /* while (*Types) */ | ||
657 | 677 | ||
658 | return_ACPI_STATUS (status); | 678 | return_ACPI_STATUS (status); |
659 | } | 679 | } |
diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c index e0fc6aba1253..2725db0901b8 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/executer/exstore.c | |||
@@ -48,11 +48,171 @@ | |||
48 | #include <acpi/acinterp.h> | 48 | #include <acpi/acinterp.h> |
49 | #include <acpi/amlcode.h> | 49 | #include <acpi/amlcode.h> |
50 | #include <acpi/acnamesp.h> | 50 | #include <acpi/acnamesp.h> |
51 | #include <acpi/acparser.h> | ||
51 | 52 | ||
52 | 53 | ||
53 | #define _COMPONENT ACPI_EXECUTER | 54 | #define _COMPONENT ACPI_EXECUTER |
54 | ACPI_MODULE_NAME ("exstore") | 55 | ACPI_MODULE_NAME ("exstore") |
55 | 56 | ||
57 | /* Local prototypes */ | ||
58 | |||
59 | static void | ||
60 | acpi_ex_do_debug_object ( | ||
61 | union acpi_operand_object *source_desc, | ||
62 | u32 level, | ||
63 | u32 index); | ||
64 | |||
65 | static acpi_status | ||
66 | acpi_ex_store_object_to_index ( | ||
67 | union acpi_operand_object *val_desc, | ||
68 | union acpi_operand_object *dest_desc, | ||
69 | struct acpi_walk_state *walk_state); | ||
70 | |||
71 | |||
72 | /******************************************************************************* | ||
73 | * | ||
74 | * FUNCTION: acpi_ex_do_debug_object | ||
75 | * | ||
76 | * PARAMETERS: source_desc - Value to be stored | ||
77 | * Level - Indentation level (used for packages) | ||
78 | * Index - Current package element, zero if not pkg | ||
79 | * | ||
80 | * RETURN: None | ||
81 | * | ||
82 | * DESCRIPTION: Handles stores to the Debug Object. | ||
83 | * | ||
84 | ******************************************************************************/ | ||
85 | |||
86 | static void | ||
87 | acpi_ex_do_debug_object ( | ||
88 | union acpi_operand_object *source_desc, | ||
89 | u32 level, | ||
90 | u32 index) | ||
91 | { | ||
92 | u32 i; | ||
93 | |||
94 | |||
95 | ACPI_FUNCTION_TRACE_PTR ("ex_do_debug_object", source_desc); | ||
96 | |||
97 | |||
98 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", | ||
99 | level, " ")); | ||
100 | |||
101 | /* Display index for package output only */ | ||
102 | |||
103 | if (index > 0) { | ||
104 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, | ||
105 | "(%.2u) ", index -1)); | ||
106 | } | ||
107 | |||
108 | if (!source_desc) { | ||
109 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n")); | ||
110 | return_VOID; | ||
111 | } | ||
112 | |||
113 | if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_OPERAND) { | ||
114 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: ", | ||
115 | acpi_ut_get_object_type_name (source_desc))); | ||
116 | |||
117 | if (!acpi_ut_valid_internal_object (source_desc)) { | ||
118 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, | ||
119 | "%p, Invalid Internal Object!\n", source_desc)); | ||
120 | return_VOID; | ||
121 | } | ||
122 | } | ||
123 | else if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_NAMED) { | ||
124 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: %p\n", | ||
125 | acpi_ut_get_type_name (((struct acpi_namespace_node *) source_desc)->type), | ||
126 | source_desc)); | ||
127 | return_VOID; | ||
128 | } | ||
129 | else { | ||
130 | return_VOID; | ||
131 | } | ||
132 | |||
133 | switch (ACPI_GET_OBJECT_TYPE (source_desc)) { | ||
134 | case ACPI_TYPE_INTEGER: | ||
135 | |||
136 | /* Output correct integer width */ | ||
137 | |||
138 | if (acpi_gbl_integer_byte_width == 4) { | ||
139 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n", | ||
140 | (u32) source_desc->integer.value)); | ||
141 | } | ||
142 | else { | ||
143 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n", | ||
144 | ACPI_FORMAT_UINT64 (source_desc->integer.value))); | ||
145 | } | ||
146 | break; | ||
147 | |||
148 | case ACPI_TYPE_BUFFER: | ||
149 | |||
150 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]", | ||
151 | (u32) source_desc->buffer.length)); | ||
152 | ACPI_DUMP_BUFFER (source_desc->buffer.pointer, | ||
153 | (source_desc->buffer.length < 32) ? source_desc->buffer.length : 32); | ||
154 | break; | ||
155 | |||
156 | case ACPI_TYPE_STRING: | ||
157 | |||
158 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n", | ||
159 | source_desc->string.length, source_desc->string.pointer)); | ||
160 | break; | ||
161 | |||
162 | case ACPI_TYPE_PACKAGE: | ||
163 | |||
164 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X Elements]\n", | ||
165 | source_desc->package.count)); | ||
166 | |||
167 | /* Output the entire contents of the package */ | ||
168 | |||
169 | for (i = 0; i < source_desc->package.count; i++) { | ||
170 | acpi_ex_do_debug_object (source_desc->package.elements[i], | ||
171 | level+4, i+1); | ||
172 | } | ||
173 | break; | ||
174 | |||
175 | case ACPI_TYPE_LOCAL_REFERENCE: | ||
176 | |||
177 | if (source_desc->reference.opcode == AML_INDEX_OP) { | ||
178 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s, 0x%X]\n", | ||
179 | acpi_ps_get_opcode_name (source_desc->reference.opcode), | ||
180 | source_desc->reference.offset)); | ||
181 | } | ||
182 | else { | ||
183 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s]\n", | ||
184 | acpi_ps_get_opcode_name (source_desc->reference.opcode))); | ||
185 | } | ||
186 | |||
187 | |||
188 | if (source_desc->reference.object) { | ||
189 | if (ACPI_GET_DESCRIPTOR_TYPE (source_desc->reference.object) == | ||
190 | ACPI_DESC_TYPE_NAMED) { | ||
191 | acpi_ex_do_debug_object (((struct acpi_namespace_node *) | ||
192 | source_desc->reference.object)->object, | ||
193 | level+4, 0); | ||
194 | } | ||
195 | else { | ||
196 | acpi_ex_do_debug_object (source_desc->reference.object, level+4, 0); | ||
197 | } | ||
198 | } | ||
199 | else if (source_desc->reference.node) { | ||
200 | acpi_ex_do_debug_object ((source_desc->reference.node)->object, | ||
201 | level+4, 0); | ||
202 | } | ||
203 | break; | ||
204 | |||
205 | default: | ||
206 | |||
207 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p %s\n", | ||
208 | source_desc, acpi_ut_get_object_type_name (source_desc))); | ||
209 | break; | ||
210 | } | ||
211 | |||
212 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n")); | ||
213 | return_VOID; | ||
214 | } | ||
215 | |||
56 | 216 | ||
57 | /******************************************************************************* | 217 | /******************************************************************************* |
58 | * | 218 | * |
@@ -154,8 +314,9 @@ acpi_ex_store ( | |||
154 | 314 | ||
155 | /* Storing an object into a Name "container" */ | 315 | /* Storing an object into a Name "container" */ |
156 | 316 | ||
157 | status = acpi_ex_store_object_to_node (source_desc, ref_desc->reference.object, | 317 | status = acpi_ex_store_object_to_node (source_desc, |
158 | walk_state, ACPI_IMPLICIT_CONVERSION); | 318 | ref_desc->reference.object, |
319 | walk_state, ACPI_IMPLICIT_CONVERSION); | ||
159 | break; | 320 | break; |
160 | 321 | ||
161 | 322 | ||
@@ -173,7 +334,7 @@ acpi_ex_store ( | |||
173 | /* Store to a method local/arg */ | 334 | /* Store to a method local/arg */ |
174 | 335 | ||
175 | status = acpi_ds_store_object_to_local (ref_desc->reference.opcode, | 336 | status = acpi_ds_store_object_to_local (ref_desc->reference.opcode, |
176 | ref_desc->reference.offset, source_desc, walk_state); | 337 | ref_desc->reference.offset, source_desc, walk_state); |
177 | break; | 338 | break; |
178 | 339 | ||
179 | 340 | ||
@@ -187,60 +348,7 @@ acpi_ex_store ( | |||
187 | "**** Write to Debug Object: Object %p %s ****:\n\n", | 348 | "**** Write to Debug Object: Object %p %s ****:\n\n", |
188 | source_desc, acpi_ut_get_object_type_name (source_desc))); | 349 | source_desc, acpi_ut_get_object_type_name (source_desc))); |
189 | 350 | ||
190 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ", | 351 | acpi_ex_do_debug_object (source_desc, 0, 0); |
191 | acpi_ut_get_object_type_name (source_desc))); | ||
192 | |||
193 | if (!acpi_ut_valid_internal_object (source_desc)) { | ||
194 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, | ||
195 | "%p, Invalid Internal Object!\n", source_desc)); | ||
196 | break; | ||
197 | } | ||
198 | |||
199 | switch (ACPI_GET_OBJECT_TYPE (source_desc)) { | ||
200 | case ACPI_TYPE_INTEGER: | ||
201 | |||
202 | if (acpi_gbl_integer_byte_width == 4) { | ||
203 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n", | ||
204 | (u32) source_desc->integer.value)); | ||
205 | } | ||
206 | else { | ||
207 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n", | ||
208 | ACPI_FORMAT_UINT64 (source_desc->integer.value))); | ||
209 | } | ||
210 | break; | ||
211 | |||
212 | |||
213 | case ACPI_TYPE_BUFFER: | ||
214 | |||
215 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]", | ||
216 | (u32) source_desc->buffer.length)); | ||
217 | ACPI_DUMP_BUFFER (source_desc->buffer.pointer, | ||
218 | (source_desc->buffer.length < 32) ? source_desc->buffer.length : 32); | ||
219 | break; | ||
220 | |||
221 | |||
222 | case ACPI_TYPE_STRING: | ||
223 | |||
224 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n", | ||
225 | source_desc->string.length, source_desc->string.pointer)); | ||
226 | break; | ||
227 | |||
228 | |||
229 | case ACPI_TYPE_PACKAGE: | ||
230 | |||
231 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] Elements Ptr - %p\n", | ||
232 | source_desc->package.count, source_desc->package.elements)); | ||
233 | break; | ||
234 | |||
235 | |||
236 | default: | ||
237 | |||
238 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p\n", | ||
239 | source_desc)); | ||
240 | break; | ||
241 | } | ||
242 | |||
243 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n")); | ||
244 | break; | 352 | break; |
245 | 353 | ||
246 | 354 | ||
@@ -272,7 +380,7 @@ acpi_ex_store ( | |||
272 | * | 380 | * |
273 | ******************************************************************************/ | 381 | ******************************************************************************/ |
274 | 382 | ||
275 | acpi_status | 383 | static acpi_status |
276 | acpi_ex_store_object_to_index ( | 384 | acpi_ex_store_object_to_index ( |
277 | union acpi_operand_object *source_desc, | 385 | union acpi_operand_object *source_desc, |
278 | union acpi_operand_object *index_desc, | 386 | union acpi_operand_object *index_desc, |
@@ -313,16 +421,22 @@ acpi_ex_store_object_to_index ( | |||
313 | if (obj_desc) { | 421 | if (obj_desc) { |
314 | /* Decrement reference count by the ref count of the parent package */ | 422 | /* Decrement reference count by the ref count of the parent package */ |
315 | 423 | ||
316 | for (i = 0; i < ((union acpi_operand_object *) index_desc->reference.object)->common.reference_count; i++) { | 424 | for (i = 0; |
425 | i < ((union acpi_operand_object *) | ||
426 | index_desc->reference.object)->common.reference_count; | ||
427 | i++) { | ||
317 | acpi_ut_remove_reference (obj_desc); | 428 | acpi_ut_remove_reference (obj_desc); |
318 | } | 429 | } |
319 | } | 430 | } |
320 | 431 | ||
321 | *(index_desc->reference.where) = new_desc; | 432 | *(index_desc->reference.where) = new_desc; |
322 | 433 | ||
323 | /* Increment reference count by the ref count of the parent package -1 */ | 434 | /* Increment ref count by the ref count of the parent package-1 */ |
324 | 435 | ||
325 | for (i = 1; i < ((union acpi_operand_object *) index_desc->reference.object)->common.reference_count; i++) { | 436 | for (i = 1; |
437 | i < ((union acpi_operand_object *) | ||
438 | index_desc->reference.object)->common.reference_count; | ||
439 | i++) { | ||
326 | acpi_ut_add_reference (new_desc); | 440 | acpi_ut_add_reference (new_desc); |
327 | } | 441 | } |
328 | 442 | ||
@@ -440,9 +554,8 @@ acpi_ex_store_object_to_node ( | |||
440 | ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_node", source_desc); | 554 | ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_node", source_desc); |
441 | 555 | ||
442 | 556 | ||
443 | /* | 557 | /* Get current type of the node, and object attached to Node */ |
444 | * Get current type of the node, and object attached to Node | 558 | |
445 | */ | ||
446 | target_type = acpi_ns_get_type (node); | 559 | target_type = acpi_ns_get_type (node); |
447 | target_desc = acpi_ns_get_attached_object (node); | 560 | target_desc = acpi_ns_get_attached_object (node); |
448 | 561 | ||
@@ -467,19 +580,18 @@ acpi_ex_store_object_to_node ( | |||
467 | target_type = ACPI_TYPE_ANY; | 580 | target_type = ACPI_TYPE_ANY; |
468 | } | 581 | } |
469 | 582 | ||
470 | /* | 583 | /* Do the actual store operation */ |
471 | * Do the actual store operation | 584 | |
472 | */ | ||
473 | switch (target_type) { | 585 | switch (target_type) { |
474 | case ACPI_TYPE_BUFFER_FIELD: | 586 | case ACPI_TYPE_BUFFER_FIELD: |
475 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 587 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
476 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 588 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
477 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 589 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
478 | 590 | ||
479 | /* | 591 | /* For fields, copy the source data to the target field. */ |
480 | * For fields, copy the source data to the target field. | 592 | |
481 | */ | 593 | status = acpi_ex_write_data_to_field (source_desc, target_desc, |
482 | status = acpi_ex_write_data_to_field (source_desc, target_desc, &walk_state->result_obj); | 594 | &walk_state->result_obj); |
483 | break; | 595 | break; |
484 | 596 | ||
485 | 597 | ||
@@ -493,7 +605,8 @@ acpi_ex_store_object_to_node ( | |||
493 | * | 605 | * |
494 | * Copy and/or convert the source object to a new target object | 606 | * Copy and/or convert the source object to a new target object |
495 | */ | 607 | */ |
496 | status = acpi_ex_store_object_to_object (source_desc, target_desc, &new_desc, walk_state); | 608 | status = acpi_ex_store_object_to_object (source_desc, target_desc, |
609 | &new_desc, walk_state); | ||
497 | if (ACPI_FAILURE (status)) { | 610 | if (ACPI_FAILURE (status)) { |
498 | return_ACPI_STATUS (status); | 611 | return_ACPI_STATUS (status); |
499 | } | 612 | } |
@@ -526,7 +639,8 @@ acpi_ex_store_object_to_node ( | |||
526 | 639 | ||
527 | /* No conversions for all other types. Just attach the source object */ | 640 | /* No conversions for all other types. Just attach the source object */ |
528 | 641 | ||
529 | status = acpi_ns_attach_object (node, source_desc, ACPI_GET_OBJECT_TYPE (source_desc)); | 642 | status = acpi_ns_attach_object (node, source_desc, |
643 | ACPI_GET_OBJECT_TYPE (source_desc)); | ||
530 | break; | 644 | break; |
531 | } | 645 | } |
532 | 646 | ||
diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c index d3677feb07fd..120f30ed0bd4 100644 --- a/drivers/acpi/executer/exstoren.c +++ b/drivers/acpi/executer/exstoren.c | |||
@@ -81,9 +81,8 @@ acpi_ex_resolve_object ( | |||
81 | ACPI_FUNCTION_TRACE ("ex_resolve_object"); | 81 | ACPI_FUNCTION_TRACE ("ex_resolve_object"); |
82 | 82 | ||
83 | 83 | ||
84 | /* | 84 | /* Ensure we have a Target that can be stored to */ |
85 | * Ensure we have a Target that can be stored to | 85 | |
86 | */ | ||
87 | switch (target_type) { | 86 | switch (target_type) { |
88 | case ACPI_TYPE_BUFFER_FIELD: | 87 | case ACPI_TYPE_BUFFER_FIELD: |
89 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 88 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
@@ -118,16 +117,14 @@ acpi_ex_resolve_object ( | |||
118 | break; | 117 | break; |
119 | } | 118 | } |
120 | 119 | ||
121 | /* | 120 | /* Must have a Integer, Buffer, or String */ |
122 | * Must have a Integer, Buffer, or String | 121 | |
123 | */ | ||
124 | if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) && | 122 | if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) && |
125 | (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) && | 123 | (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) && |
126 | (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) && | 124 | (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) && |
127 | !((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) { | 125 | !((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) { |
128 | /* | 126 | /* Conversion successful but still not a valid type */ |
129 | * Conversion successful but still not a valid type | 127 | |
130 | */ | ||
131 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 128 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
132 | "Cannot assign type %s to %s (must be type Int/Str/Buf)\n", | 129 | "Cannot assign type %s to %s (must be type Int/Str/Buf)\n", |
133 | acpi_ut_get_object_type_name (source_desc), | 130 | acpi_ut_get_object_type_name (source_desc), |
@@ -140,9 +137,8 @@ acpi_ex_resolve_object ( | |||
140 | case ACPI_TYPE_LOCAL_ALIAS: | 137 | case ACPI_TYPE_LOCAL_ALIAS: |
141 | case ACPI_TYPE_LOCAL_METHOD_ALIAS: | 138 | case ACPI_TYPE_LOCAL_METHOD_ALIAS: |
142 | 139 | ||
143 | /* | 140 | /* Aliases are resolved by acpi_ex_prep_operands */ |
144 | * Aliases are resolved by acpi_ex_prep_operands | 141 | |
145 | */ | ||
146 | ACPI_REPORT_ERROR (("Store into Alias - should never happen\n")); | 142 | ACPI_REPORT_ERROR (("Store into Alias - should never happen\n")); |
147 | status = AE_AML_INTERNAL; | 143 | status = AE_AML_INTERNAL; |
148 | break; | 144 | break; |
diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c index 05e1ecae8d92..12d1527669c8 100644 --- a/drivers/acpi/executer/exstorob.c +++ b/drivers/acpi/executer/exstorob.c | |||
@@ -128,7 +128,8 @@ acpi_ex_store_buffer_to_buffer ( | |||
128 | else { | 128 | else { |
129 | /* Truncate the source, copy only what will fit */ | 129 | /* Truncate the source, copy only what will fit */ |
130 | 130 | ||
131 | ACPI_MEMCPY (target_desc->buffer.pointer, buffer, target_desc->buffer.length); | 131 | ACPI_MEMCPY (target_desc->buffer.pointer, buffer, |
132 | target_desc->buffer.length); | ||
132 | 133 | ||
133 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 134 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
134 | "Truncating source buffer from %X to %X\n", | 135 | "Truncating source buffer from %X to %X\n", |
@@ -183,7 +184,8 @@ acpi_ex_store_string_to_string ( | |||
183 | * String will fit in existing non-static buffer. | 184 | * String will fit in existing non-static buffer. |
184 | * Clear old string and copy in the new one | 185 | * Clear old string and copy in the new one |
185 | */ | 186 | */ |
186 | ACPI_MEMSET (target_desc->string.pointer, 0, (acpi_size) target_desc->string.length + 1); | 187 | ACPI_MEMSET (target_desc->string.pointer, 0, |
188 | (acpi_size) target_desc->string.length + 1); | ||
187 | ACPI_MEMCPY (target_desc->string.pointer, buffer, length); | 189 | ACPI_MEMCPY (target_desc->string.pointer, buffer, length); |
188 | } | 190 | } |
189 | else { | 191 | else { |
@@ -198,7 +200,8 @@ acpi_ex_store_string_to_string ( | |||
198 | ACPI_MEM_FREE (target_desc->string.pointer); | 200 | ACPI_MEM_FREE (target_desc->string.pointer); |
199 | } | 201 | } |
200 | 202 | ||
201 | target_desc->string.pointer = ACPI_MEM_CALLOCATE ((acpi_size) length + 1); | 203 | target_desc->string.pointer = ACPI_MEM_CALLOCATE ( |
204 | (acpi_size) length + 1); | ||
202 | if (!target_desc->string.pointer) { | 205 | if (!target_desc->string.pointer) { |
203 | return_ACPI_STATUS (AE_NO_MEMORY); | 206 | return_ACPI_STATUS (AE_NO_MEMORY); |
204 | } | 207 | } |
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index f92efc512890..cafa702108dc 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c | |||
@@ -55,8 +55,8 @@ | |||
55 | * | 55 | * |
56 | * FUNCTION: acpi_ex_system_wait_semaphore | 56 | * FUNCTION: acpi_ex_system_wait_semaphore |
57 | * | 57 | * |
58 | * PARAMETERS: Semaphore - OSD semaphore to wait on | 58 | * PARAMETERS: Semaphore - Semaphore to wait on |
59 | * Timeout - Max time to wait | 59 | * Timeout - Max time to wait |
60 | * | 60 | * |
61 | * RETURN: Status | 61 | * RETURN: Status |
62 | * | 62 | * |
@@ -90,7 +90,8 @@ acpi_ex_system_wait_semaphore ( | |||
90 | 90 | ||
91 | status = acpi_os_wait_semaphore (semaphore, 1, timeout); | 91 | status = acpi_os_wait_semaphore (semaphore, 1, timeout); |
92 | 92 | ||
93 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*** Thread awake after blocking, %s\n", | 93 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
94 | "*** Thread awake after blocking, %s\n", | ||
94 | acpi_format_exception (status))); | 95 | acpi_format_exception (status))); |
95 | 96 | ||
96 | /* Reacquire the interpreter */ | 97 | /* Reacquire the interpreter */ |
@@ -111,8 +112,8 @@ acpi_ex_system_wait_semaphore ( | |||
111 | * | 112 | * |
112 | * FUNCTION: acpi_ex_system_do_stall | 113 | * FUNCTION: acpi_ex_system_do_stall |
113 | * | 114 | * |
114 | * PARAMETERS: how_long - The amount of time to stall, | 115 | * PARAMETERS: how_long - The amount of time to stall, |
115 | * in microseconds | 116 | * in microseconds |
116 | * | 117 | * |
117 | * RETURN: Status | 118 | * RETURN: Status |
118 | * | 119 | * |
@@ -141,7 +142,8 @@ acpi_ex_system_do_stall ( | |||
141 | * (ACPI specifies 100 usec as max, but this gives some slack in | 142 | * (ACPI specifies 100 usec as max, but this gives some slack in |
142 | * order to support existing BIOSs) | 143 | * order to support existing BIOSs) |
143 | */ | 144 | */ |
144 | ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n", how_long)); | 145 | ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n", |
146 | how_long)); | ||
145 | status = AE_AML_OPERAND_VALUE; | 147 | status = AE_AML_OPERAND_VALUE; |
146 | } | 148 | } |
147 | else { | 149 | else { |
@@ -156,8 +158,8 @@ acpi_ex_system_do_stall ( | |||
156 | * | 158 | * |
157 | * FUNCTION: acpi_ex_system_do_suspend | 159 | * FUNCTION: acpi_ex_system_do_suspend |
158 | * | 160 | * |
159 | * PARAMETERS: how_long - The amount of time to suspend, | 161 | * PARAMETERS: how_long - The amount of time to suspend, |
160 | * in milliseconds | 162 | * in milliseconds |
161 | * | 163 | * |
162 | * RETURN: None | 164 | * RETURN: None |
163 | * | 165 | * |
@@ -192,8 +194,8 @@ acpi_ex_system_do_suspend ( | |||
192 | * | 194 | * |
193 | * FUNCTION: acpi_ex_system_acquire_mutex | 195 | * FUNCTION: acpi_ex_system_acquire_mutex |
194 | * | 196 | * |
195 | * PARAMETERS: *time_desc - The 'time to delay' object descriptor | 197 | * PARAMETERS: time_desc - The 'time to delay' object descriptor |
196 | * *obj_desc - The object descriptor for this op | 198 | * obj_desc - The object descriptor for this op |
197 | * | 199 | * |
198 | * RETURN: Status | 200 | * RETURN: Status |
199 | * | 201 | * |
@@ -218,16 +220,15 @@ acpi_ex_system_acquire_mutex ( | |||
218 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 220 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
219 | } | 221 | } |
220 | 222 | ||
221 | /* | 223 | /* Support for the _GL_ Mutex object -- go get the global lock */ |
222 | * Support for the _GL_ Mutex object -- go get the global lock | 224 | |
223 | */ | ||
224 | if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { | 225 | if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { |
225 | status = acpi_ev_acquire_global_lock ((u16) time_desc->integer.value); | 226 | status = acpi_ev_acquire_global_lock ((u16) time_desc->integer.value); |
226 | return_ACPI_STATUS (status); | 227 | return_ACPI_STATUS (status); |
227 | } | 228 | } |
228 | 229 | ||
229 | status = acpi_ex_system_wait_semaphore (obj_desc->mutex.semaphore, | 230 | status = acpi_ex_system_wait_semaphore (obj_desc->mutex.semaphore, |
230 | (u16) time_desc->integer.value); | 231 | (u16) time_desc->integer.value); |
231 | return_ACPI_STATUS (status); | 232 | return_ACPI_STATUS (status); |
232 | } | 233 | } |
233 | 234 | ||
@@ -236,7 +237,7 @@ acpi_ex_system_acquire_mutex ( | |||
236 | * | 237 | * |
237 | * FUNCTION: acpi_ex_system_release_mutex | 238 | * FUNCTION: acpi_ex_system_release_mutex |
238 | * | 239 | * |
239 | * PARAMETERS: *obj_desc - The object descriptor for this op | 240 | * PARAMETERS: obj_desc - The object descriptor for this op |
240 | * | 241 | * |
241 | * RETURN: Status | 242 | * RETURN: Status |
242 | * | 243 | * |
@@ -261,9 +262,8 @@ acpi_ex_system_release_mutex ( | |||
261 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 262 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
262 | } | 263 | } |
263 | 264 | ||
264 | /* | 265 | /* Support for the _GL_ Mutex object -- release the global lock */ |
265 | * Support for the _GL_ Mutex object -- release the global lock | 266 | |
266 | */ | ||
267 | if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { | 267 | if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { |
268 | status = acpi_ev_release_global_lock (); | 268 | status = acpi_ev_release_global_lock (); |
269 | return_ACPI_STATUS (status); | 269 | return_ACPI_STATUS (status); |
@@ -278,9 +278,9 @@ acpi_ex_system_release_mutex ( | |||
278 | * | 278 | * |
279 | * FUNCTION: acpi_ex_system_signal_event | 279 | * FUNCTION: acpi_ex_system_signal_event |
280 | * | 280 | * |
281 | * PARAMETERS: *obj_desc - The object descriptor for this op | 281 | * PARAMETERS: obj_desc - The object descriptor for this op |
282 | * | 282 | * |
283 | * RETURN: AE_OK | 283 | * RETURN: Status |
284 | * | 284 | * |
285 | * DESCRIPTION: Provides an access point to perform synchronization operations | 285 | * DESCRIPTION: Provides an access point to perform synchronization operations |
286 | * within the AML. | 286 | * within the AML. |
@@ -309,8 +309,8 @@ acpi_ex_system_signal_event ( | |||
309 | * | 309 | * |
310 | * FUNCTION: acpi_ex_system_wait_event | 310 | * FUNCTION: acpi_ex_system_wait_event |
311 | * | 311 | * |
312 | * PARAMETERS: *time_desc - The 'time to delay' object descriptor | 312 | * PARAMETERS: time_desc - The 'time to delay' object descriptor |
313 | * *obj_desc - The object descriptor for this op | 313 | * obj_desc - The object descriptor for this op |
314 | * | 314 | * |
315 | * RETURN: Status | 315 | * RETURN: Status |
316 | * | 316 | * |
@@ -333,7 +333,7 @@ acpi_ex_system_wait_event ( | |||
333 | 333 | ||
334 | if (obj_desc) { | 334 | if (obj_desc) { |
335 | status = acpi_ex_system_wait_semaphore (obj_desc->event.semaphore, | 335 | status = acpi_ex_system_wait_semaphore (obj_desc->event.semaphore, |
336 | (u16) time_desc->integer.value); | 336 | (u16) time_desc->integer.value); |
337 | } | 337 | } |
338 | 338 | ||
339 | return_ACPI_STATUS (status); | 339 | return_ACPI_STATUS (status); |
@@ -344,7 +344,7 @@ acpi_ex_system_wait_event ( | |||
344 | * | 344 | * |
345 | * FUNCTION: acpi_ex_system_reset_event | 345 | * FUNCTION: acpi_ex_system_reset_event |
346 | * | 346 | * |
347 | * PARAMETERS: *obj_desc - The object descriptor for this op | 347 | * PARAMETERS: obj_desc - The object descriptor for this op |
348 | * | 348 | * |
349 | * RETURN: Status | 349 | * RETURN: Status |
350 | * | 350 | * |
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index 40c6abb8b49a..5c7ec0c04177 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c | |||
@@ -67,22 +67,31 @@ | |||
67 | #define _COMPONENT ACPI_EXECUTER | 67 | #define _COMPONENT ACPI_EXECUTER |
68 | ACPI_MODULE_NAME ("exutils") | 68 | ACPI_MODULE_NAME ("exutils") |
69 | 69 | ||
70 | /* Local prototypes */ | ||
70 | 71 | ||
71 | #ifndef ACPI_NO_METHOD_EXECUTION | 72 | static u32 |
73 | acpi_ex_digits_needed ( | ||
74 | acpi_integer value, | ||
75 | u32 base); | ||
72 | 76 | ||
77 | |||
78 | #ifndef ACPI_NO_METHOD_EXECUTION | ||
73 | /******************************************************************************* | 79 | /******************************************************************************* |
74 | * | 80 | * |
75 | * FUNCTION: acpi_ex_enter_interpreter | 81 | * FUNCTION: acpi_ex_enter_interpreter |
76 | * | 82 | * |
77 | * PARAMETERS: None | 83 | * PARAMETERS: None |
78 | * | 84 | * |
85 | * RETURN: Status | ||
86 | * | ||
79 | * DESCRIPTION: Enter the interpreter execution region. Failure to enter | 87 | * DESCRIPTION: Enter the interpreter execution region. Failure to enter |
80 | * the interpreter region is a fatal system error | 88 | * the interpreter region is a fatal system error |
81 | * | 89 | * |
82 | ******************************************************************************/ | 90 | ******************************************************************************/ |
83 | 91 | ||
84 | acpi_status | 92 | acpi_status |
85 | acpi_ex_enter_interpreter (void) | 93 | acpi_ex_enter_interpreter ( |
94 | void) | ||
86 | { | 95 | { |
87 | acpi_status status; | 96 | acpi_status status; |
88 | 97 | ||
@@ -104,6 +113,8 @@ acpi_ex_enter_interpreter (void) | |||
104 | * | 113 | * |
105 | * PARAMETERS: None | 114 | * PARAMETERS: None |
106 | * | 115 | * |
116 | * RETURN: None | ||
117 | * | ||
107 | * DESCRIPTION: Exit the interpreter execution region | 118 | * DESCRIPTION: Exit the interpreter execution region |
108 | * | 119 | * |
109 | * Cases where the interpreter is unlocked: | 120 | * Cases where the interpreter is unlocked: |
@@ -119,7 +130,8 @@ acpi_ex_enter_interpreter (void) | |||
119 | ******************************************************************************/ | 130 | ******************************************************************************/ |
120 | 131 | ||
121 | void | 132 | void |
122 | acpi_ex_exit_interpreter (void) | 133 | acpi_ex_exit_interpreter ( |
134 | void) | ||
123 | { | 135 | { |
124 | acpi_status status; | 136 | acpi_status status; |
125 | 137 | ||
@@ -212,7 +224,8 @@ acpi_ex_acquire_global_lock ( | |||
212 | locked = TRUE; | 224 | locked = TRUE; |
213 | } | 225 | } |
214 | else { | 226 | else { |
215 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not acquire Global Lock, %s\n", | 227 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
228 | "Could not acquire Global Lock, %s\n", | ||
216 | acpi_format_exception (status))); | 229 | acpi_format_exception (status))); |
217 | } | 230 | } |
218 | } | 231 | } |
@@ -228,7 +241,7 @@ acpi_ex_acquire_global_lock ( | |||
228 | * PARAMETERS: locked_by_me - Return value from corresponding call to | 241 | * PARAMETERS: locked_by_me - Return value from corresponding call to |
229 | * acquire_global_lock. | 242 | * acquire_global_lock. |
230 | * | 243 | * |
231 | * RETURN: Status | 244 | * RETURN: None |
232 | * | 245 | * |
233 | * DESCRIPTION: Release the global lock if it is locked. | 246 | * DESCRIPTION: Release the global lock if it is locked. |
234 | * | 247 | * |
@@ -269,11 +282,14 @@ acpi_ex_release_global_lock ( | |||
269 | * PARAMETERS: Value - Value to be represented | 282 | * PARAMETERS: Value - Value to be represented |
270 | * Base - Base of representation | 283 | * Base - Base of representation |
271 | * | 284 | * |
272 | * RETURN: the number of digits needed to represent Value in Base | 285 | * RETURN: The number of digits. |
286 | * | ||
287 | * DESCRIPTION: Calculate the number of digits needed to represent the Value | ||
288 | * in the given Base (Radix) | ||
273 | * | 289 | * |
274 | ******************************************************************************/ | 290 | ******************************************************************************/ |
275 | 291 | ||
276 | u32 | 292 | static u32 |
277 | acpi_ex_digits_needed ( | 293 | acpi_ex_digits_needed ( |
278 | acpi_integer value, | 294 | acpi_integer value, |
279 | u32 base) | 295 | u32 base) |
@@ -312,6 +328,8 @@ acpi_ex_digits_needed ( | |||
312 | * PARAMETERS: numeric_id - EISA ID to be converted | 328 | * PARAMETERS: numeric_id - EISA ID to be converted |
313 | * out_string - Where to put the converted string (8 bytes) | 329 | * out_string - Where to put the converted string (8 bytes) |
314 | * | 330 | * |
331 | * RETURN: None | ||
332 | * | ||
315 | * DESCRIPTION: Convert a numeric EISA ID to string representation | 333 | * DESCRIPTION: Convert a numeric EISA ID to string representation |
316 | * | 334 | * |
317 | ******************************************************************************/ | 335 | ******************************************************************************/ |
@@ -349,7 +367,10 @@ acpi_ex_eisa_id_to_string ( | |||
349 | * PARAMETERS: Value - Value to be converted | 367 | * PARAMETERS: Value - Value to be converted |
350 | * out_string - Where to put the converted string (8 bytes) | 368 | * out_string - Where to put the converted string (8 bytes) |
351 | * | 369 | * |
352 | * RETURN: Convert a number to string representation | 370 | * RETURN: None, string |
371 | * | ||
372 | * DESCRIPTOIN: Convert a number to string representation. Assumes string | ||
373 | * buffer is large enough to hold the string. | ||
353 | * | 374 | * |
354 | ******************************************************************************/ | 375 | ******************************************************************************/ |
355 | 376 | ||
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c new file mode 100644 index 000000000000..770cfc8b17e0 --- /dev/null +++ b/drivers/acpi/glue.c | |||
@@ -0,0 +1,360 @@ | |||
1 | /* | ||
2 | * Link physical devices with ACPI devices support | ||
3 | * | ||
4 | * Copyright (c) 2005 David Shaohua Li <shaohua.li@intel.com> | ||
5 | * Copyright (c) 2005 Intel Corp. | ||
6 | * | ||
7 | * This file is released under the GPLv2. | ||
8 | */ | ||
9 | #include <linux/init.h> | ||
10 | #include <linux/list.h> | ||
11 | #include <linux/device.h> | ||
12 | #include <linux/rwsem.h> | ||
13 | #include <linux/acpi.h> | ||
14 | |||
15 | #define ACPI_GLUE_DEBUG 0 | ||
16 | #if ACPI_GLUE_DEBUG | ||
17 | #define DBG(x...) printk(PREFIX x) | ||
18 | #else | ||
19 | #define DBG(x...) | ||
20 | #endif | ||
21 | static LIST_HEAD(bus_type_list); | ||
22 | static DECLARE_RWSEM(bus_type_sem); | ||
23 | |||
24 | int register_acpi_bus_type(struct acpi_bus_type *type) | ||
25 | { | ||
26 | if (acpi_disabled) | ||
27 | return -ENODEV; | ||
28 | if (type && type->bus && type->find_device) { | ||
29 | down_write(&bus_type_sem); | ||
30 | list_add_tail(&type->list, &bus_type_list); | ||
31 | up_write(&bus_type_sem); | ||
32 | printk(KERN_INFO PREFIX "bus type %s registered\n", type->bus->name); | ||
33 | return 0; | ||
34 | } | ||
35 | return -ENODEV; | ||
36 | } | ||
37 | |||
38 | EXPORT_SYMBOL(register_acpi_bus_type); | ||
39 | |||
40 | int unregister_acpi_bus_type(struct acpi_bus_type *type) | ||
41 | { | ||
42 | if (acpi_disabled) | ||
43 | return 0; | ||
44 | if (type) { | ||
45 | down_write(&bus_type_sem); | ||
46 | list_del_init(&type->list); | ||
47 | up_write(&bus_type_sem); | ||
48 | printk(KERN_INFO PREFIX "ACPI bus type %s unregistered\n", type->bus->name); | ||
49 | return 0; | ||
50 | } | ||
51 | return -ENODEV; | ||
52 | } | ||
53 | |||
54 | EXPORT_SYMBOL(unregister_acpi_bus_type); | ||
55 | |||
56 | static struct acpi_bus_type *acpi_get_bus_type(struct bus_type *type) | ||
57 | { | ||
58 | struct acpi_bus_type *tmp, *ret = NULL; | ||
59 | |||
60 | down_read(&bus_type_sem); | ||
61 | list_for_each_entry(tmp, &bus_type_list, list) { | ||
62 | if (tmp->bus == type) { | ||
63 | ret = tmp; | ||
64 | break; | ||
65 | } | ||
66 | } | ||
67 | up_read(&bus_type_sem); | ||
68 | return ret; | ||
69 | } | ||
70 | |||
71 | static int acpi_find_bridge_device(struct device *dev, acpi_handle * handle) | ||
72 | { | ||
73 | struct acpi_bus_type *tmp; | ||
74 | int ret = -ENODEV; | ||
75 | |||
76 | down_read(&bus_type_sem); | ||
77 | list_for_each_entry(tmp, &bus_type_list, list) { | ||
78 | if (tmp->find_bridge && !tmp->find_bridge(dev, handle)) { | ||
79 | ret = 0; | ||
80 | break; | ||
81 | } | ||
82 | } | ||
83 | up_read(&bus_type_sem); | ||
84 | return ret; | ||
85 | } | ||
86 | |||
87 | /* Get PCI root bridge's handle from its segment and bus number */ | ||
88 | struct acpi_find_pci_root { | ||
89 | unsigned int seg; | ||
90 | unsigned int bus; | ||
91 | acpi_handle handle; | ||
92 | }; | ||
93 | |||
94 | static acpi_status | ||
95 | do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) | ||
96 | { | ||
97 | int *busnr = (int *)data; | ||
98 | struct acpi_resource_address64 address; | ||
99 | |||
100 | if (resource->id != ACPI_RSTYPE_ADDRESS16 && | ||
101 | resource->id != ACPI_RSTYPE_ADDRESS32 && | ||
102 | resource->id != ACPI_RSTYPE_ADDRESS64) | ||
103 | return AE_OK; | ||
104 | |||
105 | acpi_resource_to_address64(resource, &address); | ||
106 | if ((address.address_length > 0) && | ||
107 | (address.resource_type == ACPI_BUS_NUMBER_RANGE)) | ||
108 | *busnr = address.min_address_range; | ||
109 | |||
110 | return AE_OK; | ||
111 | } | ||
112 | |||
113 | static int get_root_bridge_busnr(acpi_handle handle) | ||
114 | { | ||
115 | acpi_status status; | ||
116 | int bus, bbn; | ||
117 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
118 | |||
119 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); | ||
120 | |||
121 | status = acpi_evaluate_integer(handle, METHOD_NAME__BBN, NULL, | ||
122 | (unsigned long *)&bbn); | ||
123 | if (status == AE_NOT_FOUND) { | ||
124 | /* Assume bus = 0 */ | ||
125 | printk(KERN_INFO PREFIX | ||
126 | "Assume root bridge [%s] bus is 0\n", | ||
127 | (char *)buffer.pointer); | ||
128 | status = AE_OK; | ||
129 | bbn = 0; | ||
130 | } | ||
131 | if (ACPI_FAILURE(status)) { | ||
132 | bbn = -ENODEV; | ||
133 | goto exit; | ||
134 | } | ||
135 | if (bbn > 0) | ||
136 | goto exit; | ||
137 | |||
138 | /* _BBN in some systems return 0 for all root bridges */ | ||
139 | bus = -1; | ||
140 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | ||
141 | do_root_bridge_busnr_callback, &bus); | ||
142 | /* If _CRS failed, we just use _BBN */ | ||
143 | if (ACPI_FAILURE(status) || (bus == -1)) | ||
144 | goto exit; | ||
145 | /* We select _CRS */ | ||
146 | if (bbn != bus) { | ||
147 | printk(KERN_INFO PREFIX | ||
148 | "_BBN and _CRS returns different value for %s. Select _CRS\n", | ||
149 | (char *)buffer.pointer); | ||
150 | bbn = bus; | ||
151 | } | ||
152 | exit: | ||
153 | acpi_os_free(buffer.pointer); | ||
154 | return bbn; | ||
155 | } | ||
156 | |||
157 | static acpi_status | ||
158 | find_pci_rootbridge(acpi_handle handle, u32 lvl, void *context, void **rv) | ||
159 | { | ||
160 | struct acpi_find_pci_root *find = (struct acpi_find_pci_root *)context; | ||
161 | unsigned long seg, bus; | ||
162 | acpi_status status; | ||
163 | int tmp; | ||
164 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
165 | |||
166 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); | ||
167 | |||
168 | status = acpi_evaluate_integer(handle, METHOD_NAME__SEG, NULL, &seg); | ||
169 | if (status == AE_NOT_FOUND) { | ||
170 | /* Assume seg = 0 */ | ||
171 | printk(KERN_INFO PREFIX | ||
172 | "Assume root bridge [%s] segment is 0\n", | ||
173 | (char *)buffer.pointer); | ||
174 | status = AE_OK; | ||
175 | seg = 0; | ||
176 | } | ||
177 | if (ACPI_FAILURE(status)) { | ||
178 | status = AE_CTRL_DEPTH; | ||
179 | goto exit; | ||
180 | } | ||
181 | |||
182 | tmp = get_root_bridge_busnr(handle); | ||
183 | if (tmp < 0) { | ||
184 | printk(KERN_ERR PREFIX | ||
185 | "Find root bridge failed for %s\n", | ||
186 | (char *)buffer.pointer); | ||
187 | status = AE_CTRL_DEPTH; | ||
188 | goto exit; | ||
189 | } | ||
190 | bus = tmp; | ||
191 | |||
192 | if (seg == find->seg && bus == find->bus) | ||
193 | find->handle = handle; | ||
194 | status = AE_OK; | ||
195 | exit: | ||
196 | acpi_os_free(buffer.pointer); | ||
197 | return status; | ||
198 | } | ||
199 | |||
200 | acpi_handle acpi_get_pci_rootbridge_handle(unsigned int seg, unsigned int bus) | ||
201 | { | ||
202 | struct acpi_find_pci_root find = { seg, bus, NULL }; | ||
203 | |||
204 | acpi_get_devices(PCI_ROOT_HID_STRING, find_pci_rootbridge, &find, NULL); | ||
205 | return find.handle; | ||
206 | } | ||
207 | |||
208 | /* Get device's handler per its address under its parent */ | ||
209 | struct acpi_find_child { | ||
210 | acpi_handle handle; | ||
211 | acpi_integer address; | ||
212 | }; | ||
213 | |||
214 | static acpi_status | ||
215 | do_acpi_find_child(acpi_handle handle, u32 lvl, void *context, void **rv) | ||
216 | { | ||
217 | acpi_status status; | ||
218 | struct acpi_device_info *info; | ||
219 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
220 | struct acpi_find_child *find = (struct acpi_find_child *)context; | ||
221 | |||
222 | status = acpi_get_object_info(handle, &buffer); | ||
223 | if (ACPI_SUCCESS(status)) { | ||
224 | info = buffer.pointer; | ||
225 | if (info->address == find->address) | ||
226 | find->handle = handle; | ||
227 | acpi_os_free(buffer.pointer); | ||
228 | } | ||
229 | return AE_OK; | ||
230 | } | ||
231 | |||
232 | acpi_handle acpi_get_child(acpi_handle parent, acpi_integer address) | ||
233 | { | ||
234 | struct acpi_find_child find = { NULL, address }; | ||
235 | |||
236 | if (!parent) | ||
237 | return NULL; | ||
238 | acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, | ||
239 | 1, do_acpi_find_child, &find, NULL); | ||
240 | return find.handle; | ||
241 | } | ||
242 | |||
243 | EXPORT_SYMBOL(acpi_get_child); | ||
244 | |||
245 | /* Link ACPI devices with physical devices */ | ||
246 | static void acpi_glue_data_handler(acpi_handle handle, | ||
247 | u32 function, void *context) | ||
248 | { | ||
249 | /* we provide an empty handler */ | ||
250 | } | ||
251 | |||
252 | /* Note: a success call will increase reference count by one */ | ||
253 | struct device *acpi_get_physical_device(acpi_handle handle) | ||
254 | { | ||
255 | acpi_status status; | ||
256 | struct device *dev; | ||
257 | |||
258 | status = acpi_get_data(handle, acpi_glue_data_handler, (void **)&dev); | ||
259 | if (ACPI_SUCCESS(status)) | ||
260 | return get_device(dev); | ||
261 | return NULL; | ||
262 | } | ||
263 | |||
264 | EXPORT_SYMBOL(acpi_get_physical_device); | ||
265 | |||
266 | static int acpi_bind_one(struct device *dev, acpi_handle handle) | ||
267 | { | ||
268 | acpi_status status; | ||
269 | |||
270 | if (dev->firmware_data) { | ||
271 | printk(KERN_WARNING PREFIX | ||
272 | "Drivers changed 'firmware_data' for %s\n", dev->bus_id); | ||
273 | return -EINVAL; | ||
274 | } | ||
275 | get_device(dev); | ||
276 | status = acpi_attach_data(handle, acpi_glue_data_handler, dev); | ||
277 | if (ACPI_FAILURE(status)) { | ||
278 | put_device(dev); | ||
279 | return -EINVAL; | ||
280 | } | ||
281 | dev->firmware_data = handle; | ||
282 | |||
283 | return 0; | ||
284 | } | ||
285 | |||
286 | static int acpi_unbind_one(struct device *dev) | ||
287 | { | ||
288 | if (!dev->firmware_data) | ||
289 | return 0; | ||
290 | if (dev == acpi_get_physical_device(dev->firmware_data)) { | ||
291 | /* acpi_get_physical_device increase refcnt by one */ | ||
292 | put_device(dev); | ||
293 | acpi_detach_data(dev->firmware_data, acpi_glue_data_handler); | ||
294 | dev->firmware_data = NULL; | ||
295 | /* acpi_bind_one increase refcnt by one */ | ||
296 | put_device(dev); | ||
297 | } else { | ||
298 | printk(KERN_ERR PREFIX | ||
299 | "Oops, 'firmware_data' corrupt for %s\n", dev->bus_id); | ||
300 | } | ||
301 | return 0; | ||
302 | } | ||
303 | |||
304 | static int acpi_platform_notify(struct device *dev) | ||
305 | { | ||
306 | struct acpi_bus_type *type; | ||
307 | acpi_handle handle; | ||
308 | int ret = -EINVAL; | ||
309 | |||
310 | if (!dev->bus || !dev->parent) { | ||
311 | /* bridge devices genernally haven't bus or parent */ | ||
312 | ret = acpi_find_bridge_device(dev, &handle); | ||
313 | goto end; | ||
314 | } | ||
315 | type = acpi_get_bus_type(dev->bus); | ||
316 | if (!type) { | ||
317 | DBG("No ACPI bus support for %s\n", dev->bus_id); | ||
318 | ret = -EINVAL; | ||
319 | goto end; | ||
320 | } | ||
321 | if ((ret = type->find_device(dev, &handle)) != 0) | ||
322 | DBG("Can't get handler for %s\n", dev->bus_id); | ||
323 | end: | ||
324 | if (!ret) | ||
325 | acpi_bind_one(dev, handle); | ||
326 | |||
327 | #if ACPI_GLUE_DEBUG | ||
328 | if (!ret) { | ||
329 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
330 | |||
331 | acpi_get_name(dev->firmware_data, ACPI_FULL_PATHNAME, &buffer); | ||
332 | DBG("Device %s -> %s\n", dev->bus_id, (char *)buffer.pointer); | ||
333 | acpi_os_free(buffer.pointer); | ||
334 | } else | ||
335 | DBG("Device %s -> No ACPI support\n", dev->bus_id); | ||
336 | #endif | ||
337 | |||
338 | return ret; | ||
339 | } | ||
340 | |||
341 | static int acpi_platform_notify_remove(struct device *dev) | ||
342 | { | ||
343 | acpi_unbind_one(dev); | ||
344 | return 0; | ||
345 | } | ||
346 | |||
347 | static int __init init_acpi_device_notify(void) | ||
348 | { | ||
349 | if (acpi_disabled) | ||
350 | return 0; | ||
351 | if (platform_notify || platform_notify_remove) { | ||
352 | printk(KERN_ERR PREFIX "Can't use platform_notify\n"); | ||
353 | return 0; | ||
354 | } | ||
355 | platform_notify = acpi_platform_notify; | ||
356 | platform_notify_remove = acpi_platform_notify_remove; | ||
357 | return 0; | ||
358 | } | ||
359 | |||
360 | arch_initcall(init_acpi_device_notify); | ||
diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c index 529e922bdc85..b51001e74eea 100644 --- a/drivers/acpi/hardware/hwacpi.c +++ b/drivers/acpi/hardware/hwacpi.c | |||
@@ -58,7 +58,8 @@ | |||
58 | * | 58 | * |
59 | * RETURN: Status | 59 | * RETURN: Status |
60 | * | 60 | * |
61 | * DESCRIPTION: Initialize and validate various ACPI registers | 61 | * DESCRIPTION: Initialize and validate the various ACPI registers defined in |
62 | * the FADT. | ||
62 | * | 63 | * |
63 | ******************************************************************************/ | 64 | ******************************************************************************/ |
64 | 65 | ||
@@ -75,7 +76,7 @@ acpi_hw_initialize ( | |||
75 | /* We must have the ACPI tables by the time we get here */ | 76 | /* We must have the ACPI tables by the time we get here */ |
76 | 77 | ||
77 | if (!acpi_gbl_FADT) { | 78 | if (!acpi_gbl_FADT) { |
78 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "A FADT is not loaded\n")); | 79 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No FADT is present\n")); |
79 | 80 | ||
80 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); | 81 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); |
81 | } | 82 | } |
@@ -131,7 +132,8 @@ acpi_hw_set_mode ( | |||
131 | * transitions are not supported. | 132 | * transitions are not supported. |
132 | */ | 133 | */ |
133 | if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) { | 134 | if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) { |
134 | ACPI_REPORT_ERROR (("No ACPI mode transition supported in this system (enable/disable both zero)\n")); | 135 | ACPI_REPORT_ERROR (( |
136 | "No ACPI mode transition supported in this system (enable/disable both zero)\n")); | ||
135 | return_ACPI_STATUS (AE_OK); | 137 | return_ACPI_STATUS (AE_OK); |
136 | } | 138 | } |
137 | 139 | ||
@@ -162,7 +164,8 @@ acpi_hw_set_mode ( | |||
162 | } | 164 | } |
163 | 165 | ||
164 | if (ACPI_FAILURE (status)) { | 166 | if (ACPI_FAILURE (status)) { |
165 | ACPI_REPORT_ERROR (("Could not write mode change, %s\n", acpi_format_exception (status))); | 167 | ACPI_REPORT_ERROR (("Could not write mode change, %s\n", |
168 | acpi_format_exception (status))); | ||
166 | return_ACPI_STATUS (status); | 169 | return_ACPI_STATUS (status); |
167 | } | 170 | } |
168 | 171 | ||
@@ -173,7 +176,8 @@ acpi_hw_set_mode ( | |||
173 | retry = 3000; | 176 | retry = 3000; |
174 | while (retry) { | 177 | while (retry) { |
175 | if (acpi_hw_get_mode() == mode) { | 178 | if (acpi_hw_get_mode() == mode) { |
176 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", mode)); | 179 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", |
180 | mode)); | ||
177 | return_ACPI_STATUS (AE_OK); | 181 | return_ACPI_STATUS (AE_OK); |
178 | } | 182 | } |
179 | acpi_os_stall(1000); | 183 | acpi_os_stall(1000); |
@@ -185,7 +189,7 @@ acpi_hw_set_mode ( | |||
185 | } | 189 | } |
186 | 190 | ||
187 | 191 | ||
188 | /****************************************************************************** | 192 | /******************************************************************************* |
189 | * | 193 | * |
190 | * FUNCTION: acpi_hw_get_mode | 194 | * FUNCTION: acpi_hw_get_mode |
191 | * | 195 | * |
@@ -199,7 +203,8 @@ acpi_hw_set_mode ( | |||
199 | ******************************************************************************/ | 203 | ******************************************************************************/ |
200 | 204 | ||
201 | u32 | 205 | u32 |
202 | acpi_hw_get_mode (void) | 206 | acpi_hw_get_mode ( |
207 | void) | ||
203 | { | 208 | { |
204 | acpi_status status; | 209 | acpi_status status; |
205 | u32 value; | 210 | u32 value; |
diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c index 9ac1d639bf51..8daeabb2fc7a 100644 --- a/drivers/acpi/hardware/hwgpe.c +++ b/drivers/acpi/hardware/hwgpe.c | |||
@@ -48,6 +48,13 @@ | |||
48 | #define _COMPONENT ACPI_HARDWARE | 48 | #define _COMPONENT ACPI_HARDWARE |
49 | ACPI_MODULE_NAME ("hwgpe") | 49 | ACPI_MODULE_NAME ("hwgpe") |
50 | 50 | ||
51 | /* Local prototypes */ | ||
52 | |||
53 | static acpi_status | ||
54 | acpi_hw_enable_wakeup_gpe_block ( | ||
55 | struct acpi_gpe_xrupt_info *gpe_xrupt_info, | ||
56 | struct acpi_gpe_block_info *gpe_block); | ||
57 | |||
51 | 58 | ||
52 | /****************************************************************************** | 59 | /****************************************************************************** |
53 | * | 60 | * |
@@ -135,6 +142,7 @@ acpi_hw_clear_gpe ( | |||
135 | * DESCRIPTION: Return the status of a single GPE. | 142 | * DESCRIPTION: Return the status of a single GPE. |
136 | * | 143 | * |
137 | ******************************************************************************/ | 144 | ******************************************************************************/ |
145 | |||
138 | #ifdef ACPI_FUTURE_USAGE | 146 | #ifdef ACPI_FUTURE_USAGE |
139 | acpi_status | 147 | acpi_status |
140 | acpi_hw_get_gpe_status ( | 148 | acpi_hw_get_gpe_status ( |
@@ -206,7 +214,7 @@ unlock_and_exit: | |||
206 | * | 214 | * |
207 | * RETURN: Status | 215 | * RETURN: Status |
208 | * | 216 | * |
209 | * DESCRIPTION: Disable all GPEs within a GPE block | 217 | * DESCRIPTION: Disable all GPEs within a single GPE block |
210 | * | 218 | * |
211 | ******************************************************************************/ | 219 | ******************************************************************************/ |
212 | 220 | ||
@@ -244,7 +252,7 @@ acpi_hw_disable_gpe_block ( | |||
244 | * | 252 | * |
245 | * RETURN: Status | 253 | * RETURN: Status |
246 | * | 254 | * |
247 | * DESCRIPTION: Clear status bits for all GPEs within a GPE block | 255 | * DESCRIPTION: Clear status bits for all GPEs within a single GPE block |
248 | * | 256 | * |
249 | ******************************************************************************/ | 257 | ******************************************************************************/ |
250 | 258 | ||
@@ -282,8 +290,8 @@ acpi_hw_clear_gpe_block ( | |||
282 | * | 290 | * |
283 | * RETURN: Status | 291 | * RETURN: Status |
284 | * | 292 | * |
285 | * DESCRIPTION: Enable all "runtime" GPEs within a GPE block. (Includes | 293 | * DESCRIPTION: Enable all "runtime" GPEs within a single GPE block. Includes |
286 | * combination wake/run GPEs.) | 294 | * combination wake/run GPEs. |
287 | * | 295 | * |
288 | ******************************************************************************/ | 296 | ******************************************************************************/ |
289 | 297 | ||
@@ -327,12 +335,12 @@ acpi_hw_enable_runtime_gpe_block ( | |||
327 | * | 335 | * |
328 | * RETURN: Status | 336 | * RETURN: Status |
329 | * | 337 | * |
330 | * DESCRIPTION: Enable all "wake" GPEs within a GPE block. (Includes | 338 | * DESCRIPTION: Enable all "wake" GPEs within a single GPE block. Includes |
331 | * combination wake/run GPEs.) | 339 | * combination wake/run GPEs. |
332 | * | 340 | * |
333 | ******************************************************************************/ | 341 | ******************************************************************************/ |
334 | 342 | ||
335 | acpi_status | 343 | static acpi_status |
336 | acpi_hw_enable_wakeup_gpe_block ( | 344 | acpi_hw_enable_wakeup_gpe_block ( |
337 | struct acpi_gpe_xrupt_info *gpe_xrupt_info, | 345 | struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
338 | struct acpi_gpe_block_info *gpe_block) | 346 | struct acpi_gpe_block_info *gpe_block) |
@@ -350,7 +358,8 @@ acpi_hw_enable_wakeup_gpe_block ( | |||
350 | 358 | ||
351 | /* Enable all "wake" GPEs in this register */ | 359 | /* Enable all "wake" GPEs in this register */ |
352 | 360 | ||
353 | status = acpi_hw_low_level_write (8, gpe_block->register_info[i].enable_for_wake, | 361 | status = acpi_hw_low_level_write (8, |
362 | gpe_block->register_info[i].enable_for_wake, | ||
354 | &gpe_block->register_info[i].enable_address); | 363 | &gpe_block->register_info[i].enable_address); |
355 | if (ACPI_FAILURE (status)) { | 364 | if (ACPI_FAILURE (status)) { |
356 | return (status); | 365 | return (status); |
@@ -369,7 +378,7 @@ acpi_hw_enable_wakeup_gpe_block ( | |||
369 | * | 378 | * |
370 | * RETURN: Status | 379 | * RETURN: Status |
371 | * | 380 | * |
372 | * DESCRIPTION: Disable and clear all GPEs | 381 | * DESCRIPTION: Disable and clear all GPEs in all GPE blocks |
373 | * | 382 | * |
374 | ******************************************************************************/ | 383 | ******************************************************************************/ |
375 | 384 | ||
@@ -397,7 +406,7 @@ acpi_hw_disable_all_gpes ( | |||
397 | * | 406 | * |
398 | * RETURN: Status | 407 | * RETURN: Status |
399 | * | 408 | * |
400 | * DESCRIPTION: Enable all GPEs of the given type | 409 | * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks |
401 | * | 410 | * |
402 | ******************************************************************************/ | 411 | ******************************************************************************/ |
403 | 412 | ||
@@ -424,7 +433,7 @@ acpi_hw_enable_all_runtime_gpes ( | |||
424 | * | 433 | * |
425 | * RETURN: Status | 434 | * RETURN: Status |
426 | * | 435 | * |
427 | * DESCRIPTION: Enable all GPEs of the given type | 436 | * DESCRIPTION: Enable all "wakeup" GPEs, in all GPE blocks |
428 | * | 437 | * |
429 | ******************************************************************************/ | 438 | ******************************************************************************/ |
430 | 439 | ||
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index 91af0c2ddcf7..6d9e4eb84836 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c | |||
@@ -87,8 +87,9 @@ acpi_hw_clear_acpi_status ( | |||
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, | 90 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, |
91 | ACPI_BITMASK_ALL_FIXED_STATUS); | 91 | ACPI_REGISTER_PM1_STATUS, |
92 | ACPI_BITMASK_ALL_FIXED_STATUS); | ||
92 | if (ACPI_FAILURE (status)) { | 93 | if (ACPI_FAILURE (status)) { |
93 | goto unlock_and_exit; | 94 | goto unlock_and_exit; |
94 | } | 95 | } |
@@ -138,28 +139,30 @@ acpi_get_sleep_type_data ( | |||
138 | { | 139 | { |
139 | acpi_status status = AE_OK; | 140 | acpi_status status = AE_OK; |
140 | struct acpi_parameter_info info; | 141 | struct acpi_parameter_info info; |
142 | char *sleep_state_name; | ||
141 | 143 | ||
142 | 144 | ||
143 | ACPI_FUNCTION_TRACE ("acpi_get_sleep_type_data"); | 145 | ACPI_FUNCTION_TRACE ("acpi_get_sleep_type_data"); |
144 | 146 | ||
145 | 147 | ||
146 | /* | 148 | /* Validate parameters */ |
147 | * Validate parameters | 149 | |
148 | */ | ||
149 | if ((sleep_state > ACPI_S_STATES_MAX) || | 150 | if ((sleep_state > ACPI_S_STATES_MAX) || |
150 | !sleep_type_a || !sleep_type_b) { | 151 | !sleep_type_a || !sleep_type_b) { |
151 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 152 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
152 | } | 153 | } |
153 | 154 | ||
154 | /* | 155 | /* Evaluate the namespace object containing the values for this state */ |
155 | * Evaluate the namespace object containing the values for this state | 156 | |
156 | */ | ||
157 | info.parameters = NULL; | 157 | info.parameters = NULL; |
158 | status = acpi_ns_evaluate_by_name ((char *) acpi_gbl_sleep_state_names[sleep_state], | 158 | info.return_object = NULL; |
159 | &info); | 159 | sleep_state_name = (char *) acpi_gbl_sleep_state_names[sleep_state]; |
160 | |||
161 | status = acpi_ns_evaluate_by_name (sleep_state_name, &info); | ||
160 | if (ACPI_FAILURE (status)) { | 162 | if (ACPI_FAILURE (status)) { |
161 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s while evaluating sleep_state [%s]\n", | 163 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
162 | acpi_format_exception (status), acpi_gbl_sleep_state_names[sleep_state])); | 164 | "%s while evaluating sleep_state [%s]\n", |
165 | acpi_format_exception (status), sleep_state_name)); | ||
163 | 166 | ||
164 | return_ACPI_STATUS (status); | 167 | return_ACPI_STATUS (status); |
165 | } | 168 | } |
@@ -167,45 +170,57 @@ acpi_get_sleep_type_data ( | |||
167 | /* Must have a return object */ | 170 | /* Must have a return object */ |
168 | 171 | ||
169 | if (!info.return_object) { | 172 | if (!info.return_object) { |
170 | ACPI_REPORT_ERROR (("Missing Sleep State object\n")); | 173 | ACPI_REPORT_ERROR (("No Sleep State object returned from [%s]\n", |
174 | sleep_state_name)); | ||
171 | status = AE_NOT_EXIST; | 175 | status = AE_NOT_EXIST; |
172 | } | 176 | } |
173 | 177 | ||
174 | /* It must be of type Package */ | 178 | /* It must be of type Package */ |
175 | 179 | ||
176 | else if (ACPI_GET_OBJECT_TYPE (info.return_object) != ACPI_TYPE_PACKAGE) { | 180 | else if (ACPI_GET_OBJECT_TYPE (info.return_object) != ACPI_TYPE_PACKAGE) { |
177 | ACPI_REPORT_ERROR (("Sleep State object not a Package\n")); | 181 | ACPI_REPORT_ERROR (("Sleep State return object is not a Package\n")); |
178 | status = AE_AML_OPERAND_TYPE; | 182 | status = AE_AML_OPERAND_TYPE; |
179 | } | 183 | } |
180 | 184 | ||
181 | /* The package must have at least two elements */ | 185 | /* |
182 | 186 | * The package must have at least two elements. NOTE (March 2005): This | |
187 | * goes against the current ACPI spec which defines this object as a | ||
188 | * package with one encoded DWORD element. However, existing practice | ||
189 | * by BIOS vendors seems to be to have 2 or more elements, at least | ||
190 | * one per sleep type (A/B). | ||
191 | */ | ||
183 | else if (info.return_object->package.count < 2) { | 192 | else if (info.return_object->package.count < 2) { |
184 | ACPI_REPORT_ERROR (("Sleep State package does not have at least two elements\n")); | 193 | ACPI_REPORT_ERROR (( |
194 | "Sleep State return package does not have at least two elements\n")); | ||
185 | status = AE_AML_NO_OPERAND; | 195 | status = AE_AML_NO_OPERAND; |
186 | } | 196 | } |
187 | 197 | ||
188 | /* The first two elements must both be of type Integer */ | 198 | /* The first two elements must both be of type Integer */ |
189 | 199 | ||
190 | else if ((ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[0]) != ACPI_TYPE_INTEGER) || | 200 | else if ((ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[0]) |
191 | (ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[1]) != ACPI_TYPE_INTEGER)) { | 201 | != ACPI_TYPE_INTEGER) || |
192 | ACPI_REPORT_ERROR (("Sleep State package elements are not both Integers (%s, %s)\n", | 202 | (ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[1]) |
203 | != ACPI_TYPE_INTEGER)) { | ||
204 | ACPI_REPORT_ERROR (( | ||
205 | "Sleep State return package elements are not both Integers (%s, %s)\n", | ||
193 | acpi_ut_get_object_type_name (info.return_object->package.elements[0]), | 206 | acpi_ut_get_object_type_name (info.return_object->package.elements[0]), |
194 | acpi_ut_get_object_type_name (info.return_object->package.elements[1]))); | 207 | acpi_ut_get_object_type_name (info.return_object->package.elements[1]))); |
195 | status = AE_AML_OPERAND_TYPE; | 208 | status = AE_AML_OPERAND_TYPE; |
196 | } | 209 | } |
197 | else { | 210 | else { |
198 | /* | 211 | /* Valid _Sx_ package size, type, and value */ |
199 | * Valid _Sx_ package size, type, and value | 212 | |
200 | */ | 213 | *sleep_type_a = (u8) |
201 | *sleep_type_a = (u8) (info.return_object->package.elements[0])->integer.value; | 214 | (info.return_object->package.elements[0])->integer.value; |
202 | *sleep_type_b = (u8) (info.return_object->package.elements[1])->integer.value; | 215 | *sleep_type_b = (u8) |
216 | (info.return_object->package.elements[1])->integer.value; | ||
203 | } | 217 | } |
204 | 218 | ||
205 | if (ACPI_FAILURE (status)) { | 219 | if (ACPI_FAILURE (status)) { |
206 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 220 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
207 | "While evaluating sleep_state [%s], bad Sleep object %p type %s\n", | 221 | "%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n", |
208 | acpi_gbl_sleep_state_names[sleep_state], info.return_object, | 222 | acpi_format_exception (status), |
223 | sleep_state_name, info.return_object, | ||
209 | acpi_ut_get_object_type_name (info.return_object))); | 224 | acpi_ut_get_object_type_name (info.return_object))); |
210 | } | 225 | } |
211 | 226 | ||
@@ -221,9 +236,9 @@ EXPORT_SYMBOL(acpi_get_sleep_type_data); | |||
221 | * | 236 | * |
222 | * PARAMETERS: register_id - Index of ACPI Register to access | 237 | * PARAMETERS: register_id - Index of ACPI Register to access |
223 | * | 238 | * |
224 | * RETURN: The bit mask to be used when accessing the register | 239 | * RETURN: The bitmask to be used when accessing the register |
225 | * | 240 | * |
226 | * DESCRIPTION: Map register_id into a register bit mask. | 241 | * DESCRIPTION: Map register_id into a register bitmask. |
227 | * | 242 | * |
228 | ******************************************************************************/ | 243 | ******************************************************************************/ |
229 | 244 | ||
@@ -359,7 +374,7 @@ acpi_set_register ( | |||
359 | /* Always do a register read first so we can insert the new bits */ | 374 | /* Always do a register read first so we can insert the new bits */ |
360 | 375 | ||
361 | status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, | 376 | status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, |
362 | bit_reg_info->parent_register, ®ister_value); | 377 | bit_reg_info->parent_register, ®ister_value); |
363 | if (ACPI_FAILURE (status)) { | 378 | if (ACPI_FAILURE (status)) { |
364 | goto unlock_and_exit; | 379 | goto unlock_and_exit; |
365 | } | 380 | } |
@@ -396,7 +411,7 @@ acpi_set_register ( | |||
396 | bit_reg_info->access_bit_mask, value); | 411 | bit_reg_info->access_bit_mask, value); |
397 | 412 | ||
398 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, | 413 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, |
399 | ACPI_REGISTER_PM1_ENABLE, (u16) register_value); | 414 | ACPI_REGISTER_PM1_ENABLE, (u16) register_value); |
400 | break; | 415 | break; |
401 | 416 | ||
402 | 417 | ||
@@ -413,7 +428,7 @@ acpi_set_register ( | |||
413 | bit_reg_info->access_bit_mask, value); | 428 | bit_reg_info->access_bit_mask, value); |
414 | 429 | ||
415 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, | 430 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, |
416 | ACPI_REGISTER_PM1_CONTROL, (u16) register_value); | 431 | ACPI_REGISTER_PM1_CONTROL, (u16) register_value); |
417 | break; | 432 | break; |
418 | 433 | ||
419 | 434 | ||
@@ -427,17 +442,19 @@ acpi_set_register ( | |||
427 | 442 | ||
428 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n", | 443 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n", |
429 | register_value, | 444 | register_value, |
430 | ACPI_FORMAT_UINT64 (acpi_gbl_FADT->xpm2_cnt_blk.address))); | 445 | ACPI_FORMAT_UINT64 ( |
446 | acpi_gbl_FADT->xpm2_cnt_blk.address))); | ||
431 | 447 | ||
432 | ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, | 448 | ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, |
433 | bit_reg_info->access_bit_mask, value); | 449 | bit_reg_info->access_bit_mask, value); |
434 | 450 | ||
435 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n", | 451 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n", |
436 | register_value, | 452 | register_value, |
437 | ACPI_FORMAT_UINT64 (acpi_gbl_FADT->xpm2_cnt_blk.address))); | 453 | ACPI_FORMAT_UINT64 ( |
454 | acpi_gbl_FADT->xpm2_cnt_blk.address))); | ||
438 | 455 | ||
439 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, | 456 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, |
440 | ACPI_REGISTER_PM2_CONTROL, (u8) (register_value)); | 457 | ACPI_REGISTER_PM2_CONTROL, (u8) (register_value)); |
441 | break; | 458 | break; |
442 | 459 | ||
443 | 460 | ||
@@ -454,7 +471,9 @@ unlock_and_exit: | |||
454 | 471 | ||
455 | /* Normalize the value that was read */ | 472 | /* Normalize the value that was read */ |
456 | 473 | ||
457 | ACPI_DEBUG_EXEC (register_value = ((register_value & bit_reg_info->access_bit_mask) >> bit_reg_info->bit_position)); | 474 | ACPI_DEBUG_EXEC (register_value = |
475 | ((register_value & bit_reg_info->access_bit_mask) >> | ||
476 | bit_reg_info->bit_position)); | ||
458 | 477 | ||
459 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n", | 478 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n", |
460 | value, register_value, bit_reg_info->parent_register)); | 479 | value, register_value, bit_reg_info->parent_register)); |
@@ -469,7 +488,7 @@ EXPORT_SYMBOL(acpi_set_register); | |||
469 | * | 488 | * |
470 | * PARAMETERS: use_lock - Mutex hw access | 489 | * PARAMETERS: use_lock - Mutex hw access |
471 | * register_id - register_iD + Offset | 490 | * register_id - register_iD + Offset |
472 | * return_value - Value that was read from the register | 491 | * return_value - Where the register value is returned |
473 | * | 492 | * |
474 | * RETURN: Status and the value read. | 493 | * RETURN: Status and the value read. |
475 | * | 494 | * |
@@ -557,7 +576,8 @@ acpi_hw_register_read ( | |||
557 | break; | 576 | break; |
558 | 577 | ||
559 | default: | 578 | default: |
560 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n", register_id)); | 579 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n", |
580 | register_id)); | ||
561 | status = AE_BAD_PARAMETER; | 581 | status = AE_BAD_PARAMETER; |
562 | break; | 582 | break; |
563 | } | 583 | } |
@@ -763,10 +783,11 @@ acpi_hw_low_level_read ( | |||
763 | return (AE_BAD_PARAMETER); | 783 | return (AE_BAD_PARAMETER); |
764 | } | 784 | } |
765 | 785 | ||
766 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", | 786 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, |
767 | *value, width, | 787 | "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", |
768 | ACPI_FORMAT_UINT64 (address), | 788 | *value, width, |
769 | acpi_ut_get_region_name (reg->address_space_id))); | 789 | ACPI_FORMAT_UINT64 (address), |
790 | acpi_ut_get_region_name (reg->address_space_id))); | ||
770 | 791 | ||
771 | return (status); | 792 | return (status); |
772 | } | 793 | } |
@@ -841,10 +862,11 @@ acpi_hw_low_level_write ( | |||
841 | return (AE_BAD_PARAMETER); | 862 | return (AE_BAD_PARAMETER); |
842 | } | 863 | } |
843 | 864 | ||
844 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", | 865 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, |
845 | value, width, | 866 | "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", |
846 | ACPI_FORMAT_UINT64 (address), | 867 | value, width, |
847 | acpi_ut_get_region_name (reg->address_space_id))); | 868 | ACPI_FORMAT_UINT64 (address), |
869 | acpi_ut_get_region_name (reg->address_space_id))); | ||
848 | 870 | ||
849 | return (status); | 871 | return (status); |
850 | } | 872 | } |
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c index 77b3e9a8550b..415d342aeab5 100644 --- a/drivers/acpi/hardware/hwsleep.c +++ b/drivers/acpi/hardware/hwsleep.c | |||
@@ -43,27 +43,13 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | 45 | #include <linux/module.h> |
46 | |||
47 | #include <acpi/acpi.h> | 46 | #include <acpi/acpi.h> |
48 | 47 | ||
49 | #define _COMPONENT ACPI_HARDWARE | 48 | #define _COMPONENT ACPI_HARDWARE |
50 | ACPI_MODULE_NAME ("hwsleep") | 49 | ACPI_MODULE_NAME ("hwsleep") |
51 | 50 | ||
52 | 51 | ||
53 | #define METHOD_NAME__BFS "\\_BFS" | 52 | /******************************************************************************* |
54 | #define METHOD_NAME__GTS "\\_GTS" | ||
55 | #define METHOD_NAME__PTS "\\_PTS" | ||
56 | #define METHOD_NAME__SST "\\_SI._SST" | ||
57 | #define METHOD_NAME__WAK "\\_WAK" | ||
58 | |||
59 | #define ACPI_SST_INDICATOR_OFF 0 | ||
60 | #define ACPI_SST_WORKING 1 | ||
61 | #define ACPI_SST_WAKING 2 | ||
62 | #define ACPI_SST_SLEEPING 3 | ||
63 | #define ACPI_SST_SLEEP_CONTEXT 4 | ||
64 | |||
65 | |||
66 | /****************************************************************************** | ||
67 | * | 53 | * |
68 | * FUNCTION: acpi_set_firmware_waking_vector | 54 | * FUNCTION: acpi_set_firmware_waking_vector |
69 | * | 55 | * |
@@ -72,7 +58,7 @@ | |||
72 | * | 58 | * |
73 | * RETURN: Status | 59 | * RETURN: Status |
74 | * | 60 | * |
75 | * DESCRIPTION: access function for d_firmware_waking_vector field in FACS | 61 | * DESCRIPTION: Access function for the firmware_waking_vector field in FACS |
76 | * | 62 | * |
77 | ******************************************************************************/ | 63 | ******************************************************************************/ |
78 | 64 | ||
@@ -99,19 +85,20 @@ acpi_set_firmware_waking_vector ( | |||
99 | } | 85 | } |
100 | 86 | ||
101 | 87 | ||
102 | /****************************************************************************** | 88 | /******************************************************************************* |
103 | * | 89 | * |
104 | * FUNCTION: acpi_get_firmware_waking_vector | 90 | * FUNCTION: acpi_get_firmware_waking_vector |
105 | * | 91 | * |
106 | * PARAMETERS: *physical_address - Output buffer where contents of | 92 | * PARAMETERS: *physical_address - Where the contents of |
107 | * the firmware_waking_vector field of | 93 | * the firmware_waking_vector field of |
108 | * the FACS will be stored. | 94 | * the FACS will be returned. |
109 | * | 95 | * |
110 | * RETURN: Status | 96 | * RETURN: Status, vector |
111 | * | 97 | * |
112 | * DESCRIPTION: Access function for firmware_waking_vector field in FACS | 98 | * DESCRIPTION: Access function for the firmware_waking_vector field in FACS |
113 | * | 99 | * |
114 | ******************************************************************************/ | 100 | ******************************************************************************/ |
101 | |||
115 | #ifdef ACPI_FUTURE_USAGE | 102 | #ifdef ACPI_FUTURE_USAGE |
116 | acpi_status | 103 | acpi_status |
117 | acpi_get_firmware_waking_vector ( | 104 | acpi_get_firmware_waking_vector ( |
@@ -141,7 +128,7 @@ acpi_get_firmware_waking_vector ( | |||
141 | #endif | 128 | #endif |
142 | 129 | ||
143 | 130 | ||
144 | /****************************************************************************** | 131 | /******************************************************************************* |
145 | * | 132 | * |
146 | * FUNCTION: acpi_enter_sleep_state_prep | 133 | * FUNCTION: acpi_enter_sleep_state_prep |
147 | * | 134 | * |
@@ -215,7 +202,7 @@ acpi_enter_sleep_state_prep ( | |||
215 | break; | 202 | break; |
216 | 203 | ||
217 | default: | 204 | default: |
218 | arg.integer.value = ACPI_SST_INDICATOR_OFF; /* Default is indicator off */ | 205 | arg.integer.value = ACPI_SST_INDICATOR_OFF; /* Default is off */ |
219 | break; | 206 | break; |
220 | } | 207 | } |
221 | 208 | ||
@@ -223,14 +210,15 @@ acpi_enter_sleep_state_prep ( | |||
223 | 210 | ||
224 | status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); | 211 | status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); |
225 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { | 212 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { |
226 | ACPI_REPORT_ERROR (("Method _SST failed, %s\n", acpi_format_exception (status))); | 213 | ACPI_REPORT_ERROR (("Method _SST failed, %s\n", |
214 | acpi_format_exception (status))); | ||
227 | } | 215 | } |
228 | 216 | ||
229 | return_ACPI_STATUS (AE_OK); | 217 | return_ACPI_STATUS (AE_OK); |
230 | } | 218 | } |
231 | 219 | ||
232 | 220 | ||
233 | /****************************************************************************** | 221 | /******************************************************************************* |
234 | * | 222 | * |
235 | * FUNCTION: acpi_enter_sleep_state | 223 | * FUNCTION: acpi_enter_sleep_state |
236 | * | 224 | * |
@@ -299,15 +287,18 @@ acpi_enter_sleep_state ( | |||
299 | 287 | ||
300 | /* Get current value of PM1A control */ | 288 | /* Get current value of PM1A control */ |
301 | 289 | ||
302 | status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol); | 290 | status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, |
291 | ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol); | ||
303 | if (ACPI_FAILURE (status)) { | 292 | if (ACPI_FAILURE (status)) { |
304 | return_ACPI_STATUS (status); | 293 | return_ACPI_STATUS (status); |
305 | } | 294 | } |
306 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Entering sleep state [S%d]\n", sleep_state)); | 295 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, |
296 | "Entering sleep state [S%d]\n", sleep_state)); | ||
307 | 297 | ||
308 | /* Clear SLP_EN and SLP_TYP fields */ | 298 | /* Clear SLP_EN and SLP_TYP fields */ |
309 | 299 | ||
310 | PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | sleep_enable_reg_info->access_bit_mask); | 300 | PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | |
301 | sleep_enable_reg_info->access_bit_mask); | ||
311 | PM1Bcontrol = PM1Acontrol; | 302 | PM1Bcontrol = PM1Acontrol; |
312 | 303 | ||
313 | /* Insert SLP_TYP bits */ | 304 | /* Insert SLP_TYP bits */ |
@@ -322,12 +313,14 @@ acpi_enter_sleep_state ( | |||
322 | 313 | ||
323 | /* Write #1: fill in SLP_TYP data */ | 314 | /* Write #1: fill in SLP_TYP data */ |
324 | 315 | ||
325 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol); | 316 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, |
317 | ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol); | ||
326 | if (ACPI_FAILURE (status)) { | 318 | if (ACPI_FAILURE (status)) { |
327 | return_ACPI_STATUS (status); | 319 | return_ACPI_STATUS (status); |
328 | } | 320 | } |
329 | 321 | ||
330 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol); | 322 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, |
323 | ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol); | ||
331 | if (ACPI_FAILURE (status)) { | 324 | if (ACPI_FAILURE (status)) { |
332 | return_ACPI_STATUS (status); | 325 | return_ACPI_STATUS (status); |
333 | } | 326 | } |
@@ -341,22 +334,25 @@ acpi_enter_sleep_state ( | |||
341 | 334 | ||
342 | ACPI_FLUSH_CPU_CACHE (); | 335 | ACPI_FLUSH_CPU_CACHE (); |
343 | 336 | ||
344 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol); | 337 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, |
338 | ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol); | ||
345 | if (ACPI_FAILURE (status)) { | 339 | if (ACPI_FAILURE (status)) { |
346 | return_ACPI_STATUS (status); | 340 | return_ACPI_STATUS (status); |
347 | } | 341 | } |
348 | 342 | ||
349 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol); | 343 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, |
344 | ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol); | ||
350 | if (ACPI_FAILURE (status)) { | 345 | if (ACPI_FAILURE (status)) { |
351 | return_ACPI_STATUS (status); | 346 | return_ACPI_STATUS (status); |
352 | } | 347 | } |
353 | 348 | ||
354 | if (sleep_state > ACPI_STATE_S3) { | 349 | if (sleep_state > ACPI_STATE_S3) { |
355 | /* | 350 | /* |
356 | * We wanted to sleep > S3, but it didn't happen (by virtue of the fact that | 351 | * We wanted to sleep > S3, but it didn't happen (by virtue of the |
357 | * we are still executing!) | 352 | * fact that we are still executing!) |
358 | * | 353 | * |
359 | * Wait ten seconds, then try again. This is to get S4/S5 to work on all machines. | 354 | * Wait ten seconds, then try again. This is to get S4/S5 to work on |
355 | * all machines. | ||
360 | * | 356 | * |
361 | * We wait so long to allow chipsets that poll this reg very slowly to | 357 | * We wait so long to allow chipsets that poll this reg very slowly to |
362 | * still read the right value. Ideally, this block would go | 358 | * still read the right value. Ideally, this block would go |
@@ -364,7 +360,8 @@ acpi_enter_sleep_state ( | |||
364 | */ | 360 | */ |
365 | acpi_os_stall (10000000); | 361 | acpi_os_stall (10000000); |
366 | 362 | ||
367 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL, | 363 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, |
364 | ACPI_REGISTER_PM1_CONTROL, | ||
368 | sleep_enable_reg_info->access_bit_mask); | 365 | sleep_enable_reg_info->access_bit_mask); |
369 | if (ACPI_FAILURE (status)) { | 366 | if (ACPI_FAILURE (status)) { |
370 | return_ACPI_STATUS (status); | 367 | return_ACPI_STATUS (status); |
@@ -374,7 +371,8 @@ acpi_enter_sleep_state ( | |||
374 | /* Wait until we enter sleep state */ | 371 | /* Wait until we enter sleep state */ |
375 | 372 | ||
376 | do { | 373 | do { |
377 | status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, ACPI_MTX_DO_NOT_LOCK); | 374 | status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, |
375 | ACPI_MTX_DO_NOT_LOCK); | ||
378 | if (ACPI_FAILURE (status)) { | 376 | if (ACPI_FAILURE (status)) { |
379 | return_ACPI_STATUS (status); | 377 | return_ACPI_STATUS (status); |
380 | } | 378 | } |
@@ -388,7 +386,7 @@ acpi_enter_sleep_state ( | |||
388 | EXPORT_SYMBOL(acpi_enter_sleep_state); | 386 | EXPORT_SYMBOL(acpi_enter_sleep_state); |
389 | 387 | ||
390 | 388 | ||
391 | /****************************************************************************** | 389 | /******************************************************************************* |
392 | * | 390 | * |
393 | * FUNCTION: acpi_enter_sleep_state_s4bios | 391 | * FUNCTION: acpi_enter_sleep_state_s4bios |
394 | * | 392 | * |
@@ -439,11 +437,13 @@ acpi_enter_sleep_state_s4bios ( | |||
439 | 437 | ||
440 | ACPI_FLUSH_CPU_CACHE (); | 438 | ACPI_FLUSH_CPU_CACHE (); |
441 | 439 | ||
442 | status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, (u32) acpi_gbl_FADT->S4bios_req, 8); | 440 | status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, |
441 | (u32) acpi_gbl_FADT->S4bios_req, 8); | ||
443 | 442 | ||
444 | do { | 443 | do { |
445 | acpi_os_stall(1000); | 444 | acpi_os_stall(1000); |
446 | status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, ACPI_MTX_DO_NOT_LOCK); | 445 | status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, |
446 | ACPI_MTX_DO_NOT_LOCK); | ||
447 | if (ACPI_FAILURE (status)) { | 447 | if (ACPI_FAILURE (status)) { |
448 | return_ACPI_STATUS (status); | 448 | return_ACPI_STATUS (status); |
449 | } | 449 | } |
@@ -454,7 +454,7 @@ acpi_enter_sleep_state_s4bios ( | |||
454 | EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios); | 454 | EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios); |
455 | 455 | ||
456 | 456 | ||
457 | /****************************************************************************** | 457 | /******************************************************************************* |
458 | * | 458 | * |
459 | * FUNCTION: acpi_leave_sleep_state | 459 | * FUNCTION: acpi_leave_sleep_state |
460 | * | 460 | * |
@@ -534,18 +534,21 @@ acpi_leave_sleep_state ( | |||
534 | arg.integer.value = ACPI_SST_WAKING; | 534 | arg.integer.value = ACPI_SST_WAKING; |
535 | status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); | 535 | status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); |
536 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { | 536 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { |
537 | ACPI_REPORT_ERROR (("Method _SST failed, %s\n", acpi_format_exception (status))); | 537 | ACPI_REPORT_ERROR (("Method _SST failed, %s\n", |
538 | acpi_format_exception (status))); | ||
538 | } | 539 | } |
539 | 540 | ||
540 | arg.integer.value = sleep_state; | 541 | arg.integer.value = sleep_state; |
541 | status = acpi_evaluate_object (NULL, METHOD_NAME__BFS, &arg_list, NULL); | 542 | status = acpi_evaluate_object (NULL, METHOD_NAME__BFS, &arg_list, NULL); |
542 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { | 543 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { |
543 | ACPI_REPORT_ERROR (("Method _BFS failed, %s\n", acpi_format_exception (status))); | 544 | ACPI_REPORT_ERROR (("Method _BFS failed, %s\n", |
545 | acpi_format_exception (status))); | ||
544 | } | 546 | } |
545 | 547 | ||
546 | status = acpi_evaluate_object (NULL, METHOD_NAME__WAK, &arg_list, NULL); | 548 | status = acpi_evaluate_object (NULL, METHOD_NAME__WAK, &arg_list, NULL); |
547 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { | 549 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { |
548 | ACPI_REPORT_ERROR (("Method _WAK failed, %s\n", acpi_format_exception (status))); | 550 | ACPI_REPORT_ERROR (("Method _WAK failed, %s\n", |
551 | acpi_format_exception (status))); | ||
549 | } | 552 | } |
550 | /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ | 553 | /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ |
551 | 554 | ||
@@ -567,15 +570,19 @@ acpi_leave_sleep_state ( | |||
567 | 570 | ||
568 | /* Enable power button */ | 571 | /* Enable power button */ |
569 | 572 | ||
570 | (void) acpi_set_register(acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].enable_register_id, | 573 | (void) acpi_set_register( |
574 | acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].enable_register_id, | ||
571 | 1, ACPI_MTX_DO_NOT_LOCK); | 575 | 1, ACPI_MTX_DO_NOT_LOCK); |
572 | (void) acpi_set_register(acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].status_register_id, | 576 | |
577 | (void) acpi_set_register( | ||
578 | acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].status_register_id, | ||
573 | 1, ACPI_MTX_DO_NOT_LOCK); | 579 | 1, ACPI_MTX_DO_NOT_LOCK); |
574 | 580 | ||
575 | arg.integer.value = ACPI_SST_WORKING; | 581 | arg.integer.value = ACPI_SST_WORKING; |
576 | status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); | 582 | status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); |
577 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { | 583 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { |
578 | ACPI_REPORT_ERROR (("Method _SST failed, %s\n", acpi_format_exception (status))); | 584 | ACPI_REPORT_ERROR (("Method _SST failed, %s\n", |
585 | acpi_format_exception (status))); | ||
579 | } | 586 | } |
580 | 587 | ||
581 | return_ACPI_STATUS (status); | 588 | return_ACPI_STATUS (status); |
diff --git a/drivers/acpi/hardware/hwtimer.c b/drivers/acpi/hardware/hwtimer.c index 1906167d7294..49d7b395322e 100644 --- a/drivers/acpi/hardware/hwtimer.c +++ b/drivers/acpi/hardware/hwtimer.c | |||
@@ -43,7 +43,6 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | 45 | #include <linux/module.h> |
46 | |||
47 | #include <acpi/acpi.h> | 46 | #include <acpi/acpi.h> |
48 | 47 | ||
49 | #define _COMPONENT ACPI_HARDWARE | 48 | #define _COMPONENT ACPI_HARDWARE |
@@ -90,7 +89,7 @@ acpi_get_timer_resolution ( | |||
90 | * | 89 | * |
91 | * PARAMETERS: Ticks - Where the timer value is returned | 90 | * PARAMETERS: Ticks - Where the timer value is returned |
92 | * | 91 | * |
93 | * RETURN: Status and current ticks | 92 | * RETURN: Status and current timer value (ticks) |
94 | * | 93 | * |
95 | * DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks). | 94 | * DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks). |
96 | * | 95 | * |
@@ -199,5 +198,6 @@ acpi_get_timer_duration ( | |||
199 | *time_elapsed = (u32) quotient; | 198 | *time_elapsed = (u32) quotient; |
200 | return_ACPI_STATUS (status); | 199 | return_ACPI_STATUS (status); |
201 | } | 200 | } |
201 | |||
202 | EXPORT_SYMBOL(acpi_get_timer_duration); | 202 | EXPORT_SYMBOL(acpi_get_timer_duration); |
203 | 203 | ||
diff --git a/drivers/acpi/hotkey.c b/drivers/acpi/hotkey.c new file mode 100644 index 000000000000..babdf762eadb --- /dev/null +++ b/drivers/acpi/hotkey.c | |||
@@ -0,0 +1,1019 @@ | |||
1 | /* | ||
2 | * hotkey.c - ACPI Hotkey Driver ($Revision:$) | ||
3 | * | ||
4 | * Copyright (C) 2004 Luming Yu <luming.yu@intel.com> | ||
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 | * You should have received a copy of the GNU General Public License along | ||
19 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | ||
21 | * | ||
22 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
23 | */ | ||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/init.h> | ||
27 | #include <linux/types.h> | ||
28 | #include <linux/proc_fs.h> | ||
29 | #include <linux/sched.h> | ||
30 | #include <linux/kmod.h> | ||
31 | #include <linux/seq_file.h> | ||
32 | #include <acpi/acpi_drivers.h> | ||
33 | #include <acpi/acpi_bus.h> | ||
34 | #include <asm/uaccess.h> | ||
35 | |||
36 | #define HOTKEY_ACPI_VERSION "0.1" | ||
37 | |||
38 | #define HOTKEY_PROC "hotkey" | ||
39 | #define HOTKEY_EV_CONFIG "event_config" | ||
40 | #define HOTKEY_PL_CONFIG "poll_config" | ||
41 | #define HOTKEY_ACTION "action" | ||
42 | #define HOTKEY_INFO "info" | ||
43 | |||
44 | #define ACPI_HOTK_NAME "Generic Hotkey Driver" | ||
45 | #define ACPI_HOTK_CLASS "Hotkey" | ||
46 | #define ACPI_HOTK_DEVICE_NAME "Hotkey" | ||
47 | #define ACPI_HOTK_HID "Unknown?" | ||
48 | #define ACPI_HOTKEY_COMPONENT 0x20000000 | ||
49 | |||
50 | #define ACPI_HOTKEY_EVENT 0x1 | ||
51 | #define ACPI_HOTKEY_POLLING 0x2 | ||
52 | #define ACPI_UNDEFINED_EVENT 0xf | ||
53 | |||
54 | #define MAX_CONFIG_RECORD_LEN 80 | ||
55 | #define MAX_NAME_PATH_LEN 80 | ||
56 | #define MAX_CALL_PARM 80 | ||
57 | |||
58 | #define IS_EVENT(e) 0xff /* ((e) & 0x40000000) */ | ||
59 | #define IS_POLL(e) 0xff /* (~((e) & 0x40000000)) */ | ||
60 | |||
61 | #define _COMPONENT ACPI_HOTKEY_COMPONENT | ||
62 | ACPI_MODULE_NAME("acpi_hotkey") | ||
63 | |||
64 | MODULE_AUTHOR("luming.yu@intel.com"); | ||
65 | MODULE_DESCRIPTION(ACPI_HOTK_NAME); | ||
66 | MODULE_LICENSE("GPL"); | ||
67 | |||
68 | /* standardized internal hotkey number/event */ | ||
69 | enum { | ||
70 | /* Video Extension event */ | ||
71 | HK_EVENT_CYCLE_OUTPUT_DEVICE = 0x80, | ||
72 | HK_EVENT_OUTPUT_DEVICE_STATUS_CHANGE, | ||
73 | HK_EVENT_CYCLE_DISPLAY_OUTPUT, | ||
74 | HK_EVENT_NEXT_DISPLAY_OUTPUT, | ||
75 | HK_EVENT_PREVIOUS_DISPLAY_OUTPUT, | ||
76 | HK_EVENT_CYCLE_BRIGHTNESS, | ||
77 | HK_EVENT_INCREASE_BRIGHTNESS, | ||
78 | HK_EVENT_DECREASE_BRIGHTNESS, | ||
79 | HK_EVENT_ZERO_BRIGHTNESS, | ||
80 | HK_EVENT_DISPLAY_DEVICE_OFF, | ||
81 | |||
82 | /* Snd Card event */ | ||
83 | HK_EVENT_VOLUME_MUTE, | ||
84 | HK_EVENT_VOLUME_INCLREASE, | ||
85 | HK_EVENT_VOLUME_DECREASE, | ||
86 | |||
87 | /* running state control */ | ||
88 | HK_EVENT_ENTERRING_S3, | ||
89 | HK_EVENT_ENTERRING_S4, | ||
90 | HK_EVENT_ENTERRING_S5, | ||
91 | }; | ||
92 | |||
93 | /* procdir we use */ | ||
94 | static struct proc_dir_entry *hotkey_proc_dir; | ||
95 | static struct proc_dir_entry *hotkey_config; | ||
96 | static struct proc_dir_entry *hotkey_poll_config; | ||
97 | static struct proc_dir_entry *hotkey_action; | ||
98 | static struct proc_dir_entry *hotkey_info; | ||
99 | |||
100 | /* linkage for all type of hotkey */ | ||
101 | struct acpi_hotkey_link { | ||
102 | struct list_head entries; | ||
103 | int hotkey_type; /* event or polling based hotkey */ | ||
104 | int hotkey_standard_num; /* standardized hotkey(event) number */ | ||
105 | }; | ||
106 | |||
107 | /* event based hotkey */ | ||
108 | struct acpi_event_hotkey { | ||
109 | struct acpi_hotkey_link hotkey_link; | ||
110 | int flag; | ||
111 | acpi_handle bus_handle; /* bus to install notify handler */ | ||
112 | int external_hotkey_num; /* external hotkey/event number */ | ||
113 | acpi_handle action_handle; /* acpi handle attached aml action method */ | ||
114 | char *action_method; /* action method */ | ||
115 | }; | ||
116 | |||
117 | /* | ||
118 | * There are two ways to poll status | ||
119 | * 1. directy call read_xxx method, without any arguments passed in | ||
120 | * 2. call write_xxx method, with arguments passed in, you need | ||
121 | * the result is saved in acpi_polling_hotkey.poll_result. | ||
122 | * anthoer read command through polling interface. | ||
123 | * | ||
124 | */ | ||
125 | |||
126 | /* polling based hotkey */ | ||
127 | struct acpi_polling_hotkey { | ||
128 | struct acpi_hotkey_link hotkey_link; | ||
129 | int flag; | ||
130 | acpi_handle poll_handle; /* acpi handle attached polling method */ | ||
131 | char *poll_method; /* poll method */ | ||
132 | acpi_handle action_handle; /* acpi handle attached action method */ | ||
133 | char *action_method; /* action method */ | ||
134 | void *poll_result; /* polling_result */ | ||
135 | struct proc_dir_entry *proc; | ||
136 | }; | ||
137 | |||
138 | /* hotkey object union */ | ||
139 | union acpi_hotkey { | ||
140 | struct list_head entries; | ||
141 | struct acpi_hotkey_link link; | ||
142 | struct acpi_event_hotkey event_hotkey; | ||
143 | struct acpi_polling_hotkey poll_hotkey; | ||
144 | }; | ||
145 | |||
146 | /* hotkey object list */ | ||
147 | struct acpi_hotkey_list { | ||
148 | struct list_head *entries; | ||
149 | int count; | ||
150 | }; | ||
151 | |||
152 | static int auto_hotkey_add(struct acpi_device *device); | ||
153 | static int auto_hotkey_remove(struct acpi_device *device, int type); | ||
154 | |||
155 | static struct acpi_driver hotkey_driver = { | ||
156 | .name = ACPI_HOTK_NAME, | ||
157 | .class = ACPI_HOTK_CLASS, | ||
158 | .ids = ACPI_HOTK_HID, | ||
159 | .ops = { | ||
160 | .add = auto_hotkey_add, | ||
161 | .remove = auto_hotkey_remove, | ||
162 | }, | ||
163 | }; | ||
164 | |||
165 | static int hotkey_open_config(struct inode *inode, struct file *file); | ||
166 | static ssize_t hotkey_write_config(struct file *file, | ||
167 | const char __user * buffer, | ||
168 | size_t count, loff_t * data); | ||
169 | static ssize_t hotkey_write_poll_config(struct file *file, | ||
170 | const char __user * buffer, | ||
171 | size_t count, loff_t * data); | ||
172 | static int hotkey_info_open_fs(struct inode *inode, struct file *file); | ||
173 | static int hotkey_action_open_fs(struct inode *inode, struct file *file); | ||
174 | static ssize_t hotkey_execute_aml_method(struct file *file, | ||
175 | const char __user * buffer, | ||
176 | size_t count, loff_t * data); | ||
177 | static int hotkey_config_seq_show(struct seq_file *seq, void *offset); | ||
178 | static int hotkey_polling_open_fs(struct inode *inode, struct file *file); | ||
179 | |||
180 | /* event based config */ | ||
181 | static struct file_operations hotkey_config_fops = { | ||
182 | .open = hotkey_open_config, | ||
183 | .read = seq_read, | ||
184 | .write = hotkey_write_config, | ||
185 | .llseek = seq_lseek, | ||
186 | .release = single_release, | ||
187 | }; | ||
188 | |||
189 | /* polling based config */ | ||
190 | static struct file_operations hotkey_poll_config_fops = { | ||
191 | .open = hotkey_open_config, | ||
192 | .read = seq_read, | ||
193 | .write = hotkey_write_poll_config, | ||
194 | .llseek = seq_lseek, | ||
195 | .release = single_release, | ||
196 | }; | ||
197 | |||
198 | /* hotkey driver info */ | ||
199 | static struct file_operations hotkey_info_fops = { | ||
200 | .open = hotkey_info_open_fs, | ||
201 | .read = seq_read, | ||
202 | .llseek = seq_lseek, | ||
203 | .release = single_release, | ||
204 | }; | ||
205 | |||
206 | /* action */ | ||
207 | static struct file_operations hotkey_action_fops = { | ||
208 | .open = hotkey_action_open_fs, | ||
209 | .read = seq_read, | ||
210 | .write = hotkey_execute_aml_method, | ||
211 | .llseek = seq_lseek, | ||
212 | .release = single_release, | ||
213 | }; | ||
214 | |||
215 | /* polling results */ | ||
216 | static struct file_operations hotkey_polling_fops = { | ||
217 | .open = hotkey_polling_open_fs, | ||
218 | .read = seq_read, | ||
219 | .llseek = seq_lseek, | ||
220 | .release = single_release, | ||
221 | }; | ||
222 | |||
223 | struct acpi_hotkey_list global_hotkey_list; /* link all ev or pl hotkey */ | ||
224 | struct list_head hotkey_entries; /* head of the list of hotkey_list */ | ||
225 | |||
226 | static int hotkey_info_seq_show(struct seq_file *seq, void *offset) | ||
227 | { | ||
228 | ACPI_FUNCTION_TRACE("hotkey_info_seq_show"); | ||
229 | |||
230 | seq_printf(seq, "Hotkey generic driver ver: %s", HOTKEY_ACPI_VERSION); | ||
231 | |||
232 | return_VALUE(0); | ||
233 | } | ||
234 | |||
235 | static int hotkey_info_open_fs(struct inode *inode, struct file *file) | ||
236 | { | ||
237 | return single_open(file, hotkey_info_seq_show, PDE(inode)->data); | ||
238 | } | ||
239 | |||
240 | static char *format_result(union acpi_object *object) | ||
241 | { | ||
242 | char *buf = (char *)kmalloc(sizeof(union acpi_object), GFP_KERNEL); | ||
243 | |||
244 | memset(buf, 0, sizeof(union acpi_object)); | ||
245 | |||
246 | /* Now, just support integer type */ | ||
247 | if (object->type == ACPI_TYPE_INTEGER) | ||
248 | sprintf(buf, "%d", (u32) object->integer.value); | ||
249 | |||
250 | return buf; | ||
251 | } | ||
252 | |||
253 | static int hotkey_polling_seq_show(struct seq_file *seq, void *offset) | ||
254 | { | ||
255 | struct acpi_polling_hotkey *poll_hotkey = | ||
256 | (struct acpi_polling_hotkey *)seq->private; | ||
257 | |||
258 | ACPI_FUNCTION_TRACE("hotkey_polling_seq_show"); | ||
259 | |||
260 | if (poll_hotkey->poll_result) | ||
261 | seq_printf(seq, "%s", format_result(poll_hotkey->poll_result)); | ||
262 | |||
263 | return_VALUE(0); | ||
264 | } | ||
265 | |||
266 | static int hotkey_polling_open_fs(struct inode *inode, struct file *file) | ||
267 | { | ||
268 | return single_open(file, hotkey_polling_seq_show, PDE(inode)->data); | ||
269 | } | ||
270 | |||
271 | static int hotkey_action_open_fs(struct inode *inode, struct file *file) | ||
272 | { | ||
273 | return single_open(file, hotkey_info_seq_show, PDE(inode)->data); | ||
274 | } | ||
275 | |||
276 | /* Mapping external hotkey number to standardized hotkey event num */ | ||
277 | static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list) | ||
278 | { | ||
279 | struct list_head *entries, *next; | ||
280 | int val = 0; | ||
281 | |||
282 | ACPI_FUNCTION_TRACE("hotkey_get_internal_event"); | ||
283 | |||
284 | list_for_each_safe(entries, next, list->entries) { | ||
285 | union acpi_hotkey *key = | ||
286 | container_of(entries, union acpi_hotkey, entries); | ||
287 | if (key->link.hotkey_type == ACPI_HOTKEY_EVENT | ||
288 | && key->event_hotkey.external_hotkey_num == event) | ||
289 | val = key->link.hotkey_standard_num; | ||
290 | else | ||
291 | val = -1; | ||
292 | } | ||
293 | |||
294 | return_VALUE(val); | ||
295 | } | ||
296 | |||
297 | static void | ||
298 | acpi_hotkey_notify_handler(acpi_handle handle, u32 event, void *data) | ||
299 | { | ||
300 | struct acpi_device *device = NULL; | ||
301 | u32 internal_event; | ||
302 | |||
303 | ACPI_FUNCTION_TRACE("acpi_hotkey_notify_handler"); | ||
304 | |||
305 | if (acpi_bus_get_device(handle, &device)) | ||
306 | return_VOID; | ||
307 | |||
308 | internal_event = hotkey_get_internal_event(event, &global_hotkey_list); | ||
309 | acpi_bus_generate_event(device, event, 0); | ||
310 | |||
311 | return_VOID; | ||
312 | } | ||
313 | |||
314 | /* Need to invent automatically hotkey add method */ | ||
315 | static int auto_hotkey_add(struct acpi_device *device) | ||
316 | { | ||
317 | /* Implement me */ | ||
318 | return 0; | ||
319 | } | ||
320 | |||
321 | /* Need to invent automatically hotkey remove method */ | ||
322 | static int auto_hotkey_remove(struct acpi_device *device, int type) | ||
323 | { | ||
324 | /* Implement me */ | ||
325 | return 0; | ||
326 | } | ||
327 | |||
328 | /* Create a proc file for each polling method */ | ||
329 | static int create_polling_proc(union acpi_hotkey *device) | ||
330 | { | ||
331 | struct proc_dir_entry *proc; | ||
332 | mode_t mode; | ||
333 | |||
334 | ACPI_FUNCTION_TRACE("create_polling_proc"); | ||
335 | mode = S_IFREG | S_IRUGO | S_IWUGO; | ||
336 | |||
337 | proc = create_proc_entry(device->poll_hotkey.action_method, | ||
338 | mode, hotkey_proc_dir); | ||
339 | |||
340 | if (!proc) { | ||
341 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
342 | "Hotkey: Unable to create %s entry\n", | ||
343 | device->poll_hotkey.poll_method)); | ||
344 | return_VALUE(-ENODEV); | ||
345 | } else { | ||
346 | proc->proc_fops = &hotkey_polling_fops; | ||
347 | proc->owner = THIS_MODULE; | ||
348 | proc->data = device; | ||
349 | proc->uid = 0; | ||
350 | proc->gid = 0; | ||
351 | device->poll_hotkey.proc = proc; | ||
352 | } | ||
353 | return_VALUE(0); | ||
354 | } | ||
355 | |||
356 | static int is_valid_acpi_path(const char *pathname) | ||
357 | { | ||
358 | acpi_handle handle; | ||
359 | acpi_status status; | ||
360 | ACPI_FUNCTION_TRACE("is_valid_acpi_path"); | ||
361 | |||
362 | status = acpi_get_handle(NULL, (char *)pathname, &handle); | ||
363 | return_VALUE(!ACPI_FAILURE(status)); | ||
364 | } | ||
365 | |||
366 | static int is_valid_hotkey(union acpi_hotkey *device) | ||
367 | { | ||
368 | ACPI_FUNCTION_TRACE("is_valid_hotkey"); | ||
369 | /* Implement valid check */ | ||
370 | return_VALUE(1); | ||
371 | } | ||
372 | |||
373 | static int hotkey_add(union acpi_hotkey *device) | ||
374 | { | ||
375 | int status = 0; | ||
376 | struct acpi_device *dev = NULL; | ||
377 | |||
378 | ACPI_FUNCTION_TRACE("hotkey_add"); | ||
379 | |||
380 | if (device->link.hotkey_type == ACPI_HOTKEY_EVENT) { | ||
381 | status = | ||
382 | acpi_bus_get_device(device->event_hotkey.bus_handle, &dev); | ||
383 | if (status) | ||
384 | return_VALUE(status); | ||
385 | |||
386 | status = acpi_install_notify_handler(dev->handle, | ||
387 | ACPI_SYSTEM_NOTIFY, | ||
388 | acpi_hotkey_notify_handler, | ||
389 | device); | ||
390 | } else /* Add polling hotkey */ | ||
391 | create_polling_proc(device); | ||
392 | |||
393 | global_hotkey_list.count++; | ||
394 | |||
395 | list_add_tail(&device->link.entries, global_hotkey_list.entries); | ||
396 | |||
397 | return_VALUE(status); | ||
398 | } | ||
399 | |||
400 | static int hotkey_remove(union acpi_hotkey *device) | ||
401 | { | ||
402 | struct list_head *entries, *next; | ||
403 | |||
404 | ACPI_FUNCTION_TRACE("hotkey_remove"); | ||
405 | |||
406 | list_for_each_safe(entries, next, global_hotkey_list.entries) { | ||
407 | union acpi_hotkey *key = | ||
408 | container_of(entries, union acpi_hotkey, entries); | ||
409 | if (key->link.hotkey_standard_num == | ||
410 | device->link.hotkey_standard_num) { | ||
411 | list_del(&key->link.entries); | ||
412 | remove_proc_entry(key->poll_hotkey.action_method, | ||
413 | hotkey_proc_dir); | ||
414 | global_hotkey_list.count--; | ||
415 | break; | ||
416 | } | ||
417 | } | ||
418 | return_VALUE(0); | ||
419 | } | ||
420 | |||
421 | static void hotkey_update(union acpi_hotkey *key) | ||
422 | { | ||
423 | struct list_head *entries, *next; | ||
424 | |||
425 | ACPI_FUNCTION_TRACE("hotkey_update"); | ||
426 | |||
427 | list_for_each_safe(entries, next, global_hotkey_list.entries) { | ||
428 | union acpi_hotkey *key = | ||
429 | container_of(entries, union acpi_hotkey, entries); | ||
430 | if (key->link.hotkey_standard_num == | ||
431 | key->link.hotkey_standard_num) { | ||
432 | key->event_hotkey.bus_handle = | ||
433 | key->event_hotkey.bus_handle; | ||
434 | key->event_hotkey.external_hotkey_num = | ||
435 | key->event_hotkey.external_hotkey_num; | ||
436 | key->event_hotkey.action_handle = | ||
437 | key->event_hotkey.action_handle; | ||
438 | key->event_hotkey.action_method = | ||
439 | key->event_hotkey.action_method; | ||
440 | break; | ||
441 | } | ||
442 | } | ||
443 | |||
444 | return_VOID; | ||
445 | } | ||
446 | |||
447 | static void free_hotkey_device(union acpi_hotkey *key) | ||
448 | { | ||
449 | struct acpi_device *dev; | ||
450 | int status; | ||
451 | |||
452 | ACPI_FUNCTION_TRACE("free_hotkey_device"); | ||
453 | |||
454 | if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) { | ||
455 | status = | ||
456 | acpi_bus_get_device(key->event_hotkey.bus_handle, &dev); | ||
457 | if (dev->handle) | ||
458 | acpi_remove_notify_handler(dev->handle, | ||
459 | ACPI_SYSTEM_NOTIFY, | ||
460 | acpi_hotkey_notify_handler); | ||
461 | } else | ||
462 | remove_proc_entry(key->poll_hotkey.action_method, | ||
463 | hotkey_proc_dir); | ||
464 | kfree(key); | ||
465 | return_VOID; | ||
466 | } | ||
467 | |||
468 | static int | ||
469 | init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str, | ||
470 | char *method, int std_num, int external_num) | ||
471 | { | ||
472 | ACPI_FUNCTION_TRACE("init_hotkey_device"); | ||
473 | |||
474 | key->link.hotkey_type = ACPI_HOTKEY_EVENT; | ||
475 | key->link.hotkey_standard_num = std_num; | ||
476 | key->event_hotkey.flag = 0; | ||
477 | if (is_valid_acpi_path(bus_str)) | ||
478 | acpi_get_handle((acpi_handle) 0, | ||
479 | bus_str, &(key->event_hotkey.bus_handle)); | ||
480 | else | ||
481 | return_VALUE(-ENODEV); | ||
482 | key->event_hotkey.external_hotkey_num = external_num; | ||
483 | if (is_valid_acpi_path(action_str)) | ||
484 | acpi_get_handle((acpi_handle) 0, | ||
485 | action_str, &(key->event_hotkey.action_handle)); | ||
486 | key->event_hotkey.action_method = kmalloc(sizeof(method), GFP_KERNEL); | ||
487 | strcpy(key->event_hotkey.action_method, method); | ||
488 | |||
489 | return_VALUE(!is_valid_hotkey(key)); | ||
490 | } | ||
491 | |||
492 | static int | ||
493 | init_poll_hotkey_device(union acpi_hotkey *key, | ||
494 | char *poll_str, | ||
495 | char *poll_method, | ||
496 | char *action_str, char *action_method, int std_num) | ||
497 | { | ||
498 | ACPI_FUNCTION_TRACE("init_poll_hotkey_device"); | ||
499 | |||
500 | key->link.hotkey_type = ACPI_HOTKEY_POLLING; | ||
501 | key->link.hotkey_standard_num = std_num; | ||
502 | key->poll_hotkey.flag = 0; | ||
503 | if (is_valid_acpi_path(poll_str)) | ||
504 | acpi_get_handle((acpi_handle) 0, | ||
505 | poll_str, &(key->poll_hotkey.poll_handle)); | ||
506 | else | ||
507 | return_VALUE(-ENODEV); | ||
508 | key->poll_hotkey.poll_method = poll_method; | ||
509 | if (is_valid_acpi_path(action_str)) | ||
510 | acpi_get_handle((acpi_handle) 0, | ||
511 | action_str, &(key->poll_hotkey.action_handle)); | ||
512 | key->poll_hotkey.action_method = | ||
513 | kmalloc(sizeof(action_method), GFP_KERNEL); | ||
514 | strcpy(key->poll_hotkey.action_method, action_method); | ||
515 | key->poll_hotkey.poll_result = | ||
516 | (union acpi_object *)kmalloc(sizeof(union acpi_object), GFP_KERNEL); | ||
517 | return_VALUE(is_valid_hotkey(key)); | ||
518 | } | ||
519 | |||
520 | static int check_hotkey_valid(union acpi_hotkey *key, | ||
521 | struct acpi_hotkey_list *list) | ||
522 | { | ||
523 | ACPI_FUNCTION_TRACE("check_hotkey_valid"); | ||
524 | return_VALUE(0); | ||
525 | } | ||
526 | |||
527 | static int hotkey_open_config(struct inode *inode, struct file *file) | ||
528 | { | ||
529 | ACPI_FUNCTION_TRACE("hotkey_open_config"); | ||
530 | return_VALUE(single_open | ||
531 | (file, hotkey_config_seq_show, PDE(inode)->data)); | ||
532 | } | ||
533 | |||
534 | static int hotkey_config_seq_show(struct seq_file *seq, void *offset) | ||
535 | { | ||
536 | struct acpi_hotkey_list *hotkey_list = &global_hotkey_list; | ||
537 | struct list_head *entries, *next; | ||
538 | char bus_name[ACPI_PATHNAME_MAX] = { 0 }; | ||
539 | char action_name[ACPI_PATHNAME_MAX] = { 0 }; | ||
540 | struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name }; | ||
541 | struct acpi_buffer act = { ACPI_PATHNAME_MAX, action_name }; | ||
542 | |||
543 | ACPI_FUNCTION_TRACE(("hotkey_config_seq_show")); | ||
544 | |||
545 | if (!hotkey_list) | ||
546 | goto end; | ||
547 | |||
548 | list_for_each_safe(entries, next, hotkey_list->entries) { | ||
549 | union acpi_hotkey *key = | ||
550 | container_of(entries, union acpi_hotkey, entries); | ||
551 | if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) { | ||
552 | acpi_get_name(key->event_hotkey.bus_handle, | ||
553 | ACPI_NAME_TYPE_MAX, &bus); | ||
554 | acpi_get_name(key->event_hotkey.action_handle, | ||
555 | ACPI_NAME_TYPE_MAX, &act); | ||
556 | seq_printf(seq, "%s:%s:%s:%d:%d", bus_name, | ||
557 | action_name, | ||
558 | key->event_hotkey.action_method, | ||
559 | key->link.hotkey_standard_num, | ||
560 | key->event_hotkey.external_hotkey_num); | ||
561 | } /* ACPI_HOTKEY_POLLING */ | ||
562 | else { | ||
563 | acpi_get_name(key->poll_hotkey.poll_handle, | ||
564 | ACPI_NAME_TYPE_MAX, &bus); | ||
565 | acpi_get_name(key->poll_hotkey.action_handle, | ||
566 | ACPI_NAME_TYPE_MAX, &act); | ||
567 | seq_printf(seq, "%s:%s:%s:%s:%d", bus_name, | ||
568 | key->poll_hotkey.poll_method, | ||
569 | action_name, | ||
570 | key->poll_hotkey.action_method, | ||
571 | key->link.hotkey_standard_num); | ||
572 | } | ||
573 | } | ||
574 | seq_puts(seq, "\n"); | ||
575 | end: | ||
576 | return_VALUE(0); | ||
577 | } | ||
578 | |||
579 | static int | ||
580 | get_parms(char *config_record, | ||
581 | int *cmd, | ||
582 | char *bus_handle, | ||
583 | char *bus_method, | ||
584 | char *action_handle, | ||
585 | char *method, int *internal_event_num, int *external_event_num) | ||
586 | { | ||
587 | char *tmp, *tmp1; | ||
588 | ACPI_FUNCTION_TRACE(("get_parms")); | ||
589 | |||
590 | sscanf(config_record, "%d", cmd); | ||
591 | |||
592 | tmp = strchr(config_record, ':'); | ||
593 | tmp++; | ||
594 | tmp1 = strchr(tmp, ':'); | ||
595 | strncpy(bus_handle, tmp, tmp1 - tmp); | ||
596 | bus_handle[tmp1 - tmp] = 0; | ||
597 | |||
598 | tmp = tmp1; | ||
599 | tmp++; | ||
600 | tmp1 = strchr(tmp, ':'); | ||
601 | strncpy(bus_method, tmp, tmp1 - tmp); | ||
602 | bus_method[tmp1 - tmp] = 0; | ||
603 | |||
604 | tmp = tmp1; | ||
605 | tmp++; | ||
606 | tmp1 = strchr(tmp, ':'); | ||
607 | strncpy(action_handle, tmp, tmp1 - tmp); | ||
608 | action_handle[tmp1 - tmp] = 0; | ||
609 | |||
610 | tmp = tmp1; | ||
611 | tmp++; | ||
612 | tmp1 = strchr(tmp, ':'); | ||
613 | strncpy(method, tmp, tmp1 - tmp); | ||
614 | method[tmp1 - tmp] = 0; | ||
615 | |||
616 | sscanf(tmp1 + 1, "%d:%d", internal_event_num, external_event_num); | ||
617 | return_VALUE(6); | ||
618 | } | ||
619 | |||
620 | /* count is length for one input record */ | ||
621 | static ssize_t hotkey_write_config(struct file *file, | ||
622 | const char __user * buffer, | ||
623 | size_t count, loff_t * data) | ||
624 | { | ||
625 | struct acpi_hotkey_list *hotkey_list = &global_hotkey_list; | ||
626 | char config_record[MAX_CONFIG_RECORD_LEN]; | ||
627 | char bus_handle[MAX_NAME_PATH_LEN]; | ||
628 | char bus_method[MAX_NAME_PATH_LEN]; | ||
629 | char action_handle[MAX_NAME_PATH_LEN]; | ||
630 | char method[20]; | ||
631 | int cmd, internal_event_num, external_event_num; | ||
632 | int ret = 0; | ||
633 | union acpi_hotkey *key = NULL; | ||
634 | |||
635 | ACPI_FUNCTION_TRACE(("hotkey_write_config")); | ||
636 | |||
637 | if (!hotkey_list || count > MAX_CONFIG_RECORD_LEN) { | ||
638 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid arguments\n")); | ||
639 | return_VALUE(-EINVAL); | ||
640 | } | ||
641 | |||
642 | if (copy_from_user(config_record, buffer, count)) { | ||
643 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data \n")); | ||
644 | return_VALUE(-EINVAL); | ||
645 | } | ||
646 | config_record[count] = '\0'; | ||
647 | |||
648 | ret = get_parms(config_record, | ||
649 | &cmd, | ||
650 | bus_handle, | ||
651 | bus_method, | ||
652 | action_handle, | ||
653 | method, &internal_event_num, &external_event_num); | ||
654 | if (ret != 6) { | ||
655 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
656 | "Invalid data format ret=%d\n", ret)); | ||
657 | return_VALUE(-EINVAL); | ||
658 | } | ||
659 | |||
660 | key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL); | ||
661 | ret = init_hotkey_device(key, bus_handle, action_handle, method, | ||
662 | internal_event_num, external_event_num); | ||
663 | |||
664 | if (ret || check_hotkey_valid(key, hotkey_list)) { | ||
665 | kfree(key); | ||
666 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid hotkey \n")); | ||
667 | return_VALUE(-EINVAL); | ||
668 | } | ||
669 | switch (cmd) { | ||
670 | case 0: | ||
671 | hotkey_add(key); | ||
672 | break; | ||
673 | case 1: | ||
674 | hotkey_remove(key); | ||
675 | free_hotkey_device(key); | ||
676 | break; | ||
677 | case 2: | ||
678 | hotkey_update(key); | ||
679 | break; | ||
680 | default: | ||
681 | break; | ||
682 | } | ||
683 | return_VALUE(count); | ||
684 | } | ||
685 | |||
686 | /* count is length for one input record */ | ||
687 | static ssize_t hotkey_write_poll_config(struct file *file, | ||
688 | const char __user * buffer, | ||
689 | size_t count, loff_t * data) | ||
690 | { | ||
691 | struct seq_file *m = (struct seq_file *)file->private_data; | ||
692 | struct acpi_hotkey_list *hotkey_list = | ||
693 | (struct acpi_hotkey_list *)m->private; | ||
694 | |||
695 | char config_record[MAX_CONFIG_RECORD_LEN]; | ||
696 | char polling_handle[MAX_NAME_PATH_LEN]; | ||
697 | char action_handle[MAX_NAME_PATH_LEN]; | ||
698 | char poll_method[20], action_method[20]; | ||
699 | int ret, internal_event_num, cmd, external_event_num; | ||
700 | union acpi_hotkey *key = NULL; | ||
701 | |||
702 | ACPI_FUNCTION_TRACE("hotkey_write_poll_config"); | ||
703 | |||
704 | if (!hotkey_list || count > MAX_CONFIG_RECORD_LEN) { | ||
705 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid arguments\n")); | ||
706 | return_VALUE(-EINVAL); | ||
707 | } | ||
708 | |||
709 | if (copy_from_user(config_record, buffer, count)) { | ||
710 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data \n")); | ||
711 | return_VALUE(-EINVAL); | ||
712 | } | ||
713 | config_record[count] = '\0'; | ||
714 | |||
715 | ret = get_parms(config_record, | ||
716 | &cmd, | ||
717 | polling_handle, | ||
718 | poll_method, | ||
719 | action_handle, | ||
720 | action_method, | ||
721 | &internal_event_num, &external_event_num); | ||
722 | |||
723 | if (ret != 6) { | ||
724 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data format\n")); | ||
725 | return_VALUE(-EINVAL); | ||
726 | } | ||
727 | |||
728 | key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL); | ||
729 | ret = init_poll_hotkey_device(key, polling_handle, poll_method, | ||
730 | action_handle, action_method, | ||
731 | internal_event_num); | ||
732 | if (ret || check_hotkey_valid(key, hotkey_list)) { | ||
733 | kfree(key); | ||
734 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid hotkey \n")); | ||
735 | return_VALUE(-EINVAL); | ||
736 | } | ||
737 | switch (cmd) { | ||
738 | case 0: | ||
739 | hotkey_add(key); | ||
740 | break; | ||
741 | case 1: | ||
742 | hotkey_remove(key); | ||
743 | break; | ||
744 | case 2: | ||
745 | hotkey_update(key); | ||
746 | break; | ||
747 | default: | ||
748 | break; | ||
749 | } | ||
750 | return_VALUE(count); | ||
751 | } | ||
752 | |||
753 | /* | ||
754 | * This function evaluates an ACPI method, given an int as parameter, the | ||
755 | * method is searched within the scope of the handle, can be NULL. The output | ||
756 | * of the method is written is output, which can also be NULL | ||
757 | * | ||
758 | * returns 1 if write is successful, 0 else. | ||
759 | */ | ||
760 | static int write_acpi_int(acpi_handle handle, const char *method, int val, | ||
761 | struct acpi_buffer *output) | ||
762 | { | ||
763 | struct acpi_object_list params; /* list of input parameters (an int here) */ | ||
764 | union acpi_object in_obj; /* the only param we use */ | ||
765 | acpi_status status; | ||
766 | |||
767 | ACPI_FUNCTION_TRACE("write_acpi_int"); | ||
768 | params.count = 1; | ||
769 | params.pointer = &in_obj; | ||
770 | in_obj.type = ACPI_TYPE_INTEGER; | ||
771 | in_obj.integer.value = val; | ||
772 | |||
773 | status = acpi_evaluate_object(handle, (char *)method, ¶ms, output); | ||
774 | |||
775 | return_VALUE(status == AE_OK); | ||
776 | } | ||
777 | |||
778 | static int read_acpi_int(acpi_handle handle, const char *method, int *val) | ||
779 | { | ||
780 | struct acpi_buffer output; | ||
781 | union acpi_object out_obj; | ||
782 | acpi_status status; | ||
783 | |||
784 | ACPI_FUNCTION_TRACE("read_acpi_int"); | ||
785 | output.length = sizeof(out_obj); | ||
786 | output.pointer = &out_obj; | ||
787 | |||
788 | status = acpi_evaluate_object(handle, (char *)method, NULL, &output); | ||
789 | *val = out_obj.integer.value; | ||
790 | return_VALUE((status == AE_OK) | ||
791 | && (out_obj.type == ACPI_TYPE_INTEGER)); | ||
792 | } | ||
793 | |||
794 | static acpi_handle | ||
795 | get_handle_from_hotkeylist(struct acpi_hotkey_list *hotkey_list, int event_num) | ||
796 | { | ||
797 | struct list_head *entries, *next; | ||
798 | |||
799 | list_for_each_safe(entries, next, hotkey_list->entries) { | ||
800 | union acpi_hotkey *key = | ||
801 | container_of(entries, union acpi_hotkey, entries); | ||
802 | if (key->link.hotkey_type == ACPI_HOTKEY_EVENT | ||
803 | && key->link.hotkey_standard_num == event_num) { | ||
804 | return (key->event_hotkey.action_handle); | ||
805 | } | ||
806 | } | ||
807 | return (NULL); | ||
808 | } | ||
809 | |||
810 | static | ||
811 | char *get_method_from_hotkeylist(struct acpi_hotkey_list *hotkey_list, | ||
812 | int event_num) | ||
813 | { | ||
814 | struct list_head *entries, *next; | ||
815 | |||
816 | list_for_each_safe(entries, next, hotkey_list->entries) { | ||
817 | union acpi_hotkey *key = | ||
818 | container_of(entries, union acpi_hotkey, entries); | ||
819 | |||
820 | if (key->link.hotkey_type == ACPI_HOTKEY_EVENT && | ||
821 | key->link.hotkey_standard_num == event_num) | ||
822 | return (key->event_hotkey.action_method); | ||
823 | } | ||
824 | return (NULL); | ||
825 | } | ||
826 | |||
827 | static struct acpi_polling_hotkey *get_hotkey_by_event(struct | ||
828 | acpi_hotkey_list | ||
829 | *hotkey_list, int event) | ||
830 | { | ||
831 | struct list_head *entries, *next; | ||
832 | |||
833 | list_for_each_safe(entries, next, hotkey_list->entries) { | ||
834 | union acpi_hotkey *key = | ||
835 | container_of(entries, union acpi_hotkey, entries); | ||
836 | if (key->link.hotkey_type == ACPI_HOTKEY_POLLING | ||
837 | && key->link.hotkey_standard_num == event) { | ||
838 | return (&key->poll_hotkey); | ||
839 | } | ||
840 | } | ||
841 | return (NULL); | ||
842 | } | ||
843 | |||
844 | /* | ||
845 | * user call AML method interface: | ||
846 | * Call convention: | ||
847 | * echo "event_num: arg type : value" | ||
848 | * example: echo "1:1:30" > /proc/acpi/action | ||
849 | * Just support 1 integer arg passing to AML method | ||
850 | */ | ||
851 | |||
852 | static ssize_t hotkey_execute_aml_method(struct file *file, | ||
853 | const char __user * buffer, | ||
854 | size_t count, loff_t * data) | ||
855 | { | ||
856 | struct acpi_hotkey_list *hotkey_list = &global_hotkey_list; | ||
857 | char arg[MAX_CALL_PARM]; | ||
858 | int event, type, value; | ||
859 | |||
860 | char *method; | ||
861 | acpi_handle handle; | ||
862 | |||
863 | ACPI_FUNCTION_TRACE("hotkey_execte_aml_method"); | ||
864 | |||
865 | if (!hotkey_list || count > MAX_CALL_PARM) { | ||
866 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 1")); | ||
867 | return_VALUE(-EINVAL); | ||
868 | } | ||
869 | |||
870 | if (copy_from_user(arg, buffer, count)) { | ||
871 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 2")); | ||
872 | return_VALUE(-EINVAL); | ||
873 | } | ||
874 | |||
875 | arg[count] = '\0'; | ||
876 | |||
877 | if (sscanf(arg, "%d:%d:%d", &event, &type, &value) != 3) { | ||
878 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 3")); | ||
879 | return_VALUE(-EINVAL); | ||
880 | } | ||
881 | |||
882 | if (type == ACPI_TYPE_INTEGER) { | ||
883 | handle = get_handle_from_hotkeylist(hotkey_list, event); | ||
884 | method = (char *)get_method_from_hotkeylist(hotkey_list, event); | ||
885 | if (IS_EVENT(event)) | ||
886 | write_acpi_int(handle, method, value, NULL); | ||
887 | else if (IS_POLL(event)) { | ||
888 | struct acpi_polling_hotkey *key; | ||
889 | key = (struct acpi_polling_hotkey *) | ||
890 | get_hotkey_by_event(hotkey_list, event); | ||
891 | read_acpi_int(handle, method, key->poll_result); | ||
892 | } | ||
893 | } else { | ||
894 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Not supported")); | ||
895 | return_VALUE(-EINVAL); | ||
896 | } | ||
897 | |||
898 | return_VALUE(count); | ||
899 | } | ||
900 | |||
901 | static int __init hotkey_init(void) | ||
902 | { | ||
903 | int result; | ||
904 | mode_t mode = S_IFREG | S_IRUGO | S_IWUGO; | ||
905 | |||
906 | ACPI_FUNCTION_TRACE("hotkey_init"); | ||
907 | |||
908 | if (acpi_disabled) | ||
909 | return -ENODEV; | ||
910 | |||
911 | if (acpi_specific_hotkey_enabled) { | ||
912 | printk("Using specific hotkey driver\n"); | ||
913 | return -ENODEV; | ||
914 | } | ||
915 | |||
916 | hotkey_proc_dir = proc_mkdir(HOTKEY_PROC, acpi_root_dir); | ||
917 | if (!hotkey_proc_dir) { | ||
918 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
919 | "Hotkey: Unable to create %s entry\n", | ||
920 | HOTKEY_PROC)); | ||
921 | return (-ENODEV); | ||
922 | } | ||
923 | hotkey_proc_dir->owner = THIS_MODULE; | ||
924 | |||
925 | hotkey_config = | ||
926 | create_proc_entry(HOTKEY_EV_CONFIG, mode, hotkey_proc_dir); | ||
927 | if (!hotkey_config) { | ||
928 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
929 | "Hotkey: Unable to create %s entry\n", | ||
930 | HOTKEY_EV_CONFIG)); | ||
931 | return (-ENODEV); | ||
932 | } else { | ||
933 | hotkey_config->proc_fops = &hotkey_config_fops; | ||
934 | hotkey_config->data = &global_hotkey_list; | ||
935 | hotkey_config->owner = THIS_MODULE; | ||
936 | hotkey_config->uid = 0; | ||
937 | hotkey_config->gid = 0; | ||
938 | } | ||
939 | |||
940 | hotkey_poll_config = | ||
941 | create_proc_entry(HOTKEY_PL_CONFIG, mode, hotkey_proc_dir); | ||
942 | if (!hotkey_poll_config) { | ||
943 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
944 | "Hotkey: Unable to create %s entry\n", | ||
945 | HOTKEY_EV_CONFIG)); | ||
946 | return (-ENODEV); | ||
947 | } else { | ||
948 | hotkey_poll_config->proc_fops = &hotkey_poll_config_fops; | ||
949 | hotkey_poll_config->data = &global_hotkey_list; | ||
950 | hotkey_poll_config->owner = THIS_MODULE; | ||
951 | hotkey_poll_config->uid = 0; | ||
952 | hotkey_poll_config->gid = 0; | ||
953 | } | ||
954 | |||
955 | hotkey_action = create_proc_entry(HOTKEY_ACTION, mode, hotkey_proc_dir); | ||
956 | if (!hotkey_action) { | ||
957 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
958 | "Hotkey: Unable to create %s entry\n", | ||
959 | HOTKEY_ACTION)); | ||
960 | return (-ENODEV); | ||
961 | } else { | ||
962 | hotkey_action->proc_fops = &hotkey_action_fops; | ||
963 | hotkey_action->owner = THIS_MODULE; | ||
964 | hotkey_action->uid = 0; | ||
965 | hotkey_action->gid = 0; | ||
966 | } | ||
967 | |||
968 | hotkey_info = create_proc_entry(HOTKEY_INFO, mode, hotkey_proc_dir); | ||
969 | if (!hotkey_info) { | ||
970 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
971 | "Hotkey: Unable to create %s entry\n", | ||
972 | HOTKEY_INFO)); | ||
973 | return (-ENODEV); | ||
974 | } else { | ||
975 | hotkey_info->proc_fops = &hotkey_info_fops; | ||
976 | hotkey_info->owner = THIS_MODULE; | ||
977 | hotkey_info->uid = 0; | ||
978 | hotkey_info->gid = 0; | ||
979 | } | ||
980 | |||
981 | result = acpi_bus_register_driver(&hotkey_driver); | ||
982 | if (result < 0) { | ||
983 | remove_proc_entry(HOTKEY_PROC, acpi_root_dir); | ||
984 | return (-ENODEV); | ||
985 | } | ||
986 | global_hotkey_list.count = 0; | ||
987 | global_hotkey_list.entries = &hotkey_entries; | ||
988 | |||
989 | INIT_LIST_HEAD(&hotkey_entries); | ||
990 | |||
991 | return (0); | ||
992 | } | ||
993 | |||
994 | static void __exit hotkey_exit(void) | ||
995 | { | ||
996 | struct list_head *entries, *next; | ||
997 | |||
998 | ACPI_FUNCTION_TRACE("hotkey_remove"); | ||
999 | |||
1000 | list_for_each_safe(entries, next, global_hotkey_list.entries) { | ||
1001 | union acpi_hotkey *key = | ||
1002 | container_of(entries, union acpi_hotkey, entries); | ||
1003 | |||
1004 | acpi_os_wait_events_complete(NULL); | ||
1005 | list_del(&key->link.entries); | ||
1006 | global_hotkey_list.count--; | ||
1007 | free_hotkey_device(key); | ||
1008 | } | ||
1009 | acpi_bus_unregister_driver(&hotkey_driver); | ||
1010 | remove_proc_entry(HOTKEY_EV_CONFIG, hotkey_proc_dir); | ||
1011 | remove_proc_entry(HOTKEY_PL_CONFIG, hotkey_proc_dir); | ||
1012 | remove_proc_entry(HOTKEY_ACTION, hotkey_proc_dir); | ||
1013 | remove_proc_entry(HOTKEY_INFO, hotkey_proc_dir); | ||
1014 | remove_proc_entry(HOTKEY_PROC, acpi_root_dir); | ||
1015 | return; | ||
1016 | } | ||
1017 | |||
1018 | module_init(hotkey_init); | ||
1019 | module_exit(hotkey_exit); | ||
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c index 0fb731a470dc..ad85e10001f4 100644 --- a/drivers/acpi/ibm_acpi.c +++ b/drivers/acpi/ibm_acpi.c | |||
@@ -1025,7 +1025,7 @@ static int setup_notify(struct ibm_struct *ibm) | |||
1025 | return 0; | 1025 | return 0; |
1026 | } | 1026 | } |
1027 | 1027 | ||
1028 | static int device_add(struct acpi_device *device) | 1028 | static int ibmacpi_device_add(struct acpi_device *device) |
1029 | { | 1029 | { |
1030 | return 0; | 1030 | return 0; |
1031 | } | 1031 | } |
@@ -1043,7 +1043,7 @@ static int register_driver(struct ibm_struct *ibm) | |||
1043 | memset(ibm->driver, 0, sizeof(struct acpi_driver)); | 1043 | memset(ibm->driver, 0, sizeof(struct acpi_driver)); |
1044 | sprintf(ibm->driver->name, "%s/%s", IBM_NAME, ibm->name); | 1044 | sprintf(ibm->driver->name, "%s/%s", IBM_NAME, ibm->name); |
1045 | ibm->driver->ids = ibm->hid; | 1045 | ibm->driver->ids = ibm->hid; |
1046 | ibm->driver->ops.add = &device_add; | 1046 | ibm->driver->ops.add = &ibmacpi_device_add; |
1047 | 1047 | ||
1048 | ret = acpi_bus_register_driver(ibm->driver); | 1048 | ret = acpi_bus_register_driver(ibm->driver); |
1049 | if (ret < 0) { | 1049 | if (ret < 0) { |
@@ -1185,6 +1185,10 @@ static int __init acpi_ibm_init(void) | |||
1185 | if (acpi_disabled) | 1185 | if (acpi_disabled) |
1186 | return -ENODEV; | 1186 | return -ENODEV; |
1187 | 1187 | ||
1188 | if (!acpi_specific_hotkey_enabled){ | ||
1189 | printk(IBM_ERR "Using generic hotkey driver\n"); | ||
1190 | return -ENODEV; | ||
1191 | } | ||
1188 | /* these handles are required */ | 1192 | /* these handles are required */ |
1189 | if (IBM_HANDLE_INIT(ec, 1) < 0 || | 1193 | if (IBM_HANDLE_INIT(ec, 1) < 0 || |
1190 | IBM_HANDLE_INIT(hkey, 1) < 0 || | 1194 | IBM_HANDLE_INIT(hkey, 1) < 0 || |
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 1c0c12336c57..ece7a9dedd5c 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c | |||
@@ -67,7 +67,8 @@ | |||
67 | ******************************************************************************/ | 67 | ******************************************************************************/ |
68 | 68 | ||
69 | acpi_status | 69 | acpi_status |
70 | acpi_ns_root_initialize (void) | 70 | acpi_ns_root_initialize ( |
71 | void) | ||
71 | { | 72 | { |
72 | acpi_status status; | 73 | acpi_status status; |
73 | const struct acpi_predefined_names *init_val = NULL; | 74 | const struct acpi_predefined_names *init_val = NULL; |
@@ -265,7 +266,7 @@ unlock_and_exit: | |||
265 | * | 266 | * |
266 | * FUNCTION: acpi_ns_lookup | 267 | * FUNCTION: acpi_ns_lookup |
267 | * | 268 | * |
268 | * PARAMETERS: prefix_node - Search scope if name is not fully qualified | 269 | * PARAMETERS: scope_info - Current scope info block |
269 | * Pathname - Search pathname, in internal format | 270 | * Pathname - Search pathname, in internal format |
270 | * (as represented in the AML stream) | 271 | * (as represented in the AML stream) |
271 | * Type - Type associated with name | 272 | * Type - Type associated with name |
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index bfd922c5c7d1..5653a19d7172 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c | |||
@@ -49,14 +49,20 @@ | |||
49 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME ("nsalloc") | 50 | ACPI_MODULE_NAME ("nsalloc") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static void | ||
55 | acpi_ns_remove_reference ( | ||
56 | struct acpi_namespace_node *node); | ||
57 | |||
52 | 58 | ||
53 | /******************************************************************************* | 59 | /******************************************************************************* |
54 | * | 60 | * |
55 | * FUNCTION: acpi_ns_create_node | 61 | * FUNCTION: acpi_ns_create_node |
56 | * | 62 | * |
57 | * PARAMETERS: acpi_name - Name of the new node | 63 | * PARAMETERS: Name - Name of the new node (4 char ACPI name) |
58 | * | 64 | * |
59 | * RETURN: None | 65 | * RETURN: New namespace node (Null on failure) |
60 | * | 66 | * |
61 | * DESCRIPTION: Create a namespace node | 67 | * DESCRIPTION: Create a namespace node |
62 | * | 68 | * |
@@ -145,7 +151,6 @@ acpi_ns_delete_node ( | |||
145 | } | 151 | } |
146 | } | 152 | } |
147 | 153 | ||
148 | |||
149 | ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++); | 154 | ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++); |
150 | 155 | ||
151 | /* | 156 | /* |
@@ -157,57 +162,6 @@ acpi_ns_delete_node ( | |||
157 | } | 162 | } |
158 | 163 | ||
159 | 164 | ||
160 | #ifdef ACPI_ALPHABETIC_NAMESPACE | ||
161 | /******************************************************************************* | ||
162 | * | ||
163 | * FUNCTION: acpi_ns_compare_names | ||
164 | * | ||
165 | * PARAMETERS: Name1 - First name to compare | ||
166 | * Name2 - Second name to compare | ||
167 | * | ||
168 | * RETURN: value from strncmp | ||
169 | * | ||
170 | * DESCRIPTION: Compare two ACPI names. Names that are prefixed with an | ||
171 | * underscore are forced to be alphabetically first. | ||
172 | * | ||
173 | ******************************************************************************/ | ||
174 | |||
175 | int | ||
176 | acpi_ns_compare_names ( | ||
177 | char *name1, | ||
178 | char *name2) | ||
179 | { | ||
180 | char reversed_name1[ACPI_NAME_SIZE]; | ||
181 | char reversed_name2[ACPI_NAME_SIZE]; | ||
182 | u32 i; | ||
183 | u32 j; | ||
184 | |||
185 | |||
186 | /* | ||
187 | * Replace all instances of "underscore" with a value that is smaller so | ||
188 | * that all names that are prefixed with underscore(s) are alphabetically | ||
189 | * first. | ||
190 | * | ||
191 | * Reverse the name bytewise so we can just do a 32-bit compare instead | ||
192 | * of a strncmp. | ||
193 | */ | ||
194 | for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--) { | ||
195 | reversed_name1[j] = name1[i]; | ||
196 | if (name1[i] == '_') { | ||
197 | reversed_name1[j] = '*'; | ||
198 | } | ||
199 | |||
200 | reversed_name2[j] = name2[i]; | ||
201 | if (name2[i] == '_') { | ||
202 | reversed_name2[j] = '*'; | ||
203 | } | ||
204 | } | ||
205 | |||
206 | return (*(int *) reversed_name1 - *(int *) reversed_name2); | ||
207 | } | ||
208 | #endif | ||
209 | |||
210 | |||
211 | /******************************************************************************* | 165 | /******************************************************************************* |
212 | * | 166 | * |
213 | * FUNCTION: acpi_ns_install_node | 167 | * FUNCTION: acpi_ns_install_node |
@@ -271,7 +225,8 @@ acpi_ns_install_node ( | |||
271 | * alphabetic placement. | 225 | * alphabetic placement. |
272 | */ | 226 | */ |
273 | previous_child_node = NULL; | 227 | previous_child_node = NULL; |
274 | while (acpi_ns_compare_names (acpi_ut_get_node_name (child_node), acpi_ut_get_node_name (node)) < 0) { | 228 | while (acpi_ns_compare_names (acpi_ut_get_node_name (child_node), |
229 | acpi_ut_get_node_name (node)) < 0) { | ||
275 | if (child_node->flags & ANOBJ_END_OF_PEER_LIST) { | 230 | if (child_node->flags & ANOBJ_END_OF_PEER_LIST) { |
276 | /* Last peer; Clear end-of-list flag */ | 231 | /* Last peer; Clear end-of-list flag */ |
277 | 232 | ||
@@ -429,7 +384,8 @@ acpi_ns_delete_children ( | |||
429 | /* There should be only one reference remaining on this node */ | 384 | /* There should be only one reference remaining on this node */ |
430 | 385 | ||
431 | if (child_node->reference_count != 1) { | 386 | if (child_node->reference_count != 1) { |
432 | ACPI_REPORT_WARNING (("Existing references (%d) on node being deleted (%p)\n", | 387 | ACPI_REPORT_WARNING (( |
388 | "Existing references (%d) on node being deleted (%p)\n", | ||
433 | child_node->reference_count, child_node)); | 389 | child_node->reference_count, child_node)); |
434 | } | 390 | } |
435 | 391 | ||
@@ -548,7 +504,7 @@ acpi_ns_delete_namespace_subtree ( | |||
548 | * | 504 | * |
549 | ******************************************************************************/ | 505 | ******************************************************************************/ |
550 | 506 | ||
551 | void | 507 | static void |
552 | acpi_ns_remove_reference ( | 508 | acpi_ns_remove_reference ( |
553 | struct acpi_namespace_node *node) | 509 | struct acpi_namespace_node *node) |
554 | { | 510 | { |
@@ -683,3 +639,54 @@ acpi_ns_delete_namespace_by_owner ( | |||
683 | } | 639 | } |
684 | 640 | ||
685 | 641 | ||
642 | #ifdef ACPI_ALPHABETIC_NAMESPACE | ||
643 | /******************************************************************************* | ||
644 | * | ||
645 | * FUNCTION: acpi_ns_compare_names | ||
646 | * | ||
647 | * PARAMETERS: Name1 - First name to compare | ||
648 | * Name2 - Second name to compare | ||
649 | * | ||
650 | * RETURN: value from strncmp | ||
651 | * | ||
652 | * DESCRIPTION: Compare two ACPI names. Names that are prefixed with an | ||
653 | * underscore are forced to be alphabetically first. | ||
654 | * | ||
655 | ******************************************************************************/ | ||
656 | |||
657 | int | ||
658 | acpi_ns_compare_names ( | ||
659 | char *name1, | ||
660 | char *name2) | ||
661 | { | ||
662 | char reversed_name1[ACPI_NAME_SIZE]; | ||
663 | char reversed_name2[ACPI_NAME_SIZE]; | ||
664 | u32 i; | ||
665 | u32 j; | ||
666 | |||
667 | |||
668 | /* | ||
669 | * Replace all instances of "underscore" with a value that is smaller so | ||
670 | * that all names that are prefixed with underscore(s) are alphabetically | ||
671 | * first. | ||
672 | * | ||
673 | * Reverse the name bytewise so we can just do a 32-bit compare instead | ||
674 | * of a strncmp. | ||
675 | */ | ||
676 | for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--) { | ||
677 | reversed_name1[j] = name1[i]; | ||
678 | if (name1[i] == '_') { | ||
679 | reversed_name1[j] = '*'; | ||
680 | } | ||
681 | |||
682 | reversed_name2[j] = name2[i]; | ||
683 | if (name2[i] == '_') { | ||
684 | reversed_name2[j] = '*'; | ||
685 | } | ||
686 | } | ||
687 | |||
688 | return (*(int *) reversed_name1 - *(int *) reversed_name2); | ||
689 | } | ||
690 | #endif | ||
691 | |||
692 | |||
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index 1f6af3eb6c91..6c2aef0e0dd4 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c | |||
@@ -50,16 +50,32 @@ | |||
50 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME ("nsdump") | 51 | ACPI_MODULE_NAME ("nsdump") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
53 | 54 | ||
54 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 55 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
56 | void | ||
57 | acpi_ns_dump_root_devices ( | ||
58 | void); | ||
55 | 59 | ||
60 | static acpi_status | ||
61 | acpi_ns_dump_one_device ( | ||
62 | acpi_handle obj_handle, | ||
63 | u32 level, | ||
64 | void *context, | ||
65 | void **return_value); | ||
66 | #endif | ||
67 | |||
68 | |||
69 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
56 | /******************************************************************************* | 70 | /******************************************************************************* |
57 | * | 71 | * |
58 | * FUNCTION: acpi_ns_print_pathname | 72 | * FUNCTION: acpi_ns_print_pathname |
59 | * | 73 | * |
60 | * PARAMETERS: num_segment - Number of ACPI name segments | 74 | * PARAMETERS: num_segments - Number of ACPI name segments |
61 | * Pathname - The compressed (internal) path | 75 | * Pathname - The compressed (internal) path |
62 | * | 76 | * |
77 | * RETURN: None | ||
78 | * | ||
63 | * DESCRIPTION: Print an object's full namespace pathname | 79 | * DESCRIPTION: Print an object's full namespace pathname |
64 | * | 80 | * |
65 | ******************************************************************************/ | 81 | ******************************************************************************/ |
@@ -103,6 +119,8 @@ acpi_ns_print_pathname ( | |||
103 | * Level - Desired debug level | 119 | * Level - Desired debug level |
104 | * Component - Caller's component ID | 120 | * Component - Caller's component ID |
105 | * | 121 | * |
122 | * RETURN: None | ||
123 | * | ||
106 | * DESCRIPTION: Print an object's full namespace pathname | 124 | * DESCRIPTION: Print an object's full namespace pathname |
107 | * Manages allocation/freeing of a pathname buffer | 125 | * Manages allocation/freeing of a pathname buffer |
108 | * | 126 | * |
@@ -137,9 +155,12 @@ acpi_ns_dump_pathname ( | |||
137 | * | 155 | * |
138 | * FUNCTION: acpi_ns_dump_one_object | 156 | * FUNCTION: acpi_ns_dump_one_object |
139 | * | 157 | * |
140 | * PARAMETERS: Handle - Node to be dumped | 158 | * PARAMETERS: obj_handle - Node to be dumped |
141 | * Level - Nesting level of the handle | 159 | * Level - Nesting level of the handle |
142 | * Context - Passed into walk_namespace | 160 | * Context - Passed into walk_namespace |
161 | * return_value - Not used | ||
162 | * | ||
163 | * RETURN: Status | ||
143 | * | 164 | * |
144 | * DESCRIPTION: Dump a single Node | 165 | * DESCRIPTION: Dump a single Node |
145 | * This procedure is a user_function called by acpi_ns_walk_namespace. | 166 | * This procedure is a user_function called by acpi_ns_walk_namespace. |
@@ -394,8 +415,7 @@ acpi_ns_dump_one_object ( | |||
394 | return (AE_OK); | 415 | return (AE_OK); |
395 | } | 416 | } |
396 | 417 | ||
397 | acpi_os_printf ("(R%d)", | 418 | acpi_os_printf ("(R%d)", obj_desc->common.reference_count); |
398 | obj_desc->common.reference_count); | ||
399 | 419 | ||
400 | switch (type) { | 420 | switch (type) { |
401 | case ACPI_TYPE_METHOD: | 421 | case ACPI_TYPE_METHOD: |
@@ -551,18 +571,20 @@ cleanup: | |||
551 | 571 | ||
552 | 572 | ||
553 | #ifdef ACPI_FUTURE_USAGE | 573 | #ifdef ACPI_FUTURE_USAGE |
554 | |||
555 | /******************************************************************************* | 574 | /******************************************************************************* |
556 | * | 575 | * |
557 | * FUNCTION: acpi_ns_dump_objects | 576 | * FUNCTION: acpi_ns_dump_objects |
558 | * | 577 | * |
559 | * PARAMETERS: Type - Object type to be dumped | 578 | * PARAMETERS: Type - Object type to be dumped |
579 | * display_type - 0 or ACPI_DISPLAY_SUMMARY | ||
560 | * max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX | 580 | * max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX |
561 | * for an effectively unlimited depth. | 581 | * for an effectively unlimited depth. |
562 | * owner_id - Dump only objects owned by this ID. Use | 582 | * owner_id - Dump only objects owned by this ID. Use |
563 | * ACPI_UINT32_MAX to match all owners. | 583 | * ACPI_UINT32_MAX to match all owners. |
564 | * start_handle - Where in namespace to start/end search | 584 | * start_handle - Where in namespace to start/end search |
565 | * | 585 | * |
586 | * RETURN: None | ||
587 | * | ||
566 | * DESCRIPTION: Dump typed objects within the loaded namespace. | 588 | * DESCRIPTION: Dump typed objects within the loaded namespace. |
567 | * Uses acpi_ns_walk_namespace in conjunction with acpi_ns_dump_one_object. | 589 | * Uses acpi_ns_walk_namespace in conjunction with acpi_ns_dump_one_object. |
568 | * | 590 | * |
@@ -590,10 +612,44 @@ acpi_ns_dump_objects ( | |||
590 | ACPI_NS_WALK_NO_UNLOCK, acpi_ns_dump_one_object, | 612 | ACPI_NS_WALK_NO_UNLOCK, acpi_ns_dump_one_object, |
591 | (void *) &info, NULL); | 613 | (void *) &info, NULL); |
592 | } | 614 | } |
615 | #endif /* ACPI_FUTURE_USAGE */ | ||
593 | 616 | ||
594 | 617 | ||
595 | /******************************************************************************* | 618 | /******************************************************************************* |
596 | * | 619 | * |
620 | * FUNCTION: acpi_ns_dump_entry | ||
621 | * | ||
622 | * PARAMETERS: Handle - Node to be dumped | ||
623 | * debug_level - Output level | ||
624 | * | ||
625 | * RETURN: None | ||
626 | * | ||
627 | * DESCRIPTION: Dump a single Node | ||
628 | * | ||
629 | ******************************************************************************/ | ||
630 | |||
631 | void | ||
632 | acpi_ns_dump_entry ( | ||
633 | acpi_handle handle, | ||
634 | u32 debug_level) | ||
635 | { | ||
636 | struct acpi_walk_info info; | ||
637 | |||
638 | |||
639 | ACPI_FUNCTION_ENTRY (); | ||
640 | |||
641 | |||
642 | info.debug_level = debug_level; | ||
643 | info.owner_id = ACPI_UINT32_MAX; | ||
644 | info.display_type = ACPI_DISPLAY_SUMMARY; | ||
645 | |||
646 | (void) acpi_ns_dump_one_object (handle, 1, &info, NULL); | ||
647 | } | ||
648 | |||
649 | |||
650 | #ifdef _ACPI_ASL_COMPILER | ||
651 | /******************************************************************************* | ||
652 | * | ||
597 | * FUNCTION: acpi_ns_dump_tables | 653 | * FUNCTION: acpi_ns_dump_tables |
598 | * | 654 | * |
599 | * PARAMETERS: search_base - Root of subtree to be dumped, or | 655 | * PARAMETERS: search_base - Root of subtree to be dumped, or |
@@ -601,6 +657,8 @@ acpi_ns_dump_objects ( | |||
601 | * max_depth - Maximum depth of dump. Use INT_MAX | 657 | * max_depth - Maximum depth of dump. Use INT_MAX |
602 | * for an effectively unlimited depth. | 658 | * for an effectively unlimited depth. |
603 | * | 659 | * |
660 | * RETURN: None | ||
661 | * | ||
604 | * DESCRIPTION: Dump the name space, or a portion of it. | 662 | * DESCRIPTION: Dump the name space, or a portion of it. |
605 | * | 663 | * |
606 | ******************************************************************************/ | 664 | ******************************************************************************/ |
@@ -626,7 +684,7 @@ acpi_ns_dump_tables ( | |||
626 | } | 684 | } |
627 | 685 | ||
628 | if (ACPI_NS_ALL == search_base) { | 686 | if (ACPI_NS_ALL == search_base) { |
629 | /* entire namespace */ | 687 | /* Entire namespace */ |
630 | 688 | ||
631 | search_handle = acpi_gbl_root_node; | 689 | search_handle = acpi_gbl_root_node; |
632 | ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n")); | 690 | ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n")); |
@@ -636,38 +694,5 @@ acpi_ns_dump_tables ( | |||
636 | ACPI_UINT32_MAX, search_handle); | 694 | ACPI_UINT32_MAX, search_handle); |
637 | return_VOID; | 695 | return_VOID; |
638 | } | 696 | } |
639 | 697 | #endif /* _ACPI_ASL_COMPILER */ | |
640 | #endif /* ACPI_FUTURE_USAGE */ | 698 | #endif /* defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) */ |
641 | |||
642 | |||
643 | /******************************************************************************* | ||
644 | * | ||
645 | * FUNCTION: acpi_ns_dump_entry | ||
646 | * | ||
647 | * PARAMETERS: Handle - Node to be dumped | ||
648 | * debug_level - Output level | ||
649 | * | ||
650 | * DESCRIPTION: Dump a single Node | ||
651 | * | ||
652 | ******************************************************************************/ | ||
653 | |||
654 | void | ||
655 | acpi_ns_dump_entry ( | ||
656 | acpi_handle handle, | ||
657 | u32 debug_level) | ||
658 | { | ||
659 | struct acpi_walk_info info; | ||
660 | |||
661 | |||
662 | ACPI_FUNCTION_ENTRY (); | ||
663 | |||
664 | |||
665 | info.debug_level = debug_level; | ||
666 | info.owner_id = ACPI_UINT32_MAX; | ||
667 | info.display_type = ACPI_DISPLAY_SUMMARY; | ||
668 | |||
669 | (void) acpi_ns_dump_one_object (handle, 1, &info, NULL); | ||
670 | } | ||
671 | |||
672 | #endif | ||
673 | |||
diff --git a/drivers/acpi/namespace/nsdumpdv.c b/drivers/acpi/namespace/nsdumpdv.c index d30a59e6b07d..27c4f7cd2a43 100644 --- a/drivers/acpi/namespace/nsdumpdv.c +++ b/drivers/acpi/namespace/nsdumpdv.c | |||
@@ -43,15 +43,18 @@ | |||
43 | 43 | ||
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acnamesp.h> | ||
47 | 46 | ||
48 | 47 | ||
48 | /* TBD: This entire module is apparently obsolete and should be removed */ | ||
49 | |||
49 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME ("nsdumpdv") | 51 | ACPI_MODULE_NAME ("nsdumpdv") |
51 | 52 | ||
52 | 53 | #ifdef ACPI_OBSOLETE_FUNCTIONS | |
53 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 54 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
54 | 55 | ||
56 | #include <acpi/acnamesp.h> | ||
57 | |||
55 | /******************************************************************************* | 58 | /******************************************************************************* |
56 | * | 59 | * |
57 | * FUNCTION: acpi_ns_dump_one_device | 60 | * FUNCTION: acpi_ns_dump_one_device |
@@ -59,13 +62,16 @@ | |||
59 | * PARAMETERS: Handle - Node to be dumped | 62 | * PARAMETERS: Handle - Node to be dumped |
60 | * Level - Nesting level of the handle | 63 | * Level - Nesting level of the handle |
61 | * Context - Passed into walk_namespace | 64 | * Context - Passed into walk_namespace |
65 | * return_value - Not used | ||
66 | * | ||
67 | * RETURN: Status | ||
62 | * | 68 | * |
63 | * DESCRIPTION: Dump a single Node that represents a device | 69 | * DESCRIPTION: Dump a single Node that represents a device |
64 | * This procedure is a user_function called by acpi_ns_walk_namespace. | 70 | * This procedure is a user_function called by acpi_ns_walk_namespace. |
65 | * | 71 | * |
66 | ******************************************************************************/ | 72 | ******************************************************************************/ |
67 | 73 | ||
68 | acpi_status | 74 | static acpi_status |
69 | acpi_ns_dump_one_device ( | 75 | acpi_ns_dump_one_device ( |
70 | acpi_handle obj_handle, | 76 | acpi_handle obj_handle, |
71 | u32 level, | 77 | u32 level, |
@@ -108,12 +114,15 @@ acpi_ns_dump_one_device ( | |||
108 | * | 114 | * |
109 | * PARAMETERS: None | 115 | * PARAMETERS: None |
110 | * | 116 | * |
117 | * RETURN: None | ||
118 | * | ||
111 | * DESCRIPTION: Dump all objects of type "device" | 119 | * DESCRIPTION: Dump all objects of type "device" |
112 | * | 120 | * |
113 | ******************************************************************************/ | 121 | ******************************************************************************/ |
114 | 122 | ||
115 | void | 123 | void |
116 | acpi_ns_dump_root_devices (void) | 124 | acpi_ns_dump_root_devices ( |
125 | void) | ||
117 | { | 126 | { |
118 | acpi_handle sys_bus_handle; | 127 | acpi_handle sys_bus_handle; |
119 | acpi_status status; | 128 | acpi_status status; |
@@ -142,5 +151,6 @@ acpi_ns_dump_root_devices (void) | |||
142 | } | 151 | } |
143 | 152 | ||
144 | #endif | 153 | #endif |
154 | #endif | ||
145 | 155 | ||
146 | 156 | ||
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index 0d008d53657e..1ae89a1c8826 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c | |||
@@ -52,19 +52,33 @@ | |||
52 | #define _COMPONENT ACPI_NAMESPACE | 52 | #define _COMPONENT ACPI_NAMESPACE |
53 | ACPI_MODULE_NAME ("nseval") | 53 | ACPI_MODULE_NAME ("nseval") |
54 | 54 | ||
55 | /* Local prototypes */ | ||
56 | |||
57 | static acpi_status | ||
58 | acpi_ns_execute_control_method ( | ||
59 | struct acpi_parameter_info *info); | ||
60 | |||
61 | static acpi_status | ||
62 | acpi_ns_get_object_value ( | ||
63 | struct acpi_parameter_info *info); | ||
64 | |||
55 | 65 | ||
56 | /******************************************************************************* | 66 | /******************************************************************************* |
57 | * | 67 | * |
58 | * FUNCTION: acpi_ns_evaluate_relative | 68 | * FUNCTION: acpi_ns_evaluate_relative |
59 | * | 69 | * |
60 | * PARAMETERS: Pathname - Name of method to execute, If NULL, the | 70 | * PARAMETERS: Pathname - Name of method to execute, If NULL, the |
61 | * handle is the object to execute | 71 | * handle is the object to execute |
62 | * Info - Method info block | 72 | * Info - Method info block, contains: |
73 | * return_object - Where to put method's return value (if | ||
74 | * any). If NULL, no value is returned. | ||
75 | * Params - List of parameters to pass to the method, | ||
76 | * terminated by NULL. Params itself may be | ||
77 | * NULL if no parameters are being passed. | ||
63 | * | 78 | * |
64 | * RETURN: Status | 79 | * RETURN: Status |
65 | * | 80 | * |
66 | * DESCRIPTION: Find and execute the requested method using the handle as a | 81 | * DESCRIPTION: Evaluate the object or find and execute the requested method |
67 | * scope | ||
68 | * | 82 | * |
69 | * MUTEX: Locks Namespace | 83 | * MUTEX: Locks Namespace |
70 | * | 84 | * |
@@ -157,8 +171,8 @@ cleanup1: | |||
157 | * | 171 | * |
158 | * FUNCTION: acpi_ns_evaluate_by_name | 172 | * FUNCTION: acpi_ns_evaluate_by_name |
159 | * | 173 | * |
160 | * PARAMETERS: Pathname - Fully qualified pathname to the object | 174 | * PARAMETERS: Pathname - Fully qualified pathname to the object |
161 | * Info - Contains: | 175 | * Info - Method info block, contains: |
162 | * return_object - Where to put method's return value (if | 176 | * return_object - Where to put method's return value (if |
163 | * any). If NULL, no value is returned. | 177 | * any). If NULL, no value is returned. |
164 | * Params - List of parameters to pass to the method, | 178 | * Params - List of parameters to pass to the method, |
@@ -167,8 +181,8 @@ cleanup1: | |||
167 | * | 181 | * |
168 | * RETURN: Status | 182 | * RETURN: Status |
169 | * | 183 | * |
170 | * DESCRIPTION: Find and execute the requested method passing the given | 184 | * DESCRIPTION: Evaluate the object or rind and execute the requested method |
171 | * parameters | 185 | * passing the given parameters |
172 | * | 186 | * |
173 | * MUTEX: Locks Namespace | 187 | * MUTEX: Locks Namespace |
174 | * | 188 | * |
@@ -241,17 +255,21 @@ cleanup: | |||
241 | * | 255 | * |
242 | * FUNCTION: acpi_ns_evaluate_by_handle | 256 | * FUNCTION: acpi_ns_evaluate_by_handle |
243 | * | 257 | * |
244 | * PARAMETERS: Handle - Method Node to execute | 258 | * PARAMETERS: Info - Method info block, contains: |
245 | * Params - List of parameters to pass to the method, | 259 | * Node - Method/Object Node to execute |
246 | * terminated by NULL. Params itself may be | 260 | * Parameters - List of parameters to pass to the method, |
261 | * terminated by NULL. Params itself may be | ||
247 | * NULL if no parameters are being passed. | 262 | * NULL if no parameters are being passed. |
248 | * param_type - Type of Parameter list | 263 | * return_object - Where to put method's return value (if |
249 | * return_object - Where to put method's return value (if | 264 | * any). If NULL, no value is returned. |
250 | * any). If NULL, no value is returned. | 265 | * parameter_type - Type of Parameter list |
266 | * return_object - Where to put method's return value (if | ||
267 | * any). If NULL, no value is returned. | ||
251 | * | 268 | * |
252 | * RETURN: Status | 269 | * RETURN: Status |
253 | * | 270 | * |
254 | * DESCRIPTION: Execute the requested method passing the given parameters | 271 | * DESCRIPTION: Evaluate object or execute the requested method passing the |
272 | * given parameters | ||
255 | * | 273 | * |
256 | * MUTEX: Locks Namespace | 274 | * MUTEX: Locks Namespace |
257 | * | 275 | * |
@@ -345,7 +363,16 @@ acpi_ns_evaluate_by_handle ( | |||
345 | * | 363 | * |
346 | * FUNCTION: acpi_ns_execute_control_method | 364 | * FUNCTION: acpi_ns_execute_control_method |
347 | * | 365 | * |
348 | * PARAMETERS: Info - Method info block (w/params) | 366 | * PARAMETERS: Info - Method info block, contains: |
367 | * Node - Method Node to execute | ||
368 | * Parameters - List of parameters to pass to the method, | ||
369 | * terminated by NULL. Params itself may be | ||
370 | * NULL if no parameters are being passed. | ||
371 | * return_object - Where to put method's return value (if | ||
372 | * any). If NULL, no value is returned. | ||
373 | * parameter_type - Type of Parameter list | ||
374 | * return_object - Where to put method's return value (if | ||
375 | * any). If NULL, no value is returned. | ||
349 | * | 376 | * |
350 | * RETURN: Status | 377 | * RETURN: Status |
351 | * | 378 | * |
@@ -355,7 +382,7 @@ acpi_ns_evaluate_by_handle ( | |||
355 | * | 382 | * |
356 | ******************************************************************************/ | 383 | ******************************************************************************/ |
357 | 384 | ||
358 | acpi_status | 385 | static acpi_status |
359 | acpi_ns_execute_control_method ( | 386 | acpi_ns_execute_control_method ( |
360 | struct acpi_parameter_info *info) | 387 | struct acpi_parameter_info *info) |
361 | { | 388 | { |
@@ -414,7 +441,10 @@ acpi_ns_execute_control_method ( | |||
414 | * | 441 | * |
415 | * FUNCTION: acpi_ns_get_object_value | 442 | * FUNCTION: acpi_ns_get_object_value |
416 | * | 443 | * |
417 | * PARAMETERS: Info - Method info block (w/params) | 444 | * PARAMETERS: Info - Method info block, contains: |
445 | * Node - Object's NS node | ||
446 | * return_object - Where to put object value (if | ||
447 | * any). If NULL, no value is returned. | ||
418 | * | 448 | * |
419 | * RETURN: Status | 449 | * RETURN: Status |
420 | * | 450 | * |
@@ -424,7 +454,7 @@ acpi_ns_execute_control_method ( | |||
424 | * | 454 | * |
425 | ******************************************************************************/ | 455 | ******************************************************************************/ |
426 | 456 | ||
427 | acpi_status | 457 | static acpi_status |
428 | acpi_ns_get_object_value ( | 458 | acpi_ns_get_object_value ( |
429 | struct acpi_parameter_info *info) | 459 | struct acpi_parameter_info *info) |
430 | { | 460 | { |
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index 4a46b380605b..362802ae29a2 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c | |||
@@ -50,6 +50,22 @@ | |||
50 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME ("nsinit") | 51 | ACPI_MODULE_NAME ("nsinit") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
54 | |||
55 | static acpi_status | ||
56 | acpi_ns_init_one_object ( | ||
57 | acpi_handle obj_handle, | ||
58 | u32 level, | ||
59 | void *context, | ||
60 | void **return_value); | ||
61 | |||
62 | static acpi_status | ||
63 | acpi_ns_init_one_device ( | ||
64 | acpi_handle obj_handle, | ||
65 | u32 nesting_level, | ||
66 | void *context, | ||
67 | void **return_value); | ||
68 | |||
53 | 69 | ||
54 | /******************************************************************************* | 70 | /******************************************************************************* |
55 | * | 71 | * |
@@ -191,7 +207,7 @@ acpi_ns_initialize_devices ( | |||
191 | * | 207 | * |
192 | ******************************************************************************/ | 208 | ******************************************************************************/ |
193 | 209 | ||
194 | acpi_status | 210 | static acpi_status |
195 | acpi_ns_init_one_object ( | 211 | acpi_ns_init_one_object ( |
196 | acpi_handle obj_handle, | 212 | acpi_handle obj_handle, |
197 | u32 level, | 213 | u32 level, |
@@ -331,7 +347,7 @@ acpi_ns_init_one_object ( | |||
331 | * | 347 | * |
332 | ******************************************************************************/ | 348 | ******************************************************************************/ |
333 | 349 | ||
334 | acpi_status | 350 | static acpi_status |
335 | acpi_ns_init_one_device ( | 351 | acpi_ns_init_one_device ( |
336 | acpi_handle obj_handle, | 352 | acpi_handle obj_handle, |
337 | u32 nesting_level, | 353 | u32 nesting_level, |
@@ -374,7 +390,8 @@ acpi_ns_init_one_device ( | |||
374 | /* | 390 | /* |
375 | * Run _STA to determine if we can run _INI on the device. | 391 | * Run _STA to determine if we can run _INI on the device. |
376 | */ | 392 | */ |
377 | ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD, pinfo.node, "_STA")); | 393 | ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD, |
394 | pinfo.node, METHOD_NAME__STA)); | ||
378 | status = acpi_ut_execute_STA (pinfo.node, &flags); | 395 | status = acpi_ut_execute_STA (pinfo.node, &flags); |
379 | 396 | ||
380 | if (ACPI_FAILURE (status)) { | 397 | if (ACPI_FAILURE (status)) { |
@@ -399,8 +416,9 @@ acpi_ns_init_one_device ( | |||
399 | /* | 416 | /* |
400 | * The device is present. Run _INI. | 417 | * The device is present. Run _INI. |
401 | */ | 418 | */ |
402 | ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD, pinfo.node, "_INI")); | 419 | ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD, |
403 | status = acpi_ns_evaluate_relative ("_INI", &pinfo); | 420 | pinfo.node, METHOD_NAME__INI)); |
421 | status = acpi_ns_evaluate_relative (METHOD_NAME__INI, &pinfo); | ||
404 | if (ACPI_FAILURE (status)) { | 422 | if (ACPI_FAILURE (status)) { |
405 | /* No _INI (AE_NOT_FOUND) means device requires no initialization */ | 423 | /* No _INI (AE_NOT_FOUND) means device requires no initialization */ |
406 | 424 | ||
diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c index 1d7aedf68a77..34e497016601 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/namespace/nsload.c | |||
@@ -50,9 +50,24 @@ | |||
50 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME ("nsload") | 51 | ACPI_MODULE_NAME ("nsload") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
53 | 54 | ||
54 | #ifndef ACPI_NO_METHOD_EXECUTION | 55 | static acpi_status |
56 | acpi_ns_load_table_by_type ( | ||
57 | acpi_table_type table_type); | ||
58 | |||
59 | #ifdef ACPI_FUTURE_IMPLEMENTATION | ||
60 | acpi_status | ||
61 | acpi_ns_unload_namespace ( | ||
62 | acpi_handle handle); | ||
63 | |||
64 | static acpi_status | ||
65 | acpi_ns_delete_subtree ( | ||
66 | acpi_handle start_handle); | ||
67 | #endif | ||
55 | 68 | ||
69 | |||
70 | #ifndef ACPI_NO_METHOD_EXECUTION | ||
56 | /******************************************************************************* | 71 | /******************************************************************************* |
57 | * | 72 | * |
58 | * FUNCTION: acpi_ns_load_table | 73 | * FUNCTION: acpi_ns_load_table |
@@ -159,7 +174,7 @@ acpi_ns_load_table ( | |||
159 | * | 174 | * |
160 | ******************************************************************************/ | 175 | ******************************************************************************/ |
161 | 176 | ||
162 | acpi_status | 177 | static acpi_status |
163 | acpi_ns_load_table_by_type ( | 178 | acpi_ns_load_table_by_type ( |
164 | acpi_table_type table_type) | 179 | acpi_table_type table_type) |
165 | { | 180 | { |
@@ -321,8 +336,7 @@ acpi_ns_load_namespace ( | |||
321 | } | 336 | } |
322 | 337 | ||
323 | 338 | ||
324 | #ifdef ACPI_FUTURE_USAGE | 339 | #ifdef ACPI_FUTURE_IMPLEMENTATION |
325 | |||
326 | /******************************************************************************* | 340 | /******************************************************************************* |
327 | * | 341 | * |
328 | * FUNCTION: acpi_ns_delete_subtree | 342 | * FUNCTION: acpi_ns_delete_subtree |
@@ -339,7 +353,7 @@ acpi_ns_load_namespace ( | |||
339 | * | 353 | * |
340 | ******************************************************************************/ | 354 | ******************************************************************************/ |
341 | 355 | ||
342 | acpi_status | 356 | static acpi_status |
343 | acpi_ns_delete_subtree ( | 357 | acpi_ns_delete_subtree ( |
344 | acpi_handle start_handle) | 358 | acpi_handle start_handle) |
345 | { | 359 | { |
@@ -453,8 +467,6 @@ acpi_ns_unload_namespace ( | |||
453 | 467 | ||
454 | return_ACPI_STATUS (status); | 468 | return_ACPI_STATUS (status); |
455 | } | 469 | } |
456 | 470 | #endif | |
457 | #endif /* ACPI_FUTURE_USAGE */ | ||
458 | |||
459 | #endif | 471 | #endif |
460 | 472 | ||
diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index b6f8f910eff0..d8ce7e39795f 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c | |||
@@ -50,6 +50,14 @@ | |||
50 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME ("nsnames") | 51 | ACPI_MODULE_NAME ("nsnames") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
54 | |||
55 | static void | ||
56 | acpi_ns_build_external_path ( | ||
57 | struct acpi_namespace_node *node, | ||
58 | acpi_size size, | ||
59 | char *name_buffer); | ||
60 | |||
53 | 61 | ||
54 | /******************************************************************************* | 62 | /******************************************************************************* |
55 | * | 63 | * |
@@ -66,7 +74,7 @@ | |||
66 | * | 74 | * |
67 | ******************************************************************************/ | 75 | ******************************************************************************/ |
68 | 76 | ||
69 | void | 77 | static void |
70 | acpi_ns_build_external_path ( | 78 | acpi_ns_build_external_path ( |
71 | struct acpi_namespace_node *node, | 79 | struct acpi_namespace_node *node, |
72 | acpi_size size, | 80 | acpi_size size, |
@@ -126,7 +134,7 @@ acpi_ns_build_external_path ( | |||
126 | * | 134 | * |
127 | * FUNCTION: acpi_ns_get_external_pathname | 135 | * FUNCTION: acpi_ns_get_external_pathname |
128 | * | 136 | * |
129 | * PARAMETERS: Node - NS node whose pathname is needed | 137 | * PARAMETERS: Node - Namespace node whose pathname is needed |
130 | * | 138 | * |
131 | * RETURN: Pointer to storage containing the fully qualified name of | 139 | * RETURN: Pointer to storage containing the fully qualified name of |
132 | * the node, In external format (name segments separated by path | 140 | * the node, In external format (name segments separated by path |
diff --git a/drivers/acpi/namespace/nsobject.c b/drivers/acpi/namespace/nsobject.c index 4e41e66db61f..27258c1ca4f1 100644 --- a/drivers/acpi/namespace/nsobject.c +++ b/drivers/acpi/namespace/nsobject.c | |||
@@ -60,6 +60,8 @@ | |||
60 | * Type - Type of object, or ACPI_TYPE_ANY if not | 60 | * Type - Type of object, or ACPI_TYPE_ANY if not |
61 | * known | 61 | * known |
62 | * | 62 | * |
63 | * RETURN: Status | ||
64 | * | ||
63 | * DESCRIPTION: Record the given object as the value associated with the | 65 | * DESCRIPTION: Record the given object as the value associated with the |
64 | * name whose acpi_handle is passed. If Object is NULL | 66 | * name whose acpi_handle is passed. If Object is NULL |
65 | * and Type is ACPI_TYPE_ANY, set the name as having no value. | 67 | * and Type is ACPI_TYPE_ANY, set the name as having no value. |
@@ -97,7 +99,8 @@ acpi_ns_attach_object ( | |||
97 | if (!object && (ACPI_TYPE_ANY != type)) { | 99 | if (!object && (ACPI_TYPE_ANY != type)) { |
98 | /* Null object */ | 100 | /* Null object */ |
99 | 101 | ||
100 | ACPI_REPORT_ERROR (("ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n")); | 102 | ACPI_REPORT_ERROR (( |
103 | "ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n")); | ||
101 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 104 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
102 | } | 105 | } |
103 | 106 | ||
@@ -112,7 +115,8 @@ acpi_ns_attach_object ( | |||
112 | /* Check if this object is already attached */ | 115 | /* Check if this object is already attached */ |
113 | 116 | ||
114 | if (node->object == object) { | 117 | if (node->object == object) { |
115 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj %p already installed in name_obj %p\n", | 118 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
119 | "Obj %p already installed in name_obj %p\n", | ||
116 | object, node)); | 120 | object, node)); |
117 | 121 | ||
118 | return_ACPI_STATUS (AE_OK); | 122 | return_ACPI_STATUS (AE_OK); |
@@ -192,7 +196,7 @@ acpi_ns_attach_object ( | |||
192 | * | 196 | * |
193 | * FUNCTION: acpi_ns_detach_object | 197 | * FUNCTION: acpi_ns_detach_object |
194 | * | 198 | * |
195 | * PARAMETERS: Node - An node whose object will be detached | 199 | * PARAMETERS: Node - A Namespace node whose object will be detached |
196 | * | 200 | * |
197 | * RETURN: None. | 201 | * RETURN: None. |
198 | * | 202 | * |
@@ -248,7 +252,7 @@ acpi_ns_detach_object ( | |||
248 | * | 252 | * |
249 | * FUNCTION: acpi_ns_get_attached_object | 253 | * FUNCTION: acpi_ns_get_attached_object |
250 | * | 254 | * |
251 | * PARAMETERS: Node - Parent Node to be examined | 255 | * PARAMETERS: Node - Namespace node |
252 | * | 256 | * |
253 | * RETURN: Current value of the object field from the Node whose | 257 | * RETURN: Current value of the object field from the Node whose |
254 | * handle is passed | 258 | * handle is passed |
@@ -284,7 +288,7 @@ acpi_ns_get_attached_object ( | |||
284 | * | 288 | * |
285 | * FUNCTION: acpi_ns_get_secondary_object | 289 | * FUNCTION: acpi_ns_get_secondary_object |
286 | * | 290 | * |
287 | * PARAMETERS: Node - Parent Node to be examined | 291 | * PARAMETERS: Node - Namespace node |
288 | * | 292 | * |
289 | * RETURN: Current value of the object field from the Node whose | 293 | * RETURN: Current value of the object field from the Node whose |
290 | * handle is passed. | 294 | * handle is passed. |
diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index 0e6dea23603b..af8aaa9cc4f3 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/namespace/nssearch.c | |||
@@ -49,15 +49,24 @@ | |||
49 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME ("nssearch") | 50 | ACPI_MODULE_NAME ("nssearch") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static acpi_status | ||
55 | acpi_ns_search_parent_tree ( | ||
56 | u32 target_name, | ||
57 | struct acpi_namespace_node *node, | ||
58 | acpi_object_type type, | ||
59 | struct acpi_namespace_node **return_node); | ||
60 | |||
52 | 61 | ||
53 | /******************************************************************************* | 62 | /******************************************************************************* |
54 | * | 63 | * |
55 | * FUNCTION: acpi_ns_search_node | 64 | * FUNCTION: acpi_ns_search_node |
56 | * | 65 | * |
57 | * PARAMETERS: *target_name - Ascii ACPI name to search for | 66 | * PARAMETERS: target_name - Ascii ACPI name to search for |
58 | * *Node - Starting node where search will begin | 67 | * Node - Starting node where search will begin |
59 | * Type - Object type to match | 68 | * Type - Object type to match |
60 | * **return_node - Where the matched Named obj is returned | 69 | * return_node - Where the matched Named obj is returned |
61 | * | 70 | * |
62 | * RETURN: Status | 71 | * RETURN: Status |
63 | * | 72 | * |
@@ -163,10 +172,10 @@ acpi_ns_search_node ( | |||
163 | * | 172 | * |
164 | * FUNCTION: acpi_ns_search_parent_tree | 173 | * FUNCTION: acpi_ns_search_parent_tree |
165 | * | 174 | * |
166 | * PARAMETERS: *target_name - Ascii ACPI name to search for | 175 | * PARAMETERS: target_name - Ascii ACPI name to search for |
167 | * *Node - Starting node where search will begin | 176 | * Node - Starting node where search will begin |
168 | * Type - Object type to match | 177 | * Type - Object type to match |
169 | * **return_node - Where the matched Node is returned | 178 | * return_node - Where the matched Node is returned |
170 | * | 179 | * |
171 | * RETURN: Status | 180 | * RETURN: Status |
172 | * | 181 | * |
@@ -257,12 +266,12 @@ acpi_ns_search_parent_tree ( | |||
257 | * | 266 | * |
258 | * PARAMETERS: target_name - Ascii ACPI name to search for (4 chars) | 267 | * PARAMETERS: target_name - Ascii ACPI name to search for (4 chars) |
259 | * walk_state - Current state of the walk | 268 | * walk_state - Current state of the walk |
260 | * *Node - Starting node where search will begin | 269 | * Node - Starting node where search will begin |
261 | * interpreter_mode - Add names only in ACPI_MODE_LOAD_PASS_x. | 270 | * interpreter_mode - Add names only in ACPI_MODE_LOAD_PASS_x. |
262 | * Otherwise,search only. | 271 | * Otherwise,search only. |
263 | * Type - Object type to match | 272 | * Type - Object type to match |
264 | * Flags - Flags describing the search restrictions | 273 | * Flags - Flags describing the search restrictions |
265 | * **return_node - Where the Node is returned | 274 | * return_node - Where the Node is returned |
266 | * | 275 | * |
267 | * RETURN: Status | 276 | * RETURN: Status |
268 | * | 277 | * |
diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index 75da76cc0b19..c53b82e94ce3 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c | |||
@@ -51,6 +51,18 @@ | |||
51 | #define _COMPONENT ACPI_NAMESPACE | 51 | #define _COMPONENT ACPI_NAMESPACE |
52 | ACPI_MODULE_NAME ("nsutils") | 52 | ACPI_MODULE_NAME ("nsutils") |
53 | 53 | ||
54 | /* Local prototypes */ | ||
55 | |||
56 | static u8 | ||
57 | acpi_ns_valid_path_separator ( | ||
58 | char sep); | ||
59 | |||
60 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
61 | acpi_name | ||
62 | acpi_ns_find_parent_name ( | ||
63 | struct acpi_namespace_node *node_to_search); | ||
64 | #endif | ||
65 | |||
54 | 66 | ||
55 | /******************************************************************************* | 67 | /******************************************************************************* |
56 | * | 68 | * |
@@ -59,7 +71,8 @@ | |||
59 | * PARAMETERS: module_name - Caller's module name (for error output) | 71 | * PARAMETERS: module_name - Caller's module name (for error output) |
60 | * line_number - Caller's line number (for error output) | 72 | * line_number - Caller's line number (for error output) |
61 | * component_id - Caller's component ID (for error output) | 73 | * component_id - Caller's component ID (for error output) |
62 | * Message - Error message to use on failure | 74 | * internal_name - Name or path of the namespace node |
75 | * lookup_status - Exception code from NS lookup | ||
63 | * | 76 | * |
64 | * RETURN: None | 77 | * RETURN: None |
65 | * | 78 | * |
@@ -121,6 +134,9 @@ acpi_ns_report_error ( | |||
121 | * line_number - Caller's line number (for error output) | 134 | * line_number - Caller's line number (for error output) |
122 | * component_id - Caller's component ID (for error output) | 135 | * component_id - Caller's component ID (for error output) |
123 | * Message - Error message to use on failure | 136 | * Message - Error message to use on failure |
137 | * prefix_node - Prefix relative to the path | ||
138 | * Path - Path to the node | ||
139 | * method_status - Execution status | ||
124 | * | 140 | * |
125 | * RETURN: None | 141 | * RETURN: None |
126 | * | 142 | * |
@@ -161,8 +177,8 @@ acpi_ns_report_method_error ( | |||
161 | * | 177 | * |
162 | * FUNCTION: acpi_ns_print_node_pathname | 178 | * FUNCTION: acpi_ns_print_node_pathname |
163 | * | 179 | * |
164 | * PARAMETERS: Node - Object | 180 | * PARAMETERS: Node - Object |
165 | * Msg - Prefix message | 181 | * Message - Prefix message |
166 | * | 182 | * |
167 | * DESCRIPTION: Print an object's full namespace pathname | 183 | * DESCRIPTION: Print an object's full namespace pathname |
168 | * Manages allocation/freeing of a pathname buffer | 184 | * Manages allocation/freeing of a pathname buffer |
@@ -172,7 +188,7 @@ acpi_ns_report_method_error ( | |||
172 | void | 188 | void |
173 | acpi_ns_print_node_pathname ( | 189 | acpi_ns_print_node_pathname ( |
174 | struct acpi_namespace_node *node, | 190 | struct acpi_namespace_node *node, |
175 | char *msg) | 191 | char *message) |
176 | { | 192 | { |
177 | struct acpi_buffer buffer; | 193 | struct acpi_buffer buffer; |
178 | acpi_status status; | 194 | acpi_status status; |
@@ -189,8 +205,8 @@ acpi_ns_print_node_pathname ( | |||
189 | 205 | ||
190 | status = acpi_ns_handle_to_pathname (node, &buffer); | 206 | status = acpi_ns_handle_to_pathname (node, &buffer); |
191 | if (ACPI_SUCCESS (status)) { | 207 | if (ACPI_SUCCESS (status)) { |
192 | if (msg) { | 208 | if (message) { |
193 | acpi_os_printf ("%s ", msg); | 209 | acpi_os_printf ("%s ", message); |
194 | } | 210 | } |
195 | 211 | ||
196 | acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node); | 212 | acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node); |
@@ -224,7 +240,7 @@ acpi_ns_valid_root_prefix ( | |||
224 | * | 240 | * |
225 | * FUNCTION: acpi_ns_valid_path_separator | 241 | * FUNCTION: acpi_ns_valid_path_separator |
226 | * | 242 | * |
227 | * PARAMETERS: Sep - Character to be checked | 243 | * PARAMETERS: Sep - Character to be checked |
228 | * | 244 | * |
229 | * RETURN: TRUE if a valid path separator | 245 | * RETURN: TRUE if a valid path separator |
230 | * | 246 | * |
@@ -232,7 +248,7 @@ acpi_ns_valid_root_prefix ( | |||
232 | * | 248 | * |
233 | ******************************************************************************/ | 249 | ******************************************************************************/ |
234 | 250 | ||
235 | u8 | 251 | static u8 |
236 | acpi_ns_valid_path_separator ( | 252 | acpi_ns_valid_path_separator ( |
237 | char sep) | 253 | char sep) |
238 | { | 254 | { |
@@ -245,10 +261,12 @@ acpi_ns_valid_path_separator ( | |||
245 | * | 261 | * |
246 | * FUNCTION: acpi_ns_get_type | 262 | * FUNCTION: acpi_ns_get_type |
247 | * | 263 | * |
248 | * PARAMETERS: Handle - Parent Node to be examined | 264 | * PARAMETERS: Node - Parent Node to be examined |
249 | * | 265 | * |
250 | * RETURN: Type field from Node whose handle is passed | 266 | * RETURN: Type field from Node whose handle is passed |
251 | * | 267 | * |
268 | * DESCRIPTION: Return the type of a Namespace node | ||
269 | * | ||
252 | ******************************************************************************/ | 270 | ******************************************************************************/ |
253 | 271 | ||
254 | acpi_object_type | 272 | acpi_object_type |
@@ -271,11 +289,13 @@ acpi_ns_get_type ( | |||
271 | * | 289 | * |
272 | * FUNCTION: acpi_ns_local | 290 | * FUNCTION: acpi_ns_local |
273 | * | 291 | * |
274 | * PARAMETERS: Type - A namespace object type | 292 | * PARAMETERS: Type - A namespace object type |
275 | * | 293 | * |
276 | * RETURN: LOCAL if names must be found locally in objects of the | 294 | * RETURN: LOCAL if names must be found locally in objects of the |
277 | * passed type, 0 if enclosing scopes should be searched | 295 | * passed type, 0 if enclosing scopes should be searched |
278 | * | 296 | * |
297 | * DESCRIPTION: Returns scope rule for the given object type. | ||
298 | * | ||
279 | ******************************************************************************/ | 299 | ******************************************************************************/ |
280 | 300 | ||
281 | u32 | 301 | u32 |
@@ -303,7 +323,7 @@ acpi_ns_local ( | |||
303 | * PARAMETERS: Info - Info struct initialized with the | 323 | * PARAMETERS: Info - Info struct initialized with the |
304 | * external name pointer. | 324 | * external name pointer. |
305 | * | 325 | * |
306 | * RETURN: Status | 326 | * RETURN: None |
307 | * | 327 | * |
308 | * DESCRIPTION: Calculate the length of the internal (AML) namestring | 328 | * DESCRIPTION: Calculate the length of the internal (AML) namestring |
309 | * corresponding to the external (ASL) namestring. | 329 | * corresponding to the external (ASL) namestring. |
@@ -551,14 +571,16 @@ acpi_ns_internalize_name ( | |||
551 | * | 571 | * |
552 | * FUNCTION: acpi_ns_externalize_name | 572 | * FUNCTION: acpi_ns_externalize_name |
553 | * | 573 | * |
554 | * PARAMETERS: *internal_name - Internal representation of name | 574 | * PARAMETERS: internal_name_length - Lenth of the internal name below |
555 | * **converted_name - Where to return the resulting | 575 | * internal_name - Internal representation of name |
556 | * external representation of name | 576 | * converted_name_length - Where the length is returned |
577 | * converted_name - Where the resulting external name | ||
578 | * is returned | ||
557 | * | 579 | * |
558 | * RETURN: Status | 580 | * RETURN: Status |
559 | * | 581 | * |
560 | * DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30) | 582 | * DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30) |
561 | * to its external form (e.g. "\_PR_.CPU0") | 583 | * to its external (printable) form (e.g. "\_PR_.CPU0") |
562 | * | 584 | * |
563 | ******************************************************************************/ | 585 | ******************************************************************************/ |
564 | 586 | ||
@@ -717,8 +739,9 @@ acpi_ns_externalize_name ( | |||
717 | * | 739 | * |
718 | * DESCRIPTION: Convert a namespace handle to a real Node | 740 | * DESCRIPTION: Convert a namespace handle to a real Node |
719 | * | 741 | * |
720 | * Note: Real integer handles allow for more verification | 742 | * Note: Real integer handles would allow for more verification |
721 | * and keep all pointers within this subsystem. | 743 | * and keep all pointers within this subsystem - however this introduces |
744 | * more (and perhaps unnecessary) overhead. | ||
722 | * | 745 | * |
723 | ******************************************************************************/ | 746 | ******************************************************************************/ |
724 | 747 | ||
@@ -775,7 +798,7 @@ acpi_ns_convert_entry_to_handle ( | |||
775 | return ((acpi_handle) node); | 798 | return ((acpi_handle) node); |
776 | 799 | ||
777 | 800 | ||
778 | /* --------------------------------------------------- | 801 | /* Example future implementation --------------------- |
779 | 802 | ||
780 | if (!Node) | 803 | if (!Node) |
781 | { | 804 | { |
@@ -801,12 +824,13 @@ acpi_ns_convert_entry_to_handle ( | |||
801 | * | 824 | * |
802 | * RETURN: none | 825 | * RETURN: none |
803 | * | 826 | * |
804 | * DESCRIPTION: free memory allocated for table storage. | 827 | * DESCRIPTION: free memory allocated for namespace and ACPI table storage. |
805 | * | 828 | * |
806 | ******************************************************************************/ | 829 | ******************************************************************************/ |
807 | 830 | ||
808 | void | 831 | void |
809 | acpi_ns_terminate (void) | 832 | acpi_ns_terminate ( |
833 | void) | ||
810 | { | 834 | { |
811 | union acpi_operand_object *obj_desc; | 835 | union acpi_operand_object *obj_desc; |
812 | 836 | ||
@@ -940,7 +964,6 @@ acpi_ns_get_node_by_path ( | |||
940 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 964 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); |
941 | 965 | ||
942 | cleanup: | 966 | cleanup: |
943 | /* Cleanup */ | ||
944 | if (internal_path) { | 967 | if (internal_path) { |
945 | ACPI_MEM_FREE (internal_path); | 968 | ACPI_MEM_FREE (internal_path); |
946 | } | 969 | } |
@@ -950,55 +973,6 @@ cleanup: | |||
950 | 973 | ||
951 | /******************************************************************************* | 974 | /******************************************************************************* |
952 | * | 975 | * |
953 | * FUNCTION: acpi_ns_find_parent_name | ||
954 | * | ||
955 | * PARAMETERS: *child_node - Named Obj whose name is to be found | ||
956 | * | ||
957 | * RETURN: The ACPI name | ||
958 | * | ||
959 | * DESCRIPTION: Search for the given obj in its parent scope and return the | ||
960 | * name segment, or "????" if the parent name can't be found | ||
961 | * (which "should not happen"). | ||
962 | * | ||
963 | ******************************************************************************/ | ||
964 | #ifdef ACPI_FUTURE_USAGE | ||
965 | acpi_name | ||
966 | acpi_ns_find_parent_name ( | ||
967 | struct acpi_namespace_node *child_node) | ||
968 | { | ||
969 | struct acpi_namespace_node *parent_node; | ||
970 | |||
971 | |||
972 | ACPI_FUNCTION_TRACE ("ns_find_parent_name"); | ||
973 | |||
974 | |||
975 | if (child_node) { | ||
976 | /* Valid entry. Get the parent Node */ | ||
977 | |||
978 | parent_node = acpi_ns_get_parent_node (child_node); | ||
979 | if (parent_node) { | ||
980 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | ||
981 | "Parent of %p [%4.4s] is %p [%4.4s]\n", | ||
982 | child_node, acpi_ut_get_node_name (child_node), | ||
983 | parent_node, acpi_ut_get_node_name (parent_node))); | ||
984 | |||
985 | if (parent_node->name.integer) { | ||
986 | return_VALUE ((acpi_name) parent_node->name.integer); | ||
987 | } | ||
988 | } | ||
989 | |||
990 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | ||
991 | "Unable to find parent of %p (%4.4s)\n", | ||
992 | child_node, acpi_ut_get_node_name (child_node))); | ||
993 | } | ||
994 | |||
995 | return_VALUE (ACPI_UNKNOWN_NAME); | ||
996 | } | ||
997 | #endif | ||
998 | |||
999 | |||
1000 | /******************************************************************************* | ||
1001 | * | ||
1002 | * FUNCTION: acpi_ns_get_parent_node | 976 | * FUNCTION: acpi_ns_get_parent_node |
1003 | * | 977 | * |
1004 | * PARAMETERS: Node - Current table entry | 978 | * PARAMETERS: Node - Current table entry |
@@ -1009,7 +983,6 @@ acpi_ns_find_parent_name ( | |||
1009 | * | 983 | * |
1010 | ******************************************************************************/ | 984 | ******************************************************************************/ |
1011 | 985 | ||
1012 | |||
1013 | struct acpi_namespace_node * | 986 | struct acpi_namespace_node * |
1014 | acpi_ns_get_parent_node ( | 987 | acpi_ns_get_parent_node ( |
1015 | struct acpi_namespace_node *node) | 988 | struct acpi_namespace_node *node) |
@@ -1030,7 +1003,6 @@ acpi_ns_get_parent_node ( | |||
1030 | node = node->peer; | 1003 | node = node->peer; |
1031 | } | 1004 | } |
1032 | 1005 | ||
1033 | |||
1034 | return (node->peer); | 1006 | return (node->peer); |
1035 | } | 1007 | } |
1036 | 1008 | ||
@@ -1049,7 +1021,6 @@ acpi_ns_get_parent_node ( | |||
1049 | * | 1021 | * |
1050 | ******************************************************************************/ | 1022 | ******************************************************************************/ |
1051 | 1023 | ||
1052 | |||
1053 | struct acpi_namespace_node * | 1024 | struct acpi_namespace_node * |
1054 | acpi_ns_get_next_valid_node ( | 1025 | acpi_ns_get_next_valid_node ( |
1055 | struct acpi_namespace_node *node) | 1026 | struct acpi_namespace_node *node) |
@@ -1067,3 +1038,53 @@ acpi_ns_get_next_valid_node ( | |||
1067 | } | 1038 | } |
1068 | 1039 | ||
1069 | 1040 | ||
1041 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
1042 | /******************************************************************************* | ||
1043 | * | ||
1044 | * FUNCTION: acpi_ns_find_parent_name | ||
1045 | * | ||
1046 | * PARAMETERS: *child_node - Named Obj whose name is to be found | ||
1047 | * | ||
1048 | * RETURN: The ACPI name | ||
1049 | * | ||
1050 | * DESCRIPTION: Search for the given obj in its parent scope and return the | ||
1051 | * name segment, or "????" if the parent name can't be found | ||
1052 | * (which "should not happen"). | ||
1053 | * | ||
1054 | ******************************************************************************/ | ||
1055 | |||
1056 | acpi_name | ||
1057 | acpi_ns_find_parent_name ( | ||
1058 | struct acpi_namespace_node *child_node) | ||
1059 | { | ||
1060 | struct acpi_namespace_node *parent_node; | ||
1061 | |||
1062 | |||
1063 | ACPI_FUNCTION_TRACE ("ns_find_parent_name"); | ||
1064 | |||
1065 | |||
1066 | if (child_node) { | ||
1067 | /* Valid entry. Get the parent Node */ | ||
1068 | |||
1069 | parent_node = acpi_ns_get_parent_node (child_node); | ||
1070 | if (parent_node) { | ||
1071 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | ||
1072 | "Parent of %p [%4.4s] is %p [%4.4s]\n", | ||
1073 | child_node, acpi_ut_get_node_name (child_node), | ||
1074 | parent_node, acpi_ut_get_node_name (parent_node))); | ||
1075 | |||
1076 | if (parent_node->name.integer) { | ||
1077 | return_VALUE ((acpi_name) parent_node->name.integer); | ||
1078 | } | ||
1079 | } | ||
1080 | |||
1081 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | ||
1082 | "Unable to find parent of %p (%4.4s)\n", | ||
1083 | child_node, acpi_ut_get_node_name (child_node))); | ||
1084 | } | ||
1085 | |||
1086 | return_VALUE (ACPI_UNKNOWN_NAME); | ||
1087 | } | ||
1088 | #endif | ||
1089 | |||
1090 | |||
diff --git a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/namespace/nswalk.c index 4de2444df300..f9a7277dca6e 100644 --- a/drivers/acpi/namespace/nswalk.c +++ b/drivers/acpi/namespace/nswalk.c | |||
@@ -56,7 +56,7 @@ | |||
56 | * | 56 | * |
57 | * PARAMETERS: Type - Type of node to be searched for | 57 | * PARAMETERS: Type - Type of node to be searched for |
58 | * parent_node - Parent node whose children we are | 58 | * parent_node - Parent node whose children we are |
59 | * getting | 59 | * getting |
60 | * child_node - Previous child that was found. | 60 | * child_node - Previous child that was found. |
61 | * The NEXT child will be returned | 61 | * The NEXT child will be returned |
62 | * | 62 | * |
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index 1dc995586cbe..12ea202257fa 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c | |||
@@ -58,11 +58,11 @@ | |||
58 | * FUNCTION: acpi_evaluate_object_typed | 58 | * FUNCTION: acpi_evaluate_object_typed |
59 | * | 59 | * |
60 | * PARAMETERS: Handle - Object handle (optional) | 60 | * PARAMETERS: Handle - Object handle (optional) |
61 | * *Pathname - Object pathname (optional) | 61 | * Pathname - Object pathname (optional) |
62 | * **external_params - List of parameters to pass to method, | 62 | * external_params - List of parameters to pass to method, |
63 | * terminated by NULL. May be NULL | 63 | * terminated by NULL. May be NULL |
64 | * if no parameters are being passed. | 64 | * if no parameters are being passed. |
65 | * *return_buffer - Where to put method's return value (if | 65 | * return_buffer - Where to put method's return value (if |
66 | * any). If NULL, no value is returned. | 66 | * any). If NULL, no value is returned. |
67 | * return_type - Expected type of return object | 67 | * return_type - Expected type of return object |
68 | * | 68 | * |
@@ -73,6 +73,7 @@ | |||
73 | * be valid (non-null) | 73 | * be valid (non-null) |
74 | * | 74 | * |
75 | ******************************************************************************/ | 75 | ******************************************************************************/ |
76 | |||
76 | #ifdef ACPI_FUTURE_USAGE | 77 | #ifdef ACPI_FUTURE_USAGE |
77 | acpi_status | 78 | acpi_status |
78 | acpi_evaluate_object_typed ( | 79 | acpi_evaluate_object_typed ( |
@@ -307,7 +308,8 @@ acpi_evaluate_object ( | |||
307 | if (ACPI_SUCCESS (status)) { | 308 | if (ACPI_SUCCESS (status)) { |
308 | /* Validate/Allocate/Clear caller buffer */ | 309 | /* Validate/Allocate/Clear caller buffer */ |
309 | 310 | ||
310 | status = acpi_ut_initialize_buffer (return_buffer, buffer_space_needed); | 311 | status = acpi_ut_initialize_buffer (return_buffer, |
312 | buffer_space_needed); | ||
311 | if (ACPI_FAILURE (status)) { | 313 | if (ACPI_FAILURE (status)) { |
312 | /* | 314 | /* |
313 | * Caller's buffer is too small or a new one can't be allocated | 315 | * Caller's buffer is too small or a new one can't be allocated |
@@ -423,7 +425,8 @@ acpi_walk_namespace ( | |||
423 | return_ACPI_STATUS (status); | 425 | return_ACPI_STATUS (status); |
424 | } | 426 | } |
425 | 427 | ||
426 | status = acpi_ns_walk_namespace (type, start_object, max_depth, ACPI_NS_WALK_UNLOCK, | 428 | status = acpi_ns_walk_namespace (type, start_object, max_depth, |
429 | ACPI_NS_WALK_UNLOCK, | ||
427 | user_function, context, return_value); | 430 | user_function, context, return_value); |
428 | 431 | ||
429 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 432 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); |
@@ -525,7 +528,8 @@ acpi_ns_get_device_callback ( | |||
525 | } | 528 | } |
526 | } | 529 | } |
527 | 530 | ||
528 | status = info->user_function (obj_handle, nesting_level, info->context, return_value); | 531 | status = info->user_function (obj_handle, nesting_level, info->context, |
532 | return_value); | ||
529 | return (status); | 533 | return (status); |
530 | } | 534 | } |
531 | 535 | ||
diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c index f2405efd1b9a..8d097914c49a 100644 --- a/drivers/acpi/namespace/nsxfname.c +++ b/drivers/acpi/namespace/nsxfname.c | |||
@@ -57,9 +57,9 @@ | |||
57 | * FUNCTION: acpi_get_handle | 57 | * FUNCTION: acpi_get_handle |
58 | * | 58 | * |
59 | * PARAMETERS: Parent - Object to search under (search scope). | 59 | * PARAMETERS: Parent - Object to search under (search scope). |
60 | * path_name - Pointer to an asciiz string containing the | 60 | * Pathname - Pointer to an asciiz string containing the |
61 | * name | 61 | * name |
62 | * ret_handle - Where the return handle is placed | 62 | * ret_handle - Where the return handle is returned |
63 | * | 63 | * |
64 | * RETURN: Status | 64 | * RETURN: Status |
65 | * | 65 | * |
@@ -220,7 +220,7 @@ EXPORT_SYMBOL(acpi_get_name); | |||
220 | * FUNCTION: acpi_get_object_info | 220 | * FUNCTION: acpi_get_object_info |
221 | * | 221 | * |
222 | * PARAMETERS: Handle - Object Handle | 222 | * PARAMETERS: Handle - Object Handle |
223 | * Info - Where the info is returned | 223 | * Buffer - Where the info is returned |
224 | * | 224 | * |
225 | * RETURN: Status | 225 | * RETURN: Status |
226 | * | 226 | * |
diff --git a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/namespace/nsxfobj.c index 19acf32674b9..363e1f6cfb18 100644 --- a/drivers/acpi/namespace/nsxfobj.c +++ b/drivers/acpi/namespace/nsxfobj.c | |||
@@ -56,7 +56,7 @@ | |||
56 | * FUNCTION: acpi_get_type | 56 | * FUNCTION: acpi_get_type |
57 | * | 57 | * |
58 | * PARAMETERS: Handle - Handle of object whose type is desired | 58 | * PARAMETERS: Handle - Handle of object whose type is desired |
59 | * *ret_type - Where the type will be placed | 59 | * ret_type - Where the type will be placed |
60 | * | 60 | * |
61 | * RETURN: Status | 61 | * RETURN: Status |
62 | * | 62 | * |
@@ -258,5 +258,5 @@ unlock_and_exit: | |||
258 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 258 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); |
259 | return (status); | 259 | return (status); |
260 | } | 260 | } |
261 | EXPORT_SYMBOL(acpi_get_next_object); | ||
262 | 261 | ||
262 | EXPORT_SYMBOL(acpi_get_next_object); | ||
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 5a9128de6226..bdd9f37f8101 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -71,6 +71,9 @@ EXPORT_SYMBOL(acpi_in_debugger); | |||
71 | extern char line_buf[80]; | 71 | extern char line_buf[80]; |
72 | #endif /*ENABLE_DEBUGGER*/ | 72 | #endif /*ENABLE_DEBUGGER*/ |
73 | 73 | ||
74 | int acpi_specific_hotkey_enabled; | ||
75 | EXPORT_SYMBOL(acpi_specific_hotkey_enabled); | ||
76 | |||
74 | static unsigned int acpi_irq_irq; | 77 | static unsigned int acpi_irq_irq; |
75 | static acpi_osd_handler acpi_irq_handler; | 78 | static acpi_osd_handler acpi_irq_handler; |
76 | static void *acpi_irq_context; | 79 | static void *acpi_irq_context; |
@@ -1152,6 +1155,15 @@ acpi_wake_gpes_always_on_setup(char *str) | |||
1152 | 1155 | ||
1153 | __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup); | 1156 | __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup); |
1154 | 1157 | ||
1158 | int __init | ||
1159 | acpi_hotkey_setup(char *str) | ||
1160 | { | ||
1161 | acpi_specific_hotkey_enabled = TRUE; | ||
1162 | return 1; | ||
1163 | } | ||
1164 | |||
1165 | __setup("acpi_specific_hotkey", acpi_hotkey_setup); | ||
1166 | |||
1155 | /* | 1167 | /* |
1156 | * max_cstate is defined in the base kernel so modules can | 1168 | * max_cstate is defined in the base kernel so modules can |
1157 | * change it w/o depending on the state of the processor module. | 1169 | * change it w/o depending on the state of the processor module. |
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index b5d98895f6a8..b7ac68cc9e1c 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c | |||
@@ -50,6 +50,16 @@ | |||
50 | #define _COMPONENT ACPI_PARSER | 50 | #define _COMPONENT ACPI_PARSER |
51 | ACPI_MODULE_NAME ("psargs") | 51 | ACPI_MODULE_NAME ("psargs") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
54 | |||
55 | static u32 | ||
56 | acpi_ps_get_next_package_length ( | ||
57 | struct acpi_parse_state *parser_state); | ||
58 | |||
59 | static union acpi_parse_object * | ||
60 | acpi_ps_get_next_field ( | ||
61 | struct acpi_parse_state *parser_state); | ||
62 | |||
53 | 63 | ||
54 | /******************************************************************************* | 64 | /******************************************************************************* |
55 | * | 65 | * |
@@ -64,7 +74,7 @@ | |||
64 | * | 74 | * |
65 | ******************************************************************************/ | 75 | ******************************************************************************/ |
66 | 76 | ||
67 | u32 | 77 | static u32 |
68 | acpi_ps_get_next_package_length ( | 78 | acpi_ps_get_next_package_length ( |
69 | struct acpi_parse_state *parser_state) | 79 | struct acpi_parse_state *parser_state) |
70 | { | 80 | { |
@@ -78,7 +88,6 @@ acpi_ps_get_next_package_length ( | |||
78 | encoded_length = (u32) ACPI_GET8 (parser_state->aml); | 88 | encoded_length = (u32) ACPI_GET8 (parser_state->aml); |
79 | parser_state->aml++; | 89 | parser_state->aml++; |
80 | 90 | ||
81 | |||
82 | switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */ { | 91 | switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */ { |
83 | case 0: /* 1-byte encoding (bits 0-5) */ | 92 | case 0: /* 1-byte encoding (bits 0-5) */ |
84 | 93 | ||
@@ -287,13 +296,14 @@ acpi_ps_get_next_namepath ( | |||
287 | * parent tree, but don't open a new scope -- we just want to lookup the | 296 | * parent tree, but don't open a new scope -- we just want to lookup the |
288 | * object (MUST BE mode EXECUTE to perform upsearch) | 297 | * object (MUST BE mode EXECUTE to perform upsearch) |
289 | */ | 298 | */ |
290 | status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | 299 | status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY, |
291 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &node); | 300 | ACPI_IMODE_EXECUTE, |
301 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, | ||
302 | NULL, &node); | ||
292 | if (ACPI_SUCCESS (status) && method_call) { | 303 | if (ACPI_SUCCESS (status) && method_call) { |
293 | if (node->type == ACPI_TYPE_METHOD) { | 304 | if (node->type == ACPI_TYPE_METHOD) { |
294 | /* | 305 | /* This name is actually a control method invocation */ |
295 | * This name is actually a control method invocation | 306 | |
296 | */ | ||
297 | method_desc = acpi_ns_get_attached_object (node); | 307 | method_desc = acpi_ns_get_attached_object (node); |
298 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, | 308 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, |
299 | "Control Method - %p Desc %p Path=%p\n", | 309 | "Control Method - %p Desc %p Path=%p\n", |
@@ -360,7 +370,7 @@ acpi_ps_get_next_namepath ( | |||
360 | /* | 370 | /* |
361 | * We got a NOT_FOUND during table load or we encountered | 371 | * We got a NOT_FOUND during table load or we encountered |
362 | * a cond_ref_of(x) where the target does not exist. | 372 | * a cond_ref_of(x) where the target does not exist. |
363 | * -- either case is ok | 373 | * Either case is ok |
364 | */ | 374 | */ |
365 | status = AE_OK; | 375 | status = AE_OK; |
366 | } | 376 | } |
@@ -486,12 +496,13 @@ acpi_ps_get_next_simple_arg ( | |||
486 | * | 496 | * |
487 | ******************************************************************************/ | 497 | ******************************************************************************/ |
488 | 498 | ||
489 | union acpi_parse_object * | 499 | static union acpi_parse_object * |
490 | acpi_ps_get_next_field ( | 500 | acpi_ps_get_next_field ( |
491 | struct acpi_parse_state *parser_state) | 501 | struct acpi_parse_state *parser_state) |
492 | { | 502 | { |
493 | u32 aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, | 503 | u32 aml_offset = (u32) |
494 | parser_state->aml_start); | 504 | ACPI_PTR_DIFF (parser_state->aml, |
505 | parser_state->aml_start); | ||
495 | union acpi_parse_object *field; | 506 | union acpi_parse_object *field; |
496 | u16 opcode; | 507 | u16 opcode; |
497 | u32 name; | 508 | u32 name; |
@@ -500,7 +511,7 @@ acpi_ps_get_next_field ( | |||
500 | ACPI_FUNCTION_TRACE ("ps_get_next_field"); | 511 | ACPI_FUNCTION_TRACE ("ps_get_next_field"); |
501 | 512 | ||
502 | 513 | ||
503 | /* determine field type */ | 514 | /* Determine field type */ |
504 | 515 | ||
505 | switch (ACPI_GET8 (parser_state->aml)) { | 516 | switch (ACPI_GET8 (parser_state->aml)) { |
506 | default: | 517 | default: |
@@ -521,7 +532,6 @@ acpi_ps_get_next_field ( | |||
521 | break; | 532 | break; |
522 | } | 533 | } |
523 | 534 | ||
524 | |||
525 | /* Allocate a new field op */ | 535 | /* Allocate a new field op */ |
526 | 536 | ||
527 | field = acpi_ps_alloc_op (opcode); | 537 | field = acpi_ps_alloc_op (opcode); |
@@ -582,10 +592,10 @@ acpi_ps_get_next_field ( | |||
582 | * | 592 | * |
583 | * FUNCTION: acpi_ps_get_next_arg | 593 | * FUNCTION: acpi_ps_get_next_arg |
584 | * | 594 | * |
585 | * PARAMETERS: parser_state - Current parser state object | 595 | * PARAMETERS: walk_state - Current state |
596 | * parser_state - Current parser state object | ||
586 | * arg_type - The argument type (AML_*_ARG) | 597 | * arg_type - The argument type (AML_*_ARG) |
587 | * arg_count - If the argument points to a control method | 598 | * return_arg - Where the next arg is returned |
588 | * the method's argument is returned here. | ||
589 | * | 599 | * |
590 | * RETURN: Status, and an op object containing the next argument. | 600 | * RETURN: Status, and an op object containing the next argument. |
591 | * | 601 | * |
@@ -619,7 +629,7 @@ acpi_ps_get_next_arg ( | |||
619 | case ARGP_NAME: | 629 | case ARGP_NAME: |
620 | case ARGP_NAMESTRING: | 630 | case ARGP_NAMESTRING: |
621 | 631 | ||
622 | /* constants, strings, and namestrings are all the same size */ | 632 | /* Constants, strings, and namestrings are all the same size */ |
623 | 633 | ||
624 | arg = acpi_ps_alloc_op (AML_BYTE_OP); | 634 | arg = acpi_ps_alloc_op (AML_BYTE_OP); |
625 | if (!arg) { | 635 | if (!arg) { |
@@ -654,7 +664,6 @@ acpi_ps_get_next_arg ( | |||
654 | else { | 664 | else { |
655 | arg = field; | 665 | arg = field; |
656 | } | 666 | } |
657 | |||
658 | prev = field; | 667 | prev = field; |
659 | } | 668 | } |
660 | 669 | ||
@@ -677,8 +686,8 @@ acpi_ps_get_next_arg ( | |||
677 | 686 | ||
678 | /* Fill in bytelist data */ | 687 | /* Fill in bytelist data */ |
679 | 688 | ||
680 | arg->common.value.size = (u32) ACPI_PTR_DIFF (parser_state->pkg_end, | 689 | arg->common.value.size = (u32) |
681 | parser_state->aml); | 690 | ACPI_PTR_DIFF (parser_state->pkg_end, parser_state->aml); |
682 | arg->named.data = parser_state->aml; | 691 | arg->named.data = parser_state->aml; |
683 | 692 | ||
684 | /* Skip to End of byte data */ | 693 | /* Skip to End of byte data */ |
@@ -706,7 +715,7 @@ acpi_ps_get_next_arg ( | |||
706 | status = acpi_ps_get_next_namepath (walk_state, parser_state, arg, 0); | 715 | status = acpi_ps_get_next_namepath (walk_state, parser_state, arg, 0); |
707 | } | 716 | } |
708 | else { | 717 | else { |
709 | /* single complex argument, nothing returned */ | 718 | /* Single complex argument, nothing returned */ |
710 | 719 | ||
711 | walk_state->arg_count = 1; | 720 | walk_state->arg_count = 1; |
712 | } | 721 | } |
@@ -716,7 +725,7 @@ acpi_ps_get_next_arg ( | |||
716 | case ARGP_DATAOBJ: | 725 | case ARGP_DATAOBJ: |
717 | case ARGP_TERMARG: | 726 | case ARGP_TERMARG: |
718 | 727 | ||
719 | /* single complex argument, nothing returned */ | 728 | /* Single complex argument, nothing returned */ |
720 | 729 | ||
721 | walk_state->arg_count = 1; | 730 | walk_state->arg_count = 1; |
722 | break; | 731 | break; |
@@ -727,7 +736,7 @@ acpi_ps_get_next_arg ( | |||
727 | case ARGP_OBJLIST: | 736 | case ARGP_OBJLIST: |
728 | 737 | ||
729 | if (parser_state->aml < parser_state->pkg_end) { | 738 | if (parser_state->aml < parser_state->pkg_end) { |
730 | /* non-empty list of variable arguments, nothing returned */ | 739 | /* Non-empty list of variable arguments, nothing returned */ |
731 | 740 | ||
732 | walk_state->arg_count = ACPI_VAR_ARGS; | 741 | walk_state->arg_count = ACPI_VAR_ARGS; |
733 | } | 742 | } |
diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c index 03e33fedc11a..5744673568c0 100644 --- a/drivers/acpi/parser/psopcode.c +++ b/drivers/acpi/parser/psopcode.c | |||
@@ -44,6 +44,7 @@ | |||
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acparser.h> | 46 | #include <acpi/acparser.h> |
47 | #include <acpi/acopcode.h> | ||
47 | #include <acpi/amlcode.h> | 48 | #include <acpi/amlcode.h> |
48 | 49 | ||
49 | 50 | ||
@@ -51,23 +52,6 @@ | |||
51 | ACPI_MODULE_NAME ("psopcode") | 52 | ACPI_MODULE_NAME ("psopcode") |
52 | 53 | ||
53 | 54 | ||
54 | #define _UNK 0x6B | ||
55 | /* | ||
56 | * Reserved ASCII characters. Do not use any of these for | ||
57 | * internal opcodes, since they are used to differentiate | ||
58 | * name strings from AML opcodes | ||
59 | */ | ||
60 | #define _ASC 0x6C | ||
61 | #define _NAM 0x6C | ||
62 | #define _PFX 0x6D | ||
63 | #define _UNKNOWN_OPCODE 0x02 /* An example unknown opcode */ | ||
64 | |||
65 | #define MAX_EXTENDED_OPCODE 0x88 | ||
66 | #define NUM_EXTENDED_OPCODE (MAX_EXTENDED_OPCODE + 1) | ||
67 | #define MAX_INTERNAL_OPCODE | ||
68 | #define NUM_INTERNAL_OPCODE (MAX_INTERNAL_OPCODE + 1) | ||
69 | |||
70 | |||
71 | /******************************************************************************* | 55 | /******************************************************************************* |
72 | * | 56 | * |
73 | * NAME: acpi_gbl_aml_op_info | 57 | * NAME: acpi_gbl_aml_op_info |
@@ -79,274 +63,9 @@ | |||
79 | * | 63 | * |
80 | ******************************************************************************/ | 64 | ******************************************************************************/ |
81 | 65 | ||
82 | |||
83 | /* | ||
84 | * All AML opcodes and the parse-time arguments for each. Used by the AML parser Each list is compressed | ||
85 | * into a 32-bit number and stored in the master opcode table at the end of this file. | ||
86 | */ | ||
87 | |||
88 | |||
89 | #define ARGP_ACCESSFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
90 | #define ARGP_ACQUIRE_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_WORDDATA) | ||
91 | #define ARGP_ADD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
92 | #define ARGP_ALIAS_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_NAME) | ||
93 | #define ARGP_ARG0 ARG_NONE | ||
94 | #define ARGP_ARG1 ARG_NONE | ||
95 | #define ARGP_ARG2 ARG_NONE | ||
96 | #define ARGP_ARG3 ARG_NONE | ||
97 | #define ARGP_ARG4 ARG_NONE | ||
98 | #define ARGP_ARG5 ARG_NONE | ||
99 | #define ARGP_ARG6 ARG_NONE | ||
100 | #define ARGP_BANK_FIELD_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_TERMARG, ARGP_BYTEDATA, ARGP_FIELDLIST) | ||
101 | #define ARGP_BIT_AND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
102 | #define ARGP_BIT_NAND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
103 | #define ARGP_BIT_NOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
104 | #define ARGP_BIT_NOT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
105 | #define ARGP_BIT_OR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
106 | #define ARGP_BIT_XOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
107 | #define ARGP_BREAK_OP ARG_NONE | ||
108 | #define ARGP_BREAK_POINT_OP ARG_NONE | ||
109 | #define ARGP_BUFFER_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_BYTELIST) | ||
110 | #define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA) | ||
111 | #define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
112 | #define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
113 | #define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
114 | #define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME) | ||
115 | #define ARGP_CONTINUE_OP ARG_NONE | ||
116 | #define ARGP_COPY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SIMPLENAME) | ||
117 | #define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | ||
118 | #define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | ||
119 | #define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | ||
120 | #define ARGP_CREATE_FIELD_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | ||
121 | #define ARGP_CREATE_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | ||
122 | #define ARGP_CREATE_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | ||
123 | #define ARGP_DATA_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG) | ||
124 | #define ARGP_DEBUG_OP ARG_NONE | ||
125 | #define ARGP_DECREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
126 | #define ARGP_DEREF_OF_OP ARGP_LIST1 (ARGP_TERMARG) | ||
127 | #define ARGP_DEVICE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST) | ||
128 | #define ARGP_DIVIDE_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET, ARGP_TARGET) | ||
129 | #define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA) | ||
130 | #define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST) | ||
131 | #define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME) | ||
132 | #define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG) | ||
133 | #define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST) | ||
134 | #define ARGP_FIND_SET_LEFT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
135 | #define ARGP_FIND_SET_RIGHT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
136 | #define ARGP_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
137 | #define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST) | ||
138 | #define ARGP_INCREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
139 | #define ARGP_INDEX_FIELD_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_BYTEDATA, ARGP_FIELDLIST) | ||
140 | #define ARGP_INDEX_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
141 | #define ARGP_LAND_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
142 | #define ARGP_LEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
143 | #define ARGP_LGREATER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
144 | #define ARGP_LGREATEREQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
145 | #define ARGP_LLESS_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
146 | #define ARGP_LLESSEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
147 | #define ARGP_LNOT_OP ARGP_LIST1 (ARGP_TERMARG) | ||
148 | #define ARGP_LNOTEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
149 | #define ARGP_LOAD_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_SUPERNAME) | ||
150 | #define ARGP_LOAD_TABLE_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG) | ||
151 | #define ARGP_LOCAL0 ARG_NONE | ||
152 | #define ARGP_LOCAL1 ARG_NONE | ||
153 | #define ARGP_LOCAL2 ARG_NONE | ||
154 | #define ARGP_LOCAL3 ARG_NONE | ||
155 | #define ARGP_LOCAL4 ARG_NONE | ||
156 | #define ARGP_LOCAL5 ARG_NONE | ||
157 | #define ARGP_LOCAL6 ARG_NONE | ||
158 | #define ARGP_LOCAL7 ARG_NONE | ||
159 | #define ARGP_LOR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
160 | #define ARGP_MATCH_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG) | ||
161 | #define ARGP_METHOD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMLIST) | ||
162 | #define ARGP_METHODCALL_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
163 | #define ARGP_MID_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
164 | #define ARGP_MOD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
165 | #define ARGP_MULTIPLY_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
166 | #define ARGP_MUTEX_OP ARGP_LIST2 (ARGP_NAME, ARGP_BYTEDATA) | ||
167 | #define ARGP_NAME_OP ARGP_LIST2 (ARGP_NAME, ARGP_DATAOBJ) | ||
168 | #define ARGP_NAMEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
169 | #define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
170 | #define ARGP_NOOP_OP ARG_NONE | ||
171 | #define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) | ||
172 | #define ARGP_ONE_OP ARG_NONE | ||
173 | #define ARGP_ONES_OP ARG_NONE | ||
174 | #define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST) | ||
175 | #define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST) | ||
176 | #define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST) | ||
177 | #define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA) | ||
178 | #define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
179 | #define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG) | ||
180 | #define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
181 | #define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
182 | #define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
183 | #define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG) | ||
184 | #define ARGP_REVISION_OP ARG_NONE | ||
185 | #define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST) | ||
186 | #define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
187 | #define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
188 | #define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
189 | #define ARGP_SIZE_OF_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
190 | #define ARGP_SLEEP_OP ARGP_LIST1 (ARGP_TERMARG) | ||
191 | #define ARGP_STALL_OP ARGP_LIST1 (ARGP_TERMARG) | ||
192 | #define ARGP_STATICSTRING_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
193 | #define ARGP_STORE_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SUPERNAME) | ||
194 | #define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST) | ||
195 | #define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
196 | #define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST) | ||
197 | #define ARGP_TIMER_OP ARG_NONE | ||
198 | #define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
199 | #define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
200 | #define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
201 | #define ARGP_TO_HEX_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
202 | #define ARGP_TO_INTEGER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
203 | #define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
204 | #define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
205 | #define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
206 | #define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_DATAOBJLIST) | ||
207 | #define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) | ||
208 | #define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST) | ||
209 | #define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA) | ||
210 | #define ARGP_ZERO_OP ARG_NONE | ||
211 | |||
212 | |||
213 | /* | ||
214 | * All AML opcodes and the runtime arguments for each. Used by the AML interpreter Each list is compressed | ||
215 | * into a 32-bit number and stored in the master opcode table at the end of this file. | ||
216 | * | ||
217 | * (Used by prep_operands procedure and the ASL Compiler) | ||
218 | */ | ||
219 | |||
220 | |||
221 | #define ARGI_ACCESSFIELD_OP ARGI_INVALID_OPCODE | ||
222 | #define ARGI_ACQUIRE_OP ARGI_LIST2 (ARGI_MUTEX, ARGI_INTEGER) | ||
223 | #define ARGI_ADD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
224 | #define ARGI_ALIAS_OP ARGI_INVALID_OPCODE | ||
225 | #define ARGI_ARG0 ARG_NONE | ||
226 | #define ARGI_ARG1 ARG_NONE | ||
227 | #define ARGI_ARG2 ARG_NONE | ||
228 | #define ARGI_ARG3 ARG_NONE | ||
229 | #define ARGI_ARG4 ARG_NONE | ||
230 | #define ARGI_ARG5 ARG_NONE | ||
231 | #define ARGI_ARG6 ARG_NONE | ||
232 | #define ARGI_BANK_FIELD_OP ARGI_INVALID_OPCODE | ||
233 | #define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
234 | #define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
235 | #define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
236 | #define ARGI_BIT_NOT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) | ||
237 | #define ARGI_BIT_OR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
238 | #define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
239 | #define ARGI_BREAK_OP ARG_NONE | ||
240 | #define ARGI_BREAK_POINT_OP ARG_NONE | ||
241 | #define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER) | ||
242 | #define ARGI_BYTE_OP ARGI_INVALID_OPCODE | ||
243 | #define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE | ||
244 | #define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF) | ||
245 | #define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF) | ||
246 | #define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF) | ||
247 | #define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE | ||
248 | #define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET) | ||
249 | #define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) | ||
250 | #define ARGI_CREATE_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) | ||
251 | #define ARGI_CREATE_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) | ||
252 | #define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE) | ||
253 | #define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) | ||
254 | #define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) | ||
255 | #define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING) | ||
256 | #define ARGI_DEBUG_OP ARG_NONE | ||
257 | #define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) | ||
258 | #define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING) | ||
259 | #define ARGI_DEVICE_OP ARGI_INVALID_OPCODE | ||
260 | #define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF) | ||
261 | #define ARGI_DWORD_OP ARGI_INVALID_OPCODE | ||
262 | #define ARGI_ELSE_OP ARGI_INVALID_OPCODE | ||
263 | #define ARGI_EVENT_OP ARGI_INVALID_OPCODE | ||
264 | #define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER) | ||
265 | #define ARGI_FIELD_OP ARGI_INVALID_OPCODE | ||
266 | #define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) | ||
267 | #define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) | ||
268 | #define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) | ||
269 | #define ARGI_IF_OP ARGI_INVALID_OPCODE | ||
270 | #define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) | ||
271 | #define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE | ||
272 | #define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF) | ||
273 | #define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) | ||
274 | #define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA) | ||
275 | #define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA) | ||
276 | #define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE | ||
277 | #define ARGI_LLESS_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA) | ||
278 | #define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE | ||
279 | #define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER) | ||
280 | #define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE | ||
281 | #define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_FIELD,ARGI_TARGETREF) | ||
282 | #define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE) | ||
283 | #define ARGI_LOCAL0 ARG_NONE | ||
284 | #define ARGI_LOCAL1 ARG_NONE | ||
285 | #define ARGI_LOCAL2 ARG_NONE | ||
286 | #define ARGI_LOCAL3 ARG_NONE | ||
287 | #define ARGI_LOCAL4 ARG_NONE | ||
288 | #define ARGI_LOCAL5 ARG_NONE | ||
289 | #define ARGI_LOCAL6 ARG_NONE | ||
290 | #define ARGI_LOCAL7 ARG_NONE | ||
291 | #define ARGI_LOR_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) | ||
292 | #define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_COMPUTEDATA, ARGI_INTEGER,ARGI_COMPUTEDATA,ARGI_INTEGER) | ||
293 | #define ARGI_METHOD_OP ARGI_INVALID_OPCODE | ||
294 | #define ARGI_METHODCALL_OP ARGI_INVALID_OPCODE | ||
295 | #define ARGI_MID_OP ARGI_LIST4 (ARGI_BUFFER_OR_STRING,ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
296 | #define ARGI_MOD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
297 | #define ARGI_MULTIPLY_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
298 | #define ARGI_MUTEX_OP ARGI_INVALID_OPCODE | ||
299 | #define ARGI_NAME_OP ARGI_INVALID_OPCODE | ||
300 | #define ARGI_NAMEDFIELD_OP ARGI_INVALID_OPCODE | ||
301 | #define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE | ||
302 | #define ARGI_NOOP_OP ARG_NONE | ||
303 | #define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER) | ||
304 | #define ARGI_ONE_OP ARG_NONE | ||
305 | #define ARGI_ONES_OP ARG_NONE | ||
306 | #define ARGI_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER) | ||
307 | #define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE | ||
308 | #define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE | ||
309 | #define ARGI_QWORD_OP ARGI_INVALID_OPCODE | ||
310 | #define ARGI_REF_OF_OP ARGI_LIST1 (ARGI_OBJECT_REF) | ||
311 | #define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) | ||
312 | #define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX) | ||
313 | #define ARGI_RESERVEDFIELD_OP ARGI_INVALID_OPCODE | ||
314 | #define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT) | ||
315 | #define ARGI_RETURN_OP ARGI_INVALID_OPCODE | ||
316 | #define ARGI_REVISION_OP ARG_NONE | ||
317 | #define ARGI_SCOPE_OP ARGI_INVALID_OPCODE | ||
318 | #define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
319 | #define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
320 | #define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT) | ||
321 | #define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_DATAOBJECT) | ||
322 | #define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER) | ||
323 | #define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER) | ||
324 | #define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE | ||
325 | #define ARGI_STORE_OP ARGI_LIST2 (ARGI_DATAREFOBJ, ARGI_TARGETREF) | ||
326 | #define ARGI_STRING_OP ARGI_INVALID_OPCODE | ||
327 | #define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
328 | #define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE | ||
329 | #define ARGI_TIMER_OP ARG_NONE | ||
330 | #define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET) | ||
331 | #define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) | ||
332 | #define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) | ||
333 | #define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) | ||
334 | #define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) | ||
335 | #define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET) | ||
336 | #define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE) | ||
337 | #define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE) | ||
338 | #define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER) | ||
339 | #define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER) | ||
340 | #define ARGI_WHILE_OP ARGI_INVALID_OPCODE | ||
341 | #define ARGI_WORD_OP ARGI_INVALID_OPCODE | ||
342 | #define ARGI_ZERO_OP ARG_NONE | ||
343 | |||
344 | |||
345 | /* | 66 | /* |
346 | * Summary of opcode types/flags | 67 | * Summary of opcode types/flags |
347 | */ | 68 | * |
348 | |||
349 | /****************************************************************************** | ||
350 | 69 | ||
351 | Opcodes that have associated namespace objects (AML_NSOBJECT flag) | 70 | Opcodes that have associated namespace objects (AML_NSOBJECT flag) |
352 | 71 | ||
@@ -460,14 +179,13 @@ | |||
460 | AML_CREATE_DWORD_FIELD_OP | 179 | AML_CREATE_DWORD_FIELD_OP |
461 | AML_CREATE_QWORD_FIELD_OP | 180 | AML_CREATE_QWORD_FIELD_OP |
462 | 181 | ||
463 | ******************************************************************************/ | 182 | ******************************************************************************/ |
464 | 183 | ||
465 | 184 | ||
466 | /* | 185 | /* |
467 | * Master Opcode information table. A summary of everything we know about each opcode, all in one place. | 186 | * Master Opcode information table. A summary of everything we know about each |
187 | * opcode, all in one place. | ||
468 | */ | 188 | */ |
469 | |||
470 | |||
471 | const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = | 189 | const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = |
472 | { | 190 | { |
473 | /*! [Begin] no source code translation */ | 191 | /*! [Begin] no source code translation */ |
@@ -693,8 +411,7 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = | |||
693 | * | 411 | * |
694 | * PARAMETERS: Opcode - The AML opcode | 412 | * PARAMETERS: Opcode - The AML opcode |
695 | * | 413 | * |
696 | * RETURN: A pointer to the info about the opcode. NULL if the opcode was | 414 | * RETURN: A pointer to the info about the opcode. |
697 | * not found in the table. | ||
698 | * | 415 | * |
699 | * DESCRIPTION: Find AML opcode description based on the opcode. | 416 | * DESCRIPTION: Find AML opcode description based on the opcode. |
700 | * NOTE: This procedure must ALWAYS return a valid pointer! | 417 | * NOTE: This procedure must ALWAYS return a valid pointer! |
@@ -731,7 +448,8 @@ acpi_ps_get_opcode_info ( | |||
731 | 448 | ||
732 | default: | 449 | default: |
733 | 450 | ||
734 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown AML opcode [%4.4X]\n", opcode)); | 451 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
452 | "Unknown AML opcode [%4.4X]\n", opcode)); | ||
735 | break; | 453 | break; |
736 | } | 454 | } |
737 | 455 | ||
diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index e79edb53cb3b..bbfdc1a58c27 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c | |||
@@ -64,6 +64,23 @@ | |||
64 | 64 | ||
65 | static u32 acpi_gbl_depth = 0; | 65 | static u32 acpi_gbl_depth = 0; |
66 | 66 | ||
67 | /* Local prototypes */ | ||
68 | |||
69 | static void | ||
70 | acpi_ps_complete_this_op ( | ||
71 | struct acpi_walk_state *walk_state, | ||
72 | union acpi_parse_object *op); | ||
73 | |||
74 | static acpi_status | ||
75 | acpi_ps_next_parse_state ( | ||
76 | struct acpi_walk_state *walk_state, | ||
77 | union acpi_parse_object *op, | ||
78 | acpi_status callback_status); | ||
79 | |||
80 | static acpi_status | ||
81 | acpi_ps_parse_loop ( | ||
82 | struct acpi_walk_state *walk_state); | ||
83 | |||
67 | 84 | ||
68 | /******************************************************************************* | 85 | /******************************************************************************* |
69 | * | 86 | * |
@@ -100,7 +117,7 @@ acpi_ps_get_opcode_size ( | |||
100 | * | 117 | * |
101 | * PARAMETERS: parser_state - A parser state object | 118 | * PARAMETERS: parser_state - A parser state object |
102 | * | 119 | * |
103 | * RETURN: Status | 120 | * RETURN: Next AML opcode |
104 | * | 121 | * |
105 | * DESCRIPTION: Get next AML opcode (without incrementing AML pointer) | 122 | * DESCRIPTION: Get next AML opcode (without incrementing AML pointer) |
106 | * | 123 | * |
@@ -117,7 +134,6 @@ acpi_ps_peek_opcode ( | |||
117 | aml = parser_state->aml; | 134 | aml = parser_state->aml; |
118 | opcode = (u16) ACPI_GET8 (aml); | 135 | opcode = (u16) ACPI_GET8 (aml); |
119 | 136 | ||
120 | |||
121 | if (opcode == AML_EXTOP) { | 137 | if (opcode == AML_EXTOP) { |
122 | /* Extended opcode */ | 138 | /* Extended opcode */ |
123 | 139 | ||
@@ -142,7 +158,7 @@ acpi_ps_peek_opcode ( | |||
142 | * | 158 | * |
143 | ******************************************************************************/ | 159 | ******************************************************************************/ |
144 | 160 | ||
145 | void | 161 | static void |
146 | acpi_ps_complete_this_op ( | 162 | acpi_ps_complete_this_op ( |
147 | struct acpi_walk_state *walk_state, | 163 | struct acpi_walk_state *walk_state, |
148 | union acpi_parse_object *op) | 164 | union acpi_parse_object *op) |
@@ -272,7 +288,6 @@ acpi_ps_complete_this_op ( | |||
272 | next = NULL; | 288 | next = NULL; |
273 | } | 289 | } |
274 | } | 290 | } |
275 | |||
276 | prev = next; | 291 | prev = next; |
277 | } | 292 | } |
278 | } | 293 | } |
@@ -280,7 +295,7 @@ acpi_ps_complete_this_op ( | |||
280 | 295 | ||
281 | cleanup: | 296 | cleanup: |
282 | 297 | ||
283 | /* Now we can actually delete the subtree rooted at op */ | 298 | /* Now we can actually delete the subtree rooted at Op */ |
284 | 299 | ||
285 | acpi_ps_delete_parse_tree (op); | 300 | acpi_ps_delete_parse_tree (op); |
286 | return_VOID; | 301 | return_VOID; |
@@ -291,7 +306,9 @@ cleanup: | |||
291 | * | 306 | * |
292 | * FUNCTION: acpi_ps_next_parse_state | 307 | * FUNCTION: acpi_ps_next_parse_state |
293 | * | 308 | * |
294 | * PARAMETERS: parser_state - Current parser state object | 309 | * PARAMETERS: walk_state - Current state |
310 | * Op - Current parse op | ||
311 | * callback_status - Status from previous operation | ||
295 | * | 312 | * |
296 | * RETURN: Status | 313 | * RETURN: Status |
297 | * | 314 | * |
@@ -300,7 +317,7 @@ cleanup: | |||
300 | * | 317 | * |
301 | ******************************************************************************/ | 318 | ******************************************************************************/ |
302 | 319 | ||
303 | acpi_status | 320 | static acpi_status |
304 | acpi_ps_next_parse_state ( | 321 | acpi_ps_next_parse_state ( |
305 | struct acpi_walk_state *walk_state, | 322 | struct acpi_walk_state *walk_state, |
306 | union acpi_parse_object *op, | 323 | union acpi_parse_object *op, |
@@ -382,9 +399,8 @@ acpi_ps_next_parse_state ( | |||
382 | 399 | ||
383 | case AE_CTRL_TRANSFER: | 400 | case AE_CTRL_TRANSFER: |
384 | 401 | ||
385 | /* | 402 | /* A method call (invocation) -- transfer control */ |
386 | * A method call (invocation) -- transfer control | 403 | |
387 | */ | ||
388 | status = AE_CTRL_TRANSFER; | 404 | status = AE_CTRL_TRANSFER; |
389 | walk_state->prev_op = op; | 405 | walk_state->prev_op = op; |
390 | walk_state->method_call_op = op; | 406 | walk_state->method_call_op = op; |
@@ -397,6 +413,7 @@ acpi_ps_next_parse_state ( | |||
397 | 413 | ||
398 | 414 | ||
399 | default: | 415 | default: |
416 | |||
400 | status = callback_status; | 417 | status = callback_status; |
401 | if ((callback_status & AE_CODE_MASK) == AE_CODE_CONTROL) { | 418 | if ((callback_status & AE_CODE_MASK) == AE_CODE_CONTROL) { |
402 | status = AE_OK; | 419 | status = AE_OK; |
@@ -412,7 +429,7 @@ acpi_ps_next_parse_state ( | |||
412 | * | 429 | * |
413 | * FUNCTION: acpi_ps_parse_loop | 430 | * FUNCTION: acpi_ps_parse_loop |
414 | * | 431 | * |
415 | * PARAMETERS: parser_state - Current parser state object | 432 | * PARAMETERS: walk_state - Current state |
416 | * | 433 | * |
417 | * RETURN: Status | 434 | * RETURN: Status |
418 | * | 435 | * |
@@ -421,7 +438,7 @@ acpi_ps_next_parse_state ( | |||
421 | * | 438 | * |
422 | ******************************************************************************/ | 439 | ******************************************************************************/ |
423 | 440 | ||
424 | acpi_status | 441 | static acpi_status |
425 | acpi_ps_parse_loop ( | 442 | acpi_ps_parse_loop ( |
426 | struct acpi_walk_state *walk_state) | 443 | struct acpi_walk_state *walk_state) |
427 | { | 444 | { |
@@ -443,6 +460,7 @@ acpi_ps_parse_loop ( | |||
443 | walk_state->arg_types = 0; | 460 | walk_state->arg_types = 0; |
444 | 461 | ||
445 | #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) | 462 | #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) |
463 | |||
446 | if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { | 464 | if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { |
447 | /* We are restarting a preempted control method */ | 465 | /* We are restarting a preempted control method */ |
448 | 466 | ||
@@ -471,7 +489,8 @@ acpi_ps_parse_loop ( | |||
471 | acpi_format_exception (status))); | 489 | acpi_format_exception (status))); |
472 | 490 | ||
473 | } | 491 | } |
474 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "get_predicate Failed, %s\n", | 492 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
493 | "get_predicate Failed, %s\n", | ||
475 | acpi_format_exception (status))); | 494 | acpi_format_exception (status))); |
476 | return_ACPI_STATUS (status); | 495 | return_ACPI_STATUS (status); |
477 | } | 496 | } |
@@ -492,16 +511,15 @@ acpi_ps_parse_loop ( | |||
492 | } | 511 | } |
493 | #endif | 512 | #endif |
494 | 513 | ||
495 | /* | 514 | /* Iterative parsing loop, while there is more AML to process: */ |
496 | * Iterative parsing loop, while there is more aml to process: | 515 | |
497 | */ | ||
498 | while ((parser_state->aml < parser_state->aml_end) || (op)) { | 516 | while ((parser_state->aml < parser_state->aml_end) || (op)) { |
499 | aml_op_start = parser_state->aml; | 517 | aml_op_start = parser_state->aml; |
500 | if (!op) { | 518 | if (!op) { |
501 | /* Get the next opcode from the AML stream */ | 519 | /* Get the next opcode from the AML stream */ |
502 | 520 | ||
503 | walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, | 521 | walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, |
504 | parser_state->aml_start); | 522 | parser_state->aml_start); |
505 | walk_state->opcode = acpi_ps_peek_opcode (parser_state); | 523 | walk_state->opcode = acpi_ps_peek_opcode (parser_state); |
506 | 524 | ||
507 | /* | 525 | /* |
@@ -578,8 +596,10 @@ acpi_ps_parse_loop ( | |||
578 | INCREMENT_ARG_LIST (walk_state->arg_types); | 596 | INCREMENT_ARG_LIST (walk_state->arg_types); |
579 | } | 597 | } |
580 | 598 | ||
581 | /* Make sure that we found a NAME and didn't run out of arguments */ | 599 | /* |
582 | 600 | * Make sure that we found a NAME and didn't run out of | |
601 | * arguments | ||
602 | */ | ||
583 | if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) { | 603 | if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) { |
584 | status = AE_AML_NO_OPERAND; | 604 | status = AE_AML_NO_OPERAND; |
585 | goto close_this_op; | 605 | goto close_this_op; |
@@ -597,12 +617,13 @@ acpi_ps_parse_loop ( | |||
597 | 617 | ||
598 | status = walk_state->descending_callback (walk_state, &op); | 618 | status = walk_state->descending_callback (walk_state, &op); |
599 | if (ACPI_FAILURE (status)) { | 619 | if (ACPI_FAILURE (status)) { |
600 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "During name lookup/catalog, %s\n", | 620 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
601 | acpi_format_exception (status))); | 621 | "During name lookup/catalog, %s\n", |
622 | acpi_format_exception (status))); | ||
602 | goto close_this_op; | 623 | goto close_this_op; |
603 | } | 624 | } |
604 | 625 | ||
605 | if (op == NULL) { | 626 | if (!op) { |
606 | continue; | 627 | continue; |
607 | } | 628 | } |
608 | 629 | ||
@@ -659,7 +680,7 @@ acpi_ps_parse_loop ( | |||
659 | 680 | ||
660 | if ((walk_state->descending_callback != NULL)) { | 681 | if ((walk_state->descending_callback != NULL)) { |
661 | /* | 682 | /* |
662 | * Find the object. This will either insert the object into | 683 | * Find the object. This will either insert the object into |
663 | * the namespace or simply look it up | 684 | * the namespace or simply look it up |
664 | */ | 685 | */ |
665 | walk_state->op = op; | 686 | walk_state->op = op; |
@@ -688,11 +709,15 @@ acpi_ps_parse_loop ( | |||
688 | } | 709 | } |
689 | 710 | ||
690 | 711 | ||
691 | /* Start arg_count at zero because we don't know if there are any args yet */ | 712 | /* |
692 | 713 | * Start arg_count at zero because we don't know if there are | |
714 | * any args yet | ||
715 | */ | ||
693 | walk_state->arg_count = 0; | 716 | walk_state->arg_count = 0; |
694 | 717 | ||
695 | if (walk_state->arg_types) /* Are there any arguments that must be processed? */ { | 718 | /* Are there any arguments that must be processed? */ |
719 | |||
720 | if (walk_state->arg_types) { | ||
696 | /* Get arguments */ | 721 | /* Get arguments */ |
697 | 722 | ||
698 | switch (op->common.aml_opcode) { | 723 | switch (op->common.aml_opcode) { |
@@ -720,14 +745,18 @@ acpi_ps_parse_loop ( | |||
720 | 745 | ||
721 | default: | 746 | default: |
722 | 747 | ||
723 | /* Op is not a constant or string, append each argument to the Op */ | 748 | /* |
724 | 749 | * Op is not a constant or string, append each argument | |
750 | * to the Op | ||
751 | */ | ||
725 | while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && | 752 | while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && |
726 | !walk_state->arg_count) { | 753 | !walk_state->arg_count) { |
727 | walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, | 754 | walk_state->aml_offset = (u32) |
728 | parser_state->aml_start); | 755 | ACPI_PTR_DIFF (parser_state->aml, parser_state->aml_start); |
756 | |||
729 | status = acpi_ps_get_next_arg (walk_state, parser_state, | 757 | status = acpi_ps_get_next_arg (walk_state, parser_state, |
730 | GET_CURRENT_ARG_TYPE (walk_state->arg_types), &arg); | 758 | GET_CURRENT_ARG_TYPE (walk_state->arg_types), |
759 | &arg); | ||
731 | if (ACPI_FAILURE (status)) { | 760 | if (ACPI_FAILURE (status)) { |
732 | goto close_this_op; | 761 | goto close_this_op; |
733 | } | 762 | } |
@@ -752,7 +781,8 @@ acpi_ps_parse_loop ( | |||
752 | * Save the length and address of the body | 781 | * Save the length and address of the body |
753 | */ | 782 | */ |
754 | op->named.data = parser_state->aml; | 783 | op->named.data = parser_state->aml; |
755 | op->named.length = (u32) (parser_state->pkg_end - parser_state->aml); | 784 | op->named.length = (u32) (parser_state->pkg_end - |
785 | parser_state->aml); | ||
756 | 786 | ||
757 | /* Skip body of method */ | 787 | /* Skip body of method */ |
758 | 788 | ||
@@ -773,7 +803,8 @@ acpi_ps_parse_loop ( | |||
773 | * to parse them correctly. | 803 | * to parse them correctly. |
774 | */ | 804 | */ |
775 | op->named.data = aml_op_start; | 805 | op->named.data = aml_op_start; |
776 | op->named.length = (u32) (parser_state->pkg_end - aml_op_start); | 806 | op->named.length = (u32) (parser_state->pkg_end - |
807 | aml_op_start); | ||
777 | 808 | ||
778 | /* Skip body */ | 809 | /* Skip body */ |
779 | 810 | ||
@@ -785,7 +816,8 @@ acpi_ps_parse_loop ( | |||
785 | case AML_WHILE_OP: | 816 | case AML_WHILE_OP: |
786 | 817 | ||
787 | if (walk_state->control_state) { | 818 | if (walk_state->control_state) { |
788 | walk_state->control_state->control.package_end = parser_state->pkg_end; | 819 | walk_state->control_state->control.package_end = |
820 | parser_state->pkg_end; | ||
789 | } | 821 | } |
790 | break; | 822 | break; |
791 | 823 | ||
@@ -801,8 +833,10 @@ acpi_ps_parse_loop ( | |||
801 | /* Check for arguments that need to be processed */ | 833 | /* Check for arguments that need to be processed */ |
802 | 834 | ||
803 | if (walk_state->arg_count) { | 835 | if (walk_state->arg_count) { |
804 | /* There are arguments (complex ones), push Op and prepare for argument */ | 836 | /* |
805 | 837 | * There are arguments (complex ones), push Op and | |
838 | * prepare for argument | ||
839 | */ | ||
806 | status = acpi_ps_push_scope (parser_state, op, | 840 | status = acpi_ps_push_scope (parser_state, op, |
807 | walk_state->arg_types, walk_state->arg_count); | 841 | walk_state->arg_types, walk_state->arg_count); |
808 | if (ACPI_FAILURE (status)) { | 842 | if (ACPI_FAILURE (status)) { |
@@ -812,8 +846,10 @@ acpi_ps_parse_loop ( | |||
812 | continue; | 846 | continue; |
813 | } | 847 | } |
814 | 848 | ||
815 | /* All arguments have been processed -- Op is complete, prepare for next */ | 849 | /* |
816 | 850 | * All arguments have been processed -- Op is complete, | |
851 | * prepare for next | ||
852 | */ | ||
817 | walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); | 853 | walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); |
818 | if (walk_state->op_info->flags & AML_NAMED) { | 854 | if (walk_state->op_info->flags & AML_NAMED) { |
819 | if (acpi_gbl_depth) { | 855 | if (acpi_gbl_depth) { |
@@ -880,9 +916,8 @@ close_this_op: | |||
880 | 916 | ||
881 | case AE_CTRL_TRANSFER: | 917 | case AE_CTRL_TRANSFER: |
882 | 918 | ||
883 | /* | 919 | /* We are about to transfer to a called method. */ |
884 | * We are about to transfer to a called method. | 920 | |
885 | */ | ||
886 | walk_state->prev_op = op; | 921 | walk_state->prev_op = op; |
887 | walk_state->prev_arg_types = walk_state->arg_types; | 922 | walk_state->prev_arg_types = walk_state->arg_types; |
888 | return_ACPI_STATUS (status); | 923 | return_ACPI_STATUS (status); |
@@ -1051,10 +1086,7 @@ close_this_op: | |||
1051 | * | 1086 | * |
1052 | * FUNCTION: acpi_ps_parse_aml | 1087 | * FUNCTION: acpi_ps_parse_aml |
1053 | * | 1088 | * |
1054 | * PARAMETERS: start_scope - The starting point of the parse. Becomes the | 1089 | * PARAMETERS: walk_state - Current state |
1055 | * root of the parsed op tree. | ||
1056 | * Aml - Pointer to the raw AML code to parse | ||
1057 | * aml_size - Length of the AML to parse | ||
1058 | * | 1090 | * |
1059 | * | 1091 | * |
1060 | * RETURN: Status | 1092 | * RETURN: Status |
@@ -1076,8 +1108,10 @@ acpi_ps_parse_aml ( | |||
1076 | 1108 | ||
1077 | ACPI_FUNCTION_TRACE ("ps_parse_aml"); | 1109 | ACPI_FUNCTION_TRACE ("ps_parse_aml"); |
1078 | 1110 | ||
1079 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Entered with walk_state=%p Aml=%p size=%X\n", | 1111 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, |
1080 | walk_state, walk_state->parser_state.aml, walk_state->parser_state.aml_size)); | 1112 | "Entered with walk_state=%p Aml=%p size=%X\n", |
1113 | walk_state, walk_state->parser_state.aml, | ||
1114 | walk_state->parser_state.aml_size)); | ||
1081 | 1115 | ||
1082 | 1116 | ||
1083 | /* Create and initialize a new thread state */ | 1117 | /* Create and initialize a new thread state */ |
@@ -1142,9 +1176,10 @@ acpi_ps_parse_aml ( | |||
1142 | if ((status == AE_ALREADY_EXISTS) && | 1176 | if ((status == AE_ALREADY_EXISTS) && |
1143 | (!walk_state->method_desc->method.semaphore)) { | 1177 | (!walk_state->method_desc->method.semaphore)) { |
1144 | /* | 1178 | /* |
1145 | * This method is marked not_serialized, but it tried to create a named | 1179 | * This method is marked not_serialized, but it tried to create |
1146 | * object, causing the second thread entrance to fail. We will workaround | 1180 | * a named object, causing the second thread entrance to fail. |
1147 | * this by marking the method permanently as Serialized. | 1181 | * We will workaround this by marking the method permanently |
1182 | * as Serialized. | ||
1148 | */ | 1183 | */ |
1149 | walk_state->method_desc->method.method_flags |= AML_METHOD_SERIALIZED; | 1184 | walk_state->method_desc->method.method_flags |= AML_METHOD_SERIALIZED; |
1150 | walk_state->method_desc->method.concurrency = 1; | 1185 | walk_state->method_desc->method.concurrency = 1; |
@@ -1187,7 +1222,8 @@ acpi_ps_parse_aml ( | |||
1187 | 1222 | ||
1188 | previous_walk_state = walk_state; | 1223 | previous_walk_state = walk_state; |
1189 | 1224 | ||
1190 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "return_value=%p, implicit_value=%p State=%p\n", | 1225 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, |
1226 | "return_value=%p, implicit_value=%p State=%p\n", | ||
1191 | walk_state->return_desc, walk_state->implicit_return_obj, walk_state)); | 1227 | walk_state->return_desc, walk_state->implicit_return_obj, walk_state)); |
1192 | 1228 | ||
1193 | /* Check if we have restarted a preempted walk */ | 1229 | /* Check if we have restarted a preempted walk */ |
@@ -1231,12 +1267,14 @@ acpi_ps_parse_aml ( | |||
1231 | */ | 1267 | */ |
1232 | else if (previous_walk_state->caller_return_desc) { | 1268 | else if (previous_walk_state->caller_return_desc) { |
1233 | if (previous_walk_state->implicit_return_obj) { | 1269 | if (previous_walk_state->implicit_return_obj) { |
1234 | *(previous_walk_state->caller_return_desc) = previous_walk_state->implicit_return_obj; | 1270 | *(previous_walk_state->caller_return_desc) = |
1271 | previous_walk_state->implicit_return_obj; | ||
1235 | } | 1272 | } |
1236 | else { | 1273 | else { |
1237 | /* NULL if no return value */ | 1274 | /* NULL if no return value */ |
1238 | 1275 | ||
1239 | *(previous_walk_state->caller_return_desc) = previous_walk_state->return_desc; | 1276 | *(previous_walk_state->caller_return_desc) = |
1277 | previous_walk_state->return_desc; | ||
1240 | } | 1278 | } |
1241 | } | 1279 | } |
1242 | else { | 1280 | else { |
diff --git a/drivers/acpi/parser/psscope.c b/drivers/acpi/parser/psscope.c index dcbed49608b0..8dcd1b1e7131 100644 --- a/drivers/acpi/parser/psscope.c +++ b/drivers/acpi/parser/psscope.c | |||
@@ -65,6 +65,7 @@ union acpi_parse_object * | |||
65 | acpi_ps_get_parent_scope ( | 65 | acpi_ps_get_parent_scope ( |
66 | struct acpi_parse_state *parser_state) | 66 | struct acpi_parse_state *parser_state) |
67 | { | 67 | { |
68 | |||
68 | return (parser_state->scope->parse_scope.op); | 69 | return (parser_state->scope->parse_scope.op); |
69 | } | 70 | } |
70 | 71 | ||
@@ -87,8 +88,10 @@ u8 | |||
87 | acpi_ps_has_completed_scope ( | 88 | acpi_ps_has_completed_scope ( |
88 | struct acpi_parse_state *parser_state) | 89 | struct acpi_parse_state *parser_state) |
89 | { | 90 | { |
90 | return ((u8) ((parser_state->aml >= parser_state->scope->parse_scope.arg_end || | 91 | |
91 | !parser_state->scope->parse_scope.arg_count))); | 92 | return ((u8) |
93 | ((parser_state->aml >= parser_state->scope->parse_scope.arg_end || | ||
94 | !parser_state->scope->parse_scope.arg_count))); | ||
92 | } | 95 | } |
93 | 96 | ||
94 | 97 | ||
@@ -167,23 +170,23 @@ acpi_ps_push_scope ( | |||
167 | return_ACPI_STATUS (AE_NO_MEMORY); | 170 | return_ACPI_STATUS (AE_NO_MEMORY); |
168 | } | 171 | } |
169 | 172 | ||
170 | scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE; | 173 | scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE; |
171 | scope->parse_scope.op = op; | 174 | scope->parse_scope.op = op; |
172 | scope->parse_scope.arg_list = remaining_args; | 175 | scope->parse_scope.arg_list = remaining_args; |
173 | scope->parse_scope.arg_count = arg_count; | 176 | scope->parse_scope.arg_count = arg_count; |
174 | scope->parse_scope.pkg_end = parser_state->pkg_end; | 177 | scope->parse_scope.pkg_end = parser_state->pkg_end; |
175 | 178 | ||
176 | /* Push onto scope stack */ | 179 | /* Push onto scope stack */ |
177 | 180 | ||
178 | acpi_ut_push_generic_state (&parser_state->scope, scope); | 181 | acpi_ut_push_generic_state (&parser_state->scope, scope); |
179 | 182 | ||
180 | if (arg_count == ACPI_VAR_ARGS) { | 183 | if (arg_count == ACPI_VAR_ARGS) { |
181 | /* multiple arguments */ | 184 | /* Multiple arguments */ |
182 | 185 | ||
183 | scope->parse_scope.arg_end = parser_state->pkg_end; | 186 | scope->parse_scope.arg_end = parser_state->pkg_end; |
184 | } | 187 | } |
185 | else { | 188 | else { |
186 | /* single argument */ | 189 | /* Single argument */ |
187 | 190 | ||
188 | scope->parse_scope.arg_end = ACPI_TO_POINTER (ACPI_MAX_PTR); | 191 | scope->parse_scope.arg_end = ACPI_TO_POINTER (ACPI_MAX_PTR); |
189 | } | 192 | } |
@@ -221,18 +224,17 @@ acpi_ps_pop_scope ( | |||
221 | ACPI_FUNCTION_TRACE ("ps_pop_scope"); | 224 | ACPI_FUNCTION_TRACE ("ps_pop_scope"); |
222 | 225 | ||
223 | 226 | ||
224 | /* | 227 | /* Only pop the scope if there is in fact a next scope */ |
225 | * Only pop the scope if there is in fact a next scope | 228 | |
226 | */ | ||
227 | if (scope->common.next) { | 229 | if (scope->common.next) { |
228 | scope = acpi_ut_pop_generic_state (&parser_state->scope); | 230 | scope = acpi_ut_pop_generic_state (&parser_state->scope); |
229 | 231 | ||
230 | /* return to parsing previous op */ | 232 | /* return to parsing previous op */ |
231 | 233 | ||
232 | *op = scope->parse_scope.op; | 234 | *op = scope->parse_scope.op; |
233 | *arg_list = scope->parse_scope.arg_list; | 235 | *arg_list = scope->parse_scope.arg_list; |
234 | *arg_count = scope->parse_scope.arg_count; | 236 | *arg_count = scope->parse_scope.arg_count; |
235 | parser_state->pkg_end = scope->parse_scope.pkg_end; | 237 | parser_state->pkg_end = scope->parse_scope.pkg_end; |
236 | 238 | ||
237 | /* All done with this scope state structure */ | 239 | /* All done with this scope state structure */ |
238 | 240 | ||
@@ -241,12 +243,13 @@ acpi_ps_pop_scope ( | |||
241 | else { | 243 | else { |
242 | /* empty parse stack, prepare to fetch next opcode */ | 244 | /* empty parse stack, prepare to fetch next opcode */ |
243 | 245 | ||
244 | *op = NULL; | 246 | *op = NULL; |
245 | *arg_list = 0; | 247 | *arg_list = 0; |
246 | *arg_count = 0; | 248 | *arg_count = 0; |
247 | } | 249 | } |
248 | 250 | ||
249 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped Op %p Args %X\n", *op, *arg_count)); | 251 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, |
252 | "Popped Op %p Args %X\n", *op, *arg_count)); | ||
250 | return_VOID; | 253 | return_VOID; |
251 | } | 254 | } |
252 | 255 | ||
@@ -257,7 +260,7 @@ acpi_ps_pop_scope ( | |||
257 | * | 260 | * |
258 | * PARAMETERS: parser_state - Current parser state object | 261 | * PARAMETERS: parser_state - Current parser state object |
259 | * | 262 | * |
260 | * RETURN: Status | 263 | * RETURN: None |
261 | * | 264 | * |
262 | * DESCRIPTION: Destroy available list, remaining stack levels, and return | 265 | * DESCRIPTION: Destroy available list, remaining stack levels, and return |
263 | * root scope | 266 | * root scope |
diff --git a/drivers/acpi/parser/pstree.c b/drivers/acpi/parser/pstree.c index 2140bd1ac10b..d5aafe73fca0 100644 --- a/drivers/acpi/parser/pstree.c +++ b/drivers/acpi/parser/pstree.c | |||
@@ -49,6 +49,14 @@ | |||
49 | #define _COMPONENT ACPI_PARSER | 49 | #define _COMPONENT ACPI_PARSER |
50 | ACPI_MODULE_NAME ("pstree") | 50 | ACPI_MODULE_NAME ("pstree") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
55 | union acpi_parse_object * | ||
56 | acpi_ps_get_child ( | ||
57 | union acpi_parse_object *op); | ||
58 | #endif | ||
59 | |||
52 | 60 | ||
53 | /******************************************************************************* | 61 | /******************************************************************************* |
54 | * | 62 | * |
@@ -57,7 +65,7 @@ | |||
57 | * PARAMETERS: Op - Get an argument for this op | 65 | * PARAMETERS: Op - Get an argument for this op |
58 | * Argn - Nth argument to get | 66 | * Argn - Nth argument to get |
59 | * | 67 | * |
60 | * RETURN: The argument (as an Op object). NULL if argument does not exist | 68 | * RETURN: The argument (as an Op object). NULL if argument does not exist |
61 | * | 69 | * |
62 | * DESCRIPTION: Get the specified op's argument. | 70 | * DESCRIPTION: Get the specified op's argument. |
63 | * | 71 | * |
@@ -152,7 +160,6 @@ acpi_ps_append_arg ( | |||
152 | return; | 160 | return; |
153 | } | 161 | } |
154 | 162 | ||
155 | |||
156 | /* Append the argument to the linked argument list */ | 163 | /* Append the argument to the linked argument list */ |
157 | 164 | ||
158 | if (op->common.value.arg) { | 165 | if (op->common.value.arg) { |
@@ -164,14 +171,12 @@ acpi_ps_append_arg ( | |||
164 | } | 171 | } |
165 | prev_arg->common.next = arg; | 172 | prev_arg->common.next = arg; |
166 | } | 173 | } |
167 | |||
168 | else { | 174 | else { |
169 | /* No argument list, this will be the first argument */ | 175 | /* No argument list, this will be the first argument */ |
170 | 176 | ||
171 | op->common.value.arg = arg; | 177 | op->common.value.arg = arg; |
172 | } | 178 | } |
173 | 179 | ||
174 | |||
175 | /* Set the parent in this arg and any args linked after it */ | 180 | /* Set the parent in this arg and any args linked after it */ |
176 | 181 | ||
177 | while (arg) { | 182 | while (arg) { |
@@ -182,73 +187,6 @@ acpi_ps_append_arg ( | |||
182 | 187 | ||
183 | 188 | ||
184 | #ifdef ACPI_FUTURE_USAGE | 189 | #ifdef ACPI_FUTURE_USAGE |
185 | |||
186 | /******************************************************************************* | ||
187 | * | ||
188 | * FUNCTION: acpi_ps_get_child | ||
189 | * | ||
190 | * PARAMETERS: Op - Get the child of this Op | ||
191 | * | ||
192 | * RETURN: Child Op, Null if none is found. | ||
193 | * | ||
194 | * DESCRIPTION: Get op's children or NULL if none | ||
195 | * | ||
196 | ******************************************************************************/ | ||
197 | union acpi_parse_object * | ||
198 | acpi_ps_get_child ( | ||
199 | union acpi_parse_object *op) | ||
200 | { | ||
201 | union acpi_parse_object *child = NULL; | ||
202 | |||
203 | |||
204 | ACPI_FUNCTION_ENTRY (); | ||
205 | |||
206 | |||
207 | switch (op->common.aml_opcode) { | ||
208 | case AML_SCOPE_OP: | ||
209 | case AML_ELSE_OP: | ||
210 | case AML_DEVICE_OP: | ||
211 | case AML_THERMAL_ZONE_OP: | ||
212 | case AML_INT_METHODCALL_OP: | ||
213 | |||
214 | child = acpi_ps_get_arg (op, 0); | ||
215 | break; | ||
216 | |||
217 | |||
218 | case AML_BUFFER_OP: | ||
219 | case AML_PACKAGE_OP: | ||
220 | case AML_METHOD_OP: | ||
221 | case AML_IF_OP: | ||
222 | case AML_WHILE_OP: | ||
223 | case AML_FIELD_OP: | ||
224 | |||
225 | child = acpi_ps_get_arg (op, 1); | ||
226 | break; | ||
227 | |||
228 | |||
229 | case AML_POWER_RES_OP: | ||
230 | case AML_INDEX_FIELD_OP: | ||
231 | |||
232 | child = acpi_ps_get_arg (op, 2); | ||
233 | break; | ||
234 | |||
235 | |||
236 | case AML_PROCESSOR_OP: | ||
237 | case AML_BANK_FIELD_OP: | ||
238 | |||
239 | child = acpi_ps_get_arg (op, 3); | ||
240 | break; | ||
241 | |||
242 | |||
243 | default: | ||
244 | /* All others have no children */ | ||
245 | break; | ||
246 | } | ||
247 | |||
248 | return (child); | ||
249 | } | ||
250 | |||
251 | |||
252 | /******************************************************************************* | 190 | /******************************************************************************* |
253 | * | 191 | * |
254 | * FUNCTION: acpi_ps_get_depth_next | 192 | * FUNCTION: acpi_ps_get_depth_next |
@@ -280,21 +218,21 @@ acpi_ps_get_depth_next ( | |||
280 | return (NULL); | 218 | return (NULL); |
281 | } | 219 | } |
282 | 220 | ||
283 | /* look for an argument or child */ | 221 | /* Look for an argument or child */ |
284 | 222 | ||
285 | next = acpi_ps_get_arg (op, 0); | 223 | next = acpi_ps_get_arg (op, 0); |
286 | if (next) { | 224 | if (next) { |
287 | return (next); | 225 | return (next); |
288 | } | 226 | } |
289 | 227 | ||
290 | /* look for a sibling */ | 228 | /* Look for a sibling */ |
291 | 229 | ||
292 | next = op->common.next; | 230 | next = op->common.next; |
293 | if (next) { | 231 | if (next) { |
294 | return (next); | 232 | return (next); |
295 | } | 233 | } |
296 | 234 | ||
297 | /* look for a sibling of parent */ | 235 | /* Look for a sibling of parent */ |
298 | 236 | ||
299 | parent = op->common.parent; | 237 | parent = op->common.parent; |
300 | 238 | ||
@@ -305,13 +243,13 @@ acpi_ps_get_depth_next ( | |||
305 | } | 243 | } |
306 | 244 | ||
307 | if (arg == origin) { | 245 | if (arg == origin) { |
308 | /* reached parent of origin, end search */ | 246 | /* Reached parent of origin, end search */ |
309 | 247 | ||
310 | return (NULL); | 248 | return (NULL); |
311 | } | 249 | } |
312 | 250 | ||
313 | if (parent->common.next) { | 251 | if (parent->common.next) { |
314 | /* found sibling of parent */ | 252 | /* Found sibling of parent */ |
315 | 253 | ||
316 | return (parent->common.next); | 254 | return (parent->common.next); |
317 | } | 255 | } |
@@ -323,5 +261,74 @@ acpi_ps_get_depth_next ( | |||
323 | return (next); | 261 | return (next); |
324 | } | 262 | } |
325 | 263 | ||
264 | |||
265 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
266 | /******************************************************************************* | ||
267 | * | ||
268 | * FUNCTION: acpi_ps_get_child | ||
269 | * | ||
270 | * PARAMETERS: Op - Get the child of this Op | ||
271 | * | ||
272 | * RETURN: Child Op, Null if none is found. | ||
273 | * | ||
274 | * DESCRIPTION: Get op's children or NULL if none | ||
275 | * | ||
276 | ******************************************************************************/ | ||
277 | |||
278 | union acpi_parse_object * | ||
279 | acpi_ps_get_child ( | ||
280 | union acpi_parse_object *op) | ||
281 | { | ||
282 | union acpi_parse_object *child = NULL; | ||
283 | |||
284 | |||
285 | ACPI_FUNCTION_ENTRY (); | ||
286 | |||
287 | |||
288 | switch (op->common.aml_opcode) { | ||
289 | case AML_SCOPE_OP: | ||
290 | case AML_ELSE_OP: | ||
291 | case AML_DEVICE_OP: | ||
292 | case AML_THERMAL_ZONE_OP: | ||
293 | case AML_INT_METHODCALL_OP: | ||
294 | |||
295 | child = acpi_ps_get_arg (op, 0); | ||
296 | break; | ||
297 | |||
298 | |||
299 | case AML_BUFFER_OP: | ||
300 | case AML_PACKAGE_OP: | ||
301 | case AML_METHOD_OP: | ||
302 | case AML_IF_OP: | ||
303 | case AML_WHILE_OP: | ||
304 | case AML_FIELD_OP: | ||
305 | |||
306 | child = acpi_ps_get_arg (op, 1); | ||
307 | break; | ||
308 | |||
309 | |||
310 | case AML_POWER_RES_OP: | ||
311 | case AML_INDEX_FIELD_OP: | ||
312 | |||
313 | child = acpi_ps_get_arg (op, 2); | ||
314 | break; | ||
315 | |||
316 | |||
317 | case AML_PROCESSOR_OP: | ||
318 | case AML_BANK_FIELD_OP: | ||
319 | |||
320 | child = acpi_ps_get_arg (op, 3); | ||
321 | break; | ||
322 | |||
323 | |||
324 | default: | ||
325 | /* All others have no children */ | ||
326 | break; | ||
327 | } | ||
328 | |||
329 | return (child); | ||
330 | } | ||
331 | #endif | ||
332 | |||
326 | #endif /* ACPI_FUTURE_USAGE */ | 333 | #endif /* ACPI_FUTURE_USAGE */ |
327 | 334 | ||
diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c index b3597cb19f88..a10f88715d43 100644 --- a/drivers/acpi/parser/psutils.c +++ b/drivers/acpi/parser/psutils.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acparser.h> | 46 | #include <acpi/acparser.h> |
47 | #include <acpi/amlcode.h> | 47 | #include <acpi/amlcode.h> |
48 | #include <acpi/acnamesp.h> | ||
49 | 48 | ||
50 | #define _COMPONENT ACPI_PARSER | 49 | #define _COMPONENT ACPI_PARSER |
51 | ACPI_MODULE_NAME ("psutils") | 50 | ACPI_MODULE_NAME ("psutils") |
@@ -57,7 +56,7 @@ | |||
57 | * | 56 | * |
58 | * PARAMETERS: None | 57 | * PARAMETERS: None |
59 | * | 58 | * |
60 | * RETURN: scope_op | 59 | * RETURN: A new Scope object, null on failure |
61 | * | 60 | * |
62 | * DESCRIPTION: Create a Scope and associated namepath op with the root name | 61 | * DESCRIPTION: Create a Scope and associated namepath op with the root name |
63 | * | 62 | * |
@@ -75,7 +74,6 @@ acpi_ps_create_scope_op ( | |||
75 | return (NULL); | 74 | return (NULL); |
76 | } | 75 | } |
77 | 76 | ||
78 | |||
79 | scope_op->named.name = ACPI_ROOT_NAME; | 77 | scope_op->named.name = ACPI_ROOT_NAME; |
80 | return (scope_op); | 78 | return (scope_op); |
81 | } | 79 | } |
@@ -88,10 +86,9 @@ acpi_ps_create_scope_op ( | |||
88 | * PARAMETERS: Op - A newly allocated Op object | 86 | * PARAMETERS: Op - A newly allocated Op object |
89 | * Opcode - Opcode to store in the Op | 87 | * Opcode - Opcode to store in the Op |
90 | * | 88 | * |
91 | * RETURN: Status | 89 | * RETURN: None |
92 | * | 90 | * |
93 | * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on | 91 | * DESCRIPTION: Initialize a parse (Op) object |
94 | * opcode | ||
95 | * | 92 | * |
96 | ******************************************************************************/ | 93 | ******************************************************************************/ |
97 | 94 | ||
@@ -107,7 +104,8 @@ acpi_ps_init_op ( | |||
107 | op->common.aml_opcode = opcode; | 104 | op->common.aml_opcode = opcode; |
108 | 105 | ||
109 | ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name, | 106 | ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name, |
110 | (acpi_ps_get_opcode_info (opcode))->name, sizeof (op->common.aml_op_name))); | 107 | (acpi_ps_get_opcode_info (opcode))->name, |
108 | sizeof (op->common.aml_op_name))); | ||
111 | } | 109 | } |
112 | 110 | ||
113 | 111 | ||
@@ -117,7 +115,7 @@ acpi_ps_init_op ( | |||
117 | * | 115 | * |
118 | * PARAMETERS: Opcode - Opcode that will be stored in the new Op | 116 | * PARAMETERS: Opcode - Opcode that will be stored in the new Op |
119 | * | 117 | * |
120 | * RETURN: Pointer to the new Op. | 118 | * RETURN: Pointer to the new Op, null on failure |
121 | * | 119 | * |
122 | * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on | 120 | * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on |
123 | * opcode. A cache of opcodes is available for the pure | 121 | * opcode. A cache of opcodes is available for the pure |
@@ -275,7 +273,6 @@ acpi_ps_get_name ( | |||
275 | union acpi_parse_object *op) | 273 | union acpi_parse_object *op) |
276 | { | 274 | { |
277 | 275 | ||
278 | |||
279 | /* The "generic" object has no name associated with it */ | 276 | /* The "generic" object has no name associated with it */ |
280 | 277 | ||
281 | if (op->common.flags & ACPI_PARSEOP_GENERIC) { | 278 | if (op->common.flags & ACPI_PARSEOP_GENERIC) { |
diff --git a/drivers/acpi/parser/pswalk.c b/drivers/acpi/parser/pswalk.c index 110d2ce917b6..9d20cb2ceb51 100644 --- a/drivers/acpi/parser/pswalk.c +++ b/drivers/acpi/parser/pswalk.c | |||
@@ -90,17 +90,15 @@ acpi_ps_delete_parse_tree ( | |||
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
93 | /* | 93 | /* No more children, this Op is complete. */ |
94 | * No more children, this Op is complete. | 94 | |
95 | */ | ||
96 | next = op->common.next; | 95 | next = op->common.next; |
97 | parent = op->common.parent; | 96 | parent = op->common.parent; |
98 | 97 | ||
99 | acpi_ps_free_op (op); | 98 | acpi_ps_free_op (op); |
100 | 99 | ||
101 | /* | 100 | /* If we are back to the starting point, the walk is complete. */ |
102 | * If we are back to the starting point, the walk is complete. | 101 | |
103 | */ | ||
104 | if (op == subtree_root) { | 102 | if (op == subtree_root) { |
105 | return_VOID; | 103 | return_VOID; |
106 | } | 104 | } |
@@ -111,5 +109,6 @@ acpi_ps_delete_parse_tree ( | |||
111 | op = parent; | 109 | op = parent; |
112 | } | 110 | } |
113 | } | 111 | } |
112 | |||
114 | return_VOID; | 113 | return_VOID; |
115 | } | 114 | } |
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index b318ad24726d..dba893648e84 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c | |||
@@ -57,13 +57,16 @@ | |||
57 | * | 57 | * |
58 | * FUNCTION: acpi_psx_execute | 58 | * FUNCTION: acpi_psx_execute |
59 | * | 59 | * |
60 | * PARAMETERS: Info->Node - A method object containing both the AML | 60 | * PARAMETERS: Info - Method info block, contains: |
61 | * address and length. | 61 | * Node - Method Node to execute |
62 | * **Params - List of parameters to pass to method, | 62 | * Parameters - List of parameters to pass to the method, |
63 | * terminated by NULL. Params itself may be | 63 | * terminated by NULL. Params itself may be |
64 | * NULL if no parameters are being passed. | 64 | * NULL if no parameters are being passed. |
65 | * **return_obj_desc - Return object from execution of the | 65 | * return_object - Where to put method's return value (if |
66 | * method. | 66 | * any). If NULL, no value is returned. |
67 | * parameter_type - Type of Parameter list | ||
68 | * return_object - Where to put method's return value (if | ||
69 | * any). If NULL, no value is returned. | ||
67 | * | 70 | * |
68 | * RETURN: Status | 71 | * RETURN: Status |
69 | * | 72 | * |
@@ -196,9 +199,8 @@ acpi_psx_execute ( | |||
196 | goto cleanup3; | 199 | goto cleanup3; |
197 | } | 200 | } |
198 | 201 | ||
199 | /* | 202 | /* The walk of the parse tree is where we actually execute the method */ |
200 | * The walk of the parse tree is where we actually execute the method | 203 | |
201 | */ | ||
202 | status = acpi_ps_parse_aml (walk_state); | 204 | status = acpi_ps_parse_aml (walk_state); |
203 | goto cleanup2; /* Walk state already deleted */ | 205 | goto cleanup2; /* Walk state already deleted */ |
204 | 206 | ||
@@ -217,7 +219,8 @@ cleanup1: | |||
217 | for (i = 0; info->parameters[i]; i++) { | 219 | for (i = 0; info->parameters[i]; i++) { |
218 | /* Ignore errors, just do them all */ | 220 | /* Ignore errors, just do them all */ |
219 | 221 | ||
220 | (void) acpi_ut_update_object_reference (info->parameters[i], REF_DECREMENT); | 222 | (void) acpi_ut_update_object_reference ( |
223 | info->parameters[i], REF_DECREMENT); | ||
221 | } | 224 | } |
222 | } | 225 | } |
223 | 226 | ||
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 520b28ad0740..6ad0e77df9b3 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -72,10 +72,12 @@ struct acpi_pci_link_irq { | |||
72 | u8 active; /* Current IRQ */ | 72 | u8 active; /* Current IRQ */ |
73 | u8 edge_level; /* All IRQs */ | 73 | u8 edge_level; /* All IRQs */ |
74 | u8 active_high_low; /* All IRQs */ | 74 | u8 active_high_low; /* All IRQs */ |
75 | u8 initialized; | ||
76 | u8 resource_type; | 75 | u8 resource_type; |
77 | u8 possible_count; | 76 | u8 possible_count; |
78 | u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; | 77 | u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; |
78 | u8 initialized:1; | ||
79 | u8 suspend_resume:1; | ||
80 | u8 reserved:6; | ||
79 | }; | 81 | }; |
80 | 82 | ||
81 | struct acpi_pci_link { | 83 | struct acpi_pci_link { |
@@ -530,6 +532,10 @@ static int acpi_pci_link_allocate( | |||
530 | 532 | ||
531 | ACPI_FUNCTION_TRACE("acpi_pci_link_allocate"); | 533 | ACPI_FUNCTION_TRACE("acpi_pci_link_allocate"); |
532 | 534 | ||
535 | if (link->irq.suspend_resume) { | ||
536 | acpi_pci_link_set(link, link->irq.active); | ||
537 | link->irq.suspend_resume = 0; | ||
538 | } | ||
533 | if (link->irq.initialized) | 539 | if (link->irq.initialized) |
534 | return_VALUE(0); | 540 | return_VALUE(0); |
535 | 541 | ||
@@ -713,38 +719,24 @@ end: | |||
713 | return_VALUE(result); | 719 | return_VALUE(result); |
714 | } | 720 | } |
715 | 721 | ||
716 | |||
717 | static int | ||
718 | acpi_pci_link_resume ( | ||
719 | struct acpi_pci_link *link) | ||
720 | { | ||
721 | ACPI_FUNCTION_TRACE("acpi_pci_link_resume"); | ||
722 | |||
723 | if (link->irq.active && link->irq.initialized) | ||
724 | return_VALUE(acpi_pci_link_set(link, link->irq.active)); | ||
725 | else | ||
726 | return_VALUE(0); | ||
727 | } | ||
728 | |||
729 | |||
730 | static int | 722 | static int |
731 | irqrouter_resume( | 723 | irqrouter_suspend( |
732 | struct sys_device *dev) | 724 | struct sys_device *dev, |
725 | u32 state) | ||
733 | { | 726 | { |
734 | struct list_head *node = NULL; | 727 | struct list_head *node = NULL; |
735 | struct acpi_pci_link *link = NULL; | 728 | struct acpi_pci_link *link = NULL; |
736 | 729 | ||
737 | ACPI_FUNCTION_TRACE("irqrouter_resume"); | 730 | ACPI_FUNCTION_TRACE("irqrouter_suspend"); |
738 | 731 | ||
739 | list_for_each(node, &acpi_link.entries) { | 732 | list_for_each(node, &acpi_link.entries) { |
740 | |||
741 | link = list_entry(node, struct acpi_pci_link, node); | 733 | link = list_entry(node, struct acpi_pci_link, node); |
742 | if (!link) { | 734 | if (!link) { |
743 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); | 735 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); |
744 | continue; | 736 | continue; |
745 | } | 737 | } |
746 | 738 | if (link->irq.active && link->irq.initialized) | |
747 | acpi_pci_link_resume(link); | 739 | link->irq.suspend_resume = 1; |
748 | } | 740 | } |
749 | return_VALUE(0); | 741 | return_VALUE(0); |
750 | } | 742 | } |
@@ -812,9 +804,12 @@ static int __init acpi_irq_penalty_update(char *str, int used) | |||
812 | * There is no ISA_POSSIBLE weight, so we simply use | 804 | * There is no ISA_POSSIBLE weight, so we simply use |
813 | * the (small) PCI_USING penalty. | 805 | * the (small) PCI_USING penalty. |
814 | */ | 806 | */ |
815 | void acpi_penalize_isa_irq(int irq) | 807 | void acpi_penalize_isa_irq(int irq, int active) |
816 | { | 808 | { |
817 | acpi_irq_penalty[irq] += PIRQ_PENALTY_PCI_USING; | 809 | if (active) |
810 | acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_USED; | ||
811 | else | ||
812 | acpi_irq_penalty[irq] += PIRQ_PENALTY_PCI_USING; | ||
818 | } | 813 | } |
819 | 814 | ||
820 | /* | 815 | /* |
@@ -856,7 +851,7 @@ __setup("acpi_irq_balance", acpi_irq_balance_set); | |||
856 | 851 | ||
857 | static struct sysdev_class irqrouter_sysdev_class = { | 852 | static struct sysdev_class irqrouter_sysdev_class = { |
858 | set_kset_name("irqrouter"), | 853 | set_kset_name("irqrouter"), |
859 | .resume = irqrouter_resume, | 854 | .suspend = irqrouter_suspend, |
860 | }; | 855 | }; |
861 | 856 | ||
862 | 857 | ||
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 76156ac91bd3..d56a439ac614 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -256,6 +256,43 @@ acpi_processor_errata ( | |||
256 | 256 | ||
257 | 257 | ||
258 | /* -------------------------------------------------------------------------- | 258 | /* -------------------------------------------------------------------------- |
259 | Common ACPI processor fucntions | ||
260 | -------------------------------------------------------------------------- */ | ||
261 | |||
262 | /* | ||
263 | * _PDC is required for a BIOS-OS handshake for most of the newer | ||
264 | * ACPI processor features. | ||
265 | */ | ||
266 | |||
267 | int acpi_processor_set_pdc(struct acpi_processor *pr, | ||
268 | struct acpi_object_list *pdc_in) | ||
269 | { | ||
270 | acpi_status status = AE_OK; | ||
271 | u32 arg0_buf[3]; | ||
272 | union acpi_object arg0 = {ACPI_TYPE_BUFFER}; | ||
273 | struct acpi_object_list no_object = {1, &arg0}; | ||
274 | struct acpi_object_list *pdc; | ||
275 | |||
276 | ACPI_FUNCTION_TRACE("acpi_processor_set_pdc"); | ||
277 | |||
278 | arg0.buffer.length = 12; | ||
279 | arg0.buffer.pointer = (u8 *) arg0_buf; | ||
280 | arg0_buf[0] = ACPI_PDC_REVISION_ID; | ||
281 | arg0_buf[1] = 0; | ||
282 | arg0_buf[2] = 0; | ||
283 | |||
284 | pdc = (pdc_in) ? pdc_in : &no_object; | ||
285 | |||
286 | status = acpi_evaluate_object(pr->handle, "_PDC", pdc, NULL); | ||
287 | |||
288 | if ((ACPI_FAILURE(status)) && (pdc_in)) | ||
289 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Error evaluating _PDC, using legacy perf. control...\n")); | ||
290 | |||
291 | return_VALUE(status); | ||
292 | } | ||
293 | |||
294 | |||
295 | /* -------------------------------------------------------------------------- | ||
259 | FS Interface (/proc) | 296 | FS Interface (/proc) |
260 | -------------------------------------------------------------------------- */ | 297 | -------------------------------------------------------------------------- */ |
261 | 298 | ||
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index c9d671cf7857..893b074e3d1a 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -6,6 +6,8 @@ | |||
6 | * Copyright (C) 2004 Dominik Brodowski <linux@brodo.de> | 6 | * Copyright (C) 2004 Dominik Brodowski <linux@brodo.de> |
7 | * Copyright (C) 2004 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> | 7 | * Copyright (C) 2004 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> |
8 | * - Added processor hotplug support | 8 | * - Added processor hotplug support |
9 | * Copyright (C) 2005 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> | ||
10 | * - Added support for C3 on SMP | ||
9 | * | 11 | * |
10 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 12 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
11 | * | 13 | * |
@@ -142,7 +144,7 @@ acpi_processor_power_activate ( | |||
142 | switch (old->type) { | 144 | switch (old->type) { |
143 | case ACPI_STATE_C3: | 145 | case ACPI_STATE_C3: |
144 | /* Disable bus master reload */ | 146 | /* Disable bus master reload */ |
145 | if (new->type != ACPI_STATE_C3) | 147 | if (new->type != ACPI_STATE_C3 && pr->flags.bm_check) |
146 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0, ACPI_MTX_DO_NOT_LOCK); | 148 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0, ACPI_MTX_DO_NOT_LOCK); |
147 | break; | 149 | break; |
148 | } | 150 | } |
@@ -152,7 +154,7 @@ acpi_processor_power_activate ( | |||
152 | switch (new->type) { | 154 | switch (new->type) { |
153 | case ACPI_STATE_C3: | 155 | case ACPI_STATE_C3: |
154 | /* Enable bus master reload */ | 156 | /* Enable bus master reload */ |
155 | if (old->type != ACPI_STATE_C3) | 157 | if (old->type != ACPI_STATE_C3 && pr->flags.bm_check) |
156 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1, ACPI_MTX_DO_NOT_LOCK); | 158 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1, ACPI_MTX_DO_NOT_LOCK); |
157 | break; | 159 | break; |
158 | } | 160 | } |
@@ -163,6 +165,9 @@ acpi_processor_power_activate ( | |||
163 | } | 165 | } |
164 | 166 | ||
165 | 167 | ||
168 | static atomic_t c3_cpu_count; | ||
169 | |||
170 | |||
166 | static void acpi_processor_idle (void) | 171 | static void acpi_processor_idle (void) |
167 | { | 172 | { |
168 | struct acpi_processor *pr = NULL; | 173 | struct acpi_processor *pr = NULL; |
@@ -297,8 +302,22 @@ static void acpi_processor_idle (void) | |||
297 | break; | 302 | break; |
298 | 303 | ||
299 | case ACPI_STATE_C3: | 304 | case ACPI_STATE_C3: |
300 | /* Disable bus master arbitration */ | 305 | |
301 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_DO_NOT_LOCK); | 306 | if (pr->flags.bm_check) { |
307 | if (atomic_inc_return(&c3_cpu_count) == | ||
308 | num_online_cpus()) { | ||
309 | /* | ||
310 | * All CPUs are trying to go to C3 | ||
311 | * Disable bus master arbitration | ||
312 | */ | ||
313 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1, | ||
314 | ACPI_MTX_DO_NOT_LOCK); | ||
315 | } | ||
316 | } else { | ||
317 | /* SMP with no shared cache... Invalidate cache */ | ||
318 | ACPI_FLUSH_CPU_CACHE(); | ||
319 | } | ||
320 | |||
302 | /* Get start time (ticks) */ | 321 | /* Get start time (ticks) */ |
303 | t1 = inl(acpi_fadt.xpm_tmr_blk.address); | 322 | t1 = inl(acpi_fadt.xpm_tmr_blk.address); |
304 | /* Invoke C3 */ | 323 | /* Invoke C3 */ |
@@ -307,8 +326,12 @@ static void acpi_processor_idle (void) | |||
307 | t2 = inl(acpi_fadt.xpm_tmr_blk.address); | 326 | t2 = inl(acpi_fadt.xpm_tmr_blk.address); |
308 | /* Get end time (ticks) */ | 327 | /* Get end time (ticks) */ |
309 | t2 = inl(acpi_fadt.xpm_tmr_blk.address); | 328 | t2 = inl(acpi_fadt.xpm_tmr_blk.address); |
310 | /* Enable bus master arbitration */ | 329 | if (pr->flags.bm_check) { |
311 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_DO_NOT_LOCK); | 330 | /* Enable bus master arbitration */ |
331 | atomic_dec(&c3_cpu_count); | ||
332 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_DO_NOT_LOCK); | ||
333 | } | ||
334 | |||
312 | /* Re-enable interrupts */ | 335 | /* Re-enable interrupts */ |
313 | local_irq_enable(); | 336 | local_irq_enable(); |
314 | /* Compute time (ticks) that we were actually asleep */ | 337 | /* Compute time (ticks) that we were actually asleep */ |
@@ -519,6 +542,29 @@ static int acpi_processor_get_power_info_fadt (struct acpi_processor *pr) | |||
519 | } | 542 | } |
520 | 543 | ||
521 | 544 | ||
545 | static int acpi_processor_get_power_info_default_c1 (struct acpi_processor *pr) | ||
546 | { | ||
547 | int i; | ||
548 | |||
549 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); | ||
550 | |||
551 | for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) | ||
552 | memset(pr->power.states, 0, sizeof(struct acpi_processor_cx)); | ||
553 | |||
554 | /* if info is obtained from pblk/fadt, type equals state */ | ||
555 | pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; | ||
556 | pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2; | ||
557 | pr->power.states[ACPI_STATE_C3].type = ACPI_STATE_C3; | ||
558 | |||
559 | /* the C0 state only exists as a filler in our array, | ||
560 | * and all processors need to support C1 */ | ||
561 | pr->power.states[ACPI_STATE_C0].valid = 1; | ||
562 | pr->power.states[ACPI_STATE_C1].valid = 1; | ||
563 | |||
564 | return_VALUE(0); | ||
565 | } | ||
566 | |||
567 | |||
522 | static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) | 568 | static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) |
523 | { | 569 | { |
524 | acpi_status status = 0; | 570 | acpi_status status = 0; |
@@ -529,9 +575,6 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) | |||
529 | 575 | ||
530 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_cst"); | 576 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_cst"); |
531 | 577 | ||
532 | if (errata.smp) | ||
533 | return_VALUE(-ENODEV); | ||
534 | |||
535 | if (nocst) | 578 | if (nocst) |
536 | return_VALUE(-ENODEV); | 579 | return_VALUE(-ENODEV); |
537 | 580 | ||
@@ -664,13 +707,6 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) | |||
664 | return_VOID; | 707 | return_VOID; |
665 | } | 708 | } |
666 | 709 | ||
667 | /* We're (currently) only supporting C2 on UP */ | ||
668 | else if (errata.smp) { | ||
669 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
670 | "C2 not supported in SMP mode\n")); | ||
671 | return_VOID; | ||
672 | } | ||
673 | |||
674 | /* | 710 | /* |
675 | * Otherwise we've met all of our C2 requirements. | 711 | * Otherwise we've met all of our C2 requirements. |
676 | * Normalize the C2 latency to expidite policy | 712 | * Normalize the C2 latency to expidite policy |
@@ -686,6 +722,8 @@ static void acpi_processor_power_verify_c3( | |||
686 | struct acpi_processor *pr, | 722 | struct acpi_processor *pr, |
687 | struct acpi_processor_cx *cx) | 723 | struct acpi_processor_cx *cx) |
688 | { | 724 | { |
725 | static int bm_check_flag; | ||
726 | |||
689 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c3"); | 727 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c3"); |
690 | 728 | ||
691 | if (!cx->address) | 729 | if (!cx->address) |
@@ -702,20 +740,6 @@ static void acpi_processor_power_verify_c3( | |||
702 | return_VOID; | 740 | return_VOID; |
703 | } | 741 | } |
704 | 742 | ||
705 | /* bus mastering control is necessary */ | ||
706 | else if (!pr->flags.bm_control) { | ||
707 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
708 | "C3 support requires bus mastering control\n")); | ||
709 | return_VOID; | ||
710 | } | ||
711 | |||
712 | /* We're (currently) only supporting C2 on UP */ | ||
713 | else if (errata.smp) { | ||
714 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
715 | "C3 not supported in SMP mode\n")); | ||
716 | return_VOID; | ||
717 | } | ||
718 | |||
719 | /* | 743 | /* |
720 | * PIIX4 Erratum #18: We don't support C3 when Type-F (fast) | 744 | * PIIX4 Erratum #18: We don't support C3 when Type-F (fast) |
721 | * DMA transfers are used by any ISA device to avoid livelock. | 745 | * DMA transfers are used by any ISA device to avoid livelock. |
@@ -729,6 +753,39 @@ static void acpi_processor_power_verify_c3( | |||
729 | return_VOID; | 753 | return_VOID; |
730 | } | 754 | } |
731 | 755 | ||
756 | /* All the logic here assumes flags.bm_check is same across all CPUs */ | ||
757 | if (!bm_check_flag) { | ||
758 | /* Determine whether bm_check is needed based on CPU */ | ||
759 | acpi_processor_power_init_bm_check(&(pr->flags), pr->id); | ||
760 | bm_check_flag = pr->flags.bm_check; | ||
761 | } else { | ||
762 | pr->flags.bm_check = bm_check_flag; | ||
763 | } | ||
764 | |||
765 | if (pr->flags.bm_check) { | ||
766 | printk("Disabling BM access before entering C3\n"); | ||
767 | /* bus mastering control is necessary */ | ||
768 | if (!pr->flags.bm_control) { | ||
769 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
770 | "C3 support requires bus mastering control\n")); | ||
771 | return_VOID; | ||
772 | } | ||
773 | } else { | ||
774 | printk("Invalidating cache before entering C3\n"); | ||
775 | /* | ||
776 | * WBINVD should be set in fadt, for C3 state to be | ||
777 | * supported on when bm_check is not required. | ||
778 | */ | ||
779 | if (acpi_fadt.wb_invd != 1) { | ||
780 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
781 | "Cache invalidation should work properly" | ||
782 | " for C3 to be enabled on SMP systems\n")); | ||
783 | return_VOID; | ||
784 | } | ||
785 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, | ||
786 | 0, ACPI_MTX_DO_NOT_LOCK); | ||
787 | } | ||
788 | |||
732 | /* | 789 | /* |
733 | * Otherwise we've met all of our C3 requirements. | 790 | * Otherwise we've met all of our C3 requirements. |
734 | * Normalize the C3 latency to expidite policy. Enable | 791 | * Normalize the C3 latency to expidite policy. Enable |
@@ -737,7 +794,6 @@ static void acpi_processor_power_verify_c3( | |||
737 | */ | 794 | */ |
738 | cx->valid = 1; | 795 | cx->valid = 1; |
739 | cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); | 796 | cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); |
740 | pr->flags.bm_check = 1; | ||
741 | 797 | ||
742 | return_VOID; | 798 | return_VOID; |
743 | } | 799 | } |
@@ -787,10 +843,7 @@ static int acpi_processor_get_power_info ( | |||
787 | if ((result) || (acpi_processor_power_verify(pr) < 2)) { | 843 | if ((result) || (acpi_processor_power_verify(pr) < 2)) { |
788 | result = acpi_processor_get_power_info_fadt(pr); | 844 | result = acpi_processor_get_power_info_fadt(pr); |
789 | if (result) | 845 | if (result) |
790 | return_VALUE(result); | 846 | result = acpi_processor_get_power_info_default_c1(pr); |
791 | |||
792 | if (acpi_processor_power_verify(pr) < 2) | ||
793 | return_VALUE(-ENODEV); | ||
794 | } | 847 | } |
795 | 848 | ||
796 | /* | 849 | /* |
@@ -810,11 +863,10 @@ static int acpi_processor_get_power_info ( | |||
810 | * CPU as being "idle manageable" | 863 | * CPU as being "idle manageable" |
811 | */ | 864 | */ |
812 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { | 865 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { |
813 | if (pr->power.states[i].valid) | 866 | if (pr->power.states[i].valid) { |
814 | pr->power.count = i; | 867 | pr->power.count = i; |
815 | if ((pr->power.states[i].valid) && | ||
816 | (pr->power.states[i].type >= ACPI_STATE_C2)) | ||
817 | pr->flags.power = 1; | 868 | pr->flags.power = 1; |
869 | } | ||
818 | } | 870 | } |
819 | 871 | ||
820 | return_VALUE(0); | 872 | return_VALUE(0); |
@@ -829,7 +881,7 @@ int acpi_processor_cst_has_changed (struct acpi_processor *pr) | |||
829 | if (!pr) | 881 | if (!pr) |
830 | return_VALUE(-EINVAL); | 882 | return_VALUE(-EINVAL); |
831 | 883 | ||
832 | if (errata.smp || nocst) { | 884 | if ( nocst) { |
833 | return_VALUE(-ENODEV); | 885 | return_VALUE(-ENODEV); |
834 | } | 886 | } |
835 | 887 | ||
@@ -929,7 +981,6 @@ static struct file_operations acpi_processor_power_fops = { | |||
929 | .release = single_release, | 981 | .release = single_release, |
930 | }; | 982 | }; |
931 | 983 | ||
932 | |||
933 | int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device) | 984 | int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device) |
934 | { | 985 | { |
935 | acpi_status status = 0; | 986 | acpi_status status = 0; |
@@ -946,7 +997,10 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev | |||
946 | first_run++; | 997 | first_run++; |
947 | } | 998 | } |
948 | 999 | ||
949 | if (!errata.smp && (pr->id == 0) && acpi_fadt.cst_cnt && !nocst) { | 1000 | if (!pr) |
1001 | return_VALUE(-EINVAL); | ||
1002 | |||
1003 | if (acpi_fadt.cst_cnt && !nocst) { | ||
950 | status = acpi_os_write_port(acpi_fadt.smi_cmd, acpi_fadt.cst_cnt, 8); | 1004 | status = acpi_os_write_port(acpi_fadt.smi_cmd, acpi_fadt.cst_cnt, 8); |
951 | if (ACPI_FAILURE(status)) { | 1005 | if (ACPI_FAILURE(status)) { |
952 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1006 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
@@ -954,6 +1008,8 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev | |||
954 | } | 1008 | } |
955 | } | 1009 | } |
956 | 1010 | ||
1011 | acpi_processor_power_init_pdc(&(pr->power), pr->id); | ||
1012 | acpi_processor_set_pdc(pr, pr->power.pdc); | ||
957 | acpi_processor_get_power_info(pr); | 1013 | acpi_processor_get_power_info(pr); |
958 | 1014 | ||
959 | /* | 1015 | /* |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index a9a1a8fe3199..1f0d6256302f 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -165,37 +165,6 @@ void acpi_processor_ppc_exit(void) { | |||
165 | acpi_processor_ppc_status &= ~PPC_REGISTERED; | 165 | acpi_processor_ppc_status &= ~PPC_REGISTERED; |
166 | } | 166 | } |
167 | 167 | ||
168 | /* | ||
169 | * when registering a cpufreq driver with this ACPI processor driver, the | ||
170 | * _PCT and _PSS structures are read out and written into struct | ||
171 | * acpi_processor_performance. | ||
172 | */ | ||
173 | static int acpi_processor_set_pdc (struct acpi_processor *pr) | ||
174 | { | ||
175 | acpi_status status = AE_OK; | ||
176 | u32 arg0_buf[3]; | ||
177 | union acpi_object arg0 = {ACPI_TYPE_BUFFER}; | ||
178 | struct acpi_object_list no_object = {1, &arg0}; | ||
179 | struct acpi_object_list *pdc; | ||
180 | |||
181 | ACPI_FUNCTION_TRACE("acpi_processor_set_pdc"); | ||
182 | |||
183 | arg0.buffer.length = 12; | ||
184 | arg0.buffer.pointer = (u8 *) arg0_buf; | ||
185 | arg0_buf[0] = ACPI_PDC_REVISION_ID; | ||
186 | arg0_buf[1] = 0; | ||
187 | arg0_buf[2] = 0; | ||
188 | |||
189 | pdc = (pr->performance->pdc) ? pr->performance->pdc : &no_object; | ||
190 | |||
191 | status = acpi_evaluate_object(pr->handle, "_PDC", pdc, NULL); | ||
192 | |||
193 | if ((ACPI_FAILURE(status)) && (pr->performance->pdc)) | ||
194 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Error evaluating _PDC, using legacy perf. control...\n")); | ||
195 | |||
196 | return_VALUE(status); | ||
197 | } | ||
198 | |||
199 | 168 | ||
200 | static int | 169 | static int |
201 | acpi_processor_get_performance_control ( | 170 | acpi_processor_get_performance_control ( |
@@ -357,7 +326,7 @@ acpi_processor_get_performance_info ( | |||
357 | if (!pr || !pr->performance || !pr->handle) | 326 | if (!pr || !pr->performance || !pr->handle) |
358 | return_VALUE(-EINVAL); | 327 | return_VALUE(-EINVAL); |
359 | 328 | ||
360 | acpi_processor_set_pdc(pr); | 329 | acpi_processor_set_pdc(pr, pr->performance->pdc); |
361 | 330 | ||
362 | status = acpi_get_handle(pr->handle, "_PCT", &handle); | 331 | status = acpi_get_handle(pr->handle, "_PCT", &handle); |
363 | if (ACPI_FAILURE(status)) { | 332 | if (ACPI_FAILURE(status)) { |
diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c index 4788c079735d..55d264771c48 100644 --- a/drivers/acpi/resources/rsaddr.c +++ b/drivers/acpi/resources/rsaddr.c | |||
@@ -77,21 +77,21 @@ acpi_rs_address16_resource ( | |||
77 | u8 **output_buffer, | 77 | u8 **output_buffer, |
78 | acpi_size *structure_size) | 78 | acpi_size *structure_size) |
79 | { | 79 | { |
80 | u8 *buffer = byte_stream_buffer; | ||
81 | struct acpi_resource *output_struct = (void *) *output_buffer; | ||
82 | u8 *temp_ptr; | ||
83 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16); | ||
84 | u32 index; | 80 | u32 index; |
85 | u16 temp16; | 81 | u16 temp16; |
86 | u8 temp8; | 82 | u8 temp8; |
83 | u8 *temp_ptr; | ||
84 | u8 *buffer = byte_stream_buffer; | ||
85 | struct acpi_resource *output_struct = (void *) *output_buffer; | ||
86 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( | ||
87 | struct acpi_resource_address16); | ||
87 | 88 | ||
88 | 89 | ||
89 | ACPI_FUNCTION_TRACE ("rs_address16_resource"); | 90 | ACPI_FUNCTION_TRACE ("rs_address16_resource"); |
90 | 91 | ||
91 | 92 | ||
92 | /* | 93 | /* Point past the Descriptor to get the number of bytes consumed */ |
93 | * Point past the Descriptor to get the number of bytes consumed | 94 | |
94 | */ | ||
95 | buffer += 1; | 95 | buffer += 1; |
96 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 96 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
97 | 97 | ||
@@ -104,9 +104,8 @@ acpi_rs_address16_resource ( | |||
104 | *bytes_consumed = temp16 + 3; | 104 | *bytes_consumed = temp16 + 3; |
105 | output_struct->id = ACPI_RSTYPE_ADDRESS16; | 105 | output_struct->id = ACPI_RSTYPE_ADDRESS16; |
106 | 106 | ||
107 | /* | 107 | /* Get the Resource Type (Byte3) */ |
108 | * Get the Resource Type (Byte3) | 108 | |
109 | */ | ||
110 | buffer += 2; | 109 | buffer += 2; |
111 | temp8 = *buffer; | 110 | temp8 = *buffer; |
112 | 111 | ||
@@ -118,9 +117,8 @@ acpi_rs_address16_resource ( | |||
118 | 117 | ||
119 | output_struct->data.address16.resource_type = temp8; | 118 | output_struct->data.address16.resource_type = temp8; |
120 | 119 | ||
121 | /* | 120 | /* Get the General Flags (Byte4) */ |
122 | * Get the General Flags (Byte4) | 121 | |
123 | */ | ||
124 | buffer += 1; | 122 | buffer += 1; |
125 | temp8 = *buffer; | 123 | temp8 = *buffer; |
126 | 124 | ||
@@ -140,9 +138,8 @@ acpi_rs_address16_resource ( | |||
140 | 138 | ||
141 | output_struct->data.address16.max_address_fixed = (temp8 >> 3) & 0x01; | 139 | output_struct->data.address16.max_address_fixed = (temp8 >> 3) & 0x01; |
142 | 140 | ||
143 | /* | 141 | /* Get the Type Specific Flags (Byte5) */ |
144 | * Get the Type Specific Flags (Byte5) | 142 | |
145 | */ | ||
146 | buffer += 1; | 143 | buffer += 1; |
147 | temp8 = *buffer; | 144 | temp8 = *buffer; |
148 | 145 | ||
@@ -165,39 +162,34 @@ acpi_rs_address16_resource ( | |||
165 | } | 162 | } |
166 | } | 163 | } |
167 | 164 | ||
168 | /* | 165 | /* Get Granularity (Bytes 6-7) */ |
169 | * Get Granularity (Bytes 6-7) | 166 | |
170 | */ | ||
171 | buffer += 1; | 167 | buffer += 1; |
172 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.granularity, buffer); | 168 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.granularity, buffer); |
173 | 169 | ||
174 | /* | 170 | /* Get min_address_range (Bytes 8-9) */ |
175 | * Get min_address_range (Bytes 8-9) | 171 | |
176 | */ | ||
177 | buffer += 2; | 172 | buffer += 2; |
178 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.min_address_range, buffer); | 173 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.min_address_range, buffer); |
179 | 174 | ||
180 | /* | 175 | /* Get max_address_range (Bytes 10-11) */ |
181 | * Get max_address_range (Bytes 10-11) | 176 | |
182 | */ | ||
183 | buffer += 2; | 177 | buffer += 2; |
184 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.max_address_range, buffer); | 178 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.max_address_range, buffer); |
185 | 179 | ||
186 | /* | 180 | /* Get address_translation_offset (Bytes 12-13) */ |
187 | * Get address_translation_offset (Bytes 12-13) | 181 | |
188 | */ | ||
189 | buffer += 2; | 182 | buffer += 2; |
190 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_translation_offset, buffer); | 183 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_translation_offset, |
184 | buffer); | ||
185 | |||
186 | /* Get address_length (Bytes 14-15) */ | ||
191 | 187 | ||
192 | /* | ||
193 | * Get address_length (Bytes 14-15) | ||
194 | */ | ||
195 | buffer += 2; | 188 | buffer += 2; |
196 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_length, buffer); | 189 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_length, buffer); |
197 | 190 | ||
198 | /* | 191 | /* Resource Source Index (if present) */ |
199 | * Resource Source Index (if present) | 192 | |
200 | */ | ||
201 | buffer += 2; | 193 | buffer += 2; |
202 | 194 | ||
203 | /* | 195 | /* |
@@ -225,7 +217,8 @@ acpi_rs_address16_resource ( | |||
225 | output_struct->data.address16.resource_source.string_ptr = | 217 | output_struct->data.address16.resource_source.string_ptr = |
226 | (char *)((u8 * )output_struct + struct_size); | 218 | (char *)((u8 * )output_struct + struct_size); |
227 | 219 | ||
228 | temp_ptr = (u8 *) output_struct->data.address16.resource_source.string_ptr; | 220 | temp_ptr = (u8 *) |
221 | output_struct->data.address16.resource_source.string_ptr; | ||
229 | 222 | ||
230 | /* Copy the string into the buffer */ | 223 | /* Copy the string into the buffer */ |
231 | 224 | ||
@@ -239,9 +232,8 @@ acpi_rs_address16_resource ( | |||
239 | index += 1; | 232 | index += 1; |
240 | } | 233 | } |
241 | 234 | ||
242 | /* | 235 | /* Add the terminating null */ |
243 | * Add the terminating null | 236 | |
244 | */ | ||
245 | *temp_ptr = 0x00; | 237 | *temp_ptr = 0x00; |
246 | 238 | ||
247 | output_struct->data.address16.resource_source.string_length = index + 1; | 239 | output_struct->data.address16.resource_source.string_length = index + 1; |
@@ -260,14 +252,12 @@ acpi_rs_address16_resource ( | |||
260 | output_struct->data.address16.resource_source.string_ptr = NULL; | 252 | output_struct->data.address16.resource_source.string_ptr = NULL; |
261 | } | 253 | } |
262 | 254 | ||
263 | /* | 255 | /* Set the Length parameter */ |
264 | * Set the Length parameter | 256 | |
265 | */ | ||
266 | output_struct->length = (u32) struct_size; | 257 | output_struct->length = (u32) struct_size; |
267 | 258 | ||
268 | /* | 259 | /* Return the final size of the structure */ |
269 | * Return the final size of the structure | 260 | |
270 | */ | ||
271 | *structure_size = struct_size; | 261 | *structure_size = struct_size; |
272 | return_ACPI_STATUS (AE_OK); | 262 | return_ACPI_STATUS (AE_OK); |
273 | } | 263 | } |
@@ -305,28 +295,24 @@ acpi_rs_address16_stream ( | |||
305 | ACPI_FUNCTION_TRACE ("rs_address16_stream"); | 295 | ACPI_FUNCTION_TRACE ("rs_address16_stream"); |
306 | 296 | ||
307 | 297 | ||
308 | /* | 298 | /* The descriptor field is static */ |
309 | * The descriptor field is static | 299 | |
310 | */ | ||
311 | *buffer = 0x88; | 300 | *buffer = 0x88; |
312 | buffer += 1; | 301 | buffer += 1; |
313 | 302 | ||
314 | /* | 303 | /* Save a pointer to the Length field - to be filled in later */ |
315 | * Save a pointer to the Length field - to be filled in later | 304 | |
316 | */ | ||
317 | length_field = buffer; | 305 | length_field = buffer; |
318 | buffer += 2; | 306 | buffer += 2; |
319 | 307 | ||
320 | /* | 308 | /* Set the Resource Type (Memory, Io, bus_number) */ |
321 | * Set the Resource Type (Memory, Io, bus_number) | 309 | |
322 | */ | ||
323 | temp8 = (u8) (linked_list->data.address16.resource_type & 0x03); | 310 | temp8 = (u8) (linked_list->data.address16.resource_type & 0x03); |
324 | *buffer = temp8; | 311 | *buffer = temp8; |
325 | buffer += 1; | 312 | buffer += 1; |
326 | 313 | ||
327 | /* | 314 | /* Set the general flags */ |
328 | * Set the general flags | 315 | |
329 | */ | ||
330 | temp8 = (u8) (linked_list->data.address16.producer_consumer & 0x01); | 316 | temp8 = (u8) (linked_list->data.address16.producer_consumer & 0x01); |
331 | 317 | ||
332 | temp8 |= (linked_list->data.address16.decode & 0x01) << 1; | 318 | temp8 |= (linked_list->data.address16.decode & 0x01) << 1; |
@@ -336,9 +322,8 @@ acpi_rs_address16_stream ( | |||
336 | *buffer = temp8; | 322 | *buffer = temp8; |
337 | buffer += 1; | 323 | buffer += 1; |
338 | 324 | ||
339 | /* | 325 | /* Set the type specific flags */ |
340 | * Set the type specific flags | 326 | |
341 | */ | ||
342 | temp8 = 0; | 327 | temp8 = 0; |
343 | 328 | ||
344 | if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) { | 329 | if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) { |
@@ -362,39 +347,34 @@ acpi_rs_address16_stream ( | |||
362 | *buffer = temp8; | 347 | *buffer = temp8; |
363 | buffer += 1; | 348 | buffer += 1; |
364 | 349 | ||
365 | /* | 350 | /* Set the address space granularity */ |
366 | * Set the address space granularity | 351 | |
367 | */ | ||
368 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.granularity); | 352 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.granularity); |
369 | buffer += 2; | 353 | buffer += 2; |
370 | 354 | ||
371 | /* | 355 | /* Set the address range minimum */ |
372 | * Set the address range minimum | 356 | |
373 | */ | ||
374 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.min_address_range); | 357 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.min_address_range); |
375 | buffer += 2; | 358 | buffer += 2; |
376 | 359 | ||
377 | /* | 360 | /* Set the address range maximum */ |
378 | * Set the address range maximum | 361 | |
379 | */ | ||
380 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.max_address_range); | 362 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.max_address_range); |
381 | buffer += 2; | 363 | buffer += 2; |
382 | 364 | ||
383 | /* | 365 | /* Set the address translation offset */ |
384 | * Set the address translation offset | 366 | |
385 | */ | 367 | ACPI_MOVE_32_TO_16 (buffer, |
386 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_translation_offset); | 368 | &linked_list->data.address16.address_translation_offset); |
387 | buffer += 2; | 369 | buffer += 2; |
388 | 370 | ||
389 | /* | 371 | /* Set the address length */ |
390 | * Set the address length | 372 | |
391 | */ | ||
392 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_length); | 373 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_length); |
393 | buffer += 2; | 374 | buffer += 2; |
394 | 375 | ||
395 | /* | 376 | /* Resource Source Index and Resource Source are optional */ |
396 | * Resource Source Index and Resource Source are optional | 377 | |
397 | */ | ||
398 | if (0 != linked_list->data.address16.resource_source.string_length) { | 378 | if (0 != linked_list->data.address16.resource_source.string_length) { |
399 | temp8 = (u8) linked_list->data.address16.resource_source.index; | 379 | temp8 = (u8) linked_list->data.address16.resource_source.index; |
400 | 380 | ||
@@ -403,9 +383,8 @@ acpi_rs_address16_stream ( | |||
403 | 383 | ||
404 | temp_pointer = (char *) buffer; | 384 | temp_pointer = (char *) buffer; |
405 | 385 | ||
406 | /* | 386 | /* Copy the string */ |
407 | * Copy the string | 387 | |
408 | */ | ||
409 | ACPI_STRCPY (temp_pointer, | 388 | ACPI_STRCPY (temp_pointer, |
410 | linked_list->data.address16.resource_source.string_ptr); | 389 | linked_list->data.address16.resource_source.string_ptr); |
411 | 390 | ||
@@ -413,12 +392,12 @@ acpi_rs_address16_stream ( | |||
413 | * Buffer needs to be set to the length of the sting + one for the | 392 | * Buffer needs to be set to the length of the sting + one for the |
414 | * terminating null | 393 | * terminating null |
415 | */ | 394 | */ |
416 | buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address16.resource_source.string_ptr) + 1); | 395 | buffer += (acpi_size)(ACPI_STRLEN ( |
396 | linked_list->data.address16.resource_source.string_ptr) + 1); | ||
417 | } | 397 | } |
418 | 398 | ||
419 | /* | 399 | /* Return the number of bytes consumed in this operation */ |
420 | * Return the number of bytes consumed in this operation | 400 | |
421 | */ | ||
422 | actual_bytes = ACPI_PTR_DIFF (buffer, *output_buffer); | 401 | actual_bytes = ACPI_PTR_DIFF (buffer, *output_buffer); |
423 | *bytes_consumed = actual_bytes; | 402 | *bytes_consumed = actual_bytes; |
424 | 403 | ||
@@ -475,9 +454,8 @@ acpi_rs_address32_resource ( | |||
475 | buffer = byte_stream_buffer; | 454 | buffer = byte_stream_buffer; |
476 | struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32); | 455 | struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32); |
477 | 456 | ||
478 | /* | 457 | /* Point past the Descriptor to get the number of bytes consumed */ |
479 | * Point past the Descriptor to get the number of bytes consumed | 458 | |
480 | */ | ||
481 | buffer += 1; | 459 | buffer += 1; |
482 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 460 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
483 | 461 | ||
@@ -490,9 +468,8 @@ acpi_rs_address32_resource ( | |||
490 | *bytes_consumed = temp16 + 3; | 468 | *bytes_consumed = temp16 + 3; |
491 | output_struct->id = ACPI_RSTYPE_ADDRESS32; | 469 | output_struct->id = ACPI_RSTYPE_ADDRESS32; |
492 | 470 | ||
493 | /* | 471 | /* Get the Resource Type (Byte3) */ |
494 | * Get the Resource Type (Byte3) | 472 | |
495 | */ | ||
496 | buffer += 2; | 473 | buffer += 2; |
497 | temp8 = *buffer; | 474 | temp8 = *buffer; |
498 | 475 | ||
@@ -504,35 +481,29 @@ acpi_rs_address32_resource ( | |||
504 | 481 | ||
505 | output_struct->data.address32.resource_type = temp8; | 482 | output_struct->data.address32.resource_type = temp8; |
506 | 483 | ||
507 | /* | 484 | /* Get the General Flags (Byte4) */ |
508 | * Get the General Flags (Byte4) | 485 | |
509 | */ | ||
510 | buffer += 1; | 486 | buffer += 1; |
511 | temp8 = *buffer; | 487 | temp8 = *buffer; |
512 | 488 | ||
513 | /* | 489 | /* Producer / Consumer */ |
514 | * Producer / Consumer | 490 | |
515 | */ | ||
516 | output_struct->data.address32.producer_consumer = temp8 & 0x01; | 491 | output_struct->data.address32.producer_consumer = temp8 & 0x01; |
517 | 492 | ||
518 | /* | 493 | /* Decode */ |
519 | * Decode | 494 | |
520 | */ | ||
521 | output_struct->data.address32.decode = (temp8 >> 1) & 0x01; | 495 | output_struct->data.address32.decode = (temp8 >> 1) & 0x01; |
522 | 496 | ||
523 | /* | 497 | /* Min Address Fixed */ |
524 | * Min Address Fixed | 498 | |
525 | */ | ||
526 | output_struct->data.address32.min_address_fixed = (temp8 >> 2) & 0x01; | 499 | output_struct->data.address32.min_address_fixed = (temp8 >> 2) & 0x01; |
527 | 500 | ||
528 | /* | 501 | /* Max Address Fixed */ |
529 | * Max Address Fixed | 502 | |
530 | */ | ||
531 | output_struct->data.address32.max_address_fixed = (temp8 >> 3) & 0x01; | 503 | output_struct->data.address32.max_address_fixed = (temp8 >> 3) & 0x01; |
532 | 504 | ||
533 | /* | 505 | /* Get the Type Specific Flags (Byte5) */ |
534 | * Get the Type Specific Flags (Byte5) | 506 | |
535 | */ | ||
536 | buffer += 1; | 507 | buffer += 1; |
537 | temp8 = *buffer; | 508 | temp8 = *buffer; |
538 | 509 | ||
@@ -556,39 +527,34 @@ acpi_rs_address32_resource ( | |||
556 | } | 527 | } |
557 | } | 528 | } |
558 | 529 | ||
559 | /* | 530 | /* Get Granularity (Bytes 6-9) */ |
560 | * Get Granularity (Bytes 6-9) | 531 | |
561 | */ | ||
562 | buffer += 1; | 532 | buffer += 1; |
563 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.granularity, buffer); | 533 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.granularity, buffer); |
564 | 534 | ||
565 | /* | 535 | /* Get min_address_range (Bytes 10-13) */ |
566 | * Get min_address_range (Bytes 10-13) | 536 | |
567 | */ | ||
568 | buffer += 4; | 537 | buffer += 4; |
569 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.min_address_range, buffer); | 538 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.min_address_range, buffer); |
570 | 539 | ||
571 | /* | 540 | /* Get max_address_range (Bytes 14-17) */ |
572 | * Get max_address_range (Bytes 14-17) | 541 | |
573 | */ | ||
574 | buffer += 4; | 542 | buffer += 4; |
575 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.max_address_range, buffer); | 543 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.max_address_range, buffer); |
576 | 544 | ||
577 | /* | 545 | /* Get address_translation_offset (Bytes 18-21) */ |
578 | * Get address_translation_offset (Bytes 18-21) | 546 | |
579 | */ | ||
580 | buffer += 4; | 547 | buffer += 4; |
581 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_translation_offset, buffer); | 548 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_translation_offset, |
549 | buffer); | ||
550 | |||
551 | /* Get address_length (Bytes 22-25) */ | ||
582 | 552 | ||
583 | /* | ||
584 | * Get address_length (Bytes 22-25) | ||
585 | */ | ||
586 | buffer += 4; | 553 | buffer += 4; |
587 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_length, buffer); | 554 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_length, buffer); |
588 | 555 | ||
589 | /* | 556 | /* Resource Source Index (if present) */ |
590 | * Resource Source Index (if present) | 557 | |
591 | */ | ||
592 | buffer += 4; | 558 | buffer += 4; |
593 | 559 | ||
594 | /* | 560 | /* |
@@ -615,7 +581,8 @@ acpi_rs_address32_resource ( | |||
615 | output_struct->data.address32.resource_source.string_ptr = | 581 | output_struct->data.address32.resource_source.string_ptr = |
616 | (char *)((u8 *)output_struct + struct_size); | 582 | (char *)((u8 *)output_struct + struct_size); |
617 | 583 | ||
618 | temp_ptr = (u8 *) output_struct->data.address32.resource_source.string_ptr; | 584 | temp_ptr = (u8 *) |
585 | output_struct->data.address32.resource_source.string_ptr; | ||
619 | 586 | ||
620 | /* Copy the string into the buffer */ | 587 | /* Copy the string into the buffer */ |
621 | 588 | ||
@@ -628,9 +595,8 @@ acpi_rs_address32_resource ( | |||
628 | index += 1; | 595 | index += 1; |
629 | } | 596 | } |
630 | 597 | ||
631 | /* | 598 | /* Add the terminating null */ |
632 | * Add the terminating null | 599 | |
633 | */ | ||
634 | *temp_ptr = 0x00; | 600 | *temp_ptr = 0x00; |
635 | output_struct->data.address32.resource_source.string_length = index + 1; | 601 | output_struct->data.address32.resource_source.string_length = index + 1; |
636 | 602 | ||
@@ -648,14 +614,12 @@ acpi_rs_address32_resource ( | |||
648 | output_struct->data.address32.resource_source.string_ptr = NULL; | 614 | output_struct->data.address32.resource_source.string_ptr = NULL; |
649 | } | 615 | } |
650 | 616 | ||
651 | /* | 617 | /* Set the Length parameter */ |
652 | * Set the Length parameter | 618 | |
653 | */ | ||
654 | output_struct->length = (u32) struct_size; | 619 | output_struct->length = (u32) struct_size; |
655 | 620 | ||
656 | /* | 621 | /* Return the final size of the structure */ |
657 | * Return the final size of the structure | 622 | |
658 | */ | ||
659 | *structure_size = struct_size; | 623 | *structure_size = struct_size; |
660 | return_ACPI_STATUS (AE_OK); | 624 | return_ACPI_STATUS (AE_OK); |
661 | } | 625 | } |
@@ -694,29 +658,25 @@ acpi_rs_address32_stream ( | |||
694 | 658 | ||
695 | buffer = *output_buffer; | 659 | buffer = *output_buffer; |
696 | 660 | ||
697 | /* | 661 | /* The descriptor field is static */ |
698 | * The descriptor field is static | 662 | |
699 | */ | ||
700 | *buffer = 0x87; | 663 | *buffer = 0x87; |
701 | buffer += 1; | 664 | buffer += 1; |
702 | 665 | ||
703 | /* | 666 | /* Set a pointer to the Length field - to be filled in later */ |
704 | * Set a pointer to the Length field - to be filled in later | 667 | |
705 | */ | ||
706 | length_field = ACPI_CAST_PTR (u16, buffer); | 668 | length_field = ACPI_CAST_PTR (u16, buffer); |
707 | buffer += 2; | 669 | buffer += 2; |
708 | 670 | ||
709 | /* | 671 | /* Set the Resource Type (Memory, Io, bus_number) */ |
710 | * Set the Resource Type (Memory, Io, bus_number) | 672 | |
711 | */ | ||
712 | temp8 = (u8) (linked_list->data.address32.resource_type & 0x03); | 673 | temp8 = (u8) (linked_list->data.address32.resource_type & 0x03); |
713 | 674 | ||
714 | *buffer = temp8; | 675 | *buffer = temp8; |
715 | buffer += 1; | 676 | buffer += 1; |
716 | 677 | ||
717 | /* | 678 | /* Set the general flags */ |
718 | * Set the general flags | 679 | |
719 | */ | ||
720 | temp8 = (u8) (linked_list->data.address32.producer_consumer & 0x01); | 680 | temp8 = (u8) (linked_list->data.address32.producer_consumer & 0x01); |
721 | temp8 |= (linked_list->data.address32.decode & 0x01) << 1; | 681 | temp8 |= (linked_list->data.address32.decode & 0x01) << 1; |
722 | temp8 |= (linked_list->data.address32.min_address_fixed & 0x01) << 2; | 682 | temp8 |= (linked_list->data.address32.min_address_fixed & 0x01) << 2; |
@@ -725,9 +685,8 @@ acpi_rs_address32_stream ( | |||
725 | *buffer = temp8; | 685 | *buffer = temp8; |
726 | buffer += 1; | 686 | buffer += 1; |
727 | 687 | ||
728 | /* | 688 | /* Set the type specific flags */ |
729 | * Set the type specific flags | 689 | |
730 | */ | ||
731 | temp8 = 0; | 690 | temp8 = 0; |
732 | 691 | ||
733 | if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) { | 692 | if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) { |
@@ -751,39 +710,34 @@ acpi_rs_address32_stream ( | |||
751 | *buffer = temp8; | 710 | *buffer = temp8; |
752 | buffer += 1; | 711 | buffer += 1; |
753 | 712 | ||
754 | /* | 713 | /* Set the address space granularity */ |
755 | * Set the address space granularity | 714 | |
756 | */ | ||
757 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.granularity); | 715 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.granularity); |
758 | buffer += 4; | 716 | buffer += 4; |
759 | 717 | ||
760 | /* | 718 | /* Set the address range minimum */ |
761 | * Set the address range minimum | 719 | |
762 | */ | ||
763 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.min_address_range); | 720 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.min_address_range); |
764 | buffer += 4; | 721 | buffer += 4; |
765 | 722 | ||
766 | /* | 723 | /* Set the address range maximum */ |
767 | * Set the address range maximum | 724 | |
768 | */ | ||
769 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.max_address_range); | 725 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.max_address_range); |
770 | buffer += 4; | 726 | buffer += 4; |
771 | 727 | ||
772 | /* | 728 | /* Set the address translation offset */ |
773 | * Set the address translation offset | 729 | |
774 | */ | 730 | ACPI_MOVE_32_TO_32 (buffer, |
775 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_translation_offset); | 731 | &linked_list->data.address32.address_translation_offset); |
776 | buffer += 4; | 732 | buffer += 4; |
777 | 733 | ||
778 | /* | 734 | /* Set the address length */ |
779 | * Set the address length | 735 | |
780 | */ | ||
781 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_length); | 736 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_length); |
782 | buffer += 4; | 737 | buffer += 4; |
783 | 738 | ||
784 | /* | 739 | /* Resource Source Index and Resource Source are optional */ |
785 | * Resource Source Index and Resource Source are optional | 740 | |
786 | */ | ||
787 | if (0 != linked_list->data.address32.resource_source.string_length) { | 741 | if (0 != linked_list->data.address32.resource_source.string_length) { |
788 | temp8 = (u8) linked_list->data.address32.resource_source.index; | 742 | temp8 = (u8) linked_list->data.address32.resource_source.index; |
789 | 743 | ||
@@ -792,9 +746,8 @@ acpi_rs_address32_stream ( | |||
792 | 746 | ||
793 | temp_pointer = (char *) buffer; | 747 | temp_pointer = (char *) buffer; |
794 | 748 | ||
795 | /* | 749 | /* Copy the string */ |
796 | * Copy the string | 750 | |
797 | */ | ||
798 | ACPI_STRCPY (temp_pointer, | 751 | ACPI_STRCPY (temp_pointer, |
799 | linked_list->data.address32.resource_source.string_ptr); | 752 | linked_list->data.address32.resource_source.string_ptr); |
800 | 753 | ||
@@ -802,12 +755,12 @@ acpi_rs_address32_stream ( | |||
802 | * Buffer needs to be set to the length of the sting + one for the | 755 | * Buffer needs to be set to the length of the sting + one for the |
803 | * terminating null | 756 | * terminating null |
804 | */ | 757 | */ |
805 | buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address32.resource_source.string_ptr) + 1); | 758 | buffer += (acpi_size)(ACPI_STRLEN ( |
759 | linked_list->data.address32.resource_source.string_ptr) + 1); | ||
806 | } | 760 | } |
807 | 761 | ||
808 | /* | 762 | /* Return the number of bytes consumed in this operation */ |
809 | * Return the number of bytes consumed in this operation | 763 | |
810 | */ | ||
811 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 764 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
812 | 765 | ||
813 | /* | 766 | /* |
@@ -864,9 +817,8 @@ acpi_rs_address64_resource ( | |||
864 | struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64); | 817 | struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64); |
865 | resource_type = *buffer; | 818 | resource_type = *buffer; |
866 | 819 | ||
867 | /* | 820 | /* Point past the Descriptor to get the number of bytes consumed */ |
868 | * Point past the Descriptor to get the number of bytes consumed | 821 | |
869 | */ | ||
870 | buffer += 1; | 822 | buffer += 1; |
871 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 823 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
872 | 824 | ||
@@ -879,9 +831,8 @@ acpi_rs_address64_resource ( | |||
879 | *bytes_consumed = temp16 + 3; | 831 | *bytes_consumed = temp16 + 3; |
880 | output_struct->id = ACPI_RSTYPE_ADDRESS64; | 832 | output_struct->id = ACPI_RSTYPE_ADDRESS64; |
881 | 833 | ||
882 | /* | 834 | /* Get the Resource Type (Byte3) */ |
883 | * Get the Resource Type (Byte3) | 835 | |
884 | */ | ||
885 | buffer += 2; | 836 | buffer += 2; |
886 | temp8 = *buffer; | 837 | temp8 = *buffer; |
887 | 838 | ||
@@ -893,35 +844,29 @@ acpi_rs_address64_resource ( | |||
893 | 844 | ||
894 | output_struct->data.address64.resource_type = temp8; | 845 | output_struct->data.address64.resource_type = temp8; |
895 | 846 | ||
896 | /* | 847 | /* Get the General Flags (Byte4) */ |
897 | * Get the General Flags (Byte4) | 848 | |
898 | */ | ||
899 | buffer += 1; | 849 | buffer += 1; |
900 | temp8 = *buffer; | 850 | temp8 = *buffer; |
901 | 851 | ||
902 | /* | 852 | /* Producer / Consumer */ |
903 | * Producer / Consumer | 853 | |
904 | */ | ||
905 | output_struct->data.address64.producer_consumer = temp8 & 0x01; | 854 | output_struct->data.address64.producer_consumer = temp8 & 0x01; |
906 | 855 | ||
907 | /* | 856 | /* Decode */ |
908 | * Decode | 857 | |
909 | */ | ||
910 | output_struct->data.address64.decode = (temp8 >> 1) & 0x01; | 858 | output_struct->data.address64.decode = (temp8 >> 1) & 0x01; |
911 | 859 | ||
912 | /* | 860 | /* Min Address Fixed */ |
913 | * Min Address Fixed | 861 | |
914 | */ | ||
915 | output_struct->data.address64.min_address_fixed = (temp8 >> 2) & 0x01; | 862 | output_struct->data.address64.min_address_fixed = (temp8 >> 2) & 0x01; |
916 | 863 | ||
917 | /* | 864 | /* Max Address Fixed */ |
918 | * Max Address Fixed | 865 | |
919 | */ | ||
920 | output_struct->data.address64.max_address_fixed = (temp8 >> 3) & 0x01; | 866 | output_struct->data.address64.max_address_fixed = (temp8 >> 3) & 0x01; |
921 | 867 | ||
922 | /* | 868 | /* Get the Type Specific Flags (Byte5) */ |
923 | * Get the Type Specific Flags (Byte5) | 869 | |
924 | */ | ||
925 | buffer += 1; | 870 | buffer += 1; |
926 | temp8 = *buffer; | 871 | temp8 = *buffer; |
927 | 872 | ||
@@ -951,33 +896,29 @@ acpi_rs_address64_resource ( | |||
951 | buffer += 2; | 896 | buffer += 2; |
952 | } | 897 | } |
953 | 898 | ||
954 | /* | 899 | /* Get Granularity (Bytes 6-13) or (Bytes 8-15) */ |
955 | * Get Granularity (Bytes 6-13) or (Bytes 8-15) | 900 | |
956 | */ | ||
957 | buffer += 1; | 901 | buffer += 1; |
958 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.granularity, buffer); | 902 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.granularity, buffer); |
959 | 903 | ||
960 | /* | 904 | /* Get min_address_range (Bytes 14-21) or (Bytes 16-23) */ |
961 | * Get min_address_range (Bytes 14-21) or (Bytes 16-23) | 905 | |
962 | */ | ||
963 | buffer += 8; | 906 | buffer += 8; |
964 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.min_address_range, buffer); | 907 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.min_address_range, buffer); |
965 | 908 | ||
966 | /* | 909 | /* Get max_address_range (Bytes 22-29) or (Bytes 24-31) */ |
967 | * Get max_address_range (Bytes 22-29) or (Bytes 24-31) | 910 | |
968 | */ | ||
969 | buffer += 8; | 911 | buffer += 8; |
970 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.max_address_range, buffer); | 912 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.max_address_range, buffer); |
971 | 913 | ||
972 | /* | 914 | /* Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) */ |
973 | * Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) | 915 | |
974 | */ | ||
975 | buffer += 8; | 916 | buffer += 8; |
976 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_translation_offset, buffer); | 917 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_translation_offset, |
918 | buffer); | ||
919 | |||
920 | /* Get address_length (Bytes 38-45) or (Bytes 40-47) */ | ||
977 | 921 | ||
978 | /* | ||
979 | * Get address_length (Bytes 38-45) or (Bytes 40-47) | ||
980 | */ | ||
981 | buffer += 8; | 922 | buffer += 8; |
982 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_length, buffer); | 923 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_length, buffer); |
983 | 924 | ||
@@ -989,14 +930,15 @@ acpi_rs_address64_resource ( | |||
989 | /* Get type_specific_attribute (Bytes 48-55) */ | 930 | /* Get type_specific_attribute (Bytes 48-55) */ |
990 | 931 | ||
991 | buffer += 8; | 932 | buffer += 8; |
992 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.type_specific_attributes, buffer); | 933 | ACPI_MOVE_64_TO_64 ( |
934 | &output_struct->data.address64.type_specific_attributes, | ||
935 | buffer); | ||
993 | } | 936 | } |
994 | else { | 937 | else { |
995 | output_struct->data.address64.type_specific_attributes = 0; | 938 | output_struct->data.address64.type_specific_attributes = 0; |
996 | 939 | ||
997 | /* | 940 | /* Resource Source Index (if present) */ |
998 | * Resource Source Index (if present) | 941 | |
999 | */ | ||
1000 | buffer += 8; | 942 | buffer += 8; |
1001 | 943 | ||
1002 | /* | 944 | /* |
@@ -1025,7 +967,8 @@ acpi_rs_address64_resource ( | |||
1025 | output_struct->data.address64.resource_source.string_ptr = | 967 | output_struct->data.address64.resource_source.string_ptr = |
1026 | (char *)((u8 *)output_struct + struct_size); | 968 | (char *)((u8 *)output_struct + struct_size); |
1027 | 969 | ||
1028 | temp_ptr = (u8 *) output_struct->data.address64.resource_source.string_ptr; | 970 | temp_ptr = (u8 *) |
971 | output_struct->data.address64.resource_source.string_ptr; | ||
1029 | 972 | ||
1030 | /* Copy the string into the buffer */ | 973 | /* Copy the string into the buffer */ |
1031 | 974 | ||
@@ -1042,7 +985,8 @@ acpi_rs_address64_resource ( | |||
1042 | * Add the terminating null | 985 | * Add the terminating null |
1043 | */ | 986 | */ |
1044 | *temp_ptr = 0x00; | 987 | *temp_ptr = 0x00; |
1045 | output_struct->data.address64.resource_source.string_length = index + 1; | 988 | output_struct->data.address64.resource_source.string_length = |
989 | index + 1; | ||
1046 | 990 | ||
1047 | /* | 991 | /* |
1048 | * In order for the struct_size to fall on a 32-bit boundary, | 992 | * In order for the struct_size to fall on a 32-bit boundary, |
@@ -1054,14 +998,12 @@ acpi_rs_address64_resource ( | |||
1054 | } | 998 | } |
1055 | } | 999 | } |
1056 | 1000 | ||
1057 | /* | 1001 | /* Set the Length parameter */ |
1058 | * Set the Length parameter | 1002 | |
1059 | */ | ||
1060 | output_struct->length = (u32) struct_size; | 1003 | output_struct->length = (u32) struct_size; |
1061 | 1004 | ||
1062 | /* | 1005 | /* Return the final size of the structure */ |
1063 | * Return the final size of the structure | 1006 | |
1064 | */ | ||
1065 | *structure_size = struct_size; | 1007 | *structure_size = struct_size; |
1066 | return_ACPI_STATUS (AE_OK); | 1008 | return_ACPI_STATUS (AE_OK); |
1067 | } | 1009 | } |
@@ -1100,29 +1042,25 @@ acpi_rs_address64_stream ( | |||
1100 | 1042 | ||
1101 | buffer = *output_buffer; | 1043 | buffer = *output_buffer; |
1102 | 1044 | ||
1103 | /* | 1045 | /* The descriptor field is static */ |
1104 | * The descriptor field is static | 1046 | |
1105 | */ | ||
1106 | *buffer = 0x8A; | 1047 | *buffer = 0x8A; |
1107 | buffer += 1; | 1048 | buffer += 1; |
1108 | 1049 | ||
1109 | /* | 1050 | /* Set a pointer to the Length field - to be filled in later */ |
1110 | * Set a pointer to the Length field - to be filled in later | 1051 | |
1111 | */ | ||
1112 | length_field = ACPI_CAST_PTR (u16, buffer); | 1052 | length_field = ACPI_CAST_PTR (u16, buffer); |
1113 | buffer += 2; | 1053 | buffer += 2; |
1114 | 1054 | ||
1115 | /* | 1055 | /* Set the Resource Type (Memory, Io, bus_number) */ |
1116 | * Set the Resource Type (Memory, Io, bus_number) | 1056 | |
1117 | */ | ||
1118 | temp8 = (u8) (linked_list->data.address64.resource_type & 0x03); | 1057 | temp8 = (u8) (linked_list->data.address64.resource_type & 0x03); |
1119 | 1058 | ||
1120 | *buffer = temp8; | 1059 | *buffer = temp8; |
1121 | buffer += 1; | 1060 | buffer += 1; |
1122 | 1061 | ||
1123 | /* | 1062 | /* Set the general flags */ |
1124 | * Set the general flags | 1063 | |
1125 | */ | ||
1126 | temp8 = (u8) (linked_list->data.address64.producer_consumer & 0x01); | 1064 | temp8 = (u8) (linked_list->data.address64.producer_consumer & 0x01); |
1127 | temp8 |= (linked_list->data.address64.decode & 0x01) << 1; | 1065 | temp8 |= (linked_list->data.address64.decode & 0x01) << 1; |
1128 | temp8 |= (linked_list->data.address64.min_address_fixed & 0x01) << 2; | 1066 | temp8 |= (linked_list->data.address64.min_address_fixed & 0x01) << 2; |
@@ -1131,9 +1069,8 @@ acpi_rs_address64_stream ( | |||
1131 | *buffer = temp8; | 1069 | *buffer = temp8; |
1132 | buffer += 1; | 1070 | buffer += 1; |
1133 | 1071 | ||
1134 | /* | 1072 | /* Set the type specific flags */ |
1135 | * Set the type specific flags | 1073 | |
1136 | */ | ||
1137 | temp8 = 0; | 1074 | temp8 = 0; |
1138 | 1075 | ||
1139 | if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) { | 1076 | if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) { |
@@ -1157,39 +1094,34 @@ acpi_rs_address64_stream ( | |||
1157 | *buffer = temp8; | 1094 | *buffer = temp8; |
1158 | buffer += 1; | 1095 | buffer += 1; |
1159 | 1096 | ||
1160 | /* | 1097 | /* Set the address space granularity */ |
1161 | * Set the address space granularity | 1098 | |
1162 | */ | ||
1163 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.granularity); | 1099 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.granularity); |
1164 | buffer += 8; | 1100 | buffer += 8; |
1165 | 1101 | ||
1166 | /* | 1102 | /* Set the address range minimum */ |
1167 | * Set the address range minimum | 1103 | |
1168 | */ | ||
1169 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.min_address_range); | 1104 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.min_address_range); |
1170 | buffer += 8; | 1105 | buffer += 8; |
1171 | 1106 | ||
1172 | /* | 1107 | /* Set the address range maximum */ |
1173 | * Set the address range maximum | 1108 | |
1174 | */ | ||
1175 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.max_address_range); | 1109 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.max_address_range); |
1176 | buffer += 8; | 1110 | buffer += 8; |
1177 | 1111 | ||
1178 | /* | 1112 | /* Set the address translation offset */ |
1179 | * Set the address translation offset | 1113 | |
1180 | */ | 1114 | ACPI_MOVE_64_TO_64 (buffer, |
1181 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_translation_offset); | 1115 | &linked_list->data.address64.address_translation_offset); |
1182 | buffer += 8; | 1116 | buffer += 8; |
1183 | 1117 | ||
1184 | /* | 1118 | /* Set the address length */ |
1185 | * Set the address length | 1119 | |
1186 | */ | ||
1187 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_length); | 1120 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_length); |
1188 | buffer += 8; | 1121 | buffer += 8; |
1189 | 1122 | ||
1190 | /* | 1123 | /* Resource Source Index and Resource Source are optional */ |
1191 | * Resource Source Index and Resource Source are optional | 1124 | |
1192 | */ | ||
1193 | if (0 != linked_list->data.address64.resource_source.string_length) { | 1125 | if (0 != linked_list->data.address64.resource_source.string_length) { |
1194 | temp8 = (u8) linked_list->data.address64.resource_source.index; | 1126 | temp8 = (u8) linked_list->data.address64.resource_source.index; |
1195 | 1127 | ||
@@ -1198,21 +1130,21 @@ acpi_rs_address64_stream ( | |||
1198 | 1130 | ||
1199 | temp_pointer = (char *) buffer; | 1131 | temp_pointer = (char *) buffer; |
1200 | 1132 | ||
1201 | /* | 1133 | /* Copy the string */ |
1202 | * Copy the string | 1134 | |
1203 | */ | 1135 | ACPI_STRCPY (temp_pointer, |
1204 | ACPI_STRCPY (temp_pointer, linked_list->data.address64.resource_source.string_ptr); | 1136 | linked_list->data.address64.resource_source.string_ptr); |
1205 | 1137 | ||
1206 | /* | 1138 | /* |
1207 | * Buffer needs to be set to the length of the sting + one for the | 1139 | * Buffer needs to be set to the length of the sting + one for the |
1208 | * terminating null | 1140 | * terminating null |
1209 | */ | 1141 | */ |
1210 | buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address64.resource_source.string_ptr) + 1); | 1142 | buffer += (acpi_size)(ACPI_STRLEN ( |
1143 | linked_list->data.address64.resource_source.string_ptr) + 1); | ||
1211 | } | 1144 | } |
1212 | 1145 | ||
1213 | /* | 1146 | /* Return the number of bytes consumed in this operation */ |
1214 | * Return the number of bytes consumed in this operation | 1147 | |
1215 | */ | ||
1216 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 1148 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
1217 | 1149 | ||
1218 | /* | 1150 | /* |
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index 8a5f0a52371d..98176f2fcb5d 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c | |||
@@ -81,9 +81,8 @@ acpi_rs_get_byte_stream_length ( | |||
81 | 81 | ||
82 | 82 | ||
83 | while (!done) { | 83 | while (!done) { |
84 | /* | 84 | /* Init the variable that will hold the size to add to the total. */ |
85 | * Init the variable that will hold the size to add to the total. | 85 | |
86 | */ | ||
87 | segment_size = 0; | 86 | segment_size = 0; |
88 | 87 | ||
89 | switch (linked_list->id) { | 88 | switch (linked_list->id) { |
@@ -196,7 +195,8 @@ acpi_rs_get_byte_stream_length ( | |||
196 | segment_size = 16; | 195 | segment_size = 16; |
197 | 196 | ||
198 | if (linked_list->data.address16.resource_source.string_ptr) { | 197 | if (linked_list->data.address16.resource_source.string_ptr) { |
199 | segment_size += linked_list->data.address16.resource_source.string_length; | 198 | segment_size += |
199 | linked_list->data.address16.resource_source.string_length; | ||
200 | segment_size++; | 200 | segment_size++; |
201 | } | 201 | } |
202 | break; | 202 | break; |
@@ -212,7 +212,8 @@ acpi_rs_get_byte_stream_length ( | |||
212 | segment_size = 26; | 212 | segment_size = 26; |
213 | 213 | ||
214 | if (linked_list->data.address32.resource_source.string_ptr) { | 214 | if (linked_list->data.address32.resource_source.string_ptr) { |
215 | segment_size += linked_list->data.address32.resource_source.string_length; | 215 | segment_size += |
216 | linked_list->data.address32.resource_source.string_length; | ||
216 | segment_size++; | 217 | segment_size++; |
217 | } | 218 | } |
218 | break; | 219 | break; |
@@ -227,7 +228,8 @@ acpi_rs_get_byte_stream_length ( | |||
227 | segment_size = 46; | 228 | segment_size = 46; |
228 | 229 | ||
229 | if (linked_list->data.address64.resource_source.string_ptr) { | 230 | if (linked_list->data.address64.resource_source.string_ptr) { |
230 | segment_size += linked_list->data.address64.resource_source.string_length; | 231 | segment_size += |
232 | linked_list->data.address64.resource_source.string_length; | ||
231 | segment_size++; | 233 | segment_size++; |
232 | } | 234 | } |
233 | break; | 235 | break; |
@@ -241,38 +243,36 @@ acpi_rs_get_byte_stream_length ( | |||
241 | * Index + the length of the null terminated string | 243 | * Index + the length of the null terminated string |
242 | * Resource Source + 1 for the null. | 244 | * Resource Source + 1 for the null. |
243 | */ | 245 | */ |
244 | segment_size = 9 + | 246 | segment_size = 9 + (((acpi_size) |
245 | (((acpi_size) linked_list->data.extended_irq.number_of_interrupts - 1) * 4); | 247 | linked_list->data.extended_irq.number_of_interrupts - 1) * 4); |
246 | 248 | ||
247 | if (linked_list->data.extended_irq.resource_source.string_ptr) { | 249 | if (linked_list->data.extended_irq.resource_source.string_ptr) { |
248 | segment_size += linked_list->data.extended_irq.resource_source.string_length; | 250 | segment_size += |
251 | linked_list->data.extended_irq.resource_source.string_length; | ||
249 | segment_size++; | 252 | segment_size++; |
250 | } | 253 | } |
251 | break; | 254 | break; |
252 | 255 | ||
253 | default: | 256 | default: |
254 | /* | 257 | |
255 | * If we get here, everything is out of sync, exit with error | 258 | /* If we get here, everything is out of sync, exit with error */ |
256 | */ | 259 | |
257 | return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); | 260 | return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); |
258 | 261 | ||
259 | } /* switch (linked_list->Id) */ | 262 | } /* switch (linked_list->Id) */ |
260 | 263 | ||
261 | /* | 264 | /* Update the total */ |
262 | * Update the total | 265 | |
263 | */ | ||
264 | byte_stream_size_needed += segment_size; | 266 | byte_stream_size_needed += segment_size; |
265 | 267 | ||
266 | /* | 268 | /* Point to the next object */ |
267 | * Point to the next object | 269 | |
268 | */ | ||
269 | linked_list = ACPI_PTR_ADD (struct acpi_resource, | 270 | linked_list = ACPI_PTR_ADD (struct acpi_resource, |
270 | linked_list, linked_list->length); | 271 | linked_list, linked_list->length); |
271 | } | 272 | } |
272 | 273 | ||
273 | /* | 274 | /* This is the data the caller needs */ |
274 | * This is the data the caller needs | 275 | |
275 | */ | ||
276 | *size_needed = byte_stream_size_needed; | 276 | *size_needed = byte_stream_size_needed; |
277 | return_ACPI_STATUS (AE_OK); | 277 | return_ACPI_STATUS (AE_OK); |
278 | } | 278 | } |
@@ -320,9 +320,8 @@ acpi_rs_get_list_length ( | |||
320 | 320 | ||
321 | 321 | ||
322 | while (bytes_parsed < byte_stream_buffer_length) { | 322 | while (bytes_parsed < byte_stream_buffer_length) { |
323 | /* | 323 | /* The next byte in the stream is the resource type */ |
324 | * The next byte in the stream is the resource type | 324 | |
325 | */ | ||
326 | resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); | 325 | resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); |
327 | 326 | ||
328 | switch (resource_type) { | 327 | switch (resource_type) { |
@@ -346,9 +345,8 @@ acpi_rs_get_list_length ( | |||
346 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 345 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
347 | bytes_consumed = temp16 + 3; | 346 | bytes_consumed = temp16 + 3; |
348 | 347 | ||
349 | /* | 348 | /* Ensure a 32-bit boundary for the structure */ |
350 | * Ensure a 32-bit boundary for the structure | 349 | |
351 | */ | ||
352 | temp16 = (u16) ACPI_ROUND_UP_to_32_bITS (temp16); | 350 | temp16 = (u16) ACPI_ROUND_UP_to_32_bITS (temp16); |
353 | 351 | ||
354 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + | 352 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + |
@@ -416,9 +414,8 @@ acpi_rs_get_list_length ( | |||
416 | temp8 = 0; | 414 | temp8 = 0; |
417 | } | 415 | } |
418 | 416 | ||
419 | /* | 417 | /* Ensure a 64-bit boundary for the structure */ |
420 | * Ensure a 64-bit boundary for the structure | 418 | |
421 | */ | ||
422 | temp8 = (u8) ACPI_ROUND_UP_to_64_bITS (temp8); | 419 | temp8 = (u8) ACPI_ROUND_UP_to_64_bITS (temp8); |
423 | 420 | ||
424 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64) + | 421 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64) + |
@@ -452,9 +449,8 @@ acpi_rs_get_list_length ( | |||
452 | temp8 = 0; | 449 | temp8 = 0; |
453 | } | 450 | } |
454 | 451 | ||
455 | /* | 452 | /* Ensure a 32-bit boundary for the structure */ |
456 | * Ensure a 32-bit boundary for the structure | 453 | |
457 | */ | ||
458 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); | 454 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); |
459 | 455 | ||
460 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32) + | 456 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32) + |
@@ -488,9 +484,8 @@ acpi_rs_get_list_length ( | |||
488 | temp8 = 0; | 484 | temp8 = 0; |
489 | } | 485 | } |
490 | 486 | ||
491 | /* | 487 | /* Ensure a 32-bit boundary for the structure */ |
492 | * Ensure a 32-bit boundary for the structure | 488 | |
493 | */ | ||
494 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); | 489 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); |
495 | 490 | ||
496 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16) + | 491 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16) + |
@@ -537,9 +532,8 @@ acpi_rs_get_list_length ( | |||
537 | temp8 = 0; | 532 | temp8 = 0; |
538 | } | 533 | } |
539 | 534 | ||
540 | /* | 535 | /* Ensure a 32-bit boundary for the structure */ |
541 | * Ensure a 32-bit boundary for the structure | 536 | |
542 | */ | ||
543 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); | 537 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); |
544 | 538 | ||
545 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_ext_irq) + | 539 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_ext_irq) + |
@@ -567,9 +561,8 @@ acpi_rs_get_list_length ( | |||
567 | 561 | ||
568 | ++buffer; | 562 | ++buffer; |
569 | 563 | ||
570 | /* | 564 | /* Look at the number of bits set */ |
571 | * Look at the number of bits set | 565 | |
572 | */ | ||
573 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 566 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
574 | 567 | ||
575 | for (index = 0; index < 16; index++) { | 568 | for (index = 0; index < 16; index++) { |
@@ -596,9 +589,8 @@ acpi_rs_get_list_length ( | |||
596 | 589 | ||
597 | ++buffer; | 590 | ++buffer; |
598 | 591 | ||
599 | /* | 592 | /* Look at the number of bits set */ |
600 | * Look at the number of bits set | 593 | |
601 | */ | ||
602 | temp8 = *buffer; | 594 | temp8 = *buffer; |
603 | 595 | ||
604 | for(index = 0; index < 8; index++) { | 596 | for(index = 0; index < 8; index++) { |
@@ -670,9 +662,8 @@ acpi_rs_get_list_length ( | |||
670 | temp8 = (u8) (temp8 & 0x7); | 662 | temp8 = (u8) (temp8 & 0x7); |
671 | bytes_consumed = temp8 + 1; | 663 | bytes_consumed = temp8 + 1; |
672 | 664 | ||
673 | /* | 665 | /* Ensure a 32-bit boundary for the structure */ |
674 | * Ensure a 32-bit boundary for the structure | 666 | |
675 | */ | ||
676 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); | 667 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); |
677 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + | 668 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + |
678 | (temp8 * sizeof (u8)); | 669 | (temp8 * sizeof (u8)); |
@@ -697,21 +688,18 @@ acpi_rs_get_list_length ( | |||
697 | return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); | 688 | return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); |
698 | } | 689 | } |
699 | 690 | ||
700 | /* | 691 | /* Update the return value and counter */ |
701 | * Update the return value and counter | 692 | |
702 | */ | ||
703 | buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE (structure_size); | 693 | buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE (structure_size); |
704 | bytes_parsed += bytes_consumed; | 694 | bytes_parsed += bytes_consumed; |
705 | 695 | ||
706 | /* | 696 | /* Set the byte stream to point to the next resource */ |
707 | * Set the byte stream to point to the next resource | 697 | |
708 | */ | ||
709 | byte_stream_buffer += bytes_consumed; | 698 | byte_stream_buffer += bytes_consumed; |
710 | } | 699 | } |
711 | 700 | ||
712 | /* | 701 | /* This is the data the caller needs */ |
713 | * This is the data the caller needs | 702 | |
714 | */ | ||
715 | *size_needed = buffer_size; | 703 | *size_needed = buffer_size; |
716 | return_ACPI_STATUS (AE_OK); | 704 | return_ACPI_STATUS (AE_OK); |
717 | } | 705 | } |
@@ -767,9 +755,8 @@ acpi_rs_get_pci_routing_table_length ( | |||
767 | top_object_list = package_object->package.elements; | 755 | top_object_list = package_object->package.elements; |
768 | 756 | ||
769 | for (index = 0; index < number_of_elements; index++) { | 757 | for (index = 0; index < number_of_elements; index++) { |
770 | /* | 758 | /* Dereference the sub-package */ |
771 | * Dereference the sub-package | 759 | |
772 | */ | ||
773 | package_element = *top_object_list; | 760 | package_element = *top_object_list; |
774 | 761 | ||
775 | /* | 762 | /* |
@@ -778,37 +765,40 @@ acpi_rs_get_pci_routing_table_length ( | |||
778 | */ | 765 | */ |
779 | sub_object_list = package_element->package.elements; | 766 | sub_object_list = package_element->package.elements; |
780 | 767 | ||
781 | /* | 768 | /* Scan the irq_table_elements for the Source Name String */ |
782 | * Scan the irq_table_elements for the Source Name String | 769 | |
783 | */ | ||
784 | name_found = FALSE; | 770 | name_found = FALSE; |
785 | 771 | ||
786 | for (table_index = 0; table_index < 4 && !name_found; table_index++) { | 772 | for (table_index = 0; table_index < 4 && !name_found; table_index++) { |
787 | if ((ACPI_TYPE_STRING == ACPI_GET_OBJECT_TYPE (*sub_object_list)) || | 773 | if ((ACPI_TYPE_STRING == |
788 | ((ACPI_TYPE_LOCAL_REFERENCE == ACPI_GET_OBJECT_TYPE (*sub_object_list)) && | 774 | ACPI_GET_OBJECT_TYPE (*sub_object_list)) || |
789 | ((*sub_object_list)->reference.opcode == AML_INT_NAMEPATH_OP))) { | 775 | |
776 | ((ACPI_TYPE_LOCAL_REFERENCE == | ||
777 | ACPI_GET_OBJECT_TYPE (*sub_object_list)) && | ||
778 | |||
779 | ((*sub_object_list)->reference.opcode == | ||
780 | AML_INT_NAMEPATH_OP))) { | ||
790 | name_found = TRUE; | 781 | name_found = TRUE; |
791 | } | 782 | } |
792 | else { | 783 | else { |
793 | /* | 784 | /* Look at the next element */ |
794 | * Look at the next element | 785 | |
795 | */ | ||
796 | sub_object_list++; | 786 | sub_object_list++; |
797 | } | 787 | } |
798 | } | 788 | } |
799 | 789 | ||
800 | temp_size_needed += (sizeof (struct acpi_pci_routing_table) - 4); | 790 | temp_size_needed += (sizeof (struct acpi_pci_routing_table) - 4); |
801 | 791 | ||
802 | /* | 792 | /* Was a String type found? */ |
803 | * Was a String type found? | 793 | |
804 | */ | ||
805 | if (name_found) { | 794 | if (name_found) { |
806 | if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_STRING) { | 795 | if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_STRING) { |
807 | /* | 796 | /* |
808 | * The length String.Length field does not include the | 797 | * The length String.Length field does not include the |
809 | * terminating NULL, add 1 | 798 | * terminating NULL, add 1 |
810 | */ | 799 | */ |
811 | temp_size_needed += ((acpi_size) (*sub_object_list)->string.length + 1); | 800 | temp_size_needed += ((acpi_size) |
801 | (*sub_object_list)->string.length + 1); | ||
812 | } | 802 | } |
813 | else { | 803 | else { |
814 | temp_size_needed += acpi_ns_get_pathname_length ( | 804 | temp_size_needed += acpi_ns_get_pathname_length ( |
@@ -827,14 +817,14 @@ acpi_rs_get_pci_routing_table_length ( | |||
827 | 817 | ||
828 | temp_size_needed = ACPI_ROUND_UP_to_64_bITS (temp_size_needed); | 818 | temp_size_needed = ACPI_ROUND_UP_to_64_bITS (temp_size_needed); |
829 | 819 | ||
830 | /* | 820 | /* Point to the next union acpi_operand_object */ |
831 | * Point to the next union acpi_operand_object | 821 | |
832 | */ | ||
833 | top_object_list++; | 822 | top_object_list++; |
834 | } | 823 | } |
835 | 824 | ||
836 | /* | 825 | /* |
837 | * Adding an extra element to the end of the list, essentially a NULL terminator | 826 | * Adding an extra element to the end of the list, essentially a |
827 | * NULL terminator | ||
838 | */ | 828 | */ |
839 | *buffer_size_needed = temp_size_needed + sizeof (struct acpi_pci_routing_table); | 829 | *buffer_size_needed = temp_size_needed + sizeof (struct acpi_pci_routing_table); |
840 | return_ACPI_STATUS (AE_OK); | 830 | return_ACPI_STATUS (AE_OK); |
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index a3a0cbfda68d..8e0eae0d50bb 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c | |||
@@ -87,9 +87,8 @@ acpi_rs_create_resource_list ( | |||
87 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_buffer = %p\n", | 87 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_buffer = %p\n", |
88 | byte_stream_buffer)); | 88 | byte_stream_buffer)); |
89 | 89 | ||
90 | /* | 90 | /* Params already validated, so we don't re-validate here */ |
91 | * Params already validated, so we don't re-validate here | 91 | |
92 | */ | ||
93 | byte_stream_buffer_length = byte_stream_buffer->buffer.length; | 92 | byte_stream_buffer_length = byte_stream_buffer->buffer.length; |
94 | byte_stream_start = byte_stream_buffer->buffer.pointer; | 93 | byte_stream_start = byte_stream_buffer->buffer.pointer; |
95 | 94 | ||
@@ -171,9 +170,8 @@ acpi_rs_create_pci_routing_table ( | |||
171 | 170 | ||
172 | /* Params already validated, so we don't re-validate here */ | 171 | /* Params already validated, so we don't re-validate here */ |
173 | 172 | ||
174 | /* | 173 | /* Get the required buffer length */ |
175 | * Get the required buffer length | 174 | |
176 | */ | ||
177 | status = acpi_rs_get_pci_routing_table_length (package_object, | 175 | status = acpi_rs_get_pci_routing_table_length (package_object, |
178 | &buffer_size_needed); | 176 | &buffer_size_needed); |
179 | if (ACPI_FAILURE (status)) { | 177 | if (ACPI_FAILURE (status)) { |
@@ -217,9 +215,8 @@ acpi_rs_create_pci_routing_table ( | |||
217 | */ | 215 | */ |
218 | user_prt->length = (sizeof (struct acpi_pci_routing_table) - 4); | 216 | user_prt->length = (sizeof (struct acpi_pci_routing_table) - 4); |
219 | 217 | ||
220 | /* | 218 | /* Each element of the top-level package must also be a package */ |
221 | * Each element of the top-level package must also be a package | 219 | |
222 | */ | ||
223 | if (ACPI_GET_OBJECT_TYPE (*top_object_list) != ACPI_TYPE_PACKAGE) { | 220 | if (ACPI_GET_OBJECT_TYPE (*top_object_list) != ACPI_TYPE_PACKAGE) { |
224 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 221 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
225 | "(PRT[%X]) Need sub-package, found %s\n", | 222 | "(PRT[%X]) Need sub-package, found %s\n", |
@@ -243,9 +240,8 @@ acpi_rs_create_pci_routing_table ( | |||
243 | */ | 240 | */ |
244 | sub_object_list = (*top_object_list)->package.elements; | 241 | sub_object_list = (*top_object_list)->package.elements; |
245 | 242 | ||
246 | /* | 243 | /* 1) First subobject: Dereference the PRT.Address */ |
247 | * 1) First subobject: Dereference the PRT.Address | 244 | |
248 | */ | ||
249 | obj_desc = sub_object_list[0]; | 245 | obj_desc = sub_object_list[0]; |
250 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { | 246 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { |
251 | user_prt->address = obj_desc->integer.value; | 247 | user_prt->address = obj_desc->integer.value; |
@@ -257,9 +253,8 @@ acpi_rs_create_pci_routing_table ( | |||
257 | return_ACPI_STATUS (AE_BAD_DATA); | 253 | return_ACPI_STATUS (AE_BAD_DATA); |
258 | } | 254 | } |
259 | 255 | ||
260 | /* | 256 | /* 2) Second subobject: Dereference the PRT.Pin */ |
261 | * 2) Second subobject: Dereference the PRT.Pin | 257 | |
262 | */ | ||
263 | obj_desc = sub_object_list[1]; | 258 | obj_desc = sub_object_list[1]; |
264 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { | 259 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { |
265 | user_prt->pin = (u32) obj_desc->integer.value; | 260 | user_prt->pin = (u32) obj_desc->integer.value; |
@@ -271,9 +266,8 @@ acpi_rs_create_pci_routing_table ( | |||
271 | return_ACPI_STATUS (AE_BAD_DATA); | 266 | return_ACPI_STATUS (AE_BAD_DATA); |
272 | } | 267 | } |
273 | 268 | ||
274 | /* | 269 | /* 3) Third subobject: Dereference the PRT.source_name */ |
275 | * 3) Third subobject: Dereference the PRT.source_name | 270 | |
276 | */ | ||
277 | obj_desc = sub_object_list[2]; | 271 | obj_desc = sub_object_list[2]; |
278 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 272 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { |
279 | case ACPI_TYPE_LOCAL_REFERENCE: | 273 | case ACPI_TYPE_LOCAL_REFERENCE: |
@@ -296,7 +290,9 @@ acpi_rs_create_pci_routing_table ( | |||
296 | 290 | ||
297 | status = acpi_ns_handle_to_pathname ((acpi_handle) node, &path_buffer); | 291 | status = acpi_ns_handle_to_pathname ((acpi_handle) node, &path_buffer); |
298 | 292 | ||
299 | user_prt->length += (u32) ACPI_STRLEN (user_prt->source) + 1; /* include null terminator */ | 293 | /* +1 to include null terminator */ |
294 | |||
295 | user_prt->length += (u32) ACPI_STRLEN (user_prt->source) + 1; | ||
300 | break; | 296 | break; |
301 | 297 | ||
302 | 298 | ||
@@ -304,8 +300,10 @@ acpi_rs_create_pci_routing_table ( | |||
304 | 300 | ||
305 | ACPI_STRCPY (user_prt->source, obj_desc->string.pointer); | 301 | ACPI_STRCPY (user_prt->source, obj_desc->string.pointer); |
306 | 302 | ||
307 | /* Add to the Length field the length of the string (add 1 for terminator) */ | 303 | /* |
308 | 304 | * Add to the Length field the length of the string | |
305 | * (add 1 for terminator) | ||
306 | */ | ||
309 | user_prt->length += obj_desc->string.length + 1; | 307 | user_prt->length += obj_desc->string.length + 1; |
310 | break; | 308 | break; |
311 | 309 | ||
@@ -333,9 +331,8 @@ acpi_rs_create_pci_routing_table ( | |||
333 | 331 | ||
334 | user_prt->length = (u32) ACPI_ROUND_UP_to_64_bITS (user_prt->length); | 332 | user_prt->length = (u32) ACPI_ROUND_UP_to_64_bITS (user_prt->length); |
335 | 333 | ||
336 | /* | 334 | /* 4) Fourth subobject: Dereference the PRT.source_index */ |
337 | * 4) Fourth subobject: Dereference the PRT.source_index | 335 | |
338 | */ | ||
339 | obj_desc = sub_object_list[3]; | 336 | obj_desc = sub_object_list[3]; |
340 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { | 337 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { |
341 | user_prt->source_index = (u32) obj_desc->integer.value; | 338 | user_prt->source_index = (u32) obj_desc->integer.value; |
diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index eef1b1f2c685..1935dab2ab51 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c | |||
@@ -48,9 +48,62 @@ | |||
48 | #define _COMPONENT ACPI_RESOURCES | 48 | #define _COMPONENT ACPI_RESOURCES |
49 | ACPI_MODULE_NAME ("rsdump") | 49 | ACPI_MODULE_NAME ("rsdump") |
50 | 50 | ||
51 | /* Local prototypes */ | ||
51 | 52 | ||
52 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 53 | static void |
54 | acpi_rs_dump_irq ( | ||
55 | union acpi_resource_data *data); | ||
56 | |||
57 | static void | ||
58 | acpi_rs_dump_address16 ( | ||
59 | union acpi_resource_data *data); | ||
60 | |||
61 | static void | ||
62 | acpi_rs_dump_address32 ( | ||
63 | union acpi_resource_data *data); | ||
64 | |||
65 | static void | ||
66 | acpi_rs_dump_address64 ( | ||
67 | union acpi_resource_data *data); | ||
68 | |||
69 | static void | ||
70 | acpi_rs_dump_dma ( | ||
71 | union acpi_resource_data *data); | ||
72 | |||
73 | static void | ||
74 | acpi_rs_dump_io ( | ||
75 | union acpi_resource_data *data); | ||
76 | |||
77 | static void | ||
78 | acpi_rs_dump_extended_irq ( | ||
79 | union acpi_resource_data *data); | ||
53 | 80 | ||
81 | static void | ||
82 | acpi_rs_dump_fixed_io ( | ||
83 | union acpi_resource_data *data); | ||
84 | |||
85 | static void | ||
86 | acpi_rs_dump_fixed_memory32 ( | ||
87 | union acpi_resource_data *data); | ||
88 | |||
89 | static void | ||
90 | acpi_rs_dump_memory24 ( | ||
91 | union acpi_resource_data *data); | ||
92 | |||
93 | static void | ||
94 | acpi_rs_dump_memory32 ( | ||
95 | union acpi_resource_data *data); | ||
96 | |||
97 | static void | ||
98 | acpi_rs_dump_start_depend_fns ( | ||
99 | union acpi_resource_data *data); | ||
100 | |||
101 | static void | ||
102 | acpi_rs_dump_vendor_specific ( | ||
103 | union acpi_resource_data *data); | ||
104 | |||
105 | |||
106 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
54 | /******************************************************************************* | 107 | /******************************************************************************* |
55 | * | 108 | * |
56 | * FUNCTION: acpi_rs_dump_irq | 109 | * FUNCTION: acpi_rs_dump_irq |
@@ -63,7 +116,7 @@ | |||
63 | * | 116 | * |
64 | ******************************************************************************/ | 117 | ******************************************************************************/ |
65 | 118 | ||
66 | void | 119 | static void |
67 | acpi_rs_dump_irq ( | 120 | acpi_rs_dump_irq ( |
68 | union acpi_resource_data *data) | 121 | union acpi_resource_data *data) |
69 | { | 122 | { |
@@ -77,13 +130,13 @@ acpi_rs_dump_irq ( | |||
77 | acpi_os_printf ("IRQ Resource\n"); | 130 | acpi_os_printf ("IRQ Resource\n"); |
78 | 131 | ||
79 | acpi_os_printf (" %s Triggered\n", | 132 | acpi_os_printf (" %s Triggered\n", |
80 | ACPI_LEVEL_SENSITIVE == irq_data->edge_level ? "Level" : "Edge"); | 133 | ACPI_LEVEL_SENSITIVE == irq_data->edge_level ? "Level" : "Edge"); |
81 | 134 | ||
82 | acpi_os_printf (" Active %s\n", | 135 | acpi_os_printf (" Active %s\n", |
83 | ACPI_ACTIVE_LOW == irq_data->active_high_low ? "Low" : "High"); | 136 | ACPI_ACTIVE_LOW == irq_data->active_high_low ? "Low" : "High"); |
84 | 137 | ||
85 | acpi_os_printf (" %s\n", | 138 | acpi_os_printf (" %s\n", |
86 | ACPI_SHARED == irq_data->shared_exclusive ? "Shared" : "Exclusive"); | 139 | ACPI_SHARED == irq_data->shared_exclusive ? "Shared" : "Exclusive"); |
87 | 140 | ||
88 | acpi_os_printf (" %X Interrupts ( ", irq_data->number_of_interrupts); | 141 | acpi_os_printf (" %X Interrupts ( ", irq_data->number_of_interrupts); |
89 | 142 | ||
@@ -108,7 +161,7 @@ acpi_rs_dump_irq ( | |||
108 | * | 161 | * |
109 | ******************************************************************************/ | 162 | ******************************************************************************/ |
110 | 163 | ||
111 | void | 164 | static void |
112 | acpi_rs_dump_dma ( | 165 | acpi_rs_dump_dma ( |
113 | union acpi_resource_data *data) | 166 | union acpi_resource_data *data) |
114 | { | 167 | { |
@@ -144,7 +197,7 @@ acpi_rs_dump_dma ( | |||
144 | } | 197 | } |
145 | 198 | ||
146 | acpi_os_printf (" %sBus Master\n", | 199 | acpi_os_printf (" %sBus Master\n", |
147 | ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a "); | 200 | ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a "); |
148 | 201 | ||
149 | 202 | ||
150 | switch (dma_data->transfer) { | 203 | switch (dma_data->transfer) { |
@@ -165,7 +218,8 @@ acpi_rs_dump_dma ( | |||
165 | break; | 218 | break; |
166 | } | 219 | } |
167 | 220 | ||
168 | acpi_os_printf (" Number of Channels: %X ( ", dma_data->number_of_channels); | 221 | acpi_os_printf (" Number of Channels: %X ( ", |
222 | dma_data->number_of_channels); | ||
169 | 223 | ||
170 | for (index = 0; index < dma_data->number_of_channels; index++) { | 224 | for (index = 0; index < dma_data->number_of_channels; index++) { |
171 | acpi_os_printf ("%X ", dma_data->channels[index]); | 225 | acpi_os_printf ("%X ", dma_data->channels[index]); |
@@ -188,7 +242,7 @@ acpi_rs_dump_dma ( | |||
188 | * | 242 | * |
189 | ******************************************************************************/ | 243 | ******************************************************************************/ |
190 | 244 | ||
191 | void | 245 | static void |
192 | acpi_rs_dump_start_depend_fns ( | 246 | acpi_rs_dump_start_depend_fns ( |
193 | union acpi_resource_data *data) | 247 | union acpi_resource_data *data) |
194 | { | 248 | { |
@@ -232,8 +286,7 @@ acpi_rs_dump_start_depend_fns ( | |||
232 | break; | 286 | break; |
233 | 287 | ||
234 | default: | 288 | default: |
235 | acpi_os_printf (" Invalid performance " | 289 | acpi_os_printf (" Invalid performance robustness preference\n"); |
236 | "robustness preference\n"); | ||
237 | break; | 290 | break; |
238 | } | 291 | } |
239 | 292 | ||
@@ -253,7 +306,7 @@ acpi_rs_dump_start_depend_fns ( | |||
253 | * | 306 | * |
254 | ******************************************************************************/ | 307 | ******************************************************************************/ |
255 | 308 | ||
256 | void | 309 | static void |
257 | acpi_rs_dump_io ( | 310 | acpi_rs_dump_io ( |
258 | union acpi_resource_data *data) | 311 | union acpi_resource_data *data) |
259 | { | 312 | { |
@@ -266,19 +319,15 @@ acpi_rs_dump_io ( | |||
266 | acpi_os_printf ("Io Resource\n"); | 319 | acpi_os_printf ("Io Resource\n"); |
267 | 320 | ||
268 | acpi_os_printf (" %d bit decode\n", | 321 | acpi_os_printf (" %d bit decode\n", |
269 | ACPI_DECODE_16 == io_data->io_decode ? 16 : 10); | 322 | ACPI_DECODE_16 == io_data->io_decode ? 16 : 10); |
270 | 323 | ||
271 | acpi_os_printf (" Range minimum base: %08X\n", | 324 | acpi_os_printf (" Range minimum base: %08X\n", io_data->min_base_address); |
272 | io_data->min_base_address); | ||
273 | 325 | ||
274 | acpi_os_printf (" Range maximum base: %08X\n", | 326 | acpi_os_printf (" Range maximum base: %08X\n", io_data->max_base_address); |
275 | io_data->max_base_address); | ||
276 | 327 | ||
277 | acpi_os_printf (" Alignment: %08X\n", | 328 | acpi_os_printf (" Alignment: %08X\n", io_data->alignment); |
278 | io_data->alignment); | ||
279 | 329 | ||
280 | acpi_os_printf (" Range Length: %08X\n", | 330 | acpi_os_printf (" Range Length: %08X\n", io_data->range_length); |
281 | io_data->range_length); | ||
282 | 331 | ||
283 | return; | 332 | return; |
284 | } | 333 | } |
@@ -296,7 +345,7 @@ acpi_rs_dump_io ( | |||
296 | * | 345 | * |
297 | ******************************************************************************/ | 346 | ******************************************************************************/ |
298 | 347 | ||
299 | void | 348 | static void |
300 | acpi_rs_dump_fixed_io ( | 349 | acpi_rs_dump_fixed_io ( |
301 | union acpi_resource_data *data) | 350 | union acpi_resource_data *data) |
302 | { | 351 | { |
@@ -307,11 +356,9 @@ acpi_rs_dump_fixed_io ( | |||
307 | 356 | ||
308 | 357 | ||
309 | acpi_os_printf ("Fixed Io Resource\n"); | 358 | acpi_os_printf ("Fixed Io Resource\n"); |
310 | acpi_os_printf (" Range base address: %08X", | 359 | acpi_os_printf (" Range base address: %08X", fixed_io_data->base_address); |
311 | fixed_io_data->base_address); | ||
312 | 360 | ||
313 | acpi_os_printf (" Range length: %08X", | 361 | acpi_os_printf (" Range length: %08X", fixed_io_data->range_length); |
314 | fixed_io_data->range_length); | ||
315 | 362 | ||
316 | return; | 363 | return; |
317 | } | 364 | } |
@@ -329,7 +376,7 @@ acpi_rs_dump_fixed_io ( | |||
329 | * | 376 | * |
330 | ******************************************************************************/ | 377 | ******************************************************************************/ |
331 | 378 | ||
332 | void | 379 | static void |
333 | acpi_rs_dump_vendor_specific ( | 380 | acpi_rs_dump_vendor_specific ( |
334 | union acpi_resource_data *data) | 381 | union acpi_resource_data *data) |
335 | { | 382 | { |
@@ -346,7 +393,7 @@ acpi_rs_dump_vendor_specific ( | |||
346 | 393 | ||
347 | for (index = 0; index < vendor_data->length; index++) { | 394 | for (index = 0; index < vendor_data->length; index++) { |
348 | acpi_os_printf (" Byte %X: %08X\n", | 395 | acpi_os_printf (" Byte %X: %08X\n", |
349 | index, vendor_data->reserved[index]); | 396 | index, vendor_data->reserved[index]); |
350 | } | 397 | } |
351 | 398 | ||
352 | return; | 399 | return; |
@@ -365,7 +412,7 @@ acpi_rs_dump_vendor_specific ( | |||
365 | * | 412 | * |
366 | ******************************************************************************/ | 413 | ******************************************************************************/ |
367 | 414 | ||
368 | void | 415 | static void |
369 | acpi_rs_dump_memory24 ( | 416 | acpi_rs_dump_memory24 ( |
370 | union acpi_resource_data *data) | 417 | union acpi_resource_data *data) |
371 | { | 418 | { |
@@ -378,21 +425,19 @@ acpi_rs_dump_memory24 ( | |||
378 | acpi_os_printf ("24-Bit Memory Range Resource\n"); | 425 | acpi_os_printf ("24-Bit Memory Range Resource\n"); |
379 | 426 | ||
380 | acpi_os_printf (" Read%s\n", | 427 | acpi_os_printf (" Read%s\n", |
381 | ACPI_READ_WRITE_MEMORY == | 428 | ACPI_READ_WRITE_MEMORY == |
382 | memory24_data->read_write_attribute ? | 429 | memory24_data->read_write_attribute ? |
383 | "/Write" : " only"); | 430 | "/Write" : " only"); |
384 | 431 | ||
385 | acpi_os_printf (" Range minimum base: %08X\n", | 432 | acpi_os_printf (" Range minimum base: %08X\n", |
386 | memory24_data->min_base_address); | 433 | memory24_data->min_base_address); |
387 | 434 | ||
388 | acpi_os_printf (" Range maximum base: %08X\n", | 435 | acpi_os_printf (" Range maximum base: %08X\n", |
389 | memory24_data->max_base_address); | 436 | memory24_data->max_base_address); |
390 | 437 | ||
391 | acpi_os_printf (" Alignment: %08X\n", | 438 | acpi_os_printf (" Alignment: %08X\n", memory24_data->alignment); |
392 | memory24_data->alignment); | ||
393 | 439 | ||
394 | acpi_os_printf (" Range length: %08X\n", | 440 | acpi_os_printf (" Range length: %08X\n", memory24_data->range_length); |
395 | memory24_data->range_length); | ||
396 | 441 | ||
397 | return; | 442 | return; |
398 | } | 443 | } |
@@ -410,7 +455,7 @@ acpi_rs_dump_memory24 ( | |||
410 | * | 455 | * |
411 | ******************************************************************************/ | 456 | ******************************************************************************/ |
412 | 457 | ||
413 | void | 458 | static void |
414 | acpi_rs_dump_memory32 ( | 459 | acpi_rs_dump_memory32 ( |
415 | union acpi_resource_data *data) | 460 | union acpi_resource_data *data) |
416 | { | 461 | { |
@@ -423,21 +468,19 @@ acpi_rs_dump_memory32 ( | |||
423 | acpi_os_printf ("32-Bit Memory Range Resource\n"); | 468 | acpi_os_printf ("32-Bit Memory Range Resource\n"); |
424 | 469 | ||
425 | acpi_os_printf (" Read%s\n", | 470 | acpi_os_printf (" Read%s\n", |
426 | ACPI_READ_WRITE_MEMORY == | 471 | ACPI_READ_WRITE_MEMORY == |
427 | memory32_data->read_write_attribute ? | 472 | memory32_data->read_write_attribute ? |
428 | "/Write" : " only"); | 473 | "/Write" : " only"); |
429 | 474 | ||
430 | acpi_os_printf (" Range minimum base: %08X\n", | 475 | acpi_os_printf (" Range minimum base: %08X\n", |
431 | memory32_data->min_base_address); | 476 | memory32_data->min_base_address); |
432 | 477 | ||
433 | acpi_os_printf (" Range maximum base: %08X\n", | 478 | acpi_os_printf (" Range maximum base: %08X\n", |
434 | memory32_data->max_base_address); | 479 | memory32_data->max_base_address); |
435 | 480 | ||
436 | acpi_os_printf (" Alignment: %08X\n", | 481 | acpi_os_printf (" Alignment: %08X\n", memory32_data->alignment); |
437 | memory32_data->alignment); | ||
438 | 482 | ||
439 | acpi_os_printf (" Range length: %08X\n", | 483 | acpi_os_printf (" Range length: %08X\n", memory32_data->range_length); |
440 | memory32_data->range_length); | ||
441 | 484 | ||
442 | return; | 485 | return; |
443 | } | 486 | } |
@@ -455,11 +498,12 @@ acpi_rs_dump_memory32 ( | |||
455 | * | 498 | * |
456 | ******************************************************************************/ | 499 | ******************************************************************************/ |
457 | 500 | ||
458 | void | 501 | static void |
459 | acpi_rs_dump_fixed_memory32 ( | 502 | acpi_rs_dump_fixed_memory32 ( |
460 | union acpi_resource_data *data) | 503 | union acpi_resource_data *data) |
461 | { | 504 | { |
462 | struct acpi_resource_fixed_mem32 *fixed_memory32_data = (struct acpi_resource_fixed_mem32 *) data; | 505 | struct acpi_resource_fixed_mem32 *fixed_memory32_data = |
506 | (struct acpi_resource_fixed_mem32 *) data; | ||
463 | 507 | ||
464 | 508 | ||
465 | ACPI_FUNCTION_ENTRY (); | 509 | ACPI_FUNCTION_ENTRY (); |
@@ -468,15 +512,14 @@ acpi_rs_dump_fixed_memory32 ( | |||
468 | acpi_os_printf ("32-Bit Fixed Location Memory Range Resource\n"); | 512 | acpi_os_printf ("32-Bit Fixed Location Memory Range Resource\n"); |
469 | 513 | ||
470 | acpi_os_printf (" Read%s\n", | 514 | acpi_os_printf (" Read%s\n", |
471 | ACPI_READ_WRITE_MEMORY == | 515 | ACPI_READ_WRITE_MEMORY == |
472 | fixed_memory32_data->read_write_attribute ? | 516 | fixed_memory32_data->read_write_attribute ? "/Write" : " Only"); |
473 | "/Write" : " Only"); | ||
474 | 517 | ||
475 | acpi_os_printf (" Range base address: %08X\n", | 518 | acpi_os_printf (" Range base address: %08X\n", |
476 | fixed_memory32_data->range_base_address); | 519 | fixed_memory32_data->range_base_address); |
477 | 520 | ||
478 | acpi_os_printf (" Range length: %08X\n", | 521 | acpi_os_printf (" Range length: %08X\n", |
479 | fixed_memory32_data->range_length); | 522 | fixed_memory32_data->range_length); |
480 | 523 | ||
481 | return; | 524 | return; |
482 | } | 525 | } |
@@ -494,7 +537,7 @@ acpi_rs_dump_fixed_memory32 ( | |||
494 | * | 537 | * |
495 | ******************************************************************************/ | 538 | ******************************************************************************/ |
496 | 539 | ||
497 | void | 540 | static void |
498 | acpi_rs_dump_address16 ( | 541 | acpi_rs_dump_address16 ( |
499 | union acpi_resource_data *data) | 542 | union acpi_resource_data *data) |
500 | { | 543 | { |
@@ -514,35 +557,30 @@ acpi_rs_dump_address16 ( | |||
514 | 557 | ||
515 | switch (address16_data->attribute.memory.cache_attribute) { | 558 | switch (address16_data->attribute.memory.cache_attribute) { |
516 | case ACPI_NON_CACHEABLE_MEMORY: | 559 | case ACPI_NON_CACHEABLE_MEMORY: |
517 | acpi_os_printf (" Type Specific: " | 560 | acpi_os_printf (" Type Specific: Noncacheable memory\n"); |
518 | "Noncacheable memory\n"); | ||
519 | break; | 561 | break; |
520 | 562 | ||
521 | case ACPI_CACHABLE_MEMORY: | 563 | case ACPI_CACHABLE_MEMORY: |
522 | acpi_os_printf (" Type Specific: " | 564 | acpi_os_printf (" Type Specific: Cacheable memory\n"); |
523 | "Cacheable memory\n"); | ||
524 | break; | 565 | break; |
525 | 566 | ||
526 | case ACPI_WRITE_COMBINING_MEMORY: | 567 | case ACPI_WRITE_COMBINING_MEMORY: |
527 | acpi_os_printf (" Type Specific: " | 568 | acpi_os_printf (" Type Specific: Write-combining memory\n"); |
528 | "Write-combining memory\n"); | ||
529 | break; | 569 | break; |
530 | 570 | ||
531 | case ACPI_PREFETCHABLE_MEMORY: | 571 | case ACPI_PREFETCHABLE_MEMORY: |
532 | acpi_os_printf (" Type Specific: " | 572 | acpi_os_printf (" Type Specific: Prefetchable memory\n"); |
533 | "Prefetchable memory\n"); | ||
534 | break; | 573 | break; |
535 | 574 | ||
536 | default: | 575 | default: |
537 | acpi_os_printf (" Type Specific: " | 576 | acpi_os_printf (" Type Specific: Invalid cache attribute\n"); |
538 | "Invalid cache attribute\n"); | ||
539 | break; | 577 | break; |
540 | } | 578 | } |
541 | 579 | ||
542 | acpi_os_printf (" Type Specific: Read%s\n", | 580 | acpi_os_printf (" Type Specific: Read%s\n", |
543 | ACPI_READ_WRITE_MEMORY == | 581 | ACPI_READ_WRITE_MEMORY == |
544 | address16_data->attribute.memory.read_write_attribute ? | 582 | address16_data->attribute.memory.read_write_attribute ? |
545 | "/Write" : " Only"); | 583 | "/Write" : " Only"); |
546 | break; | 584 | break; |
547 | 585 | ||
548 | case ACPI_IO_RANGE: | 586 | case ACPI_IO_RANGE: |
@@ -551,30 +589,26 @@ acpi_rs_dump_address16 ( | |||
551 | 589 | ||
552 | switch (address16_data->attribute.io.range_attribute) { | 590 | switch (address16_data->attribute.io.range_attribute) { |
553 | case ACPI_NON_ISA_ONLY_RANGES: | 591 | case ACPI_NON_ISA_ONLY_RANGES: |
554 | acpi_os_printf (" Type Specific: " | 592 | acpi_os_printf (" Type Specific: Non-ISA Io Addresses\n"); |
555 | "Non-ISA Io Addresses\n"); | ||
556 | break; | 593 | break; |
557 | 594 | ||
558 | case ACPI_ISA_ONLY_RANGES: | 595 | case ACPI_ISA_ONLY_RANGES: |
559 | acpi_os_printf (" Type Specific: " | 596 | acpi_os_printf (" Type Specific: ISA Io Addresses\n"); |
560 | "ISA Io Addresses\n"); | ||
561 | break; | 597 | break; |
562 | 598 | ||
563 | case ACPI_ENTIRE_RANGE: | 599 | case ACPI_ENTIRE_RANGE: |
564 | acpi_os_printf (" Type Specific: " | 600 | acpi_os_printf (" Type Specific: ISA and non-ISA Io Addresses\n"); |
565 | "ISA and non-ISA Io Addresses\n"); | ||
566 | break; | 601 | break; |
567 | 602 | ||
568 | default: | 603 | default: |
569 | acpi_os_printf (" Type Specific: " | 604 | acpi_os_printf (" Type Specific: Invalid range attribute\n"); |
570 | "Invalid range attribute\n"); | ||
571 | break; | 605 | break; |
572 | } | 606 | } |
573 | 607 | ||
574 | acpi_os_printf (" Type Specific: %s Translation\n", | 608 | acpi_os_printf (" Type Specific: %s Translation\n", |
575 | ACPI_SPARSE_TRANSLATION == | 609 | ACPI_SPARSE_TRANSLATION == |
576 | address16_data->attribute.io.translation_attribute ? | 610 | address16_data->attribute.io.translation_attribute ? |
577 | "Sparse" : "Dense"); | 611 | "Sparse" : "Dense"); |
578 | break; | 612 | break; |
579 | 613 | ||
580 | case ACPI_BUS_NUMBER_RANGE: | 614 | case ACPI_BUS_NUMBER_RANGE: |
@@ -589,41 +623,42 @@ acpi_rs_dump_address16 ( | |||
589 | } | 623 | } |
590 | 624 | ||
591 | acpi_os_printf (" Resource %s\n", | 625 | acpi_os_printf (" Resource %s\n", |
592 | ACPI_CONSUMER == address16_data->producer_consumer ? | 626 | ACPI_CONSUMER == address16_data->producer_consumer ? |
593 | "Consumer" : "Producer"); | 627 | "Consumer" : "Producer"); |
594 | 628 | ||
595 | acpi_os_printf (" %s decode\n", | 629 | acpi_os_printf (" %s decode\n", |
596 | ACPI_SUB_DECODE == address16_data->decode ? | 630 | ACPI_SUB_DECODE == address16_data->decode ? |
597 | "Subtractive" : "Positive"); | 631 | "Subtractive" : "Positive"); |
598 | 632 | ||
599 | acpi_os_printf (" Min address is %s fixed\n", | 633 | acpi_os_printf (" Min address is %s fixed\n", |
600 | ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ? | 634 | ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ? |
601 | "" : "not"); | 635 | "" : "not"); |
602 | 636 | ||
603 | acpi_os_printf (" Max address is %s fixed\n", | 637 | acpi_os_printf (" Max address is %s fixed\n", |
604 | ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ? | 638 | ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ? |
605 | "" : "not"); | 639 | "" : "not"); |
606 | 640 | ||
607 | acpi_os_printf (" Granularity: %08X\n", | 641 | acpi_os_printf (" Granularity: %08X\n", |
608 | address16_data->granularity); | 642 | address16_data->granularity); |
609 | 643 | ||
610 | acpi_os_printf (" Address range min: %08X\n", | 644 | acpi_os_printf (" Address range min: %08X\n", |
611 | address16_data->min_address_range); | 645 | address16_data->min_address_range); |
612 | 646 | ||
613 | acpi_os_printf (" Address range max: %08X\n", | 647 | acpi_os_printf (" Address range max: %08X\n", |
614 | address16_data->max_address_range); | 648 | address16_data->max_address_range); |
615 | 649 | ||
616 | acpi_os_printf (" Address translation offset: %08X\n", | 650 | acpi_os_printf (" Address translation offset: %08X\n", |
617 | address16_data->address_translation_offset); | 651 | address16_data->address_translation_offset); |
618 | 652 | ||
619 | acpi_os_printf (" Address Length: %08X\n", | 653 | acpi_os_printf (" Address Length: %08X\n", |
620 | address16_data->address_length); | 654 | address16_data->address_length); |
621 | 655 | ||
622 | if (0xFF != address16_data->resource_source.index) { | 656 | if (0xFF != address16_data->resource_source.index) { |
623 | acpi_os_printf (" Resource Source Index: %X\n", | 657 | acpi_os_printf (" Resource Source Index: %X\n", |
624 | address16_data->resource_source.index); | 658 | address16_data->resource_source.index); |
659 | |||
625 | acpi_os_printf (" Resource Source: %s\n", | 660 | acpi_os_printf (" Resource Source: %s\n", |
626 | address16_data->resource_source.string_ptr); | 661 | address16_data->resource_source.string_ptr); |
627 | } | 662 | } |
628 | 663 | ||
629 | return; | 664 | return; |
@@ -642,7 +677,7 @@ acpi_rs_dump_address16 ( | |||
642 | * | 677 | * |
643 | ******************************************************************************/ | 678 | ******************************************************************************/ |
644 | 679 | ||
645 | void | 680 | static void |
646 | acpi_rs_dump_address32 ( | 681 | acpi_rs_dump_address32 ( |
647 | union acpi_resource_data *data) | 682 | union acpi_resource_data *data) |
648 | { | 683 | { |
@@ -661,35 +696,30 @@ acpi_rs_dump_address32 ( | |||
661 | 696 | ||
662 | switch (address32_data->attribute.memory.cache_attribute) { | 697 | switch (address32_data->attribute.memory.cache_attribute) { |
663 | case ACPI_NON_CACHEABLE_MEMORY: | 698 | case ACPI_NON_CACHEABLE_MEMORY: |
664 | acpi_os_printf (" Type Specific: " | 699 | acpi_os_printf (" Type Specific: Noncacheable memory\n"); |
665 | "Noncacheable memory\n"); | ||
666 | break; | 700 | break; |
667 | 701 | ||
668 | case ACPI_CACHABLE_MEMORY: | 702 | case ACPI_CACHABLE_MEMORY: |
669 | acpi_os_printf (" Type Specific: " | 703 | acpi_os_printf (" Type Specific: Cacheable memory\n"); |
670 | "Cacheable memory\n"); | ||
671 | break; | 704 | break; |
672 | 705 | ||
673 | case ACPI_WRITE_COMBINING_MEMORY: | 706 | case ACPI_WRITE_COMBINING_MEMORY: |
674 | acpi_os_printf (" Type Specific: " | 707 | acpi_os_printf (" Type Specific: Write-combining memory\n"); |
675 | "Write-combining memory\n"); | ||
676 | break; | 708 | break; |
677 | 709 | ||
678 | case ACPI_PREFETCHABLE_MEMORY: | 710 | case ACPI_PREFETCHABLE_MEMORY: |
679 | acpi_os_printf (" Type Specific: " | 711 | acpi_os_printf (" Type Specific: Prefetchable memory\n"); |
680 | "Prefetchable memory\n"); | ||
681 | break; | 712 | break; |
682 | 713 | ||
683 | default: | 714 | default: |
684 | acpi_os_printf (" Type Specific: " | 715 | acpi_os_printf (" Type Specific: Invalid cache attribute\n"); |
685 | "Invalid cache attribute\n"); | ||
686 | break; | 716 | break; |
687 | } | 717 | } |
688 | 718 | ||
689 | acpi_os_printf (" Type Specific: Read%s\n", | 719 | acpi_os_printf (" Type Specific: Read%s\n", |
690 | ACPI_READ_WRITE_MEMORY == | 720 | ACPI_READ_WRITE_MEMORY == |
691 | address32_data->attribute.memory.read_write_attribute ? | 721 | address32_data->attribute.memory.read_write_attribute ? |
692 | "/Write" : " Only"); | 722 | "/Write" : " Only"); |
693 | break; | 723 | break; |
694 | 724 | ||
695 | case ACPI_IO_RANGE: | 725 | case ACPI_IO_RANGE: |
@@ -698,30 +728,26 @@ acpi_rs_dump_address32 ( | |||
698 | 728 | ||
699 | switch (address32_data->attribute.io.range_attribute) { | 729 | switch (address32_data->attribute.io.range_attribute) { |
700 | case ACPI_NON_ISA_ONLY_RANGES: | 730 | case ACPI_NON_ISA_ONLY_RANGES: |
701 | acpi_os_printf (" Type Specific: " | 731 | acpi_os_printf (" Type Specific: Non-ISA Io Addresses\n"); |
702 | "Non-ISA Io Addresses\n"); | ||
703 | break; | 732 | break; |
704 | 733 | ||
705 | case ACPI_ISA_ONLY_RANGES: | 734 | case ACPI_ISA_ONLY_RANGES: |
706 | acpi_os_printf (" Type Specific: " | 735 | acpi_os_printf (" Type Specific: ISA Io Addresses\n"); |
707 | "ISA Io Addresses\n"); | ||
708 | break; | 736 | break; |
709 | 737 | ||
710 | case ACPI_ENTIRE_RANGE: | 738 | case ACPI_ENTIRE_RANGE: |
711 | acpi_os_printf (" Type Specific: " | 739 | acpi_os_printf (" Type Specific: ISA and non-ISA Io Addresses\n"); |
712 | "ISA and non-ISA Io Addresses\n"); | ||
713 | break; | 740 | break; |
714 | 741 | ||
715 | default: | 742 | default: |
716 | acpi_os_printf (" Type Specific: " | 743 | acpi_os_printf (" Type Specific: Invalid Range attribute"); |
717 | "Invalid Range attribute"); | ||
718 | break; | 744 | break; |
719 | } | 745 | } |
720 | 746 | ||
721 | acpi_os_printf (" Type Specific: %s Translation\n", | 747 | acpi_os_printf (" Type Specific: %s Translation\n", |
722 | ACPI_SPARSE_TRANSLATION == | 748 | ACPI_SPARSE_TRANSLATION == |
723 | address32_data->attribute.io.translation_attribute ? | 749 | address32_data->attribute.io.translation_attribute ? |
724 | "Sparse" : "Dense"); | 750 | "Sparse" : "Dense"); |
725 | break; | 751 | break; |
726 | 752 | ||
727 | case ACPI_BUS_NUMBER_RANGE: | 753 | case ACPI_BUS_NUMBER_RANGE: |
@@ -731,46 +757,48 @@ acpi_rs_dump_address32 ( | |||
731 | 757 | ||
732 | default: | 758 | default: |
733 | 759 | ||
734 | acpi_os_printf (" Resource Type: 0x%2.2X\n", address32_data->resource_type); | 760 | acpi_os_printf (" Resource Type: 0x%2.2X\n", |
761 | address32_data->resource_type); | ||
735 | break; | 762 | break; |
736 | } | 763 | } |
737 | 764 | ||
738 | acpi_os_printf (" Resource %s\n", | 765 | acpi_os_printf (" Resource %s\n", |
739 | ACPI_CONSUMER == address32_data->producer_consumer ? | 766 | ACPI_CONSUMER == address32_data->producer_consumer ? |
740 | "Consumer" : "Producer"); | 767 | "Consumer" : "Producer"); |
741 | 768 | ||
742 | acpi_os_printf (" %s decode\n", | 769 | acpi_os_printf (" %s decode\n", |
743 | ACPI_SUB_DECODE == address32_data->decode ? | 770 | ACPI_SUB_DECODE == address32_data->decode ? |
744 | "Subtractive" : "Positive"); | 771 | "Subtractive" : "Positive"); |
745 | 772 | ||
746 | acpi_os_printf (" Min address is %s fixed\n", | 773 | acpi_os_printf (" Min address is %s fixed\n", |
747 | ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ? | 774 | ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ? |
748 | "" : "not "); | 775 | "" : "not "); |
749 | 776 | ||
750 | acpi_os_printf (" Max address is %s fixed\n", | 777 | acpi_os_printf (" Max address is %s fixed\n", |
751 | ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ? | 778 | ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ? |
752 | "" : "not "); | 779 | "" : "not "); |
753 | 780 | ||
754 | acpi_os_printf (" Granularity: %08X\n", | 781 | acpi_os_printf (" Granularity: %08X\n", |
755 | address32_data->granularity); | 782 | address32_data->granularity); |
756 | 783 | ||
757 | acpi_os_printf (" Address range min: %08X\n", | 784 | acpi_os_printf (" Address range min: %08X\n", |
758 | address32_data->min_address_range); | 785 | address32_data->min_address_range); |
759 | 786 | ||
760 | acpi_os_printf (" Address range max: %08X\n", | 787 | acpi_os_printf (" Address range max: %08X\n", |
761 | address32_data->max_address_range); | 788 | address32_data->max_address_range); |
762 | 789 | ||
763 | acpi_os_printf (" Address translation offset: %08X\n", | 790 | acpi_os_printf (" Address translation offset: %08X\n", |
764 | address32_data->address_translation_offset); | 791 | address32_data->address_translation_offset); |
765 | 792 | ||
766 | acpi_os_printf (" Address Length: %08X\n", | 793 | acpi_os_printf (" Address Length: %08X\n", |
767 | address32_data->address_length); | 794 | address32_data->address_length); |
768 | 795 | ||
769 | if(0xFF != address32_data->resource_source.index) { | 796 | if(0xFF != address32_data->resource_source.index) { |
770 | acpi_os_printf (" Resource Source Index: %X\n", | 797 | acpi_os_printf (" Resource Source Index: %X\n", |
771 | address32_data->resource_source.index); | 798 | address32_data->resource_source.index); |
799 | |||
772 | acpi_os_printf (" Resource Source: %s\n", | 800 | acpi_os_printf (" Resource Source: %s\n", |
773 | address32_data->resource_source.string_ptr); | 801 | address32_data->resource_source.string_ptr); |
774 | } | 802 | } |
775 | 803 | ||
776 | return; | 804 | return; |
@@ -789,7 +817,7 @@ acpi_rs_dump_address32 ( | |||
789 | * | 817 | * |
790 | ******************************************************************************/ | 818 | ******************************************************************************/ |
791 | 819 | ||
792 | void | 820 | static void |
793 | acpi_rs_dump_address64 ( | 821 | acpi_rs_dump_address64 ( |
794 | union acpi_resource_data *data) | 822 | union acpi_resource_data *data) |
795 | { | 823 | { |
@@ -808,35 +836,30 @@ acpi_rs_dump_address64 ( | |||
808 | 836 | ||
809 | switch (address64_data->attribute.memory.cache_attribute) { | 837 | switch (address64_data->attribute.memory.cache_attribute) { |
810 | case ACPI_NON_CACHEABLE_MEMORY: | 838 | case ACPI_NON_CACHEABLE_MEMORY: |
811 | acpi_os_printf (" Type Specific: " | 839 | acpi_os_printf (" Type Specific: Noncacheable memory\n"); |
812 | "Noncacheable memory\n"); | ||
813 | break; | 840 | break; |
814 | 841 | ||
815 | case ACPI_CACHABLE_MEMORY: | 842 | case ACPI_CACHABLE_MEMORY: |
816 | acpi_os_printf (" Type Specific: " | 843 | acpi_os_printf (" Type Specific: Cacheable memory\n"); |
817 | "Cacheable memory\n"); | ||
818 | break; | 844 | break; |
819 | 845 | ||
820 | case ACPI_WRITE_COMBINING_MEMORY: | 846 | case ACPI_WRITE_COMBINING_MEMORY: |
821 | acpi_os_printf (" Type Specific: " | 847 | acpi_os_printf (" Type Specific: Write-combining memory\n"); |
822 | "Write-combining memory\n"); | ||
823 | break; | 848 | break; |
824 | 849 | ||
825 | case ACPI_PREFETCHABLE_MEMORY: | 850 | case ACPI_PREFETCHABLE_MEMORY: |
826 | acpi_os_printf (" Type Specific: " | 851 | acpi_os_printf (" Type Specific: Prefetchable memory\n"); |
827 | "Prefetchable memory\n"); | ||
828 | break; | 852 | break; |
829 | 853 | ||
830 | default: | 854 | default: |
831 | acpi_os_printf (" Type Specific: " | 855 | acpi_os_printf (" Type Specific: Invalid cache attribute\n"); |
832 | "Invalid cache attribute\n"); | ||
833 | break; | 856 | break; |
834 | } | 857 | } |
835 | 858 | ||
836 | acpi_os_printf (" Type Specific: Read%s\n", | 859 | acpi_os_printf (" Type Specific: Read%s\n", |
837 | ACPI_READ_WRITE_MEMORY == | 860 | ACPI_READ_WRITE_MEMORY == |
838 | address64_data->attribute.memory.read_write_attribute ? | 861 | address64_data->attribute.memory.read_write_attribute ? |
839 | "/Write" : " Only"); | 862 | "/Write" : " Only"); |
840 | break; | 863 | break; |
841 | 864 | ||
842 | case ACPI_IO_RANGE: | 865 | case ACPI_IO_RANGE: |
@@ -845,30 +868,26 @@ acpi_rs_dump_address64 ( | |||
845 | 868 | ||
846 | switch (address64_data->attribute.io.range_attribute) { | 869 | switch (address64_data->attribute.io.range_attribute) { |
847 | case ACPI_NON_ISA_ONLY_RANGES: | 870 | case ACPI_NON_ISA_ONLY_RANGES: |
848 | acpi_os_printf (" Type Specific: " | 871 | acpi_os_printf (" Type Specific: Non-ISA Io Addresses\n"); |
849 | "Non-ISA Io Addresses\n"); | ||
850 | break; | 872 | break; |
851 | 873 | ||
852 | case ACPI_ISA_ONLY_RANGES: | 874 | case ACPI_ISA_ONLY_RANGES: |
853 | acpi_os_printf (" Type Specific: " | 875 | acpi_os_printf (" Type Specific: ISA Io Addresses\n"); |
854 | "ISA Io Addresses\n"); | ||
855 | break; | 876 | break; |
856 | 877 | ||
857 | case ACPI_ENTIRE_RANGE: | 878 | case ACPI_ENTIRE_RANGE: |
858 | acpi_os_printf (" Type Specific: " | 879 | acpi_os_printf (" Type Specific: ISA and non-ISA Io Addresses\n"); |
859 | "ISA and non-ISA Io Addresses\n"); | ||
860 | break; | 880 | break; |
861 | 881 | ||
862 | default: | 882 | default: |
863 | acpi_os_printf (" Type Specific: " | 883 | acpi_os_printf (" Type Specific: Invalid Range attribute"); |
864 | "Invalid Range attribute"); | ||
865 | break; | 884 | break; |
866 | } | 885 | } |
867 | 886 | ||
868 | acpi_os_printf (" Type Specific: %s Translation\n", | 887 | acpi_os_printf (" Type Specific: %s Translation\n", |
869 | ACPI_SPARSE_TRANSLATION == | 888 | ACPI_SPARSE_TRANSLATION == |
870 | address64_data->attribute.io.translation_attribute ? | 889 | address64_data->attribute.io.translation_attribute ? |
871 | "Sparse" : "Dense"); | 890 | "Sparse" : "Dense"); |
872 | break; | 891 | break; |
873 | 892 | ||
874 | case ACPI_BUS_NUMBER_RANGE: | 893 | case ACPI_BUS_NUMBER_RANGE: |
@@ -878,49 +897,51 @@ acpi_rs_dump_address64 ( | |||
878 | 897 | ||
879 | default: | 898 | default: |
880 | 899 | ||
881 | acpi_os_printf (" Resource Type: 0x%2.2X\n", address64_data->resource_type); | 900 | acpi_os_printf (" Resource Type: 0x%2.2X\n", |
901 | address64_data->resource_type); | ||
882 | break; | 902 | break; |
883 | } | 903 | } |
884 | 904 | ||
885 | acpi_os_printf (" Resource %s\n", | 905 | acpi_os_printf (" Resource %s\n", |
886 | ACPI_CONSUMER == address64_data->producer_consumer ? | 906 | ACPI_CONSUMER == address64_data->producer_consumer ? |
887 | "Consumer" : "Producer"); | 907 | "Consumer" : "Producer"); |
888 | 908 | ||
889 | acpi_os_printf (" %s decode\n", | 909 | acpi_os_printf (" %s decode\n", |
890 | ACPI_SUB_DECODE == address64_data->decode ? | 910 | ACPI_SUB_DECODE == address64_data->decode ? |
891 | "Subtractive" : "Positive"); | 911 | "Subtractive" : "Positive"); |
892 | 912 | ||
893 | acpi_os_printf (" Min address is %s fixed\n", | 913 | acpi_os_printf (" Min address is %s fixed\n", |
894 | ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ? | 914 | ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ? |
895 | "" : "not "); | 915 | "" : "not "); |
896 | 916 | ||
897 | acpi_os_printf (" Max address is %s fixed\n", | 917 | acpi_os_printf (" Max address is %s fixed\n", |
898 | ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ? | 918 | ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ? |
899 | "" : "not "); | 919 | "" : "not "); |
900 | 920 | ||
901 | acpi_os_printf (" Granularity: %8.8X%8.8X\n", | 921 | acpi_os_printf (" Granularity: %8.8X%8.8X\n", |
902 | ACPI_FORMAT_UINT64 (address64_data->granularity)); | 922 | ACPI_FORMAT_UINT64 (address64_data->granularity)); |
903 | 923 | ||
904 | acpi_os_printf (" Address range min: %8.8X%8.8X\n", | 924 | acpi_os_printf (" Address range min: %8.8X%8.8X\n", |
905 | ACPI_FORMAT_UINT64 (address64_data->min_address_range)); | 925 | ACPI_FORMAT_UINT64 (address64_data->min_address_range)); |
906 | 926 | ||
907 | acpi_os_printf (" Address range max: %8.8X%8.8X\n", | 927 | acpi_os_printf (" Address range max: %8.8X%8.8X\n", |
908 | ACPI_FORMAT_UINT64 (address64_data->max_address_range)); | 928 | ACPI_FORMAT_UINT64 (address64_data->max_address_range)); |
909 | 929 | ||
910 | acpi_os_printf (" Address translation offset: %8.8X%8.8X\n", | 930 | acpi_os_printf (" Address translation offset: %8.8X%8.8X\n", |
911 | ACPI_FORMAT_UINT64 (address64_data->address_translation_offset)); | 931 | ACPI_FORMAT_UINT64 (address64_data->address_translation_offset)); |
912 | 932 | ||
913 | acpi_os_printf (" Address Length: %8.8X%8.8X\n", | 933 | acpi_os_printf (" Address Length: %8.8X%8.8X\n", |
914 | ACPI_FORMAT_UINT64 (address64_data->address_length)); | 934 | ACPI_FORMAT_UINT64 (address64_data->address_length)); |
915 | 935 | ||
916 | acpi_os_printf (" Type Specific Attributes: %8.8X%8.8X\n", | 936 | acpi_os_printf (" Type Specific Attributes: %8.8X%8.8X\n", |
917 | ACPI_FORMAT_UINT64 (address64_data->type_specific_attributes)); | 937 | ACPI_FORMAT_UINT64 (address64_data->type_specific_attributes)); |
918 | 938 | ||
919 | if (0xFF != address64_data->resource_source.index) { | 939 | if (0xFF != address64_data->resource_source.index) { |
920 | acpi_os_printf (" Resource Source Index: %X\n", | 940 | acpi_os_printf (" Resource Source Index: %X\n", |
921 | address64_data->resource_source.index); | 941 | address64_data->resource_source.index); |
942 | |||
922 | acpi_os_printf (" Resource Source: %s\n", | 943 | acpi_os_printf (" Resource Source: %s\n", |
923 | address64_data->resource_source.string_ptr); | 944 | address64_data->resource_source.string_ptr); |
924 | } | 945 | } |
925 | 946 | ||
926 | return; | 947 | return; |
@@ -939,7 +960,7 @@ acpi_rs_dump_address64 ( | |||
939 | * | 960 | * |
940 | ******************************************************************************/ | 961 | ******************************************************************************/ |
941 | 962 | ||
942 | void | 963 | static void |
943 | acpi_rs_dump_extended_irq ( | 964 | acpi_rs_dump_extended_irq ( |
944 | union acpi_resource_data *data) | 965 | union acpi_resource_data *data) |
945 | { | 966 | { |
@@ -953,23 +974,22 @@ acpi_rs_dump_extended_irq ( | |||
953 | acpi_os_printf ("Extended IRQ Resource\n"); | 974 | acpi_os_printf ("Extended IRQ Resource\n"); |
954 | 975 | ||
955 | acpi_os_printf (" Resource %s\n", | 976 | acpi_os_printf (" Resource %s\n", |
956 | ACPI_CONSUMER == ext_irq_data->producer_consumer ? | 977 | ACPI_CONSUMER == ext_irq_data->producer_consumer ? |
957 | "Consumer" : "Producer"); | 978 | "Consumer" : "Producer"); |
958 | 979 | ||
959 | acpi_os_printf (" %s\n", | 980 | acpi_os_printf (" %s\n", |
960 | ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ? | 981 | ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ? |
961 | "Level" : "Edge"); | 982 | "Level" : "Edge"); |
962 | 983 | ||
963 | acpi_os_printf (" Active %s\n", | 984 | acpi_os_printf (" Active %s\n", |
964 | ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ? | 985 | ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ? |
965 | "low" : "high"); | 986 | "low" : "high"); |
966 | 987 | ||
967 | acpi_os_printf (" %s\n", | 988 | acpi_os_printf (" %s\n", |
968 | ACPI_SHARED == ext_irq_data->shared_exclusive ? | 989 | ACPI_SHARED == ext_irq_data->shared_exclusive ? |
969 | "Shared" : "Exclusive"); | 990 | "Shared" : "Exclusive"); |
970 | 991 | ||
971 | acpi_os_printf (" Interrupts : %X ( ", | 992 | acpi_os_printf (" Interrupts : %X ( ", ext_irq_data->number_of_interrupts); |
972 | ext_irq_data->number_of_interrupts); | ||
973 | 993 | ||
974 | for (index = 0; index < ext_irq_data->number_of_interrupts; index++) { | 994 | for (index = 0; index < ext_irq_data->number_of_interrupts; index++) { |
975 | acpi_os_printf ("%X ", ext_irq_data->interrupts[index]); | 995 | acpi_os_printf ("%X ", ext_irq_data->interrupts[index]); |
@@ -979,9 +999,10 @@ acpi_rs_dump_extended_irq ( | |||
979 | 999 | ||
980 | if(0xFF != ext_irq_data->resource_source.index) { | 1000 | if(0xFF != ext_irq_data->resource_source.index) { |
981 | acpi_os_printf (" Resource Source Index: %X", | 1001 | acpi_os_printf (" Resource Source Index: %X", |
982 | ext_irq_data->resource_source.index); | 1002 | ext_irq_data->resource_source.index); |
1003 | |||
983 | acpi_os_printf (" Resource Source: %s", | 1004 | acpi_os_printf (" Resource Source: %s", |
984 | ext_irq_data->resource_source.string_ptr); | 1005 | ext_irq_data->resource_source.string_ptr); |
985 | } | 1006 | } |
986 | 1007 | ||
987 | return; | 1008 | return; |
@@ -992,7 +1013,7 @@ acpi_rs_dump_extended_irq ( | |||
992 | * | 1013 | * |
993 | * FUNCTION: acpi_rs_dump_resource_list | 1014 | * FUNCTION: acpi_rs_dump_resource_list |
994 | * | 1015 | * |
995 | * PARAMETERS: Data - pointer to the resource structure to dump. | 1016 | * PARAMETERS: Resource - pointer to the resource structure to dump. |
996 | * | 1017 | * |
997 | * RETURN: None | 1018 | * RETURN: None |
998 | * | 1019 | * |
@@ -1096,7 +1117,7 @@ acpi_rs_dump_resource_list ( | |||
1096 | * | 1117 | * |
1097 | * FUNCTION: acpi_rs_dump_irq_list | 1118 | * FUNCTION: acpi_rs_dump_irq_list |
1098 | * | 1119 | * |
1099 | * PARAMETERS: Data - pointer to the routing table to dump. | 1120 | * PARAMETERS: route_table - pointer to the routing table to dump. |
1100 | * | 1121 | * |
1101 | * RETURN: None | 1122 | * RETURN: None |
1102 | * | 1123 | * |
@@ -1124,20 +1145,17 @@ acpi_rs_dump_irq_list ( | |||
1124 | acpi_os_printf ("PCI IRQ Routing Table structure %X.\n", count++); | 1145 | acpi_os_printf ("PCI IRQ Routing Table structure %X.\n", count++); |
1125 | 1146 | ||
1126 | acpi_os_printf (" Address: %8.8X%8.8X\n", | 1147 | acpi_os_printf (" Address: %8.8X%8.8X\n", |
1127 | ACPI_FORMAT_UINT64 (prt_element->address)); | 1148 | ACPI_FORMAT_UINT64 (prt_element->address)); |
1128 | 1149 | ||
1129 | acpi_os_printf (" Pin: %X\n", prt_element->pin); | 1150 | acpi_os_printf (" Pin: %X\n", prt_element->pin); |
1130 | 1151 | ||
1131 | acpi_os_printf (" Source: %s\n", prt_element->source); | 1152 | acpi_os_printf (" Source: %s\n", prt_element->source); |
1132 | 1153 | ||
1133 | acpi_os_printf (" source_index: %X\n", | 1154 | acpi_os_printf (" source_index: %X\n", prt_element->source_index); |
1134 | prt_element->source_index); | ||
1135 | 1155 | ||
1136 | buffer += prt_element->length; | 1156 | buffer += prt_element->length; |
1137 | |||
1138 | prt_element = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer); | 1157 | prt_element = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer); |
1139 | 1158 | if (0 == prt_element->length) { | |
1140 | if(0 == prt_element->length) { | ||
1141 | done = TRUE; | 1159 | done = TRUE; |
1142 | } | 1160 | } |
1143 | } | 1161 | } |
diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c index 972c746d37e4..23a4d149fac8 100644 --- a/drivers/acpi/resources/rsio.c +++ b/drivers/acpi/resources/rsio.c | |||
@@ -81,67 +81,60 @@ acpi_rs_io_resource ( | |||
81 | struct acpi_resource *output_struct = (void *) *output_buffer; | 81 | struct acpi_resource *output_struct = (void *) *output_buffer; |
82 | u16 temp16 = 0; | 82 | u16 temp16 = 0; |
83 | u8 temp8 = 0; | 83 | u8 temp8 = 0; |
84 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_io); | 84 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
85 | struct acpi_resource_io); | ||
85 | 86 | ||
86 | 87 | ||
87 | ACPI_FUNCTION_TRACE ("rs_io_resource"); | 88 | ACPI_FUNCTION_TRACE ("rs_io_resource"); |
88 | 89 | ||
89 | 90 | ||
90 | /* | 91 | /* The number of bytes consumed are Constant */ |
91 | * The number of bytes consumed are Constant | 92 | |
92 | */ | ||
93 | *bytes_consumed = 8; | 93 | *bytes_consumed = 8; |
94 | 94 | ||
95 | output_struct->id = ACPI_RSTYPE_IO; | 95 | output_struct->id = ACPI_RSTYPE_IO; |
96 | 96 | ||
97 | /* | 97 | /* Check Decode */ |
98 | * Check Decode | 98 | |
99 | */ | ||
100 | buffer += 1; | 99 | buffer += 1; |
101 | temp8 = *buffer; | 100 | temp8 = *buffer; |
102 | 101 | ||
103 | output_struct->data.io.io_decode = temp8 & 0x01; | 102 | output_struct->data.io.io_decode = temp8 & 0x01; |
104 | 103 | ||
105 | /* | 104 | /* Check min_base Address */ |
106 | * Check min_base Address | 105 | |
107 | */ | ||
108 | buffer += 1; | 106 | buffer += 1; |
109 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 107 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
110 | 108 | ||
111 | output_struct->data.io.min_base_address = temp16; | 109 | output_struct->data.io.min_base_address = temp16; |
112 | 110 | ||
113 | /* | 111 | /* Check max_base Address */ |
114 | * Check max_base Address | 112 | |
115 | */ | ||
116 | buffer += 2; | 113 | buffer += 2; |
117 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 114 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
118 | 115 | ||
119 | output_struct->data.io.max_base_address = temp16; | 116 | output_struct->data.io.max_base_address = temp16; |
120 | 117 | ||
121 | /* | 118 | /* Check Base alignment */ |
122 | * Check Base alignment | 119 | |
123 | */ | ||
124 | buffer += 2; | 120 | buffer += 2; |
125 | temp8 = *buffer; | 121 | temp8 = *buffer; |
126 | 122 | ||
127 | output_struct->data.io.alignment = temp8; | 123 | output_struct->data.io.alignment = temp8; |
128 | 124 | ||
129 | /* | 125 | /* Check range_length */ |
130 | * Check range_length | 126 | |
131 | */ | ||
132 | buffer += 1; | 127 | buffer += 1; |
133 | temp8 = *buffer; | 128 | temp8 = *buffer; |
134 | 129 | ||
135 | output_struct->data.io.range_length = temp8; | 130 | output_struct->data.io.range_length = temp8; |
136 | 131 | ||
137 | /* | 132 | /* Set the Length parameter */ |
138 | * Set the Length parameter | 133 | |
139 | */ | ||
140 | output_struct->length = (u32) struct_size; | 134 | output_struct->length = (u32) struct_size; |
141 | 135 | ||
142 | /* | 136 | /* Return the final size of the structure */ |
143 | * Return the final size of the structure | 137 | |
144 | */ | ||
145 | *structure_size = struct_size; | 138 | *structure_size = struct_size; |
146 | return_ACPI_STATUS (AE_OK); | 139 | return_ACPI_STATUS (AE_OK); |
147 | } | 140 | } |
@@ -179,43 +172,39 @@ acpi_rs_fixed_io_resource ( | |||
179 | struct acpi_resource *output_struct = (void *) *output_buffer; | 172 | struct acpi_resource *output_struct = (void *) *output_buffer; |
180 | u16 temp16 = 0; | 173 | u16 temp16 = 0; |
181 | u8 temp8 = 0; | 174 | u8 temp8 = 0; |
182 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_fixed_io); | 175 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
176 | struct acpi_resource_fixed_io); | ||
183 | 177 | ||
184 | 178 | ||
185 | ACPI_FUNCTION_TRACE ("rs_fixed_io_resource"); | 179 | ACPI_FUNCTION_TRACE ("rs_fixed_io_resource"); |
186 | 180 | ||
187 | 181 | ||
188 | /* | 182 | /* The number of bytes consumed are Constant */ |
189 | * The number of bytes consumed are Constant | 183 | |
190 | */ | ||
191 | *bytes_consumed = 4; | 184 | *bytes_consumed = 4; |
192 | 185 | ||
193 | output_struct->id = ACPI_RSTYPE_FIXED_IO; | 186 | output_struct->id = ACPI_RSTYPE_FIXED_IO; |
194 | 187 | ||
195 | /* | 188 | /* Check Range Base Address */ |
196 | * Check Range Base Address | 189 | |
197 | */ | ||
198 | buffer += 1; | 190 | buffer += 1; |
199 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 191 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
200 | 192 | ||
201 | output_struct->data.fixed_io.base_address = temp16; | 193 | output_struct->data.fixed_io.base_address = temp16; |
202 | 194 | ||
203 | /* | 195 | /* Check range_length */ |
204 | * Check range_length | 196 | |
205 | */ | ||
206 | buffer += 2; | 197 | buffer += 2; |
207 | temp8 = *buffer; | 198 | temp8 = *buffer; |
208 | 199 | ||
209 | output_struct->data.fixed_io.range_length = temp8; | 200 | output_struct->data.fixed_io.range_length = temp8; |
210 | 201 | ||
211 | /* | 202 | /* Set the Length parameter */ |
212 | * Set the Length parameter | 203 | |
213 | */ | ||
214 | output_struct->length = (u32) struct_size; | 204 | output_struct->length = (u32) struct_size; |
215 | 205 | ||
216 | /* | 206 | /* Return the final size of the structure */ |
217 | * Return the final size of the structure | 207 | |
218 | */ | ||
219 | *structure_size = struct_size; | 208 | *structure_size = struct_size; |
220 | return_ACPI_STATUS (AE_OK); | 209 | return_ACPI_STATUS (AE_OK); |
221 | } | 210 | } |
@@ -251,55 +240,48 @@ acpi_rs_io_stream ( | |||
251 | ACPI_FUNCTION_TRACE ("rs_io_stream"); | 240 | ACPI_FUNCTION_TRACE ("rs_io_stream"); |
252 | 241 | ||
253 | 242 | ||
254 | /* | 243 | /* The descriptor field is static */ |
255 | * The descriptor field is static | 244 | |
256 | */ | ||
257 | *buffer = 0x47; | 245 | *buffer = 0x47; |
258 | buffer += 1; | 246 | buffer += 1; |
259 | 247 | ||
260 | /* | 248 | /* Io Information Byte */ |
261 | * Io Information Byte | 249 | |
262 | */ | ||
263 | temp8 = (u8) (linked_list->data.io.io_decode & 0x01); | 250 | temp8 = (u8) (linked_list->data.io.io_decode & 0x01); |
264 | 251 | ||
265 | *buffer = temp8; | 252 | *buffer = temp8; |
266 | buffer += 1; | 253 | buffer += 1; |
267 | 254 | ||
268 | /* | 255 | /* Set the Range minimum base address */ |
269 | * Set the Range minimum base address | 256 | |
270 | */ | ||
271 | temp16 = (u16) linked_list->data.io.min_base_address; | 257 | temp16 = (u16) linked_list->data.io.min_base_address; |
272 | 258 | ||
273 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 259 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
274 | buffer += 2; | 260 | buffer += 2; |
275 | 261 | ||
276 | /* | 262 | /* Set the Range maximum base address */ |
277 | * Set the Range maximum base address | 263 | |
278 | */ | ||
279 | temp16 = (u16) linked_list->data.io.max_base_address; | 264 | temp16 = (u16) linked_list->data.io.max_base_address; |
280 | 265 | ||
281 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 266 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
282 | buffer += 2; | 267 | buffer += 2; |
283 | 268 | ||
284 | /* | 269 | /* Set the base alignment */ |
285 | * Set the base alignment | 270 | |
286 | */ | ||
287 | temp8 = (u8) linked_list->data.io.alignment; | 271 | temp8 = (u8) linked_list->data.io.alignment; |
288 | 272 | ||
289 | *buffer = temp8; | 273 | *buffer = temp8; |
290 | buffer += 1; | 274 | buffer += 1; |
291 | 275 | ||
292 | /* | 276 | /* Set the range length */ |
293 | * Set the range length | 277 | |
294 | */ | ||
295 | temp8 = (u8) linked_list->data.io.range_length; | 278 | temp8 = (u8) linked_list->data.io.range_length; |
296 | 279 | ||
297 | *buffer = temp8; | 280 | *buffer = temp8; |
298 | buffer += 1; | 281 | buffer += 1; |
299 | 282 | ||
300 | /* | 283 | /* Return the number of bytes consumed in this operation */ |
301 | * Return the number of bytes consumed in this operation | 284 | |
302 | */ | ||
303 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 285 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
304 | return_ACPI_STATUS (AE_OK); | 286 | return_ACPI_STATUS (AE_OK); |
305 | } | 287 | } |
@@ -335,32 +317,28 @@ acpi_rs_fixed_io_stream ( | |||
335 | ACPI_FUNCTION_TRACE ("rs_fixed_io_stream"); | 317 | ACPI_FUNCTION_TRACE ("rs_fixed_io_stream"); |
336 | 318 | ||
337 | 319 | ||
338 | /* | 320 | /* The descriptor field is static */ |
339 | * The descriptor field is static | 321 | |
340 | */ | ||
341 | *buffer = 0x4B; | 322 | *buffer = 0x4B; |
342 | 323 | ||
343 | buffer += 1; | 324 | buffer += 1; |
344 | 325 | ||
345 | /* | 326 | /* Set the Range base address */ |
346 | * Set the Range base address | 327 | |
347 | */ | ||
348 | temp16 = (u16) linked_list->data.fixed_io.base_address; | 328 | temp16 = (u16) linked_list->data.fixed_io.base_address; |
349 | 329 | ||
350 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 330 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
351 | buffer += 2; | 331 | buffer += 2; |
352 | 332 | ||
353 | /* | 333 | /* Set the range length */ |
354 | * Set the range length | 334 | |
355 | */ | ||
356 | temp8 = (u8) linked_list->data.fixed_io.range_length; | 335 | temp8 = (u8) linked_list->data.fixed_io.range_length; |
357 | 336 | ||
358 | *buffer = temp8; | 337 | *buffer = temp8; |
359 | buffer += 1; | 338 | buffer += 1; |
360 | 339 | ||
361 | /* | 340 | /* Return the number of bytes consumed in this operation */ |
362 | * Return the number of bytes consumed in this operation | 341 | |
363 | */ | ||
364 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 342 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
365 | return_ACPI_STATUS (AE_OK); | 343 | return_ACPI_STATUS (AE_OK); |
366 | } | 344 | } |
@@ -399,21 +377,20 @@ acpi_rs_dma_resource ( | |||
399 | u8 temp8 = 0; | 377 | u8 temp8 = 0; |
400 | u8 index; | 378 | u8 index; |
401 | u8 i; | 379 | u8 i; |
402 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_dma); | 380 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
381 | struct acpi_resource_dma); | ||
403 | 382 | ||
404 | 383 | ||
405 | ACPI_FUNCTION_TRACE ("rs_dma_resource"); | 384 | ACPI_FUNCTION_TRACE ("rs_dma_resource"); |
406 | 385 | ||
407 | 386 | ||
408 | /* | 387 | /* The number of bytes consumed are Constant */ |
409 | * The number of bytes consumed are Constant | 388 | |
410 | */ | ||
411 | *bytes_consumed = 3; | 389 | *bytes_consumed = 3; |
412 | output_struct->id = ACPI_RSTYPE_DMA; | 390 | output_struct->id = ACPI_RSTYPE_DMA; |
413 | 391 | ||
414 | /* | 392 | /* Point to the 8-bits of Byte 1 */ |
415 | * Point to the 8-bits of Byte 1 | 393 | |
416 | */ | ||
417 | buffer += 1; | 394 | buffer += 1; |
418 | temp8 = *buffer; | 395 | temp8 = *buffer; |
419 | 396 | ||
@@ -430,46 +407,40 @@ acpi_rs_dma_resource ( | |||
430 | 407 | ||
431 | output_struct->data.dma.number_of_channels = i; | 408 | output_struct->data.dma.number_of_channels = i; |
432 | if (i > 0) { | 409 | if (i > 0) { |
433 | /* | 410 | /* Calculate the structure size based upon the number of interrupts */ |
434 | * Calculate the structure size based upon the number of interrupts | 411 | |
435 | */ | ||
436 | struct_size += ((acpi_size) i - 1) * 4; | 412 | struct_size += ((acpi_size) i - 1) * 4; |
437 | } | 413 | } |
438 | 414 | ||
439 | /* | 415 | /* Point to Byte 2 */ |
440 | * Point to Byte 2 | 416 | |
441 | */ | ||
442 | buffer += 1; | 417 | buffer += 1; |
443 | temp8 = *buffer; | 418 | temp8 = *buffer; |
444 | 419 | ||
445 | /* | 420 | /* Check for transfer preference (Bits[1:0]) */ |
446 | * Check for transfer preference (Bits[1:0]) | 421 | |
447 | */ | ||
448 | output_struct->data.dma.transfer = temp8 & 0x03; | 422 | output_struct->data.dma.transfer = temp8 & 0x03; |
449 | 423 | ||
450 | if (0x03 == output_struct->data.dma.transfer) { | 424 | if (0x03 == output_struct->data.dma.transfer) { |
451 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid DMA.Transfer preference (3)\n")); | 425 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
426 | "Invalid DMA.Transfer preference (3)\n")); | ||
452 | return_ACPI_STATUS (AE_BAD_DATA); | 427 | return_ACPI_STATUS (AE_BAD_DATA); |
453 | } | 428 | } |
454 | 429 | ||
455 | /* | 430 | /* Get bus master preference (Bit[2]) */ |
456 | * Get bus master preference (Bit[2]) | 431 | |
457 | */ | ||
458 | output_struct->data.dma.bus_master = (temp8 >> 2) & 0x01; | 432 | output_struct->data.dma.bus_master = (temp8 >> 2) & 0x01; |
459 | 433 | ||
460 | /* | 434 | /* Get channel speed support (Bits[6:5]) */ |
461 | * Get channel speed support (Bits[6:5]) | 435 | |
462 | */ | ||
463 | output_struct->data.dma.type = (temp8 >> 5) & 0x03; | 436 | output_struct->data.dma.type = (temp8 >> 5) & 0x03; |
464 | 437 | ||
465 | /* | 438 | /* Set the Length parameter */ |
466 | * Set the Length parameter | 439 | |
467 | */ | ||
468 | output_struct->length = (u32) struct_size; | 440 | output_struct->length = (u32) struct_size; |
469 | 441 | ||
470 | /* | 442 | /* Return the final size of the structure */ |
471 | * Return the final size of the structure | 443 | |
472 | */ | ||
473 | *structure_size = struct_size; | 444 | *structure_size = struct_size; |
474 | return_ACPI_STATUS (AE_OK); | 445 | return_ACPI_STATUS (AE_OK); |
475 | } | 446 | } |
@@ -506,16 +477,14 @@ acpi_rs_dma_stream ( | |||
506 | ACPI_FUNCTION_TRACE ("rs_dma_stream"); | 477 | ACPI_FUNCTION_TRACE ("rs_dma_stream"); |
507 | 478 | ||
508 | 479 | ||
509 | /* | 480 | /* The descriptor field is static */ |
510 | * The descriptor field is static | 481 | |
511 | */ | ||
512 | *buffer = 0x2A; | 482 | *buffer = 0x2A; |
513 | buffer += 1; | 483 | buffer += 1; |
514 | temp8 = 0; | 484 | temp8 = 0; |
515 | 485 | ||
516 | /* | 486 | /* Loop through all of the Channels and set the mask bits */ |
517 | * Loop through all of the Channels and set the mask bits | 487 | |
518 | */ | ||
519 | for (index = 0; | 488 | for (index = 0; |
520 | index < linked_list->data.dma.number_of_channels; | 489 | index < linked_list->data.dma.number_of_channels; |
521 | index++) { | 490 | index++) { |
@@ -526,9 +495,8 @@ acpi_rs_dma_stream ( | |||
526 | *buffer = temp8; | 495 | *buffer = temp8; |
527 | buffer += 1; | 496 | buffer += 1; |
528 | 497 | ||
529 | /* | 498 | /* Set the DMA Info */ |
530 | * Set the DMA Info | 499 | |
531 | */ | ||
532 | temp8 = (u8) ((linked_list->data.dma.type & 0x03) << 5); | 500 | temp8 = (u8) ((linked_list->data.dma.type & 0x03) << 5); |
533 | temp8 |= ((linked_list->data.dma.bus_master & 0x01) << 2); | 501 | temp8 |= ((linked_list->data.dma.bus_master & 0x01) << 2); |
534 | temp8 |= (linked_list->data.dma.transfer & 0x03); | 502 | temp8 |= (linked_list->data.dma.transfer & 0x03); |
@@ -536,9 +504,8 @@ acpi_rs_dma_stream ( | |||
536 | *buffer = temp8; | 504 | *buffer = temp8; |
537 | buffer += 1; | 505 | buffer += 1; |
538 | 506 | ||
539 | /* | 507 | /* Return the number of bytes consumed in this operation */ |
540 | * Return the number of bytes consumed in this operation | 508 | |
541 | */ | ||
542 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 509 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
543 | return_ACPI_STATUS (AE_OK); | 510 | return_ACPI_STATUS (AE_OK); |
544 | } | 511 | } |
diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c index fd07a8702fbe..8a2b630be45b 100644 --- a/drivers/acpi/resources/rsirq.c +++ b/drivers/acpi/resources/rsirq.c | |||
@@ -83,7 +83,8 @@ acpi_rs_irq_resource ( | |||
83 | u8 temp8 = 0; | 83 | u8 temp8 = 0; |
84 | u8 index; | 84 | u8 index; |
85 | u8 i; | 85 | u8 i; |
86 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_irq); | 86 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
87 | struct acpi_resource_irq); | ||
87 | 88 | ||
88 | 89 | ||
89 | ACPI_FUNCTION_TRACE ("rs_irq_resource"); | 90 | ACPI_FUNCTION_TRACE ("rs_irq_resource"); |
@@ -91,15 +92,14 @@ acpi_rs_irq_resource ( | |||
91 | 92 | ||
92 | /* | 93 | /* |
93 | * The number of bytes consumed are contained in the descriptor | 94 | * The number of bytes consumed are contained in the descriptor |
94 | * (Bits:0-1) | 95 | * (Bits:0-1) |
95 | */ | 96 | */ |
96 | temp8 = *buffer; | 97 | temp8 = *buffer; |
97 | *bytes_consumed = (temp8 & 0x03) + 1; | 98 | *bytes_consumed = (temp8 & 0x03) + 1; |
98 | output_struct->id = ACPI_RSTYPE_IRQ; | 99 | output_struct->id = ACPI_RSTYPE_IRQ; |
99 | 100 | ||
100 | /* | 101 | /* Point to the 16-bits of Bytes 1 and 2 */ |
101 | * Point to the 16-bits of Bytes 1 and 2 | 102 | |
102 | */ | ||
103 | buffer += 1; | 103 | buffer += 1; |
104 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 104 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
105 | 105 | ||
@@ -118,22 +118,19 @@ acpi_rs_irq_resource ( | |||
118 | 118 | ||
119 | output_struct->data.irq.number_of_interrupts = i; | 119 | output_struct->data.irq.number_of_interrupts = i; |
120 | if (i > 0) { | 120 | if (i > 0) { |
121 | /* | 121 | /* Calculate the structure size based upon the number of interrupts */ |
122 | * Calculate the structure size based upon the number of interrupts | 122 | |
123 | */ | ||
124 | struct_size += ((acpi_size) i - 1) * 4; | 123 | struct_size += ((acpi_size) i - 1) * 4; |
125 | } | 124 | } |
126 | 125 | ||
127 | /* | 126 | /* Point to Byte 3 if it is used */ |
128 | * Point to Byte 3 if it is used | 127 | |
129 | */ | ||
130 | if (4 == *bytes_consumed) { | 128 | if (4 == *bytes_consumed) { |
131 | buffer += 2; | 129 | buffer += 2; |
132 | temp8 = *buffer; | 130 | temp8 = *buffer; |
133 | 131 | ||
134 | /* | 132 | /* Check for HE, LL interrupts */ |
135 | * Check for HE, LL interrupts | 133 | |
136 | */ | ||
137 | switch (temp8 & 0x09) { | 134 | switch (temp8 & 0x09) { |
138 | case 0x01: /* HE */ | 135 | case 0x01: /* HE */ |
139 | output_struct->data.irq.edge_level = ACPI_EDGE_SENSITIVE; | 136 | output_struct->data.irq.edge_level = ACPI_EDGE_SENSITIVE; |
@@ -152,13 +149,13 @@ acpi_rs_irq_resource ( | |||
152 | * so 0x00 and 0x09 are illegal. | 149 | * so 0x00 and 0x09 are illegal. |
153 | */ | 150 | */ |
154 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 151 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
155 | "Invalid interrupt polarity/trigger in resource list, %X\n", temp8)); | 152 | "Invalid interrupt polarity/trigger in resource list, %X\n", |
153 | temp8)); | ||
156 | return_ACPI_STATUS (AE_BAD_DATA); | 154 | return_ACPI_STATUS (AE_BAD_DATA); |
157 | } | 155 | } |
158 | 156 | ||
159 | /* | 157 | /* Check for sharable */ |
160 | * Check for sharable | 158 | |
161 | */ | ||
162 | output_struct->data.irq.shared_exclusive = (temp8 >> 3) & 0x01; | 159 | output_struct->data.irq.shared_exclusive = (temp8 >> 3) & 0x01; |
163 | } | 160 | } |
164 | else { | 161 | else { |
@@ -171,14 +168,12 @@ acpi_rs_irq_resource ( | |||
171 | output_struct->data.irq.shared_exclusive = ACPI_EXCLUSIVE; | 168 | output_struct->data.irq.shared_exclusive = ACPI_EXCLUSIVE; |
172 | } | 169 | } |
173 | 170 | ||
174 | /* | 171 | /* Set the Length parameter */ |
175 | * Set the Length parameter | 172 | |
176 | */ | ||
177 | output_struct->length = (u32) struct_size; | 173 | output_struct->length = (u32) struct_size; |
178 | 174 | ||
179 | /* | 175 | /* Return the final size of the structure */ |
180 | * Return the final size of the structure | 176 | |
181 | */ | ||
182 | *structure_size = struct_size; | 177 | *structure_size = struct_size; |
183 | return_ACPI_STATUS (AE_OK); | 178 | return_ACPI_STATUS (AE_OK); |
184 | } | 179 | } |
@@ -234,9 +229,8 @@ acpi_rs_irq_stream ( | |||
234 | buffer += 1; | 229 | buffer += 1; |
235 | temp16 = 0; | 230 | temp16 = 0; |
236 | 231 | ||
237 | /* | 232 | /* Loop through all of the interrupts and set the mask bits */ |
238 | * Loop through all of the interrupts and set the mask bits | 233 | |
239 | */ | ||
240 | for(index = 0; | 234 | for(index = 0; |
241 | index < linked_list->data.irq.number_of_interrupts; | 235 | index < linked_list->data.irq.number_of_interrupts; |
242 | index++) { | 236 | index++) { |
@@ -247,9 +241,8 @@ acpi_rs_irq_stream ( | |||
247 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 241 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
248 | buffer += 2; | 242 | buffer += 2; |
249 | 243 | ||
250 | /* | 244 | /* Set the IRQ Info byte if needed. */ |
251 | * Set the IRQ Info byte if needed. | 245 | |
252 | */ | ||
253 | if (IRqinfo_byte_needed) { | 246 | if (IRqinfo_byte_needed) { |
254 | temp8 = 0; | 247 | temp8 = 0; |
255 | temp8 = (u8) ((linked_list->data.irq.shared_exclusive & | 248 | temp8 = (u8) ((linked_list->data.irq.shared_exclusive & |
@@ -267,9 +260,8 @@ acpi_rs_irq_stream ( | |||
267 | buffer += 1; | 260 | buffer += 1; |
268 | } | 261 | } |
269 | 262 | ||
270 | /* | 263 | /* Return the number of bytes consumed in this operation */ |
271 | * Return the number of bytes consumed in this operation | 264 | |
272 | */ | ||
273 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 265 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
274 | return_ACPI_STATUS (AE_OK); | 266 | return_ACPI_STATUS (AE_OK); |
275 | } | 267 | } |
@@ -309,15 +301,15 @@ acpi_rs_extended_irq_resource ( | |||
309 | u8 temp8 = 0; | 301 | u8 temp8 = 0; |
310 | u8 *temp_ptr; | 302 | u8 *temp_ptr; |
311 | u8 index; | 303 | u8 index; |
312 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_ext_irq); | 304 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
305 | struct acpi_resource_ext_irq); | ||
313 | 306 | ||
314 | 307 | ||
315 | ACPI_FUNCTION_TRACE ("rs_extended_irq_resource"); | 308 | ACPI_FUNCTION_TRACE ("rs_extended_irq_resource"); |
316 | 309 | ||
317 | 310 | ||
318 | /* | 311 | /* Point past the Descriptor to get the number of bytes consumed */ |
319 | * Point past the Descriptor to get the number of bytes consumed | 312 | |
320 | */ | ||
321 | buffer += 1; | 313 | buffer += 1; |
322 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 314 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
323 | 315 | ||
@@ -330,9 +322,8 @@ acpi_rs_extended_irq_resource ( | |||
330 | *bytes_consumed = temp16 + 3; | 322 | *bytes_consumed = temp16 + 3; |
331 | output_struct->id = ACPI_RSTYPE_EXT_IRQ; | 323 | output_struct->id = ACPI_RSTYPE_EXT_IRQ; |
332 | 324 | ||
333 | /* | 325 | /* Point to the Byte3 */ |
334 | * Point to the Byte3 | 326 | |
335 | */ | ||
336 | buffer += 2; | 327 | buffer += 2; |
337 | temp8 = *buffer; | 328 | temp8 = *buffer; |
338 | 329 | ||
@@ -347,21 +338,18 @@ acpi_rs_extended_irq_resource ( | |||
347 | * - Edge/Level are defined opposite in the table vs the headers | 338 | * - Edge/Level are defined opposite in the table vs the headers |
348 | */ | 339 | */ |
349 | output_struct->data.extended_irq.edge_level = | 340 | output_struct->data.extended_irq.edge_level = |
350 | (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE; | 341 | (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE; |
342 | |||
343 | /* Check Interrupt Polarity */ | ||
351 | 344 | ||
352 | /* | ||
353 | * Check Interrupt Polarity | ||
354 | */ | ||
355 | output_struct->data.extended_irq.active_high_low = (temp8 >> 2) & 0x1; | 345 | output_struct->data.extended_irq.active_high_low = (temp8 >> 2) & 0x1; |
356 | 346 | ||
357 | /* | 347 | /* Check for sharable */ |
358 | * Check for sharable | 348 | |
359 | */ | ||
360 | output_struct->data.extended_irq.shared_exclusive = (temp8 >> 3) & 0x01; | 349 | output_struct->data.extended_irq.shared_exclusive = (temp8 >> 3) & 0x01; |
361 | 350 | ||
362 | /* | 351 | /* Point to Byte4 (IRQ Table length) */ |
363 | * Point to Byte4 (IRQ Table length) | 352 | |
364 | */ | ||
365 | buffer += 1; | 353 | buffer += 1; |
366 | temp8 = *buffer; | 354 | temp8 = *buffer; |
367 | 355 | ||
@@ -379,14 +367,12 @@ acpi_rs_extended_irq_resource ( | |||
379 | */ | 367 | */ |
380 | struct_size += (temp8 - 1) * 4; | 368 | struct_size += (temp8 - 1) * 4; |
381 | 369 | ||
382 | /* | 370 | /* Point to Byte5 (First IRQ Number) */ |
383 | * Point to Byte5 (First IRQ Number) | 371 | |
384 | */ | ||
385 | buffer += 1; | 372 | buffer += 1; |
386 | 373 | ||
387 | /* | 374 | /* Cycle through every IRQ in the table */ |
388 | * Cycle through every IRQ in the table | 375 | |
389 | */ | ||
390 | for (index = 0; index < temp8; index++) { | 376 | for (index = 0; index < temp8; index++) { |
391 | ACPI_MOVE_32_TO_32 ( | 377 | ACPI_MOVE_32_TO_32 ( |
392 | &output_struct->data.extended_irq.interrupts[index], buffer); | 378 | &output_struct->data.extended_irq.interrupts[index], buffer); |
@@ -407,7 +393,8 @@ acpi_rs_extended_irq_resource ( | |||
407 | * we add 1 to the length. | 393 | * we add 1 to the length. |
408 | */ | 394 | */ |
409 | if (*bytes_consumed > | 395 | if (*bytes_consumed > |
410 | ((acpi_size) output_struct->data.extended_irq.number_of_interrupts * 4) + (5 + 1)) { | 396 | ((acpi_size) output_struct->data.extended_irq.number_of_interrupts * 4) + |
397 | (5 + 1)) { | ||
411 | /* Dereference the Index */ | 398 | /* Dereference the Index */ |
412 | 399 | ||
413 | temp8 = *buffer; | 400 | temp8 = *buffer; |
@@ -417,13 +404,13 @@ acpi_rs_extended_irq_resource ( | |||
417 | 404 | ||
418 | buffer += 1; | 405 | buffer += 1; |
419 | 406 | ||
420 | /* | 407 | /* Point the String pointer to the end of this structure. */ |
421 | * Point the String pointer to the end of this structure. | 408 | |
422 | */ | ||
423 | output_struct->data.extended_irq.resource_source.string_ptr = | 409 | output_struct->data.extended_irq.resource_source.string_ptr = |
424 | (char *)((char *) output_struct + struct_size); | 410 | (char *)((char *) output_struct + struct_size); |
425 | 411 | ||
426 | temp_ptr = (u8 *) output_struct->data.extended_irq.resource_source.string_ptr; | 412 | temp_ptr = (u8 *) |
413 | output_struct->data.extended_irq.resource_source.string_ptr; | ||
427 | 414 | ||
428 | /* Copy the string into the buffer */ | 415 | /* Copy the string into the buffer */ |
429 | 416 | ||
@@ -436,9 +423,8 @@ acpi_rs_extended_irq_resource ( | |||
436 | index += 1; | 423 | index += 1; |
437 | } | 424 | } |
438 | 425 | ||
439 | /* | 426 | /* Add the terminating null */ |
440 | * Add the terminating null | 427 | |
441 | */ | ||
442 | *temp_ptr = 0x00; | 428 | *temp_ptr = 0x00; |
443 | output_struct->data.extended_irq.resource_source.string_length = index + 1; | 429 | output_struct->data.extended_irq.resource_source.string_length = index + 1; |
444 | 430 | ||
@@ -456,14 +442,12 @@ acpi_rs_extended_irq_resource ( | |||
456 | output_struct->data.extended_irq.resource_source.string_ptr = NULL; | 442 | output_struct->data.extended_irq.resource_source.string_ptr = NULL; |
457 | } | 443 | } |
458 | 444 | ||
459 | /* | 445 | /* Set the Length parameter */ |
460 | * Set the Length parameter | 446 | |
461 | */ | ||
462 | output_struct->length = (u32) struct_size; | 447 | output_struct->length = (u32) struct_size; |
463 | 448 | ||
464 | /* | 449 | /* Return the final size of the structure */ |
465 | * Return the final size of the structure | 450 | |
466 | */ | ||
467 | *structure_size = struct_size; | 451 | *structure_size = struct_size; |
468 | return_ACPI_STATUS (AE_OK); | 452 | return_ACPI_STATUS (AE_OK); |
469 | } | 453 | } |
@@ -501,21 +485,18 @@ acpi_rs_extended_irq_stream ( | |||
501 | ACPI_FUNCTION_TRACE ("rs_extended_irq_stream"); | 485 | ACPI_FUNCTION_TRACE ("rs_extended_irq_stream"); |
502 | 486 | ||
503 | 487 | ||
504 | /* | 488 | /* The descriptor field is static */ |
505 | * The descriptor field is static | 489 | |
506 | */ | ||
507 | *buffer = 0x89; | 490 | *buffer = 0x89; |
508 | buffer += 1; | 491 | buffer += 1; |
509 | 492 | ||
510 | /* | 493 | /* Set a pointer to the Length field - to be filled in later */ |
511 | * Set a pointer to the Length field - to be filled in later | 494 | |
512 | */ | ||
513 | length_field = ACPI_CAST_PTR (u16, buffer); | 495 | length_field = ACPI_CAST_PTR (u16, buffer); |
514 | buffer += 2; | 496 | buffer += 2; |
515 | 497 | ||
516 | /* | 498 | /* Set the Interrupt vector flags */ |
517 | * Set the Interrupt vector flags | 499 | |
518 | */ | ||
519 | temp8 = (u8)(linked_list->data.extended_irq.producer_consumer & 0x01); | 500 | temp8 = (u8)(linked_list->data.extended_irq.producer_consumer & 0x01); |
520 | temp8 |= ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3); | 501 | temp8 |= ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3); |
521 | 502 | ||
@@ -532,17 +513,15 @@ acpi_rs_extended_irq_stream ( | |||
532 | temp8 |= 0x2; | 513 | temp8 |= 0x2; |
533 | } | 514 | } |
534 | 515 | ||
535 | /* | 516 | /* Set the Interrupt Polarity */ |
536 | * Set the Interrupt Polarity | 517 | |
537 | */ | ||
538 | temp8 |= ((linked_list->data.extended_irq.active_high_low & 0x1) << 2); | 518 | temp8 |= ((linked_list->data.extended_irq.active_high_low & 0x1) << 2); |
539 | 519 | ||
540 | *buffer = temp8; | 520 | *buffer = temp8; |
541 | buffer += 1; | 521 | buffer += 1; |
542 | 522 | ||
543 | /* | 523 | /* Set the Interrupt table length */ |
544 | * Set the Interrupt table length | 524 | |
545 | */ | ||
546 | temp8 = (u8) linked_list->data.extended_irq.number_of_interrupts; | 525 | temp8 = (u8) linked_list->data.extended_irq.number_of_interrupts; |
547 | 526 | ||
548 | *buffer = temp8; | 527 | *buffer = temp8; |
@@ -555,18 +534,16 @@ acpi_rs_extended_irq_stream ( | |||
555 | buffer += 4; | 534 | buffer += 4; |
556 | } | 535 | } |
557 | 536 | ||
558 | /* | 537 | /* Resource Source Index and Resource Source are optional */ |
559 | * Resource Source Index and Resource Source are optional | 538 | |
560 | */ | ||
561 | if (0 != linked_list->data.extended_irq.resource_source.string_length) { | 539 | if (0 != linked_list->data.extended_irq.resource_source.string_length) { |
562 | *buffer = (u8) linked_list->data.extended_irq.resource_source.index; | 540 | *buffer = (u8) linked_list->data.extended_irq.resource_source.index; |
563 | buffer += 1; | 541 | buffer += 1; |
564 | 542 | ||
565 | temp_pointer = (char *) buffer; | 543 | temp_pointer = (char *) buffer; |
566 | 544 | ||
567 | /* | 545 | /* Copy the string */ |
568 | * Copy the string | 546 | |
569 | */ | ||
570 | ACPI_STRCPY (temp_pointer, | 547 | ACPI_STRCPY (temp_pointer, |
571 | linked_list->data.extended_irq.resource_source.string_ptr); | 548 | linked_list->data.extended_irq.resource_source.string_ptr); |
572 | 549 | ||
@@ -574,12 +551,12 @@ acpi_rs_extended_irq_stream ( | |||
574 | * Buffer needs to be set to the length of the sting + one for the | 551 | * Buffer needs to be set to the length of the sting + one for the |
575 | * terminating null | 552 | * terminating null |
576 | */ | 553 | */ |
577 | buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.extended_irq.resource_source.string_ptr) + 1); | 554 | buffer += (acpi_size) (ACPI_STRLEN ( |
555 | linked_list->data.extended_irq.resource_source.string_ptr) + 1); | ||
578 | } | 556 | } |
579 | 557 | ||
580 | /* | 558 | /* Return the number of bytes consumed in this operation */ |
581 | * Return the number of bytes consumed in this operation | 559 | |
582 | */ | ||
583 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 560 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
584 | 561 | ||
585 | /* | 562 | /* |
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index e49c1e030f99..db7bcb4e60e3 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c | |||
@@ -55,7 +55,7 @@ | |||
55 | * | 55 | * |
56 | * PARAMETERS: resource_start_byte - Byte 0 of a resource descriptor | 56 | * PARAMETERS: resource_start_byte - Byte 0 of a resource descriptor |
57 | * | 57 | * |
58 | * RETURN: The Resource Type (Name) with no extraneous bits | 58 | * RETURN: The Resource Type with no extraneous bits |
59 | * | 59 | * |
60 | * DESCRIPTION: Extract the Resource Type/Name from the first byte of | 60 | * DESCRIPTION: Extract the Resource Type/Name from the first byte of |
61 | * a resource descriptor. | 61 | * a resource descriptor. |
@@ -70,28 +70,25 @@ acpi_rs_get_resource_type ( | |||
70 | ACPI_FUNCTION_ENTRY (); | 70 | ACPI_FUNCTION_ENTRY (); |
71 | 71 | ||
72 | 72 | ||
73 | /* | 73 | /* Determine if this is a small or large resource */ |
74 | * Determine if this is a small or large resource | 74 | |
75 | */ | ||
76 | switch (resource_start_byte & ACPI_RDESC_TYPE_MASK) { | 75 | switch (resource_start_byte & ACPI_RDESC_TYPE_MASK) { |
77 | case ACPI_RDESC_TYPE_SMALL: | 76 | case ACPI_RDESC_TYPE_SMALL: |
78 | 77 | ||
79 | /* | 78 | /* Small Resource Type -- Only bits 6:3 are valid */ |
80 | * Small Resource Type -- Only bits 6:3 are valid | 79 | |
81 | */ | ||
82 | return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK)); | 80 | return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK)); |
83 | 81 | ||
84 | 82 | ||
85 | case ACPI_RDESC_TYPE_LARGE: | 83 | case ACPI_RDESC_TYPE_LARGE: |
86 | 84 | ||
87 | /* | 85 | /* Large Resource Type -- All bits are valid */ |
88 | * Large Resource Type -- All bits are valid | 86 | |
89 | */ | ||
90 | return (resource_start_byte); | 87 | return (resource_start_byte); |
91 | 88 | ||
92 | 89 | ||
93 | default: | 90 | default: |
94 | /* No other types of resource descriptor */ | 91 | /* Invalid type */ |
95 | break; | 92 | break; |
96 | } | 93 | } |
97 | 94 | ||
@@ -135,9 +132,8 @@ acpi_rs_byte_stream_to_list ( | |||
135 | 132 | ||
136 | while (bytes_parsed < byte_stream_buffer_length && | 133 | while (bytes_parsed < byte_stream_buffer_length && |
137 | !end_tag_processed) { | 134 | !end_tag_processed) { |
138 | /* | 135 | /* The next byte in the stream is the resource type */ |
139 | * The next byte in the stream is the resource type | 136 | |
140 | */ | ||
141 | resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); | 137 | resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); |
142 | 138 | ||
143 | switch (resource_type) { | 139 | switch (resource_type) { |
@@ -299,28 +295,23 @@ acpi_rs_byte_stream_to_list ( | |||
299 | return_ACPI_STATUS (status); | 295 | return_ACPI_STATUS (status); |
300 | } | 296 | } |
301 | 297 | ||
302 | /* | 298 | /* Update the return value and counter */ |
303 | * Update the return value and counter | 299 | |
304 | */ | ||
305 | bytes_parsed += bytes_consumed; | 300 | bytes_parsed += bytes_consumed; |
306 | 301 | ||
307 | /* | 302 | /* Set the byte stream to point to the next resource */ |
308 | * Set the byte stream to point to the next resource | 303 | |
309 | */ | ||
310 | byte_stream_buffer += bytes_consumed; | 304 | byte_stream_buffer += bytes_consumed; |
311 | 305 | ||
312 | /* | 306 | /* Set the Buffer to the next structure */ |
313 | * Set the Buffer to the next structure | 307 | |
314 | */ | ||
315 | resource = ACPI_CAST_PTR (struct acpi_resource, buffer); | 308 | resource = ACPI_CAST_PTR (struct acpi_resource, buffer); |
316 | resource->length = (u32) ACPI_ALIGN_RESOURCE_SIZE (resource->length); | 309 | resource->length = (u32) ACPI_ALIGN_RESOURCE_SIZE (resource->length); |
317 | buffer += ACPI_ALIGN_RESOURCE_SIZE (structure_size); | 310 | buffer += ACPI_ALIGN_RESOURCE_SIZE (structure_size); |
311 | } | ||
318 | 312 | ||
319 | } /* end while */ | 313 | /* Check the reason for exiting the while loop */ |
320 | 314 | ||
321 | /* | ||
322 | * Check the reason for exiting the while loop | ||
323 | */ | ||
324 | if (!end_tag_processed) { | 315 | if (!end_tag_processed) { |
325 | return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); | 316 | return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); |
326 | } | 317 | } |
@@ -424,9 +415,8 @@ acpi_rs_list_to_byte_stream ( | |||
424 | */ | 415 | */ |
425 | status = acpi_rs_end_tag_stream (linked_list, &buffer, &bytes_consumed); | 416 | status = acpi_rs_end_tag_stream (linked_list, &buffer, &bytes_consumed); |
426 | 417 | ||
427 | /* | 418 | /* An End Tag indicates the end of the Resource Template */ |
428 | * An End Tag indicates the end of the Resource Template | 419 | |
429 | */ | ||
430 | done = TRUE; | 420 | done = TRUE; |
431 | break; | 421 | break; |
432 | 422 | ||
@@ -488,27 +478,25 @@ acpi_rs_list_to_byte_stream ( | |||
488 | default: | 478 | default: |
489 | /* | 479 | /* |
490 | * If we get here, everything is out of sync, | 480 | * If we get here, everything is out of sync, |
491 | * so exit with an error | 481 | * so exit with an error |
492 | */ | 482 | */ |
493 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid descriptor type (%X) in resource list\n", | 483 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
484 | "Invalid descriptor type (%X) in resource list\n", | ||
494 | linked_list->id)); | 485 | linked_list->id)); |
495 | status = AE_BAD_DATA; | 486 | status = AE_BAD_DATA; |
496 | break; | 487 | break; |
497 | 488 | } | |
498 | } /* switch (linked_list->Id) */ | ||
499 | 489 | ||
500 | if (ACPI_FAILURE (status)) { | 490 | if (ACPI_FAILURE (status)) { |
501 | return_ACPI_STATUS (status); | 491 | return_ACPI_STATUS (status); |
502 | } | 492 | } |
503 | 493 | ||
504 | /* | 494 | /* Set the Buffer to point to the open byte */ |
505 | * Set the Buffer to point to the open byte | 495 | |
506 | */ | ||
507 | buffer += bytes_consumed; | 496 | buffer += bytes_consumed; |
508 | 497 | ||
509 | /* | 498 | /* Point to the next object */ |
510 | * Point to the next object | 499 | |
511 | */ | ||
512 | linked_list = ACPI_PTR_ADD (struct acpi_resource, | 500 | linked_list = ACPI_PTR_ADD (struct acpi_resource, |
513 | linked_list, linked_list->length); | 501 | linked_list, linked_list->length); |
514 | } | 502 | } |
diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c index 7c935aecf075..91d0207f01ac 100644 --- a/drivers/acpi/resources/rsmemory.c +++ b/drivers/acpi/resources/rsmemory.c | |||
@@ -81,15 +81,15 @@ acpi_rs_memory24_resource ( | |||
81 | struct acpi_resource *output_struct = (void *) *output_buffer; | 81 | struct acpi_resource *output_struct = (void *) *output_buffer; |
82 | u16 temp16 = 0; | 82 | u16 temp16 = 0; |
83 | u8 temp8 = 0; | 83 | u8 temp8 = 0; |
84 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_mem24); | 84 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
85 | struct acpi_resource_mem24); | ||
85 | 86 | ||
86 | 87 | ||
87 | ACPI_FUNCTION_TRACE ("rs_memory24_resource"); | 88 | ACPI_FUNCTION_TRACE ("rs_memory24_resource"); |
88 | 89 | ||
89 | 90 | ||
90 | /* | 91 | /* Point past the Descriptor to get the number of bytes consumed */ |
91 | * Point past the Descriptor to get the number of bytes consumed | 92 | |
92 | */ | ||
93 | buffer += 1; | 93 | buffer += 1; |
94 | 94 | ||
95 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 95 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
@@ -97,48 +97,41 @@ acpi_rs_memory24_resource ( | |||
97 | *bytes_consumed = (acpi_size) temp16 + 3; | 97 | *bytes_consumed = (acpi_size) temp16 + 3; |
98 | output_struct->id = ACPI_RSTYPE_MEM24; | 98 | output_struct->id = ACPI_RSTYPE_MEM24; |
99 | 99 | ||
100 | /* | 100 | /* Check Byte 3 the Read/Write bit */ |
101 | * Check Byte 3 the Read/Write bit | 101 | |
102 | */ | ||
103 | temp8 = *buffer; | 102 | temp8 = *buffer; |
104 | buffer += 1; | 103 | buffer += 1; |
105 | output_struct->data.memory24.read_write_attribute = temp8 & 0x01; | 104 | output_struct->data.memory24.read_write_attribute = temp8 & 0x01; |
106 | 105 | ||
107 | /* | 106 | /* Get min_base_address (Bytes 4-5) */ |
108 | * Get min_base_address (Bytes 4-5) | 107 | |
109 | */ | ||
110 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 108 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
111 | buffer += 2; | 109 | buffer += 2; |
112 | output_struct->data.memory24.min_base_address = temp16; | 110 | output_struct->data.memory24.min_base_address = temp16; |
113 | 111 | ||
114 | /* | 112 | /* Get max_base_address (Bytes 6-7) */ |
115 | * Get max_base_address (Bytes 6-7) | 113 | |
116 | */ | ||
117 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 114 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
118 | buffer += 2; | 115 | buffer += 2; |
119 | output_struct->data.memory24.max_base_address = temp16; | 116 | output_struct->data.memory24.max_base_address = temp16; |
120 | 117 | ||
121 | /* | 118 | /* Get Alignment (Bytes 8-9) */ |
122 | * Get Alignment (Bytes 8-9) | 119 | |
123 | */ | ||
124 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 120 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
125 | buffer += 2; | 121 | buffer += 2; |
126 | output_struct->data.memory24.alignment = temp16; | 122 | output_struct->data.memory24.alignment = temp16; |
127 | 123 | ||
128 | /* | 124 | /* Get range_length (Bytes 10-11) */ |
129 | * Get range_length (Bytes 10-11) | 125 | |
130 | */ | ||
131 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 126 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
132 | output_struct->data.memory24.range_length = temp16; | 127 | output_struct->data.memory24.range_length = temp16; |
133 | 128 | ||
134 | /* | 129 | /* Set the Length parameter */ |
135 | * Set the Length parameter | 130 | |
136 | */ | ||
137 | output_struct->length = (u32) struct_size; | 131 | output_struct->length = (u32) struct_size; |
138 | 132 | ||
139 | /* | 133 | /* Return the final size of the structure */ |
140 | * Return the final size of the structure | 134 | |
141 | */ | ||
142 | *structure_size = struct_size; | 135 | *structure_size = struct_size; |
143 | return_ACPI_STATUS (AE_OK); | 136 | return_ACPI_STATUS (AE_OK); |
144 | } | 137 | } |
@@ -174,53 +167,45 @@ acpi_rs_memory24_stream ( | |||
174 | ACPI_FUNCTION_TRACE ("rs_memory24_stream"); | 167 | ACPI_FUNCTION_TRACE ("rs_memory24_stream"); |
175 | 168 | ||
176 | 169 | ||
177 | /* | 170 | /* The descriptor field is static */ |
178 | * The descriptor field is static | 171 | |
179 | */ | ||
180 | *buffer = 0x81; | 172 | *buffer = 0x81; |
181 | buffer += 1; | 173 | buffer += 1; |
182 | 174 | ||
183 | /* | 175 | /* The length field is static */ |
184 | * The length field is static | 176 | |
185 | */ | ||
186 | temp16 = 0x09; | 177 | temp16 = 0x09; |
187 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 178 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
188 | buffer += 2; | 179 | buffer += 2; |
189 | 180 | ||
190 | /* | 181 | /* Set the Information Byte */ |
191 | * Set the Information Byte | 182 | |
192 | */ | ||
193 | temp8 = (u8) (linked_list->data.memory24.read_write_attribute & 0x01); | 183 | temp8 = (u8) (linked_list->data.memory24.read_write_attribute & 0x01); |
194 | *buffer = temp8; | 184 | *buffer = temp8; |
195 | buffer += 1; | 185 | buffer += 1; |
196 | 186 | ||
197 | /* | 187 | /* Set the Range minimum base address */ |
198 | * Set the Range minimum base address | 188 | |
199 | */ | ||
200 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.min_base_address); | 189 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.min_base_address); |
201 | buffer += 2; | 190 | buffer += 2; |
202 | 191 | ||
203 | /* | 192 | /* Set the Range maximum base address */ |
204 | * Set the Range maximum base address | 193 | |
205 | */ | ||
206 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.max_base_address); | 194 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.max_base_address); |
207 | buffer += 2; | 195 | buffer += 2; |
208 | 196 | ||
209 | /* | 197 | /* Set the base alignment */ |
210 | * Set the base alignment | 198 | |
211 | */ | ||
212 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.alignment); | 199 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.alignment); |
213 | buffer += 2; | 200 | buffer += 2; |
214 | 201 | ||
215 | /* | 202 | /* Set the range length */ |
216 | * Set the range length | 203 | |
217 | */ | ||
218 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.range_length); | 204 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.range_length); |
219 | buffer += 2; | 205 | buffer += 2; |
220 | 206 | ||
221 | /* | 207 | /* Return the number of bytes consumed in this operation */ |
222 | * Return the number of bytes consumed in this operation | 208 | |
223 | */ | ||
224 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 209 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
225 | return_ACPI_STATUS (AE_OK); | 210 | return_ACPI_STATUS (AE_OK); |
226 | } | 211 | } |
@@ -258,15 +243,15 @@ acpi_rs_memory32_range_resource ( | |||
258 | struct acpi_resource *output_struct = (void *) *output_buffer; | 243 | struct acpi_resource *output_struct = (void *) *output_buffer; |
259 | u16 temp16 = 0; | 244 | u16 temp16 = 0; |
260 | u8 temp8 = 0; | 245 | u8 temp8 = 0; |
261 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_mem32); | 246 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
247 | struct acpi_resource_mem32); | ||
262 | 248 | ||
263 | 249 | ||
264 | ACPI_FUNCTION_TRACE ("rs_memory32_range_resource"); | 250 | ACPI_FUNCTION_TRACE ("rs_memory32_range_resource"); |
265 | 251 | ||
266 | 252 | ||
267 | /* | 253 | /* Point past the Descriptor to get the number of bytes consumed */ |
268 | * Point past the Descriptor to get the number of bytes consumed | 254 | |
269 | */ | ||
270 | buffer += 1; | 255 | buffer += 1; |
271 | 256 | ||
272 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 257 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
@@ -285,45 +270,38 @@ acpi_rs_memory32_range_resource ( | |||
285 | * 4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(u8) | 270 | * 4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(u8) |
286 | */ | 271 | */ |
287 | 272 | ||
288 | /* | 273 | /* Check Byte 3 the Read/Write bit */ |
289 | * Check Byte 3 the Read/Write bit | 274 | |
290 | */ | ||
291 | temp8 = *buffer; | 275 | temp8 = *buffer; |
292 | buffer += 1; | 276 | buffer += 1; |
293 | 277 | ||
294 | output_struct->data.memory32.read_write_attribute = temp8 & 0x01; | 278 | output_struct->data.memory32.read_write_attribute = temp8 & 0x01; |
295 | 279 | ||
296 | /* | 280 | /* Get min_base_address (Bytes 4-7) */ |
297 | * Get min_base_address (Bytes 4-7) | 281 | |
298 | */ | ||
299 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.min_base_address, buffer); | 282 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.min_base_address, buffer); |
300 | buffer += 4; | 283 | buffer += 4; |
301 | 284 | ||
302 | /* | 285 | /* Get max_base_address (Bytes 8-11) */ |
303 | * Get max_base_address (Bytes 8-11) | 286 | |
304 | */ | ||
305 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.max_base_address, buffer); | 287 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.max_base_address, buffer); |
306 | buffer += 4; | 288 | buffer += 4; |
307 | 289 | ||
308 | /* | 290 | /* Get Alignment (Bytes 12-15) */ |
309 | * Get Alignment (Bytes 12-15) | 291 | |
310 | */ | ||
311 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.alignment, buffer); | 292 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.alignment, buffer); |
312 | buffer += 4; | 293 | buffer += 4; |
313 | 294 | ||
314 | /* | 295 | /* Get range_length (Bytes 16-19) */ |
315 | * Get range_length (Bytes 16-19) | 296 | |
316 | */ | ||
317 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.range_length, buffer); | 297 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.range_length, buffer); |
318 | 298 | ||
319 | /* | 299 | /* Set the Length parameter */ |
320 | * Set the Length parameter | 300 | |
321 | */ | ||
322 | output_struct->length = (u32) struct_size; | 301 | output_struct->length = (u32) struct_size; |
323 | 302 | ||
324 | /* | 303 | /* Return the final size of the structure */ |
325 | * Return the final size of the structure | 304 | |
326 | */ | ||
327 | *structure_size = struct_size; | 305 | *structure_size = struct_size; |
328 | return_ACPI_STATUS (AE_OK); | 306 | return_ACPI_STATUS (AE_OK); |
329 | } | 307 | } |
@@ -361,15 +339,15 @@ acpi_rs_fixed_memory32_resource ( | |||
361 | struct acpi_resource *output_struct = (void *) *output_buffer; | 339 | struct acpi_resource *output_struct = (void *) *output_buffer; |
362 | u16 temp16 = 0; | 340 | u16 temp16 = 0; |
363 | u8 temp8 = 0; | 341 | u8 temp8 = 0; |
364 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_fixed_mem32); | 342 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
343 | struct acpi_resource_fixed_mem32); | ||
365 | 344 | ||
366 | 345 | ||
367 | ACPI_FUNCTION_TRACE ("rs_fixed_memory32_resource"); | 346 | ACPI_FUNCTION_TRACE ("rs_fixed_memory32_resource"); |
368 | 347 | ||
369 | 348 | ||
370 | /* | 349 | /* Point past the Descriptor to get the number of bytes consumed */ |
371 | * Point past the Descriptor to get the number of bytes consumed | 350 | |
372 | */ | ||
373 | buffer += 1; | 351 | buffer += 1; |
374 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 352 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
375 | 353 | ||
@@ -378,32 +356,28 @@ acpi_rs_fixed_memory32_resource ( | |||
378 | 356 | ||
379 | output_struct->id = ACPI_RSTYPE_FIXED_MEM32; | 357 | output_struct->id = ACPI_RSTYPE_FIXED_MEM32; |
380 | 358 | ||
381 | /* | 359 | /* Check Byte 3 the Read/Write bit */ |
382 | * Check Byte 3 the Read/Write bit | 360 | |
383 | */ | ||
384 | temp8 = *buffer; | 361 | temp8 = *buffer; |
385 | buffer += 1; | 362 | buffer += 1; |
386 | output_struct->data.fixed_memory32.read_write_attribute = temp8 & 0x01; | 363 | output_struct->data.fixed_memory32.read_write_attribute = temp8 & 0x01; |
387 | 364 | ||
388 | /* | 365 | /* Get range_base_address (Bytes 4-7) */ |
389 | * Get range_base_address (Bytes 4-7) | 366 | |
390 | */ | 367 | ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_base_address, |
391 | ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_base_address, buffer); | 368 | buffer); |
392 | buffer += 4; | 369 | buffer += 4; |
393 | 370 | ||
394 | /* | 371 | /* Get range_length (Bytes 8-11) */ |
395 | * Get range_length (Bytes 8-11) | 372 | |
396 | */ | ||
397 | ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_length, buffer); | 373 | ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_length, buffer); |
398 | 374 | ||
399 | /* | 375 | /* Set the Length parameter */ |
400 | * Set the Length parameter | 376 | |
401 | */ | ||
402 | output_struct->length = (u32) struct_size; | 377 | output_struct->length = (u32) struct_size; |
403 | 378 | ||
404 | /* | 379 | /* Return the final size of the structure */ |
405 | * Return the final size of the structure | 380 | |
406 | */ | ||
407 | *structure_size = struct_size; | 381 | *structure_size = struct_size; |
408 | return_ACPI_STATUS (AE_OK); | 382 | return_ACPI_STATUS (AE_OK); |
409 | } | 383 | } |
@@ -439,54 +413,46 @@ acpi_rs_memory32_range_stream ( | |||
439 | ACPI_FUNCTION_TRACE ("rs_memory32_range_stream"); | 413 | ACPI_FUNCTION_TRACE ("rs_memory32_range_stream"); |
440 | 414 | ||
441 | 415 | ||
442 | /* | 416 | /* The descriptor field is static */ |
443 | * The descriptor field is static | 417 | |
444 | */ | ||
445 | *buffer = 0x85; | 418 | *buffer = 0x85; |
446 | buffer += 1; | 419 | buffer += 1; |
447 | 420 | ||
448 | /* | 421 | /* The length field is static */ |
449 | * The length field is static | 422 | |
450 | */ | ||
451 | temp16 = 0x11; | 423 | temp16 = 0x11; |
452 | 424 | ||
453 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 425 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
454 | buffer += 2; | 426 | buffer += 2; |
455 | 427 | ||
456 | /* | 428 | /* Set the Information Byte */ |
457 | * Set the Information Byte | 429 | |
458 | */ | ||
459 | temp8 = (u8) (linked_list->data.memory32.read_write_attribute & 0x01); | 430 | temp8 = (u8) (linked_list->data.memory32.read_write_attribute & 0x01); |
460 | *buffer = temp8; | 431 | *buffer = temp8; |
461 | buffer += 1; | 432 | buffer += 1; |
462 | 433 | ||
463 | /* | 434 | /* Set the Range minimum base address */ |
464 | * Set the Range minimum base address | 435 | |
465 | */ | ||
466 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.min_base_address); | 436 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.min_base_address); |
467 | buffer += 4; | 437 | buffer += 4; |
468 | 438 | ||
469 | /* | 439 | /* Set the Range maximum base address */ |
470 | * Set the Range maximum base address | 440 | |
471 | */ | ||
472 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.max_base_address); | 441 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.max_base_address); |
473 | buffer += 4; | 442 | buffer += 4; |
474 | 443 | ||
475 | /* | 444 | /* Set the base alignment */ |
476 | * Set the base alignment | 445 | |
477 | */ | ||
478 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.alignment); | 446 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.alignment); |
479 | buffer += 4; | 447 | buffer += 4; |
480 | 448 | ||
481 | /* | 449 | /* Set the range length */ |
482 | * Set the range length | 450 | |
483 | */ | ||
484 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.range_length); | 451 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.range_length); |
485 | buffer += 4; | 452 | buffer += 4; |
486 | 453 | ||
487 | /* | 454 | /* Return the number of bytes consumed in this operation */ |
488 | * Return the number of bytes consumed in this operation | 455 | |
489 | */ | ||
490 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 456 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
491 | return_ACPI_STATUS (AE_OK); | 457 | return_ACPI_STATUS (AE_OK); |
492 | } | 458 | } |
@@ -522,44 +488,38 @@ acpi_rs_fixed_memory32_stream ( | |||
522 | ACPI_FUNCTION_TRACE ("rs_fixed_memory32_stream"); | 488 | ACPI_FUNCTION_TRACE ("rs_fixed_memory32_stream"); |
523 | 489 | ||
524 | 490 | ||
525 | /* | 491 | /* The descriptor field is static */ |
526 | * The descriptor field is static | 492 | |
527 | */ | ||
528 | *buffer = 0x86; | 493 | *buffer = 0x86; |
529 | buffer += 1; | 494 | buffer += 1; |
530 | 495 | ||
531 | /* | 496 | /* The length field is static */ |
532 | * The length field is static | 497 | |
533 | */ | ||
534 | temp16 = 0x09; | 498 | temp16 = 0x09; |
535 | 499 | ||
536 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 500 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
537 | buffer += 2; | 501 | buffer += 2; |
538 | 502 | ||
539 | /* | 503 | /* Set the Information Byte */ |
540 | * Set the Information Byte | 504 | |
541 | */ | ||
542 | temp8 = (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01); | 505 | temp8 = (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01); |
543 | *buffer = temp8; | 506 | *buffer = temp8; |
544 | buffer += 1; | 507 | buffer += 1; |
545 | 508 | ||
546 | /* | 509 | /* Set the Range base address */ |
547 | * Set the Range base address | 510 | |
548 | */ | ||
549 | ACPI_MOVE_32_TO_32 (buffer, | 511 | ACPI_MOVE_32_TO_32 (buffer, |
550 | &linked_list->data.fixed_memory32.range_base_address); | 512 | &linked_list->data.fixed_memory32.range_base_address); |
551 | buffer += 4; | 513 | buffer += 4; |
552 | 514 | ||
553 | /* | 515 | /* Set the range length */ |
554 | * Set the range length | 516 | |
555 | */ | ||
556 | ACPI_MOVE_32_TO_32 (buffer, | 517 | ACPI_MOVE_32_TO_32 (buffer, |
557 | &linked_list->data.fixed_memory32.range_length); | 518 | &linked_list->data.fixed_memory32.range_length); |
558 | buffer += 4; | 519 | buffer += 4; |
559 | 520 | ||
560 | /* | 521 | /* Return the number of bytes consumed in this operation */ |
561 | * Return the number of bytes consumed in this operation | 522 | |
562 | */ | ||
563 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 523 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
564 | return_ACPI_STATUS (AE_OK); | 524 | return_ACPI_STATUS (AE_OK); |
565 | } | 525 | } |
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index d16be44b5df7..a1f1741f0d83 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c | |||
@@ -84,24 +84,20 @@ acpi_rs_end_tag_resource ( | |||
84 | ACPI_FUNCTION_TRACE ("rs_end_tag_resource"); | 84 | ACPI_FUNCTION_TRACE ("rs_end_tag_resource"); |
85 | 85 | ||
86 | 86 | ||
87 | /* | 87 | /* The number of bytes consumed is static */ |
88 | * The number of bytes consumed is static | 88 | |
89 | */ | ||
90 | *bytes_consumed = 2; | 89 | *bytes_consumed = 2; |
91 | 90 | ||
92 | /* | 91 | /* Fill out the structure */ |
93 | * Fill out the structure | 92 | |
94 | */ | ||
95 | output_struct->id = ACPI_RSTYPE_END_TAG; | 93 | output_struct->id = ACPI_RSTYPE_END_TAG; |
96 | 94 | ||
97 | /* | 95 | /* Set the Length parameter */ |
98 | * Set the Length parameter | 96 | |
99 | */ | ||
100 | output_struct->length = 0; | 97 | output_struct->length = 0; |
101 | 98 | ||
102 | /* | 99 | /* Return the final size of the structure */ |
103 | * Return the final size of the structure | 100 | |
104 | */ | ||
105 | *structure_size = struct_size; | 101 | *structure_size = struct_size; |
106 | return_ACPI_STATUS (AE_OK); | 102 | return_ACPI_STATUS (AE_OK); |
107 | } | 103 | } |
@@ -136,9 +132,8 @@ acpi_rs_end_tag_stream ( | |||
136 | ACPI_FUNCTION_TRACE ("rs_end_tag_stream"); | 132 | ACPI_FUNCTION_TRACE ("rs_end_tag_stream"); |
137 | 133 | ||
138 | 134 | ||
139 | /* | 135 | /* The descriptor field is static */ |
140 | * The descriptor field is static | 136 | |
141 | */ | ||
142 | *buffer = 0x79; | 137 | *buffer = 0x79; |
143 | buffer += 1; | 138 | buffer += 1; |
144 | 139 | ||
@@ -151,9 +146,8 @@ acpi_rs_end_tag_stream ( | |||
151 | *buffer = temp8; | 146 | *buffer = temp8; |
152 | buffer += 1; | 147 | buffer += 1; |
153 | 148 | ||
154 | /* | 149 | /* Return the number of bytes consumed in this operation */ |
155 | * Return the number of bytes consumed in this operation | 150 | |
156 | */ | ||
157 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 151 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
158 | return_ACPI_STATUS (AE_OK); | 152 | return_ACPI_STATUS (AE_OK); |
159 | } | 153 | } |
@@ -192,21 +186,20 @@ acpi_rs_vendor_resource ( | |||
192 | u16 temp16 = 0; | 186 | u16 temp16 = 0; |
193 | u8 temp8 = 0; | 187 | u8 temp8 = 0; |
194 | u8 index; | 188 | u8 index; |
195 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor); | 189 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
190 | struct acpi_resource_vendor); | ||
196 | 191 | ||
197 | 192 | ||
198 | ACPI_FUNCTION_TRACE ("rs_vendor_resource"); | 193 | ACPI_FUNCTION_TRACE ("rs_vendor_resource"); |
199 | 194 | ||
200 | 195 | ||
201 | /* | 196 | /* Dereference the Descriptor to find if this is a large or small item. */ |
202 | * Dereference the Descriptor to find if this is a large or small item. | 197 | |
203 | */ | ||
204 | temp8 = *buffer; | 198 | temp8 = *buffer; |
205 | 199 | ||
206 | if (temp8 & 0x80) { | 200 | if (temp8 & 0x80) { |
207 | /* | 201 | /* Large Item, point to the length field */ |
208 | * Large Item, point to the length field | 202 | |
209 | */ | ||
210 | buffer += 1; | 203 | buffer += 1; |
211 | 204 | ||
212 | /* Dereference */ | 205 | /* Dereference */ |
@@ -222,9 +215,8 @@ acpi_rs_vendor_resource ( | |||
222 | buffer += 2; | 215 | buffer += 2; |
223 | } | 216 | } |
224 | else { | 217 | else { |
225 | /* | 218 | /* Small Item, dereference the size */ |
226 | * Small Item, dereference the size | 219 | |
227 | */ | ||
228 | temp16 = (u8)(*buffer & 0x07); | 220 | temp16 = (u8)(*buffer & 0x07); |
229 | 221 | ||
230 | /* Calculate bytes consumed */ | 222 | /* Calculate bytes consumed */ |
@@ -251,14 +243,12 @@ acpi_rs_vendor_resource ( | |||
251 | */ | 243 | */ |
252 | struct_size += ACPI_ROUND_UP_to_32_bITS (temp16); | 244 | struct_size += ACPI_ROUND_UP_to_32_bITS (temp16); |
253 | 245 | ||
254 | /* | 246 | /* Set the Length parameter */ |
255 | * Set the Length parameter | 247 | |
256 | */ | ||
257 | output_struct->length = (u32) struct_size; | 248 | output_struct->length = (u32) struct_size; |
258 | 249 | ||
259 | /* | 250 | /* Return the final size of the structure */ |
260 | * Return the final size of the structure | 251 | |
261 | */ | ||
262 | *structure_size = struct_size; | 252 | *structure_size = struct_size; |
263 | return_ACPI_STATUS (AE_OK); | 253 | return_ACPI_STATUS (AE_OK); |
264 | } | 254 | } |
@@ -295,13 +285,11 @@ acpi_rs_vendor_stream ( | |||
295 | ACPI_FUNCTION_TRACE ("rs_vendor_stream"); | 285 | ACPI_FUNCTION_TRACE ("rs_vendor_stream"); |
296 | 286 | ||
297 | 287 | ||
298 | /* | 288 | /* Dereference the length to find if this is a large or small item. */ |
299 | * Dereference the length to find if this is a large or small item. | 289 | |
300 | */ | ||
301 | if(linked_list->data.vendor_specific.length > 7) { | 290 | if(linked_list->data.vendor_specific.length > 7) { |
302 | /* | 291 | /* Large Item, Set the descriptor field and length bytes */ |
303 | * Large Item, Set the descriptor field and length bytes | 292 | |
304 | */ | ||
305 | *buffer = 0x84; | 293 | *buffer = 0x84; |
306 | buffer += 1; | 294 | buffer += 1; |
307 | 295 | ||
@@ -311,9 +299,8 @@ acpi_rs_vendor_stream ( | |||
311 | buffer += 2; | 299 | buffer += 2; |
312 | } | 300 | } |
313 | else { | 301 | else { |
314 | /* | 302 | /* Small Item, Set the descriptor field */ |
315 | * Small Item, Set the descriptor field | 303 | |
316 | */ | ||
317 | temp8 = 0x70; | 304 | temp8 = 0x70; |
318 | temp8 |= (u8) linked_list->data.vendor_specific.length; | 305 | temp8 |= (u8) linked_list->data.vendor_specific.length; |
319 | 306 | ||
@@ -321,9 +308,8 @@ acpi_rs_vendor_stream ( | |||
321 | buffer += 1; | 308 | buffer += 1; |
322 | } | 309 | } |
323 | 310 | ||
324 | /* | 311 | /* Loop through all of the Vendor Specific fields */ |
325 | * Loop through all of the Vendor Specific fields | 312 | |
326 | */ | ||
327 | for (index = 0; index < linked_list->data.vendor_specific.length; index++) { | 313 | for (index = 0; index < linked_list->data.vendor_specific.length; index++) { |
328 | temp8 = linked_list->data.vendor_specific.reserved[index]; | 314 | temp8 = linked_list->data.vendor_specific.reserved[index]; |
329 | 315 | ||
@@ -331,9 +317,8 @@ acpi_rs_vendor_stream ( | |||
331 | buffer += 1; | 317 | buffer += 1; |
332 | } | 318 | } |
333 | 319 | ||
334 | /* | 320 | /* Return the number of bytes consumed in this operation */ |
335 | * Return the number of bytes consumed in this operation | 321 | |
336 | */ | ||
337 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 322 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
338 | return_ACPI_STATUS (AE_OK); | 323 | return_ACPI_STATUS (AE_OK); |
339 | } | 324 | } |
@@ -370,40 +355,37 @@ acpi_rs_start_depend_fns_resource ( | |||
370 | u8 *buffer = byte_stream_buffer; | 355 | u8 *buffer = byte_stream_buffer; |
371 | struct acpi_resource *output_struct = (void *) *output_buffer; | 356 | struct acpi_resource *output_struct = (void *) *output_buffer; |
372 | u8 temp8 = 0; | 357 | u8 temp8 = 0; |
373 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_start_dpf); | 358 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
359 | struct acpi_resource_start_dpf); | ||
374 | 360 | ||
375 | 361 | ||
376 | ACPI_FUNCTION_TRACE ("rs_start_depend_fns_resource"); | 362 | ACPI_FUNCTION_TRACE ("rs_start_depend_fns_resource"); |
377 | 363 | ||
378 | 364 | ||
379 | /* | 365 | /* The number of bytes consumed are found in the descriptor (Bits:0-1) */ |
380 | * The number of bytes consumed are contained in the descriptor (Bits:0-1) | 366 | |
381 | */ | ||
382 | temp8 = *buffer; | 367 | temp8 = *buffer; |
383 | 368 | ||
384 | *bytes_consumed = (temp8 & 0x01) + 1; | 369 | *bytes_consumed = (temp8 & 0x01) + 1; |
385 | 370 | ||
386 | output_struct->id = ACPI_RSTYPE_START_DPF; | 371 | output_struct->id = ACPI_RSTYPE_START_DPF; |
387 | 372 | ||
388 | /* | 373 | /* Point to Byte 1 if it is used */ |
389 | * Point to Byte 1 if it is used | 374 | |
390 | */ | ||
391 | if (2 == *bytes_consumed) { | 375 | if (2 == *bytes_consumed) { |
392 | buffer += 1; | 376 | buffer += 1; |
393 | temp8 = *buffer; | 377 | temp8 = *buffer; |
394 | 378 | ||
395 | /* | 379 | /* Check Compatibility priority */ |
396 | * Check Compatibility priority | 380 | |
397 | */ | ||
398 | output_struct->data.start_dpf.compatibility_priority = temp8 & 0x03; | 381 | output_struct->data.start_dpf.compatibility_priority = temp8 & 0x03; |
399 | 382 | ||
400 | if (3 == output_struct->data.start_dpf.compatibility_priority) { | 383 | if (3 == output_struct->data.start_dpf.compatibility_priority) { |
401 | return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); | 384 | return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); |
402 | } | 385 | } |
403 | 386 | ||
404 | /* | 387 | /* Check Performance/Robustness preference */ |
405 | * Check Performance/Robustness preference | 388 | |
406 | */ | ||
407 | output_struct->data.start_dpf.performance_robustness = (temp8 >> 2) & 0x03; | 389 | output_struct->data.start_dpf.performance_robustness = (temp8 >> 2) & 0x03; |
408 | 390 | ||
409 | if (3 == output_struct->data.start_dpf.performance_robustness) { | 391 | if (3 == output_struct->data.start_dpf.performance_robustness) { |
@@ -412,20 +394,18 @@ acpi_rs_start_depend_fns_resource ( | |||
412 | } | 394 | } |
413 | else { | 395 | else { |
414 | output_struct->data.start_dpf.compatibility_priority = | 396 | output_struct->data.start_dpf.compatibility_priority = |
415 | ACPI_ACCEPTABLE_CONFIGURATION; | 397 | ACPI_ACCEPTABLE_CONFIGURATION; |
416 | 398 | ||
417 | output_struct->data.start_dpf.performance_robustness = | 399 | output_struct->data.start_dpf.performance_robustness = |
418 | ACPI_ACCEPTABLE_CONFIGURATION; | 400 | ACPI_ACCEPTABLE_CONFIGURATION; |
419 | } | 401 | } |
420 | 402 | ||
421 | /* | 403 | /* Set the Length parameter */ |
422 | * Set the Length parameter | 404 | |
423 | */ | ||
424 | output_struct->length = (u32) struct_size; | 405 | output_struct->length = (u32) struct_size; |
425 | 406 | ||
426 | /* | 407 | /* Return the final size of the structure */ |
427 | * Return the final size of the structure | 408 | |
428 | */ | ||
429 | *structure_size = struct_size; | 409 | *structure_size = struct_size; |
430 | return_ACPI_STATUS (AE_OK); | 410 | return_ACPI_STATUS (AE_OK); |
431 | } | 411 | } |
@@ -466,24 +446,20 @@ acpi_rs_end_depend_fns_resource ( | |||
466 | ACPI_FUNCTION_TRACE ("rs_end_depend_fns_resource"); | 446 | ACPI_FUNCTION_TRACE ("rs_end_depend_fns_resource"); |
467 | 447 | ||
468 | 448 | ||
469 | /* | 449 | /* The number of bytes consumed is static */ |
470 | * The number of bytes consumed is static | 450 | |
471 | */ | ||
472 | *bytes_consumed = 1; | 451 | *bytes_consumed = 1; |
473 | 452 | ||
474 | /* | 453 | /* Fill out the structure */ |
475 | * Fill out the structure | 454 | |
476 | */ | ||
477 | output_struct->id = ACPI_RSTYPE_END_DPF; | 455 | output_struct->id = ACPI_RSTYPE_END_DPF; |
478 | 456 | ||
479 | /* | 457 | /* Set the Length parameter */ |
480 | * Set the Length parameter | 458 | |
481 | */ | ||
482 | output_struct->length = (u32) struct_size; | 459 | output_struct->length = (u32) struct_size; |
483 | 460 | ||
484 | /* | 461 | /* Return the final size of the structure */ |
485 | * Return the final size of the structure | 462 | |
486 | */ | ||
487 | *structure_size = struct_size; | 463 | *structure_size = struct_size; |
488 | return_ACPI_STATUS (AE_OK); | 464 | return_ACPI_STATUS (AE_OK); |
489 | } | 465 | } |
@@ -533,9 +509,8 @@ acpi_rs_start_depend_fns_stream ( | |||
533 | *buffer = 0x31; | 509 | *buffer = 0x31; |
534 | buffer += 1; | 510 | buffer += 1; |
535 | 511 | ||
536 | /* | 512 | /* Set the Priority Byte Definition */ |
537 | * Set the Priority Byte Definition | 513 | |
538 | */ | ||
539 | temp8 = 0; | 514 | temp8 = 0; |
540 | temp8 = (u8) ((linked_list->data.start_dpf.performance_robustness & | 515 | temp8 = (u8) ((linked_list->data.start_dpf.performance_robustness & |
541 | 0x03) << 2); | 516 | 0x03) << 2); |
@@ -546,9 +521,8 @@ acpi_rs_start_depend_fns_stream ( | |||
546 | 521 | ||
547 | buffer += 1; | 522 | buffer += 1; |
548 | 523 | ||
549 | /* | 524 | /* Return the number of bytes consumed in this operation */ |
550 | * Return the number of bytes consumed in this operation | 525 | |
551 | */ | ||
552 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 526 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
553 | return_ACPI_STATUS (AE_OK); | 527 | return_ACPI_STATUS (AE_OK); |
554 | } | 528 | } |
@@ -582,15 +556,13 @@ acpi_rs_end_depend_fns_stream ( | |||
582 | ACPI_FUNCTION_TRACE ("rs_end_depend_fns_stream"); | 556 | ACPI_FUNCTION_TRACE ("rs_end_depend_fns_stream"); |
583 | 557 | ||
584 | 558 | ||
585 | /* | 559 | /* The descriptor field is static */ |
586 | * The descriptor field is static | 560 | |
587 | */ | ||
588 | *buffer = 0x38; | 561 | *buffer = 0x38; |
589 | buffer += 1; | 562 | buffer += 1; |
590 | 563 | ||
591 | /* | 564 | /* Return the number of bytes consumed in this operation */ |
592 | * Return the number of bytes consumed in this operation | 565 | |
593 | */ | ||
594 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 566 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
595 | return_ACPI_STATUS (AE_OK); | 567 | return_ACPI_STATUS (AE_OK); |
596 | } | 568 | } |
diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index ee9ce13c053d..700cf7d65d76 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c | |||
@@ -83,10 +83,10 @@ acpi_rs_get_prt_method_data ( | |||
83 | 83 | ||
84 | /* Parameters guaranteed valid by caller */ | 84 | /* Parameters guaranteed valid by caller */ |
85 | 85 | ||
86 | /* | 86 | /* Execute the method, no parameters */ |
87 | * Execute the method, no parameters | 87 | |
88 | */ | 88 | status = acpi_ut_evaluate_object (handle, METHOD_NAME__PRT, |
89 | status = acpi_ut_evaluate_object (handle, "_PRT", ACPI_BTYPE_PACKAGE, &obj_desc); | 89 | ACPI_BTYPE_PACKAGE, &obj_desc); |
90 | if (ACPI_FAILURE (status)) { | 90 | if (ACPI_FAILURE (status)) { |
91 | return_ACPI_STATUS (status); | 91 | return_ACPI_STATUS (status); |
92 | } | 92 | } |
@@ -136,10 +136,10 @@ acpi_rs_get_crs_method_data ( | |||
136 | 136 | ||
137 | /* Parameters guaranteed valid by caller */ | 137 | /* Parameters guaranteed valid by caller */ |
138 | 138 | ||
139 | /* | 139 | /* Execute the method, no parameters */ |
140 | * Execute the method, no parameters | 140 | |
141 | */ | 141 | status = acpi_ut_evaluate_object (handle, METHOD_NAME__CRS, |
142 | status = acpi_ut_evaluate_object (handle, "_CRS", ACPI_BTYPE_BUFFER, &obj_desc); | 142 | ACPI_BTYPE_BUFFER, &obj_desc); |
143 | if (ACPI_FAILURE (status)) { | 143 | if (ACPI_FAILURE (status)) { |
144 | return_ACPI_STATUS (status); | 144 | return_ACPI_STATUS (status); |
145 | } | 145 | } |
@@ -175,6 +175,7 @@ acpi_rs_get_crs_method_data ( | |||
175 | * and the contents of the callers buffer is undefined. | 175 | * and the contents of the callers buffer is undefined. |
176 | * | 176 | * |
177 | ******************************************************************************/ | 177 | ******************************************************************************/ |
178 | |||
178 | #ifdef ACPI_FUTURE_USAGE | 179 | #ifdef ACPI_FUTURE_USAGE |
179 | acpi_status | 180 | acpi_status |
180 | acpi_rs_get_prs_method_data ( | 181 | acpi_rs_get_prs_method_data ( |
@@ -190,10 +191,10 @@ acpi_rs_get_prs_method_data ( | |||
190 | 191 | ||
191 | /* Parameters guaranteed valid by caller */ | 192 | /* Parameters guaranteed valid by caller */ |
192 | 193 | ||
193 | /* | 194 | /* Execute the method, no parameters */ |
194 | * Execute the method, no parameters | 195 | |
195 | */ | 196 | status = acpi_ut_evaluate_object (handle, METHOD_NAME__PRS, |
196 | status = acpi_ut_evaluate_object (handle, "_PRS", ACPI_BTYPE_BUFFER, &obj_desc); | 197 | ACPI_BTYPE_BUFFER, &obj_desc); |
197 | if (ACPI_FAILURE (status)) { | 198 | if (ACPI_FAILURE (status)) { |
198 | return_ACPI_STATUS (status); | 199 | return_ACPI_STATUS (status); |
199 | } | 200 | } |
@@ -218,6 +219,7 @@ acpi_rs_get_prs_method_data ( | |||
218 | * FUNCTION: acpi_rs_get_method_data | 219 | * FUNCTION: acpi_rs_get_method_data |
219 | * | 220 | * |
220 | * PARAMETERS: Handle - a handle to the containing object | 221 | * PARAMETERS: Handle - a handle to the containing object |
222 | * Path - Path to method, relative to Handle | ||
221 | * ret_buffer - a pointer to a buffer structure for the | 223 | * ret_buffer - a pointer to a buffer structure for the |
222 | * results | 224 | * results |
223 | * | 225 | * |
@@ -246,9 +248,8 @@ acpi_rs_get_method_data ( | |||
246 | 248 | ||
247 | /* Parameters guaranteed valid by caller */ | 249 | /* Parameters guaranteed valid by caller */ |
248 | 250 | ||
249 | /* | 251 | /* Execute the method, no parameters */ |
250 | * Execute the method, no parameters | 252 | |
251 | */ | ||
252 | status = acpi_ut_evaluate_object (handle, path, ACPI_BTYPE_BUFFER, &obj_desc); | 253 | status = acpi_ut_evaluate_object (handle, path, ACPI_BTYPE_BUFFER, &obj_desc); |
253 | if (ACPI_FAILURE (status)) { | 254 | if (ACPI_FAILURE (status)) { |
254 | return_ACPI_STATUS (status); | 255 | return_ACPI_STATUS (status); |
@@ -314,18 +315,16 @@ acpi_rs_set_srs_method_data ( | |||
314 | return_ACPI_STATUS (status); | 315 | return_ACPI_STATUS (status); |
315 | } | 316 | } |
316 | 317 | ||
317 | /* | 318 | /* Init the param object */ |
318 | * Init the param object | 319 | |
319 | */ | ||
320 | params[0] = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER); | 320 | params[0] = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER); |
321 | if (!params[0]) { | 321 | if (!params[0]) { |
322 | acpi_os_free (buffer.pointer); | 322 | acpi_os_free (buffer.pointer); |
323 | return_ACPI_STATUS (AE_NO_MEMORY); | 323 | return_ACPI_STATUS (AE_NO_MEMORY); |
324 | } | 324 | } |
325 | 325 | ||
326 | /* | 326 | /* Set up the parameter object */ |
327 | * Set up the parameter object | 327 | |
328 | */ | ||
329 | params[0]->buffer.length = (u32) buffer.length; | 328 | params[0]->buffer.length = (u32) buffer.length; |
330 | params[0]->buffer.pointer = buffer.pointer; | 329 | params[0]->buffer.pointer = buffer.pointer; |
331 | params[0]->common.flags = AOPOBJ_DATA_VALID; | 330 | params[0]->common.flags = AOPOBJ_DATA_VALID; |
@@ -335,10 +334,9 @@ acpi_rs_set_srs_method_data ( | |||
335 | info.parameters = params; | 334 | info.parameters = params; |
336 | info.parameter_type = ACPI_PARAM_ARGS; | 335 | info.parameter_type = ACPI_PARAM_ARGS; |
337 | 336 | ||
338 | /* | 337 | /* Execute the method, no return value */ |
339 | * Execute the method, no return value | 338 | |
340 | */ | 339 | status = acpi_ns_evaluate_relative (METHOD_NAME__SRS, &info); |
341 | status = acpi_ns_evaluate_relative ("_SRS", &info); | ||
342 | if (ACPI_SUCCESS (status)) { | 340 | if (ACPI_SUCCESS (status)) { |
343 | /* Delete any return object (especially if implicit_return is enabled) */ | 341 | /* Delete any return object (especially if implicit_return is enabled) */ |
344 | 342 | ||
@@ -347,9 +345,8 @@ acpi_rs_set_srs_method_data ( | |||
347 | } | 345 | } |
348 | } | 346 | } |
349 | 347 | ||
350 | /* | 348 | /* Clean up and return the status from acpi_ns_evaluate_relative */ |
351 | * Clean up and return the status from acpi_ns_evaluate_relative | 349 | |
352 | */ | ||
353 | acpi_ut_remove_reference (params[0]); | 350 | acpi_ut_remove_reference (params[0]); |
354 | return_ACPI_STATUS (status); | 351 | return_ACPI_STATUS (status); |
355 | } | 352 | } |
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index a9cdcbeb3432..83c944b8b097 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c | |||
@@ -49,6 +49,23 @@ | |||
49 | #define _COMPONENT ACPI_RESOURCES | 49 | #define _COMPONENT ACPI_RESOURCES |
50 | ACPI_MODULE_NAME ("rsxface") | 50 | ACPI_MODULE_NAME ("rsxface") |
51 | 51 | ||
52 | /* Local macros for 16,32-bit to 64-bit conversion */ | ||
53 | |||
54 | #define ACPI_COPY_FIELD(out, in, field) ((out)->field = (in)->field) | ||
55 | #define ACPI_COPY_ADDRESS(out, in) \ | ||
56 | ACPI_COPY_FIELD(out, in, resource_type); \ | ||
57 | ACPI_COPY_FIELD(out, in, producer_consumer); \ | ||
58 | ACPI_COPY_FIELD(out, in, decode); \ | ||
59 | ACPI_COPY_FIELD(out, in, min_address_fixed); \ | ||
60 | ACPI_COPY_FIELD(out, in, max_address_fixed); \ | ||
61 | ACPI_COPY_FIELD(out, in, attribute); \ | ||
62 | ACPI_COPY_FIELD(out, in, granularity); \ | ||
63 | ACPI_COPY_FIELD(out, in, min_address_range); \ | ||
64 | ACPI_COPY_FIELD(out, in, max_address_range); \ | ||
65 | ACPI_COPY_FIELD(out, in, address_translation_offset); \ | ||
66 | ACPI_COPY_FIELD(out, in, address_length); \ | ||
67 | ACPI_COPY_FIELD(out, in, resource_source); | ||
68 | |||
52 | 69 | ||
53 | /******************************************************************************* | 70 | /******************************************************************************* |
54 | * | 71 | * |
@@ -180,6 +197,7 @@ EXPORT_SYMBOL(acpi_get_current_resources); | |||
180 | * and the value of ret_buffer is undefined. | 197 | * and the value of ret_buffer is undefined. |
181 | * | 198 | * |
182 | ******************************************************************************/ | 199 | ******************************************************************************/ |
200 | |||
183 | #ifdef ACPI_FUTURE_USAGE | 201 | #ifdef ACPI_FUTURE_USAGE |
184 | acpi_status | 202 | acpi_status |
185 | acpi_get_possible_resources ( | 203 | acpi_get_possible_resources ( |
@@ -346,9 +364,8 @@ acpi_set_current_resources ( | |||
346 | ACPI_FUNCTION_TRACE ("acpi_set_current_resources"); | 364 | ACPI_FUNCTION_TRACE ("acpi_set_current_resources"); |
347 | 365 | ||
348 | 366 | ||
349 | /* | 367 | /* Must have a valid handle and buffer */ |
350 | * Must have a valid handle and buffer | 368 | |
351 | */ | ||
352 | if ((!device_handle) || | 369 | if ((!device_handle) || |
353 | (!in_buffer) || | 370 | (!in_buffer) || |
354 | (!in_buffer->pointer) || | 371 | (!in_buffer->pointer) || |
@@ -362,21 +379,6 @@ acpi_set_current_resources ( | |||
362 | EXPORT_SYMBOL(acpi_set_current_resources); | 379 | EXPORT_SYMBOL(acpi_set_current_resources); |
363 | 380 | ||
364 | 381 | ||
365 | #define ACPI_COPY_FIELD(out, in, field) ((out)->field = (in)->field) | ||
366 | #define ACPI_COPY_ADDRESS(out, in) \ | ||
367 | ACPI_COPY_FIELD(out, in, resource_type); \ | ||
368 | ACPI_COPY_FIELD(out, in, producer_consumer); \ | ||
369 | ACPI_COPY_FIELD(out, in, decode); \ | ||
370 | ACPI_COPY_FIELD(out, in, min_address_fixed); \ | ||
371 | ACPI_COPY_FIELD(out, in, max_address_fixed); \ | ||
372 | ACPI_COPY_FIELD(out, in, attribute); \ | ||
373 | ACPI_COPY_FIELD(out, in, granularity); \ | ||
374 | ACPI_COPY_FIELD(out, in, min_address_range); \ | ||
375 | ACPI_COPY_FIELD(out, in, max_address_range); \ | ||
376 | ACPI_COPY_FIELD(out, in, address_translation_offset); \ | ||
377 | ACPI_COPY_FIELD(out, in, address_length); \ | ||
378 | ACPI_COPY_FIELD(out, in, resource_source); | ||
379 | |||
380 | /****************************************************************************** | 382 | /****************************************************************************** |
381 | * | 383 | * |
382 | * FUNCTION: acpi_resource_to_address64 | 384 | * FUNCTION: acpi_resource_to_address64 |
@@ -408,14 +410,14 @@ acpi_resource_to_address64 ( | |||
408 | case ACPI_RSTYPE_ADDRESS16: | 410 | case ACPI_RSTYPE_ADDRESS16: |
409 | 411 | ||
410 | address16 = (struct acpi_resource_address16 *) &resource->data; | 412 | address16 = (struct acpi_resource_address16 *) &resource->data; |
411 | ACPI_COPY_ADDRESS(out, address16); | 413 | ACPI_COPY_ADDRESS (out, address16); |
412 | break; | 414 | break; |
413 | 415 | ||
414 | 416 | ||
415 | case ACPI_RSTYPE_ADDRESS32: | 417 | case ACPI_RSTYPE_ADDRESS32: |
416 | 418 | ||
417 | address32 = (struct acpi_resource_address32 *) &resource->data; | 419 | address32 = (struct acpi_resource_address32 *) &resource->data; |
418 | ACPI_COPY_ADDRESS(out, address32); | 420 | ACPI_COPY_ADDRESS (out, address32); |
419 | break; | 421 | break; |
420 | 422 | ||
421 | 423 | ||
@@ -434,4 +436,3 @@ acpi_resource_to_address64 ( | |||
434 | return (AE_OK); | 436 | return (AE_OK); |
435 | } | 437 | } |
436 | EXPORT_SYMBOL(acpi_resource_to_address64); | 438 | EXPORT_SYMBOL(acpi_resource_to_address64); |
437 | |||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 337d49b5564b..cbcda30c172d 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -1061,13 +1061,15 @@ acpi_add_single_object ( | |||
1061 | /* | 1061 | /* |
1062 | * Status | 1062 | * Status |
1063 | * ------ | 1063 | * ------ |
1064 | * See if the device is present. We always assume that non-Device() | 1064 | * See if the device is present. We always assume that non-Device |
1065 | * objects (e.g. thermal zones, power resources, processors, etc.) are | 1065 | * and non-Processor objects (e.g. thermal zones, power resources, |
1066 | * present, functioning, etc. (at least when parent object is present). | 1066 | * etc.) are present, functioning, etc. (at least when parent object |
1067 | * Note that _STA has a different meaning for some objects (e.g. | 1067 | * is present). Note that _STA has a different meaning for some |
1068 | * power resources) so we need to be careful how we use it. | 1068 | * objects (e.g. power resources) so we need to be careful how we use |
1069 | * it. | ||
1069 | */ | 1070 | */ |
1070 | switch (type) { | 1071 | switch (type) { |
1072 | case ACPI_BUS_TYPE_PROCESSOR: | ||
1071 | case ACPI_BUS_TYPE_DEVICE: | 1073 | case ACPI_BUS_TYPE_DEVICE: |
1072 | result = acpi_bus_get_status(device); | 1074 | result = acpi_bus_get_status(device); |
1073 | if (ACPI_FAILURE(result) || !device->status.present) { | 1075 | if (ACPI_FAILURE(result) || !device->status.present) { |
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index 0a5d2a94131e..7249ba2b7a27 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * sleep.c - ACPI sleep support. | 2 | * sleep.c - ACPI sleep support. |
3 | * | 3 | * |
4 | * Copyright (c) 2005 Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> | ||
4 | * Copyright (c) 2004 David Shaohua Li <shaohua.li@intel.com> | 5 | * Copyright (c) 2004 David Shaohua Li <shaohua.li@intel.com> |
5 | * Copyright (c) 2000-2003 Patrick Mochel | 6 | * Copyright (c) 2000-2003 Patrick Mochel |
6 | * Copyright (c) 2003 Open Source Development Lab | 7 | * Copyright (c) 2003 Open Source Development Lab |
@@ -14,7 +15,6 @@ | |||
14 | #include <linux/dmi.h> | 15 | #include <linux/dmi.h> |
15 | #include <linux/device.h> | 16 | #include <linux/device.h> |
16 | #include <linux/suspend.h> | 17 | #include <linux/suspend.h> |
17 | #include <asm/io.h> | ||
18 | #include <acpi/acpi_bus.h> | 18 | #include <acpi/acpi_bus.h> |
19 | #include <acpi/acpi_drivers.h> | 19 | #include <acpi/acpi_drivers.h> |
20 | #include "sleep.h" | 20 | #include "sleep.h" |
@@ -27,10 +27,11 @@ extern void do_suspend_lowlevel_s4bios(void); | |||
27 | extern void do_suspend_lowlevel(void); | 27 | extern void do_suspend_lowlevel(void); |
28 | 28 | ||
29 | static u32 acpi_suspend_states[] = { | 29 | static u32 acpi_suspend_states[] = { |
30 | [PM_SUSPEND_ON] = ACPI_STATE_S0, | 30 | [PM_SUSPEND_ON] = ACPI_STATE_S0, |
31 | [PM_SUSPEND_STANDBY] = ACPI_STATE_S1, | 31 | [PM_SUSPEND_STANDBY] = ACPI_STATE_S1, |
32 | [PM_SUSPEND_MEM] = ACPI_STATE_S3, | 32 | [PM_SUSPEND_MEM] = ACPI_STATE_S3, |
33 | [PM_SUSPEND_DISK] = ACPI_STATE_S4, | 33 | [PM_SUSPEND_DISK] = ACPI_STATE_S4, |
34 | [PM_SUSPEND_MAX] = ACPI_STATE_S5 | ||
34 | }; | 35 | }; |
35 | 36 | ||
36 | static int init_8259A_after_S1; | 37 | static int init_8259A_after_S1; |
@@ -44,30 +45,20 @@ static int init_8259A_after_S1; | |||
44 | * wakeup code to the waking vector. | 45 | * wakeup code to the waking vector. |
45 | */ | 46 | */ |
46 | 47 | ||
48 | extern int acpi_sleep_prepare(u32 acpi_state); | ||
49 | extern void acpi_power_off(void); | ||
50 | |||
47 | static int acpi_pm_prepare(suspend_state_t pm_state) | 51 | static int acpi_pm_prepare(suspend_state_t pm_state) |
48 | { | 52 | { |
49 | u32 acpi_state = acpi_suspend_states[pm_state]; | 53 | u32 acpi_state = acpi_suspend_states[pm_state]; |
50 | 54 | ||
51 | if (!sleep_states[acpi_state]) | 55 | if (!sleep_states[acpi_state]) { |
56 | printk("acpi_pm_prepare does not support %d \n", pm_state); | ||
52 | return -EPERM; | 57 | return -EPERM; |
53 | |||
54 | /* do we have a wakeup address for S2 and S3? */ | ||
55 | /* Here, we support only S4BIOS, those we set the wakeup address */ | ||
56 | /* S4OS is only supported for now via swsusp.. */ | ||
57 | if (pm_state == PM_SUSPEND_MEM || pm_state == PM_SUSPEND_DISK) { | ||
58 | if (!acpi_wakeup_address) | ||
59 | return -EFAULT; | ||
60 | acpi_set_firmware_waking_vector( | ||
61 | (acpi_physical_address) virt_to_phys( | ||
62 | (void *)acpi_wakeup_address)); | ||
63 | } | 58 | } |
64 | ACPI_FLUSH_CPU_CACHE(); | 59 | return acpi_sleep_prepare(acpi_state); |
65 | acpi_enable_wakeup_device_prep(acpi_state); | ||
66 | acpi_enter_sleep_state_prep(acpi_state); | ||
67 | return 0; | ||
68 | } | 60 | } |
69 | 61 | ||
70 | |||
71 | /** | 62 | /** |
72 | * acpi_pm_enter - Actually enter a sleep state. | 63 | * acpi_pm_enter - Actually enter a sleep state. |
73 | * @pm_state: State we're entering. | 64 | * @pm_state: State we're entering. |
@@ -92,11 +83,9 @@ static int acpi_pm_enter(suspend_state_t pm_state) | |||
92 | return error; | 83 | return error; |
93 | } | 84 | } |
94 | 85 | ||
95 | |||
96 | local_irq_save(flags); | 86 | local_irq_save(flags); |
97 | acpi_enable_wakeup_device(acpi_state); | 87 | acpi_enable_wakeup_device(acpi_state); |
98 | switch (pm_state) | 88 | switch (pm_state) { |
99 | { | ||
100 | case PM_SUSPEND_STANDBY: | 89 | case PM_SUSPEND_STANDBY: |
101 | barrier(); | 90 | barrier(); |
102 | status = acpi_enter_sleep_state(acpi_state); | 91 | status = acpi_enter_sleep_state(acpi_state); |
@@ -112,6 +101,10 @@ static int acpi_pm_enter(suspend_state_t pm_state) | |||
112 | else | 101 | else |
113 | do_suspend_lowlevel_s4bios(); | 102 | do_suspend_lowlevel_s4bios(); |
114 | break; | 103 | break; |
104 | case PM_SUSPEND_MAX: | ||
105 | acpi_power_off(); | ||
106 | break; | ||
107 | |||
115 | default: | 108 | default: |
116 | return -EINVAL; | 109 | return -EINVAL; |
117 | } | 110 | } |
@@ -126,11 +119,9 @@ static int acpi_pm_enter(suspend_state_t pm_state) | |||
126 | if (pm_state > PM_SUSPEND_STANDBY) | 119 | if (pm_state > PM_SUSPEND_STANDBY) |
127 | acpi_restore_state_mem(); | 120 | acpi_restore_state_mem(); |
128 | 121 | ||
129 | |||
130 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; | 122 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; |
131 | } | 123 | } |
132 | 124 | ||
133 | |||
134 | /** | 125 | /** |
135 | * acpi_pm_finish - Finish up suspend sequence. | 126 | * acpi_pm_finish - Finish up suspend sequence. |
136 | * @pm_state: State we're coming out of. | 127 | * @pm_state: State we're coming out of. |
@@ -156,27 +147,26 @@ static int acpi_pm_finish(suspend_state_t pm_state) | |||
156 | return 0; | 147 | return 0; |
157 | } | 148 | } |
158 | 149 | ||
159 | |||
160 | int acpi_suspend(u32 acpi_state) | 150 | int acpi_suspend(u32 acpi_state) |
161 | { | 151 | { |
162 | suspend_state_t states[] = { | 152 | suspend_state_t states[] = { |
163 | [1] = PM_SUSPEND_STANDBY, | 153 | [1] = PM_SUSPEND_STANDBY, |
164 | [3] = PM_SUSPEND_MEM, | 154 | [3] = PM_SUSPEND_MEM, |
165 | [4] = PM_SUSPEND_DISK, | 155 | [4] = PM_SUSPEND_DISK, |
156 | [5] = PM_SUSPEND_MAX | ||
166 | }; | 157 | }; |
167 | 158 | ||
168 | if (acpi_state <= 4 && states[acpi_state]) | 159 | if (acpi_state < 6 && states[acpi_state]) |
169 | return pm_suspend(states[acpi_state]); | 160 | return pm_suspend(states[acpi_state]); |
170 | return -EINVAL; | 161 | return -EINVAL; |
171 | } | 162 | } |
172 | 163 | ||
173 | static struct pm_ops acpi_pm_ops = { | 164 | static struct pm_ops acpi_pm_ops = { |
174 | .prepare = acpi_pm_prepare, | 165 | .prepare = acpi_pm_prepare, |
175 | .enter = acpi_pm_enter, | 166 | .enter = acpi_pm_enter, |
176 | .finish = acpi_pm_finish, | 167 | .finish = acpi_pm_finish, |
177 | }; | 168 | }; |
178 | 169 | ||
179 | |||
180 | /* | 170 | /* |
181 | * Toshiba fails to preserve interrupts over S1, reinitialization | 171 | * Toshiba fails to preserve interrupts over S1, reinitialization |
182 | * of 8259 is needed after S1 resume. | 172 | * of 8259 is needed after S1 resume. |
@@ -190,16 +180,16 @@ static int __init init_ints_after_s1(struct dmi_system_id *d) | |||
190 | 180 | ||
191 | static struct dmi_system_id __initdata acpisleep_dmi_table[] = { | 181 | static struct dmi_system_id __initdata acpisleep_dmi_table[] = { |
192 | { | 182 | { |
193 | .callback = init_ints_after_s1, | 183 | .callback = init_ints_after_s1, |
194 | .ident = "Toshiba Satellite 4030cdt", | 184 | .ident = "Toshiba Satellite 4030cdt", |
195 | .matches = { DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"), }, | 185 | .matches = {DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),}, |
196 | }, | 186 | }, |
197 | { }, | 187 | {}, |
198 | }; | 188 | }; |
199 | 189 | ||
200 | static int __init acpi_sleep_init(void) | 190 | static int __init acpi_sleep_init(void) |
201 | { | 191 | { |
202 | int i = 0; | 192 | int i = 0; |
203 | 193 | ||
204 | dmi_check_system(acpisleep_dmi_table); | 194 | dmi_check_system(acpisleep_dmi_table); |
205 | 195 | ||
@@ -207,7 +197,7 @@ static int __init acpi_sleep_init(void) | |||
207 | return 0; | 197 | return 0; |
208 | 198 | ||
209 | printk(KERN_INFO PREFIX "(supports"); | 199 | printk(KERN_INFO PREFIX "(supports"); |
210 | for (i=0; i < ACPI_S_STATE_COUNT; i++) { | 200 | for (i = 0; i < ACPI_S_STATE_COUNT; i++) { |
211 | acpi_status status; | 201 | acpi_status status; |
212 | u8 type_a, type_b; | 202 | u8 type_a, type_b; |
213 | status = acpi_get_sleep_type_data(i, &type_a, &type_b); | 203 | status = acpi_get_sleep_type_data(i, &type_a, &type_b); |
diff --git a/drivers/acpi/sleep/poweroff.c b/drivers/acpi/sleep/poweroff.c index da237754ded9..1fc86e6b5ab9 100644 --- a/drivers/acpi/sleep/poweroff.c +++ b/drivers/acpi/sleep/poweroff.c | |||
@@ -3,35 +3,100 @@ | |||
3 | * | 3 | * |
4 | * AKA S5, but it is independent of whether or not the kernel supports | 4 | * AKA S5, but it is independent of whether or not the kernel supports |
5 | * any other sleep support in the system. | 5 | * any other sleep support in the system. |
6 | * | ||
7 | * Copyright (c) 2005 Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> | ||
8 | * | ||
9 | * This file is released under the GPLv2. | ||
6 | */ | 10 | */ |
7 | 11 | ||
8 | #include <linux/pm.h> | 12 | #include <linux/pm.h> |
9 | #include <linux/init.h> | 13 | #include <linux/init.h> |
10 | #include <acpi/acpi_bus.h> | 14 | #include <acpi/acpi_bus.h> |
11 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
16 | #include <linux/sysdev.h> | ||
17 | #include <asm/io.h> | ||
12 | #include "sleep.h" | 18 | #include "sleep.h" |
13 | 19 | ||
14 | static void | 20 | int acpi_sleep_prepare(u32 acpi_state) |
15 | acpi_power_off (void) | 21 | { |
22 | /* Flag to do not allow second time invocation for S5 state */ | ||
23 | static int shutdown_prepared = 0; | ||
24 | #ifdef CONFIG_ACPI_SLEEP | ||
25 | /* do we have a wakeup address for S2 and S3? */ | ||
26 | /* Here, we support only S4BIOS, those we set the wakeup address */ | ||
27 | /* S4OS is only supported for now via swsusp.. */ | ||
28 | if (acpi_state == ACPI_STATE_S3 || acpi_state == ACPI_STATE_S4) { | ||
29 | if (!acpi_wakeup_address) { | ||
30 | return -EFAULT; | ||
31 | } | ||
32 | acpi_set_firmware_waking_vector((acpi_physical_address) | ||
33 | virt_to_phys((void *) | ||
34 | acpi_wakeup_address)); | ||
35 | |||
36 | } | ||
37 | ACPI_FLUSH_CPU_CACHE(); | ||
38 | acpi_enable_wakeup_device_prep(acpi_state); | ||
39 | #endif | ||
40 | if (acpi_state == ACPI_STATE_S5) { | ||
41 | /* Check if we were already called */ | ||
42 | if (shutdown_prepared) | ||
43 | return 0; | ||
44 | acpi_wakeup_gpe_poweroff_prepare(); | ||
45 | shutdown_prepared = 1; | ||
46 | } | ||
47 | acpi_enter_sleep_state_prep(acpi_state); | ||
48 | return 0; | ||
49 | } | ||
50 | |||
51 | void acpi_power_off(void) | ||
16 | { | 52 | { |
17 | printk("%s called\n",__FUNCTION__); | 53 | printk("%s called\n", __FUNCTION__); |
54 | acpi_sleep_prepare(ACPI_STATE_S5); | ||
55 | local_irq_disable(); | ||
18 | /* Some SMP machines only can poweroff in boot CPU */ | 56 | /* Some SMP machines only can poweroff in boot CPU */ |
19 | set_cpus_allowed(current, cpumask_of_cpu(0)); | 57 | set_cpus_allowed(current, cpumask_of_cpu(0)); |
20 | acpi_wakeup_gpe_poweroff_prepare(); | ||
21 | acpi_enter_sleep_state_prep(ACPI_STATE_S5); | ||
22 | ACPI_DISABLE_IRQS(); | ||
23 | acpi_enter_sleep_state(ACPI_STATE_S5); | 58 | acpi_enter_sleep_state(ACPI_STATE_S5); |
24 | } | 59 | } |
25 | 60 | ||
61 | #ifdef CONFIG_PM | ||
62 | |||
63 | static int acpi_shutdown(struct sys_device *x) | ||
64 | { | ||
65 | return acpi_sleep_prepare(ACPI_STATE_S5); | ||
66 | } | ||
67 | |||
68 | static struct sysdev_class acpi_sysclass = { | ||
69 | set_kset_name("acpi"), | ||
70 | .shutdown = acpi_shutdown | ||
71 | }; | ||
72 | |||
73 | static struct sys_device device_acpi = { | ||
74 | .id = 0, | ||
75 | .cls = &acpi_sysclass, | ||
76 | }; | ||
77 | |||
78 | #endif | ||
79 | |||
26 | static int acpi_poweroff_init(void) | 80 | static int acpi_poweroff_init(void) |
27 | { | 81 | { |
28 | if (!acpi_disabled) { | 82 | if (!acpi_disabled) { |
29 | u8 type_a, type_b; | 83 | u8 type_a, type_b; |
30 | acpi_status status; | 84 | acpi_status status; |
31 | 85 | ||
32 | status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b); | 86 | status = |
33 | if (ACPI_SUCCESS(status)) | 87 | acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b); |
88 | if (ACPI_SUCCESS(status)) { | ||
34 | pm_power_off = acpi_power_off; | 89 | pm_power_off = acpi_power_off; |
90 | #ifdef CONFIG_PM | ||
91 | { | ||
92 | int error; | ||
93 | error = sysdev_class_register(&acpi_sysclass); | ||
94 | if (!error) | ||
95 | error = sysdev_register(&device_acpi); | ||
96 | return error; | ||
97 | } | ||
98 | #endif | ||
99 | } | ||
35 | } | 100 | } |
36 | return 0; | 101 | return 0; |
37 | } | 102 | } |
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c index fd7c5a0649af..1be99f0996d6 100644 --- a/drivers/acpi/sleep/proc.c +++ b/drivers/acpi/sleep/proc.c | |||
@@ -13,13 +13,17 @@ | |||
13 | 13 | ||
14 | #include "sleep.h" | 14 | #include "sleep.h" |
15 | 15 | ||
16 | #ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP | ||
16 | #define ACPI_SYSTEM_FILE_SLEEP "sleep" | 17 | #define ACPI_SYSTEM_FILE_SLEEP "sleep" |
18 | #endif | ||
19 | |||
17 | #define ACPI_SYSTEM_FILE_ALARM "alarm" | 20 | #define ACPI_SYSTEM_FILE_ALARM "alarm" |
18 | #define ACPI_SYSTEM_FILE_WAKEUP_DEVICE "wakeup" | 21 | #define ACPI_SYSTEM_FILE_WAKEUP_DEVICE "wakeup" |
19 | 22 | ||
20 | #define _COMPONENT ACPI_SYSTEM_COMPONENT | 23 | #define _COMPONENT ACPI_SYSTEM_COMPONENT |
21 | ACPI_MODULE_NAME ("sleep") | 24 | ACPI_MODULE_NAME ("sleep") |
22 | 25 | ||
26 | #ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP | ||
23 | 27 | ||
24 | static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset) | 28 | static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset) |
25 | { | 29 | { |
@@ -78,6 +82,7 @@ acpi_system_write_sleep ( | |||
78 | Done: | 82 | Done: |
79 | return error ? error : count; | 83 | return error ? error : count; |
80 | } | 84 | } |
85 | #endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */ | ||
81 | 86 | ||
82 | static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset) | 87 | static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset) |
83 | { | 88 | { |
@@ -452,6 +457,7 @@ static struct file_operations acpi_system_wakeup_device_fops = { | |||
452 | .release = single_release, | 457 | .release = single_release, |
453 | }; | 458 | }; |
454 | 459 | ||
460 | #ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP | ||
455 | static struct file_operations acpi_system_sleep_fops = { | 461 | static struct file_operations acpi_system_sleep_fops = { |
456 | .open = acpi_system_sleep_open_fs, | 462 | .open = acpi_system_sleep_open_fs, |
457 | .read = seq_read, | 463 | .read = seq_read, |
@@ -459,6 +465,7 @@ static struct file_operations acpi_system_sleep_fops = { | |||
459 | .llseek = seq_lseek, | 465 | .llseek = seq_lseek, |
460 | .release = single_release, | 466 | .release = single_release, |
461 | }; | 467 | }; |
468 | #endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */ | ||
462 | 469 | ||
463 | static struct file_operations acpi_system_alarm_fops = { | 470 | static struct file_operations acpi_system_alarm_fops = { |
464 | .open = acpi_system_alarm_open_fs, | 471 | .open = acpi_system_alarm_open_fs, |
@@ -484,11 +491,13 @@ static int acpi_sleep_proc_init(void) | |||
484 | if (acpi_disabled) | 491 | if (acpi_disabled) |
485 | return 0; | 492 | return 0; |
486 | 493 | ||
494 | #ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP | ||
487 | /* 'sleep' [R/W]*/ | 495 | /* 'sleep' [R/W]*/ |
488 | entry = create_proc_entry(ACPI_SYSTEM_FILE_SLEEP, | 496 | entry = create_proc_entry(ACPI_SYSTEM_FILE_SLEEP, |
489 | S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir); | 497 | S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir); |
490 | if (entry) | 498 | if (entry) |
491 | entry->proc_fops = &acpi_system_sleep_fops; | 499 | entry->proc_fops = &acpi_system_sleep_fops; |
500 | #endif | ||
492 | 501 | ||
493 | /* 'alarm' [R/W] */ | 502 | /* 'alarm' [R/W] */ |
494 | entry = create_proc_entry(ACPI_SYSTEM_FILE_ALARM, | 503 | entry = create_proc_entry(ACPI_SYSTEM_FILE_ALARM, |
diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c index 334327c1f66f..92e0c31539be 100644 --- a/drivers/acpi/tables/tbconvrt.c +++ b/drivers/acpi/tables/tbconvrt.c | |||
@@ -50,6 +50,24 @@ | |||
50 | #define _COMPONENT ACPI_TABLES | 50 | #define _COMPONENT ACPI_TABLES |
51 | ACPI_MODULE_NAME ("tbconvrt") | 51 | ACPI_MODULE_NAME ("tbconvrt") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
54 | |||
55 | static void | ||
56 | acpi_tb_init_generic_address ( | ||
57 | struct acpi_generic_address *new_gas_struct, | ||
58 | u8 register_bit_width, | ||
59 | acpi_physical_address address); | ||
60 | |||
61 | static void | ||
62 | acpi_tb_convert_fadt1 ( | ||
63 | struct fadt_descriptor_rev2 *local_fadt, | ||
64 | struct fadt_descriptor_rev1 *original_fadt); | ||
65 | |||
66 | static void | ||
67 | acpi_tb_convert_fadt2 ( | ||
68 | struct fadt_descriptor_rev2 *local_fadt, | ||
69 | struct fadt_descriptor_rev2 *original_fadt); | ||
70 | |||
53 | 71 | ||
54 | u8 acpi_fadt_is_v1; | 72 | u8 acpi_fadt_is_v1; |
55 | EXPORT_SYMBOL(acpi_fadt_is_v1); | 73 | EXPORT_SYMBOL(acpi_fadt_is_v1); |
@@ -142,11 +160,13 @@ acpi_tb_convert_to_xsdt ( | |||
142 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { | 160 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { |
143 | if (acpi_gbl_RSDP->revision < 2) { | 161 | if (acpi_gbl_RSDP->revision < 2) { |
144 | ACPI_STORE_ADDRESS (new_table->table_offset_entry[i], | 162 | ACPI_STORE_ADDRESS (new_table->table_offset_entry[i], |
145 | (ACPI_CAST_PTR (struct rsdt_descriptor_rev1, table_info->pointer))->table_offset_entry[i]); | 163 | (ACPI_CAST_PTR (struct rsdt_descriptor_rev1, |
164 | table_info->pointer))->table_offset_entry[i]); | ||
146 | } | 165 | } |
147 | else { | 166 | else { |
148 | new_table->table_offset_entry[i] = | 167 | new_table->table_offset_entry[i] = |
149 | (ACPI_CAST_PTR (XSDT_DESCRIPTOR, table_info->pointer))->table_offset_entry[i]; | 168 | (ACPI_CAST_PTR (XSDT_DESCRIPTOR, |
169 | table_info->pointer))->table_offset_entry[i]; | ||
150 | } | 170 | } |
151 | } | 171 | } |
152 | 172 | ||
@@ -164,7 +184,7 @@ acpi_tb_convert_to_xsdt ( | |||
164 | } | 184 | } |
165 | 185 | ||
166 | 186 | ||
167 | /****************************************************************************** | 187 | /******************************************************************************* |
168 | * | 188 | * |
169 | * FUNCTION: acpi_tb_init_generic_address | 189 | * FUNCTION: acpi_tb_init_generic_address |
170 | * | 190 | * |
@@ -201,7 +221,7 @@ acpi_tb_init_generic_address ( | |||
201 | * PARAMETERS: local_fadt - Pointer to new FADT | 221 | * PARAMETERS: local_fadt - Pointer to new FADT |
202 | * original_fadt - Pointer to old FADT | 222 | * original_fadt - Pointer to old FADT |
203 | * | 223 | * |
204 | * RETURN: Populates local_fadt | 224 | * RETURN: None, populates local_fadt |
205 | * | 225 | * |
206 | * DESCRIPTION: Convert an ACPI 1.0 FADT to common internal format | 226 | * DESCRIPTION: Convert an ACPI 1.0 FADT to common internal format |
207 | * | 227 | * |
@@ -213,7 +233,6 @@ acpi_tb_convert_fadt1 ( | |||
213 | struct fadt_descriptor_rev1 *original_fadt) | 233 | struct fadt_descriptor_rev1 *original_fadt) |
214 | { | 234 | { |
215 | 235 | ||
216 | |||
217 | /* ACPI 1.0 FACS */ | 236 | /* ACPI 1.0 FACS */ |
218 | /* The BIOS stored FADT should agree with Revision 1.0 */ | 237 | /* The BIOS stored FADT should agree with Revision 1.0 */ |
219 | acpi_fadt_is_v1 = 1; | 238 | acpi_fadt_is_v1 = 1; |
@@ -232,7 +251,8 @@ acpi_tb_convert_fadt1 ( | |||
232 | ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt); | 251 | ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt); |
233 | 252 | ||
234 | /* | 253 | /* |
235 | * System Interrupt Model isn't used in ACPI 2.0 (local_fadt->Reserved1 = 0;) | 254 | * System Interrupt Model isn't used in ACPI 2.0 |
255 | * (local_fadt->Reserved1 = 0;) | ||
236 | */ | 256 | */ |
237 | 257 | ||
238 | /* | 258 | /* |
@@ -269,7 +289,8 @@ acpi_tb_convert_fadt1 ( | |||
269 | * that immediately follows. | 289 | * that immediately follows. |
270 | */ | 290 | */ |
271 | ACPI_MEMCPY (&local_fadt->reset_register, | 291 | ACPI_MEMCPY (&local_fadt->reset_register, |
272 | &(ACPI_CAST_PTR (struct fadt_descriptor_rev2_minus, original_fadt))->reset_register, | 292 | &(ACPI_CAST_PTR (struct fadt_descriptor_rev2_minus, |
293 | original_fadt))->reset_register, | ||
273 | sizeof (struct acpi_generic_address) + 1); | 294 | sizeof (struct acpi_generic_address) + 1); |
274 | } | 295 | } |
275 | else { | 296 | else { |
@@ -304,7 +325,8 @@ acpi_tb_convert_fadt1 ( | |||
304 | 325 | ||
305 | acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, | 326 | acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, |
306 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), | 327 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), |
307 | (acpi_physical_address) (local_fadt->xpm1a_evt_blk.address + | 328 | (acpi_physical_address) |
329 | (local_fadt->xpm1a_evt_blk.address + | ||
308 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); | 330 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); |
309 | 331 | ||
310 | /* PM1B is optional; leave null if not present */ | 332 | /* PM1B is optional; leave null if not present */ |
@@ -312,7 +334,8 @@ acpi_tb_convert_fadt1 ( | |||
312 | if (local_fadt->xpm1b_evt_blk.address) { | 334 | if (local_fadt->xpm1b_evt_blk.address) { |
313 | acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, | 335 | acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, |
314 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), | 336 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), |
315 | (acpi_physical_address) (local_fadt->xpm1b_evt_blk.address + | 337 | (acpi_physical_address) |
338 | (local_fadt->xpm1b_evt_blk.address + | ||
316 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); | 339 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); |
317 | } | 340 | } |
318 | } | 341 | } |
@@ -325,7 +348,7 @@ acpi_tb_convert_fadt1 ( | |||
325 | * PARAMETERS: local_fadt - Pointer to new FADT | 348 | * PARAMETERS: local_fadt - Pointer to new FADT |
326 | * original_fadt - Pointer to old FADT | 349 | * original_fadt - Pointer to old FADT |
327 | * | 350 | * |
328 | * RETURN: Populates local_fadt | 351 | * RETURN: None, populates local_fadt |
329 | * | 352 | * |
330 | * DESCRIPTION: Convert an ACPI 2.0 FADT to common internal format. | 353 | * DESCRIPTION: Convert an ACPI 2.0 FADT to common internal format. |
331 | * Handles optional "X" fields. | 354 | * Handles optional "X" fields. |
@@ -348,7 +371,8 @@ acpi_tb_convert_fadt2 ( | |||
348 | * is zero. | 371 | * is zero. |
349 | */ | 372 | */ |
350 | if (!(local_fadt->xfirmware_ctrl)) { | 373 | if (!(local_fadt->xfirmware_ctrl)) { |
351 | ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl, local_fadt->V1_firmware_ctrl); | 374 | ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl, |
375 | local_fadt->V1_firmware_ctrl); | ||
352 | } | 376 | } |
353 | 377 | ||
354 | if (!(local_fadt->Xdsdt)) { | 378 | if (!(local_fadt->Xdsdt)) { |
@@ -357,32 +381,38 @@ acpi_tb_convert_fadt2 ( | |||
357 | 381 | ||
358 | if (!(local_fadt->xpm1a_evt_blk.address)) { | 382 | if (!(local_fadt->xpm1a_evt_blk.address)) { |
359 | acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk, | 383 | acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk, |
360 | local_fadt->pm1_evt_len, (acpi_physical_address) local_fadt->V1_pm1a_evt_blk); | 384 | local_fadt->pm1_evt_len, |
385 | (acpi_physical_address) local_fadt->V1_pm1a_evt_blk); | ||
361 | } | 386 | } |
362 | 387 | ||
363 | if (!(local_fadt->xpm1b_evt_blk.address)) { | 388 | if (!(local_fadt->xpm1b_evt_blk.address)) { |
364 | acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk, | 389 | acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk, |
365 | local_fadt->pm1_evt_len, (acpi_physical_address) local_fadt->V1_pm1b_evt_blk); | 390 | local_fadt->pm1_evt_len, |
391 | (acpi_physical_address) local_fadt->V1_pm1b_evt_blk); | ||
366 | } | 392 | } |
367 | 393 | ||
368 | if (!(local_fadt->xpm1a_cnt_blk.address)) { | 394 | if (!(local_fadt->xpm1a_cnt_blk.address)) { |
369 | acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk, | 395 | acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk, |
370 | local_fadt->pm1_cnt_len, (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk); | 396 | local_fadt->pm1_cnt_len, |
397 | (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk); | ||
371 | } | 398 | } |
372 | 399 | ||
373 | if (!(local_fadt->xpm1b_cnt_blk.address)) { | 400 | if (!(local_fadt->xpm1b_cnt_blk.address)) { |
374 | acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk, | 401 | acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk, |
375 | local_fadt->pm1_cnt_len, (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk); | 402 | local_fadt->pm1_cnt_len, |
403 | (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk); | ||
376 | } | 404 | } |
377 | 405 | ||
378 | if (!(local_fadt->xpm2_cnt_blk.address)) { | 406 | if (!(local_fadt->xpm2_cnt_blk.address)) { |
379 | acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk, | 407 | acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk, |
380 | local_fadt->pm2_cnt_len, (acpi_physical_address) local_fadt->V1_pm2_cnt_blk); | 408 | local_fadt->pm2_cnt_len, |
409 | (acpi_physical_address) local_fadt->V1_pm2_cnt_blk); | ||
381 | } | 410 | } |
382 | 411 | ||
383 | if (!(local_fadt->xpm_tmr_blk.address)) { | 412 | if (!(local_fadt->xpm_tmr_blk.address)) { |
384 | acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk, | 413 | acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk, |
385 | local_fadt->pm_tm_len, (acpi_physical_address) local_fadt->V1_pm_tmr_blk); | 414 | local_fadt->pm_tm_len, |
415 | (acpi_physical_address) local_fadt->V1_pm_tmr_blk); | ||
386 | } | 416 | } |
387 | 417 | ||
388 | if (!(local_fadt->xgpe0_blk.address)) { | 418 | if (!(local_fadt->xgpe0_blk.address)) { |
@@ -399,18 +429,24 @@ acpi_tb_convert_fadt2 ( | |||
399 | 429 | ||
400 | acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, | 430 | acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, |
401 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), | 431 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), |
402 | (acpi_physical_address) (local_fadt->xpm1a_evt_blk.address + | 432 | (acpi_physical_address) |
433 | (local_fadt->xpm1a_evt_blk.address + | ||
403 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); | 434 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); |
404 | acpi_gbl_xpm1a_enable.address_space_id = local_fadt->xpm1a_evt_blk.address_space_id; | 435 | |
436 | acpi_gbl_xpm1a_enable.address_space_id = | ||
437 | local_fadt->xpm1a_evt_blk.address_space_id; | ||
405 | 438 | ||
406 | /* PM1B is optional; leave null if not present */ | 439 | /* PM1B is optional; leave null if not present */ |
407 | 440 | ||
408 | if (local_fadt->xpm1b_evt_blk.address) { | 441 | if (local_fadt->xpm1b_evt_blk.address) { |
409 | acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, | 442 | acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, |
410 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), | 443 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), |
411 | (acpi_physical_address) (local_fadt->xpm1b_evt_blk.address + | 444 | (acpi_physical_address) |
445 | (local_fadt->xpm1b_evt_blk.address + | ||
412 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); | 446 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); |
413 | acpi_gbl_xpm1b_enable.address_space_id = local_fadt->xpm1b_evt_blk.address_space_id; | 447 | |
448 | acpi_gbl_xpm1b_enable.address_space_id = | ||
449 | local_fadt->xpm1b_evt_blk.address_space_id; | ||
414 | } | 450 | } |
415 | } | 451 | } |
416 | 452 | ||
@@ -432,7 +468,8 @@ acpi_tb_convert_fadt2 ( | |||
432 | ******************************************************************************/ | 468 | ******************************************************************************/ |
433 | 469 | ||
434 | acpi_status | 470 | acpi_status |
435 | acpi_tb_convert_table_fadt (void) | 471 | acpi_tb_convert_table_fadt ( |
472 | void) | ||
436 | { | 473 | { |
437 | struct fadt_descriptor_rev2 *local_fadt; | 474 | struct fadt_descriptor_rev2 *local_fadt; |
438 | struct acpi_table_desc *table_desc; | 475 | struct acpi_table_desc *table_desc; |
@@ -446,7 +483,8 @@ acpi_tb_convert_table_fadt (void) | |||
446 | * at least as long as the version 1.0 FADT | 483 | * at least as long as the version 1.0 FADT |
447 | */ | 484 | */ |
448 | if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev1)) { | 485 | if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev1)) { |
449 | ACPI_REPORT_ERROR (("FADT is invalid, too short: 0x%X\n", acpi_gbl_FADT->length)); | 486 | ACPI_REPORT_ERROR (("FADT is invalid, too short: 0x%X\n", |
487 | acpi_gbl_FADT->length)); | ||
450 | return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); | 488 | return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); |
451 | } | 489 | } |
452 | 490 | ||
@@ -461,8 +499,9 @@ acpi_tb_convert_table_fadt (void) | |||
461 | if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev2)) { | 499 | if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev2)) { |
462 | /* Length is too short to be a V2.0 table */ | 500 | /* Length is too short to be a V2.0 table */ |
463 | 501 | ||
464 | ACPI_REPORT_WARNING (("Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n", | 502 | ACPI_REPORT_WARNING (( |
465 | acpi_gbl_FADT->length, acpi_gbl_FADT->revision)); | 503 | "Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n", |
504 | acpi_gbl_FADT->length, acpi_gbl_FADT->revision)); | ||
466 | 505 | ||
467 | acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); | 506 | acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); |
468 | } | 507 | } |
@@ -478,9 +517,8 @@ acpi_tb_convert_table_fadt (void) | |||
478 | acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); | 517 | acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); |
479 | } | 518 | } |
480 | 519 | ||
481 | /* | 520 | /* Global FADT pointer will point to the new common V2.0 FADT */ |
482 | * Global FADT pointer will point to the new common V2.0 FADT | 521 | |
483 | */ | ||
484 | acpi_gbl_FADT = local_fadt; | 522 | acpi_gbl_FADT = local_fadt; |
485 | acpi_gbl_FADT->length = sizeof (FADT_DESCRIPTOR); | 523 | acpi_gbl_FADT->length = sizeof (FADT_DESCRIPTOR); |
486 | 524 | ||
@@ -508,7 +546,7 @@ acpi_tb_convert_table_fadt (void) | |||
508 | 546 | ||
509 | /******************************************************************************* | 547 | /******************************************************************************* |
510 | * | 548 | * |
511 | * FUNCTION: acpi_tb_convert_table_facs | 549 | * FUNCTION: acpi_tb_build_common_facs |
512 | * | 550 | * |
513 | * PARAMETERS: table_info - Info for currently installed FACS | 551 | * PARAMETERS: table_info - Info for currently installed FACS |
514 | * | 552 | * |
@@ -530,12 +568,14 @@ acpi_tb_build_common_facs ( | |||
530 | /* Absolute minimum length is 24, but the ACPI spec says 64 */ | 568 | /* Absolute minimum length is 24, but the ACPI spec says 64 */ |
531 | 569 | ||
532 | if (acpi_gbl_FACS->length < 24) { | 570 | if (acpi_gbl_FACS->length < 24) { |
533 | ACPI_REPORT_ERROR (("Invalid FACS table length: 0x%X\n", acpi_gbl_FACS->length)); | 571 | ACPI_REPORT_ERROR (("Invalid FACS table length: 0x%X\n", |
572 | acpi_gbl_FACS->length)); | ||
534 | return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); | 573 | return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); |
535 | } | 574 | } |
536 | 575 | ||
537 | if (acpi_gbl_FACS->length < 64) { | 576 | if (acpi_gbl_FACS->length < 64) { |
538 | ACPI_REPORT_WARNING (("FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n", | 577 | ACPI_REPORT_WARNING (( |
578 | "FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n", | ||
539 | acpi_gbl_FACS->length)); | 579 | acpi_gbl_FACS->length)); |
540 | } | 580 | } |
541 | 581 | ||
@@ -548,7 +588,8 @@ acpi_tb_build_common_facs ( | |||
548 | (!(acpi_gbl_FACS->xfirmware_waking_vector))) { | 588 | (!(acpi_gbl_FACS->xfirmware_waking_vector))) { |
549 | /* ACPI 1.0 FACS or short table or optional X_ field is zero */ | 589 | /* ACPI 1.0 FACS or short table or optional X_ field is zero */ |
550 | 590 | ||
551 | acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR (u64, &(acpi_gbl_FACS->firmware_waking_vector)); | 591 | acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR (u64, |
592 | &(acpi_gbl_FACS->firmware_waking_vector)); | ||
552 | acpi_gbl_common_fACS.vector_width = 32; | 593 | acpi_gbl_common_fACS.vector_width = 32; |
553 | } | 594 | } |
554 | else { | 595 | else { |
diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c index 896f3ddda62e..4ab2aadc6133 100644 --- a/drivers/acpi/tables/tbget.c +++ b/drivers/acpi/tables/tbget.c | |||
@@ -49,6 +49,19 @@ | |||
49 | #define _COMPONENT ACPI_TABLES | 49 | #define _COMPONENT ACPI_TABLES |
50 | ACPI_MODULE_NAME ("tbget") | 50 | ACPI_MODULE_NAME ("tbget") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static acpi_status | ||
55 | acpi_tb_get_this_table ( | ||
56 | struct acpi_pointer *address, | ||
57 | struct acpi_table_header *header, | ||
58 | struct acpi_table_desc *table_info); | ||
59 | |||
60 | static acpi_status | ||
61 | acpi_tb_table_override ( | ||
62 | struct acpi_table_header *header, | ||
63 | struct acpi_table_desc *table_info); | ||
64 | |||
52 | 65 | ||
53 | /******************************************************************************* | 66 | /******************************************************************************* |
54 | * | 67 | * |
@@ -76,9 +89,8 @@ acpi_tb_get_table ( | |||
76 | ACPI_FUNCTION_TRACE ("tb_get_table"); | 89 | ACPI_FUNCTION_TRACE ("tb_get_table"); |
77 | 90 | ||
78 | 91 | ||
79 | /* | 92 | /* Get the header in order to get signature and table size */ |
80 | * Get the header in order to get signature and table size | 93 | |
81 | */ | ||
82 | status = acpi_tb_get_table_header (address, &header); | 94 | status = acpi_tb_get_table_header (address, &header); |
83 | if (ACPI_FAILURE (status)) { | 95 | if (ACPI_FAILURE (status)) { |
84 | return_ACPI_STATUS (status); | 96 | return_ACPI_STATUS (status); |
@@ -127,8 +139,8 @@ acpi_tb_get_table_header ( | |||
127 | 139 | ||
128 | 140 | ||
129 | /* | 141 | /* |
130 | * Flags contains the current processor mode (Virtual or Physical addressing) | 142 | * Flags contains the current processor mode (Virtual or Physical |
131 | * The pointer_type is either Logical or Physical | 143 | * addressing) The pointer_type is either Logical or Physical |
132 | */ | 144 | */ |
133 | switch (address->pointer_type) { | 145 | switch (address->pointer_type) { |
134 | case ACPI_PHYSMODE_PHYSPTR: | 146 | case ACPI_PHYSMODE_PHYSPTR: |
@@ -136,7 +148,8 @@ acpi_tb_get_table_header ( | |||
136 | 148 | ||
137 | /* Pointer matches processor mode, copy the header */ | 149 | /* Pointer matches processor mode, copy the header */ |
138 | 150 | ||
139 | ACPI_MEMCPY (return_header, address->pointer.logical, sizeof (struct acpi_table_header)); | 151 | ACPI_MEMCPY (return_header, address->pointer.logical, |
152 | sizeof (struct acpi_table_header)); | ||
140 | break; | 153 | break; |
141 | 154 | ||
142 | 155 | ||
@@ -144,10 +157,11 @@ acpi_tb_get_table_header ( | |||
144 | 157 | ||
145 | /* Create a logical address for the physical pointer*/ | 158 | /* Create a logical address for the physical pointer*/ |
146 | 159 | ||
147 | status = acpi_os_map_memory (address->pointer.physical, sizeof (struct acpi_table_header), | 160 | status = acpi_os_map_memory (address->pointer.physical, |
148 | (void *) &header); | 161 | sizeof (struct acpi_table_header), (void *) &header); |
149 | if (ACPI_FAILURE (status)) { | 162 | if (ACPI_FAILURE (status)) { |
150 | ACPI_REPORT_ERROR (("Could not map memory at %8.8X%8.8X for length %X\n", | 163 | ACPI_REPORT_ERROR (( |
164 | "Could not map memory at %8.8X%8.8X for length %X\n", | ||
151 | ACPI_FORMAT_UINT64 (address->pointer.physical), | 165 | ACPI_FORMAT_UINT64 (address->pointer.physical), |
152 | sizeof (struct acpi_table_header))); | 166 | sizeof (struct acpi_table_header))); |
153 | return_ACPI_STATUS (status); | 167 | return_ACPI_STATUS (status); |
@@ -210,9 +224,8 @@ acpi_tb_get_table_body ( | |||
210 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 224 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
211 | } | 225 | } |
212 | 226 | ||
213 | /* | 227 | /* Attempt table override. */ |
214 | * Attempt table override. | 228 | |
215 | */ | ||
216 | status = acpi_tb_table_override (header, table_info); | 229 | status = acpi_tb_table_override (header, table_info); |
217 | if (ACPI_SUCCESS (status)) { | 230 | if (ACPI_SUCCESS (status)) { |
218 | /* Table was overridden by the host OS */ | 231 | /* Table was overridden by the host OS */ |
@@ -241,7 +254,7 @@ acpi_tb_get_table_body ( | |||
241 | * | 254 | * |
242 | ******************************************************************************/ | 255 | ******************************************************************************/ |
243 | 256 | ||
244 | acpi_status | 257 | static acpi_status |
245 | acpi_tb_table_override ( | 258 | acpi_tb_table_override ( |
246 | struct acpi_table_header *header, | 259 | struct acpi_table_header *header, |
247 | struct acpi_table_desc *table_info) | 260 | struct acpi_table_desc *table_info) |
@@ -315,7 +328,7 @@ acpi_tb_table_override ( | |||
315 | * | 328 | * |
316 | ******************************************************************************/ | 329 | ******************************************************************************/ |
317 | 330 | ||
318 | acpi_status | 331 | static acpi_status |
319 | acpi_tb_get_this_table ( | 332 | acpi_tb_get_this_table ( |
320 | struct acpi_pointer *address, | 333 | struct acpi_pointer *address, |
321 | struct acpi_table_header *header, | 334 | struct acpi_table_header *header, |
@@ -330,8 +343,8 @@ acpi_tb_get_this_table ( | |||
330 | 343 | ||
331 | 344 | ||
332 | /* | 345 | /* |
333 | * Flags contains the current processor mode (Virtual or Physical addressing) | 346 | * Flags contains the current processor mode (Virtual or Physical |
334 | * The pointer_type is either Logical or Physical | 347 | * addressing) The pointer_type is either Logical or Physical |
335 | */ | 348 | */ |
336 | switch (address->pointer_type) { | 349 | switch (address->pointer_type) { |
337 | case ACPI_PHYSMODE_PHYSPTR: | 350 | case ACPI_PHYSMODE_PHYSPTR: |
@@ -341,7 +354,8 @@ acpi_tb_get_this_table ( | |||
341 | 354 | ||
342 | full_table = ACPI_MEM_ALLOCATE (header->length); | 355 | full_table = ACPI_MEM_ALLOCATE (header->length); |
343 | if (!full_table) { | 356 | if (!full_table) { |
344 | ACPI_REPORT_ERROR (("Could not allocate table memory for [%4.4s] length %X\n", | 357 | ACPI_REPORT_ERROR (( |
358 | "Could not allocate table memory for [%4.4s] length %X\n", | ||
345 | header->signature, header->length)); | 359 | header->signature, header->length)); |
346 | return_ACPI_STATUS (AE_NO_MEMORY); | 360 | return_ACPI_STATUS (AE_NO_MEMORY); |
347 | } | 361 | } |
@@ -362,12 +376,14 @@ acpi_tb_get_this_table ( | |||
362 | * Just map the table's physical memory | 376 | * Just map the table's physical memory |
363 | * into our address space. | 377 | * into our address space. |
364 | */ | 378 | */ |
365 | status = acpi_os_map_memory (address->pointer.physical, (acpi_size) header->length, | 379 | status = acpi_os_map_memory (address->pointer.physical, |
366 | (void *) &full_table); | 380 | (acpi_size) header->length, (void *) &full_table); |
367 | if (ACPI_FAILURE (status)) { | 381 | if (ACPI_FAILURE (status)) { |
368 | ACPI_REPORT_ERROR (("Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n", | 382 | ACPI_REPORT_ERROR (( |
383 | "Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n", | ||
369 | header->signature, | 384 | header->signature, |
370 | ACPI_FORMAT_UINT64 (address->pointer.physical), header->length)); | 385 | ACPI_FORMAT_UINT64 (address->pointer.physical), |
386 | header->length)); | ||
371 | return (status); | 387 | return (status); |
372 | } | 388 | } |
373 | 389 | ||
@@ -465,9 +481,8 @@ acpi_tb_get_table_ptr ( | |||
465 | return_ACPI_STATUS (AE_OK); | 481 | return_ACPI_STATUS (AE_OK); |
466 | } | 482 | } |
467 | 483 | ||
468 | /* | 484 | /* Check for instance out of range */ |
469 | * Check for instance out of range | 485 | |
470 | */ | ||
471 | if (instance > acpi_gbl_table_lists[table_type].count) { | 486 | if (instance > acpi_gbl_table_lists[table_type].count) { |
472 | return_ACPI_STATUS (AE_NOT_EXIST); | 487 | return_ACPI_STATUS (AE_NOT_EXIST); |
473 | } | 488 | } |
diff --git a/drivers/acpi/tables/tbgetall.c b/drivers/acpi/tables/tbgetall.c index adc4270988bc..eea5b8cb5ebb 100644 --- a/drivers/acpi/tables/tbgetall.c +++ b/drivers/acpi/tables/tbgetall.c | |||
@@ -49,6 +49,19 @@ | |||
49 | #define _COMPONENT ACPI_TABLES | 49 | #define _COMPONENT ACPI_TABLES |
50 | ACPI_MODULE_NAME ("tbgetall") | 50 | ACPI_MODULE_NAME ("tbgetall") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static acpi_status | ||
55 | acpi_tb_get_primary_table ( | ||
56 | struct acpi_pointer *address, | ||
57 | struct acpi_table_desc *table_info); | ||
58 | |||
59 | static acpi_status | ||
60 | acpi_tb_get_secondary_table ( | ||
61 | struct acpi_pointer *address, | ||
62 | acpi_string signature, | ||
63 | struct acpi_table_desc *table_info); | ||
64 | |||
52 | 65 | ||
53 | /******************************************************************************* | 66 | /******************************************************************************* |
54 | * | 67 | * |
@@ -63,7 +76,7 @@ | |||
63 | * | 76 | * |
64 | ******************************************************************************/ | 77 | ******************************************************************************/ |
65 | 78 | ||
66 | acpi_status | 79 | static acpi_status |
67 | acpi_tb_get_primary_table ( | 80 | acpi_tb_get_primary_table ( |
68 | struct acpi_pointer *address, | 81 | struct acpi_pointer *address, |
69 | struct acpi_table_desc *table_info) | 82 | struct acpi_table_desc *table_info) |
@@ -81,9 +94,8 @@ acpi_tb_get_primary_table ( | |||
81 | return_ACPI_STATUS (AE_OK); | 94 | return_ACPI_STATUS (AE_OK); |
82 | } | 95 | } |
83 | 96 | ||
84 | /* | 97 | /* Get the header in order to get signature and table size */ |
85 | * Get the header in order to get signature and table size | 98 | |
86 | */ | ||
87 | status = acpi_tb_get_table_header (address, &header); | 99 | status = acpi_tb_get_table_header (address, &header); |
88 | if (ACPI_FAILURE (status)) { | 100 | if (ACPI_FAILURE (status)) { |
89 | return_ACPI_STATUS (status); | 101 | return_ACPI_STATUS (status); |
@@ -130,7 +142,7 @@ acpi_tb_get_primary_table ( | |||
130 | * | 142 | * |
131 | ******************************************************************************/ | 143 | ******************************************************************************/ |
132 | 144 | ||
133 | acpi_status | 145 | static acpi_status |
134 | acpi_tb_get_secondary_table ( | 146 | acpi_tb_get_secondary_table ( |
135 | struct acpi_pointer *address, | 147 | struct acpi_pointer *address, |
136 | acpi_string signature, | 148 | acpi_string signature, |
@@ -153,7 +165,8 @@ acpi_tb_get_secondary_table ( | |||
153 | /* Signature must match request */ | 165 | /* Signature must match request */ |
154 | 166 | ||
155 | if (ACPI_STRNCMP (header.signature, signature, ACPI_NAME_SIZE)) { | 167 | if (ACPI_STRNCMP (header.signature, signature, ACPI_NAME_SIZE)) { |
156 | ACPI_REPORT_ERROR (("Incorrect table signature - wanted [%s] found [%4.4s]\n", | 168 | ACPI_REPORT_ERROR (( |
169 | "Incorrect table signature - wanted [%s] found [%4.4s]\n", | ||
157 | signature, header.signature)); | 170 | signature, header.signature)); |
158 | return_ACPI_STATUS (AE_BAD_SIGNATURE); | 171 | return_ACPI_STATUS (AE_BAD_SIGNATURE); |
159 | } | 172 | } |
@@ -230,7 +243,8 @@ acpi_tb_get_required_tables ( | |||
230 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { | 243 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { |
231 | /* Get the table address from the common internal XSDT */ | 244 | /* Get the table address from the common internal XSDT */ |
232 | 245 | ||
233 | address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i]; | 246 | address.pointer.value = |
247 | acpi_gbl_XSDT->table_offset_entry[i]; | ||
234 | 248 | ||
235 | /* | 249 | /* |
236 | * Get the tables needed by this subsystem (FADT and any SSDTs). | 250 | * Get the tables needed by this subsystem (FADT and any SSDTs). |
@@ -252,18 +266,18 @@ acpi_tb_get_required_tables ( | |||
252 | } | 266 | } |
253 | 267 | ||
254 | /* | 268 | /* |
255 | * Convert the FADT to a common format. This allows earlier revisions of the | 269 | * Convert the FADT to a common format. This allows earlier revisions of |
256 | * table to coexist with newer versions, using common access code. | 270 | * the table to coexist with newer versions, using common access code. |
257 | */ | 271 | */ |
258 | status = acpi_tb_convert_table_fadt (); | 272 | status = acpi_tb_convert_table_fadt (); |
259 | if (ACPI_FAILURE (status)) { | 273 | if (ACPI_FAILURE (status)) { |
260 | ACPI_REPORT_ERROR (("Could not convert FADT to internal common format\n")); | 274 | ACPI_REPORT_ERROR (( |
275 | "Could not convert FADT to internal common format\n")); | ||
261 | return_ACPI_STATUS (status); | 276 | return_ACPI_STATUS (status); |
262 | } | 277 | } |
263 | 278 | ||
264 | /* | 279 | /* Get the FACS (Pointed to by the FADT) */ |
265 | * Get the FACS (Pointed to by the FADT) | 280 | |
266 | */ | ||
267 | address.pointer.value = acpi_gbl_FADT->xfirmware_ctrl; | 281 | address.pointer.value = acpi_gbl_FADT->xfirmware_ctrl; |
268 | 282 | ||
269 | status = acpi_tb_get_secondary_table (&address, FACS_SIG, &table_info); | 283 | status = acpi_tb_get_secondary_table (&address, FACS_SIG, &table_info); |
@@ -282,9 +296,8 @@ acpi_tb_get_required_tables ( | |||
282 | return_ACPI_STATUS (status); | 296 | return_ACPI_STATUS (status); |
283 | } | 297 | } |
284 | 298 | ||
285 | /* | 299 | /* Get/install the DSDT (Pointed to by the FADT) */ |
286 | * Get/install the DSDT (Pointed to by the FADT) | 300 | |
287 | */ | ||
288 | address.pointer.value = acpi_gbl_FADT->Xdsdt; | 301 | address.pointer.value = acpi_gbl_FADT->Xdsdt; |
289 | 302 | ||
290 | status = acpi_tb_get_secondary_table (&address, DSDT_SIG, &table_info); | 303 | status = acpi_tb_get_secondary_table (&address, DSDT_SIG, &table_info); |
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index 85d5bb01022c..629b64c8193d 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c | |||
@@ -49,6 +49,14 @@ | |||
49 | #define _COMPONENT ACPI_TABLES | 49 | #define _COMPONENT ACPI_TABLES |
50 | ACPI_MODULE_NAME ("tbinstal") | 50 | ACPI_MODULE_NAME ("tbinstal") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static acpi_status | ||
55 | acpi_tb_match_signature ( | ||
56 | char *signature, | ||
57 | struct acpi_table_desc *table_info, | ||
58 | u8 search_type); | ||
59 | |||
52 | 60 | ||
53 | /******************************************************************************* | 61 | /******************************************************************************* |
54 | * | 62 | * |
@@ -56,6 +64,7 @@ | |||
56 | * | 64 | * |
57 | * PARAMETERS: Signature - Table signature to match | 65 | * PARAMETERS: Signature - Table signature to match |
58 | * table_info - Return data | 66 | * table_info - Return data |
67 | * search_type - Table type to match (primary/secondary) | ||
59 | * | 68 | * |
60 | * RETURN: Status | 69 | * RETURN: Status |
61 | * | 70 | * |
@@ -64,7 +73,7 @@ | |||
64 | * | 73 | * |
65 | ******************************************************************************/ | 74 | ******************************************************************************/ |
66 | 75 | ||
67 | acpi_status | 76 | static acpi_status |
68 | acpi_tb_match_signature ( | 77 | acpi_tb_match_signature ( |
69 | char *signature, | 78 | char *signature, |
70 | struct acpi_table_desc *table_info, | 79 | struct acpi_table_desc *table_info, |
@@ -76,9 +85,8 @@ acpi_tb_match_signature ( | |||
76 | ACPI_FUNCTION_TRACE ("tb_match_signature"); | 85 | ACPI_FUNCTION_TRACE ("tb_match_signature"); |
77 | 86 | ||
78 | 87 | ||
79 | /* | 88 | /* Search for a signature match among the known table types */ |
80 | * Search for a signature match among the known table types | 89 | |
81 | */ | ||
82 | for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { | 90 | for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { |
83 | if (!(acpi_gbl_table_data[i].flags & search_type)) { | 91 | if (!(acpi_gbl_table_data[i].flags & search_type)) { |
84 | continue; | 92 | continue; |
@@ -161,6 +169,7 @@ acpi_tb_install_table ( | |||
161 | * FUNCTION: acpi_tb_recognize_table | 169 | * FUNCTION: acpi_tb_recognize_table |
162 | * | 170 | * |
163 | * PARAMETERS: table_info - Return value from acpi_tb_get_table_body | 171 | * PARAMETERS: table_info - Return value from acpi_tb_get_table_body |
172 | * search_type - Table type to match (primary/secondary) | ||
164 | * | 173 | * |
165 | * RETURN: Status | 174 | * RETURN: Status |
166 | * | 175 | * |
@@ -203,7 +212,8 @@ acpi_tb_recognize_table ( | |||
203 | * This can be any one of many valid ACPI tables, it just isn't one of | 212 | * This can be any one of many valid ACPI tables, it just isn't one of |
204 | * the tables that is consumed by the core subsystem | 213 | * the tables that is consumed by the core subsystem |
205 | */ | 214 | */ |
206 | status = acpi_tb_match_signature (table_header->signature, table_info, search_type); | 215 | status = acpi_tb_match_signature (table_header->signature, |
216 | table_info, search_type); | ||
207 | if (ACPI_FAILURE (status)) { | 217 | if (ACPI_FAILURE (status)) { |
208 | return_ACPI_STATUS (status); | 218 | return_ACPI_STATUS (status); |
209 | } | 219 | } |
@@ -253,9 +263,8 @@ acpi_tb_init_table_descriptor ( | |||
253 | return_ACPI_STATUS (AE_NO_MEMORY); | 263 | return_ACPI_STATUS (AE_NO_MEMORY); |
254 | } | 264 | } |
255 | 265 | ||
256 | /* | 266 | /* Install the table into the global data structure */ |
257 | * Install the table into the global data structure | 267 | |
258 | */ | ||
259 | list_head = &acpi_gbl_table_lists[table_type]; | 268 | list_head = &acpi_gbl_table_lists[table_type]; |
260 | 269 | ||
261 | /* | 270 | /* |
@@ -316,7 +325,8 @@ acpi_tb_init_table_descriptor ( | |||
316 | table_desc->aml_start = (u8 *) (table_desc->pointer + 1), | 325 | table_desc->aml_start = (u8 *) (table_desc->pointer + 1), |
317 | table_desc->aml_length = (u32) (table_desc->length - | 326 | table_desc->aml_length = (u32) (table_desc->length - |
318 | (u32) sizeof (struct acpi_table_header)); | 327 | (u32) sizeof (struct acpi_table_header)); |
319 | table_desc->table_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_TABLE); | 328 | table_desc->table_id = acpi_ut_allocate_owner_id ( |
329 | ACPI_OWNER_TYPE_TABLE); | ||
320 | table_desc->loaded_into_namespace = FALSE; | 330 | table_desc->loaded_into_namespace = FALSE; |
321 | 331 | ||
322 | /* | 332 | /* |
@@ -349,7 +359,8 @@ acpi_tb_init_table_descriptor ( | |||
349 | ******************************************************************************/ | 359 | ******************************************************************************/ |
350 | 360 | ||
351 | void | 361 | void |
352 | acpi_tb_delete_all_tables (void) | 362 | acpi_tb_delete_all_tables ( |
363 | void) | ||
353 | { | 364 | { |
354 | acpi_table_type type; | 365 | acpi_table_type type; |
355 | 366 | ||
diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c index 9c6913238d52..b7ffe39c3626 100644 --- a/drivers/acpi/tables/tbrsdt.c +++ b/drivers/acpi/tables/tbrsdt.c | |||
@@ -84,8 +84,9 @@ acpi_tb_verify_rsdp ( | |||
84 | /* | 84 | /* |
85 | * Obtain access to the RSDP structure | 85 | * Obtain access to the RSDP structure |
86 | */ | 86 | */ |
87 | status = acpi_os_map_memory (address->pointer.physical, sizeof (struct rsdp_descriptor), | 87 | status = acpi_os_map_memory (address->pointer.physical, |
88 | (void *) &rsdp); | 88 | sizeof (struct rsdp_descriptor), |
89 | (void *) &rsdp); | ||
89 | if (ACPI_FAILURE (status)) { | 90 | if (ACPI_FAILURE (status)) { |
90 | return_ACPI_STATUS (status); | 91 | return_ACPI_STATUS (status); |
91 | } | 92 | } |
@@ -154,9 +155,9 @@ cleanup: | |||
154 | * | 155 | * |
155 | * FUNCTION: acpi_tb_get_rsdt_address | 156 | * FUNCTION: acpi_tb_get_rsdt_address |
156 | * | 157 | * |
157 | * PARAMETERS: None | 158 | * PARAMETERS: out_address - Where the address is returned |
158 | * | 159 | * |
159 | * RETURN: RSDT physical address | 160 | * RETURN: None, Address |
160 | * | 161 | * |
161 | * DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the | 162 | * DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the |
162 | * version of the RSDP | 163 | * version of the RSDP |
@@ -181,7 +182,8 @@ acpi_tb_get_rsdt_address ( | |||
181 | out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address; | 182 | out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address; |
182 | } | 183 | } |
183 | else { | 184 | else { |
184 | out_address->pointer.value = acpi_gbl_RSDP->xsdt_physical_address; | 185 | out_address->pointer.value = |
186 | acpi_gbl_RSDP->xsdt_physical_address; | ||
185 | } | 187 | } |
186 | } | 188 | } |
187 | 189 | ||
@@ -224,7 +226,8 @@ acpi_tb_validate_rsdt ( | |||
224 | if (no_match) { | 226 | if (no_match) { |
225 | /* Invalid RSDT or XSDT signature */ | 227 | /* Invalid RSDT or XSDT signature */ |
226 | 228 | ||
227 | ACPI_REPORT_ERROR (("Invalid signature where RSDP indicates RSDT/XSDT should be located\n")); | 229 | ACPI_REPORT_ERROR (( |
230 | "Invalid signature where RSDP indicates RSDT/XSDT should be located\n")); | ||
228 | 231 | ||
229 | ACPI_DUMP_BUFFER (acpi_gbl_RSDP, 20); | 232 | ACPI_DUMP_BUFFER (acpi_gbl_RSDP, 20); |
230 | 233 | ||
@@ -282,6 +285,7 @@ acpi_tb_get_table_rsdt ( | |||
282 | if (ACPI_FAILURE (status)) { | 285 | if (ACPI_FAILURE (status)) { |
283 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT/XSDT, %s\n", | 286 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT/XSDT, %s\n", |
284 | acpi_format_exception (status))); | 287 | acpi_format_exception (status))); |
288 | |||
285 | return_ACPI_STATUS (status); | 289 | return_ACPI_STATUS (status); |
286 | } | 290 | } |
287 | 291 | ||
@@ -299,7 +303,8 @@ acpi_tb_get_table_rsdt ( | |||
299 | 303 | ||
300 | /* Get the number of tables defined in the RSDT or XSDT */ | 304 | /* Get the number of tables defined in the RSDT or XSDT */ |
301 | 305 | ||
302 | acpi_gbl_rsdt_table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, table_info.pointer); | 306 | acpi_gbl_rsdt_table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, |
307 | table_info.pointer); | ||
303 | 308 | ||
304 | /* Convert and/or copy to an XSDT structure */ | 309 | /* Convert and/or copy to an XSDT structure */ |
305 | 310 | ||
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index fede5804c783..e69d01d443d2 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c | |||
@@ -49,48 +49,14 @@ | |||
49 | #define _COMPONENT ACPI_TABLES | 49 | #define _COMPONENT ACPI_TABLES |
50 | ACPI_MODULE_NAME ("tbutils") | 50 | ACPI_MODULE_NAME ("tbutils") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
52 | 53 | ||
53 | /******************************************************************************* | 54 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
54 | * | ||
55 | * FUNCTION: acpi_tb_handle_to_object | ||
56 | * | ||
57 | * PARAMETERS: table_id - Id for which the function is searching | ||
58 | * table_desc - Pointer to return the matching table | ||
59 | * descriptor. | ||
60 | * | ||
61 | * RETURN: Search the tables to find one with a matching table_id and | ||
62 | * return a pointer to that table descriptor. | ||
63 | * | ||
64 | ******************************************************************************/ | ||
65 | #ifdef ACPI_FUTURE_USAGE | ||
66 | acpi_status | 55 | acpi_status |
67 | acpi_tb_handle_to_object ( | 56 | acpi_tb_handle_to_object ( |
68 | u16 table_id, | 57 | u16 table_id, |
69 | struct acpi_table_desc **return_table_desc) | 58 | struct acpi_table_desc **table_desc); |
70 | { | 59 | #endif |
71 | u32 i; | ||
72 | struct acpi_table_desc *table_desc; | ||
73 | |||
74 | |||
75 | ACPI_FUNCTION_NAME ("tb_handle_to_object"); | ||
76 | |||
77 | |||
78 | for (i = 0; i < ACPI_TABLE_MAX; i++) { | ||
79 | table_desc = acpi_gbl_table_lists[i].next; | ||
80 | while (table_desc) { | ||
81 | if (table_desc->table_id == table_id) { | ||
82 | *return_table_desc = table_desc; | ||
83 | return (AE_OK); | ||
84 | } | ||
85 | |||
86 | table_desc = table_desc->next; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "table_id=%X does not exist\n", table_id)); | ||
91 | return (AE_BAD_PARAMETER); | ||
92 | } | ||
93 | #endif /* ACPI_FUTURE_USAGE */ | ||
94 | 60 | ||
95 | 61 | ||
96 | /******************************************************************************* | 62 | /******************************************************************************* |
@@ -128,6 +94,7 @@ acpi_tb_validate_table_header ( | |||
128 | if (!acpi_os_readable (table_header, sizeof (struct acpi_table_header))) { | 94 | if (!acpi_os_readable (table_header, sizeof (struct acpi_table_header))) { |
129 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 95 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
130 | "Cannot read table header at %p\n", table_header)); | 96 | "Cannot read table header at %p\n", table_header)); |
97 | |||
131 | return (AE_BAD_ADDRESS); | 98 | return (AE_BAD_ADDRESS); |
132 | } | 99 | } |
133 | 100 | ||
@@ -141,6 +108,7 @@ acpi_tb_validate_table_header ( | |||
141 | 108 | ||
142 | ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n", | 109 | ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n", |
143 | (char *) &signature)); | 110 | (char *) &signature)); |
111 | |||
144 | ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); | 112 | ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); |
145 | return (AE_BAD_SIGNATURE); | 113 | return (AE_BAD_SIGNATURE); |
146 | } | 114 | } |
@@ -154,6 +122,7 @@ acpi_tb_validate_table_header ( | |||
154 | 122 | ||
155 | ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n", | 123 | ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n", |
156 | (u32) table_header->length)); | 124 | (u32) table_header->length)); |
125 | |||
157 | ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); | 126 | ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); |
158 | return (AE_BAD_HEADER); | 127 | return (AE_BAD_HEADER); |
159 | } | 128 | } |
@@ -193,8 +162,10 @@ acpi_tb_verify_table_checksum ( | |||
193 | /* Return the appropriate exception */ | 162 | /* Return the appropriate exception */ |
194 | 163 | ||
195 | if (checksum) { | 164 | if (checksum) { |
196 | ACPI_REPORT_WARNING (("Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n", | 165 | ACPI_REPORT_WARNING (( |
197 | table_header->signature, (u32) table_header->checksum, (u32) checksum)); | 166 | "Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n", |
167 | table_header->signature, (u32) table_header->checksum, | ||
168 | (u32) checksum)); | ||
198 | 169 | ||
199 | status = AE_BAD_CHECKSUM; | 170 | status = AE_BAD_CHECKSUM; |
200 | } | 171 | } |
@@ -209,7 +180,7 @@ acpi_tb_verify_table_checksum ( | |||
209 | * PARAMETERS: Buffer - Buffer to checksum | 180 | * PARAMETERS: Buffer - Buffer to checksum |
210 | * Length - Size of the buffer | 181 | * Length - Size of the buffer |
211 | * | 182 | * |
212 | * RETURNS 8 bit checksum of buffer | 183 | * RETURN: 8 bit checksum of buffer |
213 | * | 184 | * |
214 | * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it. | 185 | * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it. |
215 | * | 186 | * |
@@ -238,3 +209,47 @@ acpi_tb_checksum ( | |||
238 | } | 209 | } |
239 | 210 | ||
240 | 211 | ||
212 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
213 | /******************************************************************************* | ||
214 | * | ||
215 | * FUNCTION: acpi_tb_handle_to_object | ||
216 | * | ||
217 | * PARAMETERS: table_id - Id for which the function is searching | ||
218 | * table_desc - Pointer to return the matching table | ||
219 | * descriptor. | ||
220 | * | ||
221 | * RETURN: Search the tables to find one with a matching table_id and | ||
222 | * return a pointer to that table descriptor. | ||
223 | * | ||
224 | ******************************************************************************/ | ||
225 | |||
226 | acpi_status | ||
227 | acpi_tb_handle_to_object ( | ||
228 | u16 table_id, | ||
229 | struct acpi_table_desc **return_table_desc) | ||
230 | { | ||
231 | u32 i; | ||
232 | struct acpi_table_desc *table_desc; | ||
233 | |||
234 | |||
235 | ACPI_FUNCTION_NAME ("tb_handle_to_object"); | ||
236 | |||
237 | |||
238 | for (i = 0; i < ACPI_TABLE_MAX; i++) { | ||
239 | table_desc = acpi_gbl_table_lists[i].next; | ||
240 | while (table_desc) { | ||
241 | if (table_desc->table_id == table_id) { | ||
242 | *return_table_desc = table_desc; | ||
243 | return (AE_OK); | ||
244 | } | ||
245 | |||
246 | table_desc = table_desc->next; | ||
247 | } | ||
248 | } | ||
249 | |||
250 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "table_id=%X does not exist\n", table_id)); | ||
251 | return (AE_BAD_PARAMETER); | ||
252 | } | ||
253 | #endif | ||
254 | |||
255 | |||
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index 7715043461c4..0c0b9085dbeb 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c | |||
@@ -67,7 +67,8 @@ | |||
67 | ******************************************************************************/ | 67 | ******************************************************************************/ |
68 | 68 | ||
69 | acpi_status | 69 | acpi_status |
70 | acpi_load_tables (void) | 70 | acpi_load_tables ( |
71 | void) | ||
71 | { | 72 | { |
72 | struct acpi_pointer rsdp_address; | 73 | struct acpi_pointer rsdp_address; |
73 | acpi_status status; | 74 | acpi_status status; |
@@ -82,7 +83,7 @@ acpi_load_tables (void) | |||
82 | &rsdp_address); | 83 | &rsdp_address); |
83 | if (ACPI_FAILURE (status)) { | 84 | if (ACPI_FAILURE (status)) { |
84 | ACPI_REPORT_ERROR (("acpi_load_tables: Could not get RSDP, %s\n", | 85 | ACPI_REPORT_ERROR (("acpi_load_tables: Could not get RSDP, %s\n", |
85 | acpi_format_exception (status))); | 86 | acpi_format_exception (status))); |
86 | goto error_exit; | 87 | goto error_exit; |
87 | } | 88 | } |
88 | 89 | ||
@@ -93,7 +94,7 @@ acpi_load_tables (void) | |||
93 | status = acpi_tb_verify_rsdp (&rsdp_address); | 94 | status = acpi_tb_verify_rsdp (&rsdp_address); |
94 | if (ACPI_FAILURE (status)) { | 95 | if (ACPI_FAILURE (status)) { |
95 | ACPI_REPORT_ERROR (("acpi_load_tables: RSDP Failed validation: %s\n", | 96 | ACPI_REPORT_ERROR (("acpi_load_tables: RSDP Failed validation: %s\n", |
96 | acpi_format_exception (status))); | 97 | acpi_format_exception (status))); |
97 | goto error_exit; | 98 | goto error_exit; |
98 | } | 99 | } |
99 | 100 | ||
@@ -102,7 +103,7 @@ acpi_load_tables (void) | |||
102 | status = acpi_tb_get_table_rsdt (); | 103 | status = acpi_tb_get_table_rsdt (); |
103 | if (ACPI_FAILURE (status)) { | 104 | if (ACPI_FAILURE (status)) { |
104 | ACPI_REPORT_ERROR (("acpi_load_tables: Could not load RSDT: %s\n", | 105 | ACPI_REPORT_ERROR (("acpi_load_tables: Could not load RSDT: %s\n", |
105 | acpi_format_exception (status))); | 106 | acpi_format_exception (status))); |
106 | goto error_exit; | 107 | goto error_exit; |
107 | } | 108 | } |
108 | 109 | ||
@@ -110,20 +111,20 @@ acpi_load_tables (void) | |||
110 | 111 | ||
111 | status = acpi_tb_get_required_tables (); | 112 | status = acpi_tb_get_required_tables (); |
112 | if (ACPI_FAILURE (status)) { | 113 | if (ACPI_FAILURE (status)) { |
113 | ACPI_REPORT_ERROR (("acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n", | 114 | ACPI_REPORT_ERROR (( |
114 | acpi_format_exception (status))); | 115 | "acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n", |
116 | acpi_format_exception (status))); | ||
115 | goto error_exit; | 117 | goto error_exit; |
116 | } | 118 | } |
117 | 119 | ||
118 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); | 120 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); |
119 | 121 | ||
120 | |||
121 | /* Load the namespace from the tables */ | 122 | /* Load the namespace from the tables */ |
122 | 123 | ||
123 | status = acpi_ns_load_namespace (); | 124 | status = acpi_ns_load_namespace (); |
124 | if (ACPI_FAILURE (status)) { | 125 | if (ACPI_FAILURE (status)) { |
125 | ACPI_REPORT_ERROR (("acpi_load_tables: Could not load namespace: %s\n", | 126 | ACPI_REPORT_ERROR (("acpi_load_tables: Could not load namespace: %s\n", |
126 | acpi_format_exception (status))); | 127 | acpi_format_exception (status))); |
127 | goto error_exit; | 128 | goto error_exit; |
128 | } | 129 | } |
129 | 130 | ||
@@ -139,7 +140,6 @@ error_exit: | |||
139 | 140 | ||
140 | 141 | ||
141 | #ifdef ACPI_FUTURE_USAGE | 142 | #ifdef ACPI_FUTURE_USAGE |
142 | |||
143 | /******************************************************************************* | 143 | /******************************************************************************* |
144 | * | 144 | * |
145 | * FUNCTION: acpi_load_table | 145 | * FUNCTION: acpi_load_table |
@@ -250,7 +250,6 @@ acpi_unload_table ( | |||
250 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 250 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
251 | } | 251 | } |
252 | 252 | ||
253 | |||
254 | /* Find all tables of the requested type */ | 253 | /* Find all tables of the requested type */ |
255 | 254 | ||
256 | table_desc = acpi_gbl_table_lists[table_type].next; | 255 | table_desc = acpi_gbl_table_lists[table_type].next; |
@@ -321,7 +320,6 @@ acpi_get_table_header ( | |||
321 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 320 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
322 | } | 321 | } |
323 | 322 | ||
324 | |||
325 | /* Get a pointer to the entire table */ | 323 | /* Get a pointer to the entire table */ |
326 | 324 | ||
327 | status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); | 325 | status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); |
@@ -329,23 +327,20 @@ acpi_get_table_header ( | |||
329 | return_ACPI_STATUS (status); | 327 | return_ACPI_STATUS (status); |
330 | } | 328 | } |
331 | 329 | ||
332 | /* | 330 | /* The function will return a NULL pointer if the table is not loaded */ |
333 | * The function will return a NULL pointer if the table is not loaded | 331 | |
334 | */ | ||
335 | if (tbl_ptr == NULL) { | 332 | if (tbl_ptr == NULL) { |
336 | return_ACPI_STATUS (AE_NOT_EXIST); | 333 | return_ACPI_STATUS (AE_NOT_EXIST); |
337 | } | 334 | } |
338 | 335 | ||
339 | /* | 336 | /* Copy the header to the caller's buffer */ |
340 | * Copy the header to the caller's buffer | 337 | |
341 | */ | ||
342 | ACPI_MEMCPY ((void *) out_table_header, (void *) tbl_ptr, | 338 | ACPI_MEMCPY ((void *) out_table_header, (void *) tbl_ptr, |
343 | sizeof (struct acpi_table_header)); | 339 | sizeof (struct acpi_table_header)); |
344 | 340 | ||
345 | return_ACPI_STATUS (status); | 341 | return_ACPI_STATUS (status); |
346 | } | 342 | } |
347 | 343 | ||
348 | |||
349 | #endif /* ACPI_FUTURE_USAGE */ | 344 | #endif /* ACPI_FUTURE_USAGE */ |
350 | 345 | ||
351 | /******************************************************************************* | 346 | /******************************************************************************* |
@@ -404,7 +399,6 @@ acpi_get_table ( | |||
404 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 399 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
405 | } | 400 | } |
406 | 401 | ||
407 | |||
408 | /* Get a pointer to the entire table */ | 402 | /* Get a pointer to the entire table */ |
409 | 403 | ||
410 | status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); | 404 | status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); |
@@ -423,9 +417,8 @@ acpi_get_table ( | |||
423 | /* Get the table length */ | 417 | /* Get the table length */ |
424 | 418 | ||
425 | if (table_type == ACPI_TABLE_RSDP) { | 419 | if (table_type == ACPI_TABLE_RSDP) { |
426 | /* | 420 | /* RSD PTR is the only "table" without a header */ |
427 | * RSD PTR is the only "table" without a header | 421 | |
428 | */ | ||
429 | table_length = sizeof (struct rsdp_descriptor); | 422 | table_length = sizeof (struct rsdp_descriptor); |
430 | } | 423 | } |
431 | else { | 424 | else { |
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index 6e8072ebbac6..dc3c3f6a9f62 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c | |||
@@ -50,6 +50,18 @@ | |||
50 | #define _COMPONENT ACPI_TABLES | 50 | #define _COMPONENT ACPI_TABLES |
51 | ACPI_MODULE_NAME ("tbxfroot") | 51 | ACPI_MODULE_NAME ("tbxfroot") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
54 | |||
55 | static acpi_status | ||
56 | acpi_tb_find_rsdp ( | ||
57 | struct acpi_table_desc *table_info, | ||
58 | u32 flags); | ||
59 | |||
60 | static u8 * | ||
61 | acpi_tb_scan_memory_for_rsdp ( | ||
62 | u8 *start_address, | ||
63 | u32 length); | ||
64 | |||
53 | 65 | ||
54 | /******************************************************************************* | 66 | /******************************************************************************* |
55 | * | 67 | * |
@@ -57,7 +69,8 @@ | |||
57 | * | 69 | * |
58 | * PARAMETERS: Signature - String with ACPI table signature | 70 | * PARAMETERS: Signature - String with ACPI table signature |
59 | * oem_id - String with the table OEM ID | 71 | * oem_id - String with the table OEM ID |
60 | * oem_table_id - String with the OEM Table ID. | 72 | * oem_table_id - String with the OEM Table ID |
73 | * table_ptr - Where the table pointer is returned | ||
61 | * | 74 | * |
62 | * RETURN: Status | 75 | * RETURN: Status |
63 | * | 76 | * |
@@ -99,14 +112,13 @@ acpi_tb_find_table ( | |||
99 | if (!acpi_gbl_DSDT) { | 112 | if (!acpi_gbl_DSDT) { |
100 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); | 113 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); |
101 | } | 114 | } |
102 | |||
103 | table = acpi_gbl_DSDT; | 115 | table = acpi_gbl_DSDT; |
104 | } | 116 | } |
105 | else { | 117 | else { |
106 | /* Find the table */ | 118 | /* Find the table */ |
107 | 119 | ||
108 | status = acpi_get_firmware_table (signature, 1, | 120 | status = acpi_get_firmware_table (signature, 1, |
109 | ACPI_LOGICAL_ADDRESSING, &table); | 121 | ACPI_LOGICAL_ADDRESSING, &table); |
110 | if (ACPI_FAILURE (status)) { | 122 | if (ACPI_FAILURE (status)) { |
111 | return_ACPI_STATUS (status); | 123 | return_ACPI_STATUS (status); |
112 | } | 124 | } |
@@ -114,14 +126,19 @@ acpi_tb_find_table ( | |||
114 | 126 | ||
115 | /* Check oem_id and oem_table_id */ | 127 | /* Check oem_id and oem_table_id */ |
116 | 128 | ||
117 | if ((oem_id[0] && ACPI_STRNCMP ( | 129 | if ((oem_id[0] && ACPI_STRNCMP ( |
118 | oem_id, table->oem_id, sizeof (table->oem_id))) || | 130 | oem_id, table->oem_id, |
131 | sizeof (table->oem_id))) || | ||
132 | |||
119 | (oem_table_id[0] && ACPI_STRNCMP ( | 133 | (oem_table_id[0] && ACPI_STRNCMP ( |
120 | oem_table_id, table->oem_table_id, sizeof (table->oem_table_id)))) { | 134 | oem_table_id, table->oem_table_id, |
135 | sizeof (table->oem_table_id)))) { | ||
121 | return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND); | 136 | return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND); |
122 | } | 137 | } |
123 | 138 | ||
124 | ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n", table->signature)); | 139 | ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n", |
140 | table->signature)); | ||
141 | |||
125 | *table_ptr = table; | 142 | *table_ptr = table; |
126 | return_ACPI_STATUS (AE_OK); | 143 | return_ACPI_STATUS (AE_OK); |
127 | } | 144 | } |
@@ -191,8 +208,8 @@ acpi_get_firmware_table ( | |||
191 | /* Map and validate the RSDP */ | 208 | /* Map and validate the RSDP */ |
192 | 209 | ||
193 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { | 210 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { |
194 | status = acpi_os_map_memory (address.pointer.physical, sizeof (struct rsdp_descriptor), | 211 | status = acpi_os_map_memory (address.pointer.physical, |
195 | (void *) &acpi_gbl_RSDP); | 212 | sizeof (struct rsdp_descriptor), (void *) &acpi_gbl_RSDP); |
196 | if (ACPI_FAILURE (status)) { | 213 | if (ACPI_FAILURE (status)) { |
197 | return_ACPI_STATUS (status); | 214 | return_ACPI_STATUS (status); |
198 | } | 215 | } |
@@ -203,7 +220,8 @@ acpi_get_firmware_table ( | |||
203 | 220 | ||
204 | /* The signature and checksum must both be correct */ | 221 | /* The signature and checksum must both be correct */ |
205 | 222 | ||
206 | if (ACPI_STRNCMP ((char *) acpi_gbl_RSDP, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { | 223 | if (ACPI_STRNCMP ((char *) acpi_gbl_RSDP, RSDP_SIG, |
224 | sizeof (RSDP_SIG)-1) != 0) { | ||
207 | /* Nope, BAD Signature */ | 225 | /* Nope, BAD Signature */ |
208 | 226 | ||
209 | return_ACPI_STATUS (AE_BAD_SIGNATURE); | 227 | return_ACPI_STATUS (AE_BAD_SIGNATURE); |
@@ -313,7 +331,8 @@ acpi_get_firmware_table ( | |||
313 | 331 | ||
314 | 332 | ||
315 | cleanup: | 333 | cleanup: |
316 | acpi_os_unmap_memory (rsdt_info->pointer, (acpi_size) rsdt_info->pointer->length); | 334 | acpi_os_unmap_memory (rsdt_info->pointer, |
335 | (acpi_size) rsdt_info->pointer->length); | ||
317 | ACPI_MEM_FREE (rsdt_info); | 336 | ACPI_MEM_FREE (rsdt_info); |
318 | 337 | ||
319 | if (header) { | 338 | if (header) { |
@@ -335,8 +354,8 @@ EXPORT_SYMBOL(acpi_get_firmware_table); | |||
335 | * | 354 | * |
336 | * FUNCTION: acpi_find_root_pointer | 355 | * FUNCTION: acpi_find_root_pointer |
337 | * | 356 | * |
338 | * PARAMETERS: **rsdp_address - Where to place the RSDP address | 357 | * PARAMETERS: Flags - Logical/Physical addressing |
339 | * Flags - Logical/Physical addressing | 358 | * rsdp_address - Where to place the RSDP address |
340 | * | 359 | * |
341 | * RETURN: Status, Physical address of the RSDP | 360 | * RETURN: Status, Physical address of the RSDP |
342 | * | 361 | * |
@@ -363,6 +382,7 @@ acpi_find_root_pointer ( | |||
363 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 382 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
364 | "RSDP structure not found, %s Flags=%X\n", | 383 | "RSDP structure not found, %s Flags=%X\n", |
365 | acpi_format_exception (status), flags)); | 384 | acpi_format_exception (status), flags)); |
385 | |||
366 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); | 386 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); |
367 | } | 387 | } |
368 | 388 | ||
@@ -385,7 +405,7 @@ acpi_find_root_pointer ( | |||
385 | * | 405 | * |
386 | ******************************************************************************/ | 406 | ******************************************************************************/ |
387 | 407 | ||
388 | u8 * | 408 | static u8 * |
389 | acpi_tb_scan_memory_for_rsdp ( | 409 | acpi_tb_scan_memory_for_rsdp ( |
390 | u8 *start_address, | 410 | u8 *start_address, |
391 | u32 length) | 411 | u32 length) |
@@ -406,7 +426,8 @@ acpi_tb_scan_memory_for_rsdp ( | |||
406 | mem_rover += ACPI_RSDP_SCAN_STEP) { | 426 | mem_rover += ACPI_RSDP_SCAN_STEP) { |
407 | /* The signature and checksum must both be correct */ | 427 | /* The signature and checksum must both be correct */ |
408 | 428 | ||
409 | if (ACPI_STRNCMP ((char *) mem_rover, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { | 429 | if (ACPI_STRNCMP ((char *) mem_rover, |
430 | RSDP_SIG, sizeof (RSDP_SIG) - 1) != 0) { | ||
410 | /* No signature match, keep looking */ | 431 | /* No signature match, keep looking */ |
411 | 432 | ||
412 | continue; | 433 | continue; |
@@ -450,7 +471,7 @@ acpi_tb_scan_memory_for_rsdp ( | |||
450 | * | 471 | * |
451 | * FUNCTION: acpi_tb_find_rsdp | 472 | * FUNCTION: acpi_tb_find_rsdp |
452 | * | 473 | * |
453 | * PARAMETERS: *table_info - Where the table info is returned | 474 | * PARAMETERS: table_info - Where the table info is returned |
454 | * Flags - Current memory mode (logical vs. | 475 | * Flags - Current memory mode (logical vs. |
455 | * physical addressing) | 476 | * physical addressing) |
456 | * | 477 | * |
@@ -468,7 +489,7 @@ acpi_tb_scan_memory_for_rsdp ( | |||
468 | * | 489 | * |
469 | ******************************************************************************/ | 490 | ******************************************************************************/ |
470 | 491 | ||
471 | acpi_status | 492 | static acpi_status |
472 | acpi_tb_find_rsdp ( | 493 | acpi_tb_find_rsdp ( |
473 | struct acpi_table_desc *table_info, | 494 | struct acpi_table_desc *table_info, |
474 | u32 flags) | 495 | u32 flags) |
@@ -483,43 +504,49 @@ acpi_tb_find_rsdp ( | |||
483 | 504 | ||
484 | 505 | ||
485 | /* | 506 | /* |
486 | * Scan supports either 1) Logical addressing or 2) Physical addressing | 507 | * Scan supports either logical addressing or physical addressing |
487 | */ | 508 | */ |
488 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { | 509 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { |
489 | /* | 510 | /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ |
490 | * 1a) Get the location of the EBDA | 511 | |
491 | */ | 512 | status = acpi_os_map_memory ( |
492 | status = acpi_os_map_memory ((acpi_physical_address) ACPI_EBDA_PTR_LOCATION, | 513 | (acpi_physical_address) ACPI_EBDA_PTR_LOCATION, |
493 | ACPI_EBDA_PTR_LENGTH, | 514 | ACPI_EBDA_PTR_LENGTH, (void *) &table_ptr); |
494 | (void *) &table_ptr); | ||
495 | if (ACPI_FAILURE (status)) { | 515 | if (ACPI_FAILURE (status)) { |
496 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 516 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
497 | "Could not map memory at %8.8X for length %X\n", | 517 | "Could not map memory at %8.8X for length %X\n", |
498 | ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); | 518 | ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); |
519 | |||
499 | return_ACPI_STATUS (status); | 520 | return_ACPI_STATUS (status); |
500 | } | 521 | } |
501 | 522 | ||
502 | ACPI_MOVE_16_TO_32 (&physical_address, table_ptr); | 523 | ACPI_MOVE_16_TO_32 (&physical_address, table_ptr); |
503 | physical_address <<= 4; /* Convert segment to physical address */ | 524 | |
525 | /* Convert segment part to physical address */ | ||
526 | |||
527 | physical_address <<= 4; | ||
504 | acpi_os_unmap_memory (table_ptr, ACPI_EBDA_PTR_LENGTH); | 528 | acpi_os_unmap_memory (table_ptr, ACPI_EBDA_PTR_LENGTH); |
505 | 529 | ||
506 | /* EBDA present? */ | 530 | /* EBDA present? */ |
507 | 531 | ||
508 | if (physical_address > 0x400) { | 532 | if (physical_address > 0x400) { |
509 | /* | 533 | /* |
510 | * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of 1_k length) | 534 | * 1b) Search EBDA paragraphs (EBDa is required to be a |
535 | * minimum of 1_k length) | ||
511 | */ | 536 | */ |
512 | status = acpi_os_map_memory ((acpi_physical_address) physical_address, | 537 | status = acpi_os_map_memory ( |
513 | ACPI_EBDA_WINDOW_SIZE, | 538 | (acpi_physical_address) physical_address, |
514 | (void *) &table_ptr); | 539 | ACPI_EBDA_WINDOW_SIZE, (void *) &table_ptr); |
515 | if (ACPI_FAILURE (status)) { | 540 | if (ACPI_FAILURE (status)) { |
516 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 541 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
517 | "Could not map memory at %8.8X for length %X\n", | 542 | "Could not map memory at %8.8X for length %X\n", |
518 | physical_address, ACPI_EBDA_WINDOW_SIZE)); | 543 | physical_address, ACPI_EBDA_WINDOW_SIZE)); |
544 | |||
519 | return_ACPI_STATUS (status); | 545 | return_ACPI_STATUS (status); |
520 | } | 546 | } |
521 | 547 | ||
522 | mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, ACPI_EBDA_WINDOW_SIZE); | 548 | mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, |
549 | ACPI_EBDA_WINDOW_SIZE); | ||
523 | acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE); | 550 | acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE); |
524 | 551 | ||
525 | if (mem_rover) { | 552 | if (mem_rover) { |
@@ -527,7 +554,8 @@ acpi_tb_find_rsdp ( | |||
527 | 554 | ||
528 | physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr); | 555 | physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr); |
529 | 556 | ||
530 | table_info->physical_address = (acpi_physical_address) physical_address; | 557 | table_info->physical_address = |
558 | (acpi_physical_address) physical_address; | ||
531 | return_ACPI_STATUS (AE_OK); | 559 | return_ACPI_STATUS (AE_OK); |
532 | } | 560 | } |
533 | } | 561 | } |
@@ -535,13 +563,15 @@ acpi_tb_find_rsdp ( | |||
535 | /* | 563 | /* |
536 | * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh | 564 | * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh |
537 | */ | 565 | */ |
538 | status = acpi_os_map_memory ((acpi_physical_address) ACPI_HI_RSDP_WINDOW_BASE, | 566 | status = acpi_os_map_memory ( |
539 | ACPI_HI_RSDP_WINDOW_SIZE, | 567 | (acpi_physical_address) ACPI_HI_RSDP_WINDOW_BASE, |
540 | (void *) &table_ptr); | 568 | ACPI_HI_RSDP_WINDOW_SIZE, (void *) &table_ptr); |
569 | |||
541 | if (ACPI_FAILURE (status)) { | 570 | if (ACPI_FAILURE (status)) { |
542 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 571 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
543 | "Could not map memory at %8.8X for length %X\n", | 572 | "Could not map memory at %8.8X for length %X\n", |
544 | ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); | 573 | ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); |
574 | |||
545 | return_ACPI_STATUS (status); | 575 | return_ACPI_STATUS (status); |
546 | } | 576 | } |
547 | 577 | ||
@@ -551,9 +581,11 @@ acpi_tb_find_rsdp ( | |||
551 | if (mem_rover) { | 581 | if (mem_rover) { |
552 | /* Found it, return the physical address */ | 582 | /* Found it, return the physical address */ |
553 | 583 | ||
554 | physical_address = ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr); | 584 | physical_address = |
585 | ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr); | ||
555 | 586 | ||
556 | table_info->physical_address = (acpi_physical_address) physical_address; | 587 | table_info->physical_address = |
588 | (acpi_physical_address) physical_address; | ||
557 | return_ACPI_STATUS (AE_OK); | 589 | return_ACPI_STATUS (AE_OK); |
558 | } | 590 | } |
559 | } | 591 | } |
@@ -562,9 +594,8 @@ acpi_tb_find_rsdp ( | |||
562 | * Physical addressing | 594 | * Physical addressing |
563 | */ | 595 | */ |
564 | else { | 596 | else { |
565 | /* | 597 | /* 1a) Get the location of the EBDA */ |
566 | * 1a) Get the location of the EBDA | 598 | |
567 | */ | ||
568 | ACPI_MOVE_16_TO_32 (&physical_address, ACPI_EBDA_PTR_LOCATION); | 599 | ACPI_MOVE_16_TO_32 (&physical_address, ACPI_EBDA_PTR_LOCATION); |
569 | physical_address <<= 4; /* Convert segment to physical address */ | 600 | physical_address <<= 4; /* Convert segment to physical address */ |
570 | 601 | ||
@@ -572,9 +603,11 @@ acpi_tb_find_rsdp ( | |||
572 | 603 | ||
573 | if (physical_address > 0x400) { | 604 | if (physical_address > 0x400) { |
574 | /* | 605 | /* |
575 | * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of 1_k length) | 606 | * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of |
607 | * 1_k length) | ||
576 | */ | 608 | */ |
577 | mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (physical_address), | 609 | mem_rover = acpi_tb_scan_memory_for_rsdp ( |
610 | ACPI_PHYSADDR_TO_PTR (physical_address), | ||
578 | ACPI_EBDA_WINDOW_SIZE); | 611 | ACPI_EBDA_WINDOW_SIZE); |
579 | if (mem_rover) { | 612 | if (mem_rover) { |
580 | /* Found it, return the physical address */ | 613 | /* Found it, return the physical address */ |
@@ -584,10 +617,10 @@ acpi_tb_find_rsdp ( | |||
584 | } | 617 | } |
585 | } | 618 | } |
586 | 619 | ||
587 | /* | 620 | /* 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */ |
588 | * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh | 621 | |
589 | */ | 622 | mem_rover = acpi_tb_scan_memory_for_rsdp ( |
590 | mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE), | 623 | ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE), |
591 | ACPI_HI_RSDP_WINDOW_SIZE); | 624 | ACPI_HI_RSDP_WINDOW_SIZE); |
592 | if (mem_rover) { | 625 | if (mem_rover) { |
593 | /* Found it, return the physical address */ | 626 | /* Found it, return the physical address */ |
diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c index c84997c9f964..73b1d8aeae9d 100644 --- a/drivers/acpi/toshiba_acpi.c +++ b/drivers/acpi/toshiba_acpi.c | |||
@@ -263,6 +263,9 @@ dispatch_write(struct file* file, const char __user * buffer, | |||
263 | * destination so that sscanf can be used on it safely. | 263 | * destination so that sscanf can be used on it safely. |
264 | */ | 264 | */ |
265 | tmp_buffer = kmalloc(count + 1, GFP_KERNEL); | 265 | tmp_buffer = kmalloc(count + 1, GFP_KERNEL); |
266 | if(!tmp_buffer) | ||
267 | return -ENOMEM; | ||
268 | |||
266 | if (copy_from_user(tmp_buffer, buffer, count)) { | 269 | if (copy_from_user(tmp_buffer, buffer, count)) { |
267 | result = -EFAULT; | 270 | result = -EFAULT; |
268 | } | 271 | } |
@@ -529,6 +532,11 @@ toshiba_acpi_init(void) | |||
529 | 532 | ||
530 | if (acpi_disabled) | 533 | if (acpi_disabled) |
531 | return -ENODEV; | 534 | return -ENODEV; |
535 | |||
536 | if (!acpi_specific_hotkey_enabled){ | ||
537 | printk(MY_INFO "Using generic hotkey driver\n"); | ||
538 | return -ENODEV; | ||
539 | } | ||
532 | /* simple device detection: look for HCI method */ | 540 | /* simple device detection: look for HCI method */ |
533 | if (is_valid_acpi_path(METHOD_HCI_1)) | 541 | if (is_valid_acpi_path(METHOD_HCI_1)) |
534 | method_hci = METHOD_HCI_1; | 542 | method_hci = METHOD_HCI_1; |
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 3313439c4bc7..c4e7f989a2bd 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c | |||
@@ -47,8 +47,35 @@ | |||
47 | #define _COMPONENT ACPI_UTILITIES | 47 | #define _COMPONENT ACPI_UTILITIES |
48 | ACPI_MODULE_NAME ("utalloc") | 48 | ACPI_MODULE_NAME ("utalloc") |
49 | 49 | ||
50 | /* Local prototypes */ | ||
50 | 51 | ||
51 | /****************************************************************************** | 52 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
53 | static struct acpi_debug_mem_block * | ||
54 | acpi_ut_find_allocation ( | ||
55 | u32 list_id, | ||
56 | void *allocation); | ||
57 | |||
58 | static acpi_status | ||
59 | acpi_ut_track_allocation ( | ||
60 | u32 list_id, | ||
61 | struct acpi_debug_mem_block *address, | ||
62 | acpi_size size, | ||
63 | u8 alloc_type, | ||
64 | u32 component, | ||
65 | char *module, | ||
66 | u32 line); | ||
67 | |||
68 | static acpi_status | ||
69 | acpi_ut_remove_allocation ( | ||
70 | u32 list_id, | ||
71 | struct acpi_debug_mem_block *address, | ||
72 | u32 component, | ||
73 | char *module, | ||
74 | u32 line); | ||
75 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ | ||
76 | |||
77 | |||
78 | /******************************************************************************* | ||
52 | * | 79 | * |
53 | * FUNCTION: acpi_ut_release_to_cache | 80 | * FUNCTION: acpi_ut_release_to_cache |
54 | * | 81 | * |
@@ -98,7 +125,8 @@ acpi_ut_release_to_cache ( | |||
98 | 125 | ||
99 | /* Put the object at the head of the cache list */ | 126 | /* Put the object at the head of the cache list */ |
100 | 127 | ||
101 | * (ACPI_CAST_INDIRECT_PTR (char, &(((char *) object)[cache_info->link_offset]))) = cache_info->list_head; | 128 | * (ACPI_CAST_INDIRECT_PTR (char, |
129 | &(((char *) object)[cache_info->link_offset]))) = cache_info->list_head; | ||
102 | cache_info->list_head = object; | 130 | cache_info->list_head = object; |
103 | cache_info->cache_depth++; | 131 | cache_info->cache_depth++; |
104 | 132 | ||
@@ -115,7 +143,7 @@ acpi_ut_release_to_cache ( | |||
115 | } | 143 | } |
116 | 144 | ||
117 | 145 | ||
118 | /****************************************************************************** | 146 | /******************************************************************************* |
119 | * | 147 | * |
120 | * FUNCTION: acpi_ut_acquire_from_cache | 148 | * FUNCTION: acpi_ut_acquire_from_cache |
121 | * | 149 | * |
@@ -156,7 +184,8 @@ acpi_ut_acquire_from_cache ( | |||
156 | /* There is an object available, use it */ | 184 | /* There is an object available, use it */ |
157 | 185 | ||
158 | object = cache_info->list_head; | 186 | object = cache_info->list_head; |
159 | cache_info->list_head = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) object)[cache_info->link_offset]))); | 187 | cache_info->list_head = *(ACPI_CAST_INDIRECT_PTR (char, |
188 | &(((char *) object)[cache_info->link_offset]))); | ||
160 | 189 | ||
161 | ACPI_MEM_TRACKING (cache_info->cache_hits++); | 190 | ACPI_MEM_TRACKING (cache_info->cache_hits++); |
162 | cache_info->cache_depth--; | 191 | cache_info->cache_depth--; |
@@ -201,7 +230,7 @@ acpi_ut_acquire_from_cache ( | |||
201 | 230 | ||
202 | 231 | ||
203 | #ifdef ACPI_ENABLE_OBJECT_CACHE | 232 | #ifdef ACPI_ENABLE_OBJECT_CACHE |
204 | /****************************************************************************** | 233 | /******************************************************************************* |
205 | * | 234 | * |
206 | * FUNCTION: acpi_ut_delete_generic_cache | 235 | * FUNCTION: acpi_ut_delete_generic_cache |
207 | * | 236 | * |
@@ -228,7 +257,8 @@ acpi_ut_delete_generic_cache ( | |||
228 | while (cache_info->list_head) { | 257 | while (cache_info->list_head) { |
229 | /* Delete one cached state object */ | 258 | /* Delete one cached state object */ |
230 | 259 | ||
231 | next = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) cache_info->list_head)[cache_info->link_offset]))); | 260 | next = *(ACPI_CAST_INDIRECT_PTR (char, |
261 | &(((char *) cache_info->list_head)[cache_info->link_offset]))); | ||
232 | ACPI_MEM_FREE (cache_info->list_head); | 262 | ACPI_MEM_FREE (cache_info->list_head); |
233 | 263 | ||
234 | cache_info->list_head = next; | 264 | cache_info->list_head = next; |
@@ -497,8 +527,8 @@ acpi_ut_allocate_and_track ( | |||
497 | acpi_status status; | 527 | acpi_status status; |
498 | 528 | ||
499 | 529 | ||
500 | allocation = acpi_ut_allocate (size + sizeof (struct acpi_debug_mem_header), component, | 530 | allocation = acpi_ut_allocate (size + sizeof (struct acpi_debug_mem_header), |
501 | module, line); | 531 | component, module, line); |
502 | if (!allocation) { | 532 | if (!allocation) { |
503 | return (NULL); | 533 | return (NULL); |
504 | } | 534 | } |
@@ -543,8 +573,8 @@ acpi_ut_callocate_and_track ( | |||
543 | acpi_status status; | 573 | acpi_status status; |
544 | 574 | ||
545 | 575 | ||
546 | allocation = acpi_ut_callocate (size + sizeof (struct acpi_debug_mem_header), component, | 576 | allocation = acpi_ut_callocate (size + sizeof (struct acpi_debug_mem_header), |
547 | module, line); | 577 | component, module, line); |
548 | if (!allocation) { | 578 | if (!allocation) { |
549 | /* Report allocation error */ | 579 | /* Report allocation error */ |
550 | 580 | ||
@@ -637,7 +667,7 @@ acpi_ut_free_and_track ( | |||
637 | * | 667 | * |
638 | ******************************************************************************/ | 668 | ******************************************************************************/ |
639 | 669 | ||
640 | struct acpi_debug_mem_block * | 670 | static struct acpi_debug_mem_block * |
641 | acpi_ut_find_allocation ( | 671 | acpi_ut_find_allocation ( |
642 | u32 list_id, | 672 | u32 list_id, |
643 | void *allocation) | 673 | void *allocation) |
@@ -686,7 +716,7 @@ acpi_ut_find_allocation ( | |||
686 | * | 716 | * |
687 | ******************************************************************************/ | 717 | ******************************************************************************/ |
688 | 718 | ||
689 | acpi_status | 719 | static acpi_status |
690 | acpi_ut_track_allocation ( | 720 | acpi_ut_track_allocation ( |
691 | u32 list_id, | 721 | u32 list_id, |
692 | struct acpi_debug_mem_block *allocation, | 722 | struct acpi_debug_mem_block *allocation, |
@@ -721,10 +751,12 @@ acpi_ut_track_allocation ( | |||
721 | 751 | ||
722 | element = acpi_ut_find_allocation (list_id, allocation); | 752 | element = acpi_ut_find_allocation (list_id, allocation); |
723 | if (element) { | 753 | if (element) { |
724 | ACPI_REPORT_ERROR (("ut_track_allocation: Allocation already present in list! (%p)\n", | 754 | ACPI_REPORT_ERROR (( |
755 | "ut_track_allocation: Allocation already present in list! (%p)\n", | ||
725 | allocation)); | 756 | allocation)); |
726 | 757 | ||
727 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n", element, allocation)); | 758 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n", |
759 | element, allocation)); | ||
728 | 760 | ||
729 | goto unlock_and_exit; | 761 | goto unlock_and_exit; |
730 | } | 762 | } |
@@ -773,7 +805,7 @@ unlock_and_exit: | |||
773 | * | 805 | * |
774 | ******************************************************************************/ | 806 | ******************************************************************************/ |
775 | 807 | ||
776 | acpi_status | 808 | static acpi_status |
777 | acpi_ut_remove_allocation ( | 809 | acpi_ut_remove_allocation ( |
778 | u32 list_id, | 810 | u32 list_id, |
779 | struct acpi_debug_mem_block *allocation, | 811 | struct acpi_debug_mem_block *allocation, |
@@ -797,7 +829,7 @@ acpi_ut_remove_allocation ( | |||
797 | /* No allocations! */ | 829 | /* No allocations! */ |
798 | 830 | ||
799 | _ACPI_REPORT_ERROR (module, line, component, | 831 | _ACPI_REPORT_ERROR (module, line, component, |
800 | ("ut_remove_allocation: Empty allocation list, nothing to free!\n")); | 832 | ("ut_remove_allocation: Empty allocation list, nothing to free!\n")); |
801 | 833 | ||
802 | return_ACPI_STATUS (AE_OK); | 834 | return_ACPI_STATUS (AE_OK); |
803 | } | 835 | } |
@@ -824,7 +856,8 @@ acpi_ut_remove_allocation ( | |||
824 | 856 | ||
825 | ACPI_MEMSET (&allocation->user_space, 0xEA, allocation->size); | 857 | ACPI_MEMSET (&allocation->user_space, 0xEA, allocation->size); |
826 | 858 | ||
827 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", allocation->size)); | 859 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", |
860 | allocation->size)); | ||
828 | 861 | ||
829 | status = acpi_ut_release_mutex (ACPI_MTX_MEMORY); | 862 | status = acpi_ut_release_mutex (ACPI_MTX_MEMORY); |
830 | return_ACPI_STATUS (status); | 863 | return_ACPI_STATUS (status); |
@@ -842,6 +875,7 @@ acpi_ut_remove_allocation ( | |||
842 | * DESCRIPTION: Print some info about the outstanding allocations. | 875 | * DESCRIPTION: Print some info about the outstanding allocations. |
843 | * | 876 | * |
844 | ******************************************************************************/ | 877 | ******************************************************************************/ |
878 | |||
845 | #ifdef ACPI_FUTURE_USAGE | 879 | #ifdef ACPI_FUTURE_USAGE |
846 | void | 880 | void |
847 | acpi_ut_dump_allocation_info ( | 881 | acpi_ut_dump_allocation_info ( |
@@ -884,7 +918,8 @@ acpi_ut_dump_allocation_info ( | |||
884 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | 918 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, |
885 | ("%30s: %4d (%3d Kb)\n", "Max Nodes", | 919 | ("%30s: %4d (%3d Kb)\n", "Max Nodes", |
886 | acpi_gbl_max_concurrent_node_count, | 920 | acpi_gbl_max_concurrent_node_count, |
887 | ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count * sizeof (struct acpi_namespace_node))))); | 921 | ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count * |
922 | sizeof (struct acpi_namespace_node))))); | ||
888 | */ | 923 | */ |
889 | return_VOID; | 924 | return_VOID; |
890 | } | 925 | } |
@@ -933,26 +968,26 @@ acpi_ut_dump_allocations ( | |||
933 | descriptor = ACPI_CAST_PTR (union acpi_descriptor, &element->user_space); | 968 | descriptor = ACPI_CAST_PTR (union acpi_descriptor, &element->user_space); |
934 | if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) { | 969 | if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) { |
935 | acpi_os_printf ("%p Len %04X %9.9s-%d [%s] ", | 970 | acpi_os_printf ("%p Len %04X %9.9s-%d [%s] ", |
936 | descriptor, element->size, element->module, | 971 | descriptor, element->size, element->module, |
937 | element->line, acpi_ut_get_descriptor_name (descriptor)); | 972 | element->line, acpi_ut_get_descriptor_name (descriptor)); |
938 | 973 | ||
939 | /* Most of the elements will be Operand objects. */ | 974 | /* Most of the elements will be Operand objects. */ |
940 | 975 | ||
941 | switch (ACPI_GET_DESCRIPTOR_TYPE (descriptor)) { | 976 | switch (ACPI_GET_DESCRIPTOR_TYPE (descriptor)) { |
942 | case ACPI_DESC_TYPE_OPERAND: | 977 | case ACPI_DESC_TYPE_OPERAND: |
943 | acpi_os_printf ("%12.12s R%hd", | 978 | acpi_os_printf ("%12.12s R%hd", |
944 | acpi_ut_get_type_name (descriptor->object.common.type), | 979 | acpi_ut_get_type_name (descriptor->object.common.type), |
945 | descriptor->object.common.reference_count); | 980 | descriptor->object.common.reference_count); |
946 | break; | 981 | break; |
947 | 982 | ||
948 | case ACPI_DESC_TYPE_PARSER: | 983 | case ACPI_DESC_TYPE_PARSER: |
949 | acpi_os_printf ("aml_opcode %04hX", | 984 | acpi_os_printf ("aml_opcode %04hX", |
950 | descriptor->op.asl.aml_opcode); | 985 | descriptor->op.asl.aml_opcode); |
951 | break; | 986 | break; |
952 | 987 | ||
953 | case ACPI_DESC_TYPE_NAMED: | 988 | case ACPI_DESC_TYPE_NAMED: |
954 | acpi_os_printf ("%4.4s", | 989 | acpi_os_printf ("%4.4s", |
955 | acpi_ut_get_node_name (&descriptor->node)); | 990 | acpi_ut_get_node_name (&descriptor->node)); |
956 | break; | 991 | break; |
957 | 992 | ||
958 | default: | 993 | default: |
@@ -983,6 +1018,5 @@ acpi_ut_dump_allocations ( | |||
983 | return_VOID; | 1018 | return_VOID; |
984 | } | 1019 | } |
985 | 1020 | ||
986 | |||
987 | #endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */ | 1021 | #endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */ |
988 | 1022 | ||
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index 0fcd98bde0d1..11e884957162 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c | |||
@@ -49,21 +49,69 @@ | |||
49 | #define _COMPONENT ACPI_UTILITIES | 49 | #define _COMPONENT ACPI_UTILITIES |
50 | ACPI_MODULE_NAME ("utcopy") | 50 | ACPI_MODULE_NAME ("utcopy") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static acpi_status | ||
55 | acpi_ut_copy_isimple_to_esimple ( | ||
56 | union acpi_operand_object *internal_object, | ||
57 | union acpi_object *external_object, | ||
58 | u8 *data_space, | ||
59 | acpi_size *buffer_space_used); | ||
60 | |||
61 | static acpi_status | ||
62 | acpi_ut_copy_ielement_to_ielement ( | ||
63 | u8 object_type, | ||
64 | union acpi_operand_object *source_object, | ||
65 | union acpi_generic_state *state, | ||
66 | void *context); | ||
67 | |||
68 | static acpi_status | ||
69 | acpi_ut_copy_ipackage_to_epackage ( | ||
70 | union acpi_operand_object *internal_object, | ||
71 | u8 *buffer, | ||
72 | acpi_size *space_used); | ||
73 | |||
74 | static acpi_status | ||
75 | acpi_ut_copy_esimple_to_isimple( | ||
76 | union acpi_object *user_obj, | ||
77 | union acpi_operand_object **return_obj); | ||
78 | |||
79 | static acpi_status | ||
80 | acpi_ut_copy_simple_object ( | ||
81 | union acpi_operand_object *source_desc, | ||
82 | union acpi_operand_object *dest_desc); | ||
83 | |||
84 | static acpi_status | ||
85 | acpi_ut_copy_ielement_to_eelement ( | ||
86 | u8 object_type, | ||
87 | union acpi_operand_object *source_object, | ||
88 | union acpi_generic_state *state, | ||
89 | void *context); | ||
90 | |||
91 | static acpi_status | ||
92 | acpi_ut_copy_ipackage_to_ipackage ( | ||
93 | union acpi_operand_object *source_obj, | ||
94 | union acpi_operand_object *dest_obj, | ||
95 | struct acpi_walk_state *walk_state); | ||
96 | |||
52 | 97 | ||
53 | /******************************************************************************* | 98 | /******************************************************************************* |
54 | * | 99 | * |
55 | * FUNCTION: acpi_ut_copy_isimple_to_esimple | 100 | * FUNCTION: acpi_ut_copy_isimple_to_esimple |
56 | * | 101 | * |
57 | * PARAMETERS: *internal_object - Pointer to the object we are examining | 102 | * PARAMETERS: internal_object - Source object to be copied |
58 | * *Buffer - Where the object is returned | 103 | * external_object - Where to return the copied object |
59 | * *space_used - Where the data length is returned | 104 | * data_space - Where object data is returned (such as |
105 | * buffer and string data) | ||
106 | * buffer_space_used - Length of data_space that was used | ||
60 | * | 107 | * |
61 | * RETURN: Status | 108 | * RETURN: Status |
62 | * | 109 | * |
63 | * DESCRIPTION: This function is called to place a simple object in a user | 110 | * DESCRIPTION: This function is called to copy a simple internal object to |
64 | * buffer. | 111 | * an external object. |
65 | * | 112 | * |
66 | * The buffer is assumed to have sufficient space for the object. | 113 | * The data_space buffer is assumed to have sufficient space for |
114 | * the object. | ||
67 | * | 115 | * |
68 | ******************************************************************************/ | 116 | ******************************************************************************/ |
69 | 117 | ||
@@ -107,10 +155,12 @@ acpi_ut_copy_isimple_to_esimple ( | |||
107 | 155 | ||
108 | external_object->string.pointer = (char *) data_space; | 156 | external_object->string.pointer = (char *) data_space; |
109 | external_object->string.length = internal_object->string.length; | 157 | external_object->string.length = internal_object->string.length; |
110 | *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD ((acpi_size) internal_object->string.length + 1); | 158 | *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD ( |
159 | (acpi_size) internal_object->string.length + 1); | ||
111 | 160 | ||
112 | ACPI_MEMCPY ((void *) data_space, (void *) internal_object->string.pointer, | 161 | ACPI_MEMCPY ((void *) data_space, |
113 | (acpi_size) internal_object->string.length + 1); | 162 | (void *) internal_object->string.pointer, |
163 | (acpi_size) internal_object->string.length + 1); | ||
114 | break; | 164 | break; |
115 | 165 | ||
116 | 166 | ||
@@ -118,10 +168,12 @@ acpi_ut_copy_isimple_to_esimple ( | |||
118 | 168 | ||
119 | external_object->buffer.pointer = data_space; | 169 | external_object->buffer.pointer = data_space; |
120 | external_object->buffer.length = internal_object->buffer.length; | 170 | external_object->buffer.length = internal_object->buffer.length; |
121 | *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD (internal_object->string.length); | 171 | *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD ( |
172 | internal_object->string.length); | ||
122 | 173 | ||
123 | ACPI_MEMCPY ((void *) data_space, (void *) internal_object->buffer.pointer, | 174 | ACPI_MEMCPY ((void *) data_space, |
124 | internal_object->buffer.length); | 175 | (void *) internal_object->buffer.pointer, |
176 | internal_object->buffer.length); | ||
125 | break; | 177 | break; |
126 | 178 | ||
127 | 179 | ||
@@ -194,7 +246,7 @@ acpi_ut_copy_isimple_to_esimple ( | |||
194 | * | 246 | * |
195 | ******************************************************************************/ | 247 | ******************************************************************************/ |
196 | 248 | ||
197 | acpi_status | 249 | static acpi_status |
198 | acpi_ut_copy_ielement_to_eelement ( | 250 | acpi_ut_copy_ielement_to_eelement ( |
199 | u8 object_type, | 251 | u8 object_type, |
200 | union acpi_operand_object *source_object, | 252 | union acpi_operand_object *source_object, |
@@ -213,7 +265,7 @@ acpi_ut_copy_ielement_to_eelement ( | |||
213 | 265 | ||
214 | this_index = state->pkg.index; | 266 | this_index = state->pkg.index; |
215 | target_object = (union acpi_object *) | 267 | target_object = (union acpi_object *) |
216 | &((union acpi_object *)(state->pkg.dest_object))->package.elements[this_index]; | 268 | &((union acpi_object *)(state->pkg.dest_object))->package.elements[this_index]; |
217 | 269 | ||
218 | switch (object_type) { | 270 | switch (object_type) { |
219 | case ACPI_COPY_TYPE_SIMPLE: | 271 | case ACPI_COPY_TYPE_SIMPLE: |
@@ -236,7 +288,8 @@ acpi_ut_copy_ielement_to_eelement ( | |||
236 | */ | 288 | */ |
237 | target_object->type = ACPI_TYPE_PACKAGE; | 289 | target_object->type = ACPI_TYPE_PACKAGE; |
238 | target_object->package.count = source_object->package.count; | 290 | target_object->package.count = source_object->package.count; |
239 | target_object->package.elements = ACPI_CAST_PTR (union acpi_object, info->free_space); | 291 | target_object->package.elements = |
292 | ACPI_CAST_PTR (union acpi_object, info->free_space); | ||
240 | 293 | ||
241 | /* | 294 | /* |
242 | * Pass the new package object back to the package walk routine | 295 | * Pass the new package object back to the package walk routine |
@@ -248,7 +301,8 @@ acpi_ut_copy_ielement_to_eelement ( | |||
248 | * update the buffer length counter | 301 | * update the buffer length counter |
249 | */ | 302 | */ |
250 | object_space = ACPI_ROUND_UP_TO_NATIVE_WORD ( | 303 | object_space = ACPI_ROUND_UP_TO_NATIVE_WORD ( |
251 | (acpi_size) target_object->package.count * sizeof (union acpi_object)); | 304 | (acpi_size) target_object->package.count * |
305 | sizeof (union acpi_object)); | ||
252 | break; | 306 | break; |
253 | 307 | ||
254 | 308 | ||
@@ -266,9 +320,9 @@ acpi_ut_copy_ielement_to_eelement ( | |||
266 | * | 320 | * |
267 | * FUNCTION: acpi_ut_copy_ipackage_to_epackage | 321 | * FUNCTION: acpi_ut_copy_ipackage_to_epackage |
268 | * | 322 | * |
269 | * PARAMETERS: *internal_object - Pointer to the object we are returning | 323 | * PARAMETERS: internal_object - Pointer to the object we are returning |
270 | * *Buffer - Where the object is returned | 324 | * Buffer - Where the object is returned |
271 | * *space_used - Where the object length is returned | 325 | * space_used - Where the object length is returned |
272 | * | 326 | * |
273 | * RETURN: Status | 327 | * RETURN: Status |
274 | * | 328 | * |
@@ -304,13 +358,15 @@ acpi_ut_copy_ipackage_to_epackage ( | |||
304 | * Free space begins right after the first package | 358 | * Free space begins right after the first package |
305 | */ | 359 | */ |
306 | info.length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object)); | 360 | info.length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object)); |
307 | info.free_space = buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object)); | 361 | info.free_space = buffer + ACPI_ROUND_UP_TO_NATIVE_WORD ( |
362 | sizeof (union acpi_object)); | ||
308 | info.object_space = 0; | 363 | info.object_space = 0; |
309 | info.num_packages = 1; | 364 | info.num_packages = 1; |
310 | 365 | ||
311 | external_object->type = ACPI_GET_OBJECT_TYPE (internal_object); | 366 | external_object->type = ACPI_GET_OBJECT_TYPE (internal_object); |
312 | external_object->package.count = internal_object->package.count; | 367 | external_object->package.count = internal_object->package.count; |
313 | external_object->package.elements = ACPI_CAST_PTR (union acpi_object, info.free_space); | 368 | external_object->package.elements = ACPI_CAST_PTR (union acpi_object, |
369 | info.free_space); | ||
314 | 370 | ||
315 | /* | 371 | /* |
316 | * Leave room for an array of ACPI_OBJECTS in the buffer | 372 | * Leave room for an array of ACPI_OBJECTS in the buffer |
@@ -333,8 +389,8 @@ acpi_ut_copy_ipackage_to_epackage ( | |||
333 | * | 389 | * |
334 | * FUNCTION: acpi_ut_copy_iobject_to_eobject | 390 | * FUNCTION: acpi_ut_copy_iobject_to_eobject |
335 | * | 391 | * |
336 | * PARAMETERS: *internal_object - The internal object to be converted | 392 | * PARAMETERS: internal_object - The internal object to be converted |
337 | * *buffer_ptr - Where the object is returned | 393 | * buffer_ptr - Where the object is returned |
338 | * | 394 | * |
339 | * RETURN: Status | 395 | * RETURN: Status |
340 | * | 396 | * |
@@ -367,10 +423,10 @@ acpi_ut_copy_iobject_to_eobject ( | |||
367 | * Build a simple object (no nested objects) | 423 | * Build a simple object (no nested objects) |
368 | */ | 424 | */ |
369 | status = acpi_ut_copy_isimple_to_esimple (internal_object, | 425 | status = acpi_ut_copy_isimple_to_esimple (internal_object, |
370 | (union acpi_object *) ret_buffer->pointer, | 426 | (union acpi_object *) ret_buffer->pointer, |
371 | ((u8 *) ret_buffer->pointer + | 427 | ((u8 *) ret_buffer->pointer + |
372 | ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object))), | 428 | ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object))), |
373 | &ret_buffer->length); | 429 | &ret_buffer->length); |
374 | /* | 430 | /* |
375 | * build simple does not include the object size in the length | 431 | * build simple does not include the object size in the length |
376 | * so we add it in here | 432 | * so we add it in here |
@@ -386,8 +442,8 @@ acpi_ut_copy_iobject_to_eobject ( | |||
386 | * | 442 | * |
387 | * FUNCTION: acpi_ut_copy_esimple_to_isimple | 443 | * FUNCTION: acpi_ut_copy_esimple_to_isimple |
388 | * | 444 | * |
389 | * PARAMETERS: *external_object - The external object to be converted | 445 | * PARAMETERS: external_object - The external object to be converted |
390 | * *internal_object - Where the internal object is returned | 446 | * ret_internal_object - Where the internal object is returned |
391 | * | 447 | * |
392 | * RETURN: Status | 448 | * RETURN: Status |
393 | * | 449 | * |
@@ -398,7 +454,7 @@ acpi_ut_copy_iobject_to_eobject ( | |||
398 | * | 454 | * |
399 | ******************************************************************************/ | 455 | ******************************************************************************/ |
400 | 456 | ||
401 | acpi_status | 457 | static acpi_status |
402 | acpi_ut_copy_esimple_to_isimple ( | 458 | acpi_ut_copy_esimple_to_isimple ( |
403 | union acpi_object *external_object, | 459 | union acpi_object *external_object, |
404 | union acpi_operand_object **ret_internal_object) | 460 | union acpi_operand_object **ret_internal_object) |
@@ -417,7 +473,8 @@ acpi_ut_copy_esimple_to_isimple ( | |||
417 | case ACPI_TYPE_BUFFER: | 473 | case ACPI_TYPE_BUFFER: |
418 | case ACPI_TYPE_INTEGER: | 474 | case ACPI_TYPE_INTEGER: |
419 | 475 | ||
420 | internal_object = acpi_ut_create_internal_object ((u8) external_object->type); | 476 | internal_object = acpi_ut_create_internal_object ( |
477 | (u8) external_object->type); | ||
421 | if (!internal_object) { | 478 | if (!internal_object) { |
422 | return_ACPI_STATUS (AE_NO_MEMORY); | 479 | return_ACPI_STATUS (AE_NO_MEMORY); |
423 | } | 480 | } |
@@ -486,7 +543,6 @@ error_exit: | |||
486 | 543 | ||
487 | 544 | ||
488 | #ifdef ACPI_FUTURE_IMPLEMENTATION | 545 | #ifdef ACPI_FUTURE_IMPLEMENTATION |
489 | |||
490 | /* Code to convert packages that are parameters to control methods */ | 546 | /* Code to convert packages that are parameters to control methods */ |
491 | 547 | ||
492 | /******************************************************************************* | 548 | /******************************************************************************* |
@@ -614,7 +670,7 @@ acpi_ut_copy_eobject_to_iobject ( | |||
614 | * | 670 | * |
615 | ******************************************************************************/ | 671 | ******************************************************************************/ |
616 | 672 | ||
617 | acpi_status | 673 | static acpi_status |
618 | acpi_ut_copy_simple_object ( | 674 | acpi_ut_copy_simple_object ( |
619 | union acpi_operand_object *source_desc, | 675 | union acpi_operand_object *source_desc, |
620 | union acpi_operand_object *dest_desc) | 676 | union acpi_operand_object *dest_desc) |
@@ -724,7 +780,7 @@ acpi_ut_copy_simple_object ( | |||
724 | * | 780 | * |
725 | ******************************************************************************/ | 781 | ******************************************************************************/ |
726 | 782 | ||
727 | acpi_status | 783 | static acpi_status |
728 | acpi_ut_copy_ielement_to_ielement ( | 784 | acpi_ut_copy_ielement_to_ielement ( |
729 | u8 object_type, | 785 | u8 object_type, |
730 | union acpi_operand_object *source_object, | 786 | union acpi_operand_object *source_object, |
@@ -837,7 +893,7 @@ error_exit: | |||
837 | * | 893 | * |
838 | ******************************************************************************/ | 894 | ******************************************************************************/ |
839 | 895 | ||
840 | acpi_status | 896 | static acpi_status |
841 | acpi_ut_copy_ipackage_to_ipackage ( | 897 | acpi_ut_copy_ipackage_to_ipackage ( |
842 | union acpi_operand_object *source_obj, | 898 | union acpi_operand_object *source_obj, |
843 | union acpi_operand_object *dest_obj, | 899 | union acpi_operand_object *dest_obj, |
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index 985c5d045b78..794c7df3f2ad 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c | |||
@@ -56,7 +56,7 @@ static char *acpi_gbl_fn_entry_str = "----Entry"; | |||
56 | static char *acpi_gbl_fn_exit_str = "----Exit-"; | 56 | static char *acpi_gbl_fn_exit_str = "----Exit-"; |
57 | 57 | ||
58 | 58 | ||
59 | /***************************************************************************** | 59 | /******************************************************************************* |
60 | * | 60 | * |
61 | * FUNCTION: acpi_ut_init_stack_ptr_trace | 61 | * FUNCTION: acpi_ut_init_stack_ptr_trace |
62 | * | 62 | * |
@@ -64,9 +64,9 @@ static char *acpi_gbl_fn_exit_str = "----Exit-"; | |||
64 | * | 64 | * |
65 | * RETURN: None | 65 | * RETURN: None |
66 | * | 66 | * |
67 | * DESCRIPTION: Save the current stack pointer | 67 | * DESCRIPTION: Save the current CPU stack pointer at subsystem startup |
68 | * | 68 | * |
69 | ****************************************************************************/ | 69 | ******************************************************************************/ |
70 | 70 | ||
71 | void | 71 | void |
72 | acpi_ut_init_stack_ptr_trace ( | 72 | acpi_ut_init_stack_ptr_trace ( |
@@ -79,7 +79,7 @@ acpi_ut_init_stack_ptr_trace ( | |||
79 | } | 79 | } |
80 | 80 | ||
81 | 81 | ||
82 | /***************************************************************************** | 82 | /******************************************************************************* |
83 | * | 83 | * |
84 | * FUNCTION: acpi_ut_track_stack_ptr | 84 | * FUNCTION: acpi_ut_track_stack_ptr |
85 | * | 85 | * |
@@ -87,9 +87,9 @@ acpi_ut_init_stack_ptr_trace ( | |||
87 | * | 87 | * |
88 | * RETURN: None | 88 | * RETURN: None |
89 | * | 89 | * |
90 | * DESCRIPTION: Save the current stack pointer | 90 | * DESCRIPTION: Save the current CPU stack pointer |
91 | * | 91 | * |
92 | ****************************************************************************/ | 92 | ******************************************************************************/ |
93 | 93 | ||
94 | void | 94 | void |
95 | acpi_ut_track_stack_ptr ( | 95 | acpi_ut_track_stack_ptr ( |
@@ -110,16 +110,16 @@ acpi_ut_track_stack_ptr ( | |||
110 | } | 110 | } |
111 | 111 | ||
112 | 112 | ||
113 | /***************************************************************************** | 113 | /******************************************************************************* |
114 | * | 114 | * |
115 | * FUNCTION: acpi_ut_debug_print | 115 | * FUNCTION: acpi_ut_debug_print |
116 | * | 116 | * |
117 | * PARAMETERS: debug_level - Requested debug print level | 117 | * PARAMETERS: requested_debug_level - Requested debug print level |
118 | * proc_name - Caller's procedure name | ||
119 | * module_name - Caller's module name (for error output) | ||
120 | * line_number - Caller's line number (for error output) | 118 | * line_number - Caller's line number (for error output) |
121 | * component_id - Caller's component ID (for error output) | 119 | * dbg_info - Contains: |
122 | * | 120 | * proc_name - Caller's procedure name |
121 | * module_name - Caller's module name | ||
122 | * component_id - Caller's component ID | ||
123 | * Format - Printf format field | 123 | * Format - Printf format field |
124 | * ... - Optional printf arguments | 124 | * ... - Optional printf arguments |
125 | * | 125 | * |
@@ -128,7 +128,7 @@ acpi_ut_track_stack_ptr ( | |||
128 | * DESCRIPTION: Print error message with prefix consisting of the module name, | 128 | * DESCRIPTION: Print error message with prefix consisting of the module name, |
129 | * line number, and component ID. | 129 | * line number, and component ID. |
130 | * | 130 | * |
131 | ****************************************************************************/ | 131 | ******************************************************************************/ |
132 | 132 | ||
133 | void ACPI_INTERNAL_VAR_XFACE | 133 | void ACPI_INTERNAL_VAR_XFACE |
134 | acpi_ut_debug_print ( | 134 | acpi_ut_debug_print ( |
@@ -157,7 +157,8 @@ acpi_ut_debug_print ( | |||
157 | 157 | ||
158 | if (thread_id != acpi_gbl_prev_thread_id) { | 158 | if (thread_id != acpi_gbl_prev_thread_id) { |
159 | if (ACPI_LV_THREADS & acpi_dbg_level) { | 159 | if (ACPI_LV_THREADS & acpi_dbg_level) { |
160 | acpi_os_printf ("\n**** Context Switch from TID %X to TID %X ****\n\n", | 160 | acpi_os_printf ( |
161 | "\n**** Context Switch from TID %X to TID %X ****\n\n", | ||
161 | acpi_gbl_prev_thread_id, thread_id); | 162 | acpi_gbl_prev_thread_id, thread_id); |
162 | } | 163 | } |
163 | 164 | ||
@@ -174,15 +175,16 @@ acpi_ut_debug_print ( | |||
174 | acpi_os_printf ("[%04lX] ", thread_id); | 175 | acpi_os_printf ("[%04lX] ", thread_id); |
175 | } | 176 | } |
176 | 177 | ||
177 | acpi_os_printf ("[%02ld] %-22.22s: ", acpi_gbl_nesting_level, dbg_info->proc_name); | 178 | acpi_os_printf ("[%02ld] %-22.22s: ", |
179 | acpi_gbl_nesting_level, dbg_info->proc_name); | ||
178 | 180 | ||
179 | va_start (args, format); | 181 | va_start (args, format); |
180 | acpi_os_vprintf (format, args); | 182 | acpi_os_vprintf (format, args); |
181 | } | 183 | } |
182 | EXPORT_SYMBOL(acpi_ut_debug_print); | ||
183 | 184 | ||
185 | EXPORT_SYMBOL(acpi_ut_debug_print); | ||
184 | 186 | ||
185 | /***************************************************************************** | 187 | /******************************************************************************* |
186 | * | 188 | * |
187 | * FUNCTION: acpi_ut_debug_print_raw | 189 | * FUNCTION: acpi_ut_debug_print_raw |
188 | * | 190 | * |
@@ -200,7 +202,7 @@ EXPORT_SYMBOL(acpi_ut_debug_print); | |||
200 | * DESCRIPTION: Print message with no headers. Has same interface as | 202 | * DESCRIPTION: Print message with no headers. Has same interface as |
201 | * debug_print so that the same macros can be used. | 203 | * debug_print so that the same macros can be used. |
202 | * | 204 | * |
203 | ****************************************************************************/ | 205 | ******************************************************************************/ |
204 | 206 | ||
205 | void ACPI_INTERNAL_VAR_XFACE | 207 | void ACPI_INTERNAL_VAR_XFACE |
206 | acpi_ut_debug_print_raw ( | 208 | acpi_ut_debug_print_raw ( |
@@ -224,7 +226,7 @@ acpi_ut_debug_print_raw ( | |||
224 | EXPORT_SYMBOL(acpi_ut_debug_print_raw); | 226 | EXPORT_SYMBOL(acpi_ut_debug_print_raw); |
225 | 227 | ||
226 | 228 | ||
227 | /***************************************************************************** | 229 | /******************************************************************************* |
228 | * | 230 | * |
229 | * FUNCTION: acpi_ut_trace | 231 | * FUNCTION: acpi_ut_trace |
230 | * | 232 | * |
@@ -239,7 +241,7 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw); | |||
239 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is | 241 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is |
240 | * set in debug_level | 242 | * set in debug_level |
241 | * | 243 | * |
242 | ****************************************************************************/ | 244 | ******************************************************************************/ |
243 | 245 | ||
244 | void | 246 | void |
245 | acpi_ut_trace ( | 247 | acpi_ut_trace ( |
@@ -256,7 +258,7 @@ acpi_ut_trace ( | |||
256 | EXPORT_SYMBOL(acpi_ut_trace); | 258 | EXPORT_SYMBOL(acpi_ut_trace); |
257 | 259 | ||
258 | 260 | ||
259 | /***************************************************************************** | 261 | /******************************************************************************* |
260 | * | 262 | * |
261 | * FUNCTION: acpi_ut_trace_ptr | 263 | * FUNCTION: acpi_ut_trace_ptr |
262 | * | 264 | * |
@@ -272,7 +274,7 @@ EXPORT_SYMBOL(acpi_ut_trace); | |||
272 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is | 274 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is |
273 | * set in debug_level | 275 | * set in debug_level |
274 | * | 276 | * |
275 | ****************************************************************************/ | 277 | ******************************************************************************/ |
276 | 278 | ||
277 | void | 279 | void |
278 | acpi_ut_trace_ptr ( | 280 | acpi_ut_trace_ptr ( |
@@ -288,7 +290,7 @@ acpi_ut_trace_ptr ( | |||
288 | } | 290 | } |
289 | 291 | ||
290 | 292 | ||
291 | /***************************************************************************** | 293 | /******************************************************************************* |
292 | * | 294 | * |
293 | * FUNCTION: acpi_ut_trace_str | 295 | * FUNCTION: acpi_ut_trace_str |
294 | * | 296 | * |
@@ -304,7 +306,7 @@ acpi_ut_trace_ptr ( | |||
304 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is | 306 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is |
305 | * set in debug_level | 307 | * set in debug_level |
306 | * | 308 | * |
307 | ****************************************************************************/ | 309 | ******************************************************************************/ |
308 | 310 | ||
309 | void | 311 | void |
310 | acpi_ut_trace_str ( | 312 | acpi_ut_trace_str ( |
@@ -321,7 +323,7 @@ acpi_ut_trace_str ( | |||
321 | } | 323 | } |
322 | 324 | ||
323 | 325 | ||
324 | /***************************************************************************** | 326 | /******************************************************************************* |
325 | * | 327 | * |
326 | * FUNCTION: acpi_ut_trace_u32 | 328 | * FUNCTION: acpi_ut_trace_u32 |
327 | * | 329 | * |
@@ -337,7 +339,7 @@ acpi_ut_trace_str ( | |||
337 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is | 339 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is |
338 | * set in debug_level | 340 | * set in debug_level |
339 | * | 341 | * |
340 | ****************************************************************************/ | 342 | ******************************************************************************/ |
341 | 343 | ||
342 | void | 344 | void |
343 | acpi_ut_trace_u32 ( | 345 | acpi_ut_trace_u32 ( |
@@ -354,7 +356,7 @@ acpi_ut_trace_u32 ( | |||
354 | } | 356 | } |
355 | 357 | ||
356 | 358 | ||
357 | /***************************************************************************** | 359 | /******************************************************************************* |
358 | * | 360 | * |
359 | * FUNCTION: acpi_ut_exit | 361 | * FUNCTION: acpi_ut_exit |
360 | * | 362 | * |
@@ -369,7 +371,7 @@ acpi_ut_trace_u32 ( | |||
369 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is | 371 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is |
370 | * set in debug_level | 372 | * set in debug_level |
371 | * | 373 | * |
372 | ****************************************************************************/ | 374 | ******************************************************************************/ |
373 | 375 | ||
374 | void | 376 | void |
375 | acpi_ut_exit ( | 377 | acpi_ut_exit ( |
@@ -385,7 +387,7 @@ acpi_ut_exit ( | |||
385 | EXPORT_SYMBOL(acpi_ut_exit); | 387 | EXPORT_SYMBOL(acpi_ut_exit); |
386 | 388 | ||
387 | 389 | ||
388 | /***************************************************************************** | 390 | /******************************************************************************* |
389 | * | 391 | * |
390 | * FUNCTION: acpi_ut_status_exit | 392 | * FUNCTION: acpi_ut_status_exit |
391 | * | 393 | * |
@@ -401,7 +403,7 @@ EXPORT_SYMBOL(acpi_ut_exit); | |||
401 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is | 403 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is |
402 | * set in debug_level. Prints exit status also. | 404 | * set in debug_level. Prints exit status also. |
403 | * | 405 | * |
404 | ****************************************************************************/ | 406 | ******************************************************************************/ |
405 | 407 | ||
406 | void | 408 | void |
407 | acpi_ut_status_exit ( | 409 | acpi_ut_status_exit ( |
@@ -426,7 +428,7 @@ acpi_ut_status_exit ( | |||
426 | EXPORT_SYMBOL(acpi_ut_status_exit); | 428 | EXPORT_SYMBOL(acpi_ut_status_exit); |
427 | 429 | ||
428 | 430 | ||
429 | /***************************************************************************** | 431 | /******************************************************************************* |
430 | * | 432 | * |
431 | * FUNCTION: acpi_ut_value_exit | 433 | * FUNCTION: acpi_ut_value_exit |
432 | * | 434 | * |
@@ -442,7 +444,7 @@ EXPORT_SYMBOL(acpi_ut_status_exit); | |||
442 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is | 444 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is |
443 | * set in debug_level. Prints exit value also. | 445 | * set in debug_level. Prints exit value also. |
444 | * | 446 | * |
445 | ****************************************************************************/ | 447 | ******************************************************************************/ |
446 | 448 | ||
447 | void | 449 | void |
448 | acpi_ut_value_exit ( | 450 | acpi_ut_value_exit ( |
@@ -460,7 +462,7 @@ acpi_ut_value_exit ( | |||
460 | EXPORT_SYMBOL(acpi_ut_value_exit); | 462 | EXPORT_SYMBOL(acpi_ut_value_exit); |
461 | 463 | ||
462 | 464 | ||
463 | /***************************************************************************** | 465 | /******************************************************************************* |
464 | * | 466 | * |
465 | * FUNCTION: acpi_ut_ptr_exit | 467 | * FUNCTION: acpi_ut_ptr_exit |
466 | * | 468 | * |
@@ -469,14 +471,14 @@ EXPORT_SYMBOL(acpi_ut_value_exit); | |||
469 | * proc_name - Caller's procedure name | 471 | * proc_name - Caller's procedure name |
470 | * module_name - Caller's module name | 472 | * module_name - Caller's module name |
471 | * component_id - Caller's component ID | 473 | * component_id - Caller's component ID |
472 | * Value - Value to be printed with exit msg | 474 | * Ptr - Pointer to display |
473 | * | 475 | * |
474 | * RETURN: None | 476 | * RETURN: None |
475 | * | 477 | * |
476 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is | 478 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is |
477 | * set in debug_level. Prints exit value also. | 479 | * set in debug_level. Prints exit value also. |
478 | * | 480 | * |
479 | ****************************************************************************/ | 481 | ******************************************************************************/ |
480 | 482 | ||
481 | void | 483 | void |
482 | acpi_ut_ptr_exit ( | 484 | acpi_ut_ptr_exit ( |
@@ -494,7 +496,7 @@ acpi_ut_ptr_exit ( | |||
494 | #endif | 496 | #endif |
495 | 497 | ||
496 | 498 | ||
497 | /***************************************************************************** | 499 | /******************************************************************************* |
498 | * | 500 | * |
499 | * FUNCTION: acpi_ut_dump_buffer | 501 | * FUNCTION: acpi_ut_dump_buffer |
500 | * | 502 | * |
@@ -507,7 +509,7 @@ acpi_ut_ptr_exit ( | |||
507 | * | 509 | * |
508 | * DESCRIPTION: Generic dump buffer in both hex and ascii. | 510 | * DESCRIPTION: Generic dump buffer in both hex and ascii. |
509 | * | 511 | * |
510 | ****************************************************************************/ | 512 | ******************************************************************************/ |
511 | 513 | ||
512 | void | 514 | void |
513 | acpi_ut_dump_buffer ( | 515 | acpi_ut_dump_buffer ( |
@@ -533,34 +535,28 @@ acpi_ut_dump_buffer ( | |||
533 | display = DB_BYTE_DISPLAY; | 535 | display = DB_BYTE_DISPLAY; |
534 | } | 536 | } |
535 | 537 | ||
536 | acpi_os_printf ("\nOffset Value\n"); | 538 | /* Nasty little dump buffer routine! */ |
537 | 539 | ||
538 | /* | ||
539 | * Nasty little dump buffer routine! | ||
540 | */ | ||
541 | while (i < count) { | 540 | while (i < count) { |
542 | /* Print current offset */ | 541 | /* Print current offset */ |
543 | 542 | ||
544 | acpi_os_printf ("%05X ", (u32) i); | 543 | acpi_os_printf ("%6.4X: ", (u32) i); |
545 | 544 | ||
546 | /* Print 16 hex chars */ | 545 | /* Print 16 hex chars */ |
547 | 546 | ||
548 | for (j = 0; j < 16;) { | 547 | for (j = 0; j < 16;) { |
549 | if (i + j >= count) { | 548 | if (i + j >= count) { |
550 | acpi_os_printf ("\n"); | 549 | /* Dump fill spaces */ |
551 | return; | ||
552 | } | ||
553 | 550 | ||
554 | /* Make sure that the s8 doesn't get sign-extended! */ | 551 | acpi_os_printf ("%*s", ((display * 2) + 1), " "); |
552 | j += display; | ||
553 | continue; | ||
554 | } | ||
555 | 555 | ||
556 | switch (display) { | 556 | switch (display) { |
557 | /* Default is BYTE display */ | 557 | default: /* Default is BYTE display */ |
558 | 558 | ||
559 | default: | 559 | acpi_os_printf ("%02X ", buffer[i + j]); |
560 | |||
561 | acpi_os_printf ("%02X ", | ||
562 | *((u8 *) &buffer[i + j])); | ||
563 | j += 1; | ||
564 | break; | 560 | break; |
565 | 561 | ||
566 | 562 | ||
@@ -568,7 +564,6 @@ acpi_ut_dump_buffer ( | |||
568 | 564 | ||
569 | ACPI_MOVE_16_TO_32 (&temp32, &buffer[i + j]); | 565 | ACPI_MOVE_16_TO_32 (&temp32, &buffer[i + j]); |
570 | acpi_os_printf ("%04X ", temp32); | 566 | acpi_os_printf ("%04X ", temp32); |
571 | j += 2; | ||
572 | break; | 567 | break; |
573 | 568 | ||
574 | 569 | ||
@@ -576,7 +571,6 @@ acpi_ut_dump_buffer ( | |||
576 | 571 | ||
577 | ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j]); | 572 | ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j]); |
578 | acpi_os_printf ("%08X ", temp32); | 573 | acpi_os_printf ("%08X ", temp32); |
579 | j += 4; | ||
580 | break; | 574 | break; |
581 | 575 | ||
582 | 576 | ||
@@ -587,15 +581,17 @@ acpi_ut_dump_buffer ( | |||
587 | 581 | ||
588 | ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j + 4]); | 582 | ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j + 4]); |
589 | acpi_os_printf ("%08X ", temp32); | 583 | acpi_os_printf ("%08X ", temp32); |
590 | j += 8; | ||
591 | break; | 584 | break; |
592 | } | 585 | } |
586 | |||
587 | j += display; | ||
593 | } | 588 | } |
594 | 589 | ||
595 | /* | 590 | /* |
596 | * Print the ASCII equivalent characters | 591 | * Print the ASCII equivalent characters |
597 | * But watch out for the bad unprintable ones... | 592 | * But watch out for the bad unprintable ones... |
598 | */ | 593 | */ |
594 | acpi_os_printf (" "); | ||
599 | for (j = 0; j < 16; j++) { | 595 | for (j = 0; j < 16; j++) { |
600 | if (i + j >= count) { | 596 | if (i + j >= count) { |
601 | acpi_os_printf ("\n"); | 597 | acpi_os_printf ("\n"); |
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 9a52ad52a23a..bc5403022681 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c | |||
@@ -51,12 +51,23 @@ | |||
51 | #define _COMPONENT ACPI_UTILITIES | 51 | #define _COMPONENT ACPI_UTILITIES |
52 | ACPI_MODULE_NAME ("utdelete") | 52 | ACPI_MODULE_NAME ("utdelete") |
53 | 53 | ||
54 | /* Local prototypes */ | ||
55 | |||
56 | static void | ||
57 | acpi_ut_delete_internal_obj ( | ||
58 | union acpi_operand_object *object); | ||
59 | |||
60 | static void | ||
61 | acpi_ut_update_ref_count ( | ||
62 | union acpi_operand_object *object, | ||
63 | u32 action); | ||
64 | |||
54 | 65 | ||
55 | /******************************************************************************* | 66 | /******************************************************************************* |
56 | * | 67 | * |
57 | * FUNCTION: acpi_ut_delete_internal_obj | 68 | * FUNCTION: acpi_ut_delete_internal_obj |
58 | * | 69 | * |
59 | * PARAMETERS: *Object - Pointer to the list to be deleted | 70 | * PARAMETERS: Object - Object to be deleted |
60 | * | 71 | * |
61 | * RETURN: None | 72 | * RETURN: None |
62 | * | 73 | * |
@@ -65,7 +76,7 @@ | |||
65 | * | 76 | * |
66 | ******************************************************************************/ | 77 | ******************************************************************************/ |
67 | 78 | ||
68 | void | 79 | static void |
69 | acpi_ut_delete_internal_obj ( | 80 | acpi_ut_delete_internal_obj ( |
70 | union acpi_operand_object *object) | 81 | union acpi_operand_object *object) |
71 | { | 82 | { |
@@ -152,7 +163,8 @@ acpi_ut_delete_internal_obj ( | |||
152 | 163 | ||
153 | case ACPI_TYPE_MUTEX: | 164 | case ACPI_TYPE_MUTEX: |
154 | 165 | ||
155 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Mutex %p, Semaphore %p\n", | 166 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
167 | "***** Mutex %p, Semaphore %p\n", | ||
156 | object, object->mutex.semaphore)); | 168 | object, object->mutex.semaphore)); |
157 | 169 | ||
158 | acpi_ex_unlink_mutex (object); | 170 | acpi_ex_unlink_mutex (object); |
@@ -162,7 +174,8 @@ acpi_ut_delete_internal_obj ( | |||
162 | 174 | ||
163 | case ACPI_TYPE_EVENT: | 175 | case ACPI_TYPE_EVENT: |
164 | 176 | ||
165 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Event %p, Semaphore %p\n", | 177 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
178 | "***** Event %p, Semaphore %p\n", | ||
166 | object, object->event.semaphore)); | 179 | object, object->event.semaphore)); |
167 | 180 | ||
168 | (void) acpi_os_delete_semaphore (object->event.semaphore); | 181 | (void) acpi_os_delete_semaphore (object->event.semaphore); |
@@ -172,7 +185,8 @@ acpi_ut_delete_internal_obj ( | |||
172 | 185 | ||
173 | case ACPI_TYPE_METHOD: | 186 | case ACPI_TYPE_METHOD: |
174 | 187 | ||
175 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Method %p\n", object)); | 188 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
189 | "***** Method %p\n", object)); | ||
176 | 190 | ||
177 | /* Delete the method semaphore if it exists */ | 191 | /* Delete the method semaphore if it exists */ |
178 | 192 | ||
@@ -185,7 +199,8 @@ acpi_ut_delete_internal_obj ( | |||
185 | 199 | ||
186 | case ACPI_TYPE_REGION: | 200 | case ACPI_TYPE_REGION: |
187 | 201 | ||
188 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Region %p\n", object)); | 202 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
203 | "***** Region %p\n", object)); | ||
189 | 204 | ||
190 | second_desc = acpi_ns_get_secondary_object (object); | 205 | second_desc = acpi_ns_get_secondary_object (object); |
191 | if (second_desc) { | 206 | if (second_desc) { |
@@ -212,7 +227,8 @@ acpi_ut_delete_internal_obj ( | |||
212 | 227 | ||
213 | case ACPI_TYPE_BUFFER_FIELD: | 228 | case ACPI_TYPE_BUFFER_FIELD: |
214 | 229 | ||
215 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Buffer Field %p\n", object)); | 230 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
231 | "***** Buffer Field %p\n", object)); | ||
216 | 232 | ||
217 | second_desc = acpi_ns_get_secondary_object (object); | 233 | second_desc = acpi_ns_get_secondary_object (object); |
218 | if (second_desc) { | 234 | if (second_desc) { |
@@ -247,7 +263,7 @@ acpi_ut_delete_internal_obj ( | |||
247 | * | 263 | * |
248 | * FUNCTION: acpi_ut_delete_internal_object_list | 264 | * FUNCTION: acpi_ut_delete_internal_object_list |
249 | * | 265 | * |
250 | * PARAMETERS: *obj_list - Pointer to the list to be deleted | 266 | * PARAMETERS: obj_list - Pointer to the list to be deleted |
251 | * | 267 | * |
252 | * RETURN: None | 268 | * RETURN: None |
253 | * | 269 | * |
@@ -283,7 +299,7 @@ acpi_ut_delete_internal_object_list ( | |||
283 | * | 299 | * |
284 | * FUNCTION: acpi_ut_update_ref_count | 300 | * FUNCTION: acpi_ut_update_ref_count |
285 | * | 301 | * |
286 | * PARAMETERS: *Object - Object whose ref count is to be updated | 302 | * PARAMETERS: Object - Object whose ref count is to be updated |
287 | * Action - What to do | 303 | * Action - What to do |
288 | * | 304 | * |
289 | * RETURN: New ref count | 305 | * RETURN: New ref count |
@@ -312,7 +328,8 @@ acpi_ut_update_ref_count ( | |||
312 | new_count = count; | 328 | new_count = count; |
313 | 329 | ||
314 | /* | 330 | /* |
315 | * Perform the reference count action (increment, decrement, or force delete) | 331 | * Perform the reference count action |
332 | * (increment, decrement, or force delete) | ||
316 | */ | 333 | */ |
317 | switch (action) { | 334 | switch (action) { |
318 | 335 | ||
@@ -321,7 +338,8 @@ acpi_ut_update_ref_count ( | |||
321 | new_count++; | 338 | new_count++; |
322 | object->common.reference_count = new_count; | 339 | object->common.reference_count = new_count; |
323 | 340 | ||
324 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, [Incremented]\n", | 341 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
342 | "Obj %p Refs=%X, [Incremented]\n", | ||
325 | object, new_count)); | 343 | object, new_count)); |
326 | break; | 344 | break; |
327 | 345 | ||
@@ -329,7 +347,8 @@ acpi_ut_update_ref_count ( | |||
329 | case REF_DECREMENT: | 347 | case REF_DECREMENT: |
330 | 348 | ||
331 | if (count < 1) { | 349 | if (count < 1) { |
332 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, can't decrement! (Set to 0)\n", | 350 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
351 | "Obj %p Refs=%X, can't decrement! (Set to 0)\n", | ||
333 | object, new_count)); | 352 | object, new_count)); |
334 | 353 | ||
335 | new_count = 0; | 354 | new_count = 0; |
@@ -337,12 +356,14 @@ acpi_ut_update_ref_count ( | |||
337 | else { | 356 | else { |
338 | new_count--; | 357 | new_count--; |
339 | 358 | ||
340 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, [Decremented]\n", | 359 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
360 | "Obj %p Refs=%X, [Decremented]\n", | ||
341 | object, new_count)); | 361 | object, new_count)); |
342 | } | 362 | } |
343 | 363 | ||
344 | if (ACPI_GET_OBJECT_TYPE (object) == ACPI_TYPE_METHOD) { | 364 | if (ACPI_GET_OBJECT_TYPE (object) == ACPI_TYPE_METHOD) { |
345 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Method Obj %p Refs=%X, [Decremented]\n", | 365 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
366 | "Method Obj %p Refs=%X, [Decremented]\n", | ||
346 | object, new_count)); | 367 | object, new_count)); |
347 | } | 368 | } |
348 | 369 | ||
@@ -356,7 +377,8 @@ acpi_ut_update_ref_count ( | |||
356 | 377 | ||
357 | case REF_FORCE_DELETE: | 378 | case REF_FORCE_DELETE: |
358 | 379 | ||
359 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, Force delete! (Set to 0)\n", | 380 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
381 | "Obj %p Refs=%X, Force delete! (Set to 0)\n", | ||
360 | object, count)); | 382 | object, count)); |
361 | 383 | ||
362 | new_count = 0; | 384 | new_count = 0; |
@@ -390,7 +412,7 @@ acpi_ut_update_ref_count ( | |||
390 | * | 412 | * |
391 | * FUNCTION: acpi_ut_update_object_reference | 413 | * FUNCTION: acpi_ut_update_object_reference |
392 | * | 414 | * |
393 | * PARAMETERS: *Object - Increment ref count for this object | 415 | * PARAMETERS: Object - Increment ref count for this object |
394 | * and all sub-objects | 416 | * and all sub-objects |
395 | * Action - Either REF_INCREMENT or REF_DECREMENT or | 417 | * Action - Either REF_INCREMENT or REF_DECREMENT or |
396 | * REF_FORCE_DELETE | 418 | * REF_FORCE_DELETE |
@@ -431,7 +453,8 @@ acpi_ut_update_object_reference ( | |||
431 | /* Make sure that this isn't a namespace handle */ | 453 | /* Make sure that this isn't a namespace handle */ |
432 | 454 | ||
433 | if (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) { | 455 | if (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) { |
434 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p is NS handle\n", object)); | 456 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
457 | "Object %p is NS handle\n", object)); | ||
435 | return_ACPI_STATUS (AE_OK); | 458 | return_ACPI_STATUS (AE_OK); |
436 | } | 459 | } |
437 | 460 | ||
@@ -614,8 +637,8 @@ error_exit: | |||
614 | * | 637 | * |
615 | * FUNCTION: acpi_ut_add_reference | 638 | * FUNCTION: acpi_ut_add_reference |
616 | * | 639 | * |
617 | * PARAMETERS: *Object - Object whose reference count is to be | 640 | * PARAMETERS: Object - Object whose reference count is to be |
618 | * incremented | 641 | * incremented |
619 | * | 642 | * |
620 | * RETURN: None | 643 | * RETURN: None |
621 | * | 644 | * |
@@ -652,7 +675,7 @@ acpi_ut_add_reference ( | |||
652 | * | 675 | * |
653 | * FUNCTION: acpi_ut_remove_reference | 676 | * FUNCTION: acpi_ut_remove_reference |
654 | * | 677 | * |
655 | * PARAMETERS: *Object - Object whose ref count will be decremented | 678 | * PARAMETERS: Object - Object whose ref count will be decremented |
656 | * | 679 | * |
657 | * RETURN: None | 680 | * RETURN: None |
658 | * | 681 | * |
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index ead27d2c4d18..00046dd5d925 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c | |||
@@ -50,6 +50,19 @@ | |||
50 | #define _COMPONENT ACPI_UTILITIES | 50 | #define _COMPONENT ACPI_UTILITIES |
51 | ACPI_MODULE_NAME ("uteval") | 51 | ACPI_MODULE_NAME ("uteval") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
54 | |||
55 | static void | ||
56 | acpi_ut_copy_id_string ( | ||
57 | char *destination, | ||
58 | char *source, | ||
59 | acpi_size max_length); | ||
60 | |||
61 | static acpi_status | ||
62 | acpi_ut_translate_one_cid ( | ||
63 | union acpi_operand_object *obj_desc, | ||
64 | struct acpi_compatible_id *one_cid); | ||
65 | |||
53 | 66 | ||
54 | /******************************************************************************* | 67 | /******************************************************************************* |
55 | * | 68 | * |
@@ -237,9 +250,9 @@ acpi_ut_evaluate_object ( | |||
237 | * | 250 | * |
238 | * FUNCTION: acpi_ut_evaluate_numeric_object | 251 | * FUNCTION: acpi_ut_evaluate_numeric_object |
239 | * | 252 | * |
240 | * PARAMETERS: *object_name - Object name to be evaluated | 253 | * PARAMETERS: object_name - Object name to be evaluated |
241 | * device_node - Node for the device | 254 | * device_node - Node for the device |
242 | * *Address - Where the value is returned | 255 | * Address - Where the value is returned |
243 | * | 256 | * |
244 | * RETURN: Status | 257 | * RETURN: Status |
245 | * | 258 | * |
@@ -303,7 +316,6 @@ acpi_ut_copy_id_string ( | |||
303 | acpi_size max_length) | 316 | acpi_size max_length) |
304 | { | 317 | { |
305 | 318 | ||
306 | |||
307 | /* | 319 | /* |
308 | * Workaround for ID strings that have a leading asterisk. This construct | 320 | * Workaround for ID strings that have a leading asterisk. This construct |
309 | * is not allowed by the ACPI specification (ID strings must be | 321 | * is not allowed by the ACPI specification (ID strings must be |
@@ -325,7 +337,7 @@ acpi_ut_copy_id_string ( | |||
325 | * FUNCTION: acpi_ut_execute_HID | 337 | * FUNCTION: acpi_ut_execute_HID |
326 | * | 338 | * |
327 | * PARAMETERS: device_node - Node for the device | 339 | * PARAMETERS: device_node - Node for the device |
328 | * *Hid - Where the HID is returned | 340 | * Hid - Where the HID is returned |
329 | * | 341 | * |
330 | * RETURN: Status | 342 | * RETURN: Status |
331 | * | 343 | * |
@@ -429,7 +441,7 @@ acpi_ut_translate_one_cid ( | |||
429 | * FUNCTION: acpi_ut_execute_CID | 441 | * FUNCTION: acpi_ut_execute_CID |
430 | * | 442 | * |
431 | * PARAMETERS: device_node - Node for the device | 443 | * PARAMETERS: device_node - Node for the device |
432 | * *Cid - Where the CID is returned | 444 | * return_cid_list - Where the CID list is returned |
433 | * | 445 | * |
434 | * RETURN: Status | 446 | * RETURN: Status |
435 | * | 447 | * |
@@ -488,10 +500,10 @@ acpi_ut_execute_CID ( | |||
488 | cid_list->size = size; | 500 | cid_list->size = size; |
489 | 501 | ||
490 | /* | 502 | /* |
491 | * A _CID can return either a single compatible ID or a package of compatible | 503 | * A _CID can return either a single compatible ID or a package of |
492 | * IDs. Each compatible ID can be one of the following: | 504 | * compatible IDs. Each compatible ID can be one of the following: |
493 | * -- Number (32 bit compressed EISA ID) or | 505 | * 1) Integer (32 bit compressed EISA ID) or |
494 | * -- String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss"). | 506 | * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss") |
495 | */ | 507 | */ |
496 | 508 | ||
497 | /* The _CID object can be either a single CID or a package (list) of CIDs */ | 509 | /* The _CID object can be either a single CID or a package (list) of CIDs */ |
@@ -534,7 +546,7 @@ acpi_ut_execute_CID ( | |||
534 | * FUNCTION: acpi_ut_execute_UID | 546 | * FUNCTION: acpi_ut_execute_UID |
535 | * | 547 | * |
536 | * PARAMETERS: device_node - Node for the device | 548 | * PARAMETERS: device_node - Node for the device |
537 | * *Uid - Where the UID is returned | 549 | * Uid - Where the UID is returned |
538 | * | 550 | * |
539 | * RETURN: Status | 551 | * RETURN: Status |
540 | * | 552 | * |
@@ -587,7 +599,7 @@ acpi_ut_execute_UID ( | |||
587 | * FUNCTION: acpi_ut_execute_STA | 599 | * FUNCTION: acpi_ut_execute_STA |
588 | * | 600 | * |
589 | * PARAMETERS: device_node - Node for the device | 601 | * PARAMETERS: device_node - Node for the device |
590 | * *Flags - Where the status flags are returned | 602 | * Flags - Where the status flags are returned |
591 | * | 603 | * |
592 | * RETURN: Status | 604 | * RETURN: Status |
593 | * | 605 | * |
@@ -641,7 +653,7 @@ acpi_ut_execute_STA ( | |||
641 | * FUNCTION: acpi_ut_execute_Sxds | 653 | * FUNCTION: acpi_ut_execute_Sxds |
642 | * | 654 | * |
643 | * PARAMETERS: device_node - Node for the device | 655 | * PARAMETERS: device_node - Node for the device |
644 | * *Flags - Where the status flags are returned | 656 | * Flags - Where the status flags are returned |
645 | * | 657 | * |
646 | * RETURN: Status | 658 | * RETURN: Status |
647 | * | 659 | * |
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 25b0f8ae1bc6..4146019b543f 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c | |||
@@ -44,7 +44,6 @@ | |||
44 | #define DEFINE_ACPI_GLOBALS | 44 | #define DEFINE_ACPI_GLOBALS |
45 | 45 | ||
46 | #include <linux/module.h> | 46 | #include <linux/module.h> |
47 | |||
48 | #include <acpi/acpi.h> | 47 | #include <acpi/acpi.h> |
49 | #include <acpi/acnamesp.h> | 48 | #include <acpi/acnamesp.h> |
50 | 49 | ||
@@ -52,13 +51,14 @@ | |||
52 | ACPI_MODULE_NAME ("utglobal") | 51 | ACPI_MODULE_NAME ("utglobal") |
53 | 52 | ||
54 | 53 | ||
55 | /****************************************************************************** | 54 | /******************************************************************************* |
56 | * | 55 | * |
57 | * FUNCTION: acpi_format_exception | 56 | * FUNCTION: acpi_format_exception |
58 | * | 57 | * |
59 | * PARAMETERS: Status - The acpi_status code to be formatted | 58 | * PARAMETERS: Status - The acpi_status code to be formatted |
60 | * | 59 | * |
61 | * RETURN: A string containing the exception text | 60 | * RETURN: A string containing the exception text. A valid pointer is |
61 | * always returned. | ||
62 | * | 62 | * |
63 | * DESCRIPTION: This function translates an ACPI exception into an ASCII string. | 63 | * DESCRIPTION: This function translates an ACPI exception into an ASCII string. |
64 | * | 64 | * |
@@ -68,8 +68,8 @@ const char * | |||
68 | acpi_format_exception ( | 68 | acpi_format_exception ( |
69 | acpi_status status) | 69 | acpi_status status) |
70 | { | 70 | { |
71 | const char *exception = "UNKNOWN_STATUS_CODE"; | ||
72 | acpi_status sub_status; | 71 | acpi_status sub_status; |
72 | const char *exception = NULL; | ||
73 | 73 | ||
74 | 74 | ||
75 | ACPI_FUNCTION_NAME ("format_exception"); | 75 | ACPI_FUNCTION_NAME ("format_exception"); |
@@ -82,57 +82,55 @@ acpi_format_exception ( | |||
82 | 82 | ||
83 | if (sub_status <= AE_CODE_ENV_MAX) { | 83 | if (sub_status <= AE_CODE_ENV_MAX) { |
84 | exception = acpi_gbl_exception_names_env [sub_status]; | 84 | exception = acpi_gbl_exception_names_env [sub_status]; |
85 | break; | ||
86 | } | 85 | } |
87 | goto unknown; | 86 | break; |
88 | 87 | ||
89 | case AE_CODE_PROGRAMMER: | 88 | case AE_CODE_PROGRAMMER: |
90 | 89 | ||
91 | if (sub_status <= AE_CODE_PGM_MAX) { | 90 | if (sub_status <= AE_CODE_PGM_MAX) { |
92 | exception = acpi_gbl_exception_names_pgm [sub_status -1]; | 91 | exception = acpi_gbl_exception_names_pgm [sub_status -1]; |
93 | break; | ||
94 | } | 92 | } |
95 | goto unknown; | 93 | break; |
96 | 94 | ||
97 | case AE_CODE_ACPI_TABLES: | 95 | case AE_CODE_ACPI_TABLES: |
98 | 96 | ||
99 | if (sub_status <= AE_CODE_TBL_MAX) { | 97 | if (sub_status <= AE_CODE_TBL_MAX) { |
100 | exception = acpi_gbl_exception_names_tbl [sub_status -1]; | 98 | exception = acpi_gbl_exception_names_tbl [sub_status -1]; |
101 | break; | ||
102 | } | 99 | } |
103 | goto unknown; | 100 | break; |
104 | 101 | ||
105 | case AE_CODE_AML: | 102 | case AE_CODE_AML: |
106 | 103 | ||
107 | if (sub_status <= AE_CODE_AML_MAX) { | 104 | if (sub_status <= AE_CODE_AML_MAX) { |
108 | exception = acpi_gbl_exception_names_aml [sub_status -1]; | 105 | exception = acpi_gbl_exception_names_aml [sub_status -1]; |
109 | break; | ||
110 | } | 106 | } |
111 | goto unknown; | 107 | break; |
112 | 108 | ||
113 | case AE_CODE_CONTROL: | 109 | case AE_CODE_CONTROL: |
114 | 110 | ||
115 | if (sub_status <= AE_CODE_CTRL_MAX) { | 111 | if (sub_status <= AE_CODE_CTRL_MAX) { |
116 | exception = acpi_gbl_exception_names_ctrl [sub_status -1]; | 112 | exception = acpi_gbl_exception_names_ctrl [sub_status -1]; |
117 | break; | ||
118 | } | 113 | } |
119 | goto unknown; | 114 | break; |
120 | 115 | ||
121 | default: | 116 | default: |
122 | goto unknown; | 117 | break; |
123 | } | 118 | } |
124 | 119 | ||
120 | if (!exception) { | ||
121 | /* Exception code was not recognized */ | ||
125 | 122 | ||
126 | return ((const char *) exception); | 123 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
124 | "Unknown exception code: 0x%8.8X\n", status)); | ||
127 | 125 | ||
128 | unknown: | 126 | return ((const char *) "UNKNOWN_STATUS_CODE"); |
127 | } | ||
129 | 128 | ||
130 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown exception code: 0x%8.8X\n", status)); | ||
131 | return ((const char *) exception); | 129 | return ((const char *) exception); |
132 | } | 130 | } |
133 | 131 | ||
134 | 132 | ||
135 | /****************************************************************************** | 133 | /******************************************************************************* |
136 | * | 134 | * |
137 | * Static global variable initialization. | 135 | * Static global variable initialization. |
138 | * | 136 | * |
@@ -212,13 +210,12 @@ const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STR | |||
212 | }; | 210 | }; |
213 | 211 | ||
214 | 212 | ||
215 | /****************************************************************************** | 213 | /******************************************************************************* |
216 | * | 214 | * |
217 | * Namespace globals | 215 | * Namespace globals |
218 | * | 216 | * |
219 | ******************************************************************************/ | 217 | ******************************************************************************/ |
220 | 218 | ||
221 | |||
222 | /* | 219 | /* |
223 | * Predefined ACPI Names (Built-in to the Interpreter) | 220 | * Predefined ACPI Names (Built-in to the Interpreter) |
224 | * | 221 | * |
@@ -241,9 +238,11 @@ const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = | |||
241 | #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) | 238 | #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) |
242 | {"_OSI", ACPI_TYPE_METHOD, (char *) 1}, | 239 | {"_OSI", ACPI_TYPE_METHOD, (char *) 1}, |
243 | #endif | 240 | #endif |
244 | {NULL, ACPI_TYPE_ANY, NULL} /* Table terminator */ | ||
245 | }; | ||
246 | 241 | ||
242 | /* Table terminator */ | ||
243 | |||
244 | {NULL, ACPI_TYPE_ANY, NULL} | ||
245 | }; | ||
247 | 246 | ||
248 | /* | 247 | /* |
249 | * Properties of the ACPI Object Types, both internal and external. | 248 | * Properties of the ACPI Object Types, both internal and external. |
@@ -288,22 +287,25 @@ const u8 acpi_gbl_ns_properties[] = | |||
288 | /* Hex to ASCII conversion table */ | 287 | /* Hex to ASCII conversion table */ |
289 | 288 | ||
290 | static const char acpi_gbl_hex_to_ascii[] = | 289 | static const char acpi_gbl_hex_to_ascii[] = |
291 | {'0','1','2','3','4','5','6','7', | 290 | { |
292 | '8','9','A','B','C','D','E','F'}; | 291 | '0','1','2','3','4','5','6','7', |
292 | '8','9','A','B','C','D','E','F' | ||
293 | }; | ||
294 | |||
293 | 295 | ||
294 | /***************************************************************************** | 296 | /******************************************************************************* |
295 | * | 297 | * |
296 | * FUNCTION: acpi_ut_hex_to_ascii_char | 298 | * FUNCTION: acpi_ut_hex_to_ascii_char |
297 | * | 299 | * |
298 | * PARAMETERS: Integer - Contains the hex digit | 300 | * PARAMETERS: Integer - Contains the hex digit |
299 | * Position - bit position of the digit within the | 301 | * Position - bit position of the digit within the |
300 | * integer | 302 | * integer (multiple of 4) |
301 | * | 303 | * |
302 | * RETURN: Ascii character | 304 | * RETURN: The converted Ascii character |
303 | * | 305 | * |
304 | * DESCRIPTION: Convert a hex digit to an ascii character | 306 | * DESCRIPTION: Convert a hex digit to an Ascii character |
305 | * | 307 | * |
306 | ****************************************************************************/ | 308 | ******************************************************************************/ |
307 | 309 | ||
308 | char | 310 | char |
309 | acpi_ut_hex_to_ascii_char ( | 311 | acpi_ut_hex_to_ascii_char ( |
@@ -315,7 +317,7 @@ acpi_ut_hex_to_ascii_char ( | |||
315 | } | 317 | } |
316 | 318 | ||
317 | 319 | ||
318 | /****************************************************************************** | 320 | /******************************************************************************* |
319 | * | 321 | * |
320 | * Table name globals | 322 | * Table name globals |
321 | * | 323 | * |
@@ -324,7 +326,7 @@ acpi_ut_hex_to_ascii_char ( | |||
324 | * that are not used by the subsystem are simply ignored. | 326 | * that are not used by the subsystem are simply ignored. |
325 | * | 327 | * |
326 | * Do NOT add any table to this list that is not consumed directly by this | 328 | * Do NOT add any table to this list that is not consumed directly by this |
327 | * subsystem. | 329 | * subsystem (No MADT, ECDT, SBST, etc.) |
328 | * | 330 | * |
329 | ******************************************************************************/ | 331 | ******************************************************************************/ |
330 | 332 | ||
@@ -391,7 +393,7 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVE | |||
391 | /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE}, | 393 | /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE}, |
392 | }; | 394 | }; |
393 | 395 | ||
394 | /***************************************************************************** | 396 | /******************************************************************************* |
395 | * | 397 | * |
396 | * FUNCTION: acpi_ut_get_region_name | 398 | * FUNCTION: acpi_ut_get_region_name |
397 | * | 399 | * |
@@ -401,7 +403,7 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVE | |||
401 | * | 403 | * |
402 | * DESCRIPTION: Translate a Space ID into a name string (Debug only) | 404 | * DESCRIPTION: Translate a Space ID into a name string (Debug only) |
403 | * | 405 | * |
404 | ****************************************************************************/ | 406 | ******************************************************************************/ |
405 | 407 | ||
406 | /* Region type decoding */ | 408 | /* Region type decoding */ |
407 | 409 | ||
@@ -429,7 +431,6 @@ acpi_ut_get_region_name ( | |||
429 | { | 431 | { |
430 | return ("user_defined_region"); | 432 | return ("user_defined_region"); |
431 | } | 433 | } |
432 | |||
433 | else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) | 434 | else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) |
434 | { | 435 | { |
435 | return ("invalid_space_id"); | 436 | return ("invalid_space_id"); |
@@ -439,7 +440,7 @@ acpi_ut_get_region_name ( | |||
439 | } | 440 | } |
440 | 441 | ||
441 | 442 | ||
442 | /***************************************************************************** | 443 | /******************************************************************************* |
443 | * | 444 | * |
444 | * FUNCTION: acpi_ut_get_event_name | 445 | * FUNCTION: acpi_ut_get_event_name |
445 | * | 446 | * |
@@ -449,7 +450,7 @@ acpi_ut_get_region_name ( | |||
449 | * | 450 | * |
450 | * DESCRIPTION: Translate a Event ID into a name string (Debug only) | 451 | * DESCRIPTION: Translate a Event ID into a name string (Debug only) |
451 | * | 452 | * |
452 | ****************************************************************************/ | 453 | ******************************************************************************/ |
453 | 454 | ||
454 | /* Event type decoding */ | 455 | /* Event type decoding */ |
455 | 456 | ||
@@ -477,7 +478,7 @@ acpi_ut_get_event_name ( | |||
477 | } | 478 | } |
478 | 479 | ||
479 | 480 | ||
480 | /***************************************************************************** | 481 | /******************************************************************************* |
481 | * | 482 | * |
482 | * FUNCTION: acpi_ut_get_type_name | 483 | * FUNCTION: acpi_ut_get_type_name |
483 | * | 484 | * |
@@ -487,20 +488,21 @@ acpi_ut_get_event_name ( | |||
487 | * | 488 | * |
488 | * DESCRIPTION: Translate a Type ID into a name string (Debug only) | 489 | * DESCRIPTION: Translate a Type ID into a name string (Debug only) |
489 | * | 490 | * |
490 | ****************************************************************************/ | 491 | ******************************************************************************/ |
491 | 492 | ||
492 | /* | 493 | /* |
493 | * Elements of acpi_gbl_ns_type_names below must match | 494 | * Elements of acpi_gbl_ns_type_names below must match |
494 | * one-to-one with values of acpi_object_type | 495 | * one-to-one with values of acpi_object_type |
495 | * | 496 | * |
496 | * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; when | 497 | * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; |
497 | * stored in a table it really means that we have thus far seen no evidence to | 498 | * when stored in a table it really means that we have thus far seen no |
498 | * indicate what type is actually going to be stored for this entry. | 499 | * evidence to indicate what type is actually going to be stored for this entry. |
499 | */ | 500 | */ |
500 | static const char acpi_gbl_bad_type[] = "UNDEFINED"; | 501 | static const char acpi_gbl_bad_type[] = "UNDEFINED"; |
501 | #define TYPE_NAME_LENGTH 12 /* Maximum length of each string */ | ||
502 | 502 | ||
503 | static const char *acpi_gbl_ns_type_names[] = /* printable names of ACPI types */ | 503 | /* Printable names of the ACPI object types */ |
504 | |||
505 | static const char *acpi_gbl_ns_type_names[] = | ||
504 | { | 506 | { |
505 | /* 00 */ "Untyped", | 507 | /* 00 */ "Untyped", |
506 | /* 01 */ "Integer", | 508 | /* 01 */ "Integer", |
@@ -564,7 +566,7 @@ acpi_ut_get_object_type_name ( | |||
564 | } | 566 | } |
565 | 567 | ||
566 | 568 | ||
567 | /***************************************************************************** | 569 | /******************************************************************************* |
568 | * | 570 | * |
569 | * FUNCTION: acpi_ut_get_node_name | 571 | * FUNCTION: acpi_ut_get_node_name |
570 | * | 572 | * |
@@ -574,7 +576,7 @@ acpi_ut_get_object_type_name ( | |||
574 | * | 576 | * |
575 | * DESCRIPTION: Validate the node and return the node's ACPI name. | 577 | * DESCRIPTION: Validate the node and return the node's ACPI name. |
576 | * | 578 | * |
577 | ****************************************************************************/ | 579 | ******************************************************************************/ |
578 | 580 | ||
579 | char * | 581 | char * |
580 | acpi_ut_get_node_name ( | 582 | acpi_ut_get_node_name ( |
@@ -618,7 +620,7 @@ acpi_ut_get_node_name ( | |||
618 | } | 620 | } |
619 | 621 | ||
620 | 622 | ||
621 | /***************************************************************************** | 623 | /******************************************************************************* |
622 | * | 624 | * |
623 | * FUNCTION: acpi_ut_get_descriptor_name | 625 | * FUNCTION: acpi_ut_get_descriptor_name |
624 | * | 626 | * |
@@ -628,9 +630,11 @@ acpi_ut_get_node_name ( | |||
628 | * | 630 | * |
629 | * DESCRIPTION: Validate object and return the descriptor type | 631 | * DESCRIPTION: Validate object and return the descriptor type |
630 | * | 632 | * |
631 | ****************************************************************************/ | 633 | ******************************************************************************/ |
634 | |||
635 | /* Printable names of object descriptor types */ | ||
632 | 636 | ||
633 | static const char *acpi_gbl_desc_type_names[] = /* printable names of descriptor types */ | 637 | static const char *acpi_gbl_desc_type_names[] = |
634 | { | 638 | { |
635 | /* 00 */ "Invalid", | 639 | /* 00 */ "Invalid", |
636 | /* 01 */ "Cached", | 640 | /* 01 */ "Cached", |
@@ -676,17 +680,18 @@ acpi_ut_get_descriptor_name ( | |||
676 | * Strings and procedures used for debug only | 680 | * Strings and procedures used for debug only |
677 | */ | 681 | */ |
678 | 682 | ||
679 | /***************************************************************************** | 683 | /******************************************************************************* |
680 | * | 684 | * |
681 | * FUNCTION: acpi_ut_get_mutex_name | 685 | * FUNCTION: acpi_ut_get_mutex_name |
682 | * | 686 | * |
683 | * PARAMETERS: None. | 687 | * PARAMETERS: mutex_id - The predefined ID for this mutex. |
684 | * | 688 | * |
685 | * RETURN: Status | 689 | * RETURN: String containing the name of the mutex. Always returns a valid |
690 | * pointer. | ||
686 | * | 691 | * |
687 | * DESCRIPTION: Translate a mutex ID into a name string (Debug only) | 692 | * DESCRIPTION: Translate a mutex ID into a name string (Debug only) |
688 | * | 693 | * |
689 | ****************************************************************************/ | 694 | ******************************************************************************/ |
690 | 695 | ||
691 | char * | 696 | char * |
692 | acpi_ut_get_mutex_name ( | 697 | acpi_ut_get_mutex_name ( |
@@ -700,21 +705,20 @@ acpi_ut_get_mutex_name ( | |||
700 | 705 | ||
701 | return (acpi_gbl_mutex_names[mutex_id]); | 706 | return (acpi_gbl_mutex_names[mutex_id]); |
702 | } | 707 | } |
703 | |||
704 | #endif | 708 | #endif |
705 | 709 | ||
706 | 710 | ||
707 | /***************************************************************************** | 711 | /******************************************************************************* |
708 | * | 712 | * |
709 | * FUNCTION: acpi_ut_valid_object_type | 713 | * FUNCTION: acpi_ut_valid_object_type |
710 | * | 714 | * |
711 | * PARAMETERS: Type - Object type to be validated | 715 | * PARAMETERS: Type - Object type to be validated |
712 | * | 716 | * |
713 | * RETURN: TRUE if valid object type | 717 | * RETURN: TRUE if valid object type, FALSE otherwise |
714 | * | 718 | * |
715 | * DESCRIPTION: Validate an object type | 719 | * DESCRIPTION: Validate an object type |
716 | * | 720 | * |
717 | ****************************************************************************/ | 721 | ******************************************************************************/ |
718 | 722 | ||
719 | u8 | 723 | u8 |
720 | acpi_ut_valid_object_type ( | 724 | acpi_ut_valid_object_type ( |
@@ -732,7 +736,7 @@ acpi_ut_valid_object_type ( | |||
732 | } | 736 | } |
733 | 737 | ||
734 | 738 | ||
735 | /**************************************************************************** | 739 | /******************************************************************************* |
736 | * | 740 | * |
737 | * FUNCTION: acpi_ut_allocate_owner_id | 741 | * FUNCTION: acpi_ut_allocate_owner_id |
738 | * | 742 | * |
@@ -740,7 +744,10 @@ acpi_ut_valid_object_type ( | |||
740 | * | 744 | * |
741 | * DESCRIPTION: Allocate a table or method owner id | 745 | * DESCRIPTION: Allocate a table or method owner id |
742 | * | 746 | * |
743 | ***************************************************************************/ | 747 | * NOTE: this algorithm has a wraparound problem at 64_k method invocations, and |
748 | * should be revisited (TBD) | ||
749 | * | ||
750 | ******************************************************************************/ | ||
744 | 751 | ||
745 | acpi_owner_id | 752 | acpi_owner_id |
746 | acpi_ut_allocate_owner_id ( | 753 | acpi_ut_allocate_owner_id ( |
@@ -796,16 +803,18 @@ acpi_ut_allocate_owner_id ( | |||
796 | } | 803 | } |
797 | 804 | ||
798 | 805 | ||
799 | /**************************************************************************** | 806 | /******************************************************************************* |
800 | * | 807 | * |
801 | * FUNCTION: acpi_ut_init_globals | 808 | * FUNCTION: acpi_ut_init_globals |
802 | * | 809 | * |
803 | * PARAMETERS: none | 810 | * PARAMETERS: None |
811 | * | ||
812 | * RETURN: None | ||
804 | * | 813 | * |
805 | * DESCRIPTION: Init library globals. All globals that require specific | 814 | * DESCRIPTION: Init library globals. All globals that require specific |
806 | * initialization should be initialized here! | 815 | * initialization should be initialized here! |
807 | * | 816 | * |
808 | ***************************************************************************/ | 817 | ******************************************************************************/ |
809 | 818 | ||
810 | void | 819 | void |
811 | acpi_ut_init_globals ( | 820 | acpi_ut_init_globals ( |
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c index bdbadaf48d29..7f3713889ff0 100644 --- a/drivers/acpi/utilities/utinit.c +++ b/drivers/acpi/utilities/utinit.c | |||
@@ -49,19 +49,29 @@ | |||
49 | #define _COMPONENT ACPI_UTILITIES | 49 | #define _COMPONENT ACPI_UTILITIES |
50 | ACPI_MODULE_NAME ("utinit") | 50 | ACPI_MODULE_NAME ("utinit") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static void | ||
55 | acpi_ut_fadt_register_error ( | ||
56 | char *register_name, | ||
57 | u32 value, | ||
58 | acpi_size offset); | ||
59 | |||
60 | static void acpi_ut_terminate ( | ||
61 | void); | ||
62 | |||
52 | 63 | ||
53 | /******************************************************************************* | 64 | /******************************************************************************* |
54 | * | 65 | * |
55 | * FUNCTION: acpi_ut_fadt_register_error | 66 | * FUNCTION: acpi_ut_fadt_register_error |
56 | * | 67 | * |
57 | * PARAMETERS: *register_name - Pointer to string identifying register | 68 | * PARAMETERS: register_name - Pointer to string identifying register |
58 | * Value - Actual register contents value | 69 | * Value - Actual register contents value |
59 | * acpi_test_spec_section - TDS section containing assertion | 70 | * Offset - Byte offset in the FADT |
60 | * acpi_assertion - Assertion number being tested | ||
61 | * | 71 | * |
62 | * RETURN: AE_BAD_VALUE | 72 | * RETURN: AE_BAD_VALUE |
63 | * | 73 | * |
64 | * DESCRIPTION: Display failure message and link failure to TDS assertion | 74 | * DESCRIPTION: Display failure message |
65 | * | 75 | * |
66 | ******************************************************************************/ | 76 | ******************************************************************************/ |
67 | 77 | ||
@@ -166,12 +176,13 @@ acpi_ut_validate_fadt ( | |||
166 | * | 176 | * |
167 | * RETURN: none | 177 | * RETURN: none |
168 | * | 178 | * |
169 | * DESCRIPTION: free global memory | 179 | * DESCRIPTION: Free global memory |
170 | * | 180 | * |
171 | ******************************************************************************/ | 181 | ******************************************************************************/ |
172 | 182 | ||
173 | void | 183 | static void |
174 | acpi_ut_terminate (void) | 184 | acpi_ut_terminate ( |
185 | void) | ||
175 | { | 186 | { |
176 | struct acpi_gpe_block_info *gpe_block; | 187 | struct acpi_gpe_block_info *gpe_block; |
177 | struct acpi_gpe_block_info *next_gpe_block; | 188 | struct acpi_gpe_block_info *next_gpe_block; |
@@ -183,8 +194,6 @@ acpi_ut_terminate (void) | |||
183 | 194 | ||
184 | 195 | ||
185 | /* Free global tables, etc. */ | 196 | /* Free global tables, etc. */ |
186 | |||
187 | |||
188 | /* Free global GPE blocks and related info structures */ | 197 | /* Free global GPE blocks and related info structures */ |
189 | 198 | ||
190 | gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; | 199 | gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; |
@@ -221,7 +230,8 @@ acpi_ut_terminate (void) | |||
221 | ******************************************************************************/ | 230 | ******************************************************************************/ |
222 | 231 | ||
223 | void | 232 | void |
224 | acpi_ut_subsystem_shutdown (void) | 233 | acpi_ut_subsystem_shutdown ( |
234 | void) | ||
225 | { | 235 | { |
226 | 236 | ||
227 | ACPI_FUNCTION_TRACE ("ut_subsystem_shutdown"); | 237 | ACPI_FUNCTION_TRACE ("ut_subsystem_shutdown"); |
@@ -229,14 +239,16 @@ acpi_ut_subsystem_shutdown (void) | |||
229 | /* Just exit if subsystem is already shutdown */ | 239 | /* Just exit if subsystem is already shutdown */ |
230 | 240 | ||
231 | if (acpi_gbl_shutdown) { | 241 | if (acpi_gbl_shutdown) { |
232 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "ACPI Subsystem is already terminated\n")); | 242 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
243 | "ACPI Subsystem is already terminated\n")); | ||
233 | return_VOID; | 244 | return_VOID; |
234 | } | 245 | } |
235 | 246 | ||
236 | /* Subsystem appears active, go ahead and shut it down */ | 247 | /* Subsystem appears active, go ahead and shut it down */ |
237 | 248 | ||
238 | acpi_gbl_shutdown = TRUE; | 249 | acpi_gbl_shutdown = TRUE; |
239 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem...\n")); | 250 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
251 | "Shutting down ACPI Subsystem...\n")); | ||
240 | 252 | ||
241 | /* Close the acpi_event Handling */ | 253 | /* Close the acpi_event Handling */ |
242 | 254 | ||
diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c index 2525c1a93547..0d527c91543c 100644 --- a/drivers/acpi/utilities/utmath.c +++ b/drivers/acpi/utilities/utmath.c | |||
@@ -259,6 +259,8 @@ acpi_ut_divide ( | |||
259 | * | 259 | * |
260 | * FUNCTION: acpi_ut_short_divide, acpi_ut_divide | 260 | * FUNCTION: acpi_ut_short_divide, acpi_ut_divide |
261 | * | 261 | * |
262 | * PARAMETERS: See function headers above | ||
263 | * | ||
262 | * DESCRIPTION: Native versions of the ut_divide functions. Use these if either | 264 | * DESCRIPTION: Native versions of the ut_divide functions. Use these if either |
263 | * 1) The target is a 64-bit platform and therefore 64-bit | 265 | * 1) The target is a 64-bit platform and therefore 64-bit |
264 | * integer math is supported directly by the machine. | 266 | * integer math is supported directly by the machine. |
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index f6598547389b..f6de4ed3d527 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c | |||
@@ -49,12 +49,57 @@ | |||
49 | #define _COMPONENT ACPI_UTILITIES | 49 | #define _COMPONENT ACPI_UTILITIES |
50 | ACPI_MODULE_NAME ("utmisc") | 50 | ACPI_MODULE_NAME ("utmisc") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static acpi_status | ||
55 | acpi_ut_create_mutex ( | ||
56 | acpi_mutex_handle mutex_id); | ||
57 | |||
58 | static acpi_status | ||
59 | acpi_ut_delete_mutex ( | ||
60 | acpi_mutex_handle mutex_id); | ||
61 | |||
62 | |||
63 | /******************************************************************************* | ||
64 | * | ||
65 | * FUNCTION: acpi_ut_strupr (strupr) | ||
66 | * | ||
67 | * PARAMETERS: src_string - The source string to convert | ||
68 | * | ||
69 | * RETURN: Converted src_string (same as input pointer) | ||
70 | * | ||
71 | * DESCRIPTION: Convert string to uppercase | ||
72 | * | ||
73 | * NOTE: This is not a POSIX function, so it appears here, not in utclib.c | ||
74 | * | ||
75 | ******************************************************************************/ | ||
76 | |||
77 | char * | ||
78 | acpi_ut_strupr ( | ||
79 | char *src_string) | ||
80 | { | ||
81 | char *string; | ||
82 | |||
83 | |||
84 | ACPI_FUNCTION_ENTRY (); | ||
85 | |||
86 | |||
87 | /* Walk entire string, uppercasing the letters */ | ||
88 | |||
89 | for (string = src_string; *string; string++) { | ||
90 | *string = (char) ACPI_TOUPPER (*string); | ||
91 | } | ||
92 | |||
93 | return (src_string); | ||
94 | } | ||
95 | |||
52 | 96 | ||
53 | /******************************************************************************* | 97 | /******************************************************************************* |
54 | * | 98 | * |
55 | * FUNCTION: acpi_ut_print_string | 99 | * FUNCTION: acpi_ut_print_string |
56 | * | 100 | * |
57 | * PARAMETERS: String - Null terminated ASCII string | 101 | * PARAMETERS: String - Null terminated ASCII string |
102 | * max_length - Maximum output length | ||
58 | * | 103 | * |
59 | * RETURN: None | 104 | * RETURN: None |
60 | * | 105 | * |
@@ -148,6 +193,8 @@ acpi_ut_print_string ( | |||
148 | * | 193 | * |
149 | * PARAMETERS: Value - Value to be converted | 194 | * PARAMETERS: Value - Value to be converted |
150 | * | 195 | * |
196 | * RETURN: u32 integer with bytes swapped | ||
197 | * | ||
151 | * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes) | 198 | * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes) |
152 | * | 199 | * |
153 | ******************************************************************************/ | 200 | ******************************************************************************/ |
@@ -160,7 +207,6 @@ acpi_ut_dword_byte_swap ( | |||
160 | u32 value; | 207 | u32 value; |
161 | u8 bytes[4]; | 208 | u8 bytes[4]; |
162 | } out; | 209 | } out; |
163 | |||
164 | union { | 210 | union { |
165 | u32 value; | 211 | u32 value; |
166 | u8 bytes[4]; | 212 | u8 bytes[4]; |
@@ -219,7 +265,8 @@ acpi_ut_set_integer_width ( | |||
219 | * | 265 | * |
220 | * FUNCTION: acpi_ut_display_init_pathname | 266 | * FUNCTION: acpi_ut_display_init_pathname |
221 | * | 267 | * |
222 | * PARAMETERS: obj_handle - Handle whose pathname will be displayed | 268 | * PARAMETERS: Type - Object type of the node |
269 | * obj_handle - Handle whose pathname will be displayed | ||
223 | * Path - Additional path string to be appended. | 270 | * Path - Additional path string to be appended. |
224 | * (NULL if no extra path) | 271 | * (NULL if no extra path) |
225 | * | 272 | * |
@@ -270,7 +317,8 @@ acpi_ut_display_init_pathname ( | |||
270 | 317 | ||
271 | /* Print the object type and pathname */ | 318 | /* Print the object type and pathname */ |
272 | 319 | ||
273 | acpi_os_printf ("%-12s %s", acpi_ut_get_type_name (type), (char *) buffer.pointer); | 320 | acpi_os_printf ("%-12s %s", |
321 | acpi_ut_get_type_name (type), (char *) buffer.pointer); | ||
274 | 322 | ||
275 | /* Extra path is used to append names like _STA, _INI, etc. */ | 323 | /* Extra path is used to append names like _STA, _INI, etc. */ |
276 | 324 | ||
@@ -288,9 +336,9 @@ acpi_ut_display_init_pathname ( | |||
288 | * | 336 | * |
289 | * FUNCTION: acpi_ut_valid_acpi_name | 337 | * FUNCTION: acpi_ut_valid_acpi_name |
290 | * | 338 | * |
291 | * PARAMETERS: Character - The character to be examined | 339 | * PARAMETERS: Name - The name to be examined |
292 | * | 340 | * |
293 | * RETURN: 1 if Character may appear in a name, else 0 | 341 | * RETURN: TRUE if the name is valid, FALSE otherwise |
294 | * | 342 | * |
295 | * DESCRIPTION: Check for a valid ACPI name. Each character must be one of: | 343 | * DESCRIPTION: Check for a valid ACPI name. Each character must be one of: |
296 | * 1) Upper case alpha | 344 | * 1) Upper case alpha |
@@ -495,40 +543,6 @@ error_exit: | |||
495 | 543 | ||
496 | /******************************************************************************* | 544 | /******************************************************************************* |
497 | * | 545 | * |
498 | * FUNCTION: acpi_ut_strupr | ||
499 | * | ||
500 | * PARAMETERS: src_string - The source string to convert to | ||
501 | * | ||
502 | * RETURN: src_string | ||
503 | * | ||
504 | * DESCRIPTION: Convert string to uppercase | ||
505 | * | ||
506 | ******************************************************************************/ | ||
507 | #ifdef ACPI_FUTURE_USAGE | ||
508 | char * | ||
509 | acpi_ut_strupr ( | ||
510 | char *src_string) | ||
511 | { | ||
512 | char *string; | ||
513 | |||
514 | |||
515 | ACPI_FUNCTION_ENTRY (); | ||
516 | |||
517 | |||
518 | /* Walk entire string, uppercasing the letters */ | ||
519 | |||
520 | for (string = src_string; *string; ) { | ||
521 | *string = (char) ACPI_TOUPPER (*string); | ||
522 | string++; | ||
523 | } | ||
524 | |||
525 | return (src_string); | ||
526 | } | ||
527 | #endif /* ACPI_FUTURE_USAGE */ | ||
528 | |||
529 | |||
530 | /******************************************************************************* | ||
531 | * | ||
532 | * FUNCTION: acpi_ut_mutex_initialize | 546 | * FUNCTION: acpi_ut_mutex_initialize |
533 | * | 547 | * |
534 | * PARAMETERS: None. | 548 | * PARAMETERS: None. |
@@ -611,7 +625,7 @@ acpi_ut_mutex_terminate ( | |||
611 | * | 625 | * |
612 | ******************************************************************************/ | 626 | ******************************************************************************/ |
613 | 627 | ||
614 | acpi_status | 628 | static acpi_status |
615 | acpi_ut_create_mutex ( | 629 | acpi_ut_create_mutex ( |
616 | acpi_mutex_handle mutex_id) | 630 | acpi_mutex_handle mutex_id) |
617 | { | 631 | { |
@@ -648,7 +662,7 @@ acpi_ut_create_mutex ( | |||
648 | * | 662 | * |
649 | ******************************************************************************/ | 663 | ******************************************************************************/ |
650 | 664 | ||
651 | acpi_status | 665 | static acpi_status |
652 | acpi_ut_delete_mutex ( | 666 | acpi_ut_delete_mutex ( |
653 | acpi_mutex_handle mutex_id) | 667 | acpi_mutex_handle mutex_id) |
654 | { | 668 | { |
@@ -715,16 +729,16 @@ acpi_ut_acquire_mutex ( | |||
715 | if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { | 729 | if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { |
716 | if (i == mutex_id) { | 730 | if (i == mutex_id) { |
717 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 731 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
718 | "Mutex [%s] already acquired by this thread [%X]\n", | 732 | "Mutex [%s] already acquired by this thread [%X]\n", |
719 | acpi_ut_get_mutex_name (mutex_id), this_thread_id)); | 733 | acpi_ut_get_mutex_name (mutex_id), this_thread_id)); |
720 | 734 | ||
721 | return (AE_ALREADY_ACQUIRED); | 735 | return (AE_ALREADY_ACQUIRED); |
722 | } | 736 | } |
723 | 737 | ||
724 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 738 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
725 | "Invalid acquire order: Thread %X owns [%s], wants [%s]\n", | 739 | "Invalid acquire order: Thread %X owns [%s], wants [%s]\n", |
726 | this_thread_id, acpi_ut_get_mutex_name (i), | 740 | this_thread_id, acpi_ut_get_mutex_name (i), |
727 | acpi_ut_get_mutex_name (mutex_id))); | 741 | acpi_ut_get_mutex_name (mutex_id))); |
728 | 742 | ||
729 | return (AE_ACQUIRE_DEADLOCK); | 743 | return (AE_ACQUIRE_DEADLOCK); |
730 | } | 744 | } |
@@ -733,22 +747,23 @@ acpi_ut_acquire_mutex ( | |||
733 | #endif | 747 | #endif |
734 | 748 | ||
735 | ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, | 749 | ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, |
736 | "Thread %X attempting to acquire Mutex [%s]\n", | 750 | "Thread %X attempting to acquire Mutex [%s]\n", |
737 | this_thread_id, acpi_ut_get_mutex_name (mutex_id))); | 751 | this_thread_id, acpi_ut_get_mutex_name (mutex_id))); |
738 | 752 | ||
739 | status = acpi_os_wait_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, | 753 | status = acpi_os_wait_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, |
740 | 1, ACPI_WAIT_FOREVER); | 754 | 1, ACPI_WAIT_FOREVER); |
741 | if (ACPI_SUCCESS (status)) { | 755 | if (ACPI_SUCCESS (status)) { |
742 | ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n", | 756 | ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n", |
743 | this_thread_id, acpi_ut_get_mutex_name (mutex_id))); | 757 | this_thread_id, acpi_ut_get_mutex_name (mutex_id))); |
744 | 758 | ||
745 | acpi_gbl_mutex_info[mutex_id].use_count++; | 759 | acpi_gbl_mutex_info[mutex_id].use_count++; |
746 | acpi_gbl_mutex_info[mutex_id].owner_id = this_thread_id; | 760 | acpi_gbl_mutex_info[mutex_id].owner_id = this_thread_id; |
747 | } | 761 | } |
748 | else { | 762 | else { |
749 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not acquire Mutex [%s] %s\n", | 763 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
750 | this_thread_id, acpi_ut_get_mutex_name (mutex_id), | 764 | "Thread %X could not acquire Mutex [%s] %s\n", |
751 | acpi_format_exception (status))); | 765 | this_thread_id, acpi_ut_get_mutex_name (mutex_id), |
766 | acpi_format_exception (status))); | ||
752 | } | 767 | } |
753 | 768 | ||
754 | return (status); | 769 | return (status); |
@@ -793,8 +808,8 @@ acpi_ut_release_mutex ( | |||
793 | */ | 808 | */ |
794 | if (acpi_gbl_mutex_info[mutex_id].owner_id == ACPI_MUTEX_NOT_ACQUIRED) { | 809 | if (acpi_gbl_mutex_info[mutex_id].owner_id == ACPI_MUTEX_NOT_ACQUIRED) { |
795 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 810 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
796 | "Mutex [%s] is not acquired, cannot release\n", | 811 | "Mutex [%s] is not acquired, cannot release\n", |
797 | acpi_ut_get_mutex_name (mutex_id))); | 812 | acpi_ut_get_mutex_name (mutex_id))); |
798 | 813 | ||
799 | return (AE_NOT_ACQUIRED); | 814 | return (AE_NOT_ACQUIRED); |
800 | } | 815 | } |
@@ -812,8 +827,8 @@ acpi_ut_release_mutex ( | |||
812 | } | 827 | } |
813 | 828 | ||
814 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 829 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
815 | "Invalid release order: owns [%s], releasing [%s]\n", | 830 | "Invalid release order: owns [%s], releasing [%s]\n", |
816 | acpi_ut_get_mutex_name (i), acpi_ut_get_mutex_name (mutex_id))); | 831 | acpi_ut_get_mutex_name (i), acpi_ut_get_mutex_name (mutex_id))); |
817 | 832 | ||
818 | return (AE_RELEASE_DEADLOCK); | 833 | return (AE_RELEASE_DEADLOCK); |
819 | } | 834 | } |
@@ -826,13 +841,14 @@ acpi_ut_release_mutex ( | |||
826 | status = acpi_os_signal_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, 1); | 841 | status = acpi_os_signal_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, 1); |
827 | 842 | ||
828 | if (ACPI_FAILURE (status)) { | 843 | if (ACPI_FAILURE (status)) { |
829 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not release Mutex [%s] %s\n", | 844 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
830 | this_thread_id, acpi_ut_get_mutex_name (mutex_id), | 845 | "Thread %X could not release Mutex [%s] %s\n", |
831 | acpi_format_exception (status))); | 846 | this_thread_id, acpi_ut_get_mutex_name (mutex_id), |
847 | acpi_format_exception (status))); | ||
832 | } | 848 | } |
833 | else { | 849 | else { |
834 | ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n", | 850 | ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n", |
835 | this_thread_id, acpi_ut_get_mutex_name (mutex_id))); | 851 | this_thread_id, acpi_ut_get_mutex_name (mutex_id))); |
836 | } | 852 | } |
837 | 853 | ||
838 | return (status); | 854 | return (status); |
@@ -843,11 +859,11 @@ acpi_ut_release_mutex ( | |||
843 | * | 859 | * |
844 | * FUNCTION: acpi_ut_create_update_state_and_push | 860 | * FUNCTION: acpi_ut_create_update_state_and_push |
845 | * | 861 | * |
846 | * PARAMETERS: *Object - Object to be added to the new state | 862 | * PARAMETERS: Object - Object to be added to the new state |
847 | * Action - Increment/Decrement | 863 | * Action - Increment/Decrement |
848 | * state_list - List the state will be added to | 864 | * state_list - List the state will be added to |
849 | * | 865 | * |
850 | * RETURN: None | 866 | * RETURN: Status |
851 | * | 867 | * |
852 | * DESCRIPTION: Create a new state and push it | 868 | * DESCRIPTION: Create a new state and push it |
853 | * | 869 | * |
@@ -885,15 +901,16 @@ acpi_ut_create_update_state_and_push ( | |||
885 | * | 901 | * |
886 | * FUNCTION: acpi_ut_create_pkg_state_and_push | 902 | * FUNCTION: acpi_ut_create_pkg_state_and_push |
887 | * | 903 | * |
888 | * PARAMETERS: *Object - Object to be added to the new state | 904 | * PARAMETERS: Object - Object to be added to the new state |
889 | * Action - Increment/Decrement | 905 | * Action - Increment/Decrement |
890 | * state_list - List the state will be added to | 906 | * state_list - List the state will be added to |
891 | * | 907 | * |
892 | * RETURN: None | 908 | * RETURN: Status |
893 | * | 909 | * |
894 | * DESCRIPTION: Create a new state and push it | 910 | * DESCRIPTION: Create a new state and push it |
895 | * | 911 | * |
896 | ******************************************************************************/ | 912 | ******************************************************************************/ |
913 | |||
897 | #ifdef ACPI_FUTURE_USAGE | 914 | #ifdef ACPI_FUTURE_USAGE |
898 | acpi_status | 915 | acpi_status |
899 | acpi_ut_create_pkg_state_and_push ( | 916 | acpi_ut_create_pkg_state_and_push ( |
@@ -925,7 +942,7 @@ acpi_ut_create_pkg_state_and_push ( | |||
925 | * PARAMETERS: list_head - Head of the state stack | 942 | * PARAMETERS: list_head - Head of the state stack |
926 | * State - State object to push | 943 | * State - State object to push |
927 | * | 944 | * |
928 | * RETURN: Status | 945 | * RETURN: None |
929 | * | 946 | * |
930 | * DESCRIPTION: Push a state object onto a state stack | 947 | * DESCRIPTION: Push a state object onto a state stack |
931 | * | 948 | * |
@@ -954,7 +971,7 @@ acpi_ut_push_generic_state ( | |||
954 | * | 971 | * |
955 | * PARAMETERS: list_head - Head of the state stack | 972 | * PARAMETERS: list_head - Head of the state stack |
956 | * | 973 | * |
957 | * RETURN: Status | 974 | * RETURN: The popped state object |
958 | * | 975 | * |
959 | * DESCRIPTION: Pop a state object from a state stack | 976 | * DESCRIPTION: Pop a state object from a state stack |
960 | * | 977 | * |
@@ -989,7 +1006,7 @@ acpi_ut_pop_generic_state ( | |||
989 | * | 1006 | * |
990 | * PARAMETERS: None | 1007 | * PARAMETERS: None |
991 | * | 1008 | * |
992 | * RETURN: Status | 1009 | * RETURN: The new state object. NULL on failure. |
993 | * | 1010 | * |
994 | * DESCRIPTION: Create a generic state object. Attempt to obtain one from | 1011 | * DESCRIPTION: Create a generic state object. Attempt to obtain one from |
995 | * the global state cache; If none available, create a new one. | 1012 | * the global state cache; If none available, create a new one. |
@@ -997,7 +1014,8 @@ acpi_ut_pop_generic_state ( | |||
997 | ******************************************************************************/ | 1014 | ******************************************************************************/ |
998 | 1015 | ||
999 | union acpi_generic_state * | 1016 | union acpi_generic_state * |
1000 | acpi_ut_create_generic_state (void) | 1017 | acpi_ut_create_generic_state ( |
1018 | void) | ||
1001 | { | 1019 | { |
1002 | union acpi_generic_state *state; | 1020 | union acpi_generic_state *state; |
1003 | 1021 | ||
@@ -1023,7 +1041,7 @@ acpi_ut_create_generic_state (void) | |||
1023 | * | 1041 | * |
1024 | * PARAMETERS: None | 1042 | * PARAMETERS: None |
1025 | * | 1043 | * |
1026 | * RETURN: Thread State | 1044 | * RETURN: New Thread State. NULL on failure |
1027 | * | 1045 | * |
1028 | * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used | 1046 | * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used |
1029 | * to track per-thread info during method execution | 1047 | * to track per-thread info during method execution |
@@ -1060,11 +1078,10 @@ acpi_ut_create_thread_state ( | |||
1060 | * | 1078 | * |
1061 | * FUNCTION: acpi_ut_create_update_state | 1079 | * FUNCTION: acpi_ut_create_update_state |
1062 | * | 1080 | * |
1063 | * PARAMETERS: Object - Initial Object to be installed in the | 1081 | * PARAMETERS: Object - Initial Object to be installed in the state |
1064 | * state | 1082 | * Action - Update action to be performed |
1065 | * Action - Update action to be performed | ||
1066 | * | 1083 | * |
1067 | * RETURN: Status | 1084 | * RETURN: New state object, null on failure |
1068 | * | 1085 | * |
1069 | * DESCRIPTION: Create an "Update State" - a flavor of the generic state used | 1086 | * DESCRIPTION: Create an "Update State" - a flavor of the generic state used |
1070 | * to update reference counts and delete complex objects such | 1087 | * to update reference counts and delete complex objects such |
@@ -1104,11 +1121,10 @@ acpi_ut_create_update_state ( | |||
1104 | * | 1121 | * |
1105 | * FUNCTION: acpi_ut_create_pkg_state | 1122 | * FUNCTION: acpi_ut_create_pkg_state |
1106 | * | 1123 | * |
1107 | * PARAMETERS: Object - Initial Object to be installed in the | 1124 | * PARAMETERS: Object - Initial Object to be installed in the state |
1108 | * state | 1125 | * Action - Update action to be performed |
1109 | * Action - Update action to be performed | ||
1110 | * | 1126 | * |
1111 | * RETURN: Status | 1127 | * RETURN: New state object, null on failure |
1112 | * | 1128 | * |
1113 | * DESCRIPTION: Create a "Package State" | 1129 | * DESCRIPTION: Create a "Package State" |
1114 | * | 1130 | * |
@@ -1151,7 +1167,7 @@ acpi_ut_create_pkg_state ( | |||
1151 | * | 1167 | * |
1152 | * PARAMETERS: None | 1168 | * PARAMETERS: None |
1153 | * | 1169 | * |
1154 | * RETURN: Status | 1170 | * RETURN: New state object, null on failure |
1155 | * | 1171 | * |
1156 | * DESCRIPTION: Create a "Control State" - a flavor of the generic state used | 1172 | * DESCRIPTION: Create a "Control State" - a flavor of the generic state used |
1157 | * to support nested IF/WHILE constructs in the AML. | 1173 | * to support nested IF/WHILE constructs in the AML. |
@@ -1190,7 +1206,7 @@ acpi_ut_create_control_state ( | |||
1190 | * | 1206 | * |
1191 | * PARAMETERS: State - The state object to be deleted | 1207 | * PARAMETERS: State - The state object to be deleted |
1192 | * | 1208 | * |
1193 | * RETURN: Status | 1209 | * RETURN: None |
1194 | * | 1210 | * |
1195 | * DESCRIPTION: Put a state object back into the global state cache. The object | 1211 | * DESCRIPTION: Put a state object back into the global state cache. The object |
1196 | * is not actually freed at this time. | 1212 | * is not actually freed at this time. |
@@ -1216,7 +1232,7 @@ acpi_ut_delete_generic_state ( | |||
1216 | * | 1232 | * |
1217 | * PARAMETERS: None | 1233 | * PARAMETERS: None |
1218 | * | 1234 | * |
1219 | * RETURN: Status | 1235 | * RETURN: None |
1220 | * | 1236 | * |
1221 | * DESCRIPTION: Purge the global state object cache. Used during subsystem | 1237 | * DESCRIPTION: Purge the global state object cache. Used during subsystem |
1222 | * termination. | 1238 | * termination. |
@@ -1240,7 +1256,10 @@ acpi_ut_delete_generic_state_cache ( | |||
1240 | * | 1256 | * |
1241 | * FUNCTION: acpi_ut_walk_package_tree | 1257 | * FUNCTION: acpi_ut_walk_package_tree |
1242 | * | 1258 | * |
1243 | * PARAMETERS: obj_desc - The Package object on which to resolve refs | 1259 | * PARAMETERS: source_object - The package to walk |
1260 | * target_object - Target object (if package is being copied) | ||
1261 | * walk_callback - Called once for each package element | ||
1262 | * Context - Passed to the callback function | ||
1244 | * | 1263 | * |
1245 | * RETURN: Status | 1264 | * RETURN: Status |
1246 | * | 1265 | * |
@@ -1359,7 +1378,7 @@ acpi_ut_walk_package_tree ( | |||
1359 | * PARAMETERS: Buffer - Buffer to be scanned | 1378 | * PARAMETERS: Buffer - Buffer to be scanned |
1360 | * Length - number of bytes to examine | 1379 | * Length - number of bytes to examine |
1361 | * | 1380 | * |
1362 | * RETURN: checksum | 1381 | * RETURN: The generated checksum |
1363 | * | 1382 | * |
1364 | * DESCRIPTION: Generate a checksum on a raw buffer | 1383 | * DESCRIPTION: Generate a checksum on a raw buffer |
1365 | * | 1384 | * |
@@ -1442,7 +1461,6 @@ acpi_ut_get_resource_end_tag ( | |||
1442 | * PARAMETERS: module_name - Caller's module name (for error output) | 1461 | * PARAMETERS: module_name - Caller's module name (for error output) |
1443 | * line_number - Caller's line number (for error output) | 1462 | * line_number - Caller's line number (for error output) |
1444 | * component_id - Caller's component ID (for error output) | 1463 | * component_id - Caller's component ID (for error output) |
1445 | * Message - Error message to use on failure | ||
1446 | * | 1464 | * |
1447 | * RETURN: None | 1465 | * RETURN: None |
1448 | * | 1466 | * |
@@ -1457,7 +1475,6 @@ acpi_ut_report_error ( | |||
1457 | u32 component_id) | 1475 | u32 component_id) |
1458 | { | 1476 | { |
1459 | 1477 | ||
1460 | |||
1461 | acpi_os_printf ("%8s-%04d: *** Error: ", module_name, line_number); | 1478 | acpi_os_printf ("%8s-%04d: *** Error: ", module_name, line_number); |
1462 | } | 1479 | } |
1463 | 1480 | ||
@@ -1469,7 +1486,6 @@ acpi_ut_report_error ( | |||
1469 | * PARAMETERS: module_name - Caller's module name (for error output) | 1486 | * PARAMETERS: module_name - Caller's module name (for error output) |
1470 | * line_number - Caller's line number (for error output) | 1487 | * line_number - Caller's line number (for error output) |
1471 | * component_id - Caller's component ID (for error output) | 1488 | * component_id - Caller's component ID (for error output) |
1472 | * Message - Error message to use on failure | ||
1473 | * | 1489 | * |
1474 | * RETURN: None | 1490 | * RETURN: None |
1475 | * | 1491 | * |
@@ -1495,7 +1511,6 @@ acpi_ut_report_warning ( | |||
1495 | * PARAMETERS: module_name - Caller's module name (for error output) | 1511 | * PARAMETERS: module_name - Caller's module name (for error output) |
1496 | * line_number - Caller's line number (for error output) | 1512 | * line_number - Caller's line number (for error output) |
1497 | * component_id - Caller's component ID (for error output) | 1513 | * component_id - Caller's component ID (for error output) |
1498 | * Message - Error message to use on failure | ||
1499 | * | 1514 | * |
1500 | * RETURN: None | 1515 | * RETURN: None |
1501 | * | 1516 | * |
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index 9ee40a484e07..cd3899b9cc5a 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c | |||
@@ -50,6 +50,25 @@ | |||
50 | #define _COMPONENT ACPI_UTILITIES | 50 | #define _COMPONENT ACPI_UTILITIES |
51 | ACPI_MODULE_NAME ("utobject") | 51 | ACPI_MODULE_NAME ("utobject") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
54 | |||
55 | static acpi_status | ||
56 | acpi_ut_get_simple_object_size ( | ||
57 | union acpi_operand_object *obj, | ||
58 | acpi_size *obj_length); | ||
59 | |||
60 | static acpi_status | ||
61 | acpi_ut_get_package_object_size ( | ||
62 | union acpi_operand_object *obj, | ||
63 | acpi_size *obj_length); | ||
64 | |||
65 | static acpi_status | ||
66 | acpi_ut_get_element_length ( | ||
67 | u8 object_type, | ||
68 | union acpi_operand_object *source_object, | ||
69 | union acpi_generic_state *state, | ||
70 | void *context); | ||
71 | |||
53 | 72 | ||
54 | /******************************************************************************* | 73 | /******************************************************************************* |
55 | * | 74 | * |
@@ -60,7 +79,7 @@ | |||
60 | * component_id - Component type of caller | 79 | * component_id - Component type of caller |
61 | * Type - ACPI Type of the new object | 80 | * Type - ACPI Type of the new object |
62 | * | 81 | * |
63 | * RETURN: Object - The new object. Null on failure | 82 | * RETURN: A new internal object, null on failure |
64 | * | 83 | * |
65 | * DESCRIPTION: Create and initialize a new internal object. | 84 | * DESCRIPTION: Create and initialize a new internal object. |
66 | * | 85 | * |
@@ -83,7 +102,8 @@ acpi_ut_create_internal_object_dbg ( | |||
83 | union acpi_operand_object *second_object; | 102 | union acpi_operand_object *second_object; |
84 | 103 | ||
85 | 104 | ||
86 | ACPI_FUNCTION_TRACE_STR ("ut_create_internal_object_dbg", acpi_ut_get_type_name (type)); | 105 | ACPI_FUNCTION_TRACE_STR ("ut_create_internal_object_dbg", |
106 | acpi_ut_get_type_name (type)); | ||
87 | 107 | ||
88 | 108 | ||
89 | /* Allocate the raw object descriptor */ | 109 | /* Allocate the raw object descriptor */ |
@@ -99,7 +119,8 @@ acpi_ut_create_internal_object_dbg ( | |||
99 | 119 | ||
100 | /* These types require a secondary object */ | 120 | /* These types require a secondary object */ |
101 | 121 | ||
102 | second_object = acpi_ut_allocate_object_desc_dbg (module_name, line_number, component_id); | 122 | second_object = acpi_ut_allocate_object_desc_dbg (module_name, |
123 | line_number, component_id); | ||
103 | if (!second_object) { | 124 | if (!second_object) { |
104 | acpi_ut_delete_object_desc (object); | 125 | acpi_ut_delete_object_desc (object); |
105 | return_PTR (NULL); | 126 | return_PTR (NULL); |
@@ -138,7 +159,7 @@ acpi_ut_create_internal_object_dbg ( | |||
138 | * | 159 | * |
139 | * PARAMETERS: buffer_size - Size of buffer to be created | 160 | * PARAMETERS: buffer_size - Size of buffer to be created |
140 | * | 161 | * |
141 | * RETURN: Pointer to a new Buffer object | 162 | * RETURN: Pointer to a new Buffer object, null on failure |
142 | * | 163 | * |
143 | * DESCRIPTION: Create a fully initialized buffer object | 164 | * DESCRIPTION: Create a fully initialized buffer object |
144 | * | 165 | * |
@@ -192,9 +213,9 @@ acpi_ut_create_buffer_object ( | |||
192 | * | 213 | * |
193 | * FUNCTION: acpi_ut_create_string_object | 214 | * FUNCTION: acpi_ut_create_string_object |
194 | * | 215 | * |
195 | * PARAMETERS: string_size - Size of string to be created. Does not | 216 | * PARAMETERS: string_size - Size of string to be created. Does not |
196 | * include NULL terminator, this is added | 217 | * include NULL terminator, this is added |
197 | * automatically. | 218 | * automatically. |
198 | * | 219 | * |
199 | * RETURN: Pointer to a new String object | 220 | * RETURN: Pointer to a new String object |
200 | * | 221 | * |
@@ -249,7 +270,9 @@ acpi_ut_create_string_object ( | |||
249 | * | 270 | * |
250 | * PARAMETERS: Object - Object to be validated | 271 | * PARAMETERS: Object - Object to be validated |
251 | * | 272 | * |
252 | * RETURN: Validate a pointer to be an union acpi_operand_object | 273 | * RETURN: TRUE if object is valid, FALSE otherwise |
274 | * | ||
275 | * DESCRIPTION: Validate a pointer to be an union acpi_operand_object | ||
253 | * | 276 | * |
254 | ******************************************************************************/ | 277 | ******************************************************************************/ |
255 | 278 | ||
@@ -399,8 +422,8 @@ acpi_ut_delete_object_cache ( | |||
399 | * | 422 | * |
400 | * FUNCTION: acpi_ut_get_simple_object_size | 423 | * FUNCTION: acpi_ut_get_simple_object_size |
401 | * | 424 | * |
402 | * PARAMETERS: *internal_object - Pointer to the object we are examining | 425 | * PARAMETERS: internal_object - An ACPI operand object |
403 | * *obj_length - Where the length is returned | 426 | * obj_length - Where the length is returned |
404 | * | 427 | * |
405 | * RETURN: Status | 428 | * RETURN: Status |
406 | * | 429 | * |
@@ -412,7 +435,7 @@ acpi_ut_delete_object_cache ( | |||
412 | * | 435 | * |
413 | ******************************************************************************/ | 436 | ******************************************************************************/ |
414 | 437 | ||
415 | acpi_status | 438 | static acpi_status |
416 | acpi_ut_get_simple_object_size ( | 439 | acpi_ut_get_simple_object_size ( |
417 | union acpi_operand_object *internal_object, | 440 | union acpi_operand_object *internal_object, |
418 | acpi_size *obj_length) | 441 | acpi_size *obj_length) |
@@ -424,8 +447,10 @@ acpi_ut_get_simple_object_size ( | |||
424 | ACPI_FUNCTION_TRACE_PTR ("ut_get_simple_object_size", internal_object); | 447 | ACPI_FUNCTION_TRACE_PTR ("ut_get_simple_object_size", internal_object); |
425 | 448 | ||
426 | 449 | ||
427 | /* Handle a null object (Could be a uninitialized package element -- which is legal) */ | 450 | /* |
428 | 451 | * Handle a null object (Could be a uninitialized package | |
452 | * element -- which is legal) | ||
453 | */ | ||
429 | if (!internal_object) { | 454 | if (!internal_object) { |
430 | *obj_length = 0; | 455 | *obj_length = 0; |
431 | return_ACPI_STATUS (AE_OK); | 456 | return_ACPI_STATUS (AE_OK); |
@@ -480,7 +505,8 @@ acpi_ut_get_simple_object_size ( | |||
480 | * Get the actual length of the full pathname to this object. | 505 | * Get the actual length of the full pathname to this object. |
481 | * The reference will be converted to the pathname to the object | 506 | * The reference will be converted to the pathname to the object |
482 | */ | 507 | */ |
483 | length += ACPI_ROUND_UP_TO_NATIVE_WORD (acpi_ns_get_pathname_length (internal_object->reference.node)); | 508 | length += ACPI_ROUND_UP_TO_NATIVE_WORD ( |
509 | acpi_ns_get_pathname_length (internal_object->reference.node)); | ||
484 | break; | 510 | break; |
485 | 511 | ||
486 | default: | 512 | default: |
@@ -530,7 +556,7 @@ acpi_ut_get_simple_object_size ( | |||
530 | * | 556 | * |
531 | ******************************************************************************/ | 557 | ******************************************************************************/ |
532 | 558 | ||
533 | acpi_status | 559 | static acpi_status |
534 | acpi_ut_get_element_length ( | 560 | acpi_ut_get_element_length ( |
535 | u8 object_type, | 561 | u8 object_type, |
536 | union acpi_operand_object *source_object, | 562 | union acpi_operand_object *source_object, |
@@ -582,8 +608,8 @@ acpi_ut_get_element_length ( | |||
582 | * | 608 | * |
583 | * FUNCTION: acpi_ut_get_package_object_size | 609 | * FUNCTION: acpi_ut_get_package_object_size |
584 | * | 610 | * |
585 | * PARAMETERS: *internal_object - Pointer to the object we are examining | 611 | * PARAMETERS: internal_object - An ACPI internal object |
586 | * *obj_length - Where the length is returned | 612 | * obj_length - Where the length is returned |
587 | * | 613 | * |
588 | * RETURN: Status | 614 | * RETURN: Status |
589 | * | 615 | * |
@@ -595,7 +621,7 @@ acpi_ut_get_element_length ( | |||
595 | * | 621 | * |
596 | ******************************************************************************/ | 622 | ******************************************************************************/ |
597 | 623 | ||
598 | acpi_status | 624 | static acpi_status |
599 | acpi_ut_get_package_object_size ( | 625 | acpi_ut_get_package_object_size ( |
600 | union acpi_operand_object *internal_object, | 626 | union acpi_operand_object *internal_object, |
601 | acpi_size *obj_length) | 627 | acpi_size *obj_length) |
@@ -636,8 +662,8 @@ acpi_ut_get_package_object_size ( | |||
636 | * | 662 | * |
637 | * FUNCTION: acpi_ut_get_object_size | 663 | * FUNCTION: acpi_ut_get_object_size |
638 | * | 664 | * |
639 | * PARAMETERS: *internal_object - Pointer to the object we are examining | 665 | * PARAMETERS: internal_object - An ACPI internal object |
640 | * *obj_length - Where the length will be returned | 666 | * obj_length - Where the length will be returned |
641 | * | 667 | * |
642 | * RETURN: Status | 668 | * RETURN: Status |
643 | * | 669 | * |
@@ -647,7 +673,7 @@ acpi_ut_get_package_object_size ( | |||
647 | ******************************************************************************/ | 673 | ******************************************************************************/ |
648 | 674 | ||
649 | acpi_status | 675 | acpi_status |
650 | acpi_ut_get_object_size( | 676 | acpi_ut_get_object_size ( |
651 | union acpi_operand_object *internal_object, | 677 | union acpi_operand_object *internal_object, |
652 | acpi_size *obj_length) | 678 | acpi_size *obj_length) |
653 | { | 679 | { |
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index 97a91f3f06f0..e8803d810656 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c | |||
@@ -73,6 +73,7 @@ acpi_initialize_subsystem ( | |||
73 | { | 73 | { |
74 | acpi_status status; | 74 | acpi_status status; |
75 | 75 | ||
76 | |||
76 | ACPI_FUNCTION_TRACE ("acpi_initialize_subsystem"); | 77 | ACPI_FUNCTION_TRACE ("acpi_initialize_subsystem"); |
77 | 78 | ||
78 | 79 | ||
@@ -105,7 +106,6 @@ acpi_initialize_subsystem ( | |||
105 | * Initialize the namespace manager and | 106 | * Initialize the namespace manager and |
106 | * the root of the namespace tree | 107 | * the root of the namespace tree |
107 | */ | 108 | */ |
108 | |||
109 | status = acpi_ns_root_initialize (); | 109 | status = acpi_ns_root_initialize (); |
110 | if (ACPI_FAILURE (status)) { | 110 | if (ACPI_FAILURE (status)) { |
111 | ACPI_REPORT_ERROR (("Namespace initialization failure, %s\n", | 111 | ACPI_REPORT_ERROR (("Namespace initialization failure, %s\n", |
@@ -113,7 +113,6 @@ acpi_initialize_subsystem ( | |||
113 | return_ACPI_STATUS (status); | 113 | return_ACPI_STATUS (status); |
114 | } | 114 | } |
115 | 115 | ||
116 | |||
117 | /* If configured, initialize the AML debugger */ | 116 | /* If configured, initialize the AML debugger */ |
118 | 117 | ||
119 | ACPI_DEBUGGER_EXEC (status = acpi_db_initialize ()); | 118 | ACPI_DEBUGGER_EXEC (status = acpi_db_initialize ()); |
@@ -150,7 +149,8 @@ acpi_enable_subsystem ( | |||
150 | * The values from the FADT are validated here. | 149 | * The values from the FADT are validated here. |
151 | */ | 150 | */ |
152 | if (!(flags & ACPI_NO_HARDWARE_INIT)) { | 151 | if (!(flags & ACPI_NO_HARDWARE_INIT)) { |
153 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI hardware\n")); | 152 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
153 | "[Init] Initializing ACPI hardware\n")); | ||
154 | 154 | ||
155 | status = acpi_hw_initialize (); | 155 | status = acpi_hw_initialize (); |
156 | if (ACPI_FAILURE (status)) { | 156 | if (ACPI_FAILURE (status)) { |
@@ -178,7 +178,8 @@ acpi_enable_subsystem ( | |||
178 | * install_address_space_handler interface. | 178 | * install_address_space_handler interface. |
179 | */ | 179 | */ |
180 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | 180 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { |
181 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n")); | 181 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
182 | "[Init] Installing default address space handlers\n")); | ||
182 | 183 | ||
183 | status = acpi_ev_install_region_handlers (); | 184 | status = acpi_ev_install_region_handlers (); |
184 | if (ACPI_FAILURE (status)) { | 185 | if (ACPI_FAILURE (status)) { |
@@ -189,12 +190,14 @@ acpi_enable_subsystem ( | |||
189 | /* | 190 | /* |
190 | * Initialize ACPI Event handling (Fixed and General Purpose) | 191 | * Initialize ACPI Event handling (Fixed and General Purpose) |
191 | * | 192 | * |
192 | * NOTE: We must have the hardware AND events initialized before we can execute | 193 | * NOTE: We must have the hardware AND events initialized before we can |
193 | * ANY control methods SAFELY. Any control method can require ACPI hardware | 194 | * execute ANY control methods SAFELY. Any control method can require |
194 | * support, so the hardware MUST be initialized before execution! | 195 | * ACPI hardware support, so the hardware MUST be initialized before |
196 | * execution! | ||
195 | */ | 197 | */ |
196 | if (!(flags & ACPI_NO_EVENT_INIT)) { | 198 | if (!(flags & ACPI_NO_EVENT_INIT)) { |
197 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI events\n")); | 199 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
200 | "[Init] Initializing ACPI events\n")); | ||
198 | 201 | ||
199 | status = acpi_ev_initialize_events (); | 202 | status = acpi_ev_initialize_events (); |
200 | if (ACPI_FAILURE (status)) { | 203 | if (ACPI_FAILURE (status)) { |
@@ -205,7 +208,8 @@ acpi_enable_subsystem ( | |||
205 | /* Install the SCI handler and Global Lock handler */ | 208 | /* Install the SCI handler and Global Lock handler */ |
206 | 209 | ||
207 | if (!(flags & ACPI_NO_HANDLER_INIT)) { | 210 | if (!(flags & ACPI_NO_HANDLER_INIT)) { |
208 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing SCI/GL handlers\n")); | 211 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
212 | "[Init] Installing SCI/GL handlers\n")); | ||
209 | 213 | ||
210 | status = acpi_ev_install_xrupt_handlers (); | 214 | status = acpi_ev_install_xrupt_handlers (); |
211 | if (ACPI_FAILURE (status)) { | 215 | if (ACPI_FAILURE (status)) { |
@@ -247,7 +251,8 @@ acpi_initialize_objects ( | |||
247 | * contain executable AML (see call to acpi_ns_initialize_objects below). | 251 | * contain executable AML (see call to acpi_ns_initialize_objects below). |
248 | */ | 252 | */ |
249 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | 253 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { |
250 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Executing _REG op_region methods\n")); | 254 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
255 | "[Init] Executing _REG op_region methods\n")); | ||
251 | 256 | ||
252 | status = acpi_ev_initialize_op_regions (); | 257 | status = acpi_ev_initialize_op_regions (); |
253 | if (ACPI_FAILURE (status)) { | 258 | if (ACPI_FAILURE (status)) { |
@@ -261,7 +266,8 @@ acpi_initialize_objects ( | |||
261 | * objects: operation_regions, buffer_fields, Buffers, and Packages. | 266 | * objects: operation_regions, buffer_fields, Buffers, and Packages. |
262 | */ | 267 | */ |
263 | if (!(flags & ACPI_NO_OBJECT_INIT)) { | 268 | if (!(flags & ACPI_NO_OBJECT_INIT)) { |
264 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Completing Initialization of ACPI Objects\n")); | 269 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
270 | "[Init] Completing Initialization of ACPI Objects\n")); | ||
265 | 271 | ||
266 | status = acpi_ns_initialize_objects (); | 272 | status = acpi_ns_initialize_objects (); |
267 | if (ACPI_FAILURE (status)) { | 273 | if (ACPI_FAILURE (status)) { |
@@ -274,7 +280,8 @@ acpi_initialize_objects ( | |||
274 | * This runs the _STA and _INI methods. | 280 | * This runs the _STA and _INI methods. |
275 | */ | 281 | */ |
276 | if (!(flags & ACPI_NO_DEVICE_INIT)) { | 282 | if (!(flags & ACPI_NO_DEVICE_INIT)) { |
277 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI Devices\n")); | 283 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
284 | "[Init] Initializing ACPI Devices\n")); | ||
278 | 285 | ||
279 | status = acpi_ns_initialize_devices (); | 286 | status = acpi_ns_initialize_devices (); |
280 | if (ACPI_FAILURE (status)) { | 287 | if (ACPI_FAILURE (status)) { |
@@ -307,7 +314,8 @@ acpi_initialize_objects ( | |||
307 | ******************************************************************************/ | 314 | ******************************************************************************/ |
308 | 315 | ||
309 | acpi_status | 316 | acpi_status |
310 | acpi_terminate (void) | 317 | acpi_terminate ( |
318 | void) | ||
311 | { | 319 | { |
312 | acpi_status status; | 320 | acpi_status status; |
313 | 321 | ||
@@ -344,8 +352,7 @@ acpi_terminate (void) | |||
344 | 352 | ||
345 | 353 | ||
346 | #ifdef ACPI_FUTURE_USAGE | 354 | #ifdef ACPI_FUTURE_USAGE |
347 | 355 | /******************************************************************************* | |
348 | /***************************************************************************** | ||
349 | * | 356 | * |
350 | * FUNCTION: acpi_subsystem_status | 357 | * FUNCTION: acpi_subsystem_status |
351 | * | 358 | * |
@@ -354,14 +361,16 @@ acpi_terminate (void) | |||
354 | * RETURN: Status of the ACPI subsystem | 361 | * RETURN: Status of the ACPI subsystem |
355 | * | 362 | * |
356 | * DESCRIPTION: Other drivers that use the ACPI subsystem should call this | 363 | * DESCRIPTION: Other drivers that use the ACPI subsystem should call this |
357 | * before making any other calls, to ensure the subsystem initial- | 364 | * before making any other calls, to ensure the subsystem |
358 | * ized successfully. | 365 | * initialized successfully. |
359 | * | 366 | * |
360 | ****************************************************************************/ | 367 | ******************************************************************************/ |
361 | 368 | ||
362 | acpi_status | 369 | acpi_status |
363 | acpi_subsystem_status (void) | 370 | acpi_subsystem_status ( |
371 | void) | ||
364 | { | 372 | { |
373 | |||
365 | if (acpi_gbl_startup_flags & ACPI_INITIALIZED_OK) { | 374 | if (acpi_gbl_startup_flags & ACPI_INITIALIZED_OK) { |
366 | return (AE_OK); | 375 | return (AE_OK); |
367 | } | 376 | } |
@@ -371,13 +380,12 @@ acpi_subsystem_status (void) | |||
371 | } | 380 | } |
372 | 381 | ||
373 | 382 | ||
374 | /****************************************************************************** | 383 | /******************************************************************************* |
375 | * | 384 | * |
376 | * FUNCTION: acpi_get_system_info | 385 | * FUNCTION: acpi_get_system_info |
377 | * | 386 | * |
378 | * PARAMETERS: out_buffer - a pointer to a buffer to receive the | 387 | * PARAMETERS: out_buffer - A buffer to receive the resources for the |
379 | * resources for the device | 388 | * device |
380 | * buffer_length - the number of bytes available in the buffer | ||
381 | * | 389 | * |
382 | * RETURN: Status - the status of the call | 390 | * RETURN: Status - the status of the call |
383 | * | 391 | * |
@@ -395,8 +403,8 @@ acpi_get_system_info ( | |||
395 | struct acpi_buffer *out_buffer) | 403 | struct acpi_buffer *out_buffer) |
396 | { | 404 | { |
397 | struct acpi_system_info *info_ptr; | 405 | struct acpi_system_info *info_ptr; |
398 | u32 i; | ||
399 | acpi_status status; | 406 | acpi_status status; |
407 | u32 i; | ||
400 | 408 | ||
401 | 409 | ||
402 | ACPI_FUNCTION_TRACE ("acpi_get_system_info"); | 410 | ACPI_FUNCTION_TRACE ("acpi_get_system_info"); |
@@ -466,6 +474,7 @@ EXPORT_SYMBOL(acpi_get_system_info); | |||
466 | * FUNCTION: acpi_install_initialization_handler | 474 | * FUNCTION: acpi_install_initialization_handler |
467 | * | 475 | * |
468 | * PARAMETERS: Handler - Callback procedure | 476 | * PARAMETERS: Handler - Callback procedure |
477 | * Function - Not (currently) used, see below | ||
469 | * | 478 | * |
470 | * RETURN: Status | 479 | * RETURN: Status |
471 | * | 480 | * |
@@ -495,7 +504,6 @@ acpi_install_initialization_handler ( | |||
495 | 504 | ||
496 | #endif /* ACPI_FUTURE_USAGE */ | 505 | #endif /* ACPI_FUTURE_USAGE */ |
497 | 506 | ||
498 | |||
499 | /***************************************************************************** | 507 | /***************************************************************************** |
500 | * | 508 | * |
501 | * FUNCTION: acpi_purge_cached_objects | 509 | * FUNCTION: acpi_purge_cached_objects |
@@ -509,7 +517,8 @@ acpi_install_initialization_handler ( | |||
509 | ****************************************************************************/ | 517 | ****************************************************************************/ |
510 | 518 | ||
511 | acpi_status | 519 | acpi_status |
512 | acpi_purge_cached_objects (void) | 520 | acpi_purge_cached_objects ( |
521 | void) | ||
513 | { | 522 | { |
514 | ACPI_FUNCTION_TRACE ("acpi_purge_cached_objects"); | 523 | ACPI_FUNCTION_TRACE ("acpi_purge_cached_objects"); |
515 | 524 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 71fa1011715f..2cf264fd52e0 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -564,12 +564,13 @@ acpi_video_device_find_cap (struct acpi_video_device *device) | |||
564 | int count = 0; | 564 | int count = 0; |
565 | union acpi_object *o; | 565 | union acpi_object *o; |
566 | 566 | ||
567 | br = kmalloc(sizeof &br, GFP_KERNEL); | 567 | br = kmalloc(sizeof(*br), GFP_KERNEL); |
568 | if (!br) { | 568 | if (!br) { |
569 | printk(KERN_ERR "can't allocate memory\n"); | 569 | printk(KERN_ERR "can't allocate memory\n"); |
570 | } else { | 570 | } else { |
571 | memset(br, 0, sizeof &br); | 571 | memset(br, 0, sizeof(*br)); |
572 | br->levels = kmalloc(obj->package.count * sizeof &br->levels, GFP_KERNEL); | 572 | br->levels = kmalloc(obj->package.count * |
573 | sizeof *(br->levels), GFP_KERNEL); | ||
573 | if (!br->levels) | 574 | if (!br->levels) |
574 | goto out; | 575 | goto out; |
575 | 576 | ||
@@ -584,8 +585,7 @@ acpi_video_device_find_cap (struct acpi_video_device *device) | |||
584 | } | 585 | } |
585 | out: | 586 | out: |
586 | if (count < 2) { | 587 | if (count < 2) { |
587 | if (br->levels) | 588 | kfree(br->levels); |
588 | kfree(br->levels); | ||
589 | kfree(br); | 589 | kfree(br); |
590 | } else { | 590 | } else { |
591 | br->count = count; | 591 | br->count = count; |
@@ -595,8 +595,7 @@ out: | |||
595 | } | 595 | } |
596 | } | 596 | } |
597 | 597 | ||
598 | if (obj) | 598 | kfree(obj); |
599 | kfree(obj); | ||
600 | 599 | ||
601 | return_VOID; | 600 | return_VOID; |
602 | } | 601 | } |
@@ -1585,7 +1584,7 @@ acpi_video_switch_output( | |||
1585 | ACPI_FUNCTION_TRACE("acpi_video_switch_output"); | 1584 | ACPI_FUNCTION_TRACE("acpi_video_switch_output"); |
1586 | 1585 | ||
1587 | list_for_each_safe(node, next, &video->video_device_list) { | 1586 | list_for_each_safe(node, next, &video->video_device_list) { |
1588 | struct acpi_video_device * dev = container_of(node, struct acpi_video_device, entry); | 1587 | dev = container_of(node, struct acpi_video_device, entry); |
1589 | status = acpi_video_device_get_state(dev, &state); | 1588 | status = acpi_video_device_get_state(dev, &state); |
1590 | if (state & 0x2){ | 1589 | if (state & 0x2){ |
1591 | dev_next = container_of(node->next, struct acpi_video_device, entry); | 1590 | dev_next = container_of(node->next, struct acpi_video_device, entry); |
diff --git a/drivers/base/sys.c b/drivers/base/sys.c index f37a13de804a..214b96435409 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/string.h> | 22 | #include <linux/string.h> |
23 | #include <linux/pm.h> | 23 | #include <linux/pm.h> |
24 | 24 | ||
25 | |||
26 | extern struct subsystem devices_subsys; | 25 | extern struct subsystem devices_subsys; |
27 | 26 | ||
28 | #define to_sysdev(k) container_of(k, struct sys_device, kobj) | 27 | #define to_sysdev(k) container_of(k, struct sys_device, kobj) |
diff --git a/drivers/char/tb0219.c b/drivers/char/tb0219.c index 5413f2908859..eb7058cbf015 100644 --- a/drivers/char/tb0219.c +++ b/drivers/char/tb0219.c | |||
@@ -24,6 +24,8 @@ | |||
24 | 24 | ||
25 | #include <asm/io.h> | 25 | #include <asm/io.h> |
26 | #include <asm/reboot.h> | 26 | #include <asm/reboot.h> |
27 | #include <asm/vr41xx/giu.h> | ||
28 | #include <asm/vr41xx/tb0219.h> | ||
27 | 29 | ||
28 | MODULE_AUTHOR("Yoichi Yuasa <yuasa@hh.iij4u.or.jp>"); | 30 | MODULE_AUTHOR("Yoichi Yuasa <yuasa@hh.iij4u.or.jp>"); |
29 | MODULE_DESCRIPTION("TANBAC TB0219 base board driver"); | 31 | MODULE_DESCRIPTION("TANBAC TB0219 base board driver"); |
@@ -266,6 +268,21 @@ static void tb0219_restart(char *command) | |||
266 | tb0219_write(TB0219_RESET, 0); | 268 | tb0219_write(TB0219_RESET, 0); |
267 | } | 269 | } |
268 | 270 | ||
271 | static void tb0219_pci_irq_init(void) | ||
272 | { | ||
273 | /* PCI Slot 1 */ | ||
274 | vr41xx_set_irq_trigger(TB0219_PCI_SLOT1_PIN, IRQ_TRIGGER_LEVEL, IRQ_SIGNAL_THROUGH); | ||
275 | vr41xx_set_irq_level(TB0219_PCI_SLOT1_PIN, IRQ_LEVEL_LOW); | ||
276 | |||
277 | /* PCI Slot 2 */ | ||
278 | vr41xx_set_irq_trigger(TB0219_PCI_SLOT2_PIN, IRQ_TRIGGER_LEVEL, IRQ_SIGNAL_THROUGH); | ||
279 | vr41xx_set_irq_level(TB0219_PCI_SLOT2_PIN, IRQ_LEVEL_LOW); | ||
280 | |||
281 | /* PCI Slot 3 */ | ||
282 | vr41xx_set_irq_trigger(TB0219_PCI_SLOT3_PIN, IRQ_TRIGGER_LEVEL, IRQ_SIGNAL_THROUGH); | ||
283 | vr41xx_set_irq_level(TB0219_PCI_SLOT3_PIN, IRQ_LEVEL_LOW); | ||
284 | } | ||
285 | |||
269 | static int tb0219_probe(struct device *dev) | 286 | static int tb0219_probe(struct device *dev) |
270 | { | 287 | { |
271 | int retval; | 288 | int retval; |
@@ -292,6 +309,8 @@ static int tb0219_probe(struct device *dev) | |||
292 | old_machine_restart = _machine_restart; | 309 | old_machine_restart = _machine_restart; |
293 | _machine_restart = tb0219_restart; | 310 | _machine_restart = tb0219_restart; |
294 | 311 | ||
312 | tb0219_pci_irq_init(); | ||
313 | |||
295 | if (major == 0) { | 314 | if (major == 0) { |
296 | major = retval; | 315 | major = retval; |
297 | printk(KERN_INFO "TB0219: major number %d\n", major); | 316 | printk(KERN_INFO "TB0219: major number %d\n", major); |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig new file mode 100644 index 000000000000..140d5f851a5b --- /dev/null +++ b/drivers/hwmon/Kconfig | |||
@@ -0,0 +1,420 @@ | |||
1 | # | ||
2 | # I2C Sensor chip drivers configuration | ||
3 | # | ||
4 | |||
5 | menu "Hardware Monitoring support" | ||
6 | |||
7 | config HWMON | ||
8 | tristate "Hardware Monitoring support" | ||
9 | default y | ||
10 | help | ||
11 | Hardware monitoring devices let you monitor the hardware health | ||
12 | of a system. Most modern motherboards include such a device. It | ||
13 | can include temperature sensors, voltage sensors, fan speed | ||
14 | sensors and various additional features such as the ability to | ||
15 | control the speed of the fans. | ||
16 | |||
17 | config SENSORS_ADM1021 | ||
18 | tristate "Analog Devices ADM1021 and compatibles" | ||
19 | depends on HWMON && I2C | ||
20 | select I2C_SENSOR | ||
21 | help | ||
22 | If you say yes here you get support for Analog Devices ADM1021 | ||
23 | and ADM1023 sensor chips and clones: Maxim MAX1617 and MAX1617A, | ||
24 | Genesys Logic GL523SM, National Semiconductor LM84, TI THMC10, | ||
25 | and the XEON processor built-in sensor. | ||
26 | |||
27 | This driver can also be built as a module. If so, the module | ||
28 | will be called adm1021. | ||
29 | |||
30 | config SENSORS_ADM1025 | ||
31 | tristate "Analog Devices ADM1025 and compatibles" | ||
32 | depends on HWMON && I2C && EXPERIMENTAL | ||
33 | select I2C_SENSOR | ||
34 | help | ||
35 | If you say yes here you get support for Analog Devices ADM1025 | ||
36 | and Philips NE1619 sensor chips. | ||
37 | |||
38 | This driver can also be built as a module. If so, the module | ||
39 | will be called adm1025. | ||
40 | |||
41 | config SENSORS_ADM1026 | ||
42 | tristate "Analog Devices ADM1026 and compatibles" | ||
43 | depends on HWMON && I2C && EXPERIMENTAL | ||
44 | select I2C_SENSOR | ||
45 | help | ||
46 | If you say yes here you get support for Analog Devices ADM1026 | ||
47 | sensor chip. | ||
48 | |||
49 | This driver can also be built as a module. If so, the module | ||
50 | will be called adm1026. | ||
51 | |||
52 | config SENSORS_ADM1031 | ||
53 | tristate "Analog Devices ADM1031 and compatibles" | ||
54 | depends on HWMON && I2C && EXPERIMENTAL | ||
55 | select I2C_SENSOR | ||
56 | help | ||
57 | If you say yes here you get support for Analog Devices ADM1031 | ||
58 | and ADM1030 sensor chips. | ||
59 | |||
60 | This driver can also be built as a module. If so, the module | ||
61 | will be called adm1031. | ||
62 | |||
63 | config SENSORS_ADM9240 | ||
64 | tristate "Analog Devices ADM9240 and compatibles" | ||
65 | depends on HWMON && I2C && EXPERIMENTAL | ||
66 | select I2C_SENSOR | ||
67 | help | ||
68 | If you say yes here you get support for Analog Devices ADM9240, | ||
69 | Dallas DS1780, National Semiconductor LM81 sensor chips. | ||
70 | |||
71 | This driver can also be built as a module. If so, the module | ||
72 | will be called adm9240. | ||
73 | |||
74 | config SENSORS_ASB100 | ||
75 | tristate "Asus ASB100 Bach" | ||
76 | depends on HWMON && I2C && EXPERIMENTAL | ||
77 | select I2C_SENSOR | ||
78 | help | ||
79 | If you say yes here you get support for the ASB100 Bach sensor | ||
80 | chip found on some Asus mainboards. | ||
81 | |||
82 | This driver can also be built as a module. If so, the module | ||
83 | will be called asb100. | ||
84 | |||
85 | config SENSORS_ATXP1 | ||
86 | tristate "Attansic ATXP1 VID controller" | ||
87 | depends on HWMON && I2C && EXPERIMENTAL | ||
88 | select I2C_SENSOR | ||
89 | help | ||
90 | If you say yes here you get support for the Attansic ATXP1 VID | ||
91 | controller. | ||
92 | |||
93 | If your board have such a chip, you are able to control your CPU | ||
94 | core and other voltages. | ||
95 | |||
96 | This driver can also be built as a module. If so, the module | ||
97 | will be called atxp1. | ||
98 | |||
99 | config SENSORS_DS1621 | ||
100 | tristate "Dallas Semiconductor DS1621 and DS1625" | ||
101 | depends on HWMON && I2C && EXPERIMENTAL | ||
102 | select I2C_SENSOR | ||
103 | help | ||
104 | If you say yes here you get support for Dallas Semiconductor | ||
105 | DS1621 and DS1625 sensor chips. | ||
106 | |||
107 | This driver can also be built as a module. If so, the module | ||
108 | will be called ds1621. | ||
109 | |||
110 | config SENSORS_FSCHER | ||
111 | tristate "FSC Hermes" | ||
112 | depends on HWMON && I2C && EXPERIMENTAL | ||
113 | select I2C_SENSOR | ||
114 | help | ||
115 | If you say yes here you get support for Fujitsu Siemens | ||
116 | Computers Hermes sensor chips. | ||
117 | |||
118 | This driver can also be built as a module. If so, the module | ||
119 | will be called fscher. | ||
120 | |||
121 | config SENSORS_FSCPOS | ||
122 | tristate "FSC Poseidon" | ||
123 | depends on HWMON && I2C && EXPERIMENTAL | ||
124 | select I2C_SENSOR | ||
125 | help | ||
126 | If you say yes here you get support for Fujitsu Siemens | ||
127 | Computers Poseidon sensor chips. | ||
128 | |||
129 | This driver can also be built as a module. If so, the module | ||
130 | will be called fscpos. | ||
131 | |||
132 | config SENSORS_GL518SM | ||
133 | tristate "Genesys Logic GL518SM" | ||
134 | depends on HWMON && I2C | ||
135 | select I2C_SENSOR | ||
136 | help | ||
137 | If you say yes here you get support for Genesys Logic GL518SM | ||
138 | sensor chips. | ||
139 | |||
140 | This driver can also be built as a module. If so, the module | ||
141 | will be called gl518sm. | ||
142 | |||
143 | config SENSORS_GL520SM | ||
144 | tristate "Genesys Logic GL520SM" | ||
145 | depends on HWMON && I2C && EXPERIMENTAL | ||
146 | select I2C_SENSOR | ||
147 | help | ||
148 | If you say yes here you get support for Genesys Logic GL520SM | ||
149 | sensor chips. | ||
150 | |||
151 | This driver can also be built as a module. If so, the module | ||
152 | will be called gl520sm. | ||
153 | |||
154 | config SENSORS_IT87 | ||
155 | tristate "ITE IT87xx and compatibles" | ||
156 | depends on HWMON && I2C | ||
157 | select I2C_SENSOR | ||
158 | help | ||
159 | If you say yes here you get support for ITE IT87xx sensor chips | ||
160 | and clones: SiS960. | ||
161 | |||
162 | This driver can also be built as a module. If so, the module | ||
163 | will be called it87. | ||
164 | |||
165 | config SENSORS_LM63 | ||
166 | tristate "National Semiconductor LM63" | ||
167 | depends on HWMON && I2C && EXPERIMENTAL | ||
168 | select I2C_SENSOR | ||
169 | help | ||
170 | If you say yes here you get support for the National Semiconductor | ||
171 | LM63 remote diode digital temperature sensor with integrated fan | ||
172 | control. Such chips are found on the Tyan S4882 (Thunder K8QS Pro) | ||
173 | motherboard, among others. | ||
174 | |||
175 | This driver can also be built as a module. If so, the module | ||
176 | will be called lm63. | ||
177 | |||
178 | config SENSORS_LM75 | ||
179 | tristate "National Semiconductor LM75 and compatibles" | ||
180 | depends on HWMON && I2C | ||
181 | select I2C_SENSOR | ||
182 | help | ||
183 | If you say yes here you get support for National Semiconductor LM75 | ||
184 | sensor chips and clones: Dallas Semiconductor DS75 and DS1775 (in | ||
185 | 9-bit precision mode), and TelCom (now Microchip) TCN75. | ||
186 | |||
187 | The DS75 and DS1775 in 10- to 12-bit precision modes will require | ||
188 | a force module parameter. The driver will not handle the extra | ||
189 | precision anyhow. | ||
190 | |||
191 | This driver can also be built as a module. If so, the module | ||
192 | will be called lm75. | ||
193 | |||
194 | config SENSORS_LM77 | ||
195 | tristate "National Semiconductor LM77" | ||
196 | depends on HWMON && I2C && EXPERIMENTAL | ||
197 | select I2C_SENSOR | ||
198 | help | ||
199 | If you say yes here you get support for National Semiconductor LM77 | ||
200 | sensor chips. | ||
201 | |||
202 | This driver can also be built as a module. If so, the module | ||
203 | will be called lm77. | ||
204 | |||
205 | config SENSORS_LM78 | ||
206 | tristate "National Semiconductor LM78 and compatibles" | ||
207 | depends on HWMON && I2C && EXPERIMENTAL | ||
208 | select I2C_SENSOR | ||
209 | help | ||
210 | If you say yes here you get support for National Semiconductor LM78, | ||
211 | LM78-J and LM79. | ||
212 | |||
213 | This driver can also be built as a module. If so, the module | ||
214 | will be called lm78. | ||
215 | |||
216 | config SENSORS_LM80 | ||
217 | tristate "National Semiconductor LM80" | ||
218 | depends on HWMON && I2C && EXPERIMENTAL | ||
219 | select I2C_SENSOR | ||
220 | help | ||
221 | If you say yes here you get support for National Semiconductor | ||
222 | LM80 sensor chips. | ||
223 | |||
224 | This driver can also be built as a module. If so, the module | ||
225 | will be called lm80. | ||
226 | |||
227 | config SENSORS_LM83 | ||
228 | tristate "National Semiconductor LM83" | ||
229 | depends on HWMON && I2C | ||
230 | select I2C_SENSOR | ||
231 | help | ||
232 | If you say yes here you get support for National Semiconductor | ||
233 | LM83 sensor chips. | ||
234 | |||
235 | This driver can also be built as a module. If so, the module | ||
236 | will be called lm83. | ||
237 | |||
238 | config SENSORS_LM85 | ||
239 | tristate "National Semiconductor LM85 and compatibles" | ||
240 | depends on HWMON && I2C && EXPERIMENTAL | ||
241 | select I2C_SENSOR | ||
242 | help | ||
243 | If you say yes here you get support for National Semiconductor LM85 | ||
244 | sensor chips and clones: ADT7463, EMC6D100, EMC6D102 and ADM1027. | ||
245 | |||
246 | This driver can also be built as a module. If so, the module | ||
247 | will be called lm85. | ||
248 | |||
249 | config SENSORS_LM87 | ||
250 | tristate "National Semiconductor LM87" | ||
251 | depends on HWMON && I2C && EXPERIMENTAL | ||
252 | select I2C_SENSOR | ||
253 | help | ||
254 | If you say yes here you get support for National Semiconductor LM87 | ||
255 | sensor chips. | ||
256 | |||
257 | This driver can also be built as a module. If so, the module | ||
258 | will be called lm87. | ||
259 | |||
260 | config SENSORS_LM90 | ||
261 | tristate "National Semiconductor LM90 and compatibles" | ||
262 | depends on HWMON && I2C | ||
263 | select I2C_SENSOR | ||
264 | help | ||
265 | If you say yes here you get support for National Semiconductor LM90, | ||
266 | LM86, LM89 and LM99, Analog Devices ADM1032 and Maxim MAX6657 and | ||
267 | MAX6658 sensor chips. | ||
268 | |||
269 | The Analog Devices ADT7461 sensor chip is also supported, but only | ||
270 | if found in ADM1032 compatibility mode. | ||
271 | |||
272 | This driver can also be built as a module. If so, the module | ||
273 | will be called lm90. | ||
274 | |||
275 | config SENSORS_LM92 | ||
276 | tristate "National Semiconductor LM92 and compatibles" | ||
277 | depends on HWMON && I2C && EXPERIMENTAL | ||
278 | select I2C_SENSOR | ||
279 | help | ||
280 | If you say yes here you get support for National Semiconductor LM92 | ||
281 | and Maxim MAX6635 sensor chips. | ||
282 | |||
283 | This driver can also be built as a module. If so, the module | ||
284 | will be called lm92. | ||
285 | |||
286 | config SENSORS_MAX1619 | ||
287 | tristate "Maxim MAX1619 sensor chip" | ||
288 | depends on HWMON && I2C && EXPERIMENTAL | ||
289 | select I2C_SENSOR | ||
290 | help | ||
291 | If you say yes here you get support for MAX1619 sensor chip. | ||
292 | |||
293 | This driver can also be built as a module. If so, the module | ||
294 | will be called max1619. | ||
295 | |||
296 | config SENSORS_PC87360 | ||
297 | tristate "National Semiconductor PC87360 family" | ||
298 | depends on HWMON && I2C && EXPERIMENTAL | ||
299 | select I2C_SENSOR | ||
300 | select I2C_ISA | ||
301 | help | ||
302 | If you say yes here you get access to the hardware monitoring | ||
303 | functions of the National Semiconductor PC8736x Super-I/O chips. | ||
304 | The PC87360, PC87363 and PC87364 only have fan monitoring and | ||
305 | control. The PC87365 and PC87366 additionally have voltage and | ||
306 | temperature monitoring. | ||
307 | |||
308 | This driver can also be built as a module. If so, the module | ||
309 | will be called pc87360. | ||
310 | |||
311 | config SENSORS_SIS5595 | ||
312 | tristate "Silicon Integrated Systems Corp. SiS5595" | ||
313 | depends on HWMON && I2C && PCI && EXPERIMENTAL | ||
314 | select I2C_SENSOR | ||
315 | select I2C_ISA | ||
316 | help | ||
317 | If you say yes here you get support for the integrated sensors in | ||
318 | SiS5595 South Bridges. | ||
319 | |||
320 | This driver can also be built as a module. If so, the module | ||
321 | will be called sis5595. | ||
322 | |||
323 | config SENSORS_SMSC47M1 | ||
324 | tristate "SMSC LPC47M10x and compatibles" | ||
325 | depends on HWMON && I2C && EXPERIMENTAL | ||
326 | select I2C_SENSOR | ||
327 | select I2C_ISA | ||
328 | help | ||
329 | If you say yes here you get support for the integrated fan | ||
330 | monitoring and control capabilities of the SMSC LPC47B27x, | ||
331 | LPC47M10x, LPC47M13x, LPC47M14x, LPC47M15x and LPC47M192 chips. | ||
332 | |||
333 | This driver can also be built as a module. If so, the module | ||
334 | will be called smsc47m1. | ||
335 | |||
336 | config SENSORS_SMSC47B397 | ||
337 | tristate "SMSC LPC47B397-NC" | ||
338 | depends on HWMON && I2C && EXPERIMENTAL | ||
339 | select I2C_SENSOR | ||
340 | select I2C_ISA | ||
341 | help | ||
342 | If you say yes here you get support for the SMSC LPC47B397-NC | ||
343 | sensor chip. | ||
344 | |||
345 | This driver can also be built as a module. If so, the module | ||
346 | will be called smsc47b397. | ||
347 | |||
348 | config SENSORS_VIA686A | ||
349 | tristate "VIA686A" | ||
350 | depends on HWMON && I2C && PCI | ||
351 | select I2C_SENSOR | ||
352 | select I2C_ISA | ||
353 | help | ||
354 | If you say yes here you get support for the integrated sensors in | ||
355 | Via 686A/B South Bridges. | ||
356 | |||
357 | This driver can also be built as a module. If so, the module | ||
358 | will be called via686a. | ||
359 | |||
360 | config SENSORS_W83781D | ||
361 | tristate "Winbond W83781D, W83782D, W83783S, W83627HF, Asus AS99127F" | ||
362 | depends on HWMON && I2C | ||
363 | select I2C_SENSOR | ||
364 | help | ||
365 | If you say yes here you get support for the Winbond W8378x series | ||
366 | of sensor chips: the W83781D, W83782D, W83783S and W83627HF, | ||
367 | and the similar Asus AS99127F. | ||
368 | |||
369 | This driver can also be built as a module. If so, the module | ||
370 | will be called w83781d. | ||
371 | |||
372 | config SENSORS_W83L785TS | ||
373 | tristate "Winbond W83L785TS-S" | ||
374 | depends on HWMON && I2C && EXPERIMENTAL | ||
375 | select I2C_SENSOR | ||
376 | help | ||
377 | If you say yes here you get support for the Winbond W83L785TS-S | ||
378 | sensor chip, which is used on the Asus A7N8X, among other | ||
379 | motherboards. | ||
380 | |||
381 | This driver can also be built as a module. If so, the module | ||
382 | will be called w83l785ts. | ||
383 | |||
384 | config SENSORS_W83627HF | ||
385 | tristate "Winbond W83627HF, W83627THF, W83637HF, W83697HF" | ||
386 | depends on HWMON && I2C && EXPERIMENTAL | ||
387 | select I2C_SENSOR | ||
388 | select I2C_ISA | ||
389 | help | ||
390 | If you say yes here you get support for the Winbond W836X7 series | ||
391 | of sensor chips: the W83627HF, W83627THF, W83637HF, and the W83697HF | ||
392 | |||
393 | This driver can also be built as a module. If so, the module | ||
394 | will be called w83627hf. | ||
395 | |||
396 | config SENSORS_W83627EHF | ||
397 | tristate "Winbond W83627EHF" | ||
398 | depends on HWMON && I2C && EXPERIMENTAL | ||
399 | select I2C_SENSOR | ||
400 | select I2C_ISA | ||
401 | help | ||
402 | If you say yes here you get preliminary support for the hardware | ||
403 | monitoring functionality of the Winbond W83627EHF Super-I/O chip. | ||
404 | Only fan and temperature inputs are supported at the moment, while | ||
405 | the chip does much more than that. | ||
406 | |||
407 | This driver can also be built as a module. If so, the module | ||
408 | will be called w83627ehf. | ||
409 | |||
410 | config HWMON_DEBUG_CHIP | ||
411 | bool "Hardware Monitoring Chip debugging messages" | ||
412 | depends on HWMON | ||
413 | default n | ||
414 | help | ||
415 | Say Y here if you want the I2C chip drivers to produce a bunch of | ||
416 | debug messages to the system log. Select this if you are having | ||
417 | a problem with I2C support and want to see more of what is going | ||
418 | on. | ||
419 | |||
420 | endmenu | ||
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile new file mode 100644 index 000000000000..2781403a0236 --- /dev/null +++ b/drivers/hwmon/Makefile | |||
@@ -0,0 +1,44 @@ | |||
1 | # | ||
2 | # Makefile for sensor chip drivers. | ||
3 | # | ||
4 | |||
5 | # asb100, then w83781d go first, as they can override other drivers' addresses. | ||
6 | obj-$(CONFIG_SENSORS_ASB100) += asb100.o | ||
7 | obj-$(CONFIG_SENSORS_W83627HF) += w83627hf.o | ||
8 | obj-$(CONFIG_SENSORS_W83781D) += w83781d.o | ||
9 | |||
10 | obj-$(CONFIG_SENSORS_ADM1021) += adm1021.o | ||
11 | obj-$(CONFIG_SENSORS_ADM1025) += adm1025.o | ||
12 | obj-$(CONFIG_SENSORS_ADM1026) += adm1026.o | ||
13 | obj-$(CONFIG_SENSORS_ADM1031) += adm1031.o | ||
14 | obj-$(CONFIG_SENSORS_ADM9240) += adm9240.o | ||
15 | obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o | ||
16 | obj-$(CONFIG_SENSORS_DS1621) += ds1621.o | ||
17 | obj-$(CONFIG_SENSORS_FSCHER) += fscher.o | ||
18 | obj-$(CONFIG_SENSORS_FSCPOS) += fscpos.o | ||
19 | obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o | ||
20 | obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o | ||
21 | obj-$(CONFIG_SENSORS_IT87) += it87.o | ||
22 | obj-$(CONFIG_SENSORS_LM63) += lm63.o | ||
23 | obj-$(CONFIG_SENSORS_LM75) += lm75.o | ||
24 | obj-$(CONFIG_SENSORS_LM77) += lm77.o | ||
25 | obj-$(CONFIG_SENSORS_LM78) += lm78.o | ||
26 | obj-$(CONFIG_SENSORS_LM80) += lm80.o | ||
27 | obj-$(CONFIG_SENSORS_LM83) += lm83.o | ||
28 | obj-$(CONFIG_SENSORS_LM85) += lm85.o | ||
29 | obj-$(CONFIG_SENSORS_LM87) += lm87.o | ||
30 | obj-$(CONFIG_SENSORS_LM90) += lm90.o | ||
31 | obj-$(CONFIG_SENSORS_LM92) += lm92.o | ||
32 | obj-$(CONFIG_SENSORS_MAX1619) += max1619.o | ||
33 | obj-$(CONFIG_SENSORS_PC87360) += pc87360.o | ||
34 | obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o | ||
35 | obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o | ||
36 | obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o | ||
37 | obj-$(CONFIG_SENSORS_VIA686A) += via686a.o | ||
38 | obj-$(CONFIG_SENSORS_W83627EHF) += w83627ehf.o | ||
39 | obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o | ||
40 | |||
41 | ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y) | ||
42 | EXTRA_CFLAGS += -DDEBUG | ||
43 | endif | ||
44 | |||
diff --git a/drivers/i2c/chips/adm1021.c b/drivers/hwmon/adm1021.c index d2c774c32f45..d2c774c32f45 100644 --- a/drivers/i2c/chips/adm1021.c +++ b/drivers/hwmon/adm1021.c | |||
diff --git a/drivers/i2c/chips/adm1025.c b/drivers/hwmon/adm1025.c index e452d0daf906..e452d0daf906 100644 --- a/drivers/i2c/chips/adm1025.c +++ b/drivers/hwmon/adm1025.c | |||
diff --git a/drivers/i2c/chips/adm1026.c b/drivers/hwmon/adm1026.c index 3c85fe150cd7..3c85fe150cd7 100644 --- a/drivers/i2c/chips/adm1026.c +++ b/drivers/hwmon/adm1026.c | |||
diff --git a/drivers/i2c/chips/adm1031.c b/drivers/hwmon/adm1031.c index 9168e983ca1d..9168e983ca1d 100644 --- a/drivers/i2c/chips/adm1031.c +++ b/drivers/hwmon/adm1031.c | |||
diff --git a/drivers/i2c/chips/adm9240.c b/drivers/hwmon/adm9240.c index 5c68e9c311aa..5c68e9c311aa 100644 --- a/drivers/i2c/chips/adm9240.c +++ b/drivers/hwmon/adm9240.c | |||
diff --git a/drivers/i2c/chips/asb100.c b/drivers/hwmon/asb100.c index 70d996d6fe0a..70d996d6fe0a 100644 --- a/drivers/i2c/chips/asb100.c +++ b/drivers/hwmon/asb100.c | |||
diff --git a/drivers/i2c/chips/atxp1.c b/drivers/hwmon/atxp1.c index 0bcf82b4c07b..0bcf82b4c07b 100644 --- a/drivers/i2c/chips/atxp1.c +++ b/drivers/hwmon/atxp1.c | |||
diff --git a/drivers/i2c/chips/ds1621.c b/drivers/hwmon/ds1621.c index 5360d58804f6..5360d58804f6 100644 --- a/drivers/i2c/chips/ds1621.c +++ b/drivers/hwmon/ds1621.c | |||
diff --git a/drivers/i2c/chips/fscher.c b/drivers/hwmon/fscher.c index da411741c2c5..da411741c2c5 100644 --- a/drivers/i2c/chips/fscher.c +++ b/drivers/hwmon/fscher.c | |||
diff --git a/drivers/i2c/chips/fscpos.c b/drivers/hwmon/fscpos.c index 3beaa6191ef4..3beaa6191ef4 100644 --- a/drivers/i2c/chips/fscpos.c +++ b/drivers/hwmon/fscpos.c | |||
diff --git a/drivers/i2c/chips/gl518sm.c b/drivers/hwmon/gl518sm.c index 6bedf729dcf5..6bedf729dcf5 100644 --- a/drivers/i2c/chips/gl518sm.c +++ b/drivers/hwmon/gl518sm.c | |||
diff --git a/drivers/i2c/chips/gl520sm.c b/drivers/hwmon/gl520sm.c index a13a504f5bfa..a13a504f5bfa 100644 --- a/drivers/i2c/chips/gl520sm.c +++ b/drivers/hwmon/gl520sm.c | |||
diff --git a/drivers/i2c/chips/it87.c b/drivers/hwmon/it87.c index db20c9e47393..db20c9e47393 100644 --- a/drivers/i2c/chips/it87.c +++ b/drivers/hwmon/it87.c | |||
diff --git a/drivers/i2c/chips/lm63.c b/drivers/hwmon/lm63.c index 7c6f9ea5a254..7c6f9ea5a254 100644 --- a/drivers/i2c/chips/lm63.c +++ b/drivers/hwmon/lm63.c | |||
diff --git a/drivers/i2c/chips/lm75.c b/drivers/hwmon/lm75.c index 5be164ed278e..5be164ed278e 100644 --- a/drivers/i2c/chips/lm75.c +++ b/drivers/hwmon/lm75.c | |||
diff --git a/drivers/i2c/chips/lm75.h b/drivers/hwmon/lm75.h index 63e3f2fb4c21..63e3f2fb4c21 100644 --- a/drivers/i2c/chips/lm75.h +++ b/drivers/hwmon/lm75.h | |||
diff --git a/drivers/i2c/chips/lm77.c b/drivers/hwmon/lm77.c index b98f44952997..b98f44952997 100644 --- a/drivers/i2c/chips/lm77.c +++ b/drivers/hwmon/lm77.c | |||
diff --git a/drivers/i2c/chips/lm78.c b/drivers/hwmon/lm78.c index 29241469dcba..29241469dcba 100644 --- a/drivers/i2c/chips/lm78.c +++ b/drivers/hwmon/lm78.c | |||
diff --git a/drivers/i2c/chips/lm80.c b/drivers/hwmon/lm80.c index 8100595feb44..8100595feb44 100644 --- a/drivers/i2c/chips/lm80.c +++ b/drivers/hwmon/lm80.c | |||
diff --git a/drivers/i2c/chips/lm83.c b/drivers/hwmon/lm83.c index a49008b444c8..a49008b444c8 100644 --- a/drivers/i2c/chips/lm83.c +++ b/drivers/hwmon/lm83.c | |||
diff --git a/drivers/i2c/chips/lm85.c b/drivers/hwmon/lm85.c index b4d7fd418264..b4d7fd418264 100644 --- a/drivers/i2c/chips/lm85.c +++ b/drivers/hwmon/lm85.c | |||
diff --git a/drivers/i2c/chips/lm87.c b/drivers/hwmon/lm87.c index 1921ed1af182..1921ed1af182 100644 --- a/drivers/i2c/chips/lm87.c +++ b/drivers/hwmon/lm87.c | |||
diff --git a/drivers/i2c/chips/lm90.c b/drivers/hwmon/lm90.c index a67dcadf7cb0..a67dcadf7cb0 100644 --- a/drivers/i2c/chips/lm90.c +++ b/drivers/hwmon/lm90.c | |||
diff --git a/drivers/i2c/chips/lm92.c b/drivers/hwmon/lm92.c index 215c8e40ffdd..215c8e40ffdd 100644 --- a/drivers/i2c/chips/lm92.c +++ b/drivers/hwmon/lm92.c | |||
diff --git a/drivers/i2c/chips/max1619.c b/drivers/hwmon/max1619.c index bf553dcd97d6..bf553dcd97d6 100644 --- a/drivers/i2c/chips/max1619.c +++ b/drivers/hwmon/max1619.c | |||
diff --git a/drivers/i2c/chips/pc87360.c b/drivers/hwmon/pc87360.c index 876c68f3af31..876c68f3af31 100644 --- a/drivers/i2c/chips/pc87360.c +++ b/drivers/hwmon/pc87360.c | |||
diff --git a/drivers/i2c/chips/sis5595.c b/drivers/hwmon/sis5595.c index 6bbfc8fb4f13..6bbfc8fb4f13 100644 --- a/drivers/i2c/chips/sis5595.c +++ b/drivers/hwmon/sis5595.c | |||
diff --git a/drivers/i2c/chips/smsc47b397.c b/drivers/hwmon/smsc47b397.c index 251ac2659554..251ac2659554 100644 --- a/drivers/i2c/chips/smsc47b397.c +++ b/drivers/hwmon/smsc47b397.c | |||
diff --git a/drivers/i2c/chips/smsc47m1.c b/drivers/hwmon/smsc47m1.c index 897117a7213f..897117a7213f 100644 --- a/drivers/i2c/chips/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c | |||
diff --git a/drivers/i2c/chips/via686a.c b/drivers/hwmon/via686a.c index 137d9b7cacd4..164d47948390 100644 --- a/drivers/i2c/chips/via686a.c +++ b/drivers/hwmon/via686a.c | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | via686a.c - Part of lm_sensors, Linux kernel modules | 2 | via686a.c - Part of lm_sensors, Linux kernel modules |
3 | for hardware monitoring | 3 | for hardware monitoring |
4 | 4 | ||
5 | Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl>, | 5 | Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl>, |
6 | Kyösti Mälkki <kmalkki@cc.hut.fi>, | 6 | Kyösti Mälkki <kmalkki@cc.hut.fi>, |
7 | Mark Studebaker <mdsxyz123@yahoo.com>, | 7 | Mark Studebaker <mdsxyz123@yahoo.com>, |
8 | and Bob Dougherty <bobd@stanford.edu> | 8 | and Bob Dougherty <bobd@stanford.edu> |
9 | (Some conversion-factor data were contributed by Jonathan Teh Soon Yew | 9 | (Some conversion-factor data were contributed by Jonathan Teh Soon Yew |
@@ -171,18 +171,18 @@ static inline u8 FAN_TO_REG(long rpm, int div) | |||
171 | /******** TEMP CONVERSIONS (Bob Dougherty) *********/ | 171 | /******** TEMP CONVERSIONS (Bob Dougherty) *********/ |
172 | /* linear fits from HWMon.cpp (Copyright 1998-2000 Jonathan Teh Soon Yew) | 172 | /* linear fits from HWMon.cpp (Copyright 1998-2000 Jonathan Teh Soon Yew) |
173 | if(temp<169) | 173 | if(temp<169) |
174 | return double(temp)*0.427-32.08; | 174 | return double(temp)*0.427-32.08; |
175 | else if(temp>=169 && temp<=202) | 175 | else if(temp>=169 && temp<=202) |
176 | return double(temp)*0.582-58.16; | 176 | return double(temp)*0.582-58.16; |
177 | else | 177 | else |
178 | return double(temp)*0.924-127.33; | 178 | return double(temp)*0.924-127.33; |
179 | 179 | ||
180 | A fifth-order polynomial fits the unofficial data (provided by Alex van | 180 | A fifth-order polynomial fits the unofficial data (provided by Alex van |
181 | Kaam <darkside@chello.nl>) a bit better. It also give more reasonable | 181 | Kaam <darkside@chello.nl>) a bit better. It also give more reasonable |
182 | numbers on my machine (ie. they agree with what my BIOS tells me). | 182 | numbers on my machine (ie. they agree with what my BIOS tells me). |
183 | Here's the fifth-order fit to the 8-bit data: | 183 | Here's the fifth-order fit to the 8-bit data: |
184 | temp = 1.625093e-10*val^5 - 1.001632e-07*val^4 + 2.457653e-05*val^3 - | 184 | temp = 1.625093e-10*val^5 - 1.001632e-07*val^4 + 2.457653e-05*val^3 - |
185 | 2.967619e-03*val^2 + 2.175144e-01*val - 7.090067e+0. | 185 | 2.967619e-03*val^2 + 2.175144e-01*val - 7.090067e+0. |
186 | 186 | ||
187 | (2000-10-25- RFD: thanks to Uwe Andersen <uandersen@mayah.com> for | 187 | (2000-10-25- RFD: thanks to Uwe Andersen <uandersen@mayah.com> for |
188 | finding my typos in this formula!) | 188 | finding my typos in this formula!) |
diff --git a/drivers/i2c/chips/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 8a40b6976e1a..8a40b6976e1a 100644 --- a/drivers/i2c/chips/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
diff --git a/drivers/i2c/chips/w83627hf.c b/drivers/hwmon/w83627hf.c index bd87a42e068a..bd87a42e068a 100644 --- a/drivers/i2c/chips/w83627hf.c +++ b/drivers/hwmon/w83627hf.c | |||
diff --git a/drivers/i2c/chips/w83781d.c b/drivers/hwmon/w83781d.c index 0bb131ce09eb..0bb131ce09eb 100644 --- a/drivers/i2c/chips/w83781d.c +++ b/drivers/hwmon/w83781d.c | |||
diff --git a/drivers/i2c/chips/w83l785ts.c b/drivers/hwmon/w83l785ts.c index 4469d52aba4c..4469d52aba4c 100644 --- a/drivers/i2c/chips/w83l785ts.c +++ b/drivers/hwmon/w83l785ts.c | |||
diff --git a/drivers/i2c/algos/i2c-algo-ite.c b/drivers/i2c/algos/i2c-algo-ite.c index 68e9e6832ca0..e6cae39f47aa 100644 --- a/drivers/i2c/algos/i2c-algo-ite.c +++ b/drivers/i2c/algos/i2c-algo-ite.c | |||
@@ -208,7 +208,7 @@ static int test_bus(struct i2c_algo_iic_data *adap, char *name) { | |||
208 | goto bailout; | 208 | goto bailout; |
209 | } | 209 | } |
210 | sdalo(adap); | 210 | sdalo(adap); |
211 | printk("test_bus:1 scl: %d sda: %d \n",getscl(adap), | 211 | printk("test_bus:1 scl: %d sda: %d\n", getscl(adap), |
212 | getsda(adap)); | 212 | getsda(adap)); |
213 | if ( 0 != getsda(adap) ) { | 213 | if ( 0 != getsda(adap) ) { |
214 | printk("test_bus: %s SDA stuck high!\n",name); | 214 | printk("test_bus: %s SDA stuck high!\n",name); |
@@ -221,7 +221,7 @@ static int test_bus(struct i2c_algo_iic_data *adap, char *name) { | |||
221 | goto bailout; | 221 | goto bailout; |
222 | } | 222 | } |
223 | sdahi(adap); | 223 | sdahi(adap); |
224 | printk("test_bus:2 scl: %d sda: %d \n",getscl(adap), | 224 | printk("test_bus:2 scl: %d sda: %d\n", getscl(adap), |
225 | getsda(adap)); | 225 | getsda(adap)); |
226 | if ( 0 == getsda(adap) ) { | 226 | if ( 0 == getsda(adap) ) { |
227 | printk("test_bus: %s SDA stuck low!\n",name); | 227 | printk("test_bus: %s SDA stuck low!\n",name); |
@@ -234,7 +234,7 @@ static int test_bus(struct i2c_algo_iic_data *adap, char *name) { | |||
234 | goto bailout; | 234 | goto bailout; |
235 | } | 235 | } |
236 | scllo(adap); | 236 | scllo(adap); |
237 | printk("test_bus:3 scl: %d sda: %d \n",getscl(adap), | 237 | printk("test_bus:3 scl: %d sda: %d\n", getscl(adap), |
238 | getsda(adap)); | 238 | getsda(adap)); |
239 | if ( 0 != getscl(adap) ) { | 239 | if ( 0 != getscl(adap) ) { |
240 | 240 | ||
@@ -247,7 +247,7 @@ static int test_bus(struct i2c_algo_iic_data *adap, char *name) { | |||
247 | goto bailout; | 247 | goto bailout; |
248 | } | 248 | } |
249 | sclhi(adap); | 249 | sclhi(adap); |
250 | printk("test_bus:4 scl: %d sda: %d \n",getscl(adap), | 250 | printk("test_bus:4 scl: %d sda: %d\n", getscl(adap), |
251 | getsda(adap)); | 251 | getsda(adap)); |
252 | if ( 0 == getscl(adap) ) { | 252 | if ( 0 == getscl(adap) ) { |
253 | printk("test_bus: %s SCL stuck low!\n",name); | 253 | printk("test_bus: %s SCL stuck low!\n",name); |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 45e6efb1dcd1..0ab7e37f5b00 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -194,7 +194,7 @@ static int i801_transaction(void) | |||
194 | /* Make sure the SMBus host is ready to start transmitting */ | 194 | /* Make sure the SMBus host is ready to start transmitting */ |
195 | /* 0x1f = Failed, Bus_Err, Dev_Err, Intr, Host_Busy */ | 195 | /* 0x1f = Failed, Bus_Err, Dev_Err, Intr, Host_Busy */ |
196 | if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) { | 196 | if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) { |
197 | dev_dbg(&I801_dev->dev, "SMBus busy (%02x). Resetting... \n", | 197 | dev_dbg(&I801_dev->dev, "SMBus busy (%02x). Resetting...\n", |
198 | temp); | 198 | temp); |
199 | outb_p(temp, SMBHSTSTS); | 199 | outb_p(temp, SMBHSTSTS); |
200 | if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) { | 200 | if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) { |
@@ -315,7 +315,7 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write, | |||
315 | } | 315 | } |
316 | if (temp & errmask) { | 316 | if (temp & errmask) { |
317 | dev_dbg(&I801_dev->dev, "SMBus busy (%02x). " | 317 | dev_dbg(&I801_dev->dev, "SMBus busy (%02x). " |
318 | "Resetting... \n", temp); | 318 | "Resetting...\n", temp); |
319 | outb_p(temp, SMBHSTSTS); | 319 | outb_p(temp, SMBHSTSTS); |
320 | if (((temp = inb_p(SMBHSTSTS)) & errmask) != 0x00) { | 320 | if (((temp = inb_p(SMBHSTSTS)) & errmask) != 0x00) { |
321 | dev_err(&I801_dev->dev, | 321 | dev_err(&I801_dev->dev, |
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index 1f80ba9da6f1..6d34ee381ce1 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c | |||
@@ -243,7 +243,7 @@ static int piix4_transaction(void) | |||
243 | /* Make sure the SMBus host is ready to start transmitting */ | 243 | /* Make sure the SMBus host is ready to start transmitting */ |
244 | if ((temp = inb_p(SMBHSTSTS)) != 0x00) { | 244 | if ((temp = inb_p(SMBHSTSTS)) != 0x00) { |
245 | dev_dbg(&piix4_adapter.dev, "SMBus busy (%02x). " | 245 | dev_dbg(&piix4_adapter.dev, "SMBus busy (%02x). " |
246 | "Resetting... \n", temp); | 246 | "Resetting...\n", temp); |
247 | outb_p(temp, SMBHSTSTS); | 247 | outb_p(temp, SMBHSTSTS); |
248 | if ((temp = inb_p(SMBHSTSTS)) != 0x00) { | 248 | if ((temp = inb_p(SMBHSTSTS)) != 0x00) { |
249 | dev_err(&piix4_adapter.dev, "Failed! (%02x)\n", temp); | 249 | dev_err(&piix4_adapter.dev, "Failed! (%02x)\n", temp); |
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c index 2b5911cfb7b5..bbd5e4e52f09 100644 --- a/drivers/i2c/busses/i2c-sis5595.c +++ b/drivers/i2c/busses/i2c-sis5595.c | |||
@@ -228,7 +228,7 @@ static int sis5595_transaction(struct i2c_adapter *adap) | |||
228 | /* Make sure the SMBus host is ready to start transmitting */ | 228 | /* Make sure the SMBus host is ready to start transmitting */ |
229 | temp = sis5595_read(SMB_STS_LO) + (sis5595_read(SMB_STS_HI) << 8); | 229 | temp = sis5595_read(SMB_STS_LO) + (sis5595_read(SMB_STS_HI) << 8); |
230 | if (temp != 0x00) { | 230 | if (temp != 0x00) { |
231 | dev_dbg(&adap->dev, "SMBus busy (%04x). Resetting... \n", temp); | 231 | dev_dbg(&adap->dev, "SMBus busy (%04x). Resetting...\n", temp); |
232 | sis5595_write(SMB_STS_LO, temp & 0xff); | 232 | sis5595_write(SMB_STS_LO, temp & 0xff); |
233 | sis5595_write(SMB_STS_HI, temp >> 8); | 233 | sis5595_write(SMB_STS_HI, temp >> 8); |
234 | if ((temp = sis5595_read(SMB_STS_LO) + (sis5595_read(SMB_STS_HI) << 8)) != 0x00) { | 234 | if ((temp = sis5595_read(SMB_STS_LO) + (sis5595_read(SMB_STS_HI) << 8)) != 0x00) { |
diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig index a0982da09803..43f70dbfc03f 100644 --- a/drivers/i2c/chips/Kconfig +++ b/drivers/i2c/chips/Kconfig | |||
@@ -1,409 +1,12 @@ | |||
1 | # | 1 | # |
2 | # I2C Sensor and "other" chip configuration | 2 | # Miscellaneous I2C chip drivers configuration |
3 | # | 3 | # |
4 | 4 | ||
5 | menu "Hardware Sensors Chip support" | ||
6 | depends on I2C | ||
7 | |||
8 | config I2C_SENSOR | 5 | config I2C_SENSOR |
9 | tristate | 6 | tristate |
10 | default n | 7 | default n |
11 | 8 | ||
12 | config SENSORS_ADM1021 | 9 | menu "Miscellaneous I2C Chip support" |
13 | tristate "Analog Devices ADM1021 and compatibles" | ||
14 | depends on I2C | ||
15 | select I2C_SENSOR | ||
16 | help | ||
17 | If you say yes here you get support for Analog Devices ADM1021 | ||
18 | and ADM1023 sensor chips and clones: Maxim MAX1617 and MAX1617A, | ||
19 | Genesys Logic GL523SM, National Semiconductor LM84, TI THMC10, | ||
20 | and the XEON processor built-in sensor. | ||
21 | |||
22 | This driver can also be built as a module. If so, the module | ||
23 | will be called adm1021. | ||
24 | |||
25 | config SENSORS_ADM1025 | ||
26 | tristate "Analog Devices ADM1025 and compatibles" | ||
27 | depends on I2C && EXPERIMENTAL | ||
28 | select I2C_SENSOR | ||
29 | help | ||
30 | If you say yes here you get support for Analog Devices ADM1025 | ||
31 | and Philips NE1619 sensor chips. | ||
32 | |||
33 | This driver can also be built as a module. If so, the module | ||
34 | will be called adm1025. | ||
35 | |||
36 | config SENSORS_ADM1026 | ||
37 | tristate "Analog Devices ADM1026 and compatibles" | ||
38 | depends on I2C && EXPERIMENTAL | ||
39 | select I2C_SENSOR | ||
40 | help | ||
41 | If you say yes here you get support for Analog Devices ADM1026 | ||
42 | sensor chip. | ||
43 | |||
44 | This driver can also be built as a module. If so, the module | ||
45 | will be called adm1026. | ||
46 | |||
47 | config SENSORS_ADM1031 | ||
48 | tristate "Analog Devices ADM1031 and compatibles" | ||
49 | depends on I2C && EXPERIMENTAL | ||
50 | select I2C_SENSOR | ||
51 | help | ||
52 | If you say yes here you get support for Analog Devices ADM1031 | ||
53 | and ADM1030 sensor chips. | ||
54 | |||
55 | This driver can also be built as a module. If so, the module | ||
56 | will be called adm1031. | ||
57 | |||
58 | config SENSORS_ADM9240 | ||
59 | tristate "Analog Devices ADM9240 and compatibles" | ||
60 | depends on I2C && EXPERIMENTAL | ||
61 | select I2C_SENSOR | ||
62 | help | ||
63 | If you say yes here you get support for Analog Devices ADM9240, | ||
64 | Dallas DS1780, National Semiconductor LM81 sensor chips. | ||
65 | |||
66 | This driver can also be built as a module. If so, the module | ||
67 | will be called adm9240. | ||
68 | |||
69 | config SENSORS_ASB100 | ||
70 | tristate "Asus ASB100 Bach" | ||
71 | depends on I2C && EXPERIMENTAL | ||
72 | select I2C_SENSOR | ||
73 | help | ||
74 | If you say yes here you get support for the ASB100 Bach sensor | ||
75 | chip found on some Asus mainboards. | ||
76 | |||
77 | This driver can also be built as a module. If so, the module | ||
78 | will be called asb100. | ||
79 | |||
80 | config SENSORS_ATXP1 | ||
81 | tristate "Attansic ATXP1 VID controller" | ||
82 | depends on I2C && EXPERIMENTAL | ||
83 | help | ||
84 | If you say yes here you get support for the Attansic ATXP1 VID | ||
85 | controller. | ||
86 | |||
87 | If your board have such a chip, you are able to control your CPU | ||
88 | core and other voltages. | ||
89 | |||
90 | This driver can also be built as a module. If so, the module | ||
91 | will be called atxp1. | ||
92 | |||
93 | config SENSORS_DS1621 | ||
94 | tristate "Dallas Semiconductor DS1621 and DS1625" | ||
95 | depends on I2C && EXPERIMENTAL | ||
96 | select I2C_SENSOR | ||
97 | help | ||
98 | If you say yes here you get support for Dallas Semiconductor | ||
99 | DS1621 and DS1625 sensor chips. | ||
100 | |||
101 | This driver can also be built as a module. If so, the module | ||
102 | will be called ds1621. | ||
103 | |||
104 | config SENSORS_FSCHER | ||
105 | tristate "FSC Hermes" | ||
106 | depends on I2C && EXPERIMENTAL | ||
107 | select I2C_SENSOR | ||
108 | help | ||
109 | If you say yes here you get support for Fujitsu Siemens | ||
110 | Computers Hermes sensor chips. | ||
111 | |||
112 | This driver can also be built as a module. If so, the module | ||
113 | will be called fscher. | ||
114 | |||
115 | config SENSORS_FSCPOS | ||
116 | tristate "FSC Poseidon" | ||
117 | depends on I2C && EXPERIMENTAL | ||
118 | select I2C_SENSOR | ||
119 | help | ||
120 | If you say yes here you get support for Fujitsu Siemens | ||
121 | Computers Poseidon sensor chips. | ||
122 | |||
123 | This driver can also be built as a module. If so, the module | ||
124 | will be called fscpos. | ||
125 | |||
126 | config SENSORS_GL518SM | ||
127 | tristate "Genesys Logic GL518SM" | ||
128 | depends on I2C | ||
129 | select I2C_SENSOR | ||
130 | help | ||
131 | If you say yes here you get support for Genesys Logic GL518SM | ||
132 | sensor chips. | ||
133 | |||
134 | This driver can also be built as a module. If so, the module | ||
135 | will be called gl518sm. | ||
136 | |||
137 | config SENSORS_GL520SM | ||
138 | tristate "Genesys Logic GL520SM" | ||
139 | depends on I2C && EXPERIMENTAL | ||
140 | select I2C_SENSOR | ||
141 | help | ||
142 | If you say yes here you get support for Genesys Logic GL520SM | ||
143 | sensor chips. | ||
144 | |||
145 | This driver can also be built as a module. If so, the module | ||
146 | will be called gl520sm. | ||
147 | |||
148 | config SENSORS_IT87 | ||
149 | tristate "ITE IT87xx and compatibles" | ||
150 | depends on I2C | ||
151 | select I2C_SENSOR | ||
152 | help | ||
153 | If you say yes here you get support for ITE IT87xx sensor chips | ||
154 | and clones: SiS960. | ||
155 | |||
156 | This driver can also be built as a module. If so, the module | ||
157 | will be called it87. | ||
158 | |||
159 | config SENSORS_LM63 | ||
160 | tristate "National Semiconductor LM63" | ||
161 | depends on I2C && EXPERIMENTAL | ||
162 | select I2C_SENSOR | ||
163 | help | ||
164 | If you say yes here you get support for the National Semiconductor | ||
165 | LM63 remote diode digital temperature sensor with integrated fan | ||
166 | control. Such chips are found on the Tyan S4882 (Thunder K8QS Pro) | ||
167 | motherboard, among others. | ||
168 | |||
169 | This driver can also be built as a module. If so, the module | ||
170 | will be called lm63. | ||
171 | |||
172 | config SENSORS_LM75 | ||
173 | tristate "National Semiconductor LM75 and compatibles" | ||
174 | depends on I2C | ||
175 | select I2C_SENSOR | ||
176 | help | ||
177 | If you say yes here you get support for National Semiconductor LM75 | ||
178 | sensor chips and clones: Dallas Semiconductor DS75 and DS1775 (in | ||
179 | 9-bit precision mode), and TelCom (now Microchip) TCN75. | ||
180 | |||
181 | The DS75 and DS1775 in 10- to 12-bit precision modes will require | ||
182 | a force module parameter. The driver will not handle the extra | ||
183 | precision anyhow. | ||
184 | |||
185 | This driver can also be built as a module. If so, the module | ||
186 | will be called lm75. | ||
187 | |||
188 | config SENSORS_LM77 | ||
189 | tristate "National Semiconductor LM77" | ||
190 | depends on I2C && EXPERIMENTAL | ||
191 | select I2C_SENSOR | ||
192 | help | ||
193 | If you say yes here you get support for National Semiconductor LM77 | ||
194 | sensor chips. | ||
195 | |||
196 | This driver can also be built as a module. If so, the module | ||
197 | will be called lm77. | ||
198 | |||
199 | config SENSORS_LM78 | ||
200 | tristate "National Semiconductor LM78 and compatibles" | ||
201 | depends on I2C && EXPERIMENTAL | ||
202 | select I2C_SENSOR | ||
203 | help | ||
204 | If you say yes here you get support for National Semiconductor LM78, | ||
205 | LM78-J and LM79. | ||
206 | |||
207 | This driver can also be built as a module. If so, the module | ||
208 | will be called lm78. | ||
209 | |||
210 | config SENSORS_LM80 | ||
211 | tristate "National Semiconductor LM80" | ||
212 | depends on I2C && EXPERIMENTAL | ||
213 | select I2C_SENSOR | ||
214 | help | ||
215 | If you say yes here you get support for National Semiconductor | ||
216 | LM80 sensor chips. | ||
217 | |||
218 | This driver can also be built as a module. If so, the module | ||
219 | will be called lm80. | ||
220 | |||
221 | config SENSORS_LM83 | ||
222 | tristate "National Semiconductor LM83" | ||
223 | depends on I2C | ||
224 | select I2C_SENSOR | ||
225 | help | ||
226 | If you say yes here you get support for National Semiconductor | ||
227 | LM83 sensor chips. | ||
228 | |||
229 | This driver can also be built as a module. If so, the module | ||
230 | will be called lm83. | ||
231 | |||
232 | config SENSORS_LM85 | ||
233 | tristate "National Semiconductor LM85 and compatibles" | ||
234 | depends on I2C && EXPERIMENTAL | ||
235 | select I2C_SENSOR | ||
236 | help | ||
237 | If you say yes here you get support for National Semiconductor LM85 | ||
238 | sensor chips and clones: ADT7463, EMC6D100, EMC6D102 and ADM1027. | ||
239 | |||
240 | This driver can also be built as a module. If so, the module | ||
241 | will be called lm85. | ||
242 | |||
243 | config SENSORS_LM87 | ||
244 | tristate "National Semiconductor LM87" | ||
245 | depends on I2C && EXPERIMENTAL | ||
246 | select I2C_SENSOR | ||
247 | help | ||
248 | If you say yes here you get support for National Semiconductor LM87 | ||
249 | sensor chips. | ||
250 | |||
251 | This driver can also be built as a module. If so, the module | ||
252 | will be called lm87. | ||
253 | |||
254 | config SENSORS_LM90 | ||
255 | tristate "National Semiconductor LM90 and compatibles" | ||
256 | depends on I2C | ||
257 | select I2C_SENSOR | ||
258 | help | ||
259 | If you say yes here you get support for National Semiconductor LM90, | ||
260 | LM86, LM89 and LM99, Analog Devices ADM1032 and Maxim MAX6657 and | ||
261 | MAX6658 sensor chips. | ||
262 | |||
263 | The Analog Devices ADT7461 sensor chip is also supported, but only | ||
264 | if found in ADM1032 compatibility mode. | ||
265 | |||
266 | This driver can also be built as a module. If so, the module | ||
267 | will be called lm90. | ||
268 | |||
269 | config SENSORS_LM92 | ||
270 | tristate "National Semiconductor LM92 and compatibles" | ||
271 | depends on I2C && EXPERIMENTAL | ||
272 | select I2C_SENSOR | ||
273 | help | ||
274 | If you say yes here you get support for National Semiconductor LM92 | ||
275 | and Maxim MAX6635 sensor chips. | ||
276 | |||
277 | This driver can also be built as a module. If so, the module | ||
278 | will be called lm92. | ||
279 | |||
280 | config SENSORS_MAX1619 | ||
281 | tristate "Maxim MAX1619 sensor chip" | ||
282 | depends on I2C && EXPERIMENTAL | ||
283 | select I2C_SENSOR | ||
284 | help | ||
285 | If you say yes here you get support for MAX1619 sensor chip. | ||
286 | |||
287 | This driver can also be built as a module. If so, the module | ||
288 | will be called max1619. | ||
289 | |||
290 | config SENSORS_PC87360 | ||
291 | tristate "National Semiconductor PC87360 family" | ||
292 | depends on I2C && EXPERIMENTAL | ||
293 | select I2C_SENSOR | ||
294 | select I2C_ISA | ||
295 | help | ||
296 | If you say yes here you get access to the hardware monitoring | ||
297 | functions of the National Semiconductor PC8736x Super-I/O chips. | ||
298 | The PC87360, PC87363 and PC87364 only have fan monitoring and | ||
299 | control. The PC87365 and PC87366 additionally have voltage and | ||
300 | temperature monitoring. | ||
301 | |||
302 | This driver can also be built as a module. If so, the module | ||
303 | will be called pc87360. | ||
304 | |||
305 | config SENSORS_SMSC47B397 | ||
306 | tristate "SMSC LPC47B397-NC" | ||
307 | depends on I2C && EXPERIMENTAL | ||
308 | select I2C_SENSOR | ||
309 | select I2C_ISA | ||
310 | help | ||
311 | If you say yes here you get support for the SMSC LPC47B397-NC | ||
312 | sensor chip. | ||
313 | |||
314 | This driver can also be built as a module. If so, the module | ||
315 | will be called smsc47b397. | ||
316 | |||
317 | config SENSORS_SIS5595 | ||
318 | tristate "Silicon Integrated Systems Corp. SiS5595" | ||
319 | depends on I2C && PCI && EXPERIMENTAL | ||
320 | select I2C_SENSOR | ||
321 | select I2C_ISA | ||
322 | help | ||
323 | If you say yes here you get support for the integrated sensors in | ||
324 | SiS5595 South Bridges. | ||
325 | |||
326 | This driver can also be built as a module. If so, the module | ||
327 | will be called sis5595. | ||
328 | |||
329 | config SENSORS_SMSC47M1 | ||
330 | tristate "SMSC LPC47M10x and compatibles" | ||
331 | depends on I2C && EXPERIMENTAL | ||
332 | select I2C_SENSOR | ||
333 | select I2C_ISA | ||
334 | help | ||
335 | If you say yes here you get support for the integrated fan | ||
336 | monitoring and control capabilities of the SMSC LPC47B27x, | ||
337 | LPC47M10x, LPC47M13x, LPC47M14x, LPC47M15x and LPC47M192 chips. | ||
338 | |||
339 | This driver can also be built as a module. If so, the module | ||
340 | will be called smsc47m1. | ||
341 | |||
342 | config SENSORS_VIA686A | ||
343 | tristate "VIA686A" | ||
344 | depends on I2C && PCI | ||
345 | select I2C_SENSOR | ||
346 | select I2C_ISA | ||
347 | help | ||
348 | If you say yes here you get support for the integrated sensors in | ||
349 | Via 686A/B South Bridges. | ||
350 | |||
351 | This driver can also be built as a module. If so, the module | ||
352 | will be called via686a. | ||
353 | |||
354 | config SENSORS_W83781D | ||
355 | tristate "Winbond W83781D, W83782D, W83783S, W83627HF, Asus AS99127F" | ||
356 | depends on I2C | ||
357 | select I2C_SENSOR | ||
358 | help | ||
359 | If you say yes here you get support for the Winbond W8378x series | ||
360 | of sensor chips: the W83781D, W83782D, W83783S and W83627HF, | ||
361 | and the similar Asus AS99127F. | ||
362 | |||
363 | This driver can also be built as a module. If so, the module | ||
364 | will be called w83781d. | ||
365 | |||
366 | config SENSORS_W83L785TS | ||
367 | tristate "Winbond W83L785TS-S" | ||
368 | depends on I2C && EXPERIMENTAL | ||
369 | select I2C_SENSOR | ||
370 | help | ||
371 | If you say yes here you get support for the Winbond W83L785TS-S | ||
372 | sensor chip, which is used on the Asus A7N8X, among other | ||
373 | motherboards. | ||
374 | |||
375 | This driver can also be built as a module. If so, the module | ||
376 | will be called w83l785ts. | ||
377 | |||
378 | config SENSORS_W83627HF | ||
379 | tristate "Winbond W83627HF, W83627THF, W83637HF, W83697HF" | ||
380 | depends on I2C && EXPERIMENTAL | ||
381 | select I2C_SENSOR | ||
382 | select I2C_ISA | ||
383 | help | ||
384 | If you say yes here you get support for the Winbond W836X7 series | ||
385 | of sensor chips: the W83627HF, W83627THF, W83637HF, and the W83697HF | ||
386 | |||
387 | This driver can also be built as a module. If so, the module | ||
388 | will be called w83627hf. | ||
389 | |||
390 | config SENSORS_W83627EHF | ||
391 | tristate "Winbond W83627EHF" | ||
392 | depends on I2C && EXPERIMENTAL | ||
393 | select I2C_SENSOR | ||
394 | select I2C_ISA | ||
395 | help | ||
396 | If you say yes here you get preliminary support for the hardware | ||
397 | monitoring functionality of the Winbond W83627EHF Super-I/O chip. | ||
398 | Only fan and temperature inputs are supported at the moment, while | ||
399 | the chip does much more than that. | ||
400 | |||
401 | This driver can also be built as a module. If so, the module | ||
402 | will be called w83627ehf. | ||
403 | |||
404 | endmenu | ||
405 | |||
406 | menu "Other I2C Chip support" | ||
407 | depends on I2C | 10 | depends on I2C |
408 | 11 | ||
409 | config SENSORS_DS1337 | 12 | config SENSORS_DS1337 |
@@ -509,7 +112,6 @@ config TPS65010 | |||
509 | This driver can also be built as a module. If so, the module | 112 | This driver can also be built as a module. If so, the module |
510 | will be called tps65010. | 113 | will be called tps65010. |
511 | 114 | ||
512 | |||
513 | config SENSORS_M41T00 | 115 | config SENSORS_M41T00 |
514 | tristate "ST M41T00 RTC chip" | 116 | tristate "ST M41T00 RTC chip" |
515 | depends on I2C && PPC32 | 117 | depends on I2C && PPC32 |
@@ -520,13 +122,16 @@ config SENSORS_M41T00 | |||
520 | will be called m41t00. | 122 | will be called m41t00. |
521 | 123 | ||
522 | config SENSORS_MAX6875 | 124 | config SENSORS_MAX6875 |
523 | tristate "MAXIM MAX6875 Power supply supervisor" | 125 | tristate "Maxim MAX6875 Power supply supervisor" |
524 | depends on I2C && EXPERIMENTAL | 126 | depends on I2C && EXPERIMENTAL |
525 | help | 127 | help |
526 | If you say yes here you get support for the MAX6875 | 128 | If you say yes here you get support for the Maxim MAX6875 |
527 | EEPROM-Programmable, Hex/Quad, Power-Suppy Sequencers/Supervisors. | 129 | EEPROM-programmable, quad power-supply sequencer/supervisor. |
130 | |||
131 | This provides an interface to program the EEPROM and reset the chip. | ||
528 | 132 | ||
529 | This provides a interface to program the EEPROM and reset the chip. | 133 | This driver also supports the Maxim MAX6874 hex power-supply |
134 | sequencer/supervisor if found at a compatible address. | ||
530 | 135 | ||
531 | This driver can also be built as a module. If so, the module | 136 | This driver can also be built as a module. If so, the module |
532 | will be called max6875. | 137 | will be called max6875. |
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile index b5e6d2f84f97..a876dd42b860 100644 --- a/drivers/i2c/chips/Makefile +++ b/drivers/i2c/chips/Makefile | |||
@@ -1,52 +1,16 @@ | |||
1 | # | 1 | # |
2 | # Makefile for sensor and "other" I2C chip drivers. | 2 | # Makefile for miscellaneous I2C chip drivers. |
3 | # | 3 | # |
4 | 4 | ||
5 | # asb100, then w83781d go first, as they can override other drivers' addresses. | ||
6 | obj-$(CONFIG_SENSORS_ASB100) += asb100.o | ||
7 | obj-$(CONFIG_SENSORS_W83627HF) += w83627hf.o | ||
8 | obj-$(CONFIG_SENSORS_W83781D) += w83781d.o | ||
9 | |||
10 | obj-$(CONFIG_SENSORS_ADM1021) += adm1021.o | ||
11 | obj-$(CONFIG_SENSORS_ADM1025) += adm1025.o | ||
12 | obj-$(CONFIG_SENSORS_ADM1026) += adm1026.o | ||
13 | obj-$(CONFIG_SENSORS_ADM1031) += adm1031.o | ||
14 | obj-$(CONFIG_SENSORS_ADM9240) += adm9240.o | ||
15 | obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o | ||
16 | obj-$(CONFIG_SENSORS_DS1337) += ds1337.o | 5 | obj-$(CONFIG_SENSORS_DS1337) += ds1337.o |
17 | obj-$(CONFIG_SENSORS_DS1374) += ds1374.o | 6 | obj-$(CONFIG_SENSORS_DS1374) += ds1374.o |
18 | obj-$(CONFIG_SENSORS_DS1621) += ds1621.o | ||
19 | obj-$(CONFIG_SENSORS_EEPROM) += eeprom.o | 7 | obj-$(CONFIG_SENSORS_EEPROM) += eeprom.o |
20 | obj-$(CONFIG_SENSORS_FSCHER) += fscher.o | ||
21 | obj-$(CONFIG_SENSORS_FSCPOS) += fscpos.o | ||
22 | obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o | ||
23 | obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o | ||
24 | obj-$(CONFIG_SENSORS_IT87) += it87.o | ||
25 | obj-$(CONFIG_SENSORS_LM63) += lm63.o | ||
26 | obj-$(CONFIG_SENSORS_LM75) += lm75.o | ||
27 | obj-$(CONFIG_SENSORS_LM77) += lm77.o | ||
28 | obj-$(CONFIG_SENSORS_LM78) += lm78.o | ||
29 | obj-$(CONFIG_SENSORS_LM80) += lm80.o | ||
30 | obj-$(CONFIG_SENSORS_LM83) += lm83.o | ||
31 | obj-$(CONFIG_SENSORS_LM85) += lm85.o | ||
32 | obj-$(CONFIG_SENSORS_LM87) += lm87.o | ||
33 | obj-$(CONFIG_SENSORS_LM90) += lm90.o | ||
34 | obj-$(CONFIG_SENSORS_LM92) += lm92.o | ||
35 | obj-$(CONFIG_SENSORS_MAX1619) += max1619.o | ||
36 | obj-$(CONFIG_SENSORS_MAX6875) += max6875.o | 8 | obj-$(CONFIG_SENSORS_MAX6875) += max6875.o |
37 | obj-$(CONFIG_SENSORS_M41T00) += m41t00.o | 9 | obj-$(CONFIG_SENSORS_M41T00) += m41t00.o |
38 | obj-$(CONFIG_SENSORS_PC87360) += pc87360.o | ||
39 | obj-$(CONFIG_SENSORS_PCA9539) += pca9539.o | 10 | obj-$(CONFIG_SENSORS_PCA9539) += pca9539.o |
40 | obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o | 11 | obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o |
41 | obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o | 12 | obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o |
42 | obj-$(CONFIG_SENSORS_RTC8564) += rtc8564.o | 13 | obj-$(CONFIG_SENSORS_RTC8564) += rtc8564.o |
43 | obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o | ||
44 | obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o | ||
45 | obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o | ||
46 | obj-$(CONFIG_SENSORS_VIA686A) += via686a.o | ||
47 | obj-$(CONFIG_SENSORS_W83627EHF) += w83627ehf.o | ||
48 | obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o | ||
49 | |||
50 | obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o | 14 | obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o |
51 | obj-$(CONFIG_TPS65010) += tps65010.o | 15 | obj-$(CONFIG_TPS65010) += tps65010.o |
52 | 16 | ||
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c index addf0adc24d4..6ea413f6d5e5 100644 --- a/drivers/i2c/chips/eeprom.c +++ b/drivers/i2c/chips/eeprom.c | |||
@@ -173,9 +173,6 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind) | |||
173 | | I2C_FUNC_SMBUS_BYTE)) | 173 | | I2C_FUNC_SMBUS_BYTE)) |
174 | goto exit; | 174 | goto exit; |
175 | 175 | ||
176 | /* OK. For now, we presume we have a valid client. We now create the | ||
177 | client structure, even though we cannot fill it completely yet. | ||
178 | But it allows us to access eeprom_{read,write}_value. */ | ||
179 | if (!(data = kmalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { | 176 | if (!(data = kmalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { |
180 | err = -ENOMEM; | 177 | err = -ENOMEM; |
181 | goto exit; | 178 | goto exit; |
diff --git a/drivers/i2c/chips/m41t00.c b/drivers/i2c/chips/m41t00.c index 5e463c47bfbc..778d7e12859d 100644 --- a/drivers/i2c/chips/m41t00.c +++ b/drivers/i2c/chips/m41t00.c | |||
@@ -207,7 +207,7 @@ m41t00_detach(struct i2c_client *client) | |||
207 | int rc; | 207 | int rc; |
208 | 208 | ||
209 | if ((rc = i2c_detach_client(client)) == 0) { | 209 | if ((rc = i2c_detach_client(client)) == 0) { |
210 | kfree(i2c_get_clientdata(client)); | 210 | kfree(client); |
211 | tasklet_kill(&m41t00_tasklet); | 211 | tasklet_kill(&m41t00_tasklet); |
212 | } | 212 | } |
213 | return rc; | 213 | return rc; |
diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c index fe6b150ec4c2..c4f14d9623c4 100644 --- a/drivers/i2c/chips/max6875.c +++ b/drivers/i2c/chips/max6875.c | |||
@@ -37,7 +37,8 @@ | |||
37 | #include <linux/i2c-sensor.h> | 37 | #include <linux/i2c-sensor.h> |
38 | 38 | ||
39 | /* Addresses to scan */ | 39 | /* Addresses to scan */ |
40 | static unsigned short normal_i2c[] = {0x50, 0x52, I2C_CLIENT_END}; | 40 | /* No address scanned by default, as this could corrupt standard EEPROMS. */ |
41 | static unsigned short normal_i2c[] = {I2C_CLIENT_END}; | ||
41 | static unsigned int normal_isa[] = {I2C_CLIENT_ISA_END}; | 42 | static unsigned int normal_isa[] = {I2C_CLIENT_ISA_END}; |
42 | 43 | ||
43 | /* Insmod parameters */ | 44 | /* Insmod parameters */ |
@@ -369,6 +370,9 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind) | |||
369 | new_client->driver = &max6875_driver; | 370 | new_client->driver = &max6875_driver; |
370 | new_client->flags = 0; | 371 | new_client->flags = 0; |
371 | 372 | ||
373 | /* Prevent 24RF08 corruption */ | ||
374 | i2c_smbus_write_quick(new_client, 0); | ||
375 | |||
372 | /* Setup the user section */ | 376 | /* Setup the user section */ |
373 | data->blocks[max6875_eeprom_user].type = max6875_eeprom_user; | 377 | data->blocks[max6875_eeprom_user].type = max6875_eeprom_user; |
374 | data->blocks[max6875_eeprom_user].slices = USER_EEPROM_SLICES; | 378 | data->blocks[max6875_eeprom_user].slices = USER_EEPROM_SLICES; |
diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c index c0ac01b60039..280e9638c0f8 100644 --- a/drivers/i2c/chips/tps65010.c +++ b/drivers/i2c/chips/tps65010.c | |||
@@ -18,7 +18,6 @@ | |||
18 | * along with this program; if not, write to the Free Software | 18 | * along with this program; if not, write to the Free Software |
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | */ | 20 | */ |
21 | #undef DEBUG | ||
22 | 21 | ||
23 | #include <linux/config.h> | 22 | #include <linux/config.h> |
24 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
@@ -49,11 +48,7 @@ | |||
49 | MODULE_DESCRIPTION("TPS6501x Power Management Driver"); | 48 | MODULE_DESCRIPTION("TPS6501x Power Management Driver"); |
50 | MODULE_LICENSE("GPL"); | 49 | MODULE_LICENSE("GPL"); |
51 | 50 | ||
52 | /* only two addresses possible */ | 51 | static unsigned short normal_i2c[] = { 0x48, /* 0x49, */ I2C_CLIENT_END }; |
53 | #define TPS_BASE 0x48 | ||
54 | static unsigned short normal_i2c[] = { | ||
55 | TPS_BASE, | ||
56 | I2C_CLIENT_END }; | ||
57 | static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; | 52 | static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; |
58 | 53 | ||
59 | I2C_CLIENT_INSMOD; | 54 | I2C_CLIENT_INSMOD; |
@@ -102,7 +97,7 @@ struct tps65010 { | |||
102 | u8 chgstatus, regstatus, chgconf; | 97 | u8 chgstatus, regstatus, chgconf; |
103 | u8 nmask1, nmask2; | 98 | u8 nmask1, nmask2; |
104 | 99 | ||
105 | /* plus four GPIOs, probably used to switch power */ | 100 | /* not currently tracking GPIO state */ |
106 | }; | 101 | }; |
107 | 102 | ||
108 | #define POWER_POLL_DELAY msecs_to_jiffies(800) | 103 | #define POWER_POLL_DELAY msecs_to_jiffies(800) |
@@ -135,7 +130,7 @@ static void dbg_regstat(char *buf, size_t len, u8 regstatus) | |||
135 | (regstatus & TPS_REG_COVER) ? " uncover" : "", | 130 | (regstatus & TPS_REG_COVER) ? " uncover" : "", |
136 | (regstatus & TPS_REG_UVLO) ? " UVLO" : "", | 131 | (regstatus & TPS_REG_UVLO) ? " UVLO" : "", |
137 | (regstatus & TPS_REG_NO_CHG) ? " NO_CHG" : "", | 132 | (regstatus & TPS_REG_NO_CHG) ? " NO_CHG" : "", |
138 | (regstatus & TPS_REG_PG_LD02) ? " ld01_bad" : "", | 133 | (regstatus & TPS_REG_PG_LD02) ? " ld02_bad" : "", |
139 | (regstatus & TPS_REG_PG_LD01) ? " ld01_bad" : "", | 134 | (regstatus & TPS_REG_PG_LD01) ? " ld01_bad" : "", |
140 | (regstatus & TPS_REG_PG_MAIN) ? " main_bad" : "", | 135 | (regstatus & TPS_REG_PG_MAIN) ? " main_bad" : "", |
141 | (regstatus & TPS_REG_PG_CORE) ? " core_bad" : ""); | 136 | (regstatus & TPS_REG_PG_CORE) ? " core_bad" : ""); |
@@ -143,7 +138,7 @@ static void dbg_regstat(char *buf, size_t len, u8 regstatus) | |||
143 | 138 | ||
144 | static void dbg_chgconf(int por, char *buf, size_t len, u8 chgconfig) | 139 | static void dbg_chgconf(int por, char *buf, size_t len, u8 chgconfig) |
145 | { | 140 | { |
146 | char *hibit; | 141 | const char *hibit; |
147 | 142 | ||
148 | if (por) | 143 | if (por) |
149 | hibit = (chgconfig & TPS_CHARGE_POR) | 144 | hibit = (chgconfig & TPS_CHARGE_POR) |
@@ -295,7 +290,7 @@ static int dbg_show(struct seq_file *s, void *_) | |||
295 | seq_printf(s, "defgpio %02x mask3 %02x\n", value, v2); | 290 | seq_printf(s, "defgpio %02x mask3 %02x\n", value, v2); |
296 | 291 | ||
297 | for (i = 0; i < 4; i++) { | 292 | for (i = 0; i < 4; i++) { |
298 | if (value & (1 << (4 +i))) | 293 | if (value & (1 << (4 + i))) |
299 | seq_printf(s, " gpio%d-out %s\n", i + 1, | 294 | seq_printf(s, " gpio%d-out %s\n", i + 1, |
300 | (value & (1 << i)) ? "low" : "hi "); | 295 | (value & (1 << i)) ? "low" : "hi "); |
301 | else | 296 | else |
@@ -481,7 +476,7 @@ static int __exit tps65010_detach_client(struct i2c_client *client) | |||
481 | debugfs_remove(tps->file); | 476 | debugfs_remove(tps->file); |
482 | if (i2c_detach_client(client) == 0) | 477 | if (i2c_detach_client(client) == 0) |
483 | kfree(tps); | 478 | kfree(tps); |
484 | the_tps = 0; | 479 | the_tps = NULL; |
485 | return 0; | 480 | return 0; |
486 | } | 481 | } |
487 | 482 | ||
@@ -514,7 +509,6 @@ tps65010_probe(struct i2c_adapter *bus, int address, int kind) | |||
514 | INIT_WORK(&tps->work, tps65010_work, tps); | 509 | INIT_WORK(&tps->work, tps65010_work, tps); |
515 | tps->irq = -1; | 510 | tps->irq = -1; |
516 | tps->client.addr = address; | 511 | tps->client.addr = address; |
517 | i2c_set_clientdata(&tps->client, tps); | ||
518 | tps->client.adapter = bus; | 512 | tps->client.adapter = bus; |
519 | tps->client.driver = &tps65010_driver; | 513 | tps->client.driver = &tps65010_driver; |
520 | strlcpy(tps->client.name, DRIVER_NAME, I2C_NAME_SIZE); | 514 | strlcpy(tps->client.name, DRIVER_NAME, I2C_NAME_SIZE); |
@@ -523,9 +517,7 @@ tps65010_probe(struct i2c_adapter *bus, int address, int kind) | |||
523 | if (status < 0) { | 517 | if (status < 0) { |
524 | dev_dbg(&bus->dev, "can't attach %s to device %d, err %d\n", | 518 | dev_dbg(&bus->dev, "can't attach %s to device %d, err %d\n", |
525 | DRIVER_NAME, address, status); | 519 | DRIVER_NAME, address, status); |
526 | fail1: | 520 | goto fail1; |
527 | kfree(tps); | ||
528 | return 0; | ||
529 | } | 521 | } |
530 | 522 | ||
531 | #ifdef CONFIG_ARM | 523 | #ifdef CONFIG_ARM |
@@ -535,7 +527,7 @@ fail1: | |||
535 | tps->irq = OMAP_GPIO_IRQ(58); | 527 | tps->irq = OMAP_GPIO_IRQ(58); |
536 | omap_request_gpio(58); | 528 | omap_request_gpio(58); |
537 | omap_set_gpio_direction(58, 1); | 529 | omap_set_gpio_direction(58, 1); |
538 | omap_set_gpio_edge_ctrl(58, OMAP_GPIO_FALLING_EDGE); | 530 | set_irq_type(tps->irq, IRQT_FALLING); |
539 | } | 531 | } |
540 | if (machine_is_omap_osk()) { | 532 | if (machine_is_omap_osk()) { |
541 | tps->model = TPS65010; | 533 | tps->model = TPS65010; |
@@ -543,7 +535,7 @@ fail1: | |||
543 | tps->irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1)); | 535 | tps->irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1)); |
544 | omap_request_gpio(OMAP_MPUIO(1)); | 536 | omap_request_gpio(OMAP_MPUIO(1)); |
545 | omap_set_gpio_direction(OMAP_MPUIO(1), 1); | 537 | omap_set_gpio_direction(OMAP_MPUIO(1), 1); |
546 | omap_set_gpio_edge_ctrl(OMAP_MPUIO(1), OMAP_GPIO_FALLING_EDGE); | 538 | set_irq_type(tps->irq, IRQT_FALLING); |
547 | } | 539 | } |
548 | if (machine_is_omap_h3()) { | 540 | if (machine_is_omap_h3()) { |
549 | tps->model = TPS65013; | 541 | tps->model = TPS65013; |
@@ -633,6 +625,9 @@ fail1: | |||
633 | tps->file = debugfs_create_file(DRIVER_NAME, S_IRUGO, NULL, | 625 | tps->file = debugfs_create_file(DRIVER_NAME, S_IRUGO, NULL, |
634 | tps, DEBUG_FOPS); | 626 | tps, DEBUG_FOPS); |
635 | return 0; | 627 | return 0; |
628 | fail1: | ||
629 | kfree(tps); | ||
630 | return 0; | ||
636 | } | 631 | } |
637 | 632 | ||
638 | static int __init tps65010_scan_bus(struct i2c_adapter *bus) | 633 | static int __init tps65010_scan_bus(struct i2c_adapter *bus) |
@@ -645,7 +640,6 @@ static int __init tps65010_scan_bus(struct i2c_adapter *bus) | |||
645 | static struct i2c_driver tps65010_driver = { | 640 | static struct i2c_driver tps65010_driver = { |
646 | .owner = THIS_MODULE, | 641 | .owner = THIS_MODULE, |
647 | .name = "tps65010", | 642 | .name = "tps65010", |
648 | .id = 888, /* FIXME assign "official" value */ | ||
649 | .flags = I2C_DF_NOTIFY, | 643 | .flags = I2C_DF_NOTIFY, |
650 | .attach_adapter = tps65010_scan_bus, | 644 | .attach_adapter = tps65010_scan_bus, |
651 | .detach_client = __exit_p(tps65010_detach_client), | 645 | .detach_client = __exit_p(tps65010_detach_client), |
@@ -744,7 +738,7 @@ int tps65010_set_led(unsigned led, unsigned mode) | |||
744 | if (!the_tps) | 738 | if (!the_tps) |
745 | return -ENODEV; | 739 | return -ENODEV; |
746 | 740 | ||
747 | if(led == LED1) | 741 | if (led == LED1) |
748 | offs = 0; | 742 | offs = 0; |
749 | else { | 743 | else { |
750 | offs = 2; | 744 | offs = 2; |
@@ -753,11 +747,13 @@ int tps65010_set_led(unsigned led, unsigned mode) | |||
753 | 747 | ||
754 | down(&the_tps->lock); | 748 | down(&the_tps->lock); |
755 | 749 | ||
756 | dev_dbg (&the_tps->client.dev, "led%i_on 0x%02x\n", led, | 750 | pr_debug("%s: led%i_on 0x%02x\n", DRIVER_NAME, led, |
757 | i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_ON + offs)); | 751 | i2c_smbus_read_byte_data(&the_tps->client, |
752 | TPS_LED1_ON + offs)); | ||
758 | 753 | ||
759 | dev_dbg (&the_tps->client.dev, "led%i_per 0x%02x\n", led, | 754 | pr_debug("%s: led%i_per 0x%02x\n", DRIVER_NAME, led, |
760 | i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_PER + offs)); | 755 | i2c_smbus_read_byte_data(&the_tps->client, |
756 | TPS_LED1_PER + offs)); | ||
761 | 757 | ||
762 | switch (mode) { | 758 | switch (mode) { |
763 | case OFF: | 759 | case OFF: |
@@ -773,7 +769,7 @@ int tps65010_set_led(unsigned led, unsigned mode) | |||
773 | led_per = 0x08 | (1 << 7); | 769 | led_per = 0x08 | (1 << 7); |
774 | break; | 770 | break; |
775 | default: | 771 | default: |
776 | printk(KERN_ERR "%s: Wrong mode parameter for tps65010_set_led()\n", | 772 | printk(KERN_ERR "%s: Wrong mode parameter for set_led()\n", |
777 | DRIVER_NAME); | 773 | DRIVER_NAME); |
778 | up(&the_tps->lock); | 774 | up(&the_tps->lock); |
779 | return -EINVAL; | 775 | return -EINVAL; |
@@ -789,7 +785,7 @@ int tps65010_set_led(unsigned led, unsigned mode) | |||
789 | return status; | 785 | return status; |
790 | } | 786 | } |
791 | 787 | ||
792 | dev_dbg (&the_tps->client.dev, "led%i_on 0x%02x\n", led, | 788 | pr_debug("%s: led%i_on 0x%02x\n", DRIVER_NAME, led, |
793 | i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_ON + offs)); | 789 | i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_ON + offs)); |
794 | 790 | ||
795 | status = i2c_smbus_write_byte_data(&the_tps->client, | 791 | status = i2c_smbus_write_byte_data(&the_tps->client, |
@@ -802,8 +798,9 @@ int tps65010_set_led(unsigned led, unsigned mode) | |||
802 | return status; | 798 | return status; |
803 | } | 799 | } |
804 | 800 | ||
805 | dev_dbg (&the_tps->client.dev, "led%i_per 0x%02x\n", led, | 801 | pr_debug("%s: led%i_per 0x%02x\n", DRIVER_NAME, led, |
806 | i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_PER + offs)); | 802 | i2c_smbus_read_byte_data(&the_tps->client, |
803 | TPS_LED1_PER + offs)); | ||
807 | 804 | ||
808 | up(&the_tps->lock); | 805 | up(&the_tps->lock); |
809 | 806 | ||
@@ -874,7 +871,7 @@ int tps65010_set_low_pwr(unsigned mode) | |||
874 | 871 | ||
875 | if (status != 0) | 872 | if (status != 0) |
876 | printk(KERN_ERR "%s: Failed to write vdcdc1 register\n", | 873 | printk(KERN_ERR "%s: Failed to write vdcdc1 register\n", |
877 | DRIVER_NAME); | 874 | DRIVER_NAME); |
878 | else | 875 | else |
879 | pr_debug("%s: vdcdc1 0x%02x\n", DRIVER_NAME, | 876 | pr_debug("%s: vdcdc1 0x%02x\n", DRIVER_NAME, |
880 | i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1)); | 877 | i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1)); |
@@ -900,14 +897,14 @@ int tps65010_config_vregs1(unsigned value) | |||
900 | down(&the_tps->lock); | 897 | down(&the_tps->lock); |
901 | 898 | ||
902 | pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME, | 899 | pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME, |
903 | i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1)); | 900 | i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1)); |
904 | 901 | ||
905 | status = i2c_smbus_write_byte_data(&the_tps->client, | 902 | status = i2c_smbus_write_byte_data(&the_tps->client, |
906 | TPS_VREGS1, value); | 903 | TPS_VREGS1, value); |
907 | 904 | ||
908 | if (status != 0) | 905 | if (status != 0) |
909 | printk(KERN_ERR "%s: Failed to write vregs1 register\n", | 906 | printk(KERN_ERR "%s: Failed to write vregs1 register\n", |
910 | DRIVER_NAME); | 907 | DRIVER_NAME); |
911 | else | 908 | else |
912 | pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME, | 909 | pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME, |
913 | i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1)); | 910 | i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1)); |
@@ -1009,7 +1006,7 @@ static int __init tps_init(void) | |||
1009 | msleep(10); | 1006 | msleep(10); |
1010 | } | 1007 | } |
1011 | 1008 | ||
1012 | #if defined(CONFIG_ARM) | 1009 | #ifdef CONFIG_ARM |
1013 | if (machine_is_omap_osk()) { | 1010 | if (machine_is_omap_osk()) { |
1014 | 1011 | ||
1015 | // FIXME: More should be placed in the initialization code | 1012 | // FIXME: More should be placed in the initialization code |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 51ce268998cd..4fd4f52c8e9b 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -156,7 +156,7 @@ int i2c_add_adapter(struct i2c_adapter *adap) | |||
156 | goto out_unlock; | 156 | goto out_unlock; |
157 | } | 157 | } |
158 | 158 | ||
159 | res = idr_get_new(&i2c_adapter_idr, NULL, &id); | 159 | res = idr_get_new(&i2c_adapter_idr, adap, &id); |
160 | if (res < 0) { | 160 | if (res < 0) { |
161 | if (res == -EAGAIN) | 161 | if (res == -EAGAIN) |
162 | res = -ENOMEM; | 162 | res = -ENOMEM; |
@@ -765,20 +765,15 @@ int i2c_adapter_id(struct i2c_adapter *adap) | |||
765 | 765 | ||
766 | struct i2c_adapter* i2c_get_adapter(int id) | 766 | struct i2c_adapter* i2c_get_adapter(int id) |
767 | { | 767 | { |
768 | struct list_head *item; | ||
769 | struct i2c_adapter *adapter; | 768 | struct i2c_adapter *adapter; |
770 | 769 | ||
771 | down(&core_lists); | 770 | down(&core_lists); |
772 | list_for_each(item,&adapters) { | 771 | adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id); |
773 | adapter = list_entry(item, struct i2c_adapter, list); | 772 | if (adapter && !try_module_get(adapter->owner)) |
774 | if (id == adapter->nr && | 773 | adapter = NULL; |
775 | try_module_get(adapter->owner)) { | 774 | |
776 | up(&core_lists); | ||
777 | return adapter; | ||
778 | } | ||
779 | } | ||
780 | up(&core_lists); | 775 | up(&core_lists); |
781 | return NULL; | 776 | return adapter; |
782 | } | 777 | } |
783 | 778 | ||
784 | void i2c_put_adapter(struct i2c_adapter *adap) | 779 | void i2c_put_adapter(struct i2c_adapter *adap) |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 0a31cfda08a0..74af7e074868 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -431,7 +431,7 @@ void cdrom_analyze_sense_data(ide_drive_t *drive, | |||
431 | #if VERBOSE_IDE_CD_ERRORS | 431 | #if VERBOSE_IDE_CD_ERRORS |
432 | { | 432 | { |
433 | int i; | 433 | int i; |
434 | const char *s; | 434 | const char *s = "bad sense key!"; |
435 | char buf[80]; | 435 | char buf[80]; |
436 | 436 | ||
437 | printk ("ATAPI device %s:\n", drive->name); | 437 | printk ("ATAPI device %s:\n", drive->name); |
@@ -446,8 +446,6 @@ void cdrom_analyze_sense_data(ide_drive_t *drive, | |||
446 | 446 | ||
447 | if (sense->sense_key < ARY_LEN(sense_key_texts)) | 447 | if (sense->sense_key < ARY_LEN(sense_key_texts)) |
448 | s = sense_key_texts[sense->sense_key]; | 448 | s = sense_key_texts[sense->sense_key]; |
449 | else | ||
450 | s = "bad sense key!"; | ||
451 | 449 | ||
452 | printk("%s -- (Sense key=0x%02x)\n", s, sense->sense_key); | 450 | printk("%s -- (Sense key=0x%02x)\n", s, sense->sense_key); |
453 | 451 | ||
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 0c1b8520ef86..785806bdb248 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -63,6 +63,7 @@ struct multipath { | |||
63 | unsigned nr_priority_groups; | 63 | unsigned nr_priority_groups; |
64 | struct list_head priority_groups; | 64 | struct list_head priority_groups; |
65 | unsigned pg_init_required; /* pg_init needs calling? */ | 65 | unsigned pg_init_required; /* pg_init needs calling? */ |
66 | unsigned pg_init_in_progress; /* Only one pg_init allowed at once */ | ||
66 | 67 | ||
67 | unsigned nr_valid_paths; /* Total number of usable paths */ | 68 | unsigned nr_valid_paths; /* Total number of usable paths */ |
68 | struct pgpath *current_pgpath; | 69 | struct pgpath *current_pgpath; |
@@ -72,7 +73,7 @@ struct multipath { | |||
72 | 73 | ||
73 | unsigned queue_io; /* Must we queue all I/O? */ | 74 | unsigned queue_io; /* Must we queue all I/O? */ |
74 | unsigned queue_if_no_path; /* Queue I/O if last path fails? */ | 75 | unsigned queue_if_no_path; /* Queue I/O if last path fails? */ |
75 | unsigned suspended; /* Has dm core suspended our I/O? */ | 76 | unsigned saved_queue_if_no_path;/* Saved state during suspension */ |
76 | 77 | ||
77 | struct work_struct process_queued_ios; | 78 | struct work_struct process_queued_ios; |
78 | struct bio_list queued_ios; | 79 | struct bio_list queued_ios; |
@@ -304,11 +305,12 @@ static int map_io(struct multipath *m, struct bio *bio, struct mpath_io *mpio, | |||
304 | m->queue_size--; | 305 | m->queue_size--; |
305 | 306 | ||
306 | if ((pgpath && m->queue_io) || | 307 | if ((pgpath && m->queue_io) || |
307 | (!pgpath && m->queue_if_no_path && !m->suspended)) { | 308 | (!pgpath && m->queue_if_no_path)) { |
308 | /* Queue for the daemon to resubmit */ | 309 | /* Queue for the daemon to resubmit */ |
309 | bio_list_add(&m->queued_ios, bio); | 310 | bio_list_add(&m->queued_ios, bio); |
310 | m->queue_size++; | 311 | m->queue_size++; |
311 | if (m->pg_init_required || !m->queue_io) | 312 | if ((m->pg_init_required && !m->pg_init_in_progress) || |
313 | !m->queue_io) | ||
312 | queue_work(kmultipathd, &m->process_queued_ios); | 314 | queue_work(kmultipathd, &m->process_queued_ios); |
313 | pgpath = NULL; | 315 | pgpath = NULL; |
314 | r = 0; | 316 | r = 0; |
@@ -333,8 +335,9 @@ static int queue_if_no_path(struct multipath *m, unsigned queue_if_no_path) | |||
333 | 335 | ||
334 | spin_lock_irqsave(&m->lock, flags); | 336 | spin_lock_irqsave(&m->lock, flags); |
335 | 337 | ||
338 | m->saved_queue_if_no_path = m->queue_if_no_path; | ||
336 | m->queue_if_no_path = queue_if_no_path; | 339 | m->queue_if_no_path = queue_if_no_path; |
337 | if (!m->queue_if_no_path) | 340 | if (!m->queue_if_no_path && m->queue_size) |
338 | queue_work(kmultipathd, &m->process_queued_ios); | 341 | queue_work(kmultipathd, &m->process_queued_ios); |
339 | 342 | ||
340 | spin_unlock_irqrestore(&m->lock, flags); | 343 | spin_unlock_irqrestore(&m->lock, flags); |
@@ -379,25 +382,31 @@ static void process_queued_ios(void *data) | |||
379 | { | 382 | { |
380 | struct multipath *m = (struct multipath *) data; | 383 | struct multipath *m = (struct multipath *) data; |
381 | struct hw_handler *hwh = &m->hw_handler; | 384 | struct hw_handler *hwh = &m->hw_handler; |
382 | struct pgpath *pgpath; | 385 | struct pgpath *pgpath = NULL; |
383 | unsigned init_required, must_queue = 0; | 386 | unsigned init_required = 0, must_queue = 1; |
384 | unsigned long flags; | 387 | unsigned long flags; |
385 | 388 | ||
386 | spin_lock_irqsave(&m->lock, flags); | 389 | spin_lock_irqsave(&m->lock, flags); |
387 | 390 | ||
391 | if (!m->queue_size) | ||
392 | goto out; | ||
393 | |||
388 | if (!m->current_pgpath) | 394 | if (!m->current_pgpath) |
389 | __choose_pgpath(m); | 395 | __choose_pgpath(m); |
390 | 396 | ||
391 | pgpath = m->current_pgpath; | 397 | pgpath = m->current_pgpath; |
392 | 398 | ||
393 | if ((pgpath && m->queue_io) || | 399 | if ((pgpath && !m->queue_io) || |
394 | (!pgpath && m->queue_if_no_path && !m->suspended)) | 400 | (!pgpath && !m->queue_if_no_path)) |
395 | must_queue = 1; | 401 | must_queue = 0; |
396 | 402 | ||
397 | init_required = m->pg_init_required; | 403 | if (m->pg_init_required && !m->pg_init_in_progress) { |
398 | if (init_required) | ||
399 | m->pg_init_required = 0; | 404 | m->pg_init_required = 0; |
405 | m->pg_init_in_progress = 1; | ||
406 | init_required = 1; | ||
407 | } | ||
400 | 408 | ||
409 | out: | ||
401 | spin_unlock_irqrestore(&m->lock, flags); | 410 | spin_unlock_irqrestore(&m->lock, flags); |
402 | 411 | ||
403 | if (init_required) | 412 | if (init_required) |
@@ -752,6 +761,8 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc, | |||
752 | static void multipath_dtr(struct dm_target *ti) | 761 | static void multipath_dtr(struct dm_target *ti) |
753 | { | 762 | { |
754 | struct multipath *m = (struct multipath *) ti->private; | 763 | struct multipath *m = (struct multipath *) ti->private; |
764 | |||
765 | flush_workqueue(kmultipathd); | ||
755 | free_multipath(m); | 766 | free_multipath(m); |
756 | } | 767 | } |
757 | 768 | ||
@@ -765,6 +776,9 @@ static int multipath_map(struct dm_target *ti, struct bio *bio, | |||
765 | struct mpath_io *mpio; | 776 | struct mpath_io *mpio; |
766 | struct multipath *m = (struct multipath *) ti->private; | 777 | struct multipath *m = (struct multipath *) ti->private; |
767 | 778 | ||
779 | if (bio_barrier(bio)) | ||
780 | return -EOPNOTSUPP; | ||
781 | |||
768 | mpio = mempool_alloc(m->mpio_pool, GFP_NOIO); | 782 | mpio = mempool_alloc(m->mpio_pool, GFP_NOIO); |
769 | dm_bio_record(&mpio->details, bio); | 783 | dm_bio_record(&mpio->details, bio); |
770 | 784 | ||
@@ -837,7 +851,7 @@ static int reinstate_path(struct pgpath *pgpath) | |||
837 | pgpath->path.is_active = 1; | 851 | pgpath->path.is_active = 1; |
838 | 852 | ||
839 | m->current_pgpath = NULL; | 853 | m->current_pgpath = NULL; |
840 | if (!m->nr_valid_paths++) | 854 | if (!m->nr_valid_paths++ && m->queue_size) |
841 | queue_work(kmultipathd, &m->process_queued_ios); | 855 | queue_work(kmultipathd, &m->process_queued_ios); |
842 | 856 | ||
843 | queue_work(kmultipathd, &m->trigger_event); | 857 | queue_work(kmultipathd, &m->trigger_event); |
@@ -963,12 +977,13 @@ void dm_pg_init_complete(struct path *path, unsigned err_flags) | |||
963 | bypass_pg(m, pg, 1); | 977 | bypass_pg(m, pg, 1); |
964 | 978 | ||
965 | spin_lock_irqsave(&m->lock, flags); | 979 | spin_lock_irqsave(&m->lock, flags); |
966 | if (!err_flags) | 980 | if (err_flags) { |
967 | m->queue_io = 0; | ||
968 | else { | ||
969 | m->current_pgpath = NULL; | 981 | m->current_pgpath = NULL; |
970 | m->current_pg = NULL; | 982 | m->current_pg = NULL; |
971 | } | 983 | } else if (!m->pg_init_required) |
984 | m->queue_io = 0; | ||
985 | |||
986 | m->pg_init_in_progress = 0; | ||
972 | queue_work(kmultipathd, &m->process_queued_ios); | 987 | queue_work(kmultipathd, &m->process_queued_ios); |
973 | spin_unlock_irqrestore(&m->lock, flags); | 988 | spin_unlock_irqrestore(&m->lock, flags); |
974 | } | 989 | } |
@@ -988,9 +1003,12 @@ static int do_end_io(struct multipath *m, struct bio *bio, | |||
988 | if ((error == -EWOULDBLOCK) && bio_rw_ahead(bio)) | 1003 | if ((error == -EWOULDBLOCK) && bio_rw_ahead(bio)) |
989 | return error; | 1004 | return error; |
990 | 1005 | ||
1006 | if (error == -EOPNOTSUPP) | ||
1007 | return error; | ||
1008 | |||
991 | spin_lock(&m->lock); | 1009 | spin_lock(&m->lock); |
992 | if (!m->nr_valid_paths) { | 1010 | if (!m->nr_valid_paths) { |
993 | if (!m->queue_if_no_path || m->suspended) { | 1011 | if (!m->queue_if_no_path) { |
994 | spin_unlock(&m->lock); | 1012 | spin_unlock(&m->lock); |
995 | return -EIO; | 1013 | return -EIO; |
996 | } else { | 1014 | } else { |
@@ -1051,27 +1069,27 @@ static int multipath_end_io(struct dm_target *ti, struct bio *bio, | |||
1051 | 1069 | ||
1052 | /* | 1070 | /* |
1053 | * Suspend can't complete until all the I/O is processed so if | 1071 | * Suspend can't complete until all the I/O is processed so if |
1054 | * the last path failed we will now error any queued I/O. | 1072 | * the last path fails we must error any remaining I/O. |
1073 | * Note that if the freeze_bdev fails while suspending, the | ||
1074 | * queue_if_no_path state is lost - userspace should reset it. | ||
1055 | */ | 1075 | */ |
1056 | static void multipath_presuspend(struct dm_target *ti) | 1076 | static void multipath_presuspend(struct dm_target *ti) |
1057 | { | 1077 | { |
1058 | struct multipath *m = (struct multipath *) ti->private; | 1078 | struct multipath *m = (struct multipath *) ti->private; |
1059 | unsigned long flags; | ||
1060 | 1079 | ||
1061 | spin_lock_irqsave(&m->lock, flags); | 1080 | queue_if_no_path(m, 0); |
1062 | m->suspended = 1; | ||
1063 | if (m->queue_if_no_path) | ||
1064 | queue_work(kmultipathd, &m->process_queued_ios); | ||
1065 | spin_unlock_irqrestore(&m->lock, flags); | ||
1066 | } | 1081 | } |
1067 | 1082 | ||
1083 | /* | ||
1084 | * Restore the queue_if_no_path setting. | ||
1085 | */ | ||
1068 | static void multipath_resume(struct dm_target *ti) | 1086 | static void multipath_resume(struct dm_target *ti) |
1069 | { | 1087 | { |
1070 | struct multipath *m = (struct multipath *) ti->private; | 1088 | struct multipath *m = (struct multipath *) ti->private; |
1071 | unsigned long flags; | 1089 | unsigned long flags; |
1072 | 1090 | ||
1073 | spin_lock_irqsave(&m->lock, flags); | 1091 | spin_lock_irqsave(&m->lock, flags); |
1074 | m->suspended = 0; | 1092 | m->queue_if_no_path = m->saved_queue_if_no_path; |
1075 | spin_unlock_irqrestore(&m->lock, flags); | 1093 | spin_unlock_irqrestore(&m->lock, flags); |
1076 | } | 1094 | } |
1077 | 1095 | ||
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 7e691ab9a748..ab54f99b7c3b 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -777,7 +777,7 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio, | |||
777 | 777 | ||
778 | /* Full snapshots are not usable */ | 778 | /* Full snapshots are not usable */ |
779 | if (!s->valid) | 779 | if (!s->valid) |
780 | return -1; | 780 | return -EIO; |
781 | 781 | ||
782 | /* | 782 | /* |
783 | * Write to snapshot - higher level takes care of RW/RO | 783 | * Write to snapshot - higher level takes care of RW/RO |
@@ -931,6 +931,10 @@ static int __origin_write(struct list_head *snapshots, struct bio *bio) | |||
931 | if (!snap->valid) | 931 | if (!snap->valid) |
932 | continue; | 932 | continue; |
933 | 933 | ||
934 | /* Nothing to do if writing beyond end of snapshot */ | ||
935 | if (bio->bi_sector >= dm_table_get_size(snap->table)) | ||
936 | continue; | ||
937 | |||
934 | down_write(&snap->lock); | 938 | down_write(&snap->lock); |
935 | 939 | ||
936 | /* | 940 | /* |
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 18e9b9953fcd..a5a4c0ed8a14 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
@@ -943,6 +943,7 @@ EXPORT_SYMBOL(dm_vcalloc); | |||
943 | EXPORT_SYMBOL(dm_get_device); | 943 | EXPORT_SYMBOL(dm_get_device); |
944 | EXPORT_SYMBOL(dm_put_device); | 944 | EXPORT_SYMBOL(dm_put_device); |
945 | EXPORT_SYMBOL(dm_table_event); | 945 | EXPORT_SYMBOL(dm_table_event); |
946 | EXPORT_SYMBOL(dm_table_get_size); | ||
946 | EXPORT_SYMBOL(dm_table_get_mode); | 947 | EXPORT_SYMBOL(dm_table_get_mode); |
947 | EXPORT_SYMBOL(dm_table_put); | 948 | EXPORT_SYMBOL(dm_table_put); |
948 | EXPORT_SYMBOL(dm_table_get); | 949 | EXPORT_SYMBOL(dm_table_get); |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index f6b03957efc7..54fabbf06678 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -384,7 +384,7 @@ static void __map_bio(struct dm_target *ti, struct bio *clone, | |||
384 | /* error the io and bail out */ | 384 | /* error the io and bail out */ |
385 | struct dm_io *io = tio->io; | 385 | struct dm_io *io = tio->io; |
386 | free_tio(tio->io->md, tio); | 386 | free_tio(tio->io->md, tio); |
387 | dec_pending(io, -EIO); | 387 | dec_pending(io, r); |
388 | bio_put(clone); | 388 | bio_put(clone); |
389 | } | 389 | } |
390 | } | 390 | } |
@@ -966,23 +966,20 @@ static void __flush_deferred_io(struct mapped_device *md, struct bio *c) | |||
966 | */ | 966 | */ |
967 | int dm_swap_table(struct mapped_device *md, struct dm_table *table) | 967 | int dm_swap_table(struct mapped_device *md, struct dm_table *table) |
968 | { | 968 | { |
969 | int r; | 969 | int r = -EINVAL; |
970 | 970 | ||
971 | down_write(&md->lock); | 971 | down_write(&md->lock); |
972 | 972 | ||
973 | /* device must be suspended */ | 973 | /* device must be suspended */ |
974 | if (!test_bit(DMF_SUSPENDED, &md->flags)) { | 974 | if (!test_bit(DMF_SUSPENDED, &md->flags)) |
975 | up_write(&md->lock); | 975 | goto out; |
976 | return -EPERM; | ||
977 | } | ||
978 | 976 | ||
979 | __unbind(md); | 977 | __unbind(md); |
980 | r = __bind(md, table); | 978 | r = __bind(md, table); |
981 | if (r) | ||
982 | return r; | ||
983 | 979 | ||
980 | out: | ||
984 | up_write(&md->lock); | 981 | up_write(&md->lock); |
985 | return 0; | 982 | return r; |
986 | } | 983 | } |
987 | 984 | ||
988 | /* | 985 | /* |
@@ -1055,14 +1052,17 @@ int dm_suspend(struct mapped_device *md) | |||
1055 | if (test_bit(DMF_BLOCK_IO, &md->flags)) | 1052 | if (test_bit(DMF_BLOCK_IO, &md->flags)) |
1056 | goto out_read_unlock; | 1053 | goto out_read_unlock; |
1057 | 1054 | ||
1058 | error = __lock_fs(md); | ||
1059 | if (error) | ||
1060 | goto out_read_unlock; | ||
1061 | |||
1062 | map = dm_get_table(md); | 1055 | map = dm_get_table(md); |
1063 | if (map) | 1056 | if (map) |
1057 | /* This does not get reverted if there's an error later. */ | ||
1064 | dm_table_presuspend_targets(map); | 1058 | dm_table_presuspend_targets(map); |
1065 | 1059 | ||
1060 | error = __lock_fs(md); | ||
1061 | if (error) { | ||
1062 | dm_table_put(map); | ||
1063 | goto out_read_unlock; | ||
1064 | } | ||
1065 | |||
1066 | up_read(&md->lock); | 1066 | up_read(&md->lock); |
1067 | 1067 | ||
1068 | /* | 1068 | /* |
@@ -1121,7 +1121,6 @@ int dm_suspend(struct mapped_device *md) | |||
1121 | return 0; | 1121 | return 0; |
1122 | 1122 | ||
1123 | out_unfreeze: | 1123 | out_unfreeze: |
1124 | /* FIXME Undo dm_table_presuspend_targets */ | ||
1125 | __unlock_fs(md); | 1124 | __unlock_fs(md); |
1126 | clear_bit(DMF_BLOCK_IO, &md->flags); | 1125 | clear_bit(DMF_BLOCK_IO, &md->flags); |
1127 | out_write_unlock: | 1126 | out_write_unlock: |
diff --git a/drivers/media/common/ir-common.c b/drivers/media/common/ir-common.c index 4adb2843f8be..ab7a1fba4427 100644 --- a/drivers/media/common/ir-common.c +++ b/drivers/media/common/ir-common.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: ir-common.c,v 1.10 2005/05/22 19:23:39 nsh Exp $ | 2 | * $Id: ir-common.c,v 1.11 2005/07/07 14:44:43 mchehab Exp $ |
3 | * | 3 | * |
4 | * some common structs and functions to handle infrared remotes via | 4 | * some common structs and functions to handle infrared remotes via |
5 | * input layer ... | 5 | * input layer ... |
@@ -46,79 +46,49 @@ module_param(debug, int, 0644); | |||
46 | /* see http://users.pandora.be/nenya/electronics/rc5/codes00.htm */ | 46 | /* see http://users.pandora.be/nenya/electronics/rc5/codes00.htm */ |
47 | /* used by old (black) Hauppauge remotes */ | 47 | /* used by old (black) Hauppauge remotes */ |
48 | IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE] = { | 48 | IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE] = { |
49 | [ 0x00 ] = KEY_KP0, // 0 | 49 | /* Keys 0 to 9 */ |
50 | [ 0x01 ] = KEY_KP1, // 1 | 50 | [ 0x00 ] = KEY_KP0, |
51 | [ 0x02 ] = KEY_KP2, // 2 | 51 | [ 0x01 ] = KEY_KP1, |
52 | [ 0x03 ] = KEY_KP3, // 3 | 52 | [ 0x02 ] = KEY_KP2, |
53 | [ 0x04 ] = KEY_KP4, // 4 | 53 | [ 0x03 ] = KEY_KP3, |
54 | [ 0x05 ] = KEY_KP5, // 5 | 54 | [ 0x04 ] = KEY_KP4, |
55 | [ 0x06 ] = KEY_KP6, // 6 | 55 | [ 0x05 ] = KEY_KP5, |
56 | [ 0x07 ] = KEY_KP7, // 7 | 56 | [ 0x06 ] = KEY_KP6, |
57 | [ 0x08 ] = KEY_KP8, // 8 | 57 | [ 0x07 ] = KEY_KP7, |
58 | [ 0x09 ] = KEY_KP9, // 9 | 58 | [ 0x08 ] = KEY_KP8, |
59 | 59 | [ 0x09 ] = KEY_KP9, | |
60 | [ 0x0b ] = KEY_CHANNEL, // channel / program (japan: 11) | 60 | |
61 | [ 0x0c ] = KEY_POWER, // standby | 61 | [ 0x0b ] = KEY_CHANNEL, /* channel / program (japan: 11) */ |
62 | [ 0x0d ] = KEY_MUTE, // mute / demute | 62 | [ 0x0c ] = KEY_POWER, /* standby */ |
63 | [ 0x0f ] = KEY_TV, // display | 63 | [ 0x0d ] = KEY_MUTE, /* mute / demute */ |
64 | [ 0x10 ] = KEY_VOLUMEUP, // volume + | 64 | [ 0x0f ] = KEY_TV, /* display */ |
65 | [ 0x11 ] = KEY_VOLUMEDOWN, // volume - | 65 | [ 0x10 ] = KEY_VOLUMEUP, |
66 | [ 0x12 ] = KEY_BRIGHTNESSUP, // brightness + | 66 | [ 0x11 ] = KEY_VOLUMEDOWN, |
67 | [ 0x13 ] = KEY_BRIGHTNESSDOWN, // brightness - | 67 | [ 0x12 ] = KEY_BRIGHTNESSUP, |
68 | [ 0x1e ] = KEY_SEARCH, // search + | 68 | [ 0x13 ] = KEY_BRIGHTNESSDOWN, |
69 | [ 0x20 ] = KEY_CHANNELUP, // channel / program + | 69 | [ 0x1e ] = KEY_SEARCH, /* search + */ |
70 | [ 0x21 ] = KEY_CHANNELDOWN, // channel / program - | 70 | [ 0x20 ] = KEY_CHANNELUP, /* channel / program + */ |
71 | [ 0x22 ] = KEY_CHANNEL, // alt / channel | 71 | [ 0x21 ] = KEY_CHANNELDOWN, /* channel / program - */ |
72 | [ 0x23 ] = KEY_LANGUAGE, // 1st / 2nd language | 72 | [ 0x22 ] = KEY_CHANNEL, /* alt / channel */ |
73 | [ 0x26 ] = KEY_SLEEP, // sleeptimer | 73 | [ 0x23 ] = KEY_LANGUAGE, /* 1st / 2nd language */ |
74 | [ 0x2e ] = KEY_MENU, // 2nd controls (USA: menu) | 74 | [ 0x26 ] = KEY_SLEEP, /* sleeptimer */ |
75 | [ 0x30 ] = KEY_PAUSE, // pause | 75 | [ 0x2e ] = KEY_MENU, /* 2nd controls (USA: menu) */ |
76 | [ 0x32 ] = KEY_REWIND, // rewind | 76 | [ 0x30 ] = KEY_PAUSE, |
77 | [ 0x33 ] = KEY_GOTO, // go to | 77 | [ 0x32 ] = KEY_REWIND, |
78 | [ 0x35 ] = KEY_PLAY, // play | 78 | [ 0x33 ] = KEY_GOTO, |
79 | [ 0x36 ] = KEY_STOP, // stop | 79 | [ 0x35 ] = KEY_PLAY, |
80 | [ 0x37 ] = KEY_RECORD, // recording | 80 | [ 0x36 ] = KEY_STOP, |
81 | [ 0x3c ] = KEY_TEXT, // teletext submode (Japan: 12) | 81 | [ 0x37 ] = KEY_RECORD, /* recording */ |
82 | [ 0x3d ] = KEY_SUSPEND, // system standby | 82 | [ 0x3c ] = KEY_TEXT, /* teletext submode (Japan: 12) */ |
83 | 83 | [ 0x3d ] = KEY_SUSPEND, /* system standby */ | |
84 | #if 0 /* FIXME */ | 84 | |
85 | [ 0x0a ] = KEY_RESERVED, // 1/2/3 digits (japan: 10) | ||
86 | [ 0x0e ] = KEY_RESERVED, // P.P. (personal preference) | ||
87 | [ 0x14 ] = KEY_RESERVED, // colour saturation + | ||
88 | [ 0x15 ] = KEY_RESERVED, // colour saturation - | ||
89 | [ 0x16 ] = KEY_RESERVED, // bass + | ||
90 | [ 0x17 ] = KEY_RESERVED, // bass - | ||
91 | [ 0x18 ] = KEY_RESERVED, // treble + | ||
92 | [ 0x19 ] = KEY_RESERVED, // treble - | ||
93 | [ 0x1a ] = KEY_RESERVED, // balance right | ||
94 | [ 0x1b ] = KEY_RESERVED, // balance left | ||
95 | [ 0x1c ] = KEY_RESERVED, // contrast + | ||
96 | [ 0x1d ] = KEY_RESERVED, // contrast - | ||
97 | [ 0x1f ] = KEY_RESERVED, // tint/hue + | ||
98 | [ 0x24 ] = KEY_RESERVED, // spacial stereo on/off | ||
99 | [ 0x25 ] = KEY_RESERVED, // mono / stereo (USA) | ||
100 | [ 0x27 ] = KEY_RESERVED, // tint / hue - | ||
101 | [ 0x28 ] = KEY_RESERVED, // RF switch/PIP select | ||
102 | [ 0x29 ] = KEY_RESERVED, // vote | ||
103 | [ 0x2a ] = KEY_RESERVED, // timed page/channel clck | ||
104 | [ 0x2b ] = KEY_RESERVED, // increment (USA) | ||
105 | [ 0x2c ] = KEY_RESERVED, // decrement (USA) | ||
106 | [ 0x2d ] = KEY_RESERVED, // | ||
107 | [ 0x2f ] = KEY_RESERVED, // PIP shift | ||
108 | [ 0x31 ] = KEY_RESERVED, // erase | ||
109 | [ 0x34 ] = KEY_RESERVED, // wind | ||
110 | [ 0x38 ] = KEY_RESERVED, // external 1 | ||
111 | [ 0x39 ] = KEY_RESERVED, // external 2 | ||
112 | [ 0x3a ] = KEY_RESERVED, // PIP display mode | ||
113 | [ 0x3b ] = KEY_RESERVED, // view data mode / advance | ||
114 | [ 0x3e ] = KEY_RESERVED, // crispener on/off | ||
115 | [ 0x3f ] = KEY_RESERVED, // system select | ||
116 | #endif | ||
117 | }; | 85 | }; |
118 | EXPORT_SYMBOL_GPL(ir_codes_rc5_tv); | 86 | EXPORT_SYMBOL_GPL(ir_codes_rc5_tv); |
119 | 87 | ||
120 | /* Table for Leadtek Winfast Remote Controls - used by both bttv and cx88 */ | 88 | /* Table for Leadtek Winfast Remote Controls - used by both bttv and cx88 */ |
121 | IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE] = { | 89 | IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE] = { |
90 | /* Keys 0 to 9 */ | ||
91 | [ 18 ] = KEY_KP0, | ||
122 | [ 5 ] = KEY_KP1, | 92 | [ 5 ] = KEY_KP1, |
123 | [ 6 ] = KEY_KP2, | 93 | [ 6 ] = KEY_KP2, |
124 | [ 7 ] = KEY_KP3, | 94 | [ 7 ] = KEY_KP3, |
@@ -128,39 +98,31 @@ IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE] = { | |||
128 | [ 13 ] = KEY_KP7, | 98 | [ 13 ] = KEY_KP7, |
129 | [ 14 ] = KEY_KP8, | 99 | [ 14 ] = KEY_KP8, |
130 | [ 15 ] = KEY_KP9, | 100 | [ 15 ] = KEY_KP9, |
131 | [ 18 ] = KEY_KP0, | ||
132 | 101 | ||
133 | [ 0 ] = KEY_POWER, | 102 | [ 0 ] = KEY_POWER, |
134 | // [ 27 ] = MTS button | 103 | [ 2 ] = KEY_TUNER, /* TV/FM */ |
135 | [ 2 ] = KEY_TUNER, // TV/FM | ||
136 | [ 30 ] = KEY_VIDEO, | 104 | [ 30 ] = KEY_VIDEO, |
137 | // [ 22 ] = display button | ||
138 | [ 4 ] = KEY_VOLUMEUP, | 105 | [ 4 ] = KEY_VOLUMEUP, |
139 | [ 8 ] = KEY_VOLUMEDOWN, | 106 | [ 8 ] = KEY_VOLUMEDOWN, |
140 | [ 12 ] = KEY_CHANNELUP, | 107 | [ 12 ] = KEY_CHANNELUP, |
141 | [ 16 ] = KEY_CHANNELDOWN, | 108 | [ 16 ] = KEY_CHANNELDOWN, |
142 | [ 3 ] = KEY_ZOOM, // fullscreen | 109 | [ 3 ] = KEY_ZOOM, /* fullscreen */ |
143 | [ 31 ] = KEY_SUBTITLE, // closed caption/teletext | 110 | [ 31 ] = KEY_SUBTITLE, /* closed caption/teletext */ |
144 | [ 32 ] = KEY_SLEEP, | 111 | [ 32 ] = KEY_SLEEP, |
145 | // [ 41 ] = boss key | ||
146 | [ 20 ] = KEY_MUTE, | 112 | [ 20 ] = KEY_MUTE, |
147 | [ 43 ] = KEY_RED, | 113 | [ 43 ] = KEY_RED, |
148 | [ 44 ] = KEY_GREEN, | 114 | [ 44 ] = KEY_GREEN, |
149 | [ 45 ] = KEY_YELLOW, | 115 | [ 45 ] = KEY_YELLOW, |
150 | [ 46 ] = KEY_BLUE, | 116 | [ 46 ] = KEY_BLUE, |
151 | [ 24 ] = KEY_KPPLUS, //fine tune + | 117 | [ 24 ] = KEY_KPPLUS, /* fine tune + */ |
152 | [ 25 ] = KEY_KPMINUS, //fine tune - | 118 | [ 25 ] = KEY_KPMINUS, /* fine tune - */ |
153 | // [ 42 ] = picture in picture | ||
154 | [ 33 ] = KEY_KPDOT, | 119 | [ 33 ] = KEY_KPDOT, |
155 | [ 19 ] = KEY_KPENTER, | 120 | [ 19 ] = KEY_KPENTER, |
156 | // [ 17 ] = recall | ||
157 | [ 34 ] = KEY_BACK, | 121 | [ 34 ] = KEY_BACK, |
158 | [ 35 ] = KEY_PLAYPAUSE, | 122 | [ 35 ] = KEY_PLAYPAUSE, |
159 | [ 36 ] = KEY_NEXT, | 123 | [ 36 ] = KEY_NEXT, |
160 | // [ 37 ] = time shifting | ||
161 | [ 38 ] = KEY_STOP, | 124 | [ 38 ] = KEY_STOP, |
162 | [ 39 ] = KEY_RECORD | 125 | [ 39 ] = KEY_RECORD |
163 | // [ 40 ] = snapshot | ||
164 | }; | 126 | }; |
165 | EXPORT_SYMBOL_GPL(ir_codes_winfast); | 127 | EXPORT_SYMBOL_GPL(ir_codes_winfast); |
166 | 128 | ||
@@ -174,54 +136,61 @@ EXPORT_SYMBOL_GPL(ir_codes_empty); | |||
174 | * slightly different versions), shipped with cx88+ivtv cards. | 136 | * slightly different versions), shipped with cx88+ivtv cards. |
175 | * almost rc5 coding, but some non-standard keys */ | 137 | * almost rc5 coding, but some non-standard keys */ |
176 | IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE] = { | 138 | IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE] = { |
177 | [ 0x00 ] = KEY_KP0, // 0 | 139 | /* Keys 0 to 9 */ |
178 | [ 0x01 ] = KEY_KP1, // 1 | 140 | [ 0x00 ] = KEY_KP0, |
179 | [ 0x02 ] = KEY_KP2, // 2 | 141 | [ 0x01 ] = KEY_KP1, |
180 | [ 0x03 ] = KEY_KP3, // 3 | 142 | [ 0x02 ] = KEY_KP2, |
181 | [ 0x04 ] = KEY_KP4, // 4 | 143 | [ 0x03 ] = KEY_KP3, |
182 | [ 0x05 ] = KEY_KP5, // 5 | 144 | [ 0x04 ] = KEY_KP4, |
183 | [ 0x06 ] = KEY_KP6, // 6 | 145 | [ 0x05 ] = KEY_KP5, |
184 | [ 0x07 ] = KEY_KP7, // 7 | 146 | [ 0x06 ] = KEY_KP6, |
185 | [ 0x08 ] = KEY_KP8, // 8 | 147 | [ 0x07 ] = KEY_KP7, |
186 | [ 0x09 ] = KEY_KP9, // 9 | 148 | [ 0x08 ] = KEY_KP8, |
187 | [ 0x0a ] = KEY_TEXT, // keypad asterisk as well | 149 | [ 0x09 ] = KEY_KP9, |
188 | [ 0x0b ] = KEY_RED, // red button | 150 | |
189 | [ 0x0c ] = KEY_RADIO, // radio | 151 | [ 0x0a ] = KEY_TEXT, /* keypad asterisk as well */ |
190 | [ 0x0d ] = KEY_MENU, // menu | 152 | [ 0x0b ] = KEY_RED, /* red button */ |
191 | [ 0x0e ] = KEY_SUBTITLE, // also the # key | 153 | [ 0x0c ] = KEY_RADIO, |
192 | [ 0x0f ] = KEY_MUTE, // mute | 154 | [ 0x0d ] = KEY_MENU, |
193 | [ 0x10 ] = KEY_VOLUMEUP, // volume + | 155 | [ 0x0e ] = KEY_SUBTITLE, /* also the # key */ |
194 | [ 0x11 ] = KEY_VOLUMEDOWN, // volume - | 156 | [ 0x0f ] = KEY_MUTE, |
195 | [ 0x12 ] = KEY_PREVIOUS, // previous channel | 157 | [ 0x10 ] = KEY_VOLUMEUP, |
196 | [ 0x14 ] = KEY_UP, // up | 158 | [ 0x11 ] = KEY_VOLUMEDOWN, |
197 | [ 0x15 ] = KEY_DOWN, // down | 159 | [ 0x12 ] = KEY_PREVIOUS, /* previous channel */ |
198 | [ 0x16 ] = KEY_LEFT, // left | 160 | [ 0x14 ] = KEY_UP, |
199 | [ 0x17 ] = KEY_RIGHT, // right | 161 | [ 0x15 ] = KEY_DOWN, |
200 | [ 0x18 ] = KEY_VIDEO, // Videos | 162 | [ 0x16 ] = KEY_LEFT, |
201 | [ 0x19 ] = KEY_AUDIO, // Music | 163 | [ 0x17 ] = KEY_RIGHT, |
202 | [ 0x1a ] = KEY_MHP, // Pictures - presume this means "Multimedia Home Platform"- no "PICTURES" key in input.h | 164 | [ 0x18 ] = KEY_VIDEO, /* Videos */ |
203 | [ 0x1b ] = KEY_EPG, // Guide | 165 | [ 0x19 ] = KEY_AUDIO, /* Music */ |
204 | [ 0x1c ] = KEY_TV, // TV | 166 | /* 0x1a: Pictures - presume this means |
205 | [ 0x1e ] = KEY_NEXTSONG, // skip >| | 167 | "Multimedia Home Platform" - |
206 | [ 0x1f ] = KEY_EXIT, // back/exit | 168 | no "PICTURES" key in input.h |
207 | [ 0x20 ] = KEY_CHANNELUP, // channel / program + | 169 | */ |
208 | [ 0x21 ] = KEY_CHANNELDOWN, // channel / program - | 170 | [ 0x1a ] = KEY_MHP, |
209 | [ 0x22 ] = KEY_CHANNEL, // source (old black remote) | 171 | |
210 | [ 0x24 ] = KEY_PREVIOUSSONG, // replay |< | 172 | [ 0x1b ] = KEY_EPG, /* Guide */ |
211 | [ 0x25 ] = KEY_ENTER, // OK | 173 | [ 0x1c ] = KEY_TV, |
212 | [ 0x26 ] = KEY_SLEEP, // minimize (old black remote) | 174 | [ 0x1e ] = KEY_NEXTSONG, /* skip >| */ |
213 | [ 0x29 ] = KEY_BLUE, // blue key | 175 | [ 0x1f ] = KEY_EXIT, /* back/exit */ |
214 | [ 0x2e ] = KEY_GREEN, // green button | 176 | [ 0x20 ] = KEY_CHANNELUP, /* channel / program + */ |
215 | [ 0x30 ] = KEY_PAUSE, // pause | 177 | [ 0x21 ] = KEY_CHANNELDOWN, /* channel / program - */ |
216 | [ 0x32 ] = KEY_REWIND, // backward << | 178 | [ 0x22 ] = KEY_CHANNEL, /* source (old black remote) */ |
217 | [ 0x34 ] = KEY_FASTFORWARD, // forward >> | 179 | [ 0x24 ] = KEY_PREVIOUSSONG, /* replay |< */ |
218 | [ 0x35 ] = KEY_PLAY, // play | 180 | [ 0x25 ] = KEY_ENTER, /* OK */ |
219 | [ 0x36 ] = KEY_STOP, // stop | 181 | [ 0x26 ] = KEY_SLEEP, /* minimize (old black remote) */ |
220 | [ 0x37 ] = KEY_RECORD, // recording | 182 | [ 0x29 ] = KEY_BLUE, /* blue key */ |
221 | [ 0x38 ] = KEY_YELLOW, // yellow key | 183 | [ 0x2e ] = KEY_GREEN, /* green button */ |
222 | [ 0x3b ] = KEY_SELECT, // top right button | 184 | [ 0x30 ] = KEY_PAUSE, /* pause */ |
223 | [ 0x3c ] = KEY_ZOOM, // full | 185 | [ 0x32 ] = KEY_REWIND, /* backward << */ |
224 | [ 0x3d ] = KEY_POWER, // system power (green button) | 186 | [ 0x34 ] = KEY_FASTFORWARD, /* forward >> */ |
187 | [ 0x35 ] = KEY_PLAY, | ||
188 | [ 0x36 ] = KEY_STOP, | ||
189 | [ 0x37 ] = KEY_RECORD, /* recording */ | ||
190 | [ 0x38 ] = KEY_YELLOW, /* yellow key */ | ||
191 | [ 0x3b ] = KEY_SELECT, /* top right button */ | ||
192 | [ 0x3c ] = KEY_ZOOM, /* full */ | ||
193 | [ 0x3d ] = KEY_POWER, /* system power (green button) */ | ||
225 | }; | 194 | }; |
226 | EXPORT_SYMBOL(ir_codes_hauppauge_new); | 195 | EXPORT_SYMBOL(ir_codes_hauppauge_new); |
227 | 196 | ||
@@ -237,9 +206,9 @@ IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE] = { | |||
237 | [ 10 ] = KEY_KP8, | 206 | [ 10 ] = KEY_KP8, |
238 | [ 18 ] = KEY_KP9, | 207 | [ 18 ] = KEY_KP9, |
239 | 208 | ||
240 | [ 3 ] = KEY_TUNER, // TV/FM | 209 | [ 3 ] = KEY_TUNER, /* TV/FM */ |
241 | [ 7 ] = KEY_SEARCH, // scan | 210 | [ 7 ] = KEY_SEARCH, /* scan */ |
242 | [ 28 ] = KEY_ZOOM, // full screen | 211 | [ 28 ] = KEY_ZOOM, /* full screen */ |
243 | [ 30 ] = KEY_POWER, | 212 | [ 30 ] = KEY_POWER, |
244 | [ 23 ] = KEY_VOLUMEDOWN, | 213 | [ 23 ] = KEY_VOLUMEDOWN, |
245 | [ 31 ] = KEY_VOLUMEUP, | 214 | [ 31 ] = KEY_VOLUMEUP, |
@@ -247,14 +216,14 @@ IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE] = { | |||
247 | [ 22 ] = KEY_CHANNELUP, | 216 | [ 22 ] = KEY_CHANNELUP, |
248 | [ 24 ] = KEY_MUTE, | 217 | [ 24 ] = KEY_MUTE, |
249 | 218 | ||
250 | [ 0 ] = KEY_LIST, // source | 219 | [ 0 ] = KEY_LIST, /* source */ |
251 | [ 19 ] = KEY_INFO, // loop | 220 | [ 19 ] = KEY_INFO, /* loop */ |
252 | [ 16 ] = KEY_LAST, // +100 | 221 | [ 16 ] = KEY_LAST, /* +100 */ |
253 | [ 13 ] = KEY_CLEAR, // reset | 222 | [ 13 ] = KEY_CLEAR, /* reset */ |
254 | [ 12 ] = BTN_RIGHT, // fun++ | 223 | [ 12 ] = BTN_RIGHT, /* fun++ */ |
255 | [ 4 ] = BTN_LEFT, // fun-- | 224 | [ 4 ] = BTN_LEFT, /* fun-- */ |
256 | [ 14 ] = KEY_GOTO, // function | 225 | [ 14 ] = KEY_GOTO, /* function */ |
257 | [ 15 ] = KEY_STOP, // freeze | 226 | [ 15 ] = KEY_STOP, /* freeze */ |
258 | }; | 227 | }; |
259 | EXPORT_SYMBOL(ir_codes_pixelview); | 228 | EXPORT_SYMBOL(ir_codes_pixelview); |
260 | 229 | ||
@@ -321,10 +290,6 @@ void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, | |||
321 | ir->keypressed = 1; | 290 | ir->keypressed = 1; |
322 | ir_input_key_event(dev,ir); | 291 | ir_input_key_event(dev,ir); |
323 | } | 292 | } |
324 | #if 0 | ||
325 | /* maybe do something like this ??? */ | ||
326 | input_event(a, EV_IR, ir->ir_type, ir->ir_raw); | ||
327 | #endif | ||
328 | } | 293 | } |
329 | 294 | ||
330 | /* -------------------------------------------------------------------------- */ | 295 | /* -------------------------------------------------------------------------- */ |
diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c index 9bd12832e3d9..07a0b0a968a6 100644 --- a/drivers/media/dvb/bt8xx/dst.c +++ b/drivers/media/dvb/bt8xx/dst.c | |||
@@ -928,7 +928,7 @@ static int dst_get_signal(struct dst_state* state) | |||
928 | { | 928 | { |
929 | int retval; | 929 | int retval; |
930 | u8 get_signal[] = { 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfb }; | 930 | u8 get_signal[] = { 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfb }; |
931 | printk("%s: Getting Signal strength and other parameters !!!!!!!!\n", __FUNCTION__); | 931 | dprintk("%s: Getting Signal strength and other parameters\n", __FUNCTION__); |
932 | if ((state->diseq_flags & ATTEMPT_TUNE) == 0) { | 932 | if ((state->diseq_flags & ATTEMPT_TUNE) == 0) { |
933 | state->decode_lock = state->decode_strength = state->decode_snr = 0; | 933 | state->decode_lock = state->decode_strength = state->decode_snr = 0; |
934 | return 0; | 934 | return 0; |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c index bdd72f779707..3491ff40885c 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c | |||
@@ -175,7 +175,7 @@ static int dvb_usb_fe_sleep(struct dvb_frontend *fe) | |||
175 | int dvb_usb_fe_init(struct dvb_usb_device* d) | 175 | int dvb_usb_fe_init(struct dvb_usb_device* d) |
176 | { | 176 | { |
177 | if (d->props.frontend_attach == NULL) { | 177 | if (d->props.frontend_attach == NULL) { |
178 | err("strange '%s' don't want to attach a frontend.",d->desc->name); | 178 | err("strange '%s' doesn't want to attach a frontend.",d->desc->name); |
179 | return 0; | 179 | return 0; |
180 | } | 180 | } |
181 | 181 | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/drivers/media/dvb/dvb-usb/dvb-usb-init.c index c3b3ae4f3ec7..65f0c095abc9 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-init.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-init.c | |||
@@ -51,17 +51,17 @@ static int dvb_usb_init(struct dvb_usb_device *d) | |||
51 | 51 | ||
52 | /* speed - when running at FULL speed we need a HW PID filter */ | 52 | /* speed - when running at FULL speed we need a HW PID filter */ |
53 | if (d->udev->speed == USB_SPEED_FULL && !(d->props.caps & DVB_USB_HAS_PID_FILTER)) { | 53 | if (d->udev->speed == USB_SPEED_FULL && !(d->props.caps & DVB_USB_HAS_PID_FILTER)) { |
54 | err("This USB2.0 device cannot be run on a USB1.1 port. (it lacks a HW PID filter)"); | 54 | err("This USB2.0 device cannot be run on a USB1.1 port. (it lacks a hardware PID filter)"); |
55 | return -ENODEV; | 55 | return -ENODEV; |
56 | } | 56 | } |
57 | 57 | ||
58 | if ((d->udev->speed == USB_SPEED_FULL && d->props.caps & DVB_USB_HAS_PID_FILTER) || | 58 | if ((d->udev->speed == USB_SPEED_FULL && d->props.caps & DVB_USB_HAS_PID_FILTER) || |
59 | (d->props.caps & DVB_USB_NEED_PID_FILTERING)) { | 59 | (d->props.caps & DVB_USB_NEED_PID_FILTERING)) { |
60 | info("will use the device's hw PID filter."); | 60 | info("will use the device's hardware PID filter (table count: %d).",d->props.pid_filter_count); |
61 | d->pid_filtering = 1; | 61 | d->pid_filtering = 1; |
62 | d->max_feed_count = d->props.pid_filter_count; | 62 | d->max_feed_count = d->props.pid_filter_count; |
63 | } else { | 63 | } else { |
64 | info("will pass the complete MPEG2 transport stream to the demuxer."); | 64 | info("will pass the complete MPEG2 transport stream to the software demuxer."); |
65 | d->pid_filtering = 0; | 65 | d->pid_filtering = 0; |
66 | d->max_feed_count = 255; | 66 | d->max_feed_count = 255; |
67 | } | 67 | } |
diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c index 5adc5d69ec84..9ac95f54f9fc 100644 --- a/drivers/media/dvb/dvb-usb/vp7045.c +++ b/drivers/media/dvb/dvb-usb/vp7045.c | |||
@@ -128,7 +128,7 @@ static struct dvb_usb_rc_key vp7045_rc_keys[] = { | |||
128 | { 0x00, 0x0f, KEY_TEXT } /* Teletext */ | 128 | { 0x00, 0x0f, KEY_TEXT } /* Teletext */ |
129 | }; | 129 | }; |
130 | 130 | ||
131 | static int vp7045_rc_query(struct dvb_usb_device *d, u32 *key_buf, int *state) | 131 | static int vp7045_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
132 | { | 132 | { |
133 | u8 key; | 133 | u8 key; |
134 | int i; | 134 | int i; |
@@ -144,7 +144,7 @@ static int vp7045_rc_query(struct dvb_usb_device *d, u32 *key_buf, int *state) | |||
144 | for (i = 0; i < sizeof(vp7045_rc_keys)/sizeof(struct dvb_usb_rc_key); i++) | 144 | for (i = 0; i < sizeof(vp7045_rc_keys)/sizeof(struct dvb_usb_rc_key); i++) |
145 | if (vp7045_rc_keys[i].data == key) { | 145 | if (vp7045_rc_keys[i].data == key) { |
146 | *state = REMOTE_KEY_PRESSED; | 146 | *state = REMOTE_KEY_PRESSED; |
147 | *key_buf = vp7045_rc_keys[i].event; | 147 | *event = vp7045_rc_keys[i].event; |
148 | break; | 148 | break; |
149 | } | 149 | } |
150 | return 0; | 150 | return 0; |
diff --git a/drivers/media/dvb/frontends/lgdt3302.c b/drivers/media/dvb/frontends/lgdt3302.c index 09c914256e49..2eea03d218cd 100644 --- a/drivers/media/dvb/frontends/lgdt3302.c +++ b/drivers/media/dvb/frontends/lgdt3302.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: lgdt3302.c,v 1.5 2005/07/07 03:47:15 mkrufky Exp $ | ||
3 | * | ||
4 | * Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM | 2 | * Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM |
5 | * | 3 | * |
6 | * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> | 4 | * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> |
@@ -83,7 +81,10 @@ static int i2c_writebytes (struct lgdt3302_state* state, | |||
83 | 81 | ||
84 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { | 82 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { |
85 | printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err); | 83 | printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err); |
86 | return -EREMOTEIO; | 84 | if (err < 0) |
85 | return err; | ||
86 | else | ||
87 | return -EREMOTEIO; | ||
87 | } | 88 | } |
88 | } else { | 89 | } else { |
89 | u8 tmp[] = { buf[0], buf[1] }; | 90 | u8 tmp[] = { buf[0], buf[1] }; |
@@ -96,7 +97,10 @@ static int i2c_writebytes (struct lgdt3302_state* state, | |||
96 | tmp[1] = buf[i]; | 97 | tmp[1] = buf[i]; |
97 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { | 98 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { |
98 | printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err); | 99 | printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err); |
99 | return -EREMOTEIO; | 100 | if (err < 0) |
101 | return err; | ||
102 | else | ||
103 | return -EREMOTEIO; | ||
100 | } | 104 | } |
101 | tmp[0]++; | 105 | tmp[0]++; |
102 | } | 106 | } |
@@ -218,6 +222,8 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe, | |||
218 | 222 | ||
219 | /* Change only if we are actually changing the modulation */ | 223 | /* Change only if we are actually changing the modulation */ |
220 | if (state->current_modulation != param->u.vsb.modulation) { | 224 | if (state->current_modulation != param->u.vsb.modulation) { |
225 | int value; | ||
226 | |||
221 | switch(param->u.vsb.modulation) { | 227 | switch(param->u.vsb.modulation) { |
222 | case VSB_8: | 228 | case VSB_8: |
223 | dprintk("%s: VSB_8 MODE\n", __FUNCTION__); | 229 | dprintk("%s: VSB_8 MODE\n", __FUNCTION__); |
@@ -266,36 +272,29 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe, | |||
266 | i2c_writebytes(state, state->config->demod_address, | 272 | i2c_writebytes(state, state->config->demod_address, |
267 | demux_ctrl_cfg, sizeof(demux_ctrl_cfg)); | 273 | demux_ctrl_cfg, sizeof(demux_ctrl_cfg)); |
268 | 274 | ||
269 | if (param->u.vsb.modulation == VSB_8) { | 275 | /* Change the value of NCOCTFV[25:0] of carrier |
270 | /* Initialization for VSB modes only */ | 276 | recovery center frequency register */ |
271 | /* Change the value of NCOCTFV[25:0]of carrier | 277 | i2c_writebytes(state, state->config->demod_address, |
272 | recovery center frequency register for VSB */ | ||
273 | i2c_writebytes(state, state->config->demod_address, | ||
274 | vsb_freq_cfg, sizeof(vsb_freq_cfg)); | 278 | vsb_freq_cfg, sizeof(vsb_freq_cfg)); |
275 | } else { | 279 | /* Set the value of 'INLVTHD' register 0x2a/0x2c |
276 | /* Initialization for QAM modes only */ | 280 | to value from 'IFACC' register 0x39/0x3b -1 */ |
277 | /* Set the value of 'INLVTHD' register 0x2a/0x2c | 281 | i2c_selectreadbytes(state, AGC_RFIF_ACC0, |
278 | to value from 'IFACC' register 0x39/0x3b -1 */ | 282 | &agc_delay_cfg[1], 3); |
279 | int value; | 283 | value = ((agc_delay_cfg[1] & 0x0f) << 8) | agc_delay_cfg[3]; |
280 | i2c_selectreadbytes(state, AGC_RFIF_ACC0, | 284 | value = value -1; |
281 | &agc_delay_cfg[1], 3); | 285 | dprintk("%s IFACC -1 = 0x%03x\n", __FUNCTION__, value); |
282 | value = ((agc_delay_cfg[1] & 0x0f) << 8) | agc_delay_cfg[3]; | 286 | agc_delay_cfg[1] = (value >> 8) & 0x0f; |
283 | value = value -1; | 287 | agc_delay_cfg[2] = 0x00; |
284 | dprintk("%s IFACC -1 = 0x%03x\n", __FUNCTION__, value); | 288 | agc_delay_cfg[3] = value & 0xff; |
285 | agc_delay_cfg[1] = (value >> 8) & 0x0f; | 289 | i2c_writebytes(state, state->config->demod_address, |
286 | agc_delay_cfg[2] = 0x00; | 290 | agc_delay_cfg, sizeof(agc_delay_cfg)); |
287 | agc_delay_cfg[3] = value & 0xff; | 291 | |
288 | i2c_writebytes(state, state->config->demod_address, | 292 | /* Change the value of IAGCBW[15:8] |
289 | agc_delay_cfg, sizeof(agc_delay_cfg)); | 293 | of inner AGC loop filter bandwith */ |
290 | 294 | i2c_writebytes(state, state->config->demod_address, | |
291 | /* Change the value of IAGCBW[15:8] | 295 | agc_loop_cfg, sizeof(agc_loop_cfg)); |
292 | of inner AGC loop filter bandwith */ | ||
293 | i2c_writebytes(state, state->config->demod_address, | ||
294 | agc_loop_cfg, sizeof(agc_loop_cfg)); | ||
295 | } | ||
296 | 296 | ||
297 | state->config->set_ts_params(fe, 0); | 297 | state->config->set_ts_params(fe, 0); |
298 | lgdt3302_SwReset(state); | ||
299 | state->current_modulation = param->u.vsb.modulation; | 298 | state->current_modulation = param->u.vsb.modulation; |
300 | } | 299 | } |
301 | 300 | ||
@@ -311,11 +310,10 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe, | |||
311 | i2c_readbytes(state, state->config->pll_address, buf, 1); | 310 | i2c_readbytes(state, state->config->pll_address, buf, 1); |
312 | dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[0]); | 311 | dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[0]); |
313 | 312 | ||
314 | lgdt3302_SwReset(state); | ||
315 | |||
316 | /* Update current frequency */ | 313 | /* Update current frequency */ |
317 | state->current_frequency = param->frequency; | 314 | state->current_frequency = param->frequency; |
318 | } | 315 | } |
316 | lgdt3302_SwReset(state); | ||
319 | return 0; | 317 | return 0; |
320 | } | 318 | } |
321 | 319 | ||
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index b65f4b0a481f..9746d2bb916f 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c | |||
@@ -1022,7 +1022,7 @@ static struct pci_device_id pci_tbl[] = { | |||
1022 | MODULE_DEVICE_TABLE(pci, pci_tbl); | 1022 | MODULE_DEVICE_TABLE(pci, pci_tbl); |
1023 | 1023 | ||
1024 | static struct saa7146_extension budget_extension = { | 1024 | static struct saa7146_extension budget_extension = { |
1025 | .name = "budget dvb /w video in\0", | 1025 | .name = "budget_av", |
1026 | .pci_tbl = pci_tbl, | 1026 | .pci_tbl = pci_tbl, |
1027 | 1027 | ||
1028 | .module = THIS_MODULE, | 1028 | .module = THIS_MODULE, |
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 2c17a5f58340..aa43b5fcb8e7 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | |||
@@ -1626,7 +1626,7 @@ static struct usb_device_id ttusb_table[] = { | |||
1626 | MODULE_DEVICE_TABLE(usb, ttusb_table); | 1626 | MODULE_DEVICE_TABLE(usb, ttusb_table); |
1627 | 1627 | ||
1628 | static struct usb_driver ttusb_driver = { | 1628 | static struct usb_driver ttusb_driver = { |
1629 | .name = "Technotrend/Hauppauge USB-Nova", | 1629 | .name = "ttusb", |
1630 | .probe = ttusb_probe, | 1630 | .probe = ttusb_probe, |
1631 | .disconnect = ttusb_disconnect, | 1631 | .disconnect = ttusb_disconnect, |
1632 | .id_table = ttusb_table, | 1632 | .id_table = ttusb_table, |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index e771064689e6..f461750c7646 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -7,19 +7,6 @@ menu "Video For Linux" | |||
7 | 7 | ||
8 | comment "Video Adapters" | 8 | comment "Video Adapters" |
9 | 9 | ||
10 | config TUNER_MULTI_I2C | ||
11 | bool "Enable support for multiple I2C devices on Video Adapters (EXPERIMENTAL)" | ||
12 | depends on VIDEO_DEV && EXPERIMENTAL | ||
13 | ---help--- | ||
14 | Some video adapters have more than one tuner inside. This patch | ||
15 | enables support for using more than one tuner. This is required | ||
16 | for some cards to allow tunning both video and radio. | ||
17 | It also improves I2C autodetection for these cards. | ||
18 | |||
19 | Only few tuners currently is supporting this. More to come. | ||
20 | |||
21 | It is safe to say 'Y' here even if your card has only one I2C tuner. | ||
22 | |||
23 | config VIDEO_BT848 | 10 | config VIDEO_BT848 |
24 | tristate "BT848 Video For Linux" | 11 | tristate "BT848 Video For Linux" |
25 | depends on VIDEO_DEV && PCI && I2C | 12 | depends on VIDEO_DEV && PCI && I2C |
diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c index 9a642c7de545..a070417e65e6 100644 --- a/drivers/media/video/bt832.c +++ b/drivers/media/video/bt832.c | |||
@@ -138,25 +138,13 @@ int bt832_init(struct i2c_client *i2c_client_s) | |||
138 | 138 | ||
139 | bt832_hexdump(i2c_client_s,buf); | 139 | bt832_hexdump(i2c_client_s,buf); |
140 | 140 | ||
141 | #if 0 | ||
142 | // Full 30/25 Frame rate | ||
143 | printk("Full 30/25 Frame rate\n"); | ||
144 | buf[0]=BT832_VP_CONTROL0; // Reg.39 | ||
145 | buf[1]= 0x00; | ||
146 | if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) | ||
147 | printk("bt832: i2c i/o error FFR: rc == %d (should be 2)\n",rc); | ||
148 | |||
149 | bt832_hexdump(i2c_client_s,buf); | ||
150 | #endif | ||
151 | 141 | ||
152 | #if 1 | ||
153 | // for testing (even works when no camera attached) | 142 | // for testing (even works when no camera attached) |
154 | printk("bt832: *** Generate NTSC M Bars *****\n"); | 143 | printk("bt832: *** Generate NTSC M Bars *****\n"); |
155 | buf[0]=BT832_VP_TESTCONTROL0; // Reg. 42 | 144 | buf[0]=BT832_VP_TESTCONTROL0; // Reg. 42 |
156 | buf[1]=3; // Generate NTSC System M bars, Generate Frame timing internally | 145 | buf[1]=3; // Generate NTSC System M bars, Generate Frame timing internally |
157 | if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) | 146 | if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) |
158 | printk("bt832: i2c i/o error MBAR: rc == %d (should be 2)\n",rc); | 147 | printk("bt832: i2c i/o error MBAR: rc == %d (should be 2)\n",rc); |
159 | #endif | ||
160 | 148 | ||
161 | printk("Bt832: Camera Present: %s\n", | 149 | printk("Bt832: Camera Present: %s\n", |
162 | (buf[1+BT832_CAM_STATUS] & BT832_56_CAMERA_PRESENT) ? "yes":"no"); | 150 | (buf[1+BT832_CAM_STATUS] & BT832_56_CAMERA_PRESENT) ? "yes":"no"); |
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 251092e7f19f..2dbf5ec43abd 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttv-cards.c,v 1.49 2005/06/10 17:20:24 mchehab Exp $ | 2 | $Id: bttv-cards.c,v 1.53 2005/07/05 17:37:35 nsh Exp $ |
3 | 3 | ||
4 | bttv-cards.c | 4 | bttv-cards.c |
5 | 5 | ||
@@ -39,9 +39,6 @@ | |||
39 | #include <asm/io.h> | 39 | #include <asm/io.h> |
40 | 40 | ||
41 | #include "bttvp.h" | 41 | #include "bttvp.h" |
42 | #if 0 /* not working yet */ | ||
43 | #include "bt832.h" | ||
44 | #endif | ||
45 | 42 | ||
46 | /* fwd decl */ | 43 | /* fwd decl */ |
47 | static void boot_msp34xx(struct bttv *btv, int pin); | 44 | static void boot_msp34xx(struct bttv *btv, int pin); |
@@ -513,13 +510,8 @@ struct tvcard bttv_tvcards[] = { | |||
513 | .svhs = 2, | 510 | .svhs = 2, |
514 | .gpiomask = 0x01fe00, | 511 | .gpiomask = 0x01fe00, |
515 | .muxsel = { 2, 3, 1, 1}, | 512 | .muxsel = { 2, 3, 1, 1}, |
516 | #if 0 | ||
517 | // old | ||
518 | .audiomux = { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 }, | ||
519 | #else | ||
520 | // 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> | 513 | // 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> |
521 | .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 }, | 514 | .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 }, |
522 | #endif | ||
523 | .needs_tvaudio = 1, | 515 | .needs_tvaudio = 1, |
524 | .pll = PLL_28, | 516 | .pll = PLL_28, |
525 | .tuner_type = -1, | 517 | .tuner_type = -1, |
@@ -766,14 +758,9 @@ struct tvcard bttv_tvcards[] = { | |||
766 | .tuner = 0, | 758 | .tuner = 0, |
767 | .svhs = 2, | 759 | .svhs = 2, |
768 | .muxsel = { 2, 3, 1, 1, 0}, // TV, CVid, SVid, CVid over SVid connector | 760 | .muxsel = { 2, 3, 1, 1, 0}, // TV, CVid, SVid, CVid over SVid connector |
769 | #if 0 | ||
770 | .gpiomask = 0xc33000, | ||
771 | .audiomux = { 0x422000,0x1000,0x0000,0x620000,0x800000 }, | ||
772 | #else | ||
773 | /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */ | 761 | /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */ |
774 | .gpiomask = 0xb33000, | 762 | .gpiomask = 0xb33000, |
775 | .audiomux = { 0x122000,0x1000,0x0000,0x620000,0x800000 }, | 763 | .audiomux = { 0x122000,0x1000,0x0000,0x620000,0x800000 }, |
776 | #endif | ||
777 | /* Audio Routing for "WinFast 2000 XP" (no tv stereo !) | 764 | /* Audio Routing for "WinFast 2000 XP" (no tv stereo !) |
778 | gpio23 -- hef4052:nEnable (0x800000) | 765 | gpio23 -- hef4052:nEnable (0x800000) |
779 | gpio12 -- hef4052:A1 | 766 | gpio12 -- hef4052:A1 |
@@ -1603,20 +1590,11 @@ struct tvcard bttv_tvcards[] = { | |||
1603 | .video_inputs = 4, | 1590 | .video_inputs = 4, |
1604 | .audio_inputs = 1, | 1591 | .audio_inputs = 1, |
1605 | .tuner = -1, | 1592 | .tuner = -1, |
1606 | #if 0 /* TODO ... */ | ||
1607 | .svhs = OSPREY540_SVID_ANALOG, | ||
1608 | .muxsel = { [OSPREY540_COMP_ANALOG] = 2, | ||
1609 | [OSPREY540_SVID_ANALOG] = 3, }, | ||
1610 | #endif | ||
1611 | .pll = PLL_28, | 1593 | .pll = PLL_28, |
1612 | .tuner_type = -1, | 1594 | .tuner_type = -1, |
1613 | .no_msp34xx = 1, | 1595 | .no_msp34xx = 1, |
1614 | .no_tda9875 = 1, | 1596 | .no_tda9875 = 1, |
1615 | .no_tda7432 = 1, | 1597 | .no_tda7432 = 1, |
1616 | #if 0 /* TODO ... */ | ||
1617 | .muxsel_hook = osprey_540_muxsel, | ||
1618 | .picture_hook = osprey_540_set_picture, | ||
1619 | #endif | ||
1620 | },{ | 1598 | },{ |
1621 | 1599 | ||
1622 | /* ---- card 0x5C ---------------------------------- */ | 1600 | /* ---- card 0x5C ---------------------------------- */ |
@@ -2546,21 +2524,12 @@ static void eagle_muxsel(struct bttv *btv, unsigned int input) | |||
2546 | btaor((2)<<5, ~(3<<5), BT848_IFORM); | 2524 | btaor((2)<<5, ~(3<<5), BT848_IFORM); |
2547 | gpio_bits(3,bttv_tvcards[btv->c.type].muxsel[input&7]); | 2525 | gpio_bits(3,bttv_tvcards[btv->c.type].muxsel[input&7]); |
2548 | 2526 | ||
2549 | #if 0 | ||
2550 | /* svhs */ | ||
2551 | /* wake chroma ADC */ | ||
2552 | btand(~BT848_ADC_C_SLEEP, BT848_ADC); | ||
2553 | /* set to YC video */ | ||
2554 | btor(BT848_CONTROL_COMP, BT848_E_CONTROL); | ||
2555 | btor(BT848_CONTROL_COMP, BT848_O_CONTROL); | ||
2556 | #else | ||
2557 | /* composite */ | 2527 | /* composite */ |
2558 | /* set chroma ADC to sleep */ | 2528 | /* set chroma ADC to sleep */ |
2559 | btor(BT848_ADC_C_SLEEP, BT848_ADC); | 2529 | btor(BT848_ADC_C_SLEEP, BT848_ADC); |
2560 | /* set to composite video */ | 2530 | /* set to composite video */ |
2561 | btand(~BT848_CONTROL_COMP, BT848_E_CONTROL); | 2531 | btand(~BT848_CONTROL_COMP, BT848_E_CONTROL); |
2562 | btand(~BT848_CONTROL_COMP, BT848_O_CONTROL); | 2532 | btand(~BT848_CONTROL_COMP, BT848_O_CONTROL); |
2563 | #endif | ||
2564 | 2533 | ||
2565 | /* switch sync drive off */ | 2534 | /* switch sync drive off */ |
2566 | gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE); | 2535 | gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE); |
@@ -2813,10 +2782,18 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
2813 | btv->tuner_type = tuner[btv->c.nr]; | 2782 | btv->tuner_type = tuner[btv->c.nr]; |
2814 | printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type); | 2783 | printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type); |
2815 | if (btv->pinnacle_id != UNSET) | 2784 | if (btv->pinnacle_id != UNSET) |
2816 | bttv_call_i2c_clients(btv,AUDC_CONFIG_PINNACLE, | 2785 | bttv_call_i2c_clients(btv, AUDC_CONFIG_PINNACLE, |
2817 | &btv->pinnacle_id); | 2786 | &btv->pinnacle_id); |
2818 | if (btv->tuner_type != UNSET) | 2787 | if (btv->tuner_type != UNSET) { |
2819 | bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type); | 2788 | struct tuner_setup tun_setup; |
2789 | |||
2790 | tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; | ||
2791 | tun_setup.type = btv->tuner_type; | ||
2792 | tun_setup.addr = ADDR_UNSET; | ||
2793 | |||
2794 | bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup); | ||
2795 | } | ||
2796 | |||
2820 | btv->svhs = bttv_tvcards[btv->c.type].svhs; | 2797 | btv->svhs = bttv_tvcards[btv->c.type].svhs; |
2821 | if (svhs[btv->c.nr] != UNSET) | 2798 | if (svhs[btv->c.nr] != UNSET) |
2822 | btv->svhs = svhs[btv->c.nr]; | 2799 | btv->svhs = svhs[btv->c.nr]; |
@@ -3125,14 +3102,6 @@ static int tuner_0_table[] = { | |||
3125 | TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM, | 3102 | TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM, |
3126 | TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL, | 3103 | TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL, |
3127 | TUNER_PHILIPS_FM1216ME_MK3 }; | 3104 | TUNER_PHILIPS_FM1216ME_MK3 }; |
3128 | #if 0 | ||
3129 | int tuner_0_fm_table[] = { | ||
3130 | PHILIPS_FR1236_NTSC, PHILIPS_FR1216_PAL, | ||
3131 | PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL, | ||
3132 | PHILIPS_FR1216_PAL, PHILIPS_FR1216_PAL, | ||
3133 | PHILIPS_FR1236_SECAM, PHILIPS_FR1236_SECAM, | ||
3134 | PHILIPS_FR1236_SECAM, PHILIPS_FR1216_PAL}; | ||
3135 | #endif | ||
3136 | 3105 | ||
3137 | static int tuner_1_table[] = { | 3106 | static int tuner_1_table[] = { |
3138 | TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL, | 3107 | TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL, |
@@ -3218,36 +3187,6 @@ static void __devinit boot_msp34xx(struct bttv *btv, int pin) | |||
3218 | 3187 | ||
3219 | static void __devinit boot_bt832(struct bttv *btv) | 3188 | static void __devinit boot_bt832(struct bttv *btv) |
3220 | { | 3189 | { |
3221 | #if 0 /* not working yet */ | ||
3222 | int resetbit=0; | ||
3223 | |||
3224 | switch (btv->c.type) { | ||
3225 | case BTTV_PXELVWPLTVPAK: | ||
3226 | resetbit = 0x400000; | ||
3227 | break; | ||
3228 | case BTTV_MODTEC_205: | ||
3229 | resetbit = 1<<9; | ||
3230 | break; | ||
3231 | default: | ||
3232 | BUG(); | ||
3233 | } | ||
3234 | |||
3235 | request_module("bt832"); | ||
3236 | bttv_call_i2c_clients(btv, BT832_HEXDUMP, NULL); | ||
3237 | |||
3238 | printk("bttv%d: Reset Bt832 [line=0x%x]\n",btv->c.nr,resetbit); | ||
3239 | gpio_write(0); | ||
3240 | gpio_inout(resetbit, resetbit); | ||
3241 | udelay(5); | ||
3242 | gpio_bits(resetbit, resetbit); | ||
3243 | udelay(5); | ||
3244 | gpio_bits(resetbit, 0); | ||
3245 | udelay(5); | ||
3246 | |||
3247 | // bt832 on pixelview changes from i2c 0x8a to 0x88 after | ||
3248 | // being reset as above. So we must follow by this: | ||
3249 | bttv_call_i2c_clients(btv, BT832_REATTACH, NULL); | ||
3250 | #endif | ||
3251 | } | 3190 | } |
3252 | 3191 | ||
3253 | /* ----------------------------------------------------------------------- */ | 3192 | /* ----------------------------------------------------------------------- */ |
@@ -3572,11 +3511,6 @@ void tea5757_set_freq(struct bttv *btv, unsigned short freq) | |||
3572 | { | 3511 | { |
3573 | dprintk("tea5757_set_freq %d\n",freq); | 3512 | dprintk("tea5757_set_freq %d\n",freq); |
3574 | tea5757_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */ | 3513 | tea5757_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */ |
3575 | #if 0 | ||
3576 | /* breaks Miro PCTV */ | ||
3577 | value = tea5757_read(btv); | ||
3578 | dprintk("bttv%d: tea5757 readback=0x%x\n",btv->c.nr,value); | ||
3579 | #endif | ||
3580 | } | 3514 | } |
3581 | 3515 | ||
3582 | 3516 | ||
@@ -3656,13 +3590,8 @@ gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set) | |||
3656 | { | 3590 | { |
3657 | unsigned int val, con; | 3591 | unsigned int val, con; |
3658 | 3592 | ||
3659 | #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0) | ||
3660 | if (btv->radio_user) | 3593 | if (btv->radio_user) |
3661 | return; | 3594 | return; |
3662 | #else | ||
3663 | if (btv->radio) | ||
3664 | return; | ||
3665 | #endif | ||
3666 | 3595 | ||
3667 | val = gpio_read(); | 3596 | val = gpio_read(); |
3668 | if (set) { | 3597 | if (set) { |
@@ -3851,13 +3780,8 @@ pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set) | |||
3851 | { | 3780 | { |
3852 | unsigned int val = 0; | 3781 | unsigned int val = 0; |
3853 | 3782 | ||
3854 | #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0) | ||
3855 | if (btv->radio_user) | 3783 | if (btv->radio_user) |
3856 | return; | 3784 | return; |
3857 | #else | ||
3858 | if (btv->radio) | ||
3859 | return; | ||
3860 | #endif | ||
3861 | 3785 | ||
3862 | if (set) { | 3786 | if (set) { |
3863 | if (v->mode & VIDEO_SOUND_MONO) { | 3787 | if (v->mode & VIDEO_SOUND_MONO) { |
@@ -3888,13 +3812,8 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set) | |||
3888 | { | 3812 | { |
3889 | unsigned int val = 0xffff; | 3813 | unsigned int val = 0xffff; |
3890 | 3814 | ||
3891 | #if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0) | ||
3892 | if (btv->radio_user) | 3815 | if (btv->radio_user) |
3893 | return; | 3816 | return; |
3894 | #else | ||
3895 | if (btv->radio) | ||
3896 | return; | ||
3897 | #endif | ||
3898 | if (set) { | 3817 | if (set) { |
3899 | if (v->mode & VIDEO_SOUND_MONO) { | 3818 | if (v->mode & VIDEO_SOUND_MONO) { |
3900 | val = 0x0000; | 3819 | val = 0x0000; |
@@ -4371,11 +4290,6 @@ void __devinit bttv_check_chipset(void) | |||
4371 | latency = 0x0A; | 4290 | latency = 0x0A; |
4372 | #endif | 4291 | #endif |
4373 | 4292 | ||
4374 | #if 0 | ||
4375 | /* print which chipset we have */ | ||
4376 | while ((dev = pci_find_class(PCI_CLASS_BRIDGE_HOST << 8,dev))) | ||
4377 | printk(KERN_INFO "bttv: Host bridge is %s\n",pci_name(dev)); | ||
4378 | #endif | ||
4379 | 4293 | ||
4380 | /* print warnings about any quirks found */ | 4294 | /* print warnings about any quirks found */ |
4381 | if (triton1) | 4295 | if (triton1) |
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index 7d62b394c509..51a0f6d68e73 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttv-driver.c,v 1.40 2005/06/16 21:38:45 nsh Exp $ | 2 | $Id: bttv-driver.c,v 1.42 2005/07/05 17:37:35 nsh Exp $ |
3 | 3 | ||
4 | bttv - Bt848 frame grabber driver | 4 | bttv - Bt848 frame grabber driver |
5 | 5 | ||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/sched.h> | 35 | #include <linux/sched.h> |
36 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
37 | #include <linux/kdev_t.h> | 37 | #include <linux/kdev_t.h> |
38 | #include <linux/dma-mapping.h> | ||
38 | 39 | ||
39 | #include <asm/io.h> | 40 | #include <asm/io.h> |
40 | #include <asm/byteorder.h> | 41 | #include <asm/byteorder.h> |
@@ -698,12 +699,10 @@ int locked_btres(struct bttv *btv, int bit) | |||
698 | static | 699 | static |
699 | void free_btres(struct bttv *btv, struct bttv_fh *fh, int bits) | 700 | void free_btres(struct bttv *btv, struct bttv_fh *fh, int bits) |
700 | { | 701 | { |
701 | #if 1 /* DEBUG */ | ||
702 | if ((fh->resources & bits) != bits) { | 702 | if ((fh->resources & bits) != bits) { |
703 | /* trying to free ressources not allocated by us ... */ | 703 | /* trying to free ressources not allocated by us ... */ |
704 | printk("bttv: BUG! (btres)\n"); | 704 | printk("bttv: BUG! (btres)\n"); |
705 | } | 705 | } |
706 | #endif | ||
707 | down(&btv->reslock); | 706 | down(&btv->reslock); |
708 | fh->resources &= ~bits; | 707 | fh->resources &= ~bits; |
709 | btv->resources &= ~bits; | 708 | btv->resources &= ~bits; |
@@ -943,11 +942,6 @@ audio_mux(struct bttv *btv, int mode) | |||
943 | i2c_mux = mux = (btv->audio & AUDIO_MUTE) ? AUDIO_OFF : btv->audio; | 942 | i2c_mux = mux = (btv->audio & AUDIO_MUTE) ? AUDIO_OFF : btv->audio; |
944 | if (btv->opt_automute && !signal && !btv->radio_user) | 943 | if (btv->opt_automute && !signal && !btv->radio_user) |
945 | mux = AUDIO_OFF; | 944 | mux = AUDIO_OFF; |
946 | #if 0 | ||
947 | printk("bttv%d: amux: mode=%d audio=%d signal=%s mux=%d/%d irq=%s\n", | ||
948 | btv->c.nr, mode, btv->audio, signal ? "yes" : "no", | ||
949 | mux, i2c_mux, in_interrupt() ? "yes" : "no"); | ||
950 | #endif | ||
951 | 945 | ||
952 | val = bttv_tvcards[btv->c.type].audiomux[mux]; | 946 | val = bttv_tvcards[btv->c.type].audiomux[mux]; |
953 | gpio_bits(bttv_tvcards[btv->c.type].gpiomask,val); | 947 | gpio_bits(bttv_tvcards[btv->c.type].gpiomask,val); |
@@ -994,11 +988,6 @@ set_tvnorm(struct bttv *btv, unsigned int norm) | |||
994 | case BTTV_VOODOOTV_FM: | 988 | case BTTV_VOODOOTV_FM: |
995 | bttv_tda9880_setnorm(btv,norm); | 989 | bttv_tda9880_setnorm(btv,norm); |
996 | break; | 990 | break; |
997 | #if 0 | ||
998 | case BTTV_OSPREY540: | ||
999 | osprey_540_set_norm(btv,norm); | ||
1000 | break; | ||
1001 | #endif | ||
1002 | } | 991 | } |
1003 | return 0; | 992 | return 0; |
1004 | } | 993 | } |
@@ -1849,7 +1838,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) | |||
1849 | 1838 | ||
1850 | if (unlikely(f->tuner != 0)) | 1839 | if (unlikely(f->tuner != 0)) |
1851 | return -EINVAL; | 1840 | return -EINVAL; |
1852 | if (unlikely(f->type != V4L2_TUNER_ANALOG_TV)) | 1841 | if (unlikely (f->type != V4L2_TUNER_ANALOG_TV)) |
1853 | return -EINVAL; | 1842 | return -EINVAL; |
1854 | down(&btv->lock); | 1843 | down(&btv->lock); |
1855 | btv->freq = f->frequency; | 1844 | btv->freq = f->frequency; |
@@ -3865,7 +3854,7 @@ static int __devinit bttv_probe(struct pci_dev *dev, | |||
3865 | btv->c.nr); | 3854 | btv->c.nr); |
3866 | return -EIO; | 3855 | return -EIO; |
3867 | } | 3856 | } |
3868 | if (pci_set_dma_mask(dev, 0xffffffff)) { | 3857 | if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) { |
3869 | printk(KERN_WARNING "bttv%d: No suitable DMA available.\n", | 3858 | printk(KERN_WARNING "bttv%d: No suitable DMA available.\n", |
3870 | btv->c.nr); | 3859 | btv->c.nr); |
3871 | return -EIO; | 3860 | return -EIO; |
diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c index da448a5f9e9c..234a85563769 100644 --- a/drivers/media/video/bttv-i2c.c +++ b/drivers/media/video/bttv-i2c.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttv-i2c.c,v 1.21 2005/06/10 17:20:24 mchehab Exp $ | 2 | $Id: bttv-i2c.c,v 1.25 2005/07/05 17:37:35 nsh Exp $ |
3 | 3 | ||
4 | bttv-i2c.c -- all the i2c code is here | 4 | bttv-i2c.c -- all the i2c code is here |
5 | 5 | ||
@@ -295,14 +295,26 @@ static int attach_inform(struct i2c_client *client) | |||
295 | { | 295 | { |
296 | struct bttv *btv = i2c_get_adapdata(client->adapter); | 296 | struct bttv *btv = i2c_get_adapdata(client->adapter); |
297 | 297 | ||
298 | if (btv->tuner_type != UNSET) | 298 | if (bttv_debug) |
299 | bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type); | 299 | printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n", |
300 | btv->c.nr,client->driver->name,client->addr, | ||
301 | i2c_clientname(client)); | ||
302 | if (!client->driver->command) | ||
303 | return 0; | ||
304 | |||
305 | if (btv->tuner_type != UNSET) { | ||
306 | struct tuner_setup tun_setup; | ||
307 | |||
308 | tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; | ||
309 | tun_setup.type = btv->tuner_type; | ||
310 | tun_setup.addr = ADDR_UNSET; | ||
311 | |||
312 | client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup); | ||
313 | } | ||
314 | |||
300 | if (btv->pinnacle_id != UNSET) | 315 | if (btv->pinnacle_id != UNSET) |
301 | bttv_call_i2c_clients(btv,AUDC_CONFIG_PINNACLE, | 316 | client->driver->command(client,AUDC_CONFIG_PINNACLE, |
302 | &btv->pinnacle_id); | 317 | &btv->pinnacle_id); |
303 | if (bttv_debug) | ||
304 | printk("bttv%d: i2c attach [client=%s]\n", | ||
305 | btv->c.nr, i2c_clientname(client)); | ||
306 | return 0; | 318 | return 0; |
307 | } | 319 | } |
308 | 320 | ||
diff --git a/drivers/media/video/bttv-risc.c b/drivers/media/video/bttv-risc.c index bdc5ce6c43b9..9ed21fd190c6 100644 --- a/drivers/media/video/bttv-risc.c +++ b/drivers/media/video/bttv-risc.c | |||
@@ -334,10 +334,6 @@ bttv_calc_geo(struct bttv *btv, struct bttv_geometry *geo, | |||
334 | } | 334 | } |
335 | 335 | ||
336 | vdelay = tvnorm->vdelay; | 336 | vdelay = tvnorm->vdelay; |
337 | #if 0 /* FIXME */ | ||
338 | if (vdelay < btv->vbi.lines*2) | ||
339 | vdelay = btv->vbi.lines*2; | ||
340 | #endif | ||
341 | 337 | ||
342 | xsf = (width*scaledtwidth)/swidth; | 338 | xsf = (width*scaledtwidth)/swidth; |
343 | geo->hscale = ((totalwidth*4096UL)/xsf-4096); | 339 | geo->hscale = ((totalwidth*4096UL)/xsf-4096); |
@@ -776,13 +772,8 @@ bttv_overlay_risc(struct bttv *btv, | |||
776 | bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 0, 0); | 772 | bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 0, 0); |
777 | break; | 773 | break; |
778 | case V4L2_FIELD_INTERLACED: | 774 | case V4L2_FIELD_INTERLACED: |
779 | #if 0 | ||
780 | bttv_risc_overlay(btv, &buf->top, fmt, ov, 1, 0); | ||
781 | bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 0, 1); | ||
782 | #else | ||
783 | bttv_risc_overlay(btv, &buf->top, fmt, ov, 0, 1); | 775 | bttv_risc_overlay(btv, &buf->top, fmt, ov, 0, 1); |
784 | bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 1, 0); | 776 | bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 1, 0); |
785 | #endif | ||
786 | break; | 777 | break; |
787 | default: | 778 | default: |
788 | BUG(); | 779 | BUG(); |
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 91f8afeded88..4f39688f780a 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
@@ -690,11 +690,9 @@ static void blackbird_codec_settings(struct cx8802_dev *dev) | |||
690 | int bitrate_mode = 1; | 690 | int bitrate_mode = 1; |
691 | int bitrate = 7500000; | 691 | int bitrate = 7500000; |
692 | int bitrate_peak = 7500000; | 692 | int bitrate_peak = 7500000; |
693 | #if 1 | ||
694 | bitrate_mode = BLACKBIRD_VIDEO_CBR; | 693 | bitrate_mode = BLACKBIRD_VIDEO_CBR; |
695 | bitrate = 4000*1024; | 694 | bitrate = 4000*1024; |
696 | bitrate_peak = 4000*1024; | 695 | bitrate_peak = 4000*1024; |
697 | #endif | ||
698 | 696 | ||
699 | /* assign stream type */ | 697 | /* assign stream type */ |
700 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_PROGRAM); | 698 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_PROGRAM); |
@@ -810,9 +808,6 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev) | |||
810 | cx_write(MO_VBOS_CONTROL, 0x84A00); /* no 656 mode, 8-bit pixels, disable VBI */ | 808 | cx_write(MO_VBOS_CONTROL, 0x84A00); /* no 656 mode, 8-bit pixels, disable VBI */ |
811 | cx_clear(MO_OUTPUT_FORMAT, 0x0008); /* Normal Y-limits to let the mpeg encoder sync */ | 809 | cx_clear(MO_OUTPUT_FORMAT, 0x0008); /* Normal Y-limits to let the mpeg encoder sync */ |
812 | 810 | ||
813 | #if 0 /* FIXME */ | ||
814 | set_scale(dev, 720, 480, V4L2_FIELD_INTERLACED); | ||
815 | #endif | ||
816 | blackbird_codec_settings(dev); | 811 | blackbird_codec_settings(dev); |
817 | msleep(1); | 812 | msleep(1); |
818 | 813 | ||
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index 96cb0ff33bbd..5e868f5cd0c0 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-core.c,v 1.31 2005/06/22 22:58:04 mchehab Exp $ | 2 | * $Id: cx88-core.c,v 1.33 2005/07/07 14:17:47 mchehab Exp $ |
3 | * | 3 | * |
4 | * device driver for Conexant 2388x based TV cards | 4 | * device driver for Conexant 2388x based TV cards |
5 | * driver core | 5 | * driver core |
@@ -470,25 +470,6 @@ int cx88_risc_decode(u32 risc) | |||
470 | return incr[risc >> 28] ? incr[risc >> 28] : 1; | 470 | return incr[risc >> 28] ? incr[risc >> 28] : 1; |
471 | } | 471 | } |
472 | 472 | ||
473 | #if 0 /* currently unused, but useful for debugging */ | ||
474 | void cx88_risc_disasm(struct cx88_core *core, | ||
475 | struct btcx_riscmem *risc) | ||
476 | { | ||
477 | unsigned int i,j,n; | ||
478 | |||
479 | printk("%s: risc disasm: %p [dma=0x%08lx]\n", | ||
480 | core->name, risc->cpu, (unsigned long)risc->dma); | ||
481 | for (i = 0; i < (risc->size >> 2); i += n) { | ||
482 | printk("%s: %04d: ", core->name, i); | ||
483 | n = cx88_risc_decode(risc->cpu[i]); | ||
484 | for (j = 1; j < n; j++) | ||
485 | printk("%s: %04d: 0x%08x [ arg #%d ]\n", | ||
486 | core->name, i+j, risc->cpu[i+j], j); | ||
487 | if (risc->cpu[i] == RISC_JUMP) | ||
488 | break; | ||
489 | } | ||
490 | } | ||
491 | #endif | ||
492 | 473 | ||
493 | void cx88_sram_channel_dump(struct cx88_core *core, | 474 | void cx88_sram_channel_dump(struct cx88_core *core, |
494 | struct sram_channel *ch) | 475 | struct sram_channel *ch) |
@@ -545,30 +526,12 @@ void cx88_sram_channel_dump(struct cx88_core *core, | |||
545 | core->name,cx_read(ch->cnt2_reg)); | 526 | core->name,cx_read(ch->cnt2_reg)); |
546 | } | 527 | } |
547 | 528 | ||
548 | /* Used only on cx88-core */ | ||
549 | static char *cx88_pci_irqs[32] = { | 529 | static char *cx88_pci_irqs[32] = { |
550 | "vid", "aud", "ts", "vip", "hst", "5", "6", "tm1", | 530 | "vid", "aud", "ts", "vip", "hst", "5", "6", "tm1", |
551 | "src_dma", "dst_dma", "risc_rd_err", "risc_wr_err", | 531 | "src_dma", "dst_dma", "risc_rd_err", "risc_wr_err", |
552 | "brdg_err", "src_dma_err", "dst_dma_err", "ipb_dma_err", | 532 | "brdg_err", "src_dma_err", "dst_dma_err", "ipb_dma_err", |
553 | "i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1" | 533 | "i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1" |
554 | }; | 534 | }; |
555 | /* Used only on cx88-video */ | ||
556 | char *cx88_vid_irqs[32] = { | ||
557 | "y_risci1", "u_risci1", "v_risci1", "vbi_risc1", | ||
558 | "y_risci2", "u_risci2", "v_risci2", "vbi_risc2", | ||
559 | "y_oflow", "u_oflow", "v_oflow", "vbi_oflow", | ||
560 | "y_sync", "u_sync", "v_sync", "vbi_sync", | ||
561 | "opc_err", "par_err", "rip_err", "pci_abort", | ||
562 | }; | ||
563 | /* Used only on cx88-mpeg */ | ||
564 | char *cx88_mpeg_irqs[32] = { | ||
565 | "ts_risci1", NULL, NULL, NULL, | ||
566 | "ts_risci2", NULL, NULL, NULL, | ||
567 | "ts_oflow", NULL, NULL, NULL, | ||
568 | "ts_sync", NULL, NULL, NULL, | ||
569 | "opc_err", "par_err", "rip_err", "pci_abort", | ||
570 | "ts_err?", | ||
571 | }; | ||
572 | 535 | ||
573 | void cx88_print_irqbits(char *name, char *tag, char **strings, | 536 | void cx88_print_irqbits(char *name, char *tag, char **strings, |
574 | u32 bits, u32 mask) | 537 | u32 bits, u32 mask) |
@@ -618,16 +581,11 @@ void cx88_wakeup(struct cx88_core *core, | |||
618 | break; | 581 | break; |
619 | buf = list_entry(q->active.next, | 582 | buf = list_entry(q->active.next, |
620 | struct cx88_buffer, vb.queue); | 583 | struct cx88_buffer, vb.queue); |
621 | #if 0 | ||
622 | if (buf->count > count) | ||
623 | break; | ||
624 | #else | ||
625 | /* count comes from the hw and is is 16bit wide -- | 584 | /* count comes from the hw and is is 16bit wide -- |
626 | * this trick handles wrap-arounds correctly for | 585 | * this trick handles wrap-arounds correctly for |
627 | * up to 32767 buffers in flight... */ | 586 | * up to 32767 buffers in flight... */ |
628 | if ((s16) (count - buf->count) < 0) | 587 | if ((s16) (count - buf->count) < 0) |
629 | break; | 588 | break; |
630 | #endif | ||
631 | do_gettimeofday(&buf->vb.ts); | 589 | do_gettimeofday(&buf->vb.ts); |
632 | dprintk(2,"[%p/%d] wakeup reg=%d buf=%d\n",buf,buf->vb.i, | 590 | dprintk(2,"[%p/%d] wakeup reg=%d buf=%d\n",buf,buf->vb.i, |
633 | count, buf->count); | 591 | count, buf->count); |
@@ -955,12 +913,10 @@ int cx88_set_tvnorm(struct cx88_core *core, struct cx88_tvnorm *norm) | |||
955 | norm->cxiformat, cx_read(MO_INPUT_FORMAT) & 0x0f); | 913 | norm->cxiformat, cx_read(MO_INPUT_FORMAT) & 0x0f); |
956 | cx_andor(MO_INPUT_FORMAT, 0xf, norm->cxiformat); | 914 | cx_andor(MO_INPUT_FORMAT, 0xf, norm->cxiformat); |
957 | 915 | ||
958 | #if 1 | ||
959 | // FIXME: as-is from DScaler | 916 | // FIXME: as-is from DScaler |
960 | dprintk(1,"set_tvnorm: MO_OUTPUT_FORMAT 0x%08x [old=0x%08x]\n", | 917 | dprintk(1,"set_tvnorm: MO_OUTPUT_FORMAT 0x%08x [old=0x%08x]\n", |
961 | norm->cxoformat, cx_read(MO_OUTPUT_FORMAT)); | 918 | norm->cxoformat, cx_read(MO_OUTPUT_FORMAT)); |
962 | cx_write(MO_OUTPUT_FORMAT, norm->cxoformat); | 919 | cx_write(MO_OUTPUT_FORMAT, norm->cxoformat); |
963 | #endif | ||
964 | 920 | ||
965 | // MO_SCONV_REG = adc clock / video dec clock * 2^17 | 921 | // MO_SCONV_REG = adc clock / video dec clock * 2^17 |
966 | tmp64 = adc_clock * (u64)(1 << 17); | 922 | tmp64 = adc_clock * (u64)(1 << 17); |
@@ -1219,8 +1175,6 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci) | |||
1219 | /* ------------------------------------------------------------------ */ | 1175 | /* ------------------------------------------------------------------ */ |
1220 | 1176 | ||
1221 | EXPORT_SYMBOL(cx88_print_ioctl); | 1177 | EXPORT_SYMBOL(cx88_print_ioctl); |
1222 | EXPORT_SYMBOL(cx88_vid_irqs); | ||
1223 | EXPORT_SYMBOL(cx88_mpeg_irqs); | ||
1224 | EXPORT_SYMBOL(cx88_print_irqbits); | 1178 | EXPORT_SYMBOL(cx88_print_irqbits); |
1225 | 1179 | ||
1226 | EXPORT_SYMBOL(cx88_core_irq); | 1180 | EXPORT_SYMBOL(cx88_core_irq); |
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 690477a67917..8db68f2d1351 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-dvb.c,v 1.39 2005/07/02 20:00:46 mkrufky Exp $ | 2 | * $Id: cx88-dvb.c,v 1.41 2005/07/04 19:35:05 mkrufky Exp $ |
3 | * | 3 | * |
4 | * device driver for Conexant 2388x based TV cards | 4 | * device driver for Conexant 2388x based TV cards |
5 | * MPEG Transport Stream (DVB) routines | 5 | * MPEG Transport Stream (DVB) routines |
@@ -30,22 +30,25 @@ | |||
30 | #include <linux/file.h> | 30 | #include <linux/file.h> |
31 | #include <linux/suspend.h> | 31 | #include <linux/suspend.h> |
32 | 32 | ||
33 | /* these three frontends need merging via linuxtv cvs ... */ | 33 | #define CONFIG_DVB_MT352 1 |
34 | #define HAVE_CX22702 1 | 34 | #define CONFIG_DVB_CX22702 1 |
35 | #define HAVE_OR51132 1 | 35 | #define CONFIG_DVB_OR51132 1 |
36 | #define HAVE_LGDT3302 1 | 36 | #define CONFIG_DVB_LGDT3302 1 |
37 | 37 | ||
38 | #include "cx88.h" | 38 | #include "cx88.h" |
39 | #include "dvb-pll.h" | 39 | #include "dvb-pll.h" |
40 | #include "mt352.h" | 40 | |
41 | #include "mt352_priv.h" | 41 | #if CONFIG_DVB_MT352 |
42 | #if HAVE_CX22702 | 42 | # include "mt352.h" |
43 | # include "mt352_priv.h" | ||
44 | #endif | ||
45 | #if CONFIG_DVB_CX22702 | ||
43 | # include "cx22702.h" | 46 | # include "cx22702.h" |
44 | #endif | 47 | #endif |
45 | #if HAVE_OR51132 | 48 | #if CONFIG_DVB_OR51132 |
46 | # include "or51132.h" | 49 | # include "or51132.h" |
47 | #endif | 50 | #endif |
48 | #if HAVE_LGDT3302 | 51 | #if CONFIG_DVB_LGDT3302 |
49 | # include "lgdt3302.h" | 52 | # include "lgdt3302.h" |
50 | #endif | 53 | #endif |
51 | 54 | ||
@@ -104,6 +107,7 @@ static struct videobuf_queue_ops dvb_qops = { | |||
104 | 107 | ||
105 | /* ------------------------------------------------------------------ */ | 108 | /* ------------------------------------------------------------------ */ |
106 | 109 | ||
110 | #if CONFIG_DVB_MT352 | ||
107 | static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe) | 111 | static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe) |
108 | { | 112 | { |
109 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; | 113 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; |
@@ -171,8 +175,9 @@ static struct mt352_config dntv_live_dvbt_config = { | |||
171 | .demod_init = dntv_live_dvbt_demod_init, | 175 | .demod_init = dntv_live_dvbt_demod_init, |
172 | .pll_set = mt352_pll_set, | 176 | .pll_set = mt352_pll_set, |
173 | }; | 177 | }; |
178 | #endif | ||
174 | 179 | ||
175 | #if HAVE_CX22702 | 180 | #if CONFIG_DVB_CX22702 |
176 | static struct cx22702_config connexant_refboard_config = { | 181 | static struct cx22702_config connexant_refboard_config = { |
177 | .demod_address = 0x43, | 182 | .demod_address = 0x43, |
178 | .pll_address = 0x60, | 183 | .pll_address = 0x60, |
@@ -186,7 +191,7 @@ static struct cx22702_config hauppauge_novat_config = { | |||
186 | }; | 191 | }; |
187 | #endif | 192 | #endif |
188 | 193 | ||
189 | #if HAVE_OR51132 | 194 | #if CONFIG_DVB_OR51132 |
190 | static int or51132_set_ts_param(struct dvb_frontend* fe, | 195 | static int or51132_set_ts_param(struct dvb_frontend* fe, |
191 | int is_punctured) | 196 | int is_punctured) |
192 | { | 197 | { |
@@ -203,7 +208,7 @@ static struct or51132_config pchdtv_hd3000 = { | |||
203 | }; | 208 | }; |
204 | #endif | 209 | #endif |
205 | 210 | ||
206 | #if HAVE_LGDT3302 | 211 | #if CONFIG_DVB_LGDT3302 |
207 | static int lgdt3302_set_ts_param(struct dvb_frontend* fe, int is_punctured) | 212 | static int lgdt3302_set_ts_param(struct dvb_frontend* fe, int is_punctured) |
208 | { | 213 | { |
209 | struct cx8802_dev *dev= fe->dvb->priv; | 214 | struct cx8802_dev *dev= fe->dvb->priv; |
@@ -237,7 +242,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
237 | 242 | ||
238 | /* init frontend */ | 243 | /* init frontend */ |
239 | switch (dev->core->board) { | 244 | switch (dev->core->board) { |
240 | #if HAVE_CX22702 | 245 | #if CONFIG_DVB_CX22702 |
241 | case CX88_BOARD_HAUPPAUGE_DVB_T1: | 246 | case CX88_BOARD_HAUPPAUGE_DVB_T1: |
242 | dev->dvb.frontend = cx22702_attach(&hauppauge_novat_config, | 247 | dev->dvb.frontend = cx22702_attach(&hauppauge_novat_config, |
243 | &dev->core->i2c_adap); | 248 | &dev->core->i2c_adap); |
@@ -248,6 +253,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
248 | &dev->core->i2c_adap); | 253 | &dev->core->i2c_adap); |
249 | break; | 254 | break; |
250 | #endif | 255 | #endif |
256 | #if CONFIG_DVB_MT352 | ||
251 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: | 257 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: |
252 | dev->core->pll_addr = 0x61; | 258 | dev->core->pll_addr = 0x61; |
253 | dev->core->pll_desc = &dvb_pll_lg_z201; | 259 | dev->core->pll_desc = &dvb_pll_lg_z201; |
@@ -268,13 +274,14 @@ static int dvb_register(struct cx8802_dev *dev) | |||
268 | dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_config, | 274 | dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_config, |
269 | &dev->core->i2c_adap); | 275 | &dev->core->i2c_adap); |
270 | break; | 276 | break; |
271 | #if HAVE_OR51132 | 277 | #endif |
278 | #if CONFIG_DVB_OR51132 | ||
272 | case CX88_BOARD_PCHDTV_HD3000: | 279 | case CX88_BOARD_PCHDTV_HD3000: |
273 | dev->dvb.frontend = or51132_attach(&pchdtv_hd3000, | 280 | dev->dvb.frontend = or51132_attach(&pchdtv_hd3000, |
274 | &dev->core->i2c_adap); | 281 | &dev->core->i2c_adap); |
275 | break; | 282 | break; |
276 | #endif | 283 | #endif |
277 | #if HAVE_LGDT3302 | 284 | #if CONFIG_DVB_LGDT3302 |
278 | case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: | 285 | case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: |
279 | dev->ts_gen_cntrl = 0x08; | 286 | dev->ts_gen_cntrl = 0x08; |
280 | { | 287 | { |
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c index b5342234b305..8403c4e95050 100644 --- a/drivers/media/video/cx88/cx88-i2c.c +++ b/drivers/media/video/cx88/cx88-i2c.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: cx88-i2c.c,v 1.24 2005/06/17 18:46:23 mkrufky Exp $ | 2 | $Id: cx88-i2c.c,v 1.28 2005/07/05 17:37:35 nsh Exp $ |
3 | 3 | ||
4 | cx88-i2c.c -- all the i2c code is here | 4 | cx88-i2c.c -- all the i2c code is here |
5 | 5 | ||
@@ -91,25 +91,32 @@ static int cx8800_bit_getsda(void *data) | |||
91 | 91 | ||
92 | static int attach_inform(struct i2c_client *client) | 92 | static int attach_inform(struct i2c_client *client) |
93 | { | 93 | { |
94 | struct tuner_addr tun_addr; | 94 | struct tuner_setup tun_setup; |
95 | struct cx88_core *core = i2c_get_adapdata(client->adapter); | 95 | struct cx88_core *core = i2c_get_adapdata(client->adapter); |
96 | 96 | ||
97 | dprintk(1, "i2c attach [addr=0x%x,client=%s]\n", | 97 | dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n", |
98 | client->addr, i2c_clientname(client)); | 98 | client->driver->name,client->addr,i2c_clientname(client)); |
99 | if (!client->driver->command) | 99 | if (!client->driver->command) |
100 | return 0; | 100 | return 0; |
101 | 101 | ||
102 | if (core->radio_type != UNSET) { | 102 | if (core->radio_type != UNSET) { |
103 | tun_addr.v4l2_tuner = V4L2_TUNER_RADIO; | 103 | if ((core->radio_addr==ADDR_UNSET)||(core->radio_addr==client->addr)) { |
104 | tun_addr.type = core->radio_type; | 104 | tun_setup.mode_mask = T_RADIO; |
105 | tun_addr.addr = core->radio_addr; | 105 | tun_setup.type = core->radio_type; |
106 | client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr); | 106 | tun_setup.addr = core->radio_addr; |
107 | |||
108 | client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup); | ||
109 | } | ||
107 | } | 110 | } |
108 | if (core->tuner_type != UNSET) { | 111 | if (core->tuner_type != UNSET) { |
109 | tun_addr.v4l2_tuner = V4L2_TUNER_ANALOG_TV; | 112 | if ((core->tuner_addr==ADDR_UNSET)||(core->tuner_addr==client->addr)) { |
110 | tun_addr.type = core->tuner_type; | 113 | |
111 | tun_addr.addr = core->tuner_addr; | 114 | tun_setup.mode_mask = T_ANALOG_TV; |
112 | client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr); | 115 | tun_setup.type = core->tuner_type; |
116 | tun_setup.addr = core->tuner_addr; | ||
117 | |||
118 | client->driver->command (client,TUNER_SET_TYPE_ADDR, &tun_setup); | ||
119 | } | ||
113 | } | 120 | } |
114 | 121 | ||
115 | if (core->tda9887_conf) | 122 | if (core->tda9887_conf) |
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index bdc26e75ab5f..214887798192 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-input.c,v 1.13 2005/06/13 16:07:46 nsh Exp $ | 2 | * $Id: cx88-input.c,v 1.15 2005/07/07 13:58:38 mchehab Exp $ |
3 | * | 3 | * |
4 | * Device driver for GPIO attached remote control interfaces | 4 | * Device driver for GPIO attached remote control interfaces |
5 | * on Conexant 2388x based TV/DVB cards. | 5 | * on Conexant 2388x based TV/DVB cards. |
@@ -38,199 +38,206 @@ | |||
38 | 38 | ||
39 | /* DigitalNow DNTV Live DVB-T Remote */ | 39 | /* DigitalNow DNTV Live DVB-T Remote */ |
40 | static IR_KEYTAB_TYPE ir_codes_dntv_live_dvb_t[IR_KEYTAB_SIZE] = { | 40 | static IR_KEYTAB_TYPE ir_codes_dntv_live_dvb_t[IR_KEYTAB_SIZE] = { |
41 | [ 0x00 ] = KEY_ESC, // 'go up a level?' | 41 | [0x00] = KEY_ESC, /* 'go up a level?' */ |
42 | [ 0x01 ] = KEY_KP1, // '1' | 42 | /* Keys 0 to 9 */ |
43 | [ 0x02 ] = KEY_KP2, // '2' | 43 | [0x0a] = KEY_KP0, |
44 | [ 0x03 ] = KEY_KP3, // '3' | 44 | [0x01] = KEY_KP1, |
45 | [ 0x04 ] = KEY_KP4, // '4' | 45 | [0x02] = KEY_KP2, |
46 | [ 0x05 ] = KEY_KP5, // '5' | 46 | [0x03] = KEY_KP3, |
47 | [ 0x06 ] = KEY_KP6, // '6' | 47 | [0x04] = KEY_KP4, |
48 | [ 0x07 ] = KEY_KP7, // '7' | 48 | [0x05] = KEY_KP5, |
49 | [ 0x08 ] = KEY_KP8, // '8' | 49 | [0x06] = KEY_KP6, |
50 | [ 0x09 ] = KEY_KP9, // '9' | 50 | [0x07] = KEY_KP7, |
51 | [ 0x0a ] = KEY_KP0, // '0' | 51 | [0x08] = KEY_KP8, |
52 | [ 0x0b ] = KEY_TUNER, // 'tv/fm' | 52 | [0x09] = KEY_KP9, |
53 | [ 0x0c ] = KEY_SEARCH, // 'scan' | 53 | |
54 | [ 0x0d ] = KEY_STOP, // 'stop' | 54 | [0x0b] = KEY_TUNER, /* tv/fm */ |
55 | [ 0x0e ] = KEY_PAUSE, // 'pause' | 55 | [0x0c] = KEY_SEARCH, /* scan */ |
56 | [ 0x0f ] = KEY_LIST, // 'source' | 56 | [0x0d] = KEY_STOP, |
57 | 57 | [0x0e] = KEY_PAUSE, | |
58 | [ 0x10 ] = KEY_MUTE, // 'mute' | 58 | [0x0f] = KEY_LIST, /* source */ |
59 | [ 0x11 ] = KEY_REWIND, // 'backward <<' | 59 | |
60 | [ 0x12 ] = KEY_POWER, // 'power' | 60 | [0x10] = KEY_MUTE, |
61 | [ 0x13 ] = KEY_S, // 'snap' | 61 | [0x11] = KEY_REWIND, /* backward << */ |
62 | [ 0x14 ] = KEY_AUDIO, // 'stereo' | 62 | [0x12] = KEY_POWER, |
63 | [ 0x15 ] = KEY_CLEAR, // 'reset' | 63 | [0x13] = KEY_S, /* snap */ |
64 | [ 0x16 ] = KEY_PLAY, // 'play' | 64 | [0x14] = KEY_AUDIO, /* stereo */ |
65 | [ 0x17 ] = KEY_ENTER, // 'enter' | 65 | [0x15] = KEY_CLEAR, /* reset */ |
66 | [ 0x18 ] = KEY_ZOOM, // 'full screen' | 66 | [0x16] = KEY_PLAY, |
67 | [ 0x19 ] = KEY_FASTFORWARD, // 'forward >>' | 67 | [0x17] = KEY_ENTER, |
68 | [ 0x1a ] = KEY_CHANNELUP, // 'channel +' | 68 | [0x18] = KEY_ZOOM, /* full screen */ |
69 | [ 0x1b ] = KEY_VOLUMEUP, // 'volume +' | 69 | [0x19] = KEY_FASTFORWARD, /* forward >> */ |
70 | [ 0x1c ] = KEY_INFO, // 'preview' | 70 | [0x1a] = KEY_CHANNELUP, |
71 | [ 0x1d ] = KEY_RECORD, // 'record' | 71 | [0x1b] = KEY_VOLUMEUP, |
72 | [ 0x1e ] = KEY_CHANNELDOWN, // 'channel -' | 72 | [0x1c] = KEY_INFO, /* preview */ |
73 | [ 0x1f ] = KEY_VOLUMEDOWN, // 'volume -' | 73 | [0x1d] = KEY_RECORD, /* record */ |
74 | [0x1e] = KEY_CHANNELDOWN, | ||
75 | [0x1f] = KEY_VOLUMEDOWN, | ||
74 | }; | 76 | }; |
75 | 77 | ||
76 | /* ---------------------------------------------------------------------- */ | 78 | /* ---------------------------------------------------------------------- */ |
77 | 79 | ||
78 | /* IO-DATA BCTV7E Remote */ | 80 | /* IO-DATA BCTV7E Remote */ |
79 | static IR_KEYTAB_TYPE ir_codes_iodata_bctv7e[IR_KEYTAB_SIZE] = { | 81 | static IR_KEYTAB_TYPE ir_codes_iodata_bctv7e[IR_KEYTAB_SIZE] = { |
80 | [ 0x40 ] = KEY_TV, // TV | 82 | [0x40] = KEY_TV, |
81 | [ 0x20 ] = KEY_RADIO, // FM | 83 | [0x20] = KEY_RADIO, /* FM */ |
82 | [ 0x60 ] = KEY_EPG, // EPG | 84 | [0x60] = KEY_EPG, |
83 | [ 0x00 ] = KEY_POWER, // power | 85 | [0x00] = KEY_POWER, |
84 | 86 | ||
85 | [ 0x50 ] = KEY_KP1, // 1 | 87 | /* Keys 0 to 9 */ |
86 | [ 0x30 ] = KEY_KP2, // 2 | 88 | [0x44] = KEY_KP0, /* 10 */ |
87 | [ 0x70 ] = KEY_KP3, // 3 | 89 | [0x50] = KEY_KP1, |
88 | [ 0x10 ] = KEY_L, // Live | 90 | [0x30] = KEY_KP2, |
89 | 91 | [0x70] = KEY_KP3, | |
90 | [ 0x48 ] = KEY_KP4, // 4 | 92 | [0x48] = KEY_KP4, |
91 | [ 0x28 ] = KEY_KP5, // 5 | 93 | [0x28] = KEY_KP5, |
92 | [ 0x68 ] = KEY_KP6, // 6 | 94 | [0x68] = KEY_KP6, |
93 | [ 0x08 ] = KEY_T, // Time Shift | 95 | [0x58] = KEY_KP7, |
94 | 96 | [0x38] = KEY_KP8, | |
95 | [ 0x58 ] = KEY_KP7, // 7 | 97 | [0x78] = KEY_KP9, |
96 | [ 0x38 ] = KEY_KP8, // 8 | 98 | |
97 | [ 0x78 ] = KEY_KP9, // 9 | 99 | [0x10] = KEY_L, /* Live */ |
98 | [ 0x18 ] = KEY_PLAYPAUSE, // Play | 100 | [0x08] = KEY_T, /* Time Shift */ |
99 | 101 | ||
100 | [ 0x44 ] = KEY_KP0, // 10 | 102 | [0x18] = KEY_PLAYPAUSE, /* Play */ |
101 | [ 0x24 ] = KEY_ENTER, // 11 | 103 | |
102 | [ 0x64 ] = KEY_ESC, // 12 | 104 | [0x24] = KEY_ENTER, /* 11 */ |
103 | [ 0x04 ] = KEY_M, // Multi | 105 | [0x64] = KEY_ESC, /* 12 */ |
104 | 106 | [0x04] = KEY_M, /* Multi */ | |
105 | [ 0x54 ] = KEY_VIDEO, // VIDEO | 107 | |
106 | [ 0x34 ] = KEY_CHANNELUP, // channel + | 108 | [0x54] = KEY_VIDEO, |
107 | [ 0x74 ] = KEY_VOLUMEUP, // volume + | 109 | [0x34] = KEY_CHANNELUP, |
108 | [ 0x14 ] = KEY_MUTE, // Mute | 110 | [0x74] = KEY_VOLUMEUP, |
109 | 111 | [0x14] = KEY_MUTE, | |
110 | [ 0x4c ] = KEY_S, // SVIDEO | 112 | |
111 | [ 0x2c ] = KEY_CHANNELDOWN, // channel - | 113 | [0x4c] = KEY_S, /* SVIDEO */ |
112 | [ 0x6c ] = KEY_VOLUMEDOWN, // volume - | 114 | [0x2c] = KEY_CHANNELDOWN, |
113 | [ 0x0c ] = KEY_ZOOM, // Zoom | 115 | [0x6c] = KEY_VOLUMEDOWN, |
114 | 116 | [0x0c] = KEY_ZOOM, | |
115 | [ 0x5c ] = KEY_PAUSE, // pause | 117 | |
116 | [ 0x3c ] = KEY_C, // || (red) | 118 | [0x5c] = KEY_PAUSE, |
117 | [ 0x7c ] = KEY_RECORD, // recording | 119 | [0x3c] = KEY_C, /* || (red) */ |
118 | [ 0x1c ] = KEY_STOP, // stop | 120 | [0x7c] = KEY_RECORD, /* recording */ |
119 | 121 | [0x1c] = KEY_STOP, | |
120 | [ 0x41 ] = KEY_REWIND, // backward << | 122 | |
121 | [ 0x21 ] = KEY_PLAY, // play | 123 | [0x41] = KEY_REWIND, /* backward << */ |
122 | [ 0x61 ] = KEY_FASTFORWARD, // forward >> | 124 | [0x21] = KEY_PLAY, |
123 | [ 0x01 ] = KEY_NEXT, // skip >| | 125 | [0x61] = KEY_FASTFORWARD, /* forward >> */ |
126 | [0x01] = KEY_NEXT, /* skip >| */ | ||
124 | }; | 127 | }; |
125 | 128 | ||
126 | /* ---------------------------------------------------------------------- */ | 129 | /* ---------------------------------------------------------------------- */ |
127 | 130 | ||
128 | /* ADS Tech Instant TV DVB-T PCI Remote */ | 131 | /* ADS Tech Instant TV DVB-T PCI Remote */ |
129 | static IR_KEYTAB_TYPE ir_codes_adstech_dvb_t_pci[IR_KEYTAB_SIZE] = { | 132 | static IR_KEYTAB_TYPE ir_codes_adstech_dvb_t_pci[IR_KEYTAB_SIZE] = { |
130 | [ 0x5b ] = KEY_POWER, | 133 | /* Keys 0 to 9 */ |
131 | [ 0x5f ] = KEY_MUTE, | 134 | [0x4d] = KEY_0, |
132 | [ 0x57 ] = KEY_1, | 135 | [0x57] = KEY_1, |
133 | [ 0x4f ] = KEY_2, | 136 | [0x4f] = KEY_2, |
134 | [ 0x53 ] = KEY_3, | 137 | [0x53] = KEY_3, |
135 | [ 0x56 ] = KEY_4, | 138 | [0x56] = KEY_4, |
136 | [ 0x4e ] = KEY_5, | 139 | [0x4e] = KEY_5, |
137 | [ 0x5e ] = KEY_6, | 140 | [0x5e] = KEY_6, |
138 | [ 0x54 ] = KEY_7, | 141 | [0x54] = KEY_7, |
139 | [ 0x4c ] = KEY_8, | 142 | [0x4c] = KEY_8, |
140 | [ 0x5c ] = KEY_9, | 143 | [0x5c] = KEY_9, |
141 | [ 0x4d ] = KEY_0, | 144 | |
142 | [ 0x55 ] = KEY_GOTO, | 145 | [0x5b] = KEY_POWER, |
143 | [ 0x5d ] = KEY_SEARCH, | 146 | [0x5f] = KEY_MUTE, |
144 | [ 0x17 ] = KEY_EPG, // Guide | 147 | [0x55] = KEY_GOTO, |
145 | [ 0x1f ] = KEY_MENU, | 148 | [0x5d] = KEY_SEARCH, |
146 | [ 0x0f ] = KEY_UP, | 149 | [0x17] = KEY_EPG, /* Guide */ |
147 | [ 0x46 ] = KEY_DOWN, | 150 | [0x1f] = KEY_MENU, |
148 | [ 0x16 ] = KEY_LEFT, | 151 | [0x0f] = KEY_UP, |
149 | [ 0x1e ] = KEY_RIGHT, | 152 | [0x46] = KEY_DOWN, |
150 | [ 0x0e ] = KEY_SELECT, // Enter | 153 | [0x16] = KEY_LEFT, |
151 | [ 0x5a ] = KEY_INFO, | 154 | [0x1e] = KEY_RIGHT, |
152 | [ 0x52 ] = KEY_EXIT, | 155 | [0x0e] = KEY_SELECT, /* Enter */ |
153 | [ 0x59 ] = KEY_PREVIOUS, | 156 | [0x5a] = KEY_INFO, |
154 | [ 0x51 ] = KEY_NEXT, | 157 | [0x52] = KEY_EXIT, |
155 | [ 0x58 ] = KEY_REWIND, | 158 | [0x59] = KEY_PREVIOUS, |
156 | [ 0x50 ] = KEY_FORWARD, | 159 | [0x51] = KEY_NEXT, |
157 | [ 0x44 ] = KEY_PLAYPAUSE, | 160 | [0x58] = KEY_REWIND, |
158 | [ 0x07 ] = KEY_STOP, | 161 | [0x50] = KEY_FORWARD, |
159 | [ 0x1b ] = KEY_RECORD, | 162 | [0x44] = KEY_PLAYPAUSE, |
160 | [ 0x13 ] = KEY_TUNER, // Live | 163 | [0x07] = KEY_STOP, |
161 | [ 0x0a ] = KEY_A, | 164 | [0x1b] = KEY_RECORD, |
162 | [ 0x12 ] = KEY_B, | 165 | [0x13] = KEY_TUNER, /* Live */ |
163 | [ 0x03 ] = KEY_PROG1, // 1 | 166 | [0x0a] = KEY_A, |
164 | [ 0x01 ] = KEY_PROG2, // 2 | 167 | [0x12] = KEY_B, |
165 | [ 0x00 ] = KEY_PROG3, // 3 | 168 | [0x03] = KEY_PROG1, /* 1 */ |
166 | [ 0x06 ] = KEY_DVD, | 169 | [0x01] = KEY_PROG2, /* 2 */ |
167 | [ 0x48 ] = KEY_AUX, // Photo | 170 | [0x00] = KEY_PROG3, /* 3 */ |
168 | [ 0x40 ] = KEY_VIDEO, | 171 | [0x06] = KEY_DVD, |
169 | [ 0x19 ] = KEY_AUDIO, // Music | 172 | [0x48] = KEY_AUX, /* Photo */ |
170 | [ 0x0b ] = KEY_CHANNELUP, | 173 | [0x40] = KEY_VIDEO, |
171 | [ 0x08 ] = KEY_CHANNELDOWN, | 174 | [0x19] = KEY_AUDIO, /* Music */ |
172 | [ 0x15 ] = KEY_VOLUMEUP, | 175 | [0x0b] = KEY_CHANNELUP, |
173 | [ 0x1c ] = KEY_VOLUMEDOWN, | 176 | [0x08] = KEY_CHANNELDOWN, |
177 | [0x15] = KEY_VOLUMEUP, | ||
178 | [0x1c] = KEY_VOLUMEDOWN, | ||
174 | }; | 179 | }; |
175 | 180 | ||
176 | /* ---------------------------------------------------------------------- */ | 181 | /* ---------------------------------------------------------------------- */ |
177 | 182 | ||
178 | /* MSI TV@nywhere remote */ | 183 | /* MSI TV@nywhere remote */ |
179 | static IR_KEYTAB_TYPE ir_codes_msi_tvanywhere[IR_KEYTAB_SIZE] = { | 184 | static IR_KEYTAB_TYPE ir_codes_msi_tvanywhere[IR_KEYTAB_SIZE] = { |
180 | [ 0x00 ] = KEY_0, /* '0' */ | 185 | /* Keys 0 to 9 */ |
181 | [ 0x01 ] = KEY_1, /* '1' */ | 186 | [0x00] = KEY_0, |
182 | [ 0x02 ] = KEY_2, /* '2' */ | 187 | [0x01] = KEY_1, |
183 | [ 0x03 ] = KEY_3, /* '3' */ | 188 | [0x02] = KEY_2, |
184 | [ 0x04 ] = KEY_4, /* '4' */ | 189 | [0x03] = KEY_3, |
185 | [ 0x05 ] = KEY_5, /* '5' */ | 190 | [0x04] = KEY_4, |
186 | [ 0x06 ] = KEY_6, /* '6' */ | 191 | [0x05] = KEY_5, |
187 | [ 0x07 ] = KEY_7, /* '7' */ | 192 | [0x06] = KEY_6, |
188 | [ 0x08 ] = KEY_8, /* '8' */ | 193 | [0x07] = KEY_7, |
189 | [ 0x09 ] = KEY_9, /* '9' */ | 194 | [0x08] = KEY_8, |
190 | [ 0x0c ] = KEY_MUTE, /* 'Mute' */ | 195 | [0x09] = KEY_9, |
191 | [ 0x0f ] = KEY_SCREEN, /* 'Full Screen' */ | 196 | |
192 | [ 0x10 ] = KEY_F, /* 'Funtion' */ | 197 | [0x0c] = KEY_MUTE, |
193 | [ 0x11 ] = KEY_T, /* 'Time shift' */ | 198 | [0x0f] = KEY_SCREEN, /* Full Screen */ |
194 | [ 0x12 ] = KEY_POWER, /* 'Power' */ | 199 | [0x10] = KEY_F, /* Funtion */ |
195 | [ 0x13 ] = KEY_MEDIA, /* 'MTS' */ | 200 | [0x11] = KEY_T, /* Time shift */ |
196 | [ 0x14 ] = KEY_SLOW, /* 'Slow' */ | 201 | [0x12] = KEY_POWER, |
197 | [ 0x16 ] = KEY_REWIND, /* 'backward <<' */ | 202 | [0x13] = KEY_MEDIA, /* MTS */ |
198 | [ 0x17 ] = KEY_ENTER, /* 'Return' */ | 203 | [0x14] = KEY_SLOW, |
199 | [ 0x18 ] = KEY_FASTFORWARD, /* 'forward >>' */ | 204 | [0x16] = KEY_REWIND, /* backward << */ |
200 | [ 0x1a ] = KEY_CHANNELUP, /* 'Channel+' */ | 205 | [0x17] = KEY_ENTER, /* Return */ |
201 | [ 0x1b ] = KEY_VOLUMEUP, /* 'Volume+' */ | 206 | [0x18] = KEY_FASTFORWARD, /* forward >> */ |
202 | [ 0x1e ] = KEY_CHANNELDOWN, /* 'Channel-' */ | 207 | [0x1a] = KEY_CHANNELUP, |
203 | [ 0x1f ] = KEY_VOLUMEDOWN, /* 'Volume-' */ | 208 | [0x1b] = KEY_VOLUMEUP, |
209 | [0x1e] = KEY_CHANNELDOWN, | ||
210 | [0x1f] = KEY_VOLUMEDOWN, | ||
204 | }; | 211 | }; |
205 | 212 | ||
206 | /* ---------------------------------------------------------------------- */ | 213 | /* ---------------------------------------------------------------------- */ |
207 | 214 | ||
208 | struct cx88_IR { | 215 | struct cx88_IR { |
209 | struct cx88_core *core; | 216 | struct cx88_core *core; |
210 | struct input_dev input; | 217 | struct input_dev input; |
211 | struct ir_input_state ir; | 218 | struct ir_input_state ir; |
212 | char name[32]; | 219 | char name[32]; |
213 | char phys[32]; | 220 | char phys[32]; |
214 | 221 | ||
215 | /* sample from gpio pin 16 */ | 222 | /* sample from gpio pin 16 */ |
216 | int sampling; | 223 | int sampling; |
217 | u32 samples[16]; | 224 | u32 samples[16]; |
218 | int scount; | 225 | int scount; |
219 | unsigned long release; | 226 | unsigned long release; |
220 | 227 | ||
221 | /* poll external decoder */ | 228 | /* poll external decoder */ |
222 | int polling; | 229 | int polling; |
223 | struct work_struct work; | 230 | struct work_struct work; |
224 | struct timer_list timer; | 231 | struct timer_list timer; |
225 | u32 gpio_addr; | 232 | u32 gpio_addr; |
226 | u32 last_gpio; | 233 | u32 last_gpio; |
227 | u32 mask_keycode; | 234 | u32 mask_keycode; |
228 | u32 mask_keydown; | 235 | u32 mask_keydown; |
229 | u32 mask_keyup; | 236 | u32 mask_keyup; |
230 | }; | 237 | }; |
231 | 238 | ||
232 | static int ir_debug = 0; | 239 | static int ir_debug = 0; |
233 | module_param(ir_debug, int, 0644); /* debug level [IR] */ | 240 | module_param(ir_debug, int, 0644); /* debug level [IR] */ |
234 | MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); | 241 | MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); |
235 | 242 | ||
236 | #define ir_dprintk(fmt, arg...) if (ir_debug) \ | 243 | #define ir_dprintk(fmt, arg...) if (ir_debug) \ |
@@ -254,37 +261,37 @@ static void cx88_ir_handle_key(struct cx88_IR *ir) | |||
254 | /* extract data */ | 261 | /* extract data */ |
255 | data = ir_extract_bits(gpio, ir->mask_keycode); | 262 | data = ir_extract_bits(gpio, ir->mask_keycode); |
256 | ir_dprintk("irq gpio=0x%x code=%d | %s%s%s\n", | 263 | ir_dprintk("irq gpio=0x%x code=%d | %s%s%s\n", |
257 | gpio, data, | 264 | gpio, data, |
258 | ir->polling ? "poll" : "irq", | 265 | ir->polling ? "poll" : "irq", |
259 | (gpio & ir->mask_keydown) ? " down" : "", | 266 | (gpio & ir->mask_keydown) ? " down" : "", |
260 | (gpio & ir->mask_keyup) ? " up" : ""); | 267 | (gpio & ir->mask_keyup) ? " up" : ""); |
261 | 268 | ||
262 | if (ir->mask_keydown) { | 269 | if (ir->mask_keydown) { |
263 | /* bit set on keydown */ | 270 | /* bit set on keydown */ |
264 | if (gpio & ir->mask_keydown) { | 271 | if (gpio & ir->mask_keydown) { |
265 | ir_input_keydown(&ir->input,&ir->ir,data,data); | 272 | ir_input_keydown(&ir->input, &ir->ir, data, data); |
266 | } else { | 273 | } else { |
267 | ir_input_nokey(&ir->input,&ir->ir); | 274 | ir_input_nokey(&ir->input, &ir->ir); |
268 | } | 275 | } |
269 | 276 | ||
270 | } else if (ir->mask_keyup) { | 277 | } else if (ir->mask_keyup) { |
271 | /* bit cleared on keydown */ | 278 | /* bit cleared on keydown */ |
272 | if (0 == (gpio & ir->mask_keyup)) { | 279 | if (0 == (gpio & ir->mask_keyup)) { |
273 | ir_input_keydown(&ir->input,&ir->ir,data,data); | 280 | ir_input_keydown(&ir->input, &ir->ir, data, data); |
274 | } else { | 281 | } else { |
275 | ir_input_nokey(&ir->input,&ir->ir); | 282 | ir_input_nokey(&ir->input, &ir->ir); |
276 | } | 283 | } |
277 | 284 | ||
278 | } else { | 285 | } else { |
279 | /* can't distinguish keydown/up :-/ */ | 286 | /* can't distinguish keydown/up :-/ */ |
280 | ir_input_keydown(&ir->input,&ir->ir,data,data); | 287 | ir_input_keydown(&ir->input, &ir->ir, data, data); |
281 | ir_input_nokey(&ir->input,&ir->ir); | 288 | ir_input_nokey(&ir->input, &ir->ir); |
282 | } | 289 | } |
283 | } | 290 | } |
284 | 291 | ||
285 | static void ir_timer(unsigned long data) | 292 | static void ir_timer(unsigned long data) |
286 | { | 293 | { |
287 | struct cx88_IR *ir = (struct cx88_IR*)data; | 294 | struct cx88_IR *ir = (struct cx88_IR *)data; |
288 | 295 | ||
289 | schedule_work(&ir->work); | 296 | schedule_work(&ir->work); |
290 | } | 297 | } |
@@ -307,62 +314,62 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
307 | IR_KEYTAB_TYPE *ir_codes = NULL; | 314 | IR_KEYTAB_TYPE *ir_codes = NULL; |
308 | int ir_type = IR_TYPE_OTHER; | 315 | int ir_type = IR_TYPE_OTHER; |
309 | 316 | ||
310 | ir = kmalloc(sizeof(*ir),GFP_KERNEL); | 317 | ir = kmalloc(sizeof(*ir), GFP_KERNEL); |
311 | if (NULL == ir) | 318 | if (NULL == ir) |
312 | return -ENOMEM; | 319 | return -ENOMEM; |
313 | memset(ir,0,sizeof(*ir)); | 320 | memset(ir, 0, sizeof(*ir)); |
314 | 321 | ||
315 | /* detect & configure */ | 322 | /* detect & configure */ |
316 | switch (core->board) { | 323 | switch (core->board) { |
317 | case CX88_BOARD_DNTV_LIVE_DVB_T: | 324 | case CX88_BOARD_DNTV_LIVE_DVB_T: |
318 | case CX88_BOARD_KWORLD_DVB_T: | 325 | case CX88_BOARD_KWORLD_DVB_T: |
319 | ir_codes = ir_codes_dntv_live_dvb_t; | 326 | ir_codes = ir_codes_dntv_live_dvb_t; |
320 | ir->gpio_addr = MO_GP1_IO; | 327 | ir->gpio_addr = MO_GP1_IO; |
321 | ir->mask_keycode = 0x1f; | 328 | ir->mask_keycode = 0x1f; |
322 | ir->mask_keyup = 0x60; | 329 | ir->mask_keyup = 0x60; |
323 | ir->polling = 50; // ms | 330 | ir->polling = 50; /* ms */ |
324 | break; | 331 | break; |
325 | case CX88_BOARD_HAUPPAUGE: | 332 | case CX88_BOARD_HAUPPAUGE: |
326 | case CX88_BOARD_HAUPPAUGE_DVB_T1: | 333 | case CX88_BOARD_HAUPPAUGE_DVB_T1: |
327 | ir_codes = ir_codes_hauppauge_new; | 334 | ir_codes = ir_codes_hauppauge_new; |
328 | ir_type = IR_TYPE_RC5; | 335 | ir_type = IR_TYPE_RC5; |
329 | ir->sampling = 1; | 336 | ir->sampling = 1; |
330 | break; | 337 | break; |
331 | case CX88_BOARD_WINFAST2000XP_EXPERT: | 338 | case CX88_BOARD_WINFAST2000XP_EXPERT: |
332 | ir_codes = ir_codes_winfast; | 339 | ir_codes = ir_codes_winfast; |
333 | ir->gpio_addr = MO_GP0_IO; | 340 | ir->gpio_addr = MO_GP0_IO; |
334 | ir->mask_keycode = 0x8f8; | 341 | ir->mask_keycode = 0x8f8; |
335 | ir->mask_keyup = 0x100; | 342 | ir->mask_keyup = 0x100; |
336 | ir->polling = 1; // ms | 343 | ir->polling = 1; /* ms */ |
337 | break; | 344 | break; |
338 | case CX88_BOARD_IODATA_GVBCTV7E: | 345 | case CX88_BOARD_IODATA_GVBCTV7E: |
339 | ir_codes = ir_codes_iodata_bctv7e; | 346 | ir_codes = ir_codes_iodata_bctv7e; |
340 | ir->gpio_addr = MO_GP0_IO; | 347 | ir->gpio_addr = MO_GP0_IO; |
341 | ir->mask_keycode = 0xfd; | 348 | ir->mask_keycode = 0xfd; |
342 | ir->mask_keydown = 0x02; | 349 | ir->mask_keydown = 0x02; |
343 | ir->polling = 5; // ms | 350 | ir->polling = 5; /* ms */ |
344 | break; | 351 | break; |
345 | case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO: | 352 | case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO: |
346 | ir_codes = ir_codes_pixelview; | 353 | ir_codes = ir_codes_pixelview; |
347 | ir->gpio_addr = MO_GP1_IO; | 354 | ir->gpio_addr = MO_GP1_IO; |
348 | ir->mask_keycode = 0x1f; | 355 | ir->mask_keycode = 0x1f; |
349 | ir->mask_keyup = 0x80; | 356 | ir->mask_keyup = 0x80; |
350 | ir->polling = 1; // ms | 357 | ir->polling = 1; /* ms */ |
351 | break; | 358 | break; |
352 | case CX88_BOARD_ADSTECH_DVB_T_PCI: | 359 | case CX88_BOARD_ADSTECH_DVB_T_PCI: |
353 | ir_codes = ir_codes_adstech_dvb_t_pci; | 360 | ir_codes = ir_codes_adstech_dvb_t_pci; |
354 | ir->gpio_addr = MO_GP1_IO; | 361 | ir->gpio_addr = MO_GP1_IO; |
355 | ir->mask_keycode = 0xbf; | 362 | ir->mask_keycode = 0xbf; |
356 | ir->mask_keyup = 0x40; | 363 | ir->mask_keyup = 0x40; |
357 | ir->polling = 50; // ms | 364 | ir->polling = 50; /* ms */ |
365 | break; | ||
366 | case CX88_BOARD_MSI_TVANYWHERE_MASTER: | ||
367 | ir_codes = ir_codes_msi_tvanywhere; | ||
368 | ir->gpio_addr = MO_GP1_IO; | ||
369 | ir->mask_keycode = 0x1f; | ||
370 | ir->mask_keyup = 0x40; | ||
371 | ir->polling = 1; /* ms */ | ||
358 | break; | 372 | break; |
359 | case CX88_BOARD_MSI_TVANYWHERE_MASTER: | ||
360 | ir_codes = ir_codes_msi_tvanywhere; | ||
361 | ir->gpio_addr = MO_GP1_IO; | ||
362 | ir->mask_keycode = 0x1f; | ||
363 | ir->mask_keyup = 0x40; | ||
364 | ir->polling = 1; | ||
365 | break; | ||
366 | } | 373 | } |
367 | 374 | ||
368 | if (NULL == ir_codes) { | 375 | if (NULL == ir_codes) { |
@@ -373,8 +380,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
373 | /* init input device */ | 380 | /* init input device */ |
374 | snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", | 381 | snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", |
375 | cx88_boards[core->board].name); | 382 | cx88_boards[core->board].name); |
376 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", | 383 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci)); |
377 | pci_name(pci)); | ||
378 | 384 | ||
379 | ir_input_init(&ir->input, &ir->ir, ir_type, ir_codes); | 385 | ir_input_init(&ir->input, &ir->ir, ir_type, ir_codes); |
380 | ir->input.name = ir->name; | 386 | ir->input.name = ir->name; |
@@ -382,10 +388,10 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
382 | ir->input.id.bustype = BUS_PCI; | 388 | ir->input.id.bustype = BUS_PCI; |
383 | ir->input.id.version = 1; | 389 | ir->input.id.version = 1; |
384 | if (pci->subsystem_vendor) { | 390 | if (pci->subsystem_vendor) { |
385 | ir->input.id.vendor = pci->subsystem_vendor; | 391 | ir->input.id.vendor = pci->subsystem_vendor; |
386 | ir->input.id.product = pci->subsystem_device; | 392 | ir->input.id.product = pci->subsystem_device; |
387 | } else { | 393 | } else { |
388 | ir->input.id.vendor = pci->vendor; | 394 | ir->input.id.vendor = pci->vendor; |
389 | ir->input.id.product = pci->device; | 395 | ir->input.id.product = pci->device; |
390 | } | 396 | } |
391 | 397 | ||
@@ -397,13 +403,13 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
397 | INIT_WORK(&ir->work, cx88_ir_work, ir); | 403 | INIT_WORK(&ir->work, cx88_ir_work, ir); |
398 | init_timer(&ir->timer); | 404 | init_timer(&ir->timer); |
399 | ir->timer.function = ir_timer; | 405 | ir->timer.function = ir_timer; |
400 | ir->timer.data = (unsigned long)ir; | 406 | ir->timer.data = (unsigned long)ir; |
401 | schedule_work(&ir->work); | 407 | schedule_work(&ir->work); |
402 | } | 408 | } |
403 | if (ir->sampling) { | 409 | if (ir->sampling) { |
404 | core->pci_irqmask |= (1<<18); // IR_SMP_INT | 410 | core->pci_irqmask |= (1 << 18); /* IR_SMP_INT */ |
405 | cx_write(MO_DDS_IO, 0xa80a80); // 4 kHz sample rate | 411 | cx_write(MO_DDS_IO, 0xa80a80); /* 4 kHz sample rate */ |
406 | cx_write(MO_DDSCFG_IO, 0x5); // enable | 412 | cx_write(MO_DDSCFG_IO, 0x5); /* enable */ |
407 | } | 413 | } |
408 | 414 | ||
409 | /* all done */ | 415 | /* all done */ |
@@ -439,7 +445,7 @@ int cx88_ir_fini(struct cx88_core *core) | |||
439 | void cx88_ir_irq(struct cx88_core *core) | 445 | void cx88_ir_irq(struct cx88_core *core) |
440 | { | 446 | { |
441 | struct cx88_IR *ir = core->ir; | 447 | struct cx88_IR *ir = core->ir; |
442 | u32 samples,rc5; | 448 | u32 samples, rc5; |
443 | int i; | 449 | int i; |
444 | 450 | ||
445 | if (NULL == ir) | 451 | if (NULL == ir) |
@@ -448,7 +454,7 @@ void cx88_ir_irq(struct cx88_core *core) | |||
448 | return; | 454 | return; |
449 | 455 | ||
450 | samples = cx_read(MO_SAMPLE_IO); | 456 | samples = cx_read(MO_SAMPLE_IO); |
451 | if (0 != samples && 0xffffffff != samples) { | 457 | if (0 != samples && 0xffffffff != samples) { |
452 | /* record sample data */ | 458 | /* record sample data */ |
453 | if (ir->scount < ARRAY_SIZE(ir->samples)) | 459 | if (ir->scount < ARRAY_SIZE(ir->samples)) |
454 | ir->samples[ir->scount++] = samples; | 460 | ir->samples[ir->scount++] = samples; |
@@ -456,8 +462,8 @@ void cx88_ir_irq(struct cx88_core *core) | |||
456 | } | 462 | } |
457 | if (!ir->scount) { | 463 | if (!ir->scount) { |
458 | /* nothing to sample */ | 464 | /* nothing to sample */ |
459 | if (ir->ir.keypressed && time_after(jiffies,ir->release)) | 465 | if (ir->ir.keypressed && time_after(jiffies, ir->release)) |
460 | ir_input_nokey(&ir->input,&ir->ir); | 466 | ir_input_nokey(&ir->input, &ir->ir); |
461 | return; | 467 | return; |
462 | } | 468 | } |
463 | 469 | ||
@@ -467,14 +473,14 @@ void cx88_ir_irq(struct cx88_core *core) | |||
467 | for (i = 0; i < ir->scount; i++) | 473 | for (i = 0; i < ir->scount; i++) |
468 | ir->samples[i] = ~ir->samples[i]; | 474 | ir->samples[i] = ~ir->samples[i]; |
469 | if (ir_debug) | 475 | if (ir_debug) |
470 | ir_dump_samples(ir->samples,ir->scount); | 476 | ir_dump_samples(ir->samples, ir->scount); |
471 | 477 | ||
472 | /* decode it */ | 478 | /* decode it */ |
473 | switch (core->board) { | 479 | switch (core->board) { |
474 | case CX88_BOARD_HAUPPAUGE: | 480 | case CX88_BOARD_HAUPPAUGE: |
475 | case CX88_BOARD_HAUPPAUGE_DVB_T1: | 481 | case CX88_BOARD_HAUPPAUGE_DVB_T1: |
476 | rc5 = ir_decode_biphase(ir->samples,ir->scount,5,7); | 482 | rc5 = ir_decode_biphase(ir->samples, ir->scount, 5, 7); |
477 | ir_dprintk("biphase decoded: %x\n",rc5); | 483 | ir_dprintk("biphase decoded: %x\n", rc5); |
478 | if ((rc5 & 0xfffff000) != 0x3000) | 484 | if ((rc5 & 0xfffff000) != 0x3000) |
479 | break; | 485 | break; |
480 | ir_input_keydown(&ir->input, &ir->ir, rc5 & 0x3f, rc5); | 486 | ir_input_keydown(&ir->input, &ir->ir, rc5 & 0x3f, rc5); |
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index 85da6dc8d0e0..fe2767c0ff94 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-mpeg.c,v 1.30 2005/07/05 19:44:40 mkrufky Exp $ | 2 | * $Id: cx88-mpeg.c,v 1.31 2005/07/07 14:17:47 mchehab Exp $ |
3 | * | 3 | * |
4 | * Support for the mpeg transport stream transfers | 4 | * Support for the mpeg transport stream transfers |
5 | * PCI function #2 of the cx2388x. | 5 | * PCI function #2 of the cx2388x. |
@@ -64,7 +64,6 @@ static int cx8802_start_dma(struct cx8802_dev *dev, | |||
64 | /* write TS length to chip */ | 64 | /* write TS length to chip */ |
65 | cx_write(MO_TS_LNGTH, buf->vb.width); | 65 | cx_write(MO_TS_LNGTH, buf->vb.width); |
66 | 66 | ||
67 | #if 1 | ||
68 | /* FIXME: this needs a review. | 67 | /* FIXME: this needs a review. |
69 | * also: move to cx88-blackbird + cx88-dvb source files? */ | 68 | * also: move to cx88-blackbird + cx88-dvb source files? */ |
70 | 69 | ||
@@ -76,9 +75,9 @@ static int cx8802_start_dma(struct cx8802_dev *dev, | |||
76 | cx_write(TS_HW_SOP_CNTRL,0x47<<16|188<<4|0x01); | 75 | cx_write(TS_HW_SOP_CNTRL,0x47<<16|188<<4|0x01); |
77 | if ((core->board == CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q) || | 76 | if ((core->board == CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q) || |
78 | (core->board == CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T)) { | 77 | (core->board == CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T)) { |
79 | cx_write(TS_SOP_STAT, 0<<16 | 0<<14 | 1<<13 | 0<<12); | 78 | cx_write(TS_SOP_STAT, 1<<13); |
80 | } else { | 79 | } else { |
81 | cx_write(TS_SOP_STAT,0x00); | 80 | cx_write(TS_SOP_STAT, 0x00); |
82 | } | 81 | } |
83 | cx_write(TS_GEN_CNTRL, dev->ts_gen_cntrl); | 82 | cx_write(TS_GEN_CNTRL, dev->ts_gen_cntrl); |
84 | udelay(100); | 83 | udelay(100); |
@@ -98,7 +97,6 @@ static int cx8802_start_dma(struct cx8802_dev *dev, | |||
98 | cx_write(TS_GEN_CNTRL, 0x06); /* punctured clock TS & posedge driven */ | 97 | cx_write(TS_GEN_CNTRL, 0x06); /* punctured clock TS & posedge driven */ |
99 | udelay(100); | 98 | udelay(100); |
100 | } | 99 | } |
101 | #endif | ||
102 | 100 | ||
103 | /* reset counter */ | 101 | /* reset counter */ |
104 | cx_write(MO_TS_GPCNTRL, GP_COUNT_CONTROL_RESET); | 102 | cx_write(MO_TS_GPCNTRL, GP_COUNT_CONTROL_RESET); |
@@ -270,6 +268,15 @@ static void cx8802_timeout(unsigned long data) | |||
270 | do_cancel_buffers(dev,"timeout",1); | 268 | do_cancel_buffers(dev,"timeout",1); |
271 | } | 269 | } |
272 | 270 | ||
271 | static char *cx88_mpeg_irqs[32] = { | ||
272 | "ts_risci1", NULL, NULL, NULL, | ||
273 | "ts_risci2", NULL, NULL, NULL, | ||
274 | "ts_oflow", NULL, NULL, NULL, | ||
275 | "ts_sync", NULL, NULL, NULL, | ||
276 | "opc_err", "par_err", "rip_err", "pci_abort", | ||
277 | "ts_err?", | ||
278 | }; | ||
279 | |||
273 | static void cx8802_mpeg_irq(struct cx8802_dev *dev) | 280 | static void cx8802_mpeg_irq(struct cx8802_dev *dev) |
274 | { | 281 | { |
275 | struct cx88_core *core = dev->core; | 282 | struct cx88_core *core = dev->core; |
@@ -282,10 +289,7 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev) | |||
282 | return; | 289 | return; |
283 | 290 | ||
284 | cx_write(MO_TS_INTSTAT, status); | 291 | cx_write(MO_TS_INTSTAT, status); |
285 | #if 0 | 292 | |
286 | cx88_print_irqbits(core->name, "irq mpeg ", | ||
287 | cx88_mpeg_irqs, status, mask); | ||
288 | #endif | ||
289 | if (debug || (status & mask & ~0xff)) | 293 | if (debug || (status & mask & ~0xff)) |
290 | cx88_print_irqbits(core->name, "irq mpeg ", | 294 | cx88_print_irqbits(core->name, "irq mpeg ", |
291 | cx88_mpeg_irqs, status, mask); | 295 | cx88_mpeg_irqs, status, mask); |
@@ -441,10 +445,8 @@ int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state) | |||
441 | } | 445 | } |
442 | spin_unlock(&dev->slock); | 446 | spin_unlock(&dev->slock); |
443 | 447 | ||
444 | #if 1 | ||
445 | /* FIXME -- shutdown device */ | 448 | /* FIXME -- shutdown device */ |
446 | cx88_shutdown(dev->core); | 449 | cx88_shutdown(dev->core); |
447 | #endif | ||
448 | 450 | ||
449 | pci_save_state(pci_dev); | 451 | pci_save_state(pci_dev); |
450 | if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) { | 452 | if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) { |
@@ -466,10 +468,8 @@ int cx8802_resume_common(struct pci_dev *pci_dev) | |||
466 | pci_set_power_state(pci_dev, PCI_D0); | 468 | pci_set_power_state(pci_dev, PCI_D0); |
467 | pci_restore_state(pci_dev); | 469 | pci_restore_state(pci_dev); |
468 | 470 | ||
469 | #if 1 | ||
470 | /* FIXME: re-initialize hardware */ | 471 | /* FIXME: re-initialize hardware */ |
471 | cx88_reset(dev->core); | 472 | cx88_reset(dev->core); |
472 | #endif | ||
473 | 473 | ||
474 | /* restart video+vbi capture */ | 474 | /* restart video+vbi capture */ |
475 | spin_lock(&dev->slock); | 475 | spin_lock(&dev->slock); |
diff --git a/drivers/media/video/cx88/cx88-reg.h b/drivers/media/video/cx88/cx88-reg.h index 63ad33f5818b..37f82662d265 100644 --- a/drivers/media/video/cx88/cx88-reg.h +++ b/drivers/media/video/cx88/cx88-reg.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: cx88-reg.h,v 1.7 2005/06/03 13:31:51 mchehab Exp $ | 2 | $Id: cx88-reg.h,v 1.8 2005/07/07 13:58:38 mchehab Exp $ |
3 | 3 | ||
4 | cx88x-hw.h - CX2388x register offsets | 4 | cx88x-hw.h - CX2388x register offsets |
5 | 5 | ||
@@ -604,20 +604,11 @@ | |||
604 | #define EN_I2SIN_STR2DAC 0x00004000 | 604 | #define EN_I2SIN_STR2DAC 0x00004000 |
605 | #define EN_I2SIN_ENABLE 0x00008000 | 605 | #define EN_I2SIN_ENABLE 0x00008000 |
606 | 606 | ||
607 | #if 0 | ||
608 | /* old */ | ||
609 | #define EN_DMTRX_SUMDIFF 0x00000800 | ||
610 | #define EN_DMTRX_SUMR 0x00000880 | ||
611 | #define EN_DMTRX_LR 0x00000900 | ||
612 | #define EN_DMTRX_MONO 0x00000980 | ||
613 | #else | ||
614 | /* dscaler cvs */ | ||
615 | #define EN_DMTRX_SUMDIFF (0 << 7) | 607 | #define EN_DMTRX_SUMDIFF (0 << 7) |
616 | #define EN_DMTRX_SUMR (1 << 7) | 608 | #define EN_DMTRX_SUMR (1 << 7) |
617 | #define EN_DMTRX_LR (2 << 7) | 609 | #define EN_DMTRX_LR (2 << 7) |
618 | #define EN_DMTRX_MONO (3 << 7) | 610 | #define EN_DMTRX_MONO (3 << 7) |
619 | #define EN_DMTRX_BYPASS (1 << 11) | 611 | #define EN_DMTRX_BYPASS (1 << 11) |
620 | #endif | ||
621 | 612 | ||
622 | // Video | 613 | // Video |
623 | #define VID_CAPTURE_CONTROL 0x310180 | 614 | #define VID_CAPTURE_CONTROL 0x310180 |
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c index 46d78b1dc9b2..91207f10bae7 100644 --- a/drivers/media/video/cx88/cx88-tvaudio.c +++ b/drivers/media/video/cx88/cx88-tvaudio.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: cx88-tvaudio.c,v 1.36 2005/06/05 05:53:45 mchehab Exp $ | 2 | $Id: cx88-tvaudio.c,v 1.37 2005/07/07 13:58:38 mchehab Exp $ |
3 | 3 | ||
4 | cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver | 4 | cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver |
5 | 5 | ||
@@ -278,80 +278,6 @@ static void set_audio_standard_BTSC(struct cx88_core *core, unsigned int sap) | |||
278 | set_audio_finish(core); | 278 | set_audio_finish(core); |
279 | } | 279 | } |
280 | 280 | ||
281 | #if 0 | ||
282 | static void set_audio_standard_NICAM(struct cx88_core *core) | ||
283 | { | ||
284 | static const struct rlist nicam_common[] = { | ||
285 | /* from dscaler */ | ||
286 | { AUD_RATE_ADJ1, 0x00000010 }, | ||
287 | { AUD_RATE_ADJ2, 0x00000040 }, | ||
288 | { AUD_RATE_ADJ3, 0x00000100 }, | ||
289 | { AUD_RATE_ADJ4, 0x00000400 }, | ||
290 | { AUD_RATE_ADJ5, 0x00001000 }, | ||
291 | // { AUD_DMD_RA_DDS, 0x00c0d5ce }, | ||
292 | |||
293 | // Deemphasis 1: | ||
294 | { AUD_DEEMPHGAIN_R, 0x000023c2 }, | ||
295 | { AUD_DEEMPHNUMER1_R, 0x0002a7bc }, | ||
296 | { AUD_DEEMPHNUMER2_R, 0x0003023e }, | ||
297 | { AUD_DEEMPHDENOM1_R, 0x0000f3d0 }, | ||
298 | { AUD_DEEMPHDENOM2_R, 0x00000000 }, | ||
299 | |||
300 | #if 0 | ||
301 | // Deemphasis 2: (other tv norm?) | ||
302 | { AUD_DEEMPHGAIN_R, 0x0000c600 }, | ||
303 | { AUD_DEEMPHNUMER1_R, 0x00066738 }, | ||
304 | { AUD_DEEMPHNUMER2_R, 0x00066739 }, | ||
305 | { AUD_DEEMPHDENOM1_R, 0x0001e88c }, | ||
306 | { AUD_DEEMPHDENOM2_R, 0x0001e88c }, | ||
307 | #endif | ||
308 | |||
309 | { AUD_DEEMPHDENOM2_R, 0x00000000 }, | ||
310 | { AUD_ERRLOGPERIOD_R, 0x00000fff }, | ||
311 | { AUD_ERRINTRPTTHSHLD1_R, 0x000003ff }, | ||
312 | { AUD_ERRINTRPTTHSHLD2_R, 0x000000ff }, | ||
313 | { AUD_ERRINTRPTTHSHLD3_R, 0x0000003f }, | ||
314 | { AUD_POLYPH80SCALEFAC, 0x00000003 }, | ||
315 | |||
316 | // setup QAM registers | ||
317 | { AUD_PDF_DDS_CNST_BYTE2, 0x06 }, | ||
318 | { AUD_PDF_DDS_CNST_BYTE1, 0x82 }, | ||
319 | { AUD_PDF_DDS_CNST_BYTE0, 0x16 }, | ||
320 | { AUD_QAM_MODE, 0x05 }, | ||
321 | |||
322 | { /* end of list */ }, | ||
323 | }; | ||
324 | static const struct rlist nicam_pal_i[] = { | ||
325 | { AUD_PDF_DDS_CNST_BYTE0, 0x12 }, | ||
326 | { AUD_PHACC_FREQ_8MSB, 0x3a }, | ||
327 | { AUD_PHACC_FREQ_8LSB, 0x93 }, | ||
328 | |||
329 | { /* end of list */ }, | ||
330 | }; | ||
331 | static const struct rlist nicam_default[] = { | ||
332 | { AUD_PDF_DDS_CNST_BYTE0, 0x16 }, | ||
333 | { AUD_PHACC_FREQ_8MSB, 0x34 }, | ||
334 | { AUD_PHACC_FREQ_8LSB, 0x4c }, | ||
335 | |||
336 | { /* end of list */ }, | ||
337 | }; | ||
338 | |||
339 | set_audio_start(core, 0x0010, | ||
340 | EN_DMTRX_LR | EN_DMTRX_BYPASS | EN_NICAM_AUTO_STEREO); | ||
341 | set_audio_registers(core, nicam_common); | ||
342 | switch (core->tvaudio) { | ||
343 | case WW_NICAM_I: | ||
344 | dprintk("%s PAL-I NICAM (status: unknown)\n",__FUNCTION__); | ||
345 | set_audio_registers(core, nicam_pal_i); | ||
346 | break; | ||
347 | case WW_NICAM_BGDKL: | ||
348 | dprintk("%s PAL-BGDK NICAM (status: unknown)\n",__FUNCTION__); | ||
349 | set_audio_registers(core, nicam_default); | ||
350 | break; | ||
351 | }; | ||
352 | set_audio_finish(core); | ||
353 | } | ||
354 | #endif | ||
355 | 281 | ||
356 | static void set_audio_standard_NICAM_L(struct cx88_core *core, int stereo) | 282 | static void set_audio_standard_NICAM_L(struct cx88_core *core, int stereo) |
357 | { | 283 | { |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index dc997549b634..c44a079d08c0 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-video.c,v 1.70 2005/06/20 03:36:00 mkrufky Exp $ | 2 | * $Id: cx88-video.c,v 1.79 2005/07/07 14:17:47 mchehab Exp $ |
3 | * | 3 | * |
4 | * device driver for Conexant 2388x based TV cards | 4 | * device driver for Conexant 2388x based TV cards |
5 | * video4linux video interface | 5 | * video4linux video interface |
@@ -86,13 +86,6 @@ static struct cx88_tvnorm tvnorms[] = { | |||
86 | .id = V4L2_STD_NTSC_M_JP, | 86 | .id = V4L2_STD_NTSC_M_JP, |
87 | .cxiformat = VideoFormatNTSCJapan, | 87 | .cxiformat = VideoFormatNTSCJapan, |
88 | .cxoformat = 0x181f0008, | 88 | .cxoformat = 0x181f0008, |
89 | #if 0 | ||
90 | },{ | ||
91 | .name = "NTSC-4.43", | ||
92 | .id = FIXME, | ||
93 | .cxiformat = VideoFormatNTSC443, | ||
94 | .cxoformat = 0x181f0008, | ||
95 | #endif | ||
96 | },{ | 89 | },{ |
97 | .name = "PAL-BG", | 90 | .name = "PAL-BG", |
98 | .id = V4L2_STD_PAL_BG, | 91 | .id = V4L2_STD_PAL_BG, |
@@ -248,6 +241,7 @@ static struct cx88_ctrl cx8800_ctls[] = { | |||
248 | .default_value = 0, | 241 | .default_value = 0, |
249 | .type = V4L2_CTRL_TYPE_INTEGER, | 242 | .type = V4L2_CTRL_TYPE_INTEGER, |
250 | }, | 243 | }, |
244 | .off = 0, | ||
251 | .reg = MO_CONTR_BRIGHT, | 245 | .reg = MO_CONTR_BRIGHT, |
252 | .mask = 0xff00, | 246 | .mask = 0xff00, |
253 | .shift = 8, | 247 | .shift = 8, |
@@ -674,231 +668,6 @@ static struct videobuf_queue_ops cx8800_video_qops = { | |||
674 | 668 | ||
675 | /* ------------------------------------------------------------------ */ | 669 | /* ------------------------------------------------------------------ */ |
676 | 670 | ||
677 | #if 0 /* overlay support not finished yet */ | ||
678 | static u32* ov_risc_field(struct cx8800_dev *dev, struct cx8800_fh *fh, | ||
679 | u32 *rp, struct btcx_skiplist *skips, | ||
680 | u32 sync_line, int skip_even, int skip_odd) | ||
681 | { | ||
682 | int line,maxy,start,end,skip,nskips; | ||
683 | u32 ri,ra; | ||
684 | u32 addr; | ||
685 | |||
686 | /* sync instruction */ | ||
687 | *(rp++) = cpu_to_le32(RISC_RESYNC | sync_line); | ||
688 | |||
689 | addr = (unsigned long)dev->fbuf.base; | ||
690 | addr += dev->fbuf.fmt.bytesperline * fh->win.w.top; | ||
691 | addr += (fh->fmt->depth >> 3) * fh->win.w.left; | ||
692 | |||
693 | /* scan lines */ | ||
694 | for (maxy = -1, line = 0; line < fh->win.w.height; | ||
695 | line++, addr += dev->fbuf.fmt.bytesperline) { | ||
696 | if ((line%2) == 0 && skip_even) | ||
697 | continue; | ||
698 | if ((line%2) == 1 && skip_odd) | ||
699 | continue; | ||
700 | |||
701 | /* calculate clipping */ | ||
702 | if (line > maxy) | ||
703 | btcx_calc_skips(line, fh->win.w.width, &maxy, | ||
704 | skips, &nskips, fh->clips, fh->nclips); | ||
705 | |||
706 | /* write out risc code */ | ||
707 | for (start = 0, skip = 0; start < fh->win.w.width; start = end) { | ||
708 | if (skip >= nskips) { | ||
709 | ri = RISC_WRITE; | ||
710 | end = fh->win.w.width; | ||
711 | } else if (start < skips[skip].start) { | ||
712 | ri = RISC_WRITE; | ||
713 | end = skips[skip].start; | ||
714 | } else { | ||
715 | ri = RISC_SKIP; | ||
716 | end = skips[skip].end; | ||
717 | skip++; | ||
718 | } | ||
719 | if (RISC_WRITE == ri) | ||
720 | ra = addr + (fh->fmt->depth>>3)*start; | ||
721 | else | ||
722 | ra = 0; | ||
723 | |||
724 | if (0 == start) | ||
725 | ri |= RISC_SOL; | ||
726 | if (fh->win.w.width == end) | ||
727 | ri |= RISC_EOL; | ||
728 | ri |= (fh->fmt->depth>>3) * (end-start); | ||
729 | |||
730 | *(rp++)=cpu_to_le32(ri); | ||
731 | if (0 != ra) | ||
732 | *(rp++)=cpu_to_le32(ra); | ||
733 | } | ||
734 | } | ||
735 | kfree(skips); | ||
736 | return rp; | ||
737 | } | ||
738 | |||
739 | static int ov_risc_frame(struct cx8800_dev *dev, struct cx8800_fh *fh, | ||
740 | struct cx88_buffer *buf) | ||
741 | { | ||
742 | struct btcx_skiplist *skips; | ||
743 | u32 instructions,fields; | ||
744 | u32 *rp; | ||
745 | int rc; | ||
746 | |||
747 | /* skip list for window clipping */ | ||
748 | if (NULL == (skips = kmalloc(sizeof(*skips) * fh->nclips,GFP_KERNEL))) | ||
749 | return -ENOMEM; | ||
750 | |||
751 | fields = 0; | ||
752 | if (V4L2_FIELD_HAS_TOP(fh->win.field)) | ||
753 | fields++; | ||
754 | if (V4L2_FIELD_HAS_BOTTOM(fh->win.field)) | ||
755 | fields++; | ||
756 | |||
757 | /* estimate risc mem: worst case is (clip+1) * lines instructions | ||
758 | + syncs + jump (all 2 dwords) */ | ||
759 | instructions = (fh->nclips+1) * fh->win.w.height; | ||
760 | instructions += 3 + 4; | ||
761 | if ((rc = btcx_riscmem_alloc(dev->pci,&buf->risc,instructions*8)) < 0) { | ||
762 | kfree(skips); | ||
763 | return rc; | ||
764 | } | ||
765 | |||
766 | /* write risc instructions */ | ||
767 | rp = buf->risc.cpu; | ||
768 | switch (fh->win.field) { | ||
769 | case V4L2_FIELD_TOP: | ||
770 | rp = ov_risc_field(dev, fh, rp, skips, 0, 0, 0); | ||
771 | break; | ||
772 | case V4L2_FIELD_BOTTOM: | ||
773 | rp = ov_risc_field(dev, fh, rp, skips, 0x200, 0, 0); | ||
774 | break; | ||
775 | case V4L2_FIELD_INTERLACED: | ||
776 | rp = ov_risc_field(dev, fh, rp, skips, 0, 0, 1); | ||
777 | rp = ov_risc_field(dev, fh, rp, skips, 0x200, 1, 0); | ||
778 | break; | ||
779 | default: | ||
780 | BUG(); | ||
781 | } | ||
782 | |||
783 | /* save pointer to jmp instruction address */ | ||
784 | buf->risc.jmp = rp; | ||
785 | kfree(skips); | ||
786 | return 0; | ||
787 | } | ||
788 | |||
789 | static int verify_window(struct cx8800_dev *dev, struct v4l2_window *win) | ||
790 | { | ||
791 | enum v4l2_field field; | ||
792 | int maxw, maxh; | ||
793 | |||
794 | if (NULL == dev->fbuf.base) | ||
795 | return -EINVAL; | ||
796 | if (win->w.width < 48 || win->w.height < 32) | ||
797 | return -EINVAL; | ||
798 | if (win->clipcount > 2048) | ||
799 | return -EINVAL; | ||
800 | |||
801 | field = win->field; | ||
802 | maxw = norm_maxw(core->tvnorm); | ||
803 | maxh = norm_maxh(core->tvnorm); | ||
804 | |||
805 | if (V4L2_FIELD_ANY == field) { | ||
806 | field = (win->w.height > maxh/2) | ||
807 | ? V4L2_FIELD_INTERLACED | ||
808 | : V4L2_FIELD_TOP; | ||
809 | } | ||
810 | switch (field) { | ||
811 | case V4L2_FIELD_TOP: | ||
812 | case V4L2_FIELD_BOTTOM: | ||
813 | maxh = maxh / 2; | ||
814 | break; | ||
815 | case V4L2_FIELD_INTERLACED: | ||
816 | break; | ||
817 | default: | ||
818 | return -EINVAL; | ||
819 | } | ||
820 | |||
821 | win->field = field; | ||
822 | if (win->w.width > maxw) | ||
823 | win->w.width = maxw; | ||
824 | if (win->w.height > maxh) | ||
825 | win->w.height = maxh; | ||
826 | return 0; | ||
827 | } | ||
828 | |||
829 | static int setup_window(struct cx8800_dev *dev, struct cx8800_fh *fh, | ||
830 | struct v4l2_window *win) | ||
831 | { | ||
832 | struct v4l2_clip *clips = NULL; | ||
833 | int n,size,retval = 0; | ||
834 | |||
835 | if (NULL == fh->fmt) | ||
836 | return -EINVAL; | ||
837 | retval = verify_window(dev,win); | ||
838 | if (0 != retval) | ||
839 | return retval; | ||
840 | |||
841 | /* copy clips -- luckily v4l1 + v4l2 are binary | ||
842 | compatible here ...*/ | ||
843 | n = win->clipcount; | ||
844 | size = sizeof(*clips)*(n+4); | ||
845 | clips = kmalloc(size,GFP_KERNEL); | ||
846 | if (NULL == clips) | ||
847 | return -ENOMEM; | ||
848 | if (n > 0) { | ||
849 | if (copy_from_user(clips,win->clips,sizeof(struct v4l2_clip)*n)) { | ||
850 | kfree(clips); | ||
851 | return -EFAULT; | ||
852 | } | ||
853 | } | ||
854 | |||
855 | /* clip against screen */ | ||
856 | if (NULL != dev->fbuf.base) | ||
857 | n = btcx_screen_clips(dev->fbuf.fmt.width, dev->fbuf.fmt.height, | ||
858 | &win->w, clips, n); | ||
859 | btcx_sort_clips(clips,n); | ||
860 | |||
861 | /* 4-byte alignments */ | ||
862 | switch (fh->fmt->depth) { | ||
863 | case 8: | ||
864 | case 24: | ||
865 | btcx_align(&win->w, clips, n, 3); | ||
866 | break; | ||
867 | case 16: | ||
868 | btcx_align(&win->w, clips, n, 1); | ||
869 | break; | ||
870 | case 32: | ||
871 | /* no alignment fixups needed */ | ||
872 | break; | ||
873 | default: | ||
874 | BUG(); | ||
875 | } | ||
876 | |||
877 | down(&fh->vidq.lock); | ||
878 | if (fh->clips) | ||
879 | kfree(fh->clips); | ||
880 | fh->clips = clips; | ||
881 | fh->nclips = n; | ||
882 | fh->win = *win; | ||
883 | #if 0 | ||
884 | fh->ov.setup_ok = 1; | ||
885 | #endif | ||
886 | |||
887 | /* update overlay if needed */ | ||
888 | retval = 0; | ||
889 | #if 0 | ||
890 | if (check_btres(fh, RESOURCE_OVERLAY)) { | ||
891 | struct bttv_buffer *new; | ||
892 | |||
893 | new = videobuf_alloc(sizeof(*new)); | ||
894 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); | ||
895 | retval = bttv_switch_overlay(btv,fh,new); | ||
896 | } | ||
897 | #endif | ||
898 | up(&fh->vidq.lock); | ||
899 | return retval; | ||
900 | } | ||
901 | #endif | ||
902 | 671 | ||
903 | /* ------------------------------------------------------------------ */ | 672 | /* ------------------------------------------------------------------ */ |
904 | 673 | ||
@@ -1327,9 +1096,6 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1327 | struct cx8800_fh *fh = file->private_data; | 1096 | struct cx8800_fh *fh = file->private_data; |
1328 | struct cx8800_dev *dev = fh->dev; | 1097 | struct cx8800_dev *dev = fh->dev; |
1329 | struct cx88_core *core = dev->core; | 1098 | struct cx88_core *core = dev->core; |
1330 | #if 0 | ||
1331 | unsigned long flags; | ||
1332 | #endif | ||
1333 | int err; | 1099 | int err; |
1334 | 1100 | ||
1335 | if (video_debug > 1) | 1101 | if (video_debug > 1) |
@@ -1350,9 +1116,6 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1350 | V4L2_CAP_READWRITE | | 1116 | V4L2_CAP_READWRITE | |
1351 | V4L2_CAP_STREAMING | | 1117 | V4L2_CAP_STREAMING | |
1352 | V4L2_CAP_VBI_CAPTURE | | 1118 | V4L2_CAP_VBI_CAPTURE | |
1353 | #if 0 | ||
1354 | V4L2_CAP_VIDEO_OVERLAY | | ||
1355 | #endif | ||
1356 | 0; | 1119 | 0; |
1357 | if (UNSET != core->tuner_type) | 1120 | if (UNSET != core->tuner_type) |
1358 | cap->capabilities |= V4L2_CAP_TUNER; | 1121 | cap->capabilities |= V4L2_CAP_TUNER; |
@@ -1453,36 +1216,6 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1453 | } | 1216 | } |
1454 | 1217 | ||
1455 | 1218 | ||
1456 | #if 0 | ||
1457 | /* needs review */ | ||
1458 | case VIDIOC_G_AUDIO: | ||
1459 | { | ||
1460 | struct v4l2_audio *a = arg; | ||
1461 | unsigned int n = a->index; | ||
1462 | |||
1463 | memset(a,0,sizeof(*a)); | ||
1464 | a->index = n; | ||
1465 | switch (n) { | ||
1466 | case 0: | ||
1467 | if ((CX88_VMUX_TELEVISION == INPUT(n)->type) | ||
1468 | || (CX88_VMUX_CABLE == INPUT(n)->type)) { | ||
1469 | strcpy(a->name,"Television"); | ||
1470 | // FIXME figure out if stereo received and set V4L2_AUDCAP_STEREO. | ||
1471 | return 0; | ||
1472 | } | ||
1473 | break; | ||
1474 | case 1: | ||
1475 | if (CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q == core->board) { | ||
1476 | strcpy(a->name,"Line In"); | ||
1477 | a->capability = V4L2_AUDCAP_STEREO; | ||
1478 | return 0; | ||
1479 | } | ||
1480 | break; | ||
1481 | } | ||
1482 | // Audio input not available. | ||
1483 | return -EINVAL; | ||
1484 | } | ||
1485 | #endif | ||
1486 | 1219 | ||
1487 | /* --- capture ioctls ---------------------------------------- */ | 1220 | /* --- capture ioctls ---------------------------------------- */ |
1488 | case VIDIOC_ENUM_FMT: | 1221 | case VIDIOC_ENUM_FMT: |
@@ -1592,6 +1325,9 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1592 | 1325 | ||
1593 | f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; | 1326 | f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; |
1594 | f->frequency = dev->freq; | 1327 | f->frequency = dev->freq; |
1328 | |||
1329 | cx88_call_i2c_clients(dev->core,VIDIOC_G_FREQUENCY,f); | ||
1330 | |||
1595 | return 0; | 1331 | return 0; |
1596 | } | 1332 | } |
1597 | case VIDIOC_S_FREQUENCY: | 1333 | case VIDIOC_S_FREQUENCY: |
@@ -1846,6 +1582,14 @@ static void cx8800_vid_timeout(unsigned long data) | |||
1846 | spin_unlock_irqrestore(&dev->slock,flags); | 1582 | spin_unlock_irqrestore(&dev->slock,flags); |
1847 | } | 1583 | } |
1848 | 1584 | ||
1585 | static char *cx88_vid_irqs[32] = { | ||
1586 | "y_risci1", "u_risci1", "v_risci1", "vbi_risc1", | ||
1587 | "y_risci2", "u_risci2", "v_risci2", "vbi_risc2", | ||
1588 | "y_oflow", "u_oflow", "v_oflow", "vbi_oflow", | ||
1589 | "y_sync", "u_sync", "v_sync", "vbi_sync", | ||
1590 | "opc_err", "par_err", "rip_err", "pci_abort", | ||
1591 | }; | ||
1592 | |||
1849 | static void cx8800_vid_irq(struct cx8800_dev *dev) | 1593 | static void cx8800_vid_irq(struct cx8800_dev *dev) |
1850 | { | 1594 | { |
1851 | struct cx88_core *core = dev->core; | 1595 | struct cx88_core *core = dev->core; |
@@ -2013,7 +1757,6 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | |||
2013 | { | 1757 | { |
2014 | struct cx8800_dev *dev; | 1758 | struct cx8800_dev *dev; |
2015 | struct cx88_core *core; | 1759 | struct cx88_core *core; |
2016 | struct tuner_addr tun_addr; | ||
2017 | int err; | 1760 | int err; |
2018 | 1761 | ||
2019 | dev = kmalloc(sizeof(*dev),GFP_KERNEL); | 1762 | dev = kmalloc(sizeof(*dev),GFP_KERNEL); |
@@ -2087,22 +1830,6 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | |||
2087 | request_module("tuner"); | 1830 | request_module("tuner"); |
2088 | if (core->tda9887_conf) | 1831 | if (core->tda9887_conf) |
2089 | request_module("tda9887"); | 1832 | request_module("tda9887"); |
2090 | if (core->radio_type != UNSET) { | ||
2091 | tun_addr.v4l2_tuner = V4L2_TUNER_RADIO; | ||
2092 | tun_addr.type = core->radio_type; | ||
2093 | tun_addr.addr = core->radio_addr; | ||
2094 | cx88_call_i2c_clients(dev->core,TUNER_SET_TYPE_ADDR, &tun_addr); | ||
2095 | } | ||
2096 | if (core->tuner_type != UNSET) { | ||
2097 | tun_addr.v4l2_tuner = V4L2_TUNER_ANALOG_TV; | ||
2098 | tun_addr.type = core->tuner_type; | ||
2099 | tun_addr.addr = core->tuner_addr; | ||
2100 | cx88_call_i2c_clients(dev->core,TUNER_SET_TYPE_ADDR, &tun_addr); | ||
2101 | } | ||
2102 | |||
2103 | if (core->tda9887_conf) | ||
2104 | cx88_call_i2c_clients(dev->core,TDA9887_SET_CONFIG,&core->tda9887_conf); | ||
2105 | |||
2106 | /* register v4l devices */ | 1833 | /* register v4l devices */ |
2107 | dev->video_dev = cx88_vdev_init(core,dev->pci, | 1834 | dev->video_dev = cx88_vdev_init(core,dev->pci, |
2108 | &cx8800_video_template,"video"); | 1835 | &cx8800_video_template,"video"); |
@@ -2212,10 +1939,8 @@ static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state) | |||
2212 | } | 1939 | } |
2213 | spin_unlock(&dev->slock); | 1940 | spin_unlock(&dev->slock); |
2214 | 1941 | ||
2215 | #if 1 | ||
2216 | /* FIXME -- shutdown device */ | 1942 | /* FIXME -- shutdown device */ |
2217 | cx88_shutdown(dev->core); | 1943 | cx88_shutdown(dev->core); |
2218 | #endif | ||
2219 | 1944 | ||
2220 | pci_save_state(pci_dev); | 1945 | pci_save_state(pci_dev); |
2221 | if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) { | 1946 | if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) { |
@@ -2237,10 +1962,8 @@ static int cx8800_resume(struct pci_dev *pci_dev) | |||
2237 | pci_set_power_state(pci_dev, PCI_D0); | 1962 | pci_set_power_state(pci_dev, PCI_D0); |
2238 | pci_restore_state(pci_dev); | 1963 | pci_restore_state(pci_dev); |
2239 | 1964 | ||
2240 | #if 1 | ||
2241 | /* FIXME: re-initialize hardware */ | 1965 | /* FIXME: re-initialize hardware */ |
2242 | cx88_reset(dev->core); | 1966 | cx88_reset(dev->core); |
2243 | #endif | ||
2244 | 1967 | ||
2245 | /* restart video+vbi capture */ | 1968 | /* restart video+vbi capture */ |
2246 | spin_lock(&dev->slock); | 1969 | spin_lock(&dev->slock); |
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index bc5e038bc0fe..307beae04f2a 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88.h,v 1.67 2005/07/01 12:10:07 mkrufky Exp $ | 2 | * $Id: cx88.h,v 1.68 2005/07/07 14:17:47 mchehab Exp $ |
3 | * | 3 | * |
4 | * v4l2 device driver for cx2388x based TV cards | 4 | * v4l2 device driver for cx2388x based TV cards |
5 | * | 5 | * |
@@ -82,9 +82,9 @@ struct cx88_tvnorm { | |||
82 | static unsigned int inline norm_maxw(struct cx88_tvnorm *norm) | 82 | static unsigned int inline norm_maxw(struct cx88_tvnorm *norm) |
83 | { | 83 | { |
84 | return (norm->id & V4L2_STD_625_50) ? 768 : 640; | 84 | return (norm->id & V4L2_STD_625_50) ? 768 : 640; |
85 | // return (norm->id & V4L2_STD_625_50) ? 720 : 640; | ||
86 | } | 85 | } |
87 | 86 | ||
87 | |||
88 | static unsigned int inline norm_maxh(struct cx88_tvnorm *norm) | 88 | static unsigned int inline norm_maxh(struct cx88_tvnorm *norm) |
89 | { | 89 | { |
90 | return (norm->id & V4L2_STD_625_50) ? 576 : 480; | 90 | return (norm->id & V4L2_STD_625_50) ? 576 : 480; |
@@ -220,7 +220,6 @@ struct cx88_subid { | |||
220 | #define RESOURCE_VBI 4 | 220 | #define RESOURCE_VBI 4 |
221 | 221 | ||
222 | #define BUFFER_TIMEOUT (HZ/2) /* 0.5 seconds */ | 222 | #define BUFFER_TIMEOUT (HZ/2) /* 0.5 seconds */ |
223 | //#define BUFFER_TIMEOUT (HZ*2) | ||
224 | 223 | ||
225 | /* buffer for one video frame */ | 224 | /* buffer for one video frame */ |
226 | struct cx88_buffer { | 225 | struct cx88_buffer { |
@@ -336,11 +335,6 @@ struct cx8800_dev { | |||
336 | struct pci_dev *pci; | 335 | struct pci_dev *pci; |
337 | unsigned char pci_rev,pci_lat; | 336 | unsigned char pci_rev,pci_lat; |
338 | 337 | ||
339 | #if 0 | ||
340 | /* video overlay */ | ||
341 | struct v4l2_framebuffer fbuf; | ||
342 | struct cx88_buffer *screen; | ||
343 | #endif | ||
344 | 338 | ||
345 | /* capture queues */ | 339 | /* capture queues */ |
346 | struct cx88_dmaqueue vidq; | 340 | struct cx88_dmaqueue vidq; |
@@ -435,8 +429,6 @@ struct cx8802_dev { | |||
435 | /* ----------------------------------------------------------- */ | 429 | /* ----------------------------------------------------------- */ |
436 | /* cx88-core.c */ | 430 | /* cx88-core.c */ |
437 | 431 | ||
438 | extern char *cx88_vid_irqs[32]; | ||
439 | extern char *cx88_mpeg_irqs[32]; | ||
440 | extern void cx88_print_irqbits(char *name, char *tag, char **strings, | 432 | extern void cx88_print_irqbits(char *name, char *tag, char **strings, |
441 | u32 bits, u32 mask); | 433 | u32 bits, u32 mask); |
442 | extern void cx88_print_ioctl(char *name, unsigned int cmd); | 434 | extern void cx88_print_ioctl(char *name, unsigned int cmd); |
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 92664f75d327..9fc5055e001c 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: ir-kbd-i2c.c,v 1.10 2004/12/09 12:51:35 kraxel Exp $ | 2 | * $Id: ir-kbd-i2c.c,v 1.11 2005/07/07 16:42:11 mchehab Exp $ |
3 | * | 3 | * |
4 | * keyboard input driver for i2c IR remote controls | 4 | * keyboard input driver for i2c IR remote controls |
5 | * | 5 | * |
@@ -66,26 +66,26 @@ static IR_KEYTAB_TYPE ir_codes_pv951[IR_KEYTAB_SIZE] = { | |||
66 | [ 29 ] = KEY_PAGEDOWN, | 66 | [ 29 ] = KEY_PAGEDOWN, |
67 | [ 19 ] = KEY_SOUND, | 67 | [ 19 ] = KEY_SOUND, |
68 | 68 | ||
69 | [ 24 ] = KEY_KPPLUSMINUS, // CH +/- | 69 | [ 24 ] = KEY_KPPLUSMINUS, /* CH +/- */ |
70 | [ 22 ] = KEY_SUBTITLE, // CC | 70 | [ 22 ] = KEY_SUBTITLE, /* CC */ |
71 | [ 13 ] = KEY_TEXT, // TTX | 71 | [ 13 ] = KEY_TEXT, /* TTX */ |
72 | [ 11 ] = KEY_TV, // AIR/CBL | 72 | [ 11 ] = KEY_TV, /* AIR/CBL */ |
73 | [ 17 ] = KEY_PC, // PC/TV | 73 | [ 17 ] = KEY_PC, /* PC/TV */ |
74 | [ 23 ] = KEY_OK, // CH RTN | 74 | [ 23 ] = KEY_OK, /* CH RTN */ |
75 | [ 25 ] = KEY_MODE, // FUNC | 75 | [ 25 ] = KEY_MODE, /* FUNC */ |
76 | [ 12 ] = KEY_SEARCH, // AUTOSCAN | 76 | [ 12 ] = KEY_SEARCH, /* AUTOSCAN */ |
77 | 77 | ||
78 | /* Not sure what to do with these ones! */ | 78 | /* Not sure what to do with these ones! */ |
79 | [ 15 ] = KEY_SELECT, // SOURCE | 79 | [ 15 ] = KEY_SELECT, /* SOURCE */ |
80 | [ 10 ] = KEY_KPPLUS, // +100 | 80 | [ 10 ] = KEY_KPPLUS, /* +100 */ |
81 | [ 20 ] = KEY_KPEQUAL, // SYNC | 81 | [ 20 ] = KEY_KPEQUAL, /* SYNC */ |
82 | [ 28 ] = KEY_MEDIA, // PC/TV | 82 | [ 28 ] = KEY_MEDIA, /* PC/TV */ |
83 | }; | 83 | }; |
84 | 84 | ||
85 | static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = { | 85 | static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = { |
86 | [ 0x3 ] = KEY_POWER, | 86 | [ 0x3 ] = KEY_POWER, |
87 | [ 0x6f ] = KEY_MUTE, | 87 | [ 0x6f ] = KEY_MUTE, |
88 | [ 0x10 ] = KEY_BACKSPACE, // Recall | 88 | [ 0x10 ] = KEY_BACKSPACE, /* Recall */ |
89 | 89 | ||
90 | [ 0x11 ] = KEY_KP0, | 90 | [ 0x11 ] = KEY_KP0, |
91 | [ 0x4 ] = KEY_KP1, | 91 | [ 0x4 ] = KEY_KP1, |
@@ -97,7 +97,7 @@ static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = { | |||
97 | [ 0xc ] = KEY_KP7, | 97 | [ 0xc ] = KEY_KP7, |
98 | [ 0xd ] = KEY_KP8, | 98 | [ 0xd ] = KEY_KP8, |
99 | [ 0xe ] = KEY_KP9, | 99 | [ 0xe ] = KEY_KP9, |
100 | [ 0x12 ] = KEY_KPDOT, // 100+ | 100 | [ 0x12 ] = KEY_KPDOT, /* 100+ */ |
101 | 101 | ||
102 | [ 0x7 ] = KEY_VOLUMEUP, | 102 | [ 0x7 ] = KEY_VOLUMEUP, |
103 | [ 0xb ] = KEY_VOLUMEDOWN, | 103 | [ 0xb ] = KEY_VOLUMEDOWN, |
@@ -109,25 +109,16 @@ static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = { | |||
109 | [ 0x13 ] = KEY_CHANNELDOWN, | 109 | [ 0x13 ] = KEY_CHANNELDOWN, |
110 | [ 0x48 ] = KEY_ZOOM, | 110 | [ 0x48 ] = KEY_ZOOM, |
111 | 111 | ||
112 | [ 0x1b ] = KEY_VIDEO, // Video source | 112 | [ 0x1b ] = KEY_VIDEO, /* Video source */ |
113 | #if 0 | 113 | [ 0x49 ] = KEY_LANGUAGE, /* MTS Select */ |
114 | [ 0x1f ] = KEY_S, // Snapshot | 114 | [ 0x19 ] = KEY_SEARCH, /* Auto Scan */ |
115 | #endif | ||
116 | [ 0x49 ] = KEY_LANGUAGE, // MTS Select | ||
117 | [ 0x19 ] = KEY_SEARCH, // Auto Scan | ||
118 | 115 | ||
119 | [ 0x4b ] = KEY_RECORD, | 116 | [ 0x4b ] = KEY_RECORD, |
120 | [ 0x46 ] = KEY_PLAY, | 117 | [ 0x46 ] = KEY_PLAY, |
121 | [ 0x45 ] = KEY_PAUSE, // Pause | 118 | [ 0x45 ] = KEY_PAUSE, /* Pause */ |
122 | [ 0x44 ] = KEY_STOP, | 119 | [ 0x44 ] = KEY_STOP, |
123 | #if 0 | 120 | [ 0x40 ] = KEY_FORWARD, /* Forward ? */ |
124 | [ 0x43 ] = KEY_T, // Time Shift | 121 | [ 0x42 ] = KEY_REWIND, /* Backward ? */ |
125 | [ 0x47 ] = KEY_Y, // Time Shift OFF | ||
126 | [ 0x4a ] = KEY_O, // TOP | ||
127 | [ 0x17 ] = KEY_F, // SURF CH | ||
128 | #endif | ||
129 | [ 0x40 ] = KEY_FORWARD, // Forward ? | ||
130 | [ 0x42 ] = KEY_REWIND, // Backward ? | ||
131 | 122 | ||
132 | }; | 123 | }; |
133 | 124 | ||
diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index b4ee9dfe6d42..6239254db27e 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c | |||
@@ -567,10 +567,6 @@ static void msp3400c_set_audmode(struct i2c_client *client, int audmode) | |||
567 | switch (audmode) { | 567 | switch (audmode) { |
568 | case V4L2_TUNER_MODE_STEREO: | 568 | case V4L2_TUNER_MODE_STEREO: |
569 | src = 0x0020 | nicam; | 569 | src = 0x0020 | nicam; |
570 | #if 0 | ||
571 | /* spatial effect */ | ||
572 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x0005,0x4000); | ||
573 | #endif | ||
574 | break; | 570 | break; |
575 | case V4L2_TUNER_MODE_MONO: | 571 | case V4L2_TUNER_MODE_MONO: |
576 | if (msp->mode == MSP_MODE_AM_NICAM) { | 572 | if (msp->mode == MSP_MODE_AM_NICAM) { |
@@ -741,16 +737,14 @@ static int msp34xx_sleep(struct msp3400c *msp, int timeout) | |||
741 | set_current_state(TASK_INTERRUPTIBLE); | 737 | set_current_state(TASK_INTERRUPTIBLE); |
742 | schedule(); | 738 | schedule(); |
743 | } else { | 739 | } else { |
744 | #if 0 | ||
745 | /* hmm, that one doesn't return on wakeup ... */ | ||
746 | msleep_interruptible(timeout); | ||
747 | #else | ||
748 | set_current_state(TASK_INTERRUPTIBLE); | 740 | set_current_state(TASK_INTERRUPTIBLE); |
749 | schedule_timeout(msecs_to_jiffies(timeout)); | 741 | schedule_timeout(msecs_to_jiffies(timeout)); |
750 | #endif | ||
751 | } | 742 | } |
752 | } | 743 | } |
753 | try_to_freeze(); | 744 | if (current->flags & PF_FREEZE) { |
745 | refrigerator (); | ||
746 | } | ||
747 | |||
754 | remove_wait_queue(&msp->wq, &wait); | 748 | remove_wait_queue(&msp->wq, &wait); |
755 | return msp->restart; | 749 | return msp->restart; |
756 | } | 750 | } |
@@ -1154,17 +1148,10 @@ static int msp3410d_thread(void *data) | |||
1154 | MSP_CARRIER(10.7)); | 1148 | MSP_CARRIER(10.7)); |
1155 | /* scart routing */ | 1149 | /* scart routing */ |
1156 | msp3400c_set_scart(client,SCART_IN2,0); | 1150 | msp3400c_set_scart(client,SCART_IN2,0); |
1157 | #if 0 | ||
1158 | /* radio from SCART_IN2 */ | ||
1159 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x08, 0x0220); | ||
1160 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x09, 0x0220); | ||
1161 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x0b, 0x0220); | ||
1162 | #else | ||
1163 | /* msp34xx does radio decoding */ | 1151 | /* msp34xx does radio decoding */ |
1164 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x08, 0x0020); | 1152 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x08, 0x0020); |
1165 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x09, 0x0020); | 1153 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x09, 0x0020); |
1166 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x0b, 0x0020); | 1154 | msp3400c_write(client,I2C_MSP3400C_DFP, 0x0b, 0x0020); |
1167 | #endif | ||
1168 | break; | 1155 | break; |
1169 | case 0x0003: | 1156 | case 0x0003: |
1170 | case 0x0004: | 1157 | case 0x0004: |
@@ -1507,10 +1494,6 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) | |||
1507 | return -1; | 1494 | return -1; |
1508 | } | 1495 | } |
1509 | 1496 | ||
1510 | #if 0 | ||
1511 | /* this will turn on a 1kHz beep - might be useful for debugging... */ | ||
1512 | msp3400c_write(c,I2C_MSP3400C_DFP, 0x0014, 0x1040); | ||
1513 | #endif | ||
1514 | msp3400c_setvolume(c, msp->muted, msp->volume, msp->balance); | 1497 | msp3400c_setvolume(c, msp->muted, msp->volume, msp->balance); |
1515 | 1498 | ||
1516 | snprintf(c->name, sizeof(c->name), "MSP34%02d%c-%c%d", | 1499 | snprintf(c->name, sizeof(c->name), "MSP34%02d%c-%c%d", |
diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c index 9c005cb128d7..2fb7c2d1787a 100644 --- a/drivers/media/video/mt20xx.c +++ b/drivers/media/video/mt20xx.c | |||
@@ -511,22 +511,6 @@ int microtune_init(struct i2c_client *c) | |||
511 | tuner_info("microtune: companycode=%04x part=%02x rev=%02x\n", | 511 | tuner_info("microtune: companycode=%04x part=%02x rev=%02x\n", |
512 | company_code,buf[0x13],buf[0x14]); | 512 | company_code,buf[0x13],buf[0x14]); |
513 | 513 | ||
514 | #if 0 | ||
515 | /* seems to cause more problems than it solves ... */ | ||
516 | switch (company_code) { | ||
517 | case 0x30bf: | ||
518 | case 0x3cbf: | ||
519 | case 0x3dbf: | ||
520 | case 0x4d54: | ||
521 | case 0x8e81: | ||
522 | case 0x8e91: | ||
523 | /* ok (?) */ | ||
524 | break; | ||
525 | default: | ||
526 | tuner_warn("tuner: microtune: unknown companycode\n"); | ||
527 | return 0; | ||
528 | } | ||
529 | #endif | ||
530 | 514 | ||
531 | if (buf[0x13] < ARRAY_SIZE(microtune_part) && | 515 | if (buf[0x13] < ARRAY_SIZE(microtune_part) && |
532 | NULL != microtune_part[buf[0x13]]) | 516 | NULL != microtune_part[buf[0x13]]) |
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c index 70bf1f1fad59..486234d41b56 100644 --- a/drivers/media/video/mxb.c +++ b/drivers/media/video/mxb.c | |||
@@ -326,6 +326,7 @@ static int mxb_init_done(struct saa7146_dev* dev) | |||
326 | struct mxb* mxb = (struct mxb*)dev->ext_priv; | 326 | struct mxb* mxb = (struct mxb*)dev->ext_priv; |
327 | struct video_decoder_init init; | 327 | struct video_decoder_init init; |
328 | struct i2c_msg msg; | 328 | struct i2c_msg msg; |
329 | struct tuner_setup tun_setup; | ||
329 | 330 | ||
330 | int i = 0, err = 0; | 331 | int i = 0, err = 0; |
331 | struct tea6415c_multiplex vm; | 332 | struct tea6415c_multiplex vm; |
@@ -349,8 +350,10 @@ static int mxb_init_done(struct saa7146_dev* dev) | |||
349 | mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_VBI_BYPASS, &i); | 350 | mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_VBI_BYPASS, &i); |
350 | 351 | ||
351 | /* select a tuner type */ | 352 | /* select a tuner type */ |
352 | i = 5; | 353 | tun_setup.mode_mask = T_ANALOG_TV; |
353 | mxb->tuner->driver->command(mxb->tuner,TUNER_SET_TYPE, &i); | 354 | tun_setup.addr = ADDR_UNSET; |
355 | tun_setup.type = 5; | ||
356 | mxb->tuner->driver->command(mxb->tuner,TUNER_SET_TYPE_ADDR, &tun_setup); | ||
354 | 357 | ||
355 | /* mute audio on tea6420s */ | 358 | /* mute audio on tea6420s */ |
356 | mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]); | 359 | mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]); |
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index e6d0a18833d6..79d05ea1b69b 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c | |||
@@ -155,10 +155,6 @@ static struct v4l2_mpeg_compression param_defaults = | |||
155 | .target = 256, | 155 | .target = 256, |
156 | }, | 156 | }, |
157 | 157 | ||
158 | #if 0 | ||
159 | /* FIXME: size? via S_FMT? */ | ||
160 | .video_format = MPEG_VIDEO_FORMAT_D1, | ||
161 | #endif | ||
162 | }; | 158 | }; |
163 | 159 | ||
164 | /* ---------------------------------------------------------------------- */ | 160 | /* ---------------------------------------------------------------------- */ |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 0c781e24c446..88b71a20b602 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -1,6 +1,5 @@ | |||
1 | |||
2 | /* | 1 | /* |
3 | * $Id: saa7134-cards.c,v 1.58 2005/06/07 18:05:00 nsh Exp $ | 2 | * $Id: saa7134-cards.c,v 1.80 2005/07/07 01:49:30 mkrufky Exp $ |
4 | * | 3 | * |
5 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
6 | * card-specific stuff. | 5 | * card-specific stuff. |
@@ -47,6 +46,10 @@ struct saa7134_board saa7134_boards[] = { | |||
47 | .name = "UNKNOWN/GENERIC", | 46 | .name = "UNKNOWN/GENERIC", |
48 | .audio_clock = 0x00187de7, | 47 | .audio_clock = 0x00187de7, |
49 | .tuner_type = TUNER_ABSENT, | 48 | .tuner_type = TUNER_ABSENT, |
49 | .radio_type = UNSET, | ||
50 | .tuner_addr = ADDR_UNSET, | ||
51 | .radio_addr = ADDR_UNSET, | ||
52 | |||
50 | .inputs = {{ | 53 | .inputs = {{ |
51 | .name = "default", | 54 | .name = "default", |
52 | .vmux = 0, | 55 | .vmux = 0, |
@@ -58,6 +61,10 @@ struct saa7134_board saa7134_boards[] = { | |||
58 | .name = "Proteus Pro [philips reference design]", | 61 | .name = "Proteus Pro [philips reference design]", |
59 | .audio_clock = 0x00187de7, | 62 | .audio_clock = 0x00187de7, |
60 | .tuner_type = TUNER_PHILIPS_PAL, | 63 | .tuner_type = TUNER_PHILIPS_PAL, |
64 | .radio_type = UNSET, | ||
65 | .tuner_addr = ADDR_UNSET, | ||
66 | .radio_addr = ADDR_UNSET, | ||
67 | |||
61 | .inputs = {{ | 68 | .inputs = {{ |
62 | .name = name_comp1, | 69 | .name = name_comp1, |
63 | .vmux = 0, | 70 | .vmux = 0, |
@@ -83,6 +90,10 @@ struct saa7134_board saa7134_boards[] = { | |||
83 | .name = "LifeView FlyVIDEO3000", | 90 | .name = "LifeView FlyVIDEO3000", |
84 | .audio_clock = 0x00200000, | 91 | .audio_clock = 0x00200000, |
85 | .tuner_type = TUNER_PHILIPS_PAL, | 92 | .tuner_type = TUNER_PHILIPS_PAL, |
93 | .radio_type = UNSET, | ||
94 | .tuner_addr = ADDR_UNSET, | ||
95 | .radio_addr = ADDR_UNSET, | ||
96 | |||
86 | .gpiomask = 0xe000, | 97 | .gpiomask = 0xe000, |
87 | .inputs = {{ | 98 | .inputs = {{ |
88 | .name = name_tv, | 99 | .name = name_tv, |
@@ -90,7 +101,7 @@ struct saa7134_board saa7134_boards[] = { | |||
90 | .amux = TV, | 101 | .amux = TV, |
91 | .gpio = 0x8000, | 102 | .gpio = 0x8000, |
92 | .tv = 1, | 103 | .tv = 1, |
93 | },{ | 104 | },{ |
94 | .name = name_tv_mono, | 105 | .name = name_tv_mono, |
95 | .vmux = 1, | 106 | .vmux = 1, |
96 | .amux = LINE2, | 107 | .amux = LINE2, |
@@ -117,12 +128,21 @@ struct saa7134_board saa7134_boards[] = { | |||
117 | .amux = LINE2, | 128 | .amux = LINE2, |
118 | .gpio = 0x2000, | 129 | .gpio = 0x2000, |
119 | }, | 130 | }, |
131 | .mute = { | ||
132 | .name = name_mute, | ||
133 | .amux = TV, | ||
134 | .gpio = 0x8000, | ||
135 | }, | ||
120 | }, | 136 | }, |
121 | [SAA7134_BOARD_FLYVIDEO2000] = { | 137 | [SAA7134_BOARD_FLYVIDEO2000] = { |
122 | /* "TC Wan" <tcwan@cs.usm.my> */ | 138 | /* "TC Wan" <tcwan@cs.usm.my> */ |
123 | .name = "LifeView FlyVIDEO2000", | 139 | .name = "LifeView FlyVIDEO2000", |
124 | .audio_clock = 0x00200000, | 140 | .audio_clock = 0x00200000, |
125 | .tuner_type = TUNER_LG_PAL_NEW_TAPC, | 141 | .tuner_type = TUNER_LG_PAL_NEW_TAPC, |
142 | .radio_type = UNSET, | ||
143 | .tuner_addr = ADDR_UNSET, | ||
144 | .radio_addr = ADDR_UNSET, | ||
145 | |||
126 | .gpiomask = 0xe000, | 146 | .gpiomask = 0xe000, |
127 | .inputs = {{ | 147 | .inputs = {{ |
128 | .name = name_tv, | 148 | .name = name_tv, |
@@ -146,14 +166,14 @@ struct saa7134_board saa7134_boards[] = { | |||
146 | .amux = LINE2, | 166 | .amux = LINE2, |
147 | .gpio = 0x4000, | 167 | .gpio = 0x4000, |
148 | }}, | 168 | }}, |
149 | .radio = { | 169 | .radio = { |
150 | .name = name_radio, | 170 | .name = name_radio, |
151 | .amux = LINE2, | 171 | .amux = LINE2, |
152 | .gpio = 0x2000, | 172 | .gpio = 0x2000, |
153 | }, | 173 | }, |
154 | .mute = { | 174 | .mute = { |
155 | .name = name_mute, | 175 | .name = name_mute, |
156 | .amux = LINE2, | 176 | .amux = LINE2, |
157 | .gpio = 0x8000, | 177 | .gpio = 0x8000, |
158 | }, | 178 | }, |
159 | }, | 179 | }, |
@@ -162,6 +182,10 @@ struct saa7134_board saa7134_boards[] = { | |||
162 | .name = "LifeView FlyTV Platinum Mini", | 182 | .name = "LifeView FlyTV Platinum Mini", |
163 | .audio_clock = 0x00200000, | 183 | .audio_clock = 0x00200000, |
164 | .tuner_type = TUNER_PHILIPS_TDA8290, | 184 | .tuner_type = TUNER_PHILIPS_TDA8290, |
185 | .radio_type = UNSET, | ||
186 | .tuner_addr = ADDR_UNSET, | ||
187 | .radio_addr = ADDR_UNSET, | ||
188 | |||
165 | .inputs = {{ | 189 | .inputs = {{ |
166 | .name = name_tv, | 190 | .name = name_tv, |
167 | .vmux = 1, | 191 | .vmux = 1, |
@@ -183,6 +207,10 @@ struct saa7134_board saa7134_boards[] = { | |||
183 | .name = "LifeView FlyTV Platinum FM", | 207 | .name = "LifeView FlyTV Platinum FM", |
184 | .audio_clock = 0x00200000, | 208 | .audio_clock = 0x00200000, |
185 | .tuner_type = TUNER_PHILIPS_TDA8290, | 209 | .tuner_type = TUNER_PHILIPS_TDA8290, |
210 | .radio_type = UNSET, | ||
211 | .tuner_addr = ADDR_UNSET, | ||
212 | .radio_addr = ADDR_UNSET, | ||
213 | |||
186 | .gpiomask = 0x1E000, /* Set GP16 and unused 15,14,13 to Output */ | 214 | .gpiomask = 0x1E000, /* Set GP16 and unused 15,14,13 to Output */ |
187 | .inputs = {{ | 215 | .inputs = {{ |
188 | .name = name_tv, | 216 | .name = name_tv, |
@@ -190,7 +218,7 @@ struct saa7134_board saa7134_boards[] = { | |||
190 | .amux = TV, | 218 | .amux = TV, |
191 | .gpio = 0x10000, /* GP16=1 selects TV input */ | 219 | .gpio = 0x10000, /* GP16=1 selects TV input */ |
192 | .tv = 1, | 220 | .tv = 1, |
193 | },{ | 221 | },{ |
194 | /* .name = name_tv_mono, | 222 | /* .name = name_tv_mono, |
195 | .vmux = 1, | 223 | .vmux = 1, |
196 | .amux = LINE2, | 224 | .amux = LINE2, |
@@ -200,29 +228,38 @@ struct saa7134_board saa7134_boards[] = { | |||
200 | */ .name = name_comp1, /* Composite signal on S-Video input */ | 228 | */ .name = name_comp1, /* Composite signal on S-Video input */ |
201 | .vmux = 0, | 229 | .vmux = 0, |
202 | .amux = LINE2, | 230 | .amux = LINE2, |
203 | // .gpio = 0x4000, | 231 | /* .gpio = 0x4000, */ |
204 | },{ | 232 | },{ |
205 | .name = name_comp2, /* Composite input */ | 233 | .name = name_comp2, /* Composite input */ |
206 | .vmux = 3, | 234 | .vmux = 3, |
207 | .amux = LINE2, | 235 | .amux = LINE2, |
208 | // .gpio = 0x4000, | 236 | /* .gpio = 0x4000, */ |
209 | },{ | 237 | },{ |
210 | .name = name_svideo, /* S-Video signal on S-Video input */ | 238 | .name = name_svideo, /* S-Video signal on S-Video input */ |
211 | .vmux = 8, | 239 | .vmux = 8, |
212 | .amux = LINE2, | 240 | .amux = LINE2, |
213 | // .gpio = 0x4000, | 241 | /* .gpio = 0x4000, */ |
214 | }}, | 242 | }}, |
215 | .radio = { | 243 | .radio = { |
216 | .name = name_radio, | 244 | .name = name_radio, |
217 | .amux = TV, | 245 | .amux = TV, |
218 | .gpio = 0x00000, /* GP16=0 selects FM radio antenna */ | 246 | .gpio = 0x00000, /* GP16=0 selects FM radio antenna */ |
219 | }, | 247 | }, |
248 | .mute = { | ||
249 | .name = name_mute, | ||
250 | .amux = TV, | ||
251 | .gpio = 0x10000, | ||
252 | }, | ||
220 | }, | 253 | }, |
221 | [SAA7134_BOARD_EMPRESS] = { | 254 | [SAA7134_BOARD_EMPRESS] = { |
222 | /* "Gert Vervoort" <gert.vervoort@philips.com> */ | 255 | /* "Gert Vervoort" <gert.vervoort@philips.com> */ |
223 | .name = "EMPRESS", | 256 | .name = "EMPRESS", |
224 | .audio_clock = 0x00187de7, | 257 | .audio_clock = 0x00187de7, |
225 | .tuner_type = TUNER_PHILIPS_PAL, | 258 | .tuner_type = TUNER_PHILIPS_PAL, |
259 | .radio_type = UNSET, | ||
260 | .tuner_addr = ADDR_UNSET, | ||
261 | .radio_addr = ADDR_UNSET, | ||
262 | |||
226 | .inputs = {{ | 263 | .inputs = {{ |
227 | .name = name_comp1, | 264 | .name = name_comp1, |
228 | .vmux = 0, | 265 | .vmux = 0, |
@@ -245,33 +282,40 @@ struct saa7134_board saa7134_boards[] = { | |||
245 | .video_out = CCIR656, | 282 | .video_out = CCIR656, |
246 | }, | 283 | }, |
247 | [SAA7134_BOARD_MONSTERTV] = { | 284 | [SAA7134_BOARD_MONSTERTV] = { |
248 | /* "K.Ohta" <alpha292@bremen.or.jp> */ | 285 | /* "K.Ohta" <alpha292@bremen.or.jp> */ |
249 | .name = "SKNet Monster TV", | 286 | .name = "SKNet Monster TV", |
250 | .audio_clock = 0x00187de7, | 287 | .audio_clock = 0x00187de7, |
251 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 288 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
252 | .inputs = {{ | 289 | .radio_type = UNSET, |
253 | .name = name_tv, | 290 | .tuner_addr = ADDR_UNSET, |
254 | .vmux = 1, | 291 | .radio_addr = ADDR_UNSET, |
255 | .amux = TV, | 292 | |
256 | .tv = 1, | 293 | .inputs = {{ |
257 | },{ | 294 | .name = name_tv, |
258 | .name = name_comp1, | 295 | .vmux = 1, |
259 | .vmux = 0, | 296 | .amux = TV, |
260 | .amux = LINE1, | 297 | .tv = 1, |
261 | },{ | 298 | },{ |
262 | .name = name_svideo, | 299 | .name = name_comp1, |
263 | .vmux = 8, | 300 | .vmux = 0, |
264 | .amux = LINE1, | 301 | .amux = LINE1, |
265 | }}, | 302 | },{ |
266 | .radio = { | 303 | .name = name_svideo, |
267 | .name = name_radio, | 304 | .vmux = 8, |
268 | .amux = LINE2, | 305 | .amux = LINE1, |
269 | }, | 306 | }}, |
307 | .radio = { | ||
308 | .name = name_radio, | ||
309 | .amux = LINE2, | ||
310 | }, | ||
270 | }, | 311 | }, |
271 | [SAA7134_BOARD_MD9717] = { | 312 | [SAA7134_BOARD_MD9717] = { |
272 | .name = "Tevion MD 9717", | 313 | .name = "Tevion MD 9717", |
273 | .audio_clock = 0x00200000, | 314 | .audio_clock = 0x00200000, |
274 | .tuner_type = TUNER_PHILIPS_PAL, | 315 | .tuner_type = TUNER_PHILIPS_PAL, |
316 | .radio_type = UNSET, | ||
317 | .tuner_addr = ADDR_UNSET, | ||
318 | .radio_addr = ADDR_UNSET, | ||
275 | .inputs = {{ | 319 | .inputs = {{ |
276 | .name = name_tv, | 320 | .name = name_tv, |
277 | .vmux = 1, | 321 | .vmux = 1, |
@@ -302,10 +346,13 @@ struct saa7134_board saa7134_boards[] = { | |||
302 | }, | 346 | }, |
303 | }, | 347 | }, |
304 | [SAA7134_BOARD_TVSTATION_RDS] = { | 348 | [SAA7134_BOARD_TVSTATION_RDS] = { |
305 | /* Typhoon TV Tuner RDS: Art.Nr. 50694 */ | 349 | /* Typhoon TV Tuner RDS: Art.Nr. 50694 */ |
306 | .name = "KNC One TV-Station RDS / Typhoon TV Tuner RDS", | 350 | .name = "KNC One TV-Station RDS / Typhoon TV Tuner RDS", |
307 | .audio_clock = 0x00200000, | 351 | .audio_clock = 0x00200000, |
308 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, | 352 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
353 | .radio_type = UNSET, | ||
354 | .tuner_addr = ADDR_UNSET, | ||
355 | .radio_addr = ADDR_UNSET, | ||
309 | .tda9887_conf = TDA9887_PRESENT, | 356 | .tda9887_conf = TDA9887_PRESENT, |
310 | .inputs = {{ | 357 | .inputs = {{ |
311 | .name = name_tv, | 358 | .name = name_tv, |
@@ -314,10 +361,10 @@ struct saa7134_board saa7134_boards[] = { | |||
314 | .tv = 1, | 361 | .tv = 1, |
315 | },{ | 362 | },{ |
316 | .name = name_tv_mono, | 363 | .name = name_tv_mono, |
317 | .vmux = 1, | 364 | .vmux = 1, |
318 | .amux = LINE2, | 365 | .amux = LINE2, |
319 | .tv = 1, | 366 | .tv = 1, |
320 | },{ | 367 | },{ |
321 | 368 | ||
322 | .name = name_svideo, | 369 | .name = name_svideo, |
323 | .vmux = 8, | 370 | .vmux = 8, |
@@ -328,10 +375,10 @@ struct saa7134_board saa7134_boards[] = { | |||
328 | .amux = LINE1, | 375 | .amux = LINE1, |
329 | },{ | 376 | },{ |
330 | 377 | ||
331 | .name = "CVid over SVid", | 378 | .name = "CVid over SVid", |
332 | .vmux = 0, | 379 | .vmux = 0, |
333 | .amux = LINE1, | 380 | .amux = LINE1, |
334 | }}, | 381 | }}, |
335 | .radio = { | 382 | .radio = { |
336 | .name = name_radio, | 383 | .name = name_radio, |
337 | .amux = LINE2, | 384 | .amux = LINE2, |
@@ -341,6 +388,9 @@ struct saa7134_board saa7134_boards[] = { | |||
341 | .name = "KNC One TV-Station DVR", | 388 | .name = "KNC One TV-Station DVR", |
342 | .audio_clock = 0x00200000, | 389 | .audio_clock = 0x00200000, |
343 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, | 390 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
391 | .radio_type = UNSET, | ||
392 | .tuner_addr = ADDR_UNSET, | ||
393 | .radio_addr = ADDR_UNSET, | ||
344 | .tda9887_conf = TDA9887_PRESENT, | 394 | .tda9887_conf = TDA9887_PRESENT, |
345 | .gpiomask = 0x820000, | 395 | .gpiomask = 0x820000, |
346 | .inputs = {{ | 396 | .inputs = {{ |
@@ -369,32 +419,38 @@ struct saa7134_board saa7134_boards[] = { | |||
369 | .video_out = CCIR656, | 419 | .video_out = CCIR656, |
370 | }, | 420 | }, |
371 | [SAA7134_BOARD_CINERGY400] = { | 421 | [SAA7134_BOARD_CINERGY400] = { |
372 | .name = "Terratec Cinergy 400 TV", | 422 | .name = "Terratec Cinergy 400 TV", |
373 | .audio_clock = 0x00200000, | 423 | .audio_clock = 0x00200000, |
374 | .tuner_type = TUNER_PHILIPS_PAL, | 424 | .tuner_type = TUNER_PHILIPS_PAL, |
375 | .inputs = {{ | 425 | .radio_type = UNSET, |
376 | .name = name_tv, | 426 | .tuner_addr = ADDR_UNSET, |
377 | .vmux = 1, | 427 | .radio_addr = ADDR_UNSET, |
378 | .amux = TV, | 428 | .inputs = {{ |
379 | .tv = 1, | 429 | .name = name_tv, |
380 | },{ | 430 | .vmux = 1, |
381 | .name = name_comp1, | 431 | .amux = TV, |
382 | .vmux = 4, | 432 | .tv = 1, |
383 | .amux = LINE1, | 433 | },{ |
384 | },{ | 434 | .name = name_comp1, |
385 | .name = name_svideo, | 435 | .vmux = 4, |
386 | .vmux = 8, | 436 | .amux = LINE1, |
387 | .amux = LINE1, | 437 | },{ |
388 | },{ | 438 | .name = name_svideo, |
389 | .name = name_comp2, // CVideo over SVideo Connector | 439 | .vmux = 8, |
390 | .vmux = 0, | 440 | .amux = LINE1, |
391 | .amux = LINE1, | 441 | },{ |
392 | }} | 442 | .name = name_comp2, /* CVideo over SVideo Connector */ |
393 | }, | 443 | .vmux = 0, |
444 | .amux = LINE1, | ||
445 | }} | ||
446 | }, | ||
394 | [SAA7134_BOARD_MD5044] = { | 447 | [SAA7134_BOARD_MD5044] = { |
395 | .name = "Medion 5044", | 448 | .name = "Medion 5044", |
396 | .audio_clock = 0x00187de7, // was: 0x00200000, | 449 | .audio_clock = 0x00187de7, /* was: 0x00200000, */ |
397 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, | 450 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
451 | .radio_type = UNSET, | ||
452 | .tuner_addr = ADDR_UNSET, | ||
453 | .radio_addr = ADDR_UNSET, | ||
398 | .tda9887_conf = TDA9887_PRESENT, | 454 | .tda9887_conf = TDA9887_PRESENT, |
399 | .inputs = {{ | 455 | .inputs = {{ |
400 | .name = name_tv, | 456 | .name = name_tv, |
@@ -426,57 +482,65 @@ struct saa7134_board saa7134_boards[] = { | |||
426 | }, | 482 | }, |
427 | }, | 483 | }, |
428 | [SAA7134_BOARD_KWORLD] = { | 484 | [SAA7134_BOARD_KWORLD] = { |
429 | .name = "Kworld/KuroutoShikou SAA7130-TVPCI", | 485 | .name = "Kworld/KuroutoShikou SAA7130-TVPCI", |
430 | .audio_clock = 0x00187de7, | 486 | .audio_clock = 0x00187de7, |
431 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 487 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
432 | .inputs = {{ | 488 | .radio_type = UNSET, |
433 | .name = name_svideo, | 489 | .tuner_addr = ADDR_UNSET, |
434 | .vmux = 8, | 490 | .radio_addr = ADDR_UNSET, |
435 | .amux = LINE1, | 491 | .inputs = {{ |
436 | },{ | 492 | .name = name_svideo, |
437 | .name = name_comp1, | 493 | .vmux = 8, |
438 | .vmux = 3, | 494 | .amux = LINE1, |
439 | .amux = LINE1, | 495 | },{ |
440 | },{ | 496 | .name = name_comp1, |
441 | .name = name_tv, | 497 | .vmux = 3, |
442 | .vmux = 1, | 498 | .amux = LINE1, |
443 | .amux = LINE2, | 499 | },{ |
444 | .tv = 1, | 500 | .name = name_tv, |
445 | }}, | 501 | .vmux = 1, |
446 | }, | 502 | .amux = LINE2, |
503 | .tv = 1, | ||
504 | }}, | ||
505 | }, | ||
447 | [SAA7134_BOARD_CINERGY600] = { | 506 | [SAA7134_BOARD_CINERGY600] = { |
448 | .name = "Terratec Cinergy 600 TV", | 507 | .name = "Terratec Cinergy 600 TV", |
449 | .audio_clock = 0x00200000, | 508 | .audio_clock = 0x00200000, |
450 | .tuner_type = TUNER_PHILIPS_PAL, | 509 | .tuner_type = TUNER_PHILIPS_PAL, |
510 | .radio_type = UNSET, | ||
511 | .tuner_addr = ADDR_UNSET, | ||
512 | .radio_addr = ADDR_UNSET, | ||
451 | .tda9887_conf = TDA9887_PRESENT, | 513 | .tda9887_conf = TDA9887_PRESENT, |
452 | .inputs = {{ | 514 | .inputs = {{ |
453 | .name = name_tv, | 515 | .name = name_tv, |
454 | .vmux = 1, | 516 | .vmux = 1, |
455 | .amux = TV, | 517 | .amux = TV, |
456 | .tv = 1, | 518 | .tv = 1, |
457 | },{ | 519 | },{ |
458 | .name = name_comp1, | 520 | .name = name_comp1, |
459 | .vmux = 4, | 521 | .vmux = 4, |
460 | .amux = LINE1, | 522 | .amux = LINE1, |
461 | },{ | 523 | },{ |
462 | .name = name_svideo, | 524 | .name = name_svideo, |
463 | .vmux = 8, | 525 | .vmux = 8, |
464 | .amux = LINE1, | 526 | .amux = LINE1, |
465 | },{ | 527 | },{ |
466 | .name = name_comp2, // CVideo over SVideo Connector | 528 | .name = name_comp2, /* CVideo over SVideo Connector */ |
467 | .vmux = 0, | 529 | .vmux = 0, |
468 | .amux = LINE1, | 530 | .amux = LINE1, |
469 | }}, | 531 | }}, |
470 | .radio = { | 532 | .radio = { |
471 | .name = name_radio, | 533 | .name = name_radio, |
472 | .amux = LINE2, | 534 | .amux = LINE2, |
473 | }, | 535 | }, |
474 | }, | 536 | }, |
475 | [SAA7134_BOARD_MD7134] = { | 537 | [SAA7134_BOARD_MD7134] = { |
476 | .name = "Medion 7134", | 538 | .name = "Medion 7134", |
477 | //.audio_clock = 0x00200000, | ||
478 | .audio_clock = 0x00187de7, | 539 | .audio_clock = 0x00187de7, |
479 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, | 540 | .tuner_type = TUNER_PHILIPS_FMD1216ME_MK3, |
541 | .radio_type = UNSET, | ||
542 | .tuner_addr = ADDR_UNSET, | ||
543 | .radio_addr = ADDR_UNSET, | ||
480 | .tda9887_conf = TDA9887_PRESENT, | 544 | .tda9887_conf = TDA9887_PRESENT, |
481 | .mpeg = SAA7134_MPEG_DVB, | 545 | .mpeg = SAA7134_MPEG_DVB, |
482 | .inputs = {{ | 546 | .inputs = {{ |
@@ -504,6 +568,9 @@ struct saa7134_board saa7134_boards[] = { | |||
504 | .name = "Typhoon TV+Radio 90031", | 568 | .name = "Typhoon TV+Radio 90031", |
505 | .audio_clock = 0x00200000, | 569 | .audio_clock = 0x00200000, |
506 | .tuner_type = TUNER_PHILIPS_PAL, | 570 | .tuner_type = TUNER_PHILIPS_PAL, |
571 | .radio_type = UNSET, | ||
572 | .tuner_addr = ADDR_UNSET, | ||
573 | .radio_addr = ADDR_UNSET, | ||
507 | .tda9887_conf = TDA9887_PRESENT, | 574 | .tda9887_conf = TDA9887_PRESENT, |
508 | .inputs = {{ | 575 | .inputs = {{ |
509 | .name = name_tv, | 576 | .name = name_tv, |
@@ -523,11 +590,14 @@ struct saa7134_board saa7134_boards[] = { | |||
523 | .name = name_radio, | 590 | .name = name_radio, |
524 | .amux = LINE2, | 591 | .amux = LINE2, |
525 | }, | 592 | }, |
526 | }, | 593 | }, |
527 | [SAA7134_BOARD_ELSA] = { | 594 | [SAA7134_BOARD_ELSA] = { |
528 | .name = "ELSA EX-VISION 300TV", | 595 | .name = "ELSA EX-VISION 300TV", |
529 | .audio_clock = 0x00187de7, | 596 | .audio_clock = 0x00187de7, |
530 | .tuner_type = TUNER_HITACHI_NTSC, | 597 | .tuner_type = TUNER_HITACHI_NTSC, |
598 | .radio_type = UNSET, | ||
599 | .tuner_addr = ADDR_UNSET, | ||
600 | .radio_addr = ADDR_UNSET, | ||
531 | .inputs = {{ | 601 | .inputs = {{ |
532 | .name = name_svideo, | 602 | .name = name_svideo, |
533 | .vmux = 8, | 603 | .vmux = 8, |
@@ -542,11 +612,14 @@ struct saa7134_board saa7134_boards[] = { | |||
542 | .amux = LINE2, | 612 | .amux = LINE2, |
543 | .tv = 1, | 613 | .tv = 1, |
544 | }}, | 614 | }}, |
545 | }, | 615 | }, |
546 | [SAA7134_BOARD_ELSA_500TV] = { | 616 | [SAA7134_BOARD_ELSA_500TV] = { |
547 | .name = "ELSA EX-VISION 500TV", | 617 | .name = "ELSA EX-VISION 500TV", |
548 | .audio_clock = 0x00187de7, | 618 | .audio_clock = 0x00187de7, |
549 | .tuner_type = TUNER_HITACHI_NTSC, | 619 | .tuner_type = TUNER_HITACHI_NTSC, |
620 | .radio_type = UNSET, | ||
621 | .tuner_addr = ADDR_UNSET, | ||
622 | .radio_addr = ADDR_UNSET, | ||
550 | .inputs = {{ | 623 | .inputs = {{ |
551 | .name = name_svideo, | 624 | .name = name_svideo, |
552 | .vmux = 7, | 625 | .vmux = 7, |
@@ -562,83 +635,100 @@ struct saa7134_board saa7134_boards[] = { | |||
562 | .amux = LINE2, | 635 | .amux = LINE2, |
563 | .tv = 1, | 636 | .tv = 1, |
564 | }}, | 637 | }}, |
565 | }, | 638 | }, |
566 | [SAA7134_BOARD_ASUSTeK_TVFM7134] = { | 639 | [SAA7134_BOARD_ASUSTeK_TVFM7134] = { |
567 | .name = "ASUS TV-FM 7134", | 640 | .name = "ASUS TV-FM 7134", |
568 | .audio_clock = 0x00187de7, | 641 | .audio_clock = 0x00187de7, |
569 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, | 642 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
570 | .tda9887_conf = TDA9887_PRESENT, | 643 | .radio_type = UNSET, |
571 | .inputs = {{ | 644 | .tuner_addr = ADDR_UNSET, |
572 | .name = name_tv, | 645 | .radio_addr = ADDR_UNSET, |
573 | .vmux = 1, | 646 | .tda9887_conf = TDA9887_PRESENT, |
574 | .amux = TV, | 647 | .inputs = {{ |
575 | .tv = 1, | 648 | .name = name_tv, |
576 | },{ | 649 | .vmux = 1, |
577 | .name = name_comp1, | 650 | .amux = TV, |
578 | .vmux = 4, | 651 | .tv = 1, |
579 | .amux = LINE2, | 652 | },{ |
580 | },{ | 653 | .name = name_comp1, |
581 | .name = name_svideo, | 654 | .vmux = 4, |
582 | .vmux = 6, | 655 | .amux = LINE2, |
583 | .amux = LINE2, | 656 | },{ |
584 | }}, | 657 | .name = name_svideo, |
585 | .radio = { | 658 | .vmux = 6, |
586 | .name = name_radio, | 659 | .amux = LINE2, |
587 | .amux = LINE1, | 660 | }}, |
588 | }, | 661 | .radio = { |
589 | }, | 662 | .name = name_radio, |
590 | [SAA7135_BOARD_ASUSTeK_TVFM7135] = { | 663 | .amux = LINE1, |
591 | .name = "ASUS TV-FM 7135", | 664 | }, |
592 | .audio_clock = 0x00187de7, | 665 | }, |
593 | .tuner_type = TUNER_PHILIPS_TDA8290, | 666 | [SAA7134_BOARD_ASUSTeK_TVFM7135] = { |
667 | .name = "ASUS TV-FM 7135", | ||
668 | .audio_clock = 0x00187de7, | ||
669 | .tuner_type = TUNER_PHILIPS_TDA8290, | ||
670 | .radio_type = UNSET, | ||
671 | .tuner_addr = ADDR_UNSET, | ||
672 | .radio_addr = ADDR_UNSET, | ||
594 | .gpiomask = 0x200000, | 673 | .gpiomask = 0x200000, |
595 | .inputs = {{ | 674 | .inputs = {{ |
596 | .name = name_tv, | 675 | .name = name_tv, |
597 | .vmux = 1, | 676 | .vmux = 1, |
598 | .amux = TV, | 677 | .amux = TV, |
599 | .gpio = 0x0000, | 678 | .gpio = 0x0000, |
600 | .tv = 1, | 679 | .tv = 1, |
601 | },{ | 680 | },{ |
602 | .name = name_comp1, | 681 | .name = name_comp1, |
603 | .vmux = 4, | 682 | .vmux = 4, |
604 | .amux = LINE2, | 683 | .amux = LINE2, |
605 | .gpio = 0x0000, | 684 | .gpio = 0x0000, |
606 | },{ | 685 | },{ |
607 | .name = name_svideo, | 686 | .name = name_svideo, |
608 | .vmux = 6, | 687 | .vmux = 6, |
609 | .amux = LINE2, | 688 | .amux = LINE2, |
610 | .gpio = 0x0000, | 689 | .gpio = 0x0000, |
611 | }}, | 690 | }}, |
612 | .radio = { | 691 | .radio = { |
613 | .name = name_radio, | 692 | .name = name_radio, |
614 | .amux = TV, | 693 | .amux = TV, |
615 | .gpio = 0x200000, | 694 | .gpio = 0x200000, |
616 | }, | 695 | }, |
696 | .mute = { | ||
697 | .name = name_mute, | ||
698 | .gpio = 0x0000, | ||
699 | }, | ||
700 | |||
617 | }, | 701 | }, |
618 | [SAA7134_BOARD_VA1000POWER] = { | 702 | [SAA7134_BOARD_VA1000POWER] = { |
619 | .name = "AOPEN VA1000 POWER", | 703 | .name = "AOPEN VA1000 POWER", |
620 | .audio_clock = 0x00187de7, | 704 | .audio_clock = 0x00187de7, |
621 | .tuner_type = TUNER_PHILIPS_NTSC, | 705 | .tuner_type = TUNER_PHILIPS_NTSC, |
622 | .inputs = {{ | 706 | .radio_type = UNSET, |
623 | .name = name_svideo, | 707 | .tuner_addr = ADDR_UNSET, |
624 | .vmux = 8, | 708 | .radio_addr = ADDR_UNSET, |
625 | .amux = LINE1, | 709 | .inputs = {{ |
626 | },{ | 710 | .name = name_svideo, |
627 | .name = name_comp1, | 711 | .vmux = 8, |
628 | .vmux = 3, | 712 | .amux = LINE1, |
629 | .amux = LINE1, | 713 | },{ |
630 | },{ | 714 | .name = name_comp1, |
631 | .name = name_tv, | 715 | .vmux = 3, |
632 | .vmux = 1, | 716 | .amux = LINE1, |
633 | .amux = LINE2, | 717 | },{ |
634 | .tv = 1, | 718 | .name = name_tv, |
635 | }}, | 719 | .vmux = 1, |
720 | .amux = LINE2, | ||
721 | .tv = 1, | ||
722 | }}, | ||
636 | }, | 723 | }, |
637 | [SAA7134_BOARD_10MOONSTVMASTER] = { | 724 | [SAA7134_BOARD_10MOONSTVMASTER] = { |
638 | /* "lilicheng" <llc@linuxfans.org> */ | 725 | /* "lilicheng" <llc@linuxfans.org> */ |
639 | .name = "10MOONS PCI TV CAPTURE CARD", | 726 | .name = "10MOONS PCI TV CAPTURE CARD", |
640 | .audio_clock = 0x00200000, | 727 | .audio_clock = 0x00200000, |
641 | .tuner_type = TUNER_LG_PAL_NEW_TAPC, | 728 | .tuner_type = TUNER_LG_PAL_NEW_TAPC, |
729 | .radio_type = UNSET, | ||
730 | .tuner_addr = ADDR_UNSET, | ||
731 | .radio_addr = ADDR_UNSET, | ||
642 | .gpiomask = 0xe000, | 732 | .gpiomask = 0xe000, |
643 | .inputs = {{ | 733 | .inputs = {{ |
644 | .name = name_tv, | 734 | .name = name_tv, |
@@ -662,14 +752,14 @@ struct saa7134_board saa7134_boards[] = { | |||
662 | .amux = LINE2, | 752 | .amux = LINE2, |
663 | .gpio = 0x4000, | 753 | .gpio = 0x4000, |
664 | }}, | 754 | }}, |
665 | .radio = { | 755 | .radio = { |
666 | .name = name_radio, | 756 | .name = name_radio, |
667 | .amux = LINE2, | 757 | .amux = LINE2, |
668 | .gpio = 0x2000, | 758 | .gpio = 0x2000, |
669 | }, | 759 | }, |
670 | .mute = { | 760 | .mute = { |
671 | .name = name_mute, | 761 | .name = name_mute, |
672 | .amux = LINE2, | 762 | .amux = LINE2, |
673 | .gpio = 0x8000, | 763 | .gpio = 0x8000, |
674 | }, | 764 | }, |
675 | }, | 765 | }, |
@@ -678,6 +768,9 @@ struct saa7134_board saa7134_boards[] = { | |||
678 | .name = "BMK MPEX No Tuner", | 768 | .name = "BMK MPEX No Tuner", |
679 | .audio_clock = 0x200000, | 769 | .audio_clock = 0x200000, |
680 | .tuner_type = TUNER_ABSENT, | 770 | .tuner_type = TUNER_ABSENT, |
771 | .radio_type = UNSET, | ||
772 | .tuner_addr = ADDR_UNSET, | ||
773 | .radio_addr = ADDR_UNSET, | ||
681 | .inputs = {{ | 774 | .inputs = {{ |
682 | .name = name_comp1, | 775 | .name = name_comp1, |
683 | .vmux = 4, | 776 | .vmux = 4, |
@@ -706,80 +799,94 @@ struct saa7134_board saa7134_boards[] = { | |||
706 | .name = "Compro VideoMate TV", | 799 | .name = "Compro VideoMate TV", |
707 | .audio_clock = 0x00187de7, | 800 | .audio_clock = 0x00187de7, |
708 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 801 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
709 | .inputs = {{ | 802 | .radio_type = UNSET, |
710 | .name = name_svideo, | 803 | .tuner_addr = ADDR_UNSET, |
711 | .vmux = 8, | 804 | .radio_addr = ADDR_UNSET, |
712 | .amux = LINE1, | 805 | .inputs = {{ |
713 | },{ | 806 | .name = name_svideo, |
714 | .name = name_comp1, | 807 | .vmux = 8, |
715 | .vmux = 3, | 808 | .amux = LINE1, |
716 | .amux = LINE1, | 809 | },{ |
717 | },{ | 810 | .name = name_comp1, |
718 | .name = name_tv, | 811 | .vmux = 3, |
719 | .vmux = 1, | 812 | .amux = LINE1, |
720 | .amux = LINE2, | 813 | },{ |
721 | .tv = 1, | 814 | .name = name_tv, |
722 | }}, | 815 | .vmux = 1, |
723 | }, | 816 | .amux = LINE2, |
724 | [SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS] = { | 817 | .tv = 1, |
818 | }}, | ||
819 | }, | ||
820 | [SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS] = { | ||
725 | .name = "Compro VideoMate TV Gold+", | 821 | .name = "Compro VideoMate TV Gold+", |
726 | .audio_clock = 0x00187de7, | 822 | .audio_clock = 0x00187de7, |
727 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 823 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
728 | .gpiomask = 0x800c0000, | 824 | .gpiomask = 0x800c0000, |
729 | .inputs = {{ | 825 | .radio_type = UNSET, |
730 | .name = name_svideo, | 826 | .tuner_addr = ADDR_UNSET, |
731 | .vmux = 8, | 827 | .radio_addr = ADDR_UNSET, |
732 | .amux = LINE1, | 828 | .inputs = {{ |
733 | .gpio = 0x06c00012, | 829 | .name = name_svideo, |
734 | },{ | 830 | .vmux = 8, |
735 | .name = name_comp1, | 831 | .amux = LINE1, |
736 | .vmux = 3, | 832 | .gpio = 0x06c00012, |
737 | .amux = LINE1, | 833 | },{ |
738 | .gpio = 0x0ac20012, | 834 | .name = name_comp1, |
739 | },{ | 835 | .vmux = 3, |
740 | .name = name_tv, | 836 | .amux = LINE1, |
741 | .vmux = 1, | 837 | .gpio = 0x0ac20012, |
742 | .amux = LINE2, | 838 | },{ |
743 | .gpio = 0x08c20012, | 839 | .name = name_tv, |
744 | .tv = 1, | 840 | .vmux = 1, |
745 | }}, | 841 | .amux = LINE2, |
746 | }, | 842 | .gpio = 0x08c20012, |
843 | .tv = 1, | ||
844 | }}, /* radio and probably mute is missing */ | ||
845 | }, | ||
747 | [SAA7134_BOARD_CRONOS_PLUS] = { | 846 | [SAA7134_BOARD_CRONOS_PLUS] = { |
748 | /* gpio pins: | 847 | /* |
749 | 0 .. 3 BASE_ID | 848 | gpio pins: |
750 | 4 .. 7 PROTECT_ID | 849 | 0 .. 3 BASE_ID |
751 | 8 .. 11 USER_OUT | 850 | 4 .. 7 PROTECT_ID |
752 | 12 .. 13 USER_IN | 851 | 8 .. 11 USER_OUT |
753 | 14 .. 15 VIDIN_SEL */ | 852 | 12 .. 13 USER_IN |
853 | 14 .. 15 VIDIN_SEL | ||
854 | */ | ||
754 | .name = "Matrox CronosPlus", | 855 | .name = "Matrox CronosPlus", |
755 | .tuner_type = TUNER_ABSENT, | 856 | .tuner_type = TUNER_ABSENT, |
857 | .radio_type = UNSET, | ||
858 | .tuner_addr = ADDR_UNSET, | ||
859 | .radio_addr = ADDR_UNSET, | ||
756 | .gpiomask = 0xcf00, | 860 | .gpiomask = 0xcf00, |
757 | .inputs = {{ | 861 | .inputs = {{ |
758 | .name = name_comp1, | 862 | .name = name_comp1, |
759 | .vmux = 0, | 863 | .vmux = 0, |
760 | .gpio = 2 << 14, | 864 | .gpio = 2 << 14, |
761 | },{ | 865 | },{ |
762 | .name = name_comp2, | 866 | .name = name_comp2, |
763 | .vmux = 0, | 867 | .vmux = 0, |
764 | .gpio = 1 << 14, | 868 | .gpio = 1 << 14, |
765 | },{ | 869 | },{ |
766 | .name = name_comp3, | 870 | .name = name_comp3, |
767 | .vmux = 0, | 871 | .vmux = 0, |
768 | .gpio = 0 << 14, | 872 | .gpio = 0 << 14, |
769 | },{ | 873 | },{ |
770 | .name = name_comp4, | 874 | .name = name_comp4, |
771 | .vmux = 0, | 875 | .vmux = 0, |
772 | .gpio = 3 << 14, | 876 | .gpio = 3 << 14, |
773 | },{ | 877 | },{ |
774 | .name = name_svideo, | 878 | .name = name_svideo, |
775 | .vmux = 8, | 879 | .vmux = 8, |
776 | .gpio = 2 << 14, | 880 | .gpio = 2 << 14, |
777 | }}, | 881 | }}, |
778 | }, | 882 | }, |
779 | [SAA7134_BOARD_MD2819] = { | 883 | [SAA7134_BOARD_MD2819] = { |
780 | .name = "AverMedia M156 / Medion 2819", | 884 | .name = "AverMedia M156 / Medion 2819", |
781 | .audio_clock = 0x00187de7, | 885 | .audio_clock = 0x00187de7, |
782 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, | 886 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
887 | .radio_type = UNSET, | ||
888 | .tuner_addr = ADDR_UNSET, | ||
889 | .radio_addr = ADDR_UNSET, | ||
783 | .tda9887_conf = TDA9887_PRESENT, | 890 | .tda9887_conf = TDA9887_PRESENT, |
784 | .inputs = {{ | 891 | .inputs = {{ |
785 | .name = name_tv, | 892 | .name = name_tv, |
@@ -809,6 +916,9 @@ struct saa7134_board saa7134_boards[] = { | |||
809 | .name = "BMK MPEX Tuner", | 916 | .name = "BMK MPEX Tuner", |
810 | .audio_clock = 0x200000, | 917 | .audio_clock = 0x200000, |
811 | .tuner_type = TUNER_PHILIPS_PAL, | 918 | .tuner_type = TUNER_PHILIPS_PAL, |
919 | .radio_type = UNSET, | ||
920 | .tuner_addr = ADDR_UNSET, | ||
921 | .radio_addr = ADDR_UNSET, | ||
812 | .inputs = {{ | 922 | .inputs = {{ |
813 | .name = name_comp1, | 923 | .name = name_comp1, |
814 | .vmux = 1, | 924 | .vmux = 1, |
@@ -825,62 +935,72 @@ struct saa7134_board saa7134_boards[] = { | |||
825 | }}, | 935 | }}, |
826 | .mpeg = SAA7134_MPEG_EMPRESS, | 936 | .mpeg = SAA7134_MPEG_EMPRESS, |
827 | .video_out = CCIR656, | 937 | .video_out = CCIR656, |
828 | }, | 938 | }, |
829 | [SAA7134_BOARD_ASUSTEK_TVFM7133] = { | 939 | [SAA7134_BOARD_ASUSTEK_TVFM7133] = { |
830 | .name = "ASUS TV-FM 7133", | 940 | .name = "ASUS TV-FM 7133", |
831 | .audio_clock = 0x00187de7, | 941 | .audio_clock = 0x00187de7, |
832 | // probably wrong, the 7133 one is the NTSC version ... | 942 | /* probably wrong, the 7133 one is the NTSC version ... |
833 | // .tuner_type = TUNER_PHILIPS_FM1236_MK3 | 943 | * .tuner_type = TUNER_PHILIPS_FM1236_MK3 */ |
834 | .tuner_type = TUNER_LG_NTSC_NEW_TAPC, | 944 | .tuner_type = TUNER_LG_NTSC_NEW_TAPC, |
835 | .tda9887_conf = TDA9887_PRESENT, | 945 | .radio_type = UNSET, |
836 | .inputs = {{ | 946 | .tuner_addr = ADDR_UNSET, |
837 | .name = name_tv, | 947 | .radio_addr = ADDR_UNSET, |
838 | .vmux = 1, | 948 | .tda9887_conf = TDA9887_PRESENT, |
839 | .amux = TV, | 949 | .inputs = {{ |
840 | .tv = 1, | 950 | .name = name_tv, |
841 | },{ | 951 | .vmux = 1, |
842 | .name = name_comp1, | 952 | .amux = TV, |
843 | .vmux = 4, | 953 | .tv = 1, |
844 | .amux = LINE2, | 954 | |
845 | },{ | 955 | },{ |
846 | .name = name_svideo, | 956 | .name = name_comp1, |
847 | .vmux = 6, | 957 | .vmux = 4, |
848 | .amux = LINE2, | 958 | .amux = LINE2, |
849 | }}, | 959 | },{ |
850 | .radio = { | 960 | .name = name_svideo, |
851 | .name = name_radio, | 961 | .vmux = 6, |
852 | .amux = LINE1, | 962 | .amux = LINE2, |
853 | }, | 963 | }}, |
854 | }, | 964 | .radio = { |
965 | .name = name_radio, | ||
966 | .amux = LINE1, | ||
967 | }, | ||
968 | }, | ||
855 | [SAA7134_BOARD_PINNACLE_PCTV_STEREO] = { | 969 | [SAA7134_BOARD_PINNACLE_PCTV_STEREO] = { |
856 | .name = "Pinnacle PCTV Stereo (saa7134)", | 970 | .name = "Pinnacle PCTV Stereo (saa7134)", |
857 | .audio_clock = 0x00187de7, | 971 | .audio_clock = 0x00187de7, |
858 | .tuner_type = TUNER_MT2032, | 972 | .tuner_type = TUNER_MT2032, |
859 | .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER, | 973 | .radio_type = UNSET, |
860 | .inputs = {{ | 974 | .tuner_addr = ADDR_UNSET, |
861 | .name = name_tv, | 975 | .radio_addr = ADDR_UNSET, |
862 | .vmux = 3, | 976 | .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER, |
863 | .amux = TV, | 977 | .inputs = {{ |
864 | .tv = 1, | 978 | .name = name_tv, |
865 | },{ | 979 | .vmux = 3, |
866 | .name = name_comp1, | 980 | .amux = TV, |
867 | .vmux = 0, | 981 | .tv = 1, |
868 | .amux = LINE2, | 982 | },{ |
869 | },{ | 983 | .name = name_comp1, |
870 | .name = name_comp2, | 984 | .vmux = 0, |
871 | .vmux = 1, | 985 | .amux = LINE2, |
872 | .amux = LINE2, | 986 | },{ |
873 | },{ | 987 | .name = name_comp2, |
874 | .name = name_svideo, | 988 | .vmux = 1, |
875 | .vmux = 8, | 989 | .amux = LINE2, |
876 | .amux = LINE2, | 990 | },{ |
877 | }}, | 991 | .name = name_svideo, |
878 | }, | 992 | .vmux = 8, |
993 | .amux = LINE2, | ||
994 | }}, | ||
995 | }, | ||
879 | [SAA7134_BOARD_MANLI_MTV002] = { | 996 | [SAA7134_BOARD_MANLI_MTV002] = { |
880 | /* Ognjen Nastic <ognjen@logosoft.ba> */ | 997 | /* Ognjen Nastic <ognjen@logosoft.ba> */ |
881 | .name = "Manli MuchTV M-TV002/Behold TV 403 FM", | 998 | .name = "Manli MuchTV M-TV002/Behold TV 403 FM", |
882 | .audio_clock = 0x00200000, | 999 | .audio_clock = 0x00200000, |
883 | .tuner_type = TUNER_PHILIPS_PAL, | 1000 | .tuner_type = TUNER_PHILIPS_PAL, |
1001 | .radio_type = UNSET, | ||
1002 | .tuner_addr = ADDR_UNSET, | ||
1003 | .radio_addr = ADDR_UNSET, | ||
884 | .inputs = {{ | 1004 | .inputs = {{ |
885 | .name = name_svideo, | 1005 | .name = name_svideo, |
886 | .vmux = 8, | 1006 | .vmux = 8, |
@@ -905,6 +1025,9 @@ struct saa7134_board saa7134_boards[] = { | |||
905 | .name = "Manli MuchTV M-TV001/Behold TV 401", | 1025 | .name = "Manli MuchTV M-TV001/Behold TV 401", |
906 | .audio_clock = 0x00200000, | 1026 | .audio_clock = 0x00200000, |
907 | .tuner_type = TUNER_PHILIPS_PAL, | 1027 | .tuner_type = TUNER_PHILIPS_PAL, |
1028 | .radio_type = UNSET, | ||
1029 | .tuner_addr = ADDR_UNSET, | ||
1030 | .radio_addr = ADDR_UNSET, | ||
908 | .inputs = {{ | 1031 | .inputs = {{ |
909 | .name = name_svideo, | 1032 | .name = name_svideo, |
910 | .vmux = 8, | 1033 | .vmux = 8, |
@@ -921,14 +1044,17 @@ struct saa7134_board saa7134_boards[] = { | |||
921 | }}, | 1044 | }}, |
922 | .mute = { | 1045 | .mute = { |
923 | .name = name_mute, | 1046 | .name = name_mute, |
924 | .amux = LINE1, | 1047 | .amux = LINE1, |
925 | }, | 1048 | }, |
926 | }, | 1049 | }, |
927 | [SAA7134_BOARD_TG3000TV] = { | 1050 | [SAA7134_BOARD_TG3000TV] = { |
928 | /* TransGear 3000TV */ | 1051 | /* TransGear 3000TV */ |
929 | .name = "Nagase Sangyo TransGear 3000TV", | 1052 | .name = "Nagase Sangyo TransGear 3000TV", |
930 | .audio_clock = 0x00187de7, | 1053 | .audio_clock = 0x00187de7, |
931 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 1054 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
1055 | .radio_type = UNSET, | ||
1056 | .tuner_addr = ADDR_UNSET, | ||
1057 | .radio_addr = ADDR_UNSET, | ||
932 | .inputs = {{ | 1058 | .inputs = {{ |
933 | .name = name_tv, | 1059 | .name = name_tv, |
934 | .vmux = 1, | 1060 | .vmux = 1, |
@@ -944,81 +1070,90 @@ struct saa7134_board saa7134_boards[] = { | |||
944 | .amux = LINE2, | 1070 | .amux = LINE2, |
945 | }}, | 1071 | }}, |
946 | }, | 1072 | }, |
947 | [SAA7134_BOARD_ECS_TVP3XP] = { | 1073 | [SAA7134_BOARD_ECS_TVP3XP] = { |
948 | .name = "Elitegroup ECS TVP3XP FM1216 Tuner Card(PAL-BG,FM) ", | 1074 | .name = "Elitegroup ECS TVP3XP FM1216 Tuner Card(PAL-BG,FM) ", |
949 | .audio_clock = 0x187de7, // xtal 32.1 MHz | 1075 | .audio_clock = 0x187de7, /* xtal 32.1 MHz */ |
950 | .tuner_type = TUNER_PHILIPS_PAL, | 1076 | .tuner_type = TUNER_PHILIPS_PAL, |
951 | .inputs = {{ | 1077 | .radio_type = UNSET, |
952 | .name = name_tv, | 1078 | .tuner_addr = ADDR_UNSET, |
953 | .vmux = 1, | 1079 | .radio_addr = ADDR_UNSET, |
954 | .amux = TV, | 1080 | .inputs = {{ |
955 | .tv = 1, | 1081 | .name = name_tv, |
956 | },{ | 1082 | .vmux = 1, |
957 | .name = name_tv_mono, | 1083 | .amux = TV, |
958 | .vmux = 1, | 1084 | .tv = 1, |
959 | .amux = LINE2, | 1085 | },{ |
960 | .tv = 1, | 1086 | .name = name_tv_mono, |
961 | },{ | 1087 | .vmux = 1, |
962 | .name = name_comp1, | 1088 | .amux = LINE2, |
963 | .vmux = 3, | 1089 | .tv = 1, |
964 | .amux = LINE1, | 1090 | },{ |
965 | },{ | 1091 | .name = name_comp1, |
966 | .name = name_svideo, | 1092 | .vmux = 3, |
967 | .vmux = 8, | 1093 | .amux = LINE1, |
968 | .amux = LINE1, | 1094 | },{ |
1095 | .name = name_svideo, | ||
1096 | .vmux = 8, | ||
1097 | .amux = LINE1, | ||
969 | },{ | 1098 | },{ |
970 | .name = "CVid over SVid", | 1099 | .name = "CVid over SVid", |
971 | .vmux = 0, | 1100 | .vmux = 0, |
972 | .amux = LINE1, | 1101 | .amux = LINE1, |
973 | }}, | 1102 | }}, |
974 | .radio = { | 1103 | .radio = { |
975 | .name = name_radio, | 1104 | .name = name_radio, |
976 | .amux = LINE2, | 1105 | .amux = LINE2, |
977 | }, | 1106 | }, |
978 | }, | 1107 | }, |
979 | [SAA7134_BOARD_ECS_TVP3XP_4CB5] = { | 1108 | [SAA7134_BOARD_ECS_TVP3XP_4CB5] = { |
980 | .name = "Elitegroup ECS TVP3XP FM1236 Tuner Card (NTSC,FM)", | 1109 | .name = "Elitegroup ECS TVP3XP FM1236 Tuner Card (NTSC,FM)", |
981 | .audio_clock = 0x187de7, | 1110 | .audio_clock = 0x187de7, |
982 | .tuner_type = TUNER_PHILIPS_NTSC, | 1111 | .tuner_type = TUNER_PHILIPS_NTSC, |
983 | .inputs = {{ | 1112 | .radio_type = UNSET, |
984 | .name = name_tv, | 1113 | .tuner_addr = ADDR_UNSET, |
985 | .vmux = 1, | 1114 | .radio_addr = ADDR_UNSET, |
986 | .amux = TV, | 1115 | .inputs = {{ |
987 | .tv = 1, | 1116 | .name = name_tv, |
988 | },{ | 1117 | .vmux = 1, |
989 | .name = name_tv_mono, | 1118 | .amux = TV, |
990 | .vmux = 1, | 1119 | .tv = 1, |
991 | .amux = LINE2, | 1120 | },{ |
992 | .tv = 1, | 1121 | .name = name_tv_mono, |
993 | },{ | 1122 | .vmux = 1, |
994 | .name = name_comp1, | 1123 | .amux = LINE2, |
995 | .vmux = 3, | 1124 | .tv = 1, |
996 | .amux = LINE1, | 1125 | },{ |
997 | },{ | 1126 | .name = name_comp1, |
998 | .name = name_svideo, | 1127 | .vmux = 3, |
999 | .vmux = 8, | 1128 | .amux = LINE1, |
1000 | .amux = LINE1, | 1129 | },{ |
1001 | },{ | 1130 | .name = name_svideo, |
1002 | .name = "CVid over SVid", | 1131 | .vmux = 8, |
1003 | .vmux = 0, | 1132 | .amux = LINE1, |
1004 | .amux = LINE1, | 1133 | },{ |
1005 | }}, | 1134 | .name = "CVid over SVid", |
1006 | .radio = { | 1135 | .vmux = 0, |
1007 | .name = name_radio, | 1136 | .amux = LINE1, |
1008 | .amux = LINE2, | 1137 | }}, |
1009 | }, | 1138 | .radio = { |
1010 | }, | 1139 | .name = name_radio, |
1140 | .amux = LINE2, | ||
1141 | }, | ||
1142 | }, | ||
1011 | [SAA7134_BOARD_AVACSSMARTTV] = { | 1143 | [SAA7134_BOARD_AVACSSMARTTV] = { |
1012 | /* Roman Pszonczenko <romka@kolos.math.uni.lodz.pl> */ | 1144 | /* Roman Pszonczenko <romka@kolos.math.uni.lodz.pl> */ |
1013 | .name = "AVACS SmartTV", | 1145 | .name = "AVACS SmartTV", |
1014 | .audio_clock = 0x00187de7, | 1146 | .audio_clock = 0x00187de7, |
1015 | .tuner_type = TUNER_PHILIPS_PAL, | 1147 | .tuner_type = TUNER_PHILIPS_PAL, |
1148 | .radio_type = UNSET, | ||
1149 | .tuner_addr = ADDR_UNSET, | ||
1150 | .radio_addr = ADDR_UNSET, | ||
1016 | .inputs = {{ | 1151 | .inputs = {{ |
1017 | .name = name_tv, | 1152 | .name = name_tv, |
1018 | .vmux = 1, | 1153 | .vmux = 1, |
1019 | .amux = TV, | 1154 | .amux = TV, |
1020 | .tv = 1, | 1155 | .tv = 1, |
1021 | },{ | 1156 | },{ |
1022 | .name = name_tv_mono, | 1157 | .name = name_tv_mono, |
1023 | .vmux = 1, | 1158 | .vmux = 1, |
1024 | .amux = LINE2, | 1159 | .amux = LINE2, |
@@ -1047,6 +1182,9 @@ struct saa7134_board saa7134_boards[] = { | |||
1047 | .name = "AVerMedia DVD EZMaker", | 1182 | .name = "AVerMedia DVD EZMaker", |
1048 | .audio_clock = 0x00187de7, | 1183 | .audio_clock = 0x00187de7, |
1049 | .tuner_type = TUNER_ABSENT, | 1184 | .tuner_type = TUNER_ABSENT, |
1185 | .radio_type = UNSET, | ||
1186 | .tuner_addr = ADDR_UNSET, | ||
1187 | .radio_addr = ADDR_UNSET, | ||
1050 | .inputs = {{ | 1188 | .inputs = {{ |
1051 | .name = name_comp1, | 1189 | .name = name_comp1, |
1052 | .vmux = 3, | 1190 | .vmux = 3, |
@@ -1055,28 +1193,34 @@ struct saa7134_board saa7134_boards[] = { | |||
1055 | .vmux = 8, | 1193 | .vmux = 8, |
1056 | }}, | 1194 | }}, |
1057 | }, | 1195 | }, |
1058 | [SAA7134_BOARD_NOVAC_PRIMETV7133] = { | 1196 | [SAA7134_BOARD_NOVAC_PRIMETV7133] = { |
1059 | /* toshii@netbsd.org */ | 1197 | /* toshii@netbsd.org */ |
1060 | .name = "Noval Prime TV 7133", | 1198 | .name = "Noval Prime TV 7133", |
1061 | .audio_clock = 0x00200000, | 1199 | .audio_clock = 0x00200000, |
1062 | .tuner_type = TUNER_ALPS_TSBH1_NTSC, | 1200 | .tuner_type = TUNER_ALPS_TSBH1_NTSC, |
1063 | .inputs = {{ | 1201 | .radio_type = UNSET, |
1064 | .name = name_comp1, | 1202 | .tuner_addr = ADDR_UNSET, |
1065 | .vmux = 3, | 1203 | .radio_addr = ADDR_UNSET, |
1066 | },{ | 1204 | .inputs = {{ |
1067 | .name = name_tv, | 1205 | .name = name_comp1, |
1068 | .vmux = 1, | 1206 | .vmux = 3, |
1069 | .amux = TV, | 1207 | },{ |
1070 | .tv = 1, | 1208 | .name = name_tv, |
1071 | },{ | 1209 | .vmux = 1, |
1072 | .name = name_svideo, | 1210 | .amux = TV, |
1073 | .vmux = 8, | 1211 | .tv = 1, |
1074 | }}, | 1212 | },{ |
1075 | }, | 1213 | .name = name_svideo, |
1214 | .vmux = 8, | ||
1215 | }}, | ||
1216 | }, | ||
1076 | [SAA7134_BOARD_AVERMEDIA_STUDIO_305] = { | 1217 | [SAA7134_BOARD_AVERMEDIA_STUDIO_305] = { |
1077 | .name = "AverMedia AverTV Studio 305", | 1218 | .name = "AverMedia AverTV Studio 305", |
1078 | .audio_clock = 0x00187de7, | 1219 | .audio_clock = 0x00187de7, |
1079 | .tuner_type = TUNER_PHILIPS_FM1256_IH3, | 1220 | .tuner_type = TUNER_PHILIPS_FM1256_IH3, |
1221 | .radio_type = UNSET, | ||
1222 | .tuner_addr = ADDR_UNSET, | ||
1223 | .radio_addr = ADDR_UNSET, | ||
1080 | .tda9887_conf = TDA9887_PRESENT, | 1224 | .tda9887_conf = TDA9887_PRESENT, |
1081 | .inputs = {{ | 1225 | .inputs = {{ |
1082 | .name = name_tv, | 1226 | .name = name_tv, |
@@ -1097,35 +1241,41 @@ struct saa7134_board saa7134_boards[] = { | |||
1097 | .amux = LINE2, | 1241 | .amux = LINE2, |
1098 | }}, | 1242 | }}, |
1099 | .radio = { | 1243 | .radio = { |
1100 | .name = name_radio, | 1244 | .name = name_radio, |
1101 | .amux = LINE2, | 1245 | .amux = LINE2, |
1102 | }, | 1246 | }, |
1103 | .mute = { | 1247 | .mute = { |
1104 | .name = name_mute, | 1248 | .name = name_mute, |
1105 | .amux = LINE1, | 1249 | .amux = LINE1, |
1106 | }, | 1250 | }, |
1107 | }, | 1251 | }, |
1108 | [SAA7133_BOARD_UPMOST_PURPLE_TV] = { | 1252 | [SAA7134_BOARD_UPMOST_PURPLE_TV] = { |
1109 | .name = "UPMOST PURPLE TV", | 1253 | .name = "UPMOST PURPLE TV", |
1110 | .audio_clock = 0x00187de7, | 1254 | .audio_clock = 0x00187de7, |
1111 | .tuner_type = TUNER_PHILIPS_FM1236_MK3, | 1255 | .tuner_type = TUNER_PHILIPS_FM1236_MK3, |
1112 | .tda9887_conf = TDA9887_PRESENT, | 1256 | .radio_type = UNSET, |
1113 | .inputs = {{ | 1257 | .tuner_addr = ADDR_UNSET, |
1114 | .name = name_tv, | 1258 | .radio_addr = ADDR_UNSET, |
1115 | .vmux = 7, | 1259 | .tda9887_conf = TDA9887_PRESENT, |
1116 | .amux = TV, | 1260 | .inputs = {{ |
1117 | .tv = 1, | 1261 | .name = name_tv, |
1118 | },{ | 1262 | .vmux = 7, |
1119 | .name = name_svideo, | 1263 | .amux = TV, |
1120 | .vmux = 7, | 1264 | .tv = 1, |
1121 | .amux = LINE1, | 1265 | },{ |
1122 | }}, | 1266 | .name = name_svideo, |
1267 | .vmux = 7, | ||
1268 | .amux = LINE1, | ||
1269 | }}, | ||
1123 | }, | 1270 | }, |
1124 | [SAA7134_BOARD_ITEMS_MTV005] = { | 1271 | [SAA7134_BOARD_ITEMS_MTV005] = { |
1125 | /* Norman Jonas <normanjonas@arcor.de> */ | 1272 | /* Norman Jonas <normanjonas@arcor.de> */ |
1126 | .name = "Items MuchTV Plus / IT-005", | 1273 | .name = "Items MuchTV Plus / IT-005", |
1127 | .audio_clock = 0x00187de7, | 1274 | .audio_clock = 0x00187de7, |
1128 | .tuner_type = TUNER_PHILIPS_PAL, | 1275 | .tuner_type = TUNER_PHILIPS_PAL, |
1276 | .radio_type = UNSET, | ||
1277 | .tuner_addr = ADDR_UNSET, | ||
1278 | .radio_addr = ADDR_UNSET, | ||
1129 | .inputs = {{ | 1279 | .inputs = {{ |
1130 | .name = name_tv, | 1280 | .name = name_tv, |
1131 | .vmux = 3, | 1281 | .vmux = 3, |
@@ -1149,27 +1299,30 @@ struct saa7134_board saa7134_boards[] = { | |||
1149 | .name = "Terratec Cinergy 200 TV", | 1299 | .name = "Terratec Cinergy 200 TV", |
1150 | .audio_clock = 0x00200000, | 1300 | .audio_clock = 0x00200000, |
1151 | .tuner_type = TUNER_PHILIPS_PAL, | 1301 | .tuner_type = TUNER_PHILIPS_PAL, |
1302 | .radio_type = UNSET, | ||
1303 | .tuner_addr = ADDR_UNSET, | ||
1304 | .radio_addr = ADDR_UNSET, | ||
1152 | .inputs = {{ | 1305 | .inputs = {{ |
1153 | .name = name_tv, | 1306 | .name = name_tv, |
1154 | .vmux = 1, | 1307 | .vmux = 1, |
1155 | .amux = LINE2, | 1308 | .amux = LINE2, |
1156 | .tv = 1, | 1309 | .tv = 1, |
1157 | },{ | 1310 | },{ |
1158 | .name = name_comp1, | 1311 | .name = name_comp1, |
1159 | .vmux = 4, | 1312 | .vmux = 4, |
1160 | .amux = LINE1, | 1313 | .amux = LINE1, |
1161 | },{ | 1314 | },{ |
1162 | .name = name_svideo, | 1315 | .name = name_svideo, |
1163 | .vmux = 8, | 1316 | .vmux = 8, |
1164 | .amux = LINE1, | 1317 | .amux = LINE1, |
1165 | },{ | 1318 | },{ |
1166 | .name = name_comp2, // CVideo over SVideo Connector | 1319 | .name = name_comp2, /* CVideo over SVideo Connector */ |
1167 | .vmux = 0, | 1320 | .vmux = 0, |
1168 | .amux = LINE1, | 1321 | .amux = LINE1, |
1169 | }}, | 1322 | }}, |
1170 | .mute = { | 1323 | .mute = { |
1171 | .name = name_mute, | 1324 | .name = name_mute, |
1172 | .amux = LINE2, | 1325 | .amux = LINE2, |
1173 | }, | 1326 | }, |
1174 | }, | 1327 | }, |
1175 | [SAA7134_BOARD_VIDEOMATE_TV_PVR] = { | 1328 | [SAA7134_BOARD_VIDEOMATE_TV_PVR] = { |
@@ -1177,84 +1330,96 @@ struct saa7134_board saa7134_boards[] = { | |||
1177 | .name = "Compro VideoMate TV PVR/FM", | 1330 | .name = "Compro VideoMate TV PVR/FM", |
1178 | .audio_clock = 0x00187de7, | 1331 | .audio_clock = 0x00187de7, |
1179 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 1332 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
1333 | .radio_type = UNSET, | ||
1334 | .tuner_addr = ADDR_UNSET, | ||
1335 | .radio_addr = ADDR_UNSET, | ||
1180 | .gpiomask = 0x808c0080, | 1336 | .gpiomask = 0x808c0080, |
1181 | .inputs = {{ | 1337 | .inputs = {{ |
1182 | .name = name_svideo, | 1338 | .name = name_svideo, |
1183 | .vmux = 8, | 1339 | .vmux = 8, |
1184 | .amux = LINE1, | 1340 | .amux = LINE1, |
1185 | .gpio = 0x00080, | 1341 | .gpio = 0x00080, |
1186 | },{ | 1342 | },{ |
1187 | .name = name_comp1, | 1343 | .name = name_comp1, |
1188 | .vmux = 3, | 1344 | .vmux = 3, |
1189 | .amux = LINE1, | 1345 | .amux = LINE1, |
1190 | .gpio = 0x00080, | 1346 | .gpio = 0x00080, |
1191 | },{ | 1347 | },{ |
1192 | .name = name_tv, | 1348 | .name = name_tv, |
1193 | .vmux = 1, | 1349 | .vmux = 1, |
1194 | .amux = LINE2_LEFT, | 1350 | .amux = LINE2_LEFT, |
1195 | .tv = 1, | 1351 | .tv = 1, |
1196 | .gpio = 0x00080, | 1352 | .gpio = 0x00080, |
1197 | }}, | 1353 | }}, |
1198 | .radio = { | 1354 | .radio = { |
1199 | .name = name_radio, | 1355 | .name = name_radio, |
1200 | .amux = LINE2, | 1356 | .amux = LINE2, |
1201 | .gpio = 0x80000, | 1357 | .gpio = 0x80000, |
1202 | }, | 1358 | }, |
1203 | .mute = { | 1359 | .mute = { |
1204 | .name = name_mute, | 1360 | .name = name_mute, |
1205 | .amux = LINE2, | 1361 | .amux = LINE2, |
1206 | .gpio = 0x40000, | 1362 | .gpio = 0x40000, |
1207 | }, | 1363 | }, |
1208 | }, | 1364 | }, |
1209 | [SAA7134_BOARD_SABRENT_SBTTVFM] = { | 1365 | [SAA7134_BOARD_SABRENT_SBTTVFM] = { |
1210 | /* Michael Rodriguez-Torrent <mrtorrent@asu.edu> */ | 1366 | /* Michael Rodriguez-Torrent <mrtorrent@asu.edu> */ |
1211 | .name = "Sabrent SBT-TVFM (saa7130)", | 1367 | .name = "Sabrent SBT-TVFM (saa7130)", |
1212 | .audio_clock = 0x00187de7, | 1368 | .audio_clock = 0x00187de7, |
1213 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 1369 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
1214 | .inputs = {{ | 1370 | .radio_type = UNSET, |
1371 | .tuner_addr = ADDR_UNSET, | ||
1372 | .radio_addr = ADDR_UNSET, | ||
1373 | .inputs = {{ | ||
1215 | .name = name_comp1, | 1374 | .name = name_comp1, |
1216 | .vmux = 1, | 1375 | .vmux = 1, |
1217 | .amux = LINE2, | 1376 | .amux = LINE2, |
1218 | },{ | 1377 | },{ |
1219 | .name = name_tv, | 1378 | .name = name_tv, |
1220 | .vmux = 3, | 1379 | .vmux = 3, |
1221 | .amux = LINE2, | 1380 | .amux = LINE2, |
1222 | .tv = 1, | 1381 | .tv = 1, |
1223 | },{ | 1382 | },{ |
1224 | .name = name_svideo, | 1383 | .name = name_svideo, |
1225 | .vmux = 8, | 1384 | .vmux = 8, |
1226 | .amux = LINE2, | 1385 | .amux = LINE2, |
1227 | }}, | 1386 | }}, |
1228 | .radio = { | 1387 | .radio = { |
1229 | .name = name_radio, | 1388 | .name = name_radio, |
1230 | .amux = LINE2, | 1389 | .amux = LINE2, |
1231 | }, | 1390 | }, |
1232 | }, | 1391 | }, |
1233 | [SAA7134_BOARD_ZOLID_XPERT_TV7134] = { | 1392 | [SAA7134_BOARD_ZOLID_XPERT_TV7134] = { |
1234 | /* Helge Jensen <helge.jensen@slog.dk> */ | 1393 | /* Helge Jensen <helge.jensen@slog.dk> */ |
1235 | .name = ":Zolid Xpert TV7134", | 1394 | .name = ":Zolid Xpert TV7134", |
1236 | .audio_clock = 0x00187de7, | 1395 | .audio_clock = 0x00187de7, |
1237 | .tuner_type = TUNER_PHILIPS_NTSC, | 1396 | .tuner_type = TUNER_PHILIPS_NTSC, |
1238 | .inputs = {{ | 1397 | .radio_type = UNSET, |
1398 | .tuner_addr = ADDR_UNSET, | ||
1399 | .radio_addr = ADDR_UNSET, | ||
1400 | .inputs = {{ | ||
1239 | .name = name_svideo, | 1401 | .name = name_svideo, |
1240 | .vmux = 8, | 1402 | .vmux = 8, |
1241 | .amux = LINE1, | 1403 | .amux = LINE1, |
1242 | },{ | 1404 | },{ |
1243 | .name = name_comp1, | 1405 | .name = name_comp1, |
1244 | .vmux = 3, | 1406 | .vmux = 3, |
1245 | .amux = LINE1, | 1407 | .amux = LINE1, |
1246 | },{ | 1408 | },{ |
1247 | .name = name_tv, | 1409 | .name = name_tv, |
1248 | .vmux = 1, | 1410 | .vmux = 1, |
1249 | .amux = LINE2, | 1411 | .amux = LINE2, |
1250 | .tv = 1, | 1412 | .tv = 1, |
1251 | }}, | 1413 | }}, |
1252 | }, | 1414 | }, |
1253 | [SAA7134_BOARD_EMPIRE_PCI_TV_RADIO_LE] = { | 1415 | [SAA7134_BOARD_EMPIRE_PCI_TV_RADIO_LE] = { |
1254 | /* "Matteo Az" <matte.az@nospam.libero.it> ;-) */ | 1416 | /* "Matteo Az" <matte.az@nospam.libero.it> ;-) */ |
1255 | .name = "Empire PCI TV-Radio LE", | 1417 | .name = "Empire PCI TV-Radio LE", |
1256 | .audio_clock = 0x00187de7, | 1418 | .audio_clock = 0x00187de7, |
1257 | .tuner_type = TUNER_PHILIPS_PAL, | 1419 | .tuner_type = TUNER_PHILIPS_PAL, |
1420 | .radio_type = UNSET, | ||
1421 | .tuner_addr = ADDR_UNSET, | ||
1422 | .radio_addr = ADDR_UNSET, | ||
1258 | .gpiomask = 0x4000, | 1423 | .gpiomask = 0x4000, |
1259 | .inputs = {{ | 1424 | .inputs = {{ |
1260 | .name = name_tv_mono, | 1425 | .name = name_tv_mono, |
@@ -1273,18 +1438,18 @@ struct saa7134_board saa7134_boards[] = { | |||
1273 | .amux = LINE1, | 1438 | .amux = LINE1, |
1274 | .gpio = 0x8000, | 1439 | .gpio = 0x8000, |
1275 | }}, | 1440 | }}, |
1276 | .radio = { | 1441 | .radio = { |
1277 | .name = name_radio, | 1442 | .name = name_radio, |
1278 | .amux = LINE1, | 1443 | .amux = LINE1, |
1279 | .gpio = 0x8000, | 1444 | .gpio = 0x8000, |
1280 | }, | 1445 | }, |
1281 | .mute = { | 1446 | .mute = { |
1282 | .name = name_mute, | 1447 | .name = name_mute, |
1283 | .amux = TV, | 1448 | .amux = TV, |
1284 | .gpio =0x8000, | 1449 | .gpio =0x8000, |
1285 | } | 1450 | } |
1286 | }, | 1451 | }, |
1287 | [SAA7134_BOARD_AVERMEDIA_STUDIO_307] = { | 1452 | [SAA7134_BOARD_AVERMEDIA_STUDIO_307] = { |
1288 | /* | 1453 | /* |
1289 | Nickolay V. Shmyrev <nshmyrev@yandex.ru> | 1454 | Nickolay V. Shmyrev <nshmyrev@yandex.ru> |
1290 | Lots of thanks to Andrey Zolotarev <zolotarev_andrey@mail.ru> | 1455 | Lots of thanks to Andrey Zolotarev <zolotarev_andrey@mail.ru> |
@@ -1292,6 +1457,9 @@ struct saa7134_board saa7134_boards[] = { | |||
1292 | .name = "Avermedia AVerTV Studio 307", | 1457 | .name = "Avermedia AVerTV Studio 307", |
1293 | .audio_clock = 0x00187de7, | 1458 | .audio_clock = 0x00187de7, |
1294 | .tuner_type = TUNER_PHILIPS_FM1256_IH3, | 1459 | .tuner_type = TUNER_PHILIPS_FM1256_IH3, |
1460 | .radio_type = UNSET, | ||
1461 | .tuner_addr = ADDR_UNSET, | ||
1462 | .radio_addr = ADDR_UNSET, | ||
1295 | .tda9887_conf = TDA9887_PRESENT, | 1463 | .tda9887_conf = TDA9887_PRESENT, |
1296 | .gpiomask = 0x03, | 1464 | .gpiomask = 0x03, |
1297 | .inputs = {{ | 1465 | .inputs = {{ |
@@ -1321,13 +1489,21 @@ struct saa7134_board saa7134_boards[] = { | |||
1321 | .amux = LINE1, | 1489 | .amux = LINE1, |
1322 | .gpio = 0x01, | 1490 | .gpio = 0x01, |
1323 | }, | 1491 | }, |
1324 | }, | 1492 | .mute = { |
1325 | [SAA7134_BOARD_AVERMEDIA_GO_007_FM] = { | 1493 | .name = name_mute, |
1494 | .amux = LINE1, | ||
1495 | .gpio = 0x00, | ||
1496 | }, | ||
1497 | }, | ||
1498 | [SAA7134_BOARD_AVERMEDIA_GO_007_FM] = { | ||
1326 | .name = "Avermedia AVerTV GO 007 FM", | 1499 | .name = "Avermedia AVerTV GO 007 FM", |
1327 | .audio_clock = 0x00187de7, | 1500 | .audio_clock = 0x00187de7, |
1328 | .tuner_type = TUNER_PHILIPS_TDA8290, | 1501 | .tuner_type = TUNER_PHILIPS_TDA8290, |
1502 | .radio_type = UNSET, | ||
1503 | .tuner_addr = ADDR_UNSET, | ||
1504 | .radio_addr = ADDR_UNSET, | ||
1329 | .gpiomask = 0x00300003, | 1505 | .gpiomask = 0x00300003, |
1330 | // .gpiomask = 0x8c240003, | 1506 | /* .gpiomask = 0x8c240003, */ |
1331 | .inputs = {{ | 1507 | .inputs = {{ |
1332 | .name = name_tv, | 1508 | .name = name_tv, |
1333 | .vmux = 1, | 1509 | .vmux = 1, |
@@ -1350,16 +1526,24 @@ struct saa7134_board saa7134_boards[] = { | |||
1350 | .amux = LINE1, | 1526 | .amux = LINE1, |
1351 | .gpio = 0x00300001, | 1527 | .gpio = 0x00300001, |
1352 | }, | 1528 | }, |
1353 | }, | 1529 | .mute = { |
1530 | .name = name_mute, | ||
1531 | .amux = TV, | ||
1532 | .gpio = 0x01, | ||
1533 | }, | ||
1534 | }, | ||
1354 | [SAA7134_BOARD_AVERMEDIA_CARDBUS] = { | 1535 | [SAA7134_BOARD_AVERMEDIA_CARDBUS] = { |
1355 | /* Jon Westgate <oryn@oryn.fsck.tv> */ | 1536 | /* Kees.Blom@cwi.nl */ |
1356 | .name = "AVerMedia Cardbus TV/Radio", | 1537 | .name = "AVerMedia Cardbus TV/Radio (E500)", |
1357 | .audio_clock = 0x00200000, | 1538 | .audio_clock = 0x187de7, |
1358 | .tuner_type = TUNER_PHILIPS_PAL, | 1539 | .tuner_type = TUNER_PHILIPS_TDA8290, |
1540 | .radio_type = UNSET, | ||
1541 | .tuner_addr = ADDR_UNSET, | ||
1542 | .radio_addr = ADDR_UNSET, | ||
1359 | .inputs = {{ | 1543 | .inputs = {{ |
1360 | .name = name_tv, | 1544 | .name = name_tv, |
1361 | .vmux = 1, | 1545 | .vmux = 1, |
1362 | .amux = LINE2, | 1546 | .amux = TV, |
1363 | .tv = 1, | 1547 | .tv = 1, |
1364 | },{ | 1548 | },{ |
1365 | .name = name_comp1, | 1549 | .name = name_comp1, |
@@ -1368,10 +1552,10 @@ struct saa7134_board saa7134_boards[] = { | |||
1368 | },{ | 1552 | },{ |
1369 | .name = name_svideo, | 1553 | .name = name_svideo, |
1370 | .vmux = 8, | 1554 | .vmux = 8, |
1371 | .amux = LINE2, | 1555 | .amux = LINE1, |
1372 | }}, | 1556 | }}, |
1373 | .radio = { | 1557 | .radio = { |
1374 | .name = name_radio, | 1558 | .name = name_radio, |
1375 | .amux = LINE1, | 1559 | .amux = LINE1, |
1376 | }, | 1560 | }, |
1377 | }, | 1561 | }, |
@@ -1379,119 +1563,134 @@ struct saa7134_board saa7134_boards[] = { | |||
1379 | .name = "Terratec Cinergy 400 mobile", | 1563 | .name = "Terratec Cinergy 400 mobile", |
1380 | .audio_clock = 0x187de7, | 1564 | .audio_clock = 0x187de7, |
1381 | .tuner_type = TUNER_ALPS_TSBE5_PAL, | 1565 | .tuner_type = TUNER_ALPS_TSBE5_PAL, |
1382 | .tda9887_conf = TDA9887_PRESENT, | 1566 | .radio_type = UNSET, |
1567 | .tuner_addr = ADDR_UNSET, | ||
1568 | .radio_addr = ADDR_UNSET, | ||
1569 | .tda9887_conf = TDA9887_PRESENT, | ||
1383 | .inputs = {{ | 1570 | .inputs = {{ |
1384 | .name = name_tv, | 1571 | .name = name_tv, |
1385 | .vmux = 1, | 1572 | .vmux = 1, |
1386 | .amux = TV, | 1573 | .amux = TV, |
1387 | .tv = 1, | 1574 | .tv = 1, |
1388 | },{ | 1575 | },{ |
1389 | .name = name_tv_mono, | 1576 | .name = name_tv_mono, |
1390 | .vmux = 1, | 1577 | .vmux = 1, |
1391 | .amux = LINE2, | 1578 | .amux = LINE2, |
1392 | .tv = 1, | 1579 | .tv = 1, |
1393 | },{ | 1580 | },{ |
1394 | .name = name_comp1, | 1581 | .name = name_comp1, |
1395 | .vmux = 3, | 1582 | .vmux = 3, |
1396 | .amux = LINE1, | 1583 | .amux = LINE1, |
1397 | },{ | 1584 | },{ |
1398 | .name = name_svideo, | 1585 | .name = name_svideo, |
1399 | .vmux = 8, | 1586 | .vmux = 8, |
1400 | .amux = LINE1, | 1587 | .amux = LINE1, |
1401 | }}, | 1588 | }}, |
1402 | }, | 1589 | }, |
1403 | [SAA7134_BOARD_CINERGY600_MK3] = { | 1590 | [SAA7134_BOARD_CINERGY600_MK3] = { |
1404 | .name = "Terratec Cinergy 600 TV MK3", | 1591 | .name = "Terratec Cinergy 600 TV MK3", |
1405 | .audio_clock = 0x00200000, | 1592 | .audio_clock = 0x00200000, |
1406 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, | 1593 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
1407 | .tda9887_conf = TDA9887_PRESENT, | 1594 | .radio_type = UNSET, |
1408 | .inputs = {{ | 1595 | .tuner_addr = ADDR_UNSET, |
1409 | .name = name_tv, | 1596 | .radio_addr = ADDR_UNSET, |
1410 | .vmux = 1, | 1597 | .tda9887_conf = TDA9887_PRESENT, |
1411 | .amux = TV, | 1598 | .inputs = {{ |
1412 | .tv = 1, | 1599 | .name = name_tv, |
1413 | },{ | 1600 | .vmux = 1, |
1414 | .name = name_comp1, | 1601 | .amux = TV, |
1415 | .vmux = 4, | 1602 | .tv = 1, |
1416 | .amux = LINE1, | 1603 | },{ |
1417 | },{ | 1604 | .name = name_comp1, |
1418 | .name = name_svideo, | 1605 | .vmux = 4, |
1419 | .vmux = 8, | 1606 | .amux = LINE1, |
1420 | .amux = LINE1, | 1607 | },{ |
1421 | },{ | 1608 | .name = name_svideo, |
1422 | .name = name_comp2, // CVideo over SVideo Connector | 1609 | .vmux = 8, |
1423 | .vmux = 0, | 1610 | .amux = LINE1, |
1424 | .amux = LINE1, | 1611 | },{ |
1425 | }}, | 1612 | .name = name_comp2, /* CVideo over SVideo Connector */ |
1613 | .vmux = 0, | ||
1614 | .amux = LINE1, | ||
1615 | }}, | ||
1426 | .radio = { | 1616 | .radio = { |
1427 | .name = name_radio, | 1617 | .name = name_radio, |
1428 | .amux = LINE2, | 1618 | .amux = LINE2, |
1429 | }, | 1619 | }, |
1430 | }, | 1620 | }, |
1431 | [SAA7134_BOARD_VIDEOMATE_GOLD_PLUS] = { | 1621 | [SAA7134_BOARD_VIDEOMATE_GOLD_PLUS] = { |
1432 | /* Dylan Walkden <dylan_walkden@hotmail.com> */ | 1622 | /* Dylan Walkden <dylan_walkden@hotmail.com> */ |
1433 | .name = "Compro VideoMate Gold+ Pal", | 1623 | .name = "Compro VideoMate Gold+ Pal", |
1434 | .audio_clock = 0x00187de7, | 1624 | .audio_clock = 0x00187de7, |
1435 | .tuner_type = TUNER_PHILIPS_PAL, | 1625 | .tuner_type = TUNER_PHILIPS_PAL, |
1436 | .gpiomask = 0x1ce780, | 1626 | .radio_type = UNSET, |
1437 | .inputs = {{ | 1627 | .tuner_addr = ADDR_UNSET, |
1438 | .name = name_svideo, | 1628 | .radio_addr = ADDR_UNSET, |
1439 | .vmux = 0, // CVideo over SVideo Connector - ok? | 1629 | .gpiomask = 0x1ce780, |
1440 | .amux = LINE1, | 1630 | .inputs = {{ |
1441 | .gpio = 0x008080, | 1631 | .name = name_svideo, |
1442 | },{ | 1632 | .vmux = 0, /* CVideo over SVideo Connector - ok? */ |
1443 | .name = name_comp1, | 1633 | .amux = LINE1, |
1444 | .vmux = 3, | 1634 | .gpio = 0x008080, |
1445 | .amux = LINE1, | 1635 | },{ |
1446 | .gpio = 0x008080, | 1636 | .name = name_comp1, |
1447 | },{ | 1637 | .vmux = 3, |
1448 | .name = name_tv, | 1638 | .amux = LINE1, |
1449 | .vmux = 1, | 1639 | .gpio = 0x008080, |
1450 | .amux = TV, | 1640 | },{ |
1451 | .tv = 1, | 1641 | .name = name_tv, |
1452 | .gpio = 0x008080, | 1642 | .vmux = 1, |
1453 | }}, | 1643 | .amux = TV, |
1454 | .radio = { | 1644 | .tv = 1, |
1455 | .name = name_radio, | 1645 | .gpio = 0x008080, |
1456 | .amux = LINE2, | 1646 | }}, |
1457 | .gpio = 0x80000, | 1647 | .radio = { |
1458 | }, | 1648 | .name = name_radio, |
1459 | .mute = { | 1649 | .amux = LINE2, |
1460 | .name = name_mute, | 1650 | .gpio = 0x80000, |
1461 | .amux = LINE2, | 1651 | }, |
1462 | .gpio = 0x0c8000, | 1652 | .mute = { |
1463 | }, | 1653 | .name = name_mute, |
1464 | }, | 1654 | .amux = LINE2, |
1655 | .gpio = 0x0c8000, | ||
1656 | }, | ||
1657 | }, | ||
1465 | [SAA7134_BOARD_PINNACLE_300I_DVBT_PAL] = { | 1658 | [SAA7134_BOARD_PINNACLE_300I_DVBT_PAL] = { |
1466 | .name = "Pinnacle PCTV 300i DVB-T + PAL", | 1659 | .name = "Pinnacle PCTV 300i DVB-T + PAL", |
1467 | .audio_clock = 0x00187de7, | 1660 | .audio_clock = 0x00187de7, |
1468 | .tuner_type = TUNER_MT2032, | 1661 | .tuner_type = TUNER_MT2032, |
1469 | .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER, | 1662 | .radio_type = UNSET, |
1663 | .tuner_addr = ADDR_UNSET, | ||
1664 | .radio_addr = ADDR_UNSET, | ||
1665 | .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER, | ||
1470 | .mpeg = SAA7134_MPEG_DVB, | 1666 | .mpeg = SAA7134_MPEG_DVB, |
1471 | .inputs = {{ | 1667 | .inputs = {{ |
1472 | .name = name_tv, | 1668 | .name = name_tv, |
1473 | .vmux = 3, | 1669 | .vmux = 3, |
1474 | .amux = TV, | 1670 | .amux = TV, |
1475 | .tv = 1, | 1671 | .tv = 1, |
1476 | },{ | 1672 | },{ |
1477 | .name = name_comp1, | 1673 | .name = name_comp1, |
1478 | .vmux = 0, | 1674 | .vmux = 0, |
1479 | .amux = LINE2, | 1675 | .amux = LINE2, |
1480 | },{ | 1676 | },{ |
1481 | .name = name_comp2, | 1677 | .name = name_comp2, |
1482 | .vmux = 1, | 1678 | .vmux = 1, |
1483 | .amux = LINE2, | 1679 | .amux = LINE2, |
1484 | },{ | 1680 | },{ |
1485 | .name = name_svideo, | 1681 | .name = name_svideo, |
1486 | .vmux = 8, | 1682 | .vmux = 8, |
1487 | .amux = LINE2, | 1683 | .amux = LINE2, |
1488 | }}, | 1684 | }}, |
1489 | }, | 1685 | }, |
1490 | [SAA7134_BOARD_PROVIDEO_PV952] = { | 1686 | [SAA7134_BOARD_PROVIDEO_PV952] = { |
1491 | /* andreas.kretschmer@web.de */ | 1687 | /* andreas.kretschmer@web.de */ |
1492 | .name = "ProVideo PV952", | 1688 | .name = "ProVideo PV952", |
1493 | .audio_clock = 0x00187de7, | 1689 | .audio_clock = 0x00187de7, |
1494 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, | 1690 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
1691 | .radio_type = UNSET, | ||
1692 | .tuner_addr = ADDR_UNSET, | ||
1693 | .radio_addr = ADDR_UNSET, | ||
1495 | .tda9887_conf = TDA9887_PRESENT, | 1694 | .tda9887_conf = TDA9887_PRESENT, |
1496 | .inputs = {{ | 1695 | .inputs = {{ |
1497 | .name = name_comp1, | 1696 | .name = name_comp1, |
@@ -1515,10 +1714,13 @@ struct saa7134_board saa7134_boards[] = { | |||
1515 | }, | 1714 | }, |
1516 | [SAA7134_BOARD_AVERMEDIA_305] = { | 1715 | [SAA7134_BOARD_AVERMEDIA_305] = { |
1517 | /* much like the "studio" version but without radio | 1716 | /* much like the "studio" version but without radio |
1518 | * and another tuner (sirspiritus@yandex.ru) */ | 1717 | * and another tuner (sirspiritus@yandex.ru) */ |
1519 | .name = "AverMedia AverTV/305", | 1718 | .name = "AverMedia AverTV/305", |
1520 | .audio_clock = 0x00187de7, | 1719 | .audio_clock = 0x00187de7, |
1521 | .tuner_type = TUNER_PHILIPS_FQ1216ME, | 1720 | .tuner_type = TUNER_PHILIPS_FQ1216ME, |
1721 | .radio_type = UNSET, | ||
1722 | .tuner_addr = ADDR_UNSET, | ||
1723 | .radio_addr = ADDR_UNSET, | ||
1522 | .tda9887_conf = TDA9887_PRESENT, | 1724 | .tda9887_conf = TDA9887_PRESENT, |
1523 | .inputs = {{ | 1725 | .inputs = {{ |
1524 | .name = name_tv, | 1726 | .name = name_tv, |
@@ -1539,115 +1741,268 @@ struct saa7134_board saa7134_boards[] = { | |||
1539 | .amux = LINE2, | 1741 | .amux = LINE2, |
1540 | }}, | 1742 | }}, |
1541 | .mute = { | 1743 | .mute = { |
1542 | .name = name_mute, | 1744 | .name = name_mute, |
1543 | .amux = LINE1, | 1745 | .amux = LINE1, |
1544 | }, | 1746 | }, |
1545 | }, | 1747 | }, |
1546 | [SAA7134_BOARD_FLYDVBTDUO] = { | 1748 | [SAA7134_BOARD_FLYDVBTDUO] = { |
1547 | /* LifeView FlyDVB-T DUO */ | 1749 | /* LifeView FlyDVB-T DUO */ |
1548 | /* "Nico Sabbi <nsabbi@tiscali.it> */ | 1750 | /* "Nico Sabbi <nsabbi@tiscali.it> Hartmut Hackmann hartmut.hackmann@t-online.de*/ |
1549 | .name = "LifeView FlyDVB-T DUO", | 1751 | .name = "LifeView FlyDVB-T DUO", |
1550 | .audio_clock = 0x00200000, | 1752 | .audio_clock = 0x00200000, |
1551 | .tuner_type = TUNER_PHILIPS_TDA8290, | 1753 | .tuner_type = TUNER_PHILIPS_TDA8290, |
1552 | // .gpiomask = 0xe000, | 1754 | .radio_type = UNSET, |
1755 | .tuner_addr = ADDR_UNSET, | ||
1756 | .radio_addr = ADDR_UNSET, | ||
1757 | .mpeg = SAA7134_MPEG_DVB, | ||
1553 | .inputs = {{ | 1758 | .inputs = {{ |
1554 | .name = name_tv, | 1759 | .name = name_tv, |
1555 | .vmux = 1, | 1760 | .vmux = 1, |
1556 | .amux = TV, | 1761 | .amux = TV, |
1557 | // .gpio = 0x0000, | ||
1558 | .tv = 1, | 1762 | .tv = 1, |
1559 | },{ | 1763 | },{ |
1560 | .name = name_comp1, /* Composite signal on S-Video input */ | 1764 | .name = name_comp1, /* Composite signal on S-Video input */ |
1561 | .vmux = 0, | 1765 | .vmux = 0, |
1562 | .amux = LINE2, | 1766 | .amux = LINE2, |
1563 | // .gpio = 0x4000, | ||
1564 | },{ | 1767 | },{ |
1565 | .name = name_comp2, /* Composite input */ | 1768 | .name = name_comp2, /* Composite input */ |
1566 | .vmux = 3, | 1769 | .vmux = 3, |
1567 | .amux = LINE2, | 1770 | .amux = LINE2, |
1568 | // .gpio = 0x4000, | ||
1569 | },{ | 1771 | },{ |
1570 | .name = name_svideo, /* S-Video signal on S-Video input */ | 1772 | .name = name_svideo, /* S-Video signal on S-Video input */ |
1571 | .vmux = 8, | 1773 | .vmux = 8, |
1572 | .amux = LINE2, | 1774 | .amux = LINE2, |
1573 | // .gpio = 0x4000, | ||
1574 | }}, | 1775 | }}, |
1575 | }, | 1776 | }, |
1576 | [SAA7134_BOARD_AVERMEDIA_307] = { | 1777 | [SAA7134_BOARD_PHILIPS_TOUGH] = { |
1577 | /* | 1778 | .name = "Philips TOUGH DVB-T reference design", |
1578 | Davydov Vladimir <vladimir@iqmedia.com> | 1779 | .tuner_type = TUNER_ABSENT, |
1579 | */ | 1780 | .audio_clock = 0x00187de7, |
1580 | .name = "Avermedia AVerTV 307", | 1781 | .radio_type = UNSET, |
1581 | .audio_clock = 0x00187de7, | 1782 | .tuner_addr = ADDR_UNSET, |
1582 | .tuner_type = TUNER_PHILIPS_FQ1216ME, | 1783 | .radio_addr = ADDR_UNSET, |
1583 | .tda9887_conf = TDA9887_PRESENT, | 1784 | .mpeg = SAA7134_MPEG_DVB, |
1584 | .inputs = {{ | 1785 | .inputs = {{ |
1585 | .name = name_tv, | 1786 | .name = name_comp1, |
1586 | .vmux = 1, | 1787 | .vmux = 0, |
1587 | .amux = TV, | 1788 | .amux = LINE1, |
1588 | .tv = 1, | 1789 | },{ |
1589 | },{ | 1790 | .name = name_svideo, |
1590 | .name = name_comp1, | 1791 | .vmux = 8, |
1591 | .vmux = 0, | 1792 | .amux = LINE1, |
1592 | .amux = LINE1, | 1793 | }}, |
1593 | },{ | 1794 | }, |
1594 | .name = name_comp2, | 1795 | [SAA7134_BOARD_AVERMEDIA_307] = { |
1595 | .vmux = 3, | 1796 | /* |
1596 | .amux = LINE1, | 1797 | Davydov Vladimir <vladimir@iqmedia.com> |
1597 | },{ | 1798 | */ |
1598 | .name = name_svideo, | 1799 | .name = "Avermedia AVerTV 307", |
1599 | .vmux = 8, | 1800 | .audio_clock = 0x00187de7, |
1600 | .amux = LINE1, | 1801 | .tuner_type = TUNER_PHILIPS_FQ1216ME, |
1601 | }}, | 1802 | .radio_type = UNSET, |
1602 | }, | 1803 | .tuner_addr = ADDR_UNSET, |
1804 | .radio_addr = ADDR_UNSET, | ||
1805 | .tda9887_conf = TDA9887_PRESENT, | ||
1806 | .inputs = {{ | ||
1807 | .name = name_tv, | ||
1808 | .vmux = 1, | ||
1809 | .amux = TV, | ||
1810 | .tv = 1, | ||
1811 | },{ | ||
1812 | .name = name_comp1, | ||
1813 | .vmux = 0, | ||
1814 | .amux = LINE1, | ||
1815 | },{ | ||
1816 | .name = name_comp2, | ||
1817 | .vmux = 3, | ||
1818 | .amux = LINE1, | ||
1819 | },{ | ||
1820 | .name = name_svideo, | ||
1821 | .vmux = 8, | ||
1822 | .amux = LINE1, | ||
1823 | }}, | ||
1824 | }, | ||
1603 | [SAA7134_BOARD_ADS_INSTANT_TV] = { | 1825 | [SAA7134_BOARD_ADS_INSTANT_TV] = { |
1604 | .name = "ADS Tech Instant TV (saa7135)", | 1826 | .name = "ADS Tech Instant TV (saa7135)", |
1827 | .audio_clock = 0x00187de7, | ||
1828 | .tuner_type = TUNER_PHILIPS_TDA8290, | ||
1829 | .radio_type = UNSET, | ||
1830 | .tuner_addr = ADDR_UNSET, | ||
1831 | .radio_addr = ADDR_UNSET, | ||
1832 | .inputs = {{ | ||
1833 | .name = name_tv, | ||
1834 | .vmux = 1, | ||
1835 | .amux = TV, | ||
1836 | .tv = 1, | ||
1837 | },{ | ||
1838 | .name = name_comp1, | ||
1839 | .vmux = 3, | ||
1840 | .amux = LINE2, | ||
1841 | },{ | ||
1842 | .name = name_svideo, | ||
1843 | .vmux = 8, | ||
1844 | .amux = LINE2, | ||
1845 | }}, | ||
1846 | }, | ||
1847 | [SAA7134_BOARD_KWORLD_VSTREAM_XPERT] = { | ||
1848 | .name = "Kworld/Tevion V-Stream Xpert TV PVR7134", | ||
1605 | .audio_clock = 0x00187de7, | 1849 | .audio_clock = 0x00187de7, |
1606 | .tuner_type = TUNER_PHILIPS_TDA8290, | 1850 | .tuner_type = TUNER_PHILIPS_PAL_I, |
1607 | .inputs = {{ | 1851 | .radio_type = UNSET, |
1608 | .name = name_tv, | 1852 | .tuner_addr = ADDR_UNSET, |
1609 | .vmux = 1, | 1853 | .radio_addr = ADDR_UNSET, |
1610 | .amux = TV, | 1854 | .gpiomask = 0x0700, |
1611 | .tv = 1, | 1855 | .inputs = {{ |
1612 | },{ | 1856 | .name = name_tv, |
1613 | .name = name_comp1, | 1857 | .vmux = 1, |
1614 | .vmux = 3, | 1858 | .amux = TV, |
1615 | .amux = LINE2, | 1859 | .tv = 1, |
1616 | },{ | 1860 | .gpio = 0x000, |
1617 | .name = name_svideo, | 1861 | },{ |
1618 | .vmux = 8, | 1862 | .name = name_comp1, |
1619 | .amux = LINE2, | 1863 | .vmux = 3, |
1620 | }}, | 1864 | .amux = LINE1, |
1621 | }, | 1865 | .gpio = 0x200, /* gpio by DScaler */ |
1622 | [SAA7134_BOARD_KWORLD_VSTREAM_XPERT] = { | 1866 | },{ |
1623 | .name = "Kworld/Tevion V-Stream Xpert TV PVR7134", | 1867 | .name = name_svideo, |
1624 | .audio_clock = 0x00187de7, | 1868 | .vmux = 0, |
1625 | .tuner_type = TUNER_PHILIPS_PAL_I, | 1869 | .amux = LINE1, |
1626 | .gpiomask = 0x0700, | 1870 | .gpio = 0x200, |
1627 | .inputs = {{ | 1871 | }}, |
1628 | .name = name_tv, | 1872 | .radio = { |
1629 | .vmux = 1, | 1873 | .name = name_radio, |
1630 | .amux = TV, | 1874 | .amux = LINE1, |
1631 | .tv = 1, | 1875 | .gpio = 0x100, |
1632 | .gpio = 0x000, | 1876 | }, |
1633 | },{ | 1877 | .mute = { |
1634 | .name = name_comp1, | 1878 | .name = name_mute, |
1635 | .vmux = 3, | 1879 | .amux = TV, |
1636 | .amux = LINE1, | 1880 | .gpio = 0x000, |
1637 | .gpio = 0x200, //gpio by DScaler | 1881 | }, |
1638 | },{ | 1882 | }, |
1639 | .name = name_svideo, | 1883 | [SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS] = { |
1640 | .vmux = 0, | 1884 | .name = "Typhoon DVB-T Duo Digital/Analog Cardbus", |
1641 | .amux = LINE1, | 1885 | .audio_clock = 0x00200000, |
1642 | .gpio = 0x200, | 1886 | .tuner_type = TUNER_PHILIPS_TDA8290, |
1643 | }}, | 1887 | .radio_type = UNSET, |
1644 | .radio = { | 1888 | .tuner_addr = ADDR_UNSET, |
1645 | .name = name_radio, | 1889 | .radio_addr = ADDR_UNSET, |
1646 | .amux = LINE1, | 1890 | .mpeg = SAA7134_MPEG_DVB, |
1647 | .gpio = 0x100, | 1891 | /* .gpiomask = 0xe000, */ |
1648 | }, | 1892 | .inputs = {{ |
1649 | }, | 1893 | .name = name_tv, |
1650 | }; | 1894 | .vmux = 1, |
1895 | .amux = TV, | ||
1896 | /* .gpio = 0x0000, */ | ||
1897 | .tv = 1, | ||
1898 | },{ | ||
1899 | .name = name_comp1, /* Composite signal on S-Video input */ | ||
1900 | .vmux = 0, | ||
1901 | .amux = LINE2, | ||
1902 | /* .gpio = 0x4000, */ | ||
1903 | },{ | ||
1904 | .name = name_comp2, /* Composite input */ | ||
1905 | .vmux = 3, | ||
1906 | .amux = LINE2, | ||
1907 | /* .gpio = 0x4000, */ | ||
1908 | },{ | ||
1909 | .name = name_svideo, /* S-Video signal on S-Video input */ | ||
1910 | .vmux = 8, | ||
1911 | .amux = LINE2, | ||
1912 | /* .gpio = 0x4000, */ | ||
1913 | }}, | ||
1914 | .radio = { | ||
1915 | .name = name_radio, | ||
1916 | .amux = LINE2, | ||
1917 | }, | ||
1918 | .mute = { | ||
1919 | .name = name_mute, | ||
1920 | .amux = LINE1, | ||
1921 | }, | ||
1922 | }, | ||
1923 | [SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII] = { | ||
1924 | .name = "Compro VideoMate TV Gold+II", | ||
1925 | .audio_clock = 0x002187de7, | ||
1926 | .tuner_type = TUNER_LG_PAL_NEW_TAPC, | ||
1927 | .radio_type = TUNER_TEA5767, | ||
1928 | .tuner_addr = 0x63, | ||
1929 | .radio_addr = 0x60, | ||
1930 | .gpiomask = 0x8c1880, | ||
1931 | .inputs = {{ | ||
1932 | .name = name_svideo, | ||
1933 | .vmux = 0, | ||
1934 | .amux = LINE1, | ||
1935 | .gpio = 0x800800, | ||
1936 | },{ | ||
1937 | .name = name_comp1, | ||
1938 | .vmux = 3, | ||
1939 | .amux = LINE1, | ||
1940 | .gpio = 0x801000, | ||
1941 | },{ | ||
1942 | .name = name_tv, | ||
1943 | .vmux = 1, | ||
1944 | .amux = TV, | ||
1945 | .tv = 1, | ||
1946 | .gpio = 0x800000, | ||
1947 | }}, | ||
1948 | .radio = { | ||
1949 | .name = name_radio, | ||
1950 | .amux = TV, | ||
1951 | .gpio = 0x880000, | ||
1952 | }, | ||
1953 | .mute = { | ||
1954 | .name = name_mute, | ||
1955 | .amux = LINE2, | ||
1956 | .gpio = 0x840000, | ||
1957 | }, | ||
1958 | }, | ||
1959 | [SAA7134_BOARD_KWORLD_XPERT] = { | ||
1960 | /* | ||
1961 | FIXME: | ||
1962 | - Remote control doesn't initialize properly. | ||
1963 | - Audio volume starts muted, | ||
1964 | then gradually increases after channel change. | ||
1965 | - Overlay scaling problems (application error?) | ||
1966 | - Composite S-Video untested. | ||
1967 | From: Konrad Rzepecki <hannibal@megapolis.pl> | ||
1968 | */ | ||
1969 | .name = "Kworld Xpert TV PVR7134", | ||
1970 | .audio_clock = 0x00187de7, | ||
1971 | .tuner_type = TUNER_TENA_9533_DI, | ||
1972 | .radio_type = TUNER_TEA5767, | ||
1973 | .tuner_addr = 0x61, | ||
1974 | .radio_addr = 0x60, | ||
1975 | .gpiomask = 0x0700, | ||
1976 | .inputs = {{ | ||
1977 | .name = name_tv, | ||
1978 | .vmux = 1, | ||
1979 | .amux = TV, | ||
1980 | .tv = 1, | ||
1981 | .gpio = 0x000, | ||
1982 | },{ | ||
1983 | .name = name_comp1, | ||
1984 | .vmux = 3, | ||
1985 | .amux = LINE1, | ||
1986 | .gpio = 0x200, /* gpio by DScaler */ | ||
1987 | },{ | ||
1988 | .name = name_svideo, | ||
1989 | .vmux = 0, | ||
1990 | .amux = LINE1, | ||
1991 | .gpio = 0x200, | ||
1992 | }}, | ||
1993 | .radio = { | ||
1994 | .name = name_radio, | ||
1995 | .amux = LINE1, | ||
1996 | .gpio = 0x100, | ||
1997 | }, | ||
1998 | .mute = { | ||
1999 | .name = name_mute, | ||
2000 | .amux = TV, | ||
2001 | .gpio = 0x000, | ||
2002 | }, | ||
2003 | }, | ||
2004 | }; | ||
2005 | |||
1651 | 2006 | ||
1652 | const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); | 2007 | const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); |
1653 | 2008 | ||
@@ -1661,13 +2016,13 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
1661 | .subvendor = PCI_VENDOR_ID_PHILIPS, | 2016 | .subvendor = PCI_VENDOR_ID_PHILIPS, |
1662 | .subdevice = 0x2001, | 2017 | .subdevice = 0x2001, |
1663 | .driver_data = SAA7134_BOARD_PROTEUS_PRO, | 2018 | .driver_data = SAA7134_BOARD_PROTEUS_PRO, |
1664 | },{ | 2019 | },{ |
1665 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2020 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1666 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2021 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1667 | .subvendor = PCI_VENDOR_ID_PHILIPS, | 2022 | .subvendor = PCI_VENDOR_ID_PHILIPS, |
1668 | .subdevice = 0x2001, | 2023 | .subdevice = 0x2001, |
1669 | .driver_data = SAA7134_BOARD_PROTEUS_PRO, | 2024 | .driver_data = SAA7134_BOARD_PROTEUS_PRO, |
1670 | },{ | 2025 | },{ |
1671 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2026 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1672 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2027 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1673 | .subvendor = PCI_VENDOR_ID_PHILIPS, | 2028 | .subvendor = PCI_VENDOR_ID_PHILIPS, |
@@ -1676,70 +2031,70 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
1676 | },{ | 2031 | },{ |
1677 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2032 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1678 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2033 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1679 | .subvendor = 0x1131, | 2034 | .subvendor = 0x1131, |
1680 | .subdevice = 0x4e85, | 2035 | .subdevice = 0x4e85, |
1681 | .driver_data = SAA7134_BOARD_MONSTERTV, | 2036 | .driver_data = SAA7134_BOARD_MONSTERTV, |
1682 | },{ | 2037 | },{ |
1683 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2038 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1684 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2039 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1685 | .subvendor = 0x153B, | 2040 | .subvendor = 0x153B, |
1686 | .subdevice = 0x1142, | 2041 | .subdevice = 0x1142, |
1687 | .driver_data = SAA7134_BOARD_CINERGY400, | 2042 | .driver_data = SAA7134_BOARD_CINERGY400, |
1688 | },{ | 2043 | },{ |
1689 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2044 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1690 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2045 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1691 | .subvendor = 0x153B, | 2046 | .subvendor = 0x153B, |
1692 | .subdevice = 0x1143, | 2047 | .subdevice = 0x1143, |
1693 | .driver_data = SAA7134_BOARD_CINERGY600, | 2048 | .driver_data = SAA7134_BOARD_CINERGY600, |
1694 | },{ | 2049 | },{ |
1695 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2050 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1696 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2051 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1697 | .subvendor = 0x153B, | 2052 | .subvendor = 0x153B, |
1698 | .subdevice = 0x1158, | 2053 | .subdevice = 0x1158, |
1699 | .driver_data = SAA7134_BOARD_CINERGY600_MK3, | 2054 | .driver_data = SAA7134_BOARD_CINERGY600_MK3, |
1700 | },{ | 2055 | },{ |
1701 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2056 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1702 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2057 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1703 | .subvendor = 0x153b, | 2058 | .subvendor = 0x153b, |
1704 | .subdevice = 0x1162, | 2059 | .subdevice = 0x1162, |
1705 | .driver_data = SAA7134_BOARD_CINERGY400_CARDBUS, | 2060 | .driver_data = SAA7134_BOARD_CINERGY400_CARDBUS, |
1706 | },{ | 2061 | },{ |
1707 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2062 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1708 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2063 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1709 | .subvendor = 0x5168, | 2064 | .subvendor = 0x5168, |
1710 | .subdevice = 0x0138, | 2065 | .subdevice = 0x0138, |
1711 | .driver_data = SAA7134_BOARD_FLYVIDEO3000, | 2066 | .driver_data = SAA7134_BOARD_FLYVIDEO3000, |
1712 | },{ | 2067 | },{ |
1713 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2068 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1714 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2069 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1715 | .subvendor = 0x4e42, //"Typhoon PCI Capture TV Card" Art.No. 50673 | 2070 | .subvendor = 0x4e42, /* "Typhoon PCI Capture TV Card" Art.No. 50673 */ |
1716 | .subdevice = 0x0138, | 2071 | .subdevice = 0x0138, |
1717 | .driver_data = SAA7134_BOARD_FLYVIDEO3000, | 2072 | .driver_data = SAA7134_BOARD_FLYVIDEO3000, |
1718 | },{ | 2073 | },{ |
1719 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2074 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1720 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2075 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1721 | .subvendor = 0x5168, | 2076 | .subvendor = 0x5168, |
1722 | .subdevice = 0x0138, | 2077 | .subdevice = 0x0138, |
1723 | .driver_data = SAA7134_BOARD_FLYVIDEO2000, | 2078 | .driver_data = SAA7134_BOARD_FLYVIDEO2000, |
1724 | },{ | 2079 | },{ |
1725 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2080 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1726 | .device = PCI_DEVICE_ID_PHILIPS_SAA7135, | 2081 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1727 | .subvendor = 0x5168, | 2082 | .subvendor = 0x5168, |
1728 | .subdevice = 0x0212, /* minipci, LR212 */ | 2083 | .subdevice = 0x0212, /* minipci, LR212 */ |
1729 | .driver_data = SAA7134_BOARD_FLYTVPLATINUM_MINI, | 2084 | .driver_data = SAA7134_BOARD_FLYTVPLATINUM_MINI, |
1730 | },{ | 2085 | },{ |
1731 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2086 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1732 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2087 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1733 | .subvendor = 0x5168, /* Animation Technologies (LifeView) */ | 2088 | .subvendor = 0x5168, /* Animation Technologies (LifeView) */ |
1734 | .subdevice = 0x0214, /* Standard PCI, LR214WF */ | 2089 | .subdevice = 0x0214, /* Standard PCI, LR214WF */ |
1735 | .driver_data = SAA7134_BOARD_FLYTVPLATINUM_FM, | 2090 | .driver_data = SAA7134_BOARD_FLYTVPLATINUM_FM, |
1736 | },{ | 2091 | },{ |
1737 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2092 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1738 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2093 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1739 | .subvendor = 0x1489, /* KYE */ | 2094 | .subvendor = 0x1489, /* KYE */ |
1740 | .subdevice = 0x0214, /* Genius VideoWonder ProTV */ | 2095 | .subdevice = 0x0214, /* Genius VideoWonder ProTV */ |
1741 | .driver_data = SAA7134_BOARD_FLYTVPLATINUM_FM, /* is an LR214WF actually */ | 2096 | .driver_data = SAA7134_BOARD_FLYTVPLATINUM_FM, /* is an LR214WF actually */ |
1742 | },{ | 2097 | },{ |
1743 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2098 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1744 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2099 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1745 | .subvendor = 0x16be, | 2100 | .subvendor = 0x16be, |
@@ -1758,36 +2113,36 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
1758 | .subdevice = 0x226b, | 2113 | .subdevice = 0x226b, |
1759 | .driver_data = SAA7134_BOARD_ELSA_500TV, | 2114 | .driver_data = SAA7134_BOARD_ELSA_500TV, |
1760 | },{ | 2115 | },{ |
1761 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2116 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1762 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2117 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1763 | .subvendor = PCI_VENDOR_ID_ASUSTEK, | 2118 | .subvendor = PCI_VENDOR_ID_ASUSTEK, |
1764 | .subdevice = 0x4842, | 2119 | .subdevice = 0x4842, |
1765 | .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134, | 2120 | .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134, |
1766 | },{ | 2121 | },{ |
1767 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2122 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1768 | .device = PCI_DEVICE_ID_PHILIPS_SAA7135, | 2123 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1769 | .subvendor = PCI_VENDOR_ID_ASUSTEK, | 2124 | .subvendor = PCI_VENDOR_ID_ASUSTEK, |
1770 | .subdevice = 0x4845, | 2125 | .subdevice = 0x4845, |
1771 | .driver_data = SAA7135_BOARD_ASUSTeK_TVFM7135, | 2126 | .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7135, |
1772 | },{ | 2127 | },{ |
1773 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2128 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1774 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2129 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1775 | .subvendor = PCI_VENDOR_ID_ASUSTEK, | 2130 | .subvendor = PCI_VENDOR_ID_ASUSTEK, |
1776 | .subdevice = 0x4830, | 2131 | .subdevice = 0x4830, |
1777 | .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134, | 2132 | .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134, |
1778 | },{ | 2133 | },{ |
1779 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2134 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1780 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2135 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1781 | .subvendor = PCI_VENDOR_ID_ASUSTEK, | 2136 | .subvendor = PCI_VENDOR_ID_ASUSTEK, |
1782 | .subdevice = 0x4843, | 2137 | .subdevice = 0x4843, |
1783 | .driver_data = SAA7134_BOARD_ASUSTEK_TVFM7133, | 2138 | .driver_data = SAA7134_BOARD_ASUSTEK_TVFM7133, |
2139 | },{ | ||
2140 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2141 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | ||
2142 | .subvendor = PCI_VENDOR_ID_ASUSTEK, | ||
2143 | .subdevice = 0x4840, | ||
2144 | .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134, | ||
1784 | },{ | 2145 | },{ |
1785 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
1786 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | ||
1787 | .subvendor = PCI_VENDOR_ID_ASUSTEK, | ||
1788 | .subdevice = 0x4840, | ||
1789 | .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134, | ||
1790 | },{ | ||
1791 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2146 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1792 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2147 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1793 | .subvendor = PCI_VENDOR_ID_PHILIPS, | 2148 | .subvendor = PCI_VENDOR_ID_PHILIPS, |
@@ -1808,118 +2163,118 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
1808 | },{ | 2163 | },{ |
1809 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2164 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1810 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2165 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1811 | .subvendor = 0x1131, | 2166 | .subvendor = 0x1131, |
1812 | .subdevice = 0x7133, | 2167 | .subdevice = 0x7133, |
1813 | .driver_data = SAA7134_BOARD_VA1000POWER, | 2168 | .driver_data = SAA7134_BOARD_VA1000POWER, |
1814 | },{ | 2169 | },{ |
1815 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2170 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1816 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2171 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1817 | .subvendor = PCI_VENDOR_ID_PHILIPS, | 2172 | .subvendor = PCI_VENDOR_ID_PHILIPS, |
1818 | .subdevice = 0x2001, | 2173 | .subdevice = 0x2001, |
1819 | .driver_data = SAA7134_BOARD_10MOONSTVMASTER, | 2174 | .driver_data = SAA7134_BOARD_10MOONSTVMASTER, |
1820 | },{ | 2175 | },{ |
1821 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2176 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1822 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2177 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1823 | .subvendor = 0x185b, | 2178 | .subvendor = 0x185b, |
1824 | .subdevice = 0xc100, | 2179 | .subdevice = 0xc100, |
1825 | .driver_data = SAA7134_BOARD_VIDEOMATE_TV, | 2180 | .driver_data = SAA7134_BOARD_VIDEOMATE_TV, |
1826 | },{ | 2181 | },{ |
1827 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2182 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1828 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2183 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1829 | .subvendor = 0x185b, | 2184 | .subvendor = 0x185b, |
1830 | .subdevice = 0xc100, | 2185 | .subdevice = 0xc100, |
1831 | .driver_data = SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS, | 2186 | .driver_data = SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS, |
1832 | },{ | 2187 | },{ |
1833 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2188 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1834 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2189 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1835 | .subvendor = PCI_VENDOR_ID_MATROX, | 2190 | .subvendor = PCI_VENDOR_ID_MATROX, |
1836 | .subdevice = 0x48d0, | 2191 | .subdevice = 0x48d0, |
1837 | .driver_data = SAA7134_BOARD_CRONOS_PLUS, | 2192 | .driver_data = SAA7134_BOARD_CRONOS_PLUS, |
1838 | },{ | 2193 | },{ |
1839 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2194 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1840 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2195 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1841 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ | 2196 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ |
1842 | .subdevice = 0xa70b, | 2197 | .subdevice = 0xa70b, |
1843 | .driver_data = SAA7134_BOARD_MD2819, | 2198 | .driver_data = SAA7134_BOARD_MD2819, |
1844 | },{ | 2199 | },{ |
1845 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2200 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1846 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2201 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1847 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ | 2202 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ |
1848 | .subdevice = 0x2115, | 2203 | .subdevice = 0x2115, |
1849 | .driver_data = SAA7134_BOARD_AVERMEDIA_STUDIO_305, | 2204 | .driver_data = SAA7134_BOARD_AVERMEDIA_STUDIO_305, |
1850 | },{ | 2205 | },{ |
1851 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2206 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1852 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2207 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1853 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ | 2208 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ |
1854 | .subdevice = 0x2108, | 2209 | .subdevice = 0x2108, |
1855 | .driver_data = SAA7134_BOARD_AVERMEDIA_305, | 2210 | .driver_data = SAA7134_BOARD_AVERMEDIA_305, |
1856 | },{ | 2211 | },{ |
1857 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2212 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1858 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2213 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1859 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ | 2214 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ |
1860 | .subdevice = 0x10ff, | 2215 | .subdevice = 0x10ff, |
1861 | .driver_data = SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER, | 2216 | .driver_data = SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER, |
1862 | },{ | 2217 | },{ |
1863 | /* AVerMedia CardBus */ | 2218 | /* AVerMedia CardBus */ |
1864 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2219 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1865 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2220 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1866 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ | 2221 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ |
1867 | .subdevice = 0xd6ee, | 2222 | .subdevice = 0xd6ee, |
1868 | .driver_data = SAA7134_BOARD_AVERMEDIA_CARDBUS, | 2223 | .driver_data = SAA7134_BOARD_AVERMEDIA_CARDBUS, |
1869 | },{ | 2224 | },{ |
1870 | /* TransGear 3000TV */ | 2225 | /* TransGear 3000TV */ |
1871 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2226 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1872 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2227 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1873 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ | 2228 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ |
1874 | .subdevice = 0x050c, | 2229 | .subdevice = 0x050c, |
1875 | .driver_data = SAA7134_BOARD_TG3000TV, | 2230 | .driver_data = SAA7134_BOARD_TG3000TV, |
1876 | },{ | 2231 | },{ |
1877 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
1878 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | ||
1879 | .subvendor = 0x11bd, | ||
1880 | .subdevice = 0x002b, | ||
1881 | .driver_data = SAA7134_BOARD_PINNACLE_PCTV_STEREO, | ||
1882 | },{ | ||
1883 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
1884 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | ||
1885 | .subvendor = 0x11bd, | ||
1886 | .subdevice = 0x002d, | ||
1887 | .driver_data = SAA7134_BOARD_PINNACLE_300I_DVBT_PAL, | ||
1888 | },{ | ||
1889 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
1890 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | ||
1891 | .subvendor = 0x1019, | ||
1892 | .subdevice = 0x4cb4, | ||
1893 | .driver_data = SAA7134_BOARD_ECS_TVP3XP, | ||
1894 | },{ | ||
1895 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
1896 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
1897 | .subvendor = 0x1019, | ||
1898 | .subdevice = 0x4cb5, | ||
1899 | .driver_data = SAA7134_BOARD_ECS_TVP3XP_4CB5, | ||
1900 | },{ | ||
1901 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2232 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1902 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2233 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1903 | .subvendor = 0x12ab, | 2234 | .subvendor = 0x11bd, |
1904 | .subdevice = 0x0800, | 2235 | .subdevice = 0x002b, |
1905 | .driver_data = SAA7133_BOARD_UPMOST_PURPLE_TV, | 2236 | .driver_data = SAA7134_BOARD_PINNACLE_PCTV_STEREO, |
2237 | },{ | ||
2238 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2239 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | ||
2240 | .subvendor = 0x11bd, | ||
2241 | .subdevice = 0x002d, | ||
2242 | .driver_data = SAA7134_BOARD_PINNACLE_300I_DVBT_PAL, | ||
2243 | },{ | ||
2244 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2245 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | ||
2246 | .subvendor = 0x1019, | ||
2247 | .subdevice = 0x4cb4, | ||
2248 | .driver_data = SAA7134_BOARD_ECS_TVP3XP, | ||
2249 | },{ | ||
2250 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2251 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
2252 | .subvendor = 0x1019, | ||
2253 | .subdevice = 0x4cb5, | ||
2254 | .driver_data = SAA7134_BOARD_ECS_TVP3XP_4CB5, | ||
2255 | },{ | ||
2256 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2257 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
2258 | .subvendor = 0x12ab, | ||
2259 | .subdevice = 0x0800, | ||
2260 | .driver_data = SAA7134_BOARD_UPMOST_PURPLE_TV, | ||
1906 | },{ | 2261 | },{ |
1907 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2262 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1908 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2263 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1909 | .subvendor = 0x153B, | 2264 | .subvendor = 0x153B, |
1910 | .subdevice = 0x1152, | 2265 | .subdevice = 0x1152, |
1911 | .driver_data = SAA7134_BOARD_CINERGY200, | 2266 | .driver_data = SAA7134_BOARD_CINERGY200, |
1912 | },{ | 2267 | },{ |
1913 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2268 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1914 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2269 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1915 | .subvendor = 0x185b, | 2270 | .subvendor = 0x185b, |
1916 | .subdevice = 0xc100, | 2271 | .subdevice = 0xc100, |
1917 | .driver_data = SAA7134_BOARD_VIDEOMATE_TV_PVR, | 2272 | .driver_data = SAA7134_BOARD_VIDEOMATE_TV_PVR, |
1918 | },{ | 2273 | },{ |
1919 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2274 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1920 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2275 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1921 | .subvendor = 0x1131, | 2276 | .subvendor = 0x1131, |
1922 | .subdevice = 0, | 2277 | .subdevice = 0, |
1923 | .driver_data = SAA7134_BOARD_SABRENT_SBTTVFM, | 2278 | .driver_data = SAA7134_BOARD_SABRENT_SBTTVFM, |
1924 | },{ | 2279 | },{ |
1925 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2280 | .vendor = PCI_VENDOR_ID_PHILIPS, |
@@ -1939,18 +2294,24 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
1939 | .subvendor = 0x185b, | 2294 | .subvendor = 0x185b, |
1940 | .subdevice = 0xc200, | 2295 | .subdevice = 0xc200, |
1941 | .driver_data = SAA7134_BOARD_VIDEOMATE_GOLD_PLUS, | 2296 | .driver_data = SAA7134_BOARD_VIDEOMATE_GOLD_PLUS, |
1942 | },{ | 2297 | },{ |
1943 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2298 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1944 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2299 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1945 | .subvendor = 0x1540, | 2300 | .subvendor = 0x1540, |
1946 | .subdevice = 0x9524, | 2301 | .subdevice = 0x9524, |
1947 | .driver_data = SAA7134_BOARD_PROVIDEO_PV952, | 2302 | .driver_data = SAA7134_BOARD_PROVIDEO_PV952, |
1948 | 2303 | ||
1949 | },{ | 2304 | },{ |
1950 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2305 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1951 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2306 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1952 | .subvendor = 0x5168, | 2307 | .subvendor = 0x5168, |
1953 | .subdevice = 0x0306, | 2308 | .subdevice = 0x0502, /* Cardbus version */ |
2309 | .driver_data = SAA7134_BOARD_FLYDVBTDUO, | ||
2310 | },{ | ||
2311 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2312 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
2313 | .subvendor = 0x5168, | ||
2314 | .subdevice = 0x0306, /* PCI version */ | ||
1954 | .driver_data = SAA7134_BOARD_FLYDVBTDUO, | 2315 | .driver_data = SAA7134_BOARD_FLYDVBTDUO, |
1955 | },{ | 2316 | },{ |
1956 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2317 | .vendor = PCI_VENDOR_ID_PHILIPS, |
@@ -1959,31 +2320,44 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
1959 | .subdevice = 0xf31f, | 2320 | .subdevice = 0xf31f, |
1960 | .driver_data = SAA7134_BOARD_AVERMEDIA_GO_007_FM, | 2321 | .driver_data = SAA7134_BOARD_AVERMEDIA_GO_007_FM, |
1961 | 2322 | ||
1962 | },{ | 2323 | },{ |
1963 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2324 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1964 | .device = PCI_DEVICE_ID_PHILIPS_SAA7135, | 2325 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
2326 | .subvendor = PCI_VENDOR_ID_PHILIPS, | ||
2327 | .subdevice = 0x2004, | ||
2328 | .driver_data = SAA7134_BOARD_PHILIPS_TOUGH, | ||
2329 | },{ | ||
2330 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2331 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
1965 | .subvendor = 0x1421, | 2332 | .subvendor = 0x1421, |
1966 | .subdevice = 0x0350, /* PCI version */ | 2333 | .subdevice = 0x0350, /* PCI version */ |
1967 | .driver_data = SAA7134_BOARD_ADS_INSTANT_TV, | 2334 | .driver_data = SAA7134_BOARD_ADS_INSTANT_TV, |
1968 | 2335 | ||
1969 | },{ | 2336 | },{ |
1970 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2337 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1971 | .device = PCI_DEVICE_ID_PHILIPS_SAA7135, | 2338 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
1972 | .subvendor = 0x1421, | 2339 | .subvendor = 0x1421, |
1973 | .subdevice = 0x0370, /* cardbus version */ | 2340 | .subdevice = 0x0370, /* cardbus version */ |
1974 | .driver_data = SAA7134_BOARD_ADS_INSTANT_TV, | 2341 | .driver_data = SAA7134_BOARD_ADS_INSTANT_TV, |
1975 | 2342 | ||
1976 | },{ | 2343 | },{ /* Typhoon DVB-T Duo Digital/Analog Cardbus */ |
2344 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2345 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
2346 | .subvendor = 0x4e42, | ||
2347 | .subdevice = 0x0502, | ||
2348 | .driver_data = SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS, | ||
2349 | |||
2350 | },{ | ||
1977 | /* --- boards without eeprom + subsystem ID --- */ | 2351 | /* --- boards without eeprom + subsystem ID --- */ |
1978 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2352 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1979 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2353 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1980 | .subvendor = PCI_VENDOR_ID_PHILIPS, | 2354 | .subvendor = PCI_VENDOR_ID_PHILIPS, |
1981 | .subdevice = 0, | 2355 | .subdevice = 0, |
1982 | .driver_data = SAA7134_BOARD_NOAUTO, | 2356 | .driver_data = SAA7134_BOARD_NOAUTO, |
1983 | },{ | 2357 | },{ |
1984 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2358 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1985 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2359 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1986 | .subvendor = PCI_VENDOR_ID_PHILIPS, | 2360 | .subvendor = PCI_VENDOR_ID_PHILIPS, |
1987 | .subdevice = 0, | 2361 | .subdevice = 0, |
1988 | .driver_data = SAA7134_BOARD_NOAUTO, | 2362 | .driver_data = SAA7134_BOARD_NOAUTO, |
1989 | },{ | 2363 | },{ |
@@ -1991,26 +2365,26 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
1991 | /* --- default catch --- */ | 2365 | /* --- default catch --- */ |
1992 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2366 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1993 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | 2367 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, |
1994 | .subvendor = PCI_ANY_ID, | 2368 | .subvendor = PCI_ANY_ID, |
1995 | .subdevice = PCI_ANY_ID, | 2369 | .subdevice = PCI_ANY_ID, |
1996 | .driver_data = SAA7134_BOARD_UNKNOWN, | 2370 | .driver_data = SAA7134_BOARD_UNKNOWN, |
1997 | },{ | 2371 | },{ |
1998 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2372 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1999 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 2373 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
2000 | .subvendor = PCI_ANY_ID, | 2374 | .subvendor = PCI_ANY_ID, |
2001 | .subdevice = PCI_ANY_ID, | 2375 | .subdevice = PCI_ANY_ID, |
2002 | .driver_data = SAA7134_BOARD_UNKNOWN, | 2376 | .driver_data = SAA7134_BOARD_UNKNOWN, |
2003 | },{ | 2377 | },{ |
2004 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2378 | .vendor = PCI_VENDOR_ID_PHILIPS, |
2005 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2379 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
2006 | .subvendor = PCI_ANY_ID, | 2380 | .subvendor = PCI_ANY_ID, |
2007 | .subdevice = PCI_ANY_ID, | 2381 | .subdevice = PCI_ANY_ID, |
2008 | .driver_data = SAA7134_BOARD_UNKNOWN, | 2382 | .driver_data = SAA7134_BOARD_UNKNOWN, |
2009 | },{ | 2383 | },{ |
2010 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2384 | .vendor = PCI_VENDOR_ID_PHILIPS, |
2011 | .device = PCI_DEVICE_ID_PHILIPS_SAA7135, | 2385 | .device = PCI_DEVICE_ID_PHILIPS_SAA7135, |
2012 | .subvendor = PCI_ANY_ID, | 2386 | .subvendor = PCI_ANY_ID, |
2013 | .subdevice = PCI_ANY_ID, | 2387 | .subdevice = PCI_ANY_ID, |
2014 | .driver_data = SAA7134_BOARD_UNKNOWN, | 2388 | .driver_data = SAA7134_BOARD_UNKNOWN, |
2015 | },{ | 2389 | },{ |
2016 | /* --- end of list --- */ | 2390 | /* --- end of list --- */ |
@@ -2021,46 +2395,9 @@ MODULE_DEVICE_TABLE(pci, saa7134_pci_tbl); | |||
2021 | /* ----------------------------------------------------------- */ | 2395 | /* ----------------------------------------------------------- */ |
2022 | /* flyvideo tweaks */ | 2396 | /* flyvideo tweaks */ |
2023 | 2397 | ||
2024 | #if 0 | ||
2025 | static struct { | ||
2026 | char *model; | ||
2027 | int tuner_type; | ||
2028 | } fly_list[0x20] = { | ||
2029 | /* default catch ... */ | ||
2030 | [ 0 ... 0x1f ] = { | ||
2031 | .model = "UNKNOWN", | ||
2032 | .tuner_type = TUNER_ABSENT, | ||
2033 | }, | ||
2034 | /* ... the ones known so far */ | ||
2035 | [ 0x05 ] = { | ||
2036 | .model = "PAL-BG", | ||
2037 | .tuner_type = TUNER_LG_PAL_NEW_TAPC, | ||
2038 | }, | ||
2039 | [ 0x10 ] = { | ||
2040 | .model = "PAL-BG / PAL-DK", | ||
2041 | .tuner_type = TUNER_PHILIPS_PAL, | ||
2042 | }, | ||
2043 | [ 0x15 ] = { | ||
2044 | .model = "NTSC", | ||
2045 | .tuner_type = TUNER_ABSENT /* FIXME */, | ||
2046 | }, | ||
2047 | }; | ||
2048 | #endif | ||
2049 | 2398 | ||
2050 | static void board_flyvideo(struct saa7134_dev *dev) | 2399 | static void board_flyvideo(struct saa7134_dev *dev) |
2051 | { | 2400 | { |
2052 | #if 0 | ||
2053 | /* non-working attempt to detect the correct tuner type ... */ | ||
2054 | u32 value; | ||
2055 | int index; | ||
2056 | |||
2057 | value = dev->gpio_value; | ||
2058 | index = (value & 0x1f00) >> 8; | ||
2059 | printk(KERN_INFO "%s: flyvideo: gpio is 0x%x [model=%s,tuner=%d]\n", | ||
2060 | dev->name, value, fly_list[index].model, | ||
2061 | fly_list[index].tuner_type); | ||
2062 | dev->tuner_type = fly_list[index].tuner_type; | ||
2063 | #endif | ||
2064 | printk("%s: there are different flyvideo cards with different tuners\n" | 2401 | printk("%s: there are different flyvideo cards with different tuners\n" |
2065 | "%s: out there, you might have to use the tuner=<nr> insmod\n" | 2402 | "%s: out there, you might have to use the tuner=<nr> insmod\n" |
2066 | "%s: option to override the default value.\n", | 2403 | "%s: option to override the default value.\n", |
@@ -2071,7 +2408,7 @@ static void board_flyvideo(struct saa7134_dev *dev) | |||
2071 | 2408 | ||
2072 | int saa7134_board_init1(struct saa7134_dev *dev) | 2409 | int saa7134_board_init1(struct saa7134_dev *dev) |
2073 | { | 2410 | { |
2074 | // Always print gpio, often manufacturers encode tuner type and other info. | 2411 | /* Always print gpio, often manufacturers encode tuner type and other info. */ |
2075 | saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0); | 2412 | saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0); |
2076 | dev->gpio_value = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2); | 2413 | dev->gpio_value = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2); |
2077 | printk(KERN_INFO "%s: board init: gpio is %x\n", dev->name, dev->gpio_value); | 2414 | printk(KERN_INFO "%s: board init: gpio is %x\n", dev->name, dev->gpio_value); |
@@ -2082,7 +2419,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) | |||
2082 | dev->has_remote = 1; | 2419 | dev->has_remote = 1; |
2083 | board_flyvideo(dev); | 2420 | board_flyvideo(dev); |
2084 | break; | 2421 | break; |
2085 | case SAA7134_BOARD_FLYTVPLATINUM_FM: | 2422 | case SAA7134_BOARD_FLYTVPLATINUM_FM: |
2086 | case SAA7134_BOARD_CINERGY400: | 2423 | case SAA7134_BOARD_CINERGY400: |
2087 | case SAA7134_BOARD_CINERGY600: | 2424 | case SAA7134_BOARD_CINERGY600: |
2088 | case SAA7134_BOARD_CINERGY600_MK3: | 2425 | case SAA7134_BOARD_CINERGY600_MK3: |
@@ -2090,23 +2427,25 @@ int saa7134_board_init1(struct saa7134_dev *dev) | |||
2090 | case SAA7134_BOARD_ECS_TVP3XP_4CB5: | 2427 | case SAA7134_BOARD_ECS_TVP3XP_4CB5: |
2091 | case SAA7134_BOARD_MD2819: | 2428 | case SAA7134_BOARD_MD2819: |
2092 | case SAA7134_BOARD_KWORLD_VSTREAM_XPERT: | 2429 | case SAA7134_BOARD_KWORLD_VSTREAM_XPERT: |
2430 | case SAA7134_BOARD_KWORLD_XPERT: | ||
2093 | case SAA7134_BOARD_AVERMEDIA_STUDIO_305: | 2431 | case SAA7134_BOARD_AVERMEDIA_STUDIO_305: |
2094 | case SAA7134_BOARD_AVERMEDIA_305: | 2432 | case SAA7134_BOARD_AVERMEDIA_305: |
2095 | case SAA7134_BOARD_AVERMEDIA_STUDIO_307: | 2433 | case SAA7134_BOARD_AVERMEDIA_STUDIO_307: |
2096 | case SAA7134_BOARD_AVERMEDIA_307: | 2434 | case SAA7134_BOARD_AVERMEDIA_307: |
2097 | case SAA7134_BOARD_AVERMEDIA_GO_007_FM: | 2435 | case SAA7134_BOARD_AVERMEDIA_GO_007_FM: |
2098 | // case SAA7134_BOARD_SABRENT_SBTTVFM: /* not finished yet */ | 2436 | /* case SAA7134_BOARD_SABRENT_SBTTVFM: */ /* not finished yet */ |
2099 | case SAA7134_BOARD_VIDEOMATE_TV_PVR: | 2437 | case SAA7134_BOARD_VIDEOMATE_TV_PVR: |
2100 | case SAA7134_BOARD_MANLI_MTV001: | 2438 | case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII: |
2101 | case SAA7134_BOARD_MANLI_MTV002: | 2439 | case SAA7134_BOARD_MANLI_MTV001: |
2440 | case SAA7134_BOARD_MANLI_MTV002: | ||
2102 | case SAA7134_BOARD_AVACSSMARTTV: | 2441 | case SAA7134_BOARD_AVACSSMARTTV: |
2103 | dev->has_remote = 1; | 2442 | dev->has_remote = 1; |
2104 | break; | 2443 | break; |
2105 | case SAA7134_BOARD_MD5044: | 2444 | case SAA7134_BOARD_MD5044: |
2106 | printk("%s: seems there are two different versions of the MD5044\n" | 2445 | printk("%s: seems there are two different versions of the MD5044\n" |
2107 | "%s: (with the same ID) out there. If sound doesn't work for\n" | 2446 | "%s: (with the same ID) out there. If sound doesn't work for\n" |
2108 | "%s: you try the audio_clock_override=0x200000 insmod option.\n", | 2447 | "%s: you try the audio_clock_override=0x200000 insmod option.\n", |
2109 | dev->name,dev->name,dev->name); | 2448 | dev->name,dev->name,dev->name); |
2110 | break; | 2449 | break; |
2111 | case SAA7134_BOARD_CINERGY400_CARDBUS: | 2450 | case SAA7134_BOARD_CINERGY400_CARDBUS: |
2112 | /* power-up tuner chip */ | 2451 | /* power-up tuner chip */ |
@@ -2114,11 +2453,19 @@ int saa7134_board_init1(struct saa7134_dev *dev) | |||
2114 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000000); | 2453 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000000); |
2115 | msleep(1); | 2454 | msleep(1); |
2116 | break; | 2455 | break; |
2456 | case SAA7134_BOARD_FLYDVBTDUO: | ||
2457 | case SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS: | ||
2458 | /* turn the fan on Hac: static for the time being */ | ||
2459 | saa_writeb(SAA7134_GPIO_GPMODE3, 0x08); | ||
2460 | saa_writeb(SAA7134_GPIO_GPSTATUS3, 0x06); | ||
2461 | break; | ||
2462 | case SAA7134_BOARD_AVERMEDIA_CARDBUS: | ||
2463 | /* power-up tuner chip */ | ||
2464 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0xffffffff); | ||
2465 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0xffffffff); | ||
2466 | msleep(1); | ||
2467 | break; | ||
2117 | } | 2468 | } |
2118 | if (dev->has_remote) | ||
2119 | dev->irq2_mask |= (SAA7134_IRQ2_INTE_GPIO18 | | ||
2120 | SAA7134_IRQ2_INTE_GPIO18A | | ||
2121 | SAA7134_IRQ2_INTE_GPIO16 ); | ||
2122 | return 0; | 2469 | return 0; |
2123 | } | 2470 | } |
2124 | 2471 | ||
@@ -2139,10 +2486,85 @@ int saa7134_board_init2(struct saa7134_dev *dev) | |||
2139 | break; | 2486 | break; |
2140 | dev->board = board; | 2487 | dev->board = board; |
2141 | printk("%s: board type fixup: %s\n", dev->name, | 2488 | printk("%s: board type fixup: %s\n", dev->name, |
2142 | saa7134_boards[dev->board].name); | 2489 | saa7134_boards[dev->board].name); |
2143 | dev->tuner_type = saa7134_boards[dev->board].tuner_type; | 2490 | dev->tuner_type = saa7134_boards[dev->board].tuner_type; |
2144 | if (TUNER_ABSENT != dev->tuner_type) | 2491 | |
2145 | saa7134_i2c_call_clients(dev,TUNER_SET_TYPE,&dev->tuner_type); | 2492 | if (TUNER_ABSENT != dev->tuner_type) { |
2493 | struct tuner_setup tun_setup; | ||
2494 | |||
2495 | tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; | ||
2496 | tun_setup.type = dev->tuner_type; | ||
2497 | tun_setup.addr = ADDR_UNSET; | ||
2498 | |||
2499 | saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR, &tun_setup); | ||
2500 | } | ||
2501 | break; | ||
2502 | case SAA7134_BOARD_MD7134: | ||
2503 | { | ||
2504 | struct tuner_setup tun_setup; | ||
2505 | u8 subaddr; | ||
2506 | u8 data[3]; | ||
2507 | int ret, tuner_t; | ||
2508 | |||
2509 | struct i2c_msg msg[] = {{.addr=0x50, .flags=0, .buf=&subaddr, .len = 1}, | ||
2510 | {.addr=0x50, .flags=I2C_M_RD, .buf=data, .len = 3}}; | ||
2511 | subaddr= 0x14; | ||
2512 | tuner_t = 0; | ||
2513 | ret = i2c_transfer(&dev->i2c_adap, msg, 2); | ||
2514 | if (ret != 2) { | ||
2515 | printk(KERN_ERR "EEPROM read failure\n"); | ||
2516 | } else if ((data[0] != 0) && (data[0] != 0xff)) { | ||
2517 | /* old config structure */ | ||
2518 | subaddr = data[0] + 2; | ||
2519 | msg[1].len = 2; | ||
2520 | i2c_transfer(&dev->i2c_adap, msg, 2); | ||
2521 | tuner_t = (data[0] << 8) + data[1]; | ||
2522 | switch (tuner_t){ | ||
2523 | case 0x0103: | ||
2524 | dev->tuner_type = TUNER_PHILIPS_PAL; | ||
2525 | break; | ||
2526 | case 0x010C: | ||
2527 | dev->tuner_type = TUNER_PHILIPS_FM1216ME_MK3; | ||
2528 | break; | ||
2529 | default: | ||
2530 | printk(KERN_ERR "%s Cant determine tuner type %x from EEPROM\n", dev->name, tuner_t); | ||
2531 | } | ||
2532 | } else if ((data[1] != 0) && (data[1] != 0xff)) { | ||
2533 | /* new config structure */ | ||
2534 | subaddr = data[1] + 1; | ||
2535 | msg[1].len = 1; | ||
2536 | i2c_transfer(&dev->i2c_adap, msg, 2); | ||
2537 | subaddr = data[0] + 1; | ||
2538 | msg[1].len = 2; | ||
2539 | i2c_transfer(&dev->i2c_adap, msg, 2); | ||
2540 | tuner_t = (data[1] << 8) + data[0]; | ||
2541 | switch (tuner_t) { | ||
2542 | case 0x0005: | ||
2543 | dev->tuner_type = TUNER_PHILIPS_FM1216ME_MK3; | ||
2544 | break; | ||
2545 | case 0x001d: | ||
2546 | dev->tuner_type = TUNER_PHILIPS_FMD1216ME_MK3; | ||
2547 | printk(KERN_INFO "%s Board has DVB-T\n", dev->name); | ||
2548 | break; | ||
2549 | default: | ||
2550 | printk(KERN_ERR "%s Cant determine tuner type %x from EEPROM\n", dev->name, tuner_t); | ||
2551 | } | ||
2552 | } else { | ||
2553 | printk(KERN_ERR "%s unexpected config structure\n", dev->name); | ||
2554 | } | ||
2555 | |||
2556 | printk(KERN_INFO "%s Tuner type is %d\n", dev->name, dev->tuner_type); | ||
2557 | if (dev->tuner_type == TUNER_PHILIPS_FMD1216ME_MK3) { | ||
2558 | dev->tda9887_conf = TDA9887_PRESENT | TDA9887_PORT1_ACTIVE | TDA9887_PORT2_ACTIVE; | ||
2559 | saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG, &dev->tda9887_conf); | ||
2560 | } | ||
2561 | |||
2562 | tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; | ||
2563 | tun_setup.type = dev->tuner_type; | ||
2564 | tun_setup.addr = ADDR_UNSET; | ||
2565 | |||
2566 | saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR,&tun_setup); | ||
2567 | } | ||
2146 | break; | 2568 | break; |
2147 | } | 2569 | } |
2148 | return 0; | 2570 | return 0; |
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index f61ed1849a2a..1dbe61755e9f 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-core.c,v 1.30 2005/05/22 19:23:39 nsh Exp $ | 2 | * $Id: saa7134-core.c,v 1.39 2005/07/05 17:37:35 nsh Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * driver core | 5 | * driver core |
@@ -183,46 +183,6 @@ void saa7134_track_gpio(struct saa7134_dev *dev, char *msg) | |||
183 | 183 | ||
184 | /* ------------------------------------------------------------------ */ | 184 | /* ------------------------------------------------------------------ */ |
185 | 185 | ||
186 | #if 0 | ||
187 | static char *dec1_bits[8] = { | ||
188 | "DCSTD0", "DCSCT1", "WIPA", "GLIMB", | ||
189 | "GLIMT", "SLTCA", "HLCK" | ||
190 | }; | ||
191 | static char *dec2_bits[8] = { | ||
192 | "RDCAP", "COPRO", "COLSTR", "TYPE3", | ||
193 | NULL, "FIDT", "HLVLN", "INTL" | ||
194 | }; | ||
195 | static char *scale1_bits[8] = { | ||
196 | "VID_A", "VBI_A", NULL, NULL, "VID_B", "VBI_B" | ||
197 | }; | ||
198 | static char *scale2_bits[8] = { | ||
199 | "TRERR", "CFERR", "LDERR", "WASRST", | ||
200 | "FIDSCI", "FIDSCO", "D6^D5", "TASK" | ||
201 | }; | ||
202 | |||
203 | static void dump_statusreg(struct saa7134_dev *dev, int reg, | ||
204 | char *regname, char **bits) | ||
205 | { | ||
206 | int value,i; | ||
207 | |||
208 | value = saa_readb(reg); | ||
209 | printk(KERN_DEBUG "%s: %s:", dev->name, regname); | ||
210 | for (i = 7; i >= 0; i--) { | ||
211 | if (NULL == bits[i]) | ||
212 | continue; | ||
213 | printk(" %s=%d", bits[i], (value & (1 << i)) ? 1 : 0); | ||
214 | } | ||
215 | printk("\n"); | ||
216 | } | ||
217 | |||
218 | static void dump_statusregs(struct saa7134_dev *dev) | ||
219 | { | ||
220 | dump_statusreg(dev,SAA7134_STATUS_VIDEO1,"dec1",dec1_bits); | ||
221 | dump_statusreg(dev,SAA7134_STATUS_VIDEO2,"dec2",dec2_bits); | ||
222 | dump_statusreg(dev,SAA7134_SCALER_STATUS0,"scale0",scale1_bits); | ||
223 | dump_statusreg(dev,SAA7134_SCALER_STATUS1,"scale1",scale2_bits); | ||
224 | } | ||
225 | #endif | ||
226 | 186 | ||
227 | /* ----------------------------------------------------------- */ | 187 | /* ----------------------------------------------------------- */ |
228 | /* delayed request_module */ | 188 | /* delayed request_module */ |
@@ -616,10 +576,6 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
616 | if (irq_debug) | 576 | if (irq_debug) |
617 | print_irqstatus(dev,loop,report,status); | 577 | print_irqstatus(dev,loop,report,status); |
618 | 578 | ||
619 | #if 0 | ||
620 | if (report & SAA7134_IRQ_REPORT_CONF_ERR) | ||
621 | dump_statusregs(dev); | ||
622 | #endif | ||
623 | 579 | ||
624 | if (report & SAA7134_IRQ_REPORT_RDCAP /* _INTL */) | 580 | if (report & SAA7134_IRQ_REPORT_RDCAP /* _INTL */) |
625 | saa7134_irq_video_intl(dev); | 581 | saa7134_irq_video_intl(dev); |
@@ -711,7 +667,6 @@ static int saa7134_hwinit1(struct saa7134_dev *dev) | |||
711 | SAA7134_MAIN_CTRL_EVFE1 | | 667 | SAA7134_MAIN_CTRL_EVFE1 | |
712 | SAA7134_MAIN_CTRL_EVFE2 | | 668 | SAA7134_MAIN_CTRL_EVFE2 | |
713 | SAA7134_MAIN_CTRL_ESFE | | 669 | SAA7134_MAIN_CTRL_ESFE | |
714 | SAA7134_MAIN_CTRL_EBADC | | ||
715 | SAA7134_MAIN_CTRL_EBDAC); | 670 | SAA7134_MAIN_CTRL_EBDAC); |
716 | 671 | ||
717 | /* enable peripheral devices */ | 672 | /* enable peripheral devices */ |
@@ -726,14 +681,28 @@ static int saa7134_hwinit1(struct saa7134_dev *dev) | |||
726 | /* late init (with i2c + irq) */ | 681 | /* late init (with i2c + irq) */ |
727 | static int saa7134_hwinit2(struct saa7134_dev *dev) | 682 | static int saa7134_hwinit2(struct saa7134_dev *dev) |
728 | { | 683 | { |
684 | unsigned int irq2_mask; | ||
729 | dprintk("hwinit2\n"); | 685 | dprintk("hwinit2\n"); |
730 | 686 | ||
731 | saa7134_video_init2(dev); | 687 | saa7134_video_init2(dev); |
732 | saa7134_tvaudio_init2(dev); | 688 | saa7134_tvaudio_init2(dev); |
733 | 689 | ||
734 | /* enable IRQ's */ | 690 | /* enable IRQ's */ |
691 | irq2_mask = | ||
692 | SAA7134_IRQ2_INTE_DEC3 | | ||
693 | SAA7134_IRQ2_INTE_DEC2 | | ||
694 | SAA7134_IRQ2_INTE_DEC1 | | ||
695 | SAA7134_IRQ2_INTE_DEC0 | | ||
696 | SAA7134_IRQ2_INTE_PE | | ||
697 | SAA7134_IRQ2_INTE_AR; | ||
698 | |||
699 | if (dev->has_remote) | ||
700 | irq2_mask |= (SAA7134_IRQ2_INTE_GPIO18 | | ||
701 | SAA7134_IRQ2_INTE_GPIO18A | | ||
702 | SAA7134_IRQ2_INTE_GPIO16 ); | ||
703 | |||
735 | saa_writel(SAA7134_IRQ1, 0); | 704 | saa_writel(SAA7134_IRQ1, 0); |
736 | saa_writel(SAA7134_IRQ2, dev->irq2_mask); | 705 | saa_writel(SAA7134_IRQ2, irq2_mask); |
737 | 706 | ||
738 | return 0; | 707 | return 0; |
739 | } | 708 | } |
@@ -954,13 +923,6 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
954 | } | 923 | } |
955 | 924 | ||
956 | /* initialize hardware #1 */ | 925 | /* initialize hardware #1 */ |
957 | dev->irq2_mask = | ||
958 | SAA7134_IRQ2_INTE_DEC3 | | ||
959 | SAA7134_IRQ2_INTE_DEC2 | | ||
960 | SAA7134_IRQ2_INTE_DEC1 | | ||
961 | SAA7134_IRQ2_INTE_DEC0 | | ||
962 | SAA7134_IRQ2_INTE_PE | | ||
963 | SAA7134_IRQ2_INTE_AR; | ||
964 | saa7134_board_init1(dev); | 926 | saa7134_board_init1(dev); |
965 | saa7134_hwinit1(dev); | 927 | saa7134_hwinit1(dev); |
966 | 928 | ||
@@ -990,6 +952,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
990 | request_module("saa6752hs"); | 952 | request_module("saa6752hs"); |
991 | request_module_depend("saa7134-empress",&need_empress); | 953 | request_module_depend("saa7134-empress",&need_empress); |
992 | } | 954 | } |
955 | |||
993 | if (card_is_dvb(dev)) | 956 | if (card_is_dvb(dev)) |
994 | request_module_depend("saa7134-dvb",&need_dvb); | 957 | request_module_depend("saa7134-dvb",&need_dvb); |
995 | 958 | ||
@@ -1144,9 +1107,6 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev) | |||
1144 | release_mem_region(pci_resource_start(pci_dev,0), | 1107 | release_mem_region(pci_resource_start(pci_dev,0), |
1145 | pci_resource_len(pci_dev,0)); | 1108 | pci_resource_len(pci_dev,0)); |
1146 | 1109 | ||
1147 | #if 0 /* causes some trouble when reinserting the driver ... */ | ||
1148 | pci_disable_device(pci_dev); | ||
1149 | #endif | ||
1150 | pci_set_drvdata(pci_dev, NULL); | 1110 | pci_set_drvdata(pci_dev, NULL); |
1151 | 1111 | ||
1152 | /* free memory */ | 1112 | /* free memory */ |
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index aa8e2cf62d55..334bc1850092 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -1,8 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-dvb.c,v 1.13 2005/06/12 04:19:19 mchehab Exp $ | 2 | * $Id: saa7134-dvb.c,v 1.18 2005/07/04 16:05:50 mkrufky Exp $ |
3 | * | 3 | * |
4 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] | 4 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] |
5 | * | 5 | * |
6 | * Extended 3 / 2005 by Hartmut Hackmann to support various | ||
7 | * cards with the tda10046 DVB-T channel decoder | ||
8 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or | 11 | * the Free Software Foundation; either version 2 of the License, or |
@@ -27,23 +30,31 @@ | |||
27 | #include <linux/kthread.h> | 30 | #include <linux/kthread.h> |
28 | #include <linux/suspend.h> | 31 | #include <linux/suspend.h> |
29 | 32 | ||
33 | #define CONFIG_DVB_MT352 1 | ||
34 | #define CONFIG_DVB_TDA1004X 1 | ||
35 | |||
30 | #include "saa7134-reg.h" | 36 | #include "saa7134-reg.h" |
31 | #include "saa7134.h" | 37 | #include "saa7134.h" |
32 | 38 | ||
33 | #include "dvb-pll.h" | 39 | #if CONFIG_DVB_MT352 |
34 | #include "mt352.h" | 40 | # include "mt352.h" |
35 | #include "mt352_priv.h" /* FIXME */ | 41 | # include "mt352_priv.h" /* FIXME */ |
36 | #include "tda1004x.h" | 42 | #endif |
43 | #if CONFIG_DVB_TDA1004X | ||
44 | # include "tda1004x.h" | ||
45 | #endif | ||
37 | 46 | ||
38 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); | 47 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); |
39 | MODULE_LICENSE("GPL"); | 48 | MODULE_LICENSE("GPL"); |
40 | 49 | ||
41 | static unsigned int antenna_pwr = 0; | 50 | static unsigned int antenna_pwr = 0; |
51 | |||
42 | module_param(antenna_pwr, int, 0444); | 52 | module_param(antenna_pwr, int, 0444); |
43 | MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)"); | 53 | MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)"); |
44 | 54 | ||
45 | /* ------------------------------------------------------------------ */ | 55 | /* ------------------------------------------------------------------ */ |
46 | 56 | ||
57 | #if CONFIG_DVB_MT352 | ||
47 | static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on) | 58 | static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on) |
48 | { | 59 | { |
49 | u32 ok; | 60 | u32 ok; |
@@ -138,51 +149,390 @@ static struct mt352_config pinnacle_300i = { | |||
138 | .demod_init = mt352_pinnacle_init, | 149 | .demod_init = mt352_pinnacle_init, |
139 | .pll_set = mt352_pinnacle_pll_set, | 150 | .pll_set = mt352_pinnacle_pll_set, |
140 | }; | 151 | }; |
152 | #endif | ||
141 | 153 | ||
142 | /* ------------------------------------------------------------------ */ | 154 | /* ------------------------------------------------------------------ */ |
143 | 155 | ||
144 | static int medion_cardbus_init(struct dvb_frontend* fe) | 156 | #if CONFIG_DVB_TDA1004X |
157 | static int philips_tu1216_pll_init(struct dvb_frontend *fe) | ||
145 | { | 158 | { |
146 | /* anything to do here ??? */ | 159 | struct saa7134_dev *dev = fe->dvb->priv; |
160 | static u8 tu1216_init[] = { 0x0b, 0xf5, 0x85, 0xab }; | ||
161 | struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) }; | ||
162 | |||
163 | /* setup PLL configuration */ | ||
164 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | ||
165 | return -EIO; | ||
166 | msleep(1); | ||
167 | |||
147 | return 0; | 168 | return 0; |
148 | } | 169 | } |
149 | 170 | ||
150 | static int medion_cardbus_pll_set(struct dvb_frontend* fe, | 171 | static int philips_tu1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
151 | struct dvb_frontend_parameters* params) | ||
152 | { | 172 | { |
153 | struct saa7134_dev *dev = fe->dvb->priv; | 173 | struct saa7134_dev *dev = fe->dvb->priv; |
154 | struct v4l2_frequency f; | 174 | u8 tuner_buf[4]; |
175 | struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tuner_buf,.len = | ||
176 | sizeof(tuner_buf) }; | ||
177 | int tuner_frequency = 0; | ||
178 | u8 band, cp, filter; | ||
179 | |||
180 | /* determine charge pump */ | ||
181 | tuner_frequency = params->frequency + 36166000; | ||
182 | if (tuner_frequency < 87000000) | ||
183 | return -EINVAL; | ||
184 | else if (tuner_frequency < 130000000) | ||
185 | cp = 3; | ||
186 | else if (tuner_frequency < 160000000) | ||
187 | cp = 5; | ||
188 | else if (tuner_frequency < 200000000) | ||
189 | cp = 6; | ||
190 | else if (tuner_frequency < 290000000) | ||
191 | cp = 3; | ||
192 | else if (tuner_frequency < 420000000) | ||
193 | cp = 5; | ||
194 | else if (tuner_frequency < 480000000) | ||
195 | cp = 6; | ||
196 | else if (tuner_frequency < 620000000) | ||
197 | cp = 3; | ||
198 | else if (tuner_frequency < 830000000) | ||
199 | cp = 5; | ||
200 | else if (tuner_frequency < 895000000) | ||
201 | cp = 7; | ||
202 | else | ||
203 | return -EINVAL; | ||
204 | |||
205 | /* determine band */ | ||
206 | if (params->frequency < 49000000) | ||
207 | return -EINVAL; | ||
208 | else if (params->frequency < 161000000) | ||
209 | band = 1; | ||
210 | else if (params->frequency < 444000000) | ||
211 | band = 2; | ||
212 | else if (params->frequency < 861000000) | ||
213 | band = 4; | ||
214 | else | ||
215 | return -EINVAL; | ||
216 | |||
217 | /* setup PLL filter */ | ||
218 | switch (params->u.ofdm.bandwidth) { | ||
219 | case BANDWIDTH_6_MHZ: | ||
220 | filter = 0; | ||
221 | break; | ||
155 | 222 | ||
156 | /* | 223 | case BANDWIDTH_7_MHZ: |
157 | * this instructs tuner.o to set the frequency, the call will | 224 | filter = 0; |
158 | * end up in tuner_command(), VIDIOC_S_FREQUENCY switch. | 225 | break; |
159 | * tda9887.o will see that as well. | 226 | |
227 | case BANDWIDTH_8_MHZ: | ||
228 | filter = 1; | ||
229 | break; | ||
230 | |||
231 | default: | ||
232 | return -EINVAL; | ||
233 | } | ||
234 | |||
235 | /* calculate divisor | ||
236 | * ((36166000+((1000000/6)/2)) + Finput)/(1000000/6) | ||
160 | */ | 237 | */ |
161 | f.tuner = 0; | 238 | tuner_frequency = (((params->frequency / 1000) * 6) + 217496) / 1000; |
162 | f.type = V4L2_TUNER_DIGITAL_TV; | 239 | |
163 | f.frequency = params->frequency / 1000 * 16 / 1000; | 240 | /* setup tuner buffer */ |
164 | saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,&f); | 241 | tuner_buf[0] = (tuner_frequency >> 8) & 0x7f; |
242 | tuner_buf[1] = tuner_frequency & 0xff; | ||
243 | tuner_buf[2] = 0xca; | ||
244 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; | ||
245 | |||
246 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | ||
247 | return -EIO; | ||
248 | |||
249 | msleep(1); | ||
165 | return 0; | 250 | return 0; |
166 | } | 251 | } |
167 | 252 | ||
168 | static int fe_request_firmware(struct dvb_frontend* fe, | 253 | static int philips_tu1216_request_firmware(struct dvb_frontend *fe, |
169 | const struct firmware **fw, char* name) | 254 | const struct firmware **fw, char *name) |
170 | { | 255 | { |
171 | struct saa7134_dev *dev = fe->dvb->priv; | 256 | struct saa7134_dev *dev = fe->dvb->priv; |
172 | return request_firmware(fw, name, &dev->pci->dev); | 257 | return request_firmware(fw, name, &dev->pci->dev); |
173 | } | 258 | } |
174 | 259 | ||
260 | static struct tda1004x_config philips_tu1216_config = { | ||
261 | |||
262 | .demod_address = 0x8, | ||
263 | .invert = 1, | ||
264 | .invert_oclk = 1, | ||
265 | .xtal_freq = TDA10046_XTAL_4M, | ||
266 | .agc_config = TDA10046_AGC_DEFAULT, | ||
267 | .if_freq = TDA10046_FREQ_3617, | ||
268 | .pll_init = philips_tu1216_pll_init, | ||
269 | .pll_set = philips_tu1216_pll_set, | ||
270 | .pll_sleep = NULL, | ||
271 | .request_firmware = philips_tu1216_request_firmware, | ||
272 | }; | ||
273 | |||
274 | /* ------------------------------------------------------------------ */ | ||
275 | |||
276 | |||
277 | static int philips_fmd1216_pll_init(struct dvb_frontend *fe) | ||
278 | { | ||
279 | struct saa7134_dev *dev = fe->dvb->priv; | ||
280 | /* this message is to set up ATC and ALC */ | ||
281 | static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0xa0 }; | ||
282 | struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) }; | ||
283 | |||
284 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | ||
285 | return -EIO; | ||
286 | msleep(1); | ||
287 | |||
288 | return 0; | ||
289 | } | ||
290 | |||
291 | static void philips_fmd1216_analog(struct dvb_frontend *fe) | ||
292 | { | ||
293 | struct saa7134_dev *dev = fe->dvb->priv; | ||
294 | /* this message actually turns the tuner back to analog mode */ | ||
295 | static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0x60 }; | ||
296 | struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) }; | ||
297 | |||
298 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); | ||
299 | msleep(1); | ||
300 | fmd1216_init[2] = 0x86; | ||
301 | fmd1216_init[3] = 0x54; | ||
302 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); | ||
303 | msleep(1); | ||
304 | } | ||
305 | |||
306 | static int philips_fmd1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
307 | { | ||
308 | struct saa7134_dev *dev = fe->dvb->priv; | ||
309 | u8 tuner_buf[4]; | ||
310 | struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = tuner_buf,.len = | ||
311 | sizeof(tuner_buf) }; | ||
312 | int tuner_frequency = 0; | ||
313 | int divider = 0; | ||
314 | u8 band, mode, cp; | ||
315 | |||
316 | /* determine charge pump */ | ||
317 | tuner_frequency = params->frequency + 36130000; | ||
318 | if (tuner_frequency < 87000000) | ||
319 | return -EINVAL; | ||
320 | /* low band */ | ||
321 | else if (tuner_frequency < 180000000) { | ||
322 | band = 1; | ||
323 | mode = 7; | ||
324 | cp = 0; | ||
325 | } else if (tuner_frequency < 195000000) { | ||
326 | band = 1; | ||
327 | mode = 6; | ||
328 | cp = 1; | ||
329 | /* mid band */ | ||
330 | } else if (tuner_frequency < 366000000) { | ||
331 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
332 | band = 10; | ||
333 | } else { | ||
334 | band = 2; | ||
335 | } | ||
336 | mode = 7; | ||
337 | cp = 0; | ||
338 | } else if (tuner_frequency < 478000000) { | ||
339 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
340 | band = 10; | ||
341 | } else { | ||
342 | band = 2; | ||
343 | } | ||
344 | mode = 6; | ||
345 | cp = 1; | ||
346 | /* high band */ | ||
347 | } else if (tuner_frequency < 662000000) { | ||
348 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
349 | band = 12; | ||
350 | } else { | ||
351 | band = 4; | ||
352 | } | ||
353 | mode = 7; | ||
354 | cp = 0; | ||
355 | } else if (tuner_frequency < 840000000) { | ||
356 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
357 | band = 12; | ||
358 | } else { | ||
359 | band = 4; | ||
360 | } | ||
361 | mode = 6; | ||
362 | cp = 1; | ||
363 | } else { | ||
364 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { | ||
365 | band = 12; | ||
366 | } else { | ||
367 | band = 4; | ||
368 | } | ||
369 | mode = 7; | ||
370 | cp = 1; | ||
371 | |||
372 | } | ||
373 | /* calculate divisor */ | ||
374 | /* ((36166000 + Finput) / 166666) rounded! */ | ||
375 | divider = (tuner_frequency + 83333) / 166667; | ||
376 | |||
377 | /* setup tuner buffer */ | ||
378 | tuner_buf[0] = (divider >> 8) & 0x7f; | ||
379 | tuner_buf[1] = divider & 0xff; | ||
380 | tuner_buf[2] = 0x80 | (cp << 6) | (mode << 3) | 4; | ||
381 | tuner_buf[3] = 0x40 | band; | ||
382 | |||
383 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | ||
384 | return -EIO; | ||
385 | return 0; | ||
386 | } | ||
387 | |||
388 | |||
175 | static struct tda1004x_config medion_cardbus = { | 389 | static struct tda1004x_config medion_cardbus = { |
176 | .demod_address = 0x08, /* not sure this is correct */ | 390 | .demod_address = 0x08, |
177 | .invert = 0, | 391 | .invert = 1, |
178 | .invert_oclk = 0, | 392 | .invert_oclk = 0, |
179 | .pll_init = medion_cardbus_init, | 393 | .xtal_freq = TDA10046_XTAL_16M, |
180 | .pll_set = medion_cardbus_pll_set, | 394 | .agc_config = TDA10046_AGC_IFO_AUTO_NEG, |
181 | .request_firmware = fe_request_firmware, | 395 | .if_freq = TDA10046_FREQ_3613, |
396 | .pll_init = philips_fmd1216_pll_init, | ||
397 | .pll_set = philips_fmd1216_pll_set, | ||
398 | .pll_sleep = philips_fmd1216_analog, | ||
399 | .request_firmware = NULL, | ||
182 | }; | 400 | }; |
183 | 401 | ||
184 | /* ------------------------------------------------------------------ */ | 402 | /* ------------------------------------------------------------------ */ |
185 | 403 | ||
404 | struct tda827x_data { | ||
405 | u32 lomax; | ||
406 | u8 spd; | ||
407 | u8 bs; | ||
408 | u8 bp; | ||
409 | u8 cp; | ||
410 | u8 gc3; | ||
411 | u8 div1p5; | ||
412 | }; | ||
413 | |||
414 | static struct tda827x_data tda827x_dvbt[] = { | ||
415 | { .lomax = 62000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 1}, | ||
416 | { .lomax = 66000000, .spd = 3, .bs = 3, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 1}, | ||
417 | { .lomax = 76000000, .spd = 3, .bs = 1, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 0}, | ||
418 | { .lomax = 84000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 0}, | ||
419 | { .lomax = 93000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
420 | { .lomax = 98000000, .spd = 3, .bs = 3, .bp = 0, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
421 | { .lomax = 109000000, .spd = 3, .bs = 3, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
422 | { .lomax = 123000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 1}, | ||
423 | { .lomax = 133000000, .spd = 2, .bs = 3, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 1}, | ||
424 | { .lomax = 151000000, .spd = 2, .bs = 1, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
425 | { .lomax = 154000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
426 | { .lomax = 181000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 0, .div1p5 = 0}, | ||
427 | { .lomax = 185000000, .spd = 2, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
428 | { .lomax = 217000000, .spd = 2, .bs = 3, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
429 | { .lomax = 244000000, .spd = 1, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 1}, | ||
430 | { .lomax = 265000000, .spd = 1, .bs = 3, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 1}, | ||
431 | { .lomax = 302000000, .spd = 1, .bs = 1, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
432 | { .lomax = 324000000, .spd = 1, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
433 | { .lomax = 370000000, .spd = 1, .bs = 2, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
434 | { .lomax = 454000000, .spd = 1, .bs = 3, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
435 | { .lomax = 493000000, .spd = 0, .bs = 2, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 1}, | ||
436 | { .lomax = 530000000, .spd = 0, .bs = 3, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 1}, | ||
437 | { .lomax = 554000000, .spd = 0, .bs = 1, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0}, | ||
438 | { .lomax = 604000000, .spd = 0, .bs = 1, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0}, | ||
439 | { .lomax = 696000000, .spd = 0, .bs = 2, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0}, | ||
440 | { .lomax = 740000000, .spd = 0, .bs = 2, .bp = 4, .cp = 1, .gc3 = 0, .div1p5 = 0}, | ||
441 | { .lomax = 820000000, .spd = 0, .bs = 3, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0}, | ||
442 | { .lomax = 865000000, .spd = 0, .bs = 3, .bp = 4, .cp = 1, .gc3 = 0, .div1p5 = 0}, | ||
443 | { .lomax = 0, .spd = 0, .bs = 0, .bp = 0, .cp = 0, .gc3 = 0, .div1p5 = 0} | ||
444 | }; | ||
445 | |||
446 | static int philips_tda827x_pll_init(struct dvb_frontend *fe) | ||
447 | { | ||
448 | return 0; | ||
449 | } | ||
450 | |||
451 | static int philips_tda827x_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
452 | { | ||
453 | struct saa7134_dev *dev = fe->dvb->priv; | ||
454 | u8 tuner_buf[14]; | ||
455 | |||
456 | struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tuner_buf, | ||
457 | .len = sizeof(tuner_buf) }; | ||
458 | int i, tuner_freq, if_freq; | ||
459 | u32 N; | ||
460 | switch (params->u.ofdm.bandwidth) { | ||
461 | case BANDWIDTH_6_MHZ: | ||
462 | if_freq = 4000000; | ||
463 | break; | ||
464 | case BANDWIDTH_7_MHZ: | ||
465 | if_freq = 4500000; | ||
466 | break; | ||
467 | default: /* 8 MHz or Auto */ | ||
468 | if_freq = 5000000; | ||
469 | break; | ||
470 | } | ||
471 | tuner_freq = params->frequency + if_freq; | ||
472 | |||
473 | i = 0; | ||
474 | while (tda827x_dvbt[i].lomax < tuner_freq) { | ||
475 | if(tda827x_dvbt[i + 1].lomax == 0) | ||
476 | break; | ||
477 | i++; | ||
478 | } | ||
479 | |||
480 | N = ((tuner_freq + 125000) / 250000) << (tda827x_dvbt[i].spd + 2); | ||
481 | tuner_buf[0] = 0; | ||
482 | tuner_buf[1] = (N>>8) | 0x40; | ||
483 | tuner_buf[2] = N & 0xff; | ||
484 | tuner_buf[3] = 0; | ||
485 | tuner_buf[4] = 0x52; | ||
486 | tuner_buf[5] = (tda827x_dvbt[i].spd << 6) + (tda827x_dvbt[i].div1p5 << 5) + | ||
487 | (tda827x_dvbt[i].bs << 3) + tda827x_dvbt[i].bp; | ||
488 | tuner_buf[6] = (tda827x_dvbt[i].gc3 << 4) + 0x8f; | ||
489 | tuner_buf[7] = 0xbf; | ||
490 | tuner_buf[8] = 0x2a; | ||
491 | tuner_buf[9] = 0x05; | ||
492 | tuner_buf[10] = 0xff; | ||
493 | tuner_buf[11] = 0x00; | ||
494 | tuner_buf[12] = 0x00; | ||
495 | tuner_buf[13] = 0x40; | ||
496 | |||
497 | tuner_msg.len = 14; | ||
498 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | ||
499 | return -EIO; | ||
500 | |||
501 | msleep(500); | ||
502 | /* correct CP value */ | ||
503 | tuner_buf[0] = 0x30; | ||
504 | tuner_buf[1] = 0x50 + tda827x_dvbt[i].cp; | ||
505 | tuner_msg.len = 2; | ||
506 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); | ||
507 | |||
508 | return 0; | ||
509 | } | ||
510 | |||
511 | static void philips_tda827x_pll_sleep(struct dvb_frontend *fe) | ||
512 | { | ||
513 | struct saa7134_dev *dev = fe->dvb->priv; | ||
514 | static u8 tda827x_sleep[] = { 0x30, 0xd0}; | ||
515 | struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tda827x_sleep, | ||
516 | .len = sizeof(tda827x_sleep) }; | ||
517 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); | ||
518 | } | ||
519 | |||
520 | static struct tda1004x_config tda827x_lifeview_config = { | ||
521 | .demod_address = 0x08, | ||
522 | .invert = 1, | ||
523 | .invert_oclk = 0, | ||
524 | .xtal_freq = TDA10046_XTAL_16M, | ||
525 | .agc_config = TDA10046_AGC_TDA827X, | ||
526 | .if_freq = TDA10046_FREQ_045, | ||
527 | .pll_init = philips_tda827x_pll_init, | ||
528 | .pll_set = philips_tda827x_pll_set, | ||
529 | .pll_sleep = philips_tda827x_pll_sleep, | ||
530 | .request_firmware = NULL, | ||
531 | }; | ||
532 | #endif | ||
533 | |||
534 | /* ------------------------------------------------------------------ */ | ||
535 | |||
186 | static int dvb_init(struct saa7134_dev *dev) | 536 | static int dvb_init(struct saa7134_dev *dev) |
187 | { | 537 | { |
188 | /* init struct videobuf_dvb */ | 538 | /* init struct videobuf_dvb */ |
@@ -197,18 +547,31 @@ static int dvb_init(struct saa7134_dev *dev) | |||
197 | dev); | 547 | dev); |
198 | 548 | ||
199 | switch (dev->board) { | 549 | switch (dev->board) { |
550 | #if CONFIG_DVB_MT352 | ||
200 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: | 551 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: |
201 | printk("%s: pinnacle 300i dvb setup\n",dev->name); | 552 | printk("%s: pinnacle 300i dvb setup\n",dev->name); |
202 | dev->dvb.frontend = mt352_attach(&pinnacle_300i, | 553 | dev->dvb.frontend = mt352_attach(&pinnacle_300i, |
203 | &dev->i2c_adap); | 554 | &dev->i2c_adap); |
204 | break; | 555 | break; |
556 | #endif | ||
557 | #if CONFIG_DVB_TDA1004X | ||
205 | case SAA7134_BOARD_MD7134: | 558 | case SAA7134_BOARD_MD7134: |
206 | dev->dvb.frontend = tda10046_attach(&medion_cardbus, | 559 | dev->dvb.frontend = tda10046_attach(&medion_cardbus, |
207 | &dev->i2c_adap); | 560 | &dev->i2c_adap); |
208 | if (NULL == dev->dvb.frontend) | ||
209 | printk("%s: Hmm, looks like this is the old MD7134 " | ||
210 | "version without DVB-T support\n",dev->name); | ||
211 | break; | 561 | break; |
562 | case SAA7134_BOARD_PHILIPS_TOUGH: | ||
563 | dev->dvb.frontend = tda10046_attach(&philips_tu1216_config, | ||
564 | &dev->i2c_adap); | ||
565 | break; | ||
566 | case SAA7134_BOARD_FLYDVBTDUO: | ||
567 | dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, | ||
568 | &dev->i2c_adap); | ||
569 | break; | ||
570 | case SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS: | ||
571 | dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, | ||
572 | &dev->i2c_adap); | ||
573 | break; | ||
574 | #endif | ||
212 | default: | 575 | default: |
213 | printk("%s: Huh? unknown DVB card?\n",dev->name); | 576 | printk("%s: Huh? unknown DVB card?\n",dev->name); |
214 | break; | 577 | break; |
@@ -227,8 +590,6 @@ static int dvb_fini(struct saa7134_dev *dev) | |||
227 | { | 590 | { |
228 | static int on = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE; | 591 | static int on = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE; |
229 | 592 | ||
230 | printk("%s: %s\n",dev->name,__FUNCTION__); | ||
231 | |||
232 | switch (dev->board) { | 593 | switch (dev->board) { |
233 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: | 594 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: |
234 | /* otherwise we don't detect the tuner on next insmod */ | 595 | /* otherwise we don't detect the tuner on next insmod */ |
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c index b6f002e8421d..93dd61978541 100644 --- a/drivers/media/video/saa7134/saa7134-i2c.c +++ b/drivers/media/video/saa7134/saa7134-i2c.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-i2c.c,v 1.11 2005/06/12 01:36:14 mchehab Exp $ | 2 | * $Id: saa7134-i2c.c,v 1.19 2005/07/07 01:49:30 mkrufky Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * i2c interface support | 5 | * i2c interface support |
@@ -197,10 +197,6 @@ static inline int i2c_send_byte(struct saa7134_dev *dev, | |||
197 | enum i2c_status status; | 197 | enum i2c_status status; |
198 | __u32 dword; | 198 | __u32 dword; |
199 | 199 | ||
200 | #if 0 | ||
201 | i2c_set_attr(dev,attr); | ||
202 | saa_writeb(SAA7134_I2C_DATA, data); | ||
203 | #else | ||
204 | /* have to write both attr + data in one 32bit word */ | 200 | /* have to write both attr + data in one 32bit word */ |
205 | dword = saa_readl(SAA7134_I2C_ATTR_STATUS >> 2); | 201 | dword = saa_readl(SAA7134_I2C_ATTR_STATUS >> 2); |
206 | dword &= 0x0f; | 202 | dword &= 0x0f; |
@@ -210,7 +206,6 @@ static inline int i2c_send_byte(struct saa7134_dev *dev, | |||
210 | // dword |= 0x40 << 16; /* 400 kHz */ | 206 | // dword |= 0x40 << 16; /* 400 kHz */ |
211 | dword |= 0xf0 << 24; | 207 | dword |= 0xf0 << 24; |
212 | saa_writel(SAA7134_I2C_ATTR_STATUS >> 2, dword); | 208 | saa_writel(SAA7134_I2C_ATTR_STATUS >> 2, dword); |
213 | #endif | ||
214 | d2printk(KERN_DEBUG "%s: i2c data => 0x%x\n",dev->name,data); | 209 | d2printk(KERN_DEBUG "%s: i2c data => 0x%x\n",dev->name,data); |
215 | 210 | ||
216 | if (!i2c_is_busy_wait(dev)) | 211 | if (!i2c_is_busy_wait(dev)) |
@@ -331,12 +326,44 @@ static u32 functionality(struct i2c_adapter *adap) | |||
331 | 326 | ||
332 | static int attach_inform(struct i2c_client *client) | 327 | static int attach_inform(struct i2c_client *client) |
333 | { | 328 | { |
334 | struct saa7134_dev *dev = client->adapter->algo_data; | 329 | struct saa7134_dev *dev = client->adapter->algo_data; |
335 | int tuner = dev->tuner_type; | 330 | int tuner = dev->tuner_type; |
336 | int conf = dev->tda9887_conf; | 331 | int conf = dev->tda9887_conf; |
332 | struct tuner_setup tun_setup; | ||
333 | |||
334 | d1printk( "%s i2c attach [addr=0x%x,client=%s]\n", | ||
335 | client->driver->name,client->addr,i2c_clientname(client)); | ||
336 | |||
337 | if (!client->driver->command) | ||
338 | return 0; | ||
339 | |||
340 | if (saa7134_boards[dev->board].radio_type != UNSET) { | ||
341 | |||
342 | tun_setup.type = saa7134_boards[dev->board].radio_type; | ||
343 | tun_setup.addr = saa7134_boards[dev->board].radio_addr; | ||
344 | |||
345 | if ((tun_setup.addr == ADDR_UNSET) || (tun_setup.addr == client->addr)) { | ||
346 | tun_setup.mode_mask = T_RADIO; | ||
347 | |||
348 | client->driver->command(client, TUNER_SET_TYPE_ADDR, &tun_setup); | ||
349 | } | ||
350 | } | ||
351 | |||
352 | if (tuner != UNSET) { | ||
353 | |||
354 | tun_setup.type = tuner; | ||
355 | tun_setup.addr = saa7134_boards[dev->board].tuner_addr; | ||
356 | |||
357 | if ((tun_setup.addr == ADDR_UNSET)||(tun_setup.addr == client->addr)) { | ||
358 | |||
359 | tun_setup.mode_mask = T_ANALOG_TV; | ||
360 | |||
361 | client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_setup); | ||
362 | } | ||
363 | } | ||
364 | |||
365 | client->driver->command(client, TDA9887_SET_CONFIG, &conf); | ||
337 | 366 | ||
338 | saa7134_i2c_call_clients(dev,TUNER_SET_TYPE,&tuner); | ||
339 | saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&conf); | ||
340 | return 0; | 367 | return 0; |
341 | } | 368 | } |
342 | 369 | ||
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index aba2b9de60de..213740122fe6 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-input.c,v 1.19 2005/06/07 18:02:26 nsh Exp $ | 2 | * $Id: saa7134-input.c,v 1.21 2005/06/22 23:37:34 nsh Exp $ |
3 | * | 3 | * |
4 | * handle saa7134 IR remotes via linux kernel input layer. | 4 | * handle saa7134 IR remotes via linux kernel input layer. |
5 | * | 5 | * |
@@ -68,10 +68,8 @@ static IR_KEYTAB_TYPE flyvideo_codes[IR_KEYTAB_SIZE] = { | |||
68 | [ 6 ] = KEY_AGAIN, // Recal | 68 | [ 6 ] = KEY_AGAIN, // Recal |
69 | [ 16 ] = KEY_KPENTER, // Enter | 69 | [ 16 ] = KEY_KPENTER, // Enter |
70 | 70 | ||
71 | #if 1 /* FIXME */ | ||
72 | [ 26 ] = KEY_F22, // Stereo | 71 | [ 26 ] = KEY_F22, // Stereo |
73 | [ 24 ] = KEY_EDIT, // AV Source | 72 | [ 24 ] = KEY_EDIT, // AV Source |
74 | #endif | ||
75 | }; | 73 | }; |
76 | 74 | ||
77 | static IR_KEYTAB_TYPE cinergy_codes[IR_KEYTAB_SIZE] = { | 75 | static IR_KEYTAB_TYPE cinergy_codes[IR_KEYTAB_SIZE] = { |
@@ -172,45 +170,45 @@ static IR_KEYTAB_TYPE eztv_codes[IR_KEYTAB_SIZE] = { | |||
172 | }; | 170 | }; |
173 | 171 | ||
174 | static IR_KEYTAB_TYPE avacssmart_codes[IR_KEYTAB_SIZE] = { | 172 | static IR_KEYTAB_TYPE avacssmart_codes[IR_KEYTAB_SIZE] = { |
175 | [ 30 ] = KEY_POWER, // power | 173 | [ 30 ] = KEY_POWER, // power |
176 | [ 28 ] = KEY_SEARCH, // scan | 174 | [ 28 ] = KEY_SEARCH, // scan |
177 | [ 7 ] = KEY_SELECT, // source | 175 | [ 7 ] = KEY_SELECT, // source |
178 | 176 | ||
179 | [ 22 ] = KEY_VOLUMEUP, | 177 | [ 22 ] = KEY_VOLUMEUP, |
180 | [ 20 ] = KEY_VOLUMEDOWN, | 178 | [ 20 ] = KEY_VOLUMEDOWN, |
181 | [ 31 ] = KEY_CHANNELUP, | 179 | [ 31 ] = KEY_CHANNELUP, |
182 | [ 23 ] = KEY_CHANNELDOWN, | 180 | [ 23 ] = KEY_CHANNELDOWN, |
183 | [ 24 ] = KEY_MUTE, | 181 | [ 24 ] = KEY_MUTE, |
184 | 182 | ||
185 | [ 2 ] = KEY_KP0, | 183 | [ 2 ] = KEY_KP0, |
186 | [ 1 ] = KEY_KP1, | 184 | [ 1 ] = KEY_KP1, |
187 | [ 11 ] = KEY_KP2, | 185 | [ 11 ] = KEY_KP2, |
188 | [ 27 ] = KEY_KP3, | 186 | [ 27 ] = KEY_KP3, |
189 | [ 5 ] = KEY_KP4, | 187 | [ 5 ] = KEY_KP4, |
190 | [ 9 ] = KEY_KP5, | 188 | [ 9 ] = KEY_KP5, |
191 | [ 21 ] = KEY_KP6, | 189 | [ 21 ] = KEY_KP6, |
192 | [ 6 ] = KEY_KP7, | 190 | [ 6 ] = KEY_KP7, |
193 | [ 10 ] = KEY_KP8, | 191 | [ 10 ] = KEY_KP8, |
194 | [ 18 ] = KEY_KP9, | 192 | [ 18 ] = KEY_KP9, |
195 | [ 16 ] = KEY_KPDOT, | 193 | [ 16 ] = KEY_KPDOT, |
196 | 194 | ||
197 | [ 3 ] = KEY_TUNER, // tv/fm | 195 | [ 3 ] = KEY_TUNER, // tv/fm |
198 | [ 4 ] = KEY_REWIND, // fm tuning left or function left | 196 | [ 4 ] = KEY_REWIND, // fm tuning left or function left |
199 | [ 12 ] = KEY_FORWARD, // fm tuning right or function right | 197 | [ 12 ] = KEY_FORWARD, // fm tuning right or function right |
200 | 198 | ||
201 | [ 0 ] = KEY_RECORD, | 199 | [ 0 ] = KEY_RECORD, |
202 | [ 8 ] = KEY_STOP, | 200 | [ 8 ] = KEY_STOP, |
203 | [ 17 ] = KEY_PLAY, | 201 | [ 17 ] = KEY_PLAY, |
204 | 202 | ||
205 | [ 25 ] = KEY_ZOOM, | 203 | [ 25 ] = KEY_ZOOM, |
206 | [ 14 ] = KEY_MENU, // function | 204 | [ 14 ] = KEY_MENU, // function |
207 | [ 19 ] = KEY_AGAIN, // recall | 205 | [ 19 ] = KEY_AGAIN, // recall |
208 | [ 29 ] = KEY_RESTART, // reset | 206 | [ 29 ] = KEY_RESTART, // reset |
207 | [ 26 ] = KEY_SHUFFLE, // snapshot/shuffle | ||
209 | 208 | ||
210 | // FIXME | 209 | // FIXME |
211 | [ 13 ] = KEY_F21, // mts | 210 | [ 13 ] = KEY_F21, // mts |
212 | [ 15 ] = KEY_F22, // min | 211 | [ 15 ] = KEY_F22, // min |
213 | [ 26 ] = KEY_F23, // freeze | ||
214 | }; | 212 | }; |
215 | 213 | ||
216 | /* Alex Hermann <gaaf@gmx.net> */ | 214 | /* Alex Hermann <gaaf@gmx.net> */ |
@@ -489,13 +487,14 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
489 | break; | 487 | break; |
490 | case SAA7134_BOARD_ECS_TVP3XP: | 488 | case SAA7134_BOARD_ECS_TVP3XP: |
491 | case SAA7134_BOARD_ECS_TVP3XP_4CB5: | 489 | case SAA7134_BOARD_ECS_TVP3XP_4CB5: |
492 | ir_codes = eztv_codes; | 490 | ir_codes = eztv_codes; |
493 | mask_keycode = 0x00017c; | 491 | mask_keycode = 0x00017c; |
494 | mask_keyup = 0x000002; | 492 | mask_keyup = 0x000002; |
495 | polling = 50; // ms | 493 | polling = 50; // ms |
496 | break; | 494 | break; |
495 | case SAA7134_BOARD_KWORLD_XPERT: | ||
497 | case SAA7134_BOARD_AVACSSMARTTV: | 496 | case SAA7134_BOARD_AVACSSMARTTV: |
498 | ir_codes = avacssmart_codes; | 497 | ir_codes = avacssmart_codes; |
499 | mask_keycode = 0x00001F; | 498 | mask_keycode = 0x00001F; |
500 | mask_keyup = 0x000020; | 499 | mask_keyup = 0x000020; |
501 | polling = 50; // ms | 500 | polling = 50; // ms |
@@ -524,6 +523,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
524 | polling = 50; // ms | 523 | polling = 50; // ms |
525 | break; | 524 | break; |
526 | case SAA7134_BOARD_VIDEOMATE_TV_PVR: | 525 | case SAA7134_BOARD_VIDEOMATE_TV_PVR: |
526 | case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII: | ||
527 | ir_codes = videomate_tv_pvr_codes; | 527 | ir_codes = videomate_tv_pvr_codes; |
528 | mask_keycode = 0x00003F; | 528 | mask_keycode = 0x00003F; |
529 | mask_keyup = 0x400000; | 529 | mask_keyup = 0x400000; |
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c index 81732904623f..b5bede95dbf5 100644 --- a/drivers/media/video/saa7134/saa7134-oss.c +++ b/drivers/media/video/saa7134/saa7134-oss.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-oss.c,v 1.14 2005/05/18 22:45:16 hhackmann Exp $ | 2 | * $Id: saa7134-oss.c,v 1.17 2005/06/28 23:41:47 mkrufky Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * oss dsp interface | 5 | * oss dsp interface |
@@ -556,21 +556,28 @@ mixer_recsrc_7134(struct saa7134_dev *dev) | |||
556 | static int | 556 | static int |
557 | mixer_recsrc_7133(struct saa7134_dev *dev) | 557 | mixer_recsrc_7133(struct saa7134_dev *dev) |
558 | { | 558 | { |
559 | u32 value = 0xbbbbbb; | 559 | u32 anabar, xbarin; |
560 | 560 | ||
561 | xbarin = 0x03; // adc | ||
562 | anabar = 0; | ||
561 | switch (dev->oss.input) { | 563 | switch (dev->oss.input) { |
562 | case TV: | 564 | case TV: |
563 | value = 0xbbbb10; /* MAIN */ | 565 | xbarin = 0; // Demodulator |
566 | anabar = 2; // DACs | ||
564 | break; | 567 | break; |
565 | case LINE1: | 568 | case LINE1: |
566 | value = 0xbbbb32; /* AUX1 */ | 569 | anabar = 0; // aux1, aux1 |
567 | break; | 570 | break; |
568 | case LINE2: | 571 | case LINE2: |
569 | case LINE2_LEFT: | 572 | case LINE2_LEFT: |
570 | value = 0xbbbb54; /* AUX2 */ | 573 | anabar = 9; // aux2, aux2 |
571 | break; | 574 | break; |
572 | } | 575 | } |
573 | saa_dsp_writel(dev, 0x46c >> 2, value); | 576 | /* output xbar always main channel */ |
577 | saa_dsp_writel(dev, 0x46c >> 2, 0xbbbb10); | ||
578 | saa_dsp_writel(dev, 0x464 >> 2, xbarin); | ||
579 | saa_writel(0x594 >> 2, anabar); | ||
580 | |||
574 | return 0; | 581 | return 0; |
575 | } | 582 | } |
576 | 583 | ||
diff --git a/drivers/media/video/saa7134/saa7134-ts.c b/drivers/media/video/saa7134/saa7134-ts.c index 345eb2a8c28d..4dd9f1b23928 100644 --- a/drivers/media/video/saa7134/saa7134-ts.c +++ b/drivers/media/video/saa7134/saa7134-ts.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-ts.c,v 1.14 2005/02/03 10:24:33 kraxel Exp $ | 2 | * $Id: saa7134-ts.c,v 1.15 2005/06/14 22:48:18 hhackmann Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * video4linux video interface | 5 | * video4linux video interface |
@@ -221,10 +221,10 @@ void saa7134_irq_ts_done(struct saa7134_dev *dev, unsigned long status) | |||
221 | if (dev->ts_q.curr) { | 221 | if (dev->ts_q.curr) { |
222 | field = dev->ts_q.curr->vb.field; | 222 | field = dev->ts_q.curr->vb.field; |
223 | if (field == V4L2_FIELD_TOP) { | 223 | if (field == V4L2_FIELD_TOP) { |
224 | if ((status & 0x100000) != 0x000000) | 224 | if ((status & 0x100000) != 0x100000) |
225 | goto done; | 225 | goto done; |
226 | } else { | 226 | } else { |
227 | if ((status & 0x100000) != 0x100000) | 227 | if ((status & 0x100000) != 0x000000) |
228 | goto done; | 228 | goto done; |
229 | } | 229 | } |
230 | saa7134_buffer_finish(dev,&dev->ts_q,STATE_DONE); | 230 | saa7134_buffer_finish(dev,&dev->ts_q,STATE_DONE); |
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index 3617e7f7a410..eeafa5a71d2b 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-tvaudio.c,v 1.25 2005/06/07 19:00:38 nsh Exp $ | 2 | * $Id: saa7134-tvaudio.c,v 1.30 2005/06/28 23:41:47 mkrufky Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * tv audio decoder (fm stereo, nicam, ...) | 5 | * tv audio decoder (fm stereo, nicam, ...) |
@@ -169,7 +169,7 @@ static void tvaudio_init(struct saa7134_dev *dev) | |||
169 | int clock = saa7134_boards[dev->board].audio_clock; | 169 | int clock = saa7134_boards[dev->board].audio_clock; |
170 | 170 | ||
171 | if (UNSET != audio_clock_override) | 171 | if (UNSET != audio_clock_override) |
172 | clock = audio_clock_override; | 172 | clock = audio_clock_override; |
173 | 173 | ||
174 | /* init all audio registers */ | 174 | /* init all audio registers */ |
175 | saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x00); | 175 | saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x00); |
@@ -219,14 +219,17 @@ static void mute_input_7134(struct saa7134_dev *dev) | |||
219 | in = dev->input; | 219 | in = dev->input; |
220 | mute = (dev->ctl_mute || | 220 | mute = (dev->ctl_mute || |
221 | (dev->automute && (&card(dev).radio) != in)); | 221 | (dev->automute && (&card(dev).radio) != in)); |
222 | if (PCI_DEVICE_ID_PHILIPS_SAA7130 == dev->pci->device && | 222 | if (card(dev).mute.name) { |
223 | card(dev).mute.name) { | 223 | /* |
224 | /* 7130 - we'll mute using some unconnected audio input */ | 224 | * 7130 - we'll mute using some unconnected audio input |
225 | * 7134 - we'll probably should switch external mux with gpio | ||
226 | */ | ||
225 | if (mute) | 227 | if (mute) |
226 | in = &card(dev).mute; | 228 | in = &card(dev).mute; |
227 | } | 229 | } |
230 | |||
228 | if (dev->hw_mute == mute && | 231 | if (dev->hw_mute == mute && |
229 | dev->hw_input == in) { | 232 | dev->hw_input == in) { |
230 | dprintk("mute/input: nothing to do [mute=%d,input=%s]\n", | 233 | dprintk("mute/input: nothing to do [mute=%d,input=%s]\n", |
231 | mute,in->name); | 234 | mute,in->name); |
232 | return; | 235 | return; |
@@ -260,6 +263,7 @@ static void mute_input_7134(struct saa7134_dev *dev) | |||
260 | /* switch gpio-connected external audio mux */ | 263 | /* switch gpio-connected external audio mux */ |
261 | if (0 == card(dev).gpiomask) | 264 | if (0 == card(dev).gpiomask) |
262 | return; | 265 | return; |
266 | |||
263 | mask = card(dev).gpiomask; | 267 | mask = card(dev).gpiomask; |
264 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask); | 268 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask); |
265 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, in->gpio); | 269 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, in->gpio); |
@@ -339,13 +343,8 @@ static int tvaudio_sleep(struct saa7134_dev *dev, int timeout) | |||
339 | set_current_state(TASK_INTERRUPTIBLE); | 343 | set_current_state(TASK_INTERRUPTIBLE); |
340 | schedule(); | 344 | schedule(); |
341 | } else { | 345 | } else { |
342 | #if 0 | ||
343 | /* hmm, that one doesn't return on wakeup ... */ | ||
344 | msleep_interruptible(timeout); | ||
345 | #else | ||
346 | set_current_state(TASK_INTERRUPTIBLE); | 346 | set_current_state(TASK_INTERRUPTIBLE); |
347 | schedule_timeout(msecs_to_jiffies(timeout)); | 347 | schedule_timeout(msecs_to_jiffies(timeout)); |
348 | #endif | ||
349 | } | 348 | } |
350 | } | 349 | } |
351 | remove_wait_queue(&dev->thread.wq, &wait); | 350 | remove_wait_queue(&dev->thread.wq, &wait); |
@@ -400,27 +399,10 @@ static int tvaudio_checkcarrier(struct saa7134_dev *dev, struct mainscan *scan) | |||
400 | return value; | 399 | return value; |
401 | } | 400 | } |
402 | 401 | ||
403 | #if 0 | ||
404 | static void sifdebug_dump_regs(struct saa7134_dev *dev) | ||
405 | { | ||
406 | print_regb(AUDIO_STATUS); | ||
407 | print_regb(IDENT_SIF); | ||
408 | print_regb(LEVEL_READOUT1); | ||
409 | print_regb(LEVEL_READOUT2); | ||
410 | print_regb(DCXO_IDENT_CTRL); | ||
411 | print_regb(DEMODULATOR); | ||
412 | print_regb(AGC_GAIN_SELECT); | ||
413 | print_regb(MONITOR_SELECT); | ||
414 | print_regb(FM_DEEMPHASIS); | ||
415 | print_regb(FM_DEMATRIX); | ||
416 | print_regb(SIF_SAMPLE_FREQ); | ||
417 | print_regb(ANALOG_IO_SELECT); | ||
418 | } | ||
419 | #endif | ||
420 | 402 | ||
421 | static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *audio) | 403 | static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *audio) |
422 | { | 404 | { |
423 | __u32 idp,nicam; | 405 | __u32 idp, nicam, nicam_status; |
424 | int retval = -1; | 406 | int retval = -1; |
425 | 407 | ||
426 | switch (audio->mode) { | 408 | switch (audio->mode) { |
@@ -442,18 +424,24 @@ static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au | |||
442 | break; | 424 | break; |
443 | case TVAUDIO_NICAM_FM: | 425 | case TVAUDIO_NICAM_FM: |
444 | case TVAUDIO_NICAM_AM: | 426 | case TVAUDIO_NICAM_AM: |
445 | nicam = saa_readb(SAA7134_NICAM_STATUS); | 427 | nicam = saa_readb(SAA7134_AUDIO_STATUS); |
446 | dprintk("getstereo: nicam=0x%x\n",nicam); | 428 | dprintk("getstereo: nicam=0x%x\n",nicam); |
447 | switch (nicam & 0x0b) { | 429 | if (nicam & 0x1) { |
448 | case 0x08: | 430 | nicam_status = saa_readb(SAA7134_NICAM_STATUS); |
449 | retval = V4L2_TUNER_SUB_MONO; | 431 | dprintk("getstereo: nicam_status=0x%x\n", nicam_status); |
450 | break; | 432 | |
451 | case 0x09: | 433 | switch (nicam_status & 0x03) { |
452 | retval = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; | 434 | case 0x01: |
453 | break; | 435 | retval = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; |
454 | case 0x0a: | 436 | break; |
455 | retval = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; | 437 | case 0x02: |
456 | break; | 438 | retval = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; |
439 | break; | ||
440 | default: | ||
441 | retval = V4L2_TUNER_SUB_MONO; | ||
442 | } | ||
443 | } else { | ||
444 | /* No nicam detected */ | ||
457 | } | 445 | } |
458 | break; | 446 | break; |
459 | } | 447 | } |
@@ -489,15 +477,15 @@ static int tvaudio_setstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au | |||
489 | break; | 477 | break; |
490 | case TVAUDIO_FM_K_STEREO: | 478 | case TVAUDIO_FM_K_STEREO: |
491 | case TVAUDIO_FM_BG_STEREO: | 479 | case TVAUDIO_FM_BG_STEREO: |
480 | case TVAUDIO_NICAM_AM: | ||
481 | case TVAUDIO_NICAM_FM: | ||
492 | dprintk("setstereo [fm] => %s\n", | 482 | dprintk("setstereo [fm] => %s\n", |
493 | name[ mode % ARRAY_SIZE(name) ]); | 483 | name[ mode % ARRAY_SIZE(name) ]); |
494 | reg = fm[ mode % ARRAY_SIZE(fm) ]; | 484 | reg = fm[ mode % ARRAY_SIZE(fm) ]; |
495 | saa_writeb(SAA7134_FM_DEMATRIX, reg); | 485 | saa_writeb(SAA7134_FM_DEMATRIX, reg); |
496 | break; | 486 | break; |
497 | case TVAUDIO_FM_SAT_STEREO: | 487 | case TVAUDIO_FM_SAT_STEREO: |
498 | case TVAUDIO_NICAM_AM: | 488 | /* Not implemented */ |
499 | case TVAUDIO_NICAM_FM: | ||
500 | /* FIXME */ | ||
501 | break; | 489 | break; |
502 | } | 490 | } |
503 | return 0; | 491 | return 0; |
@@ -596,7 +584,7 @@ static int tvaudio_thread(void *data) | |||
596 | /* find the exact tv audio norm */ | 584 | /* find the exact tv audio norm */ |
597 | for (audio = UNSET, i = 0; i < TVAUDIO; i++) { | 585 | for (audio = UNSET, i = 0; i < TVAUDIO; i++) { |
598 | if (dev->tvnorm->id != UNSET && | 586 | if (dev->tvnorm->id != UNSET && |
599 | !(dev->tvnorm->id & tvaudio[i].std)) | 587 | !(dev->tvnorm->id & tvaudio[i].std)) |
600 | continue; | 588 | continue; |
601 | if (tvaudio[i].carr1 != carrier) | 589 | if (tvaudio[i].carr1 != carrier) |
602 | continue; | 590 | continue; |
@@ -703,24 +691,6 @@ static inline int saa_dsp_wait_bit(struct saa7134_dev *dev, int bit) | |||
703 | return 0; | 691 | return 0; |
704 | } | 692 | } |
705 | 693 | ||
706 | #if 0 | ||
707 | static int saa_dsp_readl(struct saa7134_dev *dev, int reg, u32 *value) | ||
708 | { | ||
709 | int err; | ||
710 | |||
711 | d2printk("dsp read reg 0x%x\n", reg<<2); | ||
712 | saa_readl(reg); | ||
713 | err = saa_dsp_wait_bit(dev,SAA7135_DSP_RWSTATE_RDB); | ||
714 | if (err < 0) | ||
715 | return err; | ||
716 | *value = saa_readl(reg); | ||
717 | d2printk("dsp read => 0x%06x\n", *value & 0xffffff); | ||
718 | err = saa_dsp_wait_bit(dev,SAA7135_DSP_RWSTATE_IDA); | ||
719 | if (err < 0) | ||
720 | return err; | ||
721 | return 0; | ||
722 | } | ||
723 | #endif | ||
724 | 694 | ||
725 | int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value) | 695 | int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value) |
726 | { | 696 | { |
@@ -753,31 +723,50 @@ static int getstereo_7133(struct saa7134_dev *dev) | |||
753 | static int mute_input_7133(struct saa7134_dev *dev) | 723 | static int mute_input_7133(struct saa7134_dev *dev) |
754 | { | 724 | { |
755 | u32 reg = 0; | 725 | u32 reg = 0; |
726 | u32 xbarin, xbarout; | ||
756 | int mask; | 727 | int mask; |
728 | struct saa7134_input *in; | ||
757 | 729 | ||
730 | /* Hac 0506 route OSS sound simultanously */ | ||
731 | xbarin = 0x03; | ||
758 | switch (dev->input->amux) { | 732 | switch (dev->input->amux) { |
759 | case TV: | 733 | case TV: |
760 | reg = 0x02; | 734 | reg = 0x02; |
735 | xbarin = 0; | ||
761 | break; | 736 | break; |
762 | case LINE1: | 737 | case LINE1: |
763 | reg = 0x00; | 738 | reg = 0x00; |
764 | break; | 739 | break; |
765 | case LINE2: | 740 | case LINE2: |
766 | case LINE2_LEFT: | 741 | case LINE2_LEFT: |
767 | reg = 0x01; | 742 | reg = 0x09; |
768 | break; | 743 | break; |
769 | } | 744 | } |
770 | if (dev->ctl_mute) | 745 | saa_dsp_writel(dev, 0x464 >> 2, xbarin); |
746 | if (dev->ctl_mute) { | ||
771 | reg = 0x07; | 747 | reg = 0x07; |
748 | xbarout = 0xbbbbbb; | ||
749 | } else | ||
750 | xbarout = 0xbbbb10; | ||
751 | saa_dsp_writel(dev, 0x46c >> 2, xbarout); | ||
752 | |||
772 | saa_writel(0x594 >> 2, reg); | 753 | saa_writel(0x594 >> 2, reg); |
773 | 754 | ||
755 | |||
774 | /* switch gpio-connected external audio mux */ | 756 | /* switch gpio-connected external audio mux */ |
775 | if (0 != card(dev).gpiomask) { | 757 | if (0 != card(dev).gpiomask) { |
776 | mask = card(dev).gpiomask; | 758 | mask = card(dev).gpiomask; |
759 | |||
760 | if (card(dev).mute.name && dev->ctl_mute) | ||
761 | in = &card(dev).mute; | ||
762 | else | ||
763 | in = dev->input; | ||
764 | |||
777 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask); | 765 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask); |
778 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, dev->input->gpio); | 766 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, in->gpio); |
779 | saa7134_track_gpio(dev,dev->input->name); | 767 | saa7134_track_gpio(dev,in->name); |
780 | } | 768 | } |
769 | |||
781 | return 0; | 770 | return 0; |
782 | } | 771 | } |
783 | 772 | ||
diff --git a/drivers/media/video/saa7134/saa7134-vbi.c b/drivers/media/video/saa7134/saa7134-vbi.c index 3c33c591cc85..29e51cad2aaf 100644 --- a/drivers/media/video/saa7134/saa7134-vbi.c +++ b/drivers/media/video/saa7134/saa7134-vbi.c | |||
@@ -130,13 +130,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
130 | lines = norm->vbi_v_stop_0 - norm->vbi_v_start_0 +1; | 130 | lines = norm->vbi_v_stop_0 - norm->vbi_v_start_0 +1; |
131 | if (lines > VBI_LINE_COUNT) | 131 | if (lines > VBI_LINE_COUNT) |
132 | lines = VBI_LINE_COUNT; | 132 | lines = VBI_LINE_COUNT; |
133 | #if 1 | ||
134 | llength = VBI_LINE_LENGTH; | 133 | llength = VBI_LINE_LENGTH; |
135 | #else | ||
136 | llength = (norm->h_stop - norm->h_start +1) * 2; | ||
137 | if (llength > VBI_LINE_LENGTH) | ||
138 | llength = VBI_LINE_LENGTH; | ||
139 | #endif | ||
140 | size = lines * llength * 2; | 134 | size = lines * llength * 2; |
141 | if (0 != buf->vb.baddr && buf->vb.bsize < size) | 135 | if (0 != buf->vb.baddr && buf->vb.bsize < size) |
142 | return -EINVAL; | 136 | return -EINVAL; |
@@ -178,13 +172,7 @@ buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size) | |||
178 | int llength,lines; | 172 | int llength,lines; |
179 | 173 | ||
180 | lines = dev->tvnorm->vbi_v_stop_0 - dev->tvnorm->vbi_v_start_0 +1; | 174 | lines = dev->tvnorm->vbi_v_stop_0 - dev->tvnorm->vbi_v_start_0 +1; |
181 | #if 1 | ||
182 | llength = VBI_LINE_LENGTH; | 175 | llength = VBI_LINE_LENGTH; |
183 | #else | ||
184 | llength = (norm->h_stop - norm->h_start +1) * 2; | ||
185 | if (llength > VBI_LINE_LENGTH) | ||
186 | llength = VBI_LINE_LENGTH; | ||
187 | #endif | ||
188 | *size = lines * llength * 2; | 176 | *size = lines * llength * 2; |
189 | if (0 == *count) | 177 | if (0 == *count) |
190 | *count = vbibufs; | 178 | *count = vbibufs; |
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index c0a2ee520531..a4c2f751d097 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-video.c,v 1.30 2005/06/07 19:00:38 nsh Exp $ | 2 | * $Id: saa7134-video.c,v 1.36 2005/06/28 23:41:47 mkrufky Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * video4linux video interface | 5 | * video4linux video interface |
@@ -274,7 +274,7 @@ static struct saa7134_tvnorm tvnorms[] = { | |||
274 | 274 | ||
275 | .h_start = 0, | 275 | .h_start = 0, |
276 | .h_stop = 719, | 276 | .h_stop = 719, |
277 | .video_v_start = 23, | 277 | .video_v_start = 23, |
278 | .video_v_stop = 262, | 278 | .video_v_stop = 262, |
279 | .vbi_v_start_0 = 10, | 279 | .vbi_v_start_0 = 10, |
280 | .vbi_v_stop_0 = 21, | 280 | .vbi_v_stop_0 = 21, |
@@ -1204,7 +1204,6 @@ static int video_open(struct inode *inode, struct file *file) | |||
1204 | struct list_head *list; | 1204 | struct list_head *list; |
1205 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 1205 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1206 | int radio = 0; | 1206 | int radio = 0; |
1207 | |||
1208 | list_for_each(list,&saa7134_devlist) { | 1207 | list_for_each(list,&saa7134_devlist) { |
1209 | h = list_entry(list, struct saa7134_dev, devlist); | 1208 | h = list_entry(list, struct saa7134_dev, devlist); |
1210 | if (h->video_dev && (h->video_dev->minor == minor)) | 1209 | if (h->video_dev && (h->video_dev->minor == minor)) |
@@ -1256,12 +1255,12 @@ static int video_open(struct inode *inode, struct file *file) | |||
1256 | if (fh->radio) { | 1255 | if (fh->radio) { |
1257 | /* switch to radio mode */ | 1256 | /* switch to radio mode */ |
1258 | saa7134_tvaudio_setinput(dev,&card(dev).radio); | 1257 | saa7134_tvaudio_setinput(dev,&card(dev).radio); |
1259 | saa7134_i2c_call_clients(dev,AUDC_SET_RADIO,NULL); | 1258 | saa7134_i2c_call_clients(dev,AUDC_SET_RADIO, NULL); |
1260 | } else { | 1259 | } else { |
1261 | /* switch to video/vbi mode */ | 1260 | /* switch to video/vbi mode */ |
1262 | video_mux(dev,dev->ctl_input); | 1261 | video_mux(dev,dev->ctl_input); |
1263 | } | 1262 | } |
1264 | return 0; | 1263 | return 0; |
1265 | } | 1264 | } |
1266 | 1265 | ||
1267 | static ssize_t | 1266 | static ssize_t |
@@ -1304,10 +1303,10 @@ video_poll(struct file *file, struct poll_table_struct *wait) | |||
1304 | } else { | 1303 | } else { |
1305 | down(&fh->cap.lock); | 1304 | down(&fh->cap.lock); |
1306 | if (UNSET == fh->cap.read_off) { | 1305 | if (UNSET == fh->cap.read_off) { |
1307 | /* need to capture a new frame */ | 1306 | /* need to capture a new frame */ |
1308 | if (res_locked(fh->dev,RESOURCE_VIDEO)) { | 1307 | if (res_locked(fh->dev,RESOURCE_VIDEO)) { |
1309 | up(&fh->cap.lock); | 1308 | up(&fh->cap.lock); |
1310 | return POLLERR; | 1309 | return POLLERR; |
1311 | } | 1310 | } |
1312 | if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field)) { | 1311 | if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field)) { |
1313 | up(&fh->cap.lock); | 1312 | up(&fh->cap.lock); |
@@ -1363,6 +1362,36 @@ static int video_release(struct inode *inode, struct file *file) | |||
1363 | res_free(dev,fh,RESOURCE_VBI); | 1362 | res_free(dev,fh,RESOURCE_VBI); |
1364 | } | 1363 | } |
1365 | 1364 | ||
1365 | /* ts-capture will not work in planar mode, so turn it off Hac: 04.05*/ | ||
1366 | saa_andorb(SAA7134_OFMT_VIDEO_A, 0x1f, 0); | ||
1367 | saa_andorb(SAA7134_OFMT_VIDEO_B, 0x1f, 0); | ||
1368 | saa_andorb(SAA7134_OFMT_DATA_A, 0x1f, 0); | ||
1369 | saa_andorb(SAA7134_OFMT_DATA_B, 0x1f, 0); | ||
1370 | |||
1371 | if (dev->tuner_type == TUNER_PHILIPS_TDA8290) { | ||
1372 | u8 data[2]; | ||
1373 | int ret; | ||
1374 | struct i2c_msg msg = {.addr=I2C_ADDR_TDA8290, .flags=0, .buf=data, .len = 2}; | ||
1375 | data[0] = 0x21; | ||
1376 | data[1] = 0xc0; | ||
1377 | ret = i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
1378 | if (ret != 1) | ||
1379 | printk(KERN_ERR "TDA8290 access failure\n"); | ||
1380 | msg.addr = I2C_ADDR_TDA8275; | ||
1381 | data[0] = 0x30; | ||
1382 | data[1] = 0xd0; | ||
1383 | ret = i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
1384 | if (ret != 1) | ||
1385 | printk(KERN_ERR "TDA8275 access failure\n"); | ||
1386 | msg.addr = I2C_ADDR_TDA8290; | ||
1387 | data[0] = 0x21; | ||
1388 | data[1] = 0x80; | ||
1389 | i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
1390 | data[0] = 0x00; | ||
1391 | data[1] = 0x02; | ||
1392 | i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
1393 | } | ||
1394 | |||
1366 | /* free stuff */ | 1395 | /* free stuff */ |
1367 | videobuf_mmap_free(&fh->cap); | 1396 | videobuf_mmap_free(&fh->cap); |
1368 | videobuf_mmap_free(&fh->vbi); | 1397 | videobuf_mmap_free(&fh->vbi); |
@@ -1399,13 +1428,6 @@ static void saa7134_vbi_fmt(struct saa7134_dev *dev, struct v4l2_format *f) | |||
1399 | f->fmt.vbi.count[1] = f->fmt.vbi.count[0]; | 1428 | f->fmt.vbi.count[1] = f->fmt.vbi.count[0]; |
1400 | f->fmt.vbi.flags = 0; /* VBI_UNSYNC VBI_INTERLACED */ | 1429 | f->fmt.vbi.flags = 0; /* VBI_UNSYNC VBI_INTERLACED */ |
1401 | 1430 | ||
1402 | #if 0 | ||
1403 | if (V4L2_STD_PAL == norm->id) { | ||
1404 | /* FIXME */ | ||
1405 | f->fmt.vbi.start[0] += 3; | ||
1406 | f->fmt.vbi.start[1] += 3*2; | ||
1407 | } | ||
1408 | #endif | ||
1409 | } | 1431 | } |
1410 | 1432 | ||
1411 | static int saa7134_g_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh, | 1433 | static int saa7134_g_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh, |
@@ -2120,8 +2142,6 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, | |||
2120 | 2142 | ||
2121 | memset(t,0,sizeof(*t)); | 2143 | memset(t,0,sizeof(*t)); |
2122 | strcpy(t->name, "Radio"); | 2144 | strcpy(t->name, "Radio"); |
2123 | t->rangelow = (int)(65*16); | ||
2124 | t->rangehigh = (int)(108*16); | ||
2125 | 2145 | ||
2126 | saa7134_i2c_call_clients(dev, VIDIOC_G_TUNER, t); | 2146 | saa7134_i2c_call_clients(dev, VIDIOC_G_TUNER, t); |
2127 | 2147 | ||
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index d6b1c0d4d0f9..6836c07794fc 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134.h,v 1.41 2005/06/07 18:02:26 nsh Exp $ | 2 | * $Id: saa7134.h,v 1.48 2005/07/01 08:22:24 nsh Exp $ |
3 | * | 3 | * |
4 | * v4l2 device driver for philips saa7134 based TV cards | 4 | * v4l2 device driver for philips saa7134 based TV cards |
5 | * | 5 | * |
@@ -46,8 +46,6 @@ | |||
46 | #endif | 46 | #endif |
47 | #define UNSET (-1U) | 47 | #define UNSET (-1U) |
48 | 48 | ||
49 | /* 2.4 / 2.5 driver compatibility stuff */ | ||
50 | |||
51 | /* ----------------------------------------------------------- */ | 49 | /* ----------------------------------------------------------- */ |
52 | /* enums */ | 50 | /* enums */ |
53 | 51 | ||
@@ -159,7 +157,7 @@ struct saa7134_format { | |||
159 | #define SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER 33 | 157 | #define SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER 33 |
160 | #define SAA7134_BOARD_NOVAC_PRIMETV7133 34 | 158 | #define SAA7134_BOARD_NOVAC_PRIMETV7133 34 |
161 | #define SAA7134_BOARD_AVERMEDIA_STUDIO_305 35 | 159 | #define SAA7134_BOARD_AVERMEDIA_STUDIO_305 35 |
162 | #define SAA7133_BOARD_UPMOST_PURPLE_TV 36 | 160 | #define SAA7134_BOARD_UPMOST_PURPLE_TV 36 |
163 | #define SAA7134_BOARD_ITEMS_MTV005 37 | 161 | #define SAA7134_BOARD_ITEMS_MTV005 37 |
164 | #define SAA7134_BOARD_CINERGY200 38 | 162 | #define SAA7134_BOARD_CINERGY200 38 |
165 | #define SAA7134_BOARD_FLYTVPLATINUM_MINI 39 | 163 | #define SAA7134_BOARD_FLYTVPLATINUM_MINI 39 |
@@ -176,13 +174,17 @@ struct saa7134_format { | |||
176 | #define SAA7134_BOARD_PINNACLE_300I_DVBT_PAL 50 | 174 | #define SAA7134_BOARD_PINNACLE_300I_DVBT_PAL 50 |
177 | #define SAA7134_BOARD_PROVIDEO_PV952 51 | 175 | #define SAA7134_BOARD_PROVIDEO_PV952 51 |
178 | #define SAA7134_BOARD_AVERMEDIA_305 52 | 176 | #define SAA7134_BOARD_AVERMEDIA_305 52 |
179 | #define SAA7135_BOARD_ASUSTeK_TVFM7135 53 | 177 | #define SAA7134_BOARD_ASUSTeK_TVFM7135 53 |
180 | #define SAA7134_BOARD_FLYTVPLATINUM_FM 54 | 178 | #define SAA7134_BOARD_FLYTVPLATINUM_FM 54 |
181 | #define SAA7134_BOARD_FLYDVBTDUO 55 | 179 | #define SAA7134_BOARD_FLYDVBTDUO 55 |
182 | #define SAA7134_BOARD_AVERMEDIA_307 56 | 180 | #define SAA7134_BOARD_AVERMEDIA_307 56 |
183 | #define SAA7134_BOARD_AVERMEDIA_GO_007_FM 57 | 181 | #define SAA7134_BOARD_AVERMEDIA_GO_007_FM 57 |
184 | #define SAA7134_BOARD_ADS_INSTANT_TV 58 | 182 | #define SAA7134_BOARD_ADS_INSTANT_TV 58 |
185 | #define SAA7134_BOARD_KWORLD_VSTREAM_XPERT 59 | 183 | #define SAA7134_BOARD_KWORLD_VSTREAM_XPERT 59 |
184 | #define SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS 60 | ||
185 | #define SAA7134_BOARD_PHILIPS_TOUGH 61 | ||
186 | #define SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII 62 | ||
187 | #define SAA7134_BOARD_KWORLD_XPERT 63 | ||
186 | 188 | ||
187 | #define SAA7134_MAXBOARDS 8 | 189 | #define SAA7134_MAXBOARDS 8 |
188 | #define SAA7134_INPUT_MAX 8 | 190 | #define SAA7134_INPUT_MAX 8 |
@@ -213,6 +215,10 @@ struct saa7134_board { | |||
213 | 215 | ||
214 | /* i2c chip info */ | 216 | /* i2c chip info */ |
215 | unsigned int tuner_type; | 217 | unsigned int tuner_type; |
218 | unsigned int radio_type; | ||
219 | unsigned char tuner_addr; | ||
220 | unsigned char radio_addr; | ||
221 | |||
216 | unsigned int tda9887_conf; | 222 | unsigned int tda9887_conf; |
217 | 223 | ||
218 | /* peripheral I/O */ | 224 | /* peripheral I/O */ |
@@ -403,9 +409,12 @@ struct saa7134_dev { | |||
403 | /* config info */ | 409 | /* config info */ |
404 | unsigned int board; | 410 | unsigned int board; |
405 | unsigned int tuner_type; | 411 | unsigned int tuner_type; |
412 | unsigned int radio_type; | ||
413 | unsigned char tuner_addr; | ||
414 | unsigned char radio_addr; | ||
415 | |||
406 | unsigned int tda9887_conf; | 416 | unsigned int tda9887_conf; |
407 | unsigned int gpio_value; | 417 | unsigned int gpio_value; |
408 | unsigned int irq2_mask; | ||
409 | 418 | ||
410 | /* i2c i/o */ | 419 | /* i2c i/o */ |
411 | struct i2c_adapter i2c_adap; | 420 | struct i2c_adapter i2c_adap; |
diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c index 07ba6d3ed08c..7cb1fb3e66f9 100644 --- a/drivers/media/video/tda7432.c +++ b/drivers/media/video/tda7432.c | |||
@@ -243,19 +243,6 @@ static int tda7432_write(struct i2c_client *client, int subaddr, int val) | |||
243 | } | 243 | } |
244 | 244 | ||
245 | /* I don't think we ever actually _read_ the chip... */ | 245 | /* I don't think we ever actually _read_ the chip... */ |
246 | #if 0 | ||
247 | static int tda7432_read(struct i2c_client *client) | ||
248 | { | ||
249 | unsigned char buffer; | ||
250 | d2printk("tda7432: In tda7432_read\n"); | ||
251 | if (1 != i2c_master_recv(client,&buffer,1)) { | ||
252 | printk(KERN_WARNING "tda7432: I/O error, trying (read)\n"); | ||
253 | return -1; | ||
254 | } | ||
255 | dprintk("tda7432: Read 0x%02x\n", buffer); | ||
256 | return buffer; | ||
257 | } | ||
258 | #endif | ||
259 | 246 | ||
260 | static int tda7432_set(struct i2c_client *client) | 247 | static int tda7432_set(struct i2c_client *client) |
261 | { | 248 | { |
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index f59d4601cc63..a8b6a8df5109 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: tda8290.c,v 1.11 2005/06/18 06:09:06 nsh Exp $ | 2 | * $Id: tda8290.c,v 1.15 2005/07/08 20:21:33 mchehab Exp $ |
3 | * | 3 | * |
4 | * i2c tv tuner chip device driver | 4 | * i2c tv tuner chip device driver |
5 | * controls the philips tda8290+75 tuner chip combo. | 5 | * controls the philips tda8290+75 tuner chip combo. |
@@ -136,15 +136,12 @@ static int tda8290_tune(struct i2c_client *c) | |||
136 | return 0; | 136 | return 0; |
137 | } | 137 | } |
138 | 138 | ||
139 | static void set_frequency(struct tuner *t, u16 ifc) | 139 | static void set_frequency(struct tuner *t, u16 ifc, unsigned int freq) |
140 | { | 140 | { |
141 | u32 freq; | ||
142 | u32 N; | 141 | u32 N; |
143 | 142 | ||
144 | if (t->mode == V4L2_TUNER_RADIO) | 143 | if (t->mode == V4L2_TUNER_RADIO) |
145 | freq = t->freq / 1000; | 144 | freq = freq / 1000; |
146 | else | ||
147 | freq = t->freq; | ||
148 | 145 | ||
149 | N = (((freq<<3)+ifc)&0x3fffc); | 146 | N = (((freq<<3)+ifc)&0x3fffc); |
150 | 147 | ||
@@ -187,14 +184,14 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
187 | struct tuner *t = i2c_get_clientdata(c); | 184 | struct tuner *t = i2c_get_clientdata(c); |
188 | 185 | ||
189 | set_audio(t); | 186 | set_audio(t); |
190 | set_frequency(t, 864); | 187 | set_frequency(t, 864, freq); |
191 | tda8290_tune(c); | 188 | tda8290_tune(c); |
192 | } | 189 | } |
193 | 190 | ||
194 | static void set_radio_freq(struct i2c_client *c, unsigned int freq) | 191 | static void set_radio_freq(struct i2c_client *c, unsigned int freq) |
195 | { | 192 | { |
196 | struct tuner *t = i2c_get_clientdata(c); | 193 | struct tuner *t = i2c_get_clientdata(c); |
197 | set_frequency(t, 704); | 194 | set_frequency(t, 704, freq); |
198 | tda8290_tune(c); | 195 | tda8290_tune(c); |
199 | } | 196 | } |
200 | 197 | ||
diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c index 97b113e070f3..566e1a5ca135 100644 --- a/drivers/media/video/tda9875.c +++ b/drivers/media/video/tda9875.c | |||
@@ -123,19 +123,6 @@ static int tda9875_write(struct i2c_client *client, int subaddr, unsigned char v | |||
123 | return 0; | 123 | return 0; |
124 | } | 124 | } |
125 | 125 | ||
126 | #if 0 | ||
127 | static int tda9875_read(struct i2c_client *client) | ||
128 | { | ||
129 | unsigned char buffer; | ||
130 | dprintk("In tda9875_read\n"); | ||
131 | if (1 != i2c_master_recv(client,&buffer,1)) { | ||
132 | printk(KERN_WARNING "tda9875: I/O error, trying (read)\n"); | ||
133 | return -1; | ||
134 | } | ||
135 | dprintk("Read 0x%02x\n", buffer); | ||
136 | return buffer; | ||
137 | } | ||
138 | #endif | ||
139 | 126 | ||
140 | static int i2c_read_register(struct i2c_adapter *adap, int addr, int reg) | 127 | static int i2c_read_register(struct i2c_adapter *adap, int addr, int reg) |
141 | { | 128 | { |
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index ee35562f4d1a..108c3ad7d622 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c | |||
@@ -569,15 +569,6 @@ static int tda9887_configure(struct tda9887 *t) | |||
569 | tda9887_set_config(t,buf); | 569 | tda9887_set_config(t,buf); |
570 | tda9887_set_insmod(t,buf); | 570 | tda9887_set_insmod(t,buf); |
571 | 571 | ||
572 | #if 0 | ||
573 | /* This as-is breaks some cards, must be fixed in a | ||
574 | * card-specific way, probably using TDA9887_SET_CONFIG to | ||
575 | * turn on/off port2 */ | ||
576 | if (t->std & V4L2_STD_SECAM_L) { | ||
577 | /* secam fixup (FIXME: move this to tvnorms array?) */ | ||
578 | buf[1] &= ~cOutputPort2Inactive; | ||
579 | } | ||
580 | #endif | ||
581 | 572 | ||
582 | dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n", | 573 | dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n", |
583 | buf[1],buf[2],buf[3]); | 574 | buf[1],buf[2],buf[3]); |
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c index a29f08f81f63..b53c748caf2a 100644 --- a/drivers/media/video/tea5767.c +++ b/drivers/media/video/tea5767.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview | 2 | * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview |
3 | * I2C address is allways 0xC0. | 3 | * I2C address is allways 0xC0. |
4 | * | 4 | * |
5 | * $Id: tea5767.c,v 1.11 2005/06/21 15:40:33 mchehab Exp $ | 5 | * $Id: tea5767.c,v 1.18 2005/07/07 03:02:55 mchehab Exp $ |
6 | * | 6 | * |
7 | * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) | 7 | * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) |
8 | * This code is placed under the terms of the GNU General Public License | 8 | * This code is placed under the terms of the GNU General Public License |
@@ -11,23 +11,11 @@ | |||
11 | * from their contributions on DScaler. | 11 | * from their contributions on DScaler. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/sched.h> | ||
18 | #include <linux/string.h> | ||
19 | #include <linux/timer.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <linux/errno.h> | ||
22 | #include <linux/slab.h> | ||
23 | #include <linux/videodev.h> | ||
24 | #include <linux/i2c.h> | 14 | #include <linux/i2c.h> |
25 | #include <linux/i2c-algo-bit.h> | 15 | #include <linux/videodev.h> |
26 | 16 | #include <linux/delay.h> | |
17 | #include <media/tuner.h> | ||
27 | #include <media/tuner.h> | 18 | #include <media/tuner.h> |
28 | |||
29 | /* Declared at tuner-core.c */ | ||
30 | extern unsigned int tuner_debug; | ||
31 | 19 | ||
32 | #define PREFIX "TEA5767 " | 20 | #define PREFIX "TEA5767 " |
33 | 21 | ||
@@ -38,8 +26,8 @@ extern unsigned int tuner_debug; | |||
38 | ******************************/ | 26 | ******************************/ |
39 | 27 | ||
40 | /* First register */ | 28 | /* First register */ |
41 | #define TEA5767_MUTE 0x80 /* Mutes output */ | 29 | #define TEA5767_MUTE 0x80 /* Mutes output */ |
42 | #define TEA5767_SEARCH 0x40 /* Activates station search */ | 30 | #define TEA5767_SEARCH 0x40 /* Activates station search */ |
43 | /* Bits 0-5 for divider MSB */ | 31 | /* Bits 0-5 for divider MSB */ |
44 | 32 | ||
45 | /* Second register */ | 33 | /* Second register */ |
@@ -130,6 +118,14 @@ extern unsigned int tuner_debug; | |||
130 | /* Reserved for future extensions */ | 118 | /* Reserved for future extensions */ |
131 | #define TEA5767_RESERVED_MASK 0xff | 119 | #define TEA5767_RESERVED_MASK 0xff |
132 | 120 | ||
121 | enum tea5767_xtal_freq { | ||
122 | TEA5767_LOW_LO_32768 = 0, | ||
123 | TEA5767_HIGH_LO_32768 = 1, | ||
124 | TEA5767_LOW_LO_13MHz = 2, | ||
125 | TEA5767_HIGH_LO_13MHz = 3, | ||
126 | }; | ||
127 | |||
128 | |||
133 | /*****************************************************************************/ | 129 | /*****************************************************************************/ |
134 | 130 | ||
135 | static void set_tv_freq(struct i2c_client *c, unsigned int freq) | 131 | static void set_tv_freq(struct i2c_client *c, unsigned int freq) |
@@ -153,103 +149,112 @@ static void tea5767_status_dump(unsigned char *buffer) | |||
153 | else | 149 | else |
154 | printk(PREFIX "Tuner not at band limit\n"); | 150 | printk(PREFIX "Tuner not at band limit\n"); |
155 | 151 | ||
156 | div=((buffer[0]&0x3f)<<8) | buffer[1]; | 152 | div = ((buffer[0] & 0x3f) << 8) | buffer[1]; |
157 | 153 | ||
158 | switch (TEA5767_HIGH_LO_32768) { | 154 | switch (TEA5767_HIGH_LO_32768) { |
159 | case TEA5767_HIGH_LO_13MHz: | 155 | case TEA5767_HIGH_LO_13MHz: |
160 | frq = 1000*(div*50-700-225)/4; /* Freq in KHz */ | 156 | frq = 1000 * (div * 50 - 700 - 225) / 4; /* Freq in KHz */ |
161 | break; | 157 | break; |
162 | case TEA5767_LOW_LO_13MHz: | 158 | case TEA5767_LOW_LO_13MHz: |
163 | frq = 1000*(div*50+700+225)/4; /* Freq in KHz */ | 159 | frq = 1000 * (div * 50 + 700 + 225) / 4; /* Freq in KHz */ |
164 | break; | 160 | break; |
165 | case TEA5767_LOW_LO_32768: | 161 | case TEA5767_LOW_LO_32768: |
166 | frq = 1000*(div*32768/1000+700+225)/4; /* Freq in KHz */ | 162 | frq = 1000 * (div * 32768 / 1000 + 700 + 225) / 4; /* Freq in KHz */ |
167 | break; | 163 | break; |
168 | case TEA5767_HIGH_LO_32768: | 164 | case TEA5767_HIGH_LO_32768: |
169 | default: | 165 | default: |
170 | frq = 1000*(div*32768/1000-700-225)/4; /* Freq in KHz */ | 166 | frq = 1000 * (div * 32768 / 1000 - 700 - 225) / 4; /* Freq in KHz */ |
171 | break; | 167 | break; |
172 | } | 168 | } |
173 | buffer[0] = (div>>8) & 0x3f; | 169 | buffer[0] = (div >> 8) & 0x3f; |
174 | buffer[1] = div & 0xff; | 170 | buffer[1] = div & 0xff; |
175 | 171 | ||
176 | printk(PREFIX "Frequency %d.%03d KHz (divider = 0x%04x)\n", | 172 | printk(PREFIX "Frequency %d.%03d KHz (divider = 0x%04x)\n", |
177 | frq/1000,frq%1000,div); | 173 | frq / 1000, frq % 1000, div); |
178 | 174 | ||
179 | if (TEA5767_STEREO_MASK & buffer[2]) | 175 | if (TEA5767_STEREO_MASK & buffer[2]) |
180 | printk(PREFIX "Stereo\n"); | 176 | printk(PREFIX "Stereo\n"); |
181 | else | 177 | else |
182 | printk(PREFIX "Mono\n"); | 178 | printk(PREFIX "Mono\n"); |
183 | 179 | ||
184 | printk(PREFIX "IF Counter = %d\n",buffer[2] & TEA5767_IF_CNTR_MASK); | 180 | printk(PREFIX "IF Counter = %d\n", buffer[2] & TEA5767_IF_CNTR_MASK); |
185 | 181 | ||
186 | printk(PREFIX "ADC Level = %d\n",(buffer[3] & TEA5767_ADC_LEVEL_MASK)>>4); | 182 | printk(PREFIX "ADC Level = %d\n", |
183 | (buffer[3] & TEA5767_ADC_LEVEL_MASK) >> 4); | ||
187 | 184 | ||
188 | printk(PREFIX "Chip ID = %d\n",(buffer[3] & TEA5767_CHIP_ID_MASK)); | 185 | printk(PREFIX "Chip ID = %d\n", (buffer[3] & TEA5767_CHIP_ID_MASK)); |
189 | 186 | ||
190 | printk(PREFIX "Reserved = 0x%02x\n",(buffer[4] & TEA5767_RESERVED_MASK)); | 187 | printk(PREFIX "Reserved = 0x%02x\n", |
188 | (buffer[4] & TEA5767_RESERVED_MASK)); | ||
191 | } | 189 | } |
192 | 190 | ||
193 | /* Freq should be specifyed at 62.5 Hz */ | 191 | /* Freq should be specifyed at 62.5 Hz */ |
194 | static void set_radio_freq(struct i2c_client *c, unsigned int frq) | 192 | static void set_radio_freq(struct i2c_client *c, unsigned int frq) |
195 | { | 193 | { |
196 | struct tuner *t = i2c_get_clientdata(c); | 194 | struct tuner *t = i2c_get_clientdata(c); |
197 | unsigned char buffer[5]; | 195 | unsigned char buffer[5]; |
198 | unsigned div; | 196 | unsigned div; |
199 | int rc; | 197 | int rc; |
200 | 198 | ||
201 | if ( tuner_debug ) | 199 | tuner_dbg (PREFIX "radio freq counter %d\n", frq); |
202 | printk(PREFIX "radio freq counter %d\n",frq); | ||
203 | 200 | ||
204 | /* Rounds freq to next decimal value - for 62.5 KHz step */ | 201 | /* Rounds freq to next decimal value - for 62.5 KHz step */ |
205 | /* frq = 20*(frq/16)+radio_frq[frq%16]; */ | 202 | /* frq = 20*(frq/16)+radio_frq[frq%16]; */ |
206 | 203 | ||
207 | buffer[2] = TEA5767_PORT1_HIGH; | 204 | buffer[2] = TEA5767_PORT1_HIGH; |
208 | buffer[3] = TEA5767_PORT2_HIGH | TEA5767_HIGH_CUT_CTRL | TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND; | 205 | buffer[3] = TEA5767_PORT2_HIGH | TEA5767_HIGH_CUT_CTRL | |
209 | buffer[4]=0; | 206 | TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND; |
207 | buffer[4] = 0; | ||
208 | |||
209 | if (t->mode == T_STANDBY) { | ||
210 | tuner_dbg("TEA5767 set to standby mode\n"); | ||
211 | buffer[3] |= TEA5767_STDBY; | ||
212 | } | ||
210 | 213 | ||
211 | if (t->audmode == V4L2_TUNER_MODE_MONO) { | 214 | if (t->audmode == V4L2_TUNER_MODE_MONO) { |
212 | tuner_dbg("TEA5767 set to mono\n"); | 215 | tuner_dbg("TEA5767 set to mono\n"); |
213 | buffer[2] |= TEA5767_MONO; | 216 | buffer[2] |= TEA5767_MONO; |
214 | } else | 217 | } else { |
215 | tuner_dbg("TEA5767 set to stereo\n"); | 218 | tuner_dbg("TEA5767 set to stereo\n"); |
219 | } | ||
216 | 220 | ||
217 | switch (t->type) { | 221 | /* Should be replaced */ |
222 | switch (TEA5767_HIGH_LO_32768) { | ||
218 | case TEA5767_HIGH_LO_13MHz: | 223 | case TEA5767_HIGH_LO_13MHz: |
219 | tuner_dbg("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n"); | 224 | tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n"); |
220 | buffer[2] |= TEA5767_HIGH_LO_INJECT; | 225 | buffer[2] |= TEA5767_HIGH_LO_INJECT; |
221 | buffer[4] |= TEA5767_PLLREF_ENABLE; | 226 | buffer[4] |= TEA5767_PLLREF_ENABLE; |
222 | div = (frq*4/16+700+225+25)/50; | 227 | div = (frq * 4 / 16 + 700 + 225 + 25) / 50; |
223 | break; | 228 | break; |
224 | case TEA5767_LOW_LO_13MHz: | 229 | case TEA5767_LOW_LO_13MHz: |
225 | tuner_dbg("TEA5767 radio LOW LO inject xtal @ 13 MHz\n"); | 230 | tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 13 MHz\n"); |
226 | 231 | ||
227 | buffer[4] |= TEA5767_PLLREF_ENABLE; | 232 | buffer[4] |= TEA5767_PLLREF_ENABLE; |
228 | div = (frq*4/16-700-225+25)/50; | 233 | div = (frq * 4 / 16 - 700 - 225 + 25) / 50; |
229 | break; | 234 | break; |
230 | case TEA5767_LOW_LO_32768: | 235 | case TEA5767_LOW_LO_32768: |
231 | tuner_dbg("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n"); | 236 | tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n"); |
232 | buffer[3] |= TEA5767_XTAL_32768; | 237 | buffer[3] |= TEA5767_XTAL_32768; |
233 | /* const 700=4000*175 Khz - to adjust freq to right value */ | 238 | /* const 700=4000*175 Khz - to adjust freq to right value */ |
234 | div = (1000*(frq*4/16-700-225)+16384)>>15; | 239 | div = (1000 * (frq * 4 / 16 - 700 - 225) + 16384) >> 15; |
235 | break; | 240 | break; |
236 | case TEA5767_HIGH_LO_32768: | 241 | case TEA5767_HIGH_LO_32768: |
237 | default: | 242 | default: |
238 | tuner_dbg("TEA5767 radio HIGH LO inject xtal @ 32,768 MHz\n"); | 243 | tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 32,768 MHz\n"); |
239 | 244 | ||
240 | buffer[2] |= TEA5767_HIGH_LO_INJECT; | 245 | buffer[2] |= TEA5767_HIGH_LO_INJECT; |
241 | buffer[3] |= TEA5767_XTAL_32768; | 246 | buffer[3] |= TEA5767_XTAL_32768; |
242 | div = (1000*(frq*4/16+700+225)+16384)>>15; | 247 | div = (1000 * (frq * 4 / 16 + 700 + 225) + 16384) >> 15; |
243 | break; | 248 | break; |
244 | } | 249 | } |
245 | buffer[0] = (div>>8) & 0x3f; | 250 | buffer[0] = (div >> 8) & 0x3f; |
246 | buffer[1] = div & 0xff; | 251 | buffer[1] = div & 0xff; |
247 | 252 | ||
248 | if ( tuner_debug ) | 253 | if (tuner_debug) |
249 | tea5767_status_dump(buffer); | 254 | tea5767_status_dump(buffer); |
250 | 255 | ||
251 | if (5 != (rc = i2c_master_send(c,buffer,5))) | 256 | if (5 != (rc = i2c_master_send(c, buffer, 5))) |
252 | tuner_warn("i2c i/o error: rc == %d (should be 5)\n",rc); | 257 | tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc); |
253 | } | 258 | } |
254 | 259 | ||
255 | static int tea5767_signal(struct i2c_client *c) | 260 | static int tea5767_signal(struct i2c_client *c) |
@@ -258,11 +263,11 @@ static int tea5767_signal(struct i2c_client *c) | |||
258 | int rc; | 263 | int rc; |
259 | struct tuner *t = i2c_get_clientdata(c); | 264 | struct tuner *t = i2c_get_clientdata(c); |
260 | 265 | ||
261 | memset(buffer,0,sizeof(buffer)); | 266 | memset(buffer, 0, sizeof(buffer)); |
262 | if (5 != (rc = i2c_master_recv(c,buffer,5))) | 267 | if (5 != (rc = i2c_master_recv(c, buffer, 5))) |
263 | tuner_warn ( "i2c i/o error: rc == %d (should be 5)\n",rc); | 268 | tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc); |
264 | 269 | ||
265 | return ((buffer[3] & TEA5767_ADC_LEVEL_MASK) <<(13-4)); | 270 | return ((buffer[3] & TEA5767_ADC_LEVEL_MASK) << (13 - 4)); |
266 | } | 271 | } |
267 | 272 | ||
268 | static int tea5767_stereo(struct i2c_client *c) | 273 | static int tea5767_stereo(struct i2c_client *c) |
@@ -271,47 +276,46 @@ static int tea5767_stereo(struct i2c_client *c) | |||
271 | int rc; | 276 | int rc; |
272 | struct tuner *t = i2c_get_clientdata(c); | 277 | struct tuner *t = i2c_get_clientdata(c); |
273 | 278 | ||
274 | memset(buffer,0,sizeof(buffer)); | 279 | memset(buffer, 0, sizeof(buffer)); |
275 | if (5 != (rc = i2c_master_recv(c,buffer,5))) | 280 | if (5 != (rc = i2c_master_recv(c, buffer, 5))) |
276 | tuner_warn ( "i2c i/o error: rc == %d (should be 5)\n",rc); | 281 | tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc); |
277 | 282 | ||
278 | rc = buffer[2] & TEA5767_STEREO_MASK; | 283 | rc = buffer[2] & TEA5767_STEREO_MASK; |
279 | 284 | ||
280 | if ( tuner_debug ) | 285 | tuner_dbg("TEA5767 radio ST GET = %02x\n", rc); |
281 | tuner_dbg("TEA5767 radio ST GET = %02x\n", rc); | ||
282 | 286 | ||
283 | return ( (buffer[2] & TEA5767_STEREO_MASK) ? V4L2_TUNER_SUB_STEREO: 0); | 287 | return ((buffer[2] & TEA5767_STEREO_MASK) ? V4L2_TUNER_SUB_STEREO : 0); |
284 | } | 288 | } |
285 | 289 | ||
286 | int tea_detection(struct i2c_client *c) | 290 | int tea5767_autodetection(struct i2c_client *c) |
287 | { | 291 | { |
288 | unsigned char buffer[5]= { 0xff, 0xff, 0xff, 0xff, 0xff }; | 292 | unsigned char buffer[5] = { 0xff, 0xff, 0xff, 0xff, 0xff }; |
289 | int rc; | 293 | int rc; |
290 | struct tuner *t = i2c_get_clientdata(c); | 294 | struct tuner *t = i2c_get_clientdata(c); |
291 | 295 | ||
292 | if (5 != (rc = i2c_master_recv(c,buffer,5))) { | 296 | if (5 != (rc = i2c_master_recv(c, buffer, 5))) { |
293 | tuner_warn ( "it is not a TEA5767. Received %i chars.\n",rc ); | 297 | tuner_warn("it is not a TEA5767. Received %i chars.\n", rc); |
294 | return EINVAL; | 298 | return EINVAL; |
295 | } | 299 | } |
296 | 300 | ||
297 | /* If all bytes are the same then it's a TV tuner and not a tea5767 chip. */ | 301 | /* If all bytes are the same then it's a TV tuner and not a tea5767 chip. */ |
298 | if (buffer[0] == buffer[1] && buffer[0] == buffer[2] && | 302 | if (buffer[0] == buffer[1] && buffer[0] == buffer[2] && |
299 | buffer[0] == buffer[3] && buffer[0] == buffer[4]) { | 303 | buffer[0] == buffer[3] && buffer[0] == buffer[4]) { |
300 | tuner_warn ( "All bytes are equal. It is not a TEA5767\n" ); | 304 | tuner_warn("All bytes are equal. It is not a TEA5767\n"); |
301 | return EINVAL; | 305 | return EINVAL; |
302 | } | 306 | } |
303 | 307 | ||
304 | /* Status bytes: | 308 | /* Status bytes: |
305 | * Byte 4: bit 3:1 : CI (Chip Identification) == 0 | 309 | * Byte 4: bit 3:1 : CI (Chip Identification) == 0 |
306 | * bit 0 : internally set to 0 | 310 | * bit 0 : internally set to 0 |
307 | * Byte 5: bit 7:0 : == 0 | 311 | * Byte 5: bit 7:0 : == 0 |
308 | */ | 312 | */ |
309 | 313 | ||
310 | if (!((buffer[3] & 0x0f) == 0x00) && (buffer[4] == 0x00)) { | 314 | if (!((buffer[3] & 0x0f) == 0x00) && (buffer[4] == 0x00)) { |
311 | tuner_warn ( "Chip ID is not zero. It is not a TEA5767\n" ); | 315 | tuner_warn("Chip ID is not zero. It is not a TEA5767\n"); |
312 | return EINVAL; | 316 | return EINVAL; |
313 | } | 317 | } |
314 | tuner_warn ( "TEA5767 detected.\n" ); | 318 | tuner_warn("TEA5767 detected.\n"); |
315 | return 0; | 319 | return 0; |
316 | } | 320 | } |
317 | 321 | ||
@@ -319,16 +323,16 @@ int tea5767_tuner_init(struct i2c_client *c) | |||
319 | { | 323 | { |
320 | struct tuner *t = i2c_get_clientdata(c); | 324 | struct tuner *t = i2c_get_clientdata(c); |
321 | 325 | ||
322 | if (tea_detection(c)==EINVAL) return EINVAL; | 326 | if (tea5767_autodetection(c) == EINVAL) |
327 | return EINVAL; | ||
323 | 328 | ||
324 | tuner_info("type set to %d (%s)\n", | 329 | tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio"); |
325 | t->type, TEA5767_TUNER_NAME); | 330 | strlcpy(c->name, "tea5767", sizeof(c->name)); |
326 | strlcpy(c->name, TEA5767_TUNER_NAME, sizeof(c->name)); | ||
327 | 331 | ||
328 | t->tv_freq = set_tv_freq; | 332 | t->tv_freq = set_tv_freq; |
329 | t->radio_freq = set_radio_freq; | 333 | t->radio_freq = set_radio_freq; |
330 | t->has_signal = tea5767_signal; | 334 | t->has_signal = tea5767_signal; |
331 | t->is_stereo = tea5767_stereo; | 335 | t->is_stereo = tea5767_stereo; |
332 | 336 | ||
333 | return (0); | 337 | return (0); |
334 | } | 338 | } |
diff --git a/drivers/media/video/tuner-3036.c b/drivers/media/video/tuner-3036.c index 51748c6578d1..7d825e510ffd 100644 --- a/drivers/media/video/tuner-3036.c +++ b/drivers/media/video/tuner-3036.c | |||
@@ -152,7 +152,7 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
152 | 152 | ||
153 | switch (cmd) | 153 | switch (cmd) |
154 | { | 154 | { |
155 | case TUNER_SET_TVFREQ: | 155 | case VIDIOCSFREQ: |
156 | set_tv_freq(client, *iarg); | 156 | set_tv_freq(client, *iarg); |
157 | break; | 157 | break; |
158 | 158 | ||
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 6f6bf4a633fc..de190630babb 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: tuner-core.c,v 1.29 2005/06/21 15:40:33 mchehab Exp $ | 2 | * $Id: tuner-core.c,v 1.55 2005/07/08 13:20:33 mchehab Exp $ |
3 | * | 3 | * |
4 | * i2c tv tuner chip device driver | 4 | * i2c tv tuner chip device driver |
5 | * core core, i.e. kernel interfaces, registering and so on | 5 | * core core, i.e. kernel interfaces, registering and so on |
@@ -23,42 +23,36 @@ | |||
23 | #include <media/tuner.h> | 23 | #include <media/tuner.h> |
24 | #include <media/audiochip.h> | 24 | #include <media/audiochip.h> |
25 | 25 | ||
26 | /* | ||
27 | * comment line bellow to return to old behavor, where only one I2C device is supported | ||
28 | */ | ||
29 | |||
30 | #define UNSET (-1U) | 26 | #define UNSET (-1U) |
31 | 27 | ||
32 | /* standard i2c insmod options */ | 28 | /* standard i2c insmod options */ |
33 | static unsigned short normal_i2c[] = { | 29 | static unsigned short normal_i2c[] = { |
34 | 0x4b, /* tda8290 */ | 30 | 0x4b, /* tda8290 */ |
35 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, | 31 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, |
36 | 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | 32 | 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, |
37 | I2C_CLIENT_END | 33 | I2C_CLIENT_END |
38 | }; | 34 | }; |
35 | |||
39 | I2C_CLIENT_INSMOD; | 36 | I2C_CLIENT_INSMOD; |
40 | 37 | ||
41 | /* insmod options used at init time => read/only */ | 38 | /* insmod options used at init time => read/only */ |
42 | static unsigned int addr = 0; | 39 | static unsigned int addr = 0; |
43 | module_param(addr, int, 0444); | 40 | module_param(addr, int, 0444); |
44 | 41 | ||
45 | /* insmod options used at runtime => read/write */ | 42 | /* insmod options used at runtime => read/write */ |
46 | unsigned int tuner_debug = 0; | 43 | unsigned int tuner_debug = 0; |
47 | module_param(tuner_debug, int, 0644); | 44 | module_param(tuner_debug, int, 0644); |
48 | 45 | ||
49 | static unsigned int tv_range[2] = { 44, 958 }; | 46 | static unsigned int tv_range[2] = { 44, 958 }; |
50 | static unsigned int radio_range[2] = { 65, 108 }; | 47 | static unsigned int radio_range[2] = { 65, 108 }; |
51 | 48 | ||
52 | module_param_array(tv_range, int, NULL, 0644); | 49 | module_param_array(tv_range, int, NULL, 0644); |
53 | module_param_array(radio_range, int, NULL, 0644); | 50 | module_param_array(radio_range, int, NULL, 0644); |
54 | 51 | ||
55 | MODULE_DESCRIPTION("device driver for various TV and TV+FM radio tuners"); | 52 | MODULE_DESCRIPTION("device driver for various TV and TV+FM radio tuners"); |
56 | MODULE_AUTHOR("Ralph Metzler, Gerd Knorr, Gunther Mayer"); | 53 | MODULE_AUTHOR("Ralph Metzler, Gerd Knorr, Gunther Mayer"); |
57 | MODULE_LICENSE("GPL"); | 54 | MODULE_LICENSE("GPL"); |
58 | 55 | ||
59 | static int this_adap; | ||
60 | static unsigned short first_tuner, tv_tuner, radio_tuner; | ||
61 | |||
62 | static struct i2c_driver driver; | 56 | static struct i2c_driver driver; |
63 | static struct i2c_client client_template; | 57 | static struct i2c_client client_template; |
64 | 58 | ||
@@ -70,18 +64,19 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
70 | struct tuner *t = i2c_get_clientdata(c); | 64 | struct tuner *t = i2c_get_clientdata(c); |
71 | 65 | ||
72 | if (t->type == UNSET) { | 66 | if (t->type == UNSET) { |
73 | tuner_info("tuner type not set\n"); | 67 | tuner_warn ("tuner type not set\n"); |
74 | return; | 68 | return; |
75 | } | 69 | } |
76 | if (NULL == t->tv_freq) { | 70 | if (NULL == t->tv_freq) { |
77 | tuner_info("Huh? tv_set is NULL?\n"); | 71 | tuner_warn ("Tuner has no way to set tv freq\n"); |
78 | return; | 72 | return; |
79 | } | 73 | } |
80 | if (freq < tv_range[0]*16 || freq > tv_range[1]*16) { | 74 | if (freq < tv_range[0] * 16 || freq > tv_range[1] * 16) { |
81 | tuner_info("TV freq (%d.%02d) out of range (%d-%d)\n", | 75 | tuner_dbg ("TV freq (%d.%02d) out of range (%d-%d)\n", |
82 | freq/16,freq%16*100/16,tv_range[0],tv_range[1]); | 76 | freq / 16, freq % 16 * 100 / 16, tv_range[0], |
77 | tv_range[1]); | ||
83 | } | 78 | } |
84 | t->tv_freq(c,freq); | 79 | t->tv_freq(c, freq); |
85 | } | 80 | } |
86 | 81 | ||
87 | static void set_radio_freq(struct i2c_client *c, unsigned int freq) | 82 | static void set_radio_freq(struct i2c_client *c, unsigned int freq) |
@@ -89,24 +84,20 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
89 | struct tuner *t = i2c_get_clientdata(c); | 84 | struct tuner *t = i2c_get_clientdata(c); |
90 | 85 | ||
91 | if (t->type == UNSET) { | 86 | if (t->type == UNSET) { |
92 | tuner_info("tuner type not set\n"); | 87 | tuner_warn ("tuner type not set\n"); |
93 | return; | 88 | return; |
94 | } | 89 | } |
95 | if (NULL == t->radio_freq) { | 90 | if (NULL == t->radio_freq) { |
96 | tuner_info("no radio tuning for this one, sorry.\n"); | 91 | tuner_warn ("tuner has no way to set radio frequency\n"); |
97 | return; | 92 | return; |
98 | } | 93 | } |
99 | if (freq >= radio_range[0]*16000 && freq <= radio_range[1]*16000) { | 94 | if (freq <= radio_range[0] * 16000 || freq >= radio_range[1] * 16000) { |
100 | if (tuner_debug) | 95 | tuner_dbg ("radio freq (%d.%02d) out of range (%d-%d)\n", |
101 | tuner_info("radio freq step 62.5Hz (%d.%06d)\n", | 96 | freq / 16000, freq % 16000 * 100 / 16000, |
102 | freq/16000,freq%16000*1000/16); | 97 | radio_range[0], radio_range[1]); |
103 | t->radio_freq(c,freq); | ||
104 | } else { | ||
105 | tuner_info("radio freq (%d.%02d) out of range (%d-%d)\n", | ||
106 | freq/16,freq%16*100/16, | ||
107 | radio_range[0],radio_range[1]); | ||
108 | } | 98 | } |
109 | 99 | ||
100 | t->radio_freq(c, freq); | ||
110 | return; | 101 | return; |
111 | } | 102 | } |
112 | 103 | ||
@@ -117,42 +108,45 @@ static void set_freq(struct i2c_client *c, unsigned long freq) | |||
117 | switch (t->mode) { | 108 | switch (t->mode) { |
118 | case V4L2_TUNER_RADIO: | 109 | case V4L2_TUNER_RADIO: |
119 | tuner_dbg("radio freq set to %lu.%02lu\n", | 110 | tuner_dbg("radio freq set to %lu.%02lu\n", |
120 | freq/16,freq%16*100/16); | 111 | freq / 16000, freq % 16000 * 100 / 16000); |
121 | set_radio_freq(c,freq); | 112 | set_radio_freq(c, freq); |
122 | break; | 113 | break; |
123 | case V4L2_TUNER_ANALOG_TV: | 114 | case V4L2_TUNER_ANALOG_TV: |
124 | case V4L2_TUNER_DIGITAL_TV: | 115 | case V4L2_TUNER_DIGITAL_TV: |
125 | tuner_dbg("tv freq set to %lu.%02lu\n", | 116 | tuner_dbg("tv freq set to %lu.%02lu\n", |
126 | freq/16,freq%16*100/16); | 117 | freq / 16, freq % 16 * 100 / 16); |
127 | set_tv_freq(c, freq); | 118 | set_tv_freq(c, freq); |
128 | break; | 119 | break; |
129 | } | 120 | } |
130 | t->freq = freq; | 121 | t->freq = freq; |
131 | } | 122 | } |
132 | 123 | ||
133 | static void set_type(struct i2c_client *c, unsigned int type) | 124 | static void set_type(struct i2c_client *c, unsigned int type, |
125 | unsigned int new_mode_mask) | ||
134 | { | 126 | { |
135 | struct tuner *t = i2c_get_clientdata(c); | 127 | struct tuner *t = i2c_get_clientdata(c); |
136 | unsigned char buffer[4]; | 128 | unsigned char buffer[4]; |
137 | 129 | ||
138 | /* sanity check */ | 130 | if (type == UNSET || type == TUNER_ABSENT) { |
139 | if (type == UNSET || type == TUNER_ABSENT) | 131 | tuner_dbg ("tuner 0x%02x: Tuner type absent\n",c->addr); |
140 | return; | 132 | return; |
141 | if (type >= tuner_count) | 133 | } |
134 | |||
135 | if (type >= tuner_count) { | ||
136 | tuner_warn ("tuner 0x%02x: Tuner count greater than %d\n",c->addr,tuner_count); | ||
142 | return; | 137 | return; |
138 | } | ||
143 | 139 | ||
140 | /* This code detects calls by card attach_inform */ | ||
144 | if (NULL == t->i2c.dev.driver) { | 141 | if (NULL == t->i2c.dev.driver) { |
145 | /* not registered yet */ | 142 | tuner_dbg ("tuner 0x%02x: called during i2c_client register by adapter's attach_inform\n", c->addr); |
146 | t->type = type; | 143 | |
144 | t->type=type; | ||
147 | return; | 145 | return; |
148 | } | 146 | } |
149 | if ((t->initialized) && (t->type == type)) | ||
150 | /* run only once except type change Hac 04/05*/ | ||
151 | return; | ||
152 | |||
153 | t->initialized = 1; | ||
154 | 147 | ||
155 | t->type = type; | 148 | t->type = type; |
149 | |||
156 | switch (t->type) { | 150 | switch (t->type) { |
157 | case TUNER_MT2032: | 151 | case TUNER_MT2032: |
158 | microtune_init(c); | 152 | microtune_init(c); |
@@ -161,136 +155,194 @@ static void set_type(struct i2c_client *c, unsigned int type) | |||
161 | tda8290_init(c); | 155 | tda8290_init(c); |
162 | break; | 156 | break; |
163 | case TUNER_TEA5767: | 157 | case TUNER_TEA5767: |
164 | if (tea5767_tuner_init(c)==EINVAL) t->type=TUNER_ABSENT; | 158 | if (tea5767_tuner_init(c) == EINVAL) { |
159 | t->type = TUNER_ABSENT; | ||
160 | t->mode_mask = T_UNINITIALIZED; | ||
161 | return; | ||
162 | } | ||
163 | t->mode_mask = T_RADIO; | ||
165 | break; | 164 | break; |
166 | case TUNER_PHILIPS_FMD1216ME_MK3: | 165 | case TUNER_PHILIPS_FMD1216ME_MK3: |
167 | buffer[0] = 0x0b; | 166 | buffer[0] = 0x0b; |
168 | buffer[1] = 0xdc; | 167 | buffer[1] = 0xdc; |
169 | buffer[2] = 0x9c; | 168 | buffer[2] = 0x9c; |
170 | buffer[3] = 0x60; | 169 | buffer[3] = 0x60; |
171 | i2c_master_send(c,buffer,4); | 170 | i2c_master_send(c, buffer, 4); |
172 | mdelay(1); | 171 | mdelay(1); |
173 | buffer[2] = 0x86; | 172 | buffer[2] = 0x86; |
174 | buffer[3] = 0x54; | 173 | buffer[3] = 0x54; |
175 | i2c_master_send(c,buffer,4); | 174 | i2c_master_send(c, buffer, 4); |
176 | default_tuner_init(c); | 175 | default_tuner_init(c); |
177 | break; | 176 | break; |
178 | default: | 177 | default: |
179 | /* TEA5767 autodetection code */ | ||
180 | if (tea5767_tuner_init(c)!=EINVAL) { | ||
181 | t->type = TUNER_TEA5767; | ||
182 | if (first_tuner == 0x60) | ||
183 | first_tuner++; | ||
184 | break; | ||
185 | } | ||
186 | |||
187 | default_tuner_init(c); | 178 | default_tuner_init(c); |
188 | break; | 179 | break; |
189 | } | 180 | } |
190 | tuner_dbg ("I2C addr 0x%02x with type %d\n",c->addr<<1,type); | 181 | |
182 | if (t->mode_mask == T_UNINITIALIZED) | ||
183 | t->mode_mask = new_mode_mask; | ||
184 | |||
185 | set_freq(c, t->freq); | ||
186 | tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n", | ||
187 | c->adapter->name, c->driver->name, c->addr << 1, type, | ||
188 | t->mode_mask); | ||
191 | } | 189 | } |
192 | 190 | ||
193 | #define CHECK_ADDR(tp,cmd,tun) if (client->addr!=tp) { \ | 191 | /* |
194 | return 0; } else if (tuner_debug) \ | 192 | * This function apply tuner config to tuner specified |
195 | tuner_info ("Cmd %s accepted to "tun"\n",cmd); | 193 | * by tun_setup structure. I addr is unset, then admin status |
196 | #define CHECK_MODE(cmd) if (t->mode == V4L2_TUNER_RADIO) { \ | 194 | * and tun addr status is more precise then current status, |
197 | CHECK_ADDR(radio_tuner,cmd,"radio") } else \ | 195 | * it's applied. Otherwise status and type are applied only to |
198 | { CHECK_ADDR(tv_tuner,cmd,"TV"); } | 196 | * tuner with exactly the same addr. |
197 | */ | ||
198 | |||
199 | static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup) | ||
200 | { | ||
201 | struct tuner *t = i2c_get_clientdata(c); | ||
202 | |||
203 | if (tun_setup->addr == ADDR_UNSET) { | ||
204 | if (t->mode_mask & tun_setup->mode_mask) | ||
205 | set_type(c, tun_setup->type, tun_setup->mode_mask); | ||
206 | } else if (tun_setup->addr == c->addr) { | ||
207 | set_type(c, tun_setup->type, tun_setup->mode_mask); | ||
208 | } | ||
209 | } | ||
199 | 210 | ||
200 | static void set_addr(struct i2c_client *c, struct tuner_addr *tun_addr) | 211 | static inline int check_mode(struct tuner *t, char *cmd) |
201 | { | 212 | { |
202 | /* ADDR_UNSET defaults to first available tuner */ | 213 | if (1 << t->mode & t->mode_mask) { |
203 | if ( tun_addr->addr == ADDR_UNSET ) { | 214 | switch (t->mode) { |
204 | if (first_tuner != c->addr) | ||
205 | return; | ||
206 | switch (tun_addr->v4l2_tuner) { | ||
207 | case V4L2_TUNER_RADIO: | 215 | case V4L2_TUNER_RADIO: |
208 | radio_tuner=c->addr; | 216 | tuner_dbg("Cmd %s accepted for radio\n", cmd); |
209 | break; | 217 | break; |
210 | default: | 218 | case V4L2_TUNER_ANALOG_TV: |
211 | tv_tuner=c->addr; | 219 | tuner_dbg("Cmd %s accepted for analog TV\n", cmd); |
220 | break; | ||
221 | case V4L2_TUNER_DIGITAL_TV: | ||
222 | tuner_dbg("Cmd %s accepted for digital TV\n", cmd); | ||
212 | break; | 223 | break; |
213 | } | 224 | } |
214 | } else { | 225 | return 0; |
215 | /* Sets tuner to its configured value */ | ||
216 | switch (tun_addr->v4l2_tuner) { | ||
217 | case V4L2_TUNER_RADIO: | ||
218 | radio_tuner=tun_addr->addr; | ||
219 | if ( tun_addr->addr == c->addr ) set_type(c,tun_addr->type); | ||
220 | return; | ||
221 | default: | ||
222 | tv_tuner=tun_addr->addr; | ||
223 | if ( tun_addr->addr == c->addr ) set_type(c,tun_addr->type); | ||
224 | return; | ||
225 | } | ||
226 | } | 226 | } |
227 | set_type(c,tun_addr->type); | 227 | return EINVAL; |
228 | } | 228 | } |
229 | 229 | ||
230 | static char pal[] = "-"; | 230 | static char pal[] = "-"; |
231 | module_param_string(pal, pal, sizeof(pal), 0644); | 231 | module_param_string(pal, pal, sizeof(pal), 0644); |
232 | static char secam[] = "-"; | ||
233 | module_param_string(secam, secam, sizeof(secam), 0644); | ||
232 | 234 | ||
235 | /* get more precise norm info from insmod option */ | ||
233 | static int tuner_fixup_std(struct tuner *t) | 236 | static int tuner_fixup_std(struct tuner *t) |
234 | { | 237 | { |
235 | if ((t->std & V4L2_STD_PAL) == V4L2_STD_PAL) { | 238 | if ((t->std & V4L2_STD_PAL) == V4L2_STD_PAL) { |
236 | /* get more precise norm info from insmod option */ | ||
237 | switch (pal[0]) { | 239 | switch (pal[0]) { |
238 | case 'b': | 240 | case 'b': |
239 | case 'B': | 241 | case 'B': |
240 | case 'g': | 242 | case 'g': |
241 | case 'G': | 243 | case 'G': |
242 | tuner_dbg("insmod fixup: PAL => PAL-BG\n"); | 244 | tuner_dbg ("insmod fixup: PAL => PAL-BG\n"); |
243 | t->std = V4L2_STD_PAL_BG; | 245 | t->std = V4L2_STD_PAL_BG; |
244 | break; | 246 | break; |
245 | case 'i': | 247 | case 'i': |
246 | case 'I': | 248 | case 'I': |
247 | tuner_dbg("insmod fixup: PAL => PAL-I\n"); | 249 | tuner_dbg ("insmod fixup: PAL => PAL-I\n"); |
248 | t->std = V4L2_STD_PAL_I; | 250 | t->std = V4L2_STD_PAL_I; |
249 | break; | 251 | break; |
250 | case 'd': | 252 | case 'd': |
251 | case 'D': | 253 | case 'D': |
252 | case 'k': | 254 | case 'k': |
253 | case 'K': | 255 | case 'K': |
254 | tuner_dbg("insmod fixup: PAL => PAL-DK\n"); | 256 | tuner_dbg ("insmod fixup: PAL => PAL-DK\n"); |
255 | t->std = V4L2_STD_PAL_DK; | 257 | t->std = V4L2_STD_PAL_DK; |
256 | break; | 258 | break; |
259 | case 'M': | ||
260 | case 'm': | ||
261 | tuner_dbg ("insmod fixup: PAL => PAL-M\n"); | ||
262 | t->std = V4L2_STD_PAL_M; | ||
263 | break; | ||
264 | case 'N': | ||
265 | case 'n': | ||
266 | tuner_dbg ("insmod fixup: PAL => PAL-N\n"); | ||
267 | t->std = V4L2_STD_PAL_N; | ||
268 | break; | ||
257 | } | 269 | } |
258 | } | 270 | } |
271 | if ((t->std & V4L2_STD_SECAM) == V4L2_STD_SECAM) { | ||
272 | switch (secam[0]) { | ||
273 | case 'd': | ||
274 | case 'D': | ||
275 | case 'k': | ||
276 | case 'K': | ||
277 | tuner_dbg ("insmod fixup: SECAM => SECAM-DK\n"); | ||
278 | t->std = V4L2_STD_SECAM_DK; | ||
279 | break; | ||
280 | case 'l': | ||
281 | case 'L': | ||
282 | tuner_dbg ("insmod fixup: SECAM => SECAM-L\n"); | ||
283 | t->std = V4L2_STD_SECAM_L; | ||
284 | break; | ||
285 | } | ||
286 | } | ||
287 | |||
259 | return 0; | 288 | return 0; |
260 | } | 289 | } |
261 | 290 | ||
262 | /* ---------------------------------------------------------------------- */ | 291 | /* ---------------------------------------------------------------------- */ |
263 | 292 | ||
293 | /* static var Used only in tuner_attach and tuner_probe */ | ||
294 | static unsigned default_mode_mask; | ||
295 | |||
296 | /* During client attach, set_type is called by adapter's attach_inform callback. | ||
297 | set_type must then be completed by tuner_attach. | ||
298 | */ | ||
264 | static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) | 299 | static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) |
265 | { | 300 | { |
266 | struct tuner *t; | 301 | struct tuner *t; |
267 | 302 | ||
268 | /* by default, first I2C card is both tv and radio tuner */ | 303 | client_template.adapter = adap; |
269 | if (this_adap == 0) { | 304 | client_template.addr = addr; |
270 | first_tuner = addr; | ||
271 | tv_tuner = addr; | ||
272 | radio_tuner = addr; | ||
273 | } | ||
274 | this_adap++; | ||
275 | |||
276 | client_template.adapter = adap; | ||
277 | client_template.addr = addr; | ||
278 | 305 | ||
279 | t = kmalloc(sizeof(struct tuner),GFP_KERNEL); | 306 | t = kmalloc(sizeof(struct tuner), GFP_KERNEL); |
280 | if (NULL == t) | 307 | if (NULL == t) |
281 | return -ENOMEM; | 308 | return -ENOMEM; |
282 | memset(t,0,sizeof(struct tuner)); | 309 | memset(t, 0, sizeof(struct tuner)); |
283 | memcpy(&t->i2c,&client_template,sizeof(struct i2c_client)); | 310 | memcpy(&t->i2c, &client_template, sizeof(struct i2c_client)); |
284 | i2c_set_clientdata(&t->i2c, t); | 311 | i2c_set_clientdata(&t->i2c, t); |
285 | t->type = UNSET; | 312 | t->type = UNSET; |
286 | t->radio_if2 = 10700*1000; /* 10.7MHz - FM radio */ | 313 | t->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */ |
287 | t->audmode = V4L2_TUNER_MODE_STEREO; | 314 | t->audmode = V4L2_TUNER_MODE_STEREO; |
315 | t->mode_mask = T_UNINITIALIZED; | ||
316 | |||
317 | |||
318 | tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name); | ||
319 | |||
320 | /* TEA5767 autodetection code - only for addr = 0xc0 */ | ||
321 | if (addr == 0x60) { | ||
322 | if (tea5767_autodetection(&t->i2c) != EINVAL) { | ||
323 | t->type = TUNER_TEA5767; | ||
324 | t->mode_mask = T_RADIO; | ||
325 | t->mode = T_STANDBY; | ||
326 | t->freq = 87.5 * 16; /* Sets freq to FM range */ | ||
327 | default_mode_mask &= ~T_RADIO; | ||
328 | |||
329 | i2c_attach_client (&t->i2c); | ||
330 | set_type(&t->i2c,t->type, t->mode_mask); | ||
331 | return 0; | ||
332 | } | ||
333 | } | ||
288 | 334 | ||
289 | i2c_attach_client(&t->i2c); | 335 | /* Initializes only the first adapter found */ |
290 | tuner_info("chip found @ 0x%x (%s)\n", | 336 | if (default_mode_mask != T_UNINITIALIZED) { |
291 | addr << 1, adap->name); | 337 | tuner_dbg ("Setting mode_mask to 0x%02x\n", default_mode_mask); |
338 | t->mode_mask = default_mode_mask; | ||
339 | t->freq = 400 * 16; /* Sets freq to VHF High */ | ||
340 | default_mode_mask = T_UNINITIALIZED; | ||
341 | } | ||
292 | 342 | ||
293 | set_type(&t->i2c, t->type); | 343 | /* Should be just before return */ |
344 | i2c_attach_client (&t->i2c); | ||
345 | set_type (&t->i2c,t->type, t->mode_mask); | ||
294 | return 0; | 346 | return 0; |
295 | } | 347 | } |
296 | 348 | ||
@@ -300,11 +352,8 @@ static int tuner_probe(struct i2c_adapter *adap) | |||
300 | normal_i2c[0] = addr; | 352 | normal_i2c[0] = addr; |
301 | normal_i2c[1] = I2C_CLIENT_END; | 353 | normal_i2c[1] = I2C_CLIENT_END; |
302 | } | 354 | } |
303 | this_adap = 0; | ||
304 | 355 | ||
305 | first_tuner = 0; | 356 | default_mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; |
306 | tv_tuner = 0; | ||
307 | radio_tuner = 0; | ||
308 | 357 | ||
309 | if (adap->class & I2C_CLASS_TV_ANALOG) | 358 | if (adap->class & I2C_CLASS_TV_ANALOG) |
310 | return i2c_probe(adap, &addr_data, tuner_attach); | 359 | return i2c_probe(adap, &addr_data, tuner_attach); |
@@ -316,9 +365,10 @@ static int tuner_detach(struct i2c_client *client) | |||
316 | struct tuner *t = i2c_get_clientdata(client); | 365 | struct tuner *t = i2c_get_clientdata(client); |
317 | int err; | 366 | int err; |
318 | 367 | ||
319 | err=i2c_detach_client(&t->i2c); | 368 | err = i2c_detach_client(&t->i2c); |
320 | if (err) { | 369 | if (err) { |
321 | tuner_warn ("Client deregistration failed, client not detached.\n"); | 370 | tuner_warn |
371 | ("Client deregistration failed, client not detached.\n"); | ||
322 | return err; | 372 | return err; |
323 | } | 373 | } |
324 | 374 | ||
@@ -326,37 +376,65 @@ static int tuner_detach(struct i2c_client *client) | |||
326 | return 0; | 376 | return 0; |
327 | } | 377 | } |
328 | 378 | ||
329 | #define SWITCH_V4L2 if (!t->using_v4l2 && tuner_debug) \ | 379 | /* |
330 | tuner_info("switching to v4l2\n"); \ | 380 | * Switch tuner to other mode. If tuner support both tv and radio, |
331 | t->using_v4l2 = 1; | 381 | * set another frequency to some value (This is needed for some pal |
332 | #define CHECK_V4L2 if (t->using_v4l2) { if (tuner_debug) \ | 382 | * tuners to avoid locking). Otherwise, just put second tuner in |
333 | tuner_info("ignore v4l1 call\n"); \ | 383 | * standby mode. |
334 | return 0; } | 384 | */ |
385 | |||
386 | static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode, char *cmd) | ||
387 | { | ||
388 | if (mode != t->mode) { | ||
389 | |||
390 | t->mode = mode; | ||
391 | if (check_mode(t, cmd) == EINVAL) { | ||
392 | t->mode = T_STANDBY; | ||
393 | if (V4L2_TUNER_RADIO == mode) { | ||
394 | set_tv_freq(client, 400 * 16); | ||
395 | } else { | ||
396 | set_radio_freq(client, 87.5 * 16000); | ||
397 | } | ||
398 | return EINVAL; | ||
399 | } | ||
400 | } | ||
401 | return 0; | ||
402 | } | ||
403 | |||
404 | #define switch_v4l2() if (!t->using_v4l2) \ | ||
405 | tuner_dbg("switching to v4l2\n"); \ | ||
406 | t->using_v4l2 = 1; | ||
407 | |||
408 | static inline int check_v4l2(struct tuner *t) | ||
409 | { | ||
410 | if (t->using_v4l2) { | ||
411 | tuner_dbg ("ignore v4l1 call\n"); | ||
412 | return EINVAL; | ||
413 | } | ||
414 | return 0; | ||
415 | } | ||
335 | 416 | ||
336 | static int | 417 | static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) |
337 | tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | ||
338 | { | 418 | { |
339 | struct tuner *t = i2c_get_clientdata(client); | 419 | struct tuner *t = i2c_get_clientdata(client); |
340 | unsigned int *iarg = (int*)arg; | 420 | unsigned int *iarg = (int *)arg; |
341 | 421 | ||
342 | switch (cmd) { | 422 | switch (cmd) { |
343 | /* --- configuration --- */ | 423 | /* --- configuration --- */ |
344 | case TUNER_SET_TYPE: | ||
345 | set_type(client,*iarg); | ||
346 | break; | ||
347 | case TUNER_SET_TYPE_ADDR: | 424 | case TUNER_SET_TYPE_ADDR: |
348 | set_addr(client,(struct tuner_addr *)arg); | 425 | tuner_dbg ("Calling set_type_addr for type=%d, addr=0x%02x, mode=0x%02x\n", |
426 | ((struct tuner_setup *)arg)->type, | ||
427 | ((struct tuner_setup *)arg)->addr, | ||
428 | ((struct tuner_setup *)arg)->mode_mask); | ||
429 | |||
430 | set_addr(client, (struct tuner_setup *)arg); | ||
349 | break; | 431 | break; |
350 | case AUDC_SET_RADIO: | 432 | case AUDC_SET_RADIO: |
351 | t->mode = V4L2_TUNER_RADIO; | 433 | set_mode(client,t,V4L2_TUNER_RADIO, "AUDC_SET_RADIO"); |
352 | CHECK_ADDR(tv_tuner,"AUDC_SET_RADIO","TV"); | ||
353 | |||
354 | if (V4L2_TUNER_RADIO != t->mode) { | ||
355 | set_tv_freq(client,400 * 16); | ||
356 | } | ||
357 | break; | 434 | break; |
358 | case AUDC_CONFIG_PINNACLE: | 435 | case AUDC_CONFIG_PINNACLE: |
359 | CHECK_ADDR(tv_tuner,"AUDC_CONFIG_PINNACLE","TV"); | 436 | if (check_mode(t, "AUDC_CONFIG_PINNACLE") == EINVAL) |
437 | return 0; | ||
360 | switch (*iarg) { | 438 | switch (*iarg) { |
361 | case 2: | 439 | case 2: |
362 | tuner_dbg("pinnacle pal\n"); | 440 | tuner_dbg("pinnacle pal\n"); |
@@ -368,219 +446,238 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
368 | break; | 446 | break; |
369 | } | 447 | } |
370 | break; | 448 | break; |
449 | case TDA9887_SET_CONFIG: | ||
450 | break; | ||
371 | /* --- v4l ioctls --- */ | 451 | /* --- v4l ioctls --- */ |
372 | /* take care: bttv does userspace copying, we'll get a | 452 | /* take care: bttv does userspace copying, we'll get a |
373 | kernel pointer here... */ | 453 | kernel pointer here... */ |
374 | case VIDIOCSCHAN: | 454 | case VIDIOCSCHAN: |
375 | { | 455 | { |
376 | static const v4l2_std_id map[] = { | 456 | static const v4l2_std_id map[] = { |
377 | [ VIDEO_MODE_PAL ] = V4L2_STD_PAL, | 457 | [VIDEO_MODE_PAL] = V4L2_STD_PAL, |
378 | [ VIDEO_MODE_NTSC ] = V4L2_STD_NTSC_M, | 458 | [VIDEO_MODE_NTSC] = V4L2_STD_NTSC_M, |
379 | [ VIDEO_MODE_SECAM ] = V4L2_STD_SECAM, | 459 | [VIDEO_MODE_SECAM] = V4L2_STD_SECAM, |
380 | [ 4 /* bttv */ ] = V4L2_STD_PAL_M, | 460 | [4 /* bttv */ ] = V4L2_STD_PAL_M, |
381 | [ 5 /* bttv */ ] = V4L2_STD_PAL_N, | 461 | [5 /* bttv */ ] = V4L2_STD_PAL_N, |
382 | [ 6 /* bttv */ ] = V4L2_STD_NTSC_M_JP, | 462 | [6 /* bttv */ ] = V4L2_STD_NTSC_M_JP, |
383 | }; | 463 | }; |
384 | struct video_channel *vc = arg; | 464 | struct video_channel *vc = arg; |
385 | 465 | ||
386 | CHECK_V4L2; | 466 | if (check_v4l2(t) == EINVAL) |
387 | t->mode = V4L2_TUNER_ANALOG_TV; | 467 | return 0; |
388 | CHECK_ADDR(tv_tuner,"VIDIOCSCHAN","TV"); | 468 | |
389 | 469 | if (set_mode(client,t,V4L2_TUNER_ANALOG_TV, "VIDIOCSCHAN")==EINVAL) | |
390 | if (vc->norm < ARRAY_SIZE(map)) | 470 | return 0; |
391 | t->std = map[vc->norm]; | 471 | |
392 | tuner_fixup_std(t); | 472 | if (vc->norm < ARRAY_SIZE(map)) |
393 | if (t->freq) | 473 | t->std = map[vc->norm]; |
394 | set_tv_freq(client,t->freq); | 474 | tuner_fixup_std(t); |
395 | return 0; | 475 | if (t->freq) |
396 | } | 476 | set_tv_freq(client, t->freq); |
477 | return 0; | ||
478 | } | ||
397 | case VIDIOCSFREQ: | 479 | case VIDIOCSFREQ: |
398 | { | 480 | { |
399 | unsigned long *v = arg; | 481 | unsigned long *v = arg; |
400 | 482 | ||
401 | CHECK_MODE("VIDIOCSFREQ"); | 483 | if (check_mode(t, "VIDIOCSFREQ") == EINVAL) |
402 | CHECK_V4L2; | 484 | return 0; |
403 | set_freq(client,*v); | 485 | if (check_v4l2(t) == EINVAL) |
404 | return 0; | 486 | return 0; |
405 | } | 487 | |
488 | set_freq(client, *v); | ||
489 | return 0; | ||
490 | } | ||
406 | case VIDIOCGTUNER: | 491 | case VIDIOCGTUNER: |
407 | { | 492 | { |
408 | struct video_tuner *vt = arg; | 493 | struct video_tuner *vt = arg; |
409 | 494 | ||
410 | CHECK_ADDR(radio_tuner,"VIDIOCGTUNER","radio"); | 495 | if (check_mode(t, "VIDIOCGTUNER") == EINVAL) |
411 | CHECK_V4L2; | 496 | return 0; |
412 | if (V4L2_TUNER_RADIO == t->mode) { | 497 | if (check_v4l2(t) == EINVAL) |
413 | if (t->has_signal) | 498 | return 0; |
414 | vt->signal = t->has_signal(client); | 499 | |
415 | if (t->is_stereo) { | 500 | if (V4L2_TUNER_RADIO == t->mode) { |
416 | if (t->is_stereo(client)) | 501 | if (t->has_signal) |
417 | vt->flags |= VIDEO_TUNER_STEREO_ON; | 502 | vt->signal = t->has_signal(client); |
418 | else | 503 | if (t->is_stereo) { |
419 | vt->flags &= ~VIDEO_TUNER_STEREO_ON; | 504 | if (t->is_stereo(client)) |
420 | } | 505 | vt->flags |= |
421 | vt->flags |= V4L2_TUNER_CAP_LOW; /* Allow freqs at 62.5 Hz */ | 506 | VIDEO_TUNER_STEREO_ON; |
507 | else | ||
508 | vt->flags &= | ||
509 | ~VIDEO_TUNER_STEREO_ON; | ||
510 | } | ||
511 | vt->flags |= VIDEO_TUNER_LOW; /* Allow freqs at 62.5 Hz */ | ||
422 | 512 | ||
423 | vt->rangelow = radio_range[0] * 16000; | 513 | vt->rangelow = radio_range[0] * 16000; |
424 | vt->rangehigh = radio_range[1] * 16000; | 514 | vt->rangehigh = radio_range[1] * 16000; |
425 | 515 | ||
426 | } else { | 516 | } else { |
427 | vt->rangelow = tv_range[0] * 16; | 517 | vt->rangelow = tv_range[0] * 16; |
428 | vt->rangehigh = tv_range[1] * 16; | 518 | vt->rangehigh = tv_range[1] * 16; |
429 | } | 519 | } |
430 | 520 | ||
431 | return 0; | 521 | return 0; |
432 | } | 522 | } |
433 | case VIDIOCGAUDIO: | 523 | case VIDIOCGAUDIO: |
434 | { | 524 | { |
435 | struct video_audio *va = arg; | 525 | struct video_audio *va = arg; |
436 | 526 | ||
437 | CHECK_ADDR(radio_tuner,"VIDIOCGAUDIO","radio"); | 527 | if (check_mode(t, "VIDIOCGAUDIO") == EINVAL) |
438 | CHECK_V4L2; | 528 | return 0; |
439 | if (V4L2_TUNER_RADIO == t->mode && t->is_stereo) | 529 | if (check_v4l2(t) == EINVAL) |
440 | va->mode = t->is_stereo(client) | 530 | return 0; |
441 | ? VIDEO_SOUND_STEREO | 531 | |
442 | : VIDEO_SOUND_MONO; | 532 | if (V4L2_TUNER_RADIO == t->mode && t->is_stereo) |
443 | return 0; | 533 | va->mode = t->is_stereo(client) |
444 | } | 534 | ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO; |
535 | return 0; | ||
536 | } | ||
445 | 537 | ||
446 | case VIDIOC_S_STD: | 538 | case VIDIOC_S_STD: |
447 | { | 539 | { |
448 | v4l2_std_id *id = arg; | 540 | v4l2_std_id *id = arg; |
449 | 541 | ||
450 | SWITCH_V4L2; | 542 | if (set_mode (client, t, V4L2_TUNER_ANALOG_TV, "VIDIOC_S_STD") |
451 | t->mode = V4L2_TUNER_ANALOG_TV; | 543 | == EINVAL) |
452 | CHECK_ADDR(tv_tuner,"VIDIOC_S_STD","TV"); | 544 | return 0; |
453 | 545 | ||
454 | t->std = *id; | 546 | switch_v4l2(); |
455 | tuner_fixup_std(t); | 547 | |
456 | if (t->freq) | 548 | t->std = *id; |
457 | set_freq(client,t->freq); | 549 | tuner_fixup_std(t); |
458 | break; | 550 | if (t->freq) |
459 | } | 551 | set_freq(client, t->freq); |
552 | break; | ||
553 | } | ||
460 | case VIDIOC_S_FREQUENCY: | 554 | case VIDIOC_S_FREQUENCY: |
461 | { | 555 | { |
462 | struct v4l2_frequency *f = arg; | 556 | struct v4l2_frequency *f = arg; |
463 | 557 | ||
464 | CHECK_MODE("VIDIOC_S_FREQUENCY"); | 558 | t->freq = f->frequency; |
465 | SWITCH_V4L2; | 559 | switch_v4l2(); |
466 | if (V4L2_TUNER_RADIO == f->type && | 560 | if (V4L2_TUNER_RADIO == f->type && |
467 | V4L2_TUNER_RADIO != t->mode) | 561 | V4L2_TUNER_RADIO != t->mode) { |
468 | set_tv_freq(client,400*16); | 562 | if (set_mode (client, t, f->type, "VIDIOC_S_FREQUENCY") |
469 | t->mode = f->type; | 563 | == EINVAL) |
470 | set_freq(client,f->frequency); | 564 | return 0; |
471 | break; | 565 | } |
472 | } | 566 | set_freq(client,t->freq); |
473 | case VIDIOC_G_FREQUENCY: | ||
474 | { | ||
475 | struct v4l2_frequency *f = arg; | ||
476 | 567 | ||
477 | CHECK_MODE("VIDIOC_G_FREQUENCY"); | 568 | break; |
478 | SWITCH_V4L2; | 569 | } |
479 | f->type = t->mode; | 570 | case VIDIOC_G_FREQUENCY: |
480 | f->frequency = t->freq; | 571 | { |
481 | break; | 572 | struct v4l2_frequency *f = arg; |
482 | } | 573 | |
574 | if (check_mode(t, "VIDIOC_G_FREQUENCY") == EINVAL) | ||
575 | return 0; | ||
576 | switch_v4l2(); | ||
577 | f->type = t->mode; | ||
578 | f->frequency = t->freq; | ||
579 | break; | ||
580 | } | ||
483 | case VIDIOC_G_TUNER: | 581 | case VIDIOC_G_TUNER: |
484 | { | 582 | { |
485 | struct v4l2_tuner *tuner = arg; | 583 | struct v4l2_tuner *tuner = arg; |
486 | 584 | ||
487 | CHECK_MODE("VIDIOC_G_TUNER"); | 585 | if (check_mode(t, "VIDIOC_G_TUNER") == EINVAL) |
488 | SWITCH_V4L2; | 586 | return 0; |
489 | if (V4L2_TUNER_RADIO == t->mode) { | 587 | switch_v4l2(); |
490 | if (t->has_signal) | 588 | |
491 | tuner -> signal = t->has_signal(client); | 589 | if (V4L2_TUNER_RADIO == t->mode) { |
492 | if (t->is_stereo) { | 590 | |
493 | if (t->is_stereo(client)) { | 591 | if (t->has_signal) |
494 | tuner -> rxsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_MONO; | 592 | tuner->signal = t->has_signal(client); |
495 | } else { | 593 | |
496 | tuner -> rxsubchans = V4L2_TUNER_SUB_MONO; | 594 | if (t->is_stereo) { |
595 | if (t->is_stereo(client)) { | ||
596 | tuner->rxsubchans = | ||
597 | V4L2_TUNER_SUB_STEREO | | ||
598 | V4L2_TUNER_SUB_MONO; | ||
599 | } else { | ||
600 | tuner->rxsubchans = | ||
601 | V4L2_TUNER_SUB_MONO; | ||
602 | } | ||
497 | } | 603 | } |
604 | |||
605 | tuner->capability |= | ||
606 | V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; | ||
607 | |||
608 | tuner->audmode = t->audmode; | ||
609 | |||
610 | tuner->rangelow = radio_range[0] * 16000; | ||
611 | tuner->rangehigh = radio_range[1] * 16000; | ||
612 | } else { | ||
613 | tuner->rangelow = tv_range[0] * 16; | ||
614 | tuner->rangehigh = tv_range[1] * 16; | ||
498 | } | 615 | } |
499 | tuner->capability |= V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; | 616 | break; |
500 | tuner->audmode = t->audmode; | 617 | } |
501 | 618 | case VIDIOC_S_TUNER: | |
502 | tuner->rangelow = radio_range[0] * 16000; | 619 | { |
503 | tuner->rangehigh = radio_range[1] * 16000; | 620 | struct v4l2_tuner *tuner = arg; |
504 | } else { | 621 | |
505 | tuner->rangelow = tv_range[0] * 16; | 622 | if (check_mode(t, "VIDIOC_S_TUNER") == EINVAL) |
506 | tuner->rangehigh = tv_range[1] * 16; | 623 | return 0; |
624 | |||
625 | switch_v4l2(); | ||
626 | |||
627 | if (V4L2_TUNER_RADIO == t->mode) { | ||
628 | t->audmode = tuner->audmode; | ||
629 | set_radio_freq(client, t->freq); | ||
630 | } | ||
631 | break; | ||
507 | } | 632 | } |
508 | break; | ||
509 | } | ||
510 | case VIDIOC_S_TUNER: /* Allow changing radio range and audio mode */ | ||
511 | { | ||
512 | struct v4l2_tuner *tuner = arg; | ||
513 | |||
514 | CHECK_ADDR(radio_tuner,"VIDIOC_S_TUNER","radio"); | ||
515 | SWITCH_V4L2; | ||
516 | |||
517 | /* To switch the audio mode, applications initialize the | ||
518 | index and audmode fields and the reserved array and | ||
519 | call the VIDIOC_S_TUNER ioctl. */ | ||
520 | /* rxsubchannels: V4L2_TUNER_MODE_MONO, V4L2_TUNER_MODE_STEREO, | ||
521 | V4L2_TUNER_MODE_LANG1, V4L2_TUNER_MODE_LANG2, | ||
522 | V4L2_TUNER_MODE_SAP */ | ||
523 | |||
524 | if (tuner->audmode == V4L2_TUNER_MODE_MONO) | ||
525 | t->audmode = V4L2_TUNER_MODE_MONO; | ||
526 | else | ||
527 | t->audmode = V4L2_TUNER_MODE_STEREO; | ||
528 | |||
529 | set_radio_freq(client, t->freq); | ||
530 | break; | ||
531 | } | ||
532 | case TDA9887_SET_CONFIG: /* Nothing to do on tuner-core */ | ||
533 | break; | ||
534 | default: | 633 | default: |
535 | tuner_dbg ("Unimplemented IOCTL 0x%08x called to tuner.\n", cmd); | 634 | tuner_dbg("Unimplemented IOCTL 0x%08x called to tuner.\n", cmd); |
536 | /* nothing */ | ||
537 | break; | 635 | break; |
538 | } | 636 | } |
539 | 637 | ||
540 | return 0; | 638 | return 0; |
541 | } | 639 | } |
542 | 640 | ||
543 | static int tuner_suspend(struct device * dev, u32 state, u32 level) | 641 | static int tuner_suspend(struct device *dev, u32 state, u32 level) |
544 | { | 642 | { |
545 | struct i2c_client *c = container_of(dev, struct i2c_client, dev); | 643 | struct i2c_client *c = container_of (dev, struct i2c_client, dev); |
546 | struct tuner *t = i2c_get_clientdata(c); | 644 | struct tuner *t = i2c_get_clientdata (c); |
547 | 645 | ||
548 | tuner_dbg("suspend\n"); | 646 | tuner_dbg ("suspend\n"); |
549 | /* FIXME: power down ??? */ | 647 | /* FIXME: power down ??? */ |
550 | return 0; | 648 | return 0; |
551 | } | 649 | } |
552 | 650 | ||
553 | static int tuner_resume(struct device * dev, u32 level) | 651 | static int tuner_resume(struct device *dev, u32 level) |
554 | { | 652 | { |
555 | struct i2c_client *c = container_of(dev, struct i2c_client, dev); | 653 | struct i2c_client *c = container_of (dev, struct i2c_client, dev); |
556 | struct tuner *t = i2c_get_clientdata(c); | 654 | struct tuner *t = i2c_get_clientdata (c); |
557 | 655 | ||
558 | tuner_dbg("resume\n"); | 656 | tuner_dbg ("resume\n"); |
559 | if (t->freq) | 657 | if (t->freq) |
560 | set_freq(c,t->freq); | 658 | set_freq(c, t->freq); |
561 | return 0; | 659 | return 0; |
562 | } | 660 | } |
563 | 661 | ||
564 | /* ----------------------------------------------------------------------- */ | 662 | /* ----------------------------------------------------------------------- */ |
565 | 663 | ||
566 | static struct i2c_driver driver = { | 664 | static struct i2c_driver driver = { |
567 | .owner = THIS_MODULE, | 665 | .owner = THIS_MODULE, |
568 | .name = "tuner", | 666 | .name = "tuner", |
569 | .id = I2C_DRIVERID_TUNER, | 667 | .id = I2C_DRIVERID_TUNER, |
570 | .flags = I2C_DF_NOTIFY, | 668 | .flags = I2C_DF_NOTIFY, |
571 | .attach_adapter = tuner_probe, | 669 | .attach_adapter = tuner_probe, |
572 | .detach_client = tuner_detach, | 670 | .detach_client = tuner_detach, |
573 | .command = tuner_command, | 671 | .command = tuner_command, |
574 | .driver = { | 672 | .driver = { |
575 | .suspend = tuner_suspend, | 673 | .suspend = tuner_suspend, |
576 | .resume = tuner_resume, | 674 | .resume = tuner_resume, |
577 | }, | 675 | }, |
578 | }; | 676 | }; |
579 | static struct i2c_client client_template = | 677 | static struct i2c_client client_template = { |
580 | { | ||
581 | I2C_DEVNAME("(tuner unset)"), | 678 | I2C_DEVNAME("(tuner unset)"), |
582 | .flags = I2C_CLIENT_ALLOW_USE, | 679 | .flags = I2C_CLIENT_ALLOW_USE, |
583 | .driver = &driver, | 680 | .driver = &driver, |
584 | }; | 681 | }; |
585 | 682 | ||
586 | static int __init tuner_init_module(void) | 683 | static int __init tuner_init_module(void) |
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index c39ed6226ee0..a3f8e83f5314 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: tuner-simple.c,v 1.31 2005/06/21 16:02:25 mkrufky Exp $ | 2 | * $Id: tuner-simple.c,v 1.39 2005/07/07 01:49:30 mkrufky Exp $ |
3 | * | 3 | * |
4 | * i2c tv tuner chip device driver | 4 | * i2c tv tuner chip device driver |
5 | * controls all those simple 4-control-bytes style tuners. | 5 | * controls all those simple 4-control-bytes style tuners. |
@@ -54,6 +54,27 @@ | |||
54 | #define PHILIPS_MF_SET_PAL_L 0x03 // France | 54 | #define PHILIPS_MF_SET_PAL_L 0x03 // France |
55 | #define PHILIPS_MF_SET_PAL_L2 0x02 // L' | 55 | #define PHILIPS_MF_SET_PAL_L2 0x02 // L' |
56 | 56 | ||
57 | /* Control byte */ | ||
58 | |||
59 | #define TUNER_RATIO_MASK 0x06 /* Bit cb1:cb2 */ | ||
60 | #define TUNER_RATIO_SELECT_50 0x00 | ||
61 | #define TUNER_RATIO_SELECT_32 0x02 | ||
62 | #define TUNER_RATIO_SELECT_166 0x04 | ||
63 | #define TUNER_RATIO_SELECT_62 0x06 | ||
64 | |||
65 | #define TUNER_CHARGE_PUMP 0x40 /* Bit cb6 */ | ||
66 | |||
67 | /* Status byte */ | ||
68 | |||
69 | #define TUNER_POR 0x80 | ||
70 | #define TUNER_FL 0x40 | ||
71 | #define TUNER_MODE 0x38 | ||
72 | #define TUNER_AFC 0x07 | ||
73 | #define TUNER_SIGNAL 0x07 | ||
74 | #define TUNER_STEREO 0x10 | ||
75 | |||
76 | #define TUNER_PLL_LOCKED 0x40 | ||
77 | #define TUNER_STEREO_MK3 0x04 | ||
57 | 78 | ||
58 | /* ---------------------------------------------------------------------- */ | 79 | /* ---------------------------------------------------------------------- */ |
59 | 80 | ||
@@ -211,21 +232,17 @@ static struct tunertype tuners[] = { | |||
211 | 16*160.00,16*442.00,0x01,0x02,0x04,0xce,623 }, | 232 | 16*160.00,16*442.00,0x01,0x02,0x04,0xce,623 }, |
212 | { "Philips FQ1236A MK4", Philips, NTSC, | 233 | { "Philips FQ1236A MK4", Philips, NTSC, |
213 | 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 }, | 234 | 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 }, |
214 | 235 | { "Ymec TVision TVF-8531MF/8831MF/8731MF", Philips, NTSC, | |
215 | /* Should work for TVF8531MF, TVF8831MF, TVF8731MF */ | ||
216 | { "Ymec TVision TVF-8531MF", Philips, NTSC, | ||
217 | 16*160.00,16*454.00,0xa0,0x90,0x30,0x8e,732}, | 236 | 16*160.00,16*454.00,0xa0,0x90,0x30,0x8e,732}, |
218 | { "Ymec TVision TVF-5533MF", Philips, NTSC, | 237 | { "Ymec TVision TVF-5533MF", Philips, NTSC, |
219 | 16*160.00,16*454.00,0x01,0x02,0x04,0x8e,732}, | 238 | 16*160.00,16*454.00,0x01,0x02,0x04,0x8e,732}, |
239 | |||
220 | { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC, | 240 | { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC, |
221 | 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732}, | 241 | 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732}, |
222 | /* Should work for TNF9533-D/IF, TNF9533-B/DF */ | 242 | { "Tena TNF9533-D/IF/TNF9533-B/DF", Philips, PAL, |
223 | { "Tena TNF9533-D/IF", Philips, PAL, | ||
224 | 16*160.25,16*464.25,0x01,0x02,0x04,0x8e,623}, | 243 | 16*160.25,16*464.25,0x01,0x02,0x04,0x8e,623}, |
225 | 244 | { "Philips TEA5767HN FM Radio", Philips, RADIO, | |
226 | /* This entry is for TEA5767 FM radio only chip used on several boards w/TV tuner */ | 245 | /* see tea5767.c for details */}, |
227 | { TEA5767_TUNER_NAME, Philips, RADIO, | ||
228 | -1, -1, 0, 0, 0, TEA5767_LOW_LO_32768,0}, | ||
229 | { "Philips FMD1216ME MK3 Hybrid Tuner", Philips, PAL, | 246 | { "Philips FMD1216ME MK3 Hybrid Tuner", Philips, PAL, |
230 | 16*160.00,16*442.00,0x51,0x52,0x54,0x86,623 }, | 247 | 16*160.00,16*442.00,0x51,0x52,0x54,0x86,623 }, |
231 | }; | 248 | }; |
@@ -244,15 +261,6 @@ static int tuner_getstatus(struct i2c_client *c) | |||
244 | return byte; | 261 | return byte; |
245 | } | 262 | } |
246 | 263 | ||
247 | #define TUNER_POR 0x80 | ||
248 | #define TUNER_FL 0x40 | ||
249 | #define TUNER_MODE 0x38 | ||
250 | #define TUNER_AFC 0x07 | ||
251 | |||
252 | #define TUNER_STEREO 0x10 /* radio mode */ | ||
253 | #define TUNER_STEREO_MK3 0x04 /* radio mode */ | ||
254 | #define TUNER_SIGNAL 0x07 /* radio mode */ | ||
255 | |||
256 | static int tuner_signal(struct i2c_client *c) | 264 | static int tuner_signal(struct i2c_client *c) |
257 | { | 265 | { |
258 | return (tuner_getstatus(c) & TUNER_SIGNAL) << 13; | 266 | return (tuner_getstatus(c) & TUNER_SIGNAL) << 13; |
@@ -278,22 +286,6 @@ static int tuner_stereo(struct i2c_client *c) | |||
278 | return stereo; | 286 | return stereo; |
279 | } | 287 | } |
280 | 288 | ||
281 | #if 0 /* unused */ | ||
282 | static int tuner_islocked (struct i2c_client *c) | ||
283 | { | ||
284 | return (tuner_getstatus (c) & TUNER_FL); | ||
285 | } | ||
286 | |||
287 | static int tuner_afcstatus (struct i2c_client *c) | ||
288 | { | ||
289 | return (tuner_getstatus (c) & TUNER_AFC) - 2; | ||
290 | } | ||
291 | |||
292 | static int tuner_mode (struct i2c_client *c) | ||
293 | { | ||
294 | return (tuner_getstatus (c) & TUNER_MODE) >> 3; | ||
295 | } | ||
296 | #endif | ||
297 | 289 | ||
298 | /* ---------------------------------------------------------------------- */ | 290 | /* ---------------------------------------------------------------------- */ |
299 | 291 | ||
@@ -376,7 +368,7 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
376 | 368 | ||
377 | case TUNER_MICROTUNE_4042FI5: | 369 | case TUNER_MICROTUNE_4042FI5: |
378 | /* Set the charge pump for fast tuning */ | 370 | /* Set the charge pump for fast tuning */ |
379 | tun->config |= 0x40; | 371 | tun->config |= TUNER_CHARGE_PUMP; |
380 | break; | 372 | break; |
381 | } | 373 | } |
382 | 374 | ||
@@ -425,14 +417,13 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
425 | tuner_warn("i2c i/o read error: rc == %d (should be 1)\n",rc); | 417 | tuner_warn("i2c i/o read error: rc == %d (should be 1)\n",rc); |
426 | break; | 418 | break; |
427 | } | 419 | } |
428 | /* bit 6 is PLL locked indicator */ | 420 | if (status_byte & TUNER_PLL_LOCKED) |
429 | if (status_byte & 0x40) | ||
430 | break; | 421 | break; |
431 | udelay(10); | 422 | udelay(10); |
432 | } | 423 | } |
433 | 424 | ||
434 | /* Set the charge pump for optimized phase noise figure */ | 425 | /* Set the charge pump for optimized phase noise figure */ |
435 | tun->config &= ~0x40; | 426 | tun->config &= ~TUNER_CHARGE_PUMP; |
436 | buffer[0] = (div>>8) & 0x7f; | 427 | buffer[0] = (div>>8) & 0x7f; |
437 | buffer[1] = div & 0xff; | 428 | buffer[1] = div & 0xff; |
438 | buffer[2] = tun->config; | 429 | buffer[2] = tun->config; |
@@ -453,26 +444,22 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
453 | unsigned div; | 444 | unsigned div; |
454 | int rc; | 445 | int rc; |
455 | 446 | ||
456 | tun=&tuners[t->type]; | 447 | tun = &tuners[t->type]; |
457 | div = (freq / 1000) + (int)(16*10.7); | 448 | div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */ |
458 | buffer[2] = tun->config; | 449 | buffer[2] = (tun->config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */ |
459 | 450 | ||
460 | switch (t->type) { | 451 | switch (t->type) { |
461 | case TUNER_TENA_9533_DI: | 452 | case TUNER_TENA_9533_DI: |
462 | case TUNER_YMEC_TVF_5533MF: | 453 | case TUNER_YMEC_TVF_5533MF: |
463 | /*These values are empirically determinated */ | 454 | tuner_dbg ("This tuner doesn't have FM. Most cards has a TEA5767 for FM\n"); |
464 | div = (freq * 122) / 16000 - 20; | 455 | return; |
465 | buffer[2] = 0x88; /* could be also 0x80 */ | ||
466 | buffer[3] = 0x19; /* could be also 0x10, 0x18, 0x99 */ | ||
467 | break; | ||
468 | case TUNER_PHILIPS_FM1216ME_MK3: | 456 | case TUNER_PHILIPS_FM1216ME_MK3: |
469 | case TUNER_PHILIPS_FM1236_MK3: | 457 | case TUNER_PHILIPS_FM1236_MK3: |
470 | case TUNER_PHILIPS_FMD1216ME_MK3: | 458 | case TUNER_PHILIPS_FMD1216ME_MK3: |
471 | buffer[3] = 0x19; | 459 | buffer[3] = 0x19; |
472 | break; | 460 | break; |
473 | case TUNER_PHILIPS_FM1256_IH3: | 461 | case TUNER_PHILIPS_FM1256_IH3: |
474 | div = (20 * freq) / 16000 + 333 * 2; | 462 | div = (20 * freq) / 16000 + (int)(33.3 * 20); /* IF 33.3 MHz */ |
475 | buffer[2] = 0x80; | ||
476 | buffer[3] = 0x19; | 463 | buffer[3] = 0x19; |
477 | break; | 464 | break; |
478 | case TUNER_LG_PAL_FM: | 465 | case TUNER_LG_PAL_FM: |
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index 9a493bea76d8..d8b78f1d686b 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c | |||
@@ -864,13 +864,8 @@ static int tda9874a_getmode(struct CHIPSTATE *chip) | |||
864 | * But changing the mode to VIDEO_SOUND_MONO would switch | 864 | * But changing the mode to VIDEO_SOUND_MONO would switch |
865 | * external 4052 multiplexer in audio_hook(). | 865 | * external 4052 multiplexer in audio_hook(). |
866 | */ | 866 | */ |
867 | #if 0 | ||
868 | if((nsr & 0x02) && !(dsr & 0x10)) /* NSR.S/MB=1 and DSR.AMSTAT=0 */ | ||
869 | mode |= VIDEO_SOUND_STEREO; | ||
870 | #else | ||
871 | if(nsr & 0x02) /* NSR.S/MB=1 */ | 867 | if(nsr & 0x02) /* NSR.S/MB=1 */ |
872 | mode |= VIDEO_SOUND_STEREO; | 868 | mode |= VIDEO_SOUND_STEREO; |
873 | #endif | ||
874 | if(nsr & 0x01) /* NSR.D/SB=1 */ | 869 | if(nsr & 0x01) /* NSR.D/SB=1 */ |
875 | mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | 870 | mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; |
876 | } else { | 871 | } else { |
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 0f03c25489f1..e8d9440977cb 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c | |||
@@ -400,14 +400,6 @@ void tveeprom_hauppauge_analog(struct tveeprom *tvee, unsigned char *eeprom_data | |||
400 | } | 400 | } |
401 | } | 401 | } |
402 | 402 | ||
403 | #if 0 | ||
404 | if (t_format < sizeof(hauppauge_tuner_fmt)/sizeof(struct HAUPPAUGE_TUNER_FMT)) { | ||
405 | tvee->tuner_formats = hauppauge_tuner_fmt[t_format].id; | ||
406 | t_fmt_name = hauppauge_tuner_fmt[t_format].name; | ||
407 | } else { | ||
408 | t_fmt_name = "<unknown>"; | ||
409 | } | ||
410 | #endif | ||
411 | 403 | ||
412 | TVEEPROM_KERN_INFO("Hauppauge: model = %d, rev = %s, serial# = %d\n", | 404 | TVEEPROM_KERN_INFO("Hauppauge: model = %d, rev = %s, serial# = %d\n", |
413 | tvee->model, | 405 | tvee->model, |
@@ -482,6 +474,7 @@ static unsigned short normal_i2c[] = { | |||
482 | 0xa0 >> 1, | 474 | 0xa0 >> 1, |
483 | I2C_CLIENT_END, | 475 | I2C_CLIENT_END, |
484 | }; | 476 | }; |
477 | |||
485 | I2C_CLIENT_INSMOD; | 478 | I2C_CLIENT_INSMOD; |
486 | 479 | ||
487 | struct i2c_driver i2c_driver_tveeprom; | 480 | struct i2c_driver i2c_driver_tveeprom; |
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 4cecdafeb87d..7fc692a8f5b0 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
@@ -6,8 +6,7 @@ menu "Misc devices" | |||
6 | 6 | ||
7 | config IBM_ASM | 7 | config IBM_ASM |
8 | tristate "Device driver for IBM RSA service processor" | 8 | tristate "Device driver for IBM RSA service processor" |
9 | depends on X86 && EXPERIMENTAL | 9 | depends on X86 && PCI && EXPERIMENTAL |
10 | default n | ||
11 | ---help--- | 10 | ---help--- |
12 | This option enables device driver support for in-band access to the | 11 | This option enables device driver support for in-band access to the |
13 | IBM RSA (Condor) service processor in eServer xSeries systems. | 12 | IBM RSA (Condor) service processor in eServer xSeries systems. |
@@ -22,7 +21,7 @@ config IBM_ASM | |||
22 | 21 | ||
23 | WARNING: This software may not be supported or function | 22 | WARNING: This software may not be supported or function |
24 | correctly on your IBM server. Please consult the IBM ServerProven | 23 | correctly on your IBM server. Please consult the IBM ServerProven |
25 | website <http://www.pc.ibm/ww/eserver/xseries/serverproven> for | 24 | website <http://www.pc.ibm.com/ww/eserver/xseries/serverproven> for |
26 | information on the specific driver level and support statement | 25 | information on the specific driver level and support statement |
27 | for your IBM server. | 26 | for your IBM server. |
28 | 27 | ||
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 2b55687f6ee9..9a07ff7a7777 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -3,6 +3,8 @@ | |||
3 | # Network device configuration | 3 | # Network device configuration |
4 | # | 4 | # |
5 | 5 | ||
6 | menu "Network device support" | ||
7 | |||
6 | config NETDEVICES | 8 | config NETDEVICES |
7 | depends on NET | 9 | depends on NET |
8 | bool "Network device support" | 10 | bool "Network device support" |
@@ -2547,3 +2549,4 @@ config NETCONSOLE | |||
2547 | If you want to log kernel messages over the network, enable this. | 2549 | If you want to log kernel messages over the network, enable this. |
2548 | See <file:Documentation/networking/netconsole.txt> for details. | 2550 | See <file:Documentation/networking/netconsole.txt> for details. |
2549 | 2551 | ||
2552 | endmenu | ||
diff --git a/drivers/net/appletalk/Kconfig b/drivers/net/appletalk/Kconfig index 69c488d933a2..b14e89004c3a 100644 --- a/drivers/net/appletalk/Kconfig +++ b/drivers/net/appletalk/Kconfig | |||
@@ -1,6 +1,33 @@ | |||
1 | # | 1 | # |
2 | # Appletalk driver configuration | 2 | # Appletalk driver configuration |
3 | # | 3 | # |
4 | config ATALK | ||
5 | tristate "Appletalk protocol support" | ||
6 | select LLC | ||
7 | ---help--- | ||
8 | AppleTalk is the protocol that Apple computers can use to communicate | ||
9 | on a network. If your Linux box is connected to such a network and you | ||
10 | wish to connect to it, say Y. You will need to use the netatalk package | ||
11 | so that your Linux box can act as a print and file server for Macs as | ||
12 | well as access AppleTalk printers. Check out | ||
13 | <http://www.zettabyte.net/netatalk/> on the WWW for details. | ||
14 | EtherTalk is the name used for AppleTalk over Ethernet and the | ||
15 | cheaper and slower LocalTalk is AppleTalk over a proprietary Apple | ||
16 | network using serial links. EtherTalk and LocalTalk are fully | ||
17 | supported by Linux. | ||
18 | |||
19 | General information about how to connect Linux, Windows machines and | ||
20 | Macs is on the WWW at <http://www.eats.com/linux_mac_win.html>. The | ||
21 | NET-3-HOWTO, available from | ||
22 | <http://www.tldp.org/docs.html#howto>, contains valuable | ||
23 | information as well. | ||
24 | |||
25 | To compile this driver as a module, choose M here: the module will be | ||
26 | called appletalk. You almost certainly want to compile it as a | ||
27 | module so you can restart your AppleTalk stack without rebooting | ||
28 | your machine. I hear that the GNU boycott of Apple is over, so | ||
29 | even politically correct people are allowed to say Y here. | ||
30 | |||
4 | config DEV_APPLETALK | 31 | config DEV_APPLETALK |
5 | bool "Appletalk interfaces support" | 32 | bool "Appletalk interfaces support" |
6 | depends on ATALK | 33 | depends on ATALK |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index f1bd45e3da31..94939f570f78 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -1930,6 +1930,7 @@ static int b44_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1930 | b44_free_rings(bp); | 1930 | b44_free_rings(bp); |
1931 | 1931 | ||
1932 | spin_unlock_irq(&bp->lock); | 1932 | spin_unlock_irq(&bp->lock); |
1933 | pci_disable_device(pdev); | ||
1933 | return 0; | 1934 | return 0; |
1934 | } | 1935 | } |
1935 | 1936 | ||
@@ -1939,6 +1940,8 @@ static int b44_resume(struct pci_dev *pdev) | |||
1939 | struct b44 *bp = netdev_priv(dev); | 1940 | struct b44 *bp = netdev_priv(dev); |
1940 | 1941 | ||
1941 | pci_restore_state(pdev); | 1942 | pci_restore_state(pdev); |
1943 | pci_enable_device(pdev); | ||
1944 | pci_set_master(pdev); | ||
1942 | 1945 | ||
1943 | if (!netif_running(dev)) | 1946 | if (!netif_running(dev)) |
1944 | return 0; | 1947 | return 0; |
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c index aad5494c83cf..f0996ce5c268 100644 --- a/drivers/net/myri_sbus.c +++ b/drivers/net/myri_sbus.c | |||
@@ -369,7 +369,7 @@ static void myri_tx(struct myri_eth *mp, struct net_device *dev) | |||
369 | * assume 802.3 if the type field is short enough to be a length. | 369 | * assume 802.3 if the type field is short enough to be a length. |
370 | * This is normal practice and works for any 'now in use' protocol. | 370 | * This is normal practice and works for any 'now in use' protocol. |
371 | */ | 371 | */ |
372 | static unsigned short myri_type_trans(struct sk_buff *skb, struct net_device *dev) | 372 | static __be16 myri_type_trans(struct sk_buff *skb, struct net_device *dev) |
373 | { | 373 | { |
374 | struct ethhdr *eth; | 374 | struct ethhdr *eth; |
375 | unsigned char *rawp; | 375 | unsigned char *rawp; |
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c index a1a6c08e7dcf..f1c01ac29102 100644 --- a/drivers/net/ne2k-pci.c +++ b/drivers/net/ne2k-pci.c | |||
@@ -660,6 +660,7 @@ static int ne2k_pci_suspend (struct pci_dev *pdev, pm_message_t state) | |||
660 | 660 | ||
661 | netif_device_detach(dev); | 661 | netif_device_detach(dev); |
662 | pci_save_state(pdev); | 662 | pci_save_state(pdev); |
663 | pci_disable_device(pdev); | ||
663 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | 664 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); |
664 | 665 | ||
665 | return 0; | 666 | return 0; |
@@ -671,6 +672,8 @@ static int ne2k_pci_resume (struct pci_dev *pdev) | |||
671 | 672 | ||
672 | pci_set_power_state(pdev, 0); | 673 | pci_set_power_state(pdev, 0); |
673 | pci_restore_state(pdev); | 674 | pci_restore_state(pdev); |
675 | pci_enable_device(pdev); | ||
676 | pci_set_master(pdev); | ||
674 | NS8390_init(dev, 1); | 677 | NS8390_init(dev, 1); |
675 | netif_device_attach(dev); | 678 | netif_device_attach(dev); |
676 | 679 | ||
diff --git a/drivers/net/plip.c b/drivers/net/plip.c index f4b62405d2e5..21537ee3a6a7 100644 --- a/drivers/net/plip.c +++ b/drivers/net/plip.c | |||
@@ -540,7 +540,7 @@ plip_receive(unsigned short nibble_timeout, struct net_device *dev, | |||
540 | * in far too many old systems not all even running Linux. | 540 | * in far too many old systems not all even running Linux. |
541 | */ | 541 | */ |
542 | 542 | ||
543 | static unsigned short plip_type_trans(struct sk_buff *skb, struct net_device *dev) | 543 | static __be16 plip_type_trans(struct sk_buff *skb, struct net_device *dev) |
544 | { | 544 | { |
545 | struct ethhdr *eth; | 545 | struct ethhdr *eth; |
546 | unsigned char *rawp; | 546 | unsigned char *rawp; |
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index 7217d44e8854..2c83cca34b86 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c | |||
@@ -861,8 +861,7 @@ fst_tx_dma_complete(struct fst_card_info *card, struct fst_port_info *port, | |||
861 | /* | 861 | /* |
862 | * Mark it for our own raw sockets interface | 862 | * Mark it for our own raw sockets interface |
863 | */ | 863 | */ |
864 | static unsigned short farsync_type_trans(struct sk_buff *skb, | 864 | static __be16 farsync_type_trans(struct sk_buff *skb, struct net_device *dev) |
865 | struct net_device *dev) | ||
866 | { | 865 | { |
867 | skb->dev = dev; | 866 | skb->dev = dev; |
868 | skb->mac.raw = skb->data; | 867 | skb->mac.raw = skb->data; |
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c index 87496843681a..48c03c11cd9a 100644 --- a/drivers/net/wan/hdlc_cisco.c +++ b/drivers/net/wan/hdlc_cisco.c | |||
@@ -91,8 +91,7 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type, | |||
91 | 91 | ||
92 | 92 | ||
93 | 93 | ||
94 | static unsigned short cisco_type_trans(struct sk_buff *skb, | 94 | static __be16 cisco_type_trans(struct sk_buff *skb, struct net_device *dev) |
95 | struct net_device *dev) | ||
96 | { | 95 | { |
97 | hdlc_header *data = (hdlc_header*)skb->data; | 96 | hdlc_header *data = (hdlc_header*)skb->data; |
98 | 97 | ||
diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c index 7cd6195a2e46..b81263eaede0 100644 --- a/drivers/net/wan/hdlc_ppp.c +++ b/drivers/net/wan/hdlc_ppp.c | |||
@@ -66,8 +66,7 @@ static void ppp_close(struct net_device *dev) | |||
66 | 66 | ||
67 | 67 | ||
68 | 68 | ||
69 | static unsigned short ppp_type_trans(struct sk_buff *skb, | 69 | static __be16 ppp_type_trans(struct sk_buff *skb, struct net_device *dev) |
70 | struct net_device *dev) | ||
71 | { | 70 | { |
72 | return __constant_htons(ETH_P_WAN_PPP); | 71 | return __constant_htons(ETH_P_WAN_PPP); |
73 | } | 72 | } |
diff --git a/drivers/net/wan/hdlc_raw.c b/drivers/net/wan/hdlc_raw.c index c41fb70b6929..9456d31cb1c1 100644 --- a/drivers/net/wan/hdlc_raw.c +++ b/drivers/net/wan/hdlc_raw.c | |||
@@ -24,8 +24,7 @@ | |||
24 | #include <linux/hdlc.h> | 24 | #include <linux/hdlc.h> |
25 | 25 | ||
26 | 26 | ||
27 | static unsigned short raw_type_trans(struct sk_buff *skb, | 27 | static __be16 raw_type_trans(struct sk_buff *skb, struct net_device *dev) |
28 | struct net_device *dev) | ||
29 | { | 28 | { |
30 | return __constant_htons(ETH_P_IP); | 29 | return __constant_htons(ETH_P_IP); |
31 | } | 30 | } |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index bc01d34e2634..e9e37abe1f76 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -1,9 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | * File: pci-acpi.c | 2 | * File: pci-acpi.c |
3 | * Purpose: Provide PCI supports in ACPI | 3 | * Purpose: Provide PCI support in ACPI |
4 | * | 4 | * |
5 | * Copyright (C) 2004 Intel | 5 | * Copyright (C) 2005 David Shaohua Li <shaohua.li@intel.com> |
6 | * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com) | 6 | * Copyright (C) 2004 Tom Long Nguyen <tom.l.nguyen@intel.com> |
7 | * Copyright (C) 2004 Intel Corp. | ||
7 | */ | 8 | */ |
8 | 9 | ||
9 | #include <linux/delay.h> | 10 | #include <linux/delay.h> |
@@ -16,6 +17,7 @@ | |||
16 | #include <acpi/acpi_bus.h> | 17 | #include <acpi/acpi_bus.h> |
17 | 18 | ||
18 | #include <linux/pci-acpi.h> | 19 | #include <linux/pci-acpi.h> |
20 | #include "pci.h" | ||
19 | 21 | ||
20 | static u32 ctrlset_buf[3] = {0, 0, 0}; | 22 | static u32 ctrlset_buf[3] = {0, 0, 0}; |
21 | static u32 global_ctrlsets = 0; | 23 | static u32 global_ctrlsets = 0; |
@@ -207,3 +209,105 @@ acpi_status pci_osc_control_set(u32 flags) | |||
207 | return status; | 209 | return status; |
208 | } | 210 | } |
209 | EXPORT_SYMBOL(pci_osc_control_set); | 211 | EXPORT_SYMBOL(pci_osc_control_set); |
212 | |||
213 | /* | ||
214 | * _SxD returns the D-state with the highest power | ||
215 | * (lowest D-state number) supported in the S-state "x". | ||
216 | * | ||
217 | * If the devices does not have a _PRW | ||
218 | * (Power Resources for Wake) supporting system wakeup from "x" | ||
219 | * then the OS is free to choose a lower power (higher number | ||
220 | * D-state) than the return value from _SxD. | ||
221 | * | ||
222 | * But if _PRW is enabled at S-state "x", the OS | ||
223 | * must not choose a power lower than _SxD -- | ||
224 | * unless the device has an _SxW method specifying | ||
225 | * the lowest power (highest D-state number) the device | ||
226 | * may enter while still able to wake the system. | ||
227 | * | ||
228 | * ie. depending on global OS policy: | ||
229 | * | ||
230 | * if (_PRW at S-state x) | ||
231 | * choose from highest power _SxD to lowest power _SxW | ||
232 | * else // no _PRW at S-state x | ||
233 | * choose highest power _SxD or any lower power | ||
234 | * | ||
235 | * currently we simply return _SxD, if present. | ||
236 | */ | ||
237 | |||
238 | static int acpi_pci_choose_state(struct pci_dev *pdev, pm_message_t state) | ||
239 | { | ||
240 | /* TBD */ | ||
241 | |||
242 | return -ENODEV; | ||
243 | } | ||
244 | |||
245 | static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | ||
246 | { | ||
247 | acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); | ||
248 | static int state_conv[] = { | ||
249 | [0] = 0, | ||
250 | [1] = 1, | ||
251 | [2] = 2, | ||
252 | [3] = 3, | ||
253 | [4] = 3 | ||
254 | }; | ||
255 | int acpi_state = state_conv[(int __force) state]; | ||
256 | |||
257 | if (!handle) | ||
258 | return -ENODEV; | ||
259 | return acpi_bus_set_power(handle, acpi_state); | ||
260 | } | ||
261 | |||
262 | |||
263 | /* ACPI bus type */ | ||
264 | static int pci_acpi_find_device(struct device *dev, acpi_handle *handle) | ||
265 | { | ||
266 | struct pci_dev * pci_dev; | ||
267 | acpi_integer addr; | ||
268 | |||
269 | pci_dev = to_pci_dev(dev); | ||
270 | /* Please ref to ACPI spec for the syntax of _ADR */ | ||
271 | addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); | ||
272 | *handle = acpi_get_child(DEVICE_ACPI_HANDLE(dev->parent), addr); | ||
273 | if (!*handle) | ||
274 | return -ENODEV; | ||
275 | return 0; | ||
276 | } | ||
277 | |||
278 | static int pci_acpi_find_root_bridge(struct device *dev, acpi_handle *handle) | ||
279 | { | ||
280 | int num; | ||
281 | unsigned int seg, bus; | ||
282 | |||
283 | /* | ||
284 | * The string should be the same as root bridge's name | ||
285 | * Please look at 'pci_scan_bus_parented' | ||
286 | */ | ||
287 | num = sscanf(dev->bus_id, "pci%04x:%02x", &seg, &bus); | ||
288 | if (num != 2) | ||
289 | return -ENODEV; | ||
290 | *handle = acpi_get_pci_rootbridge_handle(seg, bus); | ||
291 | if (!*handle) | ||
292 | return -ENODEV; | ||
293 | return 0; | ||
294 | } | ||
295 | |||
296 | static struct acpi_bus_type pci_acpi_bus = { | ||
297 | .bus = &pci_bus_type, | ||
298 | .find_device = pci_acpi_find_device, | ||
299 | .find_bridge = pci_acpi_find_root_bridge, | ||
300 | }; | ||
301 | |||
302 | static int __init pci_acpi_init(void) | ||
303 | { | ||
304 | int ret; | ||
305 | |||
306 | ret = register_acpi_bus_type(&pci_acpi_bus); | ||
307 | if (ret) | ||
308 | return 0; | ||
309 | platform_pci_choose_state = acpi_pci_choose_state; | ||
310 | platform_pci_set_power_state = acpi_pci_set_power_state; | ||
311 | return 0; | ||
312 | } | ||
313 | arch_initcall(pci_acpi_init); | ||
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index d382bdb7b560..1b34fc56067e 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -235,7 +235,7 @@ pci_find_parent_resource(const struct pci_dev *dev, struct resource *res) | |||
235 | * -EIO if device does not support PCI PM. | 235 | * -EIO if device does not support PCI PM. |
236 | * 0 if we can successfully change the power state. | 236 | * 0 if we can successfully change the power state. |
237 | */ | 237 | */ |
238 | 238 | int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t t); | |
239 | int | 239 | int |
240 | pci_set_power_state(struct pci_dev *dev, pci_power_t state) | 240 | pci_set_power_state(struct pci_dev *dev, pci_power_t state) |
241 | { | 241 | { |
@@ -299,11 +299,20 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
299 | msleep(10); | 299 | msleep(10); |
300 | else if (state == PCI_D2 || dev->current_state == PCI_D2) | 300 | else if (state == PCI_D2 || dev->current_state == PCI_D2) |
301 | udelay(200); | 301 | udelay(200); |
302 | dev->current_state = state; | ||
303 | 302 | ||
303 | /* | ||
304 | * Give firmware a chance to be called, such as ACPI _PRx, _PSx | ||
305 | * Firmware method after natice method ? | ||
306 | */ | ||
307 | if (platform_pci_set_power_state) | ||
308 | platform_pci_set_power_state(dev, state); | ||
309 | |||
310 | dev->current_state = state; | ||
304 | return 0; | 311 | return 0; |
305 | } | 312 | } |
306 | 313 | ||
314 | int (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); | ||
315 | |||
307 | /** | 316 | /** |
308 | * pci_choose_state - Choose the power state of a PCI device | 317 | * pci_choose_state - Choose the power state of a PCI device |
309 | * @dev: PCI device to be suspended | 318 | * @dev: PCI device to be suspended |
@@ -316,10 +325,17 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
316 | 325 | ||
317 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) | 326 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) |
318 | { | 327 | { |
328 | int ret; | ||
329 | |||
319 | if (!pci_find_capability(dev, PCI_CAP_ID_PM)) | 330 | if (!pci_find_capability(dev, PCI_CAP_ID_PM)) |
320 | return PCI_D0; | 331 | return PCI_D0; |
321 | 332 | ||
322 | switch (state) { | 333 | if (platform_pci_choose_state) { |
334 | ret = platform_pci_choose_state(dev, state); | ||
335 | if (ret >= 0) | ||
336 | state = ret; | ||
337 | } | ||
338 | switch (state) { | ||
323 | case 0: return PCI_D0; | 339 | case 0: return PCI_D0; |
324 | case 3: return PCI_D3hot; | 340 | case 3: return PCI_D3hot; |
325 | default: | 341 | default: |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 744da0d4ae5f..d94d7af4f7a0 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -11,6 +11,10 @@ extern int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | |||
11 | void (*alignf)(void *, struct resource *, | 11 | void (*alignf)(void *, struct resource *, |
12 | unsigned long, unsigned long), | 12 | unsigned long, unsigned long), |
13 | void *alignf_data); | 13 | void *alignf_data); |
14 | /* Firmware callbacks */ | ||
15 | extern int (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); | ||
16 | extern int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t state); | ||
17 | |||
14 | /* PCI /proc functions */ | 18 | /* PCI /proc functions */ |
15 | #ifdef CONFIG_PROC_FS | 19 | #ifdef CONFIG_PROC_FS |
16 | extern int pci_proc_attach_device(struct pci_dev *dev); | 20 | extern int pci_proc_attach_device(struct pci_dev *dev); |
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index 0e7aa8176692..6837491f021c 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c | |||
@@ -527,98 +527,144 @@ static int yenta_sock_suspend(struct pcmcia_socket *sock) | |||
527 | * Use an adaptive allocation for the memory resource, | 527 | * Use an adaptive allocation for the memory resource, |
528 | * sometimes the memory behind pci bridges is limited: | 528 | * sometimes the memory behind pci bridges is limited: |
529 | * 1/8 of the size of the io window of the parent. | 529 | * 1/8 of the size of the io window of the parent. |
530 | * max 4 MB, min 16 kB. | 530 | * max 4 MB, min 16 kB. We try very hard to not get below |
531 | * the "ACC" values, though. | ||
531 | */ | 532 | */ |
532 | #define BRIDGE_MEM_MAX 4*1024*1024 | 533 | #define BRIDGE_MEM_MAX 4*1024*1024 |
534 | #define BRIDGE_MEM_ACC 128*1024 | ||
533 | #define BRIDGE_MEM_MIN 16*1024 | 535 | #define BRIDGE_MEM_MIN 16*1024 |
534 | 536 | ||
535 | #define BRIDGE_IO_MAX 256 | 537 | #define BRIDGE_IO_MAX 512 |
538 | #define BRIDGE_IO_ACC 256 | ||
536 | #define BRIDGE_IO_MIN 32 | 539 | #define BRIDGE_IO_MIN 32 |
537 | 540 | ||
538 | #ifndef PCIBIOS_MIN_CARDBUS_IO | 541 | #ifndef PCIBIOS_MIN_CARDBUS_IO |
539 | #define PCIBIOS_MIN_CARDBUS_IO PCIBIOS_MIN_IO | 542 | #define PCIBIOS_MIN_CARDBUS_IO PCIBIOS_MIN_IO |
540 | #endif | 543 | #endif |
541 | 544 | ||
542 | static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type) | 545 | static int yenta_search_one_res(struct resource *root, struct resource *res, |
546 | u32 min) | ||
547 | { | ||
548 | u32 align, size, start, end; | ||
549 | |||
550 | if (res->flags & IORESOURCE_IO) { | ||
551 | align = 1024; | ||
552 | size = BRIDGE_IO_MAX; | ||
553 | start = PCIBIOS_MIN_CARDBUS_IO; | ||
554 | end = ~0U; | ||
555 | } else { | ||
556 | unsigned long avail = root->end - root->start; | ||
557 | int i; | ||
558 | size = BRIDGE_MEM_MAX; | ||
559 | if (size > avail/8) { | ||
560 | size=(avail+1)/8; | ||
561 | /* round size down to next power of 2 */ | ||
562 | i = 0; | ||
563 | while ((size /= 2) != 0) | ||
564 | i++; | ||
565 | size = 1 << i; | ||
566 | } | ||
567 | if (size < min) | ||
568 | size = min; | ||
569 | align = size; | ||
570 | start = PCIBIOS_MIN_MEM; | ||
571 | end = ~0U; | ||
572 | } | ||
573 | |||
574 | do { | ||
575 | if (allocate_resource(root, res, size, start, end, align, | ||
576 | NULL, NULL)==0) { | ||
577 | return 1; | ||
578 | } | ||
579 | size = size/2; | ||
580 | align = size; | ||
581 | } while (size >= min); | ||
582 | |||
583 | return 0; | ||
584 | } | ||
585 | |||
586 | |||
587 | static int yenta_search_res(struct yenta_socket *socket, struct resource *res, | ||
588 | u32 min) | ||
589 | { | ||
590 | int i; | ||
591 | for (i=0; i<PCI_BUS_NUM_RESOURCES; i++) { | ||
592 | struct resource * root = socket->dev->bus->resource[i]; | ||
593 | if (!root) | ||
594 | continue; | ||
595 | |||
596 | if ((res->flags ^ root->flags) & | ||
597 | (IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH)) | ||
598 | continue; /* Wrong type */ | ||
599 | |||
600 | if (yenta_search_one_res(root, res, min)) | ||
601 | return 1; | ||
602 | } | ||
603 | return 0; | ||
604 | } | ||
605 | |||
606 | static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end) | ||
543 | { | 607 | { |
544 | struct pci_bus *bus; | 608 | struct pci_bus *bus; |
545 | struct resource *root, *res; | 609 | struct resource *root, *res; |
546 | u32 start, end; | 610 | u32 start, end; |
547 | u32 align, size, min; | ||
548 | unsigned offset; | ||
549 | unsigned mask; | 611 | unsigned mask; |
550 | 612 | ||
551 | res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr; | 613 | res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr; |
552 | /* Already allocated? */ | 614 | /* Already allocated? */ |
553 | if (res->parent) | 615 | if (res->parent) |
554 | return 0; | 616 | return; |
555 | 617 | ||
556 | /* The granularity of the memory limit is 4kB, on IO it's 4 bytes */ | 618 | /* The granularity of the memory limit is 4kB, on IO it's 4 bytes */ |
557 | mask = ~0xfff; | 619 | mask = ~0xfff; |
558 | if (type & IORESOURCE_IO) | 620 | if (type & IORESOURCE_IO) |
559 | mask = ~3; | 621 | mask = ~3; |
560 | 622 | ||
561 | offset = 0x1c + 8*nr; | ||
562 | bus = socket->dev->subordinate; | 623 | bus = socket->dev->subordinate; |
563 | res->name = bus->name; | 624 | res->name = bus->name; |
564 | res->flags = type; | 625 | res->flags = type; |
565 | res->start = 0; | ||
566 | res->end = 0; | ||
567 | root = pci_find_parent_resource(socket->dev, res); | ||
568 | 626 | ||
569 | if (!root) | 627 | start = config_readl(socket, addr_start) & mask; |
570 | return; | 628 | end = config_readl(socket, addr_end) | ~mask; |
571 | |||
572 | start = config_readl(socket, offset) & mask; | ||
573 | end = config_readl(socket, offset+4) | ~mask; | ||
574 | if (start && end > start && !override_bios) { | 629 | if (start && end > start && !override_bios) { |
575 | res->start = start; | 630 | res->start = start; |
576 | res->end = end; | 631 | res->end = end; |
577 | if (request_resource(root, res) == 0) | 632 | root = pci_find_parent_resource(socket->dev, res); |
633 | if (root && (request_resource(root, res) == 0)) | ||
578 | return; | 634 | return; |
579 | printk(KERN_INFO "yenta %s: Preassigned resource %d busy, reconfiguring...\n", | 635 | printk(KERN_INFO "yenta %s: Preassigned resource %d busy or not available, reconfiguring...\n", |
580 | pci_name(socket->dev), nr); | 636 | pci_name(socket->dev), nr); |
581 | res->start = res->end = 0; | ||
582 | } | 637 | } |
583 | 638 | ||
584 | if (type & IORESOURCE_IO) { | 639 | if (type & IORESOURCE_IO) { |
585 | align = 1024; | 640 | if ((yenta_search_res(socket, res, BRIDGE_IO_MAX)) || |
586 | size = BRIDGE_IO_MAX; | 641 | (yenta_search_res(socket, res, BRIDGE_IO_ACC)) || |
587 | min = BRIDGE_IO_MIN; | 642 | (yenta_search_res(socket, res, BRIDGE_IO_MIN))) { |
588 | start = PCIBIOS_MIN_CARDBUS_IO; | 643 | config_writel(socket, addr_start, res->start); |
589 | end = ~0U; | 644 | config_writel(socket, addr_end, res->end); |
645 | } | ||
590 | } else { | 646 | } else { |
591 | unsigned long avail = root->end - root->start; | 647 | if (type & IORESOURCE_PREFETCH) { |
592 | int i; | 648 | if ((yenta_search_res(socket, res, BRIDGE_MEM_MAX)) || |
593 | size = BRIDGE_MEM_MAX; | 649 | (yenta_search_res(socket, res, BRIDGE_MEM_ACC)) || |
594 | if (size > avail/8) { | 650 | (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) { |
595 | size=(avail+1)/8; | 651 | config_writel(socket, addr_start, res->start); |
596 | /* round size down to next power of 2 */ | 652 | config_writel(socket, addr_end, res->end); |
597 | i = 0; | 653 | } |
598 | while ((size /= 2) != 0) | 654 | /* Approximating prefetchable by non-prefetchable */ |
599 | i++; | 655 | res->flags = IORESOURCE_MEM; |
600 | size = 1 << i; | ||
601 | } | 656 | } |
602 | if (size < BRIDGE_MEM_MIN) | 657 | if ((yenta_search_res(socket, res, BRIDGE_MEM_MAX)) || |
603 | size = BRIDGE_MEM_MIN; | 658 | (yenta_search_res(socket, res, BRIDGE_MEM_ACC)) || |
604 | min = BRIDGE_MEM_MIN; | 659 | (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) { |
605 | align = size; | 660 | config_writel(socket, addr_start, res->start); |
606 | start = PCIBIOS_MIN_MEM; | 661 | config_writel(socket, addr_end, res->end); |
607 | end = ~0U; | ||
608 | } | ||
609 | |||
610 | do { | ||
611 | if (allocate_resource(root, res, size, start, end, align, NULL, NULL)==0) { | ||
612 | config_writel(socket, offset, res->start); | ||
613 | config_writel(socket, offset+4, res->end); | ||
614 | return; | ||
615 | } | 662 | } |
616 | size = size/2; | 663 | } |
617 | align = size; | 664 | |
618 | } while (size >= min); | ||
619 | printk(KERN_INFO "yenta %s: no resource of type %x available, trying to continue...\n", | 665 | printk(KERN_INFO "yenta %s: no resource of type %x available, trying to continue...\n", |
620 | pci_name(socket->dev), type); | 666 | pci_name(socket->dev), type); |
621 | res->start = res->end = 0; | 667 | res->start = res->end = res->flags = 0; |
622 | } | 668 | } |
623 | 669 | ||
624 | /* | 670 | /* |
@@ -626,10 +672,14 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ | |||
626 | */ | 672 | */ |
627 | static void yenta_allocate_resources(struct yenta_socket *socket) | 673 | static void yenta_allocate_resources(struct yenta_socket *socket) |
628 | { | 674 | { |
629 | yenta_allocate_res(socket, 0, IORESOURCE_MEM|IORESOURCE_PREFETCH); | 675 | yenta_allocate_res(socket, 0, IORESOURCE_IO, |
630 | yenta_allocate_res(socket, 1, IORESOURCE_MEM); | 676 | PCI_CB_IO_BASE_0, PCI_CB_IO_LIMIT_0); |
631 | yenta_allocate_res(socket, 2, IORESOURCE_IO); | 677 | yenta_allocate_res(socket, 1, IORESOURCE_IO, |
632 | yenta_allocate_res(socket, 3, IORESOURCE_IO); /* PCI isn't clever enough to use this one yet */ | 678 | PCI_CB_IO_BASE_1, PCI_CB_IO_LIMIT_1); |
679 | yenta_allocate_res(socket, 2, IORESOURCE_MEM|IORESOURCE_PREFETCH, | ||
680 | PCI_CB_MEMORY_BASE_0, PCI_CB_MEMORY_LIMIT_0); | ||
681 | yenta_allocate_res(socket, 3, IORESOURCE_MEM, | ||
682 | PCI_CB_MEMORY_BASE_1, PCI_CB_MEMORY_LIMIT_1); | ||
633 | } | 683 | } |
634 | 684 | ||
635 | 685 | ||
@@ -1055,6 +1105,7 @@ static int yenta_dev_suspend (struct pci_dev *dev, pm_message_t state) | |||
1055 | pci_save_state(dev); | 1105 | pci_save_state(dev); |
1056 | pci_read_config_dword(dev, 16*4, &socket->saved_state[0]); | 1106 | pci_read_config_dword(dev, 16*4, &socket->saved_state[0]); |
1057 | pci_read_config_dword(dev, 17*4, &socket->saved_state[1]); | 1107 | pci_read_config_dword(dev, 17*4, &socket->saved_state[1]); |
1108 | pci_disable_device(dev); | ||
1058 | 1109 | ||
1059 | /* | 1110 | /* |
1060 | * Some laptops (IBM T22) do not like us putting the Cardbus | 1111 | * Some laptops (IBM T22) do not like us putting the Cardbus |
@@ -1078,6 +1129,8 @@ static int yenta_dev_resume (struct pci_dev *dev) | |||
1078 | pci_restore_state(dev); | 1129 | pci_restore_state(dev); |
1079 | pci_write_config_dword(dev, 16*4, socket->saved_state[0]); | 1130 | pci_write_config_dword(dev, 16*4, socket->saved_state[0]); |
1080 | pci_write_config_dword(dev, 17*4, socket->saved_state[1]); | 1131 | pci_write_config_dword(dev, 17*4, socket->saved_state[1]); |
1132 | pci_enable_device(dev); | ||
1133 | pci_set_master(dev); | ||
1081 | 1134 | ||
1082 | if (socket->type && socket->type->restore_state) | 1135 | if (socket->type && socket->type->restore_state) |
1083 | socket->type->restore_state(socket); | 1136 | socket->type->restore_state(socket); |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index dd61e09029b1..75575f6c349c 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -160,7 +160,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
160 | acpi_register_gsi(res->data.irq.interrupts[0], | 160 | acpi_register_gsi(res->data.irq.interrupts[0], |
161 | res->data.irq.edge_level, | 161 | res->data.irq.edge_level, |
162 | res->data.irq.active_high_low)); | 162 | res->data.irq.active_high_low)); |
163 | pcibios_penalize_isa_irq(res->data.irq.interrupts[0]); | 163 | pcibios_penalize_isa_irq(res->data.irq.interrupts[0], 1); |
164 | } | 164 | } |
165 | break; | 165 | break; |
166 | 166 | ||
@@ -171,7 +171,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
171 | acpi_register_gsi(res->data.extended_irq.interrupts[0], | 171 | acpi_register_gsi(res->data.extended_irq.interrupts[0], |
172 | res->data.extended_irq.edge_level, | 172 | res->data.extended_irq.edge_level, |
173 | res->data.extended_irq.active_high_low)); | 173 | res->data.extended_irq.active_high_low)); |
174 | pcibios_penalize_isa_irq(res->data.extended_irq.interrupts[0]); | 174 | pcibios_penalize_isa_irq(res->data.extended_irq.interrupts[0], 1); |
175 | } | 175 | } |
176 | break; | 176 | break; |
177 | case ACPI_RSTYPE_DMA: | 177 | case ACPI_RSTYPE_DMA: |
@@ -444,6 +444,7 @@ pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, | |||
444 | 444 | ||
445 | struct acpipnp_parse_option_s { | 445 | struct acpipnp_parse_option_s { |
446 | struct pnp_option *option; | 446 | struct pnp_option *option; |
447 | struct pnp_option *option_independent; | ||
447 | struct pnp_dev *dev; | 448 | struct pnp_dev *dev; |
448 | }; | 449 | }; |
449 | 450 | ||
@@ -507,7 +508,14 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
507 | parse_data->option = option; | 508 | parse_data->option = option; |
508 | break; | 509 | break; |
509 | case ACPI_RSTYPE_END_DPF: | 510 | case ACPI_RSTYPE_END_DPF: |
510 | return AE_CTRL_TERMINATE; | 511 | /*only one EndDependentFn is allowed*/ |
512 | if (!parse_data->option_independent) { | ||
513 | pnp_warn("PnPACPI: more than one EndDependentFn"); | ||
514 | return AE_ERROR; | ||
515 | } | ||
516 | parse_data->option = parse_data->option_independent; | ||
517 | parse_data->option_independent = NULL; | ||
518 | break; | ||
511 | default: | 519 | default: |
512 | pnp_warn("PnPACPI: unknown resource type %d", res->id); | 520 | pnp_warn("PnPACPI: unknown resource type %d", res->id); |
513 | return AE_ERROR; | 521 | return AE_ERROR; |
@@ -525,6 +533,7 @@ acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, | |||
525 | parse_data.option = pnp_register_independent_option(dev); | 533 | parse_data.option = pnp_register_independent_option(dev); |
526 | if (!parse_data.option) | 534 | if (!parse_data.option) |
527 | return AE_ERROR; | 535 | return AE_ERROR; |
536 | parse_data.option_independent = parse_data.option; | ||
528 | parse_data.dev = dev; | 537 | parse_data.dev = dev; |
529 | status = acpi_walk_resources(handle, METHOD_NAME__PRS, | 538 | status = acpi_walk_resources(handle, METHOD_NAME__PRS, |
530 | pnpacpi_option_resource, &parse_data); | 539 | pnpacpi_option_resource, &parse_data); |
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c index 79bce7b75740..9001b6f0204d 100644 --- a/drivers/pnp/pnpbios/rsparser.c +++ b/drivers/pnp/pnpbios/rsparser.c | |||
@@ -64,7 +64,7 @@ pnpbios_parse_allocated_irqresource(struct pnp_resource_table * res, int irq) | |||
64 | } | 64 | } |
65 | res->irq_resource[i].start = | 65 | res->irq_resource[i].start = |
66 | res->irq_resource[i].end = (unsigned long) irq; | 66 | res->irq_resource[i].end = (unsigned long) irq; |
67 | pcibios_penalize_isa_irq(irq); | 67 | pcibios_penalize_isa_irq(irq, 1); |
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c index 2d1322dd7e19..887ad8939349 100644 --- a/drivers/pnp/resource.c +++ b/drivers/pnp/resource.c | |||
@@ -102,7 +102,7 @@ int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data) | |||
102 | 102 | ||
103 | for (i = 0; i < 16; i++) | 103 | for (i = 0; i < 16; i++) |
104 | if (test_bit(i, data->map)) | 104 | if (test_bit(i, data->map)) |
105 | pcibios_penalize_isa_irq(i); | 105 | pcibios_penalize_isa_irq(i, 0); |
106 | } | 106 | } |
107 | #endif | 107 | #endif |
108 | return 0; | 108 | return 0; |
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index 3cb88c770037..8f4d2999af8e 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -2210,7 +2210,7 @@ no_mem: | |||
2210 | return NULL; | 2210 | return NULL; |
2211 | } | 2211 | } |
2212 | 2212 | ||
2213 | static inline unsigned short | 2213 | static inline __be16 |
2214 | qeth_type_trans(struct sk_buff *skb, struct net_device *dev) | 2214 | qeth_type_trans(struct sk_buff *skb, struct net_device *dev) |
2215 | { | 2215 | { |
2216 | struct qeth_card *card; | 2216 | struct qeth_card *card; |
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c index 1fef92d55dee..390cd67c57c0 100644 --- a/drivers/scsi/aacraid/commctrl.c +++ b/drivers/scsi/aacraid/commctrl.c | |||
@@ -469,7 +469,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
469 | goto cleanup; | 469 | goto cleanup; |
470 | } | 470 | } |
471 | 471 | ||
472 | user_srbcmd = kmalloc(GFP_KERNEL, fibsize); | 472 | user_srbcmd = kmalloc(fibsize, GFP_KERNEL); |
473 | if (!user_srbcmd) { | 473 | if (!user_srbcmd) { |
474 | dprintk((KERN_DEBUG"aacraid: Could not make a copy of the srb\n")); | 474 | dprintk((KERN_DEBUG"aacraid: Could not make a copy of the srb\n")); |
475 | rcode = -ENOMEM; | 475 | rcode = -ENOMEM; |
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index d79cd218a551..df014c2a7c54 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile | |||
@@ -65,12 +65,14 @@ obj-$(CONFIG_USB_EMI26) += misc/ | |||
65 | obj-$(CONFIG_USB_EMI62) += misc/ | 65 | obj-$(CONFIG_USB_EMI62) += misc/ |
66 | obj-$(CONFIG_USB_IDMOUSE) += misc/ | 66 | obj-$(CONFIG_USB_IDMOUSE) += misc/ |
67 | obj-$(CONFIG_USB_LCD) += misc/ | 67 | obj-$(CONFIG_USB_LCD) += misc/ |
68 | obj-$(CONFIG_USB_LD) += misc/ | ||
68 | obj-$(CONFIG_USB_LED) += misc/ | 69 | obj-$(CONFIG_USB_LED) += misc/ |
69 | obj-$(CONFIG_USB_LEGOTOWER) += misc/ | 70 | obj-$(CONFIG_USB_LEGOTOWER) += misc/ |
70 | obj-$(CONFIG_USB_RIO500) += misc/ | 71 | obj-$(CONFIG_USB_RIO500) += misc/ |
71 | obj-$(CONFIG_USB_TEST) += misc/ | 72 | obj-$(CONFIG_USB_TEST) += misc/ |
72 | obj-$(CONFIG_USB_USS720) += misc/ | 73 | obj-$(CONFIG_USB_USS720) += misc/ |
73 | obj-$(CONFIG_USB_PHIDGETSERVO) += misc/ | 74 | obj-$(CONFIG_USB_PHIDGETSERVO) += misc/ |
75 | obj-$(CONFIG_USB_SISUSBVGA) += misc/ | ||
74 | 76 | ||
75 | obj-$(CONFIG_USB_ATM) += atm/ | 77 | obj-$(CONFIG_USB_ATM) += atm/ |
76 | obj-$(CONFIG_USB_SPEEDTOUCH) += atm/ | 78 | obj-$(CONFIG_USB_SPEEDTOUCH) += atm/ |
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index cbd4a7d25d0b..8e184e2641cb 100644 --- a/drivers/usb/atm/cxacru.c +++ b/drivers/usb/atm/cxacru.c | |||
@@ -427,7 +427,7 @@ static void cxacru_poll_status(struct cxacru_data *instance) | |||
427 | atm_dev->link_rate = buf[CXINF_DOWNSTREAM_RATE] * 1000 / 424; | 427 | atm_dev->link_rate = buf[CXINF_DOWNSTREAM_RATE] * 1000 / 424; |
428 | atm_dev->signal = ATM_PHY_SIG_FOUND; | 428 | atm_dev->signal = ATM_PHY_SIG_FOUND; |
429 | 429 | ||
430 | dev_info(dev, "ADSL line: up (%d Kib/s down | %d Kib/s up)\n", | 430 | dev_info(dev, "ADSL line: up (%d kb/s down | %d kb/s up)\n", |
431 | buf[CXINF_DOWNSTREAM_RATE], buf[CXINF_UPSTREAM_RATE]); | 431 | buf[CXINF_DOWNSTREAM_RATE], buf[CXINF_UPSTREAM_RATE]); |
432 | break; | 432 | break; |
433 | 433 | ||
diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c index 6a6eaa2a3b1c..d0cbbb7f0385 100644 --- a/drivers/usb/atm/speedtch.c +++ b/drivers/usb/atm/speedtch.c | |||
@@ -100,6 +100,8 @@ struct speedtch_instance_data { | |||
100 | 100 | ||
101 | struct work_struct status_checker; | 101 | struct work_struct status_checker; |
102 | 102 | ||
103 | unsigned char last_status; | ||
104 | |||
103 | int poll_delay; /* milliseconds */ | 105 | int poll_delay; /* milliseconds */ |
104 | 106 | ||
105 | struct timer_list resubmit_timer; | 107 | struct timer_list resubmit_timer; |
@@ -423,52 +425,48 @@ static void speedtch_check_status(struct speedtch_instance_data *instance) | |||
423 | struct usbatm_data *usbatm = instance->usbatm; | 425 | struct usbatm_data *usbatm = instance->usbatm; |
424 | struct atm_dev *atm_dev = usbatm->atm_dev; | 426 | struct atm_dev *atm_dev = usbatm->atm_dev; |
425 | unsigned char *buf = instance->scratch_buffer; | 427 | unsigned char *buf = instance->scratch_buffer; |
426 | int ret; | 428 | int down_speed, up_speed, ret; |
429 | unsigned char status; | ||
427 | 430 | ||
428 | atm_dbg(usbatm, "%s entered\n", __func__); | 431 | atm_dbg(usbatm, "%s entered\n", __func__); |
429 | 432 | ||
430 | ret = speedtch_read_status(instance); | 433 | ret = speedtch_read_status(instance); |
431 | if (ret < 0) { | 434 | if (ret < 0) { |
432 | atm_warn(usbatm, "error %d fetching device status\n", ret); | 435 | atm_warn(usbatm, "error %d fetching device status\n", ret); |
433 | if (instance->poll_delay < MAX_POLL_DELAY) | 436 | instance->poll_delay = min(2 * instance->poll_delay, MAX_POLL_DELAY); |
434 | instance->poll_delay *= 2; | ||
435 | return; | 437 | return; |
436 | } | 438 | } |
437 | 439 | ||
438 | if (instance->poll_delay > MIN_POLL_DELAY) | 440 | instance->poll_delay = max(instance->poll_delay / 2, MIN_POLL_DELAY); |
439 | instance->poll_delay /= 2; | ||
440 | 441 | ||
441 | atm_dbg(usbatm, "%s: line state %02x\n", __func__, buf[OFFSET_7]); | 442 | status = buf[OFFSET_7]; |
442 | 443 | ||
443 | switch (buf[OFFSET_7]) { | 444 | atm_dbg(usbatm, "%s: line state %02x\n", __func__, status); |
444 | case 0: | 445 | |
445 | if (atm_dev->signal != ATM_PHY_SIG_LOST) { | 446 | if ((status != instance->last_status) || !status) { |
447 | switch (status) { | ||
448 | case 0: | ||
446 | atm_dev->signal = ATM_PHY_SIG_LOST; | 449 | atm_dev->signal = ATM_PHY_SIG_LOST; |
447 | atm_info(usbatm, "ADSL line is down\n"); | 450 | if (instance->last_status) |
448 | /* It'll never resync again unless we ask it to... */ | 451 | atm_info(usbatm, "ADSL line is down\n"); |
452 | /* It may never resync again unless we ask it to... */ | ||
449 | ret = speedtch_start_synchro(instance); | 453 | ret = speedtch_start_synchro(instance); |
450 | } | 454 | break; |
451 | break; | ||
452 | 455 | ||
453 | case 0x08: | 456 | case 0x08: |
454 | if (atm_dev->signal != ATM_PHY_SIG_UNKNOWN) { | ||
455 | atm_dev->signal = ATM_PHY_SIG_UNKNOWN; | 457 | atm_dev->signal = ATM_PHY_SIG_UNKNOWN; |
456 | atm_info(usbatm, "ADSL line is blocked?\n"); | 458 | atm_info(usbatm, "ADSL line is blocked?\n"); |
457 | } | 459 | break; |
458 | break; | ||
459 | 460 | ||
460 | case 0x10: | 461 | case 0x10: |
461 | if (atm_dev->signal != ATM_PHY_SIG_LOST) { | ||
462 | atm_dev->signal = ATM_PHY_SIG_LOST; | 462 | atm_dev->signal = ATM_PHY_SIG_LOST; |
463 | atm_info(usbatm, "ADSL line is synchronising\n"); | 463 | atm_info(usbatm, "ADSL line is synchronising\n"); |
464 | } | 464 | break; |
465 | break; | ||
466 | 465 | ||
467 | case 0x20: | 466 | case 0x20: |
468 | if (atm_dev->signal != ATM_PHY_SIG_FOUND) { | 467 | down_speed = buf[OFFSET_b] | (buf[OFFSET_b + 1] << 8) |
469 | int down_speed = buf[OFFSET_b] | (buf[OFFSET_b + 1] << 8) | ||
470 | | (buf[OFFSET_b + 2] << 16) | (buf[OFFSET_b + 3] << 24); | 468 | | (buf[OFFSET_b + 2] << 16) | (buf[OFFSET_b + 3] << 24); |
471 | int up_speed = buf[OFFSET_b + 4] | (buf[OFFSET_b + 5] << 8) | 469 | up_speed = buf[OFFSET_b + 4] | (buf[OFFSET_b + 5] << 8) |
472 | | (buf[OFFSET_b + 6] << 16) | (buf[OFFSET_b + 7] << 24); | 470 | | (buf[OFFSET_b + 6] << 16) | (buf[OFFSET_b + 7] << 24); |
473 | 471 | ||
474 | if (!(down_speed & 0x0000ffff) && !(up_speed & 0x0000ffff)) { | 472 | if (!(down_speed & 0x0000ffff) && !(up_speed & 0x0000ffff)) { |
@@ -480,17 +478,17 @@ static void speedtch_check_status(struct speedtch_instance_data *instance) | |||
480 | atm_dev->signal = ATM_PHY_SIG_FOUND; | 478 | atm_dev->signal = ATM_PHY_SIG_FOUND; |
481 | 479 | ||
482 | atm_info(usbatm, | 480 | atm_info(usbatm, |
483 | "ADSL line is up (%d Kib/s down | %d Kib/s up)\n", | 481 | "ADSL line is up (%d kb/s down | %d kb/s up)\n", |
484 | down_speed, up_speed); | 482 | down_speed, up_speed); |
485 | } | 483 | break; |
486 | break; | ||
487 | 484 | ||
488 | default: | 485 | default: |
489 | if (atm_dev->signal != ATM_PHY_SIG_UNKNOWN) { | ||
490 | atm_dev->signal = ATM_PHY_SIG_UNKNOWN; | 486 | atm_dev->signal = ATM_PHY_SIG_UNKNOWN; |
491 | atm_info(usbatm, "Unknown line state %02x\n", buf[OFFSET_7]); | 487 | atm_info(usbatm, "Unknown line state %02x\n", status); |
488 | break; | ||
492 | } | 489 | } |
493 | break; | 490 | |
491 | instance->last_status = status; | ||
494 | } | 492 | } |
495 | } | 493 | } |
496 | 494 | ||
@@ -730,6 +728,7 @@ static int speedtch_bind(struct usbatm_data *usbatm, | |||
730 | 728 | ||
731 | instance->status_checker.timer.function = speedtch_status_poll; | 729 | instance->status_checker.timer.function = speedtch_status_poll; |
732 | instance->status_checker.timer.data = (unsigned long)instance; | 730 | instance->status_checker.timer.data = (unsigned long)instance; |
731 | instance->last_status = 0xff; | ||
733 | instance->poll_delay = MIN_POLL_DELAY; | 732 | instance->poll_delay = MIN_POLL_DELAY; |
734 | 733 | ||
735 | init_timer(&instance->resubmit_timer); | 734 | init_timer(&instance->resubmit_timer); |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 69e859e0f51d..adff5a77e31f 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -422,6 +422,17 @@ bail_out: | |||
422 | return -EIO; | 422 | return -EIO; |
423 | } | 423 | } |
424 | 424 | ||
425 | static void acm_tty_unregister(struct acm *acm) | ||
426 | { | ||
427 | tty_unregister_device(acm_tty_driver, acm->minor); | ||
428 | usb_put_intf(acm->control); | ||
429 | acm_table[acm->minor] = NULL; | ||
430 | usb_free_urb(acm->ctrlurb); | ||
431 | usb_free_urb(acm->readurb); | ||
432 | usb_free_urb(acm->writeurb); | ||
433 | kfree(acm); | ||
434 | } | ||
435 | |||
425 | static void acm_tty_close(struct tty_struct *tty, struct file *filp) | 436 | static void acm_tty_close(struct tty_struct *tty, struct file *filp) |
426 | { | 437 | { |
427 | struct acm *acm = tty->driver_data; | 438 | struct acm *acm = tty->driver_data; |
@@ -436,14 +447,8 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp) | |||
436 | usb_kill_urb(acm->ctrlurb); | 447 | usb_kill_urb(acm->ctrlurb); |
437 | usb_kill_urb(acm->writeurb); | 448 | usb_kill_urb(acm->writeurb); |
438 | usb_kill_urb(acm->readurb); | 449 | usb_kill_urb(acm->readurb); |
439 | } else { | 450 | } else |
440 | tty_unregister_device(acm_tty_driver, acm->minor); | 451 | acm_tty_unregister(acm); |
441 | acm_table[acm->minor] = NULL; | ||
442 | usb_free_urb(acm->ctrlurb); | ||
443 | usb_free_urb(acm->readurb); | ||
444 | usb_free_urb(acm->writeurb); | ||
445 | kfree(acm); | ||
446 | } | ||
447 | } | 452 | } |
448 | up(&open_sem); | 453 | up(&open_sem); |
449 | } | 454 | } |
@@ -905,7 +910,8 @@ skip_normal_probe: | |||
905 | 910 | ||
906 | usb_driver_claim_interface(&acm_driver, data_interface, acm); | 911 | usb_driver_claim_interface(&acm_driver, data_interface, acm); |
907 | 912 | ||
908 | tty_register_device(acm_tty_driver, minor, &intf->dev); | 913 | usb_get_intf(control_interface); |
914 | tty_register_device(acm_tty_driver, minor, &control_interface->dev); | ||
909 | 915 | ||
910 | acm_table[minor] = acm; | 916 | acm_table[minor] = acm; |
911 | usb_set_intfdata (intf, acm); | 917 | usb_set_intfdata (intf, acm); |
@@ -954,12 +960,7 @@ static void acm_disconnect(struct usb_interface *intf) | |||
954 | usb_driver_release_interface(&acm_driver, acm->data); | 960 | usb_driver_release_interface(&acm_driver, acm->data); |
955 | 961 | ||
956 | if (!acm->used) { | 962 | if (!acm->used) { |
957 | tty_unregister_device(acm_tty_driver, acm->minor); | 963 | acm_tty_unregister(acm); |
958 | acm_table[acm->minor] = NULL; | ||
959 | usb_free_urb(acm->ctrlurb); | ||
960 | usb_free_urb(acm->readurb); | ||
961 | usb_free_urb(acm->writeurb); | ||
962 | kfree(acm); | ||
963 | up(&open_sem); | 964 | up(&open_sem); |
964 | return; | 965 | return; |
965 | } | 966 | } |
diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c index b7827df21f48..fc15b4acc8af 100644 --- a/drivers/usb/core/buffer.c +++ b/drivers/usb/core/buffer.c | |||
@@ -106,7 +106,7 @@ void hcd_buffer_destroy (struct usb_hcd *hcd) | |||
106 | void *hcd_buffer_alloc ( | 106 | void *hcd_buffer_alloc ( |
107 | struct usb_bus *bus, | 107 | struct usb_bus *bus, |
108 | size_t size, | 108 | size_t size, |
109 | int mem_flags, | 109 | unsigned mem_flags, |
110 | dma_addr_t *dma | 110 | dma_addr_t *dma |
111 | ) | 111 | ) |
112 | { | 112 | { |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 71b4a8d66318..fc056062c960 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -380,6 +380,7 @@ int usb_hcd_pci_resume (struct pci_dev *dev) | |||
380 | usb_hc_died (hcd); | 380 | usb_hc_died (hcd); |
381 | } | 381 | } |
382 | 382 | ||
383 | pci_enable_device(dev); | ||
383 | return retval; | 384 | return retval; |
384 | } | 385 | } |
385 | EXPORT_SYMBOL (usb_hcd_pci_resume); | 386 | EXPORT_SYMBOL (usb_hcd_pci_resume); |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 83e732a0d64a..8616356f55e8 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1112,7 +1112,7 @@ static void urb_unlink (struct urb *urb) | |||
1112 | * expects usb_submit_urb() to have sanity checked and conditioned all | 1112 | * expects usb_submit_urb() to have sanity checked and conditioned all |
1113 | * inputs in the urb | 1113 | * inputs in the urb |
1114 | */ | 1114 | */ |
1115 | static int hcd_submit_urb (struct urb *urb, int mem_flags) | 1115 | static int hcd_submit_urb (struct urb *urb, unsigned mem_flags) |
1116 | { | 1116 | { |
1117 | int status; | 1117 | int status; |
1118 | struct usb_hcd *hcd = urb->dev->bus->hcpriv; | 1118 | struct usb_hcd *hcd = urb->dev->bus->hcpriv; |
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index 8dc13cde2f73..67db4a999b93 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
@@ -142,12 +142,12 @@ struct hcd_timeout { /* timeouts we allocate */ | |||
142 | 142 | ||
143 | struct usb_operations { | 143 | struct usb_operations { |
144 | int (*get_frame_number) (struct usb_device *usb_dev); | 144 | int (*get_frame_number) (struct usb_device *usb_dev); |
145 | int (*submit_urb) (struct urb *urb, int mem_flags); | 145 | int (*submit_urb) (struct urb *urb, unsigned mem_flags); |
146 | int (*unlink_urb) (struct urb *urb, int status); | 146 | int (*unlink_urb) (struct urb *urb, int status); |
147 | 147 | ||
148 | /* allocate dma-consistent buffer for URB_DMA_NOMAPPING */ | 148 | /* allocate dma-consistent buffer for URB_DMA_NOMAPPING */ |
149 | void *(*buffer_alloc)(struct usb_bus *bus, size_t size, | 149 | void *(*buffer_alloc)(struct usb_bus *bus, size_t size, |
150 | int mem_flags, | 150 | unsigned mem_flags, |
151 | dma_addr_t *dma); | 151 | dma_addr_t *dma); |
152 | void (*buffer_free)(struct usb_bus *bus, size_t size, | 152 | void (*buffer_free)(struct usb_bus *bus, size_t size, |
153 | void *addr, dma_addr_t dma); | 153 | void *addr, dma_addr_t dma); |
@@ -200,7 +200,7 @@ struct hc_driver { | |||
200 | int (*urb_enqueue) (struct usb_hcd *hcd, | 200 | int (*urb_enqueue) (struct usb_hcd *hcd, |
201 | struct usb_host_endpoint *ep, | 201 | struct usb_host_endpoint *ep, |
202 | struct urb *urb, | 202 | struct urb *urb, |
203 | int mem_flags); | 203 | unsigned mem_flags); |
204 | int (*urb_dequeue) (struct usb_hcd *hcd, struct urb *urb); | 204 | int (*urb_dequeue) (struct usb_hcd *hcd, struct urb *urb); |
205 | 205 | ||
206 | /* hw synch, freeing endpoint resources that urb_dequeue can't */ | 206 | /* hw synch, freeing endpoint resources that urb_dequeue can't */ |
@@ -247,7 +247,7 @@ int hcd_buffer_create (struct usb_hcd *hcd); | |||
247 | void hcd_buffer_destroy (struct usb_hcd *hcd); | 247 | void hcd_buffer_destroy (struct usb_hcd *hcd); |
248 | 248 | ||
249 | void *hcd_buffer_alloc (struct usb_bus *bus, size_t size, | 249 | void *hcd_buffer_alloc (struct usb_bus *bus, size_t size, |
250 | int mem_flags, dma_addr_t *dma); | 250 | unsigned mem_flags, dma_addr_t *dma); |
251 | void hcd_buffer_free (struct usb_bus *bus, size_t size, | 251 | void hcd_buffer_free (struct usb_bus *bus, size_t size, |
252 | void *addr, dma_addr_t dma); | 252 | void *addr, dma_addr_t dma); |
253 | 253 | ||
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 32ff32181852..c3e46d24a37e 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/ioctl.h> | 26 | #include <linux/ioctl.h> |
27 | #include <linux/usb.h> | 27 | #include <linux/usb.h> |
28 | #include <linux/usbdevice_fs.h> | 28 | #include <linux/usbdevice_fs.h> |
29 | #include <linux/kthread.h> | ||
29 | 30 | ||
30 | #include <asm/semaphore.h> | 31 | #include <asm/semaphore.h> |
31 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
@@ -47,8 +48,7 @@ static LIST_HEAD(hub_event_list); /* List of hubs needing servicing */ | |||
47 | /* Wakes up khubd */ | 48 | /* Wakes up khubd */ |
48 | static DECLARE_WAIT_QUEUE_HEAD(khubd_wait); | 49 | static DECLARE_WAIT_QUEUE_HEAD(khubd_wait); |
49 | 50 | ||
50 | static pid_t khubd_pid = 0; /* PID of khubd */ | 51 | static struct task_struct *khubd_task; |
51 | static DECLARE_COMPLETION(khubd_exited); | ||
52 | 52 | ||
53 | /* cycle leds on hubs that aren't blinking for attention */ | 53 | /* cycle leds on hubs that aren't blinking for attention */ |
54 | static int blinkenlights = 0; | 54 | static int blinkenlights = 0; |
@@ -2807,23 +2807,16 @@ loop: | |||
2807 | 2807 | ||
2808 | static int hub_thread(void *__unused) | 2808 | static int hub_thread(void *__unused) |
2809 | { | 2809 | { |
2810 | /* | ||
2811 | * This thread doesn't need any user-level access, | ||
2812 | * so get rid of all our resources | ||
2813 | */ | ||
2814 | |||
2815 | daemonize("khubd"); | ||
2816 | allow_signal(SIGKILL); | ||
2817 | |||
2818 | /* Send me a signal to get me die (for debugging) */ | ||
2819 | do { | 2810 | do { |
2820 | hub_events(); | 2811 | hub_events(); |
2821 | wait_event_interruptible(khubd_wait, !list_empty(&hub_event_list)); | 2812 | wait_event_interruptible(khubd_wait, |
2813 | !list_empty(&hub_event_list) || | ||
2814 | kthread_should_stop()); | ||
2822 | try_to_freeze(); | 2815 | try_to_freeze(); |
2823 | } while (!signal_pending(current)); | 2816 | } while (!kthread_should_stop() || !list_empty(&hub_event_list)); |
2824 | 2817 | ||
2825 | pr_debug ("%s: khubd exiting\n", usbcore_name); | 2818 | pr_debug("%s: khubd exiting\n", usbcore_name); |
2826 | complete_and_exit(&khubd_exited, 0); | 2819 | return 0; |
2827 | } | 2820 | } |
2828 | 2821 | ||
2829 | static struct usb_device_id hub_id_table [] = { | 2822 | static struct usb_device_id hub_id_table [] = { |
@@ -2849,20 +2842,15 @@ static struct usb_driver hub_driver = { | |||
2849 | 2842 | ||
2850 | int usb_hub_init(void) | 2843 | int usb_hub_init(void) |
2851 | { | 2844 | { |
2852 | pid_t pid; | ||
2853 | |||
2854 | if (usb_register(&hub_driver) < 0) { | 2845 | if (usb_register(&hub_driver) < 0) { |
2855 | printk(KERN_ERR "%s: can't register hub driver\n", | 2846 | printk(KERN_ERR "%s: can't register hub driver\n", |
2856 | usbcore_name); | 2847 | usbcore_name); |
2857 | return -1; | 2848 | return -1; |
2858 | } | 2849 | } |
2859 | 2850 | ||
2860 | pid = kernel_thread(hub_thread, NULL, CLONE_KERNEL); | 2851 | khubd_task = kthread_run(hub_thread, NULL, "khubd"); |
2861 | if (pid >= 0) { | 2852 | if (!IS_ERR(khubd_task)) |
2862 | khubd_pid = pid; | ||
2863 | |||
2864 | return 0; | 2853 | return 0; |
2865 | } | ||
2866 | 2854 | ||
2867 | /* Fall through if kernel_thread failed */ | 2855 | /* Fall through if kernel_thread failed */ |
2868 | usb_deregister(&hub_driver); | 2856 | usb_deregister(&hub_driver); |
@@ -2873,12 +2861,7 @@ int usb_hub_init(void) | |||
2873 | 2861 | ||
2874 | void usb_hub_cleanup(void) | 2862 | void usb_hub_cleanup(void) |
2875 | { | 2863 | { |
2876 | int ret; | 2864 | kthread_stop(khubd_task); |
2877 | |||
2878 | /* Kill the thread */ | ||
2879 | ret = kill_proc(khubd_pid, SIGKILL, 1); | ||
2880 | |||
2881 | wait_for_completion(&khubd_exited); | ||
2882 | 2865 | ||
2883 | /* | 2866 | /* |
2884 | * Hub resources are freed for us by usb_deregister. It calls | 2867 | * Hub resources are freed for us by usb_deregister. It calls |
@@ -2890,7 +2873,6 @@ void usb_hub_cleanup(void) | |||
2890 | usb_deregister(&hub_driver); | 2873 | usb_deregister(&hub_driver); |
2891 | } /* usb_hub_cleanup() */ | 2874 | } /* usb_hub_cleanup() */ |
2892 | 2875 | ||
2893 | |||
2894 | static int config_descriptors_changed(struct usb_device *udev) | 2876 | static int config_descriptors_changed(struct usb_device *udev) |
2895 | { | 2877 | { |
2896 | unsigned index; | 2878 | unsigned index; |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index f50aaf25c98e..a428ef479bd7 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -320,7 +320,7 @@ int usb_sg_init ( | |||
320 | struct scatterlist *sg, | 320 | struct scatterlist *sg, |
321 | int nents, | 321 | int nents, |
322 | size_t length, | 322 | size_t length, |
323 | int mem_flags | 323 | unsigned mem_flags |
324 | ) | 324 | ) |
325 | { | 325 | { |
326 | int i; | 326 | int i; |
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index 740cb4c668df..00297f113849 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c | |||
@@ -196,6 +196,7 @@ usb_descriptor_attr (bDeviceClass, "%02x\n") | |||
196 | usb_descriptor_attr (bDeviceSubClass, "%02x\n") | 196 | usb_descriptor_attr (bDeviceSubClass, "%02x\n") |
197 | usb_descriptor_attr (bDeviceProtocol, "%02x\n") | 197 | usb_descriptor_attr (bDeviceProtocol, "%02x\n") |
198 | usb_descriptor_attr (bNumConfigurations, "%d\n") | 198 | usb_descriptor_attr (bNumConfigurations, "%d\n") |
199 | usb_descriptor_attr (bMaxPacketSize0, "%d\n") | ||
199 | 200 | ||
200 | static struct attribute *dev_attrs[] = { | 201 | static struct attribute *dev_attrs[] = { |
201 | /* current configuration's attributes */ | 202 | /* current configuration's attributes */ |
@@ -211,6 +212,7 @@ static struct attribute *dev_attrs[] = { | |||
211 | &dev_attr_bDeviceSubClass.attr, | 212 | &dev_attr_bDeviceSubClass.attr, |
212 | &dev_attr_bDeviceProtocol.attr, | 213 | &dev_attr_bDeviceProtocol.attr, |
213 | &dev_attr_bNumConfigurations.attr, | 214 | &dev_attr_bNumConfigurations.attr, |
215 | &dev_attr_bMaxPacketSize0.attr, | ||
214 | &dev_attr_speed.attr, | 216 | &dev_attr_speed.attr, |
215 | &dev_attr_devnum.attr, | 217 | &dev_attr_devnum.attr, |
216 | &dev_attr_version.attr, | 218 | &dev_attr_version.attr, |
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index 0faf18d511de..c0feee25ff0a 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
@@ -60,7 +60,7 @@ void usb_init_urb(struct urb *urb) | |||
60 | * | 60 | * |
61 | * The driver must call usb_free_urb() when it is finished with the urb. | 61 | * The driver must call usb_free_urb() when it is finished with the urb. |
62 | */ | 62 | */ |
63 | struct urb *usb_alloc_urb(int iso_packets, int mem_flags) | 63 | struct urb *usb_alloc_urb(int iso_packets, unsigned mem_flags) |
64 | { | 64 | { |
65 | struct urb *urb; | 65 | struct urb *urb; |
66 | 66 | ||
@@ -224,7 +224,7 @@ struct urb * usb_get_urb(struct urb *urb) | |||
224 | * GFP_NOIO, unless b) or c) apply | 224 | * GFP_NOIO, unless b) or c) apply |
225 | * | 225 | * |
226 | */ | 226 | */ |
227 | int usb_submit_urb(struct urb *urb, int mem_flags) | 227 | int usb_submit_urb(struct urb *urb, unsigned mem_flags) |
228 | { | 228 | { |
229 | int pipe, temp, max; | 229 | int pipe, temp, max; |
230 | struct usb_device *dev; | 230 | struct usb_device *dev; |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index a3c42203213a..99c85d2f92da 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -1129,7 +1129,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size, | |||
1129 | void *usb_buffer_alloc ( | 1129 | void *usb_buffer_alloc ( |
1130 | struct usb_device *dev, | 1130 | struct usb_device *dev, |
1131 | size_t size, | 1131 | size_t size, |
1132 | int mem_flags, | 1132 | unsigned mem_flags, |
1133 | dma_addr_t *dma | 1133 | dma_addr_t *dma |
1134 | ) | 1134 | ) |
1135 | { | 1135 | { |
@@ -1532,6 +1532,9 @@ EXPORT_SYMBOL(usb_register); | |||
1532 | EXPORT_SYMBOL(usb_deregister); | 1532 | EXPORT_SYMBOL(usb_deregister); |
1533 | EXPORT_SYMBOL(usb_disabled); | 1533 | EXPORT_SYMBOL(usb_disabled); |
1534 | 1534 | ||
1535 | EXPORT_SYMBOL_GPL(usb_get_intf); | ||
1536 | EXPORT_SYMBOL_GPL(usb_put_intf); | ||
1537 | |||
1535 | EXPORT_SYMBOL(usb_alloc_dev); | 1538 | EXPORT_SYMBOL(usb_alloc_dev); |
1536 | EXPORT_SYMBOL(usb_put_dev); | 1539 | EXPORT_SYMBOL(usb_put_dev); |
1537 | EXPORT_SYMBOL(usb_get_dev); | 1540 | EXPORT_SYMBOL(usb_get_dev); |
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 4d692670f288..583db7c38cf1 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
@@ -470,7 +470,7 @@ static int dummy_disable (struct usb_ep *_ep) | |||
470 | } | 470 | } |
471 | 471 | ||
472 | static struct usb_request * | 472 | static struct usb_request * |
473 | dummy_alloc_request (struct usb_ep *_ep, int mem_flags) | 473 | dummy_alloc_request (struct usb_ep *_ep, unsigned mem_flags) |
474 | { | 474 | { |
475 | struct dummy_ep *ep; | 475 | struct dummy_ep *ep; |
476 | struct dummy_request *req; | 476 | struct dummy_request *req; |
@@ -507,7 +507,7 @@ dummy_alloc_buffer ( | |||
507 | struct usb_ep *_ep, | 507 | struct usb_ep *_ep, |
508 | unsigned bytes, | 508 | unsigned bytes, |
509 | dma_addr_t *dma, | 509 | dma_addr_t *dma, |
510 | int mem_flags | 510 | unsigned mem_flags |
511 | ) { | 511 | ) { |
512 | char *retval; | 512 | char *retval; |
513 | struct dummy_ep *ep; | 513 | struct dummy_ep *ep; |
@@ -540,7 +540,8 @@ fifo_complete (struct usb_ep *ep, struct usb_request *req) | |||
540 | } | 540 | } |
541 | 541 | ||
542 | static int | 542 | static int |
543 | dummy_queue (struct usb_ep *_ep, struct usb_request *_req, int mem_flags) | 543 | dummy_queue (struct usb_ep *_ep, struct usb_request *_req, |
544 | unsigned mem_flags) | ||
544 | { | 545 | { |
545 | struct dummy_ep *ep; | 546 | struct dummy_ep *ep; |
546 | struct dummy_request *req; | 547 | struct dummy_request *req; |
@@ -998,7 +999,7 @@ static int dummy_urb_enqueue ( | |||
998 | struct usb_hcd *hcd, | 999 | struct usb_hcd *hcd, |
999 | struct usb_host_endpoint *ep, | 1000 | struct usb_host_endpoint *ep, |
1000 | struct urb *urb, | 1001 | struct urb *urb, |
1001 | int mem_flags | 1002 | unsigned mem_flags |
1002 | ) { | 1003 | ) { |
1003 | struct dummy *dum; | 1004 | struct dummy *dum; |
1004 | struct urbp *urbp; | 1005 | struct urbp *urbp; |
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 5bb53ae88969..8509e955007d 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
@@ -945,15 +945,16 @@ config_buf (enum usb_device_speed speed, | |||
945 | 945 | ||
946 | /*-------------------------------------------------------------------------*/ | 946 | /*-------------------------------------------------------------------------*/ |
947 | 947 | ||
948 | static void eth_start (struct eth_dev *dev, int gfp_flags); | 948 | static void eth_start (struct eth_dev *dev, unsigned gfp_flags); |
949 | static int alloc_requests (struct eth_dev *dev, unsigned n, int gfp_flags); | 949 | static int alloc_requests (struct eth_dev *dev, unsigned n, unsigned gfp_flags); |
950 | 950 | ||
951 | static int | 951 | static int |
952 | set_ether_config (struct eth_dev *dev, int gfp_flags) | 952 | set_ether_config (struct eth_dev *dev, unsigned gfp_flags) |
953 | { | 953 | { |
954 | int result = 0; | 954 | int result = 0; |
955 | struct usb_gadget *gadget = dev->gadget; | 955 | struct usb_gadget *gadget = dev->gadget; |
956 | 956 | ||
957 | #if defined(DEV_CONFIG_CDC) || defined(CONFIG_USB_ETH_RNDIS) | ||
957 | /* status endpoint used for RNDIS and (optionally) CDC */ | 958 | /* status endpoint used for RNDIS and (optionally) CDC */ |
958 | if (!subset_active(dev) && dev->status_ep) { | 959 | if (!subset_active(dev) && dev->status_ep) { |
959 | dev->status = ep_desc (gadget, &hs_status_desc, | 960 | dev->status = ep_desc (gadget, &hs_status_desc, |
@@ -967,6 +968,7 @@ set_ether_config (struct eth_dev *dev, int gfp_flags) | |||
967 | goto done; | 968 | goto done; |
968 | } | 969 | } |
969 | } | 970 | } |
971 | #endif | ||
970 | 972 | ||
971 | dev->in = ep_desc (dev->gadget, &hs_source_desc, &fs_source_desc); | 973 | dev->in = ep_desc (dev->gadget, &hs_source_desc, &fs_source_desc); |
972 | dev->in_ep->driver_data = dev; | 974 | dev->in_ep->driver_data = dev; |
@@ -1079,7 +1081,7 @@ static void eth_reset_config (struct eth_dev *dev) | |||
1079 | * that returns config descriptors, and altsetting code. | 1081 | * that returns config descriptors, and altsetting code. |
1080 | */ | 1082 | */ |
1081 | static int | 1083 | static int |
1082 | eth_set_config (struct eth_dev *dev, unsigned number, int gfp_flags) | 1084 | eth_set_config (struct eth_dev *dev, unsigned number, unsigned gfp_flags) |
1083 | { | 1085 | { |
1084 | int result = 0; | 1086 | int result = 0; |
1085 | struct usb_gadget *gadget = dev->gadget; | 1087 | struct usb_gadget *gadget = dev->gadget; |
@@ -1596,7 +1598,7 @@ static void defer_kevent (struct eth_dev *dev, int flag) | |||
1596 | static void rx_complete (struct usb_ep *ep, struct usb_request *req); | 1598 | static void rx_complete (struct usb_ep *ep, struct usb_request *req); |
1597 | 1599 | ||
1598 | static int | 1600 | static int |
1599 | rx_submit (struct eth_dev *dev, struct usb_request *req, int gfp_flags) | 1601 | rx_submit (struct eth_dev *dev, struct usb_request *req, unsigned gfp_flags) |
1600 | { | 1602 | { |
1601 | struct sk_buff *skb; | 1603 | struct sk_buff *skb; |
1602 | int retval = -ENOMEM; | 1604 | int retval = -ENOMEM; |
@@ -1722,7 +1724,7 @@ clean: | |||
1722 | } | 1724 | } |
1723 | 1725 | ||
1724 | static int prealloc (struct list_head *list, struct usb_ep *ep, | 1726 | static int prealloc (struct list_head *list, struct usb_ep *ep, |
1725 | unsigned n, int gfp_flags) | 1727 | unsigned n, unsigned gfp_flags) |
1726 | { | 1728 | { |
1727 | unsigned i; | 1729 | unsigned i; |
1728 | struct usb_request *req; | 1730 | struct usb_request *req; |
@@ -1761,7 +1763,7 @@ extra: | |||
1761 | return 0; | 1763 | return 0; |
1762 | } | 1764 | } |
1763 | 1765 | ||
1764 | static int alloc_requests (struct eth_dev *dev, unsigned n, int gfp_flags) | 1766 | static int alloc_requests (struct eth_dev *dev, unsigned n, unsigned gfp_flags) |
1765 | { | 1767 | { |
1766 | int status; | 1768 | int status; |
1767 | 1769 | ||
@@ -1777,7 +1779,7 @@ fail: | |||
1777 | return status; | 1779 | return status; |
1778 | } | 1780 | } |
1779 | 1781 | ||
1780 | static void rx_fill (struct eth_dev *dev, int gfp_flags) | 1782 | static void rx_fill (struct eth_dev *dev, unsigned gfp_flags) |
1781 | { | 1783 | { |
1782 | struct usb_request *req; | 1784 | struct usb_request *req; |
1783 | unsigned long flags; | 1785 | unsigned long flags; |
@@ -2022,7 +2024,7 @@ static int rndis_control_ack (struct net_device *net) | |||
2022 | 2024 | ||
2023 | #endif /* RNDIS */ | 2025 | #endif /* RNDIS */ |
2024 | 2026 | ||
2025 | static void eth_start (struct eth_dev *dev, int gfp_flags) | 2027 | static void eth_start (struct eth_dev *dev, unsigned gfp_flags) |
2026 | { | 2028 | { |
2027 | DEBUG (dev, "%s\n", __FUNCTION__); | 2029 | DEBUG (dev, "%s\n", __FUNCTION__); |
2028 | 2030 | ||
@@ -2428,7 +2430,7 @@ autoconf_fail: | |||
2428 | dev->req->complete = eth_setup_complete; | 2430 | dev->req->complete = eth_setup_complete; |
2429 | 2431 | ||
2430 | /* ... and maybe likewise for status transfer */ | 2432 | /* ... and maybe likewise for status transfer */ |
2431 | #ifdef DEV_CONFIG_CDC | 2433 | #if defined(DEV_CONFIG_CDC) || defined(CONFIG_USB_ETH_RNDIS) |
2432 | if (dev->status_ep) { | 2434 | if (dev->status_ep) { |
2433 | dev->stat_req = eth_req_alloc (dev->status_ep, | 2435 | dev->stat_req = eth_req_alloc (dev->status_ep, |
2434 | STATUS_BYTECOUNT, GFP_KERNEL); | 2436 | STATUS_BYTECOUNT, GFP_KERNEL); |
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c index ed773a9111de..eaab26f4ed37 100644 --- a/drivers/usb/gadget/goku_udc.c +++ b/drivers/usb/gadget/goku_udc.c | |||
@@ -269,7 +269,7 @@ static int goku_ep_disable(struct usb_ep *_ep) | |||
269 | /*-------------------------------------------------------------------------*/ | 269 | /*-------------------------------------------------------------------------*/ |
270 | 270 | ||
271 | static struct usb_request * | 271 | static struct usb_request * |
272 | goku_alloc_request(struct usb_ep *_ep, int gfp_flags) | 272 | goku_alloc_request(struct usb_ep *_ep, unsigned gfp_flags) |
273 | { | 273 | { |
274 | struct goku_request *req; | 274 | struct goku_request *req; |
275 | 275 | ||
@@ -327,7 +327,7 @@ goku_free_request(struct usb_ep *_ep, struct usb_request *_req) | |||
327 | */ | 327 | */ |
328 | static void * | 328 | static void * |
329 | goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes, | 329 | goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes, |
330 | dma_addr_t *dma, int gfp_flags) | 330 | dma_addr_t *dma, unsigned gfp_flags) |
331 | { | 331 | { |
332 | void *retval; | 332 | void *retval; |
333 | struct goku_ep *ep; | 333 | struct goku_ep *ep; |
@@ -789,7 +789,7 @@ finished: | |||
789 | /*-------------------------------------------------------------------------*/ | 789 | /*-------------------------------------------------------------------------*/ |
790 | 790 | ||
791 | static int | 791 | static int |
792 | goku_queue(struct usb_ep *_ep, struct usb_request *_req, int gfp_flags) | 792 | goku_queue(struct usb_ep *_ep, struct usb_request *_req, unsigned gfp_flags) |
793 | { | 793 | { |
794 | struct goku_request *req; | 794 | struct goku_request *req; |
795 | struct goku_ep *ep; | 795 | struct goku_ep *ep; |
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c index df75ab65a5ec..4842577789c9 100644 --- a/drivers/usb/gadget/lh7a40x_udc.c +++ b/drivers/usb/gadget/lh7a40x_udc.c | |||
@@ -1106,7 +1106,7 @@ static int lh7a40x_ep_disable(struct usb_ep *_ep) | |||
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | static struct usb_request *lh7a40x_alloc_request(struct usb_ep *ep, | 1108 | static struct usb_request *lh7a40x_alloc_request(struct usb_ep *ep, |
1109 | int gfp_flags) | 1109 | unsigned gfp_flags) |
1110 | { | 1110 | { |
1111 | struct lh7a40x_request *req; | 1111 | struct lh7a40x_request *req; |
1112 | 1112 | ||
@@ -1134,7 +1134,7 @@ static void lh7a40x_free_request(struct usb_ep *ep, struct usb_request *_req) | |||
1134 | } | 1134 | } |
1135 | 1135 | ||
1136 | static void *lh7a40x_alloc_buffer(struct usb_ep *ep, unsigned bytes, | 1136 | static void *lh7a40x_alloc_buffer(struct usb_ep *ep, unsigned bytes, |
1137 | dma_addr_t * dma, int gfp_flags) | 1137 | dma_addr_t * dma, unsigned gfp_flags) |
1138 | { | 1138 | { |
1139 | char *retval; | 1139 | char *retval; |
1140 | 1140 | ||
@@ -1158,7 +1158,7 @@ static void lh7a40x_free_buffer(struct usb_ep *ep, void *buf, dma_addr_t dma, | |||
1158 | * NOTE: Sets INDEX register | 1158 | * NOTE: Sets INDEX register |
1159 | */ | 1159 | */ |
1160 | static int lh7a40x_queue(struct usb_ep *_ep, struct usb_request *_req, | 1160 | static int lh7a40x_queue(struct usb_ep *_ep, struct usb_request *_req, |
1161 | int gfp_flags) | 1161 | unsigned gfp_flags) |
1162 | { | 1162 | { |
1163 | struct lh7a40x_request *req; | 1163 | struct lh7a40x_request *req; |
1164 | struct lh7a40x_ep *ep; | 1164 | struct lh7a40x_ep *ep; |
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index 13a3dbc9949b..477fab2e74d1 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c | |||
@@ -376,7 +376,7 @@ static int net2280_disable (struct usb_ep *_ep) | |||
376 | /*-------------------------------------------------------------------------*/ | 376 | /*-------------------------------------------------------------------------*/ |
377 | 377 | ||
378 | static struct usb_request * | 378 | static struct usb_request * |
379 | net2280_alloc_request (struct usb_ep *_ep, int gfp_flags) | 379 | net2280_alloc_request (struct usb_ep *_ep, unsigned gfp_flags) |
380 | { | 380 | { |
381 | struct net2280_ep *ep; | 381 | struct net2280_ep *ep; |
382 | struct net2280_request *req; | 382 | struct net2280_request *req; |
@@ -463,7 +463,7 @@ net2280_alloc_buffer ( | |||
463 | struct usb_ep *_ep, | 463 | struct usb_ep *_ep, |
464 | unsigned bytes, | 464 | unsigned bytes, |
465 | dma_addr_t *dma, | 465 | dma_addr_t *dma, |
466 | int gfp_flags | 466 | unsigned gfp_flags |
467 | ) | 467 | ) |
468 | { | 468 | { |
469 | void *retval; | 469 | void *retval; |
@@ -897,7 +897,7 @@ done (struct net2280_ep *ep, struct net2280_request *req, int status) | |||
897 | /*-------------------------------------------------------------------------*/ | 897 | /*-------------------------------------------------------------------------*/ |
898 | 898 | ||
899 | static int | 899 | static int |
900 | net2280_queue (struct usb_ep *_ep, struct usb_request *_req, int gfp_flags) | 900 | net2280_queue (struct usb_ep *_ep, struct usb_request *_req, unsigned gfp_flags) |
901 | { | 901 | { |
902 | struct net2280_request *req; | 902 | struct net2280_request *req; |
903 | struct net2280_ep *ep; | 903 | struct net2280_ep *ep; |
@@ -1490,7 +1490,7 @@ show_registers (struct device *_dev, struct device_attribute *attr, char *buf) | |||
1490 | unsigned long flags; | 1490 | unsigned long flags; |
1491 | int i; | 1491 | int i; |
1492 | u32 t1, t2; | 1492 | u32 t1, t2; |
1493 | char *s; | 1493 | const char *s; |
1494 | 1494 | ||
1495 | dev = dev_get_drvdata (_dev); | 1495 | dev = dev_get_drvdata (_dev); |
1496 | next = buf; | 1496 | next = buf; |
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index a2b812af6e66..ff5533e69560 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
@@ -269,7 +269,7 @@ static int omap_ep_disable(struct usb_ep *_ep) | |||
269 | /*-------------------------------------------------------------------------*/ | 269 | /*-------------------------------------------------------------------------*/ |
270 | 270 | ||
271 | static struct usb_request * | 271 | static struct usb_request * |
272 | omap_alloc_request(struct usb_ep *ep, int gfp_flags) | 272 | omap_alloc_request(struct usb_ep *ep, unsigned gfp_flags) |
273 | { | 273 | { |
274 | struct omap_req *req; | 274 | struct omap_req *req; |
275 | 275 | ||
@@ -298,7 +298,7 @@ omap_alloc_buffer( | |||
298 | struct usb_ep *_ep, | 298 | struct usb_ep *_ep, |
299 | unsigned bytes, | 299 | unsigned bytes, |
300 | dma_addr_t *dma, | 300 | dma_addr_t *dma, |
301 | int gfp_flags | 301 | unsigned gfp_flags |
302 | ) | 302 | ) |
303 | { | 303 | { |
304 | void *retval; | 304 | void *retval; |
@@ -937,7 +937,7 @@ static void dma_channel_release(struct omap_ep *ep) | |||
937 | /*-------------------------------------------------------------------------*/ | 937 | /*-------------------------------------------------------------------------*/ |
938 | 938 | ||
939 | static int | 939 | static int |
940 | omap_ep_queue(struct usb_ep *_ep, struct usb_request *_req, int gfp_flags) | 940 | omap_ep_queue(struct usb_ep *_ep, struct usb_request *_req, unsigned gfp_flags) |
941 | { | 941 | { |
942 | struct omap_ep *ep = container_of(_ep, struct omap_ep, ep); | 942 | struct omap_ep *ep = container_of(_ep, struct omap_ep, ep); |
943 | struct omap_req *req = container_of(_req, struct omap_req, req); | 943 | struct omap_req *req = container_of(_req, struct omap_req, req); |
@@ -2908,6 +2908,7 @@ static int __exit omap_udc_remove(struct device *dev) | |||
2908 | * make host resumes and VBUS detection trigger OMAP wakeup events; that | 2908 | * make host resumes and VBUS detection trigger OMAP wakeup events; that |
2909 | * may involve talking to an external transceiver (e.g. isp1301). | 2909 | * may involve talking to an external transceiver (e.g. isp1301). |
2910 | */ | 2910 | */ |
2911 | |||
2911 | static int omap_udc_suspend(struct device *dev, pm_message_t message, u32 level) | 2912 | static int omap_udc_suspend(struct device *dev, pm_message_t message, u32 level) |
2912 | { | 2913 | { |
2913 | u32 devstat; | 2914 | u32 devstat; |
@@ -2936,8 +2937,6 @@ static int omap_udc_resume(struct device *dev, u32 level) | |||
2936 | return 0; | 2937 | return 0; |
2937 | 2938 | ||
2938 | DBG("resume + wakeup/SRP\n"); | 2939 | DBG("resume + wakeup/SRP\n"); |
2939 | udc->gadget.dev.parent->power.power_state = PMSG_ON; | ||
2940 | udc->gadget.dev.power.power_state = PMSG_ON; | ||
2941 | omap_pullup(&udc->gadget, 1); | 2940 | omap_pullup(&udc->gadget, 1); |
2942 | 2941 | ||
2943 | /* maybe the host would enumerate us if we nudged it */ | 2942 | /* maybe the host would enumerate us if we nudged it */ |
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c index 6a0b957af335..1507738337c4 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c | |||
@@ -332,7 +332,7 @@ static int pxa2xx_ep_disable (struct usb_ep *_ep) | |||
332 | * pxa2xx_ep_alloc_request - allocate a request data structure | 332 | * pxa2xx_ep_alloc_request - allocate a request data structure |
333 | */ | 333 | */ |
334 | static struct usb_request * | 334 | static struct usb_request * |
335 | pxa2xx_ep_alloc_request (struct usb_ep *_ep, int gfp_flags) | 335 | pxa2xx_ep_alloc_request (struct usb_ep *_ep, unsigned gfp_flags) |
336 | { | 336 | { |
337 | struct pxa2xx_request *req; | 337 | struct pxa2xx_request *req; |
338 | 338 | ||
@@ -367,7 +367,7 @@ pxa2xx_ep_free_request (struct usb_ep *_ep, struct usb_request *_req) | |||
367 | */ | 367 | */ |
368 | static void * | 368 | static void * |
369 | pxa2xx_ep_alloc_buffer(struct usb_ep *_ep, unsigned bytes, | 369 | pxa2xx_ep_alloc_buffer(struct usb_ep *_ep, unsigned bytes, |
370 | dma_addr_t *dma, int gfp_flags) | 370 | dma_addr_t *dma, unsigned gfp_flags) |
371 | { | 371 | { |
372 | char *retval; | 372 | char *retval; |
373 | 373 | ||
@@ -874,7 +874,7 @@ done: | |||
874 | /*-------------------------------------------------------------------------*/ | 874 | /*-------------------------------------------------------------------------*/ |
875 | 875 | ||
876 | static int | 876 | static int |
877 | pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, int gfp_flags) | 877 | pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, unsigned gfp_flags) |
878 | { | 878 | { |
879 | struct pxa2xx_request *req; | 879 | struct pxa2xx_request *req; |
880 | struct pxa2xx_ep *ep; | 880 | struct pxa2xx_ep *ep; |
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index a6e035e24479..bb9b2d94eed5 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c | |||
@@ -612,7 +612,7 @@ static void source_sink_complete (struct usb_ep *ep, struct usb_request *req) | |||
612 | } | 612 | } |
613 | 613 | ||
614 | static struct usb_request * | 614 | static struct usb_request * |
615 | source_sink_start_ep (struct usb_ep *ep, int gfp_flags) | 615 | source_sink_start_ep (struct usb_ep *ep, unsigned gfp_flags) |
616 | { | 616 | { |
617 | struct usb_request *req; | 617 | struct usb_request *req; |
618 | int status; | 618 | int status; |
@@ -640,7 +640,7 @@ source_sink_start_ep (struct usb_ep *ep, int gfp_flags) | |||
640 | } | 640 | } |
641 | 641 | ||
642 | static int | 642 | static int |
643 | set_source_sink_config (struct zero_dev *dev, int gfp_flags) | 643 | set_source_sink_config (struct zero_dev *dev, unsigned gfp_flags) |
644 | { | 644 | { |
645 | int result = 0; | 645 | int result = 0; |
646 | struct usb_ep *ep; | 646 | struct usb_ep *ep; |
@@ -744,7 +744,7 @@ static void loopback_complete (struct usb_ep *ep, struct usb_request *req) | |||
744 | } | 744 | } |
745 | 745 | ||
746 | static int | 746 | static int |
747 | set_loopback_config (struct zero_dev *dev, int gfp_flags) | 747 | set_loopback_config (struct zero_dev *dev, unsigned gfp_flags) |
748 | { | 748 | { |
749 | int result = 0; | 749 | int result = 0; |
750 | struct usb_ep *ep; | 750 | struct usb_ep *ep; |
@@ -845,7 +845,7 @@ static void zero_reset_config (struct zero_dev *dev) | |||
845 | * by limiting configuration choices (like the pxa2xx). | 845 | * by limiting configuration choices (like the pxa2xx). |
846 | */ | 846 | */ |
847 | static int | 847 | static int |
848 | zero_set_config (struct zero_dev *dev, unsigned number, int gfp_flags) | 848 | zero_set_config (struct zero_dev *dev, unsigned number, unsigned gfp_flags) |
849 | { | 849 | { |
850 | int result = 0; | 850 | int result = 0; |
851 | struct usb_gadget *gadget = dev->gadget; | 851 | struct usb_gadget *gadget = dev->gadget; |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 35248a37b717..149b13fc0a71 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -960,7 +960,7 @@ static int ehci_urb_enqueue ( | |||
960 | struct usb_hcd *hcd, | 960 | struct usb_hcd *hcd, |
961 | struct usb_host_endpoint *ep, | 961 | struct usb_host_endpoint *ep, |
962 | struct urb *urb, | 962 | struct urb *urb, |
963 | int mem_flags | 963 | unsigned mem_flags |
964 | ) { | 964 | ) { |
965 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 965 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); |
966 | struct list_head qtd_list; | 966 | struct list_head qtd_list; |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 45d89a7083b1..d74b2d68a50e 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -898,7 +898,7 @@ submit_async ( | |||
898 | struct usb_host_endpoint *ep, | 898 | struct usb_host_endpoint *ep, |
899 | struct urb *urb, | 899 | struct urb *urb, |
900 | struct list_head *qtd_list, | 900 | struct list_head *qtd_list, |
901 | int mem_flags | 901 | unsigned mem_flags |
902 | ) { | 902 | ) { |
903 | struct ehci_qtd *qtd; | 903 | struct ehci_qtd *qtd; |
904 | int epnum; | 904 | int epnum; |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index c2104cad4033..9af4f64532a9 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -588,7 +588,7 @@ static int intr_submit ( | |||
588 | struct usb_host_endpoint *ep, | 588 | struct usb_host_endpoint *ep, |
589 | struct urb *urb, | 589 | struct urb *urb, |
590 | struct list_head *qtd_list, | 590 | struct list_head *qtd_list, |
591 | int mem_flags | 591 | unsigned mem_flags |
592 | ) { | 592 | ) { |
593 | unsigned epnum; | 593 | unsigned epnum; |
594 | unsigned long flags; | 594 | unsigned long flags; |
@@ -633,7 +633,7 @@ done: | |||
633 | /* ehci_iso_stream ops work with both ITD and SITD */ | 633 | /* ehci_iso_stream ops work with both ITD and SITD */ |
634 | 634 | ||
635 | static struct ehci_iso_stream * | 635 | static struct ehci_iso_stream * |
636 | iso_stream_alloc (int mem_flags) | 636 | iso_stream_alloc (unsigned mem_flags) |
637 | { | 637 | { |
638 | struct ehci_iso_stream *stream; | 638 | struct ehci_iso_stream *stream; |
639 | 639 | ||
@@ -846,7 +846,7 @@ iso_stream_find (struct ehci_hcd *ehci, struct urb *urb) | |||
846 | /* ehci_iso_sched ops can be ITD-only or SITD-only */ | 846 | /* ehci_iso_sched ops can be ITD-only or SITD-only */ |
847 | 847 | ||
848 | static struct ehci_iso_sched * | 848 | static struct ehci_iso_sched * |
849 | iso_sched_alloc (unsigned packets, int mem_flags) | 849 | iso_sched_alloc (unsigned packets, unsigned mem_flags) |
850 | { | 850 | { |
851 | struct ehci_iso_sched *iso_sched; | 851 | struct ehci_iso_sched *iso_sched; |
852 | int size = sizeof *iso_sched; | 852 | int size = sizeof *iso_sched; |
@@ -919,7 +919,7 @@ itd_urb_transaction ( | |||
919 | struct ehci_iso_stream *stream, | 919 | struct ehci_iso_stream *stream, |
920 | struct ehci_hcd *ehci, | 920 | struct ehci_hcd *ehci, |
921 | struct urb *urb, | 921 | struct urb *urb, |
922 | int mem_flags | 922 | unsigned mem_flags |
923 | ) | 923 | ) |
924 | { | 924 | { |
925 | struct ehci_itd *itd; | 925 | struct ehci_itd *itd; |
@@ -1412,7 +1412,8 @@ itd_complete ( | |||
1412 | 1412 | ||
1413 | /*-------------------------------------------------------------------------*/ | 1413 | /*-------------------------------------------------------------------------*/ |
1414 | 1414 | ||
1415 | static int itd_submit (struct ehci_hcd *ehci, struct urb *urb, int mem_flags) | 1415 | static int itd_submit (struct ehci_hcd *ehci, struct urb *urb, |
1416 | unsigned mem_flags) | ||
1416 | { | 1417 | { |
1417 | int status = -EINVAL; | 1418 | int status = -EINVAL; |
1418 | unsigned long flags; | 1419 | unsigned long flags; |
@@ -1523,7 +1524,7 @@ sitd_urb_transaction ( | |||
1523 | struct ehci_iso_stream *stream, | 1524 | struct ehci_iso_stream *stream, |
1524 | struct ehci_hcd *ehci, | 1525 | struct ehci_hcd *ehci, |
1525 | struct urb *urb, | 1526 | struct urb *urb, |
1526 | int mem_flags | 1527 | unsigned mem_flags |
1527 | ) | 1528 | ) |
1528 | { | 1529 | { |
1529 | struct ehci_sitd *sitd; | 1530 | struct ehci_sitd *sitd; |
@@ -1772,7 +1773,8 @@ sitd_complete ( | |||
1772 | } | 1773 | } |
1773 | 1774 | ||
1774 | 1775 | ||
1775 | static int sitd_submit (struct ehci_hcd *ehci, struct urb *urb, int mem_flags) | 1776 | static int sitd_submit (struct ehci_hcd *ehci, struct urb *urb, |
1777 | unsigned mem_flags) | ||
1776 | { | 1778 | { |
1777 | int status = -EINVAL; | 1779 | int status = -EINVAL; |
1778 | unsigned long flags; | 1780 | unsigned long flags; |
@@ -1822,7 +1824,8 @@ done: | |||
1822 | #else | 1824 | #else |
1823 | 1825 | ||
1824 | static inline int | 1826 | static inline int |
1825 | sitd_submit (struct ehci_hcd *ehci, struct urb *urb, int mem_flags) | 1827 | sitd_submit (struct ehci_hcd *ehci, struct urb *urb, |
1828 | unsigned mem_flags) | ||
1826 | { | 1829 | { |
1827 | ehci_dbg (ehci, "split iso support is disabled\n"); | 1830 | ehci_dbg (ehci, "split iso support is disabled\n"); |
1828 | return -ENOSYS; | 1831 | return -ENOSYS; |
diff --git a/drivers/usb/host/hc_crisv10.c b/drivers/usb/host/hc_crisv10.c index d9883d774d3a..81f8f6b7fdce 100644 --- a/drivers/usb/host/hc_crisv10.c +++ b/drivers/usb/host/hc_crisv10.c | |||
@@ -463,7 +463,8 @@ static void etrax_usb_free_epid(int epid); | |||
463 | 463 | ||
464 | static int etrax_remove_from_sb_list(struct urb *urb); | 464 | static int etrax_remove_from_sb_list(struct urb *urb); |
465 | 465 | ||
466 | static void* etrax_usb_buffer_alloc(struct usb_bus* bus, size_t size, int mem_flags, dma_addr_t *dma); | 466 | static void* etrax_usb_buffer_alloc(struct usb_bus* bus, size_t size, |
467 | unsigned mem_flags, dma_addr_t *dma); | ||
467 | static void etrax_usb_buffer_free(struct usb_bus *bus, size_t size, void *addr, dma_addr_t dma); | 468 | static void etrax_usb_buffer_free(struct usb_bus *bus, size_t size, void *addr, dma_addr_t dma); |
468 | 469 | ||
469 | static void etrax_usb_add_to_bulk_sb_list(struct urb *urb, int epid); | 470 | static void etrax_usb_add_to_bulk_sb_list(struct urb *urb, int epid); |
@@ -476,7 +477,7 @@ static int etrax_usb_submit_ctrl_urb(struct urb *urb); | |||
476 | static int etrax_usb_submit_intr_urb(struct urb *urb); | 477 | static int etrax_usb_submit_intr_urb(struct urb *urb); |
477 | static int etrax_usb_submit_isoc_urb(struct urb *urb); | 478 | static int etrax_usb_submit_isoc_urb(struct urb *urb); |
478 | 479 | ||
479 | static int etrax_usb_submit_urb(struct urb *urb, int mem_flags); | 480 | static int etrax_usb_submit_urb(struct urb *urb, unsigned mem_flags); |
480 | static int etrax_usb_unlink_urb(struct urb *urb, int status); | 481 | static int etrax_usb_unlink_urb(struct urb *urb, int status); |
481 | static int etrax_usb_get_frame_number(struct usb_device *usb_dev); | 482 | static int etrax_usb_get_frame_number(struct usb_device *usb_dev); |
482 | 483 | ||
@@ -1262,7 +1263,7 @@ static int etrax_usb_allocate_epid(void) | |||
1262 | return -1; | 1263 | return -1; |
1263 | } | 1264 | } |
1264 | 1265 | ||
1265 | static int etrax_usb_submit_urb(struct urb *urb, int mem_flags) | 1266 | static int etrax_usb_submit_urb(struct urb *urb, unsigned mem_flags) |
1266 | { | 1267 | { |
1267 | etrax_hc_t *hc; | 1268 | etrax_hc_t *hc; |
1268 | int ret = -EINVAL; | 1269 | int ret = -EINVAL; |
@@ -4277,7 +4278,8 @@ etrax_usb_bulk_eot_timer_func(unsigned long dummy) | |||
4277 | } | 4278 | } |
4278 | 4279 | ||
4279 | static void* | 4280 | static void* |
4280 | etrax_usb_buffer_alloc(struct usb_bus* bus, size_t size, int mem_flags, dma_addr_t *dma) | 4281 | etrax_usb_buffer_alloc(struct usb_bus* bus, size_t size, |
4282 | unsigned mem_flags, dma_addr_t *dma) | ||
4281 | { | 4283 | { |
4282 | return kmalloc(size, mem_flags); | 4284 | return kmalloc(size, mem_flags); |
4283 | } | 4285 | } |
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c index ff0a168e8eed..50b1970fe6b6 100644 --- a/drivers/usb/host/isp116x-hcd.c +++ b/drivers/usb/host/isp116x-hcd.c | |||
@@ -17,7 +17,7 @@ | |||
17 | * The driver basically works. A number of people have used it with a range | 17 | * The driver basically works. A number of people have used it with a range |
18 | * of devices. | 18 | * of devices. |
19 | * | 19 | * |
20 | *The driver passes all usbtests 1-14. | 20 | * The driver passes all usbtests 1-14. |
21 | * | 21 | * |
22 | * Suspending/resuming of root hub via sysfs works. Remote wakeup works too. | 22 | * Suspending/resuming of root hub via sysfs works. Remote wakeup works too. |
23 | * And suspending/resuming of platform device works too. Suspend/resume | 23 | * And suspending/resuming of platform device works too. Suspend/resume |
@@ -229,7 +229,7 @@ static void preproc_atl_queue(struct isp116x *isp116x) | |||
229 | struct isp116x_ep *ep; | 229 | struct isp116x_ep *ep; |
230 | struct urb *urb; | 230 | struct urb *urb; |
231 | struct ptd *ptd; | 231 | struct ptd *ptd; |
232 | u16 toggle, dir, len; | 232 | u16 toggle = 0, dir = PTD_DIR_SETUP, len; |
233 | 233 | ||
234 | for (ep = isp116x->atl_active; ep; ep = ep->active) { | 234 | for (ep = isp116x->atl_active; ep; ep = ep->active) { |
235 | BUG_ON(list_empty(&ep->hep->urb_list)); | 235 | BUG_ON(list_empty(&ep->hep->urb_list)); |
@@ -251,8 +251,6 @@ static void preproc_atl_queue(struct isp116x *isp116x) | |||
251 | dir = PTD_DIR_OUT; | 251 | dir = PTD_DIR_OUT; |
252 | break; | 252 | break; |
253 | case USB_PID_SETUP: | 253 | case USB_PID_SETUP: |
254 | toggle = 0; | ||
255 | dir = PTD_DIR_SETUP; | ||
256 | len = sizeof(struct usb_ctrlrequest); | 254 | len = sizeof(struct usb_ctrlrequest); |
257 | ep->data = urb->setup_packet; | 255 | ep->data = urb->setup_packet; |
258 | break; | 256 | break; |
@@ -264,11 +262,9 @@ static void preproc_atl_queue(struct isp116x *isp116x) | |||
264 | ? PTD_DIR_OUT : PTD_DIR_IN; | 262 | ? PTD_DIR_OUT : PTD_DIR_IN; |
265 | break; | 263 | break; |
266 | default: | 264 | default: |
267 | /* To please gcc */ | ||
268 | toggle = dir = 0; | ||
269 | ERR("%s %d: ep->nextpid %d\n", __func__, __LINE__, | 265 | ERR("%s %d: ep->nextpid %d\n", __func__, __LINE__, |
270 | ep->nextpid); | 266 | ep->nextpid); |
271 | BUG_ON(1); | 267 | BUG(); |
272 | } | 268 | } |
273 | 269 | ||
274 | ptd->count = PTD_CC_MSK | PTD_ACTIVE_MSK | PTD_TOGGLE(toggle); | 270 | ptd->count = PTD_CC_MSK | PTD_ACTIVE_MSK | PTD_TOGGLE(toggle); |
@@ -697,7 +693,7 @@ static int balance(struct isp116x *isp116x, u16 period, u16 load) | |||
697 | 693 | ||
698 | static int isp116x_urb_enqueue(struct usb_hcd *hcd, | 694 | static int isp116x_urb_enqueue(struct usb_hcd *hcd, |
699 | struct usb_host_endpoint *hep, struct urb *urb, | 695 | struct usb_host_endpoint *hep, struct urb *urb, |
700 | int mem_flags) | 696 | unsigned mem_flags) |
701 | { | 697 | { |
702 | struct isp116x *isp116x = hcd_to_isp116x(hcd); | 698 | struct isp116x *isp116x = hcd_to_isp116x(hcd); |
703 | struct usb_device *udev = urb->dev; | 699 | struct usb_device *udev = urb->dev; |
@@ -719,7 +715,7 @@ static int isp116x_urb_enqueue(struct usb_hcd *hcd, | |||
719 | } | 715 | } |
720 | /* avoid all allocations within spinlocks: request or endpoint */ | 716 | /* avoid all allocations within spinlocks: request or endpoint */ |
721 | if (!hep->hcpriv) { | 717 | if (!hep->hcpriv) { |
722 | ep = kcalloc(1, sizeof *ep, (__force unsigned)mem_flags); | 718 | ep = kcalloc(1, sizeof *ep, mem_flags); |
723 | if (!ep) | 719 | if (!ep) |
724 | return -ENOMEM; | 720 | return -ENOMEM; |
725 | } | 721 | } |
@@ -1054,7 +1050,7 @@ static int isp116x_hub_control(struct usb_hcd *hcd, | |||
1054 | break; | 1050 | break; |
1055 | case GetHubStatus: | 1051 | case GetHubStatus: |
1056 | DBG("GetHubStatus\n"); | 1052 | DBG("GetHubStatus\n"); |
1057 | *(__le32 *) buf = cpu_to_le32(0); | 1053 | *(__le32 *) buf = 0; |
1058 | break; | 1054 | break; |
1059 | case GetPortStatus: | 1055 | case GetPortStatus: |
1060 | DBG("GetPortStatus\n"); | 1056 | DBG("GetPortStatus\n"); |
@@ -1810,9 +1806,9 @@ static int isp116x_suspend(struct device *dev, pm_message_t state, u32 phase) | |||
1810 | ret = usb_suspend_device(hcd->self.root_hub, state); | 1806 | ret = usb_suspend_device(hcd->self.root_hub, state); |
1811 | if (!ret) { | 1807 | if (!ret) { |
1812 | dev->power.power_state = state; | 1808 | dev->power.power_state = state; |
1813 | INFO("%s suspended\n", (char *)hcd_name); | 1809 | INFO("%s suspended\n", hcd_name); |
1814 | } else | 1810 | } else |
1815 | ERR("%s suspend failed\n", (char *)hcd_name); | 1811 | ERR("%s suspend failed\n", hcd_name); |
1816 | 1812 | ||
1817 | return ret; | 1813 | return ret; |
1818 | } | 1814 | } |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 13cd2177b557..68decab280dd 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -180,7 +180,7 @@ static int ohci_urb_enqueue ( | |||
180 | struct usb_hcd *hcd, | 180 | struct usb_hcd *hcd, |
181 | struct usb_host_endpoint *ep, | 181 | struct usb_host_endpoint *ep, |
182 | struct urb *urb, | 182 | struct urb *urb, |
183 | int mem_flags | 183 | unsigned mem_flags |
184 | ) { | 184 | ) { |
185 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | 185 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); |
186 | struct ed *ed; | 186 | struct ed *ed; |
@@ -673,8 +673,10 @@ retry: | |||
673 | 673 | ||
674 | ohci_dump (ohci, 1); | 674 | ohci_dump (ohci, 1); |
675 | 675 | ||
676 | if (ohci_to_hcd(ohci)->self.root_hub == NULL) | 676 | if (ohci_to_hcd(ohci)->self.root_hub == NULL) { |
677 | register_reboot_notifier (&ohci->reboot_notifier); | ||
677 | create_debug_files (ohci); | 678 | create_debug_files (ohci); |
679 | } | ||
678 | 680 | ||
679 | return 0; | 681 | return 0; |
680 | } | 682 | } |
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index e2fc4129dfc6..83ca4549a50e 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c | |||
@@ -419,10 +419,11 @@ ohci_hub_descriptor ( | |||
419 | 419 | ||
420 | /* two bitmaps: ports removable, and usb 1.0 legacy PortPwrCtrlMask */ | 420 | /* two bitmaps: ports removable, and usb 1.0 legacy PortPwrCtrlMask */ |
421 | rh = roothub_b (ohci); | 421 | rh = roothub_b (ohci); |
422 | memset(desc->bitmap, 0xff, sizeof(desc->bitmap)); | ||
422 | desc->bitmap [0] = rh & RH_B_DR; | 423 | desc->bitmap [0] = rh & RH_B_DR; |
423 | if (ports > 7) { | 424 | if (ports > 7) { |
424 | desc->bitmap [1] = (rh & RH_B_DR) >> 8; | 425 | desc->bitmap [1] = (rh & RH_B_DR) >> 8; |
425 | desc->bitmap [2] = desc->bitmap [3] = 0xff; | 426 | desc->bitmap [2] = 0xff; |
426 | } else | 427 | } else |
427 | desc->bitmap [1] = 0xff; | 428 | desc->bitmap [1] = 0xff; |
428 | } | 429 | } |
diff --git a/drivers/usb/host/ohci-mem.c b/drivers/usb/host/ohci-mem.c index 23735a36af00..fd3c4d3714bd 100644 --- a/drivers/usb/host/ohci-mem.c +++ b/drivers/usb/host/ohci-mem.c | |||
@@ -84,7 +84,7 @@ dma_to_td (struct ohci_hcd *hc, dma_addr_t td_dma) | |||
84 | 84 | ||
85 | /* TDs ... */ | 85 | /* TDs ... */ |
86 | static struct td * | 86 | static struct td * |
87 | td_alloc (struct ohci_hcd *hc, int mem_flags) | 87 | td_alloc (struct ohci_hcd *hc, unsigned mem_flags) |
88 | { | 88 | { |
89 | dma_addr_t dma; | 89 | dma_addr_t dma; |
90 | struct td *td; | 90 | struct td *td; |
@@ -118,7 +118,7 @@ td_free (struct ohci_hcd *hc, struct td *td) | |||
118 | 118 | ||
119 | /* EDs ... */ | 119 | /* EDs ... */ |
120 | static struct ed * | 120 | static struct ed * |
121 | ed_alloc (struct ohci_hcd *hc, int mem_flags) | 121 | ed_alloc (struct ohci_hcd *hc, unsigned mem_flags) |
122 | { | 122 | { |
123 | dma_addr_t dma; | 123 | dma_addr_t dma; |
124 | struct ed *ed; | 124 | struct ed *ed; |
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index b62d69937694..5cde76faab93 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c | |||
@@ -456,34 +456,22 @@ static int ohci_hcd_omap_drv_remove(struct device *dev) | |||
456 | 456 | ||
457 | #ifdef CONFIG_PM | 457 | #ifdef CONFIG_PM |
458 | 458 | ||
459 | /* states match PCI usage, always suspending the root hub except that | 459 | static int ohci_omap_suspend(struct device *dev, pm_message_t message, u32 level) |
460 | * 4 ~= D3cold (ACPI D3) with clock off (resume sees reset). | ||
461 | * | ||
462 | * FIXME: above comment is not right, and code is wrong, too :-(. | ||
463 | */ | ||
464 | |||
465 | static int ohci_omap_suspend(struct device *dev, pm_message_t state, u32 level) | ||
466 | { | 460 | { |
467 | struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); | 461 | struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); |
468 | int status = -EINVAL; | 462 | int status = -EINVAL; |
469 | 463 | ||
470 | if (level != SUSPEND_POWER_DOWN) | 464 | if (level != SUSPEND_POWER_DOWN) |
471 | return 0; | 465 | return 0; |
472 | if (state <= dev->power.power_state) | ||
473 | return 0; | ||
474 | 466 | ||
475 | dev_dbg(dev, "suspend to %d\n", state); | ||
476 | down(&ohci_to_hcd(ohci)->self.root_hub->serialize); | 467 | down(&ohci_to_hcd(ohci)->self.root_hub->serialize); |
477 | status = ohci_hub_suspend(ohci_to_hcd(ohci)); | 468 | status = ohci_hub_suspend(ohci_to_hcd(ohci)); |
478 | if (status == 0) { | 469 | if (status == 0) { |
479 | if (state >= 4) { | 470 | omap_ohci_clock_power(0); |
480 | omap_ohci_clock_power(0); | 471 | ohci_to_hcd(ohci)->self.root_hub->state = |
481 | ohci_to_hcd(ohci)->self.root_hub->state = | 472 | USB_STATE_SUSPENDED; |
482 | USB_STATE_SUSPENDED; | ||
483 | state = 4; | ||
484 | } | ||
485 | ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED; | 473 | ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED; |
486 | dev->power.power_state = state; | 474 | dev->power.power_state = PMSG_SUSPEND; |
487 | } | 475 | } |
488 | up(&ohci_to_hcd(ohci)->self.root_hub->serialize); | 476 | up(&ohci_to_hcd(ohci)->self.root_hub->serialize); |
489 | return status; | 477 | return status; |
@@ -497,29 +485,20 @@ static int ohci_omap_resume(struct device *dev, u32 level) | |||
497 | if (level != RESUME_POWER_ON) | 485 | if (level != RESUME_POWER_ON) |
498 | return 0; | 486 | return 0; |
499 | 487 | ||
500 | switch (dev->power.power_state) { | 488 | if (time_before(jiffies, ohci->next_statechange)) |
501 | case 0: | 489 | msleep(5); |
502 | break; | 490 | ohci->next_statechange = jiffies; |
503 | case 4: | 491 | omap_ohci_clock_power(1); |
504 | if (time_before(jiffies, ohci->next_statechange)) | ||
505 | msleep(5); | ||
506 | ohci->next_statechange = jiffies; | ||
507 | omap_ohci_clock_power(1); | ||
508 | /* FALLTHROUGH */ | ||
509 | default: | ||
510 | dev_dbg(dev, "resume from %d\n", dev->power.power_state); | ||
511 | #ifdef CONFIG_USB_SUSPEND | 492 | #ifdef CONFIG_USB_SUSPEND |
512 | /* get extra cleanup even if remote wakeup isn't in use */ | 493 | /* get extra cleanup even if remote wakeup isn't in use */ |
513 | status = usb_resume_device(ohci_to_hcd(ohci)->self.root_hub); | 494 | status = usb_resume_device(ohci_to_hcd(ohci)->self.root_hub); |
514 | #else | 495 | #else |
515 | down(&ohci_to_hcd(ohci)->self.root_hub->serialize); | 496 | down(&ohci_to_hcd(ohci)->self.root_hub->serialize); |
516 | status = ohci_hub_resume(ohci_to_hcd(ohci)); | 497 | status = ohci_hub_resume(ohci_to_hcd(ohci)); |
517 | up(&ohci_to_hcd(ohci)->self.root_hub->serialize); | 498 | up(&ohci_to_hcd(ohci)->self.root_hub->serialize); |
518 | #endif | 499 | #endif |
519 | if (status == 0) | 500 | if (status == 0) |
520 | dev->power.power_state = 0; | 501 | dev->power.power_state = PMSG_ON; |
521 | break; | ||
522 | } | ||
523 | return status; | 502 | return status; |
524 | } | 503 | } |
525 | 504 | ||
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c index 6c3f910bc307..7a890a65f55d 100644 --- a/drivers/usb/host/sl811-hcd.c +++ b/drivers/usb/host/sl811-hcd.c | |||
@@ -815,7 +815,7 @@ static int sl811h_urb_enqueue( | |||
815 | struct usb_hcd *hcd, | 815 | struct usb_hcd *hcd, |
816 | struct usb_host_endpoint *hep, | 816 | struct usb_host_endpoint *hep, |
817 | struct urb *urb, | 817 | struct urb *urb, |
818 | int mem_flags | 818 | unsigned mem_flags |
819 | ) { | 819 | ) { |
820 | struct sl811 *sl811 = hcd_to_sl811(hcd); | 820 | struct sl811 *sl811 = hcd_to_sl811(hcd); |
821 | struct usb_device *udev = urb->dev; | 821 | struct usb_device *udev = urb->dev; |
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c index 5f18084a116d..bbb36cd6ed61 100644 --- a/drivers/usb/host/uhci-q.c +++ b/drivers/usb/host/uhci-q.c | |||
@@ -1164,7 +1164,7 @@ static struct urb *uhci_find_urb_ep(struct uhci_hcd *uhci, struct urb *urb) | |||
1164 | 1164 | ||
1165 | static int uhci_urb_enqueue(struct usb_hcd *hcd, | 1165 | static int uhci_urb_enqueue(struct usb_hcd *hcd, |
1166 | struct usb_host_endpoint *ep, | 1166 | struct usb_host_endpoint *ep, |
1167 | struct urb *urb, int mem_flags) | 1167 | struct urb *urb, unsigned mem_flags) |
1168 | { | 1168 | { |
1169 | int ret; | 1169 | int ret; |
1170 | struct uhci_hcd *uhci = hcd_to_uhci(hcd); | 1170 | struct uhci_hcd *uhci = hcd_to_uhci(hcd); |
diff --git a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig index fd59f6bdd67f..298e4a25e3d3 100644 --- a/drivers/usb/input/Kconfig +++ b/drivers/usb/input/Kconfig | |||
@@ -259,3 +259,16 @@ config USB_ATI_REMOTE | |||
259 | To compile this driver as a module, choose M here: the module will be | 259 | To compile this driver as a module, choose M here: the module will be |
260 | called ati_remote. | 260 | called ati_remote. |
261 | 261 | ||
262 | config USB_KEYSPAN_REMOTE | ||
263 | tristate "Keyspan DMR USB remote control (EXPERIMENTAL)" | ||
264 | depends on USB && INPUT && EXPERIMENTAL | ||
265 | ---help--- | ||
266 | Say Y here if you want to use a Keyspan DMR USB remote control. | ||
267 | Currently only the UIA-11 type of receiver has been tested. The tag | ||
268 | on the receiver that connects to the USB port should have a P/N that | ||
269 | will tell you what type of DMR you have. The UIA-10 type is not | ||
270 | supported at this time. This driver maps all buttons to keypress | ||
271 | events. | ||
272 | |||
273 | To compile this driver as a module, choose M here: the module will | ||
274 | be called keyspan_remote. | ||
diff --git a/drivers/usb/input/Makefile b/drivers/usb/input/Makefile index 831b2b0f1f05..f1547be632d4 100644 --- a/drivers/usb/input/Makefile +++ b/drivers/usb/input/Makefile | |||
@@ -31,6 +31,7 @@ obj-$(CONFIG_USB_ATI_REMOTE) += ati_remote.o | |||
31 | obj-$(CONFIG_USB_HID) += usbhid.o | 31 | obj-$(CONFIG_USB_HID) += usbhid.o |
32 | obj-$(CONFIG_USB_KBD) += usbkbd.o | 32 | obj-$(CONFIG_USB_KBD) += usbkbd.o |
33 | obj-$(CONFIG_USB_KBTAB) += kbtab.o | 33 | obj-$(CONFIG_USB_KBTAB) += kbtab.o |
34 | obj-$(CONFIG_USB_KEYSPAN_REMOTE) += keyspan_remote.o | ||
34 | obj-$(CONFIG_USB_MOUSE) += usbmouse.o | 35 | obj-$(CONFIG_USB_MOUSE) += usbmouse.o |
35 | obj-$(CONFIG_USB_MTOUCH) += mtouchusb.o | 36 | obj-$(CONFIG_USB_MTOUCH) += mtouchusb.o |
36 | obj-$(CONFIG_USB_ITMTOUCH) += itmtouch.o | 37 | obj-$(CONFIG_USB_ITMTOUCH) += itmtouch.o |
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index 100b49bd1d3e..2350e7a5ad70 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
@@ -1428,6 +1428,19 @@ void hid_init_reports(struct hid_device *hid) | |||
1428 | #define USB_DEVICE_ID_VERNIER_SKIP 0x0003 | 1428 | #define USB_DEVICE_ID_VERNIER_SKIP 0x0003 |
1429 | #define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004 | 1429 | #define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004 |
1430 | 1430 | ||
1431 | #define USB_VENDOR_ID_LD 0x0f11 | ||
1432 | #define USB_DEVICE_ID_CASSY 0x1000 | ||
1433 | #define USB_DEVICE_ID_POCKETCASSY 0x1010 | ||
1434 | #define USB_DEVICE_ID_MOBILECASSY 0x1020 | ||
1435 | #define USB_DEVICE_ID_JWM 0x1080 | ||
1436 | #define USB_DEVICE_ID_DMMP 0x1081 | ||
1437 | #define USB_DEVICE_ID_UMIP 0x1090 | ||
1438 | #define USB_DEVICE_ID_VIDEOCOM 0x1200 | ||
1439 | #define USB_DEVICE_ID_COM3LAB 0x2000 | ||
1440 | #define USB_DEVICE_ID_TELEPORT 0x2010 | ||
1441 | #define USB_DEVICE_ID_NETWORKANALYSER 0x2020 | ||
1442 | #define USB_DEVICE_ID_POWERCONTROL 0x2030 | ||
1443 | |||
1431 | 1444 | ||
1432 | /* | 1445 | /* |
1433 | * Alphabetically sorted blacklist by quirk type. | 1446 | * Alphabetically sorted blacklist by quirk type. |
@@ -1463,6 +1476,17 @@ static struct hid_blacklist { | |||
1463 | { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE }, | 1476 | { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE }, |
1464 | { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE }, | 1477 | { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE }, |
1465 | { USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE }, | 1478 | { USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE }, |
1479 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_CASSY, HID_QUIRK_IGNORE }, | ||
1480 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_POCKETCASSY, HID_QUIRK_IGNORE }, | ||
1481 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_MOBILECASSY, HID_QUIRK_IGNORE }, | ||
1482 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_JWM, HID_QUIRK_IGNORE }, | ||
1483 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_DMMP, HID_QUIRK_IGNORE }, | ||
1484 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_UMIP, HID_QUIRK_IGNORE }, | ||
1485 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_VIDEOCOM, HID_QUIRK_IGNORE }, | ||
1486 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_COM3LAB, HID_QUIRK_IGNORE }, | ||
1487 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_TELEPORT, HID_QUIRK_IGNORE }, | ||
1488 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_NETWORKANALYSER, HID_QUIRK_IGNORE }, | ||
1489 | { USB_VENDOR_ID_LD, USB_DEVICE_ID_POWERCONTROL, HID_QUIRK_IGNORE }, | ||
1466 | { USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS, HID_QUIRK_IGNORE }, | 1490 | { USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS, HID_QUIRK_IGNORE }, |
1467 | { USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS, HID_QUIRK_IGNORE }, | 1491 | { USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS, HID_QUIRK_IGNORE }, |
1468 | { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_IGNORE }, | 1492 | { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_IGNORE }, |
diff --git a/drivers/usb/input/keyspan_remote.c b/drivers/usb/input/keyspan_remote.c new file mode 100644 index 000000000000..67dc93685203 --- /dev/null +++ b/drivers/usb/input/keyspan_remote.c | |||
@@ -0,0 +1,633 @@ | |||
1 | /* | ||
2 | * keyspan_remote: USB driver for the Keyspan DMR | ||
3 | * | ||
4 | * Copyright (C) 2005 Zymeta Corporation - Michael Downey (downey@zymeta.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License as | ||
8 | * published by the Free Software Foundation, version 2. | ||
9 | * | ||
10 | * This driver has been put together with the support of Innosys, Inc. | ||
11 | * and Keyspan, Inc the manufacturers of the Keyspan USB DMR product. | ||
12 | */ | ||
13 | |||
14 | #include <linux/config.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/errno.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/slab.h> | ||
19 | #include <linux/module.h> | ||
20 | #include <linux/moduleparam.h> | ||
21 | #include <linux/input.h> | ||
22 | #include <linux/usb.h> | ||
23 | |||
24 | #define DRIVER_VERSION "v0.1" | ||
25 | #define DRIVER_AUTHOR "Michael Downey <downey@zymeta.com>" | ||
26 | #define DRIVER_DESC "Driver for the USB Keyspan remote control." | ||
27 | #define DRIVER_LICENSE "GPL" | ||
28 | |||
29 | /* Parameters that can be passed to the driver. */ | ||
30 | static int debug; | ||
31 | module_param(debug, int, 0444); | ||
32 | MODULE_PARM_DESC(debug, "Enable extra debug messages and information"); | ||
33 | |||
34 | /* Vendor and product ids */ | ||
35 | #define USB_KEYSPAN_VENDOR_ID 0x06CD | ||
36 | #define USB_KEYSPAN_PRODUCT_UIA11 0x0202 | ||
37 | |||
38 | /* Defines for converting the data from the remote. */ | ||
39 | #define ZERO 0x18 | ||
40 | #define ZERO_MASK 0x1F /* 5 bits for a 0 */ | ||
41 | #define ONE 0x3C | ||
42 | #define ONE_MASK 0x3F /* 6 bits for a 1 */ | ||
43 | #define SYNC 0x3F80 | ||
44 | #define SYNC_MASK 0x3FFF /* 14 bits for a SYNC sequence */ | ||
45 | #define STOP 0x00 | ||
46 | #define STOP_MASK 0x1F /* 5 bits for the STOP sequence */ | ||
47 | #define GAP 0xFF | ||
48 | |||
49 | #define RECV_SIZE 8 /* The UIA-11 type have a 8 byte limit. */ | ||
50 | |||
51 | /* table of devices that work with this driver */ | ||
52 | static struct usb_device_id keyspan_table[] = { | ||
53 | { USB_DEVICE(USB_KEYSPAN_VENDOR_ID, USB_KEYSPAN_PRODUCT_UIA11) }, | ||
54 | { } /* Terminating entry */ | ||
55 | }; | ||
56 | |||
57 | /* Structure to store all the real stuff that a remote sends to us. */ | ||
58 | struct keyspan_message { | ||
59 | u16 system; | ||
60 | u8 button; | ||
61 | u8 toggle; | ||
62 | }; | ||
63 | |||
64 | /* Structure used for all the bit testing magic needed to be done. */ | ||
65 | struct bit_tester { | ||
66 | u32 tester; | ||
67 | int len; | ||
68 | int pos; | ||
69 | int bits_left; | ||
70 | u8 buffer[32]; | ||
71 | }; | ||
72 | |||
73 | /* Structure to hold all of our driver specific stuff */ | ||
74 | struct usb_keyspan { | ||
75 | char name[128]; | ||
76 | char phys[64]; | ||
77 | struct usb_device* udev; | ||
78 | struct input_dev input; | ||
79 | struct usb_interface* interface; | ||
80 | struct usb_endpoint_descriptor* in_endpoint; | ||
81 | struct urb* irq_urb; | ||
82 | int open; | ||
83 | dma_addr_t in_dma; | ||
84 | unsigned char* in_buffer; | ||
85 | |||
86 | /* variables used to parse messages from remote. */ | ||
87 | struct bit_tester data; | ||
88 | int stage; | ||
89 | int toggle; | ||
90 | }; | ||
91 | |||
92 | /* | ||
93 | * Table that maps the 31 possible keycodes to input keys. | ||
94 | * Currently there are 15 and 17 button models so RESERVED codes | ||
95 | * are blank areas in the mapping. | ||
96 | */ | ||
97 | static int keyspan_key_table[] = { | ||
98 | KEY_RESERVED, /* 0 is just a place holder. */ | ||
99 | KEY_RESERVED, | ||
100 | KEY_STOP, | ||
101 | KEY_PLAYCD, | ||
102 | KEY_RESERVED, | ||
103 | KEY_PREVIOUSSONG, | ||
104 | KEY_REWIND, | ||
105 | KEY_FORWARD, | ||
106 | KEY_NEXTSONG, | ||
107 | KEY_RESERVED, | ||
108 | KEY_RESERVED, | ||
109 | KEY_RESERVED, | ||
110 | KEY_PAUSE, | ||
111 | KEY_VOLUMEUP, | ||
112 | KEY_RESERVED, | ||
113 | KEY_RESERVED, | ||
114 | KEY_RESERVED, | ||
115 | KEY_VOLUMEDOWN, | ||
116 | KEY_RESERVED, | ||
117 | KEY_UP, | ||
118 | KEY_RESERVED, | ||
119 | KEY_MUTE, | ||
120 | KEY_LEFT, | ||
121 | KEY_ENTER, | ||
122 | KEY_RIGHT, | ||
123 | KEY_RESERVED, | ||
124 | KEY_RESERVED, | ||
125 | KEY_DOWN, | ||
126 | KEY_RESERVED, | ||
127 | KEY_KPASTERISK, | ||
128 | KEY_RESERVED, | ||
129 | KEY_MENU | ||
130 | }; | ||
131 | |||
132 | static struct usb_driver keyspan_driver; | ||
133 | |||
134 | /* | ||
135 | * Debug routine that prints out what we've received from the remote. | ||
136 | */ | ||
137 | static void keyspan_print(struct usb_keyspan* dev) /*unsigned char* data)*/ | ||
138 | { | ||
139 | char codes[4*RECV_SIZE]; | ||
140 | int i; | ||
141 | |||
142 | for (i = 0; i < RECV_SIZE; i++) { | ||
143 | snprintf(codes+i*3, 4, "%02x ", dev->in_buffer[i]); | ||
144 | } | ||
145 | |||
146 | dev_info(&dev->udev->dev, "%s\n", codes); | ||
147 | } | ||
148 | |||
149 | /* | ||
150 | * Routine that manages the bit_tester structure. It makes sure that there are | ||
151 | * at least bits_needed bits loaded into the tester. | ||
152 | */ | ||
153 | static int keyspan_load_tester(struct usb_keyspan* dev, int bits_needed) | ||
154 | { | ||
155 | if (dev->data.bits_left >= bits_needed) | ||
156 | return(0); | ||
157 | |||
158 | /* | ||
159 | * Somehow we've missed the last message. The message will be repeated | ||
160 | * though so it's not too big a deal | ||
161 | */ | ||
162 | if (dev->data.pos >= dev->data.len) { | ||
163 | dev_dbg(&dev->udev, "%s - Error ran out of data. pos: %d, len: %d\n", | ||
164 | __FUNCTION__, dev->data.pos, dev->data.len); | ||
165 | return(-1); | ||
166 | } | ||
167 | |||
168 | /* Load as much as we can into the tester. */ | ||
169 | while ((dev->data.bits_left + 7 < (sizeof(dev->data.tester) * 8)) && | ||
170 | (dev->data.pos < dev->data.len)) { | ||
171 | dev->data.tester += (dev->data.buffer[dev->data.pos++] << dev->data.bits_left); | ||
172 | dev->data.bits_left += 8; | ||
173 | } | ||
174 | |||
175 | return(0); | ||
176 | } | ||
177 | |||
178 | /* | ||
179 | * Routine that handles all the logic needed to parse out the message from the remote. | ||
180 | */ | ||
181 | static void keyspan_check_data(struct usb_keyspan *remote, struct pt_regs *regs) | ||
182 | { | ||
183 | int i; | ||
184 | int found = 0; | ||
185 | struct keyspan_message message; | ||
186 | |||
187 | switch(remote->stage) { | ||
188 | case 0: | ||
189 | /* | ||
190 | * In stage 0 we want to find the start of a message. The remote sends a 0xFF as filler. | ||
191 | * So the first byte that isn't a FF should be the start of a new message. | ||
192 | */ | ||
193 | for (i = 0; i < RECV_SIZE && remote->in_buffer[i] == GAP; ++i); | ||
194 | |||
195 | if (i < RECV_SIZE) { | ||
196 | memcpy(remote->data.buffer, remote->in_buffer, RECV_SIZE); | ||
197 | remote->data.len = RECV_SIZE; | ||
198 | remote->data.pos = 0; | ||
199 | remote->data.tester = 0; | ||
200 | remote->data.bits_left = 0; | ||
201 | remote->stage = 1; | ||
202 | } | ||
203 | break; | ||
204 | |||
205 | case 1: | ||
206 | /* | ||
207 | * Stage 1 we should have 16 bytes and should be able to detect a | ||
208 | * SYNC. The SYNC is 14 bits, 7 0's and then 7 1's. | ||
209 | */ | ||
210 | memcpy(remote->data.buffer + remote->data.len, remote->in_buffer, RECV_SIZE); | ||
211 | remote->data.len += RECV_SIZE; | ||
212 | |||
213 | found = 0; | ||
214 | while ((remote->data.bits_left >= 14 || remote->data.pos < remote->data.len) && !found) { | ||
215 | for (i = 0; i < 8; ++i) { | ||
216 | if (keyspan_load_tester(remote, 14) != 0) { | ||
217 | remote->stage = 0; | ||
218 | return; | ||
219 | } | ||
220 | |||
221 | if ((remote->data.tester & SYNC_MASK) == SYNC) { | ||
222 | remote->data.tester = remote->data.tester >> 14; | ||
223 | remote->data.bits_left -= 14; | ||
224 | found = 1; | ||
225 | break; | ||
226 | } else { | ||
227 | remote->data.tester = remote->data.tester >> 1; | ||
228 | --remote->data.bits_left; | ||
229 | } | ||
230 | } | ||
231 | } | ||
232 | |||
233 | if (!found) { | ||
234 | remote->stage = 0; | ||
235 | remote->data.len = 0; | ||
236 | } else { | ||
237 | remote->stage = 2; | ||
238 | } | ||
239 | break; | ||
240 | |||
241 | case 2: | ||
242 | /* | ||
243 | * Stage 2 we should have 24 bytes which will be enough for a full | ||
244 | * message. We need to parse out the system code, button code, | ||
245 | * toggle code, and stop. | ||
246 | */ | ||
247 | memcpy(remote->data.buffer + remote->data.len, remote->in_buffer, RECV_SIZE); | ||
248 | remote->data.len += RECV_SIZE; | ||
249 | |||
250 | message.system = 0; | ||
251 | for (i = 0; i < 9; i++) { | ||
252 | keyspan_load_tester(remote, 6); | ||
253 | |||
254 | if ((remote->data.tester & ZERO_MASK) == ZERO) { | ||
255 | message.system = message.system << 1; | ||
256 | remote->data.tester = remote->data.tester >> 5; | ||
257 | remote->data.bits_left -= 5; | ||
258 | } else if ((remote->data.tester & ONE_MASK) == ONE) { | ||
259 | message.system = (message.system << 1) + 1; | ||
260 | remote->data.tester = remote->data.tester >> 6; | ||
261 | remote->data.bits_left -= 6; | ||
262 | } else { | ||
263 | err("%s - Unknown sequence found in system data.\n", __FUNCTION__); | ||
264 | remote->stage = 0; | ||
265 | return; | ||
266 | } | ||
267 | } | ||
268 | |||
269 | message.button = 0; | ||
270 | for (i = 0; i < 5; i++) { | ||
271 | keyspan_load_tester(remote, 6); | ||
272 | |||
273 | if ((remote->data.tester & ZERO_MASK) == ZERO) { | ||
274 | message.button = message.button << 1; | ||
275 | remote->data.tester = remote->data.tester >> 5; | ||
276 | remote->data.bits_left -= 5; | ||
277 | } else if ((remote->data.tester & ONE_MASK) == ONE) { | ||
278 | message.button = (message.button << 1) + 1; | ||
279 | remote->data.tester = remote->data.tester >> 6; | ||
280 | remote->data.bits_left -= 6; | ||
281 | } else { | ||
282 | err("%s - Unknown sequence found in button data.\n", __FUNCTION__); | ||
283 | remote->stage = 0; | ||
284 | return; | ||
285 | } | ||
286 | } | ||
287 | |||
288 | keyspan_load_tester(remote, 6); | ||
289 | if ((remote->data.tester & ZERO_MASK) == ZERO) { | ||
290 | message.toggle = 0; | ||
291 | remote->data.tester = remote->data.tester >> 5; | ||
292 | remote->data.bits_left -= 5; | ||
293 | } else if ((remote->data.tester & ONE_MASK) == ONE) { | ||
294 | message.toggle = 1; | ||
295 | remote->data.tester = remote->data.tester >> 6; | ||
296 | remote->data.bits_left -= 6; | ||
297 | } else { | ||
298 | err("%s - Error in message, invalid toggle.\n", __FUNCTION__); | ||
299 | } | ||
300 | |||
301 | keyspan_load_tester(remote, 5); | ||
302 | if ((remote->data.tester & STOP_MASK) == STOP) { | ||
303 | remote->data.tester = remote->data.tester >> 5; | ||
304 | remote->data.bits_left -= 5; | ||
305 | } else { | ||
306 | err("Bad message recieved, no stop bit found.\n"); | ||
307 | } | ||
308 | |||
309 | dev_dbg(&remote->udev, | ||
310 | "%s found valid message: system: %d, button: %d, toggle: %d\n", | ||
311 | __FUNCTION__, message.system, message.button, message.toggle); | ||
312 | |||
313 | if (message.toggle != remote->toggle) { | ||
314 | input_regs(&remote->input, regs); | ||
315 | input_report_key(&remote->input, keyspan_key_table[message.button], 1); | ||
316 | input_report_key(&remote->input, keyspan_key_table[message.button], 0); | ||
317 | input_sync(&remote->input); | ||
318 | remote->toggle = message.toggle; | ||
319 | } | ||
320 | |||
321 | remote->stage = 0; | ||
322 | break; | ||
323 | } | ||
324 | } | ||
325 | |||
326 | /* | ||
327 | * Routine for sending all the initialization messages to the remote. | ||
328 | */ | ||
329 | static int keyspan_setup(struct usb_device* dev) | ||
330 | { | ||
331 | int retval = 0; | ||
332 | |||
333 | retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | ||
334 | 0x11, 0x40, 0x5601, 0x0, NULL, 0, 0); | ||
335 | if (retval) { | ||
336 | dev_dbg(&dev->dev, "%s - failed to set bit rate due to error: %d\n", | ||
337 | __FUNCTION__, retval); | ||
338 | return(retval); | ||
339 | } | ||
340 | |||
341 | retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | ||
342 | 0x44, 0x40, 0x0, 0x0, NULL, 0, 0); | ||
343 | if (retval) { | ||
344 | dev_dbg(&dev->dev, "%s - failed to set resume sensitivity due to error: %d\n", | ||
345 | __FUNCTION__, retval); | ||
346 | return(retval); | ||
347 | } | ||
348 | |||
349 | retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | ||
350 | 0x22, 0x40, 0x0, 0x0, NULL, 0, 0); | ||
351 | if (retval) { | ||
352 | dev_dbg(&dev->dev, "%s - failed to turn receive on due to error: %d\n", | ||
353 | __FUNCTION__, retval); | ||
354 | return(retval); | ||
355 | } | ||
356 | |||
357 | dev_dbg(&dev->dev, "%s - Setup complete.\n", __FUNCTION__); | ||
358 | return(retval); | ||
359 | } | ||
360 | |||
361 | /* | ||
362 | * Routine used to handle a new message that has come in. | ||
363 | */ | ||
364 | static void keyspan_irq_recv(struct urb *urb, struct pt_regs *regs) | ||
365 | { | ||
366 | struct usb_keyspan *dev = urb->context; | ||
367 | int retval; | ||
368 | |||
369 | /* Check our status in case we need to bail out early. */ | ||
370 | switch (urb->status) { | ||
371 | case 0: | ||
372 | break; | ||
373 | |||
374 | /* Device went away so don't keep trying to read from it. */ | ||
375 | case -ECONNRESET: | ||
376 | case -ENOENT: | ||
377 | case -ESHUTDOWN: | ||
378 | return; | ||
379 | |||
380 | default: | ||
381 | goto resubmit; | ||
382 | break; | ||
383 | } | ||
384 | |||
385 | if (debug) | ||
386 | keyspan_print(dev); | ||
387 | |||
388 | keyspan_check_data(dev, regs); | ||
389 | |||
390 | resubmit: | ||
391 | retval = usb_submit_urb(urb, GFP_ATOMIC); | ||
392 | if (retval) | ||
393 | err ("%s - usb_submit_urb failed with result: %d", __FUNCTION__, retval); | ||
394 | } | ||
395 | |||
396 | static int keyspan_open(struct input_dev *dev) | ||
397 | { | ||
398 | struct usb_keyspan *remote = dev->private; | ||
399 | |||
400 | if (remote->open++) | ||
401 | return 0; | ||
402 | |||
403 | remote->irq_urb->dev = remote->udev; | ||
404 | if (usb_submit_urb(remote->irq_urb, GFP_KERNEL)) { | ||
405 | remote->open--; | ||
406 | return -EIO; | ||
407 | } | ||
408 | |||
409 | return 0; | ||
410 | } | ||
411 | |||
412 | static void keyspan_close(struct input_dev *dev) | ||
413 | { | ||
414 | struct usb_keyspan *remote = dev->private; | ||
415 | |||
416 | if (!--remote->open) | ||
417 | usb_kill_urb(remote->irq_urb); | ||
418 | } | ||
419 | |||
420 | /* | ||
421 | * Routine that sets up the driver to handle a specific USB device detected on the bus. | ||
422 | */ | ||
423 | static int keyspan_probe(struct usb_interface *interface, const struct usb_device_id *id) | ||
424 | { | ||
425 | int i; | ||
426 | int retval = -ENOMEM; | ||
427 | char path[64]; | ||
428 | char *buf; | ||
429 | struct usb_keyspan *remote = NULL; | ||
430 | struct usb_host_interface *iface_desc; | ||
431 | struct usb_endpoint_descriptor *endpoint; | ||
432 | struct usb_device *udev = usb_get_dev(interface_to_usbdev(interface)); | ||
433 | |||
434 | /* See if the offered device matches what we can accept */ | ||
435 | if ((udev->descriptor.idVendor != USB_KEYSPAN_VENDOR_ID) || | ||
436 | (udev->descriptor.idProduct != USB_KEYSPAN_PRODUCT_UIA11) ) | ||
437 | return -ENODEV; | ||
438 | |||
439 | /* allocate memory for our device state and initialize it */ | ||
440 | remote = kmalloc(sizeof(*remote), GFP_KERNEL); | ||
441 | if (remote == NULL) { | ||
442 | err("Out of memory\n"); | ||
443 | goto error; | ||
444 | } | ||
445 | memset(remote, 0x00, sizeof(*remote)); | ||
446 | |||
447 | remote->udev = udev; | ||
448 | remote->interface = interface; | ||
449 | remote->toggle = -1; /* Set to -1 so we will always not match the toggle from the first remote message. */ | ||
450 | |||
451 | /* set up the endpoint information */ | ||
452 | /* use only the first in interrupt endpoint */ | ||
453 | iface_desc = interface->cur_altsetting; | ||
454 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { | ||
455 | endpoint = &iface_desc->endpoint[i].desc; | ||
456 | |||
457 | if (!remote->in_endpoint && | ||
458 | (endpoint->bEndpointAddress & USB_DIR_IN) && | ||
459 | ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT)) { | ||
460 | /* we found our interrupt in endpoint */ | ||
461 | remote->in_endpoint = endpoint; | ||
462 | |||
463 | remote->in_buffer = usb_buffer_alloc(remote->udev, RECV_SIZE, SLAB_ATOMIC, &remote->in_dma); | ||
464 | if (!remote->in_buffer) { | ||
465 | retval = -ENOMEM; | ||
466 | goto error; | ||
467 | } | ||
468 | } | ||
469 | } | ||
470 | |||
471 | if (!remote->in_endpoint) { | ||
472 | err("Could not find interrupt input endpoint.\n"); | ||
473 | retval = -ENODEV; | ||
474 | goto error; | ||
475 | } | ||
476 | |||
477 | remote->irq_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
478 | if (!remote->irq_urb) { | ||
479 | err("Failed to allocate urb.\n"); | ||
480 | retval = -ENOMEM; | ||
481 | goto error; | ||
482 | } | ||
483 | |||
484 | retval = keyspan_setup(remote->udev); | ||
485 | if (retval) { | ||
486 | err("Failed to setup device.\n"); | ||
487 | retval = -ENODEV; | ||
488 | goto error; | ||
489 | } | ||
490 | |||
491 | /* | ||
492 | * Setup the input system with the bits we are going to be reporting | ||
493 | */ | ||
494 | remote->input.evbit[0] = BIT(EV_KEY); /* We will only report KEY events. */ | ||
495 | for (i = 0; i < 32; ++i) { | ||
496 | if (keyspan_key_table[i] != KEY_RESERVED) { | ||
497 | set_bit(keyspan_key_table[i], remote->input.keybit); | ||
498 | } | ||
499 | } | ||
500 | |||
501 | remote->input.private = remote; | ||
502 | remote->input.open = keyspan_open; | ||
503 | remote->input.close = keyspan_close; | ||
504 | |||
505 | usb_make_path(remote->udev, path, 64); | ||
506 | sprintf(remote->phys, "%s/input0", path); | ||
507 | |||
508 | remote->input.name = remote->name; | ||
509 | remote->input.phys = remote->phys; | ||
510 | remote->input.id.bustype = BUS_USB; | ||
511 | remote->input.id.vendor = le16_to_cpu(remote->udev->descriptor.idVendor); | ||
512 | remote->input.id.product = le16_to_cpu(remote->udev->descriptor.idProduct); | ||
513 | remote->input.id.version = le16_to_cpu(remote->udev->descriptor.bcdDevice); | ||
514 | |||
515 | if (!(buf = kmalloc(63, GFP_KERNEL))) { | ||
516 | usb_buffer_free(remote->udev, RECV_SIZE, remote->in_buffer, remote->in_dma); | ||
517 | kfree(remote); | ||
518 | return -ENOMEM; | ||
519 | } | ||
520 | |||
521 | if (remote->udev->descriptor.iManufacturer && | ||
522 | usb_string(remote->udev, remote->udev->descriptor.iManufacturer, buf, 63) > 0) | ||
523 | strcat(remote->name, buf); | ||
524 | |||
525 | if (remote->udev->descriptor.iProduct && | ||
526 | usb_string(remote->udev, remote->udev->descriptor.iProduct, buf, 63) > 0) | ||
527 | sprintf(remote->name, "%s %s", remote->name, buf); | ||
528 | |||
529 | if (!strlen(remote->name)) | ||
530 | sprintf(remote->name, "USB Keyspan Remote %04x:%04x", | ||
531 | remote->input.id.vendor, remote->input.id.product); | ||
532 | |||
533 | kfree(buf); | ||
534 | |||
535 | /* | ||
536 | * Initialize the URB to access the device. The urb gets sent to the device in keyspan_open() | ||
537 | */ | ||
538 | usb_fill_int_urb(remote->irq_urb, | ||
539 | remote->udev, usb_rcvintpipe(remote->udev, remote->in_endpoint->bEndpointAddress), | ||
540 | remote->in_buffer, RECV_SIZE, keyspan_irq_recv, remote, | ||
541 | remote->in_endpoint->bInterval); | ||
542 | remote->irq_urb->transfer_dma = remote->in_dma; | ||
543 | remote->irq_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
544 | |||
545 | /* we can register the device now, as it is ready */ | ||
546 | input_register_device(&remote->input); | ||
547 | |||
548 | /* save our data pointer in this interface device */ | ||
549 | usb_set_intfdata(interface, remote); | ||
550 | |||
551 | /* let the user know what node this device is now attached to */ | ||
552 | info("connected: %s on %s", remote->name, path); | ||
553 | return 0; | ||
554 | |||
555 | error: | ||
556 | /* | ||
557 | * In case of error we need to clean up any allocated buffers | ||
558 | */ | ||
559 | if (remote->irq_urb) | ||
560 | usb_free_urb(remote->irq_urb); | ||
561 | |||
562 | if (remote->in_buffer) | ||
563 | usb_buffer_free(remote->udev, RECV_SIZE, remote->in_buffer, remote->in_dma); | ||
564 | |||
565 | if (remote) | ||
566 | kfree(remote); | ||
567 | |||
568 | return retval; | ||
569 | } | ||
570 | |||
571 | /* | ||
572 | * Routine called when a device is disconnected from the USB. | ||
573 | */ | ||
574 | static void keyspan_disconnect(struct usb_interface *interface) | ||
575 | { | ||
576 | struct usb_keyspan *remote; | ||
577 | |||
578 | /* prevent keyspan_open() from racing keyspan_disconnect() */ | ||
579 | lock_kernel(); | ||
580 | |||
581 | remote = usb_get_intfdata(interface); | ||
582 | usb_set_intfdata(interface, NULL); | ||
583 | |||
584 | if (remote) { /* We have a valid driver structure so clean up everything we allocated. */ | ||
585 | input_unregister_device(&remote->input); | ||
586 | usb_kill_urb(remote->irq_urb); | ||
587 | usb_free_urb(remote->irq_urb); | ||
588 | usb_buffer_free(interface_to_usbdev(interface), RECV_SIZE, remote->in_buffer, remote->in_dma); | ||
589 | kfree(remote); | ||
590 | } | ||
591 | |||
592 | unlock_kernel(); | ||
593 | |||
594 | info("USB Keyspan now disconnected"); | ||
595 | } | ||
596 | |||
597 | /* | ||
598 | * Standard driver set up sections | ||
599 | */ | ||
600 | static struct usb_driver keyspan_driver = | ||
601 | { | ||
602 | .owner = THIS_MODULE, | ||
603 | .name = "keyspan_remote", | ||
604 | .probe = keyspan_probe, | ||
605 | .disconnect = keyspan_disconnect, | ||
606 | .id_table = keyspan_table | ||
607 | }; | ||
608 | |||
609 | static int __init usb_keyspan_init(void) | ||
610 | { | ||
611 | int result; | ||
612 | |||
613 | /* register this driver with the USB subsystem */ | ||
614 | result = usb_register(&keyspan_driver); | ||
615 | if (result) | ||
616 | err("usb_register failed. Error number %d\n", result); | ||
617 | |||
618 | return result; | ||
619 | } | ||
620 | |||
621 | static void __exit usb_keyspan_exit(void) | ||
622 | { | ||
623 | /* deregister this driver with the USB subsystem */ | ||
624 | usb_deregister(&keyspan_driver); | ||
625 | } | ||
626 | |||
627 | module_init(usb_keyspan_init); | ||
628 | module_exit(usb_keyspan_exit); | ||
629 | |||
630 | MODULE_DEVICE_TABLE(usb, keyspan_table); | ||
631 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
632 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
633 | MODULE_LICENSE(DRIVER_LICENSE); | ||
diff --git a/drivers/usb/media/Makefile b/drivers/usb/media/Makefile index 2b76df7005fe..d83adffa925f 100644 --- a/drivers/usb/media/Makefile +++ b/drivers/usb/media/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for USB Media drivers | 2 | # Makefile for USB Media drivers |
3 | # | 3 | # |
4 | 4 | ||
5 | sn9c102-objs := sn9c102_core.o sn9c102_hv7131d.o sn9c102_mi0343.o sn9c102_pas106b.o sn9c102_pas202bcb.o sn9c102_tas5110c1b.o sn9c102_tas5130d1b.o | 5 | sn9c102-objs := sn9c102_core.o sn9c102_hv7131d.o sn9c102_mi0343.o sn9c102_ov7630.o sn9c102_pas106b.o sn9c102_pas202bcb.o sn9c102_tas5110c1b.o sn9c102_tas5130d1b.o |
6 | 6 | ||
7 | obj-$(CONFIG_USB_DABUSB) += dabusb.o | 7 | obj-$(CONFIG_USB_DABUSB) += dabusb.o |
8 | obj-$(CONFIG_USB_DSBR) += dsbr100.o | 8 | obj-$(CONFIG_USB_DSBR) += dsbr100.o |
diff --git a/drivers/usb/media/sn9c102.h b/drivers/usb/media/sn9c102.h index 8b8a4c8743f8..e5cea0e2eb57 100644 --- a/drivers/usb/media/sn9c102.h +++ b/drivers/usb/media/sn9c102.h | |||
@@ -56,7 +56,7 @@ | |||
56 | #define SN9C102_MODULE_AUTHOR "(C) 2004-2005 Luca Risolia" | 56 | #define SN9C102_MODULE_AUTHOR "(C) 2004-2005 Luca Risolia" |
57 | #define SN9C102_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" | 57 | #define SN9C102_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" |
58 | #define SN9C102_MODULE_LICENSE "GPL" | 58 | #define SN9C102_MODULE_LICENSE "GPL" |
59 | #define SN9C102_MODULE_VERSION "1:1.24" | 59 | #define SN9C102_MODULE_VERSION "1:1.24a" |
60 | #define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 24) | 60 | #define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 24) |
61 | 61 | ||
62 | enum sn9c102_bridge { | 62 | enum sn9c102_bridge { |
diff --git a/drivers/usb/media/sn9c102_core.c b/drivers/usb/media/sn9c102_core.c index 31d57400d5be..cf8cfbabefde 100644 --- a/drivers/usb/media/sn9c102_core.c +++ b/drivers/usb/media/sn9c102_core.c | |||
@@ -429,7 +429,7 @@ sn9c102_i2c_try_read(struct sn9c102_device* cam, | |||
429 | } | 429 | } |
430 | 430 | ||
431 | 431 | ||
432 | static int | 432 | int |
433 | sn9c102_i2c_try_write(struct sn9c102_device* cam, | 433 | sn9c102_i2c_try_write(struct sn9c102_device* cam, |
434 | struct sn9c102_sensor* sensor, u8 address, u8 value) | 434 | struct sn9c102_sensor* sensor, u8 address, u8 value) |
435 | { | 435 | { |
diff --git a/drivers/usb/media/sn9c102_ov7630.c b/drivers/usb/media/sn9c102_ov7630.c new file mode 100644 index 000000000000..d27c5aedeaf8 --- /dev/null +++ b/drivers/usb/media/sn9c102_ov7630.c | |||
@@ -0,0 +1,394 @@ | |||
1 | /*************************************************************************** | ||
2 | * Plug-in for OV7630 image sensor connected to the SN9C10x PC Camera * | ||
3 | * Controllers * | ||
4 | * * | ||
5 | * Copyright (C) 2005 by Luca Risolia <luca.risolia@studio.unibo.it> * | ||
6 | * * | ||
7 | * This program is free software; you can redistribute it and/or modify * | ||
8 | * it under the terms of the GNU General Public License as published by * | ||
9 | * the Free Software Foundation; either version 2 of the License, or * | ||
10 | * (at your option) any later version. * | ||
11 | * * | ||
12 | * This program is distributed in the hope that it will be useful, * | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
15 | * GNU General Public License for more details. * | ||
16 | * * | ||
17 | * You should have received a copy of the GNU General Public License * | ||
18 | * along with this program; if not, write to the Free Software * | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * | ||
20 | ***************************************************************************/ | ||
21 | |||
22 | #include "sn9c102_sensor.h" | ||
23 | |||
24 | |||
25 | static struct sn9c102_sensor ov7630; | ||
26 | |||
27 | |||
28 | static int ov7630_init(struct sn9c102_device* cam) | ||
29 | { | ||
30 | int err = 0; | ||
31 | |||
32 | err += sn9c102_write_reg(cam, 0x00, 0x14); | ||
33 | err += sn9c102_write_reg(cam, 0x60, 0x17); | ||
34 | err += sn9c102_write_reg(cam, 0x0f, 0x18); | ||
35 | err += sn9c102_write_reg(cam, 0x50, 0x19); | ||
36 | |||
37 | err += sn9c102_i2c_write(cam, 0x12, 0x8d); | ||
38 | err += sn9c102_i2c_write(cam, 0x11, 0x00); | ||
39 | err += sn9c102_i2c_write(cam, 0x15, 0x34); | ||
40 | err += sn9c102_i2c_write(cam, 0x16, 0x03); | ||
41 | err += sn9c102_i2c_write(cam, 0x17, 0x1c); | ||
42 | err += sn9c102_i2c_write(cam, 0x18, 0xbd); | ||
43 | err += sn9c102_i2c_write(cam, 0x19, 0x06); | ||
44 | err += sn9c102_i2c_write(cam, 0x1a, 0xf6); | ||
45 | err += sn9c102_i2c_write(cam, 0x1b, 0x04); | ||
46 | err += sn9c102_i2c_write(cam, 0x20, 0x44); | ||
47 | err += sn9c102_i2c_write(cam, 0x23, 0xee); | ||
48 | err += sn9c102_i2c_write(cam, 0x26, 0xa0); | ||
49 | err += sn9c102_i2c_write(cam, 0x27, 0x9a); | ||
50 | err += sn9c102_i2c_write(cam, 0x28, 0x20); | ||
51 | err += sn9c102_i2c_write(cam, 0x29, 0x30); | ||
52 | err += sn9c102_i2c_write(cam, 0x2f, 0x3d); | ||
53 | err += sn9c102_i2c_write(cam, 0x30, 0x24); | ||
54 | err += sn9c102_i2c_write(cam, 0x32, 0x86); | ||
55 | err += sn9c102_i2c_write(cam, 0x60, 0xa9); | ||
56 | err += sn9c102_i2c_write(cam, 0x61, 0x42); | ||
57 | err += sn9c102_i2c_write(cam, 0x65, 0x00); | ||
58 | err += sn9c102_i2c_write(cam, 0x69, 0x38); | ||
59 | err += sn9c102_i2c_write(cam, 0x6f, 0x88); | ||
60 | err += sn9c102_i2c_write(cam, 0x70, 0x0b); | ||
61 | err += sn9c102_i2c_write(cam, 0x71, 0x00); | ||
62 | err += sn9c102_i2c_write(cam, 0x74, 0x21); | ||
63 | err += sn9c102_i2c_write(cam, 0x7d, 0xf7); | ||
64 | |||
65 | return err; | ||
66 | } | ||
67 | |||
68 | |||
69 | static int ov7630_set_ctrl(struct sn9c102_device* cam, | ||
70 | const struct v4l2_control* ctrl) | ||
71 | { | ||
72 | int err = 0; | ||
73 | |||
74 | switch (ctrl->id) { | ||
75 | case V4L2_CID_EXPOSURE: | ||
76 | err += sn9c102_i2c_write(cam, 0x10, ctrl->value >> 2); | ||
77 | err += sn9c102_i2c_write(cam, 0x76, ctrl->value & 0x03); | ||
78 | break; | ||
79 | case V4L2_CID_RED_BALANCE: | ||
80 | err += sn9c102_i2c_write(cam, 0x02, ctrl->value); | ||
81 | break; | ||
82 | case V4L2_CID_BLUE_BALANCE: | ||
83 | err += sn9c102_i2c_write(cam, 0x03, ctrl->value); | ||
84 | break; | ||
85 | case V4L2_CID_GAIN: | ||
86 | err += sn9c102_i2c_write(cam, 0x00, ctrl->value); | ||
87 | break; | ||
88 | case V4L2_CID_CONTRAST: | ||
89 | err += ctrl->value ? sn9c102_i2c_write(cam, 0x05, | ||
90 | (ctrl->value-1) | 0x20) | ||
91 | : sn9c102_i2c_write(cam, 0x05, 0x00); | ||
92 | break; | ||
93 | case V4L2_CID_BRIGHTNESS: | ||
94 | err += sn9c102_i2c_write(cam, 0x06, ctrl->value); | ||
95 | break; | ||
96 | case V4L2_CID_SATURATION: | ||
97 | err += sn9c102_i2c_write(cam, 0x03, ctrl->value << 4); | ||
98 | break; | ||
99 | case V4L2_CID_HUE: | ||
100 | err += ctrl->value ? sn9c102_i2c_write(cam, 0x04, | ||
101 | (ctrl->value-1) | 0x20) | ||
102 | : sn9c102_i2c_write(cam, 0x04, 0x00); | ||
103 | break; | ||
104 | case V4L2_CID_DO_WHITE_BALANCE: | ||
105 | err += sn9c102_i2c_write(cam, 0x0c, ctrl->value); | ||
106 | break; | ||
107 | case V4L2_CID_WHITENESS: | ||
108 | err += sn9c102_i2c_write(cam, 0x0d, ctrl->value); | ||
109 | break; | ||
110 | case V4L2_CID_AUTO_WHITE_BALANCE: | ||
111 | err += sn9c102_i2c_write(cam, 0x12, (ctrl->value << 2) | 0x09); | ||
112 | break; | ||
113 | case V4L2_CID_AUTOGAIN: | ||
114 | err += sn9c102_i2c_write(cam, 0x13, ctrl->value); | ||
115 | break; | ||
116 | case V4L2_CID_VFLIP: | ||
117 | err += sn9c102_i2c_write(cam, 0x75, 0x0e | (ctrl->value << 7)); | ||
118 | break; | ||
119 | case V4L2_CID_BLACK_LEVEL: | ||
120 | err += sn9c102_i2c_write(cam, 0x25, ctrl->value); | ||
121 | break; | ||
122 | case SN9C102_V4L2_CID_BRIGHT_LEVEL: | ||
123 | err += sn9c102_i2c_write(cam, 0x24, ctrl->value); | ||
124 | break; | ||
125 | case SN9C102_V4L2_CID_GAMMA: | ||
126 | err += sn9c102_i2c_write(cam, 0x14, (ctrl->value << 2) | 0x80); | ||
127 | break; | ||
128 | case SN9C102_V4L2_CID_BAND_FILTER: | ||
129 | err += sn9c102_i2c_write(cam, 0x2d, ctrl->value << 2); | ||
130 | break; | ||
131 | default: | ||
132 | return -EINVAL; | ||
133 | } | ||
134 | |||
135 | return err ? -EIO : 0; | ||
136 | } | ||
137 | |||
138 | |||
139 | static int ov7630_set_crop(struct sn9c102_device* cam, | ||
140 | const struct v4l2_rect* rect) | ||
141 | { | ||
142 | struct sn9c102_sensor* s = &ov7630; | ||
143 | int err = 0; | ||
144 | u8 v_start = (u8)(rect->top - s->cropcap.bounds.top) + 1; | ||
145 | |||
146 | err += sn9c102_write_reg(cam, v_start, 0x13); | ||
147 | |||
148 | return err; | ||
149 | } | ||
150 | |||
151 | |||
152 | static int ov7630_set_pix_format(struct sn9c102_device* cam, | ||
153 | const struct v4l2_pix_format* pix) | ||
154 | { | ||
155 | int err = 0; | ||
156 | |||
157 | if (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) | ||
158 | err += sn9c102_write_reg(cam, 0x20, 0x19); | ||
159 | else | ||
160 | err += sn9c102_write_reg(cam, 0x50, 0x19); | ||
161 | |||
162 | return err; | ||
163 | } | ||
164 | |||
165 | |||
166 | static struct sn9c102_sensor ov7630 = { | ||
167 | .name = "OV7630", | ||
168 | .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>", | ||
169 | .sysfs_ops = SN9C102_I2C_WRITE, | ||
170 | .frequency = SN9C102_I2C_100KHZ, | ||
171 | .interface = SN9C102_I2C_2WIRES, | ||
172 | .i2c_slave_id = 0x21, | ||
173 | .init = &ov7630_init, | ||
174 | .qctrl = { | ||
175 | { | ||
176 | .id = V4L2_CID_GAIN, | ||
177 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
178 | .name = "global gain", | ||
179 | .minimum = 0x00, | ||
180 | .maximum = 0x3f, | ||
181 | .step = 0x01, | ||
182 | .default_value = 0x14, | ||
183 | .flags = 0, | ||
184 | }, | ||
185 | { | ||
186 | .id = V4L2_CID_HUE, | ||
187 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
188 | .name = "hue", | ||
189 | .minimum = 0x00, | ||
190 | .maximum = 0x1f+1, | ||
191 | .step = 0x01, | ||
192 | .default_value = 0x00, | ||
193 | .flags = 0, | ||
194 | }, | ||
195 | { | ||
196 | .id = V4L2_CID_SATURATION, | ||
197 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
198 | .name = "saturation", | ||
199 | .minimum = 0x00, | ||
200 | .maximum = 0x0f, | ||
201 | .step = 0x01, | ||
202 | .default_value = 0x08, | ||
203 | .flags = 0, | ||
204 | }, | ||
205 | { | ||
206 | .id = V4L2_CID_CONTRAST, | ||
207 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
208 | .name = "contrast", | ||
209 | .minimum = 0x00, | ||
210 | .maximum = 0x1f+1, | ||
211 | .step = 0x01, | ||
212 | .default_value = 0x00, | ||
213 | .flags = 0, | ||
214 | }, | ||
215 | { | ||
216 | .id = V4L2_CID_EXPOSURE, | ||
217 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
218 | .name = "exposure", | ||
219 | .minimum = 0x000, | ||
220 | .maximum = 0x3ff, | ||
221 | .step = 0x001, | ||
222 | .default_value = 0x83<<2, | ||
223 | .flags = 0, | ||
224 | }, | ||
225 | { | ||
226 | .id = V4L2_CID_RED_BALANCE, | ||
227 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
228 | .name = "red balance", | ||
229 | .minimum = 0x00, | ||
230 | .maximum = 0xff, | ||
231 | .step = 0x01, | ||
232 | .default_value = 0x3a, | ||
233 | .flags = 0, | ||
234 | }, | ||
235 | { | ||
236 | .id = V4L2_CID_BLUE_BALANCE, | ||
237 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
238 | .name = "blue balance", | ||
239 | .minimum = 0x00, | ||
240 | .maximum = 0xff, | ||
241 | .step = 0x01, | ||
242 | .default_value = 0x77, | ||
243 | .flags = 0, | ||
244 | }, | ||
245 | { | ||
246 | .id = V4L2_CID_BRIGHTNESS, | ||
247 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
248 | .name = "brightness", | ||
249 | .minimum = 0x00, | ||
250 | .maximum = 0xff, | ||
251 | .step = 0x01, | ||
252 | .default_value = 0xa0, | ||
253 | .flags = 0, | ||
254 | }, | ||
255 | { | ||
256 | .id = V4L2_CID_DO_WHITE_BALANCE, | ||
257 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
258 | .name = "white balance background: blue", | ||
259 | .minimum = 0x00, | ||
260 | .maximum = 0x3f, | ||
261 | .step = 0x01, | ||
262 | .default_value = 0x20, | ||
263 | .flags = 0, | ||
264 | }, | ||
265 | { | ||
266 | .id = V4L2_CID_WHITENESS, | ||
267 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
268 | .name = "white balance background: red", | ||
269 | .minimum = 0x00, | ||
270 | .maximum = 0x3f, | ||
271 | .step = 0x01, | ||
272 | .default_value = 0x20, | ||
273 | .flags = 0, | ||
274 | }, | ||
275 | { | ||
276 | .id = V4L2_CID_AUTO_WHITE_BALANCE, | ||
277 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
278 | .name = "auto white balance", | ||
279 | .minimum = 0x00, | ||
280 | .maximum = 0x01, | ||
281 | .step = 0x01, | ||
282 | .default_value = 0x01, | ||
283 | .flags = 0, | ||
284 | }, | ||
285 | { | ||
286 | .id = V4L2_CID_AUTOGAIN, | ||
287 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
288 | .name = "gain & exposure mode", | ||
289 | .minimum = 0x00, | ||
290 | .maximum = 0x03, | ||
291 | .step = 0x01, | ||
292 | .default_value = 0x00, | ||
293 | .flags = 0, | ||
294 | }, | ||
295 | { | ||
296 | .id = V4L2_CID_VFLIP, | ||
297 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
298 | .name = "vertical flip", | ||
299 | .minimum = 0x00, | ||
300 | .maximum = 0x01, | ||
301 | .step = 0x01, | ||
302 | .default_value = 0x01, | ||
303 | .flags = 0, | ||
304 | }, | ||
305 | { | ||
306 | .id = V4L2_CID_BLACK_LEVEL, | ||
307 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
308 | .name = "black pixel ratio", | ||
309 | .minimum = 0x01, | ||
310 | .maximum = 0x9a, | ||
311 | .step = 0x01, | ||
312 | .default_value = 0x8a, | ||
313 | .flags = 0, | ||
314 | }, | ||
315 | { | ||
316 | .id = SN9C102_V4L2_CID_BRIGHT_LEVEL, | ||
317 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
318 | .name = "bright pixel ratio", | ||
319 | .minimum = 0x01, | ||
320 | .maximum = 0x9a, | ||
321 | .step = 0x01, | ||
322 | .default_value = 0x10, | ||
323 | .flags = 0, | ||
324 | }, | ||
325 | { | ||
326 | .id = SN9C102_V4L2_CID_BAND_FILTER, | ||
327 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
328 | .name = "band filter", | ||
329 | .minimum = 0x00, | ||
330 | .maximum = 0x01, | ||
331 | .step = 0x01, | ||
332 | .default_value = 0x00, | ||
333 | .flags = 0, | ||
334 | }, | ||
335 | { | ||
336 | .id = SN9C102_V4L2_CID_GAMMA, | ||
337 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
338 | .name = "rgb gamma", | ||
339 | .minimum = 0x00, | ||
340 | .maximum = 0x01, | ||
341 | .step = 0x01, | ||
342 | .default_value = 0x00, | ||
343 | .flags = 0, | ||
344 | }, | ||
345 | }, | ||
346 | .set_ctrl = &ov7630_set_ctrl, | ||
347 | .cropcap = { | ||
348 | .bounds = { | ||
349 | .left = 0, | ||
350 | .top = 0, | ||
351 | .width = 640, | ||
352 | .height = 480, | ||
353 | }, | ||
354 | .defrect = { | ||
355 | .left = 0, | ||
356 | .top = 0, | ||
357 | .width = 640, | ||
358 | .height = 480, | ||
359 | }, | ||
360 | }, | ||
361 | .set_crop = &ov7630_set_crop, | ||
362 | .pix_format = { | ||
363 | .width = 640, | ||
364 | .height = 480, | ||
365 | .pixelformat = V4L2_PIX_FMT_SBGGR8, | ||
366 | .priv = 8, | ||
367 | }, | ||
368 | .set_pix_format = &ov7630_set_pix_format | ||
369 | }; | ||
370 | |||
371 | |||
372 | int sn9c102_probe_ov7630(struct sn9c102_device* cam) | ||
373 | { | ||
374 | int err = 0; | ||
375 | |||
376 | sn9c102_attach_sensor(cam, &ov7630); | ||
377 | |||
378 | if (le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x608f && | ||
379 | le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x602c) | ||
380 | return -ENODEV; | ||
381 | |||
382 | err += sn9c102_write_reg(cam, 0x01, 0x01); | ||
383 | err += sn9c102_write_reg(cam, 0x00, 0x01); | ||
384 | err += sn9c102_write_reg(cam, 0x28, 0x17); | ||
385 | |||
386 | if (err) | ||
387 | return -EIO; | ||
388 | |||
389 | err += sn9c102_i2c_write(cam, 0x0b, 0); | ||
390 | if (err) | ||
391 | return -ENODEV; | ||
392 | |||
393 | return 0; | ||
394 | } | ||
diff --git a/drivers/usb/media/sn9c102_sensor.h b/drivers/usb/media/sn9c102_sensor.h index 6a7adebcb4bf..a45166c3488c 100644 --- a/drivers/usb/media/sn9c102_sensor.h +++ b/drivers/usb/media/sn9c102_sensor.h | |||
@@ -64,6 +64,7 @@ struct sn9c102_sensor; | |||
64 | */ | 64 | */ |
65 | extern int sn9c102_probe_hv7131d(struct sn9c102_device* cam); | 65 | extern int sn9c102_probe_hv7131d(struct sn9c102_device* cam); |
66 | extern int sn9c102_probe_mi0343(struct sn9c102_device* cam); | 66 | extern int sn9c102_probe_mi0343(struct sn9c102_device* cam); |
67 | extern int sn9c102_probe_ov7630(struct sn9c102_device* cam); | ||
67 | extern int sn9c102_probe_pas106b(struct sn9c102_device* cam); | 68 | extern int sn9c102_probe_pas106b(struct sn9c102_device* cam); |
68 | extern int sn9c102_probe_pas202bcb(struct sn9c102_device* cam); | 69 | extern int sn9c102_probe_pas202bcb(struct sn9c102_device* cam); |
69 | extern int sn9c102_probe_tas5110c1b(struct sn9c102_device* cam); | 70 | extern int sn9c102_probe_tas5110c1b(struct sn9c102_device* cam); |
@@ -80,6 +81,7 @@ static int (*sn9c102_sensor_table[])(struct sn9c102_device*) = { \ | |||
80 | &sn9c102_probe_pas106b, /* strong detection based on SENSOR ids */ \ | 81 | &sn9c102_probe_pas106b, /* strong detection based on SENSOR ids */ \ |
81 | &sn9c102_probe_pas202bcb, /* strong detection based on SENSOR ids */ \ | 82 | &sn9c102_probe_pas202bcb, /* strong detection based on SENSOR ids */ \ |
82 | &sn9c102_probe_hv7131d, /* strong detection based on SENSOR ids */ \ | 83 | &sn9c102_probe_hv7131d, /* strong detection based on SENSOR ids */ \ |
84 | &sn9c102_probe_ov7630, /* detection mostly based on USB pid/vid */ \ | ||
83 | &sn9c102_probe_tas5110c1b, /* detection based on USB pid/vid */ \ | 85 | &sn9c102_probe_tas5110c1b, /* detection based on USB pid/vid */ \ |
84 | &sn9c102_probe_tas5130d1b, /* detection based on USB pid/vid */ \ | 86 | &sn9c102_probe_tas5130d1b, /* detection based on USB pid/vid */ \ |
85 | NULL, \ | 87 | NULL, \ |
@@ -103,7 +105,8 @@ static const struct usb_device_id sn9c102_id_table[] = { \ | |||
103 | { USB_DEVICE(0x0c45, 0x6029), }, /* PAS106B */ \ | 105 | { USB_DEVICE(0x0c45, 0x6029), }, /* PAS106B */ \ |
104 | { USB_DEVICE(0x0c45, 0x602a), }, /* HV7131D */ \ | 106 | { USB_DEVICE(0x0c45, 0x602a), }, /* HV7131D */ \ |
105 | { USB_DEVICE(0x0c45, 0x602b), }, /* MI-0343 */ \ | 107 | { USB_DEVICE(0x0c45, 0x602b), }, /* MI-0343 */ \ |
106 | { USB_DEVICE(0x0c45, 0x602c), }, /* OV7620 */ \ | 108 | { USB_DEVICE(0x0c45, 0x602c), }, /* OV7630 */ \ |
109 | { USB_DEVICE(0x0c45, 0x602d), }, \ | ||
107 | { USB_DEVICE(0x0c45, 0x6030), }, /* MI03x */ \ | 110 | { USB_DEVICE(0x0c45, 0x6030), }, /* MI03x */ \ |
108 | { USB_DEVICE(0x0c45, 0x6080), }, \ | 111 | { USB_DEVICE(0x0c45, 0x6080), }, \ |
109 | { USB_DEVICE(0x0c45, 0x6082), }, /* MI0343 and MI0360 */ \ | 112 | { USB_DEVICE(0x0c45, 0x6082), }, /* MI0343 and MI0360 */ \ |
@@ -145,6 +148,8 @@ static const struct usb_device_id sn9c102_id_table[] = { \ | |||
145 | */ | 148 | */ |
146 | 149 | ||
147 | /* The "try" I2C I/O versions are used when probing the sensor */ | 150 | /* The "try" I2C I/O versions are used when probing the sensor */ |
151 | extern int sn9c102_i2c_try_write(struct sn9c102_device*,struct sn9c102_sensor*, | ||
152 | u8 address, u8 value); | ||
148 | extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*, | 153 | extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*, |
149 | u8 address); | 154 | u8 address); |
150 | 155 | ||
@@ -201,6 +206,8 @@ enum sn9c102_i2c_interface { | |||
201 | SN9C102_I2C_3WIRES, | 206 | SN9C102_I2C_3WIRES, |
202 | }; | 207 | }; |
203 | 208 | ||
209 | #define SN9C102_MAX_CTRLS V4L2_CID_LASTP1-V4L2_CID_BASE+10 | ||
210 | |||
204 | struct sn9c102_sensor { | 211 | struct sn9c102_sensor { |
205 | char name[32], /* sensor name */ | 212 | char name[32], /* sensor name */ |
206 | maintainer[64]; /* name of the mantainer <email> */ | 213 | maintainer[64]; /* name of the mantainer <email> */ |
@@ -243,7 +250,7 @@ struct sn9c102_sensor { | |||
243 | sensor according to the default configuration structures below. | 250 | sensor according to the default configuration structures below. |
244 | */ | 251 | */ |
245 | 252 | ||
246 | struct v4l2_queryctrl qctrl[V4L2_CID_LASTP1-V4L2_CID_BASE]; | 253 | struct v4l2_queryctrl qctrl[SN9C102_MAX_CTRLS]; |
247 | /* | 254 | /* |
248 | Optional list of default controls, defined as indicated in the | 255 | Optional list of default controls, defined as indicated in the |
249 | V4L2 API. Menu type controls are not handled by this interface. | 256 | V4L2 API. Menu type controls are not handled by this interface. |
@@ -356,7 +363,7 @@ struct sn9c102_sensor { | |||
356 | core module to store successfully updated values of the above | 363 | core module to store successfully updated values of the above |
357 | settings, for rollbacks..etc..in case of errors during atomic I/O | 364 | settings, for rollbacks..etc..in case of errors during atomic I/O |
358 | */ | 365 | */ |
359 | struct v4l2_queryctrl _qctrl[V4L2_CID_LASTP1-V4L2_CID_BASE]; | 366 | struct v4l2_queryctrl _qctrl[SN9C102_MAX_CTRLS]; |
360 | struct v4l2_rect _rect; | 367 | struct v4l2_rect _rect; |
361 | }; | 368 | }; |
362 | 369 | ||
@@ -367,5 +374,8 @@ struct sn9c102_sensor { | |||
367 | #define SN9C102_V4L2_CID_GREEN_BALANCE V4L2_CID_PRIVATE_BASE + 1 | 374 | #define SN9C102_V4L2_CID_GREEN_BALANCE V4L2_CID_PRIVATE_BASE + 1 |
368 | #define SN9C102_V4L2_CID_RESET_LEVEL V4L2_CID_PRIVATE_BASE + 2 | 375 | #define SN9C102_V4L2_CID_RESET_LEVEL V4L2_CID_PRIVATE_BASE + 2 |
369 | #define SN9C102_V4L2_CID_PIXEL_BIAS_VOLTAGE V4L2_CID_PRIVATE_BASE + 3 | 376 | #define SN9C102_V4L2_CID_PIXEL_BIAS_VOLTAGE V4L2_CID_PRIVATE_BASE + 3 |
377 | #define SN9C102_V4L2_CID_GAMMA V4L2_CID_PRIVATE_BASE + 4 | ||
378 | #define SN9C102_V4L2_CID_BAND_FILTER V4L2_CID_PRIVATE_BASE + 5 | ||
379 | #define SN9C102_V4L2_CID_BRIGHT_LEVEL V4L2_CID_PRIVATE_BASE + 6 | ||
370 | 380 | ||
371 | #endif /* _SN9C102_SENSOR_H_ */ | 381 | #endif /* _SN9C102_SENSOR_H_ */ |
diff --git a/drivers/usb/media/sn9c102_tas5110c1b.c b/drivers/usb/media/sn9c102_tas5110c1b.c index 690d62192273..8775999b5aff 100644 --- a/drivers/usb/media/sn9c102_tas5110c1b.c +++ b/drivers/usb/media/sn9c102_tas5110c1b.c | |||
@@ -24,8 +24,6 @@ | |||
24 | 24 | ||
25 | static struct sn9c102_sensor tas5110c1b; | 25 | static struct sn9c102_sensor tas5110c1b; |
26 | 26 | ||
27 | static struct v4l2_control tas5110c1b_gain; | ||
28 | |||
29 | 27 | ||
30 | static int tas5110c1b_init(struct sn9c102_device* cam) | 28 | static int tas5110c1b_init(struct sn9c102_device* cam) |
31 | { | 29 | { |
@@ -46,21 +44,6 @@ static int tas5110c1b_init(struct sn9c102_device* cam) | |||
46 | } | 44 | } |
47 | 45 | ||
48 | 46 | ||
49 | static int tas5110c1b_get_ctrl(struct sn9c102_device* cam, | ||
50 | struct v4l2_control* ctrl) | ||
51 | { | ||
52 | switch (ctrl->id) { | ||
53 | case V4L2_CID_GAIN: | ||
54 | ctrl->value = tas5110c1b_gain.value; | ||
55 | break; | ||
56 | default: | ||
57 | return -EINVAL; | ||
58 | } | ||
59 | |||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | |||
64 | static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, | 47 | static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, |
65 | const struct v4l2_control* ctrl) | 48 | const struct v4l2_control* ctrl) |
66 | { | 49 | { |
@@ -68,8 +51,7 @@ static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, | |||
68 | 51 | ||
69 | switch (ctrl->id) { | 52 | switch (ctrl->id) { |
70 | case V4L2_CID_GAIN: | 53 | case V4L2_CID_GAIN: |
71 | if (!(err += sn9c102_i2c_write(cam, 0x20, 0xf6 - ctrl->value))) | 54 | err += sn9c102_i2c_write(cam, 0x20, 0xf6 - ctrl->value); |
72 | tas5110c1b_gain.value = ctrl->value; | ||
73 | break; | 55 | break; |
74 | default: | 56 | default: |
75 | return -EINVAL; | 57 | return -EINVAL; |
@@ -147,7 +129,6 @@ static struct sn9c102_sensor tas5110c1b = { | |||
147 | .height = 288, | 129 | .height = 288, |
148 | }, | 130 | }, |
149 | }, | 131 | }, |
150 | .get_ctrl = &tas5110c1b_get_ctrl, | ||
151 | .set_crop = &tas5110c1b_set_crop, | 132 | .set_crop = &tas5110c1b_set_crop, |
152 | .pix_format = { | 133 | .pix_format = { |
153 | .width = 352, | 134 | .width = 352, |
diff --git a/drivers/usb/media/sn9c102_tas5130d1b.c b/drivers/usb/media/sn9c102_tas5130d1b.c index b378e941bbe8..927eafdd8c73 100644 --- a/drivers/usb/media/sn9c102_tas5130d1b.c +++ b/drivers/usb/media/sn9c102_tas5130d1b.c | |||
@@ -24,8 +24,6 @@ | |||
24 | 24 | ||
25 | static struct sn9c102_sensor tas5130d1b; | 25 | static struct sn9c102_sensor tas5130d1b; |
26 | 26 | ||
27 | static struct v4l2_control tas5130d1b_gain, tas5130d1b_exposure; | ||
28 | |||
29 | 27 | ||
30 | static int tas5130d1b_init(struct sn9c102_device* cam) | 28 | static int tas5130d1b_init(struct sn9c102_device* cam) |
31 | { | 29 | { |
@@ -44,24 +42,6 @@ static int tas5130d1b_init(struct sn9c102_device* cam) | |||
44 | } | 42 | } |
45 | 43 | ||
46 | 44 | ||
47 | static int tas5130d1b_get_ctrl(struct sn9c102_device* cam, | ||
48 | struct v4l2_control* ctrl) | ||
49 | { | ||
50 | switch (ctrl->id) { | ||
51 | case V4L2_CID_GAIN: | ||
52 | ctrl->value = tas5130d1b_gain.value; | ||
53 | break; | ||
54 | case V4L2_CID_EXPOSURE: | ||
55 | ctrl->value = tas5130d1b_exposure.value; | ||
56 | break; | ||
57 | default: | ||
58 | return -EINVAL; | ||
59 | } | ||
60 | |||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | |||
65 | static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, | 45 | static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, |
66 | const struct v4l2_control* ctrl) | 46 | const struct v4l2_control* ctrl) |
67 | { | 47 | { |
@@ -69,12 +49,10 @@ static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, | |||
69 | 49 | ||
70 | switch (ctrl->id) { | 50 | switch (ctrl->id) { |
71 | case V4L2_CID_GAIN: | 51 | case V4L2_CID_GAIN: |
72 | if (!(err += sn9c102_i2c_write(cam, 0x20, 0xf6 - ctrl->value))) | 52 | err += sn9c102_i2c_write(cam, 0x20, 0xf6 - ctrl->value); |
73 | tas5130d1b_gain.value = ctrl->value; | ||
74 | break; | 53 | break; |
75 | case V4L2_CID_EXPOSURE: | 54 | case V4L2_CID_EXPOSURE: |
76 | if (!(err += sn9c102_i2c_write(cam, 0x40, 0x47 - ctrl->value))) | 55 | err += sn9c102_i2c_write(cam, 0x40, 0x47 - ctrl->value); |
77 | tas5130d1b_exposure.value = ctrl->value; | ||
78 | break; | 56 | break; |
79 | default: | 57 | default: |
80 | return -EINVAL; | 58 | return -EINVAL; |
@@ -147,7 +125,6 @@ static struct sn9c102_sensor tas5130d1b = { | |||
147 | .flags = 0, | 125 | .flags = 0, |
148 | }, | 126 | }, |
149 | }, | 127 | }, |
150 | .get_ctrl = &tas5130d1b_get_ctrl, | ||
151 | .set_ctrl = &tas5130d1b_set_ctrl, | 128 | .set_ctrl = &tas5130d1b_set_ctrl, |
152 | .cropcap = { | 129 | .cropcap = { |
153 | .bounds = { | 130 | .bounds = { |
diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig index 3a896954b3a9..6649531fa824 100644 --- a/drivers/usb/misc/Kconfig +++ b/drivers/usb/misc/Kconfig | |||
@@ -139,6 +139,16 @@ config USB_IDMOUSE | |||
139 | 139 | ||
140 | source "drivers/usb/misc/sisusbvga/Kconfig" | 140 | source "drivers/usb/misc/sisusbvga/Kconfig" |
141 | 141 | ||
142 | config USB_LD | ||
143 | tristate "USB LD driver" | ||
144 | depends on USB && EXPERIMENTAL | ||
145 | help | ||
146 | This driver is for generic USB devices that use interrupt transfers, | ||
147 | like LD Didactic's USB devices. | ||
148 | |||
149 | To compile this driver as a module, choose M here: the | ||
150 | module will be called ldusb. | ||
151 | |||
142 | config USB_TEST | 152 | config USB_TEST |
143 | tristate "USB testing driver (DEVELOPMENT)" | 153 | tristate "USB testing driver (DEVELOPMENT)" |
144 | depends on USB && USB_DEVICEFS && EXPERIMENTAL | 154 | depends on USB && USB_DEVICEFS && EXPERIMENTAL |
diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile index 4a3814cbd48d..862e40a83689 100644 --- a/drivers/usb/misc/Makefile +++ b/drivers/usb/misc/Makefile | |||
@@ -9,6 +9,7 @@ obj-$(CONFIG_USB_EMI26) += emi26.o | |||
9 | obj-$(CONFIG_USB_EMI62) += emi62.o | 9 | obj-$(CONFIG_USB_EMI62) += emi62.o |
10 | obj-$(CONFIG_USB_IDMOUSE) += idmouse.o | 10 | obj-$(CONFIG_USB_IDMOUSE) += idmouse.o |
11 | obj-$(CONFIG_USB_LCD) += usblcd.o | 11 | obj-$(CONFIG_USB_LCD) += usblcd.o |
12 | obj-$(CONFIG_USB_LD) += ldusb.o | ||
12 | obj-$(CONFIG_USB_LED) += usbled.o | 13 | obj-$(CONFIG_USB_LED) += usbled.o |
13 | obj-$(CONFIG_USB_LEGOTOWER) += legousbtower.o | 14 | obj-$(CONFIG_USB_LEGOTOWER) += legousbtower.o |
14 | obj-$(CONFIG_USB_PHIDGETKIT) += phidgetkit.o | 15 | obj-$(CONFIG_USB_PHIDGETKIT) += phidgetkit.o |
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c new file mode 100644 index 000000000000..66ec88354b93 --- /dev/null +++ b/drivers/usb/misc/ldusb.c | |||
@@ -0,0 +1,794 @@ | |||
1 | /** | ||
2 | * Generic USB driver for report based interrupt in/out devices | ||
3 | * like LD Didactic's USB devices. LD Didactic's USB devices are | ||
4 | * HID devices which do not use HID report definitons (they use | ||
5 | * raw interrupt in and our reports only for communication). | ||
6 | * | ||
7 | * This driver uses a ring buffer for time critical reading of | ||
8 | * interrupt in reports and provides read and write methods for | ||
9 | * raw interrupt reports (similar to the Windows HID driver). | ||
10 | * Devices based on the book USB COMPLETE by Jan Axelson may need | ||
11 | * such a compatibility to the Windows HID driver. | ||
12 | * | ||
13 | * Copyright (C) 2005 Michael Hund <mhund@ld-didactic.de> | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or | ||
16 | * modify it under the terms of the GNU General Public License as | ||
17 | * published by the Free Software Foundation; either version 2 of | ||
18 | * the License, or (at your option) any later version. | ||
19 | * | ||
20 | * Derived from Lego USB Tower driver | ||
21 | * Copyright (C) 2003 David Glance <advidgsf@sourceforge.net> | ||
22 | * 2001-2004 Juergen Stuber <starblue@users.sourceforge.net> | ||
23 | * | ||
24 | * V0.1 (mh) Initial version | ||
25 | * V0.11 (mh) Added raw support for HID 1.0 devices (no interrupt out endpoint) | ||
26 | */ | ||
27 | |||
28 | #include <linux/config.h> | ||
29 | #include <linux/kernel.h> | ||
30 | #include <linux/errno.h> | ||
31 | #include <linux/init.h> | ||
32 | #include <linux/slab.h> | ||
33 | #include <linux/module.h> | ||
34 | |||
35 | #include <asm/uaccess.h> | ||
36 | #include <linux/input.h> | ||
37 | #include <linux/usb.h> | ||
38 | #include <linux/poll.h> | ||
39 | |||
40 | /* Define these values to match your devices */ | ||
41 | #define USB_VENDOR_ID_LD 0x0f11 /* USB Vendor ID of LD Didactic GmbH */ | ||
42 | #define USB_DEVICE_ID_CASSY 0x1000 /* USB Product ID for all CASSY-S modules */ | ||
43 | #define USB_DEVICE_ID_POCKETCASSY 0x1010 /* USB Product ID for Pocket-CASSY */ | ||
44 | #define USB_DEVICE_ID_MOBILECASSY 0x1020 /* USB Product ID for Mobile-CASSY */ | ||
45 | #define USB_DEVICE_ID_JWM 0x1080 /* USB Product ID for Joule and Wattmeter */ | ||
46 | #define USB_DEVICE_ID_DMMP 0x1081 /* USB Product ID for Digital Multimeter P (reserved) */ | ||
47 | #define USB_DEVICE_ID_UMIP 0x1090 /* USB Product ID for UMI P */ | ||
48 | #define USB_DEVICE_ID_VIDEOCOM 0x1200 /* USB Product ID for VideoCom */ | ||
49 | #define USB_DEVICE_ID_COM3LAB 0x2000 /* USB Product ID for COM3LAB */ | ||
50 | #define USB_DEVICE_ID_TELEPORT 0x2010 /* USB Product ID for Terminal Adapter */ | ||
51 | #define USB_DEVICE_ID_NETWORKANALYSER 0x2020 /* USB Product ID for Network Analyser */ | ||
52 | #define USB_DEVICE_ID_POWERCONTROL 0x2030 /* USB Product ID for Controlling device for Power Electronics */ | ||
53 | |||
54 | #define USB_VENDOR_ID_VERNIER 0x08f7 | ||
55 | #define USB_DEVICE_ID_VERNIER_LABPRO 0x0001 | ||
56 | #define USB_DEVICE_ID_VERNIER_GOTEMP 0x0002 | ||
57 | #define USB_DEVICE_ID_VERNIER_SKIP 0x0003 | ||
58 | #define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004 | ||
59 | |||
60 | |||
61 | #ifdef CONFIG_USB_DYNAMIC_MINORS | ||
62 | #define USB_LD_MINOR_BASE 0 | ||
63 | #else | ||
64 | #define USB_LD_MINOR_BASE 176 | ||
65 | #endif | ||
66 | |||
67 | /* table of devices that work with this driver */ | ||
68 | static struct usb_device_id ld_usb_table [] = { | ||
69 | { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_CASSY) }, | ||
70 | { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_POCKETCASSY) }, | ||
71 | { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_MOBILECASSY) }, | ||
72 | { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_JWM) }, | ||
73 | { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_DMMP) }, | ||
74 | { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_UMIP) }, | ||
75 | { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_VIDEOCOM) }, | ||
76 | { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_COM3LAB) }, | ||
77 | { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_TELEPORT) }, | ||
78 | { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_NETWORKANALYSER) }, | ||
79 | { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_POWERCONTROL) }, | ||
80 | { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) }, | ||
81 | { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) }, | ||
82 | { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, | ||
83 | { USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS) }, | ||
84 | { } /* Terminating entry */ | ||
85 | }; | ||
86 | MODULE_DEVICE_TABLE(usb, ld_usb_table); | ||
87 | MODULE_VERSION("V0.11"); | ||
88 | MODULE_AUTHOR("Michael Hund <mhund@ld-didactic.de>"); | ||
89 | MODULE_DESCRIPTION("LD USB Driver"); | ||
90 | MODULE_LICENSE("GPL"); | ||
91 | MODULE_SUPPORTED_DEVICE("LD USB Devices"); | ||
92 | |||
93 | #ifdef CONFIG_USB_DEBUG | ||
94 | static int debug = 1; | ||
95 | #else | ||
96 | static int debug = 0; | ||
97 | #endif | ||
98 | |||
99 | /* Use our own dbg macro */ | ||
100 | #define dbg_info(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0) | ||
101 | |||
102 | /* Module parameters */ | ||
103 | module_param(debug, int, S_IRUGO | S_IWUSR); | ||
104 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | ||
105 | |||
106 | /* All interrupt in transfers are collected in a ring buffer to | ||
107 | * avoid racing conditions and get better performance of the driver. | ||
108 | */ | ||
109 | static int ring_buffer_size = 128; | ||
110 | module_param(ring_buffer_size, int, 0); | ||
111 | MODULE_PARM_DESC(ring_buffer_size, "Read ring buffer size in reports"); | ||
112 | |||
113 | /* The write_buffer can contain more than one interrupt out transfer. | ||
114 | */ | ||
115 | static int write_buffer_size = 10; | ||
116 | module_param(write_buffer_size, int, 0); | ||
117 | MODULE_PARM_DESC(write_buffer_size, "Write buffer size in reports"); | ||
118 | |||
119 | /* As of kernel version 2.6.4 ehci-hcd uses an | ||
120 | * "only one interrupt transfer per frame" shortcut | ||
121 | * to simplify the scheduling of periodic transfers. | ||
122 | * This conflicts with our standard 1ms intervals for in and out URBs. | ||
123 | * We use default intervals of 2ms for in and 2ms for out transfers, | ||
124 | * which should be fast enough. | ||
125 | * Increase the interval to allow more devices that do interrupt transfers, | ||
126 | * or set to 1 to use the standard interval from the endpoint descriptors. | ||
127 | */ | ||
128 | static int min_interrupt_in_interval = 2; | ||
129 | module_param(min_interrupt_in_interval, int, 0); | ||
130 | MODULE_PARM_DESC(min_interrupt_in_interval, "Minimum interrupt in interval in ms"); | ||
131 | |||
132 | static int min_interrupt_out_interval = 2; | ||
133 | module_param(min_interrupt_out_interval, int, 0); | ||
134 | MODULE_PARM_DESC(min_interrupt_out_interval, "Minimum interrupt out interval in ms"); | ||
135 | |||
136 | /* Structure to hold all of our device specific stuff */ | ||
137 | struct ld_usb { | ||
138 | struct semaphore sem; /* locks this structure */ | ||
139 | struct usb_interface* intf; /* save off the usb interface pointer */ | ||
140 | |||
141 | int open_count; /* number of times this port has been opened */ | ||
142 | |||
143 | char* ring_buffer; | ||
144 | unsigned int ring_head; | ||
145 | unsigned int ring_tail; | ||
146 | |||
147 | wait_queue_head_t read_wait; | ||
148 | wait_queue_head_t write_wait; | ||
149 | |||
150 | char* interrupt_in_buffer; | ||
151 | struct usb_endpoint_descriptor* interrupt_in_endpoint; | ||
152 | struct urb* interrupt_in_urb; | ||
153 | int interrupt_in_interval; | ||
154 | size_t interrupt_in_endpoint_size; | ||
155 | int interrupt_in_running; | ||
156 | int interrupt_in_done; | ||
157 | |||
158 | char* interrupt_out_buffer; | ||
159 | struct usb_endpoint_descriptor* interrupt_out_endpoint; | ||
160 | struct urb* interrupt_out_urb; | ||
161 | int interrupt_out_interval; | ||
162 | size_t interrupt_out_endpoint_size; | ||
163 | int interrupt_out_busy; | ||
164 | }; | ||
165 | |||
166 | /* prevent races between open() and disconnect() */ | ||
167 | static DECLARE_MUTEX(disconnect_sem); | ||
168 | |||
169 | static struct usb_driver ld_usb_driver; | ||
170 | |||
171 | /** | ||
172 | * ld_usb_abort_transfers | ||
173 | * aborts transfers and frees associated data structures | ||
174 | */ | ||
175 | static void ld_usb_abort_transfers(struct ld_usb *dev) | ||
176 | { | ||
177 | /* shutdown transfer */ | ||
178 | if (dev->interrupt_in_running) { | ||
179 | dev->interrupt_in_running = 0; | ||
180 | if (dev->intf) | ||
181 | usb_kill_urb(dev->interrupt_in_urb); | ||
182 | } | ||
183 | if (dev->interrupt_out_busy) | ||
184 | if (dev->intf) | ||
185 | usb_kill_urb(dev->interrupt_out_urb); | ||
186 | } | ||
187 | |||
188 | /** | ||
189 | * ld_usb_delete | ||
190 | */ | ||
191 | static void ld_usb_delete(struct ld_usb *dev) | ||
192 | { | ||
193 | ld_usb_abort_transfers(dev); | ||
194 | |||
195 | /* free data structures */ | ||
196 | usb_free_urb(dev->interrupt_in_urb); | ||
197 | usb_free_urb(dev->interrupt_out_urb); | ||
198 | kfree(dev->ring_buffer); | ||
199 | kfree(dev->interrupt_in_buffer); | ||
200 | kfree(dev->interrupt_out_buffer); | ||
201 | kfree(dev); | ||
202 | } | ||
203 | |||
204 | /** | ||
205 | * ld_usb_interrupt_in_callback | ||
206 | */ | ||
207 | static void ld_usb_interrupt_in_callback(struct urb *urb, struct pt_regs *regs) | ||
208 | { | ||
209 | struct ld_usb *dev = urb->context; | ||
210 | size_t *actual_buffer; | ||
211 | unsigned int next_ring_head; | ||
212 | int retval; | ||
213 | |||
214 | if (urb->status) { | ||
215 | if (urb->status == -ENOENT || | ||
216 | urb->status == -ECONNRESET || | ||
217 | urb->status == -ESHUTDOWN) { | ||
218 | goto exit; | ||
219 | } else { | ||
220 | dbg_info(&dev->intf->dev, "%s: nonzero status received: %d\n", | ||
221 | __FUNCTION__, urb->status); | ||
222 | goto resubmit; /* maybe we can recover */ | ||
223 | } | ||
224 | } | ||
225 | |||
226 | if (urb->actual_length > 0) { | ||
227 | next_ring_head = (dev->ring_head+1) % ring_buffer_size; | ||
228 | if (next_ring_head != dev->ring_tail) { | ||
229 | actual_buffer = (size_t*)(dev->ring_buffer + dev->ring_head*(sizeof(size_t)+dev->interrupt_in_endpoint_size)); | ||
230 | /* actual_buffer gets urb->actual_length + interrupt_in_buffer */ | ||
231 | *actual_buffer = urb->actual_length; | ||
232 | memcpy(actual_buffer+1, dev->interrupt_in_buffer, urb->actual_length); | ||
233 | dev->ring_head = next_ring_head; | ||
234 | dbg_info(&dev->intf->dev, "%s: received %d bytes\n", | ||
235 | __FUNCTION__, urb->actual_length); | ||
236 | } else | ||
237 | dev_warn(&dev->intf->dev, | ||
238 | "Ring buffer overflow, %d bytes dropped\n", | ||
239 | urb->actual_length); | ||
240 | } | ||
241 | |||
242 | resubmit: | ||
243 | /* resubmit if we're still running */ | ||
244 | if (dev->interrupt_in_running && dev->intf) { | ||
245 | retval = usb_submit_urb(dev->interrupt_in_urb, GFP_ATOMIC); | ||
246 | if (retval) | ||
247 | dev_err(&dev->intf->dev, | ||
248 | "usb_submit_urb failed (%d)\n", retval); | ||
249 | } | ||
250 | |||
251 | exit: | ||
252 | dev->interrupt_in_done = 1; | ||
253 | wake_up_interruptible(&dev->read_wait); | ||
254 | } | ||
255 | |||
256 | /** | ||
257 | * ld_usb_interrupt_out_callback | ||
258 | */ | ||
259 | static void ld_usb_interrupt_out_callback(struct urb *urb, struct pt_regs *regs) | ||
260 | { | ||
261 | struct ld_usb *dev = urb->context; | ||
262 | |||
263 | /* sync/async unlink faults aren't errors */ | ||
264 | if (urb->status && !(urb->status == -ENOENT || | ||
265 | urb->status == -ECONNRESET || | ||
266 | urb->status == -ESHUTDOWN)) | ||
267 | dbg_info(&dev->intf->dev, | ||
268 | "%s - nonzero write interrupt status received: %d\n", | ||
269 | __FUNCTION__, urb->status); | ||
270 | |||
271 | dev->interrupt_out_busy = 0; | ||
272 | wake_up_interruptible(&dev->write_wait); | ||
273 | } | ||
274 | |||
275 | /** | ||
276 | * ld_usb_open | ||
277 | */ | ||
278 | static int ld_usb_open(struct inode *inode, struct file *file) | ||
279 | { | ||
280 | struct ld_usb *dev; | ||
281 | int subminor; | ||
282 | int retval = 0; | ||
283 | struct usb_interface *interface; | ||
284 | |||
285 | nonseekable_open(inode, file); | ||
286 | subminor = iminor(inode); | ||
287 | |||
288 | down(&disconnect_sem); | ||
289 | |||
290 | interface = usb_find_interface(&ld_usb_driver, subminor); | ||
291 | |||
292 | if (!interface) { | ||
293 | err("%s - error, can't find device for minor %d\n", | ||
294 | __FUNCTION__, subminor); | ||
295 | retval = -ENODEV; | ||
296 | goto unlock_disconnect_exit; | ||
297 | } | ||
298 | |||
299 | dev = usb_get_intfdata(interface); | ||
300 | |||
301 | if (!dev) { | ||
302 | retval = -ENODEV; | ||
303 | goto unlock_disconnect_exit; | ||
304 | } | ||
305 | |||
306 | /* lock this device */ | ||
307 | if (down_interruptible(&dev->sem)) { | ||
308 | retval = -ERESTARTSYS; | ||
309 | goto unlock_disconnect_exit; | ||
310 | } | ||
311 | |||
312 | /* allow opening only once */ | ||
313 | if (dev->open_count) { | ||
314 | retval = -EBUSY; | ||
315 | goto unlock_exit; | ||
316 | } | ||
317 | dev->open_count = 1; | ||
318 | |||
319 | /* initialize in direction */ | ||
320 | dev->ring_head = 0; | ||
321 | dev->ring_tail = 0; | ||
322 | usb_fill_int_urb(dev->interrupt_in_urb, | ||
323 | interface_to_usbdev(interface), | ||
324 | usb_rcvintpipe(interface_to_usbdev(interface), | ||
325 | dev->interrupt_in_endpoint->bEndpointAddress), | ||
326 | dev->interrupt_in_buffer, | ||
327 | dev->interrupt_in_endpoint_size, | ||
328 | ld_usb_interrupt_in_callback, | ||
329 | dev, | ||
330 | dev->interrupt_in_interval); | ||
331 | |||
332 | dev->interrupt_in_running = 1; | ||
333 | dev->interrupt_in_done = 0; | ||
334 | |||
335 | retval = usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL); | ||
336 | if (retval) { | ||
337 | dev_err(&interface->dev, "Couldn't submit interrupt_in_urb %d\n", retval); | ||
338 | dev->interrupt_in_running = 0; | ||
339 | dev->open_count = 0; | ||
340 | goto unlock_exit; | ||
341 | } | ||
342 | |||
343 | /* save device in the file's private structure */ | ||
344 | file->private_data = dev; | ||
345 | |||
346 | unlock_exit: | ||
347 | up(&dev->sem); | ||
348 | |||
349 | unlock_disconnect_exit: | ||
350 | up(&disconnect_sem); | ||
351 | |||
352 | return retval; | ||
353 | } | ||
354 | |||
355 | /** | ||
356 | * ld_usb_release | ||
357 | */ | ||
358 | static int ld_usb_release(struct inode *inode, struct file *file) | ||
359 | { | ||
360 | struct ld_usb *dev; | ||
361 | int retval = 0; | ||
362 | |||
363 | dev = file->private_data; | ||
364 | |||
365 | if (dev == NULL) { | ||
366 | retval = -ENODEV; | ||
367 | goto exit; | ||
368 | } | ||
369 | |||
370 | if (down_interruptible(&dev->sem)) { | ||
371 | retval = -ERESTARTSYS; | ||
372 | goto exit; | ||
373 | } | ||
374 | |||
375 | if (dev->open_count != 1) { | ||
376 | retval = -ENODEV; | ||
377 | goto unlock_exit; | ||
378 | } | ||
379 | if (dev->intf == NULL) { | ||
380 | /* the device was unplugged before the file was released */ | ||
381 | up(&dev->sem); | ||
382 | /* unlock here as ld_usb_delete frees dev */ | ||
383 | ld_usb_delete(dev); | ||
384 | goto exit; | ||
385 | } | ||
386 | |||
387 | /* wait until write transfer is finished */ | ||
388 | if (dev->interrupt_out_busy) | ||
389 | wait_event_interruptible_timeout(dev->write_wait, !dev->interrupt_out_busy, 2 * HZ); | ||
390 | ld_usb_abort_transfers(dev); | ||
391 | dev->open_count = 0; | ||
392 | |||
393 | unlock_exit: | ||
394 | up(&dev->sem); | ||
395 | |||
396 | exit: | ||
397 | return retval; | ||
398 | } | ||
399 | |||
400 | /** | ||
401 | * ld_usb_poll | ||
402 | */ | ||
403 | static unsigned int ld_usb_poll(struct file *file, poll_table *wait) | ||
404 | { | ||
405 | struct ld_usb *dev; | ||
406 | unsigned int mask = 0; | ||
407 | |||
408 | dev = file->private_data; | ||
409 | |||
410 | poll_wait(file, &dev->read_wait, wait); | ||
411 | poll_wait(file, &dev->write_wait, wait); | ||
412 | |||
413 | if (dev->ring_head != dev->ring_tail) | ||
414 | mask |= POLLIN | POLLRDNORM; | ||
415 | if (!dev->interrupt_out_busy) | ||
416 | mask |= POLLOUT | POLLWRNORM; | ||
417 | |||
418 | return mask; | ||
419 | } | ||
420 | |||
421 | /** | ||
422 | * ld_usb_read | ||
423 | */ | ||
424 | static ssize_t ld_usb_read(struct file *file, char __user *buffer, size_t count, | ||
425 | loff_t *ppos) | ||
426 | { | ||
427 | struct ld_usb *dev; | ||
428 | size_t *actual_buffer; | ||
429 | size_t bytes_to_read; | ||
430 | int retval = 0; | ||
431 | |||
432 | dev = file->private_data; | ||
433 | |||
434 | /* verify that we actually have some data to read */ | ||
435 | if (count == 0) | ||
436 | goto exit; | ||
437 | |||
438 | /* lock this object */ | ||
439 | if (down_interruptible(&dev->sem)) { | ||
440 | retval = -ERESTARTSYS; | ||
441 | goto exit; | ||
442 | } | ||
443 | |||
444 | /* verify that the device wasn't unplugged */ | ||
445 | if (dev->intf == NULL) { | ||
446 | retval = -ENODEV; | ||
447 | err("No device or device unplugged %d\n", retval); | ||
448 | goto unlock_exit; | ||
449 | } | ||
450 | |||
451 | /* wait for data */ | ||
452 | if (dev->ring_head == dev->ring_tail) { | ||
453 | if (file->f_flags & O_NONBLOCK) { | ||
454 | retval = -EAGAIN; | ||
455 | goto unlock_exit; | ||
456 | } | ||
457 | retval = wait_event_interruptible(dev->read_wait, dev->interrupt_in_done); | ||
458 | if (retval < 0) | ||
459 | goto unlock_exit; | ||
460 | } | ||
461 | |||
462 | /* actual_buffer contains actual_length + interrupt_in_buffer */ | ||
463 | actual_buffer = (size_t*)(dev->ring_buffer + dev->ring_tail*(sizeof(size_t)+dev->interrupt_in_endpoint_size)); | ||
464 | bytes_to_read = min(count, *actual_buffer); | ||
465 | if (bytes_to_read < *actual_buffer) | ||
466 | dev_warn(&dev->intf->dev, "Read buffer overflow, %d bytes dropped\n", | ||
467 | *actual_buffer-bytes_to_read); | ||
468 | |||
469 | /* copy one interrupt_in_buffer from ring_buffer into userspace */ | ||
470 | if (copy_to_user(buffer, actual_buffer+1, bytes_to_read)) { | ||
471 | retval = -EFAULT; | ||
472 | goto unlock_exit; | ||
473 | } | ||
474 | dev->ring_tail = (dev->ring_tail+1) % ring_buffer_size; | ||
475 | |||
476 | retval = bytes_to_read; | ||
477 | |||
478 | unlock_exit: | ||
479 | /* unlock the device */ | ||
480 | up(&dev->sem); | ||
481 | |||
482 | exit: | ||
483 | return retval; | ||
484 | } | ||
485 | |||
486 | /** | ||
487 | * ld_usb_write | ||
488 | */ | ||
489 | static ssize_t ld_usb_write(struct file *file, const char __user *buffer, | ||
490 | size_t count, loff_t *ppos) | ||
491 | { | ||
492 | struct ld_usb *dev; | ||
493 | size_t bytes_to_write; | ||
494 | int retval = 0; | ||
495 | |||
496 | dev = file->private_data; | ||
497 | |||
498 | /* verify that we actually have some data to write */ | ||
499 | if (count == 0) | ||
500 | goto exit; | ||
501 | |||
502 | /* lock this object */ | ||
503 | if (down_interruptible(&dev->sem)) { | ||
504 | retval = -ERESTARTSYS; | ||
505 | goto exit; | ||
506 | } | ||
507 | |||
508 | /* verify that the device wasn't unplugged */ | ||
509 | if (dev->intf == NULL) { | ||
510 | retval = -ENODEV; | ||
511 | err("No device or device unplugged %d\n", retval); | ||
512 | goto unlock_exit; | ||
513 | } | ||
514 | |||
515 | /* wait until previous transfer is finished */ | ||
516 | if (dev->interrupt_out_busy) { | ||
517 | if (file->f_flags & O_NONBLOCK) { | ||
518 | retval = -EAGAIN; | ||
519 | goto unlock_exit; | ||
520 | } | ||
521 | retval = wait_event_interruptible(dev->write_wait, !dev->interrupt_out_busy); | ||
522 | if (retval < 0) { | ||
523 | goto unlock_exit; | ||
524 | } | ||
525 | } | ||
526 | |||
527 | /* write the data into interrupt_out_buffer from userspace */ | ||
528 | bytes_to_write = min(count, write_buffer_size*dev->interrupt_out_endpoint_size); | ||
529 | if (bytes_to_write < count) | ||
530 | dev_warn(&dev->intf->dev, "Write buffer overflow, %d bytes dropped\n",count-bytes_to_write); | ||
531 | dbg_info(&dev->intf->dev, "%s: count = %d, bytes_to_write = %d\n", __FUNCTION__, count, bytes_to_write); | ||
532 | |||
533 | if (copy_from_user(dev->interrupt_out_buffer, buffer, bytes_to_write)) { | ||
534 | retval = -EFAULT; | ||
535 | goto unlock_exit; | ||
536 | } | ||
537 | |||
538 | if (dev->interrupt_out_endpoint == NULL) { | ||
539 | /* try HID_REQ_SET_REPORT=9 on control_endpoint instead of interrupt_out_endpoint */ | ||
540 | retval = usb_control_msg(interface_to_usbdev(dev->intf), | ||
541 | usb_sndctrlpipe(interface_to_usbdev(dev->intf), 0), | ||
542 | 9, | ||
543 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT, | ||
544 | 1 << 8, 0, | ||
545 | dev->interrupt_out_buffer, | ||
546 | bytes_to_write, | ||
547 | USB_CTRL_SET_TIMEOUT * HZ); | ||
548 | if (retval < 0) | ||
549 | err("Couldn't submit HID_REQ_SET_REPORT %d\n", retval); | ||
550 | goto unlock_exit; | ||
551 | } | ||
552 | |||
553 | /* send off the urb */ | ||
554 | usb_fill_int_urb(dev->interrupt_out_urb, | ||
555 | interface_to_usbdev(dev->intf), | ||
556 | usb_sndintpipe(interface_to_usbdev(dev->intf), | ||
557 | dev->interrupt_out_endpoint->bEndpointAddress), | ||
558 | dev->interrupt_out_buffer, | ||
559 | bytes_to_write, | ||
560 | ld_usb_interrupt_out_callback, | ||
561 | dev, | ||
562 | dev->interrupt_out_interval); | ||
563 | |||
564 | dev->interrupt_out_busy = 1; | ||
565 | wmb(); | ||
566 | |||
567 | retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL); | ||
568 | if (retval) { | ||
569 | dev->interrupt_out_busy = 0; | ||
570 | err("Couldn't submit interrupt_out_urb %d\n", retval); | ||
571 | goto unlock_exit; | ||
572 | } | ||
573 | retval = bytes_to_write; | ||
574 | |||
575 | unlock_exit: | ||
576 | /* unlock the device */ | ||
577 | up(&dev->sem); | ||
578 | |||
579 | exit: | ||
580 | return retval; | ||
581 | } | ||
582 | |||
583 | /* file operations needed when we register this driver */ | ||
584 | static struct file_operations ld_usb_fops = { | ||
585 | .owner = THIS_MODULE, | ||
586 | .read = ld_usb_read, | ||
587 | .write = ld_usb_write, | ||
588 | .open = ld_usb_open, | ||
589 | .release = ld_usb_release, | ||
590 | .poll = ld_usb_poll, | ||
591 | }; | ||
592 | |||
593 | /* | ||
594 | * usb class driver info in order to get a minor number from the usb core, | ||
595 | * and to have the device registered with devfs and the driver core | ||
596 | */ | ||
597 | static struct usb_class_driver ld_usb_class = { | ||
598 | .name = "ldusb%d", | ||
599 | .fops = &ld_usb_fops, | ||
600 | .minor_base = USB_LD_MINOR_BASE, | ||
601 | }; | ||
602 | |||
603 | /** | ||
604 | * ld_usb_probe | ||
605 | * | ||
606 | * Called by the usb core when a new device is connected that it thinks | ||
607 | * this driver might be interested in. | ||
608 | */ | ||
609 | static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | ||
610 | { | ||
611 | struct usb_device *udev = interface_to_usbdev(intf); | ||
612 | struct ld_usb *dev = NULL; | ||
613 | struct usb_host_interface *iface_desc; | ||
614 | struct usb_endpoint_descriptor *endpoint; | ||
615 | char *buffer; | ||
616 | int i; | ||
617 | int retval = -ENOMEM; | ||
618 | |||
619 | /* allocate memory for our device state and intialize it */ | ||
620 | |||
621 | dev = kmalloc(sizeof(*dev), GFP_KERNEL); | ||
622 | if (dev == NULL) { | ||
623 | dev_err(&intf->dev, "Out of memory\n"); | ||
624 | goto exit; | ||
625 | } | ||
626 | memset(dev, 0x00, sizeof(*dev)); | ||
627 | init_MUTEX(&dev->sem); | ||
628 | dev->intf = intf; | ||
629 | init_waitqueue_head(&dev->read_wait); | ||
630 | init_waitqueue_head(&dev->write_wait); | ||
631 | |||
632 | /* workaround for early firmware versions on fast computers */ | ||
633 | if ((le16_to_cpu(udev->descriptor.idVendor) == USB_VENDOR_ID_LD) && | ||
634 | ((le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_CASSY) || | ||
635 | (le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_COM3LAB)) && | ||
636 | (le16_to_cpu(udev->descriptor.bcdDevice) <= 0x103)) { | ||
637 | buffer = kmalloc(256, GFP_KERNEL); | ||
638 | /* usb_string makes SETUP+STALL to leave always ControlReadLoop */ | ||
639 | usb_string(udev, 255, buffer, 256); | ||
640 | kfree(buffer); | ||
641 | } | ||
642 | |||
643 | iface_desc = intf->cur_altsetting; | ||
644 | |||
645 | /* set up the endpoint information */ | ||
646 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { | ||
647 | endpoint = &iface_desc->endpoint[i].desc; | ||
648 | |||
649 | if (((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN) && | ||
650 | ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT)) { | ||
651 | dev->interrupt_in_endpoint = endpoint; | ||
652 | } | ||
653 | |||
654 | if (((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) && | ||
655 | ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT)) { | ||
656 | dev->interrupt_out_endpoint = endpoint; | ||
657 | } | ||
658 | } | ||
659 | if (dev->interrupt_in_endpoint == NULL) { | ||
660 | dev_err(&intf->dev, "Interrupt in endpoint not found\n"); | ||
661 | goto error; | ||
662 | } | ||
663 | if (dev->interrupt_out_endpoint == NULL) | ||
664 | dev_warn(&intf->dev, "Interrupt out endpoint not found (using control endpoint instead)\n"); | ||
665 | |||
666 | dev->interrupt_in_endpoint_size = le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize); | ||
667 | dev->ring_buffer = kmalloc(ring_buffer_size*(sizeof(size_t)+dev->interrupt_in_endpoint_size), GFP_KERNEL); | ||
668 | if (!dev->ring_buffer) { | ||
669 | dev_err(&intf->dev, "Couldn't allocate ring_buffer\n"); | ||
670 | goto error; | ||
671 | } | ||
672 | dev->interrupt_in_buffer = kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL); | ||
673 | if (!dev->interrupt_in_buffer) { | ||
674 | dev_err(&intf->dev, "Couldn't allocate interrupt_in_buffer\n"); | ||
675 | goto error; | ||
676 | } | ||
677 | dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
678 | if (!dev->interrupt_in_urb) { | ||
679 | dev_err(&intf->dev, "Couldn't allocate interrupt_in_urb\n"); | ||
680 | goto error; | ||
681 | } | ||
682 | dev->interrupt_out_endpoint_size = dev->interrupt_out_endpoint ? le16_to_cpu(dev->interrupt_out_endpoint->wMaxPacketSize) : | ||
683 | udev->descriptor.bMaxPacketSize0; | ||
684 | dev->interrupt_out_buffer = kmalloc(write_buffer_size*dev->interrupt_out_endpoint_size, GFP_KERNEL); | ||
685 | if (!dev->interrupt_out_buffer) { | ||
686 | dev_err(&intf->dev, "Couldn't allocate interrupt_out_buffer\n"); | ||
687 | goto error; | ||
688 | } | ||
689 | dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
690 | if (!dev->interrupt_out_urb) { | ||
691 | dev_err(&intf->dev, "Couldn't allocate interrupt_out_urb\n"); | ||
692 | goto error; | ||
693 | } | ||
694 | dev->interrupt_in_interval = min_interrupt_in_interval > dev->interrupt_in_endpoint->bInterval ? min_interrupt_in_interval : dev->interrupt_in_endpoint->bInterval; | ||
695 | if (dev->interrupt_out_endpoint) | ||
696 | dev->interrupt_out_interval = min_interrupt_out_interval > dev->interrupt_out_endpoint->bInterval ? min_interrupt_out_interval : dev->interrupt_out_endpoint->bInterval; | ||
697 | |||
698 | /* we can register the device now, as it is ready */ | ||
699 | usb_set_intfdata(intf, dev); | ||
700 | |||
701 | retval = usb_register_dev(intf, &ld_usb_class); | ||
702 | if (retval) { | ||
703 | /* something prevented us from registering this driver */ | ||
704 | dev_err(&intf->dev, "Not able to get a minor for this device.\n"); | ||
705 | usb_set_intfdata(intf, NULL); | ||
706 | goto error; | ||
707 | } | ||
708 | |||
709 | /* let the user know what node this device is now attached to */ | ||
710 | dev_info(&intf->dev, "LD USB Device #%d now attached to major %d minor %d\n", | ||
711 | (intf->minor - USB_LD_MINOR_BASE), USB_MAJOR, intf->minor); | ||
712 | |||
713 | exit: | ||
714 | return retval; | ||
715 | |||
716 | error: | ||
717 | ld_usb_delete(dev); | ||
718 | |||
719 | return retval; | ||
720 | } | ||
721 | |||
722 | /** | ||
723 | * ld_usb_disconnect | ||
724 | * | ||
725 | * Called by the usb core when the device is removed from the system. | ||
726 | */ | ||
727 | static void ld_usb_disconnect(struct usb_interface *intf) | ||
728 | { | ||
729 | struct ld_usb *dev; | ||
730 | int minor; | ||
731 | |||
732 | down(&disconnect_sem); | ||
733 | |||
734 | dev = usb_get_intfdata(intf); | ||
735 | usb_set_intfdata(intf, NULL); | ||
736 | |||
737 | down(&dev->sem); | ||
738 | |||
739 | minor = intf->minor; | ||
740 | |||
741 | /* give back our minor */ | ||
742 | usb_deregister_dev(intf, &ld_usb_class); | ||
743 | |||
744 | /* if the device is not opened, then we clean up right now */ | ||
745 | if (!dev->open_count) { | ||
746 | up(&dev->sem); | ||
747 | ld_usb_delete(dev); | ||
748 | } else { | ||
749 | dev->intf = NULL; | ||
750 | up(&dev->sem); | ||
751 | } | ||
752 | |||
753 | up(&disconnect_sem); | ||
754 | |||
755 | dev_info(&intf->dev, "LD USB Device #%d now disconnected\n", | ||
756 | (minor - USB_LD_MINOR_BASE)); | ||
757 | } | ||
758 | |||
759 | /* usb specific object needed to register this driver with the usb subsystem */ | ||
760 | static struct usb_driver ld_usb_driver = { | ||
761 | .owner = THIS_MODULE, | ||
762 | .name = "ldusb", | ||
763 | .probe = ld_usb_probe, | ||
764 | .disconnect = ld_usb_disconnect, | ||
765 | .id_table = ld_usb_table, | ||
766 | }; | ||
767 | |||
768 | /** | ||
769 | * ld_usb_init | ||
770 | */ | ||
771 | static int __init ld_usb_init(void) | ||
772 | { | ||
773 | int retval; | ||
774 | |||
775 | /* register this driver with the USB subsystem */ | ||
776 | retval = usb_register(&ld_usb_driver); | ||
777 | if (retval) | ||
778 | err("usb_register failed for the "__FILE__" driver. Error number %d\n", retval); | ||
779 | |||
780 | return retval; | ||
781 | } | ||
782 | |||
783 | /** | ||
784 | * ld_usb_exit | ||
785 | */ | ||
786 | static void __exit ld_usb_exit(void) | ||
787 | { | ||
788 | /* deregister this driver with the USB subsystem */ | ||
789 | usb_deregister(&ld_usb_driver); | ||
790 | } | ||
791 | |||
792 | module_init(ld_usb_init); | ||
793 | module_exit(ld_usb_exit); | ||
794 | |||
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c index 755a4570477f..26266b30028e 100644 --- a/drivers/usb/mon/mon_text.c +++ b/drivers/usb/mon/mon_text.c | |||
@@ -19,11 +19,16 @@ | |||
19 | #define DATA_MAX 32 | 19 | #define DATA_MAX 32 |
20 | 20 | ||
21 | /* | 21 | /* |
22 | * Defined by USB 2.0 clause 9.3, table 9.2. | ||
23 | */ | ||
24 | #define SETUP_MAX 8 | ||
25 | |||
26 | /* | ||
22 | * This limit exists to prevent OOMs when the user process stops reading. | 27 | * This limit exists to prevent OOMs when the user process stops reading. |
23 | */ | 28 | */ |
24 | #define EVENT_MAX 25 | 29 | #define EVENT_MAX 25 |
25 | 30 | ||
26 | #define PRINTF_DFL 120 | 31 | #define PRINTF_DFL 130 |
27 | 32 | ||
28 | struct mon_event_text { | 33 | struct mon_event_text { |
29 | struct list_head e_link; | 34 | struct list_head e_link; |
@@ -33,7 +38,9 @@ struct mon_event_text { | |||
33 | unsigned int tstamp; | 38 | unsigned int tstamp; |
34 | int length; /* Depends on type: xfer length or act length */ | 39 | int length; /* Depends on type: xfer length or act length */ |
35 | int status; | 40 | int status; |
41 | char setup_flag; | ||
36 | char data_flag; | 42 | char data_flag; |
43 | unsigned char setup[SETUP_MAX]; | ||
37 | unsigned char data[DATA_MAX]; | 44 | unsigned char data[DATA_MAX]; |
38 | }; | 45 | }; |
39 | 46 | ||
@@ -64,6 +71,22 @@ static void mon_text_dtor(void *, kmem_cache_t *, unsigned long); | |||
64 | * This is called with the whole mon_bus locked, so no additional lock. | 71 | * This is called with the whole mon_bus locked, so no additional lock. |
65 | */ | 72 | */ |
66 | 73 | ||
74 | static inline char mon_text_get_setup(struct mon_event_text *ep, | ||
75 | struct urb *urb, char ev_type) | ||
76 | { | ||
77 | |||
78 | if (!usb_pipecontrol(urb->pipe) || ev_type != 'S') | ||
79 | return '-'; | ||
80 | |||
81 | if (urb->transfer_flags & URB_NO_SETUP_DMA_MAP) | ||
82 | return 'D'; | ||
83 | if (urb->setup_packet == NULL) | ||
84 | return 'Z'; /* '0' would be not as pretty. */ | ||
85 | |||
86 | memcpy(ep->setup, urb->setup_packet, SETUP_MAX); | ||
87 | return 0; | ||
88 | } | ||
89 | |||
67 | static inline char mon_text_get_data(struct mon_event_text *ep, struct urb *urb, | 90 | static inline char mon_text_get_data(struct mon_event_text *ep, struct urb *urb, |
68 | int len, char ev_type) | 91 | int len, char ev_type) |
69 | { | 92 | { |
@@ -90,7 +113,6 @@ static inline char mon_text_get_data(struct mon_event_text *ep, struct urb *urb, | |||
90 | 113 | ||
91 | /* | 114 | /* |
92 | * Bulk is easy to shortcut reliably. | 115 | * Bulk is easy to shortcut reliably. |
93 | * XXX Control needs setup packet taken. | ||
94 | * XXX Other pipe types need consideration. Currently, we overdo it | 116 | * XXX Other pipe types need consideration. Currently, we overdo it |
95 | * and collect garbage for them: better more than less. | 117 | * and collect garbage for them: better more than less. |
96 | */ | 118 | */ |
@@ -144,6 +166,7 @@ static void mon_text_event(struct mon_reader_text *rp, struct urb *urb, | |||
144 | /* Collecting status makes debugging sense for submits, too */ | 166 | /* Collecting status makes debugging sense for submits, too */ |
145 | ep->status = urb->status; | 167 | ep->status = urb->status; |
146 | 168 | ||
169 | ep->setup_flag = mon_text_get_setup(ep, urb, ev_type); | ||
147 | ep->data_flag = mon_text_get_data(ep, urb, ep->length, ev_type); | 170 | ep->data_flag = mon_text_get_data(ep, urb, ep->length, ev_type); |
148 | 171 | ||
149 | rp->nevents++; | 172 | rp->nevents++; |
@@ -299,10 +322,25 @@ static ssize_t mon_text_read(struct file *file, char __user *buf, | |||
299 | default: /* PIPE_BULK */ utype = 'B'; | 322 | default: /* PIPE_BULK */ utype = 'B'; |
300 | } | 323 | } |
301 | cnt += snprintf(pbuf + cnt, limit - cnt, | 324 | cnt += snprintf(pbuf + cnt, limit - cnt, |
302 | "%lx %u %c %c%c:%03u:%02u %d %d", | 325 | "%lx %u %c %c%c:%03u:%02u", |
303 | ep->id, ep->tstamp, ep->type, | 326 | ep->id, ep->tstamp, ep->type, |
304 | utype, udir, usb_pipedevice(ep->pipe), usb_pipeendpoint(ep->pipe), | 327 | utype, udir, usb_pipedevice(ep->pipe), usb_pipeendpoint(ep->pipe)); |
305 | ep->status, ep->length); | 328 | |
329 | if (ep->setup_flag == 0) { /* Setup packet is present and captured */ | ||
330 | cnt += snprintf(pbuf + cnt, limit - cnt, | ||
331 | " s %02x %02x %04x %04x %04x", | ||
332 | ep->setup[0], | ||
333 | ep->setup[1], | ||
334 | (ep->setup[3] << 8) | ep->setup[2], | ||
335 | (ep->setup[5] << 8) | ep->setup[4], | ||
336 | (ep->setup[7] << 8) | ep->setup[6]); | ||
337 | } else if (ep->setup_flag != '-') { /* Unable to capture setup packet */ | ||
338 | cnt += snprintf(pbuf + cnt, limit - cnt, | ||
339 | " %c __ __ ____ ____ ____", ep->setup_flag); | ||
340 | } else { /* No setup for this kind of URB */ | ||
341 | cnt += snprintf(pbuf + cnt, limit - cnt, " %d", ep->status); | ||
342 | } | ||
343 | cnt += snprintf(pbuf + cnt, limit - cnt, " %d", ep->length); | ||
306 | 344 | ||
307 | if ((data_len = ep->length) > 0) { | 345 | if ((data_len = ep->length) > 0) { |
308 | if (ep->data_flag == 0) { | 346 | if (ep->data_flag == 0) { |
diff --git a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c index fd6ff4cb2c62..7ffa99b9760f 100644 --- a/drivers/usb/net/kaweth.c +++ b/drivers/usb/net/kaweth.c | |||
@@ -477,7 +477,7 @@ static int kaweth_reset(struct kaweth_device *kaweth) | |||
477 | } | 477 | } |
478 | 478 | ||
479 | static void kaweth_usb_receive(struct urb *, struct pt_regs *regs); | 479 | static void kaweth_usb_receive(struct urb *, struct pt_regs *regs); |
480 | static int kaweth_resubmit_rx_urb(struct kaweth_device *, int); | 480 | static int kaweth_resubmit_rx_urb(struct kaweth_device *, unsigned); |
481 | 481 | ||
482 | /**************************************************************** | 482 | /**************************************************************** |
483 | int_callback | 483 | int_callback |
@@ -550,7 +550,7 @@ static void kaweth_resubmit_tl(void *d) | |||
550 | * kaweth_resubmit_rx_urb | 550 | * kaweth_resubmit_rx_urb |
551 | ****************************************************************/ | 551 | ****************************************************************/ |
552 | static int kaweth_resubmit_rx_urb(struct kaweth_device *kaweth, | 552 | static int kaweth_resubmit_rx_urb(struct kaweth_device *kaweth, |
553 | int mem_flags) | 553 | unsigned mem_flags) |
554 | { | 554 | { |
555 | int result; | 555 | int result; |
556 | 556 | ||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index d882fa3ad19a..0b03ddab53d9 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -264,16 +264,26 @@ | |||
264 | /* | 264 | /* |
265 | * Version Information | 265 | * Version Information |
266 | */ | 266 | */ |
267 | #define DRIVER_VERSION "v1.4.2" | 267 | #define DRIVER_VERSION "v1.4.3" |
268 | #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Bill Ryder <bryder@sgi.com>, Kuba Ober <kuba@mareimbrium.org>" | 268 | #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Bill Ryder <bryder@sgi.com>, Kuba Ober <kuba@mareimbrium.org>" |
269 | #define DRIVER_DESC "USB FTDI Serial Converters Driver" | 269 | #define DRIVER_DESC "USB FTDI Serial Converters Driver" |
270 | 270 | ||
271 | static int debug; | 271 | static int debug; |
272 | 272 | ||
273 | static struct usb_device_id id_table_sio [] = { | 273 | /* struct ftdi_sio_quirk is used by devices requiring special attention. */ |
274 | { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, | 274 | struct ftdi_sio_quirk { |
275 | { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, | 275 | void (*setup)(struct usb_serial *); /* Special settings during startup. */ |
276 | { } /* Terminating entry */ | 276 | }; |
277 | |||
278 | static void ftdi_USB_UIRT_setup (struct usb_serial *serial); | ||
279 | static void ftdi_HE_TIRA1_setup (struct usb_serial *serial); | ||
280 | |||
281 | static struct ftdi_sio_quirk ftdi_USB_UIRT_quirk = { | ||
282 | .setup = ftdi_USB_UIRT_setup, | ||
283 | }; | ||
284 | |||
285 | static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = { | ||
286 | .setup = ftdi_HE_TIRA1_setup, | ||
277 | }; | 287 | }; |
278 | 288 | ||
279 | /* | 289 | /* |
@@ -288,237 +298,11 @@ static struct usb_device_id id_table_sio [] = { | |||
288 | * the bcdDevice value is used to differentiate FT232BM and FT245BM from | 298 | * the bcdDevice value is used to differentiate FT232BM and FT245BM from |
289 | * the earlier FT8U232AM and FT8U232BM. For now, include all known VID/PID | 299 | * the earlier FT8U232AM and FT8U232BM. For now, include all known VID/PID |
290 | * combinations in both tables. | 300 | * combinations in both tables. |
291 | * FIXME: perhaps bcdDevice can also identify 12MHz devices, but I don't know | 301 | * FIXME: perhaps bcdDevice can also identify 12MHz FT8U232AM devices, |
292 | * if those ever went into mass production. [Ian Abbott] | 302 | * but I don't know if those ever went into mass production. [Ian Abbott] |
293 | */ | 303 | */ |
294 | 304 | ||
295 | 305 | ||
296 | static struct usb_device_id id_table_8U232AM [] = { | ||
297 | { USB_DEVICE_VER(FTDI_VID, FTDI_IRTRANS_PID, 0, 0x3ff) }, | ||
298 | { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_PID, 0, 0x3ff) }, | ||
299 | { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_ALT_PID, 0, 0x3ff) }, | ||
300 | { USB_DEVICE_VER(FTDI_VID, FTDI_RELAIS_PID, 0, 0x3ff) }, | ||
301 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, | ||
302 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, | ||
303 | { USB_DEVICE_VER(FTDI_NF_RIC_VID, FTDI_NF_RIC_PID, 0, 0x3ff) }, | ||
304 | { USB_DEVICE_VER(FTDI_VID, FTDI_XF_632_PID, 0, 0x3ff) }, | ||
305 | { USB_DEVICE_VER(FTDI_VID, FTDI_XF_634_PID, 0, 0x3ff) }, | ||
306 | { USB_DEVICE_VER(FTDI_VID, FTDI_XF_547_PID, 0, 0x3ff) }, | ||
307 | { USB_DEVICE_VER(FTDI_VID, FTDI_XF_633_PID, 0, 0x3ff) }, | ||
308 | { USB_DEVICE_VER(FTDI_VID, FTDI_XF_631_PID, 0, 0x3ff) }, | ||
309 | { USB_DEVICE_VER(FTDI_VID, FTDI_XF_635_PID, 0, 0x3ff) }, | ||
310 | { USB_DEVICE_VER(FTDI_VID, FTDI_XF_640_PID, 0, 0x3ff) }, | ||
311 | { USB_DEVICE_VER(FTDI_VID, FTDI_XF_642_PID, 0, 0x3ff) }, | ||
312 | { USB_DEVICE_VER(FTDI_VID, FTDI_VNHCPCUSB_D_PID, 0, 0x3ff) }, | ||
313 | { USB_DEVICE_VER(FTDI_VID, FTDI_DSS20_PID, 0, 0x3ff) }, | ||
314 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2101_PID, 0, 0x3ff) }, | ||
315 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2102_PID, 0, 0x3ff) }, | ||
316 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2103_PID, 0, 0x3ff) }, | ||
317 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2104_PID, 0, 0x3ff) }, | ||
318 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2201_1_PID, 0, 0x3ff) }, | ||
319 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2201_2_PID, 0, 0x3ff) }, | ||
320 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2202_1_PID, 0, 0x3ff) }, | ||
321 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2202_2_PID, 0, 0x3ff) }, | ||
322 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2203_1_PID, 0, 0x3ff) }, | ||
323 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2203_2_PID, 0, 0x3ff) }, | ||
324 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2401_1_PID, 0, 0x3ff) }, | ||
325 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2401_2_PID, 0, 0x3ff) }, | ||
326 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2401_3_PID, 0, 0x3ff) }, | ||
327 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2401_4_PID, 0, 0x3ff) }, | ||
328 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2402_1_PID, 0, 0x3ff) }, | ||
329 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2402_2_PID, 0, 0x3ff) }, | ||
330 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2402_3_PID, 0, 0x3ff) }, | ||
331 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2402_4_PID, 0, 0x3ff) }, | ||
332 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2403_1_PID, 0, 0x3ff) }, | ||
333 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2403_2_PID, 0, 0x3ff) }, | ||
334 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2403_3_PID, 0, 0x3ff) }, | ||
335 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2403_4_PID, 0, 0x3ff) }, | ||
336 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_1_PID, 0, 0x3ff) }, | ||
337 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_2_PID, 0, 0x3ff) }, | ||
338 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_3_PID, 0, 0x3ff) }, | ||
339 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_4_PID, 0, 0x3ff) }, | ||
340 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_5_PID, 0, 0x3ff) }, | ||
341 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_6_PID, 0, 0x3ff) }, | ||
342 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_7_PID, 0, 0x3ff) }, | ||
343 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_8_PID, 0, 0x3ff) }, | ||
344 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_1_PID, 0, 0x3ff) }, | ||
345 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_2_PID, 0, 0x3ff) }, | ||
346 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_3_PID, 0, 0x3ff) }, | ||
347 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_4_PID, 0, 0x3ff) }, | ||
348 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_5_PID, 0, 0x3ff) }, | ||
349 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_6_PID, 0, 0x3ff) }, | ||
350 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_7_PID, 0, 0x3ff) }, | ||
351 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_8_PID, 0, 0x3ff) }, | ||
352 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_1_PID, 0, 0x3ff) }, | ||
353 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_2_PID, 0, 0x3ff) }, | ||
354 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_3_PID, 0, 0x3ff) }, | ||
355 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_4_PID, 0, 0x3ff) }, | ||
356 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_5_PID, 0, 0x3ff) }, | ||
357 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_6_PID, 0, 0x3ff) }, | ||
358 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_7_PID, 0, 0x3ff) }, | ||
359 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_8_PID, 0, 0x3ff) }, | ||
360 | { USB_DEVICE_VER(IDTECH_VID, IDTECH_IDT1221U_PID, 0, 0x3ff) }, | ||
361 | { USB_DEVICE_VER(OCT_VID, OCT_US101_PID, 0, 0x3ff) }, | ||
362 | { USB_DEVICE_VER(FTDI_VID, PROTEGO_SPECIAL_1, 0, 0x3ff) }, | ||
363 | { USB_DEVICE_VER(FTDI_VID, PROTEGO_R2X0, 0, 0x3ff) }, | ||
364 | { USB_DEVICE_VER(FTDI_VID, PROTEGO_SPECIAL_3, 0, 0x3ff) }, | ||
365 | { USB_DEVICE_VER(FTDI_VID, PROTEGO_SPECIAL_4, 0, 0x3ff) }, | ||
366 | { USB_DEVICE_VER(FTDI_VID, FTDI_ELV_UO100_PID, 0, 0x3ff) }, | ||
367 | { USB_DEVICE_VER(FTDI_VID, FTDI_ELV_UM100_PID, 0, 0x3ff) }, | ||
368 | { USB_DEVICE_VER(FTDI_VID, INSIDE_ACCESSO, 0, 0x3ff) }, | ||
369 | { USB_DEVICE_VER(INTREPID_VID, INTREPID_VALUECAN_PID, 0, 0x3ff) }, | ||
370 | { USB_DEVICE_VER(INTREPID_VID, INTREPID_NEOVI_PID, 0, 0x3ff) }, | ||
371 | { USB_DEVICE_VER(FALCOM_VID, FALCOM_TWIST_PID, 0, 0x3ff) }, | ||
372 | { USB_DEVICE_VER(FTDI_VID, FTDI_SUUNTO_SPORTS_PID, 0, 0x3ff) }, | ||
373 | { USB_DEVICE_VER(FTDI_VID, FTDI_RM_CANVIEW_PID, 0, 0x3ff) }, | ||
374 | { USB_DEVICE_VER(BANDB_VID, BANDB_USOTL4_PID, 0, 0x3ff) }, | ||
375 | { USB_DEVICE_VER(BANDB_VID, BANDB_USTL4_PID, 0, 0x3ff) }, | ||
376 | { USB_DEVICE_VER(BANDB_VID, BANDB_USO9ML2_PID, 0, 0x3ff) }, | ||
377 | { USB_DEVICE_VER(FTDI_VID, EVER_ECO_PRO_CDS, 0, 0x3ff) }, | ||
378 | { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_0_PID, 0, 0x3ff) }, | ||
379 | { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID, 0, 0x3ff) }, | ||
380 | { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID, 0, 0x3ff) }, | ||
381 | { } /* Terminating entry */ | ||
382 | }; | ||
383 | |||
384 | |||
385 | static struct usb_device_id id_table_FT232BM [] = { | ||
386 | { USB_DEVICE_VER(FTDI_VID, FTDI_IRTRANS_PID, 0x400, 0xffff) }, | ||
387 | { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_PID, 0x400, 0xffff) }, | ||
388 | { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_ALT_PID, 0x400, 0xffff) }, | ||
389 | { USB_DEVICE_VER(FTDI_VID, FTDI_RELAIS_PID, 0x400, 0xffff) }, | ||
390 | { USB_DEVICE_VER(FTDI_NF_RIC_VID, FTDI_NF_RIC_PID, 0x400, 0xffff) }, | ||
391 | { USB_DEVICE_VER(FTDI_VID, FTDI_XF_632_PID, 0x400, 0xffff) }, | ||
392 | { USB_DEVICE_VER(FTDI_VID, FTDI_XF_634_PID, 0x400, 0xffff) }, | ||
393 | { USB_DEVICE_VER(FTDI_VID, FTDI_XF_547_PID, 0x400, 0xffff) }, | ||
394 | { USB_DEVICE_VER(FTDI_VID, FTDI_XF_633_PID, 0x400, 0xffff) }, | ||
395 | { USB_DEVICE_VER(FTDI_VID, FTDI_XF_631_PID, 0x400, 0xffff) }, | ||
396 | { USB_DEVICE_VER(FTDI_VID, FTDI_XF_635_PID, 0x400, 0xffff) }, | ||
397 | { USB_DEVICE_VER(FTDI_VID, FTDI_XF_640_PID, 0x400, 0xffff) }, | ||
398 | { USB_DEVICE_VER(FTDI_VID, FTDI_XF_642_PID, 0x400, 0xffff) }, | ||
399 | { USB_DEVICE_VER(FTDI_VID, FTDI_VNHCPCUSB_D_PID, 0x400, 0xffff) }, | ||
400 | { USB_DEVICE_VER(FTDI_VID, FTDI_DSS20_PID, 0x400, 0xffff) }, | ||
401 | { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_0_PID, 0x400, 0xffff) }, | ||
402 | { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_1_PID, 0x400, 0xffff) }, | ||
403 | { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_2_PID, 0x400, 0xffff) }, | ||
404 | { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_3_PID, 0x400, 0xffff) }, | ||
405 | { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_4_PID, 0x400, 0xffff) }, | ||
406 | { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_5_PID, 0x400, 0xffff) }, | ||
407 | { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_6_PID, 0x400, 0xffff) }, | ||
408 | { USB_DEVICE_VER(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID, 0x400, 0xffff) }, | ||
409 | { USB_DEVICE_VER(FTDI_VID, FTDI_PIEGROUP_PID, 0x400, 0xffff) }, | ||
410 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2101_PID, 0x400, 0xffff) }, | ||
411 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2102_PID, 0x400, 0xffff) }, | ||
412 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2103_PID, 0x400, 0xffff) }, | ||
413 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2104_PID, 0x400, 0xffff) }, | ||
414 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2201_1_PID, 0x400, 0xffff) }, | ||
415 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2201_2_PID, 0x400, 0xffff) }, | ||
416 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2202_1_PID, 0x400, 0xffff) }, | ||
417 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2202_2_PID, 0x400, 0xffff) }, | ||
418 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2203_1_PID, 0x400, 0xffff) }, | ||
419 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2203_2_PID, 0x400, 0xffff) }, | ||
420 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2401_1_PID, 0x400, 0xffff) }, | ||
421 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2401_2_PID, 0x400, 0xffff) }, | ||
422 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2401_3_PID, 0x400, 0xffff) }, | ||
423 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2401_4_PID, 0x400, 0xffff) }, | ||
424 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2402_1_PID, 0x400, 0xffff) }, | ||
425 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2402_2_PID, 0x400, 0xffff) }, | ||
426 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2402_3_PID, 0x400, 0xffff) }, | ||
427 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2402_4_PID, 0x400, 0xffff) }, | ||
428 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2403_1_PID, 0x400, 0xffff) }, | ||
429 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2403_2_PID, 0x400, 0xffff) }, | ||
430 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2403_3_PID, 0x400, 0xffff) }, | ||
431 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2403_4_PID, 0x400, 0xffff) }, | ||
432 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_1_PID, 0x400, 0xffff) }, | ||
433 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_2_PID, 0x400, 0xffff) }, | ||
434 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_3_PID, 0x400, 0xffff) }, | ||
435 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_4_PID, 0x400, 0xffff) }, | ||
436 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_5_PID, 0x400, 0xffff) }, | ||
437 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_6_PID, 0x400, 0xffff) }, | ||
438 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_7_PID, 0x400, 0xffff) }, | ||
439 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2801_8_PID, 0x400, 0xffff) }, | ||
440 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_1_PID, 0x400, 0xffff) }, | ||
441 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_2_PID, 0x400, 0xffff) }, | ||
442 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_3_PID, 0x400, 0xffff) }, | ||
443 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_4_PID, 0x400, 0xffff) }, | ||
444 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_5_PID, 0x400, 0xffff) }, | ||
445 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_6_PID, 0x400, 0xffff) }, | ||
446 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_7_PID, 0x400, 0xffff) }, | ||
447 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2802_8_PID, 0x400, 0xffff) }, | ||
448 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_1_PID, 0x400, 0xffff) }, | ||
449 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_2_PID, 0x400, 0xffff) }, | ||
450 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_3_PID, 0x400, 0xffff) }, | ||
451 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_4_PID, 0x400, 0xffff) }, | ||
452 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_5_PID, 0x400, 0xffff) }, | ||
453 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_6_PID, 0x400, 0xffff) }, | ||
454 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_7_PID, 0x400, 0xffff) }, | ||
455 | { USB_DEVICE_VER(SEALEVEL_VID, SEALEVEL_2803_8_PID, 0x400, 0xffff) }, | ||
456 | { USB_DEVICE_VER(IDTECH_VID, IDTECH_IDT1221U_PID, 0x400, 0xffff) }, | ||
457 | { USB_DEVICE_VER(OCT_VID, OCT_US101_PID, 0x400, 0xffff) }, | ||
458 | { USB_DEVICE_VER(FTDI_VID, PROTEGO_SPECIAL_1, 0x400, 0xffff) }, | ||
459 | { USB_DEVICE_VER(FTDI_VID, PROTEGO_R2X0, 0x400, 0xffff) }, | ||
460 | { USB_DEVICE_VER(FTDI_VID, PROTEGO_SPECIAL_3, 0x400, 0xffff) }, | ||
461 | { USB_DEVICE_VER(FTDI_VID, PROTEGO_SPECIAL_4, 0x400, 0xffff) }, | ||
462 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E808_PID, 0x400, 0xffff) }, | ||
463 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E809_PID, 0x400, 0xffff) }, | ||
464 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80A_PID, 0x400, 0xffff) }, | ||
465 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80B_PID, 0x400, 0xffff) }, | ||
466 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80C_PID, 0x400, 0xffff) }, | ||
467 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80D_PID, 0x400, 0xffff) }, | ||
468 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80E_PID, 0x400, 0xffff) }, | ||
469 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80F_PID, 0x400, 0xffff) }, | ||
470 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E888_PID, 0x400, 0xffff) }, | ||
471 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E889_PID, 0x400, 0xffff) }, | ||
472 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88A_PID, 0x400, 0xffff) }, | ||
473 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88B_PID, 0x400, 0xffff) }, | ||
474 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88C_PID, 0x400, 0xffff) }, | ||
475 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88D_PID, 0x400, 0xffff) }, | ||
476 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88E_PID, 0x400, 0xffff) }, | ||
477 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88F_PID, 0x400, 0xffff) }, | ||
478 | { USB_DEVICE_VER(FTDI_VID, FTDI_ELV_UO100_PID, 0x400, 0xffff) }, | ||
479 | { USB_DEVICE_VER(FTDI_VID, FTDI_ELV_UM100_PID, 0x400, 0xffff) }, | ||
480 | { USB_DEVICE_VER(FTDI_VID, LINX_SDMUSBQSS_PID, 0x400, 0xffff) }, | ||
481 | { USB_DEVICE_VER(FTDI_VID, LINX_MASTERDEVEL2_PID, 0x400, 0xffff) }, | ||
482 | { USB_DEVICE_VER(FTDI_VID, LINX_FUTURE_0_PID, 0x400, 0xffff) }, | ||
483 | { USB_DEVICE_VER(FTDI_VID, LINX_FUTURE_1_PID, 0x400, 0xffff) }, | ||
484 | { USB_DEVICE_VER(FTDI_VID, LINX_FUTURE_2_PID, 0x400, 0xffff) }, | ||
485 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) }, | ||
486 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) }, | ||
487 | { USB_DEVICE_VER(FTDI_VID, INSIDE_ACCESSO, 0x400, 0xffff) }, | ||
488 | { USB_DEVICE_VER(INTREPID_VID, INTREPID_VALUECAN_PID, 0x400, 0xffff) }, | ||
489 | { USB_DEVICE_VER(INTREPID_VID, INTREPID_NEOVI_PID, 0x400, 0xffff) }, | ||
490 | { USB_DEVICE_VER(FALCOM_VID, FALCOM_TWIST_PID, 0x400, 0xffff) }, | ||
491 | { USB_DEVICE_VER(FTDI_VID, FTDI_SUUNTO_SPORTS_PID, 0x400, 0xffff) }, | ||
492 | { USB_DEVICE_VER(FTDI_VID, FTDI_RM_CANVIEW_PID, 0x400, 0xffff) }, | ||
493 | { USB_DEVICE_VER(BANDB_VID, BANDB_USOTL4_PID, 0x400, 0xffff) }, | ||
494 | { USB_DEVICE_VER(BANDB_VID, BANDB_USTL4_PID, 0x400, 0xffff) }, | ||
495 | { USB_DEVICE_VER(BANDB_VID, BANDB_USO9ML2_PID, 0x400, 0xffff) }, | ||
496 | { USB_DEVICE_VER(FTDI_VID, EVER_ECO_PRO_CDS, 0x400, 0xffff) }, | ||
497 | { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_0_PID, 0x400, 0xffff) }, | ||
498 | { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID, 0x400, 0xffff) }, | ||
499 | { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID, 0x400, 0xffff) }, | ||
500 | { USB_DEVICE_VER(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID, 0x400, 0xffff) }, | ||
501 | { } /* Terminating entry */ | ||
502 | }; | ||
503 | |||
504 | |||
505 | static struct usb_device_id id_table_USB_UIRT [] = { | ||
506 | { USB_DEVICE(FTDI_VID, FTDI_USB_UIRT_PID) }, | ||
507 | { } /* Terminating entry */ | ||
508 | }; | ||
509 | |||
510 | |||
511 | static struct usb_device_id id_table_HE_TIRA1 [] = { | ||
512 | { USB_DEVICE_VER(FTDI_VID, FTDI_HE_TIRA1_PID, 0x400, 0xffff) }, | ||
513 | { } /* Terminating entry */ | ||
514 | }; | ||
515 | |||
516 | |||
517 | static struct usb_device_id id_table_FT2232C[] = { | ||
518 | { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) }, | ||
519 | { } /* Terminating entry */ | ||
520 | }; | ||
521 | |||
522 | 306 | ||
523 | static struct usb_device_id id_table_combined [] = { | 307 | static struct usb_device_id id_table_combined [] = { |
524 | { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) }, | 308 | { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) }, |
@@ -540,14 +324,14 @@ static struct usb_device_id id_table_combined [] = { | |||
540 | { USB_DEVICE(FTDI_VID, FTDI_DSS20_PID) }, | 324 | { USB_DEVICE(FTDI_VID, FTDI_DSS20_PID) }, |
541 | { USB_DEVICE(FTDI_NF_RIC_VID, FTDI_NF_RIC_PID) }, | 325 | { USB_DEVICE(FTDI_NF_RIC_VID, FTDI_NF_RIC_PID) }, |
542 | { USB_DEVICE(FTDI_VID, FTDI_VNHCPCUSB_D_PID) }, | 326 | { USB_DEVICE(FTDI_VID, FTDI_VNHCPCUSB_D_PID) }, |
543 | { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_0_PID, 0x400, 0xffff) }, | 327 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_0_PID) }, |
544 | { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_1_PID, 0x400, 0xffff) }, | 328 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_1_PID) }, |
545 | { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_2_PID, 0x400, 0xffff) }, | 329 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_2_PID) }, |
546 | { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_3_PID, 0x400, 0xffff) }, | 330 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_3_PID) }, |
547 | { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_4_PID, 0x400, 0xffff) }, | 331 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) }, |
548 | { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_5_PID, 0x400, 0xffff) }, | 332 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, |
549 | { USB_DEVICE_VER(FTDI_VID, FTDI_MTXORB_6_PID, 0x400, 0xffff) }, | 333 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, |
550 | { USB_DEVICE_VER(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID, 0x400, 0xffff) }, | 334 | { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, |
551 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, | 335 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, |
552 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) }, | 336 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) }, |
553 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) }, | 337 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) }, |
@@ -597,35 +381,37 @@ static struct usb_device_id id_table_combined [] = { | |||
597 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_8_PID) }, | 381 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_8_PID) }, |
598 | { USB_DEVICE(IDTECH_VID, IDTECH_IDT1221U_PID) }, | 382 | { USB_DEVICE(IDTECH_VID, IDTECH_IDT1221U_PID) }, |
599 | { USB_DEVICE(OCT_VID, OCT_US101_PID) }, | 383 | { USB_DEVICE(OCT_VID, OCT_US101_PID) }, |
600 | { USB_DEVICE_VER(FTDI_VID, FTDI_HE_TIRA1_PID, 0x400, 0xffff) }, | 384 | { USB_DEVICE(FTDI_VID, FTDI_HE_TIRA1_PID), |
601 | { USB_DEVICE(FTDI_VID, FTDI_USB_UIRT_PID) }, | 385 | .driver_info = (kernel_ulong_t)&ftdi_HE_TIRA1_quirk }, |
386 | { USB_DEVICE(FTDI_VID, FTDI_USB_UIRT_PID), | ||
387 | .driver_info = (kernel_ulong_t)&ftdi_USB_UIRT_quirk }, | ||
602 | { USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_1) }, | 388 | { USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_1) }, |
603 | { USB_DEVICE(FTDI_VID, PROTEGO_R2X0) }, | 389 | { USB_DEVICE(FTDI_VID, PROTEGO_R2X0) }, |
604 | { USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_3) }, | 390 | { USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_3) }, |
605 | { USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_4) }, | 391 | { USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_4) }, |
606 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E808_PID, 0x400, 0xffff) }, | 392 | { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E808_PID) }, |
607 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E809_PID, 0x400, 0xffff) }, | 393 | { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E809_PID) }, |
608 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80A_PID, 0x400, 0xffff) }, | 394 | { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80A_PID) }, |
609 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80B_PID, 0x400, 0xffff) }, | 395 | { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80B_PID) }, |
610 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80C_PID, 0x400, 0xffff) }, | 396 | { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80C_PID) }, |
611 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80D_PID, 0x400, 0xffff) }, | 397 | { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80D_PID) }, |
612 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80E_PID, 0x400, 0xffff) }, | 398 | { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80E_PID) }, |
613 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80F_PID, 0x400, 0xffff) }, | 399 | { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E80F_PID) }, |
614 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E888_PID, 0x400, 0xffff) }, | 400 | { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E888_PID) }, |
615 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E889_PID, 0x400, 0xffff) }, | 401 | { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E889_PID) }, |
616 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88A_PID, 0x400, 0xffff) }, | 402 | { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88A_PID) }, |
617 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88B_PID, 0x400, 0xffff) }, | 403 | { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88B_PID) }, |
618 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88C_PID, 0x400, 0xffff) }, | 404 | { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88C_PID) }, |
619 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88D_PID, 0x400, 0xffff) }, | 405 | { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88D_PID) }, |
620 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88E_PID, 0x400, 0xffff) }, | 406 | { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88E_PID) }, |
621 | { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88F_PID, 0x400, 0xffff) }, | 407 | { USB_DEVICE(FTDI_VID, FTDI_GUDEADS_E88F_PID) }, |
622 | { USB_DEVICE(FTDI_VID, FTDI_ELV_UO100_PID) }, | 408 | { USB_DEVICE(FTDI_VID, FTDI_ELV_UO100_PID) }, |
623 | { USB_DEVICE(FTDI_VID, FTDI_ELV_UM100_PID) }, | 409 | { USB_DEVICE(FTDI_VID, FTDI_ELV_UM100_PID) }, |
624 | { USB_DEVICE_VER(FTDI_VID, LINX_SDMUSBQSS_PID, 0x400, 0xffff) }, | 410 | { USB_DEVICE(FTDI_VID, LINX_SDMUSBQSS_PID) }, |
625 | { USB_DEVICE_VER(FTDI_VID, LINX_MASTERDEVEL2_PID, 0x400, 0xffff) }, | 411 | { USB_DEVICE(FTDI_VID, LINX_MASTERDEVEL2_PID) }, |
626 | { USB_DEVICE_VER(FTDI_VID, LINX_FUTURE_0_PID, 0x400, 0xffff) }, | 412 | { USB_DEVICE(FTDI_VID, LINX_FUTURE_0_PID) }, |
627 | { USB_DEVICE_VER(FTDI_VID, LINX_FUTURE_1_PID, 0x400, 0xffff) }, | 413 | { USB_DEVICE(FTDI_VID, LINX_FUTURE_1_PID) }, |
628 | { USB_DEVICE_VER(FTDI_VID, LINX_FUTURE_2_PID, 0x400, 0xffff) }, | 414 | { USB_DEVICE(FTDI_VID, LINX_FUTURE_2_PID) }, |
629 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) }, | 415 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) }, |
630 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) }, | 416 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) }, |
631 | { USB_DEVICE(FTDI_VID, INSIDE_ACCESSO) }, | 417 | { USB_DEVICE(FTDI_VID, INSIDE_ACCESSO) }, |
@@ -642,7 +428,7 @@ static struct usb_device_id id_table_combined [] = { | |||
642 | { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) }, | 428 | { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) }, |
643 | { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) }, | 429 | { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) }, |
644 | { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, | 430 | { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, |
645 | { USB_DEVICE_VER(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID, 0x400, 0xffff) }, | 431 | { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) }, |
646 | { } /* Terminating entry */ | 432 | { } /* Terminating entry */ |
647 | }; | 433 | }; |
648 | 434 | ||
@@ -705,12 +491,8 @@ struct ftdi_private { | |||
705 | ASYNC_SPD_CUST | ASYNC_SPD_SHI | ASYNC_SPD_WARP ) | 491 | ASYNC_SPD_CUST | ASYNC_SPD_SHI | ASYNC_SPD_WARP ) |
706 | 492 | ||
707 | /* function prototypes for a FTDI serial converter */ | 493 | /* function prototypes for a FTDI serial converter */ |
708 | static int ftdi_SIO_startup (struct usb_serial *serial); | 494 | static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id); |
709 | static int ftdi_8U232AM_startup (struct usb_serial *serial); | 495 | static int ftdi_sio_attach (struct usb_serial *serial); |
710 | static int ftdi_FT232BM_startup (struct usb_serial *serial); | ||
711 | static int ftdi_FT2232C_startup (struct usb_serial *serial); | ||
712 | static int ftdi_USB_UIRT_startup (struct usb_serial *serial); | ||
713 | static int ftdi_HE_TIRA1_startup (struct usb_serial *serial); | ||
714 | static void ftdi_shutdown (struct usb_serial *serial); | 496 | static void ftdi_shutdown (struct usb_serial *serial); |
715 | static int ftdi_open (struct usb_serial_port *port, struct file *filp); | 497 | static int ftdi_open (struct usb_serial_port *port, struct file *filp); |
716 | static void ftdi_close (struct usb_serial_port *port, struct file *filp); | 498 | static void ftdi_close (struct usb_serial_port *port, struct file *filp); |
@@ -733,14 +515,16 @@ static unsigned short int ftdi_232am_baud_to_divisor (int baud); | |||
733 | static __u32 ftdi_232bm_baud_base_to_divisor (int baud, int base); | 515 | static __u32 ftdi_232bm_baud_base_to_divisor (int baud, int base); |
734 | static __u32 ftdi_232bm_baud_to_divisor (int baud); | 516 | static __u32 ftdi_232bm_baud_to_divisor (int baud); |
735 | 517 | ||
736 | static struct usb_serial_device_type ftdi_SIO_device = { | 518 | static struct usb_serial_device_type ftdi_sio_device = { |
737 | .owner = THIS_MODULE, | 519 | .owner = THIS_MODULE, |
738 | .name = "FTDI SIO", | 520 | .name = "FTDI USB Serial Device", |
739 | .id_table = id_table_sio, | 521 | .short_name = "ftdi_sio", |
522 | .id_table = id_table_combined, | ||
740 | .num_interrupt_in = 0, | 523 | .num_interrupt_in = 0, |
741 | .num_bulk_in = 1, | 524 | .num_bulk_in = 1, |
742 | .num_bulk_out = 1, | 525 | .num_bulk_out = 1, |
743 | .num_ports = 1, | 526 | .num_ports = 1, |
527 | .probe = ftdi_sio_probe, | ||
744 | .open = ftdi_open, | 528 | .open = ftdi_open, |
745 | .close = ftdi_close, | 529 | .close = ftdi_close, |
746 | .throttle = ftdi_throttle, | 530 | .throttle = ftdi_throttle, |
@@ -755,143 +539,10 @@ static struct usb_serial_device_type ftdi_SIO_device = { | |||
755 | .ioctl = ftdi_ioctl, | 539 | .ioctl = ftdi_ioctl, |
756 | .set_termios = ftdi_set_termios, | 540 | .set_termios = ftdi_set_termios, |
757 | .break_ctl = ftdi_break_ctl, | 541 | .break_ctl = ftdi_break_ctl, |
758 | .attach = ftdi_SIO_startup, | 542 | .attach = ftdi_sio_attach, |
759 | .shutdown = ftdi_shutdown, | 543 | .shutdown = ftdi_shutdown, |
760 | }; | 544 | }; |
761 | 545 | ||
762 | static struct usb_serial_device_type ftdi_8U232AM_device = { | ||
763 | .owner = THIS_MODULE, | ||
764 | .name = "FTDI 8U232AM Compatible", | ||
765 | .id_table = id_table_8U232AM, | ||
766 | .num_interrupt_in = 0, | ||
767 | .num_bulk_in = 1, | ||
768 | .num_bulk_out = 1, | ||
769 | .num_ports = 1, | ||
770 | .open = ftdi_open, | ||
771 | .close = ftdi_close, | ||
772 | .throttle = ftdi_throttle, | ||
773 | .unthrottle = ftdi_unthrottle, | ||
774 | .write = ftdi_write, | ||
775 | .write_room = ftdi_write_room, | ||
776 | .chars_in_buffer = ftdi_chars_in_buffer, | ||
777 | .read_bulk_callback = ftdi_read_bulk_callback, | ||
778 | .write_bulk_callback = ftdi_write_bulk_callback, | ||
779 | .tiocmget = ftdi_tiocmget, | ||
780 | .tiocmset = ftdi_tiocmset, | ||
781 | .ioctl = ftdi_ioctl, | ||
782 | .set_termios = ftdi_set_termios, | ||
783 | .break_ctl = ftdi_break_ctl, | ||
784 | .attach = ftdi_8U232AM_startup, | ||
785 | .shutdown = ftdi_shutdown, | ||
786 | }; | ||
787 | |||
788 | static struct usb_serial_device_type ftdi_FT232BM_device = { | ||
789 | .owner = THIS_MODULE, | ||
790 | .name = "FTDI FT232BM Compatible", | ||
791 | .id_table = id_table_FT232BM, | ||
792 | .num_interrupt_in = 0, | ||
793 | .num_bulk_in = 1, | ||
794 | .num_bulk_out = 1, | ||
795 | .num_ports = 1, | ||
796 | .open = ftdi_open, | ||
797 | .close = ftdi_close, | ||
798 | .throttle = ftdi_throttle, | ||
799 | .unthrottle = ftdi_unthrottle, | ||
800 | .write = ftdi_write, | ||
801 | .write_room = ftdi_write_room, | ||
802 | .chars_in_buffer = ftdi_chars_in_buffer, | ||
803 | .read_bulk_callback = ftdi_read_bulk_callback, | ||
804 | .write_bulk_callback = ftdi_write_bulk_callback, | ||
805 | .tiocmget = ftdi_tiocmget, | ||
806 | .tiocmset = ftdi_tiocmset, | ||
807 | .ioctl = ftdi_ioctl, | ||
808 | .set_termios = ftdi_set_termios, | ||
809 | .break_ctl = ftdi_break_ctl, | ||
810 | .attach = ftdi_FT232BM_startup, | ||
811 | .shutdown = ftdi_shutdown, | ||
812 | }; | ||
813 | |||
814 | static struct usb_serial_device_type ftdi_FT2232C_device = { | ||
815 | .owner = THIS_MODULE, | ||
816 | .name = "FTDI FT2232C Compatible", | ||
817 | .id_table = id_table_FT2232C, | ||
818 | .num_interrupt_in = 0, | ||
819 | .num_bulk_in = 1, | ||
820 | .num_bulk_out = 1, | ||
821 | .num_ports = 1, | ||
822 | .open = ftdi_open, | ||
823 | .close = ftdi_close, | ||
824 | .throttle = ftdi_throttle, | ||
825 | .unthrottle = ftdi_unthrottle, | ||
826 | .write = ftdi_write, | ||
827 | .write_room = ftdi_write_room, | ||
828 | .chars_in_buffer = ftdi_chars_in_buffer, | ||
829 | .read_bulk_callback = ftdi_read_bulk_callback, | ||
830 | .write_bulk_callback = ftdi_write_bulk_callback, | ||
831 | .tiocmget = ftdi_tiocmget, | ||
832 | .tiocmset = ftdi_tiocmset, | ||
833 | .ioctl = ftdi_ioctl, | ||
834 | .set_termios = ftdi_set_termios, | ||
835 | .break_ctl = ftdi_break_ctl, | ||
836 | .attach = ftdi_FT2232C_startup, | ||
837 | .shutdown = ftdi_shutdown, | ||
838 | }; | ||
839 | |||
840 | static struct usb_serial_device_type ftdi_USB_UIRT_device = { | ||
841 | .owner = THIS_MODULE, | ||
842 | .name = "USB-UIRT Infrared Tranceiver", | ||
843 | .id_table = id_table_USB_UIRT, | ||
844 | .num_interrupt_in = 0, | ||
845 | .num_bulk_in = 1, | ||
846 | .num_bulk_out = 1, | ||
847 | .num_ports = 1, | ||
848 | .open = ftdi_open, | ||
849 | .close = ftdi_close, | ||
850 | .throttle = ftdi_throttle, | ||
851 | .unthrottle = ftdi_unthrottle, | ||
852 | .write = ftdi_write, | ||
853 | .write_room = ftdi_write_room, | ||
854 | .chars_in_buffer = ftdi_chars_in_buffer, | ||
855 | .read_bulk_callback = ftdi_read_bulk_callback, | ||
856 | .write_bulk_callback = ftdi_write_bulk_callback, | ||
857 | .tiocmget = ftdi_tiocmget, | ||
858 | .tiocmset = ftdi_tiocmset, | ||
859 | .ioctl = ftdi_ioctl, | ||
860 | .set_termios = ftdi_set_termios, | ||
861 | .break_ctl = ftdi_break_ctl, | ||
862 | .attach = ftdi_USB_UIRT_startup, | ||
863 | .shutdown = ftdi_shutdown, | ||
864 | }; | ||
865 | |||
866 | /* The TIRA1 is based on a FT232BM which requires a fixed baud rate of 100000 | ||
867 | * and which requires RTS-CTS to be enabled. */ | ||
868 | static struct usb_serial_device_type ftdi_HE_TIRA1_device = { | ||
869 | .owner = THIS_MODULE, | ||
870 | .name = "Home-Electronics TIRA-1 IR Transceiver", | ||
871 | .id_table = id_table_HE_TIRA1, | ||
872 | .num_interrupt_in = 0, | ||
873 | .num_bulk_in = 1, | ||
874 | .num_bulk_out = 1, | ||
875 | .num_ports = 1, | ||
876 | .open = ftdi_open, | ||
877 | .close = ftdi_close, | ||
878 | .throttle = ftdi_throttle, | ||
879 | .unthrottle = ftdi_unthrottle, | ||
880 | .write = ftdi_write, | ||
881 | .write_room = ftdi_write_room, | ||
882 | .chars_in_buffer = ftdi_chars_in_buffer, | ||
883 | .read_bulk_callback = ftdi_read_bulk_callback, | ||
884 | .write_bulk_callback = ftdi_write_bulk_callback, | ||
885 | .tiocmget = ftdi_tiocmget, | ||
886 | .tiocmset = ftdi_tiocmset, | ||
887 | .ioctl = ftdi_ioctl, | ||
888 | .set_termios = ftdi_set_termios, | ||
889 | .break_ctl = ftdi_break_ctl, | ||
890 | .attach = ftdi_HE_TIRA1_startup, | ||
891 | .shutdown = ftdi_shutdown, | ||
892 | }; | ||
893 | |||
894 | |||
895 | 546 | ||
896 | #define WDR_TIMEOUT 5000 /* default urb timeout */ | 547 | #define WDR_TIMEOUT 5000 /* default urb timeout */ |
897 | 548 | ||
@@ -1212,6 +863,59 @@ check_and_exit: | |||
1212 | } /* set_serial_info */ | 863 | } /* set_serial_info */ |
1213 | 864 | ||
1214 | 865 | ||
866 | /* Determine type of FTDI chip based on USB config and descriptor. */ | ||
867 | static void ftdi_determine_type(struct usb_serial_port *port) | ||
868 | { | ||
869 | struct ftdi_private *priv = usb_get_serial_port_data(port); | ||
870 | struct usb_serial *serial = port->serial; | ||
871 | struct usb_device *udev = serial->dev; | ||
872 | unsigned version; | ||
873 | unsigned interfaces; | ||
874 | |||
875 | /* Assume it is not the original SIO device for now. */ | ||
876 | priv->baud_base = 48000000 / 16; | ||
877 | priv->write_offset = 0; | ||
878 | |||
879 | version = le16_to_cpu(udev->descriptor.bcdDevice); | ||
880 | interfaces = udev->actconfig->desc.bNumInterfaces; | ||
881 | dbg("%s: bcdDevice = 0x%x, bNumInterfaces = %u", __FUNCTION__, | ||
882 | version, interfaces); | ||
883 | if (interfaces > 1) { | ||
884 | int inter; | ||
885 | |||
886 | /* Multiple interfaces. Assume FT2232C. */ | ||
887 | priv->chip_type = FT2232C; | ||
888 | /* Determine interface code. */ | ||
889 | inter = serial->interface->altsetting->desc.bInterfaceNumber; | ||
890 | if (inter == 0) { | ||
891 | priv->interface = PIT_SIOA; | ||
892 | } else { | ||
893 | priv->interface = PIT_SIOB; | ||
894 | } | ||
895 | /* BM-type devices have a bug where bcdDevice gets set | ||
896 | * to 0x200 when iSerialNumber is 0. */ | ||
897 | if (version < 0x500) { | ||
898 | dbg("%s: something fishy - bcdDevice too low for multi-interface device", | ||
899 | __FUNCTION__); | ||
900 | } | ||
901 | } else if (version < 0x200) { | ||
902 | /* Old device. Assume its the original SIO. */ | ||
903 | priv->chip_type = SIO; | ||
904 | priv->baud_base = 12000000 / 16; | ||
905 | priv->write_offset = 1; | ||
906 | } else if (version < 0x400) { | ||
907 | /* Assume its an FT8U232AM (or FT8U245AM) */ | ||
908 | /* (It might be a BM because of the iSerialNumber bug, | ||
909 | * but it will still work as an AM device.) */ | ||
910 | priv->chip_type = FT8U232AM; | ||
911 | } else { | ||
912 | /* Assume its an FT232BM (or FT245BM) */ | ||
913 | priv->chip_type = FT232BM; | ||
914 | } | ||
915 | info("Detected %s", ftdi_chip_name[priv->chip_type]); | ||
916 | } | ||
917 | |||
918 | |||
1215 | /* | 919 | /* |
1216 | * *************************************************************************** | 920 | * *************************************************************************** |
1217 | * Sysfs Attribute | 921 | * Sysfs Attribute |
@@ -1355,12 +1059,20 @@ static void remove_sysfs_attrs(struct usb_serial *serial) | |||
1355 | * *************************************************************************** | 1059 | * *************************************************************************** |
1356 | */ | 1060 | */ |
1357 | 1061 | ||
1358 | /* Common startup subroutine */ | 1062 | /* Probe function to check for special devices */ |
1359 | /* Called from ftdi_SIO_startup, etc. */ | 1063 | static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id *id) |
1360 | static int ftdi_common_startup (struct usb_serial *serial) | 1064 | { |
1065 | usb_set_serial_data(serial, (void *)id->driver_info); | ||
1066 | |||
1067 | return (0); | ||
1068 | } | ||
1069 | |||
1070 | /* attach subroutine */ | ||
1071 | static int ftdi_sio_attach (struct usb_serial *serial) | ||
1361 | { | 1072 | { |
1362 | struct usb_serial_port *port = serial->port[0]; | 1073 | struct usb_serial_port *port = serial->port[0]; |
1363 | struct ftdi_private *priv; | 1074 | struct ftdi_private *priv; |
1075 | struct ftdi_sio_quirk *quirk; | ||
1364 | 1076 | ||
1365 | dbg("%s",__FUNCTION__); | 1077 | dbg("%s",__FUNCTION__); |
1366 | 1078 | ||
@@ -1400,150 +1112,49 @@ static int ftdi_common_startup (struct usb_serial *serial) | |||
1400 | port->bulk_out_buffer = NULL; | 1112 | port->bulk_out_buffer = NULL; |
1401 | 1113 | ||
1402 | usb_set_serial_port_data(serial->port[0], priv); | 1114 | usb_set_serial_port_data(serial->port[0], priv); |
1403 | |||
1404 | return (0); | ||
1405 | } | ||
1406 | |||
1407 | |||
1408 | /* Startup for the SIO chip */ | ||
1409 | /* Called from usbserial:serial_probe */ | ||
1410 | static int ftdi_SIO_startup (struct usb_serial *serial) | ||
1411 | { | ||
1412 | struct ftdi_private *priv; | ||
1413 | int err; | ||
1414 | |||
1415 | dbg("%s",__FUNCTION__); | ||
1416 | |||
1417 | err = ftdi_common_startup(serial); | ||
1418 | if (err){ | ||
1419 | return (err); | ||
1420 | } | ||
1421 | |||
1422 | priv = usb_get_serial_port_data(serial->port[0]); | ||
1423 | priv->chip_type = SIO; | ||
1424 | priv->baud_base = 12000000 / 16; | ||
1425 | priv->write_offset = 1; | ||
1426 | |||
1427 | return (0); | ||
1428 | } | ||
1429 | |||
1430 | /* Startup for the 8U232AM chip */ | ||
1431 | /* Called from usbserial:serial_probe */ | ||
1432 | static int ftdi_8U232AM_startup (struct usb_serial *serial) | ||
1433 | { /* ftdi_8U232AM_startup */ | ||
1434 | struct ftdi_private *priv; | ||
1435 | int err; | ||
1436 | |||
1437 | dbg("%s",__FUNCTION__); | ||
1438 | err = ftdi_common_startup(serial); | ||
1439 | if (err){ | ||
1440 | return (err); | ||
1441 | } | ||
1442 | 1115 | ||
1443 | priv = usb_get_serial_port_data(serial->port[0]); | 1116 | ftdi_determine_type (serial->port[0]); |
1444 | priv->chip_type = FT8U232AM; | ||
1445 | priv->baud_base = 48000000 / 2; /* Would be / 16, but FTDI supports 0.125, 0.25 and 0.5 divisor fractions! */ | ||
1446 | |||
1447 | create_sysfs_attrs(serial); | 1117 | create_sysfs_attrs(serial); |
1448 | |||
1449 | return (0); | ||
1450 | } /* ftdi_8U232AM_startup */ | ||
1451 | 1118 | ||
1452 | /* Startup for the FT232BM chip */ | 1119 | /* Check for device requiring special set up. */ |
1453 | /* Called from usbserial:serial_probe */ | 1120 | quirk = (struct ftdi_sio_quirk *)usb_get_serial_data(serial); |
1454 | static int ftdi_FT232BM_startup (struct usb_serial *serial) | 1121 | if (quirk && quirk->setup) { |
1455 | { /* ftdi_FT232BM_startup */ | 1122 | quirk->setup(serial); |
1456 | struct ftdi_private *priv; | ||
1457 | int err; | ||
1458 | |||
1459 | dbg("%s",__FUNCTION__); | ||
1460 | err = ftdi_common_startup(serial); | ||
1461 | if (err){ | ||
1462 | return (err); | ||
1463 | } | 1123 | } |
1464 | |||
1465 | priv = usb_get_serial_port_data(serial->port[0]); | ||
1466 | priv->chip_type = FT232BM; | ||
1467 | priv->baud_base = 48000000 / 2; /* Would be / 16, but FT232BM supports multiple of 0.125 divisor fractions! */ | ||
1468 | 1124 | ||
1469 | create_sysfs_attrs(serial); | ||
1470 | |||
1471 | return (0); | 1125 | return (0); |
1472 | } /* ftdi_FT232BM_startup */ | 1126 | } /* ftdi_sio_attach */ |
1473 | |||
1474 | /* Startup for the FT2232C chip */ | ||
1475 | /* Called from usbserial:serial_probe */ | ||
1476 | static int ftdi_FT2232C_startup (struct usb_serial *serial) | ||
1477 | { /* ftdi_FT2232C_startup */ | ||
1478 | struct ftdi_private *priv; | ||
1479 | int err; | ||
1480 | int inter; | ||
1481 | |||
1482 | dbg("%s",__FUNCTION__); | ||
1483 | err = ftdi_common_startup(serial); | ||
1484 | if (err){ | ||
1485 | return (err); | ||
1486 | } | ||
1487 | 1127 | ||
1488 | priv = usb_get_serial_port_data(serial->port[0]); | ||
1489 | priv->chip_type = FT2232C; | ||
1490 | inter = serial->interface->altsetting->desc.bInterfaceNumber; | ||
1491 | 1128 | ||
1492 | if (inter) { | 1129 | /* Setup for the USB-UIRT device, which requires hardwired |
1493 | priv->interface = PIT_SIOB; | 1130 | * baudrate (38400 gets mapped to 312500) */ |
1494 | } | ||
1495 | else { | ||
1496 | priv->interface = PIT_SIOA; | ||
1497 | } | ||
1498 | priv->baud_base = 48000000 / 2; /* Would be / 16, but FT2232C supports multiple of 0.125 divisor fractions! */ | ||
1499 | |||
1500 | create_sysfs_attrs(serial); | ||
1501 | |||
1502 | return (0); | ||
1503 | } /* ftdi_FT2232C_startup */ | ||
1504 | |||
1505 | /* Startup for the USB-UIRT device, which requires hardwired baudrate (38400 gets mapped to 312500) */ | ||
1506 | /* Called from usbserial:serial_probe */ | 1131 | /* Called from usbserial:serial_probe */ |
1507 | static int ftdi_USB_UIRT_startup (struct usb_serial *serial) | 1132 | static void ftdi_USB_UIRT_setup (struct usb_serial *serial) |
1508 | { /* ftdi_USB_UIRT_startup */ | 1133 | { |
1509 | struct ftdi_private *priv; | 1134 | struct ftdi_private *priv; |
1510 | int err; | ||
1511 | 1135 | ||
1512 | dbg("%s",__FUNCTION__); | 1136 | dbg("%s",__FUNCTION__); |
1513 | err = ftdi_8U232AM_startup(serial); | ||
1514 | if (err){ | ||
1515 | return (err); | ||
1516 | } | ||
1517 | 1137 | ||
1518 | priv = usb_get_serial_port_data(serial->port[0]); | 1138 | priv = usb_get_serial_port_data(serial->port[0]); |
1519 | priv->flags |= ASYNC_SPD_CUST; | 1139 | priv->flags |= ASYNC_SPD_CUST; |
1520 | priv->custom_divisor = 77; | 1140 | priv->custom_divisor = 77; |
1521 | priv->force_baud = B38400; | 1141 | priv->force_baud = B38400; |
1522 | 1142 | } /* ftdi_USB_UIRT_setup */ | |
1523 | return (0); | ||
1524 | } /* ftdi_USB_UIRT_startup */ | ||
1525 | 1143 | ||
1526 | /* Startup for the HE-TIRA1 device, which requires hardwired | 1144 | /* Setup for the HE-TIRA1 device, which requires hardwired |
1527 | * baudrate (38400 gets mapped to 100000) */ | 1145 | * baudrate (38400 gets mapped to 100000) and RTS-CTS enabled. */ |
1528 | static int ftdi_HE_TIRA1_startup (struct usb_serial *serial) | 1146 | static void ftdi_HE_TIRA1_setup (struct usb_serial *serial) |
1529 | { /* ftdi_HE_TIRA1_startup */ | 1147 | { |
1530 | struct ftdi_private *priv; | 1148 | struct ftdi_private *priv; |
1531 | int err; | ||
1532 | 1149 | ||
1533 | dbg("%s",__FUNCTION__); | 1150 | dbg("%s",__FUNCTION__); |
1534 | err = ftdi_FT232BM_startup(serial); | ||
1535 | if (err){ | ||
1536 | return (err); | ||
1537 | } | ||
1538 | 1151 | ||
1539 | priv = usb_get_serial_port_data(serial->port[0]); | 1152 | priv = usb_get_serial_port_data(serial->port[0]); |
1540 | priv->flags |= ASYNC_SPD_CUST; | 1153 | priv->flags |= ASYNC_SPD_CUST; |
1541 | priv->custom_divisor = 240; | 1154 | priv->custom_divisor = 240; |
1542 | priv->force_baud = B38400; | 1155 | priv->force_baud = B38400; |
1543 | priv->force_rtscts = 1; | 1156 | priv->force_rtscts = 1; |
1544 | 1157 | } /* ftdi_HE_TIRA1_setup */ | |
1545 | return (0); | ||
1546 | } /* ftdi_HE_TIRA1_startup */ | ||
1547 | 1158 | ||
1548 | 1159 | ||
1549 | /* ftdi_shutdown is called from usbserial:usb_serial_disconnect | 1160 | /* ftdi_shutdown is called from usbserial:usb_serial_disconnect |
@@ -2367,60 +1978,11 @@ static int ftdi_ioctl (struct usb_serial_port *port, struct file * file, unsigne | |||
2367 | { | 1978 | { |
2368 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1979 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
2369 | 1980 | ||
2370 | int ret, mask; | ||
2371 | |||
2372 | dbg("%s cmd 0x%04x", __FUNCTION__, cmd); | 1981 | dbg("%s cmd 0x%04x", __FUNCTION__, cmd); |
2373 | 1982 | ||
2374 | /* Based on code from acm.c and others */ | 1983 | /* Based on code from acm.c and others */ |
2375 | switch (cmd) { | 1984 | switch (cmd) { |
2376 | 1985 | ||
2377 | case TIOCMBIS: /* turns on (Sets) the lines as specified by the mask */ | ||
2378 | dbg("%s TIOCMBIS", __FUNCTION__); | ||
2379 | if (get_user(mask, (unsigned long __user *) arg)) | ||
2380 | return -EFAULT; | ||
2381 | if (mask & TIOCM_DTR){ | ||
2382 | if ((ret = set_dtr(port, HIGH)) < 0) { | ||
2383 | err("Urb to set DTR failed"); | ||
2384 | return(ret); | ||
2385 | } | ||
2386 | } | ||
2387 | if (mask & TIOCM_RTS) { | ||
2388 | if ((ret = set_rts(port, HIGH)) < 0){ | ||
2389 | err("Urb to set RTS failed"); | ||
2390 | return(ret); | ||
2391 | } | ||
2392 | } | ||
2393 | return(0); | ||
2394 | break; | ||
2395 | |||
2396 | case TIOCMBIC: /* turns off (Clears) the lines as specified by the mask */ | ||
2397 | dbg("%s TIOCMBIC", __FUNCTION__); | ||
2398 | if (get_user(mask, (unsigned long __user *) arg)) | ||
2399 | return -EFAULT; | ||
2400 | if (mask & TIOCM_DTR){ | ||
2401 | if ((ret = set_dtr(port, LOW)) < 0){ | ||
2402 | err("Urb to unset DTR failed"); | ||
2403 | return(ret); | ||
2404 | } | ||
2405 | } | ||
2406 | if (mask & TIOCM_RTS) { | ||
2407 | if ((ret = set_rts(port, LOW)) < 0){ | ||
2408 | err("Urb to unset RTS failed"); | ||
2409 | return(ret); | ||
2410 | } | ||
2411 | } | ||
2412 | return(0); | ||
2413 | break; | ||
2414 | |||
2415 | /* | ||
2416 | * I had originally implemented TCSET{A,S}{,F,W} and | ||
2417 | * TCGET{A,S} here separately, however when testing I | ||
2418 | * found that the higher layers actually do the termios | ||
2419 | * conversions themselves and pass the call onto | ||
2420 | * ftdi_sio_set_termios. | ||
2421 | * | ||
2422 | */ | ||
2423 | |||
2424 | case TIOCGSERIAL: /* gets serial port data */ | 1986 | case TIOCGSERIAL: /* gets serial port data */ |
2425 | return get_serial_info(port, (struct serial_struct __user *) arg); | 1987 | return get_serial_info(port, (struct serial_struct __user *) arg); |
2426 | 1988 | ||
@@ -2516,24 +2078,9 @@ static int __init ftdi_init (void) | |||
2516 | int retval; | 2078 | int retval; |
2517 | 2079 | ||
2518 | dbg("%s", __FUNCTION__); | 2080 | dbg("%s", __FUNCTION__); |
2519 | retval = usb_serial_register(&ftdi_SIO_device); | 2081 | retval = usb_serial_register(&ftdi_sio_device); |
2520 | if (retval) | ||
2521 | goto failed_SIO_register; | ||
2522 | retval = usb_serial_register(&ftdi_8U232AM_device); | ||
2523 | if (retval) | ||
2524 | goto failed_8U232AM_register; | ||
2525 | retval = usb_serial_register(&ftdi_FT232BM_device); | ||
2526 | if (retval) | ||
2527 | goto failed_FT232BM_register; | ||
2528 | retval = usb_serial_register(&ftdi_FT2232C_device); | ||
2529 | if (retval) | ||
2530 | goto failed_FT2232C_register; | ||
2531 | retval = usb_serial_register(&ftdi_USB_UIRT_device); | ||
2532 | if (retval) | ||
2533 | goto failed_USB_UIRT_register; | ||
2534 | retval = usb_serial_register(&ftdi_HE_TIRA1_device); | ||
2535 | if (retval) | 2082 | if (retval) |
2536 | goto failed_HE_TIRA1_register; | 2083 | goto failed_sio_register; |
2537 | retval = usb_register(&ftdi_driver); | 2084 | retval = usb_register(&ftdi_driver); |
2538 | if (retval) | 2085 | if (retval) |
2539 | goto failed_usb_register; | 2086 | goto failed_usb_register; |
@@ -2541,18 +2088,8 @@ static int __init ftdi_init (void) | |||
2541 | info(DRIVER_VERSION ":" DRIVER_DESC); | 2088 | info(DRIVER_VERSION ":" DRIVER_DESC); |
2542 | return 0; | 2089 | return 0; |
2543 | failed_usb_register: | 2090 | failed_usb_register: |
2544 | usb_serial_deregister(&ftdi_HE_TIRA1_device); | 2091 | usb_serial_deregister(&ftdi_sio_device); |
2545 | failed_HE_TIRA1_register: | 2092 | failed_sio_register: |
2546 | usb_serial_deregister(&ftdi_USB_UIRT_device); | ||
2547 | failed_USB_UIRT_register: | ||
2548 | usb_serial_deregister(&ftdi_FT2232C_device); | ||
2549 | failed_FT2232C_register: | ||
2550 | usb_serial_deregister(&ftdi_FT232BM_device); | ||
2551 | failed_FT232BM_register: | ||
2552 | usb_serial_deregister(&ftdi_8U232AM_device); | ||
2553 | failed_8U232AM_register: | ||
2554 | usb_serial_deregister(&ftdi_SIO_device); | ||
2555 | failed_SIO_register: | ||
2556 | return retval; | 2093 | return retval; |
2557 | } | 2094 | } |
2558 | 2095 | ||
@@ -2563,12 +2100,7 @@ static void __exit ftdi_exit (void) | |||
2563 | dbg("%s", __FUNCTION__); | 2100 | dbg("%s", __FUNCTION__); |
2564 | 2101 | ||
2565 | usb_deregister (&ftdi_driver); | 2102 | usb_deregister (&ftdi_driver); |
2566 | usb_serial_deregister (&ftdi_HE_TIRA1_device); | 2103 | usb_serial_deregister (&ftdi_sio_device); |
2567 | usb_serial_deregister (&ftdi_USB_UIRT_device); | ||
2568 | usb_serial_deregister (&ftdi_FT2232C_device); | ||
2569 | usb_serial_deregister (&ftdi_FT232BM_device); | ||
2570 | usb_serial_deregister (&ftdi_8U232AM_device); | ||
2571 | usb_serial_deregister (&ftdi_SIO_device); | ||
2572 | 2104 | ||
2573 | } | 2105 | } |
2574 | 2106 | ||
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 9fcc7bd1fbe4..bd0ab3039bdd 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -697,7 +697,7 @@ UNUSUAL_DEV( 0x07af, 0x0004, 0x0100, 0x0133, | |||
697 | UNUSUAL_DEV( 0x07af, 0x0005, 0x0100, 0x0100, | 697 | UNUSUAL_DEV( 0x07af, 0x0005, 0x0100, 0x0100, |
698 | "Microtech", | 698 | "Microtech", |
699 | "USB-SCSI-HD50", | 699 | "USB-SCSI-HD50", |
700 | US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, | 700 | US_SC_DEVICE, US_PR_DEVICE, usb_stor_euscsi_init, |
701 | US_FL_SCM_MULT_TARG ), | 701 | US_FL_SCM_MULT_TARG ), |
702 | 702 | ||
703 | #ifdef CONFIG_USB_STORAGE_DPCM | 703 | #ifdef CONFIG_USB_STORAGE_DPCM |
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index 312cf3220f12..8a9c42822502 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c | |||
@@ -516,6 +516,7 @@ static void w1_slave_found(unsigned long data, u64 rn) | |||
516 | struct w1_reg_num *tmp; | 516 | struct w1_reg_num *tmp; |
517 | int family_found = 0; | 517 | int family_found = 0; |
518 | struct w1_master *dev; | 518 | struct w1_master *dev; |
519 | u64 rn_le = cpu_to_le64(rn); | ||
519 | 520 | ||
520 | dev = w1_search_master(data); | 521 | dev = w1_search_master(data); |
521 | if (!dev) { | 522 | if (!dev) { |
@@ -544,10 +545,8 @@ static void w1_slave_found(unsigned long data, u64 rn) | |||
544 | slave_count++; | 545 | slave_count++; |
545 | } | 546 | } |
546 | 547 | ||
547 | rn = cpu_to_le64(rn); | ||
548 | |||
549 | if (slave_count == dev->slave_count && | 548 | if (slave_count == dev->slave_count && |
550 | rn && ((le64_to_cpu(rn) >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn, 7)) { | 549 | rn && ((rn >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn_le, 7)) { |
551 | w1_attach_slave_device(dev, tmp); | 550 | w1_attach_slave_device(dev, tmp); |
552 | } | 551 | } |
553 | 552 | ||