bootinfo.h revision 1.9 1 1.9 phx /* $NetBSD: bootinfo.h,v 1.9 2015/09/30 14:14:32 phx Exp $ */
2 1.1 briggs
3 1.1 briggs /*
4 1.1 briggs * Copyright (c) 1997
5 1.1 briggs * Matthias Drochner. All rights reserved.
6 1.1 briggs *
7 1.1 briggs * Redistribution and use in source and binary forms, with or without
8 1.1 briggs * modification, are permitted provided that the following conditions
9 1.1 briggs * are met:
10 1.1 briggs * 1. Redistributions of source code must retain the above copyright
11 1.1 briggs * notice, this list of conditions and the following disclaimer.
12 1.1 briggs * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 briggs * notice, this list of conditions and the following disclaimer in the
14 1.1 briggs * documentation and/or other materials provided with the distribution.
15 1.1 briggs *
16 1.1 briggs * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 1.1 briggs * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 1.1 briggs * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 1.1 briggs * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 1.1 briggs * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 1.1 briggs * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 1.1 briggs * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 1.1 briggs * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 1.1 briggs * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 1.1 briggs * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 1.1 briggs *
27 1.1 briggs */
28 1.1 briggs
29 1.1 briggs #ifndef _MACHINE_BOOTINFO_H_
30 1.4 garbled #define _MACHINE_BOOTINFO_H_
31 1.4 garbled
32 1.4 garbled #define BOOTINFO_MAGIC 0xb007babe
33 1.1 briggs
34 1.1 briggs struct btinfo_common {
35 1.1 briggs int next; /* offset of next item, or zero */
36 1.1 briggs int type;
37 1.1 briggs };
38 1.1 briggs
39 1.4 garbled #define BTINFO_MAGIC 1
40 1.4 garbled #define BTINFO_MEMORY 2
41 1.4 garbled #define BTINFO_CONSOLE 3
42 1.4 garbled #define BTINFO_CLOCK 4
43 1.4 garbled #define BTINFO_BOOTPATH 5
44 1.4 garbled #define BTINFO_ROOTDEVICE 6
45 1.5 phx #define BTINFO_NET 7
46 1.7 phx #define BTINFO_PRODFAMILY 8
47 1.8 nisimura #define BTINFO_MODULELIST 9
48 1.9 phx #define BTINFO_MODEL 10
49 1.4 garbled
50 1.4 garbled struct btinfo_magic {
51 1.4 garbled struct btinfo_common common;
52 1.4 garbled unsigned magic;
53 1.4 garbled };
54 1.1 briggs
55 1.1 briggs struct btinfo_memory {
56 1.1 briggs struct btinfo_common common;
57 1.1 briggs int memsize;
58 1.1 briggs };
59 1.1 briggs
60 1.1 briggs struct btinfo_console {
61 1.1 briggs struct btinfo_common common;
62 1.4 garbled char devname[8];
63 1.1 briggs int addr;
64 1.1 briggs int speed;
65 1.1 briggs };
66 1.1 briggs
67 1.1 briggs struct btinfo_clock {
68 1.1 briggs struct btinfo_common common;
69 1.1 briggs int ticks_per_sec;
70 1.1 briggs };
71 1.1 briggs
72 1.4 garbled struct btinfo_bootpath {
73 1.4 garbled struct btinfo_common common;
74 1.4 garbled char bootpath[80];
75 1.4 garbled };
76 1.4 garbled
77 1.4 garbled struct btinfo_rootdevice {
78 1.4 garbled struct btinfo_common common;
79 1.4 garbled char devname[16];
80 1.4 garbled unsigned cookie;
81 1.4 garbled };
82 1.4 garbled
83 1.5 phx struct btinfo_net {
84 1.5 phx struct btinfo_common common;
85 1.5 phx char devname[16];
86 1.6 phx unsigned cookie;
87 1.5 phx uint8_t mac_address[6];
88 1.5 phx };
89 1.5 phx
90 1.7 phx struct btinfo_prodfamily {
91 1.7 phx struct btinfo_common common;
92 1.7 phx char name[24];
93 1.7 phx };
94 1.7 phx
95 1.9 phx struct btinfo_model {
96 1.9 phx struct btinfo_common common;
97 1.9 phx char name[28];
98 1.9 phx unsigned flags; /* model specific flags */
99 1.9 phx /* Synology flags: */
100 1.9 phx #define BI_MODEL_CPLDVER_MASK 0x07
101 1.9 phx #define BI_MODEL_CPLD207 0x08
102 1.9 phx #define BI_MODEL_CPLD209 0x10
103 1.9 phx #define BI_MODEL_CPLD406 0x18
104 1.9 phx #define BI_MODEL_CPLD407 0x20
105 1.9 phx #define BI_MODEL_CPLD_MASK 0x38
106 1.9 phx #define BI_MODEL_THERMAL 0x40
107 1.9 phx };
108 1.9 phx
109 1.8 nisimura struct btinfo_modulelist {
110 1.8 nisimura struct btinfo_common common;
111 1.8 nisimura int num;
112 1.8 nisimura uint32_t endpa;
113 1.8 nisimura /* bi_modulelist_entry follows as an array */
114 1.8 nisimura };
115 1.8 nisimura
116 1.8 nisimura struct bi_modulelist_entry {
117 1.8 nisimura char kmod[80];
118 1.8 nisimura int type;
119 1.8 nisimura #define BI_MODULE_NONE 0x00
120 1.8 nisimura #define BI_MODULE_ELF 0x01
121 1.8 nisimura int len;
122 1.8 nisimura uint32_t base;
123 1.8 nisimura };
124 1.8 nisimura
125 1.4 garbled #define BOOTINFO_MAXSIZE 4096
126 1.4 garbled
127 1.1 briggs #ifdef _KERNEL
128 1.4 garbled void *lookup_bootinfo(int);
129 1.1 briggs #endif
130 1.1 briggs
131 1.1 briggs #endif /* _MACHINE_BOOTINFO_H_ */
132