Lines Matching +full:os +full:- +full:initiated

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * acpi_osl.c - OS-dependent functions ($Revision: 83 $)
34 #include <linux/io-64-nonatomic-lo-hi.h>
96 memcpy(&addr, &gas->address, sizeof(addr)); in acpi_request_region()
101 if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) in acpi_request_region()
103 else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) in acpi_request_region()
127 /* Length of GPE blocks must be a non-negative multiple of 2 */ in acpi_reserve_resources()
192 * at modified ACPI tables that could alter kernel behaviour - in acpi_os_get_root_pointer()
227 if (map->phys <= phys && in acpi_map_lookup()
228 phys + size <= map->phys + map->size) in acpi_map_lookup()
242 return map->virt + (phys - map->phys); in acpi_map_vaddr_lookup()
255 virt = map->virt + (phys - map->phys); in acpi_os_get_iomem()
256 map->track.refcount++; in acpi_os_get_iomem()
270 if (map->virt <= virt && in acpi_map_lookup_virt()
271 virt + size <= map->virt + map->size) in acpi_map_lookup_virt()
309 * acpi_os_map_iomem - Get a virtual address for a given physical address range.
341 map->track.refcount++; in acpi_os_map_iomem()
352 pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off; in acpi_os_map_iomem()
360 INIT_LIST_HEAD(&map->list); in acpi_os_map_iomem()
361 map->virt = (void __iomem __force *)((unsigned long)virt & PAGE_MASK); in acpi_os_map_iomem()
362 map->phys = pg_off; in acpi_os_map_iomem()
363 map->size = pg_sz; in acpi_os_map_iomem()
364 map->track.refcount = 1; in acpi_os_map_iomem()
366 list_add_tail_rcu(&map->list, &acpi_ioremaps); in acpi_os_map_iomem()
370 return map->virt + (phys - map->phys); in acpi_os_map_iomem()
386 acpi_unmap(map->phys, map->virt); in acpi_os_map_remove()
393 if (--map->track.refcount) in acpi_os_drop_map_ref()
396 list_del_rcu(&map->list); in acpi_os_drop_map_ref()
398 INIT_RCU_WORK(&map->track.rwork, acpi_os_map_remove); in acpi_os_drop_map_ref()
399 queue_rcu_work(system_wq, &map->track.rwork); in acpi_os_drop_map_ref()
403 * acpi_os_unmap_iomem - Drop a memory mapping reference.
440 * acpi_os_unmap_memory - Drop a memory mapping reference.
454 if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) in acpi_os_map_generic_address()
458 memcpy(&addr, &gas->address, sizeof(addr)); in acpi_os_map_generic_address()
459 if (!addr || !gas->bit_width) in acpi_os_map_generic_address()
462 return acpi_os_map_iomem(addr, gas->bit_width / 8); in acpi_os_map_generic_address()
471 if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) in acpi_os_unmap_generic_address()
475 memcpy(&addr, &gas->address, sizeof(addr)); in acpi_os_unmap_generic_address()
476 if (!addr || !gas->bit_width) in acpi_os_unmap_generic_address()
481 map = acpi_map_lookup(addr, gas->bit_width / 8); in acpi_os_unmap_generic_address()
530 if (!memcmp(init_val->name, "_OS_", 4) && strlen(acpi_os_name)) { in acpi_os_predefined_override()
536 if (!memcmp(init_val->name, "_REV", 4) && acpi_rev_override) { in acpi_os_predefined_override()
625 us -= delay; in acpi_os_stall()
630 * Support ACPI 3.0 AML Timer operand. Returns a 64-bit free-running,
640 return (get_jiffies_64() - INITIAL_JIFFIES) * in acpi_os_get_timer()
701 return -EINVAL; in acpi_os_read_iomem()
807 result = raw_pci_read(pci_id->segment, pci_id->bus, in acpi_os_read_pci_configuration()
808 PCI_DEVFN(pci_id->device, pci_id->function), in acpi_os_read_pci_configuration()
835 result = raw_pci_write(pci_id->segment, pci_id->bus, in acpi_os_write_pci_configuration()
836 PCI_DEVFN(pci_id->device, pci_id->function), in acpi_os_write_pci_configuration()
847 dpc->function(dpc->context); in acpi_os_execute_deferred()
862 ret = -EBUSY; in acpi_register_debugger()
893 return -ENODEV; in acpi_debugger_create_thread()
896 ret = -ENODEV; in acpi_debugger_create_thread()
900 ret = -ENODEV; in acpi_debugger_create_thread()
903 func = acpi_debugger.ops->create_thread; in acpi_debugger_create_thread()
923 return -ENODEV; in acpi_debugger_write_log()
926 ret = -ENODEV; in acpi_debugger_write_log()
930 ret = -ENODEV; in acpi_debugger_write_log()
933 func = acpi_debugger.ops->write_log; in acpi_debugger_write_log()
953 return -ENODEV; in acpi_debugger_read_cmd()
956 ret = -ENODEV; in acpi_debugger_read_cmd()
960 ret = -ENODEV; in acpi_debugger_read_cmd()
963 func = acpi_debugger.ops->read_cmd; in acpi_debugger_read_cmd()
983 return -ENODEV; in acpi_debugger_wait_command_ready()
986 ret = -ENODEV; in acpi_debugger_wait_command_ready()
990 ret = -ENODEV; in acpi_debugger_wait_command_ready()
993 func = acpi_debugger.ops->wait_command_ready; in acpi_debugger_wait_command_ready()
1014 return -ENODEV; in acpi_debugger_notify_command_complete()
1017 ret = -ENODEV; in acpi_debugger_notify_command_complete()
1021 ret = -ENODEV; in acpi_debugger_notify_command_complete()
1024 func = acpi_debugger.ops->notify_command_complete; in acpi_debugger_notify_command_complete()
1049 * PARAMETERS: Type - Type of the callback
1050 * Function - Function to be executed
1051 * Context - Function parameters
1093 dpc->function = function; in acpi_os_execute()
1094 dpc->context = context; in acpi_os_execute()
1103 INIT_WORK(&dpc->work, acpi_os_execute_deferred); in acpi_os_execute()
1106 INIT_WORK(&dpc->work, acpi_os_execute_deferred); in acpi_os_execute()
1116 * On some machines, a software-initiated SMI causes corruption unless in acpi_os_execute()
1117 * the SMI runs on CPU 0. An SMI can be initiated by any AML, but in acpi_os_execute()
1118 * typically it's done in GPE-related methods that are run via in acpi_os_execute()
1122 ret = queue_work_on(0, queue, &dpc->work); in acpi_os_execute()
1160 acpi_device_hotplug(hpw->adev, hpw->src); in acpi_hotplug_work_fn()
1176 INIT_WORK(&hpw->work, acpi_hotplug_work_fn); in acpi_hotplug_schedule()
1177 hpw->adev = adev; in acpi_hotplug_schedule()
1178 hpw->src = src; in acpi_hotplug_schedule()
1185 if (!queue_work(kacpi_hotplug_wq, &hpw->work)) { in acpi_hotplug_schedule()
1218 * 'delete_semaphore()' function -- may result in an invalid
1219 * pointer dereference for non-synchronized consumers. Should
1232 BUG_ON(!list_empty(&sem->wait_list)); in acpi_os_delete_semaphore()
1317 chars = strlen(buffer) - 1; in acpi_os_get_line()
1380 int count = ACPI_MAX_OVERRIDE_LEN - 1; in acpi_os_name_setup()
1385 for (; count-- && *str; str++) { in acpi_os_name_setup()
1402 * Disable the auto-serialization of named objects creation methods.
1410 pr_info("ACPI: auto-serialization disabled\n"); in acpi_no_auto_serialize_setup()
1423 * - strict (default) (2)
1424 * -> further driver trying to access the resources will not load
1425 * - lax (1)
1426 * -> further driver trying to access the resources will load, but you
1429 * - no (0)
1430 * -> ACPI Operation Region resources will not be registered
1467 if (!(res->flags & IORESOURCE_IO) && !(res->flags & IORESOURCE_MEM)) in acpi_check_resource_conflict()
1470 if (res->flags & IORESOURCE_IO) in acpi_check_resource_conflict()
1478 clash = acpi_check_address_range(space_id, res->start, length, warn); in acpi_check_resource_conflict()
1491 return -EBUSY; in acpi_check_resource_conflict()
1502 .end = start + n - 1, in acpi_check_region()
1525 handler_obj = region_obj->region.handler; in acpi_deactivate_mem_region()
1529 if (region_obj->region.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) in acpi_deactivate_mem_region()
1532 if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) in acpi_deactivate_mem_region()
1539 mem_ctx = (void *)&region_obj2->extra.region_context; in acpi_deactivate_mem_region()
1541 if (!(mem_ctx[0]->address >= res->start && in acpi_deactivate_mem_region()
1542 mem_ctx[0]->address < res->end)) in acpi_deactivate_mem_region()
1545 status = handler_obj->address_space.setup(region_obj, in acpi_deactivate_mem_region()
1549 region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE); in acpi_deactivate_mem_region()
1555 * acpi_release_memory - Release any mappings done to a memory region
1565 * safely map the region as non-cached memory.
1575 if (!(res->flags & IORESOURCE_MEM)) in acpi_release_memory()
1643 * PARAMETERS: name - Ascii name for the cache
1644 * size - Size of each cached object
1645 * depth - Maximum depth of the cache (in objects) <ignored>
1646 * cache - Where the new cache object is returned
1668 * PARAMETERS: Cache - Handle to cache object
1686 * PARAMETERS: Cache - Handle to cache object
1705 * PARAMETERS: Cache - Handle to cache object
1706 * Object - The object to be released
1755 * Use acpi_os_map_generic_address to pre-map the reset in acpi_os_initialize()