Lines Matching +full:sci +full:- +full:proc +full:- +full:ids
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * acpi_bus.c - ACPI Bus Driver ($Revision: 80 $)
50 printk(KERN_NOTICE "%s detected - " in set_copy_dsdt()
51 "force copy of DSDT to local memory\n", id->ident); in set_copy_dsdt()
59 * Invoke DSDT corruption work-around on all Toshiba Satellite.
74 /* --------------------------------------------------------------------------
76 -------------------------------------------------------------------------- */
107 if (acpi_device_is_battery(device) && device->dep_unmet) { in acpi_bus_get_status()
112 status = acpi_bus_get_status_handle(device->handle, &sta); in acpi_bus_get_status()
114 return -ENODEV; in acpi_bus_get_status()
118 if (device->status.functional && !device->status.present) { in acpi_bus_get_status()
121 device->pnp.bus_id, (u32)sta)); in acpi_bus_get_status()
125 device->pnp.bus_id, (u32)sta)); in acpi_bus_get_status()
145 return -ENODEV; in acpi_bus_attach_private_data()
157 return -EINVAL; in acpi_bus_get_private_data()
162 return -ENODEV; in acpi_bus_get_private_data()
180 acpi_handle_debug(handle, "(%s): %s\n", context->uuid_str, error); in acpi_print_osc_error()
183 for (i = 0; i < context->cap.length; i += sizeof(u32)) in acpi_print_osc_error()
184 pr_debug(" %x", *((u32 *)(context->cap.pointer + i))); in acpi_print_osc_error()
201 if (guid_parse(context->uuid_str, &guid)) in acpi_run_osc()
203 context->ret.length = ACPI_ALLOCATE_BUFFER; in acpi_run_osc()
204 context->ret.pointer = NULL; in acpi_run_osc()
213 in_params[1].integer.value = context->rev; in acpi_run_osc()
215 in_params[2].integer.value = context->cap.length/sizeof(u32); in acpi_run_osc()
217 in_params[3].buffer.length = context->cap.length; in acpi_run_osc()
218 in_params[3].buffer.pointer = context->cap.pointer; in acpi_run_osc()
228 if (out_obj->type != ACPI_TYPE_BUFFER in acpi_run_osc()
229 || out_obj->buffer.length != context->cap.length) { in acpi_run_osc()
236 errors = *((u32 *)out_obj->buffer.pointer) & ~(1 << 0); in acpi_run_osc()
248 if (((u32 *)context->cap.pointer)[OSC_QUERY_DWORD] in acpi_run_osc()
258 context->ret.length = out_obj->buffer.length; in acpi_run_osc()
259 context->ret.pointer = kmemdup(out_obj->buffer.pointer, in acpi_run_osc()
260 context->ret.length, GFP_KERNEL); in acpi_run_osc()
261 if (!context->ret.pointer) { in acpi_run_osc()
270 context->ret.pointer = NULL; in acpi_run_osc()
284 static u8 sb_uuid_str[] = "0811B06E-4A27-44F9-8D60-3CBBC22E7B48";
337 /* --------------------------------------------------------------------------
339 -------------------------------------------------------------------------- */
343 * ---------------
344 * Callback for all 'system-level' device notifications (values 0x00-0x7F).
401 driver = adev->driver; in acpi_bus_notify()
402 if (driver && driver->ops.notify && in acpi_bus_notify()
403 (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS)) in acpi_bus_notify()
404 driver->ops.notify(adev, type); in acpi_bus_notify()
424 device->driver->ops.notify(device, event); in acpi_device_notify()
445 if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) in acpi_device_install_notify_handler()
450 else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) in acpi_device_install_notify_handler()
456 status = acpi_install_notify_handler(device->handle, in acpi_device_install_notify_handler()
462 return -EINVAL; in acpi_device_install_notify_handler()
468 if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) in acpi_device_remove_notify_handler()
471 else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) in acpi_device_remove_notify_handler()
475 acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, in acpi_device_remove_notify_handler()
520 return -ENXIO; in acpi_setup_sb_notify_handler()
524 return -EINVAL; in acpi_setup_sb_notify_handler()
529 /* --------------------------------------------------------------------------
531 -------------------------------------------------------------------------- */
534 * acpi_get_first_physical_node - Get first physical node of an ACPI device
541 struct mutex *physical_node_lock = &adev->physical_node_lock; in acpi_get_first_physical_node()
545 if (list_empty(&adev->physical_node_list)) { in acpi_get_first_physical_node()
550 node = list_first_entry(&adev->physical_node_list, in acpi_get_first_physical_node()
553 phys_dev = node->dev; in acpi_get_first_physical_node()
569 * acpi_device_is_first_physical_node - Is given dev first physical node
586 * acpi_companion_match() - Can we match via ACPI companion device
590 * a valid list of PNP IDs, and if the device is the first (primary) physical
597 * companion. A typical case is an MFD device where all the sub-devices share
600 * IDs.
614 if (list_empty(&adev->pnp.ids)) in acpi_companion_match()
621 * acpi_of_match_device - Match device object using the "compatible" property.
623 * @of_match_table: List of device IDs to match against.
640 of_compatible = adev->data.of_compatible; in acpi_of_match_device()
644 if (of_compatible->type == ACPI_TYPE_PACKAGE) { in acpi_of_match_device()
645 nval = of_compatible->package.count; in acpi_of_match_device()
646 obj = of_compatible->package.elements; in acpi_of_match_device()
655 for (id = of_match_table; id->compatible[0]; id++) in acpi_of_match_device()
656 if (!strcasecmp(obj->string.pointer, id->compatible)) { in acpi_of_match_device()
673 of_compatible = adev->data.of_compatible; in acpi_of_modalias()
677 if (of_compatible->type == ACPI_TYPE_PACKAGE) in acpi_of_modalias()
678 obj = of_compatible->package.elements; in acpi_of_modalias()
682 str = obj->string.pointer; in acpi_of_modalias()
690 * acpi_set_modalias - Set modalias using "compatible" property or supplied ID
714 if (!id->cls) in __acpi_match_device_cls()
717 /* Apply class-code bitmask, before checking each class-code byte */ in __acpi_match_device_cls()
719 byte_shift = 8 * (3 - i); in __acpi_match_device_cls()
720 msk = (id->cls_msk >> byte_shift) & 0xFF; in __acpi_match_device_cls()
724 sprintf(buf, "%02x", (id->cls >> byte_shift) & msk); in __acpi_match_device_cls()
725 if (strncmp(buf, &hwid->id[(i - 1) * 2], 2)) in __acpi_match_device_cls()
744 if (!device || !device->status.present) in __acpi_match_device()
747 list_for_each_entry(hwid, &device->pnp.ids, list) { in __acpi_match_device()
748 /* First, check the ACPI/PNP IDs provided by the caller. */ in __acpi_match_device()
750 for (id = acpi_ids; id->id[0] || id->cls; id++) { in __acpi_match_device()
751 if (id->id[0] && !strcmp((char *)id->id, hwid->id)) in __acpi_match_device()
753 if (id->cls && __acpi_match_device_cls(id, hwid)) in __acpi_match_device()
762 if (!strcmp(ACPI_DT_NAMESPACE_HID, hwid->id)) in __acpi_match_device()
774 * acpi_match_device - Match a struct device against a given list of ACPI IDs
775 * @ids: Array of struct acpi_device_id object to match against.
780 * device IDs.
784 const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, in acpi_match_device() argument
789 __acpi_match_device(acpi_companion_match(dev), ids, NULL, &id, NULL); in acpi_match_device()
799 if (!acpi_of_match_device(adev, dev->driver->of_match_table, &match)) in acpi_of_device_get_match_data()
802 return match->data; in acpi_of_device_get_match_data()
809 if (!dev->driver->acpi_match_table) in acpi_device_get_match_data()
812 match = acpi_match_device(dev->driver->acpi_match_table, dev); in acpi_device_get_match_data()
816 return (const void *)match->driver_data; in acpi_device_get_match_data()
821 const struct acpi_device_id *ids) in acpi_match_device_ids() argument
823 return __acpi_match_device(device, ids, NULL, NULL, NULL) ? 0 : -ENOENT; in acpi_match_device_ids()
830 if (!drv->acpi_match_table) in acpi_driver_match_device()
832 drv->of_match_table, in acpi_driver_match_device()
836 drv->acpi_match_table, drv->of_match_table, in acpi_driver_match_device()
841 /* --------------------------------------------------------------------------
843 -------------------------------------------------------------------------- */
846 * acpi_bus_register_driver - register a driver with the ACPI bus
858 return -ENODEV; in acpi_bus_register_driver()
859 driver->drv.name = driver->name; in acpi_bus_register_driver()
860 driver->drv.bus = &acpi_bus_type; in acpi_bus_register_driver()
861 driver->drv.owner = driver->owner; in acpi_bus_register_driver()
863 ret = driver_register(&driver->drv); in acpi_bus_register_driver()
870 * acpi_bus_unregister_driver - unregisters a driver with the ACPI bus
878 driver_unregister(&driver->drv); in acpi_bus_unregister_driver()
883 /* --------------------------------------------------------------------------
885 -------------------------------------------------------------------------- */
892 return acpi_dev->flags.match_driver in acpi_bus_match()
893 && !acpi_match_device_ids(acpi_dev, acpi_drv->ids); in acpi_bus_match()
904 struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver); in acpi_device_probe()
907 if (acpi_dev->handler && !acpi_is_pnp_device(acpi_dev)) in acpi_device_probe()
908 return -EINVAL; in acpi_device_probe()
910 if (!acpi_drv->ops.add) in acpi_device_probe()
911 return -ENOSYS; in acpi_device_probe()
913 ret = acpi_drv->ops.add(acpi_dev); in acpi_device_probe()
917 acpi_dev->driver = acpi_drv; in acpi_device_probe()
920 acpi_drv->name, acpi_dev->pnp.bus_id)); in acpi_device_probe()
922 if (acpi_drv->ops.notify) { in acpi_device_probe()
925 if (acpi_drv->ops.remove) in acpi_device_probe()
926 acpi_drv->ops.remove(acpi_dev); in acpi_device_probe()
928 acpi_dev->driver = NULL; in acpi_device_probe()
929 acpi_dev->driver_data = NULL; in acpi_device_probe()
935 acpi_drv->name, acpi_dev->pnp.bus_id)); in acpi_device_probe()
943 struct acpi_driver *acpi_drv = acpi_dev->driver; in acpi_device_remove()
946 if (acpi_drv->ops.notify) in acpi_device_remove()
948 if (acpi_drv->ops.remove) in acpi_device_remove()
949 acpi_drv->ops.remove(acpi_dev); in acpi_device_remove()
951 acpi_dev->driver = NULL; in acpi_device_remove()
952 acpi_dev->driver_data = NULL; in acpi_device_remove()
966 /* --------------------------------------------------------------------------
968 -------------------------------------------------------------------------- */
1002 return -ENODEV; in acpi_bus_init_irq()
1010 return -ENODEV; in acpi_bus_init_irq()
1017 * acpi_early_init - Initialize ACPICA and populate the ACPI namespace.
1073 /* Set PIC-mode SCI trigger type */ in acpi_early_init()
1091 * acpi_subsystem_init - Finalize the early initialization of ACPI.
1217 * Create the top ACPI proc directory in acpi_bus_init()
1228 return -ENODEV; in acpi_bus_init()
1240 return -ENODEV; in acpi_init()