@@ -211,11 +211,12 @@ config ACPI_IPMI
select IPMI_HANDLER
select IPMI_SI
help
- This driver enables the ACPI to access the BMC controller. And it
- uses the IPMI request/response message to communicate with BMC
- controller, which can be found on on the server.
+ This driver enables ACPI AML access to the BMC controller. It
+ uses IPMI request/response messages to communicate with the BMC
+ controller.
To compile this driver as a module, choose M here:
+ the module will be called ipmi.
config ACPI_HOTPLUG_CPU
bool
@@ -56,7 +56,6 @@ MODULE_LICENSE("GPL");
struct acpi_ipmi_device {
acpi_handle handle;
struct acpi_device *device;
- int if_type;
/* the device list attached to driver_data.ipmi_devices */
struct list_head head;
ipmi_user_t user_interface;
@@ -454,40 +453,16 @@ static int ipmi_install_handlers(struct acpi_ipmi_device *ipmi)
return 0;
}
-static int acpi_ipmi_add(struct acpi_device *device)
+int acpi_ipmi_add(struct acpi_device *device)
{
struct acpi_ipmi_device *ipmi_device;
- acpi_handle handle;
- unsigned long long temp;
- acpi_status status;
- if (!device)
- return -EINVAL;
- handle = device->handle;
- temp = 0;
- status = acpi_evaluate_integer(handle, "_IFT", NULL, &temp);
- if (ACPI_FAILURE(status)) {
- printk(KERN_DEBUG "Incorrect _IFT object for %s\n",
- acpi_device_bid(device));
- return -ENODEV;
- }
ipmi_device = kzalloc(sizeof(struct acpi_ipmi_device), GFP_KERNEL);
if (!ipmi_device) {
printk(KERN_DEBUG "Can't allocate memory space\n");
return -ENOMEM;
}
- ipmi_device->if_type = temp;
- switch (ipmi_device->if_type) {
- case 1:
- case 2:
- case 3:
- break;
- default:
- printk(KERN_DEBUG "Unknow IPMI:SI interface type %d\n",
- ipmi_device->if_type);
- kfree(ipmi_device);
- return -EINVAL;
- }
+
ipmi_device->handle = device->handle;
ipmi_device->device = device;
mutex_init(&ipmi_device->mutex_lock);
@@ -505,8 +480,9 @@ static int acpi_ipmi_add(struct acpi_device *device)
device->driver_data = ipmi_device;
return 0;
}
+EXPORT_SYMBOL(acpi_ipmi_add);
-static int acpi_ipmi_remove(struct acpi_device *device, int type)
+int acpi_ipmi_remove(struct acpi_device *device)
{
struct acpi_ipmi_device *ipmi_device;
@@ -532,51 +508,16 @@ static int acpi_ipmi_remove(struct acpi_device *device, int type)
device->driver_data = NULL;
return 0;
}
-
-static const struct acpi_device_id ipmi_device_ids[] = {
- {"IPI0001", 0},
- {"", 0},
-};
-
-static struct acpi_driver acpi_ipmi_driver = {
- .name = "ipmi",
- .class = ACPI_IPMI_CLASS,
- .ids = ipmi_device_ids,
- .ops = {
- .add = acpi_ipmi_add,
- .remove = acpi_ipmi_remove,
- },
-};
+EXPORT_SYMBOL(acpi_ipmi_remove);
static int __init acpi_ipmi_init(void)
{
- int result = 0;
-
- if (acpi_disabled)
- return result;
-
- result = acpi_bus_register_driver(&acpi_ipmi_driver);
-
- if (result)
- return result;
-
- result = ipmi_smi_watcher_register(&driver_data.bmc_events);
-
- if (result)
- acpi_bus_unregister_driver(&acpi_ipmi_driver);
-
- return result;
+ return ipmi_smi_watcher_register(&driver_data.bmc_events);
}
static void __exit acpi_ipmi_exit(void)
{
- if (acpi_disabled)
- return;
-
ipmi_smi_watcher_unregister(&driver_data.bmc_events);
- acpi_bus_unregister_driver(&acpi_ipmi_driver);
-
- return;
}
module_init(acpi_ipmi_init);
@@ -1807,6 +1807,7 @@ static __devinit void hardcode_find_bmc(void)
#ifdef CONFIG_ACPI
#include <linux/acpi.h>
+#include <acpi/acpi_drivers.h>
/*
* Once we get an ACPI failure, we don't try any more, because we go
@@ -2033,6 +2034,7 @@ static int __devinit ipmi_pnp_probe(struct pnp_dev *dev,
acpi_handle handle;
acpi_status status;
unsigned long long tmp;
+ int ret;
acpi_dev = pnp_acpi_device(dev);
if (!acpi_dev)
@@ -2096,7 +2098,12 @@ static int __devinit ipmi_pnp_probe(struct pnp_dev *dev,
info->dev = &acpi_dev->dev;
pnp_set_drvdata(dev, info);
- return try_smi_init(info);
+ ret = try_smi_init(info);
+ if (ret)
+ return ret;
+
+ acpi_ipmi_add(acpi_dev);
+ return 0;
err_free:
kfree(info);
@@ -2107,6 +2114,7 @@ static void __devexit ipmi_pnp_remove(struct pnp_dev *dev)
{
struct smi_info *info = pnp_get_drvdata(dev);
+ acpi_ipmi_remove(pnp_acpi_device(dev));
cleanup_one_si(info);
}
@@ -153,4 +153,8 @@ static inline void unregister_hotplug_dock_device(acpi_handle handle)
}
#endif
+/* IPMI opregion driver */
+extern int acpi_ipmi_add(struct acpi_device *device);
+extern int acpi_ipmi_remove(struct acpi_device *device);
+
#endif /*__ACPI_DRIVERS_H__*/