source: mainline/boot/genarch/include/ofw.h@ c7afcba7

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since c7afcba7 was 96b02eb9, checked in by Martin Decky <martin@…>, 15 years ago

more unification of basic types

  • use sysarg_t and native_t (unsigned and signed variant) in both kernel and uspace
  • remove ipcarg_t in favour of sysarg_t

(no change in functionality)

  • Property mode set to 100644
File size: 3.9 KB
Line 
1/*
2 * Copyright (c) 2005 Martin Decky
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 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef BOOT_OFW_H_
30#define BOOT_OFW_H_
31
32#include <typedefs.h>
33#include <stdarg.h>
34
35#define MEMMAP_MAX_RECORDS 32
36#define MAX_OFW_ARGS 12
37
38#define OFW_TREE_PATH_MAX_LEN 256
39#define OFW_TREE_PROPERTY_MAX_NAMELEN 32
40#define OFW_TREE_PROPERTY_MAX_VALUELEN 64
41
42typedef sysarg_t ofw_arg_t;
43typedef native_t ofw_ret_t;
44typedef uint32_t ofw_prop_t;
45typedef uint32_t ihandle;
46typedef uint32_t phandle;
47
48/** OpenFirmware command structure
49 *
50 */
51typedef struct {
52 ofw_arg_t service; /**< Command name. */
53 ofw_arg_t nargs; /**< Number of in arguments. */
54 ofw_arg_t nret; /**< Number of out arguments. */
55 ofw_arg_t args[MAX_OFW_ARGS]; /**< List of arguments. */
56} ofw_args_t;
57
58typedef struct {
59 void *start;
60 size_t size;
61} memzone_t;
62
63typedef struct {
64 uint64_t total;
65 size_t cnt;
66 memzone_t zones[MEMMAP_MAX_RECORDS];
67} memmap_t;
68
69typedef struct {
70 uint32_t info;
71 uint32_t addr_hi;
72 uint32_t addr_lo;
73} pci_addr_t;
74
75typedef struct {
76 pci_addr_t addr;
77 uint32_t size_hi;
78 uint32_t size_lo;
79} pci_reg_t;
80
81extern uintptr_t ofw_cif;
82
83extern phandle ofw_chosen;
84extern ihandle ofw_stdout;
85extern phandle ofw_root;
86extern ihandle ofw_mmu;
87extern phandle ofw_memory;
88
89extern void ofw_init(void);
90
91extern void ofw_putchar(const char);
92
93extern ofw_arg_t ofw_get_property(const phandle, const char *, void *,
94 const size_t);
95extern ofw_arg_t ofw_get_proplen(const phandle, const char *);
96extern ofw_arg_t ofw_next_property(const phandle, char *, char *);
97
98extern phandle ofw_get_child_node(const phandle);
99extern phandle ofw_get_peer_node(const phandle);
100extern phandle ofw_find_device(const char *);
101
102extern ofw_arg_t ofw_package_to_path(const phandle, char *, const size_t);
103
104extern ofw_arg_t ofw(ofw_args_t *);
105extern ofw_arg_t ofw_call(const char *, const size_t, const size_t, ofw_arg_t *,
106 ...);
107
108extern size_t ofw_get_address_cells(const phandle);
109extern size_t ofw_get_size_cells(const phandle);
110
111extern void *ofw_translate(const void *);
112
113extern void ofw_claim_virt(const void *, const size_t);
114extern void *ofw_claim_virt_any(const size_t, const size_t);
115
116extern void ofw_claim_phys(const void *, const size_t);
117extern void *ofw_claim_phys_any(const size_t, const size_t);
118
119extern void ofw_map(const void *, const void *, const size_t,
120 const ofw_arg_t);
121
122extern void ofw_alloc(const char *, void **, void **, const size_t, void *);
123
124extern void ofw_memmap(memmap_t *);
125extern void ofw_setup_screens(void);
126extern void ofw_quiesce(void);
127
128#endif
Note: See TracBrowser for help on using the repository browser.