Commit d35701d1 authored by David Jeffery's avatar David Jeffery Committed by James Bottomley

[PATCH] ips 2.5 driver update [4/4]: use dev_printk

Use the new dev_printk.

Thanks go to Mike Christie who originally
created this patch.

 ips.c |  135 +++++++++++++++++++++++++++---------------------------------------
 ips.h |    5 ++
 2 files changed, 62 insertions(+), 78 deletions(-)
parent 3dab298a
......@@ -703,13 +703,13 @@ ips_release(struct Scsi_Host *sh) {
scb->cmd.flush_cache.reserved3 = 0;
scb->cmd.flush_cache.reserved4 = 0;
printk(KERN_NOTICE "(%s%d) Flushing Cache.\n", ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "Flushing Cache.\n");
/* send command */
if (ips_send_wait(ha, scb, ips_cmd_timeout, IPS_INTR_ON) == IPS_FAILURE)
printk(KERN_NOTICE "(%s%d) Incomplete Flush.\n", ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "Incomplete Flush.\n");
printk(KERN_NOTICE "(%s%d) Flushing Complete.\n", ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "Flushing Complete.\n");
ips_sh[i] = NULL;
ips_ha[i] = NULL;
......@@ -776,13 +776,13 @@ ips_halt(struct notifier_block *nb, ulong event, void *buf) {
scb->cmd.flush_cache.reserved3 = 0;
scb->cmd.flush_cache.reserved4 = 0;
printk(KERN_NOTICE "(%s%d) Flushing Cache.\n", ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "Flushing Cache.\n");
/* send command */
if (ips_send_wait(ha, scb, ips_cmd_timeout, IPS_INTR_ON) == IPS_FAILURE)
printk(KERN_NOTICE "(%s%d) Incomplete Flush.\n", ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "Incomplete Flush.\n");
else
printk(KERN_NOTICE "(%s%d) Flushing Complete.\n", ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "Flushing Complete.\n");
}
return (NOTIFY_OK);
......@@ -932,7 +932,7 @@ ips_eh_reset(Scsi_Cmnd *SC) {
/* Attempt the flush command */
ret = ips_send_wait(ha, scb, ips_cmd_timeout, IPS_INTR_IORL);
if (ret == IPS_SUCCESS) {
printk(KERN_NOTICE "(%s%d) Reset Request - Flushed Cache\n", ips_name, ha->host_num);
IPS_PRINTK(KERN_NOTICE, ha->pcidev, "Reset Request - Flushed Cache\n");
return (SUCCESS);
}
}
......@@ -946,16 +946,14 @@ ips_eh_reset(Scsi_Cmnd *SC) {
* command must have already been sent
* reset the controller
*/
printk(KERN_NOTICE "(%s%d) Resetting controller.\n",
ips_name, ha->host_num);
IPS_PRINTK(KERN_NOTICE, ha->pcidev, "Resetting controller.\n");
ret = (*ha->func.reset)(ha);
if (!ret) {
Scsi_Cmnd *scsi_cmd;
printk(KERN_NOTICE
"(%s%d) Controller reset failed - controller now offline.\n",
ips_name, ha->host_num);
IPS_PRINTK(KERN_NOTICE, ha->pcidev,
"Controller reset failed - controller now offline.\n");
/* Now fail all of the active commands */
DEBUG_VAR(1, "(%s%d) Failing active commands",
......@@ -983,9 +981,8 @@ ips_eh_reset(Scsi_Cmnd *SC) {
if (!ips_clear_adapter(ha, IPS_INTR_IORL)) {
Scsi_Cmnd *scsi_cmd;
printk(KERN_NOTICE
"(%s%d) Controller reset failed - controller now offline.\n",
ips_name, ha->host_num);
IPS_PRINTK(KERN_NOTICE, ha->pcidev,
"Controller reset failed - controller now offline.\n");
/* Now fail all of the active commands */
DEBUG_VAR(1, "(%s%d) Failing active commands",
......@@ -1434,8 +1431,7 @@ ips_intr_morpheus(ips_ha_t *ha) {
break;
if (cstatus.fields.command_id > (IPS_MAX_CMDS - 1)) {
printk(KERN_WARNING "(%s%d) Spurious interrupt; no ccb.\n",
ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "Spurious interrupt; no ccb.\n");
continue;
}
......@@ -1752,7 +1748,7 @@ ips_flash_copperhead(ips_ha_t *ha, ips_passthru_t *pt, ips_scb_t *scb){
if(pt->CoppCP.cmd.flashfw.count + ha->flash_datasize >
(PAGE_SIZE << ha->flash_order)){
ips_free_flash_copperhead(ha);
printk(KERN_WARNING "failed size sanity check\n");
IPS_PRINTK(KERN_WARNING, ha->pcidev, "failed size sanity check\n");
return IPS_FAILURE;
}
}
......@@ -2475,15 +2471,13 @@ ips_hainit(ips_ha_t *ha) {
ips_ffdc_reset(ha, IPS_INTR_IORL);
if (!ips_read_config(ha, IPS_INTR_IORL)) {
printk(KERN_WARNING "(%s%d) unable to read config from controller.\n",
ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "unable to read config from controller.\n");
return (0);
} /* end if */
if (!ips_read_adapter_status(ha, IPS_INTR_IORL)) {
printk(KERN_WARNING "(%s%d) unable to read controller status.\n",
ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "unable to read controller status.\n");
return (0);
}
......@@ -2492,16 +2486,14 @@ ips_hainit(ips_ha_t *ha) {
ips_identify_controller(ha);
if (!ips_read_subsystem_parameters(ha, IPS_INTR_IORL)) {
printk(KERN_WARNING "(%s%d) unable to read subsystem parameters.\n",
ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "unable to read subsystem parameters.\n");
return (0);
}
/* write nvram user page 5 */
if (!ips_write_driver_status(ha, IPS_INTR_IORL)) {
printk(KERN_WARNING "(%s%d) unable to write driver info to controller.\n",
ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "unable to write driver info to controller.\n");
return (0);
}
......@@ -3258,16 +3250,14 @@ ipsintr_done(ips_ha_t *ha, ips_scb_t *scb) {
METHOD_TRACE("ipsintr_done", 2);
if (!scb) {
printk(KERN_WARNING "(%s%d) Spurious interrupt; scb NULL.\n",
ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "Spurious interrupt; scb NULL.\n");
return ;
}
if (scb->scsi_cmd == NULL) {
/* unexpected interrupt */
printk(KERN_WARNING "(%s%d) Spurious interrupt; scsi_cmd not set.\n",
ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "Spurious interrupt; scsi_cmd not set.\n");
return;
}
......@@ -4702,8 +4692,8 @@ ips_init_copperhead(ips_ha_t *ha) {
}
if (PostByte[0] < IPS_GOOD_POST_STATUS) {
printk(KERN_WARNING "(%s%d) reset controller fails (post status %x %x).\n",
ips_name, ha->host_num, PostByte[0], PostByte[1]);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "reset controller fails (post status %x %x).\n",
PostByte[0], PostByte[1]);
return (0);
}
......@@ -4794,8 +4784,8 @@ ips_init_copperhead_memio(ips_ha_t *ha) {
}
if (PostByte[0] < IPS_GOOD_POST_STATUS) {
printk(KERN_WARNING "(%s%d) reset controller fails (post status %x %x).\n",
ips_name, ha->host_num, PostByte[0], PostByte[1]);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "reset controller fails (post status %x %x).\n",
PostByte[0], PostByte[1]);
return (0);
}
......@@ -4881,8 +4871,7 @@ ips_init_morpheus(ips_ha_t *ha) {
if (i >= 45) {
/* error occurred */
printk(KERN_WARNING "(%s%d) timeout waiting for post.\n",
ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "timeout waiting for post.\n");
return (0);
}
......@@ -4890,7 +4879,7 @@ ips_init_morpheus(ips_ha_t *ha) {
Post = readl(ha->mem_ptr + IPS_REG_I960_MSG0);
if (Post == 0x4F00) { /* If Flashing the Battery PIC */
printk(KERN_WARNING "Flashing Battery PIC, Please wait ...\n" );
IPS_PRINTK(KERN_WARNING, ha->pcidev, "Flashing Battery PIC, Please wait ...\n" );
/* Clear the interrupt bit */
Isr = (uint32_t) IPS_BIT_I960_MSG0I;
......@@ -4905,8 +4894,7 @@ ips_init_morpheus(ips_ha_t *ha) {
}
if (i >= 120) {
printk(KERN_WARNING "(%s%d) timeout waiting for Battery PIC Flash\n",
ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "timeout waiting for Battery PIC Flash\n");
return (0);
}
......@@ -4917,8 +4905,7 @@ ips_init_morpheus(ips_ha_t *ha) {
writel(Isr, ha->mem_ptr + IPS_REG_I2O_HIR);
if (Post < (IPS_GOOD_POST_STATUS << 8)) {
printk(KERN_WARNING "(%s%d) reset controller fails (post status %x).\n",
ips_name, ha->host_num, Post);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "reset controller fails (post status %x).\n", Post);
return (0);
}
......@@ -4936,8 +4923,7 @@ ips_init_morpheus(ips_ha_t *ha) {
if (i >= 240) {
/* error occurred */
printk(KERN_WARNING "(%s%d) timeout waiting for config.\n",
ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "timeout waiting for config.\n");
return (0);
}
......@@ -5264,10 +5250,8 @@ ips_issue_copperhead(ips_ha_t *ha, ips_scb_t *scb) {
if (!(val & IPS_BIT_START_STOP))
break;
printk(KERN_WARNING "(%s%d) ips_issue val [0x%x].\n",
ips_name, ha->host_num, val);
printk(KERN_WARNING "(%s%d) ips_issue semaphore chk timeout.\n",
ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "ips_issue val [0x%x].\n", val);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "ips_issue semaphore chk timeout.\n");
return (IPS_FAILURE);
} /* end if */
......@@ -5320,10 +5304,8 @@ ips_issue_copperhead_memio(ips_ha_t *ha, ips_scb_t *scb) {
if (!(val & IPS_BIT_START_STOP))
break;
printk(KERN_WARNING "(%s%d) ips_issue val [0x%x].\n",
ips_name, ha->host_num, val);
printk(KERN_WARNING "(%s%d) ips_issue semaphore chk timeout.\n",
ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "ips_issue val [0x%x].\n", val);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "ips_issue semaphore chk timeout.\n");
return (IPS_FAILURE);
} /* end if */
......@@ -5563,8 +5545,7 @@ ips_write_driver_status(ips_ha_t *ha, int intr) {
METHOD_TRACE("ips_write_driver_status", 1);
if (!ips_readwrite_page5(ha, FALSE, intr)) {
printk(KERN_WARNING "(%s%d) unable to read NVRAM page 5.\n",
ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "unable to read NVRAM page 5.\n");
return (0);
}
......@@ -5599,8 +5580,7 @@ ips_write_driver_status(ips_ha_t *ha, int intr) {
/* now update the page */
if (!ips_readwrite_page5(ha, TRUE, intr)) {
printk(KERN_WARNING "(%s%d) unable to write NVRAM page 5.\n",
ips_name, ha->host_num);
IPS_PRINTK(KERN_WARNING, ha->pcidev, "unable to write NVRAM page 5.\n");
return (0);
}
......@@ -6563,10 +6543,10 @@ static void ips_version_check(ips_ha_t *ha, int intr) {
strncpy(&FirmwareString[0], ha->enq->CodeBlkVersion, 8);
FirmwareString[8] = 0;
printk(KERN_WARNING "Warning ! ! ! ServeRAID Version Mismatch\n");
printk(KERN_WARNING "Bios = %s, Firmware = %s, Device Driver = %s%s\n",
IPS_PRINTK(KERN_WARNING, ha->pcidev, "Warning ! ! ! ServeRAID Version Mismatch\n");
IPS_PRINTK(KERN_WARNING, ha->pcidev, "Bios = %s, Firmware = %s, Device Driver = %s%s\n",
BiosString, FirmwareString, IPS_VERSION_HIGH, IPS_VERSION_LOW );
printk(KERN_WARNING "These levels should match to avoid possible compatibility problems.\n" );
IPS_PRINTK(KERN_WARNING, ha->pcidev, "These levels should match to avoid possible compatibility problems.\n");
}
}
else
......@@ -6751,19 +6731,18 @@ ips_order_controllers(void){
static int
ips_register_scsi( int index){
struct Scsi_Host *sh;
ips_ha_t *ha, *oldha;
ips_ha_t *ha, *oldha = ips_ha[index];
sh = scsi_register(&ips_driver_template, sizeof(ips_ha_t));
if(!sh) {
printk(KERN_WARNING "Unable to register controller with SCSI subsystem\n" );
IPS_PRINTK(KERN_WARNING, oldha->pcidev, "Unable to register controller with SCSI subsystem\n");
return -1;
}
oldha = ips_ha[index];
ha = IPS_HA(sh);
memcpy(ha, oldha, sizeof(ips_ha_t));
free_irq(oldha->irq, oldha);
/* Install the interrupt handler with the new ha */
if (request_irq(ha->irq, do_ipsintr, SA_SHIRQ, ips_name, ha)) {
printk(KERN_WARNING "Unable to install interrupt handler\n" );
IPS_PRINTK(KERN_WARNING, ha->pcidev, "Unable to install interrupt handler\n" );
scsi_unregister(sh);
return -1;
}
......@@ -6966,7 +6945,7 @@ static int ips_init_phase1( struct pci_dev *pci_dev, int *indexPtr )
uint32_t offs;
if (!request_mem_region(mem_addr, mem_len, "ips")) {
printk(KERN_WARNING "Couldn't allocate IO Memory space %x len %d.\n", mem_addr, mem_len);
IPS_PRINTK(KERN_WARNING, pci_dev, "Couldn't allocate IO Memory space %x len %d.\n", mem_addr, mem_len);
return -1;
}
......@@ -6982,14 +6961,14 @@ static int ips_init_phase1( struct pci_dev *pci_dev, int *indexPtr )
/* setup I/O mapped area (if applicable) */
if (io_addr) {
if (!request_region(io_addr, io_len, "ips")) {
printk(KERN_WARNING "Couldn't allocate IO space %x len %d.\n", io_addr, io_len);
IPS_PRINTK(KERN_WARNING, pci_dev, "Couldn't allocate IO space %x len %d.\n", io_addr, io_len);
return -1;
}
}
/* get the revision ID */
if (pci_read_config_byte(pci_dev, PCI_REVISION_ID, &revision_id)) {
printk(KERN_WARNING "Can't get revision id.\n" );
IPS_PRINTK(KERN_WARNING, pci_dev, "Can't get revision id.\n");
return -1;
}
......@@ -6998,7 +6977,7 @@ static int ips_init_phase1( struct pci_dev *pci_dev, int *indexPtr )
/* found a controller */
ha = kmalloc(sizeof(ips_ha_t), GFP_KERNEL);
if (ha == NULL) {
printk(KERN_WARNING "Unable to allocate temporary ha struct\n" );
IPS_PRINTK(KERN_WARNING, pci_dev, "Unable to allocate temporary ha struct\n");
return -1;
}
......@@ -7042,14 +7021,14 @@ static int ips_init_phase1( struct pci_dev *pci_dev, int *indexPtr )
ha->enq = kmalloc(sizeof(IPS_ENQ), IPS_INIT_GFP);
if (!ha->enq) {
printk(KERN_WARNING "Unable to allocate host inquiry structure\n" );
IPS_PRINTK(KERN_WARNING, pci_dev, "Unable to allocate host inquiry structure\n" );
return ips_abort_init(ha, index);
}
ha->adapt = pci_alloc_consistent(pci_dev, sizeof(IPS_ADAPTER) +
sizeof(IPS_IO_CMD), &dma_address);
if (!ha->adapt) {
printk(KERN_WARNING "Unable to allocate host adapt & dummy structures\n");
IPS_PRINTK(KERN_WARNING, pci_dev, "Unable to allocate host adapt & dummy structures\n");
return ips_abort_init(ha, index);
}
ha->adapt->hw_status_start = dma_address;
......@@ -7058,21 +7037,21 @@ static int ips_init_phase1( struct pci_dev *pci_dev, int *indexPtr )
ha->conf = kmalloc(sizeof(IPS_CONF), IPS_INIT_GFP);
if (!ha->conf) {
printk(KERN_WARNING "Unable to allocate host conf structure\n" );
IPS_PRINTK(KERN_WARNING, pci_dev, "Unable to allocate host conf structure\n");
return ips_abort_init(ha, index);
}
ha->nvram = kmalloc(sizeof(IPS_NVRAM_P5), IPS_INIT_GFP);
if (!ha->nvram) {
printk(KERN_WARNING "Unable to allocate host NVRAM structure\n" );
IPS_PRINTK(KERN_WARNING, pci_dev, "Unable to allocate host NVRAM structure\n");
return ips_abort_init(ha, index);
}
ha->subsys = kmalloc(sizeof(IPS_SUBSYS), IPS_INIT_GFP);
if (!ha->subsys) {
printk(KERN_WARNING "Unable to allocate host subsystem structure\n" );
IPS_PRINTK(KERN_WARNING, pci_dev, "Unable to allocate host subsystem structure\n");
return ips_abort_init(ha, index);
}
......@@ -7084,7 +7063,7 @@ static int ips_init_phase1( struct pci_dev *pci_dev, int *indexPtr )
ha->ioctl_datasize = count;
if (!ha->ioctl_data) {
printk(KERN_WARNING "Unable to allocate IOCTL data\n" );
IPS_PRINTK(KERN_WARNING, pci_dev, "Unable to allocate IOCTL data\n");
ha->ioctl_data = NULL;
ha->ioctl_order = 0;
ha->ioctl_datasize = 0;
......@@ -7112,7 +7091,7 @@ static int ips_init_phase1( struct pci_dev *pci_dev, int *indexPtr )
/*
* Initialization failed
*/
printk(KERN_WARNING "Unable to initialize controller\n" );
IPS_PRINTK(KERN_WARNING, pci_dev, "Unable to initialize controller\n");
return ips_abort_init(ha, index);
}
}
......@@ -7144,7 +7123,7 @@ static int ips_init_phase2( int index )
/* Install the interrupt handler */
if (request_irq(ha->irq, do_ipsintr, SA_SHIRQ, ips_name, ha)) {
printk(KERN_WARNING "Unable to install interrupt handler\n" );
IPS_PRINTK(KERN_WARNING, ha->pcidev, "Unable to install interrupt handler\n");
return ips_abort_init(ha, index);
}
......@@ -7153,13 +7132,13 @@ static int ips_init_phase2( int index )
*/
ha->max_cmds = 1;
if (!ips_allocatescbs(ha)) {
printk(KERN_WARNING "Unable to allocate a CCB\n" );
IPS_PRINTK(KERN_WARNING, ha->pcidev, "Unable to allocate a CCB\n");
free_irq(ha->irq, ha);
return ips_abort_init(ha, index);
}
if (!ips_hainit(ha)) {
printk(KERN_WARNING "Unable to initialize controller\n" );
IPS_PRINTK(KERN_WARNING, ha->pcidev, "Unable to initialize controller\n");
free_irq(ha->irq, ha);
return ips_abort_init(ha, index);
}
......@@ -7168,7 +7147,7 @@ static int ips_init_phase2( int index )
/* allocate CCBs */
if (!ips_allocatescbs(ha)) {
printk(KERN_WARNING "Unable to allocate CCBs\n" );
IPS_PRINTK(KERN_WARNING, ha->pcidev, "Unable to allocate CCBs\n");
free_irq(ha->irq, ha);
return ips_abort_init(ha, index);
}
......
......@@ -105,12 +105,17 @@
#define IPS_ADD_HOST(shost,device)
#define IPS_REMOVE_HOST(shost)
#define IPS_SCSI_SET_DEVICE(sh,ha) scsi_set_pci_device(sh, (ha)->pcidev)
#define IPS_PRINTK(level, pcidev, format, arg...) \
printk(level "%s %s:" format , (pcidev)->driver->name , \
(pcidev)->slot_name , ## arg)
#else
#define IPS_REGISTER_HOSTS(SHT) (!ips_detect(SHT))
#define IPS_UNREGISTER_HOSTS(SHT)
#define IPS_ADD_HOST(shost,device) scsi_add_host(shost,device)
#define IPS_REMOVE_HOST(shost) scsi_remove_host(shost)
#define IPS_SCSI_SET_DEVICE(sh,ha) scsi_set_device(sh, &(ha)->pcidev->dev)
#define IPS_PRINTK(level, pcidev, format, arg...) \
dev_printk(level , &((pcidev)->dev) , format , ## arg)
#endif
#ifndef MDELAY
......
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