summaryrefslogtreecommitdiff
path: root/bsd-core
diff options
context:
space:
mode:
Diffstat (limited to 'bsd-core')
-rw-r--r--bsd-core/Makefile2
-rw-r--r--bsd-core/ati_pcigart.c11
-rw-r--r--bsd-core/drmP.h14
-rw-r--r--bsd-core/drm_agpsupport.c18
-rw-r--r--bsd-core/radeon/Makefile3
5 files changed, 39 insertions, 9 deletions
diff --git a/bsd-core/Makefile b/bsd-core/Makefile
index 895e0377..5f1204ab 100644
--- a/bsd-core/Makefile
+++ b/bsd-core/Makefile
@@ -29,6 +29,8 @@ SHAREDFILES= drm.h \
radeon_irq.c \
radeon_mem.c \
radeon_state.c \
+ r300_cmdbuf.c \
+ r300_reg.h \
sis_drm.h \
sis_drv.h \
sis_ds.c \
diff --git a/bsd-core/ati_pcigart.c b/bsd-core/ati_pcigart.c
index 2eff5be1..f6131664 100644
--- a/bsd-core/ati_pcigart.c
+++ b/bsd-core/ati_pcigart.c
@@ -36,7 +36,7 @@
#define ATI_PCIGART_TABLE_SIZE 32768
int drm_ati_pcigart_init(drm_device_t *dev, unsigned long *addr,
- dma_addr_t *bus_addr)
+ dma_addr_t *bus_addr, int is_pcie)
{
unsigned long pages;
u32 *pci_gart = 0, page_base;
@@ -71,7 +71,14 @@ int drm_ati_pcigart_init(drm_device_t *dev, unsigned long *addr,
page_base = (u32) dev->sg->busaddr[i];
for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) {
- *pci_gart++ = cpu_to_le32( page_base );
+ if (is_pcie) {
+ *pci_gart = (cpu_to_le32(page_base)>>8) | 0xc;
+ DRM_DEBUG("PCIE: %d %08X %08X to %p\n", i,
+ page_base, (cpu_to_le32(page_base)>>8)|0xc,
+ pci_gart);
+ } else
+ *pci_gart = cpu_to_le32(page_base);
+ pci_gart++;
page_base += ATI_PCIGART_PAGE_SIZE;
}
}
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
index 88cf938b..ab6cc534 100644
--- a/bsd-core/drmP.h
+++ b/bsd-core/drmP.h
@@ -258,6 +258,15 @@ typedef drm_device_t *device_t;
extern struct cfdriver drm_cd;
#endif /* !__FreeBSD__ */
+/* Capabilities taken from src/sys/dev/pci/pcireg.h. */
+#ifndef PCIY_AGP
+#define PCIY_AGP 0x02
+#endif
+
+#ifndef PCIY_EXPRESS
+#define PCIY_EXPRESS 0x10
+#endif
+
typedef unsigned long dma_addr_t;
typedef u_int32_t u32;
typedef u_int16_t u16;
@@ -854,8 +863,9 @@ void drm_driver_irq_uninstall(drm_device_t *dev);
int drm_vblank_wait(drm_device_t *dev, unsigned int *vbl_seq);
void drm_vbl_send_signals(drm_device_t *dev);
-/* AGP/GART support (drm_agpsupport.c) */
+/* AGP/PCI Express/GART support (drm_agpsupport.c) */
int drm_device_is_agp(drm_device_t *dev);
+int drm_device_is_pcie(drm_device_t *dev);
drm_agp_head_t *drm_agp_init(void);
void drm_agp_uninit(void);
int drm_agp_acquire(drm_device_t *dev);
@@ -882,7 +892,7 @@ extern int drm_sysctl_cleanup(drm_device_t *dev);
/* ATI PCIGART support (ati_pcigart.c) */
int drm_ati_pcigart_init(drm_device_t *dev, unsigned long *addr,
- dma_addr_t *bus_addr);
+ dma_addr_t *bus_addr, int is_pcie);
int drm_ati_pcigart_cleanup(drm_device_t *dev, unsigned long addr,
dma_addr_t bus_addr);
diff --git a/bsd-core/drm_agpsupport.c b/bsd-core/drm_agpsupport.c
index 9e98140a..4f3a6f28 100644
--- a/bsd-core/drm_agpsupport.c
+++ b/bsd-core/drm_agpsupport.c
@@ -39,8 +39,8 @@
#endif
/* Returns 1 if AGP or 0 if not. */
-int
-drm_device_is_agp(drm_device_t *dev)
+static int
+drm_device_find_capability(drm_device_t *dev, int cap)
{
int ret;
@@ -74,9 +74,9 @@ drm_device_is_agp(drm_device_t *dev)
next = AGP_CAPID_GET_NEXT_PTR(capid);
/*
- * If this capability entry ID is 2, then we are done.
+ * If this capability entry ID is cap, then we are done.
*/
- if (AGP_CAPID_GET_CAP_ID(capid) == 2)
+ if (AGP_CAPID_GET_CAP_ID(capid) == cap)
return 1;
}
@@ -87,6 +87,16 @@ drm_device_is_agp(drm_device_t *dev)
#endif
}
+int drm_device_is_agp(drm_device_t *dev)
+{
+ return (drm_device_find_capability(dev, PCIY_AGP));
+}
+
+int drm_device_is_pcie(drm_device_t *dev)
+{
+ return (drm_device_find_capability(dev, PCIY_EXPRESS));
+}
+
int drm_agp_info(drm_device_t * dev, drm_agp_info_t *info)
{
struct agp_info *kern;
diff --git a/bsd-core/radeon/Makefile b/bsd-core/radeon/Makefile
index b1167521..3348a869 100644
--- a/bsd-core/radeon/Makefile
+++ b/bsd-core/radeon/Makefile
@@ -3,7 +3,8 @@
.PATH: ${.CURDIR}/..
KMOD = radeon
NO_MAN = YES
-SRCS = radeon_cp.c radeon_drv.c radeon_state.c radeon_irq.c radeon_mem.c
+SRCS = r300_cmdbuf.c radeon_cp.c radeon_drv.c radeon_state.c radeon_irq.c \
+ radeon_mem.c
SRCS += device_if.h bus_if.h pci_if.h opt_drm.h
CFLAGS += ${DEBUG_FLAGS} -I. -I..