scsiconf.h
来自「基于组件方式开发操作系统的OSKIT源代码」· C头文件 代码 · 共 597 行 · 第 1/2 页
H
597 行
* XXX-HA And I added the "supports residuals properly" flag that ALSO goes * in an adapter structure. I figure I'll fix both at once. * * XXX SDEV_OPEN is used for two things: To prevent more than one * open and to make unit attentions errors be logged on the console. * These should be split up; I'm adding SDEV_IS_OPEN to enforce one * open only. * * XXX SDEV_UK is used to mark the "uk" device. */#define SDEV_MEDIA_LOADED 0x0001 /* device figures are still valid */#define SDEV_WAITING 0x0002 /* a process is waiting for this */#define SDEV_OPEN 0x0004 /* at least 1 open session */#define SDEV_BOUNCE 0x0008 /* XXX-HA: unit needs DMA bounce buffer */#define SDEV_DBX 0x00F0 /* debugging flags (scsi_debug.h) */#define SDEV_ONCE_ONLY 0x0100 /* unit can only be opened once */#define SDEV_BOOTVERBOSE 0x0200 /* be noisy during boot */#define SDEV_RESIDS_WORK 0x0400 /* XXX-HA: Residuals work */#define SDEV_TARGET_OPS 0x0800 /* XXX-HA: Supports target ops */#define SDEV_IS_OPEN 0x1000 /* at least 1 open session */#define SDEV_UK 0x2000 /* this is the "uk" device *//* * One of these is allocated and filled in for each scsi bus. * it holds pointers to allow the scsi bus to get to the driver * That is running each LUN on the bus * it also has a template entry which is the prototype struct * supplied by the adapter driver, this is used to initialise * the others, before they have the rest of the fields filled in */struct scsibus_data { u_char maxtarg; u_char maxlun; struct scsi_link *adapter_link; /* prototype supplied by adapter */ struct scsi_link *(*sc_link)[][8]; /* dynamically allocated */};/* * Each scsi transaction is fully described by one of these structures * It includes information about the source of the command and also the * device and adapter for which the command is destined. * (via the scsi_link structure) * */struct scsi_xfer{/*04*/ struct scsi_xfer *next; /* when free *//*08*/ u_int32_t flags;/*12*/ struct scsi_link *sc_link; /* all about our device and adapter *//*13*/ u_int8_t retries; /* the number of times to retry *//*16*/ u_int8_t spare[3];/*20*/ int32_t timeout; /* in milliseconds *//*24*/ struct scsi_generic *cmd; /* The scsi command to execute *//*28*/ int32_t cmdlen; /* how long it is *//*32*/ u_char *data; /* dma address OR a uio address *//*36*/ int32_t datalen; /* data len (blank if uio) *//*40*/ int32_t resid; /* how much buffer was not touched *//*44*/ int32_t error; /* an error value *//*48*/ struct buf *bp; /* If we need to associate with a buf *//*80*/ struct scsi_sense_data sense; /* 32 bytes*/ /* * Believe it or not, Some targets fall on the ground with * anything but a certain sense length. *//*84*/ int32_t req_sense_length; /* Explicit request sense length *//*88*/ int32_t status; /* SCSI status *//*100*/ struct scsi_generic cmdstore; /* stash the command in here */};/* * Per-request Flag values */#define SCSI_NOSLEEP 0x01 /* Not a user... don't sleep */#define SCSI_NOMASK 0x02 /* dont allow interrupts.. booting */#define SCSI_NOSTART 0x04 /* left over from ancient history */#define SCSI_USER 0x08 /* Is a user cmd, call scsi_user_done */#define SCSI_ITSDONE 0x10 /* the transfer is as done as it gets */#define ITSDONE 0x10 /* the transfer is as done as it gets */#define SCSI_INUSE 0x20 /* The scsi_xfer block is in use */#define INUSE 0x20 /* The scsi_xfer block is in use */#define SCSI_SILENT 0x40 /* Don't report errors to console */#define SCSI_ERR_OK 0x80 /* An error on this operation is OK. */#define SCSI_RESET 0x100 /* Reset the device in question */#define SCSI_DATA_UIO 0x200 /* The data address refers to a UIO */#define SCSI_DATA_IN 0x400 /* expect data to come INTO memory */#define SCSI_DATA_OUT 0x800 /* expect data to flow OUT of memory */#define SCSI_TARGET 0x1000 /* This defines a TARGET mode op. */#define SCSI_ESCAPE 0x2000 /* Escape operation */#define SCSI_EOF 0x4000 /* The operation should return EOF */#define SCSI_RESID_VALID 0x8000 /* The resid field contains valid data *//* * Escape op codes. This provides an extensible setup for operations * that are not scsi commands. They are intended for modal operations. */#define SCSI_OP_TARGET 0x0001#define SCSI_OP_RESET 0x0002#define SCSI_OP_BDINFO 0x0003/* * Error values an adapter driver may return */#define XS_NOERROR 0x0 /* there is no error, (sense is invalid) */#define XS_SENSE 0x1 /* Check the returned sense for the error */#define XS_DRIVER_STUFFUP 0x2 /* Driver failed to perform operation */#define XS_TIMEOUT 0x03 /* The device timed out.. turned off? */#define XS_SWTIMEOUT 0x04 /* The Timeout reported was caught by SW */#define XS_BUSY 0x08 /* The device busy, try again later? */#define XS_LENGTH 0x09 /* Illegal length (over/under run) */#define XS_SELTIMEOUT 0x10 /* Device failed to respond to selection */#ifdef KERNELvoid *extend_get(struct extend_array *ea, int index);void scsi_attachdevs __P((struct scsibus_data *scbus));struct scsi_xfer *get_xs( struct scsi_link *sc_link, u_int32_t flags);void free_xs(struct scsi_xfer *xs, struct scsi_link *sc_link,u_int32_t flags);u_int32_t scsi_read_capacity __P(( struct scsi_link *sc_link, u_int32_t *blk_size, u_int32_t flags));errval scsi_test_unit_ready __P(( struct scsi_link *sc_link, u_int32_t flags));errval scsi_reset_target __P((struct scsi_link *));errval scsi_target_mode __P((struct scsi_link *, int));errval scsi_change_def( struct scsi_link *sc_link, u_int32_t flags);errval scsi_inquire( struct scsi_link *sc_link, struct scsi_inquiry_data *inqbuf, u_int32_t flags);errval scsi_prevent( struct scsi_link *sc_link, u_int32_t type,u_int32_t flags);struct scsibus_data *scsi_alloc_bus ();errval scsi_probe_bus __P((int, int, int));errval scsi_probe_busses __P(( int, int, int));errval scsi_start_unit( struct scsi_link *sc_link, u_int32_t flags);errval scsi_stop_unit(struct scsi_link *sc_link, u_int32_t eject, u_int32_t flags);void scsi_done(struct scsi_xfer *xs);void scsi_user_done(struct scsi_xfer *xs);errval scsi_scsi_cmd __P(( struct scsi_link *, struct scsi_generic *, u_int32_t, u_char *, u_int32_t, u_int32_t, u_int32_t, struct buf *, u_int32_t));int scsi_do_ioctl __P((dev_t dev, int cmd, caddr_t addr, int mode, struct proc *p, struct scsi_link *sc_link));struct scsi_link *scsi_link_get __P((int bus, int targ, int lun));dev_t scsi_dev_lookup __P((int (*opener)(dev_t dev, int flags, int fmt,struct proc *p)));int scsi_opened_ok __P((dev_t dev, int flag, int type, struct scsi_link *sc_link));errval scsi_set_bus __P((int, struct scsi_link *));char *scsi_sense_desc __P((int, int));void scsi_sense_print __P((struct scsi_xfer *));int scsi_sense_qualifiers __P((struct scsi_xfer *, int *, int *));void show_scsi_xs __P((struct scsi_xfer *));void show_scsi_cmd __P((struct scsi_xfer *));void show_mem __P((unsigned char * , u_int32_t));void scsi_uto3b __P((u_int32_t , u_char *));u_int32_t scsi_3btou __P((u_char *));int32_t scsi_3btoi __P((u_char *));void scsi_uto4b __P((u_int32_t, u_char *));u_int32_t scsi_4btou __P((u_char *));void scsi_uto2b __P((u_int32_t, u_char *));u_int32_t scsi_2btou __P((u_char *));void sc_print_addr __P((struct scsi_link *));void sc_print_start __P((struct scsi_link *));void sc_print_finish __P((void));extern int scsi_externalize __P((struct scsi_link *, void *, size_t *));void scsi_device_register __P((struct scsi_device *sd));extern struct kern_devconf kdc_scbus0; /* XXX should go away */void scsi_configure_start __P((void));void scsi_configure_finish __P((void));#endif /* KERNEL */#define SCSI_EXTERNALLEN (sizeof(struct scsi_link))#ifdef NEW_SCSICONF/* XXX This belongs in a tape file. *//********************************************************************** from the scsi2 spec Value Tracks Density(bpi) Code Type Reference Note 0x1 9 800 NRZI R X3.22-1983 2 0x2 9 1600 PE R X3.39-1986 2 0x3 9 6250 GCR R X3.54-1986 2 0x5 4/9 8000 GCR C X3.136-1986 1 0x6 9 3200 PE R X3.157-1987 2 0x7 4 6400 IMFM C X3.116-1986 1 0x8 4 8000 GCR CS X3.158-1986 1 0x9 18 37871 GCR C X3B5/87-099 2 0xA 22 6667 MFM C X3B5/86-199 1 0xB 4 1600 PE C X3.56-1986 1 0xC 24 12690 GCR C HI-TC1 1,5 0xD 24 25380 GCR C HI-TC2 1,5 0xF 15 10000 GCR C QIC-120 1,5 0x10 18 10000 GCR C QIC-150 1,5 0x11 26 16000 GCR C QIC-320(525?) 1,5 0x12 30 51667 RLL C QIC-1350 1,5 0x13 1 61000 DDS CS X3B5/88-185A 4 0x14 1 43245 RLL CS X3.202-1991 4 0x15 1 45434 RLL CS ECMA TC17 4 0x16 48 10000 MFM C X3.193-1990 1 0x17 48 42500 MFM C X3B5/91-174 1 where Code means: NRZI Non Return to Zero, change on ones GCR Group Code Recording PE Phase Encoded IMFM Inverted Modified Frequency Modulation MFM Modified Frequency Modulation DDS Dat Data Storage RLL Run Length Encoding where Type means: R Real-to-Real C Cartridge CS cassette where Notes means: 1 Serial Recorded 2 Parallel Recorded 3 Old format know as QIC-11 4 Helical Scan 5 Not ANSI standard, rather industry standard.********************************************************************/#define HALFINCH_800 0x01#define HALFINCH_1600 0x02#define HALFINCH_6250 0x03#define QIC_11 0x04 /* from Archive 150S Theory of Op. XXX */#define QIC_24 0x05 /* may be bad, works for CIPHER ST150S XXX */#define QIC_120 0x0f#define QIC_150 0x10#define QIC_320 0x11#define QIC_525 0x11#define QIC_1320 0x12#define DDS 0x13#define DAT_1 0x13#endif /* NEW_SCSICONF *//* XXX (dufault@hda.com) This is used only by "su" and "sctarg". * The minor number field conflicts with the disk slice code, * and so it is tough to access the disks through the "su" device. *//* Device number fields: * * NON-FIXED SCSI devices: * * ?FC? ???? ???? ???? MMMMMMMM mmmmmmmm * * F: Fixed device (nexus in number): must be 0. * C: Control device; only user mode ioctl is supported. * ?: Don't know; those bits didn't use to exist, currently always 0. * M: Major device number. * m: Old style minor device number. * * FIXED SCSI devices: * * XXX Conflicts with the slice code. Maybe the slice code can be * changed to respect the F bit? * * ?FC? ?BBB TTTT ?LLL MMMMMMMM mmmmmmmm * * F: Fixed device (nexus in number); must be 1. * C: Control device; only user mode ioctl is supported. * B: SCSI bus * T: SCSI target ID * L: Logical unit * M: Major device number * m: Old style minor device number. */#define SCSI_FIXED_MASK 0x40000000#define SCSI_FIXED(DEV) (((DEV) & SCSI_FIXED_MASK))#define SCSI_CONTROL_MASK 0x20000000#define SCSI_CONTROL(DEV) (((DEV) & SCSI_CONTROL_MASK))#define SCSI_BUS(DEV) (((DEV) & 0x07000000) >> 24)#define SCSI_ID(DEV) (((DEV) & 0x00F00000) >> 20)#define SCSI_LUN(DEV) (((DEV) & 0x00070000) >> 16)#define SCSI_MKFIXED(B, T, L) ( \ ((B) << 24) | \ ((T) << 20) | \ ((L) << 16) | \ SCSI_FIXED_MASK )#endif /*SCSI_SCSICONF_H*//* END OF FILE */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?