2 * Copyright (c) 2009 The DragonFly Project. All rights reserved.
4 * This code is derived from software contributed to The DragonFly Project
5 * by Matthew Dillon <dillon@backplane.com>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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
15 * the documentation and/or other materials provided with the
17 * 3. Neither the name of The DragonFly Project nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific, prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * boot2 encapsulated ABI. The boot2 standalone code provides these functions
36 * to the boot2 add-on modules (ufsread.c and hammerread.c).
39 #ifndef _BOOT_COMMON_BOOT2_H_
40 #define _BOOT_COMMON_BOOT2_H_
43 #include <sys/param.h>
44 #include <sys/dtype.h>
45 #include <sys/dirent.h>
49 #include <machine/bootinfo.h>
50 #include <machine/elf.h>
53 * We only need a 32 bit ino_t for UFS-only boot code. We have to squeeze
54 * space usage, else we'd just use 64 bits across the board.
57 typedef uint64_t boot2_ino_t
;
59 typedef uint32_t boot2_ino_t
;
64 boot2_ino_t (*fslookup
)(const char *);
65 ssize_t (*fsread
)(boot2_ino_t
, void *, size_t);
69 char secbuf
[DEV_BSIZE
];
70 /* extended by *fsread() modules */
73 extern uint32_t fs_off
;
76 extern struct boot2_dmadat
*boot2_dmadat
;
78 extern int dskread(void *, unsigned, unsigned);
79 extern void printf(const char *,...);
80 extern void putchar(int);
81 extern int strcmp(const char *s1
, const char *s2
);
82 extern void memcpy(void *d
, const void *s
, int len
);
85 extern const struct boot2_fsapi boot2_ufs_api
;
88 extern const struct boot2_fsapi boot2_hammer_api
;