* [RFC PATCH 0/3] ACPI based system device hotplug framework
@ 2012-07-28 11:42 Jiang Liu
2012-07-28 11:42 ` [RFC PATCH 1/3] ACPIHP: introduce a framework for ACPI based system device hotplug Jiang Liu
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Jiang Liu @ 2012-07-28 11:42 UTC (permalink / raw)
To: Len Brown, Tony Luck, Bob Moore, Huang Ying, Yinghai Lu,
Yasuaki Ishimatsu, Kenji Kaneshige, Wen Congyang, Taku Izumi
Cc: Jiang Liu, Bjorn Helgaas, Hanjun Guo, linux-kernel, linux-acpi,
linux-pci
From: Jiang Liu <liuj97@gmail.com>
The patchset is based on v3.5-rc6 and you may pull them from:
git://github.com/jiangliu/linux.git acpihp
Modern high-end server may support advanced hotplug features for system
devices, including physical processor, memory board, IO extension board
and/or computer node. The ACPI specifications have provided standard
interfaces between firmware and OS to support device hotplug at runtime.
This patch series provide an ACPI based hotplug framework to support system
device hotplug at runtime, which will replace current existing ACPI device
driver based CPU/memory/CONTAINER hotplug mechanism.
The new ACPI based hotplug framework is modelled after PCI hotplug
architecture and target to achieve following goals:
1) Provide a mechanism to detect hotplug slots by checking ACPI _EJ0 method,
ACPI PRCT (platform RAS capabilities table) and other platform specific
mechanisms.
2) Unify the way to enumerate ACPI based hotplug slots. All hotplug slots
will be enumerated by the enumeration driver, instead of by ACPI device
drivers.
3) Dynamically create/destroy ACPI hotplug slots. For example, new ACPI
hotplug slots may be created when hot-adding a computer node if the node
contains some memory hotplug slots.
4) Unify the way to handle ACPI hotplug events. All ACPI hotplug events
for system devices will be handled by a generic ACPI hotplug driver,
instead of handled by ACPI device drivers.
5) Solve dependencies among hotplug slots. You need first to remove the
memory device before removing a physical processor if a hotpluggable memory
device is connected to a hotpluggable physical processor.
6) Provide better error handling and recover.
7) Provide interface to cancel ongoing hotplug operations. It may take a
very long time to remove a memory device, so provide interface to cancel
the operation.
8) Support new RAS features, such as socket/memory migration.
9) Provide better user interfaces to the hotplug functionalities.
The new hotplug framework includes four logical components.
The first is an ACPI hotplug slot enumerator, which enumerates ACPI hotplug
slots on load and provides callbacks to manage those hotplug slots. An ACPI
hotplug slot is an abstraction of receptacles, where a group of system
devices could be connected to.
The second is a device class for ACPI hotplug slots, named acpihp_slot_class.
All ACPI hotplug slot devices will be associated with acpihp_slot_class.
The third is a platform independent class driver for ACPI hotplug slots,
which registers itself onto acpihp_slot_class and manages all ACPI hotplug
slots in system. This hotplug driver handles ACPI hotplug events, processes
user requests and manages slot state machine accoring to user requests.
The fourth is a series of ACPI device drivers, for CPU, memory, PCI host
bridge, IOAPIC and ACPI CONTAINER. These ACPI device drivers provide device
specific callbacks for the hotplug driver to add/remove system devices at
runtime.
This patch set implements the first and second parts, which enumerates
hotplug slots and creates sysfs entries for each slot as below.
linux-drf:/sys/devices/LNXSYSTM:00/acpihp # ll
drwxr-xr-x 4 root root 0 Jul 28 16:00 NODE00
drwxr-xr-x 3 root root 0 Jul 28 16:00 NODE01
drwxr-xr-x 3 root root 0 Jul 28 16:00 NODE02
linux-drf:/sys/devices/LNXSYSTM:00/acpihp/NODE00 # ll
drwxr-xr-x 3 root root 0 Jul 28 16:00 IOX01
-r--r--r-- 1 root root 65536 Jul 28 16:01 capabilities
lrwxrwxrwx 1 root root 0 Jul 28 16:00 device -> ../../../LNXSYSTM:00
-r--r--r-- 1 root root 65536 Jul 28 16:01 object
drwxr-xr-x 2 root root 0 Jul 28 16:01 power
-r--r--r-- 1 root root 65536 Jul 28 16:01 state
-r--r--r-- 1 root root 65536 Jul 28 16:01 status
lrwxrwxrwx 1 root root 0 Jul 28 16:00 subsystem -> ../../../../class/acpihp
-r--r--r-- 1 root root 65536 Jul 28 16:01 type
-rw-r--r-- 1 root root 65536 Jul 28 16:01 uevent
linux-drf:/sys/bus/acpi/acpihp # ls
NODE00 NODE00.IOX01 NODE01 NODE02
linux-drf:/sys/bus/acpi/acpihp # ll
lrwxrwxrwx 1 root root 0 Jul 28 16:03 NODE00 ->
../../../devices/LNXSYSTM:00/acpihp/NODE00
lrwxrwxrwx 1 root root 0 Jul 28 16:03 NODE00.IOX01 ->
../../../devices/LNXSYSTM:00/acpihp/NODE00/IOX01
lrwxrwxrwx 1 root root 0 Jul 28 16:03 NODE01 ->
../../../devices/LNXSYSTM:00/acpihp/NODE01
lrwxrwxrwx 1 root root 0 Jul 28 16:03 NODE02 ->
../../../devices/LNXSYSTM:00/acpihp/NODE02
Jiang Liu (3):
ACPIHP: introduce a framework for ACPI based system device hotplug
ACPIHP: ACPI system device hotplug slot enumerator
ACPIHP: detect ACPI hotplug slots by checking ACPI _EJ0 method
drivers/acpi/Kconfig | 33 ++
drivers/acpi/Makefile | 2 +
drivers/acpi/hotplug/Makefile | 10 +
drivers/acpi/hotplug/core.c | 590 ++++++++++++++++++++++++++++++++++
drivers/acpi/hotplug/slot_enum.c | 469 +++++++++++++++++++++++++++
drivers/acpi/hotplug/slot_enum_ej0.c | 113 +++++++
include/acpi/acpi_hotplug.h | 191 +++++++++++
7 files changed, 1408 insertions(+)
create mode 100644 drivers/acpi/hotplug/Makefile
create mode 100644 drivers/acpi/hotplug/core.c
create mode 100644 drivers/acpi/hotplug/slot_enum.c
create mode 100644 drivers/acpi/hotplug/slot_enum_ej0.c
create mode 100644 include/acpi/acpi_hotplug.h
--
1.7.9.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [RFC PATCH 1/3] ACPIHP: introduce a framework for ACPI based system device hotplug
2012-07-28 11:42 [RFC PATCH 0/3] ACPI based system device hotplug framework Jiang Liu
@ 2012-07-28 11:42 ` Jiang Liu
2012-08-02 7:07 ` Tang Chen
2012-07-28 11:42 ` [RFC PATCH 2/3] ACPIHP: ACPI system device hotplug slot enumerator Jiang Liu
2012-07-28 11:42 ` [RFC PATCH 3/3] ACPIHP: detect ACPI hotplug slots by checking ACPI _EJ0 method Jiang Liu
2 siblings, 1 reply; 10+ messages in thread
From: Jiang Liu @ 2012-07-28 11:42 UTC (permalink / raw)
To: Len Brown, Tony Luck, Bob Moore, Huang Ying, Yinghai Lu,
Yasuaki Ishimatsu, Kenji Kaneshige, Wen Congyang, Taku Izumi
Cc: Jiang Liu, Bjorn Helgaas, Hanjun Guo, linux-kernel, linux-acpi,
linux-pci, Jiang Liu, Gaohuai Han
Modern high-end server may support advanced hotplug features for system
devices, including physical processor, memory board, IO extension board/box
and/or computer node. The ACPI specifications have provided standard
interfaces between firmware and OS to support device hotplug at runtime.
This patch series provide an ACPI based hotplug framework to support system
device hotplug at runtime, which will replace current existing ACPI device
driver based CPU/memory/CONTAINER hotplug mechanism.
An ACPI hotplug slot is an abstraction of receptacles, where a group of
system devices could be connected to. Every ACPI system device hotplug slot
will be associated with a device class named acpihp_slot_class. This device
class provides sysfs interfaces for each slot:
linux-drf:/sys/devices/LNXSYSTM:00/acpihp/NODE00 # ll
-r--r--r-- 1 root root 65536 Jul 28 16:01 capabilities
-r--r--r-- 1 root root 65536 Jul 28 16:01 object
-r--r--r-- 1 root root 65536 Jul 28 16:01 state
-r--r--r-- 1 root root 65536 Jul 28 16:01 status
-r--r--r-- 1 root root 65536 Jul 28 16:01 type
This patch also implements some utility functions to support ACPI hotplug
slot enumerator and ACPI hotplug driver.
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Gaohuai Han <hangaohuai@huawei.com>
---
drivers/acpi/Kconfig | 12 +
drivers/acpi/Makefile | 2 +
drivers/acpi/hotplug/Makefile | 6 +
drivers/acpi/hotplug/core.c | 590 +++++++++++++++++++++++++++++++++++++++++
include/acpi/acpi_hotplug.h | 191 +++++++++++++
5 files changed, 801 insertions(+)
create mode 100644 drivers/acpi/hotplug/Makefile
create mode 100644 drivers/acpi/hotplug/core.c
create mode 100644 include/acpi/acpi_hotplug.h
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 8099895..e457d31 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -321,6 +321,18 @@ config X86_PM_TIMER
You should nearly always say Y here because many modern
systems require this timer.
+menuconfig ACPI_HOTPLUG
+ bool "ACPI Based System Device Hotplug (EXPERIMENTAL)"
+ depends on (X86 || IA64) && SYSFS && EXPERIMENTAL
+ default n
+ help
+ This option enables an framework for ACPI based system devices
+ hotplug, including physical processor, memory device, IO host
+ bridge and/or computer node etc.
+
+ If your hardware and firmware do not support adding or removing
+ of system devices at runtime, you need not to enable this option.
+
config ACPI_CONTAINER
tristate "Container and Module Devices (EXPERIMENTAL)"
depends on EXPERIMENTAL
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 47199e2..17bea6c 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -73,3 +73,5 @@ obj-$(CONFIG_ACPI_PROCESSOR_AGGREGATOR) += acpi_pad.o
obj-$(CONFIG_ACPI_IPMI) += acpi_ipmi.o
obj-$(CONFIG_ACPI_APEI) += apei/
+
+obj-$(CONFIG_ACPI_HOTPLUG) += hotplug/
diff --git a/drivers/acpi/hotplug/Makefile b/drivers/acpi/hotplug/Makefile
new file mode 100644
index 0000000..5e7790f
--- /dev/null
+++ b/drivers/acpi/hotplug/Makefile
@@ -0,0 +1,6 @@
+#
+# Makefile for ACPI based system device hotplug drivers
+#
+
+obj-$(CONFIG_ACPI_HOTPLUG) += acpihp.o
+acpihp-y = core.o
diff --git a/drivers/acpi/hotplug/core.c b/drivers/acpi/hotplug/core.c
new file mode 100644
index 0000000..5b4982a
--- /dev/null
+++ b/drivers/acpi/hotplug/core.c
@@ -0,0 +1,590 @@
+/*
+ * Copyright (C) 2011 Huawei Tech. Co., Ltd.
+ * Copyright (C) 2011 Jiang Liu <jiang.liu@huawei.com>
+ * Copyright (C) 2011 Gaohuai Han <hangaohuai@huawei.com>
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+#include <linux/types.h>
+#include <linux/module.h>
+#include <linux/acpi.h>
+#include <linux/bug.h>
+#include <linux/device.h>
+#include <linux/mutex.h>
+#include <linux/sem.h>
+#include <linux/version.h>
+#include <acpi/acpi.h>
+#include <acpi/acpi_bus.h>
+#include <acpi/acpi_hotplug.h>
+
+#define to_acpihp_slot(d) container_of(d, struct acpihp_slot, dev)
+
+extern struct acpi_device *acpi_root;
+
+static DEFINE_MUTEX(acpihp_mutex);
+static int acpihp_class_count;
+static struct kset *acpihp_slot_kset;
+
+static char *acpihp_slot_names[ACPIHP_SLOT_TYPE_MAX] = {
+ [ACPIHP_SLOT_TYPE_UNKNOWN] = "UNKNOWN",
+ [ACPIHP_SLOT_TYPE_COMMON] = "SLOT",
+ [ACPIHP_SLOT_TYPE_NODE] = "NODE",
+ [ACPIHP_SLOT_TYPE_SYSTEM_BOARD] = "SB",
+ [ACPIHP_SLOT_TYPE_CPU] = "CPU",
+ [ACPIHP_SLOT_TYPE_MEM] = "MEM",
+ [ACPIHP_SLOT_TYPE_IOX] = "IOX",
+};
+
+static char *acpihp_slot_descriptions[ACPIHP_SLOT_TYPE_MAX] = {
+ [ACPIHP_SLOT_TYPE_UNKNOWN] = "unknown slot",
+ [ACPIHP_SLOT_TYPE_COMMON] = "common slot",
+ [ACPIHP_SLOT_TYPE_NODE] = "computer node slot",
+ [ACPIHP_SLOT_TYPE_SYSTEM_BOARD] = "system board slot",
+ [ACPIHP_SLOT_TYPE_CPU] = "processor slot",
+ [ACPIHP_SLOT_TYPE_MEM] = "memory slot",
+ [ACPIHP_SLOT_TYPE_IOX] = "IO extension slot",
+};
+
+static char *acpihp_slot_states[] = {
+ [ACPIHP_SLOT_STATE_UNKNOWN] = "unknown",
+ [ACPIHP_SLOT_STATE_ABSENT] = "absent",
+ [ACPIHP_SLOT_STATE_PRESENT] = "present",
+ [ACPIHP_SLOT_STATE_POWERED] = "powered",
+ [ACPIHP_SLOT_STATE_CONNECTED] = "connected",
+ [ACPIHP_SLOT_STATE_CONFIGURED] = "configured",
+ [ACPIHP_SLOT_STATE_POWERING_ON] = "powering on",
+ [ACPIHP_SLOT_STATE_POWERING_OFF] = "powering off",
+ [ACPIHP_SLOT_STATE_CONNECTING] = "connecting",
+ [ACPIHP_SLOT_STATE_DISCONNECTING] = "disconneting",
+ [ACPIHP_SLOT_STATE_CONFIGURING] = "configuring",
+ [ACPIHP_SLOT_STATE_UNCONFIGURING] = "unconfiguring",
+};
+
+static char *acpihp_slot_status[] = {
+ "ok",
+ "irremovable",
+ "fault",
+ "irremovable, fault",
+};
+
+static char *acpihp_dev_container_ids[] = {
+ "ACPI0004",
+ "PNP0A05",
+ "PNP0A06",
+ NULL
+};
+
+static char *acpihp_dev_cpu_ids[] = {
+ "ACPI0007",
+ "LNXCPU",
+ NULL
+};
+
+static char *acpihp_dev_mem_ids[] = {
+ "PNP0C80",
+ NULL
+};
+
+static char *acpihp_dev_pcihb_ids[] = {
+ "PNP0A03",
+ "PNP0A08",
+ NULL
+};
+
+static char *acpihp_dev_ioapic_ids[] = {
+ "ACPI0009",
+ "ACPI000A",
+ "ACPI000B",
+ NULL
+};
+
+static void acpihp_slot_release(struct device *dev)
+{
+ struct acpihp_slot *slot = to_acpihp_slot(dev);
+
+ if (!list_empty(&slot->slot_list))
+ ACPIHP_ERROR("slot->slot_list is not empty.\n");
+
+ if (!list_empty(&slot->drvdata_list))
+ ACPIHP_ERROR("slot->drvdata_list is not empty.\n");
+
+ if (!list_empty(&slot->slot_id_list))
+ ACPIHP_ERROR("slot->slot_id_list is not empty.\n");
+
+ kfree(slot);
+}
+
+struct acpihp_slot *acpihp_create_slot(acpi_handle handle, char *name)
+{
+ struct acpihp_slot *slot;
+
+ if (name == NULL) {
+ ACPIHP_DEBUG("slot name is NULL.\n");
+ return NULL;
+ } else if (strlen(name) >= ACPIHP_SLOT_NAME_MAX_SIZE) {
+ ACPIHP_WARN("slot name %s is too big.\n", name);
+ return NULL;
+ }
+
+ slot = kzalloc(sizeof(*slot), GFP_KERNEL);
+ if (slot == NULL) {
+ ACPIHP_DEBUG("failed to allocate slot dev.\n");
+ return NULL;
+ }
+
+ slot->handle = handle;
+ INIT_LIST_HEAD(&slot->slot_list);
+ INIT_LIST_HEAD(&slot->drvdata_list);
+ INIT_LIST_HEAD(&slot->slot_id_list);
+ strncpy(slot->name, name, sizeof(slot->name) - 1);
+ mutex_init(&slot->slot_mutex);
+
+ slot->dev.class = &acpihp_slot_class;
+ device_initialize(&slot->dev);
+
+ return slot;
+}
+EXPORT_SYMBOL_GPL(acpihp_create_slot);
+
+static size_t acpihp_generate_link_name(struct acpihp_slot *slot,
+ char *name, size_t off)
+{
+ if (slot->parent)
+ off = acpihp_generate_link_name(slot->parent, name, off);
+ off += snprintf(name + off, PAGE_SIZE - off, "%s.", slot->name);
+ BUG_ON(off >= PAGE_SIZE);
+
+ return off;
+}
+
+int acpihp_register_slot(struct acpihp_slot *slot)
+{
+ int ret;
+ char *name;
+ size_t off;
+
+ if (!slot || !slot->slot_ops)
+ return -EINVAL;
+
+ /* Hook top level hotplug slots under ACPI root device */
+ if (slot->parent)
+ slot->dev.parent = &slot->parent->dev;
+ else
+ slot->dev.parent = &acpi_root->dev;
+
+ ret = device_add(&slot->dev);
+ if (!ret) {
+ slot->flags |= ACPIHP_SLOT_FLAG_REGISTERED;
+ name = kmalloc(PAGE_SIZE, GFP_KERNEL);
+ if (name) {
+ off = acpihp_generate_link_name(slot, name, 0);
+ name[off - 1] = '\0';
+ sysfs_create_link(&acpihp_slot_kset->kobj,
+ &slot->dev.kobj, name);
+ kfree(name);
+ }
+ }
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(acpihp_register_slot);
+
+void acpihp_unregister_slot(struct acpihp_slot *slot)
+{
+ char *name;
+ size_t off;
+
+ if (slot && (slot->flags & ACPIHP_SLOT_FLAG_REGISTERED)) {
+ name = kmalloc(PAGE_SIZE, GFP_KERNEL);
+ if (name) {
+ off = acpihp_generate_link_name(slot, name, 0);
+ name[off - 1] = '\0';
+ sysfs_remove_link(&acpihp_slot_kset->kobj, name);
+ kfree(name);
+ }
+ device_del(&slot->dev);
+ }
+}
+EXPORT_SYMBOL_GPL(acpihp_unregister_slot);
+
+struct acpihp_slot *acpihp_slot_get(struct acpihp_slot *slot)
+{
+ if (slot)
+ get_device(&slot->dev);
+
+ return slot;
+}
+EXPORT_SYMBOL_GPL(acpihp_slot_get);
+
+void acpihp_slot_put(struct acpihp_slot *slot)
+{
+ if (slot)
+ put_device(&slot->dev);
+}
+EXPORT_SYMBOL_GPL(acpihp_slot_put);
+
+static void acpihp_slot_data_handler(acpi_handle handle, void *context)
+{
+ return;
+}
+
+acpi_status acpihp_mark_slot(acpi_handle handle, struct acpihp_slot *slot)
+{
+ acpi_status status;
+
+ mutex_lock(&acpihp_mutex);
+ status = acpi_attach_data(handle, &acpihp_slot_data_handler, slot);
+ mutex_unlock(&acpihp_mutex);
+
+ return status;
+}
+EXPORT_SYMBOL_GPL(acpihp_mark_slot);
+
+acpi_status acpihp_unmark_slot(acpi_handle handle)
+{
+ acpi_status result;
+
+ mutex_lock(&acpihp_mutex);
+ result = acpi_detach_data(handle, &acpihp_slot_data_handler);
+ if (result == AE_NOT_FOUND)
+ result = AE_OK;
+ BUG_ON(result != AE_OK);
+ mutex_unlock(&acpihp_mutex);
+
+ return result;
+}
+EXPORT_SYMBOL_GPL(acpihp_unmark_slot);
+
+bool acpihp_check_slot(acpi_handle handle)
+{
+ acpi_status result;
+ void *data = NULL;
+
+ result = acpi_get_data(handle, &acpihp_slot_data_handler, &data);
+ BUG_ON(result != AE_OK && result != AE_NOT_FOUND);
+
+ return (result == AE_OK);
+}
+EXPORT_SYMBOL_GPL(acpihp_check_slot);
+
+bool acpihp_get_slot(acpi_handle handle, struct acpihp_slot **slot)
+{
+ acpi_status result;
+ void *data = NULL;
+
+ mutex_lock(&acpihp_mutex);
+ result = acpi_get_data(handle, &acpihp_slot_data_handler, &data);
+ if (slot) {
+ if (result == AE_OK) {
+ *slot = data;
+ acpihp_slot_get(*slot);
+ } else
+ *slot = NULL;
+ }
+ mutex_unlock(&acpihp_mutex);
+
+ return (result == AE_OK);
+}
+EXPORT_SYMBOL_GPL(acpihp_get_slot);
+
+bool acpihp_dev_match_ids(struct acpi_device_info *infop, char **ids)
+{
+ int i, j;
+ struct acpica_device_id_list *cid_list;
+
+ if (infop == NULL || ids == NULL) {
+ ACPIHP_DEBUG("invalid parameters.\n");
+ return false;
+ }
+
+ if (infop->valid & ACPI_VALID_HID) {
+ for (i = 0; ids[i]; i++) {
+ if (strncmp(ids[i], infop->hardware_id.string,
+ infop->hardware_id.length) == 0) {
+ return true;
+ }
+ }
+ }
+
+ if (!(infop->valid & ACPI_VALID_CID)) {
+ for (i = 0; ids[i]; i++) {
+ cid_list = &infop->compatible_id_list;
+ for (j = 0; j < cid_list->count; j++) {
+ if (strncmp(ids[i],
+ cid_list->ids[j].string,
+ cid_list->ids[j].length) == 0) {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+}
+EXPORT_SYMBOL_GPL(acpihp_dev_match_ids);
+
+int acpihp_dev_get_type(acpi_handle handle, enum acpihp_dev_type *type)
+{
+ struct acpi_device_info *infop = NULL;
+
+ if (handle == NULL || type == NULL) {
+ ACPIHP_DEBUG("invalid parameters.\n");
+ return -EINVAL;
+ }
+ if (ACPI_FAILURE(acpi_get_object_info(handle, &infop)))
+ return -ENODEV;
+
+ *type = ACPIHP_DEV_TYPE_UNKNOWN;
+ if (infop->type == ACPI_TYPE_PROCESSOR) {
+ *type = ACPIHP_DEV_TYPE_CPU;
+ } else if (infop->type == ACPI_TYPE_DEVICE) {
+ if (acpihp_dev_match_ids(infop, acpihp_dev_container_ids))
+ *type = ACPIHP_DEV_TYPE_CONTAINER;
+ else if (acpihp_dev_match_ids(infop, acpihp_dev_cpu_ids))
+ *type = ACPIHP_DEV_TYPE_CPU;
+ else if (acpihp_dev_match_ids(infop, acpihp_dev_mem_ids))
+ *type = ACPIHP_DEV_TYPE_MEM;
+ else if (acpihp_dev_match_ids(infop, acpihp_dev_pcihb_ids))
+ *type = ACPIHP_DEV_TYPE_HOST_BRIDGE;
+ else if (acpihp_dev_match_ids(infop, acpihp_dev_ioapic_ids))
+ *type = ACPIHP_DEV_TYPE_IOAPIC;
+ }
+ kfree(infop);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(acpihp_dev_get_type);
+
+char *acpihp_get_slot_type_name(enum acpihp_slot_type type)
+{
+ if (type < 0 || type >= ACPIHP_SLOT_TYPE_MAX) {
+ ACPIHP_DEBUG("invalid parameters.\n");
+ return "UNKNOWN";
+ } else {
+ return acpihp_slot_names[type];
+ }
+}
+EXPORT_SYMBOL_GPL(acpihp_get_slot_type_name);
+
+/*
+ * slot_ops should be valid during the life cycle of a slot, so no protection.
+ */
+acpi_status
+acpihp_slot_get_capabilities(struct acpihp_slot *slot, u32 *capability)
+{
+ if (slot == NULL || capability == NULL) {
+ ACPIHP_DEBUG("invalid parameters.\n");
+ return AE_BAD_PARAMETER;
+ } else if (slot->slot_ops == NULL ||
+ slot->slot_ops->get_capabilities == NULL) {
+ ACPIHP_DEBUG("operation not supported.\n");
+ return AE_SUPPORT;
+ }
+
+ return slot->slot_ops->get_capabilities(slot->handle, capability);
+}
+EXPORT_SYMBOL_GPL(acpihp_slot_get_capabilities);
+
+acpi_status acpihp_slot_poweron(struct acpihp_slot *slot)
+{
+ if (slot == NULL) {
+ ACPIHP_DEBUG("invalid parameter.\n");
+ return AE_BAD_PARAMETER;
+ } else if (slot->slot_ops == NULL || slot->slot_ops->poweron == NULL) {
+ ACPIHP_DEBUG("operation not supported.\n");
+ return AE_SUPPORT;
+ }
+
+ return slot->slot_ops->poweron(slot->handle);
+}
+EXPORT_SYMBOL_GPL(acpihp_slot_poweron);
+
+acpi_status acpihp_slot_poweroff(struct acpihp_slot *slot)
+{
+ if (slot == NULL) {
+ ACPIHP_DEBUG("invalid parameter.\n");
+ return AE_BAD_PARAMETER;
+ } else if (slot->slot_ops == NULL || slot->slot_ops->poweroff == NULL) {
+ ACPIHP_DEBUG("operation not supported.\n");
+ return AE_SUPPORT;
+ }
+
+ return slot->slot_ops->poweroff(slot->handle);
+}
+EXPORT_SYMBOL_GPL(acpihp_slot_poweroff);
+
+/* SYSFS interfaces */
+static ssize_t acpihp_slot_object_show(struct device *d,
+ struct device_attribute *attr, char *buf)
+{
+ ssize_t sz;
+ struct acpihp_slot *slot = to_acpihp_slot(d);
+ struct acpi_buffer path = {ACPI_ALLOCATE_BUFFER, NULL};
+
+ sz = acpi_get_name(slot->handle, ACPI_FULL_PATHNAME, &path);
+ if (sz)
+ goto end;
+
+ sz = sprintf(buf, "%s\n", (char*)path.pointer);
+ kfree(path.pointer);
+end:
+ return sz;
+}
+
+static ssize_t acpihp_slot_type_show(struct device *d,
+ struct device_attribute *attr, char *buf)
+{
+ enum acpihp_slot_type type;
+ struct acpihp_slot *slot = to_acpihp_slot(d);
+
+ type = slot->type < 0 || slot->type >= ACPIHP_SLOT_TYPE_MAX ?
+ ACPIHP_SLOT_TYPE_UNKNOWN : slot->type;
+
+ return snprintf(buf, PAGE_SIZE, "%s: %s\n",
+ acpihp_get_slot_type_name(type),
+ acpihp_slot_descriptions[type]);
+}
+
+static ssize_t acpihp_slot_state_show(struct device *d,
+ struct device_attribute *attr, char *buf)
+{
+ enum acpihp_slot_state state;
+ acpi_status status;
+ unsigned long long sta;
+ struct acpihp_slot *slot = to_acpihp_slot(d);
+
+ state = slot->state < 0 || slot->state >= ACPIHP_SLOT_STATE_MAX ?
+ ACPIHP_SLOT_STATE_UNKNOWN : slot->state;
+
+ if ((ACPIHP_SLOT_STATE_ABSENT == state) ||
+ (ACPIHP_SLOT_STATE_PRESENT == state)) {
+ status = acpi_evaluate_integer(slot->handle, "_STA", NULL,
+ &sta);
+ if (ACPI_SUCCESS(status)) {
+ if ((sta & ACPI_STA_DEVICE_PRESENT) ==
+ ACPI_STA_DEVICE_PRESENT)
+ state = ACPIHP_SLOT_STATE_PRESENT;
+ else
+ state = ACPIHP_SLOT_STATE_ABSENT;
+ }
+ }
+
+ return snprintf(buf, PAGE_SIZE, "%s\n", acpihp_slot_states[state]);
+}
+
+static ssize_t acpihp_slot_status_show(struct device *d,
+ struct device_attribute *attr, char *buf)
+{
+ struct acpihp_slot *slot = to_acpihp_slot(d);
+ u32 status = slot->flags & ACPIHP_SLOT_STATUS_MASK;
+
+ return snprintf(buf, PAGE_SIZE, "%s\n", acpihp_slot_status[status]);
+}
+
+static ssize_t acpihp_slot_capabilities_show(struct device *d,
+ struct device_attribute *attr, char *buf)
+{
+ ssize_t sz;
+ struct acpihp_slot *slot = to_acpihp_slot(d);
+ u32 cap = slot->capabilities;
+
+ sz = snprintf(buf, PAGE_SIZE, "%s%s%s%s%s%s",
+ (cap & ACPIHP_SLOT_CAP_ONLINE) ? "online," : "",
+ (cap & ACPIHP_SLOT_CAP_OFFLINE) ? "offline," : "",
+ (cap & ACPIHP_SLOT_CAP_POWERON) ? "poweron," : "",
+ (cap & ACPIHP_SLOT_CAP_POWEROFF) ? "poweroff," : "",
+ (cap & ACPIHP_SLOT_CAP_HOTPLUG) ? "hotplug," : "",
+ (cap & ACPIHP_SLOT_CAP_MIGRATE) ? "migrate," : "");
+ BUG_ON(sz == 0);
+ if (sz)
+ buf[--sz] = '\n';
+
+ return sz + 1;
+}
+
+struct device_attribute acpihp_slot_dev_attrs[] = {
+ __ATTR(object, S_IRUGO, acpihp_slot_object_show, NULL),
+ __ATTR(type, S_IRUGO, acpihp_slot_type_show, NULL),
+ __ATTR(state, S_IRUGO, acpihp_slot_state_show, NULL),
+ __ATTR(status, S_IRUGO, acpihp_slot_status_show, NULL),
+ __ATTR(capabilities, S_IRUGO, acpihp_slot_capabilities_show, NULL),
+ __ATTR_NULL
+};
+
+/*
+ * The device class to support ACPI hotplug slots.
+ * The hotplug slot enumerator should associate all discovered slots with
+ * this class and all hotplug drivers should register onto this class too.
+ */
+struct class acpihp_slot_class = {
+ .name = "acpihp",
+ .dev_release = &acpihp_slot_release,
+ .dev_attrs = acpihp_slot_dev_attrs,
+};
+EXPORT_SYMBOL_GPL(acpihp_slot_class);
+
+int acpihp_register_class(void)
+{
+ int retval = 0;
+ struct kset *acpi_bus_kset;
+
+ mutex_lock(&acpihp_mutex);
+ if (acpihp_class_count == 0) {
+ acpi_bus_kset = bus_get_kset(&acpi_bus_type);
+ acpihp_slot_kset = kset_create_and_add("acpihp", NULL,
+ &acpi_bus_kset->kobj);
+ if (!acpihp_slot_kset) {
+ ACPIHP_WARN("fails to create kset.\n");
+ retval = -ENOMEM;
+ goto out_unlock;
+ }
+
+ retval = class_register(&acpihp_slot_class);
+ if (retval) {
+ ACPIHP_WARN("fails to register acpihp_slot_class.\n");
+ kset_unregister(acpihp_slot_kset);
+ goto out_unlock;
+ }
+ }
+ acpihp_class_count++;
+out_unlock:
+ mutex_unlock(&acpihp_mutex);
+
+ return retval;
+}
+EXPORT_SYMBOL_GPL(acpihp_register_class);
+
+void acpihp_unregister_class(void)
+{
+ mutex_lock(&acpihp_mutex);
+ BUG_ON(acpihp_class_count == 0);
+ --acpihp_class_count;
+ if (acpihp_class_count == 0) {
+ class_unregister(&acpihp_slot_class);
+ kset_unregister(acpihp_slot_kset);
+ acpihp_slot_kset = NULL;
+ }
+ mutex_unlock(&acpihp_mutex);
+}
+EXPORT_SYMBOL_GPL(acpihp_unregister_class);
+
+int acpihp_debug;
+EXPORT_SYMBOL_GPL(acpihp_debug);
+module_param_named(debug, acpihp_debug, int, S_IRUGO | S_IWUSR);
diff --git a/include/acpi/acpi_hotplug.h b/include/acpi/acpi_hotplug.h
new file mode 100644
index 0000000..367e6d7
--- /dev/null
+++ b/include/acpi/acpi_hotplug.h
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 2011 Huawei Tech. Co., Ltd.
+ * Copyright (C) 2011 Jiang Liu <jiang.liu@huawei.com>
+ * Copyright (C) 2011 Gaohuai Han <hangaohuai@huawei.com>
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+#ifndef __ACPI_HOTPLUG_H__
+#define __ACPI_HOTPLUG_H__
+#include <linux/types.h>
+#include <linux/device.h>
+#include <linux/kernel.h>
+#include <linux/kobject.h>
+#include <linux/module.h>
+#include <linux/klist.h>
+#include <acpi/acpi.h>
+#include <acpi/acpi_drivers.h>
+
+#ifdef CONFIG_ACPI_HOTPLUG
+
+#define ACPIHP_SLOT_NAME_MAX_SIZE 16
+
+/* Types of system devices supported by the ACPI hotplug framework. */
+enum acpihp_dev_type {
+ ACPIHP_DEV_TYPE_UNKNOWN = 0, /* Unknown device type */
+ ACPIHP_DEV_TYPE_CONTAINER, /* ACPI container device */
+ ACPIHP_DEV_TYPE_MEM, /* Memory device */
+ ACPIHP_DEV_TYPE_CPU, /* Logical CPU device */
+ ACPIHP_DEV_TYPE_IOAPIC, /* IOAPIC/IOxAPIC/IOSAPIC */
+ ACPIHP_DEV_TYPE_HOST_BRIDGE, /* PCI/PCIe host bridge */
+ ACPIHP_DEV_TYPE_MAX
+};
+
+/*
+ * ACPI hotplug slot is an abstraction of receptacles where a group of
+ * system devices could be attached, just like PCI slot in PCI hotplug.
+ */
+enum acpihp_slot_type {
+ ACPIHP_SLOT_TYPE_UNKNOWN = 0, /* Unknown slot type */
+ ACPIHP_SLOT_TYPE_COMMON, /* Generic hotplug slot */
+ ACPIHP_SLOT_TYPE_NODE, /* Node hosts CPU, memory & IO device */
+ ACPIHP_SLOT_TYPE_SYSTEM_BOARD, /* System board hosts CPU & memory */
+ ACPIHP_SLOT_TYPE_CPU, /* CPU board */
+ ACPIHP_SLOT_TYPE_MEM, /* Memory board */
+ ACPIHP_SLOT_TYPE_IOX, /* IO eXtension board */
+ ACPIHP_SLOT_TYPE_MAX
+};
+
+/*
+ * States of ACPI hotplug slot:
+ * (POWERON) (CONNECT) (CONFIGURE)
+ * [ABSENT] <-> [PRESENT] <-> [POWERED] <-> [CONNECTED] <-> [CONFIGURED]
+ * (POWEROFF) (DISCONNECT) (UNCONFIGURE)
+ */
+enum acpihp_slot_state {
+ ACPIHP_SLOT_STATE_UNKNOWN = 0,
+ ACPIHP_SLOT_STATE_ABSENT, /* slot is empty. */
+ ACPIHP_SLOT_STATE_PRESENT, /* slot is populated. */
+ ACPIHP_SLOT_STATE_POWERED, /* attached devices are powered. */
+ ACPIHP_SLOT_STATE_CONNECTED, /* ACPI device nodes created. */
+ ACPIHP_SLOT_STATE_CONFIGURED, /* attached devices are configured. */
+ ACPIHP_SLOT_STATE_POWERING_ON, /* powering devices on */
+ ACPIHP_SLOT_STATE_POWERING_OFF, /* powering devices off */
+ ACPIHP_SLOT_STATE_CONNECTING, /* creating ACPI device nodes */
+ ACPIHP_SLOT_STATE_DISCONNECTING,/* destroying ACPI device nodes */
+ ACPIHP_SLOT_STATE_CONFIGURING, /* configuring devices */
+ ACPIHP_SLOT_STATE_UNCONFIGURING,/* unconfigure devices */
+ ACPIHP_SLOT_STATE_MAX
+};
+
+#define ACPIHP_SLOT_FLAG_IRREMOVABLE 0x1 /* Attached devices can't be
+ * removed.
+ */
+#define ACPIHP_SLOT_FLAG_FAULT 0x2 /* Attached devices have
+ * encountered serious problem.
+ */
+#define ACPIHP_SLOT_STATUS_MASK 0x3
+#define ACPIHP_SLOT_FLAG_REGISTERED 0x80000000 /* Slot device registered */
+
+/*
+ * ACPI hotplug slot capabilites.
+ */
+#define ACPIHP_SLOT_CAP_ONLINE 0x1 /* Logical online */
+#define ACPIHP_SLOT_CAP_OFFLINE 0x2 /* Logical offline */
+#define ACPIHP_SLOT_CAP_POWERON 0x4 /* Powering on */
+#define ACPIHP_SLOT_CAP_POWEROFF 0x8 /* Powering off */
+#define ACPIHP_SLOT_CAP_HOTPLUG 0x10 /* Physical hotplug */
+#define ACPIHP_SLOT_CAP_MIGRATE 0x20 /* Memory migration */
+
+/*
+ * Callback hooks provided by the platform dependent slot driver for the
+ * platform independent ACPI hotplug driver to manage ACPI hotplug slots.
+ */
+struct acpihp_slot_ops {
+ acpi_status (*init)(void);
+ void (*fini)(void);
+ acpi_status (*check)(acpi_handle handle);
+ acpi_status (*get_capabilities)(acpi_handle handle, u32 *capability);
+ acpi_status (*poweron)(acpi_handle handle);
+ acpi_status (*poweroff)(acpi_handle handle);
+ struct module *owner;
+ char *desc;
+};
+
+/* Device structure for ACPI hotplug slots. */
+struct acpihp_slot {
+ struct device dev;
+ acpi_handle handle;
+ enum acpihp_slot_type type;
+ enum acpihp_slot_state state;
+ u32 flags;
+ u32 capabilities;
+ struct acpihp_slot *parent;
+ struct acpihp_slot_ops *slot_ops;
+ struct mutex slot_mutex;
+ struct list_head slot_list;
+ struct list_head slot_id_list;
+ struct list_head drvdata_list;
+ struct klist dev_lists[ACPIHP_DEV_TYPE_MAX];
+ char name[ACPIHP_SLOT_NAME_MAX_SIZE];
+};
+
+/* Device class for ACPI hotplug slots */
+extern struct class acpihp_slot_class;
+
+/* Register the ACPI hotplug slot class driver */
+extern int acpihp_register_class(void);
+
+/* Unregister the ACPI hotplug slot class driver */
+extern void acpihp_unregister_class(void);
+
+/* Utility routines */
+extern int acpihp_dev_get_type(acpi_handle handle, enum acpihp_dev_type *type);
+extern bool acpihp_dev_match_ids(struct acpi_device_info *infop, char **ids);
+extern char *acpihp_get_slot_type_name(enum acpihp_slot_type type);
+
+/* Mark/unmark an ACPI object as an ACPI hotplug slot. */
+extern acpi_status acpihp_mark_slot(acpi_handle handle,
+ struct acpihp_slot *slot);
+extern acpi_status acpihp_unmark_slot(acpi_handle handle);
+
+/* Check whether the ACPI object is a hotplug slot. */
+extern bool acpihp_check_slot(acpi_handle handle);
+
+/* Interfaces to manage ACPI hotplug slots */
+extern struct acpihp_slot *acpihp_create_slot(acpi_handle handle, char *name);
+extern int acpihp_register_slot(struct acpihp_slot *slot);
+extern void acpihp_unregister_slot(struct acpihp_slot *slot);
+extern struct acpihp_slot *acpihp_slot_get(struct acpihp_slot *slot);
+extern void acpihp_slot_put(struct acpihp_slot *slot);
+extern bool acpihp_get_slot(acpi_handle handle, struct acpihp_slot **slot);
+
+/* Platform dependent hotplug hooks */
+extern acpi_status acpihp_slot_get_capabilities(struct acpihp_slot *slot,
+ u32 *capability);
+extern acpi_status acpihp_slot_poweron(struct acpihp_slot *slot);
+extern acpi_status acpihp_slot_poweroff(struct acpihp_slot *slot);
+
+extern int acpihp_debug;
+
+#define ACPIHP_DEBUG(fmt, ...) \
+ do { \
+ if (acpihp_debug & 0x01) \
+ pr_debug("acpihp@%s:%d: " fmt, \
+ __FILE__, __LINE__, ##__VA_ARGS__); \
+ } while (0)
+
+#define ACPIHP_INFO(fmt, ...) pr_info("acpihp: " fmt, ##__VA_ARGS__)
+#define ACPIHP_WARN(fmt, ...) pr_warn("acpihp: " fmt, ##__VA_ARGS__)
+#define ACPIHP_ERROR(fmt, ...) pr_err("acpihp: " fmt, ##__VA_ARGS__)
+
+#endif /* CONFIG_ACPI_HOTPLUG */
+
+#endif /* __ACPI_HOTPLUG_H__ */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [RFC PATCH 2/3] ACPIHP: ACPI system device hotplug slot enumerator
2012-07-28 11:42 [RFC PATCH 0/3] ACPI based system device hotplug framework Jiang Liu
2012-07-28 11:42 ` [RFC PATCH 1/3] ACPIHP: introduce a framework for ACPI based system device hotplug Jiang Liu
@ 2012-07-28 11:42 ` Jiang Liu
2012-08-03 6:10 ` Taku Izumi
2012-08-04 20:14 ` Yinghai Lu
2012-07-28 11:42 ` [RFC PATCH 3/3] ACPIHP: detect ACPI hotplug slots by checking ACPI _EJ0 method Jiang Liu
2 siblings, 2 replies; 10+ messages in thread
From: Jiang Liu @ 2012-07-28 11:42 UTC (permalink / raw)
To: Len Brown, Tony Luck, Bob Moore, Huang Ying, Yinghai Lu,
Yasuaki Ishimatsu, Kenji Kaneshige, Wen Congyang, Taku Izumi
Cc: Jiang Liu, Bjorn Helgaas, Hanjun Guo, linux-kernel, linux-acpi,
linux-pci, Jiang Liu, Gaohuai Han
The first is an ACPI hotplug slot enumerator, which enumerates ACPI hotplug
slots on load and provides callbacks to manage those hotplug slots.
An ACPI hotplug slot is an abstraction of receptacles, where a group of
system devices could be connected to. This patch implements the skeleton for
ACPI system device hotplug slot enumerator. On loading, the driver scans the
whole ACPI namespace for hotplug slots and creates a device node for each
hotplug slots. Every slot is associated with a device class named
acpihp_slot_class and will be managed by ACPI hotplug drivers.
The hotplug enumerator will create following sysfs entries for hotplug slots:
linux-drf:/sys/devices/LNXSYSTM:00/acpihp # ll
drwxr-xr-x 4 root root 0 Jul 28 16:00 NODE00
drwxr-xr-x 3 root root 0 Jul 28 16:00 NODE01
drwxr-xr-x 3 root root 0 Jul 28 16:00 NODE02
linux-drf:/sys/devices/LNXSYSTM:00/acpihp/NODE00 # ll
drwxr-xr-x 3 root root 0 Jul 28 16:00 IOX01
-r--r--r-- 1 root root 65536 Jul 28 16:01 capabilities
lrwxrwxrwx 1 root root 0 Jul 28 16:00 device -> ../../../LNXSYSTM:00
-r--r--r-- 1 root root 65536 Jul 28 16:01 object
drwxr-xr-x 2 root root 0 Jul 28 16:01 power
-r--r--r-- 1 root root 65536 Jul 28 16:01 state
-r--r--r-- 1 root root 65536 Jul 28 16:01 status
lrwxrwxrwx 1 root root 0 Jul 28 16:00 subsystem -> ../../../../class/acpihp
-r--r--r-- 1 root root 65536 Jul 28 16:01 type
-rw-r--r-- 1 root root 65536 Jul 28 16:01 uevent
linux-drf:/sys/bus/acpi/acpihp # ls
NODE00 NODE00.IOX01 NODE01 NODE02
linux-drf:/sys/bus/acpi/acpihp # ll
lrwxrwxrwx 1 root root 0 Jul 28 16:03 NODE00 ->
../../../devices/LNXSYSTM:00/acpihp/NODE00
lrwxrwxrwx 1 root root 0 Jul 28 16:03 NODE00.IOX01 ->
../../../devices/LNXSYSTM:00/acpihp/NODE00/IOX01
lrwxrwxrwx 1 root root 0 Jul 28 16:03 NODE01 ->
../../../devices/LNXSYSTM:00/acpihp/NODE01
lrwxrwxrwx 1 root root 0 Jul 28 16:03 NODE02 ->
../../../devices/LNXSYSTM:00/acpihp/NODE02
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Gaohuai Han <hangaohuai@huawei.com>
---
drivers/acpi/Kconfig | 11 +
drivers/acpi/hotplug/Makefile | 3 +
drivers/acpi/hotplug/slot_enum.c | 466 ++++++++++++++++++++++++++++++++++++++
3 files changed, 480 insertions(+)
create mode 100644 drivers/acpi/hotplug/slot_enum.c
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index e457d31..711e18e 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -333,6 +333,17 @@ menuconfig ACPI_HOTPLUG
If your hardware and firmware do not support adding or removing
of system devices at runtime, you need not to enable this option.
+config ACPI_HOTPLUG_ENUM
+ tristate "ACPI Hotplug Slot Enumerator"
+ depends on ACPI_HOTPLUG
+ default y
+ help
+ This driver enumerates ACPI hotplug slots for ACPI based system
+ device hotplug.
+
+ To compile this driver as a module, choose M here:
+ the module will be called acpihp_enum.
+
config ACPI_CONTAINER
tristate "Container and Module Devices (EXPERIMENTAL)"
depends on EXPERIMENTAL
diff --git a/drivers/acpi/hotplug/Makefile b/drivers/acpi/hotplug/Makefile
index 5e7790f..41c0da9 100644
--- a/drivers/acpi/hotplug/Makefile
+++ b/drivers/acpi/hotplug/Makefile
@@ -4,3 +4,6 @@
obj-$(CONFIG_ACPI_HOTPLUG) += acpihp.o
acpihp-y = core.o
+
+obj-$(CONFIG_ACPI_HOTPLUG_ENUM) += acpihp_enum.o
+acpihp_enum-y = slot_enum.o
diff --git a/drivers/acpi/hotplug/slot_enum.c b/drivers/acpi/hotplug/slot_enum.c
new file mode 100644
index 0000000..80396a3
--- /dev/null
+++ b/drivers/acpi/hotplug/slot_enum.c
@@ -0,0 +1,466 @@
+/*
+ * Copyright (C) 2011 Huawei Tech. Co., Ltd.
+ * Copyright (C) 2011 Jiang Liu <jiang.liu@huawei.com>
+ * Copyright (C) 2011 Gaohuai Han <hangaohuai@huawei.com>
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/acpi.h>
+#include <acpi/acpi.h>
+#include <acpi/acpi_hotplug.h>
+
+static LIST_HEAD(slot_list);
+static LIST_HEAD(slot_id_list);
+
+struct acpihp_slot_id {
+ struct list_head node;
+ unsigned long instance_id;
+ enum acpihp_slot_type type;
+};
+
+static struct acpihp_slot_ops *slot_ops_curr;
+
+/*
+ * Array of platform specific enumeration methods.
+ * Entries in the array should be sorted by descending priority order.
+ */
+static struct acpihp_slot_ops *slot_ops_array[] = {
+ NULL
+};
+
+static void acpihp_enum_cleanup_slots(void);
+
+static int __init acpihp_get_parent_slot(struct acpihp_slot *slot)
+{
+ acpi_handle handle, root_handle;
+ struct acpihp_slot *tmp;
+
+ slot->parent = NULL;
+ handle = slot->handle;
+ if (ACPI_FAILURE(acpi_get_handle(NULL, ACPI_NS_ROOT_PATH,
+ &root_handle))) {
+ ACPIHP_WARN("fails to get ACPI root device.\n");
+ return -EINVAL;
+ }
+
+ do {
+ if (ACPI_FAILURE(acpi_get_parent(handle, &handle))) {
+ ACPIHP_DEBUG("fails to get parent device handle.\n");
+ return -ENODEV;
+ }
+ list_for_each_entry(tmp, &slot_list, slot_list)
+ if (tmp->handle == handle) {
+ slot->parent = tmp;
+ return 0;
+ }
+ } while (handle != root_handle);
+
+ return 0;
+}
+
+static int __init acpihp_get_slot_state(struct acpihp_slot *slot)
+{
+ unsigned long long sta;
+
+ /* An hotplug slot must implement _STA method. */
+ if (ACPI_FAILURE(acpi_evaluate_integer(slot->handle, METHOD_NAME__STA,
+ NULL, &sta))) {
+ ACPIHP_DEBUG("fails to execute _STA method.\n");
+ return -EINVAL;
+ }
+
+ if (!(sta & ACPI_STA_DEVICE_PRESENT))
+ slot->state = ACPIHP_SLOT_STATE_ABSENT;
+ else if ((sta & ACPI_STA_DEVICE_ENABLED) ||
+ (sta & ACPI_STA_DEVICE_FUNCTIONING))
+ slot->state = ACPIHP_SLOT_STATE_POWERED;
+ else
+ slot->state = ACPIHP_SLOT_STATE_PRESENT;
+
+ return 0;
+}
+
+static int __init acpihp_enum_create_slot(acpi_handle handle)
+{
+ struct acpihp_slot *slot;
+
+ slot = acpihp_create_slot(handle, "TEMP");
+ if (!slot) {
+ ACPIHP_DEBUG("fails to allocate memory for hotplug slot.\n");
+ return -ENOMEM;
+ }
+
+ slot->slot_ops = slot_ops_curr;
+
+ if (acpihp_get_parent_slot(slot))
+ goto out;
+ if (acpihp_get_slot_state(slot))
+ goto out;
+ if (ACPI_FAILURE(acpihp_slot_get_capabilities(slot,
+ &slot->capabilities))) {
+ ACPIHP_DEBUG("fails to get slot capabilities.\n");
+ goto out;
+ }
+ if (ACPI_FAILURE(acpihp_mark_slot(handle, slot))) {
+ ACPIHP_DEBUG("fails to attach slot to ACPI device object.\n");
+ goto out;
+ }
+
+ list_add_tail(&slot->slot_list, &slot_list);
+
+ return 0;
+out:
+ acpihp_slot_put(slot);
+ return -EINVAL;
+}
+
+/*
+ * Scan hotplug slots for ACPI based system device hotplug.
+ * We only care about processor, memory, PCI host bridge and CONTAINER.
+ */
+static acpi_status __init acpihp_enum_scan_slot(acpi_handle handle, u32 lvl,
+ void *context, void **rv)
+{
+ enum acpihp_dev_type type;
+
+ if (acpihp_dev_get_type(handle, &type) ||
+ type == ACPIHP_DEV_TYPE_UNKNOWN)
+ return AE_OK;
+
+ if (ACPI_SUCCESS(slot_ops_curr->check(handle)))
+ acpihp_enum_create_slot(handle);
+
+ /*
+ * Don't scan hotplug slots under PCI host bridges, they should be
+ * handled by acpiphp or pciehp drivers.
+ */
+ if (type == ACPIHP_DEV_TYPE_HOST_BRIDGE)
+ return AE_CTRL_DEPTH;
+
+ return AE_OK;
+}
+
+/*
+ * Get types of child devices connected to this slot.
+ * We only care about CPU, memory, PCI host bridge and CONTAINER here.
+ * Values used here must be in consistence with acpihp_enum_get_slot_type().
+ */
+static acpi_status __init
+acpihp_enum_get_dev_type(acpi_handle handle, u32 lvl, void *context, void **rv)
+{
+ acpi_status status = AE_OK;
+ enum acpihp_dev_type type;
+ u32 *tp = (u32 *)rv;
+
+ if (!acpihp_dev_get_type(handle, &type)) {
+ switch (type) {
+ case ACPIHP_DEV_TYPE_CPU:
+ *tp |= 0x0001;
+ status = AE_CTRL_DEPTH;
+ break;
+ case ACPIHP_DEV_TYPE_MEM:
+ *tp |= 0x0002;
+ status = AE_CTRL_DEPTH;
+ break;
+ case ACPIHP_DEV_TYPE_HOST_BRIDGE:
+ *tp |= 0x0004;
+ status = AE_CTRL_DEPTH;
+ break;
+ case ACPIHP_DEV_TYPE_CONTAINER:
+ *tp |= 0x0008;
+ break;
+ default:
+ break;
+ }
+ }
+
+ return status;
+}
+
+/*
+ * Guess type of a hotplug slot according to child devices connecting to it.
+ */
+static enum acpihp_slot_type __init acpihp_enum_get_slot_type(u32 dev_types)
+{
+ BUG_ON(dev_types > 15);
+
+ switch (dev_types) {
+ case 0:
+ /* Generic CONTAINER */
+ return ACPIHP_SLOT_TYPE_COMMON;
+ case 1:
+ /* Physical processor with logical CPUs */
+ return ACPIHP_SLOT_TYPE_CPU;
+ case 2:
+ /* Memory board/box with memory devices */
+ return ACPIHP_SLOT_TYPE_MEM;
+ case 3:
+ /* Physical processor with CPUs and memory controllers */
+ return ACPIHP_SLOT_TYPE_CPU;
+ case 4:
+ /* IO eXtension board/box with IO host bridges */
+ return ACPIHP_SLOT_TYPE_IOX;
+ case 7:
+ /* Physical processor with CPUs, IO host bridges and MCs. */
+ return ACPIHP_SLOT_TYPE_CPU;
+ case 8:
+ /* Generic CONTAINER */
+ return ACPIHP_SLOT_TYPE_COMMON;
+ case 9:
+ /* System board with physical processors */
+ return ACPIHP_SLOT_TYPE_SYSTEM_BOARD;
+ case 11:
+ /* System board with physical processors and memory */
+ return ACPIHP_SLOT_TYPE_SYSTEM_BOARD;
+ case 15:
+ /* Node with processor, memory and IO host bridge */
+ return ACPIHP_SLOT_TYPE_NODE;
+ default:
+ return ACPIHP_SLOT_TYPE_UNKNOWN;
+ }
+}
+
+/*
+ * Guess type of a hotplug slot according to the device type of the
+ * corresponding ACPI object itself.
+ */
+static enum acpihp_slot_type __init
+acpihp_enum_check_slot_self(struct acpihp_slot *slot)
+{
+ enum acpihp_dev_type type;
+
+ if (acpihp_dev_get_type(slot->handle, &type))
+ return ACPIHP_SLOT_TYPE_UNKNOWN;
+
+ switch (type) {
+ case ACPIHP_DEV_TYPE_CPU:
+ /* Logical CPU used in virtualization environment */
+ return ACPIHP_SLOT_TYPE_CPU;
+ case ACPIHP_DEV_TYPE_MEM:
+ /* Memory board with single memory device */
+ return ACPIHP_SLOT_TYPE_MEM;
+ case ACPIHP_DEV_TYPE_HOST_BRIDGE:
+ /* IO eXtension board/box with single IO host bridge */
+ return ACPIHP_SLOT_TYPE_IOX;
+ default:
+ return ACPIHP_SLOT_TYPE_UNKNOWN;
+ }
+}
+
+static int __init acpihp_enum_generate_slot_name(struct acpihp_slot *slot)
+{
+ int found = 0;
+ struct list_head *list;
+ struct acpihp_slot_id *slot_id;
+ unsigned long long uid;
+
+ /* Respect firmware settings if _UID return an integer. */
+ if (ACPI_SUCCESS(acpi_evaluate_integer(slot->handle, METHOD_NAME__UID,
+ NULL, &uid)))
+ goto set_name;
+
+ if (slot->parent)
+ list = &slot->parent->slot_id_list;
+ else
+ list = &slot_id_list;
+
+ list_for_each_entry(slot_id, list, node)
+ if (slot_id->type == slot->type) {
+ found = 1;
+ break;
+ }
+ if (!found) {
+ slot_id = kzalloc(sizeof(struct acpihp_slot_id), GFP_KERNEL);
+ if (!slot_id) {
+ ACPIHP_DEBUG("fails to allocate slot instance ID.\n");
+ return -ENOMEM;
+ }
+ slot_id->type = slot->type;
+ list_add_tail(&slot_id->node, list);
+ }
+
+ uid = slot_id->instance_id++;
+
+set_name:
+ snprintf(slot->name, sizeof(slot->name) - 1, "%s%02llx",
+ acpihp_get_slot_type_name(slot->type), uid);
+ dev_set_name(&slot->dev, "%s", slot->name);
+
+ return 0;
+}
+
+/*
+ * Generate a meaningful name for the slot according to devices connecting
+ * to this slot
+ */
+static int __init acpihp_enum_rename_slot(struct acpihp_slot *slot)
+{
+ u32 child_types = 0;
+
+ slot->type = acpihp_enum_check_slot_self(slot);
+ if (slot->type == ACPIHP_SLOT_TYPE_UNKNOWN) {
+ acpi_walk_namespace(ACPI_TYPE_DEVICE, slot->handle,
+ ACPI_UINT32_MAX, acpihp_enum_get_dev_type,
+ NULL, NULL, (void **)&child_types);
+ acpi_walk_namespace(ACPI_TYPE_PROCESSOR, slot->handle,
+ ACPI_UINT32_MAX, acpihp_enum_get_dev_type,
+ NULL, NULL, (void **)&child_types);
+ slot->type = acpihp_enum_get_slot_type(child_types);
+ }
+
+ if (acpihp_enum_generate_slot_name(slot))
+ return -EINVAL;
+
+ return 0;
+}
+
+static void __init acpihp_enum_rename_and_register_slots(void)
+{
+ struct acpihp_slot *slot;
+
+ list_for_each_entry(slot, &slot_list, slot_list) {
+ /* generate a meaningful name for this slot */
+ if (acpihp_enum_rename_slot(slot))
+ continue;
+
+ if (acpihp_register_slot(slot))
+ ACPIHP_DEBUG("fails to register slot %s.\n",
+ slot->name);
+ }
+}
+
+static int __init acpihp_enum_generate_slots(void)
+{
+ acpi_status status;
+
+ status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, acpihp_enum_scan_slot,
+ NULL, NULL, NULL);
+ if (!ACPI_SUCCESS(status))
+ goto out_err;
+
+ status = acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, acpihp_enum_scan_slot,
+ NULL, NULL, NULL);
+ if (!ACPI_SUCCESS(status))
+ goto out_err;
+
+ acpihp_enum_rename_and_register_slots();
+
+ return 0;
+
+out_err:
+ ACPIHP_DEBUG("fails to scan hotplug slots.\n");
+ acpihp_enum_cleanup_slots();
+
+ return -ENOTSUPP;
+}
+
+static void acpihp_enum_unregister_slots(void)
+{
+ struct acpihp_slot *slot, *tmp;
+ struct acpihp_slot_id *slot_id, *slot_id_safe;
+
+ list_for_each_entry_safe(slot, tmp, &slot_list, slot_list) {
+ acpihp_unregister_slot(slot);
+ list_del_init(&slot->slot_list);
+ acpihp_unmark_slot(slot->handle);
+ list_for_each_entry_safe(slot_id, slot_id_safe,
+ &slot->slot_id_list, node) {
+ list_del(&slot_id->node);
+ kfree(slot_id);
+ }
+ acpihp_slot_put(slot);
+ }
+}
+
+static void acpihp_enum_cleanup_slots(void)
+{
+ struct acpihp_slot_id *slot_id, *tmp;
+
+ acpihp_enum_unregister_slots();
+ list_for_each_entry_safe(slot_id, tmp, &slot_id_list, node) {
+ list_del(&slot_id->node);
+ kfree(slot_id);
+ }
+}
+
+static int __init acpihp_enum_init(void)
+{
+ int i;
+ int retval;
+
+ /* probe for suitable enumerator. */
+ for (i = 0; slot_ops_array[i]; i++)
+ if (ACPI_SUCCESS(slot_ops_array[i]->init())) {
+ slot_ops_curr = slot_ops_array[i];
+ break;
+ }
+ if (slot_ops_curr == NULL) {
+ ACPIHP_DEBUG("no ACPI hotplug slot found.\n");
+ return -ENXIO;
+ }
+
+ retval = acpihp_register_class();
+ if (retval != 0) {
+ ACPIHP_DEBUG("fails to register ACPI hotplug slot class.\n");
+ goto out_fini;
+ }
+
+ retval = acpihp_enum_generate_slots();
+ if (retval != 0) {
+ ACPIHP_DEBUG("fails to enumerate ACPI hotplug slots.\n");
+ goto out_unregister_class;
+ }
+
+ /* Back out if no ACPI hotplug slot found. */
+ if (list_empty(&slot_list)) {
+ ACPIHP_DEBUG("no ACPI hotplug slot found.\n");
+ retval = -ENODEV;
+ goto out_unregister_class;
+ }
+
+ return 0;
+
+out_unregister_class:
+ acpihp_unregister_class();
+out_fini:
+ slot_ops_curr->fini();
+ ACPIHP_DEBUG("fails to initialize hotplug slot enumerator.\n");
+
+ return retval;
+}
+
+static void __exit acpihp_enum_exit(void)
+{
+ acpihp_enum_cleanup_slots();
+ acpihp_unregister_class();
+ slot_ops_curr->fini();
+}
+
+module_init(acpihp_enum_init);
+module_exit(acpihp_enum_exit);
+
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Jiang Liu <jiang.liu@huawei.com>");
+MODULE_AUTHOR("Gaohuai Han <hangaohuai@huawei.com>");
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [RFC PATCH 3/3] ACPIHP: detect ACPI hotplug slots by checking ACPI _EJ0 method
2012-07-28 11:42 [RFC PATCH 0/3] ACPI based system device hotplug framework Jiang Liu
2012-07-28 11:42 ` [RFC PATCH 1/3] ACPIHP: introduce a framework for ACPI based system device hotplug Jiang Liu
2012-07-28 11:42 ` [RFC PATCH 2/3] ACPIHP: ACPI system device hotplug slot enumerator Jiang Liu
@ 2012-07-28 11:42 ` Jiang Liu
2 siblings, 0 replies; 10+ messages in thread
From: Jiang Liu @ 2012-07-28 11:42 UTC (permalink / raw)
To: Len Brown, Tony Luck, Bob Moore, Huang Ying, Yinghai Lu,
Yasuaki Ishimatsu, Kenji Kaneshige, Wen Congyang, Taku Izumi
Cc: Jiang Liu, Bjorn Helgaas, Hanjun Guo, linux-kernel, linux-acpi,
linux-pci, Gaohuai Han, Jiang Liu
This patch implements a default mechanism to detect and manage ACPI system
device hotplug slots based on standard ACPI interfaces.
1) Detech hotplug slot by checking existence of _EJ0 and _STA methods.
2) Power off a slot by excuting _EJ0 method.
It's the default hotplug slot enumerating mechanism, platform specifc drivers
may provide advanced implementation to override the default implementation.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Gaohuai Han <hangaohuai@huawei.com>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
---
drivers/acpi/Kconfig | 10 +++
drivers/acpi/hotplug/Makefile | 1 +
drivers/acpi/hotplug/slot_enum.c | 3 +
drivers/acpi/hotplug/slot_enum_ej0.c | 113 ++++++++++++++++++++++++++++++++++
4 files changed, 127 insertions(+)
create mode 100644 drivers/acpi/hotplug/slot_enum_ej0.c
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 711e18e..c9f7918 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -344,6 +344,16 @@ config ACPI_HOTPLUG_ENUM
To compile this driver as a module, choose M here:
the module will be called acpihp_enum.
+config ACPI_HOTPLUG_ENUM_EJ0
+ bool "Detecting ACPI Hotplug Slot by Checking _EJ0 Method"
+ depends on ACPI_HOTPLUG_ENUM
+ default y
+ help
+ Enable detecting ACPI hotplug slots by checking ACPI _EJ0 method
+ under ACPI device objects.
+
+ It's the default method to detect ACPI hotplug slots.
+
config ACPI_CONTAINER
tristate "Container and Module Devices (EXPERIMENTAL)"
depends on EXPERIMENTAL
diff --git a/drivers/acpi/hotplug/Makefile b/drivers/acpi/hotplug/Makefile
index 41c0da9..23dfa93 100644
--- a/drivers/acpi/hotplug/Makefile
+++ b/drivers/acpi/hotplug/Makefile
@@ -7,3 +7,4 @@ acpihp-y = core.o
obj-$(CONFIG_ACPI_HOTPLUG_ENUM) += acpihp_enum.o
acpihp_enum-y = slot_enum.o
+acpihp_enum-y += slot_enum_ej0.o
diff --git a/drivers/acpi/hotplug/slot_enum.c b/drivers/acpi/hotplug/slot_enum.c
index 80396a3..a251ecf 100644
--- a/drivers/acpi/hotplug/slot_enum.c
+++ b/drivers/acpi/hotplug/slot_enum.c
@@ -40,11 +40,14 @@ struct acpihp_slot_id {
static struct acpihp_slot_ops *slot_ops_curr;
+extern struct acpihp_slot_ops acpihp_enum_ej0;
+
/*
* Array of platform specific enumeration methods.
* Entries in the array should be sorted by descending priority order.
*/
static struct acpihp_slot_ops *slot_ops_array[] = {
+ &acpihp_enum_ej0,
NULL
};
diff --git a/drivers/acpi/hotplug/slot_enum_ej0.c b/drivers/acpi/hotplug/slot_enum_ej0.c
new file mode 100644
index 0000000..2788860
--- /dev/null
+++ b/drivers/acpi/hotplug/slot_enum_ej0.c
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2011 Huawei Tech. Co., Ltd.
+ * Copyright (C) 2011 Gaohuai Han <hangaohuai@huawei.com>
+ * Copyright (C) 2011 Jiang Liu <jiang.liu@huawei.com>
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+#include <linux/acpi.h>
+#include <acpi/acpi.h>
+#include <acpi/acpi_hotplug.h>
+
+static acpi_status acpihp_enum_ej0_init(void)
+{
+ return AE_OK;
+}
+
+static void acpihp_enum_ej0_fini(void)
+{
+}
+
+static acpi_status acpihp_enum_ej0_check(acpi_handle handle)
+{
+ acpi_handle tmp;
+
+ /* Assume a device object with _EJ0 and _STA has a hotplug slot. */
+ if (ACPI_FAILURE(acpi_get_handle(handle, "_EJ0", &tmp)))
+ return AE_ERROR;
+ if (ACPI_FAILURE(acpi_get_handle(handle, METHOD_NAME__STA, &tmp)))
+ return AE_ERROR;
+
+ return AE_OK;
+}
+
+static acpi_status
+acpihp_enum_ej0_get_capabilities(acpi_handle handle, u32 *capability)
+{
+ /*
+ * Assume device objects with _EJ0 are capable of:
+ * ONLINE, OFFLINE, POWEROFF, HOTPLUG
+ */
+ *capability = ACPIHP_SLOT_CAP_ONLINE | ACPIHP_SLOT_CAP_OFFLINE |
+ ACPIHP_SLOT_CAP_POWEROFF | ACPIHP_SLOT_CAP_HOTPLUG;
+
+ return AE_OK;
+}
+
+static acpi_status acpihp_enum_ej0_poweron(acpi_handle handle)
+{
+ return AE_SUPPORT;
+}
+
+static acpi_status acpihp_enum_ej0_poweroff(acpi_handle handle)
+{
+ acpi_status status;
+ unsigned long long sta;
+ union acpi_object arg;
+ struct acpi_object_list arg_list;
+
+ if (!handle)
+ return AE_BAD_PARAMETER;
+
+ arg_list.count = 1;
+ arg_list.pointer = &arg;
+ arg.type = ACPI_TYPE_INTEGER;
+ arg.integer.value = 1;
+ status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL);
+ if (ACPI_FAILURE(status)) {
+ ACPIHP_WARN("fails to power off object %p.\n", handle);
+ return status;
+ }
+
+ status = acpi_evaluate_integer(handle, METHOD_NAME__STA, NULL, &sta);
+ if (ACPI_FAILURE(status)) {
+ ACPIHP_WARN("fails to evaluate _STA method of object %p\n",
+ handle);
+ return status;
+ }
+
+ if (sta & (ACPI_STA_DEVICE_FUNCTIONING | ACPI_STA_DEVICE_ENABLED)) {
+ ACPIHP_WARN("object %p is still active after executing _EJ0.\n",
+ handle);
+ return AE_ERROR;
+ }
+
+ return AE_OK;
+}
+
+struct acpihp_slot_ops acpihp_enum_ej0 = {
+ .init = acpihp_enum_ej0_init,
+ .fini = acpihp_enum_ej0_fini,
+ .check = acpihp_enum_ej0_check,
+ .get_capabilities = acpihp_enum_ej0_get_capabilities,
+ .poweron = acpihp_enum_ej0_poweron,
+ .poweroff = acpihp_enum_ej0_poweroff,
+ .owner = THIS_MODULE,
+ .desc = "ACPI _EJ0 Based Hotplug Slot Enumerator"
+};
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [RFC PATCH 1/3] ACPIHP: introduce a framework for ACPI based system device hotplug
2012-07-28 11:42 ` [RFC PATCH 1/3] ACPIHP: introduce a framework for ACPI based system device hotplug Jiang Liu
@ 2012-08-02 7:07 ` Tang Chen
2012-08-02 7:07 ` Jiang Liu
0 siblings, 1 reply; 10+ messages in thread
From: Tang Chen @ 2012-08-02 7:07 UTC (permalink / raw)
To: Jiang Liu
Cc: Len Brown, Tony Luck, Bob Moore, Huang Ying, Yinghai Lu,
Yasuaki Ishimatsu, Kenji Kaneshige, Wen Congyang, Taku Izumi,
Jiang Liu, Bjorn Helgaas, Hanjun Guo, linux-kernel, linux-acpi,
linux-pci, Gaohuai Han
Hi,
A little problem here. :)
On 07/28/2012 07:42 PM, Jiang Liu wrote:
> +int acpihp_register_slot(struct acpihp_slot *slot)
> +{
> + int ret;
> + char *name;
> + size_t off;
> +
> + if (!slot || !slot->slot_ops)
> + return -EINVAL;
> +
> + /* Hook top level hotplug slots under ACPI root device */
> + if (slot->parent)
> + slot->dev.parent = &slot->parent->dev;
> + else
> + slot->dev.parent = &acpi_root->dev;
> +
> + ret = device_add(&slot->dev);
> + if (!ret) {
> + slot->flags |= ACPIHP_SLOT_FLAG_REGISTERED;
> + name = kmalloc(PAGE_SIZE, GFP_KERNEL);
> + if (name) {
> + off = acpihp_generate_link_name(slot, name, 0);
> + name[off - 1] = '\0';
> + sysfs_create_link(&acpihp_slot_kset->kobj,
> + &slot->dev.kobj, name);
I got a compiler warning here:
CC drivers/acpi/hotplug/core.o
drivers/acpi/hotplug/core.c: In function ‘acpihp_register_slot’:
drivers/acpi/hotplug/core.c:199: warning: ignoring return value of ‘sysfs_create_link’, declared with attribute warn_unused_result
Seems that we need to check the sysfs_create_link()'s return value here, and if it fails,
shall we at least give a warning message here ?
Thanks. :)
> + kfree(name);
> + }
> + }
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(acpihp_register_slot);
--
Best Regards,
Tang chen
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC PATCH 1/3] ACPIHP: introduce a framework for ACPI based system device hotplug
2012-08-02 7:07 ` Tang Chen
@ 2012-08-02 7:07 ` Jiang Liu
0 siblings, 0 replies; 10+ messages in thread
From: Jiang Liu @ 2012-08-02 7:07 UTC (permalink / raw)
To: Tang Chen
Cc: Jiang Liu, Len Brown, Tony Luck, Bob Moore, Huang Ying,
Yinghai Lu, Yasuaki Ishimatsu, Kenji Kaneshige, Wen Congyang,
Taku Izumi, Bjorn Helgaas, Hanjun Guo, linux-kernel, linux-acpi,
linux-pci, Gaohuai Han
On 2012-8-2 15:07, Tang Chen wrote:
> Hi,
>
> A little problem here. :)
>
> On 07/28/2012 07:42 PM, Jiang Liu wrote:
>> +int acpihp_register_slot(struct acpihp_slot *slot)
>> +{
>> + int ret;
>> + char *name;
>> + size_t off;
>> +
>> + if (!slot || !slot->slot_ops)
>> + return -EINVAL;
>> +
>> + /* Hook top level hotplug slots under ACPI root device */
>> + if (slot->parent)
>> + slot->dev.parent = &slot->parent->dev;
>> + else
>> + slot->dev.parent = &acpi_root->dev;
>> +
>> + ret = device_add(&slot->dev);
>> + if (!ret) {
>> + slot->flags |= ACPIHP_SLOT_FLAG_REGISTERED;
>> + name = kmalloc(PAGE_SIZE, GFP_KERNEL);
>> + if (name) {
>> + off = acpihp_generate_link_name(slot, name, 0);
>> + name[off - 1] = '\0';
>> + sysfs_create_link(&acpihp_slot_kset->kobj,
>> + &slot->dev.kobj, name);
>
> I got a compiler warning here:
> CC drivers/acpi/hotplug/core.o
> drivers/acpi/hotplug/core.c: In function ‘acpihp_register_slot’:
> drivers/acpi/hotplug/core.c:199: warning: ignoring return value of ‘sysfs_create_link’, declared with attribute warn_unused_result
>
> Seems that we need to check the sysfs_create_link()'s return value here, and if it fails,
> shall we at least give a warning message here ?
>
> Thanks. :)
Hi Tang,
Thanks for your comments, will fix it in next version.
Regards!
Gerry
>
>
>> + kfree(name);
>> + }
>> + }
>> +
>> + return ret;
>> +}
>> +EXPORT_SYMBOL_GPL(acpihp_register_slot);
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC PATCH 2/3] ACPIHP: ACPI system device hotplug slot enumerator
2012-07-28 11:42 ` [RFC PATCH 2/3] ACPIHP: ACPI system device hotplug slot enumerator Jiang Liu
@ 2012-08-03 6:10 ` Taku Izumi
2012-08-04 9:40 ` Jiang Liu
2012-08-04 20:14 ` Yinghai Lu
1 sibling, 1 reply; 10+ messages in thread
From: Taku Izumi @ 2012-08-03 6:10 UTC (permalink / raw)
To: Jiang Liu
Cc: Len Brown, Tony Luck, Bob Moore, Huang Ying, Yinghai Lu,
Yasuaki Ishimatsu, Kenji Kaneshige, Wen Congyang, Jiang Liu,
Bjorn Helgaas, Hanjun Guo, linux-kernel, linux-acpi, linux-pci,
Gaohuai Han
On Sat, 28 Jul 2012 19:42:51 +0800
Jiang Liu <liuj97@gmail.com> wrote:
> The first is an ACPI hotplug slot enumerator, which enumerates ACPI hotplug
> slots on load and provides callbacks to manage those hotplug slots.
> An ACPI hotplug slot is an abstraction of receptacles, where a group of
> system devices could be connected to. This patch implements the skeleton for
> ACPI system device hotplug slot enumerator. On loading, the driver scans the
> whole ACPI namespace for hotplug slots and creates a device node for each
> hotplug slots. Every slot is associated with a device class named
> acpihp_slot_class and will be managed by ACPI hotplug drivers.
>
> The hotplug enumerator will create following sysfs entries for hotplug slots:
>
> linux-drf:/sys/devices/LNXSYSTM:00/acpihp # ll
> drwxr-xr-x 4 root root 0 Jul 28 16:00 NODE00
> drwxr-xr-x 3 root root 0 Jul 28 16:00 NODE01
> drwxr-xr-x 3 root root 0 Jul 28 16:00 NODE02
>
> linux-drf:/sys/devices/LNXSYSTM:00/acpihp/NODE00 # ll
> drwxr-xr-x 3 root root 0 Jul 28 16:00 IOX01
> -r--r--r-- 1 root root 65536 Jul 28 16:01 capabilities
> lrwxrwxrwx 1 root root 0 Jul 28 16:00 device -> ../../../LNXSYSTM:00
> -r--r--r-- 1 root root 65536 Jul 28 16:01 object
> drwxr-xr-x 2 root root 0 Jul 28 16:01 power
> -r--r--r-- 1 root root 65536 Jul 28 16:01 state
> -r--r--r-- 1 root root 65536 Jul 28 16:01 status
> lrwxrwxrwx 1 root root 0 Jul 28 16:00 subsystem -> ../../../../class/acpihp
> -r--r--r-- 1 root root 65536 Jul 28 16:01 type
> -rw-r--r-- 1 root root 65536 Jul 28 16:01 uevent
>
> linux-drf:/sys/bus/acpi/acpihp # ls
> NODE00 NODE00.IOX01 NODE01 NODE02
>
> linux-drf:/sys/bus/acpi/acpihp # ll
> lrwxrwxrwx 1 root root 0 Jul 28 16:03 NODE00 ->
> ../../../devices/LNXSYSTM:00/acpihp/NODE00
> lrwxrwxrwx 1 root root 0 Jul 28 16:03 NODE00.IOX01 ->
> ../../../devices/LNXSYSTM:00/acpihp/NODE00/IOX01
> lrwxrwxrwx 1 root root 0 Jul 28 16:03 NODE01 ->
> ../../../devices/LNXSYSTM:00/acpihp/NODE01
> lrwxrwxrwx 1 root root 0 Jul 28 16:03 NODE02 ->
> ../../../devices/LNXSYSTM:00/acpihp/NODE02
>
> Signed-off-by: Jiang Liu <liuj97@gmail.com>
> Signed-off-by: Gaohuai Han <hangaohuai@huawei.com>
> ---
> drivers/acpi/Kconfig | 11 +
> drivers/acpi/hotplug/Makefile | 3 +
> drivers/acpi/hotplug/slot_enum.c | 466 ++++++++++++++++++++++++++++++++++++++
> 3 files changed, 480 insertions(+)
> create mode 100644 drivers/acpi/hotplug/slot_enum.c
>
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index e457d31..711e18e 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -333,6 +333,17 @@ menuconfig ACPI_HOTPLUG
> If your hardware and firmware do not support adding or removing
> of system devices at runtime, you need not to enable this option.
>
> +config ACPI_HOTPLUG_ENUM
> + tristate "ACPI Hotplug Slot Enumerator"
> + depends on ACPI_HOTPLUG
> + default y
> + help
> + This driver enumerates ACPI hotplug slots for ACPI based system
> + device hotplug.
> +
> + To compile this driver as a module, choose M here:
> + the module will be called acpihp_enum.
> +
> config ACPI_CONTAINER
> tristate "Container and Module Devices (EXPERIMENTAL)"
> depends on EXPERIMENTAL
> diff --git a/drivers/acpi/hotplug/Makefile b/drivers/acpi/hotplug/Makefile
> index 5e7790f..41c0da9 100644
> --- a/drivers/acpi/hotplug/Makefile
> +++ b/drivers/acpi/hotplug/Makefile
> @@ -4,3 +4,6 @@
>
> obj-$(CONFIG_ACPI_HOTPLUG) += acpihp.o
> acpihp-y = core.o
> +
> +obj-$(CONFIG_ACPI_HOTPLUG_ENUM) += acpihp_enum.o
> +acpihp_enum-y = slot_enum.o
> diff --git a/drivers/acpi/hotplug/slot_enum.c b/drivers/acpi/hotplug/slot_enum.c
> new file mode 100644
> index 0000000..80396a3
> --- /dev/null
> +++ b/drivers/acpi/hotplug/slot_enum.c
> @@ -0,0 +1,466 @@
> +/*
> + * Copyright (C) 2011 Huawei Tech. Co., Ltd.
> + * Copyright (C) 2011 Jiang Liu <jiang.liu@huawei.com>
> + * Copyright (C) 2011 Gaohuai Han <hangaohuai@huawei.com>
> + *
> + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> + *
> + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> + */
> +
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/acpi.h>
> +#include <acpi/acpi.h>
> +#include <acpi/acpi_hotplug.h>
> +
> +static LIST_HEAD(slot_list);
> +static LIST_HEAD(slot_id_list);
> +
> +struct acpihp_slot_id {
> + struct list_head node;
> + unsigned long instance_id;
> + enum acpihp_slot_type type;
> +};
> +
> +static struct acpihp_slot_ops *slot_ops_curr;
> +
> +/*
> + * Array of platform specific enumeration methods.
> + * Entries in the array should be sorted by descending priority order.
> + */
> +static struct acpihp_slot_ops *slot_ops_array[] = {
> + NULL
> +};
> +
> +static void acpihp_enum_cleanup_slots(void);
> +
> +static int __init acpihp_get_parent_slot(struct acpihp_slot *slot)
> +{
> + acpi_handle handle, root_handle;
> + struct acpihp_slot *tmp;
> +
> + slot->parent = NULL;
> + handle = slot->handle;
> + if (ACPI_FAILURE(acpi_get_handle(NULL, ACPI_NS_ROOT_PATH,
> + &root_handle))) {
> + ACPIHP_WARN("fails to get ACPI root device.\n");
> + return -EINVAL;
> + }
> +
> + do {
> + if (ACPI_FAILURE(acpi_get_parent(handle, &handle))) {
> + ACPIHP_DEBUG("fails to get parent device handle.\n");
> + return -ENODEV;
> + }
> + list_for_each_entry(tmp, &slot_list, slot_list)
> + if (tmp->handle == handle) {
> + slot->parent = tmp;
> + return 0;
> + }
> + } while (handle != root_handle);
> +
> + return 0;
> +}
> +
> +static int __init acpihp_get_slot_state(struct acpihp_slot *slot)
> +{
> + unsigned long long sta;
> +
> + /* An hotplug slot must implement _STA method. */
> + if (ACPI_FAILURE(acpi_evaluate_integer(slot->handle, METHOD_NAME__STA,
> + NULL, &sta))) {
> + ACPIHP_DEBUG("fails to execute _STA method.\n");
> + return -EINVAL;
> + }
> +
> + if (!(sta & ACPI_STA_DEVICE_PRESENT))
> + slot->state = ACPIHP_SLOT_STATE_ABSENT;
> + else if ((sta & ACPI_STA_DEVICE_ENABLED) ||
> + (sta & ACPI_STA_DEVICE_FUNCTIONING))
> + slot->state = ACPIHP_SLOT_STATE_POWERED;
> + else
> + slot->state = ACPIHP_SLOT_STATE_PRESENT;
> +
> + return 0;
> +}
> +
> +static int __init acpihp_enum_create_slot(acpi_handle handle)
> +{
> + struct acpihp_slot *slot;
> +
> + slot = acpihp_create_slot(handle, "TEMP");
> + if (!slot) {
> + ACPIHP_DEBUG("fails to allocate memory for hotplug slot.\n");
> + return -ENOMEM;
> + }
> +
> + slot->slot_ops = slot_ops_curr;
> +
> + if (acpihp_get_parent_slot(slot))
> + goto out;
> + if (acpihp_get_slot_state(slot))
> + goto out;
> + if (ACPI_FAILURE(acpihp_slot_get_capabilities(slot,
> + &slot->capabilities))) {
> + ACPIHP_DEBUG("fails to get slot capabilities.\n");
> + goto out;
> + }
> + if (ACPI_FAILURE(acpihp_mark_slot(handle, slot))) {
> + ACPIHP_DEBUG("fails to attach slot to ACPI device object.\n");
> + goto out;
> + }
> +
> + list_add_tail(&slot->slot_list, &slot_list);
> +
> + return 0;
> +out:
> + acpihp_slot_put(slot);
> + return -EINVAL;
> +}
> +
> +/*
> + * Scan hotplug slots for ACPI based system device hotplug.
> + * We only care about processor, memory, PCI host bridge and CONTAINER.
> + */
> +static acpi_status __init acpihp_enum_scan_slot(acpi_handle handle, u32 lvl,
> + void *context, void **rv)
> +{
> + enum acpihp_dev_type type;
> +
> + if (acpihp_dev_get_type(handle, &type) ||
> + type == ACPIHP_DEV_TYPE_UNKNOWN)
> + return AE_OK;
> +
> + if (ACPI_SUCCESS(slot_ops_curr->check(handle)))
> + acpihp_enum_create_slot(handle);
> +
> + /*
> + * Don't scan hotplug slots under PCI host bridges, they should be
> + * handled by acpiphp or pciehp drivers.
> + */
> + if (type == ACPIHP_DEV_TYPE_HOST_BRIDGE)
> + return AE_CTRL_DEPTH;
> +
> + return AE_OK;
> +}
> +
> +/*
> + * Get types of child devices connected to this slot.
> + * We only care about CPU, memory, PCI host bridge and CONTAINER here.
> + * Values used here must be in consistence with acpihp_enum_get_slot_type().
> + */
> +static acpi_status __init
> +acpihp_enum_get_dev_type(acpi_handle handle, u32 lvl, void *context, void **rv)
> +{
> + acpi_status status = AE_OK;
> + enum acpihp_dev_type type;
> + u32 *tp = (u32 *)rv;
> +
> + if (!acpihp_dev_get_type(handle, &type)) {
> + switch (type) {
> + case ACPIHP_DEV_TYPE_CPU:
> + *tp |= 0x0001;
> + status = AE_CTRL_DEPTH;
> + break;
> + case ACPIHP_DEV_TYPE_MEM:
> + *tp |= 0x0002;
> + status = AE_CTRL_DEPTH;
> + break;
> + case ACPIHP_DEV_TYPE_HOST_BRIDGE:
> + *tp |= 0x0004;
> + status = AE_CTRL_DEPTH;
> + break;
> + case ACPIHP_DEV_TYPE_CONTAINER:
> + *tp |= 0x0008;
> + break;
> + default:
> + break;
> + }
> + }
> +
> + return status;
> +}
> +
> +/*
> + * Guess type of a hotplug slot according to child devices connecting to it.
> + */
> +static enum acpihp_slot_type __init acpihp_enum_get_slot_type(u32 dev_types)
> +{
> + BUG_ON(dev_types > 15);
> +
> + switch (dev_types) {
> + case 0:
> + /* Generic CONTAINER */
> + return ACPIHP_SLOT_TYPE_COMMON;
> + case 1:
> + /* Physical processor with logical CPUs */
> + return ACPIHP_SLOT_TYPE_CPU;
> + case 2:
> + /* Memory board/box with memory devices */
> + return ACPIHP_SLOT_TYPE_MEM;
> + case 3:
> + /* Physical processor with CPUs and memory controllers */
> + return ACPIHP_SLOT_TYPE_CPU;
> + case 4:
> + /* IO eXtension board/box with IO host bridges */
> + return ACPIHP_SLOT_TYPE_IOX;
> + case 7:
> + /* Physical processor with CPUs, IO host bridges and MCs. */
> + return ACPIHP_SLOT_TYPE_CPU;
Why is this case ACPIHP_SLOT_TYPE_CPU?
I think this case is ACPIHP_SLOT_TYPE_COMMON or else.
By the way how about simplifying slot type category?
Do we need to differentiate case7, 8, 9, 11 and 15?
Best regards,
Taku Izumi
> + case 8:
> + /* Generic CONTAINER */
> + return ACPIHP_SLOT_TYPE_COMMON;
> + case 9:
> + /* System board with physical processors */
> + return ACPIHP_SLOT_TYPE_SYSTEM_BOARD;
> + case 11:
> + /* System board with physical processors and memory */
> + return ACPIHP_SLOT_TYPE_SYSTEM_BOARD;
> + case 15:
> + /* Node with processor, memory and IO host bridge */
> + return ACPIHP_SLOT_TYPE_NODE;
> + default:
> + return ACPIHP_SLOT_TYPE_UNKNOWN;
> + }
> +}
> +
> +/*
> + * Guess type of a hotplug slot according to the device type of the
> + * corresponding ACPI object itself.
> + */
> +static enum acpihp_slot_type __init
> +acpihp_enum_check_slot_self(struct acpihp_slot *slot)
> +{
> + enum acpihp_dev_type type;
> +
> + if (acpihp_dev_get_type(slot->handle, &type))
> + return ACPIHP_SLOT_TYPE_UNKNOWN;
> +
> + switch (type) {
> + case ACPIHP_DEV_TYPE_CPU:
> + /* Logical CPU used in virtualization environment */
> + return ACPIHP_SLOT_TYPE_CPU;
> + case ACPIHP_DEV_TYPE_MEM:
> + /* Memory board with single memory device */
> + return ACPIHP_SLOT_TYPE_MEM;
> + case ACPIHP_DEV_TYPE_HOST_BRIDGE:
> + /* IO eXtension board/box with single IO host bridge */
> + return ACPIHP_SLOT_TYPE_IOX;
> + default:
> + return ACPIHP_SLOT_TYPE_UNKNOWN;
> + }
> +}
> +
> +static int __init acpihp_enum_generate_slot_name(struct acpihp_slot *slot)
> +{
> + int found = 0;
> + struct list_head *list;
> + struct acpihp_slot_id *slot_id;
> + unsigned long long uid;
> +
> + /* Respect firmware settings if _UID return an integer. */
> + if (ACPI_SUCCESS(acpi_evaluate_integer(slot->handle, METHOD_NAME__UID,
> + NULL, &uid)))
> + goto set_name;
> +
> + if (slot->parent)
> + list = &slot->parent->slot_id_list;
> + else
> + list = &slot_id_list;
> +
> + list_for_each_entry(slot_id, list, node)
> + if (slot_id->type == slot->type) {
> + found = 1;
> + break;
> + }
> + if (!found) {
> + slot_id = kzalloc(sizeof(struct acpihp_slot_id), GFP_KERNEL);
> + if (!slot_id) {
> + ACPIHP_DEBUG("fails to allocate slot instance ID.\n");
> + return -ENOMEM;
> + }
> + slot_id->type = slot->type;
> + list_add_tail(&slot_id->node, list);
> + }
> +
> + uid = slot_id->instance_id++;
> +
> +set_name:
> + snprintf(slot->name, sizeof(slot->name) - 1, "%s%02llx",
> + acpihp_get_slot_type_name(slot->type), uid);
> + dev_set_name(&slot->dev, "%s", slot->name);
> +
> + return 0;
> +}
> +
> +/*
> + * Generate a meaningful name for the slot according to devices connecting
> + * to this slot
> + */
> +static int __init acpihp_enum_rename_slot(struct acpihp_slot *slot)
> +{
> + u32 child_types = 0;
> +
> + slot->type = acpihp_enum_check_slot_self(slot);
> + if (slot->type == ACPIHP_SLOT_TYPE_UNKNOWN) {
> + acpi_walk_namespace(ACPI_TYPE_DEVICE, slot->handle,
> + ACPI_UINT32_MAX, acpihp_enum_get_dev_type,
> + NULL, NULL, (void **)&child_types);
> + acpi_walk_namespace(ACPI_TYPE_PROCESSOR, slot->handle,
> + ACPI_UINT32_MAX, acpihp_enum_get_dev_type,
> + NULL, NULL, (void **)&child_types);
> + slot->type = acpihp_enum_get_slot_type(child_types);
> + }
> +
> + if (acpihp_enum_generate_slot_name(slot))
> + return -EINVAL;
> +
> + return 0;
> +}
> +
> +static void __init acpihp_enum_rename_and_register_slots(void)
> +{
> + struct acpihp_slot *slot;
> +
> + list_for_each_entry(slot, &slot_list, slot_list) {
> + /* generate a meaningful name for this slot */
> + if (acpihp_enum_rename_slot(slot))
> + continue;
> +
> + if (acpihp_register_slot(slot))
> + ACPIHP_DEBUG("fails to register slot %s.\n",
> + slot->name);
> + }
> +}
> +
> +static int __init acpihp_enum_generate_slots(void)
> +{
> + acpi_status status;
> +
> + status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
> + ACPI_UINT32_MAX, acpihp_enum_scan_slot,
> + NULL, NULL, NULL);
> + if (!ACPI_SUCCESS(status))
> + goto out_err;
> +
> + status = acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
> + ACPI_UINT32_MAX, acpihp_enum_scan_slot,
> + NULL, NULL, NULL);
> + if (!ACPI_SUCCESS(status))
> + goto out_err;
> +
> + acpihp_enum_rename_and_register_slots();
> +
> + return 0;
> +
> +out_err:
> + ACPIHP_DEBUG("fails to scan hotplug slots.\n");
> + acpihp_enum_cleanup_slots();
> +
> + return -ENOTSUPP;
> +}
> +
> +static void acpihp_enum_unregister_slots(void)
> +{
> + struct acpihp_slot *slot, *tmp;
> + struct acpihp_slot_id *slot_id, *slot_id_safe;
> +
> + list_for_each_entry_safe(slot, tmp, &slot_list, slot_list) {
> + acpihp_unregister_slot(slot);
> + list_del_init(&slot->slot_list);
> + acpihp_unmark_slot(slot->handle);
> + list_for_each_entry_safe(slot_id, slot_id_safe,
> + &slot->slot_id_list, node) {
> + list_del(&slot_id->node);
> + kfree(slot_id);
> + }
> + acpihp_slot_put(slot);
> + }
> +}
> +
> +static void acpihp_enum_cleanup_slots(void)
> +{
> + struct acpihp_slot_id *slot_id, *tmp;
> +
> + acpihp_enum_unregister_slots();
> + list_for_each_entry_safe(slot_id, tmp, &slot_id_list, node) {
> + list_del(&slot_id->node);
> + kfree(slot_id);
> + }
> +}
> +
> +static int __init acpihp_enum_init(void)
> +{
> + int i;
> + int retval;
> +
> + /* probe for suitable enumerator. */
> + for (i = 0; slot_ops_array[i]; i++)
> + if (ACPI_SUCCESS(slot_ops_array[i]->init())) {
> + slot_ops_curr = slot_ops_array[i];
> + break;
> + }
> + if (slot_ops_curr == NULL) {
> + ACPIHP_DEBUG("no ACPI hotplug slot found.\n");
> + return -ENXIO;
> + }
> +
> + retval = acpihp_register_class();
> + if (retval != 0) {
> + ACPIHP_DEBUG("fails to register ACPI hotplug slot class.\n");
> + goto out_fini;
> + }
> +
> + retval = acpihp_enum_generate_slots();
> + if (retval != 0) {
> + ACPIHP_DEBUG("fails to enumerate ACPI hotplug slots.\n");
> + goto out_unregister_class;
> + }
> +
> + /* Back out if no ACPI hotplug slot found. */
> + if (list_empty(&slot_list)) {
> + ACPIHP_DEBUG("no ACPI hotplug slot found.\n");
> + retval = -ENODEV;
> + goto out_unregister_class;
> + }
> +
> + return 0;
> +
> +out_unregister_class:
> + acpihp_unregister_class();
> +out_fini:
> + slot_ops_curr->fini();
> + ACPIHP_DEBUG("fails to initialize hotplug slot enumerator.\n");
> +
> + return retval;
> +}
> +
> +static void __exit acpihp_enum_exit(void)
> +{
> + acpihp_enum_cleanup_slots();
> + acpihp_unregister_class();
> + slot_ops_curr->fini();
> +}
> +
> +module_init(acpihp_enum_init);
> +module_exit(acpihp_enum_exit);
> +
> +MODULE_LICENSE("GPL v2");
> +MODULE_AUTHOR("Jiang Liu <jiang.liu@huawei.com>");
> +MODULE_AUTHOR("Gaohuai Han <hangaohuai@huawei.com>");
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
Taku Izumi <izumi.taku@jp.fujitsu.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC PATCH 2/3] ACPIHP: ACPI system device hotplug slot enumerator
2012-08-03 6:10 ` Taku Izumi
@ 2012-08-04 9:40 ` Jiang Liu
0 siblings, 0 replies; 10+ messages in thread
From: Jiang Liu @ 2012-08-04 9:40 UTC (permalink / raw)
To: Taku Izumi
Cc: Len Brown, Tony Luck, Bob Moore, Huang Ying, Yinghai Lu,
Yasuaki Ishimatsu, Kenji Kaneshige, Wen Congyang, Jiang Liu,
Bjorn Helgaas, Hanjun Guo, linux-kernel, linux-acpi, linux-pci,
Gaohuai Han
>> +/*
>> + * Guess type of a hotplug slot according to child devices connecting to it.
>> + */
>> +static enum acpihp_slot_type __init acpihp_enum_get_slot_type(u32 dev_types)
>> +{
>> + BUG_ON(dev_types > 15);
>> +
>> + switch (dev_types) {
>> + case 0:
>> + /* Generic CONTAINER */
>> + return ACPIHP_SLOT_TYPE_COMMON;
>> + case 1:
>> + /* Physical processor with logical CPUs */
>> + return ACPIHP_SLOT_TYPE_CPU;
>> + case 2:
>> + /* Memory board/box with memory devices */
>> + return ACPIHP_SLOT_TYPE_MEM;
>> + case 3:
>> + /* Physical processor with CPUs and memory controllers */
>> + return ACPIHP_SLOT_TYPE_CPU;
>> + case 4:
>> + /* IO eXtension board/box with IO host bridges */
>> + return ACPIHP_SLOT_TYPE_IOX;
>> + case 7:
>> + /* Physical processor with CPUs, IO host bridges and MCs. */
>> + return ACPIHP_SLOT_TYPE_CPU;
>
>
> Why is this case ACPIHP_SLOT_TYPE_CPU?
> I think this case is ACPIHP_SLOT_TYPE_COMMON or else.
> By the way how about simplifying slot type category?
> Do we need to differentiate case7, 8, 9, 11 and 15?
Hi Izumi,
Thanks for your comments!
The 'case 7' is for the typical case of Intel next generation processors with
embedded memory controllers and IOH. It's reasonable to treat 9, 10, 15 in the same way
because I have encountered a system board with only CPU and memory in x86/IA64 world.
For "case 8", I have no idea about what's the most suitable way to deal with it because
I haven't seen a ACPI implementation exhibits such a namespace structure yet.
Actually we have strong dependency on firmware implementation to generate a
meaningful name for each hotplug slot.
>
> Best regards,
> Taku Izumi
>
>
>> + case 8:
>> + /* Generic CONTAINER */
>> + return ACPIHP_SLOT_TYPE_COMMON;
>> + case 9:
>> + /* System board with physical processors */
>> + return ACPIHP_SLOT_TYPE_SYSTEM_BOARD;
>> + case 11:
>> + /* System board with physical processors and memory */
>> + return ACPIHP_SLOT_TYPE_SYSTEM_BOARD;
>> + case 15:
>> + /* Node with processor, memory and IO host bridge */
>> + return ACPIHP_SLOT_TYPE_NODE;
>> + default:
>> + return ACPIHP_SLOT_TYPE_UNKNOWN;
>> + }
>> +}
>> +
>> +/*
>> + * Guess type of a hotplug slot according to the device type of the
>> + * corresponding ACPI object itself.
>> + */
>> +static enum acpihp_slot_type __init
>> +acpihp_enum_check_slot_self(struct acpihp_slot *slot)
>> +{
>> + enum acpihp_dev_type type;
>> +
>> + if (acpihp_dev_get_type(slot->handle, &type))
>> + return ACPIHP_SLOT_TYPE_UNKNOWN;
>> +
>> + switch (type) {
>> + case ACPIHP_DEV_TYPE_CPU:
>> + /* Logical CPU used in virtualization environment */
>> + return ACPIHP_SLOT_TYPE_CPU;
>> + case ACPIHP_DEV_TYPE_MEM:
>> + /* Memory board with single memory device */
>> + return ACPIHP_SLOT_TYPE_MEM;
>> + case ACPIHP_DEV_TYPE_HOST_BRIDGE:
>> + /* IO eXtension board/box with single IO host bridge */
>> + return ACPIHP_SLOT_TYPE_IOX;
>> + default:
>> + return ACPIHP_SLOT_TYPE_UNKNOWN;
>> + }
>> +}
>> +
>> +static int __init acpihp_enum_generate_slot_name(struct acpihp_slot *slot)
>> +{
>> + int found = 0;
>> + struct list_head *list;
>> + struct acpihp_slot_id *slot_id;
>> + unsigned long long uid;
>> +
>> + /* Respect firmware settings if _UID return an integer. */
>> + if (ACPI_SUCCESS(acpi_evaluate_integer(slot->handle, METHOD_NAME__UID,
>> + NULL, &uid)))
>> + goto set_name;
>> +
>> + if (slot->parent)
>> + list = &slot->parent->slot_id_list;
>> + else
>> + list = &slot_id_list;
>> +
>> + list_for_each_entry(slot_id, list, node)
>> + if (slot_id->type == slot->type) {
>> + found = 1;
>> + break;
>> + }
>> + if (!found) {
>> + slot_id = kzalloc(sizeof(struct acpihp_slot_id), GFP_KERNEL);
>> + if (!slot_id) {
>> + ACPIHP_DEBUG("fails to allocate slot instance ID.\n");
>> + return -ENOMEM;
>> + }
>> + slot_id->type = slot->type;
>> + list_add_tail(&slot_id->node, list);
>> + }
>> +
>> + uid = slot_id->instance_id++;
>> +
>> +set_name:
>> + snprintf(slot->name, sizeof(slot->name) - 1, "%s%02llx",
>> + acpihp_get_slot_type_name(slot->type), uid);
>> + dev_set_name(&slot->dev, "%s", slot->name);
>> +
>> + return 0;
>> +}
>> +
>> +/*
>> + * Generate a meaningful name for the slot according to devices connecting
>> + * to this slot
>> + */
>> +static int __init acpihp_enum_rename_slot(struct acpihp_slot *slot)
>> +{
>> + u32 child_types = 0;
>> +
>> + slot->type = acpihp_enum_check_slot_self(slot);
>> + if (slot->type == ACPIHP_SLOT_TYPE_UNKNOWN) {
>> + acpi_walk_namespace(ACPI_TYPE_DEVICE, slot->handle,
>> + ACPI_UINT32_MAX, acpihp_enum_get_dev_type,
>> + NULL, NULL, (void **)&child_types);
>> + acpi_walk_namespace(ACPI_TYPE_PROCESSOR, slot->handle,
>> + ACPI_UINT32_MAX, acpihp_enum_get_dev_type,
>> + NULL, NULL, (void **)&child_types);
>> + slot->type = acpihp_enum_get_slot_type(child_types);
>> + }
>> +
>> + if (acpihp_enum_generate_slot_name(slot))
>> + return -EINVAL;
>> +
>> + return 0;
>> +}
>> +
>> +static void __init acpihp_enum_rename_and_register_slots(void)
>> +{
>> + struct acpihp_slot *slot;
>> +
>> + list_for_each_entry(slot, &slot_list, slot_list) {
>> + /* generate a meaningful name for this slot */
>> + if (acpihp_enum_rename_slot(slot))
>> + continue;
>> +
>> + if (acpihp_register_slot(slot))
>> + ACPIHP_DEBUG("fails to register slot %s.\n",
>> + slot->name);
>> + }
>> +}
>> +
>> +static int __init acpihp_enum_generate_slots(void)
>> +{
>> + acpi_status status;
>> +
>> + status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
>> + ACPI_UINT32_MAX, acpihp_enum_scan_slot,
>> + NULL, NULL, NULL);
>> + if (!ACPI_SUCCESS(status))
>> + goto out_err;
>> +
>> + status = acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
>> + ACPI_UINT32_MAX, acpihp_enum_scan_slot,
>> + NULL, NULL, NULL);
>> + if (!ACPI_SUCCESS(status))
>> + goto out_err;
>> +
>> + acpihp_enum_rename_and_register_slots();
>> +
>> + return 0;
>> +
>> +out_err:
>> + ACPIHP_DEBUG("fails to scan hotplug slots.\n");
>> + acpihp_enum_cleanup_slots();
>> +
>> + return -ENOTSUPP;
>> +}
>> +
>> +static void acpihp_enum_unregister_slots(void)
>> +{
>> + struct acpihp_slot *slot, *tmp;
>> + struct acpihp_slot_id *slot_id, *slot_id_safe;
>> +
>> + list_for_each_entry_safe(slot, tmp, &slot_list, slot_list) {
>> + acpihp_unregister_slot(slot);
>> + list_del_init(&slot->slot_list);
>> + acpihp_unmark_slot(slot->handle);
>> + list_for_each_entry_safe(slot_id, slot_id_safe,
>> + &slot->slot_id_list, node) {
>> + list_del(&slot_id->node);
>> + kfree(slot_id);
>> + }
>> + acpihp_slot_put(slot);
>> + }
>> +}
>> +
>> +static void acpihp_enum_cleanup_slots(void)
>> +{
>> + struct acpihp_slot_id *slot_id, *tmp;
>> +
>> + acpihp_enum_unregister_slots();
>> + list_for_each_entry_safe(slot_id, tmp, &slot_id_list, node) {
>> + list_del(&slot_id->node);
>> + kfree(slot_id);
>> + }
>> +}
>> +
>> +static int __init acpihp_enum_init(void)
>> +{
>> + int i;
>> + int retval;
>> +
>> + /* probe for suitable enumerator. */
>> + for (i = 0; slot_ops_array[i]; i++)
>> + if (ACPI_SUCCESS(slot_ops_array[i]->init())) {
>> + slot_ops_curr = slot_ops_array[i];
>> + break;
>> + }
>> + if (slot_ops_curr == NULL) {
>> + ACPIHP_DEBUG("no ACPI hotplug slot found.\n");
>> + return -ENXIO;
>> + }
>> +
>> + retval = acpihp_register_class();
>> + if (retval != 0) {
>> + ACPIHP_DEBUG("fails to register ACPI hotplug slot class.\n");
>> + goto out_fini;
>> + }
>> +
>> + retval = acpihp_enum_generate_slots();
>> + if (retval != 0) {
>> + ACPIHP_DEBUG("fails to enumerate ACPI hotplug slots.\n");
>> + goto out_unregister_class;
>> + }
>> +
>> + /* Back out if no ACPI hotplug slot found. */
>> + if (list_empty(&slot_list)) {
>> + ACPIHP_DEBUG("no ACPI hotplug slot found.\n");
>> + retval = -ENODEV;
>> + goto out_unregister_class;
>> + }
>> +
>> + return 0;
>> +
>> +out_unregister_class:
>> + acpihp_unregister_class();
>> +out_fini:
>> + slot_ops_curr->fini();
>> + ACPIHP_DEBUG("fails to initialize hotplug slot enumerator.\n");
>> +
>> + return retval;
>> +}
>> +
>> +static void __exit acpihp_enum_exit(void)
>> +{
>> + acpihp_enum_cleanup_slots();
>> + acpihp_unregister_class();
>> + slot_ops_curr->fini();
>> +}
>> +
>> +module_init(acpihp_enum_init);
>> +module_exit(acpihp_enum_exit);
>> +
>> +MODULE_LICENSE("GPL v2");
>> +MODULE_AUTHOR("Jiang Liu <jiang.liu@huawei.com>");
>> +MODULE_AUTHOR("Gaohuai Han <hangaohuai@huawei.com>");
>> --
>> 1.7.9.5
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at http://www.tux.org/lkml/
>>
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC PATCH 2/3] ACPIHP: ACPI system device hotplug slot enumerator
2012-07-28 11:42 ` [RFC PATCH 2/3] ACPIHP: ACPI system device hotplug slot enumerator Jiang Liu
2012-08-03 6:10 ` Taku Izumi
@ 2012-08-04 20:14 ` Yinghai Lu
2012-08-05 9:36 ` Jiang Liu
1 sibling, 1 reply; 10+ messages in thread
From: Yinghai Lu @ 2012-08-04 20:14 UTC (permalink / raw)
To: Jiang Liu
Cc: Len Brown, Tony Luck, Bob Moore, Huang Ying, Yasuaki Ishimatsu,
Kenji Kaneshige, Wen Congyang, Taku Izumi, Jiang Liu,
Bjorn Helgaas, Hanjun Guo, linux-kernel, linux-acpi, linux-pci,
Gaohuai Han
On Sat, Jul 28, 2012 at 4:42 AM, Jiang Liu <liuj97@gmail.com> wrote:
> The first is an ACPI hotplug slot enumerator, which enumerates ACPI hotplug
> slots on load and provides callbacks to manage those hotplug slots.
> An ACPI hotplug slot is an abstraction of receptacles, where a group of
> system devices could be connected to. This patch implements the skeleton for
> ACPI system device hotplug slot enumerator. On loading, the driver scans the
> whole ACPI namespace for hotplug slots and creates a device node for each
> hotplug slots. Every slot is associated with a device class named
> acpihp_slot_class and will be managed by ACPI hotplug drivers.
I was thinking:
We can have module in ACPI DSDT, and every module is coresponding
to SystemModule.
so it will be
\_SB.NOD1
CPU0
CPU1
CPU2
CPU3
MEM0
MEM1
MEM2
MEM3
PCI0
PCI1
PCI2
PCI3
NTFY
STAT
STOP
NTFY will be something like:
Notify(\_SB.NOD1.CPU0,....)
Notify(\_SB.NOD1.CPU1,....)
Notify(\_SB.NOD1.CPU2,....)
Notify(\_SB.NOD1.CPU3,....)
Notify(\_SB.NOD1.MEM0,....)
Notify(\_SB.NOD1.MEM1,....)
Notify(\_SB.NOD1.MEM2,....)
Notify(\_SB.NOD1.MEM3,....)
Notify(\_SB.NOD1.PCI0,....)
Notify(\_SB.NOD1.PCI1,....)
Notify(\_SB.NOD1.PCI2,....)
Notify(\_SB.NOD1.PCI3,....)
and will link GPE button for SystemModule to call NTFY.
STAT could be 32bit integer for final turn off the power.
every CPU, MEM, PCI will own one bit, it will clear that bit in this own
_EJ0.
Every _EJ0 will double check if all are cleared, then it call extra STOP
to power off the whole SystemModule.
if OS already have seperated handler for those type objects (CPU, MEM,
PCI), we may not need to change to much to os.
Thanks
Yinghai
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC PATCH 2/3] ACPIHP: ACPI system device hotplug slot enumerator
2012-08-04 20:14 ` Yinghai Lu
@ 2012-08-05 9:36 ` Jiang Liu
0 siblings, 0 replies; 10+ messages in thread
From: Jiang Liu @ 2012-08-05 9:36 UTC (permalink / raw)
To: Yinghai Lu
Cc: Jiang Liu, Len Brown, Tony Luck, Bob Moore, Huang Ying,
Yasuaki Ishimatsu, Kenji Kaneshige, Wen Congyang, Taku Izumi,
Bjorn Helgaas, Hanjun Guo, linux-kernel, linux-acpi, linux-pci,
Gaohuai Han
On 2012-8-5 4:14, Yinghai Lu wrote:
> On Sat, Jul 28, 2012 at 4:42 AM, Jiang Liu <liuj97@gmail.com> wrote:
>> The first is an ACPI hotplug slot enumerator, which enumerates ACPI hotplug
>> slots on load and provides callbacks to manage those hotplug slots.
>> An ACPI hotplug slot is an abstraction of receptacles, where a group of
>> system devices could be connected to. This patch implements the skeleton for
>> ACPI system device hotplug slot enumerator. On loading, the driver scans the
>> whole ACPI namespace for hotplug slots and creates a device node for each
>> hotplug slots. Every slot is associated with a device class named
>> acpihp_slot_class and will be managed by ACPI hotplug drivers.
>
> I was thinking:
> We can have module in ACPI DSDT, and every module is coresponding
> to SystemModule.
> so it will be
> \_SB.NOD1
> CPU0
> CPU1
> CPU2
> CPU3
> MEM0
> MEM1
> MEM2
> MEM3
> PCI0
> PCI1
> PCI2
> PCI3
> NTFY
> STAT
> STOP
> NTFY will be something like:
> Notify(\_SB.NOD1.CPU0,....)
> Notify(\_SB.NOD1.CPU1,....)
> Notify(\_SB.NOD1.CPU2,....)
> Notify(\_SB.NOD1.CPU3,....)
>
> Notify(\_SB.NOD1.MEM0,....)
> Notify(\_SB.NOD1.MEM1,....)
> Notify(\_SB.NOD1.MEM2,....)
> Notify(\_SB.NOD1.MEM3,....)
>
> Notify(\_SB.NOD1.PCI0,....)
> Notify(\_SB.NOD1.PCI1,....)
> Notify(\_SB.NOD1.PCI2,....)
> Notify(\_SB.NOD1.PCI3,....)
>
> and will link GPE button for SystemModule to call NTFY.
>
> STAT could be 32bit integer for final turn off the power.
> every CPU, MEM, PCI will own one bit, it will clear that bit in this own
> _EJ0.
> Every _EJ0 will double check if all are cleared, then it call extra STOP
> to power off the whole SystemModule.
>
> if OS already have seperated handler for those type objects (CPU, MEM,
> PCI), we may not need to change to much to os.
Hi Yinghai,
Thanks for your comments.
It's one of the major concerns that we may need to make too many changes
to existing code, and even break backward compatibilities:(
There are two possible ways to support hotplug in ACPI BIOS:
1) send hotplug notifications to each sub-component of an FRU/module.
2) send hotplug notifications to the FRU itself.
We have had discussions with BIOS team and chose to adopt the second
solution because:
1) It's more convenient for user to operate on FRUs instead of sub-components.
2) BIOS will be simpler because it only need to track status of FRU itself
instead of sub-components.
3) It will be much more complex to do error recover if OS/BIOS cooperate on
sub-component granularity.
Any suggestions here?
Regards!
Gerry
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-08-05 9:37 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-28 11:42 [RFC PATCH 0/3] ACPI based system device hotplug framework Jiang Liu
2012-07-28 11:42 ` [RFC PATCH 1/3] ACPIHP: introduce a framework for ACPI based system device hotplug Jiang Liu
2012-08-02 7:07 ` Tang Chen
2012-08-02 7:07 ` Jiang Liu
2012-07-28 11:42 ` [RFC PATCH 2/3] ACPIHP: ACPI system device hotplug slot enumerator Jiang Liu
2012-08-03 6:10 ` Taku Izumi
2012-08-04 9:40 ` Jiang Liu
2012-08-04 20:14 ` Yinghai Lu
2012-08-05 9:36 ` Jiang Liu
2012-07-28 11:42 ` [RFC PATCH 3/3] ACPIHP: detect ACPI hotplug slots by checking ACPI _EJ0 method Jiang Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).