Softpanorama
(slightly skeptical) Open Source Software Educational Society

May the source be with you, but remember the KISS principle ;-)

Google   


PROM Device Tree (Full Device Pathnames)

OpenBoot deals directly with the hardware devices in the system. Each device has a unique name that represents both the type of device and the location of that device in the device tree. The OpenBoot firmware builds a device tree for all devices from information gathered at the POST. Sun uses the device tree to organize devices that are attached to the system. The device tree is loaded into memory, to be used by the kernel during boot to identify all configured devices. The paths built in the device tree by OpenBoot vary, depending on the type of system and its device configuration. The following example shows a full device pathname for an older Sun system with SBus architecture, such as a SPARCstation 20:

/sbus@1f,0/esp@0,40000/sd@3,0:a

NOTE

The Device Tree Versus Device Pathname The terms device tree and device pathname are often interchanged, and you'll see both used. They both mean the same thing.

The following example shows the device tree for an internal disk on a peripheral component interconnect (PCI) bus system such as an Ultra 5:

/pci@1f,0/pci@1,1/ide@3/disk

Typically, the OBP uses disk and cdrom for the boot disk and CD-ROM drive.

The following example shows the disk device on an Ultra system with a PCI-SCSI bus:

/pci@1f,0/pci@1/isptwo@4/sd@3,0

A device tree is a series of node names separated by slashes (/).The top of the device tree is the root device node. Following the root device node, and separated by a leading slash /, is a bus nexus node. Connected to a bus nexus node is a leaf node, which is typically a controller for the attached device. Each device pathname has this form:

driver-name@unit-address:device-arguments

The components of the device pathname are described in Table 3.3.

Table 3.3 - Device Pathname Parameters

Parameter Description
driver-name This is the root device node, which is a human-readable string that consists of 1 to 31 letters, digits, and the following punctuation characters:

, (comma)

. (period)

_ (underscore)

+ (plus sign)

(minus sign)

Uppercase and lowercase characters are distinct from one another. In some cases, the driver name includes the name of the device's manufacturer and the device's model name, separated by a comma. Typically, the manufacturer's uppercase, publicly listed stock symbol is used as the manufacturer's name (for example, SUNW,hme0). For built-in devices, the manufacturer's name is usually omitted (for example, sbus or pci).

@ must precede the address parameter; it serves as a separator between the driver name and unit address.

unit-address A text string that represents the physical address of the device in its parent's address space. The exact meaning of a particular address depends on the bus to which the device is attached. In this example,

/sbus@3,0/SUNW,fas@3,0/sd@0,0

sbus@3,0 represents the I/O board in slot 1, located on the back of the system, and SUNW,fas@3,0 is the onboard fast/wide SCSI controller of the same board.

The following are common device driver names:

fas—Fast/wide SCSI controller.

hme—Fast (10/100Mbps) Ethernet.

isp—Differential SCSI controllers and the SunSwift card.

glm—UltraSCSI controllers.

scsi—SCSI devices.

sf—SCSI-compliant nexus driver that supports the Fibre Channel Protocol for SCSI on Private Fibre Channel Arbitrated Loops (FC-ALs).

soc—Serial optical controller (SOC) device driver.

socal—The Fibre Channel host bus adapter, which is an SBus card that implements two full-duplex Fibre Channel interfaces. Each Fibre Channel interface can connect to an FC-AL.

sd@0,0 is the SCSI disk (sd) set to target id 0. (In this case, it is an internal disk because only internal disks should be controlled by the onboard SCSI controller of the I/O board in slot 1.)

device-arguments A text string whose format depends on the particular device. device-arguments can be used to pass additional information to the device's software. In this example:

/pci@1f,0/pci@1,1/ide@3/atapicd@2,0:f

the argument for the disk device is f. The software driver for this device interprets its argument as a disk partition, so the device pathname refers to partition f on a CD-ROM.


 

You use the OpenBoot command show-devs to obtain information about the device tree and to display device pathnames. This command displays all the devices known to the system directly beneath a given device in the device hierarchy. show-devs used by itself shows the entire device tree. The syntax is as follows:

ok show-devs

The system outputs the entire device tree, as follows:

