1 /* $NetBSD: mdesc.h,v 1.1 2015/01/10 22:19:26 palle Exp $ */ 2 /* $OpenBSD: mdesc.h,v 1.3 2014/11/30 22:26:14 kettenis Exp $ */ 3 /* 4 * Copyright (c) 2009 Mark Kettenis 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 struct md_header { 20 uint32_t transport_version; 21 uint32_t node_blk_sz; 22 uint32_t name_blk_sz; 23 uint32_t data_blk_sz; 24 }; 25 26 struct md_element { 27 uint8_t tag; 28 uint8_t name_len; 29 uint16_t _reserved_field; 30 uint32_t name_offset; 31 union { 32 struct { 33 uint32_t data_len; 34 uint32_t data_offset; 35 } y; 36 uint64_t val; 37 } d; 38 }; 39 40 #ifdef _KERNEL 41 extern vaddr_t mdesc; 42 extern size_t mdesc_len; 43 44 void mdesc_init(void); 45 uint64_t mdesc_get_prop_val(int, const char *); 46 const char *mdesc_get_prop_str(int, const char *); 47 const char *mdesc_get_prop_data(int, const char *, size_t *); 48 int mdesc_find(const char *, uint64_t); 49 int mdesc_find_child(int, const char *, uint64_t); 50 int mdesc_find_node(const char *); 51 #endif 52