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;
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,
/* 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. */
} 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);
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,
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);
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,
UINT uiNumBytes)
{
UINT uiData[4] = {0};
- // UINT uiAddress = 0;
+ /* UINT uiAddress = 0; */
UINT uiBytesRemaining = uiNumBytes;
UINT uiIndex = 0;
UINT uiTempOffset = 0;
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;
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])) {
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... */
}
}
}
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,
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;
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)
{
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) {
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;
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,
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));
}
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");
return STATUS_FAILURE;
}
- //__udelay(950);
+ /* __udelay(950); */
do {
value = (FLASH_CMD_STATUS_REG_READ << 24);
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;
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;
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;
}
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));
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) {
return STATUS_FAILURE;
}
- //msleep(1);
+ /* msleep(1); */
do {
value = (FLASH_CMD_STATUS_REG_READ << 24);
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;
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;
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);
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;
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);
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)
{
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)
{
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);
}
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,
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);
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;
}
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);
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) {
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;
}
}
- // 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) {
}
}
}
- // 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;
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);
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,
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;
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++;
uiOffsetFromSectStart += Adapter->uiSectorSize;
uiNumSectTobeRead--;
}
-//
-// Cleanup.
-//
-BeceemFlashBulkWriteStatus_EXIT :
+/*
+ * Cleanup.
+ */
+BeceemFlashBulkWriteStatus_EXIT:
if (ulStatus)
BcmRestoreBlockProtectStatus(Adapter, ulStatus);
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)
{
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;
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)
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,
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);
} 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);
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);
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)
{
/* 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));
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);
/* 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) {
* 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) {
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,
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);
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);
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,
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,
} 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);
}
}
}
- // restore the values.
+ /* restore the values. */
wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp));
} else if (Adapter->eNVMType == NVM_EEPROM) {
Status = BeceemEEPROMBulkWrite(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)
{
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);
}
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)
{
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 {
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));
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)
{
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)
{
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);
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);
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);
}
}
-//-----------------------------------------------------------------------------
-// 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;
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)) {
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)
{
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)
{
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)
{
(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)
}
/*
-* 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,
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
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;
}
/*
-* 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,
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
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));
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)
{
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;
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)
{
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)
{
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)
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)
{
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;
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;
}
}
- ///
- // 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;
}
}
- ///
- // 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;
}
}
- ///
- // 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;
}
}
- ///
- //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;
}
}
- ///
- // 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;
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;
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,
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);
case VSA0:
case VSA1:
case VSA2:
- // Has to be decided
+ /* Has to be decided */
break;
default:
Status = STATUS_FAILURE;
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)
{
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;
}
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++)
MAX_RW_SIZE);
IsThisHeaderSector = FALSE;
}
- //subtracting the written Data
+ /* subtracting the written Data */
uiTotalDataToCopy = uiTotalDataToCopy - Adapter->uiSectorSize;
}
}
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;
}
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++)
IsThisHeaderSector = FALSE;
}
- // subtracting the written Data
+ /* subtracting the written Data */
uiTotalDataToCopy = uiTotalDataToCopy - Adapter->uiSectorSize;
}
}
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)
{
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;
}
} 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");
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)
{
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);
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 {
}
}
-/**
-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)
{
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)
{
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;
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;
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,
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);
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)
{
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;
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);
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;
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);
{
}
}
/* 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);
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");
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,
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;
UINT uiPartOffset = 0;
#endif
UINT uiStartOffset = 0;
- // Adding section start address
+ /* Adding section start address */
INT Status = STATUS_SUCCESS;
PUCHAR pcBuff = (PUCHAR)pBuff;
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) {
sig = *((PUINT)pBuff);
sig = ntohl(sig);
- // corrupt signature
+ /* corrupt signature */
*pBuff = 0;
if (sig == ISO_IMAGE_MAGIC_NUMBER) {