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