00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include <string.h>
00035
00036 #include <arch/i386.h>
00037 #include <arch/interrupt.h>
00038 #include <arch/mem.h>
00039
00040 #include <kernel/clock.h>
00041 #include <kernel/IdeTimer.h>
00042 #include <kernel/IdeDebug.h>
00043 #include <kernel/IdeLow.h>
00044 #include <kernel/video.h>
00045 #include <kernel/IdeAta.h>
00046 #include <kernel/keyboard.h>
00047
00048 #include <kernel/Ide.h>
00049
00050 extern IdeChannel_Struct * CurrentChannel;
00051
00052
00053
00054
00055
00056 void ShowDeviceSubData(int Dev)
00057 {
00058
00059 Device_Struct * CurDev=&CurrentChannel->Device[Dev];
00060
00061 if ( CurDev->Type==CC_DEVTYPE_ATA )
00062 {
00063 kprintf("\n\rDevice %d: %s",Dev, CurDev->Info.ModelNumber);
00064 kprintf("\n\r Type: ATA %d - UDMA %d",
00065 CurDev->Info.HighestAtaSupported,
00066 CurDev->Info.HighestUDMASupported);
00067 kprintf("\n\r Firmware Rev: %s", CurDev->Info.FirmwareRev);
00068 kprintf("\n\r SerialNumber: %s", CurDev->Info.SerialNumber);
00069 kprintf("\n\r Capacity: %i MB",CurDev->Info.CapacityLba / 2 / 1024);
00070 }
00071 else if ( CurDev->Type==CC_DEVTYPE_NONE )
00072 kprintf("\n\rDevice %d NOT FOUND",Dev);
00073 else if ( CurDev->Type==CC_DEVTYPE_ATAPI )
00074 kprintf("\n\rDevice %d FOUND Type: ATAPI",Dev);
00075 else
00076 kprintf("\n\rDevice %d FOUND Type: UNKNOW",Dev);
00077 }
00078
00079 void ShowIdeSubData()
00080 {
00081 SelectAtaChannel(CC_PRIMARY);
00082 kprintf("\n\rPRIMARY CHANNEL");
00083 ShowDeviceSubData(CC_DEV0);
00084 ShowDeviceSubData(CC_DEV1);
00085 kprintf("\n\r");
00086 SelectAtaChannel(CC_SECONDARY);
00087 kprintf("\n\rSECONDARY CHANNEL");
00088 ShowDeviceSubData(CC_DEV0);
00089 ShowDeviceSubData(CC_DEV1);
00090 }
00091
00092
00093
00094
00095
00096
00097
00098 int ScanDevice(int UseInterrupt)
00099 {
00100 byte DevCtrl;
00101 int Err=FALSE;
00102
00103
00104 DevCtrl= HDC_DEVC_HD15 | ( UseInterrupt ? 0 : HDC_DEVC_NIEN );
00105
00106
00107 OutPortAta(CC_DEVC,DevCtrl);
00108
00109
00110
00111 IdeDeviceDetection(CC_DEV0);
00112 IdeDeviceDetection(CC_DEV1);
00113
00114
00115 SetDevBit(CC_DEV0);
00116
00117
00118
00119 Err=IdeSoftReset( FALSE, UseInterrupt );
00120
00121
00122
00123
00124 IdeDeviceTypeDetection(CC_DEV0);
00125 IdeDeviceTypeDetection(CC_DEV1);
00126
00127
00128 SetFirstDevBit();
00129
00130
00131
00132
00133 return Err;
00134
00135 }
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145 int IdentifyDevice (int Dev)
00146 {
00147 int i;
00148 word Buffer[256];
00149 word * Tmp;
00150 int Err=0;
00151 DeviceInfo_Struct * TmpDev=(DeviceInfo_Struct *) &(CurrentChannel->Device[Dev].Info);
00152
00153
00154
00155
00156 memsetw( &Buffer, 0, 256);
00157
00158
00159 Err = IdePioDataInLba(Dev, HDC_CMD_IDENTIFY_DEVICE, 0, 0, 0L, (word *) &Buffer , 1, 0, TRUE);
00160 if ( Err )
00161 return Err;
00162
00163
00164
00165
00166 TmpDev->Ata =(byte) GETBITW(Buffer[0],15);
00167 TmpDev->Removable =(byte) GETBITW(Buffer[0],7);
00168 TmpDev->NotRemovable =(byte) GETBITW(Buffer[0],6);
00169 TmpDev->LogicalCylinders =(word) Buffer[1];
00170 TmpDev->LogicalHeads =(word) Buffer[3];
00171 TmpDev->LogicalSectorsPerTrack=(word) Buffer[6];
00172
00173 Tmp=(word *) &(TmpDev->SerialNumber);
00174 for (i=10;i<=19;i++)
00175 {
00176 *Tmp=SWAPBYTEW(Buffer[i]);
00177 Tmp++;
00178 }
00179 TmpDev->SerialNumber[21]='\0';
00180
00181
00182 Tmp=(word *) &(TmpDev->FirmwareRev);
00183 for (i=23;i<=26;i++)
00184 {
00185 *Tmp=SWAPBYTEW(Buffer[i]);
00186 Tmp++;
00187 }
00188 TmpDev->FirmwareRev[9]='\0';
00189
00190 Tmp=(word *) &(TmpDev->ModelNumber);
00191 for (i=27;i<=46;i++)
00192 {
00193 *Tmp=SWAPBYTEW(Buffer[i]);
00194 Tmp++;
00195 }
00196 TmpDev->ModelNumber[41]='\0';
00197
00198 TmpDev->MaxMulitSectPerBlock = (byte) GETBYTEW(Buffer[47],0);
00199 TmpDev->StandByTimerSupport = (byte) GETBITW(Buffer[49],13);
00200 TmpDev->IORDYSupport = (byte) GETBITW(Buffer[49],11);
00201 TmpDev->IORDYDisabled = (byte) GETBITW(Buffer[49],10);
00202 TmpDev->PioMode = (byte) GETBYTEW(Buffer[51],1);
00203 TmpDev->ValidUDMAMode = (byte) GETBITW(Buffer[53],2);
00204 TmpDev->ValidCycleTime = (byte) GETBITW(Buffer[53],1);
00205 TmpDev->ValidCurLogicalValue= (byte) GETBITW(Buffer[53],0);
00206 TmpDev->CurLogicalCylinders = (word) Buffer[54];
00207 TmpDev->CurLogicalHeads = (word) Buffer[55];
00208 TmpDev->CurLogicalSectorsPerTrack = (word) Buffer[56];
00209 TmpDev->CapacityInSectors = (dword) MAKEDWORDW(Buffer[58],Buffer[57]);
00210 TmpDev->ValidCurMultiSectPerInt = (byte) GETBITW(Buffer[59],8);
00211 TmpDev->CurMultiSectPerInt = (byte) GETBYTEW(Buffer[59],0);
00212 TmpDev->CapacityLba = (dword) MAKEDWORDW(Buffer[61],Buffer[60]);
00213
00214 TmpDev->MultiDMASupported = ((byte) GETBYTEW(Buffer[63],1)) & 0x07;
00215 TmpDev->MultiDMASelected = ((byte) GETBYTEW(Buffer[63],0)) & 0x07;
00216
00217 TmpDev->AdvPioModeSupported = (byte) GETBYTEW(Buffer[64],0);
00218 TmpDev->MinCycleTime = (word) Buffer[65];
00219 TmpDev->RecCycleTime = (word) Buffer[66];
00220 TmpDev->MinPioCycleTime = (word) Buffer[67];
00221 TmpDev->MinPioCyleTimeFlow = (word) Buffer[68];
00222 TmpDev->QueueDepth = (byte) GETBYTEW(Buffer[75],0) & 0x1F;
00223
00224 TmpDev->AtaSupported = (word) Buffer[80];
00225
00226 i=14;
00227 while ( i>0 && (GETBITW(Buffer[80],i)==0) )
00228 i--;
00229
00230 TmpDev->HighestAtaSupported=(byte) i;
00231
00232 if ( Buffer[81]==0xFFFF )
00233 TmpDev->MinorVersion = (word) Buffer[81];
00234 else
00235 TmpDev->MinorVersion = (word) Buffer[81];
00236
00237 TmpDev->SFSNopSupported = (byte) GETBITW(Buffer[82],14);
00238 TmpDev->SFSReadBufferSupported = (byte) GETBITW(Buffer[82],13);
00239 TmpDev->SFSWriteBufferSupported = (byte) GETBITW(Buffer[82],12);
00240 TmpDev->SFSProtectedAreaSupported = (byte) GETBITW(Buffer[82],10);
00241 TmpDev->SFSDeviceResetSupported = (byte) GETBITW(Buffer[82],9);
00242 TmpDev->SFSServiceIntSupported = (byte) GETBITW(Buffer[82],8);
00243 TmpDev->SFSReleaseIntSupported = (byte) GETBITW(Buffer[82],7);
00244 TmpDev->SFSLookAheadSupported = (byte) GETBITW(Buffer[82],6);
00245 TmpDev->SFSWriteCacheSupported = (byte) GETBITW(Buffer[82],5);
00246 TmpDev->SFSPacketSupported = (byte) GETBITW(Buffer[82],4);
00247 TmpDev->SFSPowerManagSupported = (byte) GETBITW(Buffer[82],3);
00248 TmpDev->SFSRemovableMediaSupported = (byte) GETBITW(Buffer[82],2);
00249 TmpDev->SFSSecurityModeSupported = (byte) GETBITW(Buffer[82],1);
00250 TmpDev->SFSSmartSupported = (byte) GETBITW(Buffer[82],0);
00251 TmpDev->SFSRemMediaNotifSupported = (byte) GETBITW(Buffer[83],4);
00252 TmpDev->SFSAdvPowerManagSupported = (byte) GETBITW(Buffer[83],3);
00253 TmpDev->SFSCFASupported = (byte) GETBITW(Buffer[83],2);
00254 TmpDev->SFSRWDmaQueuedSupported = (byte) GETBITW(Buffer[83],1);
00255 TmpDev->SFSDownMicrocodeSupported = (byte) GETBITW(Buffer[83],1);
00256
00257 TmpDev->SFEServiceIntEnalbed = (byte) GETBITW(Buffer[85],8);
00258 TmpDev->SFEReleaseIntEnabled = (byte) GETBITW(Buffer[85],7);
00259 TmpDev->SFELookAheadEnabled = (byte) GETBITW(Buffer[85],6);
00260 TmpDev->SFEWriteCacheEnabled = (byte) GETBITW(Buffer[85],5);
00261 TmpDev->SFESecurityModeEnabled = (byte) GETBITW(Buffer[85],1);
00262 TmpDev->SFESmartEnabled = (byte) GETBITW(Buffer[85],0);
00263 TmpDev->SFERemMediaNotifEnabled = (byte) GETBITW(Buffer[86],4);
00264 TmpDev->SFEAdvPowerManagEnabled = (byte) GETBITW(Buffer[86],3);
00265
00266 TmpDev->UDMASelected = ((byte) GETBYTEW(Buffer[88],1)) & 0x3F;
00267 TmpDev->UDMASupported =((byte) GETBYTEW(Buffer[88],0)) & 0x3F;
00268
00269 i=5;
00270 while ( i>=0 && (GETBITW(Buffer[88],i)==0) )
00271 i--;
00272
00273 TmpDev->HighestUDMASupported=(byte) i;
00274
00275 TmpDev->SecurityEraseTime = (word) Buffer[89];
00276 TmpDev->SecurityEnEraseTime = (word) Buffer[90];
00277 TmpDev->CurAPMValue = (word) Buffer[91];
00278
00279 TmpDev->SecurityLevel = (byte) GETBITW(Buffer[128],8);
00280 TmpDev->SecurityEnErase = (byte) GETBITW(Buffer[128],5);
00281 TmpDev->SecurityCountExpired = (byte) GETBITW(Buffer[128],4);
00282 TmpDev->SecurityFrozen = (byte) GETBITW(Buffer[128],3);
00283 TmpDev->SecurityLocked = (byte) GETBITW(Buffer[128],2);
00284 TmpDev->SecurityEnabled = (byte) GETBITW(Buffer[128],1);
00285 TmpDev->SecuritySupported = (byte) GETBITW(Buffer[128],0);
00286
00287 Tmp=(word *) &(TmpDev->VendorSpecific);
00288 for (i=129;i<=159;i++)
00289 {
00290 *Tmp=(word) Buffer[i];
00291 Tmp++;
00292 }
00293 return 0;
00294 }
00295
00296
00297 void ShowDeviceDataRowName(char * Name,int Col)
00298 {
00299 kprintf(Name);
00300 gotoxy(Col,-1);
00301 kprintf("=");
00302 }
00303
00304
00305 void ShowDeviceDataRowValue(char * Name, int Col, char * Format, dword Value)
00306 {
00307 ShowDeviceDataRowName(Name,Col);
00308 kprintf(Format, Value);
00309 }
00310
00311 void ShowDeviceDataRowString(char * Name, int Col, char * Value)
00312 {
00313 ShowDeviceDataRowName(Name,Col);
00314 kprintf("%s", Value);
00315 }
00316
00317
00318 void ShowDeviceDataRowSup(char * Name,int Col, byte Supported)
00319 {
00320 ShowDeviceDataRowName(Name,Col);
00321 kprintf("Supported:%s",Bit2YesNo(Supported));
00322 }
00323
00324 void ShowDeviceDataRowSupEn(char * Name,int Col,byte Supported,byte Enabled)
00325 {
00326 ShowDeviceDataRowName(Name,Col);
00327 kprintf("Supported:%s",Bit2YesNo(Supported));
00328 kprintf(" - ");
00329 kprintf("Enabled:%s",Bit2YesNo(Enabled));
00330 }
00331
00332 void ShowDeviceDataRowBitNum(word BitCode,byte StartFrom, byte EndTo, byte StartPrintNum)
00333 {
00334 int i;
00335 byte Val=BitCode;
00336
00337 if ( StartFrom )
00338 Val=Val >> StartFrom;
00339
00340 for (i=0;i<=EndTo-StartFrom;i++)
00341 {
00342 if (Val & 0x01)
00343 kprintf("%d ",StartPrintNum+i);
00344 Val=Val >> 1;
00345 }
00346 }
00347
00348
00349 void ShowDeviceData(int Dev,int Col)
00350 {
00351
00352 DeviceInfo_Struct * TmpDev=(DeviceInfo_Struct *) &(CurrentChannel->Device[Dev].Info);
00353
00354 kprintf("\n\r***** GENERAL INFORMATION *****");
00355 ShowDeviceDataRowString("\n\rModel Name",Col,TmpDev->ModelNumber);
00356 ShowDeviceDataRowString("\n\rFirmware Revision",Col,TmpDev->FirmwareRev);
00357 ShowDeviceDataRowString("\n\rSerial Number",Col,TmpDev->SerialNumber);
00358
00359 ShowDeviceDataRowName("\n\rType",Col);
00360 if (CurrentChannel->Device[Dev].Type==CC_DEVTYPE_ATA )
00361 kprintf("ATA");
00362 else if (CurrentChannel->Device[Dev].Type==CC_DEVTYPE_ATAPI )
00363 kprintf("ATAPI");
00364 else if (CurrentChannel->Device[Dev].Type==CC_DEVTYPE_UNKN )
00365 kprintf("UNKNOW");
00366
00367 if ( TmpDev->Removable )
00368 kprintf(" - Removable");
00369 if ( TmpDev->NotRemovable )
00370 kprintf(" - Not Removable");
00371
00372
00373 kprintf("\n\r\n\r***** STANDARD SUPPORTED AND SELECTED *****");
00374
00375 ShowDeviceDataRowName("\n\rAta Supported",Col);
00376 if ( (TmpDev->AtaSupported == 0x0000) || (TmpDev->AtaSupported == 0xFFFF) )
00377 kprintf("UNKNOW");
00378 else
00379
00380 ShowDeviceDataRowBitNum(TmpDev->AtaSupported,1,14,1);
00381
00382 ShowDeviceDataRowName("\n\rUdma Supported",Col);
00383 if ( TmpDev->ValidUDMAMode )
00384 {
00385
00386 if ( TmpDev->UDMASupported )
00387
00388 ShowDeviceDataRowBitNum((word) TmpDev->UDMASupported,0,7,0);
00389 else
00390 kprintf("NONE");
00391 }
00392 else
00393 kprintf("UNKNOW");
00394
00395
00396 ShowDeviceDataRowName("\n\rUdma Selected",Col);
00397 if ( TmpDev->ValidUDMAMode )
00398 {
00399 if ( TmpDev->UDMASelected )
00400 ShowDeviceDataRowBitNum((word) TmpDev->UDMASelected,0,7,0);
00401 else
00402 kprintf("NONE");
00403 }
00404 else
00405 kprintf("UNKNOW");
00406
00407 ShowDeviceDataRowName("\n\rMultiDma Supported",Col);
00408 if ( TmpDev->MultiDMASupported )
00409 ShowDeviceDataRowBitNum((word) TmpDev->UDMASupported,0,2,0);
00410 else
00411 kprintf("NONE");
00412
00413 ShowDeviceDataRowName("\n\rMultiDma Selected",Col);
00414 if ( TmpDev->MultiDMASelected )
00415 ShowDeviceDataRowBitNum((word) TmpDev->UDMASelected,0,2,0);
00416 else
00417 kprintf("NONE");
00418
00419
00420 ShowDeviceDataRowValue("\n\rStandard Pio Mode",Col,"%d",TmpDev->PioMode);
00421
00422 ShowDeviceDataRowName("\n\rAdvanced Pio Mode Supported",Col);
00423 if ( TmpDev->AdvPioModeSupported )
00424 ShowDeviceDataRowBitNum(TmpDev->AdvPioModeSupported,0,7,3);
00425 else
00426 kprintf("NONE");
00427
00428 WaitKeyPress(MSG_PRESSKEY);
00429
00430 kprintf("\n\r\n\r***** DEVICE LOGICAL INFORMATION *****");
00431 ShowDeviceDataRowValue("\n\rLogical Cylinders",Col,"%u",TmpDev->LogicalCylinders);
00432 ShowDeviceDataRowValue("\n\rLogical Heads",Col,"%u",TmpDev->LogicalHeads);
00433 ShowDeviceDataRowValue("\n\rLogical Sectors",Col,"%u",TmpDev->LogicalSectorsPerTrack);
00434 if ( TmpDev->ValidCurLogicalValue )
00435 {
00436 ShowDeviceDataRowValue("\n\rCurrent Logical Cylinders",Col, "%u",TmpDev->CurLogicalCylinders);
00437 ShowDeviceDataRowValue("\n\rCurrent Logical Heads",Col,"%u",TmpDev->CurLogicalHeads);
00438 ShowDeviceDataRowValue("\n\rCurrent Logical Sectors",Col,"%u",TmpDev->CurLogicalSectorsPerTrack);
00439 }
00440 else
00441 {
00442 ShowDeviceDataRowString("\n\rCurrent Logical Cylinders",Col,"UNKNOW");
00443 ShowDeviceDataRowString("\n\rCurrent Logical Heads",Col,"UNKNOW");
00444 ShowDeviceDataRowString("\n\rCurrent Logical Sectors",Col,"UNKNOW");
00445 }
00446 ShowDeviceDataRowValue("\n\rCapacity Sectors Current CHS",Col,"%u",TmpDev->CapacityInSectors);
00447 ShowDeviceDataRowValue("\n\rCapacity Sectors",Col,"%u",TmpDev->CapacityLba);
00448 ShowDeviceDataRowValue("\n\rCapacity in MB",Col,"%u",TmpDev->CapacityLba / 2 / 1024);
00449
00450 ShowDeviceDataRowSupEn("\n\rIORDY",Col,TmpDev->IORDYSupport,TmpDev->IORDYDisabled);
00451
00452 WaitKeyPress(MSG_PRESSKEY);
00453
00454 kprintf("\n\r\n\r***** DEVICE FEATURES AND SETTING INFORMATION *****");
00455 ShowDeviceDataRowSup("\n\rR W Dma Queued",Col,TmpDev->SFSRWDmaQueuedSupported);
00456 ShowDeviceDataRowValue("\n\rQueue Depth",Col,"%u",TmpDev->QueueDepth);
00457 ShowDeviceDataRowValue("\n\rMax Sect Per Block (in Multi)",Col,"%u",TmpDev->MaxMulitSectPerBlock);
00458 ShowDeviceDataRowSupEn("\n\rAdv Power Management",Col,TmpDev->SFSAdvPowerManagSupported,TmpDev->SFEAdvPowerManagEnabled);
00459 ShowDeviceDataRowValue("\n\rAdv Power Management Level",Col,"%u",TmpDev->CurAPMValue);
00460
00461 ShowDeviceDataRowSupEn("\n\rLook Ahead",Col,TmpDev->SFSLookAheadSupported,TmpDev->SFELookAheadEnabled);
00462 ShowDeviceDataRowSupEn("\n\rRelease Interrupt",Col,TmpDev->SFSReleaseIntSupported,TmpDev->SFEReleaseIntEnabled);
00463 ShowDeviceDataRowSupEn("\n\rRemovable Media Notif",Col,TmpDev->SFSRemMediaNotifSupported,TmpDev->SFERemMediaNotifEnabled);
00464 ShowDeviceDataRowSupEn("\n\rService Interrupt",Col,TmpDev->SFSServiceIntSupported,TmpDev->SFEServiceIntEnalbed);
00465 ShowDeviceDataRowSupEn("\n\rSmart",Col,TmpDev->SFSSmartSupported,TmpDev->SFESmartEnabled);
00466 ShowDeviceDataRowSupEn("\n\rWrite Cache",Col,TmpDev->SFSWriteCacheSupported,TmpDev->SFEWriteCacheEnabled);
00467 ShowDeviceDataRowSup("\n\rRead Buffer",Col,TmpDev->SFSReadBufferSupported);
00468 ShowDeviceDataRowSup("\n\rWrite Buffer",Col,TmpDev->SFSWriteBufferSupported);
00469 ShowDeviceDataRowSup("\n\rNop",Col,TmpDev->SFSNopSupported);
00470 ShowDeviceDataRowSup("\n\rPacket",Col,TmpDev->SFSPacketSupported);
00471 ShowDeviceDataRowSup("\n\rPower Management",Col,TmpDev->SFSPowerManagSupported);
00472 ShowDeviceDataRowSup("\n\rProtected Area",Col,TmpDev->SFSProtectedAreaSupported);
00473 ShowDeviceDataRowSup("\n\rDownload Microcode",Col,TmpDev->SFSDownMicrocodeSupported);
00474 ShowDeviceDataRowSup("\n\rCFA",Col,TmpDev->SFSCFASupported);
00475 ShowDeviceDataRowSup("\n\rDevice Reset",Col,TmpDev->SFSDeviceResetSupported);
00476 ShowDeviceDataRowSup("\n\rStandBy Timer",Col,TmpDev->StandByTimerSupport);
00477
00478 WaitKeyPress(MSG_PRESSKEY);
00479
00480
00481 kprintf("\n\r\n\r***** DEVICE TIMING INFORMATION *****");
00482 ShowDeviceDataRowSup("\n\rStandBy Timer",Col,TmpDev->StandByTimerSupport);
00483
00484 if (TmpDev->ValidCycleTime )
00485 {
00486 ShowDeviceDataRowValue("\n\rMin Multi Dma Cycle Time (ns)",Col,"%u",TmpDev->MinCycleTime);
00487 ShowDeviceDataRowValue("\n\rRecc MultiDma Cycle Time (ns)",Col,"%u",TmpDev->RecCycleTime);
00488 ShowDeviceDataRowValue("\n\rMin Pio Cycle Time (ns)",Col,"%u",TmpDev->MinPioCycleTime);
00489 ShowDeviceDataRowValue("\n\rMin Pio Cycle Time Flow (ns)",Col,"%u",TmpDev->MinPioCyleTimeFlow);
00490 }
00491 else
00492 {
00493 kprintf("\n\rTiming Information Unavaiable");
00494 }
00495
00496 kprintf("\n\r\n\r***** SECURITY INFORMATION *****");
00497 ShowDeviceDataRowSupEn("\n\rSecurity",Col,TmpDev->SecuritySupported,TmpDev->SecurityEnabled);
00498 ShowDeviceDataRowSupEn("\n\rSecurity Mode",Col,TmpDev->SFSSecurityModeSupported,TmpDev->SFESecurityModeEnabled);
00499 ShowDeviceDataRowValue("\n\rSecurity Erase Time (min)",Col,"%u",(int) TmpDev->SecurityEraseTime*2);
00500 ShowDeviceDataRowValue("\n\rEnh Security Erase Time (min)",Col,"%u",(int) TmpDev->SecurityEnEraseTime*2);
00501
00502 ShowDeviceDataRowName("\n\rSecurity Level",Col);
00503 if ( TmpDev->SFESecurityModeEnabled )
00504 {
00505 if (TmpDev->SecurityLevel)
00506 kprintf("Max");
00507 else
00508 kprintf("High");
00509 }
00510 else
00511 {
00512 kprintf("Disabled");
00513 }
00514
00515 ShowDeviceDataRowString("\n\rSecurity Frozen",Col,Bit2YesNo(TmpDev->SecurityFrozen));
00516 kprintf("\n\rSecurity CountExpired");
00517 gotoxy(Col,-1);
00518 kprintf("=%s",Bit2YesNo(TmpDev->SecurityCountExpired));
00519 kprintf("\n\rSecurity Locked");
00520 gotoxy(Col,-1);
00521 kprintf("=%s",Bit2YesNo(TmpDev->SecurityLocked));
00522 ShowDeviceDataRowSup("\n\rSecurity Enh Erase Supported",Col,TmpDev->SecurityEnErase);
00523
00524 kprintf("\n\r\n\r END DEVICE INFORMATION \n\r");
00525 }
00526
00527
00528
00529
00530
00531
00532
00533
00534 void InitIde()
00535 {
00536 extern void Ide_Handler_Pri, Ide_Handler_Sec;
00537
00538
00539
00540 install_irq_handler(IDEP_IRQ, &Ide_Handler_Pri);
00541 install_irq_handler(IDES_IRQ, &Ide_Handler_Sec);
00542
00543
00544
00545 SelectAtaChannel(CC_PRIMARY);
00546 SetAtaRegisterIoPort(HDC_BASEPRI,HDC_BASEPRI+HDC_CONTROLGAP,HDC_INTPRI);
00547
00548
00549 ScanDevice(TRUE);
00550 if ( CurrentChannel->Device[CC_DEV0].Type==CC_DEVTYPE_ATA )
00551 IdentifyDevice(CC_DEV0);
00552 if ( CurrentChannel->Device[CC_DEV1].Type==CC_DEVTYPE_ATA )
00553 IdentifyDevice(CC_DEV1);
00554
00555
00556 SelectAtaChannel(CC_SECONDARY);
00557 SetAtaRegisterIoPort(HDC_BASESEC,HDC_BASESEC+HDC_CONTROLGAP,HDC_INTSEC);
00558
00559
00560 ScanDevice(TRUE);
00561 if ( CurrentChannel->Device[CC_DEV0].Type==CC_DEVTYPE_ATA )
00562 IdentifyDevice(CC_DEV0);
00563 if ( CurrentChannel->Device[CC_DEV1].Type==CC_DEVTYPE_ATA )
00564 IdentifyDevice(CC_DEV1);
00565 }
00566
00567
00568
00569
00570
00571
00572 int ReadSectorsLba(int Dev, uint64 Lba, int NumSect, word * Buffer,int UseInterrupt)
00573 {
00574
00575
00576 return IdePioDataInLba(Dev,HDC_CMD_READ_SECTORS,0,NumSect,Lba,Buffer,NumSect,1,UseInterrupt);
00577 }
00578
00579
00580
00581
00582 int WriteSectorsLba(int Dev, uint64 Lba, int NumSect, word * Buffer,int UseInterrupt)
00583 {
00584 return IdePioDataOutLba(Dev,HDC_CMD_WRITE_SECTORS,0,NumSect,Lba,Buffer,NumSect,1,UseInterrupt);
00585 }
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039
01040