This patch correctly formats all comments as reported by checkpatch.pl. Signed-off-by: Kevin McKinney <klmckinney1@xxxxxxxxx> --- drivers/staging/bcm/nvm.c | 1895 +++++++++++++++++++++++---------------------- 1 file changed, 955 insertions(+), 940 deletions(-) diff --git a/drivers/staging/bcm/nvm.c b/drivers/staging/bcm/nvm.c index 66001fc..cfc0458 100644 --- a/drivers/staging/bcm/nvm.c +++ b/drivers/staging/bcm/nvm.c @@ -51,17 +51,15 @@ static INT GetFlashBaseAddr(struct bcm_mini_adapter *Adapter); static INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, UINT dwAddress, UINT *pdwData, UINT dwNumData); -// Procedure: ReadEEPROMStatusRegister -// -// Description: Reads the standard EEPROM Status Register. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- - +/* Procedure: ReadEEPROMStatusRegister + * + * Description: Reads the standard EEPROM Status Register. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * Returns: + * OSAL_STATUS_CODE + */ static UCHAR ReadEEPROMStatusRegister(struct bcm_mini_adapter *Adapter) { UCHAR uiData = 0; @@ -110,19 +108,19 @@ static UCHAR ReadEEPROMStatusRegister(struct bcm_mini_adapter *Adapter) return uiData; } /* ReadEEPROMStatusRegister */ -//----------------------------------------------------------------------------- -// Procedure: ReadBeceemEEPROMBulk -// -// Description: This routine reads 16Byte data from EEPROM -// -// Arguments: -// Adapter - ptr to Adapter object instance -// dwAddress - EEPROM Offset to read the data from. -// pdwData - Pointer to double word where data needs to be stored in. // dwNumWords - Number of words. Valid values are 4 ONLY. -// -// Returns: -// OSAL_STATUS_CODE: -//----------------------------------------------------------------------------- +/* + * Procedure: ReadBeceemEEPROMBulk + * + * Description: This routine reads 16Byte data from EEPROM + * + * Arguments: + * Adapter - ptr to Adapter object instance + * dwAddress - EEPROM Offset to read the data from. + * pdwData - Pointer to double word where data needs to be stored in. // dwNumWords - Number of words. Valid values are 4 ONLY. + * + * Returns: + * OSAL_STATUS_CODE: + */ INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, DWORD dwAddress, @@ -159,7 +157,8 @@ INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, /* If we are reading 16 bytes we want to be sure that the queue * is full before we read. In the other cases we are ok if the - * queue has data available */ + * queue has data available + */ if (dwNumWords == 4) { if ((uiStatus & EEPROM_READ_DATA_FULL) != 0) { /* Clear the Avail/Full bits - which ever is set. */ @@ -170,7 +169,8 @@ INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, } else if (dwNumWords == 1) { if ((uiStatus & EEPROM_READ_DATA_AVAIL) != 0) { /* We just got Avail and we have to read 32bits so we - * need this sleep for Cardbus kind of devices. */ + * need this sleep for Cardbus kind of devices. + */ if (Adapter->chip_id == 0xBECE0210) udelay(800); @@ -226,20 +226,20 @@ INT ReadBeceemEEPROMBulk(struct bcm_mini_adapter *Adapter, return STATUS_SUCCESS; } /* ReadBeceemEEPROMBulk() */ -//----------------------------------------------------------------------------- -// Procedure: ReadBeceemEEPROM -// -// Description: This routine reads 4 data from EEPROM. It uses 1 or 2 page -// reads to do this operation. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// uiOffset - EEPROM Offset to read the data from. -// pBuffer - Pointer to word where data needs to be stored in. -// -// Returns: -// OSAL_STATUS_CODE: -//----------------------------------------------------------------------------- +/* + * Procedure: ReadBeceemEEPROM + * + * Description: This routine reads 4 data from EEPROM. It uses 1 or 2 page + * reads to do this operation. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * uiOffset - EEPROM Offset to read the data from. + * pBuffer - Pointer to word where data needs to be stored in. + * + * Returns: + * OSAL_STATUS_CODE: + */ INT ReadBeceemEEPROM(struct bcm_mini_adapter *Adapter, DWORD uiOffset, @@ -257,7 +257,8 @@ INT ReadBeceemEEPROM(struct bcm_mini_adapter *Adapter, ReadBeceemEEPROMBulk(Adapter, uiTempOffset, (PUINT)&uiData[0], 4); /* A word can overlap at most over 2 pages. In that case we read the - * next page too. */ + * next page too. + */ if (uiByteOffset > 12) ReadBeceemEEPROMBulk(Adapter, uiTempOffset + MAX_RW_SIZE, (PUINT)&uiData[4], 4); @@ -282,21 +283,21 @@ INT ReadMacAddressFromNVM(struct bcm_mini_adapter *Adapter) return Status; } -//----------------------------------------------------------------------------- -// Procedure: BeceemEEPROMBulkRead -// -// Description: Reads the EEPROM and returns the Data. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// pBuffer - Buffer to store the data read from EEPROM -// uiOffset - Offset of EEPROM from where data should be read -// uiNumBytes - Number of bytes to be read from the EEPROM. -// -// Returns: -// OSAL_STATUS_SUCCESS - if EEPROM read is successful. -// <FAILURE> - if failed. -//----------------------------------------------------------------------------- +/* + * Procedure: BeceemEEPROMBulkRead + * + * Description: Reads the EEPROM and returns the Data. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * pBuffer - Buffer to store the data read from EEPROM + * uiOffset - Offset of EEPROM from where data should be read + * uiNumBytes - Number of bytes to be read from the EEPROM. + * + * Returns: + * OSAL_STATUS_SUCCESS - if EEPROM read is successful. + * <FAILURE> - if failed. + */ INT BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, PUINT pBuffer, @@ -304,7 +305,7 @@ INT BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, UINT uiNumBytes) { UINT uiData[4] = {0}; - // UINT uiAddress = 0; + /* UINT uiAddress = 0; */ UINT uiBytesRemaining = uiNumBytes; UINT uiIndex = 0; UINT uiTempOffset = 0; @@ -336,7 +337,8 @@ INT BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, if (uiBytesRemaining >= MAX_RW_SIZE) { /* For the requests more than or equal to 16 bytes, use bulk * read function to make the access faster. - * We read 4 Dwords of data */ + * We read 4 Dwords of data + */ if (0 == ReadBeceemEEPROMBulk(Adapter, uiOffset, &uiData[0], 4)) { memcpy(pcBuff + uiIndex, &uiData[0], MAX_RW_SIZE); uiOffset += MAX_RW_SIZE; @@ -344,7 +346,7 @@ INT BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, uiIndex += MAX_RW_SIZE; } else { uiFailureRetries++; - mdelay(3); //sleep for a while before retry... + mdelay(3); /* sleep for a while before retry... */ } } else if (uiBytesRemaining >= 4) { if (0 == ReadBeceemEEPROM(Adapter, uiOffset, &uiData[0])) { @@ -354,18 +356,18 @@ INT BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, uiIndex += 4; } else { uiFailureRetries++; - mdelay(3); //sleep for a while before retry... + mdelay(3); /* sleep for a while before retry... */ } } else { - // Handle the reads less than 4 bytes... + /* Handle the reads less than 4 bytes... */ PUCHAR pCharBuff = (PUCHAR)pBuffer; pCharBuff += uiIndex; if (0 == ReadBeceemEEPROM(Adapter, uiOffset, &uiData[0])) { - memcpy(pCharBuff, &uiData[0], uiBytesRemaining); //copy only bytes requested. + memcpy(pCharBuff, &uiData[0], uiBytesRemaining); /* copy only bytes requested. */ uiBytesRemaining = 0; } else { uiFailureRetries++; - mdelay(3); //sleep for a while before retry... + mdelay(3); /* sleep for a while before retry... */ } } } @@ -373,21 +375,21 @@ INT BeceemEEPROMBulkRead(struct bcm_mini_adapter *Adapter, return 0; } -//----------------------------------------------------------------------------- -// Procedure: BeceemFlashBulkRead -// -// Description: Reads the FLASH and returns the Data. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// pBuffer - Buffer to store the data read from FLASH -// uiOffset - Offset of FLASH from where data should be read -// uiNumBytes - Number of bytes to be read from the FLASH. -// -// Returns: -// OSAL_STATUS_SUCCESS - if FLASH read is successful. -// <FAILURE> - if failed. -//----------------------------------------------------------------------------- +/* + * Procedure: BeceemFlashBulkRead + * + * Description: Reads the FLASH and returns the Data. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * pBuffer - Buffer to store the data read from FLASH + * uiOffset - Offset of FLASH from where data should be read + * uiNumBytes - Number of bytes to be read from the FLASH. + * + * Returns: + * OSAL_STATUS_SUCCESS - if FLASH read is successful. + * <FAILURE> - if failed. + */ static INT BeceemFlashBulkRead(struct bcm_mini_adapter *Adapter, PUINT pBuffer, @@ -405,8 +407,9 @@ static INT BeceemFlashBulkRead(struct bcm_mini_adapter *Adapter, return -ENODEV; } - // Adding flash Base address - // uiOffset = uiOffset + GetFlashBaseAddr(Adapter); + /* Adding flash Base address + * uiOffset = uiOffset + GetFlashBaseAddr(Adapter); + */ #if defined(BCM_SHM_INTERFACE) && !defined(FLASH_DIRECT_ACCESS) Status = bcmflash_raw_read((uiOffset/FLASH_PART_SIZE), (uiOffset % FLASH_PART_SIZE), (unsigned char *)pBuffer, uiNumBytes); return Status; @@ -453,18 +456,18 @@ static INT BeceemFlashBulkRead(struct bcm_mini_adapter *Adapter, return Status; } -//----------------------------------------------------------------------------- -// Procedure: BcmGetFlashSize -// -// Description: Finds the size of FLASH. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// -// Returns: -// UINT - size of the FLASH Storage. -// -//----------------------------------------------------------------------------- +/* + * Procedure: BcmGetFlashSize + * + * Description: Finds the size of FLASH. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * + * Returns: + * UINT - size of the FLASH Storage. + * + */ static UINT BcmGetFlashSize(struct bcm_mini_adapter *Adapter) { @@ -474,32 +477,32 @@ static UINT BcmGetFlashSize(struct bcm_mini_adapter *Adapter) return 32 * 1024; } -//----------------------------------------------------------------------------- -// Procedure: BcmGetEEPROMSize -// -// Description: Finds the size of EEPROM. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// -// Returns: -// UINT - size of the EEPROM Storage. -// -//----------------------------------------------------------------------------- +/* + * Procedure: BcmGetEEPROMSize + * + * Description: Finds the size of EEPROM. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * + * Returns: + * UINT - size of the EEPROM Storage. + * + */ static UINT BcmGetEEPROMSize(struct bcm_mini_adapter *Adapter) { UINT uiData = 0; UINT uiIndex = 0; - // - // if EEPROM is present and already Calibrated,it will have - // 'BECM' string at 0th offset. - // To find the EEPROM size read the possible boundaries of the - // EEPROM like 4K,8K etc..accessing the EEPROM beyond its size will - // result in wrap around. So when we get the End of the EEPROM we will - // get 'BECM' string which is indeed at offset 0. - // + /* + * if EEPROM is present and already Calibrated,it will have + * 'BECM' string at 0th offset. + * To find the EEPROM size read the possible boundaries of the + * EEPROM like 4K,8K etc..accessing the EEPROM beyond its size will + * result in wrap around. So when we get the End of the EEPROM we will + * get 'BECM' string which is indeed at offset 0. + */ BeceemEEPROMBulkRead(Adapter, &uiData, 0x0, 4); if (uiData == BECM) { for (uiIndex = 2; uiIndex <= 256; uiIndex *= 2) { @@ -508,9 +511,9 @@ static UINT BcmGetEEPROMSize(struct bcm_mini_adapter *Adapter) return uiIndex * 1024; } } else { - // - // EEPROM may not be present or not programmed - // + /* + * EEPROM may not be present or not programmed + */ uiData = 0xBABEFACE; if (0 == BeceemEEPROMBulkWrite(Adapter, (PUCHAR)&uiData, 0, 4, TRUE)) { uiData = 0; @@ -524,20 +527,20 @@ static UINT BcmGetEEPROMSize(struct bcm_mini_adapter *Adapter) return 0; } -//----------------------------------------------------------------------------- -// Procedure: FlashSectorErase -// -// Description: Finds the sector size of the FLASH. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// addr - sector start address -// numOfSectors - number of sectors to be erased. -// -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: FlashSectorErase + * + * Description: Finds the sector size of the FLASH. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * addr - sector start address + * numOfSectors - number of sectors to be erased. + * + * Returns: + * OSAL_STATUS_CODE + * + */ static INT FlashSectorErase(struct bcm_mini_adapter *Adapter, UINT addr, @@ -570,9 +573,10 @@ static INT FlashSectorErase(struct bcm_mini_adapter *Adapter, return uiStatus; } iRetries++; - // After every try lets make the CPU free for 10 ms. generally time taken by the - // the sector erase cycle is 500 ms to 40000 msec. hence sleeping 10 ms - // won't hamper performance in any case. + /* After every try lets make the CPU free for 10 ms. generally time taken by the + * the sector erase cycle is 500 ms to 40000 msec. hence sleeping 10 ms + * won't hamper performance in any case. + */ msleep(10); } while ((uiStatus & 0x1) && (iRetries < 400)); @@ -585,38 +589,38 @@ static INT FlashSectorErase(struct bcm_mini_adapter *Adapter, } return 0; } -//----------------------------------------------------------------------------- -// Procedure: flashByteWrite -// -// Description: Performs Byte by Byte write to flash -// -// Arguments: -// Adapter - ptr to Adapter object instance -// uiOffset - Offset of the flash where data needs to be written to. -// pData - Address of Data to be written. -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: flashByteWrite + * + * Description: Performs Byte by Byte write to flash + * + * Arguments: + * Adapter - ptr to Adapter object instance + * uiOffset - Offset of the flash where data needs to be written to. + * pData - Address of Data to be written. + * Returns: + * OSAL_STATUS_CODE + * + */ static INT flashByteWrite(struct bcm_mini_adapter *Adapter, UINT uiOffset, PVOID pData) { UINT uiStatus = 0; - INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; //3 + INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ UINT value; ULONG ulData = *(PUCHAR)pData; int bytes; - // - // need not write 0xFF because write requires an erase and erase will - // make whole sector 0xFF. - // + /* + * need not write 0xFF because write requires an erase and erase will + * make whole sector 0xFF. + */ if (0xFF == ulData) return STATUS_SUCCESS; - // DumpDebug(NVM_RW,("flashWrite ====>\n")); + /* DumpDebug(NVM_RW,("flashWrite ====>\n")); */ value = (FLASH_CMD_WRITE_ENABLE << 24); if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Write enable in FLASH_SPI_CMDQ_REG register fails"); @@ -633,7 +637,7 @@ static INT flashByteWrite(struct bcm_mini_adapter *Adapter, return STATUS_FAILURE; } - //__udelay(950); + /* __udelay(950); */ do { value = (FLASH_CMD_STATUS_REG_READ << 24); @@ -641,7 +645,7 @@ static INT flashByteWrite(struct bcm_mini_adapter *Adapter, BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programing of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } - //__udelay(1); + /* __udelay(1); */ bytes = rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus)); if (bytes < 0) { uiStatus = bytes; @@ -662,37 +666,37 @@ static INT flashByteWrite(struct bcm_mini_adapter *Adapter, return STATUS_SUCCESS; } -//----------------------------------------------------------------------------- -// Procedure: flashWrite -// -// Description: Performs write to flash -// -// Arguments: -// Adapter - ptr to Adapter object instance -// uiOffset - Offset of the flash where data needs to be written to. -// pData - Address of Data to be written. -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: flashWrite + * + * Description: Performs write to flash + * + * Arguments: + * Adapter - ptr to Adapter object instance + * uiOffset - Offset of the flash where data needs to be written to. + * pData - Address of Data to be written. + * Returns: + * OSAL_STATUS_CODE + * + */ static INT flashWrite(struct bcm_mini_adapter *Adapter, UINT uiOffset, PVOID pData) { - //UINT uiStatus = 0; - //INT iRetries = 0; - //UINT uiReadBack = 0; - + /* UINT uiStatus = 0; + * INT iRetries = 0; + * UINT uiReadBack = 0; + */ UINT uiStatus = 0; - INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; //3 + INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ UINT value; UINT uiErasePattern[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; int bytes; - // - // need not write 0xFFFFFFFF because write requires an erase and erase will - // make whole sector 0xFFFFFFFF. - // + /* + * need not write 0xFFFFFFFF because write requires an erase and erase will + * make whole sector 0xFFFFFFFF. + */ if (!memcmp(pData, uiErasePattern, MAX_RW_SIZE)) return 0; @@ -708,14 +712,14 @@ static INT flashWrite(struct bcm_mini_adapter *Adapter, return STATUS_FAILURE; } - //__udelay(950); + /* __udelay(950); */ do { value = (FLASH_CMD_STATUS_REG_READ << 24); if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programing of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } - //__udelay(1); + /* __udelay(1); */ bytes = rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus)); if (bytes < 0) { uiStatus = bytes; @@ -724,10 +728,11 @@ static INT flashWrite(struct bcm_mini_adapter *Adapter, } iRetries--; - //this will ensure that in there will be no changes in the current path. - //currently one rdm/wrm takes 125 us. - //Hence 125 *2 * FLASH_PER_RETRIES_DELAY > 3 ms(worst case delay) - //Hence current implementation cycle will intoduce no delay in current path + /* this will ensure that in there will be no changes in the current path. + * currently one rdm/wrm takes 125 us. + * Hence 125 *2 * FLASH_PER_RETRIES_DELAY > 3 ms(worst case delay) + * Hence current implementation cycle will intoduce no delay in current path + */ if (iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) msleep(1); } while ((uiStatus & 0x1) && (iRetries > 0)); @@ -740,38 +745,38 @@ static INT flashWrite(struct bcm_mini_adapter *Adapter, return STATUS_SUCCESS; } -//----------------------------------------------------------------------------- -// Procedure: flashByteWriteStatus -// -// Description: Performs byte by byte write to flash with write done status check -// -// Arguments: -// Adapter - ptr to Adapter object instance -// uiOffset - Offset of the flash where data needs to be written to. -// pData - Address of the Data to be written. -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/*----------------------------------------------------------------------------- + * Procedure: flashByteWriteStatus + * + * Description: Performs byte by byte write to flash with write done status check + * + * Arguments: + * Adapter - ptr to Adapter object instance + * uiOffset - Offset of the flash where data needs to be written to. + * pData - Address of the Data to be written. + * Returns: + * OSAL_STATUS_CODE + * + */ static INT flashByteWriteStatus(struct bcm_mini_adapter *Adapter, UINT uiOffset, PVOID pData) { UINT uiStatus = 0; - INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; //3 + INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ ULONG ulData = *(PUCHAR)pData; UINT value; int bytes; - // - // need not write 0xFFFFFFFF because write requires an erase and erase will - // make whole sector 0xFFFFFFFF. - // + /* + * need not write 0xFFFFFFFF because write requires an erase and erase will + * make whole sector 0xFFFFFFFF. + */ if (0xFF == ulData) return STATUS_SUCCESS; - // DumpDebug(NVM_RW,("flashWrite ====>\n")); + /* DumpDebug(NVM_RW,("flashWrite ====>\n")); */ value = (FLASH_CMD_WRITE_ENABLE << 24); if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { @@ -788,7 +793,7 @@ static INT flashByteWriteStatus(struct bcm_mini_adapter *Adapter, return STATUS_FAILURE; } - //msleep(1); + /* msleep(1); */ do { value = (FLASH_CMD_STATUS_REG_READ << 24); @@ -796,7 +801,7 @@ static INT flashByteWriteStatus(struct bcm_mini_adapter *Adapter, BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programing of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } - //__udelay(1); + /* __udelay(1); */ bytes = rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus)); if (bytes < 0) { uiStatus = bytes; @@ -817,35 +822,35 @@ static INT flashByteWriteStatus(struct bcm_mini_adapter *Adapter, return STATUS_SUCCESS; } -//----------------------------------------------------------------------------- -// Procedure: flashWriteStatus -// -// Description: Performs write to flash with write done status check -// -// Arguments: -// Adapter - ptr to Adapter object instance -// uiOffset - Offset of the flash where data needs to be written to. -// pData - Address of the Data to be written. -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: flashWriteStatus + * + * Description: Performs write to flash with write done status check + * + * Arguments: + * Adapter - ptr to Adapter object instance + * uiOffset - Offset of the flash where data needs to be written to. + * pData - Address of the Data to be written. + * Returns: + * OSAL_STATUS_CODE + * + */ static INT flashWriteStatus(struct bcm_mini_adapter *Adapter, UINT uiOffset, PVOID pData) { UINT uiStatus = 0; - INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; //3 - //UINT uiReadBack = 0; + INT iRetries = MAX_FLASH_RETRIES * FLASH_PER_RETRIES_DELAY; /* 3 */ + /* UINT uiReadBack = 0; */ UINT value; UINT uiErasePattern[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; int bytes; - // - // need not write 0xFFFFFFFF because write requires an erase and erase will - // make whole sector 0xFFFFFFFF. - // + /* + * need not write 0xFFFFFFFF because write requires an erase and erase will + * make whole sector 0xFFFFFFFF. + */ if (!memcmp(pData, uiErasePattern, MAX_RW_SIZE)) return 0; @@ -859,7 +864,7 @@ static INT flashWriteStatus(struct bcm_mini_adapter *Adapter, BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Data write fails..."); return STATUS_FAILURE; } - // __udelay(1); + /* __udelay(1); */ do { value = (FLASH_CMD_STATUS_REG_READ << 24); @@ -867,7 +872,7 @@ static INT flashWriteStatus(struct bcm_mini_adapter *Adapter, BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Programing of FLASH_SPI_CMDQ_REG fails"); return STATUS_FAILURE; } - //__udelay(1); + /* __udelay(1); */ bytes = rdmalt(Adapter, FLASH_SPI_READQ_REG, &uiStatus, sizeof(uiStatus)); if (bytes < 0) { uiStatus = bytes; @@ -875,10 +880,11 @@ static INT flashWriteStatus(struct bcm_mini_adapter *Adapter, return uiStatus; } iRetries--; - // this will ensure that in there will be no changes in the current path. - // currently one rdm/wrm takes 125 us. - // Hence 125 *2 * FLASH_PER_RETRIES_DELAY >3 ms(worst case delay) - // Hence current implementation cycle will intoduce no delay in current path + /* this will ensure that in there will be no changes in the current path. + * currently one rdm/wrm takes 125 us. + * Hence 125 *2 * FLASH_PER_RETRIES_DELAY >3 ms(worst case delay) + * Hence current implementation cycle will intoduce no delay in current path + */ if (iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) msleep(1); @@ -892,18 +898,18 @@ static INT flashWriteStatus(struct bcm_mini_adapter *Adapter, return STATUS_SUCCESS; } -//----------------------------------------------------------------------------- -// Procedure: BcmRestoreBlockProtectStatus -// -// Description: Restores the original block protection status. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// ulWriteStatus -Original status -// Returns: -// <VOID> -// -//----------------------------------------------------------------------------- +/* + * Procedure: BcmRestoreBlockProtectStatus + * + * Description: Restores the original block protection status. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * ulWriteStatus -Original status + * Returns: + * <VOID> + * + */ static VOID BcmRestoreBlockProtectStatus(struct bcm_mini_adapter *Adapter, ULONG ulWriteStatus) { @@ -917,18 +923,18 @@ static VOID BcmRestoreBlockProtectStatus(struct bcm_mini_adapter *Adapter, ULONG udelay(20); } -//----------------------------------------------------------------------------- -// Procedure: BcmFlashUnProtectBlock -// -// Description: UnProtects appropriate blocks for writing. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// uiOffset - Offset of the flash where data needs to be written to. This should be Sector aligned. -// Returns: -// ULONG - Status value before UnProtect. -// -//----------------------------------------------------------------------------- +/* + * Procedure: BcmFlashUnProtectBlock + * + * Description: UnProtects appropriate blocks for writing. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * uiOffset - Offset of the flash where data needs to be written to. This should be Sector aligned. + * Returns: + * ULONG - Status value before UnProtect. + * + */ static ULONG BcmFlashUnProtectBlock(struct bcm_mini_adapter *Adapter, UINT uiOffset, UINT uiLength) { @@ -937,63 +943,63 @@ static ULONG BcmFlashUnProtectBlock(struct bcm_mini_adapter *Adapter, UINT uiOff UINT value; uiOffset = uiOffset&0x000FFFFF; - // - // Implemented only for 1MB Flash parts. - // + /* + * Implemented only for 1MB Flash parts. + */ if (FLASH_PART_SST25VF080B == Adapter->ulFlashID) { - // - // Get Current BP status. - // + /* + * Get Current BP status. + */ value = (FLASH_CMD_STATUS_REG_READ << 24); wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)); udelay(10); - // - // Read status will be WWXXYYZZ. We have to take only WW. - // + /* + * Read status will be WWXXYYZZ. We have to take only WW. + */ rdmalt(Adapter, FLASH_SPI_READQ_REG, (PUINT)&ulStatus, sizeof(ulStatus)); ulStatus >>= 24; ulWriteStatus = ulStatus; - // - // Bits [5-2] give current block level protection status. - // Bit5: BP3 - DONT CARE - // BP2-BP0: 0 - NO PROTECTION, 1 - UPPER 1/16, 2 - UPPER 1/8, 3 - UPPER 1/4 - // 4 - UPPER 1/2. 5 to 7 - ALL BLOCKS - // + /* + * Bits [5-2] give current block level protection status. + * Bit5: BP3 - DONT CARE + * BP2-BP0: 0 - NO PROTECTION, 1 - UPPER 1/16, 2 - UPPER 1/8, 3 - UPPER 1/4 + * 4 - UPPER 1/2. 5 to 7 - ALL BLOCKS + */ if (ulStatus) { if ((uiOffset+uiLength) <= 0x80000) { - // - // Offset comes in lower half of 1MB. Protect the upper half. - // Clear BP1 and BP0 and set BP2. - // + /* + * Offset comes in lower half of 1MB. Protect the upper half. + * Clear BP1 and BP0 and set BP2. + */ ulWriteStatus |= (0x4<<2); ulWriteStatus &= ~(0x3<<2); } else if ((uiOffset + uiLength) <= 0xC0000) { - // - // Offset comes below Upper 1/4. Upper 1/4 can be protected. - // Clear BP2 and set BP1 and BP0. - // + /* + * Offset comes below Upper 1/4. Upper 1/4 can be protected. + * Clear BP2 and set BP1 and BP0. + */ ulWriteStatus |= (0x3<<2); ulWriteStatus &= ~(0x1<<4); } else if ((uiOffset + uiLength) <= 0xE0000) { - // - // Offset comes below Upper 1/8. Upper 1/8 can be protected. - // Clear BP2 and BP0 and set BP1 - // + /* + * Offset comes below Upper 1/8. Upper 1/8 can be protected. + * Clear BP2 and BP0 and set BP1 + */ ulWriteStatus |= (0x1<<3); ulWriteStatus &= ~(0x5<<2); } else if ((uiOffset + uiLength) <= 0xF0000) { - // - // Offset comes below Upper 1/16. Only upper 1/16 can be protected. - // Set BP0 and Clear BP2,BP1. - // + /* + * Offset comes below Upper 1/16. Only upper 1/16 can be protected. + * Set BP0 and Clear BP2,BP1. + */ ulWriteStatus |= (0x1<<2); ulWriteStatus &= ~(0x3<<3); } else { - // - // Unblock all. - // Clear BP2,BP1 and BP0. - // + /* + * Unblock all. + * Clear BP2,BP1 and BP0. + */ ulWriteStatus &= ~(0x7<<2); } @@ -1008,21 +1014,21 @@ static ULONG BcmFlashUnProtectBlock(struct bcm_mini_adapter *Adapter, UINT uiOff return ulStatus; } -//----------------------------------------------------------------------------- -// Procedure: BeceemFlashBulkWrite -// -// Description: Performs write to the flash -// -// Arguments: -// Adapter - ptr to Adapter object instance -// pBuffer - Data to be written. -// uiOffset - Offset of the flash where data needs to be written to. -// uiNumBytes - Number of bytes to be written. -// bVerify - read verify flag. -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: BeceemFlashBulkWrite + * + * Description: Performs write to the flash + * + * Arguments: + * Adapter - ptr to Adapter object instance + * pBuffer - Data to be written. + * uiOffset - Offset of the flash where data needs to be written to. + * uiNumBytes - Number of bytes to be written. + * bVerify - read verify flag. + * Returns: + * OSAL_STATUS_CODE + * + */ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, PUINT pBuffer, @@ -1052,8 +1058,9 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, uiOffsetFromSectStart = uiOffset & ~(Adapter->uiSectorSize - 1); - // Adding flash Base address - // uiOffset = uiOffset + GetFlashBaseAddr(Adapter); + /* Adding flash Base address + * uiOffset = uiOffset + GetFlashBaseAddr(Adapter); + */ uiSectAlignAddr = uiOffset & ~(Adapter->uiSectorSize - 1); uiCurrSectOffsetAddr = uiOffset & (Adapter->uiSectorSize - 1); @@ -1062,19 +1069,20 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, pTempBuff = kmalloc(Adapter->uiSectorSize, GFP_KERNEL); if (NULL == pTempBuff) goto BeceemFlashBulkWrite_EXIT; - // - // check if the data to be written is overlapped across sectors - // + /* + * check if the data to be written is overlapped across sectors + */ if (uiOffset+uiNumBytes < uiSectBoundary) { uiNumSectTobeRead = 1; } else { - // Number of sectors = Last sector start address/First sector start address + /* Number of sectors = Last sector start address/First sector start address */ uiNumSectTobeRead = (uiCurrSectOffsetAddr + uiNumBytes) / Adapter->uiSectorSize; if ((uiCurrSectOffsetAddr + uiNumBytes)%Adapter->uiSectorSize) uiNumSectTobeRead++; } - // Check whether Requested sector is writable or not in case of flash2x write. But if write call is - // for DSD calibration, allow it without checking of sector permission + /* Check whether Requested sector is writable or not in case of flash2x write. But if write call is + * for DSD calibration, allow it without checking of sector permission + */ if (IsFlash2x(Adapter) && (Adapter->bAllDSDWriteAllow == FALSE)) { index = 0; @@ -1092,8 +1100,9 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, } Adapter->SelectedChip = RESET_CHIP_SELECT; while (uiNumSectTobeRead) { - // do_gettimeofday(&tv1); - // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "\nTime In start of write :%ld ms\n",(tv1.tv_sec *1000 + tv1.tv_usec /1000)); + /* do_gettimeofday(&tv1); + * BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "\nTime In start of write :%ld ms\n",(tv1.tv_sec *1000 + tv1.tv_usec /1000)); + */ uiPartOffset = (uiSectAlignAddr & (FLASH_PART_SIZE - 1)) + GetFlashBaseAddr(Adapter); BcmDoChipSelect(Adapter, uiSectAlignAddr); @@ -1106,9 +1115,9 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, goto BeceemFlashBulkWrite_EXIT; } - // do_gettimeofday(&tr); - // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken by Read :%ld ms\n", (tr.tv_sec *1000 + tr.tv_usec/1000) - (tv1.tv_sec *1000 + tv1.tv_usec/1000)); - + /* do_gettimeofday(&tr); + * BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken by Read :%ld ms\n", (tr.tv_sec *1000 + tr.tv_usec/1000) - (tv1.tv_sec *1000 + tv1.tv_usec/1000)); + */ ulStatus = BcmFlashUnProtectBlock(Adapter, uiSectAlignAddr, Adapter->uiSectorSize); if (uiNumSectTobeRead > 1) { @@ -1123,9 +1132,9 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, SaveHeaderIfPresent(Adapter, (PUCHAR)pTempBuff, uiOffsetFromSectStart); FlashSectorErase(Adapter, uiPartOffset, 1); - // do_gettimeofday(&te); - // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken by Erase :%ld ms\n", (te.tv_sec *1000 + te.tv_usec/1000) - (tr.tv_sec *1000 + tr.tv_usec/1000)); - + /* do_gettimeofday(&te); + * BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken by Erase :%ld ms\n", (te.tv_sec *1000 + te.tv_usec/1000) - (tr.tv_sec *1000 + tr.tv_usec/1000)); + */ for (uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex += Adapter->ulFlashWriteSize) { if (Adapter->device_removed) { Status = -1; @@ -1138,8 +1147,9 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, } } - // do_gettimeofday(&tw); - // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken in Write to Flash :%ld ms\n", (tw.tv_sec *1000 + tw.tv_usec/1000) - (te.tv_sec *1000 + te.tv_usec/1000)); + /* do_gettimeofday(&tw); + * BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken in Write to Flash :%ld ms\n", (tw.tv_sec *1000 + tw.tv_usec/1000) - (te.tv_sec *1000 + te.tv_usec/1000)); + */ for (uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex += MAX_RW_SIZE) { if (STATUS_SUCCESS == BeceemFlashBulkRead(Adapter, (PUINT)ucReadBk, uiOffsetFromSectStart + uiIndex, MAX_RW_SIZE)) { if (Adapter->ulFlashWriteSize == 1) { @@ -1162,8 +1172,9 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, } } } - // do_gettimeofday(&twv); - // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken in Write to Flash verification :%ld ms\n", (twv.tv_sec *1000 + twv.tv_usec/1000) - (tw.tv_sec *1000 + tw.tv_usec/1000)); + /* do_gettimeofday(&twv); + * BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken in Write to Flash verification :%ld ms\n", (twv.tv_sec *1000 + twv.tv_usec/1000) - (tw.tv_sec *1000 + tw.tv_usec/1000)); + */ if (ulStatus) { BcmRestoreBlockProtectStatus(Adapter, ulStatus); ulStatus = 0; @@ -1175,13 +1186,13 @@ static INT BeceemFlashBulkWrite(struct bcm_mini_adapter *Adapter, uiOffsetFromSectStart += Adapter->uiSectorSize; uiNumSectTobeRead--; } - // do_gettimeofday(&tv2); - // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Time after Write :%ld ms\n",(tv2.tv_sec *1000 + tv2.tv_usec/1000)); - // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken by in Write is :%ld ms\n", (tv2.tv_sec *1000 + tv2.tv_usec/1000) - (tv1.tv_sec *1000 + tv1.tv_usec/1000)); - // - // Cleanup. - // -BeceemFlashBulkWrite_EXIT : + /* do_gettimeofday(&tv2); + * BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Time after Write :%ld ms\n",(tv2.tv_sec *1000 + tv2.tv_usec/1000)); + * BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "Total time taken by in Write is :%ld ms\n", (tv2.tv_sec *1000 + tv2.tv_usec/1000) - (tv1.tv_sec *1000 + tv1.tv_usec/1000)); + * + * Cleanup. + */ +BeceemFlashBulkWrite_EXIT: if (ulStatus) BcmRestoreBlockProtectStatus(Adapter, ulStatus); @@ -1191,21 +1202,21 @@ BeceemFlashBulkWrite_EXIT : return Status; } -//----------------------------------------------------------------------------- -// Procedure: BeceemFlashBulkWriteStatus -// -// Description: Writes to Flash. Checks the SPI status after each write. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// pBuffer - Data to be written. -// uiOffset - Offset of the flash where data needs to be written to. -// uiNumBytes - Number of bytes to be written. -// bVerify - read verify flag. -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: BeceemFlashBulkWriteStatus + * + * Description: Writes to Flash. Checks the SPI status after each write. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * pBuffer - Data to be written. + * uiOffset - Offset of the flash where data needs to be written to. + * uiNumBytes - Number of bytes to be written. + * bVerify - read verify flag. + * Returns: + * OSAL_STATUS_CODE + * + */ static INT BeceemFlashBulkWriteStatus(struct bcm_mini_adapter *Adapter, PUINT pBuffer, @@ -1230,10 +1241,10 @@ static INT BeceemFlashBulkWriteStatus(struct bcm_mini_adapter *Adapter, uiOffsetFromSectStart = uiOffset & ~(Adapter->uiSectorSize - 1); - // uiOffset += Adapter->ulFlashCalStart; - // Adding flash Base address - // uiOffset = uiOffset + GetFlashBaseAddr(Adapter); - + /* uiOffset += Adapter->ulFlashCalStart; + * Adding flash Base address + * uiOffset = uiOffset + GetFlashBaseAddr(Adapter); + */ uiSectAlignAddr = uiOffset & ~(Adapter->uiSectorSize - 1); uiCurrSectOffsetAddr = uiOffset & (Adapter->uiSectorSize - 1); uiSectBoundary = uiSectAlignAddr + Adapter->uiSectorSize; @@ -1242,13 +1253,13 @@ static INT BeceemFlashBulkWriteStatus(struct bcm_mini_adapter *Adapter, if (NULL == pTempBuff) goto BeceemFlashBulkWriteStatus_EXIT; - // - // check if the data to be written is overlapped across sectors - // + /* + * check if the data to be written is overlapped across sectors + */ if (uiOffset+uiNumBytes < uiSectBoundary) { uiNumSectTobeRead = 1; } else { - // Number of sectors = Last sector start address/First sector start address + /* Number of sectors = Last sector start address/First sector start address */ uiNumSectTobeRead = (uiCurrSectOffsetAddr + uiNumBytes) / Adapter->uiSectorSize; if ((uiCurrSectOffsetAddr + uiNumBytes)%Adapter->uiSectorSize) uiNumSectTobeRead++; @@ -1331,10 +1342,10 @@ static INT BeceemFlashBulkWriteStatus(struct bcm_mini_adapter *Adapter, uiOffsetFromSectStart += Adapter->uiSectorSize; uiNumSectTobeRead--; } -// -// Cleanup. -// -BeceemFlashBulkWriteStatus_EXIT : +/* + * Cleanup. + */ +BeceemFlashBulkWriteStatus_EXIT: if (ulStatus) BcmRestoreBlockProtectStatus(Adapter, ulStatus); @@ -1343,17 +1354,17 @@ BeceemFlashBulkWriteStatus_EXIT : return Status; } -//----------------------------------------------------------------------------- -// Procedure: PropagateCalParamsFromEEPROMToMemory -// -// Description: Dumps the calibration section of EEPROM to DDR. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: PropagateCalParamsFromEEPROMToMemory + * + * Description: Dumps the calibration section of EEPROM to DDR. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * Returns: + * OSAL_STATUS_CODE + * + */ INT PropagateCalParamsFromEEPROMToMemory(struct bcm_mini_adapter *Adapter) { @@ -1404,32 +1415,32 @@ INT PropagateCalParamsFromEEPROMToMemory(struct bcm_mini_adapter *Adapter) return Status; } -//----------------------------------------------------------------------------- -// Procedure: PropagateCalParamsFromFlashToMemory -// -// Description: Dumps the calibration section of EEPROM to DDR. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: PropagateCalParamsFromFlashToMemory + * + * Description: Dumps the calibration section of EEPROM to DDR. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * Returns: + * OSAL_STATUS_CODE + * + */ INT PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) { PCHAR pBuff, pPtr; UINT uiEepromSize = 0; UINT uiBytesToCopy = 0; - //UINT uiIndex = 0; + /* UINT uiIndex = 0; */ UINT uiCalStartAddr = EEPROM_CALPARAM_START; UINT uiMemoryLoc = EEPROM_CAL_DATA_INTERNAL_LOC; UINT value; INT Status = 0; - // - // Write the signature first. This will ensure firmware does not access EEPROM. - // + /* + * Write the signature first. This will ensure firmware does not access EEPROM. + */ value = 0xbeadbead; wrmalt(Adapter, EEPROM_CAL_DATA_INTERNAL_LOC - 4, &value, sizeof(value)); value = 0xbeadbead; @@ -1441,9 +1452,9 @@ INT PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) uiEepromSize = ntohl(uiEepromSize); uiEepromSize >>= 16; - // - // subtract the auto init section size - // + /* + * subtract the auto init section size + */ uiEepromSize -= EEPROM_CALPARAM_START; if (uiEepromSize > 1024 * 1024) @@ -1479,20 +1490,20 @@ INT PropagateCalParamsFromFlashToMemory(struct bcm_mini_adapter *Adapter) return Status; } -//----------------------------------------------------------------------------- -// Procedure: BeceemEEPROMReadBackandVerify -// -// Description: Read back the data written and verifies. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// pBuffer - Data to be written. -// uiOffset - Offset of the flash where data needs to be written to. -// uiNumBytes - Number of bytes to be written. -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: BeceemEEPROMReadBackandVerify + * + * Description: Read back the data written and verifies. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * pBuffer - Data to be written. + * uiOffset - Offset of the flash where data needs to be written to. + * uiNumBytes - Number of bytes to be written. + * Returns: + * OSAL_STATUS_CODE + * + */ static INT BeceemEEPROMReadBackandVerify(struct bcm_mini_adapter *Adapter, PUINT pBuffer, @@ -1509,11 +1520,11 @@ static INT BeceemEEPROMReadBackandVerify(struct bcm_mini_adapter *Adapter, return -1; if (uiNumBytes >= MAX_RW_SIZE) { - // for the requests more than or equal to MAX_RW_SIZE bytes, use bulk read function to make the access faster. + /* for the requests more than or equal to MAX_RW_SIZE bytes, use bulk read function to make the access faster. */ BeceemEEPROMBulkRead(Adapter, &auiData[0], uiOffset, MAX_RW_SIZE); if (memcmp(&pBuffer[uiIndex], &auiData[0], MAX_RW_SIZE)) { - // re-write + /* re-write */ BeceemEEPROMBulkWrite(Adapter, (PUCHAR)(pBuffer + uiIndex), uiOffset, MAX_RW_SIZE, FALSE); mdelay(3); BeceemEEPROMBulkRead(Adapter, &auiData[0], uiOffset, MAX_RW_SIZE); @@ -1527,7 +1538,7 @@ static INT BeceemEEPROMReadBackandVerify(struct bcm_mini_adapter *Adapter, } else if (uiNumBytes >= 4) { BeceemEEPROMBulkRead(Adapter, &uiData, uiOffset, 4); if (uiData != pBuffer[uiIndex]) { - // re-write + /* re-write */ BeceemEEPROMBulkWrite(Adapter, (PUCHAR)(pBuffer + uiIndex), uiOffset, 4, FALSE); mdelay(3); BeceemEEPROMBulkRead(Adapter, &uiData, uiOffset, 4); @@ -1538,7 +1549,7 @@ static INT BeceemEEPROMReadBackandVerify(struct bcm_mini_adapter *Adapter, uiNumBytes -= 4; uiIndex++; } else { - // Handle the reads less than 4 bytes... + /* Handle the reads less than 4 bytes... */ uiData = 0; memcpy(&uiData, ((PUCHAR)pBuffer) + (uiIndex * sizeof(UINT)), uiNumBytes); BeceemEEPROMBulkRead(Adapter, &uiRdbk, uiOffset, 4); @@ -1565,19 +1576,19 @@ static VOID BcmSwapWord(UINT *ptr1) ptr[3] = ptr2[0]; } -//----------------------------------------------------------------------------- -// Procedure: BeceemEEPROMWritePage -// -// Description: Performs page write (16bytes) to the EEPROM -// -// Arguments: -// Adapter - ptr to Adapter object instance -// uiData - Data to be written. -// uiOffset - Offset of the EEPROM where data needs to be written to. -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: BeceemEEPROMWritePage + * + * Description: Performs page write (16bytes) to the EEPROM + * + * Arguments: + * Adapter - ptr to Adapter object instance + * uiData - Data to be written. + * uiOffset - Offset of the EEPROM where data needs to be written to. + * Returns: + * OSAL_STATUS_CODE + * + */ static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[], UINT uiOffset) { @@ -1595,7 +1606,8 @@ static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[] /* Clear the Empty/Avail/Full bits. After this it has been confirmed * that the bit was cleared by reading back the register. See NOTE below. * We also clear the Read queues as we do a EEPROM status register read - * later. */ + * later. + */ value = (EEPROM_WRITE_QUEUE_EMPTY | EEPROM_WRITE_QUEUE_AVAIL | EEPROM_WRITE_QUEUE_FULL | EEPROM_READ_DATA_AVAIL | EEPROM_READ_DATA_FULL); wrmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); @@ -1604,7 +1616,8 @@ static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[] wrmalt(Adapter, EEPROM_CMDQ_SPI_REG, &value, sizeof(value)); /* We can write back to back 8bits * 16 into the queue and as we have - * checked for the queue to be empty we can write in a burst. */ + * checked for the queue to be empty we can write in a burst. + */ value = uiData[0]; BcmSwapWord(&value); @@ -1625,13 +1638,15 @@ static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[] /* NOTE : After this write, on readback of EEPROM_SPI_Q_STATUS1_REG * shows that we see 7 for the EEPROM data write. Which means that * queue got full, also space is available as well as the queue is empty. - * This may happen in sequence. */ + * This may happen in sequence. + */ value = EEPROM_16_BYTE_PAGE_WRITE | uiOffset; wrmalt(Adapter, EEPROM_CMDQ_SPI_REG, &value, sizeof(value)); /* Ideally we should loop here without tries and eventually succeed. * What we are checking if the previous write has completed, and this - * may take time. We should wait till the Empty bit is set. */ + * may take time. We should wait till the Empty bit is set. + */ uiStatus = 0; rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus)); while ((uiStatus & EEPROM_WRITE_QUEUE_EMPTY) == 0) { @@ -1662,7 +1677,8 @@ static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[] * proceeding. Bit 0 in the EEPROM Status register should be 0 before * we proceed further. A 1 at Bit 0 indicates that the EEPROM is busy * with the previous write. Note also that issuing this read finally - * means the previous write to the EEPROM has completed. */ + * means the previous write to the EEPROM has completed. + */ uiRetries = MAX_EEPROM_RETRIES * RETRIES_PER_DELAY; uiEpromStatus = 0; while (uiRetries != 0) { @@ -1688,21 +1704,21 @@ static INT BeceemEEPROMWritePage(struct bcm_mini_adapter *Adapter, UINT uiData[] return STATUS_SUCCESS; } /* BeceemEEPROMWritePage */ -//----------------------------------------------------------------------------- -// Procedure: BeceemEEPROMBulkWrite -// -// Description: Performs write to the EEPROM -// -// Arguments: -// Adapter - ptr to Adapter object instance -// pBuffer - Data to be written. -// uiOffset - Offset of the EEPROM where data needs to be written to. -// uiNumBytes - Number of bytes to be written. -// bVerify - read verify flag. -// Returns: -// OSAL_STATUS_CODE -// -//----------------------------------------------------------------------------- +/* + * Procedure: BeceemEEPROMBulkWrite + * + * Description: Performs write to the EEPROM + * + * Arguments: + * Adapter - ptr to Adapter object instance + * pBuffer - Data to be written. + * uiOffset - Offset of the EEPROM where data needs to be written to. + * uiNumBytes - Number of bytes to be written. + * bVerify - read verify flag. + * Returns: + * OSAL_STATUS_CODE + * + */ INT BeceemEEPROMBulkWrite(struct bcm_mini_adapter *Adapter, PUCHAR pBuffer, @@ -1711,13 +1727,14 @@ INT BeceemEEPROMBulkWrite(struct bcm_mini_adapter *Adapter, BOOLEAN bVerify) { UINT uiBytesToCopy = uiNumBytes; - // UINT uiRdbk = 0; + /* UINT uiRdbk = 0; */ UINT uiData[4] = {0}; UINT uiIndex = 0; UINT uiTempOffset = 0; UINT uiExtraBytes = 0; - // PUINT puiBuffer = (PUINT)pBuffer; - // INT value; + /* PUINT puiBuffer = (PUINT)pBuffer; + * INT value; + */ if (uiOffset % MAX_RW_SIZE && uiBytesToCopy) { uiTempOffset = uiOffset - (uiOffset % MAX_RW_SIZE); @@ -1758,9 +1775,9 @@ INT BeceemEEPROMBulkWrite(struct bcm_mini_adapter *Adapter, uiOffset += MAX_RW_SIZE; uiBytesToCopy -= MAX_RW_SIZE; } else { - // - // To program non 16byte aligned data, read 16byte and then update. - // + /* + * To program non 16byte aligned data, read 16byte and then update. + */ BeceemEEPROMBulkRead(Adapter, &uiData[0], uiOffset, 16); memcpy(&uiData[0], pBuffer + uiIndex, uiBytesToCopy); @@ -1774,21 +1791,21 @@ INT BeceemEEPROMBulkWrite(struct bcm_mini_adapter *Adapter, return 0; } -//----------------------------------------------------------------------------- -// Procedure: BeceemNVMRead -// -// Description: Reads n number of bytes from NVM. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// pBuffer - Buffer to store the data read from NVM -// uiOffset - Offset of NVM from where data should be read -// uiNumBytes - Number of bytes to be read from the NVM. -// -// Returns: -// OSAL_STATUS_SUCCESS - if NVM read is successful. -// <FAILURE> - if failed. -//----------------------------------------------------------------------------- +/* + * Procedure: BeceemNVMRead + * + * Description: Reads n number of bytes from NVM. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * pBuffer - Buffer to store the data read from NVM + * uiOffset - Offset of NVM from where data should be read + * uiNumBytes - Number of bytes to be read from the NVM. + * + * Returns: + * OSAL_STATUS_SUCCESS - if NVM read is successful. + * <FAILURE> - if failed. + */ INT BeceemNVMRead(struct bcm_mini_adapter *Adapter, PUINT pBuffer, @@ -1833,21 +1850,21 @@ INT BeceemNVMRead(struct bcm_mini_adapter *Adapter, return Status; } -//----------------------------------------------------------------------------- -// Procedure: BeceemNVMWrite -// -// Description: Writes n number of bytes to NVM. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// pBuffer - Buffer contains the data to be written. -// uiOffset - Offset of NVM where data to be written to. -// uiNumBytes - Number of bytes to be written.. -// -// Returns: -// OSAL_STATUS_SUCCESS - if NVM write is successful. -// <FAILURE> - if failed. -//----------------------------------------------------------------------------- +/* + * Procedure: BeceemNVMWrite + * + * Description: Writes n number of bytes to NVM. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * pBuffer - Buffer contains the data to be written. + * uiOffset - Offset of NVM where data to be written to. + * uiNumBytes - Number of bytes to be written.. + * + * Returns: + * OSAL_STATUS_SUCCESS - if NVM write is successful. + * <FAILURE> - if failed. + */ INT BeceemNVMWrite(struct bcm_mini_adapter *Adapter, PUINT pBuffer, @@ -1911,7 +1928,7 @@ INT BeceemNVMWrite(struct bcm_mini_adapter *Adapter, } else { if ((uiOffset + uiNumBytes) > EEPROM_CALPARAM_START) { ULONG ulBytesTobeSkipped = 0; - PUCHAR pcBuffer = (PUCHAR)pBuffer; // char pointer to take care of odd byte cases. + PUCHAR pcBuffer = (PUCHAR)pBuffer; /* char pointer to take care of odd byte cases. */ uiNumBytes -= (EEPROM_CALPARAM_START - uiOffset); ulBytesTobeSkipped += (EEPROM_CALPARAM_START - uiOffset); uiOffset += (EEPROM_CALPARAM_START - uiOffset); @@ -1928,7 +1945,7 @@ INT BeceemNVMWrite(struct bcm_mini_adapter *Adapter, } } } - // restore the values. + /* restore the values. */ wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); } else if (Adapter->eNVMType == NVM_EEPROM) { Status = BeceemEEPROMBulkWrite(Adapter, @@ -1944,19 +1961,19 @@ INT BeceemNVMWrite(struct bcm_mini_adapter *Adapter, return Status; } -//----------------------------------------------------------------------------- -// Procedure: BcmUpdateSectorSize -// -// Description: Updates the sector size to FLASH. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// uiSectorSize - sector size -// -// Returns: -// OSAL_STATUS_SUCCESS - if NVM write is successful. -// <FAILURE> - if failed. -//----------------------------------------------------------------------------- +/* + * Procedure: BcmUpdateSectorSize + * + * Description: Updates the sector size to FLASH. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * uiSectorSize - sector size + * + * Returns: + * OSAL_STATUS_SUCCESS - if NVM write is successful. + * <FAILURE> - if failed. + */ INT BcmUpdateSectorSize(struct bcm_mini_adapter *Adapter, UINT uiSectorSize) { @@ -1971,9 +1988,9 @@ INT BcmUpdateSectorSize(struct bcm_mini_adapter *Adapter, UINT uiSectorSize) value = 0; wrmalt(Adapter, 0x0f000C80, &value, sizeof(value)); - // - // Before updating the sector size in the reserved area, check if already present. - // + /* + * Before updating the sector size in the reserved area, check if already present. + */ BeceemFlashBulkRead(Adapter, (PUINT)&sFlashCsInfo, Adapter->ulFlashControlSectionStart, sizeof(sFlashCsInfo)); uiSectorSig = ntohl(sFlashCsInfo.FlashSectorSizeSig); uiCurrentSectorSize = ntohl(sFlashCsInfo.FlashSectorSize); @@ -2000,24 +2017,24 @@ INT BcmUpdateSectorSize(struct bcm_mini_adapter *Adapter, UINT uiSectorSize) } Restore: - // restore the values. + /* restore the values. */ wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); return Status; } -//----------------------------------------------------------------------------- -// Procedure: BcmGetFlashSectorSize -// -// Description: Finds the sector size of the FLASH. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// -// Returns: -// UINT - sector size. -// -//----------------------------------------------------------------------------- +/* + * Procedure: BcmGetFlashSectorSize + * + * Description: Finds the sector size of the FLASH. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * + * Returns: + * UINT - sector size. + * + */ static UINT BcmGetFlashSectorSize(struct bcm_mini_adapter *Adapter, UINT FlashSectorSizeSig, UINT FlashSectorSize) { @@ -2033,17 +2050,17 @@ static UINT BcmGetFlashSectorSize(struct bcm_mini_adapter *Adapter, UINT FlashSe if (uiSectorSig == FLASH_SECTOR_SIZE_SIG) { uiSectorSize = FlashSectorSize; - // - // If the sector size stored in the FLASH makes sense then use it. - // + /* + * If the sector size stored in the FLASH makes sense then use it. + */ if (uiSectorSize <= MAX_SECTOR_SIZE && uiSectorSize >= MIN_SECTOR_SIZE) { Adapter->uiSectorSize = uiSectorSize; } else if (Adapter->uiSectorSizeInCFG <= MAX_SECTOR_SIZE && Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE) { - //No valid size in FLASH, check if Config file has it. + /* No valid size in FLASH, check if Config file has it. */ Adapter->uiSectorSize = Adapter->uiSectorSizeInCFG; } else { - // Init to Default, if none of the above works. + /* Init to Default, if none of the above works. */ Adapter->uiSectorSize = DEFAULT_SECTOR_SIZE; } } else { @@ -2060,24 +2077,25 @@ static UINT BcmGetFlashSectorSize(struct bcm_mini_adapter *Adapter, UINT FlashSe return Adapter->uiSectorSize; } -//----------------------------------------------------------------------------- -// Procedure: BcmInitEEPROMQueues -// -// Description: Initialization of EEPROM queues. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// -// Returns: -// <OSAL_STATUS_CODE> -//----------------------------------------------------------------------------- +/* + * Procedure: BcmInitEEPROMQueues + * + * Description: Initialization of EEPROM queues. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * + * Returns: + * <OSAL_STATUS_CODE> + */ static INT BcmInitEEPROMQueues(struct bcm_mini_adapter *Adapter) { UINT value = 0; /* CHIP Bug : Clear the Avail bits on the Read queue. The default * value on this register is supposed to be 0x00001102. - * But we get 0x00001122. */ + * But we get 0x00001122. + */ BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Fixing reset value on 0x0f003004 register\n"); value = EEPROM_READ_DATA_AVAIL; wrmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); @@ -2096,17 +2114,17 @@ static INT BcmInitEEPROMQueues(struct bcm_mini_adapter *Adapter) return STATUS_SUCCESS; } /* BcmInitEEPROMQueues() */ -//----------------------------------------------------------------------------- -// Procedure: BcmInitNVM -// -// Description: Initialization of NVM, EEPROM size,FLASH size, sector size etc. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// -// Returns: -// <OSAL_STATUS_CODE> -//----------------------------------------------------------------------------- +/* + * Procedure: BcmInitNVM + * + * Description: Initialization of NVM, EEPROM size,FLASH size, sector size etc. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * + * Returns: + * <OSAL_STATUS_CODE> + */ INT BcmInitNVM(struct bcm_mini_adapter *ps_adapter) { @@ -2126,15 +2144,13 @@ INT BcmInitNVM(struct bcm_mini_adapter *ps_adapter) return STATUS_SUCCESS; } -/***************************************************************************/ -/*BcmGetNvmSize : set the EEPROM or flash size in Adapter. -* -*Input Parameter: -* Adapter data structure -*Return Value : -* 0. means success; -*/ -/***************************************************************************/ +/* BcmGetNvmSize : set the EEPROM or flash size in Adapter. + * + * Input Parameter: + * Adapter data structure + * Return Value : + * 0. means success; + */ static INT BcmGetNvmSize(struct bcm_mini_adapter *Adapter) { @@ -2146,61 +2162,61 @@ static INT BcmGetNvmSize(struct bcm_mini_adapter *Adapter) return 0; } -//----------------------------------------------------------------------------- -// Procedure: BcmValidateNvm -// -// Description: Validates the NVM Type option selected against the device -// -// Arguments: -// Adapter - ptr to Adapter object instance -// -// Returns: -// <VOID> -//----------------------------------------------------------------------------- +/* + * Procedure: BcmValidateNvm + * + * Description: Validates the NVM Type option selected against the device + * + * Arguments: + * Adapter - ptr to Adapter object instance + * + * Returns: + * <VOID> + */ static VOID BcmValidateNvmType(struct bcm_mini_adapter *Adapter) { - // - // if forcing the FLASH through CFG file, we should ensure device really has a FLASH. - // Accessing the FLASH address without the FLASH being present can cause hang/freeze etc. - // So if NVM_FLASH is selected for older chipsets, change it to AUTODETECT where EEPROM is 1st choice. - // + /* + * if forcing the FLASH through CFG file, we should ensure device really has a FLASH. + * Accessing the FLASH address without the FLASH being present can cause hang/freeze etc. + * So if NVM_FLASH is selected for older chipsets, change it to AUTODETECT where EEPROM is 1st choice. + */ if (Adapter->eNVMType == NVM_FLASH && Adapter->chip_id < 0xBECE3300) Adapter->eNVMType = NVM_AUTODETECT; } -//----------------------------------------------------------------------------- -// Procedure: BcmReadFlashRDID -// -// Description: Reads ID from Serial Flash -// -// Arguments: -// Adapter - ptr to Adapter object instance -// -// Returns: -// Flash ID -//----------------------------------------------------------------------------- +/* + * Procedure: BcmReadFlashRDID + * + * Description: Reads ID from Serial Flash + * + * Arguments: + * Adapter - ptr to Adapter object instance + * + * Returns: + * Flash ID + */ static ULONG BcmReadFlashRDID(struct bcm_mini_adapter *Adapter) { ULONG ulRDID = 0; UINT value; - // - // Read ID Instruction. - // + /* + * Read ID Instruction. + */ value = (FLASH_CMD_READ_ID << 24); wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)); - //Delay + /* Delay */ udelay(10); - // - // Read SPI READQ REG. The output will be WWXXYYZZ. - // The ID is 3Bytes long and is WWXXYY. ZZ needs to be Ignored. - // + /* + * Read SPI READQ REG. The output will be WWXXYYZZ. + * The ID is 3Bytes long and is WWXXYY. ZZ needs to be Ignored. + */ rdmalt(Adapter, FLASH_SPI_READQ_REG, (PUINT)&ulRDID, sizeof(ulRDID)); return (ulRDID >> 8); @@ -2314,7 +2330,7 @@ static INT ConvertEndianOf2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo) psFlash2xCSInfo->MagicNumber = ntohl(psFlash2xCSInfo->MagicNumber); psFlash2xCSInfo->FlashLayoutVersion = ntohl(psFlash2xCSInfo->FlashLayoutVersion); - //psFlash2xCSInfo->FlashLayoutMinorVersion = ntohs(psFlash2xCSInfo->FlashLayoutMinorVersion); + /* psFlash2xCSInfo->FlashLayoutMinorVersion = ntohs(psFlash2xCSInfo->FlashLayoutMinorVersion); */ psFlash2xCSInfo->ISOImageVersion = ntohl(psFlash2xCSInfo->ISOImageVersion); psFlash2xCSInfo->SCSIFirmwareVersion = ntohl(psFlash2xCSInfo->SCSIFirmwareVersion); psFlash2xCSInfo->OffsetFromZeroForPart1ISOImage = ntohl(psFlash2xCSInfo->OffsetFromZeroForPart1ISOImage); @@ -2367,11 +2383,11 @@ static INT ConvertEndianOf2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo) static INT ConvertEndianOfCSStructure(PFLASH_CS_INFO psFlashCSInfo) { - //UINT Index = 0; + /* UINT Index = 0; */ psFlashCSInfo->MagicNumber = ntohl(psFlashCSInfo->MagicNumber); psFlashCSInfo->FlashLayoutVersion = ntohl(psFlashCSInfo->FlashLayoutVersion); psFlashCSInfo->ISOImageVersion = ntohl(psFlashCSInfo->ISOImageVersion); - //won't convert according to old assumption + /* won't convert according to old assumption */ psFlashCSInfo->SCSIFirmwareVersion = (psFlashCSInfo->SCSIFirmwareVersion); psFlashCSInfo->OffsetFromZeroForPart1ISOImage = ntohl(psFlashCSInfo->OffsetFromZeroForPart1ISOImage); psFlashCSInfo->OffsetFromZeroForScsiFirmware = ntohl(psFlashCSInfo->OffsetFromZeroForScsiFirmware); @@ -2479,21 +2495,21 @@ static VOID UpdateVendorInfo(struct bcm_mini_adapter *Adapter) } } -//----------------------------------------------------------------------------- -// Procedure: BcmGetFlashCSInfo -// -// Description: Reads control structure and gets Cal section addresses. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// -// Returns: -// <VOID> -//----------------------------------------------------------------------------- +/* + * Procedure: BcmGetFlashCSInfo + * + * Description: Reads control structure and gets Cal section addresses. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * + * Returns: + * <VOID> + */ static INT BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) { - //FLASH_CS_INFO sFlashCsInfo = {0}; + /* FLASH_CS_INFO sFlashCsInfo = {0}; */ #if !defined(BCM_SHM_INTERFACE) || defined(FLASH_DIRECT_ACCESS) UINT value; @@ -2514,13 +2530,14 @@ static INT BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) wrmalt(Adapter, 0xAF00A080, &value, sizeof(value)); } - // Reading first 8 Bytes to get the Flash Layout - // MagicNumber(4 bytes) +FlashLayoutMinorVersion(2 Bytes) +FlashLayoutMajorVersion(2 Bytes) + /* Reading first 8 Bytes to get the Flash Layout + * MagicNumber(4 bytes) +FlashLayoutMinorVersion(2 Bytes) +FlashLayoutMajorVersion(2 Bytes) + */ BeceemFlashBulkRead(Adapter, (PUINT)Adapter->psFlashCSInfo, Adapter->ulFlashControlSectionStart, 8); Adapter->psFlashCSInfo->FlashLayoutVersion = ntohl(Adapter->psFlashCSInfo->FlashLayoutVersion); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Flash Layout Version :%X", (Adapter->psFlashCSInfo->FlashLayoutVersion)); - //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Flash Layout Minor Version :%d\n", ntohs(sFlashCsInfo.FlashLayoutMinorVersion)); + /* BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Flash Layout Minor Version :%d\n", ntohs(sFlashCsInfo.FlashLayoutMinorVersion)); */ BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Signature is :%x\n", ntohl(Adapter->psFlashCSInfo->MagicNumber)); if (FLASH_CONTROL_STRUCT_SIGNATURE == ntohl(Adapter->psFlashCSInfo->MagicNumber)) { @@ -2590,27 +2607,27 @@ static INT BcmGetFlashCSInfo(struct bcm_mini_adapter *Adapter) Adapter->ulFlashControlSectionStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart; } /* - Concerns: what if CS sector size does not match with this sector size ??? - what is the indication of AccessBitMap in CS in flash 2.x ???? - */ + * Concerns: what if CS sector size does not match with this sector size ??? + * what is the indication of AccessBitMap in CS in flash 2.x ???? + */ Adapter->ulFlashID = BcmReadFlashRDID(Adapter); Adapter->uiFlashLayoutMajorVersion = uiFlashLayoutMajorVersion; return STATUS_SUCCESS; } -//----------------------------------------------------------------------------- -// Procedure: BcmGetNvmType -// -// Description: Finds the type of NVM used. -// -// Arguments: -// Adapter - ptr to Adapter object instance -// -// Returns: -// NVM_TYPE -// -//----------------------------------------------------------------------------- +/* + * Procedure: BcmGetNvmType + * + * Description: Finds the type of NVM used. + * + * Arguments: + * Adapter - ptr to Adapter object instance + * + * Returns: + * NVM_TYPE + * + */ static NVM_TYPE BcmGetNvmType(struct bcm_mini_adapter *Adapter) { @@ -2620,35 +2637,35 @@ static NVM_TYPE BcmGetNvmType(struct bcm_mini_adapter *Adapter) if (uiData == BECM) return NVM_EEPROM; - // - // Read control struct and get cal addresses before accessing the flash - // + /* + * Read control struct and get cal addresses before accessing the flash + */ BcmGetFlashCSInfo(Adapter); BeceemFlashBulkRead(Adapter, &uiData, 0x0 + Adapter->ulFlashCalStart, 4); if (uiData == BECM) return NVM_FLASH; - // - // even if there is no valid signature on EEPROM/FLASH find out if they really exist. - // if exist select it. - // + /* + * even if there is no valid signature on EEPROM/FLASH find out if they really exist. + * if exist select it. + */ if (BcmGetEEPROMSize(Adapter)) return NVM_EEPROM; - //TBD for Flash. + /* TBD for Flash. */ return NVM_UNKNOWN; } -/** -* BcmGetSectionValStartOffset - this will calculate the section's starting offset if section val is given -* @Adapter : Drivers Private Data structure -* @eFlashSectionVal : Flash secion value defined in enum FLASH2X_SECTION_VAL -* -* Return value:- -* On success it return the start offset of the provided section val -* On Failure -returns STATUS_FAILURE -**/ +/* + * BcmGetSectionValStartOffset - this will calculate the section's starting offset if section val is given + * @Adapter : Drivers Private Data structure + * @eFlashSectionVal : Flash secion value defined in enum FLASH2X_SECTION_VAL + * + * Return value:- + * On success it return the start offset of the provided section val + * On Failure -returns STATUS_FAILURE + */ INT BcmGetSectionValStartOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlashSectionVal) { @@ -2732,15 +2749,15 @@ INT BcmGetSectionValStartOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTIO return SectStartOffset; } -/** -* BcmGetSectionValEndOffset - this will calculate the section's Ending offset if section val is given -* @Adapter : Drivers Private Data structure -* @eFlashSectionVal : Flash secion value defined in enum FLASH2X_SECTION_VAL -* -* Return value:- -* On success it return the end offset of the provided section val -* On Failure -returns STATUS_FAILURE -**/ +/* + * BcmGetSectionValEndOffset - this will calculate the section's Ending offset if section val is given + * @Adapter : Drivers Private Data structure + * @eFlashSectionVal : Flash secion value defined in enum FLASH2X_SECTION_VAL + * + * Return value:- + * On success it return the end offset of the provided section val + * On Failure -returns STATUS_FAILURE + */ INT BcmGetSectionValEndOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) { @@ -2791,7 +2808,7 @@ INT BcmGetSectionValEndOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_ (Adapter->psFlash2xCSInfo->SizeOfScsiFirmware)); break; case CONTROL_SECTION: - //Not Clear So Putting failure. confirm and fix it. + /* Not Clear So Putting failure. confirm and fix it. */ SectEndOffset = STATUS_FAILURE; case ISO_IMAGE1_PART2: if (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End != UNINIT_PTR_IN_CS) @@ -2817,16 +2834,16 @@ INT BcmGetSectionValEndOffset(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_ } /* -* BcmFlash2xBulkRead:- Read API for Flash Map 2.x . -* @Adapter :Driver Private Data Structure -* @pBuffer : Buffer where data has to be put after reading -* @eFlashSectionVal :Flash Section Val defined in FLASH2X_SECTION_VAL -* @uiOffsetWithinSectionVal :- Offset with in provided section -* @uiNumBytes : Number of Bytes for Read -* -* Return value:- -* return true on success and STATUS_FAILURE on fail. -*/ + * BcmFlash2xBulkRead:- Read API for Flash Map 2.x . + * @Adapter :Driver Private Data Structure + * @pBuffer : Buffer where data has to be put after reading + * @eFlashSectionVal :Flash Section Val defined in FLASH2X_SECTION_VAL + * @uiOffsetWithinSectionVal :- Offset with in provided section + * @uiNumBytes : Number of Bytes for Read + * + * Return value:- + * return true on success and STATUS_FAILURE on fail. + */ INT BcmFlash2xBulkRead(struct bcm_mini_adapter *Adapter, PUINT pBuffer, @@ -2848,7 +2865,7 @@ INT BcmFlash2xBulkRead(struct bcm_mini_adapter *Adapter, return -ENODEV; } - //NO_SECTION_VAL means absolute offset is given. + /* NO_SECTION_VAL means absolute offset is given. */ if (eFlash2xSectionVal == NO_SECTION_VAL) SectionStartOffset = 0; else @@ -2862,7 +2879,7 @@ INT BcmFlash2xBulkRead(struct bcm_mini_adapter *Adapter, if (IsSectionExistInVendorInfo(Adapter, eFlash2xSectionVal)) return vendorextnReadSection(Adapter, (PUCHAR)pBuffer, eFlash2xSectionVal, uiOffsetWithinSectionVal, uiNumBytes); - //calculating the absolute offset from FLASH; + /* calculating the absolute offset from FLASH; */ uiAbsoluteOffset = uiOffsetWithinSectionVal + SectionStartOffset; rdmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); value = 0; @@ -2878,17 +2895,17 @@ INT BcmFlash2xBulkRead(struct bcm_mini_adapter *Adapter, } /* -* BcmFlash2xBulkWrite :-API for Writing on the Flash Map 2.x. -* @Adapter :Driver Private Data Structure -* @pBuffer : Buffer From where data has to taken for writing -* @eFlashSectionVal :Flash Section Val defined in FLASH2X_SECTION_VAL -* @uiOffsetWithinSectionVal :- Offset with in provided section -* @uiNumBytes : Number of Bytes for Write -* -* Return value:- -* return true on success and STATUS_FAILURE on fail. -* -*/ + * BcmFlash2xBulkWrite :-API for Writing on the Flash Map 2.x. + * @Adapter :Driver Private Data Structure + * @pBuffer : Buffer From where data has to taken for writing + * @eFlashSectionVal :Flash Section Val defined in FLASH2X_SECTION_VAL + * @uiOffsetWithinSectionVal :- Offset with in provided section + * @uiNumBytes : Number of Bytes for Write + * + * Return value:- + * return true on success and STATUS_FAILURE on fail. + * + */ INT BcmFlash2xBulkWrite(struct bcm_mini_adapter *Adapter, PUINT pBuffer, @@ -2911,7 +2928,7 @@ INT BcmFlash2xBulkWrite(struct bcm_mini_adapter *Adapter, return -ENODEV; } - //NO_SECTION_VAL means absolute offset is given. + /* NO_SECTION_VAL means absolute offset is given. */ if (eFlash2xSectVal == NO_SECTION_VAL) FlashSectValStartOffset = 0; else @@ -2925,7 +2942,7 @@ INT BcmFlash2xBulkWrite(struct bcm_mini_adapter *Adapter, if (IsSectionExistInVendorInfo(Adapter, eFlash2xSectVal)) return vendorextnWriteSection(Adapter, (PUCHAR)pBuffer, eFlash2xSectVal, uiOffset, uiNumBytes, bVerify); - //calculating the absolute offset from FLASH; + /* calculating the absolute offset from FLASH; */ uiOffset = uiOffset + FlashSectValStartOffset; rdmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); @@ -2943,14 +2960,14 @@ INT BcmFlash2xBulkWrite(struct bcm_mini_adapter *Adapter, return Status; } -/** -* BcmGetActiveDSD : Set the Active DSD in Adapter Structure which has to be dumped in DDR -* @Adapter :-Drivers private Data Structure -* -* Return Value:- -* Return STATUS_SUCESS if get success in setting the right DSD else negaive error code -* -**/ +/* + * BcmGetActiveDSD : Set the Active DSD in Adapter Structure which has to be dumped in DDR + * @Adapter :-Drivers private Data Structure + * + * Return Value:- + * Return STATUS_SUCESS if get success in setting the right DSD else negaive error code + * + */ static INT BcmGetActiveDSD(struct bcm_mini_adapter *Adapter) { @@ -2968,7 +2985,7 @@ static INT BcmGetActiveDSD(struct bcm_mini_adapter *Adapter) if (Adapter->eActiveDSD) BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Active DSD :%d", Adapter->eActiveDSD); if (Adapter->eActiveDSD == 0) { - //if No DSD gets Active, Make Active the DSD with WR permission + /* if No DSD gets Active, Make Active the DSD with WR permission */ if (IsSectionWritable(Adapter, DSD2)) { Adapter->eActiveDSD = DSD2; Adapter->ulFlashCalStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start; @@ -2984,15 +3001,15 @@ static INT BcmGetActiveDSD(struct bcm_mini_adapter *Adapter) return STATUS_SUCCESS; } -/** -* BcmGetActiveISO :- Set the Active ISO in Adapter Data Structue -* @Adapter : Driver private Data Structure -* -* Return Value:- -* Sucsess:- STATUS_SUCESS -* Failure- : negative erro code -* -**/ +/* + * BcmGetActiveISO :- Set the Active ISO in Adapter Data Structue + * @Adapter : Driver private Data Structure + * + * Return Value:- + * Sucsess:- STATUS_SUCESS + * Failure- : negative erro code + * + */ static INT BcmGetActiveISO(struct bcm_mini_adapter *Adapter) { @@ -3012,16 +3029,16 @@ static INT BcmGetActiveISO(struct bcm_mini_adapter *Adapter) return STATUS_SUCCESS; } -/** -* IsOffsetWritable :- it will tell the access permission of the sector having passed offset -* @Adapter : Drivers Private Data Structure -* @uiOffset : Offset provided in the Flash -* -* Return Value:- -* Success:-TRUE , offset is writable -* Failure:-FALSE, offset is RO -* -**/ +/* + * IsOffsetWritable :- it will tell the access permission of the sector having passed offset + * @Adapter : Drivers Private Data Structure + * @uiOffset : Offset provided in the Flash + * + * Return Value:- + * Success:-TRUE , offset is writable + * Failure:-FALSE, offset is RO + * + */ B_UINT8 IsOffsetWritable(struct bcm_mini_adapter *Adapter, UINT uiOffset) { @@ -3032,13 +3049,13 @@ B_UINT8 IsOffsetWritable(struct bcm_mini_adapter *Adapter, UINT uiOffset) uiSectorNum = uiOffset/Adapter->uiSectorSize; - // calculating the word having this Sector Access permission from SectorAccessBitMap Array + /* calculating the word having this Sector Access permission from SectorAccessBitMap Array */ uiWordOfSectorPermission = Adapter->psFlash2xCSInfo->SectorAccessBitMap[uiSectorNum / 16]; - // calculating the bit index inside the word for this sector + /* calculating the bit index inside the word for this sector */ uiBitofSectorePermission = 2 * (15 - uiSectorNum % 16); - // Setting Access permission + /* Setting Access permission */ permissionBits = uiWordOfSectorPermission & (0x3 << uiBitofSectorePermission); permissionBits = (permissionBits >> uiBitofSectorePermission) & 0x3; if (permissionBits == SECTOR_READWRITE_PERMISSION) @@ -3066,21 +3083,21 @@ static INT BcmDumpFlash2xSectionBitMap(PFLASH2X_BITMAP psFlash2xBitMap) return STATUS_SUCCESS; } -/** -* BcmGetFlash2xSectionalBitMap :- It will provide the bit map of all the section present in Flash -* 8bit has been assigned to every section. - bit[0] :Section present or not - bit[1] :section is valid or not - bit[2] : Secton is read only or has write permission too. - bit[3] : Active Section - - bit[7...4] = Reserved . - - @Adapter:-Driver private Data Structure -* -* Return value:- -* Success:- STATUS_SUCESS -* Failure:- negative error code -**/ +/* + * BcmGetFlash2xSectionalBitMap :- It will provide the bit map of all the section present in Flash + * 8bit has been assigned to every section. + * bit[0] :Section present or not + * bit[1] :section is valid or not + * bit[2] : Secton is read only or has write permission too. + * bit[3] : Active Section - + * bit[7...4] = Reserved . + * + * @Adapter:-Driver private Data Structure + * + * Return value:- + * Success:- STATUS_SUCESS + * Failure:- negative error code + */ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITMAP psFlash2xBitMap) { @@ -3090,12 +3107,13 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM BOOLEAN SetActiveDSDDone = FALSE; BOOLEAN SetActiveISODone = FALSE; - // For 1.x map all the section except DSD0 will be shown as not present - // This part will be used by calibration tool to detect the number of DSD present in Flash. + /* For 1.x map all the section except DSD0 will be shown as not present + * This part will be used by calibration tool to detect the number of DSD present in Flash. + */ if (IsFlash2x(Adapter) == FALSE) { psFlash2xBitMap->ISO_IMAGE2 = 0; psFlash2xBitMap->ISO_IMAGE1 = 0; - psFlash2xBitMap->DSD0 = FLASH2X_SECTION_VALID | FLASH2X_SECTION_ACT | FLASH2X_SECTION_PRESENT; //0xF; //0000(Reseved)1(Active)0(RW)1(valid)1(present) + psFlash2xBitMap->DSD0 = FLASH2X_SECTION_VALID | FLASH2X_SECTION_ACT | FLASH2X_SECTION_PRESENT; /* 0xF; 0000(Reseved)1(Active)0(RW)1(valid)1(present) */ psFlash2xBitMap->DSD1 = 0; psFlash2xBitMap->DSD2 = 0; psFlash2xBitMap->VSA0 = 0; @@ -3113,17 +3131,17 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM uiHighestPriDSD = getHighestPriDSD(Adapter); uiHighestPriISO = getHighestPriISO(Adapter); - /// - // IS0 IMAGE 2 - /// + /* + * IS0 IMAGE 2 + */ if ((psFlash2xCSInfo->OffsetISOImage2Part1Start) != UNINIT_PTR_IN_CS) { - //Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->ISO_IMAGE2 = psFlash2xBitMap->ISO_IMAGE2 | FLASH2X_SECTION_PRESENT; if (ReadISOSignature(Adapter, ISO_IMAGE2) == ISO_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->ISO_IMAGE2 |= FLASH2X_SECTION_VALID; - // Calculation for extrating the Access permission + /* Calculation for extrating the Access permission */ if (IsSectionWritable(Adapter, ISO_IMAGE2) == FALSE) psFlash2xBitMap->ISO_IMAGE2 |= FLASH2X_SECTION_RO; @@ -3133,17 +3151,17 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM } } - /// - // IS0 IMAGE 1 - /// + /* + * IS0 IMAGE 1 + */ if ((psFlash2xCSInfo->OffsetISOImage1Part1Start) != UNINIT_PTR_IN_CS) { - // Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->ISO_IMAGE1 = psFlash2xBitMap->ISO_IMAGE1 | FLASH2X_SECTION_PRESENT; if (ReadISOSignature(Adapter, ISO_IMAGE1) == ISO_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->ISO_IMAGE1 |= FLASH2X_SECTION_VALID; - // Calculation for extrating the Access permission + /* Calculation for extrating the Access permission */ if (IsSectionWritable(Adapter, ISO_IMAGE1) == FALSE) psFlash2xBitMap->ISO_IMAGE1 |= FLASH2X_SECTION_RO; @@ -3153,21 +3171,21 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM } } - /// - // DSD2 - /// + /* + * DSD2 + */ if ((psFlash2xCSInfo->OffsetFromZeroForDSD2Start) != UNINIT_PTR_IN_CS) { - //Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->DSD2 = psFlash2xBitMap->DSD2 | FLASH2X_SECTION_PRESENT; if (ReadDSDSignature(Adapter, DSD2) == DSD_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->DSD2 |= FLASH2X_SECTION_VALID; - // Calculation for extrating the Access permission + /* Calculation for extrating the Access permission */ if (IsSectionWritable(Adapter, DSD2) == FALSE) { psFlash2xBitMap->DSD2 |= FLASH2X_SECTION_RO; } else { - //Means section is writable + /* Means section is writable */ if ((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD2)) { psFlash2xBitMap->DSD2 |= FLASH2X_SECTION_ACT; SetActiveDSDDone = TRUE; @@ -3175,21 +3193,21 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM } } - /// - // DSD 1 - /// + /* + * DSD 1 + */ if ((psFlash2xCSInfo->OffsetFromZeroForDSD1Start) != UNINIT_PTR_IN_CS) { - // Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->DSD1 = psFlash2xBitMap->DSD1 | FLASH2X_SECTION_PRESENT; if (ReadDSDSignature(Adapter, DSD1) == DSD_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->DSD1 |= FLASH2X_SECTION_VALID; - // Calculation for extrating the Access permission + /* Calculation for extrating the Access permission */ if (IsSectionWritable(Adapter, DSD1) == FALSE) { psFlash2xBitMap->DSD1 |= FLASH2X_SECTION_RO; } else { - // Means section is writable + /* Means section is writable */ if ((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD1)) { psFlash2xBitMap->DSD1 |= FLASH2X_SECTION_ACT; SetActiveDSDDone = TRUE; @@ -3197,21 +3215,21 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM } } - /// - //For DSD 0 - // + /* + * For DSD 0 + */ if ((psFlash2xCSInfo->OffsetFromZeroForDSDStart) != UNINIT_PTR_IN_CS) { - //Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->DSD0 = psFlash2xBitMap->DSD0 | FLASH2X_SECTION_PRESENT; if (ReadDSDSignature(Adapter, DSD0) == DSD_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->DSD0 |= FLASH2X_SECTION_VALID; - // Setting Access permission + /* Setting Access permission */ if (IsSectionWritable(Adapter, DSD0) == FALSE) { psFlash2xBitMap->DSD0 |= FLASH2X_SECTION_RO; } else { - // Means section is writable + /* Means section is writable */ if ((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD0)) { psFlash2xBitMap->DSD0 |= FLASH2X_SECTION_ACT; SetActiveDSDDone = TRUE; @@ -3219,99 +3237,99 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM } } - /// - // VSA 0 - /// + /* + * VSA 0 + */ if ((psFlash2xCSInfo->OffsetFromZeroForVSAStart) != UNINIT_PTR_IN_CS) { - // Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->VSA0 = psFlash2xBitMap->VSA0 | FLASH2X_SECTION_PRESENT; - // Setting the Access Bit. Map is not defined hece setting it always valid + /* Setting the Access Bit. Map is not defined hece setting it always valid */ psFlash2xBitMap->VSA0 |= FLASH2X_SECTION_VALID; - // Calculation for extrating the Access permission + /* Calculation for extrating the Access permission */ if (IsSectionWritable(Adapter, VSA0) == FALSE) psFlash2xBitMap->VSA0 |= FLASH2X_SECTION_RO; - // By Default section is Active + /* By Default section is Active */ psFlash2xBitMap->VSA0 |= FLASH2X_SECTION_ACT; } - /// - // VSA 1 - /// + /* + * VSA 1 + */ if ((psFlash2xCSInfo->OffsetFromZeroForVSA1Start) != UNINIT_PTR_IN_CS) { - // Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->VSA1 = psFlash2xBitMap->VSA1 | FLASH2X_SECTION_PRESENT; - // Setting the Access Bit. Map is not defined hece setting it always valid + /* Setting the Access Bit. Map is not defined hece setting it always valid */ psFlash2xBitMap->VSA1 |= FLASH2X_SECTION_VALID; - // Checking For Access permission + /* Checking For Access permission */ if (IsSectionWritable(Adapter, VSA1) == FALSE) psFlash2xBitMap->VSA1 |= FLASH2X_SECTION_RO; - // By Default section is Active + /* By Default section is Active */ psFlash2xBitMap->VSA1 |= FLASH2X_SECTION_ACT; } - /// - // VSA 2 - /// + /* + * VSA 2 + */ if ((psFlash2xCSInfo->OffsetFromZeroForVSA2Start) != UNINIT_PTR_IN_CS) { - // Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->VSA2 = psFlash2xBitMap->VSA2 | FLASH2X_SECTION_PRESENT; - // Setting the Access Bit. Map is not defined hece setting it always valid + /* Setting the Access Bit. Map is not defined hece setting it always valid */ psFlash2xBitMap->VSA2 |= FLASH2X_SECTION_VALID; - // Checking For Access permission + /* Checking For Access permission */ if (IsSectionWritable(Adapter, VSA2) == FALSE) psFlash2xBitMap->VSA2 |= FLASH2X_SECTION_RO; - // By Default section is Active + /* By Default section is Active */ psFlash2xBitMap->VSA2 |= FLASH2X_SECTION_ACT; } - /// - // SCSI Section - /// + /* + * SCSI Section + */ if ((psFlash2xCSInfo->OffsetFromZeroForScsiFirmware) != UNINIT_PTR_IN_CS) { - // Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->SCSI = psFlash2xBitMap->SCSI | FLASH2X_SECTION_PRESENT; - // Setting the Access Bit. Map is not defined hece setting it always valid + /* Setting the Access Bit. Map is not defined hece setting it always valid */ psFlash2xBitMap->SCSI |= FLASH2X_SECTION_VALID; - // Checking For Access permission + /* Checking For Access permission */ if (IsSectionWritable(Adapter, SCSI) == FALSE) psFlash2xBitMap->SCSI |= FLASH2X_SECTION_RO; - // By Default section is Active + /* By Default section is Active */ psFlash2xBitMap->SCSI |= FLASH2X_SECTION_ACT; } - /// - // Control Section - /// + /* + * Control Section + */ if ((psFlash2xCSInfo->OffsetFromZeroForControlSectionStart) != UNINIT_PTR_IN_CS) { - // Setting the 0th Bit representing the Section is present or not. + /* Setting the 0th Bit representing the Section is present or not. */ psFlash2xBitMap->CONTROL_SECTION = psFlash2xBitMap->CONTROL_SECTION | (FLASH2X_SECTION_PRESENT); - // Setting the Access Bit. Map is not defined hece setting it always valid + /* Setting the Access Bit. Map is not defined hece setting it always valid */ psFlash2xBitMap->CONTROL_SECTION |= FLASH2X_SECTION_VALID; - // Checking For Access permission + /* Checking For Access permission */ if (IsSectionWritable(Adapter, CONTROL_SECTION) == FALSE) psFlash2xBitMap->CONTROL_SECTION |= FLASH2X_SECTION_RO; - // By Default section is Active + /* By Default section is Active */ psFlash2xBitMap->CONTROL_SECTION |= FLASH2X_SECTION_ACT; } - /// - // For Reserved Sections - /// + /* + * For Reserved Sections + */ psFlash2xBitMap->Reserved0 = 0; psFlash2xBitMap->Reserved0 = 0; psFlash2xBitMap->Reserved0 = 0; @@ -3320,24 +3338,25 @@ INT BcmGetFlash2xSectionalBitMap(struct bcm_mini_adapter *Adapter, PFLASH2X_BITM return STATUS_SUCCESS; } -/** -BcmSetActiveSection :- Set Active section is used to make priority field highest over other - section of same type. - -@Adapater :- Bcm Driver Private Data Structure -@eFlash2xSectionVal :- Flash section val whose priority has to be made highest. - -Return Value:- Make the priorit highest else return erorr code - -**/ +/* + * BcmSetActiveSection :- Set Active section is used to make priority field highest over other + * section of same type. + * + * @Adapater :- Bcm Driver Private Data Structure + * @eFlash2xSectionVal :- Flash section val whose priority has to be made highest. + * + * Return Value:- Make the priorit highest else return erorr code + * + */ INT BcmSetActiveSection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectVal) { unsigned int SectImagePriority = 0; INT Status = STATUS_SUCCESS; - //DSD_HEADER sDSD = {0}; - //ISO_HEADER sISO = {0}; + /* DSD_HEADER sDSD = {0}; + * ISO_HEADER sISO = {0}; + */ INT HighestPriDSD = 0 ; INT HighestPriISO = 0; @@ -3363,9 +3382,10 @@ INT BcmSetActiveSection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eF SectImagePriority = ReadISOPriority(Adapter, HighestPriISO) + 1; if ((SectImagePriority <= 0) && IsSectionWritable(Adapter, HighestPriISO)) { - // This is a SPECIAL Case which will only happen if the current highest priority ISO has priority value = 0x7FFFFFFF. - // We will write 1 to the current Highest priority ISO And then shall increase the priority of the requested ISO - // by user + /* This is a SPECIAL Case which will only happen if the current highest priority ISO has priority value = 0x7FFFFFFF. + * We will write 1 to the current Highest priority ISO And then shall increase the priority of the requested ISO + * by user + */ BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happened, eFlash2xSectVal: 0x%x\n", eFlash2xSectVal); SectImagePriority = htonl(0x1); Status = BcmFlash2xBulkWrite(Adapter, @@ -3422,9 +3442,10 @@ INT BcmSetActiveSection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eF SectImagePriority = ReadDSDPriority(Adapter, HighestPriDSD) + 1; if (SectImagePriority <= 0) { - // This is a SPECIAL Case which will only happen if the current highest priority DSD has priority value = 0x7FFFFFFF. - // We will write 1 to the current Highest priority DSD And then shall increase the priority of the requested DSD - // by user + /* This is a SPECIAL Case which will only happen if the current highest priority DSD has priority value = 0x7FFFFFFF. + * We will write 1 to the current Highest priority DSD And then shall increase the priority of the requested DSD + * by user + */ BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happened, eFlash2xSectVal: 0x%x\n", eFlash2xSectVal); SectImagePriority = htonl(0x1); @@ -3488,7 +3509,7 @@ INT BcmSetActiveSection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eF case VSA0: case VSA1: case VSA2: - // Has to be decided + /* Has to be decided */ break; default: Status = STATUS_FAILURE; @@ -3499,14 +3520,14 @@ INT BcmSetActiveSection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eF return Status; } -/** -BcmCopyISO - Used only for copying the ISO section -@Adapater :- Bcm Driver Private Data Structure -@sCopySectStrut :- Section copy structure - -Return value:- SUCCESS if copies successfully else negative error code - -**/ +/* + * BcmCopyISO - Used only for copying the ISO section + * @Adapater :- Bcm Driver Private Data Structure + * @sCopySectStrut :- Section copy structure + * + * Return value:- SUCCESS if copies successfully else negative error code + * + */ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectStrut) { @@ -3586,7 +3607,7 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS CorruptISOSig(Adapter, ISO_IMAGE2); while (uiTotalDataToCopy) { if (uiTotalDataToCopy == Adapter->uiSectorSize) { - // Setting for write of first sector. First sector is assumed to be written in last + /* Setting for write of first sector. First sector is assumed to be written in last */ BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Writing the signature sector"); eISOReadPart = ISO_IMAGE1; uiReadOffsetWithinPart = 0; @@ -3629,7 +3650,7 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS } if (IsThisHeaderSector == TRUE) { - // If this is header sector write 0xFFFFFFFF at the sig time and in last write sig + /* If this is header sector write 0xFFFFFFFF at the sig time and in last write sig */ memcpy(SigBuff, Buff + sigOffset, MAX_RW_SIZE); for (i = 0; i < MAX_RW_SIZE; i++) @@ -3656,7 +3677,7 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS MAX_RW_SIZE); IsThisHeaderSector = FALSE; } - //subtracting the written Data + /* subtracting the written Data */ uiTotalDataToCopy = uiTotalDataToCopy - Adapter->uiSectorSize; } } @@ -3699,7 +3720,7 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS while (uiTotalDataToCopy) { if (uiTotalDataToCopy == Adapter->uiSectorSize) { - //Setting for write of first sector. First sector is assumed to be written in last + /* Setting for write of first sector. First sector is assumed to be written in last */ BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Writing the signature sector"); eISOReadPart = ISO_IMAGE2; uiReadOffsetWithinPart = 0; @@ -3742,7 +3763,7 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS } if (IsThisHeaderSector == TRUE) { - // If this is header sector write 0xFFFFFFFF at the sig time and in last write sig + /* If this is header sector write 0xFFFFFFFF at the sig time and in last write sig */ memcpy(SigBuff, Buff + sigOffset, MAX_RW_SIZE); for (i = 0; i < MAX_RW_SIZE; i++) @@ -3771,7 +3792,7 @@ INT BcmCopyISO(struct bcm_mini_adapter *Adapter, FLASH2X_COPY_SECTION sCopySectS IsThisHeaderSector = FALSE; } - // subtracting the written Data + /* subtracting the written Data */ uiTotalDataToCopy = uiTotalDataToCopy - Adapter->uiSectorSize; } } @@ -3781,18 +3802,16 @@ out: return Status; } -/** -BcmFlash2xCorruptSig : this API is used to corrupt the written sig in Bcm Header present in flash section. - It will corrupt the sig, if Section is writable, by making first bytes as zero. -@Adapater :- Bcm Driver Private Data Structure -@eFlash2xSectionVal :- Flash section val which has header - -Return Value :- - Success :- If Section is present and writable, corrupt the sig and return STATUS_SUCCESS - Failure :-Return negative error code - - -**/ +/* + * BcmFlash2xCorruptSig : this API is used to corrupt the written sig in Bcm Header present in flash section. + * It will corrupt the sig, if Section is writable, by making first bytes as zero. + * @Adapater :- Bcm Driver Private Data Structure + * @eFlash2xSectionVal :- Flash section val which has header + * + * Return Value :- + * Success :- If Section is present and writable, corrupt the sig and return STATUS_SUCCESS + * Failure :-Return negative error code + */ INT BcmFlash2xCorruptSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlash2xSectionVal) { @@ -3811,24 +3830,23 @@ INT BcmFlash2xCorruptSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL e return Status; } -/** -BcmFlash2xWriteSig :-this API is used to Write the sig if requested Section has - header and Write Permission. -@Adapater :- Bcm Driver Private Data Structure -@eFlashSectionVal :- Flash section val which has header - -Return Value :- - Success :- If Section is present and writable write the sig and return STATUS_SUCCESS - Failure :-Return negative error code - -**/ +/* + *BcmFlash2xWriteSig :-this API is used to Write the sig if requested Section has + * header and Write Permission. + * @Adapater :- Bcm Driver Private Data Structure + * @eFlashSectionVal :- Flash section val which has header + * + * Return Value :- + * Success :- If Section is present and writable write the sig and return STATUS_SUCCESS + * Failure :-Return negative error code + */ INT BcmFlash2xWriteSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFlashSectionVal) { UINT uiSignature = 0; UINT uiOffset = 0; - // DSD_HEADER dsdHeader = {0}; + /* DSD_HEADER dsdHeader = {0}; */ if (Adapter->bSigCorrupted == FALSE) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Signature is not corrupted by driver, hence not restoring\n"); return STATUS_SUCCESS; @@ -3853,7 +3871,7 @@ INT BcmFlash2xWriteSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFl } } else if ((eFlashSectionVal == ISO_IMAGE1) || (eFlashSectionVal == ISO_IMAGE2)) { uiSignature = htonl(ISO_IMAGE_MAGIC_NUMBER); - // uiOffset = 0; + /* uiOffset = 0; */ uiOffset = FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImageMagicNumber); if ((ReadISOSignature(Adapter, eFlashSectionVal) & 0xFF000000) != CORRUPTED_PATTERN) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Currupted Pattern is not there. Hence won't write sig"); @@ -3874,16 +3892,14 @@ INT BcmFlash2xWriteSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL eFl return STATUS_SUCCESS; } -/** -validateFlash2xReadWrite :- This API is used to validate the user request for Read/Write. - if requested Bytes goes beyond the Requested section, it reports error. -@Adapater :- Bcm Driver Private Data Structure -@psFlash2xReadWrite :-Flash2x Read/write structure pointer - -Return values:-Return TRUE is request is valid else FALSE. - - -**/ +/* + * validateFlash2xReadWrite :- This API is used to validate the user request for Read/Write. + * if requested Bytes goes beyond the Requested section, it reports error. + * @Adapater :- Bcm Driver Private Data Structure + * @psFlash2xReadWrite :-Flash2x Read/write structure pointer + * + * Return values:-Return TRUE is request is valid else FALSE. + */ INT validateFlash2xReadWrite(struct bcm_mini_adapter *Adapter, PFLASH2X_READWRITE psFlash2xReadWrite) { @@ -3916,8 +3932,9 @@ INT validateFlash2xReadWrite(struct bcm_mini_adapter *Adapter, PFLASH2X_READWRIT BcmGetSectionValStartOffset(Adapter, ISO_IMAGE2_PART3); } - // since this uiSectEndoffset is the size of iso Image. hence for calculating the vitual endoffset - // it should be added in startoffset. so that check done in last of this function can be valued. + /* since this uiSectEndoffset is the size of iso Image. hence for calculating the vitual endoffset + * it should be added in startoffset. so that check done in last of this function can be valued. + */ uiSectEndOffset = uiSectStartOffset + uiSectEndOffset; BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Total size of the ISO Image :%x", uiSectEndOffset); @@ -3926,7 +3943,7 @@ INT validateFlash2xReadWrite(struct bcm_mini_adapter *Adapter, PFLASH2X_READWRIT BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "End offset :%x\n", uiSectEndOffset); - // Checking the boundary condition + /* Checking the boundary condition */ if ((uiSectStartOffset + psFlash2xReadWrite->offset + uiNumOfBytes) <= uiSectEndOffset) return TRUE; else { @@ -3935,13 +3952,13 @@ INT validateFlash2xReadWrite(struct bcm_mini_adapter *Adapter, PFLASH2X_READWRIT } } -/** -IsFlash2x :- check for Flash 2.x -@Adapater :- Bcm Driver Private Data Structure - -Return value:- - return TRUE if flah2.x of hgher version else return false. -**/ +/* + * IsFlash2x :- check for Flash 2.x + * Adapater :- Bcm Driver Private Data Structure + * + * Return value:- + * return TRUE if flah2.x of hgher version else return false. + */ INT IsFlash2x(struct bcm_mini_adapter *Adapter) { @@ -3951,13 +3968,13 @@ INT IsFlash2x(struct bcm_mini_adapter *Adapter) return FALSE; } -/** -GetFlashBaseAddr :- Calculate the Flash Base address -@Adapater :- Bcm Driver Private Data Structure - -Return Value:- - Success :- Base Address of the Flash -**/ +/* + * GetFlashBaseAddr :- Calculate the Flash Base address + * @Adapater :- Bcm Driver Private Data Structure + * + * Return Value:- + * Success :- Base Address of the Flash + */ static INT GetFlashBaseAddr(struct bcm_mini_adapter *Adapter) { @@ -3965,9 +3982,9 @@ static INT GetFlashBaseAddr(struct bcm_mini_adapter *Adapter) if (Adapter->bDDRInitDone) { /* - For All Valid Flash Versions... except 1.1, take the value from FlashBaseAddr - In case of Raw Read... use the default value - */ + * For All Valid Flash Versions... except 1.1, take the value from FlashBaseAddr + * In case of Raw Read... use the default value + */ if (Adapter->uiFlashLayoutMajorVersion && (Adapter->bFlashRawRead == FALSE) && !((Adapter->uiFlashLayoutMajorVersion == 1) && (Adapter->uiFlashLayoutMinorVersion == 1))) uiBaseAddr = Adapter->uiFlashBaseAdd; @@ -3975,9 +3992,9 @@ static INT GetFlashBaseAddr(struct bcm_mini_adapter *Adapter) uiBaseAddr = FLASH_CONTIGIOUS_START_ADDR_AFTER_INIT; } else { /* - For All Valid Flash Versions... except 1.1, take the value from FlashBaseAddr - In case of Raw Read... use the default value - */ + * For All Valid Flash Versions... except 1.1, take the value from FlashBaseAddr + * In case of Raw Read... use the default value + */ if (Adapter->uiFlashLayoutMajorVersion && (Adapter->bFlashRawRead == FALSE) && !((Adapter->uiFlashLayoutMajorVersion == 1) && (Adapter->uiFlashLayoutMinorVersion == 1))) uiBaseAddr = Adapter->uiFlashBaseAdd | FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT; @@ -3988,22 +4005,20 @@ static INT GetFlashBaseAddr(struct bcm_mini_adapter *Adapter) return uiBaseAddr; } -/** -BcmCopySection :- This API is used to copy the One section in another. Both section should - be contiuous and of same size. Hence this Will not be applicabe to copy ISO. - -@Adapater :- Bcm Driver Private Data Structure -@SrcSection :- Source section From where data has to be copied -@DstSection :- Destination section to which data has to be copied -@offset :- Offset from/to where data has to be copied from one section to another. -@numOfBytes :- number of byes that has to be copyed from one section to another at given offset. - in case of numofBytes equal zero complete section will be copied. - -Return Values- - Success : Return STATUS_SUCCESS - Faillure :- return negative error code - -**/ +/* + * BcmCopySection :- This API is used to copy the One section in another. Both section should + * be contiuous and of same size. Hence this Will not be applicabe to copy ISO. + * + * @Adapater :- Bcm Driver Private Data Structure + * @SrcSection :- Source section From where data has to be copied + * @DstSection :- Destination section to which data has to be copied + * @offset :- Offset from/to where data has to be copied from one section to another. + * @numOfBytes :- number of byes that has to be copyed from one section to another at given offset. + * in case of numofBytes equal zero complete section will be copied. + * Return Values- + * Success : Return STATUS_SUCCESS + * Faillure :- return negative error code + */ INT BcmCopySection(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL SrcSection, @@ -4031,7 +4046,7 @@ INT BcmCopySection(struct bcm_mini_adapter *Adapter, return -EINVAL; } - // if offset zero means have to copy complete secton + /* if offset zero means have to copy complete secton */ if (numOfBytes == 0) { numOfBytes = BcmGetSectionValEndOffset(Adapter, SrcSection) - BcmGetSectionValStartOffset(Adapter, SrcSection); @@ -4099,17 +4114,16 @@ INT BcmCopySection(struct bcm_mini_adapter *Adapter, return Status; } -/** -SaveHeaderIfPresent :- This API is use to Protect the Header in case of Header Sector write -@Adapater :- Bcm Driver Private Data Structure -@pBuff :- Data buffer that has to be written in sector having the header map. -@uiOffset :- Flash offset that has to be written. - -Return value :- - Success :- On success return STATUS_SUCCESS - Faillure :- Return negative error code - -**/ +/* + * SaveHeaderIfPresent :- This API is use to Protect the Header in case of Header Sector write + * @Adapater :- Bcm Driver Private Data Structure + * @pBuff :- Data buffer that has to be written in sector having the header map. + * @uiOffset :- Flash offset that has to be written. + * + * Return value :- + * Success :- On success return STATUS_SUCCESS + * Faillure :- Return negative error code + */ INT SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiOffset) { @@ -4119,13 +4133,13 @@ INT SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiO UINT uiSectAlignAddr = 0; UINT sig = 0; - //making the offset sector aligned + /* making the offset sector aligned */ uiSectAlignAddr = uiOffset & ~(Adapter->uiSectorSize - 1); if ((uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter, DSD2) - Adapter->uiSectorSize) || (uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter, DSD1) - Adapter->uiSectorSize) || (uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter, DSD0) - Adapter->uiSectorSize)) { - // offset from the sector boundary having the header map + /* offset from the sector boundary having the header map */ offsetToProtect = Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader % Adapter->uiSectorSize; HeaderSizeToProtect = sizeof(DSD_HEADER); bHasHeader = TRUE; @@ -4137,17 +4151,17 @@ INT SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiO HeaderSizeToProtect = sizeof(ISO_HEADER); bHasHeader = TRUE; } - // If Header is present overwrite passed buffer with this + /* If Header is present overwrite passed buffer with this */ if (bHasHeader && (Adapter->bHeaderChangeAllowed == FALSE)) { pTempBuff = (PUCHAR)kzalloc(HeaderSizeToProtect, GFP_KERNEL); if (pTempBuff == NULL) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Memory allocation failed"); return -ENOMEM; } - // Read header + /* Read header */ BeceemFlashBulkRead(Adapter, (PUINT)pTempBuff, (uiSectAlignAddr + offsetToProtect), HeaderSizeToProtect); BCM_DEBUG_PRINT_BUFFER(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, pTempBuff, HeaderSizeToProtect); - //Replace Buffer content with Header + /* Replace Buffer content with Header */ memcpy(pBuff + offsetToProtect, pTempBuff, HeaderSizeToProtect); kfree(pTempBuff); @@ -4169,13 +4183,13 @@ INT SaveHeaderIfPresent(struct bcm_mini_adapter *Adapter, PUCHAR pBuff, UINT uiO return STATUS_SUCCESS; } -/** -BcmDoChipSelect : This will selcet the appropriate chip for writing. -@Adapater :- Bcm Driver Private Data Structure - -OutPut:- - Select the Appropriate chip and retrn status Success -**/ +/* + * BcmDoChipSelect : This will selcet the appropriate chip for writing. + * @Adapater :- Bcm Driver Private Data Structure + * + * OutPut:- + * Select the Appropriate chip and retrn status Success + */ static INT BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset) { UINT FlashConfig = 0; @@ -4185,28 +4199,28 @@ static INT BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset) ChipNum = offset / FLASH_PART_SIZE; - // - // Chip Select mapping to enable flash0. - // To select flash 0, we have to OR with (0<<12). - // ORing 0 will have no impact so not doing that part. - // In future if Chip select value changes from 0 to non zero, - // That needs be taken care with backward comaptibility. No worries for now. - // + /* + * Chip Select mapping to enable flash0. + * To select flash 0, we have to OR with (0<<12). + * ORing 0 will have no impact so not doing that part. + * In future if Chip select value changes from 0 to non zero, + * That needs be taken care with backward comaptibility. No worries for now. + */ /* - SelectedChip Variable is the selection that the host is 100% Sure the same as what the register will hold. This can be ONLY ensured - if the Chip doesn't goes to low power mode while the flash operation is in progress (NVMRdmWrmLock is taken) - Before every new Flash Write operation, we reset the variable. This is to ensure that after any wake-up from - power down modes (Idle mode/shutdown mode), the values in the register will be different. - */ + * SelectedChip Variable is the selection that the host is 100% Sure the same as what the register will hold. This can be ONLY ensured + * if the Chip doesn't goes to low power mode while the flash operation is in progress (NVMRdmWrmLock is taken) + * Before every new Flash Write operation, we reset the variable. This is to ensure that after any wake-up from + * power down modes (Idle mode/shutdown mode), the values in the register will be different. + */ if (Adapter->SelectedChip == ChipNum) return STATUS_SUCCESS; - // BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Selected Chip :%x", ChipNum); + /* BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "Selected Chip :%x", ChipNum); */ Adapter->SelectedChip = ChipNum; - // bit[13..12] will select the appropriate chip + /* bit[13..12] will select the appropriate chip */ rdmalt(Adapter, FLASH_CONFIG_REG, &FlashConfig, 4); rdmalt(Adapter, FLASH_GPIO_CONFIG_REG, &GPIOConfig, 4); { @@ -4229,17 +4243,17 @@ static INT BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset) } } /* In case the bits already written in the FLASH_CONFIG_REG is same as what the user desired, - nothing to do... can return immediately. - ASSUMPTION: FLASH_GPIO_CONFIG_REG will be in sync with FLASH_CONFIG_REG. - Even if the chip goes to low power mode, it should wake with values in each register in sync with each other. - These values are not written by host other than during CHIP_SELECT. - */ + * nothing to do... can return immediately. + * ASSUMPTION: FLASH_GPIO_CONFIG_REG will be in sync with FLASH_CONFIG_REG. + * Even if the chip goes to low power mode, it should wake with values in each register in sync with each other. + * These values are not written by host other than during CHIP_SELECT. + */ if (PartNum == ((FlashConfig >> CHIP_SELECT_BIT12) & 0x3)) return STATUS_SUCCESS; - // clearing the bit[13..12] + /* clearing the bit[13..12] */ FlashConfig &= 0xFFFFCFFF; - FlashConfig = (FlashConfig | (PartNum<<CHIP_SELECT_BIT12)); // 00 + FlashConfig = (FlashConfig | (PartNum<<CHIP_SELECT_BIT12)); /* 00 */ wrmalt(Adapter, FLASH_GPIO_CONFIG_REG, &GPIOConfig, 4); udelay(100); @@ -4253,11 +4267,11 @@ static INT BcmDoChipSelect(struct bcm_mini_adapter *Adapter, UINT offset) INT ReadDSDSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd) { UINT uiDSDsig = 0; - //UINT sigoffsetInMap = 0; - //DSD_HEADER dsdHeader = {0}; - + /* UINT sigoffsetInMap = 0; + * DSD_HEADER dsdHeader = {0}; + */ - //sigoffsetInMap =(PUCHAR)&(dsdHeader.DSDImageMagicNumber) -(PUCHAR)&dsdHeader; + /* sigoffsetInMap =(PUCHAR)&(dsdHeader.DSDImageMagicNumber) -(PUCHAR)&dsdHeader; */ if (dsd != DSD0 && dsd != DSD1 && dsd != DSD2) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "passed section value is not for DSDs"); @@ -4277,10 +4291,11 @@ INT ReadDSDSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd) INT ReadDSDPriority(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL dsd) { - // UINT priOffsetInMap = 0 ; + /* UINT priOffsetInMap = 0 ; */ unsigned int uiDSDPri = STATUS_FAILURE; - // DSD_HEADER dsdHeader = {0}; - // priOffsetInMap = (PUCHAR)&(dsdHeader.DSDImagePriority) -(PUCHAR)&dsdHeader; + /* DSD_HEADER dsdHeader = {0}; + * priOffsetInMap = (PUCHAR)&(dsdHeader.DSDImagePriority) -(PUCHAR)&dsdHeader; + */ if (IsSectionWritable(Adapter, dsd)) { if (ReadDSDSignature(Adapter, dsd) == DSD_IMAGE_MAGIC_NUMBER) { BcmFlash2xBulkRead(Adapter, @@ -4332,10 +4347,10 @@ FLASH2X_SECTION_VAL getHighestPriDSD(struct bcm_mini_adapter *Adapter) INT ReadISOSignature(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL iso) { UINT uiISOsig = 0; - //UINT sigoffsetInMap = 0; - //ISO_HEADER ISOHeader = {0}; - //sigoffsetInMap =(PUCHAR)&(ISOHeader.ISOImageMagicNumber) -(PUCHAR)&ISOHeader; - + /* UINT sigoffsetInMap = 0; + * ISO_HEADER ISOHeader = {0}; + * sigoffsetInMap =(PUCHAR)&(ISOHeader.ISOImageMagicNumber) -(PUCHAR)&ISOHeader; + */ if (iso != ISO_IMAGE1 && iso != ISO_IMAGE2) { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "passed section value is not for ISOs"); return STATUS_FAILURE; @@ -4407,7 +4422,7 @@ INT WriteToFlashWithoutSectorErase(struct bcm_mini_adapter *Adapter, UINT uiPartOffset = 0; #endif UINT uiStartOffset = 0; - // Adding section start address + /* Adding section start address */ INT Status = STATUS_SUCCESS; PUCHAR pcBuff = (PUCHAR)pBuff; @@ -4561,7 +4576,7 @@ static INT CorruptDSDSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL e sig = *((PUINT)(pBuff + 12)); sig = ntohl(sig); BCM_DEBUG_PRINT_BUFFER(Adapter, DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, pBuff, MAX_RW_SIZE); - // Now corrupting the sig by corrupting 4th last Byte. + /* Now corrupting the sig by corrupting 4th last Byte. */ *(pBuff + 12) = 0; if (sig == DSD_IMAGE_MAGIC_NUMBER) { @@ -4619,7 +4634,7 @@ static INT CorruptISOSig(struct bcm_mini_adapter *Adapter, FLASH2X_SECTION_VAL e sig = *((PUINT)pBuff); sig = ntohl(sig); - // corrupt signature + /* corrupt signature */ *pBuff = 0; if (sig == ISO_IMAGE_MAGIC_NUMBER) { -- 1.7.9.5 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel