sdvar.h revision 1.40 1 1.40 mlelstv /* $NetBSD: sdvar.h,v 1.40 2022/08/28 10:26:37 mlelstv Exp $ */
2 1.1 cgd
3 1.7 mycroft /*-
4 1.23 mycroft * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
5 1.7 mycroft * All rights reserved.
6 1.7 mycroft *
7 1.7 mycroft * This code is derived from software contributed to The NetBSD Foundation
8 1.7 mycroft * by Charles M. Hannum.
9 1.1 cgd *
10 1.1 cgd * Redistribution and use in source and binary forms, with or without
11 1.1 cgd * modification, are permitted provided that the following conditions
12 1.1 cgd * are met:
13 1.1 cgd * 1. Redistributions of source code must retain the above copyright
14 1.1 cgd * notice, this list of conditions and the following disclaimer.
15 1.1 cgd * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 cgd * notice, this list of conditions and the following disclaimer in the
17 1.1 cgd * documentation and/or other materials provided with the distribution.
18 1.1 cgd *
19 1.7 mycroft * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.7 mycroft * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.7 mycroft * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.7 mycroft * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.7 mycroft * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.7 mycroft * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.7 mycroft * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.7 mycroft * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.7 mycroft * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.7 mycroft * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.7 mycroft * POSSIBILITY OF SUCH DAMAGE.
30 1.1 cgd */
31 1.1 cgd
32 1.1 cgd /*
33 1.1 cgd * Originally written by Julian Elischer (julian (at) dialix.oz.au)
34 1.1 cgd * for TRW Financial Systems for use under the MACH(2.5) operating system.
35 1.1 cgd *
36 1.1 cgd * TRW Financial Systems, in accordance with their agreement with Carnegie
37 1.1 cgd * Mellon University, makes this software available to CMU to distribute
38 1.1 cgd * or use in any manner that they see fit as long as this message is kept with
39 1.1 cgd * the software. For this reason TFS also grants any other persons or
40 1.1 cgd * organisations permission to use or modify this software.
41 1.1 cgd *
42 1.1 cgd * TFS supplies this software to be publicly redistributed
43 1.1 cgd * on the understanding that TFS is not responsible for the correct
44 1.1 cgd * functioning of this software in any circumstances.
45 1.1 cgd *
46 1.1 cgd * Ported to run under 386BSD by Julian Elischer (julian (at) dialix.oz.au) Sept 1992
47 1.1 cgd */
48 1.11 drochner
49 1.18 matt #ifndef _DEV_SCSIPI_SDVAR_H_
50 1.18 matt #define _DEV_SCSIPI_SDVAR_H_
51 1.18 matt
52 1.37 pooka #ifdef _KERNEL_OPT
53 1.14 mjacob #include "opt_scsi.h"
54 1.37 pooka #endif
55 1.34 tls
56 1.38 mlelstv #include <dev/dkvar.h>
57 1.1 cgd
58 1.14 mjacob #ifndef SDRETRIES
59 1.1 cgd #define SDRETRIES 4
60 1.14 mjacob #endif
61 1.14 mjacob
62 1.14 mjacob #ifndef SD_IO_TIMEOUT
63 1.15 chs #define SD_IO_TIMEOUT (60 * 1000)
64 1.14 mjacob #endif
65 1.1 cgd
66 1.35 matt struct disk_parms {
67 1.35 matt u_long heads; /* number of heads */
68 1.35 matt u_long cyls; /* number of cylinders */
69 1.35 matt u_long sectors; /* number of sectors/track */
70 1.35 matt u_long blksize; /* number of bytes/sector */
71 1.35 matt u_long rot_rate; /* rotational rate, in RPM */
72 1.35 matt u_int64_t disksize; /* total number sectors */
73 1.35 matt u_int64_t disksize512; /* total number sectors */
74 1.35 matt };
75 1.35 matt
76 1.1 cgd struct sd_softc {
77 1.38 mlelstv struct dk_softc sc_dksc;
78 1.1 cgd
79 1.1 cgd int flags;
80 1.1 cgd #define SDF_ANCIENT 0x10 /* disk is ancient; for minphys */
81 1.6 thorpej #define SDF_DIRTY 0x20 /* disk is dirty; needs cache flush */
82 1.6 thorpej #define SDF_FLUSHING 0x40 /* flushing, for sddone() */
83 1.13 bouyer
84 1.13 bouyer struct scsipi_periph *sc_periph;/* contains our targ, lun, etc. */
85 1.13 bouyer
86 1.35 matt struct disk_parms params;
87 1.13 bouyer
88 1.29 ad callout_t sc_callout;
89 1.26 reinoud u_int8_t type;
90 1.5 drochner char name[16]; /* product name, for default disklabel */
91 1.40 mlelstv char typename[16+1]; /* stored in disk info */
92 1.1 cgd };
93 1.1 cgd
94 1.21 wiz #define SDGP_RESULT_OK 0 /* parameters obtained */
95 1.1 cgd #define SDGP_RESULT_OFFLINE 1 /* no media, or otherwise losing */
96 1.1 cgd #define SDGP_RESULT_UNFORMATTED 2 /* unformatted media (max params) */
97 1.18 matt
98 1.18 matt #endif /* _DEV_SCSIPI_SDVAR_H_ */
99