osl.c 32 KB

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