Skip to content

Commit dfef771

Browse files
committed
Merge branches 'acpi-bus', 'acpi-scan' and 'acpi-tables'
* acpi-bus: ACPI: Remove redundant clearing of context->ret.pointer from acpi_run_osc() * acpi-scan: ACPI: scan: Simplify acpi_table_events_fn() ACPI: scan: Fix race related to dropping dependencies ACPI: scan: Reorganize acpi_device_add() ACPI: scan: Fix device object rescan in acpi_scan_clear_dep() ACPI: scan: Make acpi_walk_dep_device_list() ACPI: scan: Rearrange acpi_dev_get_first_consumer_dev_cb() ACPI: scan: Define acpi_bus_put_acpi_device() as static inline ACPI: scan: initialize local variable to avoid garbage being returned ACPI: scan: Add function to fetch dependent of ACPI device ACPI: scan: Extend acpi_walk_dep_device_list() ACPI: scan: Rearrange dep_unmet initialization * acpi-tables: ACPI: tables: Add custom DSDT file as makefile prerequisite ACPI: bgrt: Use sysfs_emit ACPI: bgrt: Fix CFI violation ACPI: tables: FPDT: Add missing acpi_put_table() in acpi_init_fpdt() ACPI: tables: PPTT: Populate cache-id if provided by firmware
4 parents f9ef9b8 + 84b7355 + 8d287e8 + d1059c1 commit dfef771

File tree

16 files changed

+292
-177
lines changed

16 files changed

+292
-177
lines changed

drivers/acpi/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT
88
#
99
# ACPI Boot-Time Table Parsing
1010
#
11+
ifeq ($(CONFIG_ACPI_CUSTOM_DSDT),y)
12+
tables.o: $(src)/../../include/$(subst $\",,$(CONFIG_ACPI_CUSTOM_DSDT_FILE)) ;
13+
14+
endif
15+
1116
obj-$(CONFIG_ACPI) += tables.o
1217
obj-$(CONFIG_X86) += blacklist.o
1318

drivers/acpi/acpi_fpdt.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,10 @@ static int __init acpi_init_fpdt(void)
240240
return 0;
241241

242242
fpdt_kobj = kobject_create_and_add("fpdt", acpi_kobj);
243-
if (!fpdt_kobj)
243+
if (!fpdt_kobj) {
244+
acpi_put_table(header);
244245
return -ENOMEM;
246+
}
245247

246248
while (offset < header->length) {
247249
subtable = (void *)header + offset;

drivers/acpi/bgrt.c

Lines changed: 18 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -15,40 +15,19 @@
1515
static void *bgrt_image;
1616
static struct kobject *bgrt_kobj;
1717

18-
static ssize_t version_show(struct device *dev,
19-
struct device_attribute *attr, char *buf)
20-
{
21-
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.version);
22-
}
23-
static DEVICE_ATTR_RO(version);
24-
25-
static ssize_t status_show(struct device *dev,
26-
struct device_attribute *attr, char *buf)
27-
{
28-
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.status);
29-
}
30-
static DEVICE_ATTR_RO(status);
31-
32-
static ssize_t type_show(struct device *dev,
33-
struct device_attribute *attr, char *buf)
34-
{
35-
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_type);
36-
}
37-
static DEVICE_ATTR_RO(type);
38-
39-
static ssize_t xoffset_show(struct device *dev,
40-
struct device_attribute *attr, char *buf)
41-
{
42-
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_offset_x);
43-
}
44-
static DEVICE_ATTR_RO(xoffset);
45-
46-
static ssize_t yoffset_show(struct device *dev,
47-
struct device_attribute *attr, char *buf)
48-
{
49-
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_offset_y);
50-
}
51-
static DEVICE_ATTR_RO(yoffset);
18+
#define BGRT_SHOW(_name, _member) \
19+
static ssize_t _name##_show(struct kobject *kobj, \
20+
struct kobj_attribute *attr, char *buf) \
21+
{ \
22+
return sysfs_emit(buf, "%d\n", bgrt_tab._member); \
23+
} \
24+
struct kobj_attribute bgrt_attr_##_name = __ATTR_RO(_name)
25+
26+
BGRT_SHOW(version, version);
27+
BGRT_SHOW(status, status);
28+
BGRT_SHOW(type, image_type);
29+
BGRT_SHOW(xoffset, image_offset_x);
30+
BGRT_SHOW(yoffset, image_offset_y);
5231

