qed_mcp.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738
  1. /* QLogic qed NIC Driver
  2. * Copyright (c) 2015-2017 QLogic Corporation
  3. *
  4. * This software is available to you under a choice of one of two
  5. * licenses. You may choose to be licensed under the terms of the GNU
  6. * General Public License (GPL) Version 2, available from the file
  7. * COPYING in the main directory of this source tree, or the
  8. * OpenIB.org BSD license below:
  9. *
  10. * Redistribution and use in source and binary forms, with or
  11. * without modification, are permitted provided that the following
  12. * conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above
  15. * copyright notice, this list of conditions and the following
  16. * disclaimer.
  17. *
  18. * - Redistributions in binary form must reproduce the above
  19. * copyright notice, this list of conditions and the following
  20. * disclaimer in the documentation and /or other materials
  21. * provided with the distribution.
  22. *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  27. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  28. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  29. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30. * SOFTWARE.
  31. */
  32. #ifndef _QED_MCP_H
  33. #define _QED_MCP_H
  34. #include <linux/types.h>
  35. #include <linux/delay.h>
  36. #include <linux/slab.h>
  37. #include <linux/spinlock.h>
  38. #include <linux/qed/qed_fcoe_if.h>
  39. #include "qed_hsi.h"
  40. struct qed_mcp_link_speed_params {
  41. bool autoneg;
  42. u32 advertised_speeds; /* bitmask of DRV_SPEED_CAPABILITY */
  43. u32 forced_speed; /* In Mb/s */
  44. };
  45. struct qed_mcp_link_pause_params {
  46. bool autoneg;
  47. bool forced_rx;
  48. bool forced_tx;
  49. };
  50. struct qed_mcp_link_params {
  51. struct qed_mcp_link_speed_params speed;
  52. struct qed_mcp_link_pause_params pause;
  53. u32 loopback_mode;
  54. };
  55. struct qed_mcp_link_capabilities {
  56. u32 speed_capabilities;
  57. };
  58. struct qed_mcp_link_state {
  59. bool link_up;
  60. u32 min_pf_rate;
  61. /* Actual link speed in Mb/s */
  62. u32 line_speed;
  63. /* PF max speed in Mb/s, deduced from line_speed
  64. * according to PF max bandwidth configuration.
  65. */
  66. u32 speed;
  67. bool full_duplex;
  68. bool an;
  69. bool an_complete;
  70. bool parallel_detection;
  71. bool pfc_enabled;
  72. #define QED_LINK_PARTNER_SPEED_1G_HD BIT(0)
  73. #define QED_LINK_PARTNER_SPEED_1G_FD BIT(1)
  74. #define QED_LINK_PARTNER_SPEED_10G BIT(2)
  75. #define QED_LINK_PARTNER_SPEED_20G BIT(3)
  76. #define QED_LINK_PARTNER_SPEED_25G BIT(4)
  77. #define QED_LINK_PARTNER_SPEED_40G BIT(5)
  78. #define QED_LINK_PARTNER_SPEED_50G BIT(6)
  79. #define QED_LINK_PARTNER_SPEED_100G BIT(7)
  80. u32 partner_adv_speed;
  81. bool partner_tx_flow_ctrl_en;
  82. bool partner_rx_flow_ctrl_en;
  83. #define QED_LINK_PARTNER_SYMMETRIC_PAUSE (1)
  84. #define QED_LINK_PARTNER_ASYMMETRIC_PAUSE (2)
  85. #define QED_LINK_PARTNER_BOTH_PAUSE (3)
  86. u8 partner_adv_pause;
  87. bool sfp_tx_fault;
  88. };
  89. struct qed_mcp_function_info {
  90. u8 pause_on_host;
  91. enum qed_pci_personality protocol;
  92. u8 bandwidth_min;
  93. u8 bandwidth_max;
  94. u8 mac[ETH_ALEN];
  95. u64 wwn_port;
  96. u64 wwn_node;
  97. #define QED_MCP_VLAN_UNSET (0xffff)
  98. u16 ovlan;
  99. u16 mtu;
  100. };
  101. struct qed_mcp_nvm_common {
  102. u32 offset;
  103. u32 param;
  104. u32 resp;
  105. u32 cmd;
  106. };
  107. struct qed_mcp_drv_version {
  108. u32 version;
  109. u8 name[MCP_DRV_VER_STR_SIZE - 4];
  110. };
  111. struct qed_mcp_lan_stats {
  112. u64 ucast_rx_pkts;
  113. u64 ucast_tx_pkts;
  114. u32 fcs_err;
  115. };
  116. struct qed_mcp_fcoe_stats {
  117. u64 rx_pkts;
  118. u64 tx_pkts;
  119. u32 fcs_err;
  120. u32 login_failure;
  121. };
  122. struct qed_mcp_iscsi_stats {
  123. u64 rx_pdus;
  124. u64 tx_pdus;
  125. u64 rx_bytes;
  126. u64 tx_bytes;
  127. };
  128. struct qed_mcp_rdma_stats {
  129. u64 rx_pkts;
  130. u64 tx_pkts;
  131. u64 rx_bytes;
  132. u64 tx_byts;
  133. };
  134. enum qed_mcp_protocol_type {
  135. QED_MCP_LAN_STATS,
  136. QED_MCP_FCOE_STATS,
  137. QED_MCP_ISCSI_STATS,
  138. QED_MCP_RDMA_STATS
  139. };
  140. union qed_mcp_protocol_stats {
  141. struct qed_mcp_lan_stats lan_stats;
  142. struct qed_mcp_fcoe_stats fcoe_stats;
  143. struct qed_mcp_iscsi_stats iscsi_stats;
  144. struct qed_mcp_rdma_stats rdma_stats;
  145. };
  146. enum qed_ov_eswitch {
  147. QED_OV_ESWITCH_NONE,
  148. QED_OV_ESWITCH_VEB,
  149. QED_OV_ESWITCH_VEPA
  150. };
  151. enum qed_ov_client {
  152. QED_OV_CLIENT_DRV,
  153. QED_OV_CLIENT_USER,
  154. QED_OV_CLIENT_VENDOR_SPEC
  155. };
  156. enum qed_ov_driver_state {
  157. QED_OV_DRIVER_STATE_NOT_LOADED,
  158. QED_OV_DRIVER_STATE_DISABLED,
  159. QED_OV_DRIVER_STATE_ACTIVE
  160. };
  161. enum qed_ov_wol {
  162. QED_OV_WOL_DEFAULT,
  163. QED_OV_WOL_DISABLED,
  164. QED_OV_WOL_ENABLED
  165. };
  166. /**
  167. * @brief - returns the link params of the hw function
  168. *
  169. * @param p_hwfn
  170. *
  171. * @returns pointer to link params
  172. */
  173. struct qed_mcp_link_params *qed_mcp_get_link_params(struct qed_hwfn *);
  174. /**
  175. * @brief - return the link state of the hw function
  176. *
  177. * @param p_hwfn
  178. *
  179. * @returns pointer to link state
  180. */
  181. struct qed_mcp_link_state *qed_mcp_get_link_state(struct qed_hwfn *);
  182. /**
  183. * @brief - return the link capabilities of the hw function
  184. *
  185. * @param p_hwfn
  186. *
  187. * @returns pointer to link capabilities
  188. */
  189. struct qed_mcp_link_capabilities
  190. *qed_mcp_get_link_capabilities(struct qed_hwfn *p_hwfn);
  191. /**
  192. * @brief Request the MFW to set the the link according to 'link_input'.
  193. *
  194. * @param p_hwfn
  195. * @param p_ptt
  196. * @param b_up - raise link if `true'. Reset link if `false'.
  197. *
  198. * @return int
  199. */
  200. int qed_mcp_set_link(struct qed_hwfn *p_hwfn,
  201. struct qed_ptt *p_ptt,
  202. bool b_up);
  203. /**
  204. * @brief Get the management firmware version value
  205. *
  206. * @param p_hwfn
  207. * @param p_ptt
  208. * @param p_mfw_ver - mfw version value
  209. * @param p_running_bundle_id - image id in nvram; Optional.
  210. *
  211. * @return int - 0 - operation was successful.
  212. */
  213. int qed_mcp_get_mfw_ver(struct qed_hwfn *p_hwfn,
  214. struct qed_ptt *p_ptt,
  215. u32 *p_mfw_ver, u32 *p_running_bundle_id);
  216. /**
  217. * @brief Get media type value of the port.
  218. *
  219. * @param cdev - qed dev pointer
  220. * @param mfw_ver - media type value
  221. *
  222. * @return int -
  223. * 0 - Operation was successul.
  224. * -EBUSY - Operation failed
  225. */
  226. int qed_mcp_get_media_type(struct qed_dev *cdev,
  227. u32 *media_type);
  228. /**
  229. * @brief General function for sending commands to the MCP
  230. * mailbox. It acquire mutex lock for the entire
  231. * operation, from sending the request until the MCP
  232. * response. Waiting for MCP response will be checked up
  233. * to 5 seconds every 5ms.
  234. *
  235. * @param p_hwfn - hw function
  236. * @param p_ptt - PTT required for register access
  237. * @param cmd - command to be sent to the MCP.
  238. * @param param - Optional param
  239. * @param o_mcp_resp - The MCP response code (exclude sequence).
  240. * @param o_mcp_param- Optional parameter provided by the MCP
  241. * response
  242. * @return int - 0 - operation
  243. * was successul.
  244. */
  245. int qed_mcp_cmd(struct qed_hwfn *p_hwfn,
  246. struct qed_ptt *p_ptt,
  247. u32 cmd,
  248. u32 param,
  249. u32 *o_mcp_resp,
  250. u32 *o_mcp_param);
  251. /**
  252. * @brief - drains the nig, allowing completion to pass in case of pauses.
  253. * (Should be called only from sleepable context)
  254. *
  255. * @param p_hwfn
  256. * @param p_ptt
  257. */
  258. int qed_mcp_drain(struct qed_hwfn *p_hwfn,
  259. struct qed_ptt *p_ptt);
  260. /**
  261. * @brief Get the flash size value
  262. *
  263. * @param p_hwfn
  264. * @param p_ptt
  265. * @param p_flash_size - flash size in bytes to be filled.
  266. *
  267. * @return int - 0 - operation was successul.
  268. */
  269. int qed_mcp_get_flash_size(struct qed_hwfn *p_hwfn,
  270. struct qed_ptt *p_ptt,
  271. u32 *p_flash_size);
  272. /**
  273. * @brief Send driver version to MFW
  274. *
  275. * @param p_hwfn
  276. * @param p_ptt
  277. * @param version - Version value
  278. * @param name - Protocol driver name
  279. *
  280. * @return int - 0 - operation was successul.
  281. */
  282. int
  283. qed_mcp_send_drv_version(struct qed_hwfn *p_hwfn,
  284. struct qed_ptt *p_ptt,
  285. struct qed_mcp_drv_version *p_ver);
  286. /**
  287. * @brief Notify MFW about the change in base device properties
  288. *
  289. * @param p_hwfn
  290. * @param p_ptt
  291. * @param client - qed client type
  292. *
  293. * @return int - 0 - operation was successful.
  294. */
  295. int qed_mcp_ov_update_current_config(struct qed_hwfn *p_hwfn,
  296. struct qed_ptt *p_ptt,
  297. enum qed_ov_client client);
  298. /**
  299. * @brief Notify MFW about the driver state
  300. *
  301. * @param p_hwfn
  302. * @param p_ptt
  303. * @param drv_state - Driver state
  304. *
  305. * @return int - 0 - operation was successful.
  306. */
  307. int qed_mcp_ov_update_driver_state(struct qed_hwfn *p_hwfn,
  308. struct qed_ptt *p_ptt,
  309. enum qed_ov_driver_state drv_state);
  310. /**
  311. * @brief Send MTU size to MFW
  312. *
  313. * @param p_hwfn
  314. * @param p_ptt
  315. * @param mtu - MTU size
  316. *
  317. * @return int - 0 - operation was successful.
  318. */
  319. int qed_mcp_ov_update_mtu(struct qed_hwfn *p_hwfn,
  320. struct qed_ptt *p_ptt, u16 mtu);
  321. /**
  322. * @brief Send MAC address to MFW
  323. *
  324. * @param p_hwfn
  325. * @param p_ptt
  326. * @param mac - MAC address
  327. *
  328. * @return int - 0 - operation was successful.
  329. */
  330. int qed_mcp_ov_update_mac(struct qed_hwfn *p_hwfn,
  331. struct qed_ptt *p_ptt, u8 *mac);
  332. /**
  333. * @brief Send WOL mode to MFW
  334. *
  335. * @param p_hwfn
  336. * @param p_ptt
  337. * @param wol - WOL mode
  338. *
  339. * @return int - 0 - operation was successful.
  340. */
  341. int qed_mcp_ov_update_wol(struct qed_hwfn *p_hwfn,
  342. struct qed_ptt *p_ptt,
  343. enum qed_ov_wol wol);
  344. /**
  345. * @brief Set LED status
  346. *
  347. * @param p_hwfn
  348. * @param p_ptt
  349. * @param mode - LED mode
  350. *
  351. * @return int - 0 - operation was successful.
  352. */
  353. int qed_mcp_set_led(struct qed_hwfn *p_hwfn,
  354. struct qed_ptt *p_ptt,
  355. enum qed_led_mode mode);
  356. /**
  357. * @brief Read from nvm
  358. *
  359. * @param cdev
  360. * @param addr - nvm offset
  361. * @param p_buf - nvm read buffer
  362. * @param len - buffer len
  363. *
  364. * @return int - 0 - operation was successful.
  365. */
  366. int qed_mcp_nvm_read(struct qed_dev *cdev, u32 addr, u8 *p_buf, u32 len);
  367. /**
  368. * @brief Bist register test
  369. *
  370. * @param p_hwfn - hw function
  371. * @param p_ptt - PTT required for register access
  372. *
  373. * @return int - 0 - operation was successful.
  374. */
  375. int qed_mcp_bist_register_test(struct qed_hwfn *p_hwfn,
  376. struct qed_ptt *p_ptt);
  377. /**
  378. * @brief Bist clock test
  379. *
  380. * @param p_hwfn - hw function
  381. * @param p_ptt - PTT required for register access
  382. *
  383. * @return int - 0 - operation was successful.
  384. */
  385. int qed_mcp_bist_clock_test(struct qed_hwfn *p_hwfn,
  386. struct qed_ptt *p_ptt);
  387. /**
  388. * @brief Bist nvm test - get number of images
  389. *
  390. * @param p_hwfn - hw function
  391. * @param p_ptt - PTT required for register access
  392. * @param num_images - number of images if operation was
  393. * successful. 0 if not.
  394. *
  395. * @return int - 0 - operation was successful.
  396. */
  397. int qed_mcp_bist_nvm_test_get_num_images(struct qed_hwfn *p_hwfn,
  398. struct qed_ptt *p_ptt,
  399. u32 *num_images);
  400. /**
  401. * @brief Bist nvm test - get image attributes by index
  402. *
  403. * @param p_hwfn - hw function
  404. * @param p_ptt - PTT required for register access
  405. * @param p_image_att - Attributes of image
  406. * @param image_index - Index of image to get information for
  407. *
  408. * @return int - 0 - operation was successful.
  409. */
  410. int qed_mcp_bist_nvm_test_get_image_att(struct qed_hwfn *p_hwfn,
  411. struct qed_ptt *p_ptt,
  412. struct bist_nvm_image_att *p_image_att,
  413. u32 image_index);
  414. /* Using hwfn number (and not pf_num) is required since in CMT mode,
  415. * same pf_num may be used by two different hwfn
  416. * TODO - this shouldn't really be in .h file, but until all fields
  417. * required during hw-init will be placed in their correct place in shmem
  418. * we need it in qed_dev.c [for readin the nvram reflection in shmem].
  419. */
  420. #define MCP_PF_ID_BY_REL(p_hwfn, rel_pfid) (QED_IS_BB((p_hwfn)->cdev) ? \
  421. ((rel_pfid) | \
  422. ((p_hwfn)->abs_pf_id & 1) << 3) : \
  423. rel_pfid)
  424. #define MCP_PF_ID(p_hwfn) MCP_PF_ID_BY_REL(p_hwfn, (p_hwfn)->rel_pf_id)
  425. /* TODO - this is only correct as long as only BB is supported, and
  426. * no port-swapping is implemented; Afterwards we'll need to fix it.
  427. */
  428. #define MFW_PORT(_p_hwfn) ((_p_hwfn)->abs_pf_id % \
  429. ((_p_hwfn)->cdev->num_ports_in_engines * 2))
  430. struct qed_mcp_info {
  431. /* Spinlock used for protecting the access to the MFW mailbox */
  432. spinlock_t lock;
  433. /* Spinlock used for syncing SW link-changes and link-changes
  434. * originating from attention context.
  435. */
  436. spinlock_t link_lock;
  437. bool block_mb_sending;
  438. u32 public_base;
  439. u32 drv_mb_addr;
  440. u32 mfw_mb_addr;
  441. u32 port_addr;
  442. u16 drv_mb_seq;
  443. u16 drv_pulse_seq;
  444. struct qed_mcp_link_params link_input;
  445. struct qed_mcp_link_state link_output;
  446. struct qed_mcp_link_capabilities link_capabilities;
  447. struct qed_mcp_function_info func_info;
  448. u8 *mfw_mb_cur;
  449. u8 *mfw_mb_shadow;
  450. u16 mfw_mb_length;
  451. u16 mcp_hist;
  452. };
  453. struct qed_mcp_mb_params {
  454. u32 cmd;
  455. u32 param;
  456. union drv_union_data *p_data_src;
  457. union drv_union_data *p_data_dst;
  458. u32 mcp_resp;
  459. u32 mcp_param;
  460. };
  461. /**
  462. * @brief Initialize the interface with the MCP
  463. *
  464. * @param p_hwfn - HW func
  465. * @param p_ptt - PTT required for register access
  466. *
  467. * @return int
  468. */
  469. int qed_mcp_cmd_init(struct qed_hwfn *p_hwfn,
  470. struct qed_ptt *p_ptt);
  471. /**
  472. * @brief Initialize the port interface with the MCP
  473. *
  474. * @param p_hwfn
  475. * @param p_ptt
  476. * Can only be called after `num_ports_in_engines' is set
  477. */
  478. void qed_mcp_cmd_port_init(struct qed_hwfn *p_hwfn,
  479. struct qed_ptt *p_ptt);
  480. /**
  481. * @brief Releases resources allocated during the init process.
  482. *
  483. * @param p_hwfn - HW func
  484. * @param p_ptt - PTT required for register access
  485. *
  486. * @return int
  487. */
  488. int qed_mcp_free(struct qed_hwfn *p_hwfn);
  489. /**
  490. * @brief This function is called from the DPC context. After
  491. * pointing PTT to the mfw mb, check for events sent by the MCP
  492. * to the driver and ack them. In case a critical event
  493. * detected, it will be handled here, otherwise the work will be
  494. * queued to a sleepable work-queue.
  495. *
  496. * @param p_hwfn - HW function
  497. * @param p_ptt - PTT required for register access
  498. * @return int - 0 - operation
  499. * was successul.
  500. */
  501. int qed_mcp_handle_events(struct qed_hwfn *p_hwfn,
  502. struct qed_ptt *p_ptt);
  503. /**
  504. * @brief Sends a LOAD_REQ to the MFW, and in case operation
  505. * succeed, returns whether this PF is the first on the
  506. * chip/engine/port or function. This function should be
  507. * called when driver is ready to accept MFW events after
  508. * Storms initializations are done.
  509. *
  510. * @param p_hwfn - hw function
  511. * @param p_ptt - PTT required for register access
  512. * @param p_load_code - The MCP response param containing one
  513. * of the following:
  514. * FW_MSG_CODE_DRV_LOAD_ENGINE
  515. * FW_MSG_CODE_DRV_LOAD_PORT
  516. * FW_MSG_CODE_DRV_LOAD_FUNCTION
  517. * @return int -
  518. * 0 - Operation was successul.
  519. * -EBUSY - Operation failed
  520. */
  521. int qed_mcp_load_req(struct qed_hwfn *p_hwfn,
  522. struct qed_ptt *p_ptt,
  523. u32 *p_load_code);
  524. /**
  525. * @brief Read the MFW mailbox into Current buffer.
  526. *
  527. * @param p_hwfn
  528. * @param p_ptt
  529. */
  530. void qed_mcp_read_mb(struct qed_hwfn *p_hwfn,
  531. struct qed_ptt *p_ptt);
  532. /**
  533. * @brief Ack to mfw that driver finished FLR process for VFs
  534. *
  535. * @param p_hwfn
  536. * @param p_ptt
  537. * @param vfs_to_ack - bit mask of all engine VFs for which the PF acks.
  538. *
  539. * @param return int - 0 upon success.
  540. */
  541. int qed_mcp_ack_vf_flr(struct qed_hwfn *p_hwfn,
  542. struct qed_ptt *p_ptt, u32 *vfs_to_ack);
  543. /**
  544. * @brief - calls during init to read shmem of all function-related info.
  545. *
  546. * @param p_hwfn
  547. *
  548. * @param return 0 upon success.
  549. */
  550. int qed_mcp_fill_shmem_func_info(struct qed_hwfn *p_hwfn,
  551. struct qed_ptt *p_ptt);
  552. /**
  553. * @brief - Reset the MCP using mailbox command.
  554. *
  555. * @param p_hwfn
  556. * @param p_ptt
  557. *
  558. * @param return 0 upon success.
  559. */
  560. int qed_mcp_reset(struct qed_hwfn *p_hwfn,
  561. struct qed_ptt *p_ptt);
  562. /**
  563. * @brief - Sends an NVM read command request to the MFW to get
  564. * a buffer.
  565. *
  566. * @param p_hwfn
  567. * @param p_ptt
  568. * @param cmd - Command: DRV_MSG_CODE_NVM_GET_FILE_DATA or
  569. * DRV_MSG_CODE_NVM_READ_NVRAM commands
  570. * @param param - [0:23] - Offset [24:31] - Size
  571. * @param o_mcp_resp - MCP response
  572. * @param o_mcp_param - MCP response param
  573. * @param o_txn_size - Buffer size output
  574. * @param o_buf - Pointer to the buffer returned by the MFW.
  575. *
  576. * @param return 0 upon success.
  577. */
  578. int qed_mcp_nvm_rd_cmd(struct qed_hwfn *p_hwfn,
  579. struct qed_ptt *p_ptt,
  580. u32 cmd,
  581. u32 param,
  582. u32 *o_mcp_resp,
  583. u32 *o_mcp_param, u32 *o_txn_size, u32 *o_buf);
  584. /**
  585. * @brief indicates whether the MFW objects [under mcp_info] are accessible
  586. *
  587. * @param p_hwfn
  588. *
  589. * @return true iff MFW is running and mcp_info is initialized
  590. */
  591. bool qed_mcp_is_init(struct qed_hwfn *p_hwfn);
  592. /**
  593. * @brief request MFW to configure MSI-X for a VF
  594. *
  595. * @param p_hwfn
  596. * @param p_ptt
  597. * @param vf_id - absolute inside engine
  598. * @param num_sbs - number of entries to request
  599. *
  600. * @return int
  601. */
  602. int qed_mcp_config_vf_msix(struct qed_hwfn *p_hwfn,
  603. struct qed_ptt *p_ptt, u8 vf_id, u8 num);
  604. /**
  605. * @brief - Halt the MCP.
  606. *
  607. * @param p_hwfn
  608. * @param p_ptt
  609. *
  610. * @param return 0 upon success.
  611. */
  612. int qed_mcp_halt(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
  613. /**
  614. * @brief - Wake up the MCP.
  615. *
  616. * @param p_hwfn
  617. * @param p_ptt
  618. *
  619. * @param return 0 upon success.
  620. */
  621. int qed_mcp_resume(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
  622. int qed_configure_pf_min_bandwidth(struct qed_dev *cdev, u8 min_bw);
  623. int qed_configure_pf_max_bandwidth(struct qed_dev *cdev, u8 max_bw);
  624. int __qed_configure_pf_max_bandwidth(struct qed_hwfn *p_hwfn,
  625. struct qed_ptt *p_ptt,
  626. struct qed_mcp_link_state *p_link,
  627. u8 max_bw);
  628. int __qed_configure_pf_min_bandwidth(struct qed_hwfn *p_hwfn,
  629. struct qed_ptt *p_ptt,
  630. struct qed_mcp_link_state *p_link,
  631. u8 min_bw);
  632. int qed_mcp_mask_parities(struct qed_hwfn *p_hwfn,
  633. struct qed_ptt *p_ptt, u32 mask_parities);
  634. /**
  635. * @brief Send eswitch mode to MFW
  636. *
  637. * @param p_hwfn
  638. * @param p_ptt
  639. * @param eswitch - eswitch mode
  640. *
  641. * @return int - 0 - operation was successful.
  642. */
  643. int qed_mcp_ov_update_eswitch(struct qed_hwfn *p_hwfn,
  644. struct qed_ptt *p_ptt,
  645. enum qed_ov_eswitch eswitch);
  646. /**
  647. * @brief - Gets the MFW allocation info for the given resource
  648. *
  649. * @param p_hwfn
  650. * @param p_ptt
  651. * @param p_resc_info - descriptor of requested resource
  652. * @param p_mcp_resp
  653. * @param p_mcp_param
  654. *
  655. * @return int - 0 - operation was successful.
  656. */
  657. int qed_mcp_get_resc_info(struct qed_hwfn *p_hwfn,
  658. struct qed_ptt *p_ptt,
  659. struct resource_info *p_resc_info,
  660. u32 *p_mcp_resp, u32 *p_mcp_param);
  661. #endif