⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hpt370.cod

📁 hpt370的驱动程序
💻 COD
📖 第 1 页 / 共 5 页
字号:
$L1941:

; 154  : 
; 155  :         //
; 156  :         // SET DATA TRANSFER TIMING MODE
; 157  :         //
; 158  :         ScsiPortWritePortUchar(
; 159  :             &baseIoAddress1->DriveSelect,
; 160  :             (UCHAR)((deviceNumber << 4) | 0xA0));

  00130	8a d3		 mov	 dl, bl
  00132	8d 47 06	 lea	 eax, DWORD PTR [edi+6]
  00135	80 ca fa	 or	 dl, 250			; 000000faH
  00138	c0 e2 04	 shl	 dl, 4
  0013b	52		 push	 edx
  0013c	50		 push	 eax
  0013d	e8 00 00 00 00	 call	 _ScsiPortWritePortUchar@8

; 161  : 
; 162  :         //
; 163  :         // Select sub-command 0x03 (Set Transfer Mode)
; 164  :         //
; 165  :         ScsiPortWritePortUchar((PUCHAR)&baseIoAddress1->Data + 1, 0x03);

  00142	8d 4f 01	 lea	 ecx, DWORD PTR [edi+1]
  00145	6a 03		 push	 3
  00147	51		 push	 ecx
  00148	e8 00 00 00 00	 call	 _ScsiPortWritePortUchar@8

; 166  : 
; 167  :         //
; 168  :         // Select mode
; 169  :         //
; 170  :         if (pDev->Flag & PF_DMA) {

  0014d	8b 06		 mov	 eax, DWORD PTR [esi]
  0014f	a8 01		 test	 al, 1
  00151	74 1c		 je	 SHORT $L1945

; 171  :             //
; 172  :             // Select DMA transfer mode to enable
; 173  :             //
; 174  :             if (pDev->Flag & PF_ULTRA)

  00153	a8 10		 test	 al, 16			; 00000010H
  00155	74 0d		 je	 SHORT $L1946

; 175  :                 tmp = FT_USE_ULTRA | pDev->UltraDmaMode;

  00157	8a 56 0d	 mov	 dl, BYTE PTR [esi+13]
  0015a	80 ca 40	 or	 dl, 64			; 00000040H
  0015d	66 33 c0	 xor	 ax, ax
  00160	8a c2		 mov	 al, dl

; 176  :             else 

  00162	eb 16		 jmp	 SHORT $L1948
$L1946:

; 177  :                 tmp = pDev->DmaHpt366Mode | FT_USE_MWDMA;

  00164	8a 46 0b	 mov	 al, BYTE PTR [esi+11]
  00167	0c 20		 or	 al, 32			; 00000020H
  00169	66 0f b6 c0	 movzx	 ax, al

; 178  :         }
; 179  :         else {

  0016d	eb 0b		 jmp	 SHORT $L1948
$L1945:

; 180  :             //
; 181  :             // Select PIO flow control transfer mode to enable
; 182  :             // (This will enable the IO channel ready)
; 183  :             //
; 184  :             tmp = FT_USE_PIO | pDev->PioHpt366Mode;

  0016f	8a 4e 0c	 mov	 cl, BYTE PTR [esi+12]
  00172	80 c9 08	 or	 cl, 8
  00175	66 33 c0	 xor	 ax, ax
  00178	8a c1		 mov	 al, cl
$L1948:

; 185  :         }
; 186  : 
; 187  :         ScsiPortWritePortUchar(&baseIoAddress1->BlockCount, (UCHAR)tmp);

  0017a	8d 57 02	 lea	 edx, DWORD PTR [edi+2]
  0017d	50		 push	 eax
  0017e	52		 push	 edx
  0017f	e8 00 00 00 00	 call	 _ScsiPortWritePortUchar@8

; 188  : 
; 189  :         //
; 190  :         // Issue SET FEATURES command
; 191  :         //
; 192  :         ScsiPortWritePortUchar(
; 193  :             &baseIoAddress1->Command, IDE_COMMAND_SET_FEATURES);

  00184	8d 47 07	 lea	 eax, DWORD PTR [edi+7]
  00187	68 ef 00 00 00	 push	 239			; 000000efH
  0018c	50		 push	 eax
  0018d	e8 00 00 00 00	 call	 _ScsiPortWritePortUchar@8

