File indexing completed on 2025-05-11 08:24:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #ifndef BOOT_OFW_H_
0030 #define BOOT_OFW_H_
0031
0032 #include <boot/types.h>
0033 #include <stdarg.h>
0034
0035 #define MEMMAP_MAX_RECORDS 32
0036 #define MAX_OFW_ARGS 12
0037
0038 #define OFW_TREE_PATH_MAX_LEN 256
0039 #define OFW_TREE_PROPERTY_MAX_NAMELEN 32
0040 #define OFW_TREE_PROPERTY_MAX_VALUELEN 64
0041
0042 typedef unative_t ofw_arg_t;
0043 typedef unsigned int ihandle;
0044 typedef unsigned int phandle;
0045
0046
0047
0048
0049 typedef struct {
0050 ofw_arg_t service;
0051 ofw_arg_t nargs;
0052 ofw_arg_t nret;
0053 ofw_arg_t args[MAX_OFW_ARGS];
0054 } ofw_args_t;
0055
0056 typedef struct {
0057 void *start;
0058 uint32_t size;
0059 } memzone_t;
0060
0061 typedef struct {
0062 uint32_t total;
0063 uint32_t count;
0064 memzone_t zones[MEMMAP_MAX_RECORDS];
0065 } memmap_t;
0066
0067 typedef struct {
0068 uint32_t info;
0069 uint32_t addr_hi;
0070 uint32_t addr_lo;
0071 } pci_addr_t;
0072
0073 typedef struct {
0074 pci_addr_t addr;
0075 uint32_t size_hi;
0076 uint32_t size_lo;
0077 } pci_reg_t;
0078
0079 extern uintptr_t ofw_cif;
0080
0081 extern phandle ofw_chosen;
0082 extern ihandle ofw_stdout;
0083 extern phandle ofw_root;
0084 extern ihandle ofw_mmu;
0085 extern phandle ofw_memory;
0086
0087 extern void ofw_init(void);
0088
0089 extern void ofw_write(const char *str, const int len);
0090
0091 extern int ofw_get_property(const phandle device, const char *name, void *buf, const int buflen);
0092 extern int ofw_get_proplen(const phandle device, const char *name);
0093 extern int ofw_next_property(const phandle device, char *previous, char *buf);
0094
0095 extern phandle ofw_get_child_node(const phandle node);
0096 extern phandle ofw_get_peer_node(const phandle node);
0097 extern phandle ofw_find_device(const char *name);
0098
0099 extern int ofw_package_to_path(const phandle device, char *buf, const int buflen);
0100
0101 extern int ofw(ofw_args_t *arg);
0102 extern unsigned long ofw_call(const char *service, const int nargs, const int nret, ofw_arg_t *rets, ...);
0103 extern void ofw_write(const char *str, const int len);
0104 extern void ofw_read(void *str, const int len);
0105 extern unsigned int ofw_get_address_cells(const phandle device);
0106 extern unsigned int ofw_get_size_cells(const phandle device);
0107 extern void *ofw_translate(const void *virt);
0108 extern int ofw_translate_failed(ofw_arg_t flag);
0109 extern void *ofw_claim_virt(const void *virt, const unsigned int len);
0110 extern void *ofw_claim_phys(const void *virt, const unsigned int len);
0111 extern void *ofw_claim_phys_any(const unsigned int len, const unsigned int alignment);
0112 extern int ofw_map(const void *phys, const void *virt, const unsigned int size, const int mode);
0113 extern int ofw_memmap(memmap_t *map);
0114 extern void ofw_setup_screens(void);
0115 extern void ofw_quiesce(void);
0116
0117 #endif