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

📄 hpt370.cod

📁 hpt370的驱动程序
💻 COD
📖 第 1 页 / 共 5 页
字号:
; 363  : 
; 364  :     //
; 365  :     // Are words 27-29 of IDENTIFY "WDC" ?
; 366  :     //
; 367  :     if (pDev->IdentifyData.ModelNumber[0]!=0x5744 ||
; 368  :         pDev->IdentifyData.ModelNumber[1]!=0x4320 ||
; 369  :         pDev->IdentifyData.ModelNumber[2]!=0x4143) {

  00305	66 81 bc 93 86
	00 00 00 44 57	 cmp	 WORD PTR [ebx+edx*4+134], 22340 ; 00005744H
  0030f	8d 44 93 3c	 lea	 eax, DWORD PTR [ebx+edx*4+60]
  00313	0f 85 dd 00 00
	00		 jne	 $L1993
  00319	66 81 78 4c 20
	43		 cmp	 WORD PTR [eax+76], 17184 ; 00004320H
  0031f	0f 85 d1 00 00
	00		 jne	 $L1993
  00325	66 81 78 4e 43
	41		 cmp	 WORD PTR [eax+78], 16707 ; 00004143H
  0032b	0f 85 c5 00 00
	00		 jne	 $L1993

; 371  :     }
; 372  : 
; 373  :     //
; 374  :     // ModelNumber == "WDC"
; 375  :     //
; 376  :     if (wdc_MW1_fix_flag == WDC_MW1_FIX_FLAG_VALUE)

  00331	66 81 b8 16 01
	00 00 55 55	 cmp	 WORD PTR [eax+278], 21845 ; 00005555H

; 377  :         return TRUE;

  0033a	0f 84 b6 00 00
	00		 je	 $L1993

; 378  : 
; 379  :     //
; 380  :     // If drive is SINGLE and one of supported firmware
; 381  :     // revisions, ok to use DMA.
; 382  :     //
; 383  :     // SUPPORTED FIRMWARE REVISIONS:
; 384  :     //      AC31200   A0    14.04E28
; 385  :     //      AC2850    B3    25.26H35
; 386  :     //      AC2850    B4    26.27J38
; 387  :     //      AC2850    C0    27.25C38
; 388  :     //      AC2850    C1    27.25C39
; 389  :     //
; 390  :     if((pDev->IdentifyData.FirmwareRevision[0]==0x3134 &&
; 391  :         pDev->IdentifyData.FirmwareRevision[1]==0x2E30 &&
; 392  :         pDev->IdentifyData.FirmwareRevision[2]==0x3445 &&
; 393  :         pDev->IdentifyData.FirmwareRevision[3]==0x3238 ||
; 394  : 
; 395  :         pDev->IdentifyData.FirmwareRevision[0]==0x3235 &&
; 396  :         pDev->IdentifyData.FirmwareRevision[1]==0x2E32 &&
; 397  :         pDev->IdentifyData.FirmwareRevision[2]==0x3648 &&
; 398  :         pDev->IdentifyData.FirmwareRevision[3]==0x3335 ||
; 399  : 
; 400  :         pDev->IdentifyData.FirmwareRevision[0]==0x3236 &&
; 401  :         pDev->IdentifyData.FirmwareRevision[1]==0x2E32 &&
; 402  :         pDev->IdentifyData.FirmwareRevision[2]==0x37A4 &&
; 403  :         pDev->IdentifyData.FirmwareRevision[3]==0x3338 ||
; 404  : 
; 405  :         pDev->IdentifyData.FirmwareRevision[0]==0x3237 &&
; 406  :         pDev->IdentifyData.FirmwareRevision[1]==0x2E32 &&
; 407  :         pDev->IdentifyData.FirmwareRevision[2]==0x3543 &&
; 408  :         pDev->IdentifyData.FirmwareRevision[3]==0x3338 ||
; 409  : 
; 410  :         pDev->IdentifyData.FirmwareRevision[0]==0x3237 &&
; 411  :         pDev->IdentifyData.FirmwareRevision[1]==0x2E32 &&
; 412  :         pDev->IdentifyData.FirmwareRevision[2]==0x3543 &&
; 413  :         pDev->IdentifyData.FirmwareRevision[3]==0x3339 )
; 414  : 
; 415  :      &&(!IdeChannel->Devices[0].DevicePresent ||
; 416  :         !IdeChannel->Devices[1].DevicePresent))

  00340	66 8b 48 42	 mov	 cx, WORD PTR [eax+66]
  00344	66 81 f9 34 31	 cmp	 cx, 12596		; 00003134H
  00349	75 18		 jne	 SHORT $L1989
  0034b	66 81 78 44 30
	2e		 cmp	 WORD PTR [eax+68], 11824 ; 00002e30H
  00351	75 10		 jne	 SHORT $L1989
  00353	66 81 78 46 45
	34		 cmp	 WORD PTR [eax+70], 13381 ; 00003445H
  00359	75 08		 jne	 SHORT $L1989
  0035b	66 81 78 48 38
	32		 cmp	 WORD PTR [eax+72], 12856 ; 00003238H
  00361	74 7a		 je	 SHORT $L1988
