37 #define DRM_MODE_SCALE_NO_SCALE 2
46 #define IS_PSB(dev) (((dev)->pci_device & 0xfffe) == 0x8108)
47 #define IS_MRST(dev) (((dev)->pci_device & 0xfffc) == 0x4100)
48 #define IS_MFLD(dev) (((dev)->pci_device & 0xfff8) == 0x0130)
54 #define DRIVER_NAME "gma500"
55 #define DRIVER_DESC "DRM driver for the Intel GMA500"
57 #define PSB_DRM_DRIVER_DATE "2011-06-06"
58 #define PSB_DRM_DRIVER_MAJOR 1
59 #define PSB_DRM_DRIVER_MINOR 0
60 #define PSB_DRM_DRIVER_PATCHLEVEL 0
65 #define PSB_VDC_OFFSET 0x00000000
66 #define PSB_VDC_SIZE 0x000080000
67 #define MRST_MMIO_SIZE 0x0000C0000
68 #define MDFLD_MMIO_SIZE 0x000100000
69 #define PSB_SGX_SIZE 0x8000
70 #define PSB_SGX_OFFSET 0x00040000
71 #define MRST_SGX_OFFSET 0x00080000
75 #define PSB_MMIO_RESOURCE 0
76 #define PSB_GATT_RESOURCE 2
77 #define PSB_GTT_RESOURCE 3
81 #define PSB_GMCH_CTRL 0x52
83 #define _PSB_GMCH_ENABLED 0x4
84 #define PSB_PGETBL_CTL 0x2020
85 #define _PSB_PGETBL_ENABLED 0x00000001
86 #define PSB_SGX_2D_SLAVE_PORT 0x4000
89 #define PSB_TT_PRIV0_LIMIT (256*1024*1024)
90 #define PSB_TT_PRIV0_PLIMIT (PSB_TT_PRIV0_LIMIT >> PAGE_SHIFT)
99 #define PSB_MMU_CACHED_MEMORY 0x0001
100 #define PSB_MMU_RO_MEMORY 0x0002
101 #define PSB_MMU_WO_MEMORY 0x0004
105 #define PSB_PDE_MASK 0x003FFFFF
106 #define PSB_PDE_SHIFT 22
107 #define PSB_PTE_SHIFT 12
111 #define PSB_PTE_VALID 0x0001
112 #define PSB_PTE_WO 0x0002
113 #define PSB_PTE_RO 0x0004
114 #define PSB_PTE_CACHED 0x0008
119 #define PSB_MSVDX_CLOCKGATING 0x2064
120 #define PSB_TOPAZ_CLOCKGATING 0x2068
121 #define PSB_HWSTAM 0x2098
122 #define PSB_INSTPM 0x20C0
123 #define PSB_INT_IDENTITY_R 0x20A4
124 #define _PSB_IRQ_ASLE (1<<0)
125 #define _MDFLD_PIPEC_EVENT_FLAG (1<<2)
126 #define _MDFLD_PIPEC_VBLANK_FLAG (1<<3)
127 #define _PSB_DPST_PIPEB_FLAG (1<<4)
128 #define _MDFLD_PIPEB_EVENT_FLAG (1<<4)
129 #define _PSB_VSYNC_PIPEB_FLAG (1<<5)
130 #define _PSB_DPST_PIPEA_FLAG (1<<6)
131 #define _PSB_PIPEA_EVENT_FLAG (1<<6)
132 #define _PSB_VSYNC_PIPEA_FLAG (1<<7)
133 #define _MDFLD_MIPIA_FLAG (1<<16)
134 #define _MDFLD_MIPIC_FLAG (1<<17)
135 #define _PSB_IRQ_DISP_HOTSYNC (1<<17)
136 #define _PSB_IRQ_SGX_FLAG (1<<18)
137 #define _PSB_IRQ_MSVDX_FLAG (1<<19)
138 #define _LNC_IRQ_TOPAZ_FLAG (1<<20)
140 #define _PSB_PIPE_EVENT_FLAG (_PSB_VSYNC_PIPEA_FLAG | \
141 _PSB_VSYNC_PIPEB_FLAG)
144 #define _MDFLD_DISP_ALL_IRQ_FLAG (_MDFLD_PIPEC_EVENT_FLAG | \
145 _MDFLD_PIPEB_EVENT_FLAG | \
146 _PSB_PIPEA_EVENT_FLAG | \
147 _PSB_VSYNC_PIPEA_FLAG | \
148 _MDFLD_MIPIA_FLAG | \
150 #define PSB_INT_IDENTITY_R 0x20A4
151 #define PSB_INT_MASK_R 0x20A8
152 #define PSB_INT_ENABLE_R 0x20A0
154 #define _PSB_MMU_ER_MASK 0x0001FF00
155 #define _PSB_MMU_ER_HOST (1 << 16)
164 #define GPIO_CLOCK_DIR_MASK (1 << 0)
165 #define GPIO_CLOCK_DIR_IN (0 << 1)
166 #define GPIO_CLOCK_DIR_OUT (1 << 1)
167 #define GPIO_CLOCK_VAL_MASK (1 << 2)
168 #define GPIO_CLOCK_VAL_OUT (1 << 3)
169 #define GPIO_CLOCK_VAL_IN (1 << 4)
170 #define GPIO_CLOCK_PULLUP_DISABLE (1 << 5)
171 #define GPIO_DATA_DIR_MASK (1 << 8)
172 #define GPIO_DATA_DIR_IN (0 << 9)
173 #define GPIO_DATA_DIR_OUT (1 << 9)
174 #define GPIO_DATA_VAL_MASK (1 << 10)
175 #define GPIO_DATA_VAL_OUT (1 << 11)
176 #define GPIO_DATA_VAL_IN (1 << 12)
177 #define GPIO_DATA_PULLUP_DISABLE (1 << 13)
179 #define VCLK_DIVISOR_VGA0 0x6000
180 #define VCLK_DIVISOR_VGA1 0x6004
181 #define VCLK_POST_DIV 0x6010
183 #define PSB_COMM_2D (PSB_ENGINE_2D << 4)
184 #define PSB_COMM_3D (PSB_ENGINE_3D << 4)
185 #define PSB_COMM_TA (PSB_ENGINE_TA << 4)
186 #define PSB_COMM_HP (PSB_ENGINE_HP << 4)
187 #define PSB_COMM_USER_IRQ (1024 >> 2)
188 #define PSB_COMM_USER_IRQ_LOST (PSB_COMM_USER_IRQ + 1)
189 #define PSB_COMM_FW (2048 >> 2)
191 #define PSB_UIRQ_VISTEST 1
192 #define PSB_UIRQ_OOM_REPLY 2
193 #define PSB_UIRQ_FIRE_TA_REPLY 3
194 #define PSB_UIRQ_FIRE_RASTER_REPLY 4
196 #define PSB_2D_SIZE (256*1024*1024)
197 #define PSB_MAX_RELOC_PAGES 1024
199 #define PSB_LOW_REG_OFFS 0x0204
200 #define PSB_HIGH_REG_OFFS 0x0600
202 #define PSB_NUM_VBLANKS 2
205 #define PSB_2D_SIZE (256*1024*1024)
206 #define PSB_MAX_RELOC_PAGES 1024
208 #define PSB_LOW_REG_OFFS 0x0204
209 #define PSB_HIGH_REG_OFFS 0x0600
211 #define PSB_NUM_VBLANKS 2
212 #define PSB_WATCHDOG_DELAY (DRM_HZ * 2)
213 #define PSB_LID_DELAY (DRM_HZ / 10)
215 #define MDFLD_PNW_B0 0x04
216 #define MDFLD_PNW_C0 0x08
218 #define MDFLD_DSR_2D_3D_0 (1 << 0)
219 #define MDFLD_DSR_2D_3D_2 (1 << 1)
220 #define MDFLD_DSR_CURSOR_0 (1 << 2)
221 #define MDFLD_DSR_CURSOR_2 (1 << 3)
222 #define MDFLD_DSR_OVERLAY_0 (1 << 4)
223 #define MDFLD_DSR_OVERLAY_2 (1 << 5)
224 #define MDFLD_DSR_MIPI_CONTROL (1 << 6)
225 #define MDFLD_DSR_DAMAGE_MASK_0 ((1 << 0) | (1 << 2) | (1 << 4))
226 #define MDFLD_DSR_DAMAGE_MASK_2 ((1 << 1) | (1 << 3) | (1 << 5))
227 #define MDFLD_DSR_2D_3D (MDFLD_DSR_2D_3D_0 | MDFLD_DSR_2D_3D_2)
229 #define MDFLD_DSR_RR 45
230 #define MDFLD_DPU_ENABLE (1 << 31)
231 #define MDFLD_DSR_FULLSCREEN (1 << 30)
232 #define MDFLD_DSR_DELAY (DRM_HZ / MDFLD_DSR_RR)
234 #define PSB_PWR_STATE_ON 1
235 #define PSB_PWR_STATE_OFF 2
237 #define PSB_PMPOLICY_NOPM 0
238 #define PSB_PMPOLICY_CLOCKGATING 1
239 #define PSB_PMPOLICY_POWERDOWN 2
241 #define PSB_PMSTATE_POWERUP 0
242 #define PSB_PMSTATE_CLOCKGATED 1
243 #define PSB_PMSTATE_POWERDOWN 2
244 #define PSB_PCIx_MSI_ADDR_LOC 0x94
245 #define PSB_PCIx_MSI_DATA_LOC 0x98
248 #define KSEL_CRYSTAL_19 1
249 #define KSEL_BYPASS_19 5
250 #define KSEL_BYPASS_25 6
251 #define KSEL_BYPASS_83_100 7
452 #define PSB_NUM_PIPE 3
697 #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
838 struct drm_file *
file);
847 struct drm_file *
file);
849 struct drm_file *
file);
866 #define PSB_D_GENERAL (1 << 0)
867 #define PSB_D_INIT (1 << 1)
868 #define PSB_D_IRQ (1 << 2)
869 #define PSB_D_ENTRY (1 << 3)
871 #define PSB_D_HV (1 << 4)
872 #define PSB_D_DBI_BF (1 << 5)
873 #define PSB_D_PM (1 << 6)
874 #define PSB_D_RENDER (1 << 7)
875 #define PSB_D_REG (1 << 8)
876 #define PSB_D_MSVDX (1 << 9)
877 #define PSB_D_TOPAZ (1 << 10)
888 int mcr = (0xD0<<24) | (port << 16) | (offset << 8);
891 pci_write_config_dword(pci_root, 0xD0, mcr);
892 pci_read_config_dword(pci_root, 0xD4, &ret_val);
898 int mcr = (0xE0<<24) | (port << 16) | (offset << 8) | 0xF0;
900 pci_write_config_dword(pci_root, 0xD4, value);
901 pci_write_config_dword(pci_root, 0xD0, mcr);
904 static inline u32 MDFLD_MSG_READ32(
uint port,
uint offset)
906 int mcr = (0x10<<24) | (port << 16) | (offset << 8);
909 pci_write_config_dword(pci_root, 0xD0, mcr);
910 pci_read_config_dword(pci_root, 0xD4, &ret_val);
914 static inline void MDFLD_MSG_WRITE32(
uint port,
uint offset,
u32 value)
916 int mcr = (0x11<<24) | (port << 16) | (offset << 8) | 0xF0;
918 pci_write_config_dword(pci_root, 0xD4, value);
919 pci_write_config_dword(pci_root, 0xD0, mcr);
929 #define REG_READ(reg) REGISTER_READ(dev, (reg))
938 #define REG_WRITE(reg, val) REGISTER_WRITE(dev, (reg), (val))
940 static inline void REGISTER_WRITE16(
struct drm_device *dev,
947 #define REG_WRITE16(reg, val) REGISTER_WRITE16(dev, (reg), (val))
949 static inline void REGISTER_WRITE8(
struct drm_device *dev,
956 #define REG_WRITE8(reg, val) REGISTER_WRITE8(dev, (reg), (val))
958 #define PSB_WVDC32(_val, _offs) iowrite32(_val, dev_priv->vdc_reg + (_offs))
959 #define PSB_RVDC32(_offs) ioread32(dev_priv->vdc_reg + (_offs))
962 #ifdef TRAP_SGX_PM_FAULT
963 #define PSB_RSGX32(_offs) \
965 if (inl(dev_priv->apm_base + PSB_APM_STS) & 0x3) { \
967 "access sgx when it's off!! (READ) %s, %d\n", \
968 __FILE__, __LINE__); \
971 ioread32(dev_priv->sgx_reg + (_offs)); \
974 #define PSB_RSGX32(_offs) ioread32(dev_priv->sgx_reg + (_offs))
976 #define PSB_WSGX32(_val, _offs) iowrite32(_val, dev_priv->sgx_reg + (_offs))
978 #define MSVDX_REG_DUMP 0
980 #define PSB_WMSVDX32(_val, _offs) iowrite32(_val, dev_priv->msvdx_reg + (_offs))
981 #define PSB_RMSVDX32(_offs) ioread32(dev_priv->msvdx_reg + (_offs))