Merge branches 'acpi-osl', 'acpi-power' and 'acpi-misc'
* acpi-osl: ACPI: Add memory semantics to acpi_os_map_memory() * acpi-power: ACPI: power: Drop name from struct acpi_power_resource ACPI: power: Use acpi_handle_debug() to print debug messages * acpi-misc: ACPI: button: Add DMI quirk for Lenovo Yoga 9 (14INTL5)
This commit is contained in:
commit
2cbd40709a
@ -50,6 +50,9 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr);
|
||||
void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size);
|
||||
#define acpi_os_ioremap acpi_os_ioremap
|
||||
|
||||
void __iomem *acpi_os_memmap(acpi_physical_address phys, acpi_size size);
|
||||
#define acpi_os_memmap acpi_os_memmap
|
||||
|
||||
typedef u64 phys_cpuid_t;
|
||||
#define PHYS_CPUID_INVALID INVALID_HWID
|
||||
|
||||
|
@ -273,7 +273,8 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr)
|
||||
return __pgprot(PROT_DEVICE_nGnRnE);
|
||||
}
|
||||
|
||||
void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
|
||||
static void __iomem *__acpi_os_ioremap(acpi_physical_address phys,
|
||||
acpi_size size, bool memory)
|
||||
{
|
||||
efi_memory_desc_t *md, *region = NULL;
|
||||
pgprot_t prot;
|
||||
@ -299,9 +300,11 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
|
||||
* It is fine for AML to remap regions that are not represented in the
|
||||
* EFI memory map at all, as it only describes normal memory, and MMIO
|
||||
* regions that require a virtual mapping to make them accessible to
|
||||
* the EFI runtime services.
|
||||
* the EFI runtime services. Determine the region default
|
||||
* attributes by checking the requested memory semantics.
|
||||
*/
|
||||
prot = __pgprot(PROT_DEVICE_nGnRnE);
|
||||
prot = memory ? __pgprot(PROT_NORMAL_NC) :
|
||||
__pgprot(PROT_DEVICE_nGnRnE);
|
||||
if (region) {
|
||||
switch (region->type) {
|
||||
case EFI_LOADER_CODE:
|
||||
@ -361,6 +364,16 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
|
||||
return __ioremap(phys, size, prot);
|
||||
}
|
||||
|
||||
void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
|
||||
{
|
||||
return __acpi_os_ioremap(phys, size, false);
|
||||
}
|
||||
|
||||
void __iomem *acpi_os_memmap(acpi_physical_address phys, acpi_size size)
|
||||
{
|
||||
return __acpi_os_ioremap(phys, size, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Claim Synchronous External Aborts as a firmware first notification.
|
||||
*
|
||||
|
@ -77,6 +77,17 @@ static const struct dmi_system_id dmi_lid_quirks[] = {
|
||||
},
|
||||
.driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_DISABLED,
|
||||
},
|
||||
{
|
||||
/*
|
||||
* Lenovo Yoga 9 14ITL5, initial notification of the LID device
|
||||
* never happens.
|
||||
*/
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "82BG"),
|
||||
},
|
||||
.driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN,
|
||||
},
|
||||
{
|
||||
/*
|
||||
* Medion Akoya E2215T, notification of the LID device only
|
||||
|
@ -284,7 +284,8 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size)
|
||||
#define should_use_kmap(pfn) page_is_ram(pfn)
|
||||
#endif
|
||||
|
||||
static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz)
|
||||
static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz,
|
||||
bool memory)
|
||||
{
|
||||
unsigned long pfn;
|
||||
|
||||
@ -294,7 +295,8 @@ static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz)
|
||||
return NULL;
|
||||
return (void __iomem __force *)kmap(pfn_to_page(pfn));
|
||||
} else
|
||||
return acpi_os_ioremap(pg_off, pg_sz);
|
||||
return memory ? acpi_os_memmap(pg_off, pg_sz) :
|
||||
acpi_os_ioremap(pg_off, pg_sz);
|
||||
}
|
||||
|
||||
static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr)
|
||||
@ -309,9 +311,10 @@ static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr)
|
||||
}
|
||||
|
||||
/**
|
||||
* acpi_os_map_iomem - Get a virtual address for a given physical address range.
|
||||
* __acpi_os_map_iomem - Get a virtual address for a given physical address range.
|
||||
* @phys: Start of the physical address range to map.
|
||||
* @size: Size of the physical address range to map.
|
||||
* @memory: true if remapping memory, false if IO
|
||||
*
|
||||
* Look up the given physical address range in the list of existing ACPI memory
|
||||
* mappings. If found, get a reference to it and return a pointer to it (its
|
||||
@ -321,8 +324,8 @@ static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr)
|
||||
* During early init (when acpi_permanent_mmap has not been set yet) this
|
||||
* routine simply calls __acpi_map_table() to get the job done.
|
||||
*/
|
||||
void __iomem __ref
|
||||
*acpi_os_map_iomem(acpi_physical_address phys, acpi_size size)
|
||||
static void __iomem __ref
|
||||
*__acpi_os_map_iomem(acpi_physical_address phys, acpi_size size, bool memory)
|
||||
{
|
||||
struct acpi_ioremap *map;
|
||||
void __iomem *virt;
|
||||
@ -353,7 +356,7 @@ void __iomem __ref
|
||||
|
||||
pg_off = round_down(phys, PAGE_SIZE);
|
||||
pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off;
|
||||
virt = acpi_map(phys, size);
|
||||
virt = acpi_map(phys, size, memory);
|
||||
if (!virt) {
|
||||
mutex_unlock(&acpi_ioremap_lock);
|
||||
kfree(map);
|
||||
@ -372,11 +375,17 @@ out:
|
||||
mutex_unlock(&acpi_ioremap_lock);
|
||||
return map->virt + (phys - map->phys);
|
||||
}
|
||||
|
||||
void __iomem *__ref
|
||||
acpi_os_map_iomem(acpi_physical_address phys, acpi_size size)
|
||||
{
|
||||
return __acpi_os_map_iomem(phys, size, false);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(acpi_os_map_iomem);
|
||||
|
||||
void *__ref acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
|
||||
{
|
||||
return (void *)acpi_os_map_iomem(phys, size);
|
||||
return (void *)__acpi_os_map_iomem(phys, size, true);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(acpi_os_map_memory);
|
||||
|
||||
|
@ -48,7 +48,6 @@ struct acpi_power_dependent_device {
|
||||
struct acpi_power_resource {
|
||||
struct acpi_device device;
|
||||
struct list_head list_node;
|
||||
char *name;
|
||||
u32 system_level;
|
||||
u32 order;
|
||||
unsigned int ref_count;
|
||||
@ -70,6 +69,11 @@ static DEFINE_MUTEX(power_resource_list_lock);
|
||||
Power Resource Management
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
static inline const char *resource_dev_name(struct acpi_power_resource *pr)
|
||||
{
|
||||
return dev_name(&pr->device.dev);
|
||||
}
|
||||
|
||||
static inline
|
||||
struct acpi_power_resource *to_power_resource(struct acpi_device *device)
|
||||
{
|
||||
@ -264,7 +268,8 @@ acpi_power_resource_add_dependent(struct acpi_power_resource *resource,
|
||||
|
||||
dep->dev = dev;
|
||||
list_add_tail(&dep->node, &resource->dependents);
|
||||
dev_dbg(dev, "added power dependency to [%s]\n", resource->name);
|
||||
dev_dbg(dev, "added power dependency to [%s]\n",
|
||||
resource_dev_name(resource));
|
||||
|
||||
unlock:
|
||||
mutex_unlock(&resource->resource_lock);
|
||||
@ -283,7 +288,7 @@ acpi_power_resource_remove_dependent(struct acpi_power_resource *resource,
|
||||
list_del(&dep->node);
|
||||
kfree(dep);
|
||||
dev_dbg(dev, "removed power dependency to [%s]\n",
|
||||
resource->name);
|
||||
resource_dev_name(resource));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -356,10 +361,11 @@ void acpi_device_power_remove_dependent(struct acpi_device *adev,
|
||||
|
||||
static int __acpi_power_on(struct acpi_power_resource *resource)
|
||||
{
|
||||
acpi_handle handle = resource->device.handle;
|
||||
struct acpi_power_dependent_device *dep;
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
status = acpi_evaluate_object(resource->device.handle, "_ON", NULL, NULL);
|
||||
status = acpi_evaluate_object(handle, "_ON", NULL, NULL);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
resource->state = ACPI_POWER_RESOURCE_STATE_UNKNOWN;
|
||||
return -ENODEV;
|
||||
@ -367,7 +373,7 @@ static int __acpi_power_on(struct acpi_power_resource *resource)
|
||||
|
||||
resource->state = ACPI_POWER_RESOURCE_STATE_ON;
|
||||
|
||||
pr_debug("Power resource [%s] turned on\n", resource->name);
|
||||
acpi_handle_debug(handle, "Power resource turned on\n");
|
||||
|
||||
/*
|
||||
* If there are other dependents on this power resource we need to
|
||||
@ -380,7 +386,7 @@ static int __acpi_power_on(struct acpi_power_resource *resource)
|
||||
|
||||
list_for_each_entry(dep, &resource->dependents, node) {
|
||||
dev_dbg(dep->dev, "runtime resuming because [%s] turned on\n",
|
||||
resource->name);
|
||||
resource_dev_name(resource));
|
||||
pm_request_resume(dep->dev);
|
||||
}
|
||||
|
||||
@ -392,7 +398,8 @@ static int acpi_power_on_unlocked(struct acpi_power_resource *resource)
|
||||
int result = 0;
|
||||
|
||||
if (resource->ref_count++) {
|
||||
pr_debug("Power resource [%s] already on\n", resource->name);
|
||||
acpi_handle_debug(resource->device.handle,
|
||||
"Power resource already on\n");
|
||||
} else {
|
||||
result = __acpi_power_on(resource);
|
||||
if (result)
|
||||
@ -413,10 +420,10 @@ static int acpi_power_on(struct acpi_power_resource *resource)
|
||||
|
||||
static int __acpi_power_off(struct acpi_power_resource *resource)
|
||||
{
|
||||
acpi_handle handle = resource->device.handle;
|
||||
acpi_status status;
|
||||
|
||||
status = acpi_evaluate_object(resource->device.handle, "_OFF",
|
||||
NULL, NULL);
|
||||
status = acpi_evaluate_object(handle, "_OFF", NULL, NULL);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
resource->state = ACPI_POWER_RESOURCE_STATE_UNKNOWN;
|
||||
return -ENODEV;
|
||||
@ -424,7 +431,7 @@ static int __acpi_power_off(struct acpi_power_resource *resource)
|
||||
|
||||
resource->state = ACPI_POWER_RESOURCE_STATE_OFF;
|
||||
|
||||
pr_debug("Power resource [%s] turned off\n", resource->name);
|
||||
acpi_handle_debug(handle, "Power resource turned off\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -434,12 +441,14 @@ static int acpi_power_off_unlocked(struct acpi_power_resource *resource)
|
||||
int result = 0;
|
||||
|
||||
if (!resource->ref_count) {
|
||||
pr_debug("Power resource [%s] already off\n", resource->name);
|
||||
acpi_handle_debug(resource->device.handle,
|
||||
"Power resource already off\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (--resource->ref_count) {
|
||||
pr_debug("Power resource [%s] still in use\n", resource->name);
|
||||
acpi_handle_debug(resource->device.handle,
|
||||
"Power resource still in use\n");
|
||||
} else {
|
||||
result = __acpi_power_off(resource);
|
||||
if (result)
|
||||
@ -949,7 +958,6 @@ struct acpi_device *acpi_add_power_resource(acpi_handle handle)
|
||||
mutex_init(&resource->resource_lock);
|
||||
INIT_LIST_HEAD(&resource->list_node);
|
||||
INIT_LIST_HEAD(&resource->dependents);
|
||||
resource->name = device->pnp.bus_id;
|
||||
strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
|
||||
strcpy(acpi_device_class(device), ACPI_POWER_CLASS);
|
||||
device->power.state = ACPI_STATE_UNKNOWN;
|
||||
@ -1004,7 +1012,7 @@ void acpi_resume_power_resources(void)
|
||||
|
||||
if (state == ACPI_POWER_RESOURCE_STATE_OFF
|
||||
&& resource->ref_count) {
|
||||
dev_dbg(&resource->device.dev, "Turning ON\n");
|
||||
acpi_handle_debug(resource->device.handle, "Turning ON\n");
|
||||
__acpi_power_on(resource);
|
||||
}
|
||||
|
||||
@ -1034,7 +1042,7 @@ void acpi_turn_off_unused_power_resources(void)
|
||||
*/
|
||||
if (!resource->ref_count &&
|
||||
resource->state != ACPI_POWER_RESOURCE_STATE_OFF) {
|
||||
dev_dbg(&resource->device.dev, "Turning OFF\n");
|
||||
acpi_handle_debug(resource->device.handle, "Turning OFF\n");
|
||||
__acpi_power_off(resource);
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,14 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef acpi_os_memmap
|
||||
static inline void __iomem *acpi_os_memmap(acpi_physical_address phys,
|
||||
acpi_size size)
|
||||
{
|
||||
return ioremap_cache(phys, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
extern bool acpi_permanent_mmap;
|
||||
|
||||
void __iomem __ref
|
||||
|
Loading…
Reference in New Issue
Block a user