$L1989:
  00363	66 81 f9 35 32	 cmp	 cx, 12853		; 00003235H
  00368	bf 32 2e 00 00	 mov	 edi, 11826		; 00002e32H
  0036d	75 16		 jne	 SHORT $L1990
  0036f	66 39 78 44	 cmp	 WORD PTR [eax+68], di
  00373	75 10		 jne	 SHORT $L1990
  00375	66 81 78 46 48
	36		 cmp	 WORD PTR [eax+70], 13896 ; 00003648H
  0037b	75 08		 jne	 SHORT $L1990
  0037d	66 81 78 48 35
	33		 cmp	 WORD PTR [eax+72], 13109 ; 00003335H
  00383	74 58		 je	 SHORT $L1988
$L1990:
  00385	66 81 f9 36 32	 cmp	 cx, 12854		; 00003236H
  0038a	75 16		 jne	 SHORT $L1991
  0038c	66 39 78 44	 cmp	 WORD PTR [eax+68], di
  00390	75 10		 jne	 SHORT $L1991
  00392	66 81 78 46 a4
	37		 cmp	 WORD PTR [eax+70], 14244 ; 000037a4H
  00398	75 08		 jne	 SHORT $L1991
  0039a	66 81 78 48 38
	33		 cmp	 WORD PTR [eax+72], 13112 ; 00003338H
  003a0	74 3b		 je	 SHORT $L1988
$L1991:
  003a2	66 81 f9 37 32	 cmp	 cx, 12855		; 00003237H
  003a7	ba 43 35 00 00	 mov	 edx, 13635		; 00003543H
  003ac	75 40		 jne	 SHORT $L1987
  003ae	66 39 78 44	 cmp	 WORD PTR [eax+68], di
  003b2	75 0e		 jne	 SHORT $L1992
  003b4	66 39 50 46	 cmp	 WORD PTR [eax+70], dx
  003b8	75 08		 jne	 SHORT $L1992
  003ba	66 81 78 48 38
	33		 cmp	 WORD PTR [eax+72], 13112 ; 00003338H
  003c0	74 1b		 je	 SHORT $L1988
$L1992:
  003c2	66 81 f9 37 32	 cmp	 cx, 12855		; 00003237H
  003c7	75 25		 jne	 SHORT $L1987
  003c9	66 39 78 44	 cmp	 WORD PTR [eax+68], di
  003cd	75 1f		 jne	 SHORT $L1987
  003cf	66 39 50 46	 cmp	 WORD PTR [eax+70], dx
  003d3	75 19		 jne	 SHORT $L1987
  003d5	66 81 78 48 39
	33		 cmp	 WORD PTR [eax+72], 13113 ; 00003339H
  003db	75 11		 jne	 SHORT $L1987
