Device Driver Concepts Digital UNIX Internals II Device Driver Concepts Chapter 13.

Slides:



Advertisements
Similar presentations
CT213 – Computing system Organization
Advertisements

Device Drivers. Linux Device Drivers Linux supports three types of hardware device: character, block and network –character devices: R/W without buffering.
Input and Output CS 215 Lecture #20.
Avishai Wool lecture Introduction to Systems Programming Lecture 8 Input-Output.
04/14/2008CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem.
I/O Hardware n Incredible variety of I/O devices n Common concepts: – Port – connection point to the computer – Bus (daisy chain or shared direct access)
04/16/2010CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying an earlier edition.
I/O Systems CS 3100 I/O Hardware1. I/O Hardware Incredible variety of I/O devices Common concepts ◦Port ◦Bus (daisy chain or shared direct access) ◦Controller.
1 Device Management The von Neumann Architecture System Architecture Device Management Polling Interrupts DMA operating systems.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
1 I/O Management in Representative Operating Systems.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
1 CSC 2405: Computer Systems II Spring 2012 Dr. Tom Way.
Device Management. Serial Port Serial Device Serial Device Memory CPU Printer Terminal Modem Mouse etc.
1 Input/Output. 2 Principles of I/O Hardware Some typical device, network, and data base rates.
CHAPTER 13: I/O SYSTEMS Overview Overview I/O Hardware I/O Hardware I/O API I/O API I/O Subsystem I/O Subsystem Transforming I/O Requests to Hardware Operations.
System Calls 1.
OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements.
Cpr E 308 Input/Output Recall: OS must abstract out all the details of specific I/O devices Today –Block and Character Devices –Hardware Issues – Programmed.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Segmentation & O/S Input/Output Chapter 4 & 5 Tuesday, April 3, 2007.
CSC 322 Operating Systems Concepts Lecture - 25: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
COMP 3438 – Part I - Lecture 4 Introduction to Device Drivers Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 2, 2005 Chapter 13: I/O Systems I/O Hardware.
Hardware Definitions –Port: Point of connection –Bus: Interface Daisy Chain (A=>B=>…=>X) Shared Direct Device Access –Controller: Device Electronics –Registers:
ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-2: I/O Management (Review) Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
I/O Systems I/O Hardware Application I/O Interface
1 Lecture 20: I/O n I/O hardware n I/O structure n communication with controllers n device interrupts n device drivers n streams.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS6: Device Management 6.1. Principles of I/O.
1 Comp 104: Operating Systems Concepts Devices. 2 Today Devices –Introduction –Handling I/O Device handling Buffering and caching.
Device Drivers CPU I/O Interface Device Driver DEVICECONTROL OPERATIONSDATA TRANSFER OPERATIONS Disk Seek to Sector, Track, Cyl. Seek Home Position.
Chapter 13: I/O Systems. 13.2/34 Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware.
Fall 2000M.B. Ibáñez Lecture 25 I/O Systems. Fall 2000M.B. Ibáñez Categories of I/O Devices Human readable –used to communicate with the user –video display.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Chapter 5 Input/Output 5.1 Principles of I/O hardware
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, Chapter 13: I/O Systems.
4P13 Week 12 Talking Points Device Drivers 1.Auto-configuration and initialization routines 2.Routines for servicing I/O requests (the top half)
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 13: I/O Systems Overview I/O Hardware Application.
Processor Memory Processor-memory bus I/O Device Bus Adapter I/O Device I/O Device Bus Adapter I/O Device I/O Device Expansion bus I/O Bus.
Chapter 13: I/O Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 2, 2005 I/O through system calls Protection.
Input Output Techniques Programmed Interrupt driven Direct Memory Access (DMA)
بسم الله الرحمن الرحيم MEMORY AND I/O.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 12: I/O Systems I/O hardwared Application I/O Interface Kernel I/O.
Part IVI/O Systems Chapter 13: I/O Systems. I/O Hardware a typical PCI bus structure 2.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edit9on Lecture 3 Chapter 1: Introduction Provided & Updated by Sameer Akram.
Introduction to Operating Systems Concepts
Input/Output (I/O) Important OS function – control I/O
Chapter 13: I/O Systems.
Module 12: I/O Systems I/O hardware Application I/O Interface
Chapter 13: I/O Systems Modified by Dr. Neerja Mhaskar for CS 3SH3.
CS 286 Computer Organization and Architecture
CS703 - Advanced Operating Systems
CSCI 315 Operating Systems Design
I/O Systems I/O Hardware Application I/O Interface
Operating Systems Chapter 5: Input/Output Management
Operating System Concepts
13: I/O Systems I/O hardwared Application I/O Interface
CS703 - Advanced Operating Systems
Direct Memory Access Disk and Network transfers: awkward timing:
Chapter 5: I/O Systems.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Chapter 13: I/O Systems.
Module 12: I/O Systems I/O hardwared Application I/O Interface
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

