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 CP2300 is equipped with user flash memory. This chapter includes the following sections:
The customer can use the flash memory for various purposes such as storage for RTOS, user data storage, OpenBoot PROM information or to store dropins. Dropins simplify customizing a system for the user.
When OpenBoot PROM in system flash is corrupted, and if a backup copy of OpenBoot PROM is stored in user flash, you can switch the SMC switch to boot the OpenBoot PROM from the user flash and then use flash update to get a good OpenBoot PROM image back into the system flash.
The user flash includes a flash PROM chip that can be programmed. The Netra CP2300 has an 8MB flash that is logically divided into two parts: 1MB for the system/boot flash and 7MB for the user flash. The physical address for the flash is 1ff.f000.0000.
The following releases support the user flash driver:
The uflash is the device driver for the flash PROM device on the Netra CP2300. Access to the driver is carried out through open, read, write, pread, pwrite and ioctl system interfaces.
On the Netra CP2300, one of these devices is supported. There is one logical device file for each physical device that can be accessed from applications. Users can use these devices 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. Access to the device normally happens a byte at a 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.
The user flash modules on the Netra CP2300 are write enabled by default. The user flash is detected during OpenBoot PROM boot by default.
This section provides information on the user flash OpenBoot PROM device node and its properties.
User flash OpenBoot PROM device node is:
/pci@1f,0/pci@1,1/isa@7/flashprom@1f,100000
See TABLE 3-1 for the user flash node properties.
The user flash device files are as follows:
The user flash header file is located in the following path:
/usr/platform/SUNW,Netra-CP2300/include/sys/uflash_if.h
Access to the user flash device from the Solaris operating environment 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 Erase Action on the user flash device.
CODE EXAMPLE 3-6 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 © 2004, Sun Microsystems, Inc. All rights reserved.