5332
static ssize_t image_read(struct file *file, struct kobject *kobj,
5433
struct bin_attribute *attr, char *buf, loff_t off, size_t count)
@@ -60,11 +39,11 @@ static ssize_t image_read(struct file *file, struct kobject *kobj,
6039
static BIN_ATTR_RO(image, 0); /* size gets filled in later */
6140

6241
static struct attribute *bgrt_attributes[] = {
63-
&dev_attr_version.attr,
64-
&dev_attr_status.attr,
65-
&dev_attr_type.attr,
66-
&dev_attr_xoffset.attr,
67-
&dev_attr_yoffset.attr,
42+
&bgrt_attr_version.attr,
43+
&bgrt_attr_status.attr,
44+
&bgrt_attr_type.attr,
45+
&bgrt_attr_xoffset.attr,
46+
&bgrt_attr_yoffset.attr,
6847
NULL,
6948
};
7049

drivers/acpi/bus.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,6 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
262262

263263
out_kfree:
264264
kfree(output.pointer);
265-
if (status != AE_OK)
266-
context->ret.pointer = NULL;
267265
return status;
268266
}
269267
EXPORT_SYMBOL(acpi_run_osc);
@@ -1195,7 +1193,8 @@ void __init acpi_subsystem_init(void)
11951193

11961194
static acpi_status acpi_bus_table_handler(u32 event, void *table, void *context)
11971195
{
1198-
acpi_scan_table_handler(event, table, context);
1196+
if (event == ACPI_TABLE_EVENT_LOAD)
1197+
acpi_scan_table_notify();
11991198

12001199
return acpi_sysfs_table_handler(event, table, context);
12011200
}

drivers/acpi/ec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1627,7 +1627,7 @@ static int acpi_ec_add(struct acpi_device *device)
16271627
WARN(!ret, "Could not request EC cmd io port 0x%lx", ec->command_addr);
16281628

16291629
/* Reprobe devices depending on the EC */
1630-
acpi_walk_dep_device_list(ec->handle);
1630+
acpi_dev_clear_dependencies(device);
16311631

16321632
acpi_handle_debug(ec->handle, "enumerated.\n");
16331633
return 0;

drivers/acpi/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void acpi_device_hotplug(struct acpi_device *adev, u32 src);
8888
bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent);
8989

9090
acpi_status acpi_sysfs_table_handler(u32 event, void *table, void *context);
91-
void acpi_scan_table_handler(u32 event, void *table, void *context);
91+
void acpi_scan_table_notify(void);
9292

9393
/* --------------------------------------------------------------------------
9494
Device Node Initialization / Removal

drivers/acpi/pmic/intel_pmic_chtdc_ti.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static int chtdc_ti_pmic_opregion_probe(struct platform_device *pdev)
117117
return err;
118118

119119
/* Re-enumerate devices depending on PMIC */
120-
acpi_walk_dep_device_list(ACPI_HANDLE(pdev->dev.parent));
120+
acpi_dev_clear_dependencies(ACPI_COMPANION(pdev->dev.parent));
121121
return 0;
122122
}
123123

drivers/acpi/pptt.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ static struct acpi_pptt_cache *acpi_find_cache_node(struct acpi_table_header *ta
347347
* @this_leaf: Kernel cache info structure being updated
348348
* @found_cache: The PPTT node describing this cache instance
349349
* @cpu_node: A unique reference to describe this cache instance
350+
* @revision: The revision of the PPTT table
350351
*
351352
* The ACPI spec implies that the fields in the cache structures are used to
352353
* extend and correct the information probed from the hardware. Lets only
@@ -356,8 +357,11 @@ static struct acpi_pptt_cache *acpi_find_cache_node(struct acpi_table_header *ta
356357
*/
357358
static void update_cache_properties(struct cacheinfo *this_leaf,
358359
struct acpi_pptt_cache *found_cache,
359-
struct acpi_pptt_processor *cpu_node)
360+
struct acpi_pptt_processor *cpu_node,
361+
u8 revision)
360362
{
363+
struct acpi_pptt_cache_v1* found_cache_v1;
364+
361365
this_leaf->fw_token = cpu_node;
362366
if (found_cache->flags & ACPI_PPTT_SIZE_PROPERTY_VALID)
363367
this_leaf->size = found_cache->size;
@@ -405,6 +409,13 @@ static void update_cache_properties(struct cacheinfo *this_leaf,
405409
if (this_leaf->type == CACHE_TYPE_NOCACHE &&
406410
found_cache->flags & ACPI_PPTT_CACHE_TYPE_VALID)
407411
this_leaf->type = CACHE_TYPE_UNIFIED;
412+
413+
if (revision >= 3 && (found_cache->flags & ACPI_PPTT_CACHE_ID_VALID)) {
414+
found_cache_v1 = ACPI_ADD_PTR(struct acpi_pptt_cache_v1,
415+
found_cache, sizeof(struct acpi_pptt_cache));
416+
this_leaf->id = found_cache_v1->cache_id;
417+
this_leaf->attributes |= CACHE_ID;
418+
}
408419
}
409420

410421
static void cache_setup_acpi_cpu(struct acpi_table_header *table,
@@ -425,9 +436,8 @@ static void cache_setup_acpi_cpu(struct acpi_table_header *table,
425436
&cpu_node);
426437
pr_debug("found = %p %p\n", found_cache, cpu_node);
427438
if (found_cache)
428-
update_cache_properties(this_leaf,
429-
found_cache,
430-
cpu_node);
439+
update_cache_properties(this_leaf, found_cache,
440+
cpu_node, table->revision);
431441

432442
index++;
433443
}

0 commit comments

Comments
 (0)