hcp_phyp.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * IBM eServer eHCA Infiniband device driver for Linux on POWER
  3. *
  4. * Firmware calls
  5. *
  6. * Authors: Christoph Raisch <raisch@de.ibm.com>
  7. * Hoang-Nam Nguyen <hnguyen@de.ibm.com>
  8. * Waleri Fomin <fomin@de.ibm.com>
  9. * Gerd Bayer <gerd.bayer@de.ibm.com>
  10. *
  11. * Copyright (c) 2005 IBM Corporation
  12. *
  13. * All rights reserved.
  14. *
  15. * This source code is distributed under a dual license of GPL v2.0 and OpenIB
  16. * BSD.
  17. *
  18. * OpenIB BSD License
  19. *
  20. * Redistribution and use in source and binary forms, with or without
  21. * modification, are permitted provided that the following conditions are met:
  22. *
  23. * Redistributions of source code must retain the above copyright notice, this
  24. * list of conditions and the following disclaimer.
  25. *
  26. * Redistributions in binary form must reproduce the above copyright notice,
  27. * this list of conditions and the following disclaimer in the documentation
  28. * and/or other materials
  29. * provided with the distribution.
  30. *
  31. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  32. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  33. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  34. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  35. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  36. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  37. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  38. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  39. * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  40. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41. * POSSIBILITY OF SUCH DAMAGE.
  42. */
  43. #ifndef __HCP_PHYP_H__
  44. #define __HCP_PHYP_H__
  45. /*
  46. * eHCA page (mapped into memory)
  47. * resource to access eHCA register pages in CPU address space
  48. */
  49. struct h_galpa {
  50. u64 fw_handle;
  51. /* for pSeries this is a 64bit memory address where
  52. I/O memory is mapped into CPU address space (kv) */
  53. };
  54. /*
  55. * resource to access eHCA address space registers, all types
  56. */
  57. struct h_galpas {
  58. u32 pid; /*PID of userspace galpa checking */
  59. struct h_galpa user; /* user space accessible resource,
  60. set to 0 if unused */
  61. struct h_galpa kernel; /* kernel space accessible resource,
  62. set to 0 if unused */
  63. };
  64. static inline u64 hipz_galpa_load(struct h_galpa galpa, u32 offset)
  65. {
  66. u64 addr = galpa.fw_handle + offset;
  67. return *(volatile u64 __force *)addr;
  68. }
  69. static inline void hipz_galpa_store(struct h_galpa galpa, u32 offset, u64 value)
  70. {
  71. u64 addr = galpa.fw_handle + offset;
  72. *(volatile u64 __force *)addr = value;
  73. }
  74. int hcp_galpas_ctor(struct h_galpas *galpas, int is_user,
  75. u64 paddr_kernel, u64 paddr_user);
  76. int hcp_galpas_dtor(struct h_galpas *galpas);
  77. u64 hcall_map_page(u64 physaddr);
  78. int hcall_unmap_page(u64 mapaddr);
  79. #endif