diff options
author | Ian Romanick <idr@us.ibm.com> | 2007-03-28 08:08:04 -0700 |
---|---|---|
committer | Ian Romanick <idr@us.ibm.com> | 2007-03-28 08:08:04 -0700 |
commit | 2c6d47108880584f1221ff86c6c8947627f9f607 (patch) | |
tree | 64a042f58df056433c430fb0c99735d9e8c0904d /hw/xfree86/os-support | |
parent | c4fe1bcce1c1e4822e688959b331b47a051d6e0a (diff) | |
parent | 85220446359a75ea2c359b418b4051c04eea739c (diff) |
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into pci-rework
Conflicts:
hw/xfree86/Makefile.am
hw/xfree86/dri/dri.c
Diffstat (limited to 'hw/xfree86/os-support')
-rw-r--r-- | hw/xfree86/os-support/bus/axpPci.c | 5 | ||||
-rw-r--r-- | hw/xfree86/os-support/shared/libc_wrapper.c | 2 | ||||
-rw-r--r-- | hw/xfree86/os-support/solaris/Makefile.am | 4 | ||||
-rw-r--r-- | hw/xfree86/os-support/solaris/sun_apm.c | 232 | ||||
-rw-r--r-- | hw/xfree86/os-support/xf86_OSlib.h | 2 |
5 files changed, 239 insertions, 6 deletions
diff --git a/hw/xfree86/os-support/bus/axpPci.c b/hw/xfree86/os-support/bus/axpPci.c index 1f1547798..e2f086c53 100644 --- a/hw/xfree86/os-support/bus/axpPci.c +++ b/hw/xfree86/os-support/bus/axpPci.c @@ -217,7 +217,8 @@ axpPciInit() * only set up the root bus for each domain (hose) and the bridged * buses will be set up as they are found. */ - bus = PCI_MAKE_BUS(domain, 0); + /* make a bus with both the domain and the root bus in it */ + bus = PCI_MAKE_BUS(domain, pDomain->root_bus); pciBusInfo[bus] = xnfalloc(sizeof(pciBusInfo_t)); (void)memset(pciBusInfo[bus], 0, sizeof(pciBusInfo_t)); @@ -246,7 +247,7 @@ axpPciBusFromTag(PCITAG tag) || !(pDomain = pBusInfo->pciBusPriv) || (pDomain->domain != PCI_DOM_FROM_TAG(tag))) return -1; - bus = PCI_BUS_NO_DOMAIN(bus) + pDomain->root_bus; + bus = PCI_BUS_NO_DOMAIN(bus); /* should just be root_bus */ dfn = PCI_DFN_FROM_TAG(tag); if (_iobase(IOBASE_HOSE, -1, bus, dfn) != pDomain->hose) return -1; diff --git a/hw/xfree86/os-support/shared/libc_wrapper.c b/hw/xfree86/os-support/shared/libc_wrapper.c index 4c4af4c24..a459d5d70 100644 --- a/hw/xfree86/os-support/shared/libc_wrapper.c +++ b/hw/xfree86/os-support/shared/libc_wrapper.c @@ -628,7 +628,7 @@ typedef struct _xf86_file_ { char* fname; } XF86FILE_priv; -XF86FILE_priv stdhnd[3] = { +static XF86FILE_priv stdhnd[3] = { { 0, XF86FILE_magic, NULL, "$stdinp$" }, { 0, XF86FILE_magic, NULL, "$stdout$" }, { 0, XF86FILE_magic, NULL, "$stderr$" } diff --git a/hw/xfree86/os-support/solaris/Makefile.am b/hw/xfree86/os-support/solaris/Makefile.am index 57ec89e57..d01e2e676 100644 --- a/hw/xfree86/os-support/solaris/Makefile.am +++ b/hw/xfree86/os-support/solaris/Makefile.am @@ -19,9 +19,9 @@ solaris-$(SOLARIS_INOUT_ARCH).il: solaris-${SOLARIS_INOUT_ARCH}.S noinst_LTLIBRARIES = libsolaris.la libsolaris_la_SOURCES = sun_bios.c sun_init.c \ - sun_mouse.c sun_vid.c sun_bell.c $(AGP_SRC) \ + sun_mouse.c sun_vid.c sun_bell.c $(AGP_SRC) sun_apm.c \ $(srcdir)/../shared/libc_wrapper.c \ - $(srcdir)/../shared/kmod_noop.c $(srcdir)/../shared/pm_noop.c \ + $(srcdir)/../shared/kmod_noop.c \ $(srcdir)/../shared/posix_tty.c $(srcdir)/../shared/sigiostubs.c \ $(srcdir)/../shared/stdPci.c $(srcdir)/../shared/stdResource.c \ $(VTSW_SRC) diff --git a/hw/xfree86/os-support/solaris/sun_apm.c b/hw/xfree86/os-support/solaris/sun_apm.c new file mode 100644 index 000000000..a9657fd55 --- /dev/null +++ b/hw/xfree86/os-support/solaris/sun_apm.c @@ -0,0 +1,232 @@ +/* Based on hw/xfree86/os-support/bsd/bsd_apm.c which bore no explicit + * copyright notice, so is covered by the following notice: + * + * Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + */ + +/* Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons + * to whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT + * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + * + * Except as contained in this notice, the name of a copyright holder + * shall not be used in advertising or otherwise to promote the sale, use + * or other dealings in this Software without prior written authorization + * of the copyright holder. + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <X11/X.h> +#include "os.h" +#include "xf86.h" +#include "xf86Priv.h" +#define XF86_OS_PRIVS +#include "xf86_OSproc.h" +#include "xf86_OSlib.h" + +#ifndef PLEASE_FIX_THIS +#define APM_STANDBY_REQ 0xa01 +#define APM_SUSPEND_REQ 0xa02 +#define APM_NORMAL_RESUME 0xa03 +#define APM_CRIT_RESUME 0xa04 +#define APM_BATTERY_LOW 0xa05 +#define APM_POWER_CHANGE 0xa06 +#define APM_UPDATE_TIME 0xa07 +#define APM_CRIT_SUSPEND_REQ 0xa08 +#define APM_USER_STANDBY_REQ 0xa09 +#define APM_USER_SUSPEND_REQ 0xa0a +#define APM_SYS_STANDBY_RESUME 0xa0b +#define APM_IOC_NEXTEVENT 0xa0c +#define APM_IOC_RESUME 0xa0d +#define APM_IOC_SUSPEND 0xa0e +#define APM_IOC_STANDBY 0xa0f +#endif + +typedef struct apm_event_info +{ + int type; +} apm_event_info; + +/* + This may be replaced with a better device name + very soon... +*/ +#define APM_DEVICE "/dev/srn" +#define APM_DEVICE1 "/dev/apm" + +static pointer APMihPtr = NULL; +static void sunCloseAPM(void); + +static struct { + u_int apmBsd; + pmEvent xf86; +} sunToXF86Array [] = { + { APM_STANDBY_REQ, XF86_APM_SYS_STANDBY }, + { APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND }, + { APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME }, + { APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME }, + { APM_BATTERY_LOW, XF86_APM_LOW_BATTERY }, + { APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE }, + { APM_UPDATE_TIME, XF86_APM_UPDATE_TIME }, + { APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND }, + { APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY }, + { APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND }, + { APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME }, +#ifdef APM_CAPABILITY_CHANGE + { APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED }, +#endif +}; + +#define numApmEvents (sizeof(sunToXF86Array) / sizeof(sunToXF86Array[0])) + +static pmEvent +sunToXF86(int type) +{ + int i; + + for (i = 0; i < numApmEvents; i++) { + if (type == sunToXF86Array[i].apmBsd) { + return sunToXF86Array[i].xf86; + } + } + return XF86_APM_UNKNOWN; +} + +/* + * APM events can be requested direclty from /dev/apm + */ +static int +sunPMGetEventFromOS(int fd, pmEvent *events, int num) +{ + struct apm_event_info sunEvent; + int i; + + for (i = 0; i < num; i++) { + + if (ioctl(fd, APM_IOC_NEXTEVENT, &sunEvent) < 0) { + if (errno != EAGAIN) { + xf86Msg(X_WARNING, "sunPMGetEventFromOS: APM_IOC_NEXTEVENT" + " errno = %d\n", errno); + } + break; + } + events[i] = sunToXF86(sunEvent.type); + } + xf86Msg(X_WARNING, "Got some events\n"); + return i; +} + +static pmWait +sunPMConfirmEventToOs(int fd, pmEvent event) +{ + switch (event) { +/* XXX: NOT CURRENTLY RETURNED FROM OS */ + case XF86_APM_SYS_STANDBY: + case XF86_APM_USER_STANDBY: + if (ioctl( fd, APM_IOC_STANDBY, NULL ) == 0) + return PM_WAIT; /* should we stop the Xserver in standby, too? */ + else + return PM_NONE; + case XF86_APM_SYS_SUSPEND: + case XF86_APM_CRITICAL_SUSPEND: + case XF86_APM_USER_SUSPEND: + xf86Msg(X_WARNING, "Got SUSPENDED\n"); + if (ioctl( fd, APM_IOC_SUSPEND, NULL ) == 0) + return PM_CONTINUE; + else { + xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_SUSPEND" + " errno = %d\n", errno); + return PM_FAILED; + } + case XF86_APM_STANDBY_RESUME: + case XF86_APM_NORMAL_RESUME: + case XF86_APM_CRITICAL_RESUME: + case XF86_APM_STANDBY_FAILED: + case XF86_APM_SUSPEND_FAILED: + xf86Msg(X_WARNING, "Got RESUME\n"); + if (ioctl( fd, APM_IOC_RESUME, NULL ) == 0) + return PM_CONTINUE; + else { + xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_RESUME" + " errno = %d\n", errno); + return PM_FAILED; + } + default: + return PM_NONE; + } +} + +PMClose +xf86OSPMOpen(void) +{ + int fd; + + if (APMihPtr || !xf86Info.pmFlag) { + return NULL; + } + + if ((fd = open(APM_DEVICE, O_RDWR)) == -1) { + if ((fd = open(APM_DEVICE1, O_RDWR)) == -1) { + return NULL; + } + } + xf86PMGetEventFromOs = sunPMGetEventFromOS; + xf86PMConfirmEventToOs = sunPMConfirmEventToOs; + APMihPtr = xf86AddInputHandler(fd, xf86HandlePMEvents, NULL); + return sunCloseAPM; +} + +static void +sunCloseAPM(void) +{ + int fd; + + if (APMihPtr) { + fd = xf86RemoveInputHandler(APMihPtr); + close(fd); + APMihPtr = NULL; + } +} diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h index 97f872301..27f766d9c 100644 --- a/hw/xfree86/os-support/xf86_OSlib.h +++ b/hw/xfree86/os-support/xf86_OSlib.h @@ -130,8 +130,8 @@ typedef signed long xf86ssize_t; # include <errno.h> # if defined(_NEED_SYSI86) -# include <sys/immu.h> # if !(defined (sun) && defined (SVR4)) +# include <sys/immu.h> # include <sys/region.h> # endif # include <sys/proc.h> |