xfree86: Remove os-support/sysv

Nothing's using it, the SysV derivatives we support have their own
custom versions.

Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Adam Jackson 2010-05-12 08:50:54 -04:00
parent 01159ffc47
commit 6ce1908ba4
5 changed files with 1 additions and 570 deletions

View File

@ -2230,7 +2230,6 @@ hw/xfree86/os-support/misc/Makefile
hw/xfree86/os-support/linux/Makefile
hw/xfree86/os-support/sco/Makefile
hw/xfree86/os-support/solaris/Makefile
hw/xfree86/os-support/sysv/Makefile
hw/xfree86/parser/Makefile
hw/xfree86/ramdac/Makefile
hw/xfree86/shadowfb/Makefile

View File

@ -1,5 +1,5 @@
SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS)
DIST_SUBDIRS = bsd bus misc linux solaris sysv sco hurd
DIST_SUBDIRS = bsd bus misc linux solaris sco hurd
sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h

View File

@ -1 +0,0 @@
EXTRA_DIST = sysv_init.c sysv_video.c

View File

@ -1,252 +0,0 @@
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the names of Thomas Roell and David Wexelblat
* not be used in advertising or publicity pertaining to distribution of
* the software without specific, written prior permission. Thomas Roell and
* David Wexelblat makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
* THOMAS ROELL AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID WEXELBLAT BE LIABLE FOR
* ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include <X11/Xmd.h>
#include "compiler.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
static Bool KeepTty = FALSE;
#ifdef SVR4
static Bool Protect0 = FALSE;
#endif
static int VTnum = -1;
void
xf86OpenConsole()
{
int fd;
struct vt_mode VT;
char vtname1[10],vtname2[10];
MessageType from = X_PROBED;
if (serverGeneration == 1)
{
/* check if we're run with euid==0 */
if (geteuid() != 0)
{
FatalError("xf86OpenConsole: Server must be suid root\n");
}
#ifdef SVR4
/* Protect page 0 to help find NULL dereferencing */
/* mprotect() doesn't seem to work */
if (Protect0)
{
int fd = -1;
if ((fd = open("/dev/zero", O_RDONLY, 0)) < 0)
{
xf86Msg(X_WARNING,
"xf86OpenConsole: cannot open /dev/zero (%s)\n",
strerror(errno));
}
else
{
if ((int)mmap(0, 0x1000, PROT_NONE,
MAP_FIXED | MAP_SHARED, fd, 0) == -1)
{
xf86Msg(X_WARNING,
"xf86OpenConsole: failed to protect page 0 (%s)\n",
strerror(errno));
}
close(fd);
}
}
#endif
/*
* setup the virtual terminal manager
*/
if (VTnum != -1)
{
xf86Info.vtno = VTnum;
from = X_CMDLINE;
}
else
{
if ((fd = open("/dev/console",O_WRONLY,0)) < 0)
{
FatalError(
"xf86OpenConsole: Cannot open /dev/console (%s)\n",
strerror(errno));
}
if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) ||
(xf86Info.vtno == -1))
{
FatalError("xf86OpenConsole: Cannot find a free VT\n");
}
close(fd);
}
xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
sprintf(vtname1,"/dev/vc%02d",xf86Info.vtno); /* ESIX */
sprintf(vtname2,"/dev/vt%02d",xf86Info.vtno); /* rest of the world */
if (!KeepTty)
{
setpgrp();
}
if (((xf86Info.consoleFd = open(vtname1, O_RDWR|O_NDELAY, 0)) < 0) &&
((xf86Info.consoleFd = open(vtname2, O_RDWR|O_NDELAY, 0)) < 0))
{
FatalError("xf86OpenConsole: Cannot open %s (%s) (%s)\n",
vtname2, vtname1, strerror(errno));
}
/* change ownership of the vt */
if (chown(vtname1, getuid(), getgid()) < 0)
{
chown(vtname2, getuid(), getgid());
}
/*
* now get the VT
*/
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
{
xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
}
if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
{
xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
}
if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
{
FatalError("xf86OpenConsole: VT_GETMODE failed\n");
}
signal(SIGUSR1, xf86VTRequest);
VT.mode = VT_PROCESS;
VT.relsig = SIGUSR1;
VT.acqsig = SIGUSR1;
if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
{
FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n");
}
if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0)
{
FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed\n");
}
}
else
{
/* serverGeneration != 1 */
/*
* now get the VT
*/
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0)
{
xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
}
if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0)
{
xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
}
/*
* If the server doesn't have the VT when the reset occurs,
* this is to make sure we don't continue until the activate
* signal is received.
*/
if (!xf86Screens[0]->vtSema)
sleep(5);
}
return;
}
void
xf86CloseConsole()
{
struct vt_mode VT;
#if 0
ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno);
ioctl(xf86Info.consoleFd, VT_WAITACTIVE, 0);
#endif
ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); /* Back to text mode ... */
if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1)
{
VT.mode = VT_AUTO;
ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* set dflt vt handling */
}
close(xf86Info.consoleFd); /* make the vt-manager happy */
return;
}
int
xf86ProcessArgument(int argc, char *argv[], int i)
{
/*
* Keep server from detaching from controlling tty. This is useful
* when debugging (so the server can receive keyboard signals.
*/
if (!strcmp(argv[i], "-keeptty"))
{
KeepTty = TRUE;
return 1;
}
#ifdef SVR4
/*
* Undocumented flag to protect page 0 from read/write to help
* catch NULL pointer dereferences. This is purely a debugging
* flag.
*/
if (!strcmp(argv[i], "-protect0"))
{
Protect0 = TRUE;
return 1;
}
#endif
if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
{
if (sscanf(argv[i], "vt%2d", &VTnum) == 0)
{
UseMsg();
VTnum = -1;
return 0;
}
return 1;
}
return 0;
}
void
xf86UseMsg()
{
ErrorF("vtXX use the specified VT number\n");
ErrorF("-keeptty ");
ErrorF("don't detach controlling tty (for debugging only)\n");
return;
}

