osl.c 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398
  1. /*
  2. * acpi_osl.c - OS-dependent functions ($Revision: 83 $)
  3. *
  4. * Copyright (C) 2000 Andrew Henroid
  5. * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
  6. * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
  7. *
  8. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. *
  24. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  25. *
  26. */
  27. #include <linux/module.h>
  28. #include <linux/kernel.h>
  29. #include <linux/slab.h>
  30. #include <linux/mm.h>
  31. #include <linux/pci.h>
  32. #include <linux/interrupt.h>
  33. #include <linux/kmod.h>
  34. #include <linux/delay.h>
  35. #include <linux/dmi.h>
  36. #include <linux/workqueue.h>
  37. #include <linux/nmi.h>
  38. #include <linux/acpi.h>
  39. #include <acpi/acpi.h>
  40. #include <asm/io.h>
  41. #include <acpi/acpi_bus.h>
  42. #include <acpi/processor.h>
  43. #include <asm/uaccess.h>
  44. #include <linux/efi.h>
  45. #define _COMPONENT ACPI_OS_SERVICES
  46. ACPI_MODULE_NAME("osl");
  47. #define PREFIX "ACPI: "
  48. struct acpi_os_dpc {
  49. acpi_osd_exec_callback function;
  50. void *context;
  51. struct work_struct work;
  52. };
  53. #ifdef CONFIG_ACPI_CUSTOM_DSDT
  54. #include CONFIG_ACPI_CUSTOM_DSDT_FILE
  55. #endif
  56. #ifdef ENABLE_DEBUGGER
  57. #include <linux/kdb.h>
  58. /* stuff for debugger support */
  59. int acpi_in_debugger;
  60. EXPORT_SYMBOL(acpi_in_debugger);
  61. extern char line_buf[80];
  62. #endif /*ENABLE_DEBUGGER */
  63. static unsigned int acpi_irq_irq;
  64. static acpi_osd_handler acpi_irq_handler;
  65. static void *acpi_irq_context;
  66. static struct workqueue_struct *kacpid_wq;
  67. static struct workqueue_struct *kacpi_notify_wq;
  68. #define OSI_STRING_LENGTH_MAX 64 /* arbitrary */
  69. static char osi_additional_string[OSI_STRING_LENGTH_MAX];
  70. #ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
  71. static int acpi_no_initrd_override;
  72. #endif
  73. /*
  74. * "Ode to _OSI(Linux)"
  75. *
  76. * osi_linux -- Control response to BIOS _OSI(Linux) query.
  77. *
  78. * As Linux evolves, the features that it supports change.
  79. * So an OSI string such as "Linux" is not specific enough
  80. * to be useful across multiple versions of Linux. It
  81. * doesn't identify any particular feature, interface,
  82. * or even any particular version of Linux...
  83. *
  84. * Unfortunately, Linux-2.6.22 and earlier responded "yes"
  85. * to a BIOS _OSI(Linux) query. When
  86. * a reference mobile BIOS started using it, its use
  87. * started to spread to many vendor platforms.
  88. * As it is not supportable, we need to halt that spread.
  89. *
  90. * Today, most BIOS references to _OSI(Linux) are noise --
  91. * they have no functional effect and are just dead code
  92. * carried over from the reference BIOS.
  93. *
  94. * The next most common case is that _OSI(Linux) harms Linux,
  95. * usually by causing the BIOS to follow paths that are
  96. * not tested during Windows validation.
  97. *
  98. * Finally, there is a short list of platforms
  99. * where OSI(Linux) benefits Linux.
  100. *
  101. * In Linux-2.6.23, OSI(Linux) is first disabled by default.
  102. * DMI is used to disable the dmesg warning about OSI(Linux)
  103. * on platforms where it is known to have no effect.
  104. * But a dmesg warning remains for systems where
  105. * we do not know if OSI(Linux) is good or bad for the system.
  106. * DMI is also used to enable OSI(Linux) for the machines
  107. * that are known to need it.
  108. *
  109. * BIOS writers should NOT query _OSI(Linux) on future systems.
  110. * It will be ignored by default, and to get Linux to
  111. * not ignore it will require a kernel source update to
  112. * add a DMI entry, or a boot-time "acpi_osi=Linux" invocation.
  113. */
  114. #define OSI_LINUX_ENABLE 0
  115. struct osi_linux {
  116. unsigned int enable:1;
  117. unsigned int dmi:1;
  118. unsigned int cmdline:1;
  119. unsigned int known:1;
  120. } osi_linux = { OSI_LINUX_ENABLE, 0, 0, 0};
  121. static void __init acpi_request_region (struct acpi_generic_address *addr,
  122. unsigned int length, char *desc)
  123. {
  124. struct resource *res;
  125. if (!addr->address || !length)
  126. return;
  127. if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_IO)
  128. res = request_region(addr->address, length, desc);
  129. else if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
  130. res = request_mem_region(addr->address, length, desc);
  131. }
  132. static int __init acpi_reserve_resources(void)
  133. {
  134. acpi_request_region(&acpi_gbl_FADT.xpm1a_event_block, acpi_gbl_FADT.pm1_event_length,
  135. "ACPI PM1a_EVT_BLK");
  136. acpi_request_region(&acpi_gbl_FADT.xpm1b_event_block, acpi_gbl_FADT.pm1_event_length,
  137. "ACPI PM1b_EVT_BLK");
  138. acpi_request_region(&acpi_gbl_FADT.xpm1a_control_block, acpi_gbl_FADT.pm1_control_length,
  139. "ACPI PM1a_CNT_BLK");
  140. acpi_request_region(&acpi_gbl_FADT.xpm1b_control_block, acpi_gbl_FADT.pm1_control_length,
  141. "ACPI PM1b_CNT_BLK");
  142. if (acpi_gbl_FADT.pm_timer_length == 4)
  143. acpi_request_region(&acpi_gbl_FADT.xpm_timer_block, 4, "ACPI PM_TMR");
  144. acpi_request_region(&acpi_gbl_FADT.xpm2_control_block, acpi_gbl_FADT.pm2_control_length,
  145. "ACPI PM2_CNT_BLK");
  146. /* Length of GPE blocks must be a non-negative multiple of 2 */
  147. if (!(acpi_gbl_FADT.gpe0_block_length & 0x1))
  148. acpi_request_region(&acpi_gbl_FADT.xgpe0_block,
  149. acpi_gbl_FADT.gpe0_block_length, "ACPI GPE0_BLK");
  150. if (!(acpi_gbl_FADT.gpe1_block_length & 0x1))
  151. acpi_request_region(&acpi_gbl_FADT.xgpe1_block,
  152. acpi_gbl_FADT.gpe1_block_length, "ACPI GPE1_BLK");
  153. return 0;
  154. }
  155. device_initcall(acpi_reserve_resources);
  156. acpi_status __init acpi_os_initialize(void)
  157. {
  158. return AE_OK;
  159. }
  160. acpi_status acpi_os_initialize1(void)
  161. {
  162. /*
  163. * Initialize PCI configuration space access, as we'll need to access
  164. * it while walking the namespace (bus 0 and root bridges w/ _BBNs).
  165. */
  166. if (!raw_pci_ops) {
  167. printk(KERN_ERR PREFIX
  168. "Access to PCI configuration space unavailable\n");
  169. return AE_NULL_ENTRY;
  170. }
  171. kacpid_wq = create_singlethread_workqueue("kacpid");
  172. kacpi_notify_wq = create_singlethread_workqueue("kacpi_notify");
  173. BUG_ON(!kacpid_wq);
  174. BUG_ON(!kacpi_notify_wq);
  175. return AE_OK;
  176. }
  177. acpi_status acpi_os_terminate(void)
  178. {
  179. if (acpi_irq_handler) {
  180. acpi_os_remove_interrupt_handler(acpi_irq_irq,
  181. acpi_irq_handler);
  182. }
  183. destroy_workqueue(kacpid_wq);
  184. destroy_workqueue(kacpi_notify_wq);
  185. return AE_OK;
  186. }
  187. void acpi_os_printf(const char *fmt, ...)
  188. {
  189. va_list args;
  190. va_start(args, fmt);
  191. acpi_os_vprintf(fmt, args);
  192. va_end(args);
  193. }
  194. EXPORT_SYMBOL(acpi_os_printf);
  195. void acpi_os_vprintf(const char *fmt, va_list args)
  196. {
  197. static char buffer[512];
  198. vsprintf(buffer, fmt, args);
  199. #ifdef ENABLE_DEBUGGER
  200. if (acpi_in_debugger) {
  201. kdb_printf("%s", buffer);
  202. } else {
  203. printk("%s", buffer);
  204. }
  205. #else
  206. printk("%s", buffer);
  207. #endif
  208. }
  209. acpi_physical_address __init acpi_os_get_root_pointer(void)
  210. {
  211. if (efi_enabled) {
  212. if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
  213. return efi.acpi20;
  214. else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
  215. return efi.acpi;
  216. else {
  217. printk(KERN_ERR PREFIX
  218. "System description tables not found\n");
  219. return 0;
  220. }
  221. } else
  222. return acpi_find_rsdp();
  223. }
  224. void __iomem *acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
  225. {
  226. if (phys > ULONG_MAX) {
  227. printk(KERN_ERR PREFIX "Cannot map memory that high\n");
  228. return NULL;
  229. }
  230. if (acpi_gbl_permanent_mmap)
  231. /*
  232. * ioremap checks to ensure this is in reserved space
  233. */
  234. return ioremap((unsigned long)phys, size);
  235. else
  236. return __acpi_map_table((unsigned long)phys, size);
  237. }
  238. EXPORT_SYMBOL_GPL(acpi_os_map_memory);
  239. void acpi_os_unmap_memory(void __iomem * virt, acpi_size size)
  240. {
  241. if (acpi_gbl_permanent_mmap) {
  242. iounmap(virt);
  243. }
  244. }
  245. EXPORT_SYMBOL_GPL(acpi_os_unmap_memory);
  246. #ifdef ACPI_FUTURE_USAGE
  247. acpi_status
  248. acpi_os_get_physical_address(void *virt, acpi_physical_address * phys)
  249. {
  250. if (!phys || !virt)
  251. return AE_BAD_PARAMETER;
  252. *phys = virt_to_phys(virt);
  253. return AE_OK;
  254. }
  255. #endif
  256. #define ACPI_MAX_OVERRIDE_LEN 100
  257. static char acpi_os_name[ACPI_MAX_OVERRIDE_LEN];
  258. acpi_status
  259. acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
  260. acpi_string * new_val)
  261. {
  262. if (!init_val || !new_val)
  263. return AE_BAD_PARAMETER;
  264. *new_val = NULL;
  265. if (!memcmp(init_val->name, "_OS_", 4) && strlen(acpi_os_name)) {
  266. printk(KERN_INFO PREFIX "Overriding _OS definition to '%s'\n",
  267. acpi_os_name);
  268. *new_val = acpi_os_name;
  269. }
  270. return AE_OK;
  271. }
  272. #ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
  273. struct acpi_table_header *acpi_find_dsdt_initrd(void)
  274. {
  275. struct file *firmware_file;
  276. mm_segment_t oldfs;
  277. unsigned long len, len2;
  278. struct acpi_table_header *dsdt_buffer, *ret = NULL;
  279. struct kstat stat;
  280. char *ramfs_dsdt_name = "/DSDT.aml";
  281. printk(KERN_INFO PREFIX "Looking for DSDT in initramfs... ");
  282. /*
  283. * Never do this at home, only the user-space is allowed to open a file.
  284. * The clean way would be to use the firmware loader. But this code must be run
  285. * before there is any userspace available. So we need a static/init firmware
  286. * infrastructure, which doesn't exist yet...
  287. */
  288. if (vfs_stat(ramfs_dsdt_name, &stat) < 0) {
  289. printk("not found.\n");
  290. return ret;
  291. }
  292. len = stat.size;
  293. /* check especially against empty files */
  294. if (len <= 4) {
  295. printk("error, file is too small: only %lu bytes.\n", len);
  296. return ret;
  297. }
  298. firmware_file = filp_open(ramfs_dsdt_name, O_RDONLY, 0);
  299. if (IS_ERR(firmware_file)) {
  300. printk("error, could not open file %s.\n", ramfs_dsdt_name);
  301. return ret;
  302. }
  303. dsdt_buffer = ACPI_ALLOCATE(len);
  304. if (!dsdt_buffer) {
  305. printk("error when allocating %lu bytes of memory.\n", len);
  306. goto err;
  307. }
  308. oldfs = get_fs();
  309. set_fs(KERNEL_DS);
  310. len2 = vfs_read(firmware_file, (char __user *)dsdt_buffer, len, &firmware_file->f_pos);
  311. set_fs(oldfs);
  312. if (len2 < len) {
  313. printk("error trying to read %lu bytes from %s.\n", len, ramfs_dsdt_name);
  314. ACPI_FREE(dsdt_buffer);
  315. goto err;
  316. }
  317. printk("successfully read %lu bytes from %s.\n", len, ramfs_dsdt_name);
  318. ret = dsdt_buffer;
  319. err:
  320. filp_close(firmware_file, NULL);
  321. return ret;
  322. }
  323. #endif
  324. acpi_status
  325. acpi_os_table_override(struct acpi_table_header * existing_table,
  326. struct acpi_table_header ** new_table)
  327. {
  328. if (!existing_table || !new_table)
  329. return AE_BAD_PARAMETER;
  330. *new_table = NULL;
  331. #ifdef CONFIG_ACPI_CUSTOM_DSDT
  332. if (strncmp(existing_table->signature, "DSDT", 4) == 0)
  333. *new_table = (struct acpi_table_header *)AmlCode;
  334. #endif
  335. #ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
  336. if ((strncmp(existing_table->signature, "DSDT", 4) == 0) &&
  337. !acpi_no_initrd_override) {
  338. struct acpi_table_header *initrd_table = acpi_find_dsdt_initrd();
  339. if (initrd_table)
  340. *new_table = initrd_table;
  341. }
  342. #endif
  343. if (*new_table != NULL) {
  344. printk(KERN_WARNING PREFIX "Override [%4.4s-%8.8s], "
  345. "this is unsafe: tainting kernel\n",
  346. existing_table->signature,
  347. existing_table->oem_table_id);
  348. add_taint(TAINT_OVERRIDDEN_ACPI_TABLE);
  349. }
  350. return AE_OK;
  351. }
  352. #ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
  353. int __init acpi_no_initrd_override_setup(char *s)
  354. {
  355. acpi_no_initrd_override = 1;
  356. return 1;
  357. }
  358. __setup("acpi_no_initrd_override", acpi_no_initrd_override_setup);
  359. #endif
  360. static irqreturn_t acpi_irq(int irq, void *dev_id)
  361. {
  362. return (*acpi_irq_handler) (acpi_irq_context) ? IRQ_HANDLED : IRQ_NONE;
  363. }
  364. acpi_status
  365. acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
  366. void *context)
  367. {
  368. unsigned int irq;
  369. /*
  370. * Ignore the GSI from the core, and use the value in our copy of the
  371. * FADT. It may not be the same if an interrupt source override exists
  372. * for the SCI.
  373. */
  374. gsi = acpi_gbl_FADT.sci_interrupt;
  375. if (acpi_gsi_to_irq(gsi, &irq) < 0) {
  376. printk(KERN_ERR PREFIX "SCI (ACPI GSI %d) not registered\n",
  377. gsi);
  378. return AE_OK;
  379. }
  380. acpi_irq_handler = handler;
  381. acpi_irq_context = context;
  382. if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) {
  383. printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq);
  384. return AE_NOT_ACQUIRED;
  385. }
  386. acpi_irq_irq = irq;
  387. return AE_OK;
  388. }
  389. acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
  390. {
  391. if (irq) {
  392. free_irq(irq, acpi_irq);
  393. acpi_irq_handler = NULL;
  394. acpi_irq_irq = 0;
  395. }
  396. return AE_OK;
  397. }
  398. /*
  399. * Running in interpreter thread context, safe to sleep
  400. */
  401. void acpi_os_sleep(acpi_integer ms)
  402. {
  403. schedule_timeout_interruptible(msecs_to_jiffies(ms));
  404. }
  405. EXPORT_SYMBOL(acpi_os_sleep);
  406. void acpi_os_stall(u32 us)
  407. {
  408. while (us) {
  409. u32 delay = 1000;
  410. if (delay > us)
  411. delay = us;
  412. udelay(delay);
  413. touch_nmi_watchdog();
  414. us -= delay;
  415. }
  416. }
  417. EXPORT_SYMBOL(acpi_os_stall);
  418. /*
  419. * Support ACPI 3.0 AML Timer operand
  420. * Returns 64-bit free-running, monotonically increasing timer
  421. * with 100ns granularity
  422. */
  423. u64 acpi_os_get_timer(void)
  424. {
  425. static u64 t;
  426. #ifdef CONFIG_HPET
  427. /* TBD: use HPET if available */
  428. #endif
  429. #ifdef CONFIG_X86_PM_TIMER
  430. /* TBD: default to PM timer if HPET was not available */
  431. #endif
  432. if (!t)
  433. printk(KERN_ERR PREFIX "acpi_os_get_timer() TBD\n");
  434. return ++t;
  435. }
  436. acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width)
  437. {
  438. u32 dummy;
  439. if (!value)
  440. value = &dummy;
  441. *value = 0;
  442. if (width <= 8) {
  443. *(u8 *) value = inb(port);
  444. } else if (width <= 16) {
  445. *(u16 *) value = inw(port);
  446. } else if (width <= 32) {
  447. *(u32 *) value = inl(port);
  448. } else {
  449. BUG();
  450. }
  451. return AE_OK;
  452. }
  453. EXPORT_SYMBOL(acpi_os_read_port);
  454. acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width)
  455. {
  456. if (width <= 8) {
  457. outb(value, port);
  458. } else if (width <= 16) {
  459. outw(value, port);
  460. } else if (width <= 32) {
  461. outl(value, port);
  462. } else {
  463. BUG();
  464. }
  465. return AE_OK;
  466. }
  467. EXPORT_SYMBOL(acpi_os_write_port);
  468. acpi_status
  469. acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width)
  470. {
  471. u32 dummy;
  472. void __iomem *virt_addr;
  473. virt_addr = ioremap(phys_addr, width);
  474. if (!value)
  475. value = &dummy;
  476. switch (width) {
  477. case 8:
  478. *(u8 *) value = readb(virt_addr);
  479. break;
  480. case 16:
  481. *(u16 *) value = readw(virt_addr);
  482. break;
  483. case 32:
  484. *(u32 *) value = readl(virt_addr);
  485. break;
  486. default:
  487. BUG();
  488. }
  489. iounmap(virt_addr);
  490. return AE_OK;
  491. }
  492. acpi_status
  493. acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width)
  494. {
  495. void __iomem *virt_addr;
  496. virt_addr = ioremap(phys_addr, width);
  497. switch (width) {
  498. case 8:
  499. writeb(value, virt_addr);
  500. break;
  501. case 16:
  502. writew(value, virt_addr);
  503. break;
  504. case 32:
  505. writel(value, virt_addr);
  506. break;
  507. default:
  508. BUG();
  509. }
  510. iounmap(virt_addr);
  511. return AE_OK;
  512. }
  513. acpi_status
  514. acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
  515. void *value, u32 width)
  516. {
  517. int result, size;
  518. if (!value)
  519. return AE_BAD_PARAMETER;
  520. switch (width) {
  521. case 8:
  522. size = 1;
  523. break;
  524. case 16:
  525. size = 2;
  526. break;
  527. case 32:
  528. size = 4;
  529. break;
  530. default:
  531. return AE_ERROR;
  532. }
  533. BUG_ON(!raw_pci_ops);
  534. result = raw_pci_ops->read(pci_id->segment, pci_id->bus,
  535. PCI_DEVFN(pci_id->device, pci_id->function),
  536. reg, size, value);
  537. return (result ? AE_ERROR : AE_OK);
  538. }
  539. EXPORT_SYMBOL(acpi_os_read_pci_configuration);
  540. acpi_status
  541. acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
  542. acpi_integer value, u32 width)
  543. {
  544. int result, size;
  545. switch (width) {
  546. case 8:
  547. size = 1;
  548. break;
  549. case 16:
  550. size = 2;
  551. break;
  552. case 32:
  553. size = 4;
  554. break;
  555. default:
  556. return AE_ERROR;
  557. }
  558. BUG_ON(!raw_pci_ops);
  559. result = raw_pci_ops->write(pci_id->segment, pci_id->bus,
  560. PCI_DEVFN(pci_id->device, pci_id->function),
  561. reg, size, value);
  562. return (result ? AE_ERROR : AE_OK);
  563. }
  564. /* TODO: Change code to take advantage of driver model more */
  565. static void acpi_os_derive_pci_id_2(acpi_handle rhandle, /* upper bound */
  566. acpi_handle chandle, /* current node */
  567. struct acpi_pci_id **id,
  568. int *is_bridge, u8 * bus_number)
  569. {
  570. acpi_handle handle;
  571. struct acpi_pci_id *pci_id = *id;
  572. acpi_status status;
  573. unsigned long temp;
  574. acpi_object_type type;
  575. u8 tu8;
  576. acpi_get_parent(chandle, &handle);
  577. if (handle != rhandle) {
  578. acpi_os_derive_pci_id_2(rhandle, handle, &pci_id, is_bridge,
  579. bus_number);
  580. status = acpi_get_type(handle, &type);
  581. if ((ACPI_FAILURE(status)) || (type != ACPI_TYPE_DEVICE))
  582. return;
  583. status =
  584. acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL,
  585. &temp);
  586. if (ACPI_SUCCESS(status)) {
  587. pci_id->device = ACPI_HIWORD(ACPI_LODWORD(temp));
  588. pci_id->function = ACPI_LOWORD(ACPI_LODWORD(temp));
  589. if (*is_bridge)
  590. pci_id->bus = *bus_number;
  591. /* any nicer way to get bus number of bridge ? */
  592. status =
  593. acpi_os_read_pci_configuration(pci_id, 0x0e, &tu8,
  594. 8);
  595. if (ACPI_SUCCESS(status)
  596. && ((tu8 & 0x7f) == 1 || (tu8 & 0x7f) == 2)) {
  597. status =
  598. acpi_os_read_pci_configuration(pci_id, 0x18,
  599. &tu8, 8);
  600. if (!ACPI_SUCCESS(status)) {
  601. /* Certainly broken... FIX ME */
  602. return;
  603. }
  604. *is_bridge = 1;
  605. pci_id->bus = tu8;
  606. status =
  607. acpi_os_read_pci_configuration(pci_id, 0x19,
  608. &tu8, 8);
  609. if (ACPI_SUCCESS(status)) {
  610. *bus_number = tu8;
  611. }
  612. } else
  613. *is_bridge = 0;
  614. }
  615. }
  616. }
  617. void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */
  618. acpi_handle chandle, /* current node */
  619. struct acpi_pci_id **id)
  620. {
  621. int is_bridge = 1;
  622. u8 bus_number = (*id)->bus;
  623. acpi_os_derive_pci_id_2(rhandle, chandle, id, &is_bridge, &bus_number);
  624. }
  625. static void acpi_os_execute_deferred(struct work_struct *work)
  626. {
  627. struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work);
  628. if (!dpc) {
  629. printk(KERN_ERR PREFIX "Invalid (NULL) context\n");
  630. return;
  631. }
  632. dpc->function(dpc->context);
  633. kfree(dpc);
  634. /* Yield cpu to notify thread */
  635. cond_resched();
  636. return;
  637. }
  638. static void acpi_os_execute_notify(struct work_struct *work)
  639. {
  640. struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work);
  641. if (!dpc) {
  642. printk(KERN_ERR PREFIX "Invalid (NULL) context\n");
  643. return;
  644. }
  645. dpc->function(dpc->context);
  646. kfree(dpc);
  647. return;
  648. }
  649. /*******************************************************************************
  650. *
  651. * FUNCTION: acpi_os_execute
  652. *
  653. * PARAMETERS: Type - Type of the callback
  654. * Function - Function to be executed
  655. * Context - Function parameters
  656. *
  657. * RETURN: Status
  658. *
  659. * DESCRIPTION: Depending on type, either queues function for deferred execution or
  660. * immediately executes function on a separate thread.
  661. *
  662. ******************************************************************************/
  663. acpi_status acpi_os_execute(acpi_execute_type type,
  664. acpi_osd_exec_callback function, void *context)
  665. {
  666. acpi_status status = AE_OK;
  667. struct acpi_os_dpc *dpc;
  668. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  669. "Scheduling function [%p(%p)] for deferred execution.\n",
  670. function, context));
  671. if (!function)
  672. return AE_BAD_PARAMETER;
  673. /*
  674. * Allocate/initialize DPC structure. Note that this memory will be
  675. * freed by the callee. The kernel handles the work_struct list in a
  676. * way that allows us to also free its memory inside the callee.
  677. * Because we may want to schedule several tasks with different
  678. * parameters we can't use the approach some kernel code uses of
  679. * having a static work_struct.
  680. */
  681. dpc = kmalloc(sizeof(struct acpi_os_dpc), GFP_ATOMIC);
  682. if (!dpc)
  683. return_ACPI_STATUS(AE_NO_MEMORY);
  684. dpc->function = function;
  685. dpc->context = context;
  686. if (type == OSL_NOTIFY_HANDLER) {
  687. INIT_WORK(&dpc->work, acpi_os_execute_notify);
  688. if (!queue_work(kacpi_notify_wq, &dpc->work)) {
  689. status = AE_ERROR;
  690. kfree(dpc);
  691. }
  692. } else {
  693. INIT_WORK(&dpc->work, acpi_os_execute_deferred);
  694. if (!queue_work(kacpid_wq, &dpc->work)) {
  695. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  696. "Call to queue_work() failed.\n"));
  697. status = AE_ERROR;
  698. kfree(dpc);
  699. }
  700. }
  701. return_ACPI_STATUS(status);
  702. }
  703. EXPORT_SYMBOL(acpi_os_execute);
  704. void acpi_os_wait_events_complete(void *context)
  705. {
  706. flush_workqueue(kacpid_wq);
  707. }
  708. EXPORT_SYMBOL(acpi_os_wait_events_complete);
  709. /*
  710. * Allocate the memory for a spinlock and initialize it.
  711. */
  712. acpi_status acpi_os_create_lock(acpi_spinlock * handle)
  713. {
  714. spin_lock_init(*handle);
  715. return AE_OK;
  716. }
  717. /*
  718. * Deallocate the memory for a spinlock.
  719. */
  720. void acpi_os_delete_lock(acpi_spinlock handle)
  721. {
  722. return;
  723. }
  724. acpi_status
  725. acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle)
  726. {
  727. struct semaphore *sem = NULL;
  728. sem = acpi_os_allocate(sizeof(struct semaphore));
  729. if (!sem)
  730. return AE_NO_MEMORY;
  731. memset(sem, 0, sizeof(struct semaphore));
  732. sema_init(sem, initial_units);
  733. *handle = (acpi_handle *) sem;
  734. ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n",
  735. *handle, initial_units));
  736. return AE_OK;
  737. }
  738. EXPORT_SYMBOL(acpi_os_create_semaphore);
  739. /*
  740. * TODO: A better way to delete semaphores? Linux doesn't have a
  741. * 'delete_semaphore()' function -- may result in an invalid
  742. * pointer dereference for non-synchronized consumers. Should
  743. * we at least check for blocked threads and signal/cancel them?
  744. */
  745. acpi_status acpi_os_delete_semaphore(acpi_handle handle)
  746. {
  747. struct semaphore *sem = (struct semaphore *)handle;
  748. if (!sem)
  749. return AE_BAD_PARAMETER;
  750. ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle));
  751. kfree(sem);
  752. sem = NULL;
  753. return AE_OK;
  754. }
  755. EXPORT_SYMBOL(acpi_os_delete_semaphore);
  756. /*
  757. * TODO: The kernel doesn't have a 'down_timeout' function -- had to
  758. * improvise. The process is to sleep for one scheduler quantum
  759. * until the semaphore becomes available. Downside is that this
  760. * may result in starvation for timeout-based waits when there's
  761. * lots of semaphore activity.
  762. *
  763. * TODO: Support for units > 1?
  764. */
  765. acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout)
  766. {
  767. acpi_status status = AE_OK;
  768. struct semaphore *sem = (struct semaphore *)handle;
  769. int ret = 0;
  770. if (!sem || (units < 1))
  771. return AE_BAD_PARAMETER;
  772. if (units > 1)
  773. return AE_SUPPORT;
  774. ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n",
  775. handle, units, timeout));
  776. /*
  777. * This can be called during resume with interrupts off.
  778. * Like boot-time, we should be single threaded and will
  779. * always get the lock if we try -- timeout or not.
  780. * If this doesn't succeed, then we will oops courtesy of
  781. * might_sleep() in down().
  782. */
  783. if (!down_trylock(sem))
  784. return AE_OK;
  785. switch (timeout) {
  786. /*
  787. * No Wait:
  788. * --------
  789. * A zero timeout value indicates that we shouldn't wait - just
  790. * acquire the semaphore if available otherwise return AE_TIME
  791. * (a.k.a. 'would block').
  792. */
  793. case 0:
  794. if (down_trylock(sem))
  795. status = AE_TIME;
  796. break;
  797. /*
  798. * Wait Indefinitely:
  799. * ------------------
  800. */
  801. case ACPI_WAIT_FOREVER:
  802. down(sem);
  803. break;
  804. /*
  805. * Wait w/ Timeout:
  806. * ----------------
  807. */
  808. default:
  809. // TODO: A better timeout algorithm?
  810. {
  811. int i = 0;
  812. static const int quantum_ms = 1000 / HZ;
  813. ret = down_trylock(sem);
  814. for (i = timeout; (i > 0 && ret != 0); i -= quantum_ms) {
  815. schedule_timeout_interruptible(1);
  816. ret = down_trylock(sem);
  817. }
  818. if (ret != 0)
  819. status = AE_TIME;
  820. }
  821. break;
  822. }
  823. if (ACPI_FAILURE(status)) {
  824. ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
  825. "Failed to acquire semaphore[%p|%d|%d], %s",
  826. handle, units, timeout,
  827. acpi_format_exception(status)));
  828. } else {
  829. ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
  830. "Acquired semaphore[%p|%d|%d]", handle,
  831. units, timeout));
  832. }
  833. return status;
  834. }
  835. EXPORT_SYMBOL(acpi_os_wait_semaphore);
  836. /*
  837. * TODO: Support for units > 1?
  838. */
  839. acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units)
  840. {
  841. struct semaphore *sem = (struct semaphore *)handle;
  842. if (!sem || (units < 1))
  843. return AE_BAD_PARAMETER;
  844. if (units > 1)
  845. return AE_SUPPORT;
  846. ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle,
  847. units));
  848. up(sem);
  849. return AE_OK;
  850. }
  851. EXPORT_SYMBOL(acpi_os_signal_semaphore);
  852. #ifdef ACPI_FUTURE_USAGE
  853. u32 acpi_os_get_line(char *buffer)
  854. {
  855. #ifdef ENABLE_DEBUGGER
  856. if (acpi_in_debugger) {
  857. u32 chars;
  858. kdb_read(buffer, sizeof(line_buf));
  859. /* remove the CR kdb includes */
  860. chars = strlen(buffer) - 1;
  861. buffer[chars] = '\0';
  862. }
  863. #endif
  864. return 0;
  865. }
  866. #endif /* ACPI_FUTURE_USAGE */
  867. acpi_status acpi_os_signal(u32 function, void *info)
  868. {
  869. switch (function) {
  870. case ACPI_SIGNAL_FATAL:
  871. printk(KERN_ERR PREFIX "Fatal opcode executed\n");
  872. break;
  873. case ACPI_SIGNAL_BREAKPOINT:
  874. /*
  875. * AML Breakpoint
  876. * ACPI spec. says to treat it as a NOP unless
  877. * you are debugging. So if/when we integrate
  878. * AML debugger into the kernel debugger its
  879. * hook will go here. But until then it is
  880. * not useful to print anything on breakpoints.
  881. */
  882. break;
  883. default:
  884. break;
  885. }
  886. return AE_OK;
  887. }
  888. EXPORT_SYMBOL(acpi_os_signal);
  889. static int __init acpi_os_name_setup(char *str)
  890. {
  891. char *p = acpi_os_name;
  892. int count = ACPI_MAX_OVERRIDE_LEN - 1;
  893. if (!str || !*str)
  894. return 0;
  895. for (; count-- && str && *str; str++) {
  896. if (isalnum(*str) || *str == ' ' || *str == ':')
  897. *p++ = *str;
  898. else if (*str == '\'' || *str == '"')
  899. continue;
  900. else
  901. break;
  902. }
  903. *p = 0;
  904. return 1;
  905. }
  906. __setup("acpi_os_name=", acpi_os_name_setup);
  907. static void __init set_osi_linux(unsigned int enable)
  908. {
  909. if (osi_linux.enable != enable) {
  910. osi_linux.enable = enable;
  911. printk(KERN_NOTICE PREFIX "%sed _OSI(Linux)\n",
  912. enable ? "Add": "Delet");
  913. }
  914. return;
  915. }
  916. static void __init acpi_cmdline_osi_linux(unsigned int enable)
  917. {
  918. osi_linux.cmdline = 1; /* cmdline set the default */
  919. set_osi_linux(enable);
  920. return;
  921. }
  922. void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d)
  923. {
  924. osi_linux.dmi = 1; /* DMI knows that this box asks OSI(Linux) */
  925. printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
  926. if (enable == -1)
  927. return;
  928. osi_linux.known = 1; /* DMI knows which OSI(Linux) default needed */
  929. set_osi_linux(enable);
  930. return;
  931. }
  932. /*
  933. * Modify the list of "OS Interfaces" reported to BIOS via _OSI
  934. *
  935. * empty string disables _OSI
  936. * string starting with '!' disables that string
  937. * otherwise string is added to list, augmenting built-in strings
  938. */
  939. static int __init acpi_osi_setup(char *str)
  940. {
  941. if (str == NULL || *str == '\0') {
  942. printk(KERN_INFO PREFIX "_OSI method disabled\n");
  943. acpi_gbl_create_osi_method = FALSE;
  944. } else if (!strcmp("!Linux", str)) {
  945. acpi_cmdline_osi_linux(0); /* !enable */
  946. } else if (*str == '!') {
  947. if (acpi_osi_invalidate(++str) == AE_OK)
  948. printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str);
  949. } else if (!strcmp("Linux", str)) {
  950. acpi_cmdline_osi_linux(1); /* enable */
  951. } else if (*osi_additional_string == '\0') {
  952. strncpy(osi_additional_string, str, OSI_STRING_LENGTH_MAX);
  953. printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str);
  954. }
  955. return 1;
  956. }
  957. __setup("acpi_osi=", acpi_osi_setup);
  958. /* enable serialization to combat AE_ALREADY_EXISTS errors */
  959. static int __init acpi_serialize_setup(char *str)
  960. {
  961. printk(KERN_INFO PREFIX "serialize enabled\n");
  962. acpi_gbl_all_methods_serialized = TRUE;
  963. return 1;
  964. }
  965. __setup("acpi_serialize", acpi_serialize_setup);
  966. /*
  967. * Wake and Run-Time GPES are expected to be separate.
  968. * We disable wake-GPEs at run-time to prevent spurious
  969. * interrupts.
  970. *
  971. * However, if a system exists that shares Wake and
  972. * Run-time events on the same GPE this flag is available
  973. * to tell Linux to keep the wake-time GPEs enabled at run-time.
  974. */
  975. static int __init acpi_wake_gpes_always_on_setup(char *str)
  976. {
  977. printk(KERN_INFO PREFIX "wake GPEs not disabled\n");
  978. acpi_gbl_leave_wake_gpes_disabled = FALSE;
  979. return 1;
  980. }
  981. __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup);
  982. /*
  983. * Acquire a spinlock.
  984. *
  985. * handle is a pointer to the spinlock_t.
  986. */
  987. acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock lockp)
  988. {
  989. acpi_cpu_flags flags;
  990. spin_lock_irqsave(lockp, flags);
  991. return flags;
  992. }
  993. /*
  994. * Release a spinlock. See above.
  995. */
  996. void acpi_os_release_lock(acpi_spinlock lockp, acpi_cpu_flags flags)
  997. {
  998. spin_unlock_irqrestore(lockp, flags);
  999. }
  1000. #ifndef ACPI_USE_LOCAL_CACHE
  1001. /*******************************************************************************
  1002. *
  1003. * FUNCTION: acpi_os_create_cache
  1004. *
  1005. * PARAMETERS: name - Ascii name for the cache
  1006. * size - Size of each cached object
  1007. * depth - Maximum depth of the cache (in objects) <ignored>
  1008. * cache - Where the new cache object is returned
  1009. *
  1010. * RETURN: status
  1011. *
  1012. * DESCRIPTION: Create a cache object
  1013. *
  1014. ******************************************************************************/
  1015. acpi_status
  1016. acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache)
  1017. {
  1018. *cache = kmem_cache_create(name, size, 0, 0, NULL);
  1019. if (*cache == NULL)
  1020. return AE_ERROR;
  1021. else
  1022. return AE_OK;
  1023. }
  1024. /*******************************************************************************
  1025. *
  1026. * FUNCTION: acpi_os_purge_cache
  1027. *
  1028. * PARAMETERS: Cache - Handle to cache object
  1029. *
  1030. * RETURN: Status
  1031. *
  1032. * DESCRIPTION: Free all objects within the requested cache.
  1033. *
  1034. ******************************************************************************/
  1035. acpi_status acpi_os_purge_cache(acpi_cache_t * cache)
  1036. {
  1037. kmem_cache_shrink(cache);
  1038. return (AE_OK);
  1039. }
  1040. /*******************************************************************************
  1041. *
  1042. * FUNCTION: acpi_os_delete_cache
  1043. *
  1044. * PARAMETERS: Cache - Handle to cache object
  1045. *
  1046. * RETURN: Status
  1047. *
  1048. * DESCRIPTION: Free all objects within the requested cache and delete the
  1049. * cache object.
  1050. *
  1051. ******************************************************************************/
  1052. acpi_status acpi_os_delete_cache(acpi_cache_t * cache)
  1053. {
  1054. kmem_cache_destroy(cache);
  1055. return (AE_OK);
  1056. }
  1057. /*******************************************************************************
  1058. *
  1059. * FUNCTION: acpi_os_release_object
  1060. *
  1061. * PARAMETERS: Cache - Handle to cache object
  1062. * Object - The object to be released
  1063. *
  1064. * RETURN: None
  1065. *
  1066. * DESCRIPTION: Release an object to the specified cache. If cache is full,
  1067. * the object is deleted.
  1068. *
  1069. ******************************************************************************/
  1070. acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
  1071. {
  1072. kmem_cache_free(cache, object);
  1073. return (AE_OK);
  1074. }
  1075. /**
  1076. * acpi_dmi_dump - dump DMI slots needed for blacklist entry
  1077. *
  1078. * Returns 0 on success
  1079. */
  1080. int acpi_dmi_dump(void)
  1081. {
  1082. if (!dmi_available)
  1083. return -1;
  1084. printk(KERN_NOTICE PREFIX "DMI System Vendor: %s\n",
  1085. dmi_get_slot(DMI_SYS_VENDOR));
  1086. printk(KERN_NOTICE PREFIX "DMI Product Name: %s\n",
  1087. dmi_get_slot(DMI_PRODUCT_NAME));
  1088. printk(KERN_NOTICE PREFIX "DMI Product Version: %s\n",
  1089. dmi_get_slot(DMI_PRODUCT_VERSION));
  1090. printk(KERN_NOTICE PREFIX "DMI Board Name: %s\n",
  1091. dmi_get_slot(DMI_BOARD_NAME));
  1092. printk(KERN_NOTICE PREFIX "DMI BIOS Vendor: %s\n",
  1093. dmi_get_slot(DMI_BIOS_VENDOR));
  1094. printk(KERN_NOTICE PREFIX "DMI BIOS Date: %s\n",
  1095. dmi_get_slot(DMI_BIOS_DATE));
  1096. return 0;
  1097. }
  1098. /******************************************************************************
  1099. *
  1100. * FUNCTION: acpi_os_validate_interface
  1101. *
  1102. * PARAMETERS: interface - Requested interface to be validated
  1103. *
  1104. * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise
  1105. *
  1106. * DESCRIPTION: Match an interface string to the interfaces supported by the
  1107. * host. Strings originate from an AML call to the _OSI method.
  1108. *
  1109. *****************************************************************************/
  1110. acpi_status
  1111. acpi_os_validate_interface (char *interface)
  1112. {
  1113. if (!strncmp(osi_additional_string, interface, OSI_STRING_LENGTH_MAX))
  1114. return AE_OK;
  1115. if (!strcmp("Linux", interface)) {
  1116. printk(KERN_NOTICE PREFIX
  1117. "BIOS _OSI(Linux) query %s%s\n",
  1118. osi_linux.enable ? "honored" : "ignored",
  1119. osi_linux.cmdline ? " via cmdline" :
  1120. osi_linux.dmi ? " via DMI" : "");
  1121. if (!osi_linux.dmi) {
  1122. if (acpi_dmi_dump())
  1123. printk(KERN_NOTICE PREFIX
  1124. "[please extract dmidecode output]\n");
  1125. printk(KERN_NOTICE PREFIX
  1126. "Please send DMI info above to "
  1127. "linux-acpi@vger.kernel.org\n");
  1128. }
  1129. if (!osi_linux.known && !osi_linux.cmdline) {
  1130. printk(KERN_NOTICE PREFIX
  1131. "If \"acpi_osi=%sLinux\" works better, "
  1132. "please notify linux-acpi@vger.kernel.org\n",
  1133. osi_linux.enable ? "!" : "");
  1134. }
  1135. if (osi_linux.enable)
  1136. return AE_OK;
  1137. }
  1138. return AE_SUPPORT;
  1139. }
  1140. /******************************************************************************
  1141. *
  1142. * FUNCTION: acpi_os_validate_address
  1143. *
  1144. * PARAMETERS: space_id - ACPI space ID
  1145. * address - Physical address
  1146. * length - Address length
  1147. *
  1148. * RETURN: AE_OK if address/length is valid for the space_id. Otherwise,
  1149. * should return AE_AML_ILLEGAL_ADDRESS.
  1150. *
  1151. * DESCRIPTION: Validate a system address via the host OS. Used to validate
  1152. * the addresses accessed by AML operation regions.
  1153. *
  1154. *****************************************************************************/
  1155. acpi_status
  1156. acpi_os_validate_address (
  1157. u8 space_id,
  1158. acpi_physical_address address,
  1159. acpi_size length)
  1160. {
  1161. return AE_OK;
  1162. }
  1163. #endif