|C H A P T E R 2|
This chapter describes the user flash driver for the onboard flash PROMs and how to use it. The Netra CP2000/CP2100 series boards are 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.
A user flash switch SW2501 determines whether the user flash is detected during OpenBoot PROM boot and whether or not it is write-enabled. See Switch Settings for more information.
The user flash includes flash PROM chips that can be programmed by users (see TABLE 2-1).
TABLE 2-2 lists the compatible releases that support the user flash driver.
The uflash is the device driver for flash PROM devices on the Netra CP2000/CP2100 series boards. Access to the driver is carried out through open, read, write, pread, pwrite and ioctl system interfaces.
Depending on the platform, one or more of these devices are 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.
When multiple user flash devices are supported by the system, an instance of the driver is loaded per 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 independently of the others. All read and write operations are supported at this time.
Access to the device normally happens a byte at a time. Devices support buffers to speed up writes. The driver automatically switches to the buffer mode, when the feature is available and the request is of sufficient size.
Devices also support erase and lock features. Applications can use them through the IOCTL interface. Devices are 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.
See TABLE 2-3 for the user flash node properties.
Access to the user flash device from the Solaris operating environment is through a C program. No command-line tool is available. User programs open these device files and then issue read, write, or ioctl commands to use the user flash device.
The systems calls are listed below in TABLE 2-4.
CODE EXAMPLE 2-3 contains the Read Action on the user flash device.
CODE EXAMPLE 2-4 contains the Write Action on the user flash device.
CODE EXAMPLE 2-5 contains the Erase Action on the User Flash Device.
CODE EXAMPLE 2-6 contains the Block Erase Action on the user flash device.