; 194  : 
; 195  :         //
; 196  :         // Wait for Busy to drop.
; 197  :         //
; 198  :         WaitOnBusy(baseIoAddress2, statusByte);

  00192	c7 45 08 00 00
	00 00		 mov	 DWORD PTR _i$1950[ebp], 0
$L1951:
  00199	8b 45 fc	 mov	 eax, DWORD PTR _baseIoAddress2$[ebp]
  0019c	50		 push	 eax
  0019d	e8 00 00 00 00	 call	 _ScsiPortReadPortUchar@4
  001a2	a8 80		 test	 al, 128			; 00000080H
  001a4	74 18		 je	 SHORT $L1954
  001a6	68 96 00 00 00	 push	 150			; 00000096H
  001ab	e8 00 00 00 00	 call	 _ScsiPortStallExecution@4
  001b0	8b 45 08	 mov	 eax, DWORD PTR _i$1950[ebp]
  001b3	40		 inc	 eax
  001b4	3d 20 4e 00 00	 cmp	 eax, 20000		; 00004e20H
  001b9	89 45 08	 mov	 DWORD PTR _i$1950[ebp], eax
  001bc	72 db		 jb	 SHORT $L1951
$L1954:

; 199  : 
; 200  :         //
; 201  :         // Clear interrupt
; 202  :         //
; 203  :         GetBaseStatus(baseIoAddress1, statusByte);

  001be	8d 47 07	 lea	 eax, DWORD PTR [edi+7]
  001c1	50		 push	 eax
  001c2	e8 00 00 00 00	 call	 _ScsiPortReadPortUchar@4
$L1940:

; 204  : 
; 205  : #if defined(FIX_WD)
; 206  :         // Work Around for WD Caviar HDs:
; 207  :         // ------------------------------
; 208  :         // For some of WD Caviar HDs, we must disable IORDY to perform DMA
; 209  :         // on the drive.(Actually It doesn't hurt to do this to other HDs)
; 210  :         // These disks include:
; 211  :         //      AC1170/2250/2340 CCC:A9
; 212  :         //      AC2340 CCC:B2
; 213  :         //      AC1210/2420 CCC:A3
; 214  :         //      AC1270/2540 CCC:A1,A2,D1
; 215  :         //      AC1365/2700/31000 CCC:A3,A4,A5,A6
; 216  :         //      AC1365/1425/2700/2850 CCC:B1,B2
; 217  :         // So many models, we will not check for every model number
; 218  :         // and disable the IORDY on all WD Caviar HDs.
; 219  :         //
; 220  :         if (pDev->Flag & PF_DMA) {
; 221  :             int i = deviceNumber;
; 222  : 
; 223  :             if (pDev->IdentifyData.ModelNumber[0]==0x5744 &&
; 224  :                 pDev->IdentifyData.ModelNumber[1]==0x4320 &&
; 225  :                 pDev->IdentifyData.ModelNumber[2]==0x4143) {
; 226  : 
; 227  :                 AtDump(ATTRITON, (DBGSW
; 228  :                     "This is a WD AC disk\n"));
; 229  :                 //
; 230  :                 // Select "disable IORDY"
; 231  :                 //
; 232  :                 ScsiPortWritePortUchar(
; 233  :                     &baseIoAddress1->BlockCount, FT_DISABLE_IORDY);
; 234  : 
; 235  :                 //
; 236  :                 // Enable SET FEATURES command
; 237  :                 //
; 238  :                 ScsiPortWritePortUchar(
; 239  :                     &baseIoAddress1->Command, IDE_COMMAND_SET_FEATURES);
; 240  : 
; 241  :                 //
; 242  :                 // Wait for Busy to drop
; 243  :                 //
; 244  :                 WaitOnBusy(baseIoAddress2, statusByte);
; 245  : 
; 246  :                 //
; 247  :                 // Clear interrupt
; 248  :                 //
; 249  :                 GetBaseStatus(baseIoAddress1, statusByte);
; 250  : 
; 251  :             } // "WDC AC"?
; 252  :         }
; 253  : #endif // Must disable IORDY for WDs when DMA
; 254  : 
; 255  :     }
; 256  : 
; 257  :     //
; 258  :     // Set default PIO read/write command and block size
; 259  :     //
; 260  :     pDev->ReadCmd  = IDE_COMMAND_READ;
; 261  :     pDev->WriteCmd = IDE_COMMAND_WRITE;
; 262  :     pDev->BlockSize= SECTOR_WSIZE;
; 263  : 
; 264  : #ifdef USE_MULTIPLE
; 265  :     if (!(pDev->Flag & PF_MULTIPLE))

  001c7	8a 06		 mov	 al, BYTE PTR [esi]
  001c9	c6 46 0e 20	 mov	 BYTE PTR [esi+14], 32	; 00000020H
  001cd	a8 04		 test	 al, 4
  001cf	c6 46 0f 30	 mov	 BYTE PTR [esi+15], 48	; 00000030H
  001d3	c7 46 10 00 01
	00 00		 mov	 DWORD PTR [esi+16], 256	; 00000100H
  001da	0f 84 fa 00 00
	00		 je	 $L1973

