The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/port/sd.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Storage Device.
    3  */
    4 typedef struct SDev SDev;
    5 typedef struct SDifc SDifc;
    6 typedef struct SDpart SDpart;
    7 typedef struct SDperm SDperm;
    8 typedef struct SDreq SDreq;
    9 typedef struct SDunit SDunit;
   10 
   11 struct SDperm {
   12         char*   name;
   13         char*   user;
   14         ulong   perm;
   15 };
   16 
   17 struct SDpart {
   18         uvlong  start;
   19         uvlong  end;
   20         SDperm;
   21         int     valid;
   22         ulong   vers;
   23 };
   24 
   25 struct SDunit {
   26         SDev*   dev;
   27         int     subno;
   28         uchar   inquiry[255];           /* format follows SCSI spec */
   29         uchar   sense[18];              /* format follows SCSI spec */
   30         SDperm;
   31 
   32         QLock   ctl;
   33         uvlong  sectors;
   34         ulong   secsize;
   35         SDpart* part;                   /* nil or array of size npart */
   36         int     npart;
   37         ulong   vers;
   38         SDperm  ctlperm;
   39 
   40         QLock   raw;                    /* raw read or write in progress */
   41         ulong   rawinuse;               /* really just a test-and-set */
   42         int     state;
   43         SDreq*  req;
   44         SDperm  rawperm;
   45 };
   46 
   47 /*
   48  * Each controller is represented by a SDev.
   49  */
   50 struct SDev {
   51         Ref     r;                      /* Number of callers using device */
   52         SDifc*  ifc;                    /* pnp/legacy */
   53         void*   ctlr;
   54         int     idno;
   55         char    name[8];
   56         SDev*   next;
   57 
   58         QLock;                          /* enable/disable */
   59         int     enabled;
   60         int     nunit;                  /* Number of units */
   61         QLock   unitlock;               /* `Loading' of units */
   62         int*    unitflg;                /* Unit flags */
   63         SDunit**unit;
   64 };
   65 
   66 struct SDifc {
   67         char*   name;
   68 
   69         SDev*   (*pnp)(void);
   70         SDev*   (*legacy)(int, int);
   71         int     (*enable)(SDev*);
   72         int     (*disable)(SDev*);
   73 
   74         int     (*verify)(SDunit*);
   75         int     (*online)(SDunit*);
   76         int     (*rio)(SDreq*);
   77         int     (*rctl)(SDunit*, char*, int);
   78         int     (*wctl)(SDunit*, Cmdbuf*);
   79 
   80         long    (*bio)(SDunit*, int, int, void*, long, uvlong);
   81         SDev*   (*probe)(DevConf*);
   82         void    (*clear)(SDev*);
   83         char*   (*rtopctl)(SDev*, char*, char*);
   84         int     (*wtopctl)(SDev*, Cmdbuf*);
   85 };
   86 
   87 struct SDreq {
   88         SDunit* unit;
   89         int     lun;
   90         int     write;
   91         uchar   cmd[16];
   92         int     clen;
   93         void*   data;
   94         int     dlen;
   95 
   96         int     flags;
   97 
   98         int     status;
   99         long    rlen;
  100         uchar   sense[256];
  101 };
  102 
  103 enum {
  104         SDnosense       = 0x00000001,
  105         SDvalidsense    = 0x00010000,
  106 };
  107 
  108 enum {
  109         SDretry         = -5,           /* internal to controllers */
  110         SDmalloc        = -4,
  111         SDeio           = -3,
  112         SDtimeout       = -2,
  113         SDnostatus      = -1,
  114 
  115         SDok            = 0,
  116 
  117         SDcheck         = 0x02,         /* check condition */
  118         SDbusy          = 0x08,         /* busy */
  119 
  120         SDmaxio         = 2048*1024,
  121         SDnpart         = 16,
  122 };
  123 
  124 #define sdmalloc(n)     malloc(n)
  125 #define sdfree(p)       free(p)
  126 
  127 /* devsd.c */
  128 extern void sdadddevs(SDev*);
  129 extern int sdsetsense(SDreq*, int, int, int, int);
  130 extern int sdmodesense(SDreq*, uchar*, void*, int);
  131 extern int sdfakescsi(SDreq*, void*, int);
  132 
  133 /* sdscsi.c */
  134 extern int scsiverify(SDunit*);
  135 extern int scsionline(SDunit*);
  136 extern long scsibio(SDunit*, int, int, void*, long, uvlong);
  137 extern SDev* scsiid(SDev*, SDifc*);

Cache object: b90f7bfd3250909f61ce31e64a9ab130


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.