101 1.1 hardware settings


Published on

Published in: Technology, Business
1 Comment
  • Perfect studying material to understand hardware.
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

101 1.1 hardware settings

  1. 1. Junior Level Linux Certification
  2. 2. Exam Objectives Key Knowledge Areas 1.Enable and disable integrated peripherals. 2.Configure systems with or without external peripherals such as keyboards. 3.Differentiate between the various types of mass storage devices. 4.Set the correct hardware ID for different devices, especially the boot device. 5.Know the differences between coldplug and hotplug devices. 6.Determine hardware resources for devices. 7.Tools and utilities to list various hardware information (e.g. lsusb, lspci, etc.) 8.Tools and utilities to manipulate USB devices 9.Conceptual understanding of sysfs, udev, hald, dbus Objective 1: System Architecture Determine and configure hardware settings Weight: 2 Terms and Utilities /sys /proc /dev modprobe lsmod lspci lsusb 2
  3. 3. BIOS settings A modern personal computer (or PC) system consists of a central processing unit (CPU) for performing calculations, along with some memory for storing the data that the processor is using. To make such a device useful, we attach peripheral devices, such as keyboards, mice, displays, hard drives, CD or DVD drives, printers, scanners, and network cards, which allow us to enter, store, print, display, and transmit data. The memory used by the processor is called Random Access Memory (RAM). In a typical PC, this memory is volatile, meaning that it requires power to keep its data. Turn off the PC and the memory is wiped clean. When we turn off a PC, we turn it into a collection of hardware components that will do nothing until reprogrammed. This reprogramming occurs when we turn on the machine; the process is called bootstrapping or booting the computer. System and BIOS overview 3
  4. 4. BIOS settings The process of booting involves loading an operating system from an external storage device, such as a floppy disk, CD, DVD, hard drive, or memory key. The program that does this initial loading is permanently stored in the computer and is called the Basic Input Output System (BIOS). The BIOS is stored in non-volatile memory called Read Only Memory (ROM). Bootstrap process and BIOS Updating the BIOS meant replacing the ROM chip. Later, Electrically Erasable Programmable Read Only Memories (EEPROMs) were used. EEPROMs allowed BIOS upgrade in field with a diskette instead of special tools. Today you will more often find a form of non-volatile memory -Flash memory, which is also used in digital cameras and memory keys. Flash memory also permits BIOS upgrades in the field. 4
  5. 5. BIOS settings Besides controlling initial bootup of a PC, today's BIOS programs usually permit a user to set or verify several configuration options on a system. These include verifying installed features such as RAM, hard drive, optical drive, keyboard, mouse, and possibly onboard display, sound and network connections. The user may enable or disable some features. Bootstrap process and BIOS Accessing the BIOS setup usually requires a keyboard attached to the system. When a system is powered on a Power On Self Test or POST is performed. On some systems you will be briefly prompted to press a particular key to enter setup otherwise normal bootup takes over. 5
  6. 6. BIOS settings BIOS Ex. BIOS Setup 6
  7. 7. BIOS settings 1. CMOS memory chip for BIOS settings (Complementary Metal Oxide Semiconductor). 2. ROM chip containing the BIOS code 3. Battery CMOS settings are not lost when the power goes off. BIOS architecture In recent times, the BIOS has been relegated to a more limited set of functions: •Power on self test. (P.O.S.T.) This includes testing the memory (although the test is not exhaustive). •Putting the hardware in a sane an predictable state (set display card's video; timing parameters to use text mode; setting power manag; initialising hd dsks) • Chipset specific configuration for your machine (configuring the PCI bus and builtin peripherals) • Loading the operating system from the disk (from floppy disk, IDE disk, SCSI, network ...) • Providing basic I/O (keyboard, floppy, hard disk, CDROM). 7
  8. 8. BIOS settings The method of entering the BIOS setup program varies from BIOS manufacturer. Various computer vendors use different methods. You should be able to enter the BIOS by pressing one of the following key combinations before, during or after the P.O.S.T. (usually after): BIOS architecture Del, F2, Ctrl+Alt+Esc, Ctrl+Alt+S, Ctrl+Alt+Ins, Ctrl+Alt+Del (reboot on most PC's), F1, F3, F10, Fn+F1 (laptop), Esc. 8
  9. 9. Buses, ports, IRQs, and DMA Peripheral devices, including those that may be built in to the system board, communicate with the CPU over a bus. PCI and ISA buses /proc/{ioports,interrupts,dma,pci} Common bus type is the Peripheral Component Interconnect or PCI bus Which superseded earlier Industry Standard Architecture or ISA bus. ISA bus - AT bus after the IBM PC-AT first used in 1984. During transition from ISA to PCI bus, systems included both buses with slots. ISA bus supports 8-bit and 16-bit cards, PCI bus support 32-bit and 64-bit devices. Systems include Accelerated Graphics Port or AGP slot special slot based on the PCI 2.1 bus optimized for high bandwidth for graphics cards. replaced by PCI Express or PCI-E bus which addresses limitations of original PCI design. 9
  10. 10. Buses, ports, IRQs, and DMA When Linux is running, there are a number of commands to determine what the BIOS has been doing to your hardware. PCI and ISA buses /proc/{ioports,interrupts,dma,pci} The /proc file system contains a number of virtual files which show the state of your hardware. This is not a real filesystem on disk, but a "pseudo file system" which provides information about the running system. the file /proc/pci contains information about the devices on the system's PCI bus. Older versions of Linux kernel use /proc/pci to list devices plugged into the PCI bus. Current versions use /sbin/lspci. 10
  11. 11. Buses, ports, IRQs, and DMA /proc/pci yourname@yourcomp~> cat /proc/pci PCI devices found: Bus 0, device 0, function 0: Host bridge: Intel Corp. 82845G/GL [Brookdale-G] Chipset Host Bridge (rev 1). Prefetchable 32 bit memory at 0xd0000000 [0xdfffffff]. Bus 0, device 2, function 0: VGA compatible controller: Intel Corp. 82845G/GL [Brookdale-G] Chipset Integrated Graphics Device (rev 1). IRQ 11. Prefetchable 32 bit memory at 0x88000000 [0x8fffffff]. Non-prefetchable 32 bit memory at 0x80000000 [0x8007ffff]. Bus 0, device 29, function 0: USB Controller: Intel Corp. 82801DB USB (Hub #1) (rev 1). IRQ 11. I/O at 0x1800 [0x181f]. ...//... Bus 2, device 8, function 0: Ethernet controller: Intel Corp. 82801BD PRO/100 VE (LOM) Ethernet Controller (rev 129). IRQ 9. Master Capable. Latency=66. Min Gnt=8.Max Lat=56. Non-prefetchable 32 bit memory at 0xc0100000 [0xc0100fff]. I/O at 0x2000 [0x203f]. Ex: 11
  12. 12. Buses, ports, IRQs, and DMA /sbin/lspci yourname@yourcomp~> /sbin/lspci 00:00.0 Host bridge: VIA Technologies, Inc. VT8501 [Apollo MVP4] (rev 03) 00:01.0 PCI bridge: VIA Technologies, Inc. VT8501 [Apollo MVP4 AGP] 00:07.0 ISA bridge: VIA Technologies, Inc. VT82C686 [Apollo Super South] (rev 19) 00:07.1 IDE interface: VIA Technologies, Inc. VT82C586B PIPC Bus Master IDE (rev 06) 00:07.2 USB Controller: VIA Technologies, Inc. USB (rev 0a) 00:07.4 Non-VGA unclassified device: VIA Technologies, Inc. VT82C686 [Apollo Super ACPI] (rev 20) 00:07.5 Multimedia audio controller: VIA Technologies, Inc. VT82C686 AC97 Audio Controller (rev 21) 00:0a.0 CardBus bridge: O2 Micro, Inc. OZ6832/6833 Cardbus Controller (rev 34) 00:0a.1 CardBus bridge: O2 Micro, Inc. OZ6832/6833 Cardbus Controller (rev 34) 01:00.0 VGA compatible controller: Trident Microsystems CyberBlade/i7d (rev 5c) Ex: 12
  13. 13. Buses, ports, IRQs, and DMA When CPU needs to communicate with peripheral device it does through IO port or sometimes just simply port. When CPU wants to send data or control info to peripheral, it writes to a port. When device has data or status ready for the CPU, the CPU reads the data or status from a port. IO Ports /proc/{ioports,interrupts,dma,pci} Most devices have more than one port associated with them, power of 2, as 8, 16 or 32. Data transfer is usually done a byte or two at a time. Devices cannot share ports, so if you have ISA cards, you must ensure that each device has its own port or ports assigned. Originally, this was done using switches or jumpers on the card. later ISA cards used a system called Plug and Play. PCI cards and later all have PnP configuration. 13
  14. 14. Buses, ports, IRQs, and DMA Within /proc file system, file /proc/ioports tells about IO ports available on system and in use by devices for which a kernel module is loaded. If two devices use the same IO ports, then it is unlikely that they will work together. One of them needs to be reconfigured – either by changing jumper settings, plug and play settings, or reconfiguring internal peripherals. IO Ports /proc/{ioports,interrupts,dma,pci} Standard I/O Port Settings 1FO-1F8 - Hard Drive Controller, 16-bit ISA 200-20F - Game Control 210 - Game I/O 220 - Soundcard 278-27F - LPT2 2F8-2FF - COM2 320-32F - Hard Drive Controller, 8-bit ISA 378-37F - LPT1 3B0-3BF - Monochrome Graphics Adapter (MGA) 3D0-3DF - Colour Graphics Adapter (CGA) 3F0-3F7 - Floppy Controller 3F8-3FF – COM1 14
  15. 15. Buses, ports, IRQs, and DMA /proc/ioports yourname@yourcomp~> cat /proc/ioports 0000-001f : dma1 0020-003f : pic1 0040-005f : timer 0060-006f : keyboard 0070-007f : rtc 0080-008f : dma page reg 00a0-00bf : pic2 00c0-00df : dma2 00f0-00ff : fpu 0170-0177 : ide1 01f0-01f7 : ide0 03f8-03ff : serial(auto) 0cf8-0cff : PCI conf1 1000-10ff : VIA Technologies, Inc. VT82C686 AC97 Audio Controller 1000-10ff : via82cxxx_audio 1400-141f : VIA Technologies, Inc. UHCI USB 1400-141f : usb-uhci Ex: I/O port ranges are listed in hexadecimal. The kernel tracks their port numbers so that it can prevent unexpected interference in their operation (user space programs). 15
  16. 16. Buses, ports, IRQs, and DMA So how does the CPU know when the last output is finished or when data is waiting to be read? Interrupts /proc/{ioports,interrupts,dma,pci} this information is available in a status register which may be accessed by reading one (or more) of the IO ports associated with a device. This as 2 problems: 1.CPU has to spend time checking the status 2.if the device has data coming from somewhere, such as an attached modem, the data must be read by the CPU in a timely fashion otherwise it might be overwritten by the next available data byte The dual problems of not wasting unnecessary CPU cycles and ensuring that data is read or written in a timely fashion are addressed by the concept of interrupts. 16
  17. 17. Buses, ports, IRQs, and DMA Interrupts /proc/{ioports,interrupts,dma,pci} Interrupts are also called Interrupt Requests or IRQs. When something happens in a device that CPU needs to know about, the device raises an interrupt and CPU temporarily stops whatever else it was doing to deal with the situation. Standard IRQ Settings IRQ 0 - System Timer IRQ 1 - Keyboard IRQ 2(9) - Video Card IRQ 3 - COM2, COM4 IRQ 4 - COM1, COM3 IRQ 5 - Available (LPT2 or Sound Card) IRQ 6 - Floppy Disk Controller IRQ 7 - LPT1 Standard IRQ Settings IRQ 8 - Real-Time Clock IRQ 9 - Redirected IRQ 2 IRQ 10 - Available IRQ 11 - Available IRQ 12 - PS/2 Mouse IRQ 13 - Math Co-Processor IRQ 14 - Hard Disk Controller IRQ 15 – Available Interrupt numbers are decimal in the range 0 through 15. Originally, each device had its own private IRQ 17
  18. 18. Buses, ports, IRQs, and DMA /proc/interrupts yourname@yourcomp~> cat /proc/interrupts CPU0 0: 560557 XT-PIC timer 1: 11392 XT-PIC keyboard 2: 0 XT-PIC cascade 5: 0 XT-PIC usb-uhci, via82cxxx 8: 1 XT-PIC rtc 10: 139 XT-PIC O2 Micro, Inc. 6832, O2 Micro, Inc. 6832 (#2) 12: 114626 XT-PIC PS/2 Mouse 14: 37059 XT-PIC ide0 15: 1 XT-PIC ide1 NMI: 0 Ex: Today, devices share IRQs, so that when one interrupts the CPU, an interrupt handler checks to see if the interrupt is for it and, if not, passes it to the next handler in the chain. (whe must look in the bootstrap for the shared IRQs) 18
  19. 19. Buses, ports, IRQs, and DMA DMA /proc/{ioports,interrupts,dma,pci} Communication with peripheral devices through IO ports occurs a byte or two at a time. For a fast device, servicing interrupts that could be using a lot CPUs capability. A faster method is to use Direct Memory Access or DMA. Where a few IO instructions tell the device where in RAM to read or write data. Then the DMA controller provides hardware management of the actual transfer of data between RAM and the peripheral device. 19
  20. 20. Buses, ports, IRQs, and DMA /proc/dma yourname@yourcomp~> cat /proc/dma 4: cascade Ex: Most devices will only request one of limited number of DMA channels when IO is actually happening. So the DMA File will frequently look empty. (whe must look in the bootstrap for the request DMA) 20
  21. 21. Buses, ports, IRQs, and DMA boot messages view Messages displayed during boot up correspond to kernel initializing the devices installed in the system. The messages are usually appended to var/log/messages, and can be displayed with dmesg after the system has booted up. We can use the output to filter from the bootstrap messages about IRQs or DMA dmesg yourname@yourcomp~> dmesg | grep -i irq PCI: Discovered primary peer bus 01 [IRQ] PCI: Using IRQ router PIIX [8086/24c0] at 00:1f.0 PCI: Found IRQ 5 for device 00:1f.1 PCI: Sharing IRQ 5 with 00:1d.2 Serial driver version 5.05c (2001-07-08) with MANY_PORTS MULTIPORT … // … Ex: yourname@yourcomp~> dmesg | grep -i dma ide0: BM-DMA at 0x1860-0x1867, BIOS settings: hda:DMA, hdb:pio ide1: BM-DMA at 0x1868-0x186f, BIOS settings: hdc:DMA, hdd:DMA hda: 312581808 sectors (160042 MB) w/8192KiB Cache, CHS=19457/255/63, UDMA(100) hdc: 398297088 sectors (203928 MB) w/7936KiB Cache, CHS=24792/255/63, UDMA(33) ehci-hcd 00:1d.7: enabled 64bit PCI DMA 21
  22. 22. Plug and play Early PCs allocated fixed port numbers and IRQs for particular devices, such as keyboard or parallel printer port. This made it difficult to add new devices or even run two devices of the same type such as two modems or two printers. Plug and Play The first serial port was usually called COM1 and the second COM2. Linux systems usually refer to these as ttyS0 and ttyS1. Some cards were configurable usually with hardware jumpers which allowed a modem to operate as COM1 or COM2. As devices proliferated and the original space allocated for IO port addresses and IRQs became scarce, Plug and Play or PnP was developed. The idea was to allow a device to tell the system how many and what kind of resources it needed and the BIOS to then tell the device which particular resources it should use. 22
  23. 23. Plug and play This semi-automatic configuration was introduced with the IBM PS/2 which used a bus architecture called microchannel. Later, the idea, and the plug and play name were used for ISA cards, particularly modems and sound cards which were popular add-on cards. PCI and later buses advanced the idea and devices are inherently plug and play. Plug and Play In ISA Cards: Ports cannot be shared between two devices; each device must have its own port. The same applies for DMA channels, and in general cannot share IRQs You may be able to resolve conflicts using tools to reassign some of the ports or IRQs on non- PnP devices in order to get a working system. 23
  24. 24. Plug and play Prior to the 2.4 kernel, package called isapnptools allows to configure PnP devices. isapnp command interprets a config file (/etc/isapnp.conf) to config PnP devices. This is usually done during the Linux boot process. pnpdump command scans PnP devices and dumps a list of resources in file that the PnP cards need or would prefer to use. The format of the file output is suitable for use by the isapnp command, once you uncomment the actual commands that you wish to use. man pages for isapnp and pnpdump Plug and Play 24
  25. 25. Plug and play pnpdump yourname@yourcomp# /sbin/pnpdump > /etc/isapnp.confEx: Sound Card Config For Kernel 2.2 and before: Use isapnptools. pnpdump dumps all the possible combinations of the devices. You then edit the file it produces, and it becomes your /etc/isapnp.conf file. Plug and Play The resulting file contains commented lines. Remove comments 25
  26. 26. Plug and play Plug and Play # Card 1: (serial identifier 48 00 1b e3 d6 e4 00 8c 0e) # Vendor Id CTL00e4, Serial Number 1827799, checksum 0x48. # Version 1.0, Vendor version 1.0 # ANSI string -->Creative SB AWE64 PnP<-- # Vendor defined tag: 73 02 45 20 (CONFIGURE CTL00e4/1827799 (LD 0 # ANSI string -->Audio<-- (INT 0 (IRQ 9(MODE +E))) (DMA 0 (CHANNEL 3)) (DMA 1 (CHANNEL 7)) (IO 0 (SIZE 16) (BASE 0x0220)) (IO 1 (SIZE 2) (BASE 0x0330)) (IO 2 (SIZE 4) (BASE 0x0388)) (NAME "CTL00e4/1827798[0]{Audio }") # End dependent functions (ACT Y) )) /etc/isapnp.conf Ex: Parameters [sb io=0x220, irq=9, dma=3, dma16=7, mpu_io=0x330, midi=0x388] must be loaded to the sound card module in: /etc/modules.conf after viewed with modprobe cmd Once /etc/isapnp.conf exists, you can configure the card(s) to the chosen settings by running isapnp, and then load the sound module with modprobe 26
  27. 27. Plug and play Since the 2.4 kernel, the module isapnp handles the configuration of ISA PNP PnP support has been integrated into the Linux kernel. And the isapnptools package has become obsolete. It was removed in May 2002 from RedHat 7.3. You can use the lspnp command (part of kernel-pcmcia-cs package) to display information about PnP devices. You will find this information in the /proc file system if the BIOS found PnP devices during initialization. The file /proc/bus/pnp will contain this information. not be present on a PCI-only system. Plug and Play 27
  28. 28. IDE Hard drives BIOS is involved in the usage of IDE disks: 1.BIOS must load the essential parts of the operating system from the disk during booting. 2.BIOS must provide correct information about the installed media to the operating system. This information is the number of cylinders, heads and sectors on the disk. •In the past these used to correspond to nº. spinning platters, nº. magnetic read-write heads and density of the magnetic media. •Although most hard disks have 1 read-write head, the nº. reported depends on the size of the disk. BIOS and IDE drive sizes In order to do the task of loading the operating system, the operating system loader has to request data from exact locations on the disk. Interrupt 13h BIOS function to read a sector of data from disk is accessed via software interrupt, interrupt 13h (hexadecimal). To read from disk using interrupt 13h, you specify exact head, cylinder and sector numbers. 28
  29. 29. IDE Hard drives IDE drives are formatted into sectors, data units of 512 bytes. A drive might contain multiple rotating disk platters, so the sectors are arranged in concentric circles with each circle called a cylinder. Data from a particular platter is read or written by a head. To find data in a particular sector, the disk moves the head assembly to the cylinder, selects the appropriate head and waits for the right sector to come under the head. This is the disk geometry notion or CHS (Cylinder, Head and Sector) addressing. disk geometry Disk geometry refers to the logical dimensions of the disk – how many cylinders, heads and sectors the disk controller can access. 29
  30. 30. IDE Hard drives Early BIOS implemented a limit to the size permitted for each of C, H and S values and DOS, implemented a different limitation. During the 1990s, Disk sizes quickly outstripped the artificial CHS limitations imposed by BIOS and DOS. Several intermediate strategies involved translating real CHS values to "virtual" values that would meet the constraints, either in the BIOS itself or by means of low level software routines such as Ontrack's Disk Manager software. BIOS and IDE drive sizes Even without the artificial limits of BIOS or DOS, the CHS design allows for up to 65536 cylinders, 16 heads, and 255 sectors/track. This limits the capacity to 267386880 sectors, or approximately 137 GB. Note: disk capacities, unlike some other PC values, are measured in powers of 10, 1GB=1,000,000,000 bytes. 30
  31. 31. IDE Hard drives The solution was to have the system ignore the geometry and leave that to the drive to figure out. The system, instead of asking for a CHS value simply asks for a Logical Block Address or LBA and the drive electronics figure out which real sector to read or write. The process was standardized in 1996 with the adoption of the ATA-2 standard (ANSI standard X3.279-1996, AT Attachment Interface with Extensions). BIOS and IDE drive sizes BIOS is needed to boot a system, so booting from a hard drive requires that the BIOS understand enough of the disk layout to locate and load the initial program that will then load the full operating system. An older BIOS that does not understand LBA disks will probably be limited to booting from within the first 1024 cylinders of a disk, or at least the first 1024 cylinders as the BIOS understands the disk geometry! 31
  32. 32. IDE Hard drives Many Linux partitioning tools will warn you that a partition extends beyond the 1024 cylinder limit BIOS and IDE drive sizes Summary of limits The various modes of accessing a disk are subject to the following limitations: Method Disk size limit Cylinders Bits Normal mode (CHS addressing) 504Mb 1024 24 Interrupt 13h 8.4Gb 1024 24 Large mode (ECHS addressing) 8.4Gb 16384 24 ATA interface 128Gb - 28 Interrupt 13h extended 9.4 x 1021 bytes - 32 LBA mode 9.4 x 1021 bytes - 32 There’s kernel patchs to address disks with up to 48 /64 bits. 32 AHCI (Advanced Host Controller Interface) application programming interface that defines one mode of operation for SATA. Read more: Difference Between AHCI and IDE | Difference Between | AHCI vs IDE http://www.differencebetween.net/technology/difference-between-ahci-and-ide/#ixzz1kaVH2SiX
  33. 33. IDE Hard drives Disk with 250 GB. BIOS view of a large LBA disk Ex. 33
  34. 34. IDE Hard drives To show the disk available on a Linux system use the hdparm -I /dev/hda command. Linux and IDE drive sizes hdparm /dev/hda: ATA device, with non-removable media Model Number: Maxtor 6Y250P0 Serial Number: Y638VBWE Firmware Revision: YAR41BW0 Standards: Supported: 7 6 5 4 Likely used: 7 Configuration: Logical max current cylinders 16383 65535 heads 16 1 sectors/track 63 63 -- CHS current addressable sectors: 4128705 LBA user addressable sectors: 268435455 LBA48 user addressable sectors: 490234752 device size with M = 1024*1024: 239372 MBytes device size with M = 1000*1000: 251000 MBytes (251 GB) .. // .. Ex: Note that CHS values limit addressing to 4,128,705 sectors and the LBA value is set to 268,435,455 sectors or 137GB. These values together imply that the real capacity is in the LBA48 value. This is 490,234,752 sectors or 251GB. 34
  35. 35. IDE Hard drives By default, a PC will boot from the first IDE drive in the system. systems have BIOS settings that will allow you to override this, but most will boot this way. The system will first load a small piece of code from the master boot record and that will, in turn, provide information on which partition to boot. (Linux boot loaders) Boot Order and MBR Linux disk names A important Linux file system, is the /dev filesystem. Like /proc, is a pseudo file system which describes the devices that are or could be on a Linux system. Within /dev filesystem there are entries as /dev/hda, /dev/hda5, /dev/sda, /dev/sdb1, etc. There are entries for other device types, and disks they start with: /dev/hd or /dev/sd. Devices that start with /dev/hd, such as /dev/hda or /dev/hda5 refer to IDE drives. The 1st drive on 1st IDE controller is /dev/hda, the 2nd drive on 1st IDE controller is /dev/hdb; The 1st drive on 2st IDE controller is /dev/hdc, the 2nd drive on 2st IDE controller is /dev/hdd; 35
  36. 36. IDE Hard drives /dev/hd? and /dev/sd? entries yourname@yourcomp~> ls /dev/hd? /dev/hda /dev/hdd /dev/hdg /dev/hdj /dev/hdm /dev/hdp /dev/hds /dev/hdb /dev/hde /dev/hdh /dev/hdk /dev/hdn /dev/hdq /dev/hdt /dev/hdc /dev/hdf /dev/hdi /dev/hdl /dev/hdo /dev/hdr Ex: yourname@yourcomp~> ls /dev/hd? /dev/sda /dev/sde /dev/sdi /dev/sdm /dev/sdq /dev/sdu /dev/sdy /dev/sdb /dev/sdf /dev/sdj /dev/sdn /dev/sdr /dev/sdv /dev/sdz /dev/sdc /dev/sdg /dev/sdk /dev/sdo /dev/sds /dev/sdw /dev/sdd /dev/sdh /dev/sdl /dev/sdp /dev/sdt /dev/sdx 36
  37. 37. IDE Hard drives System has 2 IDE drives (hda and hdc) and a DVD-RW drive (hdd). No hdb, indicating that there is no second drive on the first IDE controller. Drive hdc is actually a container (or extended partition) for the logical partitions - Primary partition (hdc1) 4 logical partitions (hdc5, hdc6, hdc7, and hdc8). An IDE drive can have up to four primary partitions and an unlimited number of logical partitions. Hard drives found during bootup yourname@yourcomp~> dmesg | grep "[hs]d[a-z]" Kernel command line: ro root=LABEL=RHEL3 hdd=ide-scsi ide_setup: hdd=ide-scsi ide0: BM-DMA at 0x1860-0x1867, BIOS settings: hda:DMA, hdb:pio ide1: BM-DMA at 0x1868-0x186f, BIOS settings: hdc:DMA, hdd:DMA hda: WDC WD1600JB-00EVA0, ATA DISK drive hdc: Maxtor 6Y200P0, ATA DISK drive hdd: SONY DVD RW DRU-700A, ATAPI CD/DVD-ROM drive hda: attached ide-disk driver. hda: host protected area => 1 hda: 312581808 sectors (160042 MB) w/8192KiB Cache, CHS=19457/255/63, UDMA(100) hdc: attached ide-disk driver. hdc: host protected area => 1 hdc: 398297088 sectors (203928 MB) w/7936KiB Cache, CHS=24792/255/63, UDMA(33) hda: hda1 hda2 hda3 hda4 < hda5 hda6 hda7 hda8 hda9 hda10 hda11 > hdc: hdc1 < hdc5 hdc6 hdc7 hdc8 > hdd: attached ide-scsi driver. Ex: 37
  38. 38. IDE Hard drives Historically, devices such as sda and sdb were SCSI disks. From 2.4 kernel, IDE CD and DVD devices were usually handled through SCSI emulation. Device often appeared in /dev as something like /dev/cdrom which was a symbolic link to the SCSI emulated device. Hard drives found during bootup yourname@yourcomp~> dmesg | grep "[hs]d[a-z]" Kernel command line: ro root=LABEL=RHEL3 hdd=ide-scsi ide_setup: hdd=ide-scsi ide0: BM-DMA at 0x1860-0x1867, BIOS settings: hda:DMA, hdb:pio ide1: BM-DMA at 0x1868-0x186f, BIOS settings: hdc:DMA, hdd:DMA hda: WDC WD1600JB-00EVA0, ATA DISK drive hdc: Maxtor 6Y200P0, ATA DISK drive hdd: SONY DVD RW DRU-700A, ATAPI CD/DVD-ROM drive ..// .. hdd: attached ide-scsi driver. Ex: yourname@yourcomp~> ls -l /dev/cdrom lrwxrwxrwx 1 root root 9 Jan 11 17:15 /dev/cdrom -> /dev/scd0 Ex: Ex. show that /dev/cdrom is link to /dev/scd0 rather than to /dev/hdd as might have been expected. •Kernel parameter hdd=ide-scsi is the indicator that the ide-scsi driver was attached for hdd in scd Today, both USB and SATA storage devices appear as sd, rather than hd, devices. 38
  39. 39. Legacy peripherals Peripherals such as serial or parallel ports that are usually integrated into a motherboard, and have seen some standard IO port and IRQ assignments. Serial ports, in particular, have been used for connecting a variety of devices and they have a history of being hard to configure. Legacy peripherals With IEEE 1394 (Firewire) and USB devices, automatic configuration and hot plugging replaced ensuring correct serial or parallel port configuration. A Legacy-free system does not support the standard serial or parallel ports. Neither does it support floppy drive or PS/2 connected keyboard or mouse. 39
  40. 40. Legacy peripherals The legacy serial ports are known as COM1 through COM4. A system with a single serial port (originally 25-pin DB25 conn but now commonly a 9-pin DB9 conn) it will use default base address and IRQ for COM1 = IO port 3F8 and IRQ 4. Serial ports (COMn) Serial Ports Standard IO port addresses and IRQs: Name Address IRQ Linux device COM1 3F8-3FF 4 /dev/ttyS0 COM2 2F8-2FF 3 /dev/ttyS1 COM3 3E8-3EF 4 /dev/ttyS2 COM4 2E8-2EF 3 /dev/ttyS3 Notice COM1 and COM3 share IRQ 4 and COM2 and COM4 share IRQ 3. Unless the driver and the device can actually share interrupt, or a device does not use interrupts, this means that systems will use only COM1 and COM2. 40
  41. 41. Legacy peripherals The legacy parallel ports are known as LPT1 through LPT4 Usually only two are present. A system with single parallel port will use default base address and IRQ for LPT1 = IO port 378 and IRQ 7. Parallel ports (LPTn) Parallel Ports Standard IO port addresses and IRQs: Name Address IRQ Linux device LPT1 378-37F 7 /dev/lp0 LPT2 278-27F 5 /dev/lp1 LPT* 3BC-3BE /dev/lp2 Note that IO ports 3BC-3BE were originally used on a Hercules graphics adapter that also had a parallel port. Many BIOS systems will assign this range to LPT1 and then the other two ranges would become LPT2 and LPT3 respectively instead of LPT1 and LPT2 Many systems do not use interrupts for printers, so the IRQ may or may not actually be used. It is also common to share IRQ7 for sound (Sound Blaster compatible). 41
  42. 42. Legacy peripherals The parallel ports were originally used for printing with data flowing to the printer and a few lines reserved for reporting status. Later, the parallel port was used for attaching other devices (CD-ROMs, tape drives), so the output-only nature of the data flow changed to a bidirectional data flow. Parallel ports (LPTn) Current standard applicable to parallel ports is: IEEE Std. 1284-1994 Standard Signaling Method for a Bi-Directional Parallel Peripheral Interface for Personal Computers, defined by 5 signaling modes in BIOS with the common: bi-directional, EPP, ECP and EPP and ECP •Bi-directional; •EPP (Enhanced Parallel Port) designed for CD-ROMs and Tape drives that require large amounts of data to flow in either direction. •ECP (Enhanced Capabilities Port) designed for use with printers The default BIOS choice is likely to be ECP. 42
  43. 43. Legacy peripherals If the system has a legacy floppy disk controller, it will use ports 3F0-3F7. Floppy disk port The keyboard/mouse controller uses ports 0060 and 0064 for legacy keyboards and mice. That is, those connected by a round PS2 connector. Keyboard and mouse Many systems will generate a Power-On-Self-Test (POST) error if a keyboard is not attached. Most machines have BIOS options to allow clean startup without keyboard or mouse. You may need a customized boot disk or CD to perform a Linux system install 43 Servers frequently run without keyboard (or mouse). Management is performed over network using web admin tools, or cmdline interface (telnet or ssh). Installation on keyboardless system is accomplished using a terminal (or terminal emulator) attached through a serial port. Or, emulate a serial connection over a LAN.
  44. 44. Modems and sound cards Modem stands for modulator/demodulator (Modulation) Modem converts binary information to analogue signals (Demodulation) Modem decodes analogue signals into binary binary signals are given by the computer, and analogue signals fly over the telephone lines. Modems In the early days of PCs, modems were external devices attached to a serial port. Later, modems were implemented on cards installed inside the computer. Another cost reduction occurred when: Some functions done by a modem where transferred to software in the PC. This modems where called: softmodem, HCF modem, HSP modem, HSF modem, controllerless modem, other terms. Those modems were designed to reduce cost of systems which ran MS Windows. The term winmodem is used for such devices. Although Winmodem® is a registered trademark of U.S. Robotics, who manufactured several modems under that name. You will generally have to load a kernel module to make a Winmodem work. This may require some research and recompiling the Linux kernel. 44
  45. 45. Modems and sound cards Most external modems internal modems will work under Linux without problem. Some of the modems that require software assistance from the PC operating system will also work with Linux. Software-assisted modems that work under Linux are often called linmodems and there is a site dedicated to these (linmodems.org). The first step should be to check linmodems site and download the latest version of the scanModem tool. This will tell you about available drivers for your modem. Modems Modems discussed are asynchronous modems. Another class of modems, are called synchronous modems (HDLC, SDLC, BSC, ISDN) •Asynchronous Transmission is concerned with transmitting individual bytes of information •Synchronous Communications is concerned with transmitting whole blocks of information 45
  46. 46. Modems and sound cards Modems Most Linux communications occurs using the Internet Protocol or IP So a Linux system will need to run IP over asynchronous line which was not originally designed for block protocols such as IP. The first method of doing this was called Serial Line Interface Protocol or SLIP. A variant using compressed headers is called CSLIP. Now, Internet Service Providers (ISPs) support dialup connections using Point-to- Point Protocol or PPP. The Linux Networking-HOWTO and The Network Administrators' Guide from Linux Documentation Project provide info on SLIP, CSLIP, PPP configuration. Using tools as kppp program gui for ppp or wvdial for dialconn or general configs with the system-config-network tool. 46
  47. 47. Modems and sound cards Modems When communicating using modem, there are a number of settings that you may need to make on your Linux system, and tell Linux where the RS232 port is. Set the speed of communications between your system and the modem. (usually higher than nominal line speed and set to the maximum supported by the serial port chipset and the modem) To set/view modem parameters used by the serial driver is with the setserial program. yourname@yourcomp~# setserial /dev/ttyS0 /dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4 [root@attic4 ~]# setserial -G /dev/ttyS0 /dev/ttyS0 uart 16550A port 0x03f8 irq 4 baud_base 115200 spd_normal skip_test Ex: setserial does not probe the hardware. It tells serial driver what parameters to use unless using the parameters -autoconfig and -auto_irq. (ask kernel to probe hardware). 47
  48. 48. Modems and sound cards Sound cards Creative Labs Sound Blaster sound cards have set industry standards. Even though other brands of excellent exist, many of these provide compatibility mode for one or more of the Sound Blaster series. •The original Sound Blaster card was an 8-bit card that worked in the original IBM PC. •Later 16-bit models for the PC-AT and compatibles used the 16-bit PC-AT or ISA bus. •Today, these cards use PCI bus or provide a sound chip compatibility onboard. •Sound devices may also be attached through USB connections. Ports used by an ISA bus Sound Blaster card are 0220-022F. base addresses of 240, 260 or 280 were also configurable. IRQ is usually configurable, with common choices 2, 5, 7, or 10. The default setting is to use IRQ 5. Cards could usually be configured to use alternate DMA channels too. Sound cards had interface to attach a MIDI Device (Musical Instrument Digital Interface). This interface emulates the Roland MPU-401. Standard ports used by the MPU-401 ISA interface are 0200-020F. 48
  49. 49. Modems and sound cards Sound cards Configuring Linux sound support Since 2.4 and 2.6 kernels have sound support for a wide variety of sound devices built in to the kernel, usually as modules. Like other devices, use isapnp.conf with pnpdump cmd for ISA devices, or lspci cmd for PCI devices to display information about the device. yourname@yourcomp~# lspci | grep aud 00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 01) Ex: BUT Kernel modules are the preferred way to provide support for devices. 49
  50. 50. Modems and sound cards Configuration Exemple for Kernel 2.2 and before : • Find values I/O, IRQ, DMA. Free values by by checking /proc/ioports, /proc/interrupts and /proc/dma. • Use pnpdump to dump all possible combinations of the devices. • Edit the file produced by removing comments, and it becomes your /etc/isapnp.conf file. yourname@yourcomp# /sbin/pnpdump > /etc/isapnp.confEx 1: # Card 1: (serial identifier 48 00 1b e3 d6 e4 00 8c 0e) # Vendor Id CTL00e4, Serial Number 1827799, checksum 0x48. # Version 1.0, Vendor version 1.0 # ANSI string -->Creative SB AWE64 PnP<-- # Vendor defined tag: 73 02 45 20 (CONFIGURE CTL00e4/1827799 (LD 0 # ANSI string -->Audio<-- (INT 0 (IRQ 9(MODE +E))) (DMA 0 (CHANNEL 3)) (DMA 1 (CHANNEL 7)) (IO 0 (SIZE 16) (BASE 0x0220)) (IO 1 (SIZE 2) (BASE 0x0330)) (IO 2 (SIZE 4) (BASE 0x0388)) (NAME "CTL00e4/1827798[0]{Audio }") # End dependent functions (ACT Y) )) /etc/isapnp.conf 50
  51. 51. Modems and sound cards Configuration Exemple for Kernel 2.2 and before : Ex 2: ... // ... # Vendor defined tag: 73 02 45 20 (CONFIGURE CTL00e4/1827799 (LD 0 # ANSI string -->Audio<-- (INT 0 (IRQ 9(MODE +E))) (DMA 0 (CHANNEL 3)) (DMA 1 (CHANNEL 7)) (IO 0 (SIZE 16) (BASE 0x0220)) (IO 1 (SIZE 2) (BASE 0x0330)) (IO 2 (SIZE 4) (BASE 0x0388)) (NAME "CTL00e4/1827798[0]{Audio }") # End dependent functions (ACT Y) )) /etc/isapnp.conf File • Use command modprobe to see parameters to load on the sound card module • [options sb io=0x220, irq=9, dma=3, dma16=7, mpu_io=0x330, midi=0x388] must be loaded the sound card module in: /etc/modules.conf modprobe sb io=0x220, irq=9, dma=3, dma16=7, mpu_io=0x330, midi=0x388 51
  52. 52. Modems and sound cards Configuration Exemple for Kernel 2.2 and before : Ex 3: # /sbin/isapnp /etc/isapnp.conf # modprobe sb • Once /etc/isapnp.conf exists, you can configure the card(s) to the chosen settings by running isapnp, and then load the sound module modprobe sb Since the 2.4 kernel, the module isapnp handles the configuration of ISA PNP PnP support has been integrated into the Linux kernel and the isapnptools package has become obsolete. It was removed in May 2002 from RedHat 7.3. 52
  53. 53. Modems and sound cards Sound cards sndconfig is the console based RedHat sound configuration tool. Automatically sets ISA PnP sound cards by configuring them to default settings as given by pnpdump. It is not included on a default installation Sound support on < 2.4 is provided by Open Sound System (OSS) Free drivers. Many systems today use the Advanced Linux sound architecture or ALSA drivers. sndconfig utility was created by Red Hat to assist in configuring ISA PnP sound cards. It also works with PCI sound cards. This utility may be present on systems that do not use the ALSA drivers. Modern module support has made it unnecessary. The utility will probe for sound cards, lay a test sound of Linus Torvalds speaking, and then update the /etc/modules.conf file (or /etc/modules). 53
  54. 54. Modems and sound cards Sound cards Sndconfig configuration tool. Ex: 54
  55. 55. Modems and sound cards Sound cards Sndconfig configuration tool. Ex: 55
  56. 56. Modems and sound cards Sound cards Kernel modules, the preferred support for devices. Are modules that need only to be loaded for the devices and may be unloaded and reloaded without rebooting the system. yourname@yourcomp~# cat /etc/modprobe.conf alias eth0 e100 alias snd-card-0 snd-intel8x0 install snd-intel8x0 /sbin/modprobe --ignore-install snd-intel8x0 && /usr/sbin/alsactl restore >/dev/null 2>&1 || : remove snd-intel8x0 { /usr/sbin/alsactl store >/dev/null 2>&1 || : ; }; /sbin/modprobe -r --ignore-remove snd-intel8x0 alias usb-controller ehci-hcd alias usb-controller1 uhci-hcd < Kernel 2.4 Kernel module configuration information is stored in: /etc/modules.conf > Kernel 2.6 Kernel module system was redesigned and information is stored in: /etc/modprobe.conf In either case, lsmod cmd formats contents of /proc/modules and display status of loaded modules. /etc/modprobe.conf (2.6 kernel)Ex: 56
  57. 57. Modems and sound cards Sound cards Ex: yourname@yourcomp~# lsmod |egrep '(snd)|(Module)' Module Size Used by snd_intel8x0 34689 1 snd_ac97_codec 75961 1 snd_intel8x0 snd_seq_dummy 3653 0 snd_seq_oss 37057 0 snd_seq_midi_event 9153 1 snd_seq_oss snd_seq 62289 5 snd_seq_dummy,snd_seq_oss,snd_seq_midi_event snd_seq_device 8781 3 snd_seq_dummy,snd_seq_oss,snd_seq snd_pcm_oss 51185 0 snd_mixer_oss 17857 1 snd_pcm_oss snd_pcm 100169 3 snd_intel8x0,snd_ac97_codec,snd_pcm_oss snd_timer 33605 2 snd_seq,snd_pcm snd 57157 11 snd_intel8x0,snd_ac97_codec,snd_seq_oss, snd_seq,snd_seq_device,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer soundcore 10913 1 snd snd_page_alloc 9669 2 snd_intel8x0,snd_pcm Sound related output from lsmod (2.6 kernel) 57
  58. 58. SCSI devices SCSI overview SCSI - Small Computer System Interface interface designed for connecting streaming devices (tapes and block storage devices as disks, CD-ROMs, and DVDs). Also used for scanners and printers. SCSI was designed to allow multiple devices on the bus. One device called the controller has responsibility for managing the bus. SCSI devices may be either internal or external. 58 There are 3 major releases of SCSI standards from the American National Standards Institute (ANSI). http://www.scsilibrary.com/
  59. 59. SCSI devices SCSI-1 original standard (X3.131-1986), now usually called SCSI-1. Supported up to 8 devices on a cable and uses passive termination. This standard has now been withdrawn interface of 8 bits parallel with maximum speed of 5 MBps (megabytes/sec). SCSI standard was designed for disks, very flexible and used for other devices, scanners and slower devices such as Zip. Originally FConnection used a 50 connector cable with Centronics connector, later with a 50-pin D-shell connector, similar to a DB-25 RS-232 serial connector 59 http://www.scsi4me.com/scsi-connectors.htm http://www.scsilibrary.com/cable.html
  60. 60. SCSI devices SCSI-2 ANSI standard X3.131-1994 in 1994. speed of the bus to 10MBps and introduced wide/16-bit data transfers. (16-bit bus running at 10MBps can transfer 20MBps of data). 50-connector cable was used for 8-bit - narrow SCSI devices, 68-connector cable was used for 16-bit - wide SCSI devices. SCSI-2 introduced differential signaling to improve quality at higher speeds. called High Voltage Differential or HVD signaling - HVD has active termination requirements. Its possible to mix 8-bit and 16-bit devices. SCSI-2 supports up to 16 devices on a cable and 8 may be narrow. 60
  61. 61. SCSI devices SCSI-2 61 Ex:
  62. 62. SCSI devices SCSI-2 62 Ex:
  63. 63. SCSI devices SCSI-3 ANSI standard X3.270-1996 known as SCSI-3 Architecture Model or SAM. (Earlier SCSI standards are now in the SCSI Parallel Interface or SPI standards) Speed - 16-bit devices with 320MBps data transfers at bus speed of 160MBps. 63 new connector: Single Connector Attachment or SCA SCA is an 80-pin connector only used for wide (16-bit) devices. There are two versions of connector: SCA-1 and SCA-2, is used in most systems. There are Single-Ended (SE) and Low Voltage Differential (LVD) types of the SCA. SCA has only one plug which carries data and power - allows devices to be safely hot-plugged . Server Racks; RAID storage systems; Network Attached Storage. SCSI-3 introduced Fiber Channel SCSI with support to 126 devices per bus With connection of fiber channel links - 1GBps or 2GBps for distances to several kilometers.
  64. 64. SCSI devices SCSI-3 64 Ex: http://www.pcguide.com/ref/hdd/if/scsi/cablesSCA-c.html http://open-source-experiments.blogspot.com/2008/04/birds-eye-view-of-end-configuration.htmlhttp://open-source-experiments.blogspot.com/2008/04/birds-eye-view-of-end-configuration.html
  65. 65. SCSI devices SCSI termination SCSI bus requires each end of the bus to be terminated. use the appropriate type of terminator for your bus; passive, HVD or LVD. •If mixing wide and narrow devices the termination for narrow devices may occur in a different place to the termination for wide devices. •If controller is controlling only an internal bus or only an external bus, it will provide termination, automatically or via BIOS configuration. •If controller is controlling both internal and an external segment, normally will not provide termination. 65 Termination could be via switch, jumper. Usually a terminator block plugged into the cable.
  66. 66. SCSI devices SCSI termination 66 Ex:
  67. 67. SCSI devices SCSI Ids Every device, and the controller, have ID, represented by a number. Controller is generally assigned ID 7. •Narrow (8-bit) SCSI - ID numbers range from 0 to 7. •Wide SCSI adds numbers 8 through 15. Narrow devices only use ID numbers 0 through 7 - Wide devices may use 0 through 15. •ID are set via jumpers, switches or software. •Devices with Single Connector Attachment (SCA) have auto ID assigned as these devices may be hot-plugged. 67
  68. 68. SCSI devices SCSI Ids Priority 68 Devices on SCSI bus have priority. •Narrow devices: 0 (lowest) - 7 (highest) controller at address7 = highest priority. •Wide SCSI: 8 (lowest) - 15 (highest), with 15 having lower priority than 0. Priority sequence is: 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7. devices that cannot tolerate delays (DVD recorders) must have high priority IDs •RAID controllers may present a single ID to the bus but may incorporate several disks. •SCSI addressing also as a Logical Unit Number or LUN. Tapes and single disk drives do not report a LUN or report an LUN of 0. SCSI adapter supports more than one SCSI cable or channel, there may be multiple SCSI adapters in a system. Full ID of a device consists of: - Adapter number - Channel number - Device ID - LUN.
  69. 69. SCSI devices Linux names and files for SCSI devices 69 To a IDE controller that supports one or two hard drives. Linux assigns names to IDE devices, as /dev/hda and /dev/hdc. With SCSI there’s a mix of hard drives, tapes, CD and DVD drives. Linux will assign device names as devices are detected during boot. • 1st hard drive on 1st channel of 1st adapter will become /dev/sda, 2nd /dev/sdb, … • 1st tape drive will be /dev/st0, 2nd /dev/st1, ... • 1st CD will be /dev/sr0 or /dev/scd0 , 2nd /dev/sr1 or /dev/scd1, … Devices using SCSI emulation, such as USB storage devices and (prior to the 2.6 kernel) IDE CD or DVD drives will also be allocated names in this namespace. Important: Numbering is redone at each boot. If you add or remove a SCSI hard drive or device, then all drives or devices will have different device names next time you boot.
  70. 70. SCSI devices Linux names and files for SCSI devices 70 An example of Linux SCSI device name is /dev/sda, (first SCSI hard disk) Name Meaning Usage sd SCSI disk fdisk, mount and hdparm sr or scd SCSI CD ROM Audio data CD ROMs st SCSI tape tar, cpio, and mt (magnetic tape) for control sg SCSI generic scanners (SANE), CD writers (cdrecord, cdrdao) and reading audio CD's digitally Character interface (cdda2wav, cdparanoia) kernel supplies to the SCSI adapter: •host – SCSI adapter number: SCSI adapter is a host on SCSI bus. The numbers start at 0 and are allocated arbitarily. •bus – Channel number: A single SCSI adapter may have a number of SCSI buses attached. •target – id number: Which remote host on the SCSI bus is being addressed. •lun – Logical Unit Number: Which of the devices attached to the remote host is being addressed. Sometimes bus 1, target 3 and lun 40 is written as “1,3,0”.
  71. 71. SCSI devices SCSI devices Info in Linux 71 In directory /proc/scsi you will find useful information about the SCSI subsystem. /proc/scsi/scsi lists attached SCSI devices. Ex: yourname@yourcomp~# cat /proc/scsi/scsi Attached devices: Host: scsi0 Channel: 00 Id: 00 Lun: 00 Vendor: IBM Model: DGHS09U Rev: 03E0 Type: Direct-Access ANSI SCSI revision: 03 Host: scsi0 Channel: 00 Id: 06 Lun: 00 Vendor: PIONEER Model: CD-ROM DR-U06S Rev: 1.04 Type: CD-ROM ANSI SCSI revision: 02
  72. 72. SCSI devices SCSI devices Info in Linux 72 Some distros have an entry for SCSI adapter (or the SCSI Driver) in /proc. driver name Ex. /proc/scsi/aic7xxx/0. digit is the bus number - For some drivers parameters can be set to this file. Ex: yourname@yourcomp~# cat /proc/scsi/aic7xxx/0 Adaptec AIC7xxx driver version: 5.1.19/3.2.4 Compile Options: TCQ Enabled By Default : Disabled AIC7XXX_PROC_STATS : Disabled AIC7XXX_RESET_DELAY : 5 Adapter Configuration: SCSI Adapter: Adaptec AHA-294X Ultra SCSI host adapter Ultra Wide Controller PCI MMAPed I/O Base: 0xeb001000 Adapter SEEPROM Config: SEEPROM found and used. Adaptec SCSI BIOS: Enabled IRQ: 10 SCBs: Active 0, Max Active 2, Allocated 15, HW 16, Page 255 Interrupts: 160328 ...// ...
  73. 73. SCSI devices SCSI devices Info in Linux 73 To know which SCSI device corresponds /dev/sda, use the scsi_info command. Ex: yourname@yourcomp~# scsi_info /dev/sda SCSI_ID="0,0,0" MODEL="IBM-PSG DPSS-336950M F" FW_REV="S94S" Some systems use scsiinfo cmd. Or use sg driver. (SCSI Generic) Using sg driver, there’s information under the /proc/scsi/sg. will be devices like /dev/sg0, /dev/sg1, /dev/sg2 ... The generic devices correspond to other devices (hard disk = /dev/sda; tape = /dev/st0…) View ‘man scsiinfo’
  74. 74. SCSI devices SCSI devices Info in Linux 74 Ex: yourname@yourcomp~# sg_map /dev/sg0 /dev/scd0 /dev/sg1 /dev/sda /dev/sg2 /dev/sdb sg3-utils package: utilities for manipulating the SCSI subsystem. sg_map cmd - map between sg name and another device name if exists. system with IDE optical drive that uses SCSI emulation and two USB drives: The sg utility corresponding to scsi_info is sginfo. sginfo interrogates device for information while scsiinfo will use the retained info in /proc/scsi/scsi. Ex: yourname@yourcomp~# sginfo /dev/scd0 INQUIRY response (cmd: 0x12) --------------------------- Device Type 5 Vendor: SONY Product: DVD RW DRU-700A Revision level: VY08
  75. 75. SCSI devices SCSI BIOS and boot sequence 75 •Support for SCSI is normally accessible in BIOS boot order Setup (default boot device). •Permitting SCSI cards to invoke the configuration of the subsystem controlled by the card. BIOS boot sequence with Adaptec SCSI card:Ex: Press <Ctrl><A> for SCSISelect(TM) Utility! SCSI Bus Interface Definitions Host Adapter SCSI ID: 7 SCSI Parity Checking: Enabled Host Adapter SCSI Termination: Automatic Boot Device Options Boot SCSI ID: 0 Boot LUN Number: 0 SCSI BIOS configuration Screen:
  76. 76. USB devices USB overview 76 In 1994 Compaq, Intel, Microsoft and NEC designed the Universal Serial Bus (USB) with the goal of providing a single, simple bus for attachment of peripherals. allows devices to be hot-plugged and uses standard connectors for connecting devices. keyboards, mice, printers, scanners, hard drives, flash memory drives, cameras, modems, eth adapters, speakers... USB is a hierarchical bus and it is controlled by one host. •A computer system may provide one or more controllers or hubs. to which either a USB device or another (external) hub may be connected. •A hub can support up to 7 devices, some or all may be additional hubs. •The hub in the system is called root hub. Each star topology supports to 127 hubs or devices (USB v1). Frequently, we speak of a USB ports which refers to the USB capability in a computer and the connecting socket rather than the internal port addresses used by the device
  77. 77. USB devices USB specification 77 USB specification 1.0, 1.1 support speeds up to 12Mbps. Devices are low speed, such as printers, mice, keyboards, scanners, and modems. USB cable is a thin, 4-wire cable with two signal lines plus power and ground. USB devices/hubs may draw power from USB bus or may be self powered (low power devices) USB specification 2.0 supports speeds up to 480Mbps. Adequate for hard drives and external CD or DVD drives. http://www.usb.org/developers/docs/ http://en.wikipedia.org/wiki/Universal_Serial_Bus USB specification 3.0 supports speeds up to 5 Gbit/s (625 MB/s) SuperSpeed Adequate to all device classes.
  78. 78. USB devices USB layered system. 78 1. Bus Interface layer Provides physical, signaling, and packet connectivity data transfer between host and devices. 2. Device layer Used by system to do generic USB operations with device on the bus. allows host to determine characteristics of device (device class, vendor name, device name, power requirements, device speed). 3. Function layer Provides additional capabilities specific to the device. software layers permit use device-specific functions.
  79. 79. USB devices Linux USB module support 79 USB is well supported in Linux. Much development occurred in 2.6 kernel. Because of the hot-pluggable nature of USB, support is usually through kernel modules which can be loaded or unloaded as necessary. Linux systems founds the USB existence, with lspci command. Ex: yourname@yourcomp~# lspci | grep -i usb 00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 01) 00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 01) 00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 01) 00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 01) Indication of: AHCI (Advanced Host Controller Interface) is for app programming interface that defines operation for SATA apposed to the IDE controller. http://en.wikipedia.org/wiki/Advanced_Host_Controller_Interface In Linux kernel since v2.6.19.
  80. 80. USB devices USB chipsets and drivers 80 There are 2 USB host controller available. Supported by 2 kernel modules available. Common Drivers: 1. usb-ohci.o – Open Host Controller Interface (OHCI by Compaq) used by Nvidia chipset 2. usb-uhci.o – Universal Host Controller Interface (UHCI by Intel) used by Intel chipset, VIA chipset (simpler hardware, more complex software, higher CPU load). Driver Chipset OHCI Compaq, iMacs, PowerBooks, SiS, ALi chipsets UHCI Intel, VIA chipsets JE Alternate to UHCI for 2.4 kernels. (If UHCI doesn’t work, and have Intel/VIA chipset, try JE) EHCI USB 2.0 Support - requires one of UHCI, OHCI or JE http://www.linuxjournal.com/article/8093
  81. 81. USB devices USB chipsets and drivers 81 To determine usb controller driver in a particular computer, again use lspci Ex: yourname@yourcomp~# lspci | grep -i usb 00:07.2 USB Controller: VIA Technologies, Inc. USB (rev 0a) (prog-if 00 [UHCI]) Subsystem: VIA Technologies, Inc. (Wrong ID) USB Controller For module config files modules.conf (kernel 2.4) ; /etc/modprobe.conf (kernel2.6) or newer /proc/modules use lsmod to view modules loaded associated with USB Ex: yourname@yourcomp~# lsmod | egrep 'usb|hci|hid|mouse|Module' Module Size Used by Not tainted usbserial 23420 0 (autoclean) (unused) mousedev 5524 1 hid 22244 0 (unused) input 5888 0 [keybdev mousedev hid] ehci-hcd 20008 0 (unused) usb-uhci 25740 0 (unused) usbcore 77376 1 [usbserial hid ehci-hcd usb-uhci]
  82. 82. USB devices Displaying USB information 82 Info of USB devices attached to the system is found in /proc/bus/usb (some Karnels). USB identifies themselves on bus by vendor, and by USB class (mouse, keyboard) Ex: yourname@yourcomp~# cat /proc/bus/usb/devices T: Bus=04 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 6 B: Alloc= 0/800 us ( 0%), #Int= 0, #Iso= 0 D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS= 8 #Cfgs= 1 P: Vendor=0000 ProdID=0000 Rev= 2.04 S: Manufacturer=Linux 2.4.21-32.0.1.EL ehci-hcd S: Product=Intel Corp. 82801DB USB2 S: SerialNumber=00:1d.7 C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub E: Ad=81(I) Atr=03(Int.) MxPS= 2 Ivl=256ms T: Bus=03 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2 B: Alloc= 0/900 us ( 0%), #Int= 0, #Iso= 0 D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 P: Vendor=0000 ProdID=0000 Rev= 0.00 S: Product=USB UHCI Root Hub S: SerialNumber=1840 C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=255ms .. // ..
  83. 83. USB devices Displaying USB information 83 Best option to file /proc/bus/usb is lsusb cmd. With –t giving attachment hierarchy Ex: yourname@yourcomp~# lsusb -s 001:007 -v | head -11 Bus 001 Device 007: ID 04a5:20b0 Acer Peripherals Inc. S2W 3300U/4300U Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.00 bDeviceClass 255 Vendor Specific Class bDeviceSubClass 255 Vendor Specific Subclass bDeviceProtocol 255 Vendor Specific Protocol bMaxPacketSize0 8 idVendor 0x04a5 Acer Peripherals Inc. idProduct 0x20b0 S2W 3300U/4300U bcdDevice 1.20 iManufacturer 1 Color iProduct 2 FlatbedScanner 23 yourname@yourcomp~# lsusb Bus 002 Device 001: ID 0000:0000 Bus 001 Device 001: ID 0000:0000 Bus 001 Device 007: ID 04a5:20b0 Acer Peripherals Inc. S2W 3300U/4300U
  84. 84. Fim de sessão 84