2 * Parallel SCSI (SPI) transport specific attributes exported to sysfs.
4 * Copyright (c) 2003 Silicon Graphics, Inc. All rights reserved.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #ifndef SCSI_TRANSPORT_SPI_H
21 #define SCSI_TRANSPORT_SPI_H
23 #include <linux/config.h>
25 struct scsi_transport_template;
27 struct spi_transport_attrs {
28 int period; /* value in the PPR/SDTR command */
30 unsigned int width:1; /* 0 - narrow, 1 - wide */
31 unsigned int iu:1; /* Information Units enabled */
32 unsigned int dt:1; /* DT clocking enabled */
33 unsigned int qas:1; /* Quick Arbitration and Selection enabled */
34 unsigned int wr_flow:1; /* Write Flow control enabled */
35 unsigned int rd_strm:1; /* Read streaming enabled */
36 unsigned int rti:1; /* Retain Training Information */
37 unsigned int pcomp_en:1;/* Precompensation enabled */
39 unsigned int dv_pending:1; /* Internal flag */
40 struct semaphore dv_sem; /* semaphore to serialise dv */
43 /* accessor functions */
44 #define spi_period(x) (((struct spi_transport_attrs *)&(x)->transport_data)->period)
45 #define spi_offset(x) (((struct spi_transport_attrs *)&(x)->transport_data)->offset)
46 #define spi_width(x) (((struct spi_transport_attrs *)&(x)->transport_data)->width)
47 #define spi_iu(x) (((struct spi_transport_attrs *)&(x)->transport_data)->iu)
48 #define spi_dt(x) (((struct spi_transport_attrs *)&(x)->transport_data)->dt)
49 #define spi_qas(x) (((struct spi_transport_attrs *)&(x)->transport_data)->qas)
50 #define spi_wr_flow(x) (((struct spi_transport_attrs *)&(x)->transport_data)->wr_flow)
51 #define spi_rd_strm(x) (((struct spi_transport_attrs *)&(x)->transport_data)->rd_strm)
52 #define spi_rti(x) (((struct spi_transport_attrs *)&(x)->transport_data)->rti)
53 #define spi_pcomp_en(x) (((struct spi_transport_attrs *)&(x)->transport_data)->pcomp_en)
55 /* The functions by which the transport class and the driver communicate */
56 struct spi_function_template {
57 void (*get_period)(struct scsi_device *);
58 void (*set_period)(struct scsi_device *, int);
59 void (*get_offset)(struct scsi_device *);
60 void (*set_offset)(struct scsi_device *, int);
61 void (*get_width)(struct scsi_device *);
62 void (*set_width)(struct scsi_device *, int);
63 void (*get_iu)(struct scsi_device *);
64 void (*set_iu)(struct scsi_device *, int);
65 void (*get_dt)(struct scsi_device *);
66 void (*set_dt)(struct scsi_device *, int);
67 void (*get_qas)(struct scsi_device *);
68 void (*set_qas)(struct scsi_device *, int);
69 void (*get_wr_flow)(struct scsi_device *);
70 void (*set_wr_flow)(struct scsi_device *, int);
71 void (*get_rd_strm)(struct scsi_device *);
72 void (*set_rd_strm)(struct scsi_device *, int);
73 void (*get_rti)(struct scsi_device *);
74 void (*set_rti)(struct scsi_device *, int);
75 void (*get_pcomp_en)(struct scsi_device *);
76 void (*set_pcomp_en)(struct scsi_device *, int);
77 /* The driver sets these to tell the transport class it
78 * wants the attributes displayed in sysfs. If the show_ flag
79 * is not set, the attribute will be private to the transport
81 unsigned long show_period:1;
82 unsigned long show_offset:1;
83 unsigned long show_width:1;
84 unsigned long show_iu:1;
85 unsigned long show_dt:1;
86 unsigned long show_qas:1;
87 unsigned long show_wr_flow:1;
88 unsigned long show_rd_strm:1;
89 unsigned long show_rti:1;
90 unsigned long show_pcomp_en:1;
93 struct scsi_transport_template *spi_attach_transport(struct spi_function_template *);
94 void spi_release_transport(struct scsi_transport_template *);
95 void spi_schedule_dv_device(struct scsi_device *);
96 void spi_dv_device(struct scsi_device *);
98 #endif /* SCSI_TRANSPORT_SPI_H */