Lines Matching refs:MS_Lib
228 …_logical(pdx, PhyBlock) (((PhyBlock) >= (pdx)->MS_Lib.NumberOfPhyBlock) ? MS_STATUS_ERROR : (pdx)-…
229 …physical(pdx, LogBlock) (((LogBlock) >= (pdx)->MS_Lib.NumberOfLogBlock) ? MS_STATUS_ERROR : (pdx)-…
231 #define ms_lib_ctrl_set(pdx, Flag) ((pdx)->MS_Lib.flags |= (1 << (Flag)))
232 #define ms_lib_ctrl_reset(pdx, Flag) ((pdx)->MS_Lib.flags &= ~(1 << (Flag)))
233 #define ms_lib_ctrl_check(pdx, Flag) ((pdx)->MS_Lib.flags & (1 << (Flag)))
236 #define ms_lib_clear_pagemap(pdx) memset((pdx)->MS_Lib.pagemap, 0, sizeof((pdx)->MS_Lib.pagemap))
460 struct ms_lib_ctrl MS_Lib; member
759 if ((logblk >= info->MS_Lib.NumberOfLogBlock) || (phyblk >= info->MS_Lib.NumberOfPhyBlock)) in ms_lib_set_logicalpair()
762 info->MS_Lib.Phy2LogMap[phyblk] = logblk; in ms_lib_set_logicalpair()
763 info->MS_Lib.Log2PhyMap[logblk] = phyblk; in ms_lib_set_logicalpair()
772 if (phyblk >= info->MS_Lib.NumberOfPhyBlock) in ms_lib_set_logicalblockmark()
775 info->MS_Lib.Phy2LogMap[phyblk] = mark; in ms_lib_set_logicalblockmark()
794 kfree(info->MS_Lib.Phy2LogMap); in ms_lib_free_logicalmap()
795 info->MS_Lib.Phy2LogMap = NULL; in ms_lib_free_logicalmap()
797 kfree(info->MS_Lib.Log2PhyMap); in ms_lib_free_logicalmap()
798 info->MS_Lib.Log2PhyMap = NULL; in ms_lib_free_logicalmap()
808 info->MS_Lib.Phy2LogMap = kmalloc_array(info->MS_Lib.NumberOfPhyBlock, in ms_lib_alloc_logicalmap()
811 info->MS_Lib.Log2PhyMap = kmalloc_array(info->MS_Lib.NumberOfLogBlock, in ms_lib_alloc_logicalmap()
815 if ((info->MS_Lib.Phy2LogMap == NULL) || (info->MS_Lib.Log2PhyMap == NULL)) { in ms_lib_alloc_logicalmap()
820 for (i = 0; i < info->MS_Lib.NumberOfPhyBlock; i++) in ms_lib_alloc_logicalmap()
821 info->MS_Lib.Phy2LogMap[i] = MS_LB_NOT_USED; in ms_lib_alloc_logicalmap()
823 for (i = 0; i < info->MS_Lib.NumberOfLogBlock; i++) in ms_lib_alloc_logicalmap()
824 info->MS_Lib.Log2PhyMap[i] = MS_LB_NOT_USED; in ms_lib_alloc_logicalmap()
834 info->MS_Lib.wrtblk = (u16)-1; in ms_lib_clear_writebuf()
837 if (info->MS_Lib.blkpag) in ms_lib_clear_writebuf()
838 memset(info->MS_Lib.blkpag, 0xff, info->MS_Lib.PagesPerBlock * info->MS_Lib.BytesPerSector); in ms_lib_clear_writebuf()
840 if (info->MS_Lib.blkext) { in ms_lib_clear_writebuf()
841 for (i = 0; i < info->MS_Lib.PagesPerBlock; i++) { in ms_lib_clear_writebuf()
842 info->MS_Lib.blkext[i].status1 = MS_REG_ST1_DEFAULT; in ms_lib_clear_writebuf()
843 info->MS_Lib.blkext[i].ovrflg = MS_REG_OVR_DEFAULT; in ms_lib_clear_writebuf()
844 info->MS_Lib.blkext[i].mngflg = MS_REG_MNG_DEFAULT; in ms_lib_clear_writebuf()
845 info->MS_Lib.blkext[i].logadr = MS_LB_NOT_USED; in ms_lib_clear_writebuf()
857 switch (info->MS_Lib.Phy2LogMap[PhyBlock]) { in ms_count_freeblock()
959 switch (info->MS_Lib.cardType = SysInfo->bCardType) { in ms_lib_process_bootblock()
971 info->MS_Lib.blockSize = be16_to_cpu(SysInfo->wBlockSize); in ms_lib_process_bootblock()
972 info->MS_Lib.NumberOfPhyBlock = be16_to_cpu(SysInfo->wBlockNumber); in ms_lib_process_bootblock()
973 info->MS_Lib.NumberOfLogBlock = be16_to_cpu(SysInfo->wTotalBlockNumber)-2; in ms_lib_process_bootblock()
974 info->MS_Lib.PagesPerBlock = info->MS_Lib.blockSize * SIZE_OF_KIRO / MS_BYTES_PER_PAGE; in ms_lib_process_bootblock()
975 info->MS_Lib.NumberOfSegment = info->MS_Lib.NumberOfPhyBlock / MS_PHYSICAL_BLOCKS_PER_SEGMENT; in ms_lib_process_bootblock()
999 if (EntryOffset + MS_BYTES_PER_PAGE + EntrySize > info->MS_Lib.blockSize * (u32)SIZE_OF_KIRO) in ms_lib_process_bootblock()
1053 info->MS_Lib.BytesPerSector = le16_to_cpu(idi->wIDIbytesPerSector); in ms_lib_process_bootblock()
1054 if (info->MS_Lib.BytesPerSector != MS_BYTES_PER_PAGE) in ms_lib_process_bootblock()
1074 info->MS_Lib.wrtblk = (u16)-1; /* set to -1 */ in ms_lib_free_writebuf()
1080 if (info->MS_Lib.blkpag) { in ms_lib_free_writebuf()
1081 kfree(info->MS_Lib.blkpag); /* Arnold test ... */ in ms_lib_free_writebuf()
1082 info->MS_Lib.blkpag = NULL; in ms_lib_free_writebuf()
1085 if (info->MS_Lib.blkext) { in ms_lib_free_writebuf()
1086 kfree(info->MS_Lib.blkext); /* Arnold test ... */ in ms_lib_free_writebuf()
1087 info->MS_Lib.blkext = NULL; in ms_lib_free_writebuf()
1100 info->MS_Lib.flags = 0; in ms_lib_free_allocatedarea()
1101 info->MS_Lib.BytesPerSector = 0; in ms_lib_free_allocatedarea()
1102 info->MS_Lib.SectorsPerCylinder = 0; in ms_lib_free_allocatedarea()
1104 info->MS_Lib.cardType = 0; in ms_lib_free_allocatedarea()
1105 info->MS_Lib.blockSize = 0; in ms_lib_free_allocatedarea()
1106 info->MS_Lib.PagesPerBlock = 0; in ms_lib_free_allocatedarea()
1108 info->MS_Lib.NumberOfPhyBlock = 0; in ms_lib_free_allocatedarea()
1109 info->MS_Lib.NumberOfLogBlock = 0; in ms_lib_free_allocatedarea()
1117 info->MS_Lib.wrtblk = (u16)-1; in ms_lib_alloc_writebuf()
1119 info->MS_Lib.blkpag = kmalloc_array(info->MS_Lib.PagesPerBlock, in ms_lib_alloc_writebuf()
1120 info->MS_Lib.BytesPerSector, in ms_lib_alloc_writebuf()
1122 info->MS_Lib.blkext = kmalloc_array(info->MS_Lib.PagesPerBlock, in ms_lib_alloc_writebuf()
1126 if ((info->MS_Lib.blkpag == NULL) || (info->MS_Lib.blkext == NULL)) { in ms_lib_alloc_writebuf()
1143 if ((logblk >= info->MS_Lib.NumberOfLogBlock) || in ms_lib_force_setlogical_pair()
1144 (phyblk >= info->MS_Lib.NumberOfPhyBlock)) in ms_lib_force_setlogical_pair()
1147 info->MS_Lib.Phy2LogMap[phyblk] = logblk; in ms_lib_force_setlogical_pair()
1148 info->MS_Lib.Log2PhyMap[logblk] = phyblk; in ms_lib_force_setlogical_pair()
1232 if (blk == info->MS_Lib.Log2PhyMap[0]) { in ms_lib_check_disableblock()
1249 if (phyblk >= info->MS_Lib.NumberOfPhyBlock) in ms_lib_setacquired_errorblock()
1252 log = info->MS_Lib.Phy2LogMap[phyblk]; in ms_lib_setacquired_errorblock()
1254 if (log < info->MS_Lib.NumberOfLogBlock) in ms_lib_setacquired_errorblock()
1255 info->MS_Lib.Log2PhyMap[log] = MS_LB_NOT_USED; in ms_lib_setacquired_errorblock()
1257 if (info->MS_Lib.Phy2LogMap[phyblk] != MS_LB_INITIAL_ERROR) in ms_lib_setacquired_errorblock()
1258 info->MS_Lib.Phy2LogMap[phyblk] = MS_LB_ACQUIRED_ERROR; in ms_lib_setacquired_errorblock()
1299 if (phyblk >= info->MS_Lib.NumberOfPhyBlock) in ms_lib_error_phyblock()
1315 if (phyblk >= info->MS_Lib.NumberOfPhyBlock) in ms_lib_erase_phyblock()
1318 log = info->MS_Lib.Phy2LogMap[phyblk]; in ms_lib_erase_phyblock()
1320 if (log < info->MS_Lib.NumberOfLogBlock) in ms_lib_erase_phyblock()
1321 info->MS_Lib.Log2PhyMap[log] = MS_LB_NOT_USED; in ms_lib_erase_phyblock()
1323 info->MS_Lib.Phy2LogMap[phyblk] = MS_LB_NOT_USED; in ms_lib_erase_phyblock()
1328 info->MS_Lib.Phy2LogMap[phyblk] = MS_LB_NOT_USED_ERASED; in ms_lib_erase_phyblock()
1389 if (phyblk >= info->MS_Lib.NumberOfPhyBlock) in ms_libsearch_block_from_physical()
1396 if (info->MS_Lib.Phy2LogMap[blk] == MS_LB_NOT_USED_ERASED) { in ms_libsearch_block_from_physical()
1398 } else if (info->MS_Lib.Phy2LogMap[blk] == MS_LB_NOT_USED) { in ms_libsearch_block_from_physical()
1440 if (logblk >= info->MS_Lib.NumberOfLogBlock) in ms_libsearch_block_from_logical()
1498 bl_num = info->MS_Lib.NumberOfLogBlock * info->MS_Lib.blockSize * 2 - 1; in ms_scsi_read_capacity()
1567 for (PhyBlock = 0; PhyBlock < info->MS_Lib.NumberOfPhyBlock;) { in ms_lib_scan_logicalblocknumber()
1689 logblk = (u16)(bn / info->MS_Lib.PagesPerBlock); in ms_scsi_read()
1690 PageNum = (u8)(bn % info->MS_Lib.PagesPerBlock); in ms_scsi_read()
1693 if (blen > (info->MS_Lib.PagesPerBlock-PageNum)) in ms_scsi_read()
1694 len = info->MS_Lib.PagesPerBlock-PageNum; in ms_scsi_read()
1790 PhyBlockAddr = (u16)(bn / info->MS_Lib.PagesPerBlock); in ms_scsi_write()
1791 PageNum = (u8)(bn % info->MS_Lib.PagesPerBlock); in ms_scsi_write()
1794 if (blen > (info->MS_Lib.PagesPerBlock-PageNum)) in ms_scsi_write()
1795 len = info->MS_Lib.PagesPerBlock-PageNum; in ms_scsi_write()
1810 info->MS_Lib.Phy2LogMap[oldphy] = MS_LB_NOT_USED_ERASED; in ms_scsi_write()
2029 info->MS_Lib.Phy2LogMap[TmpBlock] = MS_LB_INITIAL_ERROR; in ms_card_init()
2031 info->MS_Lib.Phy2LogMap[btBlk1st] = MS_LB_BOOT_BLOCK; in ms_card_init()
2035 info->MS_Lib.Phy2LogMap[TmpBlock] = MS_LB_INITIAL_ERROR; in ms_card_init()
2037 info->MS_Lib.Phy2LogMap[btBlk2nd] = MS_LB_BOOT_BLOCK; in ms_card_init()
2045 TmpBlock < info->MS_Lib.NumberOfPhyBlock; in ms_card_init()