Annotation of sys/arch/hp300/stand/uboot/conf.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: conf.c,v 1.6 2006/08/17 06:31:10 miod Exp $ */
2: /* $NetBSD: conf.c,v 1.12 1996/10/14 07:29:15 thorpej Exp $ */
3:
4: /*
5: * Copyright (c) 1982, 1986, 1990, 1993
6: * The Regents of the University of California. All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
16: * 3. Neither the name of the University nor the names of its contributors
17: * may be used to endorse or promote products derived from this software
18: * without specific prior written permission.
19: *
20: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30: * SUCH DAMAGE.
31: *
32: * @(#)conf.c 8.1 (Berkeley) 6/10/93
33: */
34:
35: #include <sys/param.h>
36:
37: #include <lib/libsa/stand.h>
38:
39: #include "samachdep.h"
40:
41: #include <sys/socket.h>
42: #include <net/if.h>
43: #include <netinet/in.h>
44: #include <netinet/if_ether.h>
45: #include <netinet/in_systm.h>
46:
47: #include <lib/libsa/nfs.h>
48: #include <lib/libsa/cd9660.h>
49: #include <lib/libsa/ufs.h>
50: #include "rawfs.h"
51:
52: int debug = 0; /* XXX */
53:
54: /*
55: * Device configuration
56: */
57: int netstrategy(void *, int, daddr_t, size_t, void *, size_t *);
58: int netopen(struct open_file *, ...);
59: int netclose(struct open_file *);
60: #define netioctl noioctl
61:
62: int ctstrategy(void *, int, daddr_t, size_t, void *, size_t *);
63: int ctopen(struct open_file *, ...);
64: int ctclose(struct open_file *);
65: #define ctioctl noioctl
66:
67: int hdstrategy(void *, int, daddr_t, size_t, void *, size_t *);
68: int hdopen(struct open_file *, ...);
69: int hdclose(struct open_file *);
70: #define hdioctl noioctl
71:
72: int sdstrategy(void *, int, daddr_t, size_t, void *, size_t *);
73: int sdopen(struct open_file *, ...);
74: int sdclose(struct open_file *);
75: #define sdioctl noioctl
76:
77: #define xxstrategy \
78: (int (*)(void *, int, daddr_t, size_t, void *, size_t *))nullsys
79: #define xxopen (int (*)(struct open_file *, ...))nodev
80: #define xxclose (int (*)(struct open_file *))nullsys
81:
82: /*
83: * Note: "le" isn't a major offset.
84: */
85: struct devsw devsw[] = {
86: { "ct", ctstrategy, ctopen, ctclose, ctioctl }, /*0*/
87: { "??", xxstrategy, xxopen, xxclose, noioctl }, /*1*/
88: { "hd", hdstrategy, hdopen, hdclose, hdioctl }, /*2*/
89: { "??", xxstrategy, xxopen, xxclose, noioctl }, /*3*/
90: { "sd", sdstrategy, sdopen, sdclose, sdioctl }, /*4*/
91: { "??", xxstrategy, xxopen, xxclose, noioctl }, /*5*/
92: { "le", netstrategy, netopen, netclose, netioctl },/*6*/
93: };
94: int ndevs = (sizeof(devsw) / sizeof(devsw[0]));
95:
96: extern struct netif_driver le_driver;
97:
98: struct netif_driver *netif_drivers[] = {
99: &le_driver,
100: };
101: int n_netif_drivers = (sizeof(netif_drivers) / sizeof(netif_drivers[0]));
102:
103: /*
104: * Physical unit/lun detection.
105: */
106: int punitzero(int, int, int *);
107:
108: int
109: punitzero(int ctlr, int slave, int *punit)
110: {
111: *punit = 0;
112: return (0);
113: }
114:
115: extern int ctpunit(int, int, int *);
116: #define xxpunit punitzero
117: #define hdpunit punitzero
118: #define sdpunit punitzero
119: #define lepunit punitzero
120:
121: struct punitsw punitsw[] = {
122: { ctpunit },
123: { xxpunit },
124: { hdpunit },
125: { xxpunit },
126: { sdpunit },
127: { xxpunit },
128: { lepunit },
129: };
130: int npunit = (sizeof(punitsw) / sizeof(punitsw[0]));
131:
132: /*
133: * Filesystem configuration
134: */
135: struct fs_ops file_system_rawfs[] = {
136: { rawfs_open, rawfs_close, rawfs_read, rawfs_write, rawfs_seek,
137: rawfs_stat },
138: };
139:
140: struct fs_ops file_system_ufs[] = {
141: { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
142: };
143:
144: struct fs_ops file_system_nfs[] = {
145: { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
146: };
147:
148: struct fs_ops file_system_cd9660[] = {
149: { cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
150: cd9660_stat },
151: };
152:
153: struct fs_ops file_system[2];
154: int nfsys = 1; /* default; changed per device type. */
CVSweb