]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
8f6c56a5 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
1c79356b | 5 | * |
8f6c56a5 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
14 | * | |
15 | * Please obtain a copy of the License at | |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
23 | * Please see the License for the specific language governing rights and | |
8ad349bb | 24 | * limitations under the License. |
8f6c56a5 A |
25 | * |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ | |
1c79356b A |
27 | */ |
28 | #include <pexpert/protos.h> | |
29 | #include <pexpert/boot.h> | |
30 | ||
31 | typedef struct { | |
91447636 | 32 | const char * name; |
0b4e3aa0 A |
33 | unsigned long length; |
34 | void * value; | |
1c79356b A |
35 | } prop_init; |
36 | ||
37 | typedef struct { | |
0b4e3aa0 A |
38 | long zero; |
39 | long nProps; | |
40 | long nChildren; | |
1c79356b A |
41 | } node_init; |
42 | ||
0b4e3aa0 A |
43 | typedef struct { |
44 | long one; | |
45 | long * length; | |
46 | long * address; | |
47 | } data_init; | |
48 | ||
91447636 A |
49 | typedef struct { |
50 | long two; | |
51 | const char * name; | |
52 | void * data; | |
53 | } string_init; | |
54 | ||
1c79356b | 55 | typedef union { |
0b4e3aa0 A |
56 | prop_init propInit; |
57 | node_init nodeInit; | |
58 | data_init dataInit; | |
91447636 | 59 | string_init stringInit; |
1c79356b A |
60 | } dt_init; |
61 | ||
0b4e3aa0 A |
62 | typedef struct { |
63 | long length; | |
91447636 | 64 | void * address; |
0b4e3aa0 A |
65 | } dt_data; |
66 | ||
1c79356b A |
67 | extern boot_args fakePPCBootArgs; |
68 | extern unsigned char *nptr; | |
69 | ||
0b4e3aa0 A |
70 | void printdt(void); |
71 | void * createdt(dt_init * template, long * retSize); | |
1c79356b | 72 | |
0b4e3aa0 | 73 | #define NODE(props,children) \ |
91447636 | 74 | { .nodeInit = {0, props, children }} |
1c79356b | 75 | |
0b4e3aa0 | 76 | #define INTPROP(name,value) \ |
91447636 | 77 | { .propInit = {name, 4, (void *)(uintptr_t)value }} |
1c79356b | 78 | |
0b4e3aa0 | 79 | #define PROP(name,value) \ |
91447636 A |
80 | { .propInit = {name, sizeof( value), (void *)(uintptr_t)value }} |
81 | ||
82 | #define STRINGPROP(name,value) \ | |
83 | { .stringInit = { 2, name, (void *)&(value) }} | |
1c79356b | 84 | |
0b4e3aa0 | 85 | #define NULLPROP(name) \ |
91447636 | 86 | { propInit = {name, 0, (void *)0 }} |
1c79356b | 87 | |
0b4e3aa0 | 88 | #define DATAPROP(data) \ |
91447636 | 89 | { .dataInit = {1, &((data).length), (long *) &((data).address) }} |
0b4e3aa0 A |
90 | |
91 | #define DATANODE(data) \ | |
91447636 | 92 | { .dataInit = {1, &((data).length), (long *)&((data).address) }} |