ICOM 5007 - Noack Linux I/O structure Device special files Device switch tables and fops How the kernel finds a device Parts of a device driver or module.

Slides:



Advertisements
Similar presentations
Chapter 12: File System Implementation
Advertisements

Device Drivers. Linux Device Drivers Linux supports three types of hardware device: character, block and network –character devices: R/W without buffering.
Tutorial 3 - Linux Interrupt Handling -
Architectural Support for Operating Systems. Announcements Most office hours are finalized Assignments up every Wednesday, due next week CS 415 section.
Introduction to Kernel
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)
Embedded System Programming Introduction to Device Drivers.
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.
OS Spring’03 Introduction Operating Systems Spring 2003.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
1 I/O Management in Representative Operating Systems.
OS Spring’04 Introduction Operating Systems Spring 2004.
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
CSE 451: Operating Systems Autumn 2013 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Chapter 8 Input/Output. Busses l Group of electrical conductors suitable for carrying computer signals from one location to another l Each conductor in.
CHAPTER 5 I/O PRINCIPLE Understand the principles of System Bus
NETW 3005 I/O Systems. Reading For this lecture, you should have read Chapter 13 (Sections 1-4, 7). NETW3005 (Operating Systems) Lecture 10 - I/O Systems2.
CSC 322 Operating Systems Concepts Lecture - 25: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
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.
Architecture Support for OS CSCI 444/544 Operating Systems Fall 2008.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
File System Implementation Chapter 12. File system Organization Application programs Application programs Logical file system Logical file system manages.
Operating Systems Lecture 7 OS Potpourri Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
UNIX Files File organization and a few primitives.
LINUX System : Lecture 7 Bong-Soo Sohn Lecture notes acknowledgement : The design of UNIX Operating System.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
We will focus on operating system concepts What does it do? How is it implemented? Apply to Windows, Linux, Unix, Solaris, Mac OS X. Will discuss differences.
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
Interfacing Device Drivers with the Kernel
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
OSes: 2. Structs 1 Operating Systems v Objective –to give a (selective) overview of computer system architectures Certificate Program in Software Development.
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.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 12: I/O Systems I/O hardwared Application I/O Interface Kernel I/O.
I/O Software CS 537 – Introduction to Operating Systems.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 5.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
1.3 Operating system services An operating system provide services to programs and to the users of the program. It provides an environment for the execution.
Introduction to Operating Systems Concepts
Input/Output (I/O) Important OS function – control I/O
Introduction to Kernel
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.
Linux Details: Device Drivers
CS501 Advanced Computer Architecture
Interfacing with Hardware
Linux Kernel Module Programming
Operating Systems •The kernel is a program that constitutes the central core of a computer operating system. It has complete control over everything that.
Protection of System Resources
CS 3305 System Calls Lecture 7.
CSCI 315 Operating Systems Design
CPSC 457 Operating Systems
Operating System Concepts
CS703 - Advanced Operating Systems
Direct Memory Access Disk and Network transfers: awkward timing:
CSE 451: Operating Systems Spring 2012 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Mid Term review CSC345.
Lecture Topics: 11/1 General Operating System Concepts Processes
Chapter 5: I/O Systems.
Linux Details: Device Drivers
Chapter 2: The Linux System Part 5
LINUX System : Lecture 7 Lecture notes acknowledgement : The design of UNIX Operating System.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
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.
CS Introduction to Operating Systems
Presentation transcript:

ICOM Noack Linux I/O structure Device special files Device switch tables and fops How the kernel finds a device Parts of a device driver or module Device driver actions

ICOM Noack Level of kernel support No support Application program interacts with I/O ports directly – driver is just a stub Example – graphics drivers – X-server (an application program) deals with graphics card directly Minimal support Kernel doesn’t understand device, just interface registers and functioning Example – serial port – application program understands modem or other associated device Extended support Kernel (device driver) understands device as well as interface Example – most drivers except graphics and serial

ICOM Noack Device special files File actions (read, write, etc.) on a device special file cause interaction with the device The inode for a device special file contains Type – block or character Major number – which device driver to use Minor number – which instance of this kind of device No data or data block pointers at all The name of a device file usually means nothing Commonly these files go in /dev Examples - /dev/hdxx – hard disks, /dev/console – system console Newer scheme is used in linux-2.4 – /devfs – device files are automatically created when a device is found

ICOM Noack Device switch tables and fops Each table (block or character) contains Prefix – a short device type mnemonic – prefixes each entry name Pointer to a fops data structure – members are named open, read, write, etc. Values are function pointers to entry points in the device driver or module The fops structure is an additional level of indirection and flexibility Using a pointer to a derived structure allows additional capabilities for specific devices This general idea is an example of an implementation detail A given function can be done in any of many ways without changing the external behavior of the system Often such details are chosen for better compartmentalization or flexibility

ICOM Noack How the kernel finds a device PCI devices Pci interfaces can be initialized to set up port, interrupt line, and on-interface memory Devices can identify their type OS then sets up interrupt vectors and links them to the appropriate handler OS registers these devices Hot pluggables Identified when they appear on USB or other bus during run time – drivers or modules are registered then Legacy devices CPU probes for these at boot time – it can hang system or confuse device Probing is designed to cause device to interrupt so OS can find out which line is connected

ICOM Noack Parts of a device driver or module Upper half Contains all the fops-based entry points – kernel and user space – kernel mode Lower half Operations that can be called by some kind of scheduling queue – also kernel and user space Bottom half The interrupt service routines – kernel memory only

ICOM Noack Device driver actions Fops structure Default members connect to nothing (except for open) Usual members connect to the standard methods – read, write, etc. Member assignments can be changed – introducing new or different methods Interrupt usage Driver can request_irq() or freee_irq() Request_irq() is called in the open() method free_irq() is called in the release() method if the usage count has dropped to zero Synchronization Driver that has interrupt handler starts I/O and then does interruptible_sleep_on() – passing a pointer via the interrupt queue Polling drivers can do spinlocks (for short displays) or put themselves on a scheduling queue if the operation is long