/SUNW,UltraSPARC-IIi@0,0
/pci@1f,0
/virtual-memory
/memory@0,10000000
/aliases
/options
/openprom
/chosen
/packages
/pci@1f,0/pci@1
/pci@1f,0/pci@1,1
/pci@1f,0/pci@1/pci@1
/pci@1f,0/pci@1/pci@1/SUNW,qfe@3,1
/pci@1f,0/pci@1/pci@1/pci108e,1000@3
/pci@1f,0/pci@1/pci@1/SUNW,qfe@2,1
/pci@1f,0/pci@1/pci@1/pci108e,1000@2
/pci@1f,0/pci@1/pci@1/SUNW,qfe@1,1
/pci@1f,0/pci@1/pci@1/pci108e,1000@1
/pci@1f,0/pci@1/pci@1/SUNW,qfe@0,1
/pci@1f,0/pci@1/pci@1/pci108e,1000@0
/pci@1f,0/pci@1,1/ide@3
/pci@1f,0/pci@1,1/SUNW,m64B@2

Commands that are used to examine the device tree:

Command Description
.properties Displays the names and values of the current node's properties.
dev <device-path> Chooses the specified device node and makes it the current node.
dev <node-name> Searches for a node with the specified name in the subtree below the current node and chooses the first such node found.
dev .. Chooses the device node that is the parent of the current node.
dev / Chooses the root machine node.
device-end Leaves the device tree.
<device-path> find-device Chooses the specified device node, similar to dev.
ls Displays the names of the current node's children.
pwd Displays the device pathname that names the current node.
see <wordname> Decompiles the specified word.
show-devs <device-path> Displays all the devices known to the system directly beneath a given device in the device hierarchy. show-devs used by itself shows the entire device tree.
words Displays the names of the current node's methods.
<device-path>" select-dev Selects the specified device and makes it the active node.

 

You can examine the device path from a Unix shell prompt by typing the following:

prtconf –vp

OpenBoot Device Aliases

Device pathnames can be long and complex. Device aliases, like Unix aliases, allow you to substitute a short name for a long name. An alias represents an entire device pathname, not a component of it. For example, the alias disk0 might represent the following device pathname:

/sbus@1,f8000000/esp@0,40000/sd@3,0:a

OpenBoot provides the predefined device aliases listed in Table 3.5 for commonly used devices, so you rarely need to type a full device pathname. Be aware, however, that device aliases and pathnames can vary on each platform. The device aliases shown in Table 3.5 are from a Sun Ultra 5 system.

Predefined Device Aliases

Alias Device Pathname
disk /pci@1f,0/pci@1,1/ide@3/disk@0,0
disk0 /pci@1f,0/pci@1,1/ide@3/disk@0,0
disk1 /pci@1f,0/pci@1,1/ide@3/disk@1,0
disk2 /pci@1f,0/pci@1,1/ide@3/disk@2,0
disk3 /pci@1f,0/pci@1,1/ide@3/disk@3,0
cdrom /pci@1f,0/pci@1,1/ide@3/cdrom@2,0:f

 

If you add disk drives or change the target of the startup drive, you might need to modify these device aliases. Table 3.6 describes the devalias commands, which are used to examine, create, and change OpenBoot aliases.

NOTE

New Names Overwrite Old Names If an alias with the same name already exists, the new value overwrites the old.

Table 3.6 - The devalias Commands

Command Description
devalias Displays all current device aliases
devalias <alias> Displays the device pathname that corresponds to alias
devalias_alias <device-path> Defines an alias that represents device-path

 

The following example creates a device alias named disk3, which represents an Integrated Drive Electronics (IDE) disk with a target ID of 3 on an Ultra 5 system:

devalias disk3 /pci@1f,0/pci@1,1/ide@3/disk@3,0

To confirm the alias, you type devalias, as follows:

ok devalias

The system responds by printing all the aliases, like this:

screen          /pci@1f,0/pci@1,1/SUNW,m64B@2

net           /pci@1f,0/pci@1,1/network@1,1

cdrom          /pci@1f,0/pci@1,1/ide@3/cdrom@2,0:f

disk           /pci@1f,0/pci@1,1/ide@3/disk@0,0

disk3          /pci@1f,0/pci@1,1/ide@3/disk@3,0

disk2          /pci@1f,0/pci@1,1/ide@3/disk@2,0

disk1          /pci@1f,0/pci@1,1/ide@3/disk@1,0