$L1988:
  003dd	8a 43 44	 mov	 al, BYTE PTR [ebx+68]
  003e0	84 c0		 test	 al, al
  003e2	74 12		 je	 SHORT $L1993
  003e4	8a 83 58 02 00
	00		 mov	 al, BYTE PTR [ebx+600]
  003ea	84 c0		 test	 al, al

; 417  :         return TRUE;

  003ec	74 08		 je	 SHORT $L1993
$L1987:
  003ee	5f		 pop	 edi

; 418  :     else
; 419  :         return FALSE;

  003ef	32 c0		 xor	 al, al
  003f1	5b		 pop	 ebx

; 420  : }

  003f2	5d		 pop	 ebp
  003f3	c2 08 00	 ret	 8
$L1993:
  003f6	5f		 pop	 edi

; 370  :         return TRUE;

  003f7	b0 01		 mov	 al, 1
  003f9	5b		 pop	 ebx

; 420  : }

  003fa	5d		 pop	 ebp
  003fb	c2 08 00	 ret	 8
_Hpt366WdCanUseDma@8 ENDP
_TEXT	ENDS
PUBLIC	_ScanHpt366@12
EXTRN	_ScsiPortReadPortUshort@4:NEAR
EXTRN	_ScsiPortReadPortUlong@4:NEAR
EXTRN	_AtapiCallBack@4:NEAR
EXTRN	_AtapiCallBack2@4:NEAR
EXTRN	_ScsiPortWritePortUshort@8:NEAR
_TEXT	SEGMENT
_FirstChannel$ = 8
_BasePort$ = 16
_pci1_cfg$ = 8
_i$ = -4
_j$ = 16
_k$ = -8
_bus$ = -8
_ScanHpt366@12 PROC NEAR

