mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
f25eb44832
commit
f6296bdc49
|
@ -9,9 +9,6 @@
|
|||
#include <linux/interrupt.h>
|
||||
#include "ipmi_si_sm.h"
|
||||
|
||||
#define IPMI_IO_ADDR_SPACE 0
|
||||
#define IPMI_MEM_ADDR_SPACE 1
|
||||
|
||||
#define DEFAULT_REGSPACING 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);
|
||||
void ipmi_hardcode_init(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_shutdown(void);
|
||||
|
||||
|
|
|
@ -240,11 +240,11 @@ void ipmi_si_hardcode_exit(void)
|
|||
* Returns true of the given address exists as a hardcoded address,
|
||||
* 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;
|
||||
|
||||
if (addr_type == IPMI_IO_ADDR_SPACE) {
|
||||
if (addr_space == IPMI_IO_ADDR_SPACE) {
|
||||
for (i = 0; i < num_ports; i++) {
|
||||
if (ports[i] == addr)
|
||||
return 1;
|
||||
|
|
|
@ -106,7 +106,7 @@ static int hotmod_handler(const char *val, const struct kernel_param *kp)
|
|||
char *next, *curr, *s, *n, *o;
|
||||
enum hotmod_op op;
|
||||
enum si_type si_type;
|
||||
int addr_space;
|
||||
enum ipmi_addr_space addr_space;
|
||||
unsigned long addr;
|
||||
int regspacing;
|
||||
int regsize;
|
||||
|
@ -150,9 +150,10 @@ static int hotmod_handler(const char *val, const struct kernel_param *kp)
|
|||
break;
|
||||
si_type = ival;
|
||||
|
||||
rv = parse_str(hotmod_as, &addr_space, "address space", &curr);
|
||||
rv = parse_str(hotmod_as, &ival, "address space", &curr);
|
||||
if (rv)
|
||||
break;
|
||||
addr_space = ival;
|
||||
|
||||
s = strchr(curr, ',');
|
||||
if (s) {
|
||||
|
@ -215,7 +216,7 @@ static int hotmod_handler(const char *val, const struct kernel_param *kp)
|
|||
io.addr_source = SI_HOTMOD;
|
||||
io.si_type = si_type;
|
||||
io.addr_data = addr;
|
||||
io.addr_type = addr_space;
|
||||
io.addr_space = addr_space;
|
||||
|
||||
io.addr = NULL;
|
||||
io.regspacing = regspacing;
|
||||
|
|
|
@ -1645,7 +1645,7 @@ static ssize_t ipmi_params_show(struct device *dev,
|
|||
return snprintf(buf, 200,
|
||||
"%s,%s,0x%lx,rsp=%d,rsi=%d,rsh=%d,irq=%d,ipmb=%d\n",
|
||||
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.regspacing,
|
||||
smi_info->io.regsize,
|
||||
|
@ -1843,7 +1843,7 @@ static struct smi_info *find_dup_si(struct smi_info *info)
|
|||
struct smi_info *e;
|
||||
|
||||
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;
|
||||
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.
|
||||
*/
|
||||
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,
|
||||
"Hard-coded device at this address already exists");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
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;
|
||||
} 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;
|
||||
} else {
|
||||
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",
|
||||
ipmi_addr_src_to_str(new_smi->io.addr_source),
|
||||
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.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);
|
||||
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;
|
||||
if (e->io.si_type != si_type)
|
||||
continue;
|
||||
|
|
|
@ -15,7 +15,7 @@ static int __init ipmi_parisc_probe(struct parisc_device *dev)
|
|||
|
||||
io.si_type = SI_KCS;
|
||||
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.regsize = 1;
|
||||
io.regspacing = 1;
|
||||
|
|
|
@ -107,10 +107,10 @@ static int ipmi_pci_probe(struct pci_dev *pdev,
|
|||
io.addr_source_data = pdev;
|
||||
|
||||
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;
|
||||
} else {
|
||||
io.addr_type = IPMI_MEM_ADDR_SPACE;
|
||||
io.addr_space = IPMI_MEM_ADDR_SPACE;
|
||||
io.io_setup = ipmi_si_mem_setup;
|
||||
}
|
||||
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);
|
||||
if (res) {
|
||||
io->addr_type = IPMI_IO_ADDR_SPACE;
|
||||
io->addr_space = IPMI_IO_ADDR_SPACE;
|
||||
} else {
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (res)
|
||||
io->addr_type = IPMI_MEM_ADDR_SPACE;
|
||||
io->addr_space = IPMI_MEM_ADDR_SPACE;
|
||||
}
|
||||
if (!res) {
|
||||
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;
|
||||
res_second = platform_get_resource(pdev,
|
||||
(io->addr_type == IPMI_IO_ADDR_SPACE) ?
|
||||
(io->addr_space == IPMI_IO_ADDR_SPACE) ?
|
||||
IORESOURCE_IO : IORESOURCE_MEM,
|
||||
1);
|
||||
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",
|
||||
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);
|
||||
|
||||
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;
|
||||
|
||||
if (resource.flags & IORESOURCE_IO)
|
||||
io.addr_type = IPMI_IO_ADDR_SPACE;
|
||||
io.addr_space = IPMI_IO_ADDR_SPACE;
|
||||
else
|
||||
io.addr_type = IPMI_MEM_ADDR_SPACE;
|
||||
io.addr_space = IPMI_MEM_ADDR_SPACE;
|
||||
|
||||
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) {
|
||||
u32 flags = IORESOURCE_IO;
|
||||
|
||||
if (io->addr_type == IPMI_MEM_ADDR_SPACE)
|
||||
if (io->addr_space == IPMI_MEM_ADDR_SPACE)
|
||||
flags = IORESOURCE_MEM;
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
enum ipmi_addr_space {
|
||||
IPMI_IO_ADDR_SPACE, IPMI_MEM_ADDR_SPACE
|
||||
};
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
@ -45,7 +49,7 @@ struct si_sm_io {
|
|||
unsigned int regspacing;
|
||||
unsigned int regsize;
|
||||
unsigned int regshift;
|
||||
int addr_type;
|
||||
enum ipmi_addr_space addr_space;
|
||||
unsigned long addr_data;
|
||||
enum ipmi_addr_src addr_source; /* ACPI, PCI, SMBIOS, hardcode, etc. */
|
||||
void (*addr_source_cleanup)(struct si_sm_io *io);
|
||||
|
|
Loading…
Reference in New Issue