nouveau_drv.h 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612
  1. /*
  2. * Copyright 2005 Stephane Marchesin.
  3. * All Rights Reserved.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a
  6. * copy of this software and associated documentation files (the "Software"),
  7. * to deal in the Software without restriction, including without limitation
  8. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  9. * and/or sell copies of the Software, and to permit persons to whom the
  10. * Software is furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice (including the next
  13. * paragraph) shall be included in all copies or substantial portions of the
  14. * Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  20. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  21. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  22. * OTHER DEALINGS IN THE SOFTWARE.
  23. */
  24. #ifndef __NOUVEAU_DRV_H__
  25. #define __NOUVEAU_DRV_H__
  26. #define DRIVER_AUTHOR "Stephane Marchesin"
  27. #define DRIVER_EMAIL "nouveau@lists.freedesktop.org"
  28. #define DRIVER_NAME "nouveau"
  29. #define DRIVER_DESC "nVidia Riva/TNT/GeForce"
  30. #define DRIVER_DATE "20120316"
  31. #define DRIVER_MAJOR 1
  32. #define DRIVER_MINOR 0
  33. #define DRIVER_PATCHLEVEL 0
  34. #define NOUVEAU_FAMILY 0x0000FFFF
  35. #define NOUVEAU_FLAGS 0xFFFF0000
  36. #include "ttm/ttm_bo_api.h"
  37. #include "ttm/ttm_bo_driver.h"
  38. #include "ttm/ttm_placement.h"
  39. #include "ttm/ttm_memory.h"
  40. #include "ttm/ttm_module.h"
  41. struct nouveau_fpriv {
  42. spinlock_t lock;
  43. struct list_head channels;
  44. struct nouveau_vm *vm;
  45. };
  46. static inline struct nouveau_fpriv *
  47. nouveau_fpriv(struct drm_file *file_priv)
  48. {
  49. return file_priv ? file_priv->driver_priv : NULL;
  50. }
  51. #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
  52. #include <nouveau_drm.h>
  53. #include "nouveau_reg.h"
  54. #include <nouveau_bios.h>
  55. #include "nouveau_util.h"
  56. struct nouveau_grctx;
  57. struct nouveau_mem;
  58. #include <subdev/vm.h>
  59. #define MAX_NUM_DCB_ENTRIES 16
  60. #define NOUVEAU_MAX_CHANNEL_NR 4096
  61. #define NOUVEAU_MAX_TILE_NR 15
  62. struct nouveau_mem {
  63. struct drm_device *dev;
  64. struct nouveau_vma bar_vma;
  65. struct nouveau_vma vma[2];
  66. u8 page_shift;
  67. struct drm_mm_node *tag;
  68. struct list_head regions;
  69. dma_addr_t *pages;
  70. u32 memtype;
  71. u64 offset;
  72. u64 size;
  73. struct sg_table *sg;
  74. };
  75. struct nouveau_tile_reg {
  76. bool used;
  77. uint32_t addr;
  78. uint32_t limit;
  79. uint32_t pitch;
  80. uint32_t zcomp;
  81. struct drm_mm_node *tag_mem;
  82. struct nouveau_fence *fence;
  83. };
  84. struct nouveau_bo {
  85. struct ttm_buffer_object bo;
  86. struct ttm_placement placement;
  87. u32 valid_domains;
  88. u32 placements[3];
  89. u32 busy_placements[3];
  90. struct ttm_bo_kmap_obj kmap;
  91. struct list_head head;
  92. /* protected by ttm_bo_reserve() */
  93. struct drm_file *reserved_by;
  94. struct list_head entry;
  95. int pbbo_index;
  96. bool validate_mapped;
  97. struct list_head vma_list;
  98. unsigned page_shift;
  99. uint32_t tile_mode;
  100. uint32_t tile_flags;
  101. struct nouveau_tile_reg *tile;
  102. struct drm_gem_object *gem;
  103. int pin_refcnt;
  104. struct ttm_bo_kmap_obj dma_buf_vmap;
  105. int vmapping_count;
  106. };
  107. #define nouveau_bo_tile_layout(nvbo) \
  108. ((nvbo)->tile_flags & NOUVEAU_GEM_TILE_LAYOUT_MASK)
  109. static inline struct nouveau_bo *
  110. nouveau_bo(struct ttm_buffer_object *bo)
  111. {
  112. return container_of(bo, struct nouveau_bo, bo);
  113. }
  114. static inline struct nouveau_bo *
  115. nouveau_gem_object(struct drm_gem_object *gem)
  116. {
  117. return gem ? gem->driver_private : NULL;
  118. }
  119. /* TODO: submit equivalent to TTM generic API upstream? */
  120. static inline void __iomem *
  121. nvbo_kmap_obj_iovirtual(struct nouveau_bo *nvbo)
  122. {
  123. bool is_iomem;
  124. void __iomem *ioptr = (void __force __iomem *)ttm_kmap_obj_virtual(
  125. &nvbo->kmap, &is_iomem);
  126. WARN_ON_ONCE(ioptr && !is_iomem);
  127. return ioptr;
  128. }
  129. enum nouveau_flags {
  130. NV_NFORCE = 0x10000000,
  131. NV_NFORCE2 = 0x20000000
  132. };
  133. #define NVOBJ_ENGINE_SW 0
  134. #define NVOBJ_ENGINE_GR 1
  135. #define NVOBJ_ENGINE_CRYPT 2
  136. #define NVOBJ_ENGINE_COPY0 3
  137. #define NVOBJ_ENGINE_COPY1 4
  138. #define NVOBJ_ENGINE_MPEG 5
  139. #define NVOBJ_ENGINE_PPP NVOBJ_ENGINE_MPEG
  140. #define NVOBJ_ENGINE_BSP 6
  141. #define NVOBJ_ENGINE_VP 7
  142. #define NVOBJ_ENGINE_FIFO 14
  143. #define NVOBJ_ENGINE_FENCE 15
  144. #define NVOBJ_ENGINE_NR 16
  145. #define NVOBJ_ENGINE_DISPLAY (NVOBJ_ENGINE_NR + 0) /*XXX*/
  146. #define NVOBJ_FLAG_DONT_MAP (1 << 0)
  147. #define NVOBJ_FLAG_ZERO_ALLOC (1 << 1)
  148. #define NVOBJ_FLAG_ZERO_FREE (1 << 2)
  149. #define NVOBJ_FLAG_VM (1 << 3)
  150. #define NVOBJ_FLAG_VM_USER (1 << 4)
  151. #define NVOBJ_CINST_GLOBAL 0xdeadbeef
  152. struct nouveau_gpuobj {
  153. struct drm_device *dev;
  154. struct kref refcount;
  155. struct list_head list;
  156. void *node;
  157. u32 *suspend;
  158. uint32_t flags;
  159. u32 size;
  160. u32 pinst; /* PRAMIN BAR offset */
  161. u32 cinst; /* Channel offset */
  162. u64 vinst; /* VRAM address */
  163. u64 linst; /* VM address */
  164. uint32_t engine;
  165. uint32_t class;
  166. void (*dtor)(struct drm_device *, struct nouveau_gpuobj *);
  167. void *priv;
  168. };
  169. struct nouveau_page_flip_state {
  170. struct list_head head;
  171. struct drm_pending_vblank_event *event;
  172. int crtc, bpp, pitch, x, y;
  173. uint64_t offset;
  174. };
  175. enum nouveau_channel_mutex_class {
  176. NOUVEAU_UCHANNEL_MUTEX,
  177. NOUVEAU_KCHANNEL_MUTEX
  178. };
  179. struct nouveau_channel {
  180. struct drm_device *dev;
  181. struct list_head list;
  182. int id;
  183. /* references to the channel data structure */
  184. struct kref ref;
  185. /* users of the hardware channel resources, the hardware
  186. * context will be kicked off when it reaches zero. */
  187. atomic_t users;
  188. struct mutex mutex;
  189. /* owner of this fifo */
  190. struct drm_file *file_priv;
  191. /* mapping of the fifo itself */
  192. struct drm_local_map *map;
  193. /* mapping of the regs controlling the fifo */
  194. void __iomem *user;
  195. uint32_t user_get;
  196. uint32_t user_get_hi;
  197. uint32_t user_put;
  198. /* DMA push buffer */
  199. struct nouveau_gpuobj *pushbuf;
  200. struct nouveau_bo *pushbuf_bo;
  201. struct nouveau_vma pushbuf_vma;
  202. uint64_t pushbuf_base;
  203. /* Notifier memory */
  204. struct nouveau_bo *notifier_bo;
  205. struct nouveau_vma notifier_vma;
  206. struct drm_mm notifier_heap;
  207. /* PFIFO context */
  208. struct nouveau_gpuobj *ramfc;
  209. /* Execution engine contexts */
  210. void *engctx[NVOBJ_ENGINE_NR];
  211. /* NV50 VM */
  212. struct nouveau_vm *vm;
  213. struct nouveau_gpuobj *vm_pd;
  214. /* Objects */
  215. struct nouveau_gpuobj *ramin; /* Private instmem */
  216. struct drm_mm ramin_heap; /* Private PRAMIN heap */
  217. struct nouveau_ramht *ramht; /* Hash table */
  218. /* GPU object info for stuff used in-kernel (mm_enabled) */
  219. uint32_t m2mf_ntfy;
  220. uint32_t vram_handle;
  221. uint32_t gart_handle;
  222. bool accel_done;
  223. /* Push buffer state (only for drm's channel on !mm_enabled) */
  224. struct {
  225. int max;
  226. int free;
  227. int cur;
  228. int put;
  229. /* access via pushbuf_bo */
  230. int ib_base;
  231. int ib_max;
  232. int ib_free;
  233. int ib_put;
  234. } dma;
  235. struct {
  236. bool active;
  237. char name[32];
  238. struct drm_info_list info;
  239. } debugfs;
  240. };
  241. struct nouveau_exec_engine {
  242. void (*destroy)(struct drm_device *, int engine);
  243. int (*init)(struct drm_device *, int engine);
  244. int (*fini)(struct drm_device *, int engine, bool suspend);
  245. int (*context_new)(struct nouveau_channel *, int engine);
  246. void (*context_del)(struct nouveau_channel *, int engine);
  247. int (*object_new)(struct nouveau_channel *, int engine,
  248. u32 handle, u16 class);
  249. void (*set_tile_region)(struct drm_device *dev, int i);
  250. void (*tlb_flush)(struct drm_device *, int engine);
  251. };
  252. struct nouveau_instmem_engine {
  253. void *priv;
  254. int (*init)(struct drm_device *dev);
  255. void (*takedown)(struct drm_device *dev);
  256. int (*suspend)(struct drm_device *dev);
  257. void (*resume)(struct drm_device *dev);
  258. int (*get)(struct nouveau_gpuobj *, struct nouveau_channel *,
  259. u32 size, u32 align);
  260. void (*put)(struct nouveau_gpuobj *);
  261. int (*map)(struct nouveau_gpuobj *);
  262. void (*unmap)(struct nouveau_gpuobj *);
  263. void (*flush)(struct drm_device *);
  264. };
  265. struct nouveau_mc_engine {
  266. int (*init)(struct drm_device *dev);
  267. void (*takedown)(struct drm_device *dev);
  268. };
  269. struct nouveau_timer_engine {
  270. int (*init)(struct drm_device *dev);
  271. void (*takedown)(struct drm_device *dev);
  272. uint64_t (*read)(struct drm_device *dev);
  273. };
  274. struct nouveau_fb_engine {
  275. int num_tiles;
  276. struct drm_mm tag_heap;
  277. void *priv;
  278. int (*init)(struct drm_device *dev);
  279. void (*takedown)(struct drm_device *dev);
  280. void (*init_tile_region)(struct drm_device *dev, int i,
  281. uint32_t addr, uint32_t size,
  282. uint32_t pitch, uint32_t flags);
  283. void (*set_tile_region)(struct drm_device *dev, int i);
  284. void (*free_tile_region)(struct drm_device *dev, int i);
  285. };
  286. struct nouveau_display_engine {
  287. void *priv;
  288. int (*early_init)(struct drm_device *);
  289. void (*late_takedown)(struct drm_device *);
  290. int (*create)(struct drm_device *);
  291. void (*destroy)(struct drm_device *);
  292. int (*init)(struct drm_device *);
  293. void (*fini)(struct drm_device *);
  294. struct drm_property *dithering_mode;
  295. struct drm_property *dithering_depth;
  296. struct drm_property *underscan_property;
  297. struct drm_property *underscan_hborder_property;
  298. struct drm_property *underscan_vborder_property;
  299. /* not really hue and saturation: */
  300. struct drm_property *vibrant_hue_property;
  301. struct drm_property *color_vibrance_property;
  302. };
  303. struct nouveau_pm_voltage_level {
  304. u32 voltage; /* microvolts */
  305. u8 vid;
  306. };
  307. struct nouveau_pm_voltage {
  308. bool supported;
  309. u8 version;
  310. u8 vid_mask;
  311. struct nouveau_pm_voltage_level *level;
  312. int nr_level;
  313. };
  314. /* Exclusive upper limits */
  315. #define NV_MEM_CL_DDR2_MAX 8
  316. #define NV_MEM_WR_DDR2_MAX 9
  317. #define NV_MEM_CL_DDR3_MAX 17
  318. #define NV_MEM_WR_DDR3_MAX 17
  319. #define NV_MEM_CL_GDDR3_MAX 16
  320. #define NV_MEM_WR_GDDR3_MAX 18
  321. #define NV_MEM_CL_GDDR5_MAX 21
  322. #define NV_MEM_WR_GDDR5_MAX 20
  323. struct nouveau_pm_memtiming {
  324. int id;
  325. u32 reg[9];
  326. u32 mr[4];
  327. u8 tCWL;
  328. u8 odt;
  329. u8 drive_strength;
  330. };
  331. struct nouveau_pm_tbl_header {
  332. u8 version;
  333. u8 header_len;
  334. u8 entry_cnt;
  335. u8 entry_len;
  336. };
  337. struct nouveau_pm_tbl_entry {
  338. u8 tWR;
  339. u8 tWTR;
  340. u8 tCL;
  341. u8 tRC;
  342. u8 empty_4;
  343. u8 tRFC; /* Byte 5 */
  344. u8 empty_6;
  345. u8 tRAS; /* Byte 7 */
  346. u8 empty_8;
  347. u8 tRP; /* Byte 9 */
  348. u8 tRCDRD;
  349. u8 tRCDWR;
  350. u8 tRRD;
  351. u8 tUNK_13;
  352. u8 RAM_FT1; /* 14, a bitmask of random RAM features */
  353. u8 empty_15;
  354. u8 tUNK_16;
  355. u8 empty_17;
  356. u8 tUNK_18;
  357. u8 tCWL;
  358. u8 tUNK_20, tUNK_21;
  359. };
  360. struct nouveau_pm_profile;
  361. struct nouveau_pm_profile_func {
  362. void (*destroy)(struct nouveau_pm_profile *);
  363. void (*init)(struct nouveau_pm_profile *);
  364. void (*fini)(struct nouveau_pm_profile *);
  365. struct nouveau_pm_level *(*select)(struct nouveau_pm_profile *);
  366. };
  367. struct nouveau_pm_profile {
  368. const struct nouveau_pm_profile_func *func;
  369. struct list_head head;
  370. char name[8];
  371. };
  372. #define NOUVEAU_PM_MAX_LEVEL 8
  373. struct nouveau_pm_level {
  374. struct nouveau_pm_profile profile;
  375. struct device_attribute dev_attr;
  376. char name[32];
  377. int id;
  378. struct nouveau_pm_memtiming timing;
  379. u32 memory;
  380. u16 memscript;
  381. u32 core;
  382. u32 shader;
  383. u32 rop;
  384. u32 copy;
  385. u32 daemon;
  386. u32 vdec;
  387. u32 dom6;
  388. u32 unka0; /* nva3:nvc0 */
  389. u32 hub01; /* nvc0- */
  390. u32 hub06; /* nvc0- */
  391. u32 hub07; /* nvc0- */
  392. u32 volt_min; /* microvolts */
  393. u32 volt_max;
  394. u8 fanspeed;
  395. };
  396. struct nouveau_pm_temp_sensor_constants {
  397. u16 offset_constant;
  398. s16 offset_mult;
  399. s16 offset_div;
  400. s16 slope_mult;
  401. s16 slope_div;
  402. };
  403. struct nouveau_pm_threshold_temp {
  404. s16 critical;
  405. s16 down_clock;
  406. s16 fan_boost;
  407. };
  408. struct nouveau_pm_fan {
  409. u32 percent;
  410. u32 min_duty;
  411. u32 max_duty;
  412. u32 pwm_freq;
  413. u32 pwm_divisor;
  414. };
  415. struct nouveau_pm_engine {
  416. struct nouveau_pm_voltage voltage;
  417. struct nouveau_pm_level perflvl[NOUVEAU_PM_MAX_LEVEL];
  418. int nr_perflvl;
  419. struct nouveau_pm_temp_sensor_constants sensor_constants;
  420. struct nouveau_pm_threshold_temp threshold_temp;
  421. struct nouveau_pm_fan fan;
  422. struct nouveau_pm_profile *profile_ac;
  423. struct nouveau_pm_profile *profile_dc;
  424. struct nouveau_pm_profile *profile;
  425. struct list_head profiles;
  426. struct nouveau_pm_level boot;
  427. struct nouveau_pm_level *cur;
  428. struct device *hwmon;
  429. struct notifier_block acpi_nb;
  430. int (*clocks_get)(struct drm_device *, struct nouveau_pm_level *);
  431. void *(*clocks_pre)(struct drm_device *, struct nouveau_pm_level *);
  432. int (*clocks_set)(struct drm_device *, void *);
  433. int (*voltage_get)(struct drm_device *);
  434. int (*voltage_set)(struct drm_device *, int voltage);
  435. int (*pwm_get)(struct drm_device *, int line, u32*, u32*);
  436. int (*pwm_set)(struct drm_device *, int line, u32, u32);
  437. int (*temp_get)(struct drm_device *);
  438. };
  439. struct nouveau_vram_engine {
  440. struct nouveau_mm mm;
  441. int (*init)(struct drm_device *);
  442. void (*takedown)(struct drm_device *dev);
  443. int (*get)(struct drm_device *, u64, u32 align, u32 size_nc,
  444. u32 type, struct nouveau_mem **);
  445. void (*put)(struct drm_device *, struct nouveau_mem **);
  446. bool (*flags_valid)(struct drm_device *, u32 tile_flags);
  447. };
  448. struct nouveau_engine {
  449. struct nouveau_instmem_engine instmem;
  450. struct nouveau_mc_engine mc;
  451. struct nouveau_timer_engine timer;
  452. struct nouveau_fb_engine fb;
  453. struct nouveau_display_engine display;
  454. struct nouveau_pm_engine pm;
  455. struct nouveau_vram_engine vram;
  456. };
  457. struct nouveau_pll_vals {
  458. union {
  459. struct {
  460. #ifdef __BIG_ENDIAN
  461. uint8_t N1, M1, N2, M2;
  462. #else
  463. uint8_t M1, N1, M2, N2;
  464. #endif
  465. };
  466. struct {
  467. uint16_t NM1, NM2;
  468. } __attribute__((packed));
  469. };
  470. int log2P;
  471. int refclk;
  472. };
  473. enum nv04_fp_display_regs {
  474. FP_DISPLAY_END,
  475. FP_TOTAL,
  476. FP_CRTC,
  477. FP_SYNC_START,
  478. FP_SYNC_END,
  479. FP_VALID_START,
  480. FP_VALID_END
  481. };
  482. struct nv04_crtc_reg {
  483. unsigned char MiscOutReg;
  484. uint8_t CRTC[0xa0];
  485. uint8_t CR58[0x10];
  486. uint8_t Sequencer[5];
  487. uint8_t Graphics[9];
  488. uint8_t Attribute[21];
  489. unsigned char DAC[768];
  490. /* PCRTC regs */
  491. uint32_t fb_start;
  492. uint32_t crtc_cfg;
  493. uint32_t cursor_cfg;
  494. uint32_t gpio_ext;
  495. uint32_t crtc_830;
  496. uint32_t crtc_834;
  497. uint32_t crtc_850;
  498. uint32_t crtc_eng_ctrl;
  499. /* PRAMDAC regs */
  500. uint32_t nv10_cursync;
  501. struct nouveau_pll_vals pllvals;
  502. uint32_t ramdac_gen_ctrl;
  503. uint32_t ramdac_630;
  504. uint32_t ramdac_634;
  505. uint32_t tv_setup;
  506. uint32_t tv_vtotal;
  507. uint32_t tv_vskew;
  508. uint32_t tv_vsync_delay;
  509. uint32_t tv_htotal;
  510. uint32_t tv_hskew;
  511. uint32_t tv_hsync_delay;
  512. uint32_t tv_hsync_delay2;
  513. uint32_t fp_horiz_regs[7];
  514. uint32_t fp_vert_regs[7];
  515. uint32_t dither;
  516. uint32_t fp_control;
  517. uint32_t dither_regs[6];
  518. uint32_t fp_debug_0;
  519. uint32_t fp_debug_1;
  520. uint32_t fp_debug_2;
  521. uint32_t fp_margin_color;
  522. uint32_t ramdac_8c0;
  523. uint32_t ramdac_a20;
  524. uint32_t ramdac_a24;
  525. uint32_t ramdac_a34;
  526. uint32_t ctv_regs[38];
  527. };
  528. struct nv04_output_reg {
  529. uint32_t output;
  530. int head;
  531. };
  532. struct nv04_mode_state {
  533. struct nv04_crtc_reg crtc_reg[2];
  534. uint32_t pllsel;
  535. uint32_t sel_clk;
  536. };
  537. enum nouveau_card_type {
  538. NV_04 = 0x04,
  539. NV_10 = 0x10,
  540. NV_20 = 0x20,
  541. NV_30 = 0x30,
  542. NV_40 = 0x40,
  543. NV_50 = 0x50,
  544. NV_C0 = 0xc0,
  545. NV_D0 = 0xd0,
  546. NV_E0 = 0xe0,
  547. };
  548. struct drm_nouveau_private {
  549. struct drm_device *dev;
  550. bool noaccel;
  551. void *newpriv;
  552. /* the card type, takes NV_* as values */
  553. enum nouveau_card_type card_type;
  554. /* exact chipset, derived from NV_PMC_BOOT_0 */
  555. int chipset;
  556. int flags;
  557. u32 crystal;
  558. spinlock_t ramin_lock;
  559. void __iomem *ramin;
  560. u32 ramin_size;
  561. u32 ramin_base;
  562. bool ramin_available;
  563. struct drm_mm ramin_heap;
  564. struct nouveau_exec_engine *eng[NVOBJ_ENGINE_NR];
  565. struct list_head gpuobj_list;
  566. struct list_head classes;
  567. struct nouveau_bo *vga_ram;
  568. /* interrupt handling */
  569. void (*irq_handler[32])(struct drm_device *);
  570. bool msi_enabled;
  571. struct {
  572. struct drm_global_reference mem_global_ref;
  573. struct ttm_bo_global_ref bo_global_ref;
  574. struct ttm_bo_device bdev;
  575. atomic_t validate_sequence;
  576. int (*move)(struct nouveau_channel *,
  577. struct ttm_buffer_object *,
  578. struct ttm_mem_reg *, struct ttm_mem_reg *);
  579. } ttm;
  580. struct {
  581. spinlock_t lock;
  582. struct drm_mm heap;
  583. struct nouveau_bo *bo;
  584. } fence;
  585. struct {
  586. spinlock_t lock;
  587. struct nouveau_channel *ptr[NOUVEAU_MAX_CHANNEL_NR];
  588. } channels;
  589. struct nouveau_engine engine;
  590. struct nouveau_channel *channel;
  591. /* For PFIFO and PGRAPH. */
  592. spinlock_t context_switch_lock;
  593. /* VM/PRAMIN flush, legacy PRAMIN aperture */
  594. spinlock_t vm_lock;
  595. /* RAMIN configuration, RAMFC, RAMHT and RAMRO offsets */
  596. struct nouveau_ramht *ramht;
  597. struct nouveau_gpuobj *ramfc;
  598. struct nouveau_gpuobj *ramro;
  599. uint32_t ramin_rsvd_vram;
  600. struct {
  601. enum {
  602. NOUVEAU_GART_NONE = 0,
  603. NOUVEAU_GART_AGP, /* AGP */
  604. NOUVEAU_GART_PDMA, /* paged dma object */
  605. NOUVEAU_GART_HW /* on-chip gart/vm */
  606. } type;
  607. uint64_t aper_base;
  608. uint64_t aper_size;
  609. uint64_t aper_free;
  610. struct ttm_backend_func *func;
  611. struct {
  612. struct page *page;
  613. dma_addr_t addr;
  614. } dummy;
  615. struct nouveau_gpuobj *sg_ctxdma;
  616. } gart_info;
  617. /* nv10-nv40 tiling regions */
  618. struct {
  619. struct nouveau_tile_reg reg[NOUVEAU_MAX_TILE_NR];
  620. spinlock_t lock;
  621. } tile;
  622. /* VRAM/fb configuration */
  623. enum {
  624. NV_MEM_TYPE_UNKNOWN = 0,
  625. NV_MEM_TYPE_STOLEN,
  626. NV_MEM_TYPE_SGRAM,
  627. NV_MEM_TYPE_SDRAM,
  628. NV_MEM_TYPE_DDR1,
  629. NV_MEM_TYPE_DDR2,
  630. NV_MEM_TYPE_DDR3,
  631. NV_MEM_TYPE_GDDR2,
  632. NV_MEM_TYPE_GDDR3,
  633. NV_MEM_TYPE_GDDR4,
  634. NV_MEM_TYPE_GDDR5
  635. } vram_type;
  636. uint64_t vram_size;
  637. uint64_t vram_sys_base;
  638. bool vram_rank_B;
  639. uint64_t fb_available_size;
  640. uint64_t fb_mappable_pages;
  641. uint64_t fb_aper_free;
  642. int fb_mtrr;
  643. /* BAR control (NV50-) */
  644. struct nouveau_vm *bar1_vm;
  645. struct nouveau_vm *bar3_vm;
  646. /* G8x/G9x virtual address space */
  647. struct nouveau_vm *chan_vm;
  648. struct nvbios vbios;
  649. u8 *mxms;
  650. struct list_head i2c_ports;
  651. struct nv04_mode_state mode_reg;
  652. struct nv04_mode_state saved_reg;
  653. uint32_t saved_vga_font[4][16384];
  654. uint32_t crtc_owner;
  655. uint32_t dac_users[4];
  656. struct backlight_device *backlight;
  657. struct {
  658. struct dentry *channel_root;
  659. } debugfs;
  660. struct nouveau_fbdev *nfbdev;
  661. struct apertures_struct *apertures;
  662. };
  663. static inline struct drm_nouveau_private *
  664. nouveau_private(struct drm_device *dev)
  665. {
  666. return dev->dev_private;
  667. }
  668. static inline struct drm_nouveau_private *
  669. nouveau_bdev(struct ttm_bo_device *bd)
  670. {
  671. return container_of(bd, struct drm_nouveau_private, ttm.bdev);
  672. }
  673. static inline int
  674. nouveau_bo_ref(struct nouveau_bo *ref, struct nouveau_bo **pnvbo)
  675. {
  676. struct nouveau_bo *prev;
  677. if (!pnvbo)
  678. return -EINVAL;
  679. prev = *pnvbo;
  680. *pnvbo = ref ? nouveau_bo(ttm_bo_reference(&ref->bo)) : NULL;
  681. if (prev) {
  682. struct ttm_buffer_object *bo = &prev->bo;
  683. ttm_bo_unref(&bo);
  684. }
  685. return 0;
  686. }
  687. /* nouveau_drv.c */
  688. extern int nouveau_modeset;
  689. extern int nouveau_duallink;
  690. extern int nouveau_uscript_lvds;
  691. extern int nouveau_uscript_tmds;
  692. extern int nouveau_vram_pushbuf;
  693. extern int nouveau_vram_notify;
  694. extern char *nouveau_vram_type;
  695. extern int nouveau_fbpercrtc;
  696. extern int nouveau_tv_disable;
  697. extern char *nouveau_tv_norm;
  698. extern int nouveau_reg_debug;
  699. extern int nouveau_ignorelid;
  700. extern int nouveau_nofbaccel;
  701. extern int nouveau_noaccel;
  702. extern int nouveau_force_post;
  703. extern int nouveau_override_conntype;
  704. extern char *nouveau_perflvl;
  705. extern int nouveau_perflvl_wr;
  706. extern int nouveau_msi;
  707. extern int nouveau_ctxfw;
  708. extern int nouveau_mxmdcb;
  709. extern int nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state);
  710. extern int nouveau_pci_resume(struct pci_dev *pdev);
  711. /* nouveau_state.c */
  712. extern int nouveau_open(struct drm_device *, struct drm_file *);
  713. extern void nouveau_preclose(struct drm_device *dev, struct drm_file *);
  714. extern void nouveau_postclose(struct drm_device *, struct drm_file *);
  715. extern int nouveau_load(struct drm_device *, unsigned long flags);
  716. extern int nouveau_firstopen(struct drm_device *);
  717. extern void nouveau_lastclose(struct drm_device *);
  718. extern int nouveau_unload(struct drm_device *);
  719. extern bool nouveau_wait_eq(struct drm_device *, uint64_t timeout,
  720. uint32_t reg, uint32_t mask, uint32_t val);
  721. extern bool nouveau_wait_ne(struct drm_device *, uint64_t timeout,
  722. uint32_t reg, uint32_t mask, uint32_t val);
  723. extern bool nouveau_wait_cb(struct drm_device *, u64 timeout,
  724. bool (*cond)(void *), void *);
  725. extern bool nouveau_wait_for_idle(struct drm_device *);
  726. extern int nouveau_card_init(struct drm_device *);
  727. /* nouveau_mem.c */
  728. extern int nouveau_mem_vram_init(struct drm_device *);
  729. extern void nouveau_mem_vram_fini(struct drm_device *);
  730. extern int nouveau_mem_gart_init(struct drm_device *);
  731. extern void nouveau_mem_gart_fini(struct drm_device *);
  732. extern void nouveau_mem_close(struct drm_device *);
  733. extern bool nouveau_mem_flags_valid(struct drm_device *, u32 tile_flags);
  734. extern int nouveau_mem_timing_calc(struct drm_device *, u32 freq,
  735. struct nouveau_pm_memtiming *);
  736. extern void nouveau_mem_timing_read(struct drm_device *,
  737. struct nouveau_pm_memtiming *);
  738. extern int nouveau_mem_vbios_type(struct drm_device *);
  739. extern struct nouveau_tile_reg *nv10_mem_set_tiling(
  740. struct drm_device *dev, uint32_t addr, uint32_t size,
  741. uint32_t pitch, uint32_t flags);
  742. extern void nv10_mem_put_tile_region(struct drm_device *dev,
  743. struct nouveau_tile_reg *tile,
  744. struct nouveau_fence *fence);
  745. extern const struct ttm_mem_type_manager_func nouveau_vram_manager;
  746. extern const struct ttm_mem_type_manager_func nouveau_gart_manager;
  747. /* nouveau_notifier.c */
  748. extern int nouveau_notifier_init_channel(struct nouveau_channel *);
  749. extern void nouveau_notifier_takedown_channel(struct nouveau_channel *);
  750. extern int nouveau_notifier_alloc(struct nouveau_channel *, uint32_t handle,
  751. int cout, uint32_t start, uint32_t end,
  752. uint32_t *offset);
  753. /* nouveau_channel.c */
  754. extern void nouveau_channel_cleanup(struct drm_device *, struct drm_file *);
  755. extern int nouveau_channel_alloc(struct drm_device *dev,
  756. struct nouveau_channel **chan,
  757. struct drm_file *file_priv,
  758. uint32_t fb_ctxdma, uint32_t tt_ctxdma);
  759. extern struct nouveau_channel *
  760. nouveau_channel_get_unlocked(struct nouveau_channel *);
  761. extern struct nouveau_channel *
  762. nouveau_channel_get(struct drm_file *, int id);
  763. extern void nouveau_channel_put_unlocked(struct nouveau_channel **);
  764. extern void nouveau_channel_put(struct nouveau_channel **);
  765. extern void nouveau_channel_ref(struct nouveau_channel *chan,
  766. struct nouveau_channel **pchan);
  767. extern int nouveau_channel_idle(struct nouveau_channel *chan);
  768. /* nouveau_gpuobj.c */
  769. #define NVOBJ_ENGINE_ADD(d, e, p) do { \
  770. struct drm_nouveau_private *dev_priv = (d)->dev_private; \
  771. dev_priv->eng[NVOBJ_ENGINE_##e] = (p); \
  772. } while (0)
  773. #define NVOBJ_ENGINE_DEL(d, e) do { \
  774. struct drm_nouveau_private *dev_priv = (d)->dev_private; \
  775. dev_priv->eng[NVOBJ_ENGINE_##e] = NULL; \
  776. } while (0)
  777. #define NVOBJ_CLASS(d, c, e) do { \
  778. int ret = nouveau_gpuobj_class_new((d), (c), NVOBJ_ENGINE_##e); \
  779. if (ret) \
  780. return ret; \
  781. } while (0)
  782. #define NVOBJ_MTHD(d, c, m, e) do { \
  783. int ret = nouveau_gpuobj_mthd_new((d), (c), (m), (e)); \
  784. if (ret) \
  785. return ret; \
  786. } while (0)
  787. extern int nouveau_gpuobj_early_init(struct drm_device *);
  788. extern int nouveau_gpuobj_init(struct drm_device *);
  789. extern void nouveau_gpuobj_takedown(struct drm_device *);
  790. extern int nouveau_gpuobj_suspend(struct drm_device *dev);
  791. extern void nouveau_gpuobj_resume(struct drm_device *dev);
  792. extern int nouveau_gpuobj_class_new(struct drm_device *, u32 class, u32 eng);
  793. extern int nouveau_gpuobj_mthd_new(struct drm_device *, u32 class, u32 mthd,
  794. int (*exec)(struct nouveau_channel *,
  795. u32 class, u32 mthd, u32 data));
  796. extern int nouveau_gpuobj_mthd_call(struct nouveau_channel *, u32, u32, u32);
  797. extern int nouveau_gpuobj_mthd_call2(struct drm_device *, int, u32, u32, u32);
  798. extern int nouveau_gpuobj_channel_init(struct nouveau_channel *,
  799. uint32_t vram_h, uint32_t tt_h);
  800. extern void nouveau_gpuobj_channel_takedown(struct nouveau_channel *);
  801. extern int nouveau_gpuobj_new(struct drm_device *, struct nouveau_channel *,
  802. uint32_t size, int align, uint32_t flags,
  803. struct nouveau_gpuobj **);
  804. extern void nouveau_gpuobj_ref(struct nouveau_gpuobj *,
  805. struct nouveau_gpuobj **);
  806. extern int nouveau_gpuobj_new_fake(struct drm_device *, u32 pinst, u64 vinst,
  807. u32 size, u32 flags,
  808. struct nouveau_gpuobj **);
  809. extern int nouveau_gpuobj_dma_new(struct nouveau_channel *, int class,
  810. uint64_t offset, uint64_t size, int access,
  811. int target, struct nouveau_gpuobj **);
  812. extern int nouveau_gpuobj_gr_new(struct nouveau_channel *, u32 handle, int class);
  813. extern int nv50_gpuobj_dma_new(struct nouveau_channel *, int class, u64 base,
  814. u64 size, int target, int access, u32 type,
  815. u32 comp, struct nouveau_gpuobj **pobj);
  816. extern void nv50_gpuobj_dma_init(struct nouveau_gpuobj *, u32 offset,
  817. int class, u64 base, u64 size, int target,
  818. int access, u32 type, u32 comp);
  819. /* nouveau_irq.c */
  820. extern int nouveau_irq_init(struct drm_device *);
  821. extern void nouveau_irq_fini(struct drm_device *);
  822. extern irqreturn_t nouveau_irq_handler(DRM_IRQ_ARGS);
  823. extern void nouveau_irq_register(struct drm_device *, int status_bit,
  824. void (*)(struct drm_device *));
  825. extern void nouveau_irq_unregister(struct drm_device *, int status_bit);
  826. extern void nouveau_irq_preinstall(struct drm_device *);
  827. extern int nouveau_irq_postinstall(struct drm_device *);
  828. extern void nouveau_irq_uninstall(struct drm_device *);
  829. /* nouveau_sgdma.c */
  830. extern int nouveau_sgdma_init(struct drm_device *);
  831. extern void nouveau_sgdma_takedown(struct drm_device *);
  832. extern uint32_t nouveau_sgdma_get_physical(struct drm_device *,
  833. uint32_t offset);
  834. extern struct ttm_tt *nouveau_sgdma_create_ttm(struct ttm_bo_device *bdev,
  835. unsigned long size,
  836. uint32_t page_flags,
  837. struct page *dummy_read_page);
  838. /* nouveau_debugfs.c */
  839. #if defined(CONFIG_DRM_NOUVEAU_DEBUG)
  840. extern int nouveau_debugfs_init(struct drm_minor *);
  841. extern void nouveau_debugfs_takedown(struct drm_minor *);
  842. extern int nouveau_debugfs_channel_init(struct nouveau_channel *);
  843. extern void nouveau_debugfs_channel_fini(struct nouveau_channel *);
  844. #else
  845. static inline int
  846. nouveau_debugfs_init(struct drm_minor *minor)
  847. {
  848. return 0;
  849. }
  850. static inline void nouveau_debugfs_takedown(struct drm_minor *minor)
  851. {
  852. }
  853. static inline int
  854. nouveau_debugfs_channel_init(struct nouveau_channel *chan)
  855. {
  856. return 0;
  857. }
  858. static inline void
  859. nouveau_debugfs_channel_fini(struct nouveau_channel *chan)
  860. {
  861. }
  862. #endif
  863. /* nouveau_dma.c */
  864. extern void nouveau_dma_init(struct nouveau_channel *);
  865. extern int nouveau_dma_wait(struct nouveau_channel *, int slots, int size);
  866. /* nouveau_acpi.c */
  867. #define ROM_BIOS_PAGE 4096
  868. #if defined(CONFIG_ACPI)
  869. void nouveau_register_dsm_handler(void);
  870. void nouveau_unregister_dsm_handler(void);
  871. void nouveau_switcheroo_optimus_dsm(void);
  872. int nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len);
  873. bool nouveau_acpi_rom_supported(struct pci_dev *pdev);
  874. int nouveau_acpi_edid(struct drm_device *, struct drm_connector *);
  875. #else
  876. static inline void nouveau_register_dsm_handler(void) {}
  877. static inline void nouveau_unregister_dsm_handler(void) {}
  878. static inline void nouveau_switcheroo_optimus_dsm(void) {}
  879. static inline bool nouveau_acpi_rom_supported(struct pci_dev *pdev) { return false; }
  880. static inline int nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len) { return -EINVAL; }
  881. static inline int nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector) { return -EINVAL; }
  882. #endif
  883. /* nouveau_backlight.c */
  884. #ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT
  885. extern int nouveau_backlight_init(struct drm_device *);
  886. extern void nouveau_backlight_exit(struct drm_device *);
  887. #else
  888. static inline int nouveau_backlight_init(struct drm_device *dev)
  889. {
  890. return 0;
  891. }
  892. static inline void nouveau_backlight_exit(struct drm_device *dev) { }
  893. #endif
  894. /* nouveau_bios.c */
  895. extern int nouveau_bios_init(struct drm_device *);
  896. extern void nouveau_bios_takedown(struct drm_device *dev);
  897. extern int nouveau_run_vbios_init(struct drm_device *);
  898. extern void nouveau_bios_run_init_table(struct drm_device *, uint16_t table,
  899. struct dcb_entry *, int crtc);
  900. extern void nouveau_bios_init_exec(struct drm_device *, uint16_t table);
  901. extern struct dcb_connector_table_entry *
  902. nouveau_bios_connector_entry(struct drm_device *, int index);
  903. extern u32 get_pll_register(struct drm_device *, enum pll_types);
  904. extern int get_pll_limits(struct drm_device *, uint32_t limit_match,
  905. struct pll_lims *);
  906. extern int nouveau_bios_run_display_table(struct drm_device *, u16 id, int clk,
  907. struct dcb_entry *, int crtc);
  908. extern bool nouveau_bios_fp_mode(struct drm_device *, struct drm_display_mode *);
  909. extern uint8_t *nouveau_bios_embedded_edid(struct drm_device *);
  910. extern int nouveau_bios_parse_lvds_table(struct drm_device *, int pxclk,
  911. bool *dl, bool *if_is_24bit);
  912. extern int run_tmds_table(struct drm_device *, struct dcb_entry *,
  913. int head, int pxclk);
  914. extern int call_lvds_script(struct drm_device *, struct dcb_entry *, int head,
  915. enum LVDS_script, int pxclk);
  916. bool bios_encoder_match(struct dcb_entry *, u32 hash);
  917. /* nouveau_mxm.c */
  918. int nouveau_mxm_init(struct drm_device *dev);
  919. void nouveau_mxm_fini(struct drm_device *dev);
  920. /* nouveau_ttm.c */
  921. int nouveau_ttm_global_init(struct drm_nouveau_private *);
  922. void nouveau_ttm_global_release(struct drm_nouveau_private *);
  923. int nouveau_ttm_mmap(struct file *, struct vm_area_struct *);
  924. /* nouveau_hdmi.c */
  925. void nouveau_hdmi_mode_set(struct drm_encoder *, struct drm_display_mode *);
  926. /* nv04_fb.c */
  927. extern int nv04_fb_vram_init(struct drm_device *);
  928. extern int nv04_fb_init(struct drm_device *);
  929. extern void nv04_fb_takedown(struct drm_device *);
  930. /* nv10_fb.c */
  931. extern int nv10_fb_vram_init(struct drm_device *dev);
  932. extern int nv1a_fb_vram_init(struct drm_device *dev);
  933. extern int nv10_fb_init(struct drm_device *);
  934. extern void nv10_fb_takedown(struct drm_device *);
  935. extern void nv10_fb_init_tile_region(struct drm_device *dev, int i,
  936. uint32_t addr, uint32_t size,
  937. uint32_t pitch, uint32_t flags);
  938. extern void nv10_fb_set_tile_region(struct drm_device *dev, int i);
  939. extern void nv10_fb_free_tile_region(struct drm_device *dev, int i);
  940. /* nv20_fb.c */
  941. extern int nv20_fb_vram_init(struct drm_device *dev);
  942. extern int nv20_fb_init(struct drm_device *);
  943. extern void nv20_fb_takedown(struct drm_device *);
  944. extern void nv20_fb_init_tile_region(struct drm_device *dev, int i,
  945. uint32_t addr, uint32_t size,
  946. uint32_t pitch, uint32_t flags);
  947. extern void nv20_fb_set_tile_region(struct drm_device *dev, int i);
  948. extern void nv20_fb_free_tile_region(struct drm_device *dev, int i);
  949. /* nv30_fb.c */
  950. extern int nv30_fb_init(struct drm_device *);
  951. extern void nv30_fb_takedown(struct drm_device *);
  952. extern void nv30_fb_init_tile_region(struct drm_device *dev, int i,
  953. uint32_t addr, uint32_t size,
  954. uint32_t pitch, uint32_t flags);
  955. extern void nv30_fb_free_tile_region(struct drm_device *dev, int i);
  956. /* nv40_fb.c */
  957. extern int nv40_fb_vram_init(struct drm_device *dev);
  958. extern int nv40_fb_init(struct drm_device *);
  959. extern void nv40_fb_takedown(struct drm_device *);
  960. extern void nv40_fb_set_tile_region(struct drm_device *dev, int i);
  961. /* nv50_fb.c */
  962. extern int nv50_fb_init(struct drm_device *);
  963. extern void nv50_fb_takedown(struct drm_device *);
  964. extern void nv50_fb_vm_trap(struct drm_device *, int display);
  965. /* nvc0_fb.c */
  966. extern int nvc0_fb_init(struct drm_device *);
  967. extern void nvc0_fb_takedown(struct drm_device *);
  968. /* nv04_graph.c */
  969. extern int nv04_graph_create(struct drm_device *);
  970. extern int nv04_graph_object_new(struct nouveau_channel *, int, u32, u16);
  971. extern int nv04_graph_mthd_page_flip(struct nouveau_channel *chan,
  972. u32 class, u32 mthd, u32 data);
  973. extern struct nouveau_bitfield nv04_graph_nsource[];
  974. /* nv10_graph.c */
  975. extern int nv10_graph_create(struct drm_device *);
  976. extern struct nouveau_channel *nv10_graph_channel(struct drm_device *);
  977. extern struct nouveau_bitfield nv10_graph_intr[];
  978. extern struct nouveau_bitfield nv10_graph_nstatus[];
  979. /* nv20_graph.c */
  980. extern int nv20_graph_create(struct drm_device *);
  981. /* nv40_graph.c */
  982. extern int nv40_graph_create(struct drm_device *);
  983. extern void nv40_grctx_init(struct drm_device *, u32 *size);
  984. extern void nv40_grctx_fill(struct drm_device *, struct nouveau_gpuobj *);
  985. /* nv50_graph.c */
  986. extern int nv50_graph_create(struct drm_device *);
  987. extern struct nouveau_enum nv50_data_error_names[];
  988. extern int nv50_graph_isr_chid(struct drm_device *dev, u64 inst);
  989. extern int nv50_grctx_init(struct drm_device *, u32 *, u32, u32 *, u32 *);
  990. extern void nv50_grctx_fill(struct drm_device *, struct nouveau_gpuobj *);
  991. /* nvc0_graph.c */
  992. extern int nvc0_graph_create(struct drm_device *);
  993. extern int nvc0_graph_isr_chid(struct drm_device *dev, u64 inst);
  994. /* nve0_graph.c */
  995. extern int nve0_graph_create(struct drm_device *);
  996. /* nv84_crypt.c */
  997. extern int nv84_crypt_create(struct drm_device *);
  998. /* nv98_crypt.c */
  999. extern int nv98_crypt_create(struct drm_device *dev);
  1000. /* nva3_copy.c */
  1001. extern int nva3_copy_create(struct drm_device *dev);
  1002. /* nvc0_copy.c */
  1003. extern int nvc0_copy_create(struct drm_device *dev, int engine);
  1004. /* nv31_mpeg.c */
  1005. extern int nv31_mpeg_create(struct drm_device *dev);
  1006. /* nv50_mpeg.c */
  1007. extern int nv50_mpeg_create(struct drm_device *dev);
  1008. /* nv84_bsp.c */
  1009. /* nv98_bsp.c */
  1010. extern int nv84_bsp_create(struct drm_device *dev);
  1011. /* nv84_vp.c */
  1012. /* nv98_vp.c */
  1013. extern int nv84_vp_create(struct drm_device *dev);
  1014. /* nv98_ppp.c */
  1015. extern int nv98_ppp_create(struct drm_device *dev);
  1016. /* nv04_instmem.c */
  1017. extern int nv04_instmem_init(struct drm_device *);
  1018. extern void nv04_instmem_takedown(struct drm_device *);
  1019. extern int nv04_instmem_suspend(struct drm_device *);
  1020. extern void nv04_instmem_resume(struct drm_device *);
  1021. extern int nv04_instmem_get(struct nouveau_gpuobj *, struct nouveau_channel *,
  1022. u32 size, u32 align);
  1023. extern void nv04_instmem_put(struct nouveau_gpuobj *);
  1024. extern int nv04_instmem_map(struct nouveau_gpuobj *);
  1025. extern void nv04_instmem_unmap(struct nouveau_gpuobj *);
  1026. extern void nv04_instmem_flush(struct drm_device *);
  1027. /* nv50_instmem.c */
  1028. extern int nv50_instmem_init(struct drm_device *);
  1029. extern void nv50_instmem_takedown(struct drm_device *);
  1030. extern int nv50_instmem_suspend(struct drm_device *);
  1031. extern void nv50_instmem_resume(struct drm_device *);
  1032. extern int nv50_instmem_get(struct nouveau_gpuobj *, struct nouveau_channel *,
  1033. u32 size, u32 align);
  1034. extern void nv50_instmem_put(struct nouveau_gpuobj *);
  1035. extern int nv50_instmem_map(struct nouveau_gpuobj *);
  1036. extern void nv50_instmem_unmap(struct nouveau_gpuobj *);
  1037. extern void nv50_instmem_flush(struct drm_device *);
  1038. extern void nv84_instmem_flush(struct drm_device *);
  1039. /* nvc0_instmem.c */
  1040. extern int nvc0_instmem_init(struct drm_device *);
  1041. extern void nvc0_instmem_takedown(struct drm_device *);
  1042. extern int nvc0_instmem_suspend(struct drm_device *);
  1043. extern void nvc0_instmem_resume(struct drm_device *);
  1044. /* nv04_mc.c */
  1045. extern int nv04_mc_init(struct drm_device *);
  1046. extern void nv04_mc_takedown(struct drm_device *);
  1047. /* nv40_mc.c */
  1048. extern int nv40_mc_init(struct drm_device *);
  1049. extern void nv40_mc_takedown(struct drm_device *);
  1050. /* nv50_mc.c */
  1051. extern int nv50_mc_init(struct drm_device *);
  1052. extern void nv50_mc_takedown(struct drm_device *);
  1053. /* nv04_timer.c */
  1054. extern int nv04_timer_init(struct drm_device *);
  1055. extern uint64_t nv04_timer_read(struct drm_device *);
  1056. extern void nv04_timer_takedown(struct drm_device *);
  1057. extern long nouveau_compat_ioctl(struct file *file, unsigned int cmd,
  1058. unsigned long arg);
  1059. /* nv04_dac.c */
  1060. extern int nv04_dac_create(struct drm_connector *, struct dcb_entry *);
  1061. extern uint32_t nv17_dac_sample_load(struct drm_encoder *encoder);
  1062. extern int nv04_dac_output_offset(struct drm_encoder *encoder);
  1063. extern void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable);
  1064. extern bool nv04_dac_in_use(struct drm_encoder *encoder);
  1065. /* nv04_dfp.c */
  1066. extern int nv04_dfp_create(struct drm_connector *, struct dcb_entry *);
  1067. extern int nv04_dfp_get_bound_head(struct drm_device *dev, struct dcb_entry *dcbent);
  1068. extern void nv04_dfp_bind_head(struct drm_device *dev, struct dcb_entry *dcbent,
  1069. int head, bool dl);
  1070. extern void nv04_dfp_disable(struct drm_device *dev, int head);
  1071. extern void nv04_dfp_update_fp_control(struct drm_encoder *encoder, int mode);
  1072. /* nv04_tv.c */
  1073. extern int nv04_tv_identify(struct drm_device *dev, int i2c_index);
  1074. extern int nv04_tv_create(struct drm_connector *, struct dcb_entry *);
  1075. /* nv17_tv.c */
  1076. extern int nv17_tv_create(struct drm_connector *, struct dcb_entry *);
  1077. /* nv04_display.c */
  1078. extern int nv04_display_early_init(struct drm_device *);
  1079. extern void nv04_display_late_takedown(struct drm_device *);
  1080. extern int nv04_display_create(struct drm_device *);
  1081. extern void nv04_display_destroy(struct drm_device *);
  1082. extern int nv04_display_init(struct drm_device *);
  1083. extern void nv04_display_fini(struct drm_device *);
  1084. /* nvd0_display.c */
  1085. extern int nvd0_display_create(struct drm_device *);
  1086. extern void nvd0_display_destroy(struct drm_device *);
  1087. extern int nvd0_display_init(struct drm_device *);
  1088. extern void nvd0_display_fini(struct drm_device *);
  1089. struct nouveau_bo *nvd0_display_crtc_sema(struct drm_device *, int crtc);
  1090. void nvd0_display_flip_stop(struct drm_crtc *);
  1091. int nvd0_display_flip_next(struct drm_crtc *, struct drm_framebuffer *,
  1092. struct nouveau_channel *, u32 swap_interval);
  1093. /* nv04_crtc.c */
  1094. extern int nv04_crtc_create(struct drm_device *, int index);
  1095. /* nouveau_bo.c */
  1096. extern struct ttm_bo_driver nouveau_bo_driver;
  1097. extern void nouveau_bo_move_init(struct nouveau_channel *);
  1098. extern int nouveau_bo_new(struct drm_device *, int size, int align,
  1099. uint32_t flags, uint32_t tile_mode,
  1100. uint32_t tile_flags,
  1101. struct sg_table *sg,
  1102. struct nouveau_bo **);
  1103. extern int nouveau_bo_pin(struct nouveau_bo *, uint32_t flags);
  1104. extern int nouveau_bo_unpin(struct nouveau_bo *);
  1105. extern int nouveau_bo_map(struct nouveau_bo *);
  1106. extern void nouveau_bo_unmap(struct nouveau_bo *);
  1107. extern void nouveau_bo_placement_set(struct nouveau_bo *, uint32_t type,
  1108. uint32_t busy);
  1109. extern u16 nouveau_bo_rd16(struct nouveau_bo *nvbo, unsigned index);
  1110. extern void nouveau_bo_wr16(struct nouveau_bo *nvbo, unsigned index, u16 val);
  1111. extern u32 nouveau_bo_rd32(struct nouveau_bo *nvbo, unsigned index);
  1112. extern void nouveau_bo_wr32(struct nouveau_bo *nvbo, unsigned index, u32 val);
  1113. extern void nouveau_bo_fence(struct nouveau_bo *, struct nouveau_fence *);
  1114. extern int nouveau_bo_validate(struct nouveau_bo *, bool interruptible,
  1115. bool no_wait_reserve, bool no_wait_gpu);
  1116. extern struct nouveau_vma *
  1117. nouveau_bo_vma_find(struct nouveau_bo *, struct nouveau_vm *);
  1118. extern int nouveau_bo_vma_add(struct nouveau_bo *, struct nouveau_vm *,
  1119. struct nouveau_vma *);
  1120. extern void nouveau_bo_vma_del(struct nouveau_bo *, struct nouveau_vma *);
  1121. /* nouveau_gem.c */
  1122. extern int nouveau_gem_new(struct drm_device *, int size, int align,
  1123. uint32_t domain, uint32_t tile_mode,
  1124. uint32_t tile_flags, struct nouveau_bo **);
  1125. extern int nouveau_gem_object_new(struct drm_gem_object *);
  1126. extern void nouveau_gem_object_del(struct drm_gem_object *);
  1127. extern int nouveau_gem_object_open(struct drm_gem_object *, struct drm_file *);
  1128. extern void nouveau_gem_object_close(struct drm_gem_object *,
  1129. struct drm_file *);
  1130. extern int nouveau_gem_ioctl_new(struct drm_device *, void *,
  1131. struct drm_file *);
  1132. extern int nouveau_gem_ioctl_pushbuf(struct drm_device *, void *,
  1133. struct drm_file *);
  1134. extern int nouveau_gem_ioctl_cpu_prep(struct drm_device *, void *,
  1135. struct drm_file *);
  1136. extern int nouveau_gem_ioctl_cpu_fini(struct drm_device *, void *,
  1137. struct drm_file *);
  1138. extern int nouveau_gem_ioctl_info(struct drm_device *, void *,
  1139. struct drm_file *);
  1140. extern struct dma_buf *nouveau_gem_prime_export(struct drm_device *dev,
  1141. struct drm_gem_object *obj, int flags);
  1142. extern struct drm_gem_object *nouveau_gem_prime_import(struct drm_device *dev,
  1143. struct dma_buf *dma_buf);
  1144. /* nouveau_display.c */
  1145. int nouveau_display_create(struct drm_device *dev);
  1146. void nouveau_display_destroy(struct drm_device *dev);
  1147. int nouveau_display_init(struct drm_device *dev);
  1148. void nouveau_display_fini(struct drm_device *dev);
  1149. int nouveau_vblank_enable(struct drm_device *dev, int crtc);
  1150. void nouveau_vblank_disable(struct drm_device *dev, int crtc);
  1151. int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
  1152. struct drm_pending_vblank_event *event);
  1153. int nouveau_finish_page_flip(struct nouveau_channel *,
  1154. struct nouveau_page_flip_state *);
  1155. int nouveau_display_dumb_create(struct drm_file *, struct drm_device *,
  1156. struct drm_mode_create_dumb *args);
  1157. int nouveau_display_dumb_map_offset(struct drm_file *, struct drm_device *,
  1158. uint32_t handle, uint64_t *offset);
  1159. int nouveau_display_dumb_destroy(struct drm_file *, struct drm_device *,
  1160. uint32_t handle);
  1161. /* nv50_calc.c */
  1162. int nv50_calc_pll(struct drm_device *, struct pll_lims *, int clk,
  1163. int *N1, int *M1, int *N2, int *M2, int *P);
  1164. int nva3_calc_pll(struct drm_device *, struct pll_lims *,
  1165. int clk, int *N, int *fN, int *M, int *P);
  1166. #ifndef ioread32_native
  1167. #ifdef __BIG_ENDIAN
  1168. #define ioread16_native ioread16be
  1169. #define iowrite16_native iowrite16be
  1170. #define ioread32_native ioread32be
  1171. #define iowrite32_native iowrite32be
  1172. #else /* def __BIG_ENDIAN */
  1173. #define ioread16_native ioread16
  1174. #define iowrite16_native iowrite16
  1175. #define ioread32_native ioread32
  1176. #define iowrite32_native iowrite32
  1177. #endif /* def __BIG_ENDIAN else */
  1178. #endif /* !ioread32_native */
  1179. /* channel control reg access */
  1180. static inline u32 nvchan_rd32(struct nouveau_channel *chan, unsigned reg)
  1181. {
  1182. return ioread32_native(chan->user + reg);
  1183. }
  1184. static inline void nvchan_wr32(struct nouveau_channel *chan,
  1185. unsigned reg, u32 val)
  1186. {
  1187. iowrite32_native(val, chan->user + reg);
  1188. }
  1189. /* register access */
  1190. #include "nouveau_compat.h"
  1191. #define nv_rd08 _nv_rd08
  1192. #define nv_wr08 _nv_wr08
  1193. #define nv_rd32 _nv_rd32
  1194. #define nv_wr32 _nv_wr32
  1195. #define nv_mask _nv_mask
  1196. #define nv_wait(dev, reg, mask, val) \
  1197. nouveau_wait_eq(dev, 2000000000ULL, (reg), (mask), (val))
  1198. #define nv_wait_ne(dev, reg, mask, val) \
  1199. nouveau_wait_ne(dev, 2000000000ULL, (reg), (mask), (val))
  1200. #define nv_wait_cb(dev, func, data) \
  1201. nouveau_wait_cb(dev, 2000000000ULL, (func), (data))
  1202. /* PRAMIN access */
  1203. static inline u32 nv_ri32(struct drm_device *dev, unsigned offset)
  1204. {
  1205. struct drm_nouveau_private *dev_priv = dev->dev_private;
  1206. return ioread32_native(dev_priv->ramin + offset);
  1207. }
  1208. static inline void nv_wi32(struct drm_device *dev, unsigned offset, u32 val)
  1209. {
  1210. struct drm_nouveau_private *dev_priv = dev->dev_private;
  1211. iowrite32_native(val, dev_priv->ramin + offset);
  1212. }
  1213. /* object access */
  1214. extern u32 nv_ro32(struct nouveau_gpuobj *, u32 offset);
  1215. extern void nv_wo32(struct nouveau_gpuobj *, u32 offset, u32 val);
  1216. /*
  1217. * Logging
  1218. * Argument d is (struct drm_device *).
  1219. */
  1220. #define NV_PRINTK(level, d, fmt, arg...) \
  1221. printk(level "[" DRM_NAME "] " DRIVER_NAME " %s: " fmt, \
  1222. pci_name(d->pdev), ##arg)
  1223. #ifndef NV_DEBUG_NOTRACE
  1224. #define NV_DEBUG(d, fmt, arg...) do { \
  1225. if (drm_debug & DRM_UT_DRIVER) { \
  1226. NV_PRINTK(KERN_DEBUG, d, "%s:%d - " fmt, __func__, \
  1227. __LINE__, ##arg); \
  1228. } \
  1229. } while (0)
  1230. #define NV_DEBUG_KMS(d, fmt, arg...) do { \
  1231. if (drm_debug & DRM_UT_KMS) { \
  1232. NV_PRINTK(KERN_DEBUG, d, "%s:%d - " fmt, __func__, \
  1233. __LINE__, ##arg); \
  1234. } \
  1235. } while (0)
  1236. #else
  1237. #define NV_DEBUG(d, fmt, arg...) do { \
  1238. if (drm_debug & DRM_UT_DRIVER) \
  1239. NV_PRINTK(KERN_DEBUG, d, fmt, ##arg); \
  1240. } while (0)
  1241. #define NV_DEBUG_KMS(d, fmt, arg...) do { \
  1242. if (drm_debug & DRM_UT_KMS) \
  1243. NV_PRINTK(KERN_DEBUG, d, fmt, ##arg); \
  1244. } while (0)
  1245. #endif
  1246. #define NV_ERROR(d, fmt, arg...) NV_PRINTK(KERN_ERR, d, fmt, ##arg)
  1247. #define NV_INFO(d, fmt, arg...) NV_PRINTK(KERN_INFO, d, fmt, ##arg)
  1248. #define NV_TRACEWARN(d, fmt, arg...) NV_PRINTK(KERN_NOTICE, d, fmt, ##arg)
  1249. #define NV_TRACE(d, fmt, arg...) NV_PRINTK(KERN_INFO, d, fmt, ##arg)
  1250. #define NV_WARN(d, fmt, arg...) NV_PRINTK(KERN_WARNING, d, fmt, ##arg)
  1251. #define NV_WARNONCE(d, fmt, arg...) do { \
  1252. static int _warned = 0; \
  1253. if (!_warned) { \
  1254. NV_WARN(d, fmt, ##arg); \
  1255. _warned = 1; \
  1256. } \
  1257. } while(0)
  1258. /* nouveau_reg_debug bitmask */
  1259. enum {
  1260. NOUVEAU_REG_DEBUG_MC = 0x1,
  1261. NOUVEAU_REG_DEBUG_VIDEO = 0x2,
  1262. NOUVEAU_REG_DEBUG_FB = 0x4,
  1263. NOUVEAU_REG_DEBUG_EXTDEV = 0x8,
  1264. NOUVEAU_REG_DEBUG_CRTC = 0x10,
  1265. NOUVEAU_REG_DEBUG_RAMDAC = 0x20,
  1266. NOUVEAU_REG_DEBUG_VGACRTC = 0x40,
  1267. NOUVEAU_REG_DEBUG_RMVIO = 0x80,
  1268. NOUVEAU_REG_DEBUG_VGAATTR = 0x100,
  1269. NOUVEAU_REG_DEBUG_EVO = 0x200,
  1270. NOUVEAU_REG_DEBUG_AUXCH = 0x400
  1271. };
  1272. #define NV_REG_DEBUG(type, dev, fmt, arg...) do { \
  1273. if (nouveau_reg_debug & NOUVEAU_REG_DEBUG_##type) \
  1274. NV_PRINTK(KERN_DEBUG, dev, "%s: " fmt, __func__, ##arg); \
  1275. } while (0)
  1276. static inline bool
  1277. nv_two_heads(struct drm_device *dev)
  1278. {
  1279. struct drm_nouveau_private *dev_priv = dev->dev_private;
  1280. const int impl = dev->pci_device & 0x0ff0;
  1281. if (dev_priv->card_type >= NV_10 && impl != 0x0100 &&
  1282. impl != 0x0150 && impl != 0x01a0 && impl != 0x0200)
  1283. return true;
  1284. return false;
  1285. }
  1286. static inline bool
  1287. nv_gf4_disp_arch(struct drm_device *dev)
  1288. {
  1289. return nv_two_heads(dev) && (dev->pci_device & 0x0ff0) != 0x0110;
  1290. }
  1291. static inline bool
  1292. nv_two_reg_pll(struct drm_device *dev)
  1293. {
  1294. struct drm_nouveau_private *dev_priv = dev->dev_private;
  1295. const int impl = dev->pci_device & 0x0ff0;
  1296. if (impl == 0x0310 || impl == 0x0340 || dev_priv->card_type >= NV_40)
  1297. return true;
  1298. return false;
  1299. }
  1300. static inline bool
  1301. nv_match_device(struct drm_device *dev, unsigned device,
  1302. unsigned sub_vendor, unsigned sub_device)
  1303. {
  1304. return dev->pdev->device == device &&
  1305. dev->pdev->subsystem_vendor == sub_vendor &&
  1306. dev->pdev->subsystem_device == sub_device;
  1307. }
  1308. static inline void *
  1309. nv_engine(struct drm_device *dev, int engine)
  1310. {
  1311. struct drm_nouveau_private *dev_priv = dev->dev_private;
  1312. return (void *)dev_priv->eng[engine];
  1313. }
  1314. /* returns 1 if device is one of the nv4x using the 0x4497 object class,
  1315. * helpful to determine a number of other hardware features
  1316. */
  1317. static inline int
  1318. nv44_graph_class(struct drm_device *dev)
  1319. {
  1320. struct drm_nouveau_private *dev_priv = dev->dev_private;
  1321. if ((dev_priv->chipset & 0xf0) == 0x60)
  1322. return 1;
  1323. return !(0x0baf & (1 << (dev_priv->chipset & 0x0f)));
  1324. }
  1325. int nv50_vram_init(struct drm_device *);
  1326. void nv50_vram_fini(struct drm_device *);
  1327. int nv50_vram_new(struct drm_device *, u64 size, u32 align, u32 size_nc,
  1328. u32 memtype, struct nouveau_mem **);
  1329. void nv50_vram_del(struct drm_device *, struct nouveau_mem **);
  1330. bool nv50_vram_flags_valid(struct drm_device *, u32 tile_flags);
  1331. int nvc0_vram_init(struct drm_device *);
  1332. int nvc0_vram_new(struct drm_device *, u64 size, u32 align, u32 ncmin,
  1333. u32 memtype, struct nouveau_mem **);
  1334. bool nvc0_vram_flags_valid(struct drm_device *, u32 tile_flags);
  1335. /* memory type/access flags, do not match hardware values */
  1336. #define NV_MEM_ACCESS_RO 1
  1337. #define NV_MEM_ACCESS_WO 2
  1338. #define NV_MEM_ACCESS_RW (NV_MEM_ACCESS_RO | NV_MEM_ACCESS_WO)
  1339. #define NV_MEM_ACCESS_SYS 4
  1340. #define NV_MEM_ACCESS_VM 8
  1341. #define NV_MEM_ACCESS_NOSNOOP 16
  1342. #define NV_MEM_TARGET_VRAM 0
  1343. #define NV_MEM_TARGET_PCI 1
  1344. #define NV_MEM_TARGET_PCI_NOSNOOP 2
  1345. #define NV_MEM_TARGET_VM 3
  1346. #define NV_MEM_TARGET_GART 4
  1347. #define NV_MEM_TYPE_VM 0x7f
  1348. #define NV_MEM_COMP_VM 0x03
  1349. /* FIFO methods */
  1350. #define NV01_SUBCHAN_OBJECT 0x00000000
  1351. #define NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH 0x00000010
  1352. #define NV84_SUBCHAN_SEMAPHORE_ADDRESS_LOW 0x00000014
  1353. #define NV84_SUBCHAN_SEMAPHORE_SEQUENCE 0x00000018
  1354. #define NV84_SUBCHAN_SEMAPHORE_TRIGGER 0x0000001c
  1355. #define NV84_SUBCHAN_SEMAPHORE_TRIGGER_ACQUIRE_EQUAL 0x00000001
  1356. #define NV84_SUBCHAN_SEMAPHORE_TRIGGER_WRITE_LONG 0x00000002
  1357. #define NV84_SUBCHAN_SEMAPHORE_TRIGGER_ACQUIRE_GEQUAL 0x00000004
  1358. #define NVC0_SUBCHAN_SEMAPHORE_TRIGGER_YIELD 0x00001000
  1359. #define NV84_SUBCHAN_NOTIFY_INTR 0x00000020
  1360. #define NV84_SUBCHAN_WRCACHE_FLUSH 0x00000024
  1361. #define NV10_SUBCHAN_REF_CNT 0x00000050
  1362. #define NVSW_SUBCHAN_PAGE_FLIP 0x00000054
  1363. #define NV11_SUBCHAN_DMA_SEMAPHORE 0x00000060
  1364. #define NV11_SUBCHAN_SEMAPHORE_OFFSET 0x00000064
  1365. #define NV11_SUBCHAN_SEMAPHORE_ACQUIRE 0x00000068
  1366. #define NV11_SUBCHAN_SEMAPHORE_RELEASE 0x0000006c
  1367. #define NV40_SUBCHAN_YIELD 0x00000080
  1368. /* NV_SW object class */
  1369. #define NV_SW 0x0000506e
  1370. #define NV_SW_DMA_VBLSEM 0x0000018c
  1371. #define NV_SW_VBLSEM_OFFSET 0x00000400
  1372. #define NV_SW_VBLSEM_RELEASE_VALUE 0x00000404
  1373. #define NV_SW_VBLSEM_RELEASE 0x00000408
  1374. #define NV_SW_PAGE_FLIP 0x00000500
  1375. #endif /* __NOUVEAU_DRV_H__ */