Commit 0944d889 authored by Corey Minyard's avatar Corey Minyard

ipmi: Convert DMI handling over to a platform device

Now that the IPMI DMI code creates a platform device for IPMI devices
in the firmware, use that instead of handling all the DMI work
in the IPMI drivers themselves.
Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
Cc: Andy Lutomirski <luto@kernel.org>
parent 9f88145f
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
#include <linux/ipmi_smi.h> #include <linux/ipmi_smi.h>
#include <asm/io.h> #include <asm/io.h>
#include "ipmi_si_sm.h" #include "ipmi_si_sm.h"
#include "ipmi_dmi.h"
#include <linux/dmi.h> #include <linux/dmi.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/ctype.h> #include <linux/ctype.h>
...@@ -2273,136 +2274,105 @@ static void spmi_find_bmc(void) ...@@ -2273,136 +2274,105 @@ static void spmi_find_bmc(void)
} }
#endif #endif
#ifdef CONFIG_DMI #if defined(CONFIG_DMI) || defined(CONFIG_ACPI)
struct dmi_ipmi_data { struct resource *ipmi_get_info_from_resources(struct platform_device *pdev,
u8 type; struct smi_info *info)
u8 addr_space;
unsigned long base_addr;
u8 irq;
u8 offset;
u8 slave_addr;
};
static int decode_dmi(const struct dmi_header *dm,
struct dmi_ipmi_data *dmi)
{ {
const u8 *data = (const u8 *)dm; struct resource *res, *res_second;
unsigned long base_addr;
u8 reg_spacing;
u8 len = dm->length;
dmi->type = data[4];
memcpy(&base_addr, data+8, sizeof(unsigned long)); res = platform_get_resource(pdev, IORESOURCE_IO, 0);
if (len >= 0x11) { if (res) {
if (base_addr & 1) { info->io_setup = port_setup;
/* I/O */ info->io.addr_type = IPMI_IO_ADDR_SPACE;
base_addr &= 0xFFFE;
dmi->addr_space = IPMI_IO_ADDR_SPACE;
} else
/* Memory */
dmi->addr_space = IPMI_MEM_ADDR_SPACE;
/* If bit 4 of byte 0x10 is set, then the lsb for the address
is odd. */
dmi->base_addr = base_addr | ((data[0x10] & 0x10) >> 4);
dmi->irq = data[0x11];
/* The top two bits of byte 0x10 hold the register spacing. */
reg_spacing = (data[0x10] & 0xC0) >> 6;
switch (reg_spacing) {
case 0x00: /* Byte boundaries */
dmi->offset = 1;
break;
case 0x01: /* 32-bit boundaries */
dmi->offset = 4;
break;
case 0x02: /* 16-byte boundaries */
dmi->offset = 16;
break;
default:
/* Some other interface, just ignore it. */
return -EIO;
}
} else { } else {
/* Old DMI spec. */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
/* if (res) {
* Note that technically, the lower bit of the base info->io_setup = mem_setup;
* address should be 1 if the address is I/O and 0 if info->io.addr_type = IPMI_MEM_ADDR_SPACE;
* the address is in memory. So many systems get that }
* wrong (and all that I have seen are I/O) so we just
* ignore that bit and assume I/O. Systems that use
* memory should use the newer spec, anyway.
*/
dmi->base_addr = base_addr & 0xfffe;
dmi->addr_space = IPMI_IO_ADDR_SPACE;
dmi->offset = 1;
} }
if (!res) {
dev_err(&pdev->dev, "no I/O or memory address\n");
return NULL;
}
info->io.addr_data = res->start;
dmi->slave_addr = data[6]; info->io.regspacing = DEFAULT_REGSPACING;
res_second = platform_get_resource(pdev,
(info->io.addr_type == IPMI_IO_ADDR_SPACE) ?
IORESOURCE_IO : IORESOURCE_MEM,
1);
if (res_second) {
if (res_second->start > info->io.addr_data)
info->io.regspacing =
res_second->start - info->io.addr_data;
}
info->io.regsize = DEFAULT_REGSIZE;
info->io.regshift = 0;
return 0; return res;
} }
static void try_init_dmi(struct dmi_ipmi_data *ipmi_data) #endif
#ifdef CONFIG_DMI
static int dmi_ipmi_probe(struct platform_device *pdev)
{ {
struct smi_info *info; struct smi_info *info;
u8 type, slave_addr;
int rv;
if (!si_trydmi)
return -ENODEV;
rv = device_property_read_u8(&pdev->dev, "ipmi-type", &type);
if (rv)
return -ENODEV;
info = smi_info_alloc(); info = smi_info_alloc();
if (!info) { if (!info) {
pr_err(PFX "Could not allocate SI data\n"); pr_err(PFX "Could not allocate SI data\n");
return; return -ENOMEM;
} }
info->addr_source = SI_SMBIOS; info->addr_source = SI_SMBIOS;
pr_info(PFX "probing via SMBIOS\n"); pr_info(PFX "probing via SMBIOS\n");
switch (ipmi_data->type) { switch (type) {
case 0x01: /* KCS */ case IPMI_DMI_TYPE_KCS:
info->si_type = SI_KCS; info->si_type = SI_KCS;
break; break;
case 0x02: /* SMIC */ case IPMI_DMI_TYPE_SMIC:
info->si_type = SI_SMIC; info->si_type = SI_SMIC;
break; break;
case 0x03: /* BT */ case IPMI_DMI_TYPE_BT:
info->si_type = SI_BT; info->si_type = SI_BT;
break; break;
default: default:
kfree(info); kfree(info);
return; return -EINVAL;
} }
switch (ipmi_data->addr_space) { if (!ipmi_get_info_from_resources(pdev, info)) {
case IPMI_MEM_ADDR_SPACE: rv = -EINVAL;
info->io_setup = mem_setup; goto err_free;
info->io.addr_type = IPMI_MEM_ADDR_SPACE;
break;
case IPMI_IO_ADDR_SPACE:
info->io_setup = port_setup;
info->io.addr_type = IPMI_IO_ADDR_SPACE;
break;
default:
kfree(info);
pr_warn(PFX "Unknown SMBIOS I/O Address type: %d\n",
ipmi_data->addr_space);
return;
} }
info->io.addr_data = ipmi_data->base_addr;
info->io.regspacing = ipmi_data->offset; rv = device_property_read_u8(&pdev->dev, "slave-addr", &slave_addr);
if (!info->io.regspacing) if (rv) {
info->io.regspacing = DEFAULT_REGSPACING; dev_warn(&pdev->dev, "device has no slave-addr property");
info->io.regsize = DEFAULT_REGSIZE; info->slave_addr = 0x20;
info->io.regshift = 0; } else {
info->slave_addr = slave_addr;
info->slave_addr = ipmi_data->slave_addr; }
info->irq = ipmi_data->irq; info->irq = platform_get_irq(pdev, 0);
if (info->irq) if (info->irq > 0)
info->irq_setup = std_irq_setup; info->irq_setup = std_irq_setup;
else
info->irq = 0;
info->dev = &pdev->dev;
pr_info("ipmi_si: SMBIOS: %s %#lx regsize %d spacing %d irq %d\n", pr_info("ipmi_si: SMBIOS: %s %#lx regsize %d spacing %d irq %d\n",
(info->io.addr_type == IPMI_IO_ADDR_SPACE) ? "io" : "mem", (info->io.addr_type == IPMI_IO_ADDR_SPACE) ? "io" : "mem",
...@@ -2411,21 +2381,17 @@ static void try_init_dmi(struct dmi_ipmi_data *ipmi_data) ...@@ -2411,21 +2381,17 @@ static void try_init_dmi(struct dmi_ipmi_data *ipmi_data)
if (add_smi(info)) if (add_smi(info))
kfree(info); kfree(info);
}
static void dmi_find_bmc(void) return 0;
{
const struct dmi_device *dev = NULL;
struct dmi_ipmi_data data;
int rv;
while ((dev = dmi_find_device(DMI_DEV_TYPE_IPMI, NULL, dev))) { err_free:
memset(&data, 0, sizeof(data)); kfree(info);
rv = decode_dmi((const struct dmi_header *) dev->device_data, return rv;
&data); }
if (!rv) #else
try_init_dmi(&data); static int dmi_ipmi_probe(struct platform_device *pdev)
} {
return -ENODEV;
} }
#endif /* CONFIG_DMI */ #endif /* CONFIG_DMI */
...@@ -2684,17 +2650,47 @@ static int of_ipmi_probe(struct platform_device *dev) ...@@ -2684,17 +2650,47 @@ static int of_ipmi_probe(struct platform_device *dev)
#endif #endif
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
static int find_slave_address(struct smi_info *info, int slave_addr)
{
#ifdef CONFIG_IPMI_DMI_DECODE
if (!slave_addr) {
int type = -1;
u32 flags = IORESOURCE_IO;
switch (info->si_type) {
case SI_KCS:
type = IPMI_DMI_TYPE_KCS;
break;
case SI_BT:
type = IPMI_DMI_TYPE_BT;
break;
case SI_SMIC:
type = IPMI_DMI_TYPE_SMIC;
break;
}
if (info->io.addr_type == IPMI_MEM_ADDR_SPACE)
flags = IORESOURCE_MEM;
slave_addr = ipmi_dmi_get_slave_addr(type, flags,
info->io.addr_data);
}
#endif
return slave_addr;
}
static int acpi_ipmi_probe(struct platform_device *dev) static int acpi_ipmi_probe(struct platform_device *dev)
{ {
struct smi_info *info; struct smi_info *info;
struct resource *res, *res_second;
acpi_handle handle; acpi_handle handle;
acpi_status status; acpi_status status;
unsigned long long tmp; unsigned long long tmp;
struct resource *res;
int rv = -EINVAL; int rv = -EINVAL;
if (!si_tryacpi) if (!si_tryacpi)
return 0; return -ENODEV;
handle = ACPI_HANDLE(&dev->dev); handle = ACPI_HANDLE(&dev->dev);
if (!handle) if (!handle)
...@@ -2734,35 +2730,11 @@ static int acpi_ipmi_probe(struct platform_device *dev) ...@@ -2734,35 +2730,11 @@ static int acpi_ipmi_probe(struct platform_device *dev)
goto err_free; goto err_free;
} }
res = platform_get_resource(dev, IORESOURCE_IO, 0); res = ipmi_get_info_from_resources(dev, info);
if (res) {
info->io_setup = port_setup;
info->io.addr_type = IPMI_IO_ADDR_SPACE;
} else {
res = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (res) {
info->io_setup = mem_setup;
info->io.addr_type = IPMI_MEM_ADDR_SPACE;
}
}
if (!res) { if (!res) {
dev_err(&dev->dev, "no I/O or memory address\n"); rv = -EINVAL;
goto err_free; goto err_free;
} }
info->io.addr_data = res->start;
info->io.regspacing = DEFAULT_REGSPACING;
res_second = platform_get_resource(dev,
(info->io.addr_type == IPMI_IO_ADDR_SPACE) ?
IORESOURCE_IO : IORESOURCE_MEM,
1);
if (res_second) {
if (res_second->start > info->io.addr_data)
info->io.regspacing =
res_second->start - info->io.addr_data;
}
info->io.regsize = DEFAULT_REGSIZE;
info->io.regshift = 0;
/* If _GPE exists, use it; otherwise use standard interrupts */ /* If _GPE exists, use it; otherwise use standard interrupts */
status = acpi_evaluate_integer(handle, "_GPE", NULL, &tmp); status = acpi_evaluate_integer(handle, "_GPE", NULL, &tmp);
...@@ -2778,6 +2750,8 @@ static int acpi_ipmi_probe(struct platform_device *dev) ...@@ -2778,6 +2750,8 @@ static int acpi_ipmi_probe(struct platform_device *dev)
} }
} }
info->slave_addr = find_slave_address(info, info->slave_addr);
info->dev = &dev->dev; info->dev = &dev->dev;
platform_set_drvdata(dev, info); platform_set_drvdata(dev, info);
...@@ -2813,7 +2787,10 @@ static int ipmi_probe(struct platform_device *dev) ...@@ -2813,7 +2787,10 @@ static int ipmi_probe(struct platform_device *dev)
if (of_ipmi_probe(dev) == 0) if (of_ipmi_probe(dev) == 0)
return 0; return 0;
return acpi_ipmi_probe(dev); if (acpi_ipmi_probe(dev) == 0)
return 0;
return dmi_ipmi_probe(dev);
} }
static int ipmi_remove(struct platform_device *dev) static int ipmi_remove(struct platform_device *dev)
...@@ -3786,11 +3763,6 @@ static int init_ipmi_si(void) ...@@ -3786,11 +3763,6 @@ static int init_ipmi_si(void)
} }
#endif #endif
#ifdef CONFIG_DMI
if (si_trydmi)
dmi_find_bmc();
#endif
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
if (si_tryacpi) if (si_tryacpi)
spmi_find_bmc(); spmi_find_bmc();
...@@ -3938,6 +3910,7 @@ static void cleanup_ipmi_si(void) ...@@ -3938,6 +3910,7 @@ static void cleanup_ipmi_si(void)
} }
module_exit(cleanup_ipmi_si); module_exit(cleanup_ipmi_si);
MODULE_ALIAS("platform:dmi-ipmi-si");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Corey Minyard <minyard@mvista.com>"); MODULE_AUTHOR("Corey Minyard <minyard@mvista.com>");
MODULE_DESCRIPTION("Interface to the IPMI driver for the KCS, SMIC, and BT" MODULE_DESCRIPTION("Interface to the IPMI driver for the KCS, SMIC, and BT"
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/time64.h> #include <linux/time64.h>
#include "ipmi_dmi.h"
#define PFX "ipmi_ssif: " #define PFX "ipmi_ssif: "
#define DEVICE_NAME "ipmi_ssif" #define DEVICE_NAME "ipmi_ssif"
...@@ -180,6 +181,8 @@ struct ssif_addr_info { ...@@ -180,6 +181,8 @@ struct ssif_addr_info {
int slave_addr; int slave_addr;
enum ipmi_addr_src addr_src; enum ipmi_addr_src addr_src;
union ipmi_smi_info_union addr_info; union ipmi_smi_info_union addr_info;
struct device *dev;
struct i2c_client *client;
struct mutex clients_mutex; struct mutex clients_mutex;
struct list_head clients; struct list_head clients;
...@@ -1171,6 +1174,7 @@ static LIST_HEAD(ssif_infos); ...@@ -1171,6 +1174,7 @@ static LIST_HEAD(ssif_infos);
static int ssif_remove(struct i2c_client *client) static int ssif_remove(struct i2c_client *client)
{ {
struct ssif_info *ssif_info = i2c_get_clientdata(client); struct ssif_info *ssif_info = i2c_get_clientdata(client);
struct ssif_addr_info *addr_info;
int rv; int rv;
if (!ssif_info) if (!ssif_info)
...@@ -1198,6 +1202,13 @@ static int ssif_remove(struct i2c_client *client) ...@@ -1198,6 +1202,13 @@ static int ssif_remove(struct i2c_client *client)
kthread_stop(ssif_info->thread); kthread_stop(ssif_info->thread);
} }
list_for_each_entry(addr_info, &ssif_infos, link) {
if (addr_info->client == client) {
addr_info->client = NULL;
break;
}
}
/* /*
* No message can be outstanding now, we have removed the * No message can be outstanding now, we have removed the
* upper layer and it permitted us to do so. * upper layer and it permitted us to do so.
...@@ -1406,27 +1417,13 @@ static bool check_acpi(struct ssif_info *ssif_info, struct device *dev) ...@@ -1406,27 +1417,13 @@ static bool check_acpi(struct ssif_info *ssif_info, struct device *dev)
static int find_slave_address(struct i2c_client *client, int slave_addr) static int find_slave_address(struct i2c_client *client, int slave_addr)
{ {
struct ssif_addr_info *info; #ifdef CONFIG_IPMI_DMI_DECODE
if (!slave_addr)
if (slave_addr) slave_addr = ipmi_dmi_get_slave_addr(
return slave_addr; IPMI_DMI_TYPE_SSIF,
i2c_adapter_id(client->adapter),
/* client->addr);
* Came in without a slave address, search around to see if #endif
* the other sources have a slave address. This lets us pick
* up an SMBIOS slave address when using ACPI.
*/
list_for_each_entry(info, &ssif_infos, link) {
if (info->binfo.addr != client->addr)
continue;
if (info->adapter_name && strcmp_nospace(info->adapter_name,
client->adapter->name))
continue;
if (info->slave_addr) {
slave_addr = info->slave_addr;
break;
}
}
return slave_addr; return slave_addr;
} }
...@@ -1448,7 +1445,6 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1448,7 +1445,6 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id)
u8 slave_addr = 0; u8 slave_addr = 0;
struct ssif_addr_info *addr_info = NULL; struct ssif_addr_info *addr_info = NULL;
resp = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL); resp = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL);
if (!resp) if (!resp)
return -ENOMEM; return -ENOMEM;
...@@ -1469,6 +1465,7 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1469,6 +1465,7 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id)
ssif_info->addr_source = addr_info->addr_src; ssif_info->addr_source = addr_info->addr_src;
ssif_info->ssif_debug = addr_info->debug; ssif_info->ssif_debug = addr_info->debug;
ssif_info->addr_info = addr_info->addr_info; ssif_info->addr_info = addr_info->addr_info;
addr_info->client = client;
slave_addr = addr_info->slave_addr; slave_addr = addr_info->slave_addr;
} }
} }
...@@ -1707,8 +1704,19 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1707,8 +1704,19 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id)
} }
out: out:
if (rv) if (rv) {
/*
* Note that if addr_info->client is assigned, we
* leave it. The i2c client hangs around even if we
* return a failure here, and the failure here is not
* propagated back to the i2c code. This seems to be
* design intent, strange as it may be. But if we
* don't leave it, ssif_platform_remove will not remove
* the client like it should.
*/
dev_err(&client->dev, "Unable to start IPMI SSIF: %d\n", rv);
kfree(ssif_info); kfree(ssif_info);
}
kfree(resp); kfree(resp);
return rv; return rv;
...@@ -1733,7 +1741,8 @@ static int ssif_adapter_handler(struct device *adev, void *opaque) ...@@ -1733,7 +1741,8 @@ static int ssif_adapter_handler(struct device *adev, void *opaque)
static int new_ssif_client(int addr, char *adapter_name, static int new_ssif_client(int addr, char *adapter_name,
int debug, int slave_addr, int debug, int slave_addr,
enum ipmi_addr_src addr_src) enum ipmi_addr_src addr_src,
struct device *dev)
{ {
struct ssif_addr_info *addr_info; struct ssif_addr_info *addr_info;
int rv = 0; int rv = 0;
...@@ -1766,6 +1775,9 @@ static int new_ssif_client(int addr, char *adapter_name, ...@@ -1766,6 +1775,9 @@ static int new_ssif_client(int addr, char *adapter_name,
addr_info->debug = debug; addr_info->debug = debug;
addr_info->slave_addr = slave_addr; addr_info->slave_addr = slave_addr;
addr_info->addr_src = addr_src; addr_info->addr_src = addr_src;
addr_info->dev = dev;
dev_set_drvdata(dev, addr_info);
list_add_tail(&addr_info->link, &ssif_infos); list_add_tail(&addr_info->link, &ssif_infos);
...@@ -1904,7 +1916,7 @@ static int try_init_spmi(struct SPMITable *spmi) ...@@ -1904,7 +1916,7 @@ static int try_init_spmi(struct SPMITable *spmi)
myaddr = spmi->addr.address & 0x7f; myaddr = spmi->addr.address & 0x7f;
return new_ssif_client(myaddr, NULL, 0, 0, SI_SPMI); return new_ssif_client(myaddr, NULL, 0, 0, SI_SPMI, NULL);
} }
static void spmi_find_bmc(void) static void spmi_find_bmc(void)
...@@ -1933,48 +1945,40 @@ static void spmi_find_bmc(void) { } ...@@ -1933,48 +1945,40 @@ static void spmi_find_bmc(void) { }
#endif #endif
#ifdef CONFIG_DMI #ifdef CONFIG_DMI
static int decode_dmi(const struct dmi_device *dmi_dev) static int dmi_ipmi_probe(struct platform_device *pdev)
{ {
struct dmi_header *dm = dmi_dev->device_data; u8 type, slave_addr = 0;
u8 *data = (u8 *) dm; u16 i2c_addr;
u8 len = dm->length; int rv;
unsigned short myaddr;
int slave_addr;
if (num_addrs >= MAX_SSIF_BMCS) if (!ssif_trydmi)
return -1; return -ENODEV;
if (len < 9) rv = device_property_read_u8(&pdev->dev, "ipmi-type", &type);
return -1; if (rv)
return -ENODEV;
if (data[0x04] != 4) /* Not SSIF */ if (type != IPMI_DMI_TYPE_SSIF)
return -1; return -ENODEV;
if ((data[8] >> 1) == 0) { rv = device_property_read_u16(&pdev->dev, "i2c-addr", &i2c_addr);
/* if (rv) {
* Some broken systems put the I2C address in dev_warn(&pdev->dev, PFX "No i2c-addr property\n");
* the slave address field. We try to return -ENODEV;
* accommodate them here.
*/
myaddr = data[6] >> 1;
slave_addr = 0;
} else {
myaddr = data[8] >> 1;
slave_addr = data[6];
} }
return new_ssif_client(myaddr, NULL, 0, slave_addr, SI_SMBIOS); rv = device_property_read_u8(&pdev->dev, "slave-addr", &slave_addr);
} if (rv)
dev_warn(&pdev->dev, "device has no slave-addr property");
static void dmi_iterator(void)
{
const struct dmi_device *dev = NULL;
while ((dev = dmi_find_device(DMI_DEV_TYPE_IPMI, NULL, dev))) return new_ssif_client(i2c_addr, NULL, 0,
decode_dmi(dev); slave_addr, SI_SMBIOS, &pdev->dev);
} }
#else #else
static void dmi_iterator(void) { } static int dmi_ipmi_probe(struct platform_device *pdev)
{
return -ENODEV;
}
#endif #endif
static const struct i2c_device_id ssif_id[] = { static const struct i2c_device_id ssif_id[] = {
...@@ -1995,6 +1999,36 @@ static struct i2c_driver ssif_i2c_driver = { ...@@ -1995,6 +1999,36 @@ static struct i2c_driver ssif_i2c_driver = {
.detect = ssif_detect .detect = ssif_detect
}; };
static int ssif_platform_probe(struct platform_device *dev)
{
return dmi_ipmi_probe(dev);
}
static int ssif_platform_remove(struct platform_device *dev)
{
struct ssif_addr_info *addr_info = dev_get_drvdata(&dev->dev);
if (!addr_info)
return 0;
mutex_lock(&ssif_infos_mutex);
if (addr_info->client)
i2c_unregister_device(addr_info->client);
list_del(&addr_info->link);
kfree(addr_info);
mutex_unlock(&ssif_infos_mutex);
return 0;
}
static struct platform_driver ipmi_driver = {
.driver = {
.name = DEVICE_NAME,
},
.probe = ssif_platform_probe,
.remove = ssif_platform_remove,
};
static int init_ipmi_ssif(void) static int init_ipmi_ssif(void)
{ {
int i; int i;
...@@ -2009,7 +2043,7 @@ static int init_ipmi_ssif(void) ...@@ -2009,7 +2043,7 @@ static int init_ipmi_ssif(void)
for (i = 0; i < num_addrs; i++) { for (i = 0; i < num_addrs; i++) {
rv = new_ssif_client(addr[i], adapter_name[i], rv = new_ssif_client(addr[i], adapter_name[i],
dbg[i], slave_addrs[i], dbg[i], slave_addrs[i],
SI_HARDCODED); SI_HARDCODED, NULL);
if (rv) if (rv)
pr_err(PFX pr_err(PFX
"Couldn't add hardcoded device at addr 0x%x\n", "Couldn't add hardcoded device at addr 0x%x\n",
...@@ -2019,11 +2053,16 @@ static int init_ipmi_ssif(void) ...@@ -2019,11 +2053,16 @@ static int init_ipmi_ssif(void)
if (ssif_tryacpi) if (ssif_tryacpi)
ssif_i2c_driver.driver.acpi_match_table = ssif_i2c_driver.driver.acpi_match_table =
ACPI_PTR(ssif_acpi_match); ACPI_PTR(ssif_acpi_match);
if (ssif_trydmi)
dmi_iterator();
if (ssif_tryacpi) if (ssif_tryacpi)
spmi_find_bmc(); spmi_find_bmc();
if (ssif_trydmi) {
rv = platform_driver_register(&ipmi_driver);
if (rv)
pr_err(PFX "Unable to register driver: %d\n", rv);
}
ssif_i2c_driver.address_list = ssif_address_list(); ssif_i2c_driver.address_list = ssif_address_list();
rv = i2c_add_driver(&ssif_i2c_driver); rv = i2c_add_driver(&ssif_i2c_driver);
...@@ -2043,10 +2082,13 @@ static void cleanup_ipmi_ssif(void) ...@@ -2043,10 +2082,13 @@ static void cleanup_ipmi_ssif(void)
i2c_del_driver(&ssif_i2c_driver); i2c_del_driver(&ssif_i2c_driver);
platform_driver_unregister(&ipmi_driver);
free_ssif_clients(); free_ssif_clients();
} }
module_exit(cleanup_ipmi_ssif); module_exit(cleanup_ipmi_ssif);
MODULE_ALIAS("platform:dmi-ipmi-ssif");
MODULE_AUTHOR("Todd C Davis <todd.c.davis@intel.com>, Corey Minyard <minyard@acm.org>"); MODULE_AUTHOR("Todd C Davis <todd.c.davis@intel.com>, Corey Minyard <minyard@acm.org>");
MODULE_DESCRIPTION("IPMI driver for management controllers on a SMBus"); MODULE_DESCRIPTION("IPMI driver for management controllers on a SMBus");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment