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


Routine Description:
Program the BIOS on the adapter
Routine Description : Program the BIOS on the adapter
static int
ips_program_bios_memio(ips_ha_t *ha, char *buffer, int buffersize) {
   int   i;
   int   timeout;
   u8    status;
   METHOD_TRACE("ips_program_bios_memio", 1);
   for (i = 0; i < buffersize; i++) {
      writel(i, ha->mem_ptr + IPS_REG_FLAP);
      if (ha->revision_id == IPS_REVID_TROMBONE64)
         UDELAY(5); 
      writeb(0x40, ha->mem_ptr + IPS_REG_FLDP);
      if (ha->revision_id == IPS_REVID_TROMBONE64)
         UDELAY(5); 
      writeb(buffer[i], ha->mem_ptr + IPS_REG_FLDP);
      if (ha->revision_id == IPS_REVID_TROMBONE64)
         UDELAY(5); 
      timeout = 1000;
      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) {
         writel(0, ha->mem_ptr + IPS_REG_FLAP);
         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 (1);
      }
      if (status & 0x18) {
         writel(0, ha->mem_ptr + IPS_REG_FLAP);
         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 (1);
      }
   } 
   writel(0, ha->mem_ptr + IPS_REG_FLAP);
   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_program_bios_memio ( ips_ha_t * ha , char * buffer , int buffersize ) { int i ; int timeout ; u8 status ; METHOD_TRACE ( " " , 1 ) ; for ( i = 0 ; i < buffersize ; i ++ ) { writel ( i , ha -> mem_ptr + IPS_REG_FLAP ) ; if ( ha -> revision_id == IPS_REVID_TROMBONE64 ) UDELAY ( 5 ) ; writeb ( 0x40 , ha -> mem_ptr + IPS_REG_FLDP ) ; if ( ha -> revision_id == IPS_REVID_TROMBONE64 ) UDELAY ( 5 ) ; writeb ( buffer [ i ] , ha -> mem_ptr + IPS_REG_FLDP ) ; if ( ha -> revision_id == IPS_REVID_TROMBONE64 ) UDELAY ( 5 ) ; timeout = 1000 ; 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 ) { writel ( 0 , ha -> mem_ptr + IPS_REG_FLAP ) ; 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 ( 1 ) ; } if ( status & 0x18 ) { writel ( 0 , ha -> mem_ptr + IPS_REG_FLAP ) ; 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 ( 1 ) ; } } writel ( 0 , ha -> mem_ptr + IPS_REG_FLAP ) ; 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_program_bios_memio
Routine Name : ips_program_bios_memio
/* write a byte */ /* 5 us */ /* 5 us */ /* 5 us */ /* wait up to one second */ /* 5 us */ /* timeout error */ /* 5 us */ /* 5 us */ /* check the status */ /* programming error */ /* 5 us */ /* 5 us */ /* end for */ /* Enable reading */ /* 5 us */ /* 5 us */