SMEM(4)

NAME
smem, smemco - SCED memory driver

DESCRIPTION
Smem is a special file that is an image of the memory located on the SCED board. It may be used, for example, to get system messages that are stored in battery backed up ram.

Byte addresses in smem are interpreted as physical memory addresses. The address space from 0x400000 to 0x7FFFFF maps to the DYNIX addresses 0 to 0x3FFFFF.

Examining and patching device registers is likely to lead to unexpected results.

Smemco is a special device that always accesses the SCED board that is attached to the front panel and console.

The following iostats are provided:

    SMIOSTATS
        get statistics about the use of the smem driver

    SMIOGETREBOOT0
        get the standard reboot structure

    SMIOSETREBOOT0
        set the standard reboot structure

    SMIOGETREBOOT1
        get the dump reboot structure

    SMIOSETREBOOT1
        set the dump reboot structure

    SMIOGETLOG
        get data regarding the system log

    SMIOSETLOG
        set data regarding the system log

SMIOSTATS uses the structure:
    struct sm_stats {
    	int	sm_stats_cmd;		/* number of commands */
    	int	sm_stats_ioctls;	/* number of ioctls */
    	int	sm_stats_xfers;		/* number of data transfers */
    };

SMIOGETREBOOT0, SMIOSETREBOOT0, SMIOGETREBOOT1 and SMIOSETREBOOT1 use the structure:
    struct ioctl_reboot {
    	unsigned char	 re_powerup;		/* reference powerup defaults */
    	unsigned int     re_boot_flag;		/* Boot flags */
    	unsigned char	*re_cfg_addr;		/* address to build config */
    	char		 re_boot_name[BNAMESIZE];	/* Boot image name */
    };

There are four boot names contained in the firmware. They are boot_name[0], boot_name[1], re_boot_name[0], and re_boot_name[1]. The SMIOGETREBOOT0 and SMIOSETREBOOT0 get and set either boot_name[0] or re_boot_name[0]. This is determined by the value of the re_powerup flag which must be set to 0 or 1 respectively before calling the kernel. The SMIOGETREBOOT1 and SMIOSETREBOOT1 get and set either boot_name[1] or re_boot_name[1]. This is also determined by the value of the re_powerup flag passed in to the kernel. There are also two re_cfg_addr's. SMIOGETREBOOT0 and SMIOSETREBOOT0 are used to access the first and SMIOGETREBOOT1 and SMIOSETREBOOT1 are used to access the second. The fields, boot_name[0] and boot_name[1] are stored in battery-backed-up RAM and exist across power cycles. The re_boot_name variables are usually copies of the respective boot_name fields and are the ones actually used in booting. If they are changed and the system rebooted without power cycling the new names are used.

SMIOGETLOG and SMIOSETLOG use the structure:
    struct sec_mem {
    	char *mm_buffer;	/* address of log buffer */
    	char *mm_nextchar;	/* next free char in buffer */
    	short mm_size;		/* buffer size */
    	short mm_nchar;		/* number valid chars in buf */
    };

A program can use this structure to determine the location and size of the log buffer and then use the read system call to get the actual data.

SEE ALSO
dmesg(8), savecore(8).

FILES
/dev/smem*
/dev/smemco

BUGS
The smem driver reads values as bytes; this may not be appropriate for some 16-bit device registers on the board.