Project disk driver
Download
1 / 14

lecture notes - PowerPoint PPT Presentation


  • 537 Views
  • Updated On :

Project: Disk Driver ICS 145B L. Bic file system disk driver disk controller disk 1 2 emulation software Assignment implement a driver for a simulated disk fs requests reading/writing of logical disk blocks (0:L-1)

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'lecture notes' - bernad


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Project disk driver l.jpg

Project: Disk Driver

ICS 145B

L. Bic


Assignment l.jpg

file

system

disk

driver

disk

controller

disk

1

2

emulation software

Assignment

  • implement a driver for a simulated disk

  • fs requests reading/writing of logical disk blocks (0:L-1)

  • disk driver interacts with HW controller via register interface to read/write blocks


Organization of the disk pg 369 l.jpg
Organization of the Disk (pg 369)

  • each surface consist of tracks

  • each track consist of sectors (blocks)

  • each sector consist of bytes

  • tracks with same diameter is a cylinder

  • thus a cylinder also consist of tracks

  • sector is the smallest unit of transfer


Fs driver interface 1 l.jpg
FS/Driver Interface (1)

  • read_block(int i, char *p)

  • write_block(int i, char *p)

    copy block i to/from main memory (ptr)

  • init_disk(…)

  • save_disk(…)

file

system

disk

driver

disk

controller

disk

1

2

emulation software


Disk driver l.jpg
Disk Driver

  • principles of operation (see Section 11.4.3, page 379)

driver SW


Disk driver6 l.jpg
Disk Driver

  • valid opcodes

    • SEEK

    • READ

    • WRITE

    • REPORT

  • writing opcode (OP reg) starts operation

  • controller becomes busy (BUSY reg)

  • driver must await completion

    • await_intrpt() for SEEK/READ/WRITE

    • busy-wait for REPORT (test BUSY reg)


Disk driver7 l.jpg
Disk Driver

  • SEEK/READ/WRITE operation may fail

    • permanent failure (e.g., invalid parameter)

    • transient failure (generated at random)

  • driver must check status after every operation

    • write REPORT opcode

    • busy-wait until report operation completes

    • test STAT register

    • repeat operation if error is transient; report is permanent


Controller registers 2 l.jpg
Controller Registers (2)

  • writable registers

    • OP: SEEK, READ, WRITE, REPORT

    • CYL: 0..CYL_NO-1 (used by SEEK)

    • SURF: 0..NO_SURF-1 (used by READ/WRITE)

    • SECT: 0..NO_SECT-1 (used by READ/WRITE)

    • MEM: pointer (used by READ/WRITE)

  • read-only registers

    • BUSY: TRUE/FALSE

    • STAT: OK, ILL_OP, ILL_CYL, ILL_SURF, ILL_SECT, ERROR (transient error)

file

system

disk

driver

disk

controller

disk

1

2

emulation software


Controller interface functions l.jpg
Controller Interface Functions

  • int read_reg(int reg_no)

    • read value of BUSY or STAT

  • int write_int_reg(int reg_no, int v)

    • write v into OP, CYL, SURF, SECT register

    • writing OP also starts operation (if not busy)

  • int write_mem_reg(char* v)

    • write starting location in memory (v) into MEM

  • int await_intrpt()

    • block process until completion interrupt


Controller interface functions10 l.jpg
Controller Interface Functions

  • int init_disk(int no_cyl, int no_surf, int no_sect, int sect_len, char disk_cont[])

    • create/initialized disk

    • disk_cont[] is the initialization file; if nonexistent, disk is filled with blanks

  • int save_disk(char disk_cont[])

    • save the current disk contents in the file disk_cont[]


Driver protocol l.jpg
Driver Protocol

  • translate logical block number into a disk address (cylinder #, surface #, sector #)

  • if read/write head is already at desired cylinder, skip to step 3; else perform seek:

    • write cylinder # into the CYL register

    • write opcode SEEK into OP register

    • wait for interrupt (by calling await_intrpt() )

    • write opcode REPORT into OP register

    • busy-wait until BUSY register becomes FALSE

    • read STAT register

    • if operation ok, go to step 3; else retry SEEK


Driver protocol cont l.jpg
Driver Protocol -- cont

3. Perform READ or WRITE operation:

  • write parameters into controller registers (SURF, SECT, MEM)

  • write opcode READ or WRITE into OP register

  • wait for interrupt (by calling await_intrpt() )

  • write opcode REPORT into OP register

  • busy-wait until BUSY register becomes FALSE

  • read STAT register

  • if operation ok, go to step 1; else retry READ/WRITE


Using simulation software l.jpg
Using Simulation Software

  • the following files are on the web page

    • controller.c

    • internal.h

    • interface.h

  • DO NOT MODIFY THESE IN ANY WAY

  • compile these into controller.o

  • compile/link your program with controller.o

  • your program must include interface.h, i.e.:

    • #include ”interface.h”

  • your program uses the disk by invoking the controller interface functions (see protocol)


Summary of tasks l.jpg
Summary of tasks

  • design/implement driver

  • test driver (handling transient errors)

  • develop presentation/test shell (optional)

  • turn in design documentation

    • hard copy of high-level documentation to Distribution Center

    • commented code to Masterhit

  • code will be tested as part of FS project


ad