Device Driver Concepts Digital UNIX Internals II Device Driver Concepts Chapter 13

Device Driver Concepts Digital UNIX Internals II Topics Driver Interfaces Interrupt Handling and Drivers Classes of Drivers Accessing Hardware

Device Driver Concepts Digital UNIX Internals II Hardware Isolation Device Controller Bus Driver Kernel User Program Utility

Device Driver Concepts Digital UNIX Internals II Defined System Interfaces (1) System CallFunction mknod Creates a device special file ioctl Allows manipulation of underlying device parameters for the device special file open Makes a device available close Marks device no longer is use read Initiates data transfer from device to memory write Initiates data transfer from memory to device mmap For TURBOchannel

Device Driver Concepts Digital UNIX Internals II Kernel Interface Illustrated (open()) 1. open() DEVICE DRIVERS USER/APPLICATION 2. open() KERNEL System Call Layer return status 3. init tables 4. prepare device

Device Driver Concepts Digital UNIX Internals II Driver Models for Device Interfaces polling –drive constantly checks on the devices it supports. –drawback: overhead of CPU cycles interrupt handling –the supporting hardware has the capability of interrupting the CPU (with a hardware interrupt). –The CPU in turn invokes a procedure provided by the driver to handle the interrupt as quickly as possible so normal processing can continue.

Device Driver Concepts Digital UNIX Internals II Interrupt Handling Illustrated DEVICE DRIVER USER/APPLICATION KERNEL 8. return status &data 9. return status & data 1. read() 2. read() 4. wait for data 3. prepare device if necessary some time passes 5. hardware interrupt 6. Kernel calls registered interrupt handler 7. place data in known location, set flag for driver, return Process unblocked return data clear flag

Device Driver Concepts Digital UNIX Internals II Registering Interrupts Interrupt handler must be registered with the kernel prior to enabling interrupts. –The kernel places this address in its System Control Block (SCB) indexed by the interrupt level A subsequent hardware interrupt causes the PAL code to interrupt the CPU and call _XentInt() –This routine stores critical registers for the interrupted process, –and sets up a call stack for the interrupt routine which it then calls. The interrupt routine must service the interrupt as fast as possible with no wait(s) on any resource.

Device Driver Concepts Digital UNIX Internals II System Control Block The system control block (SCB) –8-KB, page aligned area in physical memory –specifies entry points for interrupt service routines. –the physical address of the start of the SCB is contained in the System Control Block Base (SCBB) register. The SCB contains 512 entries, each of which is 16 bytes long. –The first 8 bytes specifies the virtual address of the service routine associated with the interrupt –The second 8 bytes is a parameter, an arbitrary quadword to be passed to the service routine.

Device Driver Concepts Digital UNIX Internals II Classes of Device Drivers Character device drivers Block device drivers Network device drivers Pseudodevice drivers

Device Driver Concepts Digital UNIX Internals II Block Devices Provide structured access to the hardware. Block devices are accessible directly through device special files. Disks are the most common block I/O devices. –Support a file system and using file system sized buffers –A buffer is allocated when the first disk read is encountered. Use of buffer cache improves the disk I/O performance. –A block I/O device interface converts between the user's concept of a sequence of bytes on the disk to the restrictions imposed by the structure of the physical device.

Device Driver Concepts Digital UNIX Internals II Character Devices Can do transfers as small as one character Can transfer much larger transfers as well Can be very high speed (does not imply “slow”!) And can transfer large buffers (not restricted to a single character!) Example: serial port driver, raw devices

Device Driver Concepts Digital UNIX Internals II Network Devices May be character or block device Often use the standard streams interface for interoperability with other vendors (see Appendix A) Often uses direct memory access (DMA)

Device Driver Concepts Digital UNIX Internals II Pseudo-devices Require the low-memory access of the kernel, even though there is no hardware controller with which to interface. Never has an ISR registered in the interrupt dispatching of the system. Examples: pty pseudo terminals

Device Driver Concepts Digital UNIX Internals II Direct Memory Access Certain hardware is capable of writing to or reading from memory directly (highspeed vs. device registers) This is not to be confused with buffer cache DMA devices can be either block or character devices.

Device Driver Concepts Digital UNIX Internals II Mapped Access I/O Using mapped access I/O, the processor accesses a remote I/O interface register using a mapping of that remote address space into the processor's local I/O space. I/O access is accomplished by reading and writing interface registers directly. Mapped access can be used by TURBOchannel based, low-end, low-cost models. Mapped I/O solves granularity problems by doubly mapping I/O locations in both dense as well as sparse I/O spaces.