1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _PCP_COMMON_H 28 #define _PCP_COMMON_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 /* 35 * This file is shared by both ALOM and Solaris sides of 36 * Platform Channel Protocol users. So this file should 37 * include only common shared things. 38 */ 39 40 /* 41 * Platform Channel Request Message Header. 42 */ 43 typedef struct pcp_req_msg_hdr { 44 uint32_t magic_num; /* magic number */ 45 uint8_t proto_ver; /* version info for */ 46 /* backward compatibility */ 47 uint8_t msg_type; /* provided by user apps */ 48 uint8_t sub_type; /* provided by user apps */ 49 uint8_t rsvd_pad; /* padding bits */ 50 uint32_t xid; /* transaction id */ 51 uint32_t timeout; /* timeout in seconds */ 52 uint32_t msg_len; /* length of request or response data */ 53 uint16_t msg_cksum; /* 16-bit checksum of req msg data */ 54 uint16_t hdr_cksum; /* 16-bit checksum of req hdr */ 55 } pcp_req_msg_hdr_t; 56 57 58 /* 59 * Platform Channel Response Message Header. 60 */ 61 typedef struct pcp_resp_msg_hdr { 62 uint32_t magic_num; /* magic number */ 63 uint8_t proto_ver; /* version info for */ 64 /* backward compatibility */ 65 uint8_t msg_type; /* passed to user apps */ 66 uint8_t sub_type; /* passed to user apps */ 67 uint8_t rsvd_pad; /* for padding */ 68 uint32_t xid; /* transaction id */ 69 uint32_t timeout; /* timeout in seconds */ 70 uint32_t msg_len; /* length of request or response data */ 71 uint32_t status; /* response status */ 72 uint16_t msg_cksum; /* 16-bit checksum of resp msg data */ 73 uint16_t hdr_cksum; /* 16-bit checksum of resp hdr */ 74 } pcp_resp_msg_hdr_t; 75 76 /* 77 * magic number for Platform Channel Protocol (PCP) 78 * ~(rot13("PCP_") = 0xAFBCAFA0 79 * rot13 is a simple Caesar-cypher encryption that replaces each English letter 80 * with the one 13 places forward or back along the alphabet. 81 */ 82 #define PCP_MAGIC_NUM (0xAFBCAFA0) 83 84 85 /* Platform channel protocol versions. */ 86 #define PCP_PROT_VER_1 1 87 88 89 /* Error codes for 'status' field in response message header */ 90 91 #define PCP_OK (0) /* message received okay */ 92 #define PCP_ERROR (1) /* generic error */ 93 #define PCP_HDR_CKSUM_ERROR (2) /* header checksum error */ 94 #define PCP_MSG_CKSUM_ERROR (3) /* message checksum error */ 95 #define PCP_XPORT_ERROR (4) /* message in complete error */ 96 97 /* defines for 'timeout' */ 98 #define PCP_TO_NO_RESPONSE (0xFFFFFFFF) /* no response required */ 99 #define PCP_TO_WAIT_FOREVER (0) /* wait forever..(in reality, */ 100 /* it waits until glvc driver */ 101 /* call returns; curently glvc */ 102 /* calls are blocking calls. */ 103 104 #ifdef __cplusplus 105 } 106 #endif 107 108 #endif /* _PCP_COMMON_H */ 109