mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-28 15:40:13 +01:00
First round of AXP patches.
This commit is contained in:
parent
3fdcc554e2
commit
4234dc27e0
8 changed files with 191 additions and 5 deletions
|
|
@ -33,6 +33,12 @@
|
|||
#define _DRM_P_H_
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#ifdef __alpha__
|
||||
/* add include of current.h so that "current" is defined
|
||||
* before static inline funcs in wait.h. Doing this so we
|
||||
* can build the DRM (part of PI DRI). 4/21/2000 S + B */
|
||||
#include <asm/current.h>
|
||||
#endif /* __alpha__ */
|
||||
#include <linux/config.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
|
|
@ -44,6 +50,9 @@
|
|||
#include <linux/pci.h>
|
||||
#include <linux/wrapper.h>
|
||||
#include <linux/version.h>
|
||||
#ifdef __alpha__
|
||||
#include <asm/pgtable.h> /* For pte_wrprotect */
|
||||
#endif
|
||||
#include <asm/io.h>
|
||||
#include <asm/mman.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
|
@ -133,6 +142,71 @@ typedef struct wait_queue *wait_queue_head_t;
|
|||
#ifndef __HAVE_ARCH_CMPXCHG
|
||||
/* Include this here so that driver can be
|
||||
used with older kernels. */
|
||||
#if defined(__alpha__)
|
||||
static __inline__ unsigned long
|
||||
__cmpxchg_u32(volatile int *m, int old, int new)
|
||||
{
|
||||
unsigned long prev, cmp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
"1: ldl_l %0,%2\n"
|
||||
" cmpeq %0,%3,%1\n"
|
||||
" beq %1,2f\n"
|
||||
" mov %4,%1\n"
|
||||
" stl_c %1,%2\n"
|
||||
" beq %1,3f\n"
|
||||
"2: mb\n"
|
||||
".subsection 2\n"
|
||||
"3: br 1b\n"
|
||||
".previous"
|
||||
: "=&r"(prev), "=&r"(cmp), "=m"(*m)
|
||||
: "r"((long) old), "r"(new), "m"(*m));
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
static __inline__ unsigned long
|
||||
__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
|
||||
{
|
||||
unsigned long prev, cmp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
"1: ldq_l %0,%2\n"
|
||||
" cmpeq %0,%3,%1\n"
|
||||
" beq %1,2f\n"
|
||||
" mov %4,%1\n"
|
||||
" stq_c %1,%2\n"
|
||||
" beq %1,3f\n"
|
||||
"2: mb\n"
|
||||
".subsection 2\n"
|
||||
"3: br 1b\n"
|
||||
".previous"
|
||||
: "=&r"(prev), "=&r"(cmp), "=m"(*m)
|
||||
: "r"((long) old), "r"(new), "m"(*m));
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
static __inline__ unsigned long
|
||||
__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
|
||||
{
|
||||
switch (size) {
|
||||
case 4:
|
||||
return __cmpxchg_u32(ptr, old, new);
|
||||
case 8:
|
||||
return __cmpxchg_u64(ptr, old, new);
|
||||
}
|
||||
return old;
|
||||
}
|
||||
#define cmpxchg(ptr,o,n) \
|
||||
({ \
|
||||
__typeof__(*(ptr)) _o_ = (o); \
|
||||
__typeof__(*(ptr)) _n_ = (n); \
|
||||
(__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
|
||||
(unsigned long)_n_, sizeof(*(ptr))); \
|
||||
})
|
||||
|
||||
#elif __i386__
|
||||
static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
|
||||
unsigned long new, int size)
|
||||
{
|
||||
|
|
@ -163,6 +237,7 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
|
|||
#define cmpxchg(ptr,o,n) \
|
||||
((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o), \
|
||||
(unsigned long)(n),sizeof(*(ptr))))
|
||||
#endif /* i386 & alpha */
|
||||
#endif
|
||||
|
||||
/* Macros to make printk easier */
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ AGP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \
|
|||
| grep -s 'AGP = ' | cut -d' ' -f3)
|
||||
PARAMS := $(shell if fgrep kill_fasync $(TREE)/linux/fs.h \
|
||||
| fgrep -q band; then echo 3; else echo 2; fi)
|
||||
MACHINE := $(shell echo `uname -m`)
|
||||
ifeq ($(AGP),0)
|
||||
AGP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \
|
||||
| grep -s 'AGP_MODULE = ' | cut -d' ' -f3)
|
||||
|
|
@ -130,7 +131,11 @@ endif
|
|||
ifeq ($(AGP),1)
|
||||
MODCFLAGS += -DDRM_AGP
|
||||
DRMOBJS += agpsupport.o
|
||||
MODS += mga.o i810.o
|
||||
MODS += mga.o
|
||||
ifeq ($(MACHINE),i386)
|
||||
MODS += i810.o
|
||||
endif
|
||||
|
||||
|
||||
MGAOBJS= mga_drv.o mga_dma.o mga_bufs.o mga_state.o mga_context.o
|
||||
MGAHEADERS= mga_drv.h $(DRMHEADERS)
|
||||
|
|
@ -142,6 +147,7 @@ endif
|
|||
all::;@echo === KERNEL HEADERS IN $(TREE)
|
||||
all::;@echo === SMP=${SMP} MODVERSIONS=${MODVERSIONS} AGP=${AGP}
|
||||
all::;@echo === kill_fasync has $(PARAMS) parameters
|
||||
all::;@echo === Compiling for machine $(MACHINE)
|
||||
all:: $(LIBS) $(MODS) $(PROGS)
|
||||
endif
|
||||
|
||||
|
|
|
|||
75
linux/drmP.h
75
linux/drmP.h
|
|
@ -33,6 +33,12 @@
|
|||
#define _DRM_P_H_
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#ifdef __alpha__
|
||||
/* add include of current.h so that "current" is defined
|
||||
* before static inline funcs in wait.h. Doing this so we
|
||||
* can build the DRM (part of PI DRI). 4/21/2000 S + B */
|
||||
#include <asm/current.h>
|
||||
#endif /* __alpha__ */
|
||||
#include <linux/config.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
|
|
@ -44,6 +50,9 @@
|
|||
#include <linux/pci.h>
|
||||
#include <linux/wrapper.h>
|
||||
#include <linux/version.h>
|
||||
#ifdef __alpha__
|
||||
#include <asm/pgtable.h> /* For pte_wrprotect */
|
||||
#endif
|
||||
#include <asm/io.h>
|
||||
#include <asm/mman.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
|
@ -133,6 +142,71 @@ typedef struct wait_queue *wait_queue_head_t;
|
|||
#ifndef __HAVE_ARCH_CMPXCHG
|
||||
/* Include this here so that driver can be
|
||||
used with older kernels. */
|
||||
#if defined(__alpha__)
|
||||
static __inline__ unsigned long
|
||||
__cmpxchg_u32(volatile int *m, int old, int new)
|
||||
{
|
||||
unsigned long prev, cmp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
"1: ldl_l %0,%2\n"
|
||||
" cmpeq %0,%3,%1\n"
|
||||
" beq %1,2f\n"
|
||||
" mov %4,%1\n"
|
||||
" stl_c %1,%2\n"
|
||||
" beq %1,3f\n"
|
||||
"2: mb\n"
|
||||
".subsection 2\n"
|
||||
"3: br 1b\n"
|
||||
".previous"
|
||||
: "=&r"(prev), "=&r"(cmp), "=m"(*m)
|
||||
: "r"((long) old), "r"(new), "m"(*m));
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
static __inline__ unsigned long
|
||||
__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
|
||||
{
|
||||
unsigned long prev, cmp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
"1: ldq_l %0,%2\n"
|
||||
" cmpeq %0,%3,%1\n"
|
||||
" beq %1,2f\n"
|
||||
" mov %4,%1\n"
|
||||
" stq_c %1,%2\n"
|
||||
" beq %1,3f\n"
|
||||
"2: mb\n"
|
||||
".subsection 2\n"
|
||||
"3: br 1b\n"
|
||||
".previous"
|
||||
: "=&r"(prev), "=&r"(cmp), "=m"(*m)
|
||||
: "r"((long) old), "r"(new), "m"(*m));
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
static __inline__ unsigned long
|
||||
__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
|
||||
{
|
||||
switch (size) {
|
||||
case 4:
|
||||
return __cmpxchg_u32(ptr, old, new);
|
||||
case 8:
|
||||
return __cmpxchg_u64(ptr, old, new);
|
||||
}
|
||||
return old;
|
||||
}
|
||||
#define cmpxchg(ptr,o,n) \
|
||||
({ \
|
||||
__typeof__(*(ptr)) _o_ = (o); \
|
||||
__typeof__(*(ptr)) _n_ = (n); \
|
||||
(__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
|
||||
(unsigned long)_n_, sizeof(*(ptr))); \
|
||||
})
|
||||
|
||||
#elif __i386__
|
||||
static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
|
||||
unsigned long new, int size)
|
||||
{
|
||||
|
|
@ -163,6 +237,7 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
|
|||
#define cmpxchg(ptr,o,n) \
|
||||
((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o), \
|
||||
(unsigned long)(n),sizeof(*(ptr))))
|
||||
#endif /* i386 & alpha */
|
||||
#endif
|
||||
|
||||
/* Macros to make printk easier */
|
||||
|
|
|
|||
|
|
@ -29,11 +29,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <linux/sched.h>
|
||||
|
||||
#define __NO_VERSION__
|
||||
#include "drmP.h"
|
||||
#include "mga_drv.h"
|
||||
#include <linux/sched.h>
|
||||
|
||||
static int mga_alloc_queue(drm_device_t *dev)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ static void mga_delay(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
void mga_flush_write_combine(void)
|
||||
{
|
||||
int xchangeDummy;
|
||||
|
|
@ -92,6 +93,7 @@ void mga_flush_write_combine(void)
|
|||
" movl $0,%%eax ; cpuid ; pop %%edx ; pop %%ecx ; pop %%ebx ;"
|
||||
" pop %%eax" : /* no outputs */ : /* no inputs */ );
|
||||
}
|
||||
#endif
|
||||
|
||||
/* These are two age tags that will never be sent to
|
||||
* the hardware */
|
||||
|
|
@ -427,7 +429,12 @@ void mga_fire_primary(drm_device_t *dev, drm_mga_prim_buf_t *prim)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
mga_flush_write_combine();
|
||||
#endif
|
||||
#ifdef __alpha__
|
||||
mb();
|
||||
#endif
|
||||
atomic_inc(&dev_priv->pending_bufs);
|
||||
MGA_WRITE(MGAREG_PRIMADDRESS, phys_head | TT_GENERAL);
|
||||
MGA_WRITE(MGAREG_PRIMEND, (phys_head + num_dwords * 4) | use_agp);
|
||||
|
|
@ -824,7 +831,12 @@ static int mga_dma_initialize(drm_device_t *dev, drm_mga_init_t *init) {
|
|||
* the status register will be correct
|
||||
*/
|
||||
|
||||
#ifdef __i386__
|
||||
mga_flush_write_combine();
|
||||
#endif
|
||||
#ifdef __alpha
|
||||
mb();
|
||||
#endif
|
||||
MGA_WRITE(MGAREG_PRIMADDRESS, phys_head | TT_GENERAL);
|
||||
|
||||
MGA_WRITE(MGAREG_PRIMEND, ((phys_head + num_dwords * 4) |
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <linux/sched.h>
|
||||
|
||||
#define __NO_VERSION__
|
||||
#include "drmP.h"
|
||||
#include "r128_drv.h"
|
||||
#include <linux/sched.h>
|
||||
|
||||
extern drm_ctx_t r128_res_ctx;
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ int R128_READ_PLL(drm_device_t *dev, int addr)
|
|||
return R128_READ(R128_CLOCK_CNTL_DATA);
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
static void r128_flush_write_combine(void)
|
||||
{
|
||||
int xchangeDummy;
|
||||
|
|
@ -86,6 +87,7 @@ static void r128_flush_write_combine(void)
|
|||
"pop %%ebx ;"
|
||||
"pop %%eax" : /* no outputs */ : /* no inputs */ );
|
||||
}
|
||||
#endif
|
||||
|
||||
static void r128_status(drm_device_t *dev)
|
||||
{
|
||||
|
|
@ -496,8 +498,13 @@ static int r128_submit_packets_ring_secure(drm_device_t *dev,
|
|||
dev_priv->ring_start,
|
||||
write * sizeof(u32));
|
||||
|
||||
#ifdef __i386__
|
||||
/* Make sure WC cache has been flushed */
|
||||
r128_flush_write_combine();
|
||||
#endif
|
||||
#ifdef __alpha
|
||||
mb();
|
||||
#endif
|
||||
|
||||
dev_priv->sarea_priv->ring_write = write;
|
||||
R128_WRITE(R128_PM4_BUFFER_DL_WPTR, write);
|
||||
|
|
@ -599,8 +606,13 @@ static int r128_submit_packets_ring(drm_device_t *dev,
|
|||
dev_priv->ring_start,
|
||||
write * sizeof(u32));
|
||||
|
||||
#ifdef __i386__
|
||||
/* Make sure WC cache has been flushed */
|
||||
r128_flush_write_combine();
|
||||
#endif
|
||||
#ifdef __alpha__
|
||||
mb();
|
||||
#endif
|
||||
|
||||
dev_priv->sarea_priv->ring_write = write;
|
||||
R128_WRITE(R128_PM4_BUFFER_DL_WPTR, write);
|
||||
|
|
@ -767,7 +779,13 @@ static int r128_send_vertbufs(drm_device_t *dev, drm_r128_vertex_t *v)
|
|||
}
|
||||
|
||||
/* Make sure WC cache has been flushed (if in PIO mode) */
|
||||
if (!dev_priv->cce_is_bm_mode) r128_flush_write_combine();
|
||||
if (!dev_priv->cce_is_bm_mode)
|
||||
#ifdef __i386__
|
||||
r128_flush_write_combine();
|
||||
#endif
|
||||
#ifdef __alpha__
|
||||
mb();
|
||||
#endif
|
||||
|
||||
/* FIXME: Add support for sending vertex buffer to the CCE here
|
||||
instead of in client code. The v->prim holds the primitive
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <linux/sched.h>
|
||||
|
||||
#define __NO_VERSION__
|
||||
#include "drmP.h"
|
||||
#include "tdfx_drv.h"
|
||||
#include <linux/sched.h>
|
||||
|
||||
extern drm_ctx_t tdfx_res_ctx;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue