~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to drivers/staging/bcm/nvm.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno
  • Date: 2011-06-07 12:14:05 UTC
  • mfrom: (43.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110607121405-i3h1rd7nrnd2b73h
Tags: 2.6.39-2
[ Ben Hutchings ]
* [x86] Enable BACKLIGHT_APPLE, replacing BACKLIGHT_MBP_NVIDIA
  (Closes: #627492)
* cgroups: Disable memory resource controller by default. Allow it
  to be enabled using kernel parameter 'cgroup_enable=memory'.
* rt2800usb: Enable support for more USB devices including
  Linksys WUSB600N (Closes: #596626) (this change was accidentally
  omitted from 2.6.39-1)
* [x86] Remove Celeron from list of processors supporting PAE. Most
  'Celeron M' models do not.
* Update debconf template translations:
  - Swedish (Martin Bagge) (Closes: #628932)
  - French (David Prévot) (Closes: #628191)
* aufs: Update for 2.6.39 (Closes: #627837)
* Add stable 2.6.39.1, including:
  - ext4: dont set PageUptodate in ext4_end_bio()
  - pata_cmd64x: fix boot crash on parisc (Closes: #622997, #622745)
  - ext3: Fix fs corruption when make_indexed_dir() fails
  - netfilter: nf_ct_sip: validate Content-Length in TCP SIP messages
  - sctp: fix race between sctp_bind_addr_free() and
    sctp_bind_addr_conflict()
  - sctp: fix memory leak of the ASCONF queue when free asoc
  - md/bitmap: fix saving of events_cleared and other state
  - cdc_acm: Fix oops when Droids MuIn LCD is connected
  - cx88: Fix conversion from BKL to fine-grained locks (Closes: #619827)
  - keys: Set cred->user_ns in key_replace_session_keyring (CVE-2011-2184)
  - tmpfs: fix race between truncate and writepage
  - nfs41: Correct offset for LAYOUTCOMMIT
  - xen/mmu: fix a race window causing leave_mm BUG()
  - ext4: fix possible use-after-free in ext4_remove_li_request()
  For the complete list of changes, see:
   http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.39.1
* Bump ABI to 2
* netfilter: Enable IP_SET, IP_SET_BITMAP_IP, IP_SET_BITMAP_IPMAC,
  IP_SET_BITMAP_PORT, IP_SET_HASH_IP, IP_SET_HASH_IPPORT,
  IP_SET_HASH_IPPORTIP, IP_SET_HASH_IPPORTNET, IP_SET_HASH_NET,
  IP_SET_HASH_NETPORT, IP_SET_LIST_SET, NETFILTER_XT_SET as modules
  (Closes: #629401)

[ Aurelien Jarno ]
* [mipsel/loongson-2f] Disable_SCSI_LPFC to workaround GCC ICE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
313
313
//              uiNumBytes - Number of bytes to be read from the EEPROM.
314
314
//
315
315
// Returns:
316
 
//              OSAL_STATUS_SUCCESS - if EEPROM read is successfull.
 
316
//              OSAL_STATUS_SUCCESS - if EEPROM read is successful.
317
317
//              <FAILURE>                       - if failed.
318
318
//-----------------------------------------------------------------------------
319
319
 
431
431
//              uiNumBytes - Number of bytes to be read from the FLASH.
432
432
//
433
433
// Returns:
434
 
//              OSAL_STATUS_SUCCESS - if FLASH read is successfull.
 
434
//              OSAL_STATUS_SUCCESS - if FLASH read is successful.
435
435
//              <FAILURE>                       - if failed.
436
436
//-----------------------------------------------------------------------------
437
437
 
1174
1174
        if(NULL == pTempBuff)
1175
1175
                goto BeceemFlashBulkWrite_EXIT;
1176
1176
//
1177
 
// check if the data to be written is overlapped accross sectors
 
1177
// check if the data to be written is overlapped across sectors
1178
1178
//
1179
1179
        if(uiOffset+uiNumBytes < uiSectBoundary)
1180
1180
        {
1390
1390
                goto BeceemFlashBulkWriteStatus_EXIT;
1391
1391
 
1392
1392
//
1393
 
// check if the data to be written is overlapped accross sectors
 
1393
// check if the data to be written is overlapped across sectors
1394
1394
//
1395
1395
        if(uiOffset+uiNumBytes < uiSectBoundary)
1396
1396
        {
2020
2020
//              uiNumBytes - Number of bytes to be read from the NVM.
2021
2021
//
2022
2022
// Returns:
2023
 
//              OSAL_STATUS_SUCCESS - if NVM read is successfull.
 
2023
//              OSAL_STATUS_SUCCESS - if NVM read is successful.
2024
2024
//              <FAILURE>                       - if failed.
2025
2025
//-----------------------------------------------------------------------------
2026
2026
 
2083
2083
//              uiNumBytes - Number of bytes to be written..
2084
2084
//
2085
2085
// Returns:
2086
 
//              OSAL_STATUS_SUCCESS - if NVM write is successfull.
 
2086
//              OSAL_STATUS_SUCCESS - if NVM write is successful.
2087
2087
//              <FAILURE>                       - if failed.
2088
2088
//-----------------------------------------------------------------------------
2089
2089
 
2218
2218
//          uiSectorSize - sector size
2219
2219
//
2220
2220
// Returns:
2221
 
//              OSAL_STATUS_SUCCESS - if NVM write is successfull.
 
2221
//              OSAL_STATUS_SUCCESS - if NVM write is successful.
2222
2222
//              <FAILURE>                       - if failed.
2223
2223
//-----------------------------------------------------------------------------
2224
2224
 
2430
2430
*Input Parameter:
2431
2431
*               Adapter data structure
2432
2432
*Return Value :
2433
 
*               0. means sucess;
 
2433
*               0. means success;
2434
2434
*/
2435
2435
/***************************************************************************/
2436
2436
 
2998
2998
        /*
2999
2999
        *       Considering all the section for which end offset can be calculated or directly given
3000
3000
        *       in CS Structure. if matching case does not exist, return STATUS_FAILURE indicating section
3001
 
        *       endoffset can't be calculated or given in CS Stucture.
 
3001
        *       endoffset can't be calculated or given in CS Structure.
3002
3002
        */
3003
3003
 
3004
3004
        INT SectStartOffset = 0 ;
3173
3173
*       @uiNumBytes : Number of Bytes for Read
3174
3174
*
3175
3175
*       Return value:-
3176
 
*               return true on sucess and STATUS_FAILURE on fail.
 
3176
*               return true on success and STATUS_FAILURE on fail.
3177
3177
*/
3178
3178
 
3179
3179
INT BcmFlash2xBulkRead(
3241
3241
*       @uiNumBytes : Number of Bytes for Write
3242
3242
*
3243
3243
*       Return value:-
3244
 
*               return true on sucess and STATUS_FAILURE on fail.
 
3244
*               return true on success and STATUS_FAILURE on fail.
3245
3245
*
3246
3246
*/
3247
3247
 
3308
3308
*       @Adapter :-Drivers private Data Structure
3309
3309
*
3310
3310
*       Return Value:-
3311
 
*               Return STATUS_SUCESS if get sucess in setting the right DSD else negaive error code
 
3311
*               Return STATUS_SUCESS if get success in setting the right DSD else negaive error code
3312
3312
*
3313
3313
**/
3314
3314
static INT BcmGetActiveDSD(PMINI_ADAPTER Adapter)
3384
3384
*       @uiOffset : Offset provided in the Flash
3385
3385
*
3386
3386
*       Return Value:-
3387
 
*       Sucess:-TRUE ,  offset is writable
 
3387
*       Success:-TRUE ,  offset is writable
3388
3388
*       Failure:-FALSE, offset is RO
3389
3389
*
3390
3390
**/
3441
3441
        @Adapter:-Driver private Data Structure
3442
3442
*
3443
3443
*       Return value:-
3444
 
*       Sucess:- STATUS_SUCESS
 
3444
*       Success:- STATUS_SUCESS
3445
3445
*       Failure:- negative error code
3446
3446
**/
3447
3447
 
3783
3783
                                        // This is a SPECIAL Case which will only happen if the current highest priority ISO has priority value = 0x7FFFFFFF.
3784
3784
                                        // We will write 1 to the current Highest priority ISO And then shall increase the priority of the requested ISO
3785
3785
                                        // by user
3786
 
                                        BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happend, eFlash2xSectVal: 0x%x\n",eFlash2xSectVal);
 
3786
                                        BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happened, eFlash2xSectVal: 0x%x\n",eFlash2xSectVal);
3787
3787
                                        SectImagePriority = htonl(0x1);
3788
3788
                                        Status = BcmFlash2xBulkWrite(Adapter,
3789
3789
                                                                &SectImagePriority,
3853
3853
                                        // This is a SPECIAL Case which will only happen if the current highest priority DSD has priority value = 0x7FFFFFFF.
3854
3854
                                        // We will write 1 to the current Highest priority DSD And then shall increase the priority of the requested DSD
3855
3855
                                        // by user
3856
 
                                        BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happend, eFlash2xSectVal: 0x%x\n",eFlash2xSectVal);
 
3856
                                        BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happened, eFlash2xSectVal: 0x%x\n",eFlash2xSectVal);
3857
3857
                                        SectImagePriority = htonl(0x1);
3858
3858
 
3859
3859
                                        Status = BcmFlash2xBulkWrite(Adapter,
4119
4119
                                                                                                MAX_RW_SIZE);
4120
4120
                                IsThisHeaderSector = FALSE ;
4121
4121
                        }
4122
 
                        //substracting the written Data
 
4122
                        //subtracting the written Data
4123
4123
                        uiTotalDataToCopy = uiTotalDataToCopy - Adapter->uiSectorSize ;
4124
4124
                }
4125
4125
 
4250
4250
                                IsThisHeaderSector = FALSE ;
4251
4251
                        }
4252
4252
 
4253
 
                        //substracting the written Data
 
4253
                        //subtracting the written Data
4254
4254
                        uiTotalDataToCopy = uiTotalDataToCopy - Adapter->uiSectorSize ;
4255
4255
                }
4256
4256
 
4268
4268
@eFlash2xSectionVal :- Flash section val which has header
4269
4269
 
4270
4270
Return Value :-
4271
 
        Sucess :- If Section is present and writable, corrupt the sig and return STATUS_SUCCESS
 
4271
        Success :- If Section is present and writable, corrupt the sig and return STATUS_SUCCESS
4272
4272
        Failure :-Return negative error code
4273
4273
 
4274
4274
 
4301
4301
@eFlashSectionVal :- Flash section val which has header
4302
4302
 
4303
4303
Return Value :-
4304
 
        Sucess :- If Section is present and writable write the sig and return STATUS_SUCCESS
 
4304
        Success :- If Section is present and writable write the sig and return STATUS_SUCCESS
4305
4305
        Failure :-Return negative error code
4306
4306
 
4307
4307
**/
4504
4504
                             in case of numofBytes  equal zero complete section will be copied.
4505
4505
 
4506
4506
Return Values-
4507
 
        Sucess : Return STATUS_SUCCESS
 
4507
        Success : Return STATUS_SUCCESS
4508
4508
        Faillure :- return negative error code
4509
4509
 
4510
4510
**/
4621
4621
@uiOffset :- Flash offset that has to be written.
4622
4622
 
4623
4623
Return value :-
4624
 
        Sucess :- On sucess return STATUS_SUCCESS
 
4624
        Success :- On success return STATUS_SUCCESS
4625
4625
        Faillure :- Return negative error code
4626
4626
 
4627
4627
**/
4634
4634
        UINT uiSectAlignAddr = 0;
4635
4635
        UINT sig = 0;
4636
4636
 
4637
 
        //making the offset sector alligned
 
4637
        //making the offset sector aligned
4638
4638
        uiSectAlignAddr = uiOffset & ~(Adapter->uiSectorSize - 1);
4639
4639
 
4640
4640
 
4643
4643
        (uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter,DSD0)- Adapter->uiSectorSize))
4644
4644
        {
4645
4645
 
4646
 
                //offset from the sector boundry having the header map
 
4646
                //offset from the sector boundary having the header map
4647
4647
                offsetToProtect = Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader % Adapter->uiSectorSize;
4648
4648
                HeaderSizeToProtect = sizeof(DSD_HEADER);
4649
4649
                bHasHeader = TRUE ;
4697
4697
@Adapater :- Bcm Driver Private Data Structure
4698
4698
 
4699
4699
OutPut:-
4700
 
        Select the Appropriate chip and retrn status Sucess
 
4700
        Select the Appropriate chip and retrn status Success
4701
4701
**/
4702
4702
static INT BcmDoChipSelect(PMINI_ADAPTER Adapter, UINT offset)
4703
4703
{
5086
5086
        {
5087
5087
                if(IsSectionWritable(Adapter,eFlash2xSectionVal) != TRUE)
5088
5088
                {
5089
 
                        BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Section is not Writable...Hence cant Corrupt signature");
 
5089
                        BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Section is not Writable...Hence can't Corrupt signature");
5090
5090
                        return SECTOR_IS_NOT_WRITABLE;
5091
5091
                }
5092
5092
        }
5155
5155
 
5156
5156
        if(IsSectionWritable(Adapter,eFlash2xSectionVal) != TRUE)
5157
5157
        {
5158
 
                BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Section is not Writable...Hence cant Corrupt signature");
 
5158
                BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Section is not Writable...Hence can't Corrupt signature");
5159
5159
                return SECTOR_IS_NOT_WRITABLE;
5160
5160
        }
5161
5161