03831d35f7499c87d51205817c93e9a8d42c4baestevel * CDDL HEADER START
03831d35f7499c87d51205817c93e9a8d42c4baestevel * The contents of this file are subject to the terms of the
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Common Development and Distribution License, Version 1.0 only
03831d35f7499c87d51205817c93e9a8d42c4baestevel * (the "License"). You may not use this file except in compliance
03831d35f7499c87d51205817c93e9a8d42c4baestevel * with the License.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
03831d35f7499c87d51205817c93e9a8d42c4baestevel * See the License for the specific language governing permissions
03831d35f7499c87d51205817c93e9a8d42c4baestevel * and limitations under the License.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * When distributing Covered Code, include this CDDL HEADER in each
03831d35f7499c87d51205817c93e9a8d42c4baestevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * If applicable, add the following below this CDDL HEADER, with the
03831d35f7499c87d51205817c93e9a8d42c4baestevel * fields enclosed by brackets "[]" replaced with your own identifying
03831d35f7499c87d51205817c93e9a8d42c4baestevel * information: Portions Copyright [yyyy] [name of copyright owner]
03831d35f7499c87d51205817c93e9a8d42c4baestevel * CDDL HEADER END
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Copyright 1999-2003 Sun Microsystems, Inc. All rights reserved.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Use is subject to license terms.
03831d35f7499c87d51205817c93e9a8d42c4baestevel#pragma ident "%Z%%M% %I% %E% SMI"
03831d35f7499c87d51205817c93e9a8d42c4baestevelextern "C" {
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* structures necessary to hold Openprom data */
03831d35f7499c87d51205817c93e9a8d42c4baestevel * 128 is the size of the largest (currently) property name
03831d35f7499c87d51205817c93e9a8d42c4baestevel * 4096 - MAXPROPSIZE - sizeof (int) is the size of the largest
03831d35f7499c87d51205817c93e9a8d42c4baestevel * (currently) property value that is allowed.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * the sizeof (u_int) is from struct openpromio
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define MAXVALSIZE (4096 - MAXPROPSIZE - sizeof (uint_t))
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define BUFSIZE (MAXPROPSIZE + MAXVALSIZE + sizeof (uint_t))
03831d35f7499c87d51205817c93e9a8d42c4baesteveltypedef union {
03831d35f7499c87d51205817c93e9a8d42c4baestevel * The prop structures associated with a Prom_node were formerly statically
03831d35f7499c87d51205817c93e9a8d42c4baestevel * sized - via the buf element of the Oppbuf union. This was highly memory
03831d35f7499c87d51205817c93e9a8d42c4baestevel * inefficient, so dynamic sizing capabilities have been introduced.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * This has been achieved via the creation of dynopenpromio and dynOppbuf
03831d35f7499c87d51205817c93e9a8d42c4baestevel * structs, and altering the prop structure. The prop structure's name and value
03831d35f7499c87d51205817c93e9a8d42c4baestevel * elements are now typed as dynOppbuf instead of Oppbuf.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * For legacy purposes, static_prop has been created. It is essentially the same
03831d35f7499c87d51205817c93e9a8d42c4baestevel * as the former prop structure, but the *next element now points to a
03831d35f7499c87d51205817c93e9a8d42c4baestevel * static_prop structure instead of a prop structure.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * dynopenpromio structs are similar to openpromio structs, but with 2 major
03831d35f7499c87d51205817c93e9a8d42c4baestevel * differences. The first is that the opio_u.b element is char * instead of
03831d35f7499c87d51205817c93e9a8d42c4baestevel * char [], which allows for dynamic sizing.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * The second regards opio_u.i, which was an int, but is now int []. In almost
03831d35f7499c87d51205817c93e9a8d42c4baestevel * all cases, only opio_u.i (opio_u.i[0]) will be referenced. However, certain
03831d35f7499c87d51205817c93e9a8d42c4baestevel * platforms rely on the fact that Prop structures formerly contained Oppbuf
03831d35f7499c87d51205817c93e9a8d42c4baestevel * unions, the buf element of which was statically sized at 4k. In theory, this
03831d35f7499c87d51205817c93e9a8d42c4baestevel * enabled those platforms to validly reference any part of the union up to 4k
03831d35f7499c87d51205817c93e9a8d42c4baestevel * from the start. In reality, no element greater than opio_u.i[4] is currently
03831d35f7499c87d51205817c93e9a8d42c4baestevel * referenced, hence OPROM_NODE_SIZE (named because opio_u.i is usually
03831d35f7499c87d51205817c93e9a8d42c4baestevel * referenced as oprom_node) being set to 5.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * A minor difference is that the holds_array element has been added, which
03831d35f7499c87d51205817c93e9a8d42c4baestevel * affords an easy way to determine whether opio_u contains char * or int.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * dynOppbuf structs are a dynamic alternative to Oppbuf unions. The statically
03831d35f7499c87d51205817c93e9a8d42c4baestevel * sized Oppbuf.buf element has been removed, and the opp element common to both
03831d35f7499c87d51205817c93e9a8d42c4baestevel * is of type struct dynopenpromio instead of struct openpromio. This allows us
03831d35f7499c87d51205817c93e9a8d42c4baestevel * to take advantage of dynopenpromio's dynamic sizing capabilities.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Defines for board types.
03831d35f7499c87d51205817c93e9a8d42c4baestevel Prom_node *boards; /* boards node holds bif info if present */
03831d35f7499c87d51205817c93e9a8d42c4baestevelint do_prominfo(int, char *, int, int);
03831d35f7499c87d51205817c93e9a8d42c4baestevelextern char *badarchmsg;
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* Functions for building the user copy of the device tree. */
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* functions for searching for Prom nodes */
03831d35f7499c87d51205817c93e9a8d42c4baestevelProm_node *dev_find_node_by_type(Prom_node *root, char *type, char *property);
03831d35f7499c87d51205817c93e9a8d42c4baestevelProm_node *dev_next_node_by_type(Prom_node *root, char *type, char *property);
03831d35f7499c87d51205817c93e9a8d42c4baestevelProm_node *dev_find_node_by_compatible(Prom_node *root, char *compat);
03831d35f7499c87d51205817c93e9a8d42c4baestevelProm_node *dev_next_node_by_compatible(Prom_node *root, char *compat);
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* functions for searching for properties, extracting data from them */
03831d35f7499c87d51205817c93e9a8d42c4baestevel#endif /* _PDEVINFO_H */