C H A P T E R 3 |
User Flash |
This chapter describes the user flash driver for the onboard flash PROM and how to use it. The Netra CP2500 is equipped with user flash memory. This chapter includes the following sections:
You can use the flash memory for various purposes, such as storage for RTOS, user data storage, and OpenBoot PROM information. The Netra CP2500 has a 16Mbyte flash that is logically divided into two parts: 2Mbytes for the system/boot flash and 14Mbytes for the user flash.
The main OpenBoot PROM image and a backup copy of the image are stored in the system flash. If the OpenBoot PROM is corrupted, you can boot the OpenBoot PROM from the backup copy to get a good OpenBoot PROM image back into the system flash. On a Netra CP2500, the SW3301 dip switch on the board itself can be changed to allow you to boot from the backup copy. Refer to the Netra CP2500 Installation and Technical Reference Manual for information on this dip switch.
The uflash is the device driver for the flash PROM device on the Netra CP2500. Access to the driver is carried out through open, read, write, pread, pwrite and ioctl system interfaces.
On the Netra CP2500, one device is supported. There is one logical device file for the physical device that can be accessed from applications. Users can use this device for storing applications and data.
An instance of the driver is loaded for the device. The driver blocks any reads to the device while a write is in progress. Multiple, concurrent reads can go through to the same device at the same time. Writes to a device occur one at a time. All read and write operations are supported at this time.
The device also supports erase and lock features. Applications can use them through the IOCTL interface. The device is divided into logical blocks. Applications that issue these operations also supply a block number or a range of blocks that are a target of these operations. Locks are preserved across reboots. Locking a block prevents an erase or write operation on that block.
This section provides information on the user flash OpenBoot PROM device node and its properties.
The user flash OpenBoot PROM device node is /pci@1e,600000/isa@7/flashprom@2,0.
See TABLE 3-1 for the user flash node properties.
The user flash device file is /dev/uflash0.
The user flash header file is located in the following path:
/usr/platform/SUNW,Netra-CP2500/include/sys/uflash_if.h
Access to the user flash device from the Solaris OS is through an application or user C program. No command-line tool is available. User programs open this device file and then issue read, write, or ioctl commands to use the user flash device.
The system calls are listed below in TABLE 3-2.
The ioctl supported commands are listed below:
Note that these ioctl commands are not supported:
#define UIOCMLCK (uflashIOC|3) /* master lock */ #define UIOCEALL (uflashIOC|6) /* erase all unlocked blocks */ #define UIOCEFUL (uflashIOC|7) /* erase full chip */ |
The PROM information structure holds device information returned by the driver in response to an identify command.
The user flash user interface structure holds user parameters to commands such as erase.
Example programs are provided in this section for the following actions on user flash device:
CODE EXAMPLE 3-3 contains the Read Action on the user flash device.
CODE EXAMPLE 3-4 contains the Write Action on the user flash device.
CODE EXAMPLE 3-5 contains the Block Erase Action on the user flash device.
You can use the following program to test the user flash device and driver. This program also demonstrates how this device can be used.
Copyright © 2007, Sun Microsystems, Inc. All Rights Reserved.