kernels/linux-2.4.0/drivers/scsi/ips.c
/****************************************************************************/
/*                                                                          */
/* Routine Name: ips_halt                                                   */
/*                                                                          */
/* Routine Description:                                                     */
/*                                                                          */
/*   Perform cleanup when the system reboots                                */
/*                                                                          */
/****************************************************************************/


Routine Description.

Perform cleanup when the system reboots
Routine Description . Perform cleanup when the system reboots
static int
ips_halt(struct notifier_block *nb, ulong event, void *buf) {
   ips_scb_t *scb;
   ips_ha_t  *ha;
   int        i;
   if ((event != SYS_RESTART) && (event != SYS_HALT) &&
       (event != SYS_POWER_OFF))
      return (NOTIFY_DONE);
   for (i = 0; i < ips_next_controller; i++) {
      ha = (ips_ha_t *) ips_ha[i];
      if (!ha)
         continue;
      if (!ha->active)
         continue;
      scb = &ha->scbs[ha->max_cmds-1];
      ips_init_scb(ha, scb);
      scb->timeout = ips_cmd_timeout;
      scb->cdb[0] = IPS_CMD_FLUSH;
      scb->cmd.flush_cache.op_code = IPS_CMD_FLUSH;
      scb->cmd.flush_cache.command_id = IPS_COMMAND_ID(ha, scb);
      scb->cmd.flush_cache.state = IPS_NORM_STATE;
      scb->cmd.flush_cache.reserved = 0;
      scb->cmd.flush_cache.reserved2 = 0;
      scb->cmd.flush_cache.reserved3 = 0;
      scb->cmd.flush_cache.reserved4 = 0;
      printk("(%s%d) Flushing Cache.\n", ips_name, ha->host_num);
      if (ips_send_wait(ha, scb, ips_cmd_timeout, IPS_INTR_ON) == IPS_FAILURE)
         printk("(%s%d) Incomplete Flush.\n", ips_name, ha->host_num);
      else
         printk("(%s%d) Flushing Complete.\n", ips_name, ha->host_num);
   }
   unregister_reboot_notifier(&ips_notifier);
   return (NOTIFY_OK);
}
static int ips_halt ( struct notifier_block * nb , ulong event , void * buf ) { ips_scb_t * scb ; ips_ha_t * ha ; int i ; if ( ( event != SYS_RESTART ) && ( event != SYS_HALT ) && ( event != SYS_POWER_OFF ) ) return ( NOTIFY_DONE ) ; for ( i = 0 ; i < ips_next_controller ; i ++ ) { ha = ( ips_ha_t * ) ips_ha [ i ] ; if ( ! ha ) continue ; if ( ! ha -> active ) continue ; scb = & ha -> scbs [ ha -> max_cmds - 1 ] ; ips_init_scb ( ha , scb ) ; scb -> timeout = ips_cmd_timeout ; scb -> cdb [ 0 ] = IPS_CMD_FLUSH ; scb -> cmd . flush_cache . op_code = IPS_CMD_FLUSH ; scb -> cmd . flush_cache . command_id = IPS_COMMAND_ID ( ha , scb ) ; scb -> cmd . flush_cache . state = IPS_NORM_STATE ; scb -> cmd . flush_cache . reserved = 0 ; scb -> cmd . flush_cache . reserved2 = 0 ; scb -> cmd . flush_cache . reserved3 = 0 ; scb -> cmd . flush_cache . reserved4 = 0 ; printk ( " \n " , ips_name , ha -> host_num ) ; if ( ips_send_wait ( ha , scb , ips_cmd_timeout , IPS_INTR_ON ) == IPS_FAILURE ) printk ( " \n " , ips_name , ha -> host_num ) ; else printk ( " \n " , ips_name , ha -> host_num ) ; } unregister_reboot_notifier ( & ips_notifier ) ; return ( NOTIFY_OK ) ; }
Routine Name: ips_halt
Routine Name : ips_halt
/* flush the cache on the controller */ /* send command */