disk0          /pci@1f,0/pci@1,1/ide@3/disk@0,0

ide           /pci@1f,0/pci@1,1/ide@3

floppy          /pci@1f,0/pci@1,1/ebus@1/fdthree

ttyb           /pci@1f,0/pci@1,1/ebus@1/se:b

ttya           /pci@1f,0/pci@1,1/ebus@1/se:a

keyboard!        /pci@1f,0/pci@1,1/ebus@1/su@14,3083f8:forcemode

keyboard         /pci@1f,0/pci@1,1/ebus@1/su@14,3083f8

mouse          /pci@1f,0/pci@1,1/ebus@1/su@14,3062f8

name           aliases

You can also view device aliases from a shell prompt by using the prtconf –vp command.

User-defined aliases are lost after a system reset or power cycle unless you create a permanent alias. If you want to create permanent aliases, you can either manually store the devalias command in a portion of NVRAM called NVRAMRC or you can use the nvalias and nvunalias commands. The following section describes how to configure permanent settings in the NVRAM on a Sun system.

OpenBoot NVRAM

System configuration variables are stored in system NVRAM. These OpenBoot variables determine the startup machine configuration and related communication characteristics. If you modify the values of the configuration variables, any changes you make remain in effect even after a power cycle. Configuration variables should be adjusted cautiously, however, because incorrect settings can prevent a system from booting.

Table 3.7 describes OpenBoot's NVRAM configuration variables, their default values, and their functions.

NVRAM Variables

Variable Default Description
auto-boot? true The system starts up automatically after power-on or reset if auto-boot? is true. If it is set to false, the system stops at the OpenBoot prompt (ok) after power-on or reset.
boot-command boot The command that is executed if auto-boot? is true.
boot-device disk or net The device from which to start up.
boot-file Empty string Arguments passed to the started program.
diag-device net The diagnostic startup source device.
diag-file Empty string Arguments passed to the startup program in diagnostic mode.
diag-switch? false Whether to run in diagnostic mode.
fcode-debug? false Whether name fields are included for plug-in device FCodes.
input-device keyboard A console input device (usually keyboard, ttya, or ttyb).
nvramrc Empty The contents of NVRAMRC.
oem-banner Empty string A custom original equipment manufacturer (OEM) banner (enabled with oem-banner? true).
oem-banner? false If true, use custom OEM banner.
oem-logo No default A byte array custom OEM logo (enabled with oem-logo? true). Displayed in hexadecimal.
oem-logo? false If true, use custom OEM logo; otherwise, use the Sun logo.
output-device screen A console output device (usually screen, ttya, or ttyb).
sbus-probe-list 0123 Which SBus slots to probe and in what order.
screen-#columns 80 The number of onscreen columns (characters/line).
screen-#rows 34 The number of onscreen rows (lines).
security-#badlogins No default The number of incorrect security password attempts.
security-mode none The firmware security level (options: none, command, or full).
security-password No default The firmware security password (which is never displayed).
use-nvramrc? false If true, execute commands in NVRAMRC during system startup.

 

NOTE

OpenBoot Versions Because older SPARC systems use older versions of OpenBoot, they might use different defaults or different configuration variables from those shown in Table 3.7. This text describes OpenBoot version 4.

You can view and change the NVRAM configuration variables by using the commands listed in Table 3.8.

Table 3.8 - Commands for Viewing and Modifying Configuration Variables

Command Description
password Sets the security password.
printenv Displays the current value and the default value for each variable. To show the current value of a named variable, you type the following: printenv <parameter-name>
setenv <variable> <value> Sets <variable> to the given decimal or text <value>. Changes are permanent, but they often take effect only after a reset.
set-default <variable> Resets the value of <variable> to the factory default.
set-defaults Resets variable values to the factory defaults.

 

The following examples illustrate the use of the commands described in Table 3.8. All commands are entered at the ok OpenBoot prompt.

You use the printenv command, with no argument, to display the current value and the default value for each variable:

ok printenv

The system responds with this:

