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 5*7aadd8d4Skini * Common Development and Distribution License (the "License"). 6*7aadd8d4Skini * 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 /* 22*7aadd8d4Skini * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23fa9e4066Sahrens * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_FC_PLAT_H 277c478bd9Sstevel@tonic-gate #define _SYS_FC_PLAT_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #include <sys/inttypes.h> 327c478bd9Sstevel@tonic-gate #include <sys/obpdefs.h> 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #ifdef __cplusplus 357c478bd9Sstevel@tonic-gate extern "C" { 367c478bd9Sstevel@tonic-gate #endif 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate /* 397c478bd9Sstevel@tonic-gate * Platform specific definitions for the fcode interpreter and driver. 407c478bd9Sstevel@tonic-gate * Define the cell size for the implementation. 417c478bd9Sstevel@tonic-gate * 427c478bd9Sstevel@tonic-gate * These definitions are appropriate for SPARC V9. 437c478bd9Sstevel@tonic-gate */ 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate /* 467c478bd9Sstevel@tonic-gate * The cell size is based on the cell size of the underlying "firmware" 477c478bd9Sstevel@tonic-gate * implementation. NB: FCode is really a 32-bit language, but we still 487c478bd9Sstevel@tonic-gate * define our interfaces in terms of the underlying cell size. 497c478bd9Sstevel@tonic-gate */ 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate typedef unsigned long long fc_cell_t; 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate /* 547c478bd9Sstevel@tonic-gate * common typedef for phandles accross the interface. 557c478bd9Sstevel@tonic-gate */ 567c478bd9Sstevel@tonic-gate typedef uint32_t fc_phandle_t; 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate /* 597c478bd9Sstevel@tonic-gate * Handy macros for converting from an fc_cell_t to an integral type 607c478bd9Sstevel@tonic-gate * These are useful because arguments and results are always passed 617c478bd9Sstevel@tonic-gate * in an array of fc_cell_t's. 627c478bd9Sstevel@tonic-gate */ 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate #define fc_ptr2cell(p) ((fc_cell_t)((uintptr_t)((void *)(p)))) 657c478bd9Sstevel@tonic-gate #define fc_int2cell(i) ((fc_cell_t)((int)(i))) 667c478bd9Sstevel@tonic-gate #define fc_uint2cell(u) ((fc_cell_t)((unsigned int)(u))) 677c478bd9Sstevel@tonic-gate #define fc_uint32_t2cell(u) ((fc_cell_t)((unsigned int)((uint32_t)(u)))) 687c478bd9Sstevel@tonic-gate #define fc_uint16_t2cell(w) ((fc_cell_t)((unsigned int)((uint16_t)(w)))) 697c478bd9Sstevel@tonic-gate #define fc_uint8_t2cell(b) ((fc_cell_t)((unsigned int)((uint8_t)(b)))) 707c478bd9Sstevel@tonic-gate #define fc_size2cell(u) ((fc_cell_t)((size_t)(u))) 717c478bd9Sstevel@tonic-gate #define fc_ssize2cell(i) ((fc_cell_t)((ssize_t)(i))) 727c478bd9Sstevel@tonic-gate #define fc_phandle2cell(ph) ((fc_cell_t)((unsigned int)((phandle_t)(ph)))) 73fa9e4066Sahrens #define fc_dnode2cell(d) ((fc_cell_t)((unsigned int)((pnode_t)(d)))) 747c478bd9Sstevel@tonic-gate #define fc_ull2cell_high(ll) (0LL) 757c478bd9Sstevel@tonic-gate #define fc_ull2cell_low(ll) ((fc_cell_t)(ll)) 767c478bd9Sstevel@tonic-gate #define fc_uintptr2cell(i) ((fc_cell_t)((uintptr_t)(i))) 777c478bd9Sstevel@tonic-gate #define fc_uchar2cell(c) ((fc_cell_t)((unsigned char)(c))) 787c478bd9Sstevel@tonic-gate #define fc_ushort2cell(w) ((fc_cell_t)((unsigned short)(w))) 797c478bd9Sstevel@tonic-gate #define fc_ihandle2cell(h) ((fc_cell_t)((fc_ihandle_t)(h))) 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate #define fc_cell2ptr(p) ((void *)((fc_cell_t)(p))) 827c478bd9Sstevel@tonic-gate #define fc_cell2int(i) ((int)((fc_cell_t)(i))) 837c478bd9Sstevel@tonic-gate #define fc_cell2uint(u) ((unsigned int)((fc_cell_t)(u))) 847c478bd9Sstevel@tonic-gate #define fc_cell2uint32_t(u) ((uint32_t)((fc_cell_t)(u))) 857c478bd9Sstevel@tonic-gate #define fc_cell2uint16_t(w) ((uint16_t)((fc_cell_t)(w))) 867c478bd9Sstevel@tonic-gate #define fc_cell2uint8_t(b) ((uint8_t)((fc_cell_t)(b))) 877c478bd9Sstevel@tonic-gate #define fc_cell2size(u) ((size_t)((fc_cell_t)(u))) 887c478bd9Sstevel@tonic-gate #define fc_cell2ssize(i) ((ssize_t)((fc_cell_t)(i))) 897c478bd9Sstevel@tonic-gate #define fc_cell2phandle(ph) ((phandle_t)((fc_cell_t)(ph))) 90fa9e4066Sahrens #define fc_cell2dnode(d) ((pnode_t)((fc_cell_t)(d))) 917c478bd9Sstevel@tonic-gate #define fc_cells2ull(h, l) ((unsigned long long)(fc_cell_t)(l)) 927c478bd9Sstevel@tonic-gate #define fc_cell2uintptr(i) ((uintptr_t)((fc_cell_t)(i))) 937c478bd9Sstevel@tonic-gate #define fc_cell2uchar(c) ((unsigned char)(fc_cell_t)(c)) 947c478bd9Sstevel@tonic-gate #define fc_cell2ushort(w) ((unsigned short)(fc_cell_t)(w)) 957c478bd9Sstevel@tonic-gate #define fc_cell2ihandle(h) ((fc_ihandle_t)(fc_cell_t)(h)) 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate #ifdef __cplusplus 987c478bd9Sstevel@tonic-gate } 997c478bd9Sstevel@tonic-gate #endif 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gate #endif /* _SYS_FC_PLAT_H */ 102