[Mplayer-cvslog] CVS: main/libdha mtrr.c,NONE,1.1 Makefile,1.7,1.8 libdha.h,1.5,1.6

Nick Kurshev nick at mplayer.dev.hu
Sat Feb 2 13:14:59 CET 2002


Update of /cvsroot/mplayer/main/libdha
In directory mplayer:/var/tmp.root/cvs-serv22719/main/libdha

Modified Files:
	Makefile libdha.h 
Added Files:
	mtrr.c 
Log Message:
MTRR configuring

--- NEW FILE ---
/*
    mtrr.c - Stuff for optimizing memory access
    Copyrights:
    2002	- Linux version by Nick Kurshev
    Licence: GPL
*/

#include "config.h"

#include <stdio.h>
#include <errno.h>
#include "libdha.h"
#include "AsmMacros.h"


#if defined( __i386__ )
int	mtrr_set_type(unsigned base,unsigned size,int type)
{
#ifdef linux
    FILE * mtrr_fd;
    char * stype;
    switch(type)
    {
	case MTRR_TYPE_UNCACHABLE: stype = "uncachable"; break;
	case MTRR_TYPE_WRCOMB:	   stype = "write-combining"; break;
	case MTRR_TYPE_WRTHROUGH:  stype = "write-through"; break;
	case MTRR_TYPE_WRPROT:	   stype = "write-protect"; break;
	case MTRR_TYPE_WRBACK:	   stype = "write-back"; break;
	default:		   return EINVAL;
    }
    mtrr_fd = fopen("/proc/mtrr","wt");
    if(mtrr_fd)
    {
	fprintf(mtrr_fd,"base=0x%08X size=0x%08X type=%s\n",base,size,stype);
	printf("base=0x%08X size=0x%08X type=%s\n",base,size,stype);
	fclose(mtrr_fd);
	return 0;
    }
    return ENOSYS;
#else
#warning Please port MTRR stuff!!!
#endif
}
#else
int	mtrr_set_type(unsigned base,unsigned size,int type)
{
}
#endif
Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libdha/Makefile,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Makefile	17 Jan 2002 09:01:42 -0000	1.7
+++ Makefile	2 Feb 2002 12:14:56 -0000	1.8
@@ -11,7 +11,7 @@
 endif
 LIBNAME = libdha-$(VERSION).so
 
-SRCS=libdha.c pci.c pci_names.c
+SRCS=libdha.c mtrr.c pci.c pci_names.c
 OBJS=$(SRCS:.c=.o)
 
 CFLAGS  = $(OPTFLAGS) -fPIC -I. -I.. -Wall -W

Index: libdha.h
===================================================================
RCS file: /cvsroot/mplayer/main/libdha/libdha.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- libdha.h	20 Jan 2002 12:12:58 -0000	1.5
+++ libdha.h	2 Feb 2002 12:14:56 -0000	1.6
@@ -58,6 +58,14 @@
 extern void *  map_phys_mem(unsigned base, unsigned size);
 extern void    unmap_phys_mem(void *ptr, unsigned size);
 
+/*  These are the region types  */
+#define MTRR_TYPE_UNCACHABLE 0
+#define MTRR_TYPE_WRCOMB     1
+#define MTRR_TYPE_WRTHROUGH  4
+#define MTRR_TYPE_WRPROT     5
+#define MTRR_TYPE_WRBACK     6
+extern int	mtrr_set_type(unsigned base,unsigned size,int type);
+
 #ifdef __cplusplus
 }
 #endif




More information about the MPlayer-cvslog mailing list