1 /******************************************************************************* 2 Copyright (c) 2014-2022 NVidia Corporation 3 4 Permission is hereby granted, free of charge, to any person obtaining a copy 5 of this software and associated documentation files (the "Software"), to 6 deal in the Software without restriction, including without limitation the 7 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 sell copies of the Software, and to permit persons to whom the Software is 9 furnished to do so, subject to the following conditions: 10 11 The above copyright notice and this permission notice shall be 12 included in all copies or substantial portions of the Software. 13 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 DEALINGS IN THE SOFTWARE. 21 *******************************************************************************/ 22 23 // 24 // nvlink.h 25 // 26 27 #ifndef _NVLINK_H_ 28 #define _NVLINK_H_ 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 #include <nv-kernel-interface-api.h> 35 #include "nvlink_common.h" 36 #include "nvlink_lib_ctrl.h" 37 #include "nv_list.h" 38 #include "nvlink_errors.h" 39 #include "nvCpuUuid.h" 40 41 // Debug Prints 42 #if defined(DEVELOP) || defined(DEBUG) || defined(NV_MODS) 43 #define NVLINK_PRINT_ENABLED 1 44 #define NVLINK_PRINT(format_and_stuff) nvlink_print format_and_stuff 45 46 #define DBG_MODULE_NVLINK_CORE __FILE__, __LINE__, __FUNCTION__ 47 #define DBG_MODULE_IBMNPU DBG_MODULE_NVLINK_CORE 48 #define DBG_MODULE_TEGRASHIM DBG_MODULE_NVLINK_CORE 49 #define DBG_MODULE_EBRIDGE DBG_MODULE_NVLINK_CORE 50 #define DBG_MODULE_NVSWITCH DBG_MODULE_NVLINK_CORE 51 #else 52 #define NVLINK_PRINT(format_and_stuff) ((void)(0)) 53 #endif 54 55 // Devices that support NVLINK 56 #define NVLINK_DEVICE_TYPE_EBRIDGE 0x0 57 #define NVLINK_DEVICE_TYPE_IBMNPU 0x1 58 #define NVLINK_DEVICE_TYPE_GPU 0x2 59 #define NVLINK_DEVICE_TYPE_NVSWITCH 0x3 60 #define NVLINK_DEVICE_TYPE_TEGRASHIM 0x4 61 62 // NVLink versions 63 #define NVLINK_DEVICE_VERSION_10 0x00000001 64 #define NVLINK_DEVICE_VERSION_20 0x00000002 65 #define NVLINK_DEVICE_VERSION_22 0x00000004 66 #define NVLINK_DEVICE_VERSION_30 0x00000005 67 #define NVLINK_DEVICE_VERSION_31 0x00000006 68 #define NVLINK_DEVICE_VERSION_40 0x00000007 69 70 // Link Transition Timeouts in miliseconds 71 #define NVLINK_TRANSITION_OFF_TIMEOUT 1 72 #define NVLINK_TRANSITION_SAFE_TIMEOUT 300 73 #define NVLINK_TRANSITION_HS_TIMEOUT 8000 74 #define NVLINK_TRANSITION_ACTIVE_PENDING 2000 75 #define NVLINK_TRANSITION_POST_HS_TIMEOUT 70 76 77 // Link training seed values 78 #define NVLINK_MAX_SEED_NUM 6 79 #define NVLINK_MAX_SEED_BUFFER_SIZE NVLINK_MAX_SEED_NUM + 1 80 81 #define NVLINK_MAX_SYSTEM_LINK_NUM 624 82 83 // Forwards 84 struct nvlink_device; 85 struct nvlink_device_handle; 86 struct nvlink_link; 87 struct nvlink_link_handlers; 88 89 // nvlink device state 90 struct nvlink_device 91 { 92 NVListRec node; 93 94 // List of links associated with this device 95 NVListRec link_list; 96 97 // Uniquely identifies a device in the core 98 NvU64 deviceId; 99 100 // Client supplied names and ids 101 char *driverName; 102 char *deviceName; 103 NvU8 *uuid; 104 105 // PCI Information 106 struct nvlink_pci_info pciInfo; 107 108 // Device type and status 109 NvU64 type; 110 NvBool initialized; 111 112 // Training type: ALI or Non-ALI 113 NvBool enableALI; 114 115 // fabric node id 116 NvU16 nodeId; 117 118 // per Ioctrl data 119 NvU32 numIoctrls; 120 NvU32 numLinksPerIoctrl; 121 NvU32 numActiveLinksPerIoctrl; 122 123 // Client private information 124 void *pDevInfo; 125 }; 126 127 // nvlink link change type 128 enum nvlink_link_change_type 129 { 130 nvlink_retrain_from_off, 131 nvlink_retrain_from_safe, 132 133 }; 134 135 // nvlink link_change parameters 136 struct nvlink_link_change 137 { 138 struct nvlink_link *master; 139 struct nvlink_link *slave; 140 141 enum nvlink_link_change_type change_type; 142 }; 143 144 // 145 // Structure representing Nvlink Error Threshold 146 // 147 struct nvlink_link_error_threshold 148 { 149 NvU8 thresholdMan; 150 NvU8 thresholdExp; 151 NvU8 timescaleMan; 152 NvU8 timescaleExp; 153 NvBool bInterruptEn; 154 NvBool bUserConfig; 155 NvBool bInterruptTrigerred; // Error threshold interrupt generated 156 }; 157 158 // nvlink link state 159 struct nvlink_link 160 { 161 NVListRec node; 162 163 // Device the link is associated with 164 struct nvlink_device *dev; 165 166 // Lock for per link structure 167 void *linkLock; 168 169 // Uniquely identifies a link in the core 170 NvU64 linkId; 171 172 // If this link is the master of its connection 173 NvBool master; 174 175 // Client supplied link name and number 176 char *linkName; 177 NvU32 linkNumber; 178 179 NvU64 token; 180 181 // Link state 182 NvU32 state; 183 NvBool inSWCFG; 184 185 // Sublink states 186 NvU32 tx_sublink_state; 187 NvU32 rx_sublink_state; 188 189 // Has rceiver detect passed 190 NvBool bRxDetected; 191 192 // Link failed when sending InitPll to minion 193 NvBool bTxCommonModeFail; 194 195 // Link failed when transitioning to SWCFG 196 NvBool bSafeTransitionFail; 197 198 // Link failed when sending INITPHASE5 to minion 199 NvBool bInitphase5Fails; 200 201 // IP version 202 NvU32 version; 203 204 // Has state been saved 205 NvBool bStateSaved; 206 207 // Number of retries to put link to safe 208 NvU32 safe_retries; 209 210 // Set if LINK is ac coupled 211 NvBool ac_coupled; 212 213 // Number of retries to discover the other end of the link 214 NvU32 packet_injection_retries; 215 216 // Local Sid of the link. 217 NvU64 localSid; 218 219 // Remote Sid of the link. 220 NvU64 remoteSid; 221 222 // Remote LinkId to which the current link is connected. 223 NvU32 remoteLinkId; 224 225 NvU32 remoteDeviceType; 226 227 // Has INITNEGOTIATE received CONFIG_GOOD (NVL3.0+) 228 NvBool bInitnegotiateConfigGood; 229 230 // Power state transition status 231 enum 232 { 233 nvlink_power_state_in_L0, 234 nvlink_power_state_entering_L2, 235 nvlink_power_state_in_L2, 236 nvlink_power_state_exiting_L2 237 } powerStateTransitionStatus; 238 239 // Link handlers 240 const struct nvlink_link_handlers *link_handlers; 241 242 // Client private information 243 void *link_info; 244 245 // Outstanding link change request information 246 struct nvlink_link_change link_change; 247 248 //seed data for given nvlink 249 NvU32 seedData[NVLINK_MAX_SEED_BUFFER_SIZE]; 250 251 struct nvlink_link_error_threshold errorThreshold; 252 }; 253 254 // nvlink link handler ops 255 struct nvlink_link_handlers 256 { 257 NV_API_CALL NvlStatus (*add) (struct nvlink_link *link); 258 NV_API_CALL NvlStatus (*remove) (struct nvlink_link *link); 259 NV_API_CALL NvlStatus (*lock) (struct nvlink_link *link); 260 NV_API_CALL void (*unlock) (struct nvlink_link *link); 261 NV_API_CALL NvlStatus (*queue_link_change) (struct nvlink_link_change *link_change); 262 NV_API_CALL NvlStatus (*set_dl_link_mode) (struct nvlink_link *link, NvU64 mode, NvU32 flags); 263 NV_API_CALL NvlStatus (*get_dl_link_mode) (struct nvlink_link *link, NvU64 *mode); 264 NV_API_CALL NvlStatus (*set_tl_link_mode) (struct nvlink_link *link, NvU64 mode, NvU32 flags); 265 NV_API_CALL NvlStatus (*get_tl_link_mode) (struct nvlink_link *link, NvU64 *mode); 266 NV_API_CALL NvlStatus (*set_tx_mode) (struct nvlink_link *link, NvU64 mode, NvU32 flags); 267 NV_API_CALL NvlStatus (*get_tx_mode) (struct nvlink_link *link, NvU64 *mode, NvU32 *subMode); 268 NV_API_CALL NvlStatus (*set_rx_mode) (struct nvlink_link *link, NvU64 mode, NvU32 flags); 269 NV_API_CALL NvlStatus (*get_rx_mode) (struct nvlink_link *link, NvU64 *mode, NvU32 *subMode); 270 NV_API_CALL NvlStatus (*set_rx_detect) (struct nvlink_link *link, NvU32 flags); 271 NV_API_CALL NvlStatus (*get_rx_detect) (struct nvlink_link *link); 272 NV_API_CALL NvlStatus (*write_discovery_token) (struct nvlink_link *link, NvU64 token); 273 NV_API_CALL NvlStatus (*read_discovery_token) (struct nvlink_link *link, NvU64 *token); 274 NV_API_CALL void (*training_complete) (struct nvlink_link *link); 275 NV_API_CALL void (*get_uphy_load) (struct nvlink_link *link, NvBool* bUnlocked); 276 NV_API_CALL NvlStatus (*ali_training) (struct nvlink_link *link); 277 }; 278 279 // 280 // Represents an intranode connections in single/multi-node system. 281 // Both endpoints of the connection is visible from same node. 282 // 283 struct nvlink_intranode_conn 284 { 285 NVListRec node; 286 struct nvlink_link *end0; 287 struct nvlink_link *end1; 288 }; 289 290 // 291 // Represents internode connections in a multi-node system. 292 // One of the endpoint of the connection must be a local link. 293 // 294 struct nvlink_internode_conn 295 { 296 NVListRec node; 297 struct nvlink_link *local_end; 298 nvlink_remote_endpoint_info remote_end; 299 }; 300 301 302 // Typedefs 303 typedef struct nvlink_device nvlink_device; 304 typedef struct nvlink_device_handle nvlink_device_handle; 305 typedef struct nvlink_link nvlink_link; 306 typedef struct nvlink_link_change nvlink_link_change; 307 typedef struct nvlink_device_handlers nvlink_device_handlers; 308 typedef struct nvlink_link_handlers nvlink_link_handlers; 309 typedef struct nvlink_intranode_conn nvlink_intranode_conn; 310 typedef struct nvlink_internode_conn nvlink_internode_conn; 311 typedef enum nvlink_link_change_type nvlink_link_change_type; 312 typedef struct nvlink_inband_data nvlink_inband_data; 313 314 315 #define NVLINK_MAX_NUM_SAFE_RETRIES 7 316 #define NVLINK_MAX_NUM_PACKET_INJECTION_RETRIES 4 317 318 319 // NVLINK LINK states 320 #define NVLINK_LINKSTATE_OFF 0x00 // OFF 321 #define NVLINK_LINKSTATE_HS 0x01 // High Speed 322 #define NVLINK_LINKSTATE_SAFE 0x02 // Safe/Discovery State 323 #define NVLINK_LINKSTATE_FAULT 0x03 // Faulty 324 #define NVLINK_LINKSTATE_RECOVERY 0x04 // Recovery 325 #define NVLINK_LINKSTATE_FAIL 0x05 // Unconnected/Fail 326 #define NVLINK_LINKSTATE_DETECT 0x06 // Detect mode 327 #define NVLINK_LINKSTATE_RESET 0x07 // Reset 328 #define NVLINK_LINKSTATE_ENABLE_PM 0x08 // Enable Link Power Management 329 #define NVLINK_LINKSTATE_DISABLE_PM 0x09 // Disable Link Power Management 330 #define NVLINK_LINKSTATE_SLEEP 0x0A // Sleep (L2) 331 #define NVLINK_LINKSTATE_SAVE_STATE 0x0B // Save state while entering L2 332 #define NVLINK_LINKSTATE_RESTORE_STATE 0x0C // Restore state while exiting L2 333 #define NVLINK_LINKSTATE_PRE_HS 0x0E // Settings before moving to High Speed 334 #define NVLINK_LINKSTATE_DISABLE_ERR_DETECT 0x0F // Disable Error detection (interrupt) 335 #define NVLINK_LINKSTATE_LANE_DISABLE 0x10 // Disable Lanes 336 #define NVLINK_LINKSTATE_LANE_SHUTDOWN 0x11 // Shutdown Lanes in PHY 337 #define NVLINK_LINKSTATE_TRAFFIC_SETUP 0x12 // Setup traffic flow after ACTIVE 338 #define NVLINK_LINKSTATE_INITPHASE1 0x13 // INITPHASE1 339 #define NVLINK_LINKSTATE_INITNEGOTIATE 0x14 // Initialize the negotiation (Ampere And Later) 340 #define NVLINK_LINKSTATE_POST_INITNEGOTIATE 0x15 // Sends DL stat 341 #define NVLINK_LINKSTATE_INITOPTIMIZE 0x16 // INITOPTIMIZE 342 #define NVLINK_LINKSTATE_POST_INITOPTIMIZE 0x17 // POST INITOPTIMIZE DL stat check 343 #define NVLINK_LINKSTATE_DISABLE_HEARTBEAT 0x18 // Disables the heartbeat errors 344 #define NVLINK_LINKSTATE_CONTAIN 0x19 // TL is in contain mode 345 #define NVLINK_LINKSTATE_INITTL 0x1A // INITTL 346 #define NVLINK_LINKSTATE_INITPHASE5 0x1B // INITPHASE5 347 #define NVLINK_LINKSTATE_ALI 0x1C // ALI 348 #define NVLINK_LINKSTATE_ACTIVE_PENDING 0x1D // Intermediate state for a link going to active 349 #define NVLINK_LINKSTATE_INVALID 0xFF // Invalid state 350 351 // NVLINK TX SUBLINK states 352 #define NVLINK_SUBLINK_STATE_TX_HS 0x0 // TX High Speed 353 #define NVLINK_SUBLINK_STATE_TX_SINGLE_LANE 0x4 // TX Single Lane (1/8th or 1/4th) Mode (Deprecated) 354 #define NVLINK_SUBLINK_STATE_TX_LOW_POWER 0x4 // TX Single Lane Mode / L1 355 #define NVLINK_SUBLINK_STATE_TX_TRAIN 0x5 // TX training 356 #define NVLINK_SUBLINK_STATE_TX_SAFE 0x6 // TX Safe Mode 357 #define NVLINK_SUBLINK_STATE_TX_OFF 0x7 // TX OFF 358 #define NVLINK_SUBLINK_STATE_TX_COMMON_MODE 0x8 // TX common mode enable 359 #define NVLINK_SUBLINK_STATE_TX_COMMON_MODE_DISABLE 0x9 // TX common mode disable 360 #define NVLINK_SUBLINK_STATE_TX_DATA_READY 0xA // Do Data Ready and Data Enable 361 #define NVLINK_SUBLINK_STATE_TX_EQ 0xB // TX equalization 362 #define NVLINK_SUBLINK_STATE_TX_PRBS_EN 0xC // TX IOBIST PRBS generator enable 363 #define NVLINK_SUBLINK_STATE_TX_POST_HS 0xD // TX Post High Speed settings 364 365 // NVLINK RX SUBLINK states 366 #define NVLINK_SUBLINK_STATE_RX_HS 0x0 // RX High Speed 367 #define NVLINK_SUBLINK_STATE_RX_SINGLE_LANE 0x4 // RX Single Lane (1/8th or 1/4th) Mode (Deprecated) 368 #define NVLINK_SUBLINK_STATE_RX_LOW_POWER 0x4 // RX Single Lane Mode / L1 369 #define NVLINK_SUBLINK_STATE_RX_TRAIN 0x5 // RX training 370 #define NVLINK_SUBLINK_STATE_RX_SAFE 0x6 // RX Safe Mode 371 #define NVLINK_SUBLINK_STATE_RX_OFF 0x7 // RX OFF 372 #define NVLINK_SUBLINK_STATE_RX_RXCAL 0x8 // RX in calibration 373 #define NVLINK_SUBLINK_STATE_RX_INIT_TERM 0x9 // Enable RX termination 374 375 // NVLINK TX SUBLINK sub-states 376 #define NVLINK_SUBLINK_SUBSTATE_TX_STABLE 0x0 // TX Stable 377 378 // NVLINK RX SUBLINK sub-states 379 #define NVLINK_SUBLINK_SUBSTATE_RX_STABLE 0x0 // RX Stable 380 381 // State change flags 382 #define NVLINK_STATE_CHANGE_ASYNC 0x0 // Don't wait for the state change to complete 383 #define NVLINK_STATE_CHANGE_SYNC 0x1 // Wait for the state change to complete 384 385 386 /************************************************************************************************/ 387 /***************************** NVLink library management functions ******************************/ 388 /************************************************************************************************/ 389 390 /* 391 * Check if the nvlink core library is initialized 392 */ 393 NvBool nvlink_lib_is_initialized(void); 394 395 /* 396 * Check if there are no devices registered 397 */ 398 NvBool nvlink_lib_is_device_list_empty(void); 399 400 401 /************************************************************************************************/ 402 /************************** NVLink library driver-side interface ********************************/ 403 /***************** Manages device and link registration and un-registration *********************/ 404 /************************************************************************************************/ 405 406 /* 407 * Associates device in the NVLink Core 408 * During the call, the calling driver must support callbacks into the driver from Core 409 */ 410 NvlStatus nvlink_lib_register_device(nvlink_device *dev); 411 412 /* 413 * Unassociates device in the NVLink Core 414 * Includes removing any links related to the device if still registered 415 * During the call, the calling driver must support callbacks into the driver from Core 416 */ 417 NvlStatus nvlink_lib_unregister_device(nvlink_device *dev); 418 419 420 /* 421 * Associates link with a device in the NVLink Core 422 * During the call, the calling driver must support callbacks into the driver from Core 423 */ 424 NvlStatus nvlink_lib_register_link(nvlink_device *dev, nvlink_link *link); 425 426 /* 427 * Unassociates link from a device in the NVLink Core 428 * During the call, the calling driver must support callbacks into the driver from Core 429 */ 430 NvlStatus nvlink_lib_unregister_link(nvlink_link *link); 431 432 433 /************************************************************************************************/ 434 /******************************* NVLink link management functions *******************************/ 435 /************************************************************************************************/ 436 437 /* 438 * Check if the device has no links registered 439 */ 440 NvBool nvlink_lib_is_link_list_empty(nvlink_device *dev); 441 442 /* 443 * Get the link associated with the given device's link number 444 */ 445 NvlStatus nvlink_lib_get_link(nvlink_device *device, 446 NvU32 link_id, 447 nvlink_link **link); 448 449 /* 450 * Set the link endpoint as the link master 451 */ 452 NvlStatus nvlink_lib_set_link_master(nvlink_link *link); 453 454 /* 455 * Get the link master associated with this endpoint 456 */ 457 NvlStatus nvlink_lib_get_link_master(nvlink_link *link, nvlink_link **master); 458 459 /* 460 * Set the training state for the given link as non-ALI or ALI 461 */ 462 NvlStatus nvlink_lib_is_link_using_ALI(nvlink_link *link, NvBool *usingALI); 463 464 /* 465 * Set the training state for the given link as non-ALI or ALI 466 */ 467 NvlStatus nvlink_lib_link_set_training_mode(nvlink_link *link, NvBool enableALI); 468 /************************************************************************************************/ 469 /*************************** NVLink topology discovery functions ********************************/ 470 /************************************************************************************************/ 471 472 /* 473 * Get the connected remote endpoint information 474 * For a given link, return the other endpoint details it is connected 475 * to. If there is no connection associated with the given link, then 476 * conn_info.connected member will be NV_FALSE. 477 * 478 * Note: This routine will not initiate any link initialization or topology 479 * discovery. 480 */ 481 NvlStatus nvlink_lib_get_remote_conn_info(nvlink_link *link, nvlink_conn_info *conn_info); 482 483 /* 484 * Get the connected remote endpoint information 485 * For a given end of a link, returns the device and link information 486 * for the remote end along with a boolean variable that specifies if 487 * the topology detection was complete 488 */ 489 NvlStatus nvlink_lib_discover_and_get_remote_conn_info(nvlink_link *end, 490 nvlink_conn_info *conn_info, 491 NvU32 flags); 492 493 494 /************************************************************************************************/ 495 /****************************** NVLink initialization functions *********************************/ 496 /************************************************************************************************/ 497 498 /* 499 * Re-init a given link from OFF to SWCFG 500 */ 501 NvlStatus nvlink_lib_reinit_link_from_off_to_swcfg(nvlink_link *link, 502 NvU32 flags); 503 504 /************************************************************************************************/ 505 /********************************** NVLink training functions ***********************************/ 506 /************************************************************************************************/ 507 508 /* 509 * Train a given set of links from SWCFG to ACTIVE state 510 * a. For low training latency - caller passes all links as an array 511 * b. For high training latency - caller passes link one by one 512 */ 513 NvlStatus nvlink_lib_train_links_from_swcfg_to_active(nvlink_link **links, 514 NvU32 linkCount, 515 NvU32 flags); 516 517 /* 518 * Train a given set of links of a device from L2 to ACTIVE state 519 */ 520 NvlStatus nvlink_lib_train_links_from_L2_to_active(nvlink_device *dev, 521 NvU32 linkMask, 522 NvU32 flags); 523 524 /* 525 * Retrain a given link from SWCFG to ACTIVE 526 */ 527 NvlStatus nvlink_lib_retrain_link_from_swcfg_to_active(nvlink_link *link, 528 NvU32 flags); 529 530 /* 531 * Save the seed Data passed in from an endpoint driver 532 */ 533 NvlStatus nvlink_lib_save_training_seeds(nvlink_link * link, 534 NvU32 * seedData); 535 NvlStatus nvlink_lib_copy_training_seeds(nvlink_link * link, 536 NvU32 * seedDataCopy); 537 538 /* 539 * Send the endpoint driver back the seeds we have stored 540 */ 541 void nvlink_lib_restore_training_seeds(nvlink_link * link, 542 NvU32 * seedData); 543 544 /* 545 * Check that the requested links have trained to active 546 */ 547 NvlStatus nvlink_lib_check_training_complete(nvlink_link **links, 548 NvU32 linkCount); 549 550 551 /************************************************************************************************/ 552 /********************************** NVLink shutdown functions ***********************************/ 553 /************************************************************************************************/ 554 555 /* 556 * [CLEAN SHUTDOWN] 557 * Shutdown given links of a device from active to L2 state 558 */ 559 NvlStatus nvlink_lib_powerdown_links_from_active_to_L2(nvlink_device *dev, 560 NvU32 linkMask, 561 NvU32 flags); 562 563 /* 564 * [PSEUDO-CLEAN SHUTDOWN] 565 * Shutdown the given array of links from ACTIVE to OFF state 566 */ 567 NvlStatus nvlink_lib_powerdown_links_from_active_to_off(nvlink_link **links, 568 NvU32 numLinks, 569 NvU32 flags); 570 571 /* 572 * Power down the given array of links from ACTIVE to SWCFG state 573 */ 574 NvlStatus nvlink_lib_powerdown_links_from_active_to_swcfg(nvlink_link **links, 575 NvU32 numLinks, 576 NvU32 flags); 577 578 /* 579 * Reset the given array of links 580 */ 581 NvlStatus nvlink_lib_reset_links(nvlink_link **links, 582 NvU32 numLinks, 583 NvU32 flags); 584 585 /* 586 * Floorsweep the necessary links and set buffer ready on the active links 587 */ 588 NvlStatus nvlink_lib_powerdown_floorswept_links_to_off(nvlink_device *pDevice); 589 590 591 /* 592 * Nvlink core library structure iterators 593 */ 594 595 #define FOR_EACH_DEVICE_REGISTERED(dev, head, node) \ 596 nvListForEachEntry(dev, &head.node, node) 597 598 #define FOR_EACH_LINK_REGISTERED(link, dev, node) \ 599 nvListForEachEntry(link, &dev->link_list, node) 600 601 #define FOR_EACH_LINK_REGISTERED_SAFE(link, next, dev, node) \ 602 nvListForEachEntry_safe(link, next, &dev->link_list, node) 603 604 #define FOR_EACH_CONNECTION(conn, head, node) \ 605 nvListForEachEntry(conn, &head.node, node) 606 607 #ifdef __cplusplus 608 } 609 #endif 610 611 #endif // _NVLINK_H_ 612