Subject: Re: Explicit enabling of disk caches
To: Matthew Jacob <mjacob@feral.com>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 09/02/2001 14:11:57
On Sun, Sep 02, 2001 at 01:54:36PM -0700, Matthew Jacob wrote:

 > > BTW, I'm planning to add "format media" and "verify media" ioctls and
 > > associated stuff in dkctl(8), as well...
 > 
 > "write check" is "verify media"

Ah, gotcha.

Ok, SCSI question -- SCSI-2 says that when you MODE SENSE with a CHANGEABLE
page control field, you get a "mask denoting those mode parameters that
are changeable." (X3T9.2/375R revision 10L, page 116, ss 8.2.10.2)

It isn't terribly clear on exactly which bit in the mask means.. I am
guessing that it's a variable-length bitmask, each bit indicating
field number like so:

        struct page_caching {
                u_int8_t pg_code;       /* page code (should be 8) */
                u_int8_t pg_length;     /* page length (should be 0x0a) */
                u_int8_t flags;         /* cache parameter flags */
#define CACHING_RCD     0x01            /* read cache disable */ 
#define CACHING_MF      0x02            /* multiplcation factor */
#define CACHING_WCE     0x04            /* write cache enable (write-back) */
                u_int8_t ret_prio;      /* retention priority */
#define READ_RET_PRIO_SHIFT 4
#define RET_PRIO_DONT_DISTINGUISH       0x0
#define RET_PRIO_REPLACE_READ_WRITE     0x1
#define RET_PRIO_REPLACE_PREFETCH       0xf
                u_int8_t dis_prefetch_xfer_len[2]; 
                u_int8_t min_prefetch[2];
                u_int8_t max_prefetch[2];
                u_int8_t max_prefetch_ceiling[2];
        } caching_params;

byte 0 bit 0:		flags
byte 0 bit 1:		ret_prio
byte 0 bit 2:		dis_prefetch_xfer_len
byte 0 bit 3:		dis_prefetch_xfer_len
byte 0 bit 4:		min_prefetch
byte 0 bit 5:		max_prefetch
byte 0 bit 6:		max_prefetch_ceiling

...and "byte 0" means "byte immediately following pg_length field".

Have I got that right (isn't this more or less how the `offset' works in
the INVALID FIELD IN PARAMETER LIST error works, as well)?

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>