; 266  :         return;
; 267  : 
; 268  :     //
; 269  :     // Get number of blocks for one xfer
; 270  :     //
; 271  :     numberOfBlock =
; 272  :         pDev->IdentifyData.MaximumBlockTransfer/2;

  001e0	8a 46 72	 mov	 al, BYTE PTR [esi+114]
  001e3	d0 e8		 shr	 al, 1

; 273  : 
; 274  :     if (numberOfBlock <= 1) {

  001e5	3c 01		 cmp	 al, 1
  001e7	88 45 08	 mov	 BYTE PTR _numberOfBlock$[ebp], al
  001ea	77 09		 ja	 SHORT $L1957

; 275  :         numberOfBlock = 1;

  001ec	c6 45 08 01	 mov	 BYTE PTR _numberOfBlock$[ebp], 1

; 276  :         goto SetBlockSize;

  001f0	e9 ac 00 00 00	 jmp	 $SetBlockSize$1958
$L1957:

; 277  :     }
; 278  : 
; 279  :     //
; 280  :     // Set to use multiple sector command
; 281  :     //
; 282  :     ScsiPortWritePortUchar(
; 283  :         &baseIoAddress1->DriveSelect, (UCHAR)((deviceNumber << 4) | 0xA0));

  001f5	80 cb fa	 or	 bl, 250			; 000000faH
  001f8	8d 4f 06	 lea	 ecx, DWORD PTR [edi+6]
  001fb	c0 e3 04	 shl	 bl, 4
  001fe	53		 push	 ebx
  001ff	51		 push	 ecx
  00200	e8 00 00 00 00	 call	 _ScsiPortWritePortUchar@8

; 284  :     ScsiPortWritePortUchar(
; 285  :         &baseIoAddress1->BlockCount, numberOfBlock);

  00205	8b 55 08	 mov	 edx, DWORD PTR _numberOfBlock$[ebp]
  00208	8d 47 02	 lea	 eax, DWORD PTR [edi+2]
  0020b	52		 push	 edx
  0020c	50		 push	 eax
  0020d	e8 00 00 00 00	 call	 _ScsiPortWritePortUchar@8

; 286  :     ScsiPortWritePortUchar(
; 287  :         &baseIoAddress1->Command, IDE_COMMAND_SET_MULTIPLE);

  00212	8d 47 07	 lea	 eax, DWORD PTR [edi+7]
  00215	68 c6 00 00 00	 push	 198			; 000000c6H
  0021a	50		 push	 eax
  0021b	e8 00 00 00 00	 call	 _ScsiPortWritePortUchar@8

; 288  : 
; 289  :     //
; 290  :     // Wait for Busy to drop.
; 291  :     //
; 292  :     WaitOnBusy(baseIoAddress2, statusByte);

  00220	33 db		 xor	 ebx, ebx
