Blame view

include/scsi/scsi_transport_spi.h 7.13 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  /* 
   *  Parallel SCSI (SPI) transport specific attributes exported to sysfs.
   *
   *  Copyright (c) 2003 Silicon Graphics, Inc.  All rights reserved.
   *
   *  This program is free software; you can redistribute it and/or modify
   *  it under the terms of the GNU General Public License as published by
   *  the Free Software Foundation; either version 2 of the License, or
   *  (at your option) any later version.
   *
   *  This program is distributed in the hope that it will be useful,
   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   *  GNU General Public License for more details.
   *
   *  You should have received a copy of the GNU General Public License
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   */
  #ifndef SCSI_TRANSPORT_SPI_H
  #define SCSI_TRANSPORT_SPI_H
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
22
  #include <linux/transport_class.h>
c8d338c8d   Andrew Morton   [PATCH] scsi_tran...
23
  #include <linux/mutex.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
24
25
  
  struct scsi_transport_template;
829b84675   Matthew Wilcox   [SCSI] Make scsi_...
26
27
28
  struct scsi_target;
  struct scsi_device;
  struct Scsi_Host;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
29
30
31
  
  struct spi_transport_attrs {
  	int period;		/* value in the PPR/SDTR command */
62a861297   James Bottomley   [SCSI] implement ...
32
  	int min_period;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
33
  	int offset;
62a861297   James Bottomley   [SCSI] implement ...
34
  	int max_offset;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
35
  	unsigned int width:1;	/* 0 - narrow, 1 - wide */
62a861297   James Bottomley   [SCSI] implement ...
36
  	unsigned int max_width:1;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
37
  	unsigned int iu:1;	/* Information Units enabled */
ea4431906   James Bottomley   [SCSI] aic79xx: m...
38
  	unsigned int max_iu:1;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
39
40
  	unsigned int dt:1;	/* DT clocking enabled */
  	unsigned int qas:1;	/* Quick Arbitration and Selection enabled */
ea4431906   James Bottomley   [SCSI] aic79xx: m...
41
  	unsigned int max_qas:1;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
42
43
44
45
  	unsigned int wr_flow:1;	/* Write Flow control enabled */
  	unsigned int rd_strm:1;	/* Read streaming enabled */
  	unsigned int rti:1;	/* Retain Training Information */
  	unsigned int pcomp_en:1;/* Precompensation enabled */
d872ebe45   James Bottomley   [SCSI] add missin...
46
  	unsigned int hold_mcs:1;/* Hold Margin Control Settings */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
47
48
49
50
51
52
53
54
55
56
  	unsigned int initial_dv:1; /* DV done to this target yet  */
  	unsigned long flags;	/* flags field for drivers to use */
  	/* Device Properties fields */
  	unsigned int support_sync:1; /* synchronous support */
  	unsigned int support_wide:1; /* wide support */
  	unsigned int support_dt:1; /* allows DT phases */
  	unsigned int support_dt_only; /* disallows ST phases */
  	unsigned int support_ius; /* support Information Units */
  	unsigned int support_qas; /* supports quick arbitration and selection */
  	/* Private Fields */
dfdc58ba3   James Bottomley   [SCSI] SPI transp...
57
58
  	unsigned int dv_pending:1; /* Internal flag: DV Requested */
  	unsigned int dv_in_progress:1;	/* Internal: DV started */
d158d2616   Jes Sorensen   [SCSI] sem2mutex:...
59
  	struct mutex dv_mutex; /* semaphore to serialise dv */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
  };
  
  enum spi_signal_type {
  	SPI_SIGNAL_UNKNOWN = 1,
  	SPI_SIGNAL_SE,
  	SPI_SIGNAL_LVD,
  	SPI_SIGNAL_HVD,
  };
  
  struct spi_host_attrs {
  	enum spi_signal_type signalling;
  };
  
  /* accessor functions */
  #define spi_period(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->period)
62a861297   James Bottomley   [SCSI] implement ...
75
  #define spi_min_period(x) (((struct spi_transport_attrs *)&(x)->starget_data)->min_period)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
76
  #define spi_offset(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->offset)
62a861297   James Bottomley   [SCSI] implement ...
77
  #define spi_max_offset(x) (((struct spi_transport_attrs *)&(x)->starget_data)->max_offset)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
78
  #define spi_width(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->width)
62a861297   James Bottomley   [SCSI] implement ...
79
  #define spi_max_width(x) (((struct spi_transport_attrs *)&(x)->starget_data)->max_width)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
80
  #define spi_iu(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->iu)
ea4431906   James Bottomley   [SCSI] aic79xx: m...
81
  #define spi_max_iu(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->max_iu)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
82
83
  #define spi_dt(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->dt)
  #define spi_qas(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->qas)
