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.

mlx_cmd.c 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (C) 2015 Mellanox Technologies Ltd.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 2 of the
  7. * License, or any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  17. * 02110-1301, USA.
  18. */
  19. FILE_LICENCE ( GPL2_OR_LATER );
  20. #include "../include/mlx_cmd.h"
  21. #include "../../mlx_utils/include/public/mlx_pci_gw.h"
  22. #include "../../mlx_utils/include/public/mlx_bail.h"
  23. #include "../../mlx_utils/include/public/mlx_pci.h"
  24. #include "../../mlx_utils/include/public/mlx_logging.h"
  25. mlx_status
  26. nodnic_cmd_read(
  27. IN nodnic_device_priv *device_priv,
  28. IN mlx_uint32 address,
  29. OUT mlx_pci_gw_buffer *buffer
  30. )
  31. {
  32. mlx_status status = MLX_SUCCESS;
  33. mlx_utils *utils = NULL;
  34. if ( device_priv == NULL || buffer == NULL ) {
  35. status = MLX_INVALID_PARAMETER;
  36. goto bad_param;
  37. }
  38. utils = device_priv->utils;
  39. status = mlx_pci_gw_read(utils, PCI_GW_SPACE_NODNIC, address, buffer);
  40. MLX_CHECK_STATUS(device_priv, status, read_error,"mlx_pci_gw_read failed");
  41. read_error:
  42. bad_param:
  43. return status;
  44. }
  45. mlx_status
  46. nodnic_cmd_write(
  47. IN nodnic_device_priv *device_priv,
  48. IN mlx_uint32 address,
  49. IN mlx_pci_gw_buffer buffer
  50. )
  51. {
  52. mlx_status status = MLX_SUCCESS;
  53. mlx_utils *utils = NULL;
  54. if ( device_priv == NULL ) {
  55. status = MLX_INVALID_PARAMETER;
  56. goto bad_param;
  57. }
  58. utils = device_priv->utils;
  59. status = mlx_pci_gw_write(utils, PCI_GW_SPACE_NODNIC, address, buffer);
  60. MLX_CHECK_STATUS(device_priv, status, write_error,"mlx_pci_gw_write failed");
  61. write_error:
  62. bad_param:
  63. return status;
  64. }