ipmi_si: Rename addr_type to addr_space to match what it does
Make the naming consistent, and make the values an enum. Signed-off-by: Corey Minyard <cminyard@mvista.com>hifive-unleashed-5.1
parent
f25eb44832
commit
f6296bdc49
|
@ -9,9 +9,6 @@
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include "ipmi_si_sm.h"
|
#include "ipmi_si_sm.h"
|
||||||
|
|
||||||
#define IPMI_IO_ADDR_SPACE 0
|
|
||||||
#define IPMI_MEM_ADDR_SPACE 1
|
|
||||||
|
|
||||||
#define DEFAULT_REGSPACING 1
|
#define DEFAULT_REGSPACING 1
|
||||||
#define DEFAULT_REGSIZE 1
|
#define DEFAULT_REGSIZE 1
|
||||||
|
|
||||||
|
@ -27,7 +24,7 @@ void ipmi_si_remove_by_data(int addr_space, enum si_type si_type,
|
||||||
unsigned long addr);
|
unsigned long addr);
|
||||||
void ipmi_hardcode_init(void);
|
void ipmi_hardcode_init(void);
|
||||||
void ipmi_si_hardcode_exit(void);
|
void ipmi_si_hardcode_exit(void);
|
||||||
int ipmi_si_hardcode_match(int addr_type, unsigned long addr);
|
int ipmi_si_hardcode_match(int addr_space, unsigned long addr);
|
||||||
void ipmi_si_platform_init(void);
|
void ipmi_si_platform_init(void);
|
||||||
void ipmi_si_platform_shutdown(void);
|
void ipmi_si_platform_shutdown(void);
|
||||||
|
|
||||||
|
|
|
@ -240,11 +240,11 @@ void ipmi_si_hardcode_exit(void)
|
||||||
* Returns true of the given address exists as a hardcoded address,
|
* Returns true of the given address exists as a hardcoded address,
|
||||||
* false if not.
|
* false if not.
|
||||||
*/
|
*/
|
||||||
int ipmi_si_hardcode_match(int addr_type, unsigned long addr)
|
int ipmi_si_hardcode_match(int addr_space, unsigned long addr)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (addr_type == IPMI_IO_ADDR_SPACE) {
|
if (addr_space == IPMI_IO_ADDR_SPACE) {
|
||||||
for (i = 0; i < num_ports; i++) {
|
for (i = 0; i < num_ports; i++) {
|
||||||
if (ports[i] == addr)
|
if (ports[i] == addr)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -106,7 +106,7 @@ static int hotmod_handler(const char *val, const struct kernel_param *kp)
|
||||||
char *next, *curr, *s, *n, *o;
|
char *next, *curr, *s, *n, *o;
|
||||||
enum hotmod_op op;
|
enum hotmod_op op;
|
||||||
enum si_type si_type;
|
enum si_type si_type;
|
||||||
int addr_space;
|
enum ipmi_addr_space addr_space;
|
||||||
unsigned long addr;
|
unsigned long addr;
|
||||||
int regspacing;
|
int regspacing;
|
||||||
int regsize;
|
int regsize;
|
||||||
|
@ -150,9 +150,10 @@ static int hotmod_handler(const char *val, const struct kernel_param *kp)
|
||||||
break;
|
break;
|
||||||
si_type = ival;
|
si_type = ival;
|
||||||
|
|
||||||
rv = parse_str(hotmod_as, &addr_space, "address space", &curr);
|
rv = parse_str(hotmod_as, &ival, "address space", &curr);
|
||||||
if (rv)
|
if (rv)
|
||||||
break;
|
break;
|
||||||
|
addr_space = ival;
|
||||||
|
|
||||||
s = strchr(curr, ',');
|
s = strchr(curr, ',');
|
||||||
if (s) {
|
if (s) {
|
||||||
|
@ -215,7 +216,7 @@ static int hotmod_handler(const char *val, const struct kernel_param *kp)
|
||||||
io.addr_source = SI_HOTMOD;
|
io.addr_source = SI_HOTMOD;
|
||||||
io.si_type = si_type;
|
io.si_type = si_type;
|
||||||
io.addr_data = addr;
|
io.addr_data = addr;
|
||||||
io.addr_type = addr_space;
|
io.addr_space = addr_space;
|
||||||
|
|
||||||
io.addr = NULL;
|
io.addr = NULL;
|
||||||
io.regspacing = regspacing;
|
io.regspacing = regspacing;
|
||||||
|
|
|
@ -1645,7 +1645,7 @@ static ssize_t ipmi_params_show(struct device *dev,
|
||||||
return snprintf(buf, 200,
|
return snprintf(buf, 200,
|
||||||
"%s,%s,0x%lx,rsp=%d,rsi=%d,rsh=%d,irq=%d,ipmb=%d\n",
|
"%s,%s,0x%lx,rsp=%d,rsi=%d,rsh=%d,irq=%d,ipmb=%d\n",
|
||||||
si_to_str[smi_info->io.si_type],
|
si_to_str[smi_info->io.si_type],
|
||||||
addr_space_to_str[smi_info->io.addr_type],
|
addr_space_to_str[smi_info->io.addr_space],
|
||||||
smi_info->io.addr_data,
|
smi_info->io.addr_data,
|
||||||
smi_info->io.regspacing,
|
smi_info->io.regspacing,
|
||||||
smi_info->io.regsize,
|
smi_info->io.regsize,
|
||||||
|
@ -1843,7 +1843,7 @@ static struct smi_info *find_dup_si(struct smi_info *info)
|
||||||
struct smi_info *e;
|
struct smi_info *e;
|
||||||
|
|
||||||
list_for_each_entry(e, &smi_infos, link) {
|
list_for_each_entry(e, &smi_infos, link) {
|
||||||
if (e->io.addr_type != info->io.addr_type)
|
if (e->io.addr_space != info->io.addr_space)
|
||||||
continue;
|
continue;
|
||||||
if (e->io.addr_data == info->io.addr_data) {
|
if (e->io.addr_data == info->io.addr_data) {
|
||||||
/*
|
/*
|
||||||
|
@ -1871,16 +1871,16 @@ int ipmi_si_add_smi(struct si_sm_io *io)
|
||||||
* in the firmware.
|
* in the firmware.
|
||||||
*/
|
*/
|
||||||
if (io->addr_source != SI_HARDCODED &&
|
if (io->addr_source != SI_HARDCODED &&
|
||||||
ipmi_si_hardcode_match(io->addr_type, io->addr_data)) {
|
ipmi_si_hardcode_match(io->addr_space, io->addr_data)) {
|
||||||
dev_info(io->dev,
|
dev_info(io->dev,
|
||||||
"Hard-coded device at this address already exists");
|
"Hard-coded device at this address already exists");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!io->io_setup) {
|
if (!io->io_setup) {
|
||||||
if (io->addr_type == IPMI_IO_ADDR_SPACE) {
|
if (io->addr_space == IPMI_IO_ADDR_SPACE) {
|
||||||
io->io_setup = ipmi_si_port_setup;
|
io->io_setup = ipmi_si_port_setup;
|
||||||
} else if (io->addr_type == IPMI_MEM_ADDR_SPACE) {
|
} else if (io->addr_space == IPMI_MEM_ADDR_SPACE) {
|
||||||
io->io_setup = ipmi_si_mem_setup;
|
io->io_setup = ipmi_si_mem_setup;
|
||||||
} else {
|
} else {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -1942,7 +1942,7 @@ static int try_smi_init(struct smi_info *new_smi)
|
||||||
pr_info("Trying %s-specified %s state machine at %s address 0x%lx, slave address 0x%x, irq %d\n",
|
pr_info("Trying %s-specified %s state machine at %s address 0x%lx, slave address 0x%x, irq %d\n",
|
||||||
ipmi_addr_src_to_str(new_smi->io.addr_source),
|
ipmi_addr_src_to_str(new_smi->io.addr_source),
|
||||||
si_to_str[new_smi->io.si_type],
|
si_to_str[new_smi->io.si_type],
|
||||||
addr_space_to_str[new_smi->io.addr_type],
|
addr_space_to_str[new_smi->io.addr_space],
|
||||||
new_smi->io.addr_data,
|
new_smi->io.addr_data,
|
||||||
new_smi->io.slave_addr, new_smi->io.irq);
|
new_smi->io.slave_addr, new_smi->io.irq);
|
||||||
|
|
||||||
|
@ -2289,7 +2289,7 @@ void ipmi_si_remove_by_data(int addr_space, enum si_type si_type,
|
||||||
|
|
||||||
mutex_lock(&smi_infos_lock);
|
mutex_lock(&smi_infos_lock);
|
||||||
list_for_each_entry_safe(e, tmp_e, &smi_infos, link) {
|
list_for_each_entry_safe(e, tmp_e, &smi_infos, link) {
|
||||||
if (e->io.addr_type != addr_space)
|
if (e->io.addr_space != addr_space)
|
||||||
continue;
|
continue;
|
||||||
if (e->io.si_type != si_type)
|
if (e->io.si_type != si_type)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -15,7 +15,7 @@ static int __init ipmi_parisc_probe(struct parisc_device *dev)
|
||||||
|
|
||||||
io.si_type = SI_KCS;
|
io.si_type = SI_KCS;
|
||||||
io.addr_source = SI_DEVICETREE;
|
io.addr_source = SI_DEVICETREE;
|
||||||
io.addr_type = IPMI_MEM_ADDR_SPACE;
|
io.addr_space = IPMI_MEM_ADDR_SPACE;
|
||||||
io.addr_data = dev->hpa.start;
|
io.addr_data = dev->hpa.start;
|
||||||
io.regsize = 1;
|
io.regsize = 1;
|
||||||
io.regspacing = 1;
|
io.regspacing = 1;
|
||||||
|
|
|
@ -107,10 +107,10 @@ static int ipmi_pci_probe(struct pci_dev *pdev,
|
||||||
io.addr_source_data = pdev;
|
io.addr_source_data = pdev;
|
||||||
|
|
||||||
if (pci_resource_flags(pdev, 0) & IORESOURCE_IO) {
|
if (pci_resource_flags(pdev, 0) & IORESOURCE_IO) {
|
||||||
io.addr_type = IPMI_IO_ADDR_SPACE;
|
io.addr_space = IPMI_IO_ADDR_SPACE;
|
||||||
io.io_setup = ipmi_si_port_setup;
|
io.io_setup = ipmi_si_port_setup;
|
||||||
} else {
|
} else {
|
||||||
io.addr_type = IPMI_MEM_ADDR_SPACE;
|
io.addr_space = IPMI_MEM_ADDR_SPACE;
|
||||||
io.io_setup = ipmi_si_mem_setup;
|
io.io_setup = ipmi_si_mem_setup;
|
||||||
}
|
}
|
||||||
io.addr_data = pci_resource_start(pdev, 0);
|
io.addr_data = pci_resource_start(pdev, 0);
|
||||||
|
|
|
@ -107,11 +107,11 @@ ipmi_get_info_from_resources(struct platform_device *pdev,
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
|
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
|
||||||
if (res) {
|
if (res) {
|
||||||
io->addr_type = IPMI_IO_ADDR_SPACE;
|
io->addr_space = IPMI_IO_ADDR_SPACE;
|
||||||
} else {
|
} else {
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
if (res)
|
if (res)
|
||||||
io->addr_type = IPMI_MEM_ADDR_SPACE;
|
io->addr_space = IPMI_MEM_ADDR_SPACE;
|
||||||
}
|
}
|
||||||
if (!res) {
|
if (!res) {
|
||||||
dev_err(&pdev->dev, "no I/O or memory address\n");
|
dev_err(&pdev->dev, "no I/O or memory address\n");
|
||||||
|
@ -121,7 +121,7 @@ ipmi_get_info_from_resources(struct platform_device *pdev,
|
||||||
|
|
||||||
io->regspacing = DEFAULT_REGSPACING;
|
io->regspacing = DEFAULT_REGSPACING;
|
||||||
res_second = platform_get_resource(pdev,
|
res_second = platform_get_resource(pdev,
|
||||||
(io->addr_type == IPMI_IO_ADDR_SPACE) ?
|
(io->addr_space == IPMI_IO_ADDR_SPACE) ?
|
||||||
IORESOURCE_IO : IORESOURCE_MEM,
|
IORESOURCE_IO : IORESOURCE_MEM,
|
||||||
1);
|
1);
|
||||||
if (res_second) {
|
if (res_second) {
|
||||||
|
@ -205,7 +205,7 @@ static int platform_ipmi_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
pr_info("ipmi_si: %s: %s %#lx regsize %d spacing %d irq %d\n",
|
pr_info("ipmi_si: %s: %s %#lx regsize %d spacing %d irq %d\n",
|
||||||
ipmi_addr_src_to_str(addr_source),
|
ipmi_addr_src_to_str(addr_source),
|
||||||
(io.addr_type == IPMI_IO_ADDR_SPACE) ? "io" : "mem",
|
(io.addr_space == IPMI_IO_ADDR_SPACE) ? "io" : "mem",
|
||||||
io.addr_data, io.regsize, io.regspacing, io.irq);
|
io.addr_data, io.regsize, io.regspacing, io.irq);
|
||||||
|
|
||||||
ipmi_si_add_smi(&io);
|
ipmi_si_add_smi(&io);
|
||||||
|
@ -277,9 +277,9 @@ static int of_ipmi_probe(struct platform_device *pdev)
|
||||||
io.irq_setup = ipmi_std_irq_setup;
|
io.irq_setup = ipmi_std_irq_setup;
|
||||||
|
|
||||||
if (resource.flags & IORESOURCE_IO)
|
if (resource.flags & IORESOURCE_IO)
|
||||||
io.addr_type = IPMI_IO_ADDR_SPACE;
|
io.addr_space = IPMI_IO_ADDR_SPACE;
|
||||||
else
|
else
|
||||||
io.addr_type = IPMI_MEM_ADDR_SPACE;
|
io.addr_space = IPMI_MEM_ADDR_SPACE;
|
||||||
|
|
||||||
io.addr_data = resource.start;
|
io.addr_data = resource.start;
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ static int find_slave_address(struct si_sm_io *io, int slave_addr)
|
||||||
if (!slave_addr) {
|
if (!slave_addr) {
|
||||||
u32 flags = IORESOURCE_IO;
|
u32 flags = IORESOURCE_IO;
|
||||||
|
|
||||||
if (io->addr_type == IPMI_MEM_ADDR_SPACE)
|
if (io->addr_space == IPMI_MEM_ADDR_SPACE)
|
||||||
flags = IORESOURCE_MEM;
|
flags = IORESOURCE_MEM;
|
||||||
|
|
||||||
slave_addr = ipmi_dmi_get_slave_addr(io->si_type, flags,
|
slave_addr = ipmi_dmi_get_slave_addr(io->si_type, flags,
|
||||||
|
|
|
@ -26,6 +26,10 @@ enum si_type {
|
||||||
SI_TYPE_INVALID, SI_KCS, SI_SMIC, SI_BT
|
SI_TYPE_INVALID, SI_KCS, SI_SMIC, SI_BT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ipmi_addr_space {
|
||||||
|
IPMI_IO_ADDR_SPACE, IPMI_MEM_ADDR_SPACE
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The structure for doing I/O in the state machine. The state
|
* The structure for doing I/O in the state machine. The state
|
||||||
* machine doesn't have the actual I/O routines, they are done through
|
* machine doesn't have the actual I/O routines, they are done through
|
||||||
|
@ -45,7 +49,7 @@ struct si_sm_io {
|
||||||
unsigned int regspacing;
|
unsigned int regspacing;
|
||||||
unsigned int regsize;
|
unsigned int regsize;
|
||||||
unsigned int regshift;
|
unsigned int regshift;
|
||||||
int addr_type;
|
enum ipmi_addr_space addr_space;
|
||||||
unsigned long addr_data;
|
unsigned long addr_data;
|
||||||
enum ipmi_addr_src addr_source; /* ACPI, PCI, SMBIOS, hardcode, etc. */
|
enum ipmi_addr_src addr_source; /* ACPI, PCI, SMBIOS, hardcode, etc. */
|
||||||
void (*addr_source_cleanup)(struct si_sm_io *io);
|
void (*addr_source_cleanup)(struct si_sm_io *io);
|
||||||
|
|
Loading…
Reference in New Issue