ea4431906   James Bottomley   [SCSI] aic79xx: m...
84
  #define spi_max_qas(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->max_qas)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
85
86
87
88
  #define spi_wr_flow(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->wr_flow)
  #define spi_rd_strm(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->rd_strm)
  #define spi_rti(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->rti)
  #define spi_pcomp_en(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->pcomp_en)
d872ebe45   James Bottomley   [SCSI] add missin...
89
  #define spi_hold_mcs(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->hold_mcs)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
90
  #define spi_initial_dv(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->initial_dv)
502c62f17   Eric Moore   [SCSI] spi transp...
91
  #define spi_dv_pending(x) (((struct spi_transport_attrs *)&(x)->starget_data)->dv_pending)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
  
  #define spi_support_sync(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->support_sync)
  #define spi_support_wide(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->support_wide)
  #define spi_support_dt(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->support_dt)
  #define spi_support_dt_only(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->support_dt_only)
  #define spi_support_ius(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->support_ius)
  #define spi_support_qas(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->support_qas)
  
  #define spi_flags(x)	(((struct spi_transport_attrs *)&(x)->starget_data)->flags)
  #define spi_signalling(h)	(((struct spi_host_attrs *)(h)->shost_data)->signalling)
  
  
  
  /* The functions by which the transport class and the driver communicate */
  struct spi_function_template {
  	void	(*get_period)(struct scsi_target *);
  	void	(*set_period)(struct scsi_target *, int);
  	void	(*get_offset)(struct scsi_target *);
  	void	(*set_offset)(struct scsi_target *, int);
  	void	(*get_width)(struct scsi_target *);
  	void	(*set_width)(struct scsi_target *, int);
  	void	(*get_iu)(struct scsi_target *);
  	void	(*set_iu)(struct scsi_target *, int);
  	void	(*get_dt)(struct scsi_target *);
  	void	(*set_dt)(struct scsi_target *, int);
  	void	(*get_qas)(struct scsi_target *);
  	void	(*set_qas)(struct scsi_target *, int);
  	void	(*get_wr_flow)(struct scsi_target *);
  	void	(*set_wr_flow)(struct scsi_target *, int);
  	void	(*get_rd_strm)(struct scsi_target *);
  	void	(*set_rd_strm)(struct scsi_target *, int);
  	void	(*get_rti)(struct scsi_target *);
  	void	(*set_rti)(struct scsi_target *, int);
  	void	(*get_pcomp_en)(struct scsi_target *);
  	void	(*set_pcomp_en)(struct scsi_target *, int);
d872ebe45   James Bottomley   [SCSI] add missin...
127
128
  	void	(*get_hold_mcs)(struct scsi_target *);
  	void	(*set_hold_mcs)(struct scsi_target *, int);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
129
130
  	void	(*get_signalling)(struct Scsi_Host *);
  	void	(*set_signalling)(struct Scsi_Host *, enum spi_signal_type);
10c1b8898   James Bottomley   [SCSI] add abilit...
131
  	int	(*deny_binding)(struct scsi_target *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
132
133
134
135
136
137
138
139
140
141
142
143
144
145
  	/* The driver sets these to tell the transport class it
  	 * wants the attributes displayed in sysfs.  If the show_ flag
  	 * is not set, the attribute will be private to the transport
  	 * class */
  	unsigned long	show_period:1;
  	unsigned long	show_offset:1;
  	unsigned long	show_width:1;
  	unsigned long	show_iu:1;
  	unsigned long	show_dt:1;
  	unsigned long	show_qas:1;
  	unsigned long	show_wr_flow:1;
  	unsigned long	show_rd_strm:1;
  	unsigned long	show_rti:1;
  	unsigned long	show_pcomp_en:1;
d872ebe45   James Bottomley   [SCSI] add missin...
146
  	unsigned long	show_hold_mcs:1;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
147
148
149
150
151
152
153
  };
  
  struct scsi_transport_template *spi_attach_transport(struct spi_function_template *);
  void spi_release_transport(struct scsi_transport_template *);
  void spi_schedule_dv_device(struct scsi_device *);
  void spi_dv_device(struct scsi_device *);
  void spi_display_xfer_agreement(struct scsi_target *);
1abfd3701   Matthew Wilcox   [SCSI] Rename scs...
154
  int spi_print_msg(const unsigned char *);
6ea3c0b2d   Matthew Wilcox   [SCSI] Add spi_po...
155
156
157
158
  int spi_populate_width_msg(unsigned char *msg, int width);
  int spi_populate_sync_msg(unsigned char *msg, int period, int offset);
  int spi_populate_ppr_msg(unsigned char *msg, int period, int offset, int width,
  		int options);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
159
160
  
  #endif /* SCSI_TRANSPORT_SPI_H */