Linux Audio

Check our new training course

Loading...
v3.1
 
  1/*
  2 * Device driver for the SYMBIOS/LSILOGIC 53C8XX and 53C1010 family 
  3 * of PCI-SCSI IO processors.
  4 *
  5 * Copyright (C) 1999-2001  Gerard Roudier <groudier@free.fr>
  6 *
  7 * This driver is derived from the Linux sym53c8xx driver.
  8 * Copyright (C) 1998-2000  Gerard Roudier
  9 *
 10 * The sym53c8xx driver is derived from the ncr53c8xx driver that had been 
 11 * a port of the FreeBSD ncr driver to Linux-1.2.13.
 12 *
 13 * The original ncr driver has been written for 386bsd and FreeBSD by
 14 *         Wolfgang Stanglmeier        <wolf@cologne.de>
 15 *         Stefan Esser                <se@mi.Uni-Koeln.de>
 16 * Copyright (C) 1994  Wolfgang Stanglmeier
 17 *
 18 * Other major contributions:
 19 *
 20 * NVRAM detection and reading.
 21 * Copyright (C) 1997 Richard Waltham <dormouse@farsrobt.demon.co.uk>
 22 *
 23 *-----------------------------------------------------------------------------
 24 *
 25 * This program is free software; you can redistribute it and/or modify
 26 * it under the terms of the GNU General Public License as published by
 27 * the Free Software Foundation; either version 2 of the License, or
 28 * (at your option) any later version.
 29 *
 30 * This program is distributed in the hope that it will be useful,
 31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 33 * GNU General Public License for more details.
 34 *
 35 * You should have received a copy of the GNU General Public License
 36 * along with this program; if not, write to the Free Software
 37 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 38 */
 39
 40#ifndef SYM_NVRAM_H
 41#define SYM_NVRAM_H
 42
 43#include "sym53c8xx.h"
 44
 45/*
 46 *	Symbios NVRAM data format
 47 */
 48#define SYMBIOS_NVRAM_SIZE 368
 49#define SYMBIOS_NVRAM_ADDRESS 0x100
 50
 51struct Symbios_nvram {
 52/* Header 6 bytes */
 53	u_short type;		/* 0x0000 */
 54	u_short byte_count;	/* excluding header/trailer */
 55	u_short checksum;
 56
 57/* Controller set up 20 bytes */
 58	u_char	v_major;	/* 0x00 */
 59	u_char	v_minor;	/* 0x30 */
 60	u32	boot_crc;
 61	u_short	flags;
 62#define SYMBIOS_SCAM_ENABLE	(1)
 63#define SYMBIOS_PARITY_ENABLE	(1<<1)
 64#define SYMBIOS_VERBOSE_MSGS	(1<<2)
 65#define SYMBIOS_CHS_MAPPING	(1<<3)
 66#define SYMBIOS_NO_NVRAM	(1<<3)	/* ??? */
 67	u_short	flags1;
 68#define SYMBIOS_SCAN_HI_LO	(1)
 69	u_short	term_state;
 70#define SYMBIOS_TERM_CANT_PROGRAM	(0)
 71#define SYMBIOS_TERM_ENABLED		(1)
 72#define SYMBIOS_TERM_DISABLED		(2)
 73	u_short	rmvbl_flags;
 74#define SYMBIOS_RMVBL_NO_SUPPORT	(0)
 75#define SYMBIOS_RMVBL_BOOT_DEVICE	(1)
 76#define SYMBIOS_RMVBL_MEDIA_INSTALLED	(2)
 77	u_char	host_id;
 78	u_char	num_hba;	/* 0x04 */
 79	u_char	num_devices;	/* 0x10 */
 80	u_char	max_scam_devices;	/* 0x04 */
 81	u_char	num_valid_scam_devices;	/* 0x00 */
 82	u_char	flags2;
 83#define SYMBIOS_AVOID_BUS_RESET		(1<<2)
 84
 85/* Boot order 14 bytes * 4 */
 86	struct Symbios_host{
 87		u_short	type;		/* 4:8xx / 0:nok */
 88		u_short	device_id;	/* PCI device id */
 89		u_short	vendor_id;	/* PCI vendor id */
 90		u_char	bus_nr;		/* PCI bus number */
 91		u_char	device_fn;	/* PCI device/function number << 3*/
 92		u_short	word8;
 93		u_short	flags;
 94#define	SYMBIOS_INIT_SCAN_AT_BOOT	(1)
 95		u_short	io_port;	/* PCI io_port address */
 96	} host[4];
 97
 98/* Targets 8 bytes * 16 */
 99	struct Symbios_target {
100		u_char	flags;
101#define SYMBIOS_DISCONNECT_ENABLE	(1)
102#define SYMBIOS_SCAN_AT_BOOT_TIME	(1<<1)
103#define SYMBIOS_SCAN_LUNS		(1<<2)
104#define SYMBIOS_QUEUE_TAGS_ENABLED	(1<<3)
105		u_char	rsvd;
106		u_char	bus_width;	/* 0x08/0x10 */
107		u_char	sync_offset;
108		u_short	sync_period;	/* 4*period factor */
109		u_short	timeout;
110	} target[16];
111/* Scam table 8 bytes * 4 */
112	struct Symbios_scam {
113		u_short	id;
114		u_short	method;
115#define SYMBIOS_SCAM_DEFAULT_METHOD	(0)
116#define SYMBIOS_SCAM_DONT_ASSIGN	(1)
117#define SYMBIOS_SCAM_SET_SPECIFIC_ID	(2)
118#define SYMBIOS_SCAM_USE_ORDER_GIVEN	(3)
119		u_short status;
120#define SYMBIOS_SCAM_UNKNOWN		(0)
121#define SYMBIOS_SCAM_DEVICE_NOT_FOUND	(1)
122#define SYMBIOS_SCAM_ID_NOT_SET		(2)
123#define SYMBIOS_SCAM_ID_VALID		(3)
124		u_char	target_id;
125		u_char	rsvd;
126	} scam[4];
127
128	u_char	spare_devices[15*8];
129	u_char	trailer[6];		/* 0xfe 0xfe 0x00 0x00 0x00 0x00 */
130};
131typedef struct Symbios_nvram	Symbios_nvram;
132typedef struct Symbios_host	Symbios_host;
133typedef struct Symbios_target	Symbios_target;
134typedef struct Symbios_scam	Symbios_scam;
135
136/*
137 *	Tekram NvRAM data format.
138 */
139#define TEKRAM_NVRAM_SIZE 64
140#define TEKRAM_93C46_NVRAM_ADDRESS 0
141#define TEKRAM_24C16_NVRAM_ADDRESS 0x40
142
143struct Tekram_nvram {
144	struct Tekram_target {
145		u_char	flags;
146#define	TEKRAM_PARITY_CHECK		(1)
147#define TEKRAM_SYNC_NEGO		(1<<1)
148#define TEKRAM_DISCONNECT_ENABLE	(1<<2)
149#define	TEKRAM_START_CMD		(1<<3)
150#define TEKRAM_TAGGED_COMMANDS		(1<<4)
151#define TEKRAM_WIDE_NEGO		(1<<5)
152		u_char	sync_index;
153		u_short	word2;
154	} target[16];
155	u_char	host_id;
156	u_char	flags;
157#define TEKRAM_MORE_THAN_2_DRIVES	(1)
158#define TEKRAM_DRIVES_SUP_1GB		(1<<1)
159#define	TEKRAM_RESET_ON_POWER_ON	(1<<2)
160#define TEKRAM_ACTIVE_NEGATION		(1<<3)
161#define TEKRAM_IMMEDIATE_SEEK		(1<<4)
162#define	TEKRAM_SCAN_LUNS		(1<<5)
163#define	TEKRAM_REMOVABLE_FLAGS		(3<<6)	/* 0: disable; */
164						/* 1: boot device; 2:all */
165	u_char	boot_delay_index;
166	u_char	max_tags_index;
167	u_short	flags1;
168#define TEKRAM_F2_F6_ENABLED		(1)
169	u_short	spare[29];
170};
171typedef struct Tekram_nvram	Tekram_nvram;
172typedef struct Tekram_target	Tekram_target;
173
174#ifndef CONFIG_PARISC
175struct pdc_initiator { int dummy; };
176#endif
177
178/*
179 *  Union of supported NVRAM formats.
180 */
181struct sym_nvram {
182	int type;
183#define	SYM_SYMBIOS_NVRAM	(1)
184#define	SYM_TEKRAM_NVRAM	(2)
185#define SYM_PARISC_PDC		(3)
186#if SYM_CONF_NVRAM_SUPPORT
187	union {
188		Symbios_nvram Symbios;
189		Tekram_nvram Tekram;
190		struct pdc_initiator parisc;
191	} data;
192#endif
193};
194
195#if SYM_CONF_NVRAM_SUPPORT
196void sym_nvram_setup_host(struct Scsi_Host *shost, struct sym_hcb *np, struct sym_nvram *nvram);
197void sym_nvram_setup_target (struct sym_tcb *tp, int target, struct sym_nvram *nvp);
198int sym_read_nvram (struct sym_device *np, struct sym_nvram *nvp);
199char *sym_nvram_type(struct sym_nvram *nvp);
200#else
201static inline void sym_nvram_setup_host(struct Scsi_Host *shost, struct sym_hcb *np, struct sym_nvram *nvram) { }
202static inline void sym_nvram_setup_target(struct sym_tcb *tp, struct sym_nvram *nvram) { }
203static inline int sym_read_nvram(struct sym_device *np, struct sym_nvram *nvp)
204{
205	nvp->type = 0;
206	return 0;
207}
208static inline char *sym_nvram_type(struct sym_nvram *nvp)
209{
210	return "No NVRAM";
211}
212#endif
213
214#endif /* SYM_NVRAM_H */
v5.9
  1/* SPDX-License-Identifier: GPL-2.0-or-later */
  2/*
  3 * Device driver for the SYMBIOS/LSILOGIC 53C8XX and 53C1010 family 
  4 * of PCI-SCSI IO processors.
  5 *
  6 * Copyright (C) 1999-2001  Gerard Roudier <groudier@free.fr>
  7 *
  8 * This driver is derived from the Linux sym53c8xx driver.
  9 * Copyright (C) 1998-2000  Gerard Roudier
 10 *
 11 * The sym53c8xx driver is derived from the ncr53c8xx driver that had been 
 12 * a port of the FreeBSD ncr driver to Linux-1.2.13.
 13 *
 14 * The original ncr driver has been written for 386bsd and FreeBSD by
 15 *         Wolfgang Stanglmeier        <wolf@cologne.de>
 16 *         Stefan Esser                <se@mi.Uni-Koeln.de>
 17 * Copyright (C) 1994  Wolfgang Stanglmeier
 18 *
 19 * Other major contributions:
 20 *
 21 * NVRAM detection and reading.
 22 * Copyright (C) 1997 Richard Waltham <dormouse@farsrobt.demon.co.uk>
 23 *
 24 *-----------------------------------------------------------------------------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 25 */
 26
 27#ifndef SYM_NVRAM_H
 28#define SYM_NVRAM_H
 29
 30#include "sym53c8xx.h"
 31
 32/*
 33 *	Symbios NVRAM data format
 34 */
 35#define SYMBIOS_NVRAM_SIZE 368
 36#define SYMBIOS_NVRAM_ADDRESS 0x100
 37
 38struct Symbios_nvram {
 39/* Header 6 bytes */
 40	u_short type;		/* 0x0000 */
 41	u_short byte_count;	/* excluding header/trailer */
 42	u_short checksum;
 43
 44/* Controller set up 20 bytes */
 45	u_char	v_major;	/* 0x00 */
 46	u_char	v_minor;	/* 0x30 */
 47	u32	boot_crc;
 48	u_short	flags;
 49#define SYMBIOS_SCAM_ENABLE	(1)
 50#define SYMBIOS_PARITY_ENABLE	(1<<1)
 51#define SYMBIOS_VERBOSE_MSGS	(1<<2)
 52#define SYMBIOS_CHS_MAPPING	(1<<3)
 53#define SYMBIOS_NO_NVRAM	(1<<3)	/* ??? */
 54	u_short	flags1;
 55#define SYMBIOS_SCAN_HI_LO	(1)
 56	u_short	term_state;
 57#define SYMBIOS_TERM_CANT_PROGRAM	(0)
 58#define SYMBIOS_TERM_ENABLED		(1)
 59#define SYMBIOS_TERM_DISABLED		(2)
 60	u_short	rmvbl_flags;
 61#define SYMBIOS_RMVBL_NO_SUPPORT	(0)
 62#define SYMBIOS_RMVBL_BOOT_DEVICE	(1)
 63#define SYMBIOS_RMVBL_MEDIA_INSTALLED	(2)
 64	u_char	host_id;
 65	u_char	num_hba;	/* 0x04 */
 66	u_char	num_devices;	/* 0x10 */
 67	u_char	max_scam_devices;	/* 0x04 */
 68	u_char	num_valid_scam_devices;	/* 0x00 */
 69	u_char	flags2;
 70#define SYMBIOS_AVOID_BUS_RESET		(1<<2)
 71
 72/* Boot order 14 bytes * 4 */
 73	struct Symbios_host{
 74		u_short	type;		/* 4:8xx / 0:nok */
 75		u_short	device_id;	/* PCI device id */
 76		u_short	vendor_id;	/* PCI vendor id */
 77		u_char	bus_nr;		/* PCI bus number */
 78		u_char	device_fn;	/* PCI device/function number << 3*/
 79		u_short	word8;
 80		u_short	flags;
 81#define	SYMBIOS_INIT_SCAN_AT_BOOT	(1)
 82		u_short	io_port;	/* PCI io_port address */
 83	} host[4];
 84
 85/* Targets 8 bytes * 16 */
 86	struct Symbios_target {
 87		u_char	flags;
 88#define SYMBIOS_DISCONNECT_ENABLE	(1)
 89#define SYMBIOS_SCAN_AT_BOOT_TIME	(1<<1)
 90#define SYMBIOS_SCAN_LUNS		(1<<2)
 91#define SYMBIOS_QUEUE_TAGS_ENABLED	(1<<3)
 92		u_char	rsvd;
 93		u_char	bus_width;	/* 0x08/0x10 */
 94		u_char	sync_offset;
 95		u_short	sync_period;	/* 4*period factor */
 96		u_short	timeout;
 97	} target[16];
 98/* Scam table 8 bytes * 4 */
 99	struct Symbios_scam {
100		u_short	id;
101		u_short	method;
102#define SYMBIOS_SCAM_DEFAULT_METHOD	(0)
103#define SYMBIOS_SCAM_DONT_ASSIGN	(1)
104#define SYMBIOS_SCAM_SET_SPECIFIC_ID	(2)
105#define SYMBIOS_SCAM_USE_ORDER_GIVEN	(3)
106		u_short status;
107#define SYMBIOS_SCAM_UNKNOWN		(0)
108#define SYMBIOS_SCAM_DEVICE_NOT_FOUND	(1)
109#define SYMBIOS_SCAM_ID_NOT_SET		(2)
110#define SYMBIOS_SCAM_ID_VALID		(3)
111		u_char	target_id;
112		u_char	rsvd;
113	} scam[4];
114
115	u_char	spare_devices[15*8];
116	u_char	trailer[6];		/* 0xfe 0xfe 0x00 0x00 0x00 0x00 */
117};
118typedef struct Symbios_nvram	Symbios_nvram;
119typedef struct Symbios_host	Symbios_host;
120typedef struct Symbios_target	Symbios_target;
121typedef struct Symbios_scam	Symbios_scam;
122
123/*
124 *	Tekram NvRAM data format.
125 */
126#define TEKRAM_NVRAM_SIZE 64
127#define TEKRAM_93C46_NVRAM_ADDRESS 0
128#define TEKRAM_24C16_NVRAM_ADDRESS 0x40
129
130struct Tekram_nvram {
131	struct Tekram_target {
132		u_char	flags;
133#define	TEKRAM_PARITY_CHECK		(1)
134#define TEKRAM_SYNC_NEGO		(1<<1)
135#define TEKRAM_DISCONNECT_ENABLE	(1<<2)
136#define	TEKRAM_START_CMD		(1<<3)
137#define TEKRAM_TAGGED_COMMANDS		(1<<4)
138#define TEKRAM_WIDE_NEGO		(1<<5)
139		u_char	sync_index;
140		u_short	word2;
141	} target[16];
142	u_char	host_id;
143	u_char	flags;
144#define TEKRAM_MORE_THAN_2_DRIVES	(1)
145#define TEKRAM_DRIVES_SUP_1GB		(1<<1)
146#define	TEKRAM_RESET_ON_POWER_ON	(1<<2)
147#define TEKRAM_ACTIVE_NEGATION		(1<<3)
148#define TEKRAM_IMMEDIATE_SEEK		(1<<4)
149#define	TEKRAM_SCAN_LUNS		(1<<5)
150#define	TEKRAM_REMOVABLE_FLAGS		(3<<6)	/* 0: disable; */
151						/* 1: boot device; 2:all */
152	u_char	boot_delay_index;
153	u_char	max_tags_index;
154	u_short	flags1;
155#define TEKRAM_F2_F6_ENABLED		(1)
156	u_short	spare[29];
157};
158typedef struct Tekram_nvram	Tekram_nvram;
159typedef struct Tekram_target	Tekram_target;
160
161#ifndef CONFIG_PARISC
162struct pdc_initiator { int dummy; };
163#endif
164
165/*
166 *  Union of supported NVRAM formats.
167 */
168struct sym_nvram {
169	int type;
170#define	SYM_SYMBIOS_NVRAM	(1)
171#define	SYM_TEKRAM_NVRAM	(2)
172#define SYM_PARISC_PDC		(3)
173#if SYM_CONF_NVRAM_SUPPORT
174	union {
175		Symbios_nvram Symbios;
176		Tekram_nvram Tekram;
177		struct pdc_initiator parisc;
178	} data;
179#endif
180};
181
182#if SYM_CONF_NVRAM_SUPPORT
183void sym_nvram_setup_host(struct Scsi_Host *shost, struct sym_hcb *np, struct sym_nvram *nvram);
184void sym_nvram_setup_target (struct sym_tcb *tp, int target, struct sym_nvram *nvp);
185int sym_read_nvram (struct sym_device *np, struct sym_nvram *nvp);
186char *sym_nvram_type(struct sym_nvram *nvp);
187#else
188static inline void sym_nvram_setup_host(struct Scsi_Host *shost, struct sym_hcb *np, struct sym_nvram *nvram) { }
189static inline void sym_nvram_setup_target(struct sym_tcb *tp, struct sym_nvram *nvram) { }
190static inline int sym_read_nvram(struct sym_device *np, struct sym_nvram *nvp)
191{
192	nvp->type = 0;
193	return 0;
194}
195static inline char *sym_nvram_type(struct sym_nvram *nvp)
196{
197	return "No NVRAM";
198}
199#endif
200
201#endif /* SYM_NVRAM_H */