octeon_mem_ops.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /**********************************************************************
  2. * Author: Cavium, Inc.
  3. *
  4. * Contact: support@cavium.com
  5. * Please include "LiquidIO" in the subject.
  6. *
  7. * Copyright (c) 2003-2016 Cavium, Inc.
  8. *
  9. * This file is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License, Version 2, as
  11. * published by the Free Software Foundation.
  12. *
  13. * This file is distributed in the hope that it will be useful, but
  14. * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
  15. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
  16. * NONINFRINGEMENT. See the GNU General Public License for more
  17. * details.
  18. **********************************************************************/
  19. /*! \file octeon_mem_ops.h
  20. * \brief Host Driver: Routines used to read/write Octeon memory.
  21. */
  22. #ifndef __OCTEON_MEM_OPS_H__
  23. #define __OCTEON_MEM_OPS_H__
  24. /** Read a 64-bit value from a BAR1 mapped core memory address.
  25. * @param oct - pointer to the octeon device.
  26. * @param core_addr - the address to read from.
  27. *
  28. * The range_idx gives the BAR1 index register for the range of address
  29. * in which core_addr is mapped.
  30. *
  31. * @return 64-bit value read from Core memory
  32. */
  33. u64 octeon_read_device_mem64(struct octeon_device *oct, u64 core_addr);
  34. /** Read a 32-bit value from a BAR1 mapped core memory address.
  35. * @param oct - pointer to the octeon device.
  36. * @param core_addr - the address to read from.
  37. *
  38. * @return 32-bit value read from Core memory
  39. */
  40. u32 octeon_read_device_mem32(struct octeon_device *oct, u64 core_addr);
  41. /** Write a 32-bit value to a BAR1 mapped core memory address.
  42. * @param oct - pointer to the octeon device.
  43. * @param core_addr - the address to write to.
  44. * @param val - 32-bit value to write.
  45. */
  46. void
  47. octeon_write_device_mem32(struct octeon_device *oct,
  48. u64 core_addr,
  49. u32 val);
  50. /** Read multiple bytes from Octeon memory.
  51. */
  52. void
  53. octeon_pci_read_core_mem(struct octeon_device *oct,
  54. u64 coreaddr,
  55. u8 *buf,
  56. u32 len);
  57. /** Write multiple bytes into Octeon memory.
  58. */
  59. void
  60. octeon_pci_write_core_mem(struct octeon_device *oct,
  61. u64 coreaddr,
  62. const u8 *buf,
  63. u32 len);
  64. #endif