You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef INCLUDE_PUBLIC_MLX_PCI_GW_H_
  2. #define INCLUDE_PUBLIC_MLX_PCI_GW_H_
  3. /*
  4. * Copyright (C) 2015 Mellanox Technologies Ltd.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation; either version 2 of the
  9. * License, or any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19. * 02110-1301, USA.
  20. */
  21. FILE_LICENCE ( GPL2_OR_LATER );
  22. #include "mlx_utils.h"
  23. #define PCI_GW_FIRST_CAPABILITY_POINTER_OFFSET 0x34
  24. #define PCI_GW_CAPABILITY_ID 0x9
  25. #define PCI_GW_CAPABILITY_ID_OFFSET 0x0
  26. #define PCI_GW_CAPABILITY_NEXT_POINTER_OFFSET 0x1
  27. #define PCI_GW_CAPABILITY_SPACE_OFFSET 0x4
  28. #define PCI_GW_CAPABILITY_STATUS_OFFSET 0x7
  29. #define PCI_GW_CAPABILITY_COUNTER_OFFSET 0x8
  30. #define PCI_GW_CAPABILITY_SEMAPHORE_OFFSET 0xC
  31. #define PCI_GW_CAPABILITY_ADDRESS_OFFSET 0x10
  32. #define PCI_GW_CAPABILITY_FLAG_OFFSET 0x10
  33. #define PCI_GW_CAPABILITY_DATA_OFFSET 0x14
  34. #define PCI_GW_SEMPHORE_TRIES 3000000
  35. #define PCI_GW_GET_OWNERSHIP_TRIES 5000
  36. #define PCI_GW_READ_FLAG_TRIES 3000000
  37. #define PCI_GW_WRITE_FLAG 0x80000000
  38. #define PCI_GW_SPACE_NODNIC 0x4
  39. #define PCI_GW_SPACE_ALL_ICMD 0x3
  40. #define PCI_GW_SPACE_SEMAPHORE 0xa
  41. #define PCI_GW_SPACE_CR0 0x2
  42. typedef mlx_uint32 mlx_pci_gw_buffer;
  43. mlx_status
  44. mlx_pci_gw_init(
  45. IN mlx_utils *utils
  46. );
  47. mlx_status
  48. mlx_pci_gw_teardown(
  49. IN mlx_utils *utils
  50. );
  51. mlx_status
  52. mlx_pci_gw_read(
  53. IN mlx_utils *utils,
  54. IN mlx_pci_gw_space space,
  55. IN mlx_uint32 address,
  56. OUT mlx_pci_gw_buffer *buffer
  57. );
  58. mlx_status
  59. mlx_pci_gw_write(
  60. IN mlx_utils *utils,
  61. IN mlx_pci_gw_space space,
  62. IN mlx_uint32 address,
  63. IN mlx_pci_gw_buffer buffer
  64. );
  65. #endif /* INCLUDE_PUBLIC_MLX_PCI_GW_H_ */