OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2009 NVIDIA Corporation. |
| 3 * All rights reserved. |
| 4 * |
| 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: |
| 7 * |
| 8 * Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. |
| 10 * |
| 11 * Redistributions in binary form must reproduce the above copyright notice, |
| 12 * this list of conditions and the following disclaimer in the documentation |
| 13 * and/or other materials provided with the distribution. |
| 14 * |
| 15 * Neither the name of the NVIDIA Corporation nor the names of its contributors |
| 16 * may be used to endorse or promote products derived from this software |
| 17 * without specific prior written permission. |
| 18 * |
| 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 29 * POSSIBILITY OF SUCH DAMAGE. |
| 30 * |
| 31 */ |
| 32 |
| 33 #ifndef INCLUDED_nvrm_module_H |
| 34 #define INCLUDED_nvrm_module_H |
| 35 |
| 36 |
| 37 #if defined(__cplusplus) |
| 38 extern "C" |
| 39 { |
| 40 #endif |
| 41 |
| 42 #include "nvrm_init.h" |
| 43 |
| 44 #include "nvrm_drf.h" |
| 45 |
| 46 /** |
| 47 * SOC hardware controller class identifiers. |
| 48 */ |
| 49 |
| 50 typedef enum |
| 51 { |
| 52 |
| 53 /// Specifies an invalid module ID. |
| 54 NvRmModuleID_Invalid = 0, |
| 55 |
| 56 /// Specifies the application processor. |
| 57 NvRmModuleID_Cpu, |
| 58 |
| 59 /// Specifies the Audio Video Processor |
| 60 NvRmModuleID_Avp, |
| 61 |
| 62 /// Specifies the Vector Co Processor |
| 63 NvRmModuleID_Vcp, |
| 64 |
| 65 /// Specifies the display controller. |
| 66 NvRmModuleID_Display, |
| 67 |
| 68 /// Specifies the IDE controller. |
| 69 NvRmModuleID_Ide, |
| 70 |
| 71 /// Graphics Host |
| 72 NvRmModuleID_GraphicsHost, |
| 73 |
| 74 /// Specifies 2D graphics controller |
| 75 NvRmModuleID_2D, |
| 76 |
| 77 /// Specifies 3D graphics controller |
| 78 NvRmModuleID_3D, |
| 79 |
| 80 /// Specifies VG graphics controller |
| 81 NvRmModuleID_VG, |
| 82 |
| 83 /// NV epp (encoder pre-processor) |
| 84 NvRmModuleID_Epp, |
| 85 |
| 86 /// NV isp (image signal processor) |
| 87 NvRmModuleID_Isp, |
| 88 |
| 89 /// NV vi (video input) |
| 90 NvRmModuleID_Vi, |
| 91 |
| 92 /// Specifies USB2 OTG controller |
| 93 NvRmModuleID_Usb2Otg, |
| 94 |
| 95 /// Specifies the I2S controller. |
| 96 NvRmModuleID_I2s, |
| 97 |
| 98 /// Specifies the Pulse Width Modulator controller. |
| 99 NvRmModuleID_Pwm, |
| 100 |
| 101 /// Specifies the Three Wire controller. |
| 102 NvRmModuleID_Twc, |
| 103 |
| 104 /// HSMMC controller |
| 105 NvRmModuleID_Hsmmc, |
| 106 |
| 107 /// Specifies SDIO controller |
| 108 NvRmModuleID_Sdio, |
| 109 |
| 110 /// Specifies the NAND controller. |
| 111 NvRmModuleID_Nand, |
| 112 |
| 113 /// Specifies the I2C controller. |
| 114 NvRmModuleID_I2c, |
| 115 |
| 116 /// Specifies the Sony Phillips Digital Interface Format controller. |
| 117 NvRmModuleID_Spdif, |
| 118 |
| 119 /// Specifies the %UART controller. |
| 120 NvRmModuleID_Uart, |
| 121 |
| 122 /// Specifies the timer controller. |
| 123 NvRmModuleID_Timer, |
| 124 |
| 125 /// Specifies the timer controller microsecond counter. |
| 126 NvRmModuleID_TimerUs, |
| 127 |
| 128 /// Real time clock controller. |
| 129 NvRmModuleID_Rtc, |
| 130 |
| 131 /// Specifies the Audio Codec 97 controller. |
| 132 NvRmModuleID_Ac97, |
| 133 |
| 134 /// Specifies Audio Bit Stream Engine |
| 135 NvRmModuleID_BseA, |
| 136 |
| 137 /// Specifies Video decoder |
| 138 NvRmModuleID_Vde, |
| 139 |
| 140 /// Specifies Video encoder (Motion Picture Encoder) |
| 141 NvRmModuleID_Mpe, |
| 142 |
| 143 /// Specifies Camera Serial Interface |
| 144 NvRmModuleID_Csi, |
| 145 |
| 146 /// Specifies High-Bandwidth Digital Content Protection interface |
| 147 NvRmModuleID_Hdcp, |
| 148 |
| 149 /// Specifies High definition Multimedia Interface |
| 150 NvRmModuleID_Hdmi, |
| 151 |
| 152 /// Specifies MIPI baseband controller |
| 153 NvRmModuleID_Mipi, |
| 154 |
| 155 /// Specifies TV out controller |
| 156 NvRmModuleID_Tvo, |
| 157 |
| 158 /// Specifies Serial Display |
| 159 NvRmModuleID_Dsi, |
| 160 |
| 161 /// Specifies Dynamic Voltage Controller |
| 162 NvRmModuleID_Dvc, |
| 163 |
| 164 /// Specifies the eXtended I/O controller. |
| 165 NvRmModuleID_Xio, |
| 166 |
| 167 /// SPI controller |
| 168 NvRmModuleID_Spi, |
| 169 |
| 170 /// Specifies SLink controller |
| 171 NvRmModuleID_Slink, |
| 172 |
| 173 /// Specifies FUSE controller |
| 174 NvRmModuleID_Fuse, |
| 175 |
| 176 /// Specifies KFUSE controller |
| 177 NvRmModuleID_KFuse, |
| 178 |
| 179 /// Specifies EthernetMIO controller |
| 180 NvRmModuleID_Mio, |
| 181 |
| 182 /// Specifies keyboard controller |
| 183 NvRmModuleID_Kbc, |
| 184 |
| 185 /// Specifies Pmif controller |
| 186 NvRmModuleID_Pmif, |
| 187 |
| 188 /// Specifies Unified Command Queue |
| 189 NvRmModuleID_Ucq, |
| 190 |
| 191 /// Specifies Event controller |
| 192 NvRmModuleID_EventCtrl, |
| 193 |
| 194 /// Specifies Flow controller |
| 195 NvRmModuleID_FlowCtrl, |
| 196 |
| 197 /// Resource Semaphore |
| 198 NvRmModuleID_ResourceSema, |
| 199 |
| 200 /// Arbitration Semaphore |
| 201 NvRmModuleID_ArbitrationSema, |
| 202 |
| 203 /// Specifies Arbitration Priority |
| 204 NvRmModuleID_ArbPriority, |
| 205 |
| 206 /// Specifies Cache Memory Controller |
| 207 NvRmModuleID_CacheMemCtrl, |
| 208 |
| 209 /// Specifies very fast infra red controller |
| 210 NvRmModuleID_Vfir, |
| 211 |
| 212 /// Specifies Exception Vector |
| 213 NvRmModuleID_ExceptionVector, |
| 214 |
| 215 /// Specifies Boot Strap Controller |
| 216 NvRmModuleID_BootStrap, |
| 217 |
| 218 /// Specifies System Statistics Monitor controller |
| 219 NvRmModuleID_SysStatMonitor, |
| 220 |
| 221 /// Specifies System |
| 222 NvRmModuleID_Cdev, |
| 223 |
| 224 /// Misc module ID which contains registers for PInmux/DAP control etc. |
| 225 NvRmModuleID_Misc, |
| 226 |
| 227 // PCIE Device attached to AP20 |
| 228 NvRmModuleID_PcieDevice, |
| 229 |
| 230 // One-wire interface controller |
| 231 NvRmModuleID_OneWire, |
| 232 |
| 233 // Sync NOR controller |
| 234 NvRmModuleID_SyncNor, |
| 235 |
| 236 // NOR Memory aperture |
| 237 NvRmModuleID_Nor, |
| 238 |
| 239 // AVP UCQ module. |
| 240 NvRmModuleID_AvpUcq, |
| 241 |
| 242 /// clock and reset controller |
| 243 NvRmPrivModuleID_ClockAndReset, |
| 244 |
| 245 /// interrupt controller |
| 246 NvRmPrivModuleID_Interrupt, |
| 247 |
| 248 /// interrupt controller Arbitration Semaphore grant registers |
| 249 NvRmPrivModuleID_InterruptArbGnt, |
| 250 |
| 251 /// interrupt controller DMA Tx/Rx DRQ registers |
| 252 NvRmPrivModuleID_InterruptDrq, |
| 253 |
| 254 /// interrupt controller special SW interrupt |
| 255 NvRmPrivModuleID_InterruptSw, |
| 256 |
| 257 /// interrupt controller special CPU interrupt |
| 258 NvRmPrivModuleID_InterruptCpu, |
| 259 |
| 260 /// Apb Dma controller |
| 261 NvRmPrivModuleID_ApbDma, |
| 262 |
| 263 /// Apb Dma Channel |
| 264 NvRmPrivModuleID_ApbDmaChannel, |
| 265 |
| 266 /// Gpio controller |
| 267 NvRmPrivModuleID_Gpio, |
| 268 |
| 269 /// Pin-Mux Controller |
| 270 NvRmPrivModuleID_PinMux, |
| 271 |
| 272 /// memory configuation |
| 273 NvRmPrivModuleID_Mselect, |
| 274 |
| 275 /// memory controller (internal memory and memory arbitration) |
| 276 NvRmPrivModuleID_MemoryController, |
| 277 |
| 278 /// external memory (ddr ram, etc.) |
| 279 NvRmPrivModuleID_ExternalMemoryController, |
| 280 |
| 281 /// Processor Id |
| 282 NvRmPrivModuleID_ProcId, |
| 283 |
| 284 /// Entire System (used for system reset) |
| 285 NvRmPrivModuleID_System, |
| 286 |
| 287 /* CC device id (not sure what it actually does, but it is needed to |
| 288 * set the mem_init_done bit so that memory works). |
| 289 */ |
| 290 NvRmPrivModuleID_CC, |
| 291 |
| 292 /// AHB Arbitration Control |
| 293 NvRmPrivModuleID_Ahb_Arb_Ctrl, |
| 294 |
| 295 /// AHB Gizmo Control |
| 296 NvRmPrivModuleID_Ahb_Gizmo_Ctrl, |
| 297 |
| 298 /// External memory |
| 299 NvRmPrivModuleID_ExternalMemory, |
| 300 |
| 301 /// Internal memory |
| 302 NvRmPrivModuleID_InternalMemory, |
| 303 |
| 304 /// TCRAM |
| 305 NvRmPrivModuleID_Tcram, |
| 306 |
| 307 /// IRAM |
| 308 NvRmPrivModuleID_Iram, |
| 309 |
| 310 /// GART |
| 311 NvRmPrivModuleID_Gart, |
| 312 |
| 313 /// MIO/EXIO |
| 314 NvRmPrivModuleID_Mio_Exio, |
| 315 |
| 316 /* External PMU */ |
| 317 NvRmPrivModuleID_PmuExt, |
| 318 |
| 319 /* One module ID for all peripherals which includes cache controller, |
| 320 * SCU and interrupt controller */ |
| 321 NvRmPrivModuleID_ArmPerif, |
| 322 NvRmPrivModuleID_ArmInterruptctrl, |
| 323 |
| 324 /* PCIE Root Port internally is made up of 3 major blocks. These 3 blocks |
| 325 * have seperate reset and clock domains. So, the driver treats these |
| 326 * |
| 327 * AFI is the wrapper on the top of the PCI core. |
| 328 * PCIe refers to the core PCIe state machine module. |
| 329 * PcieXclk refers to the transmit/receive logic which runs at different |
| 330 * clock and have different reset. |
| 331 * */ |
| 332 NvRmPrivModuleID_Afi, |
| 333 NvRmPrivModuleID_Pcie, |
| 334 NvRmPrivModuleID_PcieXclk, |
| 335 |
| 336 /* PL310 */ |
| 337 NvRmPrivModuleID_Pl310, |
| 338 |
| 339 /* |
| 340 * AHB re-map aperture seen from AVP. Use this aperture for AVP to have |
| 341 * uncached access to SDRAM. |
| 342 */ |
| 343 NvRmPrivModuleID_AhbRemap, |
| 344 NvRmModuleID_Num, |
| 345 NvRmModuleID_Force32 = 0x7FFFFFFF |
| 346 } NvRmModuleID; |
| 347 |
| 348 /* FIXME |
| 349 * Hack to make the existing drivers work. |
| 350 * NvRmPriv* should be renamed to NvRm* |
| 351 */ |
| 352 #define NvRmPrivModuleID_Num NvRmModuleID_Num |
| 353 |
| 354 /** |
| 355 * Multiple module instances are handled by packing the instance number into |
| 356 * the high bits of the module id. This avoids ponderous apis with both |
| 357 * module ids and instance numbers. |
| 358 */ |
| 359 |
| 360 /** |
| 361 * Module bitfields that are compatible with the NV_DRF macros. |
| 362 */ |
| 363 #define NVRM_MODULE_0 (0x0) |
| 364 #define NVRM_MODULE_0_ID_RANGE 15:0 |
| 365 #define NVRM_MODULE_0_INSTANCE_RANGE 19:16 |
| 366 #define NVRM_MODULE_0_BAR_RANGE 23:20 |
| 367 |
| 368 /** |
| 369 * Create a module id with a given instance. |
| 370 */ |
| 371 #define NVRM_MODULE_ID( id, instance ) \ |
| 372 (NvRmModuleID)( \ |
| 373 NV_DRF_NUM( NVRM, MODULE, ID, (id) ) \ |
| 374 | NV_DRF_NUM( NVRM, MODULE, INSTANCE, (instance) ) ) |
| 375 |
| 376 /** |
| 377 * Get the actual module id. |
| 378 */ |
| 379 #define NVRM_MODULE_ID_MODULE( id ) \ |
| 380 NV_DRF_VAL( NVRM, MODULE, ID, (id) ) |
| 381 |
| 382 /** |
| 383 * Get the instance number of the module id. |
| 384 */ |
| 385 #define NVRM_MODULE_ID_INSTANCE( id ) \ |
| 386 NV_DRF_VAL( NVRM, MODULE, INSTANCE, (id) ) |
| 387 |
| 388 /** |
| 389 * Get the bar number for the module. |
| 390 */ |
| 391 #define NVRM_MODULE_ID_BAR( id ) \ |
| 392 NV_DRF_VAL( NVRM, MODULE, BAR, (id) ) |
| 393 |
| 394 /** |
| 395 * Module Information structure |
| 396 */ |
| 397 |
| 398 typedef struct NvRmModuleInfoRec |
| 399 { |
| 400 NvU32 Instance; |
| 401 NvU32 Bar; |
| 402 NvRmPhysAddr BaseAddress; |
| 403 NvU32 Length; |
| 404 } NvRmModuleInfo; |
| 405 |
| 406 /** |
| 407 * Returns list of available module instances and their information. |
| 408 * |
| 409 * @param hRmDeviceHandle The RM device handle |
| 410 * @param Module The module for which to get the number of instances. |
| 411 * @param pNum Unsigned integer indicating the number of module information |
| 412 * structures in the array pModuleInfo. |
| 413 * @param pModuleInfo A pointer to an array of module information structure, |
| 414 * where the size of array is determined by the value in pNum. |
| 415 * |
| 416 * @retval NvSuccess If successful, or the appropriate error. |
| 417 */ |
| 418 |
| 419 NvError NvRmModuleGetModuleInfo( |
| 420 NvRmDeviceHandle hDevice, |
| 421 NvRmModuleID module, |
| 422 NvU32 * pNum, |
| 423 NvRmModuleInfo * pModuleInfo ); |
| 424 |
| 425 /** |
| 426 * Returns a physical address associated with a hardware module. |
| 427 * (To be depcreated and replaced by NvRmModuleGetModuleInfo) |
| 428 * |
| 429 * @param hRmDeviceHandle The RM device handle |
| 430 * @param Module the module for which to get addresses. |
| 431 * @param pBaseAddress a pointer to the beginning of the |
| 432 * hardware register bank is stored here. |
| 433 * @param pSize the length of the aperture in bytes is stored |
| 434 * here. |
| 435 */ |
| 436 |
| 437 void NvRmModuleGetBaseAddress( |
| 438 NvRmDeviceHandle hRmDeviceHandle, |
| 439 NvRmModuleID Module, |
| 440 NvRmPhysAddr * pBaseAddress, |
| 441 NvU32 * pSize ); |
| 442 |
| 443 /** |
| 444 * Returns the number of instances of a particular hardware module. |
| 445 * (To be depcreated and replaced by NvRmModuleGetModuleInfo) |
| 446 * |
| 447 * @param hRmDeviceHandle The RM device handle |
| 448 * @param Module The module for which to get the number of instances. |
| 449 * |
| 450 * @returns Number of instances. |
| 451 */ |
| 452 |
| 453 NvU32 NvRmModuleGetNumInstances( |
| 454 NvRmDeviceHandle hRmDeviceHandle, |
| 455 NvRmModuleID Module ); |
| 456 |
| 457 /** |
| 458 * Resets the module controller hardware. |
| 459 * |
| 460 * @param hRmDeviceHandle The RM device handle |
| 461 * @param Module The module to reset |
| 462 */ |
| 463 |
| 464 void NvRmModuleReset( |
| 465 NvRmDeviceHandle hRmDeviceHandle, |
| 466 NvRmModuleID Module ); |
| 467 |
| 468 /** |
| 469 * Resets the controller with an option to hold the controller in the reset. |
| 470 * |
| 471 * @param hRmDeviceHandle Rm device handle |
| 472 * @param Module The module to be reset |
| 473 * @param bHold If NV_TRUE hold the module in reset, If NV_TRUE pulse the |
| 474 * reset. |
| 475 * |
| 476 * So, to keep the module in reset and do something |
| 477 * NvRmModuleResetWithHold(hRm, ModId, NV_TRUE) |
| 478 * ... update some registers |
| 479 * NvRmModuleResetWithHold(hRm, ModId, NV_FALSE) |
| 480 */ |
| 481 |
| 482 void NvRmModuleResetWithHold( |
| 483 NvRmDeviceHandle hRmDeviceHandle, |
| 484 NvRmModuleID Module, |
| 485 NvBool bHold ); |
| 486 |
| 487 /** |
| 488 * DDK capability encapsualtion. See NvRmModuleGetCapabilities(). |
| 489 */ |
| 490 |
| 491 typedef struct NvRmModuleCapabilityRec |
| 492 { |
| 493 NvU8 MajorVersion; |
| 494 NvU8 MinorVersion; |
| 495 NvU8 EcoLevel; |
| 496 void* Capability; |
| 497 } NvRmModuleCapability; |
| 498 |
| 499 /** |
| 500 * Returns a pointer to a class-specific capabilities structure. |
| 501 * |
| 502 * Each DDK will supply a list of NvRmCapability structures sorted by module |
| 503 * Minor and Eco levels (assuming that no DDK supports two Major versions |
| 504 * simulatenously). The last cap in the list that matches the hardware's |
| 505 * version and eco level will be returned. If the current hardware's eco |
| 506 * level is higher than the given module capability list, the last module |
| 507 * capability with the highest eco level (the last in the list) will be |
| 508 * returned. |
| 509 * |
| 510 * @param hRmDeviceHandle The RM device handle |
| 511 * @param Module the target module |
| 512 * @param pCaps Pointer to the capability list |
| 513 * @param NumCaps The number of capabilities in the list |
| 514 * @param Capability Out parameter: the cap that maches the current hardware |
| 515 * |
| 516 * Example usage: |
| 517 * |
| 518 * typedef struct FakeDdkCapRec |
| 519 * { |
| 520 * NvU32 FeatureBits; |
| 521 * } FakeDdkCap; |
| 522 * |
| 523 * FakeDdkCap cap1; |
| 524 * FakeDdkCap cap2; |
| 525 * FakeDdkCap *cap; |
| 526 * NvRmModuleCapability caps[] = |
| 527 * { { 1, 0, 0, &fcap1 }, |
| 528 * { 1, 1, 0, &fcap2 }, |
| 529 * }; |
| 530 * cap1.bits = ...; |
| 531 * cap2.bits = ...; |
| 532 * err = NvRmModuleGetCapabilities( hDevice, NvRmModuleID_FakeDDK, caps, 2, |
| 533 * (void *)&cap ); |
| 534 * ... |
| 535 * if( cap->FeatureBits & FAKEDKK_SOME_FEATURE ) |
| 536 * { |
| 537 * ... |
| 538 * } |
| 539 */ |
| 540 |
| 541 NvError NvRmModuleGetCapabilities( |
| 542 NvRmDeviceHandle hDeviceHandle, |
| 543 NvRmModuleID Module, |
| 544 NvRmModuleCapability * pCaps, |
| 545 NvU32 NumCaps, |
| 546 void* * Capability ); |
| 547 |
| 548 /** |
| 549 * @brief Queries for the device unique ID. |
| 550 * |
| 551 * @pre Not callable from early boot. |
| 552 * |
| 553 * @param pId A pointer to an area of caller-allocated memory to hold the |
| 554 * unique ID. |
| 555 * @param pIdSize an input, a pointer to a variable containing the size of |
| 556 * the caller-allocated memory to hold the unique ID pointed to by \em pId. |
| 557 * Upon successful return, this value is updated to reflect the actual |
| 558 * size of the unique ID returned in \em pId. |
| 559 * |
| 560 * @retval ::NvError_Success \em pId points to the unique ID and \em pIdSize |
| 561 * points to the actual size of the ID. |
| 562 * @retval ::NvError_BadParameter |
| 563 * @retval ::NvError_NotSupported |
| 564 * @retval ::NvError_InsufficientMemory |
| 565 */ |
| 566 |
| 567 NvError NvRmQueryChipUniqueId( |
| 568 NvRmDeviceHandle hDevHandle, |
| 569 NvU32 IdSize, |
| 570 void* pId ); |
| 571 |
| 572 /** |
| 573 * @brief Returns random bytes using hardware sources of entropy |
| 574 * |
| 575 * @param hRmDeviceHandle The RM device handle |
| 576 * @param NumBytes Number of random bytes to return in pBytes. |
| 577 * @param pBytes Array where the random bytes should be stored |
| 578 * |
| 579 * @retval ::NvError_Success |
| 580 * @retval ::NvError_BadParameter |
| 581 * @retval ::NvError_NotSupported If no hardware entropy source is available |
| 582 */ |
| 583 |
| 584 NvError NvRmGetRandomBytes( |
| 585 NvRmDeviceHandle hRmDeviceHandle, |
| 586 NvU32 NumBytes, |
| 587 void* pBytes ); |
| 588 |
| 589 /* |
| 590 * Module access functions below. |
| 591 * NOTE: Rm doesn't gaurantee access to all the modules as it only maps a few |
| 592 * modules. |
| 593 * This is not meant to be a primary mechanism to access the module registers. |
| 594 * Clients should map their register address and access the registers. |
| 595 */ |
| 596 |
| 597 /** |
| 598 * NV_REGR: register read from hardware. |
| 599 * |
| 600 * @param rm The resource manager istance |
| 601 * @param aperture The register aperture |
| 602 * @param instance The module instance |
| 603 * @param offset The offset inside the aperture |
| 604 * |
| 605 * Note that the aperture comes from the RM's private module id enumeration, |
| 606 * which is a superset of the public enumeration from nvrm_module.h. |
| 607 */ |
| 608 |
| 609 /** |
| 610 * NV_REGW: register write to hardware. |
| 611 * |
| 612 * @param rm The resource manager istance |
| 613 * @param aperture The register aperture |
| 614 * @param instance The module instance |
| 615 * @param offset The offset inside the aperture |
| 616 * @param data The data to write |
| 617 * |
| 618 * see the note regarding apertures for NV_REGR. |
| 619 */ |
| 620 #define NV_REGR(rm, aperture, instance, offset) \ |
| 621 NvRegr((rm),(NvRmModuleID)NVRM_MODULE_ID((aperture),(instance)),(offset)) |
| 622 |
| 623 #define NV_REGW(rm, aperture, instance, offset, data) \ |
| 624 NvRegw((rm),(NvRmModuleID)NVRM_MODULE_ID((aperture),(instance)),(offset),(da
ta)) |
| 625 |
| 626 |
| 627 NvU32 NvRegr( |
| 628 NvRmDeviceHandle hDeviceHandle, |
| 629 NvRmModuleID aperture, |
| 630 NvU32 offset ); |
| 631 |
| 632 void NvRegw( |
| 633 NvRmDeviceHandle hDeviceHandle, |
| 634 NvRmModuleID aperture, |
| 635 NvU32 offset, |
| 636 NvU32 data ); |
| 637 |
| 638 /** |
| 639 * NV_REGR_MULT: read multiple registers from hardware |
| 640 * |
| 641 * @param rm The resource manager istance |
| 642 * @param aperture The register aperture |
| 643 * @param instance The module instance |
| 644 * @param num The number of registers |
| 645 * @param offsets The register offsets |
| 646 * @param values The register values |
| 647 */ |
| 648 |
| 649 /** |
| 650 * NV_REGW_MULT: write multiple registers from hardware |
| 651 * |
| 652 * @param rm The resource manager istance |
| 653 * @param aperture The register aperture |
| 654 * @param instance The module instance |
| 655 * @param num The number of registers |
| 656 * @param offsets The register offsets |
| 657 * @param values The register values |
| 658 */ |
| 659 |
| 660 /** |
| 661 * NV_REGW_BLOCK: write a block of registers to hardware |
| 662 * |
| 663 * @param rm The resource manager istance |
| 664 * @param aperture The register aperture |
| 665 * @param instance The module instance |
| 666 * @param num The number of registers |
| 667 * @param offset The beginning register offset |
| 668 * @param values The register values |
| 669 */ |
| 670 |
| 671 /** |
| 672 * NV_REGR_BLOCK: read a block of registers from hardware |
| 673 * |
| 674 * @param rm The resource manager istance |
| 675 * @param aperture The register aperture |
| 676 * @param instance The module instance |
| 677 * @param num The number of registers |
| 678 * @param offset The beginning register offset |
| 679 * @param values The register values |
| 680 */ |
| 681 |
| 682 #define NV_REGR_MULT(rm, aperture, instance, num, offsets, values) \ |
| 683 NvRegrm((rm),(NvRmModuleID)NVRM_MODULE_ID((aperture),(instance)),(num),(offs
ets),(values)) |
| 684 |
| 685 #define NV_REGW_MULT(rm, aperture, instance, num, offsets, values) \ |
| 686 NvRegwm((rm),(NvRmModuleID)NVRM_MODULE_ID((aperture),(instance)),(num),(offs
ets),(values)) |
| 687 |
| 688 #define NV_REGW_BLOCK(rm, aperture, instance, num, offset, values) \ |
| 689 NvRegwb((rm),(NvRmModuleID)NVRM_MODULE_ID((aperture),(instance)),(num),(offs
et),(values)) |
| 690 |
| 691 #define NV_REGR_BLOCK(rm, aperture, instance, num, offset, values) \ |
| 692 NvRegrb((rm),(NvRmModuleID)NVRM_MODULE_ID((aperture),(instance)),(num),(offs
et),(values)) |
| 693 |
| 694 void NvRegrm( |
| 695 NvRmDeviceHandle hRmDeviceHandle, |
| 696 NvRmModuleID aperture, |
| 697 NvU32 num, |
| 698 const NvU32 * offsets, |
| 699 NvU32 * values ); |
| 700 |
| 701 void NvRegwm( |
| 702 NvRmDeviceHandle hRmDeviceHandle, |
| 703 NvRmModuleID aperture, |
| 704 NvU32 num, |
| 705 const NvU32 * offsets, |
| 706 const NvU32 * values ); |
| 707 |
| 708 void NvRegwb( |
| 709 NvRmDeviceHandle hRmDeviceHandle, |
| 710 NvRmModuleID aperture, |
| 711 NvU32 num, |
| 712 NvU32 offset, |
| 713 const NvU32 * values ); |
| 714 |
| 715 void NvRegrb( |
| 716 NvRmDeviceHandle hRmDeviceHandle, |
| 717 NvRmModuleID aperture, |
| 718 NvU32 num, |
| 719 NvU32 offset, |
| 720 NvU32 * values ); |
| 721 |
| 722 #define NV_REGR08(rm, aperture, instance, offset) \ |
| 723 NvRegr08((rm),(NvRmModuleID)NVRM_MODULE_ID((aperture),(instance)),(offset)) |
| 724 |
| 725 #define NV_REGW08(rm, aperture, instance, offset, data) \ |
| 726 NvRegw08((rm),(NvRmModuleID)NVRM_MODULE_ID((aperture),(instance)),(offset),(
data)) |
| 727 |
| 728 NvU8 NvRegr08( |
| 729 NvRmDeviceHandle hDeviceHandle, |
| 730 NvRmModuleID aperture, |
| 731 NvU32 offset ); |
| 732 |
| 733 void NvRegw08( |
| 734 NvRmDeviceHandle rm, |
| 735 NvRmModuleID aperture, |
| 736 NvU32 offset, |
| 737 NvU8 data ); |
| 738 |
| 739 /** @} */ |
| 740 |
| 741 #if defined(__cplusplus) |
| 742 } |
| 743 #endif |
| 744 |
| 745 #endif |
OLD | NEW |