diff options
author | Myron Stowe <myron.stowe@hp.com> | 2010-05-26 17:43:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 12:12:50 -0400 |
commit | 279fbd0c5daa60c76e59df33f436ca2300f2b603 (patch) | |
tree | d6907cdc8be44070ef79b82ddcc1c05cdf72804e /drivers/char | |
parent | 8c8eae2742d5ad05ef6e5b53c88e70a5231d7d9a (diff) |
ipmi: update driver to use dev_printk and its constructs
Update core IPMI driver printk()'s with dev_printk(), and its constructs,
to provide additional device topology information.
An example of the additional device topology for a PNP device -
ipmi_si 00:02: probing via ACPI
ipmi_si 00:02: [io 0x0ca2-0x0ca3] regsize 1 spacing 1 irq 0
ipmi_si 00:02: Found new BMC (man_id: 0x00000b, prod_id: 0x0000, ...
ipmi_si 00:02: IPMI kcs interface initialized
and for a PCI device -
ipmi_si 0000:01:04.6: probing via PCI
ipmi_si 0000:01:04.6: PCI INT A -> GSI 21 (level, low) -> IRQ 21
ipmi_si 0000:01:04.6: [mem 0xf1ef0000-0xf1ef00ff] regsize 1 spaci...
ipmi_si 0000:01:04.6: IPMI kcs interface initialized
[minyard@acm.org: rework to fix rejects, extended it a bit]
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Myron Stowe <myron.stowe@hp.com>
Signed-off-by: Corey Minyard <minyard@acm.org>
Cc: Zhao Yakui <yakui.zhao@intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/ipmi/ipmi_msghandler.c | 11 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_si_intf.c | 223 |
2 files changed, 107 insertions, 127 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 5de4bb99cb97..4f3f8c9ec262 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -2505,12 +2505,11 @@ static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum, | |||
2505 | return rv; | 2505 | return rv; |
2506 | } | 2506 | } |
2507 | 2507 | ||
2508 | printk(KERN_INFO | 2508 | dev_info(intf->si_dev, "Found new BMC (man_id: 0x%6.6x, " |
2509 | "ipmi: Found new BMC (man_id: 0x%6.6x, " | 2509 | "prod_id: 0x%4.4x, dev_id: 0x%2.2x)\n", |
2510 | " prod_id: 0x%4.4x, dev_id: 0x%2.2x)\n", | 2510 | bmc->id.manufacturer_id, |
2511 | bmc->id.manufacturer_id, | 2511 | bmc->id.product_id, |
2512 | bmc->id.product_id, | 2512 | bmc->id.device_id); |
2513 | bmc->id.device_id); | ||
2514 | } | 2513 | } |
2515 | 2514 | ||
2516 | /* | 2515 | /* |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 31bbcbdd178a..f052c481327a 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -588,9 +588,8 @@ static void handle_transaction_done(struct smi_info *smi_info) | |||
588 | smi_info->handlers->get_result(smi_info->si_sm, msg, 3); | 588 | smi_info->handlers->get_result(smi_info->si_sm, msg, 3); |
589 | if (msg[2] != 0) { | 589 | if (msg[2] != 0) { |
590 | /* Error clearing flags */ | 590 | /* Error clearing flags */ |
591 | printk(KERN_WARNING | 591 | dev_warn(smi_info->dev, |
592 | "ipmi_si: Error clearing flags: %2.2x\n", | 592 | "Error clearing flags: %2.2x\n", msg[2]); |
593 | msg[2]); | ||
594 | } | 593 | } |
595 | if (smi_info->si_state == SI_CLEARING_FLAGS_THEN_SET_IRQ) | 594 | if (smi_info->si_state == SI_CLEARING_FLAGS_THEN_SET_IRQ) |
596 | start_enable_irq(smi_info); | 595 | start_enable_irq(smi_info); |
@@ -682,9 +681,8 @@ static void handle_transaction_done(struct smi_info *smi_info) | |||
682 | /* We got the flags from the SMI, now handle them. */ | 681 | /* We got the flags from the SMI, now handle them. */ |
683 | smi_info->handlers->get_result(smi_info->si_sm, msg, 4); | 682 | smi_info->handlers->get_result(smi_info->si_sm, msg, 4); |
684 | if (msg[2] != 0) { | 683 | if (msg[2] != 0) { |
685 | printk(KERN_WARNING | 684 | dev_warn(smi_info->dev, "Could not enable interrupts" |
686 | "ipmi_si: Could not enable interrupts" | 685 | ", failed get, using polled mode.\n"); |
687 | ", failed get, using polled mode.\n"); | ||
688 | smi_info->si_state = SI_NORMAL; | 686 | smi_info->si_state = SI_NORMAL; |
689 | } else { | 687 | } else { |
690 | msg[0] = (IPMI_NETFN_APP_REQUEST << 2); | 688 | msg[0] = (IPMI_NETFN_APP_REQUEST << 2); |
@@ -705,13 +703,11 @@ static void handle_transaction_done(struct smi_info *smi_info) | |||
705 | 703 | ||
706 | /* We got the flags from the SMI, now handle them. */ | 704 | /* We got the flags from the SMI, now handle them. */ |
707 | smi_info->handlers->get_result(smi_info->si_sm, msg, 4); | 705 | smi_info->handlers->get_result(smi_info->si_sm, msg, 4); |
708 | if (msg[2] != 0) { | 706 | if (msg[2] != 0) |
709 | printk(KERN_WARNING | 707 | dev_warn(smi_info->dev, "Could not enable interrupts" |
710 | "ipmi_si: Could not enable interrupts" | 708 | ", failed set, using polled mode.\n"); |
711 | ", failed set, using polled mode.\n"); | 709 | else |
712 | } else { | ||
713 | smi_info->interrupt_disabled = 0; | 710 | smi_info->interrupt_disabled = 0; |
714 | } | ||
715 | smi_info->si_state = SI_NORMAL; | 711 | smi_info->si_state = SI_NORMAL; |
716 | break; | 712 | break; |
717 | } | 713 | } |
@@ -723,9 +719,8 @@ static void handle_transaction_done(struct smi_info *smi_info) | |||
723 | /* We got the flags from the SMI, now handle them. */ | 719 | /* We got the flags from the SMI, now handle them. */ |
724 | smi_info->handlers->get_result(smi_info->si_sm, msg, 4); | 720 | smi_info->handlers->get_result(smi_info->si_sm, msg, 4); |
725 | if (msg[2] != 0) { | 721 | if (msg[2] != 0) { |
726 | printk(KERN_WARNING | 722 | dev_warn(smi_info->dev, "Could not disable interrupts" |
727 | "ipmi_si: Could not disable interrupts" | 723 | ", failed get.\n"); |
728 | ", failed get.\n"); | ||
729 | smi_info->si_state = SI_NORMAL; | 724 | smi_info->si_state = SI_NORMAL; |
730 | } else { | 725 | } else { |
731 | msg[0] = (IPMI_NETFN_APP_REQUEST << 2); | 726 | msg[0] = (IPMI_NETFN_APP_REQUEST << 2); |
@@ -747,9 +742,8 @@ static void handle_transaction_done(struct smi_info *smi_info) | |||
747 | /* We got the flags from the SMI, now handle them. */ | 742 | /* We got the flags from the SMI, now handle them. */ |
748 | smi_info->handlers->get_result(smi_info->si_sm, msg, 4); | 743 | smi_info->handlers->get_result(smi_info->si_sm, msg, 4); |
749 | if (msg[2] != 0) { | 744 | if (msg[2] != 0) { |
750 | printk(KERN_WARNING | 745 | dev_warn(smi_info->dev, "Could not disable interrupts" |
751 | "ipmi_si: Could not disable interrupts" | 746 | ", failed set.\n"); |
752 | ", failed set.\n"); | ||
753 | } | 747 | } |
754 | smi_info->si_state = SI_NORMAL; | 748 | smi_info->si_state = SI_NORMAL; |
755 | break; | 749 | break; |
@@ -1167,10 +1161,10 @@ static int smi_start_processing(void *send_info, | |||
1167 | new_smi->thread = kthread_run(ipmi_thread, new_smi, | 1161 | new_smi->thread = kthread_run(ipmi_thread, new_smi, |
1168 | "kipmi%d", new_smi->intf_num); | 1162 | "kipmi%d", new_smi->intf_num); |
1169 | if (IS_ERR(new_smi->thread)) { | 1163 | if (IS_ERR(new_smi->thread)) { |
1170 | printk(KERN_NOTICE "ipmi_si_intf: Could not start" | 1164 | dev_notice(new_smi->dev, "Could not start" |
1171 | " kernel thread due to error %ld, only using" | 1165 | " kernel thread due to error %ld, only using" |
1172 | " timers to drive the interface\n", | 1166 | " timers to drive the interface\n", |
1173 | PTR_ERR(new_smi->thread)); | 1167 | PTR_ERR(new_smi->thread)); |
1174 | new_smi->thread = NULL; | 1168 | new_smi->thread = NULL; |
1175 | } | 1169 | } |
1176 | } | 1170 | } |
@@ -1331,14 +1325,13 @@ static int std_irq_setup(struct smi_info *info) | |||
1331 | DEVICE_NAME, | 1325 | DEVICE_NAME, |
1332 | info); | 1326 | info); |
1333 | if (rv) { | 1327 | if (rv) { |
1334 | printk(KERN_WARNING | 1328 | dev_warn(info->dev, "%s unable to claim interrupt %d," |
1335 | "ipmi_si: %s unable to claim interrupt %d," | 1329 | " running polled\n", |
1336 | " running polled\n", | 1330 | DEVICE_NAME, info->irq); |
1337 | DEVICE_NAME, info->irq); | ||
1338 | info->irq = 0; | 1331 | info->irq = 0; |
1339 | } else { | 1332 | } else { |
1340 | info->irq_cleanup = std_irq_cleanup; | 1333 | info->irq_cleanup = std_irq_cleanup; |
1341 | printk(" Using irq %d\n", info->irq); | 1334 | dev_info(info->dev, "Using irq %d\n", info->irq); |
1342 | } | 1335 | } |
1343 | 1336 | ||
1344 | return rv; | 1337 | return rv; |
@@ -1429,8 +1422,8 @@ static int port_setup(struct smi_info *info) | |||
1429 | info->io.outputb = port_outl; | 1422 | info->io.outputb = port_outl; |
1430 | break; | 1423 | break; |
1431 | default: | 1424 | default: |
1432 | printk(KERN_WARNING "ipmi_si: Invalid register size: %d\n", | 1425 | dev_warn(info->dev, "Invalid register size: %d\n", |
1433 | info->io.regsize); | 1426 | info->io.regsize); |
1434 | return -EINVAL; | 1427 | return -EINVAL; |
1435 | } | 1428 | } |
1436 | 1429 | ||
@@ -1552,8 +1545,8 @@ static int mem_setup(struct smi_info *info) | |||
1552 | break; | 1545 | break; |
1553 | #endif | 1546 | #endif |
1554 | default: | 1547 | default: |
1555 | printk(KERN_WARNING "ipmi_si: Invalid register size: %d\n", | 1548 | dev_warn(info->dev, "Invalid register size: %d\n", |
1556 | info->io.regsize); | 1549 | info->io.regsize); |
1557 | return -EINVAL; | 1550 | return -EINVAL; |
1558 | } | 1551 | } |
1559 | 1552 | ||
@@ -1839,6 +1832,7 @@ static __devinit void hardcode_find_bmc(void) | |||
1839 | return; | 1832 | return; |
1840 | 1833 | ||
1841 | info->addr_source = SI_HARDCODED; | 1834 | info->addr_source = SI_HARDCODED; |
1835 | printk(KERN_INFO PFX "probing via hardcoded address\n"); | ||
1842 | 1836 | ||
1843 | if (!si_type[i] || strcmp(si_type[i], "kcs") == 0) { | 1837 | if (!si_type[i] || strcmp(si_type[i], "kcs") == 0) { |
1844 | info->si_type = SI_KCS; | 1838 | info->si_type = SI_KCS; |
@@ -1847,8 +1841,7 @@ static __devinit void hardcode_find_bmc(void) | |||
1847 | } else if (strcmp(si_type[i], "bt") == 0) { | 1841 | } else if (strcmp(si_type[i], "bt") == 0) { |
1848 | info->si_type = SI_BT; | 1842 | info->si_type = SI_BT; |
1849 | } else { | 1843 | } else { |
1850 | printk(KERN_WARNING | 1844 | printk(KERN_WARNING PFX "Interface type specified " |
1851 | "ipmi_si: Interface type specified " | ||
1852 | "for interface %d, was invalid: %s\n", | 1845 | "for interface %d, was invalid: %s\n", |
1853 | i, si_type[i]); | 1846 | i, si_type[i]); |
1854 | kfree(info); | 1847 | kfree(info); |
@@ -1866,11 +1859,9 @@ static __devinit void hardcode_find_bmc(void) | |||
1866 | info->io.addr_data = addrs[i]; | 1859 | info->io.addr_data = addrs[i]; |
1867 | info->io.addr_type = IPMI_MEM_ADDR_SPACE; | 1860 | info->io.addr_type = IPMI_MEM_ADDR_SPACE; |
1868 | } else { | 1861 | } else { |
1869 | printk(KERN_WARNING | 1862 | printk(KERN_WARNING PFX "Interface type specified " |
1870 | "ipmi_si: Interface type specified " | 1863 | "for interface %d, but port and address were " |
1871 | "for interface %d, " | 1864 | "not set or set to zero.\n", i); |
1872 | "but port and address were not set or " | ||
1873 | "set to zero.\n", i); | ||
1874 | kfree(info); | 1865 | kfree(info); |
1875 | continue; | 1866 | continue; |
1876 | } | 1867 | } |
@@ -1950,15 +1941,13 @@ static int acpi_gpe_irq_setup(struct smi_info *info) | |||
1950 | &ipmi_acpi_gpe, | 1941 | &ipmi_acpi_gpe, |
1951 | info); | 1942 | info); |
1952 | if (status != AE_OK) { | 1943 | if (status != AE_OK) { |
1953 | printk(KERN_WARNING | 1944 | dev_warn(info->dev, "%s unable to claim ACPI GPE %d," |
1954 | "ipmi_si: %s unable to claim ACPI GPE %d," | 1945 | " running polled\n", DEVICE_NAME, info->irq); |
1955 | " running polled\n", | ||
1956 | DEVICE_NAME, info->irq); | ||
1957 | info->irq = 0; | 1946 | info->irq = 0; |
1958 | return -EINVAL; | 1947 | return -EINVAL; |
1959 | } else { | 1948 | } else { |
1960 | info->irq_cleanup = acpi_gpe_irq_cleanup; | 1949 | info->irq_cleanup = acpi_gpe_irq_cleanup; |
1961 | printk(" Using ACPI GPE %d\n", info->irq); | 1950 | dev_info(info->dev, "Using ACPI GPE %d\n", info->irq); |
1962 | return 0; | 1951 | return 0; |
1963 | } | 1952 | } |
1964 | } | 1953 | } |
@@ -2016,8 +2005,8 @@ static __devinit int try_init_spmi(struct SPMITable *spmi) | |||
2016 | u8 addr_space; | 2005 | u8 addr_space; |
2017 | 2006 | ||
2018 | if (spmi->IPMIlegacy != 1) { | 2007 | if (spmi->IPMIlegacy != 1) { |
2019 | printk(KERN_INFO "IPMI: Bad SPMI legacy %d\n", spmi->IPMIlegacy); | 2008 | printk(KERN_INFO PFX "Bad SPMI legacy %d\n", spmi->IPMIlegacy); |
2020 | return -ENODEV; | 2009 | return -ENODEV; |
2021 | } | 2010 | } |
2022 | 2011 | ||
2023 | if (spmi->addr.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) | 2012 | if (spmi->addr.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) |
@@ -2027,11 +2016,12 @@ static __devinit int try_init_spmi(struct SPMITable *spmi) | |||
2027 | 2016 | ||
2028 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 2017 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
2029 | if (!info) { | 2018 | if (!info) { |
2030 | printk(KERN_ERR "ipmi_si: Could not allocate SI data (3)\n"); | 2019 | printk(KERN_ERR PFX "Could not allocate SI data (3)\n"); |
2031 | return -ENOMEM; | 2020 | return -ENOMEM; |
2032 | } | 2021 | } |
2033 | 2022 | ||
2034 | info->addr_source = SI_SPMI; | 2023 | info->addr_source = SI_SPMI; |
2024 | printk(KERN_INFO PFX "probing via SPMI\n"); | ||
2035 | 2025 | ||
2036 | /* Figure out the interface type. */ | 2026 | /* Figure out the interface type. */ |
2037 | switch (spmi->InterfaceType) { | 2027 | switch (spmi->InterfaceType) { |
@@ -2045,8 +2035,8 @@ static __devinit int try_init_spmi(struct SPMITable *spmi) | |||
2045 | info->si_type = SI_BT; | 2035 | info->si_type = SI_BT; |
2046 | break; | 2036 | break; |
2047 | default: | 2037 | default: |
2048 | printk(KERN_INFO "ipmi_si: Unknown ACPI/SPMI SI type %d\n", | 2038 | printk(KERN_INFO PFX "Unknown ACPI/SPMI SI type %d\n", |
2049 | spmi->InterfaceType); | 2039 | spmi->InterfaceType); |
2050 | kfree(info); | 2040 | kfree(info); |
2051 | return -EIO; | 2041 | return -EIO; |
2052 | } | 2042 | } |
@@ -2082,8 +2072,7 @@ static __devinit int try_init_spmi(struct SPMITable *spmi) | |||
2082 | info->io.addr_type = IPMI_IO_ADDR_SPACE; | 2072 | info->io.addr_type = IPMI_IO_ADDR_SPACE; |
2083 | } else { | 2073 | } else { |
2084 | kfree(info); | 2074 | kfree(info); |
2085 | printk(KERN_WARNING | 2075 | printk(KERN_WARNING PFX "Unknown ACPI I/O Address type\n"); |
2086 | "ipmi_si: Unknown ACPI I/O Address type\n"); | ||
2087 | return -EIO; | 2076 | return -EIO; |
2088 | } | 2077 | } |
2089 | info->io.addr_data = spmi->addr.address; | 2078 | info->io.addr_data = spmi->addr.address; |
@@ -2120,6 +2109,7 @@ static int __devinit ipmi_pnp_probe(struct pnp_dev *dev, | |||
2120 | { | 2109 | { |
2121 | struct acpi_device *acpi_dev; | 2110 | struct acpi_device *acpi_dev; |
2122 | struct smi_info *info; | 2111 | struct smi_info *info; |
2112 | struct resource *res; | ||
2123 | acpi_handle handle; | 2113 | acpi_handle handle; |
2124 | acpi_status status; | 2114 | acpi_status status; |
2125 | unsigned long long tmp; | 2115 | unsigned long long tmp; |
@@ -2133,6 +2123,7 @@ static int __devinit ipmi_pnp_probe(struct pnp_dev *dev, | |||
2133 | return -ENOMEM; | 2123 | return -ENOMEM; |
2134 | 2124 | ||
2135 | info->addr_source = SI_ACPI; | 2125 | info->addr_source = SI_ACPI; |
2126 | printk(KERN_INFO PFX "probing via ACPI\n"); | ||
2136 | 2127 | ||
2137 | handle = acpi_dev->handle; | 2128 | handle = acpi_dev->handle; |
2138 | 2129 | ||
@@ -2152,22 +2143,26 @@ static int __devinit ipmi_pnp_probe(struct pnp_dev *dev, | |||
2152 | info->si_type = SI_BT; | 2143 | info->si_type = SI_BT; |
2153 | break; | 2144 | break; |
2154 | default: | 2145 | default: |
2155 | dev_info(&dev->dev, "unknown interface type %lld\n", tmp); | 2146 | dev_info(&dev->dev, "unknown IPMI type %lld\n", tmp); |
2156 | goto err_free; | 2147 | goto err_free; |
2157 | } | 2148 | } |
2158 | 2149 | ||
2159 | if (pnp_port_valid(dev, 0)) { | 2150 | res = pnp_get_resource(dev, IORESOURCE_IO, 0); |
2151 | if (res) { | ||
2160 | info->io_setup = port_setup; | 2152 | info->io_setup = port_setup; |
2161 | info->io.addr_type = IPMI_IO_ADDR_SPACE; | 2153 | info->io.addr_type = IPMI_IO_ADDR_SPACE; |
2162 | info->io.addr_data = pnp_port_start(dev, 0); | ||
2163 | } else if (pnp_mem_valid(dev, 0)) { | ||
2164 | info->io_setup = mem_setup; | ||
2165 | info->io.addr_type = IPMI_MEM_ADDR_SPACE; | ||
2166 | info->io.addr_data = pnp_mem_start(dev, 0); | ||
2167 | } else { | 2154 | } else { |
2155 | res = pnp_get_resource(dev, IORESOURCE_MEM, 0); | ||
2156 | if (res) { | ||
2157 | info->io_setup = mem_setup; | ||
2158 | info->io.addr_type = IPMI_MEM_ADDR_SPACE; | ||
2159 | } | ||
2160 | } | ||
2161 | if (!res) { | ||
2168 | dev_err(&dev->dev, "no I/O or memory address\n"); | 2162 | dev_err(&dev->dev, "no I/O or memory address\n"); |
2169 | goto err_free; | 2163 | goto err_free; |
2170 | } | 2164 | } |
2165 | info->io.addr_data = res->start; | ||
2171 | 2166 | ||
2172 | info->io.regspacing = DEFAULT_REGSPACING; | 2167 | info->io.regspacing = DEFAULT_REGSPACING; |
2173 | info->io.regsize = DEFAULT_REGSPACING; | 2168 | info->io.regsize = DEFAULT_REGSPACING; |
@@ -2186,6 +2181,10 @@ static int __devinit ipmi_pnp_probe(struct pnp_dev *dev, | |||
2186 | info->dev = &dev->dev; | 2181 | info->dev = &dev->dev; |
2187 | pnp_set_drvdata(dev, info); | 2182 | pnp_set_drvdata(dev, info); |
2188 | 2183 | ||
2184 | dev_info(info->dev, "%pR regsize %d spacing %d irq %d\n", | ||
2185 | res, info->io.regsize, info->io.regspacing, | ||
2186 | info->irq); | ||
2187 | |||
2189 | return add_smi(info); | 2188 | return add_smi(info); |
2190 | 2189 | ||
2191 | err_free: | 2190 | err_free: |
@@ -2291,12 +2290,12 @@ static __devinit void try_init_dmi(struct dmi_ipmi_data *ipmi_data) | |||
2291 | 2290 | ||
2292 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 2291 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
2293 | if (!info) { | 2292 | if (!info) { |
2294 | printk(KERN_ERR | 2293 | printk(KERN_ERR PFX "Could not allocate SI data\n"); |
2295 | "ipmi_si: Could not allocate SI data\n"); | ||
2296 | return; | 2294 | return; |
2297 | } | 2295 | } |
2298 | 2296 | ||
2299 | info->addr_source = SI_SMBIOS; | 2297 | info->addr_source = SI_SMBIOS; |
2298 | printk(KERN_INFO PFX "probing via SMBIOS\n"); | ||
2300 | 2299 | ||
2301 | switch (ipmi_data->type) { | 2300 | switch (ipmi_data->type) { |
2302 | case 0x01: /* KCS */ | 2301 | case 0x01: /* KCS */ |
@@ -2326,8 +2325,7 @@ static __devinit void try_init_dmi(struct dmi_ipmi_data *ipmi_data) | |||
2326 | 2325 | ||
2327 | default: | 2326 | default: |
2328 | kfree(info); | 2327 | kfree(info); |
2329 | printk(KERN_WARNING | 2328 | printk(KERN_WARNING PFX "Unknown SMBIOS I/O Address type: %d\n", |
2330 | "ipmi_si: Unknown SMBIOS I/O Address type: %d.\n", | ||
2331 | ipmi_data->addr_space); | 2329 | ipmi_data->addr_space); |
2332 | return; | 2330 | return; |
2333 | } | 2331 | } |
@@ -2396,6 +2394,7 @@ static int __devinit ipmi_pci_probe(struct pci_dev *pdev, | |||
2396 | return -ENOMEM; | 2394 | return -ENOMEM; |
2397 | 2395 | ||
2398 | info->addr_source = SI_PCI; | 2396 | info->addr_source = SI_PCI; |
2397 | dev_info(&pdev->dev, "probing via PCI"); | ||
2399 | 2398 | ||
2400 | switch (class_type) { | 2399 | switch (class_type) { |
2401 | case PCI_ERMC_CLASSCODE_TYPE_SMIC: | 2400 | case PCI_ERMC_CLASSCODE_TYPE_SMIC: |
@@ -2412,15 +2411,13 @@ static int __devinit ipmi_pci_probe(struct pci_dev *pdev, | |||
2412 | 2411 | ||
2413 | default: | 2412 | default: |
2414 | kfree(info); | 2413 | kfree(info); |
2415 | printk(KERN_INFO "ipmi_si: %s: Unknown IPMI type: %d\n", | 2414 | dev_info(&pdev->dev, "Unknown IPMI type: %d\n", class_type); |
2416 | pci_name(pdev), class_type); | ||
2417 | return -ENOMEM; | 2415 | return -ENOMEM; |
2418 | } | 2416 | } |
2419 | 2417 | ||
2420 | rv = pci_enable_device(pdev); | 2418 | rv = pci_enable_device(pdev); |
2421 | if (rv) { | 2419 | if (rv) { |
2422 | printk(KERN_ERR "ipmi_si: %s: couldn't enable PCI device\n", | 2420 | dev_err(&pdev->dev, "couldn't enable PCI device\n"); |
2423 | pci_name(pdev)); | ||
2424 | kfree(info); | 2421 | kfree(info); |
2425 | return rv; | 2422 | return rv; |
2426 | } | 2423 | } |
@@ -2448,6 +2445,10 @@ static int __devinit ipmi_pci_probe(struct pci_dev *pdev, | |||
2448 | info->dev = &pdev->dev; | 2445 | info->dev = &pdev->dev; |
2449 | pci_set_drvdata(pdev, info); | 2446 | pci_set_drvdata(pdev, info); |
2450 | 2447 | ||
2448 | dev_info(&pdev->dev, "%pR regsize %d spacing %d irq %d\n", | ||
2449 | &pdev->resource[0], info->io.regsize, info->io.regspacing, | ||
2450 | info->irq); | ||
2451 | |||
2451 | return add_smi(info); | 2452 | return add_smi(info); |
2452 | } | 2453 | } |
2453 | 2454 | ||
@@ -2500,7 +2501,7 @@ static int __devinit ipmi_of_probe(struct of_device *dev, | |||
2500 | int ret; | 2501 | int ret; |
2501 | int proplen; | 2502 | int proplen; |
2502 | 2503 | ||
2503 | dev_info(&dev->dev, PFX "probing via device tree\n"); | 2504 | dev_info(&dev->dev, "probing via device tree\n"); |
2504 | 2505 | ||
2505 | ret = of_address_to_resource(np, 0, &resource); | 2506 | ret = of_address_to_resource(np, 0, &resource); |
2506 | if (ret) { | 2507 | if (ret) { |
@@ -2530,7 +2531,7 @@ static int __devinit ipmi_of_probe(struct of_device *dev, | |||
2530 | 2531 | ||
2531 | if (!info) { | 2532 | if (!info) { |
2532 | dev_err(&dev->dev, | 2533 | dev_err(&dev->dev, |
2533 | PFX "could not allocate memory for OF probe\n"); | 2534 | "could not allocate memory for OF probe\n"); |
2534 | return -ENOMEM; | 2535 | return -ENOMEM; |
2535 | } | 2536 | } |
2536 | 2537 | ||
@@ -2555,7 +2556,7 @@ static int __devinit ipmi_of_probe(struct of_device *dev, | |||
2555 | info->irq = irq_of_parse_and_map(dev->dev.of_node, 0); | 2556 | info->irq = irq_of_parse_and_map(dev->dev.of_node, 0); |
2556 | info->dev = &dev->dev; | 2557 | info->dev = &dev->dev; |
2557 | 2558 | ||
2558 | dev_dbg(&dev->dev, "addr 0x%lx regsize %d spacing %d irq %x\n", | 2559 | dev_dbg(&dev->dev, "addr 0x%lx regsize %d spacing %d irq %d\n", |
2559 | info->io.addr_data, info->io.regsize, info->io.regspacing, | 2560 | info->io.addr_data, info->io.regsize, info->io.regspacing, |
2560 | info->irq); | 2561 | info->irq); |
2561 | 2562 | ||
@@ -2670,9 +2671,8 @@ static int try_enable_event_buffer(struct smi_info *smi_info) | |||
2670 | 2671 | ||
2671 | rv = wait_for_msg_done(smi_info); | 2672 | rv = wait_for_msg_done(smi_info); |
2672 | if (rv) { | 2673 | if (rv) { |
2673 | printk(KERN_WARNING | 2674 | printk(KERN_WARNING PFX "Error getting response from get" |
2674 | "ipmi_si: Error getting response from get global," | 2675 | " global enables command, the event buffer is not" |
2675 | " enables command, the event buffer is not" | ||
2676 | " enabled.\n"); | 2676 | " enabled.\n"); |
2677 | goto out; | 2677 | goto out; |
2678 | } | 2678 | } |
@@ -2684,10 +2684,8 @@ static int try_enable_event_buffer(struct smi_info *smi_info) | |||
2684 | resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 || | 2684 | resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 || |
2685 | resp[1] != IPMI_GET_BMC_GLOBAL_ENABLES_CMD || | 2685 | resp[1] != IPMI_GET_BMC_GLOBAL_ENABLES_CMD || |
2686 | resp[2] != 0) { | 2686 | resp[2] != 0) { |
2687 | printk(KERN_WARNING | 2687 | printk(KERN_WARNING PFX "Invalid return from get global" |
2688 | "ipmi_si: Invalid return from get global" | 2688 | " enables command, cannot enable the event buffer.\n"); |
2689 | " enables command, cannot enable the event" | ||
2690 | " buffer.\n"); | ||
2691 | rv = -EINVAL; | 2689 | rv = -EINVAL; |
2692 | goto out; | 2690 | goto out; |
2693 | } | 2691 | } |
@@ -2703,9 +2701,8 @@ static int try_enable_event_buffer(struct smi_info *smi_info) | |||
2703 | 2701 | ||
2704 | rv = wait_for_msg_done(smi_info); | 2702 | rv = wait_for_msg_done(smi_info); |
2705 | if (rv) { | 2703 | if (rv) { |
2706 | printk(KERN_WARNING | 2704 | printk(KERN_WARNING PFX "Error getting response from set" |
2707 | "ipmi_si: Error getting response from set global," | 2705 | " global, enables command, the event buffer is not" |
2708 | " enables command, the event buffer is not" | ||
2709 | " enabled.\n"); | 2706 | " enabled.\n"); |
2710 | goto out; | 2707 | goto out; |
2711 | } | 2708 | } |
@@ -2716,10 +2713,8 @@ static int try_enable_event_buffer(struct smi_info *smi_info) | |||
2716 | if (resp_len < 3 || | 2713 | if (resp_len < 3 || |
2717 | resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 || | 2714 | resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 || |
2718 | resp[1] != IPMI_SET_BMC_GLOBAL_ENABLES_CMD) { | 2715 | resp[1] != IPMI_SET_BMC_GLOBAL_ENABLES_CMD) { |
2719 | printk(KERN_WARNING | 2716 | printk(KERN_WARNING PFX "Invalid return from get global," |
2720 | "ipmi_si: Invalid return from get global," | 2717 | "enables command, not enable the event buffer.\n"); |
2721 | "enables command, not enable the event" | ||
2722 | " buffer.\n"); | ||
2723 | rv = -EINVAL; | 2718 | rv = -EINVAL; |
2724 | goto out; | 2719 | goto out; |
2725 | } | 2720 | } |
@@ -2993,7 +2988,7 @@ static __devinit void default_find_bmc(void) | |||
2993 | if (add_smi(info) == 0) { | 2988 | if (add_smi(info) == 0) { |
2994 | if ((try_smi_init(info)) == 0) { | 2989 | if ((try_smi_init(info)) == 0) { |
2995 | /* Found one... */ | 2990 | /* Found one... */ |
2996 | printk(KERN_INFO "ipmi_si: Found default %s" | 2991 | printk(KERN_INFO PFX "Found default %s" |
2997 | " state machine at %s address 0x%lx\n", | 2992 | " state machine at %s address 0x%lx\n", |
2998 | si_to_str[info->si_type], | 2993 | si_to_str[info->si_type], |
2999 | addr_space_to_str[info->io.addr_type], | 2994 | addr_space_to_str[info->io.addr_type], |
@@ -3022,12 +3017,12 @@ static int add_smi(struct smi_info *new_smi) | |||
3022 | { | 3017 | { |
3023 | int rv = 0; | 3018 | int rv = 0; |
3024 | 3019 | ||
3025 | printk(KERN_INFO "ipmi_si: Adding %s-specified %s state machine", | 3020 | printk(KERN_INFO PFX "Adding %s-specified %s state machine", |
3026 | ipmi_addr_src_to_str[new_smi->addr_source], | 3021 | ipmi_addr_src_to_str[new_smi->addr_source], |
3027 | si_to_str[new_smi->si_type]); | 3022 | si_to_str[new_smi->si_type]); |
3028 | mutex_lock(&smi_infos_lock); | 3023 | mutex_lock(&smi_infos_lock); |
3029 | if (!is_new_interface(new_smi)) { | 3024 | if (!is_new_interface(new_smi)) { |
3030 | printk(KERN_CONT ": duplicate interface\n"); | 3025 | printk(KERN_CONT PFX "duplicate interface\n"); |
3031 | rv = -EBUSY; | 3026 | rv = -EBUSY; |
3032 | goto out_err; | 3027 | goto out_err; |
3033 | } | 3028 | } |
@@ -3051,7 +3046,7 @@ static int try_smi_init(struct smi_info *new_smi) | |||
3051 | int rv = 0; | 3046 | int rv = 0; |
3052 | int i; | 3047 | int i; |
3053 | 3048 | ||
3054 | printk(KERN_INFO "ipmi_si: Trying %s-specified %s state" | 3049 | printk(KERN_INFO PFX "Trying %s-specified %s state" |
3055 | " machine at %s address 0x%lx, slave address 0x%x," | 3050 | " machine at %s address 0x%lx, slave address 0x%x," |
3056 | " irq %d\n", | 3051 | " irq %d\n", |
3057 | ipmi_addr_src_to_str[new_smi->addr_source], | 3052 | ipmi_addr_src_to_str[new_smi->addr_source], |
@@ -3082,7 +3077,8 @@ static int try_smi_init(struct smi_info *new_smi) | |||
3082 | /* Allocate the state machine's data and initialize it. */ | 3077 | /* Allocate the state machine's data and initialize it. */ |
3083 | new_smi->si_sm = kmalloc(new_smi->handlers->size(), GFP_KERNEL); | 3078 | new_smi->si_sm = kmalloc(new_smi->handlers->size(), GFP_KERNEL); |
3084 | if (!new_smi->si_sm) { | 3079 | if (!new_smi->si_sm) { |
3085 | printk(KERN_ERR "Could not allocate state machine memory\n"); | 3080 | printk(KERN_ERR PFX |
3081 | "Could not allocate state machine memory\n"); | ||
3086 | rv = -ENOMEM; | 3082 | rv = -ENOMEM; |
3087 | goto out_err; | 3083 | goto out_err; |
3088 | } | 3084 | } |
@@ -3092,7 +3088,7 @@ static int try_smi_init(struct smi_info *new_smi) | |||
3092 | /* Now that we know the I/O size, we can set up the I/O. */ | 3088 | /* Now that we know the I/O size, we can set up the I/O. */ |
3093 | rv = new_smi->io_setup(new_smi); | 3089 | rv = new_smi->io_setup(new_smi); |
3094 | if (rv) { | 3090 | if (rv) { |
3095 | printk(KERN_ERR "Could not set up I/O space\n"); | 3091 | printk(KERN_ERR PFX "Could not set up I/O space\n"); |
3096 | goto out_err; | 3092 | goto out_err; |
3097 | } | 3093 | } |
3098 | 3094 | ||
@@ -3102,8 +3098,7 @@ static int try_smi_init(struct smi_info *new_smi) | |||
3102 | /* Do low-level detection first. */ | 3098 | /* Do low-level detection first. */ |
3103 | if (new_smi->handlers->detect(new_smi->si_sm)) { | 3099 | if (new_smi->handlers->detect(new_smi->si_sm)) { |
3104 | if (new_smi->addr_source) | 3100 | if (new_smi->addr_source) |
3105 | printk(KERN_INFO "ipmi_si: Interface detection" | 3101 | printk(KERN_INFO PFX "Interface detection failed\n"); |
3106 | " failed\n"); | ||
3107 | rv = -ENODEV; | 3102 | rv = -ENODEV; |
3108 | goto out_err; | 3103 | goto out_err; |
3109 | } | 3104 | } |
@@ -3115,7 +3110,7 @@ static int try_smi_init(struct smi_info *new_smi) | |||
3115 | rv = try_get_dev_id(new_smi); | 3110 | rv = try_get_dev_id(new_smi); |
3116 | if (rv) { | 3111 | if (rv) { |
3117 | if (new_smi->addr_source) | 3112 | if (new_smi->addr_source) |
3118 | printk(KERN_INFO "ipmi_si: There appears to be no BMC" | 3113 | printk(KERN_INFO PFX "There appears to be no BMC" |
3119 | " at this location\n"); | 3114 | " at this location\n"); |
3120 | goto out_err; | 3115 | goto out_err; |
3121 | } | 3116 | } |
@@ -3157,9 +3152,8 @@ static int try_smi_init(struct smi_info *new_smi) | |||
3157 | new_smi->pdev = platform_device_alloc("ipmi_si", | 3152 | new_smi->pdev = platform_device_alloc("ipmi_si", |
3158 | new_smi->intf_num); | 3153 | new_smi->intf_num); |
3159 | if (!new_smi->pdev) { | 3154 | if (!new_smi->pdev) { |
3160 | printk(KERN_ERR | 3155 | printk(KERN_ERR PFX |
3161 | "ipmi_si_intf:" | 3156 | "Unable to allocate platform device\n"); |
3162 | " Unable to allocate platform device\n"); | ||
3163 | goto out_err; | 3157 | goto out_err; |
3164 | } | 3158 | } |
3165 | new_smi->dev = &new_smi->pdev->dev; | 3159 | new_smi->dev = &new_smi->pdev->dev; |
@@ -3167,9 +3161,8 @@ static int try_smi_init(struct smi_info *new_smi) | |||
3167 | 3161 | ||
3168 | rv = platform_device_add(new_smi->pdev); | 3162 | rv = platform_device_add(new_smi->pdev); |
3169 | if (rv) { | 3163 | if (rv) { |
3170 | printk(KERN_ERR | 3164 | printk(KERN_ERR PFX |
3171 | "ipmi_si_intf:" | 3165 | "Unable to register system interface device:" |
3172 | " Unable to register system interface device:" | ||
3173 | " %d\n", | 3166 | " %d\n", |
3174 | rv); | 3167 | rv); |
3175 | goto out_err; | 3168 | goto out_err; |
@@ -3184,9 +3177,8 @@ static int try_smi_init(struct smi_info *new_smi) | |||
3184 | "bmc", | 3177 | "bmc", |
3185 | new_smi->slave_addr); | 3178 | new_smi->slave_addr); |
3186 | if (rv) { | 3179 | if (rv) { |
3187 | printk(KERN_ERR | 3180 | dev_err(new_smi->dev, "Unable to register device: error %d\n", |
3188 | "ipmi_si: Unable to register device: error %d\n", | 3181 | rv); |
3189 | rv); | ||
3190 | goto out_err_stop_timer; | 3182 | goto out_err_stop_timer; |
3191 | } | 3183 | } |
3192 | 3184 | ||
@@ -3194,9 +3186,7 @@ static int try_smi_init(struct smi_info *new_smi) | |||
3194 | type_file_read_proc, | 3186 | type_file_read_proc, |
3195 | new_smi); | 3187 | new_smi); |
3196 | if (rv) { | 3188 | if (rv) { |
3197 | printk(KERN_ERR | 3189 | dev_err(new_smi->dev, "Unable to create proc entry: %d\n", rv); |
3198 | "ipmi_si: Unable to create proc entry: %d\n", | ||
3199 | rv); | ||
3200 | goto out_err_stop_timer; | 3190 | goto out_err_stop_timer; |
3201 | } | 3191 | } |
3202 | 3192 | ||
@@ -3204,9 +3194,7 @@ static int try_smi_init(struct smi_info *new_smi) | |||
3204 | stat_file_read_proc, | 3194 | stat_file_read_proc, |
3205 | new_smi); | 3195 | new_smi); |
3206 | if (rv) { | 3196 | if (rv) { |
3207 | printk(KERN_ERR | 3197 | dev_err(new_smi->dev, "Unable to create proc entry: %d\n", rv); |
3208 | "ipmi_si: Unable to create proc entry: %d\n", | ||
3209 | rv); | ||
3210 | goto out_err_stop_timer; | 3198 | goto out_err_stop_timer; |
3211 | } | 3199 | } |
3212 | 3200 | ||
@@ -3214,14 +3202,12 @@ static int try_smi_init(struct smi_info *new_smi) | |||
3214 | param_read_proc, | 3202 | param_read_proc, |
3215 | new_smi); | 3203 | new_smi); |
3216 | if (rv) { | 3204 | if (rv) { |
3217 | printk(KERN_ERR | 3205 | dev_err(new_smi->dev, "Unable to create proc entry: %d\n", rv); |
3218 | "ipmi_si: Unable to create proc entry: %d\n", | ||
3219 | rv); | ||
3220 | goto out_err_stop_timer; | 3206 | goto out_err_stop_timer; |
3221 | } | 3207 | } |
3222 | 3208 | ||
3223 | printk(KERN_INFO "IPMI %s interface initialized\n", | 3209 | dev_info(new_smi->dev, "IPMI %s interface initialized\n", |
3224 | si_to_str[new_smi->si_type]); | 3210 | si_to_str[new_smi->si_type]); |
3225 | 3211 | ||
3226 | return 0; | 3212 | return 0; |
3227 | 3213 | ||
@@ -3287,9 +3273,7 @@ static __devinit int init_ipmi_si(void) | |||
3287 | /* Register the device drivers. */ | 3273 | /* Register the device drivers. */ |
3288 | rv = driver_register(&ipmi_driver.driver); | 3274 | rv = driver_register(&ipmi_driver.driver); |
3289 | if (rv) { | 3275 | if (rv) { |
3290 | printk(KERN_ERR | 3276 | printk(KERN_ERR PFX "Unable to register driver: %d\n", rv); |
3291 | "init_ipmi_si: Unable to register driver: %d\n", | ||
3292 | rv); | ||
3293 | return rv; | 3277 | return rv; |
3294 | } | 3278 | } |
3295 | 3279 | ||
@@ -3324,9 +3308,7 @@ static __devinit int init_ipmi_si(void) | |||
3324 | #ifdef CONFIG_PCI | 3308 | #ifdef CONFIG_PCI |
3325 | rv = pci_register_driver(&ipmi_pci_driver); | 3309 | rv = pci_register_driver(&ipmi_pci_driver); |
3326 | if (rv) | 3310 | if (rv) |
3327 | printk(KERN_ERR | 3311 | printk(KERN_ERR PFX "Unable to register PCI driver: %d\n", rv); |
3328 | "init_ipmi_si: Unable to register PCI driver: %d\n", | ||
3329 | rv); | ||
3330 | #endif | 3312 | #endif |
3331 | 3313 | ||
3332 | #ifdef CONFIG_ACPI | 3314 | #ifdef CONFIG_ACPI |
@@ -3403,8 +3385,8 @@ static __devinit int init_ipmi_si(void) | |||
3403 | of_unregister_platform_driver(&ipmi_of_platform_driver); | 3385 | of_unregister_platform_driver(&ipmi_of_platform_driver); |
3404 | #endif | 3386 | #endif |
3405 | driver_unregister(&ipmi_driver.driver); | 3387 | driver_unregister(&ipmi_driver.driver); |
3406 | printk(KERN_WARNING | 3388 | printk(KERN_WARNING PFX |
3407 | "ipmi_si: Unable to find any System Interface(s)\n"); | 3389 | "Unable to find any System Interface(s)\n"); |
3408 | return -ENODEV; | 3390 | return -ENODEV; |
3409 | } else { | 3391 | } else { |
3410 | mutex_unlock(&smi_infos_lock); | 3392 | mutex_unlock(&smi_infos_lock); |
@@ -3463,8 +3445,7 @@ static void cleanup_one_si(struct smi_info *to_clean) | |||
3463 | rv = ipmi_unregister_smi(to_clean->intf); | 3445 | rv = ipmi_unregister_smi(to_clean->intf); |
3464 | 3446 | ||
3465 | if (rv) { | 3447 | if (rv) { |
3466 | printk(KERN_ERR | 3448 | printk(KERN_ERR PFX "Unable to unregister device: errno=%d\n", |
3467 | "ipmi_si: Unable to unregister device: errno=%d\n", | ||
3468 | rv); | 3449 | rv); |
3469 | } | 3450 | } |
3470 | 3451 | ||