Path: blob/master/drivers/infiniband/hw/ehca/hcp_phyp.h
15112 views
/*1* IBM eServer eHCA Infiniband device driver for Linux on POWER2*3* Firmware calls4*5* Authors: Christoph Raisch <[email protected]>6* Hoang-Nam Nguyen <[email protected]>7* Waleri Fomin <[email protected]>8* Gerd Bayer <[email protected]>9*10* Copyright (c) 2005 IBM Corporation11*12* All rights reserved.13*14* This source code is distributed under a dual license of GPL v2.0 and OpenIB15* BSD.16*17* OpenIB BSD License18*19* Redistribution and use in source and binary forms, with or without20* modification, are permitted provided that the following conditions are met:21*22* Redistributions of source code must retain the above copyright notice, this23* list of conditions and the following disclaimer.24*25* Redistributions in binary form must reproduce the above copyright notice,26* this list of conditions and the following disclaimer in the documentation27* and/or other materials28* provided with the distribution.29*30* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"31* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE32* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE33* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE34* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR35* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF36* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR37* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER38* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)39* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE40* POSSIBILITY OF SUCH DAMAGE.41*/4243#ifndef __HCP_PHYP_H__44#define __HCP_PHYP_H__454647/*48* eHCA page (mapped into memory)49* resource to access eHCA register pages in CPU address space50*/51struct h_galpa {52u64 fw_handle;53/* for pSeries this is a 64bit memory address where54I/O memory is mapped into CPU address space (kv) */55};5657/*58* resource to access eHCA address space registers, all types59*/60struct h_galpas {61u32 pid; /*PID of userspace galpa checking */62struct h_galpa user; /* user space accessible resource,63set to 0 if unused */64struct h_galpa kernel; /* kernel space accessible resource,65set to 0 if unused */66};6768static inline u64 hipz_galpa_load(struct h_galpa galpa, u32 offset)69{70u64 addr = galpa.fw_handle + offset;71return *(volatile u64 __force *)addr;72}7374static inline void hipz_galpa_store(struct h_galpa galpa, u32 offset, u64 value)75{76u64 addr = galpa.fw_handle + offset;77*(volatile u64 __force *)addr = value;78}7980int hcp_galpas_ctor(struct h_galpas *galpas, int is_user,81u64 paddr_kernel, u64 paddr_user);8283int hcp_galpas_dtor(struct h_galpas *galpas);8485u64 hcall_map_page(u64 physaddr);8687int hcall_unmap_page(u64 mapaddr);8889#endif909192