nvidia.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. typedef struct {
  2. uint16_t width;
  3. uint16_t height;
  4. } RES_TABLE;
  5. typedef struct {
  6. uint8_t ratio; /* 0 -> 16:10, 1 -> 4:3, 2 -> 5:4, 3 -> 16:9 */
  7. uint8_t matrix[17];
  8. } TABLE_A;
  9. typedef struct {
  10. uint8_t ratio;
  11. uint8_t matrix[9];
  12. } TABLE_B;
  13. typedef struct {
  14. uint8_t ratio;
  15. uint8_t matrix[13];
  16. } TABLE_D;
  17. typedef struct {
  18. uint8_t ratio;
  19. uint8_t matrix[5];
  20. } TABLE_LIMIT;
  21. static const uint8_t nv_pattern[4] = {0x44, 0x01, 0x04, 0x00};
  22. static const uint8_t nv_string[4] = "NVID";
  23. #define NV_TOTAL_RESOLUTIONS 11
  24. static const RES_TABLE nv_resolution[NV_TOTAL_RESOLUTIONS] = {
  25. {1280, 720}, {1280, 800}, {1360, 768}, {1400, 1050}, {1440, 900},
  26. {1600, 900}, {1600, 1200}, {1680, 1050}, {1920, 1080}, {1920, 1200},
  27. {2048, 1536}
  28. };
  29. static const uint8_t nv_sample0[] = {
  30. 0x34, 0x2d, 0x27, 0x28, 0x90, 0x2b, 0xa0, 0xbf, 0x9c, 0x8f, 0x96,
  31. 0xb9, 0x8e, 0x1f, 0x00, 0x00, 0x00
  32. };
  33. static const TABLE_A nv_key0[] = {
  34. {3, {0x16, 0xCB, 0x9F, 0x9F, 0x8F, 0xA7, 0x17, 0xEA, 0xD2, 0xCF, 0xCF, 0xEB, 0x47, 0xE0, 0xC0, 0x00, 0x01}},
  35. {0, {0x12, 0xCD, 0x9F, 0x9F, 0x91, 0xA9, 0x1A, 0x3A, 0x21, 0x1F, 0x1F, 0x3B, 0x44, 0xFE, 0xC0, 0x00, 0x01}},
  36. {3, {0x16, 0xB9, 0xA9, 0x9F, 0x8F, 0xB2, 0x16, 0x14, 0x01, 0xFF, 0xCF, 0xEB, 0x46, 0xEA, 0xC0, 0x00, 0x01}},
  37. {1, {0x12, 0xE6, 0xAE, 0xAE, 0x8A, 0xBB, 0x8E, 0x3D, 0x1B, 0x19, 0x19, 0x3E, 0x0E, 0x00, 0xC0, 0x24, 0x12}},
  38. {0, {0x12, 0xE9, 0xB3, 0xB3, 0x8D, 0xBF, 0x92, 0xA3, 0x85, 0x83, 0x83, 0xA4, 0x48, 0xFE, 0xC0, 0x00, 0x00}},
  39. {3, {0x1A, 0xD7, 0xC7, 0xC7, 0x9B, 0xCD, 0x11, 0x9C, 0x86, 0x83, 0x83, 0x9D, 0x4B, 0xFE, 0xC0, 0x00, 0x00}},
  40. {1, {0x12, 0x03, 0xC7, 0xC7, 0x87, 0xD1, 0x09, 0xE0, 0xB1, 0xAF, 0xAF, 0xE1, 0x04, 0x00, 0x01, 0x24, 0x13}},
  41. {0, {0x12, 0x15, 0xD1, 0xD1, 0x99, 0xE0, 0x17, 0x3D, 0x1B, 0x19, 0x19, 0x3E, 0x0E, 0x00, 0x01, 0x24, 0x13}},
  42. {3, {0x16, 0x0E, 0xEF, 0x9F, 0x8F, 0xFD, 0x02, 0x63, 0x3B, 0x37, 0xCF, 0xEB, 0x40, 0x00, 0xC1, 0x24, 0x02}},
  43. {0, {0x12, 0x3F, 0xEF, 0xEF, 0x83, 0x01, 0x1B, 0xD8, 0xB1, 0xAF, 0xAF, 0xD9, 0x04, 0x00, 0x41, 0x25, 0x12}},
  44. {1, {0x12, 0x63, 0xFF, 0xFF, 0x9D, 0x12, 0x0E, 0x34, 0x01, 0x00, 0x00, 0x35, 0x44, 0xE0, 0x41, 0x25, 0x13}}
  45. };
  46. static uint8_t nv_sample1[] =
  47. {0x28, 0x00, 0x19, 0x00, 0x28, 0x18, 0x08, 0x08, 0x05};
  48. static const TABLE_B nv_key1[] = {
  49. {3, {0x00, 0x05, 0xD0, 0x02, 0xA0, 0x2C, 0x10, 0x07, 0x05}},
  50. {0, {0x00, 0x05, 0x20, 0x03, 0xA0, 0x32, 0x10, 0x23, 0x05}},
  51. {3, {0x50, 0x05, 0x00, 0x03, 0xAA, 0x2F, 0x10, 0x07, 0x05}},
  52. {1, {0x78, 0x05, 0x1A, 0x04, 0xAF, 0x4A, 0x0E, 0x21, 0x05}},
  53. {0, {0xA0, 0x05, 0x84, 0x03, 0xB4, 0x38, 0x10, 0x24, 0x05}},
  54. {3, {0x40, 0x06, 0x84, 0x03, 0xC8, 0x38, 0x10, 0x27, 0x05}},
  55. {1, {0x40, 0x06, 0xB0, 0x04, 0xC8, 0x4A, 0x10, 0x19, 0x05}},
  56. {0, {0x90, 0x06, 0x1A, 0x04, 0xD2, 0x41, 0x10, 0x25, 0x05}},
  57. {3, {0x80, 0x07, 0x38, 0x04, 0xF0, 0x42, 0x10, 0x07, 0x05}},
  58. {0, {0x80, 0x07, 0xB0, 0x04, 0xF0, 0x4B, 0x10, 0x26, 0x05}},
  59. {1, {0x00, 0x08, 0x00, 0x06, 0x00, 0x60, 0x10, 0x22, 0x05}}
  60. };
  61. static const uint8_t nv_sample2[] =
  62. {0x82, 0x0f, 0x03, 0x01, 0x00, 0x00, 0x08, 0x04, 0x14, 0x00, 0x00, 0x08, 0x17};
  63. static const TABLE_D nv_key2[] = {
  64. {3, {0x7B, 0x01, 0x03, 0x7B, 0x01, 0x08, 0x01, 0x20, 0x80, 0x02, 0xFF, 0xFF, 0x20}},
  65. {0, {0x61, 0x01, 0x03, 0x61, 0x01, 0x08, 0x01, 0x20, 0x80, 0x02, 0xFF, 0xFF, 0x20}},
  66. {3, {0x4D, 0x01, 0x03, 0x4D, 0x01, 0x08, 0x01, 0x20, 0xA8, 0x02, 0xFF, 0xFF, 0x20}},
  67. {1, {0x49, 0x01, 0x03, 0x49, 0x01, 0x08, 0x01, 0x20, 0xBC, 0x02, 0xFF, 0xFF, 0x20}},
  68. {0, {0x65, 0x01, 0x03, 0x65, 0x01, 0x08, 0x01, 0x20, 0xD0, 0x02, 0xFF, 0xFF, 0x20}},
  69. {3, {0x67, 0x01, 0x03, 0x67, 0x01, 0x08, 0x01, 0x20, 0x20, 0x03, 0xFF, 0xFF, 0x20}},
  70. {1, {0x4A, 0x01, 0x03, 0x4A, 0x01, 0x08, 0x01, 0x20, 0x20, 0x03, 0xFF, 0xFF, 0x20}},
  71. {0, {0x69, 0x01, 0x03, 0x69, 0x01, 0x08, 0x01, 0x20, 0x48, 0x03, 0xFF, 0xFF, 0x20}},
  72. {3, {0x4D, 0x01, 0x03, 0x4D, 0x01, 0x08, 0x01, 0x20, 0xC0, 0x03, 0xFF, 0xFF, 0x20}},
  73. {0, {0x7D, 0x01, 0x03, 0x7D, 0x01, 0x08, 0x01, 0x20, 0xC0, 0x03, 0xFF, 0xFF, 0x20}},
  74. {1, {0x7A, 0x01, 0x03, 0x52, 0x01, 0x08, 0x01, 0x20, 0x00, 0x04, 0xFF, 0xFF, 0x20}}
  75. };
  76. static const uint8_t nv_sample3[] = {0x40, 0x06, 0xba, 0xb0, 0x04};
  77. static const TABLE_LIMIT nv_key3[] = {
  78. {3, {0x00, 0x05, 0xBA, 0xD0, 0x02}},
  79. {0, {0x00, 0x05, 0xBA, 0x20, 0x03}},
  80. {3, {0x50, 0x05, 0xBA, 0x00, 0x03}},
  81. {1, {0x78, 0x05, 0xBA, 0x1A, 0x04}},
  82. {0, {0xA0, 0x05, 0xBA, 0x84, 0x03}},
  83. {3, {0x40, 0x06, 0xBA, 0x84, 0x03}},
  84. {1, {0x40, 0x06, 0xBA, 0xB0, 0x04}},
  85. {0, {0x90, 0x06, 0xBA, 0x1A, 0x04}},
  86. {3, {0x80, 0x07, 0xBA, 0x38, 0x04}},
  87. {0, {0x80, 0x07, 0xBA, 0xB0, 0x04}},
  88. {1, {0x00, 0x08, 0xBA, 0x00, 0x06}}
  89. };
  90. typedef struct {
  91. int16_t reserved1;
  92. int16_t reserved2;
  93. int16_t reserved3;
  94. } NV_RESERVED;
  95. typedef struct {
  96. uint8_t major;
  97. uint8_t minor;
  98. uint8_t rev;
  99. uint8_t size;
  100. } NV_COMMON_TABLE_HEADER;
  101. typedef struct {
  102. uint16_t pixel_clock;
  103. uint16_t h_active;
  104. NV_RESERVED reserved1;
  105. uint16_t h_sync_start;
  106. uint16_t h_sync_end;
  107. uint16_t h_total;
  108. uint16_t v_active;
  109. NV_RESERVED reserved2;
  110. uint16_t v_sync_start;
  111. uint16_t v_sync_end;
  112. uint16_t v_total;
  113. uint16_t reserved3;
  114. } NV_MODELINE;
  115. typedef struct {
  116. NV_COMMON_TABLE_HEADER header;
  117. NV_MODELINE * modelines;
  118. } NV_VESA_TABLE;
  119. #define OFFSET_TO_VESA_TABLE_INDEX 2