bus.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. /*
  2. * acpi_bus.c - ACPI Bus Driver ($Revision: 80 $)
  3. *
  4. * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@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/module.h>
  25. #include <linux/init.h>
  26. #include <linux/ioport.h>
  27. #include <linux/kernel.h>
  28. #include <linux/list.h>
  29. #include <linux/sched.h>
  30. #include <linux/pm.h>
  31. #include <linux/device.h>
  32. #include <linux/proc_fs.h>
  33. #include <linux/acpi.h>
  34. #include <linux/slab.h>
  35. #include <linux/regulator/machine.h>
  36. #ifdef CONFIG_X86
  37. #include <asm/mpspec.h>
  38. #endif
  39. #include <linux/pci.h>
  40. #include <acpi/apei.h>
  41. #include <linux/dmi.h>
  42. #include <linux/suspend.h>
  43. #include "internal.h"
  44. #define _COMPONENT ACPI_BUS_COMPONENT
  45. ACPI_MODULE_NAME("bus");
  46. struct acpi_device *acpi_root;
  47. struct proc_dir_entry *acpi_root_dir;
  48. EXPORT_SYMBOL(acpi_root_dir);
  49. #ifdef CONFIG_X86
  50. static int set_copy_dsdt(const struct dmi_system_id *id)
  51. {
  52. printk(KERN_NOTICE "%s detected - "
  53. "force copy of DSDT to local memory\n", id->ident);
  54. acpi_gbl_copy_dsdt_locally = 1;
  55. return 0;
  56. }
  57. static struct dmi_system_id dsdt_dmi_table[] __initdata = {
  58. /*
  59. * Invoke DSDT corruption work-around on all Toshiba Satellite.
  60. * https://bugzilla.kernel.org/show_bug.cgi?id=14679
  61. */
  62. {
  63. .callback = set_copy_dsdt,
  64. .ident = "TOSHIBA Satellite",
  65. .matches = {
  66. DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
  67. DMI_MATCH(DMI_PRODUCT_NAME, "Satellite"),
  68. },
  69. },
  70. {}
  71. };
  72. #else
  73. static struct dmi_system_id dsdt_dmi_table[] __initdata = {
  74. {}
  75. };
  76. #endif
  77. /* --------------------------------------------------------------------------
  78. Device Management
  79. -------------------------------------------------------------------------- */
  80. acpi_status acpi_bus_get_status_handle(acpi_handle handle,
  81. unsigned long long *sta)
  82. {
  83. acpi_status status;
  84. status = acpi_evaluate_integer(handle, "_STA", NULL, sta);
  85. if (ACPI_SUCCESS(status))
  86. return AE_OK;
  87. if (status == AE_NOT_FOUND) {
  88. *sta = ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED |
  89. ACPI_STA_DEVICE_UI | ACPI_STA_DEVICE_FUNCTIONING;
  90. return AE_OK;
  91. }
  92. return status;
  93. }
  94. int acpi_bus_get_status(struct acpi_device *device)
  95. {
  96. acpi_status status;
  97. unsigned long long sta;
  98. status = acpi_bus_get_status_handle(device->handle, &sta);
  99. if (ACPI_FAILURE(status))
  100. return -ENODEV;
  101. acpi_set_device_status(device, sta);
  102. if (device->status.functional && !device->status.present) {
  103. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]: "
  104. "functional but not present;\n",
  105. device->pnp.bus_id, (u32)sta));
  106. }
  107. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n",
  108. device->pnp.bus_id, (u32)sta));
  109. return 0;
  110. }
  111. EXPORT_SYMBOL(acpi_bus_get_status);
  112. void acpi_bus_private_data_handler(acpi_handle handle,
  113. void *context)
  114. {
  115. return;
  116. }
  117. EXPORT_SYMBOL(acpi_bus_private_data_handler);
  118. int acpi_bus_get_private_data(acpi_handle handle, void **data)
  119. {
  120. acpi_status status;
  121. if (!*data)
  122. return -EINVAL;
  123. status = acpi_get_data(handle, acpi_bus_private_data_handler, data);
  124. if (ACPI_FAILURE(status) || !*data) {
  125. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No context for object [%p]\n",
  126. handle));
  127. return -ENODEV;
  128. }
  129. return 0;
  130. }
  131. EXPORT_SYMBOL(acpi_bus_get_private_data);
  132. void acpi_bus_no_hotplug(acpi_handle handle)
  133. {
  134. struct acpi_device *adev = NULL;
  135. acpi_bus_get_device(handle, &adev);
  136. if (adev)
  137. adev->flags.no_hotplug = true;
  138. }
  139. EXPORT_SYMBOL_GPL(acpi_bus_no_hotplug);
  140. static void acpi_print_osc_error(acpi_handle handle,
  141. struct acpi_osc_context *context, char *error)
  142. {
  143. struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER};
  144. int i;
  145. if (ACPI_FAILURE(acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer)))
  146. printk(KERN_DEBUG "%s\n", error);
  147. else {
  148. printk(KERN_DEBUG "%s:%s\n", (char *)buffer.pointer, error);
  149. kfree(buffer.pointer);
  150. }
  151. printk(KERN_DEBUG"_OSC request data:");
  152. for (i = 0; i < context->cap.length; i += sizeof(u32))
  153. printk("%x ", *((u32 *)(context->cap.pointer + i)));
  154. printk("\n");
  155. }
  156. acpi_status acpi_str_to_uuid(char *str, u8 *uuid)
  157. {
  158. int i;
  159. static int opc_map_to_uuid[16] = {6, 4, 2, 0, 11, 9, 16, 14, 19, 21,
  160. 24, 26, 28, 30, 32, 34};
  161. if (strlen(str) != 36)
  162. return AE_BAD_PARAMETER;
  163. for (i = 0; i < 36; i++) {
  164. if (i == 8 || i == 13 || i == 18 || i == 23) {
  165. if (str[i] != '-')
  166. return AE_BAD_PARAMETER;
  167. } else if (!isxdigit(str[i]))
  168. return AE_BAD_PARAMETER;
  169. }
  170. for (i = 0; i < 16; i++) {
  171. uuid[i] = hex_to_bin(str[opc_map_to_uuid[i]]) << 4;
  172. uuid[i] |= hex_to_bin(str[opc_map_to_uuid[i] + 1]);
  173. }
  174. return AE_OK;
  175. }
  176. EXPORT_SYMBOL_GPL(acpi_str_to_uuid);
  177. acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
  178. {
  179. acpi_status status;
  180. struct acpi_object_list input;
  181. union acpi_object in_params[4];
  182. union acpi_object *out_obj;
  183. u8 uuid[16];
  184. u32 errors;
  185. struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
  186. if (!context)
  187. return AE_ERROR;
  188. if (ACPI_FAILURE(acpi_str_to_uuid(context->uuid_str, uuid)))
  189. return AE_ERROR;
  190. context->ret.length = ACPI_ALLOCATE_BUFFER;
  191. context->ret.pointer = NULL;
  192. /* Setting up input parameters */
  193. input.count = 4;
  194. input.pointer = in_params;
  195. in_params[0].type = ACPI_TYPE_BUFFER;
  196. in_params[0].buffer.length = 16;
  197. in_params[0].buffer.pointer = uuid;
  198. in_params[1].type = ACPI_TYPE_INTEGER;
  199. in_params[1].integer.value = context->rev;
  200. in_params[2].type = ACPI_TYPE_INTEGER;
  201. in_params[2].integer.value = context->cap.length/sizeof(u32);
  202. in_params[3].type = ACPI_TYPE_BUFFER;
  203. in_params[3].buffer.length = context->cap.length;
  204. in_params[3].buffer.pointer = context->cap.pointer;
  205. status = acpi_evaluate_object(handle, "_OSC", &input, &output);
  206. if (ACPI_FAILURE(status))
  207. return status;
  208. if (!output.length)
  209. return AE_NULL_OBJECT;
  210. out_obj = output.pointer;
  211. if (out_obj->type != ACPI_TYPE_BUFFER
  212. || out_obj->buffer.length != context->cap.length) {
  213. acpi_print_osc_error(handle, context,
  214. "_OSC evaluation returned wrong type");
  215. status = AE_TYPE;
  216. goto out_kfree;
  217. }
  218. /* Need to ignore the bit0 in result code */
  219. errors = *((u32 *)out_obj->buffer.pointer) & ~(1 << 0);
  220. if (errors) {
  221. if (errors & OSC_REQUEST_ERROR)
  222. acpi_print_osc_error(handle, context,
  223. "_OSC request failed");
  224. if (errors & OSC_INVALID_UUID_ERROR)
  225. acpi_print_osc_error(handle, context,
  226. "_OSC invalid UUID");
  227. if (errors & OSC_INVALID_REVISION_ERROR)
  228. acpi_print_osc_error(handle, context,
  229. "_OSC invalid revision");
  230. if (errors & OSC_CAPABILITIES_MASK_ERROR) {
  231. if (((u32 *)context->cap.pointer)[OSC_QUERY_DWORD]
  232. & OSC_QUERY_ENABLE)
  233. goto out_success;
  234. status = AE_SUPPORT;
  235. goto out_kfree;
  236. }
  237. status = AE_ERROR;
  238. goto out_kfree;
  239. }
  240. out_success:
  241. context->ret.length = out_obj->buffer.length;
  242. context->ret.pointer = kmemdup(out_obj->buffer.pointer,
  243. context->ret.length, GFP_KERNEL);
  244. if (!context->ret.pointer) {
  245. status = AE_NO_MEMORY;
  246. goto out_kfree;
  247. }
  248. status = AE_OK;
  249. out_kfree:
  250. kfree(output.pointer);
  251. if (status != AE_OK)
  252. context->ret.pointer = NULL;
  253. return status;
  254. }
  255. EXPORT_SYMBOL(acpi_run_osc);
  256. bool osc_sb_apei_support_acked;
  257. static u8 sb_uuid_str[] = "0811B06E-4A27-44F9-8D60-3CBBC22E7B48";
  258. static void acpi_bus_osc_support(void)
  259. {
  260. u32 capbuf[2];
  261. struct acpi_osc_context context = {
  262. .uuid_str = sb_uuid_str,
  263. .rev = 1,
  264. .cap.length = 8,
  265. .cap.pointer = capbuf,
  266. };
  267. acpi_handle handle;
  268. capbuf[OSC_QUERY_DWORD] = OSC_QUERY_ENABLE;
  269. capbuf[OSC_SUPPORT_DWORD] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */
  270. #if defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR) ||\
  271. defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR_MODULE)
  272. capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PAD_SUPPORT;
  273. #endif
  274. #if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE)
  275. capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PPC_OST_SUPPORT;
  276. #endif
  277. #ifdef ACPI_HOTPLUG_OST
  278. capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT;
  279. #endif
  280. if (!ghes_disable)
  281. capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_APEI_SUPPORT;
  282. if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)))
  283. return;
  284. if (ACPI_SUCCESS(acpi_run_osc(handle, &context))) {
  285. u32 *capbuf_ret = context.ret.pointer;
  286. if (context.ret.length > OSC_SUPPORT_DWORD)
  287. osc_sb_apei_support_acked =
  288. capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT;
  289. kfree(context.ret.pointer);
  290. }
  291. /* do we need to check other returned cap? Sounds no */
  292. }
  293. /* --------------------------------------------------------------------------
  294. Notification Handling
  295. -------------------------------------------------------------------------- */
  296. /**
  297. * acpi_bus_notify
  298. * ---------------
  299. * Callback for all 'system-level' device notifications (values 0x00-0x7F).
  300. */
  301. static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
  302. {
  303. struct acpi_device *device = NULL;
  304. struct acpi_driver *driver;
  305. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notification %#02x to handle %p\n",
  306. type, handle));
  307. switch (type) {
  308. case ACPI_NOTIFY_BUS_CHECK:
  309. /* TBD */
  310. break;
  311. case ACPI_NOTIFY_DEVICE_CHECK:
  312. /* TBD */
  313. break;
  314. case ACPI_NOTIFY_DEVICE_WAKE:
  315. /* TBD */
  316. break;
  317. case ACPI_NOTIFY_EJECT_REQUEST:
  318. /* TBD */
  319. break;
  320. case ACPI_NOTIFY_DEVICE_CHECK_LIGHT:
  321. /* TBD: Exactly what does 'light' mean? */
  322. break;
  323. case ACPI_NOTIFY_FREQUENCY_MISMATCH:
  324. /* TBD */
  325. break;
  326. case ACPI_NOTIFY_BUS_MODE_MISMATCH:
  327. /* TBD */
  328. break;
  329. case ACPI_NOTIFY_POWER_FAULT:
  330. /* TBD */
  331. break;
  332. default:
  333. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  334. "Received unknown/unsupported notification [%08x]\n",
  335. type));
  336. break;
  337. }
  338. acpi_bus_get_device(handle, &device);
  339. if (device) {
  340. driver = device->driver;
  341. if (driver && driver->ops.notify &&
  342. (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS))
  343. driver->ops.notify(device, type);
  344. }
  345. }
  346. /* --------------------------------------------------------------------------
  347. Initialization/Cleanup
  348. -------------------------------------------------------------------------- */
  349. static int __init acpi_bus_init_irq(void)
  350. {
  351. acpi_status status;
  352. char *message = NULL;
  353. /*
  354. * Let the system know what interrupt model we are using by
  355. * evaluating the \_PIC object, if exists.
  356. */
  357. switch (acpi_irq_model) {
  358. case ACPI_IRQ_MODEL_PIC:
  359. message = "PIC";
  360. break;
  361. case ACPI_IRQ_MODEL_IOAPIC:
  362. message = "IOAPIC";
  363. break;
  364. case ACPI_IRQ_MODEL_IOSAPIC:
  365. message = "IOSAPIC";
  366. break;
  367. case ACPI_IRQ_MODEL_PLATFORM:
  368. message = "platform specific model";
  369. break;
  370. default:
  371. printk(KERN_WARNING PREFIX "Unknown interrupt routing model\n");
  372. return -ENODEV;
  373. }
  374. printk(KERN_INFO PREFIX "Using %s for interrupt routing\n", message);
  375. status = acpi_execute_simple_method(NULL, "\\_PIC", acpi_irq_model);
  376. if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
  377. ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PIC"));
  378. return -ENODEV;
  379. }
  380. return 0;
  381. }
  382. u8 acpi_gbl_permanent_mmap;
  383. void __init acpi_early_init(void)
  384. {
  385. acpi_status status;
  386. if (acpi_disabled)
  387. return;
  388. printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION);
  389. /* enable workarounds, unless strict ACPI spec. compliance */
  390. if (!acpi_strict)
  391. acpi_gbl_enable_interpreter_slack = TRUE;
  392. acpi_gbl_permanent_mmap = 1;
  393. /*
  394. * If the machine falls into the DMI check table,
  395. * DSDT will be copied to memory
  396. */
  397. dmi_check_system(dsdt_dmi_table);
  398. status = acpi_reallocate_root_table();
  399. if (ACPI_FAILURE(status)) {
  400. printk(KERN_ERR PREFIX
  401. "Unable to reallocate ACPI tables\n");
  402. goto error0;
  403. }
  404. status = acpi_initialize_subsystem();
  405. if (ACPI_FAILURE(status)) {
  406. printk(KERN_ERR PREFIX
  407. "Unable to initialize the ACPI Interpreter\n");
  408. goto error0;
  409. }
  410. status = acpi_load_tables();
  411. if (ACPI_FAILURE(status)) {
  412. printk(KERN_ERR PREFIX
  413. "Unable to load the System Description Tables\n");
  414. goto error0;
  415. }
  416. #ifdef CONFIG_X86
  417. if (!acpi_ioapic) {
  418. /* compatible (0) means level (3) */
  419. if (!(acpi_sci_flags & ACPI_MADT_TRIGGER_MASK)) {
  420. acpi_sci_flags &= ~ACPI_MADT_TRIGGER_MASK;
  421. acpi_sci_flags |= ACPI_MADT_TRIGGER_LEVEL;
  422. }
  423. /* Set PIC-mode SCI trigger type */
  424. acpi_pic_sci_set_trigger(acpi_gbl_FADT.sci_interrupt,
  425. (acpi_sci_flags & ACPI_MADT_TRIGGER_MASK) >> 2);
  426. } else {
  427. /*
  428. * now that acpi_gbl_FADT is initialized,
  429. * update it with result from INT_SRC_OVR parsing
  430. */
  431. acpi_gbl_FADT.sci_interrupt = acpi_sci_override_gsi;
  432. }
  433. #endif
  434. status = acpi_enable_subsystem(~ACPI_NO_ACPI_ENABLE);
  435. if (ACPI_FAILURE(status)) {
  436. printk(KERN_ERR PREFIX "Unable to enable ACPI\n");
  437. goto error0;
  438. }
  439. /*
  440. * If the system is using ACPI then we can be reasonably
  441. * confident that any regulators are managed by the firmware
  442. * so tell the regulator core it has everything it needs to
  443. * know.
  444. */
  445. regulator_has_full_constraints();
  446. return;
  447. error0:
  448. disable_acpi();
  449. return;
  450. }
  451. static int __init acpi_bus_init(void)
  452. {
  453. int result;
  454. acpi_status status;
  455. acpi_os_initialize1();
  456. status = acpi_enable_subsystem(ACPI_NO_ACPI_ENABLE);
  457. if (ACPI_FAILURE(status)) {
  458. printk(KERN_ERR PREFIX
  459. "Unable to start the ACPI Interpreter\n");
  460. goto error1;
  461. }
  462. /*
  463. * ACPI 2.0 requires the EC driver to be loaded and work before
  464. * the EC device is found in the namespace (i.e. before acpi_initialize_objects()
  465. * is called).
  466. *
  467. * This is accomplished by looking for the ECDT table, and getting
  468. * the EC parameters out of that.
  469. */
  470. status = acpi_ec_ecdt_probe();
  471. /* Ignore result. Not having an ECDT is not fatal. */
  472. status = acpi_initialize_objects(ACPI_FULL_INITIALIZATION);
  473. if (ACPI_FAILURE(status)) {
  474. printk(KERN_ERR PREFIX "Unable to initialize ACPI objects\n");
  475. goto error1;
  476. }
  477. /*
  478. * _OSC method may exist in module level code,
  479. * so it must be run after ACPI_FULL_INITIALIZATION
  480. */
  481. acpi_bus_osc_support();
  482. /*
  483. * _PDC control method may load dynamic SSDT tables,
  484. * and we need to install the table handler before that.
  485. */
  486. acpi_sysfs_init();
  487. acpi_early_processor_set_pdc();
  488. /*
  489. * Maybe EC region is required at bus_scan/acpi_get_devices. So it
  490. * is necessary to enable it as early as possible.
  491. */
  492. acpi_boot_ec_enable();
  493. printk(KERN_INFO PREFIX "Interpreter enabled\n");
  494. /* Initialize sleep structures */
  495. acpi_sleep_init();
  496. /*
  497. * Get the system interrupt model and evaluate \_PIC.
  498. */
  499. result = acpi_bus_init_irq();
  500. if (result)
  501. goto error1;
  502. /*
  503. * Register the for all standard device notifications.
  504. */
  505. status =
  506. acpi_install_notify_handler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY,
  507. &acpi_bus_notify, NULL);
  508. if (ACPI_FAILURE(status)) {
  509. printk(KERN_ERR PREFIX
  510. "Unable to register for device notifications\n");
  511. goto error1;
  512. }
  513. /*
  514. * Create the top ACPI proc directory
  515. */
  516. acpi_root_dir = proc_mkdir(ACPI_BUS_FILE_ROOT, NULL);
  517. return 0;
  518. /* Mimic structured exception handling */
  519. error1:
  520. acpi_terminate();
  521. return -ENODEV;
  522. }
  523. struct kobject *acpi_kobj;
  524. EXPORT_SYMBOL_GPL(acpi_kobj);
  525. static int __init acpi_init(void)
  526. {
  527. int result;
  528. if (acpi_disabled) {
  529. printk(KERN_INFO PREFIX "Interpreter disabled.\n");
  530. return -ENODEV;
  531. }
  532. acpi_kobj = kobject_create_and_add("acpi", firmware_kobj);
  533. if (!acpi_kobj) {
  534. printk(KERN_WARNING "%s: kset create error\n", __func__);
  535. acpi_kobj = NULL;
  536. }
  537. init_acpi_device_notify();
  538. result = acpi_bus_init();
  539. if (result) {
  540. disable_acpi();
  541. return result;
  542. }
  543. pci_mmcfg_late_init();
  544. acpi_scan_init();
  545. acpi_ec_init();
  546. acpi_debugfs_init();
  547. acpi_sleep_proc_init();
  548. acpi_wakeup_device_init();
  549. return 0;
  550. }
  551. subsys_initcall(acpi_init);