NV services

From Nintendo Switch Brew
Revision as of 21:14, 15 April 2017 by Qlutoo (talk | contribs)
Jump to navigation Jump to search

The Switch makes use of a customized NVIDIA driver.

nvdrv:a

Cmd Name
0 Open
1 Ioctl
2 Close
3 Initialize
4 QueryEvent
5 MapSharedMem
6
7
8 Audio render related init?
9 ?

Ioctls

The ioctl number is generated with the following primitive (see Linux kernel):

#define _IOC(inout, group, num, len) \
   (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))

The following table contains known ioctls.

Device Value Description Notes
/dev/nvhost-* 0xC0??0001 NVHOST32_IOCTL_CHANNEL_SUBMIT ?? == size is unknown
/dev/nvhost-* 0xC0080002 NVHOST_IOCTL_CHANNEL_GET_SYNCPOINT
/dev/nvhost-* 0xC0080003 NVHOST_IOCTL_CHANNEL_GET_WAITBASE
/dev/nvhost-* 0xC0080004 NVHOST_IOCTL_CHANNEL_SET_TIMEOUT_EX
/dev/nvhost-* 0xC01C0009 NVHOST_IOCTL_CHANNEL_SUBMIT(?)
/dev/nvhost-* 0xC01C000A NVHOST_IOCTL_CHANNEL_MODULE_REGRDWR(?)
/dev/nvhost-* 0xC0080014 NVHOST_IOCTL_CTRL_SYNCPT_READ
/dev/nvhost-* 0x40040015 NVHOST_IOCTL_CTRL_SYNCPT_INCR
/dev/nvhost-* 0xC00C0016 NVHOST_IOCTL_CTRL_SYNCPT_WAIT
/dev/nvhost-* 0x40080017 NVHOST_IOCTL_CTRL_MODULE_MUTEX
/dev/nvhost-* 0xC0180018 NVHOST32_IOCTL_CTRL_MODULE_REGRDWR
/dev/nvhost-* 0xC0100019 NVHOST_IOCTL_CTRL_SYNCPT_WAITEX
/dev/nvhost-* 0xC008001A NVHOST_IOCTL_CTRL_SYNCPT_READ_MAX
/dev/nvhost-* 0xC004001C NVHOST_IOCTL_CTRL_GET_VERSION(?)
/dev/nvhost-* 0xC010001D NvRmSyncWaitEvent (wait on event?)
/dev/nvhost-* 0xC010001E NvRmSyncWaitEvent (wait on event?)
/dev/nvhost-* 0xC004001F NvRmSyncWaitEvent (signal event?)
/dev/nvhost-* 0xC0040020 NvRmSyncWaitEvent (signal event?)
/dev/nvhost-* 0x40080021 Returns busy?
/dev/nvmap 0xC0080101 NVMAP_IOC_CREATE
/dev/nvmap 0xC0080103 NVMAP_IOC_FROM_ID
/dev/nvmap 0xC0200104 NVMAP_IOC_ALLOC
/dev/nvmap 0xC0180105 NVMAP_IOC_FREE
/dev/nvmap 0xC00C0109 NVMAP_IOC_PARAM
/dev/nvmap 0xC008010E NVMAP_IOC_GET_ID
/dev/nvhost-as-gpu 0x40044101 NVGPU_AS_IOCTL_BIND_CHANNEL
/dev/nvhost-as-gpu 0xC0184102 NVGPU32_AS_IOCTL_ALLOC_SPACE
/dev/nvhost-as-gpu 0xC0104103 NVGPU_AS_IOCTL_FREE_SPACE
/dev/nvhost-as-gpu 0xC0184104 NVGPU_AS_IOCTL_MAP_BUFFER
/dev/nvhost-as-gpu 0xC0084105 NVGPU_AS_IOCTL_UNMAP_BUFFER
/dev/nvhost-as-gpu 0xC0284106 NVGPU_AS_IOCTL_ALLOC_SPACE
/dev/nvhost-as-gpu 0x40104107
/dev/nvhost-as-gpu 0xC0404108
/dev/nvhost-as-gpu 0x40284109
/dev/nvhost-as-gpu 0xC0144114
/dev/nvhost-dbg-gpu 0xC0??4402 NVGPU_DBG_GPU_IOCTL_REG_OPS ?? == size is unknown
/dev/nvhost-ctrl-gpu 0x80044701 NVGPU_GPU_IOCTL_ZCULL_GET_CTX_SIZE
/dev/nvhost-ctrl-gpu 0x80284702 NVGPU_GPU_IOCTL_ZCULL_GET_INFO
/dev/nvhost-ctrl-gpu 0x402C4703 NVGPU_GPU_IOCTL_ZBC_SET_TABLE
/dev/nvhost-ctrl-gpu 0xC0344704 NVGPU_GPU_IOCTL_ZBC_QUERY_TABLE
/dev/nvhost-ctrl-gpu 0xC0B04705 NVGPU_GPU_IOCTL_GET_CHARACTERISTICS
/dev/nvhost-ctrl-gpu 0xC0184706 NVGPU_AS_IOCTL_ALLOC_SPACE
/dev/nvhost-ctrl-gpu 0x40084707
/dev/nvhost-ctrl-gpu 0x4008470E
/dev/nvhost-ctrl-gpu 0x4010470F
/dev/nvhost-ctrl-gpu 0xC0084710
/dev/nvhost-ctrl-gpu 0x80084711
/dev/nvhost-ctrl-gpu 0x80084714
/dev/nvhost-ctrl-gpu 0xC008471B
/dev/nvhost-ctrl-gpu 0xC010471C
/dev/nvhost-* 0x40044801 NVGPU_IOCTL_CHANNEL_SET_NVMAP_FD
/dev/nvhost-* 0x40044803 NVGPU_IOCTL_CHANNEL_SET_TIMEOUT(?)
/dev/nvhost-* 0x40084805 NVGPU_IOCTL_CHANNEL_SET_TIMEOUT_EX(?)
/dev/nvhost-* 0xC0044807 NVGPU_IOCTL_CHANNEL_CYCLE_STATS
/dev/nvhost-* 0xC0184808 NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO
/dev/nvhost-* 0xC0104809 NVGPU_IOCTL_CHANNEL_ALLOC_OBJ_CTX
/dev/nvhost-* 0x4008480A NVGPU_IOCTL_CHANNEL_FREE_OBJ_CTX
/dev/nvhost-* 0xC010480B NVGPU_IOCTL_CHANNEL_ZCULL_BIND
/dev/nvhost-* 0xC018480C NVGPU_IOCTL_CHANNEL_SET_ERROR_NOTIFIER
/dev/nvhost-* 0x4004480D NVGPU_IOCTL_CHANNEL_OPEN
/dev/nvhost-* 0x0000480E NVGPU_IOCTL_CHANNEL_ENABLE
/dev/nvhost-* 0x0000480F NVGPU_IOCTL_CHANNEL_DISABLE
/dev/nvhost-* 0x00004810 NVGPU_IOCTL_CHANNEL_PREEMPT
/dev/nvhost-* 0x00004811 NVGPU_IOCTL_CHANNEL_FORCE_RESET
/dev/nvhost-* 0x40084812 NVGPU_IOCTL_CHANNEL_EVENTS_CTRL
/dev/nvhost-* 0xC0104813 NVGPU_IOCTL_CHANNEL_CYCLE_STATS_SNAPSHOT
/dev/nvhost-* 0x80804816
/dev/nvhost-* 0xC0104817
/dev/nvhost-* 0x40204818
/dev/nvhost-* 0xC0184819
/dev/nvhost-* 0xC020481A