aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/os-support/linux
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-03-23 10:05:55 +0100
committermarha <marha@users.sourceforge.net>2012-03-23 10:05:55 +0100
commit0f834b91a4768673833ab4917e87d86c237bb1a6 (patch)
tree363489504ed4b2d360259b8de4c9e392918e5d02 /xorg-server/hw/xfree86/os-support/linux
parentfc72edebf875378459368c5383d9023730cbca54 (diff)
downloadvcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.gz
vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.bz2
vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.zip
libX11 xserver fontconfig mesa pixman xkbcomp xkeyboard-config git update
23 Mar 2012
Diffstat (limited to 'xorg-server/hw/xfree86/os-support/linux')
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/int10/linux.c544
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c390
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_agp.c745
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_apm.c153
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_axp.c166
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_init.c342
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_video.c808
7 files changed, 1588 insertions, 1560 deletions
diff --git a/xorg-server/hw/xfree86/os-support/linux/int10/linux.c b/xorg-server/hw/xfree86/os-support/linux/int10/linux.c
index 564447ff6..fa58a72b6 100644
--- a/xorg-server/hw/xfree86/os-support/linux/int10/linux.c
+++ b/xorg-server/hw/xfree86/os-support/linux/int10/linux.c
@@ -50,10 +50,10 @@ int10MemRec linuxMem = {
typedef struct {
int lowMem;
int highMem;
- char* base;
- char* base_high;
+ char *base;
+ char *base_high;
int screen;
- char* alloc;
+ char *alloc;
} linuxInt10Priv;
#if defined DoSubModules
@@ -69,7 +69,7 @@ static Int10LinuxSubModuleState loadedSubModule = INT10_NOT_LOADED;
static Int10LinuxSubModuleState int10LinuxLoadSubModule(ScrnInfoPtr pScrn);
-#endif /* DoSubModules */
+#endif /* DoSubModules */
xf86Int10InfoPtr
xf86ExtendedInitInt10(int entityIndex, int Flags)
@@ -77,152 +77,155 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
xf86Int10InfoPtr pInt = NULL;
int screen;
int fd;
- static void* vidMem = NULL;
- static void* sysMem = NULL;
- void* vMem = NULL;
+ static void *vidMem = NULL;
+ static void *sysMem = NULL;
+ void *vMem = NULL;
void *options = NULL;
int low_mem;
int high_mem = -1;
char *base = SHMERRORPTR;
char *base_high = SHMERRORPTR;
- int pagesize;
+ int pagesize;
memType cs;
legacyVGARec vga;
Bool videoBiosMapped = FALSE;
-
+
if (int10Generation != serverGeneration) {
- counter = 0;
- int10Generation = serverGeneration;
+ counter = 0;
+ int10Generation = serverGeneration;
}
screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex;
- options = xf86HandleInt10Options(xf86Screens[screen],entityIndex);
+ options = xf86HandleInt10Options(xf86Screens[screen], entityIndex);
if (int10skip(options)) {
- free(options);
- return NULL;
+ free(options);
+ return NULL;
}
#if defined DoSubModules
- if (loadedSubModule == INT10_NOT_LOADED)
- loadedSubModule = int10LinuxLoadSubModule(xf86Screens[screen]);
+ if (loadedSubModule == INT10_NOT_LOADED)
+ loadedSubModule = int10LinuxLoadSubModule(xf86Screens[screen]);
if (loadedSubModule == INT10_LOAD_FAILED)
- return NULL;
+ return NULL;
#endif
if ((!vidMem) || (!sysMem)) {
- if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
- if (!sysMem) {
- DebugF("Mapping sys bios area\n");
- if ((sysMem = mmap((void *)(SYS_BIOS), BIOS_SIZE,
- PROT_READ | PROT_EXEC,
- MAP_SHARED | MAP_FIXED, fd, SYS_BIOS))
- == MAP_FAILED) {
- xf86DrvMsg(screen, X_ERROR, "Cannot map SYS BIOS\n");
- close(fd);
- goto error0;
- }
- }
- if (!vidMem) {
- DebugF("Mapping VRAM area\n");
- if ((vidMem = mmap((void *)(V_RAM), VRAM_SIZE,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_SHARED | MAP_FIXED, fd, V_RAM))
- == MAP_FAILED) {
- xf86DrvMsg(screen, X_ERROR, "Cannot map V_RAM\n");
- close(fd);
- goto error0;
- }
- }
- close(fd);
- } else {
- xf86DrvMsg(screen, X_ERROR, "Cannot open %s\n", DEV_MEM);
- goto error0;
- }
+ if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
+ if (!sysMem) {
+ DebugF("Mapping sys bios area\n");
+ if ((sysMem = mmap((void *) (SYS_BIOS), BIOS_SIZE,
+ PROT_READ | PROT_EXEC,
+ MAP_SHARED | MAP_FIXED, fd, SYS_BIOS))
+ == MAP_FAILED) {
+ xf86DrvMsg(screen, X_ERROR, "Cannot map SYS BIOS\n");
+ close(fd);
+ goto error0;
+ }
+ }
+ if (!vidMem) {
+ DebugF("Mapping VRAM area\n");
+ if ((vidMem = mmap((void *) (V_RAM), VRAM_SIZE,
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_SHARED | MAP_FIXED, fd, V_RAM))
+ == MAP_FAILED) {
+ xf86DrvMsg(screen, X_ERROR, "Cannot map V_RAM\n");
+ close(fd);
+ goto error0;
+ }
+ }
+ close(fd);
+ }
+ else {
+ xf86DrvMsg(screen, X_ERROR, "Cannot open %s\n", DEV_MEM);
+ goto error0;
+ }
}
- pInt = (xf86Int10InfoPtr)xnfcalloc(1, sizeof(xf86Int10InfoRec));
+ pInt = (xf86Int10InfoPtr) xnfcalloc(1, sizeof(xf86Int10InfoRec));
pInt->scrnIndex = screen;
pInt->entityIndex = entityIndex;
pInt->dev = xf86GetPciInfoForEntity(entityIndex);
if (!xf86Int10ExecSetup(pInt))
- goto error0;
+ goto error0;
pInt->mem = &linuxMem;
pagesize = getpagesize();
- pInt->private = (pointer)xnfcalloc(1, sizeof(linuxInt10Priv));
- ((linuxInt10Priv*)pInt->private)->screen = screen;
- ((linuxInt10Priv*)pInt->private)->alloc =
- (pointer)xnfcalloc(1, ALLOC_ENTRIES(pagesize));
+ pInt->private = (pointer) xnfcalloc(1, sizeof(linuxInt10Priv));
+ ((linuxInt10Priv *) pInt->private)->screen = screen;
+ ((linuxInt10Priv *) pInt->private)->alloc =
+ (pointer) xnfcalloc(1, ALLOC_ENTRIES(pagesize));
if (!xf86IsEntityPrimary(entityIndex)) {
- DebugF("Mapping high memory area\n");
- if ((high_mem = shmget(counter++, HIGH_MEM_SIZE,
- IPC_CREAT | SHM_R | SHM_W)) == -1) {
- if (errno == ENOSYS)
- xf86DrvMsg(screen, X_ERROR, "shmget error\n Please reconfigure"
- " your kernel to include System V IPC support\n");
- else
- xf86DrvMsg(screen, X_ERROR,
- "shmget(highmem) error: %s\n",strerror(errno));
- goto error1;
- }
- } else {
- DebugF("Mapping Video BIOS\n");
- videoBiosMapped = TRUE;
- if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
- if ((vMem = mmap((void *)(V_BIOS), SYS_BIOS - V_BIOS,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_SHARED | MAP_FIXED, fd, V_BIOS))
- == MAP_FAILED) {
- xf86DrvMsg(screen, X_ERROR, "Cannot map V_BIOS\n");
- close(fd);
- goto error1;
- }
- close (fd);
- } else
- goto error1;
+ DebugF("Mapping high memory area\n");
+ if ((high_mem = shmget(counter++, HIGH_MEM_SIZE,
+ IPC_CREAT | SHM_R | SHM_W)) == -1) {
+ if (errno == ENOSYS)
+ xf86DrvMsg(screen, X_ERROR, "shmget error\n Please reconfigure"
+ " your kernel to include System V IPC support\n");
+ else
+ xf86DrvMsg(screen, X_ERROR,
+ "shmget(highmem) error: %s\n", strerror(errno));
+ goto error1;
+ }
+ }
+ else {
+ DebugF("Mapping Video BIOS\n");
+ videoBiosMapped = TRUE;
+ if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
+ if ((vMem = mmap((void *) (V_BIOS), SYS_BIOS - V_BIOS,
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_SHARED | MAP_FIXED, fd, V_BIOS))
+ == MAP_FAILED) {
+ xf86DrvMsg(screen, X_ERROR, "Cannot map V_BIOS\n");
+ close(fd);
+ goto error1;
+ }
+ close(fd);
+ }
+ else
+ goto error1;
}
- ((linuxInt10Priv*)pInt->private)->highMem = high_mem;
-
+ ((linuxInt10Priv *) pInt->private)->highMem = high_mem;
+
DebugF("Mapping 640kB area\n");
- if ((low_mem = shmget(counter++, V_RAM,
- IPC_CREAT | SHM_R | SHM_W)) == -1) {
- xf86DrvMsg(screen, X_ERROR,
- "shmget(lowmem) error: %s\n",strerror(errno));
- goto error2;
+ if ((low_mem = shmget(counter++, V_RAM, IPC_CREAT | SHM_R | SHM_W)) == -1) {
+ xf86DrvMsg(screen, X_ERROR,
+ "shmget(lowmem) error: %s\n", strerror(errno));
+ goto error2;
}
- ((linuxInt10Priv*)pInt->private)->lowMem = low_mem;
+ ((linuxInt10Priv *) pInt->private)->lowMem = low_mem;
base = shmat(low_mem, 0, 0);
if (base == SHMERRORPTR) {
- xf86DrvMsg(screen, X_ERROR,
- "shmat(low_mem) error: %s\n",strerror(errno));
- goto error3;
+ xf86DrvMsg(screen, X_ERROR,
+ "shmat(low_mem) error: %s\n", strerror(errno));
+ goto error3;
}
- ((linuxInt10Priv *)pInt->private)->base = base;
+ ((linuxInt10Priv *) pInt->private)->base = base;
if (high_mem > -1) {
- base_high = shmat(high_mem, 0, 0);
- if (base_high == SHMERRORPTR) {
- xf86DrvMsg(screen, X_ERROR,
- "shmat(high_mem) error: %s\n",strerror(errno));
- goto error3;
- }
- ((linuxInt10Priv*)pInt->private)->base_high = base_high;
- } else
- ((linuxInt10Priv*)pInt->private)->base_high = NULL;
+ base_high = shmat(high_mem, 0, 0);
+ if (base_high == SHMERRORPTR) {
+ xf86DrvMsg(screen, X_ERROR,
+ "shmat(high_mem) error: %s\n", strerror(errno));
+ goto error3;
+ }
+ ((linuxInt10Priv *) pInt->private)->base_high = base_high;
+ }
+ else
+ ((linuxInt10Priv *) pInt->private)->base_high = NULL;
if (!MapCurrentInt10(pInt))
- goto error3;
-
+ goto error3;
+
Int10Current = pInt;
DebugF("Mapping int area\n");
- if (xf86ReadBIOS(0, 0, (unsigned char *)0, LOW_PAGE_SIZE) < 0) {
- xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n");
- goto error3;
+ if (xf86ReadBIOS(0, 0, (unsigned char *) 0, LOW_PAGE_SIZE) < 0) {
+ xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n");
+ goto error3;
}
DebugF("done\n");
/*
@@ -231,57 +234,58 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
* 64K bytes at a time.
*/
if (!videoBiosMapped) {
- memset((pointer)V_BIOS, 0, SYS_BIOS - V_BIOS);
- DebugF("Reading BIOS\n");
- for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE)
- if (xf86ReadBIOS(cs, 0, (pointer)cs, V_BIOS_SIZE) < V_BIOS_SIZE)
- xf86DrvMsg(screen, X_WARNING,
- "Unable to retrieve all of segment 0x%06lX.\n",
- (long)cs);
- DebugF("done\n");
+ memset((pointer) V_BIOS, 0, SYS_BIOS - V_BIOS);
+ DebugF("Reading BIOS\n");
+ for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE)
+ if (xf86ReadBIOS(cs, 0, (pointer) cs, V_BIOS_SIZE) < V_BIOS_SIZE)
+ xf86DrvMsg(screen, X_WARNING,
+ "Unable to retrieve all of segment 0x%06lX.\n",
+ (long) cs);
+ DebugF("done\n");
}
if (xf86IsEntityPrimary(entityIndex) && !(initPrimary(options))) {
- if (!xf86int10GetBiosSegment(pInt, NULL))
- goto error3;
-
- set_return_trap(pInt);
-#ifdef _PC
- pInt->Flags = Flags & (SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH);
- if (! (pInt->Flags & SET_BIOS_SCRATCH))
- pInt->Flags &= ~RESTORE_BIOS_SCRATCH;
- xf86Int10SaveRestoreBIOSVars(pInt, TRUE);
+ if (!xf86int10GetBiosSegment(pInt, NULL))
+ goto error3;
+
+ set_return_trap(pInt);
+#ifdef _PC
+ pInt->Flags = Flags & (SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH);
+ if (!(pInt->Flags & SET_BIOS_SCRATCH))
+ pInt->Flags &= ~RESTORE_BIOS_SCRATCH;
+ xf86Int10SaveRestoreBIOSVars(pInt, TRUE);
#endif
- } else {
- const BusType location_type = xf86int10GetBiosLocationType(pInt);
-
- switch (location_type) {
- case BUS_PCI: {
- int err;
- struct pci_device *rom_device =
- xf86GetPciInfoForEntity(pInt->entityIndex);
-
- pci_device_enable(rom_device);
- err = pci_device_read_rom(rom_device, (unsigned char *)(V_BIOS));
- if (err) {
- xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (%s)\n",
- strerror(err));
- goto error3;
- }
-
- pInt->BIOSseg = V_BIOS >> 4;
- break;
- }
- default:
- goto error3;
- }
-
- pInt->num = 0xe6;
- reset_int_vect(pInt);
- set_return_trap(pInt);
- LockLegacyVGA(pInt, &vga);
- xf86ExecX86int10(pInt);
- UnlockLegacyVGA(pInt, &vga);
+ }
+ else {
+ const BusType location_type = xf86int10GetBiosLocationType(pInt);
+
+ switch (location_type) {
+ case BUS_PCI:{
+ int err;
+ struct pci_device *rom_device =
+ xf86GetPciInfoForEntity(pInt->entityIndex);
+
+ pci_device_enable(rom_device);
+ err = pci_device_read_rom(rom_device, (unsigned char *) (V_BIOS));
+ if (err) {
+ xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (%s)\n",
+ strerror(err));
+ goto error3;
+ }
+
+ pInt->BIOSseg = V_BIOS >> 4;
+ break;
+ }
+ default:
+ goto error3;
+ }
+
+ pInt->num = 0xe6;
+ reset_int_vect(pInt);
+ set_return_trap(pInt);
+ LockLegacyVGA(pInt, &vga);
+ xf86ExecX86int10(pInt);
+ UnlockLegacyVGA(pInt, &vga);
}
#ifdef DEBUG
dprint(0xc0000, 0x20);
@@ -290,24 +294,24 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
free(options);
return pInt;
-error3:
+ error3:
if (base_high)
- shmdt(base_high);
+ shmdt(base_high);
shmdt(base);
shmdt(0);
if (base_high)
- shmdt((char*)HIGH_MEM);
+ shmdt((char *) HIGH_MEM);
shmctl(low_mem, IPC_RMID, NULL);
Int10Current = NULL;
-error2:
+ error2:
if (high_mem > -1)
- shmctl(high_mem, IPC_RMID,NULL);
-error1:
+ shmctl(high_mem, IPC_RMID, NULL);
+ error1:
if (vMem)
- munmap(vMem, SYS_BIOS - V_BIOS);
- free(((linuxInt10Priv*)pInt->private)->alloc);
+ munmap(vMem, SYS_BIOS - V_BIOS);
+ free(((linuxInt10Priv *) pInt->private)->alloc);
free(pInt->private);
-error0:
+ error0:
free(options);
free(pInt);
return NULL;
@@ -318,57 +322,60 @@ MapCurrentInt10(xf86Int10InfoPtr pInt)
{
pointer addr;
int fd = -1;
-
+
if (Int10Current) {
- shmdt(0);
- if (((linuxInt10Priv*)Int10Current->private)->highMem >= 0)
- shmdt((char*)HIGH_MEM);
- else
- munmap((pointer)V_BIOS, (SYS_BIOS - V_BIOS));
+ shmdt(0);
+ if (((linuxInt10Priv *) Int10Current->private)->highMem >= 0)
+ shmdt((char *) HIGH_MEM);
+ else
+ munmap((pointer) V_BIOS, (SYS_BIOS - V_BIOS));
}
- addr = shmat(((linuxInt10Priv*)pInt->private)->lowMem, (char*)1, SHM_RND);
+ addr =
+ shmat(((linuxInt10Priv *) pInt->private)->lowMem, (char *) 1, SHM_RND);
if (addr == SHMERRORPTR) {
- xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot shmat() low memory\n");
- xf86DrvMsg(pInt->scrnIndex, X_ERROR,
- "shmat(low_mem) error: %s\n",strerror(errno));
- return FALSE;
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot shmat() low memory\n");
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "shmat(low_mem) error: %s\n", strerror(errno));
+ return FALSE;
}
- if (mprotect((void*)0, V_RAM, PROT_READ|PROT_WRITE|PROT_EXEC) != 0)
+ if (mprotect((void *) 0, V_RAM, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
xf86DrvMsg(pInt->scrnIndex, X_ERROR,
- "Cannot set EXEC bit on low memory: %s\n", strerror(errno));
-
- if (((linuxInt10Priv*)pInt->private)->highMem >= 0) {
- addr = shmat(((linuxInt10Priv*)pInt->private)->highMem,
- (char*)HIGH_MEM, 0);
- if (addr == SHMERRORPTR) {
- xf86DrvMsg(pInt->scrnIndex, X_ERROR,
- "Cannot shmat() high memory\n");
- xf86DrvMsg(pInt->scrnIndex, X_ERROR,
- "shmget error: %s\n",strerror(errno));
- return FALSE;
- }
- if (mprotect((void*)HIGH_MEM, HIGH_MEM_SIZE,
- PROT_READ|PROT_WRITE|PROT_EXEC) != 0)
- xf86DrvMsg(pInt->scrnIndex, X_ERROR,
- "Cannot set EXEC bit on high memory: %s\n",
- strerror(errno));
- } else {
- if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
- if (mmap((void *)(V_BIOS), SYS_BIOS - V_BIOS,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_SHARED | MAP_FIXED, fd, V_BIOS)
- == MAP_FAILED) {
- xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot map V_BIOS\n");
- close (fd);
- return FALSE;
- }
- } else {
- xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot open %s\n",DEV_MEM);
- return FALSE;
- }
- close (fd);
+ "Cannot set EXEC bit on low memory: %s\n", strerror(errno));
+
+ if (((linuxInt10Priv *) pInt->private)->highMem >= 0) {
+ addr = shmat(((linuxInt10Priv *) pInt->private)->highMem,
+ (char *) HIGH_MEM, 0);
+ if (addr == SHMERRORPTR) {
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "Cannot shmat() high memory\n");
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "shmget error: %s\n", strerror(errno));
+ return FALSE;
+ }
+ if (mprotect((void *) HIGH_MEM, HIGH_MEM_SIZE,
+ PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "Cannot set EXEC bit on high memory: %s\n",
+ strerror(errno));
}
-
+ else {
+ if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
+ if (mmap((void *) (V_BIOS), SYS_BIOS - V_BIOS,
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_SHARED | MAP_FIXED, fd, V_BIOS)
+ == MAP_FAILED) {
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot map V_BIOS\n");
+ close(fd);
+ return FALSE;
+ }
+ }
+ else {
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot open %s\n", DEV_MEM);
+ return FALSE;
+ }
+ close(fd);
+ }
+
return TRUE;
}
@@ -376,27 +383,27 @@ void
xf86FreeInt10(xf86Int10InfoPtr pInt)
{
if (!pInt)
- return;
+ return;
#ifdef _PC
- xf86Int10SaveRestoreBIOSVars(pInt, FALSE);
+ xf86Int10SaveRestoreBIOSVars(pInt, FALSE);
#endif
if (Int10Current == pInt) {
- shmdt(0);
- if (((linuxInt10Priv*)pInt->private)->highMem >= 0)
- shmdt((char*)HIGH_MEM);
- else
- munmap((pointer)V_BIOS, (SYS_BIOS - V_BIOS));
- Int10Current = NULL;
+ shmdt(0);
+ if (((linuxInt10Priv *) pInt->private)->highMem >= 0)
+ shmdt((char *) HIGH_MEM);
+ else
+ munmap((pointer) V_BIOS, (SYS_BIOS - V_BIOS));
+ Int10Current = NULL;
}
-
- if (((linuxInt10Priv*)pInt->private)->base_high)
- shmdt(((linuxInt10Priv*)pInt->private)->base_high);
- shmdt(((linuxInt10Priv*)pInt->private)->base);
- shmctl(((linuxInt10Priv*)pInt->private)->lowMem, IPC_RMID, NULL);
- if (((linuxInt10Priv*)pInt->private)->highMem >= 0)
- shmctl(((linuxInt10Priv*)pInt->private)->highMem, IPC_RMID, NULL);
- free(((linuxInt10Priv*)pInt->private)->alloc);
+
+ if (((linuxInt10Priv *) pInt->private)->base_high)
+ shmdt(((linuxInt10Priv *) pInt->private)->base_high);
+ shmdt(((linuxInt10Priv *) pInt->private)->base);
+ shmctl(((linuxInt10Priv *) pInt->private)->lowMem, IPC_RMID, NULL);
+ if (((linuxInt10Priv *) pInt->private)->highMem >= 0)
+ shmctl(((linuxInt10Priv *) pInt->private)->highMem, IPC_RMID, NULL);
+ free(((linuxInt10Priv *) pInt->private)->alloc);
free(pInt->private);
free(pInt);
}
@@ -409,91 +416,93 @@ xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off)
int i, j;
for (i = 0; i < (num_pages - num); i++) {
- if (((linuxInt10Priv*)pInt->private)->alloc[i] == 0) {
- for (j = i; j < (num + i); j++)
- if ((((linuxInt10Priv*)pInt->private)->alloc[j] != 0))
- break;
- if (j == (num + i))
- break;
- else
- i = i + num;
- }
+ if (((linuxInt10Priv *) pInt->private)->alloc[i] == 0) {
+ for (j = i; j < (num + i); j++)
+ if ((((linuxInt10Priv *) pInt->private)->alloc[j] != 0))
+ break;
+ if (j == (num + i))
+ break;
+ else
+ i = i + num;
+ }
}
if (i == (num_pages - num))
- return NULL;
+ return NULL;
for (j = i; j < (i + num); j++)
- ((linuxInt10Priv*)pInt->private)->alloc[j] = 1;
+ ((linuxInt10Priv *) pInt->private)->alloc[j] = 1;
*off = (i + 1) * pagesize;
- return ((linuxInt10Priv*)pInt->private)->base + ((i + 1) * pagesize);
+ return ((linuxInt10Priv *) pInt->private)->base + ((i + 1) * pagesize);
}
void
xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
{
int pagesize = getpagesize();
- int first = (((unsigned long)pbase
- - (unsigned long)((linuxInt10Priv*)pInt->private)->base)
- / pagesize) - 1;
+ int first = (((unsigned long) pbase
+ - (unsigned long) ((linuxInt10Priv *) pInt->private)->base)
+ / pagesize) - 1;
int i;
for (i = first; i < (first + num); i++)
- ((linuxInt10Priv*)pInt->private)->alloc[i] = 0;
+ ((linuxInt10Priv *) pInt->private)->alloc[i] = 0;
}
static CARD8
read_b(xf86Int10InfoPtr pInt, int addr)
{
- return *((CARD8 *)(memType)addr);
+ return *((CARD8 *) (memType) addr);
}
static CARD16
read_w(xf86Int10InfoPtr pInt, int addr)
{
- return *((CARD16 *)(memType)addr);
+ return *((CARD16 *) (memType) addr);
}
static CARD32
read_l(xf86Int10InfoPtr pInt, int addr)
{
- return *((CARD32 *)(memType)addr);
+ return *((CARD32 *) (memType) addr);
}
static void
write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val)
{
- *((CARD8 *)(memType)addr) = val;
+ *((CARD8 *) (memType) addr) = val;
}
static void
write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val)
{
- *((CARD16 *)(memType)addr) = val;
+ *((CARD16 *) (memType) addr) = val;
}
static
-void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val)
+ void
+write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val)
{
- *((CARD32 *)(memType) addr) = val;
+ *((CARD32 *) (memType) addr) = val;
}
pointer
xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr)
{
if (addr < V_RAM)
- return ((linuxInt10Priv*)pInt->private)->base + addr;
+ return ((linuxInt10Priv *) pInt->private)->base + addr;
else if (addr < V_BIOS)
- return (pointer)(memType)addr;
+ return (pointer) (memType) addr;
else if (addr < SYS_BIOS) {
- if (((linuxInt10Priv*)pInt->private)->base_high)
- return (pointer)(((linuxInt10Priv*)pInt->private)->base_high
- - V_BIOS + addr);
- else
- return (pointer) (memType)addr;
- } else
- return (pointer) (memType)addr;
+ if (((linuxInt10Priv *) pInt->private)->base_high)
+ return (pointer) (((linuxInt10Priv *) pInt->private)->base_high
+ - V_BIOS + addr);
+ else
+ return (pointer) (memType) addr;
+ }
+ else
+ return (pointer) (memType) addr;
}
#if defined DoSubModules
@@ -507,20 +516,17 @@ vm86_tst(void)
/* When compiling with -fPIC, we can't use asm constraint "b" because
%ebx is already taken by gcc. */
__asm__ __volatile__("pushl %%ebx\n\t"
- "movl %2,%%ebx\n\t"
- "movl %1,%%eax\n\t"
- "int $0x80\n\t"
- "popl %%ebx"
- :"=a" (__res)
- :"n" ((int)113), "r" (NULL));
+ "movl %2,%%ebx\n\t"
+ "movl %1,%%eax\n\t"
+ "int $0x80\n\t" "popl %%ebx":"=a"(__res)
+ :"n"((int) 113), "r"(NULL));
#else
- __asm__ __volatile__("int $0x80\n\t"
- :"=a" (__res):"a" ((int)113),
- "b" ((struct vm86_struct *)NULL));
+ __asm__ __volatile__("int $0x80\n\t":"=a"(__res):"a"((int) 113),
+ "b"((struct vm86_struct *) NULL));
#endif
- if (__res < 0 && __res == -ENOSYS)
- return FALSE;
+ if (__res < 0 && __res == -ENOSYS)
+ return FALSE;
return TRUE;
}
@@ -529,13 +535,13 @@ static Int10LinuxSubModuleState
int10LinuxLoadSubModule(ScrnInfoPtr pScrn)
{
if (vm86_tst()) {
- if (xf86LoadSubModule(pScrn,"vm86"))
- return INT10_LOADED_VM86;
- }
- if (xf86LoadSubModule(pScrn,"x86emu"))
- return INT10_LOADED_X86EMU;
+ if (xf86LoadSubModule(pScrn, "vm86"))
+ return INT10_LOADED_VM86;
+ }
+ if (xf86LoadSubModule(pScrn, "x86emu"))
+ return INT10_LOADED_X86EMU;
return INT10_LOAD_FAILED;
}
-#endif /* DoSubModules */
+#endif /* DoSubModules */
diff --git a/xorg-server/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c b/xorg-server/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c
index 34afd9502..8502b21b7 100644
--- a/xorg-server/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c
+++ b/xorg-server/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c
@@ -25,7 +25,7 @@ xf86Int10ExecSetup(xf86Int10InfoPtr pInt)
{
#define VM86S ((struct vm86_struct *)pInt->cpuRegs)
- pInt->cpuRegs = &vm86_s;
+ pInt->cpuRegs = &vm86_s;
VM86S->flags = 0;
VM86S->screen_bitmap = 0;
VM86S->cpu_type = CPU_586;
@@ -58,137 +58,172 @@ vm86_GP_fault(xf86Int10InfoPtr pInt)
/* eat up prefixes */
done = 0;
do {
- switch (MEM_RB(pInt, (int)csp++)) {
- case 0x66: /* operand prefix */ prefix66=1; break;
- case 0x67: /* address prefix */ prefix67=1; break;
- case 0x2e: /* CS */ pref_seg=X86_CS; break;
- case 0x3e: /* DS */ pref_seg=X86_DS; break;
- case 0x26: /* ES */ pref_seg=X86_ES; break;
- case 0x36: /* SS */ pref_seg=X86_SS; break;
- case 0x65: /* GS */ pref_seg=X86_GS; break;
- case 0x64: /* FS */ pref_seg=X86_FS; break;
- case 0xf0: /* lock */ break;
- case 0xf2: /* repnz */
- case 0xf3: /* rep */ is_rep=1; break;
- default: done=1;
- }
+ switch (MEM_RB(pInt, (int) csp++)) {
+ case 0x66: /* operand prefix */
+ prefix66 = 1;
+ break;
+ case 0x67: /* address prefix */
+ prefix67 = 1;
+ break;
+ case 0x2e: /* CS */
+ pref_seg = X86_CS;
+ break;
+ case 0x3e: /* DS */
+ pref_seg = X86_DS;
+ break;
+ case 0x26: /* ES */
+ pref_seg = X86_ES;
+ break;
+ case 0x36: /* SS */
+ pref_seg = X86_SS;
+ break;
+ case 0x65: /* GS */
+ pref_seg = X86_GS;
+ break;
+ case 0x64: /* FS */
+ pref_seg = X86_FS;
+ break;
+ case 0xf0: /* lock */
+ break;
+ case 0xf2: /* repnz */
+ case 0xf3: /* rep */
+ is_rep = 1;
+ break;
+ default:
+ done = 1;
+ }
} while (!done);
- csp--; /* oops one too many */
+ csp--; /* oops one too many */
org_eip = X86_EIP;
X86_IP += (csp - lina);
- switch (MEM_RB(pInt, (int)csp)) {
- case 0x6c: /* insb */
- /* NOTE: ES can't be overwritten; prefixes 66,67 should use esi,edi,ecx
- * but is anyone using extended regs in real mode? */
- /* WARNING: no test for DI wrapping! */
- X86_EDI += port_rep_inb(pInt, X86_DX, SEG_EADR((CARD32), X86_ES, DI),
- X86_FLAGS & DF, is_rep ? LWECX : 1);
- if (is_rep) LWECX_ZERO;
- X86_IP++;
- break;
-
- case 0x6d: /* (rep) insw / insd */
- /* NOTE: ES can't be overwritten */
- /* WARNING: no test for _DI wrapping! */
- if (prefix66) {
- X86_DI += port_rep_inl(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI),
- X86_EFLAGS & DF, is_rep ? LWECX : 1);
- }
- else {
- X86_DI += port_rep_inw(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI),
- X86_FLAGS & DF, is_rep ? LWECX : 1);
- }
- if (is_rep) LWECX_ZERO;
- X86_IP++;
- break;
-
- case 0x6e: /* (rep) outsb */
- if (pref_seg < 0) pref_seg = X86_DS;
- /* WARNING: no test for _SI wrapping! */
- X86_SI += port_rep_outb(pInt, X86_DX, (CARD32)LIN_PREF_SI,
- X86_FLAGS & DF, is_rep ? LWECX : 1);
- if (is_rep) LWECX_ZERO;
- X86_IP++;
- break;
-
- case 0x6f: /* (rep) outsw / outsd */
- if (pref_seg < 0) pref_seg = X86_DS;
- /* WARNING: no test for _SI wrapping! */
- if (prefix66) {
- X86_SI += port_rep_outl(pInt, X86_DX, (CARD32)LIN_PREF_SI,
- X86_EFLAGS & DF, is_rep ? LWECX : 1);
- }
- else {
- X86_SI += port_rep_outw(pInt, X86_DX, (CARD32)LIN_PREF_SI,
- X86_FLAGS & DF, is_rep ? LWECX : 1);
- }
- if (is_rep) LWECX_ZERO;
- X86_IP++;
- break;
-
- case 0xe5: /* inw xx, inl xx */
- if (prefix66) X86_EAX = x_inl(csp[1]);
- else X86_AX = x_inw(csp[1]);
- X86_IP += 2;
- break;
-
- case 0xe4: /* inb xx */
- X86_AL = x_inb(csp[1]);
- X86_IP += 2;
- break;
-
- case 0xed: /* inw dx, inl dx */
- if (prefix66) X86_EAX = x_inl(X86_DX);
- else X86_AX = x_inw(X86_DX);
- X86_IP += 1;
- break;
-
- case 0xec: /* inb dx */
- X86_AL = x_inb(X86_DX);
- X86_IP += 1;
- break;
-
- case 0xe7: /* outw xx */
- if (prefix66) x_outl(csp[1], X86_EAX);
- else x_outw(csp[1], X86_AX);
- X86_IP += 2;
- break;
-
- case 0xe6: /* outb xx */
- x_outb(csp[1], X86_AL);
- X86_IP += 2;
- break;
-
- case 0xef: /* outw dx */
- if (prefix66) x_outl(X86_DX, X86_EAX);
- else x_outw(X86_DX, X86_AX);
- X86_IP += 1;
- break;
-
- case 0xee: /* outb dx */
- x_outb(X86_DX, X86_AL);
- X86_IP += 1;
- break;
+ switch (MEM_RB(pInt, (int) csp)) {
+ case 0x6c: /* insb */
+ /* NOTE: ES can't be overwritten; prefixes 66,67 should use esi,edi,ecx
+ * but is anyone using extended regs in real mode? */
+ /* WARNING: no test for DI wrapping! */
+ X86_EDI += port_rep_inb(pInt, X86_DX, SEG_EADR((CARD32), X86_ES, DI),
+ X86_FLAGS & DF, is_rep ? LWECX : 1);
+ if (is_rep)
+ LWECX_ZERO;
+ X86_IP++;
+ break;
+
+ case 0x6d: /* (rep) insw / insd */
+ /* NOTE: ES can't be overwritten */
+ /* WARNING: no test for _DI wrapping! */
+ if (prefix66) {
+ X86_DI += port_rep_inl(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI),
+ X86_EFLAGS & DF, is_rep ? LWECX : 1);
+ }
+ else {
+ X86_DI += port_rep_inw(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI),
+ X86_FLAGS & DF, is_rep ? LWECX : 1);
+ }
+ if (is_rep)
+ LWECX_ZERO;
+ X86_IP++;
+ break;
+
+ case 0x6e: /* (rep) outsb */
+ if (pref_seg < 0)
+ pref_seg = X86_DS;
+ /* WARNING: no test for _SI wrapping! */
+ X86_SI += port_rep_outb(pInt, X86_DX, (CARD32) LIN_PREF_SI,
+ X86_FLAGS & DF, is_rep ? LWECX : 1);
+ if (is_rep)
+ LWECX_ZERO;
+ X86_IP++;
+ break;
+
+ case 0x6f: /* (rep) outsw / outsd */
+ if (pref_seg < 0)
+ pref_seg = X86_DS;
+ /* WARNING: no test for _SI wrapping! */
+ if (prefix66) {
+ X86_SI += port_rep_outl(pInt, X86_DX, (CARD32) LIN_PREF_SI,
+ X86_EFLAGS & DF, is_rep ? LWECX : 1);
+ }
+ else {
+ X86_SI += port_rep_outw(pInt, X86_DX, (CARD32) LIN_PREF_SI,
+ X86_FLAGS & DF, is_rep ? LWECX : 1);
+ }
+ if (is_rep)
+ LWECX_ZERO;
+ X86_IP++;
+ break;
+
+ case 0xe5: /* inw xx, inl xx */
+ if (prefix66)
+ X86_EAX = x_inl(csp[1]);
+ else
+ X86_AX = x_inw(csp[1]);
+ X86_IP += 2;
+ break;
+
+ case 0xe4: /* inb xx */
+ X86_AL = x_inb(csp[1]);
+ X86_IP += 2;
+ break;
+
+ case 0xed: /* inw dx, inl dx */
+ if (prefix66)
+ X86_EAX = x_inl(X86_DX);
+ else
+ X86_AX = x_inw(X86_DX);
+ X86_IP += 1;
+ break;
+
+ case 0xec: /* inb dx */
+ X86_AL = x_inb(X86_DX);
+ X86_IP += 1;
+ break;
+
+ case 0xe7: /* outw xx */
+ if (prefix66)
+ x_outl(csp[1], X86_EAX);
+ else
+ x_outw(csp[1], X86_AX);
+ X86_IP += 2;
+ break;
+
+ case 0xe6: /* outb xx */
+ x_outb(csp[1], X86_AL);
+ X86_IP += 2;
+ break;
+
+ case 0xef: /* outw dx */
+ if (prefix66)
+ x_outl(X86_DX, X86_EAX);
+ else
+ x_outw(X86_DX, X86_AX);
+ X86_IP += 1;
+ break;
+
+ case 0xee: /* outb dx */
+ x_outb(X86_DX, X86_AL);
+ X86_IP += 1;
+ break;
case 0xf4:
- DebugF("hlt at %p\n", lina);
- return FALSE;
+ DebugF("hlt at %p\n", lina);
+ return FALSE;
case 0x0f:
- xf86DrvMsg(pInt->scrnIndex, X_ERROR,
- "CPU 0x0f Trap at CS:EIP=0x%4.4x:0x%8.8lx\n", X86_CS, X86_EIP);
- goto op0ferr;
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "CPU 0x0f Trap at CS:EIP=0x%4.4x:0x%8.8lx\n", X86_CS,
+ X86_EIP);
+ goto op0ferr;
default:
- xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown reason for exception\n");
-
- op0ferr:
- dump_registers(pInt);
- stack_trace(pInt);
- dump_code(pInt);
- xf86DrvMsg(pInt->scrnIndex, X_ERROR, "cannot continue\n");
- return FALSE;
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown reason for exception\n");
+
+ op0ferr:
+ dump_registers(pInt);
+ stack_trace(pInt);
+ dump_code(pInt);
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "cannot continue\n");
+ return FALSE;
} /* end of switch() */
return TRUE;
}
@@ -203,51 +238,52 @@ do_vm86(xf86Int10InfoPtr pInt)
xf86InterceptSignals(NULL);
if (signo >= 0) {
- xf86DrvMsg(pInt->scrnIndex, X_ERROR,
- "vm86() syscall generated signal %d.\n", signo);
- dump_registers(pInt);
- dump_code(pInt);
- stack_trace(pInt);
- return 0;
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "vm86() syscall generated signal %d.\n", signo);
+ dump_registers(pInt);
+ dump_code(pInt);
+ stack_trace(pInt);
+ return 0;
}
switch (VM86_TYPE(retval)) {
case VM86_UNKNOWN:
- if (!vm86_GP_fault(pInt)) return 0;
- break;
+ if (!vm86_GP_fault(pInt))
+ return 0;
+ break;
case VM86_STI:
- xf86DrvMsg(pInt->scrnIndex, X_ERROR, "vm86_sti :-((\n");
- dump_registers(pInt);
- dump_code(pInt);
- stack_trace(pInt);
- return 0;
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "vm86_sti :-((\n");
+ dump_registers(pInt);
+ dump_code(pInt);
+ stack_trace(pInt);
+ return 0;
case VM86_INTx:
- pInt->num = VM86_ARG(retval);
- if (!int_handler(pInt)) {
- xf86DrvMsg(pInt->scrnIndex, X_ERROR,
- "Unknown vm86_int: 0x%X\n\n", VM86_ARG(retval));
- dump_registers(pInt);
- dump_code(pInt);
- stack_trace(pInt);
- return 0;
- }
- /* I'm not sure yet what to do if we can handle ints */
- break;
+ pInt->num = VM86_ARG(retval);
+ if (!int_handler(pInt)) {
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+ "Unknown vm86_int: 0x%X\n\n", VM86_ARG(retval));
+ dump_registers(pInt);
+ dump_code(pInt);
+ stack_trace(pInt);
+ return 0;
+ }
+ /* I'm not sure yet what to do if we can handle ints */
+ break;
case VM86_SIGNAL:
- return 1;
- /*
- * we used to warn here and bail out - but now the sigio stuff
- * always fires signals at us. So we just ignore them for now.
- */
- xf86DrvMsg(pInt->scrnIndex, X_WARNING, "received signal\n");
- return 0;
+ return 1;
+ /*
+ * we used to warn here and bail out - but now the sigio stuff
+ * always fires signals at us. So we just ignore them for now.
+ */
+ xf86DrvMsg(pInt->scrnIndex, X_WARNING, "received signal\n");
+ return 0;
default:
- xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown type(0x%x)=0x%x\n",
- VM86_ARG(retval), VM86_TYPE(retval));
- dump_registers(pInt);
- dump_code(pInt);
- stack_trace(pInt);
- return 0;
+ xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown type(0x%x)=0x%x\n",
+ VM86_ARG(retval), VM86_TYPE(retval));
+ dump_registers(pInt);
+ dump_code(pInt);
+ stack_trace(pInt);
+ return 0;
}
return 1;
@@ -259,7 +295,8 @@ xf86ExecX86int10(xf86Int10InfoPtr pInt)
int sig = setup_int(pInt);
if (int_handler(pInt))
- while(do_vm86(pInt)) {};
+ while (do_vm86(pInt)) {
+ };
finish_int(pInt, sig);
}
@@ -273,28 +310,25 @@ vm86_rep(struct vm86_struct *ptr)
/* When compiling with -fPIC, we can't use asm constraint "b" because
%ebx is already taken by gcc. */
__asm__ __volatile__("pushl %%ebx\n\t"
- "push %%gs\n\t"
- "movl %2,%%ebx\n\t"
- "movl %1,%%eax\n\t"
- "int $0x80\n\t"
- "pop %%gs\n\t"
- "popl %%ebx"
- :"=a" (__res)
- :"n" ((int)113), "r" ((struct vm86_struct *)ptr));
+ "push %%gs\n\t"
+ "movl %2,%%ebx\n\t"
+ "movl %1,%%eax\n\t"
+ "int $0x80\n\t" "pop %%gs\n\t" "popl %%ebx":"=a"(__res)
+ :"n"((int) 113), "r"((struct vm86_struct *) ptr));
#else
__asm__ __volatile__("push %%gs\n\t"
- "int $0x80\n\t"
- "pop %%gs"
- :"=a" (__res):"a" ((int)113),
- "b" ((struct vm86_struct *)ptr));
+ "int $0x80\n\t"
+ "pop %%gs":"=a"(__res):"a"((int) 113),
+ "b"((struct vm86_struct *) ptr));
#endif
- if (__res < 0) {
- errno = -__res;
- __res = -1;
- }
- else errno = 0;
- return __res;
+ if (__res < 0) {
+ errno = -__res;
+ __res = -1;
+ }
+ else
+ errno = 0;
+ return __res;
}
#endif
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_agp.c b/xorg-server/hw/xfree86/os-support/linux/lnx_agp.c
index dcc878060..e1fa3f8a7 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_agp.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_agp.c
@@ -1,374 +1,371 @@
-/*
- * Abstraction of the AGP GART interface.
- *
- * This version is for Linux and Free/Open/NetBSD.
- *
- * Copyright © 2000 VA Linux Systems, Inc.
- * Copyright © 2001 The XFree86 Project, Inc.
- */
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86OSpriv.h"
-
-#if defined(linux)
-#include <asm/ioctl.h>
-#include <linux/agpgart.h>
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
-#include <sys/ioctl.h>
-#include <sys/agpio.h>
-#endif
-
-#ifndef AGP_DEVICE
-#define AGP_DEVICE "/dev/agpgart"
-#endif
-/* AGP page size is independent of the host page size. */
-#ifndef AGP_PAGE_SIZE
-#define AGP_PAGE_SIZE 4096
-#endif
-#define AGPGART_MAJOR_VERSION 0
-#define AGPGART_MINOR_VERSION 99
-
-static int gartFd = -1;
-static int acquiredScreen = -1;
-static Bool initDone = FALSE;
-/*
- * Close /dev/agpgart. This frees all associated memory allocated during
- * this server generation.
- */
-Bool
-xf86GARTCloseScreen(int screenNum)
-{
- if(gartFd != -1) {
- close(gartFd);
- acquiredScreen = -1;
- gartFd = -1;
- initDone = FALSE;
- }
- return TRUE;
-}
-
-/*
- * Open /dev/agpgart. Keep it open until xf86GARTCloseScreen is called.
- */
-static Bool
-GARTInit(int screenNum)
-{
- struct _agp_info agpinf;
-
- if (initDone)
- return gartFd != -1;
-
- initDone = TRUE;
-
- if (gartFd == -1)
- gartFd = open(AGP_DEVICE, O_RDWR, 0);
- else
- return FALSE;
-
- if (gartFd == -1) {
- xf86DrvMsg(screenNum, X_ERROR,
- "GARTInit: Unable to open " AGP_DEVICE " (%s)\n",
- strerror(errno));
- return FALSE;
- }
-
- xf86AcquireGART(-1);
- /* Check the kernel driver version. */
- if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) {
- xf86DrvMsg(screenNum, X_ERROR,
- "GARTInit: AGPIOC_INFO failed (%s)\n", strerror(errno));
- close(gartFd);
- gartFd = -1;
- return FALSE;
- }
- xf86ReleaseGART(-1);
-
-#if defined(linux)
- /* Per Dave Jones, every effort will be made to keep the
- * agpgart interface backwards compatible, so allow all
- * future versions.
- */
- if (
-#if (AGPGART_MAJOR_VERSION > 0) /* quiet compiler */
- agpinf.version.major < AGPGART_MAJOR_VERSION ||
-#endif
- (agpinf.version.major == AGPGART_MAJOR_VERSION &&
- agpinf.version.minor < AGPGART_MINOR_VERSION)) {
- xf86DrvMsg(screenNum, X_ERROR,
- "GARTInit: Kernel agpgart driver version is not current"
- " (%d.%d vs %d.%d)\n",
- agpinf.version.major, agpinf.version.minor,
- AGPGART_MAJOR_VERSION, AGPGART_MINOR_VERSION);
- close(gartFd);
- gartFd = -1;
- return FALSE;
- }
-#endif
-
- return TRUE;
-}
-
-Bool
-xf86AgpGARTSupported(void)
-{
- return GARTInit(-1);
-}
-
-AgpInfoPtr
-xf86GetAGPInfo(int screenNum)
-{
- struct _agp_info agpinf;
- AgpInfoPtr info;
-
- if (!GARTInit(screenNum))
- return NULL;
-
-
- if ((info = calloc(sizeof(AgpInfo), 1)) == NULL) {
- xf86DrvMsg(screenNum, X_ERROR,
- "xf86GetAGPInfo: Failed to allocate AgpInfo\n");
- return NULL;
- }
-
- memset((char*)&agpinf, 0, sizeof(agpinf));
-
- if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) {
- xf86DrvMsg(screenNum, X_ERROR,
- "xf86GetAGPInfo: AGPIOC_INFO failed (%s)\n",
- strerror(errno));
- return NULL;
- }
-
- info->bridgeId = agpinf.bridge_id;
- info->agpMode = agpinf.agp_mode;
- info->base = agpinf.aper_base;
- info->size = agpinf.aper_size;
- info->totalPages = agpinf.pg_total;
- info->systemPages = agpinf.pg_system;
- info->usedPages = agpinf.pg_used;
-
- xf86DrvMsg(screenNum, X_INFO, "Kernel reported %zu total, %zu used\n", agpinf.pg_total, agpinf.pg_used);
-
- return info;
-}
-
-/*
- * XXX If multiple screens can acquire the GART, should we have a reference
- * count instead of using acquiredScreen?
- */
-
-Bool
-xf86AcquireGART(int screenNum)
-{
- if (screenNum != -1 && !GARTInit(screenNum))
- return FALSE;
-
- if (screenNum == -1 || acquiredScreen != screenNum) {
- if (ioctl(gartFd, AGPIOC_ACQUIRE, 0) != 0) {
- xf86DrvMsg(screenNum, X_WARNING,
- "xf86AcquireGART: AGPIOC_ACQUIRE failed (%s)\n",
- strerror(errno));
- return FALSE;
- }
- acquiredScreen = screenNum;
- }
- return TRUE;
-}
-
-Bool
-xf86ReleaseGART(int screenNum)
-{
- if (screenNum != -1 && !GARTInit(screenNum))
- return FALSE;
-
- if (acquiredScreen == screenNum) {
- /*
- * The FreeBSD agp driver removes allocations on release.
- * The Linux driver doesn't. xf86ReleaseGART() is expected
- * to give up access to the GART, but not to remove any
- * allocations.
- */
-#if !defined(linux)
- if (screenNum == -1)
-#endif
- {
- if (ioctl(gartFd, AGPIOC_RELEASE, 0) != 0) {
- xf86DrvMsg(screenNum, X_WARNING,
- "xf86ReleaseGART: AGPIOC_RELEASE failed (%s)\n",
- strerror(errno));
- return FALSE;
- }
- acquiredScreen = -1;
- }
- return TRUE;
- }
- return FALSE;
-}
-
-int
-xf86AllocateGARTMemory(int screenNum, unsigned long size, int type,
- unsigned long *physical)
-{
- struct _agp_allocate alloc;
- int pages;
-
- /*
- * Allocates "size" bytes of GART memory (rounds up to the next
- * page multiple) or type "type". A handle (key) for the allocated
- * memory is returned. On error, the return value is -1.
- */
-
- if (!GARTInit(screenNum) || acquiredScreen != screenNum)
- return -1;
-
- pages = (size / AGP_PAGE_SIZE);
- if (size % AGP_PAGE_SIZE != 0)
- pages++;
-
- /* XXX check for pages == 0? */
-
- alloc.pg_count = pages;
- alloc.type = type;
-
- if (ioctl(gartFd, AGPIOC_ALLOCATE, &alloc) != 0) {
- xf86DrvMsg(screenNum, X_WARNING, "xf86AllocateGARTMemory: "
- "allocation of %d pages failed\n\t(%s)\n", pages,
- strerror(errno));
- return -1;
- }
-
- if (physical)
- *physical = alloc.physical;
-
- return alloc.key;
-}
-
-Bool
-xf86DeallocateGARTMemory(int screenNum, int key)
-{
- if (!GARTInit(screenNum) || acquiredScreen != screenNum)
- return FALSE;
-
- if (acquiredScreen != screenNum) {
- xf86DrvMsg(screenNum, X_ERROR,
- "xf86UnbindGARTMemory: AGP not acquired by this screen\n");
- return FALSE;
- }
-
-#ifdef __linux__
- if (ioctl(gartFd, AGPIOC_DEALLOCATE, (int *)(uintptr_t)key) != 0) {
-#else
- if (ioctl(gartFd, AGPIOC_DEALLOCATE, &key) != 0) {
-#endif
- xf86DrvMsg(screenNum, X_WARNING,"xf86DeAllocateGARTMemory: "
- "deallocation gart memory with key %d failed\n\t(%s)\n",
- key, strerror(errno));
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Bind GART memory with "key" at "offset" */
-Bool
-xf86BindGARTMemory(int screenNum, int key, unsigned long offset)
-{
- struct _agp_bind bind;
- int pageOffset;
-
- if (!GARTInit(screenNum) || acquiredScreen != screenNum)
- return FALSE;
-
- if (acquiredScreen != screenNum) {
- xf86DrvMsg(screenNum, X_ERROR,
- "xf86BindGARTMemory: AGP not acquired by this screen\n");
- return FALSE;
- }
-
- if (offset % AGP_PAGE_SIZE != 0) {
- xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: "
- "offset (0x%lx) is not page-aligned (%d)\n",
- offset, AGP_PAGE_SIZE);
- return FALSE;
- }
- pageOffset = offset / AGP_PAGE_SIZE;
-
- xf86DrvMsgVerb(screenNum, X_INFO, 3,
- "xf86BindGARTMemory: bind key %d at 0x%08lx "
- "(pgoffset %d)\n", key, offset, pageOffset);
-
- bind.pg_start = pageOffset;
- bind.key = key;
-
- if (ioctl(gartFd, AGPIOC_BIND, &bind) != 0) {
- xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: "
- "binding of gart memory with key %d\n"
- "\tat offset 0x%lx failed (%s)\n",
- key, offset, strerror(errno));
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/* Unbind GART memory with "key" */
-Bool
-xf86UnbindGARTMemory(int screenNum, int key)
-{
- struct _agp_unbind unbind;
-
- if (!GARTInit(screenNum) || acquiredScreen != screenNum)
- return FALSE;
-
- if (acquiredScreen != screenNum) {
- xf86DrvMsg(screenNum, X_ERROR,
- "xf86UnbindGARTMemory: AGP not acquired by this screen\n");
- return FALSE;
- }
-
- unbind.priority = 0;
- unbind.key = key;
-
- if (ioctl(gartFd, AGPIOC_UNBIND, &unbind) != 0) {
- xf86DrvMsg(screenNum, X_WARNING, "xf86UnbindGARTMemory: "
- "unbinding of gart memory with key %d "
- "failed (%s)\n", key, strerror(errno));
- return FALSE;
- }
-
- xf86DrvMsgVerb(screenNum, X_INFO, 3,
- "xf86UnbindGARTMemory: unbind key %d\n", key);
-
- return TRUE;
-}
-
-
-/* XXX Interface may change. */
-Bool
-xf86EnableAGP(int screenNum, CARD32 mode)
-{
- agp_setup setup;
-
- if (!GARTInit(screenNum) || acquiredScreen != screenNum)
- return FALSE;
-
- setup.agp_mode = mode;
- if (ioctl(gartFd, AGPIOC_SETUP, &setup) != 0) {
- xf86DrvMsg(screenNum, X_WARNING, "xf86EnableAGP: "
- "AGPIOC_SETUP with mode %ld failed (%s)\n",
- (unsigned long)mode, strerror(errno));
- return FALSE;
- }
-
- return TRUE;
-}
-
+/*
+ * Abstraction of the AGP GART interface.
+ *
+ * This version is for Linux and Free/Open/NetBSD.
+ *
+ * Copyright © 2000 VA Linux Systems, Inc.
+ * Copyright © 2001 The XFree86 Project, Inc.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+#include "xf86OSpriv.h"
+
+#if defined(linux)
+#include <asm/ioctl.h>
+#include <linux/agpgart.h>
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+#include <sys/ioctl.h>
+#include <sys/agpio.h>
+#endif
+
+#ifndef AGP_DEVICE
+#define AGP_DEVICE "/dev/agpgart"
+#endif
+/* AGP page size is independent of the host page size. */
+#ifndef AGP_PAGE_SIZE
+#define AGP_PAGE_SIZE 4096
+#endif
+#define AGPGART_MAJOR_VERSION 0
+#define AGPGART_MINOR_VERSION 99
+
+static int gartFd = -1;
+static int acquiredScreen = -1;
+static Bool initDone = FALSE;
+
+/*
+ * Close /dev/agpgart. This frees all associated memory allocated during
+ * this server generation.
+ */
+Bool
+xf86GARTCloseScreen(int screenNum)
+{
+ if (gartFd != -1) {
+ close(gartFd);
+ acquiredScreen = -1;
+ gartFd = -1;
+ initDone = FALSE;
+ }
+ return TRUE;
+}
+
+/*
+ * Open /dev/agpgart. Keep it open until xf86GARTCloseScreen is called.
+ */
+static Bool
+GARTInit(int screenNum)
+{
+ struct _agp_info agpinf;
+
+ if (initDone)
+ return gartFd != -1;
+
+ initDone = TRUE;
+
+ if (gartFd == -1)
+ gartFd = open(AGP_DEVICE, O_RDWR, 0);
+ else
+ return FALSE;
+
+ if (gartFd == -1) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "GARTInit: Unable to open " AGP_DEVICE " (%s)\n",
+ strerror(errno));
+ return FALSE;
+ }
+
+ xf86AcquireGART(-1);
+ /* Check the kernel driver version. */
+ if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "GARTInit: AGPIOC_INFO failed (%s)\n", strerror(errno));
+ close(gartFd);
+ gartFd = -1;
+ return FALSE;
+ }
+ xf86ReleaseGART(-1);
+
+#if defined(linux)
+ /* Per Dave Jones, every effort will be made to keep the
+ * agpgart interface backwards compatible, so allow all
+ * future versions.
+ */
+ if (
+#if (AGPGART_MAJOR_VERSION > 0) /* quiet compiler */
+ agpinf.version.major < AGPGART_MAJOR_VERSION ||
+#endif
+ (agpinf.version.major == AGPGART_MAJOR_VERSION &&
+ agpinf.version.minor < AGPGART_MINOR_VERSION)) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "GARTInit: Kernel agpgart driver version is not current"
+ " (%d.%d vs %d.%d)\n",
+ agpinf.version.major, agpinf.version.minor,
+ AGPGART_MAJOR_VERSION, AGPGART_MINOR_VERSION);
+ close(gartFd);
+ gartFd = -1;
+ return FALSE;
+ }
+#endif
+
+ return TRUE;
+}
+
+Bool
+xf86AgpGARTSupported(void)
+{
+ return GARTInit(-1);
+}
+
+AgpInfoPtr
+xf86GetAGPInfo(int screenNum)
+{
+ struct _agp_info agpinf;
+ AgpInfoPtr info;
+
+ if (!GARTInit(screenNum))
+ return NULL;
+
+ if ((info = calloc(sizeof(AgpInfo), 1)) == NULL) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "xf86GetAGPInfo: Failed to allocate AgpInfo\n");
+ return NULL;
+ }
+
+ memset((char *) &agpinf, 0, sizeof(agpinf));
+
+ if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "xf86GetAGPInfo: AGPIOC_INFO failed (%s)\n",
+ strerror(errno));
+ return NULL;
+ }
+
+ info->bridgeId = agpinf.bridge_id;
+ info->agpMode = agpinf.agp_mode;
+ info->base = agpinf.aper_base;
+ info->size = agpinf.aper_size;
+ info->totalPages = agpinf.pg_total;
+ info->systemPages = agpinf.pg_system;
+ info->usedPages = agpinf.pg_used;
+
+ xf86DrvMsg(screenNum, X_INFO, "Kernel reported %zu total, %zu used\n",
+ agpinf.pg_total, agpinf.pg_used);
+
+ return info;
+}
+
+/*
+ * XXX If multiple screens can acquire the GART, should we have a reference
+ * count instead of using acquiredScreen?
+ */
+
+Bool
+xf86AcquireGART(int screenNum)
+{
+ if (screenNum != -1 && !GARTInit(screenNum))
+ return FALSE;
+
+ if (screenNum == -1 || acquiredScreen != screenNum) {
+ if (ioctl(gartFd, AGPIOC_ACQUIRE, 0) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "xf86AcquireGART: AGPIOC_ACQUIRE failed (%s)\n",
+ strerror(errno));
+ return FALSE;
+ }
+ acquiredScreen = screenNum;
+ }
+ return TRUE;
+}
+
+Bool
+xf86ReleaseGART(int screenNum)
+{
+ if (screenNum != -1 && !GARTInit(screenNum))
+ return FALSE;
+
+ if (acquiredScreen == screenNum) {
+ /*
+ * The FreeBSD agp driver removes allocations on release.
+ * The Linux driver doesn't. xf86ReleaseGART() is expected
+ * to give up access to the GART, but not to remove any
+ * allocations.
+ */
+#if !defined(linux)
+ if (screenNum == -1)
+#endif
+ {
+ if (ioctl(gartFd, AGPIOC_RELEASE, 0) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING,
+ "xf86ReleaseGART: AGPIOC_RELEASE failed (%s)\n",
+ strerror(errno));
+ return FALSE;
+ }
+ acquiredScreen = -1;
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+int
+xf86AllocateGARTMemory(int screenNum, unsigned long size, int type,
+ unsigned long *physical)
+{
+ struct _agp_allocate alloc;
+ int pages;
+
+ /*
+ * Allocates "size" bytes of GART memory (rounds up to the next
+ * page multiple) or type "type". A handle (key) for the allocated
+ * memory is returned. On error, the return value is -1.
+ */
+
+ if (!GARTInit(screenNum) || acquiredScreen != screenNum)
+ return -1;
+
+ pages = (size / AGP_PAGE_SIZE);
+ if (size % AGP_PAGE_SIZE != 0)
+ pages++;
+
+ /* XXX check for pages == 0? */
+
+ alloc.pg_count = pages;
+ alloc.type = type;
+
+ if (ioctl(gartFd, AGPIOC_ALLOCATE, &alloc) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86AllocateGARTMemory: "
+ "allocation of %d pages failed\n\t(%s)\n", pages,
+ strerror(errno));
+ return -1;
+ }
+
+ if (physical)
+ *physical = alloc.physical;
+
+ return alloc.key;
+}
+
+Bool
+xf86DeallocateGARTMemory(int screenNum, int key)
+{
+ if (!GARTInit(screenNum) || acquiredScreen != screenNum)
+ return FALSE;
+
+ if (acquiredScreen != screenNum) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "xf86UnbindGARTMemory: AGP not acquired by this screen\n");
+ return FALSE;
+ }
+
+#ifdef __linux__
+ if (ioctl(gartFd, AGPIOC_DEALLOCATE, (int *) (uintptr_t) key) != 0) {
+#else
+ if (ioctl(gartFd, AGPIOC_DEALLOCATE, &key) != 0) {
+#endif
+ xf86DrvMsg(screenNum, X_WARNING, "xf86DeAllocateGARTMemory: "
+ "deallocation gart memory with key %d failed\n\t(%s)\n",
+ key, strerror(errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* Bind GART memory with "key" at "offset" */
+Bool
+xf86BindGARTMemory(int screenNum, int key, unsigned long offset)
+{
+ struct _agp_bind bind;
+ int pageOffset;
+
+ if (!GARTInit(screenNum) || acquiredScreen != screenNum)
+ return FALSE;
+
+ if (acquiredScreen != screenNum) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "xf86BindGARTMemory: AGP not acquired by this screen\n");
+ return FALSE;
+ }
+
+ if (offset % AGP_PAGE_SIZE != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: "
+ "offset (0x%lx) is not page-aligned (%d)\n",
+ offset, AGP_PAGE_SIZE);
+ return FALSE;
+ }
+ pageOffset = offset / AGP_PAGE_SIZE;
+
+ xf86DrvMsgVerb(screenNum, X_INFO, 3,
+ "xf86BindGARTMemory: bind key %d at 0x%08lx "
+ "(pgoffset %d)\n", key, offset, pageOffset);
+
+ bind.pg_start = pageOffset;
+ bind.key = key;
+
+ if (ioctl(gartFd, AGPIOC_BIND, &bind) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86BindGARTMemory: "
+ "binding of gart memory with key %d\n"
+ "\tat offset 0x%lx failed (%s)\n",
+ key, offset, strerror(errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* Unbind GART memory with "key" */
+Bool
+xf86UnbindGARTMemory(int screenNum, int key)
+{
+ struct _agp_unbind unbind;
+
+ if (!GARTInit(screenNum) || acquiredScreen != screenNum)
+ return FALSE;
+
+ if (acquiredScreen != screenNum) {
+ xf86DrvMsg(screenNum, X_ERROR,
+ "xf86UnbindGARTMemory: AGP not acquired by this screen\n");
+ return FALSE;
+ }
+
+ unbind.priority = 0;
+ unbind.key = key;
+
+ if (ioctl(gartFd, AGPIOC_UNBIND, &unbind) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86UnbindGARTMemory: "
+ "unbinding of gart memory with key %d "
+ "failed (%s)\n", key, strerror(errno));
+ return FALSE;
+ }
+
+ xf86DrvMsgVerb(screenNum, X_INFO, 3,
+ "xf86UnbindGARTMemory: unbind key %d\n", key);
+
+ return TRUE;
+}
+
+/* XXX Interface may change. */
+Bool
+xf86EnableAGP(int screenNum, CARD32 mode)
+{
+ agp_setup setup;
+
+ if (!GARTInit(screenNum) || acquiredScreen != screenNum)
+ return FALSE;
+
+ setup.agp_mode = mode;
+ if (ioctl(gartFd, AGPIOC_SETUP, &setup) != 0) {
+ xf86DrvMsg(screenNum, X_WARNING, "xf86EnableAGP: "
+ "AGPIOC_SETUP with mode %ld failed (%s)\n",
+ (unsigned long) mode, strerror(errno));
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_apm.c b/xorg-server/hw/xfree86/os-support/linux/lnx_apm.c
index 54c698965..a37331e52 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_apm.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_apm.c
@@ -23,15 +23,15 @@ extern PMClose lnxACPIOpen(void);
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
-
+
#define APM_PROC "/proc/apm"
#define APM_DEVICE "/dev/apm_bios"
#ifndef APM_STANDBY_FAILED
-# define APM_STANDBY_FAILED 0xf000
+#define APM_STANDBY_FAILED 0xf000
#endif
#ifndef APM_SUSPEND_FAILED
-# define APM_SUSPEND_FAILED 0xf001
+#define APM_SUSPEND_FAILED 0xf001
#endif
static PMClose lnxAPMOpen(void);
@@ -42,23 +42,26 @@ static struct {
apm_event_t apmLinux;
pmEvent xf86;
} LinuxToXF86[] = {
- { APM_SYS_STANDBY, XF86_APM_SYS_STANDBY },
- { APM_SYS_SUSPEND, XF86_APM_SYS_SUSPEND },
- { APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME },
- { APM_CRITICAL_RESUME, XF86_APM_CRITICAL_RESUME },
- { APM_LOW_BATTERY, XF86_APM_LOW_BATTERY },
- { APM_POWER_STATUS_CHANGE, XF86_APM_POWER_STATUS_CHANGE },
- { APM_UPDATE_TIME, XF86_APM_UPDATE_TIME },
- { APM_CRITICAL_SUSPEND, XF86_APM_CRITICAL_SUSPEND },
- { APM_USER_STANDBY, XF86_APM_USER_STANDBY },
- { APM_USER_SUSPEND, XF86_APM_USER_SUSPEND },
- { APM_STANDBY_RESUME, XF86_APM_STANDBY_RESUME },
+ {
+ APM_SYS_STANDBY, XF86_APM_SYS_STANDBY}, {
+ APM_SYS_SUSPEND, XF86_APM_SYS_SUSPEND}, {
+ APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, {
+ APM_CRITICAL_RESUME, XF86_APM_CRITICAL_RESUME}, {
+ APM_LOW_BATTERY, XF86_APM_LOW_BATTERY}, {
+ APM_POWER_STATUS_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, {
+ APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, {
+ APM_CRITICAL_SUSPEND, XF86_APM_CRITICAL_SUSPEND}, {
+ APM_USER_STANDBY, XF86_APM_USER_STANDBY}, {
+ APM_USER_SUSPEND, XF86_APM_USER_SUSPEND}, {
+ APM_STANDBY_RESUME, XF86_APM_STANDBY_RESUME},
#if defined(APM_CAPABILITY_CHANGED)
- { APM_CAPABILITY_CHANGED, XF86_CAPABILITY_CHANGED },
+ {
+ APM_CAPABILITY_CHANGED, XF86_CAPABILITY_CHANGED},
#endif
#if 0
- { APM_STANDBY_FAILED, XF86_APM_STANDBY_FAILED },
- { APM_SUSPEND_FAILED, XF86_APM_SUSPEND_FAILED }
+ {
+ APM_STANDBY_FAILED, XF86_APM_STANDBY_FAILED}, {
+ APM_SUSPEND_FAILED, XF86_APM_SUSPEND_FAILED}
#endif
};
@@ -73,24 +76,24 @@ static struct {
* event is reasonable.
*/
static int
-lnxPMGetEventFromOs(int fd, pmEvent *events, int num)
+lnxPMGetEventFromOs(int fd, pmEvent * events, int num)
{
- int i,j,n;
+ int i, j, n;
apm_event_t linuxEvents[8];
- if ((n = read( fd, linuxEvents, num * sizeof(apm_event_t) )) == -1)
- return 0;
+ if ((n = read(fd, linuxEvents, num * sizeof(apm_event_t))) == -1)
+ return 0;
n /= sizeof(apm_event_t);
if (n > num)
- n = num;
+ n = num;
for (i = 0; i < n; i++) {
- for (j = 0; j < numApmEvents; j++)
- if (LinuxToXF86[j].apmLinux == linuxEvents[i]) {
- events[i] = LinuxToXF86[j].xf86;
- break;
- }
- if (j == numApmEvents)
- events[i] = XF86_APM_UNKNOWN;
+ for (j = 0; j < numApmEvents; j++)
+ if (LinuxToXF86[j].apmLinux == linuxEvents[i]) {
+ events[i] = LinuxToXF86[j].xf86;
+ break;
+ }
+ if (j == numApmEvents)
+ events[i] = XF86_APM_UNKNOWN;
}
return n;
}
@@ -101,55 +104,55 @@ lnxPMConfirmEventToOs(int fd, pmEvent event)
switch (event) {
case XF86_APM_SYS_STANDBY:
case XF86_APM_USER_STANDBY:
- if (ioctl( fd, APM_IOC_STANDBY, NULL ))
- return PM_FAILED;
- return PM_CONTINUE;
+ if (ioctl(fd, APM_IOC_STANDBY, NULL))
+ return PM_FAILED;
+ return PM_CONTINUE;
case XF86_APM_SYS_SUSPEND:
case XF86_APM_CRITICAL_SUSPEND:
case XF86_APM_USER_SUSPEND:
- if (ioctl( fd, APM_IOC_SUSPEND, NULL )) {
- /* I believe this is wrong (EE)
- EBUSY is sent when a device refuses to be suspended.
- In this case we still need to undo everything we have
- done to suspend ourselves or we will stay in suspended
- state forever. */
- if (errno == EBUSY)
- return PM_CONTINUE;
- else
- return PM_FAILED;
- }
- return PM_CONTINUE;
+ if (ioctl(fd, APM_IOC_SUSPEND, NULL)) {
+ /* I believe this is wrong (EE)
+ EBUSY is sent when a device refuses to be suspended.
+ In this case we still need to undo everything we have
+ done to suspend ourselves or we will stay in suspended
+ state forever. */
+ if (errno == EBUSY)
+ return PM_CONTINUE;
+ else
+ return PM_FAILED;
+ }
+ return PM_CONTINUE;
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:
- return PM_CONTINUE;
+ return PM_CONTINUE;
default:
- return PM_NONE;
+ return PM_NONE;
}
}
-#endif // HAVE_APM
+#endif // HAVE_APM
PMClose
xf86OSPMOpen(void)
{
- PMClose ret = NULL;
+ PMClose ret = NULL;
#ifdef HAVE_ACPI
- /* Favour ACPI over APM, but only when enabled */
+ /* Favour ACPI over APM, but only when enabled */
- if (!xf86acpiDisableFlag)
- ret = lnxACPIOpen();
+ if (!xf86acpiDisableFlag)
+ ret = lnxACPIOpen();
- if (!ret)
+ if (!ret)
#endif
#ifdef HAVE_APM
- ret = lnxAPMOpen();
+ ret = lnxAPMOpen();
#endif
- return ret;
+ return ret;
}
#ifdef HAVE_APM
@@ -157,27 +160,27 @@ xf86OSPMOpen(void)
static PMClose
lnxAPMOpen(void)
{
- int fd, pfd;
+ int fd, pfd;
DebugF("APM: OSPMOpen called\n");
if (APMihPtr || !xf86Info.pmFlag)
- return NULL;
-
+ return NULL;
+
DebugF("APM: Opening device\n");
- if ((fd = open( APM_DEVICE, O_RDWR )) > -1) {
- if (access( APM_PROC, R_OK ) ||
- ((pfd = open( APM_PROC, O_RDONLY)) == -1)) {
- xf86MsgVerb(X_WARNING,3,"Cannot open APM (%s) (%s)\n",
- APM_PROC, strerror(errno));
- close(fd);
- return NULL;
- } else
- close(pfd);
- xf86PMGetEventFromOs = lnxPMGetEventFromOs;
- xf86PMConfirmEventToOs = lnxPMConfirmEventToOs;
- APMihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL);
- xf86MsgVerb(X_INFO,3,"Open APM successful\n");
- return lnxCloseAPM;
+ if ((fd = open(APM_DEVICE, O_RDWR)) > -1) {
+ if (access(APM_PROC, R_OK) || ((pfd = open(APM_PROC, O_RDONLY)) == -1)) {
+ xf86MsgVerb(X_WARNING, 3, "Cannot open APM (%s) (%s)\n",
+ APM_PROC, strerror(errno));
+ close(fd);
+ return NULL;
+ }
+ else
+ close(pfd);
+ xf86PMGetEventFromOs = lnxPMGetEventFromOs;
+ xf86PMConfirmEventToOs = lnxPMConfirmEventToOs;
+ APMihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL);
+ xf86MsgVerb(X_INFO, 3, "Open APM successful\n");
+ return lnxCloseAPM;
}
return NULL;
}
@@ -189,10 +192,10 @@ lnxCloseAPM(void)
DebugF("APM: Closing device\n");
if (APMihPtr) {
- fd = xf86RemoveGeneralHandler(APMihPtr);
- close(fd);
- APMihPtr = NULL;
+ fd = xf86RemoveGeneralHandler(APMihPtr);
+ close(fd);
+ APMihPtr = NULL;
}
}
-#endif // HAVE_APM
+#endif // HAVE_APM
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_axp.c b/xorg-server/hw/xfree86/os-support/linux/lnx_axp.c
index 10fd9e865..d65a3a487 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_axp.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_axp.c
@@ -9,93 +9,95 @@
axpDevice lnxGetAXP(void);
-typedef struct
- { char* sysName;
- char* sysVari;
- char* cpu;
- axpDevice sys; }
-AXP;
+typedef struct {
+ char *sysName;
+ char *sysVari;
+ char *cpu;
+ axpDevice sys;
+} AXP;
static AXP axpList[] = {
- { "Tsunami", NULL, NULL, TSUNAMI },
- { "Eiger", NULL, NULL, TSUNAMI },
- {"Noname", NULL, NULL, LCA },
- { "AlphaBook1", NULL, NULL, LCA },
- {"EB66", NULL, NULL, LCA},
- {"EB64+",NULL,NULL, APECS},
- {"Noritake",NULL,"EV5",CIA},
- {"Noritake",NULL,"EV56",CIA},
- {"Noritake",NULL,NULL,APECS},
- {"XL",NULL,NULL,APECS},
- {"Avanti",NULL,NULL,APECS},
- {"Mikasa",NULL,"EV5",CIA},
- {"Mikasa",NULL,"EV56",CIA},
- {"Mikasa",NULL,NULL,APECS},
- {"EB164","EB164",NULL,CIA},
- {"EB164","PC164", NULL,CIA},
- {"EB164","LX164",NULL, PYXIS},
- {"EB164","SX164",NULL, PYXIS},
- {"EB164","RX164",NULL, POLARIS},
- {"Alcor",NULL,NULL,CIA},
- {"Takara",NULL,NULL,CIA},
- {"Sable",NULL, "EV5",T2_GAMMA},
- {"Sable",NULL,"EV56",T2_GAMMA},
- {"Sable",NULL,NULL,T2},
- {"Rawhide",NULL,NULL,MCPCIA},
- {"Jensen",NULL,NULL,JENSEN},
- {"Miata",NULL,NULL,PYXIS_CIA},
- {"Ruffian",NULL,NULL,PYXIS_CIA},
- {"Nautilus",NULL,NULL,IRONGATE},
- {NULL,NULL,NULL,SYS_NONE}
+ {"Tsunami", NULL, NULL, TSUNAMI},
+ {"Eiger", NULL, NULL, TSUNAMI},
+ {"Noname", NULL, NULL, LCA},
+ {"AlphaBook1", NULL, NULL, LCA},
+ {"EB66", NULL, NULL, LCA},
+ {"EB64+", NULL, NULL, APECS},
+ {"Noritake", NULL, "EV5", CIA},
+ {"Noritake", NULL, "EV56", CIA},
+ {"Noritake", NULL, NULL, APECS},
+ {"XL", NULL, NULL, APECS},
+ {"Avanti", NULL, NULL, APECS},
+ {"Mikasa", NULL, "EV5", CIA},
+ {"Mikasa", NULL, "EV56", CIA},
+ {"Mikasa", NULL, NULL, APECS},
+ {"EB164", "EB164", NULL, CIA},
+ {"EB164", "PC164", NULL, CIA},
+ {"EB164", "LX164", NULL, PYXIS},
+ {"EB164", "SX164", NULL, PYXIS},
+ {"EB164", "RX164", NULL, POLARIS},
+ {"Alcor", NULL, NULL, CIA},
+ {"Takara", NULL, NULL, CIA},
+ {"Sable", NULL, "EV5", T2_GAMMA},
+ {"Sable", NULL, "EV56", T2_GAMMA},
+ {"Sable", NULL, NULL, T2},
+ {"Rawhide", NULL, NULL, MCPCIA},
+ {"Jensen", NULL, NULL, JENSEN},
+ {"Miata", NULL, NULL, PYXIS_CIA},
+ {"Ruffian", NULL, NULL, PYXIS_CIA},
+ {"Nautilus", NULL, NULL, IRONGATE},
+ {NULL, NULL, NULL, SYS_NONE}
};
-
axpDevice
lnxGetAXP(void)
{
- FILE *file;
- int count = 0;
- char res[256];
- char cpu[255];
- char systype[255];
- char sysvari[255];
- if (!(file = fopen("/proc/cpuinfo","r")))
- return SYS_NONE;
- do {
- if (!fgets(res,0xff,file)) return SYS_NONE;
- switch (count) {
- case 1:
- sscanf(res, "cpu model : %s",cpu);
- DebugF("CPU %s\n",cpu);
- break;
- case 5:
- sscanf(res, "system type : %s",systype);
- DebugF("system type : %s\n",systype);
- break;
- case 6:
- sscanf(res, "system variation : %s",sysvari);
- DebugF("system variation: %s\n",sysvari);
- break;
- }
- count++;
- } while (count < 8);
-
- fclose(file);
-
- count = 0;
-
- do {
- if (!axpList[count].sysName || !strcmp(axpList[count].sysName,systype)) {
- if (axpList[count].sysVari && strcmp(axpList[count].sysVari,sysvari)) {
- count++;
- continue;
- };
- if (axpList[count].cpu && strcmp(axpList[count].cpu,cpu)) {
- count++;
- continue;
- }
- return axpList[count].sys;
- }
- count++;
- } while (1);
+ FILE *file;
+ int count = 0;
+ char res[256];
+ char cpu[255];
+ char systype[255];
+ char sysvari[255];
+
+ if (!(file = fopen("/proc/cpuinfo", "r")))
+ return SYS_NONE;
+ do {
+ if (!fgets(res, 0xff, file))
+ return SYS_NONE;
+ switch (count) {
+ case 1:
+ sscanf(res, "cpu model : %s", cpu);
+ DebugF("CPU %s\n", cpu);
+ break;
+ case 5:
+ sscanf(res, "system type : %s", systype);
+ DebugF("system type : %s\n", systype);
+ break;
+ case 6:
+ sscanf(res, "system variation : %s", sysvari);
+ DebugF("system variation: %s\n", sysvari);
+ break;
+ }
+ count++;
+ } while (count < 8);
+
+ fclose(file);
+
+ count = 0;
+
+ do {
+ if (!axpList[count].sysName || !strcmp(axpList[count].sysName, systype)) {
+ if (axpList[count].sysVari &&
+ strcmp(axpList[count].sysVari, sysvari)) {
+ count++;
+ continue;
+ };
+ if (axpList[count].cpu && strcmp(axpList[count].cpu, cpu)) {
+ count++;
+ continue;
+ }
+ return axpList[count].sys;
+ }
+ count++;
+ } while (1);
}
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_init.c b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
index 2176985f9..68c296b0f 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
@@ -43,7 +43,7 @@ static int activeVT = -1;
static char vtname[11];
static struct termios tty_attr; /* tty state to restore */
-static int tty_mode; /* kbd mode to restore */
+static int tty_mode; /* kbd mode to restore */
static void
drain_console(int fd, void *closure)
@@ -61,11 +61,11 @@ switch_to(int vt, const char *from)
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt));
if (ret < 0)
- FatalError("%s: VT_ACTIVATE failed: %s\n", from, strerror(errno));
+ FatalError("%s: VT_ACTIVATE failed: %s\n", from, strerror(errno));
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt));
if (ret < 0)
- FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
+ FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
}
void
@@ -80,171 +80,169 @@ xf86OpenConsole(void)
if (serverGeneration == 1) {
- /* when KeepTty check if we're run with euid==0 */
- if (KeepTty && geteuid() != 0)
- FatalError("xf86OpenConsole:"
- " Server must be suid root for option \"KeepTTY\"\n");
-
- /*
- * setup the virtual terminal manager
- */
- if (xf86Info.vtno != -1) {
- from = X_CMDLINE;
- } else {
-
- i=0;
- while (tty0[i] != NULL) {
- if ((fd = open(tty0[i],O_WRONLY,0)) >= 0)
- break;
- i++;
- }
-
- if (fd < 0)
- FatalError(
- "xf86OpenConsole: Cannot open /dev/tty0 (%s)\n",
- strerror(errno));
-
- if (xf86Info.ShareVTs)
- {
- SYSCALL(ret = ioctl(fd, VT_GETSTATE, &vts));
- if (ret < 0)
- FatalError("xf86OpenConsole: Cannot find the current"
- " VT (%s)\n", strerror(errno));
+ /* when KeepTty check if we're run with euid==0 */
+ if (KeepTty && geteuid() != 0)
+ FatalError("xf86OpenConsole:"
+ " Server must be suid root for option \"KeepTTY\"\n");
+
+ /*
+ * setup the virtual terminal manager
+ */
+ if (xf86Info.vtno != -1) {
+ from = X_CMDLINE;
+ }
+ else {
+
+ i = 0;
+ while (tty0[i] != NULL) {
+ if ((fd = open(tty0[i], O_WRONLY, 0)) >= 0)
+ break;
+ i++;
+ }
+
+ if (fd < 0)
+ FatalError("xf86OpenConsole: Cannot open /dev/tty0 (%s)\n",
+ strerror(errno));
+
+ if (xf86Info.ShareVTs) {
+ SYSCALL(ret = ioctl(fd, VT_GETSTATE, &vts));
+ if (ret < 0)
+ FatalError("xf86OpenConsole: Cannot find the current"
+ " VT (%s)\n", strerror(errno));
xf86Info.vtno = vts.v_active;
- } else {
- SYSCALL(ret = ioctl(fd, VT_OPENQRY, &xf86Info.vtno));
- if (ret < 0)
- FatalError("xf86OpenConsole: Cannot find a free VT: "
- "%s\n", strerror(errno));
- if (xf86Info.vtno == -1)
- FatalError("xf86OpenConsole: Cannot find a free VT\n");
- }
- close(fd);
- }
-
- xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
-
- if (!KeepTty) {
- pid_t ppid = getppid();
- pid_t ppgid;
- ppgid = getpgid(ppid);
-
- /*
- * change to parent process group that pgid != pid so
- * that setsid() doesn't fail and we become process
- * group leader
- */
- if (setpgid(0,ppgid) < 0)
- xf86Msg(X_WARNING, "xf86OpenConsole: setpgid failed: %s\n",
- strerror(errno));
-
- /* become process group leader */
- if ((setsid() < 0))
- xf86Msg(X_WARNING, "xf86OpenConsole: setsid failed: %s\n",
- strerror(errno));
- }
-
- i=0;
+ }
+ else {
+ SYSCALL(ret = ioctl(fd, VT_OPENQRY, &xf86Info.vtno));
+ if (ret < 0)
+ FatalError("xf86OpenConsole: Cannot find a free VT: "
+ "%s\n", strerror(errno));
+ if (xf86Info.vtno == -1)
+ FatalError("xf86OpenConsole: Cannot find a free VT\n");
+ }
+ close(fd);
+ }
+
+ xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
+
+ if (!KeepTty) {
+ pid_t ppid = getppid();
+ pid_t ppgid;
+
+ ppgid = getpgid(ppid);
+
+ /*
+ * change to parent process group that pgid != pid so
+ * that setsid() doesn't fail and we become process
+ * group leader
+ */
+ if (setpgid(0, ppgid) < 0)
+ xf86Msg(X_WARNING, "xf86OpenConsole: setpgid failed: %s\n",
+ strerror(errno));
+
+ /* become process group leader */
+ if ((setsid() < 0))
+ xf86Msg(X_WARNING, "xf86OpenConsole: setsid failed: %s\n",
+ strerror(errno));
+ }
+
+ i = 0;
while (vcs[i] != NULL) {
- snprintf(vtname, sizeof(vtname), vcs[i], xf86Info.vtno); /* /dev/tty1-64 */
- if ((xf86Info.consoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) >= 0)
- break;
+ snprintf(vtname, sizeof(vtname), vcs[i], xf86Info.vtno); /* /dev/tty1-64 */
+ if ((xf86Info.consoleFd = open(vtname, O_RDWR | O_NDELAY, 0)) >= 0)
+ break;
i++;
}
- if (xf86Info.consoleFd < 0)
- FatalError("xf86OpenConsole: Cannot open virtual console"
- " %d (%s)\n", xf86Info.vtno, strerror(errno));
-
- /*
- * Linux doesn't switch to an active vt after the last close of a vt,
- * so we do this ourselves by remembering which is active now.
- */
- SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts));
- if (ret < 0)
- xf86Msg(X_WARNING,"xf86OpenConsole: VT_GETSTATE failed: %s\n",
- strerror(errno));
- else
- activeVT = vts.v_active;
+ if (xf86Info.consoleFd < 0)
+ FatalError("xf86OpenConsole: Cannot open virtual console"
+ " %d (%s)\n", xf86Info.vtno, strerror(errno));
+
+ /*
+ * Linux doesn't switch to an active vt after the last close of a vt,
+ * so we do this ourselves by remembering which is active now.
+ */
+ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts));
+ if (ret < 0)
+ xf86Msg(X_WARNING, "xf86OpenConsole: VT_GETSTATE failed: %s\n",
+ strerror(errno));
+ else
+ activeVT = vts.v_active;
#if 0
- if (!KeepTty) {
- /*
- * Detach from the controlling tty to avoid char loss
- */
- if ((i = open("/dev/tty",O_RDWR)) >= 0) {
- SYSCALL(ioctl(i, TIOCNOTTY, 0));
- close(i);
- }
- }
+ if (!KeepTty) {
+ /*
+ * Detach from the controlling tty to avoid char loss
+ */
+ if ((i = open("/dev/tty", O_RDWR)) >= 0) {
+ SYSCALL(ioctl(i, TIOCNOTTY, 0));
+ close(i);
+ }
+ }
#endif
- if (!xf86Info.ShareVTs)
- {
+ if (!xf86Info.ShareVTs) {
struct termios nTty;
- /*
- * now get the VT. This _must_ succeed, or else fail completely.
- */
+ /*
+ * now get the VT. This _must_ succeed, or else fail completely.
+ */
switch_to(xf86Info.vtno, "xf86OpenConsole");
- SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT));
- if (ret < 0)
- FatalError("xf86OpenConsole: VT_GETMODE failed %s\n",
- strerror(errno));
+ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT));
+ if (ret < 0)
+ FatalError("xf86OpenConsole: VT_GETMODE failed %s\n",
+ strerror(errno));
- signal(SIGUSR1, xf86VTRequest);
+ signal(SIGUSR1, xf86VTRequest);
- VT.mode = VT_PROCESS;
- VT.relsig = SIGUSR1;
- VT.acqsig = SIGUSR1;
+ VT.mode = VT_PROCESS;
+ VT.relsig = SIGUSR1;
+ VT.acqsig = SIGUSR1;
- SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT));
- if (ret < 0)
- FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed: %s\n",
- strerror(errno));
+ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT));
+ if (ret < 0)
+ FatalError
+ ("xf86OpenConsole: VT_SETMODE VT_PROCESS failed: %s\n",
+ strerror(errno));
- SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS));
- if (ret < 0)
- FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n",
- strerror(errno));
+ SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS));
+ if (ret < 0)
+ FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n",
+ strerror(errno));
tcgetattr(xf86Info.consoleFd, &tty_attr);
- SYSCALL(ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode));
+ SYSCALL(ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode));
#ifdef K_OFF
- /* disable kernel special keys and buffering */
- SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_OFF));
- if (ret < 0)
+ /* disable kernel special keys and buffering */
+ SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_OFF));
+ if (ret < 0)
#endif
- {
- SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW));
- if (ret < 0)
- FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
- strerror(errno));
+ {
+ SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW));
+ if (ret < 0)
+ FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
+ strerror(errno));
- /* need to keep the buffer clean, else the kernel gets angry */
- xf86SetConsoleHandler(drain_console, NULL);
- }
+ /* need to keep the buffer clean, else the kernel gets angry */
+ xf86SetConsoleHandler(drain_console, NULL);
+ }
nTty = tty_attr;
nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
nTty.c_oflag = 0;
nTty.c_cflag = CREAD | CS8;
nTty.c_lflag = 0;
- nTty.c_cc[VTIME]=0;
- nTty.c_cc[VMIN]=1;
+ nTty.c_cc[VTIME] = 0;
+ nTty.c_cc[VMIN] = 1;
cfsetispeed(&nTty, 9600);
cfsetospeed(&nTty, 9600);
tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
-
- /* we really should have a InitOSInputDevices() function instead
- * of Init?$#*&Device(). So I just place it here */
}
- } else { /* serverGeneration != 1 */
- if (!xf86Info.ShareVTs && xf86Info.autoVTSwitch)
- {
- /* now get the VT */
+ }
+ else { /* serverGeneration != 1 */
+ if (!xf86Info.ShareVTs && xf86Info.autoVTSwitch) {
+ /* now get the VT */
switch_to(xf86Info.vtno, "xf86OpenConsole");
}
}
@@ -253,7 +251,7 @@ xf86OpenConsole(void)
void
xf86CloseConsole(void)
{
- struct vt_mode VT;
+ struct vt_mode VT;
int ret;
if (xf86Info.ShareVTs) {
@@ -270,68 +268,64 @@ xf86CloseConsole(void)
/* Back to text mode ... */
SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT));
if (ret < 0)
- xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
- strerror(errno));
+ xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
+ strerror(errno));
SYSCALL(ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode));
tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT));
if (ret < 0)
- xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETMODE failed: %s\n",
- strerror(errno));
+ xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETMODE failed: %s\n",
+ strerror(errno));
else {
- /* set dflt vt handling */
- VT.mode = VT_AUTO;
- SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT));
- if (ret < 0)
- xf86Msg(X_WARNING, "xf86CloseConsole: VT_SETMODE failed: %s\n",
- strerror(errno));
+ /* set dflt vt handling */
+ VT.mode = VT_AUTO;
+ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT));
+ if (ret < 0)
+ xf86Msg(X_WARNING, "xf86CloseConsole: VT_SETMODE failed: %s\n",
+ strerror(errno));
}
- if (xf86Info.autoVTSwitch)
- {
+ if (xf86Info.autoVTSwitch) {
/*
* Perform a switch back to the active VT when we were started
*/
if (activeVT >= 0) {
switch_to(activeVT, "xf86CloseConsole");
- activeVT = -1;
+ activeVT = -1;
}
}
- close(xf86Info.consoleFd); /* make the vt-manager happy */
+ close(xf86Info.consoleFd); /* make the vt-manager happy */
}
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;
- }
-
- if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
- {
- if (sscanf(argv[i], "vt%2d", &xf86Info.vtno) == 0)
- {
- UseMsg();
- xf86Info.vtno = -1;
- return 0;
- }
- return 1;
- }
- return 0;
+ /*
+ * 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;
+ }
+
+ if ((argv[i][0] == 'v') && (argv[i][1] == 't')) {
+ if (sscanf(argv[i], "vt%2d", &xf86Info.vtno) == 0) {
+ UseMsg();
+ xf86Info.vtno = -1;
+ return 0;
+ }
+ return 1;
+ }
+ return 0;
}
void
xf86UseMsg(void)
{
- ErrorF("vtXX use the specified VT number\n");
- ErrorF("-keeptty ");
- ErrorF("don't detach controlling tty (for debugging only)\n");
+ ErrorF("vtXX use the specified VT number\n");
+ ErrorF("-keeptty ");
+ ErrorF("don't detach controlling tty (for debugging only)\n");
}
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_video.c b/xorg-server/hw/xfree86/os-support/linux/lnx_video.c
index 0d91f7a52..3526a21d4 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_video.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_video.c
@@ -70,10 +70,10 @@ extern int iopl(int __level);
#endif
#ifdef __alpha__
-# define BUS_BASE bus_base
-#else
+#define BUS_BASE bus_base
+#else
#define BUS_BASE (0)
-#endif /* __alpha__ */
+#endif /* __alpha__ */
/***************************************************************************/
/* Video Memory Mapping section */
@@ -81,10 +81,11 @@ extern int iopl(int __level);
static pointer mapVidMem(int, unsigned long, unsigned long, int);
static void unmapVidMem(int, pointer, unsigned long);
-#if defined (__alpha__)
+
+#if defined (__alpha__)
extern void sethae(unsigned long hae);
-extern unsigned long _bus_base __P ((void)) __attribute__ ((const));
-extern unsigned long _bus_base_sparse __P ((void)) __attribute__ ((const));
+extern unsigned long _bus_base __P((void)) __attribute__ ((const));
+extern unsigned long _bus_base_sparse __P((void)) __attribute__ ((const));
static pointer mapVidMemSparse(int, unsigned long, unsigned long, int);
extern axpDevice lnxGetAXP(void);
@@ -105,9 +106,9 @@ static void undoWC(int, pointer);
/* The file desc for /proc/mtrr. Once opened, left opened, and the mtrr
driver will clean up when we exit. */
-#define MTRR_FD_UNOPENED (-1) /* We have yet to open /proc/mtrr */
-#define MTRR_FD_PROBLEM (-2) /* We tried to open /proc/mtrr, but had
- a problem. */
+#define MTRR_FD_UNOPENED (-1) /* We have yet to open /proc/mtrr */
+#define MTRR_FD_PROBLEM (-2) /* We tried to open /proc/mtrr, but had
+ a problem. */
static int mtrr_fd = MTRR_FD_UNOPENED;
/* Open /proc/mtrr. FALSE on failure. Will always fail on Linux 2.0,
@@ -116,29 +117,29 @@ static int mtrr_fd = MTRR_FD_UNOPENED;
static Bool
mtrr_open(int verbosity)
{
- /* Only report absence of /proc/mtrr once. */
- static Bool warned = FALSE;
-
- if (mtrr_fd == MTRR_FD_UNOPENED) {
- mtrr_fd = open("/proc/mtrr", O_WRONLY);
-
- if (mtrr_fd < 0)
- mtrr_fd = MTRR_FD_PROBLEM;
- }
-
- if (mtrr_fd == MTRR_FD_PROBLEM) {
- /* To make sure we only ever warn once, need to check
- verbosity outside xf86MsgVerb */
- if (!warned && verbosity <= xf86GetVerbosity()) {
- xf86MsgVerb(X_WARNING, verbosity,
- "System lacks support for changing MTRRs\n");
- warned = TRUE;
- }
-
- return FALSE;
- }
- else
- return TRUE;
+ /* Only report absence of /proc/mtrr once. */
+ static Bool warned = FALSE;
+
+ if (mtrr_fd == MTRR_FD_UNOPENED) {
+ mtrr_fd = open("/proc/mtrr", O_WRONLY);
+
+ if (mtrr_fd < 0)
+ mtrr_fd = MTRR_FD_PROBLEM;
+ }
+
+ if (mtrr_fd == MTRR_FD_PROBLEM) {
+ /* To make sure we only ever warn once, need to check
+ verbosity outside xf86MsgVerb */
+ if (!warned && verbosity <= xf86GetVerbosity()) {
+ xf86MsgVerb(X_WARNING, verbosity,
+ "System lacks support for changing MTRRs\n");
+ warned = TRUE;
+ }
+
+ return FALSE;
+ }
+ else
+ return TRUE;
}
/*
@@ -147,260 +148,257 @@ mtrr_open(int verbosity)
*/
struct mtrr_wc_region {
- struct mtrr_sentry sentry;
- Bool added; /* added WC or removed it */
- struct mtrr_wc_region * next;
+ struct mtrr_sentry sentry;
+ Bool added; /* added WC or removed it */
+ struct mtrr_wc_region *next;
};
-
static struct mtrr_wc_region *
mtrr_cull_wc_region(int screenNum, unsigned long base, unsigned long size,
- MessageType from)
+ MessageType from)
{
- /* Some BIOS writers thought that setting wc over the mmio
- region of a graphics devices was a good idea. Try to fix
- it. */
-
- struct mtrr_gentry gent;
- struct mtrr_wc_region *wcreturn = NULL, *wcr;
- int count, ret=0;
-
- /* Linux 2.0 users should not get a warning without -verbose */
- if (!mtrr_open(2))
- return NULL;
-
- for (gent.regnum = 0;
- ioctl(mtrr_fd, MTRRIOC_GET_ENTRY, &gent) >= 0;
- gent.regnum++) {
- if (gent.type != MTRR_TYPE_WRCOMB
- || gent.base + gent.size <= base
- || base + size <= gent.base)
- continue;
-
- /* Found an overlapping region. Delete it. */
-
- wcr = malloc(sizeof(*wcr));
- if (!wcr)
- return NULL;
- wcr->sentry.base = gent.base;
- wcr->sentry.size = gent.size;
- wcr->sentry.type = MTRR_TYPE_WRCOMB;
- wcr->added = FALSE;
-
- count = 3;
- while (count-- &&
- (ret = ioctl(mtrr_fd, MTRRIOC_KILL_ENTRY, &(wcr->sentry))) < 0);
-
- if (ret >= 0) {
- xf86DrvMsg(screenNum, from,
- "Removed MMIO write-combining range "
- "(0x%lx,0x%lx)\n",
- (unsigned long) gent.base, (unsigned long) gent.size);
- wcr->next = wcreturn;
- wcreturn = wcr;
- gent.regnum--;
- } else {
- free(wcr);
- xf86DrvMsgVerb(screenNum, X_WARNING, 0,
- "Failed to remove MMIO "
- "write-combining range (0x%lx,0x%lx)\n",
- gent.base, (unsigned long) gent.size);
- }
- }
- return wcreturn;
-}
+ /* Some BIOS writers thought that setting wc over the mmio
+ region of a graphics devices was a good idea. Try to fix
+ it. */
+ struct mtrr_gentry gent;
+ struct mtrr_wc_region *wcreturn = NULL, *wcr;
+ int count, ret = 0;
+
+ /* Linux 2.0 users should not get a warning without -verbose */
+ if (!mtrr_open(2))
+ return NULL;
+
+ for (gent.regnum = 0;
+ ioctl(mtrr_fd, MTRRIOC_GET_ENTRY, &gent) >= 0; gent.regnum++) {
+ if (gent.type != MTRR_TYPE_WRCOMB
+ || gent.base + gent.size <= base || base + size <= gent.base)
+ continue;
+
+ /* Found an overlapping region. Delete it. */
+
+ wcr = malloc(sizeof(*wcr));
+ if (!wcr)
+ return NULL;
+ wcr->sentry.base = gent.base;
+ wcr->sentry.size = gent.size;
+ wcr->sentry.type = MTRR_TYPE_WRCOMB;
+ wcr->added = FALSE;
+
+ count = 3;
+ while (count-- &&
+ (ret = ioctl(mtrr_fd, MTRRIOC_KILL_ENTRY, &(wcr->sentry))) < 0);
+
+ if (ret >= 0) {
+ xf86DrvMsg(screenNum, from,
+ "Removed MMIO write-combining range "
+ "(0x%lx,0x%lx)\n",
+ (unsigned long) gent.base, (unsigned long) gent.size);
+ wcr->next = wcreturn;
+ wcreturn = wcr;
+ gent.regnum--;
+ }
+ else {
+ free(wcr);
+ xf86DrvMsgVerb(screenNum, X_WARNING, 0,
+ "Failed to remove MMIO "
+ "write-combining range (0x%lx,0x%lx)\n",
+ gent.base, (unsigned long) gent.size);
+ }
+ }
+ return wcreturn;
+}
static struct mtrr_wc_region *
mtrr_remove_offending(int screenNum, unsigned long base, unsigned long size,
- MessageType from)
+ MessageType from)
{
struct mtrr_gentry gent;
struct mtrr_wc_region *wcreturn = NULL, **wcr;
if (!mtrr_open(2))
- return NULL;
+ return NULL;
wcr = &wcreturn;
- for (gent.regnum = 0;
- ioctl(mtrr_fd, MTRRIOC_GET_ENTRY, &gent) >= 0; gent.regnum++ ) {
- if (gent.type == MTRR_TYPE_WRCOMB
- && ((gent.base >= base && gent.base + gent.size < base + size) ||
- (gent.base > base && gent.base + gent.size <= base + size))) {
- *wcr = mtrr_cull_wc_region(screenNum, gent.base, gent.size, from);
- if (*wcr) gent.regnum--;
- while(*wcr) {
- wcr = &((*wcr)->next);
- }
- }
+ for (gent.regnum = 0;
+ ioctl(mtrr_fd, MTRRIOC_GET_ENTRY, &gent) >= 0; gent.regnum++) {
+ if (gent.type == MTRR_TYPE_WRCOMB
+ && ((gent.base >= base && gent.base + gent.size < base + size) ||
+ (gent.base > base && gent.base + gent.size <= base + size))) {
+ *wcr = mtrr_cull_wc_region(screenNum, gent.base, gent.size, from);
+ if (*wcr)
+ gent.regnum--;
+ while (*wcr) {
+ wcr = &((*wcr)->next);
+ }
+ }
}
return wcreturn;
}
-
static struct mtrr_wc_region *
mtrr_add_wc_region(int screenNum, unsigned long base, unsigned long size,
- MessageType from)
+ MessageType from)
{
- struct mtrr_wc_region **wcr, *wcreturn, *curwcr;
+ struct mtrr_wc_region **wcr, *wcreturn, *curwcr;
- /*
- * There can be only one....
- */
+ /*
+ * There can be only one....
+ */
- wcreturn = mtrr_remove_offending(screenNum, base, size, from);
- wcr = &wcreturn;
- while (*wcr) {
- wcr = &((*wcr)->next);
- }
+ wcreturn = mtrr_remove_offending(screenNum, base, size, from);
+ wcr = &wcreturn;
+ while (*wcr) {
+ wcr = &((*wcr)->next);
+ }
- /* Linux 2.0 should not warn, unless the user explicitly asks for
- WC. */
+ /* Linux 2.0 should not warn, unless the user explicitly asks for
+ WC. */
- if (!mtrr_open(from == X_CONFIG ? 0 : 2))
- return wcreturn;
+ if (!mtrr_open(from == X_CONFIG ? 0 : 2))
+ return wcreturn;
- *wcr = curwcr = malloc(sizeof(**wcr));
- if (!curwcr)
- return wcreturn;
+ *wcr = curwcr = malloc(sizeof(**wcr));
+ if (!curwcr)
+ return wcreturn;
- curwcr->sentry.base = base;
- curwcr->sentry.size = size;
- curwcr->sentry.type = MTRR_TYPE_WRCOMB;
- curwcr->added = TRUE;
- curwcr->next = NULL;
+ curwcr->sentry.base = base;
+ curwcr->sentry.size = size;
+ curwcr->sentry.type = MTRR_TYPE_WRCOMB;
+ curwcr->added = TRUE;
+ curwcr->next = NULL;
#if SPLIT_WC_REGIONS
- /*
- * Splits up the write-combining region if it is not aligned on a
- * size boundary.
- */
-
- {
- unsigned long lbase, d_size = 1;
- unsigned long n_size = size;
- unsigned long n_base = base;
-
- for (lbase = n_base, d_size = 1; !(lbase & 1);
- lbase = lbase >> 1, d_size <<= 1);
- while (d_size > n_size)
- d_size = d_size >> 1;
- DebugF("WC_BASE: 0x%lx WC_END: 0x%lx\n",base,base+d_size-1);
- n_base += d_size;
- n_size -= d_size;
- if (n_size) {
- xf86DrvMsgVerb(screenNum,X_INFO,3,"Splitting WC range: "
- "base: 0x%lx, size: 0x%lx\n",base,size);
- curwcr->next = mtrr_add_wc_region(screenNum, n_base, n_size,from);
- }
- curwcr->sentry.size = d_size;
- }
-
- /*****************************************************************/
-#endif /* SPLIT_WC_REGIONS */
-
- if (ioctl(mtrr_fd, MTRRIOC_ADD_ENTRY, &curwcr->sentry) >= 0) {
- /* Avoid printing on every VT switch */
- if (xf86ServerIsInitialising()) {
- xf86DrvMsg(screenNum, from,
- "Write-combining range (0x%lx,0x%lx)\n",
- base, size);
- }
- return wcreturn;
- }
- else {
- *wcr = curwcr->next;
- free(curwcr);
-
- /* Don't complain about the VGA region: MTRR fixed
- regions aren't currently supported, but might be in
- the future. */
- if ((unsigned long)base >= 0x100000) {
- xf86DrvMsgVerb(screenNum, X_WARNING, 0,
- "Failed to set up write-combining range "
- "(0x%lx,0x%lx)\n", base, size);
- }
- return wcreturn;
- }
+ /*
+ * Splits up the write-combining region if it is not aligned on a
+ * size boundary.
+ */
+
+ {
+ unsigned long lbase, d_size = 1;
+ unsigned long n_size = size;
+ unsigned long n_base = base;
+
+ for (lbase = n_base, d_size = 1; !(lbase & 1);
+ lbase = lbase >> 1, d_size <<= 1);
+ while (d_size > n_size)
+ d_size = d_size >> 1;
+ DebugF("WC_BASE: 0x%lx WC_END: 0x%lx\n", base, base + d_size - 1);
+ n_base += d_size;
+ n_size -= d_size;
+ if (n_size) {
+ xf86DrvMsgVerb(screenNum, X_INFO, 3, "Splitting WC range: "
+ "base: 0x%lx, size: 0x%lx\n", base, size);
+ curwcr->next = mtrr_add_wc_region(screenNum, n_base, n_size, from);
+ }
+ curwcr->sentry.size = d_size;
+ }
+
+ /*****************************************************************/
+#endif /* SPLIT_WC_REGIONS */
+
+ if (ioctl(mtrr_fd, MTRRIOC_ADD_ENTRY, &curwcr->sentry) >= 0) {
+ /* Avoid printing on every VT switch */
+ if (xf86ServerIsInitialising()) {
+ xf86DrvMsg(screenNum, from,
+ "Write-combining range (0x%lx,0x%lx)\n", base, size);
+ }
+ return wcreturn;
+ }
+ else {
+ *wcr = curwcr->next;
+ free(curwcr);
+
+ /* Don't complain about the VGA region: MTRR fixed
+ regions aren't currently supported, but might be in
+ the future. */
+ if ((unsigned long) base >= 0x100000) {
+ xf86DrvMsgVerb(screenNum, X_WARNING, 0,
+ "Failed to set up write-combining range "
+ "(0x%lx,0x%lx)\n", base, size);
+ }
+ return wcreturn;
+ }
}
static void
mtrr_undo_wc_region(int screenNum, struct mtrr_wc_region *wcr)
{
- struct mtrr_wc_region *p, *prev;
-
- if (mtrr_fd >= 0) {
- p = wcr;
- while (p) {
- if (p->added)
- ioctl(mtrr_fd, MTRRIOC_DEL_ENTRY, &p->sentry);
- prev = p;
- p = p->next;
- free(prev);
- }
- }
+ struct mtrr_wc_region *p, *prev;
+
+ if (mtrr_fd >= 0) {
+ p = wcr;
+ while (p) {
+ if (p->added)
+ ioctl(mtrr_fd, MTRRIOC_DEL_ENTRY, &p->sentry);
+ prev = p;
+ p = p->next;
+ free(prev);
+ }
+ }
}
static pointer
setWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
MessageType from)
{
- if (enable)
- return mtrr_add_wc_region(screenNum, base, size, from);
- else
- return mtrr_cull_wc_region(screenNum, base, size, from);
+ if (enable)
+ return mtrr_add_wc_region(screenNum, base, size, from);
+ else
+ return mtrr_cull_wc_region(screenNum, base, size, from);
}
static void
undoWC(int screenNum, pointer regioninfo)
{
- mtrr_undo_wc_region(screenNum, regioninfo);
+ mtrr_undo_wc_region(screenNum, regioninfo);
}
-#endif /* HAS_MTRR_SUPPORT */
+#endif /* HAS_MTRR_SUPPORT */
void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
- pVidMem->linearSupported = TRUE;
+ pVidMem->linearSupported = TRUE;
#ifdef __alpha__
- if (axpSystem == -1) {
- axpSystem = lnxGetAXP();
- if ((needSparse = (_bus_base_sparse() > 0))) {
- hae_thresh = xf86AXPParams[axpSystem].hae_thresh;
- hae_mask = xf86AXPParams[axpSystem].hae_mask;
- }
- bus_base = _bus_base();
- }
- if (needSparse) {
- xf86Msg(X_INFO,"Machine needs sparse mapping\n");
- pVidMem->mapMem = mapVidMemSparse;
- pVidMem->unmapMem = unmapVidMemSparse;
- } else {
- xf86Msg(X_INFO,"Machine type has 8/16 bit access\n");
- pVidMem->mapMem = mapVidMem;
- pVidMem->unmapMem = unmapVidMem;
- }
+ if (axpSystem == -1) {
+ axpSystem = lnxGetAXP();
+ if ((needSparse = (_bus_base_sparse() > 0))) {
+ hae_thresh = xf86AXPParams[axpSystem].hae_thresh;
+ hae_mask = xf86AXPParams[axpSystem].hae_mask;
+ }
+ bus_base = _bus_base();
+ }
+ if (needSparse) {
+ xf86Msg(X_INFO, "Machine needs sparse mapping\n");
+ pVidMem->mapMem = mapVidMemSparse;
+ pVidMem->unmapMem = unmapVidMemSparse;
+ }
+ else {
+ xf86Msg(X_INFO, "Machine type has 8/16 bit access\n");
+ pVidMem->mapMem = mapVidMem;
+ pVidMem->unmapMem = unmapVidMem;
+ }
#else
- pVidMem->mapMem = mapVidMem;
- pVidMem->unmapMem = unmapVidMem;
-#endif /* __alpha__ */
-
+ pVidMem->mapMem = mapVidMem;
+ pVidMem->unmapMem = unmapVidMem;
+#endif /* __alpha__ */
#ifdef HAS_MTRR_SUPPORT
- pVidMem->setWC = setWC;
- pVidMem->undoWC = undoWC;
+ pVidMem->setWC = setWC;
+ pVidMem->undoWC = undoWC;
#endif
- pVidMem->initialised = TRUE;
+ pVidMem->initialised = TRUE;
}
#ifdef __sparc__
/* Basically, you simply cannot do this on Sparc. You have to do something portable
* like use /dev/fb* or mmap() on /proc/bus/pci/X/Y nodes. -DaveM
*/
-static pointer mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+static pointer
+mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
- return NULL;
+ return NULL;
}
#else
static pointer
@@ -408,14 +406,14 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
{
pointer base;
int fd;
- int mapflags = MAP_SHARED;
+ int mapflags = MAP_SHARED;
int prot;
memType realBase, alignOff;
realBase = Base & ~(getpagesize() - 1);
alignOff = Base - realBase;
DebugF("base: %lx, realBase: %lx, alignOff: %lx \n",
- Base,realBase,alignOff);
+ Base, realBase, alignOff);
#if defined(__ia64__) || defined(__arm__) || defined(__s390__)
#ifndef MAP_WRITECOMBINED
@@ -424,55 +422,52 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
#ifndef MAP_NONCACHED
#define MAP_NONCACHED 0x00020000
#endif
- if(flags & VIDMEM_FRAMEBUFFER)
- mapflags |= MAP_WRITECOMBINED;
+ if (flags & VIDMEM_FRAMEBUFFER)
+ mapflags |= MAP_WRITECOMBINED;
else
- mapflags |= MAP_NONCACHED;
+ mapflags |= MAP_NONCACHED;
#endif
#if 0
/* this will disappear when people upgrade their kernels */
fd = open(DEV_MEM,
- ((flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR) | O_SYNC);
+ ((flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR) | O_SYNC);
#else
fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
#endif
- if (fd < 0)
- {
- FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
- strerror(errno));
+ if (fd < 0) {
+ FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
+ strerror(errno));
}
if (flags & VIDMEM_READONLY)
- prot = PROT_READ;
+ prot = PROT_READ;
else
- prot = PROT_READ | PROT_WRITE;
+ prot = PROT_READ | PROT_WRITE;
/* This requires linux-0.99.pl10 or above */
- base = mmap((caddr_t)0, Size + alignOff, prot, mapflags, fd,
- (off_t)realBase + BUS_BASE);
+ base = mmap((caddr_t) 0, Size + alignOff, prot, mapflags, fd,
+ (off_t) realBase + BUS_BASE);
close(fd);
if (base == MAP_FAILED) {
FatalError("xf86MapVidMem: Could not mmap framebuffer"
- " (0x%08lx,0x%lx) (%s)\n", Base, Size,
- strerror(errno));
+ " (0x%08lx,0x%lx) (%s)\n", Base, Size, strerror(errno));
}
- DebugF("base: %lx aligned base: %lx\n",base, (char *)base + alignOff);
- return (char *)base + alignOff;
+ DebugF("base: %lx aligned base: %lx\n", base, (char *) base + alignOff);
+ return (char *) base + alignOff;
}
-#endif /* !(__sparc__) */
-
+#endif /* !(__sparc__) */
+
static void
unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
{
- uintptr_t alignOff = (uintptr_t)Base
- - ((uintptr_t)Base & ~(getpagesize() - 1));
+ uintptr_t alignOff = (uintptr_t) Base
+ - ((uintptr_t) Base & ~(getpagesize() - 1));
- DebugF("alignment offset: %lx\n", (unsigned long)alignOff);
- munmap((void *)((uintptr_t)Base - alignOff), (Size + alignOff));
+ DebugF("alignment offset: %lx\n", (unsigned long) alignOff);
+ munmap((void *) ((uintptr_t) Base - alignOff), (Size + alignOff));
}
-
/***************************************************************************/
/* I/O Permissions section */
/***************************************************************************/
@@ -490,68 +485,68 @@ Bool
xf86EnableIO(void)
{
#if defined(__powerpc__)
- int fd;
- unsigned int ioBase_phys;
+ int fd;
+ unsigned int ioBase_phys;
#endif
- if (ExtendedEnabled)
- return TRUE;
+ if (ExtendedEnabled)
+ return TRUE;
#if defined(__powerpc__)
- ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0);
+ ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0);
- fd = open("/dev/mem", O_RDWR);
- if (ioBase == NULL) {
- ioBase = (volatile unsigned char *)mmap(0, 0x20000,
- PROT_READ | PROT_WRITE, MAP_SHARED, fd,
- ioBase_phys);
+ fd = open("/dev/mem", O_RDWR);
+ if (ioBase == NULL) {
+ ioBase = (volatile unsigned char *) mmap(0, 0x20000,
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED, fd, ioBase_phys);
/* Should this be fatal or just a warning? */
#if 0
- if (ioBase == MAP_FAILED) {
- xf86Msg(X_WARNING,
- "xf86EnableIOPorts: Failed to map iobase (%s)\n",
- strerror(errno));
- return FALSE;
- }
+ if (ioBase == MAP_FAILED) {
+ xf86Msg(X_WARNING,
+ "xf86EnableIOPorts: Failed to map iobase (%s)\n",
+ strerror(errno));
+ return FALSE;
+ }
#endif
- }
- close(fd);
+ }
+ close(fd);
#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__arm__) && !defined(__m32r__) && !defined(__nds32__)
- if (ioperm(0, 1024, 1) || iopl(3)) {
- if (errno == ENODEV)
- ErrorF("xf86EnableIOPorts: no I/O ports found\n");
- else
- FatalError("xf86EnableIOPorts: failed to set IOPL"
- " for I/O (%s)\n", strerror(errno));
- return FALSE;
- }
-# if !defined(__alpha__)
- /* XXX: this is actually not trapping anything because of iopl(3)
- * above */
- ioperm(0x40,4,0); /* trap access to the timer chip */
- ioperm(0x60,4,0); /* trap access to the keyboard controller */
-# endif
+ if (ioperm(0, 1024, 1) || iopl(3)) {
+ if (errno == ENODEV)
+ ErrorF("xf86EnableIOPorts: no I/O ports found\n");
+ else
+ FatalError("xf86EnableIOPorts: failed to set IOPL"
+ " for I/O (%s)\n", strerror(errno));
+ return FALSE;
+ }
+#if !defined(__alpha__)
+ /* XXX: this is actually not trapping anything because of iopl(3)
+ * above */
+ ioperm(0x40, 4, 0); /* trap access to the timer chip */
+ ioperm(0x60, 4, 0); /* trap access to the keyboard controller */
+#endif
#endif
- ExtendedEnabled = TRUE;
+ ExtendedEnabled = TRUE;
- return TRUE;
+ return TRUE;
}
void
xf86DisableIO(void)
{
- if (!ExtendedEnabled)
- return;
+ if (!ExtendedEnabled)
+ return;
#if defined(__powerpc__)
- munmap(ioBase, 0x20000);
- ioBase = NULL;
+ munmap(ioBase, 0x20000);
+ ioBase = NULL;
#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__arm__) && !defined(__s390__) && !defined(__m32r__) && !defined(__nds32__)
- iopl(0);
- ioperm(0, 1024, 0);
+ iopl(0);
+ ioperm(0, 1024, 0);
#endif
- ExtendedEnabled = FALSE;
+ ExtendedEnabled = FALSE;
- return;
+ return;
}
#if defined (__alpha__)
@@ -562,33 +557,33 @@ extern int readDense8(pointer Base, register unsigned long Offset);
extern int readDense16(pointer Base, register unsigned long Offset);
extern int readDense32(pointer Base, register unsigned long Offset);
extern void
-writeDenseNB8(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB8(int Value, pointer Base, register unsigned long Offset);
extern void
-writeDenseNB16(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB16(int Value, pointer Base, register unsigned long Offset);
extern void
-writeDenseNB32(int Value, pointer Base, register unsigned long Offset);
+ writeDenseNB32(int Value, pointer Base, register unsigned long Offset);
extern void
-writeDense8(int Value, pointer Base, register unsigned long Offset);
+ writeDense8(int Value, pointer Base, register unsigned long Offset);
extern void
-writeDense16(int Value, pointer Base, register unsigned long Offset);
+ writeDense16(int Value, pointer Base, register unsigned long Offset);
extern void
-writeDense32(int Value, pointer Base, register unsigned long Offset);
+ writeDense32(int Value, pointer Base, register unsigned long Offset);
static int readSparse8(pointer Base, register unsigned long Offset);
static int readSparse16(pointer Base, register unsigned long Offset);
static int readSparse32(pointer Base, register unsigned long Offset);
static void
-writeSparseNB8(int Value, pointer Base, register unsigned long Offset);
+ writeSparseNB8(int Value, pointer Base, register unsigned long Offset);
static void
-writeSparseNB16(int Value, pointer Base, register unsigned long Offset);
+ writeSparseNB16(int Value, pointer Base, register unsigned long Offset);
static void
-writeSparseNB32(int Value, pointer Base, register unsigned long Offset);
+ writeSparseNB32(int Value, pointer Base, register unsigned long Offset);
static void
-writeSparse8(int Value, pointer Base, register unsigned long Offset);
+ writeSparse8(int Value, pointer Base, register unsigned long Offset);
static void
-writeSparse16(int Value, pointer Base, register unsigned long Offset);
+ writeSparse16(int Value, pointer Base, register unsigned long Offset);
static void
-writeSparse32(int Value, pointer Base, register unsigned long Offset);
+ writeSparse32(int Value, pointer Base, register unsigned long Offset);
#define DENSE_BASE 0x2ff00000000UL
#define SPARSE_BASE 0x30000000000UL
@@ -596,7 +591,8 @@ writeSparse32(int Value, pointer Base, register unsigned long Offset);
static unsigned long msb_set = 0;
static pointer
-mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
+mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size,
+ int flags)
{
int fd, prot;
unsigned long ret, rets = 0;
@@ -604,43 +600,42 @@ mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags
static Bool was_here = FALSE;
if (!was_here) {
- was_here = TRUE;
-
- xf86WriteMmio8 = writeSparse8;
- xf86WriteMmio16 = writeSparse16;
- xf86WriteMmio32 = writeSparse32;
- xf86WriteMmioNB8 = writeSparseNB8;
- xf86WriteMmioNB16 = writeSparseNB16;
- xf86WriteMmioNB32 = writeSparseNB32;
- xf86ReadMmio8 = readSparse8;
- xf86ReadMmio16 = readSparse16;
- xf86ReadMmio32 = readSparse32;
+ was_here = TRUE;
+
+ xf86WriteMmio8 = writeSparse8;
+ xf86WriteMmio16 = writeSparse16;
+ xf86WriteMmio32 = writeSparse32;
+ xf86WriteMmioNB8 = writeSparseNB8;
+ xf86WriteMmioNB16 = writeSparseNB16;
+ xf86WriteMmioNB32 = writeSparseNB32;
+ xf86ReadMmio8 = readSparse8;
+ xf86ReadMmio16 = readSparse16;
+ xf86ReadMmio32 = readSparse32;
}
-
+
fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR);
if (fd < 0) {
FatalError("xf86MapVidMem: failed to open " DEV_MEM " (%s)\n",
- strerror(errno));
+ strerror(errno));
}
#if 0
- xf86Msg(X_INFO,"mapVidMemSparse: try Base 0x%lx size 0x%lx flags 0x%x\n",
- Base, Size, flags);
+ xf86Msg(X_INFO, "mapVidMemSparse: try Base 0x%lx size 0x%lx flags 0x%x\n",
+ Base, Size, flags);
#endif
if (flags & VIDMEM_READONLY)
- prot = PROT_READ;
+ prot = PROT_READ;
else
- prot = PROT_READ | PROT_WRITE;
+ prot = PROT_READ | PROT_WRITE;
/* This requirers linux-0.99.pl10 or above */
/*
* Always do DENSE mmap, since read32/write32 currently require it.
*/
- ret = (unsigned long)mmap((caddr_t)(DENSE_BASE + Base), Size,
- prot, MAP_SHARED, fd,
- (off_t) (bus_base + Base));
+ ret = (unsigned long) mmap((caddr_t) (DENSE_BASE + Base), Size,
+ prot, MAP_SHARED, fd, (off_t) (bus_base + Base));
/*
* Do SPARSE mmap only when MMIO and not MMIO_32BIT, or FRAMEBUFFER
@@ -650,40 +645,36 @@ mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags
* bytes worth of pagetable (32 pages).
*/
if (((flags & VIDMEM_MMIO) && !(flags & VIDMEM_MMIO_32BIT)) ||
- ((flags & VIDMEM_FRAMEBUFFER) && (flags & VIDMEM_SPARSE)))
- {
- rets = (unsigned long)mmap((caddr_t)(SPARSE_BASE + (Base << 5)),
- Size << 5, prot, MAP_SHARED, fd,
- (off_t) _bus_base_sparse() + (Base << 5));
+ ((flags & VIDMEM_FRAMEBUFFER) && (flags & VIDMEM_SPARSE))) {
+ rets = (unsigned long) mmap((caddr_t) (SPARSE_BASE + (Base << 5)),
+ Size << 5, prot, MAP_SHARED, fd,
+ (off_t) _bus_base_sparse() + (Base << 5));
}
close(fd);
-
- if (ret == (unsigned long)MAP_FAILED) {
+
+ if (ret == (unsigned long) MAP_FAILED) {
FatalError("xf86MapVidMemSparse: Could not (dense) mmap fb (%s)\n",
- strerror(errno));
+ strerror(errno));
}
if (((flags & VIDMEM_MMIO) && !(flags & VIDMEM_MMIO_32BIT)) ||
- ((flags & VIDMEM_FRAMEBUFFER) && (flags & VIDMEM_SPARSE)))
- {
- if (rets == (unsigned long)MAP_FAILED ||
- rets != (SPARSE_BASE + (Base << 5)))
- {
- FatalError("mapVidMemSparse: Could not (sparse) mmap fb (%s)\n",
- strerror(errno));
- }
+ ((flags & VIDMEM_FRAMEBUFFER) && (flags & VIDMEM_SPARSE))) {
+ if (rets == (unsigned long) MAP_FAILED ||
+ rets != (SPARSE_BASE + (Base << 5))) {
+ FatalError("mapVidMemSparse: Could not (sparse) mmap fb (%s)\n",
+ strerror(errno));
+ }
}
#if 1
if (rets)
- xf86Msg(X_INFO,"mapVidMemSparse: mapped Base 0x%lx size 0x%lx"
- " to DENSE at 0x%lx and SPARSE at 0x%lx\n",
- Base, Size, ret, rets);
+ xf86Msg(X_INFO, "mapVidMemSparse: mapped Base 0x%lx size 0x%lx"
+ " to DENSE at 0x%lx and SPARSE at 0x%lx\n",
+ Base, Size, ret, rets);
else
- xf86Msg(X_INFO,"mapVidMemSparse: mapped Base 0x%lx size 0x%lx"
- " to DENSE only at 0x%lx\n",
- Base, Size, ret);
+ xf86Msg(X_INFO, "mapVidMemSparse: mapped Base 0x%lx size 0x%lx"
+ " to DENSE only at 0x%lx\n", Base, Size, ret);
#endif
return (pointer) ret;
@@ -692,16 +683,17 @@ mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags
static void
unmapVidMemSparse(int ScreenNum, pointer Base, unsigned long Size)
{
- unsigned long Offset = (unsigned long)Base - DENSE_BASE;
+ unsigned long Offset = (unsigned long) Base - DENSE_BASE;
+
#if 1
- xf86Msg(X_INFO,"unmapVidMemSparse: unmapping Base 0x%lx Size 0x%lx\n",
- Base, Size);
+ xf86Msg(X_INFO, "unmapVidMemSparse: unmapping Base 0x%lx Size 0x%lx\n",
+ Base, Size);
#endif
/* Unmap DENSE always. */
- munmap((caddr_t)Base, Size);
+ munmap((caddr_t) Base, Size);
/* Unmap SPARSE always, and ignore error in case we did not map it. */
- munmap((caddr_t)(SPARSE_BASE + (Offset << 5)), Size << 5);
+ munmap((caddr_t) (SPARSE_BASE + (Offset << 5)), Size << 5);
}
static int
@@ -711,15 +703,15 @@ readSparse8(pointer Base, register unsigned long Offset)
register unsigned long msb;
mem_barrier();
- Offset += (unsigned long)Base - DENSE_BASE;
+ Offset += (unsigned long) Base - DENSE_BASE;
shift = (Offset & 0x3) << 3;
if (Offset >= (hae_thresh)) {
msb = Offset & hae_mask;
Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
}
mem_barrier();
@@ -735,19 +727,19 @@ readSparse16(pointer Base, register unsigned long Offset)
register unsigned long msb;
mem_barrier();
- Offset += (unsigned long)Base - DENSE_BASE;
+ Offset += (unsigned long) Base - DENSE_BASE;
shift = (Offset & 0x2) << 3;
if (Offset >= hae_thresh) {
msb = Offset & hae_mask;
Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
}
mem_barrier();
- result = *(vuip)(SPARSE_BASE + (Offset<<5) + (1<<(5-2)));
+ result = *(vuip) (SPARSE_BASE + (Offset << 5) + (1 << (5 - 2)));
result >>= shift;
return 0xffffUL & result;
}
@@ -757,7 +749,7 @@ readSparse32(pointer Base, register unsigned long Offset)
{
/* NOTE: this is really using DENSE. */
mem_barrier();
- return *(vuip)((unsigned long)Base+(Offset));
+ return *(vuip) ((unsigned long) Base + (Offset));
}
static void
@@ -767,14 +759,14 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset)
register unsigned int b = Value & 0xffU;
write_mem_barrier();
- Offset += (unsigned long)Base - DENSE_BASE;
+ Offset += (unsigned long) Base - DENSE_BASE;
if (Offset >= hae_thresh) {
msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
}
write_mem_barrier();
@@ -788,18 +780,18 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset)
register unsigned int w = Value & 0xffffU;
write_mem_barrier();
- Offset += (unsigned long)Base - DENSE_BASE;
+ Offset += (unsigned long) Base - DENSE_BASE;
if (Offset >= hae_thresh) {
msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
}
write_mem_barrier();
- *(vuip)(SPARSE_BASE + (Offset<<5) + (1<<(5-2))) = w * 0x00010001;
+ *(vuip) (SPARSE_BASE + (Offset << 5) + (1 << (5 - 2))) = w * 0x00010001;
}
static void
@@ -807,7 +799,7 @@ writeSparse32(int Value, pointer Base, register unsigned long Offset)
{
/* NOTE: this is really using DENSE. */
write_mem_barrier();
- *(vuip)((unsigned long)Base + (Offset)) = Value;
+ *(vuip) ((unsigned long) Base + (Offset)) = Value;
return;
}
@@ -817,14 +809,14 @@ writeSparseNB8(int Value, pointer Base, register unsigned long Offset)
register unsigned long msb;
register unsigned int b = Value & 0xffU;
- Offset += (unsigned long)Base - DENSE_BASE;
+ Offset += (unsigned long) Base - DENSE_BASE;
if (Offset >= hae_thresh) {
msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
}
*(vuip) (SPARSE_BASE + (Offset << 5)) = b * 0x01010101;
}
@@ -835,43 +827,43 @@ writeSparseNB16(int Value, pointer Base, register unsigned long Offset)
register unsigned long msb;
register unsigned int w = Value & 0xffffU;
- Offset += (unsigned long)Base - DENSE_BASE;
+ Offset += (unsigned long) Base - DENSE_BASE;
if (Offset >= hae_thresh) {
msb = Offset & hae_mask;
- Offset -= msb;
- if (msb_set != msb) {
- sethae(msb);
- msb_set = msb;
- }
+ Offset -= msb;
+ if (msb_set != msb) {
+ sethae(msb);
+ msb_set = msb;
+ }
}
- *(vuip)(SPARSE_BASE+(Offset<<5)+(1<<(5-2))) = w * 0x00010001;
+ *(vuip) (SPARSE_BASE + (Offset << 5) + (1 << (5 - 2))) = w * 0x00010001;
}
static void
writeSparseNB32(int Value, pointer Base, register unsigned long Offset)
{
/* NOTE: this is really using DENSE. */
- *(vuip)((unsigned long)Base + (Offset)) = Value;
+ *(vuip) ((unsigned long) Base + (Offset)) = Value;
return;
}
-void (*xf86WriteMmio8)(int Value, pointer Base, unsigned long Offset)
- = writeDense8;
-void (*xf86WriteMmio16)(int Value, pointer Base, unsigned long Offset)
- = writeDense16;
-void (*xf86WriteMmio32)(int Value, pointer Base, unsigned long Offset)
- = writeDense32;
-void (*xf86WriteMmioNB8)(int Value, pointer Base, unsigned long Offset)
- = writeDenseNB8;
-void (*xf86WriteMmioNB16)(int Value, pointer Base, unsigned long Offset)
- = writeDenseNB16;
-void (*xf86WriteMmioNB32)(int Value, pointer Base, unsigned long Offset)
- = writeDenseNB32;
-int (*xf86ReadMmio8)(pointer Base, unsigned long Offset)
- = readDense8;
-int (*xf86ReadMmio16)(pointer Base, unsigned long Offset)
- = readDense16;
-int (*xf86ReadMmio32)(pointer Base, unsigned long Offset)
- = readDense32;
-
-#endif /* __alpha__ */
+void (*xf86WriteMmio8) (int Value, pointer Base, unsigned long Offset)
+ = writeDense8;
+void (*xf86WriteMmio16) (int Value, pointer Base, unsigned long Offset)
+ = writeDense16;
+void (*xf86WriteMmio32) (int Value, pointer Base, unsigned long Offset)
+ = writeDense32;
+void (*xf86WriteMmioNB8) (int Value, pointer Base, unsigned long Offset)
+ = writeDenseNB8;
+void (*xf86WriteMmioNB16) (int Value, pointer Base, unsigned long Offset)
+ = writeDenseNB16;
+void (*xf86WriteMmioNB32) (int Value, pointer Base, unsigned long Offset)
+ = writeDenseNB32;
+int (*xf86ReadMmio8) (pointer Base, unsigned long Offset)
+ = readDense8;
+int (*xf86ReadMmio16) (pointer Base, unsigned long Offset)
+ = readDense16;
+int (*xf86ReadMmio32) (pointer Base, unsigned long Offset)
+ = readDense32;
+
+#endif /* __alpha__ */