This is the mail archive of the cygwin-xfree@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: FW: XFree86 Port (Message from XFree86/OS2 developer)




> Just guessing at this; but, is the /dev/iopl supported in the
> device emulation
> by cygwin?  If not, you'll have to add it to the device emulation
> routines in
> the code in the winsup directory for cygwin.
>
> Earnie.

Ernie, no, it is not supported by cygwin, that is /dev/iopl, unless
I am missing something.  That is what Holger meant when he talked about
mmap/munmap.  Mmap and munmap is in Cygwin, but dunno how it relates to
/dev/iopl.  I had been studying the codes which handle /dev/iopl on Unices.
Below is a sample from GNU MACH.  The /dev/iopl is hard coded at 1000s times
to access all kinf memories (video blah blah). Holger suggested, writing a
small
device driver which read the physical memory and using his OS/2 code in
XFree86.

First I was stuck with /dev/mouse, but that was an easy one to resolve.


Regards
Suhaib

#ifdef MACH386
static int ioplfd = -1;
static Bool ScreenEnabled[MAXSCREENS];
static Bool IOEnabled = FALSE;
static Bool InitDone = FALSE;
#endif

void xf86ClearIOPortList(ScreenNum)
int ScreenNum;
{
#ifdef MACH386
	int i;

	if (!InitDone)
	{
		for (i = 0; i < MAXSCREENS; i++)
			ScreenEnabled[i] = FALSE;
		InitDone = TRUE;
	}
#endif
	return;
}

/* ARGSUSED */
void xf86AddIOPorts(ScreenNum, NumPorts, Ports)
int ScreenNum;
int NumPorts;
unsigned *Ports;
{
	return;
}

void xf86EnableIOPorts(ScreenNum)
int ScreenNum;
{
#ifdef MACH386
	ScreenEnabled[ScreenNum] = TRUE;

	if (IOEnabled)
		return;

	if ((ioplfd = open("/dev/iopl", 0)) < 0)
		FatalError("xf86EnablePortIO: Failed to get IOPL for I/O\n");
	IOEnabled = TRUE;
#endif /* MACH386 */
	return;
}

> --- "Suhaib M. Siddiqi" <ssiddiqi@inspirepharm.com> wrote:
> >
> > > > > To explain what they do:
> > > > > pmap allows to map arbitrary physical memory into the X
> > > server's address
> > > > > space. I don't know cygwin enough to know whether there
> is a working
> > > > > mmap/munmap Unix call available, if so, it must be capable of
> > > accessing
> > >
> > > Both of these call are supported by the cygwin library.
> > >
> >
> > Hi Ernie,
> >
> > Thanks.  Actually below is my code, which i named cygwin_mmap.c in
> > xfree86/os-support/cygwin. The Server returns
> > an IOPL I/O error.  Obviously I am doing something wrong; that how do we
> > handle
> > the issue of /dev/iopl, which is hard-coded at several places in XFree86
> > source code.
> > Any advice, please?
> > Thanks
> > Suhaib
> > --------------------
> > #include "X.h"
> > #include "misc.h"
> >
> > #define DevicePtr int
> > #include "xf86_OSlib.h"
> >
> > #define BIOS_SIZE 0x20000
> > #define KERN_SUCCESS 0
> >
> > int xf86ReadBIOS(Base, Offset, Buf, Len)
> > unsigned long Base;
> > unsigned long Offset;
> > unsigned char *Buf;
> > int Len;
> > {
> > 	int fd;
> > 	int screen_addr;
> > 	int ret;
> >
> > 	if ((fd = open("/dev/iopl", O_RDWR, 0)) < 0)
> > 	{
> > 		ErrorF("xf86ReadBIOS: Failed to open /dev/iopl\n");
> > 		return(-1);
> > 	}
> > 	if (KERN_SUCCESS != vm_allocate(task_self(), &screen_addr,
> > 					BIOS_SIZE, TRUE))
> > 	{
> > 		ErrorF("xf86ReadBIOS: Failed vmallocate %x\n", BIOS_SIZE);
> > 		close(fd);
> > 		return(-1);
> > 	}
> > 	if (mmap(screen_addr, BIOS_SIZE, 3, 1, fd, Base) < 0)
> > 	{
> > 		ErrorF("xf86ReadBIOS: Failed to mmap %x at %x\n",
> > 		       BIOS_SIZE, Base);
> > 		vm_deallocate(task_self(), screen_addr, BIOS_SIZE);
> > 		close(fd);
> > 		return(-1);
> > 	}
> > 	memcpy(Buf, (unsigned char *)(screen_addr + Offset), Len);
> > 	if (KERN_SUCCESS != vm_deallocate(task_self(), screen_addr,
> BIOS_SIZE))
> > 	{
> > 		ErrorF("xf86ReadBIOS: Failed vmdeallocate %x\n", BIOS_SIZE);
> > 		close(fd);
> > 		return(-1);
> > 	}
> > 	close(fd);
> > 	return(Len);
> > }
> >
> >
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]