]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/boot/uboot/lib/disk.c
add -n option to suppress clearing the build tree and add -DNO_CLEAN
[FreeBSD/FreeBSD.git] / sys / boot / uboot / lib / disk.c
1 /*-
2  * Copyright (C) 2000 Benno Rice.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #include <sys/cdefs.h>
27 __FBSDID("$FreeBSD$");
28
29 /*
30  * Disk I/O routines using U-Boot - TODO
31  */
32
33 #include <sys/param.h>
34 #include <sys/queue.h>
35
36 #include <netinet/in.h>
37 #include <machine/stdarg.h>
38 #include <stand.h>
39
40 #include "bootstrap.h"
41
42 static int      d_init(void);
43 static int      d_strategy(void *devdata, int flag, daddr_t dblk,
44                     size_t size, char *buf, size_t *rsize);
45 static int      d_open(struct open_file *f, ...);
46 static int      d_close(struct open_file *f);
47 static int      d_ioctl(struct open_file *f, u_long cmd, void *data);
48 static void     d_print(int verbose);
49
50 struct devsw uboot_disk = {
51         "block",
52         DEVT_DISK,
53         d_init,
54         d_strategy,
55         d_open,
56         d_close,
57         d_ioctl,
58         d_print
59 };
60
61 struct opened_dev {
62         u_int                   count;
63         SLIST_ENTRY(opened_dev) link;
64 };
65
66 SLIST_HEAD(, opened_dev) opened_devs = SLIST_HEAD_INITIALIZER(opened_dev);
67
68 static int
69 d_init(void)
70 {
71
72         return 0;
73 }
74
75 static int
76 d_strategy(void *devdata, int flag, daddr_t dblk, size_t size, char *buf,
77     size_t *rsize)
78 {
79
80         return (EINVAL);
81 }
82
83 static int
84 d_open(struct open_file *f, ...)
85 {
86
87         return (EINVAL);
88 }
89
90 static int
91 d_close(struct open_file *f)
92 {
93
94         return (EINVAL);
95 }
96
97 static int
98 d_ioctl(struct open_file *f, u_long cmd, void *data)
99 {
100
101         return (EINVAL);
102 }
103
104 static void
105 d_print(int verbose)
106 {
107
108         return;
109 }