1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 1989-2000, 2003 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _SYS_OPENPROMIO_H 28*0Sstevel@tonic-gate #define _SYS_OPENPROMIO_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate /* From SunOS 4.1.1 <sundev/openpromio.h> */ 32*0Sstevel@tonic-gate 33*0Sstevel@tonic-gate #ifdef __cplusplus 34*0Sstevel@tonic-gate extern "C" { 35*0Sstevel@tonic-gate #endif 36*0Sstevel@tonic-gate 37*0Sstevel@tonic-gate /* 38*0Sstevel@tonic-gate * XXX HACK ALERT 39*0Sstevel@tonic-gate * 40*0Sstevel@tonic-gate * You might think that this interface could support setting non-ASCII 41*0Sstevel@tonic-gate * property values. Unfortunately the 4.0.3c openprom driver SETOPT 42*0Sstevel@tonic-gate * code ignores oprom_size and uses strlen() to compute the length of 43*0Sstevel@tonic-gate * the value. The 4.0.3c openprom eeprom command makes its contribution 44*0Sstevel@tonic-gate * by not setting oprom_size to anything meaningful. So, if we want the 45*0Sstevel@tonic-gate * driver to trust oprom_size we have to use SETOPT2. XXX. 46*0Sstevel@tonic-gate */ 47*0Sstevel@tonic-gate struct openpromio { 48*0Sstevel@tonic-gate uint_t oprom_size; /* real size of following array */ 49*0Sstevel@tonic-gate union { 50*0Sstevel@tonic-gate char b[1]; /* For property names and values */ 51*0Sstevel@tonic-gate /* NB: Adjacent, Null terminated */ 52*0Sstevel@tonic-gate int i; 53*0Sstevel@tonic-gate } opio_u; 54*0Sstevel@tonic-gate }; 55*0Sstevel@tonic-gate 56*0Sstevel@tonic-gate #define oprom_array opio_u.b 57*0Sstevel@tonic-gate #define oprom_node opio_u.i 58*0Sstevel@tonic-gate #define oprom_len opio_u.i 59*0Sstevel@tonic-gate 60*0Sstevel@tonic-gate /* 61*0Sstevel@tonic-gate * OPROMMAXPARAM is used as a limit by the driver, and it has been 62*0Sstevel@tonic-gate * increased to be 4 times the largest possible size of a property, 63*0Sstevel@tonic-gate * which is 8K (nvramrc property). 64*0Sstevel@tonic-gate */ 65*0Sstevel@tonic-gate #define OPROMMAXPARAM 32768 /* max size of array */ 66*0Sstevel@tonic-gate 67*0Sstevel@tonic-gate /* 68*0Sstevel@tonic-gate * Note that all OPROM ioctl codes are type void. Since the amount 69*0Sstevel@tonic-gate * of data copied in/out may (and does) vary, the openprom driver 70*0Sstevel@tonic-gate * handles the copyin/copyout itself. 71*0Sstevel@tonic-gate */ 72*0Sstevel@tonic-gate #define OIOC ('O'<<8) 73*0Sstevel@tonic-gate #define OPROMGETOPT (OIOC | 1) 74*0Sstevel@tonic-gate #define OPROMSETOPT (OIOC | 2) 75*0Sstevel@tonic-gate #define OPROMNXTOPT (OIOC | 3) 76*0Sstevel@tonic-gate #define OPROMSETOPT2 (OIOC | 4) /* working OPROMSETOPT */ 77*0Sstevel@tonic-gate #define OPROMNEXT (OIOC | 5) /* interface to raw config_ops */ 78*0Sstevel@tonic-gate #define OPROMCHILD (OIOC | 6) /* interface to raw config_ops */ 79*0Sstevel@tonic-gate #define OPROMGETPROP (OIOC | 7) /* interface to raw config_ops */ 80*0Sstevel@tonic-gate #define OPROMNXTPROP (OIOC | 8) /* interface to raw config_ops */ 81*0Sstevel@tonic-gate #define OPROMU2P (OIOC | 9) /* NOT SUPPORTED after 4.x */ 82*0Sstevel@tonic-gate #define OPROMGETCONS (OIOC | 10) /* enquire which console device */ 83*0Sstevel@tonic-gate #define OPROMGETFBNAME (OIOC | 11) /* Frame buffer OBP pathname */ 84*0Sstevel@tonic-gate #define OPROMGETBOOTARGS (OIOC | 12) /* Get boot arguments */ 85*0Sstevel@tonic-gate #define OPROMGETVERSION (OIOC | 13) /* Get OpenProm Version string */ 86*0Sstevel@tonic-gate #define OPROMPATH2DRV (OIOC | 14) /* Convert prom path to driver name */ 87*0Sstevel@tonic-gate #define OPROMDEV2PROMNAME (OIOC | 15) /* Convert devfs path to prom path */ 88*0Sstevel@tonic-gate #define OPROMPROM2DEVNAME (OIOC | 16) /* Convert devfs path to prom path */ 89*0Sstevel@tonic-gate #define OPROMGETPROPLEN (OIOC | 17) /* interface to raw config_ops */ 90*0Sstevel@tonic-gate #define OPROMREADY64 (OIOC | 18) /* is prom 64-bit ready? */ 91*0Sstevel@tonic-gate #define OPROMSETNODEID (OIOC | 19) /* set current node_id */ 92*0Sstevel@tonic-gate #define OPROMSNAPSHOT (OIOC | 20) /* create a snapshot */ 93*0Sstevel@tonic-gate #define OPROMCOPYOUT (OIOC | 21) /* copyout and free snapshot */ 94*0Sstevel@tonic-gate #define OPROMLISTKEYS (OIOC | 22) /* asr-list-keys */ 95*0Sstevel@tonic-gate #define OPROMLISTKEYSLEN (OIOC | 23) /* asr-list-keys-len */ 96*0Sstevel@tonic-gate #define OPROMEXPORT (OIOC | 24) /* asr-export */ 97*0Sstevel@tonic-gate #define OPROMEXPORTLEN (OIOC | 25) /* asr-export-len */ 98*0Sstevel@tonic-gate 99*0Sstevel@tonic-gate /* 100*0Sstevel@tonic-gate * Return values from OPROMGETCONS: 101*0Sstevel@tonic-gate */ 102*0Sstevel@tonic-gate 103*0Sstevel@tonic-gate #define OPROMCONS_NOT_WSCONS 0 104*0Sstevel@tonic-gate #define OPROMCONS_STDIN_IS_KBD 0x1 /* stdin device is kbd */ 105*0Sstevel@tonic-gate #define OPROMCONS_STDOUT_IS_FB 0x2 /* stdout is a framebuffer */ 106*0Sstevel@tonic-gate #define OPROMCONS_OPENPROM 0x4 /* supports openboot */ 107*0Sstevel@tonic-gate 108*0Sstevel@tonic-gate #if defined(__sparc) 109*0Sstevel@tonic-gate 110*0Sstevel@tonic-gate /* 111*0Sstevel@tonic-gate * Data structure returned in oprom_array, from OPROMREADY64: 112*0Sstevel@tonic-gate * 113*0Sstevel@tonic-gate * With return codes 1 and 2, also returns nodeid, a nodeid 114*0Sstevel@tonic-gate * of a flashprom node, and a message string with the minimum version 115*0Sstevel@tonic-gate * requirement for this platform. 116*0Sstevel@tonic-gate */ 117*0Sstevel@tonic-gate struct openprom_opr64 { 118*0Sstevel@tonic-gate int return_code; /* See below */ 119*0Sstevel@tonic-gate int nodeid; /* Valid with positive return codes */ 120*0Sstevel@tonic-gate char message[1]; /* NULL terminated message string */ 121*0Sstevel@tonic-gate }; 122*0Sstevel@tonic-gate 123*0Sstevel@tonic-gate /* 124*0Sstevel@tonic-gate * return_code values from OPROMREADY64: 125*0Sstevel@tonic-gate */ 126*0Sstevel@tonic-gate #define OP64R_READY 0 /* ready or not applicable */ 127*0Sstevel@tonic-gate #define OP64R_UPGRADE_REQUIRED 1 /* Upgrade required */ 128*0Sstevel@tonic-gate #define OP64R_UPGRADE_RECOMMENDED 2 /* Upgrade recommended */ 129*0Sstevel@tonic-gate 130*0Sstevel@tonic-gate #endif 131*0Sstevel@tonic-gate 132*0Sstevel@tonic-gate #ifdef __cplusplus 133*0Sstevel@tonic-gate } 134*0Sstevel@tonic-gate #endif 135*0Sstevel@tonic-gate 136*0Sstevel@tonic-gate #endif /* _SYS_OPENPROMIO_H */ 137