$L1961:
  00222	8b 4d fc	 mov	 ecx, DWORD PTR _baseIoAddress2$[ebp]
  00225	51		 push	 ecx
  00226	e8 00 00 00 00	 call	 _ScsiPortReadPortUchar@4
  0022b	a8 80		 test	 al, 128			; 00000080H
  0022d	74 13		 je	 SHORT $L1964
  0022f	68 96 00 00 00	 push	 150			; 00000096H
  00234	e8 00 00 00 00	 call	 _ScsiPortStallExecution@4
  00239	43		 inc	 ebx
  0023a	81 fb 20 4e 00
	00		 cmp	 ebx, 20000		; 00004e20H
  00240	72 e0		 jb	 SHORT $L1961
$L1964:

; 293  : 
; 294  :     //
; 295  :     // Check status
; 296  :     //
; 297  :     GetBaseStatus(baseIoAddress1, statusByte);

  00242	8d 47 07	 lea	 eax, DWORD PTR [edi+7]
  00245	50		 push	 eax
  00246	e8 00 00 00 00	 call	 _ScsiPortReadPortUchar@4

; 298  :     errorByte = ScsiPortReadPortUchar((PUCHAR)baseIoAddress1 + 1);

  0024b	8d 57 01	 lea	 edx, DWORD PTR [edi+1]
  0024e	8a d8		 mov	 bl, al
  00250	52		 push	 edx
  00251	88 5d f8	 mov	 BYTE PTR _statusByte$[ebp], bl
  00254	e8 00 00 00 00	 call	 _ScsiPortReadPortUchar@4

; 299  : 
; 300  :     if ((statusByte & (IDE_STATUS_BUSY | IDE_STATUS_ERROR)) ||
; 301  :         (errorByte & IDE_ERROR_COMMAND_ABORTED)) {

  00259	f6 c3 81	 test	 bl, 129			; 00000081H
  0025c	88 45 fc	 mov	 BYTE PTR _errorByte$[ebp], al
  0025f	75 0e		 jne	 SHORT $L1968
  00261	a8 04		 test	 al, 4
  00263	75 0a		 jne	 SHORT $L1968

; 308  :     }
; 309  :     else {
; 310  :         //
; 311  :         // SET_MULTIPLE succeeded, let's use Multiple Sector
; 312  :         //
; 313  :         pDev->ReadCmd  = IDE_COMMAND_MULTIREAD;

  00265	c6 46 0e c4	 mov	 BYTE PTR [esi+14], 196	; 000000c4H

; 314  :         pDev->WriteCmd = IDE_COMMAND_MULTIWRITE;

  00269	c6 46 0f c5	 mov	 BYTE PTR [esi+15], 197	; 000000c5H
  0026d	eb 2f		 jmp	 SHORT $L2309
$L1968:

; 302  :         //
; 303  :         // SET_MULTIPLE failed, don't use Multiple Sector
; 304  :         //
; 305  :         numberOfBlock = 1;
; 306  :         AtDump(ATTRITON, (DBGSW
; 307  :             "Status:%x, Error:%x\n", statusByte, errorByte));

  0026f	a0 00 00 00 00	 mov	 al, BYTE PTR _AtapiDebugLevel
  00274	c6 45 08 01	 mov	 BYTE PTR _numberOfBlock$[ebp], 1
  00278	a8 01		 test	 al, 1
  0027a	74 22		 je	 SHORT $L2309
  0027c	8b 45 fc	 mov	 eax, DWORD PTR _errorByte$[ebp]
  0027f	8b 4d f8	 mov	 ecx, DWORD PTR _statusByte$[ebp]
  00282	25 ff 00 00 00	 and	 eax, 255		; 000000ffH
  00287	81 e1 ff 00 00
	00		 and	 ecx, 255		; 000000ffH
  0028d	50		 push	 eax
  0028e	51		 push	 ecx
  0028f	68 00 00 00 00	 push	 OFFSET FLAT:$SG1970
  00294	6a 00		 push	 0
  00296	e8 00 00 00 00	 call	 _ScsiDebugPrint
  0029b	83 c4 10	 add	 esp, 16			; 00000010H
$L2309:

; 276  :         goto SetBlockSize;

  0029e	8b 5d 0c	 mov	 ebx, DWORD PTR _deviceNumber$[ebp]
$SetBlockSize$1958:

; 315  :     }
; 316  : 
; 317  : SetBlockSize:;
; 318  : 
; 319  :     pDev->BlockSize = (SECTOR_WSIZE * (ULONG)numberOfBlock);

  002a1	8b 45 08	 mov	 eax, DWORD PTR _numberOfBlock$[ebp]
  002a4	25 ff 00 00 00	 and	 eax, 255		; 000000ffH
  002a9	8b d0		 mov	 edx, eax
  002ab	c1 e2 08	 shl	 edx, 8
  002ae	89 56 10	 mov	 DWORD PTR [esi+16], edx

