]> git.saurik.com Git - apple/xnu.git/blob - pexpert/i386/fakePPCStructs.h
32a3d05ff023bd1b463829d65f6a51332f0414c4
[apple/xnu.git] / pexpert / i386 / fakePPCStructs.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
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
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28 #include <pexpert/protos.h>
29 #include <pexpert/boot.h>
30
31 typedef struct {
32 const char * name;
33 unsigned long length;
34 void * value;
35 } prop_init;
36
37 typedef struct {
38 long zero;
39 long nProps;
40 long nChildren;
41 } node_init;
42
43 typedef struct {
44 long one;
45 long * length;
46 long * address;
47 } data_init;
48
49 typedef struct {
50 long two;
51 const char * name;
52 void * data;
53 } string_init;
54
55 typedef union {
56 prop_init propInit;
57 node_init nodeInit;
58 data_init dataInit;
59 string_init stringInit;
60 } dt_init;
61
62 typedef struct {
63 long length;
64 void * address;
65 } dt_data;
66
67 extern boot_args fakePPCBootArgs;
68 extern unsigned char *nptr;
69
70 void printdt(void);
71 void * createdt(dt_init * template, long * retSize);
72
73 #define NODE(props,children) \
74 { .nodeInit = {0, props, children }}
75
76 #define INTPROP(name,value) \
77 { .propInit = {name, 4, (void *)(uintptr_t)value }}
78
79 #define PROP(name,value) \
80 { .propInit = {name, sizeof( value), (void *)(uintptr_t)value }}
81
82 #define STRINGPROP(name,value) \
83 { .stringInit = { 2, name, (void *)&(value) }}
84
85 #define NULLPROP(name) \
86 { propInit = {name, 0, (void *)0 }}
87
88 #define DATAPROP(data) \
89 { .dataInit = {1, &((data).length), (long *) &((data).address) }}
90
91 #define DATANODE(data) \
92 { .dataInit = {1, &((data).length), (long *)&((data).address) }}