; 443  : {

  00400	55		 push	 ebp
  00401	8b ec		 mov	 ebp, esp
  00403	83 ec 08	 sub	 esp, 8

; 444  : 	 PIDE_Channel SecondChannel = &FirstChannel[1];
; 445  :     PCI1_CFG_ADDR pci1_cfg = {0,};

  00406	66 33 c0	 xor	 ax, ax
  00409	53		 push	 ebx
  0040a	33 c9		 xor	 ecx, ecx
  0040c	56		 push	 esi
  0040d	8b 75 08	 mov	 esi, DWORD PTR _FirstChannel$[ebp]

; 446  :     ULONG  i, j, k, IoPort, bus;
; 447  :     ULONG signature;
; 448  : 
; 449  : 
; 450  :     pci1_cfg.enable = 1;

  00410	80 cc 80	 or	 ah, -128		; ffffff80H
  00413	57		 push	 edi
  00414	66 89 4d 08	 mov	 WORD PTR _pci1_cfg$[ebp], cx
  00418	66 89 45 0a	 mov	 WORD PTR _pci1_cfg$[ebp+2], ax

; 451  : 
; 452  :     for(bus=0;bus<4;bus++)

  0041c	8b 7d 08	 mov	 edi, DWORD PTR _pci1_cfg$[ebp]
  0041f	89 4d f8	 mov	 DWORD PTR _bus$[ebp], ecx
$L2010:

; 453  :     for(i = 0; i < MAX_PCI_DEVICE_NUMBER; i++) {

  00422	33 db		 xor	 ebx, ebx
  00424	89 5d fc	 mov	 DWORD PTR _i$[ebp], ebx
$L2013:

; 454  :         pci1_cfg.dev_num = i;
; 455  : 		  pci1_cfg.reg_num = 0;
; 456  : 		  pci1_cfg.bus_num = bus;

  00427	8a 4d f8	 mov	 cl, BYTE PTR _bus$[ebp]

; 467  : 		  	  goto find_channel;
; 468  :     }
; 469  :     return (0);

  0042a	8b c3		 mov	 eax, ebx
  0042c	81 e7 00 07 00
	00		 and	 edi, 1792		; 00000700H
  00432	c1 e0 0b	 shl	 eax, 11			; 0000000bH
  00435	0b f8		 or	 edi, eax
  00437	8a 45 0a	 mov	 al, BYTE PTR _pci1_cfg$[ebp+2]
  0043a	32 c8		 xor	 cl, al
  0043c	66 89 7d 08	 mov	 WORD PTR _pci1_cfg$[ebp], di
  00440	81 e1 ff 00 00
	00		 and	 ecx, 255		; 000000ffH
  00446	66 31 4d 0a	 xor	 WORD PTR _pci1_cfg$[ebp+2], cx
  0044a	8b 7d 08	 mov	 edi, DWORD PTR _pci1_cfg$[ebp]
  0044d	57		 push	 edi
  0044e	68 f8 0c 00 00	 push	 3320			; 00000cf8H
  00453	e8 00 00 00 00	 call	 _ScsiPortWritePortUlong@8
  00458	68 fc 0c 00 00	 push	 3324			; 00000cfcH
  0045d	e8 00 00 00 00	 call	 _ScsiPortReadPortUlong@4
  00462	3d 03 11 04 00	 cmp	 eax, 266499		; 00041103H
  00467	75 34		 jne	 SHORT $L2014
  00469	81 e7 10 ff 00
	00		 and	 edi, 65296		; 0000ff10H
  0046f	83 cf 10	 or	 edi, 16			; 00000010H
  00472	66 89 7d 08	 mov	 WORD PTR _pci1_cfg$[ebp], di
  00476	8b 7d 08	 mov	 edi, DWORD PTR _pci1_cfg$[ebp]
  00479	57		 push	 edi
  0047a	68 f8 0c 00 00	 push	 3320			; 00000cf8H
  0047f	e8 00 00 00 00	 call	 _ScsiPortWritePortUlong@8
  00484	68 fc 0c 00 00	 push	 3324			; 00000cfcH
  00489	e8 00 00 00 00	 call	 _ScsiPortReadPortUlong@4
  0048e	8b d8		 mov	 ebx, eax
  00490	8b 45 10	 mov	 eax, DWORD PTR _BasePort$[ebp]
  00493	83 e3 fe	 and	 ebx, -2			; fffffffeH
  00496	3b d8		 cmp	 ebx, eax
  00498	74 27		 je	 SHORT $find_channel$2024

; 457  :         ScsiPortWritePortUlong((PULONG)0xCF8, *((PULONG)&pci1_cfg));
; 458  :         signature = ScsiPortReadPortUlong((PULONG)0xCFC);
; 459  : 
; 460  :         if (signature != SIGNATURE_366)
; 461  : 			  continue;
; 462  : 
; 463  : 		  pci1_cfg.reg_num = REG_IOPORT0;
; 464  : 		  ScsiPortWritePortUlong((PULONG)0xCF8, *((PULONG)&pci1_cfg));
; 465  : 		  IoPort = ScsiPortReadPortUlong((PULONG)0xCFC) & ~1;
; 466  : 		  if(IoPort == BasePort)

  0049a	8b 5d fc	 mov	 ebx, DWORD PTR _i$[ebp]
$L2014:

; 453  :     for(i = 0; i < MAX_PCI_DEVICE_NUMBER; i++) {

  0049d	43		 inc	 ebx
  0049e	83 fb 20	 cmp	 ebx, 32			; 00000020H
  004a1	89 5d fc	 mov	 DWORD PTR _i$[ebp], ebx
  004a4	72 81		 jb	 SHORT $L2013
  004a6	8b 45 f8	 mov	 eax, DWORD PTR _bus$[ebp]
  004a9	40		 inc	 eax
  004aa	83 f8 04	 cmp	 eax, 4
  004ad	89 45 f8	 mov	 DWORD PTR _bus$[ebp], eax
  004b0	0f 82 6c ff ff
	ff		 jb	 $L2010
  004b6	5f		 pop	 edi
  004b7	5e		 pop	 esi

; 467  : 		  	  goto find_channel;
; 468  :     }
; 469  :     return (0);

  004b8	33 c0		 xor	 eax, eax
  004ba	5b		 pop	 ebx

; 596  : }

  004bb	8b e5		 mov	 esp, ebp
  004bd	5d		 pop	 ebp
  004be	c2 0c 00	 ret	 12			; 0000000cH
