UsersGuide
UsersGuide
3 )
Contents 1
1 Introduction 14
1.1 Intended Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.2 What This Manual Covers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.3 Basic Overview Of CIL Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.3.1 Expandability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.3.2 Portability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.3.3 Quick Survey Of Current Features (Subject To Expansion) . . . . . . . . . . . . . . . . . 16
HGST Confidential 1
CONTENTS
HGST Confidential 2
CONTENTS
6.2.2 err . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
6.2.3 sns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
6.3 The Local Variable: cdberr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
6.3.1 Restoring default behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
6.3.2 Why is cdberr local? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
6.3.3 Some Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
6.4 Using catch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
6.4.1 Choosing Between cdberr and catch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
8 Command Queueing 94
8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
8.2 General Usage Stacked Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
8.3 Capturing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
8.4 Concurrent Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
HGST Confidential 3
CONTENTS
HGST Confidential 4
CONTENTS
HGST Confidential 5
CONTENTS
HGST Confidential 6
CONTENTS
HGST Confidential 7
CONTENTS
HGST Confidential 8
CONTENTS
D.126eparse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
D.127err_str . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
D.128esource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
D.129fcal abort_task_set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
D.130fcal abts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
D.131fcal clear_aca . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
D.132fcal clear_task_set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
D.133fcal lip_reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
D.134fcal port_login . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
D.135fcal process_login . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
D.136fcal reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
D.137fcal target_reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
D.138fcal term_task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
D.139feedback asynccqe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
D.140feedback color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
D.141feedback default . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
D.142feedback maxlen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
D.143feedback min . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
D.144feedback pop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
D.145feedback push . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
D.146feedback showatafis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
D.147feedback showcdb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
D.148feedback showcqe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
D.149get_cil_list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
D.150get_cq_str . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
D.151get_kcq_str . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
D.152init . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
D.153niagara_log_puts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
D.154nvme dump_cid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
D.155nvme dump_cq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
D.156nvme dump_sq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
D.157nvme get callback reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
D.158nvme get controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
D.159nvme get cq_ids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
D.160nvme get cq_size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
D.161nvme get device_index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
D.162nvme get drain_cq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
D.163nvme get last_cid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
D.164nvme get last_dword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
D.165nvme get last_dword0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
D.166nvme get last_dword1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
D.167nvme get last_err_logpage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
D.168nvme get last_status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
D.169nvme get page_size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
D.170nvme get register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
D.171nvme get sq_ids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
D.172nvme get sq_size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
D.173nvme reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
D.174nvme reset_queue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
D.175nvme set callback reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
HGST Confidential 9
CONTENTS
HGST Confidential 10
CONTENTS
HGST Confidential 11
CONTENTS
HGST Confidential 12
CONTENTS
Index 352
HGST Confidential 13
Chapter 1
Introduction
In this manual, we look at Niagara, which is built on the CIL Drive Testing System, and how to use its various
capabilities. CIL stands for Common Interface Layer. The CIL is named to emphasize the way the software is
built: a set of testing components combined to form a full featured tool. The strength of this architecture is that it
makes Niagara easy to modify and expand.
We will also look at Niagara’s graphical and command line interface. The graphical interface is designed to
be intuitive to those who are new to Niagara and convenient for those who have learned the tool. The command
line interface is a more powerful tool that incorporates the TCL language. The command line interface is flexible
and powerful. In fact, the entire GUI interface is built from the command line features alone!
In addition to this manual, The CIL Programmers Guide provides the following information:
In addition to this manual and the programmer’s guide, programmers will find it helpful to have reference
manuals available for the C++ and TCL languages (the two languages used to build Niagara and the CIL).
HGST Confidential 14
CHAPTER 1. INTRODUCTION
1.3.1 Expandability
The CIL is very expandable. The key to this expandability is the UIL (Universal Interface Layer). This layer
is an abstraction that all devices communicate through. This layer is very abstract (it is loosely based on UNIX
device driver design). The abstract nature allows the UIL to be expanded to control everything from a SCSI/FCAL
device to a serial port, a power supply, or virtually any other device.
There are several layers to the CIL that can be expanded (this is explained in more detail in the CIL Program-
mers Guide). At the upper layers, new procedures can be added to TCL directly from the command line. At lower
layers, we find a C interface for adding higher performance TCL commands, a lower-level C interface for writing
custom apps (or linking to other languages) and another layer for adding support for new devices. Adding a fea-
ture to a layer generally expands the capabilities of all of the upper layers as well. See figure 1.1 for a diagram
that shows the CIL’s architecture.
Most of CIL’s expansion is accomplished through dynamic libraries. This is a plus because it means that
features can be added to the CIL without reinstalling it.
1.3.2 Portability
One of the reasons that TCL was chosen was due to its portability, all the way to the graphical user interface.
This, in combination with all ANSI standard C code, makes the CIL portable across multiple architectures. Most
TCL scripts written on one architecture (such as Windows) will run on a different architecture (such as Linux)
without change. This means many tests will only have to be written once. The C interface also provides an
abstraction that permits a CIL application written in C to compile and run on different platforms without modifying
HGST Confidential 15
CHAPTER 1. INTRODUCTION
the source.
1.3.3 Quick Survey Of Current Features (Subject To Expansion)
It is difficult to provide a concrete feature list for the CIL, namely because the CIL is so expandable. Most
features that will be needed can created as they are needed. Below, however is a list of currently implemented
features:
• GUI Interface
• C Interface
– Ability to add commands to TCL that fully integrate with the CIL
– Command Queuing1
– Command Aborts2
– Card and Device Resets3
– Lip control4
– Ability to create new device drivers
HGST Confidential 16
Chapter 2
At the top of the Command window, there are tabs labeled SCSI and ATA. When users are interfacing with
a SCSI drive, the SCSI tab should be selected so that all of the SCSI tools are available. Likewise, the ATA tab
should be selected when interfacing with an ATA drive so that all of the ATA tools are available.
Each SCSI/ATA tab of the Command window consists of three sections. The Device List section is used to
select devices and the current UIL driver. This section is described in section 2.2. The Action List section contains
groups of actions that can be executed with the GUI. These groups include:
• CDB Commands: This group contains all of the CDB’s that can be sent to a drive. CDB Commands are
described in more detail in section 2.3 on page 19.
HGST Confidential 17
CHAPTER 2. USING THE GRAPHICAL USER INTERFACE
• ATA/ATA Pass-Through Commands: This group contains all of the ATA or ATA Pass-Through com-
mands that can be sent to a drive.
• Special Commands: This group contains all of the special commands that can be sent to a drive.
• HDD/SSD Tools: This group contains additional tools to interact with a drive. A user can also add their
own custom tools. Details of how to do this can be found in Appendix 11 on page 109
The Quick Buttons section of the Command window contains a set of quick buttons. This customizable set
of buttons are used to access frequently used commands quickly. The default set of buttons contain the following
types of functions:
• Shortcuts to Common CDBs: Often used CDB’s such as “Test Unit Ready” and “Inquiry” are available
with the click of a button. See section 2.3.1 for more information.
• Buffer Management Functions: These functions provide ways to see information that was transferred
from the drive and to set up data to be transferred to the drive. See section 2.4 for more details.
• Download Code: This allows for microcode to be uploaded on a drive. See section 2.5 for more details.
• Format: This button provides users the chance to format their drive. See section 2.6 for more details.
• GoldRush: This button brings up the Gold Rush GUI, which provides a quick test of new firmware. See
section ?? for more details.
• Lock Drives: This button provides users the chance to lock drives or disable system drive removal. See
section 2.8 for more details.
• Log Bin: This button provides a log dump of a drive. See section ?? for more information.
• Mode Selection: This button brings up a dialog that allows for quick mode sense and selection operations.
See section 2.9 for more details.
• Super CSO: This button brings up the Super CSO GUI, which contains a set of typical and customizable
drive tests. See section 2.10 for more details.
Also in the Quick Buttons section is the Frequent Tools tab, which presents a list of the last tools used by the
user.
HGST Confidential 18
CHAPTER 2. USING THE GRAPHICAL USER INTERFACE
HGST Confidential 19
CHAPTER 2. USING THE GRAPHICAL USER INTERFACE
on the dump button. To save the buffer to a file either type in the filename manually within the file entry or choose
browse for a file selection dialog. After configuring the tool to output to a file you can click the dump button to
save the buffer to the file.
HGST Confidential 20
CHAPTER 2. USING THE GRAPHICAL USER INTERFACE
HGST Confidential 21
CHAPTER 2. USING THE GRAPHICAL USER INTERFACE
HGST Confidential 22
CHAPTER 2. USING THE GRAPHICAL USER INTERFACE
2.6 Format
The Format tool can be used to format the drive with different parameters. Figure 2.7 shows the Format GUI.
A drive’s block size or max LBA can be adjusted by entering new values in the appropriate fields. When you are
satisfied with your parameter selection, the Format can be started by selecting the Format button.
HGST Confidential 23
CHAPTER 2. USING THE GRAPHICAL USER INTERFACE
HGST Confidential 24
CHAPTER 2. USING THE GRAPHICAL USER INTERFACE
HGST Confidential 25
CHAPTER 2. USING THE GRAPHICAL USER INTERFACE
HGST Confidential 26
CHAPTER 2. USING THE GRAPHICAL USER INTERFACE
HGST Confidential 27
Chapter 3
3.1 Introduction
This chapter explains the basics of using the command line interface. The command line provides a shell
like interface to a device and provides more powerful features (such as scripting) than are provided through the
Graphical User Interface alone. The drawback to this is that the command interface requires a commitment from
the user to learn it (and lacks the intuitive nature of the graphical user interface). Once learned, however, the
command interface will likely become the interface of choice for many users.
We will begin by looking at the format for drive (CDB) commands followed by commands to control buffers
and other features of the CIL. Note that in some cases, we will be using a bit of TCL code to explain a command
in more detail. Feel free to reference chapter 5 on page 74 (which gives an introduction to TCL) whenever you
are unclear about what an example is doing.
inq
This will perform a device inquiry and output the results, just as it would from the graphical user interface.
You could have also typed:
inquiry
IMPORTANT: The current device in the command line is completely independent of what is selected in
the GUI. Look at the command prompt to see what the current device is. An example command prompt would
be ’(uil=0:sg)(dev=0)>’. This command prompt tells us that sg is our current uil and device #0 is our
current device. See section 3.4.1 on page 54 for information on how to select devices. Also the command line
interface only allows you to interface a single drive at a time. The GUI allow you to select multiple targets.
Most drive commands have 2 forms, a descriptive form (inquiry) and a short form (inq). To see a list of all of
the drive commands available type:
get_cdb_list
This will display a list containing all available device commands. Note that only the long form of the com-
mands are printed. In addition to the commands shown by get_cdb_list, you also have access to all of the
built in TCL commands (such as set, if, and puts). Through TkCon1 , you also have access to all of the OS
commands provided by your shell2 . TkCon also gives you the option of using the interface as a calculator, for
example:
expr 5+5
1 TkCon is a free command line extension program, written in TCL by Jeffery Hobbs. For information on the latest version, go to
http://tkcon.sourceforge.net
2 In Linux this includes commands such as ls, cp, and rm. In Windows this Includes commands such as dir, copy, and del
HGST Confidential 28
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
One thing to note is that, if you do not include a decimal point in your calculations, you will get integer math.
Fix this by post-fixing .0 at the end of one of your numbers. Here is an example:
1. If there are multiple possible completions for the command as you have typed it thus far, these completions
are shown.
2. If there is only one completion for the command as you typed it thus far, the command will be completed
for you.
As an example of the second rule, enter inqu and type tab. The rest of the command will be typed for you.
To see the short form of a drive command, type the command name followed by -help3 . For example:
inquiry -help
****************************************
Parameters:
HGST Confidential 29
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
Looking at other data returned by inq -help, we also see the each parameter has a range and a default
value. Any parameters you exclude when calling a command use this default value. With this in mind you can
see what the default operation of any command is by using the -help option and examining the default value for
each parameter.
In the data returned by inq -help there is also a section describing the range of each parameter. What
happens if you go outside of this range? Basically your result is bit truncated to fit in the desired range. As an
example, if a parameter has a range of 0-0xFF and you enter 0x123456 as a value, the low order 8 bits are
used so you will actually be sending 0x56.
3.2.2 Command Options
This brings us to our next topic, command line options. As you probably already know, there is more than one
way to call the inquiry CDB. As the GUI allows you to customize the format of the inquiry you will receive, the
command line offers the same functionality. Note the parameter list given in the help. Here we see a -pagecode
option. Let’s try using this option to do an inquiry on page 0x804 :
Note that you need to prefix 0x to all hexadecimal numbers. Any number without a preceding 0x is considered
to be in decimal form. Using the above pattern, we can specify any of the options available to the inquiry
command. The only problem is that it can be tedious to type in all of the parameter descriptors. Because of this,
there is a shortcut to the above form:
This works because -pagecode is defined as the first parameter in the Default Parm Order5 . Here is
the Default Parm Order for the inquiry command:
and:
4 Calling this command as shown in the example will likely throw a check condition from the drive, generally you need to turn on the evpd
bit to read this page
5 To see the Default Parm Order for a CDB command, type the command’s name with the -help option
HGST Confidential 30
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
Note above that when you explicitly use the -pagecode and -alloc options, the ordering is not important.
When you exclude the -pagecode or -alloc option, however, the ordering of the arguments must match those
specified in the Default Parm Order. You can also mix default parameters with options as shown below:
Once you start using - options, you can not use the shorter form for the remainder of the line. The following,
for example, is not allowed:
Because we entered the -evpd option, the interpreter does not know what option 0x80 relates to. The
correct form (assuming you want 0x80 to represent the page code) is inq 0x80 -evpd 1. In short, look
at the Default Parm Order in a command’s -help description to see which parameters can be entered
without using a - option in front. As a final note, because this is a programming language, you can use variables
and functions in place of parameters. See the chapter on TCL programming (page 74). Here are some examples:
The interpreter above works by substituting certain keywords for values. Here is a table of possible substitu-
tions:
Keyword Substitution
start 1
stop 0
true 1
false 0
on 1
off 0
send [buff get si]
recv [buff get ri]
HGST Confidential 31
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
HGST Confidential 32
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
HGST Confidential 33
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
HGST Confidential 34
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
HGST Confidential 35
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
HGST Confidential 36
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
HGST Confidential 37
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
For example: buff fill zero 0 512 fills a buffer with zeros while buff dump 0 dumps the con-
tents of buffer #0 to the screen. Below we give a table the commands and a brief description of each. In the
sections that follow, we look at each command in more detail. Commands in type are accepted commands.
Commands in italics are not full commands and will prompt you with additional options when entered as-is:
HGST Confidential 38
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
HGST Confidential 39
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
HGST Confidential 40
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
HGST Confidential 41
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
HGST Confidential 42
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
HGST Confidential 43
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
HGST Confidential 44
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
HGST Confidential 49
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
HGST Confidential 50
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
HGST Confidential 51
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
Device Information
There are 2 ways to get device information, device info, and device list. Typing device info
returns a detailed list about the currently connected device. Here is an example:
You also have the option of looking at these parameters individually. For example:
This can be useful in scripts. Options available are blocksize, channel, codelevel, host, lun,
maxlba, serial, target, and vendor.
The device list command lists all of the connected devices and provides some information about each
one. Here is an example:
Indx| Vendor Info | hst chn id lun Max LBA Blk Size
----+--------------------------------+----------------------------------
0 | HP CD-Writer+ 8290 1.3C | 0 0 0 0 296398 2048
1 | SanDisk ImageMate II 1.30 | 1 0 0 0 15680 512
----+--------------------------------+----------------------------------
HGST Confidential 53
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
HGST Confidential 54
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
****************************************
Parameters:
If we look at “Buffer Data Received” above, we see that a buffer (the receive buffer) is receiving data from
the drive. Where does this data go? The data goes into a special buffer that is managed by the CIL software.
The buff command provides access to both this buffer and the send buffer that is used with commands such as
write106
Let us look at the contents of a buffer. Start the CIL (start it from scratch to make sure the Buffers are in their
default condition) and type the following:
inq
You will see some data dumped to the screen. This data that you see is also stored in a buffer. To see the
buffer, enter the following:
6 There are actually more than 2 buffers managed by the CIL. We will cover this feature later...
HGST Confidential 55
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
buff dump 1
The buffer should match that returned by the inq command (except that buff dump 1 displays more data
than inq did).
The buff dump command’s format is:
The offset and length parameters are both optional and are used to get more control over what part of
the buffer you see. The default offset is zero bytes. The default length is 255 bytes. The default send buffer index
is zero. The default receive buffer index is 1. You can also say:
This command uses the same type of format string used by printf in C. In case you are not familiar with
this, here is an example:
This command first does an inquiry to fill the receive buffer (which we are assuming is index 1) with inquiry
data. After the buffer contains data, the buff format command is used to extract some information. Specifi-
cally, the %s tag identifies that we should substitute a string. The next field, {8 8}, specifies the offset and length
within the buffer to use for constructing the string. In addition to strings, you can also specify decimal integers
(%d and %u), hexadecimal integers (%x and %X) and others. Look up use of the printf C function for details.
You can also have multiple substitutions per line. Below we use the read_capacity cdb with buff format
to print out the max lba and block size returned by the command:
read_capacity
buff format 1 "Max LBA: %u (0x%x hex)" {0 4} {0 4}
buff format 1 "Transfer Length: %u (0x%x hex)" {4 4} {4 4}
HGST Confidential 56
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
This command fills buffer 1 with zeros, starting at an index of zero and continuing for 512 bytes. To see the
changes you made to a buffer, use the buff dump command:
In this example we used the buff fill rand command to write 1024 random bytes to buffer 2. In the line
after this we look at the contents of what we wrote. In addition to buff fill zero and buff fill rand,
there is buff fill one to fill the buffer with all 0xFF bytes. We can also fill the buffer with any other byte
using the buff fill byte command:
#format for this command is buff fill byte <index> <offset> <length> <byte>
buff fill byte 0 50 1000 0xCC
buff dump 0 1050
This example fills the buffer 0 with 1000 0xCC bytes, starting at an offset of 50. The buff dump command
below it shows that the first 50 bytes of the buffer were left undisturbed. We can also fill the buffer with sequential
bytes:
The final two fill commands are useful for writing a set of bytes to the buffer. The buff fill patt
command writes a repeating pattern of bytes to the send buffer. For example to fill buffer 6 with the pattern 0x0A,
0x0B, 0x0C, 0x01, 0x02, 0x03, we would use the command:
This command can also be useful for setting a string of hex digits that repeat once, such as in setting mode
pages. For this operation, simply set the length to the same as the number of bytes you specify. Here is an example
that sets 5 bytes:
Our final fill command, buff fill string, is used to write an arbitrary string to the drive. Here is the
format:
We can also send the results of a TCL command. Here is an example that fills a buffer with random data, then
encodes the first few bytes of the data with the current time and date:
HGST Confidential 57
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
Another convenient function is buff fill int. This function can be used to quickly fill in a buffer
parameter that is 4 bytes wide. Here is an example:
Note that the bytes above are stored in “big endian” format (the same as the SCSI standard). If you want
to store in “little endian” you can use the buff fill byte in combination with shift and mask. Here is an
example procedure that implements little endian int fill:
You can also use the “shift and mask” trick as shown above to fill 2 and 3 byte values into the buffer.
For our final note, we can use send and recv in place of our buffer index. Here is an example:
#this command
buff fill rand send 0 512
#is the same as
buff fill rand [buff get si] 0 512
SHORTCUT: You can use the following commands in place of their longer winded versions:
Command Name Shortcut
buff fill byte bfb
buff fill int bfi
buff fill one bfo
buff fill patt bfp
buff fill rand bfr
buff fill seq bfs
buff fill string bfstr
buff fill zero bfz
Loading And Saving Buffer Data
In addition to generating data on the fly, we also have the option of loading and saving buffers to a disk file.
The format for these two commands is:
The buff load commands loads a disk file into memory. The ?offset? variable is optional and specifies
an offset into the buffer other than the default of zero. Here is an example that loads a buffer with a file named
README.txt and then writes the first 512 bytes of the buffer to block 100 of our current device7 .
7 Assuming our device’s blocksize is 512
HGST Confidential 58
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
Note that the buffer data is loaded into the send buffer. We could have used a numerical index (such as 0) in
place of send above. The buff save command is performs the reverse of the buff load command. Here
is an example that gets an inquiry and saves the results to a file named inqdata.bin:
inq 0x0 96
buff save inqdata.bin 1 0 96
The buff save command saves the data from the current receive buffer (the default receive buffer is buffer
#1). Because the inq command puts its data in the same buffer, saving the information is straight forward.
Comparing buffers
Often it is useful to compare the contents of one buffer with that of another. In the next section we will see
how to change the send and receive buffers to allow for elaborate data compares. In this section, however, we will
stick to the tried and true setup of the send buffer being buffer 0 and the receive buffer being buffer 1. To compare
two buffers for equality, use the buff compare command. This command has the following syntax:
The compare command, as described above, compares buffer a and b for amount bytes. If the buffers
compare equally, a 0 is returned, otherwise a 1 is returned. Below is an example that writes random data to a
device, then reads in the data and compares:
HGST Confidential 59
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
Above we see the use of the buff set ri command. This command sets the receive buffer index. By
setting it to 2 different values for each drive, we set ourselves up for a convenient buffer compare. Another useful
command is buff set si. This sets the buffer used for the send index. This command is useful for writing
data to a drive that we read with a different command. Here we modify the above script to swap the first million
blocks between two drives (note how we avoid any memory copying in this example):
#read data
device set index 0
buff set ri 1
r10 $i 100
With a little creativity, you can probably come up with more useful applications for multiple buffers. In some
cases it might also be useful to copy a buffer, perhaps to store a master copy of data. The command for this is
buff copy. The command has 2 formats. The first format is straight forward:
buff copy 1 0
The command above would copy the information stored in buffer 1 to buffer 0. The original contents of buffer
0 are overwritten. The second format is more flexible:
Say you wanted to copy bytes 60-100 of buffer 0 to bytes 200-240 of buffer 1. This would be the command:
HGST Confidential 60
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
The above says: “Copy buffer 0 to buffer 1, start at offset 60 in buffer 0, start at offset 200 in buffer 1, copy
40 bytes”.
SHORTCUT: Because you might want to change buffers often from the command line and the buffer set
command involves a lot of keystrokes two shortcuts are provided. Instead of typing buff set ri, you can type
bri. Also, instead of typing buff set si, you can type bsi. Here is an example:
bsi 0
Having all of these device types available under the same commands means that your same scripts can poten-
tially work with all of these driver types. This “driver plug in” capability allows for a flexible testing environment.
The command that allows you to control this environment is uil.
The acronym uil stands for Universal Interface Layer. It is the mechanism that allows the capabilities
described above. Using the uil command you can:
First we will look at how to see what drivers are loaded. Enter the command:
uil list
This will show the names and index for each driver loaded as well as the number of devices recognized by the
driver. Note that different drivers can recognize the same device (Although they may do so to different capacities).
To find out the driver you are currently using type:
uil info
This tells you the driver that commands are currently being directed at. To change this driver, use the
uil set index command. For an example, let us assume that we have a driver named test (which we
probably do) and that it’s index is 1. Type the following:
HGST Confidential 61
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
Because we set ourselves to use the test driver, the inquiry was never performed on an actual device. Use
uil set index 0 to return to the default driver.
SHORTCUT: The uil set index command, although descriptive, can be a nuisance to type. Because
of this, you can also use the usi shortcut for the same effect. For example:
usi 1
Other useful uil commands are beyond the scope of this manual. Here is a brief description of what they are:
• uil create: This command loads a new driver into memory and initializes it. This is also generally
done by the startup scripts although experienced users can also use the command to load drivers as they are
needed.
• uil remove: This command removes a driver added by buff create.
• uil load: This command is used to add C extensions to the CIL interface. These extension are generally
in the form of high performance TCL commands.
• uil count: This command simply returns the number of drivers currently loaded.
feedback min
This will set the feedback to the minimum amount. Basically, after executing a feedback min command,
commands such as read10 will only indicate if they were successful. You can still see the buffer contents using
the buff dump command, but these contents will no longer be printed automatically. To return the feedback to
default type:
feedback default
This will return the level of feedback to its default setting. Another feedback command is:
feedback maxlen
This command sets the maximum number of buffer bytes that are printed. When a command returns data the
command will either dump out the number of bytes returned or maxlen, whichever is smaller. Here are some
examples to clarify:
feedback maxlen 10
inq 0 96 ;# prints 10 bytes, because that is the value of maxlen
inq 0 150 ;# prints 10 bytes, because that is the value of maxlen
HGST Confidential 62
CHAPTER 3. BASIC USE OF THE COMMAND LINE INTERFACE
inq 0 150 ;# prints 100 bytes, because that is the value of maxlen
random(maxlba − maxblk)
HGST Confidential 63
Chapter 4
4.1 Introduction
The serial extension provides a means for the CIL to communicate with a drive via the serial interface. This
extension is meant to integrate Serial Debugger functionality into the CIL both for the sake of convenience and
the ability to write scripts that make use of the serial interface and the drives standard interface (SCSI, FCAL, and
SATA) together. Another advantage of the merger is that many added functions and bug fixes can benefit both the
serial and standard interface. The TCL scripting language and true buffers also make it possible to create more
powerful serial scripts.
The serial/serial3 drivers provide a means for the serial extension to communicate with the drive itself. The
serial driver supports the UART2 protocol where the serial 3 driver supports the UART3 protocol. These drivers
handle all of the behind-the-scene serial protocols. The two protocols are not compatible with each other.
4.1.1 Basic Architecture
The serial extension is based on a 2 level architecture. The lowest level is written in C++ as a CIL driver. This
provides the advantage of having all of the CIL features provided for free and letting it deal with the protocol.
The other layer is the TCL interface layer. The result is more powerful command line and scripting functionality.
This gives users the ability to write scripts which are supported in both Windows and Linux.
4.1.2 Integratability
Another big advantage of the CIL’s serial extension is that one can write scripts that take advantage of the
serial extension and the drives more traditional interface (SCSI or FCAL) in the same script. This allows for more
creative use of the serial interface in debugging applications.
4.1.3 Buffers
The Serial Debugger has no real concept of buffers. One capability that is provided was the ability to create a
“virtual drive” from a “dump file”. This file could then be acted on with regular serial debugger commands.
Because it is a part of the CIL, the serial extension has extensive support for buffers. As with other CIL
commands, reading from the serial port automatically stores its results in the receive buffer. Writing to the serial
port also comes from the send buffer, although there is an option for filling data within the swrite command
(for convenience).
This support for buffers also introduces the other following changes:
• “Save to file” is no longer provided by the serial read function (sread). This functionality is provided by
buff save.
• “Write from file” is also no longer provided by swrite. The buff load command is used instead.
• There is no longer a concept of a “virtual device”. Equivalent functionality is provided by the buff dump
command. Simply load the dump file into a buffer using the provided utility and use buff dump instead
of sread. The reasoning behind this change is that it makes the function of sread and swrite less
ambiguous (they ALWAYS read from the serial port now).
HGST Confidential 64
CHAPTER 4. USING THE SERIAL EXTENSION
4.3 Commands
In this section, we will look at the basic commands provided by the serial extension. These commands are
supported in both UART2 and UART3. More on the differences later.
secho
This command simply asks the device to return it’s vendor id and serial number. This command is used to
confirm a connection with the drive.
This command writes information from the send buffer to the drive. As a convenient shortcut, data can be
specified in the command line. This data is then written to the send buffer before the command sends the send
buffer to the drive. The -dw and -dd options specify the format that the command line data is in. These options
only make sense to use when data is entered as part of the command. The data itself must be separated by spaces
and must start with “0x” whenever hex data is used.
This command is used for reading memory in the drive. Note that, because this is a TCL command, you must
precede all hex addresses with “0x”. The -dw option displays the buffer content in 16-bit word (little endian)
format. The -dd option displays the buffer contents in 32-bit (little endian) format. Note that the -dw and -dd
options have no effect on how the contents are stored in the buffer. The buffer is always stored in byte format. The
-dw and -dd options can also be used with the buff dump commands to view the buffer in the same format as
returned by sread.
sreadsp
This command takes no arguments and returns the current value of the drive’s stack pointer.
suart_level
HGST Confidential 65
CHAPTER 4. USING THE SERIAL EXTENSION
This command returns the current UART version of the device over serial. This is done by sending a sync
packet in UART2 and if that doesn’t respond within a few milliseconds it will try it over UART3. If UART3 also
times out then no devices are attached.
suart2
This command sets the serial communication link (using UART3 protocol) to the UART2 protocol.
suart3 [speed]
This command sets the serial communication link (using UART2 protocol) to the UART3 protocol. The
speed value determine the link speed in UART3. See the table on UART3 Line Speed Coding.
get_serial_list
This command returns a list of available serial commands.
4.4 UART
4.4.1 UART 2
With the Indy/Monza line of hardware, a new UART protocol was introduced: UART2. UART 2 is backwards
compatible with the original UART specification, so all of the existing CIL serial commands will continue to
function correctly. In addition, UART 2 adds several new serial commands as well as support for sending CDB
commands through the serial interface.
HGST Confidential 66
CHAPTER 4. USING THE SERIAL EXTENSION
Once the sversion command has been issued and the uil index has been changed to point to the serial driver,
CDB commands may now be sent through the serial interface. To send a CDB, follow the same procedure as
with the regular SCSI or F-CAL interface. The serial driver handles all the behind-the-scene serial protocol and
returns the expected data. All of the same CDB parameters are available–just issue the CDB command with all
desired parameters, and the CIL will construct the CDB command and pass it to the serial driver. Then, the serial
driver will wrap the CDB in the correct serial frame and perform all of the querying and data xfer stages. Finally,
the serial driver will receive the CDB response wrapped in a serial response block; the serial driver will strip the
response block header information and return to the CIL only the CDB response data. If an error occurs during
the communication, then the serial driver will attempt to correct the error, and upon giving up it will attempt to
request status. If the CDB command returns an error, then the serial driver will request status and return it to the
CIL.
For debugging purposes, it is not useful to have the serial driver perform all of the querying and data xfer
phases of the serial CDB command. Because of this, the individual serial commands are available that send
the CDB, query the drive, and transfer data. Note, however, that the UART 2 protocol must be followed for
these commands to be successful–the user is responsible for sending the squery commands and issuing the sxfer
commands at the correct times! Please see scdb (page 69), squery (page 69), sxfer (page 69), and sabortCDB
(page 69) for more information.
HGST Confidential 67
CHAPTER 4. USING THE SERIAL EXTENSION
4.4.3 UART 3
With the Formidible line of hardware, a new UART protocol was introduced: UART3. UART3 is not back-
wards compatible with the UART2 specification. However most of the UART2 commands have an equivalent
UART3 command. This required that a new driver, the Serial3 Driver, be created to handle all of the behind-the-
scene serial protocols, which was designed to act just like the original Serial Driver. Users can still send the same
CDBs to the drive just as they did with the Serial Driver. The Serial Extension did require an update as well.
It was modified so it will send the appropriate sread/swrite/etc commands to either the UART2 (serial) driver or
UART3 (serial3) driver. The suil driver is the UIL that receives the serial command. This allows scripts that were
written before the UART3 specification was created to still work without any changes to it.
The Formidible line also supports UART2. Because of this, we needed to create additional commands in order
for the user to switch to and from UART3. Hence suart2 and suart3 speed were created. See below for
more information on these commands.
4.4.4 UART2 & UART3 Commands
The following commands remain the same in UART 3 as they were in UART 2.
sversion
This command takes no arguments, and it will return two bytes specifying the version of UART that the current
drive supports. Note the return value doesn’t mean that it supports UART2 or UART3 protocols.
Here is an example of what the the sversion command will look like an a UART 2 drive:
(uil=0:serial)(dev=0)> sversion
Success
OFFSET 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0123456789abcdef
------ ------------------------------------------------ ----------------
000000 00 05 ..
HGST Confidential 68
CHAPTER 4. USING THE SERIAL EXTENSION
scdb
The scdb command is one of the essential commands used for sending a CDB command to the drive through
the UART interface. To be successful, this command must be used in conjunction with squery, sxfer, and possibly
sabortCDB. The scdb command takes one parameter, ?length?, which specifies how many bytes to use from the
send buffer. Then a serial CDB command block is constructed, using the first ?length? bytes from the send
buffer as the CDB command to send. Note: the CDB length is checked to verify it is 6, 10, 12, or 16 bytes long;
however, the actual bytes are not checked to verify that they form a valid CDB. If there are no errors during the
communication, then the drive will return a busy response block, signifying that the drive received the command
successfully and is busy processing it. After sending a successful scdb command, the next phase should be the
query phase. scdb reference entry: page 345
sabortCDB
The sabortCDB command is one of the essential commands used for sending a CDB command to the drive
through the UART interface. In most cases, this command will be used in conjunction with scdb, squery, and
sxfer. The sabortCDB command tells the drive to abort any current UART CDB processing and return the UART
CDB handling to an initial state. This command takes no parameters, and it will return the entire header and
response block information received from the drive. This command is used when a CDB has been sent, but the
entire process of querying and data transfer cannot be completed. In this case, an sabortCDB command should
be issued to clear the state of the UART, and then the entire CDB phase must be started from the beginning. This
command may also be used as a last resort in effort to clear the state when an initial scdb command returns an
error. sabortCDB reference entry: page 345
4.4.5 UART2 Only Commands
sdelay
The sdelay command will tell the drive to change the delay between data receive and data send. The default
is for the drive to wait 250 micro seconds after receiving data before sending response data. The one required
parameter is an integer that specifies the new delay in micro seconds. On some older systems, 250 micro seconds
may not be enough time for the computer to be ready to receive response data–a communication sync problem
will occur. In this case, increasing the delay may correct this problem. sdelay reference entry: page 346
slip
The slip command will (on a Fibre Channel drive only) cause the drive to request LIP. There is one parameter,
?LIP type?, is a one byte value that will specify the type of LIP; it may be 0xF7 or 0xF8. The UART device will
return status acknowledging that it received the slip command, and then it will perform the appropriate tasks to
request LIP. slip reference entry: page 347
squery
The squery command is one of the essential commands used for sending a CDB command to the drive through
the UART interface. To be successful, this command must be used in conjunction with scdb, sxfer, and possibly
sabortCDB. The squery command takes no parameters; when issued, it will send a query frame to the drive, asking
for status on whether it is ready or not. This command is meant to be used to poll the drive after sending a CDB
frame and between data xfer stages. The squery will return 8 bytes of data (the entire busy, ready, or fault response
block). After issuing a successful scdb command, the squery command should be issued until a ready frame is
received. Also, after the data xfer phase is complete, the squery command should be issued until a ready response
block is received before a status data xfer command is sent. squery reference entry: page 347
sxfer
The sxfer command is one of the essential commands used for sending a CDB command to the drive through
the UART interface. To be successful, this command must be used in conjunction with scdb, squery, and possibly
sabortCDB. The sxfer command will send a data xfer command block to the drive. There are three basic types of
HGST Confidential 69
CHAPTER 4. USING THE SERIAL EXTENSION
data xfer commands that may be sent: inbound data, outbound data, and command status. There are 4 required
parameters that specify what type of data xfer to send. The ?Transfer Bit? parameter should be a 0 or 1 that
specifies which direction the data is going to be transferred (0 for inbound, 1 for outbound). The ?Status Bit?
parameter should be a 0 or 1 that specifies whether or not this data xfer frame should be used for transferring
status. If the status bit is set, then this command will request the return status of the CDB that was sent; this
should only be issued when the inbound/outbound data xfer stage is complete, or when the drive, after a query
command, returns a fault response block instead of a ready or busy response block. The last two parameters of
sxfer are ?Send Length? and ?Recv Length?. The send length will only be used if the command is an inbound
data transfer to the drive, and the receive length will only be used if the command is an outbound data transfer
from the drive. Since the actual bytes received during a data xfer command is read in on the header of the data
xfer response block, the ?Recv Length? parameter will be overridden. As long as the ?Recv Length? is greater
than zero, the correct amount of data will be read in and returned. sxfer reference entry: page 351
suart3
This command is new in conjunction with the UART3 Interface Specification. Note: This command is only
supported if the driver returns a value of 5 or higher for the UART Version command. This command requires
a coded speed value for the new speed for the interface. See Code & UART Speed Table for valid values. The
suart3 speed command causes the drive to switch to the UART3 protocol specification for this interface. The
drive will send a response block to the host in the UART2 protocol and current speed indicating the command is
acknowledged. If the command was valid the change to the new protocol and speed will occur immediately after
the response is sent.
suart3 reference entry: page 350
4.4.6 UART3 Only Commands
sstatus
This command is the Get Drive State request which can be used by the host to check on the status of a long
running SCSI command (such as a manufacturing command). The drive will respond to the request with the ack
Data Available and will return a Get Drive State response followed by the state data.
Byte: Description:
0-1 Drive state version (0x0001)
2-3 Operating State (Equivalent to the Operating State field of Inq page 3.)
4-5 Functional Mode (Equivalent to the Functional Mode field of Inq page 3.)
6-7 Degraded Reason (Equivalent to the Degraded Reason field of Inq page 3.)
8-9 Broken Reason (Equivalent to the Borken Reason field of Inq page 3.)
10-11 Reset Cause (Value definition is beyond the scope of this document.)
12-13 Showstop state:
0x0000 - No Showstop has occurred.
0x0001 - Showstop has occurred and drive is ’stopped’.
0x0002 - Showstop has occurred and the drive is attempting to reset itself.
14-15 Showstop reason (Value definition is beyond the scope of this document.)
16-19 Showstop value (Value definition is beyond the scope of this document.)
HGST Confidential 70
CHAPTER 4. USING THE SERIAL EXTENSION
The correct port-name (COM1, COM2, etc) should be substituted for ?PortName?. This parameter will cause
the CIL to assume that a drive is connected to that port, and it will create the device without actually scanning the
bus. The advantage of this is that no information will cross the bus until the user manually sends a command.
4.5.2 Supported UIL Messages
The “UIL message” command (page 337) allows specific commands to be defined for each driver. The serial
driver has several messages that it recognizes.
get_delay and set_delay
The “get_delay” message takes no parameters; it returns the current delay (in ms) that the driver waits between
packets. The “set_delay” message takes on parameter, an integer. It changes the post packet delay to the new value
specified in ms.
get_retry_count and set_retry_count
The “get_retry_count” message takes no parameters; it returns the current number of times a serial command
block will be retried after a failed attempt. The default value is 5. Every command will be attempted at least once,
and then the retry count specifies how many more times it will be tried. The “set_retry_count” takes one integer
parameter that changes the retry count.
HGST Confidential 71
CHAPTER 4. USING THE SERIAL EXTENSION
• The “sdelay” command (page 69) may be used to change the delay that the drive uses between the read and
write phase.
• The “set_delay” message (page 71) may be used to change the time that the serial driver waits between
sending packets.
HGST Confidential 72
CHAPTER 4. USING THE SERIAL EXTENSION
• The “device set timeout” command (page 254) may be used to change the amount of time, in milliseconds,
that the serial driver will listen before returning a timeout.
HGST Confidential 73
Chapter 5
HGST Confidential 74
CHAPTER 5. BRIEF INTRODUCTION TO TCL
1. Commands are broken into tokens. Each token separates other tokens by one or more spaces or tabs.
2. The first token of a command is the command type. All other tokens on the same line are considered
arguments to this command type. Ending a line with { or \ tells the interpreter that the command continues
on the next line.
3. Enclosing characters in quotes ("") tells the interpreter to treat everything between the quotes as a single
token (spaces and tabs are a part of the token). However, variables (words that start with $) and bracket
expressions are still substituted.
4. Enclosing characters in braces ({}) also tells the interpreter to treat everything between the braces as a
single token (spaces and tabs are a part of the token). Variables and bracket expressions are not substituted.
5. Enclosing characters in brackets ([]) causes the interpreter to evaluate the characters in between the
brackets as a separate command, then insert the return value where the brackets used to be.
Now for some examples to clarify the rules given above. Let us start with the program lines:
In the example
The command type is puts. The command has one argument, dog. Here is another example:
The command type is puts. The command has 4 arguments: the, dog, is and 3. This is too many arguments
for puts (you will get an error). Here is another example that uses quotes to fix the problem:
Here we used quotes to represent “the dog is 3” as a single token. Here is an example with variables:
Because we used quotes, variables are expanded. If we do not want variable substitution, we use {}, as shown
here:
HGST Confidential 75
CHAPTER 5. BRIEF INTRODUCTION TO TCL
Note that in many TCL commands (such as if, for and proc) using {} is a useful way to pass segments of
code. For example:
Here we used “” for our command block, this causes the i variable to be substituted with hello before the for
command ever sees it. Switching to braces:
Now the setting of $i is defferred to when the for command calls it. This is probably the effect we wanted.
Notice that, unlike C, we are not forced to use a { after the for command, it just makes more sense do to so most
of the time. Lastly we look at the bracket notation:
> expr 2 + 3
5
> puts "8 * 7 = [expr 8 * 7]"
8 * 7 = 56
Here the interpreter calls the command expr 8 * 7 as a separate command then places the result in the
string.
source test.tcl
The source command executes the commands it finds in the specified file immediately. The source
command can either be used to quickly execute a series of commands or to define procedures.
> set i 0
> while {$i < 5} {
puts $i
incr i
}
HGST Confidential 76
CHAPTER 5. BRIEF INTRODUCTION TO TCL
5.6 Comments
A comment in TCL is declared by a # sign. Note that the pound sign must begin a line. You can get around
this, however, by putting a semicolon directly before the pound sign. Here are some examples:
> # This is a comment
> set i 0 # This is not allowed
> set i 0 ;# A semicolon is a workaround, however
HGST Confidential 77
CHAPTER 5. BRIEF INTRODUCTION TO TCL
The while command will iterate until the ending condition is met. Here is an example which emulates the
for example above:
set i 0
while {$i < 1000000} {
read10 $i 10
incr i 10
}
Here is an example:
foreach i {1 2 3 4 5} {
puts $i
}
Here is another example that uses the output of get_cdb_list to print out documentation for all available
CDB commands:
HGST Confidential 78
CHAPTER 5. BRIEF INTRODUCTION TO TCL
Here is an example:
proc add {a b} {
set c [expr $a + $b]
return $c
}
> add 2 3
5
Note that variables declared inside a proc statement are considered to be local. This means that if we are
using the variable c outside the add prodecure above, it will not be overwritten. For example:
In some cases we want to have a variable change inside a procedure effect a global variable. To accomplish
this we identify the variable with the global statement. Here is the procedure above rewritten with the global
statement used:
HGST Confidential 79
CHAPTER 5. BRIEF INTRODUCTION TO TCL
It is also possible to have a variable number of arguments passed to a procedure. See a book on TCL for a
more detailed description of proc.
5.9 Arrays
In TCL, an array is a variable with a string index in parathenses. Below are some examples of legal arrays:
set index(5) 26
set address(zip_code) 55906
set address(street_name) "Maple St"
5.10 Lists
TCL also provides support for lists. To declare a list, use the list command:
There are also other operations that can be performed on lists such as lindex, llength, lrange, lsearch,
lreplace, and others. The website www.tcl.tk is a great resource for more information on lists.
HGST Confidential 80
CHAPTER 5. BRIEF INTRODUCTION TO TCL
close $fd
}
close $in
close $out
}
If you want to read binary data, use the read command. The format for this command is read <file id> <length>.
An example of it’s use is:
HGST Confidential 81
CHAPTER 5. BRIEF INTRODUCTION TO TCL
Where .mywindow is the name of the window we are creating. This command will bring up a new empty
window. Now to add a couple of buttons to it:
At this point you will have two new buttons in your window. Clicking on them performs the commands
specified in the -command argument of each button. Like I said, this is just the tip of the iceburg in what you can
do in TK. A dedicated book on TCL/TK will go into more detail.
HGST Confidential 82
Chapter 6
6.1 Introduction
Niagara has several special variables that are set and referred to during device error situations. These variables
allow program code to quickly discern an error type and properties. Alternatively, you can use TCL’s built in
catch command as a method of trapping just about any error condition. This section discusses both methods of
error handling.
6.1.1 General and CDB Errors
The basic difference between general and CDB errors is as follows:
• Device errors relate only to CDB commands. Examples include CHECK_CONDITION and TIMEOUT. And
example of error types that do not apply are syntax errors, out of memory, and file not found.
• General errors include all errors, including all listed in the previous bullet.
• Device errors are handled with the $ec, $sns, $err and $cdberr variables.
• Generic errors can be handled with the catch statement.
• CDB errors can be tedious to deal with using the catch statement
• Because catch also catches generic errors, it will also trigger on syntax errors and other non drive related
errors. Discerning these two types of errors when using catch is the responsibility of the user.
• There are times when a lot of drive errors are expected (such as in drive testing). Special CDB error handling
allows these situations to be handled in a cleaner fashion.
proc test {} {
global ec
global sns
HGST Confidential 83
CHAPTER 6. ERROR HANDLING TECHNIQUES AND VARIABLES
• If a test program ends, these variables can be used interactively to get more information. If these variables
were local they would be lost as soon as the procedure exited.
• Many of these variables are mapped into TCL in a way that makes access very fast. This technique requires
the variables be global.
6.2.1 ec
This variable returns a CIL error code. See appendix B on page 117 for a list of possible codes. The $ec
variable can be used to easily check if an error is of a certain type (such as a timeout or check-condition).
6.2.2 err
This variable is set to the string value of the last error that occurred. It is most useful when used with
$cdberr. Note that $err is only overwritten when an error occurs. This means that you should not check
$err to see if an error occurred on the last command, use $ec for that.
6.2.3 sns
This variable contains a list of the sense data that was returned by the last command. Note that, for perfor-
mance reasons, this data is only valid updates when $ec = -16 (check condition). Always check $ec before
trusting the contents of this variable.
To access the individual bytes of the sense data use lindex. For example:
inq 1
set byte2 [lindex $sns 2]
puts "byte 2 of the sense data is $byte2"
proc test1 {} {
puts [inq 4]
puts [inq 5]
}
test1
In this example the first command will fail and return an error. The second command will never be executed.
The results from this script will look something like:
CMD: 12 00 04 01 00 00
70 00 05 00 00 00 00 18 00 00 00 00 24 00 00 C0
HGST Confidential 84
CHAPTER 6. ERROR HANDLING TECHNIQUES AND VARIABLES
00 02 00 00 F8 23 00 00 00 00 00 00 00 00 00 00
Now we will override this default functionality with our own cdb error handling. If we modify the function as
shown:
proc test2 {} {
global ec
set cdberr {
puts "The function had an error code of $ec"
}
puts [inq 4]
puts [inq 5]
test2
In the example above, we override the default operation of the cdb error handling with new functionality by
setting cdberr. Note that in the example above no errors are generated. This is why the second inquiry in the
code was executed. Alternatively we may want an error to be generated but reported in an alternate way. We
simply change the script to generate an error in $cdberr:
proc test3 {} {
global ec
set cdberr {
error "The function had an error code of $ec"
}
puts [inq 4]
puts [inq 5]
test3
unset cdberr
HGST Confidential 85
CHAPTER 6. ERROR HANDLING TECHNIQUES AND VARIABLES
By keeping $cdberr local, a script can assume that it is in a certain error state upon startup. The command
line error state will also remain unchanged (unless you explicitly set $cdberr at the global level).
6.3.3 Some Examples
To return the errors as normal with some extra information, we use the $err variable:
set cdberr { error "$err \n The function had a return code of $ec" }
When defining this in a procedure, don’t forget to make $err (and in the above case $ec) global. If we
simply want to print errors, we use puts above in place of error. We can also log errors to a file like this:
set cdberr {
set logfile [open "logfile.txt" "a"]
puts $logfile "---------------------------------"
puts $logfile "At [clock format [clock seconds]]:\n"
puts $logfile $err
flush $logfile
close $logfile
error $err
}
Again remember to make $err global when defining $cdberr in a procedure and we can use puts in place
of error to log cdb errors without generating TCL errors.
When catch is run as above, it will execute “commands” and put the result in var. The return for catch
is 0 if the command completed without error and 1 if an error occurred. Using this information, we can set up an
example:
HGST Confidential 86
CHAPTER 6. ERROR HANDLING TECHNIQUES AND VARIABLES
You can also use $err, $ec, and $sns as they are used in previous examples:
proc test {} {
global ec
test
proc test {} {
global err
global ec
This code handles errors in a special way through $cdberr but also uses catch to do additional processing
when the read CDB fails. Note that when used in this context, $cdberr must return an error of the catch
statement will never be flagged.
HGST Confidential 87
Chapter 7
7.1 Introduction
To compliment TCL’s built in expr rand() function, Niagara includes a suite of random commands. These
commands extend the functionality of TCL’s random number generation capability, adding the following features:
• Creation of up to 1024 independent random number generation channels (rand open, rand close)
• Each channel can be seeded independently (rand seed)
• Each channel can contain optional histogram constraints (rand addhist, rand showhist)
• Each channel can produce integers or integer ranges (rand int, rand range)
• Each channel can produce floats or float ranges (rand float, rand frange)
These features allow for more robust control over what types of random numbers are generated and improves
the reproducibility of these numbers (by offering independently seeded random number channels).
rand int
rand float
rand range <min> <max>
rand frange <min> <max>
The rand int command returns an integer between 0 and 0xFFFFFFFF. The rand float command
returns a floating point number: 0.0 ≤ n < 1.0. The rand range command returns an integer: min ≤
n ≤ max. The rand frange command returns a floating point number: min ≤ n < max. Here are some
examples of the commands in use:
rand int
rand float
rand range 0 255
rand frange 0.0 6.28319
To reseed the random number generator, use the rand seed command. This command takes an integer
values as an input. Here are some examples:
HGST Confidential 88
CHAPTER 7. RANDOM NUMBER GENERATION
This script will run fine and will produce identical numbers each time it is run (because we set the seed). This
script, however, has a subtle problem. The problem is that all of the random numbers are highly interdependent.
For example say you make a subtle change to the blocksize (using 520 instead of 512):
Completely different numbers! The problem is that rand range, bfr, and randlba are all sharing the
same random number generator. Changing the number of random bytes need by bfr from 512 to 520, effected
the other two commands. These situations are one area where random channels can help. Here is the first script
(512 version), modified to use multiple channels:
HGST Confidential 89
CHAPTER 7. RANDOM NUMBER GENERATION
HGST Confidential 90
CHAPTER 7. RANDOM NUMBER GENERATION
In our new script, we used a separate random channel for our lba, transfer length, and buffer data. Because
we are using three separate channels, we can made modifications to an area (such as the block size), without
effecting the other two streams. Another advantage to channels is that we can apply histogram constraints to the
values produced. Histograms are explained in the next section. To open a new random channel use the command
rand open. The format for this command is:
The ?seed? value is optional. If you do not specify a seed, the current time is used as a seed. Another good
source for a seed is the rand int command, which will retrieve a random number from channel 0. Opening
a new channel returns a channel id. You generally want to save this id so that you can later use it to refer to the
channel:
Channel zero is a special random channel in that it is always open (you can not close it), and you can not
apply histogram information to it. The rand open command will never return a channel id of zero (because it
is already open, always). Any random commands that do not have a specified random channel are using channel
0. To close a channel, use the rand close command:
It is a good idea to close random channels when you are finished with them. Niagara can have up to 1024
random channels open at a time.
To use a random channel, you simply refer to the channel id in the appropriate command’s argument list. The
following commands support channel ids:
Histogram related random commands require a channel id. These commands are described in the next section.
• Test the inner cylinders of a drive 60 percent of the time, the middle cylinders 30 percent of the time and
the outer cylinders 10 percent of the time.
• Ensure that a particular transfer length will be used 10% of the time
• Simulate different “3 sigma” ranges during off-track read-write tests
1 You cannot add a histogram to channel 0
HGST Confidential 91
CHAPTER 7. RANDOM NUMBER GENERATION
To add histogram data to a channel, use the rand addhist command. The format for this command is:
The effect of this command is to tell the channel that you want to see random values between min and max
“percent” of the time. When you call rand addhist multiple times on the same channel, the results are
stacked together, creating a histogram profile. You can stack up to 32 histogram entires per channel. In this
example, we are filling a buffer with 0x00 50% of the time, 0x55 25% of the time and 0xAA 25% of the time:
In this example, we set a random channel to return numbers that are either 0-2 or 8-10 (but never 3-7):
rand close $r
To look at the current histogram status of a channel, you can use the rand showhist command. Here is
the output for our buffer example above:
What happens if we do not use up 100% of our potential histogram space? Basically the remaining percentage
is returned as a default value. Here is the example, modified above:
HGST Confidential 92
CHAPTER 7. RANDOM NUMBER GENERATION
Note that “Default” means different things to different commands. For example, the default range for the
rand int command is 0-0xFFFFFFFF where the default range for the rand float command is 0.0-1.0.
If we define more than 100% for our histogram profile, the less likely entries we defined will never get called.
The rand showhist command will show this. Here is an example where we use 175% of our histogram space:
• Our 75% entry is the most likely. Niagara puts the most likely histogram entries at the top of the list (for
best performance).
• Our next likely entry is our 50% entry. However our first entry has already taken 75% of our histogram
space, this leaves only 25% of the space left.
• Now our histogram space is maxed out at 100%, our remaining two entries will never be called as a result.
The real moral of this story is that you should avoid defining more than 100% of your histogram space anyway.
Defining more than 100% does not make sense.
HGST Confidential 93
Chapter 8
Command Queueing
8.1 Introduction
Using certain drivers, Niagara offers support for command tag queuing. The queuing features of Niagara are
as follows:
• The ability to send a series of commands concurrently to a device, without waiting for status from each
command.
• The ability to send a sequence of commands to a device in rapid succession. Certain drivers (i-Tech) sup-
ports this functionality in hardware while others (Linux) emulate this functionality using a tightly optimized
C loop (i.e. without the TCL overhead)
• The ability to specify a certain tag or have tags auto-generated for you
• The ability to wait for any tag to complete, to wait for a specific tag to complete or to wait for all tags to
complete.
• Support for simple, ordered or head of queue tagging
HGST Confidential 94
CHAPTER 8. COMMAND QUEUEING
Note that some or all of these features may not be available, depending on your driver. For example, the SPTI
driver does not support queuing at all while the Linux driver doesn’t support queuing types other than simple.
HGST Confidential 95
CHAPTER 8. COMMAND QUEUEING
stacked mode is that it allows us to effectively achieve queue depths interactively from the command line, whereas
this would not be possible in concurrent mode. To begin our look at command queuing we will put Niagara in
stacked queuing mode:
qmode stacked
We’ll also say that we would like Niagara to automatically increment queue tags for us with an initial tag id
of zero:
Building A Sequence
Now we will issue a command:
r10 [randlba]
Note that instead of returning status of the read operation, the r10 command above returns a number (0). This
number is the queue tag id that the command will have when it is sent to the drive. Because we are in stacked
mode, the command has not been sent to the drive yet, but placed in an internal table. Next we will add 15 more
random reads to the table:
do 15 {r10 [randlba]}
Receiving Commands
Above we added 15 additional read operations to our internal table, each with an incrementing queue tag.
Including our initial r10 command makes our total table size 16. The table will be sent to the drive when a
receive command is called:
qctl recv
The above receive command returns the first command that the drive completed. Note that, in simple queuing
mode, the commands may come back in a different order than they were sent. To get the rest of the commands,
we’ll use a do loop:
do 16 {r10 [randlba]}
qctl send
qctl recv all
One question that naturally comes up here is “What about the return status for all of these commands”.
It is often useful to know if all of the commands were executed successfully. The first clue is the return of
qctl recv all. If this command returns without error, all commands were completed successfully. If one or
more commands did not complete successfully, an error is returned. In either case, we can get more information
about the commands returned by using the qctl *info family of commands. As an example, we will issue 4
commands to the device with on of them (the inquiry) a purposeful error. Here is the setup:
HGST Confidential 96
CHAPTER 8. COMMAND QUEUEING
In the case of qctl recv all, the command should return an error. This is because we did not call inquiry
correctly. To see status on all the commands, we use the qctl table_info command:
#1
--------------------------------------------------------
Tag: 0000
CDB: 12 00 00 FF 01 00 .. .. .. .. .. .. .. .. .. ..
EC: -16 (Check Condition)
Sense: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
#2
--------------------------------------------------------
Tag: 0002
CDB: 28 00 12 34 56 78 00 00 01 00 .. .. .. .. .. ..
EC: 0 (Success)
#3
--------------------------------------------------------
Tag: 0001
CDB: 28 00 05 7A 52 12 00 00 01 00 .. .. .. .. .. ..
EC: 0 (Success)
#4
--------------------------------------------------------
Tag: 0003
CDB: 28 00 02 92 01 FD 00 00 01 00 .. .. .. .. .. ..
EC: 0 (Success)
#1
--------------------------------------------------------
Tag: 0000
CDB: 12 00 00 FF 01 00 .. .. .. .. .. .. .. .. .. ..
EC: -16 (Check Condition)
Sense: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
HGST Confidential 97
CHAPTER 8. COMMAND QUEUEING
#4
--------------------------------------------------------
Tag: 0003
CDB: 28 00 02 92 01 FD 00 00 01 00 .. .. .. .. .. ..
EC: 0 (Success)
To look at a particular field, use the lindex command to extract the contents. The -list option is useful
in this situation. For example:
-16
{28 00 05 7A 52 12 00 00 01 00}
proc read_32rand {
qmode seqential
HGST Confidential 98
CHAPTER 8. COMMAND QUEUEING
#allocate 32 buffers
if {[buff get count] < 32} {
buff set count 32
}
#set up 32 reads
for {set i 0} {$i < 32} {incr i} {
r10 [randlba] -ri $i
}
#return status and the first data bytes (if command was a success)
#for each command
for {set i 0} {$i < 32} {incr i} {
puts "[qctl idx_info $i]\n"
if {[lindex [qctl idx_info $i -list] 2] == 0} {
#successful command, print first 64 bytes of data
puts "[bd $i 0 64]\n"
}
}
HGST Confidential 99
CHAPTER 8. COMMAND QUEUEING
9.1 Introduction
Certain testing systems (e.g. iTech) offer the capability to generate, collect and compare data in hardware.
Consequently, these systems have historically also provided an inefficient path for doing the same in software.
Because of this, Niagara offers the ability to access the hardware data generation / comparison features built into
cards that support the feature. Currently, only the iTech card offers this support.
This chapter provides an overview of different hardware modes supported by Niagara and discusses the per-
formance / flexibility implications of using each feature.
Mode Description
normal Default mode: buffer data is copied from main memory on both
read and write. Both reads and write operate in the slower mode.
hc Hardware Compare: The iTech card’s read and write buffers are
compared on read, does not speed up writes.
random The iTech card randomly generates data for write commands.
Speeds up writes.
random_hc The iTech card randomly generates data for write commands
and expects this same data during read commands. Speeds
up writes. In most cases you should use random_seed or
random_seed_keyed instead of this mode because they
handle compares more robustly (i.e. random_seed_keyed
will correctly compare any block that has been written, where
random_hc is much more restrictive and will generally only
compare a sequence correctly if it is the same as the sequence
that was written)
random_seed Works the same as random_hc except that the number genera-
tor is seeded with LBA and with block information. This allows
large transfers (that disconnect and reconnect) to be compared
properly.
random_seed_keyed Works the same as random_seed with the LBA coded at the
beginning of each block
keyed Uses current buffer contents but overlays LBA keys, does not
speed up writes
keyed_hc Uses current buffer contents but overlays LBA keys, performs
hardware compare on read, does not speed up writes
inc Writes an incrementing pattern to the drive. Speeds up writes
inc_hc Writes an incrementing pattern to the drive. Performs hardware
compare on reads. Speeds up writes
repeat The first write CDB executed after this command will copy data
from the PC’s memory to the iTech card (slow). All subsequent
write calls will then reuse this same data (no buffer xfer) for
improved performance.
repeat_hc The same as repeat with hardware compare on read.
repeat_read_hc The fist read CDB executed after this command will copy data
from iTech’s read buffer to its write buffer. Subsequent reads
will compare the new read buffer with the write buffer.
Note that for all of these modes, the data is still copied from the card to main memory on reads (another time
consuming process). To disable this feature, you can use the device set read_xfer command to suppress
this for a performance gain (see the next section for details).
I’ll say it again because its important: Reads will run slow regardless of transfer mode unless you use
device set read_xfer 0
Mode Effect
The hardware generation modes only are used with the following CDBs:
• read6
• read10
• write6
• write10
9.6 Example
Below are some examples of hardware compare. Note the use of checking for cross driver compatibility. This
code will run correctly whether hardware compare is available or not.If Hardware compare is not available, the
code below uses software compare instead.
#****************************************
#try to set hardware mode
#****************************************
#****************************************
#do 1000 writes
#****************************************
#****************************************
#do 1000 read/compares
#****************************************
#****************************************
#clean up
#****************************************
init
rand close $lba_rand
rand close $data_rand
return "Done"
Startup Scripts
Startup scripts are tcl scripts that are executed when Niagara is initially started. These scripts are located in
startup, startup_ata, startup_hdc, startup_scsi, and startup_user directories where Nia-
gara is installed. You can see which scripts are executed by watching Niagara’s console window on startup. To
include your own scripts, simply add them to the startup_user directory.
The calc_And_Fill procedure is used to update the checksum. It takes a buffer, offset and an optional
length.
10.1.2 debug_puts
The script debug_puts.tcl allows for the use of debug puts. Setting the debug level in a namespace using
the set_Debug_Level will determine the number of messages that will appear. The command dputs works
like a normal puts except that you also pass in a debug level that determines when the message should be printed.
10.1.3 do
The do.tcl script adds a single command to TCL called do. The do command provides an easy way to
repeat a command a certain number of times (or forever). An additional bonus to using do is that a Tk button
appears that allows you to cancel a command sequence before it is finished. The general syntax is:
do <iterations> <command>
The <iterations> parameter can be a number or fo for “forever”. Here are some examples of do:
do 5 {puts "hello"}
do 1000 {rd10 [randlba]}
do fo {rd10 [randlba]}
10.1.4 device_ops
The device_ops script contains the procedure reset_Device_Info which performs a rdcap for SCSI
drives or identify_device for ATA drives, which resets the device info to the correct max LBA or blocksize.
reset_Device_Info
The procedure reset_Device_Info will return zero if successful and one if not.
10.1.5 drive
The drive script implements drive::connect for consistency with serial::connect, agilent::connect, etc...
drive::connect
10.1.6 endian
The endian.tcl script adds a command to TCL called endian_switch. The endian_switch com-
mand can be used to switch a value between big endian and little endian format. The syntax is:
The <value> parameter specifies the value you want to be switched. The <size> parameter determines
the size in bytes of the <value>. Acceptable values for the <size> argument are 2, 3, and 4. This command
can also be run with endian instead of endian_switch.
10.1.7 file
The file script adds the procedure convert_Filename. The procedure convert_Filename will
convert a given file path into a path that TCL can recognize. Backslashes are converted to forward slashes. Spaces
are replaced with " ". The syntax is:
Where filename is the file path to convert and filter_spaces can be set to zero if you don’t want
spaces to be filtered.
10.1.8 hdc
The hdc script is an attempt to consolidate all HDC identification logic to a single place in the code, simpli-
fying the process of updating the tools when we get new HDCs.
hdc::generation
The parameters ?uil_index? and ?device_index? are optional and can be used to specify a specific
device. If these parameters are not specified, the current device is targeted.
10.1.10 modefields_cli
The modefields_cli script sets up mode page definitions for various devices. The variables set up in this
file are used by modefields_cli functions and the Mode Fields GUI tool.
10.1.11 model_number
The model_number script contains procedures that can be used to obtain model numbers from drives. The
syntax is.
model::get_Model_Number ?serial_number? ?project_id? ?alsm_code_filename?
All of these parameters are optional but serial_number is the default serial number to use if necessary,
project_id is the project of the selected device, and alsm_code_filename will set the allsym file name
that’s just been created.
10.1.12 serial
Run serial::connect to point SUIL to the serial driver. Run serial::connect 3 to point SUIL to
the serial3 driver, so that the UART3 interface can be used.
serial::connect
10.1.13 sns_tools
The sns_tools script contains procedures to allow a user to easily parse data received from the request_sense
command
get_Code ?sns_data?
The get_Code procedure returns a hex byte for the code data.
get_Descriptor_Data <sns_data> <descriptor>
The get_Descriptor_Data procedure searches the sns_data for the given descriptor and returns all data
within that descriptor block except for the descriptor byte and the additional size byte.
get_Information_Bytes ?sns_data?
The get_Information_Bytes procedure returns an LBA in hex of either 4 bytes (fixed) or 8 bytes
(descriptor) depending on the format of the sns_data.
get_Key ?sns_data?
get_Progress_Indication ?sns_data?
The get_Progress_Indication procedure returns in hex the 2 byte data for the progress indication.
Note progress indication data is only valid if the sense key is of value NO_SENSE or NOT_READY.
get_Qual ?sns_data?
get_Sense_Format
The get_Sense_Format procedure will return the current sense format (Descriptor [1] or Fixed [0]).
get_Sector ?sns_data?
get_Sksv ?sns_data?
get_Uec ?sns_data?
get_Valid ?sns_data?
set_Sense_Format <d_sense>
set_Data <data>
10.1.14 uartmode
The uartmode script adds UART mode manipulation functionality to Niagara.
uartmode
The procedure uartmode can be used to set the UART mode by providing an argument or to get the current
UART mode by not providing any arguments.
1. Quick Buttons can be added or taken away from the Quick button list.
proc runInquiry {} {
global niagara_selected_devices
#boost performance
feedback push; feedback min
#restore feedback
feedback pop
}
%$
#boost performance
feedback push; feedback min
#make sure our send and receive buffer are setup right
buff set si 0
buff set ri 1
#count miscompares
set miscompares 0
#compare size
set compare_size [expr $numblocks * [device info blocksize]]
#restore feedback
feedback pop
}
EC Error Codes
SCSI Commands
C.1 change_definition
Command Name(s): change_definition,chdef
Parameters:
C.2 close_zone
Command Name(s): close_zone
Parameters:
C.3 e6
Command Name(s): e6,log_dump
Parameters:
C.4 finish_zone
Command Name(s): finish_zone
Parameters:
C.5 format_unit
Command Name(s): format_unit,fmt
Parameters:
C.6 get_physical_element_status
Command Name(s): get_physical_element_status
Description: The device return status information for physical elements within the device.
Parameters:
C.7 inquiry
Command Name(s): inquiry,inq
Parameters:
C.8 io10
Command Name(s): io10
Default Parm Order: send_size, recv_size, b0, b1, b2, b3, b4, b5, b6, b7, b8,
b9
Parameters:
C.9 io12
Command Name(s): io12
Default Parm Order: send_size, recv_size, b0, b1, b2, b3, b4, b5, b6, b7, b8,
b9, b10, b11
Parameters:
C.10 io16
Command Name(s): io16
Default Parm Order: send_size, recv_size, b0, b1, b2, b3, b4, b5, b6, b7, b8,
b9, b10, b11, b12, b13, b14, b15
Parameters:
C.11 io32
Command Name(s): io32
Default Parm Order: send_size, recv_size, b0, b1, b2, b3, b4, b5, b6, b7, b8,
b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24,
b25, b26, b27, b28, b29, b30, b31
Parameters:
C.12 io6
Command Name(s): io6
Default Parm Order: send_size, recv_size, b0, b1, b2, b3, b4, b5
Parameters:
C.13 log_select
Command Name(s): log_select,lgsel
Parameters:
C.14 log_sense
Command Name(s): log_sense,lgsns
Parameters:
C.15 logical_depop_fmt_unit
Command Name(s): logical_depop_fmt_unit
Parameters:
C.16 logical_depop_inq
Command Name(s): logical_depop_inq
Parameters:
C.17 mode_select10
Command Name(s): mode_select10,mdsl10
Parameters:
C.18 mode_select6
Command Name(s): mode_select6,mdsl6
Parameters:
C.19 mode_sense10
Command Name(s): mode_sense10,mdsn10
Parameters:
C.20 mode_sense6
Command Name(s): mode_sense6,mdsn6
Parameters:
C.21 open_zone
Command Name(s): open_zone
Parameters:
C.22 persistent_reserve_in
Command Name(s): persistent_reserve_in,pri
Parameters:
C.23 persistent_reserve_out
Command Name(s): persistent_reserve_out,pro
Parameters:
C.24 prefetch
Command Name(s): prefetch,pref
Parameters:
C.25 prefetch16
Command Name(s): prefetch16,pref16
Parameters:
C.26 read10
Command Name(s): read10,r10,rd10
Parameters:
C.27 read12
Command Name(s): read12,r12,rd12
Parameters:
C.28 read16
Command Name(s): read16,r16,rd16
Parameters:
C.29 read32
Command Name(s): read32,r32,rd32
Parameters:
C.30 read6
Command Name(s): read6,r6,rd6
Parameters:
C.31 read_buffer
Command Name(s): read_buffer,rdbuf
Parameters:
C.32 read_buffer32
Command Name(s): read_buffer32,rdbuf32
Parameters:
C.33 read_capacity
Command Name(s): read_capacity,rdcap
Parameters:
C.34 read_capacity16
Command Name(s): read_capacity16,rdcap16
Parameters:
C.35 read_defect_data10
Command Name(s): read_defect_data10,rdmap10
Parameters:
C.36 read_defect_data12
Command Name(s): read_defect_data12,rdd12
Parameters:
C.37 read_initialization_pattern
Command Name(s): read_initialization_pattern,read_init_patt
Description: Requests that device server transfer a single logical block including protection bytes (DIF) of
currently Data Pattern set for UNMAPPED LBA to the Data-IN buffer.
Parameters:
C.38 read_long
Command Name(s): read_long,rdlong
Parameters:
C.39 read_long16
Command Name(s): read_long16,rdlong16
Parameters:
C.40 reassign_blocks
Command Name(s): reassign_blocks,reas
Parameters:
C.41 receive_diagnostic_results
Command Name(s): receive_diagnostic_results,rcvdg
Parameters:
C.42 release10
Command Name(s): release10,rel10
Parameters:
C.43 release6
Command Name(s): release6,rel6
Parameters:
C.44 remove_element_and_truncate
Command Name(s): remove_element_and_truncate
Description: Performs depopulating a storage element and truncating the reported capacity of the media.
Parameters:
C.45 report_dev_id
Command Name(s): report_dev_id,rdi
Description: Requests that the device server send device information important to the application client
Parameters:
C.46 report_lun
Command Name(s): report_lun,rlun
Parameters:
C.47 report_provisioning_init_patt
Command Name(s): report_provisioning_init_patt,rpip
Description: Requests that the device server transfer the provisioning initialization pattern
Parameters:
C.48 report_supported_opcodes
Command Name(s): report_supported_opcodes,repsupops
Parameters:
C.49 report_supported_tmf
Command Name(s): report_supported_tmf,repsuptmf
Parameters:
C.50 report_timestamp
Command Name(s): report_timestamp,rts
Description: Requests that the device server return the current value of a device clock.
Parameters:
C.51 report_zones
Command Name(s): report_zones
Parameters:
C.52 report_zones_old
Command Name(s): report_zones_old
Parameters:
C.53 request_sense
Command Name(s): request_sense,sns
Parameters:
C.54 reserve10
Command Name(s): reserve10,res10
Parameters:
C.55 reserve6
Command Name(s): reserve6,res6
Parameters:
C.56 reset_write_pointer
Command Name(s): reset_write_pointer
Parameters:
C.57 reset_write_pointer_old
Command Name(s): reset_write_pointer_old
Parameters:
C.58 rezero_unit
Command Name(s): rezero_unit,rezero
Parameters:
C.59 sanitize
Command Name(s): sanitize
Parameters:
C.60 security_protocol_in_block
Command Name(s): security_protocol_in_block,sec_in_blk
Parameters:
C.61 security_protocol_in_byte
Command Name(s): security_protocol_in_byte,sec_in_byte
Parameters:
C.62 security_protocol_out_block
Command Name(s): security_protocol_out_block,sec_out_blk
Parameters:
C.63 security_protocol_out_byte
Command Name(s): security_protocol_out_byte,sec_out_byte
Parameters:
C.64 seek10
Command Name(s): seek10,sk10
Parameters:
C.65 seek10_64lba
Command Name(s): seek10_64lba,sk10_64
Parameters:
C.66 seek6
Command Name(s): seek6,sk6
Parameters:
C.67 send_diagnostic
Command Name(s): send_diagnostic,sndd
Parameters:
C.68 set_dev_id
Command Name(s): set_dev_id,sdi
Description: Requests that the device server send device information important to the application client
Parameters:
C.69 set_initialization_pattern
Command Name(s): set_initialization_pattern,set_init_patt
Description: Requests that device server transfer a single logical block including protection bytes (DIF) from
Data-out buffer.
Parameters:
C.70 set_timestamp
Command Name(s): set_timestamp,sts
Parameters:
C.71 start_stop_unit
Command Name(s): start_stop_unit,ssu,unit
Parameters:
C.72 synchronize_cache
Command Name(s): synchronize_cache,sync
Description: Ensures that logical blocks in the cache have their most recent data value recorded on the media
Parameters:
C.73 synchronize_cache16
Command Name(s): synchronize_cache16,sync16
Description: Ensures that logical blocks in the cache have their most recent data value recorded on the media
Parameters:
C.74 test_unit_ready
Command Name(s): test_unit_ready,tstrdy,tstr
Parameters:
C.75 unmap
Command Name(s): unmap,um
Parameters:
C.76 verify
Command Name(s): verify,ver
Description: Asks drive to verify data written on media. If bytechk=0, trans_length is # of blocks to verify
internally. If bytechk=1, trans_length is also blocks being sent to drive, so send_length must be made the same as
trans_length.
Parameters:
C.77 verify12
Command Name(s): verify12,ver12
Description: Asks drive to verify data written on media. If bytechk=0, trans_length is # of blocks to verify
internally. If bytechk=1, trans_length is also blocks being sent to drive, so send_length must be made the same as
trans_length.
Parameters:
C.78 verify16
Command Name(s): verify16,ver16
Description: Asks drive to verify data written on media. If bytechk=0, trans_length is # of blocks to verify
internally. If bytechk=1, trans_length is also blocks being sent to drive, so send_length must be made the same as
trans_length.
Parameters:
C.79 verify32
Command Name(s): verify32,ver32
Description: Asks drive to verify data written on media. If bytechk=0, trans_length is # of blocks to verify
internally. If bytechk=1, trans_length is also blocks being sent to drive, so send_length must be made the same as
trans_length.
Parameters:
C.80 vu_commit_verify
Command Name(s): vu_commit_verify
Description: Upon receipt of commit verify command, drive updates verify pointer
Parameters:
C.81 vu_define_band_type
Command Name(s): vu_define_band_type
Parameters:
C.82 vu_query_band_information
Command Name(s): vu_query_band_information
Parameters:
C.83 vu_query_last_verify_error
Command Name(s): vu_query_last_verify_error
Description: Verify from last verified lba of the band through appropriate EOT
Parameters:
C.84 vu_reset_write_pointer
Command Name(s): vu_reset_write_pointer
Parameters:
C.85 vu_set_write_pointer
Command Name(s): vu_set_write_pointer
Description: Move the write pointer position to start of track of given logical block address
Parameters:
C.86 vu_verify_squeezed_blocks
Command Name(s): vu_verify_squeezed_blocks
Description: Verify from last verified lba of the band through appropriate EOT
Parameters:
C.87 write10
Command Name(s): write10,w10,wr10
Parameters:
C.88 write12
Command Name(s): write12,w12,wr12
Parameters:
C.89 write16
Command Name(s): write16,w16,wr16
Parameters:
C.90 write32
Command Name(s): write32,w32,wr32
Parameters:
C.91 write6
Command Name(s): write6,w6,wr6
Parameters:
C.92 write_and_verify
Command Name(s): write_and_verify,wrv
Description: Requests the drive write data and then check it.
Parameters:
C.93 write_and_verify12
Command Name(s): write_and_verify12,wrv12
Description: Requests the drive write data and then check it.
Parameters:
C.94 write_and_verify16
Command Name(s): write_and_verify16,wrv16
Description: Requests the drive write data and then check it.
Parameters:
C.95 write_and_verify32
Command Name(s): write_and_verify32,wrv32
Description: Requests the drive write data and then check it.
Parameters:
C.96 write_atomic16
Command Name(s): write_atomic16,wa16,wra16
Parameters:
C.97 write_atomic32
Command Name(s): write_atomic32,wa32,wra32
Parameters:
C.98 write_buffer
Command Name(s): write_buffer,writebuf
Parameters:
C.99 write_buffer32
Command Name(s): write_buffer32,writebuf32
Parameters:
C.100 write_long
Command Name(s): write_long,wrlong
Parameters:
C.101 write_long16
Command Name(s): write_long16,wrlong16
Parameters:
C.102 write_same
Command Name(s): write_same,wrs
Parameters:
C.103 write_same16
Command Name(s): write_same16,wrs16
Parameters:
C.104 write_same32
Command Name(s): write_same32,wrs32
Description: Requests the drive write data and then check it.
Parameters:
CIL Commands
Description: This command will read and display info on the desired part of an ata device. Append ata get
with one of the following commands to get the info. Possible Commands: STATUS - Status Register, ERROR
- Error Register, ERRLBA - Lower 32 bits of the 48 bit LBA, ERRLBAHI - Upper 16 bits of the 48 bit LBA,
ERRLBA28 - All of the 28 bit LBA, SCR - Sector Count Register, SNR - Sector Number / LBA Low Register,
CLR - Cylinder Low / LBA Mid Register, CHR - Cylinder High / LBA High Register, DHR - Device Head
Register, PSCR - Sector Count Register, PSNR - Sector Number / LBA Low Register, PCLR - Cylinder Low /
LBA Mid Register, PCHR - Cylinder High / LBA High Register, SHADOW - Default to show it all.
Parameters:
Name Description
commands See possible commands in the description above.
Examples:
Description: Compute checksum of buffer data using Adler32 algorithm with base of 1.
Parameters:
Name Description
index Buffer Index (Number or send or recv)
offset offset to begin checksum calculation at
length length of checksum calculation
Examples:
Parameters:
Name Description
index Buffer Index (Number or send or recv)
offset offset to begin checksum calculation at
length length of checksum calculation
Examples:
Description: This function compares the contents of two buffers over a specified range for a match. If the
buffers match, 0 is returned, if buffer 1 < buffer 2, -1 is returned. If buffer 1 > buffer 2, 1 is returned. This
command is useful for verification operations in CSO.
Parameters:
Name Description
index1 First buffer index to compare
index2 Second buffer index to compare
length Amount of buffer to compare
offset1 Optional: Offset into buffer 1 to begin compare (default=0)
offset2 Optional: Offset into buffer 2 to begin compare (default=0)
Examples:
Description: This function can be used to copy portions of an existing buffer to another buffer. One useful
application of this command is the mode sense/select combo; mode sense data can be copied from the receive
buffer to the send buffer, changes can be made, then the new buffer can be "mode selected".
Parameters:
Name Description
source_index Index of the buffer to copy from
dest_index Index of the buffer to copy to
source_offset Optional: Offset into from buffer
dest_offset Optional: Offset into to buffer
length Optional: Amount of buffer to copy (D=All)
Examples:
buff copy
buff copy 3 0
buff copy recv send 0x24
Parameters:
Name Description
index Buffer Index (Number or send or recv)
offset offset to begin CRC calculation at
length length of CRC calculation
Examples:
Description: This function diffs the contents of two buffers over a specified range for a match. In the standard
implementation the information reported is: the address of the first difference and the number of bytes that are
different in the file. When -v is used the same information is shown in addition to a hex dump of any two 8 byte
regions that contain differences between the files (differences are surrounded by () characters). For backward-
compatibility reasons, offset1 is applied to both buffers if offset2 is not specified.
Default Parm Order: index1 index2 amount ?offset1? ?offset2? ?-b? ?-a? ?-v? ?-d?
?-dw? ?-dd? ?-pre? ?-fp? ?-f? ?-fa? ?-do?
Parameters:
Name Description
index1 First Index to diff
index2 Second Index to diff
amount Amount to diff
offset1 Optional: Offset into buffer 1 to begin diff (default=0)
offset2 Optional: Offset into buffer 2 to begin diff (default=0)
-b Optional: The number of bytes to display per line (default=8)
-a Optional: Show ASCII
-v Optional: Show all differences between buffers
-d Optional: Dump entire buffer range, highlighting differences
-dw Optional: show 16-bit differences
-dd Optional: show 32-bit differences
-pre Optional: string to place in front of different lines
-fp Optional: show diffs with fewer parans
-f Optional: write data to file (instead of returning data)
-fa Optional: append data to file
-do Optional: display buffer data only
Examples:
Description: This function dumps the data contained in a specified buffer in hex. For the "specified buffer",
either an index, "send" or "recv" can be used. Output can be formated using the several optional format flags. The
column, sub, and hex width used to be set like "-column_width 16", but that has had to be changed to just the
value in the correct order.
Parameters:
Name Description
index Optional: Buffer Index (Number or send or recv)
offset Optional: Offset into buffer (Default = 0)
length Optional: Number of bytes to dump (Default = 255)
column_width Optional: Width of hex data in bytes (Default = 16)
sub_width Optional: Width of sub columns in bytes (Default = 8)
hex_width Optional: Word length in bytes (Default = 1)
-big_endian Optional: Display words in big endian form
-hide_ascii Optional: Do not display ASCII data
-hide_header Optional: Do not display the table header
-hide_offset Optional: Do not display the address column
-hide_divider Optional: Do not display the dashed divider
-show_x Optional: Display the "0x" before all hex values
-no_newline Optional: Do not display the last blank line
-dw Optional: Deprecated: Output data in little endian 16-bit words
-dw Optional: Deprecated: Output data in little endian 16-bit words
-dd Optional: Deprecated: Output data in little endian 32-bit words
-dd Optional: Deprecated: Output data in little endian 32-bit words
-qw Optional: Deprecated: Output data in little endian 64-bit words
-qw Optional: Deprecated: Output data in little endian 64-bit words
-lp Optional: Treat length as number of pages (512 bytes)
-op Optional: Treat length as number of pages (512 bytes)
-column_width Optional: column_width is also the 4th optional flag
-sub_width Optional: sub_width is also the 5th optional flag
-hex_width Optional: hex_width is also the 6th optional flag
-be Optional: Display words in big endian form
-ha Optional: Do not display ASCII data
-hh Optional: Do not display the table header
-ho Optional: Do not display the address column
-hd Optional: Do not display the dashed divider
-nn Optional: Do not display the last blank line
-sx Optional: Display the "0x" before all hex values
-cw Optional: column_width is also the 4th optional flag
-sw Optional: sub_width is also the 5th optional flag
-hw Optional: hex_width is also the 6th optional flag
Examples:
Description: This command can be used to calculate the guard of end-to-end buffer data. It can also be used
to set the apptag value and the reftag value. All parameters are optional and at least one parameter should be
specified for the command to do something. Note that the very first time this function is called, a lookup-table is
generated. Future calls simply use the lookup table, resulting in improved performance.
Parameters:
Name Description
-guard Optional: Specify this flag to calculate the guard crc value
-guard Optional: Specify this flag to calculate the guard crc value
-offset Optional: Block Offset into the buffer (Default = 0)
-blksize Optional: Current Block Size w/o e2e Data (Default = 512)
-buffindex Optional: Buffer index to use (Default = current send idx)
-mdatabuffindex Optional: Buffer index to use for metadata buffer (Default = current mdata idx)
-mdatabuffindex Optional: Buffer index to use for metadata buffer (Default = current mdata idx)
-index Optional: DEPRECATED: Buffer Index (number, send, or recv)
-length Optional: Number of blocks to calculate (Default = 1)
-apptag Optional: Set the app tag value (Default = no change)
-lba Optional: Set the starting reftag value (Default = no change)
-lba Optional: Set the starting reftag value (Default = no change)
-check Optional: Check existing data and return error if it does not match expected
-check Optional: Check existing data and return error if it does not match expected
-info Optional: Do not set buffer data, but return calculated guard value
-info Optional: Do not set buffer data, but return calculated guard value
-dix Optional: Use Data Integrity Extension (DIX - separate metadata buffer) mode
-dix Optional: Use Data Integrity Extension (DIX - separate metadata buffer) mode
Examples:
Description: Checks whether a buffer exists for the given index. The command will return 1 if the buffer
exists, 0 or error otherwise.
Parameters:
Name Description
index Buffer Index (number, send, or recv, or other alias)
Examples:
buff exists 7
Parameters:
Name Description
index Buffer Index (number, send, or recv)
offset Offset into the buffer, in bytes
length Length of pattern to write
byte The byte value to write
Examples:
Description: This function can be used to insert a 32-bit or 64-bit float value into a buffer. This can be useful
for setting up CDB parameters and other tasks.
Parameters:
Name Description
index Buffer Index (number, send, or recv)
offset Offset into the buffer, in bytes
float The float value to write
size The size of float to use, 4 or 8 bytes
-le Optional: Use little endian mode
Examples:
Description: This function can be used to insert an integer value into a buffer. This can be useful for setting
up CDB parameters and for tagging write data with information (such as LBA or other information).
Parameters:
Name Description
index Buffer Index (number, send, or recv)
offset Offset into the buffer, in bytes
int The integer value to write
-le Optional: Use little endian mode
Examples:
Description: This function can be used to insert a 64-bit value into a buffer. This can be useful for setting up
CDB parameters and other tasks.
Parameters:
Name Description
index Buffer Index (number, send, or recv)
offset Offset into the buffer, in bytes
int64 The long value to write
-le Optional: Use little endian mode
Examples:
Parameters:
Name Description
index Buffer Index (number, send, or recv)
offset Offset into the buffer, in bytes
length Length of pattern to write
Examples:
Description: This function fills a specified buffer with a pattern of bytes. The bytes should each be 0-255
(0x00-0xff) and should have 0x prepended if the intended values are in hex.
Parameters:
Name Description
index Buffer Index (number, send, or recv)
offset Offset into the buffer, in bytes
length Length of pattern to write
byte_list List of byte patterns
Examples:
Description: This function writes random bytes of data to a specified buffer. This function is useful for setting
up a buffer for random CSO operations.
Parameters:
Name Description
index Buffer Index (number, send, or recv)
offset Offset into the buffer, in bytes
length Length of pattern to write
channel Optional: The Channel to use to seed the value
Examples:
Description: This function writes a sequence of data to the specified buffer. The command is useful for
generating sequential data patterns. The minimum and maximum values for the pattern can be optionally specified.
If no minimum or maximum value is specified 0-255 (0x00-0xff) is used as a default range.
Parameters:
Name Description
index Buffer Index (number, send, or recv)
offset Offset into the buffer, in bytes
length Length of pattern to write
min Optional: The value to start the seq data at
max Optional: The value to end the seq data at
Examples:
Description: This function can be used to insert a 16-bit value into a buffer. This can be useful for setting up
CDB parameters and other tasks.
Parameters:
Name Description
index Buffer Index (number, send, or recv)
offset Offset into the buffer, in bytes
short The short value to write
-le Optional: Use little endian mode
Examples:
Description: This function is used to put a string into a buffer. The command is useful for tasks such as
time-date and LBA stamping. See the provided example for a demonstration of this.
Parameters:
Name Description
index Buffer Index (number, send, or recv)
offset Offset into the buffer, in bytes
string String to write
length Optional: Number of bytes to write
Examples:
Description: This function provides a convenient method for zeroing out a buffer.
Parameters:
Name Description
index Buffer Index (number, send, or recv)
offset Offset into the buffer, in bytes
length Length of pattern to write
Examples:
Description: This function searches the specified buffer for one or more occurances of the specified data. The
function will return a list of offsets, each offset indicating the starting location of the pattern match. If no matches
are found, then an empty list is returned. Note that this search algorithm will find a pattern, even if it overlaps
another found pattern. For example, if you search for "aaa" in the string "bbbaaaaabbb", three offsets will be
returned: {3 4 5}.
Parameters:
Name Description
search_buff_index Buffer to search in
search_buff_offset Offset to start the search at
search_buff_length Length of buffer to search in
data_buff_index Buffer containing search data
data_buff_offset Offset of the start of the search data
data_buff_length Length of the search data
Examples:
Description: This function searches the specifies buffer for one or more occurances of the specified string.
The function will return a list of offsets, each offset indicating the starting location of the pattern match. If no
matches are found, then an empty list is returned. Note that this search algorithm will find a pattern, even if it
overlaps another found pattern. For example, if you search for "aaa" in the string "bbbaaaaabbb", three offsets
will be returned: {3 4 5}.
Parameters:
Name Description
search_buff_index Buffer to search in
search_buff_offset Offset to start the search at
search_buff_length Length of buffer to search in
string String to search for
Examples:
Description: This command is useful for extracting buffer data in a formatted way. Many CDB commands
return a binary "table" of information. Information from these tables can be easily extracted using this command.
This command works a lot like a scanf() in C and supports many of the same operators. The "offset" and "length"
parameters correspond to the keys found in the format string and determine the offset and length of buffer data to
use as input into the keys (note that the number of keys in the format string must match the number of offset/length
parameters). See the example below... Important: The "offset" and "length" fields given above are NOT parsed
by the buff format command. This means that when using variables, you must surround the fields with quotes and
not braces (or you will get a syntax error). %L is the same as %u only it puts the value in little endian form. %h
and %H work the same as %x and %X respectively only the value is in little endian form.
Parameters:
Name Description
index Buffer Index (number, send, or recv)
fmt_str Format String, printf style
parm_list List of offset and length pairs
-flip_endian Optional: Flip endianness of buffer, word aligned
-word_length Optional: Word length in Bytes for flip_endian, defaults to 4 if not specified
-word_length Optional: Word length in Bytes for flip_endian, defaults to 4 if not specified
Examples:
# rdcap
rdcap
puts [buff format recv "max_lba = %d (0x%X)" {0 4} {0 4}]
Parameters:
Name Description
index Buffer Index
Examples:
Description: This function returns the maximum number of buffers available (the default setting is 10). This
maximum can be changed with "buff set count".
Examples:
Description: This functions returns the minimum buffer allocation size. This parameter controls the size a
buffer created at when it is first filled with data. Note that, buffers auto expand when needed so this command is
not needed for functional operations. The usefulness of this command is for certain "algorithm" patterns where
successively larger chunks of data are read into a buffer, requiring a lot of "costly" resizing.For most applications,
this command can be safely ignored.
Examples:
Description: This function returns the index of the send buffer which was used to send the last CDB com-
mand.
Examples:
Description: This function returns the current receive buffer index. CDB commands that return data (such as
read10) will fill this buffer index with data. Note that, when specifying indexes in commands that require them, a
"recv" can be used in place of the index (see the example below). Also note that "recv" only works with Niagara
specific commands. When in doubt, use "buff get ri", which always works.
Examples:
buff get ri
Description: This function returns the current send buffer index. CDB commands that send data (such as
write10) will send data from this buffer. Note that, when specifying indexes in commands that require them, a
"send" can be used in place of the index. Also note that "send" only works with Niagara specific commands.
When in doubt, use "buff get si", which always works.
Examples:
buff get si
Description: Returns the amount of space that is allocated to a specified buffer. This is the same value that is
used by buff diff when a length of 0 is specified. buff get size index.
Parameters:
Name Description
index Buffer Index
Examples:
buff fill rand 3 0 0x4000; # Fill buffer three with wore data than the default siz
buff get size 3
Description: This function is intended to parse through a text fle loaded into a buffer. the variable varname
is loaded with the contents between the offset given and the first pattern character. The value returned is the first
non pattern character past the string returned. The pattern sequence is \n, \r and NULL.
Parameters:
Name Description
buff Buffer Index (number, send, or recv)
offset Offset into buffer, in bytes
varname The name of the variable to store the results
Examples:
Description: This function is used to load the contents of a (binary) file into a buffer. This function is
useful in binary parsing operations, as the "buff format" command can be used to easily parse the data contained
in a structured binary file (such as a saved binary logdump or a serial dump). Important note: When using a
Windows(tm) system, use forward slashes instead of backward slashes. Backward slashes in TCL are interpreted
as special characters (another option is to use two back slashes). Use the ASCII command to import an ASCII file
in binary mode. Note that The ASCII import expect data in a format similar to that produced by the bd command
(an address followed by 16 hex bytes per row). In ASCII mode, the file_offset and file_length variables represent
the offset and length of the interpreted binary data, not the file itself (in strait binary the file offset and binary
offsets are equivalent).
Parameters:
Name Description
filename Filename to load
buffer Optional: Buffer to load into (Default = send)
buff_offset Optional: Offset into the buffer
file_offset Optional: Offset into the file
length Optional: Number of bytes to read
-ascii Optional: Load the data in ascii format
-ascii_b Optional: Load the data in big endian format
Examples:
Parameters:
Name Description
index Buffer Index (number, send, or recv)
offset Offset into the buffer, in bytes
Examples:
Description: This function can be used to insert a byte into a buffer. This can be useful for setting up CDB
parameters and other tasks.
Parameters:
Name Description
index Buffer Index (number, send, or recv)
offset Offset into the buffer, in bytes
byte Byte to write to the buffer
Examples:
Description: This command prints a representation of an SGL as specified by the parameter, buffer index.
Parameters:
Name Description
index Buffer Index
Examples:
Description: This function clears the contents of existing buffers. This is useful for freeing up memory
resources after a memory intensive operation.
Parameters:
Name Description
index Optional: Buffer Index (Number or send or recv)
Examples:
buff reset
Description: Create an RSA public/private key pair. These keys are used during signature creation and verifi-
cation. The command returns a list of key sizes {pubKeySize privKeySize} buff rsa keygen ?random_data_buffer?
?random_data_length? ?private_key_buffer? ?public_key_buffer?.
Parameters:
Name Description
random_data_buffer Buffer index of random data (Number or send or recv)
random_data_length Length of random data
private_key_buffer Buffer index for private key (Number or send or recv)
public_key_buffer Buffer index for public key (Number or send or recv)
Examples:
Description: Create an RSA signature using the provided message data and private key. The buffer in-
dex specified for the signature buffer will contain the signature after the command returns. The command re-
turns the length of the signature in bytes. buff rsa keygen ?message_buffer_index? ?message_length? ?ran-
dom_data_buffer? ?random_data_length? ?priavte_key_buffer_index? ?signature_buffer_index?.
Parameters:
Name Description
message_buffer_index Buffer index of message data (Number or send or recv)
message_length Length of random data
random_data_buffer Buffer index of random data (Number or send or recv)
random_data_length Length of random data
private_key_buffer Buffer index of private key (Number or send or recv)
signature_buffer_index Buffer index for signature (Number or send or recv)
Examples:
>set codeLength [lindex [buff load c:/code/VCGNA554.bin send] 0] #load the code in
>buff load c:/code/privateKey.txt 2 #load the private key
>buff fill rand recv 0 512 #fill recv buffer wit
>buff rsa sign send $codeLength recv 512 2 3 #create a signature f
Description: Verify an RSA signature using the provided message data, public key and signature. The com-
mand will return 1 if the signature verifies correctly, 0 or error otherwise. buff rsa verify ?message_buffer_index?
?message_length? ?public_key_buffer? ?signature_buffer? ?signature_length?.
Parameters:
Name Description
message_buffer_index Buffer index of message data (Number or send or recv)
message_length Length of random data
public_key_buffer Buffer index of public key (Number or send or recv)
signature_buffer Buffer index for signature (Number or send or recv)
signature_length Length of signature data
Examples:
>set codeLength [lindex [buff load c:/code/VCGNA554.bin send] 0] #load the code in
>set sigLength [lindex [buff load c:/code/VCGNA554.sig recv] 0] #load the signature i
>buff load c:/code/publicKey.txt 2 #load the public key
>buff rsa verify send $codeLength 2 recv $sigLength #verify the signature
Description: This command saves the contents of a buffer to a file. Binary data is stored. An existing file can
be appended to with the -append option. If you wish to store an ASCII hex dump, use the -ascii option...
Default Parm Order: filename buffer buff_offset length ?-ascii? ?-ascii_dw? ?-ascii_dd?
?-append?
Parameters:
Name Description
filename Filename to save
buffer Buffer to save from (Default = send)
buff_offset Offset into the buffer
length Number of bytes to write
-ascii Optional: Save the data in ascii format
-ascii_dw Optional: Save the data in word format
-ascii_dd Optional: Save the data in dword format
-append Optional: Append the data to the end of the file
Examples:
Description: This function is used to change the number of available buffer indices (the default is 10). This
function is useful in applications where a maximum of 10 buffers is restrictive. Note that any pre-existing buffer
data is lost after this command is executed.
Parameters:
Name Description
count Maximum Number of Buffers
Examples:
Description: This functions sets the minimum buffer allocation size. This controls the size a buffer created
at when it is first filled with data. Note that, buffers auto expand when needed so this command is not needed
for functional operations. The usefulness of this command is for certain "algorithm" patterns where successively
larger chunks of data are read into a buffer, requiring a lot of "costly" resizing. For most applications, this
command can be safely ignored.
Parameters:
Name Description
size The Default Size of a Buffers
Examples:
Description: This function sets the current receive buffer index. CDB commands that receive data (such as
read10) will read data into this buffer index. Note that, when specifying indexes in commands that require them,
a "recv" can be used in place of the index. Also note that "recv" only works with Niagara specific commands.
When in doubt, use "buff set ri", which always works.
Parameters:
Name Description
index Buffer index (must be a number)
Examples:
buff set ri 5
Parameters:
Name Description
data data
Examples:
Description: This function sets the current send buffer index. CDB commands that send data (such as write10)
will use send data from this index. Note that, when specifying indexes in commands that require them, a "send"
can be used in place of the index. Also note that "send" only works with Niagara specific commands. When in
doubt, use "buff set si", which always works.
Parameters:
Name Description
index Buffer index (must be a number)
Examples:
buff set si 3
Description: Allows the user to set the size of a specified buffer in memory. This is the same value that will
be used by buff diff when a length of 0 is specified. Note: The buffer will still resize if more information is written
to the buffer than there is space for. buff set size index size.
Parameters:
Name Description
index Buffer Index
size Buffer Size (in bytes)
Examples:
buff fill rand 3 0 0x4000; # Fill buffer three with more data than the default siz
buff set size 3 0x200
D.48 console_sync
Command Name(s): console_sync
Description: Send the current value of ::guimaker::syncConsoleGui. This value is used to determine if more
than one device could be selected.
Parameters:
Name Description
is_synced Is the console synchronized?
Examples:
console_sync 1
Description: This function returns the number of devices connected to the current UIL driver.
Parameters:
Name Description
uil_index Optional: UIL Index
Examples:
device count
Description: This command can be used to change the initiator id of aparticular card. The command can also
be used to manually set up a target. A device with the specified parameters is added to the device list. No checks
are made to see if the device actually exists. Because of this, you may need to do perform a "read_capacity" and
"inquiry" to update drive fields. This command is not available for all drivers.
Parameters:
Name Description
channel ID of card
host_id Desired Initiator ID
target_id Target ID
lun LUN
Examples:
Examples:
Description: This function returns the callback mapped to a specific device command. Callbacks are code
segments that are automatically called whenever a command is executed. Currently supported callbacks are lock,
unlock, rescan, create, remove and "set index".
Examples:
Description: This function returns the callback mapped to a specific device command. Callbacks are code
segments that are automatically called whenever a command is executed. Currently supported callbacks are lock,
unlock, rescan, create, remove and "set index".
Examples:
Description: This function returns the callback mapped to a specific device command. Callbacks are code
segments that are automatically called whenever a command is executed. Currently supported callbacks are lock,
unlock, rescan, create, remove and "set index".
Examples:
Description: This function returns the callback mapped to a specific device command. Callbacks are code
segments that are automatically called whenever a command is executed. Currently supported callbacks are lock,
unlock, rescan, create, remove and "set index".
Examples:
Description: This function returns the callback mapped to a specific device command. Callbacks are code
segments that are automatically called whenever a command is executed. Currently supported callbacks are lock,
unlock, rescan, create, remove and "set index".
Examples:
Description: This function returns the callback mapped to a specific device command. Callbacks are code
segments that are automatically called whenever a command is executed. Currently supported callbacks are lock,
unlock, rescan, create, remove and "set index".
Examples:
Description: This function returns the current target index. Because FCAL/SCSI are not the only potential
interfaces available to Niagara, devices on the loop/bus are enumerated. This function returns the index of the
currently selected device.
Parameters:
Name Description
uil_index Optional: UIL Index
Examples:
Description: This function returns the interface type (SCSI/FCAL/SAS/etc) of the current device, if the driver
has knowledge of this information. In other cases Unsupported Feature is returned.
Examples:
Description: This function returns the last CDB/ATA command to be executed. If the last CDB/ATA com-
mand execution attempt failed due to a syntax error, a partially formed CDB/ATA command may be returned.
Examples:
Description: Returns the command execution time for the last cmd in microseconds.
Examples:
Description: Returns the current state of read xfers. One means that buffer transfers on read are enabled.
Zero means transfers are disabled. If read_xfers are disabled, you cannot count on data being in the buffer after a
transfer from target to host. This command is useful when performance is more important than data verification.
Examples:
Description: Certain commands, such as inquiry or mode_sense, may return fewer bytes back than were
asked for. This function can be used to determine the number of data bytes that we actually sent from the target
to the host. This feature is not available in all drivers.
Examples:
# Perform a command
inq -pagecode 0 -alloc 255
# Get the receive count
puts "We asked for 255 bytes, inquiry actually returned [device get receive_count]"
Description: This command will get the reserved status of a device on a given interface at a given index. If
the device is reserved nothing other than Niagara can send I/O requests to the device. If no index is given then the
current device will be used.
Parameters:
Name Description
index Optional: The index to reserve
Examples:
Description: This function returns the number of bytes actually requested by the device for the last command.
This feature is not available in all drivers.
Examples:
Description: This function returns the timeout value for the current device in milliseconds.
Parameters:
Name Description
-override_persistent Optional: The timeout currently overriding persistent timeouts. O is disabled
-override_persistent Optional: The timeout currently overriding persistent timeouts. O is disabled
Examples:
puts "The current device has a timout of [device get timeout] ms"
Description: Returns the current transfer mode for the current driver. Possible modes are: normal, hc, copy,
random, random_hc, random_seed, random_seed_keyed, keyed, keyed_hc, inc, inc_hc, repeat, repeat_hc.
Examples:
Description: This function resets the device driver and rescans the interface of the current UIL driver for
new/removed devices. Note that not all UIL drivers support hbaresets.
Examples:
device hbareset
Description: This function returns the following information about a device: VendorID, Serial#, CodeLevel,
HostID, SCSIChannel, DeviceID, LUN, SCSIID, Protection, ProtectionType, Phy_BlockSize, Blocksize, MaxLBA,
and ProductID. This information can be requested individually as shown in the example section. Performing an
inquiry updates the serial number, code level, and vendor id (This is useful after a code download). Performing a
rdcap updates the blocksize and maxlba fields (This is useful after changing the blocksize via a format).
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
Examples:
device info
device info vendor //VendorID
device info serial //Serial#
device info codelevel //CodeLevel
device info host //HostID
device info channel //SCSIChannel
device info target //DeviceID
device info lun //LUN
device info scsiid //SCSIID
device info protection //Protection
device info protection_type //ProtectionType
device info phy_blocksize //Phy_Blocksize
device info blocksize //BlockSize
device info maxlba //MaxLBA
device info prodctid //ProductID
device info peripheral //PeripheralType
Description: This function returns the current blocksize for a device. This function does not issue a read_capacity
but instead relies on a previous call to read_capacity for the information. It is a good idea to execute a read_capacity
after formatting a device to a different blocksize to update this field.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Blocksize from the dev selected before the last rescan
-prev Optional: Blocksize from the dev selected before the last rescan
Examples:
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
Examples:
Description: This function returns the code level for a device. This function does not perform an inquiry but
instead relies on a past inquiry for the information. Performing an appropriate inquiry will automatically update
the information. Is is generally a good idea to execute an inquiry command after performing a download and save
operation to update this field.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-full Optional: Full Codelevel
-prev Optional: Info from the dev selected before the last rescan
Examples:
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
Examples:
Description: This function returns a dictionary of inquiry pages and corresponding values of 1/0 to show if
they are valid for a given device.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
-valid Optional: Return whether the inq_pages have been set instead of the inq_pages
dictionary
-valid Optional: Return whether the inq_pages have been set instead of the inq_pages
dictionary
Examples:
Description: This function returns the LUN of the currently selected device.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
Examples:
Description: This function returns the stored HA Marker Size (MRKSZ) for the selected device.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
Examples:
Description: This function returns the stored maxlba for the current device. Note that this function does not
perform a read_capacity, therefore it is possible for the results of this command to be reformatted. Every time an
appropriate read_capacity is executed, however this field is automatically updated. If Niagara was started with a
drive spun down, this command may return a zero. Executing a read_capacity will correct the value automatically.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
Examples:
Description: This function returns whether the device has inline metadata.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
Examples:
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
Examples:
Description: This function returns the name of the currently selected device.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Name from the dev selected before the last rescan
Examples:
Description: This function returns the peripheral type of a device. This function does not issue an inquiry for
the information but instead relies on information stored from a previous inquiry for the information.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
Examples:
Description: This function returns the current physical blocksize for a device. This function does not issue a
read_capacity16 but instead relies on a previous call to read_capacity16 for the information. It is a good idea to
execute a read_capacity16 after formatting a device to a different blocksize to update this field.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: PhyBlocksize from the dev selected before the last rescan
-prev Optional: PhyBlocksize from the dev selected before the last rescan
Examples:
Description: This function returns the stored product id for a device. Note that this command does not
perform an inquiry for the information but instead depends on a inquiry that was called when the CIL was started.
Performing an inquiry at any time will update the information returned by this command. Setting the device_index
to -1 will return the product id for the currently selected device on the UIL specified.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-dev Optional: Device Index - This is also the 1st optional flag
-uil Optional: UIL Index - This is also the 2nd optional flag
-prev Optional: Info from the dev selected before the last rescan
Examples:
Description: This function returns the project of the currently selected device.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
Examples:
Description: This function returns true if end to end protection is enabled for the currently selected device.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
Examples:
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
Examples:
Description: Returns the protection type for a device. This is the protection type value defined in the SCSI
spec. It is equal to the value returned by rdcap16 + 1.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
Examples:
Description: This function returns the protocol of a device (scsi or ata). This function does not issue an
inquiry for the information but instead relies on information stored from a previous inquiry for the information.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
Examples:
Description: This function returns true if reference tag own is enabled for the currently selected device.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
Examples:
Description: This function returns the SCSIID of the currently selected device.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
Examples:
Description: This function returns the stored serial number for a device. Note that this command does not
perform an inquiry for the information but instead depends on a inquiry that was called when the CIL was started.
Performing an inquiry at any time will update the information returned by this command. Setting the device_index
to -1 will return the serial for the currently selected device on the UIL specified.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-dev Optional: Device Index - This is also the 1st optional flag
-uil Optional: UIL Index - This is also the 2nd optional flag
-prev Optional: Info from the dev selected before the last rescan
Examples:
Description: This function returns the ASIC version of a device connected over serial.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
Examples:
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
Examples:
Description: This function returns the vendor id for a device. This function does not issue an inquiry for the
information but instead relies on information stored from a previous inquiry for the information.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-prev Optional: Info from the dev selected before the last rescan
Examples:
Description: This function returns the stored wwid for a device. Note that this command does not perform an
inquiry for the information but instead depends on a inquiry that was called when the CIL was started. Performing
an inquiry at any time will update the information returned by this command. Setting the device_index to -1 will
return the WWID for the currently selected device on the UIL specified.
Parameters:
Name Description
device_index Optional: Device Index
uil_index Optional: UIL Index
-dev Optional: Device Index - This is also the 1st optional flag
-uil Optional: UIL Index - This is also the 2nd optional flag
-prev Optional: Info from the dev selected before the last rescan
Examples:
Description: This function returns 1 if a device is locked, 0 otherwise. A locked device returns a "Device
Locked" error to any commands directed at it.
Parameters:
Name Description
index The index of the drive to query
uil_index Optional: The index of the uil to use (if not the current)
Examples:
Description: This function returns a table of devices connected to the current uil. This table contains the
following information: index of device, vendor id,host id, card id, target id, LUN, maxlba of device, and the
blocksize of the device.
Parameters:
Name Description
uil_index Optional: The index of the uil to use (if not the current)
Examples:
device list
Description: This function locks a device. A locked device return an error if any commands are sent to it.
This function is useful for protecting an internal drive or other non-testing device from accidental damage.
Parameters:
Name Description
index The device index to lock
uil_index Optional: The uil index to lock the device on
Examples:
# Lock device 0
device lock 0
Parameters:
Name Description
serial_num The serial number of the drive to lock
uil_index Optional: The uil that the device is on (if not the current one)
Examples:
Description: This command removes a device from the device list. If the current device index is greater than
or equal to the removed device, it is decremented automatically. This command is not available for all drivers.
Parameters:
Name Description
index Index of device to remove
Examples:
Description: This function rescans the interface of the current UIL driver for new/removed devices. Note that
not all UIL drivers support device rescans.
Parameters:
Name Description
uil_index Optional: The uil index to lock the device on
Examples:
device rescan
Parameters:
Name Description
on/off 1 to allow device to be set when locked, 0 to disallow
Examples:
Description: This function sets the blocksize for the device. Normally this should be done using a read_capacity
cdb (which sets the parameter automatically). This command is provided for cases where the blocksize needs to
be explicitly set (such as during drive bringup).
Parameters:
Name Description
blocksize The blocksize to set the device to
Examples:
Description: This function is used to set a callback for a particular command. Each time the command is
called, this callback is executed as code. Currently supported callbacks are "lock", "unlock", "rescan", "create",
"remove", and "set index". Each of these callbacks correspond to the associated device command. Note that in
the cases of lock, unlock, create, remove, and set index, the variable device_index and uil_index are set to provide
further information within the callback (rescan only sets uil_index). Also note that it is generally a good idea to
make sure a callback is unset before setting it yourself. To remove a callback, set it to "".
Parameters:
Name Description
callback Code to execute
Examples:
Description: This function is used to set a callback for a particular command. Each time the command is
called, this callback is executed as code. Currently supported callbacks are "lock", "unlock", "rescan", "create",
"remove", and "set index". Each of these callbacks correspond to the associated device command. Note that in
the cases of lock, unlock, create, remove, and set index, the variable device_index and uil_index are set to provide
further information within the callback (rescan only sets uil_index). Also note that it is generally a good idea to
make sure a callback is unset before setting it yourself. To remove a callback, set it to "".
Parameters:
Name Description
callback Code to execute
Examples:
Description: This function is used to set a callback for a particular command. Each time the command is
called, this callback is executed as code. Currently supported callbacks are "lock", "unlock", "rescan", "create",
"remove", and "set index". Each of these callbacks correspond to the associated device command. Note that in
the cases of lock, unlock, create, remove, and set index, the variable device_index and uil_index are set to provide
further information within the callback (rescan only sets uil_index). Also note that it is generally a good idea to
make sure a callback is unset before setting it yourself. To remove a callback, set it to "".
Parameters:
Name Description
callback Code to execute
Examples:
Description: This function is used to set a callback for a particular command. Each time the command is
called, this callback is executed as code. Currently supported callbacks are "lock", "unlock", "rescan", "create",
"remove", and "set index". Each of these callbacks correspond to the associated device command. Note that in
the cases of lock, unlock, create, remove, and set index, the variable device_index and uil_index are set to provide
further information within the callback (rescan only sets uil_index). Also note that it is generally a good idea to
make sure a callback is unset before setting it yourself. To remove a callback, set it to "".
Parameters:
Name Description
callback Code to execute
Examples:
Description: This function is used to set a callback for a particular command. Each time the command is
called, this callback is executed as code. Currently supported callbacks are "lock", "unlock", "rescan", "create",
"remove", and "set index". Each of these callbacks correspond to the associated device command. Note that in
the cases of lock, unlock, create, remove, and set index, the variable device_index and uil_index are set to provide
further information within the callback (rescan only sets uil_index). Also note that it is generally a good idea to
make sure a callback is unset before setting it yourself. To remove a callback, set it to "".
Parameters:
Name Description
callback Code to execute
Examples:
Description: This function is used to set a callback for a particular command. Each time the command is
called, this callback is executed as code. Currently supported callbacks are "lock", "unlock", "rescan", "create",
"remove", and "set index". Each of these callbacks correspond to the associated device command. Note that in
the cases of lock, unlock, create, remove, and set index, the variable device_index and uil_index are set to provide
further information within the callback (rescan only sets uil_index). Also note that it is generally a good idea to
make sure a callback is unset before setting it yourself. To remove a callback, set it to "".
Parameters:
Name Description
callback Code to execute
Examples:
Description: Each UIL object can generally access one or more devices. This function selects a device for a
particular uil. Note that a given UIL instance "remembers" its current device index so this command only applies
to the current uil. This command is generally used to communicate with multiple drives on a single bus/loop.
Parameters:
Name Description
index Index of Device
uil Optional: UIL to use
Examples:
Description: This function sets the HA Marker Size (MRKSZ) for the selected device. NOTE:This command
will overwrite the Niagara internal markersize value, but will not change the value on the actual device (as it is
read only).
Parameters:
Name Description
markersize Marker size in bytes
Examples:
Description: This function sets the maximum LBA for the device. Normally this should be done using a
read_capacity cdb (which sets the parameter automatically). This command is provided for cases where the max
lba needs to be explicitly set (such as during drive bringup).
Parameters:
Name Description
maxlba Maximum LBA in blocks
Examples:
Description: This function sets the physical blocksize for the device. Normally this should be done using
a read_capacity cdb (which sets the parameter automatically). This command is provided for cases where the
physical blocksize needs to be explicitly set (such as during drive bringup).
Parameters:
Name Description
phy_blocksize The physical blocksize to set the device to
Examples:
Description: This function will set a new project id for the drive.
Parameters:
Name Description
project The name of the project id
Examples:
Description: This function sets the current device’s protocol. This is something that is set during a device
rescan. This is useful if you want certain tools to act a specific way depending on the device’s protocol. SuperCSO
is an example of that.
Parameters:
Name Description
device_protocol The protocol to set the device to: scsi, ata, ahci, or unknown
device_protocol The protocol to set the device to: scsi, ata, ahci, or unknown
Examples:
Description: This command (might) disable transfers to the current receive buffer. The intent of this function
is to allow application that are only concerned with maximum speed to disable the transfers in exchange for faster
command execution. Note that not all drivers support this function.
Parameters:
Name Description
read_xfer_state Set to one if on, 0 if off
Examples:
Description: This command will get the reserved status of a device on a given interface at a given index. If
the device is reserved nothing other than Niagara can send I/O requests to the device. If no index is given then the
current device will be used.
Parameters:
Name Description
reserve Bool used to reserve or release the device
index Optional: The index to reserve
Examples:
Description: This function will set a new serial number for the drive.
Parameters:
Name Description
serial The Serial Number in which you would like to set to the current drive
Examples:
Description: This function sets a command timeout value for devices. Note that different UIL drivers support
different units for timeout values, not all allow timing to millisecond accuracy. Therefore after setting a timeout,
the actual timeout set is returned.
Parameters:
Name Description
time Timeout in milliseconds
-override_persistent Optional: Temporarily override the persistent timeouts set for each command. Use
0 to disable.
-override_persistent Optional: Temporarily override the persistent timeouts set for each command. Use
0 to disable.
Examples:
Description: Sets the transfer mode for the current driver, return error if not supported, 0 if hardware im-
plemented, 1 if software emulated. Available modes are: normal, hc, copy, random, random_hc, random_seed,
random_seed_keyed, keyed, keyed_hc, inc, inc_hc, repeat, repeat_hc, or repeat_read_hc. Note that for most
drivers (i-Tech), only read/write commands generate data from hardware.
Parameters:
Name Description
mode The string representation of the mode
seed Optional: Random Seek
Examples:
Description: This command unlocks a device. A locked device returns a "Device Locked" error if any CDBs
or other commands are sent to it.
Parameters:
Name Description
index The index of the device to unlock
uil_index Optional: The uil index to lock the device on
Examples:
# Unlock device 0
device unlock 0
Parameters:
Name Description
serial_num The serial number of the drive to unlock
uil_index Optional: The uil that the device is on (if not the current one)
Examples:
D.123 disable_niagara_log
Command Name(s): disable_niagara_log
Examples:
disable_niagara_log
D.124 enable_niagara_log
Command Name(s): enable_niagara_log
Examples:
enable_niagara_log
D.125 encode
Command Name(s): encode
Description: This function encrypts a TCL file, producing a <filename>.stc file. Once encrypted, the file
cannot be viewed or edited. The file can be executed with the esource command, however.
Parameters:
Name Description
tcl_filename tcl filename
Examples:
encode
D.126 eparse
Command Name(s): eparse
Description: This function opens a special file that contains definition for CDBs/ATA commands and sense
data.
Parameters:
Name Description
filename Filename to parse
-dont_overwrite Optional: Do not overwrite any previous commands of the same name
-dont_overwrite Optional: Do not overwrite any previous commands of the same name
Examples:
eparse $::env(NiagaraPath)/commands/cdb_commands.txt
D.127 err_str
Command Name(s): err_str
Description: Converts the error code returned by the ec variable into a human readable string.
Parameters:
Name Description
error_code error code
Examples:
err_str
D.128 esource
Command Name(s): esource
Description: This version of source acts identical to TCL version except that it can also execute .stc files. A
.stc file is an encrypted TCL file created with the encode command.
Parameters:
Name Description
filename Tcl filename
Examples:
encode test.tcl
esource test.stc
Description: This function sends a low-level abort_task_set FCAL frame to the device. Clearly, this command
is intended for FCAL devices only.
Parameters:
Name Description
ox_id Optional: ox_id to us with command
Examples:
Description: This function sends a low-level abort sequence FCAL frame to the device. Clearly, this com-
mand is intended for FCAL devices only.
Examples:
fcal abts
Description: This function sends a low-level clear_aca FCAL frame to the device. Clearly, this command is
intended for FCAL devices only.
Examples:
fcal clear_aca
Description: This function sends a low-level clear_task_set FCAL frame to the device. Clearly, this command
is intended for FCAL devices only.
Examples:
fcal clear_task_set
Description: This function sends a LIP followed by a port and process login to all devices.Normally you
would want to use a device rescan instead of this command.
Examples:
fcal lip_reset
Description: This function sends a low-level port_login FCAL frame to the device. Clearly, this command is
intended for FCAL devices only.
Parameters:
Name Description
payload_size New payload size
Examples:
fcal port_login
Description: This function sends a low-level process_login FCAL frame to the device. Clearly, this command
is intended for FCAL devices only.
Examples:
fcal process_login
Description: This function sends a reset followed by a port and process login to all devices. Normally you
would want to use a device rescan instead of this command.
Examples:
fcal reset
Description: This function sends a low-level target_reset FCAL frame to the device. Clearly, this command
is intended for FCAL devices only.
Examples:
fcal target_reset
Description: This function sends a low-level term_task FCAL frame to the device.Clearly, this command is
intended for FCAL devices only.
Examples:
fcal term_task
Description: This function turns the output of asynchronus NVMe CQEs on/off.A zero value turns the CQE
display off, a non-zero value turns CQE output on.This function is used to make a trade-off between functionality
and output speed.
Parameters:
Name Description
flag Optional: 0 to not show NVME CQEs, non-zero to show NVME CQEs
Examples:
feedback asynccqe
Description: This function turns embedded color on/off. A zero value turns embedded color on, non-zero
value turns color off. Note that this setting is only effective when using Niagara through an ANSI compatible
terminal. On other terminals, this option will add "garbage" characters to the display. The default setting for this
function is off. This setting is generally called in a startup script.
Parameters:
Name Description
flag Optional: 0 turns off color, non zero turns on color
Examples:
feedback color
Description: This function sets the current feedback level to a known state. This setting sets maxlen=255,
showcmd=true, and showatafis=true.
Examples:
feedback default
Description: This function changes the maximum number of buffer bytes returned by a command. Whenever
a command is called, the number of buffer bytes will be either the number actually returned, or the number
specified by this function, whichever is smaller. If a returned buffer prints less bytes than are returned, a ... is
printed at the end of the hex dump. This command is primarily used to make a trade-off between return verbosity
and speed. When trying to achieve maximum performance on high speed commands, set this value to zero for a
notable speed improvement.
Parameters:
Name Description
length Optional: Number of buffer bytes
Examples:
feedback maxlen
Description: This function sets the maximum number of returned buffer bytes to zero and turns off CDB
output. The result is improved execution performance. Use this command to set Niagara for maximum speed.
Examples:
feedback min
Description: This function pops the current state off the "feedback stack". This allows a user to store a feed-
back state and recall it. This command is useful for storing a feedback state before changing it for performance,
or other reasons.
Examples:
feedback pop
Description: This function pushes the current state off the "feedback stack". This allows a user to recall a
stored feedback state.
Examples:
feedback push
Description: This function turns the output of the ATA return FIS on/off. A zero value turns the FIS display
off, a non-zero value turns FIS output on. This function is used to make a trade-off between functionality and
output speed.
Parameters:
Name Description
flag Optional: 0 to not show ATA return FIS, non-zero to show ATA return FIS
flag Optional: 0 to not show ATA return FIS, non-zero to show ATA return FIS
Examples:
feedback showatafis
Description: This function turns the output of the CDB/ATA command on/off. A zero value turn the CDB
display off, a non-zero value turns CDB output on. This function is used to make a (slight) trade-off between
functionality and output speed.
Parameters:
Name Description
flag Optional: 0 to not show cdb, non-zero to show CDB
Examples:
feedback showcdb
Description: This function turns the output of the NVMe Completion Queue entry on/off.A zero value turns
the CQE display off, a non-zero value turns CQE output on.This function is used to make a trade-off between
functionality and output speed.
Parameters:
Name Description
flag Optional: 0 to not show NVMe CQEs, non-zero to show NVMe CQE
Examples:
feedback showcqe
D.149 get_cil_list
Command Name(s): get_cil_list
Description: Return a list of all CIL commands, listed in the order that the command was created.
Examples:
get_cil_list
D.150 get_cq_str
Command Name(s): get_cq_str
Description: This command returns the full descriptive error string associated with the specified cq value.
Parameters:
Name Description
cq CQ value to get matching error string
Examples:
dword3 80170010
D.151 get_kcq_str
Command Name(s): get_kcq_str
Description: This command returns the full descriptive error string associated with the specified kcq value.
Parameters:
Name Description
kcq KCQ value to get matching error string
Examples:
kcq 052000
D.152 init
Command Name(s): init
Examples:
No Examples given
D.153 niagara_log_puts
Command Name(s): niagara_log_puts
Description: This function will log a message to the Niagara log file which can be useful in debugging
problemsshould they arise.
Parameters:
Name Description
message Message to log to the Niagara log
Examples:
Description: This function dumps a specific command from the submission and completion queue based on
command identifier.
Parameters:
Name Description
qid Submission Queue ID
cid Command identifier
index Optional: Device to run the command on
Examples:
Description: This function dumps the current head, tail, size, and contents of a completion queue.If ’all’ is
specified, it dumps every completion queue owned by this controller, orthe controller associated with the selected
namespace.
Parameters:
Name Description
qid Queue ID to dump
first_entry Optional: First command dumped
last_entry Optional: Last command dumped
index Optional: Device to run the command on
Examples:
nvme dump_cq 0
nvme dump_cq 0 6 25
Description: This function dumps the current head, tail, size, and contents of a submission queue.If ’all’ is
specified, it dumps every submission queue owned by this controller, orthe controller associated with the selected
namespace.
Parameters:
Name Description
qid Queue ID to dump
first_entry Optional: First command dumped
last_entry Optional: Last command dumped
index Optional: Device to run the command on
Examples:
nvme dump_sq 1
nvme dump_sq 0 6 25
Description: This function returns the callback mapped to a specific device command. Callbacks are code
segments that are automatically called whenever a command is executed. Currently supported callbacks are reset.
Examples:
Description: This function returns the controller id corresponding to the given device index.
Parameters:
Name Description
dev_idx The device index of the controller
Examples:
Description: This function returns a list of completion queue ids that currently exist for the selected controller,
or the controller associated with the selected namespace.
Parameters:
Name Description
index Optional: Device to run the command on
Examples:
Parameters:
Name Description
qid Queue ID to return size of
index Optional: Device to run the command on
Examples:
Description: This function returns the device index corresponding to the given controller id.
Parameters:
Name Description
ctrlid ID of the controller
serial_num Serial number of the controller
Examples:
Description: This function returns the value describing whether the completion queue will automatically
receive commands, or if it will wait until nvme drain_cq is set to 1.
Parameters:
Name Description
index Optional: Device to run the command on
Examples:
Description: This function returns the command ID (CID) of the last completion entry received by the driver.
It may be helpful to turn off asynchronus events, otherwise the "last" completion entry may not be for the com-
mand that was just issued.
Parameters:
Name Description
index Optional: Device to run the command on
Examples:
Description: This function returns the specified dword of the last completion entry received by the driver. It
may be helpful to turn off asynchronus events, otherwise the "last" completion entry may not be for the command
that was just issued.
Parameters:
Name Description
dword Dword to gather
index Optional: Device to run the command on
Examples:
Description: This function returns the first dword of the last completion entry received by the driver. It may
be helpful to turn off asynchronus events, otherwise the "last" completion entry may not be for the command that
was just issued.
Parameters:
Name Description
index Optional: Device to run the command on
Examples:
Description: This function returns the second dword of the last completion entry received by the driver. It
may be helpful to turn off asynchronus events, otherwise the "last" completion entry may not be for the command
that was just issued.
Parameters:
Name Description
index Optional: Device to run the command on
Examples:
Description: This function returns the last error log page. This is set when the more bit is set in a completion
queue entry.
Parameters:
Name Description
index Optional: Device to run the command on
Examples:
Description: This function returns the status code and status code type of the last completion queue entry
received by the driver. It may be helpful to turn off asynchronus events, otherwise the "last" completion entry may
not be for the command that was just issued.
Parameters:
Name Description
index Optional: Device to run the command on
Examples:
Description: This function returns the memory page size (in bytes) for the selected controller, or the controller
associated with the selected namespace.
Parameters:
Name Description
index Optional: Device to run the command on
Examples:
Description: This function reads a specified register. The registers can be referenced byname (CAP, VS, CC,
CSTS, AQA, ASQ, ACQ), or by address.
Parameters:
Name Description
reg Register to get
index Optional: Device to run the command on.
Examples:
Description: This function returns a list of submission queue ids that currently exist for the selected controller,
or the controller associated with the selected namespace.
Parameters:
Name Description
index Optional: Device to run the command on
Examples:
Parameters:
Name Description
qid Queue ID to return size of
index Optional: Device to run the command on
Examples:
Description: This function performs either a NVM subsystem reset, a controller reset, or a shutdown on the
device. A controller reset with the shutdown_type specified will shutdown the controller before resetting it. Valid
reset types are "controller" and "nvm". "c" and "n" are also accepted.
Parameters:
Name Description
type The type of reset to perform
shutdown_type Optional: Used to perform a normal/abrupt shutdown as part of the reset
shutdown_type Optional: Used to perform a normal/abrupt shutdown as part of the reset
index Optional: Device to run the command on.
-no_reenable Optional: Do not attempt to re-enable the device
-timeout Optional: Set the timeout (ms) value for the command
Examples:
Description: This function performs a queue level reset, destroying a queue after allowing commands to
complete and recreating it. A new queue depth can be specified for when it is recreated.
Parameters:
Name Description
type Type of queue, submission or completion
qid ID of the queue to reset
depth Optional: Depth of the queue to recreate with. Defaults to same as the destroyed
queue
depth Optional: Depth of the queue to recreate with. Defaults to same as the destroyed
queue
device Optional: Device to perform the queue reset on
Examples:
nvme reset_queue c 1 8
nvme reset_queue s 1 8 2
Description: This function is used to set a callback for a particular command. Each time the command is
called, this callback is executed as code. Currently supported callbacks are "reset". Each of these callbacks
correspond to the associated nvme command. Note that it is generally a good idea to make sure a callback is unset
before setting it yourself. To remove a callback, set it to "".
Parameters:
Name Description
callback Code to execute
Examples:
Description: This function attempts to set a value that determines whether the completion queue will auto-
matically receive commands. Setting this value to 1 will drain the completion queue of completed commands
while 0 will cause Niagara to wait until drain_cq is set back to 1 before draining commands from CQ.
Parameters:
Name Description
auto_drain Determines whether CQ automatically receives commands
index Optional: Device to run the command on
Examples:
Description: This function sets the memory page size (in bytes) for the selected controller, or the controller
associated with the selected namespace. This value is used for PRP entry size and will result in a controller reset.
Parameters:
Name Description
size page size (in bytes) to set for controller. Valid Options: 4k/8k
index Optional: Device to run the command on
Examples:
Description: This function attempts to set a given NVMe register to a given value. The register can be speci-
fied by name, or as an offset and a mask. !!!WARNING: SETTING REGISTER BY OFFSET CAN CORRUPT
THE DEVICE AND/OR NIAGARA!!! USE AT YOUR OWN RISK.
Parameters:
Name Description
reg The register to set
data The value to
mask Optional: Mask to use when setting the register. Only used when a bar offset is
given.
mask Optional: Mask to use when setting the register. Only used when a bar offset is
given.
index Optional: Device to run the command on.
-o Optional: Overrides register restriction, USE WITH CARE!!!
Examples:
D.179 parse
Command Name(s): parse
Description: This function opens a special file that contains definition for CDBs/ATA commands and sense
data.
Parameters:
Name Description
filename Filename to parse
-dont_overwrite Optional: Do not overwrite any previous commands of the same name
-dont_overwrite Optional: Do not overwrite any previous commands of the same name
Examples:
parse $::env(NiagaraPath)/commands/cdb_commands.txt
Description: This function reads a specified register. The registers can be referenced byname (ID, CMD,
STS, RID, CC, CLS, MLT, HTYPE, BIST, BAR0, BAR1, BAR2, CCPTR, SS, EROM, CAP, INTR), or by starting
offset.Sub-addresses can be specified with a period.
Parameters:
Name Description
reg Registery name or starting address
length Optional: Length of the read. Valid lengths are 1, 2, and 4 bytess. Defaults to 4.
length Optional: Length of the read. Valid lengths are 1, 2, and 4 bytess. Defaults to 4.
index Optional: Device to run the command on.
Examples:
Parameters:
Name Description
index Optional: Device to run the command on. Only supported on pciport driver.
index Optional: Device to run the command on. Only supported on pciport driver.
-d Optional: Allow specifying an lspci device for index instead
-v Optional: Outputs more verbose info in human readable format, else outputs 1 for
up and 0 for down
-v Optional: Outputs more verbose info in human readable format, else outputs 1 for
up and 0 for down
Examples:
Description: This function returns a drive’s reported speed or -1 for no device found.
Parameters:
Name Description
index Optional: Device index to run the command on. Only supported on pciport driver..
index Optional: Device index to run the command on. Only supported on pciport driver..
-d Optional: Allow specifying an lspci device for index instead
-v Optional: Outputs more verbose info in human readable format, else outputs speed
-v Optional: Outputs more verbose info in human readable format, else outputs speed
Examples:
Description: This function returns 1 for up, 0 for down, -1 for no device found.
Parameters:
Name Description
index Optional: Niagara device to run the command on. Only supported on pciport
driver.
index Optional: Niagara device to run the command on. Only supported on pciport
driver.
-d Optional: Allow specifying an lspci device for index instead
-v Optional: Outputs more verbose info in a human-readable format
Examples:
Parameters:
Name Description
index Optional: Device to run the command on. Only supported on pciport driver.
index Optional: Device to run the command on. Only supported on pciport driver.
-d Optional: Allow specifying an lspci device for index instead
-v Optional: Outputs more verbose info in human readable format, else outputs width
-v Optional: Outputs more verbose info in human readable format, else outputs width
Examples:
Description: This function attempts to set a given pcie register to a given value. The register can be specified
by name, or as an offset and a mask.
Parameters:
Name Description
reg The register to set
data The value to write
length Optional: Length of the read. Valid lengths are 1, 2, and 4 bytes. Defaults to 4
length Optional: Length of the read. Valid lengths are 1, 2, and 4 bytes. Defaults to 4
mask Optional: Mask to use when setting the register. Only used when a bar offset is
given.
mask Optional: Mask to use when setting the register. Only used when a bar offset is
given.
index Optional: Device to run the command on.
Examples:
Description: This function functions like [clock clicks] but returns value in microseconds instead of millisec-
onds. See also: perfcnt count, perfcnt freq.
Examples:
perfcnt clicks
Description: Result is given in a list of [HighPart, LowPart], with the HighPart given in seconds. See also:
perfcnt freq, perfcnt clicks.
Examples:
perfcnt count
Description: Delay is performed using a high resolution timer. See also: perfcnt count, perfcnt clicks.
Parameters:
Name Description
usecs_to_delay Microseconds to delay
Examples:
Description: Result is given in list of [HighPart, LowPart]. Most likely ticks per seconds will not exceed the
LowPart. See also: perfcnt count, perfcnt clicks.
Examples:
perfcnt freq
Description: This function dumps the current PI, CI, size, and contents of an inbound queue. If ’all’ is
specified, it dumps every inbound queue related to this device.
Parameters:
Name Description
qid Queue ID to dump
Examples:
pqi dump_iq 0
Description: This function dumps the current PI, CI, size, and contents of an outbound queue. If ’all’ is
specified, it dumps every completion queue owned by this controller, orthe controller associated with the selected
namespace.
Parameters:
Name Description
qid Queue ID to dump
Examples:
pqi dump_oq 1
Description: This function reads a given PQI register. The register offset must be dword aligned.
Parameters:
Name Description
reg Register offset to use
Examples:
Description: This function attempts to set a given PQI register to a given value. The register offset must be
dword aligned.
Parameters:
Name Description
reg The register to set
data The value to write
mask Mask to use when setting the register.
Examples:
Description: This function returns a 1 if auto tag increment is enabled, zero otherwise.If auto tag increment is
on, the tag_id sent with command is incremented by one each time a command is sent. See also: qctl set auto_incr,
qctl set tag_id.
Examples:
Description: The ignore_queue_full bit decides whether to report an error message if the current queue depth
exceeds the maximum queue depth. A value of ’1’ disables the Queue Full error message report.
Examples:
Description: This function returns the current setting for the maximum queue depth. See also: qctl set
max_depth.
Parameters:
Name Description
sq Optional: Return the depth of a specific submission queue
-driver_max Optional: Return the driver’s max queue depth instead of the current max queue
depth
-driver_max Optional: Return the driver’s max queue depth instead of the current max queue
depth
sq Optional: Only send a specific submission queue’s commands
Examples:
Description: This function returns the number of commands that have been issued, but haven’t had status
returned.
Parameters:
Name Description
sq Optional: Return the number of commands of a specific submission queue
sq Optional: Return the number of commands of a specific submission queue
-all Optional: Returns number of commands of all submission queues
Examples:
Description: This function returns the number of queued commands that have returned status.This function
is useful for determining an estimation of realized queue depth. See also: qmode concurrent, qmode stacked.
Parameters:
Name Description
device Optional: Device to recieve from
Examples:
Description: This function returns the current queue tag type. Types include simple, ordered and head. See
also: qctl set tag_type.
Examples:
Description: This function returns status information for a specified queue index. When "qctl recv all" is
called, queue entries are placed in an internal table.This function is one of the way to examine the contents of the
table. See also: qctl recv all, qctl table_info, qctl tag_info.
Parameters:
Name Description
index Index of command (ordered by reply from device)
-list Optional: Output results in a list structure
Examples:
qmode concurrent
do 8 {r10 [randlba]}
qctl recv all
qctl idx_info 0
Description: This function waits for and retrieves the next available command from the device. Status on the
commands success is returned See also: qctl recv all, qctl recv tag.
Parameters:
Name Description
device Optional: Device to recieve from
Examples:
Description: Waits for and retrieves all outstanding commands from the device. Returns successif all com-
mands were completed successfully or an error if any commands did not.Commands results are placed in a table
that can be parsed with the "qctl idx_info","qctl tag_info", and "qctl table_info" commands. See also: qctl recv,
qctl recv tag.
Parameters:
Name Description
device Optional: Device to recieve from
Examples:
qmode concurrent
do 8 {r10 [randlba]}
qctl recv all
qctl table_info
Description: This function waits for and retrieves commands from the current device until the tag id is
received. Returns success if all commands up to and including <tag id> were successful andan error if any were
not. See also: qctl set tag_id,qctl recv, qctl recv all.
Parameters:
Name Description
tag_id Tag ID to wait for
device Optional: Device to recieve from
Examples:
qmode concurrent
do 8 {r10 [randlba]}
qctl recv all
qctl table_info
Description: This function sends an internal table of commands that were built up in stacked/pcie queuing
mode to a device. This command cannot be used in concurrent mode. See also: qmode stacked, qmode concurrent,
qmode info, qmode pcie, init, qctl recv.
Parameters:
Name Description
device Optional: Send commands queued in specified device
Examples:
Description: This function turns tag_id auto increment on/off. When auto increment is on, the tag_id will
automatically increment by 1 every time a command is send. Normally you want this setting on for convenience.
See also: qctl set tag_id, qctl get auto_incr.
Parameters:
Name Description
auto_incr Zero turn off auto increment, non zero turns it on
Examples:
Description: This function enables or disables QUEUE FULL error. The default setting is ’0’, if the queue
buffer exceeds the max queue depth, a QUEUE_FULL error message will be returned. If sets to ’1’, the driver
ignores any potential risk of sending too many commands to the HBA and will alow you to send as many com-
mands as you like without error. Please be warned that this is an ADVANCED setting and you must make sure
your queue depth does not exceed the maximum queue depth supported or you may experience an HBA hang.
Parameters:
Name Description
on/off 1 to turn ignore_queue_full. 0 to turn ignore_queue_full off
Examples:
Description: This function tests a queuing depth to see if it is supported and makes any setting changes
required to support the depth. Note that the default queuing depth may be deeperthan the depth specified. This
command only guarantees that thecurrent queuing depth is at least that specified, the actual depth may be deeper.
See also: qctl get max_depth.
Parameters:
Name Description
max_depth Maximum Queue Depth
sq Optional: Sets the depth of a given submission queue
Examples:
Description: This function is used to explicitly set the tag_id of the next command. In most cases, "qctl set
auto_incr 1" is a more convenient approach to handling tag ids. See also: qctl set auto_incr.
Parameters:
Name Description
tag_id Tag ID of next tag
Examples:
Description: This function sets the tag type of commands that follow. Options for the type include simple,
ordered and head. See also: qmode concurrent, qmode stacked, qctl get tag_type.
Parameters:
Name Description
tag_type simple, ordered or head
Examples:
qmode stacked
# Send some simple commands
qctl set tag_type simple
r10
r10
r10
# Send some ordered commands
qctl set tag_type ordered
r10
r10
r10
qctl send
qctl recv all
qmode disable
Description: This function returns a table describing the status of commands returnedby "qctl recv all". Using
the -list option, the format is one that is easy to parse. Otherwise the format is one that is easy to read. See also:
qctl recv all, qctl idx_info, qctl tag_info.
Parameters:
Name Description
-list Optional: Output results in a list structure
Examples:
qmode concurrent
do 8 {r10 [randlba]}
qctl recv all
qctl table_info
Description: This function returns information for a specified tag. When the "qctl recv all" commandis used,
results of the commands are placed in an internal table. This funcition allow information for a specific tag to be
extracted from the table. See also: qctl recv all, qctl idx_info, qctl table_info.
Parameters:
Name Description
tag_id Tag ID of command
-list Optional: Output results in a list structure
Examples:
qmode concurrent
qctl set auto_incr 1
qctl set tag_id 21
do 8 {r10 [randlba]}
qctl recv tag 21
qctl tag_info 21
Description: This function places Niagara in concurrent queuing mode. In this mode, Niagara does not wait
for commands to return status before returning control to the user. When status is needed, it is retrieved using
a "qctl recv" command. Return to normal mode with a "qmode disable" command. See also: qmode stacked,
qmode info, qmode disable, qctl recv, init.
Parameters:
Name Description
depth Optional: Maximum queue depth (default is 16)
Examples:
# qd = 1
puts -nonewline "Timing $iterations random reads at qd=1... "
set t1 [clock seconds]
for {set i 0} {$i < $iterations} {incr i} { r10 [randlba] }
set t2 [clock seconds]
puts "[expr $t2 - $t1] seconds"
#qd = 8
qmode concurrent
puts -nonewline "Timing $iterations random reads at qd=8... "
set t1 [clock seconds]
for {set i 0} {$i < 8} {incr i} { r10 [randlba] }
for {set i 0} {$i < $qit} {incr i} {
r10 [randlba]
qctl recv
}
set t2 [clock seconds]
puts "[expr $t2 - $t1] seconds"
# Clear queue
qctl recv all
Description: This function puts the current UIL in normal (non-queued) mode. In this mode commands to
the drive wait for status (or time out) before returning control to the user. See also: qmode concurrent, qmode
info, init.
Examples:
qmode disable
Description: This function returns Niagara’s current queuing mode. Possible modes are disabled, concurrent,
stacked, and pcie. See also: qmode concurrent, qmode disable, qmode stacked, qmode pcie, init.
Examples:
qmode info
Description: This function puts the current UIL into pcie queuing mode. In this mode, commands are placed
into the IO submission queue specified by the -sq flag or into the last IO submission queue that received a com-
mand. They can be issued as a group with a "qctl send" command. Completion queues are not checked or emptied
until a "qctl recv" command is issued.
Parameters:
Name Description
depth Optional: Maximum allowed waiting commands per queue (default is SQ size)
depth Optional: Maximum allowed waiting commands per queue (default is SQ size)
Examples:
Description: This function puts the current UIL into stacked queuing mode. In this mode, commands are
stacked in memory and then sent to the drive as fast as possible with a "qctl send" command. This mode is
generally used to try and force a deep queue depthSee also: qmode concurrent, qmode info, qmode disable,
qmode pcie, init.
Parameters:
Name Description
depth Optional: Maximum queue depth (default is 16)
Examples:
D.217 rand
Command Name(s): rand
Description: This function generates a random, unsigned float in the range of [0.0:1.0]. An optional random
channel can be specified (which can contain optional histogram information). If histogram information is pro-
vided, the range returned will be influenced by histogram information. If no channel is specified, channel 0 is
used. - See Also: rand open, rand int, rand addhist, rand range, rand frange.
Parameters:
Name Description
channel Optional: ID of the random channel to use (default=0)
Examples:
rand float
See Also: : rand open (page ??), rand int (page 297), rand addhist (page 295), (page ??)
Description: This function defines a histogram entry for an open random channel. When a random number
is generated, this entry will be used to predict the numbers value the specified percentage of the time. You can
stack up to 32 histogram entrys per random generator. Note that once your added histogram entrys total 100
percent or above, adding further entrys will cause the least likely entrys in the histogram to never take effect (the
most likely entrys will always consume the 100% range, leaving extra entrys with a zero percent chance of being
used). If your histogram entries total to less than 100 percent, the default range (which varies per command) is
used for the remaining percentage. Another important thing to note is that, if you define a histogram range that
is outside of a particular commands (rand int, rand double, rand range, etc) range limit, an error will result. It is
your responsibility to ensure that your histogram ranges are appropriate for the commands you are using. - See
Also: rand showhist, buff fill rand, randlba, rand int, rand addhist, rand float, rand range, rand frange, rand open.
Parameters:
Name Description
channel ID of open random channel (from rand open)
min The minimum range of the histogram entry
max The maximum range of the histogram entry
percentage The percentage that the histogram entry is used
Examples:
Description: This function closes a random channel opened with the "rand open" function and frees resources
associated with the random channel. You can not close channel 0. Because the number of random channels is
limited (1024), you should always close a random channel when finished with it. - See Also: rand open, rand int,
rand addhist, rand float, rand range, rand frange, rand seed.
Parameters:
Name Description
channel ID of the random channel to output histogram for
Examples:
Description: This function generates a random, unsigned float in the range of [0.0:1.0]. An optional random
channel can be specified (which can contain optional histogram information). If histogram information is pro-
vided, the range returned will be influenced by histogram information. If no channel is specified, channel 0 is
used. - See Also: rand open, rand int, rand addhist, rand range, rand frange.
Parameters:
Name Description
channel Optional: ID of the random channel to use (default=0)
Examples:
rand float
See Also: : rand open (page ??), rand int (page 297), rand addhist (page 295), (page ??)
Description: This function generates a random, floating point number between [min:max]. An optional
random channel can be specified. If no channel is specified, channel 0 is used. The formula used to determine the
range is equivalent to: expr ([rand float]*($max-$min)) + $min. When using histograms with this command, it
is generally clearer to define your histogram ranges between 0.0 and 1.0. All histogram ranges are applied to the
formula given above. An alternative to this command is to simply bound the random range of a channel with the
"rand addhist" command. - See Also: rand open, rand int, rand addhist, rand range.
Parameters:
Name Description
min Minimum float value
max Maximum float value
channel Optional: ID of the random channel to use (default=0)
Examples:
See Also: : rand open (page ??), rand int (page 297), rand (page 295)
Description: This function generates a random, unsigned integer between 0 and 0xFFFFFFFF. An optional
random channel can be specified (which can contain optional histogram information). If no channel is specified,
channel 0 is used. - See also: rand open, rand float, rand addhist, rand range, rand frange.
Parameters:
Name Description
channel Optional: ID of the random channel to use (default=0)
Examples:
rand int
Description: This Function creates a new random number generator channel. This channel can be used in
commands like "randlba" and "buff fill rand" as well as any of the rand commands. This command returns a
"handle" to the generator which can be used by the associated commands - See Also: buff fill rand, randlba, rand
close, rand int, rand addhist, rand float, rand range, rand frange, rand seed.
Parameters:
Name Description
seed Optional: The starting random seed (integer)
Examples:
Description: This function generates a random, unsigned integer between [min:max]. An optional random
channel can be specified. If no channel is specified, channel 0 is used. The formula used to determine the range
is equivalent to: expr ([rand int]%($max-$min + 1)) + $min. It is generally not recommended that histogram
random channels be used in combination with this command (this is not generally a problem since you can define
ranges within the histogram itself). Histogram ranges outside of those asked for with this command are applied
to the formula given above. This can lead to confusing results. An alternative to this command is to simply bound
the random range of a channel with the "rand addhist" command. - See Also: rand open, rand float, rand addhist,
rand frange.
Parameters:
Name Description
min Minimum integer value
max Maximum integer value
channel Optional: ID of the random channel to use (default=0)
Examples:
See Also: : rand open (page ??), rand float (page 296), rand (page 295)
Description: This funciton seeds a random channel. The seed value is an integer ranging from 0-0xFFFFFFFF.
Is no channel is specified, channel zero is seeded - See Also: rand open, rand int, rand float, rand range, rand
frange.
Parameters:
Name Description
chanSeed Seeds a random channel
channel Optional: ID of the random channel to seed (default is 0)
Examples:
# Seed channel 1
rand seed [clock seconds] 1
See Also: : rand open (page ??), rand int (page 297), rand float (page 296), rand range
(page 299), rand frange (page 297)
Description: This function outputs the histogram settings for an existing random channel. Note that the
histogram entries may be in a different order than they were added. This happens because the rand addhist
command orders the histogram entries for optimal performance - See Also: rand open, rand addhist.
Parameters:
Name Description
channel ID of the random channel to output histogram for
Examples:
See Also: : rand open (page ??), rand addhist (page 295)
D.227 randlba
Command Name(s): randlba
Description: This command provides a convenient way to produce a random lba. The lba produced will be
somewhere between zero and "maxlba - maxblk". An optional random channel can be specified.
Parameters:
Name Description
maxblk Optional: Maximum number of blocks that will be read
channel Optional: Random channel to use (default=0)
Examples:
Description: This function sends a low-level abort_task_set SAS frame to the device. Clearly, this command
is intended for SAS devices only.
Parameters:
Name Description
ox_id Optional: ox_id to use with this command
Examples:
sas abort_task_set
sas abort_task_set 0
Description: This function sends a low-level clear_aca SAS frame to the device. Clearly, this command is
intended for SAS devices only.
Examples:
sas clear_aca
Description: This function sends a low-level clear_task_set SAS frame to the device. Clearly, this command
is intended for SAS devices only.
Examples:
sas clear_task_set
Examples:
sas get_pod_address
Examples:
sas get_sas_address
Description: Returns the current speed of the SAS bus. This could be 1.5, 3.0, or 6.0 Gbs.
Examples:
sas get_speed
Examples:
sas link_reset
Description: This function sends a logical unit reset SAS task to the device. It waits up to 2 seconds for a
response, but it does not verify that good status was received back.
Examples:
sas lun_reset
Description: Performs a SAS I-T Nexus reset sequence to a specific LUN. The optional LUN value has a
default for LUN 0.
Parameters:
Name Description
lun Optional: LUN
Examples:
sas nexus_reset
sas nexus_reset 1
Description: Sends NOTIFY (ENABLE SPINUP) SAS primitive to allow automatic unit start. Mode page 0,
byte 4 indicates whether this is enabled or not.
Examples:
sas notify
Description: Sends a SAS Notify (Power Loss Expected), or EPOW Notify, triple primitive.
Examples:
sas notify_epow
Description: Disables SAS Phy ports that are offline (used to isolate offline devices).
Examples:
sas phy_disable_offline
Description: Enable SAS Phy ports that are disabled (used to reconnect isolated devices).
Examples:
sas phy_enable_disabled
Parameters:
Name Description
duration pulse duration in milliseconds
Examples:
Description: Performs a SAS phy reset sequence (link reset minus sending identify).
Examples:
sas phy_reset
Description: Sets the SAS Power Management for the current device to either full, partial, or slumber. No
parameter willquery the current power management state.
Parameters:
Name Description
mode Optional: either "full", "partial", or "slumber"
Examples:
sas power_manage
sas power_manage slumber
Description: Sends a Query Asynchronous Event TMF (formerly known as Query Unit Attention).
Examples:
sas query_async_event
Examples:
sas query_task_set
Description: This performs a SAS hard reset sequence. Normally you would want to use a device rescan
instead of this command.
Examples:
sas reset
Description: Sets the SAS Address for the current device. Current device from device get index. The SAS
Address top byte is always 0x50. User specifies next seven bytes.
Parameters:
Name Description
address_byte1 1 of 7 bytes that will make up the address
address_byte2 2 of 7 bytes that will make up the address
address_byte3 3 of 7 bytes that will make up the address
address_byte4 4 of 7 bytes that will make up the address
address_byte5 5 of 7 bytes that will make up the address
address_byte6 6 of 7 bytes that will make up the address
address_byte7 7 of 7 bytes that will make up the address
Examples:
Description: Sets the speed of the SAS interface (0 = autodetect, 1 = 1.5 Gbps, 3 = 3.0 Gbps, 6 = 6.0 Gbps).
Parameters:
Name Description
speed Interface speed
Examples:
sas set_speed
Description: This command will send a COM reset to the current port and hold it for the specified time. If the
-ns switch is present, time will interpreted in nanoseconds, and if the switch is not present, time will be interpreted
in seconds. If time is not specified, a default of 10 milliseconds is assumed.
Parameters:
Name Description
-ns Optional: Treats time as nanosecond delay
time Optional: Time to hold comreset
Examples:
sata comreset
sata comreset -ns 1000
Description: This command will access to the value of D2H register on the selected AHCI port. Append sata
read with a command below to get the info. You can choose target port to obtain value by option of "-dev_idx".
Parameters:
Name Description
get Get value
Examples:
Description: This command will access to the value of D2H register on the selected AHCI port. Append sata
read with a command below to get the info. You can choose target port to obtain value by option of "-dev_idx".
Default Parm Order: count lba lba_ext status error device ?-dev_idx?
Parameters:
Name Description
count Count Register
lba LBA Register
lba_ext LBA_EXT Register
status Status Register
error Error Register
device Device Register
-dev_idx Optional: Device Index
Examples:
Description: This command will access to the value of D2H register on the selected AHCI port. Append sata
read with a command below to get the info. You can choose target port to obtain value by option of "-dev_idx".
Default Parm Order: count lba lba_ext status error device ?-dev_idx?
Parameters:
Name Description
count Count Register
lba LBA Register
lba_ext LBA_EXT Register
status Status Register
error Error Register
device Device Register
-dev_idx Optional: Device Index
Examples:
Description: This command will access to the value of D2H register on the selected AHCI port. Append sata
read with a command below to get the info. You can choose target port to obtain value by option of "-dev_idx".
Default Parm Order: count lba lba_ext status error device ?-dev_idx?
Parameters:
Name Description
count Count Register
lba LBA Register
lba_ext LBA_EXT Register
status Status Register
error Error Register
device Device Register
-dev_idx Optional: Device Index
Examples:
Description: This command will access to the value of D2H register on the selected AHCI port. Append sata
read with a command below to get the info. You can choose target port to obtain value by option of "-dev_idx".
Default Parm Order: count lba lba_ext status error device ?-dev_idx?
Parameters:
Name Description
count Count Register
lba LBA Register
lba_ext LBA_EXT Register
status Status Register
error Error Register
device Device Register
-dev_idx Optional: Device Index
Examples:
Description: This command will access to the value of D2H register on the selected AHCI port. Append sata
read with a command below to get the info. You can choose target port to obtain value by option of "-dev_idx".
Default Parm Order: count lba lba_ext status error device ?-dev_idx?
Parameters:
Name Description
count Count Register
lba LBA Register
lba_ext LBA_EXT Register
status Status Register
error Error Register
device Device Register
-dev_idx Optional: Device Index
Examples:
Description: This command will access to the value of D2H register on the selected AHCI port. Append sata
read with a command below to get the info. You can choose target port to obtain value by option of "-dev_idx".
Default Parm Order: count lba lba_ext status error device ?-dev_idx?
Parameters:
Name Description
count Count Register
lba LBA Register
lba_ext LBA_EXT Register
status Status Register
error Error Register
device Device Register
-dev_idx Optional: Device Index
Examples:
Description: This command will access to the value of D2H register on the selected AHCI port. Append sata
read with a command below to get the info. You can choose target port to obtain value by option of "-dev_idx".
Default Parm Order: count lba lba_ext status error device ?-dev_idx?
Parameters:
Name Description
count Count Register
lba LBA Register
lba_ext LBA_EXT Register
status Status Register
error Error Register
device Device Register
-dev_idx Optional: Device Index
Examples:
Description: This command will read and display info on the desired part of selected(or targetted) ata device.
Append sata get with a command below to get the info.
Parameters:
Name Description
status Status Register
error Error Register
control Control Register
active Active Register
-dev_idx Optional: Device Index
Examples:
Description: This command will read and display info on the desired part of selected(or targetted) ata device.
Append sata get with a command below to get the info.
Parameters:
Name Description
status Status Register
error Error Register
control Control Register
active Active Register
-dev_idx Optional: Device Index
Examples:
Description: This command will read and display info on the desired part of selected(or targetted) ata device.
Append sata get with a command below to get the info.
Parameters:
Name Description
status Status Register
error Error Register
control Control Register
active Active Register
-dev_idx Optional: Device Index
Examples:
Description: This command will read and display info on the desired part of selected(or targetted) ata device.
Append sata get with a command below to get the info.
Parameters:
Name Description
status Status Register
error Error Register
control Control Register
active Active Register
-dev_idx Optional: Device Index
Examples:
Description: This command will read and display info on the desired part of selected(or targetted) ata device.
Append sata get with a command below to get the info.
Parameters:
Name Description
status Status Register
error Error Register
control Control Register
active Active Register
-dev_idx Optional: Device Index
Examples:
Description: This command will return whether the driver should automatically choose a free tag for NCQ
commands.
Examples:
sata get_auto_tags
Description: This command will return whether the driver should automatically clear a NCQ command error.
Examples:
sata get_clear_ncq_tags
Description: This command will return whether the driver will wait to issue non-NCQ commands until all
issued NCQ commands finish.
Examples:
sata get_cmd_fencing
Description: This command will return the information that which port is connected the test drives. Each bit
corresponds to a port number, where bit 0 corresponds to command port 0. For example, if a drive is connected
to port 0, the value will be 1(2 0̂), if a drive is connected to port 1, the value will be 2(21̂). If both of port 1 and 2
are connected, the value will be 3(= 20̂ | 21̂).
Parameters:
Name Description
ahci_id Optional: Target ahci id. It should be 0 3, The default value is 0
Examples:
sata get_connected_drive_mask 0
Description: This command will return whether the driver will wait to issue new NCQ commands until all
issued NCQ commands are started.
Examples:
sata get_ncq_sequencing
Description: This command will return whether the driver will assign a new command tag (0) or use the UIL
command tag (1).
Examples:
sata get_preserve_tags
Description: Gets selected drive’s port number. When the command is not selected or drives are not found it
will return -1.
Examples:
sata get_selected_port_num
Description: This command will return PxSIG(Port context signature) value. PxSIG contains value of first
count register and LBA register value infirst D2H immediately after start drive. The 0 7 bit offset is count register,
and 8 31 bit offset is the LBA value.
Examples:
sata get_signature
Examples:
sata get_speed
Description: This command will return TFD(Task File Data) value when spin up. TFD contains value of
error and status registers.The 0x0 - 0x7 bits are status value, 0x8-0xF bits are error value.if the drive has not spun
up, it will return 0x7F(Initial value of TFD).
Examples:
sata get_staritng_tfd
Description: Disables SATA Phy ports they are offline (used to isolate offline devices).
Examples:
sata phy_disable_offline
Description: Enable SATA Phy ports that are disabled (used to reconnect isolated devices).
Examples:
sata phy_enable_disabled
D.275 sata pm
Command Name(s): sata pm
Description: This command is used to changed the interface sleep state sata pm active . Return interface to
active state sata pm partial . Set interface to partial state sata pm slumber . Set interface to slumber state.
Parameters:
Name Description
mode The Mode can be "active", "partial", or "slumber"
Examples:
sata pm active
sata pm slumber
Description: This Command is used to change the hba’s aggressive sleep state sata pm aggressive off . Turn
off HBA aggressive PM sata pm aggressive partial . Turn on HBA aggressive PM to the partial state sata pm
aggressive slumber . Turn on HBA aggressive PM to the slumber state.
Parameters:
Name Description
mode The Mode can be "off", "partial", or "slumber"
Examples:
Description: This command will read and display the port registers (Status, Error, and Sata Control).
Parameters:
Name Description
-dev_idx Optional: Device Index
Examples:
Description: This command will set whether the driver should automatically choose a free tag for NCQ
commands.
Parameters:
Name Description
state Can be "on", "off", 0, 1
Examples:
sata set_auto_tags on
Description: This command will set whether the driver should automatically drop the queue and issue a
read_log_ext to log 0x10 when an error occurs in NCQ.
Parameters:
Name Description
state 1 or on to enable, 0 or off to disable
Examples:
sata set_clear_ncq_tags on
Description: This command will set whether the driver will wait to issue non-NCQ commands until all issued
NCQ commands finish.
Parameters:
Name Description
state 1 or on to enable, 0 or off to disable
Examples:
sata set_cmd_fencing 1
Description: This command will set whether the driver will wait to issue new NCQ commands until all issued
NCQ commands are started.
Parameters:
Name Description
state 1 or on to enable, 0 or off to disable
Examples:
sata set_ncq_sequencing 1
Description: This command will set whether the driver will assign a new command tag (0) or use the UIL
command tag (1).
Parameters:
Name Description
state 1 or on to enable, 0 or off to disable
Examples:
sata set_preserve_tags 1
Description: input speed rate by speed code.speed codes are as follows 0 : No speed negotiation restriction 1
: 1.5Gbps 2 : 3Gbps 3 : 6Gbps after do this command, you should do "COMRESET".
Parameters:
Name Description
speed Interface speed
speed Interface speed
Examples:
sata set_speed 2
Description: This command will issue a soft reset by toggling the SRST bit in the control register.
Examples:
sata srst
sata soft_reset
Description: This command will issue a soft reset by toggling the SRST bit in the control register.
Examples:
sata srst
sata soft_reset
Description: This function sends a low-level abort SCSI message to the device. Clearly, this command is
intended for SCSI devices only. See also "scsi abort_tag".
Examples:
scsi abort
Description: This function sends a low-level abort tag SCSI message to the device. Clearly, this command is
intended for SCSI devices only. See also "scsi abort".
Parameters:
Name Description
tagID ID tag to abort (0x00 - 0xFF)
Examples:
Description: This command clears all queued tasks from the drive.
Examples:
scsi clear_queue
Description: Sends a SCSI device reset message to the current target. See also "device rescan", "scsi reset".
Examples:
scsi device_reset
Description: This function changes the IDENTIFY message the initiator uses after a SCSI SELECT. Options
include 0x00 (no identify sent), 0x80 (no disconnects allowed) and 0xC0 (disconnects are allowed). Attempting
to use any other mode will return an error.
Parameters:
Name Description
mode Options are: 0x00, 0x80, 0xC0
Examples:
scsi device_reset
Description: This function changes when PPR (Parallel Protocol Request) negotiations will occur. Options
include all (every command), check (after next check status), none (disallow), once (after next command only),
required (if context requires), and target (if initiated by target). Attempting to use any other mode will return an
error See also "scsi ppr_mode target".
Parameters:
Name Description
mode Options are: all/check/none/once/required/target
Examples:
scsi ppr_mode
Description: This command sets the desired Parallel Protocol Request (PPR) parameters to use in a ll sub-
sequent PPR negotiations. It will also force a PPR negotiation to occur on the following selection, either I/O or
microprogramming functions.
Parameters:
Name Description
offset The offset for synchronous negotiations
period The period for synchronous negotiations
width The width, 1 or 2
ppr_parms Parallel protocol request parameters
Examples:
scsi ppr_mode_parms 62 9 2 6
Description: This function preforms a SCSI bus reset. See also "device rescan", "scsi device_reset".
Examples:
scsi reset
Description: This function changes when synchronous negotiations will occur. Options include all (every
command), check (after next check status), none (disallow), once (after next command only), required (if context
requires), and target (if initiated by target). Attempting to use any other mode will return an error.
Parameters:
Name Description
mode Options are: all/check/none/once/required/target
Examples:
Description: This command will set the desired synchronous period and offset for use in all subsequent
synchronous negotiations. It will also force a synchronous data transfer request negotiation to occur on the
following selection, either I/O or microprogramming functions.
Parameters:
Name Description
offset The offset for synchronous negotiations
period The period for synchronous negotiations
Examples:
scsi sync_mode_parms 16 12
Description: This function changes when width negotiations will occur. Options include all (every com-
mand), check (after next check status), none (disallow), once (after next command only), required (if context
requires), and target (if initiated by target). Attempting to use any other mode will return an error.
Parameters:
Name Description
mode Options are: all/check/none/once/required/target
Examples:
Description: This command will set the desired data width for use in all subsequent wide negotiations. It
will also force a wide data transfer request negotiation to occur on the following selection, either I/O or micropro-
gramming functions. A value of 2 for the width specifies that there should be no forced negotiation.
Parameters:
Name Description
width Options are 1 or 2
Examples:
scsi wide_mode_parms 2
Description: This function returns what IU type is currently being used as the default when sending CDBs to
a SOP device.
Examples:
Description: This function sets the default wrapper for CDBs. Any CDBs issued to a SOP device will be sent
as this IU type. Valid types are "limited_command", "command", and "extended_command". "limited_command"
is the default type. The numerical value of the IU type is also accepted.
Parameters:
Name Description
type The IU type to use as the new default
Examples:
Examples:
Description: Returns the current state of the transport_cdb descriptor format flag.
Examples:
Examples:
Examples:
Description: Use this command to return the APT protocol used during a transport command.Either "DMA"
or "PIO" will be returned.
Examples:
Description: Use this command to turn on the transport_cdb flag for every CDB issued.
Parameters:
Name Description
always_on Enable transport cdb with every command
Examples:
Description: The sns size of the 0xC3 option 3 command defaults to 32 bytes and fixed format. Enable
descriptor sns format with this command.
Parameters:
Name Description
desc_format Enable desc_format
Examples:
Description: When padding flag is set, this command defines the padding boundary. Default is 512. The
send/recv buffer will be padded, as will the amount of bytes sent/received.
Parameters:
Name Description
pad_boundary Set padding boundary
Examples:
Description: Enabling this flag will pad every transport_cdb command to the next 512 bytes. The send/recv
buffer will by padded, as will the amount of bytes sent/received. This functionality is necessary for the Audacious
chip set.
Parameters:
Name Description
padding Enable padding of DMA cmds
Examples:
Description: Use this command to set the APT protocol used during a transport command. Users can give a
value of "DMA" or "PIO".
Parameters:
Name Description
protocol DMA or PIO
Examples:
Description: This function returns the number of loaded UIL drivers. For more details about the drivers, uil
list can be used. Also see "uil list".
Examples:
uil count
Description: This function is used to create a new driver instance. If the creation is successful, the driver is
added to the uil list and the uil information is returned. Any parameters given to this function after the driver name
are passed into the driver initialization routine. The initialization parameters vary, some drivers may have none.
Parameters supported by some drivers include "-loglevel=l", "-noscan", and "-scsiid=h:c:t:l" Creating multiple
instances of a driver works for most drivers. Also see "uil info", "uil list".
Parameters:
Name Description
driver_name Name of driver to create
driver_parms Optional: Driver parameters
Examples:
Description: This function returns a 1 if autosense is currently active. Zero is returned otherwise. If the
current driver does not support the disabling of autosense, 1 is always returned. Also see "uil set autosense".
Examples:
Description: This function returns the memory allocation for the current driver’s internal data buffer.
Examples:
Description: This function returns the callback mapped to a specific uil command. Callbacks are code seg-
ments that are automatically called whenever a command is executed. Currently supported callbacks are create,
remove and "set index". Also see "uil set callback".
Examples:
Description: This function returns the callback mapped to a specific uil command. Callbacks are code seg-
ments that are automatically called whenever a command is executed. Currently supported callbacks are create,
remove and "set index". Also see "uil set callback".
Examples:
Description: This function returns the callback mapped to a specific uil command. Callbacks are code seg-
ments that are automatically called whenever a command is executed. Currently supported callbacks are create,
remove and "set index". Also see "uil set callback".
Examples:
Description: This function dumps to stdout or to a file the error information returned by ERR_STR_MESSAGE
errInfo call.
Parameters:
Name Description
outputfile Optional: File to dump error info to
Examples:
No Examples given
Description: This function returns the filter flag of the current driver, currently only in the ASPI driver.
Examples:
Description: This function returns the index of the currently active UIL driver. The uil info command can
be used in place of this one if more detailed information is required. If the optional ’uil_driver’ is provided, this
function returns the index of ’uil_driver’ or -1 if not loaded. Also see "uil count", "uil info", "uil list", "uil name",
"uil set index".
Parameters:
Name Description
uil_driver Optional: The UIL driver to get the index of
Examples:
Examples:
Description: This function gets the mpio enabled setting for this driver.
Examples:
Description: This function gets the mpio data path select setting for this driver.
Examples:
Description: This function gets the mpio task management path select setting for this driver.
Examples:
Description: This function gets the interface speed for this driver. It will return an interface type as well as
the speed that it is running at.
Examples:
No Examples given
Description: This function gets the default timeout value for all devices. This default timeout value is the
timeout assigned to a device upon a device rescan.
Examples:
Description: This function gets the interface version for this driver.
Parameters:
Name Description
-uil Optional: Get the UIL version instead of the core tcluil library.
Examples:
No Examples given
Description: This function returns a brief description about the current uil driver. Information returned
includes the index of the current driver, the name of the current driver, the version of the driver and the number of
devices that the driver currently has access to. Also see "uil list".
Parameters:
Name Description
uilIndex Optional: name of UIL index
Examples:
uil info
Description: This function returns a list of the currently installed UIL drivers. Each entry shows the index,
name, and version of the driver. The number of devices connected to each driver is also reported. Also see "uil
info".
Examples:
uil list
Description: This function is used to load a TCL "C" extension that needs access to the UIL. These types
of extensions generally extend the TCL command set with high performance macro functions (such as CSO
operations). One example of this command is used to add the serial commands to TCL. Also see "uil create".
Parameters:
Name Description
driver_name Name of driver to load
Examples:
Description: This function can be used to send special, non standard messages to a driver. Potential applica-
tions for this including the setting and or checking of internal driver settings. This command is provided as a path
to non standard driver features.
Parameters:
Name Description
message String message to send to uil
uil_index Optional: UIL index to send message to
Examples:
Description: This function returns the name of the current driver or specified uil driver. This function is
useful for determining which driver is currently running, for conditional code. It is also useful for determining
what drivers are available. For maximum versatility, use this feature only when necessary. Also see "uil info".
Parameters:
Name Description
index Optional: Name of UIL index
Examples:
Description: This function uninitializes a driver and removes it from the uil list. Also see "uil list".
Parameters:
Name Description
index Index of UIL to remove
Examples:
Description: This function is used to activate/deactivate "autosense" for the current uil driver. When autosense
is active (the default setting) the driver will automatically aquire / return sense information when a check condition
occurs. Note that some uil drivers operate in autosense mode only and do not allow autosense to be deactivated.
Also see "uil get autosense".
Parameters:
Name Description
enable Optional: 0 for off, 1 for on
Examples:
Description: This function is used to set a callback for a particular uil command. Each time the command is
called, this callback is executed as code. Currently supported callbacks are "create", "remove", and "set index".
Each of these callbacks correspond to the associated uil command. The variable uil_index is set to provide further
information within the callback. Also note that it is generally a good idea to make sure a callback is unset before
setting it yourself. To remove a callback, set it to "". Also see "uil get callback".
Parameters:
Name Description
callback Code to execute
Examples:
Description: This function is used to set a callback for a particular uil command. Each time the command is
called, this callback is executed as code. Currently supported callbacks are "create", "remove", and "set index".
Each of these callbacks correspond to the associated uil command. The variable uil_index is set to provide further
information within the callback. Also note that it is generally a good idea to make sure a callback is unset before
setting it yourself. To remove a callback, set it to "". Also see "uil get callback".
Parameters:
Name Description
callback Code to execute
Examples:
Description: This function is used to set a callback for a particular uil command. Each time the command is
called, this callback is executed as code. Currently supported callbacks are "create", "remove", and "set index".
Each of these callbacks correspond to the associated uil command. The variable uil_index is set to provide further
information within the callback. Also note that it is generally a good idea to make sure a callback is unset before
setting it yourself. To remove a callback, set it to "". Also see "uil get callback".
Parameters:
Name Description
callback Code to execute
Examples:
Description: This function sets the current uil driver index. Using this command will retarget subsequent
CDB/ATA commands to the specified driver. Also see "uil count", "uil get index", "uil info", "uil list".
Parameters:
Name Description
index UIL index
Examples:
Description: This function sets the current loglevel for the current UIL. Higher loglevels will return more
verbosity than lower loglevels. This verbosity can be used for anything from getting more information about
executing commands to debugging the drivers themselves. Level 10 is considered to request a maximum level of
verbosity. Note that in some environments, namely Windows, Niagara needs to be run from within a command
prompt to see the outputted messages.
Parameters:
Name Description
level Logging level
Examples:
Description: This function sets the mpio enabled setting for this driver.
Parameters:
Name Description
enabled 0 for disabled, 1 for enabled
Examples:
Description: This function sets the mpio data path select setting for this driver.
Parameters:
Name Description
path_select round_robin, min_queue_depth, none, path_0, path_1, path_2, path_3
path_select round_robin, min_queue_depth, none, path_0, path_1, path_2, path_3
Examples:
Description: This function sets the mpio task management path select setting for this driver.
Parameters:
Name Description
path_select round_robin, min_queue_depth, none, path_0, path_1, path_2, path_3
path_select round_robin, min_queue_depth, none, path_0, path_1, path_2, path_3
Examples:
Description: This function sets the interface speed for this driver. Options for ?interface? are scsi, fcal, or
serial.
Parameters:
Name Description
interface Interface type
speed Data xfer speed
Examples:
No Examples given
Description: This function sets the command timeout value for all devices. Note that different UIL drivers
support different units for timeout values, not all allow timing to millisecond accuracy. Therefore after setting a
timeout, the actual timeout set is returned.
Parameters:
Name Description
time Timeout in milliseconds
-override_persistent Optional: Temporarily override the persistent timeouts set for each command. Use
0 to disable.
-override_persistent Optional: Temporarily override the persistent timeouts set for each command. Use
0 to disable.
Examples:
D.344 validate_commands
Command Name(s): validate_commands
Description: If you give a file name it will check validation of target command definition file, otherwise there
are no command definition files, It will check commands which are already loaded in TCL interpreter.
Parameters:
Name Description
filename Optional: Filename to check validation
Examples:
validate_commands $::env(NiagaraPath)/commands/cdb_commands.txt
Serial Commands
E.1 get_serial_list
Command Name(s): get_serial_list
Description: This function returns a list of available serial commands. The function is intended to be used by
TCL programs (such as documentation generators) that need to know the current set of available commands.
See Also: get_cdb_list (page ??), get_ata_list (page ??), get_cil_list (page 265)
E.2 sabortCDB
Command Name(s): sabortCDB
Description: This function will send CDB abort command, aborting the CDB command that is currently in
progress. It is used as a last resort when communication sync is lost and cannot be regained.
E.3 scdb
Command Name(s): scdb
Description: This function is used to send a UART2 cdb frame to the drive. The first ?length? bytes in the
send buffer are used as the cdb to send.
Parameters:
Name Description
length Optional: Length of cdb to send
E.4 sclose
Command Name(s): sindex
Description: Close the serial port. Useful to allow external programs access to the serial port. Usage: sclose.
E.5 sdelay
Command Name(s): sdelay
Description: This function is used to set the serial comminication timing delay. Slower machines may need
to increase the delay to keep comminication in sync. The delay is set in micro seconds.
Parameters:
Name Description
delay Length of delay in micro seconds
E.6 secho
Command Name(s): secho
Description: This function requests an echo response from the serial device. The response contains the serial
number of the drive. This function is useful to asserting a good serial connection with the drive.
E.7 sget_speed
Command Name(s): sget_speed
Description: This function requests a Get UART Parameters response from the serial device. This function
will parse out the line speed from the return information.
E.8 sindex
Command Name(s): sindex
Parameters:
Name Description
index Optional: Optional: The device index you wish to select.
E.9 sio
Command Name(s): sio
Description: This command allows low level UART communication on a byte-by-byte basis. The send
length and recieve length are specified; then, ?send_length? number of bytes are sent from the send buffer and
?recv_length? number of bytes are read into the recieve buffer.
Parameters:
Name Description
send_length Optional: number of bytes to send through UART
recv_length Optional: number of bytes to recieve through UART
E.10 slip
Command Name(s): slip
Description: This function causes the drive to request LIP if it is a Fibre Channel drive. The drive will send
a response block to the host indicating the command is acknowledged and then call the appropriate function to
request LIP.
Parameters:
Name Description
LIP type Optional: type of LIP requested (F7 or F8)
E.11 squery
Command Name(s): squery
Description: This function will send a UART query command to the drive. This command will be used by
the host when it is polling the drive to see if it is ready for the next command.
E.12 sread
Command Name(s): sread
Description: This function returns a portion of memory from the current serial device. Information is also
read into the current receive buffer where it can be manipulated further by "buff" commands. Note that, unlike
Serial Debugger, you need to append 0x to all parameters you wish to be in hex.
Default Parm Order: address length ?-dw? ?-dd? ?-qw? ?-transport_cdb? ?-show_status?
Parameters:
Name Description
address Address in memory to read
length Number of bytes to read
-dw Optional: Display data in 16-bit word format
-dd Optional: Display data in 32-bit double word format
-qw Optional: Display data in 64-bit quad word format
-transport_cdb Optional: If "-transport_cdb 1", send command as a 0xC3 transport command
-transport_cdb Optional: If "-transport_cdb 1", send command as a 0xC3 transport command
-show_status Optional: To skip status output append "-show_status 0" to the command
-show_status Optional: To skip status output append "-show_status 0" to the command
See Also: buff dump (page 203), buff save (page 221), buff format (page 213), swrite
(page 350)
E.13 sreadsp
Command Name(s): sreadsp
Description: This function returns the stack pointer location for the current device.
E.14 srescan
Command Name(s): srescan
Description: Requests that the current suil performs a device rescan. Note: This skips any device rescan
binds.
E.15 sreset
Command Name(s): sreset
Description: The command initiates a reset on the drive. The drive will send a response block to the host
indicating that the command is acknowledged and then call the appropriate reset function.
Parameters:
Name Description
command flags Optional: command flags that specify the type of reset
drive type Optional: drive type byte
E.16 sset_speed
Command Name(s): sset_speed
Description: This function requests a Get UART Parameters response from the serial device, it then modifies
the line speed section, sends a Set UART Parameters request, and changes the host speed to match the new speed.
Parameters:
Name Description
coded_speed The coded speed value. See UART3 Specification.
-quick_scan Optional: quick scan the bus.
E.17 sspeed
Command Name(s): sspeed
Description: Get/Set the serial speed for suil in bps. It is valid for both serail/serial3 drivers. Usage sspeed
?speed?.
Parameters:
Name Description
index Optional: The speed in bits per second (bps)
E.18 sstatus
Command Name(s): sstatus
E.19 suart2
Command Name(s): suart2
Description: This function is used to set the serial communication link to UART2.
E.20 suart3
Command Name(s): suart3
Description: This function is used to set the serial communication link to UART3. The speed value deter-
mines the line speed that will be used in the new mode. See the UART protocol definition for values.
Parameters:
Name Description
speed UART speed setting
E.21 suil
Command Name(s): suil
Description: This command sets the UIL target index that serial commands (sread, etc...) will be directed at.
Serial commands have an independent uil setting for convenience purposes. Note that if you are sending CDBs
through the serial port, you should use "uil set index" to set your driver.
Parameters:
Name Description
index Optional: UIL Index (without index, suil returns the current index)
E.22 sversion
Command Name(s): sversion
Description: This function requests that the drive report back to the host the version of the UART interface
it supports. A drive that supports the UART 2 interface will return the Version response block with the version
field set to at least 2, while a drive that does not will either return an error on the transmission (legacy versions) or
return the response block with a different value (future versions). UART 3 devices will return the response block
with a value of at least 5.
E.23 swrite
Command Name(s): swrite
Description: This function is used to write data to memory in the drive. Data can be entered directly as part
of the swrite command or the current send buffer can be used (if no data is specified, the send buffer is used). All
entered parameters (including data) must be preceeded by a 0x if the data is in hex format. The "buff" commands
can be used to assist in pre-buffer setup (such as loading a buffer with contents from a file).
Parameters:
Name Description
address Address in memory to read
length Number of bytes to read
-dw Optional: Command line data is in 16-bit word format
-dd Optional: Command line data is in 32-bit double word format
hex data Optional: One or more space separated bytes of write data
See Also: buff load (page 217), buff fill (page ??), sread (page 347)
E.24 sxfer
Command Name(s): sxfer
Description: This command sends a UART2 data xfer command block to the drive. The type of data xfer is
defined by the parameters used.
Default Parm Order: ?Transfer Bit? ?Status Bit? ?Send Length? ?Recv Length?
Parameters:
Name Description
Transfer Bit Optional: direction of data transfer (0 inbound, 1 outbound)
Status Bit Optional: 1 indicates transfer is for reporting status
Send Length Optional: number of bytes to send
Recv Length Optional: number of bytes to recv
device get callback unlock, 41, 227 device set callback rescan, 43, 248
device get index, 41, 227 device set callback set index|hyperpage, 43, 249
device get interface, 41, 228 device set callback unlock, 43, 249
device get last_cmd, 41, 228 device set index, 43, 250
device get last_cmd_time, 41, 228 device set markersize, 43, 251
device get read_xfer, 41, 229 device set maxlba, 43, 251
device get receive_count, 41, 229 device set phy_blocksize, 43, 251
device get reserved, 41, 229 device set project, 43, 252
device get send_count, 41, 230 device set protocol, 43, 252
device get timeout, 41, 230 device set read_xfer, 43, 253
device get xfer_mode, 41, 231 device set reserved, 43, 253
device hbareset, 41, 231 device set serial, 43, 254
device info, 41, 231 device set timeout, 43, 254
device info blocksize, 41, 232 device set xfer_mode, 43, 255
device info channel, 41, 232 device unlock, 43, 255
device info codelevel, 41, 233 device unlock serial, 43, 256
device info host, 41, 233 disable_niagara_log, 43, 256
device info inq_pages, 41, 234 dsi, 250
device info lun, 41, 234
device info markersize, 41, 235 e6, 33, 121
device info maxlba, 41, 235 enable_niagara_log, 43, 256
device info mdata_inline, 41, 235 encode, 44, 257
device info mdata_size, 42, 236 eparse, 44, 257
device info name, 42, 236 err_str, 44, 257
device info peripheral, 42, 237 esource, 44, 258
device info phy_blocksize, 42, 237 fcal abort_task_set, 44, 258
device info productid, 42, 238 fcal abts, 44, 259
device info project, 42, 238 fcal clear_aca, 44, 259
device info protection, 42, 239 fcal clear_task_set, 44, 259
device info protection_location, 42, 239 fcal lip_reset, 44, 259
device info protection_type, 42, 239 fcal port_login, 44, 260
device info protocol, 42, 240 fcal process_login, 44, 260
device info rto, 42, 240 fcal reset, 44, 260
device info scsiid, 42, 241 fcal target_reset, 44, 261
device info serial, 42, 241 fcal term_task, 44, 261
device info serial_asic_version, 42, 242 feedback asynccqe, 44, 261
device info target, 42, 242 feedback color, 44, 262
device info vendor, 42, 242 feedback default, 44, 262
device info wwid, 42, 243 feedback maxlen, 44, 262
device islocked, 42, 243 feedback min, 44, 263
device list, 42, 244 feedback pop, 44, 263
device lock, 42, 244 feedback push, 44, 263
device lock serial, 42, 245 feedback showatafis, 44, 264
device remove, 42, 245 feedback showcdb, 44, 264
device rescan, 43, 246 feedback showcqe, 45, 264
device set allow_set_when_locked, 43, 246 finish_zone, 33, 122
device set blocksize, 43, 246 fmt, 123
device set callback create, 43, 247 format_unit, 33, 123
device set callback lock, 43, 247
device set callback remove, 43, 248 get_cil_list, 45, 265
w12, 183
w16, 184
w32, 184
w6, 185
wa16, 189
wa32, 190
wr10, 182
wr12, 183
wr16, 184
wr32, 184
wr6, 185
wra16, 189
wra32, 190
write10, 37, 182
write12, 37, 183
write16, 37, 184
write32, 37, 184
write6, 37, 185
write_and_verify, 37, 186
write_and_verify12, 37, 186
write_and_verify16, 37, 187
write_and_verify32, 37, 188
write_atomic16, 37, 189
write_atomic32, 37, 190
write_buffer, 37, 191
write_buffer32, 38, 192
write_long, 38, 193
write_long16, 38, 194
write_same, 38, 195
write_same16, 38, 196
write_same32, 38, 197
writebuf, 191
writebuf32, 192
wrlong, 193
wrlong16, 194
wrs, 195
wrs16, 196
wrs32, 197
wrv, 186
wrv12, 186
wrv16, 187
wrv32, 188