DOC PREVIEW
USF CS 630 - The IDE and ATA Interface

This preview shows page 1-2-14-15-29-30 out of 30 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

The IDE/ATA InterfaceThe EDD servicesPersistent data storageHardware interfacingA few cautionsFixed-Size ‘blocks’Platform-specific parametersSlide 8The ATA/IDE InterfaceCommand Block registersControl Block RegistersBus Master DMATwo I/O design-paradigmsPIO algorithm overviewPIO overview (continued)PIO overview (conclusion)Status register (cmd+7)Device register (cmd+6)Error register (cmd+1)Device Control register (ctl+2)PIO demo: ‘ideload1.s’Advantage of DMADMA Command registerDMA Status registerPRD Pointer registerDMA algorithm overviewDMA overview (continued)DMA algorithm (concluded)DMA demo: ‘ideload2.s’In-class exerciseThe IDE/ATA InterfaceHow can our mini-Operating System, executing in protected mode, access the hard disk?The EDD services•So far we have relied upon the Extended Disk Drive service-functions (available in real-mode via ‘int $0x13’) to perform any transfers of data between main memory and our computer system’s hard disk•But these service-functions in ROM-BIOS are designed to be executed in real-mode•Can we achieve their effects when PE=1?Persistent data storage•Any operating system we might design, no matter how minimal, would need to offer a way to write and to read ‘persistent data’, organized into some kind of ‘file system’ that is maintained on a secondary storage device, such as a hard disk or a disketteHardware interfacing•Modern computer platforms are expected to provide a specially designed peripheral processor, the hard disk controller, which can be programmed by system software to carry out data-transfers between a disk and the computer’s primary memory•The programming interface for hard disk controllers continues to evolve, but a stable set of standard capabilities existsA few cautions•Our classroom and laboratory computers are shared by many users who are taking various computer sciences courses•Writing to the hard disk in a careless way can do damage to the operating systems (making a machine completely unusable) •In your early experiments you will need to use great caution to avoid corrupting vital areas of these shared hard disks!Fixed-Size ‘blocks’•All data-transfers to and from the hard disk are comprised of fixed-size blocks called ‘sectors’ (whose size equals 512 bytes)•On modern hard disks, these sectors are identified by sector-numbers starting at 0•This scheme for addressing disk sectors is known as Logical Block Addressing (LBA)•So the hard disk is just an array of sectorsPlatform-specific parameters•Although older PCs used some standard I/O port-addresses for communicating with their Disk Controllers, newer PCs like ours allow these port-addresses to be assigned dynamically during the system’s startup•To keep our demonstration-code as short and uncluttered as possible, we will ‘hard-code’ the port-numbers our machines useThe ATA/IDE Interface•All communication between our driver and the Hard Disk Controller is performed with ‘in’ and ‘out’ instructions that refer to ports•Older PCs had standard i/o port-numbers for communicating with the Disk Controller•But newer PCs assign these dynamicallyCommand Block registers•When reading…–Data –Error –Sector Count–LBA Low–LBA Mid–LBA High–Device–Status•When writing…–Data–Features–Sector Count–LBA Low–LBA Mid–LBA High–Device–CommandControl Block Registers•When reading…–Alternate Status•When writing…–Device ControlINCRITSInterNational Committee on Information Technology StandardsCommittee T-13Bus Master DMA•When reading…–Primary DMA Control–Primary DMA Status–Primary PRD Pointer•When writing…–Primary DMA Control–Primary DMA Status–Primary PRD PointerINTELICH6 I/O Controller Hub DatasheetSATA Controller RegistersTwo I/O design-paradigms•PIO: Programmed I/O for ‘reading’–The cpu outputs parameters to the controller–The cpu waits till the data becomes available–The cpu transfers the data into main memory •DMA: Direct Memory Access for ‘reading’–The cpu outputs parameters to the controller–The cpu activates the DMA engine to begin–The cpu deactivates the DMA engine to endPIO algorithm overview•First select the device to read from:–Wait until the controller is not busy and does not have any data that it wants to transfer–Write to Command Block’s Device register to select the disk to send the command to–Wait until the controller indicates that it is ready to receive your new commandPIO overview (continued)•Place the command’s parameters into the appropriate Command Block registers•Put command-code in Command register•Then wait until the controller indicates that it has read the requested sector’s data and is ready for you to transfer it into memory •Use a loop to input 256 words (one sector) from the Command Block’s Data registerPIO overview (conclusion)•After you have transferred a sector, check the Controller Status to see if there were any errors (if so read the Error register)•To implement this algorithm, we need to look at the meaning of some individual bits in the Status register (and Error register)Status register (cmd+7)BSY DRDY DF DRQ ERRLegend: BSY (Device still Busy with prior command): 1=yes, 0=no DRDY (Device is Ready for a new command): 1=yes, 0=no DF (Device Fault – command cannot finish): 1=yes, 0=no DRQ (Data-transfer is currently Requested): 1=yes, 0=no ERR (Error information is in Error Register): 1 = yes, 0=no7 6 5 4 3 2 1 0Device register (cmd+6)1LBA(=1)1DEV(0/1)Sector-ID[ 27..24 ]Legend: LBA (Logical Block Addressing): 1=yes, 0=no DEV (Device selection): 1=slave, 0=master Sector-ID: Most significant 4-bits of 28-bit Sector-Address7 6 5 4 3 2 1 0Error register (cmd+1)UNC MC IDNF MCR ABRT NMLegend: UNC (Data error was UnCorrectable): 1=yes, 0=no MC (Media was Changed): 1=yes, 0=no IDNF (ID Not Found): 1=yes, 0=no MCR (Media Change was Requested): 1=yes, 0=no ABRT (Command was Aborted): 1 = yes, 0=no NM (No Media was present): 1=yes, 0=no7 6 5 4 3 2 1 0Device Control register (ctl+2)HOB 0 0 0 0 SRST nIEN 0Legend: HOB (High-Order Byte): 1=yes, 0=no SRST (Software Reset requested): 1=yes, 0=no nIEN (negate Interrupt Enabled): 1=yes, 0=noNOTE: The HOB-bit


View Full Document

USF CS 630 - The IDE and ATA Interface

Documents in this Course
Load more
Download The IDE and ATA Interface
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view The IDE and ATA Interface and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view The IDE and ATA Interface 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?