$find_channel$2024:

; 470  : 
; 471  : find_channel:
; 472  :     pci1_cfg.reg_num = 0x3C;

  004c1	81 e7 3c ff 00
	00		 and	 edi, 65340		; 0000ff3cH
  004c7	83 cf 3c	 or	 edi, 60			; 0000003cH
  004ca	66 89 7d 08	 mov	 WORD PTR _pci1_cfg$[ebp], di

; 473  :     ScsiPortWritePortUlong((PULONG)0xCF8, *((PULONG)&pci1_cfg));

  004ce	8b 7d 08	 mov	 edi, DWORD PTR _pci1_cfg$[ebp]
  004d1	57		 push	 edi
  004d2	68 f8 0c 00 00	 push	 3320			; 00000cf8H
  004d7	e8 00 00 00 00	 call	 _ScsiPortWritePortUlong@8

; 474  :     FirstChannel->InterruptLevel = ScsiPortReadPortUchar((PUCHAR)0xCFC);

  004dc	68 fc 0c 00 00	 push	 3324			; 00000cfcH
  004e1	e8 00 00 00 00	 call	 _ScsiPortReadPortUchar@4

; 475  : 
; 476  :     FirstChannel->BaseIoAddress1 = (PIDE_REGISTERS_1)IoPort;
; 477  : 
; 478  : 	 pci1_cfg.reg_num = REG_IOPORT0 + 8;

  004e6	81 e7 18 ff 00
	00		 and	 edi, 65304		; 0000ff18H
  004ec	25 ff 00 00 00	 and	 eax, 255		; 000000ffH
  004f1	83 cf 18	 or	 edi, 24			; 00000018H
  004f4	89 46 1c	 mov	 DWORD PTR [esi+28], eax
  004f7	66 89 7d 08	 mov	 WORD PTR _pci1_cfg$[ebp], di

; 479  : 	 ScsiPortWritePortUlong((PULONG)0xCF8, *((PULONG)&pci1_cfg));

  004fb	8b 7d 08	 mov	 edi, DWORD PTR _pci1_cfg$[ebp]
  004fe	57		 push	 edi
  004ff	68 f8 0c 00 00	 push	 3320			; 00000cf8H
  00504	89 5e 10	 mov	 DWORD PTR [esi+16], ebx
  00507	e8 00 00 00 00	 call	 _ScsiPortWritePortUlong@8

; 480  : 	 IoPort = ScsiPortReadPortUlong((PULONG)0xCFC) & ~1;

  0050c	68 fc 0c 00 00	 push	 3324			; 00000cfcH
  00511	e8 00 00 00 00	 call	 _ScsiPortReadPortUlong@4

; 481  :     SecondChannel->BaseIoAddress1 = (PIDE_REGISTERS_1)IoPort;
; 482  : 	
; 483  :     pci1_cfg.reg_num = REG_IOPORT1;

  00516	81 e7 14 ff 00
	00		 and	 edi, 65300		; 0000ff14H
  0051c	24 fe		 and	 al, -2			; fffffffeH
  0051e	83 cf 14	 or	 edi, 20			; 00000014H
  00521	89 86 8c 04 00
	00		 mov	 DWORD PTR [esi+1164], eax
  00527	66 89 7d 08	 mov	 WORD PTR _pci1_cfg$[ebp], di