; 320  : 
; 321  :     AtDump(ATTRITON, (DBGSW
; 322  :         "Port %x, Device %x, Size %x, ReadCmd %x, WriteCmd %x\n",
; 323  :         baseIoAddress1,
; 324  :         deviceNumber,
; 325  :         numberOfBlock,
; 326  :         pDev->ReadCmd,
; 327  :         pDev->WriteCmd
; 328  :         ));

  002b1	8a 0d 00 00 00
	00		 mov	 cl, BYTE PTR _AtapiDebugLevel
  002b7	f6 c1 01	 test	 cl, 1
  002ba	74 1e		 je	 SHORT $L1973
  002bc	33 c9		 xor	 ecx, ecx
  002be	33 d2		 xor	 edx, edx
  002c0	8a 4e 0f	 mov	 cl, BYTE PTR [esi+15]
  002c3	8a 56 0e	 mov	 dl, BYTE PTR [esi+14]
  002c6	51		 push	 ecx
  002c7	52		 push	 edx
  002c8	50		 push	 eax
  002c9	53		 push	 ebx
  002ca	57		 push	 edi
  002cb	68 00 00 00 00	 push	 OFFSET FLAT:$SG1974
  002d0	6a 00		 push	 0
  002d2	e8 00 00 00 00	 call	 _ScsiDebugPrint
  002d7	83 c4 1c	 add	 esp, 28			; 0000001cH
$L1973:
  002da	5f		 pop	 edi
  002db	5e		 pop	 esi
  002dc	5b		 pop	 ebx

; 329  : #endif //USE_MULTIPLE
; 330  : 
; 331  : } //Hpt366SetModeOnDevice()

  002dd	8b e5		 mov	 esp, ebp
  002df	5d		 pop	 ebp
  002e0	c2 08 00	 ret	 8
_Hpt366SetModeOnDevice@8 ENDP
_TEXT	ENDS
PUBLIC	_Hpt366WdCanUseDma@8
_TEXT	SEGMENT
_IdeChannel$ = 8
_deviceNumber$ = 12
_Hpt366WdCanUseDma@8 PROC NEAR

; 358  : {

  002f0	55		 push	 ebp
  002f1	8b ec		 mov	 ebp, esp

; 359  :     ULONG   i = deviceNumber;
; 360  : 	 PDevice pDev = &IdeChannel->Devices[deviceNumber];

  002f3	8b 45 0c	 mov	 eax, DWORD PTR _deviceNumber$[ebp]
  002f6	53		 push	 ebx
  002f7	8b 5d 08	 mov	 ebx, DWORD PTR _IdeChannel$[ebp]
  002fa	8b c8		 mov	 ecx, eax
  002fc	c1 e1 05	 shl	 ecx, 5
  002ff	03 c8		 add	 ecx, eax
  00301	57		 push	 edi
  00302	8d 14 88	 lea	 edx, DWORD PTR [eax+ecx*4]

; 361  :     USHORT  wdc_MW1_fix_flag =
; 362  :         *((USHORT *)&pDev->IdentifyData + WDC_MW1_FIX_FLAG_OFFSET);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -