Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) .. SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) =======================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) Notes on Linux SCSI Generic (sg) driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) =======================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)                                                         20020126
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) Introduction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) ============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) The SCSI Generic driver (sg) is one of the four "high level" SCSI device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) drivers along with sd, st and sr (disk, tape and CDROM respectively). Sg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) is more generalized (but lower level) than its siblings and tends to be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) used on SCSI devices that don't fit into the already serviced categories.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) Thus sg is used for scanners, CD writers and reading audio CDs digitally
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) amongst other things.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) Rather than document the driver's interface here, version information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) is provided plus pointers (i.e. URLs) where to find documentation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) and examples.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) Major versions of the sg driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) ===============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) There are three major versions of sg found in the linux kernel (lk):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)       - sg version 1 (original) from 1992 to early 1999 (lk 2.2.5) .
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	It is based in the sg_header interface structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)       - sg version 2 from lk 2.2.6 in the 2.2 series. It is based on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	an extended version of the sg_header interface structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)       - sg version 3 found in the lk 2.4 series (and the lk 2.5 series).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	It adds the sg_io_hdr interface structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) Sg driver documentation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) =======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) The most recent documentation of the sg driver is kept at the Linux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) Documentation Project's (LDP) site:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) - http://www.tldp.org/HOWTO/SCSI-Generic-HOWTO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) This describes the sg version 3 driver found in the lk 2.4 series.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) The LDP renders documents in single and multiple page HTML, postscript
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) and pdf. This document can also be found at:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) - http://sg.danny.cz/sg/p/sg_v3_ho.html
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) Documentation for the version 2 sg driver found in the lk 2.2 series can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) be found at http://sg.danny.cz/sg/. A larger version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) is at: http://sg.danny.cz/sg/p/scsi-generic_long.txt.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) The original documentation for the sg driver (prior to lk 2.2.6) can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) found at http://www.torque.net/sg/p/original/SCSI-Programming-HOWTO.txt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) and in the LDP archives.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) A changelog with brief notes can be found in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) /usr/src/linux/include/scsi/sg.h file. Note that the glibc maintainers copy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) and edit this file (removing its changelog for example) before placing it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) in /usr/include/scsi/sg.h . Driver debugging information and other notes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) can be found at the top of the /usr/src/linux/drivers/scsi/sg.c file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) A more general description of the Linux SCSI subsystem of which sg is a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) part can be found at http://www.tldp.org/HOWTO/SCSI-2.4-HOWTO .
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) Example code and utilities
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) ==========================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) There are two packages of sg utilities:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)     =========   ==========================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)     sg3_utils   for the sg version 3 driver found in lk 2.4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)     sg_utils    for the sg version 2 (and original) driver found in lk 2.2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)                 and earlier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)     =========   ==========================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) Both packages will work in the lk 2.4 series however sg3_utils offers more
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) capabilities. They can be found at: http://sg.danny.cz/sg/sg3_utils.html and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) freecode.com
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) Another approach is to look at the applications that use the sg driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) These include cdrecord, cdparanoia, SANE and cdrdao.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) Mapping of Linux kernel versions to sg driver versions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) ======================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) Here is a list of linux kernels in the 2.4 series that had new version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) of the sg driver:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)      - lk 2.4.0 : sg version 3.1.17
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)      - lk 2.4.7 : sg version 3.1.19
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)      - lk 2.4.10 : sg version 3.1.20 [#]_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)      - lk 2.4.17 : sg version 3.1.22
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) .. [#] There were 3 changes to sg version 3.1.20 by third parties in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)        next six linux kernel versions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) For reference here is a list of linux kernels in the 2.2 series that had
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) new version of the sg driver:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)      - lk 2.2.0 : original sg version [with no version number]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)      - lk 2.2.6 : sg version 2.1.31
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)      - lk 2.2.8 : sg version 2.1.32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)      - lk 2.2.10 : sg version 2.1.34 [SG_GET_VERSION_NUM ioctl first appeared]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)      - lk 2.2.14 : sg version 2.1.36
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)      - lk 2.2.16 : sg version 2.1.38
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)      - lk 2.2.17 : sg version 2.1.39
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)      - lk 2.2.20 : sg version 2.1.40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) The lk 2.5 development series has recently commenced and it currently
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) contains sg version 3.5.23 which is functionally equivalent to sg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) version 3.1.22 found in lk 2.4.17.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) Douglas Gilbert
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 26th January 2002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) dgilbert@interlog.com