Deleted Added
full compact
libi386.h (162814) libi386.h (163897)
1/*-
2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
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 THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
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 THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/boot/i386/libi386/libi386.h 162814 2006-09-29 20:27:41Z ru $
26 * $FreeBSD: head/sys/boot/i386/libi386/libi386.h 163897 2006-11-02 01:23:18Z marcel $
27 */
28
29
30/*
31 * i386 fully-qualified device descriptor.
32 * Note, this must match the 'struct devdesc' declaration
33 * in bootstrap.h.
34 */
35struct i386_devdesc
36{
37 struct devsw *d_dev;
38 int d_type;
27 */
28
29
30/*
31 * i386 fully-qualified device descriptor.
32 * Note, this must match the 'struct devdesc' declaration
33 * in bootstrap.h.
34 */
35struct i386_devdesc
36{
37 struct devsw *d_dev;
38 int d_type;
39 int d_unit;
39 union
40 {
41 struct
42 {
40 union
41 {
42 struct
43 {
43 int unit;
44 void *data;
44 int slice;
45 int partition;
45 int slice;
46 int partition;
46 void *data;
47 } biosdisk;
48 struct
49 {
47 } biosdisk;
48 struct
49 {
50 int unit;
51 void *data;
52 } bioscd;
50 void *data;
51 } bioscd;
53 struct
54 {
55 int unit; /* XXX net layer lives over these? */
56 } netif;
57 } d_kind;
58};
59
60int i386_getdev(void **vdev, const char *devspec, const char **path);
61char *i386_fmtdev(void *vdev);
62int i386_setcurrdev(struct env_var *ev, int flags, const void *value);
63
64extern struct devdesc currdev; /* our current device */
65
66#define MAXDEV 31 /* maximum number of distinct devices */
67
68/* exported devices XXX rename? */
69extern struct devsw bioscd;
70extern struct devsw biosdisk;
71extern struct devsw pxedisk;
72extern struct fs_ops pxe_fsops;
73
74int bc_add(int biosdev); /* Register CD booted from. */
75int bc_getdev(struct i386_devdesc *dev); /* return dev_t for (dev) */
76int bc_bios2unit(int biosdev); /* xlate BIOS device -> bioscd unit */
77int bc_unit2bios(int unit); /* xlate bioscd unit -> BIOS device */
78u_int32_t bd_getbigeom(int bunit); /* return geometry in bootinfo format */
79int bd_bios2unit(int biosdev); /* xlate BIOS device -> biosdisk unit */
80int bd_unit2bios(int unit); /* xlate biosdisk unit -> BIOS device */
81int bd_getdev(struct i386_devdesc *dev); /* return dev_t for (dev) */
82
83ssize_t i386_copyin(const void *src, vm_offset_t dest, const size_t len);
84ssize_t i386_copyout(const vm_offset_t src, void *dest, const size_t len);
85ssize_t i386_readin(const int fd, vm_offset_t dest, const size_t len);
86
87struct preloaded_file;
88void bios_addsmapdata(struct preloaded_file *);
89void bios_getsmap(void);
90
91void bios_getmem(void);
92extern u_int32_t bios_basemem; /* base memory in bytes */
93extern u_int32_t bios_extmem; /* extended memory in bytes */
94extern vm_offset_t memtop; /* last address of physical memory + 1 */
95extern vm_offset_t memtop_copyin; /* memtop less heap size for the cases */
96 /* when heap is at the top of extended memory */
97 /* for other cases - just the same as memtop */
98
99int biospci_find_devclass(uint32_t class, int index, uint32_t *locator);
100int biospci_write_config(uint32_t locator, int offset, int width, uint32_t val);
101int biospci_read_config(uint32_t locator, int offset, int width, uint32_t *val);
102
103void biosacpi_detect(void);
104
105void smbios_detect(void);
106
107int i386_autoload(void);
108
109int bi_getboothowto(char *kargs);
110void bi_setboothowto(int howto);
111vm_offset_t bi_copyenv(vm_offset_t addr);
112int bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip,
113 vm_offset_t *modulep, vm_offset_t *kernend);
114int bi_load64(char *args, vm_offset_t *modulep, vm_offset_t *kernend);
115
116void pxe_enable(void *pxeinfo);
52 } d_kind;
53};
54
55int i386_getdev(void **vdev, const char *devspec, const char **path);
56char *i386_fmtdev(void *vdev);
57int i386_setcurrdev(struct env_var *ev, int flags, const void *value);
58
59extern struct devdesc currdev; /* our current device */
60
61#define MAXDEV 31 /* maximum number of distinct devices */
62
63/* exported devices XXX rename? */
64extern struct devsw bioscd;
65extern struct devsw biosdisk;
66extern struct devsw pxedisk;
67extern struct fs_ops pxe_fsops;
68
69int bc_add(int biosdev); /* Register CD booted from. */
70int bc_getdev(struct i386_devdesc *dev); /* return dev_t for (dev) */
71int bc_bios2unit(int biosdev); /* xlate BIOS device -> bioscd unit */
72int bc_unit2bios(int unit); /* xlate bioscd unit -> BIOS device */
73u_int32_t bd_getbigeom(int bunit); /* return geometry in bootinfo format */
74int bd_bios2unit(int biosdev); /* xlate BIOS device -> biosdisk unit */
75int bd_unit2bios(int unit); /* xlate biosdisk unit -> BIOS device */
76int bd_getdev(struct i386_devdesc *dev); /* return dev_t for (dev) */
77
78ssize_t i386_copyin(const void *src, vm_offset_t dest, const size_t len);
79ssize_t i386_copyout(const vm_offset_t src, void *dest, const size_t len);
80ssize_t i386_readin(const int fd, vm_offset_t dest, const size_t len);
81
82struct preloaded_file;
83void bios_addsmapdata(struct preloaded_file *);
84void bios_getsmap(void);
85
86void bios_getmem(void);
87extern u_int32_t bios_basemem; /* base memory in bytes */
88extern u_int32_t bios_extmem; /* extended memory in bytes */
89extern vm_offset_t memtop; /* last address of physical memory + 1 */
90extern vm_offset_t memtop_copyin; /* memtop less heap size for the cases */
91 /* when heap is at the top of extended memory */
92 /* for other cases - just the same as memtop */
93
94int biospci_find_devclass(uint32_t class, int index, uint32_t *locator);
95int biospci_write_config(uint32_t locator, int offset, int width, uint32_t val);
96int biospci_read_config(uint32_t locator, int offset, int width, uint32_t *val);
97
98void biosacpi_detect(void);
99
100void smbios_detect(void);
101
102int i386_autoload(void);
103
104int bi_getboothowto(char *kargs);
105void bi_setboothowto(int howto);
106vm_offset_t bi_copyenv(vm_offset_t addr);
107int bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip,
108 vm_offset_t *modulep, vm_offset_t *kernend);
109int bi_load64(char *args, vm_offset_t *modulep, vm_offset_t *kernend);
110
111void pxe_enable(void *pxeinfo);