Contents
- Architectures
- Drivers
1.1. x86
x86-64: Rework vsyscall emulation and add vsyscall= parameter (commit)
Do not set the root_dev field in bzImage (obsolete) (commit)
x86, config: Introduce an INTEL_MID configuration (commit)
olpc: Add XO-1.5 SCI driver (commit), add XO-1 RTC driver (commit), add XO-1 SCI driver and power button control (commit), add XO-1 suspend/resume support (commit), add lid switch functionality (commit), propagate power supply/battery events (commit), add GPE handler and ebook switch functionality (commit)
mrst_pmu: driver for Intel Moorestown Power Management Unit (commit)
- ACPI
acerhdf: add support for Aspire 1810TZ BIOS v1.3314 (commit)
acer-wmi: Add support for Aspire 1830 WLAN hotkey (commit)
asus-wmi: add keyboard backlight support (commit), add thermal sensor (commit)
dell-wmi: Add keys for Dell XPS L502X (commit)
eeepc-wmi: Add support for T101MT Home/Express Gate key (commit)
ACPI, APEI, GHES: Add hardware memory error recovery support (commit)
ACPI, APEI, GHES, printk support for recoverable error via NMI (commit)
EFI: Add support for using efivars as a pstore backend (commit)
The only folder I found on the x64 VMware Tools install disk was under 'D: Program Files VMware Vmware Tools Drivers scsi' but when looking at the inf file it only says about the VMware SCSI driver, nothing specific about the paravirtual driver. If anybody has an flp for these drivers it would be greatly appreciated to post, or email me. Windows 7 Driver for SCSI CdRom HL-DT-STDVDRRWGSA-H30L I have a H-P Pavillion, it came with a LightScribe drive. And Windows Vista OS, after HD failure I did a clean install of Windows 7Pro. Description: Ultra320 64-bit SCSI drivers v7.0.0.3 for the 29320, 39320, 29320A and 39320A series cards without HostRAID enabled. This file contains the Microsoft certified driver files for Windows Server 2003 x64 Edition and Windows XP x64 Edition. 0xF7644000 C: WINDOWS system32 DRIVERS CLASSPNP.SYS 53248 bytes (Microsoft Corporation, SCSI Class System Dll) 0xF7844000 C: WINDOWS system32 DRIVERS rasl2tp.sys 53248 bytes (Microsoft Corporation. Net2272: driver for PLX NET2272 USB device controller. Option: add YUGA device id to driver. Option driver add PID of Huawei Vodafone K3806. Option driver K3765/K4505 avoid CDCDATA interface. Add a driver to support InvenSense mpu3050 gyroscope chip.
1.2. ARM
mmc, Add zboot from eSD support for SuperH Mobile ARM (commit)
cns3xxx: Add support for L2 Cache Controller (commit)
CSR: Adding CSR SiRFprimaII board support (commit)
Kconfig: Allow kprobes on Thumb-2 kernels (commit)
kprobes: Add Thumb breakpoint support (commit)
mach-mx5/mx53_ard: Add support for i.MX53 ARD board (commit)
perf: add support for the Cortex-A15 PMU (commit)
perf: add support for the Cortex-A5 PMU (commit)
pxa168: Add board support for gplugD (commit)
S3C64XX: Initial support for Wolfson/Simtec Cragganmore/Banff (commit)
Xilinx: Adding Xilinx board support (commit)
mach-loki: delete (commit)
mach-s3c2400: delete (commit)
mach-s3c24a0: delete (commit)
1.3. PowerPC
Add jump label support (commit)
cpufreq: Add cpufreq driver for Momentum Maple boards (commit)
Introduce ePAPR embedded hypervisor hcall interface (commit), introduce the ePAPR embedded hypervisor vmpic driver (commit)
85xx: Add basic P1023RDS board support (commit), add P1010RDB board support (commit), add p2040 RDB board support (commit)
1.4. MIPS
oprofile: Add callgraph support (commit)
topdown mmap support (commit)
HIGHMEM DMA on noncoherent MIPS32 processors (commit)
1.5. Tile
Add hypervisor-based character driver for SPI flash ROM (commit)
1.6. S390
Add support for IBM zEnterprise 114 (commit)
1.7. Blackfin
1.8. SPARC
2.1. Staging drivers
gma500: Medfield support (commit)
comedi: add dyna_pci10xx driver (commit)
Merge ENE UB6250 MS card codes from keucr to drivers/usb/storage/ene_ub6250.c (commit)
zcache: support multiple clients, prep for KVM and RAMster (commit)
msm: delete the driver (commit)
easycap: remove OSS support (commit)
Remove ENE UB6250 MS card codes from keucr (commit)
Remove obsoleted CS5535/CS5536 GPIO driver (commit)
Delete generic_serial drivers (commit)
Delete tty drivers (commit)
Delete westbridge code (commit)
2.2. Graphic cards
i915: Enable i915 frame buffer compression by default (commit)
nouveau: nvc1/gr: switch on acceleration support (commit), default to noaccel on 0xc1/0xc8/0xce for now (commit)
2.3. PCI
2.4. Storage (SATA/SCSI)
- SCSI
bfa: Added Fabric Assigned Address(FAA) support (commit)
bfa: Added HBA diagnostics support. (commit)
bfa: Added support for CEE info and stats query. (commit)
bfa: Added support for flash configuration (commit)
bfa: Added support to collect and reset fcport stats (commit)
bfa: Added support to configure lunmasking (commit)
bfa: Added support to configure QOS and collect stats. (commit)
bfa: Added support to obtain SFP info. (commit)
bfa: Add FC-transport based Asynchronous Event Notification support. (commit)
bfa: Add support for I/O profiling. (commit)
bfa: Add support to collect / reset fabric stats. (commit)
bfa: Add support to configure and query flash boot partition (commit)
bfa: Add support to configure trunking on Brocade adapter ports. (commit)
bfa: Add support to store driver configuration in flash. (commit)
bfa: Brocade-1860 Fabric Adapter 16Gbs support and flash controller fixes. (commit)
bfa: Brocade-1860 Fabric Adapter Hardware Enablement (commit)
bfa: Brocade-1860 Fabric Adapter vHBA support. (commit)
bfa: Introduced initiator based lun masking feature. (commit)
lpfc 8.3.25: Add FCF priority failover functionality (commit)
ata: Add iMX pata support (commit)
2.5. Network cards
Add Faraday FTGMAC100 Gigabit Ethernet driver (commit)
caif: Add CAIF HSI Link layer driver (commit)
iwlagn: implement WoWLAN (commit)
ixgbe: add basic support for setting and getting nfc controls (commit), add support for displaying ntuple filters via the nfc interface (commit), add support for nfc addition and removal of filters (commit), add support for Dell CEM (commit)
e1000e: Add Jumbo Frame support to 82583 devices (commit)
qlcnic: multi-protocol internal loopback support added. (commit)
r8169: Add support for D-Link 530T rev C1 (Kernel Bug 38862) (commit), support RTL8111E-VL. (commit)
ath9k: enable support for AR9330 (commit)
be2net: support multiple TX queues (commit)
bnx2x: Add autogrEEEn support (commit), multiple concurrent l2 traffic classes (commit)
bnx2i: Add support for new devices - 57800, 57810, and 57840 (commit)
wl12xx: Add Support for Low Power DRPw (LPD) Mode (commit)
myri_sbus: remove driver (commit)
mwifiex: remove support for old chipsets W0/W1 (commit)
rt2x00: Add new rt73 buffalo USB id (commit), add rt2870 device id for Dvico usb key (commit), add support for RT3572/RT3592/RT3592+Bluetooth combo card (commit)
rtlwifi: Add rtl8192de support (commit); rtl892cu: New USB IDs (commit)
skge: make support for old Genesis chips optional (commit)
sky2: support for new Optima chipsets (EXPERIMENTAL) (commit)
sungem: Spring cleaning and GRO support (commit)
2.6. USB
EHCI: Allow users to override 80% max periodic bandwidth (commit)
ftdi_sio: add Calao reference board support (commit)
gadget: add SuperSpeed support to the Gadget Framework (commit)
net2272: driver for PLX NET2272 USB device controller (commit)
option: add YUGA device id to driver (commit)
option driver add PID of Huawei Vodafone K3806 (commit)
option driver K3765/K4505 avoid CDC_DATA interface (commit)
2.7. Input devices
Add a driver to support InvenSense mpu3050 gyroscope chip (commit)
Add initial support for TWL6040 vibrator (commit)
Add support for Kionix KXTJ9 accelerometer (commit)
Add support for mma8450 accelerometer (commit)
wacom: add 3 new models - 6A, 6B, and 97 (commit), add support for the Wacom Bamboo Pen (CTL-660/K) (commit)
bcm5974 - Add support for newer MacBookPro8,2 (commit), add support for touchpads found in MacBookAir4,2 (commit)
- HID
Add driver to fix Speedlink VAD Cezanne support (commit)
Add FF support for Holtek On Line Grip based gamepads (commit)
Add support for MS Digital Media 3000 (commit)
Add support for new revision of Apple aluminum keyboard (commit)
uclogic: Add support for UC-Logic WP1062 (commit)
usbhid: Add support for SiGma Micro chip (commit)
2.8. Sound cards
ctxfi: Add support for Creative Titanium HD (commit)
hda: Add Creative CA0132 HDA codec support (commit), add Realtek ALC269VC codec support (commit), cirrus Logic CS421x support (commit)
- ASoC
AD1836: Add AD1835/AD1837/AD1838/AD1839 support (commit)
Add ADAU1701 codec driver (commit)
Add ADAV80x codec driver (commit)
Add STA32X codec driver (commit)
Add WM8782 ADC Codec Driver (commit)
Blackfin: Add bf5xx-adau1701 machine driver (commit), add machine driver for EVAL-ADAV80X boards (commit)
SAMSUNG: Add WM8994 PCM Machine driver (commit)
Support Speyside build variants with WM8962 fitted (commit)
Tegra: Implement SPDIF CPU DAI (commit)
WM8983: Initial driver (commit)
2.9. Hardware monitorization
coretemp: Add core/pkg threshold support to Coretemp (commit)
Driver for MAX1668 (commit)
Driver for NTC Thermistors (commit)
lm90: Add support for Philips SA56004 (commit)
lm95241: Add support for LM95231 (commit)
LM95245 driver (commit)
New driver sch5636 (commit)
pmbus: Add ADP4000, NCP4200 and NCP4208 to list of supported devices (commit), add client driver for LM25066, LM5064, and LM5066 (commit)
2.10. Webcams, image capture devices
2.11. Real-time clocks
2.12. MultiMedia Cards
2.13. Watchdog
Add support for the Synopsys DesignWare WDT (commit)
Add Xilinx watchdog timer driver (commit)
Introduce the WatchDog Timer Driver Core. The WatchDog Timer Driver Core is a framework that contains the common code for all watchdog-driver's (commit 1, 2, 3, 4, 5, 6, 7, 8, 9)
2.14. Multifunction devices
Add AAT2870 mfd driver (commit)
tps65912: Add new mfd device (commit)
twl6040: Add initial support (commit)
2.15. Memory Technology Devices
Add initial support for Terratec H5 (commit)
adp1653: Add driver for LED flash controller (commit)
af9015: add support for Sveon STV22 [1b80:e401] (commit)
cx23885: added support for card 107d:6f39 (commit)
davinci VPBE driver, V4L2 display driver for DM644X SoC (commit), (commit), (commit), (commit), (commit)
ddbridge: Initial check-in (commit)
dib0700: add initial code for PCTV 340e by Davide Ferri (commit)
DRX-K: Initial check-in (commit)
gspca: Add new se401 camera driver (commit)
marvell-cam: Basic working MMP camera driver (commit)
MFC: Add MFC 5.1 V4L2 driver (commit)
ngene: Support Digital Devices DuoFlex CT (commit)
rc-core support for Microsoft IR keyboard/mouse (commit)
tda18271c2dd: Initial check-in (commit)
V4L: at91: add Atmel Image Sensor Interface (ISI) support (commit)
V4L: initial driver for ov5642 CMOS sensor (commit)
v4l: s5p-tv: add drivers for HDMI on Samsung S5P platform (commit), add SDO driver for Samsung S5P platform (commit), add TV Mixer driver for Samsung S5P platform (commit)
2.16. Bluetooth
Add BT_POWER L2CAP socket option. (commit)
Add LE SMP Cryptoolbox functions (commit)
Add simple SMP pairing negotiation (commit)
Add SMP confirmation checks methods (commit)
Add SMP confirmation structs (commit)
Add support for LE Start Encryption (commit)
Add support for using the crypto subsystem (commit)
Add Toshiba laptops AR30XX device ID (commit)
Implement the first SMP commands (commit)
Start SMP procedure (commit)
2.17. Various
8250_pci: add support for Rosewill RC-305 4x serial port card (commit)
backlight: Add AAT2870 backlight driver (commit), add ams369fg06 amoled driver (commit)
dmaengine: add ep93xx DMA support (commit)
drivers/misc: add support the FSA9480 USB Switch (commit)
drivers/rtc: add support for Qualcomm PMIC8xxx RTC (commit)
GPIO: DA9052 GPIO module v3 (commit)
hwrng: ppc4xx - add support for ppc4xx TRNG (commit)
ideapad: add backlight driver (commit)
IIO: ADC: New driver for AD7792/AD7793 3 Channel SPI ADC (commit)
iio: dac: New driver for AD5686R, AD5685R, AD5684R Digital to analog converters (commit)
misc/eeprom: add driver for microwire 93xx46 EEPROMs (commit)
Platform: Samsung Q10 backlight driver (commit)
power_supply: Add charger driver for MAX8997/8966 (commit), add charger driver for MAX8998/LP3974 (commit)
regmap: Add generic non-memory mapped register access API (commit)
regulator: aat2870: Add AAT2870 regulator driver (commit)
Samsung Laptop platform driver: support N510 (commit)
serial: 8250_pnp: add Intermec CV60 touchscreen device (commit), sh-sci: Kill off bitrotted H8/300 support. (commit)
spi: remove obsolete spi-s3c24xx-gpio driver (commit)
tps65912: add regulator driver (commit)
tty: n_gsm: Add raw-ip support (commit)
The Solaris DDI/DKI divides the software interface to SCSI devices into two major parts: target drivers and host bus adapter (HBA) drivers. Target refers to a driver for a device on a SCSI bus, such as a disk or a tape drive. Host bus adapter refers to the driver for the SCSI controller on the host machine. SCSA defines the interface between these two components. This chapter discusses target drivers only. See Chapter 15, SCSI Host Bus Adapter Drivers for information on host bus adapter drivers.
Note –The terms “host bus adapter” or “HBA” used in this manual are equivalent to the phrase “host adapter” defined in SCSI specifications.
This chapter provides information on the following subjects:
Target drivers can be either character or block device drivers, depending on the device. Drivers for tape drives are usually character device drivers, while disks are handled by block device drivers. This chapter describes how to write a SCSI target driver and discusses the additional requirementsthat SCSA places on block and character drivers for SCSI target devices.
The following reference documents provide supplemental information needed by the designers of target drivers and host bus adapter drivers.
Small Computer System Interface 2 (SCSI-2), ANSI/NCITS X3.131-1994, Global Engineering Documents, 1998. ISBN 1199002488.
The Basics of SCSI, Fourth Edition, ANCOT Corporation, 1998. ISBN 0963743988.
Also refer to the SCSI command specification for the target device, provided by the hardware vendor.
The Sun Common SCSI Architecture (SCSA) is the Solaris DDI/DKI programming interface for the transmission of SCSI commands from a target driver to a host bus adapter driver. This interface is independent of the type of host bus adapter hardware, the platform, the processor architecture, and theSCSI command being transported across the interface.
By conforming to the SCSA, the target driver can pass any SCSI command to a target device without knowledge of the hardware implementation of the host bus adapter.
The SCSA conceptually separates building the SCSI command (by the target driver) from transporting the SCSI command and data across the SCSI bus. The architecture defines the software interface between high-level and low-level software components. The higher level software component consists ofone or more SCSI target drivers, which translate I/O requests into SCSI commands appropriate for the peripheral device. Figure 14–1 illustrates the SCSI architecture.
Figure 14–1 SCSA Block Diagram
The lower-level software component consists of a SCSA interface layer and one or more host bus adapter drivers. The target driver is responsible for the generation of the proper SCSI commands required to execute the desired function and for processing the results.
General Flow of Control
Assuming no transport errors occur, the following steps describe the general flow of control for a read or write request.
The target driver's read(9E) or write(9E) entry pointis invoked. physio(9F) is used to lock down memory, prepare a buf structure, and call the strategy routine.
The target driver's strategy(9E) routine checks the request and allocates a scsi_pkt(9S) using scsi_init_pkt(9F).The target driver initializes the packet and sets the SCSI command descriptor block (CDB) using the scsi_setup_cdb(9F) function. The targetdriver also specifies a timeout and provides a pointer to a callback function, which is called by the host bus adapter driver on completion of the command. The buf(9S)pointer should be saved in the SCSI packet's target-private space.
The target driver submits the packet to the host bus adapter driver using scsi_transport(9F). The target driver is thenfree to accept other requests. The target driver should not access the packet while it is in transport. If either the host bus adapter driver or the target supports queueing, new requests can be submitted while the packet is in transport.
As soon as the SCSI bus is free and the target not busy, the host bus adapter driver selects the target and passes the CDB. The target executes the command and performs the requested data transfers.
After the target sends completion status and the command completes, the host bus adapter driver notifies the target driver by calling the completion function that was specified in the SCSI packet. At this time the host bus adapter driver is no longer responsible for the packet, and thetarget driver has regained ownership of the packet.
The SCSI packet's completion routine analyzes the returned information and determines whether the SCSI operation was successful. If a failure has occurred, the target driver retries the command by calling scsi_transport(9F) again. If the host bus adapter driver does not support auto request sense, the target driver must submit a request sense packet to retrieve the sense data in the event of a check condition.
If either the command was completed successfully or cannot be retried, the target driver calls scsi_destroy_pkt(9F), whichsynchronizes the data and frees the packet. If the target driver needs to access the data before freeing the packet, it calls scsi_sync_pkt(9F).
Finally, the target driver notifies the application program that originally requested the read or write that the transaction is complete, either by returning from the read(9E) entry point in the driver (for a character device) or indirectly through biodone(9F).
SCSA allows the execution of many of such operations, both overlapped and queued, at various points in the process. The model places the management of system resources on the host bus adapter driver. The software interface enables the execution of target driver functions on host bus adapter driversusing SCSI bus adapters of varying degrees of sophistication.
SCSA Functions
SCSA defines functions to manage the allocation and freeing of resources, the sensing and setting of control states, and the transport of SCSI commands. These functions are listed in Table 14–1.
Table 14–1 Standard SCSA FunctionsFunction Name | Category |
---|---|
Resource management | |
scsi_dmafree(9F) | |
scsi_alloc_consistent_buf(9F) | |
scsi_free_consistent_buf(9F) | |
Command transport | |
Transport information and control | |
scsi_ifsetcap(9F) | |
scsi_abort(9F) | Error handling |
scsi_reset(9F) | |
scsi_poll(9F) | Polled I/O |
scsi_probe(9F) | Probe functions |
scsi_unprobe(9F) | |
scsi_setup_cdb(9F) | CDB initialization function |
If your driver needs to work with a SCSI-1 device, use the makecom(9F) function.
Because SCSI devices are not self-identifying, a hardware configuration file is required for a target driver (see driver.conf(4) and scsi(4) for details). A typical configuration file looks like this:
The system reads the file during autoconfiguration and uses the class property to identify the driver's possible parent. The system then attempts to attach the driver to any parent driver that is of class scsi. All host bus adapter drivers are of thisclass. Using the class property rather than the parent property enables the target driver to be attached to any host bus adapter driver that finds the expected device at the specified target and lunIDs. The target driver is responsible for verifying this in its probe(9E) routine.
Target drivers must include the header file <sys/scsi/scsi.h>.
SCSI target drivers must use the following command to generate a binary module:
scsi_device Structure
The host bus adapter driver allocates and initializes a scsi_device(9S) structure for the target driver before either the probe(9E) or attach(9E)routine is called. This structure stores information about each SCSI logical unit, including pointers to information areas that contain both generic and device-specific information. There is one scsi_device(9S) structure for each logical unit attached to the system. The target driver can retrieve a pointer to this structure by calling ddi_get_driver_private(9F).
Caution –Because the host bus adapter driver uses the private field in the target device's dev_info structure, target drivers must not use ddi_set_driver_private(9F).
The scsi_device(9S) structure contains the following fields:
Data structure that is passed to the SCSI resource allocation routines.
Pointer to the target's dev_info structure.
Mutex for use by the target driver. This is initialized by the host bus adapter driver and can be used by the target driver as a per-device mutex. Do not hold this mutex across a call to scsi_transport(9F) or scsi_poll(9F). See Chapter 3, Multithreading for more information on mutexes.
Pointer for the target device's SCSI inquiry data. The scsi_probe(9F)routine allocates a buffer, fills it in with inquiry data, and attaches it to this field.
Pointer to a buffer to contain SCSI request sense data from the device. The target driver must allocate and manage this buffer itself; see attach() Entry Point (SCSI Target Drivers).
Pointer field for use by the target driver. It is commonly used to store a pointer to a private target driver state structure.
scsi_pkt Structure
The scsi_pkt structure contains the following fields:
Target device's address set by scsi_init_pkt(9F).
Place to store private data for the target driver. It is commonly used to save the buf(9S) pointer for the command.
Address of the completion routine. The host bus adapter driver calls this routine when it has transported the command. This does not mean that the command succeeded; the target might have been busy or might not have respondedbefore the time-out time elapsed (see the description for pkt_time field). The target driver must supply a valid value in this field, though it can be NULL if the driver does not want to be notified.
Note –There are two different SCSI callback routines. The pkt_comp field identifies a completion callback routine, which is called when the host bus adapter completes its processing. There is also a resource callback routine, calledwhen currently unavailable resources are likely to be available (as in scsi_init_pkt(9F)).
Provides additional control information, for example, to transport the command without disconnect privileges (FLAG_NODISCON) or to disable callbacks (FLAG_NOINTR). See the scsi_pkt(9S) man page for details.
Time-out value (in seconds). If the command is not completed within this time, the host bus adapter calls the completion routine with pkt_reason set to CMD_TIMEOUT. The target drivershould set this field to longer than the maximum time the command might take. If the timeout is zero, no timeout is requested. Timeout starts when the command is transmitted on the SCSI bus.
Pointer to the SCSI status completion block; this is filled in by the host bus adapter driver.
Pointer to the SCSI command descriptor block, the actual command to be sent to the target device. The host bus adapter driver does not interpret this field. The target driver must fill it in with a command that the target devicecan process.
Residual of the operation. When allocating DMA resources for a command scsi_init_pkt(9F), pkt_resid indicates the number of bytes for which DMA resources could not be allocated because of DMA hardware scatter-gather or other device limitations. After command transport, pkt_resid indicates thenumber of data bytes not transferred; this is filled in by the host bus adapter driver before the completion routine is called.
Indicates the state of the command. The host bus adapter driver fills in this field as the command progresses. One bit is set in this field for each of the five following command states:
STATE_GOT_BUS – Acquired the bus
STATE_GOT_TARGET – Selected the target
STATE_SENT_CMD – Sent the command
STATE_XFERRED_DATA – Transferred data (if appropriate)
STATE_GOT_STATUS – Received status from the device
Contains transport-related statistics set by the host bus adapter driver.
Gives the reason the completion routine was called. The main function of the completion routine is to decode this field and take the appropriate action. If the command completed—in other words, if there were no transporterrors—this field is set to CMD_CMPLT; other values in this field indicate an error. After a command is completed, the target driver should examine the pkt_scbp field for a check condition status. See the scsi_pkt(9S) man page for more information.
SCSI target drivers must implement the standard autoconfiguration routines _init(9E), _fini(9E), and _info(9E). See Loadable Driver Interfaces for moreinformation.
probe(9E), attach(9E), detach(9E), and getinfo(9E) are also required, but they must perform SCSI (and SCSA) specific processing.
probe() Entry Point (SCSI Target Drivers)
SCSI target devices are not self-identifying, so target drivers must have a probe(9E) routine. This routine must determine whether the expectedtype of device is present and responding.
The general structure and return codes of the probe(9E) routine are the same as those of other device drivers. SCSI target drivers must usethe scsi_probe(9F) routine in their probe(9E) entry point. scsi_probe(9F) sends a SCSI inquiry command to the device and returns a code indicatingthe result. If the SCSI inquiry command is successful, scsi_probe(9F) allocates a scsi_inquiry(9S) structure and fills it in with the device's inquiry data. Upon return from scsi_probe(9F), the sd_inq field of the scsi_device(9S) structurepoints to this scsi_inquiry(9S) structure.
Because probe(9E) must be stateless, the target driver must call scsi_unprobe(9F) before probe(9E) returns, even if scsi_probe(9F) fails.
Example 14–1 shows a typical probe(9E) routine. It retrieves its scsi_device(9S) structure from the private field of its dev_info structure. It also retrieves the device's SCSI target and logical unit numbers so that itcan print them in messages. The probe(9E) routine then calls scsi_probe(9F) to verify that the expected device (a printer in this case) is present.
If scsi_probe(9F) succeeds, it has attached the device's SCSI inquiry data in a scsi_inquiry(9S) structure to the sd_inq field of the scsi_device(9S) structure. The driver can then determine if the device type is a printer (reported in the inq_dtype field). If it is, the type is reported with scsi_log(9F), using scsi_dname(9F) to convert the device type intoa string.
Example 14–1 SCSI Target Driver probe(9E) Routine
A more thorough probe(9E) routine could also check other fields of the scsi_inquiry(9S) structure as necessary to make sure that the device is of the type expected by a particular driver.
attach() Entry Point (SCSI Target Drivers)
After the probe(9E) routine has verified that the expected device is present, attach(9E) is called. This routine allocates and initializes any per-instance data, creates minor device node information, and restores the hardware state of a device when the device or the system has been suspended. (See The attach() Entry Point for details.) In addition to these steps, a SCSI target driver again calls scsi_probe(9F) to retrieve the device's inquirydata and also creates a SCSI request sense packet. If the attach is successful, the attach() function should not call scsi_unprobe(9F).
Three routines are used to create the request sense packet: scsi_alloc_consistent_buf(9F), scsi_init_pkt(9F), and scsi_setup_cdb(9F). scsi_alloc_consistent_buf(9F) allocates a buffer suitable for consistent DMA and returns apointer to a buf(9S) structure. The advantage of a consistent buffer is that no explicit synchronization of the data is required. In other words, thetarget driver can access the data after the callback. The sd_sense element of the device's scsi_device(9S) structuremust be initialized with the address of the sense buffer. scsi_init_pkt(9F) creates and partially initializes a scsi_pkt(9S) structure. scsi_setup_cdb(9F) creates a SCSI command descriptor block, in this case creating a SCSI request sense command.
Note that since a SCSI device is not self-identifying and does not have a reg property, the driver must set the pm-hardware-state property to inform the framework that this device needs to be suspended and resumed.
Example 14–2 shows the SCSI target driver's attach() routine.
Example 14–2 SCSI Target Driver attach(9E) Routine
detach() Entry Point (SCSI Target Drivers)
The detach(9E) entry point is the inverse of attach(9E); it must free all resources that were allocated in attach(). If successful, the detach should call scsi_unprobe(9F). Example 14–3 shows a target driver detach() routine.
Example 14–3 SCSI Target Driver detach(9E) Routine
getinfo() Entry Point (SCSI Target Drivers)
The getinfo(9E) routine for SCSI target drivers is much the same as for other drivers (see The getinfo() Entry Point for more informationon DDI_INFO_DEVT2INSTANCE case). However, in the DDI_INFO_DEVT2DEVINFO case of the getinfo() routine, the target driver must return a pointer to its dev_info node. This pointer can be saved in the driver statestructure or can be retrieved from the sd_dev field of the scsi_device(9S) structure. Example 14–4showsan alternative SCSI target driver getinfo() code fragment.
Example 14–4 Alternative SCSI Target Driver getinfo(9E) Code Fragment
To send a SCSI command to the device, the target driver must create and initialize a scsi_pkt(9S) structure and pass it to the host bus adapterdriver.
scsi_init_pkt() Function
The scsi_init_pkt(9F) routine allocates and zeros a scsi_pkt(9S) structure; it also sets pointers to pkt_private, *pkt_scbp, and *pkt_cdbp. Additionally, it provides a callback mechanism to handle the case where resourcesare not available. This function has the following syntax:
Pointer to a scsi_address structure. This is the sd_address field of the device's scsi_device(9S) structure.
Pointer to the scsi_pkt(9S) structure to be initialized. If this is setto NULL, a new packet is allocated.
Pointer to a buf(9S) structure. If this is non-NULL and contains a valid bytecount, DMA resources are allocated.
Length of the SCSI command descriptor block in bytes.
Required length of the SCSI status completion block in bytes.
Number of bytes to allocate for the pkt_private field.
Set of flags. Possible bits include:
PKT_CONSISTENT – This bit must be set if the DMA buffer was allocated using scsi_alloc_consistent_buf(9F). In this case, the host bus adapter driver guarantees that the data transfer is properly synchronized before performing the target driver's command completion callback.
PKT_DMA_PARTIAL – This bit can be set if the driver accepts a partial DMA mapping. If set, scsi_init_pkt(9F)allocates DMA resources with the DDI_DMA_PARTIAL flag set. The pkt_resid field of the scsi_pkt(9S)structure can be returned with a nonzero residual, indicating the number of bytes for which scsi_init_pkt(9F) was unable to allocate DMA resources.
Specifies the action to take if resources are not available. If set to NULL_FUNC, scsi_init_pkt(9F) returns immediately (returning NULL). If set to SLEEP_FUNC, it does not return until resources are available. Any other valid kernel address is interpreted as the address of a function to be called when resources are likely to be available.
Parameter to pass to the callback function.
The scsi_init_pkt() routine synchronizes the data prior to transport. If the driver needs to access the data after transport, it should call scsi_sync_pkt(9F) to flush any intermediate caches. The scsi_sync_pkt() routine can be used to synchronize any cached data.
scsi_sync_pkt() Function
If the target driver needs to resubmit the packet after changing the data, scsi_sync_pkt(9F) must be called before calling scsi_transport(9F). However, if the target driver does not need to access the data, there is no need to call scsi_sync_pkt() after the transport.
scsi_destroy_pkt() Function
The scsi_destroy_pkt(9F) routine synchronizes any remaining cached data associated with the packet, if necessary, and then frees thepacket and associated command, status, and target driver-private data areas. This routine should be called in the command completion routine.
scsi_alloc_consistent_buf() Function
For most I/O requests, the data buffer passed to the driver entry points is not accessed directly by the driver; it is just passed on to scsi_init_pkt(9F).If a driver sends SCSI commands that operate on buffers that the driver itself examines (such as the SCSI request sense command), the buffers should be DMA consistent. The scsi_alloc_consistent_buf(9F) routine allocates a buf(9S) structure and a data buffer suitable for DMA-consistentoperations. The HBA will perform any necessary synchronization of the buffer before performing the command completion callback.
Caution –scsi_alloc_consistent_buf(9F) uses scarce system resources; use it sparingly.
scsi_free_consistent_buf() Function
scsi_free_consistent_buf(9F) releases a buf(9S) structure and the associated data buffer allocated with scsi_alloc_consistent_buf(9F). See attach() Entry Point (SCSI Target Drivers) and detach() Entry Point (SCSI Target Drivers) for examples.
The host bus adapter driver is responsible for transmitting the command to the device and handling the low-level SCSI protocol. The scsi_transport(9F)routine hands a packet to the host bus adapter driver for transmission. The target driver has the responsibility to create a valid scsi_pkt(9S)structure.
Building a Command
The routine scsi_init_pkt(9F) allocates space for a SCSI CDB, allocates DMA resources if necessary, and sets the pkt_flagsfield, as shown in this example:
This example creates a new packet and allocates DMA resources as specified in the passed buf(9S) structure pointer. A SCSI CDB is allocated fora Group 0 (6-byte) command, the pkt_flags field is set to zero, but no space is allocated for the pkt_private field. This call to scsi_init_pkt(9F), because of the SLEEP_FUNC parameter, waits indefinitely for resources if none are currently available.
The next step is to initialize the SCSI CDB, using the scsi_setup_cdb(9F) function:
This example builds a Group 0 command descriptor block and fills in the pkt_cdbp field as follows:
The command itself (byte 0) is set from the parameter (SCMD_READ).
The address field (bits 0-4 of byte 1 and bytes 2 and 3) is set from bp->b_blkno.
The count field (byte 4) is set from the last parameter. In this case it is set to bp->b_bcount>>DEV_BSHIFT, where DEV_BSHIFT is the byte count of the transfer converted to the number of blocks.
scsi_setup_cdb(9F) does not support setting a target device's logical unit number (LUN) in bits 5-7 of byte 1 of the SCSI commandblock, as defined by SCSI-1. For SCSI-1 devices requiring the LUN bits set in the command block, use makecom_g0(9F) (or equivalent) rather than scsi_setup_cdb(9F).
After initializing the SCSI CDB, initialize three other fields in the packet and store as a pointer to the packet in the state structure.
The buf(9S) pointer is saved in the pkt_private field for later use in the completion routine.
Setting Target Capabilities
The target drivers use scsi_ifsetcap(9F) to set the capabilities of the host adapter driver. A cap is a name-valuepair whose name is a null terminated character string and whose value is an integer. The current value of a capability can be retrieved using scsi_ifgetcap(9F). scsi_ifsetcap(9F) allows capabilities to be set for all targets on the bus.
In general, however, setting capabilities of targets that are not owned by the target driver is not recommended and is not universally supported by HBA drivers. Some capabilities (such as disconnect and synchronous) can be set by default by the HBA driver but others might need to be set explicitlyby the target driver (wide-xfer or tagged-queueing, for example).
Transporting a Command
After creating and filling in the scsi_pkt(9S) structure, the final step is to hand it to the host bus adapter driver using scsi_transport(9F):
The other return values from scsi_transport(9F) are:
TRAN_BUSY – There is already a command in progress for the specified target.
TRAN_BADPKT – The DMA count in the packet was too large, or the host adapter driver rejected this packet for other reasons.
TRAN_FATAL_ERROR – The host adapter driver is unable to accept this packet.
The mutex sd_mutex in the scsi_device(9S) structure must not be held across a call to scsi_transport(9F).
If scsi_transport(9F) returns TRAN_ACCEPT, the packet is the responsibility of the host bus adapter driverand should not be accessed by the target driver until the command completion routine is called.
Synchronous scsi_transport() Function
If FLAG_NOINTR is set in the packet, then scsi_transport(9F) will not return until the command is complete,and no callback will be performed.
Note –Do not use FLAG_NOINTR in interrupt context.
Drivers Ene Scsi & Raid Devices Configuration
Command Completion
Once the host bus adapter driver has done all it can with the command, it invokes the packet's completion callback routine, passing a pointer to the scsi_pkt(9S) structure as a parameter. The completion routine decodes the packet and takes the appropriate action.
Example 14–5 presents a simple completion callback routine. This code checks for transport failures and gives up rather than retrying the command. If the target is busy, extra code is required to resubmit the command at a later time.
If the command results in a check condition, the target driver needs to send a request sense command unless auto request sense has been enabled.
Otherwise, the command succeeded. If this is the end of processing for the command, it destroys the packet and calls biodone(9F).
In the event of a transport error (such as a bus reset or parity problem), the target driver can resubmit the packet using scsi_transport(9F).There is no need to change any values in the packet prior to resubmitting.
Example 14–5 does not attempt to retry incomplete commands.
Note –Normally, the target driver's callback function is called in interrupt context. Consequently, the callback function should never sleep.
Example 14–5 SCSI Driver Completion Routine
Reuse of Packets
A target driver can reuse packets in the following ways:
Resubmit the packet unchanged.
Use scsi_sync_pkt(9F) to synchronize the data, then process the data in the driver and resubmit.
Free DMA resources, using scsi_dmafree(9F), and pass the pkt pointer to scsi_init_pkt(9F) for binding to a new bp. The target driver is responsible for reinitializing the packet. The CDB has to have the same length as the previousCDB.
If partial DMA was allocated during the first call to scsi_init_pkt(9F), subsequent calls to scsi_init_pkt(9F) can be made for the same packet and bp to adjust the DMA resources to the next portion of the transfer.
Drivers Ene Scsi & Raid Devices List
Auto-Request Sense Mode
Auto-request sense mode is most desirable if tagged or untagged queuing is used. A contingent allegiance condition is cleared by any subsequent command and, consequently, the sense data is lost. Most HBA drivers will start the next command before performing the target drivercallback. Other HBA drivers can use a separate and lower-priority thread to perform the callbacks, which might increase the time needed to notify the target driver that the packet completed with a check condition. In this case, the target driver might not be able to submit a request sense command in timeto retrieve the sense data.
To avoid this loss of sense data, the HBA driver, or controller, should issue a request sense command as soon as a check condition has been detected; this mode is known as auto-request sense mode. Note that not all HBA drivers are capable of auto-request sense mode, and some can only operate withauto-request sense mode enabled.
A target driver enables auto-request-sense mode by using scsi_ifsetcap(9F). Example 14–6 shows enabling auto request sense.
Example 14–6 Enabling Auto Request Sense
When a packet is allocated using scsi_init_pkt(9F) and auto request sense is desired on this packet, then the target driver must requestadditional space for the status block to hold the auto request sense structure. The sense length used in the request sense command is sizeof (structscsi_extended_sense). Auto request sense can be disabled per individual packet by just allocating sizeof (structscsi_status) for the status block.
The packet is submitted using scsi_transport(9F) as usual. When a check condition occurs on this packet, the host adapter driver takesthe following steps:
Issues a request sense command if the controller doesn't have auto-request-sense capability
Obtains the sense data
Fills in the scsi_arq_status information in the packet's status block
Sets STATE_ARQ_DONE in the packet's pkt_state field
Calls the packet's callback handler (pkt_comp())
The target driver's callback routine should verify that sense data is available by checking the STATE_ARQ_DONE bit in pkt_state, which implies that a check condition has occurred and a request sense has been performed. If auto-request-sense hasbeen temporarily disabled in a packet, there is no guarantee that the sense data can be retrieved at a later time.
The target driver should then verify whether the auto request sense command completed successfully and decode the sense data.
Dump Handling
The dump(9E) entry point is used to copy a portion of virtual address space directly to the specified device in the case of system failure orcheckpoint operation. See the cpr(7) and dump(9E) man pages. The dump(9E) entry point must be capable of performing this operation without the use ofinterrupts.
The arguments for dump() are as follows. dev is the device number of the dump device, addr is the kernel virtual address at which to start the dump, blkno is the first destination block on the device,and nblk is the number of blocks to dump.
Example 14–7 dump(9E) Routine
SCSA defines a global variable, scsi_options, which can be used for debug and control. The defined bits in scsi_options can be found in the file <sys/scsi/conf/autoconf.h>. The following table describes the use of thesebits.
Table 14–2 SCSA OptionsOption | Description |
---|---|
SCSI_OPTIONS_DR | Enables global disconnect/reconnect |
SCSI_OPTIONS_SYNC | Enables global synchronous transfer capability |
SCSI_OPTIONS_LINK | Enables global link support |
SCSI_OPTIONS_PARITY | Enables global parity support |
SCSI_OPTIONS_TAG | Enables global tagged queuing support |
SCSI_OPTIONS_FAST | Enables global FAST SCSI support: 10 Mbytes/sec transfers, as opposed to 5 Mbytes/sec |
SCSI_OPTIONS_FAST20 | Enables global FAST20 SCSI support: 20 Mbytes/sec transfers |
SCSI_OPTIONS_FAST40 | Enables global FAST40 SCSI support: 40 Mbytes/sec transfers |
SCSI_OPTIONS_FAST80 | Enables global FAST80 SCSI support: 80 Mbytes/sec transfers |
SCSI_OPTIONS_WIDE | Enables global WIDE SCSI |
The setting of scsi_options affects all host adapter and target drivers present on the system (as opposed to scsi_ifsetcap(9F). Refer to the scsi_hba_attach(9F) man page for information on controlling these options for a particular host adapter.