kernels/linux-2.4.0/drivers/scsi/ips.c
/****************************************************************************/
/*                                                                          */
/* Routine Name: ips_erase_bios_memio                                       */
/*                                                                          */
/* Routine Description:                                                     */
/*   Erase the BIOS on the adapter                                          */
/*                                                                          */
/****************************************************************************/


Routine Description:
Erase the BIOS on the adapter
Routine Description : Erase the BIOS on the adapter
static int
ips_erase_bios_memio(ips_ha_t *ha) {
   int   timeout;
   u8    status;
   METHOD_TRACE("ips_erase_bios_memio", 1);
   writel(0, ha->mem_ptr + IPS_REG_FLAP);
   if (ha->revision_id == IPS_REVID_TROMBONE64)
      UDELAY(5); 
   writeb(0x50, ha->mem_ptr + IPS_REG_FLDP);
   if (ha->revision_id == IPS_REVID_TROMBONE64)
      UDELAY(5); 
   writeb(0x20, ha->mem_ptr + IPS_REG_FLDP);
   if (ha->revision_id == IPS_REVID_TROMBONE64)
      UDELAY(5); 
   writeb(0xD0, ha->mem_ptr + IPS_REG_FLDP);
   if (ha->revision_id == IPS_REVID_TROMBONE64)
      UDELAY(5); 
   writeb(0x70, ha->mem_ptr + IPS_REG_FLDP);
   if (ha->revision_id == IPS_REVID_TROMBONE64)
      UDELAY(5); 
   timeout = 80000; 
   while (timeout > 0) {
      if (ha->revision_id == IPS_REVID_TROMBONE64) {
         writel(0, ha->mem_ptr + IPS_REG_FLAP);
         UDELAY(5); 
      }
      status = readb(ha->mem_ptr + IPS_REG_FLDP);
      if (status & 0x80)
         break;
      MDELAY(1);
      timeout--;
   }
   if (timeout <= 0) {
      writeb(0xB0, ha->mem_ptr + IPS_REG_FLDP);
      if (ha->revision_id == IPS_REVID_TROMBONE64)
         UDELAY(5); 
      timeout = 10000;
      while (timeout > 0) {
         if (ha->revision_id == IPS_REVID_TROMBONE64) {
            writel(0, ha->mem_ptr + IPS_REG_FLAP);
            UDELAY(5); 
         }
         status = readb(ha->mem_ptr + IPS_REG_FLDP);
         if (status & 0xC0)
            break;
         MDELAY(1);
         timeout--;
      }
      return (1);
   }
   if (status & 0x08)
      return (1);
   if (status & 0x30)
      return (1);
   writeb(0x50, ha->mem_ptr + IPS_REG_FLDP);
   if (ha->revision_id == IPS_REVID_TROMBONE64)
      UDELAY(5); 
   writeb(0xFF, ha->mem_ptr + IPS_REG_FLDP);
   if (ha->revision_id == IPS_REVID_TROMBONE64)
      UDELAY(5); 
   return (0);
}
static int ips_erase_bios_memio ( ips_ha_t * ha ) { int timeout ; u8 status ; METHOD_TRACE ( " " , 1 ) ; writel ( 0 , ha -> mem_ptr + IPS_REG_FLAP ) ; if ( ha -> revision_id == IPS_REVID_TROMBONE64 ) UDELAY ( 5 ) ; writeb ( 0x50 , ha -> mem_ptr + IPS_REG_FLDP ) ; if ( ha -> revision_id == IPS_REVID_TROMBONE64 ) UDELAY ( 5 ) ; writeb ( 0x20 , ha -> mem_ptr + IPS_REG_FLDP ) ; if ( ha -> revision_id == IPS_REVID_TROMBONE64 ) UDELAY ( 5 ) ; writeb ( 0xD0 , ha -> mem_ptr + IPS_REG_FLDP ) ; if ( ha -> revision_id == IPS_REVID_TROMBONE64 ) UDELAY ( 5 ) ; writeb ( 0x70 , ha -> mem_ptr + IPS_REG_FLDP ) ; if ( ha -> revision_id == IPS_REVID_TROMBONE64 ) UDELAY ( 5 ) ; timeout = 80000 ; while ( timeout > 0 ) { if ( ha -> revision_id == IPS_REVID_TROMBONE64 ) { writel ( 0 , ha -> mem_ptr + IPS_REG_FLAP ) ; UDELAY ( 5 ) ; } status = readb ( ha -> mem_ptr + IPS_REG_FLDP ) ; if ( status & 0x80 ) break ; MDELAY ( 1 ) ; timeout -- ; } if ( timeout <= 0 ) { writeb ( 0xB0 , ha -> mem_ptr + IPS_REG_FLDP ) ; if ( ha -> revision_id == IPS_REVID_TROMBONE64 ) UDELAY ( 5 ) ; timeout = 10000 ; while ( timeout > 0 ) { if ( ha -> revision_id == IPS_REVID_TROMBONE64 ) { writel ( 0 , ha -> mem_ptr + IPS_REG_FLAP ) ; UDELAY ( 5 ) ; } status = readb ( ha -> mem_ptr + IPS_REG_FLDP ) ; if ( status & 0xC0 ) break ; MDELAY ( 1 ) ; timeout -- ; } return ( 1 ) ; } if ( status & 0x08 ) return ( 1 ) ; if ( status & 0x30 ) return ( 1 ) ; writeb ( 0x50 , ha -> mem_ptr + IPS_REG_FLDP ) ; if ( ha -> revision_id == IPS_REVID_TROMBONE64 ) UDELAY ( 5 ) ; writeb ( 0xFF , ha -> mem_ptr + IPS_REG_FLDP ) ; if ( ha -> revision_id == IPS_REVID_TROMBONE64 ) UDELAY ( 5 ) ; return ( 0 ) ; }
Routine Name: ips_erase_bios_memio
Routine Name : ips_erase_bios_memio
/* Clear the status register */ /* 5 us */ /* 5 us */ /* Erase Setup */ /* 5 us */ /* Erase Confirm */ /* 5 us */ /* Erase Status */ /* 5 us */ /* 80 seconds */ /* 5 us */ /* check for timeout */ /* timeout */ /* try to suspend the erase */ /* 5 us */ /* wait for 10 seconds */ /* 5 us */ /* check for valid VPP */ /* VPP failure */ /* check for succesful flash */ /* sequence error */ /* Otherwise, we were successful */ /* clear status */ /* 5 us */ /* enable reads */ /* 5 us */