17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 53b133becSGangadhar Mylapuram * Common Development and Distribution License (the "License"). 63b133becSGangadhar Mylapuram * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 223b133becSGangadhar Mylapuram * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 24*9cb0a1d4SPeter Tribble * Copyright 2019 Peter Tribble. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _SYS_OPENPROMIO_H 287c478bd9Sstevel@tonic-gate #define _SYS_OPENPROMIO_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate /* From SunOS 4.1.1 <sundev/openpromio.h> */ 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #ifdef __cplusplus 337c478bd9Sstevel@tonic-gate extern "C" { 347c478bd9Sstevel@tonic-gate #endif 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate /* 377c478bd9Sstevel@tonic-gate * XXX HACK ALERT 387c478bd9Sstevel@tonic-gate * 397c478bd9Sstevel@tonic-gate * You might think that this interface could support setting non-ASCII 407c478bd9Sstevel@tonic-gate * property values. Unfortunately the 4.0.3c openprom driver SETOPT 417c478bd9Sstevel@tonic-gate * code ignores oprom_size and uses strlen() to compute the length of 427c478bd9Sstevel@tonic-gate * the value. The 4.0.3c openprom eeprom command makes its contribution 437c478bd9Sstevel@tonic-gate * by not setting oprom_size to anything meaningful. So, if we want the 447c478bd9Sstevel@tonic-gate * driver to trust oprom_size we have to use SETOPT2. XXX. 457c478bd9Sstevel@tonic-gate */ 467c478bd9Sstevel@tonic-gate struct openpromio { 477c478bd9Sstevel@tonic-gate uint_t oprom_size; /* real size of following array */ 487c478bd9Sstevel@tonic-gate union { 497c478bd9Sstevel@tonic-gate char b[1]; /* For property names and values */ 507c478bd9Sstevel@tonic-gate /* NB: Adjacent, Null terminated */ 517c478bd9Sstevel@tonic-gate int i; 527c478bd9Sstevel@tonic-gate } opio_u; 537c478bd9Sstevel@tonic-gate }; 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate #define oprom_array opio_u.b 567c478bd9Sstevel@tonic-gate #define oprom_node opio_u.i 577c478bd9Sstevel@tonic-gate #define oprom_len opio_u.i 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate /* 607c478bd9Sstevel@tonic-gate * OPROMMAXPARAM is used as a limit by the driver, and it has been 617c478bd9Sstevel@tonic-gate * increased to be 4 times the largest possible size of a property, 627c478bd9Sstevel@tonic-gate * which is 8K (nvramrc property). 637c478bd9Sstevel@tonic-gate */ 647c478bd9Sstevel@tonic-gate #define OPROMMAXPARAM 32768 /* max size of array */ 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate /* 677c478bd9Sstevel@tonic-gate * Note that all OPROM ioctl codes are type void. Since the amount 687c478bd9Sstevel@tonic-gate * of data copied in/out may (and does) vary, the openprom driver 697c478bd9Sstevel@tonic-gate * handles the copyin/copyout itself. 707c478bd9Sstevel@tonic-gate */ 717c478bd9Sstevel@tonic-gate #define OIOC ('O'<<8) 727c478bd9Sstevel@tonic-gate #define OPROMGETOPT (OIOC | 1) 737c478bd9Sstevel@tonic-gate #define OPROMSETOPT (OIOC | 2) 747c478bd9Sstevel@tonic-gate #define OPROMNXTOPT (OIOC | 3) 757c478bd9Sstevel@tonic-gate #define OPROMSETOPT2 (OIOC | 4) /* working OPROMSETOPT */ 767c478bd9Sstevel@tonic-gate #define OPROMNEXT (OIOC | 5) /* interface to raw config_ops */ 777c478bd9Sstevel@tonic-gate #define OPROMCHILD (OIOC | 6) /* interface to raw config_ops */ 787c478bd9Sstevel@tonic-gate #define OPROMGETPROP (OIOC | 7) /* interface to raw config_ops */ 797c478bd9Sstevel@tonic-gate #define OPROMNXTPROP (OIOC | 8) /* interface to raw config_ops */ 807c478bd9Sstevel@tonic-gate #define OPROMU2P (OIOC | 9) /* NOT SUPPORTED after 4.x */ 817c478bd9Sstevel@tonic-gate #define OPROMGETCONS (OIOC | 10) /* enquire which console device */ 827c478bd9Sstevel@tonic-gate #define OPROMGETFBNAME (OIOC | 11) /* Frame buffer OBP pathname */ 837c478bd9Sstevel@tonic-gate #define OPROMGETBOOTARGS (OIOC | 12) /* Get boot arguments */ 847c478bd9Sstevel@tonic-gate #define OPROMGETVERSION (OIOC | 13) /* Get OpenProm Version string */ 857c478bd9Sstevel@tonic-gate #define OPROMPATH2DRV (OIOC | 14) /* Convert prom path to driver name */ 867c478bd9Sstevel@tonic-gate #define OPROMDEV2PROMNAME (OIOC | 15) /* Convert devfs path to prom path */ 877c478bd9Sstevel@tonic-gate #define OPROMPROM2DEVNAME (OIOC | 16) /* Convert devfs path to prom path */ 887c478bd9Sstevel@tonic-gate #define OPROMGETPROPLEN (OIOC | 17) /* interface to raw config_ops */ 89*9cb0a1d4SPeter Tribble #define OPROMREADY64 (OIOC | 18) /* DEPRECATED is prom 64-bit ready? */ 907c478bd9Sstevel@tonic-gate #define OPROMSETNODEID (OIOC | 19) /* set current node_id */ 917c478bd9Sstevel@tonic-gate #define OPROMSNAPSHOT (OIOC | 20) /* create a snapshot */ 927c478bd9Sstevel@tonic-gate #define OPROMCOPYOUT (OIOC | 21) /* copyout and free snapshot */ 937c478bd9Sstevel@tonic-gate #define OPROMLISTKEYS (OIOC | 22) /* asr-list-keys */ 947c478bd9Sstevel@tonic-gate #define OPROMLISTKEYSLEN (OIOC | 23) /* asr-list-keys-len */ 957c478bd9Sstevel@tonic-gate #define OPROMEXPORT (OIOC | 24) /* asr-export */ 967c478bd9Sstevel@tonic-gate #define OPROMEXPORTLEN (OIOC | 25) /* asr-export-len */ 973b133becSGangadhar Mylapuram #define OPROMGETBOOTPATH (OIOC | 26) /* Get bootpath */ 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate /* 1007c478bd9Sstevel@tonic-gate * Return values from OPROMGETCONS: 1017c478bd9Sstevel@tonic-gate */ 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate #define OPROMCONS_NOT_WSCONS 0 1047c478bd9Sstevel@tonic-gate #define OPROMCONS_STDIN_IS_KBD 0x1 /* stdin device is kbd */ 1057c478bd9Sstevel@tonic-gate #define OPROMCONS_STDOUT_IS_FB 0x2 /* stdout is a framebuffer */ 1067c478bd9Sstevel@tonic-gate #define OPROMCONS_OPENPROM 0x4 /* supports openboot */ 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1097c478bd9Sstevel@tonic-gate } 1107c478bd9Sstevel@tonic-gate #endif 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate #endif /* _SYS_OPENPROMIO_H */ 113