Variable Name     Value             Default Value
tpe-link-test?    true              true
scsi-initiator-id   7               7
keyboard-click?    false             false
keymap
ttyb-rts-dtr-off   false             false
ttyb-ignore-cd    true              true
ttya-rts-dtr-off   false             false
ttya-ignore-cd    true              true
ttyb-mode       9600,8,n,1,-          9600,8,n,1,-
ttya-mode       9600,8,n,1,-          9600,8,n,1,-
pcia-probe-list    1,2,3,4            1,2,3,4
pcib-probe-list    1,2,3             1,2,3
mfg-mode       off              off
diag-level      max              max
#power-cycles     89
system-board-serial#
system-board-date
fcode-debug?     false             false
output-device     screen             screen
input-device     keyboard            keyboard
load-base       16384             16384
boot-command     boot              boot
auto-boot?      false             true
watchdog-reboot?   false             false
diag-file
diag-device      net              net
boot-file
boot-device      disk:a disk net        disk net
local-mac-address?  false             false
ansi-terminal?    true              true
screen-#columns    80               80
screen-#rows     34               34
silent-mode?     false             false
use-nvramrc?     false             false
nvramrc
security-mode     none
security-password
security-#badlogins  0
oem-logo
oem-logo?       false             false
oem-banner
oem-banner?      false             false
hardware-revision
last-hardware-update
diag-switch?     false             false

NOTE

The printenv Command Depending on the version of OpenBoot that you have on your system, the printenv command might show slightly different results. This example uses a system running OpenBoot version 3.15.

To set the auto-boot? variable to false, you type the following:

ok setenv auto-boot? false

The system responds with this:

auto-boot? =  false

You can verify the setting by typing the following:

ok printenv auto-boot?

The system responds with this:

auto-boot? =   true

To reset the variable to its default setting, you type the following:

ok set-default auto-boot?

The system does not respond with a message—only another OpenBoot prompt. You can verify the setting by typing the following:

ok printenv auto-boot?

The system responds with this:

auto-boot? =   true

To reset all variables to their default settings, you type the following:

ok set-defaults

The system responds with this:

Setting NVRAM parameters to default values.

It's possible to set variables from the Unix command line by issuing the eeprom command. You must be logged in as root to issue this command, and although anyone can view a parameter, only root can change the value of a parameter. For example, to set the auto-boot? variable to true, you type the following at the Unix prompt:

eeprom auto-boot\?=true

Any nonroot user can view the OpenBoot configuration variables from a Unix prompt by typing the following:

/usr/sbin/eeprom

For example, to change the OpenBoot parameter security-password from the command line, you must be logged in as root and issue the following command:

example# eeprom security-password=
Changing PROM password:
New password:
Retype new password:

CAUTION

Setting the OpenBoot Security Mode Setting the security mode and password can be dangerous: If you forget the password, the system is unable to boot. It is nearly impossible to break in without sending the CPU to Sun to have the PROM reset. OpenBoot security is discussed more in the section "OpenBoot Security," later in this chapter.

The security mode password you assign must be between zero and eight characters. Any characters after the eighth are ignored. You do not have to reset the system after you set a password; the security feature takes effect as soon as you type the command.

With no parameters, the eeprom command displays all the OpenBoot configuration settings, similar to the OpenBoot printenv command.

To view OpenBoot parameters from the shell prompt, you type prtconf –vp.

You can use the NVRAM commands listed in Table 3.9 to modify device aliases so that they remain permanent, even after a restart.

NOTE

Resetting NVRAM Variables If you change an NVRAM setting on a SPARC system and the system no longer starts up, you can reset the NVRAM variables to their default settings by holding down Stop+N while the machine is powering up. When you issue the Stop+N key sequence, you hold down Stop+N immediately after turning on the power to the SPARC system; you then keep these keys pressed for a few seconds or until you see the banner (if the display is available).

These are both good techniques for forcing a system's NVRAM variables to a known condition.

Table 3.9 - NVRAM Commands

Command Description
nvalias <alias> <device-path> Stores the command devalias <alias> <device-path> in NVRAMRC. (The alias persists until the nvunalias or set-defaults command is executed.) This command turns on use-nvramrc?.
nvunalias <alias> Deletes the corresponding alias from NVRAMRC.

 

For example, to permanently create a device alias named disk3 that represents a SCSI disk with a target ID of 3 on a SPARCstation 10 system, you type the following:

nvalias disk3 /pci@1f,0/pci@1,1/ide@3/disk@3,0


Copyright © 1996-2008 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

Standard disclaimer: The statements, views and opinions presented on this web page are those of the author and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.

Last modified: February 28, 2008