| .. | .. |
|---|
| 11 | 11 | * |
|---|
| 12 | 12 | * Copyright 2002,2004 MontaVista Software Inc. |
|---|
| 13 | 13 | */ |
|---|
| 14 | + |
|---|
| 15 | +#define pr_fmt(fmt) "IPMI poweroff: " fmt |
|---|
| 16 | + |
|---|
| 14 | 17 | #include <linux/module.h> |
|---|
| 15 | 18 | #include <linux/moduleparam.h> |
|---|
| 16 | 19 | #include <linux/proc_fs.h> |
|---|
| .. | .. |
|---|
| 20 | 23 | #include <linux/kdev_t.h> |
|---|
| 21 | 24 | #include <linux/ipmi.h> |
|---|
| 22 | 25 | #include <linux/ipmi_smi.h> |
|---|
| 23 | | - |
|---|
| 24 | | -#define PFX "IPMI poweroff: " |
|---|
| 25 | 26 | |
|---|
| 26 | 27 | static void ipmi_po_smi_gone(int if_num); |
|---|
| 27 | 28 | static void ipmi_po_new_smi(int if_num, struct device *device); |
|---|
| .. | .. |
|---|
| 192 | 193 | smi_addr.channel = IPMI_BMC_CHANNEL; |
|---|
| 193 | 194 | smi_addr.lun = 0; |
|---|
| 194 | 195 | |
|---|
| 195 | | - printk(KERN_INFO PFX "PPS powerdown hook used"); |
|---|
| 196 | + pr_info("PPS powerdown hook used\n"); |
|---|
| 196 | 197 | |
|---|
| 197 | 198 | send_msg.netfn = IPMI_NETFN_OEM; |
|---|
| 198 | 199 | send_msg.cmd = IPMI_ATCA_PPS_GRACEFUL_RESTART; |
|---|
| .. | .. |
|---|
| 201 | 202 | rv = ipmi_request_in_rc_mode(user, |
|---|
| 202 | 203 | (struct ipmi_addr *) &smi_addr, |
|---|
| 203 | 204 | &send_msg); |
|---|
| 204 | | - if (rv && rv != IPMI_UNKNOWN_ERR_COMPLETION_CODE) { |
|---|
| 205 | | - printk(KERN_ERR PFX "Unable to send ATCA ," |
|---|
| 206 | | - " IPMI error 0x%x\n", rv); |
|---|
| 207 | | - } |
|---|
| 205 | + if (rv && rv != IPMI_UNKNOWN_ERR_COMPLETION_CODE) |
|---|
| 206 | + pr_err("Unable to send ATCA, IPMI error 0x%x\n", rv); |
|---|
| 207 | + |
|---|
| 208 | 208 | return; |
|---|
| 209 | 209 | } |
|---|
| 210 | 210 | |
|---|
| .. | .. |
|---|
| 234 | 234 | (struct ipmi_addr *) &smi_addr, |
|---|
| 235 | 235 | &send_msg); |
|---|
| 236 | 236 | |
|---|
| 237 | | - printk(KERN_INFO PFX "ATCA Detect mfg 0x%X prod 0x%X\n", |
|---|
| 238 | | - mfg_id, prod_id); |
|---|
| 237 | + pr_info("ATCA Detect mfg 0x%X prod 0x%X\n", mfg_id, prod_id); |
|---|
| 239 | 238 | if ((mfg_id == IPMI_MOTOROLA_MANUFACTURER_ID) |
|---|
| 240 | 239 | && (prod_id == IPMI_MOTOROLA_PPS_IPMC_PRODUCT_ID)) { |
|---|
| 241 | | - printk(KERN_INFO PFX |
|---|
| 242 | | - "Installing Pigeon Point Systems Poweroff Hook\n"); |
|---|
| 240 | + pr_info("Installing Pigeon Point Systems Poweroff Hook\n"); |
|---|
| 243 | 241 | atca_oem_poweroff_hook = pps_poweroff_atca; |
|---|
| 244 | 242 | } |
|---|
| 245 | 243 | return !rv; |
|---|
| .. | .. |
|---|
| 259 | 257 | smi_addr.channel = IPMI_BMC_CHANNEL; |
|---|
| 260 | 258 | smi_addr.lun = 0; |
|---|
| 261 | 259 | |
|---|
| 262 | | - printk(KERN_INFO PFX "Powering down via ATCA power command\n"); |
|---|
| 260 | + pr_info("Powering down via ATCA power command\n"); |
|---|
| 263 | 261 | |
|---|
| 264 | 262 | /* |
|---|
| 265 | 263 | * Power down |
|---|
| .. | .. |
|---|
| 282 | 280 | * return code |
|---|
| 283 | 281 | */ |
|---|
| 284 | 282 | if (rv && rv != IPMI_UNKNOWN_ERR_COMPLETION_CODE) { |
|---|
| 285 | | - printk(KERN_ERR PFX "Unable to send ATCA powerdown message," |
|---|
| 286 | | - " IPMI error 0x%x\n", rv); |
|---|
| 283 | + pr_err("Unable to send ATCA powerdown message, IPMI error 0x%x\n", |
|---|
| 284 | + rv); |
|---|
| 287 | 285 | goto out; |
|---|
| 288 | 286 | } |
|---|
| 289 | 287 | |
|---|
| .. | .. |
|---|
| 334 | 332 | smi_addr.channel = IPMI_BMC_CHANNEL; |
|---|
| 335 | 333 | smi_addr.lun = 0; |
|---|
| 336 | 334 | |
|---|
| 337 | | - printk(KERN_INFO PFX "Powering down via CPI1 power command\n"); |
|---|
| 335 | + pr_info("Powering down via CPI1 power command\n"); |
|---|
| 338 | 336 | |
|---|
| 339 | 337 | /* |
|---|
| 340 | 338 | * Get IPMI ipmb address |
|---|
| .. | .. |
|---|
| 482 | 480 | smi_addr.lun = 0; |
|---|
| 483 | 481 | |
|---|
| 484 | 482 | powercyclefailed: |
|---|
| 485 | | - printk(KERN_INFO PFX "Powering %s via IPMI chassis control command\n", |
|---|
| 483 | + pr_info("Powering %s via IPMI chassis control command\n", |
|---|
| 486 | 484 | (poweroff_powercycle ? "cycle" : "down")); |
|---|
| 487 | 485 | |
|---|
| 488 | 486 | /* |
|---|
| .. | .. |
|---|
| 502 | 500 | if (rv) { |
|---|
| 503 | 501 | if (poweroff_powercycle) { |
|---|
| 504 | 502 | /* power cycle failed, default to power down */ |
|---|
| 505 | | - printk(KERN_ERR PFX "Unable to send chassis power " \ |
|---|
| 506 | | - "cycle message, IPMI error 0x%x\n", rv); |
|---|
| 503 | + pr_err("Unable to send chassis power cycle message, IPMI error 0x%x\n", |
|---|
| 504 | + rv); |
|---|
| 507 | 505 | poweroff_powercycle = 0; |
|---|
| 508 | 506 | goto powercyclefailed; |
|---|
| 509 | 507 | } |
|---|
| 510 | 508 | |
|---|
| 511 | | - printk(KERN_ERR PFX "Unable to send chassis power " \ |
|---|
| 512 | | - "down message, IPMI error 0x%x\n", rv); |
|---|
| 509 | + pr_err("Unable to send chassis power down message, IPMI error 0x%x\n", |
|---|
| 510 | + rv); |
|---|
| 513 | 511 | } |
|---|
| 514 | 512 | } |
|---|
| 515 | 513 | |
|---|
| .. | .. |
|---|
| 571 | 569 | rv = ipmi_create_user(if_num, &ipmi_poweroff_handler, NULL, |
|---|
| 572 | 570 | &ipmi_user); |
|---|
| 573 | 571 | if (rv) { |
|---|
| 574 | | - printk(KERN_ERR PFX "could not create IPMI user, error %d\n", |
|---|
| 575 | | - rv); |
|---|
| 572 | + pr_err("could not create IPMI user, error %d\n", rv); |
|---|
| 576 | 573 | return; |
|---|
| 577 | 574 | } |
|---|
| 578 | 575 | |
|---|
| .. | .. |
|---|
| 594 | 591 | (struct ipmi_addr *) &smi_addr, |
|---|
| 595 | 592 | &send_msg); |
|---|
| 596 | 593 | if (rv) { |
|---|
| 597 | | - printk(KERN_ERR PFX "Unable to send IPMI get device id info," |
|---|
| 598 | | - " IPMI error 0x%x\n", rv); |
|---|
| 594 | + pr_err("Unable to send IPMI get device id info, IPMI error 0x%x\n", |
|---|
| 595 | + rv); |
|---|
| 599 | 596 | goto out_err; |
|---|
| 600 | 597 | } |
|---|
| 601 | 598 | |
|---|
| 602 | 599 | if (halt_recv_msg.msg.data_len < 12) { |
|---|
| 603 | | - printk(KERN_ERR PFX "(chassis) IPMI get device id info too," |
|---|
| 604 | | - " short, was %d bytes, needed %d bytes\n", |
|---|
| 600 | + pr_err("(chassis) IPMI get device id info too short, was %d bytes, needed %d bytes\n", |
|---|
| 605 | 601 | halt_recv_msg.msg.data_len, 12); |
|---|
| 606 | 602 | goto out_err; |
|---|
| 607 | 603 | } |
|---|
| .. | .. |
|---|
| 622 | 618 | } |
|---|
| 623 | 619 | |
|---|
| 624 | 620 | out_err: |
|---|
| 625 | | - printk(KERN_ERR PFX "Unable to find a poweroff function that" |
|---|
| 626 | | - " will work, giving up\n"); |
|---|
| 621 | + pr_err("Unable to find a poweroff function that will work, giving up\n"); |
|---|
| 627 | 622 | ipmi_destroy_user(ipmi_user); |
|---|
| 628 | 623 | return; |
|---|
| 629 | 624 | |
|---|
| 630 | 625 | found: |
|---|
| 631 | | - printk(KERN_INFO PFX "Found a %s style poweroff function\n", |
|---|
| 632 | | - poweroff_functions[i].platform_type); |
|---|
| 626 | + pr_info("Found a %s style poweroff function\n", |
|---|
| 627 | + poweroff_functions[i].platform_type); |
|---|
| 633 | 628 | specific_poweroff_func = poweroff_functions[i].poweroff_func; |
|---|
| 634 | 629 | old_poweroff_func = pm_power_off; |
|---|
| 635 | 630 | pm_power_off = ipmi_poweroff_function; |
|---|
| .. | .. |
|---|
| 692 | 687 | { |
|---|
| 693 | 688 | int rv; |
|---|
| 694 | 689 | |
|---|
| 695 | | - printk(KERN_INFO "Copyright (C) 2004 MontaVista Software -" |
|---|
| 696 | | - " IPMI Powerdown via sys_reboot.\n"); |
|---|
| 690 | + pr_info("Copyright (C) 2004 MontaVista Software - IPMI Powerdown via sys_reboot\n"); |
|---|
| 697 | 691 | |
|---|
| 698 | 692 | if (poweroff_powercycle) |
|---|
| 699 | | - printk(KERN_INFO PFX "Power cycle is enabled.\n"); |
|---|
| 693 | + pr_info("Power cycle is enabled\n"); |
|---|
| 700 | 694 | |
|---|
| 701 | 695 | #ifdef CONFIG_PROC_FS |
|---|
| 702 | 696 | ipmi_table_header = register_sysctl_table(ipmi_root_table); |
|---|
| 703 | 697 | if (!ipmi_table_header) { |
|---|
| 704 | | - printk(KERN_ERR PFX "Unable to register powercycle sysctl\n"); |
|---|
| 698 | + pr_err("Unable to register powercycle sysctl\n"); |
|---|
| 705 | 699 | rv = -ENOMEM; |
|---|
| 706 | 700 | goto out_err; |
|---|
| 707 | 701 | } |
|---|
| .. | .. |
|---|
| 712 | 706 | #ifdef CONFIG_PROC_FS |
|---|
| 713 | 707 | if (rv) { |
|---|
| 714 | 708 | unregister_sysctl_table(ipmi_table_header); |
|---|
| 715 | | - printk(KERN_ERR PFX "Unable to register SMI watcher: %d\n", rv); |
|---|
| 709 | + pr_err("Unable to register SMI watcher: %d\n", rv); |
|---|
| 716 | 710 | goto out_err; |
|---|
| 717 | 711 | } |
|---|
| 718 | 712 | |
|---|
| .. | .. |
|---|
| 735 | 729 | if (ready) { |
|---|
| 736 | 730 | rv = ipmi_destroy_user(ipmi_user); |
|---|
| 737 | 731 | if (rv) |
|---|
| 738 | | - printk(KERN_ERR PFX "could not cleanup the IPMI" |
|---|
| 739 | | - " user: 0x%x\n", rv); |
|---|
| 732 | + pr_err("could not cleanup the IPMI user: 0x%x\n", rv); |
|---|
| 740 | 733 | pm_power_off = old_poweroff_func; |
|---|
| 741 | 734 | } |
|---|
| 742 | 735 | } |
|---|