NV services: Difference between revisions

Line 766: Line 766:
| 0x40284109 || In || 40 || [[#NVGPU_AS_IOCTL_INITIALIZE_EX]]
| 0x40284109 || In || 40 || [[#NVGPU_AS_IOCTL_INITIALIZE_EX]]
|-
|-
| 0xC038410A || Inout || 56 || NVGPU_AS_IOCTL_MAP_BUFFER_EX
| 0xC038410A || Inout || 56 || [[#NVGPU_AS_IOCTL_MAP_BUFFER_EX]]
|-
|-
| 0xC0??4114 || Inout || Variable || [[#NVGPU_AS_IOCTL_REMAP]]
| 0xC0??4114 || Inout || Variable || [[#NVGPU_AS_IOCTL_REMAP]]
Line 779: Line 779:


=== NVGPU_AS_IOCTL_ALLOC_SPACE ===
=== NVGPU_AS_IOCTL_ALLOC_SPACE ===
This one reserves pages in the device address space.
Reserves pages in the device address space.


   struct {
   struct {
Line 793: Line 793:


=== NVGPU_AS_IOCTL_FREE_SPACE ===
=== NVGPU_AS_IOCTL_FREE_SPACE ===
This one frees pages from the device address space.
Frees pages from the device address space.


   struct {
   struct {
Line 802: Line 802:


=== NVGPU_AS_IOCTL_MAP_BUFFER ===
=== NVGPU_AS_IOCTL_MAP_BUFFER ===
Map a memory region in the device address space. Identical to Linux driver pretty much.
Maps a memory region in the device address space. Identical to Linux driver pretty much.


On success, the mapped memory region is locked by having [[SVC#MemoryState]] bit34 set.
On success, the mapped memory region is locked by having [[SVC#MemoryState]] bit34 set.
Line 818: Line 818:


=== NVGPU_AS_IOCTL_MODIFY ===
=== NVGPU_AS_IOCTL_MODIFY ===
Modify a memory region in the device address space.
Modifies a memory region in the device address space.


Unaligned size will cause a [[#Panic]].
Unaligned size will cause a [[#Panic]].
Line 825: Line 825:


   struct {
   struct {
     __in   u32 flags;          // bit0: fixed_offset, bit2: cacheable
     __in     u32 flags;          // bit0: fixed_offset, bit2: cacheable
     __in   u32 kind;          // -1 is default
     __in     u32 kind;          // -1 is default
     __in   u32 nvmap_handle;
     __in     u32 nvmap_handle;
     __inout u32 page_size;      // 0 means don't care
     __inout   u32 page_size;      // 0 means don't care
     __in   u64 buffer_offset;
     __in     u64 buffer_offset;
     __in   u64 mapping_size;
     __in     u64 mapping_size;
     __inout  u64 offset;
     __inout  u64 offset;
   };
   };


=== NVGPU_AS_IOCTL_UNMAP_BUFFER ===
=== NVGPU_AS_IOCTL_UNMAP_BUFFER ===
Unmap a memory region from the device address space.
Unmaps a memory region from the device address space.


  struct {
  struct {
Line 852: Line 852:


=== NVGPU_AS_IOCTL_GET_VA_REGIONS ===
=== NVGPU_AS_IOCTL_GET_VA_REGIONS ===
Nintendo modified to get rid of pointer in struct.
Nintendo's custom implementation to get rid of pointer in struct.


   struct va_region {
   struct va_region {
Line 862: Line 862:
    
    
   struct {
   struct {
     u64         not_used;  // (contained output user ptr on linux, ignored)
     u64           not_used;  // (contained output user ptr on linux, ignored)
     __inout u32 bufsize;    // forced to 2*sizeof(struct va_region)
     __inout u32   bufsize;    // forced to 2*sizeof(struct va_region)
     u32         pad;
     u32           pad;
     __out struct va_region regions[2];
     __out struct va_region regions[2];
   };
   };


Line 879: Line 879:
     __in u64 unk1;
     __in u64 unk1;
     __in u64 unk2;
     __in u64 unk2;
  };
=== NVGPU_AS_IOCTL_MAP_BUFFER_EX ===
Maps a memory region in the device address space with extra params.
    struct {
    __in      u32 flags;          // bit0: fixed_offset, bit2: cacheable
    __in      u32 kind;          // -1 is default
    __in      u32 nvmap_handle;
    __inout  u32 page_size;      // 0 means don't care
    __in      u64 buffer_offset;
    __in      u64 mapping_size;
    __inout  u64 offset;
    __in      u64 unk0;
    __in      u32 unk1;
    u32            pad;
   };
   };