1*c2c66affSColin Finck /*++ 2*c2c66affSColin Finck 3*c2c66affSColin Finck Copyright (C) 2006 VorontSOFT 4*c2c66affSColin Finck 5*c2c66affSColin Finck Module Name: 6*c2c66affSColin Finck badblock.h 7*c2c66affSColin Finck 8*c2c66affSColin Finck Abstract: 9*c2c66affSColin Finck This is the artificial badblock simulation part of the 10*c2c66affSColin Finck miniport driver for ATA/ATAPI IDE controllers 11*c2c66affSColin Finck with Busmaster DMA support 12*c2c66affSColin Finck 13*c2c66affSColin Finck Author: 14*c2c66affSColin Finck Nikolai Vorontsov (NickViz) 15*c2c66affSColin Finck 16*c2c66affSColin Finck Environment: 17*c2c66affSColin Finck kernel mode only 18*c2c66affSColin Finck 19*c2c66affSColin Finck Notes: 20*c2c66affSColin Finck 21*c2c66affSColin Finck THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22*c2c66affSColin Finck IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23*c2c66affSColin Finck OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24*c2c66affSColin Finck IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25*c2c66affSColin Finck INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26*c2c66affSColin Finck NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27*c2c66affSColin Finck DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28*c2c66affSColin Finck THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29*c2c66affSColin Finck (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30*c2c66affSColin Finck THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31*c2c66affSColin Finck 32*c2c66affSColin Finck Revision History: 33*c2c66affSColin Finck 2006/08/03 Initial implementation. 34*c2c66affSColin Finck 2006/08/06 Added registry work. 35*c2c66affSColin Finck 36*c2c66affSColin Finck --*/ 37*c2c66affSColin Finck 38*c2c66affSColin Finck 39*c2c66affSColin Finck #ifndef _BADBLOCK_H_INCLUDED_ 40*c2c66affSColin Finck #define _BADBLOCK_H_INCLUDED_ 41*c2c66affSColin Finck 42*c2c66affSColin Finck #pragma pack(push, 4) 43*c2c66affSColin Finck typedef struct _SBadBlockRange 44*c2c66affSColin Finck { 45*c2c66affSColin Finck // ULONG m_ldev; 46*c2c66affSColin Finck ULONGLONG m_lbaStart; 47*c2c66affSColin Finck ULONGLONG m_lbaEnd; 48*c2c66affSColin Finck } SBadBlockRange, *PSBadBlockRange; 49*c2c66affSColin Finck 50*c2c66affSColin Finck typedef struct _SBadBlockListItem { 51*c2c66affSColin Finck LIST_ENTRY List; 52*c2c66affSColin Finck PHW_LU_EXTENSION LunExt; 53*c2c66affSColin Finck WCHAR SerNumStr[128]; 54*c2c66affSColin Finck SBadBlockRange* arrBadBlocks; 55*c2c66affSColin Finck ULONG nBadBlocks; 56*c2c66affSColin Finck } SBadBlockListItem, *PSBadBlockListItem; 57*c2c66affSColin Finck 58*c2c66affSColin Finck #pragma pack(pop) 59*c2c66affSColin Finck 60*c2c66affSColin Finck void 61*c2c66affSColin Finck NTAPI 62*c2c66affSColin Finck InitBadBlocks( 63*c2c66affSColin Finck IN PHW_LU_EXTENSION LunExt 64*c2c66affSColin Finck ); 65*c2c66affSColin Finck 66*c2c66affSColin Finck void 67*c2c66affSColin Finck NTAPI 68*c2c66affSColin Finck ForgetBadBlocks( 69*c2c66affSColin Finck IN PHW_LU_EXTENSION LunExt 70*c2c66affSColin Finck ); 71*c2c66affSColin Finck 72*c2c66affSColin Finck bool 73*c2c66affSColin Finck NTAPI 74*c2c66affSColin Finck CheckIfBadBlock( 75*c2c66affSColin Finck IN PHW_LU_EXTENSION LunExt, 76*c2c66affSColin Finck // IN UCHAR command, 77*c2c66affSColin Finck IN ULONGLONG lba, 78*c2c66affSColin Finck IN ULONG count 79*c2c66affSColin Finck ); 80*c2c66affSColin Finck 81*c2c66affSColin Finck #endif // _BADBLOCK_H_INCLUDED_ 82