; 484  :     ScsiPortWritePortUlong((PULONG)0xCF8, *((PULONG)&pci1_cfg));

  0052b	8b 7d 08	 mov	 edi, DWORD PTR _pci1_cfg$[ebp]
  0052e	57		 push	 edi
  0052f	68 f8 0c 00 00	 push	 3320			; 00000cf8H
  00534	e8 00 00 00 00	 call	 _ScsiPortWritePortUlong@8

; 485  :     IoPort = (ScsiPortReadPortUlong((PULONG)0xCFC) & ~1);

  00539	68 fc 0c 00 00	 push	 3324			; 00000cfcH
  0053e	e8 00 00 00 00	 call	 _ScsiPortReadPortUlong@4

; 486  :     FirstChannel->BaseIoAddress2 = (PIDE_REGISTERS_2)(IoPort + 2);
; 487  :       
; 488  :     pci1_cfg.reg_num = REG_IOPORT1 + 8;

  00543	81 e7 1c ff 00
	00		 and	 edi, 65308		; 0000ff1cH
  00549	24 fe		 and	 al, -2			; fffffffeH
  0054b	83 cf 1c	 or	 edi, 28			; 0000001cH
  0054e	83 c0 02	 add	 eax, 2
  00551	66 89 7d 08	 mov	 WORD PTR _pci1_cfg$[ebp], di

; 489  :     ScsiPortWritePortUlong((PULONG)0xCF8, *((PULONG)&pci1_cfg));

  00555	8b 7d 08	 mov	 edi, DWORD PTR _pci1_cfg$[ebp]
  00558	57		 push	 edi
  00559	68 f8 0c 00 00	 push	 3320			; 00000cf8H
  0055e	89 46 14	 mov	 DWORD PTR [esi+20], eax
  00561	e8 00 00 00 00	 call	 _ScsiPortWritePortUlong@8

; 490  :     IoPort = (ScsiPortReadPortUlong((PULONG)0xCFC) & ~1);

  00566	68 fc 0c 00 00	 push	 3324			; 00000cfcH
  0056b	e8 00 00 00 00	 call	 _ScsiPortReadPortUlong@4

; 491  :     SecondChannel->BaseIoAddress2 = (PIDE_REGISTERS_2)(IoPort + 2);
; 492  :  
; 493  :     pci1_cfg.reg_num = REG_BMIBA;

  00570	81 e7 20 ff 00
	00		 and	 edi, 65312		; 0000ff20H
  00576	24 fe		 and	 al, -2			; fffffffeH
  00578	83 cf 20	 or	 edi, 32			; 00000020H
  0057b	83 c0 02	 add	 eax, 2
  0057e	66 89 7d 08	 mov	 WORD PTR _pci1_cfg$[ebp], di

; 494  :     ScsiPortWritePortUlong((PULONG)0xCF8, *((PULONG)&pci1_cfg));

  00582	8b 7d 08	 mov	 edi, DWORD PTR _pci1_cfg$[ebp]
  00585	57		 push	 edi
  00586	68 f8 0c 00 00	 push	 3320			; 00000cf8H
  0058b	89 86 90 04 00
	00		 mov	 DWORD PTR [esi+1168], eax
  00591	e8 00 00 00 00	 call	 _ScsiPortWritePortUlong@8

; 495  : 	 IoPort = ScsiPortReadPortUlong((PULONG)0xCFC) & ~1;

  00596	68 fc 0c 00 00	 push	 3324			; 00000cfcH
  0059b	e8 00 00 00 00	 call	 _ScsiPortReadPortUlong@4
  005a0	8b d8		 mov	 ebx, eax

; 496  :     FirstChannel->BMI = (PUCHAR)IoPort;
; 497  : 
; 498  : 	 SecondChannel->BMI = (PUCHAR)(IoPort + 8);
; 499  : 
; 500  : 	 FirstChannel->HwDeviceExtension = (PHW_DEVICE_EXTENSION)FirstChannel;
; 501  : 	 FirstChannel->CallBack = AtapiCallBack;

⌨️ 快捷键说明

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