View File

@ -1,315 +0,0 @@
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the names of Thomas Roell and David Wexelblat
* not be used in advertising or publicity pertaining to distribution of
* the software without specific, written prior permission. Thomas Roell and
* David Wexelblat makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
* THOMAS ROELL AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID WEXELBLAT BE LIABLE FOR
* ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#define _NEED_SYSI86
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "xf86OSpriv.h"
#ifndef MAP_FAILED
#define MAP_FAILED ((void *)-1)
#endif
#ifndef SI86IOPL
#define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
#define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
#else
#define SET_IOPL() sysi86(SI86IOPL,3)
#define RESET_IOPL() sysi86(SI86IOPL,0)
#endif
/***************************************************************************/
/* Video Memory Mapping section */
/***************************************************************************/
/*
* XXX Support for SVR3 will need to be reworked if needed. In particular
* the Region parameter is no longer passed, and will need to be dealt
* with internally if required.
* OK, i'll rework that thing ... (clean it up a lot)
* SVR3 Support only with SVR3_MMAPDRV (mr)
*
*/
#ifdef HAS_SVR3_MMAPDRV
#ifndef MMAP_DEBUG
#define MMAP_DEBUG 3
#endif
struct kd_memloc MapDSC;
int mmapFd = -2;
static int
mmapStat(pointer Base, unsigned long Size) {
int nmmreg,i=0,region=-1;
mmapinfo_t *ibuf;
nmmreg = ioctl(mmapFd, GETNMMREG);
if(nmmreg <= 0)
xf86MsgVerb(X_INFO, MMAP_DEBUG,
"\nNo physical memory mapped currently.\n\n");
else {
if((ibuf = (mmapinfo_t *)malloc(nmmreg*sizeof(mmapinfo_t))) == NULL)
xf86Msg(X_WARNING,
"Couldn't allocate memory 4 mmapinfo_t\n");
else {
if(ioctl(mmapFd, GETMMREG, ibuf) != -1)
{
xf86MsgVerb(X_INFO, MMAP_DEBUG,
"# mmapStat: [Size=%x,Base=%x]\n", Size, Base);
xf86MsgVerb(X_INFO, MMAP_DEBUG,
"# Physical Address Size Reference Count\n");
for(i = 0; i < nmmreg; i++) {
xf86MsgVerb(X_INFO, MMAP_DEBUG,
"%-4d 0x%08X %5dk %5d ",
i, ibuf[i].physaddr, ibuf[i].length/1024, ibuf[i].refcnt);
if (ibuf[i].physaddr == Base || ibuf[i].length == Size ) {
xf86MsgVerb(X_INFO, MMAP_DEBUG,"MATCH !!!");
if (region==-1) region=i;
}
xf86ErrorFVerb(MMAP_DEBUG, "\n");
}
xf86ErrorFVerb(MMAP_DEBUG, "\n");
}
free(ibuf);
}
}
if (region == -1 && nmmreg > 0) region=region * i;
return region;
}
#endif
static Bool
linearVidMem()
{
#ifdef SVR4
return TRUE;
#elif defined(HAS_SVR3_MMAPDRV)
xf86MsgVerb(X_INFO, MMAP_DEBUG,
"# xf86LinearVidMem: MMAP 2.2.2 called\n");
if(mmapFd >= 0) return TRUE;
if ((mmapFd = open("/dev/mmap", O_RDWR)) != -1)
{
if(ioctl(mmapFd, GETVERSION) < 0x0222) {
xf86Msg(X_WARNING,
"xf86LinearVidMem: MMAP 2.2.2 or above required\n");
xf86ErrorF("\tlinear memory access disabled\n");
return FALSE;
}
return TRUE;
}
xf86Msg(X_WARNING, "xf86LinearVidMem: failed to open /dev/mmap (%s)\n",
strerror(errno));
xf86ErrorF("\tlinear memory access disabled\n");
return FALSE;
#endif
}
static pointer
mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
pointer base;
int fd;
#if defined(SVR4)
fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
if (fd < 0)
{
FatalError("xf86MapVidMem: failed to open %s (%s)\n",
DEV_MEM, strerror(errno));
}
base = mmap((caddr_t)0, Size,
(flags & VIDMEM_READONLY) ?
PROT_READ : (PROT_READ | PROT_WRITE),
MAP_SHARED, fd, (off_t)Base);
close(fd);
if (base == MAP_FAILED)
{
FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n",
"xf86MapVidMem", Size, Base, strerror(errno));
}
#else /* SVR4 */
#ifdef HAS_SVR3_MMAPDRV
xf86MsgVerb(X_INFO, MMAP_DEBUG, "# xf86MapVidMem: MMAP 2.2.2 called\n");
xf86MsgVerb(X_INFO, MMAP_DEBUG,
"MMAP_VERSION: 0x%x\n",ioctl(mmapFd, GETVERSION));
if (ioctl(mmapFd, GETVERSION) == -1)
{
xf86LinearVidMem();
}
xf86MsgVerb(X_INFO, MMAP_DEBUG,
"MMAP_VERSION: 0x%x\n",ioctl(mmapFd, GETVERSION));
xf86MsgVerb(X_INFO, MMAP_DEBUG,
"xf86MapVidMem: Screen: %d\n", ScreenNum);
mmapStat(Base,Size);
/* To force the MMAP driver to provide the address */
base = (pointer)0;
xf86MsgVerb(X_INFO, MMAP_DEBUG,
"xf86MapVidMem: [s=%x,a=%x]\n", Size, Base);
MapDSC.vaddr = (char *)base;
MapDSC.physaddr = (char *)Base;
MapDSC.length = Size;
MapDSC.ioflg = 1;
if(mmapFd >= 0)
{
if((base = (pointer)ioctl(mmapFd, MAP, &MapDSC)) == (pointer)-1)
{
FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n",
"xf86MapVidMem", Size, Base, strerror(errno));
/* NOTREACHED */
}
/* Next time we want the same address! */
MapDSC.vaddr = (char *)base;
}
xf86MsgVerb(X_INFO, MMAP_DEBUG,
"MapDSC.vaddr : 0x%x\n", MapDSC.vaddr);
xf86MsgVerb(X_INFO, MMAP_DEBUG,
"MapDSC.physaddr: 0x%x\n", MapDSC.physaddr);
xf86MsgVerb(X_INFO, MMAP_DEBUG,
"MapDSC.length : %d\n", MapDSC.length);
mmapStat(Base,Size);
xf86MsgVerb(X_INFO, MMAP_DEBUG,
"xf86MapVidMem: [s=%x,a=%x,b=%x]\n", Size, Base, base);
xf86MsgVerb(X_INFO, MMAP_DEBUG,
"xf86MapVidMem: SUCCEED Mapping FrameBuffer \n");
#endif /* HAS_SVR3_MMAPDRV */
#endif /* SVR4 */
return base;
}
/* ARGSUSED */
static void
unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
{
#if defined (SVR4)
munmap(Base, Size);
#else /* SVR4 */
#ifdef HAS_SVR3_MMAPDRV
xf86MsgVerb(X_INFO, MMAP_DEBUG,
"# xf86UnMapVidMem: UNMapping FrameBuffer\n");
mmapStat(Base,Size);
ioctl(mmapFd, UNMAPRM , Base);
mmapStat(Base,Size);
xf86MsgVerb(X_INFO, MMAP_DEBUG,
"# xf86UnMapVidMem: Screen: %d [v=%x]\n", ScreenNum, Base);
#endif /* HAS_SVR3_MMAPDRV */
#endif /* SVR4 */
return;
}
#if defined(SVR4) && defined(__i386__) && !defined(sun)
/*
* For some SVR4 versions, a 32-bit read is done for the first location
* in each page when the page is first mapped. If this is done while
* memory access is enabled for regions that have read side-effects,
* this can cause unexpected results, including lockups on some hardware.
* This function is called to make sure each page is mapped while it is
* safe to do so.
*/
/*
* XXX Should get this the correct way (see os/xalloc.c), but since this is
* for one platform I'll be lazy.
*/
#define X_PAGE_SIZE 4096
static void
readSideEffects(int ScreenNum, pointer Base, unsigned long Size)
{
unsigned long base, end, addr;
CARD32 val;
base = (unsigned long)Base;
end = base + Size;
for (addr = base; addr < end; addr += X_PAGE_SIZE)
val = *(volatile CARD32 *)addr;
}
#endif
void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
pVidMem->linearSupported = linearVidMem();
pVidMem->mapMem = mapVidMem;
pVidMem->unmapMem = unmapVidMem;
#if defined(SVR4) && defined(__i386__) && !defined(sun)
pVidMem->readSideEffects = readSideEffects;
#endif
pVidMem->initialised = TRUE;
}
/***************************************************************************/
/* I/O Permissions section */
/***************************************************************************/
static Bool ExtendedEnabled = FALSE;
static Bool InitDone = FALSE;
Bool
xf86EnableIO()
{
int i;
if (ExtendedEnabled)
return TRUE;
if (SET_IOPL() < 0)
{
xf86Msg(X_WARNING,
"xf86EnableIO: Failed to set IOPL for extended I/O\n");
return FALSE;
}
ExtendedEnabled = TRUE;
return TRUE;
}
void
xf86DisableIO()
{
if (!ExtendedEnabled)
return;
RESET_IOPL();
ExtendedEnabled = FALSE;
return;
}