#include <fcntl.h> #include <sys/types.h> #include <sundev/openpromio.h> open("/dev/openprom", mode);
Desktop SPARCsystems and SPARCsystem 600MP Series only.
As with other Sun systems, configuration options are stored in an EEPROM or NVRAM on desktop SPARCsystems and SPARCsystem 600MP series machines. However, unlike other Sun systems, the encoding of these options is private to the PROM monitor. The openprom device provides an interface to the PROM monitor allowing a user program to query and set these configuration options through the use of ioctl.2 requests. These requests are defined in <sundev/openpromio.h>:
struct openpromio { u_int oprom_size; /* real size of following array */ char oprom_array[1]; /* For property names and values */ /* NB: Adjacent, Null terminated */ }; #define OPROMMAXPARAM 1024 /* max size of array */ /* * Note that all OPROM ioctl codes are type void. Since the amount * of data copied in/out may (and does) vary, the openprom driver * handles the copyin/copyout itself. */
For all ioctl() requests, the third parameter is a pointer to a `struct openpromio'. All property names and values are null-terminated strings; the value of a numeric option is its ASCII representation.
The OPROMSETOPT2 ioctl takes two adjacent strings in oprom_array: the null-terminated property name followed by the null-terminated value.
The OPROMNXTOPT ioctl is used to retrieve properties sequentially. The null-terminated name of a property is placed into oprom_array and on return it is replaced with the null-terminated name of the next property in the sequence, with oprom_size set to its length. A null string on input means return the name of the first property; an oprom_size of zero on output means there are no more properties.
There should be separate return values for non-existent properties as opposed to not enough space for the value.
The driver should be more consistent in its treatment of errors and edge conditions.
Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97