summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@fairlite.demon.co.uk>2001-03-15 21:48:51 +0000
committerAlan Hourihane <alanh@fairlite.demon.co.uk>2001-03-15 21:48:51 +0000
commit2bea25890bacfa0f1fdc18cda63105c07157cad8 (patch)
tree48671e7caa76dfc7abdeb680e9ef70271096ab69
parente4a4359e937c60e5011273c13c24a3df82f3a0b0 (diff)
commit kernel changes for agp (needs agpgart.diff - also added) updategamma-2-0-0-branch
gamma driver for changes.
-rw-r--r--libdrm/xf86drm.c11
-rw-r--r--linux-core/drmP.h2
-rw-r--r--linux-core/drm_agpsupport.c16
-rw-r--r--linux-core/drm_drv.c3
-rw-r--r--linux/agpgart.diff319
-rw-r--r--linux/agpsupport-pre24.h4
-rw-r--r--linux/drm.h13
-rw-r--r--linux/drmP.h2
-rw-r--r--linux/drm_agpsupport.h16
-rw-r--r--linux/drm_drv.h3
-rw-r--r--linux/gamma_dma.c89
-rw-r--r--shared-core/drm.h13
-rw-r--r--shared/drm.h13
13 files changed, 430 insertions, 74 deletions
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c
index 4cc66937..e70a659a 100644
--- a/libdrm/xf86drm.c
+++ b/libdrm/xf86drm.c
@@ -882,11 +882,16 @@ int drmAgpRelease(int fd)
return 0;
}
-int drmAgpEnable(int fd, unsigned long mode)
+int drmAgpEnable(int fd, unsigned int mode, unsigned int bus, unsigned int slot,
+ unsigned int func)
{
- drm_agp_mode_t m;
+ drm_agp_setup_t m;
+
+ m.agp_mode = mode;
+ m.bus = bus;
+ m.slot = slot;
+ m.func = func;
- m.mode = mode;
if (ioctl(fd, DRM_IOCTL_AGP_ENABLE, &m)) return -errno;
return 0;
}
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 694fcb73..a6faa6b3 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -897,6 +897,8 @@ extern int DRM(agp_acquire)(struct inode *inode, struct file *filp,
extern void DRM(agp_do_release)(void);
extern int DRM(agp_release)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
+extern int DRM(agp_enable_old)(struct inode *inode,struct file *filp,
+ unsigned int cmd, unsigned long arg);
extern int DRM(agp_enable)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(agp_info)(struct inode *inode, struct file *filp,
diff --git a/linux-core/drm_agpsupport.c b/linux-core/drm_agpsupport.c
index dfd0d8fc..30940b05 100644
--- a/linux-core/drm_agpsupport.c
+++ b/linux-core/drm_agpsupport.c
@@ -101,20 +101,28 @@ void DRM(agp_do_release)(void)
if (drm_agp->release) drm_agp->release();
}
+int DRM(agp_enable_old)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
+{
+ DRM_ERROR("Called deprecated agp_enable ioctl, not enabling AGP.\n");
+
+ return -ENOSYS;
+}
+
int DRM(agp_enable)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
- drm_agp_mode_t mode;
+ agp_setup setup;
if (!dev->agp->acquired || !drm_agp->enable) return -EINVAL;
- if (copy_from_user(&mode, (drm_agp_mode_t *)arg, sizeof(mode)))
+ if (copy_from_user(&setup, (drm_agp_setup_t *)arg, sizeof(setup)))
return -EFAULT;
- dev->agp->mode = mode.mode;
- drm_agp->enable(mode.mode);
+ dev->agp->mode = setup.agp_mode;
+ drm_agp->enable(&setup);
dev->agp->base = dev->agp->agp_info.aper_base;
dev->agp->enabled = 1;
return 0;
diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c
index d8a7d992..ffb36a21 100644
--- a/linux-core/drm_drv.c
+++ b/linux-core/drm_drv.c
@@ -166,12 +166,13 @@ static drm_ioctl_desc_t DRM(ioctls)[] = {
#if __REALLY_HAVE_AGP
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { DRM(agp_acquire), 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { DRM(agp_release), 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { DRM(agp_enable), 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE_OLD)] = { DRM(agp_enable_old),1,1 },
[DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = { DRM(agp_info), 1, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = { DRM(agp_alloc), 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = { DRM(agp_free), 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { DRM(agp_bind), 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { DRM(agp_unbind), 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { DRM(agp_enable), 1, 1 },
#endif
DRIVER_IOCTLS
diff --git a/linux/agpgart.diff b/linux/agpgart.diff
new file mode 100644
index 00000000..2e6291aa
--- /dev/null
+++ b/linux/agpgart.diff
@@ -0,0 +1,319 @@
+diff -u linux/drivers/char/agp/agp.h linux-agp/drivers/char/agp/agp.h
+--- linux/drivers/char/agp/agp.h Thu Mar 15 19:08:11 2001
++++ linux-agp/drivers/char/agp/agp.h Thu Mar 15 17:42:26 2001
+@@ -106,7 +106,7 @@
+
+ int (*fetch_size) (void);
+ int (*configure) (void);
+- void (*agp_enable) (u32);
++ void (*agp_enable) (agp_setup *);
+ void (*cleanup) (void);
+ void (*tlb_flush) (agp_memory *);
+ unsigned long (*mask_memory) (unsigned long, int);
+diff -u linux/drivers/char/agp/agpgart_be.c linux-agp/drivers/char/agp/agpgart_be.c
+--- linux/drivers/char/agp/agpgart_be.c Thu Mar 15 19:08:11 2001
++++ linux-agp/drivers/char/agp/agpgart_be.c Thu Mar 15 19:00:44 2001
+@@ -383,10 +383,14 @@
+
+ /* Generic Agp routines - Start */
+
+-static void agp_generic_agp_enable(u32 mode)
++static void agp_generic_agp_enable(agp_setup *modesetup)
+ {
+ struct pci_dev *device = NULL;
+ u32 command, scratch, cap_id;
++ u32 mode = modesetup->agp_mode;
++ u32 bus = modesetup->bus;
++ u32 slot = modesetup->slot;
++ u32 func = modesetup->func;
+ u8 cap_ptr;
+
+ pci_read_config_dword(agp_bridge.dev,
+@@ -394,72 +398,81 @@
+ &command);
+
+ /*
+- * PASS1: go throu all devices that claim to be
+- * AGP devices and collect their data.
++ * PASS1: Find AGP device, by BusID
+ */
+
+- while ((device = pci_find_class(PCI_CLASS_DISPLAY_VGA << 8,
+- device)) != NULL) {
+- pci_read_config_dword(device, 0x04, &scratch);
+-
+- if (!(scratch & 0x00100000))
+- continue;
+-
+- pci_read_config_byte(device, 0x34, &cap_ptr);
+-
+- if (cap_ptr != 0x00) {
+- do {
+- pci_read_config_dword(device,
+- cap_ptr, &cap_id);
++ device = pci_find_slot(bus, PCI_DEVFN(slot, func));
+
+- if ((cap_id & 0xff) != 0x02)
+- cap_ptr = (cap_id >> 8) & 0xff;
+- }
+- while (((cap_id & 0xff) != 0x02) && (cap_ptr != 0x00));
+- }
+- if (cap_ptr != 0x00) {
+- /*
+- * Ok, here we have a AGP device. Disable impossible
+- * settings, and adjust the readqueue to the minimum.
+- */
+-
+- pci_read_config_dword(device, cap_ptr + 4, &scratch);
+-
+- /* adjust RQ depth */
+- command =
+- ((command & ~0xff000000) |
+- min((mode & 0xff000000),
+- min((command & 0xff000000),
+- (scratch & 0xff000000))));
+-
+- /* disable SBA if it's not supported */
+- if (!((command & 0x00000200) &&
+- (scratch & 0x00000200) &&
+- (mode & 0x00000200)))
+- command &= ~0x00000200;
+-
+- /* disable FW if it's not supported */
+- if (!((command & 0x00000010) &&
+- (scratch & 0x00000010) &&
+- (mode & 0x00000010)))
+- command &= ~0x00000010;
+-
+- if (!((command & 4) &&
+- (scratch & 4) &&
+- (mode & 4)))
+- command &= ~0x00000004;
+-
+- if (!((command & 2) &&
+- (scratch & 2) &&
+- (mode & 2)))
+- command &= ~0x00000002;
+-
+- if (!((command & 1) &&
+- (scratch & 1) &&
+- (mode & 1)))
+- command &= ~0x00000001;
++ /* We should return failure,
++ but it's the upper level drivers fault really */
++ if (!device) {
++ printk("Failed to initialize AGP device %d:%d:%d\n",
++ bus, slot, func);
++ return;
++ }
++
++#if 0 /* Jeff - what's this ? I can't find it in the AGP spec */
++ pci_read_config_dword(device, 0x04, &scratch);
++
++ if (!(scratch & 0x00100000))
++ continue;
++#endif
++
++ pci_read_config_byte(device, 0x34, &cap_ptr);
++
++ if (cap_ptr != 0x00) {
++ do {
++ pci_read_config_dword(device,
++ cap_ptr, &cap_id);
++
++ if ((cap_id & 0xff) != 0x02)
++ cap_ptr = (cap_id >> 8) & 0xff;
+ }
++ while (((cap_id & 0xff) != 0x02) && (cap_ptr != 0x00));
++ }
++ if (cap_ptr != 0x00) {
++ /*
++ * Ok, here we have a AGP device. Disable impossible
++ * settings, and adjust the readqueue to the minimum.
++ */
++
++ pci_read_config_dword(device, cap_ptr + 4, &scratch);
++
++ /* adjust RQ depth */
++ command =
++ ((command & ~0xff000000) |
++ min((mode & 0xff000000),
++ min((command & 0xff000000),
++ (scratch & 0xff000000))));
++
++ /* disable SBA if it's not supported */
++ if (!((command & 0x00000200) &&
++ (scratch & 0x00000200) &&
++ (mode & 0x00000200)))
++ command &= ~0x00000200;
++
++ /* disable FW if it's not supported */
++ if (!((command & 0x00000010) &&
++ (scratch & 0x00000010) &&
++ (mode & 0x00000010)))
++ command &= ~0x00000010;
++
++ if (!((command & 4) &&
++ (scratch & 4) &&
++ (mode & 4)))
++ command &= ~0x00000004;
++
++ if (!((command & 2) &&
++ (scratch & 2) &&
++ (mode & 2)))
++ command &= ~0x00000002;
++
++ if (!((command & 1) &&
++ (scratch & 1) &&
++ (mode & 1)))
++ command &= ~0x00000001;
+ }
++
+ /*
+ * PASS2: Figure out the 4X/2X/1X setting and enable the
+ * target (our motherboard chipset).
+@@ -481,32 +494,31 @@
+ command);
+
+ /*
+- * PASS3: Go throu all AGP devices and update the
+- * command registers.
++ * PASS3:
++ * update command registers.
+ */
+
+- while ((device = pci_find_class(PCI_CLASS_DISPLAY_VGA << 8,
+- device)) != NULL) {
+- pci_read_config_dword(device, 0x04, &scratch);
+-
+- if (!(scratch & 0x00100000))
+- continue;
+-
+- pci_read_config_byte(device, 0x34, &cap_ptr);
+-
+- if (cap_ptr != 0x00) {
+- do {
+- pci_read_config_dword(device,
+- cap_ptr, &cap_id);
++#if 0 /* Jeff - what's this ? I can't find it in the AGP spec */
++ pci_read_config_dword(device, 0x04, &scratch);
+
+- if ((cap_id & 0xff) != 0x02)
+- cap_ptr = (cap_id >> 8) & 0xff;
+- }
+- while (((cap_id & 0xff) != 0x02) && (cap_ptr != 0x00));
++ if (!(scratch & 0x00100000))
++ continue;
++#endif
++
++ pci_read_config_byte(device, 0x34, &cap_ptr);
++
++ if (cap_ptr != 0x00) {
++ do {
++ pci_read_config_dword(device,
++ cap_ptr, &cap_id);
++
++ if ((cap_id & 0xff) != 0x02)
++ cap_ptr = (cap_id >> 8) & 0xff;
+ }
+- if (cap_ptr != 0x00)
+- pci_write_config_dword(device, cap_ptr + 8, command);
++ while (((cap_id & 0xff) != 0x02) && (cap_ptr != 0x00));
+ }
++ if (cap_ptr != 0x00)
++ pci_write_config_dword(device, cap_ptr + 8, command);
+ }
+
+ static int agp_generic_create_gatt_table(void)
+@@ -803,7 +815,7 @@
+
+ /* End Basic Page Allocation Routines */
+
+-void agp_enable(u32 mode)
++void agp_enable(agp_setup *mode)
+ {
+ if (agp_bridge.type == NOT_SUPPORTED) return;
+ agp_bridge.agp_enable(mode);
+@@ -909,7 +921,7 @@
+ return;
+ }
+
+-static void intel_i810_agp_enable(u32 mode)
++static void intel_i810_agp_enable(agp_setup *mode)
+ {
+ return;
+ }
+diff -u linux/drivers/char/agp/agpgart_fe.c linux-agp/drivers/char/agp/agpgart_fe.c
+--- linux/drivers/char/agp/agpgart_fe.c Thu Mar 15 19:08:11 2001
++++ linux-agp/drivers/char/agp/agpgart_fe.c Thu Mar 15 17:37:06 2001
+@@ -838,7 +838,7 @@
+ if (copy_from_user(&mode, (void *) arg, sizeof(agp_setup))) {
+ return -EFAULT;
+ }
+- agp_enable(mode.agp_mode);
++ agp_enable(&mode);
+ return 0;
+ }
+
+diff -u linux/include/linux/agp_backend.h linux-agp/include/linux/agp_backend.h
+--- linux/include/linux/agp_backend.h Thu Mar 15 19:08:15 2001
++++ linux-agp/include/linux/agp_backend.h Thu Mar 15 17:48:13 2001
+@@ -84,6 +84,13 @@
+ int current_memory;
+ } agp_kern_info;
+
++typedef struct _agp_setup {
++ u32 agp_mode;
++ u32 bus;
++ u32 slot;
++ u32 func;
++} agp_setup;
++
+ /*
+ * The agp_memory structure has information
+ * about the block of agp memory allocated.
+@@ -195,7 +202,7 @@
+ *
+ */
+
+-extern void agp_enable(u32);
++extern void agp_enable(agp_setup *);
+
+ /*
+ * agp_enable :
+@@ -239,7 +246,7 @@
+ agp_memory *(*allocate_memory)(size_t, u32);
+ int (*bind_memory)(agp_memory *, off_t);
+ int (*unbind_memory)(agp_memory *);
+- void (*enable)(u32);
++ void (*enable)(agp_setup *);
+ int (*acquire)(void);
+ void (*release)(void);
+ void (*copy_info)(agp_kern_info *);
+diff -u linux/include/linux/agpgart.h linux-agp/include/linux/agpgart.h
+--- linux/include/linux/agpgart.h Mon Dec 11 20:51:40 2000
++++ linux-agp/include/linux/agpgart.h Thu Mar 15 17:39:09 2001
+@@ -69,9 +69,11 @@
+ size_t pg_used; /* current pages used */
+ } agp_info;
+
++#if 0
+ typedef struct _agp_setup {
+ __u32 agp_mode; /* mode info of bridge */
+ } agp_setup;
++#endif
+
+ /*
+ * The "prot" down below needs still a "sleep" flag somehow ...
+@@ -135,9 +137,11 @@
+ size_t pg_used; /* current pages used */
+ } agp_info;
+
++#if 0
+ typedef struct _agp_setup {
+ u32 agp_mode; /* mode info of bridge */
+ } agp_setup;
++#endif
+
+ /*
+ * The "prot" down below needs still a "sleep" flag somehow ...
diff --git a/linux/agpsupport-pre24.h b/linux/agpsupport-pre24.h
index abcf9f51..9d62a930 100644
--- a/linux/agpsupport-pre24.h
+++ b/linux/agpsupport-pre24.h
@@ -34,7 +34,7 @@ typedef struct {
agp_memory *(*allocate_memory)(size_t, u32);
int (*bind_memory)(agp_memory *, off_t);
int (*unbind_memory)(agp_memory *);
- void (*enable)(u32);
+ void (*enable)(agp_setup *);
int (*acquire)(void);
void (*release)(void);
void (*copy_info)(agp_kern_info *);
@@ -52,7 +52,7 @@ typedef union {
agp_memory *(*allocate_memory)(size_t, u32);
int (*bind_memory)(agp_memory *, off_t);
int (*unbind_memory)(agp_memory *);
- void (*enable)(u32);
+ void (*enable)(agp_setup *);
int (*acquire)(void);
void (*release)(void);
void (*copy_info)(agp_kern_info *);
diff --git a/linux/drm.h b/linux/drm.h
index 7e7682e6..c67b5449 100644
--- a/linux/drm.h
+++ b/linux/drm.h
@@ -307,10 +307,18 @@ typedef struct drm_irq_busid {
int funcnum;
} drm_irq_busid_t;
+/* This one here for backwards compatibility, use drm_agp_setup instead */
typedef struct drm_agp_mode {
- unsigned long mode;
+ unsigned int agp_mode;
} drm_agp_mode_t;
+typedef struct drm_agp_setup {
+ unsigned int agp_mode;
+ unsigned int bus;
+ unsigned int slot;
+ unsigned int func;
+} drm_agp_setup_t;
+
/* For drm_agp_alloc -- allocated a buffer */
typedef struct drm_agp_buffer {
unsigned long size; /* In bytes -- will round to page boundary */
@@ -382,12 +390,13 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30)
#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31)
-#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, drm_agp_mode_t)
+#define DRM_IOCTL_AGP_ENABLE_OLD DRM_IOW( 0x32, drm_agp_mode_t)
#define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, drm_agp_info_t)
#define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, drm_agp_buffer_t)
#define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, drm_agp_buffer_t)
#define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, drm_agp_binding_t)
#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, drm_agp_binding_t)
+#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x38, drm_agp_setup_t)
/* MGA specific ioctls */
#define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t)
diff --git a/linux/drmP.h b/linux/drmP.h
index 694fcb73..a6faa6b3 100644
--- a/linux/drmP.h
+++ b/linux/drmP.h
@@ -897,6 +897,8 @@ extern int DRM(agp_acquire)(struct inode *inode, struct file *filp,
extern void DRM(agp_do_release)(void);
extern int DRM(agp_release)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
+extern int DRM(agp_enable_old)(struct inode *inode,struct file *filp,
+ unsigned int cmd, unsigned long arg);
extern int DRM(agp_enable)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(agp_info)(struct inode *inode, struct file *filp,
diff --git a/linux/drm_agpsupport.h b/linux/drm_agpsupport.h
index dfd0d8fc..30940b05 100644
--- a/linux/drm_agpsupport.h
+++ b/linux/drm_agpsupport.h
@@ -101,20 +101,28 @@ void DRM(agp_do_release)(void)
if (drm_agp->release) drm_agp->release();
}
+int DRM(agp_enable_old)(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long arg)
+{
+ DRM_ERROR("Called deprecated agp_enable ioctl, not enabling AGP.\n");
+
+ return -ENOSYS;
+}
+
int DRM(agp_enable)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
- drm_agp_mode_t mode;
+ agp_setup setup;
if (!dev->agp->acquired || !drm_agp->enable) return -EINVAL;
- if (copy_from_user(&mode, (drm_agp_mode_t *)arg, sizeof(mode)))
+ if (copy_from_user(&setup, (drm_agp_setup_t *)arg, sizeof(setup)))
return -EFAULT;
- dev->agp->mode = mode.mode;
- drm_agp->enable(mode.mode);
+ dev->agp->mode = setup.agp_mode;
+ drm_agp->enable(&setup);
dev->agp->base = dev->agp->agp_info.aper_base;
dev->agp->enabled = 1;
return 0;
diff --git a/linux/drm_drv.h b/linux/drm_drv.h
index d8a7d992..ffb36a21 100644
--- a/linux/drm_drv.h
+++ b/linux/drm_drv.h
@@ -166,12 +166,13 @@ static drm_ioctl_desc_t DRM(ioctls)[] = {
#if __REALLY_HAVE_AGP
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { DRM(agp_acquire), 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { DRM(agp_release), 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { DRM(agp_enable), 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE_OLD)] = { DRM(agp_enable_old),1,1 },
[DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = { DRM(agp_info), 1, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = { DRM(agp_alloc), 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = { DRM(agp_free), 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { DRM(agp_bind), 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { DRM(agp_unbind), 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { DRM(agp_enable), 1, 1 },
#endif
DRIVER_IOCTLS
diff --git a/linux/gamma_dma.c b/linux/gamma_dma.c
index 1e4264ac..f775c498 100644
--- a/linux/gamma_dma.c
+++ b/linux/gamma_dma.c
@@ -639,72 +639,55 @@ static int gamma_do_init_dma( drm_device_t *dev, drm_gamma_init_t *init )
DRM_DEBUG( "%s\n", __FUNCTION__ );
-if (init->pcimode) {
- printk("INITING PCI DMA MODE\n");
- for (i = 0; i < 21; i++) {
- buf = dma->buflist[i];
- printk("0x%x 0x%x\n",buf->address,virt_to_phys((void*)buf->address));
- }
-
- buf = dma->buflist[GLINT_DRI_BUF_COUNT];
- pgt = buf->address;
- printk("pgt = 0x%x\n",pgt);
-
- printk("0x%x\n",virt_to_phys((void*)buf->address) >> 12);
- for (i = 0; i < GLINT_DRI_BUF_COUNT; i++) {
- buf = dma->buflist[i];
- *pgt = virt_to_phys((void*)buf->address) | 0x07;
- printk("0x%x ",*pgt);
- pgt++;
- }
+ if (init->pcimode) {
+ buf = dma->buflist[GLINT_DRI_BUF_COUNT];
+ pgt = buf->address;
+
+ for (i = 0; i < GLINT_DRI_BUF_COUNT; i++) {
+ buf = dma->buflist[i];
+ *pgt = virt_to_phys((void*)buf->address) | 0x07;
+ pgt++;
+ }
- buf = dma->buflist[GLINT_DRI_BUF_COUNT];
- GAMMA_WRITE( GAMMA_PAGETABLEADDR, virt_to_phys((void*)buf->address) );
- GAMMA_WRITE( GAMMA_PAGETABLELENGTH, 2 );
-} else {
- printk("INITING AGP DMA MODE\n");
- dev_priv = DRM(alloc)( sizeof(drm_gamma_private_t), DRM_MEM_DRIVER );
- if ( !dev_priv )
- return -ENOMEM;
- dev->dev_private = (void *)dev_priv;
+ buf = dma->buflist[GLINT_DRI_BUF_COUNT];
+ } else {
+ /* some of this currently isn't used */
+ dev_priv = DRM(alloc)( sizeof(drm_gamma_private_t),
+ DRM_MEM_DRIVER );
+ if ( !dev_priv )
+ return -ENOMEM;
+ dev->dev_private = (void *)dev_priv;
- memset( dev_priv, 0, sizeof(drm_gamma_private_t) );
+ memset( dev_priv, 0, sizeof(drm_gamma_private_t) );
- dev_priv->sarea = dev->maplist[0];
+ dev_priv->sarea = dev->maplist[0];
- DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset );
+ DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset );
- dev_priv->sarea_priv =
- (drm_gamma_sarea_t *)((u8 *)dev_priv->sarea->handle +
+ dev_priv->sarea_priv =
+ (drm_gamma_sarea_t *)((u8 *)dev_priv->sarea->handle +
init->sarea_priv_offset);
- DRM_IOREMAP( dev_priv->buffers );
-
-printk("0x%x 0x%x 0x%x\n",dev_priv->buffers->handle,dev_priv->buffers->size,dev_priv->buffers->offset);
- for (i = 0; i < 21; i++) {
- buf = dma->buflist[i];
- printk("0x%x\n",buf->address);
- }
+ DRM_IOREMAP( dev_priv->buffers );
- buf = dma->buflist[GLINT_DRI_BUF_COUNT];
- pgt = buf->address;
- printk("pgt = 0x%x\n",pgt);
+ buf = dma->buflist[GLINT_DRI_BUF_COUNT];
+ pgt = buf->address;
- printk("0x%x\n",virt_to_phys((void*)buf->address) >> 12);
- for (i = 0; i < GLINT_DRI_BUF_COUNT; i++) {
- buf = dma->buflist[i];
- *pgt = (unsigned int)buf->address + 0x07;
- printk("0x%x ",*pgt);
- pgt++;
- }
+ for (i = 0; i < GLINT_DRI_BUF_COUNT; i++) {
+ buf = dma->buflist[i];
+ *pgt = (unsigned int)buf->address + 0x07;
+ pgt++;
+ }
- buf = dma->buflist[GLINT_DRI_BUF_COUNT];
+ buf = dma->buflist[GLINT_DRI_BUF_COUNT];
- while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3);
- GAMMA_WRITE( GAMMA_GDMACONTROL, 0x6e);
+ while (GAMMA_READ(GAMMA_INFIFOSPACE) < 1);
+ GAMMA_WRITE( GAMMA_GDMACONTROL, 0xe);
+ }
+ while (GAMMA_READ(GAMMA_INFIFOSPACE) < 2);
GAMMA_WRITE( GAMMA_PAGETABLEADDR, virt_to_phys((void*)buf->address) );
GAMMA_WRITE( GAMMA_PAGETABLELENGTH, 2 );
-}
+
return 0;
}
diff --git a/shared-core/drm.h b/shared-core/drm.h
index 7e7682e6..c67b5449 100644
--- a/shared-core/drm.h
+++ b/shared-core/drm.h
@@ -307,10 +307,18 @@ typedef struct drm_irq_busid {
int funcnum;
} drm_irq_busid_t;
+/* This one here for backwards compatibility, use drm_agp_setup instead */
typedef struct drm_agp_mode {
- unsigned long mode;
+ unsigned int agp_mode;
} drm_agp_mode_t;
+typedef struct drm_agp_setup {
+ unsigned int agp_mode;
+ unsigned int bus;
+ unsigned int slot;
+ unsigned int func;
+} drm_agp_setup_t;
+
/* For drm_agp_alloc -- allocated a buffer */
typedef struct drm_agp_buffer {
unsigned long size; /* In bytes -- will round to page boundary */
@@ -382,12 +390,13 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30)
#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31)
-#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, drm_agp_mode_t)
+#define DRM_IOCTL_AGP_ENABLE_OLD DRM_IOW( 0x32, drm_agp_mode_t)
#define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, drm_agp_info_t)
#define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, drm_agp_buffer_t)
#define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, drm_agp_buffer_t)
#define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, drm_agp_binding_t)
#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, drm_agp_binding_t)
+#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x38, drm_agp_setup_t)
/* MGA specific ioctls */
#define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t)
diff --git a/shared/drm.h b/shared/drm.h
index 7e7682e6..c67b5449 100644
--- a/shared/drm.h
+++ b/shared/drm.h
@@ -307,10 +307,18 @@ typedef struct drm_irq_busid {
int funcnum;
} drm_irq_busid_t;
+/* This one here for backwards compatibility, use drm_agp_setup instead */
typedef struct drm_agp_mode {
- unsigned long mode;
+ unsigned int agp_mode;
} drm_agp_mode_t;
+typedef struct drm_agp_setup {
+ unsigned int agp_mode;
+ unsigned int bus;
+ unsigned int slot;
+ unsigned int func;
+} drm_agp_setup_t;
+
/* For drm_agp_alloc -- allocated a buffer */
typedef struct drm_agp_buffer {
unsigned long size; /* In bytes -- will round to page boundary */
@@ -382,12 +390,13 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30)
#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31)
-#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, drm_agp_mode_t)
+#define DRM_IOCTL_AGP_ENABLE_OLD DRM_IOW( 0x32, drm_agp_mode_t)
#define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, drm_agp_info_t)
#define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, drm_agp_buffer_t)
#define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, drm_agp_buffer_t)
#define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, drm_agp_binding_t)
#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, drm_agp_binding_t)
+#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x38, drm_agp_setup_t)
/* MGA specific ioctls */
#define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t)