Blame psm_am_internal.h

Packit Service 155747
/*
Packit Service 155747
Packit Service 155747
  This file is provided under a dual BSD/GPLv2 license.  When using or
Packit Service 155747
  redistributing this file, you may do so under either license.
Packit Service 155747
Packit Service 155747
  GPL LICENSE SUMMARY
Packit Service 155747
Packit Service 155747
  Copyright(c) 2015 Intel Corporation.
Packit Service 155747
Packit Service 155747
  This program is free software; you can redistribute it and/or modify
Packit Service 155747
  it under the terms of version 2 of the GNU General Public License as
Packit Service 155747
  published by the Free Software Foundation.
Packit Service 155747
Packit Service 155747
  This program is distributed in the hope that it will be useful, but
Packit Service 155747
  WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 155747
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 155747
  General Public License for more details.
Packit Service 155747
Packit Service 155747
  Contact Information:
Packit Service 155747
  Intel Corporation, www.intel.com
Packit Service 155747
Packit Service 155747
  BSD LICENSE
Packit Service 155747
Packit Service 155747
  Copyright(c) 2015 Intel Corporation.
Packit Service 155747
Packit Service 155747
  Redistribution and use in source and binary forms, with or without
Packit Service 155747
  modification, are permitted provided that the following conditions
Packit Service 155747
  are met:
Packit Service 155747
Packit Service 155747
    * Redistributions of source code must retain the above copyright
Packit Service 155747
      notice, this list of conditions and the following disclaimer.
Packit Service 155747
    * Redistributions in binary form must reproduce the above copyright
Packit Service 155747
      notice, this list of conditions and the following disclaimer in
Packit Service 155747
      the documentation and/or other materials provided with the
Packit Service 155747
      distribution.
Packit Service 155747
    * Neither the name of Intel Corporation nor the names of its
Packit Service 155747
      contributors may be used to endorse or promote products derived
Packit Service 155747
      from this software without specific prior written permission.
Packit Service 155747
Packit Service 155747
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit Service 155747
  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit Service 155747
  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Packit Service 155747
  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Packit Service 155747
  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
Packit Service 155747
  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Packit Service 155747
  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Packit Service 155747
  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Packit Service 155747
  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit Service 155747
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit Service 155747
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit Service 155747
Packit Service 155747
*/
Packit Service 155747
Packit Service 155747
/* Copyright (c) 2003-2014 Intel Corporation. All rights reserved. */
Packit Service 155747
Packit Service 155747
#ifndef _PSM2_AM_INTERNAL_H
Packit Service 155747
#define _PSM2_AM_INTERNAL_H
Packit Service 155747
Packit Service 155747
#define PSMI_AM_MAX_ARGS     10
Packit Service 155747
#define PSMI_AM_NUM_HANDLERS 256	/* must be power of 2 */
Packit Service 155747
Packit Service 155747
#define PSMI_AM_ARGS_DEFAULT psm2_am_token_t token,			\
Packit Service 155747
			     psm2_amarg_t *args, int nargs,		\
Packit Service 155747
			     void *src, uint32_t len,			\
Packit Service 155747
			     void *hctx
Packit Service 155747
Packit Service 155747
enum psm2_am_handler_version
Packit Service 155747
{
Packit Service 155747
	PSM2_AM_HANDLER_V1 = 0,
Packit Service 155747
	PSM2_AM_HANDLER_V2,
Packit Service 155747
};
Packit Service 155747
Packit Service 155747
struct psm2_ep_am_handle_entry
Packit Service 155747
{
Packit Service 155747
	void *hfn;
Packit Service 155747
	void *hctx;
Packit Service 155747
	enum psm2_am_handler_version version;
Packit Service 155747
};
Packit Service 155747
Packit Service 155747
struct psmi_am_token {
Packit Service 155747
	psm2_epaddr_t epaddr_incoming;
Packit Service 155747
	uint32_t flags;
Packit Service 155747
	/* Can handler reply? i.e. Not OPCODE_AM_REQUEST_NOREPLY request */
Packit Service 155747
	uint32_t can_reply;
Packit Service 155747
Packit Service 155747
	/* PTLs may add other stuff here */
Packit Service 155747
};
Packit Service 155747
Packit Service 155747
/* AM capabilities parameters are initialized once in psmi_am_init_internal
Packit Service 155747
   and copied out in __psm2_am_get_parameters.  When debugging is enabled,
Packit Service 155747
   various assertions reference these parameters for sanity checking. */
Packit Service 155747
extern struct psm2_am_parameters psmi_am_parameters;
Packit Service 155747
Packit Service 155747
PSMI_ALWAYS_INLINE(struct psm2_ep_am_handle_entry *
Packit Service 155747
		   psm_am_get_handler_function(psm2_ep_t ep,
Packit Service 155747
					       psm2_handler_t handler_idx))
Packit Service 155747
{
Packit Service 155747
	int hidx = handler_idx & (PSMI_AM_NUM_HANDLERS - 1);
Packit Service 155747
	struct psm2_ep_am_handle_entry *hentry = &ep->am_htable[hidx];
Packit Service 155747
	psmi_assert_always(hentry != NULL);
Packit Service 155747
	return hentry;
Packit Service 155747
}
Packit Service 155747
Packit Service 155747
/* PSM internal initialization */
Packit Service 155747
psm2_error_t psmi_am_init_internal(psm2_ep_t ep);
Packit Service 155747
Packit Service 155747
#endif