📄 diskmain.cod
字号:
; File c:\wince500\platform\bvdmain\drivers\atapi\diskmain.cpp
00000 AREA |.text| { |?ResetController@CDisk@@QAAHH@Z| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |?ResetController@CDisk@@QAAHH@Z| PROC ; CDisk::ResetController
; 174 : {
00000 |$L33653|
00000 e92d4030 stmdb sp!, {r4, r5, lr}
00004 |$M33651|
00004 e1a04001 mov r4, r1
00008 e1a05000 mov r5, r0
; 175 : DWORD dwAttempts;
; 176 : BYTE bStatus;
; 177 :
; 178 :
; 179 : DEBUGMSG(ZONE_INIT, (TEXT("ATAPI:ResetController entered\r\n")));
; 180 :
; 181 :
; 182 : // WriteAltDriveController( 0x8);
; 183 : // Read the status first
; 184 : bStatus = GetBaseStatus();
0000c e59f0118 ldr r0, [pc, #0x118]
00010 eb000000 bl READ_PORT_UCHAR
; 185 : // DEBUGMSG(ZONE_INIT, (TEXT("ATADISK:ResetController - ATA_STATUS = %02X Error=%x!\r\n"), bStatus, GetError()));
; 186 :
; 187 : //
; 188 : // We select the secondary device , that way we will get a response through the shadow
; 189 : // if only the master is connected. Otherwise we will get a response from
; 190 : // the secondary device
; 191 : //
; 192 :
; 193 : WriteAltDriveController(ATA_CTRL_RESET | ATA_CTRL_DISABLE_INTR);
00014 e59f0118 ldr r0, [pc, #0x118]
00018 e3a01006 mov r1, #6
0001c eb000000 bl WRITE_PORT_UCHAR
; 194 :
; 195 : WaitForDisc( WAIT_TYPE_BUSY, 500);
00020 e3a03000 mov r3, #0
00024 e3a02f7d mov r2, #0x7D, 30
00028 e3a01001 mov r1, #1
0002c e1a00005 mov r0, r5
00030 eb000000 bl |?WaitForDisc@CDisk@@QAAHEKK@Z|
; 196 :
; 197 : WriteAltDriveController(ATA_CTRL_DISABLE_INTR);
00034 e59f00f8 ldr r0, [pc, #0xF8]
00038 e3a01002 mov r1, #2
0003c eb000000 bl WRITE_PORT_UCHAR
; 198 :
; 199 : WaitForDisc( WAIT_TYPE_READY, 400);
00040 e3a03000 mov r3, #0
00044 e3a02e19 mov r2, #0x19, 28
00048 e3a01003 mov r1, #3
0004c e1a00005 mov r0, r5
00050 eb000000 bl |?WaitForDisc@CDisk@@QAAHEKK@Z|
; 200 :
; 201 : if (bSoftReset) {
00054 e3540000 cmp r4, #0
00058 0a000002 beq |$L32832|
; 202 : DEBUGMSG( ZONE_INIT, (TEXT("ATAPI:ResetController ...performing soft reset !\r\n")));
; 203 : AtapiSoftReset();
0005c e1a00005 mov r0, r5
00060 eb000000 bl |?AtapiSoftReset@CDisk@@QAAXXZ|
; 204 : } else {
00064 ea000008 b |$L33623|
00068 |$L32832|
; 205 : StallExecution(5000);
00068 e5953004 ldr r3, [r5, #4]
0006c e3130301 tst r3, #1, 6
00070 0a000002 beq |$L33622|
00074 e3a00032 mov r0, #0x32
00078 eb000000 bl Sleep
0007c ea000002 b |$L33623|
00080 |$L33622|
00080 e3a00cc3 mov r0, #0xC3, 24
00084 e3800050 orr r0, r0, #0x50
00088 eb000000 bl StallExecution
0008c |$L33623|
; 206 : }
; 207 :
; 208 : for (dwAttempts = 0; dwAttempts < MAX_RESET_ATTEMPTS; dwAttempts++)
0008c e3a04000 mov r4, #0
00090 |$L32835|
; 209 : {
; 210 : bStatus = GetBaseStatus();
00090 e59f0094 ldr r0, [pc, #0x94]
00094 eb000000 bl READ_PORT_UCHAR
; 211 :
; 212 : if ((bStatus != ATA_STATUS_IDLE) && (bStatus != 0x0))
00098 e3500050 cmp r0, #0x50
0009c 0a00001a beq |$L32841|
000a0 e3500000 cmp r0, #0
000a4 0a000018 beq |$L32841|
; 213 : {
; 214 : DEBUGMSG( ZONE_INIT, (TEXT("ATAPI::ResetController: Current drive status = 0x%2.2X\r\n"), bStatus));
; 215 :
; 216 : if (bStatus == 0xFF)
000a8 e35000ff cmp r0, #0xFF
000ac 1a00000a bne |$L32843|
; 217 : {
; 218 : SetDriveHead( ATA_HEAD_DRIVE_2);
000b0 e59f0078 ldr r0, [pc, #0x78]
000b4 e3a010b0 mov r1, #0xB0
000b8 eb000000 bl WRITE_PORT_UCHAR
; 219 :
; 220 : bStatus = GetBaseStatus();
000bc e59f0068 ldr r0, [pc, #0x68]
000c0 eb000000 bl READ_PORT_UCHAR
; 221 :
; 222 : if ((bStatus != ATA_STATUS_IDLE) && (bStatus != 0x0))
000c4 e3500050 cmp r0, #0x50
000c8 0a00000f beq |$L32841|
000cc e3500000 cmp r0, #0
000d0 0a00000d beq |$L32841|
; 223 : {
; 224 : DEBUGMSG(ZONE_INIT, (TEXT("ATAPI::ResetController Drive 2 status = 0x%2.2X\r\n"), bStatus));
; 225 :
; 226 : if (bStatus == 0xFF)
000d4 e35000ff cmp r0, #0xFF
000d8 0a00000d beq |$L33642|
000dc |$L32843|
; 227 : {
; 228 : DEBUGMSG(ZONE_INIT, (TEXT("ATAPI::ResetController no second device\r\n")));
; 229 : return FALSE;
; 230 : }
; 231 : }
; 232 : else
; 233 : {
; 234 : break;
; 235 : }
; 236 : }
; 237 : StallExecution(5000);
000dc e5953004 ldr r3, [r5, #4]
000e0 e3130301 tst r3, #1, 6
000e4 0a000002 beq |$L33638|
000e8 e3a00032 mov r0, #0x32
000ec eb000000 bl Sleep
000f0 ea000002 b |$L32836|
000f4 |$L33638|
000f4 e3a00cc3 mov r0, #0xC3, 24
000f8 e3800050 orr r0, r0, #0x50
000fc eb000000 bl StallExecution
00100 |$L32836|
00100 e2844001 add r4, r4, #1
00104 e354000a cmp r4, #0xA
00108 3affffe0 bcc |$L32835|
0010c |$L32841|
; 238 : } else {
; 239 : break;
; 240 : }
; 241 : }
; 242 : if (dwAttempts == MAX_RESET_ATTEMPTS)
0010c e354000a cmp r4, #0xA
00110 1a000002 bne |$L32847|
00114 |$L33642|
; 243 : {
; 244 : DEBUGMSG( ZONE_INIT, (TEXT("ATAPIPCI:AtaResetController no response after %ld reset attempts\r\n"), MAX_RESET_ATTEMPTS));
; 245 : return FALSE;
00114 e3a00000 mov r0, #0
; 249 : }
00118 e8bd4030 ldmia sp!, {r4, r5, lr}
0011c e12fff1e bx lr
00120 |$L32847|
; 246 : }
; 247 : DEBUGMSG( ZONE_INIT, (TEXT("ATAPI:ResetController: Controller reset done\r\n")));
; 248 : return TRUE;
00120 e3a00001 mov r0, #1
; 249 : }
00124 e8bd4030 ldmia sp!, {r4, r5, lr}
00128 e12fff1e bx lr
0012c |$L33656|
0012c b6a000e0 DCD 0xb6a000e0
00130 b6a000c0 DCD 0xb6a000c0
00134 b6b000c0 DCD 0xb6b000c0
00138 |$M33652|
ENDP ; |?ResetController@CDisk@@QAAHH@Z|, CDisk::ResetController
EXPORT |?AnalyzeDeviceCapabilities@CDisk@@QAAXXZ| ; CDisk::AnalyzeDeviceCapabilities
00000 AREA |.text| { |?AnalyzeDeviceCapabilities@CDisk@@QAAXXZ| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$?AnalyzeDeviceCapabilities@CDisk@@QAAXXZ|, PDATA, SELECTION=5, ASSOC=|.text| { |?AnalyzeDeviceCapabilities@CDisk@@QAAXXZ| } ; comdat associative
|$T33674| DCD |$L33673|
DCD 0x4000ae01
; Function compile flags: /Ogsy
00000 AREA |.text| { |?AnalyzeDeviceCapabilities@CDisk@@QAAXXZ| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |?AnalyzeDeviceCapabilities@CDisk@@QAAXXZ| PROC ; CDisk::AnalyzeDeviceCapabilities
; 447 : {
00000 |$L33673|
00000 e92d41f0 stmdb sp!, {r4 - r8, lr}
00004 |$M33671|
; 448 :
; 449 : DWORD dwCycleTime;
; 450 : DWORD dwXferMode;
; 451 : DWORD dwBestXferMode;
; 452 : DWORD dwCurrentMode;
; 453 : BOOL fIoReadyEnabled;
; 454 :
; 455 : //
; 456 : // Figure out who can do DMA and who cannot
; 457 : //
; 458 :
; 459 : if (m_dwDeviceFlags & DFLAGS_DEVICE_PRESENT) {
00004 e5903004 ldr r3, [r0, #4]
00008 e3130001 tst r3, #1
0000c 0a0000a7 beq |$L32918|
; 460 :
; 461 : //
; 462 : // check LBA capabilities
; 463 : //
; 464 : //CLRMASK (m_dwDeviceFlags, DFLAGS_LBA);
; 465 :
; 466 : dwXferMode = 0;
; 467 : dwCycleTime = UNINITIALIZED_CYCLE_TIME;
; 468 : dwBestXferMode = 0;
; 469 :
; 470 : //
; 471 : // check for IoReady Line
; 472 : //
; 473 : if (m_Id.Capabilities & IDENTIFY_CAPABILITIES_IOREADY_SUPPORTED) {
00010 e5d024a6 ldrb r2, [r0, #0x4A6]
00014 e5d034a7 ldrb r3, [r0, #0x4A7]
00018 e1823403 orr r3, r2, r3, lsl #8
; 474 :
; 475 : fIoReadyEnabled = TRUE;
; 476 :
; 477 : } else {
; 478 :
; 479 : fIoReadyEnabled = FALSE;
; 480 : }
; 481 :
; 482 : //
; 483 : // Check for PIO mode
; 484 : //
; 485 : if ((m_Id.MinimumPIOxferTimeWOFlow & 0x00ff) == 2) {
0001c e5d024ca ldrb r2, [r0, #0x4CA]
00020 e3130b02 tst r3, #2, 22
00024 e5d034cb ldrb r3, [r0, #0x4CB]
00028 13a05001 movne r5, #1
0002c 03a05000 moveq r5, #0
00030 e1826403 orr r6, r2, r3, lsl #8
00034 e1a03806 mov r3, r6, lsl #16
00038 e1a03823 mov r3, r3, lsr #16
0003c e20330ff and r3, r3, #0xFF
00040 e3530002 cmp r3, #2
; 486 :
; 487 : dwCycleTime = PIO_MODE2_CYCLE_TIME;
00044 03a040f0 moveq r4, #0xF0
; 488 : dwXferMode |= PIO_MODE2 | PIO_MODE1 | PIO_MODE0;
00048 03a01007 moveq r1, #7
; 489 : dwBestXferMode = 2;
0004c 03a0e002 moveq lr, #2
00050 0a000007 beq |$L32924|
; 490 : dwCurrentMode = PIO_MODE2;
; 491 :
; 492 : } else if ((m_Id.MinimumPIOxferTimeWOFlow & 0x00ff) == 1) {
00054 e3530001 cmp r3, #1
; 493 :
; 494 : dwCycleTime = PIO_MODE1_CYCLE_TIME;
00058 03a04f5f moveq r4, #0x5F, 30
; 495 : dwXferMode |= PIO_MODE1 | PIO_MODE0;
; 496 : dwBestXferMode = 1;
0005c 03a0e001 moveq lr, #1
00060 03844003 orreq r4, r4, #3
00064 03a01003 moveq r1, #3
; 497 : dwCurrentMode = PIO_MODE1;
; 498 :
; 499 : } else {
; 500 :
; 501 : dwCycleTime = PIO_MODE0_CYCLE_TIME;
00068 13a04f96 movne r4, #0x96, 30
; 502 : dwXferMode |= PIO_MODE0;
0006c 13a01001 movne r1, #1
; 503 : dwBestXferMode = 0;
00070 13a0e000 movne lr, #0
00074 |$L32924|
; 504 : dwCurrentMode = PIO_MODE0;
; 505 : }
; 506 :
; 507 : DEBUGMSG( ZONE_INIT, (TEXT("ATAPI:AnalyzeDeviceCapabilities target %d IdentifyData PioCycleTimingMode (highest pio mode) = 0x%x\r\n"),
; 508 : m_dwDevice,
; 509 : m_Id.MinimumPIOxferTimeWOFlow));
; 510 :
; 511 : if (m_Id.TranslationFieldsValid & (1 << 1)) {
00074 e5d024ae ldrb r2, [r0, #0x4AE]
00078 e5d034af ldrb r3, [r0, #0x4AF]
0007c e1828403 orr r8, r2, r3, lsl #8
00080 e1a03808 mov r3, r8, lsl #16
00084 e1a03823 mov r3, r3, lsr #16
00088 e2137002 ands r7, r3, #2
0008c 0a00000b beq |$L32930|
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -