From b16b9e4656e7199c2aec74a4c8ebc7a875d3ba73 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 2 Feb 2015 15:02:49 +0100 Subject: massive reduction of unneeded files --- .../programs/Xserver/hw/xfree86/common/Imakefile | 275 -- .../Xserver/hw/xfree86/common/atKeynames.h | 298 -- nx-X11/programs/Xserver/hw/xfree86/common/fourcc.h | 161 - .../Xserver/hw/xfree86/common/modeline2c.pl | 110 - nx-X11/programs/Xserver/hw/xfree86/common/scoasm.h | 143 - nx-X11/programs/Xserver/hw/xfree86/common/xf86.h | 447 --- .../Xserver/hw/xfree86/common/xf86AutoConfig.c | 368 -- .../programs/Xserver/hw/xfree86/common/xf86Bus.c | 3317 ------------------ .../programs/Xserver/hw/xfree86/common/xf86Bus.h | 162 - .../Xserver/hw/xfree86/common/xf86Config.c | 2740 --------------- .../Xserver/hw/xfree86/common/xf86Config.h | 63 - .../Xserver/hw/xfree86/common/xf86Configure.c | 1049 ------ .../Xserver/hw/xfree86/common/xf86Cursor.c | 788 ----- .../programs/Xserver/hw/xfree86/common/xf86DGA.c | 1267 ------- .../programs/Xserver/hw/xfree86/common/xf86DPMS.c | 222 -- .../programs/Xserver/hw/xfree86/common/xf86Debug.c | 197 -- .../Xserver/hw/xfree86/common/xf86DefModes.c | 160 - .../Xserver/hw/xfree86/common/xf86DoProbe.c | 129 - .../Xserver/hw/xfree86/common/xf86DoScanPci.c | 130 - .../Xserver/hw/xfree86/common/xf86Events.c | 1865 ----------- .../Xserver/hw/xfree86/common/xf86Globals.c | 254 -- .../Xserver/hw/xfree86/common/xf86Helper.c | 2983 ----------------- .../Xserver/hw/xfree86/common/xf86InPriv.h | 48 - .../programs/Xserver/hw/xfree86/common/xf86Init.c | 2035 ------------ nx-X11/programs/Xserver/hw/xfree86/common/xf86Io.c | 507 --- .../programs/Xserver/hw/xfree86/common/xf86Kbd.c | 395 --- .../Xserver/hw/xfree86/common/xf86KbdBSD.c | 1266 ------- .../Xserver/hw/xfree86/common/xf86KbdLnx.c | 651 ---- .../Xserver/hw/xfree86/common/xf86KbdMach.c | 317 -- .../Xserver/hw/xfree86/common/xf86Keymap.h | 455 --- .../Xserver/hw/xfree86/common/xf86MiscExt.c | 660 ---- .../programs/Xserver/hw/xfree86/common/xf86Mode.c | 2185 ------------ .../Xserver/hw/xfree86/common/xf86Module.h | 226 -- .../programs/Xserver/hw/xfree86/common/xf86Opt.h | 114 - .../Xserver/hw/xfree86/common/xf86Option.c | 884 ----- nx-X11/programs/Xserver/hw/xfree86/common/xf86PM.c | 225 -- .../Xserver/hw/xfree86/common/xf86PciInfo.h | 726 ---- .../programs/Xserver/hw/xfree86/common/xf86Priv.h | 228 -- .../Xserver/hw/xfree86/common/xf86Privstr.h | 234 -- .../programs/Xserver/hw/xfree86/common/xf86RandR.c | 438 --- .../Xserver/hw/xfree86/common/xf86Resources.h | 140 - .../Xserver/hw/xfree86/common/xf86Versions.c | 81 - .../Xserver/hw/xfree86/common/xf86VidMode.c | 722 ---- .../programs/Xserver/hw/xfree86/common/xf86XKB.c | 82 - .../Xserver/hw/xfree86/common/xf86Xinput.c | 1513 --------- .../Xserver/hw/xfree86/common/xf86Xinput.h | 220 -- .../programs/Xserver/hw/xfree86/common/xf86cmap.c | 1123 ------- .../programs/Xserver/hw/xfree86/common/xf86cmap.h | 76 - .../programs/Xserver/hw/xfree86/common/xf86fbBus.c | 97 - .../programs/Xserver/hw/xfree86/common/xf86fbman.c | 1445 -------- .../programs/Xserver/hw/xfree86/common/xf86fbman.h | 227 -- .../Xserver/hw/xfree86/common/xf86isaBus.c | 142 - .../programs/Xserver/hw/xfree86/common/xf86noBus.c | 75 - .../Xserver/hw/xfree86/common/xf86pciBus.c | 3506 -------------------- .../Xserver/hw/xfree86/common/xf86pciBus.h | 99 - .../Xserver/hw/xfree86/common/xf86sbusBus.c | 709 ---- .../Xserver/hw/xfree86/common/xf86sbusBus.h | 98 - .../programs/Xserver/hw/xfree86/common/xf86str.h | 1140 ------- nx-X11/programs/Xserver/hw/xfree86/common/xf86xv.c | 2050 ------------ nx-X11/programs/Xserver/hw/xfree86/common/xf86xv.h | 271 -- .../programs/Xserver/hw/xfree86/common/xf86xvmc.c | 243 -- .../programs/Xserver/hw/xfree86/common/xf86xvmc.h | 164 - .../Xserver/hw/xfree86/common/xf86xvpriv.h | 86 - nx-X11/programs/Xserver/hw/xfree86/common/xisb.c | 180 - nx-X11/programs/Xserver/hw/xfree86/common/xisb.h | 64 - .../Xserver/hw/xfree86/common/xorgHelper.c | 24 - .../Xserver/hw/xfree86/os-support/Imakefile | 130 - .../Xserver/hw/xfree86/os-support/README.OS-lib | 506 --- .../Xserver/hw/xfree86/os-support/assyntax.h | 753 ----- .../Xserver/hw/xfree86/os-support/bsd/Imakefile | 242 -- .../hw/xfree86/os-support/bsd/alpha_video.c | 735 ---- .../Xserver/hw/xfree86/os-support/bsd/arm_video.c | 690 ---- .../hw/xfree86/os-support/bsd/bsdResource.c | 194 -- .../Xserver/hw/xfree86/os-support/bsd/bsd_KbdMap.c | 1087 ------ .../Xserver/hw/xfree86/os-support/bsd/bsd_VTsw.c | 96 - .../Xserver/hw/xfree86/os-support/bsd/bsd_apm.c | 141 - .../Xserver/hw/xfree86/os-support/bsd/bsd_axp.c | 73 - .../Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c | 91 - .../Xserver/hw/xfree86/os-support/bsd/bsd_init.c | 738 ---- .../Xserver/hw/xfree86/os-support/bsd/bsd_io.c | 294 -- .../Xserver/hw/xfree86/os-support/bsd/bsd_jstk.c | 189 -- .../Xserver/hw/xfree86/os-support/bsd/bsd_kbd.c | 573 ---- .../Xserver/hw/xfree86/os-support/bsd/bsd_kbd.h | 5 - .../Xserver/hw/xfree86/os-support/bsd/bsd_kmod.c | 31 - .../hw/xfree86/os-support/bsd/bsd_kqueue_apm.c | 203 -- .../Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c | 792 ----- .../hw/xfree86/os-support/bsd/drm/Imakefile | 63 - .../Xserver/hw/xfree86/os-support/bsd/i386_video.c | 999 ------ .../hw/xfree86/os-support/bsd/libusb/Imakefile | 10 - .../hw/xfree86/os-support/bsd/libusb/data.c | 95 - .../hw/xfree86/os-support/bsd/libusb/descr.c | 76 - .../hw/xfree86/os-support/bsd/libusb/parse.c | 404 --- .../hw/xfree86/os-support/bsd/libusb/usage.c | 199 -- .../Xserver/hw/xfree86/os-support/bsd/libusb/usb.3 | 191 -- .../Xserver/hw/xfree86/os-support/bsd/libusb/usb.h | 95 - .../xfree86/os-support/bsd/libusb/usb_hid_usages | 1079 ------ .../hw/xfree86/os-support/bsd/libusb/usbvar.h | 34 - .../Xserver/hw/xfree86/os-support/bsd/memrange.h | 72 - .../Xserver/hw/xfree86/os-support/bsd/ppc_video.c | 141 - .../hw/xfree86/os-support/bsd/sparc64_video.c | 113 - .../Xserver/hw/xfree86/os-support/bsdi/Imakefile | 46 - .../Xserver/hw/xfree86/os-support/bsdi/bsdi_init.c | 156 - .../Xserver/hw/xfree86/os-support/bsdi/bsdi_io.c | 110 - .../hw/xfree86/os-support/bsdi/bsdi_mouse.c | 34 - .../hw/xfree86/os-support/bsdi/bsdi_video.c | 182 - .../Xserver/hw/xfree86/os-support/bus/460gxPCI.c | 470 --- .../Xserver/hw/xfree86/os-support/bus/460gxPCI.h | 42 - .../Xserver/hw/xfree86/os-support/bus/Imakefile | 165 - .../Xserver/hw/xfree86/os-support/bus/Pci.c | 1453 -------- .../Xserver/hw/xfree86/os-support/bus/Pci.h | 449 --- .../Xserver/hw/xfree86/os-support/bus/Sbus.c | 637 ---- .../Xserver/hw/xfree86/os-support/bus/altixPCI.c | 120 - .../Xserver/hw/xfree86/os-support/bus/altixPCI.h | 20 - .../Xserver/hw/xfree86/os-support/bus/axpPci.c | 478 --- .../Xserver/hw/xfree86/os-support/bus/e8870PCI.c | 64 - .../Xserver/hw/xfree86/os-support/bus/e8870PCI.h | 42 - .../Xserver/hw/xfree86/os-support/bus/freebsdPci.c | 171 - .../Xserver/hw/xfree86/os-support/bus/ix86Pci.c | 704 ---- .../Xserver/hw/xfree86/os-support/bus/linuxPci.c | 894 ----- .../Xserver/hw/xfree86/os-support/bus/netbsdPci.c | 132 - .../Xserver/hw/xfree86/os-support/bus/ppcPci.c | 311 -- .../Xserver/hw/xfree86/os-support/bus/sparcPci.c | 1052 ------ .../Xserver/hw/xfree86/os-support/bus/xf86Pci.h | 807 ----- .../Xserver/hw/xfree86/os-support/bus/xf86Sbus.h | 70 - .../Xserver/hw/xfree86/os-support/bus/zx1PCI.c | 1133 ------- .../Xserver/hw/xfree86/os-support/bus/zx1PCI.h | 40 - .../Xserver/hw/xfree86/os-support/dgux/Imakefile | 35 - .../hw/xfree86/os-support/dgux/bios_DGmmap.c | 70 - .../Xserver/hw/xfree86/os-support/dgux/dgux_init.c | 182 - .../Xserver/hw/xfree86/os-support/dgux/dgux_io.c | 96 - .../Xserver/hw/xfree86/os-support/dgux/dgux_kbd.c | 120 - .../hw/xfree86/os-support/dgux/dgux_kbdEv.c | 47 - .../Xserver/hw/xfree86/os-support/dgux/dgux_tty.c | 175 - .../hw/xfree86/os-support/dgux/dgux_video.c | 441 --- .../Xserver/hw/xfree86/os-support/hurd/Imakefile | 40 - .../Xserver/hw/xfree86/os-support/hurd/bios_mmap.c | 95 - .../Xserver/hw/xfree86/os-support/hurd/hurd_init.c | 90 - .../Xserver/hw/xfree86/os-support/hurd/hurd_io.c | 139 - .../hw/xfree86/os-support/hurd/hurd_mouse.c | 300 -- .../hw/xfree86/os-support/hurd/hurd_video.c | 181 - .../Xserver/hw/xfree86/os-support/int10Defines.h | 90 - .../Xserver/hw/xfree86/os-support/linux/Imakefile | 142 - .../hw/xfree86/os-support/linux/drm/Imakefile | 64 - .../hw/xfree86/os-support/linux/drm/drmmodule.c | 60 - .../hw/xfree86/os-support/linux/int10/Imakefile | 77 - .../hw/xfree86/os-support/linux/int10/linux.c | 649 ---- .../xfree86/os-support/linux/int10/vm86/Imakefile | 55 - .../os-support/linux/int10/vm86/linux_vm86.c | 302 -- .../os-support/linux/int10/x86emu/Imakefile | 86 - .../Xserver/hw/xfree86/os-support/linux/lnx.h | 55 - .../hw/xfree86/os-support/linux/lnxResource.c | 291 -- .../hw/xfree86/os-support/linux/lnx_KbdMap.c | 606 ---- .../Xserver/hw/xfree86/os-support/linux/lnx_acpi.c | 170 - .../Xserver/hw/xfree86/os-support/linux/lnx_agp.c | 371 --- .../Xserver/hw/xfree86/os-support/linux/lnx_apm.c | 192 -- .../Xserver/hw/xfree86/os-support/linux/lnx_axp.c | 200 -- .../Xserver/hw/xfree86/os-support/linux/lnx_ev56.c | 151 - .../Xserver/hw/xfree86/os-support/linux/lnx_font.c | 291 -- .../Xserver/hw/xfree86/os-support/linux/lnx_ia64.c | 74 - .../Xserver/hw/xfree86/os-support/linux/lnx_init.c | 415 --- .../Xserver/hw/xfree86/os-support/linux/lnx_io.c | 275 -- .../Xserver/hw/xfree86/os-support/linux/lnx_jstk.c | 188 -- .../Xserver/hw/xfree86/os-support/linux/lnx_kbd.c | 559 ---- .../Xserver/hw/xfree86/os-support/linux/lnx_kbd.h | 5 - .../Xserver/hw/xfree86/os-support/linux/lnx_kmod.c | 113 - .../hw/xfree86/os-support/linux/lnx_mouse.c | 206 -- .../Xserver/hw/xfree86/os-support/linux/lnx_pci.c | 230 -- .../hw/xfree86/os-support/linux/lnx_video.c | 1169 ------- .../Xserver/hw/xfree86/os-support/lynxos/Imakefile | 62 - .../hw/xfree86/os-support/lynxos/lynx_init.c | 193 -- .../Xserver/hw/xfree86/os-support/lynxos/lynx_io.c | 166 - .../hw/xfree86/os-support/lynxos/lynx_mmap.c | 73 - .../hw/xfree86/os-support/lynxos/lynx_mouse.c | 34 - .../hw/xfree86/os-support/lynxos/lynx_noinline.c | 178 - .../hw/xfree86/os-support/lynxos/lynx_ppc.S | 70 - .../hw/xfree86/os-support/lynxos/lynx_ppc.c | 52 - .../hw/xfree86/os-support/lynxos/lynx_video.c | 711 ---- .../Xserver/hw/xfree86/os-support/misc/BUSmemcpy.S | 153 - .../Xserver/hw/xfree86/os-support/misc/BUSmemcpy.c | 413 --- .../Xserver/hw/xfree86/os-support/misc/Delay.c | 44 - .../Xserver/hw/xfree86/os-support/misc/IODelay.S | 53 - .../Xserver/hw/xfree86/os-support/misc/IODelay.c | 28 - .../Xserver/hw/xfree86/os-support/misc/Imakefile | 54 - .../Xserver/hw/xfree86/os-support/misc/PortIO.S | 57 - .../Xserver/hw/xfree86/os-support/misc/SlowBcopy.S | 108 - .../Xserver/hw/xfree86/os-support/misc/SlowBcopy.c | 114 - .../hw/xfree86/os-support/misc/xf86_IlHack.c | 19 - .../Xserver/hw/xfree86/os-support/misc/xf86_Util.c | 96 - .../Xserver/hw/xfree86/os-support/nto/Imakefile | 37 - .../Xserver/hw/xfree86/os-support/nto/README | 29 - .../Xserver/hw/xfree86/os-support/nto/nto_init.c | 104 - .../Xserver/hw/xfree86/os-support/nto/nto_io.c | 118 - .../Xserver/hw/xfree86/os-support/nto/nto_ioperm.c | 48 - .../Xserver/hw/xfree86/os-support/nto/nto_kbdEv.c | 53 - .../Xserver/hw/xfree86/os-support/nto/nto_mouse.c | 210 -- .../Xserver/hw/xfree86/os-support/nto/nto_video.c | 170 - .../Xserver/hw/xfree86/os-support/os2/Imakefile | 45 - .../Xserver/hw/xfree86/os-support/os2/README | 78 - .../hw/xfree86/os-support/os2/int10/Imakefile | 110 - .../Xserver/hw/xfree86/os-support/os2/int10/os2.c | 452 --- .../Xserver/hw/xfree86/os-support/os2/os2_VTsw.c | 340 -- .../Xserver/hw/xfree86/os-support/os2/os2_bios.c | 143 - .../Xserver/hw/xfree86/os-support/os2/os2_diag.c | 263 -- .../Xserver/hw/xfree86/os-support/os2/os2_init.c | 244 -- .../Xserver/hw/xfree86/os-support/os2/os2_io.c | 257 -- .../Xserver/hw/xfree86/os-support/os2/os2_ioperm.c | 140 - .../Xserver/hw/xfree86/os-support/os2/os2_kbd.c | 158 - .../Xserver/hw/xfree86/os-support/os2/os2_kbdEv.c | 511 --- .../Xserver/hw/xfree86/os-support/os2/os2_mouse.c | 653 ---- .../Xserver/hw/xfree86/os-support/os2/os2_select.c | 497 --- .../Xserver/hw/xfree86/os-support/os2/os2_select.h | 62 - .../Xserver/hw/xfree86/os-support/os2/os2_serial.c | 517 --- .../Xserver/hw/xfree86/os-support/os2/os2_stubs.c | 403 --- .../Xserver/hw/xfree86/os-support/os2/os2_video.c | 241 -- .../Xserver/hw/xfree86/os-support/pmax/Imakefile | 48 - .../Xserver/hw/xfree86/os-support/pmax/pmax_devs.c | 126 - .../Xserver/hw/xfree86/os-support/pmax/pmax_init.c | 473 --- .../Xserver/hw/xfree86/os-support/pmax/pmax_map.c | 239 -- .../hw/xfree86/os-support/pmax/pmax_mouse.c | 60 - .../Xserver/hw/xfree86/os-support/pmax/pmax_pci.c | 1072 ------ .../Xserver/hw/xfree86/os-support/pmax/pmax_ppc.c | 251 -- .../Xserver/hw/xfree86/os-support/qnx4/Imakefile | 37 - .../Xserver/hw/xfree86/os-support/qnx4/qnx_VTsw.c | 116 - .../Xserver/hw/xfree86/os-support/qnx4/qnx_init.c | 175 - .../Xserver/hw/xfree86/os-support/qnx4/qnx_io.c | 110 - .../Xserver/hw/xfree86/os-support/qnx4/qnx_kbd.c | 104 - .../Xserver/hw/xfree86/os-support/qnx4/qnx_mouse.c | 267 -- .../hw/xfree86/os-support/qnx4/qnx_select.c | 75 - .../Xserver/hw/xfree86/os-support/qnx4/qnx_utils.c | 30 - .../Xserver/hw/xfree86/os-support/qnx4/qnx_video.c | 183 - .../Xserver/hw/xfree86/os-support/sco/Imakefile | 56 - .../Xserver/hw/xfree86/os-support/sco/VTsw_sco.c | 119 - .../Xserver/hw/xfree86/os-support/sco/sco_KbdMap.c | 304 -- .../Xserver/hw/xfree86/os-support/sco/sco_init.c | 296 -- .../Xserver/hw/xfree86/os-support/sco/sco_io.c | 269 -- .../Xserver/hw/xfree86/os-support/sco/sco_iop.c | 136 - .../Xserver/hw/xfree86/os-support/sco/sco_kbd.c | 530 --- .../Xserver/hw/xfree86/os-support/sco/sco_kbd.h | 20 - .../Xserver/hw/xfree86/os-support/sco/sco_mouse.c | 261 -- .../Xserver/hw/xfree86/os-support/sco/sco_video.c | 296 -- .../hw/xfree86/os-support/shared/VTsw_noop.c | 56 - .../hw/xfree86/os-support/shared/VTsw_usl.c | 92 - .../hw/xfree86/os-support/shared/agp_noop.c | 107 - .../hw/xfree86/os-support/shared/at_scancode.c | 132 - .../hw/xfree86/os-support/shared/bios_devmem.c | 77 - .../hw/xfree86/os-support/shared/bios_mmap.c | 164 - .../Xserver/hw/xfree86/os-support/shared/ia64Pci.c | 244 -- .../Xserver/hw/xfree86/os-support/shared/ia64Pci.h | 46 - .../Xserver/hw/xfree86/os-support/shared/inout.S | 111 - .../hw/xfree86/os-support/shared/ioperm_noop.c | 51 - .../Xserver/hw/xfree86/os-support/shared/kbd.c | 39 - .../hw/xfree86/os-support/shared/kmod_noop.c | 39 - .../hw/xfree86/os-support/shared/libc_wrapper.c | 2153 ------------ .../Xserver/hw/xfree86/os-support/shared/pm_noop.c | 48 - .../hw/xfree86/os-support/shared/posix_tty.c | 689 ---- .../Xserver/hw/xfree86/os-support/shared/sigio.c | 312 -- .../hw/xfree86/os-support/shared/sigiostubs.c | 86 - .../Xserver/hw/xfree86/os-support/shared/stdPci.c | 52 - .../hw/xfree86/os-support/shared/stdResource.c | 182 - .../hw/xfree86/os-support/shared/std_kbdEv.c | 50 - .../hw/xfree86/os-support/shared/sysv_kbd.c | 106 - .../Xserver/hw/xfree86/os-support/shared/vidmem.c | 300 -- .../Xserver/hw/xfree86/os-support/shared/xf86Axp.c | 50 - .../Xserver/hw/xfree86/os-support/shared/xf86Axp.h | 36 - .../Xserver/hw/xfree86/os-support/sunos/Imakefile | 119 - .../Xserver/hw/xfree86/os-support/sunos/agpgart.h | 109 - .../hw/xfree86/os-support/sunos/find_deps.pl | 150 - .../hw/xfree86/os-support/sunos/solaris-amd64.S | 73 - .../hw/xfree86/os-support/sunos/solaris-ia32.S | 73 - .../xfree86/os-support/sunos/solaris-sparcv8plus.S | 144 - .../Xserver/hw/xfree86/os-support/sunos/sun_agp.c | 339 -- .../Xserver/hw/xfree86/os-support/sunos/sun_bios.c | 104 - .../Xserver/hw/xfree86/os-support/sunos/sun_init.c | 393 --- .../hw/xfree86/os-support/sunos/sun_inout.s | 124 - .../Xserver/hw/xfree86/os-support/sunos/sun_io.c | 160 - .../Xserver/hw/xfree86/os-support/sunos/sun_kbd.c | 662 ---- .../Xserver/hw/xfree86/os-support/sunos/sun_kbd.h | 72 - .../hw/xfree86/os-support/sunos/sun_kbdEv.c | 892 ----- .../hw/xfree86/os-support/sunos/sun_mouse.c | 719 ---- .../Xserver/hw/xfree86/os-support/sunos/sun_vid.c | 237 -- .../Xserver/hw/xfree86/os-support/sysv/Imakefile | 58 - .../Xserver/hw/xfree86/os-support/sysv/sysv_init.c | 254 -- .../Xserver/hw/xfree86/os-support/sysv/sysv_io.c | 78 - .../hw/xfree86/os-support/sysv/sysv_mouse.c | 64 - .../hw/xfree86/os-support/sysv/sysv_video.c | 369 -- .../Xserver/hw/xfree86/os-support/sysv/xqueue.c | 543 --- .../Xserver/hw/xfree86/os-support/sysv/xqueue.h | 12 - .../Xserver/hw/xfree86/os-support/usl/Imakefile | 40 - .../Xserver/hw/xfree86/os-support/usl/usl_KbdMap.c | 304 -- .../Xserver/hw/xfree86/os-support/usl/usl_init.c | 359 -- .../Xserver/hw/xfree86/os-support/usl/usl_io.c | 172 - .../Xserver/hw/xfree86/os-support/usl/usl_iop.c | 108 - .../Xserver/hw/xfree86/os-support/usl/usl_kbd.c | 456 --- .../Xserver/hw/xfree86/os-support/usl/usl_kbd.h | 14 - .../Xserver/hw/xfree86/os-support/usl/usl_mouse.c | 181 - .../Xserver/hw/xfree86/os-support/usl/usl_video.c | 111 - .../Xserver/hw/xfree86/os-support/usl/usl_vtsw.c | 97 - .../Xserver/hw/xfree86/os-support/usl/usl_xqueue.c | 360 -- .../Xserver/hw/xfree86/os-support/usl/usl_xqueue.h | 9 - .../Xserver/hw/xfree86/os-support/xf86OSKbd.h | 133 - .../Xserver/hw/xfree86/os-support/xf86OSmouse.h | 295 -- .../Xserver/hw/xfree86/os-support/xf86OSpriv.h | 57 - .../Xserver/hw/xfree86/os-support/xf86_OSlib.h | 759 ----- .../Xserver/hw/xfree86/os-support/xf86_OSproc.h | 277 -- .../programs/Xserver/hw/xfree86/parser/Configint.h | 226 -- nx-X11/programs/Xserver/hw/xfree86/parser/DRI.c | 187 -- nx-X11/programs/Xserver/hw/xfree86/parser/Device.c | 403 --- .../Xserver/hw/xfree86/parser/Extensions.c | 111 - nx-X11/programs/Xserver/hw/xfree86/parser/Files.c | 295 -- nx-X11/programs/Xserver/hw/xfree86/parser/Flags.c | 525 --- .../programs/Xserver/hw/xfree86/parser/Imakefile | 51 - nx-X11/programs/Xserver/hw/xfree86/parser/Input.c | 215 -- .../programs/Xserver/hw/xfree86/parser/Keyboard.c | 306 -- nx-X11/programs/Xserver/hw/xfree86/parser/Layout.c | 513 --- nx-X11/programs/Xserver/hw/xfree86/parser/Module.c | 261 -- .../programs/Xserver/hw/xfree86/parser/Monitor.c | 907 ----- .../programs/Xserver/hw/xfree86/parser/Pointer.c | 236 -- nx-X11/programs/Xserver/hw/xfree86/parser/Screen.c | 578 ---- nx-X11/programs/Xserver/hw/xfree86/parser/Vendor.c | 258 -- nx-X11/programs/Xserver/hw/xfree86/parser/Video.c | 297 -- .../Xserver/hw/xfree86/parser/configProcs.h | 132 - .../programs/Xserver/hw/xfree86/parser/cpconfig.c | 123 - nx-X11/programs/Xserver/hw/xfree86/parser/read.c | 321 -- nx-X11/programs/Xserver/hw/xfree86/parser/scan.c | 949 ------ nx-X11/programs/Xserver/hw/xfree86/parser/write.c | 220 -- .../Xserver/hw/xfree86/parser/xf86Optrec.h | 113 - .../Xserver/hw/xfree86/parser/xf86Parser.h | 483 --- .../Xserver/hw/xfree86/parser/xf86tokens.h | 280 -- nx-X11/programs/Xserver/hw/xfree86/xf86Date.h | 38 - 329 files changed, 110256 deletions(-) delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/atKeynames.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/fourcc.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/modeline2c.pl delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/scoasm.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86AutoConfig.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Bus.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Bus.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Config.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Config.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Configure.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Cursor.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86DGA.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86DPMS.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Debug.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86DefModes.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86DoProbe.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Events.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Globals.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Helper.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86InPriv.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Init.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Io.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Kbd.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86KbdMach.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Keymap.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86MiscExt.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Mode.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Module.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Opt.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Option.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86PM.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86PciInfo.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Priv.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Privstr.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86RandR.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Resources.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Versions.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86VidMode.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86XKB.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Xinput.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86Xinput.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86cmap.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86cmap.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86fbBus.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86fbman.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86fbman.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86isaBus.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86noBus.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86pciBus.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86pciBus.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86sbusBus.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86sbusBus.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86str.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86xv.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86xv.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86xvmc.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86xvmc.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xf86xvpriv.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xisb.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xisb.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/common/xorgHelper.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/README.OS-lib delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/assyntax.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/alpha_video.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/arm_video.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_KbdMap.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_VTsw.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_apm.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_jstk.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kmod.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/i386_video.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/data.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/descr.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/parse.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usage.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usb.3 delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usb.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usb_hid_usages delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usbvar.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/memrange.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/ppc_video.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/sparc64_video.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_init.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_io.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_mouse.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_video.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/Pci.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/Pci.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/altixPCI.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/altixPCI.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/axpPci.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/netbsdPci.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/bios_DGmmap.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_init.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_io.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_kbd.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_kbdEv.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_tty.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_video.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/bios_mmap.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/hurd_init.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/hurd_io.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/hurd_mouse.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/hurd_video.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/int10Defines.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/drm/drmmodule.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/vm86/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/x86emu/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_KbdMap.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_acpi.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_font.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_ia64.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_jstk.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_mouse.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_init.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_io.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_mmap.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_mouse.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.S delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/misc/BUSmemcpy.S delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/misc/BUSmemcpy.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/misc/Delay.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/misc/IODelay.S delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/misc/IODelay.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/misc/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/misc/PortIO.S delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.S delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/misc/xf86_IlHack.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/misc/xf86_Util.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/nto/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/nto/README delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_init.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_io.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_ioperm.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_kbdEv.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_mouse.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_video.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/os2/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/os2/README delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/os2/int10/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_VTsw.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_bios.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_diag.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_init.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_io.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_ioperm.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_kbd.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_kbdEv.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_mouse.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_select.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_select.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_serial.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_stubs.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_video.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/pmax/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/pmax/pmax_devs.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/pmax/pmax_init.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/pmax/pmax_map.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/pmax/pmax_mouse.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/pmax/pmax_pci.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/pmax/pmax_ppc.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_VTsw.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_init.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_io.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_kbd.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_mouse.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_select.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_utils.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_video.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sco/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sco/VTsw_sco.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sco/sco_KbdMap.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sco/sco_init.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sco/sco_io.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sco/sco_iop.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sco/sco_kbd.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sco/sco_kbd.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sco/sco_mouse.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sco/sco_video.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/VTsw_noop.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/VTsw_usl.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/agp_noop.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/at_scancode.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/bios_devmem.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/ia64Pci.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/ia64Pci.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/inout.S delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/ioperm_noop.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/kbd.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/kmod_noop.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/pm_noop.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/sigio.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/sigiostubs.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/stdPci.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/std_kbdEv.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/sysv_kbd.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sunos/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sunos/agpgart.h delete mode 100755 nx-X11/programs/Xserver/hw/xfree86/os-support/sunos/find_deps.pl delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sunos/solaris-amd64.S delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sunos/solaris-ia32.S delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sunos/solaris-sparcv8plus.S delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sunos/sun_agp.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sunos/sun_bios.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sunos/sun_init.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sunos/sun_inout.s delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sunos/sun_io.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sunos/sun_kbd.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sunos/sun_kbd.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sunos/sun_kbdEv.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sunos/sun_mouse.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sunos/sun_vid.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sysv/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sysv/sysv_init.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sysv/sysv_io.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sysv/sysv_mouse.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sysv/sysv_video.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/usl/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/usl/usl_KbdMap.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/usl/usl_init.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/usl/usl_io.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/usl/usl_iop.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/usl/usl_kbd.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/usl/usl_kbd.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/usl/usl_mouse.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/usl/usl_video.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/usl/usl_vtsw.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/usl/usl_xqueue.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/usl/usl_xqueue.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/xf86OSKbd.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/xf86OSpriv.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/Configint.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/DRI.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/Device.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/Extensions.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/Files.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/Flags.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/Imakefile delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/Input.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/Keyboard.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/Layout.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/Module.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/Monitor.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/Pointer.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/Screen.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/Vendor.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/Video.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/configProcs.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/cpconfig.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/read.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/scan.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/write.c delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/xf86Optrec.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/xf86Parser.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/parser/xf86tokens.h delete mode 100644 nx-X11/programs/Xserver/hw/xfree86/xf86Date.h (limited to 'nx-X11/programs/Xserver/hw/xfree86') diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/common/Imakefile deleted file mode 100644 index 41bc6781e..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/Imakefile +++ /dev/null @@ -1,275 +0,0 @@ -XCOMM $XConsortium: Imakefile /main/34 1996/10/27 11:05:08 kaleb $ - - - - - -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.154 2003/10/08 14:58:26 dawes Exp $ - - - -#include - -#ifdef i386MachArchitecture -#ifdef GNUMachArchitecture - KBD = xf86Kbd -#else - KBD = xf86KbdMach -#endif /* GNUMachArchitecture */ -#else -# if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture) \ - || defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) \ - || defined(KFreeBSDArchitecture) - KBD = xf86KbdBSD -# else -# ifdef LinuxArchitecture - KBD = xf86KbdLnx -# else - KBD = xf86Kbd -# endif -# endif -#endif - -#if UseDeprecatedKeyboardDriver -KEYBOARD_DEFS = -DUSE_DEPRECATED_KEYBOARD_DRIVER -#endif - -#if defined(SparcArchitecture) || defined(Sparc64Architecture) - SBUSSRC = xf86sbusBus.c - SBUSOBJ = xf86sbusBus.o -#endif - -#if BuildXKB - XKBDDXSRC = xf86XKB.c - XKBDDXOBJ = xf86XKB.o -#endif - -#if BuildDebug - DEBUGSRC = xf86Debug.c - DEBUGOBJ = xf86Debug.o -#endif - -#if BuildXInputExt - XF86_XINPUT_SRC = xf86Xinput.c xisb.c - XF86_XINPUT_OBJ = xf86Xinput.o xisb.o -#endif - -#if BuildRandR - RANDRINCS = -I../../../randr - RANDRSRC = xf86RandR.c - RANDROBJ = xf86RandR.o -#endif - -MODPATHDEFINES = -DDEFAULT_MODULE_PATH=\"$(MODULEDIR)\" -LOGDEFINES = -DDEFAULT_LOGPREFIX=\"$(LOGDIRECTORY)/XLogFile.\" - -#if DoLoadableServer -EXT_MODULES_DEFINES = $(GLX_DEFINES) -#endif - -#if UseMemLeak -MDEBUGDEFS = -DMEMDEBUG -#endif - -#if defined(SunArchitecture) && ((OSMajorVersion == 5) && (OSMinorVersion >= 9)) -BACKTRACE_DEFS = -DHAVE_WALKCONTEXT -#elif defined(LinuxCLibMajorVersion) && ((LinuxCLibMajorVersion == 6) && (LinuxCLibMinorVersion >= 1)) -BACKTRACE_DEFS = -DHAVE_EXECINFO_H -#endif - -SRCS = \ - xf86Configure.c \ - xf86Bus.c \ - xf86isaBus.c \ - xf86pciBus.c \ - xf86fbBus.c \ - xf86noBus.c \ - xf86IniExt.c \ - xf86Config.c \ - xf86AutoConfig.c \ - xf86Cursor.c \ - xf86DGA.c \ - xf86DPMS.c \ - xf86DefModeSet.c \ - xf86DoProbe.c \ - xf86DoScanPci.c \ - xf86Events.c \ - xf86Globals.c \ - xf86Helper.c \ - xf86Init.c \ - xf86Io.c \ - xf86MiscExt.c \ - xf86Mode.c \ - xf86Option.c \ - xf86VidMode.c \ - xf86fbman.c \ - xf86xv.c \ - xf86xvmc.c \ - xf86cmap.c\ - xf86PM.c \ - xf86Versions.c \ - xorgHelper.c \ - $(DEBUGSRC) \ - $(KBD).c \ - $(SBUSSRC) \ - $(XF86_XINPUT_SRC) \ - $(XINPUT_DEV_SRCS) \ - $(XKBDDXSRC) \ - $(SERVERSRCS) \ - $(RANDRSRC) - -OBJS = \ - xf86Configure.o \ - xf86Bus.o \ - xf86isaBus.o \ - xf86pciBus.o \ - xf86fbBus.o \ - xf86noBus.o \ - xf86Config.o \ - xf86AutoConfig.o \ - xf86Cursor.o \ - xf86DGA.o \ - xf86DPMS.o \ - xf86DefModeSet.o \ - xf86DoProbe.o \ - xf86DoScanPci.o \ - xf86Events.o \ - xf86Globals.o \ - xf86Helper.o \ - xf86Io.o \ - xf86MiscExt.o \ - xf86Mode.o \ - xf86Option.o \ - xf86VidMode.o \ - xf86fbman.o \ - xf86xv.o \ - xf86xvmc.o \ - xf86cmap.o\ - xf86PM.o \ - xf86Versions.o \ - xorgHelper.o \ - $(DEBUGOBJ) \ - $(SBUSOBJ) \ - $(XF86_XINPUT_OBJ) \ - $(XKBDDXOBJ) \ - $(KBD).o \ - $(RANDROBJ) - -OFILES = \ - xf86Init.o \ - xf86IniExt.o - - VGAINCLUDES = -I$(XF86SRC)/vgahw - INCLUDES = -I. -I$(XF86OSSRC) -I$(XF86OSSRC)/bus -I$(SERVERSRC)/mfb \ - -I$(SERVERSRC)/mi -I$(SERVERSRC)/include -I$(SERVERSRC)/os \ - -I$(XINCLUDESRC) -I$(SERVERSRC)/Xext -I$(EXTINCSRC) \ - -I$(SERVERSRC)/Xi -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ - -I$(FONTLIBSRC)/include -I$(FONTINCSRC) \ - -I$(XF86SRC) -I$(XF86PARSERSRC) \ - -I$(XF86SRC)/loader $(VGAINCLUDES) -I$(XF86SRC)/rac \ - -I$(XF86SRC)/scanpci -I$(XF86SRC)/vbe -I$(XF86SRC)/int10 \ - -I$(XF86SRC)/ddc -I$(SERVERSRC)/render $(RANDRINCS) - - OSNAME = OSName - OSVENDOR = OSVendor - OSNAMEDEF = -DOSNAME='" $(OSNAME)"' -DOSVENDOR='" $(OSVENDOR)"' -#if defined(XorgCustomVersion) || defined(XFree86CustomVersion) -# if defined(XorgCustomVersion) -CUSTOMVERSION = XorgCustomVersion -# else -CUSTOMVERSION = XFree86CustomVersion -# endif /* XorgCustomVersion */ - CUSTOMVERDEF = -DXORG_CUSTOM_VERSION='$(CUSTOMVERSION)' -#endif /* XorgCustomVersion || XFree86CustomVersion */ -#if defined(BuilderString) - BUILDERSTRING = BuilderString - BUILDERMSG = -DBUILDERSTRING='$(BUILDERSTRING)' -#endif - XORGREL = XOrgReleaseString - XORGREL_DEF = -DXORG_RELEASE="\"$(XORGREL)\"" -#if defined(XorgDateString) - XORGDATE = XorgDateString - XORGDATE_DEF = -DXORG_DATE='$(XORGDATE)' -#endif - -CONSDEFINES = XFree86ConsoleDefines -EXP_DEFINES = -DEXPIRY_TIME=XorgServerExpiry $(EXP_FORCE_DEFINES) - DRIVERS = XF86CardDrivers - IDRIVERS = XInputDrivers -XCONFIGDEFINES = -DPROJECTROOT='"$(PROJECTROOT)"' \ - -DBINDIR='"$(BINDIR)"' \ - -DDRIVERS='"$(DRIVERS)"' \ - -DIDRIVERS='"$(IDRIVERS)"' -XF86CONFIGFILE = XConfigFile -XCONFIGUREDEFINES = -DXF86CONFIGFILE='"$(XF86CONFIGFILE)"' - - DEFINES = $(CONSDEFINES) $(KBDDEFINES) $(EXT_DEFINES) $(OS_DEFINES) \ - $(CONFIG_DEFINES) $(XKBDEFRULESDEFS) $(VENDORSUPPORTDEFS) \ - $(VENDOR_DEFINES) -DXF86PM - -AllTarget($(OFILES)) - -SpecialCObjectRule(xf86Bus,NullParameter,$(BUGMSG) $(VGAINCLUDES)) -SpecialCObjectRule(xf86Init,$(ICONFIGFILES),$(OSNAMEDEF) $(BUILDERMSG) $(BUGMSG) $(CUSTOMVERDEF) $(XORGREL_DEF) $(XORGDATE_DEF) $(EXT_DEFINES) $(MDEBUGDEFS) $(KEYBOARD_DEFS)) -SpecialCObjectRule(xf86Events,$(ICONFIGFILES),$(EXT_DEFINES) $(MDEBUGDEFS) $(BACKTRACE_DEFS)) -SpecialCObjectRule(xf86Globals,$(ICONFIGFILES),$(EXT_DEFINES) $(MODPATHDEFINES) $(LOGDEFINES)) -SpecialCObjectRule(xf86AutoConfig,$(ICONFIGFILES),$(XCONFIGDEFINES)) -SpecialCObjectRule(xf86Config,$(ICONFIGFILES),$(XCONFIGDEFINES) $(KEYBOARD_DEFS)) -SpecialCObjectRule(xf86Configure,$(ICONFIGFILES),$(XCONFIGUREDEFINES) $(KEYBOARD_DEFS)) - -SpecialCObjectRule(xf86IniExt,$(ICONFIGFILES),$(EXT_DEFINES) $(EXT_MODULES_DEFINES)) - -NormalLibraryObjectRule() -NormalLibraryTarget(xf86,$(OBJS)) - -LinkFile(xf86IniExt.c,$(SERVERSRC)/mi/miinitext.c) -LinkSourceFile(xf86Version.h,..) -LinkSourceFile(xorgVersion.h,..) -LinkSourceFile(xf86Pci.h,$(XF86OSSRC)/bus) -#ifdef SparcArchitecture -LinkSourceFile(xf86Sbus.h,$(XF86OSSRC)/bus) -#endif - -#if HasPerl -MODEDEFSRCS = ../etc/vesamodes ../etc/extramodes - -MODEDEFS = modedefs - -$(MODEDEFS): $(MODEDEFSRCS) - RemoveFile($@) - cat $(MODEDEFSRCS) > $@ - -includes:: xf86DefModeSet.c - -xf86DefModeSet.c: $(MODEDEFS) modeline2c.pl - RemoveFile($@) - RunPerlScript(modeline2c.pl, < $(MODEDEFS) > $@) - -clean:: - RemoveFile($(MODEDEFS)) - RemoveFile(xf86DefModeSet.c) -#else -LinkFile(xf86DefModeSet.c,xf86DefModes.c) -#endif - -DependTarget() - -InstallDriverSDKNonExecFile(compiler.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(fourcc.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86Module.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86Opt.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86Pci.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86PciInfo.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86Priv.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86Privstr.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86Resources.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86Version.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xorgVersion.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86Xinput.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86cmap.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86fbman.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86str.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86xv.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86xvmc.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xisb.h,$(DRIVERSDKINCLUDEDIR)) diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/atKeynames.h b/nx-X11/programs/Xserver/hw/xfree86/common/atKeynames.h deleted file mode 100644 index d37f5b0f0..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/atKeynames.h +++ /dev/null @@ -1,298 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.21 2003/10/09 11:43:59 pascal Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* - * Copyright (c) 1994-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* $XConsortium: atKeynames.h /main/11 1996/03/09 11:17:41 kaleb $ */ - -#ifndef _ATKEYNAMES_H -#define _ATKEYNAMES_H - -#define XK_TECHNICAL -#define XK_KATAKANA -#include -#include - -#define GLYPHS_PER_KEY 4 -#define NUM_KEYCODES 248 -#define MIN_KEYCODE 8 -#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1) - -#define AltMask Mod1Mask -#define NumLockMask Mod2Mask -#define AltLangMask Mod3Mask -#define KanaMask Mod4Mask -#define ScrollLockMask Mod5Mask - -#define KeyPressed(k) (keyc->down[k >> 3] & (1 << (k & 7))) -#define ModifierDown(k) ((keyc->state & (k)) == (k)) - -/* - * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three) - * sets of scancodes. Set3 can only be generated by a MF keyboard. - * Set2 sends a makecode for keypress, and the same code prefixed by a - * F0 for keyrelease. This is a little bit ugly to handle. Thus we use - * here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes. - * Bit 7 ist set if the key is released. The code E0 switches to a - * different meaning to add the new MF cursorkeys, while not breaking old - * applications. E1 is another special prefix. Since I assume that there - * will be further versions of PC/XT scancode compatible keyboards, we - * may be in trouble one day. - * - * IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3. - * 2) Use the keyboards native set and translate it to common keysyms. - */ - -/* - * definition of the AT84/MF101/MF102 Keyboard: - * ============================================================ - * Defined Key Cap Glyphs Pressed value - * Key Name Main Also (hex) (dec) - * ---------------- ---------- ------- ------ ------ - */ - -#define KEY_Escape /* Escape 0x01 */ 1 -#define KEY_1 /* 1 ! 0x02 */ 2 -#define KEY_2 /* 2 @ 0x03 */ 3 -#define KEY_3 /* 3 # 0x04 */ 4 -#define KEY_4 /* 4 $ 0x05 */ 5 -#define KEY_5 /* 5 % 0x06 */ 6 -#define KEY_6 /* 6 ^ 0x07 */ 7 -#define KEY_7 /* 7 & 0x08 */ 8 -#define KEY_8 /* 8 * 0x09 */ 9 -#define KEY_9 /* 9 ( 0x0a */ 10 -#define KEY_0 /* 0 ) 0x0b */ 11 -#define KEY_Minus /* - (Minus) _ (Under) 0x0c */ 12 -#define KEY_Equal /* = (Equal) + 0x0d */ 13 -#define KEY_BackSpace /* Back Space 0x0e */ 14 -#define KEY_Tab /* Tab 0x0f */ 15 -#define KEY_Q /* Q 0x10 */ 16 -#define KEY_W /* W 0x11 */ 17 -#define KEY_E /* E 0x12 */ 18 -#define KEY_R /* R 0x13 */ 19 -#define KEY_T /* T 0x14 */ 20 -#define KEY_Y /* Y 0x15 */ 21 -#define KEY_U /* U 0x16 */ 22 -#define KEY_I /* I 0x17 */ 23 -#define KEY_O /* O 0x18 */ 24 -#define KEY_P /* P 0x19 */ 25 -#define KEY_LBrace /* [ { 0x1a */ 26 -#define KEY_RBrace /* ] } 0x1b */ 27 -#define KEY_Enter /* Enter 0x1c */ 28 -#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29 -#define KEY_A /* A 0x1e */ 30 -#define KEY_S /* S 0x1f */ 31 -#define KEY_D /* D 0x20 */ 32 -#define KEY_F /* F 0x21 */ 33 -#define KEY_G /* G 0x22 */ 34 -#define KEY_H /* H 0x23 */ 35 -#define KEY_J /* J 0x24 */ 36 -#define KEY_K /* K 0x25 */ 37 -#define KEY_L /* L 0x26 */ 38 -#define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x27 */ 39 -#define KEY_Quote /* ' (Apostr) " (Quote) 0x28 */ 40 -#define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x29 */ 41 -#define KEY_ShiftL /* Shift(left) 0x2a */ 42 -#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 43 -#define KEY_Z /* Z 0x2c */ 44 -#define KEY_X /* X 0x2d */ 45 -#define KEY_C /* C 0x2e */ 46 -#define KEY_V /* V 0x2f */ 47 -#define KEY_B /* B 0x30 */ 48 -#define KEY_N /* N 0x31 */ 49 -#define KEY_M /* M 0x32 */ 50 -#define KEY_Comma /* , (Comma) < (Less) 0x33 */ 51 -#define KEY_Period /* . (Period) >(Greater)0x34 */ 52 -#define KEY_Slash /* / (Slash) ? 0x35 */ 53 -#define KEY_ShiftR /* Shift(right) 0x36 */ 54 -#define KEY_KP_Multiply /* * 0x37 */ 55 -#define KEY_Alt /* Alt(left) 0x38 */ 56 -#define KEY_Space /* (SpaceBar) 0x39 */ 57 -#define KEY_CapsLock /* CapsLock 0x3a */ 58 -#define KEY_F1 /* F1 0x3b */ 59 -#define KEY_F2 /* F2 0x3c */ 60 -#define KEY_F3 /* F3 0x3d */ 61 -#define KEY_F4 /* F4 0x3e */ 62 -#define KEY_F5 /* F5 0x3f */ 63 -#define KEY_F6 /* F6 0x40 */ 64 -#define KEY_F7 /* F7 0x41 */ 65 -#define KEY_F8 /* F8 0x42 */ 66 -#define KEY_F9 /* F9 0x43 */ 67 -#define KEY_F10 /* F10 0x44 */ 68 -#define KEY_NumLock /* NumLock 0x45 */ 69 -#define KEY_ScrollLock /* ScrollLock 0x46 */ 70 -#define KEY_KP_7 /* 7 Home 0x47 */ 71 -#define KEY_KP_8 /* 8 Up 0x48 */ 72 -#define KEY_KP_9 /* 9 PgUp 0x49 */ 73 -#define KEY_KP_Minus /* - (Minus) 0x4a */ 74 -#define KEY_KP_4 /* 4 Left 0x4b */ 75 -#define KEY_KP_5 /* 5 0x4c */ 76 -#define KEY_KP_6 /* 6 Right 0x4d */ 77 -#define KEY_KP_Plus /* + (Plus) 0x4e */ 78 -#define KEY_KP_1 /* 1 End 0x4f */ 79 -#define KEY_KP_2 /* 2 Down 0x50 */ 80 -#define KEY_KP_3 /* 3 PgDown 0x51 */ 81 -#define KEY_KP_0 /* 0 Insert 0x52 */ 82 -#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83 -#define KEY_SysReqest /* SysReqest 0x54 */ 84 - /* NOTUSED 0x55 */ -#define KEY_Less /* < (Less) >(Greater) 0x56 */ 86 -#define KEY_F11 /* F11 0x57 */ 87 -#define KEY_F12 /* F12 0x58 */ 88 - -#define KEY_Prefix0 /* special 0x60 */ 96 -#define KEY_Prefix1 /* specail 0x61 */ 97 - -/* - * The 'scancodes' below are generated by the server, because the MF101/102 - * keyboard sends them as sequence of other scancodes - */ -#define KEY_Home /* Home 0x59 */ 89 -#define KEY_Up /* Up 0x5a */ 90 -#define KEY_PgUp /* PgUp 0x5b */ 91 -#define KEY_Left /* Left 0x5c */ 92 -#define KEY_Begin /* Begin 0x5d */ 93 -#define KEY_Right /* Right 0x5e */ 94 -#define KEY_End /* End 0x5f */ 95 -#define KEY_Down /* Down 0x60 */ 96 -#define KEY_PgDown /* PgDown 0x61 */ 97 -#define KEY_Insert /* Insert 0x62 */ 98 -#define KEY_Delete /* Delete 0x63 */ 99 -#define KEY_KP_Enter /* Enter 0x64 */ 100 -#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101 -#define KEY_Pause /* Pause 0x66 */ 102 -#define KEY_Print /* Print 0x67 */ 103 -#define KEY_KP_Divide /* Divide 0x68 */ 104 -#define KEY_AltLang /* AtlLang(right) 0x69 */ 105 -#define KEY_Break /* Break 0x6a */ 106 -#define KEY_LMeta /* Left Meta 0x6b */ 107 -#define KEY_RMeta /* Right Meta 0x6c */ 108 -#define KEY_Menu /* Menu 0x6d */ 109 -#define KEY_F13 /* F13 0x6e */ 110 -#define KEY_F14 /* F14 0x6f */ 111 -#define KEY_F15 /* F15 0x70 */ 112 -#define KEY_HKTG /* Hirugana/Katakana tog 0x70 */ 112 -#define KEY_F16 /* F16 0x71 */ 113 -#define KEY_F17 /* F17 0x72 */ 114 -#define KEY_KP_DEC /* KP_DEC 0x73 */ 115 -#define KEY_BSlash2 /* \ _ 0x73 */ 115 -#define KEY_KP_Equal /* Equal (Keypad) 0x76 */ 118 -#define KEY_XFER /* Kanji Transfer 0x79 */ 121 -#define KEY_NFER /* No Kanji Transfer 0x7b */ 123 -#define KEY_Yen /* Yen 0x7d */ 125 - -#define KEY_Power /* Power Key 0x84 */ 132 -#define KEY_Mute /* Audio Mute 0x85 */ 133 -#define KEY_AudioLower /* Audio Lower 0x86 */ 134 -#define KEY_AudioRaise /* Audio Raise 0x87 */ 135 -#define KEY_Help /* Help 0x88 */ 136 -#define KEY_L1 /* Stop 0x89 */ 137 -#define KEY_L2 /* Again 0x8a */ 138 -#define KEY_L3 /* Props 0x8b */ 139 -#define KEY_L4 /* Undo 0x8c */ 140 -#define KEY_L5 /* Front 0x8d */ 141 -#define KEY_L6 /* Copy 0x8e */ 142 -#define KEY_L7 /* Open 0x8f */ 143 -#define KEY_L8 /* Paste 0x90 */ 144 -#define KEY_L9 /* Find 0x91 */ 145 -#define KEY_L10 /* Cut 0x92 */ 146 - -/* - * Fake 'scancodes' in the following ranges are generated for 2-byte - * codes not handled elsewhere. These correspond to most extended keys - * on so-called "Internet" keyboards: - * - * 0x79-0x93 - * 0x96-0xa1 - * 0xa3-0xac - * 0xb1-0xb4 - * 0xba-0xbd - * 0xc2 - * 0xcc-0xd2 - * 0xd6-0xf7 - */ - -/* - * Remapped 'scancodes' are generated for single-byte codes in the range - * 0x59-0x5f,0x62-0x76. These are used for some extra keys on some keyboards. - */ - -#define KEY_0x59 0x95 -#define KEY_0x5A 0xA2 -#define KEY_0x5B 0xAD -#define KEY_0x5C KEY_KP_EQUAL -#define KEY_0x5D 0xAE -#define KEY_0x5E 0xAF -#define KEY_0x5F 0xB0 -#define KEY_0x62 0xB5 -#define KEY_0x63 0xB6 -#define KEY_0x64 0xB7 -#define KEY_0x65 0xB8 -#define KEY_0x66 0xB9 -#define KEY_0x67 0xBE -#define KEY_0x68 0xBF -#define KEY_0x69 0xC0 -#define KEY_0x6A 0xC1 -#define KEY_0x6B 0xC3 -#define KEY_0x6C 0xC4 -#define KEY_0x6D 0xC5 -#define KEY_0x6E 0xC6 -#define KEY_0x6F 0xC7 -#define KEY_0x70 0xC8 -#define KEY_0x71 0xC9 -#define KEY_0x72 0xCA -#define KEY_0x73 0xCB -#define KEY_0x74 0xD3 -#define KEY_0x75 0xD4 -#define KEY_0x76 0xD5 - -/* These are for "notused" and "unknown" entries in translation maps. */ -#define KEY_NOTUSED 0 -#define KEY_UNKNOWN 255 - -#endif /* _ATKEYNAMES_H */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/fourcc.h b/nx-X11/programs/Xserver/hw/xfree86/common/fourcc.h deleted file mode 100644 index e60aa4e83..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/fourcc.h +++ /dev/null @@ -1,161 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/fourcc.h,v 1.5 2003/08/24 17:36:48 dawes Exp $ */ - -/* - * Copyright (c) 2000-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - This header file contains listings of STANDARD guids for video formats. - Please do not place non-registered, or incomplete entries in this file. - A list of some popular fourcc's are at: http://www.webartz.com/fourcc/ - For an explanation of fourcc <-> guid mappings see RFC2361. -*/ - -#ifndef _XF86_FOURCC_H_ -#define _XF86_FOURCC_H_ 1 - -#define FOURCC_YUY2 0x32595559 -#define XVIMAGE_YUY2 \ - { \ - FOURCC_YUY2, \ - XvYUV, \ - LSBFirst, \ - {'Y','U','Y','2', \ - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ - 16, \ - XvPacked, \ - 1, \ - 0, 0, 0, 0, \ - 8, 8, 8, \ - 1, 2, 2, \ - 1, 1, 1, \ - {'Y','U','Y','V', \ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ - XvTopToBottom \ - } - -#define FOURCC_YV12 0x32315659 -#define XVIMAGE_YV12 \ - { \ - FOURCC_YV12, \ - XvYUV, \ - LSBFirst, \ - {'Y','V','1','2', \ - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ - 12, \ - XvPlanar, \ - 3, \ - 0, 0, 0, 0, \ - 8, 8, 8, \ - 1, 2, 2, \ - 1, 2, 2, \ - {'Y','V','U', \ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ - XvTopToBottom \ - } - -#define FOURCC_I420 0x30323449 -#define XVIMAGE_I420 \ - { \ - FOURCC_I420, \ - XvYUV, \ - LSBFirst, \ - {'I','4','2','0', \ - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ - 12, \ - XvPlanar, \ - 3, \ - 0, 0, 0, 0, \ - 8, 8, 8, \ - 1, 2, 2, \ - 1, 2, 2, \ - {'Y','U','V', \ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ - XvTopToBottom \ - } - - -#define FOURCC_UYVY 0x59565955 -#define XVIMAGE_UYVY \ - { \ - FOURCC_UYVY, \ - XvYUV, \ - LSBFirst, \ - {'U','Y','V','Y', \ - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ - 16, \ - XvPacked, \ - 1, \ - 0, 0, 0, 0, \ - 8, 8, 8, \ - 1, 2, 2, \ - 1, 1, 1, \ - {'U','Y','V','Y', \ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ - XvTopToBottom \ - } - -#define FOURCC_IA44 0x34344149 -#define XVIMAGE_IA44 \ - { \ - FOURCC_IA44, \ - XvYUV, \ - LSBFirst, \ - {'I','A','4','4', \ - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ - 8, \ - XvPacked, \ - 1, \ - 0, 0, 0, 0, \ - 8, 8, 8, \ - 1, 1, 1, \ - 1, 1, 1, \ - {'A','I', \ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ - XvTopToBottom \ - } - -#define FOURCC_AI44 0x34344941 -#define XVIMAGE_AI44 \ - { \ - FOURCC_AI44, \ - XvYUV, \ - LSBFirst, \ - {'A','I','4','4', \ - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ - 8, \ - XvPacked, \ - 1, \ - 0, 0, 0, 0, \ - 8, 8, 8, \ - 1, 1, 1, \ - 1, 1, 1, \ - {'I','A', \ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ - XvTopToBottom \ - } - -#endif /* _XF86_FOURCC_H_ */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/modeline2c.pl b/nx-X11/programs/Xserver/hw/xfree86/common/modeline2c.pl deleted file mode 100644 index cc6c6925e..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/modeline2c.pl +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/perl - -# automatically generate the xf86DefModeSet.c file from a normal -# XF86Config style file of Modelines -# -# run as -# -# perl /modeline2c.pl < [modesfile] > xf86DefModes.c -# -# hackish perl - author Dirk Hohndel -# -# Copyright 1999-2003 by The XFree86 Project, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR -# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the copyright holder(s) -# and author(s) shall not be used in advertising or otherwise to promote -# the sale, use or other dealings in this Software without prior written -# authorization from the copyright holder(s) and author(s). -# -# $XFree86: xc/programs/Xserver/hw/xfree86/common/modeline2c.pl,v 1.10tsi Exp $ - -#my %flagshash; -$flagshash{""} = "0"; -# $flagshash{"Interlace"} = "V_INTERLACE"; -# $flagshash{"+hsync"} = "V_PHSYNC"; -# $flagshash{"-hsync"} = "V_NHSYNC"; -# $flagshash{"+vsync"} = "V_PVSYNC"; -# $flagshash{"-vsync"} = "V_NVSYNC"; -# XXX I'm definitely not a perl guru... -- tsi -$flagshash{"+hsync +vsync"} = "V_PHSYNC | V_PVSYNC"; -$flagshash{"+hsync -vsync"} = "V_PHSYNC | V_NVSYNC"; -$flagshash{"-hsync +vsync"} = "V_NHSYNC | V_PVSYNC"; -$flagshash{"-hsync -vsync"} = "V_NHSYNC | V_NVSYNC"; -$flagshash{"+hsync +vsync interlace"} = "V_PHSYNC | V_PVSYNC | V_INTERLACE"; -$flagshash{"+hsync -vsync interlace"} = "V_PHSYNC | V_NVSYNC | V_INTERLACE"; -$flagshash{"-hsync +vsync interlace"} = "V_NHSYNC | V_PVSYNC | V_INTERLACE"; -$flagshash{"-hsync -vsync interlace"} = "V_NHSYNC | V_NVSYNC | V_INTERLACE"; - -# stop CVS from expanding the XFree86 Id here... - -$proj = "XFree86"; -printf("/* \$$proj\$ */ - -/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at - * modeline2c.pl */ - -/* - * Copyright 1999-2003 by The XFree86 Project, Inc. - * - * Author: Dirk Hohndel - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifdef __UNIXOS2__ -#define I_NEED_OS2_H -#endif -#include \"xf86.h\" -#include \"xf86Config.h\" -#include \"xf86Priv.h\" -#include \"xf86_OSlib.h\" - -#include \"globals.h\" - -#define MODEPREFIX(name) NULL, NULL, name, MODE_OK, M_T_DEFAULT -#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0 - -DisplayModeRec xf86DefaultModes [] = { -"); -while (<>) { - if (/^\#/) { - s/^\#//; - chop; - print "/*" . $_ . " */\n"; - } - if (/^ModeLine\s+(\S+)\s+([\d.\s]+)(.*)/i) { - $name = $1; - $values = $2; - $flags = $3; - $flags =~ y/A-Z/a-z/; - $values =~ /([\d.]+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/; - printf("\t{MODEPREFIX(%s),%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n", - $name,$1*1000,$2,$3,$4,$5,$6,$7,$8,$9,$flagshash{$flags}); -# Also generate half-width doublescanned modes - printf("\t{MODEPREFIX(\"%dx%d\"),%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s | V_DBLSCAN, MODESUFFIX},\n", - $2/2,$6/2,$1*500,$2/2,$3/2,$4/2,$5/2,$6/2,$7/2,$8/2,$9/2,$flagshash{$flags}); - } - - -} -printf("\t{MODEPREFIX(NULL),0,0,0,0,0,0,0,0,0,0,0,0,MODESUFFIX}\n};\n"); diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/scoasm.h b/nx-X11/programs/Xserver/hw/xfree86/common/scoasm.h deleted file mode 100644 index 5a5af8eb9..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/scoasm.h +++ /dev/null @@ -1,143 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/scoasm.h,v 3.1 2003/08/24 17:36:49 dawes Exp $ */ - -/* - * Copyright (c) 1996 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * scoasm.h - used to define inline versions of certain functions which - * do NOT appear in sys/inline.h. - */ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#if defined(__SCO__) && defined(__USLC__) -#ifndef _SCOASM_HDR_INC -#define _SCOASM_HDR_INC - -asm void outl(port,val) -{ -%reg port,val; - movl port, %edx - movl val, %eax - outl (%dx) -%reg port; mem val; - movl port, %edx - movl val, %eax - outl (%dx) -%mem port; reg val; - movw port, %dx - movl val, %eax - outl (%dx) -%mem port,val; - movw port, %dx - movl val, %eax - outl (%dx) -} - -asm void outw(port,val) -{ -%reg port,val; - movl port, %edx - movl val, %eax - data16 - outl (%dx) -%reg port; mem val; - movl port, %edx - movw val, %ax - data16 - outl (%dx) -%mem port; reg val; - movw port, %dx - movl val, %eax - data16 - outl (%dx) -%mem port,val; - movw port, %dx - movw val, %ax - data16 - outl (%dx) -} - -asm void outb(port,val) -{ -%reg port,val; - movl port, %edx - movl val, %eax - outb (%dx) -%reg port; mem val; - movl port, %edx - movb val, %al - outb (%dx) -%mem port; reg val; - movw port, %dx - movl val, %eax - outb (%dx) -%mem port,val; - movw port, %dx - movb val, %al - outb (%dx) -} - -asm int inl(port) -{ -%reg port; - movl port, %edx - inl (%dx) -%mem port; - movw port, %dx - inl (%dx) -} - -asm int inw(port) -{ -%reg port; - subl %eax, %eax - movl port, %edx - data16 - inl (%dx) -%mem port; - subl %eax, %eax - movw port, %dx - data16 - inl (%dx) -} - -asm int inb(port) -{ -%reg port; - subl %eax, %eax - movl port, %edx - inb (%dx) -%mem port; - subl %eax, %eax - movw port, %dx - inb (%dx) -} - -#endif /* _SCOASM_HDR_INC */ -#endif /* __SCO__ && __USLC__ */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86.h deleted file mode 100644 index 010360cf3..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86.h +++ /dev/null @@ -1,447 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.173 2004/01/27 01:31:44 dawes Exp $ */ - -/* - * Copyright (c) 1997-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * This file contains declarations for public XFree86 functions and variables, - * and definitions of public macros. - * - * "public" means available to video drivers. - */ - -#ifndef _XF86_H -#define _XF86_H - -#include "xf86str.h" -#include "xf86Opt.h" -#include -#ifndef IN_MODULE -#include -#else -#include "xf86_ansic.h" -#endif -#ifdef RANDR -#include -#endif - -#include "propertyst.h" - -/* General parameters */ -extern int xf86DoConfigure; -extern Bool xf86DoConfigurePass1; -extern int xf86ScreenIndex; /* Index into pScreen.devPrivates */ -extern int xf86CreateRootWindowIndex; /* Index into pScreen.devPrivates */ -extern int xf86PixmapIndex; -extern Bool xf86ResAccessEnter; -extern ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */ -extern const unsigned char byte_reversed[256]; -extern ScrnInfoPtr xf86CurrentScreen; -extern Bool pciSlotClaimed; -extern Bool isaSlotClaimed; -extern Bool fbSlotClaimed; -#ifdef __sparc__ -extern Bool sbusSlotClaimed; -#endif -extern confDRIRec xf86ConfigDRI; -extern Bool xf86inSuspend; - -#define XF86SCRNINFO(p) ((ScrnInfoPtr)((p)->devPrivates[xf86ScreenIndex].ptr)) - -#define XF86FLIP_PIXELS() \ - do { \ - if (xf86GetFlipPixels()) { \ - pScreen->whitePixel = (pScreen->whitePixel) ? 0 : 1; \ - pScreen->blackPixel = (pScreen->blackPixel) ? 0 : 1; \ - } \ - while (0) - -#define BOOLTOSTRING(b) ((b) ? "TRUE" : "FALSE") - -#define PIX24TOBPP(p) (((p) == Pix24Use24) ? 24 : \ - (((p) == Pix24Use32) ? 32 : 0)) - -/* variables for debugging */ -#ifdef BUILDDEBUG -extern char* xf86p8bit[]; -extern CARD32 xf86DummyVar1; -extern CARD32 xf86DummyVar2; -extern CARD32 xf86DummyVar3; -#endif - -/* Function Prototypes */ -#ifndef _NO_XF86_PROTOTYPES - -/* xf86Bus.c */ - -Bool xf86CheckPciSlot(int bus, int device, int func); -int xf86ClaimPciSlot(int bus, int device, int func, DriverPtr drvp, - int chipset, GDevPtr dev, Bool active); -Bool xf86ParsePciBusString(const char *busID, int *bus, int *device, - int *func); -Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func); -void xf86FormatPciBusNumber(int busnum, char *buffer); -pciVideoPtr *xf86GetPciVideoInfo(void); -pciConfigPtr *xf86GetPciConfigInfo(void); -void xf86SetPciVideo(pciVideoPtr, resType); -void xf86PrintResList(int verb, resPtr list); -resPtr xf86AddRangesToList(resPtr list, resRange *pRange, int entityIndex); -int xf86ClaimIsaSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active); -int xf86GetIsaInfoForScreen(int scrnIndex); -int xf86GetFbInfoForScreen(int scrnIndex); -Bool xf86ParseIsaBusString(const char *busID); -int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active); -int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active); -void xf86EnableAccess(ScrnInfoPtr pScrn); -void xf86SetCurrentAccess(Bool Enable, ScrnInfoPtr pScrn); -Bool xf86IsPrimaryPci(pciVideoPtr pPci); -Bool xf86IsPrimaryIsa(void); -int xf86CheckPciGAType(pciVideoPtr pPci); -/* new RAC */ -resPtr xf86AddResToList(resPtr rlist, resRange *Range, int entityIndex); -resPtr xf86JoinResLists(resPtr rlist1, resPtr rlist2); -resPtr xf86DupResList(const resPtr rlist); -void xf86FreeResList(resPtr rlist); -void xf86ClaimFixedResources(resList list, int entityIndex); -Bool xf86DriverHasEntities(DriverPtr drvp); -void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex); -void xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex, - int instance); -int xf86GetNumEntityInstances(int entityIndex); -GDevPtr xf86GetDevFromEntity(int entityIndex, int instance); -void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex); -EntityInfoPtr xf86GetEntityInfo(int entityIndex); -pciVideoPtr xf86GetPciInfoForEntity(int entityIndex); -int xf86GetPciEntity(int bus, int dev, int func); -Bool xf86SetEntityFuncs(int entityIndex, EntityProc init, - EntityProc enter, EntityProc leave, pointer); -void xf86DeallocateResourcesForEntity(int entityIndex, unsigned long type); -resPtr xf86RegisterResources(int entityIndex, resList list, - unsigned long Access); -Bool xf86CheckPciMemBase(pciVideoPtr pPci, memType base); -void xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86SetAccessFuncPtr funcs, - xf86SetAccessFuncPtr oldFuncs); -Bool xf86IsEntityPrimary(int entityIndex); -Bool xf86FixPciResource(int entityIndex, int prt, memType alignment, - unsigned long type); -resPtr xf86ReallocatePciResources(int entityIndex, resPtr pRes); -resPtr xf86SetOperatingState(resList list, int entityIndex, int mask); -void xf86EnterServerState(xf86State state); -resRange xf86GetBlock(unsigned long type, memType size, - memType window_start, memType window_end, - memType align_mask, resPtr avoid); -resRange xf86GetSparse(unsigned long type, memType fixed_bits, - memType decode_mask, memType address_mask, - resPtr avoid); -memType xf86ChkConflict(resRange *rgp, int entityIndex); -Bool xf86IsPciDevPresent(int bus, int dev, int func); -ScrnInfoPtr xf86FindScreenForEntity(int entityIndex); -Bool xf86NoSharedResources(int screenIndex, resType res); -resPtr xf86FindIntersectOfLists(resPtr l1, resPtr l2); -pciVideoPtr xf86FindPciDeviceVendor(CARD16 vendorID, CARD16 deviceID, - char n, pciVideoPtr pvp_exclude); -pciVideoPtr xf86FindPciClass(CARD8 intf, CARD8 subClass, CARD16 class, - char n, pciVideoPtr pvp_exclude); -#ifdef INCLUDE_DEPRECATED -void xf86EnablePciBusMaster(pciVideoPtr pPci, Bool enable); -#endif -void xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg); -Bool xf86DeregisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func); -#ifdef async -Bool xf86QueueAsyncEvent(void (*func)(pointer),pointer arg); -#endif - -int xf86GetLastScrnFlag(int entityIndex); -void xf86SetLastScrnFlag(int entityIndex, int scrnIndex); -Bool xf86IsEntityShared(int entityIndex); -void xf86SetEntityShared(int entityIndex); -Bool xf86IsEntitySharable(int entityIndex); -void xf86SetEntitySharable(int entityIndex); -Bool xf86IsPrimInitDone(int entityIndex); -void xf86SetPrimInitDone(int entityIndex); -void xf86ClearPrimInitDone(int entityIndex); -int xf86AllocateEntityPrivateIndex(void); -DevUnion *xf86GetEntityPrivate(int entityIndex, int privIndex); - -/* xf86Configure.c */ -GDevPtr xf86AddBusDeviceToConfigure(const char *driver, BusType bus, - void *busData, int chipset); -GDevPtr xf86AddDeviceToConfigure(const char *driver, pciVideoPtr pVideo, - int chipset); - -/* xf86Cursor.c */ - -void xf86LockZoom(ScreenPtr pScreen, int lock); -void xf86InitViewport(ScrnInfoPtr pScr); -void xf86SetViewport(ScreenPtr pScreen, int x, int y); -void xf86ZoomViewport(ScreenPtr pScreen, int zoom); -Bool xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode); -void *xf86GetPointerScreenFuncs(void); -void xf86InitOrigins(void); -void xf86ReconfigureLayout(void); - -/* xf86DPMS.c */ - -Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags); - -/* xf86DGA.c */ - -Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes, - int num); -Bool DGAReInitModes(ScreenPtr pScreen, DGAModePtr modes, int num); -xf86SetDGAModeProc xf86SetDGAMode; - -/* xf86Events.c */ - -void SetTimeSinceLastInputEvent(void); -pointer xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data); -int xf86RemoveInputHandler(pointer handler); -void xf86DisableInputHandler(pointer handler); -void xf86EnableInputHandler(pointer handler); -void xf86InterceptSignals(int *signo); -void xf86InterceptSigIll(void (*sigillhandler)(void)); -Bool xf86EnableVTSwitch(Bool new); -Bool xf86CommonSpecialKey(int key, Bool down, int modifiers); -void xf86ProcessActionEvent(ActionEvent action, void *arg); - -/* xf86Helper.c */ - -void xf86AddDriver(DriverPtr driver, pointer module, int flags); -void xf86DeleteDriver(int drvIndex); -ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags); -void xf86DeleteScreen(int scrnIndex, int flags); -int xf86AllocateScrnInfoPrivateIndex(void); -Bool xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad); -Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int bpp, int fbbpp, - int depth24flags); -void xf86PrintDepthBpp(ScrnInfoPtr scrp); -Bool xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask); -Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual); -Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma newGamma); -void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y); -void xf86SetBlackWhitePixels(ScreenPtr pScreen); -void xf86EnableDisableFBAccess(int scrnIndex, Bool enable); -void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, - const char *format, va_list args); -void xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb, - const char *format, ...) _printf_attribute(4,5); -void xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...) - _printf_attribute(3,4); -void xf86MsgVerb(MessageType type, int verb, const char *format, ...) - _printf_attribute(3,4); -void xf86Msg(MessageType type, const char *format, ...) _printf_attribute(2,3); -void xf86ErrorFVerb(int verb, const char *format, ...) _printf_attribute(2,3); -void xf86ErrorF(const char *format, ...) _printf_attribute(1,2); -const char *xf86TokenToString(SymTabPtr table, int token); -int xf86StringToToken(SymTabPtr table, const char *string); -void xf86ShowClocks(ScrnInfoPtr scrp, MessageType from); -void xf86PrintChipsets(const char *drvname, const char *drvmsg, - SymTabPtr chips); -int xf86MatchDevice(const char *drivername, GDevPtr **driversectlist); -int xf86MatchPciInstances(const char *driverName, int vendorID, - SymTabPtr chipsets, PciChipsets *PCIchipsets, - GDevPtr *devList, int numDevs, DriverPtr drvp, - int **foundEntities); -int xf86MatchIsaInstances(const char *driverName, SymTabPtr chipsets, - IsaChipsets *ISAchipsets, DriverPtr drvp, - FindIsaDevProc FindIsaDevice, GDevPtr *devList, - int numDevs, int **foundEntities); -void xf86GetClocks(ScrnInfoPtr pScrn, int num, - Bool (*ClockFunc)(ScrnInfoPtr, int), - void (*ProtectRegs)(ScrnInfoPtr, Bool), - void (*BlankScreen)(ScrnInfoPtr, Bool), - IOADDRESS vertsyncreg, int maskval, - int knownclkindex, int knownclkvalue); -void xf86SetPriority(Bool up); -const char *xf86GetVisualName(int visual); -int xf86GetVerbosity(void); -Pix24Flags xf86GetPix24(void); -int xf86GetDepth(void); -rgb xf86GetWeight(void); -Gamma xf86GetGamma(void); -Bool xf86GetFlipPixels(void); -const char *xf86GetServerName(void); -Bool xf86ServerIsExiting(void); -Bool xf86ServerIsResetting(void); -Bool xf86ServerIsInitialising(void); -Bool xf86ServerIsOnlyDetecting(void); -Bool xf86ServerIsOnlyProbing(void); -Bool xf86CaughtSignal(void); -Bool xf86GetVidModeAllowNonLocal(void); -Bool xf86GetVidModeEnabled(void); -Bool xf86GetModInDevAllowNonLocal(void); -Bool xf86GetModInDevEnabled(void); -Bool xf86GetAllowMouseOpenFail(void); -Bool xf86IsPc98(void); -void xf86DisableRandR(void); -CARD32 xf86GetVersion(void); -CARD32 xorgGetVersion(void); -CARD32 xf86GetModuleVersion(pointer module); -pointer xf86LoadDrvSubModule(DriverPtr drv, const char *name); -pointer xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name); -pointer xf86LoadOneModule(char *name, pointer optlist); -void xf86UnloadSubModule(pointer mod); -Bool xf86LoaderCheckSymbol(const char *name); -void xf86LoaderReqSymLists(const char **, ...); -void xf86LoaderReqSymbols(const char *, ...); -void xf86LoaderRefSymLists(const char **, ...); -void xf86LoaderRefSymbols(const char *, ...); -void xf86SetBackingStore(ScreenPtr pScreen); -void xf86SetSilkenMouse(ScreenPtr pScreen); -int xf86NewSerialNumber(WindowPtr p, pointer unused); -pointer xf86FindXvOptions(int scrnIndex, int adapt_index, char *port_name, - char **adaptor_name, pointer *adaptor_options); -void xf86GetOS(const char **name, int *major, int *minor, int *teeny); -ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, - int entityIndex,PciChipsets *p_chip, - resList res, EntityProc init, - EntityProc enter, EntityProc leave, - pointer private); -ScrnInfoPtr xf86ConfigIsaEntity(ScrnInfoPtr pScrn, int scrnFlag, - int entityIndex, IsaChipsets *i_chip, - resList res, EntityProc init, - EntityProc enter, EntityProc leave, - pointer private); -ScrnInfoPtr xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, - int entityIndex, EntityProc init, - EntityProc enter, EntityProc leave, - pointer private); -/* Obsolete! don't use */ -Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, - int entityIndex,PciChipsets *p_chip, - resList res, EntityProc init, - EntityProc enter, EntityProc leave, - pointer private); -/* Obsolete! don't use */ -Bool xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn, - int entityIndex, IsaChipsets *i_chip, - resList res, EntityProc init, - EntityProc enter, EntityProc leave, - pointer private); -void xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip, - resList res, EntityProc init, - EntityProc enter, EntityProc leave, - pointer private); -void xf86ConfigIsaEntityInactive(EntityInfoPtr pEnt, IsaChipsets *i_chip, - resList res, EntityProc init, - EntityProc enter, EntityProc leave, - pointer private); -void xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init, - EntityProc enter, EntityProc leave, - pointer private); -Bool xf86IsScreenPrimary(int scrnIndex); -int xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type, - int format, unsigned long len, - pointer value); -Bool xf86IsUnblank(int mode); - -#ifdef XFree86LOADER -void xf86AddModuleInfo(ModuleInfoPtr info, pointer module); -void xf86DeleteModuleInfo(int idx); -#endif - -/* xf86Debug.c */ -#ifdef BUILDDEBUG - void xf86Break1(void); -void xf86Break2(void); -void xf86Break3(void); -CARD8 xf86PeekFb8(CARD8 *p); -CARD16 xf86PeekFb16(CARD16 *p); -CARD32 xf86PeekFb32(CARD32 *p); -void xf86PokeFb8(CARD8 *p, CARD8 v); -void xf86PokeFb16(CARD16 *p, CARD16 v); -void xf86PokeFb32(CARD16 *p, CARD32 v); -CARD8 xf86PeekMmio8(pointer Base, unsigned long Offset); -CARD16 xf86PeekMmio16(pointer Base, unsigned long Offset); -CARD32 xf86PeekMmio32(pointer Base, unsigned long Offset); -void xf86PokeMmio8(pointer Base, unsigned long Offset, CARD8 v); -void xf86PokeMmio16(pointer Base, unsigned long Offset, CARD16 v); -void xf86PokeMmio32(pointer Base, unsigned long Offset, CARD32 v); -extern void xf86SPTimestamp(xf86TsPtr* timestamp, char* string); -extern void xf86STimestamp(xf86TsPtr* timestamp); -#endif - -/* xf86Init.c */ - -PixmapFormatPtr xf86GetPixFormat(ScrnInfoPtr pScrn, int depth); -int xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth); - -/* xf86Mode.c */ - -int xf86GetNearestClock(ScrnInfoPtr scrp, int freq, Bool allowDiv2, - int DivFactor, int MulFactor, int *divider); -const char *xf86ModeStatusToString(ModeStatus status); -ModeStatus xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep, - ClockRangePtr clockRanges, LookupModeFlags strategy); -ModeStatus xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor); -ModeStatus xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, - ClockRangePtr clockRanges, - LookupModeFlags strategy, - int maxPitch, int virtualX, - int virtualY); -ModeStatus xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, - int flags); -int xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, - char **modeNames, ClockRangePtr clockRanges, - int *linePitches, int minPitch, int maxPitch, - int minHeight, int maxHeight, int pitchInc, - int virtualX, int virtualY, int apertureSize, - LookupModeFlags strategy); -void xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode); -void xf86PruneDriverModes(ScrnInfoPtr scrp); -void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags); -void xf86PrintModes(ScrnInfoPtr scrp); -void xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges); - -/* xf86Option.c */ - -void xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts); - - -/* xf86RandR.c */ -#ifdef RANDR -Bool xf86RandRInit (ScreenPtr pScreen); -void xf86RandRSetInitialMode (ScreenPtr pScreen); -Rotation xf86GetRotation(ScreenPtr pScreen); -Bool xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen, - int newvirtX, int newvirtY, - int newmmWidth, int newmmHeight, Bool resetMode); -#endif - -/* xf86VidModeExtentionInit.c */ - -Bool VidModeExtensionInit(ScreenPtr pScreen); - -/* xf86Versions.c */ -CARD32 xf86GetBuiltinInterfaceVersion(BuiltinInterface iface, int flag); -Bool xf86RegisterBuiltinInterfaceVersion(BuiltinInterface iface, - CARD32 version, int flags); - - -#endif /* _NO_XF86_PROTOTYPES */ - -#endif /* _XF86_H */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86AutoConfig.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86AutoConfig.c deleted file mode 100644 index 36e400cd1..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86AutoConfig.c +++ /dev/null @@ -1,368 +0,0 @@ -/* $DHD: xc/programs/Xserver/hw/xfree86/common/xf86AutoConfig.c,v 1.15 2003/09/24 19:39:36 dawes Exp $ */ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/xf86AutoConfig.c,v 1.4 2005/08/23 20:12:26 alanc Exp $ */ - -/* - * Copyright 2003 by David H. Dawes. - * Copyright 2003 by X-Oz Technologies. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - * - * Author: David Dawes . - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86AutoConfig.c,v 1.2 2003/11/03 05:11:01 tsi Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86.h" -#include "xf86Parser.h" -#include "xf86tokens.h" -#include "xf86Config.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -/* - * Sections for the default built-in configuration. - */ - -#define BUILTIN_MODULE_SECTION \ - "Section \"Module\"\n" \ - "\tLoad\t\"extmod\"\n" \ - "\tLoad\t\"dbe\"\n" \ - "\tLoad\t\"glx\"\n" \ - "\tLoad\t\"freetype\"\n" \ - "EndSection\n\n" - -#define BUILTIN_DEVICE_NAME \ - "\"Builtin Default %s Device %d\"" - -#define BUILTIN_DEVICE_SECTION_PRE \ - "Section \"Device\"\n" \ - "\tIdentifier\t" BUILTIN_DEVICE_NAME "\n" \ - "\tDriver\t\"%s\"\n" - -#define BUILTIN_DEVICE_SECTION_POST \ - "EndSection\n\n" - -#define BUILTIN_DEVICE_SECTION \ - BUILTIN_DEVICE_SECTION_PRE \ - BUILTIN_DEVICE_SECTION_POST - -#define BUILTIN_MONITOR_NAME \ - "\"Builtin Default Monitor\"" - -#define BUILTIN_MONITOR_SECTION \ - "Section \"Monitor\"\n" \ - "\tIdentifier\t" BUILTIN_MONITOR_NAME "\n" \ - "\tOption\t\"TargetRefresh\"\t\"75.0\"\n" \ - "EndSection\n\n" - -#define BUILTIN_SCREEN_NAME \ - "\"Builtin Default %s Screen %d\"" - -#define BUILTIN_SCREEN_SECTION \ - "Section \"Screen\"\n" \ - "\tIdentifier\t" BUILTIN_SCREEN_NAME "\n" \ - "\tDevice\t" BUILTIN_DEVICE_NAME "\n" \ - "\tMonitor\t" BUILTIN_MONITOR_NAME "\n" \ - "EndSection\n\n" - -#define BUILTIN_LAYOUT_SECTION_PRE \ - "Section \"ServerLayout\"\n" \ - "\tIdentifier\t\"Builtin Default Layout\"\n" - -#define BUILTIN_LAYOUT_SCREEN_LINE \ - "\tScreen\t" BUILTIN_SCREEN_NAME "\n" - -#define BUILTIN_LAYOUT_SECTION_POST \ - "EndSection\n\n" - - -#ifndef GET_CONFIG_CMD -#define GET_CONFIG_CMD "getconfig" -#endif - -#ifndef GETCONFIG_DIR -#define GETCONFIG_DIR PROJECTROOT "/lib/X11/getconfig" -#endif - -#define GETCONFIG_WHITESPACE " \t\n" - -static const char **builtinConfig = NULL; -static int builtinLines = 0; -static const char *deviceList[] = { - "fbdev", - "vesa", - "vga", - NULL -}; - -/* - * A built-in config file is stored as an array of strings, with each string - * representing a single line. AppendToConfig() breaks up the string "s" - * into lines, and appends those lines it to builtinConfig. - */ - -static void -AppendToList(const char *s, const char ***list, int *lines) -{ - char *str, *newstr, *p; - - str = xnfstrdup(s); - for (p = strtok(str, "\n"); p; p = strtok(NULL, "\n")) { - (*lines)++; - *list = xnfrealloc(*list, (*lines + 1) * sizeof(**list)); - newstr = xnfalloc(strlen(p) + 2); - strcpy(newstr, p); - strcat(newstr, "\n"); - (*list)[*lines - 1] = newstr; - (*list)[*lines] = NULL; - } - xfree(str); -} - -static void -FreeList(const char ***list, int *lines) -{ - int i; - - for (i = 0; i < *lines; i++) { - if ((*list)[i]) - xfree((*list)[i]); - } - xfree(*list); - *list = NULL; - *lines = 0; -} - -static void -FreeConfig(void) -{ - FreeList(&builtinConfig, &builtinLines); -} - -static void -AppendToConfig(const char *s) -{ - AppendToList(s, &builtinConfig, &builtinLines); -} - -Bool -xf86AutoConfig(void) -{ - const char **p; - char buf[1024]; - pciVideoPtr *pciptr, info = NULL; - char *driver = NULL; - FILE *gp = NULL; - ConfigStatus ret; - - /* Find the primary device, and get some information about it. */ - if (xf86PciVideoInfo) { - for (pciptr = xf86PciVideoInfo; (info = *pciptr); pciptr++) { - if (xf86IsPrimaryPci(info)) { - break; - } - } - if (!info) { - ErrorF("Primary device is not PCI\n"); - } - } else { - ErrorF("xf86PciVideoInfo is not set\n"); - } - - if (info) { - char *tmp; - char *path = NULL, *a, *b; - char *searchPath = NULL; - - /* - * Look for the getconfig program first in the xf86ModulePath - * directories, then in GETCONFIG_DIR, then in BINDIR. If it - * isn't found in any of those locations, just use the normal - * search path. - */ - - if (xf86ModulePath) { - a = xnfstrdup(xf86ModulePath); - b = strtok(a, ","); - while (b) { - path = xnfrealloc(path, - strlen(b) + 1 + strlen(GET_CONFIG_CMD) + 1); - sprintf(path, "%s/%s", b, GET_CONFIG_CMD); - if (access(path, X_OK) == 0) - break; - b = strtok(NULL, ","); - } - if (!b) { - xfree(path); - path = NULL; - } - xfree(a); - } - - if (!path) { - path = xnfstrdup(GETCONFIG_DIR "/" GET_CONFIG_CMD); - if (access(path, X_OK) != 0) { - xfree(path); - path = NULL; - } - } - -#ifdef BINDIR - if (!path) { - path = xnfstrdup(BINDIR "/" GET_CONFIG_CMD); - if (access(path, X_OK) != 0) { - xfree(path); - path = NULL; - } - } -#endif - - if (!path) - path = xnfstrdup(GET_CONFIG_CMD); - - /* - * Build up the config file directory search path: - * - * /etc/X11 - * PROJECTROOT/etc/X11 - * xf86ModulePath - * PROJECTROOT/lib/X11/getconfig (GETCONFIG_DIR) - */ - - searchPath = xnfalloc(strlen("/etc/X11") + 1 + - strlen(PROJECTROOT "/etc/X11") + 1 + - (xf86ModulePath ? strlen(xf86ModulePath) : 0) - + 1 + - strlen(GETCONFIG_DIR) + 1); - strcpy(searchPath, "/etc/X11," PROJECTROOT "/etc/X11,"); - if (xf86ModulePath && *xf86ModulePath) { - strcat(searchPath, xf86ModulePath); - strcat(searchPath, ","); - } - strcat(searchPath, GETCONFIG_DIR); - - ErrorF("xf86AutoConfig: Primary PCI is %d:%d:%d\n", - info->bus, info->device, info->func); - - snprintf(buf, sizeof(buf), "%s" -#ifdef DEBUG - " -D" -#endif - " -X %d" - " -I %s" - " -v 0x%04x -d 0x%04x -r 0x%02x -s 0x%04x" - " -b 0x%04x -c 0x%04x", - path, - (unsigned int)xorgGetVersion(), - searchPath, - info->vendor, info->chipType, info->chipRev, - info->subsysVendor, info->subsysCard, - info->class << 8 | info->subclass); - ErrorF("Running \"%s\"\n", buf); - gp = Popen(buf, "r"); - if (gp) { - if (fgets(buf, sizeof(buf) - 1, gp)) { - buf[strlen(buf) - 1] = '\0'; - tmp = strtok(buf, GETCONFIG_WHITESPACE); - if (tmp) - driver = xnfstrdup(tmp); - } - } - xfree(path); - xfree(searchPath); - } - - AppendToConfig(BUILTIN_MODULE_SECTION); - AppendToConfig(BUILTIN_MONITOR_SECTION); - - if (driver) { - snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION_PRE, - driver, 0, driver); - AppendToConfig(buf); - ErrorF("New driver is \"%s\"\n", driver); - buf[0] = '\t'; - while (fgets(buf + 1, sizeof(buf) - 2, gp)) { - AppendToConfig(buf); - ErrorF("Extra line: %s", buf); - } - AppendToConfig(BUILTIN_DEVICE_SECTION_POST); - snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION, - driver, 0, driver, 0); - AppendToConfig(buf); - } - - if (gp) - Pclose(gp); - - for (p = deviceList; *p; p++) { - snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION, *p, 0, *p); - AppendToConfig(buf); - snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION, *p, 0, *p, 0); - AppendToConfig(buf); - } - - AppendToConfig(BUILTIN_LAYOUT_SECTION_PRE); - if (driver) { - snprintf(buf, sizeof(buf), BUILTIN_LAYOUT_SCREEN_LINE, driver, 0); - AppendToConfig(buf); - } - for (p = deviceList; *p; p++) { - snprintf(buf, sizeof(buf), BUILTIN_LAYOUT_SCREEN_LINE, *p, 0); - AppendToConfig(buf); - } - AppendToConfig(BUILTIN_LAYOUT_SECTION_POST); - -#ifdef BUILTIN_EXTRA - AppendToConfig(BUILTIN_EXTRA); -#endif - - if (driver) - xfree(driver); - - xf86MsgVerb(X_DEFAULT, 0, - "Using default built-in configuration (%d lines)\n", - builtinLines); - - xf86MsgVerb(X_DEFAULT, 3, "--- Start of built-in configuration ---\n"); - for (p = builtinConfig; *p; p++) - xf86ErrorFVerb(3, "\t%s", *p); - xf86MsgVerb(X_DEFAULT, 3, "--- End of built-in configuration ---\n"); - - xf86setBuiltinConfig(builtinConfig); - ret = xf86HandleConfigFile(TRUE); - FreeConfig(); - switch(ret) { - case CONFIG_OK: - return TRUE; - default: - xf86Msg(X_ERROR, "Error parsing the built-in default configuration.\n"); - return FALSE; - } -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Bus.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Bus.c deleted file mode 100644 index e0cc4dd65..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Bus.c +++ /dev/null @@ -1,3317 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.80 2004/02/05 18:24:59 eich Exp $ */ -/* - * Copyright (c) 1997-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#define REDUCER -/* - * This file contains the interfaces to the bus-specific code - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Resources.h" - -/* Bus-specific headers */ - -#include "xf86Bus.h" - -#define XF86_OS_PRIVS -#define NEED_OS_RAC_PROTOS -#include "xf86_OSproc.h" - -#include "xf86RAC.h" - -/* Entity data */ -EntityPtr *xf86Entities = NULL; /* Bus slots claimed by drivers */ -int xf86NumEntities = 0; -static int xf86EntityPrivateCount = 0; -BusAccPtr xf86BusAccInfo = NULL; - -xf86AccessRec AccessNULL = {NULL,NULL,NULL}; - -xf86CurrentAccessRec xf86CurrentAccess = {NULL,NULL}; - -BusRec primaryBus = { BUS_NONE, {{0}}}; - -Bool xf86ResAccessEnter = FALSE; - -#ifdef REDUCER -/* Resources that temporarily conflict with estimated resources */ -static resPtr AccReducers = NULL; -#endif - -/* resource lists */ -resPtr Acc = NULL; -resPtr osRes = NULL; - -/* allocatable ranges */ -resPtr ResRange = NULL; - -/* predefined special resources */ -resRange resVgaExclusive[] = {_VGA_EXCLUSIVE, _END}; -resRange resVgaShared[] = {_VGA_SHARED, _END}; -resRange resVgaMemShared[] = {_VGA_SHARED_MEM,_END}; -resRange resVgaIoShared[] = {_VGA_SHARED_IO,_END}; -resRange resVgaUnusedExclusive[] = {_VGA_EXCLUSIVE_UNUSED, _END}; -resRange resVgaUnusedShared[] = {_VGA_SHARED_UNUSED, _END}; -resRange resVgaSparseExclusive[] = {_VGA_EXCLUSIVE_SPARSE, _END}; -resRange resVgaSparseShared[] = {_VGA_SHARED_SPARSE, _END}; -resRange res8514Exclusive[] = {_8514_EXCLUSIVE, _END}; -resRange res8514Shared[] = {_8514_SHARED, _END}; - -/* Flag: do we need RAC ? */ -static Bool needRAC = FALSE; -static Bool doFramebufferMode = FALSE; - -/* state change notification callback list */ -static StateChangeNotificationPtr StateChangeNotificationList; -static void notifyStateChange(xf86NotifyState state); - -#undef MIN -#define MIN(x,y) ((xentityInit) { - if (xf86Entities[i]->access->busAcc) - ((BusAccPtr)xf86Entities[i]->access->busAcc)->set_f - (xf86Entities[i]->access->busAcc); - pacc = xf86Entities[i]->access->fallback; - if (pacc->AccessEnable) - pacc->AccessEnable(pacc->arg); - xf86Entities[i]->entityInit(i,xf86Entities[i]->private); - if (pacc->AccessDisable) - pacc->AccessDisable(pacc->arg); - /* remove init resources after init is processed */ - pprev_next = &Acc; - res = Acc; - while (res) { - if (res->res_type & ResInit && (res->entityIndex == i)) { - (*pprev_next) = res->next; - xfree(res); - } else - pprev_next = &(res->next); - res = (*pprev_next); - } - } -} - -int -xf86AllocateEntity(void) -{ - xf86NumEntities++; - xf86Entities = xnfrealloc(xf86Entities, - sizeof(EntityPtr) * xf86NumEntities); - xf86Entities[xf86NumEntities - 1] = xnfcalloc(1,sizeof(EntityRec)); - xf86Entities[xf86NumEntities - 1]->entityPrivates = - xnfcalloc(sizeof(DevUnion) * xf86EntityPrivateCount, 1); - return (xf86NumEntities - 1); -} - -static void -EntityEnter(void) -{ - int i; - xf86AccessPtr pacc; - - for (i = 0; i < xf86NumEntities; i++) - if (xf86Entities[i]->entityEnter) { - if (xf86Entities[i]->access->busAcc) - ((BusAccPtr)xf86Entities[i]->access->busAcc)->set_f - (xf86Entities[i]->access->busAcc); - pacc = xf86Entities[i]->access->fallback; - if (pacc->AccessEnable) - pacc->AccessEnable(pacc->arg); - xf86Entities[i]->entityEnter(i,xf86Entities[i]->private); - if (pacc->AccessDisable) - pacc->AccessDisable(pacc->arg); - } -} - -static void -EntityLeave(void) -{ - int i; - xf86AccessPtr pacc; - - for (i = 0; i < xf86NumEntities; i++) - if (xf86Entities[i]->entityLeave) { - if (xf86Entities[i]->access->busAcc) - ((BusAccPtr)xf86Entities[i]->access->busAcc)->set_f - (xf86Entities[i]->access->busAcc); - pacc = xf86Entities[i]->access->fallback; - if (pacc->AccessEnable) - pacc->AccessEnable(pacc->arg); - xf86Entities[i]->entityLeave(i,xf86Entities[i]->private); - if (pacc->AccessDisable) - pacc->AccessDisable(pacc->arg); - } -} - -Bool -xf86IsEntityPrimary(int entityIndex) -{ - EntityPtr pEnt = xf86Entities[entityIndex]; - - if (primaryBus.type != pEnt->busType) return FALSE; - - switch (pEnt->busType) { - case BUS_PCI: - return (pEnt->pciBusId.bus == primaryBus.id.pci.bus && - pEnt->pciBusId.device == primaryBus.id.pci.device && - pEnt->pciBusId.func == primaryBus.id.pci.func); - case BUS_ISA: - return TRUE; - case BUS_SBUS: - return (pEnt->sbusBusId.fbNum == primaryBus.id.sbus.fbNum); - default: - return FALSE; - } -} - -Bool -xf86SetEntityFuncs(int entityIndex, EntityProc init, EntityProc enter, - EntityProc leave, pointer private) -{ - if (entityIndex >= xf86NumEntities) - return FALSE; - xf86Entities[entityIndex]->entityInit = init; - xf86Entities[entityIndex]->entityEnter = enter; - xf86Entities[entityIndex]->entityLeave = leave; - xf86Entities[entityIndex]->private = private; - return TRUE; -} - -Bool -xf86DriverHasEntities(DriverPtr drvp) -{ - int i; - for (i = 0; i < xf86NumEntities; i++) { - if (xf86Entities[i]->driver == drvp) - return TRUE; - } - return FALSE; -} - -void -xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex) -{ - if (entityIndex == -1) - return; - if (xf86Entities[entityIndex]->inUse && - !(xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL)) - FatalError("Requested Entity already in use!\n"); - - pScrn->numEntities++; - pScrn->entityList = xnfrealloc(pScrn->entityList, - pScrn->numEntities * sizeof(int)); - pScrn->entityList[pScrn->numEntities - 1] = entityIndex; - xf86Entities[entityIndex]->access->next = pScrn->access; - pScrn->access = xf86Entities[entityIndex]->access; - xf86Entities[entityIndex]->inUse = TRUE; - pScrn->entityInstanceList = xnfrealloc(pScrn->entityInstanceList, - pScrn->numEntities * sizeof(int)); - pScrn->entityInstanceList[pScrn->numEntities - 1] = 0; - pScrn->domainIOBase = xf86Entities[entityIndex]->domainIO; -} - -void -xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex, int instance) -{ - int i; - - if (entityIndex == -1 || entityIndex >= xf86NumEntities) - return; - - for (i = 0; i < pScrn->numEntities; i++) { - if (pScrn->entityList[i] == entityIndex) { - pScrn->entityInstanceList[i] = instance; - break; - } - } -} - -/* - * XXX This needs to be updated for the case where a single entity may have - * instances associated with more than one screen. - */ -ScrnInfoPtr -xf86FindScreenForEntity(int entityIndex) -{ - int i,j; - - if (entityIndex == -1) return NULL; - - if (xf86Screens) { - for (i = 0; i < xf86NumScreens; i++) { - for (j = 0; j < xf86Screens[i]->numEntities; j++) { - if ( xf86Screens[i]->entityList[j] == entityIndex ) - return (xf86Screens[i]); - } - } - } - return NULL; -} - -void -xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex) -{ - int i; - EntityAccessPtr *ptr = (EntityAccessPtr *)&pScrn->access; - EntityAccessPtr peacc; - - for (i = 0; i < pScrn->numEntities; i++) { - if (pScrn->entityList[i] == entityIndex) { - peacc = xf86Entities[pScrn->entityList[i]]->access; - (*ptr) = peacc->next; - /* disable entity: call disable func */ - if (peacc->pAccess && peacc->pAccess->AccessDisable) - peacc->pAccess->AccessDisable(peacc->pAccess->arg); - /* also disable fallback - just in case */ - if (peacc->fallback && peacc->fallback->AccessDisable) - peacc->fallback->AccessDisable(peacc->fallback->arg); - for (i++; i < pScrn->numEntities; i++) - pScrn->entityList[i-1] = pScrn->entityList[i]; - pScrn->numEntities--; - xf86Entities[entityIndex]->inUse = FALSE; - break; - } - ptr = &(xf86Entities[pScrn->entityList[i]]->access->next); - } -} - -/* - * xf86ClearEntitiesForScreen() - called when a screen is deleted - * to mark it's entities unused. Called by xf86DeleteScreen(). - */ -void -xf86ClearEntityListForScreen(int scrnIndex) -{ - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - EntityAccessPtr peacc; - int i, entityIndex; - - if (pScrn->entityList == NULL || pScrn->numEntities == 0) return; - - for (i = 0; i < pScrn->numEntities; i++) { - entityIndex = pScrn->entityList[i]; - xf86Entities[entityIndex]->inUse = FALSE; - /* disable resource: call the disable function */ - peacc = xf86Entities[entityIndex]->access; - if (peacc->pAccess && peacc->pAccess->AccessDisable) - peacc->pAccess->AccessDisable(peacc->pAccess->arg); - /* and the fallback function */ - if (peacc->fallback && peacc->fallback->AccessDisable) - peacc->fallback->AccessDisable(peacc->fallback->arg); - /* shared resources are only needed when entity is active: remove */ - xf86DeallocateResourcesForEntity(entityIndex, ResShared); - } - xfree(pScrn->entityList); - xfree(pScrn->entityInstanceList); - if (pScrn->CurrentAccess->pIoAccess == (EntityAccessPtr)pScrn->access) - pScrn->CurrentAccess->pIoAccess = NULL; - if (pScrn->CurrentAccess->pMemAccess == (EntityAccessPtr)pScrn->access) - pScrn->CurrentAccess->pMemAccess = NULL; - pScrn->entityList = NULL; - pScrn->entityInstanceList = NULL; -} - -void -xf86DeallocateResourcesForEntity(int entityIndex, unsigned long type) -{ - resPtr *pprev_next = &Acc; - resPtr res = Acc; - - while (res) { - if (res->entityIndex == entityIndex && - (type & ResAccMask & res->res_type)) - { - (*pprev_next) = res->next; - xfree(res); - } else - pprev_next = &(res->next); - res = (*pprev_next); - } -} - -/* - * Add an extra device section (GDevPtr) to an entity. - */ - -void -xf86AddDevToEntity(int entityIndex, GDevPtr dev) -{ - EntityPtr pEnt; - - if (entityIndex >= xf86NumEntities) - return; - - pEnt = xf86Entities[entityIndex]; - pEnt->numInstances++; - pEnt->devices = xnfrealloc(pEnt->devices, - pEnt->numInstances * sizeof(GDevPtr)); - pEnt->devices[pEnt->numInstances - 1] = dev; - dev->claimed = TRUE; -} - -/* - * xf86GetEntityInfo() -- This function hands information from the - * EntityRec struct to the drivers. The EntityRec structure itself - * remains invisible to the driver. - */ -EntityInfoPtr -xf86GetEntityInfo(int entityIndex) -{ - EntityInfoPtr pEnt; - int i; - - if (entityIndex >= xf86NumEntities) - return NULL; - - pEnt = xnfcalloc(1,sizeof(EntityInfoRec)); - pEnt->index = entityIndex; - pEnt->location = xf86Entities[entityIndex]->bus; - pEnt->active = xf86Entities[entityIndex]->active; - pEnt->chipset = xf86Entities[entityIndex]->chipset; - pEnt->resources = xf86Entities[entityIndex]->resources; - pEnt->driver = xf86Entities[entityIndex]->driver; - if ( (xf86Entities[entityIndex]->devices) && - (xf86Entities[entityIndex]->devices[0]) ) { - for (i = 0; i < xf86Entities[entityIndex]->numInstances; i++) - if (xf86Entities[entityIndex]->devices[i]->screen == 0) - break; - pEnt->device = xf86Entities[entityIndex]->devices[i]; - } else - pEnt->device = NULL; - - return pEnt; -} - -int -xf86GetNumEntityInstances(int entityIndex) -{ - if (entityIndex >= xf86NumEntities) - return -1; - - return xf86Entities[entityIndex]->numInstances; -} - -GDevPtr -xf86GetDevFromEntity(int entityIndex, int instance) -{ - int i; - - /* We might not use AddDevtoEntity */ - if ( (!xf86Entities[entityIndex]->devices) || - (!xf86Entities[entityIndex]->devices[0]) ) - return NULL; - - if (entityIndex >= xf86NumEntities || - instance >= xf86Entities[entityIndex]->numInstances) - return NULL; - - for (i = 0; i < xf86Entities[entityIndex]->numInstances; i++) - if (xf86Entities[entityIndex]->devices[i]->screen == instance) - break; - return xf86Entities[entityIndex]->devices[i]; -} - -/* - * general generic disable function. - */ -static void -disableAccess(void) -{ - int i; - xf86AccessPtr pacc; - EntityAccessPtr peacc; - - /* call disable funcs and reset current access pointer */ - /* the entity specific access funcs are in an enabled */ - /* state - driver must restore their state explicitely */ - for (i = 0; i < xf86NumScreens; i++) { - peacc = xf86Screens[i]->CurrentAccess->pIoAccess; - while (peacc) { - if (peacc->pAccess && peacc->pAccess->AccessDisable) - peacc->pAccess->AccessDisable(peacc->pAccess->arg); - peacc = peacc->next; - } - xf86Screens[i]->CurrentAccess->pIoAccess = NULL; - peacc = xf86Screens[i]->CurrentAccess->pMemAccess; - while (peacc) { - if (peacc->pAccess && peacc->pAccess->AccessDisable) - peacc->pAccess->AccessDisable(peacc->pAccess->arg); - peacc = peacc->next; - } - xf86Screens[i]->CurrentAccess->pMemAccess = NULL; - } - /* then call the generic entity disable funcs */ - for (i = 0; i < xf86NumEntities; i++) { - pacc = xf86Entities[i]->access->fallback; - if (pacc->AccessDisable) - pacc->AccessDisable(pacc->arg); - } -} - -static void -clearAccess(void) -{ - int i; - - /* call disable funcs and reset current access pointer */ - /* the entity specific access funcs are in an enabled */ - /* state - driver must restore their state explicitely */ - for (i = 0; i < xf86NumScreens; i++) { - xf86Screens[i]->CurrentAccess->pIoAccess = NULL; - xf86Screens[i]->CurrentAccess->pMemAccess = NULL; - } - -} - -/* - * Generic interface to bus specific code - add other buses here - */ - -/* - * xf86AccessInit() - set up everything needed for access control - * called only once on first server generation. - */ -void -xf86AccessInit(void) -{ - initPciState(); - initPciBusState(); - DisablePciBusAccess(); - DisablePciAccess(); - - xf86ResAccessEnter = TRUE; -} - -/* - * xf86AccessEnter() -- gets called to save the text mode VGA IO - * resources when reentering the server after a VT switch. - */ -void -xf86AccessEnter(void) -{ - if (xf86ResAccessEnter) - return; - - /* - * on enter we simply disable routing of special resources - * to any bus and let the RAC code to "open" the right bridges. - */ - PciBusStateEnter(); - DisablePciBusAccess(); - PciStateEnter(); - disableAccess(); - EntityEnter(); - notifyStateChange(NOTIFY_ENTER); - xf86EnterServerState(SETUP); - xf86ResAccessEnter = TRUE; -} - -/* - * xf86AccessLeave() -- prepares access for and calls the - * entityLeave() functions. - * xf86AccessLeaveState() --- gets called to restore the - * access to the VGA IO resources when switching VT or on - * server exit. - * This was split to call xf86AccessLeaveState() from - * ddxGiveUp(). - */ -void -xf86AccessLeave(void) -{ - if (!xf86ResAccessEnter) - return; - notifyStateChange(NOTIFY_LEAVE); - disableAccess(); - DisablePciBusAccess(); - EntityLeave(); -} - -void -xf86AccessLeaveState(void) -{ - if (!xf86ResAccessEnter) - return; - xf86ResAccessEnter = FALSE; - PciStateLeave(); - PciBusStateLeave(); -} - -/* - * xf86AccessRestoreState() - Restore the access registers to the - * state before X was started. This is handy for framebuffers. - */ -static void -xf86AccessRestoreState(void) -{ - if (!xf86ResAccessEnter) - return; - PciStateLeave(); - PciBusStateLeave(); -} - -/* - * xf86EnableAccess() -- enable access to controlled resources. - * To reduce latency when switching access the ScrnInfoRec has - * a linked list of the EntityAccPtr of all screen entities. - */ -/* - * switching access needs to be done in te following oder: - * disable - * 1. disable old entity - * 2. reroute bus - * 3. enable new entity - * Otherwise resources needed for access control might be shadowed - * by other resources! - */ -#ifdef async - -static AsyncQPtr *AsyncQ = NULL; -ScrnInfoPtr xf86CurrentScreen = NULL; - -#define SETUP_Q org = AsyncQ; \ - AsyncQ = &new; - -#define PROCESS_Q xf86CurrentScreen = pScrn; - if (!new) AsyncQ = org; \ - else { \ - AsyncQPtr tmp_Q; \ - while (1) {\ - new->func(new->arg);\ - if (!(new->next)) {\ - AsyncQ = org; xfree(new); break; \ - } \ - tmp_Q = new->next; \ - xfree(new); \ - new = tmp_Q; \ - } \ - } -#else -#define SETUP_Q -#define PROCESS_Q -#endif - -void -xf86EnableAccess(ScrnInfoPtr pScrn) -{ - register EntityAccessPtr peAcc = (EntityAccessPtr) pScrn->access; - register EntityAccessPtr pceAcc; - register xf86AccessPtr pAcc; - EntityAccessPtr tmp; -#ifdef async - AsyncQPtr *org, new = NULL; -#endif - -#ifdef DEBUG - ErrorF("Enable access %i\n",pScrn->scrnIndex); -#endif - - /* Entity is not under access control or currently enabled */ - if (!pScrn->access) { - if (pScrn->busAccess) { - SETUP_Q; - ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess); - PROCESS_Q; - } - return; - } - - switch (pScrn->resourceType) { - case IO: - pceAcc = pScrn->CurrentAccess->pIoAccess; - if (peAcc == pceAcc) { - return; - } - SETUP_Q; - if (pScrn->CurrentAccess->pMemAccess == pceAcc) - pScrn->CurrentAccess->pMemAccess = NULL; - while (pceAcc) { - pAcc = pceAcc->pAccess; - if ( pAcc && pAcc->AccessDisable) - (*pAcc->AccessDisable)(pAcc->arg); - pceAcc = pceAcc->next; - } - if (pScrn->busAccess) - ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess); - while (peAcc) { - pAcc = peAcc->pAccess; - if (pAcc && pAcc->AccessEnable) - (*pAcc->AccessEnable)(pAcc->arg); - peAcc = peAcc->next; - } - pScrn->CurrentAccess->pIoAccess = (EntityAccessPtr) pScrn->access; - PROCESS_Q; - return; - - case MEM_IO: - pceAcc = pScrn->CurrentAccess->pIoAccess; - if (peAcc != pceAcc) { /* current Io != pAccess */ - SETUP_Q; - tmp = pceAcc; - while (pceAcc) { - pAcc = pceAcc->pAccess; - if (pAcc && pAcc->AccessDisable) - (*pAcc->AccessDisable)(pAcc->arg); - pceAcc = pceAcc->next; - } - pceAcc = pScrn->CurrentAccess->pMemAccess; - if (peAcc != pceAcc /* current Mem != pAccess */ - && tmp !=pceAcc) { - while (pceAcc) { - pAcc = pceAcc->pAccess; - if (pAcc && pAcc->AccessDisable) - (*pAcc->AccessDisable)(pAcc->arg); - pceAcc = pceAcc->next; - } - } - } else { /* current Io == pAccess */ - pceAcc = pScrn->CurrentAccess->pMemAccess; - if (pceAcc == peAcc) { /* current Mem == pAccess */ - return; - } - SETUP_Q; - while (pceAcc) { /* current Mem != pAccess */ - pAcc = pceAcc->pAccess; - if (pAcc && pAcc->AccessDisable) - (*pAcc->AccessDisable)(pAcc->arg); - pceAcc = pceAcc->next; - } - } - if (pScrn->busAccess) - ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess); - while (peAcc) { - pAcc = peAcc->pAccess; - if (pAcc && pAcc->AccessEnable) - (*pAcc->AccessEnable)(pAcc->arg); - peAcc = peAcc->next; - } - pScrn->CurrentAccess->pMemAccess = - pScrn->CurrentAccess->pIoAccess = (EntityAccessPtr) pScrn->access; - PROCESS_Q; - return; - - case MEM: - pceAcc = pScrn->CurrentAccess->pMemAccess; - if (peAcc == pceAcc) { - return; - } - SETUP_Q; - if (pScrn->CurrentAccess->pIoAccess == pceAcc) - pScrn->CurrentAccess->pIoAccess = NULL; - while (pceAcc) { - pAcc = pceAcc->pAccess; - if ( pAcc && pAcc->AccessDisable) - (*pAcc->AccessDisable)(pAcc->arg); - pceAcc = pceAcc->next; - } - if (pScrn->busAccess) - ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess); - while (peAcc) { - pAcc = peAcc->pAccess; - if (pAcc && pAcc->AccessEnable) - (*pAcc->AccessEnable)(pAcc->arg); - peAcc = peAcc->next; - } - pScrn->CurrentAccess->pMemAccess = (EntityAccessPtr) pScrn->access; - PROCESS_Q; - return; - - case NONE: - if (pScrn->busAccess) { - SETUP_Q; - ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess); - PROCESS_Q; - } - return; - } -} - -void -xf86SetCurrentAccess(Bool Enable, ScrnInfoPtr pScrn) -{ - EntityAccessPtr pceAcc2 = NULL; - register EntityAccessPtr pceAcc = NULL; - register xf86AccessPtr pAcc; - - - switch(pScrn->resourceType) { - case IO: - pceAcc = pScrn->CurrentAccess->pIoAccess; - break; - case MEM: - pceAcc = pScrn->CurrentAccess->pMemAccess; - break; - case MEM_IO: - pceAcc = pScrn->CurrentAccess->pMemAccess; - pceAcc2 = pScrn->CurrentAccess->pIoAccess; - break; - default: - break; - } - - while (pceAcc) { - pAcc = pceAcc->pAccess; - if ( pAcc) { - if (!Enable) { - if (pAcc->AccessDisable) - (*pAcc->AccessDisable)(pAcc->arg); - } else { - if (pAcc->AccessEnable) - (*pAcc->AccessEnable)(pAcc->arg); - } - } - pceAcc = pceAcc->next; - if (!pceAcc) { - pceAcc = pceAcc2; - pceAcc2 = NULL; - } - } -} - -void -xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86SetAccessFuncPtr funcs, - xf86SetAccessFuncPtr oldFuncs) -{ - AccessFuncPtr rac; - - if (!xf86Entities[pEnt->index]->rac) - xf86Entities[pEnt->index]->rac = xnfcalloc(1,sizeof(AccessFuncRec)); - - rac = xf86Entities[pEnt->index]->rac; - - if (funcs->mem == funcs->io_mem && funcs->mem && funcs->io) - xf86Entities[pEnt->index]->entityProp |= NO_SEPARATE_MEM_FROM_IO; - if (funcs->io == funcs->io_mem && funcs->mem && funcs->io) - xf86Entities[pEnt->index]->entityProp |= NO_SEPARATE_IO_FROM_MEM; - - rac->mem_new = funcs->mem; - rac->io_new = funcs->io; - rac->io_mem_new = funcs->io_mem; - - rac->old = oldFuncs; -} - -/* - * Conflict checking - */ - -static memType -getMask(memType val) -{ - memType mask = 0; - memType tmp = 0; - - mask=~mask; - tmp = ~((~tmp) >> 1); - - while (!(val & tmp)) { - mask = mask >> 1; - val = val << 1; - } - return mask; -} - -/* - * checkConflictBlock() -- check for conflicts of a block resource range. - * If conflict is found return end of conflicting range. Else return 0. - */ -static memType -checkConflictBlock(resRange *range, resPtr pRes) -{ - memType val,tmp,prev; - int i; - - switch (pRes->res_type & ResExtMask) { - case ResBlock: - if (range->rBegin < pRes->block_end && - range->rEnd > pRes->block_begin) { -#ifdef DEBUG - ErrorF("b-b conflict w: %lx %lx\n", - pRes->block_begin,pRes->block_end); -#endif - return pRes->block_end < range->rEnd ? - pRes->block_end : range->rEnd; - } - return 0; - case ResSparse: - if (pRes->sparse_base > range->rEnd) return 0; - - val = (~pRes->sparse_mask | pRes->sparse_base) & getMask(range->rEnd); -#ifdef DEBUG - ErrorF("base = 0x%lx, mask = 0x%lx, begin = 0x%lx, end = 0x%lx ," - "val = 0x%lx\n", - pRes->sparse_base, pRes->sparse_mask, range->rBegin, - range->rEnd, val); -#endif - i = sizeof(memType) * 8; - tmp = prev = pRes->sparse_base; - - while (i) { - tmp |= 1<< (--i) & val; - if (tmp > range->rEnd) - tmp = prev; - else - prev = tmp; - } - if (tmp >= range->rBegin) { -#ifdef DEBUG - ErrorF("conflict found at: 0x%lx\n",tmp); - ErrorF("b-d conflict w: %lx %lx\n", - pRes->sparse_base,pRes->sparse_mask); -#endif - return tmp; - } - else - return 0; - } - return 0; -} - -/* - * checkConflictSparse() -- check for conflicts of a sparse resource range. - * If conflict is found return base of conflicting region. Else return 0. - */ -#define mt_max ~(memType)0 -#define length sizeof(memType) * 8 -static memType -checkConflictSparse(resRange *range, resPtr pRes) -{ - memType val, tmp, prev; - int i; - - switch (pRes->res_type & ResExtMask) { - case ResSparse: - tmp = pRes->sparse_mask & range->rMask; - if ((tmp & pRes->sparse_base) == (tmp & range->rBase)) { -#ifdef DEBUG - ErrorF("s-b conflict w: %lx %lx\n", - pRes->sparse_base,pRes->sparse_mask); -#endif - return pRes->sparse_mask; - } - return 0; - - case ResBlock: - if (pRes->block_end < range->rBase) return 0; - - val = (~range->rMask | range->rBase) & getMask(pRes->block_end); - i = length; - tmp = prev = range->rBase; - - while (i) { -#ifdef DEBUG - ErrorF("tmp = 0x%lx\n",tmp); -#endif - tmp |= 1<< (--i) & val; - if (tmp > pRes->block_end) - tmp = prev; - else - prev = tmp; - } - if (tmp < pRes->block_begin) - return 0; - else { - /* - * now we subdivide the block region in sparse regions - * with base values = 2^n and find the smallest mask. - * This might be done in a simpler way.... - */ - memType mask, m_mask = 0, base = pRes->block_begin; - int i; - while (base < pRes->block_end) { - for (i = 1; i < length; i++) - if ( base != (base & (mt_max << i))) break; - mask = mt_max >> (length - i); - do mask >>= 1; - while ((mask + base + 1) > pRes->block_end); - /* m_mask and are _inverted_ sparse masks */ - m_mask = mask > m_mask ? mask : m_mask; - base = base + mask + 1; - } -#ifdef DEBUG - ErrorF("conflict found at: 0x%lx\n",tmp); - ErrorF("b-b conflict w: %lx %lx\n", - pRes->block_begin,pRes->block_end); -#endif - return ~m_mask; - } - } - return 0; -} -#undef mt_max -#undef length - -/* - * needCheck() -- this function decides whether to check for conflicts - * depending on the types of the resource ranges and their locations - */ -static Bool -needCheck(resPtr pRes, unsigned long type, int entityIndex, xf86State state) -{ - /* the same entity shouldn't conflict with itself */ - ScrnInfoPtr pScrn; - int i; - BusType loc = BUS_NONE; - BusType r_loc = BUS_NONE; - - /* Ignore overlapped ranges that have been nullified */ - if ((pRes->res_type & ResOverlap) && (pRes->block_begin > pRes->block_end)) - return FALSE; - - if ((pRes->res_type & ResTypeMask) != (type & ResTypeMask)) - return FALSE; - - /* - * Resources set by BIOS (ResBios) are allowed to conflict - * with resources marked (ResBios). - */ - if (pRes->res_type & type & ResBios) - return FALSE; - - /*If requested, skip over estimated resources */ - if (pRes->res_type & type & ResEstimated) - return FALSE; - - if (type & pRes->res_type & ResUnused) - return FALSE; - - if (state == OPERATING) { - if (type & ResDisableOpr || pRes->res_type & ResDisableOpr) - return FALSE; - if (type & pRes->res_type & ResUnusedOpr) return FALSE; - /* - * Maybe we should have ResUnused set The resUnusedOpr - * bit, too. This way we could avoid this confusion - */ - if ((type & ResUnusedOpr && pRes->res_type & ResUnused) || - (type & ResUnused && pRes->res_type & ResUnusedOpr)) - return FALSE; - } - - if (entityIndex > -1) - loc = xf86Entities[entityIndex]->busType; - if (pRes->entityIndex > -1) - r_loc = xf86Entities[pRes->entityIndex]->busType; - - switch (type & ResAccMask) { - case ResExclusive: - switch (pRes->res_type & ResAccMask) { - case ResExclusive: - break; - case ResShared: - /* ISA buses are only locally exclusive on a PCI system */ - if (loc == BUS_ISA && r_loc == BUS_PCI) - return FALSE; - break; - } - break; - case ResShared: - switch (pRes->res_type & ResAccMask) { - case ResExclusive: - /* ISA buses are only locally exclusive on a PCI system */ - if (loc == BUS_PCI && r_loc == BUS_ISA) - return FALSE; - break; - case ResShared: - return FALSE; - } - break; - case ResAny: - break; - } - - if (pRes->entityIndex == entityIndex) return FALSE; - - if (pRes->entityIndex > -1 && - (pScrn = xf86FindScreenForEntity(entityIndex))) { - for (i = 0; i < pScrn->numEntities; i++) - if (pScrn->entityList[i] == pRes->entityIndex) return FALSE; - } - return TRUE; -} - -/* - * checkConflict() - main conflict checking function which all other - * function call. - */ -static memType -checkConflict(resRange *rgp, resPtr pRes, int entityIndex, - xf86State state, Bool ignoreIdentical) -{ - memType ret; - - while(pRes) { - if (!needCheck(pRes,rgp->type, entityIndex ,state)) { - pRes = pRes->next; - continue; - } - switch (rgp->type & ResExtMask) { - case ResBlock: - if (rgp->rEnd < rgp->rBegin) { - xf86Msg(X_ERROR,"end of block range 0x%lx < begin 0x%lx\n", - rgp->rEnd,rgp->rBegin); - return 0; - } - if ((ret = checkConflictBlock(rgp, pRes))) { - if (!ignoreIdentical || (rgp->rBegin != pRes->block_begin) - || (rgp->rEnd != pRes->block_end)) - return ret; - } - break; - case ResSparse: - if ((rgp->rBase & rgp->rMask) != rgp->rBase) { - xf86Msg(X_ERROR,"sparse io range (base: 0x%lx mask: 0x%lx)" - "doesn't satisfy (base & mask = mask)\n", - rgp->rBase, rgp->rMask); - return 0; - } - if ((ret = checkConflictSparse(rgp, pRes))) { - if (!ignoreIdentical || (rgp->rBase != pRes->sparse_base) - || (rgp->rMask != pRes->sparse_mask)) - return ret; - } - break; - } - pRes = pRes->next; - } - return 0; -} - -/* - * ChkConflict() -- used within xxxBus ; find conflict with any location. - */ -memType -ChkConflict(resRange *rgp, resPtr res, xf86State state) -{ - return checkConflict(rgp, res, -2, state,FALSE); -} - -/* - * xf86ChkConflict() - This function is the low level interface to - * the resource broker that gets exported. Tests all resources ie. - * performs test with SETUP flag. - */ -memType -xf86ChkConflict(resRange *rgp, int entityIndex) -{ - return checkConflict(rgp, Acc, entityIndex, SETUP,FALSE); -} - -/* - * Resources List handling - */ - -resPtr -xf86JoinResLists(resPtr rlist1, resPtr rlist2) -{ - resPtr pRes; - - if (!rlist1) - return rlist2; - - if (!rlist2) - return rlist1; - - for (pRes = rlist1; pRes->next; pRes = pRes->next) - ; - pRes->next = rlist2; - return rlist1; -} - -resPtr -xf86AddResToList(resPtr rlist, resRange *range, int entityIndex) -{ - resPtr new; - - switch (range->type & ResExtMask) { - case ResBlock: - if (range->rEnd < range->rBegin) { - xf86Msg(X_ERROR,"end of block range 0x%lx < begin 0x%lx\n", - range->rEnd,range->rBegin); - return rlist; - } - break; - case ResSparse: - if ((range->rBase & range->rMask) != range->rBase) { - xf86Msg(X_ERROR,"sparse io range (base: 0x%lx mask: 0x%lx)" - "doesn't satisfy (base & mask = mask)\n", - range->rBase, range->rMask); - return rlist; - } - break; - } - - new = xnfalloc(sizeof(resRec)); - /* - * Only background resources may be registered with ResBios - * and ResEstimated set. Other resources only set it for - * testing. - */ - if (entityIndex != (-1)) - range->type &= ~(ResBios | ResEstimated); - new->val = *range; - new->entityIndex = entityIndex; - new->next = rlist; - return new; -} - -void -xf86FreeResList(resPtr rlist) -{ - resPtr pRes; - - if (!rlist) - return; - - for (pRes = rlist->next; pRes; rlist = pRes, pRes = pRes->next) - xfree(rlist); - xfree(rlist); -} - -resPtr -xf86DupResList(const resPtr rlist) -{ - resPtr pRes, ret, prev, new; - - if (!rlist) - return NULL; - - ret = xnfalloc(sizeof(resRec)); - *ret = *rlist; - prev = ret; - for (pRes = rlist->next; pRes; pRes = pRes->next) { - new = xnfalloc(sizeof(resRec)); - *new = *pRes; - prev->next = new; - prev = new; - } - return ret; -} - -void -xf86PrintResList(int verb, resPtr list) -{ - int i = 0; - const char *s, *r; - resPtr tmp = list; - unsigned long type; - - if (!list) - return; - - type = ResMem; - r = "M"; - while (1) { - while (list) { - if ((list->res_type & ResPhysMask) == type) { - switch (list->res_type & ResExtMask) { - case ResBlock: - xf86ErrorFVerb(verb, - "\t[%d] %d\t%ld\t0x%08lx - 0x%08lx (0x%lx)", - i, list->entityIndex, - (list->res_type & ResDomain) >> 24, - list->block_begin, list->block_end, - list->block_end - list->block_begin + 1); - break; - case ResSparse: - xf86ErrorFVerb(verb, "\t[%d] %d\t%ld\t0x%08lx - 0x%08lx ", - i, list->entityIndex, - (list->res_type & ResDomain) >> 24, - list->sparse_base,list->sparse_mask); - break; - default: - list = list->next; - continue; - } - xf86ErrorFVerb(verb, " %s", r); - switch (list->res_type & ResAccMask) { - case ResExclusive: - if (list->res_type & ResUnused) - s = "x"; - else - s = "X"; - break; - case ResShared: - if (list->res_type & ResUnused) - s = "s"; - else - s = "S"; - break; - default: - s = "?"; - } - xf86ErrorFVerb(verb, "%s", s); - switch (list->res_type & ResExtMask) { - case ResBlock: - s = "[B]"; - break; - case ResSparse: - s = "[S]"; - break; - default: - s = "[?]"; - } - xf86ErrorFVerb(verb, "%s", s); - if (list->res_type & ResEstimated) - xf86ErrorFVerb(verb, "E"); - if (list->res_type & ResOverlap) - xf86ErrorFVerb(verb, "O"); - if (list->res_type & ResInit) - xf86ErrorFVerb(verb, "t"); - if (list->res_type & ResBios) - xf86ErrorFVerb(verb, "(B)"); - if (list->res_type & ResBus) - xf86ErrorFVerb(verb, "(b)"); - if (list->res_type & ResOprMask) { - switch (list->res_type & ResOprMask) { - case ResUnusedOpr: - s = "(OprU)"; - break; - case ResDisableOpr: - s = "(OprD)"; - break; - default: - s = "(Opr?)"; - break; - } - xf86ErrorFVerb(verb, "%s", s); - } - xf86ErrorFVerb(verb, "\n"); - i++; - } - list = list->next; - } - if (type == ResIo) break; - type = ResIo; - r = "I"; - list = tmp; - } -} - -resPtr -xf86AddRangesToList(resPtr list, resRange *pRange, int entityIndex) -{ - while(pRange && pRange->type != ResEnd) { - list = xf86AddResToList(list,pRange,entityIndex); - pRange++; - } - return list; -} - -void -xf86ResourceBrokerInit(void) -{ - resPtr resPci; - - osRes = NULL; - - /* Get the addressable ranges */ - ResRange = xf86BusAccWindowsFromOS(); - xf86MsgVerb(X_INFO, 3, "Addressable bus resource ranges are\n"); - xf86PrintResList(3, ResRange); - - /* Get the ranges used exclusively by the system */ - osRes = xf86AccResFromOS(osRes); - xf86MsgVerb(X_INFO, 3, "OS-reported resource ranges:\n"); - xf86PrintResList(3, osRes); - - /* Bus dep initialization */ - resPci = ResourceBrokerInitPci(&osRes); - Acc = xf86JoinResLists(xf86DupResList(osRes), resPci); - - xf86MsgVerb(X_INFO, 3, "All system resource ranges:\n"); - xf86PrintResList(3, Acc); - -} - -#define MEM_ALIGN (1024 * 1024) - -/* - * RemoveOverlaps() -- remove overlaps between resources of the - * same kind. - * Beware: This function doesn't check for access attributes. - * At resource broker initialization this is no problem as this - * only deals with exclusive resources. - */ -#if 0 -void -RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, Bool useEstimated) -{ - resPtr pRes; - memType size, newsize, adjust; - - if (!target) - return; - - for (pRes = list; pRes; pRes = pRes->next) { - if (pRes != target - && ((pRes->res_type & ResTypeMask) == - (target->res_type & ResTypeMask)) - && pRes->block_begin <= target->block_end - && pRes->block_end >= target->block_begin) { - /* Possibly ignore estimated resources */ - if (!useEstimated && (pRes->res_type & ResEstimated)) continue; - /* - * Target should be a larger region than pRes. If pRes fully - * contains target, don't do anything unless target can overlap. - */ - if (pRes->block_begin <= target->block_begin && - pRes->block_end >= target->block_end) { - if (target->res_type & ResOverlap) { - /* Nullify range but keep its ResOverlap bit on */ - target->block_end = target->block_begin - 1; - return; - } - continue; - } - /* - * In cases where the target and pRes have the same starting - * address, reduce the size of the target (given it's an estimate). - */ - if (pRes->block_begin == target->block_begin) { - if (target->res_type & ResOverlap) - target->block_end = target->block_begin - 1; - else - target->block_end = pRes->block_end; - } - /* Otherwise, trim target to remove the overlap */ - else if (pRes->block_begin <= target->block_end) { - target->block_end = pRes->block_begin - 1; - } else if (!pow2Alignment && - pRes->block_end >= target->block_begin) { - target->block_begin = pRes->block_end + 1; - } - if (pow2Alignment) { - /* - * Align to a power of two. This requires finding the - * largest power of two that is smaller than the adjusted - * size. - */ - size = target->block_end - target->block_begin + 1; - newsize = 1UL << (sizeof(memType) * 8 - 1); - while (!(newsize & size)) - newsize >>= 1; - target->block_end = target->block_begin + newsize - 1; - } else if (target->block_end > MEM_ALIGN) { - /* Align the end to MEM_ALIGN */ - if ((adjust = (target->block_end + 1) % MEM_ALIGN)) - target->block_end -= adjust; - } - } - } -} -#else - -void -RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, Bool useEstimated) -{ - resPtr pRes; - memType size, newsize, adjust; - - if (!target) - return; - - if (!(target->res_type & ResEstimated) /* Don't touch sure resources */ - && !(target->res_type & ResOverlap)) /* Unless they may overlap */ - return; - - for (pRes = list; pRes; pRes = pRes->next) { - if (pRes == target - || ((pRes->res_type & ResTypeMask) != - (target->res_type & ResTypeMask)) - || pRes->block_begin > target->block_end - || pRes->block_end < target->block_begin) - continue; - - if (pRes->block_begin <= target->block_begin) { - /* Possibly ignore estimated resources */ - if (!useEstimated && (pRes->res_type & ResEstimated)) - continue; - - /* Special cases */ - if (pRes->block_end >= target->block_end) { - /* - * If pRes fully contains target, don't do anything - * unless target can overlap. - */ - if (target->res_type & ResOverlap) { - /* Nullify range but keep its ResOverlap bit on */ - target->block_end = target->block_begin - 1; - return; - } else - continue; - } else { -#if 0 /* Don't trim start address - we trust what we got */ - /* - * If !pow2Alignment trim start address: !pow2Alingment - * is only set when estimated OS addresses are handled. - * In cases where the target and pRes have the same - * starting address, reduce the size of the target - * (given it's an estimate). - */ - if (!pow2Alignment) - target->block_begin = pRes->block_end + 1; - else -#endif - if (pRes->block_begin == target->block_begin) - target->block_end = pRes->block_end; - else - continue; - } - } else { - /* Trim target to remove the overlap */ - target->block_end = pRes->block_begin - 1; - } - if (pow2Alignment) { - /* - * Align to a power of two. This requires finding the - * largest power of two that is smaller than the adjusted - * size. - */ - size = target->block_end - target->block_begin + 1; - newsize = 1UL << (sizeof(memType) * 8 - 1); - while (!(newsize & size)) - newsize >>= 1; - target->block_end = target->block_begin + newsize - 1; - } else if (target->block_end > MEM_ALIGN) { - /* Align the end to MEM_ALIGN */ - if ((adjust = (target->block_end + 1) % MEM_ALIGN)) - target->block_end -= adjust; - } - } -} - -#endif - -/* - * Resource request code - */ - -#define ALIGN(x,a) ((x) + a) &~(a) - -resRange -xf86GetBlock(unsigned long type, memType size, - memType window_start, memType window_end, - memType align_mask, resPtr avoid) -{ - memType min, max, tmp; - resRange r = {ResEnd,0,0}; - resPtr res_range = ResRange; - - if (!size) return r; - if (window_end < window_start || (window_end - window_start) < (size - 1)) { - ErrorF("Requesting insufficient memory window!:" - " start: 0x%lx end: 0x%lx size 0x%lx\n", - window_start,window_end,size); - return r; - } - type = (type & ~(ResExtMask | ResBios | ResEstimated)) | ResBlock; - - while (res_range) { - if ((type & ResTypeMask) == (res_range->res_type & ResTypeMask)) { - if (res_range->block_begin > window_start) - min = res_range->block_begin; - else - min = window_start; - if (res_range->block_end < window_end) - max = res_range->block_end; - else - max = window_end; - min = ALIGN(min,align_mask); - /* do not produce an overflow! */ - while (min < max && (max - min) >= (size - 1)) { - RANGE(r,min,min + size - 1,type); - tmp = ChkConflict(&r,Acc,SETUP); - if (!tmp) { - tmp = ChkConflict(&r,avoid,SETUP); - if (!tmp) { - return r; - } - } - min = ALIGN(tmp,align_mask); - } - } - res_range = res_range->next; - } - RANGE(r,0,0,ResEnd); - return r; -} - -#define mt_max ~(memType)0 -#define length sizeof(memType) * 8 -/* - * make_base() -- assign the lowest bits to the bits set in mask. - * example: mask 011010 val 0000110 -> 011000 - */ -static memType -make_base(memType val, memType mask) -{ - int i,j = 0; - memType ret = 0 - ; - for (i = 0;i> j) & 1) << i); - j++; - } - } - return ret; -} - -/* - * make_base() -- assign the bits set in mask to the lowest bits. - * example: mask 011010 , val 010010 -> 000011 - */ -static memType -unmake_base(memType val, memType mask) -{ - int i,j = 0; - memType ret = 0; - - for (i = 0;i> i) & 1) << j); - j++; - } - } - return ret; -} - -static memType -fix_counter(memType val, memType old_mask, memType mask) -{ - mask = old_mask & mask; - - val = make_base(val,old_mask); - return unmake_base(val,mask); -} - -resRange -xf86GetSparse(unsigned long type, memType fixed_bits, - memType decode_mask, memType address_mask, resPtr avoid) -{ - resRange r = {ResEnd,0,0}; - memType new_mask; - memType mask1; - memType base; - memType counter = 0; - memType counter1; - memType max_counter = ~(memType)0; - memType max_counter1; - memType conflict = 0; - - /* for sanity */ - type = (type & ~(ResExtMask | ResBios | ResEstimated)) | ResSparse; - - /* - * a sparse address consists of 3 parts: - * fixed_bits: F bits which hard decoded by the hardware - * decode_bits: D bits which are used to decode address - * but which may be set by software - * address_bits: A bits which are used to address the - * sparse range. - * the decode_mask marks all decode bits while the address_mask - * masks out all address_bits: - * F D A - * decode_mask: 0 1 0 - * address_mask: 1 1 0 - */ - decode_mask &= address_mask; - new_mask = decode_mask; - - /* - * We start by setting the decode_mask bits to different values - * when a conflict is found the address_mask of the conflicting - * resource is returned. We remove those bits from decode_mask - * that are also set in the returned address_mask as they always - * conflict with resources which use them as address masks. - * The resoulting mask is stored in new_mask. - * We continue until no conflict is found or until we have - * tried all possible settings of new_mask. - */ - while (1) { - base = make_base(counter,new_mask) | fixed_bits; - RANGE(r,base,address_mask,type); - conflict = ChkConflict(&r,Acc,SETUP); - if (!conflict) { - conflict = ChkConflict(&r,avoid,SETUP); - if (!conflict) { - return r; - } - } - counter = fix_counter(counter,new_mask,conflict); - max_counter = fix_counter(max_counter,new_mask,conflict); - new_mask &= conflict; - counter ++; - if (counter > max_counter) break; - } - if (!new_mask && (new_mask == decode_mask)) { - RANGE(r,0,0,ResEnd); - return r; - } - /* - * if we haven't been successful we also try to modify those - * bits in decode_mask that are not at the same time set in - * new mask. These bits overlap with address_bits of some - * resources. If a conflict with a resource of this kind is - * found (ie. returned_mask & mask1 != mask1) with - * mask1 = decode_mask & ~new_mask we cannot - * use our choice of bits in the new_mask part. We try - * another choice. - */ - max_counter = fix_counter(mt_max,mt_max,new_mask); - mask1 = decode_mask & ~new_mask; - max_counter1 = fix_counter(mt_max,mt_max,mask1); - counter = 0; - - while (1) { - counter1 = 0; - while (1) { - base = make_base(counter1,mask1); - RANGE(r,base,address_mask,type); - conflict = ChkConflict(&r,Acc,SETUP); - if (!conflict) { - conflict = ChkConflict(&r,avoid,SETUP); - if (!conflict) { - return r; - } - } - counter1 ++; - if ((mask1 & conflict) != mask1 || counter1 > max_counter1) - break; - } - counter ++; - if (counter > max_counter) break; - } - RANGE(r,0,0,ResEnd); - return r; -} - -#undef length -#undef mt_max - -/* - * Resource registrarion - */ - -static resList -xf86GetResourcesImplicitly(int entityIndex) -{ - if (entityIndex >= xf86NumEntities) return NULL; - - switch (xf86Entities[entityIndex]->bus.type) { - case BUS_ISA: - case BUS_NONE: - case BUS_SBUS: - return NULL; - case BUS_PCI: - return GetImplicitPciResources(entityIndex); - case BUS_last: - return NULL; - } - return NULL; -} - -static void -convertRange2Host(int entityIndex, resRange *pRange) -{ - if (pRange->type & ResBus) { - switch (xf86Entities[entityIndex]->busType) { - case BUS_PCI: - pciConvertRange2Host(entityIndex,pRange); - break; - case BUS_ISA: - isaConvertRange2Host(pRange); - break; - default: - break; - } - - pRange->type &= ~ResBus; - } -} - -/* - * xf86RegisterResources() -- attempts to register listed resources. - * If list is NULL it tries to obtain resources implicitly. Function - * returns a resPtr listing all resources not successfully registered. - */ - -resPtr -xf86RegisterResources(int entityIndex, resList list, unsigned long access) -{ - resPtr res = NULL; - resRange range; - resList list_f = NULL; - - if (!list) { - list = xf86GetResourcesImplicitly(entityIndex); - /* these resources have to be in host address space already */ - if (!list) return NULL; - list_f = list; - } - - while(list->type != ResEnd) { - range = *list; - - convertRange2Host(entityIndex,&range); - - if ((access != ResNone) && (access & ResAccMask)) { - range.type = (range.type & ~ResAccMask) | (access & ResAccMask); - } - range.type &= ~ResEstimated; /* Not allowed for drivers */ -#if !((defined(__alpha__) || (defined(__ia64__))) && defined(linux)) - /* On Alpha Linux, do not check for conflicts, trust the kernel. */ - if (checkConflict(&range, Acc, entityIndex, SETUP,TRUE)) - res = xf86AddResToList(res,&range,entityIndex); - else -#endif - { - Acc = xf86AddResToList(Acc,&range,entityIndex); - } - list++; - } - if (list_f) - xfree(list_f); - -#ifdef DEBUG - xf86MsgVerb(X_INFO, 3,"Resources after driver initialization\n"); - xf86PrintResList(3, Acc); - if (res) xf86MsgVerb(X_INFO, 3, - "Failed Resources after driver initialization " - "for Entity: %i\n",entityIndex); - xf86PrintResList(3, res); -#endif - return res; - -} - -static void -busTypeSpecific(EntityPtr pEnt, xf86State state, xf86AccessPtr *acc_mem, - xf86AccessPtr *acc_io, xf86AccessPtr *acc_mem_io) -{ - pciAccPtr *ppaccp; - - switch (pEnt->bus.type) { - case BUS_ISA: - case BUS_SBUS: - *acc_mem = *acc_io = *acc_mem_io = &AccessNULL; - break; - break; - case BUS_PCI: - ppaccp = xf86PciAccInfo; - while (*ppaccp) { - if ((*ppaccp)->busnum == pEnt->pciBusId.bus - && (*ppaccp)->devnum == pEnt->pciBusId.device - && (*ppaccp)->funcnum == pEnt->pciBusId.func) { - *acc_io = &(*ppaccp)->ioAccess; - *acc_mem = &(*ppaccp)->memAccess; - *acc_mem_io = &(*ppaccp)->io_memAccess; - break; - } - ppaccp++; - } - break; - default: - *acc_mem = *acc_io = *acc_mem_io = NULL; - break; - } - return; -} - -static void -setAccess(EntityPtr pEnt, xf86State state) -{ - - xf86AccessPtr acc_mem, acc_io, acc_mem_io; - xf86AccessPtr org_mem = NULL, org_io = NULL, org_mem_io = NULL; - int prop; - - busTypeSpecific(pEnt,state,&acc_mem,&acc_io,&acc_mem_io); - - /* The replacement function needs to handle _all_ shared resources */ - /* unless they are handeled locally and disabled otherwise */ - if (pEnt->rac) { - if (pEnt->rac->io_new) { - org_io = acc_io; - acc_io = pEnt->rac->io_new; - } - if (pEnt->rac->mem_new) { - org_mem = acc_mem; - acc_mem = pEnt->rac->mem_new; - } - if (pEnt->rac->io_mem_new) { - org_mem_io = acc_mem_io; - acc_mem_io = pEnt->rac->io_mem_new; - } - } - - if (state == OPERATING) { - prop = pEnt->entityProp; - switch(pEnt->entityProp & NEED_SHARED) { - case NEED_SHARED: - pEnt->access->rt = MEM_IO; - break; - case NEED_IO_SHARED: - pEnt->access->rt = IO; - break; - case NEED_MEM_SHARED: - pEnt->access->rt = MEM; - break; - default: - pEnt->access->rt = NONE; - } - } else { - prop = NEED_SHARED | NEED_MEM | NEED_IO; - pEnt->access->rt = MEM_IO; - } - - switch(pEnt->access->rt) { - case IO: - pEnt->access->pAccess = acc_io; - break; - case MEM: - pEnt->access->pAccess = acc_mem; - break; - case MEM_IO: - pEnt->access->pAccess = acc_mem_io; - break; - default: /* no conflicts at all */ - pEnt->access->pAccess = NULL; /* remove from RAC */ - break; - } - - if (org_io) { - /* does the driver want the old access func? */ - if (pEnt->rac->old) { - /* give it to the driver, leave state disabled */ - pEnt->rac->old->io = org_io; - } else if (org_io->AccessEnable) { - /* driver doesn't want it - enable generic access */ - org_io->AccessEnable(org_io->arg); - } - } - - if (org_mem_io) { - /* does the driver want the old access func? */ - if (pEnt->rac->old) { - /* give it to the driver, leave state disabled */ - pEnt->rac->old->io_mem = org_mem_io; - } else if (org_mem_io->AccessEnable) { - /* driver doesn't want it - enable generic access */ - org_mem_io->AccessEnable(org_mem_io->arg); - } - } - - if (org_mem) { - /* does the driver want the old access func? */ - if (pEnt->rac->old) { - /* give it to the driver, leave state disabled */ - pEnt->rac->old->mem = org_mem; - } else if (org_mem->AccessEnable) { - /* driver doesn't want it - enable generic access */ - org_mem->AccessEnable(org_mem->arg); - } - } - - if (!(prop & NEED_MEM_SHARED)){ - if (prop & NEED_MEM) { - if (acc_mem && acc_mem->AccessEnable) - acc_mem->AccessEnable(acc_mem->arg); - } else { - if (acc_mem && acc_mem->AccessDisable) - acc_mem->AccessDisable(acc_mem->arg); - } - } - - if (!(prop & NEED_IO_SHARED)) { - if (prop & NEED_IO) { - if (acc_io && acc_io->AccessEnable) - acc_io->AccessEnable(acc_io->arg); - } else { - if (acc_io && acc_io->AccessDisable) - acc_io->AccessDisable(acc_io->arg); - } - } - - /* disable shared resources */ - if (pEnt->access->pAccess - && pEnt->access->pAccess->AccessDisable) - pEnt->access->pAccess->AccessDisable(pEnt->access->pAccess->arg); - - /* - * If device is not under access control it is enabled. - * If it needs bus routing do it here as it isn't bus - * type specific. Any conflicts should be checked at this - * stage - */ - if (!pEnt->access->pAccess - && (pEnt->entityProp & (state == SETUP ? NEED_VGA_ROUTED_SETUP : - NEED_VGA_ROUTED))) - ((BusAccPtr)pEnt->busAcc)->set_f(pEnt->busAcc); -} - - -/* - * xf86EnterServerState() -- set state the server is in. - */ - -typedef enum { TRI_UNSET, TRI_TRUE, TRI_FALSE } TriState; - -static void -SetSIGIOForState(xf86State state) -{ - static int sigio_state; - static TriState sigio_blocked = TRI_UNSET; - - if ((state == SETUP) && (sigio_blocked != TRI_TRUE)) { - sigio_state = xf86BlockSIGIO(); - sigio_blocked = TRI_TRUE; - } else if ((state == OPERATING) && (sigio_blocked != TRI_UNSET)) { - xf86UnblockSIGIO(sigio_state); - sigio_blocked = TRI_FALSE; - } -} - -void -xf86EnterServerState(xf86State state) -{ - EntityPtr pEnt; - ScrnInfoPtr pScrn; - int i,j; - int needVGA = 0; - resType rt; - /* - * This is a good place to block SIGIO during SETUP state. - * SIGIO should be blocked in SETUP state otherwise (u)sleep() - * might get interrupted early. - * We take care not to call xf86BlockSIGIO() twice. - */ - SetSIGIOForState(state); -#ifdef DEBUG - if (state == SETUP) - ErrorF("Entering SETUP state\n"); - else - ErrorF("Entering OPERATING state\n"); -#endif - - /* When servicing a dumb framebuffer we don't need to do anything */ - if (doFramebufferMode) return; - - for (i=0; ientityList[pScrn->numEntities - 1]; - pScrn->access = xf86Entities[j]->access; - - for (j = 0; jnumEntities; j++) { - pEnt = xf86Entities[xf86Screens[i]->entityList[j]]; - if (pEnt->entityProp & (state == SETUP ? NEED_VGA_ROUTED_SETUP - : NEED_VGA_ROUTED)) - xf86Screens[i]->busAccess = pEnt->busAcc; - } - if (xf86Screens[i]->busAccess) - needVGA ++; - } - - /* - * if we just have one screen we don't have RAC. - * Therefore just enable the screen and return. - */ - if (!needRAC) { - xf86EnableAccess(xf86Screens[0]); - notifyStateChange(NOTIFY_ENABLE); - return; - } - - if (state == SETUP) - notifyStateChange(NOTIFY_SETUP_TRANSITION); - else - notifyStateChange(NOTIFY_OPERATING_TRANSITION); - - clearAccess(); - for (i=0; inumEntities; j++) { - pEnt = xf86Entities[xf86Screens[i]->entityList[j]]; - setAccess(pEnt,state); - - if (pEnt->access->rt != NONE) { - if (rt != NONE && rt != pEnt->access->rt) - rt = MEM_IO; - else - rt = pEnt->access->rt; - } - } - xf86Screens[i]->resourceType = rt; - if (rt == NONE) { - xf86Screens[i]->access = NULL; - if (needVGA < 2) - xf86Screens[i]->busAccess = NULL; - } - -#ifdef DEBUG - if (xf86Screens[i]->busAccess) - ErrorF("Screen %i setting vga route\n",i); -#endif - switch (rt) { - case MEM_IO: - xf86MsgVerb(X_INFO, 3, "Screen %i shares mem & io resources\n",i); - break; - case IO: - xf86MsgVerb(X_INFO, 3, "Screen %i shares io resources\n",i); - break; - case MEM: - xf86MsgVerb(X_INFO, 3, "Screen %i shares mem resources\n",i); - break; - default: - xf86MsgVerb(X_INFO, 3, "Entity %i shares no resources\n",i); - break; - } - } - if (state == SETUP) - notifyStateChange(NOTIFY_SETUP); - else - notifyStateChange(NOTIFY_OPERATING); -} - -/* - * xf86SetOperatingState() -- Set ResOperMask for resources listed. - */ -resPtr -xf86SetOperatingState(resList list, int entityIndex, int mask) -{ - resPtr acc; - resPtr r_fail = NULL; - resRange range; - - while (list->type != ResEnd) { - range = *list; - convertRange2Host(entityIndex,&range); - - acc = Acc; - while (acc) { -#define MASK (ResTypeMask | ResExtMask) - if ((acc->entityIndex == entityIndex) - && (acc->val.a == range.a) && (acc->val.b == range.b) - && ((acc->val.type & MASK) == (range.type & MASK))) - break; -#undef MASK - acc = acc->next; - } - if (acc) - acc->val.type = (acc->val.type & ~ResOprMask) - | (mask & ResOprMask); - else { - r_fail = xf86AddResToList(r_fail,&range,entityIndex); - } - list ++; - } - - return r_fail; -} - -/* - * Stage specific code - */ - /* - * ProcessEstimatedConflicts() -- Do something about driver-registered - * resources that conflict with estimated resources. For now, just register - * them with a logged warning. - */ -#ifdef REDUCER -static void -ProcessEstimatedConflicts(void) -{ - if (!AccReducers) - return; - - /* Temporary */ - xf86MsgVerb(X_WARNING, 3, - "Registering the following despite conflicts with estimated" - " resources:\n"); - xf86PrintResList(3, AccReducers); - Acc = xf86JoinResLists(Acc, AccReducers); - AccReducers = NULL; -} -#endif - -/* - * xf86ClaimFixedResources() -- This function gets called from the - * driver Probe() function to claim fixed resources. - */ -static void -resError(resList list) -{ - FatalError("A driver tried to allocate the %s %sresource at \n" - "0x%lx:0x%lx which conflicted with another resource. Send the\n" - "output of the server to %s. Please \n" - "specify your computer hardware as closely as possible.\n", - ResIsBlock(list)?"Block":"Sparse", - ResIsMem(list)?"Mem":"Io", - ResIsBlock(list)?list->rBegin:list->rBase, - ResIsBlock(list)?list->rEnd:list->rMask,BUILDERADDR); -} - -/* - * xf86ClaimFixedResources() is used to allocate non-relocatable resources. - * This should only be done by a driver's Probe() function. - */ -void -xf86ClaimFixedResources(resList list, int entityIndex) -{ - resPtr ptr = NULL; - resRange range; - - if (!list) return; - - while (list->type !=ResEnd) { - range = *list; - - convertRange2Host(entityIndex,&range); - - range.type &= ~ResEstimated; /* Not allowed for drivers */ - switch (range.type & ResAccMask) { - case ResExclusive: - if (!xf86ChkConflict(&range, entityIndex)) { - Acc = xf86AddResToList(Acc, &range, entityIndex); -#ifdef REDUCER - } else { - range.type |= ResEstimated; - if (!xf86ChkConflict(&range, entityIndex) && - !checkConflict(&range, AccReducers, entityIndex, - SETUP, FALSE)) { - range.type &= ~(ResEstimated | ResBios); - AccReducers = - xf86AddResToList(AccReducers, &range, entityIndex); -#endif - } else resError(&range); /* no return */ -#ifdef REDUCER - } -#endif - break; - case ResShared: - /* at this stage the resources are just added to the - * EntityRec. After the Probe() phase this list is checked by - * xf86PostProbe(). All resources which don't - * conflict with already allocated ones are allocated - * and removed from the EntityRec. Thus a non-empty resource - * list in the EntityRec indicates resource conflicts the - * driver should either handle or fail. - */ - if (xf86Entities[entityIndex]->active) - ptr = xf86AddResToList(ptr,&range,entityIndex); - break; - } - list++; - } - xf86Entities[entityIndex]->resources = - xf86JoinResLists(xf86Entities[entityIndex]->resources,ptr); - xf86MsgVerb(X_INFO, 3, - "resource ranges after xf86ClaimFixedResources() call:\n"); - xf86PrintResList(3,Acc); -#ifdef REDUCER - ProcessEstimatedConflicts(); -#endif -#ifdef DEBUG - if (ptr) { - xf86MsgVerb(X_INFO, 3, "to be registered later:\n"); - xf86PrintResList(3,ptr); - } -#endif -} - -static void -checkRoutingForScreens(xf86State state) -{ - resList list = resVgaUnusedExclusive; - resPtr pResVGA = NULL; - resPtr pResVGAHost; - pointer vga = NULL; - int i,j; - int entityIndex; - EntityPtr pEnt; - resPtr pAcc; - resRange range; - - /* - * find devices that need VGA routed: ie the ones that have - * registered VGA resources without ResUnused. ResUnused - * doesn't conflict with itself therefore use it here. - */ - while (list->type != ResEnd) { /* create resPtr from resList for VGA */ - range = *list; - range.type &= ~(ResBios | ResEstimated); /* if set remove them */ - pResVGA = xf86AddResToList(pResVGA, &range, -1); - list++; - } - - for (i = 0; i < xf86NumScreens; i++) { - for (j = 0; j < xf86Screens[i]->numEntities; j++) { - entityIndex = xf86Screens[i]->entityList[j]; - pEnt = xf86Entities[entityIndex]; - pAcc = Acc; - vga = NULL; - pResVGAHost = xf86DupResList(pResVGA); - xf86ConvertListToHost(entityIndex,pResVGAHost); - while (pAcc) { - if (pAcc->entityIndex == entityIndex) - if (checkConflict(&pAcc->val, pResVGAHost, - entityIndex, state, FALSE)) { - if (vga && vga != pEnt->busAcc) { - xf86Msg(X_ERROR, "Screen %i needs vga routed to" - "different buses - deleting\n",i); - xf86DeleteScreen(i--,0); - } -#ifdef DEBUG - { - resPtr rlist = xf86AddResToList(NULL,&pAcc->val, - pAcc->entityIndex); - xf86MsgVerb(X_INFO,3,"====== %s\n", - state == OPERATING ? "OPERATING" - : "SETUP"); - xf86MsgVerb(X_INFO,3,"%s Resource:\n", - (pAcc->val.type) & ResMem ? "Mem" :"Io"); - xf86PrintResList(3,rlist); - xf86FreeResList(rlist); - xf86MsgVerb(X_INFO,3,"Conflicts with:\n"); - xf86PrintResList(3,pResVGAHost); - xf86MsgVerb(X_INFO,3,"=====\n"); - } -#endif - vga = pEnt->busAcc; - pEnt->entityProp |= (state == SETUP - ? NEED_VGA_ROUTED_SETUP : NEED_VGA_ROUTED); - if (state == OPERATING) { - if (pAcc->val.type & ResMem) - pEnt->entityProp |= NEED_VGA_MEM; - else - pEnt->entityProp |= NEED_VGA_IO; - } - } - pAcc = pAcc->next; - } - if (vga) - xf86MsgVerb(X_INFO, 3,"Setting vga for screen %i.\n",i); - xf86FreeResList(pResVGAHost); - } - } - xf86FreeResList(pResVGA); -} - -/* - * xf86PostProbe() -- Allocate all non conflicting resources - * This function gets called by xf86Init(). - */ -void -xf86PostProbe(void) -{ - memType val; - int i,j; - resPtr resp, acc, tmp, resp_x, *pprev_next; - - if (fbSlotClaimed) { - if (pciSlotClaimed || isaSlotClaimed -#if defined(__sparc__) && !defined(__OpenBSD__) - || sbusSlotClaimed -#endif - ) { - FatalError("Cannot run in framebuffer mode. Please specify busIDs " - " for all framebuffer devices\n"); - return; - } else { - xf86Msg(X_INFO,"Running in FRAMEBUFFER Mode\n"); - xf86AccessRestoreState(); - notifyStateChange(NOTIFY_ENABLE); - doFramebufferMode = TRUE; - - return; - } - } - /* don't compare against ResInit - remove it from clone.*/ - acc = tmp = xf86DupResList(Acc); - pprev_next = &acc; - while (tmp) { - if (tmp->res_type & ResInit) { - (*pprev_next) = tmp->next; - xfree(tmp); - } else - pprev_next = &(tmp->next); - tmp = (*pprev_next); - } - - for (i=0; iresources; - xf86Entities[i]->resources = NULL; - resp_x = NULL; - while (resp) { - if (! (val = checkConflict(&resp->val,acc,i,SETUP,FALSE))) { - resp->res_type &= ~(ResBios); /* just used for chkConflict() */ - tmp = resp_x; - resp_x = resp; - resp = resp->next; - resp_x->next = tmp; -#ifdef REDUCER - } else { - resp->res_type |= ResEstimated; - if (!checkConflict(&resp->val, acc, i, SETUP, FALSE)) { - resp->res_type &= ~(ResEstimated | ResBios); - tmp = AccReducers; - AccReducers = resp; - resp = resp->next; - AccReducers->next = tmp; -#endif - } else { - xf86MsgVerb(X_INFO, 3, "Found conflict at: 0x%lx\n",val); - resp->res_type &= ~ResEstimated; - tmp = xf86Entities[i]->resources; - xf86Entities[i]->resources = resp; - resp = resp->next; - xf86Entities[i]->resources->next = tmp; - } -#ifdef REDUCER - } -#endif - } - xf86JoinResLists(Acc,resp_x); -#ifdef REDUCER - ProcessEstimatedConflicts(); -#endif - } - xf86FreeResList(acc); -#if !(defined(__alpha__) && defined(linux)) && \ - !(defined(__ia64__) && defined(linux)) && \ - !(defined(__sparc64__) && defined(__OpenBSD__)) - /* - * No need to validate on Alpha Linux or OpenBSD/sparc64, - * trust the kernel. - */ - ValidatePci(); -#endif - - xf86MsgVerb(X_INFO, 3, "resource ranges after probing:\n"); - xf86PrintResList(3, Acc); - checkRoutingForScreens(SETUP); - - for (i = 0; i < xf86NumScreens; i++) { - for (j = 0; jnumEntities; j++) { - EntityPtr pEnt = xf86Entities[xf86Screens[i]->entityList[j]]; - if ((pEnt->entityProp & NEED_VGA_ROUTED_SETUP) && - ((xf86Screens[i]->busAccess = pEnt->busAcc))) - break; - } - } -} - -static void -checkRequiredResources(int entityIndex) -{ - resRange range; - resPtr pAcc = Acc; - const EntityPtr pEnt = xf86Entities[entityIndex]; - while (pAcc) { - if (pAcc->entityIndex == entityIndex) { - range = pAcc->val; - /* ResAny to find conflicts with anything. */ - range.type = (range.type & ~ResAccMask) | ResAny | ResBios; - if (checkConflict(&range,Acc,entityIndex,OPERATING,FALSE)) - switch (pAcc->res_type & ResPhysMask) { - case ResMem: - pEnt->entityProp |= NEED_MEM_SHARED; - break; - case ResIo: - pEnt->entityProp |= NEED_IO_SHARED; - break; - } - if (!(pAcc->res_type & ResOprMask)) { - switch (pAcc->res_type & ResPhysMask) { - case ResMem: - pEnt->entityProp |= NEED_MEM; - break; - case ResIo: - pEnt->entityProp |= NEED_IO; - break; - } - } - } - pAcc = pAcc->next; - } - - /* check if we can separately enable mem/io resources */ - /* XXX we still need to find out how to set this yet */ - if ( ((pEnt->entityProp & NO_SEPARATE_MEM_FROM_IO) - && (pEnt->entityProp & NEED_MEM_SHARED)) - || ((pEnt->entityProp & NO_SEPARATE_IO_FROM_MEM) - && (pEnt->entityProp & NEED_IO_SHARED)) ) - pEnt->entityProp |= NEED_SHARED; - /* - * After we have checked all resources of an entity agains any - * other resource we know if the entity need this resource type - * (ie. mem/io) at all. if not we can disable this type completely, - * so no need to share it either. - */ - if ((pEnt->entityProp & NEED_MEM_SHARED) - && (!(pEnt->entityProp & NEED_MEM)) - && (!(pEnt->entityProp & NO_SEPARATE_MEM_FROM_IO))) - pEnt->entityProp &= ~(unsigned long)NEED_MEM_SHARED; - - if ((pEnt->entityProp & NEED_IO_SHARED) - && (!(pEnt->entityProp & NEED_IO)) - && (!(pEnt->entityProp & NO_SEPARATE_IO_FROM_MEM))) - pEnt->entityProp &= ~(unsigned long)NEED_IO_SHARED; -} - -void -xf86PostPreInit() -{ - if (doFramebufferMode) return; - - if (xf86NumScreens > 1) - needRAC = TRUE; - -#ifdef XFree86LOADER - xf86MsgVerb(X_INFO, 3, "do I need RAC?"); - - if (needRAC) { - xf86ErrorFVerb(3, " Yes, I do.\n"); - - if (!xf86LoadOneModule("rac",NULL)) - FatalError("Cannot load RAC module\n"); - } else - xf86ErrorFVerb(3, " No, I don't.\n"); -#endif - - xf86MsgVerb(X_INFO, 3, "resource ranges after preInit:\n"); - xf86PrintResList(3, Acc); -} - -void -xf86PostScreenInit(void) -{ - int i,j; - ScreenPtr pScreen; - unsigned int flags; - int nummem = 0, numio = 0; -#ifdef XFree86LOADER - pointer xf86RACInit = NULL; -#endif - - if (doFramebufferMode) { - SetSIGIOForState(OPERATING); - return; - } - -#ifdef XFree86LOADER - if (needRAC) { - xf86RACInit = LoaderSymbol("xf86RACInit"); - if (!xf86RACInit) - FatalError("Cannot resolve symbol \"xf86RACInit\"\n"); - } -#endif -#ifdef DEBUG - ErrorF("PostScreenInit generation: %i\n",serverGeneration); -#endif - if (serverGeneration == 1) { - checkRoutingForScreens(OPERATING); - for (i=0; ientityProp & NEED_MEM_SHARED) - nummem++; - if (xf86Entities[i]->entityProp & NEED_IO_SHARED) - numio++; - } - for (i = 0; i < xf86NumEntities; i++) { - if (nummem < 2) - xf86Entities[i]->entityProp &= ~NEED_MEM_SHARED; - if (numio < 2) - xf86Entities[i]->entityProp &= ~NEED_IO_SHARED; - } - } - - if (xf86Screens && needRAC) { - int needRACforVga = 0; - - for (i = 0; i < xf86NumScreens; i++) { - for (j = 0; j < xf86Screens[i]->numEntities; j++) { - if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp - & NEED_VGA_ROUTED) { - needRACforVga ++; - break; /* only count each screen once */ - } - } - } - - for (i = 0; i < xf86NumScreens; i++) { - Bool needRACforMem = FALSE, needRACforIo = FALSE; - - for (j = 0; j < xf86Screens[i]->numEntities; j++) { - if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp - & NEED_MEM_SHARED) - needRACforMem = TRUE; - if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp - & NEED_IO_SHARED) - needRACforIo = TRUE; - /* - * We may need RAC although we don't share any resources - * as we need to route VGA to the correct bus. This can - * only be done simultaniously for MEM and IO. - */ - if (needRACforVga > 1) { - if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp - & NEED_VGA_MEM) - needRACforMem = TRUE; - if (xf86Entities[xf86Screens[i]->entityList[j]]->entityProp - & NEED_VGA_IO) - needRACforIo = TRUE; - } - } - - pScreen = xf86Screens[i]->pScreen; - flags = 0; - if (needRACforMem) { - flags |= xf86Screens[i]->racMemFlags; - xf86ErrorFVerb(3, "Screen %d is using RAC for mem\n", i); - } - if (needRACforIo) { - flags |= xf86Screens[i]->racIoFlags; - xf86ErrorFVerb(3, "Screen %d is using RAC for io\n", i); - } - -#ifdef XFree86LOADER - ((Bool(*)(ScreenPtr,unsigned int))xf86RACInit) - (pScreen,flags); -#else - xf86RACInit(pScreen,flags); -#endif - } - } - - xf86EnterServerState(OPERATING); - -} - -/* - * Sets - */ - - -static resPtr -decomposeSparse(resRange range) -{ - resRange new; - resPtr ret = NULL; - memType val = range.rBegin; - int i = 0; - - new.type = (range.type & ~ResExtMask) | ResSparse; - - while (1) { - if (val & 0x01) { - new.rBase = (val << i); - new.rMask = ~((1 << i) - 1); - ret = xf86AddResToList(ret,&new,-1); - val ++; - } - i++; - val >>= 1; - if ((((val + 1) << i) - 1) > range.rEnd) - break; - } - i--; - val <<= 1; - - while (1) { - if((((val + 1) << i) - 1)> range.rEnd) { - if (--i < 0) break; - val <<= 1; - } else { - new.rBase = (val << i); - new.rMask = ~((1 << i) - 1); - val++; - ret = xf86AddResToList(ret,&new,-1); - } - } - return ret; -} - -static Bool -x_isSubsetOf(resRange range, resPtr list1, resPtr list2) -{ - resRange range1, range2; - memType m1_A_m2; - Bool ret; - resPtr list; - - if (list1) { - list = list1; - if ((range.type & ResTypeMask) == (list->res_type & ResTypeMask)) { - switch (range.type & ResExtMask) { - case ResBlock: - if ((list->res_type & ResExtMask) == ResBlock) { - if (range.rBegin >= list->block_begin - && range.rEnd <= list->block_end) - return TRUE; - else if (range.rBegin < list->block_begin - && range.rEnd > list->block_end) { - RANGE(range1, range.rBegin, list->block_begin - 1, - range.type); - RANGE(range2, list->block_end + 1, range.rEnd, - range.type); - return (x_isSubsetOf(range1,list->next,list2) && - x_isSubsetOf(range2,list->next,list2)); - } - else if (range.rBegin >= list->block_begin - && range.rBegin <= list->block_end) { - RANGE(range1, list->block_end + 1, range.rEnd, - range.type); - return (x_isSubsetOf(range1,list->next,list2)); - } else if (range.rEnd >= list->block_begin - && range.rEnd <= list->block_end) { - RANGE(range1,range.rBegin, list->block_begin - 1, - range.type); - return (x_isSubsetOf(range1,list->next,list2)); - } - } - break; - case ResSparse: - if ((list->res_type & ResExtMask) == ResSparse) { - memType test; - int i; - - m1_A_m2 = range.rMask & list->sparse_mask; - if ((range.rBase ^ list->sparse_base) & m1_A_m2) - break; - /* - * We use the following system: - * let 0 ^= mask:1 base:0, 1 ^= mask:1 base:1, - * X mask:0 ; S: set TSS: test set for subset - * NTSS: new test set after test - * S: 1 0 1 0 X X 0 1 X - * TSS: 1 0 0 1 1 0 X X X - * T: 0 0 1 1 0 0 0 0 0 - * NTSS: 1 0 0/X 1/X 1 0 1 0 X - * R: 0 0 0 0 0 0 1 1 0 - * If R != 0 TSS and S are disjunct - * If R == 0 TSS is subset of S - * If R != 0 NTSS contains elements from TSS - * which are not also members of S. - * If a T is set one of the correspondig bits - * in NTSS must be set to the specified value - * all other are X - */ - test = list->sparse_mask & ~range.rMask; - if (test == 0) - return TRUE; - for (i = 0; i < sizeof(memType); i++) { - if ((test >> i) & 0x1) { - RANGE(range1, ((range.rBase & list->sparse_base) - | (range.rBase & ~list->sparse_mask) - | ((~list->sparse_base & list->sparse_mask) - & ~range.rMask)) & range1.rMask, - ((range.rMask | list->sparse_mask) & ~test) - | (1 << i), range.type); - return (x_isSubsetOf(range1,list->next,list2)); - } - } - } - break; - } - } - return (x_isSubsetOf(range,list->next,list2)); - } else if (list2) { - resPtr tmpList = NULL; - switch (range.type & ResExtMask) { - case ResBlock: - tmpList = decomposeSparse(range); - while (tmpList) { - if (!x_isSubsetOf(tmpList->val,list2,NULL)) { - xf86FreeResList(tmpList); - return FALSE; - } - tmpList = tmpList->next; - } - xf86FreeResList(tmpList); - return TRUE; - break; - case ResSparse: - while (list2) { - tmpList = xf86JoinResLists(tmpList,decomposeSparse(list2->val)); - list2 = list2->next; - } - ret = x_isSubsetOf(range,tmpList,NULL); - xf86FreeResList(tmpList); - return ret; - break; - } - } else - return FALSE; - - return FALSE; -} - -Bool -xf86IsSubsetOf(resRange range, resPtr list) -{ - resPtr dup = xf86DupResList(list); - resPtr r_sp = NULL, r = NULL, tmp = NULL; - Bool ret = FALSE; - - while (dup) { - tmp = dup; - dup = dup->next; - switch (tmp->res_type & ResExtMask) { - case ResBlock: - tmp->next = r; - r = tmp; - break; - case ResSparse: - tmp->next = r_sp; - r_sp = tmp; - break; - } - } - - switch (range.type & ResExtMask) { - case ResBlock: - ret = x_isSubsetOf(range,r,r_sp); - break; - case ResSparse: - ret = x_isSubsetOf(range,r_sp,r); - break; - } - xf86FreeResList(r); - xf86FreeResList(r_sp); - - return ret; -} - -Bool -xf86IsListSubsetOf(resPtr list, resPtr BaseList) -{ - while (list) { - if (! xf86IsSubsetOf(list->val,BaseList)) - return FALSE; - list = list->next; - } - return TRUE; -} - -resPtr -findIntersect(resRange Range, resPtr list) -{ - resRange range; - resPtr new = NULL; - - while (list) { - if ((Range.type & ResTypeMask) == (list->res_type & ResTypeMask)) { - switch (Range.type & ResExtMask) { - case ResBlock: - switch (list->res_type & ResExtMask) { - case ResBlock: - if (Range.rBegin >= list->block_begin) - range.rBegin = Range.rBegin; - else - range.rBegin = list->block_begin; - if (Range.rEnd <= list->block_end) - range.rEnd = Range.rEnd; - else - range.rEnd = list->block_end; - if (range.rEnd > range.rBegin) { - range.type = Range.type; - new = xf86AddResToList(new,&range,-1); - } - break; - case ResSparse: - new = xf86JoinResLists(new,xf86FindIntersectOfLists(new,decomposeSparse(list->val))); - break; - } - break; - case ResSparse: - switch (list->res_type & ResExtMask) { - case ResSparse: - if (!((~(range.rBase ^ list->sparse_base) - & (range.rMask & list->sparse_mask)))) { - RANGE(range, (range.rBase & list->sparse_base) - | (~range.rMask & list->sparse_base) - | (~list->sparse_mask & range.rBase), - range.rMask | list->sparse_mask, - Range.type); - new = xf86AddResToList(new,&range,-1); - } - break; - case ResBlock: - new = xf86JoinResLists(new,xf86FindIntersectOfLists( - decomposeSparse(range),list)); - break; - } - } - } - list = list->next; - } - return new; -} - -resPtr -xf86FindIntersectOfLists(resPtr l1, resPtr l2) -{ - resPtr ret = NULL; - - while (l1) { - ret = xf86JoinResLists(ret,findIntersect(l1->val,l2)); - l1 = l1->next; - } - return ret; -} - -#if 0 /* Not used */ -static resPtr -xf86FindComplement(resRange Range) -{ - resRange range; - memType tmp; - resPtr new = NULL; - int i; - - switch (Range.type & ResExtMask) { - case ResBlock: - if (Range.rBegin > 0) { - RANGE(range, 0, Range.rBegin - 1, Range.type); - new = xf86AddResToList(new,&range,-1); - } - if (Range.rEnd < (memType)~0) { - RANGE(range,Range.rEnd + 1, (memType)~0, Range.type); - new = xf86AddResToList(new,&range,-1); - } - break; - case ResSparse: - tmp = Range.rMask; - for (i = 0; i < sizeof(memType); i++) { - if (tmp & 0x1) { - RANGE(range,(~Range.rMask & range.rMask),(1 << i), Range.type); - new = xf86AddResToList(new,&range,-1); - } - } - break; - default: - break; - } - return new; -} -#endif - -resPtr -xf86ExtractTypeFromList(resPtr list, unsigned long type) -{ - resPtr ret = NULL; - - while (list) { - if ((list->res_type & ResTypeMask) == type) - ret = xf86AddResToList(ret,&(list->val),list->entityIndex); - list = list->next; - } - return ret; -} - -/*------------------------------------------------------------*/ -static void CheckGenericGA(void); - -/* - * xf86FindPrimaryDevice() - Find the display device which - * was active when the server was started. - */ -void -xf86FindPrimaryDevice() -{ - /* if no VGA device is found check for primary PCI device */ - if (primaryBus.type == BUS_NONE && xorgHWAccess) - CheckGenericGA(); - if (primaryBus.type != BUS_NONE) { - char *bus; - char *loc = xnfcalloc(1,9); - if (loc == NULL) return; - - switch (primaryBus.type) { - case BUS_PCI: - bus = "PCI"; - sprintf(loc," %2.2x:%2.2x:%1.1x",primaryBus.id.pci.bus, - primaryBus.id.pci.device,primaryBus.id.pci.func); - break; - case BUS_ISA: - bus = "ISA"; - loc[0] = '\0'; - break; - case BUS_SBUS: - bus = "SBUS"; - sprintf(loc," %2.2x",primaryBus.id.sbus.fbNum); - break; - default: - bus = ""; - loc[0] = '\0'; - } - - xf86MsgVerb(X_INFO, 2, "Primary Device is: %s%s\n",bus,loc); - xfree(loc); - } - -} - -#if !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) -#include "vgaHW.h" -#include "compiler.h" -#endif - -/* - * CheckGenericGA() - Check for presence of a VGA device. - */ -static void -CheckGenericGA() -{ -/* This needs to be changed for multiple domains */ -#if !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) && !defined(__ia64__) - IOADDRESS GenericIOBase = VGAHW_GET_IOBASE(); - CARD8 CurrentValue, TestValue; - - /* VGA CRTC registers are not used here, so don't bother unlocking them */ - - /* VGA has one more read/write attribute register than EGA */ - (void) inb(GenericIOBase + VGA_IN_STAT_1_OFFSET); /* Reset flip-flop */ - outb(VGA_ATTR_INDEX, 0x14 | 0x20); - CurrentValue = inb(VGA_ATTR_DATA_R); - outb(VGA_ATTR_DATA_W, CurrentValue ^ 0x0F); - outb(VGA_ATTR_INDEX, 0x14 | 0x20); - TestValue = inb(VGA_ATTR_DATA_R); - outb(VGA_ATTR_DATA_W, CurrentValue); - - if ((CurrentValue ^ 0x0F) == TestValue) { - primaryBus.type = BUS_ISA; - } -#endif -} - -Bool -xf86NoSharedResources(int screenIndex,resType res) -{ - int j; - - if (screenIndex > xf86NumScreens) - return TRUE; - - for (j = 0; j < xf86Screens[screenIndex]->numEntities; j++) { - switch (res) { - case IO: - if ( xf86Entities[xf86Screens[screenIndex]->entityList[j]]->entityProp - & NEED_IO_SHARED) - return FALSE; - break; - case MEM: - if ( xf86Entities[xf86Screens[screenIndex]->entityList[j]]->entityProp - & NEED_MEM_SHARED) - return FALSE; - break; - case MEM_IO: - if ( xf86Entities[xf86Screens[screenIndex]->entityList[j]]->entityProp - & NEED_SHARED) - return FALSE; - break; - case NONE: - break; - } - } - return TRUE; -} - -void -xf86ConvertListToHost(int entityIndex, resPtr list) -{ - while (list) { - convertRange2Host(entityIndex, &list->val); - list = list->next; - } -} - -void -xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg) -{ - StateChangeNotificationPtr ptr = - (StateChangeNotificationPtr)xnfalloc(sizeof(StateChangeNotificationRec)); - - ptr->func = func; - ptr->arg = arg; - ptr->next = StateChangeNotificationList; - StateChangeNotificationList = ptr; -} - -Bool -xf86DeregisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func) -{ - StateChangeNotificationPtr *ptr = &StateChangeNotificationList; - StateChangeNotificationPtr tmp; - - while (*ptr) { - if ((*ptr)->func == func) { - tmp = (*ptr); - (*ptr) = (*ptr)->next; - xfree(tmp); - return TRUE; - } - ptr = &((*ptr)->next); - } - return FALSE; -} - -static void -notifyStateChange(xf86NotifyState state) -{ - StateChangeNotificationPtr ptr = StateChangeNotificationList; - while (ptr) { - ptr->func(state,ptr->arg); - ptr = ptr->next; - } -} - -#ifdef async -Bool -xf86QueueAsyncEvent(void (*func)(pointer),pointer arg) -{ - AsyncQPtr new; - - if (!AsyncQ) return FALSE; - - new = (AsyncQPtr)xfnalloc(sizeof(AsyncQRec)); - new->func = func; - new->arg = arg; - (*AsyncQPtr)->next = new; - AsyncQPtr = &new; - return TRUE; -} -#endif - -/* Multihead accel sharing accessor functions and entity Private handling */ - -int -xf86GetLastScrnFlag(int entityIndex) -{ - if(entityIndex < xf86NumEntities) { - return(xf86Entities[entityIndex]->lastScrnFlag); - } else { - return -1; - } -} - -void -xf86SetLastScrnFlag(int entityIndex, int scrnIndex) -{ - if(entityIndex < xf86NumEntities) { - xf86Entities[entityIndex]->lastScrnFlag = scrnIndex; - } -} - -Bool -xf86IsEntityShared(int entityIndex) -{ - if(entityIndex < xf86NumEntities) { - if(xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL) { - return TRUE; - } - } - return FALSE; -} - -void -xf86SetEntityShared(int entityIndex) -{ - if(entityIndex < xf86NumEntities) { - xf86Entities[entityIndex]->entityProp |= IS_SHARED_ACCEL; - } -} - -Bool -xf86IsEntitySharable(int entityIndex) -{ - if(entityIndex < xf86NumEntities) { - if(xf86Entities[entityIndex]->entityProp & ACCEL_IS_SHARABLE) { - return TRUE; - } - } - return FALSE; -} - -void -xf86SetEntitySharable(int entityIndex) -{ - if(entityIndex < xf86NumEntities) { - xf86Entities[entityIndex]->entityProp |= ACCEL_IS_SHARABLE; - } -} - -Bool -xf86IsPrimInitDone(int entityIndex) -{ - if(entityIndex < xf86NumEntities) { - if(xf86Entities[entityIndex]->entityProp & SA_PRIM_INIT_DONE) { - return TRUE; - } - } - return FALSE; -} - -void -xf86SetPrimInitDone(int entityIndex) -{ - if(entityIndex < xf86NumEntities) { - xf86Entities[entityIndex]->entityProp |= SA_PRIM_INIT_DONE; - } -} - -void -xf86ClearPrimInitDone(int entityIndex) -{ - if(entityIndex < xf86NumEntities) { - xf86Entities[entityIndex]->entityProp &= ~SA_PRIM_INIT_DONE; - } -} - - -/* - * Allocate a private in the entities. - */ - -int -xf86AllocateEntityPrivateIndex(void) -{ - int idx, i; - EntityPtr pEnt; - DevUnion *nprivs; - - idx = xf86EntityPrivateCount++; - for (i = 0; i < xf86NumEntities; i++) { - pEnt = xf86Entities[i]; - nprivs = xnfrealloc(pEnt->entityPrivates, - xf86EntityPrivateCount * sizeof(DevUnion)); - /* Zero the new private */ - bzero(&nprivs[idx], sizeof(DevUnion)); - pEnt->entityPrivates = nprivs; - } - return idx; -} - -DevUnion * -xf86GetEntityPrivate(int entityIndex, int privIndex) -{ - if (entityIndex >= xf86NumEntities || privIndex >= xf86EntityPrivateCount) - return NULL; - - return &(xf86Entities[entityIndex]->entityPrivates[privIndex]); -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Bus.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Bus.h deleted file mode 100644 index 96da6e6a9..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Bus.h +++ /dev/null @@ -1,162 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.h,v 1.23 2003/08/24 17:36:50 dawes Exp $ */ - -/* - * Copyright (c) 1997-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * This file contains definitions of the bus-related data structures/types. - * Everything contained here is private to xf86Bus.c. In particular the - * video drivers must not include this file. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef _XF86_BUS_H -#define _XF86_BUS_H - -#include "xf86pciBus.h" -#ifdef __sparc__ -#include "xf86sbusBus.h" -#endif - -typedef struct racInfo { - xf86AccessPtr mem_new; - xf86AccessPtr io_new; - xf86AccessPtr io_mem_new; - xf86SetAccessFuncPtr old; -} AccessFuncRec, *AccessFuncPtr; - - -typedef struct { - DriverPtr driver; - int chipset; - int entityProp; - EntityProc entityInit; - EntityProc entityEnter; - EntityProc entityLeave; - pointer private; - resPtr resources; - Bool active; - Bool inUse; - BusRec bus; - EntityAccessPtr access; - AccessFuncPtr rac; - pointer busAcc; - int lastScrnFlag; - DevUnion * entityPrivates; - int numInstances; - GDevPtr * devices; - IOADDRESS domainIO; -} EntityRec, *EntityPtr; - -/* asynchronous event handling */ -#ifdef async -typedef struct _AsyncQRec { - void (*func)(pointer); - pointer arg; - struct _AsyncQRec *next; -} AsyncQRec, *AsyncQPtr; -#endif - -#define NO_SEPARATE_IO_FROM_MEM 0x0001 -#define NO_SEPARATE_MEM_FROM_IO 0x0002 -#define NEED_VGA_ROUTED 0x0004 -#define NEED_VGA_ROUTED_SETUP 0x0008 -#define NEED_MEM 0x0010 -#define NEED_IO 0x0020 -#define NEED_MEM_SHARED 0x0040 -#define NEED_IO_SHARED 0x0080 -#define ACCEL_IS_SHARABLE 0x0100 -#define IS_SHARED_ACCEL 0x0200 -#define SA_PRIM_INIT_DONE 0x0400 -#define NEED_VGA_MEM 0x1000 -#define NEED_VGA_IO 0x2000 - -#define NEED_SHARED (NEED_MEM_SHARED | NEED_IO_SHARED) - -#define busType bus.type -#define pciBusId bus.id.pci -#define isaBusId bus.id.isa -#define sbusBusId bus.id.sbus - -struct x_BusAccRec; -typedef void (*BusAccProcPtr)(struct x_BusAccRec *ptr); - -typedef struct x_BusAccRec { - BusAccProcPtr set_f; - BusAccProcPtr enable_f; - BusAccProcPtr disable_f; - BusAccProcPtr save_f; - BusAccProcPtr restore_f; - struct x_BusAccRec *current; /* pointer to bridge open on this bus */ - struct x_BusAccRec *primary; /* pointer to the bus connecting to this */ - struct x_BusAccRec *next; /* this links the different buses together */ - BusType type; - BusType busdep_type; - /* Bus-specific fields */ - union { - struct { - int bus; - int primary_bus; - PCITAG acc; - pciBridgesSave save; - } pci; - } busdep; -} BusAccRec, *BusAccPtr; - -/* state change notification callback */ -typedef struct _stateChange { - xf86StateChangeNotificationCallbackFunc func; - pointer arg; - struct _stateChange *next; -} StateChangeNotificationRec, *StateChangeNotificationPtr; - - -extern EntityPtr *xf86Entities; -extern int xf86NumEntities; -extern xf86AccessRec AccessNULL; -extern BusRec primaryBus; -extern resPtr Acc; -extern resPtr osRes; -extern resPtr ResRange; -extern BusAccPtr xf86BusAccInfo; - -int xf86AllocateEntity(void); -BusType StringToBusType(const char* busID, const char **retID); -memType ChkConflict(resRange *rgp, resPtr res, xf86State state); -Bool xf86IsSubsetOf(resRange range, resPtr list); -Bool xf86IsListSubsetOf(resPtr list, resPtr BaseList); -resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type); -resPtr findIntersect(resRange Range, resPtr list); -resPtr xf86FindIntersect(resRange Range, resPtr list); -void RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, - Bool useEstimated); -void xf86ConvertListToHost(int entityIndex, resPtr list); - -#endif /* _XF86_BUS_H */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Config.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Config.c deleted file mode 100644 index 0f03560a7..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Config.c +++ /dev/null @@ -1,2740 +0,0 @@ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 1.21 2005/12/20 22:30:50 alanc Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.276 2003/10/08 14:58:26 dawes Exp $ */ - - -/* - * Loosely based on code bearing the following copyright: - * - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - */ - -/* - * Copyright 1992-2003 by The XFree86 Project, Inc. - * Copyright 1997 by Metro Link, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * - * Authors: - * Dirk Hohndel - * David Dawes - * Marc La France - * Egbert Eich - * ... and others - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifdef XF86DRI -#include -#include -#endif - -#ifdef __UNIXOS2__ -#define I_NEED_OS2_H -#endif - -#include "xf86.h" -#include "xf86Parser.h" -#include "xf86tokens.h" -#include "xf86Config.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#include "globals.h" - -#ifdef XINPUT -#include "xf86Xinput.h" -extern DeviceAssocRec mouse_assoc; -#endif - -#ifdef XKB -#define XKB_IN_SERVER -#include -#endif - -#ifdef RENDER -#include "picture.h" -#endif - -#if (defined(i386) || defined(__i386__)) && \ - (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ - defined(__NetBSD__) || defined(linux) || \ - (defined(SVR4) && !defined(sun)) || defined(__GNU__)) -#define SUPPORT_PC98 -#endif - -/* - * These paths define the way the config file search is done. The escape - * sequences are documented in parser/scan.c. - */ -#ifndef ROOT_CONFIGPATH -#define ROOT_CONFIGPATH "%A," "%R," \ - "/etc/X11/%R," "%P/etc/X11/%R," \ - "%E," "%F," \ - "/etc/X11/%F," "%P/etc/X11/%F," \ - "%D/%X," \ - "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \ - "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \ - "%P/etc/X11/%X," \ - "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ - "%P/lib/X11/%X" -#endif -#ifndef USER_CONFIGPATH -#define USER_CONFIGPATH "/etc/X11/%S," "%P/etc/X11/%S," \ - "/etc/X11/%G," "%P/etc/X11/%G," \ - "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \ - "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \ - "%P/etc/X11/%X," \ - "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ - "%P/lib/X11/%X" -#endif -#ifndef PROJECTROOT -#define PROJECTROOT "/usr/X11R6" -#endif - -static char *fontPath = NULL; - -/* Forward declarations */ -static Bool configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, - int scrnum, MessageType from); -static Bool configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor); -static Bool configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, - Bool active); -static Bool configInput(IDevPtr inputp, XF86ConfInputPtr conf_input, - MessageType from); -static Bool configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display); -static Bool addDefaultModes(MonPtr monitorp); -#ifdef XF86DRI -static Bool configDRI(XF86ConfDRIPtr drip); -#endif -static Bool configExtensions(XF86ConfExtensionsPtr conf_ext); - -/* - * xf86GetPathElem -- - * Extract a single element from the font path string starting at - * pnt. The font path element will be returned, and pnt will be - * updated to point to the start of the next element, or set to - * NULL if there are no more. - */ -static char * -xf86GetPathElem(char **pnt) -{ - char *p1; - - p1 = *pnt; - *pnt = index(*pnt, ','); - if (*pnt != NULL) { - **pnt = '\0'; - *pnt += 1; - } - return(p1); -} - -/* - * xf86ValidateFontPath -- - * Validates the user-specified font path. Each element that - * begins with a '/' is checked to make sure the directory exists. - * If the directory exists, the existence of a file named 'fonts.dir' - * is checked. If either check fails, an error is printed and the - * element is removed from the font path. - */ - -#define DIR_FILE "/fonts.dir" -static char * -xf86ValidateFontPath(char *path) -{ - char *tmp_path, *out_pnt, *path_elem, *next, *p1, *dir_elem; - struct stat stat_buf; - int flag; - int dirlen; - - tmp_path = xcalloc(1,strlen(path)+1); - out_pnt = tmp_path; - path_elem = NULL; - next = path; - while (next != NULL) { - path_elem = xf86GetPathElem(&next); - if (*path_elem == '/') { -#ifndef __UNIXOS2__ - dir_elem = xnfcalloc(1, strlen(path_elem) + 1); - if ((p1 = strchr(path_elem, ':')) != 0) -#else - /* OS/2 must prepend X11ROOT */ - path_elem = (char*)__XOS2RedirRoot(path_elem); - dir_elem = xnfcalloc(1, strlen(path_elem) + 1); - if (p1 = strchr(path_elem+2, ':')) -#endif - dirlen = p1 - path_elem; - else - dirlen = strlen(path_elem); - strncpy(dir_elem, path_elem, dirlen); - dir_elem[dirlen] = '\0'; - flag = stat(dir_elem, &stat_buf); - if (flag == 0) - if (!S_ISDIR(stat_buf.st_mode)) - flag = -1; - if (flag != 0) { - xf86Msg(X_WARNING, "The directory \"%s\" does not exist.\n", dir_elem); - xf86ErrorF("\tEntry deleted from font path.\n"); - xfree(dir_elem); - continue; - } - else { - p1 = xnfalloc(strlen(dir_elem)+strlen(DIR_FILE)+1); - strcpy(p1, dir_elem); - strcat(p1, DIR_FILE); - flag = stat(p1, &stat_buf); - if (flag == 0) - if (!S_ISREG(stat_buf.st_mode)) - flag = -1; -#ifndef __UNIXOS2__ - xfree(p1); -#endif - if (flag != 0) { - xf86Msg(X_WARNING, - "`fonts.dir' not found (or not valid) in \"%s\".\n", - dir_elem); - xf86ErrorF("\tEntry deleted from font path.\n"); - xf86ErrorF("\t(Run 'mkfontdir' on \"%s\").\n", dir_elem); - xfree(dir_elem); - continue; - } - } - xfree(dir_elem); - } - - /* - * Either an OK directory, or a font server name. So add it to - * the path. - */ - if (out_pnt != tmp_path) - *out_pnt++ = ','; - strcat(out_pnt, path_elem); - out_pnt += strlen(path_elem); - } - return(tmp_path); -} - - -/* - * use the datastructure that the parser provides and pick out the parts - * that we need at this point - */ -char ** -xf86ModulelistFromConfig(pointer **optlist) -{ - int count = 0; - char **modulearray; - pointer *optarray; - XF86LoadPtr modp; - - /* - * make sure the config file has been parsed and that we have a - * ModulePath set; if no ModulePath was given, use the default - * ModulePath - */ - if (xf86configptr == NULL) { - xf86Msg(X_ERROR, "Cannot access global config data structure\n"); - return NULL; - } - - if (xf86configptr->conf_modules) { - /* - * Walk the list of modules in the "Module" section to determine how - * many we have. - */ - modp = xf86configptr->conf_modules->mod_load_lst; - while (modp) { - count++; - modp = (XF86LoadPtr) modp->list.next; - } - } - if (count == 0) - return NULL; - - /* - * allocate the memory and walk the list again to fill in the pointers - */ - modulearray = xnfalloc((count + 1) * sizeof(char*)); - optarray = xnfalloc((count + 1) * sizeof(pointer)); - count = 0; - if (xf86configptr->conf_modules) { - modp = xf86configptr->conf_modules->mod_load_lst; - while (modp) { - modulearray[count] = modp->load_name; - optarray[count] = modp->load_opt; - count++; - modp = (XF86LoadPtr) modp->list.next; - } - } - modulearray[count] = NULL; - optarray[count] = NULL; - if (optlist) - *optlist = optarray; - else - xfree(optarray); - return modulearray; -} - - -char ** -xf86DriverlistFromConfig() -{ - int count = 0; - int j; - char **modulearray; - screenLayoutPtr slp; - - /* - * make sure the config file has been parsed and that we have a - * ModulePath set; if no ModulePath was given, use the default - * ModulePath - */ - if (xf86configptr == NULL) { - xf86Msg(X_ERROR, "Cannot access global config data structure\n"); - return NULL; - } - - /* - * Walk the list of driver lines in active "Device" sections to - * determine now many implicitly loaded modules there are. - * - */ - if (xf86ConfigLayout.screens) { - slp = xf86ConfigLayout.screens; - while ((slp++)->screen) { - count++; - } - } - - /* - * Handle the set of inactive "Device" sections. - */ - j = 0; - while (xf86ConfigLayout.inactives[j++].identifier) - count++; - - if (count == 0) - return NULL; - - /* - * allocate the memory and walk the list again to fill in the pointers - */ - modulearray = xnfalloc((count + 1) * sizeof(char*)); - count = 0; - slp = xf86ConfigLayout.screens; - while (slp->screen) { - modulearray[count] = slp->screen->device->driver; - count++; - slp++; - } - - j = 0; - - while (xf86ConfigLayout.inactives[j].identifier) - modulearray[count++] = xf86ConfigLayout.inactives[j++].driver; - - modulearray[count] = NULL; - - /* Remove duplicates */ - for (count = 0; modulearray[count] != NULL; count++) { - int i; - - for (i = 0; i < count; i++) - if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) { - modulearray[count] = ""; - break; - } - } - return modulearray; -} - - -Bool -xf86BuiltinInputDriver(const char *name) -{ -#ifdef USE_DEPRECATED_KEYBOARD_DRIVER - if (xf86NameCmp(name, "keyboard") == 0) - return TRUE; - else -#endif - return FALSE; -} - -char ** -xf86InputDriverlistFromConfig() -{ - int count = 0; - char **modulearray; - IDevPtr idp; - - /* - * make sure the config file has been parsed and that we have a - * ModulePath set; if no ModulePath was given, use the default - * ModulePath - */ - if (xf86configptr == NULL) { - xf86Msg(X_ERROR, "Cannot access global config data structure\n"); - return NULL; - } - - /* - * Walk the list of driver lines in active "InputDevice" sections to - * determine now many implicitly loaded modules there are. - */ - if (xf86ConfigLayout.inputs) { - idp = xf86ConfigLayout.inputs; - while (idp->identifier) { - if (!xf86BuiltinInputDriver(idp->driver)) - count++; - idp++; - } - } - - if (count == 0) - return NULL; - - /* - * allocate the memory and walk the list again to fill in the pointers - */ - modulearray = xnfalloc((count + 1) * sizeof(char*)); - count = 0; - idp = xf86ConfigLayout.inputs; - while (idp->identifier) { - if (!xf86BuiltinInputDriver(idp->driver)) { - modulearray[count] = idp->driver; - count++; - } - idp++; - } - modulearray[count] = NULL; - - /* Remove duplicates */ - for (count = 0; modulearray[count] != NULL; count++) { - int i; - - for (i = 0; i < count; i++) - if (xf86NameCmp(modulearray[i], modulearray[count]) == 0) { - modulearray[count] = ""; - break; - } - } - return modulearray; -} - -static void -fixup_video_driver_list(char **drivers) -{ - static const char *fallback[5] = { "vga", "vesa", "fbdev", "wsfb", NULL }; - char **end, **drv; - char *x; - char **ati, **atimisc; - int i; - - /* walk to the end of the list */ - for (end = drivers; *end && **end; end++) ; - end--; - - /* - * for each of the fallback drivers, if we find it in the list, - * swap it with the last available non-fallback driver. - */ - for (i = 0; fallback[i]; i++) { - for (drv = drivers; drv != end; drv++) { - if (strstr(*drv, fallback[i])) { - x = *drv; *drv = *end; *end = x; - end--; - break; - } - } - } - /* - * since the ati wrapper driver is gross and awful, sort ati before - * atimisc, which makes sure all the ati symbols are visible in xorgcfg. - */ - for (drv = drivers; drv != end; drv++) { - if (!strcmp(*drv, "atimisc")) { - atimisc = drv; - for (drv = atimisc; drv != end; drv++) { - if (!strcmp(*drv, "ati")) { - ati = drv; - x = *ati; *ati = *atimisc; *atimisc = x; - return; - } - } - /* if we get here, ati was already ahead of atimisc */ - return; - } - } -} - - -/* - * Generate a compiled-in list of driver names. This is used to produce a - * consistent probe order. For the loader server, we also look for vendor- - * provided modules, pre-pending them to our own list. - */ -static char ** -GenerateDriverlist(char * dirname, char * drivernames) -{ -#ifdef XFree86LOADER - char **ret; - char *subdirs[] = { dirname, NULL }; - static const char *patlist[] = {"(.*)_drv\\.so", "(.*)_drv\\.o", NULL}; - ret = LoaderListDirs(subdirs, patlist); - - /* fix up the probe order for video drivers */ - if (strstr(dirname, "drivers")) - fixup_video_driver_list(ret); - - return ret; -#else /* non-loadable server */ - char *cp, **driverlist; - int count; - - /* Count the number needed */ - count = 0; - cp = drivernames; - while (*cp) { - while (*cp && isspace(*cp)) cp++; - if (!*cp) break; - count++; - while (*cp && !isspace(*cp)) cp++; - } - - if (!count) - return NULL; - - /* Now allocate the array of pointers to 0-terminated driver names */ - driverlist = (char **)xnfalloc((count + 1) * sizeof(char *)); - count = 0; - cp = drivernames; - while (*cp) { - while (*cp && isspace(*cp)) cp++; - if (!*cp) break; - driverlist[count++] = cp; - while (*cp && !isspace(*cp)) cp++; - if (!*cp) break; - *cp++ = 0; - } - driverlist[count] = NULL; - - return driverlist; -#endif -} - - -char ** -xf86DriverlistFromCompile(void) -{ - static char **driverlist = NULL; - static Bool generated = FALSE; - - /* This string is modified in-place */ - static char drivernames[] = DRIVERS; - - if (!generated) { - generated = TRUE; - driverlist = GenerateDriverlist("drivers", drivernames); - } - - return driverlist; -} - - -char ** -xf86InputDriverlistFromCompile(void) -{ - static char **driverlist = NULL; - static Bool generated = FALSE; - - /* This string is modified in-place */ - static char drivernames[] = IDRIVERS; - - if (!generated) { - generated = TRUE; - driverlist = GenerateDriverlist("input", drivernames); - } - - return driverlist; -} - - -/* - * xf86ConfigError -- - * Print a READABLE ErrorMessage!!! All information that is - * available is printed. - */ -static void -xf86ConfigError(char *msg, ...) -{ - va_list ap; - - ErrorF("\nConfig Error:\n"); - va_start(ap, msg); - VErrorF(msg, ap); - va_end(ap); - ErrorF("\n"); - return; -} - -static Bool -configFiles(XF86ConfFilesPtr fileconf) -{ - MessageType pathFrom = X_DEFAULT; - - /* FontPath */ - - /* Try XF86Config FontPath first */ - if (!xf86fpFlag) { - if (fileconf) { - if (fileconf->file_fontpath) { - char *f = xf86ValidateFontPath(fileconf->file_fontpath); - pathFrom = X_CONFIG; - if (*f) - defaultFontPath = f; - else { - xf86Msg(X_WARNING, - "FontPath is completely invalid. Using compiled-in default.\n"); - fontPath = NULL; - pathFrom = X_DEFAULT; - } - } - } else { - xf86Msg(X_WARNING, - "No FontPath specified. Using compiled-in default.\n"); - pathFrom = X_DEFAULT; - } - } else { - /* Use fontpath specified with '-fp' */ - if (fontPath) - { - fontPath = NULL; - } - pathFrom = X_CMDLINE; - } - if (!fileconf) { - /* xf86ValidateFontPath will write into it's arg, but defaultFontPath - could be static, so we make a copy. */ - char *f = xnfalloc(strlen(defaultFontPath) + 1); - f[0] = '\0'; - strcpy (f, defaultFontPath); - defaultFontPath = xf86ValidateFontPath(f); - xfree(f); - } else { - if (fileconf) { - if (!fileconf->file_fontpath) { - /* xf86ValidateFontPath will write into it's arg, but defaultFontPath - could be static, so we make a copy. */ - char *f = xnfalloc(strlen(defaultFontPath) + 1); - f[0] = '\0'; - strcpy (f, defaultFontPath); - defaultFontPath = xf86ValidateFontPath(f); - xfree(f); - } - } - } - - /* If defaultFontPath is still empty, exit here */ - - if (! *defaultFontPath) - FatalError("No valid FontPath could be found."); - - xf86Msg(pathFrom, "FontPath set to \"%s\"\n", defaultFontPath); - - /* RgbPath */ - - pathFrom = X_DEFAULT; - - if (xf86coFlag) - pathFrom = X_CMDLINE; - else if (fileconf) { - if (fileconf->file_rgbpath) { - rgbPath = fileconf->file_rgbpath; - pathFrom = X_CONFIG; - } - } - - xf86Msg(pathFrom, "RgbPath set to \"%s\"\n", rgbPath); - - if (fileconf && fileconf->file_inputdevs) { - xf86InputDeviceList = fileconf->file_inputdevs; - xf86Msg(X_CONFIG, "Input device list set to \"%s\"\n", - xf86InputDeviceList); - } - - -#ifdef XFree86LOADER - /* ModulePath */ - - if (fileconf) { - if (xf86ModPathFrom != X_CMDLINE && fileconf->file_modulepath) { - xf86ModulePath = fileconf->file_modulepath; - xf86ModPathFrom = X_CONFIG; - } - } - - xf86Msg(xf86ModPathFrom, "ModulePath set to \"%s\"\n", xf86ModulePath); -#endif - -#if 0 - /* LogFile */ - /* - * XXX The problem with this is that the log file is already open. - * One option might be to copy the exiting contents to the new location. - * and re-open it. The down side is that the default location would - * already have been overwritten. Another option would be to start with - * unique temporary location, then copy it once the correct name is known. - * A problem with this is what happens if the server exits before that - * happens. - */ - if (xf86LogFileFrom == X_DEFAULT && fileconf->file_logfile) { - xf86LogFile = fileconf->file_logfile; - xf86LogFileFrom = X_CONFIG; - } -#endif - - return TRUE; -} - -typedef enum { - FLAG_NOTRAPSIGNALS, - FLAG_DONTVTSWITCH, - FLAG_DONTZAP, - FLAG_DONTZOOM, - FLAG_DISABLEVIDMODE, - FLAG_ALLOWNONLOCAL, - FLAG_DISABLEMODINDEV, - FLAG_MODINDEVALLOWNONLOCAL, - FLAG_ALLOWMOUSEOPENFAIL, - FLAG_VTINIT, - FLAG_VTSYSREQ, - FLAG_XKBDISABLE, - FLAG_PCIPROBE1, - FLAG_PCIPROBE2, - FLAG_PCIFORCECONFIG1, - FLAG_PCIFORCECONFIG2, - FLAG_PCIFORCENONE, - FLAG_PCIOSCONFIG, - FLAG_SAVER_BLANKTIME, - FLAG_DPMS_STANDBYTIME, - FLAG_DPMS_SUSPENDTIME, - FLAG_DPMS_OFFTIME, - FLAG_PIXMAP, - FLAG_PC98, - FLAG_ESTIMATE_SIZES_AGGRESSIVELY, - FLAG_NOPM, - FLAG_XINERAMA, - FLAG_ALLOW_DEACTIVATE_GRABS, - FLAG_ALLOW_CLOSEDOWN_GRABS, - FLAG_LOG, - FLAG_RENDER_COLORMAP_MODE, - FLAG_HANDLE_SPECIAL_KEYS, - FLAG_RANDR -} FlagValues; - -static OptionInfoRec FlagOptions[] = { - { FLAG_NOTRAPSIGNALS, "NoTrapSignals", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_DONTVTSWITCH, "DontVTSwitch", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_DONTZAP, "DontZap", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_DONTZOOM, "DontZoom", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_DISABLEVIDMODE, "DisableVidModeExtension", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_ALLOWNONLOCAL, "AllowNonLocalXvidtune", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_DISABLEMODINDEV, "DisableModInDev", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_MODINDEVALLOWNONLOCAL, "AllowNonLocalModInDev", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_ALLOWMOUSEOPENFAIL, "AllowMouseOpenFail", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_VTINIT, "VTInit", OPTV_STRING, - {0}, FALSE }, - { FLAG_VTSYSREQ, "VTSysReq", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_XKBDISABLE, "XkbDisable", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_PCIPROBE1, "PciProbe1" , OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_PCIPROBE2, "PciProbe2", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_PCIFORCECONFIG1, "PciForceConfig1", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_PCIFORCECONFIG2, "PciForceConfig2", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_PCIFORCENONE, "PciForceNone", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_PCIOSCONFIG, "PciOsConfig", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_SAVER_BLANKTIME, "BlankTime" , OPTV_INTEGER, - {0}, FALSE }, - { FLAG_DPMS_STANDBYTIME, "StandbyTime", OPTV_INTEGER, - {0}, FALSE }, - { FLAG_DPMS_SUSPENDTIME, "SuspendTime", OPTV_INTEGER, - {0}, FALSE }, - { FLAG_DPMS_OFFTIME, "OffTime", OPTV_INTEGER, - {0}, FALSE }, - { FLAG_PIXMAP, "Pixmap", OPTV_INTEGER, - {0}, FALSE }, - { FLAG_PC98, "PC98", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_ESTIMATE_SIZES_AGGRESSIVELY,"EstimateSizesAggressively",OPTV_INTEGER, - {0}, FALSE }, - { FLAG_NOPM, "NoPM", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_XINERAMA, "Xinerama", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_ALLOW_DEACTIVATE_GRABS,"AllowDeactivateGrabs", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_ALLOW_CLOSEDOWN_GRABS, "AllowClosedownGrabs", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_LOG, "Log", OPTV_STRING, - {0}, FALSE }, - { FLAG_RENDER_COLORMAP_MODE, "RenderColormapMode", OPTV_STRING, - {0}, FALSE }, - { FLAG_HANDLE_SPECIAL_KEYS, "HandleSpecialKeys", OPTV_STRING, - {0}, FALSE }, - { FLAG_RANDR, "RandR", OPTV_BOOLEAN, - {0}, FALSE }, - { -1, NULL, OPTV_NONE, - {0}, FALSE }, -}; - -#if defined(i386) || defined(__i386__) -static Bool -detectPC98(void) -{ -#ifdef SUPPORT_PC98 - unsigned char buf[2]; - - if (xf86ReadBIOS(0xf8000, 0xe80, buf, 2) != 2) - return FALSE; - if ((buf[0] == 0x98) && (buf[1] == 0x21)) - return TRUE; - else - return FALSE; -#else - return FALSE; -#endif -} -#endif /* __i386__ */ - -static Bool -configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) -{ - XF86OptionPtr optp, tmp; - int i; - Pix24Flags pix24 = Pix24DontCare; - Bool value; - MessageType from; - - /* - * Merge the ServerLayout and ServerFlags options. The former have - * precedence over the latter. - */ - optp = NULL; - if (flagsconf && flagsconf->flg_option_lst) - optp = xf86optionListDup(flagsconf->flg_option_lst); - if (layoutopts) { - tmp = xf86optionListDup(layoutopts); - if (optp) - optp = xf86optionListMerge(optp, tmp); - else - optp = tmp; - } - - xf86ProcessOptions(-1, optp, FlagOptions); - - xf86GetOptValBool(FlagOptions, FLAG_NOTRAPSIGNALS, &xf86Info.notrapSignals); - xf86GetOptValBool(FlagOptions, FLAG_DONTVTSWITCH, &xf86Info.dontVTSwitch); - xf86GetOptValBool(FlagOptions, FLAG_DONTZAP, &xf86Info.dontZap); - xf86GetOptValBool(FlagOptions, FLAG_DONTZOOM, &xf86Info.dontZoom); - - xf86GetOptValBool(FlagOptions, FLAG_ALLOW_DEACTIVATE_GRABS, - &(xf86Info.grabInfo.allowDeactivate)); - xf86GetOptValBool(FlagOptions, FLAG_ALLOW_CLOSEDOWN_GRABS, - &(xf86Info.grabInfo.allowClosedown)); - - /* - * Set things up based on the config file information. Some of these - * settings may be overridden later when the command line options are - * checked. - */ -#ifdef XF86VIDMODE - if (xf86GetOptValBool(FlagOptions, FLAG_DISABLEVIDMODE, &value)) - xf86Info.vidModeEnabled = !value; - if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWNONLOCAL, &value)) - xf86Info.vidModeAllowNonLocal = value; -#endif - -#ifdef XF86MISC - if (xf86GetOptValBool(FlagOptions, FLAG_DISABLEMODINDEV, &value)) - xf86Info.miscModInDevEnabled = !value; - if (xf86GetOptValBool(FlagOptions, FLAG_MODINDEVALLOWNONLOCAL, &value)) - xf86Info.miscModInDevAllowNonLocal = value; -#endif - - if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWMOUSEOPENFAIL, &value)) - xf86Info.allowMouseOpenFail = value; - - if (xf86GetOptValBool(FlagOptions, FLAG_VTSYSREQ, &value)) { -#ifdef USE_VT_SYSREQ - xf86Info.vtSysreq = value; - xf86Msg(X_CONFIG, "VTSysReq %s\n", value ? "enabled" : "disabled"); -#else - if (value) - xf86Msg(X_WARNING, "VTSysReq is not supported on this OS\n"); -#endif - } - - if (xf86GetOptValBool(FlagOptions, FLAG_XKBDISABLE, &value)) { -#ifdef XKB - noXkbExtension = value; - xf86Msg(X_CONFIG, "Xkb %s\n", value ? "disabled" : "enabled"); -#else - if (!value) - xf86Msg(X_WARNING, "Xserver doesn't support XKB\n"); -#endif - } - - xf86Info.vtinit = xf86GetOptValString(FlagOptions, FLAG_VTINIT); - - if (xf86IsOptionSet(FlagOptions, FLAG_PCIPROBE1)) - xf86Info.pciFlags = PCIProbe1; - if (xf86IsOptionSet(FlagOptions, FLAG_PCIPROBE2)) - xf86Info.pciFlags = PCIProbe2; - if (xf86IsOptionSet(FlagOptions, FLAG_PCIFORCECONFIG1)) - xf86Info.pciFlags = PCIForceConfig1; - if (xf86IsOptionSet(FlagOptions, FLAG_PCIFORCECONFIG2)) - xf86Info.pciFlags = PCIForceConfig2; - if (xf86IsOptionSet(FlagOptions, FLAG_PCIOSCONFIG)) - xf86Info.pciFlags = PCIOsConfig; - if (xf86IsOptionSet(FlagOptions, FLAG_PCIFORCENONE)) - xf86Info.pciFlags = PCIForceNone; - - xf86Info.pmFlag = TRUE; - if (xf86GetOptValBool(FlagOptions, FLAG_NOPM, &value)) - xf86Info.pmFlag = !value; - { - const char *s; - if ((s = xf86GetOptValString(FlagOptions, FLAG_LOG))) { - if (!xf86NameCmp(s,"flush")) { - xf86Msg(X_CONFIG, "Flushing logfile enabled\n"); - xf86Info.log = LogFlush; - LogSetParameter(XLOG_FLUSH, TRUE); - } else if (!xf86NameCmp(s,"sync")) { - xf86Msg(X_CONFIG, "Syncing logfile enabled\n"); - xf86Info.log = LogSync; - LogSetParameter(XLOG_SYNC, TRUE); - } else { - xf86Msg(X_WARNING,"Unknown Log option\n"); - } - } - } - -#ifdef RENDER - { - const char *s; - - if ((s = xf86GetOptValString(FlagOptions, FLAG_RENDER_COLORMAP_MODE))){ - int policy = PictureParseCmapPolicy (s); - if (policy == PictureCmapPolicyInvalid) - xf86Msg(X_WARNING, "Unknown colormap policy \"%s\"\n", s); - else - { - xf86Msg(X_CONFIG, "Render colormap policy set to %s\n", s); - PictureCmapPolicy = policy; - } - } - } -#endif - { - const char *s; - if ((s = xf86GetOptValString(FlagOptions, FLAG_HANDLE_SPECIAL_KEYS))) { - if (!xf86NameCmp(s,"always")) { - xf86Msg(X_CONFIG, "Always handling special keys in DDX\n"); - xf86Info.ddxSpecialKeys = SKAlways; - } else if (!xf86NameCmp(s,"whenneeded")) { - xf86Msg(X_CONFIG, "Special keys handled in DDX only if needed\n"); - xf86Info.ddxSpecialKeys = SKWhenNeeded; - } else if (!xf86NameCmp(s,"never")) { - xf86Msg(X_CONFIG, "Never handling special keys in DDX\n"); - xf86Info.ddxSpecialKeys = SKNever; - } else { - xf86Msg(X_WARNING,"Unknown HandleSpecialKeys option\n"); - } - } - } -#ifdef RANDR - xf86Info.disableRandR = FALSE; - xf86Info.randRFrom = X_DEFAULT; - if (xf86GetOptValBool(FlagOptions, FLAG_RANDR, &value)) { - xf86Info.disableRandR = !value; - xf86Info.randRFrom = X_CONFIG; - } -#endif - i = -1; - xf86GetOptValInteger(FlagOptions, FLAG_ESTIMATE_SIZES_AGGRESSIVELY, &i); - if (i >= 0) - xf86Info.estimateSizesAggressively = i; - else - xf86Info.estimateSizesAggressively = 0; - -/* Make sure that timers don't overflow CARD32's after multiplying */ -#define MAX_TIME_IN_MIN (0x7fffffff / MILLI_PER_MIN) - - i = -1; - xf86GetOptValInteger(FlagOptions, FLAG_SAVER_BLANKTIME, &i); - if ((i >= 0) && (i < MAX_TIME_IN_MIN)) - ScreenSaverTime = defaultScreenSaverTime = i * MILLI_PER_MIN; - else if (i != -1) - xf86ConfigError("BlankTime value %d outside legal range of 0 - %d minutes", - i, MAX_TIME_IN_MIN); - -#ifdef DPMSExtension - i = -1; - xf86GetOptValInteger(FlagOptions, FLAG_DPMS_STANDBYTIME, &i); - if ((i >= 0) && (i < MAX_TIME_IN_MIN)) - DPMSStandbyTime = defaultDPMSStandbyTime = i * MILLI_PER_MIN; - else if (i != -1) - xf86ConfigError("StandbyTime value %d outside legal range of 0 - %d minutes", - i, MAX_TIME_IN_MIN); - i = -1; - xf86GetOptValInteger(FlagOptions, FLAG_DPMS_SUSPENDTIME, &i); - if ((i >= 0) && (i < MAX_TIME_IN_MIN)) - DPMSSuspendTime = defaultDPMSSuspendTime = i * MILLI_PER_MIN; - else if (i != -1) - xf86ConfigError("SuspendTime value %d outside legal range of 0 - %d minutes", - i, MAX_TIME_IN_MIN); - i = -1; - xf86GetOptValInteger(FlagOptions, FLAG_DPMS_OFFTIME, &i); - if ((i >= 0) && (i < MAX_TIME_IN_MIN)) - DPMSOffTime = defaultDPMSOffTime = i * MILLI_PER_MIN; - else if (i != -1) - xf86ConfigError("OffTime value %d outside legal range of 0 - %d minutes", - i, MAX_TIME_IN_MIN); -#endif - - i = -1; - xf86GetOptValInteger(FlagOptions, FLAG_PIXMAP, &i); - switch (i) { - case 24: - pix24 = Pix24Use24; - break; - case 32: - pix24 = Pix24Use32; - break; - case -1: - break; - default: - xf86ConfigError("Pixmap option's value (%d) must be 24 or 32\n", i); - return FALSE; - } - if (xf86Pix24 != Pix24DontCare) { - xf86Info.pixmap24 = xf86Pix24; - xf86Info.pix24From = X_CMDLINE; - } else if (pix24 != Pix24DontCare) { - xf86Info.pixmap24 = pix24; - xf86Info.pix24From = X_CONFIG; - } else { - xf86Info.pixmap24 = Pix24DontCare; - xf86Info.pix24From = X_DEFAULT; - } -#if defined(i386) || defined(__i386__) - if (xf86GetOptValBool(FlagOptions, FLAG_PC98, &value)) { - xf86Info.pc98 = value; - if (value) { - xf86Msg(X_CONFIG, "Japanese PC98 architecture\n"); - } - } else - if (detectPC98()) { - xf86Info.pc98 = TRUE; - xf86Msg(X_PROBED, "Japanese PC98 architecture\n"); - } -#endif - -#ifdef PANORAMIX - from = X_DEFAULT; - if (!noPanoramiXExtension) - from = X_CMDLINE; - else if (xf86GetOptValBool(FlagOptions, FLAG_XINERAMA, &value)) { - noPanoramiXExtension = !value; - from = X_CONFIG; - } - if (!noPanoramiXExtension) - xf86Msg(from, "Xinerama: enabled\n"); -#endif - - return TRUE; -} - -/* - * XXX This function is temporary, and will be removed when the keyboard - * driver is converted into a regular input driver. - */ -static Bool -configInputKbd(IDevPtr inputp) -{ - char *s; - MessageType from = X_DEFAULT; - Bool customKeycodesDefault = FALSE; - int verb = 0; -#if defined(XQUEUE) - char *kbdproto = "Xqueue"; -#else - char *kbdproto = "standard"; -#endif - - /* Initialize defaults */ - xf86Info.xleds = 0L; - xf86Info.kbdDelay = 500; - xf86Info.kbdRate = 30; - - xf86Info.kbdProc = NULL; - xf86Info.vtinit = NULL; - xf86Info.vtSysreq = VT_SYSREQ_DEFAULT; -#if defined(SVR4) && defined(i386) - xf86Info.panix106 = FALSE; -#endif - xf86Info.kbdCustomKeycodes = FALSE; -#ifdef WSCONS_SUPPORT - xf86Info.kbdFd = -1; -#endif -#ifdef XKB - if (!xf86IsPc98()) { - xf86Info.xkbrules = __XKBDEFRULES__; - xf86Info.xkbmodel = "pc105"; - xf86Info.xkblayout = "us"; - xf86Info.xkbvariant = NULL; - xf86Info.xkboptions = NULL; - } else { - xf86Info.xkbrules = "xfree98"; - xf86Info.xkbmodel = "pc98"; - xf86Info.xkblayout = "nec/jp"; - xf86Info.xkbvariant = NULL; - xf86Info.xkboptions = NULL; - } - xf86Info.xkbcomponents_specified = FALSE; - /* Should discourage the use of these. */ - xf86Info.xkbkeymap = NULL; - xf86Info.xkbtypes = NULL; - xf86Info.xkbcompat = NULL; - xf86Info.xkbkeycodes = NULL; - xf86Info.xkbsymbols = NULL; - xf86Info.xkbgeometry = NULL; -#endif - - s = xf86SetStrOption(inputp->commonOptions, "Protocol", kbdproto); - if (xf86NameCmp(s, "standard") == 0) { - xf86Info.kbdProc = xf86KbdProc; - xf86Info.kbdEvents = xf86KbdEvents; - xfree(s); - } else if (xf86NameCmp(s, "xqueue") == 0) { -#ifdef __UNIXWARE__ - /* - * To retain compatibility with older config files, on UnixWare, we - * accept the xqueue protocol but use the normal keyboard procs. - */ - xf86Info.kbdProc = xf86KbdProc; - xf86Info.kbdEvents = xf86KbdEvents; -#else -#ifdef XQUEUE - xf86Info.kbdProc = xf86XqueKbdProc; - xf86Info.kbdEvents = xf86XqueEvents; - xf86Msg(X_CONFIG, "Xqueue selected for keyboard input\n"); -#endif -#endif - xfree(s); -#ifdef WSCONS_SUPPORT - } else if (xf86NameCmp(s, "wskbd") == 0) { - xf86Info.kbdProc = xf86KbdProc; - xf86Info.kbdEvents = xf86WSKbdEvents; - xfree(s); - s = xf86SetStrOption(inputp->commonOptions, "Device", NULL); - xf86Msg(X_CONFIG, "Keyboard: Protocol: wskbd\n"); - if (s == NULL) { - xf86ConfigError("A \"device\" option is required with" - " the \"wskbd\" keyboard protocol"); - return FALSE; - } - xf86Info.kbdFd = open(s, O_RDWR | O_NONBLOCK | O_EXCL); - if (xf86Info.kbdFd == -1) { - xf86ConfigError("cannot open \"%s\"", s); - xfree(s); - return FALSE; - } - xfree(s); - /* Find out keyboard type */ - if (ioctl(xf86Info.kbdFd, WSKBDIO_GTYPE, &xf86Info.wsKbdType) == -1) { - xf86ConfigError("cannot get keyboard type"); - close(xf86Info.kbdFd); - return FALSE; - } - switch (xf86Info.wsKbdType) { - case WSKBD_TYPE_PC_XT: - xf86Msg(X_PROBED, "Keyboard type: XT\n"); - break; - case WSKBD_TYPE_PC_AT: - xf86Msg(X_PROBED, "Keyboard type: AT\n"); - break; - case WSKBD_TYPE_USB: - xf86Msg(X_PROBED, "Keyboard type: USB\n"); - break; -#ifdef WSKBD_TYPE_ADB - case WSKBD_TYPE_ADB: - xf86Msg(X_PROBED, "Keyboard type: ADB\n"); - break; -#endif -#ifdef WSKBD_TYPE_SUN - case WSKBD_TYPE_SUN: - xf86Msg(X_PROBED, "Keyboard type: Sun\n"); - break; -#endif -#ifdef WSKBD_TYPE_SUN5 - case WSKBD_TYPE_SUN5: - xf86Msg(X_PROBED, "Keyboard type: Sun5\n"); - break; -#endif - default: - xf86ConfigError("Unsupported wskbd type \"%d\"", - xf86Info.wsKbdType); - close(xf86Info.kbdFd); - return FALSE; - } -#endif - } else { - xf86ConfigError("\"%s\" is not a valid keyboard protocol name", s); - xfree(s); - return FALSE; - } - - s = xf86SetStrOption(inputp->commonOptions, "AutoRepeat", NULL); - if (s) { - if (sscanf(s, "%d %d", &xf86Info.kbdDelay, &xf86Info.kbdRate) != 2) { - xf86ConfigError("\"%s\" is not a valid AutoRepeat value", s); - xfree(s); - return FALSE; - } - xfree(s); - } - - s = xf86SetStrOption(inputp->commonOptions, "XLeds", NULL); - if (s) { - char *l, *end; - unsigned int i; - l = strtok(s, " \t\n"); - while (l) { - i = strtoul(l, &end, 0); - if (*end == '\0') - xf86Info.xleds |= 1L << (i - 1); - else { - xf86ConfigError("\"%s\" is not a valid XLeds value", l); - xfree(s); - return FALSE; - } - l = strtok(NULL, " \t\n"); - } - xfree(s); - } - -#ifdef XKB - from = X_DEFAULT; - if (noXkbExtension) - from = X_CMDLINE; - else if (xf86FindOption(inputp->commonOptions, "XkbDisable")) { - xf86Msg(X_WARNING, "KEYBOARD: XKB should be disabled in the " - "ServerFlags section instead\n" - "\tof in the \"keyboard\" InputDevice section.\n"); - noXkbExtension = - xf86SetBoolOption(inputp->commonOptions, "XkbDisable", FALSE); - from = X_CONFIG; - } - if (noXkbExtension) - xf86Msg(from, "XKB: disabled\n"); - -#define NULL_IF_EMPTY(s) (s[0] ? s : (xfree(s), (char *)NULL)) - - if (!noXkbExtension && !XkbInitialMap) { - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbKeymap", NULL))) { - xf86Info.xkbkeymap = NULL_IF_EMPTY(s); - xf86Msg(X_CONFIG, "XKB: keymap: \"%s\" " - "(overrides other XKB settings)\n", xf86Info.xkbkeymap); - } else { - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbCompat", NULL))) { - xf86Info.xkbcompat = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: compat: \"%s\"\n", s); - } - - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbTypes", NULL))) { - xf86Info.xkbtypes = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: types: \"%s\"\n", s); - } - - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbKeycodes", NULL))) { - xf86Info.xkbkeycodes = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: keycodes: \"%s\"\n", s); - } - - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbGeometry", NULL))) { - xf86Info.xkbgeometry = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: geometry: \"%s\"\n", s); - } - - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbSymbols", NULL))) { - xf86Info.xkbsymbols = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: symbols: \"%s\"\n", s); - } - - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbRules", NULL))) { - xf86Info.xkbrules = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: rules: \"%s\"\n", s); - } - - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbModel", NULL))) { - xf86Info.xkbmodel = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: model: \"%s\"\n", s); - } - - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbLayout", NULL))) { - xf86Info.xkblayout = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: layout: \"%s\"\n", s); - } - - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbVariant", NULL))) { - xf86Info.xkbvariant = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: variant: \"%s\"\n", s); - } - - if ((s = xf86SetStrOption(inputp->commonOptions, "XkbOptions", NULL))) { - xf86Info.xkboptions = NULL_IF_EMPTY(s); - xf86Info.xkbcomponents_specified = TRUE; - xf86Msg(X_CONFIG, "XKB: options: \"%s\"\n", s); - } - } - } -#undef NULL_IF_EMPTY -#endif -#if defined(SVR4) && defined(i386) - if ((xf86Info.panix106 = - xf86SetBoolOption(inputp->commonOptions, "Panix106", FALSE))) { - xf86Msg(X_CONFIG, "PANIX106: enabled\n"); - } -#endif - - /* - * This was once a compile time option (ASSUME_CUSTOM_KEYCODES) - * defaulting to 1 on Linux/PPC. It is no longer necessary, but for - * backwards compatibility we provide 'Option "CustomKeycodes"' - * and try to autoprobe on Linux/PPC. - */ - from = X_DEFAULT; - verb = 2; -#if defined(__linux__) && defined(__powerpc__) - { - FILE *f; - - f = fopen("/proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes","r"); - if (f) { - if (fgetc(f) == '0') { - customKeycodesDefault = TRUE; - from = X_PROBED; - verb = 1; - } - fclose(f); - } - } -#endif - if (xf86FindOption(inputp->commonOptions, "CustomKeycodes")) { - from = X_CONFIG; - verb = 1; - } - xf86Info.kbdCustomKeycodes = - xf86SetBoolOption(inputp->commonOptions, "CustomKeycodes", - customKeycodesDefault); - xf86MsgVerb(from, verb, "Keyboard: CustomKeycode %s\n", - xf86Info.kbdCustomKeycodes ? "enabled" : "disabled"); - - return TRUE; -} - -/* - * Locate the core input devices. These can be specified/located in - * the following ways, in order of priority: - * - * 1. The InputDevices named by the -pointer and -keyboard command line - * options. - * 2. The "CorePointer" and "CoreKeyboard" InputDevices referred to by - * the active ServerLayout. - * 3. The first InputDevices marked as "CorePointer" and "CoreKeyboard". - * 4. The first InputDevices that use the 'mouse' and 'keyboard' or 'kbd' - * drivers. - * 5. Default devices with an empty (default) configuration. These defaults - * will reference the 'mouse' and 'keyboard' drivers. - */ - -static Bool -checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout) -{ - IDevPtr corePointer = NULL, coreKeyboard = NULL; - Bool foundPointer = FALSE, foundKeyboard = FALSE; - const char *pointerMsg = NULL, *keyboardMsg = NULL; - IDevPtr indp; - IDevRec Pointer, Keyboard; - XF86ConfInputPtr confInput; - XF86ConfInputRec defPtr, defKbd; - int count = 0; - MessageType from = X_DEFAULT; - - /* - * First check if a core pointer or core keyboard have been specified - * in the active ServerLayout. If more than one is specified for either, - * remove the core attribute from the later ones. - */ - for (indp = servlayoutp->inputs; indp->identifier; indp++) { - pointer opt1 = NULL, opt2 = NULL; - if (indp->commonOptions && - xf86CheckBoolOption(indp->commonOptions, "CorePointer", FALSE)) { - opt1 = indp->commonOptions; - } - if (indp->extraOptions && - xf86CheckBoolOption(indp->extraOptions, "CorePointer", FALSE)) { - opt2 = indp->extraOptions; - } - if (opt1 || opt2) { - if (!corePointer) { - corePointer = indp; - } else { - if (opt1) - xf86ReplaceBoolOption(opt1, "CorePointer", FALSE); - if (opt2) - xf86ReplaceBoolOption(opt2, "CorePointer", FALSE); - xf86Msg(X_WARNING, "Duplicate core pointer devices. " - "Removing core pointer attribute from \"%s\"\n", - indp->identifier); - } - } - opt1 = opt2 = NULL; - if (indp->commonOptions && - xf86CheckBoolOption(indp->commonOptions, "CoreKeyboard", FALSE)) { - opt1 = indp->commonOptions; - } - if (indp->extraOptions && - xf86CheckBoolOption(indp->extraOptions, "CoreKeyboard", FALSE)) { - opt2 = indp->extraOptions; - } - if (opt1 || opt2) { - if (!coreKeyboard) { - coreKeyboard = indp; - } else { - if (opt1) - xf86ReplaceBoolOption(opt1, "CoreKeyboard", FALSE); - if (opt2) - xf86ReplaceBoolOption(opt2, "CoreKeyboard", FALSE); - xf86Msg(X_WARNING, "Duplicate core keyboard devices. " - "Removing core keyboard attribute from \"%s\"\n", - indp->identifier); - } - } - count++; - } - - confInput = NULL; - - /* 1. Check for the -pointer command line option. */ - if (xf86PointerName) { - confInput = xf86findInput(xf86PointerName, - xf86configptr->conf_input_lst); - if (!confInput) { - xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n", - xf86PointerName); - return FALSE; - } - from = X_CMDLINE; - /* - * If one was already specified in the ServerLayout, it needs to be - * removed. - */ - if (corePointer) { - for (indp = servlayoutp->inputs; indp->identifier; indp++) - if (indp == corePointer) - break; - for (; indp->identifier; indp++) - indp[0] = indp[1]; - count--; - } - corePointer = NULL; - foundPointer = TRUE; - } - - /* 2. ServerLayout-specified core pointer. */ - if (corePointer) { - foundPointer = TRUE; - from = X_CONFIG; - } - - /* 3. First core pointer device. */ - if (!foundPointer) { - XF86ConfInputPtr p; - - for (p = xf86configptr->conf_input_lst; p; p = p->list.next) { - if (p->inp_option_lst && - xf86CheckBoolOption(p->inp_option_lst, "CorePointer", FALSE)) { - confInput = p; - foundPointer = TRUE; - from = X_DEFAULT; - pointerMsg = "first core pointer device"; - break; - } - } - } - - /* 4. First pointer with 'mouse' as the driver. */ - if (!foundPointer) { - confInput = xf86findInput(CONF_IMPLICIT_POINTER, - xf86configptr->conf_input_lst); - if (!confInput) { - confInput = xf86findInputByDriver("mouse", - xf86configptr->conf_input_lst); - } - if (confInput) { - foundPointer = TRUE; - from = X_DEFAULT; - pointerMsg = "first mouse device"; - } - } - - /* 5. Built-in default. */ - if (!foundPointer) { - bzero(&defPtr, sizeof(defPtr)); - defPtr.inp_identifier = ""; - defPtr.inp_driver = "mouse"; - confInput = &defPtr; - foundPointer = TRUE; - from = X_DEFAULT; - pointerMsg = "default mouse configuration"; - } - - /* Add the core pointer device to the layout, and set it to Core. */ - if (foundPointer && confInput) { - foundPointer = configInput(&Pointer, confInput, from); - if (foundPointer) { - count++; - indp = xnfrealloc(servlayoutp->inputs, - (count + 1) * sizeof(IDevRec)); - indp[count - 1] = Pointer; - indp[count - 1].extraOptions = - xf86addNewOption(NULL, "CorePointer", NULL); - indp[count].identifier = NULL; - servlayoutp->inputs = indp; - } - } - - if (!foundPointer) { - /* This shouldn't happen. */ - xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n"); - return FALSE; - } - - confInput = NULL; - - /* 1. Check for the -keyboard command line option. */ - if (xf86KeyboardName) { - confInput = xf86findInput(xf86KeyboardName, - xf86configptr->conf_input_lst); - if (!confInput) { - xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n", - xf86KeyboardName); - return FALSE; - } - from = X_CMDLINE; - /* - * If one was already specified in the ServerLayout, it needs to be - * removed. - */ - if (coreKeyboard) { - for (indp = servlayoutp->inputs; indp->identifier; indp++) - if (indp == coreKeyboard) - break; - for (; indp->identifier; indp++) - indp[0] = indp[1]; - count--; - } - coreKeyboard = NULL; - foundKeyboard = TRUE; - } - - /* 2. ServerLayout-specified core keyboard. */ - if (coreKeyboard) { - foundKeyboard = TRUE; - from = X_CONFIG; - } - - /* 3. First core keyboard device. */ - if (!foundKeyboard) { - XF86ConfInputPtr p; - - for (p = xf86configptr->conf_input_lst; p; p = p->list.next) { - if (p->inp_option_lst && - xf86CheckBoolOption(p->inp_option_lst, "CoreKeyboard", FALSE)) { - confInput = p; - foundKeyboard = TRUE; - from = X_DEFAULT; - keyboardMsg = "first core keyboard device"; - break; - } - } - } - - /* 4. First keyboard with 'keyboard' or 'kbd' as the driver. */ - if (!foundKeyboard) { - confInput = xf86findInput(CONF_IMPLICIT_KEYBOARD, - xf86configptr->conf_input_lst); - if (!confInput) { - confInput = xf86findInputByDriver("kbd", - xf86configptr->conf_input_lst); - } - if (!confInput) { - confInput = xf86findInputByDriver("keyboard", - xf86configptr->conf_input_lst); - } - if (confInput) { - foundKeyboard = TRUE; - from = X_DEFAULT; - keyboardMsg = "first keyboard device"; - } - } - - /* 5. Built-in default. */ - if (!foundKeyboard) { - bzero(&defKbd, sizeof(defKbd)); - defKbd.inp_identifier = ""; - defKbd.inp_driver = "kbd"; - confInput = &defKbd; - foundKeyboard = TRUE; - keyboardMsg = "default keyboard configuration"; - from = X_DEFAULT; - } - - /* Add the core keyboard device to the layout, and set it to Core. */ - if (foundKeyboard && confInput) { - foundKeyboard = configInput(&Keyboard, confInput, from); - if (foundKeyboard) { - count++; - indp = xnfrealloc(servlayoutp->inputs, - (count + 1) * sizeof(IDevRec)); - indp[count - 1] = Keyboard; - indp[count - 1].extraOptions = - xf86addNewOption(NULL, "CoreKeyboard", NULL); - indp[count].identifier = NULL; - servlayoutp->inputs = indp; - } - } - - if (!foundKeyboard) { - /* This shouldn't happen. */ - xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n"); - return FALSE; - } - - if (pointerMsg) { - xf86Msg(X_WARNING, "The core pointer device wasn't specified " - "explicitly in the layout.\n" - "\tUsing the %s.\n", pointerMsg); - } - - if (keyboardMsg) { - xf86Msg(X_WARNING, "The core keyboard device wasn't specified " - "explicitly in the layout.\n" - "\tUsing the %s.\n", keyboardMsg); - } - - return TRUE; -} - -typedef enum { - LAYOUT_ISOLATEDEVICE, - LAYOUT_SINGLECARD -} LayoutValues; - -static OptionInfoRec LayoutOptions[] = { - { LAYOUT_ISOLATEDEVICE, "IsolateDevice", OPTV_STRING, - {0}, FALSE }, - { LAYOUT_SINGLECARD, "SingleCard", OPTV_BOOLEAN, - {0}, FALSE }, - { -1, NULL, OPTV_NONE, - {0}, FALSE }, -}; - -/* - * figure out which layout is active, which screens are used in that layout, - * which drivers and monitors are used in these screens - */ -static Bool -configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, - char *default_layout) -{ - XF86ConfAdjacencyPtr adjp; - XF86ConfInactivePtr idp; - XF86ConfInputrefPtr irp; - int count = 0; - int scrnum; - XF86ConfLayoutPtr l; - MessageType from; - screenLayoutPtr slp; - GDevPtr gdp; - IDevPtr indp; - int i = 0, j; - - if (!servlayoutp) - return FALSE; - - /* - * which layout section is the active one? - * - * If there is a -layout command line option, use that one, otherwise - * pick the first one. - */ - from = X_DEFAULT; - if (xf86LayoutName != NULL) - from = X_CMDLINE; - else if (default_layout) { - xf86LayoutName = default_layout; - from = X_CONFIG; - } - if (xf86LayoutName != NULL) { - if ((l = xf86findLayout(xf86LayoutName, conf_layout)) == NULL) { - xf86Msg(X_ERROR, "No ServerLayout section called \"%s\"\n", - xf86LayoutName); - return FALSE; - } - conf_layout = l; - } - xf86Msg(from, "ServerLayout \"%s\"\n", conf_layout->lay_identifier); - adjp = conf_layout->lay_adjacency_lst; - - /* - * we know that each screen is referenced exactly once on the left side - * of a layout statement in the Layout section. So to allocate the right - * size for the array we do a quick walk of the list to figure out how - * many sections we have - */ - while (adjp) { - count++; - adjp = (XF86ConfAdjacencyPtr)adjp->list.next; - } -#ifdef DEBUG - ErrorF("Found %d screens in the layout section %s", - count, conf_layout->lay_identifier); -#endif - slp = xnfcalloc(1, (count + 1) * sizeof(screenLayoutRec)); - slp[count].screen = NULL; - /* - * now that we have storage, loop over the list again and fill in our - * data structure; at this point we do not fill in the adjacency - * information as it is not clear if we need it at all - */ - adjp = conf_layout->lay_adjacency_lst; - count = 0; - while (adjp) { - slp[count].screen = xnfcalloc(1, sizeof(confScreenRec)); - if (adjp->adj_scrnum < 0) - scrnum = count; - else - scrnum = adjp->adj_scrnum; - if (!configScreen(slp[count].screen, adjp->adj_screen, scrnum, - X_CONFIG)) - return FALSE; - slp[count].x = adjp->adj_x; - slp[count].y = adjp->adj_y; - slp[count].refname = adjp->adj_refscreen; - switch (adjp->adj_where) { - case CONF_ADJ_OBSOLETE: - slp[count].where = PosObsolete; - slp[count].topname = adjp->adj_top_str; - slp[count].bottomname = adjp->adj_bottom_str; - slp[count].leftname = adjp->adj_left_str; - slp[count].rightname = adjp->adj_right_str; - break; - case CONF_ADJ_ABSOLUTE: - slp[count].where = PosAbsolute; - break; - case CONF_ADJ_RIGHTOF: - slp[count].where = PosRightOf; - break; - case CONF_ADJ_LEFTOF: - slp[count].where = PosLeftOf; - break; - case CONF_ADJ_ABOVE: - slp[count].where = PosAbove; - break; - case CONF_ADJ_BELOW: - slp[count].where = PosBelow; - break; - case CONF_ADJ_RELATIVE: - slp[count].where = PosRelative; - break; - } - count++; - adjp = (XF86ConfAdjacencyPtr)adjp->list.next; - } - - /* XXX Need to tie down the upper left screen. */ - - /* Fill in the refscreen and top/bottom/left/right values */ - for (i = 0; i < count; i++) { - for (j = 0; j < count; j++) { - if (slp[i].refname && - strcmp(slp[i].refname, slp[j].screen->id) == 0) { - slp[i].refscreen = slp[j].screen; - } - if (slp[i].topname && - strcmp(slp[i].topname, slp[j].screen->id) == 0) { - slp[i].top = slp[j].screen; - } - if (slp[i].bottomname && - strcmp(slp[i].bottomname, slp[j].screen->id) == 0) { - slp[i].bottom = slp[j].screen; - } - if (slp[i].leftname && - strcmp(slp[i].leftname, slp[j].screen->id) == 0) { - slp[i].left = slp[j].screen; - } - if (slp[i].rightname && - strcmp(slp[i].rightname, slp[j].screen->id) == 0) { - slp[i].right = slp[j].screen; - } - } - if (slp[i].where != PosObsolete - && slp[i].where != PosAbsolute - && !slp[i].refscreen) { - xf86Msg(X_ERROR,"Screen %s doesn't exist: deleting placement\n", - slp[i].refname); - slp[i].where = PosAbsolute; - slp[i].x = 0; - slp[i].y = 0; - } - } - -#ifdef LAYOUT_DEBUG - ErrorF("Layout \"%s\"\n", conf_layout->lay_identifier); - for (i = 0; i < count; i++) { - ErrorF("Screen: \"%s\" (%d):\n", slp[i].screen->id, - slp[i].screen->screennum); - switch (slp[i].where) { - case PosObsolete: - ErrorF("\tObsolete format: \"%s\" \"%s\" \"%s\" \"%s\"\n", - slp[i].top, slp[i].bottom, slp[i].left, slp[i].right); - break; - case PosAbsolute: - if (slp[i].x == -1) - if (slp[i].screen->screennum == 0) - ErrorF("\tImplicitly left-most\n"); - else - ErrorF("\tImplicitly right of screen %d\n", - slp[i].screen->screennum - 1); - else - ErrorF("\t%d %d\n", slp[i].x, slp[i].y); - break; - case PosRightOf: - ErrorF("\tRight of \"%s\"\n", slp[i].refscreen->id); - break; - case PosLeftOf: - ErrorF("\tLeft of \"%s\"\n", slp[i].refscreen->id); - break; - case PosAbove: - ErrorF("\tAbove \"%s\"\n", slp[i].refscreen->id); - break; - case PosBelow: - ErrorF("\tBelow \"%s\"\n", slp[i].refscreen->id); - break; - case PosRelative: - ErrorF("\t%d %d relative to \"%s\"\n", slp[i].x, slp[i].y, - slp[i].refscreen->id); - break; - } - } -#endif - /* - * Count the number of inactive devices. - */ - count = 0; - idp = conf_layout->lay_inactive_lst; - while (idp) { - count++; - idp = (XF86ConfInactivePtr)idp->list.next; - } -#ifdef DEBUG - ErrorF("Found %d inactive devices in the layout section %s", - count, conf_layout->lay_identifier); -#endif - gdp = xnfalloc((count + 1) * sizeof(GDevRec)); - gdp[count].identifier = NULL; - idp = conf_layout->lay_inactive_lst; - count = 0; - while (idp) { - if (!configDevice(&gdp[count], idp->inactive_device, FALSE)) - return FALSE; - count++; - idp = (XF86ConfInactivePtr)idp->list.next; - } - /* - * Count the number of input devices. - */ - count = 0; - irp = conf_layout->lay_input_lst; - while (irp) { - count++; - irp = (XF86ConfInputrefPtr)irp->list.next; - } -#ifdef DEBUG - ErrorF("Found %d input devices in the layout section %s", - count, conf_layout->lay_identifier); -#endif - indp = xnfalloc((count + 1) * sizeof(IDevRec)); - indp[count].identifier = NULL; - irp = conf_layout->lay_input_lst; - count = 0; - while (irp) { - if (!configInput(&indp[count], irp->iref_inputdev, X_CONFIG)) - return FALSE; - indp[count].extraOptions = irp->iref_option_lst; - count++; - irp = (XF86ConfInputrefPtr)irp->list.next; - } - servlayoutp->id = conf_layout->lay_identifier; - servlayoutp->screens = slp; - servlayoutp->inactives = gdp; - servlayoutp->inputs = indp; - servlayoutp->options = conf_layout->lay_option_lst; - from = X_DEFAULT; - - if (!checkCoreInputDevices(servlayoutp, FALSE)) - return FALSE; - return TRUE; -} - -/* - * No layout section, so find the first Screen section and set that up as - * the only active screen. - */ -static Bool -configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen) -{ - MessageType from; - XF86ConfScreenPtr s; - screenLayoutPtr slp; - IDevPtr indp; - - if (!servlayoutp) - return FALSE; - - if (conf_screen == NULL) { - xf86ConfigError("No Screen sections present\n"); - return FALSE; - } - - /* - * which screen section is the active one? - * - * If there is a -screen option, use that one, otherwise use the first - * one. - */ - - from = X_CONFIG; - if (xf86ScreenName != NULL) { - if ((s = xf86findScreen(xf86ScreenName, conf_screen)) == NULL) { - xf86Msg(X_ERROR, "No Screen section called \"%s\"\n", - xf86ScreenName); - return FALSE; - } - conf_screen = s; - from = X_CMDLINE; - } - - /* We have exactly one screen */ - - slp = xnfcalloc(1, 2 * sizeof(screenLayoutRec)); - slp[0].screen = xnfcalloc(1, sizeof(confScreenRec)); - slp[1].screen = NULL; - if (!configScreen(slp[0].screen, conf_screen, 0, from)) - return FALSE; - servlayoutp->id = "(implicit)"; - servlayoutp->screens = slp; - servlayoutp->inactives = xnfcalloc(1, sizeof(GDevRec)); - servlayoutp->options = NULL; - /* Set up an empty input device list, then look for some core devices. */ - indp = xnfalloc(sizeof(IDevRec)); - indp->identifier = NULL; - servlayoutp->inputs = indp; - if (!checkCoreInputDevices(servlayoutp, TRUE)) - return FALSE; - - return TRUE; -} - -static Bool -configXvAdaptor(confXvAdaptorPtr adaptor, XF86ConfVideoAdaptorPtr conf_adaptor) -{ - int count = 0; - XF86ConfVideoPortPtr conf_port; - - xf86Msg(X_CONFIG, "| |-->VideoAdaptor \"%s\"\n", - conf_adaptor->va_identifier); - adaptor->identifier = conf_adaptor->va_identifier; - adaptor->options = conf_adaptor->va_option_lst; - if (conf_adaptor->va_busid || conf_adaptor->va_driver) { - xf86Msg(X_CONFIG, "| | Unsupported device type, skipping entry\n"); - return FALSE; - } - - /* - * figure out how many videoport subsections there are and fill them in - */ - conf_port = conf_adaptor->va_port_lst; - while(conf_port) { - count++; - conf_port = (XF86ConfVideoPortPtr)conf_port->list.next; - } - adaptor->ports = xnfalloc((count) * sizeof(confXvPortRec)); - adaptor->numports = count; - count = 0; - conf_port = conf_adaptor->va_port_lst; - while(conf_port) { - adaptor->ports[count].identifier = conf_port->vp_identifier; - adaptor->ports[count].options = conf_port->vp_option_lst; - count++; - conf_port = (XF86ConfVideoPortPtr)conf_port->list.next; - } - - return TRUE; -} - -static Bool -configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum, - MessageType from) -{ - int count = 0; - XF86ConfDisplayPtr dispptr; - XF86ConfAdaptorLinkPtr conf_adaptor; - Bool defaultMonitor = FALSE; - - xf86Msg(from, "|-->Screen \"%s\" (%d)\n", conf_screen->scrn_identifier, - scrnum); - /* - * now we fill in the elements of the screen - */ - screenp->id = conf_screen->scrn_identifier; - screenp->screennum = scrnum; - screenp->defaultdepth = conf_screen->scrn_defaultdepth; - screenp->defaultbpp = conf_screen->scrn_defaultbpp; - screenp->defaultfbbpp = conf_screen->scrn_defaultfbbpp; - screenp->monitor = xnfcalloc(1, sizeof(MonRec)); - /* If no monitor is specified, create a default one. */ - if (!conf_screen->scrn_monitor) { - XF86ConfMonitorRec defMon; - - bzero(&defMon, sizeof(defMon)); - defMon.mon_identifier = ""; - /* - * TARGET_REFRESH_RATE may be defined to effectively limit the - * default resolution to the largest that has a "good" refresh - * rate. - */ -#ifdef TARGET_REFRESH_RATE - defMon.mon_option_lst = xf86ReplaceRealOption(defMon.mon_option_lst, - "TargetRefresh", - TARGET_REFRESH_RATE); -#endif - if (!configMonitor(screenp->monitor, &defMon)) - return FALSE; - defaultMonitor = TRUE; - } else { - if (!configMonitor(screenp->monitor,conf_screen->scrn_monitor)) - return FALSE; - } - screenp->device = xnfcalloc(1, sizeof(GDevRec)); - configDevice(screenp->device,conf_screen->scrn_device, TRUE); - screenp->device->myScreenSection = screenp; - screenp->options = conf_screen->scrn_option_lst; - - /* - * figure out how many display subsections there are and fill them in - */ - dispptr = conf_screen->scrn_display_lst; - while(dispptr) { - count++; - dispptr = (XF86ConfDisplayPtr)dispptr->list.next; - } - screenp->displays = xnfalloc((count) * sizeof(DispRec)); - screenp->numdisplays = count; - count = 0; - dispptr = conf_screen->scrn_display_lst; - while(dispptr) { - configDisplay(&(screenp->displays[count]),dispptr); - count++; - dispptr = (XF86ConfDisplayPtr)dispptr->list.next; - } - - /* - * figure out how many videoadaptor references there are and fill them in - */ - conf_adaptor = conf_screen->scrn_adaptor_lst; - while(conf_adaptor) { - count++; - conf_adaptor = (XF86ConfAdaptorLinkPtr)conf_adaptor->list.next; - } - screenp->xvadaptors = xnfalloc((count) * sizeof(confXvAdaptorRec)); - screenp->numxvadaptors = 0; - conf_adaptor = conf_screen->scrn_adaptor_lst; - while(conf_adaptor) { - if (configXvAdaptor(&(screenp->xvadaptors[screenp->numxvadaptors]), - conf_adaptor->al_adaptor)) - screenp->numxvadaptors++; - conf_adaptor = (XF86ConfAdaptorLinkPtr)conf_adaptor->list.next; - } - - if (defaultMonitor) { - xf86Msg(X_WARNING, "No monitor specified for screen \"%s\".\n" - "\tUsing a default monitor configuration.\n", screenp->id); - } - return TRUE; -} - -static Bool -configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor) -{ - int count; - DisplayModePtr mode,last = NULL; - XF86ConfModeLinePtr cmodep; - XF86ConfModesPtr modes; - XF86ConfModesLinkPtr modeslnk = conf_monitor->mon_modes_sect_lst; - Gamma zeros = {0.0, 0.0, 0.0}; - float badgamma = 0.0; - - xf86Msg(X_CONFIG, "| |-->Monitor \"%s\"\n", - conf_monitor->mon_identifier); - monitorp->id = conf_monitor->mon_identifier; - monitorp->vendor = conf_monitor->mon_vendor; - monitorp->model = conf_monitor->mon_modelname; - monitorp->Modes = NULL; - monitorp->Last = NULL; - monitorp->gamma = zeros; - monitorp->widthmm = conf_monitor->mon_width; - monitorp->heightmm = conf_monitor->mon_height; - monitorp->options = conf_monitor->mon_option_lst; - - /* - * fill in the monitor structure - */ - for( count = 0 ; - count < conf_monitor->mon_n_hsync && count < MAX_HSYNC; - count++) { - monitorp->hsync[count].hi = conf_monitor->mon_hsync[count].hi; - monitorp->hsync[count].lo = conf_monitor->mon_hsync[count].lo; - } - monitorp->nHsync = count; - for( count = 0 ; - count < conf_monitor->mon_n_vrefresh && count < MAX_VREFRESH; - count++) { - monitorp->vrefresh[count].hi = conf_monitor->mon_vrefresh[count].hi; - monitorp->vrefresh[count].lo = conf_monitor->mon_vrefresh[count].lo; - } - monitorp->nVrefresh = count; - - /* - * first we collect the mode lines from the UseModes directive - */ - while(modeslnk) - { - modes = xf86findModes (modeslnk->ml_modes_str, - xf86configptr->conf_modes_lst); - modeslnk->ml_modes = modes; - - - /* now add the modes found in the modes - section to the list of modes for this - monitor unless it has been added before - because we are reusing the same section - for another screen */ - if (xf86itemNotSublist( - (GenericListPtr)conf_monitor->mon_modeline_lst, - (GenericListPtr)modes->mon_modeline_lst)) { - conf_monitor->mon_modeline_lst = (XF86ConfModeLinePtr) - xf86addListItem( - (GenericListPtr)conf_monitor->mon_modeline_lst, - (GenericListPtr)modes->mon_modeline_lst); - } - modeslnk = modeslnk->list.next; - } - - /* - * we need to hook in the mode lines now - * here both data structures use lists, only our internal one - * is double linked - */ - cmodep = conf_monitor->mon_modeline_lst; - while( cmodep ) { - mode = xnfalloc(sizeof(DisplayModeRec)); - memset(mode,'\0',sizeof(DisplayModeRec)); - mode->type = 0; - mode->Clock = cmodep->ml_clock; - mode->HDisplay = cmodep->ml_hdisplay; - mode->HSyncStart = cmodep->ml_hsyncstart; - mode->HSyncEnd = cmodep->ml_hsyncend; - mode->HTotal = cmodep->ml_htotal; - mode->VDisplay = cmodep->ml_vdisplay; - mode->VSyncStart = cmodep->ml_vsyncstart; - mode->VSyncEnd = cmodep->ml_vsyncend; - mode->VTotal = cmodep->ml_vtotal; - mode->Flags = cmodep->ml_flags; - mode->HSkew = cmodep->ml_hskew; - mode->VScan = cmodep->ml_vscan; - mode->name = xnfstrdup(cmodep->ml_identifier); - if( last ) { - mode->prev = last; - last->next = mode; - } - else { - /* - * this is the first mode - */ - monitorp->Modes = mode; - mode->prev = NULL; - } - last = mode; - cmodep = (XF86ConfModeLinePtr)cmodep->list.next; - } - if(last){ - last->next = NULL; - } - monitorp->Last = last; - - /* add the (VESA) default modes */ - if (! addDefaultModes(monitorp) ) - return FALSE; - - if (conf_monitor->mon_gamma_red > GAMMA_ZERO) - monitorp->gamma.red = conf_monitor->mon_gamma_red; - if (conf_monitor->mon_gamma_green > GAMMA_ZERO) - monitorp->gamma.green = conf_monitor->mon_gamma_green; - if (conf_monitor->mon_gamma_blue > GAMMA_ZERO) - monitorp->gamma.blue = conf_monitor->mon_gamma_blue; - - /* Check that the gamma values are within range */ - if (monitorp->gamma.red > GAMMA_ZERO && - (monitorp->gamma.red < GAMMA_MIN || - monitorp->gamma.red > GAMMA_MAX)) { - badgamma = monitorp->gamma.red; - } else if (monitorp->gamma.green > GAMMA_ZERO && - (monitorp->gamma.green < GAMMA_MIN || - monitorp->gamma.green > GAMMA_MAX)) { - badgamma = monitorp->gamma.green; - } else if (monitorp->gamma.blue > GAMMA_ZERO && - (monitorp->gamma.blue < GAMMA_MIN || - monitorp->gamma.blue > GAMMA_MAX)) { - badgamma = monitorp->gamma.blue; - } - if (badgamma > GAMMA_ZERO) { - xf86ConfigError("Gamma value %.f is out of range (%.2f - %.1f)\n", - badgamma, GAMMA_MIN, GAMMA_MAX); - return FALSE; - } - - return TRUE; -} - -static int -lookupVisual(const char *visname) -{ - int i; - - if (!visname || !*visname) - return -1; - - for (i = 0; i <= DirectColor; i++) { - if (!xf86nameCompare(visname, xf86VisualNames[i])) - break; - } - - if (i <= DirectColor) - return i; - - return -1; -} - - -static Bool -configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display) -{ - int count = 0; - XF86ModePtr modep; - - displayp->frameX0 = conf_display->disp_frameX0; - displayp->frameY0 = conf_display->disp_frameY0; - displayp->virtualX = conf_display->disp_virtualX; - displayp->virtualY = conf_display->disp_virtualY; - displayp->depth = conf_display->disp_depth; - displayp->fbbpp = conf_display->disp_bpp; - displayp->weight.red = conf_display->disp_weight.red; - displayp->weight.green = conf_display->disp_weight.green; - displayp->weight.blue = conf_display->disp_weight.blue; - displayp->blackColour.red = conf_display->disp_black.red; - displayp->blackColour.green = conf_display->disp_black.green; - displayp->blackColour.blue = conf_display->disp_black.blue; - displayp->whiteColour.red = conf_display->disp_white.red; - displayp->whiteColour.green = conf_display->disp_white.green; - displayp->whiteColour.blue = conf_display->disp_white.blue; - displayp->options = conf_display->disp_option_lst; - if (conf_display->disp_visual) { - displayp->defaultVisual = lookupVisual(conf_display->disp_visual); - if (displayp->defaultVisual == -1) { - xf86ConfigError("Invalid visual name: \"%s\"", - conf_display->disp_visual); - return FALSE; - } - } else { - displayp->defaultVisual = -1; - } - - /* - * now hook in the modes - */ - modep = conf_display->disp_mode_lst; - while(modep) { - count++; - modep = (XF86ModePtr)modep->list.next; - } - displayp->modes = xnfalloc((count+1) * sizeof(char*)); - modep = conf_display->disp_mode_lst; - count = 0; - while(modep) { - displayp->modes[count] = modep->mode_name; - count++; - modep = (XF86ModePtr)modep->list.next; - } - displayp->modes[count] = NULL; - - return TRUE; -} - -static Bool -configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active) -{ - int i; - - if (active) - xf86Msg(X_CONFIG, "| |-->Device \"%s\"\n", - conf_device->dev_identifier); - else - xf86Msg(X_CONFIG, "|-->Inactive Device \"%s\"\n", - conf_device->dev_identifier); - - devicep->identifier = conf_device->dev_identifier; - devicep->vendor = conf_device->dev_vendor; - devicep->board = conf_device->dev_board; - devicep->chipset = conf_device->dev_chipset; - devicep->ramdac = conf_device->dev_ramdac; - devicep->driver = conf_device->dev_driver; - devicep->active = active; - devicep->videoRam = conf_device->dev_videoram; - devicep->BiosBase = conf_device->dev_bios_base; - devicep->MemBase = conf_device->dev_mem_base; - devicep->IOBase = conf_device->dev_io_base; - devicep->clockchip = conf_device->dev_clockchip; - devicep->busID = conf_device->dev_busid; - devicep->textClockFreq = conf_device->dev_textclockfreq; - devicep->chipID = conf_device->dev_chipid; - devicep->chipRev = conf_device->dev_chiprev; - devicep->options = conf_device->dev_option_lst; - devicep->irq = conf_device->dev_irq; - devicep->screen = conf_device->dev_screen; - - for (i = 0; i < MAXDACSPEEDS; i++) { - if (i < CONF_MAXDACSPEEDS) - devicep->dacSpeeds[i] = conf_device->dev_dacSpeeds[i]; - else - devicep->dacSpeeds[i] = 0; - } - devicep->numclocks = conf_device->dev_clocks; - if (devicep->numclocks > MAXCLOCKS) - devicep->numclocks = MAXCLOCKS; - for (i = 0; i < devicep->numclocks; i++) { - devicep->clock[i] = conf_device->dev_clock[i]; - } - devicep->claimed = FALSE; - - return TRUE; -} - -#ifdef XF86DRI -static Bool -configDRI(XF86ConfDRIPtr drip) -{ - int count = 0; - XF86ConfBuffersPtr bufs; - int i; - struct group *grp; - - xf86ConfigDRI.group = -1; - xf86ConfigDRI.mode = 0; - xf86ConfigDRI.bufs_count = 0; - xf86ConfigDRI.bufs = NULL; - - if (drip) { - if (drip->dri_group_name) { - if ((grp = getgrnam(drip->dri_group_name))) - xf86ConfigDRI.group = grp->gr_gid; - } else { - if (drip->dri_group >= 0) - xf86ConfigDRI.group = drip->dri_group; - } - xf86ConfigDRI.mode = drip->dri_mode; - for (bufs = drip->dri_buffers_lst; bufs; bufs = bufs->list.next) - ++count; - - xf86ConfigDRI.bufs_count = count; - xf86ConfigDRI.bufs = xnfalloc(count * sizeof(*xf86ConfigDRI.bufs)); - - for (i = 0, bufs = drip->dri_buffers_lst; - i < count; - i++, bufs = bufs->list.next) { - - xf86ConfigDRI.bufs[i].count = bufs->buf_count; - xf86ConfigDRI.bufs[i].size = bufs->buf_size; - /* FIXME: Flags not implemented. These - could be used, for example, to specify a - contiguous block and/or write-combining - cache policy. */ - xf86ConfigDRI.bufs[i].flags = 0; - } - } - - return TRUE; -} -#endif - -static Bool -configExtensions(XF86ConfExtensionsPtr conf_ext) -{ - XF86OptionPtr o; - - /* Extension enable/disable in miinitext.c */ - extern Bool EnableDisableExtension(char *name, Bool enable); - - if (conf_ext && conf_ext->ext_option_lst) { - for (o = conf_ext->ext_option_lst; o; o = xf86NextOption(o)) { - char *name = xf86OptionName(o); - char *val = xf86OptionValue(o); - char *n; - Bool enable = TRUE; - - /* Handle "No" */ - n = xf86NormalizeName(name); - if (strncmp(n, "no", 2) == 0) { - name += 2; - enable = FALSE; - } - - if (!val || - xf86NameCmp(val, "enable") == 0 || - xf86NameCmp(val, "enabled") == 0 || - xf86NameCmp(val, "on") == 0 || - xf86NameCmp(val, "1") == 0 || - xf86NameCmp(val, "yes") == 0 || - xf86NameCmp(val, "true") == 0) { - /* NOTHING NEEDED -- enabling is handled below */ - } else if (xf86NameCmp(val, "disable") == 0 || - xf86NameCmp(val, "disabled") == 0 || - xf86NameCmp(val, "off") == 0 || - xf86NameCmp(val, "0") == 0 || - xf86NameCmp(val, "no") == 0 || - xf86NameCmp(val, "false") == 0) { - enable = !enable; - } else { - xf86Msg(X_ERROR, - "%s is not a valid value for the Extension option\n", - val); - return FALSE; - } - - if (EnableDisableExtension(name, enable)) { - xf86Msg(X_CONFIG, "Extension \"%s\" is %s\n", - name, enable ? "enabled" : "disabled"); - } else { - xf86Msg(X_WARNING, "Ignoring unrecognized extension \"%s\"\n", - name); - } - } - } - - return TRUE; -} - -static Bool -configInput(IDevPtr inputp, XF86ConfInputPtr conf_input, MessageType from) -{ - xf86Msg(from, "|-->Input Device \"%s\"\n", conf_input->inp_identifier); - inputp->identifier = conf_input->inp_identifier; - inputp->driver = conf_input->inp_driver; - inputp->commonOptions = conf_input->inp_option_lst; - inputp->extraOptions = NULL; - - /* XXX This is required until the keyboard driver is converted */ - if (!xf86NameCmp(inputp->driver, "keyboard")) - return configInputKbd(inputp); - - return TRUE; -} - -static Bool -modeIsPresent(char * modename,MonPtr monitorp) -{ - DisplayModePtr knownmodes = monitorp->Modes; - - /* all I can think of is a linear search... */ - while(knownmodes != NULL) - { - if(!strcmp(modename,knownmodes->name) && - !(knownmodes->type & M_T_DEFAULT)) - return TRUE; - knownmodes = knownmodes->next; - } - return FALSE; -} - -static Bool -addDefaultModes(MonPtr monitorp) -{ - DisplayModePtr mode; - DisplayModePtr last = monitorp->Last; - int i = 0; - - while (xf86DefaultModes[i].name != NULL) - { - if ( ! modeIsPresent(xf86DefaultModes[i].name,monitorp) ) - do - { - mode = xnfalloc(sizeof(DisplayModeRec)); - memcpy(mode,&xf86DefaultModes[i],sizeof(DisplayModeRec)); - if (xf86DefaultModes[i].name) - mode->name = xnfstrdup(xf86DefaultModes[i].name); - if( last ) { - mode->prev = last; - last->next = mode; - } - else { - /* this is the first mode */ - monitorp->Modes = mode; - mode->prev = NULL; - } - last = mode; - i++; - } - while((xf86DefaultModes[i].name != NULL) && - (!strcmp(xf86DefaultModes[i].name,xf86DefaultModes[i-1].name))); - else - i++; - } - monitorp->Last = last; - - return TRUE; -} - -/* - * load the config file and fill the global data structure - */ -ConfigStatus -xf86HandleConfigFile(Bool autoconfig) -{ - const char *filename; - char *searchpath; - MessageType from = X_DEFAULT; - char *scanptr; - Bool singlecard = 0; - - if (!autoconfig) { - if (getuid() == 0) - searchpath = ROOT_CONFIGPATH; - else - searchpath = USER_CONFIGPATH; - - if (xf86ConfigFile) - from = X_CMDLINE; - - filename = xf86openConfigFile(searchpath, xf86ConfigFile, PROJECTROOT); - if (filename) { - xf86MsgVerb(from, 0, "Using config file: \"%s\"\n", filename); - xf86ConfigFile = xnfstrdup(filename); - } else { - xf86Msg(X_ERROR, "Unable to locate/open config file"); - if (xf86ConfigFile) - xf86ErrorFVerb(0, ": \"%s\"", xf86ConfigFile); - xf86ErrorFVerb(0, "\n"); - return CONFIG_NOFILE; - } - } - - if ((xf86configptr = xf86readConfigFile ()) == NULL) { - xf86Msg(X_ERROR, "Problem parsing the config file\n"); - return CONFIG_PARSE_ERROR; - } - xf86closeConfigFile (); - - /* Initialise a few things. */ - - /* - * now we convert part of the information contained in the parser - * structures into our own structures. - * The important part here is to figure out which Screen Sections - * in the XF86Config file are active so that we can piece together - * the modes that we need later down the road. - * And while we are at it, we'll decode the rest of the stuff as well - */ - - /* First check if a layout section is present, and if it is valid. */ - - if (xf86configptr->conf_layout_lst == NULL || xf86ScreenName != NULL) { - if (xf86ScreenName == NULL) { - xf86Msg(X_WARNING, - "No Layout section. Using the first Screen section.\n"); - } - if (!configImpliedLayout(&xf86ConfigLayout, - xf86configptr->conf_screen_lst)) { - xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); - return CONFIG_PARSE_ERROR; - } - } else { - if (xf86configptr->conf_flags != NULL) { - char *dfltlayout = NULL; - pointer optlist = xf86configptr->conf_flags->flg_option_lst; - - if (optlist && xf86FindOption(optlist, "defaultserverlayout")) - dfltlayout = xf86SetStrOption(optlist, "defaultserverlayout", NULL); - if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst, - dfltlayout)) { - xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); - return CONFIG_PARSE_ERROR; - } - } else { - if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst, - NULL)) { - xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); - return CONFIG_PARSE_ERROR; - } - } - } - - xf86ProcessOptions(-1, xf86ConfigLayout.options, LayoutOptions); - - if ((scanptr = xf86GetOptValString(LayoutOptions, LAYOUT_ISOLATEDEVICE))) { - ; /* IsolateDevice specified; overrides SingleCard */ - } else { - xf86GetOptValBool(LayoutOptions, LAYOUT_SINGLECARD, &singlecard); - if (singlecard) - scanptr = xf86ConfigLayout.screens->screen->device->busID; - } - if (scanptr) { - int bus, device, func, stroffset = 0; - if (strncmp(scanptr, "PCI:", 4) != 0) { - xf86Msg(X_WARNING, "Bus types other than PCI not yet isolable.\n" - "\tIgnoring IsolateDevice option.\n"); - } else if (sscanf(scanptr, "PCI:%d:%d:%d", &bus, &device, &func) == 3) { - xf86IsolateDevice.bus = bus; - xf86IsolateDevice.device = device; - xf86IsolateDevice.func = func; - xf86Msg(X_INFO, - "Isolating PCI bus \"%d:%d:%d\"\n", bus, device, func); - } - } - - /* Now process everything else */ - - if (!configFiles(xf86configptr->conf_files) || - !configServerFlags(xf86configptr->conf_flags, - xf86ConfigLayout.options) || - !configExtensions(xf86configptr->conf_extensions) -#ifdef XF86DRI - || !configDRI(xf86configptr->conf_dri) -#endif - ) { - ErrorF ("Problem when converting the config data structures\n"); - return CONFIG_PARSE_ERROR; - } - - /* - * Handle some command line options that can override some of the - * ServerFlags settings. - */ -#ifdef XF86VIDMODE - if (xf86VidModeDisabled) - xf86Info.vidModeEnabled = FALSE; - if (xf86VidModeAllowNonLocal) - xf86Info.vidModeAllowNonLocal = TRUE; -#endif - -#ifdef XF86MISC - if (xf86MiscModInDevDisabled) - xf86Info.miscModInDevEnabled = FALSE; - if (xf86MiscModInDevAllowNonLocal) - xf86Info.miscModInDevAllowNonLocal = TRUE; -#endif - - if (xf86AllowMouseOpenFail) - xf86Info.allowMouseOpenFail = TRUE; - - return CONFIG_OK; -} - - -/* These make the equivalent parser functions visible to the common layer. */ -Bool -xf86PathIsAbsolute(const char *path) -{ - return (xf86pathIsAbsolute(path) != 0); -} - -Bool -xf86PathIsSafe(const char *path) -{ - return (xf86pathIsSafe(path) != 0); -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Config.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Config.h deleted file mode 100644 index 77b25ed32..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Config.h +++ /dev/null @@ -1,63 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.h,v 1.7 2003/10/08 14:58:27 dawes Exp $ */ - -/* - * Copyright (c) 1997-2000 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef _xf86_config_h -#define _xf86_config_h - -#ifdef HAVE_PARSER_DECLS -/* - * global structure that holds the result of parsing the config file - */ -extern XF86ConfigPtr xf86configptr; -#endif - -typedef enum _ConfigStatus { - CONFIG_OK = 0, - CONFIG_PARSE_ERROR, - CONFIG_NOFILE -} ConfigStatus; - -/* - * prototypes - */ -char ** xf86ModulelistFromConfig(pointer **); -char ** xf86DriverlistFromConfig(void); -char ** xf86DriverlistFromCompile(void); -char ** xf86InputDriverlistFromConfig(void); -char ** xf86InputDriverlistFromCompile(void); -Bool xf86BuiltinInputDriver(const char *); -ConfigStatus xf86HandleConfigFile(Bool); - -Bool xf86AutoConfig(void); - -#endif /* _xf86_config_h */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Configure.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Configure.c deleted file mode 100644 index 208961f6a..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Configure.c +++ /dev/null @@ -1,1049 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.80 2003/10/08 14:58:27 dawes Exp $ */ -/* - * Copyright 2000-2002 by Alan Hourihane, Flint Mountain, North Wales. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Author: Alan Hourihane, alanh@fairlite.demon.co.uk - * - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include "os.h" -#ifdef XFree86LOADER -#include "loaderProcs.h" -#endif -#include "xf86.h" -#include "xf86Config.h" -#include "xf86_OSlib.h" -#include "xf86Priv.h" -#include "xf86PciData.h" -#define IN_XSERVER -#include "xf86Parser.h" -#include "xf86tokens.h" -#include "Configint.h" -#include "vbe.h" -#include "xf86DDC.h" -#if defined(__sparc__) && !defined(__OpenBSD__) -#include "xf86Bus.h" -#include "xf86Sbus.h" -#endif -#include "globals.h" - -typedef struct _DevToConfig { - GDevRec GDev; - pciVideoPtr pVideo; -#if defined(__sparc__) && !defined(__OpenBSD__) - sbusDevicePtr sVideo; -#endif - int iDriver; -} DevToConfigRec, *DevToConfigPtr; - -static DevToConfigPtr DevToConfig = NULL; -static int nDevToConfig = 0, CurrentDriver; - -xf86MonPtr ConfiguredMonitor; -Bool xf86DoConfigurePass1 = TRUE; -Bool foundMouse = FALSE; - -#if defined(__UNIXOS2__) -#define DFLT_MOUSE_DEV "mouse$" -#define DFLT_MOUSE_PROTO "OS2Mouse" -#elif defined(__SCO__) -static char *DFLT_MOUSE_PROTO = "OSMouse"; -#elif defined(__UNIXWARE__) -static char *DFLT_MOUSE_PROTO = "Xqueue"; -static char *DFLT_MOUSE_DEV = "/dev/mouse"; -#elif defined(QNX4) -static char *DFLT_MOUSE_PROTO = "OSMouse"; -static char *DFLT_MOUSE_DEV = "/dev/mouse"; -#elif defined(__QNXNTO__) -static char *DFLT_MOUSE_PROTO = "OSMouse"; -static char *DFLT_MOUSE_DEV = "/dev/devi/mouse0"; -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -static char *DFLT_MOUSE_DEV = "/dev/sysmouse"; -static char *DFLT_MOUSE_PROTO = "auto"; -#else -static char *DFLT_MOUSE_DEV = "/dev/mouse"; -static char *DFLT_MOUSE_PROTO = "auto"; -#endif - -/* - * This is called by the driver, either through xf86Match???Instances() or - * directly. We allocate a GDevRec and fill it in as much as we can, letting - * the caller fill in the rest and/or change it as it sees fit. - */ -GDevPtr -xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int chipset) -{ - int i, j; - pciVideoPtr pVideo = NULL; - Bool isPrimary = FALSE; - - if (xf86DoProbe || !xf86DoConfigure || !xf86DoConfigurePass1) - return NULL; - - /* Check for duplicates */ - switch (bus) { - case BUS_PCI: - pVideo = (pciVideoPtr) busData; - for (i = 0; i < nDevToConfig; i++) - if (DevToConfig[i].pVideo && - (DevToConfig[i].pVideo->bus == pVideo->bus) && - (DevToConfig[i].pVideo->device == pVideo->device) && - (DevToConfig[i].pVideo->func == pVideo->func)) - return NULL; - isPrimary = xf86IsPrimaryPci(pVideo); - break; - case BUS_ISA: - /* - * This needs to be revisited as it doesn't allow for non-PCI - * multihead. - */ - if (!xf86IsPrimaryIsa()) - return NULL; - isPrimary = TRUE; - for (i = 0; i < nDevToConfig; i++) - if (!DevToConfig[i].pVideo) - return NULL; - break; -#if defined(__sparc__) && !defined(__OpenBSD__) - case BUS_SBUS: - for (i = 0; i < nDevToConfig; i++) - if (DevToConfig[i].sVideo && - DevToConfig[i].sVideo->fbNum == ((sbusDevicePtr) busData)->fbNum) - return NULL; - break; -#endif - default: - return NULL; - } - - /* Allocate new structure occurrence */ - i = nDevToConfig++; - DevToConfig = - xnfrealloc(DevToConfig, nDevToConfig * sizeof(DevToConfigRec)); -#if 1 /* Doesn't work when a driver detects more than one adapter */ - if ((i > 0) && isPrimary) { - memmove(DevToConfig + 1,DevToConfig, - (nDevToConfig - 1) * sizeof(DevToConfigRec)); - i = 0; - } -#endif - memset(DevToConfig + i, 0, sizeof(DevToConfigRec)); - -# define NewDevice DevToConfig[i] - - NewDevice.GDev.chipID = NewDevice.GDev.chipRev = NewDevice.GDev.irq = -1; - - NewDevice.iDriver = CurrentDriver; - - /* Fill in what we know, converting the driver name to lower case */ - NewDevice.GDev.driver = xnfalloc(strlen(driver) + 1); - for (j = 0; (NewDevice.GDev.driver[j] = tolower(driver[j])); j++); - - switch (bus) { - case BUS_PCI: { - const char *VendorName; - const char *CardName; - char busnum[8]; - - NewDevice.pVideo = pVideo; - xf86FindPciNamesByDevice(pVideo->vendor, pVideo->chipType, - NOVENDOR, NOSUBSYS, - &VendorName, &CardName, NULL, NULL); - - if (!VendorName) { - VendorName = xnfalloc(15); - sprintf((char*)VendorName, "Unknown Vendor"); - } - - if (!CardName) { - CardName = xnfalloc(14); - sprintf((char*)CardName, "Unknown Board"); - } - - NewDevice.GDev.identifier = - xnfalloc(strlen(VendorName) + strlen(CardName) + 2); - sprintf(NewDevice.GDev.identifier, "%s %s", VendorName, CardName); - - NewDevice.GDev.vendor = (char *)VendorName; - NewDevice.GDev.board = (char *)CardName; - - NewDevice.GDev.busID = xnfalloc(16); - xf86FormatPciBusNumber(pVideo->bus, busnum); - sprintf(NewDevice.GDev.busID, "PCI:%s:%d:%d", - busnum, pVideo->device, pVideo->func); - - NewDevice.GDev.chipID = pVideo->chipType; - NewDevice.GDev.chipRev = pVideo->chipRev; - - if (chipset < 0) - chipset = (pVideo->vendor << 16) | pVideo->chipType; - } - break; - case BUS_ISA: - NewDevice.GDev.identifier = "ISA Adapter"; - NewDevice.GDev.busID = "ISA"; - break; -#if defined(__sparc__) && !defined(__OpenBSD__) - case BUS_SBUS: { - char *promPath = NULL; - NewDevice.sVideo = (sbusDevicePtr) busData; - NewDevice.GDev.identifier = NewDevice.sVideo->descr; - if (sparcPromInit() >= 0) { - promPath = sparcPromNode2Pathname(&NewDevice.sVideo->node); - sparcPromClose(); - } - if (promPath) { - NewDevice.GDev.busID = xnfalloc(strlen(promPath) + 6); - sprintf(NewDevice.GDev.busID, "SBUS:%s", promPath); - xfree(promPath); - } else { - NewDevice.GDev.busID = xnfalloc(12); - sprintf(NewDevice.GDev.busID, "SBUS:fb%d", NewDevice.sVideo->fbNum); - } - } - break; -#endif - default: - break; - } - - /* Get driver's available options */ - if (xf86DriverList[CurrentDriver]->AvailableOptions) - NewDevice.GDev.options = (OptionInfoPtr) - (*xf86DriverList[CurrentDriver]->AvailableOptions)(chipset, - bus); - - return &NewDevice.GDev; - -# undef NewDevice -} - -/* - * Backwards compatibility - */ -GDevPtr -xf86AddDeviceToConfigure(const char *driver, pciVideoPtr pVideo, int chipset) -{ - return xf86AddBusDeviceToConfigure(driver, pVideo ? BUS_PCI : BUS_ISA, - pVideo, chipset); -} - -static XF86ConfInputPtr -configureInputSection (void) -{ - XF86ConfInputPtr mouse = NULL; - parsePrologue (XF86ConfInputPtr, XF86ConfInputRec) - - ptr->inp_identifier = "Keyboard0"; -#ifdef USE_DEPRECATED_KEYBOARD_DRIVER - ptr->inp_driver = "keyboard"; -#else - ptr->inp_driver = "kbd"; -#endif - ptr->list.next = NULL; - - /* Crude mechanism to auto-detect mouse (os dependent) */ - { - int fd; -#if 0 && defined linux - /* Our autodetection code can do a better job */ - int len; - char path[32]; - - if ((len = readlink(DFLT_MOUSE_DEV, path, sizeof(path) - 1)) > 0) { - path[len] = '\0'; - if (strstr(path, "psaux") != NULL) - DFLT_MOUSE_PROTO = "PS/2"; - } -#endif -#ifdef WSCONS_SUPPORT - fd = open("/dev/wsmouse", 0); - if (fd > 0) { - DFLT_MOUSE_DEV = "/dev/wsmouse"; - DFLT_MOUSE_PROTO = "wsmouse"; - close(fd); - } else { - ErrorF("cannot open /dev/wsmouse\n"); - } -#endif - -#ifndef __SCO__ - fd = open(DFLT_MOUSE_DEV, 0); - if (fd != -1) { - foundMouse = TRUE; - close(fd); - } -#else - foundMouse = TRUE; -#endif - } - - mouse = xf86confmalloc(sizeof(XF86ConfInputRec)); - memset((XF86ConfInputPtr)mouse,0,sizeof(XF86ConfInputRec)); - mouse->inp_identifier = "Mouse0"; - mouse->inp_driver = "mouse"; - mouse->inp_option_lst = - xf86addNewOption(mouse->inp_option_lst, "Protocol", DFLT_MOUSE_PROTO); -#ifndef __SCO__ - mouse->inp_option_lst = - xf86addNewOption(mouse->inp_option_lst, "Device", DFLT_MOUSE_DEV); -#endif - mouse->inp_option_lst = - xf86addNewOption(mouse->inp_option_lst, "ZAxisMapping", "4 5 6 7"); - ptr = (XF86ConfInputPtr)xf86addListItem((glp)ptr, (glp)mouse); - return ptr; -} - -static XF86ConfDRIPtr -configureDRISection (void) -{ -#ifdef NOTYET - parsePrologue (XF86ConfDRIPtr, XF86ConfDRIRec) - - return ptr; -#else - return NULL; -#endif -} - -static XF86ConfVendorPtr -configureVendorSection (void) -{ - parsePrologue (XF86ConfVendorPtr, XF86ConfVendorRec) - - return NULL; -#if 0 - return ptr; -#endif -} - -static XF86ConfScreenPtr -configureScreenSection (int screennum) -{ - int i; - int depths[] = { 1, 4, 8, 15, 16, 24/*, 32*/ }; - parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec) - - ptr->scrn_identifier = xf86confmalloc(18); - sprintf(ptr->scrn_identifier, "Screen%d", screennum); - ptr->scrn_monitor_str = xf86confmalloc(19); - sprintf(ptr->scrn_monitor_str, "Monitor%d", screennum); - ptr->scrn_device_str = xf86confmalloc(16); - sprintf(ptr->scrn_device_str, "Card%d", screennum); - - for (i=0; idisp_depth = depths[i]; - display->disp_black.red = display->disp_white.red = -1; - display->disp_black.green = display->disp_white.green = -1; - display->disp_black.blue = display->disp_white.blue = -1; - ptr->scrn_display_lst = (XF86ConfDisplayPtr)xf86addListItem( - (glp)ptr->scrn_display_lst, (glp)display); - } - - return ptr; -} - -static const char* -optionTypeToSting(OptionValueType type) -{ - switch (type) { - case OPTV_NONE: - return ""; - case OPTV_INTEGER: - return ""; - case OPTV_STRING: - return ""; - case OPTV_ANYSTR: - return "[]"; - case OPTV_REAL: - return ""; - case OPTV_BOOLEAN: - return "[]"; - case OPTV_FREQ: - return ""; - default: - return ""; - } -} - -static XF86ConfDevicePtr -configureDeviceSection (int screennum) -{ - char identifier[16]; - OptionInfoPtr p; - int i = 0; -#ifdef DO_FBDEV_PROBE - Bool foundFBDEV = FALSE; -#endif - parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec) - - /* Move device info to parser structure */ - sprintf(identifier, "Card%d", screennum); - ptr->dev_identifier = strdup(identifier); -/* ptr->dev_identifier = DevToConfig[screennum].GDev.identifier;*/ - ptr->dev_vendor = DevToConfig[screennum].GDev.vendor; - ptr->dev_board = DevToConfig[screennum].GDev.board; - ptr->dev_chipset = DevToConfig[screennum].GDev.chipset; - ptr->dev_busid = DevToConfig[screennum].GDev.busID; - ptr->dev_driver = DevToConfig[screennum].GDev.driver; - ptr->dev_ramdac = DevToConfig[screennum].GDev.ramdac; - for (i = 0; (i < MAXDACSPEEDS) && (i < CONF_MAXDACSPEEDS); i++) - ptr->dev_dacSpeeds[i] = DevToConfig[screennum].GDev.dacSpeeds[i]; - ptr->dev_videoram = DevToConfig[screennum].GDev.videoRam; - ptr->dev_textclockfreq = DevToConfig[screennum].GDev.textClockFreq; - ptr->dev_bios_base = DevToConfig[screennum].GDev.BiosBase; - ptr->dev_mem_base = DevToConfig[screennum].GDev.MemBase; - ptr->dev_io_base = DevToConfig[screennum].GDev.IOBase; - ptr->dev_clockchip = DevToConfig[screennum].GDev.clockchip; - for (i = 0; (i < MAXCLOCKS) && (i < DevToConfig[screennum].GDev.numclocks); i++) - ptr->dev_clock[i] = DevToConfig[screennum].GDev.clock[i]; - ptr->dev_clocks = i; - ptr->dev_chipid = DevToConfig[screennum].GDev.chipID; - ptr->dev_chiprev = DevToConfig[screennum].GDev.chipRev; - ptr->dev_irq = DevToConfig[screennum].GDev.irq; - - /* Make sure older drivers don't segv */ - if (DevToConfig[screennum].GDev.options) { - /* Fill in the available driver options for people to use */ - const char *descrip = - " ### Available Driver options are:-\n" - " ### Values: : integer, : float, " - ": \"True\"/\"False\",\n" - " ### : \"String\", : \" Hz/kHz/MHz\"\n" - " ### [arg]: arg optional\n"; - ptr->dev_comment = xstrdup(descrip); - if (ptr->dev_comment) { - for (p = DevToConfig[screennum].GDev.options; - p->name != NULL; p++) { - char *p_e; - const char *prefix = " #Option "; - const char *middle = " \t# "; - const char *suffix = "\n"; - const char *opttype = optionTypeToSting(p->type); - char *optname; - int len = strlen(ptr->dev_comment) + strlen(prefix) + - strlen(middle) + strlen(suffix) + 1; - - optname = xalloc(strlen(p->name) + 2 + 1); - if (!optname) - break; - sprintf(optname, "\"%s\"", p->name); - - len += max(20, strlen(optname)); - len += strlen(opttype); - - ptr->dev_comment = xrealloc(ptr->dev_comment, len); - if (!ptr->dev_comment) - break; - p_e = ptr->dev_comment + strlen(ptr->dev_comment); - sprintf(p_e, "%s%-20s%s%s%s", prefix, optname, middle, - opttype, suffix); - xfree(optname); - } - } - } - -#ifdef DO_FBDEV_PROBE - /* Crude mechanism to auto-detect fbdev (os dependent) */ - /* Skip it for now. Options list it anyway, and we can't - * determine which screen/driver this belongs too anyway. */ - { - int fd; - - fd = open("/dev/fb0", 0); - if (fd != -1) { - foundFBDEV = TRUE; - close(fd); - } - } - - if (foundFBDEV) { - XF86OptionPtr fbdev; - - fbdev = xf86confmalloc(sizeof(XF86OptionRec)); - memset((XF86OptionPtr)fbdev,0,sizeof(XF86OptionRec)); - fbdev->opt_name = "UseFBDev"; - fbdev->opt_val = "ON"; - ptr->dev_option_lst = (XF86OptionPtr)xf86addListItem( - (glp)ptr->dev_option_lst, (glp)fbdev); - } -#endif - - return ptr; -} - -static XF86ConfLayoutPtr -configureLayoutSection (void) -{ - int scrnum = 0; - parsePrologue (XF86ConfLayoutPtr, XF86ConfLayoutRec) - - ptr->lay_identifier = "X.org Configured"; - - { - XF86ConfInputrefPtr iptr; - - iptr = xf86confmalloc (sizeof (XF86ConfInputrefRec)); - iptr->list.next = NULL; - iptr->iref_option_lst = NULL; - iptr->iref_inputdev_str = "Mouse0"; - iptr->iref_option_lst = - xf86addNewOption (iptr->iref_option_lst, "CorePointer", NULL); - ptr->lay_input_lst = (XF86ConfInputrefPtr) - xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr); - } - - { - XF86ConfInputrefPtr iptr; - - iptr = xf86confmalloc (sizeof (XF86ConfInputrefRec)); - iptr->list.next = NULL; - iptr->iref_option_lst = NULL; - iptr->iref_inputdev_str = "Keyboard0"; - iptr->iref_option_lst = - xf86addNewOption (iptr->iref_option_lst, "CoreKeyboard", NULL); - ptr->lay_input_lst = (XF86ConfInputrefPtr) - xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr); - } - - for (scrnum = 0; scrnum < nDevToConfig; scrnum++) { - XF86ConfAdjacencyPtr aptr; - - aptr = xf86confmalloc (sizeof (XF86ConfAdjacencyRec)); - aptr->list.next = NULL; - aptr->adj_x = 0; - aptr->adj_y = 0; - aptr->adj_scrnum = scrnum; - aptr->adj_screen_str = xnfalloc(18); - sprintf(aptr->adj_screen_str, "Screen%d", scrnum); - if (scrnum == 0) { - aptr->adj_where = CONF_ADJ_ABSOLUTE; - aptr->adj_refscreen = NULL; - } - else { - aptr->adj_where = CONF_ADJ_RIGHTOF; - aptr->adj_refscreen = xnfalloc(18); - sprintf(aptr->adj_refscreen, "Screen%d", scrnum - 1); - } - ptr->lay_adjacency_lst = - (XF86ConfAdjacencyPtr)xf86addListItem((glp)ptr->lay_adjacency_lst, - (glp)aptr); - } - - return ptr; -} - -static XF86ConfModesPtr -configureModesSection (void) -{ -#ifdef NOTYET - parsePrologue (XF86ConfModesPtr, XF86ConfModesRec) - - return ptr; -#else - return NULL; -#endif -} - -static XF86ConfVideoAdaptorPtr -configureVideoAdaptorSection (void) -{ - parsePrologue (XF86ConfVideoAdaptorPtr, XF86ConfVideoAdaptorRec) - - return NULL; -#if 0 - return ptr; -#endif -} - -static XF86ConfFlagsPtr -configureFlagsSection (void) -{ - parsePrologue (XF86ConfFlagsPtr, XF86ConfFlagsRec) - - return ptr; -} - -static XF86ConfModulePtr -configureModuleSection (void) -{ -#ifdef XFree86LOADER - char **elist, **el; - /* Find the list of extension modules. */ - const char *esubdirs[] = { - "extensions", - NULL - }; - const char *fsubdirs[] = { - "fonts", - NULL - }; -#endif - parsePrologue (XF86ConfModulePtr, XF86ConfModuleRec) - -#ifdef XFree86LOADER - elist = LoaderListDirs(esubdirs, NULL); - if (elist) { - for (el = elist; *el; el++) { - XF86LoadPtr module; - - module = xf86confmalloc(sizeof(XF86LoadRec)); - memset((XF86LoadPtr)module,0,sizeof(XF86LoadRec)); - module->load_name = *el; - /* HACK, remove GLcore, glx, loads it as a submodule */ - if (strcmp(*el, "GLcore")) - ptr->mod_load_lst = (XF86LoadPtr)xf86addListItem( - (glp)ptr->mod_load_lst, (glp)module); - } - xfree(elist); - } - - /* Process list of font backends separately to include only required ones */ - elist = LoaderListDirs(fsubdirs, NULL); - if (elist) { - for (el = elist; *el; el++) { - XF86LoadPtr module; - - module = xf86confmalloc(sizeof(XF86LoadRec)); - memset((XF86LoadPtr)module,0,sizeof(XF86LoadRec)); - module->load_name = *el; - - /* Add only those font backends which are referenced by fontpath */ - /* 'strstr(dFP,"/dir")' is meant as 'dFP =~ m(/dir\W)' */ - if (defaultFontPath && ( - (strcmp(*el, "freetype") == 0 && - strstr(defaultFontPath, "/TTF")) || - (strcmp(*el, "type1") == 0 && - strstr(defaultFontPath, "/Type1")) || - (strcmp(*el, "speedo") == 0 && - strstr(defaultFontPath, "/Speedo")))) - ptr->mod_load_lst = (XF86LoadPtr)xf86addListItem( - (glp)ptr->mod_load_lst, (glp)module); - } - xfree(elist); - } -#endif - - return ptr; -} - -static XF86ConfFilesPtr -configureFilesSection (void) -{ - parsePrologue (XF86ConfFilesPtr, XF86ConfFilesRec) - -#ifdef XFree86LOADER - if (xf86ModulePath) - ptr->file_modulepath = strdup(xf86ModulePath); -#endif - if (defaultFontPath) - ptr->file_fontpath = strdup(defaultFontPath); - if (rgbPath) - ptr->file_rgbpath = strdup(rgbPath); - - return ptr; -} - -static XF86ConfMonitorPtr -configureMonitorSection (int screennum) -{ - parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec) - - ptr->mon_identifier = xf86confmalloc(19); - sprintf(ptr->mon_identifier, "Monitor%d", screennum); - ptr->mon_vendor = strdup("Monitor Vendor"); - ptr->mon_modelname = strdup("Monitor Model"); - - return ptr; -} - -static XF86ConfMonitorPtr -configureDDCMonitorSection (int screennum) -{ - int i = 0; - int len, mon_width, mon_height; -#define displaySizeMaxLen 80 - char displaySize_string[displaySizeMaxLen]; - int displaySizeLen; - - parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec) - - ptr->mon_identifier = xf86confmalloc(19); - sprintf(ptr->mon_identifier, "Monitor%d", screennum); - ptr->mon_vendor = strdup(ConfiguredMonitor->vendor.name); - ptr->mon_modelname = xf86confmalloc(12); - sprintf(ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id); - - /* features in centimetres, we want millimetres */ - mon_width = 10 * ConfiguredMonitor->features.hsize ; - mon_height = 10 * ConfiguredMonitor->features.vsize ; - -#ifdef CONFIGURE_DISPLAYSIZE - ptr->mon_width = mon_width; - ptr->mon_height = mon_height; -#else - if (mon_width && mon_height) { - /* when values available add DisplaySize option AS A COMMENT */ - - displaySizeLen = snprintf(displaySize_string, displaySizeMaxLen, - "\t#DisplaySize\t%5d %5d\t# mm\n", - mon_width, mon_height); - - if (displaySizeLen>0 && displaySizeLenmon_comment) { - len = strlen(ptr->mon_comment); - } else { - len = 0; - } - if ((ptr->mon_comment = - xf86confrealloc(ptr->mon_comment, - len+strlen(displaySize_string)))) { - strcpy(ptr->mon_comment + len, displaySize_string); - } - } - } -#endif /* def CONFIGURE_DISPLAYSIZE */ - - for (i=0;i<4;i++) { - switch (ConfiguredMonitor->det_mon[i].type) { - case DS_NAME: - ptr->mon_modelname = xf86confrealloc(ptr->mon_modelname, - strlen((char*)(ConfiguredMonitor->det_mon[i].section.name)) - + 1); - strcpy(ptr->mon_modelname, - (char*)(ConfiguredMonitor->det_mon[i].section.name)); - break; - case DS_RANGES: - ptr->mon_hsync[ptr->mon_n_hsync].lo = - ConfiguredMonitor->det_mon[i].section.ranges.min_h; - ptr->mon_hsync[ptr->mon_n_hsync].hi = - ConfiguredMonitor->det_mon[i].section.ranges.max_h; - ptr->mon_n_vrefresh = 1; - ptr->mon_vrefresh[ptr->mon_n_hsync].lo = - ConfiguredMonitor->det_mon[i].section.ranges.min_v; - ptr->mon_vrefresh[ptr->mon_n_hsync].hi = - ConfiguredMonitor->det_mon[i].section.ranges.max_v; - ptr->mon_n_hsync++; - default: - break; - } - } - - if (ConfiguredMonitor->features.dpms) { - ptr->mon_option_lst = xf86addNewOption(ptr->mon_option_lst, "DPMS", NULL); - } - - return ptr; -} - -void -DoConfigure() -{ - int i,j, screennum = -1; - char *home = NULL; - char *filename = NULL; - XF86ConfigPtr xf86config = NULL; - char **vlist, **vl; - int *dev2screen; - - vlist = xf86DriverlistFromCompile(); - - if (!vlist) { - ErrorF("Missing output drivers. Configuration failed.\n"); - goto bail; - } - - ErrorF("List of video drivers:\n"); - for (vl = vlist; *vl; vl++) - ErrorF("\t%s\n", *vl); - -#ifdef XFree86LOADER - /* Load all the drivers that were found. */ - xf86LoadModules(vlist, NULL); -#endif /* XFree86LOADER */ - - xfree(vlist); - - for (i = 0; i < xf86NumDrivers; i++) { - xorgHWFlags flags; - if (!xf86DriverList[i]->driverFunc - || !xf86DriverList[i]->driverFunc(NULL, - GET_REQUIRED_HW_INTERFACES, - &flags) - || NEED_IO_ENABLED(flags)) { - xorgHWAccess = TRUE; - break; - } - } - /* Enable full I/O access */ - if (xorgHWAccess) { - if(!xf86EnableIO()) - /* oops, we have failed */ - xorgHWAccess = FALSE; - } - - /* Disable PCI devices */ - xf86ResourceBrokerInit(); - xf86AccessInit(); - xf86FindPrimaryDevice(); - - /* Create XF86Config file structure */ - xf86config = malloc(sizeof(XF86ConfigRec)); - memset ((XF86ConfigPtr)xf86config, 0, sizeof(XF86ConfigRec)); - xf86config->conf_device_lst = NULL; - xf86config->conf_screen_lst = NULL; - xf86config->conf_monitor_lst = NULL; - - /* Call all of the probe functions, reporting the results. */ - for (CurrentDriver = 0; CurrentDriver < xf86NumDrivers; CurrentDriver++) { - xorgHWFlags flags; - - if (!xorgHWAccess) { - if (!xf86DriverList[CurrentDriver]->driverFunc - || !xf86DriverList[CurrentDriver]->driverFunc(NULL, - GET_REQUIRED_HW_INTERFACES, - &flags) - || NEED_IO_ENABLED(flags)) - continue; - } - - if (xf86DriverList[CurrentDriver]->Probe == NULL) continue; - - if ((*xf86DriverList[CurrentDriver]->Probe)( - xf86DriverList[CurrentDriver], PROBE_DETECT) && - xf86DriverList[CurrentDriver]->Identify) - (*xf86DriverList[CurrentDriver]->Identify)(0); - } - - if (nDevToConfig <= 0) { - ErrorF("No devices to configure. Configuration failed.\n"); - goto bail; - } - - /* Add device, monitor and screen sections for detected devices */ - for (screennum = 0; screennum < nDevToConfig; screennum++) { - XF86ConfDevicePtr DevicePtr; - XF86ConfMonitorPtr MonitorPtr; - XF86ConfScreenPtr ScreenPtr; - - DevicePtr = configureDeviceSection(screennum); - xf86config->conf_device_lst = (XF86ConfDevicePtr)xf86addListItem( - (glp)xf86config->conf_device_lst, (glp)DevicePtr); - MonitorPtr = configureMonitorSection(screennum); - xf86config->conf_monitor_lst = (XF86ConfMonitorPtr)xf86addListItem( - (glp)xf86config->conf_monitor_lst, (glp)MonitorPtr); - ScreenPtr = configureScreenSection(screennum); - xf86config->conf_screen_lst = (XF86ConfScreenPtr)xf86addListItem( - (glp)xf86config->conf_screen_lst, (glp)ScreenPtr); - } - - xf86config->conf_files = configureFilesSection(); - xf86config->conf_modules = configureModuleSection(); - xf86config->conf_flags = configureFlagsSection(); - xf86config->conf_videoadaptor_lst = configureVideoAdaptorSection(); - xf86config->conf_modes_lst = configureModesSection(); - xf86config->conf_vendor_lst = configureVendorSection(); - xf86config->conf_dri = configureDRISection(); - xf86config->conf_input_lst = configureInputSection(); - xf86config->conf_layout_lst = configureLayoutSection(); - - if (!(home = getenv("HOME"))) - home = "/"; - { -#ifdef __UNIXOS2__ -#define PATH_MAX 2048 -#endif -#if !defined(PATH_MAX) -#define PATH_MAX 1024 -#endif - const char* configfile = XF86CONFIGFILE".new"; - char homebuf[PATH_MAX]; - /* getenv might return R/O memory, as with OS/2 */ - strncpy(homebuf,home,PATH_MAX-1); - homebuf[PATH_MAX-1] = '\0'; - home = homebuf; - if (!(filename = - (char *)ALLOCATE_LOCAL(strlen(home) + - strlen(configfile) + 3))) - - if (home[0] == '/' && home[1] == '\0') - home[0] = '\0'; -#ifndef QNX4 - sprintf(filename, "%s/%s", home,configfile); -#else - sprintf(filename, "//%d%s/%s", getnid(),home,configfile); -#endif - - } - - xf86writeConfigFile(filename, xf86config); - - xf86DoConfigurePass1 = FALSE; - /* Try to get DDC information filled in */ - xf86ConfigFile = filename; - if (xf86HandleConfigFile(FALSE) != CONFIG_OK) { - goto bail; - } - - xf86DoConfigurePass1 = FALSE; - - dev2screen = xnfcalloc(1,xf86NumDrivers*sizeof(int)); - - { - Bool *driverProbed = xnfcalloc(1,xf86NumDrivers*sizeof(Bool)); - for (screennum = 0; screennum < nDevToConfig; screennum++) { - int k,l,n,oldNumScreens; - - i = DevToConfig[screennum].iDriver; - - if (driverProbed[i]) continue; - driverProbed[i] = TRUE; - - oldNumScreens = xf86NumScreens; - - (*xf86DriverList[i]->Probe)(xf86DriverList[i], 0); - - /* reorder */ - k = screennum > 0 ? screennum : 1; - for (l = oldNumScreens; l < xf86NumScreens; l++) { - /* is screen primary? */ - Bool primary = FALSE; - for (n = 0; nnumEntities; n++) { - if (xf86IsEntityPrimary(xf86Screens[l]->entityList[n])) { - dev2screen[0] = l; - primary = TRUE; - break; - } - } - if (primary) continue; - /* not primary: assign it to next device of same driver */ - /* - * NOTE: we assume that devices in DevToConfig - * and xf86Screens[] have the same order except - * for the primary device which always comes first. - */ - for (; k < nDevToConfig; k++) { - if (DevToConfig[k].iDriver == i) { - dev2screen[k++] = l; - break; - } - } - } - xf86SetPciVideo(NULL,NONE); - } - xfree(driverProbed); - } - - - if (nDevToConfig != xf86NumScreens) { - ErrorF("Number of created screens does not match number of detected" - " devices.\n Configuration failed.\n"); - goto bail; - } - - xf86PostProbe(); - xf86EntityInit(); - - for (j = 0; j < xf86NumScreens; j++) { - xf86Screens[j]->scrnIndex = j; - } - - xf86freeMonitorList(xf86config->conf_monitor_lst); - xf86config->conf_monitor_lst = NULL; - xf86freeScreenList(xf86config->conf_screen_lst); - xf86config->conf_screen_lst = NULL; - for (j = 0; j < xf86NumScreens; j++) { - XF86ConfMonitorPtr MonitorPtr; - XF86ConfScreenPtr ScreenPtr; - - ConfiguredMonitor = NULL; - - xf86EnableAccess(xf86Screens[dev2screen[j]]); - if ((*xf86Screens[dev2screen[j]]->PreInit)(xf86Screens[dev2screen[j]], - PROBE_DETECT) && - ConfiguredMonitor) { - MonitorPtr = configureDDCMonitorSection(j); - } else { - MonitorPtr = configureMonitorSection(j); - } - ScreenPtr = configureScreenSection(j); - xf86config->conf_monitor_lst = (XF86ConfMonitorPtr)xf86addListItem( - (glp)xf86config->conf_monitor_lst, (glp)MonitorPtr); - xf86config->conf_screen_lst = (XF86ConfScreenPtr)xf86addListItem( - (glp)xf86config->conf_screen_lst, (glp)ScreenPtr); - } - - xf86writeConfigFile(filename, xf86config); - - ErrorF("\n"); - -#ifdef __SCO__ - ErrorF("\n"__XSERVERNAME__ - " is using the kernel event driver to access the mouse.\n" - "If you wish to use the internal "__XSERVERNAME__ - " mouse drivers, please\n" - "edit the file and correct the Device.\n"); -#else /* !__SCO__ */ - if (!foundMouse) { - ErrorF("\n"__XSERVERNAME__" is not able to detect your mouse.\n" - "Edit the file and correct the Device.\n"); - } else { -#ifndef __UNIXOS2__ /* OS/2 definitely has a mouse */ - ErrorF("\n"__XSERVERNAME__" detected your mouse at device %s.\n" - "Please check your config if the mouse is still not\n" - "operational, as by default "__XSERVERNAME__ - " tries to autodetect\n" - "the protocol.\n",DFLT_MOUSE_DEV); -#endif - } -#endif /* !__SCO__ */ - - if (xf86NumScreens > 1) { - ErrorF("\n"__XSERVERNAME__ - " has configured a multihead system, please check your config.\n"); - } - - ErrorF("\nYour %s file is %s\n\n", XF86CONFIGFILE ,filename); - ErrorF("To test the server, run 'X -config %s'\n\n", filename); - -bail: - OsCleanup(TRUE); - AbortDDX(); - fflush(stderr); - exit(0); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Cursor.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Cursor.c deleted file mode 100644 index 0e2d77492..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Cursor.c +++ /dev/null @@ -1,788 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c,v 3.37 2003/11/07 22:20:17 dawes Exp $ */ -/* - * Copyright (c) 1994-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* $XConsortium: xf86Cursor.c /main/10 1996/10/19 17:58:23 kaleb $ */ - -#define NEED_EVENTS -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "input.h" -#include "cursor.h" -#include "mipointer.h" -#include "scrnintstr.h" -#include "globals.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSproc.h" - -#ifdef XINPUT -#include -#include "xf86Xinput.h" -#endif - -#ifdef XFreeXDGA -#include "dgaproc.h" -#endif - -typedef struct _xf86EdgeRec { - short screen; - short start; - short end; - DDXPointRec offset; - struct _xf86EdgeRec *next; -} xf86EdgeRec, *xf86EdgePtr; - -typedef struct { - xf86EdgePtr left, right, up, down; -} xf86ScreenLayoutRec, *xf86ScreenLayoutPtr; - -static Bool xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y); -static void xf86CrossScreen(ScreenPtr pScreen, Bool entering); -static void xf86WarpCursor(ScreenPtr pScreen, int x, int y); - -static void xf86PointerMoved(int scrnIndex, int x, int y); - -static miPointerScreenFuncRec xf86PointerScreenFuncs = { - xf86CursorOffScreen, - xf86CrossScreen, - xf86WarpCursor, -#ifdef XINPUT - xf86eqEnqueue, - xf86eqSwitchScreen -#else - /* let miPointerInitialize take care of these */ - NULL, - NULL -#endif -}; - -static xf86ScreenLayoutRec xf86ScreenLayout[MAXSCREENS]; - -static Bool HardEdges; - -/* - * xf86InitViewport -- - * Initialize paning & zooming parameters, so that a driver must only - * check what resolutions are possible and whether the virtual area - * is valid if specified. - */ - -void -xf86InitViewport(ScrnInfoPtr pScr) -{ - - pScr->PointerMoved = xf86PointerMoved; - - /* - * Compute the initial Viewport if necessary - */ - if (pScr->display) { - if (pScr->display->frameX0 < 0) { - pScr->frameX0 = (pScr->virtualX - pScr->modes->HDisplay) / 2; - pScr->frameY0 = (pScr->virtualY - pScr->modes->VDisplay) / 2; - } else { - pScr->frameX0 = pScr->display->frameX0; - pScr->frameY0 = pScr->display->frameY0; - } - } - - pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1; - pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1; - - /* - * Now adjust the initial Viewport, so it lies within the virtual area - */ - if (pScr->frameX1 >= pScr->virtualX) - { - pScr->frameX0 = pScr->virtualX - pScr->modes->HDisplay; - pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1; - } - - if (pScr->frameY1 >= pScr->virtualY) - { - pScr->frameY0 = pScr->virtualY - pScr->modes->VDisplay; - pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1; - } -} - - -/* - * xf86SetViewport -- - * Scroll the visual part of the screen so the pointer is visible. - */ - -void -xf86SetViewport(ScreenPtr pScreen, int x, int y) -{ - ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); - - (*pScr->PointerMoved)(pScreen->myNum, x, y); -} - - -static void -xf86PointerMoved(int scrnIndex, int x, int y) -{ - Bool frameChanged = FALSE; - ScrnInfoPtr pScr = xf86Screens[scrnIndex]; - - /* - * check wether (x,y) belongs to the visual part of the screen - * if not, change the base of the displayed frame accoring - */ - if ( pScr->frameX0 > x) { - pScr->frameX0 = x; - pScr->frameX1 = x + pScr->currentMode->HDisplay - 1; - frameChanged = TRUE ; - } - - if ( pScr->frameX1 < x) { - pScr->frameX1 = x + 1; - pScr->frameX0 = x - pScr->currentMode->HDisplay + 1; - frameChanged = TRUE ; - } - - if ( pScr->frameY0 > y) { - pScr->frameY0 = y; - pScr->frameY1 = y + pScr->currentMode->VDisplay - 1; - frameChanged = TRUE; - } - - if ( pScr->frameY1 < y) { - pScr->frameY1 = y; - pScr->frameY0 = y - pScr->currentMode->VDisplay + 1; - frameChanged = TRUE; - } - - if (frameChanged && pScr->AdjustFrame != NULL) - pScr->AdjustFrame(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0); -} - -/* - * xf86LockZoom -- - * Enable/disable ZoomViewport - */ - -void -xf86LockZoom(ScreenPtr pScreen, Bool lock) -{ - XF86SCRNINFO(pScreen)->zoomLocked = lock; -} - -/* - * xf86SwitchMode -- - * This is called by both keyboard processing and the VidMode extension to - * set a new mode. - */ - -Bool -xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) -{ - ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); - ScreenPtr pCursorScreen; - Bool Switched; - int px, py; - - if (!pScr->vtSema || !mode || !pScr->SwitchMode) - return FALSE; - -#ifdef XFreeXDGA - if (DGAActive(pScr->scrnIndex)) - return FALSE; -#endif - - if (mode == pScr->currentMode) - return TRUE; - - if (mode->HDisplay > pScr->virtualX || mode->VDisplay > pScr->virtualY) - return FALSE; - - pCursorScreen = miPointerCurrentScreen(); - if (pScreen == pCursorScreen) - miPointerPosition(&px, &py); - - xf86EnterServerState(SETUP); - Switched = (*pScr->SwitchMode)(pScr->scrnIndex, mode, 0); - xf86EnterServerState(OPERATING); - if (Switched) { - pScr->currentMode = mode; - - /* - * Adjust frame for new display size. - */ - if (pScreen == pCursorScreen) - pScr->frameX0 = px - (mode->HDisplay / 2) + 1; - else - pScr->frameX0 = (pScr->frameX0 + pScr->frameX1 + 1 - mode->HDisplay) / 2; - - if (pScr->frameX0 < 0) - pScr->frameX0 = 0; - - pScr->frameX1 = pScr->frameX0 + mode->HDisplay - 1; - if (pScr->frameX1 >= pScr->virtualX) { - pScr->frameX0 = pScr->virtualX - mode->HDisplay; - pScr->frameX1 = pScr->virtualX - 1; - } - - if (pScreen == pCursorScreen) - pScr->frameY0 = py - (mode->VDisplay / 2) + 1; - else - pScr->frameY0 = (pScr->frameY0 + pScr->frameY1 + 1 - mode->VDisplay) / 2; - - if (pScr->frameY0 < 0) - pScr->frameY0 = 0; - - pScr->frameY1 = pScr->frameY0 + mode->VDisplay - 1; - if (pScr->frameY1 >= pScr->virtualY) { - pScr->frameY0 = pScr->virtualY - mode->VDisplay; - pScr->frameY1 = pScr->virtualY - 1; - } - } - - if (pScr->AdjustFrame) - (*pScr->AdjustFrame)(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0); - - if (pScreen == pCursorScreen) - xf86WarpCursor(pScreen, px, py); - - return Switched; -} - -/* - * xf86ZoomViewport -- - * Reinitialize the visual part of the screen for another mode. - */ - -void -xf86ZoomViewport(ScreenPtr pScreen, int zoom) -{ - ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); - DisplayModePtr mode; - - if (pScr->zoomLocked || !(mode = pScr->currentMode)) - return; - - do { - if (zoom > 0) - mode = mode->next; - else - mode = mode->prev; - } while (mode != pScr->currentMode && !(mode->type & M_T_USERDEF)); - - (void)xf86SwitchMode(pScreen, mode); -} - - -static xf86EdgePtr -FindEdge(xf86EdgePtr edge, int val) -{ - while(edge && (edge->end <= val)) - edge = edge->next; - - if(edge && (edge->start <= val)) - return edge; - - return NULL; -} - -/* - * xf86CursorOffScreen -- - * Check whether it is necessary to switch to another screen - */ - -static Bool -xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y) -{ - xf86EdgePtr edge; - int tmp; - - if(screenInfo.numScreens == 1) - return FALSE; - - if(*x < 0) { - tmp = *y; - if(tmp < 0) tmp = 0; - if(tmp >= (*pScreen)->height) tmp = (*pScreen)->height - 1; - - if((edge = xf86ScreenLayout[(*pScreen)->myNum].left)) - edge = FindEdge(edge, tmp); - - if(!edge) *x = 0; - else { - *x += edge->offset.x; - *y += edge->offset.y; - *pScreen = xf86Screens[edge->screen]->pScreen; - } - } - - if(*x >= (*pScreen)->width) { - tmp = *y; - if(tmp < 0) tmp = 0; - if(tmp >= (*pScreen)->height) tmp = (*pScreen)->height - 1; - - if((edge = xf86ScreenLayout[(*pScreen)->myNum].right)) - edge = FindEdge(edge, tmp); - - if(!edge) *x = (*pScreen)->width - 1; - else { - *x += edge->offset.x; - *y += edge->offset.y; - *pScreen = xf86Screens[edge->screen]->pScreen; - } - } - - if(*y < 0) { - tmp = *x; - if(tmp < 0) tmp = 0; - if(tmp >= (*pScreen)->width) tmp = (*pScreen)->width - 1; - - if((edge = xf86ScreenLayout[(*pScreen)->myNum].up)) - edge = FindEdge(edge, tmp); - - if(!edge) *y = 0; - else { - *x += edge->offset.x; - *y += edge->offset.y; - *pScreen = xf86Screens[edge->screen]->pScreen; - } - } - - if(*y >= (*pScreen)->height) { - tmp = *x; - if(tmp < 0) tmp = 0; - if(tmp >= (*pScreen)->width) tmp = (*pScreen)->width - 1; - - if((edge = xf86ScreenLayout[(*pScreen)->myNum].down)) - edge = FindEdge(edge, tmp); - - if(!edge) *y = (*pScreen)->height - 1; - else { - *x += edge->offset.x; - *y += edge->offset.y; - (*pScreen) = xf86Screens[edge->screen]->pScreen; - } - } - - -#if 0 - /* This presents problems for overlapping screens when - HardEdges is used. Have to think about the logic more */ - if((*x < 0) || (*x >= (*pScreen)->width) || - (*y < 0) || (*y >= (*pScreen)->height)) { - /* We may have crossed more than one screen */ - xf86CursorOffScreen(pScreen, x, y); - } -#endif - - return TRUE; -} - - - -/* - * xf86CrossScreen -- - * Switch to another screen - */ - -/* NEED TO CHECK THIS */ -/* ARGSUSED */ -static void -xf86CrossScreen (ScreenPtr pScreen, Bool entering) -{ -#if 0 - if (xf86Info.sharedMonitor) - (XF86SCRNINFO(pScreen)->EnterLeaveMonitor)(entering); - (XF86SCRNINFO(pScreen)->EnterLeaveCursor)(entering); -#endif -} - - -/* - * xf86WarpCursor -- - * Warp possible to another screen - */ - -/* ARGSUSED */ -static void -xf86WarpCursor (ScreenPtr pScreen, int x, int y) -{ - int sigstate; - sigstate = xf86BlockSIGIO (); - miPointerWarpCursor(pScreen,x,y); - - xf86Info.currentScreen = pScreen; - xf86UnblockSIGIO (sigstate); -} - - -void * -xf86GetPointerScreenFuncs(void) -{ - return (void *)&xf86PointerScreenFuncs; -} - - -static xf86EdgePtr -AddEdge( - xf86EdgePtr edge, - short min, - short max, - short dx, - short dy, - short screen -){ - xf86EdgePtr pEdge = edge, pPrev = NULL, pNew; - - while(1) { - while(pEdge && (min >= pEdge->end)) { - pPrev = pEdge; - pEdge = pEdge->next; - } - - if(!pEdge) { - if(!(pNew = xalloc(sizeof(xf86EdgeRec)))) - break; - - pNew->screen = screen; - pNew->start = min; - pNew->end = max; - pNew->offset.x = dx; - pNew->offset.y = dy; - pNew->next = NULL; - - if(pPrev) - pPrev->next = pNew; - else - edge = pNew; - - break; - } else if (min < pEdge->start) { - if(!(pNew = xalloc(sizeof(xf86EdgeRec)))) - break; - - pNew->screen = screen; - pNew->start = min; - pNew->offset.x = dx; - pNew->offset.y = dy; - pNew->next = pEdge; - - if(pPrev) pPrev->next = pNew; - else edge = pNew; - - if(max <= pEdge->start) { - pNew->end = max; - break; - } else { - pNew->end = pEdge->start; - min = pEdge->end; - } - } else - min = pEdge->end; - - pPrev = pEdge; - pEdge = pEdge->next; - - if(max <= min) break; - } - - return edge; -} - -static void -FillOutEdge(xf86EdgePtr pEdge, int limit) -{ - xf86EdgePtr pNext; - int diff; - - if(pEdge->start > 0) pEdge->start = 0; - - while((pNext = pEdge->next)) { - diff = pNext->start - pEdge->end; - if(diff > 0) { - pEdge->end += diff >> 1; - pNext->start -= diff - (diff >> 1); - } - pEdge = pNext; - } - - if(pEdge->end < limit) - pEdge->end = limit; -} - -/* - * xf86InitOrigins() can deal with a maximum of 32 screens - * on 32 bit architectures, 64 on 64 bit architectures. - */ - -void -xf86InitOrigins(void) -{ - unsigned long screensLeft, prevScreensLeft, mask; - screenLayoutPtr screen; - ScreenPtr pScreen; - int x1, x2, y1, y2, left, right, top, bottom; - int i, j, ref, minX, minY, min, max; - xf86ScreenLayoutPtr pLayout; - Bool OldStyleConfig = FALSE; - - /* need to have this set up with a config file option */ - HardEdges = FALSE; - - bzero(xf86ScreenLayout, MAXSCREENS * sizeof(xf86ScreenLayoutRec)); - - screensLeft = prevScreensLeft = (1 << xf86NumScreens) - 1; - - while(1) { - for(mask = screensLeft, i = 0; mask; mask >>= 1, i++) { - if(!(mask & 1L)) continue; - - screen = &xf86ConfigLayout.screens[i]; - - switch(screen->where) { - case PosObsolete: - OldStyleConfig = TRUE; - pLayout = &xf86ScreenLayout[i]; - /* force edge lists */ - if(screen->left) { - ref = screen->left->screennum; - pLayout->left = AddEdge(pLayout->left, - 0, xf86Screens[i]->pScreen->height, - xf86Screens[ref]->pScreen->width, 0, ref); - } - if(screen->right) { - ref = screen->right->screennum; - pScreen = xf86Screens[i]->pScreen; - pLayout->right = AddEdge(pLayout->right, - 0, pScreen->height, -pScreen->width, 0, ref); - } - if(screen->top) { - ref = screen->top->screennum; - pLayout->up = AddEdge(pLayout->up, - 0, xf86Screens[i]->pScreen->width, - 0, xf86Screens[ref]->pScreen->height, ref); - } - if(screen->bottom) { - ref = screen->bottom->screennum; - pScreen = xf86Screens[i]->pScreen; - pLayout->down = AddEdge(pLayout->down, - 0, pScreen->width, 0, -pScreen->height, ref); - } - /* we could also try to place it based on those - relative locations if we wanted to */ - screen->x = screen->y = 0; - /* FALLTHROUGH */ - case PosAbsolute: - dixScreenOrigins[i].x = screen->x; - dixScreenOrigins[i].y = screen->y; - screensLeft &= ~(1 << i); - break; - case PosRelative: - ref = screen->refscreen->screennum; - if(screensLeft & (1 << ref)) break; - dixScreenOrigins[i].x = dixScreenOrigins[ref].x + screen->x; - dixScreenOrigins[i].y = dixScreenOrigins[ref].y + screen->y; - screensLeft &= ~(1 << i); - break; - case PosRightOf: - ref = screen->refscreen->screennum; - if(screensLeft & (1 << ref)) break; - pScreen = xf86Screens[ref]->pScreen; - dixScreenOrigins[i].x = - dixScreenOrigins[ref].x + pScreen->width; - dixScreenOrigins[i].y = dixScreenOrigins[ref].y; - screensLeft &= ~(1 << i); - break; - case PosLeftOf: - ref = screen->refscreen->screennum; - if(screensLeft & (1 << ref)) break; - pScreen = xf86Screens[i]->pScreen; - dixScreenOrigins[i].x = - dixScreenOrigins[ref].x - pScreen->width; - dixScreenOrigins[i].y = dixScreenOrigins[ref].y; - screensLeft &= ~(1 << i); - break; - case PosBelow: - ref = screen->refscreen->screennum; - if(screensLeft & (1 << ref)) break; - pScreen = xf86Screens[ref]->pScreen; - dixScreenOrigins[i].x = dixScreenOrigins[ref].x; - dixScreenOrigins[i].y = - dixScreenOrigins[ref].y + pScreen->height; - screensLeft &= ~(1 << i); - break; - case PosAbove: - ref = screen->refscreen->screennum; - if(screensLeft & (1 << ref)) break; - pScreen = xf86Screens[i]->pScreen; - dixScreenOrigins[i].x = dixScreenOrigins[ref].x; - dixScreenOrigins[i].y = - dixScreenOrigins[ref].y - pScreen->height; - screensLeft &= ~(1 << i); - break; - default: - ErrorF("Illegal placement keyword in Layout!\n"); - break; - } - - } - - if(!screensLeft) break; - - if(screensLeft == prevScreensLeft) { - /* All the remaining screens are referencing each other. - Assign a value to one of them and go through again */ - i = 0; - while(!((1 << i) & screensLeft)){ i++; } - - ref = xf86ConfigLayout.screens[i].refscreen->screennum; - dixScreenOrigins[ref].x = dixScreenOrigins[ref].y = 0; - screensLeft &= ~(1 << ref); - } - - prevScreensLeft = screensLeft; - } - - /* justify the topmost and leftmost to (0,0) */ - minX = dixScreenOrigins[0].x; - minY = dixScreenOrigins[0].y; - - for(i = 1; i < xf86NumScreens; i++) { - if(dixScreenOrigins[i].x < minX) - minX = dixScreenOrigins[i].x; - if(dixScreenOrigins[i].y < minY) - minY = dixScreenOrigins[i].y; - } - - if (minX || minY) { - for(i = 0; i < xf86NumScreens; i++) { - dixScreenOrigins[i].x -= minX; - dixScreenOrigins[i].y -= minY; - } - } - - - /* Create the edge lists */ - - if(!OldStyleConfig) { - for(i = 0; i < xf86NumScreens; i++) { - pLayout = &xf86ScreenLayout[i]; - - pScreen = xf86Screens[i]->pScreen; - - left = dixScreenOrigins[i].x; - right = left + pScreen->width; - top = dixScreenOrigins[i].y; - bottom = top + pScreen->height; - - for(j = 0; j < xf86NumScreens; j++) { - if(i == j) continue; - - x1 = dixScreenOrigins[j].x; - x2 = x1 + xf86Screens[j]->pScreen->width; - y1 = dixScreenOrigins[j].y; - y2 = y1 + xf86Screens[j]->pScreen->height; - - if((bottom > y1) && (top < y2)) { - min = y1 - top; - if(min < 0) min = 0; - max = pScreen->height - (bottom - y2); - if(max > pScreen->height) max = pScreen->height; - - if(((left - 1) >= x1) && ((left - 1) < x2)) - pLayout->left = AddEdge(pLayout->left, min, max, - dixScreenOrigins[i].x - dixScreenOrigins[j].x, - dixScreenOrigins[i].y - dixScreenOrigins[j].y, j); - - if((right >= x1) && (right < x2)) - pLayout->right = AddEdge(pLayout->right, min, max, - dixScreenOrigins[i].x - dixScreenOrigins[j].x, - dixScreenOrigins[i].y - dixScreenOrigins[j].y, j); - } - - - if((left < x2) && (right > x1)) { - min = x1 - left; - if(min < 0) min = 0; - max = pScreen->width - (right - x2); - if(max > pScreen->width) max = pScreen->width; - - if(((top - 1) >= y1) && ((top - 1) < y2)) - pLayout->up = AddEdge(pLayout->up, min, max, - dixScreenOrigins[i].x - dixScreenOrigins[j].x, - dixScreenOrigins[i].y - dixScreenOrigins[j].y, j); - - if((bottom >= y1) && (bottom < y2)) - pLayout->down = AddEdge(pLayout->down, min, max, - dixScreenOrigins[i].x - dixScreenOrigins[j].x, - dixScreenOrigins[i].y - dixScreenOrigins[j].y, j); - } - } - } - } - - if(!HardEdges && !OldStyleConfig) { - for(i = 0; i < xf86NumScreens; i++) { - pLayout = &xf86ScreenLayout[i]; - pScreen = xf86Screens[i]->pScreen; - if(pLayout->left) - FillOutEdge(pLayout->left, pScreen->height); - if(pLayout->right) - FillOutEdge(pLayout->right, pScreen->height); - if(pLayout->up) - FillOutEdge(pLayout->up, pScreen->width); - if(pLayout->down) - FillOutEdge(pLayout->down, pScreen->width); - } - } -} - -void -xf86ReconfigureLayout(void) -{ - int i; - - for (i = 0; i < MAXSCREENS; i++) { - xf86ScreenLayoutPtr sl = &xf86ScreenLayout[i]; - /* we don't have to zero these, xf86InitOrigins() takes care of that */ - if (sl->left) xfree(sl->left); - if (sl->right) xfree(sl->right); - if (sl->up) xfree(sl->up); - if (sl->down) xfree(sl->down); - } - - xf86InitOrigins(); -} - - diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86DGA.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86DGA.c deleted file mode 100644 index a213e39e2..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86DGA.c +++ /dev/null @@ -1,1267 +0,0 @@ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c,v 1.7 2005/11/08 03:12:43 alanc Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c,v 1.46 2002/12/03 18:17:40 tsi Exp $ */ -/* - * Copyright (c) 1998-2002 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - * - * Written by Mark Vojkovich - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86.h" -#include "xf86str.h" -#include "xf86Priv.h" -#include "dgaproc.h" -#include -#include "colormapst.h" -#include "pixmapstr.h" -#include "inputstr.h" -#include "globals.h" -#include "servermd.h" -#include "micmap.h" -#ifdef XKB -#include -#endif -#include "xf86Xinput.h" - -static unsigned long DGAGeneration = 0; -static int DGAScreenIndex = -1; - -static Bool DGACloseScreen(int i, ScreenPtr pScreen); -static void DGADestroyColormap(ColormapPtr pmap); -static void DGAInstallColormap(ColormapPtr pmap); -static void DGAUninstallColormap(ColormapPtr pmap); - -static void -DGACopyModeInfo( - DGAModePtr mode, - XDGAModePtr xmode -); - -#if defined(XFree86LOADER) || !defined(XFreeXDGA) -int *XDGAEventBase = NULL; -#else -int *XDGAEventBase = &DGAEventBase; -#endif - -#define DGA_GET_SCREEN_PRIV(pScreen) \ - ((DGAScreenPtr)((pScreen)->devPrivates[DGAScreenIndex].ptr)) - - -typedef struct _FakedVisualList{ - Bool free; - VisualPtr pVisual; - struct _FakedVisualList *next; -} FakedVisualList; - - -typedef struct { - ScrnInfoPtr pScrn; - int numModes; - DGAModePtr modes; - CloseScreenProcPtr CloseScreen; - DestroyColormapProcPtr DestroyColormap; - InstallColormapProcPtr InstallColormap; - UninstallColormapProcPtr UninstallColormap; - DGADevicePtr current; - DGAFunctionPtr funcs; - int input; - ClientPtr client; - int pixmapMode; - FakedVisualList *fakedVisuals; - ColormapPtr dgaColormap; - ColormapPtr savedColormap; - Bool grabMouse; - Bool grabKeyboard; -} DGAScreenRec, *DGAScreenPtr; - - -Bool -DGAInit( - ScreenPtr pScreen, - DGAFunctionPtr funcs, - DGAModePtr modes, - int num -){ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - DGAScreenPtr pScreenPriv; - int i; - - if(!funcs || !funcs->SetMode || !funcs->OpenFramebuffer) - return FALSE; - - if(!modes || num <= 0) - return FALSE; - - if(DGAGeneration != serverGeneration) { - if((DGAScreenIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - DGAGeneration = serverGeneration; - } - - if(!(pScreenPriv = (DGAScreenPtr)xalloc(sizeof(DGAScreenRec)))) - return FALSE; - - pScreenPriv->pScrn = pScrn; - pScreenPriv->numModes = num; - pScreenPriv->modes = modes; - pScreenPriv->current = NULL; - - pScreenPriv->funcs = funcs; - pScreenPriv->input = 0; - pScreenPriv->client = NULL; - pScreenPriv->fakedVisuals = NULL; - pScreenPriv->dgaColormap = NULL; - pScreenPriv->savedColormap = NULL; - pScreenPriv->grabMouse = FALSE; - pScreenPriv->grabKeyboard = FALSE; - - for(i = 0; i < num; i++) - modes[i].num = i + 1; - -#ifdef PANORAMIX - if(!noPanoramiXExtension) - for(i = 0; i < num; i++) - modes[i].flags &= ~DGA_PIXMAP_AVAILABLE; -#endif - - - pScreen->devPrivates[DGAScreenIndex].ptr = (pointer)pScreenPriv; - pScreenPriv->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = DGACloseScreen; - pScreenPriv->DestroyColormap = pScreen->DestroyColormap; - pScreen->DestroyColormap = DGADestroyColormap; - pScreenPriv->InstallColormap = pScreen->InstallColormap; - pScreen->InstallColormap = DGAInstallColormap; - pScreenPriv->UninstallColormap = pScreen->UninstallColormap; - pScreen->UninstallColormap = DGAUninstallColormap; - - /* - * This is now set in InitOutput(). - * - pScrn->SetDGAMode = xf86SetDGAMode; - */ - - return TRUE; -} - -/* DGAReInitModes allows the driver to re-initialize - * the DGA mode list. - */ - -Bool -DGAReInitModes( - ScreenPtr pScreen, - DGAModePtr modes, - int num -){ - DGAScreenPtr pScreenPriv; - int i; - - /* No DGA? Ignore call (but don't make it look like it failed) */ - if(DGAScreenIndex < 0) - return TRUE; - - pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - - /* Same as above */ - if(!pScreenPriv) - return TRUE; - - /* Can't do this while DGA is active */ - if(pScreenPriv->current) - return FALSE; - - /* Quick sanity check */ - if(!num) - modes = NULL; - else if(!modes) - num = 0; - - pScreenPriv->numModes = num; - pScreenPriv->modes = modes; - - /* This practically disables DGA. So be it. */ - if(!num) - return TRUE; - - for(i = 0; i < num; i++) - modes[i].num = i + 1; - -#ifdef PANORAMIX - if(!noPanoramiXExtension) - for(i = 0; i < num; i++) - modes[i].flags &= ~DGA_PIXMAP_AVAILABLE; -#endif - - return TRUE; -} - -static void -FreeMarkedVisuals(ScreenPtr pScreen) -{ - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - FakedVisualList *prev, *curr, *tmp; - - if(!pScreenPriv->fakedVisuals) - return; - - prev = NULL; - curr = pScreenPriv->fakedVisuals; - - while(curr) { - if(curr->free) { - tmp = curr; - curr = curr->next; - if(prev) - prev->next = curr; - else - pScreenPriv->fakedVisuals = curr; - xfree(tmp->pVisual); - xfree(tmp); - } else { - prev = curr; - curr = curr->next; - } - } -} - - -static Bool -DGACloseScreen(int i, ScreenPtr pScreen) -{ - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - - FreeMarkedVisuals(pScreen); - - pScreen->CloseScreen = pScreenPriv->CloseScreen; - pScreen->DestroyColormap = pScreenPriv->DestroyColormap; - pScreen->InstallColormap = pScreenPriv->InstallColormap; - pScreen->UninstallColormap = pScreenPriv->UninstallColormap; - - /* DGAShutdown() should have ensured that no DGA - screen were active by here */ - - xfree(pScreenPriv); - - return((*pScreen->CloseScreen)(i, pScreen)); -} - - -static void -DGADestroyColormap(ColormapPtr pmap) -{ - ScreenPtr pScreen = pmap->pScreen; - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - VisualPtr pVisual = pmap->pVisual; - - if(pScreenPriv->fakedVisuals) { - FakedVisualList *curr = pScreenPriv->fakedVisuals; - - while(curr) { - if(curr->pVisual == pVisual) { - /* We can't get rid of them yet since FreeColormap - still needs the pVisual during the cleanup */ - curr->free = TRUE; - break; - } - curr = curr->next; - } - } - - if(pScreenPriv->DestroyColormap) { - pScreen->DestroyColormap = pScreenPriv->DestroyColormap; - (*pScreen->DestroyColormap)(pmap); - pScreen->DestroyColormap = DGADestroyColormap; - } -} - - -static void -DGAInstallColormap(ColormapPtr pmap) -{ - ScreenPtr pScreen = pmap->pScreen; - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - - if(pScreenPriv->current && pScreenPriv->dgaColormap) { - if (pmap != pScreenPriv->dgaColormap) { - pScreenPriv->savedColormap = pmap; - pmap = pScreenPriv->dgaColormap; - } - } - - pScreen->InstallColormap = pScreenPriv->InstallColormap; - (*pScreen->InstallColormap)(pmap); - pScreen->InstallColormap = DGAInstallColormap; -} - -static void -DGAUninstallColormap(ColormapPtr pmap) -{ - ScreenPtr pScreen = pmap->pScreen; - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - - if(pScreenPriv->current && pScreenPriv->dgaColormap) { - if (pmap == pScreenPriv->dgaColormap) { - pScreenPriv->dgaColormap = NULL; - } - } - - pScreen->UninstallColormap = pScreenPriv->UninstallColormap; - (*pScreen->UninstallColormap)(pmap); - pScreen->UninstallColormap = DGAUninstallColormap; -} - -int -xf86SetDGAMode( - int index, - int num, - DGADevicePtr devRet -){ - ScreenPtr pScreen = screenInfo.screens[index]; - DGAScreenPtr pScreenPriv; - ScrnInfoPtr pScrn; - DGADevicePtr device; - PixmapPtr pPix = NULL; - DGAModePtr pMode = NULL; - - /* First check if DGAInit was successful on this screen */ - if (DGAScreenIndex < 0) - return BadValue; - pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - if (!pScreenPriv) - return BadValue; - pScrn = pScreenPriv->pScrn; - - if(!num) { - if(pScreenPriv->current) { - PixmapPtr oldPix = pScreenPriv->current->pPix; - if(oldPix) { - if(oldPix->drawable.id) - FreeResource(oldPix->drawable.id, RT_NONE); - else - (*pScreen->DestroyPixmap)(oldPix); - } - xfree(pScreenPriv->current); - pScreenPriv->current = NULL; - pScrn->vtSema = TRUE; - (*pScreenPriv->funcs->SetMode)(pScrn, NULL); - if(pScreenPriv->savedColormap) { - (*pScreen->InstallColormap)(pScreenPriv->savedColormap); - pScreenPriv->savedColormap = NULL; - } - pScreenPriv->dgaColormap = NULL; - (*pScrn->EnableDisableFBAccess)(index, TRUE); - - FreeMarkedVisuals(pScreen); - } - - pScreenPriv->grabMouse = FALSE; - pScreenPriv->grabKeyboard = FALSE; - - return Success; - } - - if(!pScrn->vtSema && !pScreenPriv->current) /* Really switched away */ - return BadAlloc; - - if((num > 0) && (num <= pScreenPriv->numModes)) - pMode = &(pScreenPriv->modes[num - 1]); - else - return BadValue; - - if(!(device = (DGADevicePtr)xalloc(sizeof(DGADeviceRec)))) - return BadAlloc; - - if(!pScreenPriv->current) { - Bool oldVTSema = pScrn->vtSema; - - pScrn->vtSema = FALSE; /* kludge until we rewrite VT switching */ - (*pScrn->EnableDisableFBAccess)(index, FALSE); - pScrn->vtSema = oldVTSema; - } - - if(!(*pScreenPriv->funcs->SetMode)(pScrn, pMode)) { - xfree(device); - return BadAlloc; - } - - pScrn->currentMode = pMode->mode; - - if(!pScreenPriv->current && !pScreenPriv->input) { - /* if it's multihead we need to warp the cursor off of - our screen so it doesn't get trapped */ - } - - pScrn->vtSema = FALSE; - - if(pScreenPriv->current) { - PixmapPtr oldPix = pScreenPriv->current->pPix; - if(oldPix) { - if(oldPix->drawable.id) - FreeResource(oldPix->drawable.id, RT_NONE); - else - (*pScreen->DestroyPixmap)(oldPix); - } - xfree(pScreenPriv->current); - pScreenPriv->current = NULL; - } - - if(pMode->flags & DGA_PIXMAP_AVAILABLE) { - if((pPix = (*pScreen->CreatePixmap)(pScreen, 0, 0, pMode->depth))) { - (*pScreen->ModifyPixmapHeader)(pPix, - pMode->pixmapWidth, pMode->pixmapHeight, - pMode->depth, pMode->bitsPerPixel, - pMode->bytesPerScanline, - (pointer)(pMode->address)); - } - } - - devRet->mode = device->mode = pMode; - devRet->pPix = device->pPix = pPix; - pScreenPriv->current = device; - pScreenPriv->pixmapMode = FALSE; - pScreenPriv->grabMouse = TRUE; - pScreenPriv->grabKeyboard = TRUE; - - return Success; -} - - - -/*********** exported ones ***************/ - -void -DGASetInputMode(int index, Bool keyboard, Bool mouse) -{ - ScreenPtr pScreen = screenInfo.screens[index]; - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - - if (pScreenPriv) - { - pScreenPriv->grabMouse = mouse; - pScreenPriv->grabKeyboard = keyboard; - } -} - -Bool -DGAChangePixmapMode(int index, int *x, int *y, int mode) -{ - DGAScreenPtr pScreenPriv; - DGADevicePtr pDev; - DGAModePtr pMode; - PixmapPtr pPix; - - if(DGAScreenIndex < 0) - return FALSE; - - pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); - - if(!pScreenPriv || !pScreenPriv->current || !pScreenPriv->current->pPix) - return FALSE; - - pDev = pScreenPriv->current; - pPix = pDev->pPix; - pMode = pDev->mode; - - if(mode) { - int shift = 2; - - if(*x > (pMode->pixmapWidth - pMode->viewportWidth)) - *x = pMode->pixmapWidth - pMode->viewportWidth; - if(*y > (pMode->pixmapHeight - pMode->viewportHeight)) - *y = pMode->pixmapHeight - pMode->viewportHeight; - - switch(xf86Screens[index]->bitsPerPixel) { - case 16: shift = 1; break; - case 32: shift = 0; break; - default: break; - } - - if(BITMAP_SCANLINE_PAD == 64) - shift++; - - *x = (*x >> shift) << shift; - - pPix->drawable.x = *x; - pPix->drawable.y = *y; - pPix->drawable.width = pMode->viewportWidth; - pPix->drawable.height = pMode->viewportHeight; - } else { - pPix->drawable.x = 0; - pPix->drawable.y = 0; - pPix->drawable.width = pMode->pixmapWidth; - pPix->drawable.height = pMode->pixmapHeight; - } - pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER; - pScreenPriv->pixmapMode = mode; - - return TRUE; -} - -Bool -DGAAvailable(int index) -{ - if(DGAScreenIndex < 0) - return FALSE; - - if (!xf86NoSharedResources(((ScrnInfoPtr)screenInfo.screens[index]-> - devPrivates[xf86ScreenIndex].ptr)->scrnIndex,MEM)) - return FALSE; - - if(DGA_GET_SCREEN_PRIV(screenInfo.screens[index])) - return TRUE; - - return FALSE; -} - -Bool -DGAActive(int index) -{ - DGAScreenPtr pScreenPriv; - - if(DGAScreenIndex < 0) - return FALSE; - - pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); - - if(pScreenPriv && pScreenPriv->current) - return TRUE; - - return FALSE; -} - - - -/* Called by the event code in case the server is abruptly terminated */ - -void -DGAShutdown() -{ - ScrnInfoPtr pScrn; - int i; - - if(DGAScreenIndex < 0) - return; - - for(i = 0; i < screenInfo.numScreens; i++) { - pScrn = xf86Screens[i]; - - (void)(*pScrn->SetDGAMode)(pScrn->scrnIndex, 0, NULL); - } -} - -/* Called by the extension to initialize a mode */ - -int -DGASetMode( - int index, - int num, - XDGAModePtr mode, - PixmapPtr *pPix -){ - ScrnInfoPtr pScrn = xf86Screens[index]; - DGADeviceRec device; - int ret; - - /* We rely on the extension to check that DGA is available */ - - ret = (*pScrn->SetDGAMode)(index, num, &device); - if((ret == Success) && num) { - DGACopyModeInfo(device.mode, mode); - *pPix = device.pPix; - } - - return ret; -} - -/* Called from the extension to let the DDX know which events are requested */ - -void -DGASelectInput( - int index, - ClientPtr client, - long mask -){ - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); - - /* We rely on the extension to check that DGA is available */ - pScreenPriv->client = client; - pScreenPriv->input = mask; -} - -int -DGAGetViewportStatus(int index) -{ - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); - - /* We rely on the extension to check that DGA is active */ - - if (!pScreenPriv->funcs->GetViewport) - return 0; - - return (*pScreenPriv->funcs->GetViewport)(pScreenPriv->pScrn); -} - -int -DGASetViewport( - int index, - int x, int y, - int mode -){ - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); - - if (pScreenPriv->funcs->SetViewport) - (*pScreenPriv->funcs->SetViewport)(pScreenPriv->pScrn, x, y, mode); - return Success; -} - - -static int -BitsClear(CARD32 data) -{ - int bits = 0; - CARD32 mask; - - for(mask = 1; mask; mask <<= 1) { - if(!(data & mask)) bits++; - else break; - } - - return bits; -} - -int -DGACreateColormap(int index, ClientPtr client, int id, int mode, int alloc) -{ - ScreenPtr pScreen = screenInfo.screens[index]; - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - FakedVisualList *fvlp; - VisualPtr pVisual; - DGAModePtr pMode; - ColormapPtr pmap; - - if(!mode || (mode > pScreenPriv->numModes)) - return BadValue; - - if((alloc != AllocNone) && (alloc != AllocAll)) - return BadValue; - - pMode = &(pScreenPriv->modes[mode - 1]); - - if(!(pVisual = xalloc(sizeof(VisualRec)))) - return BadAlloc; - - pVisual->vid = FakeClientID(0); - pVisual->class = pMode->visualClass; - pVisual->nplanes = pMode->depth; - pVisual->ColormapEntries = 1 << pMode->depth; - pVisual->bitsPerRGBValue = (pMode->depth + 2) / 3; - - switch (pVisual->class) { - case PseudoColor: - case GrayScale: - case StaticGray: - pVisual->bitsPerRGBValue = 8; /* not quite */ - pVisual->redMask = 0; - pVisual->greenMask = 0; - pVisual->blueMask = 0; - pVisual->offsetRed = 0; - pVisual->offsetGreen = 0; - pVisual->offsetBlue = 0; - break; - case DirectColor: - case TrueColor: - pVisual->ColormapEntries = 1 << pVisual->bitsPerRGBValue; - /* fall through */ - case StaticColor: - pVisual->redMask = pMode->red_mask; - pVisual->greenMask = pMode->green_mask; - pVisual->blueMask = pMode->blue_mask; - pVisual->offsetRed = BitsClear(pVisual->redMask); - pVisual->offsetGreen = BitsClear(pVisual->greenMask); - pVisual->offsetBlue = BitsClear(pVisual->blueMask); - } - - if(!(fvlp = xalloc(sizeof(FakedVisualList)))) { - xfree(pVisual); - return BadAlloc; - } - - fvlp->free = FALSE; - fvlp->pVisual = pVisual; - fvlp->next = pScreenPriv->fakedVisuals; - pScreenPriv->fakedVisuals = fvlp; - - LEGAL_NEW_RESOURCE(id, client); - - return CreateColormap(id, pScreen, pVisual, &pmap, alloc, client->index); -} - -/* Called by the extension to install a colormap on DGA active screens */ - -void -DGAInstallCmap(ColormapPtr cmap) -{ - ScreenPtr pScreen = cmap->pScreen; - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - - /* We rely on the extension to check that DGA is active */ - - if(!pScreenPriv->dgaColormap) - pScreenPriv->savedColormap = miInstalledMaps[pScreen->myNum]; - - pScreenPriv->dgaColormap = cmap; - - (*pScreen->InstallColormap)(cmap); -} - -int -DGASync(int index) -{ - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); - - /* We rely on the extension to check that DGA is active */ - - if (pScreenPriv->funcs->Sync) - (*pScreenPriv->funcs->Sync)(pScreenPriv->pScrn); - - return Success; -} - -int -DGAFillRect( - int index, - int x, int y, int w, int h, - unsigned long color -){ - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); - - /* We rely on the extension to check that DGA is active */ - - if(pScreenPriv->funcs->FillRect && - (pScreenPriv->current->mode->flags & DGA_FILL_RECT)) { - - (*pScreenPriv->funcs->FillRect)(pScreenPriv->pScrn, x, y, w, h, color); - return Success; - } - return BadMatch; -} - -int -DGABlitRect( - int index, - int srcx, int srcy, - int w, int h, - int dstx, int dsty -){ - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); - - /* We rely on the extension to check that DGA is active */ - - if(pScreenPriv->funcs->BlitRect && - (pScreenPriv->current->mode->flags & DGA_BLIT_RECT)) { - - (*pScreenPriv->funcs->BlitRect)(pScreenPriv->pScrn, - srcx, srcy, w, h, dstx, dsty); - return Success; - } - return BadMatch; -} - -int -DGABlitTransRect( - int index, - int srcx, int srcy, - int w, int h, - int dstx, int dsty, - unsigned long color -){ - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); - - /* We rely on the extension to check that DGA is active */ - - if(pScreenPriv->funcs->BlitTransRect && - (pScreenPriv->current->mode->flags & DGA_BLIT_RECT_TRANS)) { - - (*pScreenPriv->funcs->BlitTransRect)(pScreenPriv->pScrn, - srcx, srcy, w, h, dstx, dsty, color); - return Success; - } - return BadMatch; -} - - -int -DGAGetModes(int index) -{ - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); - /* We rely on the extension to check that DGA is available */ - - return pScreenPriv->numModes; -} - - -int -DGAGetModeInfo( - int index, - XDGAModePtr mode, - int num -){ - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); - /* We rely on the extension to check that DGA is available */ - - if((num <= 0) || (num > pScreenPriv->numModes)) - return BadValue; - - DGACopyModeInfo(&(pScreenPriv->modes[num - 1]), mode); - - return Success; -} - - -static void -DGACopyModeInfo( - DGAModePtr mode, - XDGAModePtr xmode -){ - DisplayModePtr dmode = mode->mode; - - xmode->num = mode->num; - xmode->name = dmode->name; - xmode->VSync_num = (int)(dmode->VRefresh * 1000.0); - xmode->VSync_den = 1000; - xmode->flags = mode->flags; - xmode->imageWidth = mode->imageWidth; - xmode->imageHeight = mode->imageHeight; - xmode->pixmapWidth = mode->pixmapWidth; - xmode->pixmapHeight = mode->pixmapHeight; - xmode->bytesPerScanline = mode->bytesPerScanline; - xmode->byteOrder = mode->byteOrder; - xmode->depth = mode->depth; - xmode->bitsPerPixel = mode->bitsPerPixel; - xmode->red_mask = mode->red_mask; - xmode->green_mask = mode->green_mask; - xmode->blue_mask = mode->blue_mask; - xmode->visualClass = mode->visualClass; - xmode->viewportWidth = mode->viewportWidth; - xmode->viewportHeight = mode->viewportHeight; - xmode->xViewportStep = mode->xViewportStep; - xmode->yViewportStep = mode->yViewportStep; - xmode->maxViewportX = mode->maxViewportX; - xmode->maxViewportY = mode->maxViewportY; - xmode->viewportFlags = mode->viewportFlags; - xmode->reserved1 = mode->reserved1; - xmode->reserved2 = mode->reserved2; - xmode->offset = mode->offset; - - if(dmode->Flags & V_INTERLACE) xmode->flags |= DGA_INTERLACED; - if(dmode->Flags & V_DBLSCAN) xmode->flags |= DGA_DOUBLESCAN; -} - - -Bool -DGAVTSwitch(void) -{ - ScreenPtr pScreen; - int i; - - for(i = 0; i < screenInfo.numScreens; i++) { - pScreen = screenInfo.screens[i]; - - /* Alternatively, this could send events to DGA clients */ - - if(DGAScreenIndex >= 0) { - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - - if(pScreenPriv && pScreenPriv->current) - return FALSE; - } - } - - return TRUE; -} - - -/* We have the power to steal or modify events that are about to get queued */ - -Bool -DGAStealKeyEvent(int index, xEvent *e) -{ - DGAScreenPtr pScreenPriv; - dgaEvent de; - - if(DGAScreenIndex < 0) /* no DGA */ - return FALSE; - - pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); - - if(!pScreenPriv || !pScreenPriv->grabKeyboard) /* no direct mode */ - return FALSE; - - de.u.u.type = e->u.u.type + *XDGAEventBase; - de.u.u.detail = e->u.u.detail; - de.u.event.time = e->u.keyButtonPointer.time; - xf86eqEnqueue ((xEvent *) &de); - return TRUE; -} - -static int DGAMouseX, DGAMouseY; - -Bool -DGAStealMouseEvent(int index, xEvent *e, int dx, int dy) -{ - DGAScreenPtr pScreenPriv; - dgaEvent de; - - if(DGAScreenIndex < 0) /* no DGA */ - return FALSE; - - pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); - - if(!pScreenPriv || !pScreenPriv->grabMouse) /* no direct mode */ - return FALSE; - - DGAMouseX += dx; - if (DGAMouseX < 0) - DGAMouseX = 0; - else if (DGAMouseX > screenInfo.screens[index]->width) - DGAMouseX = screenInfo.screens[index]->width; - DGAMouseY += dy; - if (DGAMouseY < 0) - DGAMouseY = 0; - else if (DGAMouseY > screenInfo.screens[index]->height) - DGAMouseY = screenInfo.screens[index]->height; - de.u.u.type = e->u.u.type + *XDGAEventBase; - de.u.u.detail = e->u.u.detail; - de.u.event.time = e->u.keyButtonPointer.time; - de.u.event.dx = dx; - de.u.event.dy = dy; - de.u.event.pad1 = DGAMouseX; - de.u.event.pad2 = DGAMouseY; - xf86eqEnqueue ((xEvent *) &de); - return TRUE; -} - -Bool -DGAIsDgaEvent (xEvent *e) -{ - int coreEquiv; - if (DGAScreenIndex < 0 || XDGAEventBase == 0) - return FALSE; - coreEquiv = e->u.u.type - *XDGAEventBase; - if (KeyPress <= coreEquiv && coreEquiv <= MotionNotify) - return TRUE; - return FALSE; -} - -#define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */ -static Mask filters[] = -{ - NoSuchEvent, /* 0 */ - NoSuchEvent, /* 1 */ - KeyPressMask, /* KeyPress */ - KeyReleaseMask, /* KeyRelease */ - ButtonPressMask, /* ButtonPress */ - ButtonReleaseMask, /* ButtonRelease */ - PointerMotionMask, /* MotionNotify (initial state) */ -}; - -static void -DGAProcessKeyboardEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr keybd) -{ - int key, bit; - register BYTE *kptr; - register int i; - register CARD8 modifiers; - register CARD16 mask; - int coreEquiv; - xEvent core; - KeyClassPtr keyc = keybd->key; - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - - coreEquiv = de->u.u.type - *XDGAEventBase; - - /* - * Fill in remaining event state - */ - de->u.event.dx = 0; - de->u.event.dy = 0; - de->u.event.screen = pScreen->myNum; - de->u.event.state = keyc->state | (inputInfo.pointer)->button->state; - - /* - * Keep the core state in sync by duplicating what - * CoreProcessKeyboardEvent does - */ - key = de->u.u.detail; - kptr = &keyc->down[key >> 3]; - bit = 1 << (key & 7); - modifiers = keyc->modifierMap[key]; - switch (coreEquiv) - { - case KeyPress: - inputInfo.pointer->valuator->motionHintWindow = NullWindow; - *kptr |= bit; - keyc->prev_state = keyc->state; -#ifdef XKB - if (noXkbExtension) -#endif - { - - for (i = 0, mask = 1; modifiers; i++, mask <<= 1) - { - if (mask & modifiers) - { - /* This key affects modifier "i" */ - keyc->modifierKeyCount[i]++; - keyc->state |= mask; - modifiers &= ~mask; - } - } - } - break; - case KeyRelease: - inputInfo.pointer->valuator->motionHintWindow = NullWindow; - *kptr &= ~bit; - keyc->prev_state = keyc->state; -#ifdef XKB - if (noXkbExtension) -#endif - { - for (i = 0, mask = 1; modifiers; i++, mask <<= 1) - { - if (mask & modifiers) { - /* This key affects modifier "i" */ - if (--keyc->modifierKeyCount[i] <= 0) { - keyc->state &= ~mask; - keyc->modifierKeyCount[i] = 0; - } - modifiers &= ~mask; - } - } - } - break; - } - /* - * Deliver the DGA event - */ - if (pScreenPriv->client) - { - /* If the DGA client has selected input, then deliver based on the usual filter */ - TryClientEvents (pScreenPriv->client, (xEvent *) de, 1, - filters[coreEquiv], pScreenPriv->input, 0); - } - else - { - /* If the keyboard is actively grabbed, deliver a grabbed core event */ - if (keybd->grab && !keybd->fromPassiveGrab) - { - core.u.u.type = coreEquiv; - core.u.u.detail = de->u.u.detail; - core.u.keyButtonPointer.time = de->u.event.time; - core.u.keyButtonPointer.eventX = de->u.event.dx; - core.u.keyButtonPointer.eventY = de->u.event.dy; - core.u.keyButtonPointer.rootX = de->u.event.dx; - core.u.keyButtonPointer.rootY = de->u.event.dy; - core.u.keyButtonPointer.state = de->u.event.state; - DeliverGrabbedEvent (&core, keybd, FALSE, 1); - } - } -} - -static void -DGAProcessPointerEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr mouse) -{ - ButtonClassPtr butc = mouse->button; - int coreEquiv; - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - xEvent core; - - coreEquiv = de->u.u.type - *XDGAEventBase; - /* - * Fill in remaining event state - */ - de->u.event.screen = pScreen->myNum; - de->u.event.state = butc->state | inputInfo.keyboard->key->state; - /* - * Keep the core state in sync by duplicating what - * CoreProcessPointerEvent does - */ - if (coreEquiv != MotionNotify) - { - register int key; - register BYTE *kptr; - int bit; - - key = de->u.u.detail; - kptr = &butc->down[key >> 3]; - bit = 1 << (key & 7); - switch (coreEquiv) - { - case ButtonPress: - mouse->valuator->motionHintWindow = NullWindow; - if (!(*kptr & bit)) - butc->buttonsDown++; - butc->motionMask = ButtonMotionMask; - *kptr |= bit; - if (key <= 5) - butc->state |= (Button1Mask >> 1) << key; - break; - case ButtonRelease: - mouse->valuator->motionHintWindow = NullWindow; - if (*kptr & bit) - --butc->buttonsDown; - if (!butc->buttonsDown) - butc->motionMask = 0; - *kptr &= ~bit; - if (key == 0) - return; - if (key <= 5) - butc->state &= ~((Button1Mask >> 1) << key); - break; - } - } - /* - * Deliver the DGA event - */ - if (pScreenPriv->client) - { - /* If the DGA client has selected input, then deliver based on the usual filter */ - TryClientEvents (pScreenPriv->client, (xEvent *) de, 1, - filters[coreEquiv], pScreenPriv->input, 0); - } - else - { - /* If the pointer is actively grabbed, deliver a grabbed core event */ - if (mouse->grab && !mouse->fromPassiveGrab) - { - core.u.u.type = coreEquiv; - core.u.u.detail = de->u.u.detail; - core.u.keyButtonPointer.time = de->u.event.time; - core.u.keyButtonPointer.eventX = de->u.event.dx; - core.u.keyButtonPointer.eventY = de->u.event.dy; - core.u.keyButtonPointer.rootX = de->u.event.dx; - core.u.keyButtonPointer.rootY = de->u.event.dy; - core.u.keyButtonPointer.state = de->u.event.state; - DeliverGrabbedEvent (&core, mouse, FALSE, 1); - } - } -} - -Bool -DGADeliverEvent (ScreenPtr pScreen, xEvent *e) -{ - dgaEvent *de = (dgaEvent *) e; - DGAScreenPtr pScreenPriv; - int coreEquiv; - - /* no DGA */ - if (DGAScreenIndex < 0 || XDGAEventBase == 0) - return FALSE; - pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - - /* DGA not initialized on this screen */ - if (!pScreenPriv) - return FALSE; - - coreEquiv = de->u.u.type - *XDGAEventBase; - /* Not a DGA event */ - if (coreEquiv < KeyPress || coreEquiv > MotionNotify) - return FALSE; - - switch (coreEquiv) { - case KeyPress: - case KeyRelease: - DGAProcessKeyboardEvent (pScreen, de, inputInfo.keyboard); - break; - default: - DGAProcessPointerEvent (pScreen, de, inputInfo.pointer); - break; - } - return TRUE; -} - -Bool -DGAOpenFramebuffer( - int index, - char **name, - unsigned char **mem, - int *size, - int *offset, - int *flags -){ - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); - - /* We rely on the extension to check that DGA is available */ - - return (*pScreenPriv->funcs->OpenFramebuffer)(pScreenPriv->pScrn, - name, mem, size, offset, flags); -} - -void -DGACloseFramebuffer(int index) -{ - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); - - /* We rely on the extension to check that DGA is available */ - if(pScreenPriv->funcs->CloseFramebuffer) - (*pScreenPriv->funcs->CloseFramebuffer)(pScreenPriv->pScrn); -} - -/* For DGA 1.0 backwards compatibility only */ - -int -DGAGetOldDGAMode(int index) -{ - DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); - ScrnInfoPtr pScrn = pScreenPriv->pScrn; - DGAModePtr mode; - int i, w, h, p; - - /* We rely on the extension to check that DGA is available */ - - w = pScrn->currentMode->HDisplay; - h = pScrn->currentMode->VDisplay; - p = ((pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)) + 3) & ~3L; - - for(i = 0; i < pScreenPriv->numModes; i++) { - mode = &(pScreenPriv->modes[i]); - - if((mode->viewportWidth == w) && (mode->viewportHeight == h) && - (mode->bytesPerScanline == p) && - (mode->bitsPerPixel == pScrn->bitsPerPixel) && - (mode->depth == pScrn->depth)) { - - return mode->num; - } - } - - return 0; -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86DPMS.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86DPMS.c deleted file mode 100644 index f02585a0f..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86DPMS.c +++ /dev/null @@ -1,222 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c,v 1.11 2003/11/11 21:02:28 dawes Exp $ */ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c,v 1.8 2005/07/03 08:53:42 daniels Exp $ */ - -/* - * Copyright (c) 1997-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * This file contains the DPMS functions required by the extension. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "os.h" -#include "globals.h" -#include "xf86.h" -#include "xf86Priv.h" -#ifdef DPMSExtension -#define DPMS_SERVER -#include -#include "dpmsproc.h" -#endif - - -#ifdef DPMSExtension -static int DPMSGeneration = 0; -static int DPMSIndex = -1; -static Bool DPMSClose(int i, ScreenPtr pScreen); -static int DPMSCount = 0; -#endif - - -Bool -xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags) -{ -#ifdef DPMSExtension - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - DPMSPtr pDPMS; - pointer DPMSOpt; - - if (serverGeneration != DPMSGeneration) { - if ((DPMSIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - DPMSGeneration = serverGeneration; - } - - if (DPMSDisabledSwitch) - DPMSEnabled = FALSE; - if (!(pScreen->devPrivates[DPMSIndex].ptr = xcalloc(sizeof(DPMSRec), 1))) - return FALSE; - - pDPMS = (DPMSPtr)pScreen->devPrivates[DPMSIndex].ptr; - pScrn->DPMSSet = set; - pDPMS->Flags = flags; - DPMSOpt = xf86FindOption(pScrn->options, "dpms"); - if (DPMSOpt) { - if ((pDPMS->Enabled - = xf86SetBoolOption(pScrn->options, "dpms", FALSE)) - && !DPMSDisabledSwitch) - DPMSEnabled = TRUE; - xf86MarkOptionUsed(DPMSOpt); - xf86DrvMsg(pScreen->myNum, X_CONFIG, "DPMS enabled\n"); - } else if (DPMSEnabledSwitch) { - if (!DPMSDisabledSwitch) - DPMSEnabled = TRUE; - pDPMS->Enabled = TRUE; - } - else { - pDPMS->Enabled = defaultDPMSEnabled; - } - pDPMS->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = DPMSClose; - DPMSCount++; - return TRUE; -#else - return FALSE; -#endif -} - - -#ifdef DPMSExtension - -static Bool -DPMSClose(int i, ScreenPtr pScreen) -{ - DPMSPtr pDPMS; - - /* This shouldn't happen */ - if (DPMSIndex < 0) - return FALSE; - - pDPMS = (DPMSPtr)pScreen->devPrivates[DPMSIndex].ptr; - - /* This shouldn't happen */ - if (!pDPMS) - return FALSE; - - pScreen->CloseScreen = pDPMS->CloseScreen; - - /* - * Turn on DPMS when shutting down. If this function can be used - * depends on the order the driver wraps things. If this is called - * after the driver has shut down everything the driver will have - * to deal with this internally. - */ - if (xf86Screens[i]->vtSema && xf86Screens[i]->DPMSSet) { - xf86Screens[i]->DPMSSet(xf86Screens[i],DPMSModeOn,0); - } - - xfree((pointer)pDPMS); - pScreen->devPrivates[DPMSIndex].ptr = NULL; - if (--DPMSCount == 0) - DPMSIndex = -1; - return pScreen->CloseScreen(i, pScreen); -} - - -/* - * DPMSSet -- - * Device dependent DPMS mode setting hook. This is called whenever - * the DPMS mode is to be changed. - */ -void -DPMSSet(int level) -{ - int i; - DPMSPtr pDPMS; - ScrnInfoPtr pScrn; - - DPMSPowerLevel = level; - - if (DPMSIndex < 0) - return; - - if (level != DPMSModeOn) - SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverActive); - - /* For each screen, set the DPMS level */ - for (i = 0; i < xf86NumScreens; i++) { - pScrn = xf86Screens[i]; - pDPMS = (DPMSPtr)screenInfo.screens[i]->devPrivates[DPMSIndex].ptr; - if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) { - xf86EnableAccess(pScrn); - pScrn->DPMSSet(pScrn, level, 0); - } - } -} - - -/* - * DPMSSupported -- - * Return TRUE if any screen supports DPMS. - */ -Bool -DPMSSupported(void) -{ - int i; - DPMSPtr pDPMS; - ScrnInfoPtr pScrn; - - if (DPMSIndex < 0) { - return FALSE; - } - - /* For each screen, check if DPMS is supported */ - for (i = 0; i < xf86NumScreens; i++) { - pScrn = xf86Screens[i]; - pDPMS = (DPMSPtr)screenInfo.screens[i]->devPrivates[DPMSIndex].ptr; - if (pDPMS && pScrn->DPMSSet) - return TRUE; - } - return FALSE; -} - - -/* - * DPMSGet -- - * Device dependent DPMS mode getting hook. This returns the current - * DPMS mode, or -1 if DPMS is not supported. - * - * This should hook in to the appropriate driver-level function, which - * will be added to the ScrnInfoRec. - * - * NOTES: - * 1. the calling interface should be changed to specify which - * screen to check. - * 2. It isn't clear that this function is ever used or what it should - * return. - */ -int -DPMSGet(int *level) -{ - return DPMSPowerLevel; -} - -#endif /* DPMSExtension */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Debug.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Debug.c deleted file mode 100644 index 15c267232..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Debug.c +++ /dev/null @@ -1,197 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Debug.c,v 1.7 2003/09/24 02:43:17 dawes Exp $ */ - -/* - * Copyright (c) 2000-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifdef __UNIXOS2__ -#define I_NEED_OS2_H -#endif - -#include -#include -#include -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "compiler.h" - -void xf86Break1(void) -{ -} - -void xf86Break2(void) -{ -} - -void xf86Break3(void) -{ -} - -char *xf86p8bit[] = { "00000000", "00000001", "00000010", "00000011", - "00000100", "00000101", "00000110", "00000111", - "00001000", "00001001", "00001010", "00001011", - "00001100", "00001101", "00001110", "00001111", - "00010000", "00010001", "00010010", "00010011", - "00010100", "00010101", "00010110", "00010111", - "00011000", "00011001", "00011010", "00011011", - "00011100", "00011101", "00011110", "00011111", - "00100000", "00100001", "00100010", "00100011", - "00100100", "00100101", "00100110", "00100111", - "00101000", "00101001", "00101010", "00101011", - "00101100", "00101101", "00101110", "00101111", - "00110000", "00110001", "00110010", "00110011", - "00110100", "00110101", "00110110", "00110111", - "00111000", "00111001", "00111010", "00111011", - "00111100", "00111101", "00111110", "00111111", - "01000000", "01000001", "01000010", "01000011", - "01000100", "01000101", "01000110", "01000111", - "01001000", "01001001", "01001010", "01001011", - "01001100", "01001101", "01001110", "01001111", - "01010000", "01010001", "01010010", "01010011", - "01010100", "01010101", "01010110", "01010111", - "01011000", "01011001", "01011010", "01011011", - "01011100", "01011101", "01011110", "01011111", - "01100000", "01100001", "01100010", "01100011", - "01100100", "01100101", "01100110", "01100111", - "01101000", "01101001", "01101010", "01101011", - "01101100", "01101101", "01101110", "01101111", - "01110000", "01110001", "01110010", "01110011", - "01110100", "01110101", "01110110", "01110111", - "01111000", "01111001", "01111010", "01111011", - "01111100", "01111101", "01111110", "01111111", - "10000000", "10000001", "10000010", "10000011", - "10000100", "10000101", "10000110", "10000111", - "10001000", "10001001", "10001010", "10001011", - "10001100", "10001101", "10001110", "10001111", - "10010000", "10010001", "10010010", "10010011", - "10010100", "10010101", "10010110", "10010111", - "10011000", "10011001", "10011010", "10011011", - "10011100", "10011101", "10011110", "10011111", - "10100000", "10100001", "10100010", "10100011", - "10100100", "10100101", "10100110", "10100111", - "10101000", "10101001", "10101010", "10101011", - "10101100", "10101101", "10101110", "10101111", - "10110000", "10110001", "10110010", "10110011", - "10110100", "10110101", "10110110", "10110111", - "10111000", "10111001", "10111010", "10111011", - "10111100", "10111101", "10111110", "10111111", - "11000000", "11000001", "11000010", "11000011", - "11000100", "11000101", "11000110", "11000111", - "11001000", "11001001", "11001010", "11001011", - "11001100", "11001101", "11001110", "11001111", - "11010000", "11010001", "11010010", "11010011", - "11010100", "11010101", "11010110", "11010111", - "11011000", "11011001", "11011010", "11011011", - "11011100", "11011101", "11011110", "11011111", - "11100000", "11100001", "11100010", "11100011", - "11100100", "11100101", "11100110", "11100111", - "11101000", "11101001", "11101010", "11101011", - "11101100", "11101101", "11101110", "11101111", - "11110000", "11110001", "11110010", "11110011", - "11110100", "11110101", "11110110", "11110111", - "11111000", "11111001", "11111010", "11111011", - "11111100", "11111101", "11111110", "11111111" -}; - -CARD32 xf86DummyVar1; -CARD32 xf86DummyVar2; -CARD32 xf86DummyVar3; - -CARD8 xf86PeekFb8(CARD8 *p) { return *p; } -CARD16 xf86PeekFb16(CARD16 *p) { return *p; } -CARD32 xf86PeekFb32(CARD32 *p) { return *p; } -void xf86PokeFb8(CARD8 *p, CARD8 v) { *p = v; } -void xf86PokeFb16(CARD16 *p, CARD16 v) { *p = v; } -void xf86PokeFb32(CARD16 *p, CARD32 v) { *p = v; } - -CARD8 xf86PeekMmio8(pointer Base, unsigned long Offset) -{ - return MMIO_IN8(Base,Offset); -} - -CARD16 xf86PeekMmio16(pointer Base, unsigned long Offset) -{ - return MMIO_IN16(Base,Offset); -} - -CARD32 xf86PeekMmio32(pointer Base, unsigned long Offset) -{ - return MMIO_IN32(Base,Offset); -} - -void xf86PokeMmio8(pointer Base, unsigned long Offset, CARD8 v) -{ - MMIO_OUT8(Base,Offset,v); -} - -void xf86PokeMmio16(pointer Base, unsigned long Offset, CARD16 v) -{ - MMIO_OUT16(Base,Offset,v); -} - -void xf86PokeMmio32(pointer Base, unsigned long Offset, CARD32 v) -{ - MMIO_OUT32(Base,Offset,v); -} - - -void -xf86STimestamp(xf86TsPtr* timestamp) -{ - if (*timestamp) { - gettimeofday((struct timeval*)*timestamp,NULL); - } else { - *timestamp = xnfalloc(sizeof(xf86TsRec)); - gettimeofday((struct timeval*)*timestamp,NULL); - } -} - -void -xf86SPTimestamp(xf86TsPtr* timestamp, char *str) -{ - if (*timestamp) { - long diff; - struct timeval ts; - ts = **(struct timeval**)timestamp; - gettimeofday((struct timeval*)*timestamp,NULL); - if (ts.tv_usec > (*timestamp)->usec) - diff = ((*timestamp)->sec - ts.tv_sec - 1) * 1000 - + (ts.tv_usec - (*timestamp)->usec) / 1000; - else - diff = ((*timestamp)->sec - ts.tv_sec) * 1000 - +(- ts.tv_usec + (*timestamp)->usec) / 1000; - ErrorF("%s Elapsed: %li\n",str,diff); - } else { - *timestamp = xnfalloc(sizeof(xf86TsRec)); - gettimeofday((struct timeval*)*timestamp,NULL); - } -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86DefModes.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86DefModes.c deleted file mode 100644 index a39d0a212..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86DefModes.c +++ /dev/null @@ -1,160 +0,0 @@ -/* $XFree86$ */ - -/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at - * modeline2c.pl */ - -/* - * Copyright 1999-2003 by The XFree86 Project, Inc. - * - * Author: Dirk Hohndel - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifdef __UNIXOS2__ -#define I_NEED_OS2_H -#endif -#include "xf86.h" -#include "xf86Config.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#include "globals.h" - -#define MODEPREFIX(name) NULL, NULL, name, MODE_OK, M_T_DEFAULT -#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0 - -DisplayModeRec xf86DefaultModes [] = { -/* 640x350 @ 85Hz (VESA) hsync: 37.9kHz */ - {MODEPREFIX("640x350"),31500, 640,672,736,832,0, 350,382,385,445,0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, - {MODEPREFIX("320x175"),15750, 320,336,368,416,0, 175,191,192,222,0, V_PHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 640x400 @ 85Hz (VESA) hsync: 37.9kHz */ - {MODEPREFIX("640x400"),31500, 640,672,736,832,0, 400,401,404,445,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("320x200"),15750, 320,336,368,416,0, 200,200,202,222,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 720x400 @ 85Hz (VESA) hsync: 37.9kHz */ - {MODEPREFIX("720x400"),35500, 720,756,828,936,0, 400,401,404,446,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("360x200"),17750, 360,378,414,468,0, 200,200,202,223,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 640x480 @ 60Hz (Industry standard) hsync: 31.5kHz */ - {MODEPREFIX("640x480"),25200, 640,656,752,800,0, 480,490,492,525,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, - {MODEPREFIX("320x240"),12600, 320,328,376,400,0, 240,245,246,262,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 640x480 @ 72Hz (VESA) hsync: 37.9kHz */ - {MODEPREFIX("640x480"),31500, 640,664,704,832,0, 480,489,491,520,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, - {MODEPREFIX("320x240"),15750, 320,332,352,416,0, 240,244,245,260,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 640x480 @ 75Hz (VESA) hsync: 37.5kHz */ - {MODEPREFIX("640x480"),31500, 640,656,720,840,0, 480,481,484,500,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, - {MODEPREFIX("320x240"),15750, 320,328,360,420,0, 240,240,242,250,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 640x480 @ 85Hz (VESA) hsync: 43.3kHz */ - {MODEPREFIX("640x480"),36000, 640,696,752,832,0, 480,481,484,509,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, - {MODEPREFIX("320x240"),18000, 320,348,376,416,0, 240,240,242,254,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 800x600 @ 56Hz (VESA) hsync: 35.2kHz */ - {MODEPREFIX("800x600"),36000, 800,824,896,1024,0, 600,601,603,625,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("400x300"),18000, 400,412,448,512,0, 300,300,301,312,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 800x600 @ 60Hz (VESA) hsync: 37.9kHz */ - {MODEPREFIX("800x600"),40000, 800,840,968,1056,0, 600,601,605,628,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("400x300"),20000, 400,420,484,528,0, 300,300,302,314,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 800x600 @ 72Hz (VESA) hsync: 48.1kHz */ - {MODEPREFIX("800x600"),50000, 800,856,976,1040,0, 600,637,643,666,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("400x300"),25000, 400,428,488,520,0, 300,318,321,333,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 800x600 @ 75Hz (VESA) hsync: 46.9kHz */ - {MODEPREFIX("800x600"),49500, 800,816,896,1056,0, 600,601,604,625,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("400x300"),24750, 400,408,448,528,0, 300,300,302,312,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 800x600 @ 85Hz (VESA) hsync: 53.7kHz */ - {MODEPREFIX("800x600"),56300, 800,832,896,1048,0, 600,601,604,631,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("400x300"),28150, 400,416,448,524,0, 300,300,302,315,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1024x768i @ 43Hz (industry standard) hsync: 35.5kHz */ - {MODEPREFIX("1024x768"),44900, 1024,1032,1208,1264,0, 768,768,776,817,0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX}, - {MODEPREFIX("512x384"),22450, 512,516,604,632,0, 384,384,388,408,0, V_PHSYNC | V_PVSYNC | V_INTERLACE | V_DBLSCAN, MODESUFFIX}, -/* 1024x768 @ 60Hz (VESA) hsync: 48.4kHz */ - {MODEPREFIX("1024x768"),65000, 1024,1048,1184,1344,0, 768,771,777,806,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, - {MODEPREFIX("512x384"),32500, 512,524,592,672,0, 384,385,388,403,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1024x768 @ 70Hz (VESA) hsync: 56.5kHz */ - {MODEPREFIX("1024x768"),75000, 1024,1048,1184,1328,0, 768,771,777,806,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, - {MODEPREFIX("512x384"),37500, 512,524,592,664,0, 384,385,388,403,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1024x768 @ 75Hz (VESA) hsync: 60.0kHz */ - {MODEPREFIX("1024x768"),78800, 1024,1040,1136,1312,0, 768,769,772,800,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("512x384"),39400, 512,520,568,656,0, 384,384,386,400,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1024x768 @ 85Hz (VESA) hsync: 68.7kHz */ - {MODEPREFIX("1024x768"),94500, 1024,1072,1168,1376,0, 768,769,772,808,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("512x384"),47250, 512,536,584,688,0, 384,384,386,404,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1152x864 @ 75Hz (VESA) hsync: 67.5kHz */ - {MODEPREFIX("1152x864"),108000, 1152,1216,1344,1600,0, 864,865,868,900,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("576x432"),54000, 576,608,672,800,0, 432,432,434,450,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1280x960 @ 60Hz (VESA) hsync: 60.0kHz */ - {MODEPREFIX("1280x960"),108000, 1280,1376,1488,1800,0, 960,961,964,1000,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("640x480"),54000, 640,688,744,900,0, 480,480,482,500,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1280x960 @ 85Hz (VESA) hsync: 85.9kHz */ - {MODEPREFIX("1280x960"),148500, 1280,1344,1504,1728,0, 960,961,964,1011,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("640x480"),74250, 640,672,752,864,0, 480,480,482,505,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1280x1024 @ 60Hz (VESA) hsync: 64.0kHz */ - {MODEPREFIX("1280x1024"),108000, 1280,1328,1440,1688,0, 1024,1025,1028,1066,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("640x512"),54000, 640,664,720,844,0, 512,512,514,533,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1280x1024 @ 75Hz (VESA) hsync: 80.0kHz */ - {MODEPREFIX("1280x1024"),135000, 1280,1296,1440,1688,0, 1024,1025,1028,1066,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("640x512"),67500, 640,648,720,844,0, 512,512,514,533,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1280x1024 @ 85Hz (VESA) hsync: 91.1kHz */ - {MODEPREFIX("1280x1024"),157500, 1280,1344,1504,1728,0, 1024,1025,1028,1072,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("640x512"),78750, 640,672,752,864,0, 512,512,514,536,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1600x1200 @ 60Hz (VESA) hsync: 75.0kHz */ - {MODEPREFIX("1600x1200"),162000, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("800x600"),81000, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1600x1200 @ 65Hz (VESA) hsync: 81.3kHz */ - {MODEPREFIX("1600x1200"),175500, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("800x600"),87750, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1600x1200 @ 70Hz (VESA) hsync: 87.5kHz */ - {MODEPREFIX("1600x1200"),189000, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("800x600"),94500, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1600x1200 @ 75Hz (VESA) hsync: 93.8kHz */ - {MODEPREFIX("1600x1200"),202500, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("800x600"),101250, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1600x1200 @ 85Hz (VESA) hsync: 106.3kHz */ - {MODEPREFIX("1600x1200"),229500, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("800x600"),114750, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1792x1344 @ 60Hz (VESA) hsync: 83.6kHz */ - {MODEPREFIX("1792x1344"),204800, 1792,1920,2120,2448,0, 1344,1345,1348,1394,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("896x672"),102400, 896,960,1060,1224,0, 672,672,674,697,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1792x1344 @ 75Hz (VESA) hsync: 106.3kHz */ - {MODEPREFIX("1792x1344"),261000, 1792,1888,2104,2456,0, 1344,1345,1348,1417,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("896x672"),130500, 896,944,1052,1228,0, 672,672,674,708,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1856x1392 @ 60Hz (VESA) hsync: 86.3kHz */ - {MODEPREFIX("1856x1392"),218300, 1856,1952,2176,2528,0, 1392,1393,1396,1439,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("928x696"),109150, 928,976,1088,1264,0, 696,696,698,719,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1856x1392 @ 75Hz (VESA) hsync: 112.5kHz */ - {MODEPREFIX("1856x1392"),288000, 1856,1984,2208,2560,0, 1392,1393,1396,1500,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("928x696"),144000, 928,992,1104,1280,0, 696,696,698,750,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1920x1440 @ 60Hz (VESA) hsync: 90.0kHz */ - {MODEPREFIX("1920x1440"),234000, 1920,2048,2256,2600,0, 1440,1441,1444,1500,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("960x720"),117000, 960,1024,1128,1300,0, 720,720,722,750,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1920x1440 @ 75Hz (VESA) hsync: 112.5kHz */ - {MODEPREFIX("1920x1440"),297000, 1920,2064,2288,2640,0, 1440,1441,1444,1500,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("960x720"),148500, 960,1032,1144,1320,0, 720,720,722,750,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 832x624 @ 75Hz (74.55Hz) (fix if the official/Apple spec is different) hsync: 49.725kHz */ - {MODEPREFIX("832x624"),57284, 832,864,928,1152,0, 624,625,628,667,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, - {MODEPREFIX("416x312"),28642, 416,432,464,576,0, 312,312,314,333,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1152x768 @ 54.8Hz (Titanium PowerBook) hsync: 44.2kHz */ - {MODEPREFIX("1152x768"),64995, 1152,1178,1314,1472,0, 768,771,777,806,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("576x384"),32497, 576,589,657,736,0, 384,385,388,403,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1400x1050 @ 60Hz (VESA GTF) hsync: 65.5kHz */ - {MODEPREFIX("1400x1050"),122000, 1400,1488,1640,1880,0, 1050,1052,1064,1082,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("700x525"),61000, 700,744,820,940,0, 525,526,532,541,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1400x1050 @ 75Hz (VESA GTF) hsync: 82.2kHz */ - {MODEPREFIX("1400x1050"),155800, 1400,1464,1784,1912,0, 1050,1052,1064,1090,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("700x525"),77900, 700,732,892,956,0, 525,526,532,545,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1600x1024 @ 60Hz (SGI 1600SW) hsync: 64.0kHz */ - {MODEPREFIX("1600x1024"),106910, 1600,1620,1640,1670,0, 1024,1027,1030,1067,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, - {MODEPREFIX("800x512"),53455, 800,810,820,835,0, 512,513,515,533,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1920x1440 @ 85Hz (VESA GTF) hsync: 128.5kHz */ - {MODEPREFIX("1920x1440"),341350, 1920,2072,2288,2656,0, 1440,1441,1444,1512,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("960x720"),170675, 960,1036,1144,1328,0, 720,720,722,756,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 2048x1536 @ 60Hz (VESA GTF) hsync: 95.3kHz */ - {MODEPREFIX("2048x1536"),266950, 2048,2200,2424,2800,0, 1536,1537,1540,1589,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("1024x768"),133475, 1024,1100,1212,1400,0, 768,768,770,794,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 2048x1536 @ 75Hz (VESA GTF) hsync: 120.2kHz */ - {MODEPREFIX("2048x1536"),340480, 2048,2216,2440,2832,0, 1536,1537,1540,1603,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("1024x768"),170240, 1024,1108,1220,1416,0, 768,768,770,801,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 2048x1536 @ 85Hz (VESA GTF) hsync: 137.0kHz */ - {MODEPREFIX("2048x1536"),388040, 2048,2216,2440,2832,0, 1536,1537,1540,1612,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("1024x768"),194020, 1024,1108,1220,1416,0, 768,768,770,806,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, - {MODEPREFIX(NULL),0,0,0,0,0,0,0,0,0,0,0,0,MODESUFFIX} -}; diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86DoProbe.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86DoProbe.c deleted file mode 100644 index 2f5b03eb1..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86DoProbe.c +++ /dev/null @@ -1,129 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c,v 1.14 2003/10/29 04:17:21 dawes Exp $ */ -/* - * Copyright (c) 1999-2002 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * finish setting up the server - * Load the driver modules and call their probe functions. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include "os.h" -#ifdef XFree86LOADER -#include "loaderProcs.h" -#include "xf86Config.h" -#endif /* XFree86LOADER */ -#include "xf86_OSlib.h" -#include "xf86.h" -#include "xf86Priv.h" - -void -DoProbeArgs(int argc, char **argv, int i) -{ -} - -void -DoProbe() -{ - int i; - Bool probeResult; - Bool ioEnableFailed = FALSE; - -#ifdef XFree86LOADER - /* Find the list of video driver modules. */ - char **list = xf86DriverlistFromCompile(); - char **l; - - if (list) { - ErrorF("List of video driver modules:\n"); - for (l = list; *l; l++) - ErrorF("\t%s\n", *l); - } else { - ErrorF("No video driver modules found\n"); - } - - /* Load all the drivers that were found. */ - xf86LoadModules(list, NULL); -#endif /* XFree86LOADER */ - - /* Disable PCI devices */ - xf86AccessInit(); - - /* Call all of the probe functions, reporting the results. */ - for (i = 0; i < xf86NumDrivers; i++) { - - if (!xorgHWAccess) { - xorgHWFlags flags; - if (!xf86DriverList[i]->driverFunc - || !xf86DriverList[i]->driverFunc(NULL, - GET_REQUIRED_HW_INTERFACES, - &flags) - || NEED_IO_ENABLED(flags)) { - if (ioEnableFailed) - continue; - if (!xf86EnableIO()) { - ioEnableFailed = TRUE; - continue; - } - xorgHWAccess = TRUE; - } - } - - if (xf86DriverList[i]->Probe == NULL) continue; - - xf86MsgVerb(X_INFO, 3, "Probing in driver %s\n", - xf86DriverList[i]->driverName); - probeResult = - (*xf86DriverList[i]->Probe)(xf86DriverList[i], PROBE_DETECT); - if (!probeResult) { - xf86ErrorF("Probe in driver `%s' returns FALSE\n", - xf86DriverList[i]->driverName); - } else { - xf86ErrorF("Probe in driver `%s' returns TRUE\n", - xf86DriverList[i]->driverName); - - /* If we have a result, then call driver's Identify function */ - if (xf86DriverList[i]->Identify != NULL) { - int verbose = xf86SetVerbosity(1); - (*xf86DriverList[i]->Identify)(0); - xf86SetVerbosity(verbose); - } - } - } - - OsCleanup(TRUE); - AbortDDX(); - fflush(stderr); - exit(0); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c deleted file mode 100644 index 9f8c15651..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c +++ /dev/null @@ -1,130 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c,v 1.15 2003/09/23 06:43:46 dawes Exp $ */ -/* - * Copyright (c) 1999-2002 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * Finish setting up the server. - * Call the functions from the scanpci module. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include "os.h" -#ifdef XFree86LOADER -#include "loaderProcs.h" -#endif -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Pci.h" -#include "xf86ScanPci.h" - - -void DoScanPci(int argc, char **argv, int i) -{ - int j,skip,globalVerbose,scanpciVerbose; - ScanPciSetupProcPtr PciSetup; - ScanPciDisplayCardInfoProcPtr DisplayPCICardInfo; -#ifdef XFree86LOADER - int errmaj, errmin; -#endif - - /* - * first we need to finish setup of the OS so that we can call other - * functions in the server - */ - OsInit(); - - /* - * The old verbosity processing that was here isn't useful anymore, but - * for compatibility purposes, ignore verbosity changes after the -scanpci - * flag. - */ - globalVerbose = xf86Verbose; - - /* - * next we process the arguments that are remaining on the command line, - * so that things like the module path can be set there - */ - for ( j = i+1; j < argc; j++ ) { - if ((skip = ddxProcessArgument(argc, argv, j))) - j += (skip - 1); - } - - /* - * Was the verbosity level increased? If so, set it back. - */ - if (xf86Verbose > globalVerbose) - xf86SetVerbosity(globalVerbose); - - /* - * Setting scanpciVerbose to 0 will ensure that the output will go to - * stderr for all reasonable default stderr verbosity levels. - */ - scanpciVerbose = 0; - - /* - * now get the loader set up and load the scanpci module - */ -#ifdef XFree86LOADER - /* Initialise the loader */ - LoaderInit(); - /* Tell the loader the default module search path */ - LoaderSetPath(xf86ModulePath); - - if (!LoadModule("scanpci", NULL, NULL, NULL, NULL, NULL, - &errmaj, &errmin)) { - LoaderErrorMsg(NULL, "scanpci", errmaj, errmin); - exit(1); - } - if (LoaderCheckUnresolved(LD_RESOLV_IFDONE)) { - /* For now, just a warning */ - xf86Msg(X_WARNING, "Some symbols could not be resolved!\n"); - } - PciSetup = (ScanPciSetupProcPtr)LoaderSymbol("ScanPciSetupPciIds"); - DisplayPCICardInfo = - (ScanPciDisplayCardInfoProcPtr)LoaderSymbol("ScanPciDisplayPCICardInfo"); -#else - PciSetup = ScanPciSetupPciIds; - DisplayPCICardInfo = ScanPciDisplayPCICardInfo; -#endif - - if (!(*PciSetup)()) - FatalError("ScanPciSetupPciIds() failed\n"); - (*DisplayPCICardInfo)(scanpciVerbose); - - /* - * That's it; we really should clean things up, but a simple - * exit seems to be all we need. - */ - exit(0); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Events.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Events.c deleted file mode 100644 index c1b478ee2..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Events.c +++ /dev/null @@ -1,1865 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.159 2003/11/22 04:22:11 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* - * Copyright (c) 1994-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* $XConsortium: xf86Events.c /main/46 1996/10/25 11:36:30 kaleb $ */ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 1.21 2005/11/08 06:33:28 jkj Exp $ */ - -/* [JCH-96/01/21] Extended std reverse map to four buttons. */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifdef __UNIXOS2__ -#define I_NEED_OS2_H -#endif - -#include -#include -#include -#include "misc.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#define XF86_OS_PRIVS -#include "xf86_OSlib.h" -#include "atKeynames.h" - - -#ifdef XFreeXDGA -#include "dgaproc.h" -#endif - -#ifdef XINPUT -#include -#include -#else -#include "inputstr.h" -#endif -#include "xf86Xinput.h" - -#include "mi.h" -#include "mipointer.h" - -#ifdef XF86BIGFONT -#define _XF86BIGFONT_SERVER_ -#include -#endif - -#ifdef XKB -extern Bool noXkbExtension; -#endif - -#ifdef DPMSExtension -#define DPMS_SERVER -#include -#include "dpmsproc.h" -#endif - -#define XE_POINTER 1 -#define XE_KEYBOARD 2 - -#ifdef XINPUT -#define __EqEnqueue(ev) xf86eqEnqueue(ev) -#else -#define __EqEnqueue(ev) mieqEnqueue(ev) -#endif - -#define EqEnqueue(ev) { \ - int __sigstate = xf86BlockSIGIO (); \ - __EqEnqueue (ev); \ - xf86UnblockSIGIO(__sigstate); \ -} - -#ifdef XTESTEXT1 - -#define XTestSERVER_SIDE -#include -extern short xtest_mousex; -extern short xtest_mousey; -extern int on_steal_input; -extern Bool XTestStealKeyData(); -extern void XTestStealMotionData(); -#define ENQUEUE(ev, code, direction, dev_type) \ - (ev)->u.u.detail = (code); \ - (ev)->u.u.type = (direction); \ - if (!on_steal_input || \ - XTestStealKeyData((ev)->u.u.detail, (ev)->u.u.type, dev_type, \ - xtest_mousex, xtest_mousey)) \ - EqEnqueue((ev)) -#else /* ! XTESTEXT1 */ - -#define ENQUEUE(ev, code, direction, dev_type) \ - (ev)->u.u.detail = (code); \ - (ev)->u.u.type = (direction); \ - EqEnqueue((ev)) - -#endif - -/* - * The first of many hacks to get VT switching to work under - * Solaris 2.1 for x86. The basic problem is that Solaris is supposed - * to be SVR4. It is for the most part, except where the video interface - * is concerned. These hacks work around those problems. - * See the comments for Linux, and SCO. - * - * This is a toggling variable: - * FALSE = No VT switching keys have been pressed last time around - * TRUE = Possible VT switch Pending - * (DWH - 12/2/93) - * - * This has been generalised to work with Linux and *BSD+syscons (DHD) - */ - -#ifdef USE_VT_SYSREQ -Bool VTSysreqToggle = FALSE; -#endif /* !USE_VT_SYSREQ */ -Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for - *BSD and for avoiding VT - switches when using the DRI - automatic full screen mode.*/ - -extern fd_set EnabledDevices; - -#if defined(XQUEUE) -extern void xf86XqueRequest(void); -#endif -#ifdef XF86PM -extern void (*xf86OSPMClose)(void); -#endif - -static void xf86VTSwitch(void); - -/* - * Allow arbitrary drivers or other XFree86 code to register with our main - * Wakeup handler. - */ -typedef struct x_IHRec { - int fd; - InputHandlerProc ihproc; - pointer data; - Bool enabled; - struct x_IHRec * next; -} IHRec, *IHPtr; - -static IHPtr InputHandlers = NULL; - - -/* - * TimeSinceLastInputEvent -- - * Function used for screensaver purposes by the os module. Returns the - * time in milliseconds since there last was any input. - */ - -int -TimeSinceLastInputEvent() -{ - if (xf86Info.lastEventTime == 0) { - xf86Info.lastEventTime = GetTimeInMillis(); - } - return GetTimeInMillis() - xf86Info.lastEventTime; -} - - - -/* - * SetTimeSinceLastInputEvent -- - * Set the lastEventTime to now. - */ - -void -SetTimeSinceLastInputEvent() -{ - xf86Info.lastEventTime = GetTimeInMillis(); -} - - - -/* - * ProcessInputEvents -- - * Retrieve all waiting input events and pass them to DIX in their - * correct chronological order. Only reads from the system pointer - * and keyboard. - */ - -void -ProcessInputEvents () -{ - int x, y; -#ifdef INHERIT_LOCK_STATE - static int generation = 0; -#endif - - /* - * With INHERIT_LOCK_STATE defined, the initial state of CapsLock, NumLock - * and ScrollLock will be set to match that of the VT the server is - * running on. - */ -#ifdef INHERIT_LOCK_STATE - if (generation != serverGeneration) { - xEvent kevent; - DevicePtr pKeyboard = xf86Info.pKeyboard; - extern unsigned int xf86InitialCaps, xf86InitialNum, xf86InitialScroll; - - generation = serverGeneration; - kevent.u.keyButtonPointer.time = GetTimeInMillis(); - kevent.u.keyButtonPointer.rootX = 0; - kevent.u.keyButtonPointer.rootY = 0; - kevent.u.u.type = KeyPress; - - - if (xf86InitialCaps) { - kevent.u.u.detail = xf86InitialCaps; - (* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1); - xf86InitialCaps = 0; - } - if (xf86InitialNum) { - kevent.u.u.detail = xf86InitialNum; - (* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1); - xf86InitialNum = 0; - } - if (xf86InitialScroll) { - kevent.u.u.detail = xf86InitialScroll; - (* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1); - xf86InitialScroll = 0; - } - } -#endif - - xf86Info.inputPending = FALSE; - -#ifdef XINPUT - xf86eqProcessInputEvents(); -#else - mieqProcessInputEvents(); -#endif - miPointerUpdate(); - - miPointerPosition(&x, &y); - xf86SetViewport(xf86Info.currentScreen, x, y); -} - -void -xf86GrabServerCallback(CallbackListPtr *callbacks, pointer data, pointer args) -{ - ServerGrabInfoRec *grab = (ServerGrabInfoRec*)args; - - xf86Info.grabInfo.server.client = grab->client; - xf86Info.grabInfo.server.grabstate = grab->grabstate; -} - -/* - * Handle keyboard events that cause some kind of "action" - * (i.e., server termination, video mode changes, VT switches, etc.) - */ -void -xf86ProcessActionEvent(ActionEvent action, void *arg) -{ -#ifdef DEBUG - ErrorF("ProcessActionEvent(%d,%x)\n", (int) action, arg); -#endif - switch (action) { - case ACTION_TERMINATE: - if (!xf86Info.dontZap) { -#ifdef XFreeXDGA - DGAShutdown(); -#endif - GiveUp(0); - } - break; - case ACTION_NEXT_MODE: - if (!xf86Info.dontZoom) - xf86ZoomViewport(xf86Info.currentScreen, 1); - break; - case ACTION_PREV_MODE: - if (!xf86Info.dontZoom) - xf86ZoomViewport(xf86Info.currentScreen, -1); - break; - case ACTION_DISABLEGRAB: - if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowDeactivate) { - if (inputInfo.pointer && inputInfo.pointer->grab != NULL && - inputInfo.pointer->DeactivateGrab) - inputInfo.pointer->DeactivateGrab(inputInfo.pointer); - if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL && - inputInfo.keyboard->DeactivateGrab) - inputInfo.keyboard->DeactivateGrab(inputInfo.keyboard); - } - break; - case ACTION_CLOSECLIENT: - if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowClosedown) { - ClientPtr pointer, keyboard, server; - - pointer = keyboard = server = NULL; - if (inputInfo.pointer && inputInfo.pointer->grab != NULL) - pointer = clients[CLIENT_ID(inputInfo.pointer->grab->resource)]; - if (inputInfo.keyboard && inputInfo.keyboard->grab != NULL) { - keyboard = clients[CLIENT_ID(inputInfo.keyboard->grab->resource)]; - if (keyboard == pointer) - keyboard = NULL; - } - if ((xf86Info.grabInfo.server.grabstate == SERVER_GRABBED) && - (((server = xf86Info.grabInfo.server.client) == pointer) || - (server == keyboard))) - server = NULL; - - if (pointer) - CloseDownClient(pointer); - if (keyboard) - CloseDownClient(keyboard); - if (server) - CloseDownClient(server); - } - break; -#if !defined(__SOL8__) && !defined(__UNIXOS2__) && !defined(sgi) && \ - (!defined(sun) || defined(i386)) && defined(VT_ACTIVATE) - case ACTION_SWITCHSCREEN: - if (VTSwitchEnabled && !xf86Info.dontVTSwitch && arg) { - int vtno = *((int *) arg); -#if defined(__SCO__) || defined(__UNIXWARE__) - vtno--; -#endif -#if defined(QNX4) - xf86Info.vtRequestsPending = vtno; -#else - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) - ErrorF("Failed to switch consoles (%s)\n", strerror(errno)); -#endif - } - break; - case ACTION_SWITCHSCREEN_NEXT: - if (VTSwitchEnabled && !xf86Info.dontVTSwitch) { -/* Shouldn't this be true for (sun) && (i386) && (SVR4) ? */ -#if defined(__SCO__) || defined(__UNIXWARE__) - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0) -#else - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno + 1) < 0) -#endif -#if defined (__SCO__) || (defined(sun) && defined (i386) && defined (SVR4)) || defined(__UNIXWARE__) - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 0) < 0) -#else - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) < 0) -#endif - ErrorF("Failed to switch consoles (%s)\n", strerror(errno)); - } - break; - case ACTION_SWITCHSCREEN_PREV: - if (VTSwitchEnabled && !xf86Info.dontVTSwitch && xf86Info.vtno > 0) { - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno - 1) < 0) - ErrorF("Failed to switch consoles (%s)\n", strerror(errno)); - } - break; -#endif - case ACTION_MESSAGE: - { - char *retstr, *message = (char *) arg; - ScrnInfoPtr pScr = XF86SCRNINFO(xf86Info.currentScreen); - -#ifdef DEBUG - ErrorF("ActionMessage: '%s'\n", message); -#endif - /* Okay the message made it to the ddx. The common layer */ - /* can check for relevant messages here and react to any */ - /* that have a global effect. For example: */ - /* */ - /* if (!strcmp(message, "foo") { */ - /* do_foo(); break */ - /* } */ - /* */ - /* otherwise fallback to sending a key event message to */ - /* the current screen's driver: */ - if (*pScr->HandleMessage != NULL) { - (void) (*pScr->HandleMessage)(pScr->scrnIndex, - "KeyEventMessage", message, &retstr); - } - } - break; - default: - break; - } -} - -/* - * xf86PostKbdEvent -- - * Translate the raw hardware KbdEvent into an XEvent, and tell DIX - * about it. Scancode preprocessing and so on is done ... - * - * OS/2 specific xf86PostKbdEvent(key) has been moved to os-support/os2/os2_kbd.c - * as some things differ, and I did not want to scatter this routine with - * ifdefs further (hv). - */ - -#ifdef __linux__ -extern u_char SpecialServerMap[]; -#endif - -#if !defined(__UNIXOS2__) -void -xf86PostKbdEvent(unsigned key) -{ - int scanCode = (key & 0x7f); - int specialkey = 0; - Bool down = (key & 0x80 ? FALSE : TRUE); - KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key; - Bool updateLeds = FALSE; - Bool UsePrefix = FALSE; - Bool Direction = FALSE; - xEvent kevent; - KeySym *keysym; - int keycode; - static int lockkeys = 0; -#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) - static Bool first_time = TRUE; -#endif -#if defined(__sparc__) && defined(__linux__) - static int kbdSun = -1; -#endif - /* Disable any keyboard processing while in suspend */ - if (xf86inSuspend) - return; - -#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) - if (first_time) - { - first_time = FALSE; - VTSwitchEnabled = (xf86Info.consType == SYSCONS) - || (xf86Info.consType == PCVT); - } -#endif - -#if defined (__sparc__) && defined(__linux__) - if (kbdSun == -1) { - if ((xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun")) - || (xf86Info.xkbrules && !strcmp(xf86Info.xkbrules, "sun"))) - kbdSun = 1; - else - kbdSun = 0; - } - if (kbdSun) - goto special; -#endif /* __sparc__ && __linux__ */ - -#ifdef __linux__ - if (xf86Info.kbdCustomKeycodes) { - specialkey = SpecialServerMap[scanCode]; - goto customkeycodes; - } -#endif - - /* - * First do some special scancode remapping ... - */ - if (xf86Info.scanPrefix == 0) { - - switch (scanCode) { - case KEY_Prefix0: - case KEY_Prefix1: -#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) - if (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS - || xf86Info.consType == PCVT -#ifdef WSCONS_SUPPORT - || (xf86Info.consType == WSCONS && xf86Info.kbdEvents != xf86WSKbdEvents) -#endif - ) { -#endif - xf86Info.scanPrefix = scanCode; /* special prefixes */ - return; -#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) - } - break; -#endif - } -#if defined (i386) && defined (SVR4) - /* - * PANIX returns DICOP standards based keycodes in using 106jp - * keyboard. We need to remap some keys. - */ - if(xf86Info.panix106 == TRUE){ - switch (scanCode) { - case 0x56: scanCode = KEY_BSlash2; break; /* Backslash */ - case 0x5A: scanCode = KEY_NFER; break; /* No Kanji Transfer*/ - case 0x5B: scanCode = KEY_XFER; break; /* Kanji Tranfer */ - case 0x5C: scanCode = KEY_Yen; break; /* Yen curs pgup */ - case 0x6B: scanCode = KEY_Left; break; /* Cur Left */ - case 0x6F: scanCode = KEY_PgUp; break; /* Cur PageUp */ - case 0x72: scanCode = KEY_AltLang; break; /* AltLang(right) */ - case 0x73: scanCode = KEY_RCtrl; break; /* not needed */ - } - } else -#endif /* i386 && SVR4 */ - { - switch (scanCode) { - case 0x59: scanCode = KEY_0x59; break; - case 0x5a: scanCode = KEY_0x5A; break; - case 0x5b: scanCode = KEY_0x5B; break; - case 0x5c: scanCode = KEY_KP_Equal; break; /* Keypad Equal */ - case 0x5d: scanCode = KEY_0x5D; break; - case 0x5e: scanCode = KEY_0x5E; break; - case 0x5f: scanCode = KEY_0x5F; break; - case 0x62: scanCode = KEY_0x62; break; - case 0x63: scanCode = KEY_0x63; break; - case 0x64: scanCode = KEY_0x64; break; - case 0x65: scanCode = KEY_0x65; break; - case 0x66: scanCode = KEY_0x66; break; - case 0x67: scanCode = KEY_0x67; break; - case 0x68: scanCode = KEY_0x68; break; - case 0x69: scanCode = KEY_0x69; break; - case 0x6a: scanCode = KEY_0x6A; break; - case 0x6b: scanCode = KEY_0x6B; break; - case 0x6c: scanCode = KEY_0x6C; break; - case 0x6d: scanCode = KEY_0x6D; break; - case 0x6e: scanCode = KEY_0x6E; break; - case 0x6f: scanCode = KEY_0x6F; break; - case 0x70: scanCode = KEY_0x70; break; - case 0x71: scanCode = KEY_0x71; break; - case 0x72: scanCode = KEY_0x72; break; - case 0x73: scanCode = KEY_0x73; break; - case 0x74: scanCode = KEY_0x74; break; - case 0x75: scanCode = KEY_0x75; break; - case 0x76: scanCode = KEY_0x76; break; - } - } - } - - else if ( -#ifdef CSRG_BASED - (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS - || xf86Info.consType == PCVT -#ifdef WSCONS_SUPPORT - || (xf86Info.consType == WSCONS && xf86Info.kbdEvents != - xf86WSKbdEvents) -#endif - ) && -#endif - (xf86Info.scanPrefix == KEY_Prefix0)) { - xf86Info.scanPrefix = 0; - - switch (scanCode) { - case KEY_KP_7: scanCode = KEY_Home; break; /* curs home */ - case KEY_KP_8: scanCode = KEY_Up; break; /* curs up */ - case KEY_KP_9: scanCode = KEY_PgUp; break; /* curs pgup */ - case KEY_KP_4: scanCode = KEY_Left; break; /* curs left */ - case KEY_KP_5: scanCode = KEY_Begin; break; /* curs begin */ - case KEY_KP_6: scanCode = KEY_Right; break; /* curs right */ - case KEY_KP_1: scanCode = KEY_End; break; /* curs end */ - case KEY_KP_2: scanCode = KEY_Down; break; /* curs down */ - case KEY_KP_3: scanCode = KEY_PgDown; break; /* curs pgdown */ - case KEY_KP_0: scanCode = KEY_Insert; break; /* curs insert */ - case KEY_KP_Decimal: scanCode = KEY_Delete; break; /* curs delete */ - case KEY_Enter: scanCode = KEY_KP_Enter; break; /* keypad enter */ - case KEY_LCtrl: scanCode = KEY_RCtrl; break; /* right ctrl */ - case KEY_KP_Multiply: scanCode = KEY_Print; break; /* print */ - case KEY_Slash: scanCode = KEY_KP_Divide; break; /* keyp divide */ - case KEY_Alt: scanCode = KEY_AltLang; break; /* right alt */ - case KEY_ScrollLock: scanCode = KEY_Break; break; /* curs break */ - case 0x5b: scanCode = KEY_LMeta; break; - case 0x5c: scanCode = KEY_RMeta; break; - case 0x5d: scanCode = KEY_Menu; break; - case KEY_F3: scanCode = KEY_F13; break; - case KEY_F4: scanCode = KEY_F14; break; - case KEY_F5: scanCode = KEY_F15; break; - case KEY_F6: scanCode = KEY_F16; break; - case KEY_F7: scanCode = KEY_F17; break; - case KEY_KP_Plus: scanCode = KEY_KP_DEC; break; - /* - * Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6) - */ - case 0x2A: - case 0x36: - return; - default: - xf86MsgVerb(X_INFO, 4, "Unreported Prefix0 scancode: 0x%02x\n", - scanCode); - /* - * "Internet" keyboards are generating lots of new codes. Let them - * pass. There is little consistency between them, so don't bother - * with symbolic names at this level. - */ - scanCode += 0x78; - } - } - - else if (xf86Info.scanPrefix == KEY_Prefix1) - { - xf86Info.scanPrefix = (scanCode == KEY_LCtrl) ? KEY_LCtrl : 0; - return; - } - - else if (xf86Info.scanPrefix == KEY_LCtrl) - { - xf86Info.scanPrefix = 0; - if (scanCode != KEY_NumLock) return; - scanCode = KEY_Pause; /* pause */ - } - -#ifndef __sparc64__ - /* - * PC keyboards generate separate key codes for - * Alt+Print and Control+Pause but in the X keyboard model - * they need to get the same key code as the base key on the same - * physical keyboard key. - */ - if (scanCode == KEY_SysReqest) - scanCode = KEY_Print; - else if (scanCode == KEY_Break) - scanCode = KEY_Pause; -#endif - - /* - * and now get some special keysequences - */ - - specialkey = scanCode; - -#ifdef __linux__ -customkeycodes: -#endif -#if defined(i386) || defined(__i386__) - if (xf86IsPc98()) { - switch (scanCode) { - case 0x0e: specialkey = 0x0e; break; /* KEY_BackSpace */ - case 0x40: specialkey = 0x4a; break; /* KEY_KP_Minus */ - case 0x49: specialkey = 0x4e; break; /* KEY_KP_Plus */ - - /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */ - - case 0x62: specialkey = 0x3b; break; /* KEY_F1 */ - case 0x63: specialkey = 0x3c; break; /* KEY_F2 */ - case 0x64: specialkey = 0x3d; break; /* KEY_F3 */ - case 0x65: specialkey = 0x3e; break; /* KEY_F4 */ - case 0x66: specialkey = 0x3f; break; /* KEY_F5 */ - case 0x67: specialkey = 0x40; break; /* KEY_F6 */ - case 0x68: specialkey = 0x41; break; /* KEY_F7 */ - case 0x69: specialkey = 0x42; break; /* KEY_F8 */ - case 0x6a: specialkey = 0x43; break; /* KEY_F9 */ - case 0x6b: specialkey = 0x44; break; /* KEY_F10 */ - /* case 0x73: specialkey = 0x38; break; KEY_Alt */ - /* case 0x74: specialkey = 0x1d; break; KEY_LCtrl */ - default: specialkey = 0x00; break; - } - } -#endif -#if defined (__sparc__) && defined(__linux__) -special: - if (kbdSun) { - switch (scanCode) { - case 0x2b: specialkey = KEY_BackSpace; break; - case 0x47: specialkey = KEY_KP_Minus; break; - case 0x7d: specialkey = KEY_KP_Plus; break; - - /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */ - - case 0x05: specialkey = KEY_F1; break; - case 0x06: specialkey = KEY_F2; break; - case 0x08: specialkey = KEY_F3; break; - case 0x0a: specialkey = KEY_F4; break; - case 0x0c: specialkey = KEY_F5; break; - case 0x0e: specialkey = KEY_F6; break; - case 0x10: specialkey = KEY_F7; break; - case 0x11: specialkey = KEY_F8; break; - case 0x12: specialkey = KEY_F9; break; - case 0x07: specialkey = KEY_F10; break; - case 0x09: specialkey = KEY_F11; break; - case 0x0b: specialkey = KEY_F12; break; - default: specialkey = 0; break; - } - /* - * XXX XXX XXX: - * - * I really don't know what's wrong here, but passing the real - * scanCode offsets by one from XKB's point of view. - * - * (ecd@skynet.be, 980405) - */ - scanCode--; - } -#endif /* defined (__sparc__) && defined(__linux__) */ - -#ifdef XKB - if ((xf86Info.ddxSpecialKeys == SKWhenNeeded && - !xf86Info.ActionKeyBindingsSet) || - noXkbExtension || xf86Info.ddxSpecialKeys == SKAlways) { -#endif - if (!(ModifierDown(ShiftMask)) && - ((ModifierDown(ControlMask | AltMask)) || - (ModifierDown(ControlMask | AltLangMask)))) - { - switch (specialkey) { - - case KEY_BackSpace: - xf86ProcessActionEvent(ACTION_TERMINATE, NULL); - break; - - /* - * Check grabs - */ - case KEY_KP_Divide: - xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL); - break; - case KEY_KP_Multiply: - xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL); - break; - - /* - * Video mode switches - */ - case KEY_KP_Minus: /* Keypad - */ - if (down) xf86ProcessActionEvent(ACTION_PREV_MODE, NULL); - if (!xf86Info.dontZoom) return; - break; - - case KEY_KP_Plus: /* Keypad + */ - if (down) xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL); - if (!xf86Info.dontZoom) return; - break; - - /* Under QNX4, we set the vtPending flag for VT switching and - * let the VT switch function do the rest... - * This is a little different from the other OS'es. - */ -#if defined(QNX4) - case KEY_1: - case KEY_2: - case KEY_3: - case KEY_4: - case KEY_5: - case KEY_6: - case KEY_7: - case KEY_8: - case KEY_9: - if (VTSwitchEnabled && !xf86Info.dontVTSwitch) { - if (down) { - int vtno = specialkey - KEY_1 + 1; - xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno); - } - return; - } - break; -#endif - -#if defined(linux) || (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT))) || defined(__SCO__) || defined(__UNIXWARE__) - /* - * Under Linux, the raw keycodes are consumed before the kernel - * does any processing on them, so we must emulate the vt switching - * we want ourselves. - */ - case KEY_F1: - case KEY_F2: - case KEY_F3: - case KEY_F4: - case KEY_F5: - case KEY_F6: - case KEY_F7: - case KEY_F8: - case KEY_F9: - case KEY_F10: - case KEY_F11: - case KEY_F12: - if ((VTSwitchEnabled && !xf86Info.vtSysreq && !xf86Info.dontVTSwitch) -#if (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT))) - && (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) -#endif - ) { - int vtno = specialkey - KEY_F1 + 1; - if (specialkey == KEY_F11 || specialkey == KEY_F12) - vtno = specialkey - KEY_F11 + 11; - if (down) - xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno); - return; - } - break; -#endif /* linux || BSD with VTs */ - - /* just worth mentioning here: any 386bsd keyboard driver - * (pccons.c or co_kbd.c) catches CTRL-ALT-DEL and CTRL-ALT-ESC - * before any application (e.g. XF86) will see it - * OBS: syscons does not, nor does pcvt ! - */ - } - } - - /* - * Start of actual Solaris VT switching code. - * This should pretty much emulate standard SVR4 switching keys. - * - * DWH 12/2/93 - */ - -#ifdef USE_VT_SYSREQ - if (VTSwitchEnabled && xf86Info.vtSysreq && !xf86Info.dontVTSwitch) - { - switch (specialkey) - { - /* - * syscons on *BSD doesn't have a VT #0 -- don't think Linux does - * either - */ -#if defined (sun) && defined (i386) && defined (SVR4) - case KEY_H: - if (VTSysreqToggle && down) - { - xf86ProcessActionEvent(ACTION_SWITCHSCREEN, NULL); - VTSysreqToggle = 0; - return; - } - break; - - /* - * Yah, I know the N, and P keys seem backwards, however that's - * how they work under Solaris - * XXXX N means go to next active VT not necessarily vtno+1 (or vtno-1) - */ - - case KEY_N: - if (VTSysreqToggle && down) - { - xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL); - VTSysreqToggle = FALSE; - return; - } - break; - - case KEY_P: - if (VTSysreqToggle && down) - { - xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL); - VTSysreqToggle = FALSE; - return; - } - break; -#endif - - case KEY_F1: - case KEY_F2: - case KEY_F3: - case KEY_F4: - case KEY_F5: - case KEY_F6: - case KEY_F7: - case KEY_F8: - case KEY_F9: - case KEY_F10: - case KEY_F11: - case KEY_F12: - if (VTSysreqToggle && down) - { int vtno = specialkey - KEY_F1 + 1; - if (specialkey == KEY_F11 || specialkey == KEY_F12) - vtno = specialkey - KEY_F11 + 11; - xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno); - VTSysreqToggle = FALSE; - return; - } - break; - - /* Ignore these keys -- ie don't let them cancel an alt-sysreq */ - case KEY_Alt: - case KEY_AltLang: - break; - - case KEY_SysReqest: - if (down && (ModifierDown(AltMask) || ModifierDown(AltLangMask))) - VTSysreqToggle = TRUE; - break; - - default: - if (VTSysreqToggle) - { - /* - * We only land here when Alt-SysReq is followed by a - * non-switching key. - */ - VTSysreqToggle = FALSE; - - } - } - } - -#endif /* USE_VT_SYSREQ */ - -#ifdef __SCO__ - /* - * With the console in raw mode, SCO will not switch consoles, - * you get around this by activating the next console along, if - * this fails then go back to console 0, if there is only one - * then it doesn't matter, switching to yourself is a nop as far - * as the console driver is concerned. - * We could do something similar to linux here but SCO ODT uses - * Ctrl-PrintScrn, so why change? - */ - if (specialkey == KEY_Print && ModifierDown(ControlMask)) { - if (down) - xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL); - return; - } -#endif /* __SCO__ */ -#ifdef XKB - } -#endif - - /* - * Now map the scancodes to real X-keycodes ... - */ - keycode = scanCode + MIN_KEYCODE; - keysym = (keyc->curKeySyms.map + - keyc->curKeySyms.mapWidth * - (keycode - keyc->curKeySyms.minKeyCode)); -#ifdef XKB - if (noXkbExtension) { -#endif - /* - * Filter autorepeated caps/num/scroll lock keycodes. - */ -#define CAPSFLAG 0x01 -#define NUMFLAG 0x02 -#define SCROLLFLAG 0x04 -#define MODEFLAG 0x08 - if( down ) { - switch( keysym[0] ) { - case XK_Caps_Lock : - if (lockkeys & CAPSFLAG) - return; - else - lockkeys |= CAPSFLAG; - break; - - case XK_Num_Lock : - if (lockkeys & NUMFLAG) - return; - else - lockkeys |= NUMFLAG; - break; - - case XK_Scroll_Lock : - if (lockkeys & SCROLLFLAG) - return; - else - lockkeys |= SCROLLFLAG; - break; - } - if (keysym[1] == XF86XK_ModeLock) - { - if (lockkeys & MODEFLAG) - return; - else - lockkeys |= MODEFLAG; - } - - } - else { - switch( keysym[0] ) { - case XK_Caps_Lock : - lockkeys &= ~CAPSFLAG; - break; - - case XK_Num_Lock : - lockkeys &= ~NUMFLAG; - break; - - case XK_Scroll_Lock : - lockkeys &= ~SCROLLFLAG; - break; - } - if (keysym[1] == XF86XK_ModeLock) - lockkeys &= ~MODEFLAG; - } - - /* - * LockKey special handling: - * ignore releases, toggle on & off on presses. - * Don't deal with the Caps_Lock keysym directly, but check the lock modifier - */ - if (keyc->modifierMap[keycode] & LockMask || - keysym[0] == XK_Scroll_Lock || - keysym[1] == XF86XK_ModeLock || - keysym[0] == XK_Num_Lock) - { - Bool flag; - - if (!down) return; - if (KeyPressed(keycode)) { - down = !down; - flag = FALSE; - } - else - flag = TRUE; - - if (keyc->modifierMap[keycode] & LockMask) xf86Info.capsLock = flag; - if (keysym[0] == XK_Num_Lock) xf86Info.numLock = flag; - if (keysym[0] == XK_Scroll_Lock) xf86Info.scrollLock = flag; - if (keysym[1] == XF86XK_ModeLock) xf86Info.modeSwitchLock = flag; - updateLeds = TRUE; - } - - if (!xf86Info.kbdCustomKeycodes) { - /* - * normal, non-keypad keys - */ - if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) { -#if !defined(CSRG_BASED) && \ - !defined(__GNU__) && \ - defined(KB_84) - /* - * magic ALT_L key on AT84 keyboards for multilingual support - */ - if (xf86Info.kbdType == KB_84 && - ModifierDown(AltMask) && - keysym[2] != NoSymbol) - { - UsePrefix = TRUE; - Direction = TRUE; - } -#endif /* !CSRG_BASED && ... */ - } - } - if (updateLeds) xf86UpdateKbdLeds(); -#ifdef XKB - } -#endif - - /* - * check for an autorepeat-event - */ - if (down && KeyPressed(keycode)) { - KbdFeedbackClassRec *kbdfeed = ((DeviceIntPtr)xf86Info.pKeyboard)->kbdfeed; - if ((xf86Info.autoRepeat != AutoRepeatModeOn) || - keyc->modifierMap[keycode] || - (kbdfeed && !(kbdfeed->ctrl.autoRepeats[keycode>>3] & ( 1<<(keycode&7) )))) - return; - } - - - xf86Info.lastEventTime = kevent.u.keyButtonPointer.time = GetTimeInMillis(); - /* - * And now send these prefixes ... - * NOTE: There cannot be multiple Mode_Switch keys !!!! - */ - if (UsePrefix) - { - ENQUEUE(&kevent, - keyc->modifierKeyMap[keyc->maxKeysPerModifier*7], - (Direction ? KeyPress : KeyRelease), - XE_KEYBOARD); - ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD); - ENQUEUE(&kevent, - keyc->modifierKeyMap[keyc->maxKeysPerModifier*7], - (Direction ? KeyRelease : KeyPress), - XE_KEYBOARD); - } - else - { - ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD); - } -} -#endif /* !__UNIXOS2__ */ - -#define ModifierIsSet(k) ((modifiers & (k)) == (k)) - -Bool -xf86CommonSpecialKey(int key, Bool down, int modifiers) -{ - if ((!ModifierIsSet(ShiftMask)) && - (((ModifierIsSet(ControlMask | AltMask)) || - (ModifierIsSet(ControlMask | AltLangMask))))) { - switch (key) { - - case KEY_BackSpace: - xf86ProcessActionEvent(ACTION_TERMINATE, NULL); - break; - - /* - * Check grabs - */ - case KEY_KP_Divide: - xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL); - break; - case KEY_KP_Multiply: - xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL); - break; - - /* - * The idea here is to pass the scancode down to a list of - * registered routines. There should be some standard conventions - * for processing certain keys. - */ - case KEY_KP_Minus: /* Keypad - */ - if (down) xf86ProcessActionEvent(ACTION_PREV_MODE, NULL); - if (!xf86Info.dontZoom) return TRUE; - break; - - case KEY_KP_Plus: /* Keypad + */ - if (down) xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL); - if (!xf86Info.dontZoom) return TRUE; - break; - } - } - return FALSE; -} - -/* - * xf86Wakeup -- - * Os wakeup handler. - */ - -/* ARGSUSED */ -void -xf86Wakeup(pointer blockData, int err, pointer pReadmask) -{ -#if !defined(__UNIXOS2__) && !defined(__QNX__) - fd_set* LastSelectMask = (fd_set*)pReadmask; - fd_set devicesWithInput; - InputInfoPtr pInfo; - - if (err >= 0) { - - XFD_ANDSET(&devicesWithInput, LastSelectMask, &EnabledDevices); - if (XFD_ANYSET(&devicesWithInput)) { - if (xf86Info.kbdEvents) - (xf86Info.kbdEvents)(); - pInfo = xf86InputDevs; - while (pInfo) { - if (pInfo->read_input && pInfo->fd >= 0 && - (FD_ISSET(pInfo->fd, &devicesWithInput) != 0)) { - int sigstate = xf86BlockSIGIO(); - - pInfo->read_input(pInfo); - xf86UnblockSIGIO(sigstate); - /* - * Remove the descriptior from the set because more than one - * device may share the same file descriptor. - */ - FD_CLR(pInfo->fd, &devicesWithInput); - } - pInfo = pInfo->next; - } - } - } -#else /* __UNIXOS2__ and __QNX__ */ - - InputInfoPtr pInfo; - - (xf86Info.kbdEvents)(); /* Under OS/2 and QNX, always call */ - - pInfo = xf86InputDevs; - while (pInfo) { - if (pInfo->read_input && pInfo->fd >= 0) { - int sigstate = xf86BlockSIGIO(); - - pInfo->read_input(pInfo); - xf86UnblockSIGIO(sigstate); - /* - * Must break here because more than one device may share - * the same file descriptor. - */ - break; - } - pInfo = pInfo->next; - } - -#endif /* __UNIXOS2__ and __QNX__ */ - - if (err >= 0) { /* we don't want the handlers called if select() */ - IHPtr ih; /* returned with an error condition, do we? */ - - for (ih = InputHandlers; ih; ih = ih->next) { - if (ih->enabled && ih->fd >= 0 && ih->ihproc && - (FD_ISSET(ih->fd, ((fd_set *)pReadmask)) != 0)) { - ih->ihproc(ih->fd, ih->data); - } - } - } - - if (xf86VTSwitchPending()) xf86VTSwitch(); - - if (xf86Info.inputPending) ProcessInputEvents(); -} - - -/* - * xf86SigioReadInput -- - * signal handler for the SIGIO signal. - */ -static void -xf86SigioReadInput(int fd, - void *closure) -{ - int sigstate = xf86BlockSIGIO(); - InputInfoPtr pInfo = (InputInfoPtr) closure; - - pInfo->read_input(pInfo); - - xf86UnblockSIGIO(sigstate); -} - -/* - * xf86AddEnabledDevice -- - * - */ -void -xf86AddEnabledDevice(InputInfoPtr pInfo) -{ - if (!xf86InstallSIGIOHandler (pInfo->fd, xf86SigioReadInput, pInfo)) { - AddEnabledDevice(pInfo->fd); - } -} - -/* - * xf86RemoveEnabledDevice -- - * - */ -void -xf86RemoveEnabledDevice(InputInfoPtr pInfo) -{ - if (!xf86RemoveSIGIOHandler (pInfo->fd)) { - RemoveEnabledDevice(pInfo->fd); - } -} - -static int *xf86SignalIntercept = NULL; - -void -xf86InterceptSignals(int *signo) -{ - if ((xf86SignalIntercept = signo)) - *signo = -1; -} - -static void (*xf86SigIllHandler)(void) = NULL; - -void -xf86InterceptSigIll(void (*sigillhandler)(void)) -{ - xf86SigIllHandler = sigillhandler; -} - -#ifdef HAVE_EXECINFO_H -#define HAVE_BACKTRACE -#include -#endif - -#ifdef HAVE_BACKTRACE - -static __inline__ void xorg_backtrace(void) -{ - void *array[32]; /* deeper nesting than this means something's wrong */ - size_t size, i; - char **strings; - ErrorF("\nBacktrace:\n"); - size = backtrace(array, 32); - strings = backtrace_symbols(array, size); - for (i = 0; i < size; i++) - ErrorF("%d: %s\n", i, strings[i]); - free(strings); -} - -#else /* not glibc or glibc < 2.1 */ - -# if defined(sun) && defined(__SVR4) -# define HAVE_PSTACK -# endif - -# if defined(HAVE_WALKCONTEXT) /* Solaris 9 & later */ - -# include -# include -# include -# include - -#ifdef _LP64 -# define ElfSym Elf64_Sym -#else -# define ElfSym Elf32_Sym -#endif - -/* Called for each frame on the stack to print it's contents */ -static int xorg_backtrace_frame(uintptr_t pc, int signo, void *arg) -{ - Dl_info dlinfo; - ElfSym *dlsym; - char header[32]; - int depth = *((int *) arg); - - if (signo) { - char signame[SIG2STR_MAX]; - - if (sig2str(signo, signame) != 0) { - strcpy(signame, "unknown"); - } - - ErrorF("** Signal %d (%s)\n", signo, signame); - } - - snprintf(header, sizeof(header), "%d: 0x%lx", depth, pc); - *((int *) arg) = depth + 1; - - /* Ask system dynamic loader for info on the address */ - if (dladdr1((void *) pc, &dlinfo, (void **) &dlsym, RTLD_DL_SYMENT)) { - unsigned long offset = pc - (uintptr_t) dlinfo.dli_saddr; - const char *symname; - - if (offset < dlsym->st_size) { /* inside a function */ - symname = dlinfo.dli_sname; - } else { /* found which file it was in, but not which function */ - symname = "
"; - offset = pc - (uintptr_t)dlinfo.dli_fbase; - } - ErrorF("%s: %s:%s+0x%lx\n", header, dlinfo.dli_fname, - symname, offset); - - } else { - /* Couldn't find symbol info from system dynamic loader, should - * probably poke elfloader here, but haven't written that code yet, - * so we just print the pc. - */ - ErrorF("%s\n", header); - } - - return 0; -} -# endif /* HAVE_WALKCONTEXT */ - -# ifdef HAVE_PSTACK -static int xorg_backtrace_pstack(void) { - pid_t kidpid; - int pipefd[2]; - - if (pipe(pipefd) != 0) { - return -1; - } - - kidpid = fork1(); - - if (kidpid == -1) { - /* ERROR */ - return -1; - } else if (kidpid == 0) { - /* CHILD */ - char parent[16]; - - seteuid(0); - close(STDIN_FILENO); - close(STDOUT_FILENO); - dup2(pipefd[1],STDOUT_FILENO); - closefrom(STDERR_FILENO); - - snprintf(parent, sizeof(parent), "%d", getppid()); - execle("/usr/bin/pstack", "pstack", parent, NULL); - exit(1); - } else { - /* PARENT */ - char btline[256]; - int kidstat; - int bytesread; - int done = 0; - - close(pipefd[1]); - - while (!done) { - bytesread = read(pipefd[0], btline, sizeof(btline) - 1); - - if (bytesread > 0) { - btline[bytesread] = 0; - ErrorF("%s", btline); - } - else if ((bytesread < 0) || - ((errno != EINTR) && (errno != EAGAIN))) - done = 1; - } - close(pipefd[0]); - waitpid(kidpid, &kidstat, 0); - if (kidstat != 0) - return -1; - } - return 0; -} -# endif /* HAVE_PSTACK */ - - -# if defined(HAVE_PSTACK) || defined(HAVE_WALKCONTEXT) - -static __inline__ void xorg_backtrace(void) { - - ErrorF("\nBacktrace:\n"); - -# ifdef HAVE_PSTACK -/* First try fork/exec of pstack - otherwise fall back to walkcontext - pstack is preferred since it can print names of non-exported functions */ - - if (xorg_backtrace_pstack() < 0) -# endif - { -# ifdef HAVE_WALKCONTEXT - ucontext_t u; - int depth = 1; - - if (getcontext(&u) == 0) - walkcontext(&u, xorg_backtrace_frame, &depth); - else -# endif - Error("Failed to get backtrace info"); - } - ErrorF("\n"); -} - -# else - -/* Default fallback if we can't find any way to get a backtrace */ -static __inline__ void xorg_backtrace(void) { return; } - -# endif -#endif - -/* - * xf86SigHandler -- - * Catch unexpected signals and exit or continue cleanly. - */ -void -xf86SigHandler(int signo) -{ - if ((signo == SIGILL) && xf86SigIllHandler) { - (*xf86SigIllHandler)(); - /* Re-arm handler just in case we unexpectedly return here */ - (void) signal(signo, xf86SigHandler); - return; - } - - if (xf86SignalIntercept && (*xf86SignalIntercept < 0)) { - *xf86SignalIntercept = signo; - /* Re-arm handler just in case */ - (void) signal(signo, xf86SigHandler); - return; - } - - signal(signo,SIG_IGN); - xf86Info.caughtSignal = TRUE; -#ifdef XF86BIGFONT - XF86BigfontCleanup(); -#endif -#if defined(XFree86LOADER) - if (xf86Initialising) - LoaderCheckUnresolved(LD_RESOLV_IFDONE); - ErrorF("\n" - " *** If unresolved symbols were reported above, they might not\n" - " *** be the reason for the server aborting.\n"); -#endif - - xorg_backtrace(); - - FatalError("Caught signal %d. Server aborting\n", signo); -} - -#ifdef MEMDEBUG -void -xf86SigMemDebug(int signo) -{ - CheckMemory(); - (void) signal(signo, xf86SigMemDebug); - return; -} -#endif - -/* - * xf86VTSwitch -- - * Handle requests for switching the vt. - */ -static void -xf86VTSwitch() -{ - int i, prevSIGIO; - InputInfoPtr pInfo; - IHPtr ih; - -#ifdef DEBUG - ErrorF("xf86VTSwitch()\n"); -#endif - -#ifdef XFreeXDGA - if(!DGAVTSwitch()) - return; -#endif - - /* - * Since all screens are currently all in the same state it is sufficient - * check the first. This might change in future. - */ - if (xf86Screens[0]->vtSema) { - -#ifdef DEBUG - ErrorF("xf86VTSwitch: Leaving, xf86Exiting is %s\n", - BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE)); -#endif -#ifdef DPMSExtension - if (DPMSPowerLevel != DPMSModeOn) - DPMSSet(DPMSModeOn); -#endif - for (i = 0; i < xf86NumScreens; i++) { - if (!(dispatchException & DE_TERMINATE)) - if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE); - } -#if !defined(__UNIXOS2__) - - /* - * Keep the order: Disable Device > LeaveVT - * EnterVT > EnableDevice - */ - DisableDevice((DeviceIntPtr)xf86Info.pKeyboard); - pInfo = xf86InputDevs; - while (pInfo) { - DisableDevice(pInfo->dev); - pInfo = pInfo->next; - } -#endif /* !__UNIXOS2__ */ - xf86EnterServerState(SETUP); - for (i = 0; i < xf86NumScreens; i++) - xf86Screens[i]->LeaveVT(i, 0); - - for (ih = InputHandlers; ih; ih = ih->next) - xf86DisableInputHandler(ih); - xf86AccessLeave(); /* We need this here, otherwise */ - xf86AccessLeaveState(); /* console won't be restored */ - - if (!xf86VTSwitchAway()) { - /* - * switch failed - */ - -#ifdef DEBUG - ErrorF("xf86VTSwitch: Leave failed\n"); -#endif - prevSIGIO = xf86BlockSIGIO(); - xf86AccessEnter(); - xf86EnterServerState(SETUP); - for (i = 0; i < xf86NumScreens; i++) { - if (!xf86Screens[i]->EnterVT(i, 0)) - FatalError("EnterVT failed for screen %d\n", i); - } - xf86EnterServerState(OPERATING); - if (!(dispatchException & DE_TERMINATE)) { - for (i = 0; i < xf86NumScreens; i++) { - if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE); - } - } - SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); - -#if !defined(__UNIXOS2__) - EnableDevice((DeviceIntPtr)xf86Info.pKeyboard); - pInfo = xf86InputDevs; - while (pInfo) { - EnableDevice(pInfo->dev); - pInfo = pInfo->next; - } -#endif /* !__UNIXOS2__ */ - for (ih = InputHandlers; ih; ih = ih->next) - xf86EnableInputHandler(ih); - - xf86UnblockSIGIO(prevSIGIO); - - } else { -#ifdef XF86PM - if (xf86OSPMClose) - xf86OSPMClose(); - xf86OSPMClose = NULL; -#endif - - for (i = 0; i < xf86NumScreens; i++) { - /* - * zero all access functions to - * trap calls when switched away. - */ - xf86Screens[i]->vtSema = FALSE; - xf86Screens[i]->access = NULL; - xf86Screens[i]->busAccess = NULL; - } - if (xorgHWAccess) - xf86DisableIO(); - } - } else { - -#ifdef DEBUG - ErrorF("xf86VTSwitch: Entering\n"); -#endif - if (!xf86VTSwitchTo()) return; - - prevSIGIO = xf86BlockSIGIO(); -#ifdef XF86PM - xf86OSPMClose = xf86OSPMOpen(); -#endif - - if (xorgHWAccess) - xf86EnableIO(); - xf86AccessEnter(); - xf86EnterServerState(SETUP); - for (i = 0; i < xf86NumScreens; i++) { - xf86Screens[i]->vtSema = TRUE; - if (!xf86Screens[i]->EnterVT(i, 0)) - FatalError("EnterVT failed for screen %d\n", i); - } - xf86EnterServerState(OPERATING); - for (i = 0; i < xf86NumScreens; i++) { - if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess)(i, TRUE); - } - - /* Turn screen saver off when switching back */ - SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset); - -#if !defined(__UNIXOS2__) - EnableDevice((DeviceIntPtr)xf86Info.pKeyboard); - pInfo = xf86InputDevs; - while (pInfo) { - EnableDevice(pInfo->dev); - pInfo = pInfo->next; - } -#endif /* !__UNIXOS2__ */ - - for (ih = InputHandlers; ih; ih = ih->next) - xf86EnableInputHandler(ih); - - xf86UnblockSIGIO(prevSIGIO); - } -} - - -/* Input handler registration */ - -pointer -xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data) -{ - IHPtr ih; - - if (fd < 0 || !proc) - return NULL; - - ih = xcalloc(sizeof(*ih), 1); - if (!ih) - return NULL; - - ih->fd = fd; - ih->ihproc = proc; - ih->data = data; - ih->enabled = TRUE; - - ih->next = InputHandlers; - InputHandlers = ih; - - AddEnabledDevice(fd); - - return ih; -} - -int -xf86RemoveInputHandler(pointer handler) -{ - IHPtr ih, p; - int fd; - - if (!handler) - return -1; - - ih = handler; - fd = ih->fd; - - if (ih->fd >= 0) - RemoveEnabledDevice(ih->fd); - - if (ih == InputHandlers) - InputHandlers = ih->next; - else { - p = InputHandlers; - while (p && p->next != ih) - p = p->next; - if (ih) - p->next = ih->next; - } - xfree(ih); - return fd; -} - -void -xf86DisableInputHandler(pointer handler) -{ - IHPtr ih; - - if (!handler) - return; - - ih = handler; - ih->enabled = FALSE; - if (ih->fd >= 0) - RemoveEnabledDevice(ih->fd); -} - -void -xf86EnableInputHandler(pointer handler) -{ - IHPtr ih; - - if (!handler) - return; - - ih = handler; - ih->enabled = TRUE; - if (ih->fd >= 0) - AddEnabledDevice(ih->fd); -} - -/* - * As used currently by the DRI, the return value is ignored. - */ -Bool -xf86EnableVTSwitch(Bool new) -{ - static Bool def = TRUE; - Bool old; - - old = VTSwitchEnabled; - if (!new) { - /* Disable VT switching */ - def = VTSwitchEnabled; - VTSwitchEnabled = FALSE; - } else { - /* Restore VT switching to default */ - VTSwitchEnabled = def; - } - return old; -} - -#ifdef XTESTEXT1 - -void -XTestGetPointerPos(short *fmousex, short *fmousey) -{ - int x,y; - - miPointerPosition(&x, &y); - *fmousex = x; - *fmousey = y; -} - - - -void -XTestJumpPointer(int jx, int jy, int dev_type) -{ - miPointerAbsoluteCursor(jx, jy, GetTimeInMillis() ); -} - -void -XTestGenerateEvent(int dev_type, int keycode, int keystate, int mousex, - int mousey) -{ - xEvent tevent; - - tevent.u.u.type = (dev_type == XE_POINTER) ? - (keystate == XTestKEY_UP) ? ButtonRelease : ButtonPress : - (keystate == XTestKEY_UP) ? KeyRelease : KeyPress; - tevent.u.u.detail = keycode; - tevent.u.keyButtonPointer.rootX = mousex; - tevent.u.keyButtonPointer.rootY = mousey; - tevent.u.keyButtonPointer.time = xf86Info.lastEventTime = GetTimeInMillis(); -#ifdef XINPUT - xf86eqEnqueue(&tevent); -#else - mieqEnqueue(&tevent); -#endif - xf86Info.inputPending = TRUE; /* virtual event */ -} - -#endif /* XTESTEXT1 */ - -void -xf86ReloadInputDevs(int sig) -{ - InputInfoPtr pInfo; - - signal(sig, (void(*)(int))xf86ReloadInputDevs); - - DisableDevice((DeviceIntPtr)xf86Info.pKeyboard); - EnableDevice((DeviceIntPtr)xf86Info.pKeyboard); - - pInfo = xf86InputDevs; - while (pInfo) { - DisableDevice(pInfo->dev); - EnableDevice(pInfo->dev); - pInfo = pInfo->next; - } - - return; -} - -#ifdef WSCONS_SUPPORT - -/* XXX Currently XKB is mandatory. */ - -extern int WSKbdToKeycode(int); - -void -xf86PostWSKbdEvent(struct wscons_event *event) -{ - int type = event->type; - int value = event->value; - unsigned int keycode; - int blocked; - - if (type == WSCONS_EVENT_KEY_UP || type == WSCONS_EVENT_KEY_DOWN) { - Bool down = (type == WSCONS_EVENT_KEY_DOWN ? TRUE : FALSE); - - /* map the scancodes to standard XFree86 scancode */ - keycode = WSKbdToKeycode(value); - if (!down) keycode |= 0x80; - /* It seems better to block SIGIO there */ - blocked = xf86BlockSIGIO(); - xf86PostKbdEvent(keycode); - xf86UnblockSIGIO(blocked); - } -} -#endif /* WSCONS_SUPPORT */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Globals.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Globals.c deleted file mode 100644 index 30fe10554..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Globals.c +++ /dev/null @@ -1,254 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v 1.42 2004/01/27 01:31:44 dawes Exp $ */ - -/* - * Copyright (c) 1997-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * This file contains all the XFree86 global variables. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "os.h" -#include "windowstr.h" -#include "propertyst.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Parser.h" -#include "xf86Xinput.h" -#include "xf86InPriv.h" - -/* Globals that video drivers may access */ - -int xf86ScreenIndex = -1; /* Index of ScrnInfo in pScreen.devPrivates */ -int xf86CreateRootWindowIndex = -1; /* Index into pScreen.devPrivates */ -ScrnInfoPtr *xf86Screens = NULL; /* List of ScrnInfos */ -int xf86PixmapIndex = 0; -const unsigned char byte_reversed[256] = -{ - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, - 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, - 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, - 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, - 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, - 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, - 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, - 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, - 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, - 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, - 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, - 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, - 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, - 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, - 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, - 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, - 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, - 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, - 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, - 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, - 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, - 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, - 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, - 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, - 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, - 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, - 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, - 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, - 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, - 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, - 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, - 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff, -}; - -/* Globals that input drivers may access */ -InputInfoPtr xf86InputDevs = NULL; - - -/* Globals that video drivers may not access */ - -xf86InfoRec xf86Info = { - NULL, /* pKeyboard */ - NULL, /* kbdProc */ - NULL, /* kbdEvents */ - -1, /* consoleFd */ - -1, /* kbdFd */ - -1, /* vtno */ - -1, /* kbdType */ - -1, /* kbdRate */ - -1, /* kbdDelay */ - -1, /* bell_pitch */ - -1, /* bell_duration */ - TRUE, /* autoRepeat */ - 0, /* leds */ - 0, /* xleds */ - NULL, /* vtinit */ - 0, /* scanPrefix */ - FALSE, /* capsLock */ - FALSE, /* numLock */ - FALSE, /* scrollLock */ - FALSE, /* modeSwitchLock */ - FALSE, /* composeLock */ - FALSE, /* vtSysreq */ - SKWhenNeeded, /* ddxSpecialKeys */ - FALSE, /* ActionKeyBindingsSet */ -#if defined(SVR4) && defined(i386) - FALSE, /* panix106 */ -#endif -#if defined(__OpenBSD__) || defined(__NetBSD__) - 0, /* wskbdType */ -#endif - NULL, /* pMouse */ -#ifdef XINPUT - NULL, /* mouseLocal */ -#endif - -1, /* lastEventTime */ - FALSE, /* vtRequestsPending */ - FALSE, /* inputPending */ - FALSE, /* dontVTSwitch */ - FALSE, /* dontZap */ - FALSE, /* dontZoom */ - FALSE, /* notrapSignals */ - FALSE, /* caughtSignal */ - FALSE, /* sharedMonitor */ - NULL, /* currentScreen */ -#ifdef CSRG_BASED - -1, /* screenFd */ - -1, /* consType */ -#endif -#ifdef XKB - NULL, /* xkbkeymap */ - NULL, /* xkbkeycodes */ - NULL, /* xkbtypes */ - NULL, /* xkbcompat */ - NULL, /* xkbsymbols */ - NULL, /* xkbgeometry */ - FALSE, /* xkbcomponents_specified */ - NULL, /* xkbrules */ - NULL, /* xkbmodel */ - NULL, /* xkblayout */ - NULL, /* xkbvariant */ - NULL, /* xkboptions */ -#endif - FALSE, /* allowMouseOpenFail */ - TRUE, /* vidModeEnabled */ - FALSE, /* vidModeAllowNonLocal */ - TRUE, /* miscModInDevEnabled */ - FALSE, /* miscModInDevAllowNonLocal */ - PCIOsConfig, /* pciFlags */ - Pix24DontCare, /* pixmap24 */ - X_DEFAULT, /* pix24From */ -#if defined(i386) || defined(__i386__) - FALSE, /* pc98 */ -#endif - TRUE, /* pmFlag */ - LogNone, /* syncLog */ - 0, /* estimateSizesAggressively */ - FALSE, /* kbdCustomKeycodes */ - FALSE, /* disableRandR */ - X_DEFAULT /* randRFrom */ -}; -const char *xf86ConfigFile = NULL; -const char *xf86InputDeviceList = NULL; -const char *xf86ModulePath = DEFAULT_MODULE_PATH; -MessageType xf86ModPathFrom = X_DEFAULT; -const char *xf86LogFile = DEFAULT_LOGPREFIX; -MessageType xf86LogFileFrom = X_DEFAULT; -Bool xf86LogFileWasOpened = FALSE; -serverLayoutRec xf86ConfigLayout = {NULL, }; -confDRIRec xf86ConfigDRI = {0, }; -XF86ConfigPtr xf86configptr = NULL; -Bool xf86Resetting = FALSE; -Bool xf86Initialising = FALSE; -Bool xf86ProbeFailed = FALSE; -Bool xf86DoProbe = FALSE; -Bool xf86DoConfigure = FALSE; -#ifdef XFree86LOADER -DriverPtr *xf86DriverList = NULL; -int xf86NumDrivers = 0; -InputDriverPtr *xf86InputDriverList = NULL; -int xf86NumInputDrivers = 0; -ModuleInfoPtr *xf86ModuleInfoList = NULL; -int xf86NumModuleInfos = 0; -#endif -int xf86NumScreens = 0; - -const char *xf86VisualNames[] = { - "StaticGray", - "GrayScale", - "StaticColor", - "PseudoColor", - "TrueColor", - "DirectColor" -}; - -/* Parameters set only from the command line */ -char *xf86ServerName = "no-name"; -Bool xf86fpFlag = FALSE; -Bool xf86coFlag = FALSE; -Bool xf86sFlag = FALSE; -Bool xf86bsEnableFlag = FALSE; -Bool xf86bsDisableFlag = FALSE; -Bool xf86silkenMouseDisableFlag = FALSE; -Bool xf86acpiDisableFlag = FALSE; -char *xf86LayoutName = NULL; -char *xf86ScreenName = NULL; -char *xf86PointerName = NULL; -char *xf86KeyboardName = NULL; -Bool xf86ProbeOnly = FALSE; -int xf86Verbose = DEFAULT_VERBOSE; -int xf86LogVerbose = DEFAULT_LOG_VERBOSE; -int xf86FbBpp = -1; -Pix24Flags xf86Pix24 = Pix24DontCare; -int xf86Depth = -1; -rgb xf86Weight = {0, 0, 0}; -Bool xf86FlipPixels = FALSE; -Gamma xf86Gamma = {0.0, 0.0, 0.0}; -Bool xf86ShowUnresolved = DEFAULT_UNRESOLVED; -Bool xf86BestRefresh = DEFAULT_BEST_REFRESH; -Bool xf86AllowMouseOpenFail = FALSE; -#ifdef XF86VIDMODE -Bool xf86VidModeDisabled = FALSE; -Bool xf86VidModeAllowNonLocal = FALSE; -#endif -#ifdef XF86MISC -Bool xf86MiscModInDevDisabled = FALSE; -Bool xf86MiscModInDevAllowNonLocal = FALSE; -#endif -RootWinPropPtr *xf86RegisteredPropertiesTable = NULL; -Bool xf86inSuspend = FALSE; -Bool xorgHWAccess = FALSE; -PciBusId xf86IsolateDevice; - -#ifdef DLOPEN_HACK -/* - * This stuff is a hack to allow dlopen() modules to work. It is intended - * only to be used when using dlopen() modules for debugging purposes. - */ -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Helper.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Helper.c deleted file mode 100644 index a6c7d5c89..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Helper.c +++ /dev/null @@ -1,2983 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.136 2004/01/27 01:31:45 dawes Exp $ */ - -/* - * Copyright (c) 1997-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * Authors: Dirk Hohndel - * David Dawes - * ... and others - * - * This file includes the helper functions that the server provides for - * different drivers. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "os.h" -#include "servermd.h" -#include "pixmapstr.h" -#include "windowstr.h" -#include "propertyst.h" -#include "gcstruct.h" -#include "loaderProcs.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "micmap.h" -#include "xf86PciInfo.h" -#include "xf86DDC.h" -#include "xf86Xinput.h" -#include "xf86InPriv.h" -#include "mivalidate.h" -#include "xf86RAC.h" -#include "xf86Bus.h" -#include "xf86Version.h" - -/* For xf86GetClocks */ -#if defined(CSRG_BASED) || defined(__GNU__) -#define HAS_SETPRIORITY -#include -#endif - -static int xf86ScrnInfoPrivateCount = 0; - - -#ifdef XFree86LOADER -/* Add a pointer to a new DriverRec to xf86DriverList */ - -void -xf86AddDriver(DriverPtr driver, pointer module, int flags) -{ - /* Don't add null entries */ - if (!driver) - return; - - if (xf86DriverList == NULL) - xf86NumDrivers = 0; - - xf86NumDrivers++; - xf86DriverList = xnfrealloc(xf86DriverList, - xf86NumDrivers * sizeof(DriverPtr)); - xf86DriverList[xf86NumDrivers - 1] = xnfalloc(sizeof(DriverRec)); - if (flags & HaveDriverFuncs) - *xf86DriverList[xf86NumDrivers - 1] = *driver; - else { - memcpy(xf86DriverList[xf86NumDrivers - 1], driver, sizeof(DriverRec1)); - xf86DriverList[xf86NumDrivers - 1]->driverFunc = NULL; - } - xf86DriverList[xf86NumDrivers - 1]->module = module; - xf86DriverList[xf86NumDrivers - 1]->refCount = 0; -} - -void -xf86DeleteDriver(int drvIndex) -{ - if (xf86DriverList[drvIndex] - && (!xf86DriverHasEntities(xf86DriverList[drvIndex]))) { - if (xf86DriverList[drvIndex]->module) - UnloadModule(xf86DriverList[drvIndex]->module); - xfree(xf86DriverList[drvIndex]); - xf86DriverList[drvIndex] = NULL; - } -} - -/* Add a pointer to a new InputDriverRec to xf86InputDriverList */ - -void -xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags) -{ - /* Don't add null entries */ - if (!driver) - return; - - if (xf86InputDriverList == NULL) - xf86NumInputDrivers = 0; - - xf86NumInputDrivers++; - xf86InputDriverList = xnfrealloc(xf86InputDriverList, - xf86NumInputDrivers * sizeof(InputDriverPtr)); - xf86InputDriverList[xf86NumInputDrivers - 1] = - xnfalloc(sizeof(InputDriverRec)); - *xf86InputDriverList[xf86NumInputDrivers - 1] = *driver; - xf86InputDriverList[xf86NumInputDrivers - 1]->module = module; - xf86InputDriverList[xf86NumInputDrivers - 1]->refCount = 0; -} - -void -xf86DeleteInputDriver(int drvIndex) -{ - if (xf86InputDriverList[drvIndex] && xf86InputDriverList[drvIndex]->module) - UnloadModule(xf86InputDriverList[drvIndex]->module); - xfree(xf86InputDriverList[drvIndex]); - xf86InputDriverList[drvIndex] = NULL; -} - -void -xf86AddModuleInfo(ModuleInfoPtr info, pointer module) -{ - /* Don't add null entries */ - if (!module) - return; - - if (xf86ModuleInfoList == NULL) - xf86NumModuleInfos = 0; - - xf86NumModuleInfos++; - xf86ModuleInfoList = xnfrealloc(xf86ModuleInfoList, - xf86NumModuleInfos * sizeof(ModuleInfoPtr)); - xf86ModuleInfoList[xf86NumModuleInfos - 1] = xnfalloc(sizeof(ModuleInfoRec)); - *xf86ModuleInfoList[xf86NumModuleInfos - 1] = *info; - xf86ModuleInfoList[xf86NumModuleInfos - 1]->module = module; - xf86ModuleInfoList[xf86NumModuleInfos - 1]->refCount = 0; -} - -void -xf86DeleteModuleInfo(int idx) -{ - if (xf86ModuleInfoList[idx]) { - if (xf86ModuleInfoList[idx]->module) - UnloadModule(xf86ModuleInfoList[idx]->module); - xfree(xf86ModuleInfoList[idx]); - xf86ModuleInfoList[idx] = NULL; - } -} -#endif - - -/* Allocate a new ScrnInfoRec in xf86Screens */ - -ScrnInfoPtr -xf86AllocateScreen(DriverPtr drv, int flags) -{ - int i; - - if (xf86Screens == NULL) - xf86NumScreens = 0; - - i = xf86NumScreens++; - xf86Screens = xnfrealloc(xf86Screens, xf86NumScreens * sizeof(ScrnInfoPtr)); - xf86Screens[i] = xnfcalloc(sizeof(ScrnInfoRec), 1); - xf86Screens[i]->scrnIndex = i; /* Changes when a screen is removed */ - xf86Screens[i]->origIndex = i; /* This never changes */ - xf86Screens[i]->privates = xnfcalloc(sizeof(DevUnion), - xf86ScrnInfoPrivateCount); - /* - * EnableDisableFBAccess now gets initialized in InitOutput() - * xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess; - */ - - xf86Screens[i]->drv = drv; - drv->refCount++; -#ifdef XFree86LOADER - xf86Screens[i]->module = DuplicateModule(drv->module, NULL); -#else - xf86Screens[i]->module = NULL; -#endif - /* - * set the initial access state. This will be modified after PreInit. - * XXX Or should we do it some other place? - */ - xf86Screens[i]->CurrentAccess = &xf86CurrentAccess; - xf86Screens[i]->resourceType = MEM_IO; - -#ifdef DEBUG - /* OOps -- What's this ? */ - ErrorF("xf86AllocateScreen - xf86Screens[%d]->pScreen = %p\n", - i, xf86Screens[i]->pScreen ); - if ( NULL != xf86Screens[i]->pScreen ) { - ErrorF("xf86Screens[%d]->pScreen->CreateWindow = %p\n", - i, xf86Screens[i]->pScreen->CreateWindow ); - } -#endif - - xf86Screens[i]->DriverFunc = drv->driverFunc; - - return xf86Screens[i]; -} - - -/* - * Remove an entry from xf86Screens. Ideally it should free all allocated - * data. To do this properly may require a driver hook. - */ - -void -xf86DeleteScreen(int scrnIndex, int flags) -{ - ScrnInfoPtr pScrn; - int i; - - /* First check if the screen is valid */ - if (xf86NumScreens == 0 || xf86Screens == NULL) - return; - - if (scrnIndex > xf86NumScreens - 1) - return; - - if (!(pScrn = xf86Screens[scrnIndex])) - return; - - /* If a FreeScreen function is defined, call it here */ - if (pScrn->FreeScreen != NULL) - pScrn->FreeScreen(scrnIndex, 0); - - while (pScrn->modes) - xf86DeleteMode(&pScrn->modes, pScrn->modes); - - while (pScrn->modePool) - xf86DeleteMode(&pScrn->modePool, pScrn->modePool); - - xf86OptionListFree(pScrn->options); - -#ifdef XFree86LOADER - if (pScrn->module) - UnloadModule(pScrn->module); -#endif - - if (pScrn->drv) - pScrn->drv->refCount--; - - if (pScrn->privates) - xfree(pScrn->privates); - - xf86ClearEntityListForScreen(scrnIndex); - - xfree(pScrn); - - /* Move the other entries down, updating their scrnIndex fields */ - - xf86NumScreens--; - - for (i = scrnIndex; i < xf86NumScreens; i++) { - xf86Screens[i] = xf86Screens[i + 1]; - xf86Screens[i]->scrnIndex = i; - /* Also need to take care of the screen layout settings */ - } -} - -/* - * Allocate a private in ScrnInfoRec. - */ - -int -xf86AllocateScrnInfoPrivateIndex(void) -{ - int idx, i; - ScrnInfoPtr pScr; - DevUnion *nprivs; - - idx = xf86ScrnInfoPrivateCount++; - for (i = 0; i < xf86NumScreens; i++) { - pScr = xf86Screens[i]; - nprivs = xnfrealloc(pScr->privates, - xf86ScrnInfoPrivateCount * sizeof(DevUnion)); - /* Zero the new private */ - bzero(&nprivs[idx], sizeof(DevUnion)); - pScr->privates = nprivs; - } - return idx; -} - -/* Allocate a new InputInfoRec and add it to the head xf86InputDevs. */ - -InputInfoPtr -xf86AllocateInput(InputDriverPtr drv, int flags) -{ - InputInfoPtr new; - - if (!(new = xcalloc(sizeof(InputInfoRec), 1))) - return NULL; - - new->drv = drv; - drv->refCount++; -#ifdef XFree86LOADER - new->module = DuplicateModule(drv->module, NULL); -#else - new->module = NULL; -#endif - new->next = xf86InputDevs; - xf86InputDevs = new; - return new; -} - - -/* - * Remove an entry from xf86InputDevs. Ideally it should free all allocated - * data. To do this properly may require a driver hook. - */ - -void -xf86DeleteInput(InputInfoPtr pInp, int flags) -{ - InputInfoPtr p; - - /* First check if the inputdev is valid. */ - if (pInp == NULL) - return; - -#if 0 - /* If a free function is defined, call it here. */ - if (pInp->free) - pInp->free(pInp, 0); -#endif - -#ifdef XFree86LOADER - if (pInp->module) - UnloadModule(pInp->module); -#endif - - if (pInp->drv) - pInp->drv->refCount--; - - if (pInp->private) - xfree(pInp->private); - - /* Remove the entry from the list. */ - if (pInp == xf86InputDevs) - xf86InputDevs = pInp->next; - else { - p = xf86InputDevs; - while (p && p->next != pInp) - p = p->next; - if (p) - p->next = pInp->next; - /* Else the entry wasn't in the xf86InputDevs list (ignore this). */ - } - xfree(pInp); -} - -Bool -xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad) -{ - int i; - - if (pScrn->numFormats >= MAXFORMATS) - return FALSE; - - if (bpp <= 0) { - if (depth == 1) - bpp = 1; - else if (depth <= 8) - bpp = 8; - else if (depth <= 16) - bpp = 16; - else if (depth <= 32) - bpp = 32; - else - return FALSE; - } - if (pad <= 0) - pad = BITMAP_SCANLINE_PAD; - - i = pScrn->numFormats++; - pScrn->formats[i].depth = depth; - pScrn->formats[i].bitsPerPixel = bpp; - pScrn->formats[i].scanlinePad = pad; - return TRUE; -} - -/* - * Set the depth we are using based on (in the following order of preference): - * - values given on the command line - * - values given in the config file - * - values provided by the driver - * - an overall default when nothing else is given - * - * Also find a Display subsection matching the depth/bpp found. - * - * Sets the following ScrnInfoRec fields: - * bitsPerPixel, pixmap24, depth, display, imageByteOrder, - * bitmapScanlinePad, bitmapScanlineUnit, bitmapBitOrder, numFormats, - * formats, fbFormat. - */ - -/* Can the screen handle 24 bpp pixmaps */ -#define DO_PIX24(f) ((f & Support24bppFb) || \ - ((f & Support32bppFb) && (f & SupportConvert24to32))) - -/* Can the screen handle 32 bpp pixmaps */ -#define DO_PIX32(f) ((f & Support32bppFb) || \ - ((f & Support24bppFb) && (f & SupportConvert32to24))) - -/* Does the screen prefer 32bpp fb for 24bpp pixmaps */ -#define CHOOSE32FOR24(f) ((f & Support32bppFb) && (f & SupportConvert24to32) \ - && (f & PreferConvert24to32)) - -/* Does the screen prefer 24bpp fb for 32bpp pixmaps */ -#define CHOOSE24FOR32(f) ((f & Support24bppFb) && (f & SupportConvert32to24) \ - && (f & PreferConvert32to24)) - -/* Can the screen handle 32bpp pixmaps for 24bpp fb */ -#define DO_PIX32FOR24(f) ((f & Support24bppFb) && (f & SupportConvert32to24)) - -/* Can the screen handle 24bpp pixmaps for 32bpp fb */ -#define DO_PIX24FOR32(f) ((f & Support32bppFb) && (f & SupportConvert24to32)) - -#ifndef GLOBAL_DEFAULT_DEPTH -#define GLOBAL_DEFAULT_DEPTH 16 -#endif - -#ifndef GLOBAL_DEFAULT_FBBPP -#define GLOBAL_DEFAULT_FBBPP 16 -#endif - -Bool -xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int dummy, int fbbpp, - int depth24flags) -{ - int i; - DispPtr disp; - Pix24Flags pix24 = xf86Info.pixmap24; - Bool nomatch = FALSE; - - scrp->bitsPerPixel = -1; - scrp->depth = -1; - scrp->pixmap24 = Pix24DontCare; - scrp->bitsPerPixelFrom = X_DEFAULT; - scrp->depthFrom = X_DEFAULT; - -#if BITMAP_SCANLINE_UNIT == 64 - /* - * For platforms with 64-bit scanlines, modify the driver's depth24flags - * to remove preferences for packed 24bpp modes, which are not currently - * supported on these platforms. - */ - depth24flags &= ~(SupportConvert32to24 | SupportConvert32to24 | - PreferConvert24to32 | PreferConvert32to24); -#endif - - if (xf86FbBpp > 0) { - scrp->bitsPerPixel = xf86FbBpp; - scrp->bitsPerPixelFrom = X_CMDLINE; - } - - if (xf86Depth > 0) { - scrp->depth = xf86Depth; - scrp->depthFrom = X_CMDLINE; - } - - if (xf86FbBpp < 0 && xf86Depth < 0) { - if (scrp->confScreen->defaultfbbpp > 0) { - scrp->bitsPerPixel = scrp->confScreen->defaultfbbpp; - scrp->bitsPerPixelFrom = X_CONFIG; - } - if (scrp->confScreen->defaultdepth > 0) { - scrp->depth = scrp->confScreen->defaultdepth; - scrp->depthFrom = X_CONFIG; - } - - if (scrp->confScreen->defaultfbbpp <= 0 && - scrp->confScreen->defaultdepth <= 0) { - /* - * Check for DefaultDepth and DefaultFbBpp options in the - * Device sections. - */ - int i; - GDevPtr device; - Bool found = FALSE; - - for (i = 0; i < scrp->numEntities; i++) { - device = xf86GetDevFromEntity(scrp->entityList[i], - scrp->entityInstanceList[i]); - if (device && device->options) { - if (xf86FindOption(device->options, "DefaultDepth")) { - scrp->depth = xf86SetIntOption(device->options, - "DefaultDepth", -1); - scrp->depthFrom = X_CONFIG; - found = TRUE; - } - if (xf86FindOption(device->options, "DefaultFbBpp")) { - scrp->bitsPerPixel = xf86SetIntOption(device->options, - "DefaultFbBpp", - -1); - scrp->bitsPerPixelFrom = X_CONFIG; - found = TRUE; - } - } - if (found) - break; - } - } - } - - /* If none of these is set, pick a default */ - if (scrp->bitsPerPixel < 0 && scrp->depth < 0) { - if (fbbpp > 0 || depth > 0) { - if (fbbpp > 0) - scrp->bitsPerPixel = fbbpp; - if (depth > 0) - scrp->depth = depth; - } else { - scrp->bitsPerPixel = GLOBAL_DEFAULT_FBBPP; - scrp->depth = GLOBAL_DEFAULT_DEPTH; - } - } - - /* If any are not given, determine a default for the others */ - - if (scrp->bitsPerPixel < 0) { - /* The depth must be set */ - if (scrp->depth > -1) { - if (scrp->depth == 1) - scrp->bitsPerPixel = 1; - else if (scrp->depth <= 4) - scrp->bitsPerPixel = 4; - else if (scrp->depth <= 8) - scrp->bitsPerPixel = 8; - else if (scrp->depth <= 16) - scrp->bitsPerPixel = 16; - else if (scrp->depth <= 24) { - /* - * Figure out if a choice is possible based on the depth24 - * and pix24 flags. - */ - /* Check pix24 first */ - if (pix24 != Pix24DontCare) { - if (pix24 == Pix24Use32) { - if (DO_PIX32(depth24flags)) { - if (CHOOSE24FOR32(depth24flags)) - scrp->bitsPerPixel = 24; - else - scrp->bitsPerPixel = 32; - } else { - nomatch = TRUE; - } - } else if (pix24 == Pix24Use24) { - if (DO_PIX24(depth24flags)) { - if (CHOOSE32FOR24(depth24flags)) - scrp->bitsPerPixel = 32; - else - scrp->bitsPerPixel = 24; - } else { - nomatch = TRUE; - } - } - } else { - if (DO_PIX32(depth24flags)) { - if (CHOOSE24FOR32(depth24flags)) - scrp->bitsPerPixel = 24; - else - scrp->bitsPerPixel = 32; - } else if (DO_PIX24(depth24flags)) { - if (CHOOSE32FOR24(depth24flags)) - scrp->bitsPerPixel = 32; - else - scrp->bitsPerPixel = 24; - } - } - } else if (scrp->depth <= 32) - scrp->bitsPerPixel = 32; - else { - xf86DrvMsg(scrp->scrnIndex, X_ERROR, - "Specified depth (%d) is greater than 32\n", - scrp->depth); - return FALSE; - } - } else { - xf86DrvMsg(scrp->scrnIndex, X_ERROR, - "xf86SetDepthBpp: internal error: depth and fbbpp" - " are both not set\n"); - return FALSE; - } - if (scrp->bitsPerPixel < 0) { - if (nomatch) - xf86DrvMsg(scrp->scrnIndex, X_ERROR, - "Driver can't support depth 24 pixmap format (%d)\n", - PIX24TOBPP(pix24)); - else if ((depth24flags & (Support24bppFb | Support32bppFb)) == - NoDepth24Support) - xf86DrvMsg(scrp->scrnIndex, X_ERROR, - "Driver can't support depth 24\n"); - else - xf86DrvMsg(scrp->scrnIndex, X_ERROR, - "Can't find fbbpp for depth 24\n"); - return FALSE; - } - scrp->bitsPerPixelFrom = X_PROBED; - } - - if (scrp->depth <= 0) { - /* bitsPerPixel is already set */ - switch (scrp->bitsPerPixel) { - case 32: - scrp->depth = 24; - break; - default: - /* 1, 4, 8, 16 and 24 */ - scrp->depth = scrp->bitsPerPixel; - break; - } - scrp->depthFrom = X_PROBED; - } - - /* Sanity checks */ - if (scrp->depth < 1 || scrp->depth > 32) { - xf86DrvMsg(scrp->scrnIndex, X_ERROR, - "Specified depth (%d) is not in the range 1-32\n", - scrp->depth); - return FALSE; - } - switch (scrp->bitsPerPixel) { - case 1: - case 4: - case 8: - case 16: - case 24: - case 32: - break; - default: - xf86DrvMsg(scrp->scrnIndex, X_ERROR, - "Specified fbbpp (%d) is not a permitted value\n", - scrp->bitsPerPixel); - return FALSE; - } - if (scrp->depth > scrp->bitsPerPixel) { - xf86DrvMsg(scrp->scrnIndex, X_ERROR, - "Specified depth (%d) is greater than the fbbpp (%d)\n", - scrp->depth, scrp->bitsPerPixel); - return FALSE; - } - - /* set scrp->pixmap24 if the driver isn't flexible */ - if (scrp->bitsPerPixel == 24 && !DO_PIX32FOR24(depth24flags)) { - scrp->pixmap24 = Pix24Use24; - } - if (scrp->bitsPerPixel == 32 && !DO_PIX24FOR32(depth24flags)) { - scrp->pixmap24 = Pix24Use32; - } - - /* - * Find the Display subsection matching the depth/fbbpp and initialise - * scrp->display with it. - */ - for (i = 0, disp = scrp->confScreen->displays; - i < scrp->confScreen->numdisplays; i++, disp++) { - if ((disp->depth == scrp->depth && disp->fbbpp == scrp->bitsPerPixel) - || (disp->depth == scrp->depth && disp->fbbpp <= 0) - || (disp->fbbpp == scrp->bitsPerPixel && disp->depth <= 0)) { - scrp->display = disp; - break; - } - } - - /* - * If an exact match can't be found, see if there is one with no - * depth or fbbpp specified. - */ - if (i == scrp->confScreen->numdisplays) { - for (i = 0, disp = scrp->confScreen->displays; - i < scrp->confScreen->numdisplays; i++, disp++) { - if (disp->depth <= 0 && disp->fbbpp <= 0) { - scrp->display = disp; - break; - } - } - } - - /* - * If all else fails, create a default one. - */ - if (i == scrp->confScreen->numdisplays) { - scrp->confScreen->numdisplays++; - scrp->confScreen->displays = - xnfrealloc(scrp->confScreen->displays, - scrp->confScreen->numdisplays * sizeof(DispRec)); - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Creating default Display subsection in Screen section\n" - "\t\"%s\" for depth/fbbpp %d/%d\n", - scrp->confScreen->id, scrp->depth, scrp->bitsPerPixel); - memset(&scrp->confScreen->displays[i], 0, sizeof(DispRec)); - scrp->confScreen->displays[i].blackColour.red = -1; - scrp->confScreen->displays[i].blackColour.green = -1; - scrp->confScreen->displays[i].blackColour.blue = -1; - scrp->confScreen->displays[i].whiteColour.red = -1; - scrp->confScreen->displays[i].whiteColour.green = -1; - scrp->confScreen->displays[i].whiteColour.blue = -1; - scrp->confScreen->displays[i].defaultVisual = -1; - scrp->confScreen->displays[i].modes = xnfalloc(sizeof(char *)); - scrp->confScreen->displays[i].modes[0] = NULL; - scrp->confScreen->displays[i].depth = depth; - scrp->confScreen->displays[i].fbbpp = fbbpp; - scrp->display = &scrp->confScreen->displays[i]; - } - - /* - * Setup defaults for the display-wide attributes the framebuffer will - * need. These defaults should eventually be set globally, and not - * dependent on the screens. - */ - scrp->imageByteOrder = IMAGE_BYTE_ORDER; - scrp->bitmapScanlinePad = BITMAP_SCANLINE_PAD; - if (scrp->depth < 8) { - /* Planar modes need these settings */ - scrp->bitmapScanlineUnit = 8; - scrp->bitmapBitOrder = MSBFirst; - } else { - scrp->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; - scrp->bitmapBitOrder = BITMAP_BIT_ORDER; - } - - /* - * If an unusual depth is required, add it to scrp->formats. The formats - * for the common depths are handled globally in InitOutput - */ - switch (scrp->depth) { - case 1: - case 4: - case 8: - case 15: - case 16: - case 24: - /* Common depths. Nothing to do for them */ - break; - default: - if (!xf86AddPixFormat(scrp, scrp->depth, 0, 0)) { - xf86DrvMsg(scrp->scrnIndex, X_ERROR, - "Can't add pixmap format for depth %d\n", scrp->depth); - return FALSE; - } - } - - /* Initialise the framebuffer format for this screen */ - scrp->fbFormat.depth = scrp->depth; - scrp->fbFormat.bitsPerPixel = scrp->bitsPerPixel; - scrp->fbFormat.scanlinePad = BITMAP_SCANLINE_PAD; - - return TRUE; -} - -/* - * Print out the selected depth and bpp. - */ -void -xf86PrintDepthBpp(ScrnInfoPtr scrp) -{ - xf86DrvMsg(scrp->scrnIndex, scrp->depthFrom, "Depth %d, ", scrp->depth); - xf86Msg(scrp->bitsPerPixelFrom, "framebuffer bpp %d\n", scrp->bitsPerPixel); -} - -/* - * xf86SetWeight sets scrp->weight, scrp->mask, scrp->offset, and for depths - * greater than MAX_PSEUDO_DEPTH also scrp->rgbBits. - */ -Bool -xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask) -{ - MessageType weightFrom = X_DEFAULT; - - scrp->weight.red = 0; - scrp->weight.green = 0; - scrp->weight.blue = 0; - - if (xf86Weight.red > 0 && xf86Weight.green > 0 && xf86Weight.blue > 0) { - scrp->weight = xf86Weight; - weightFrom = X_CMDLINE; - } else if (scrp->display->weight.red > 0 && scrp->display->weight.green > 0 - && scrp->display->weight.blue > 0) { - scrp->weight = scrp->display->weight; - weightFrom = X_CONFIG; - } else if (weight.red > 0 && weight.green > 0 && weight.blue > 0) { - scrp->weight = weight; - } else { - switch (scrp->depth) { - case 1: - case 4: - case 8: - scrp->weight.red = scrp->weight.green = - scrp->weight.blue = scrp->rgbBits; - break; - case 15: - scrp->weight.red = scrp->weight.green = scrp->weight.blue = 5; - break; - case 16: - scrp->weight.red = scrp->weight.blue = 5; - scrp->weight.green = 6; - break; - case 24: - scrp->weight.red = scrp->weight.green = scrp->weight.blue = 8; - break; - case 30: - scrp->weight.red = scrp->weight.green = scrp->weight.blue = 10; - break; - } - } - - if (scrp->weight.red) - xf86DrvMsg(scrp->scrnIndex, weightFrom, "RGB weight %d%d%d\n", - (int)scrp->weight.red, (int)scrp->weight.green, - (int)scrp->weight.blue); - - if (scrp->depth > MAX_PSEUDO_DEPTH && - (scrp->depth != scrp->weight.red + scrp->weight.green + - scrp->weight.blue)) { - xf86DrvMsg(scrp->scrnIndex, X_ERROR, - "Weight given (%d%d%d) is inconsistent with the " - "depth (%d)\n", - (int)scrp->weight.red, (int)scrp->weight.green, - (int)scrp->weight.blue, scrp->depth); - return FALSE; - } - if (scrp->depth > MAX_PSEUDO_DEPTH && scrp->weight.red) { - /* - * XXX Does this even mean anything for TrueColor visuals? - * If not, we shouldn't even be setting it here. However, this - * matches the behaviour of 3.x versions of XFree86. - */ - scrp->rgbBits = scrp->weight.red; - if (scrp->weight.green > scrp->rgbBits) - scrp->rgbBits = scrp->weight.green; - if (scrp->weight.blue > scrp->rgbBits) - scrp->rgbBits = scrp->weight.blue; - } - - /* Set the mask and offsets */ - if (mask.red == 0 || mask.green == 0 || mask.blue == 0) { - /* Default to a setting common to PC hardware */ - scrp->offset.red = scrp->weight.green + scrp->weight.blue; - scrp->offset.green = scrp->weight.blue; - scrp->offset.blue = 0; - scrp->mask.red = ((1 << scrp->weight.red) - 1) << scrp->offset.red; - scrp->mask.green = ((1 << scrp->weight.green) - 1) - << scrp->offset.green; - scrp->mask.blue = (1 << scrp->weight.blue) - 1; - } else { - /* Initialise to the values passed */ - scrp->mask.red = mask.red; - scrp->mask.green = mask.green; - scrp->mask.blue = mask.blue; - scrp->offset.red = ffs(mask.red); - scrp->offset.green = ffs(mask.green); - scrp->offset.blue = ffs(mask.blue); - } - return TRUE; -} - -Bool -xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual) -{ - MessageType visualFrom = X_DEFAULT; - - if (defaultColorVisualClass >= 0) { - scrp->defaultVisual = defaultColorVisualClass; - visualFrom = X_CMDLINE; - } else if (scrp->display->defaultVisual >= 0) { - scrp->defaultVisual = scrp->display->defaultVisual; - visualFrom = X_CONFIG; - } else if (visual >= 0) { - scrp->defaultVisual = visual; - } else { - if (scrp->depth == 1) - scrp->defaultVisual = StaticGray; - else if (scrp->depth == 4) - scrp->defaultVisual = StaticColor; - else if (scrp->depth <= MAX_PSEUDO_DEPTH) - scrp->defaultVisual = PseudoColor; - else - scrp->defaultVisual = TrueColor; - } - switch (scrp->defaultVisual) { - case StaticGray: - case GrayScale: - case StaticColor: - case PseudoColor: - case TrueColor: - case DirectColor: - xf86DrvMsg(scrp->scrnIndex, visualFrom, "Default visual is %s\n", - xf86VisualNames[scrp->defaultVisual]); - return TRUE; - default: - - xf86DrvMsg(scrp->scrnIndex, X_ERROR, - "Invalid default visual class (%d)\n", scrp->defaultVisual); - return FALSE; - } -} - -#define TEST_GAMMA(g) \ - (g).red > GAMMA_ZERO || (g).green > GAMMA_ZERO || (g).blue > GAMMA_ZERO - -#define SET_GAMMA(g) \ - (g) > GAMMA_ZERO ? (g) : 1.0 - -Bool -xf86SetGamma(ScrnInfoPtr scrp, Gamma gamma) -{ - MessageType from = X_DEFAULT; -#if 0 - xf86MonPtr DDC = (xf86MonPtr)(scrp->monitor->DDC); -#endif - if (TEST_GAMMA(xf86Gamma)) { - from = X_CMDLINE; - scrp->gamma.red = SET_GAMMA(xf86Gamma.red); - scrp->gamma.green = SET_GAMMA(xf86Gamma.green); - scrp->gamma.blue = SET_GAMMA(xf86Gamma.blue); - } else if (TEST_GAMMA(scrp->monitor->gamma)) { - from = X_CONFIG; - scrp->gamma.red = SET_GAMMA(scrp->monitor->gamma.red); - scrp->gamma.green = SET_GAMMA(scrp->monitor->gamma.green); - scrp->gamma.blue = SET_GAMMA(scrp->monitor->gamma.blue); -#if 0 - } else if ( DDC && DDC->features.gamma > GAMMA_ZERO ) { - from = X_PROBED; - scrp->gamma.red = SET_GAMMA(DDC->features.gamma); - scrp->gamma.green = SET_GAMMA(DDC->features.gamma); - scrp->gamma.blue = SET_GAMMA(DDC->features.gamma); - /* EDID structure version 2 gives optional seperate red, green & blue gamma values - * in bytes 0x57-0x59 */ -#endif - } else if (TEST_GAMMA(gamma)) { - scrp->gamma.red = SET_GAMMA(gamma.red); - scrp->gamma.green = SET_GAMMA(gamma.green); - scrp->gamma.blue = SET_GAMMA(gamma.blue); - } else { - scrp->gamma.red = 1.0; - scrp->gamma.green = 1.0; - scrp->gamma.blue = 1.0; - } - xf86DrvMsg(scrp->scrnIndex, from, - "Using gamma correction (%.1f, %.1f, %.1f)\n", - scrp->gamma.red, scrp->gamma.green, scrp->gamma.blue); - - return TRUE; -} - -#undef TEST_GAMMA -#undef SET_GAMMA - - -/* - * Set the DPI from the command line option. XXX should allow it to be - * calculated from the widthmm/heightmm values. - */ - -#undef MMPERINCH -#define MMPERINCH 25.4 - -void -xf86SetDpi(ScrnInfoPtr pScrn, int x, int y) -{ - MessageType from = X_DEFAULT; - xf86MonPtr DDC = (xf86MonPtr)(pScrn->monitor->DDC); - int ddcWidthmm, ddcHeightmm; - int widthErr, heightErr; - - /* XXX Maybe there is no need for widthmm/heightmm in ScrnInfoRec */ - pScrn->widthmm = pScrn->monitor->widthmm; - pScrn->heightmm = pScrn->monitor->heightmm; - - if (DDC && (DDC->features.hsize > 0 && DDC->features.vsize > 0) ) { - /* DDC gives display size in mm for individual modes, - * but cm for monitor - */ - ddcWidthmm = DDC->features.hsize * 10; /* 10mm in 1cm */ - ddcHeightmm = DDC->features.vsize * 10; /* 10mm in 1cm */ - } else { - ddcWidthmm = ddcHeightmm = 0; - } - - if (monitorResolution > 0) { - pScrn->xDpi = monitorResolution; - pScrn->yDpi = monitorResolution; - from = X_CMDLINE; - } else if (pScrn->widthmm > 0 || pScrn->heightmm > 0) { - from = X_CONFIG; - if (pScrn->widthmm > 0) { - pScrn->xDpi = - (int)((double)pScrn->virtualX * MMPERINCH / pScrn->widthmm); - } - if (pScrn->heightmm > 0) { - pScrn->yDpi = - (int)((double)pScrn->virtualY * MMPERINCH / pScrn->heightmm); - } - if (pScrn->xDpi > 0 && pScrn->yDpi <= 0) - pScrn->yDpi = pScrn->xDpi; - if (pScrn->yDpi > 0 && pScrn->xDpi <= 0) - pScrn->xDpi = pScrn->yDpi; - xf86DrvMsg(pScrn->scrnIndex, from, "Display dimensions: (%d, %d) mm\n", - pScrn->widthmm, pScrn->heightmm); - - /* Warn if config and probe disagree about display size */ - if ( ddcWidthmm && ddcHeightmm ) { - if (pScrn->widthmm > 0) { - widthErr = abs(ddcWidthmm - pScrn->widthmm); - } else { - widthErr = 0; - } - if (pScrn->heightmm > 0) { - heightErr = abs(ddcHeightmm - pScrn->heightmm); - } else { - heightErr = 0; - } - if (widthErr>10 || heightErr>10) { - /* Should include config file name for monitor here */ - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Probed monitor is %dx%d mm, using Displaysize %dx%d mm\n", - ddcWidthmm,ddcHeightmm, pScrn->widthmm,pScrn->heightmm); - } - } - } else if ( ddcWidthmm && ddcHeightmm ) { - from = X_PROBED; - xf86DrvMsg(pScrn->scrnIndex, from, "Display dimensions: (%d, %d) mm\n", - ddcWidthmm, ddcHeightmm ); - pScrn->widthmm = ddcWidthmm; - pScrn->heightmm = ddcHeightmm; - if (pScrn->widthmm > 0) { - pScrn->xDpi = - (int)((double)pScrn->virtualX * MMPERINCH / pScrn->widthmm); - } - if (pScrn->heightmm > 0) { - pScrn->yDpi = - (int)((double)pScrn->virtualY * MMPERINCH / pScrn->heightmm); - } - if (pScrn->xDpi > 0 && pScrn->yDpi <= 0) - pScrn->yDpi = pScrn->xDpi; - if (pScrn->yDpi > 0 && pScrn->xDpi <= 0) - pScrn->xDpi = pScrn->yDpi; - } else { - if (x > 0) - pScrn->xDpi = x; - else - pScrn->xDpi = DEFAULT_DPI; - if (y > 0) - pScrn->yDpi = y; - else - pScrn->yDpi = DEFAULT_DPI; - } - xf86DrvMsg(pScrn->scrnIndex, from, "DPI set to (%d, %d)\n", - pScrn->xDpi, pScrn->yDpi); -} - -#undef MMPERINCH - - -void -xf86SetBlackWhitePixels(ScreenPtr pScreen) -{ - if (xf86FlipPixels) { - pScreen->whitePixel = 0; - pScreen->blackPixel = 1; - } else { - pScreen->whitePixel = 1; - pScreen->blackPixel = 0; - } -} - -/* - * xf86SetRootClip -- - * Enable or disable rendering to the screen by - * setting the root clip list and revalidating - * all of the windows - */ - -static void -xf86SetRootClip (ScreenPtr pScreen, Bool enable) -{ - WindowPtr pWin = WindowTable[pScreen->myNum]; - WindowPtr pChild; - Bool WasViewable = (Bool)(pWin->viewable); - Bool anyMarked = FALSE; - RegionPtr pOldClip = NULL, bsExposed; -#ifdef DO_SAVE_UNDERS - Bool dosave = FALSE; -#endif - WindowPtr pLayerWin; - BoxRec box; - - if (WasViewable) - { - for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) - { - (void) (*pScreen->MarkOverlappedWindows)(pChild, - pChild, - &pLayerWin); - } - (*pScreen->MarkWindow) (pWin); - anyMarked = TRUE; - if (pWin->valdata) - { - if (HasBorder (pWin)) - { - RegionPtr borderVisible; - - borderVisible = REGION_CREATE(pScreen, NullBox, 1); - REGION_SUBTRACT(pScreen, borderVisible, - &pWin->borderClip, &pWin->winSize); - pWin->valdata->before.borderVisible = borderVisible; - } - pWin->valdata->before.resized = TRUE; - } - } - - /* - * Use REGION_BREAK to avoid optimizations in ValidateTree - * that assume the root borderClip can't change well, normally - * it doesn't...) - */ - if (enable) - { - box.x1 = 0; - box.y1 = 0; - box.x2 = pScreen->width; - box.y2 = pScreen->height; - REGION_INIT (pScreen, &pWin->winSize, &box, 1); - REGION_INIT (pScreen, &pWin->borderSize, &box, 1); - if (WasViewable) - REGION_RESET(pScreen, &pWin->borderClip, &box); - pWin->drawable.width = pScreen->width; - pWin->drawable.height = pScreen->height; - REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList); - } - else - { - REGION_EMPTY(pScreen, &pWin->borderClip); - REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList); - } - - ResizeChildrenWinSize (pWin, 0, 0, 0, 0); - - if (WasViewable) - { - if (pWin->backStorage) - { - pOldClip = REGION_CREATE(pScreen, NullBox, 1); - REGION_COPY(pScreen, pOldClip, &pWin->clipList); - } - - if (pWin->firstChild) - { - anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild, - pWin->firstChild, - (WindowPtr *)NULL); - } - else - { - (*pScreen->MarkWindow) (pWin); - anyMarked = TRUE; - } - -#ifdef DO_SAVE_UNDERS - if (DO_SAVE_UNDERS(pWin)) - { - dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin); - } -#endif /* DO_SAVE_UNDERS */ - - if (anyMarked) - (*pScreen->ValidateTree)(pWin, NullWindow, VTOther); - } - - if (pWin->backStorage && - ((pWin->backingStore == Always) || WasViewable)) - { - if (!WasViewable) - pOldClip = &pWin->clipList; /* a convenient empty region */ - bsExposed = (*pScreen->TranslateBackingStore) - (pWin, 0, 0, pOldClip, - pWin->drawable.x, pWin->drawable.y); - if (WasViewable) - REGION_DESTROY(pScreen, pOldClip); - if (bsExposed) - { - RegionPtr valExposed = NullRegion; - - if (pWin->valdata) - valExposed = &pWin->valdata->after.exposed; - (*pScreen->WindowExposures) (pWin, valExposed, bsExposed); - if (valExposed) - REGION_EMPTY(pScreen, valExposed); - REGION_DESTROY(pScreen, bsExposed); - } - } - if (WasViewable) - { - if (anyMarked) - (*pScreen->HandleExposures)(pWin); -#ifdef DO_SAVE_UNDERS - if (dosave) - (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin); -#endif /* DO_SAVE_UNDERS */ - if (anyMarked && pScreen->PostValidateTree) - (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther); - } - if (pWin->realized) - WindowsRestructured (); - FlushAllOutput (); -} - -/* - * Function to enable/disable access to the frame buffer - * - * This is used when VT switching and when entering/leaving DGA direct mode. - * - * This has been rewritten again to eliminate the saved pixmap. The - * devPrivate field in the screen pixmap is set to NULL to catch code - * accidentally referencing the frame buffer while the X server is not - * supposed to touch it. - * - * Here, we exchange the pixmap private data, rather than the pixmaps - * themselves to avoid having to find and change any references to the screen - * pixmap such as GC's, window privates etc. This also means that this code - * does not need to know exactly how the pixmap pixels are accessed. Further, - * this exchange is >not< done through the screen's ModifyPixmapHeader() - * vector. This means the called frame buffer code layers can determine - * whether they are switched in or out by keeping track of the root pixmap's - * private data, and therefore don't need to access pScrnInfo->vtSema. - */ -void -xf86EnableDisableFBAccess(int scrnIndex, Bool enable) -{ - ScrnInfoPtr pScrnInfo = xf86Screens[scrnIndex]; - ScreenPtr pScreen = pScrnInfo->pScreen; - PixmapPtr pspix; - - pspix = (*pScreen->GetScreenPixmap) (pScreen); - if (enable) - { - /* - * Restore the screen pixmap devPrivate field - */ - pspix->devPrivate = pScrnInfo->pixmapPrivate; - /* - * Restore all of the clip lists on the screen - */ - if (!xf86Resetting) - xf86SetRootClip (pScreen, TRUE); - - } - else - { - /* - * Empty all of the clip lists on the screen - */ - xf86SetRootClip (pScreen, FALSE); - /* - * save the screen pixmap devPrivate field and - * replace it with NULL so accidental references - * to the frame buffer are caught - */ - pScrnInfo->pixmapPrivate = pspix->devPrivate; - pspix->devPrivate.ptr = NULL; - } -} - -/* Print driver messages in the standard format */ - -#undef PREFIX_SIZE -#define PREFIX_SIZE 14 - -void -xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format, - va_list args) -{ - char *tmpFormat; - - /* Prefix the scrnIndex name to the format string. */ - if (scrnIndex >= 0 && scrnIndex < xf86NumScreens && - xf86Screens[scrnIndex]->name) { - tmpFormat = xalloc(strlen(format) + - strlen(xf86Screens[scrnIndex]->name) + - PREFIX_SIZE + 1); - if (!tmpFormat) - return; - - snprintf(tmpFormat, PREFIX_SIZE + 1, "%s(%d): ", - xf86Screens[scrnIndex]->name, scrnIndex); - - strcat(tmpFormat, format); - LogVMessageVerb(type, verb, tmpFormat, args); - xfree(tmpFormat); - } else - LogVMessageVerb(type, verb, format, args); -} -#undef PREFIX_SIZE - -/* Print driver messages, with verbose level specified directly */ -void -xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format, - ...) -{ - va_list ap; - - va_start(ap, format); - xf86VDrvMsgVerb(scrnIndex, type, verb, format, ap); - va_end(ap); -} - -/* Print driver messages, with verbose level of 1 (default) */ -void -xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - xf86VDrvMsgVerb(scrnIndex, type, 1, format, ap); - va_end(ap); -} - -/* Print non-driver messages with verbose level specified directly */ -void -xf86MsgVerb(MessageType type, int verb, const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - xf86VDrvMsgVerb(-1, type, verb, format, ap); - va_end(ap); -} - -/* Print non-driver messages with verbose level of 1 (default) */ -void -xf86Msg(MessageType type, const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - xf86VDrvMsgVerb(-1, type, 1, format, ap); - va_end(ap); -} - -/* Just like ErrorF, but with the verbose level checked */ -void -xf86ErrorFVerb(int verb, const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - if (xf86Verbose >= verb || xf86LogVerbose >= verb) - LogVWrite(verb, format, ap); - va_end(ap); -} - -/* Like xf86ErrorFVerb, but with an implied verbose level of 1 */ -void -xf86ErrorF(const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - if (xf86Verbose >= 1 || xf86LogVerbose >= 1) - LogVWrite(1, format, ap); - va_end(ap); -} - - -void -xf86LogInit() -{ - char *lf; - -#define LOGSUFFIX ".log" -#define LOGOLDSUFFIX ".old" - - /* Get the log file name */ - if (xf86LogFileFrom == X_DEFAULT) { - /* Append the display number and ".log" */ - lf = malloc(strlen(xf86LogFile) + strlen("%s") + - strlen(LOGSUFFIX) + 1); - if (!lf) - FatalError("Cannot allocate space for the log file name\n"); - sprintf(lf, "%s%%s" LOGSUFFIX, xf86LogFile); - xf86LogFile = lf; - } - - xf86LogFile = LogInit(xf86LogFile, LOGOLDSUFFIX); - xf86LogFileWasOpened = TRUE; - - xf86SetVerbosity(xf86Verbose); - xf86SetLogVerbosity(xf86LogVerbose); - -#undef LOGSUFFIX -#undef LOGOLDSUFFIX -} - -void -xf86CloseLog() -{ - LogClose(); -} - - -/* - * Drivers can use these for using their own SymTabRecs. - */ - -const char * -xf86TokenToString(SymTabPtr table, int token) -{ - int i; - - for (i = 0; table[i].token >= 0 && table[i].token != token; i++) - ; - - if (table[i].token < 0) - return NULL; - else - return(table[i].name); -} - -int -xf86StringToToken(SymTabPtr table, const char *string) -{ - int i; - - if (string == NULL) - return -1; - - for (i = 0; table[i].token >= 0 && xf86NameCmp(string, table[i].name); i++) - ; - - return(table[i].token); -} - -/* - * helper to display the clocks found on a card - */ -void -xf86ShowClocks(ScrnInfoPtr scrp, MessageType from) -{ - int j; - - xf86DrvMsg(scrp->scrnIndex, from, "Pixel clocks available:"); - for (j=0; j < scrp->numClocks; j++) { - if ((j % 4) == 0) { - xf86ErrorF("\n"); - xf86DrvMsg(scrp->scrnIndex, from, "pixel clocks:"); - } - xf86ErrorF(" %7.3f", (double)scrp->clock[j] / 1000.0); - } - xf86ErrorF("\n"); -} - - -/* - * This prints out the driver identify message, including the names of - * the supported chipsets. - * - * XXX This makes assumptions about the line width, etc. Maybe we could - * use a more general "pretty print" function for messages. - */ -void -xf86PrintChipsets(const char *drvname, const char *drvmsg, SymTabPtr chips) -{ - int len, i; - - len = 6 + strlen(drvname) + 2 + strlen(drvmsg) + 2; - xf86Msg(X_INFO, "%s: %s:", drvname, drvmsg); - for (i = 0; chips[i].name != NULL; i++) { - if (i != 0) { - xf86ErrorF(","); - len++; - } - if (len + 2 + strlen(chips[i].name) < 78) { - xf86ErrorF(" "); - len++; - } else { - xf86ErrorF("\n\t"); - len = 8; - } - xf86ErrorF("%s", chips[i].name); - len += strlen(chips[i].name); - } - xf86ErrorF("\n"); -} - - -#define MAXDRIVERS 64 /* A >hack<, to be sure ... */ - - -int -xf86MatchDevice(const char *drivername, GDevPtr **sectlist) -{ - GDevPtr gdp, *pgdp = NULL; - confScreenPtr screensecptr; - int i,j; - - if (sectlist) - *sectlist = NULL; - - if (xf86DoProbe) return 1; - - if (xf86DoConfigure && xf86DoConfigurePass1) return 1; - - /* - * This is a very important function that matches the device sections - * as they show up in the config file with the drivers that the server - * loads at run time. - * - * ChipProbe can call - * int xf86MatchDevice(char * drivername, GDevPtr ** sectlist) - * with its driver name. The function allocates an array of GDevPtr and - * returns this via sectlist and returns the number of elements in - * this list as return value. 0 means none found, -1 means fatal error. - * - * It can figure out which of the Device sections to use for which card - * (using things like the Card statement, etc). For single headed servers - * there will of course be just one such Device section. - */ - i = 0; - - /* - * first we need to loop over all the Screens sections to get to all - * 'active' device sections - */ - for (j=0; xf86ConfigLayout.screens[j].screen != NULL; j++) { - screensecptr = xf86ConfigLayout.screens[j].screen; - if ((screensecptr->device->driver != NULL) - && (xf86NameCmp( screensecptr->device->driver,drivername) == 0) - && (! screensecptr->device->claimed)) { - /* - * we have a matching driver that wasn't claimed, yet - */ - pgdp = xnfrealloc(pgdp, (i + 2) * sizeof(GDevPtr)); - pgdp[i++] = screensecptr->device; - } - } - - /* Then handle the inactive devices */ - j = 0; - while (xf86ConfigLayout.inactives[j].identifier) { - gdp = &xf86ConfigLayout.inactives[j]; - if (gdp->driver && !gdp->claimed && - !xf86NameCmp(gdp->driver,drivername)) { - /* we have a matching driver that wasn't claimed yet */ - pgdp = xnfrealloc(pgdp, (i + 2) * sizeof(GDevPtr)); - pgdp[i++] = gdp; - } - j++; - } - - /* - * make the array NULL terminated and return its address - */ - if (i) - pgdp[i] = NULL; - - if (sectlist) - *sectlist = pgdp; - else - xfree(pgdp); - return i; -} - -struct Inst { - pciVideoPtr pci; - GDevPtr dev; - Bool foundHW; /* PCIid in list of supported chipsets */ - Bool claimed; /* BusID matches with a device section */ - int chip; - int screen; -}; - -int -xf86MatchPciInstances(const char *driverName, int vendorID, - SymTabPtr chipsets, PciChipsets *PCIchipsets, - GDevPtr *devList, int numDevs, DriverPtr drvp, - int **foundEntities) -{ - int i,j; - MessageType from; - pciVideoPtr pPci, *ppPci; - struct Inst { - pciVideoPtr pci; - GDevPtr dev; - Bool foundHW; /* PCIid in list of supported chipsets */ - Bool claimed; /* BusID matches with a device section */ - int chip; - int screen; - } *instances = NULL; - int numClaimedInstances = 0; - int allocatedInstances = 0; - int numFound = 0; - SymTabRec *c; - PciChipsets *id; - GDevPtr devBus = NULL; - GDevPtr dev = NULL; - int *retEntities = NULL; - - *foundEntities = NULL; - - if (vendorID == 0) { - for (ppPci = xf86PciVideoInfo; *ppPci != NULL; ppPci++) { - Bool foundVendor = FALSE; - for (id = PCIchipsets; id->PCIid != -1; id++) { - if ( (((id->PCIid & 0xFFFF0000) >> 16) == (*ppPci)->vendor)) { - if (!foundVendor) { - ++allocatedInstances; - instances = xnfrealloc(instances, - allocatedInstances * sizeof(struct Inst)); - instances[allocatedInstances - 1].pci = *ppPci; - instances[allocatedInstances - 1].dev = NULL; - instances[allocatedInstances - 1].claimed = FALSE; - instances[allocatedInstances - 1].foundHW = FALSE; - instances[allocatedInstances - 1].screen = 0; - foundVendor = TRUE; - } - if ((id->PCIid & 0x0000FFFF) == (*ppPci)->chipType) { - instances[allocatedInstances - 1].foundHW = TRUE; - instances[allocatedInstances - 1].chip = id->numChipset; - numFound++; - } - } - } - } - } else if (vendorID == PCI_VENDOR_GENERIC) { - for (ppPci = xf86PciVideoInfo; *ppPci != NULL; ppPci++) { - for (id = PCIchipsets; id->PCIid != -1; id++) { - if (id->PCIid == xf86CheckPciGAType(*ppPci)) { - ++allocatedInstances; - instances = xnfrealloc(instances, - allocatedInstances * sizeof(struct Inst)); - instances[allocatedInstances - 1].pci = *ppPci; - instances[allocatedInstances - 1].dev = NULL; - instances[allocatedInstances - 1].claimed = FALSE; - instances[allocatedInstances - 1].foundHW = TRUE; - instances[allocatedInstances - 1].chip = id->numChipset; - instances[allocatedInstances - 1].screen = 0; - numFound++; - } - } - } - } else { - /* Find PCI devices that match the given vendor ID */ - for (ppPci = xf86PciVideoInfo; (ppPci != NULL) - && (*ppPci != NULL); ppPci++) { - if ((*ppPci)->vendor == vendorID) { - ++allocatedInstances; - instances = xnfrealloc(instances, - allocatedInstances * sizeof(struct Inst)); - instances[allocatedInstances - 1].pci = *ppPci; - instances[allocatedInstances - 1].dev = NULL; - instances[allocatedInstances - 1].claimed = FALSE; - instances[allocatedInstances - 1].foundHW = FALSE; - instances[allocatedInstances - 1].screen = 0; - - /* Check if the chip type is listed in the chipsets table */ - for (id = PCIchipsets; id->PCIid != -1; id++) { - if (id->PCIid == (*ppPci)->chipType) { - instances[allocatedInstances - 1].chip - = id->numChipset; - instances[allocatedInstances - 1].foundHW = TRUE; - numFound++; - break; - } - } - } - } - } - - /* - * This may be debatable, but if no PCI devices with a matching vendor - * type is found, return zero now. It is probably not desirable to - * allow the config file to override this. - */ - if (allocatedInstances <= 0) { - xfree(instances); - return 0; - } - - if (xf86DoProbe) { - xfree(instances); - return numFound; - } - - if (xf86DoConfigure && xf86DoConfigurePass1) { - GDevPtr pGDev; - int actualcards = 0; - for (i = 0; i < allocatedInstances; i++) { - pPci = instances[i].pci; - if (instances[i].foundHW) { - if (!xf86CheckPciSlot(pPci->bus, pPci->device, pPci->func)) - continue; - actualcards++; - pGDev = xf86AddDeviceToConfigure(drvp->driverName, - instances[i].pci, -1); - if (pGDev) { - /* - * XF86Match???Instances() treat chipID and chipRev as - * overrides, so clobber them here. - */ - pGDev->chipID = pGDev->chipRev = -1; - } - } - } - xfree(instances); - return actualcards; - } - -#ifdef DEBUG - ErrorF("%s instances found: %d\n", driverName, allocatedInstances); -#endif - - /* - * Check for devices that need duplicated instances. This is required - * when there is more than one screen per entity. - * - * XXX This currently doesn't work for cases where the BusID isn't - * specified explicitly in the config file. - */ - - for (j = 0; j < numDevs; j++) { - if (devList[j]->screen > 0 && devList[j]->busID - && *devList[j]->busID) { - for (i = 0; i < allocatedInstances; i++) { - pPci = instances[i].pci; - if (xf86ComparePciBusString(devList[j]->busID, pPci->bus, - pPci->device, - pPci->func)) { - allocatedInstances++; - instances = xnfrealloc(instances, - allocatedInstances * - sizeof(struct Inst)); - instances[allocatedInstances - 1] = instances[i]; - instances[allocatedInstances - 1].screen = - devList[j]->screen; - numFound++; - break; - } - } - } - } - - for (i = 0; i < allocatedInstances; i++) { - pPci = instances[i].pci; - devBus = NULL; - dev = NULL; - for (j = 0; j < numDevs; j++) { - if (devList[j]->busID && *devList[j]->busID) { - if (xf86ComparePciBusString(devList[j]->busID, pPci->bus, - pPci->device, - pPci->func) && - devList[j]->screen == instances[i].screen) { - - if (devBus) - xf86MsgVerb(X_WARNING,0, - "%s: More than one matching Device section for " - "instances\n\t(BusID: %s) found: %s\n", - driverName, devList[j]->busID, - devList[j]->identifier); - else - devBus = devList[j]; - } - } else { - /* - * if device section without BusID is found - * only assign to it to the primary device. - */ - if (xf86IsPrimaryPci(pPci)) { - xf86Msg(X_PROBED, "Assigning device section with no busID" - " to primary device\n"); - if (dev || devBus) - xf86MsgVerb(X_WARNING, 0, - "%s: More than one matching Device section " - "found: %s\n", driverName, devList[j]->identifier); - else - dev = devList[j]; - } - } - } - if (devBus) dev = devBus; /* busID preferred */ - if (!dev) { - if (xf86CheckPciSlot(pPci->bus, pPci->device, pPci->func)) { - xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section " - "for instance (BusID PCI:%i:%i:%i) found\n", - driverName, pPci->bus, pPci->device, pPci->func); - } - } else { - numClaimedInstances++; - instances[i].claimed = TRUE; - instances[i].dev = dev; - } - } -#ifdef DEBUG - ErrorF("%s instances found: %d\n", driverName, numClaimedInstances); -#endif - /* - * Now check that a chipset or chipID override in the device section - * is valid. Chipset has precedence over chipID. - * If chipset is not valid ignore BusSlot completely. - */ - for (i = 0; i < allocatedInstances && numClaimedInstances > 0; i++) { - if (!instances[i].claimed) { - continue; - } - from = X_PROBED; - if (instances[i].dev->chipset) { - for (c = chipsets; c->token >= 0; c++) { - if (xf86NameCmp(c->name, instances[i].dev->chipset) == 0) - break; - } - if (c->token == -1) { - instances[i].claimed = FALSE; - numClaimedInstances--; - xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device " - "section \"%s\" isn't valid for this driver\n", - driverName, instances[i].dev->chipset, - instances[i].dev->identifier); - } else { - instances[i].chip = c->token; - - for (id = PCIchipsets; id->numChipset >= 0; id++) { - if (id->numChipset == instances[i].chip) - break; - } - if(id->numChipset >=0){ - xf86Msg(X_CONFIG,"Chipset override: %s\n", - instances[i].dev->chipset); - from = X_CONFIG; - } else { - instances[i].claimed = FALSE; - numClaimedInstances--; - xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device " - "section \"%s\" isn't a valid PCI chipset\n", - driverName, instances[i].dev->chipset, - instances[i].dev->identifier); - } - } - } else if (instances[i].dev->chipID > 0) { - for (id = PCIchipsets; id->numChipset >= 0; id++) { - if (id->PCIid == instances[i].dev->chipID) - break; - } - if (id->numChipset == -1) { - instances[i].claimed = FALSE; - numClaimedInstances--; - xf86MsgVerb(X_WARNING, 0, "%s: ChipID 0x%04X in Device " - "section \"%s\" isn't valid for this driver\n", - driverName, instances[i].dev->chipID, - instances[i].dev->identifier); - } else { - instances[i].chip = id->numChipset; - - xf86Msg( X_CONFIG,"ChipID override: 0x%04X\n", - instances[i].dev->chipID); - from = X_CONFIG; - } - } else if (!instances[i].foundHW) { - /* - * This means that there was no override and the PCI chipType - * doesn't match one that is supported - */ - instances[i].claimed = FALSE; - numClaimedInstances--; - } - if (instances[i].claimed == TRUE){ - for (c = chipsets; c->token >= 0; c++) { - if (c->token == instances[i].chip) - break; - } - xf86Msg(from,"Chipset %s found\n", - c->name); - } - } - - /* - * Of the claimed instances, check that another driver hasn't already - * claimed its slot. - */ - numFound = 0; - for (i = 0; i < allocatedInstances && numClaimedInstances > 0; i++) { - - if (!instances[i].claimed) - continue; - pPci = instances[i].pci; - - - /* - * Allow the same entity to be used more than once for devices with - * multiple screens per entity. This assumes implicitly that there - * will be a screen == 0 instance. - * - * XXX Need to make sure that two different drivers don't claim - * the same screen > 0 instance. - */ - if (instances[i].screen == 0 && - !xf86CheckPciSlot(pPci->bus, pPci->device, pPci->func)) - continue; - -#ifdef DEBUG - ErrorF("%s: card at %d:%d:%d is claimed by a Device section\n", - driverName, pPci->bus, pPci->device, pPci->func); -#endif - - /* Allocate an entry in the lists to be returned */ - numFound++; - retEntities = xnfrealloc(retEntities, numFound * sizeof(int)); - retEntities[numFound - 1] - = xf86ClaimPciSlot(pPci->bus, pPci->device, - pPci->func,drvp, instances[i].chip, - instances[i].dev,instances[i].dev->active ? - TRUE : FALSE); - if (retEntities[numFound - 1] == -1 && instances[i].screen > 0) { - for (j = 0; j < xf86NumEntities; j++) { - EntityPtr pEnt = xf86Entities[j]; - if (pEnt->busType != BUS_PCI) - continue; - if (pEnt->pciBusId.bus == pPci->bus && - pEnt->pciBusId.device == pPci->device && - pEnt->pciBusId.func == pPci->func) { - retEntities[numFound - 1] = j; - xf86AddDevToEntity(j, instances[i].dev); - break; - } - } - } - } - xfree(instances); - if (numFound > 0) { - *foundEntities = retEntities; - } - - return numFound; -} - -int -xf86MatchIsaInstances(const char *driverName, SymTabPtr chipsets, - IsaChipsets *ISAchipsets, DriverPtr drvp, - FindIsaDevProc FindIsaDevice, GDevPtr *devList, - int numDevs, int **foundEntities) -{ - SymTabRec *c; - IsaChipsets *Chips; - int i; - int numFound = 0; - int foundChip = -1; - int *retEntities = NULL; - - *foundEntities = NULL; - -#if defined(__sparc__) || defined(__powerpc__) - FindIsaDevice = NULL; /* Temporary */ -#endif - - if (xf86DoProbe || (xf86DoConfigure && xf86DoConfigurePass1)) { - if (FindIsaDevice && - ((foundChip = (*FindIsaDevice)(NULL)) != -1)) { - xf86AddDeviceToConfigure(drvp->driverName, NULL, foundChip); - return 1; - } - return 0; - } - - for (i = 0; i < numDevs; i++) { - MessageType from = X_CONFIG; - GDevPtr dev = NULL; - GDevPtr devBus = NULL; - - if (devList[i]->busID && *devList[i]->busID) { - if (xf86ParseIsaBusString(devList[i]->busID)) { - if (devBus) xf86MsgVerb(X_WARNING,0, - "%s: More than one matching Device " - "section for ISA-Bus found: %s\n", - driverName,devList[i]->identifier); - else devBus = devList[i]; - } - } else { - if (xf86IsPrimaryIsa()) { - if (dev) xf86MsgVerb(X_WARNING,0, - "%s: More than one matching " - "Device section found: %s\n", - driverName,devList[i]->identifier); - else dev = devList[i]; - } - } - if (devBus) dev = devBus; - if (dev) { - if (dev->chipset) { - for (c = chipsets; c->token >= 0; c++) { - if (xf86NameCmp(c->name, dev->chipset) == 0) - break; - } - if (c->token == -1) { - xf86MsgVerb(X_WARNING, 0, "%s: Chipset \"%s\" in Device " - "section \"%s\" isn't valid for this driver\n", - driverName, dev->chipset, - dev->identifier); - } else - foundChip = c->token; - } else { - if (FindIsaDevice) foundChip = (*FindIsaDevice)(dev); - /* Probe it */ - from = X_PROBED; - } - } - - /* Check if the chip type is listed in the chipset table - for sanity*/ - - if (foundChip >= 0){ - for (Chips = ISAchipsets; Chips->numChipset >= 0; Chips++) { - if (Chips->numChipset == foundChip) - break; - } - if (Chips->numChipset == -1){ - foundChip = -1; - xf86MsgVerb(X_WARNING,0, - "%s: Driver detected unknown ISA-Bus Chipset\n", - driverName); - } - } - if (foundChip != -1) { - numFound++; - retEntities = xnfrealloc(retEntities,numFound * sizeof(int)); - retEntities[numFound - 1] = - xf86ClaimIsaSlot(drvp,foundChip,dev, dev->active ? TRUE : FALSE); - for (c = chipsets; c->token >= 0; c++) { - if (c->token == foundChip) - break; - } - xf86Msg(from, "Chipset %s found\n", c->name); - } - } - *foundEntities = retEntities; - - return numFound; -} - -/* - * xf86GetClocks -- get the dot-clocks via a BIG BAD hack ... - */ -void -xf86GetClocks(ScrnInfoPtr pScrn, int num, Bool (*ClockFunc)(ScrnInfoPtr, int), - void (*ProtectRegs)(ScrnInfoPtr, Bool), - void (*BlankScreen)(ScrnInfoPtr, Bool), IOADDRESS vertsyncreg, - int maskval, int knownclkindex, int knownclkvalue) -{ - register int status = vertsyncreg; - unsigned long i, cnt, rcnt, sync; - - /* First save registers that get written on */ - (*ClockFunc)(pScrn, CLK_REG_SAVE); - - xf86SetPriority(TRUE); - - if (num > MAXCLOCKS) - num = MAXCLOCKS; - - for (i = 0; i < num; i++) - { - if (ProtectRegs) - (*ProtectRegs)(pScrn, TRUE); - if (!(*ClockFunc)(pScrn, i)) - { - pScrn->clock[i] = -1; - continue; - } - if (ProtectRegs) - (*ProtectRegs)(pScrn, FALSE); - if (BlankScreen) - (*BlankScreen)(pScrn, FALSE); - - usleep(50000); /* let VCO stabilise */ - - cnt = 0; - sync = 200000; - - /* XXX How critical is this? */ - if (!xf86DisableInterrupts()) - { - (*ClockFunc)(pScrn, CLK_REG_RESTORE); - ErrorF("Failed to disable interrupts during clock probe. If\n"); - ErrorF("your OS does not support disabling interrupts, then you\n"); - FatalError("must specify a Clocks line in the XF86Config file.\n"); - } - while ((inb(status) & maskval) == 0x00) - if (sync-- == 0) goto finish; - /* Something appears to be happening, so reset sync count */ - sync = 200000; - while ((inb(status) & maskval) == maskval) - if (sync-- == 0) goto finish; - /* Something appears to be happening, so reset sync count */ - sync = 200000; - while ((inb(status) & maskval) == 0x00) - if (sync-- == 0) goto finish; - - for (rcnt = 0; rcnt < 5; rcnt++) - { - while (!(inb(status) & maskval)) - cnt++; - while ((inb(status) & maskval)) - cnt++; - } - -finish: - xf86EnableInterrupts(); - - pScrn->clock[i] = cnt ? cnt : -1; - if (BlankScreen) - (*BlankScreen)(pScrn, TRUE); - } - - xf86SetPriority(FALSE); - - for (i = 0; i < num; i++) - { - if (i != knownclkindex) - { - if (pScrn->clock[i] == -1) - { - pScrn->clock[i] = 0; - } - else - { - pScrn->clock[i] = (int)(0.5 + - (((float)knownclkvalue) * pScrn->clock[knownclkindex]) / - (pScrn->clock[i])); - /* Round to nearest 10KHz */ - pScrn->clock[i] += 5; - pScrn->clock[i] /= 10; - pScrn->clock[i] *= 10; - } - } - } - - pScrn->clock[knownclkindex] = knownclkvalue; - pScrn->numClocks = num; - - /* Restore registers that were written on */ - (*ClockFunc)(pScrn, CLK_REG_RESTORE); -} - -void -xf86SetPriority(Bool up) -{ - static int saved_nice; - - if (up) { -#ifdef HAS_SETPRIORITY - saved_nice = getpriority(PRIO_PROCESS, 0); - setpriority(PRIO_PROCESS, 0, -20); -#endif -#if defined(SYSV) || defined(SVR4) || defined(linux) - saved_nice = nice(0); - nice(-20 - saved_nice); -#endif - } else { -#ifdef HAS_SETPRIORITY - setpriority(PRIO_PROCESS, 0, saved_nice); -#endif -#if defined(SYSV) || defined(SVR4) || defined(linux) - nice(20 + saved_nice); -#endif - } -} - -const char * -xf86GetVisualName(int visual) -{ - if (visual < 0 || visual > DirectColor) - return NULL; - - return xf86VisualNames[visual]; -} - - -int -xf86GetVerbosity() -{ - return max(xf86Verbose, xf86LogVerbose); -} - -Pix24Flags -xf86GetPix24() -{ - return xf86Info.pixmap24; -} - - -int -xf86GetDepth() -{ - return xf86Depth; -} - - -rgb -xf86GetWeight() -{ - return xf86Weight; -} - - -Gamma -xf86GetGamma() -{ - return xf86Gamma; -} - - -Bool -xf86GetFlipPixels() -{ - return xf86FlipPixels; -} - - -const char * -xf86GetServerName() -{ - return xf86ServerName; -} - - -Bool -xf86ServerIsExiting() -{ - return (dispatchException & DE_TERMINATE) == DE_TERMINATE; -} - - -Bool -xf86ServerIsResetting() -{ - return xf86Resetting; -} - - -Bool -xf86ServerIsInitialising() -{ - return xf86Initialising; -} - - -Bool -xf86ServerIsOnlyDetecting(void) -{ - return xf86DoProbe || xf86DoConfigure; -} - - -Bool -xf86ServerIsOnlyProbing(void) -{ - return xf86ProbeOnly; -} - - -Bool -xf86CaughtSignal() -{ - return xf86Info.caughtSignal; -} - - -Bool -xf86GetVidModeAllowNonLocal() -{ - return xf86Info.vidModeAllowNonLocal; -} - - -Bool -xf86GetVidModeEnabled() -{ - return xf86Info.vidModeEnabled; -} - -Bool -xf86GetModInDevAllowNonLocal() -{ - return xf86Info.miscModInDevAllowNonLocal; -} - - -Bool -xf86GetModInDevEnabled() -{ - return xf86Info.miscModInDevEnabled; -} - - -Bool -xf86GetAllowMouseOpenFail() -{ - return xf86Info.allowMouseOpenFail; -} - - -Bool -xf86IsPc98() -{ -#if defined(i386) || defined(__i386__) - return xf86Info.pc98; -#else - return FALSE; -#endif -} - -void -xf86DisableRandR() -{ - xf86Info.disableRandR = TRUE; - xf86Info.randRFrom = X_PROBED; -} - -CARD32 -xf86GetVersion() -{ - return XF86_VERSION_CURRENT; -} - -CARD32 -xf86GetModuleVersion(pointer module) -{ -#ifdef XFree86LOADER - return (CARD32)LoaderGetModuleVersion(module); -#else - return 0; -#endif -} - -pointer -xf86LoadDrvSubModule(DriverPtr drv, const char *name) -{ -#ifdef XFree86LOADER - pointer ret; - int errmaj = 0, errmin = 0; - - ret = LoadSubModule(drv->module, name, NULL, NULL, NULL, NULL, - &errmaj, &errmin); - if (!ret) - LoaderErrorMsg(NULL, name, errmaj, errmin); - return ret; -#else - return (pointer)1; -#endif -} - -pointer -xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name) -{ -#ifdef XFree86LOADER - pointer ret; - int errmaj = 0, errmin = 0; - - ret = LoadSubModule(pScrn->module, name, NULL, NULL, NULL, NULL, - &errmaj, &errmin); - if (!ret) - LoaderErrorMsg(pScrn->name, name, errmaj, errmin); - return ret; -#else - return (pointer)1; -#endif -} - -/* - * xf86LoadOneModule loads a single module. - */ -pointer -xf86LoadOneModule(char *name, pointer opt) -{ -#ifdef XFree86LOADER - int errmaj, errmin; -#endif - char *Name; - pointer mod; - - if (!name) - return NULL; - -#ifndef NORMALISE_MODULE_NAME - Name = xstrdup(name); -#else - /* Normalise the module name */ - Name = xf86NormalizeName(name); -#endif - - /* Skip empty names */ - if (Name == NULL) - return NULL; - if (*Name == '\0') { - xfree(Name); - return NULL; - } - -#ifdef XFree86LOADER - mod = LoadModule(Name, NULL, NULL, NULL, opt, NULL, &errmaj, &errmin); - if (!mod) - LoaderErrorMsg(NULL, Name, errmaj, errmin); -#else - mod = (pointer)1; -#endif - xfree(Name); - return mod; -} - -void -xf86UnloadSubModule(pointer mod) -{ - /* - * This is disabled for now. The loader isn't smart enough yet to undo - * relocations. - */ -#if defined(XFree86LOADER) && 0 - UnloadSubModule(mod); -#endif -} - -Bool -xf86LoaderCheckSymbol(const char *name) -{ -#ifdef XFree86LOADER - return LoaderSymbol(name) != NULL; -#else - return TRUE; -#endif -} - -void -xf86LoaderReqSymLists(const char **list0, ...) -{ -#ifdef XFree86LOADER - va_list ap; - - va_start(ap, list0); - LoaderVReqSymLists(list0, ap); - va_end(ap); -#endif -} - -void -xf86LoaderReqSymbols(const char *sym0, ...) -{ -#ifdef XFree86LOADER - va_list ap; - - va_start(ap, sym0); - LoaderVReqSymbols(sym0, ap); - va_end(ap); -#endif -} - -void -xf86LoaderRefSymLists(const char **list0, ...) -{ -#ifdef XFree86LOADER - va_list ap; - - va_start(ap, list0); - LoaderVRefSymLists(list0, ap); - va_end(ap); -#endif -} - -void -xf86LoaderRefSymbols(const char *sym0, ...) -{ -#ifdef XFree86LOADER - va_list ap; - - va_start(ap, sym0); - LoaderVRefSymbols(sym0, ap); - va_end(ap); -#endif -} - - -typedef enum { - OPTION_BACKING_STORE -} BSOpts; - -static const OptionInfoRec BSOptions[] = { - { OPTION_BACKING_STORE, "BackingStore", OPTV_BOOLEAN, {0}, FALSE }, - { -1, NULL, OPTV_NONE, {0}, FALSE } -}; - -void -xf86SetBackingStore(ScreenPtr pScreen) -{ - Bool useBS = FALSE; - MessageType from = X_DEFAULT; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - OptionInfoPtr options; - - options = xnfalloc(sizeof(BSOptions)); - (void)memcpy(options, BSOptions, sizeof(BSOptions)); - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); - - /* check for commandline option here */ - if (xf86bsEnableFlag) { - from = X_CMDLINE; - useBS = TRUE; - } else if (xf86bsDisableFlag) { - from = X_CMDLINE; - useBS = FALSE; - } else { - if (xf86GetOptValBool(options, OPTION_BACKING_STORE, &useBS)) - from = X_CONFIG; - } - xfree(options); - pScreen->backingStoreSupport = useBS ? Always : NotUseful; - if (serverGeneration == 1) - xf86DrvMsg(pScreen->myNum, from, "Backing store %s\n", - useBS ? "enabled" : "disabled"); -} - - -typedef enum { - OPTION_SILKEN_MOUSE -} SMOpts; - -static const OptionInfoRec SMOptions[] = { - { OPTION_SILKEN_MOUSE, "SilkenMouse", OPTV_BOOLEAN, {0}, FALSE }, - { -1, NULL, OPTV_NONE, {0}, FALSE } -}; - -void -xf86SetSilkenMouse (ScreenPtr pScreen) -{ - Bool useSM = TRUE; - MessageType from = X_DEFAULT; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - OptionInfoPtr options; - - options = xnfalloc(sizeof(SMOptions)); - (void)memcpy(options, SMOptions, sizeof(SMOptions)); - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); - - /* check for commandline option here */ - /* disable if screen shares resources */ - if (((pScrn->racMemFlags & RAC_CURSOR) && - !xf86NoSharedResources(pScrn->scrnIndex,MEM)) || - ((pScrn->racIoFlags & RAC_CURSOR) && - !xf86NoSharedResources(pScrn->scrnIndex,IO))) { - useSM = FALSE; - from = X_PROBED; - } else if (xf86silkenMouseDisableFlag) { - from = X_CMDLINE; - useSM = FALSE; - } else { - if (xf86GetOptValBool(options, OPTION_SILKEN_MOUSE, &useSM)) - from = X_CONFIG; - } - xfree(options); - /* - * XXX quick hack to report correctly for OSs that can't do SilkenMouse - * yet. Should handle this differently so that alternate async methods - * like Xqueue work correctly with this too. - */ - pScrn->silkenMouse = useSM && xf86SIGIOSupported(); - if (serverGeneration == 1) - xf86DrvMsg(pScreen->myNum, from, "Silken mouse %s\n", - pScrn->silkenMouse ? "enabled" : "disabled"); -} - -/* Wrote this function for the PM2 Xv driver, preliminary. */ - -pointer -xf86FindXvOptions(int scrnIndex, int adaptor_index, char *port_name, - char **adaptor_name, pointer *adaptor_options) -{ - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - confXvAdaptorPtr adaptor; - int i; - - if (adaptor_index >= pScrn->confScreen->numxvadaptors) { - if (adaptor_name) *adaptor_name = NULL; - if (adaptor_options) *adaptor_options = NULL; - return NULL; - } - - adaptor = &pScrn->confScreen->xvadaptors[adaptor_index]; - if (adaptor_name) *adaptor_name = adaptor->identifier; - if (adaptor_options) *adaptor_options = adaptor->options; - - for (i = 0; i < adaptor->numports; i++) - if (!xf86NameCmp(adaptor->ports[i].identifier, port_name)) - return adaptor->ports[i].options; - - return NULL; -} - -/* Rather than duplicate loader's get OS function, just include it directly */ -#define LoaderGetOS xf86GetOS -#include "loader/os.c" - -/* new RAC */ -/* - * xf86ConfigIsa/PciEntity() -- These helper functions assign an - * active entity to a screen, registers its fixed resources, assign - * special enter/leave functions and their private scratch area to - * this entity, take the dog for a walk... - */ -ScrnInfoPtr -xf86ConfigIsaEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex, - IsaChipsets *i_chip, resList res, EntityProc init, - EntityProc enter, EntityProc leave, pointer private) -{ - IsaChipsets *i_id; - EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex); - if (!pEnt) return pScrn; - - if (!(pEnt->location.type == BUS_ISA)) { - xfree(pEnt); - return pScrn; - } - - if (!pEnt->active) { - xf86ConfigIsaEntityInactive(pEnt, i_chip, res, init, enter, - leave, private); - return pScrn; - } - - if (!pScrn) - pScrn = xf86AllocateScreen(pEnt->driver,scrnFlag); - xf86AddEntityToScreen(pScrn,entityIndex); - - if (i_chip) { - for (i_id = i_chip; i_id->numChipset != -1; i_id++) { - if (pEnt->chipset == i_id->numChipset) break; - } - xf86ClaimFixedResources(i_id->resList,entityIndex); - } - xfree(pEnt); - xf86ClaimFixedResources(res,entityIndex); - xf86SetEntityFuncs(entityIndex,init,enter,leave,private); - - return pScrn; -} - -ScrnInfoPtr -xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex, - PciChipsets *p_chip, resList res, EntityProc init, - EntityProc enter, EntityProc leave, pointer private) -{ - PciChipsets *p_id; - EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex); - if (!pEnt) return pScrn; - - if (!(pEnt->location.type == BUS_PCI) - || !xf86GetPciInfoForEntity(entityIndex)) { - xfree(pEnt); - return pScrn; - } - if (!pEnt->active) { - xf86ConfigPciEntityInactive(pEnt, p_chip, res, init, enter, - leave, private); - return pScrn; - } - - if (!pScrn) - pScrn = xf86AllocateScreen(pEnt->driver,scrnFlag); - if (xf86IsEntitySharable(entityIndex)) { - xf86SetEntityShared(entityIndex); - } - xf86AddEntityToScreen(pScrn,entityIndex); - if (xf86IsEntityShared(entityIndex)) { - return pScrn; - } - if (p_chip) { - for (p_id = p_chip; p_id->numChipset != -1; p_id++) { - if (pEnt->chipset == p_id->numChipset) break; - } - xf86ClaimFixedResources(p_id->resList,entityIndex); - } - xfree(pEnt); - - xf86ClaimFixedResources(res,entityIndex); - xf86SetEntityFuncs(entityIndex,init,enter,leave,private); - - return pScrn; -} - -ScrnInfoPtr -xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex, - EntityProc init, EntityProc enter, EntityProc leave, - pointer private) -{ - EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex); - if (!pEnt) return pScrn; - - if (!(pEnt->location.type == BUS_NONE)) { - xfree(pEnt); - return pScrn; - } - - if (!pEnt->active) { - xf86ConfigFbEntityInactive(pEnt, init, enter, leave, private); - return pScrn; - } - - if (!pScrn) - pScrn = xf86AllocateScreen(pEnt->driver,scrnFlag); - xf86AddEntityToScreen(pScrn,entityIndex); - - xf86SetEntityFuncs(entityIndex,init,enter,leave,private); - - return pScrn; -} - -/* - * - * OBSOLETE ! xf86ConfigActiveIsaEntity() and xf86ConfigActivePciEntity() - * are obsolete functions. They the are likely to be removed - * Don't use! - */ -Bool -xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn, int entityIndex, - IsaChipsets *i_chip, resList res, EntityProc init, - EntityProc enter, EntityProc leave, pointer private) -{ - IsaChipsets *i_id; - EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex); - if (!pEnt) return FALSE; - - if (!pEnt->active || !(pEnt->location.type == BUS_ISA)) { - xfree(pEnt); - return FALSE; - } - - xf86AddEntityToScreen(pScrn,entityIndex); - - if (i_chip) { - for (i_id = i_chip; i_id->numChipset != -1; i_id++) { - if (pEnt->chipset == i_id->numChipset) break; - } - xf86ClaimFixedResources(i_id->resList,entityIndex); - } - xfree(pEnt); - xf86ClaimFixedResources(res,entityIndex); - if (!xf86SetEntityFuncs(entityIndex,init,enter,leave,private)) - return FALSE; - - return TRUE; -} - -Bool -xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex, - PciChipsets *p_chip, resList res, EntityProc init, - EntityProc enter, EntityProc leave, pointer private) -{ - PciChipsets *p_id; - EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex); - if (!pEnt) return FALSE; - - if (!pEnt->active || !(pEnt->location.type == BUS_PCI)) { - xfree(pEnt); - return FALSE; - } - xf86AddEntityToScreen(pScrn,entityIndex); - - if (p_chip) { - for (p_id = p_chip; p_id->numChipset != -1; p_id++) { - if (pEnt->chipset == p_id->numChipset) break; - } - xf86ClaimFixedResources(p_id->resList,entityIndex); - } - xfree(pEnt); - - xf86ClaimFixedResources(res,entityIndex); - if (!xf86SetEntityFuncs(entityIndex,init,enter,leave,private)) - return FALSE; - - return TRUE; -} - -/* - * xf86ConfigPci/IsaEntityInactive() -- These functions can be used - * to configure an inactive entity as well as to reconfigure an - * previously active entity inactive. If the entity has been - * assigned to a screen before it will be removed. If p_pci(p_isa) is - * non-NULL all static resources listed there will be registered. - */ -void -xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip, - resList res, EntityProc init, EntityProc enter, - EntityProc leave, pointer private) -{ - PciChipsets *p_id; - ScrnInfoPtr pScrn; - - if ((pScrn = xf86FindScreenForEntity(pEnt->index))) - xf86RemoveEntityFromScreen(pScrn,pEnt->index); - else if (p_chip) { - for (p_id = p_chip; p_id->numChipset != -1; p_id++) { - if (pEnt->chipset == p_id->numChipset) break; - } - xf86ClaimFixedResources(p_id->resList,pEnt->index); - } - xf86ClaimFixedResources(res,pEnt->index); - /* shared resources are only needed when entity is active: remove */ - xf86DeallocateResourcesForEntity(pEnt->index, ResShared); - xf86SetEntityFuncs(pEnt->index,init,enter,leave,private); -} - -void -xf86ConfigIsaEntityInactive(EntityInfoPtr pEnt, IsaChipsets *i_chip, - resList res, EntityProc init, EntityProc enter, - EntityProc leave, pointer private) -{ - IsaChipsets *i_id; - ScrnInfoPtr pScrn; - - if ((pScrn = xf86FindScreenForEntity(pEnt->index))) - xf86RemoveEntityFromScreen(pScrn,pEnt->index); - else if (i_chip) { - for (i_id = i_chip; i_id->numChipset != -1; i_id++) { - if (pEnt->chipset == i_id->numChipset) break; - } - xf86ClaimFixedResources(i_id->resList,pEnt->index); - } - xf86ClaimFixedResources(res,pEnt->index); - /* shared resources are only needed when entity is active: remove */ - xf86DeallocateResourcesForEntity(pEnt->index, ResShared); - xf86SetEntityFuncs(pEnt->index,init,enter,leave,private); -} - -void -xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init, - EntityProc enter, EntityProc leave, pointer private) -{ - ScrnInfoPtr pScrn; - - if ((pScrn = xf86FindScreenForEntity(pEnt->index))) - xf86RemoveEntityFromScreen(pScrn,pEnt->index); - xf86SetEntityFuncs(pEnt->index,init,enter,leave,private); -} - -Bool -xf86IsScreenPrimary(int scrnIndex) -{ - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - int i; - - for (i=0 ; i < pScrn->numEntities; i++) { - if (xf86IsEntityPrimary(i)) - return TRUE; - } - return FALSE; -} - -int -xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type, - int format, unsigned long len, pointer value ) -{ - RootWinPropPtr pNewProp = NULL, pRegProp; - int i; - Bool existing = FALSE; - -#ifdef DEBUG - ErrorF("xf86RegisterRootWindowProperty(%d, %ld, %ld, %d, %ld, %p)\n", - ScrnIndex, property, type, format, len, value); -#endif - - if (ScrnIndex<0 || ScrnIndex>=xf86NumScreens) { - return(BadMatch); - } - - if (xf86RegisteredPropertiesTable && - xf86RegisteredPropertiesTable[ScrnIndex]) { - for (pNewProp = xf86RegisteredPropertiesTable[ScrnIndex]; - pNewProp; pNewProp = pNewProp->next) { - if (strcmp(pNewProp->name, NameForAtom(property)) == 0) - break; - } - } - - if (!pNewProp) { - if ((pNewProp = (RootWinPropPtr)xalloc(sizeof(RootWinProp))) == NULL) { - return(BadAlloc); - } - /* - * We will put this property at the end of the list so that - * the changes are made in the order they were requested. - */ - pNewProp->next = NULL; - } else { - if (pNewProp->name) - xfree(pNewProp->name); - existing = TRUE; - } - - pNewProp->name = xnfstrdup(NameForAtom(property)); - pNewProp->type = type; - pNewProp->format = format; - pNewProp->size = len; - pNewProp->data = value; - -#ifdef DEBUG - ErrorF("new property filled\n"); -#endif - - if (NULL==xf86RegisteredPropertiesTable) { -#ifdef DEBUG - ErrorF("creating xf86RegisteredPropertiesTable[] size %d\n", - xf86NumScreens); -#endif - if ( NULL==(xf86RegisteredPropertiesTable=(RootWinPropPtr*)xnfcalloc(sizeof(RootWinProp),xf86NumScreens) )) { - return(BadAlloc); - } - for (i=0; inext != NULL) { -#ifdef DEBUG - ErrorF("- next %p\n", (void *)pRegProp); -#endif - pRegProp = pRegProp->next; - } - pRegProp->next = pNewProp; - } - } -#ifdef DEBUG - ErrorF("xf86RegisterRootWindowProperty succeeded\n"); -#endif - return(Success); -} - -Bool -xf86IsUnblank(int mode) -{ - switch(mode) { - case SCREEN_SAVER_OFF: - case SCREEN_SAVER_FORCER: - return TRUE; - case SCREEN_SAVER_ON: - case SCREEN_SAVER_CYCLE: - return FALSE; - default: - xf86MsgVerb(X_WARNING, 0, "Unexpected save screen mode: %d\n", mode); - return TRUE; - } -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86InPriv.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86InPriv.h deleted file mode 100644 index 4a02606d3..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86InPriv.h +++ /dev/null @@ -1,48 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86InPriv.h,v 1.5 2003/08/24 17:36:52 dawes Exp $ */ - -/* - * Copyright (c) 1999 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef _xf86InPriv_h -#define _xf86InPriv_h - -/* xf86Globals.c */ -#ifdef XFree86LOADER -extern InputDriverPtr *xf86InputDriverList; -#else -extern InputDriverPtr xf86InputDriverList[]; -#endif -extern int xf86NumInputDrivers; - -/* xf86Xinput.c */ -void xf86ActivateDevice(InputInfoPtr pInfo); - -#endif /* _xf86InPriv_h */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Init.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Init.c deleted file mode 100644 index e504c300a..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Init.c +++ /dev/null @@ -1,2035 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.212 2004/01/27 01:31:45 dawes Exp $ */ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 1.29 2005/12/14 20:12:00 ajax Exp $ */ - -/* - * Loosely based on code bearing the following copyright: - * - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - */ -/* - * Copyright (c) 1992-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -#undef HAS_UTSNAME -#if !defined(WIN32) && !defined(__UNIXOS2__) -#define HAS_UTSNAME 1 -#include -#endif - -#define NEED_EVENTS -#ifdef __UNIXOS2__ -#define I_NEED_OS2_H -#endif -#include -#include -#include -#include -#include "input.h" -#include "servermd.h" -#include "windowstr.h" -#include "scrnintstr.h" -#include "site.h" -#include "mi.h" - -#include "compiler.h" - -#ifdef XFree86LOADER -#include "loaderProcs.h" -#endif -#ifdef XFreeXDGA -#include "dgaproc.h" -#endif - -#define XF86_OS_PRIVS -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Config.h" -#include "xf86_OSlib.h" -#include "xorgVersion.h" -#include "xf86Date.h" -#include "xf86Build.h" -#include "mipointer.h" -#ifdef XINPUT -#include -#include -#else -#include "inputstr.h" -#endif -#include "xf86DDC.h" -#include "xf86Xinput.h" -#include "xf86InPriv.h" -#ifdef RENDER -#include "picturestr.h" -#endif - -#include "globals.h" - -#ifdef XTESTEXT1 -#include "atKeynames.h" -extern int xtest_command_key; -#endif /* XTESTEXT1 */ - -#ifdef DPMSExtension -#define DPMS_SERVER -#include -#include "dpmsproc.h" -#endif - - -/* forward declarations */ - -static void xf86PrintBanner(void); -static void xf86PrintMarkers(void); -static void xf86RunVtInit(void); - -#ifdef __UNIXOS2__ -extern void os2ServerVideoAccess(); -#endif - -#ifdef XF86PM -void (*xf86OSPMClose)(void) = NULL; -#endif - -#ifdef XFree86LOADER -static char *baseModules[] = { - "bitmap", - "pcidata", - NULL -}; -#endif - -/* Common pixmap formats */ - -static PixmapFormatRec formats[MAXFORMATS] = { - { 1, 1, BITMAP_SCANLINE_PAD }, - { 4, 8, BITMAP_SCANLINE_PAD }, - { 8, 8, BITMAP_SCANLINE_PAD }, - { 15, 16, BITMAP_SCANLINE_PAD }, - { 16, 16, BITMAP_SCANLINE_PAD }, - { 24, 32, BITMAP_SCANLINE_PAD }, -#ifdef RENDER - { 32, 32, BITMAP_SCANLINE_PAD }, -#endif -}; -#ifdef RENDER -static int numFormats = 7; -#else -static int numFormats = 6; -#endif -static Bool formatsDone = FALSE; - -InputDriverRec XF86KEYBOARD = { - 1, - "keyboard", - NULL, - NULL, - NULL, - NULL, - 0 -}; - -static Bool -xf86CreateRootWindow(WindowPtr pWin) -{ - int ret = TRUE; - int err = Success; - ScreenPtr pScreen = pWin->drawable.pScreen; - RootWinPropPtr pProp; - CreateWindowProcPtr CreateWindow = - (CreateWindowProcPtr)(pScreen->devPrivates[xf86CreateRootWindowIndex].ptr); - -#ifdef DEBUG - ErrorF("xf86CreateRootWindow(%p)\n", pWin); -#endif - - if ( pScreen->CreateWindow != xf86CreateRootWindow ) { - /* Can't find hook we are hung on */ - xf86DrvMsg(pScreen->myNum, X_WARNING /* X_ERROR */, - "xf86CreateRootWindow %p called when not in pScreen->CreateWindow %p n", - (void *)xf86CreateRootWindow, - (void *)pScreen->CreateWindow ); - } - - /* Unhook this function ... */ - pScreen->CreateWindow = CreateWindow; - pScreen->devPrivates[xf86CreateRootWindowIndex].ptr = NULL; - - /* ... and call the previous CreateWindow fuction, if any */ - if (NULL!=pScreen->CreateWindow) { - ret = (*pScreen->CreateWindow)(pWin); - } - - /* Now do our stuff */ - if (xf86RegisteredPropertiesTable != NULL) { - if (pWin->parent == NULL && xf86RegisteredPropertiesTable != NULL) { - for (pProp = xf86RegisteredPropertiesTable[pScreen->myNum]; - pProp != NULL && err==Success; - pProp = pProp->next ) - { - Atom prop; - - prop = MakeAtom(pProp->name, strlen(pProp->name), TRUE); - err = ChangeWindowProperty(pWin, - prop, pProp->type, - pProp->format, PropModeReplace, - pProp->size, pProp->data, - FALSE - ); - } - - /* Look at err */ - ret &= (err==Success); - - } else { - xf86Msg(X_ERROR, "xf86CreateRootWindow unexpectedly called with " - "non-root window %p (parent %p)\n", - (void *)pWin, (void *)pWin->parent); - ret = FALSE; - } - } - -#ifdef DEBUG - ErrorF("xf86CreateRootWindow() returns %d\n", ret); -#endif - return (ret); -} - - -/* - * InitOutput -- - * Initialize screenInfo for all actually accessible framebuffers. - * That includes vt-manager setup, querying all possible devices and - * collecting the pixmap formats. - */ - -static void -PostConfigInit(void) -{ - /* - * Install signal handler for unexpected signals - */ - xf86Info.caughtSignal=FALSE; - if (!xf86Info.notrapSignals) { - signal(SIGSEGV,xf86SigHandler); - signal(SIGILL,xf86SigHandler); -#ifdef SIGEMT - signal(SIGEMT,xf86SigHandler); -#endif - signal(SIGFPE,xf86SigHandler); -#ifdef SIGBUS - signal(SIGBUS,xf86SigHandler); -#endif -#ifdef SIGSYS - signal(SIGSYS,xf86SigHandler); -#endif -#ifdef SIGXCPU - signal(SIGXCPU,xf86SigHandler); -#endif -#ifdef SIGXFSZ - signal(SIGXFSZ,xf86SigHandler); -#endif -#ifdef MEMDEBUG - signal(SIGUSR2,xf86SigMemDebug); -#endif - } - -#ifdef XF86PM - xf86OSPMClose = xf86OSPMOpen(); -#endif - - /* Run an external VT Init program if specified in the config file */ - xf86RunVtInit(); - - /* Do this after XF86Config is read (it's normally in OsInit()) */ - OsInitColors(); -} - -void -InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) -{ - int i, j, k, scr_index; - static unsigned long generation = 0; -#ifdef XFree86LOADER - char **modulelist; - pointer *optionlist; -#endif - screenLayoutPtr layout; - Pix24Flags screenpix24, pix24; - MessageType pix24From = X_DEFAULT; - Bool pix24Fail = FALSE; - Bool autoconfig = FALSE; - -#ifdef __UNIXOS2__ - os2ServerVideoAccess(); /* See if we have access to the screen before doing anything */ -#endif - - xf86Initialising = TRUE; - - /* Do this early? */ - if (generation != serverGeneration) { - xf86ScreenIndex = AllocateScreenPrivateIndex(); - xf86CreateRootWindowIndex = AllocateScreenPrivateIndex(); - xf86PixmapIndex = AllocatePixmapPrivateIndex(); - generation = serverGeneration; - } - - if (serverGeneration == 1) { - - pScreenInfo->numScreens = 0; - - if ((xf86ServerName = strrchr(argv[0], '/')) != 0) - xf86ServerName++; - else - xf86ServerName = argv[0]; - - xf86PrintBanner(); - xf86PrintMarkers(); - if (xf86LogFile) { - time_t t; - const char *ct; - t = time(NULL); - ct = ctime(&t); - xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s", - xf86LogFile, ct); - } - - /* Read and parse the config file */ - if (!xf86DoProbe && !xf86DoConfigure) { - switch (xf86HandleConfigFile(FALSE)) { - case CONFIG_OK: - break; - case CONFIG_PARSE_ERROR: - xf86Msg(X_ERROR, "Error parsing the config file\n"); - return; - case CONFIG_NOFILE: - autoconfig = TRUE; - break; - } - } - - if (!autoconfig) - PostConfigInit(); - -#ifdef XFree86LOADER - /* Initialise the loader */ - LoaderInit(); - - /* Tell the loader the default module search path */ - LoaderSetPath(xf86ModulePath); - -#ifdef TESTING - { - char **list, **l; - const char *subdirs[] = { - "drivers", - NULL - }; - const char *patlist[] = { - "(.*)_drv\\.so", - "(.*)_drv\\.o", - NULL - }; - ErrorF("Getting module listing...\n"); - list = LoaderListDirs(NULL, NULL); - if (list) - for (l = list; *l; l++) - ErrorF("module: %s\n", *l); - LoaderFreeDirList(list); - ErrorF("Getting video driver listing...\n"); - list = LoaderListDirs(subdirs, NULL); - if (list) - for (l = list; *l; l++) - ErrorF("video driver: %s\n", *l); - LoaderFreeDirList(list); - ErrorF("Getting driver listing...\n"); - list = LoaderListDirs(NULL, patlist); - if (list) - for (l = list; *l; l++) - ErrorF("video driver: %s\n", *l); - LoaderFreeDirList(list); - } -#endif - - /* Force load mandatory base modules */ - if (!xf86LoadModules(baseModules, NULL)) - FatalError("Unable to load required base modules, Exiting...\n"); - -#endif - - xf86OpenConsole(); - - /* Do a general bus probe. This will be a PCI probe for x86 platforms */ - xf86BusProbe(); - - if (xf86DoProbe) - DoProbe(); - - if (xf86DoConfigure) - DoConfigure(); - - if (autoconfig) { - if (!xf86AutoConfig()) { - xf86Msg(X_ERROR, "Auto configuration failed\n"); - return; - } - PostConfigInit(); - } - - /* Initialise the resource broker */ - xf86ResourceBrokerInit(); - -#ifdef XFree86LOADER - /* Load all modules specified explicitly in the config file */ - if ((modulelist = xf86ModulelistFromConfig(&optionlist))) { - xf86LoadModules(modulelist, optionlist); - xfree(modulelist); - xfree(optionlist); - } - - /* Load all driver modules specified in the config file */ - if ((modulelist = xf86DriverlistFromConfig())) { - xf86LoadModules(modulelist, NULL); - xfree(modulelist); - } - -#ifdef USE_DEPRECATED_KEYBOARD_DRIVER - /* Setup the builtin input drivers */ - xf86AddInputDriver(&XF86KEYBOARD, NULL, 0); -#endif - /* Load all input driver modules specified in the config file. */ - if ((modulelist = xf86InputDriverlistFromConfig())) { - xf86LoadModules(modulelist, NULL); - xfree(modulelist); - } - - /* - * It is expected that xf86AddDriver()/xf86AddInputDriver will be - * called for each driver as it is loaded. Those functions save the - * module pointers for drivers. - * XXX Nothing keeps track of them for other modules. - */ - /* XXX What do we do if not all of these could be loaded? */ -#endif - - /* - * At this point, xf86DriverList[] is all filled in with entries for - * each of the drivers to try and xf86NumDrivers has the number of - * drivers. If there are none, return now. - */ - - if (xf86NumDrivers == 0) { - xf86Msg(X_ERROR, "No drivers available.\n"); - return; - } - - /* - * Call each of the Identify functions and call the driverFunc to check - * if HW access is required. The Identify functions print out some - * identifying information, and anything else that might be - * needed at this early stage. - */ - - for (i = 0; i < xf86NumDrivers; i++) { - xorgHWFlags flags; - /* The Identify function is mandatory, but if it isn't there continue */ - if (xf86DriverList[i]->Identify != NULL) - xf86DriverList[i]->Identify(0); - else { - xf86Msg(X_WARNING, "Driver `%s' has no Identify function\n", - xf86DriverList[i]->driverName ? xf86DriverList[i]->driverName - : "noname"); - } - if (!xorgHWAccess - && (!xf86DriverList[i]->driverFunc - || !xf86DriverList[i]->driverFunc(NULL, - GET_REQUIRED_HW_INTERFACES, - &flags) - || NEED_IO_ENABLED(flags))) - xorgHWAccess = TRUE; - } - - /* Enable full I/O access */ - if (xorgHWAccess) { - if(!xf86EnableIO()) - /* oops, we have failed */ - xorgHWAccess = FALSE; - } - - /* - * Locate bus slot that had register IO enabled at server startup - */ - - xf86AccessInit(); - xf86FindPrimaryDevice(); - - /* - * Now call each of the Probe functions. Each successful probe will - * result in an extra entry added to the xf86Screens[] list for each - * instance of the hardware found. - */ - - for (i = 0; i < xf86NumDrivers; i++) { - xorgHWFlags flags; - if (!xorgHWAccess) { - if (!xf86DriverList[i]->driverFunc - || !xf86DriverList[i]->driverFunc(NULL, - GET_REQUIRED_HW_INTERFACES, - &flags) - || NEED_IO_ENABLED(flags)) - continue; - } - - if (xf86DriverList[i]->Probe != NULL) - xf86DriverList[i]->Probe(xf86DriverList[i], PROBE_DEFAULT); - else { - xf86MsgVerb(X_WARNING, 0, - "Driver `%s' has no Probe function (ignoring)\n", - xf86DriverList[i]->driverName - ? xf86DriverList[i]->driverName : "noname"); - } - xf86SetPciVideo(NULL,NONE); - } - - /* - * If nothing was detected, return now. - */ - - if (xf86NumScreens == 0) { - xf86Msg(X_ERROR, "No devices detected.\n"); - return; - } - - /* - * Match up the screens found by the probes against those specified - * in the config file. Remove the ones that won't be used. Sort - * them in the order specified. - */ - - /* - * What is the best way to do this? - * - * For now, go through the screens allocated by the probes, and - * look for screen config entry which refers to the same device - * section as picked out by the probe. - * - */ - - for (i = 0; i < xf86NumScreens; i++) { - for (layout = xf86ConfigLayout.screens; layout->screen != NULL; - layout++) { - Bool found = FALSE; - for (j = 0; j < xf86Screens[i]->numEntities; j++) { - - GDevPtr dev = - xf86GetDevFromEntity(xf86Screens[i]->entityList[j], - xf86Screens[i]->entityInstanceList[j]); - - if (dev == layout->screen->device) { - /* A match has been found */ - xf86Screens[i]->confScreen = layout->screen; - found = TRUE; - break; - } - } - if (found) break; - } - if (layout->screen == NULL) { - /* No match found */ - xf86Msg(X_ERROR, - "Screen %d deleted because of no matching config section.\n", i); - xf86DeleteScreen(i--, 0); - } - } - - /* - * If no screens left, return now. - */ - - if (xf86NumScreens == 0) { - xf86Msg(X_ERROR, - "Device(s) detected, but none match those in the config file.\n"); - return; - } - - xf86PostProbe(); - xf86EntityInit(); - - /* - * Sort the drivers to match the requested ording. Using a slow - * bubble sort. - */ - for (j = 0; j < xf86NumScreens - 1; j++) { - for (i = 0; i < xf86NumScreens - j - 1; i++) { - if (xf86Screens[i + 1]->confScreen->screennum < - xf86Screens[i]->confScreen->screennum) { - ScrnInfoPtr tmpScrn = xf86Screens[i + 1]; - xf86Screens[i + 1] = xf86Screens[i]; - xf86Screens[i] = tmpScrn; - } - } - } - /* Fix up the indexes */ - for (i = 0; i < xf86NumScreens; i++) { - xf86Screens[i]->scrnIndex = i; - } - - /* - * Call the driver's PreInit()'s to complete initialisation for the first - * generation. - */ - - for (i = 0; i < xf86NumScreens; i++) { - xf86EnableAccess(xf86Screens[i]); - if (xf86Screens[i]->PreInit && - xf86Screens[i]->PreInit(xf86Screens[i], 0)) - xf86Screens[i]->configured = TRUE; - } - for (i = 0; i < xf86NumScreens; i++) - if (!xf86Screens[i]->configured) - xf86DeleteScreen(i--, 0); - - /* - * If no screens left, return now. - */ - - if (xf86NumScreens == 0) { - xf86Msg(X_ERROR, - "Screen(s) found, but none have a usable configuration.\n"); - return; - } - - /* This could be moved into a separate function */ - - /* - * Check that all screens have initialised the mandatory function - * entry points. Delete those which have not. - */ - -#define WARN_SCREEN(func) \ - xf86Msg(X_ERROR, "Driver `%s' has no %s function, deleting.\n", \ - xf86Screens[i]->name, (warned++, func)) - - for (i = 0; i < xf86NumScreens; i++) { - int warned = 0; - if (xf86Screens[i]->name == NULL) { - xf86Screens[i]->name = xnfalloc(strlen("screen") + 1 + 1); - if (i < 10) - sprintf(xf86Screens[i]->name, "screen%c", i + '0'); - else - sprintf(xf86Screens[i]->name, "screen%c", i - 10 + 'A'); - xf86MsgVerb(X_WARNING, 0, - "Screen driver %d has no name set, using `%s'.\n", - i, xf86Screens[i]->name); - } - if (xf86Screens[i]->ScreenInit == NULL) - WARN_SCREEN("ScreenInit"); - if (xf86Screens[i]->EnterVT == NULL) - WARN_SCREEN("EnterVT"); - if (xf86Screens[i]->LeaveVT == NULL) - WARN_SCREEN("LeaveVT"); - if (warned) - xf86DeleteScreen(i--, 0); - } - - /* - * If no screens left, return now. - */ - - if (xf86NumScreens == 0) { - xf86Msg(X_ERROR, "Screen(s) found, but drivers were unusable.\n"); - return; - } - - /* XXX Should this be before or after loading dependent modules? */ - if (xf86ProbeOnly) - { - OsCleanup(TRUE); - AbortDDX(); - fflush(stderr); - exit(0); - } - -#ifdef XFree86LOADER - /* Remove (unload) drivers that are not required */ - for (i = 0; i < xf86NumDrivers; i++) - if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0) - xf86DeleteDriver(i); -#endif - - /* - * At this stage we know how many screens there are. - */ - - for (i = 0; i < xf86NumScreens; i++) - xf86InitViewport(xf86Screens[i]); - - /* - * Collect all pixmap formats and check for conflicts at the display - * level. Should we die here? Or just delete the offending screens? - * Also, should this be done for -probeonly? - */ - screenpix24 = Pix24DontCare; - for (i = 0; i < xf86NumScreens; i++) { - if (xf86Screens[i]->imageByteOrder != - xf86Screens[0]->imageByteOrder) - FatalError("Inconsistent display bitmapBitOrder. Exiting\n"); - if (xf86Screens[i]->bitmapScanlinePad != - xf86Screens[0]->bitmapScanlinePad) - FatalError("Inconsistent display bitmapScanlinePad. Exiting\n"); - if (xf86Screens[i]->bitmapScanlineUnit != - xf86Screens[0]->bitmapScanlineUnit) - FatalError("Inconsistent display bitmapScanlineUnit. Exiting\n"); - if (xf86Screens[i]->bitmapBitOrder != - xf86Screens[0]->bitmapBitOrder) - FatalError("Inconsistent display bitmapBitOrder. Exiting\n"); - - /* Determine the depth 24 pixmap format the screens would like */ - if (xf86Screens[i]->pixmap24 != Pix24DontCare) { - if (screenpix24 == Pix24DontCare) - screenpix24 = xf86Screens[i]->pixmap24; - else if (screenpix24 != xf86Screens[i]->pixmap24) - FatalError("Inconsistent depth 24 pixmap format. Exiting\n"); - } - } - /* check if screenpix24 is consistent with the config/cmdline */ - if (xf86Info.pixmap24 != Pix24DontCare) { - pix24 = xf86Info.pixmap24; - pix24From = xf86Info.pix24From; - if (screenpix24 != Pix24DontCare && screenpix24 != xf86Info.pixmap24) - pix24Fail = TRUE; - } else if (screenpix24 != Pix24DontCare) { - pix24 = screenpix24; - pix24From = X_PROBED; - } else - pix24 = Pix24Use32; - - if (pix24Fail) - FatalError("Screen(s) can't use the required depth 24 pixmap format" - " (%d). Exiting\n", PIX24TOBPP(pix24)); - - /* Initialise the depth 24 format */ - for (j = 0; j < numFormats && formats[j].depth != 24; j++) - ; - formats[j].bitsPerPixel = PIX24TOBPP(pix24); - - /* Collect additional formats */ - for (i = 0; i < xf86NumScreens; i++) { - for (j = 0; j < xf86Screens[i]->numFormats; j++) { - for (k = 0; ; k++) { - if (k >= numFormats) { - if (k >= MAXFORMATS) - FatalError("Too many pixmap formats! Exiting\n"); - formats[k] = xf86Screens[i]->formats[j]; - numFormats++; - break; - } - if (formats[k].depth == xf86Screens[i]->formats[j].depth) { - if ((formats[k].bitsPerPixel == - xf86Screens[i]->formats[j].bitsPerPixel) && - (formats[k].scanlinePad == - xf86Screens[i]->formats[j].scanlinePad)) - break; - FatalError("Inconsistent pixmap format for depth %d." - " Exiting\n", formats[k].depth); - } - } - } - } - formatsDone = TRUE; - - if (xf86Info.vtno >= 0 ) { -#define VT_ATOM_NAME "XFree86_VT" - Atom VTAtom=-1; - CARD32 *VT = NULL; - int ret; - - /* This memory needs to stay available until the screen has been - initialized, and we can create the property for real. - */ - if ( (VT = xalloc(sizeof(CARD32)))==NULL ) { - FatalError("Unable to make VT property - out of memory. Exiting...\n"); - } - *VT = xf86Info.vtno; - - VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME), TRUE); - - for (i = 0, ret = Success; i < xf86NumScreens && ret == Success; i++) { - ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex, - VTAtom, XA_INTEGER, 32, - 1, VT ); - if (ret != Success) - xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING, - "Failed to register VT property\n"); - } - } - - /* If a screen uses depth 24, show what the pixmap format is */ - for (i = 0; i < xf86NumScreens; i++) { - if (xf86Screens[i]->depth == 24) { - xf86Msg(pix24From, "Depth 24 pixmap format is %d bpp\n", - PIX24TOBPP(pix24)); - break; - } - } - -#if BITMAP_SCANLINE_UNIT == 64 - /* - * cfb24 doesn't currently work on architectures with a 64 bit - * BITMAP_SCANLINE_UNIT, so check for 24 bit pixel size for pixmaps - * or framebuffers. - */ - { - Bool usesCfb24 = FALSE; - - if (PIX24TOBPP(pix24) == 24) - usesCfb24 = TRUE; - for (i = 0; i < xf86NumScreens; i++) - if (xf86Screens[i]->bitsPerPixel == 24) - usesCfb24 = TRUE; - if (usesCfb24) { - FatalError("24-bit pixel size is not supported on systems with" - " 64-bit scanlines.\n"); - } - } -#endif - -#ifdef XKB - xf86InitXkb(); -#endif - /* set up the proper access funcs */ - xf86PostPreInit(); - - AddCallback(&ServerGrabCallback, xf86GrabServerCallback, NULL); - - } else { - /* - * serverGeneration != 1; some OSs have to do things here, too. - */ - xf86OpenConsole(); - -#ifdef XF86PM - /* - should we reopen it here? We need to deal with an already opened - device. We could leave this to the OS layer. For now we simply - close it here - */ - if (xf86OSPMClose) - xf86OSPMClose(); - if ((xf86OSPMClose = xf86OSPMOpen()) != NULL) - xf86MsgVerb(X_INFO, 3, "APM registered successfully\n"); -#endif - - /* Make sure full I/O access is enabled */ - if (xorgHWAccess) - xf86EnableIO(); - } - -#if 0 - /* - * Install signal handler for unexpected signals - */ - xf86Info.caughtSignal=FALSE; - if (!xf86Info.notrapSignals) - { - signal(SIGSEGV,xf86SigHandler); - signal(SIGILL,xf86SigHandler); -#ifdef SIGEMT - signal(SIGEMT,xf86SigHandler); -#endif - signal(SIGFPE,xf86SigHandler); -#ifdef SIGBUS - signal(SIGBUS,xf86SigHandler); -#endif -#ifdef SIGSYS - signal(SIGSYS,xf86SigHandler); -#endif -#ifdef SIGXCPU - signal(SIGXCPU,xf86SigHandler); -#endif -#ifdef SIGXFSZ - signal(SIGXFSZ,xf86SigHandler); -#endif - } -#endif - - /* - * Use the previously collected parts to setup pScreenInfo - */ - - pScreenInfo->imageByteOrder = xf86Screens[0]->imageByteOrder; - pScreenInfo->bitmapScanlinePad = xf86Screens[0]->bitmapScanlinePad; - pScreenInfo->bitmapScanlineUnit = xf86Screens[0]->bitmapScanlineUnit; - pScreenInfo->bitmapBitOrder = xf86Screens[0]->bitmapBitOrder; - pScreenInfo->numPixmapFormats = numFormats; - for (i = 0; i < numFormats; i++) - pScreenInfo->formats[i] = formats[i]; - - /* Make sure the server's VT is active */ - - if (serverGeneration != 1) { - xf86Resetting = TRUE; - /* All screens are in the same state, so just check the first */ - if (!xf86Screens[0]->vtSema) { -#ifdef HAS_USL_VTS - ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ); -#endif - xf86AccessEnter(); - xf86EnterServerState(SETUP); - } - } -#ifdef SCO325 - else { - /* - * Under SCO we must ack that we got the console at startup, - * I think this is the safest way to assure it. - */ - static int once = 1; - if (once) { - once = 0; - if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) - xf86Msg(X_WARNING, "VT_ACKACQ failed"); - } - } -#endif /* SCO325 */ - - for (i = 0; i < xf86NumScreens; i++) { - xf86EnableAccess(xf86Screens[i]); - /* - * Almost everything uses these defaults, and many of those that - * don't, will wrap them. - */ - xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess; - xf86Screens[i]->SetDGAMode = xf86SetDGAMode; - xf86Screens[i]->DPMSSet = NULL; - xf86Screens[i]->LoadPalette = NULL; - xf86Screens[i]->SetOverscan = NULL; - xf86Screens[i]->DriverFunc = NULL; - xf86Screens[i]->pScreen = NULL; - scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv); - if (scr_index == i) { - /* - * Hook in our ScrnInfoRec, and initialise some other pScreen - * fields. - */ - screenInfo.screens[scr_index]->devPrivates[xf86ScreenIndex].ptr - = (pointer)xf86Screens[i]; - xf86Screens[i]->pScreen = screenInfo.screens[scr_index]; - /* The driver should set this, but make sure it is set anyway */ - xf86Screens[i]->vtSema = TRUE; - } else { - /* This shouldn't normally happen */ - FatalError("AddScreen/ScreenInit failed for driver %d\n", i); - } - -#ifdef DEBUG - ErrorF("InitOutput - xf86Screens[%d]->pScreen = %p\n", - i, xf86Screens[i]->pScreen ); - ErrorF("xf86Screens[%d]->pScreen->CreateWindow = %p\n", - i, xf86Screens[i]->pScreen->CreateWindow ); -#endif - - screenInfo.screens[scr_index]->devPrivates[xf86CreateRootWindowIndex].ptr - = (void*)(xf86Screens[i]->pScreen->CreateWindow); - xf86Screens[i]->pScreen->CreateWindow = xf86CreateRootWindow; - -#ifdef RENDER - if (PictureGetSubpixelOrder (xf86Screens[i]->pScreen) == SubPixelUnknown) - { - xf86MonPtr DDC = (xf86MonPtr)(xf86Screens[i]->monitor->DDC); - PictureSetSubpixelOrder (xf86Screens[i]->pScreen, - DDC ? - (DDC->features.input_type ? - SubPixelHorizontalRGB : SubPixelNone) : - SubPixelUnknown); - } -#endif -#ifdef RANDR - if (!xf86Info.disableRandR) - xf86RandRInit (screenInfo.screens[scr_index]); - xf86Msg(xf86Info.randRFrom, "RandR %s\n", - xf86Info.disableRandR ? "disabled" : "enabled"); -#endif -#ifdef NOT_USED - /* - * Here we have to let the driver getting access of the VT. Note that - * this doesn't mean that the graphics board may access automatically - * the monitor. If the monitor is shared this is done in xf86CrossScreen! - */ - if (!xf86Info.sharedMonitor) (xf86Screens[i]->EnterLeaveMonitor)(ENTER); -#endif - } - -#ifdef XFree86LOADER - if ((serverGeneration == 1) && LoaderCheckUnresolved(LD_RESOLV_IFDONE)) { - /* For now, just a warning */ - xf86Msg(X_WARNING, "Some symbols could not be resolved!\n"); - } -#endif - - xf86PostScreenInit(); - - xf86InitOrigins(); - - xf86Resetting = FALSE; - xf86Initialising = FALSE; - - RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, xf86Wakeup, - NULL); -} - - -static InputDriverPtr -MatchInput(IDevPtr pDev) -{ - int i; - - for (i = 0; i < xf86NumInputDrivers; i++) { - if (xf86InputDriverList[i] && xf86InputDriverList[i]->driverName && - xf86NameCmp(pDev->driver, xf86InputDriverList[i]->driverName) == 0) - return xf86InputDriverList[i]; - } - return NULL; -} - - -/* - * InitInput -- - * Initialize all supported input devices. - */ - -void -InitInput(argc, argv) - int argc; - char **argv; -{ - IDevPtr pDev; - InputDriverPtr pDrv; - InputInfoPtr pInfo; - static InputInfoPtr coreKeyboard = NULL, corePointer = NULL; - - xf86Info.vtRequestsPending = FALSE; - xf86Info.inputPending = FALSE; -#ifdef XTESTEXT1 - xtest_command_key = KEY_Begin + MIN_KEYCODE; -#endif /* XTESTEXT1 */ - - if (serverGeneration == 1) { - /* Call the PreInit function for each input device instance. */ - for (pDev = xf86ConfigLayout.inputs; pDev && pDev->identifier; pDev++) { -#ifdef USE_DEPRECATED_KEYBOARD_DRIVER - /* XXX The keyboard driver is a special case for now. */ - if (!xf86NameCmp(pDev->driver, "keyboard")) { - xf86MsgVerb(X_WARNING, 0, "*** WARNING the legacy keyboard driver \"keyboard\" is deprecated\n"); - xf86MsgVerb(X_WARNING, 0, "*** and will be removed in the next release of the Xorg server.\n"); - xf86MsgVerb(X_WARNING, 0, "*** Please consider using the the new \"kbd\" driver for \"%s\".\n", - pDev->identifier); - - continue; - } -#endif - - if ((pDrv = MatchInput(pDev)) == NULL) { - xf86Msg(X_ERROR, "No Input driver matching `%s'\n", pDev->driver); - /* XXX For now, just continue. */ - continue; - } - if (!pDrv->PreInit) { - xf86MsgVerb(X_WARNING, 0, - "Input driver `%s' has no PreInit function (ignoring)\n", - pDrv->driverName); - continue; - } - pInfo = pDrv->PreInit(pDrv, pDev, 0); - if (!pInfo) { - xf86Msg(X_ERROR, "PreInit returned NULL for \"%s\"\n", - pDev->identifier); - continue; - } else if (!(pInfo->flags & XI86_CONFIGURED)) { - xf86Msg(X_ERROR, "PreInit failed for input device \"%s\"\n", - pDev->identifier); - xf86DeleteInput(pInfo, 0); - continue; - } - if (pInfo->flags & XI86_CORE_KEYBOARD) { - if (coreKeyboard) { - xf86Msg(X_ERROR, - "Attempt to register more than one core keyboard (%s)\n", - pInfo->name); - pInfo->flags &= ~XI86_CORE_KEYBOARD; - } else { - if (!(pInfo->flags & XI86_KEYBOARD_CAPABLE)) { - /* XXX just a warning for now */ - xf86Msg(X_WARNING, - "%s: does not have core keyboard capabilities\n", - pInfo->name); - } - coreKeyboard = pInfo; - } - } - if (pInfo->flags & XI86_CORE_POINTER) { - if (corePointer) { - xf86Msg(X_ERROR, - "Attempt to register more than one core pointer (%s)\n", - pInfo->name); - pInfo->flags &= ~XI86_CORE_POINTER; - } else { - if (!(pInfo->flags & XI86_POINTER_CAPABLE)) { - /* XXX just a warning for now */ - xf86Msg(X_WARNING, - "%s: does not have core pointer capabilities\n", - pInfo->name); - } - corePointer = pInfo; - } - } - } - if (!corePointer) { - xf86Msg(X_WARNING, "No core pointer registered\n"); - /* XXX register a dummy core pointer */ - } -#ifdef NEW_KBD - if (!coreKeyboard) { - xf86Msg(X_WARNING, "No core keyboard registered\n"); - /* XXX register a dummy core keyboard */ - } -#endif - } - - /* Initialise all input devices. */ - pInfo = xf86InputDevs; - while (pInfo) { - xf86ActivateDevice(pInfo); - pInfo = pInfo->next; - } - - if (coreKeyboard) { - xf86Info.pKeyboard = coreKeyboard->dev; - xf86Info.kbdEvents = NULL; /* to prevent the internal keybord driver usage*/ - } - else { -#ifdef USE_DEPRECATED_KEYBOARD_DRIVER - /* Only set this if we're allowing the old driver. */ - if (xf86Info.kbdProc != NULL) - xf86Info.pKeyboard = AddInputDevice(xf86Info.kbdProc, TRUE); -#endif - } - if (corePointer) - xf86Info.pMouse = corePointer->dev; - if (xf86Info.pKeyboard) - RegisterKeyboardDevice(xf86Info.pKeyboard); - - miRegisterPointerDevice(screenInfo.screens[0], xf86Info.pMouse); -#ifdef XINPUT - xf86eqInit ((DevicePtr)xf86Info.pKeyboard, (DevicePtr)xf86Info.pMouse); -#else - mieqInit ((DevicePtr)xf86Info.pKeyboard, (DevicePtr)xf86Info.pMouse); -#endif -} - -#ifndef SET_STDERR_NONBLOCKING -#define SET_STDERR_NONBLOCKING 1 -#endif - -/* - * OsVendorInit -- - * OS/Vendor-specific initialisations. Called from OsInit(), which - * is called by dix before establishing the well known sockets. - */ - -void -OsVendorInit() -{ - static Bool beenHere = FALSE; - - /* xf86WrapperInit() is called directly from OsInit() */ -#ifdef SIGCHLD - signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */ -#endif - OsDelayInitColors = TRUE; -#ifdef XFree86LOADER - loadableFonts = TRUE; -#endif - - if (!beenHere) - xf86LogInit(); - -#if SET_STDERR_NONBLOCKING - /* Set stderr to non-blocking. */ -#ifndef O_NONBLOCK -#if defined(FNDELAY) -#define O_NONBLOCK FNDELAY -#elif defined(O_NDELAY) -#define O_NONBLOCK O_NDELAY -#endif -#endif - -#ifdef O_NONBLOCK - if (!beenHere) { -#if !defined(__EMX__) - if (geteuid() == 0 && getuid() != geteuid()) -#endif - { - int status; - - status = fcntl(fileno(stderr), F_GETFL, 0); - if (status != -1) { - fcntl(fileno(stderr), F_SETFL, status | O_NONBLOCK); - } - } - } -#endif -#endif - - beenHere = TRUE; -} - -/* - * ddxGiveUp -- - * Device dependent cleanup. Called by by dix before normal server death. - * For SYSV386 we must switch the terminal back to normal mode. No error- - * checking here, since there should be restored as much as possible. - */ - -void -ddxGiveUp() -{ - int i; - -#ifdef XF86PM - if (xf86OSPMClose) - xf86OSPMClose(); - xf86OSPMClose = NULL; -#endif - - xf86AccessLeaveState(); - - for (i = 0; i < xf86NumScreens; i++) { - /* - * zero all access functions to - * trap calls when switched away. - */ - xf86Screens[i]->vtSema = FALSE; - xf86Screens[i]->access = NULL; - xf86Screens[i]->busAccess = NULL; - } - -#ifdef USE_XF86_SERVERLOCK - xf86UnlockServer(); -#endif -#ifdef XFreeXDGA - DGAShutdown(); -#endif - - xf86CloseConsole(); - - xf86CloseLog(); - - /* If an unexpected signal was caught, dump a core for debugging */ - if (xf86Info.caughtSignal) - abort(); -} - - - -/* - * AbortDDX -- - * DDX - specific abort routine. Called by AbortServer(). The attempt is - * made to restore all original setting of the displays. Also all devices - * are closed. - */ - -void -AbortDDX() -{ - int i; - - /* - * try to deinitialize all input devices - */ - if (xf86Info.kbdProc && xf86Info.pKeyboard) - (xf86Info.kbdProc)(xf86Info.pKeyboard, DEVICE_CLOSE); - - /* - * try to restore the original video state - */ -#ifdef HAS_USL_VTS - /* Need the sleep when starting X from within another X session */ - sleep(1); -#endif -#ifdef DPMSExtension /* Turn screens back on */ - if (DPMSPowerLevel != DPMSModeOn) - DPMSSet(DPMSModeOn); -#endif - if (xf86Screens) { - if (xf86Screens[0]->vtSema) - xf86EnterServerState(SETUP); - for (i = 0; i < xf86NumScreens; i++) - if (xf86Screens[i]->vtSema) { - /* - * if we are aborting before ScreenInit() has finished - * we might not have been wrapped yet. Therefore enable - * screen explicitely. - */ - xf86EnableAccess(xf86Screens[i]); - (xf86Screens[i]->LeaveVT)(i, 0); - } - } - - xf86AccessLeave(); - - /* - * This is needed for an abnormal server exit, since the normal exit stuff - * MUST also be performed (i.e. the vt must be left in a defined state) - */ - ddxGiveUp(); -} - -void -OsVendorFatalError() -{ -#ifdef VENDORSUPPORT - ErrorF("\nPlease refer to your Operating System Vendor support pages\n" - "at %s for support on this crash.\n",VENDORSUPPORT); -#else - ErrorF("\nPlease consult the "XVENDORNAME" support \n" - "\t at "__VENDORDWEBSUPPORT__"\n for help. \n"); -#endif - if (xf86LogFile && xf86LogFileWasOpened) - ErrorF("Please also check the log file at \"%s\" for additional " - "information.\n", xf86LogFile); - ErrorF("\n"); -} - -int -xf86SetVerbosity(int verb) -{ - int save = xf86Verbose; - - xf86Verbose = verb; - LogSetParameter(XLOG_VERBOSITY, verb); - return save; -} - -int -xf86SetLogVerbosity(int verb) -{ - int save = xf86LogVerbose; - - xf86LogVerbose = verb; - LogSetParameter(XLOG_FILE_VERBOSITY, verb); - return save; -} - -/* - * ddxProcessArgument -- - * Process device-dependent command line args. Returns 0 if argument is - * not device dependent, otherwise Count of number of elements of argv - * that are part of a device dependent commandline option. - * - */ - - - -/* ARGSUSED */ -int -ddxProcessArgument(int argc, char **argv, int i) -{ - /* - * Note: can't use xalloc/xfree here because OsInit() hasn't been called - * yet. Use malloc/free instead. - */ - -#define CHECK_FOR_REQUIRED_ARGUMENT() \ - if (((i + 1) >= argc) || (!argv[i + 1])) { \ - ErrorF("Required argument to %s not specified\n", argv[i]); \ - UseMsg(); \ - FatalError("Required argument to %s not specified\n", argv[i]); \ - } - - /* First the options that are only allowed for root */ - if (getuid() == 0 || geteuid() != 0) - { - if (!strcmp(argv[i], "-modulepath")) - { - char *mp; - CHECK_FOR_REQUIRED_ARGUMENT(); - mp = malloc(strlen(argv[i + 1]) + 1); - if (!mp) - FatalError("Can't allocate memory for ModulePath\n"); - strcpy(mp, argv[i + 1]); - xf86ModulePath = mp; - xf86ModPathFrom = X_CMDLINE; - return 2; - } - else if (!strcmp(argv[i], "-logfile")) - { - char *lf; - CHECK_FOR_REQUIRED_ARGUMENT(); - lf = malloc(strlen(argv[i + 1]) + 1); - if (!lf) - FatalError("Can't allocate memory for LogFile\n"); - strcpy(lf, argv[i + 1]); - xf86LogFile = lf; - xf86LogFileFrom = X_CMDLINE; - return 2; - } - } else if (!strcmp(argv[i], "-modulepath") || !strcmp(argv[i], "-logfile")) { - FatalError("The '%s' option can only be used by root.\n", argv[i]); - } - if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config")) - { - CHECK_FOR_REQUIRED_ARGUMENT(); - if (getuid() != 0 && !xf86PathIsSafe(argv[i + 1])) { - FatalError("\nInvalid argument for %s\n" - "\tFor non-root users, the file specified with %s must be\n" - "\ta relative path and must not contain any \"..\" elements.\n" - "\tUsing default "__XCONFIGFILE__" search path.\n\n", - argv[i], argv[i]); - } - xf86ConfigFile = argv[i + 1]; - return 2; - } - if (!strcmp(argv[i],"-showunresolved")) - { - xf86ShowUnresolved = TRUE; - return 1; - } - if (!strcmp(argv[i],"-probeonly")) - { - xf86ProbeOnly = TRUE; - return 1; - } - if (!strcmp(argv[i],"-flipPixels")) - { - xf86FlipPixels = TRUE; - return 1; - } -#ifdef XF86VIDMODE - if (!strcmp(argv[i],"-disableVidMode")) - { - xf86VidModeDisabled = TRUE; - return 1; - } - if (!strcmp(argv[i],"-allowNonLocalXvidtune")) - { - xf86VidModeAllowNonLocal = TRUE; - return 1; - } -#endif -#ifdef XF86MISC - if (!strcmp(argv[i],"-disableModInDev")) - { - xf86MiscModInDevDisabled = TRUE; - return 1; - } - if (!strcmp(argv[i],"-allowNonLocalModInDev")) - { - xf86MiscModInDevAllowNonLocal = TRUE; - return 1; - } -#endif - if (!strcmp(argv[i],"-allowMouseOpenFail")) - { - xf86AllowMouseOpenFail = TRUE; - return 1; - } - if (!strcmp(argv[i],"-bestRefresh")) - { - xf86BestRefresh = TRUE; - return 1; - } - if (!strcmp(argv[i],"-ignoreABI")) - { -#ifdef XFree86LOADER - LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL); -#endif - return 1; - } - if (!strcmp(argv[i],"-verbose")) - { - if (++i < argc && argv[i]) - { - char *end; - long val; - val = strtol(argv[i], &end, 0); - if (*end == '\0') - { - xf86SetVerbosity(val); - return 2; - } - } - xf86SetVerbosity(++xf86Verbose); - return 1; - } - if (!strcmp(argv[i],"-logverbose")) - { - if (++i < argc && argv[i]) - { - char *end; - long val; - val = strtol(argv[i], &end, 0); - if (*end == '\0') - { - xf86SetLogVerbosity(val); - return 2; - } - } - xf86SetLogVerbosity(++xf86LogVerbose); - return 1; - } - if (!strcmp(argv[i],"-quiet")) - { - xf86SetVerbosity(0); - return 1; - } - if (!strcmp(argv[i],"-showconfig") || !strcmp(argv[i],"-version")) - { - xf86PrintBanner(); - exit(0); - } - /* Notice the -fp flag, but allow it to pass to the dix layer */ - if (!strcmp(argv[i], "-fp")) - { - xf86fpFlag = TRUE; - return 0; - } - /* Notice the -co flag, but allow it to pass to the dix layer */ - if (!strcmp(argv[i], "-co")) - { - xf86coFlag = TRUE; - return 0; - } - /* Notice the -bs flag, but allow it to pass to the dix layer */ - if (!strcmp(argv[i], "-bs")) - { - xf86bsDisableFlag = TRUE; - return 0; - } - /* Notice the +bs flag, but allow it to pass to the dix layer */ - if (!strcmp(argv[i], "+bs")) - { - xf86bsEnableFlag = TRUE; - return 0; - } - /* Notice the -s flag, but allow it to pass to the dix layer */ - if (!strcmp(argv[i], "-s")) - { - xf86sFlag = TRUE; - return 0; - } - if (!strcmp(argv[i], "-bpp")) - { - ErrorF("The -bpp option is no longer supported.\n" - "\tUse -depth to set the color depth, and use -fbbpp if you really\n" - "\tneed to force a non-default framebuffer (hardware) pixel format.\n"); - if (++i >= argc) - return 1; - return 2; - } - if (!strcmp(argv[i], "-pixmap24")) - { - xf86Pix24 = Pix24Use24; - return 1; - } - if (!strcmp(argv[i], "-pixmap32")) - { - xf86Pix24 = Pix24Use32; - return 1; - } - if (!strcmp(argv[i], "-fbbpp")) - { - int bpp; - CHECK_FOR_REQUIRED_ARGUMENT(); - if (sscanf(argv[++i], "%d", &bpp) == 1) - { - xf86FbBpp = bpp; - return 2; - } - else - { - ErrorF("Invalid fbbpp\n"); - return 0; - } - } - if (!strcmp(argv[i], "-depth")) - { - int depth; - CHECK_FOR_REQUIRED_ARGUMENT(); - if (sscanf(argv[++i], "%d", &depth) == 1) - { - xf86Depth = depth; - return 2; - } - else - { - ErrorF("Invalid depth\n"); - return 0; - } - } - if (!strcmp(argv[i], "-weight")) - { - int red, green, blue; - CHECK_FOR_REQUIRED_ARGUMENT(); - if (sscanf(argv[++i], "%1d%1d%1d", &red, &green, &blue) == 3) - { - xf86Weight.red = red; - xf86Weight.green = green; - xf86Weight.blue = blue; - return 2; - } - else - { - ErrorF("Invalid weighting\n"); - return 0; - } - } - if (!strcmp(argv[i], "-gamma") || !strcmp(argv[i], "-rgamma") || - !strcmp(argv[i], "-ggamma") || !strcmp(argv[i], "-bgamma")) - { - double gamma; - CHECK_FOR_REQUIRED_ARGUMENT(); - if (sscanf(argv[++i], "%lf", &gamma) == 1) { - if (gamma < GAMMA_MIN || gamma > GAMMA_MAX) { - ErrorF("gamma out of range, only %.2f <= gamma_value <= %.1f" - " is valid\n", GAMMA_MIN, GAMMA_MAX); - return 0; - } - if (!strcmp(argv[i-1], "-gamma")) - xf86Gamma.red = xf86Gamma.green = xf86Gamma.blue = gamma; - else if (!strcmp(argv[i-1], "-rgamma")) xf86Gamma.red = gamma; - else if (!strcmp(argv[i-1], "-ggamma")) xf86Gamma.green = gamma; - else if (!strcmp(argv[i-1], "-bgamma")) xf86Gamma.blue = gamma; - return 2; - } - } - if (!strcmp(argv[i], "-layout")) - { - CHECK_FOR_REQUIRED_ARGUMENT(); - xf86LayoutName = argv[++i]; - return 2; - } - if (!strcmp(argv[i], "-screen")) - { - CHECK_FOR_REQUIRED_ARGUMENT(); - xf86ScreenName = argv[++i]; - return 2; - } - if (!strcmp(argv[i], "-pointer")) - { - CHECK_FOR_REQUIRED_ARGUMENT(); - xf86PointerName = argv[++i]; - return 2; - } - if (!strcmp(argv[i], "-keyboard")) - { - CHECK_FOR_REQUIRED_ARGUMENT(); - xf86KeyboardName = argv[++i]; - return 2; - } - if (!strcmp(argv[i], "-nosilk")) - { - xf86silkenMouseDisableFlag = TRUE; - return 1; - } - if (!strcmp(argv[i], "-noacpi")) - { - xf86acpiDisableFlag = TRUE; - return 1; - } - if (!strcmp(argv[i], "-scanpci")) - { - DoScanPci(argc, argv, i); - } - if (!strcmp(argv[i], "-probe")) - { - xf86DoProbe = TRUE; -#if 0 - DoProbe(argc, argv, i); -#endif - return 1; - } - if (!strcmp(argv[i], "-configure")) - { - if (getuid() != 0 && geteuid() == 0) { - ErrorF("The '-configure' option can only be used by root.\n"); - exit(1); - } - xf86DoConfigure = TRUE; - xf86AllowMouseOpenFail = TRUE; - return 1; - } - if (!strcmp(argv[i], "-isolateDevice")) - { - int bus, device, func; - CHECK_FOR_REQUIRED_ARGUMENT(); - if (strncmp(argv[++i], "PCI:", 4)) { - FatalError("Bus types other than PCI not yet isolable\n"); - } - if (sscanf(argv[i], "PCI:%d:%d:%d", &bus, &device, &func) == 3) { - xf86IsolateDevice.bus = bus; - xf86IsolateDevice.device = device; - xf86IsolateDevice.func = func; - return 2; - } else { - FatalError("Invalid isolated device specification\n"); - } - } - /* OS-specific processing */ - return xf86ProcessArgument(argc, argv, i); -} - -/* ddxInitGlobals - called by |InitGlobals| from os/util.c */ -void ddxInitGlobals(void) -{ -} - -/* - * ddxUseMsg -- - * Print out correct use of device dependent commandline options. - * Maybe the user now knows what really to do ... - */ - -void -ddxUseMsg() -{ - ErrorF("\n"); - ErrorF("\n"); - ErrorF("Device Dependent Usage\n"); - if (getuid() == 0 || geteuid() != 0) - { - ErrorF("-modulepath paths specify the module search path\n"); - ErrorF("-logfile file specify a log file name\n"); - ErrorF("-configure probe for devices and write an "__XCONFIGFILE__"\n"); - } - ErrorF("-config file specify a configuration file, relative to the\n"); - ErrorF(" "__XCONFIGFILE__" search path, only root can use absolute\n"); - ErrorF("-probeonly probe for devices, then exit\n"); - ErrorF("-scanpci execute the scanpci module and exit\n"); - ErrorF("-verbose [n] verbose startup messages\n"); - ErrorF("-logverbose [n] verbose log messages\n"); - ErrorF("-quiet minimal startup messages\n"); - ErrorF("-pixmap24 use 24bpp pixmaps for depth 24\n"); - ErrorF("-pixmap32 use 32bpp pixmaps for depth 24\n"); - ErrorF("-fbbpp n set bpp for the framebuffer. Default: 8\n"); - ErrorF("-depth n set colour depth. Default: 8\n"); - ErrorF("-gamma f set gamma value (0.1 < f < 10.0) Default: 1.0\n"); - ErrorF("-rgamma f set gamma value for red phase\n"); - ErrorF("-ggamma f set gamma value for green phase\n"); - ErrorF("-bgamma f set gamma value for blue phase\n"); - ErrorF("-weight nnn set RGB weighting at 16 bpp. Default: 565\n"); - ErrorF("-layout name specify the ServerLayout section name\n"); - ErrorF("-screen name specify the Screen section name\n"); - ErrorF("-keyboard name specify the core keyboard InputDevice name\n"); - ErrorF("-pointer name specify the core pointer InputDevice name\n"); - ErrorF("-nosilk disable Silken Mouse\n"); - ErrorF("-flipPixels swap default black/white Pixel values\n"); -#ifdef XF86VIDMODE - ErrorF("-disableVidMode disable mode adjustments with xvidtune\n"); - ErrorF("-allowNonLocalXvidtune allow xvidtune to be run as a non-local client\n"); -#endif -#ifdef XF86MISC - ErrorF("-disableModInDev disable dynamic modification of input device settings\n"); - ErrorF("-allowNonLocalModInDev allow changes to keyboard and mouse settings\n"); - ErrorF(" from non-local clients\n"); - ErrorF("-allowMouseOpenFail start server even if the mouse can't be initialized\n"); -#endif - ErrorF("-bestRefresh choose modes with the best refresh rate\n"); - ErrorF("-ignoreABI make module ABI mismatches non-fatal\n"); - ErrorF("-isolateDevice bus_id restrict device resets to bus_id (PCI only)\n"); - ErrorF("-version show the server version\n"); - /* OS-specific usage */ - xf86UseMsg(); - ErrorF("\n"); -} - - -#ifndef OSNAME -#define OSNAME " unknown" -#endif -#ifndef OSVENDOR -#define OSVENDOR "" -#endif -#ifndef PRE_RELEASE -#define PRE_RELEASE XORG_VERSION_SNAP -#endif - -static void -xf86PrintBanner() -{ -#if PRE_RELEASE - ErrorF("\n" - "This is a pre-release version of the X server from " XVENDORNAME ".\n" - "It is not supported in any way.\n" - "Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n" - "Select the \"xorg\" product for bugs you find in this release.\n" - "Before reporting bugs in pre-release versions please check the\n" - "latest version in the X.Org Foundation CVS repository.\n" - "See http://wiki.x.org/wiki/CvsPage for CVS access instructions.\n"); -#endif - ErrorF("\nX Window System Version %d.%d.%d", - XORG_VERSION_MAJOR, - XORG_VERSION_MINOR, - XORG_VERSION_PATCH); -#if XORG_VERSION_SNAP > 0 - ErrorF(".%d", XORG_VERSION_SNAP); -#endif - -#if XORG_VERSION_SNAP >= 900 - /* When the minor number is 99, that signifies that the we are making - * a release candidate for a major version. (X.0.0) - * When the patch number is 99, that signifies that the we are making - * a release candidate for a minor version. (X.Y.0) - * When the patch number is < 99, then we are making a release - * candidate for the next point release. (X.Y.Z) - */ -#if XORG_VERSION_MINOR >= 99 - ErrorF(" (%d.0.0 RC %d)", XORG_VERSION_MAJOR+1, XORG_VERSION_SNAP - 900); -#elif XORG_VERSION_PATCH == 99 - ErrorF(" (%d.%d.0 RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR + 1, - XORG_VERSION_SNAP - 900); -#else - ErrorF(" (%d.%d.%d RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, - XORG_VERSION_PATCH + 1, XORG_VERSION_SNAP - 900); -#endif -#endif - -#ifdef XORG_CUSTOM_VERSION - ErrorF(" (%s)", XORG_CUSTOM_VERSION); -#endif -#ifndef XORG_DATE -#define XORG_DATE XF86_DATE -#endif - ErrorF("\nRelease Date: %s\n", XORG_DATE); - ErrorF("X Protocol Version %d, Revision %d, %s\n", - X_PROTOCOL, X_PROTOCOL_REVISION, XORG_RELEASE ); - ErrorF("Build Operating System:%s%s\n", OSNAME, OSVENDOR); -#ifdef HAS_UTSNAME - { - struct utsname name; - - /* Linux & BSD state that 0 is success, SysV (including Solaris, HP-UX, - and Irix) and Single Unix Spec 3 just say that non-negative is success. - All agree that failure is represented by a negative number. - */ - if (uname(&name) >= 0) { - ErrorF("Current Operating System: %s %s %s %s %s\n", - name.sysname, name.nodename, name.release, name.version, name.machine); - } - } -#endif -#if defined(BUILD_DATE) && (BUILD_DATE > 19000000) - { - struct tm t; - char buf[100]; - - bzero(&t, sizeof(t)); - bzero(buf, sizeof(buf)); - t.tm_mday = BUILD_DATE % 100; - t.tm_mon = (BUILD_DATE / 100) % 100 - 1; - t.tm_year = BUILD_DATE / 10000 - 1900; - if (strftime(buf, sizeof(buf), "%d %B %Y", &t)) - ErrorF("Build Date: %s\n", buf); - } -#endif -#if defined(CLOG_DATE) && (CLOG_DATE > 19000000) - { - struct tm t; - char buf[100]; - - bzero(&t, sizeof(t)); - bzero(buf, sizeof(buf)); - t.tm_mday = CLOG_DATE % 100; - t.tm_mon = (CLOG_DATE / 100) % 100 - 1; - t.tm_year = CLOG_DATE / 10000 - 1900; - if (strftime(buf, sizeof(buf), "%d %B %Y", &t)) - ErrorF("Changelog Date: %s\n", buf); - } -#endif -#if defined(BUILDERSTRING) - ErrorF("%s \n",BUILDERSTRING); -#endif - ErrorF("\tBefore reporting problems, check "__VENDORDWEBSUPPORT__"\n" - "\tto make sure that you have the latest version.\n"); -#ifdef XFree86LOADER - ErrorF("Module Loader present\n"); -#endif -} - -static void -xf86PrintMarkers() -{ - LogPrintMarkers(); -} - -static void -xf86RunVtInit(void) -{ - int i; - - /* - * If VTInit was set, run that program with consoleFd as stdin and stdout - */ - - if (xf86Info.vtinit) { - switch(fork()) { - case -1: - FatalError("xf86RunVtInit: fork failed (%s)\n", strerror(errno)); - break; - case 0: /* child */ - if (setuid(getuid()) == -1) { - xf86Msg(X_ERROR, "xf86RunVtInit: setuid failed (%s)\n", - strerror(errno)); - exit(255); - } - /* set stdin, stdout to the consoleFd */ - for (i = 0; i < 2; i++) { - if (xf86Info.consoleFd != i) { - close(i); - dup(xf86Info.consoleFd); - } - } - execl("/bin/sh", "sh", "-c", xf86Info.vtinit, (void *)NULL); - xf86Msg(X_WARNING, "exec of /bin/sh failed for VTInit (%s)\n", - strerror(errno)); - exit(255); - break; - default: /* parent */ - wait(NULL); - } - } -} - -#ifdef XFree86LOADER -/* - * xf86LoadModules iterates over a list that is being passed in. - */ -Bool -xf86LoadModules(char **list, pointer *optlist) -{ - int errmaj, errmin; - pointer opt; - int i; - char *name; - Bool failed = FALSE; - - if (!list) - return TRUE; - - for (i = 0; list[i] != NULL; i++) { - -#ifndef NORMALISE_MODULE_NAME - name = xstrdup(list[i]); -#else - /* Normalise the module name */ - name = xf86NormalizeName(list[i]); -#endif - - /* Skip empty names */ - if (name == NULL || *name == '\0') - continue; - - if (optlist) - opt = optlist[i]; - else - opt = NULL; - - if (!LoadModule(name, NULL, NULL, NULL, opt, NULL, &errmaj, &errmin)) { - LoaderErrorMsg(NULL, name, errmaj, errmin); - failed = TRUE; - } - xfree(name); - } - return !failed; -} - -#endif - -/* Pixmap format stuff */ - -PixmapFormatPtr -xf86GetPixFormat(ScrnInfoPtr pScrn, int depth) -{ - int i; - static PixmapFormatRec format; /* XXX not reentrant */ - - /* - * When the formats[] list initialisation isn't complete, check the - * depth 24 pixmap config/cmdline options and screen-specified formats. - */ - - if (!formatsDone) { - if (depth == 24) { - Pix24Flags pix24 = Pix24DontCare; - - format.depth = 24; - format.scanlinePad = BITMAP_SCANLINE_PAD; - if (xf86Info.pixmap24 != Pix24DontCare) - pix24 = xf86Info.pixmap24; - else if (pScrn->pixmap24 != Pix24DontCare) - pix24 = pScrn->pixmap24; - if (pix24 == Pix24Use24) - format.bitsPerPixel = 24; - else - format.bitsPerPixel = 32; - return &format; - } - } - - for (i = 0; i < numFormats; i++) - if (formats[i].depth == depth) - break; - if (i != numFormats) - return &formats[i]; - else if (!formatsDone) { - /* Check for screen-specified formats */ - for (i = 0; i < pScrn->numFormats; i++) - if (pScrn->formats[i].depth == depth) - break; - if (i != pScrn->numFormats) - return &pScrn->formats[i]; - } - return NULL; -} - -int -xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth) -{ - PixmapFormatPtr format; - - - format = xf86GetPixFormat(pScrn, depth); - if (format) - return format->bitsPerPixel; - else - return 0; -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Io.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Io.c deleted file mode 100644 index ef0fddf99..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Io.c +++ /dev/null @@ -1,507 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Io.c,v 3.56 2003/11/03 05:11:02 tsi Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* - * Copyright (c) 1992-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* $XConsortium: xf86Io.c /main/27 1996/10/19 17:58:55 kaleb $ */ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/xf86Io.c,v 1.5 2005/07/03 07:01:24 daniels Exp $ */ - -#define NEED_EVENTS -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "inputstr.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#define XF86_OS_PRIVS -#include "xf86_OSlib.h" -#include "mipointer.h" - -#ifdef XINPUT -#include "xf86Xinput.h" -#include -#include "exevents.h" -#endif - -#ifdef XKB -#include -#include -#include -#endif - -unsigned int xf86InitialCaps = 0; -unsigned int xf86InitialNum = 0; -unsigned int xf86InitialScroll = 0; - -#include "atKeynames.h" - -/* - * xf86KbdBell -- - * Ring the terminal/keyboard bell for an amount of time proportional to - * "loudness". - */ - -void -xf86KbdBell(percent, pKeyboard, ctrl, unused) - int percent; /* Percentage of full volume */ - DeviceIntPtr pKeyboard; /* Keyboard to ring */ - pointer ctrl; - int unused; -{ - xf86SoundKbdBell(percent, xf86Info.bell_pitch, xf86Info.bell_duration); -} - -void -xf86UpdateKbdLeds() -{ - int leds = 0; - if (xf86Info.capsLock) leds |= XLED1; - if (xf86Info.numLock) leds |= XLED2; - if (xf86Info.scrollLock || xf86Info.modeSwitchLock) leds |= XLED3; - if (xf86Info.composeLock) leds |= XLED4; - xf86Info.leds = (xf86Info.leds & xf86Info.xleds) | (leds & ~xf86Info.xleds); - xf86KbdLeds(); -} - -void -xf86KbdLeds () -{ - int leds, real_leds = 0; - -#if defined (__sparc__) && defined(__linux__) - static int kbdSun = -1; - if (kbdSun == -1) { - if ((xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun")) || - (xf86Info.xkbrules && !strcmp(xf86Info.xkbrules, "sun"))) - kbdSun = 1; - else - kbdSun = 0; - } - if (kbdSun) { - if (xf86Info.leds & 0x08) real_leds |= XLED1; - if (xf86Info.leds & 0x04) real_leds |= XLED3; - if (xf86Info.leds & 0x02) real_leds |= XLED4; - if (xf86Info.leds & 0x01) real_leds |= XLED2; - leds = real_leds; - real_leds = 0; - } else { - leds = xf86Info.leds; - } -#else - leds = xf86Info.leds; -#endif /* defined (__sparc__) */ - -#ifdef LED_CAP - if (leds & XLED1) real_leds |= LED_CAP; - if (leds & XLED2) real_leds |= LED_NUM; - if (leds & XLED3) real_leds |= LED_SCR; -#ifdef LED_COMP - if (leds & XLED4) real_leds |= LED_COMP; -#else - if (leds & XLED4) real_leds |= LED_SCR; -#endif -#endif -#ifdef sun - /* Pass through any additional LEDs, such as Kana LED on Sun Japanese kbd */ - real_leds |= (leds & 0xFFFFFFF0); -#endif - xf86SetKbdLeds(real_leds); - (void)leds; -} - -/* - * xf86KbdCtrl -- - * Alter some of the keyboard control parameters. All special protocol - * values are handled by dix (ProgChangeKeyboardControl) - */ - -void -xf86KbdCtrl (pKeyboard, ctrl) - DevicePtr pKeyboard; /* Keyboard to alter */ - KeybdCtrl *ctrl; -{ - int leds; - xf86Info.bell_pitch = ctrl->bell_pitch; - xf86Info.bell_duration = ctrl->bell_duration; - xf86Info.autoRepeat = ctrl->autoRepeat; - - xf86Info.composeLock = (ctrl->leds & XCOMP) ? TRUE : FALSE; - - leds = (ctrl->leds & ~(XCAPS | XNUM | XSCR)); -#ifdef XKB - if (noXkbExtension) { -#endif - xf86Info.leds = (leds & xf86Info.xleds)|(xf86Info.leds & ~xf86Info.xleds); -#ifdef XKB - } else { - xf86Info.leds = leds; - } -#endif - - xf86KbdLeds(); -} - -/* - * xf86InitKBD -- - * Reinitialize the keyboard. Only set Lockkeys according to ours leds. - * Depress all other keys. - */ - -void -xf86InitKBD(init) -Bool init; -{ - char leds = 0, rad; - unsigned int i; - xEvent kevent; - DeviceIntPtr pKeyboard = xf86Info.pKeyboard; - KeyClassRec *keyc = xf86Info.pKeyboard->key; - KeySym *map = keyc->curKeySyms.map; - - kevent.u.keyButtonPointer.time = GetTimeInMillis(); - kevent.u.keyButtonPointer.rootX = 0; - kevent.u.keyButtonPointer.rootY = 0; - - /* - * Hmm... here is the biggest hack of every time ! - * It may be possible that a switch-vt procedure has finished BEFORE - * you released all keys neccessary to do this. That peculiar behavior - * can fool the X-server pretty much, cause it assumes that some keys - * were not released. TWM may stuck alsmost completly.... - * OK, what we are doing here is after returning from the vt-switch - * exeplicitely unrelease all keyboard keys before the input-devices - * are reenabled. - */ - for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map; - i < keyc->curKeySyms.maxKeyCode; - i++, map += keyc->curKeySyms.mapWidth) - if (KeyPressed(i)) - { - switch (*map) { - /* Don't release the lock keys */ - case XK_Caps_Lock: - case XK_Shift_Lock: - case XK_Num_Lock: - case XK_Scroll_Lock: - case XK_Kana_Lock: - break; - default: - kevent.u.u.detail = i; - kevent.u.u.type = KeyRelease; - (* pKeyboard->public.processInputProc)(&kevent, pKeyboard, 1); - } - } - - xf86Info.scanPrefix = 0; - - if (init) - { - /* - * we must deal here with the fact, that on some cases the numlock or - * capslock key are enabled BEFORE the server is started up. So look - * here at the state on the according LEDS to determine whether a - * lock-key is already set. - */ - - xf86Info.capsLock = FALSE; - xf86Info.numLock = FALSE; - xf86Info.scrollLock = FALSE; - xf86Info.modeSwitchLock = FALSE; - xf86Info.composeLock = FALSE; - -#ifdef LED_CAP -#ifdef INHERIT_LOCK_STATE - leds = xf86Info.leds; - - for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map; - i < keyc->curKeySyms.maxKeyCode; - i++, map += keyc->curKeySyms.mapWidth) - - switch(*map) { - - case XK_Caps_Lock: - case XK_Shift_Lock: - if (leds & LED_CAP) - { - xf86InitialCaps = i; - xf86Info.capsLock = TRUE; - } - break; - - case XK_Num_Lock: - if (leds & LED_NUM) - { - xf86InitialNum = i; - xf86Info.numLock = TRUE; - } - break; - - case XK_Scroll_Lock: - case XK_Kana_Lock: - if (leds & LED_SCR) - { - xf86InitialScroll = i; - xf86Info.scrollLock = TRUE; - } - break; - } -#endif /* INHERIT_LOCK_STATE */ - xf86SetKbdLeds(leds); -#endif /* LED_CAP */ - (void)leds; - - if (xf86Info.kbdDelay <= 375) rad = 0x00; - else if (xf86Info.kbdDelay <= 625) rad = 0x20; - else if (xf86Info.kbdDelay <= 875) rad = 0x40; - else rad = 0x60; - - if (xf86Info.kbdRate <= 2) rad |= 0x1F; - else if (xf86Info.kbdRate >= 30) rad |= 0x00; - else rad |= ((58 / xf86Info.kbdRate) - 2); - - xf86SetKbdRepeat(rad); - } -} - -/* - * xf86KbdProc -- - * Handle the initialization, etc. of a keyboard. - */ - -int -xf86KbdProc (pKeyboard, what) - DeviceIntPtr pKeyboard; /* Keyboard to manipulate */ - int what; /* What to do to it */ -{ - KeySymsRec keySyms; - CARD8 modMap[MAP_LENGTH]; - int kbdFd; - - switch (what) { - - case DEVICE_INIT: - /* - * First open and find the current state of the keyboard. - */ - - xf86KbdInit(); - - xf86KbdGetMapping(&keySyms, modMap); - - -#ifndef XKB - defaultKeyboardControl.leds = xf86GetKbdLeds(); -#else - defaultKeyboardControl.leds = 0; -#endif - - /* - * Perform final initialization of the system private keyboard - * structure and fill in various slots in the device record - * itself which couldn't be filled in before. - */ - - pKeyboard->public.on = FALSE; - -#ifdef XKB - if (noXkbExtension) { -#endif - InitKeyboardDeviceStruct((DevicePtr)xf86Info.pKeyboard, - &keySyms, - modMap, - xf86KbdBell, - (KbdCtrlProcPtr)xf86KbdCtrl); -#ifdef XKB - } else { - XkbComponentNamesRec names; - XkbDescPtr desc; - Bool foundTerminate = FALSE; - int keyc; - if (XkbInitialMap) { - if ((xf86Info.xkbkeymap = strchr(XkbInitialMap, '/')) != NULL) - xf86Info.xkbkeymap++; - else - xf86Info.xkbkeymap = XkbInitialMap; - } - if (xf86Info.xkbkeymap) { - names.keymap = xf86Info.xkbkeymap; - names.keycodes = NULL; - names.types = NULL; - names.compat = NULL; - names.symbols = NULL; - names.geometry = NULL; - } else { - names.keymap = NULL; - names.keycodes = xf86Info.xkbkeycodes; - names.types = xf86Info.xkbtypes; - names.compat = xf86Info.xkbcompat; - names.symbols = xf86Info.xkbsymbols; - names.geometry = xf86Info.xkbgeometry; - } - if ((xf86Info.xkbkeymap || xf86Info.xkbcomponents_specified) - && (xf86Info.xkbmodel == NULL || xf86Info.xkblayout == NULL)) { - xf86Info.xkbrules = NULL; - } - XkbSetRulesDflts(xf86Info.xkbrules, xf86Info.xkbmodel, - xf86Info.xkblayout, xf86Info.xkbvariant, - xf86Info.xkboptions); - - XkbInitKeyboardDeviceStruct(pKeyboard, - &names, - &keySyms, - modMap, - xf86KbdBell, - (KbdCtrlProcPtr)xf86KbdCtrl); - - /* Search keymap for Terminate action */ - desc = pKeyboard->key->xkbInfo->desc; - for (keyc = desc->min_key_code; keyc <= desc->max_key_code; keyc++) { - int i; - for (i = 1; i <= XkbKeyNumActions(desc, keyc); i++) { - if (XkbKeyAction(desc, keyc, i) - && XkbKeyAction(desc, keyc, i)->type == XkbSA_Terminate) { - foundTerminate = TRUE; - goto searchdone; - } - } - } -searchdone: - xf86Info.ActionKeyBindingsSet = foundTerminate; - if (!foundTerminate) - xf86Msg(X_INFO, "Server_Terminate keybinding not found\n"); - } -#endif - - xf86InitKBD(TRUE); - break; - - case DEVICE_ON: - /* - * Set the keyboard into "direct" mode and turn on - * event translation. - */ - - kbdFd = xf86KbdOn(); - /* - * Discard any pending input after a VT switch to prevent the server - * passing on parts of the VT switch sequence. - */ - sleep(1); -#if defined(WSCONS_SUPPORT) - if (xf86Info.consType != WSCONS) { -#endif - if (kbdFd != -1) { - char buf[16]; - read(kbdFd, buf, 16); - } -#if defined(WSCONS_SUPPORT) - } -#endif - -#if !defined(__UNIXOS2__) /* Under EMX, keyboard cannot be select()'ed */ - if (kbdFd != -1) - AddEnabledDevice(kbdFd); -#endif /* __UNIXOS2__ */ - - pKeyboard->public.on = TRUE; - xf86InitKBD(FALSE); - break; - - case DEVICE_CLOSE: - case DEVICE_OFF: - /* - * Restore original keyboard directness and translation. - */ - - kbdFd = xf86KbdOff(); - - if (kbdFd != -1) - RemoveEnabledDevice(kbdFd); - - pKeyboard->public.on = FALSE; - break; - - } - return (Success); -} - -#if defined(DDXTIME) && !defined(QNX4) -/* - * These are getting tossed in here until I can think of where - * they really belong - */ -#define HALFMONTH ((unsigned long) 1<<31) -CARD32 -GetTimeInMillis() -{ - struct timeval tp; - register CARD32 val; - register INT32 diff; - static CARD32 oldval = 0; - static CARD32 time = 0; - - gettimeofday(&tp, 0); - val = (tp.tv_sec * 1000) + (tp.tv_usec / 1000); - if (oldval) { - diff = val - oldval; - if (diff > 0) - time += diff; - } - oldval = val; - - return time; -} -#endif /* DDXTIME && !QNX4 */ - diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Kbd.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Kbd.c deleted file mode 100644 index 85f9e3406..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Kbd.c +++ /dev/null @@ -1,395 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c,v 3.26 2003/08/24 17:36:53 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* - * Copyright (c) 1992-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* $XConsortium: xf86Kbd.c /main/10 1996/02/21 17:38:32 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifdef __UNIXOS2__ -#define I_NEED_OS2_H -#endif - -#include -#include -#include "input.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "atKeynames.h" -#include "xf86Config.h" - -#include "xf86Keymap.h" - -#if defined(KDGKBTYPE) && \ - !defined(Lynx) && \ - !defined(__UNIXOS2__) && !defined(__mips__) && \ - !defined(__arm32__) && !defined(__GNU__) && !defined(__QNX__) -#define HAS_GETKBTYPE -#endif -#if defined(GIO_KEYMAP) && \ - !defined(Lynx) && \ - !defined(__UNIXOS2__) && !defined(__mips__) && \ - !defined(__arm32__) && !defined(__GNU__) && !defined(DGUX) && \ - !defined(__QNX__) -#define HAS_GETKEYMAP - -#define KD_GET_ENTRY(i,n) \ - eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]] - -/* - * NOTE: Not all possible remappable symbols are remapped. There are two main - * reasons: - * a) The mapping between scancode and SYSV/386 - symboltable - * is inconsistent between different versions and has some - * BIG mistakes. - * b) In X-Windows there is a difference between numpad-keys - * and normal keys. SYSV/386 uses for both kinds of keys - * the same symbol. - * - * Thus only the alpha keypad and the function keys are translated. - * Also CapsLock, NumLock, ScrollLock, Shift, Control & Alt. - */ - -static unsigned char remap[128] = { - 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */ - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */ - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */ - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */ - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */ - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */ - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */ - 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */ - 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */ - 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */ - 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */ -}; - -static KeySym eascii_to_x[512] = { - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, - NoSymbol, XK_Return, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_Escape, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_space, XK_exclam, XK_quotedbl, XK_numbersign, - XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, - XK_parenleft, XK_parenright, XK_asterisk, XK_plus, - XK_comma, XK_minus, XK_period, XK_slash, - XK_0, XK_1, XK_2, XK_3, - XK_4, XK_5, XK_6, XK_7, - XK_8, XK_9, XK_colon, XK_semicolon, - XK_less, XK_equal, XK_greater, XK_question, - XK_at, XK_A, XK_B, XK_C, - XK_D, XK_E, XK_F, XK_G, - XK_H, XK_I, XK_J, XK_K, - XK_L, XK_M, XK_N, XK_O, - XK_P, XK_Q, XK_R, XK_S, - XK_T, XK_U, XK_V, XK_W, - XK_X, XK_Y, XK_Z, XK_bracketleft, - XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, - XK_grave, XK_a, XK_b, XK_c, - XK_d, XK_e, XK_f, XK_g, - XK_h, XK_i, XK_j, XK_k, - XK_l, XK_m, XK_n, XK_o, - XK_p, XK_q, XK_r, XK_s, - XK_t, XK_u, XK_v, XK_w, - XK_x, XK_y, XK_z, XK_braceleft, - XK_bar, XK_braceright, XK_asciitilde, XK_Delete, - XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex, - XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla, - XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis, - XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring, - XK_Eacute, XK_ae, XK_AE, XK_ocircumflex, - XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave, - XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent, - XK_sterling, XK_yen, XK_paragraph, XK_section, - XK_aacute, XK_iacute, XK_oacute, XK_uacute, - XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine, - XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf, - XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi, - XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau, - XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta, - XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection, - XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal, - XK_topintegral, XK_botintegral, XK_division, XK_similarequal, - XK_degree, NoSymbol, NoSymbol, XK_radical, - XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol, - - /* - * special marked entries (256 + x) - */ - - NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R, - XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L, - NoSymbol, XK_Control_L, XK_Alt_L, XK_Alt_R, - XK_Control_L, XK_Control_R, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_F1, - XK_F2, XK_F3, XK_F4, XK_F5, - XK_F6, XK_F7, XK_F8, XK_F9, - XK_F10, XK_F11, XK_F12, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - }; - -#endif /* HAS_GETKEYMAP */ - -/* - * LegalModifier -- - * determine whether a key is a legal modifier key, i.e send a - * press/release sequence. - */ - -/*ARGSUSED*/ -Bool -LegalModifier(key, pDev) - unsigned int key; - DevicePtr pDev; -{ - return (TRUE); -} - - - -/* - * xf86KbdGetMapping -- - * Get the national keyboard mapping. The keyboard type is set, a new map - * and the modifiermap is computed. - */ - -void -xf86KbdGetMapping (pKeySyms, pModMap) - KeySymsPtr pKeySyms; - CARD8 *pModMap; -{ - KeySym *k; -#ifdef HAS_GETKEYMAP - keymap_t keymap; -#endif - int i; - KeySym *pMap; - -#ifdef HAS_GETKBTYPE - char type; - - xf86Info.kbdType = - ioctl(xf86Info.consoleFd, KDGKBTYPE, &type) != -1 ? type : KB_101; - if (xf86Info.kbdType == KB_84) - pMap = map84; - else - pMap = map; -#else -/* OS/2 sets the keyboard type during xf86OpenKbd */ -#ifndef __UNIXOS2__ - xf86Info.kbdType = 0; -#endif - pMap = map; -#endif - -#ifdef HAS_GETKEYMAP - /* - * use the keymap, which can be gotten from our oringinal vt??. - * ( ttymap(1) !!!! ) - */ - if (ioctl(xf86Info.consoleFd, GIO_KEYMAP, &keymap) != -1) { - for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++) - - if (remap[i]) { - - k = pMap + (remap[i] << 2); - - k[0] = KD_GET_ENTRY(i,0); /* non-shifed */ - k[1] = KD_GET_ENTRY(i,1); /* shifted */ - k[2] = KD_GET_ENTRY(i,4); /* alt */ - k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */ - - if (k[3] == k[2]) k[3] = NoSymbol; - if (k[2] == k[1]) k[2] = NoSymbol; - if (k[1] == k[0]) k[1] = NoSymbol; - if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol; - } - } -#endif - - /* - * compute the modifier map - */ - for (i = 0; i < MAP_LENGTH; i++) - pModMap[i] = NoSymbol; /* make sure it is restored */ - - for (k = pMap, i = MIN_KEYCODE; - i < (NUM_KEYCODES + MIN_KEYCODE); - i++, k += 4) - - switch(*k) { - - case XK_Shift_L: - case XK_Shift_R: - pModMap[i] = ShiftMask; - break; - - case XK_Control_L: - case XK_Control_R: - pModMap[i] = ControlMask; - break; - - case XK_Caps_Lock: - pModMap[i] = LockMask; - break; - - case XK_Alt_L: - case XK_Alt_R: - pModMap[i] = AltMask; - break; - - case XK_Num_Lock: - pModMap[i] = NumLockMask; - break; - - case XK_Scroll_Lock: - pModMap[i] = ScrollLockMask; - break; - - /* kana support */ - case XK_Kana_Lock: - case XK_Kana_Shift: - pModMap[i] = KanaMask; - break; - - /* alternate toggle for multinational support */ - case XK_Mode_switch: - pModMap[i] = AltLangMask; - break; - - } - - pKeySyms->map = pMap; - pKeySyms->mapWidth = GLYPHS_PER_KEY; - pKeySyms->minKeyCode = MIN_KEYCODE; - pKeySyms->maxKeyCode = MAX_KEYCODE; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c deleted file mode 100644 index c1f6156e3..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c +++ /dev/null @@ -1,1266 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c,v 3.22 2003/10/07 22:00:52 herrb Exp $ */ -/* - * Derived from xf86Kbd.c by S_ren Schmidt (sos@login.dkuug.dk) - * which is Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * and from xf86KbdCODrv.c by Holger Veit - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Copyright (c) 1994-2002 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* $XConsortium: xf86KbdBSD.c /main/6 1996/10/23 13:12:27 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "input.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "atKeynames.h" -#include "xf86Keymap.h" - -#if (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)) && defined(GIO_KEYMAP) -#define KD_GET_ENTRY(i,n) \ - eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]] - -static unsigned char remap[NUM_KEYCODES] = { - 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */ - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */ - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */ - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */ - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */ - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */ - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */ - 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */ - 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */ - 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */ - 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */ -}; - -/* This table assumes the ibm code page 437 coding for characters - * > 0x80. They are returned in this form by PCVT */ -static KeySym eascii_to_x[512] = { - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, - NoSymbol, XK_Return, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_Escape, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_space, XK_exclam, XK_quotedbl, XK_numbersign, - XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, - XK_parenleft, XK_parenright, XK_asterisk, XK_plus, - XK_comma, XK_minus, XK_period, XK_slash, - XK_0, XK_1, XK_2, XK_3, - XK_4, XK_5, XK_6, XK_7, - XK_8, XK_9, XK_colon, XK_semicolon, - XK_less, XK_equal, XK_greater, XK_question, - XK_at, XK_A, XK_B, XK_C, - XK_D, XK_E, XK_F, XK_G, - XK_H, XK_I, XK_J, XK_K, - XK_L, XK_M, XK_N, XK_O, - XK_P, XK_Q, XK_R, XK_S, - XK_T, XK_U, XK_V, XK_W, - XK_X, XK_Y, XK_Z, XK_bracketleft, - XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, - XK_grave, XK_a, XK_b, XK_c, - XK_d, XK_e, XK_f, XK_g, - XK_h, XK_i, XK_j, XK_k, - XK_l, XK_m, XK_n, XK_o, - XK_p, XK_q, XK_r, XK_s, - XK_t, XK_u, XK_v, XK_w, - XK_x, XK_y, XK_z, XK_braceleft, - XK_bar, XK_braceright, XK_asciitilde, XK_Delete, - XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex, - XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla, - XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis, - XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring, - XK_Eacute, XK_ae, XK_AE, XK_ocircumflex, - XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave, - XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent, - XK_sterling, XK_yen, XK_paragraph, XK_section, - XK_aacute, XK_iacute, XK_oacute, XK_uacute, - XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine, - XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf, - XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi, - XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau, - XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta, - XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection, - XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal, - XK_topintegral, XK_botintegral, XK_division, XK_similarequal, - XK_degree, NoSymbol, NoSymbol, XK_radical, - XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol, - - /* - * special marked entries (256 + x) - */ - -#if 1 - /* This has been checked against what syscons actually does */ - NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R, - XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L, - XK_ISO_Left_Tab,XK_Control_L, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_F1, - XK_F2, XK_F3, XK_F4, XK_F5, - XK_F6, XK_F7, XK_F8, XK_F9, - XK_F10, XK_F11, XK_F12, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_Control_R, XK_Alt_R, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol -#else - /* The old table, supposedly for pcvt. */ - NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R, - XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L, - NoSymbol, XK_Control_L, XK_Alt_L, XK_Alt_R, - XK_Control_L, XK_Control_R, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_F1, - XK_F2, XK_F3, XK_F4, XK_F5, - XK_F6, XK_F7, XK_F8, XK_F9, - XK_F10, XK_F11, XK_F12, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol -#endif - }; - -#ifdef __OpenBSD__ -/* don't mark AltR and CtrlR for remapping, since they - * cannot be remapped by pccons */ -static unsigned char pccons_remap[128] = { - 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */ - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */ - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */ - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */ - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */ - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */ - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */ - 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */ - 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */ - 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 - 0x77 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */ -}; - -/* This table assumes an iso8859_1 encoding for the characters - * > 80, as returned by pccons */ -static KeySym latin1_to_x[256] = { - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, - NoSymbol, XK_Return, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_Escape, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_space, XK_exclam, XK_quotedbl, XK_numbersign, - XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, - XK_parenleft, XK_parenright, XK_asterisk, XK_plus, - XK_comma, XK_minus, XK_period, XK_slash, - XK_0, XK_1, XK_2, XK_3, - XK_4, XK_5, XK_6, XK_7, - XK_8, XK_9, XK_colon, XK_semicolon, - XK_less, XK_equal, XK_greater, XK_question, - XK_at, XK_A, XK_B, XK_C, - XK_D, XK_E, XK_F, XK_G, - XK_H, XK_I, XK_J, XK_K, - XK_L, XK_M, XK_N, XK_O, - XK_P, XK_Q, XK_R, XK_S, - XK_T, XK_U, XK_V, XK_W, - XK_X, XK_Y, XK_Z, XK_bracketleft, - XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, - XK_grave, XK_a, XK_b, XK_c, - XK_d, XK_e, XK_f, XK_g, - XK_h, XK_i, XK_j, XK_k, - XK_l, XK_m, XK_n, XK_o, - XK_p, XK_q, XK_r, XK_s, - XK_t, XK_u, XK_v, XK_w, - XK_x, XK_y, XK_z, XK_braceleft, - XK_bar, XK_braceright, XK_asciitilde, XK_Delete, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling, - XK_currency, XK_yen, XK_brokenbar, XK_section, - XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft, - XK_notsign, XK_hyphen, XK_registered, XK_macron, - XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior, - XK_acute, XK_mu, XK_paragraph, XK_periodcentered, - XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright, - XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown, - XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde, - XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla, - XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis, - XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis, - XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute, - XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply, - XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex, - XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp, - XK_agrave, XK_aacute, XK_acircumflex, XK_atilde, - XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla, - XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis, - XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis, - XK_eth, XK_ntilde, XK_ograve, XK_oacute, - XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division, - XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex, - XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis - }; -#endif -#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ -/* - * LegalModifier -- - * determine whether a key is a legal modifier key, i.e send a - * press/release sequence. - */ - -/*ARGSUSED*/ -Bool -LegalModifier(key, pDev) - unsigned int key; - DevicePtr pDev; -{ - return (TRUE); -} - -/* - * xf86KbdGetMapping -- - * Get the national keyboard mapping. The keyboard type is set, a new map - * and the modifiermap is computed. - */ - -void -xf86KbdGetMapping (pKeySyms, pModMap) - KeySymsPtr pKeySyms; - CARD8 *pModMap; -{ - KeySym *k; - int i; - -#ifndef __bsdi__ - switch (xf86Info.consType) { - -#ifdef PCCONS_SUPPORT - case PCCONS: -#if defined(__OpenBSD__) - /* - * on OpenBSD, the pccons keymap is programmable, too - */ - { - pccons_keymap_t keymap[KB_NUM_KEYS]; - if (ioctl(xf86Info.consoleFd, CONSOLE_GET_KEYMAP, &keymap) != -1) { - for (i = 0; i < KB_NUM_KEYS; i++) - if (pccons_remap[i]) { - k = map + (pccons_remap[i] << 2); - switch (keymap[i].type) { - case KB_ASCII: - /* For ASCII keys, there is only one char in the keymap */ - k[0] = latin1_to_x[(unsigned char)keymap[i].unshift[0]]; - k[1] = latin1_to_x[(unsigned char)keymap[i].shift[0]]; - k[2] = latin1_to_x[(unsigned char)keymap[i].altgr[0]]; - k[3] = latin1_to_x[(unsigned char)keymap[i].shift_altgr[0]]; - break; - case KB_SCROLL: - k[0] = XK_Scroll_Lock; - goto special; - case KB_NUM: - k[0] = XK_Num_Lock; - goto special; - case KB_CAPS: - k[0] = XK_Caps_Lock; - goto special; - case KB_SHIFT: - switch (keymap[i].unshift[0]) { - case 1: - /* left shift */ - k[0] = XK_Shift_L; - break; - case 2: - /* right shift */ - k[0] = XK_Shift_R; - break; - default: - k[0] = NoSymbol; - } - goto special; - case KB_CTL: - k[0] = XK_Control_L; - goto special; - case KB_ALT: - k[0] = XK_Alt_L; - goto special; - case KB_FUNC: - switch (keymap[i].unshift[2]) { - case 'M': - k[0] = XK_F1; - break; - case 'N': - k[0] = XK_F2; - break; - case 'O': - k[0] = XK_F3; - break; - case 'P': - k[0] = XK_F4; - break; - case 'Q': - k[0] = XK_F5; - break; - case 'R': - k[0] = XK_F6; - break; - case 'S': - k[0] = XK_F7; - break; - case 'T': - k[0] = XK_F8; - break; - case 'U': - k[0] = XK_F9; - break; - case 'V': - k[0] = XK_F10; - break; - case 'W': - k[0] = XK_F11; - break; - case 'X': - k[0] = XK_F12; - break; - default: - k[0] = NoSymbol; - break; - } - goto special; - default: - k[0] = NoSymbol; - special: - k[1] = k[2] = k[3] = NoSymbol; - } - } - } else { - ErrorF("Can't read pccons keymap\n"); - } - } -#endif /* __OpenBSD__ */ - break; -#endif - -/* - * XXX wscons has no GIO_KEYMAP - */ -#if (defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)) && defined(GIO_KEYMAP) - case SYSCONS: - case PCVT: - { - keymap_t keymap; - - if (ioctl(xf86Info.consoleFd, GIO_KEYMAP, &keymap) != -1) { - for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++) - if (remap[i]) { - k = map + (remap[i] << 2); - k[0] = KD_GET_ENTRY(i,0); /* non-shifed */ - k[1] = KD_GET_ENTRY(i,1); /* shifted */ - k[2] = KD_GET_ENTRY(i,4); /* alt */ - k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */ - if (k[3] == k[2]) k[3] = NoSymbol; - if (k[2] == k[1]) k[2] = NoSymbol; - if (k[1] == k[0]) k[1] = NoSymbol; - if (k[0] == k[2] && k[1] == k[3]) - k[2] = k[3] = NoSymbol; - } - } - } - break; -#endif /* SYSCONS || PCVT */ - - } -#endif /* !bsdi */ - - /* - * compute the modifier map - */ - for (i = 0; i < MAP_LENGTH; i++) - pModMap[i] = NoSymbol; /* make sure it is restored */ - - for (k = map, i = MIN_KEYCODE; - i < (NUM_KEYCODES + MIN_KEYCODE); - i++, k += 4) - - switch(*k) { - - case XK_Shift_L: - case XK_Shift_R: - pModMap[i] = ShiftMask; - break; - - case XK_Control_L: - case XK_Control_R: - pModMap[i] = ControlMask; - break; - - case XK_Caps_Lock: - pModMap[i] = LockMask; - break; - - case XK_Alt_L: - case XK_Alt_R: - pModMap[i] = AltMask; - break; - - case XK_Num_Lock: - pModMap[i] = NumLockMask; - break; - - case XK_Scroll_Lock: - pModMap[i] = ScrollLockMask; - break; - - /* kana support */ - case XK_Kana_Lock: - case XK_Kana_Shift: - pModMap[i] = KanaMask; - break; - - /* alternate toggle for multinational support */ - case XK_Mode_switch: - pModMap[i] = AltLangMask; - break; - - } - - xf86Info.kbdType = 0; - - pKeySyms->map = map; - pKeySyms->mapWidth = GLYPHS_PER_KEY; - pKeySyms->minKeyCode = MIN_KEYCODE; - pKeySyms->maxKeyCode = MAX_KEYCODE; - -} - -#ifdef WSCONS_SUPPORT -#include "atKeynames.h" - -static CARD8 wsUsbMap[] = { - /* 0 */ KEY_NOTUSED, - /* 1 */ KEY_NOTUSED, - /* 2 */ KEY_NOTUSED, - /* 3 */ KEY_NOTUSED, - /* 4 */ KEY_A, - /* 5 */ KEY_B, - /* 6 */ KEY_C, - /* 7 */ KEY_D, - /* 8 */ KEY_E, - /* 9 */ KEY_F, - /* 10 */ KEY_G, - /* 11 */ KEY_H, - /* 12 */ KEY_I, - /* 13 */ KEY_J, - /* 14 */ KEY_K, - /* 15 */ KEY_L, - /* 16 */ KEY_M, - /* 17 */ KEY_N, - /* 18 */ KEY_O, - /* 19 */ KEY_P, - /* 20 */ KEY_Q, - /* 21 */ KEY_R, - /* 22 */ KEY_S, - /* 23 */ KEY_T, - /* 24 */ KEY_U, - /* 25 */ KEY_V, - /* 26 */ KEY_W, - /* 27 */ KEY_X, - /* 28 */ KEY_Y, - /* 29 */ KEY_Z, - /* 30 */ KEY_1, /* 1 !*/ - /* 31 */ KEY_2, /* 2 @ */ - /* 32 */ KEY_3, /* 3 # */ - /* 33 */ KEY_4, /* 4 $ */ - /* 34 */ KEY_5, /* 5 % */ - /* 35 */ KEY_6, /* 6 ^ */ - /* 36 */ KEY_7, /* 7 & */ - /* 37 */ KEY_8, /* 8 * */ - /* 38 */ KEY_9, /* 9 ( */ - /* 39 */ KEY_0, /* 0 ) */ - /* 40 */ KEY_Enter, /* Return */ - /* 41 */ KEY_Escape, /* Escape */ - /* 42 */ KEY_BackSpace, /* Backspace Delete */ - /* 43 */ KEY_Tab, /* Tab */ - /* 44 */ KEY_Space, /* Space */ - /* 45 */ KEY_Minus, /* - _ */ - /* 46 */ KEY_Equal, /* = + */ - /* 47 */ KEY_LBrace, /* [ { */ - /* 48 */ KEY_RBrace, /* ] } */ - /* 49 */ KEY_BSlash, /* \ | */ - /* 50 */ KEY_BSlash2, /* \ _ # ~ on some keyboards */ - /* 51 */ KEY_SemiColon, /* ; : */ - /* 52 */ KEY_Quote, /* ' " */ - /* 53 */ KEY_Tilde, /* ` ~ */ - /* 54 */ KEY_Comma, /* , < */ - /* 55 */ KEY_Period, /* . > */ - /* 56 */ KEY_Slash, /* / ? */ - /* 57 */ KEY_CapsLock, /* Caps Lock */ - /* 58 */ KEY_F1, /* F1 */ - /* 59 */ KEY_F2, /* F2 */ - /* 60 */ KEY_F3, /* F3 */ - /* 61 */ KEY_F4, /* F4 */ - /* 62 */ KEY_F5, /* F5 */ - /* 63 */ KEY_F6, /* F6 */ - /* 64 */ KEY_F7, /* F7 */ - /* 65 */ KEY_F8, /* F8 */ - /* 66 */ KEY_F9, /* F9 */ - /* 67 */ KEY_F10, /* F10 */ - /* 68 */ KEY_F11, /* F11 */ - /* 69 */ KEY_F12, /* F12 */ - /* 70 */ KEY_Print, /* PrintScrn SysReq */ - /* 71 */ KEY_ScrollLock, /* Scroll Lock */ - /* 72 */ KEY_Pause, /* Pause Break */ - /* 73 */ KEY_Insert, /* Insert XXX Help on some Mac Keyboards */ - /* 74 */ KEY_Home, /* Home */ - /* 75 */ KEY_PgUp, /* Page Up */ - /* 76 */ KEY_Delete, /* Delete */ - /* 77 */ KEY_End, /* End */ - /* 78 */ KEY_PgDown, /* Page Down */ - /* 79 */ KEY_Right, /* Right Arrow */ - /* 80 */ KEY_Left, /* Left Arrow */ - /* 81 */ KEY_Down, /* Down Arrow */ - /* 82 */ KEY_Up, /* Up Arrow */ - /* 83 */ KEY_NumLock, /* Num Lock */ - /* 84 */ KEY_KP_Divide, /* Keypad / */ - /* 85 */ KEY_KP_Multiply, /* Keypad * */ - /* 86 */ KEY_KP_Minus, /* Keypad - */ - /* 87 */ KEY_KP_Plus, /* Keypad + */ - /* 88 */ KEY_KP_Enter, /* Keypad Enter */ - /* 89 */ KEY_KP_1, /* Keypad 1 End */ - /* 90 */ KEY_KP_2, /* Keypad 2 Down */ - /* 91 */ KEY_KP_3, /* Keypad 3 Pg Down */ - /* 92 */ KEY_KP_4, /* Keypad 4 Left */ - /* 93 */ KEY_KP_5, /* Keypad 5 */ - /* 94 */ KEY_KP_6, /* Keypad 6 */ - /* 95 */ KEY_KP_7, /* Keypad 7 Home */ - /* 96 */ KEY_KP_8, /* Keypad 8 Up */ - /* 97 */ KEY_KP_9, /* KEypad 9 Pg Up */ - /* 98 */ KEY_KP_0, /* Keypad 0 Ins */ - /* 99 */ KEY_KP_Decimal, /* Keypad . Del */ - /* 100 */ KEY_Less, /* < > on some keyboards */ - /* 101 */ KEY_Menu, /* Menu */ - /* 102 */ KEY_NOTUSED, - /* 103 */ KEY_KP_Equal, /* Keypad = on Mac keyboards */ - /* 104 */ KEY_NOTUSED, - /* 105 */ KEY_NOTUSED, - /* 106 */ KEY_NOTUSED, - /* 107 */ KEY_NOTUSED, - /* 108 */ KEY_NOTUSED, - /* 109 */ KEY_NOTUSED, - /* 110 */ KEY_NOTUSED, - /* 111 */ KEY_NOTUSED, - /* 112 */ KEY_NOTUSED, - /* 113 */ KEY_NOTUSED, - /* 114 */ KEY_NOTUSED, - /* 115 */ KEY_NOTUSED, - /* 116 */ KEY_NOTUSED, - /* 117 */ KEY_NOTUSED, - /* 118 */ KEY_NOTUSED, - /* 119 */ KEY_NOTUSED, - /* 120 */ KEY_NOTUSED, - /* 121 */ KEY_NOTUSED, - /* 122 */ KEY_NOTUSED, - /* 123 */ KEY_NOTUSED, - /* 124 */ KEY_NOTUSED, - /* 125 */ KEY_NOTUSED, - /* 126 */ KEY_NOTUSED, - /* 127 */ KEY_NOTUSED, - /* 128 */ KEY_NOTUSED, - /* 129 */ KEY_NOTUSED, - /* 130 */ KEY_NOTUSED, - /* 131 */ KEY_NOTUSED, - /* 132 */ KEY_NOTUSED, - /* 133 */ KEY_NOTUSED, - /* 134 */ KEY_NOTUSED, - /* 135 */ KEY_NOTUSED, - /* 136 */ KEY_NOTUSED, - /* 137 */ KEY_NOTUSED, - /* 138 */ KEY_NOTUSED, - /* 139 */ KEY_NOTUSED, - /* 140 */ KEY_NOTUSED, - /* 141 */ KEY_NOTUSED, - /* 142 */ KEY_NOTUSED, - /* 143 */ KEY_NOTUSED, - /* 144 */ KEY_NOTUSED, - /* 145 */ KEY_NOTUSED, - /* 146 */ KEY_NOTUSED, - /* 147 */ KEY_NOTUSED, - /* 148 */ KEY_NOTUSED, - /* 149 */ KEY_NOTUSED, - /* 150 */ KEY_NOTUSED, - /* 151 */ KEY_NOTUSED, - /* 152 */ KEY_NOTUSED, - /* 153 */ KEY_NOTUSED, - /* 154 */ KEY_NOTUSED, - /* 155 */ KEY_NOTUSED, - /* 156 */ KEY_NOTUSED, - /* 157 */ KEY_NOTUSED, - /* 158 */ KEY_NOTUSED, - /* 159 */ KEY_NOTUSED, - /* 160 */ KEY_NOTUSED, - /* 161 */ KEY_NOTUSED, - /* 162 */ KEY_NOTUSED, - /* 163 */ KEY_NOTUSED, - /* 164 */ KEY_NOTUSED, - /* 165 */ KEY_NOTUSED, - /* 166 */ KEY_NOTUSED, - /* 167 */ KEY_NOTUSED, - /* 168 */ KEY_NOTUSED, - /* 169 */ KEY_NOTUSED, - /* 170 */ KEY_NOTUSED, - /* 171 */ KEY_NOTUSED, - /* 172 */ KEY_NOTUSED, - /* 173 */ KEY_NOTUSED, - /* 174 */ KEY_NOTUSED, - /* 175 */ KEY_NOTUSED, - /* 176 */ KEY_NOTUSED, - /* 177 */ KEY_NOTUSED, - /* 178 */ KEY_NOTUSED, - /* 179 */ KEY_NOTUSED, - /* 180 */ KEY_NOTUSED, - /* 181 */ KEY_NOTUSED, - /* 182 */ KEY_NOTUSED, - /* 183 */ KEY_NOTUSED, - /* 184 */ KEY_NOTUSED, - /* 185 */ KEY_NOTUSED, - /* 186 */ KEY_NOTUSED, - /* 187 */ KEY_NOTUSED, - /* 188 */ KEY_NOTUSED, - /* 189 */ KEY_NOTUSED, - /* 190 */ KEY_NOTUSED, - /* 191 */ KEY_NOTUSED, - /* 192 */ KEY_NOTUSED, - /* 193 */ KEY_NOTUSED, - /* 194 */ KEY_NOTUSED, - /* 195 */ KEY_NOTUSED, - /* 196 */ KEY_NOTUSED, - /* 197 */ KEY_NOTUSED, - /* 198 */ KEY_NOTUSED, - /* 199 */ KEY_NOTUSED, - /* 200 */ KEY_NOTUSED, - /* 201 */ KEY_NOTUSED, - /* 202 */ KEY_NOTUSED, - /* 203 */ KEY_NOTUSED, - /* 204 */ KEY_NOTUSED, - /* 205 */ KEY_NOTUSED, - /* 206 */ KEY_NOTUSED, - /* 207 */ KEY_NOTUSED, - /* 208 */ KEY_NOTUSED, - /* 209 */ KEY_NOTUSED, - /* 210 */ KEY_NOTUSED, - /* 211 */ KEY_NOTUSED, - /* 212 */ KEY_NOTUSED, - /* 213 */ KEY_NOTUSED, - /* 214 */ KEY_NOTUSED, - /* 215 */ KEY_NOTUSED, - /* 216 */ KEY_NOTUSED, - /* 217 */ KEY_NOTUSED, - /* 218 */ KEY_NOTUSED, - /* 219 */ KEY_NOTUSED, - /* 220 */ KEY_NOTUSED, - /* 221 */ KEY_NOTUSED, - /* 222 */ KEY_NOTUSED, - /* 223 */ KEY_NOTUSED, - /* 224 */ KEY_LCtrl, /* Left Control */ - /* 225 */ KEY_ShiftL, /* Left Shift */ - /* 226 */ KEY_Alt, /* Left Alt */ - /* 227 */ KEY_LMeta, /* Left Meta */ - /* 228 */ KEY_RCtrl, /* Right Control */ - /* 229 */ KEY_ShiftR, /* Right Shift */ - /* 230 */ KEY_AltLang, /* Right Alt, AKA AltGr */ - /* 231 */ KEY_LMeta, /* Right Meta XXX */ -}; - -#define WS_USB_MAP_SIZE (sizeof(wsUsbMap)/sizeof(unsigned char)) - -/* Map for adb keyboards */ -static CARD8 wsAdbMap[] = { - /* 0 */ KEY_A, - /* 1 */ KEY_S, - /* 2 */ KEY_D, - /* 3 */ KEY_F, - /* 4 */ KEY_H, - /* 5 */ KEY_G, - /* 6 */ KEY_Z, - /* 7 */ KEY_X, - /* 8 */ KEY_C, - /* 9 */ KEY_V, - /* 10 */ KEY_UNKNOWN, /* @ # on french keyboards */ - /* 11 */ KEY_B, - /* 12 */ KEY_Q, - /* 13 */ KEY_W, - /* 14 */ KEY_E, - /* 15 */ KEY_R, - /* 16 */ KEY_Y, - /* 17 */ KEY_T, - /* 18 */ KEY_1, - /* 19 */ KEY_2, - /* 20 */ KEY_3, - /* 21 */ KEY_4, - /* 22 */ KEY_6, - /* 23 */ KEY_5, - /* 24 */ KEY_Equal, - /* 25 */ KEY_9, - /* 26 */ KEY_7, - /* 27 */ KEY_Minus, - /* 28 */ KEY_8, - /* 29 */ KEY_0, - /* 30 */ KEY_RBrace, - /* 31 */ KEY_O, - /* 32 */ KEY_U, - /* 33 */ KEY_LBrace, - /* 34 */ KEY_I, - /* 35 */ KEY_P, - /* 36 */ KEY_Enter, - /* 37 */ KEY_L, - /* 38 */ KEY_J, - /* 39 */ KEY_Quote, - /* 40 */ KEY_K, - /* 41 */ KEY_SemiColon, - /* 42 */ KEY_BSlash, - /* 43 */ KEY_Comma, - /* 44 */ KEY_Slash, - /* 45 */ KEY_N, - /* 46 */ KEY_M, - /* 47 */ KEY_Period, - /* 48 */ KEY_Tab, - /* 49 */ KEY_Space, - /* 50 */ KEY_Tilde, - /* 51 */ KEY_Delete, - /* 52 */ KEY_AltLang, - /* 53 */ KEY_Escape, - /* 54 */ KEY_LCtrl, - /* 55 */ KEY_Alt, - /* 56 */ KEY_ShiftL, - /* 57 */ KEY_CapsLock, - /* 58 */ KEY_LMeta, - /* 59 */ KEY_Left, - /* 60 */ KEY_Right, - /* 61 */ KEY_Down, - /* 62 */ KEY_Up, - /* 63 */ KEY_UNKNOWN, /* Fn */ - /* 64 */ KEY_NOTUSED, - /* 65 */ KEY_KP_Decimal, - /* 66 */ KEY_NOTUSED, - /* 67 */ KEY_KP_Multiply, - /* 68 */ KEY_NOTUSED, - /* 69 */ KEY_KP_Plus, - /* 70 */ KEY_NOTUSED, - /* 71 */ KEY_UNKNOWN, /* Clear */ - /* 72 */ KEY_NOTUSED, - /* 73 */ KEY_NOTUSED, - /* 74 */ KEY_NOTUSED, - /* 75 */ KEY_KP_Divide, - /* 76 */ KEY_KP_Enter, - /* 77 */ KEY_NOTUSED, - /* 78 */ KEY_KP_Minus, - /* 79 */ KEY_NOTUSED, - /* 80 */ KEY_NOTUSED, - /* 81 */ KEY_KP_Equal, /* Keypad = */ - /* 82 */ KEY_KP_0, - /* 83 */ KEY_KP_1, - /* 84 */ KEY_KP_2, - /* 85 */ KEY_KP_3, - /* 86 */ KEY_KP_4, - /* 87 */ KEY_KP_5, - /* 88 */ KEY_KP_6, - /* 89 */ KEY_KP_7, - /* 90 */ KEY_NOTUSED, - /* 91 */ KEY_KP_8, - /* 92 */ KEY_KP_9, - /* 93 */ KEY_NOTUSED, - /* 94 */ KEY_NOTUSED, - /* 95 */ KEY_UNKNOWN, /* Keypad , */ - /* 96 */ KEY_F5, - /* 97 */ KEY_F6, - /* 98 */ KEY_F7, - /* 99 */ KEY_F3, - /* 100 */ KEY_F8, - /* 101 */ KEY_F9, - /* 102 */ KEY_NOTUSED, - /* 103 */ KEY_F11, - /* 104 */ KEY_NOTUSED, - /* 105 */ KEY_NOTUSED, - /* 106 */ KEY_KP_Enter, - /* 107 */ KEY_NOTUSED, - /* 108 */ KEY_NOTUSED, - /* 109 */ KEY_F10, - /* 110 */ KEY_NOTUSED, - /* 111 */ KEY_F12, - /* 112 */ KEY_NOTUSED, - /* 113 */ KEY_NOTUSED, - /* 114 */ KEY_NOTUSED, - /* 115 */ KEY_Home, - /* 116 */ KEY_PgUp, - /* 117 */ KEY_NOTUSED, - /* 118 */ KEY_F4, - /* 119 */ KEY_End, - /* 120 */ KEY_F2, - /* 121 */ KEY_PgDown, - /* 122 */ KEY_F1, - /* 123 */ KEY_NOTUSED, - /* 124 */ KEY_NOTUSED, - /* 125 */ KEY_NOTUSED, - /* 126 */ KEY_NOTUSED, - /* 127 */ KEY_NOTUSED, - /* 128 */ KEY_NOTUSED, - /* 129 */ KEY_NOTUSED, - /* 130 */ KEY_NOTUSED, - /* 131 */ KEY_NOTUSED, - /* 132 */ KEY_NOTUSED, - /* 133 */ KEY_NOTUSED, - /* 134 */ KEY_NOTUSED, - /* 135 */ KEY_NOTUSED, - /* 136 */ KEY_NOTUSED, - /* 137 */ KEY_NOTUSED, - /* 138 */ KEY_NOTUSED, - /* 139 */ KEY_NOTUSED, - /* 140 */ KEY_NOTUSED, - /* 141 */ KEY_NOTUSED, - /* 142 */ KEY_NOTUSED, - /* 143 */ KEY_NOTUSED, - /* 144 */ KEY_NOTUSED, - /* 145 */ KEY_NOTUSED, - /* 146 */ KEY_NOTUSED, - /* 147 */ KEY_NOTUSED, - /* 148 */ KEY_NOTUSED, - /* 149 */ KEY_NOTUSED, - /* 150 */ KEY_NOTUSED, - /* 151 */ KEY_NOTUSED, - /* 152 */ KEY_NOTUSED, - /* 153 */ KEY_NOTUSED, - /* 154 */ KEY_NOTUSED, - /* 155 */ KEY_NOTUSED, - /* 156 */ KEY_NOTUSED, - /* 157 */ KEY_NOTUSED, - /* 158 */ KEY_NOTUSED, - /* 159 */ KEY_NOTUSED, - /* 160 */ KEY_NOTUSED, - /* 161 */ KEY_NOTUSED, - /* 162 */ KEY_NOTUSED, - /* 163 */ KEY_NOTUSED, - /* 164 */ KEY_NOTUSED, - /* 165 */ KEY_NOTUSED, - /* 166 */ KEY_NOTUSED, - /* 167 */ KEY_NOTUSED, - /* 168 */ KEY_NOTUSED, - /* 169 */ KEY_NOTUSED, - /* 170 */ KEY_NOTUSED, - /* 171 */ KEY_NOTUSED, - /* 172 */ KEY_NOTUSED, - /* 173 */ KEY_NOTUSED, - /* 174 */ KEY_NOTUSED, - /* 175 */ KEY_NOTUSED, - /* 176 */ KEY_NOTUSED, - /* 177 */ KEY_NOTUSED, - /* 178 */ KEY_NOTUSED, - /* 179 */ KEY_NOTUSED, - /* 180 */ KEY_NOTUSED, - /* 181 */ KEY_NOTUSED, - /* 182 */ KEY_NOTUSED, - /* 183 */ KEY_NOTUSED, - /* 184 */ KEY_NOTUSED, - /* 185 */ KEY_NOTUSED, - /* 186 */ KEY_NOTUSED, - /* 187 */ KEY_NOTUSED, - /* 188 */ KEY_NOTUSED, - /* 189 */ KEY_NOTUSED, - /* 190 */ KEY_NOTUSED, - /* 191 */ KEY_NOTUSED, - /* 192 */ KEY_NOTUSED, - /* 193 */ KEY_NOTUSED, - /* 194 */ KEY_NOTUSED, - /* 195 */ KEY_NOTUSED, - /* 196 */ KEY_NOTUSED, - /* 197 */ KEY_NOTUSED, - /* 198 */ KEY_NOTUSED, - /* 199 */ KEY_NOTUSED, - /* 200 */ KEY_NOTUSED, - /* 201 */ KEY_NOTUSED, - /* 202 */ KEY_NOTUSED, - /* 203 */ KEY_NOTUSED, - /* 204 */ KEY_NOTUSED, - /* 205 */ KEY_NOTUSED, - /* 206 */ KEY_NOTUSED, - /* 207 */ KEY_NOTUSED, - /* 208 */ KEY_NOTUSED, - /* 209 */ KEY_NOTUSED, - /* 210 */ KEY_NOTUSED, - /* 211 */ KEY_NOTUSED, - /* 212 */ KEY_NOTUSED, - /* 213 */ KEY_NOTUSED, - /* 214 */ KEY_NOTUSED, - /* 215 */ KEY_NOTUSED, - /* 216 */ KEY_NOTUSED, - /* 217 */ KEY_NOTUSED, - /* 218 */ KEY_NOTUSED, - /* 219 */ KEY_NOTUSED, - /* 220 */ KEY_NOTUSED, - /* 221 */ KEY_NOTUSED, - /* 222 */ KEY_NOTUSED, - /* 223 */ KEY_NOTUSED, -}; - -#define WS_ADB_MAP_SIZE (sizeof(wsAdbMap)/sizeof(unsigned char)) - -static CARD8 wsSunMap[] = { - /* 0x00 */ KEY_NOTUSED, - /* 0x01 */ KEY_NOTUSED, /* stop */ - /* 0x02 */ KEY_NOTUSED, /* BrightnessDown / S-VolumeDown */ - /* 0x03 */ KEY_NOTUSED, /* again */ - /* 0x04 */ KEY_NOTUSED, /* BridgtnessUp / S-VolumeUp */ - /* 0x05 */ KEY_F1, - /* 0x06 */ KEY_F2, - /* 0x07 */ KEY_F10, - /* 0x08 */ KEY_F3, - /* 0x09 */ KEY_F11, - /* 0x0a */ KEY_F4, - /* 0x0b */ KEY_F12, - /* 0x0c */ KEY_F5, - /* 0x0d */ KEY_AltLang, - /* 0x0e */ KEY_F6, - /* 0x0f */ KEY_NOTUSED, - /* 0x10 */ KEY_F7, - /* 0x11 */ KEY_F8, - /* 0x12 */ KEY_F9, - /* 0x13 */ KEY_Alt, - /* 0x14 */ KEY_Up, - /* 0x15 */ KEY_Pause, - /* 0x16 */ KEY_Print, - /* 0x17 */ KEY_NOTUSED, /* props */ - /* 0x18 */ KEY_Left, - /* 0x19 */ KEY_ScrollLock, - /* 0x1a */ KEY_NOTUSED, /* undo */ - /* 0x1b */ KEY_Down, - /* 0x1c */ KEY_Right, - /* 0x1d */ KEY_Escape, - /* 0x1e */ KEY_1, - /* 0x1f */ KEY_2, - /* 0x20 */ KEY_3, - /* 0x21 */ KEY_4, - /* 0x22 */ KEY_5, - /* 0x23 */ KEY_6, - /* 0x24 */ KEY_7, - /* 0x25 */ KEY_8, - /* 0x26 */ KEY_9, - /* 0x27 */ KEY_0, - /* 0x28 */ KEY_Minus, - /* 0x29 */ KEY_Equal, - /* 0x2a */ KEY_Tilde, - /* 0x2b */ KEY_BackSpace, - /* 0x2c */ KEY_Insert, - /* 0x2d */ KEY_KP_Equal, - /* 0x2e */ KEY_KP_Divide, - /* 0x2f */ KEY_KP_Multiply, - /* 0x30 */ KEY_NOTUSED, - /* 0x31 */ KEY_NOTUSED, /* front */ - /* 0x32 */ KEY_KP_Decimal, - /* 0x33 */ KEY_NOTUSED, /* copy */ - /* 0x34 */ KEY_Home, - /* 0x35 */ KEY_Tab, - /* 0x36 */ KEY_Q, - /* 0x37 */ KEY_W, - /* 0x38 */ KEY_E, - /* 0x39 */ KEY_R, - /* 0x3a */ KEY_T, - /* 0x3b */ KEY_Y, - /* 0x3c */ KEY_U, - /* 0x3d */ KEY_I, - /* 0x3e */ KEY_O, - /* 0x3f */ KEY_P, - /* 0x40 */ KEY_LBrace, - /* 0x41 */ KEY_RBrace, - /* 0x42 */ KEY_Delete, - /* 0x43 */ KEY_NOTUSED, /* compose */ - /* 0x44 */ KEY_KP_7, - /* 0x45 */ KEY_KP_8, - /* 0x46 */ KEY_KP_9, - /* 0x47 */ KEY_KP_Minus, - /* 0x48 */ KEY_NOTUSED, /* open */ - /* 0x49 */ KEY_NOTUSED, /* paste */ - /* 0x4a */ KEY_End, - /* 0x4b */ KEY_NOTUSED, - /* 0x4c */ KEY_LCtrl, - /* 0x4d */ KEY_A, - /* 0x4e */ KEY_S, - /* 0x4f */ KEY_D, - /* 0x50 */ KEY_F, - /* 0x51 */ KEY_G, - /* 0x52 */ KEY_H, - /* 0x53 */ KEY_J, - /* 0x54 */ KEY_K, - /* 0x55 */ KEY_L, - /* 0x56 */ KEY_SemiColon, - /* 0x57 */ KEY_Quote, - /* 0x58 */ KEY_BSlash, - /* 0x59 */ KEY_Enter, - /* 0x5a */ KEY_KP_Enter, - /* 0x5b */ KEY_KP_4, - /* 0x5c */ KEY_KP_5, - /* 0x5d */ KEY_KP_6, - /* 0x5e */ KEY_KP_0, - /* 0x5f */ KEY_NOTUSED, /* find */ - /* 0x60 */ KEY_PgUp, - /* 0x61 */ KEY_NOTUSED, /* cut */ - /* 0x62 */ KEY_NumLock, - /* 0x63 */ KEY_ShiftL, - /* 0x64 */ KEY_Z, - /* 0x65 */ KEY_X, - /* 0x66 */ KEY_C, - /* 0x67 */ KEY_V, - /* 0x68 */ KEY_B, - /* 0x69 */ KEY_N, - /* 0x6a */ KEY_M, - /* 0x6b */ KEY_Comma, - /* 0x6c */ KEY_Period, - /* 0x6d */ KEY_Slash, - /* 0x6e */ KEY_ShiftR, - /* 0x6f */ KEY_NOTUSED, /* linefeed */ - /* 0x70 */ KEY_KP_1, - /* 0x71 */ KEY_KP_2, - /* 0x72 */ KEY_KP_3, - /* 0x73 */ KEY_NOTUSED, - /* 0x74 */ KEY_NOTUSED, - /* 0x75 */ KEY_NOTUSED, - /* 0x76 */ KEY_NOTUSED, /* help */ - /* 0x77 */ KEY_CapsLock, - /* 0x78 */ KEY_LMeta, - /* 0x79 */ KEY_Space, - /* 0x7a */ KEY_RMeta, - /* 0x7b */ KEY_PgDown, - /* 0x7c */ KEY_NOTUSED, - /* 0x7d */ KEY_KP_Plus, - /* 0x7e */ KEY_NOTUSED, - /* 0x7f */ KEY_NOTUSED -}; - -#define WS_SUN_MAP_SIZE (sizeof(wsSunMap)/sizeof(unsigned char)) - -/* - * Translate raw wskbd keyboard event values to XFree86 standard keycodes - * (based on the AT keyboard scan codes using the tables above - */ -int -WSKbdToKeycode(int keycode) -{ - switch (xf86Info.wsKbdType) { - case WSKBD_TYPE_PC_XT: - case WSKBD_TYPE_PC_AT: - /* No translation needed */ - return keycode; - case WSKBD_TYPE_USB: - if (keycode < 0 || keycode >= WS_USB_MAP_SIZE) - return KEY_UNKNOWN; - else - return wsUsbMap[keycode]; -#ifdef WSKBD_TYPE_ADB - case WSKBD_TYPE_ADB: - if (keycode < 0 || keycode >= WS_ADB_MAP_SIZE) - return KEY_UNKNOWN; - else - return wsAdbMap[keycode]; -#endif -#ifdef WSKBD_TYPE_SUN - case WSKBD_TYPE_SUN: -#ifdef WSKBD_TYPE_SUN5 - case WSKBD_TYPE_SUN5: -#endif - if (keycode < 0 || keycode >= WS_SUN_MAP_SIZE) - return KEY_UNKNOWN; - else - return wsSunMap[keycode]; -#endif - default: - ErrorF("Unknown wskbd type %d\n", xf86Info.wsKbdType); - return KEY_UNKNOWN; - } -} - -#endif /* WSCONS_SUPPORT */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c deleted file mode 100644 index c5361f5d9..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c +++ /dev/null @@ -1,651 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c,v 3.17 2003/08/24 17:36:53 dawes Exp $ */ -/* - * Linux version of keymapping setup. The kernel (since 0.99.14) has support - * for fully remapping the keyboard, but there are some differences between - * the Linux map and the SVR4 map (esp. in the extended keycodes). We also - * remove the restriction on what keycodes can be remapped. - * Orest Zborowski. - */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* - * Copyright (c) 1994-2001 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* $XConsortium: xf86KbdLnx.c /main/7 1996/10/19 17:59:00 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "input.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "atKeynames.h" - -#include "xf86Keymap.h" - -/* - * LegalModifier -- - * determine whether a key is a legal modifier key, i.e send a - * press/release sequence. - */ - -/*ARGSUSED*/ -Bool -LegalModifier(unsigned int key, DevicePtr pDev) -{ - return (TRUE); -} - -/* - * xf86KbdGetMapping -- - * Get the national keyboard mapping. The keyboard type is set, a new map - * and the modifiermap is computed. - */ - -static void readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap); - -void -xf86KbdGetMapping (KeySymsPtr pKeySyms, CARD8 *pModMap) -{ - KeySym *k; - char type; - int i; - - readKernelMapping(pKeySyms, pModMap); - - /* - * compute the modifier map - */ - for (i = 0; i < MAP_LENGTH; i++) - pModMap[i] = NoSymbol; /* make sure it is restored */ - - for (k = map, i = MIN_KEYCODE; - i < (NUM_KEYCODES + MIN_KEYCODE); - i++, k += 4) - - switch(*k) { - - case XK_Shift_L: - case XK_Shift_R: - pModMap[i] = ShiftMask; - break; - - case XK_Control_L: - case XK_Control_R: - pModMap[i] = ControlMask; - break; - - case XK_Caps_Lock: - pModMap[i] = LockMask; - break; - - case XK_Alt_L: - case XK_Alt_R: - pModMap[i] = AltMask; - break; - - case XK_Num_Lock: - pModMap[i] = NumLockMask; - break; - - case XK_Scroll_Lock: - pModMap[i] = ScrollLockMask; - break; - - /* kana support */ - case XK_Kana_Lock: - case XK_Kana_Shift: - pModMap[i] = KanaMask; - break; - - /* alternate toggle for multinational support */ - case XK_Mode_switch: - pModMap[i] = AltLangMask; - break; - - } - - xf86Info.kbdType = - ioctl(xf86Info.consoleFd, KDGKBTYPE, &type) != -1 ? type : KB_101; - - pKeySyms->map = map; - pKeySyms->mapWidth = GLYPHS_PER_KEY; - pKeySyms->minKeyCode = MIN_KEYCODE; - pKeySyms->maxKeyCode = MAX_KEYCODE; -} - -#include - -static KeySym linux_to_x[256] = { - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_Escape, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_space, XK_exclam, XK_quotedbl, XK_numbersign, - XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, - XK_parenleft, XK_parenright, XK_asterisk, XK_plus, - XK_comma, XK_minus, XK_period, XK_slash, - XK_0, XK_1, XK_2, XK_3, - XK_4, XK_5, XK_6, XK_7, - XK_8, XK_9, XK_colon, XK_semicolon, - XK_less, XK_equal, XK_greater, XK_question, - XK_at, XK_A, XK_B, XK_C, - XK_D, XK_E, XK_F, XK_G, - XK_H, XK_I, XK_J, XK_K, - XK_L, XK_M, XK_N, XK_O, - XK_P, XK_Q, XK_R, XK_S, - XK_T, XK_U, XK_V, XK_W, - XK_X, XK_Y, XK_Z, XK_bracketleft, - XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, - XK_grave, XK_a, XK_b, XK_c, - XK_d, XK_e, XK_f, XK_g, - XK_h, XK_i, XK_j, XK_k, - XK_l, XK_m, XK_n, XK_o, - XK_p, XK_q, XK_r, XK_s, - XK_t, XK_u, XK_v, XK_w, - XK_x, XK_y, XK_z, XK_braceleft, - XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling, - XK_currency, XK_yen, XK_brokenbar, XK_section, - XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft, - XK_notsign, XK_hyphen, XK_registered, XK_macron, - XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior, - XK_acute, XK_mu, XK_paragraph, XK_periodcentered, - XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright, - XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown, - XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde, - XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla, - XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis, - XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis, - XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute, - XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply, - XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex, - XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp, - XK_agrave, XK_aacute, XK_acircumflex, XK_atilde, - XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla, - XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis, - XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis, - XK_eth, XK_ntilde, XK_ograve, XK_oacute, - XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division, - XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex, - XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis -}; - -/* - * Maps the AT keycodes to Linux keycodes - */ -static unsigned char at2lnx[NUM_KEYCODES] = -{ - 0x01, /* KEY_Escape */ 0x02, /* KEY_1 */ - 0x03, /* KEY_2 */ 0x04, /* KEY_3 */ - 0x05, /* KEY_4 */ 0x06, /* KEY_5 */ - 0x07, /* KEY_6 */ 0x08, /* KEY_7 */ - 0x09, /* KEY_8 */ 0x0a, /* KEY_9 */ - 0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */ - 0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */ - 0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */ - 0x11, /* KEY_W */ 0x12, /* KEY_E */ - 0x13, /* KEY_R */ 0x14, /* KEY_T */ - 0x15, /* KEY_Y */ 0x16, /* KEY_U */ - 0x17, /* KEY_I */ 0x18, /* KEY_O */ - 0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */ - 0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */ - 0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */ - 0x1f, /* KEY_S */ 0x20, /* KEY_D */ - 0x21, /* KEY_F */ 0x22, /* KEY_G */ - 0x23, /* KEY_H */ 0x24, /* KEY_J */ - 0x25, /* KEY_K */ 0x26, /* KEY_L */ - 0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */ - 0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */ - 0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */ - 0x2d, /* KEY_X */ 0x2e, /* KEY_C */ - 0x2f, /* KEY_V */ 0x30, /* KEY_B */ - 0x31, /* KEY_N */ 0x32, /* KEY_M */ - 0x33, /* KEY_Comma */ 0x34, /* KEY_Period */ - 0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */ - 0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */ - 0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */ - 0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */ - 0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */ - 0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */ - 0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */ - 0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */ - 0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */ - 0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */ - 0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */ - 0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */ - 0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */ - 0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */ - 0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */ - 0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */ - 0x00, /* 0x55 */ 0x56, /* KEY_Less */ - 0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */ - 0x66, /* KEY_Home */ 0x67, /* KEY_Up */ - 0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */ - 0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */ - 0x6b, /* KEY_End */ 0x6c, /* KEY_Down */ - 0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */ - 0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */ - 0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */ - 0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */ - 0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */ - 0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */ - 0x7A, /* KEY_Menu/FOCUS_PF11*/0x00, /* 0x6e */ - 0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */ - 0x00, /* 0x71 */ 0x00, /* 0x72 */ - 0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */ - 0x00, /* 0x75 */ 0x00, /* 0x76 */ - 0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */ - 0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */ - 0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */ - 0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */ - 0x00, /* 0x7f */ -}; -#define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0])) - -#define NUM_CUSTOMKEYS NR_KEYS - -u_char SpecialServerMap[NUM_CUSTOMKEYS]; - -static void -readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap) -{ - KeySym *k; - int i; - int maxkey; - static unsigned char tbl[GLYPHS_PER_KEY] = - { - 0, /* unshifted */ - 1, /* shifted */ - 0, /* modeswitch unshifted */ - 0 /* modeswitch shifted */ - }; - - /* - * Read the mapping from the kernel. - * Since we're still using the XFree86 scancode->AT keycode mapping - * routines, we need to convert the AT keycodes to Linux keycodes, - * then translate the Linux keysyms into X keysyms. - * - * First, figure out which tables to use for the modeswitch columns - * above, from the XF86Config fields. - */ - tbl[2] = 8; /* alt */ - tbl[3] = tbl[2] | 1; - - if (xf86Info.kbdCustomKeycodes) { - k = map; - maxkey = NUM_CUSTOMKEYS; - } - else { - k = map+GLYPHS_PER_KEY; - maxkey = NUM_AT2LNX; - } - - for (i = 0; i < maxkey; ++i) - { - struct kbentry kbe; - int j; - - if (xf86Info.kbdCustomKeycodes) - kbe.kb_index = i; - else - kbe.kb_index = at2lnx[i]; - - for (j = 0; j < GLYPHS_PER_KEY; ++j, ++k) - { - unsigned short kval; - - *k = NoSymbol; - - kbe.kb_table = tbl[j]; - if ( - (!xf86Info.kbdCustomKeycodes && kbe.kb_index == 0) || - ioctl(xf86Info.consoleFd, KDGKBENT, &kbe)) - continue; - - kval = KVAL(kbe.kb_value); - switch (KTYP(kbe.kb_value)) - { - case KT_LATIN: - case KT_LETTER: - *k = linux_to_x[kval]; - break; - - case KT_FN: - if (kval <= 19) - *k = XK_F1 + kval; - else switch (kbe.kb_value) - { - case K_FIND: - *k = XK_Home; /* or XK_Find */ - break; - case K_INSERT: - *k = XK_Insert; - break; - case K_REMOVE: - *k = XK_Delete; - break; - case K_SELECT: - *k = XK_End; /* or XK_Select */ - break; - case K_PGUP: - *k = XK_Prior; - break; - case K_PGDN: - *k = XK_Next; - break; - case K_HELP: - *k = XK_Help; - break; - case K_DO: - *k = XK_Execute; - break; - case K_PAUSE: - *k = XK_Pause; - break; - case K_MACRO: - *k = XK_Menu; - break; - default: - break; - } - break; - - case KT_SPEC: - switch (kbe.kb_value) - { - case K_ENTER: - *k = XK_Return; - break; - case K_BREAK: - *k = XK_Break; - break; - case K_CAPS: - *k = XK_Caps_Lock; - break; - case K_NUM: - *k = XK_Num_Lock; - break; - case K_HOLD: - *k = XK_Scroll_Lock; - break; - case K_COMPOSE: - *k = XK_Multi_key; - break; - default: - break; - } - break; - - case KT_PAD: - switch (kbe.kb_value) - { - case K_PPLUS: - *k = XK_KP_Add; - break; - case K_PMINUS: - *k = XK_KP_Subtract; - break; - case K_PSTAR: - *k = XK_KP_Multiply; - break; - case K_PSLASH: - *k = XK_KP_Divide; - break; - case K_PENTER: - *k = XK_KP_Enter; - break; - case K_PCOMMA: - *k = XK_KP_Separator; - break; - case K_PDOT: - *k = XK_KP_Decimal; - break; - case K_PPLUSMINUS: - *k = XK_KP_Subtract; - break; - default: - if (kval <= 9) - *k = XK_KP_0 + kval; - break; - } - break; - - /* - * KT_DEAD keys are for accelerated diacritical creation. - */ - case KT_DEAD: - switch (kbe.kb_value) - { - case K_DGRAVE: - *k = XK_dead_grave; - break; - case K_DACUTE: - *k = XK_dead_acute; - break; - case K_DCIRCM: - *k = XK_dead_circumflex; - break; - case K_DTILDE: - *k = XK_dead_tilde; - break; - case K_DDIERE: - *k = XK_dead_diaeresis; - break; - } - break; - - case KT_CUR: - switch (kbe.kb_value) - { - case K_DOWN: - *k = XK_Down; - break; - case K_LEFT: - *k = XK_Left; - break; - case K_RIGHT: - *k = XK_Right; - break; - case K_UP: - *k = XK_Up; - break; - } - break; - - case KT_SHIFT: - switch (kbe.kb_value) - { - case K_ALTGR: - *k = XK_Alt_R; - break; - case K_ALT: - *k = (kbe.kb_index == 0x64 ? - XK_Alt_R : XK_Alt_L); - break; - case K_CTRL: - *k = (kbe.kb_index == 0x61 ? - XK_Control_R : XK_Control_L); - break; - case K_CTRLL: - *k = XK_Control_L; - break; - case K_CTRLR: - *k = XK_Control_R; - break; - case K_SHIFT: - *k = (kbe.kb_index == 0x36 ? - XK_Shift_R : XK_Shift_L); - break; - case K_SHIFTL: - *k = XK_Shift_L; - break; - case K_SHIFTR: - *k = XK_Shift_R; - break; - default: - break; - } - break; - - /* - * KT_ASCII keys accumulate a 3 digit decimal number that gets - * emitted when the shift state changes. We can't emulate that. - */ - case KT_ASCII: - break; - - case KT_LOCK: - if (kbe.kb_value == K_SHIFTLOCK) - *k = XK_Shift_Lock; - break; - - default: - break; - } - } - - if (k[-1] == k[-2]) k[-1] = NoSymbol; - if (k[-2] == k[-3]) k[-2] = NoSymbol; - if (k[-3] == k[-4]) k[-3] = NoSymbol; - if (k[-4] == k[-2] && k[-3] == k[-1]) k[-2] = k[-1] = NoSymbol; - if (k[-1] == k[-4] && k[-2] == k[-3] && k[-2] == NoSymbol) k[-1] =NoSymbol; - } - - if (!xf86Info.kbdCustomKeycodes) - return; - - /* - * Find the Mapping for the special server functions - */ - for (i = 0; i < NUM_CUSTOMKEYS; ++i) { - struct kbentry kbe; - int special = 0; - - kbe.kb_index = i; - kbe.kb_table = 0; /* Plain map */ - if (!ioctl(xf86Info.consoleFd, KDGKBENT, &kbe)) - switch (kbe.kb_value) { - case K(KT_LATIN,0x7f): /* This catches DEL too... But who cares? */ - special = KEY_BackSpace; - break; - case K_PMINUS: - special = KEY_KP_Minus; - break; - case K_PPLUS: - special = KEY_KP_Plus; - break; - case K_F1: - special = KEY_F1; - break; - case K_F2: - special = KEY_F2; - break; - case K_F3: - special = KEY_F3; - break; - case K_F4: - special = KEY_F4; - break; - case K_F5: - special = KEY_F5; - break; - case K_F6: - special = KEY_F6; - break; - case K_F7: - special = KEY_F7; - break; - case K_F8: - special = KEY_F8; - break; - case K_F9: - special = KEY_F9; - break; - case K_F10: - special = KEY_F10; - break; - case K_F11: - special = KEY_F11; - break; - case K_F12: - special = KEY_F12; - break; - case K_ALT: - special = KEY_Alt; - break; - case K_ALTGR: - special = KEY_AltLang; - break; - case K_CONS: - special = KEY_SysReqest; - break; - } - SpecialServerMap[i] = special; - } -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86KbdMach.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86KbdMach.c deleted file mode 100644 index 89c23c24a..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86KbdMach.c +++ /dev/null @@ -1,317 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdMach.c,v 3.7.4.2 1998/06/04 17:35:20 dawes Exp $ */ -/* - ***************************************************************************** - * HISTORY - * Log: xf86KbdMach.c,v - * Revision 2.1.2.1 92/06/25 10:32:08 moore - * Incorporate the Elliot Dresselhaus's, Ernest Hua's and local changes - * to run Thomas Roell's I386 color X11R5. Original code only worked - * with SCO Unix. New code works with 2.5 and 3.0 Mach - * [92/06/24 rvb] - * - * EndLog - * - ***************************************************************************** - */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: xf86KbdMach.c /main/9 1996/02/21 17:38:43 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "input.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "atKeynames.h" -#include "xf86Config.h" - -#include "xf86Keymap.h" - -static KeySym ascii_to_x[256] = { - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, - NoSymbol, XK_Return, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_Escape, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_space, XK_exclam, XK_quotedbl, XK_numbersign, - XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, - XK_parenleft, XK_parenright, XK_asterisk, XK_plus, - XK_comma, XK_minus, XK_period, XK_slash, - XK_0, XK_1, XK_2, XK_3, - XK_4, XK_5, XK_6, XK_7, - XK_8, XK_9, XK_colon, XK_semicolon, - XK_less, XK_equal, XK_greater, XK_question, - XK_at, XK_A, XK_B, XK_C, - XK_D, XK_E, XK_F, XK_G, - XK_H, XK_I, XK_J, XK_K, - XK_L, XK_M, XK_N, XK_O, - XK_P, XK_Q, XK_R, XK_S, - XK_T, XK_U, XK_V, XK_W, - XK_X, XK_Y, XK_Z, XK_bracketleft, - XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, - XK_grave, XK_a, XK_b, XK_c, - XK_d, XK_e, XK_f, XK_g, - XK_h, XK_i, XK_j, XK_k, - XK_l, XK_m, XK_n, XK_o, - XK_p, XK_q, XK_r, XK_s, - XK_t, XK_u, XK_v, XK_w, - XK_x, XK_y, XK_z, XK_braceleft, - XK_bar, XK_braceright, XK_asciitilde, XK_Delete, - XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex, - XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla, - XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis, - XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring, - XK_Eacute, XK_ae, XK_AE, XK_ocircumflex, - XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave, - XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent, - XK_sterling, XK_yen, XK_paragraph, XK_section, - XK_aacute, XK_iacute, XK_oacute, XK_uacute, - XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine, - XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf, - XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi, - XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau, - XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta, - XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection, - XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal, - XK_topintegral, XK_botintegral, XK_division, XK_similarequal, - XK_degree, NoSymbol, NoSymbol, XK_radical, - XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol, - }; - -/* - * LegalModifier -- - * determine whether a key is a legal modifier key, i.e send a - * press/release sequence. - */ - -/*ARGSUSED*/ -Bool -LegalModifier(key, pDev) - unsigned int key; - DevicePtr pDev; -{ - return (TRUE); -} - - - -/* - * xf86KbdGetMapping -- - * Get the national keyboard mapping. The keyboard type is set, a new map - * and the modifiermap is computed. - */ - -void -xf86KbdGetMapping (pKeySyms, pModMap) - KeySymsPtr pKeySyms; - CARD8 *pModMap; -{ - KeySym *k; - struct kbentry kbe; - char type; - int i, j; - - for (i = 0; i < NUMKEYS; i++) - { - static int states[] = { NORM_STATE, SHIFT_STATE, ALT_STATE, SHIFT_ALT }; - int j; - - k = &map[i*4]; - kbe.kb_index = i; - - for (j = 0; j < 4; j++) - { - kbe.kb_state = states[j]; - - if (ioctl (xf86Info.consoleFd, KDGKBENT, &kbe) != -1) - continue; - - if (kbe.kb_value [0] == K_SCAN) - { - int keycode = -1; - switch (kbe.kb_value [1]) - { - case K_CTLSC: keycode = XK_Control_L; break; - case K_LSHSC: keycode = XK_Shift_L; break; - case K_RSHSC: keycode = XK_Shift_R; break; - case K_ALTSC: keycode = XK_Alt_L; break; - case K_CLCKSC: keycode = XK_Caps_Lock; break; - case K_NLCKSC: keycode = XK_Num_Lock; break; - default: break; - } - if (keycode > 0) - k[j] = keycode; - } - else if (kbe.kb_value[1] != NC) - { - /* How to handle multiple characters? - Ignore them for now. */ - } - else - { - k[j] = ascii_to_x[kbe.kb_value[0]]; - } - } - } - - /* - * Apply the special key mapping specified in XF86Config - */ - for (k = map, i = MIN_KEYCODE; - i < (NUM_KEYCODES + MIN_KEYCODE); - i++, k += 4) { - switch (k[0]) { - case XK_Alt_L: - j = K_INDEX_LEFTALT; - break; - case XK_Alt_R: - j = K_INDEX_RIGHTALT; - break; - case XK_Scroll_Lock: - j = K_INDEX_SCROLLLOCK; - break; - case XK_Control_R: - j = K_INDEX_RIGHTCTL; - break; - default: - j = -1; - } - if (j >= 0) - switch (xf86Info.specialKeyMap[j]) { - case KM_META: - if (k[0] == XK_Alt_R) - k[1] = XK_Meta_R; - else { - k[0] = XK_Alt_L; - k[1] = XK_Meta_L; - } - break; - case KM_COMPOSE: - k[0] = XK_Multi_key; - break; - case KM_MODESHIFT: - k[0] = XK_Mode_switch; - k[1] = NoSymbol; - break; - case KM_MODELOCK: - k[0] = XK_Mode_switch; - k[1] = XF86XK_ModeLock; - break; - case KM_SCROLLLOCK: - k[0] = XK_Scroll_Lock; - break; - case KM_CONTROL: - k[0] = XK_Control_R; - break; - } - } - - /* - * compute the modifier map - */ - for (i = 0; i < MAP_LENGTH; i++) - pModMap[i] = NoSymbol; /* make sure it is restored */ - - for (k = map, i = MIN_KEYCODE; - i < (NUM_KEYCODES + MIN_KEYCODE); - i++, k += 4) - - switch(*k) { - - case XK_Shift_L: - case XK_Shift_R: - pModMap[i] = ShiftMask; - break; - - case XK_Control_L: - case XK_Control_R: - pModMap[i] = ControlMask; - break; - - case XK_Caps_Lock: - pModMap[i] = LockMask; - break; - - case XK_Alt_L: - case XK_Alt_R: - pModMap[i] = AltMask; - break; - - case XK_Num_Lock: - if (!xf86Info.serverNumLock) pModMap[i] = NumLockMask; - break; - - case XK_Scroll_Lock: - pModMap[i] = ScrollLockMask; - break; - - /* kana support */ - case XK_Kana_Lock: - case XK_Kana_Shift: - pModMap[i] = KanaMask; - break; - - /* alternate toggle for multinational support */ - case XK_Mode_switch: - pModMap[i] = AltLangMask; - break; - - } - - xf86Info.kbdType = - ioctl(xf86Info.kbdFd, KDGKBDTYPE, &type) != -1 ? type : KB_VANILLAKB; - - pKeySyms->map = map; - pKeySyms->mapWidth = GLYPHS_PER_KEY; - pKeySyms->minKeyCode = MIN_KEYCODE; - if (xf86Info.serverNumLock) - pKeySyms->maxKeyCode = MAX_KEYCODE; - else - pKeySyms->maxKeyCode = MAX_STD_KEYCODE; - -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Keymap.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Keymap.h deleted file mode 100644 index f0998ba9b..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Keymap.h +++ /dev/null @@ -1,455 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.20 2003/08/24 17:36:53 dawes Exp $ */ - -/* - * Copyright (c) 1994-2002 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * - * For Scancodes see notes in atKeynames.h !!!! - * - */ -/* $XConsortium: xf86Keymap.h /main/14 1996/02/21 17:38:47 kaleb $ */ - -static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = { - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#if !defined(__SOL8__) && (!defined(sun) || defined(i386)) - - /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol, - /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol, - /* 0x03 */ XK_2, XK_at, NoSymbol, NoSymbol, - /* 0x04 */ XK_3, XK_numbersign, NoSymbol, NoSymbol, - /* 0x05 */ XK_4, XK_dollar, NoSymbol, NoSymbol, - /* 0x06 */ XK_5, XK_percent, NoSymbol, NoSymbol, - /* 0x07 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol, - /* 0x08 */ XK_7, XK_ampersand, NoSymbol, NoSymbol, - /* 0x09 */ XK_8, XK_asterisk, NoSymbol, NoSymbol, - /* 0x0a */ XK_9, XK_parenleft, NoSymbol, NoSymbol, - /* 0x0b */ XK_0, XK_parenright, NoSymbol, NoSymbol, - /* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol, - /* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol, - /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, - /* 0x0f */ XK_Tab, XK_ISO_Left_Tab,NoSymbol, NoSymbol, - /* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol, - /* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol, - /* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol, - /* 0x13 */ XK_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x14 */ XK_T, NoSymbol, NoSymbol, NoSymbol, - /* 0x15 */ XK_Y, NoSymbol, NoSymbol, NoSymbol, - /* 0x16 */ XK_U, NoSymbol, NoSymbol, NoSymbol, - /* 0x17 */ XK_I, NoSymbol, NoSymbol, NoSymbol, - /* 0x18 */ XK_O, NoSymbol, NoSymbol, NoSymbol, - /* 0x19 */ XK_P, NoSymbol, NoSymbol, NoSymbol, - /* 0x1a */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, - /* 0x1b */ XK_bracketright,XK_braceright, NoSymbol, NoSymbol, - /* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol, - /* 0x1d */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x1e */ XK_A, NoSymbol, NoSymbol, NoSymbol, - /* 0x1f */ XK_S, NoSymbol, NoSymbol, NoSymbol, - /* 0x20 */ XK_D, NoSymbol, NoSymbol, NoSymbol, - /* 0x21 */ XK_F, NoSymbol, NoSymbol, NoSymbol, - /* 0x22 */ XK_G, NoSymbol, NoSymbol, NoSymbol, - /* 0x23 */ XK_H, NoSymbol, NoSymbol, NoSymbol, - /* 0x24 */ XK_J, NoSymbol, NoSymbol, NoSymbol, - /* 0x25 */ XK_K, NoSymbol, NoSymbol, NoSymbol, - /* 0x26 */ XK_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x27 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol, - /* 0x28 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol, - /* 0x29 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol, - /* 0x2a */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x2b */ XK_backslash, XK_bar, NoSymbol, NoSymbol, - /* 0x2c */ XK_Z, NoSymbol, NoSymbol, NoSymbol, - /* 0x2d */ XK_X, NoSymbol, NoSymbol, NoSymbol, - /* 0x2e */ XK_C, NoSymbol, NoSymbol, NoSymbol, - /* 0x2f */ XK_V, NoSymbol, NoSymbol, NoSymbol, - /* 0x30 */ XK_B, NoSymbol, NoSymbol, NoSymbol, - /* 0x31 */ XK_N, NoSymbol, NoSymbol, NoSymbol, - /* 0x32 */ XK_M, NoSymbol, NoSymbol, NoSymbol, - /* 0x33 */ XK_comma, XK_less, NoSymbol, NoSymbol, - /* 0x34 */ XK_period, XK_greater, NoSymbol, NoSymbol, - /* 0x35 */ XK_slash, XK_question, NoSymbol, NoSymbol, - /* 0x36 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x37 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, - /* 0x38 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol, - /* 0x39 */ XK_space, NoSymbol, NoSymbol, NoSymbol, - /* 0x3a */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, - /* 0x3b */ XK_F1, NoSymbol, NoSymbol, NoSymbol, - /* 0x3c */ XK_F2, NoSymbol, NoSymbol, NoSymbol, - /* 0x3d */ XK_F3, NoSymbol, NoSymbol, NoSymbol, - /* 0x3e */ XK_F4, NoSymbol, NoSymbol, NoSymbol, - /* 0x3f */ XK_F5, NoSymbol, NoSymbol, NoSymbol, - /* 0x40 */ XK_F6, NoSymbol, NoSymbol, NoSymbol, - /* 0x41 */ XK_F7, NoSymbol, NoSymbol, NoSymbol, - /* 0x42 */ XK_F8, NoSymbol, NoSymbol, NoSymbol, - /* 0x43 */ XK_F9, NoSymbol, NoSymbol, NoSymbol, - /* 0x44 */ XK_F10, NoSymbol, NoSymbol, NoSymbol, - /* 0x45 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, - /* 0x46 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, - /* 0x47 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, - /* 0x48 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, - /* 0x49 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, - /* 0x4a */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, - /* 0x4b */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, - /* 0x4c */ XK_KP_Begin, XK_KP_5, NoSymbol, NoSymbol, - /* 0x4d */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, - /* 0x4e */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, - /* 0x4f */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, - /* 0x50 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, - /* 0x51 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, - /* 0x52 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, - /* 0x53 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, - /* 0x54 */ XK_Sys_Req, NoSymbol, NoSymbol, NoSymbol, - /* 0x55 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol, - /* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol, - /* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol, - /* 0x59 */ XK_Home, NoSymbol, NoSymbol, NoSymbol, - /* 0x5a */ XK_Up, NoSymbol, NoSymbol, NoSymbol, - /* 0x5b */ XK_Prior, NoSymbol, NoSymbol, NoSymbol, - /* 0x5c */ XK_Left, NoSymbol, NoSymbol, NoSymbol, - /* 0x5d */ XK_Begin, NoSymbol, NoSymbol, NoSymbol, - /* 0x5e */ XK_Right, NoSymbol, NoSymbol, NoSymbol, - /* 0x5f */ XK_End, NoSymbol, NoSymbol, NoSymbol, - /* 0x60 */ XK_Down, NoSymbol, NoSymbol, NoSymbol, - /* 0x61 */ XK_Next, NoSymbol, NoSymbol, NoSymbol, - /* 0x62 */ XK_Insert, NoSymbol, NoSymbol, NoSymbol, - /* 0x63 */ XK_Delete, NoSymbol, NoSymbol, NoSymbol, - /* 0x64 */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, - /* 0x65 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x66 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol, - /* 0x67 */ XK_Print, NoSymbol, NoSymbol, NoSymbol, - /* 0x68 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, - /* 0x69 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol, - /* 0x6a */ XK_Break, NoSymbol, NoSymbol, NoSymbol, - /* 0x6b */ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x6c */ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x6d */ XK_Menu, NoSymbol, NoSymbol, NoSymbol, - /* 0x6e */ XK_F13, NoSymbol, NoSymbol, NoSymbol, - /* 0x6f */ XK_F14, NoSymbol, NoSymbol, NoSymbol, - /* 0x70 */ XK_F15, NoSymbol, NoSymbol, NoSymbol, - /* 0x71 */ XK_F16, NoSymbol, NoSymbol, NoSymbol, - /* 0x72 */ XK_F17, NoSymbol, NoSymbol, NoSymbol, - /* 0x73 */ XK_backslash, XK_underscore, NoSymbol, NoSymbol, - /* 0x74 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x77 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x79 */ XK_Henkan, XK_Mode_switch, NoSymbol, NoSymbol, - /* 0x7a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7b */ XK_Muhenkan, NoSymbol, NoSymbol, NoSymbol, - /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7d */ XK_backslash, XK_bar, NoSymbol, NoSymbol, - /* 0x7e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - -#else /* SunOS */ - -/* Assumes a US English keyboard as default - sorry 'bout that - * - * Hopefully it'll be enough someone can have a sorta working - * keyboard, if they're not using XKB - * - * DWH 9/12/99 - */ - - /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x01 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol, - /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol, - /* 0x03 */ XK_2, XK_at, NoSymbol, NoSymbol, - /* 0x04 */ XK_3, XK_numbersign, NoSymbol, NoSymbol, - /* 0x05 */ XK_4, XK_dollar, NoSymbol, NoSymbol, - /* 0x06 */ XK_5, XK_percent, NoSymbol, NoSymbol, - /* 0x07 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol, - /* 0x08 */ XK_7, XK_ampersand, NoSymbol, NoSymbol, - /* 0x09 */ XK_8, XK_asterisk, NoSymbol, NoSymbol, - /* 0x0a */ XK_9, XK_parenleft, NoSymbol, NoSymbol, - /* 0x0b */ XK_0, XK_parenright, NoSymbol, NoSymbol, - /* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol, - /* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol, - /* 0x0e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x0f */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, - /* 0x10 */ XK_Tab, NoSymbol, NoSymbol, NoSymbol, - /* 0x11 */ XK_Q, NoSymbol, NoSymbol, NoSymbol, - /* 0x12 */ XK_W, NoSymbol, NoSymbol, NoSymbol, - /* 0x13 */ XK_E, NoSymbol, NoSymbol, NoSymbol, - /* 0x14 */ XK_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x15 */ XK_T, NoSymbol, NoSymbol, NoSymbol, - /* 0x16 */ XK_Y, NoSymbol, NoSymbol, NoSymbol, - /* 0x17 */ XK_U, NoSymbol, NoSymbol, NoSymbol, - /* 0x18 */ XK_I, NoSymbol, NoSymbol, NoSymbol, - /* 0x19 */ XK_O, NoSymbol, NoSymbol, NoSymbol, - /* 0x1a */ XK_P, NoSymbol, NoSymbol, NoSymbol, - /* 0x1b */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, - /* 0x1c */ XK_bracketright,XK_braceright, NoSymbol, NoSymbol, - /* 0x1d */ XK_backslash, XK_bar, NoSymbol, NoSymbol, - /* 0x1e */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, - /* 0x1f */ XK_A, NoSymbol, NoSymbol, NoSymbol, - /* 0x20 */ XK_S, NoSymbol, NoSymbol, NoSymbol, - /* 0x21 */ XK_D, NoSymbol, NoSymbol, NoSymbol, - /* 0x22 */ XK_F, NoSymbol, NoSymbol, NoSymbol, - /* 0x23 */ XK_G, NoSymbol, NoSymbol, NoSymbol, - /* 0x24 */ XK_H, NoSymbol, NoSymbol, NoSymbol, - /* 0x25 */ XK_J, NoSymbol, NoSymbol, NoSymbol, - /* 0x26 */ XK_K, NoSymbol, NoSymbol, NoSymbol, - /* 0x27 */ XK_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x28 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol, - /* 0x29 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol, - /* 0x2a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x2b */ XK_Return, NoSymbol, NoSymbol, NoSymbol, - /* 0x2c */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x2d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x2e */ XK_Z, NoSymbol, NoSymbol, NoSymbol, - /* 0x2f */ XK_X, NoSymbol, NoSymbol, NoSymbol, - /* 0x30 */ XK_C, NoSymbol, NoSymbol, NoSymbol, - /* 0x31 */ XK_V, NoSymbol, NoSymbol, NoSymbol, - /* 0x32 */ XK_B, NoSymbol, NoSymbol, NoSymbol, - /* 0x33 */ XK_N, NoSymbol, NoSymbol, NoSymbol, - /* 0x34 */ XK_M, NoSymbol, NoSymbol, NoSymbol, - /* 0x35 */ XK_comma, XK_less, NoSymbol, NoSymbol, - /* 0x36 */ XK_period, XK_greater, NoSymbol, NoSymbol, - /* 0x37 */ XK_slash, XK_question, NoSymbol, NoSymbol, - /* 0x38 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x39 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x3a */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x3b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x3c */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol, - /* 0x3d */ XK_space, NoSymbol, NoSymbol, NoSymbol, - /* 0x3e */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol, - /* 0x3f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x40 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x41 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x42 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x43 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x44 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x45 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x46 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x47 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x48 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x49 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x4a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x4b */ XK_Insert, NoSymbol, NoSymbol, NoSymbol, - /* 0x4c */ XK_Delete, NoSymbol, NoSymbol, NoSymbol, - /* 0x4d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x4e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x4f */ XK_Left, NoSymbol, NoSymbol, NoSymbol, - /* 0x50 */ XK_Home, NoSymbol, NoSymbol, NoSymbol, - /* 0x51 */ XK_End, NoSymbol, NoSymbol, NoSymbol, - /* 0x52 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x53 */ XK_Up, NoSymbol, NoSymbol, NoSymbol, - /* 0x54 */ XK_Down, NoSymbol, NoSymbol, NoSymbol, - /* 0x55 */ XK_Prior, NoSymbol, NoSymbol, NoSymbol, - /* 0x56 */ XK_Next, NoSymbol, NoSymbol, NoSymbol, - /* 0x57 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x58 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x59 */ XK_Right, NoSymbol, NoSymbol, NoSymbol, - /* 0x5a */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, - /* 0x5b */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, - /* 0x5c */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, - /* 0x5d */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, - /* 0x5e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5f */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, - /* 0x60 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, - /* 0x61 */ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, - /* 0x62 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, - /* 0x63 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, - /* 0x64 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, - /* 0x65 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, - /* 0x66 */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, - /* 0x67 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, - /* 0x68 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, - /* 0x69 */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, - /* 0x6a */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, - /* 0x6b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x6c */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, - /* 0x6d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x6e */ XK_Escape, NoSymbol, NoSymbol, NoSymbol, - /* 0x6f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x70 */ XK_F1, NoSymbol, NoSymbol, NoSymbol, - /* 0x71 */ XK_F2, NoSymbol, NoSymbol, NoSymbol, - /* 0x72 */ XK_F3, NoSymbol, NoSymbol, NoSymbol, - /* 0x73 */ XK_F4, NoSymbol, NoSymbol, NoSymbol, - /* 0x74 */ XK_F5, NoSymbol, NoSymbol, NoSymbol, - /* 0x75 */ XK_F6, NoSymbol, NoSymbol, NoSymbol, - /* 0x76 */ XK_F7, NoSymbol, NoSymbol, NoSymbol, - /* 0x77 */ XK_F8, NoSymbol, NoSymbol, NoSymbol, - /* 0x78 */ XK_F9, NoSymbol, NoSymbol, NoSymbol, - /* 0x79 */ XK_F10, NoSymbol, NoSymbol, NoSymbol, - /* 0x7a */ XK_F11, NoSymbol, NoSymbol, NoSymbol, - /* 0x7b */ XK_F12, NoSymbol, NoSymbol, NoSymbol, - /* 0x7c */ XK_Print, NoSymbol, NoSymbol, NoSymbol, - /* 0x7d */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, - /* 0x7e */ XK_Pause, NoSymbol, NoSymbol, NoSymbol, - /* 0x7f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - -#endif /* SunOS */ - -}; - -#if !defined(Lynx) && \ - !defined(__UNIXOS2__) && \ - !defined(__mips__) && \ - !defined(linux) && \ - !defined(CSRG_BASED) && \ - !defined(__CYGWIN__) && \ - !defined(__SOL8__) && \ - (!defined(sun) || defined(i386)) - -static KeySym map84[NUM_KEYCODES * GLYPHS_PER_KEY] = { - /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol, - /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol, - /* 0x03 */ XK_2, XK_at, NoSymbol, NoSymbol, - /* 0x04 */ XK_3, XK_numbersign, NoSymbol, NoSymbol, - /* 0x05 */ XK_4, XK_dollar, NoSymbol, NoSymbol, - /* 0x06 */ XK_5, XK_percent, NoSymbol, NoSymbol, - /* 0x07 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol, - /* 0x08 */ XK_7, XK_ampersand, NoSymbol, NoSymbol, - /* 0x09 */ XK_8, XK_asterisk, NoSymbol, NoSymbol, - /* 0x0a */ XK_9, XK_parenleft, NoSymbol, NoSymbol, - /* 0x0b */ XK_0, XK_parenright, NoSymbol, NoSymbol, - /* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol, - /* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol, - /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, - /* 0x0f */ XK_Tab, NoSymbol, NoSymbol, NoSymbol, - /* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol, - /* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol, - /* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol, - /* 0x13 */ XK_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x14 */ XK_T, NoSymbol, NoSymbol, NoSymbol, - /* 0x15 */ XK_Y, NoSymbol, NoSymbol, NoSymbol, - /* 0x16 */ XK_U, NoSymbol, NoSymbol, NoSymbol, - /* 0x17 */ XK_I, NoSymbol, NoSymbol, NoSymbol, - /* 0x18 */ XK_O, NoSymbol, NoSymbol, NoSymbol, - /* 0x19 */ XK_P, NoSymbol, NoSymbol, NoSymbol, - /* 0x1a */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, - /* 0x1b */ XK_bracketright,XK_braceright, NoSymbol, NoSymbol, - /* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol, - /* 0x1d */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x1e */ XK_A, NoSymbol, NoSymbol, NoSymbol, - /* 0x1f */ XK_S, NoSymbol, NoSymbol, NoSymbol, - /* 0x20 */ XK_D, NoSymbol, NoSymbol, NoSymbol, - /* 0x21 */ XK_F, NoSymbol, NoSymbol, NoSymbol, - /* 0x22 */ XK_G, NoSymbol, NoSymbol, NoSymbol, - /* 0x23 */ XK_H, NoSymbol, NoSymbol, NoSymbol, - /* 0x24 */ XK_J, NoSymbol, NoSymbol, NoSymbol, - /* 0x25 */ XK_K, NoSymbol, NoSymbol, NoSymbol, - /* 0x26 */ XK_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x27 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol, - /* 0x28 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol, - /* 0x29 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol, - /* 0x2a */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x2b */ XK_backslash, XK_bar, NoSymbol, NoSymbol, - /* 0x2c */ XK_Z, NoSymbol, NoSymbol, NoSymbol, - /* 0x2d */ XK_X, NoSymbol, NoSymbol, NoSymbol, - /* 0x2e */ XK_C, NoSymbol, NoSymbol, NoSymbol, - /* 0x2f */ XK_V, NoSymbol, NoSymbol, NoSymbol, - /* 0x30 */ XK_B, NoSymbol, NoSymbol, NoSymbol, - /* 0x31 */ XK_N, NoSymbol, NoSymbol, NoSymbol, - /* 0x32 */ XK_M, NoSymbol, NoSymbol, NoSymbol, - /* 0x33 */ XK_comma, XK_less, NoSymbol, NoSymbol, - /* 0x34 */ XK_period, XK_greater, NoSymbol, NoSymbol, - /* 0x35 */ XK_slash, XK_question, NoSymbol, NoSymbol, - /* 0x36 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x37 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, - /* 0x38 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol, - /* 0x39 */ XK_space, NoSymbol, NoSymbol, NoSymbol, - /* 0x3a */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, - /* 0x3b */ XK_F1, NoSymbol, NoSymbol, NoSymbol, - /* 0x3c */ XK_F2, NoSymbol, NoSymbol, NoSymbol, - /* 0x3d */ XK_F3, NoSymbol, NoSymbol, NoSymbol, - /* 0x3e */ XK_F4, NoSymbol, NoSymbol, NoSymbol, - /* 0x3f */ XK_F5, NoSymbol, NoSymbol, NoSymbol, - /* 0x40 */ XK_F6, NoSymbol, NoSymbol, NoSymbol, - /* 0x41 */ XK_F7, NoSymbol, NoSymbol, NoSymbol, - /* 0x42 */ XK_F8, NoSymbol, NoSymbol, NoSymbol, - /* 0x43 */ XK_F9, NoSymbol, NoSymbol, NoSymbol, - /* 0x44 */ XK_F10, NoSymbol, NoSymbol, NoSymbol, - /* 0x45 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, - /* 0x46 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, - /* 0x47 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, - /* 0x48 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, - /* 0x49 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, - /* 0x4a */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, - /* 0x4b */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, - /* 0x4c */ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, - /* 0x4d */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, - /* 0x4e */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, - /* 0x4f */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, - /* 0x50 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, - /* 0x51 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, - /* 0x52 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, - /* 0x53 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, - /* 0x54 */ XK_Sys_Req, NoSymbol, NoSymbol, NoSymbol, - /* 0x55 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol, - /* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol, - /* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol, - /* 0x59 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x60 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x61 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x62 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x63 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x64 */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, - /* 0x65 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x66 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol, - /* 0x67 */ XK_Print, NoSymbol, NoSymbol, NoSymbol, - /* 0x68 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, - /* 0x69 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol, - /* 0x6a */ XK_Break, NoSymbol, NoSymbol, NoSymbol, - /* 0x6b */ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x6c */ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x6d */ XK_Menu, NoSymbol, NoSymbol, NoSymbol, - /* 0x6e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x6f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x70 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x71 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x72 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x73 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x74 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x77 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x79 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, -}; -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86MiscExt.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86MiscExt.c deleted file mode 100644 index de4802744..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86MiscExt.c +++ /dev/null @@ -1,660 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86MiscExt.c,v 1.16 2003/11/03 05:11:02 tsi Exp $ */ -/* - * Copyright (c) 1999-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * This file contains the Pointer/Keyboard functions needed by the - * XFree86-Misc extension. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifdef __UNIXOS2__ -#define I_NEED_OS2_H -#endif - -#include -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" - -#ifdef XF86MISC -#define _XF86MISC_SERVER_ -#include -#include "xf86miscproc.h" -#endif - -#define XF86_OS_PRIVS -#include "xf86_OSlib.h" - -#ifdef XINPUT -#include -#include -#include "xf86Xinput.h" -#else -#include "inputstr.h" -#endif - -#include "xf86OSmouse.h" - -#ifdef DEBUG -# define DEBUG_P(x) ErrorF(x"\n"); -#else -# define DEBUG_P(x) /**/ -#endif - -#ifdef XF86MISC - -typedef struct { - int type; - int baudrate; - int samplerate; - int resolution; - int buttons; - Bool em3buttons; - int em3timeout; - Bool chordmiddle; - int flags; - char* device; - pointer private; -} mseParamsRec, *mseParamsPtr; - -typedef struct { - int type; - int rate; - int delay; - int serverNumLock; /* obsolete */ -} kbdParamsRec, *kbdParamsPtr; - -/* - Sigh... - - The extension should probably be changed to use protocol - names instead of ID numbers -*/ -static struct mouse_map { - int mtype; - MouseProtocolID proto; -} m_map[] = -{ - { MTYPE_MICROSOFT, PROT_MS }, - { MTYPE_MOUSESYS, PROT_MSC }, - { MTYPE_MMSERIES, PROT_MM }, - { MTYPE_LOGITECH, PROT_LOGI }, - { MTYPE_LOGIMAN, PROT_LOGIMAN }, - { MTYPE_MMHIT, PROT_MMHIT }, - { MTYPE_GLIDEPOINT, PROT_GLIDE }, - { MTYPE_IMSERIAL, PROT_IMSERIAL }, - { MTYPE_THINKING, PROT_THINKING }, - { MTYPE_ACECAD, PROT_ACECAD }, - { MTYPE_PS_2, PROT_PS2 }, - { MTYPE_IMPS2, PROT_IMPS2 }, - { MTYPE_EXPPS2, PROT_EXPPS2 }, - { MTYPE_THINKINGPS2, PROT_THINKPS2 }, - { MTYPE_MMANPLUSPS2, PROT_MMPS2 }, - { MTYPE_GLIDEPOINTPS2, PROT_GLIDEPS2 }, - { MTYPE_NETPS2, PROT_NETPS2 }, - { MTYPE_NETSCROLLPS2, PROT_NETSCPS2 }, - { MTYPE_BUSMOUSE, PROT_BM }, - { MTYPE_AUTOMOUSE, PROT_AUTO }, - { MTYPE_SYSMOUSE, PROT_SYSMOUSE }, - { MTYPE_UNKNOWN, PROT_UNKNOWN } -}; - -static int -MapMseProtoToMisc(MouseProtocolID proto) -{ - int i; - - for (i = 0; m_map[i].proto != PROT_UNKNOWN; i++) - if (proto == m_map[i].proto) - return m_map[i].mtype; - - return MTYPE_UNKNOWN; -} - -static MouseProtocolID -MapMseMiscToProto(int proto) -{ - int i; - - for (i = 0; m_map[i].mtype != MTYPE_UNKNOWN; i++) - if (proto == m_map[i].mtype) - return m_map[i].proto; - - return PROT_UNKNOWN; -} - -Bool -MiscExtGetMouseSettings(pointer *mouse, char **devname) -{ - mseParamsPtr mseptr; - - DEBUG_P("MiscExtGetMouseSettings"); - - mseptr = MiscExtCreateStruct(MISC_POINTER); - if (!mseptr) - return FALSE; - - { - InputInfoPtr pInfo = mseptr->private; - MouseDevPtr pMse; - - *devname = xf86FindOptionValue(pInfo->options, "Device"); - pMse = pInfo->private; - - mseptr->type = MapMseProtoToMisc(pMse->protocolID); - mseptr->baudrate = pMse->baudRate; - mseptr->samplerate = pMse->sampleRate; - mseptr->resolution = pMse->resolution; - mseptr->buttons = pMse->buttons; - mseptr->em3buttons = pMse->emulate3Buttons; - mseptr->em3timeout = pMse->emulate3Timeout; - mseptr->chordmiddle = pMse->chordMiddle; - mseptr->flags = pMse->mouseFlags; - } - *mouse = mseptr; - return TRUE; -} - -int -MiscExtGetMouseValue(pointer mouse, MiscExtMseValType valtype) -{ - mseParamsPtr mse = mouse; - - DEBUG_P("MiscExtGetMouseValue"); - - switch (valtype) { - case MISC_MSE_PROTO: return mse->type; - case MISC_MSE_BAUDRATE: return mse->baudrate; - case MISC_MSE_SAMPLERATE: return mse->samplerate; - case MISC_MSE_RESOLUTION: return mse->resolution; - case MISC_MSE_BUTTONS: return mse->buttons; - case MISC_MSE_EM3BUTTONS: return mse->em3buttons; - case MISC_MSE_EM3TIMEOUT: return mse->em3timeout; - case MISC_MSE_CHORDMIDDLE: return mse->chordmiddle; - case MISC_MSE_FLAGS: return mse->flags; - } - return 0; -} - -Bool -MiscExtSetMouseValue(pointer mouse, MiscExtMseValType valtype, int value) -{ - mseParamsPtr mse = mouse; - - DEBUG_P("MiscExtSetMouseValue"); - - switch (valtype) { - case MISC_MSE_PROTO: - mse->type = value; - return TRUE; - case MISC_MSE_BAUDRATE: - mse->baudrate = value; - return TRUE; - case MISC_MSE_SAMPLERATE: - mse->samplerate = value; - return TRUE; - case MISC_MSE_RESOLUTION: - mse->resolution = value; - return TRUE; - case MISC_MSE_BUTTONS: - mse->buttons = value; - return TRUE; - case MISC_MSE_EM3BUTTONS: - mse->em3buttons = value; - return TRUE; - case MISC_MSE_EM3TIMEOUT: - mse->em3timeout = value; - return TRUE; - case MISC_MSE_CHORDMIDDLE: - mse->chordmiddle = value; - return TRUE; - case MISC_MSE_FLAGS: - mse->flags = value; - return TRUE; - } - return FALSE; -} - -Bool -MiscExtSetMouseDevice(pointer mouse, char* device) -{ - mseParamsPtr mse = mouse; - - mse->device = device; - - return TRUE; -} - -Bool -MiscExtGetKbdSettings(pointer *kbd) -{ - kbdParamsPtr kbdptr; - - DEBUG_P("MiscExtGetKbdSettings"); - - kbdptr = MiscExtCreateStruct(MISC_KEYBOARD); - if (!kbdptr) - return FALSE; - kbdptr->type = xf86Info.kbdType; - kbdptr->rate = xf86Info.kbdRate; - kbdptr->delay = xf86Info.kbdDelay; - *kbd = kbdptr; - return TRUE; -} - -int -MiscExtGetKbdValue(pointer keyboard, MiscExtKbdValType valtype) -{ - kbdParamsPtr kbd = keyboard; - - DEBUG_P("MiscExtGetKbdValue"); - switch (valtype) { - case MISC_KBD_TYPE: return kbd->type; - case MISC_KBD_RATE: return kbd->rate; - case MISC_KBD_DELAY: return kbd->delay; - case MISC_KBD_SERVNUMLOCK: return 0; - } - return 0; -} - -Bool -MiscExtSetKbdValue(pointer keyboard, MiscExtKbdValType valtype, int value) -{ - kbdParamsPtr kbd = keyboard; - - DEBUG_P("MiscExtSetKbdValue"); - switch (valtype) { - case MISC_KBD_TYPE: - kbd->type = value; - return TRUE; - case MISC_KBD_RATE: - kbd->rate = value; - return TRUE; - case MISC_KBD_DELAY: - kbd->delay = value; - return TRUE; - case MISC_KBD_SERVNUMLOCK: - return TRUE; - } - return FALSE; -} - -static void -MiscExtClientStateCallback(CallbackListPtr *callbacks, - pointer data, pointer args) -{ - NewClientInfoRec *clientinfo = (NewClientInfoRec*)args; - - if (clientinfo->client == xf86Info.grabInfo.override && - clientinfo->client->clientState == ClientStateGone) { - xf86Info.grabInfo.override = NULL; - xf86Info.grabInfo.disabled = 0; - DeleteCallback(&ClientStateCallback, MiscExtClientStateCallback, NULL); - } -} - -#define MiscExtGrabStateSuccess 0 /* No errors */ -#define MiscExtGrabStateLocked 1 /* A client already requested that - * grabs cannot be removed/killed */ -#define MiscExtGrabStateAlready 2 /* Request for enabling/disabling - * grab removeal/kill already done */ -int -MiscExtSetGrabKeysState(ClientPtr client, int state) -{ - DEBUG_P("MiscExtSetGrabKeysState"); - - if (xf86Info.grabInfo.override == NULL || - xf86Info.grabInfo.override == client) { - if (state == 0 && xf86Info.grabInfo.disabled == 0) { - xf86Info.grabInfo.disabled = 1; - AddCallback(&ClientStateCallback, - MiscExtClientStateCallback, NULL); - xf86Info.grabInfo.override = client; - } - else if (state == 1 && xf86Info.grabInfo.disabled == 1) { - xf86Info.grabInfo.disabled = 0; - DeleteCallback(&ClientStateCallback, - MiscExtClientStateCallback, NULL); - xf86Info.grabInfo.override = NULL; - } - else - return MiscExtGrabStateAlready; - - return MiscExtGrabStateSuccess; - } - - return MiscExtGrabStateLocked; -} - -pointer -MiscExtCreateStruct(MiscExtStructType mse_or_kbd) -{ - DEBUG_P("MiscExtCreateStruct"); - - switch (mse_or_kbd) { - case MISC_POINTER: - { - mseParamsPtr mseptr; - InputInfoPtr pInfo = xf86InputDevs; - - while (pInfo) { - if (xf86IsCorePointer(pInfo->dev)) - break; - pInfo = pInfo->next; - } - if (!pInfo) - return NULL; - - mseptr = xcalloc(sizeof(mseParamsRec),1); - if (mseptr) - mseptr->private = pInfo; - return mseptr; - } - case MISC_KEYBOARD: - return xcalloc(sizeof(kbdParamsRec),1); - } - return 0; -} - -void -MiscExtDestroyStruct(pointer structure, MiscExtStructType mse_or_kbd) -{ - DEBUG_P("MiscExtDestroyStruct"); - - switch (mse_or_kbd) { - case MISC_POINTER: - case MISC_KEYBOARD: - xfree(structure); - } -} - -static Bool -MiscExtAuthorizeDevice(InputInfoPtr pInfo, char *device) -{ - Bool authorized = FALSE; - char *elem; - struct stat dev, dev_list; - const char *olddev = xf86FindOptionValue(pInfo->options, "Device"); - - if (stat(device,&dev)) - return FALSE; - - if (!S_ISCHR(dev.st_mode)) - return FALSE; - - if (!stat(olddev,&dev_list)) { - if (dev_list.st_dev == dev.st_dev - && dev_list.st_ino == dev.st_ino) { - authorized = TRUE; - } - } - - if (!authorized) { - char *path; - - if (!xf86InputDeviceList - || (path = strdup(xf86InputDeviceList)) == NULL) - return FALSE; - - elem = strtok(path,","); - - while (elem) { - - if (!stat(elem,&dev_list)) { - if (dev_list.st_dev == dev.st_dev - && dev_list.st_ino == dev.st_ino) { - authorized = TRUE; - break; - - } - } - elem = strtok(NULL,","); - } - xfree(path); - } -#if 0 - ErrorF("AUTHORIZED: %s\n",authorized?"Yes":"No"); -#endif - return (authorized); -} - -MiscExtReturn -MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd) -{ - DEBUG_P("MiscExtApply"); - - if (mse_or_kbd == MISC_POINTER) { - Bool protoChanged = FALSE; - int oldflags; - Bool reopen = FALSE; - MouseProtocolID newProtocol; - mseParamsPtr mse = structure; - InputInfoPtr pInfo; - MouseDevPtr pMse; -#ifdef XFree86LOADER - pointer xf86MouseProtocolIDToName - = LoaderSymbol("xf86MouseProtocolIDToName"); - if (!xf86MouseProtocolIDToName) - return MISC_RET_NOMODULE; -#endif - if (mse->type < MTYPE_MICROSOFT - || ( mse->type > MTYPE_EXPPS2 - && (mse->type!=MTYPE_OSMOUSE && mse->type!=MTYPE_XQUEUE))) - return MISC_RET_BADMSEPROTO; -#ifdef OSMOUSE_ONLY - if (mse->type != MTYPE_OSMOUSE) - return MISC_RET_BADMSEPROTO; -#else - if (mse->type == MTYPE_XQUEUE) - return MISC_RET_BADMSEPROTO; - if (mse->type == MTYPE_OSMOUSE) - return MISC_RET_BADMSEPROTO; -#endif /* OSMOUSE_ONLY */ - - if (mse->em3timeout < 0) - return MISC_RET_BADVAL; - - if (mse->type == MTYPE_LOGIMAN - && !(mse->baudrate == 0 - || mse->baudrate == 1200 - || mse->baudrate == 9600)) - return MISC_RET_BADBAUDRATE; - if (mse->type == MTYPE_LOGIMAN && mse->samplerate) - return MISC_RET_BADCOMBO; - - if (mse->flags & MF_REOPEN) { - reopen = TRUE; - mse->flags &= ~MF_REOPEN; - } - if (mse->type != MTYPE_OSMOUSE - && mse->type != MTYPE_XQUEUE - && mse->type != MTYPE_PS_2 - && mse->type != MTYPE_BUSMOUSE - && mse->type != MTYPE_IMPS2 - && mse->type != MTYPE_THINKINGPS2 - && mse->type != MTYPE_MMANPLUSPS2 - && mse->type != MTYPE_GLIDEPOINTPS2 - && mse->type != MTYPE_NETPS2 - && mse->type != MTYPE_NETSCROLLPS2 - && mse->type != MTYPE_SYSMOUSE) - { - if (mse->baudrate % 1200 != 0 - || (mse->baudrate != 0 && mse->baudrate < 1200) - || mse->baudrate > 9600) - return MISC_RET_BADBAUDRATE; - } - if ((mse->flags & (MF_CLEAR_DTR|MF_CLEAR_RTS)) - && (mse->type != MTYPE_MOUSESYS)) - return MISC_RET_BADFLAGS; - - if (mse->type != MTYPE_OSMOUSE - && mse->type != MTYPE_XQUEUE - && mse->type != MTYPE_BUSMOUSE) - { - if (mse->samplerate < 0) - return MISC_RET_BADVAL; - } - - if (mse->resolution < 0) - return MISC_RET_BADVAL; - if (mse->chordmiddle) - { - if (mse->em3buttons || !(mse->type == MTYPE_MICROSOFT - || mse->type == MTYPE_LOGIMAN) ) - return MISC_RET_BADCOMBO; - } - - /* XXX - This still needs work */ - - pInfo = mse->private; - pMse = pInfo->private; - oldflags = pMse->mouseFlags; - - newProtocol = MapMseMiscToProto(mse->type); - protoChanged = pMse->protocolID != newProtocol; - if (protoChanged - || pMse->baudRate != mse->baudrate - || pMse->sampleRate != mse->samplerate - || pMse->resolution != mse->resolution - || pMse->mouseFlags != mse->flags) - reopen = TRUE; - - if (mse->device) - reopen = TRUE; - - if (reopen) - (pMse->device->deviceProc)(pMse->device, DEVICE_CLOSE); - - pMse->protocolID = newProtocol; - pMse->baudRate = mse->baudrate; - pMse->sampleRate = mse->samplerate; - pMse->resolution = mse->resolution; - pMse->buttons = mse->buttons; - pMse->emulate3Buttons = mse->em3buttons; - pMse->emulate3Timeout = mse->em3timeout; - pMse->chordMiddle = mse->chordmiddle; - pMse->mouseFlags = mse->flags; - -#ifdef XFree86LOADER - pMse->protocol = ((const char *(*)(MouseProtocolID)) - xf86MouseProtocolIDToName)(pMse->protocolID); -#else - pMse->protocol = xf86MouseProtocolIDToName(pMse->protocolID); -#endif - - if (mse->device) { - if (MiscExtAuthorizeDevice(pInfo, mse->device)) { - xf86ReplaceStrOption(pInfo->options, "Device", mse->device); - } else { - return MISC_RET_BADVAL; - } - } - - if (reopen) { - /* Only if protocol is changed explicitely disable auto detect */ - if (protoChanged) - pMse->autoProbe = FALSE; - (pMse->device->deviceProc)(pMse->device, DEVICE_ON); - } - /* Set pInfo->options too */ - - if ((oldflags & MF_CLEAR_DTR) != (pMse->mouseFlags & MF_CLEAR_DTR)) - xf86ReplaceBoolOption(pInfo->options, "ClearDTR", - pMse->mouseFlags | MF_CLEAR_DTR); - if ((oldflags & MF_CLEAR_RTS) != (pMse->mouseFlags & MF_CLEAR_RTS)) - xf86ReplaceBoolOption(pInfo->options, "ClearRTS", - pMse->mouseFlags | MF_CLEAR_RTS); - } - if (mse_or_kbd == MISC_KEYBOARD) { - kbdParamsPtr kbd = structure; - - if (kbd->rate < 0) - return MISC_RET_BADVAL; - if (kbd->delay < 0) - return MISC_RET_BADVAL; - if (kbd->type < KTYPE_UNKNOWN || kbd->type > KTYPE_XQUEUE) - return MISC_RET_BADKBDTYPE; - - if (xf86Info.kbdRate!=kbd->rate || xf86Info.kbdDelay!=kbd->delay) { - char rad; - - xf86Info.kbdRate = kbd->rate; - xf86Info.kbdDelay = kbd->delay; - if (xf86Info.kbdDelay <= 375) rad = 0x00; - else if (xf86Info.kbdDelay <= 625) rad = 0x20; - else if (xf86Info.kbdDelay <= 875) rad = 0x40; - else rad = 0x60; - - if (xf86Info.kbdRate <= 2) rad |= 0x1F; - else if (xf86Info.kbdRate >= 30) rad |= 0x00; - else rad |= ((58/xf86Info.kbdRate)-2); - - xf86SetKbdRepeat(rad); - } -#if 0 /* Not done yet */ - xf86Info.kbdType = kbd->kbdtype; -#endif - } - return MISC_RET_SUCCESS; -} - -Bool -MiscExtGetFilePaths(const char **configfile, const char **modulepath, - const char **logfile) -{ - DEBUG_P("MiscExtGetFilePaths"); - - *configfile = xf86ConfigFile; - *modulepath = xf86ModulePath; - *logfile = xf86LogFile; - - return TRUE; -} - -int -MiscExtPassMessage(int scrnIndex, const char *msgtype, const char *msgval, - char **retstr) -{ - ScrnInfoPtr pScr = xf86Screens[scrnIndex]; - - DEBUG_P("MiscExtPassMessage"); - - /* should check this in the protocol, but xf86NumScreens isn't exported */ - if (scrnIndex >= xf86NumScreens) - return BadValue; - - if (*pScr->HandleMessage == NULL) - return BadImplementation; - return (*pScr->HandleMessage)(scrnIndex, msgtype, msgval, retstr); -} - -#endif /* XF86MISC */ - diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Mode.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Mode.c deleted file mode 100644 index 2abbd2213..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Mode.c +++ /dev/null @@ -1,2185 +0,0 @@ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.7 2005/07/03 08:53:42 daniels Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.69 2003/10/08 14:58:28 dawes Exp $ */ -/* - * Copyright (c) 1997-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * Authors: Dirk Hohndel - * David Dawes - * Marc La France - * ... and others - * - * This file includes helper functions for mode related things. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "os.h" -#include "servermd.h" -#include "mibank.h" -#include "globals.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86DDC.h" - -/* - * xf86GetNearestClock -- - * Find closest clock to given frequency (in kHz). This assumes the - * number of clocks is greater than zero. - */ -int -xf86GetNearestClock(ScrnInfoPtr scrp, int freq, Bool allowDiv2, - int DivFactor, int MulFactor, int *divider) -{ - int nearestClock = 0, nearestDiv = 1; - int minimumGap = abs(freq - scrp->clock[0]); - int i, j, k, gap; - - if (allowDiv2) - k = 2; - else - k = 1; - - /* Must set this here in case the best match is scrp->clock[0] */ - if (divider != NULL) - *divider = 0; - - for (i = 0; i < scrp->numClocks; i++) { - for (j = 1; j <= k; j++) { - gap = abs((freq * j) - ((scrp->clock[i] * DivFactor) / MulFactor)); - if ((gap < minimumGap) || - ((gap == minimumGap) && (j < nearestDiv))) { - minimumGap = gap; - nearestClock = i; - nearestDiv = j; - if (divider != NULL) - *divider = (j - 1) * V_CLKDIV2; - } - } - } - return nearestClock; -} - -/* - * xf86ModeStatusToString - * - * Convert a ModeStatus value to a printable message - */ - -const char * -xf86ModeStatusToString(ModeStatus status) -{ - switch (status) { - case MODE_OK: - return "Mode OK"; - case MODE_HSYNC: - return "hsync out of range"; - case MODE_VSYNC: - return "vrefresh out of range"; - case MODE_H_ILLEGAL: - return "illegal horizontal timings"; - case MODE_V_ILLEGAL: - return "illegal vertical timings"; - case MODE_BAD_WIDTH: - return "width requires unsupported line pitch"; - case MODE_NOMODE: - return "no mode of this name"; - case MODE_NO_INTERLACE: - return "interlace mode not supported"; - case MODE_NO_DBLESCAN: - return "doublescan mode not supported"; - case MODE_NO_VSCAN: - return "multiscan mode not supported"; - case MODE_MEM: - return "insufficient memory for mode"; - case MODE_VIRTUAL_X: - return "width too large for virtual size"; - case MODE_VIRTUAL_Y: - return "height too large for virtual size"; - case MODE_MEM_VIRT: - return "insufficient memory given virtual size"; - case MODE_NOCLOCK: - return "no clock available for mode"; - case MODE_CLOCK_HIGH: - return "mode clock too high"; - case MODE_CLOCK_LOW: - return "mode clock too low"; - case MODE_CLOCK_RANGE: - return "bad mode clock/interlace/doublescan"; - case MODE_BAD_HVALUE: - return "horizontal timing out of range"; - case MODE_BAD_VVALUE: - return "vertical timing out of range"; - case MODE_BAD_VSCAN: - return "VScan value out of range"; - case MODE_HSYNC_NARROW: - return "horizontal sync too narrow"; - case MODE_HSYNC_WIDE: - return "horizontal sync too wide"; - case MODE_HBLANK_NARROW: - return "horizontal blanking too narrow"; - case MODE_HBLANK_WIDE: - return "horizontal blanking too wide"; - case MODE_VSYNC_NARROW: - return "vertical sync too narrow"; - case MODE_VSYNC_WIDE: - return "vertical sync too wide"; - case MODE_VBLANK_NARROW: - return "vertical blanking too narrow"; - case MODE_VBLANK_WIDE: - return "vertical blanking too wide"; - case MODE_PANEL: - return "exceeds panel dimensions"; - case MODE_INTERLACE_WIDTH: - return "width too large for interlaced mode"; - case MODE_ONE_WIDTH: - return "all modes must have the same width"; - case MODE_ONE_HEIGHT: - return "all modes must have the same height"; - case MODE_ONE_SIZE: - return "all modes must have the same resolution"; - case MODE_BAD: - return "unknown reason"; - case MODE_ERROR: - return "internal error"; - default: - return "unknown"; - } -} - -/* - * xf86ShowClockRanges() -- Print the clock ranges allowed - * and the clock values scaled by ClockMulFactor and ClockDivFactor - */ -void -xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges) -{ - ClockRangePtr cp; - int MulFactor = 1; - int DivFactor = 1; - int i, j; - int scaledClock; - - for (cp = clockRanges; cp != NULL; cp = cp->next) { - DivFactor = max(1, cp->ClockDivFactor); - MulFactor = max(1, cp->ClockMulFactor); - if (scrp->progClock) { - if (cp->minClock) { - if (cp->maxClock) { - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Clock range: %6.2f to %6.2f MHz\n", - (double)cp->minClock / 1000.0, - (double)cp->maxClock / 1000.0); - } else { - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Minimum clock: %6.2f MHz\n", - (double)cp->minClock / 1000.0); - } - } else { - if (cp->maxClock) { - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Maximum clock: %6.2f MHz\n", - (double)cp->maxClock / 1000.0); - } - } - } else if (DivFactor > 1 || MulFactor > 1) { - j = 0; - for (i = 0; i < scrp->numClocks; i++) { - scaledClock = (scrp->clock[i] * DivFactor) / MulFactor; - if (scaledClock >= cp->minClock && scaledClock <= cp->maxClock) { - if ((j % 8) == 0) { - if (j > 0) - xf86ErrorF("\n"); - xf86DrvMsg(scrp->scrnIndex, X_INFO, "scaled clocks:"); - } - xf86ErrorF(" %6.2f", (double)scaledClock / 1000.0); - j++; - } - } - xf86ErrorF("\n"); - } - } -} - - -/* - * xf86FindClockRangeForMode() [... like the name says ...] - */ -static ClockRangePtr -xf86FindClockRangeForMode(ClockRangePtr clockRanges, DisplayModePtr p) -{ - ClockRangePtr cp; - - for (cp = clockRanges; ; cp = cp->next) - if (!cp || - ((p->Clock >= cp->minClock) && - (p->Clock <= cp->maxClock) && - (cp->interlaceAllowed || !(p->Flags & V_INTERLACE)) && - (cp->doubleScanAllowed || - ((p->VScan <= 1) && !(p->Flags & V_DBLSCAN))))) - return cp; -} - - -/* - * xf86HandleBuiltinMode() - handles built-in modes - */ -static ModeStatus -xf86HandleBuiltinMode(ScrnInfoPtr scrp, - DisplayModePtr p, - DisplayModePtr modep, - ClockRangePtr clockRanges, - Bool allowDiv2) -{ - ClockRangePtr cp; - int extraFlags = 0; - int MulFactor = 1; - int DivFactor = 1; - int clockIndex; - - /* Reject previously rejected modes */ - if (p->status != MODE_OK) - return p->status; - - /* Reject previously considered modes */ - if (p->prev) - return MODE_NOMODE; - - if ((p->type & M_T_CLOCK_C) == M_T_CLOCK_C) { - /* Check clock is in range */ - cp = xf86FindClockRangeForMode(clockRanges, p); - if (cp == NULL){ - modep->type = p->type; - p->status = MODE_CLOCK_RANGE; - return MODE_CLOCK_RANGE; - } - DivFactor = cp->ClockDivFactor; - MulFactor = cp->ClockMulFactor; - if (!scrp->progClock) { - clockIndex = xf86GetNearestClock(scrp, p->Clock, allowDiv2, - cp->ClockDivFactor, - cp->ClockMulFactor, &extraFlags); - modep->Clock = (scrp->clock[clockIndex] * DivFactor) - / MulFactor; - modep->ClockIndex = clockIndex; - modep->SynthClock = scrp->clock[clockIndex]; - if (extraFlags & V_CLKDIV2) { - modep->Clock /= 2; - modep->SynthClock /= 2; - } - } else { - modep->Clock = p->Clock; - modep->ClockIndex = -1; - modep->SynthClock = (modep->Clock * MulFactor) - / DivFactor; - } - modep->PrivFlags = cp->PrivFlags; - } else { - if(!scrp->progClock) { - modep->Clock = p->Clock; - modep->ClockIndex = p->ClockIndex; - modep->SynthClock = p->SynthClock; - } else { - modep->Clock = p->Clock; - modep->ClockIndex = -1; - modep->SynthClock = p->SynthClock; - } - modep->PrivFlags = p->PrivFlags; - } - modep->type = p->type; - modep->HDisplay = p->HDisplay; - modep->HSyncStart = p->HSyncStart; - modep->HSyncEnd = p->HSyncEnd; - modep->HTotal = p->HTotal; - modep->HSkew = p->HSkew; - modep->VDisplay = p->VDisplay; - modep->VSyncStart = p->VSyncStart; - modep->VSyncEnd = p->VSyncEnd; - modep->VTotal = p->VTotal; - modep->VScan = p->VScan; - modep->Flags = p->Flags | extraFlags; - modep->CrtcHDisplay = p->CrtcHDisplay; - modep->CrtcHBlankStart = p->CrtcHBlankStart; - modep->CrtcHSyncStart = p->CrtcHSyncStart; - modep->CrtcHSyncEnd = p->CrtcHSyncEnd; - modep->CrtcHBlankEnd = p->CrtcHBlankEnd; - modep->CrtcHTotal = p->CrtcHTotal; - modep->CrtcHSkew = p->CrtcHSkew; - modep->CrtcVDisplay = p->CrtcVDisplay; - modep->CrtcVBlankStart = p->CrtcVBlankStart; - modep->CrtcVSyncStart = p->CrtcVSyncStart; - modep->CrtcVSyncEnd = p->CrtcVSyncEnd; - modep->CrtcVBlankEnd = p->CrtcVBlankEnd; - modep->CrtcVTotal = p->CrtcVTotal; - modep->CrtcHAdjusted = p->CrtcHAdjusted; - modep->CrtcVAdjusted = p->CrtcVAdjusted; - modep->HSync = p->HSync; - modep->VRefresh = p->VRefresh; - modep->Private = p->Private; - modep->PrivSize = p->PrivSize; - - p->prev = modep; - - return MODE_OK; -} - -static double -ModeHSync(DisplayModePtr mode) -{ - double hsync = 0.0; - - if (mode->HSync > 0.0) - hsync = mode->HSync; - else if (mode->HTotal > 0) - hsync = (float)mode->Clock / (float)mode->HTotal; - - return hsync; -} - -static double -ModeVRefresh(DisplayModePtr mode) -{ - double refresh = 0.0; - - if (mode->VRefresh > 0.0) - refresh = mode->VRefresh; - else if (mode->HTotal > 0 && mode->VTotal > 0) { - refresh = mode->Clock * 1000.0 / mode->HTotal / mode->VTotal; - if (mode->Flags & V_INTERLACE) - refresh *= 2.0; - if (mode->Flags & V_DBLSCAN) - refresh /= 2.0; - if (mode->VScan > 1) - refresh /= (float)(mode->VScan); - } - return refresh; -} - -/* - * xf86LookupMode - * - * This function returns a mode from the given list which matches the - * given name. When multiple modes with the same name are available, - * the method of picking the matching mode is determined by the - * strategy selected. - * - * This function takes the following parameters: - * scrp ScrnInfoPtr - * modep pointer to the returned mode, which must have the name - * field filled in. - * clockRanges a list of clock ranges. This is optional when all the - * modes are built-in modes. - * strategy how to decide which mode to use from multiple modes with - * the same name - * - * In addition, the following fields from the ScrnInfoRec are used: - * modePool the list of monitor modes compatible with the driver - * clocks a list of discrete clocks - * numClocks number of discrete clocks - * progClock clock is programmable - * - * If a mode was found, its values are filled in to the area pointed to - * by modep, If a mode was not found the return value indicates the - * reason. - */ - -ModeStatus -xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep, - ClockRangePtr clockRanges, LookupModeFlags strategy) -{ - DisplayModePtr p, bestMode = NULL; - ClockRangePtr cp; - int i, k, gap, minimumGap = CLOCK_TOLERANCE + 1; - double refresh, bestRefresh = 0.0; - Bool found = FALSE; - int extraFlags = 0; - int clockIndex = -1; - int MulFactor = 1; - int DivFactor = 1; - int ModePrivFlags = 0; - ModeStatus status = MODE_NOMODE; - Bool allowDiv2 = (strategy & LOOKUP_CLKDIV2) != 0; - Bool haveBuiltin; - - strategy &= ~(LOOKUP_CLKDIV2 | LOOKUP_OPTIONAL_TOLERANCES); - - /* Some sanity checking */ - if (scrp == NULL || scrp->modePool == NULL || - (!scrp->progClock && scrp->numClocks == 0)) { - ErrorF("xf86LookupMode: called with invalid scrnInfoRec\n"); - return MODE_ERROR; - } - if (modep == NULL || modep->name == NULL) { - ErrorF("xf86LookupMode: called with invalid modep\n"); - return MODE_ERROR; - } - for (cp = clockRanges; cp != NULL; cp = cp->next) { - /* DivFactor and MulFactor must be > 0 */ - cp->ClockDivFactor = max(1, cp->ClockDivFactor); - cp->ClockMulFactor = max(1, cp->ClockMulFactor); - } - - haveBuiltin = FALSE; - /* Scan the mode pool for matching names */ - for (p = scrp->modePool; p != NULL; p = p->next) { - if (strcmp(p->name, modep->name) == 0) { - /* - * Requested mode is a built-in mode. Don't let the user - * override it. - * Since built-in modes always come before user specified - * modes it will always be found first. - */ - if (p->type & M_T_BUILTIN) { - haveBuiltin = TRUE; - } - - if (haveBuiltin && !(p->type & M_T_BUILTIN)) - continue; - - /* Skip over previously rejected modes */ - if (p->status != MODE_OK) { - if (!found) - status = p->status; - continue; - } - - /* Skip over previously considered modes */ - if (p->prev) - continue; - - if (p->type & M_T_BUILTIN) { - return xf86HandleBuiltinMode(scrp, p,modep, clockRanges, - allowDiv2); - } - - /* Check clock is in range */ - cp = xf86FindClockRangeForMode(clockRanges, p); - if (cp == NULL) { - /* - * XXX Could do more here to provide a more detailed - * reason for not finding a mode. - */ - p->status = MODE_CLOCK_RANGE; - if (!found) - status = MODE_CLOCK_RANGE; - continue; - } - - /* - * If programmable clock and strategy is not LOOKUP_BEST_REFRESH, - * the required mode has been found, otherwise record the refresh - * and continue looking. - */ - if (scrp->progClock) { - found = TRUE; - if (strategy != LOOKUP_BEST_REFRESH) { - bestMode = p; - DivFactor = cp->ClockDivFactor; - MulFactor = cp->ClockMulFactor; - ModePrivFlags = cp->PrivFlags; - break; - } - refresh = ModeVRefresh(p); - if (p->Flags & V_INTERLACE) - refresh /= INTERLACE_REFRESH_WEIGHT; - if (refresh > bestRefresh) { - bestMode = p; - DivFactor = cp->ClockDivFactor; - MulFactor = cp->ClockMulFactor; - ModePrivFlags = cp->PrivFlags; - bestRefresh = refresh; - } - continue; - } - - /* - * Clock is in range, so if it is not a programmable clock, find - * a matching clock. - */ - - i = xf86GetNearestClock(scrp, p->Clock, allowDiv2, - cp->ClockDivFactor, cp->ClockMulFactor, &k); - /* - * If the clock is too far from the requested clock, this - * mode is no good. - */ - if (k & V_CLKDIV2) - gap = abs((p->Clock * 2) - - ((scrp->clock[i] * cp->ClockDivFactor) / cp->ClockMulFactor)); - else - gap = abs(p->Clock - - ((scrp->clock[i] * cp->ClockDivFactor) / cp->ClockMulFactor)); - if (gap > minimumGap) { - p->status = MODE_NOCLOCK; - if (!found) - status = MODE_NOCLOCK; - continue; - } - found = TRUE; - - if (strategy == LOOKUP_BEST_REFRESH) { - refresh = ModeVRefresh(p); - if (p->Flags & V_INTERLACE) - refresh /= INTERLACE_REFRESH_WEIGHT; - if (refresh > bestRefresh) { - bestMode = p; - DivFactor = cp->ClockDivFactor; - MulFactor = cp->ClockMulFactor; - ModePrivFlags = cp->PrivFlags; - extraFlags = k; - clockIndex = i; - bestRefresh = refresh; - } - continue; - } - if (strategy == LOOKUP_CLOSEST_CLOCK) { - if (gap < minimumGap) { - bestMode = p; - DivFactor = cp->ClockDivFactor; - MulFactor = cp->ClockMulFactor; - ModePrivFlags = cp->PrivFlags; - extraFlags = k; - clockIndex = i; - minimumGap = gap; - } - continue; - } - /* - * If strategy is neither LOOKUP_BEST_REFRESH or - * LOOKUP_CLOSEST_CLOCK the required mode has been found. - */ - bestMode = p; - DivFactor = cp->ClockDivFactor; - MulFactor = cp->ClockMulFactor; - ModePrivFlags = cp->PrivFlags; - extraFlags = k; - clockIndex = i; - break; - } - } - if (!found || bestMode == NULL) - return status; - - /* Fill in the mode parameters */ - if (scrp->progClock) { - modep->Clock = bestMode->Clock; - modep->ClockIndex = -1; - modep->SynthClock = (modep->Clock * MulFactor) / DivFactor; - } else { - modep->Clock = (scrp->clock[clockIndex] * DivFactor) / MulFactor; - modep->ClockIndex = clockIndex; - modep->SynthClock = scrp->clock[clockIndex]; - if (extraFlags & V_CLKDIV2) { - modep->Clock /= 2; - modep->SynthClock /= 2; - } - } - modep->type = bestMode->type; - modep->PrivFlags = ModePrivFlags; - modep->HDisplay = bestMode->HDisplay; - modep->HSyncStart = bestMode->HSyncStart; - modep->HSyncEnd = bestMode->HSyncEnd; - modep->HTotal = bestMode->HTotal; - modep->HSkew = bestMode->HSkew; - modep->VDisplay = bestMode->VDisplay; - modep->VSyncStart = bestMode->VSyncStart; - modep->VSyncEnd = bestMode->VSyncEnd; - modep->VTotal = bestMode->VTotal; - modep->VScan = bestMode->VScan; - modep->Flags = bestMode->Flags | extraFlags; - modep->CrtcHDisplay = bestMode->CrtcHDisplay; - modep->CrtcHBlankStart = bestMode->CrtcHBlankStart; - modep->CrtcHSyncStart = bestMode->CrtcHSyncStart; - modep->CrtcHSyncEnd = bestMode->CrtcHSyncEnd; - modep->CrtcHBlankEnd = bestMode->CrtcHBlankEnd; - modep->CrtcHTotal = bestMode->CrtcHTotal; - modep->CrtcHSkew = bestMode->CrtcHSkew; - modep->CrtcVDisplay = bestMode->CrtcVDisplay; - modep->CrtcVBlankStart = bestMode->CrtcVBlankStart; - modep->CrtcVSyncStart = bestMode->CrtcVSyncStart; - modep->CrtcVSyncEnd = bestMode->CrtcVSyncEnd; - modep->CrtcVBlankEnd = bestMode->CrtcVBlankEnd; - modep->CrtcVTotal = bestMode->CrtcVTotal; - modep->CrtcHAdjusted = bestMode->CrtcHAdjusted; - modep->CrtcVAdjusted = bestMode->CrtcVAdjusted; - modep->HSync = bestMode->HSync; - modep->VRefresh = bestMode->VRefresh; - modep->Private = bestMode->Private; - modep->PrivSize = bestMode->PrivSize; - - bestMode->prev = modep; - - return MODE_OK; -} - - -/* - * xf86SetModeCrtc - * - * Initialises the Crtc parameters for a mode. The initialisation includes - * adjustments for interlaced and double scan modes. - */ -static void -xf86SetModeCrtc(DisplayModePtr p, int adjustFlags) -{ - if ((p == NULL) || ((p->type & M_T_CRTC_C) == M_T_BUILTIN)) - return; - - p->CrtcHDisplay = p->HDisplay; - p->CrtcHSyncStart = p->HSyncStart; - p->CrtcHSyncEnd = p->HSyncEnd; - p->CrtcHTotal = p->HTotal; - p->CrtcHSkew = p->HSkew; - p->CrtcVDisplay = p->VDisplay; - p->CrtcVSyncStart = p->VSyncStart; - p->CrtcVSyncEnd = p->VSyncEnd; - p->CrtcVTotal = p->VTotal; - if (p->Flags & V_INTERLACE) { - if (adjustFlags & INTERLACE_HALVE_V) { - p->CrtcVDisplay /= 2; - p->CrtcVSyncStart /= 2; - p->CrtcVSyncEnd /= 2; - p->CrtcVTotal /= 2; - } - /* Force interlaced modes to have an odd VTotal */ - /* maybe we should only do this when INTERLACE_HALVE_V is set? */ - p->CrtcVTotal |= 1; - } - - if (p->Flags & V_DBLSCAN) { - p->CrtcVDisplay *= 2; - p->CrtcVSyncStart *= 2; - p->CrtcVSyncEnd *= 2; - p->CrtcVTotal *= 2; - } - if (p->VScan > 1) { - p->CrtcVDisplay *= p->VScan; - p->CrtcVSyncStart *= p->VScan; - p->CrtcVSyncEnd *= p->VScan; - p->CrtcVTotal *= p->VScan; - } - p->CrtcHAdjusted = FALSE; - p->CrtcVAdjusted = FALSE; - - /* - * XXX - * - * The following is taken from VGA, but applies to other cores as well. - */ - p->CrtcVBlankStart = min(p->CrtcVSyncStart, p->CrtcVDisplay); - p->CrtcVBlankEnd = max(p->CrtcVSyncEnd, p->CrtcVTotal); - if ((p->CrtcVBlankEnd - p->CrtcVBlankStart) >= 127) { - /* - * V Blanking size must be < 127. - * Moving blank start forward is safer than moving blank end - * back, since monitors clamp just AFTER the sync pulse (or in - * the sync pulse), but never before. - */ - p->CrtcVBlankStart = p->CrtcVBlankEnd - 127; - /* - * If VBlankStart is now > VSyncStart move VBlankStart - * to VSyncStart using the maximum width that fits into - * VTotal. - */ - if (p->CrtcVBlankStart > p->CrtcVSyncStart) { - p->CrtcVBlankStart = p->CrtcVSyncStart; - p->CrtcVBlankEnd = min(p->CrtcHBlankStart + 127, p->CrtcVTotal); - } - } - p->CrtcHBlankStart = min(p->CrtcHSyncStart, p->CrtcHDisplay); - p->CrtcHBlankEnd = max(p->CrtcHSyncEnd, p->CrtcHTotal); - - if ((p->CrtcHBlankEnd - p->CrtcHBlankStart) >= 63 * 8) { - /* - * H Blanking size must be < 63*8. Same remark as above. - */ - p->CrtcHBlankStart = p->CrtcHBlankEnd - 63 * 8; - if (p->CrtcHBlankStart > p->CrtcHSyncStart) { - p->CrtcHBlankStart = p->CrtcHSyncStart; - p->CrtcHBlankEnd = min(p->CrtcHBlankStart + 63 * 8, p->CrtcHTotal); - } - } -} - -/* - * xf86CheckModeForMonitor - * - * This function takes a mode and monitor description, and determines - * if the mode is valid for the monitor. - */ -ModeStatus -xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor) -{ - int i; - - /* Sanity checks */ - if (mode == NULL || monitor == NULL) { - ErrorF("xf86CheckModeForMonitor: called with invalid parameters\n"); - return MODE_ERROR; - } - -#ifdef DEBUG - ErrorF("xf86CheckModeForMonitor(%p %s, %p %s)\n", - mode, mode->name, monitor, monitor->id); -#endif - - if (monitor->DDC) { - xf86MonPtr DDC = (xf86MonPtr)(monitor->DDC); - struct detailed_monitor_section* detMon; - struct monitor_ranges *mon_range; - int i; - - mon_range = NULL; - for (i = 0; i < 4; i++) { - detMon = &DDC->det_mon[i]; - if(detMon->type == DS_RANGES) { - mon_range = &detMon->section.ranges; - } - } - if (mon_range) { - /* mode->Clock in kHz, DDC in MHz */ - if (mon_range->max_clock < 2550 && - mode->Clock / 1000.0 > mon_range->max_clock) { - xf86Msg(X_WARNING, - "(%s,%s) mode clock %gMHz exceeds DDC maximum %dMHz\n", - mode->name, monitor->id, - mode->Clock/1000.0, mon_range->max_clock); - } - } - } - - /* Some basic mode validity checks */ - if (0 >= mode->HDisplay || mode->HDisplay > mode->HSyncStart || - mode->HSyncStart >= mode->HSyncEnd || mode->HSyncEnd >= mode->HTotal) - return MODE_H_ILLEGAL; - - if (0 >= mode->VDisplay || mode->VDisplay > mode->VSyncStart || - mode->VSyncStart >= mode->VSyncEnd || mode->VSyncEnd >= mode->VTotal) - return MODE_V_ILLEGAL; - - if (monitor->nHsync > 0) { - /* Check hsync against the allowed ranges */ - float hsync = ModeHSync(mode); - for (i = 0; i < monitor->nHsync; i++) - if ((hsync > monitor->hsync[i].lo * (1.0 - SYNC_TOLERANCE)) && - (hsync < monitor->hsync[i].hi * (1.0 + SYNC_TOLERANCE))) - break; - - /* Now see whether we ran out of sync ranges without finding a match */ - if (i == monitor->nHsync) - return MODE_HSYNC; - } - - if (monitor->nVrefresh > 0) { - /* Check vrefresh against the allowed ranges */ - float vrefrsh = ModeVRefresh(mode); - for (i = 0; i < monitor->nVrefresh; i++) - if ((vrefrsh > monitor->vrefresh[i].lo * (1.0 - SYNC_TOLERANCE)) && - (vrefrsh < monitor->vrefresh[i].hi * (1.0 + SYNC_TOLERANCE))) - break; - - /* Now see whether we ran out of refresh ranges without finding a match */ - if (i == monitor->nVrefresh) - return MODE_VSYNC; - } - - /* Force interlaced modes to have an odd VTotal */ - if (mode->Flags & V_INTERLACE) - mode->CrtcVTotal = mode->VTotal |= 1; - - return MODE_OK; -} - -/* - * xf86CheckModeSize - * - * An internal routine to check if a mode fits in video memory. This tries to - * avoid overflows that would otherwise occur when video memory size is greater - * than 256MB. - */ -static Bool -xf86CheckModeSize(ScrnInfoPtr scrp, int w, int x, int y) -{ - int bpp = scrp->fbFormat.bitsPerPixel, - pad = scrp->fbFormat.scanlinePad; - int lineWidth, lastWidth; - - if (scrp->depth == 4) - pad *= 4; /* 4 planes */ - - /* Sanity check */ - if ((w < 0) || (x < 0) || (y <= 0)) - return FALSE; - - lineWidth = (((w * bpp) + pad - 1) / pad) * pad; - lastWidth = x * bpp; - - /* - * At this point, we need to compare - * - * (lineWidth * (y - 1)) + lastWidth - * - * against - * - * scrp->videoRam * (1024 * 8) - * - * These are bit quantities. To avoid overflows, do the comparison in - * terms of BITMAP_SCANLINE_PAD units. This assumes BITMAP_SCANLINE_PAD - * is a power of 2. We currently use 32, which limits us to a video - * memory size of 8GB. - */ - - lineWidth = (lineWidth + (BITMAP_SCANLINE_PAD - 1)) / BITMAP_SCANLINE_PAD; - lastWidth = (lastWidth + (BITMAP_SCANLINE_PAD - 1)) / BITMAP_SCANLINE_PAD; - - if ((lineWidth * (y - 1) + lastWidth) > - (scrp->videoRam * ((1024 * 8) / BITMAP_SCANLINE_PAD))) - return FALSE; - - return TRUE; -} - -/* - * xf86InitialCheckModeForDriver - * - * This function checks if a mode satisfies a driver's initial requirements: - * - mode size fits within the available pixel area (memory) - * - width lies within the range of supported line pitches - * - mode size fits within virtual size (if fixed) - * - horizontal timings are in range - * - * This function takes the following parameters: - * scrp ScrnInfoPtr - * mode mode to check - * maxPitch (optional) maximum line pitch - * virtualX (optional) virtual width requested - * virtualY (optional) virtual height requested - * - * In addition, the following fields from the ScrnInfoRec are used: - * monitor pointer to structure for monitor section - * fbFormat pixel format for the framebuffer - * videoRam video memory size (in kB) - * maxHValue maximum horizontal timing value - * maxVValue maximum vertical timing value - */ - -ModeStatus -xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, - ClockRangePtr clockRanges, - LookupModeFlags strategy, - int maxPitch, int virtualX, int virtualY) -{ - ClockRangePtr cp; - ModeStatus status; - Bool allowDiv2 = (strategy & LOOKUP_CLKDIV2) != 0; - int i, needDiv2; - - /* Sanity checks */ - if (!scrp || !mode || !clockRanges) { - ErrorF("xf86InitialCheckModeForDriver: " - "called with invalid parameters\n"); - return MODE_ERROR; - } - -#ifdef DEBUG - ErrorF("xf86InitialCheckModeForDriver(%p, %p %s, %p, 0x%x, %d, %d, %d)\n", - scrp, mode, mode->name , clockRanges, strategy, maxPitch, virtualX, virtualY); -#endif - - /* Some basic mode validity checks */ - if (0 >= mode->HDisplay || mode->HDisplay > mode->HSyncStart || - mode->HSyncStart >= mode->HSyncEnd || mode->HSyncEnd >= mode->HTotal) - return MODE_H_ILLEGAL; - - if (0 >= mode->VDisplay || mode->VDisplay > mode->VSyncStart || - mode->VSyncStart >= mode->VSyncEnd || mode->VSyncEnd >= mode->VTotal) - return MODE_V_ILLEGAL; - - if (!xf86CheckModeSize(scrp, mode->HDisplay, mode->HDisplay, - mode->VDisplay)) - return MODE_MEM; - - if (maxPitch > 0 && mode->HDisplay > maxPitch) - return MODE_BAD_WIDTH; - - if (virtualX > 0 && mode->HDisplay > virtualX) - return MODE_VIRTUAL_X; - - if (virtualY > 0 && mode->VDisplay > virtualY) - return MODE_VIRTUAL_Y; - - if (scrp->maxHValue > 0 && mode->HTotal > scrp->maxHValue) - return MODE_BAD_HVALUE; - - if (scrp->maxVValue > 0 && mode->VTotal > scrp->maxVValue) - return MODE_BAD_VVALUE; - - /* - * The use of the DisplayModeRec's Crtc* and SynthClock elements below is - * provisional, in that they are later reused by the driver at mode-set - * time. Here, they are temporarily enlisted to contain the mode timings - * as seen by the CRT or panel (rather than the CRTC). The driver's - * ValidMode() is allowed to modify these so it can deal with such things - * as mode stretching and/or centering. The driver should >NOT< modify the - * user-supplied values as these are reported back when mode validation is - * said and done. - */ - /* - * NOTE: We (ab)use the mode->Crtc* values here to store timing - * information for the calculation of Hsync and Vrefresh. Before - * these values are calculated the driver is given the opportunity - * to either set these HSync and VRefresh itself or modify the timing - * values. - * The difference to the final calculation is small but imortand: - * here we pass the flag INTERLACE_HALVE_V regardless if the driver - * sets it or not. This way our calculation of VRefresh has the same - * effect as if we do if (flags & V_INTERLACE) refresh *= 2.0 - * This dual use of the mode->Crtc* values will certainly create - * confusion and is bad software design. However since it's part of - * the driver API it's hard to change. - */ - - if (scrp->ValidMode) { - - xf86SetModeCrtc(mode, INTERLACE_HALVE_V); - - cp = xf86FindClockRangeForMode(clockRanges, mode); - if (!cp) - return MODE_CLOCK_RANGE; - - if (cp->ClockMulFactor < 1) - cp->ClockMulFactor = 1; - if (cp->ClockDivFactor < 1) - cp->ClockDivFactor = 1; - - /* - * XXX The effect of clock dividers and multipliers on the monitor's - * pixel clock needs to be verified. - */ - if (scrp->progClock) { - mode->SynthClock = mode->Clock; - } else { - i = xf86GetNearestClock(scrp, mode->Clock, allowDiv2, - cp->ClockDivFactor, cp->ClockMulFactor, - &needDiv2); - mode->SynthClock = (scrp->clock[i] * cp->ClockDivFactor) / - cp->ClockMulFactor; - if (needDiv2 & V_CLKDIV2) - mode->SynthClock /= 2; - } - - status = (*scrp->ValidMode)(scrp->scrnIndex, mode, FALSE, - MODECHECK_INITIAL); - if (status != MODE_OK) - return status; - - if (mode->HSync <= 0.0) - mode->HSync = (float)mode->SynthClock / (float)mode->CrtcHTotal; - if (mode->VRefresh <= 0.0) - mode->VRefresh = (mode->SynthClock * 1000.0) - / (mode->CrtcHTotal * mode->CrtcVTotal); - } - - mode->HSync = ModeHSync(mode); - mode->VRefresh = ModeVRefresh(mode); - - /* Assume it is OK */ - return MODE_OK; -} - -/* - * xf86CheckModeForDriver - * - * This function is for checking modes while the server is running (for - * use mainly by the VidMode extension). - * - * This function checks if a mode satisfies a driver's requirements: - * - width lies within the line pitch - * - mode size fits within virtual size - * - horizontal/vertical timings are in range - * - * This function takes the following parameters: - * scrp ScrnInfoPtr - * mode mode to check - * flags not (currently) used - * - * In addition, the following fields from the ScrnInfoRec are used: - * maxHValue maximum horizontal timing value - * maxVValue maximum vertical timing value - * virtualX virtual width - * virtualY virtual height - * clockRanges allowable clock ranges - */ - -ModeStatus -xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, int flags) -{ - ClockRangesPtr cp; - int i, k, gap, minimumGap = CLOCK_TOLERANCE + 1; - int extraFlags = 0; - int clockIndex = -1; - int MulFactor = 1; - int DivFactor = 1; - int ModePrivFlags = 0; - Bool allowDiv2; - ModeStatus status = MODE_NOMODE; - - /* Some sanity checking */ - if (scrp == NULL || (!scrp->progClock && scrp->numClocks == 0)) { - ErrorF("xf86CheckModeForDriver: called with invalid scrnInfoRec\n"); - return MODE_ERROR; - } - if (mode == NULL) { - ErrorF("xf86CheckModeForDriver: called with invalid modep\n"); - return MODE_ERROR; - } - - /* Check the mode size */ - if (mode->HDisplay > scrp->virtualX) - return MODE_VIRTUAL_X; - - if (mode->VDisplay > scrp->virtualY) - return MODE_VIRTUAL_Y; - - if (scrp->maxHValue > 0 && mode->HTotal > scrp->maxHValue) - return MODE_BAD_HVALUE; - - if (scrp->maxVValue > 0 && mode->VTotal > scrp->maxVValue) - return MODE_BAD_VVALUE; - - for (cp = scrp->clockRanges; cp != NULL; cp = cp->next) { - /* DivFactor and MulFactor must be > 0 */ - cp->ClockDivFactor = max(1, cp->ClockDivFactor); - cp->ClockMulFactor = max(1, cp->ClockMulFactor); - } - - if (scrp->progClock) { - /* Check clock is in range */ - for (cp = scrp->clockRanges; cp != NULL; cp = cp->next) { - if ((cp->minClock <= mode->Clock) && - (cp->maxClock >= mode->Clock) && - (cp->interlaceAllowed || !(mode->Flags & V_INTERLACE)) && - (cp->doubleScanAllowed || - ((!(mode->Flags & V_DBLSCAN)) && (mode->VScan <= 1)))) - break; - } - if (cp == NULL) { - return MODE_CLOCK_RANGE; - } - /* - * If programmable clock the required mode has been found - */ - DivFactor = cp->ClockDivFactor; - MulFactor = cp->ClockMulFactor; - ModePrivFlags = cp->PrivFlags; - } else { - status = MODE_CLOCK_RANGE; - /* Check clock is in range */ - for (cp = scrp->clockRanges; cp != NULL; cp = cp->next) { - if ((cp->minClock <= mode->Clock) && - (cp->maxClock >= mode->Clock) && - (cp->interlaceAllowed || !(mode->Flags & V_INTERLACE)) && - (cp->doubleScanAllowed || - ((!(mode->Flags & V_DBLSCAN)) && (mode->VScan <= 1)))) { - - /* - * Clock is in range, so if it is not a programmable clock, - * find a matching clock. - */ - - allowDiv2 = (cp->strategy & LOOKUP_CLKDIV2) != 0; - i = xf86GetNearestClock(scrp, mode->Clock, allowDiv2, - cp->ClockDivFactor, cp->ClockMulFactor, &k); - /* - * If the clock is too far from the requested clock, this - * mode is no good. - */ - if (k & V_CLKDIV2) - gap = abs((mode->Clock * 2) - - ((scrp->clock[i] * cp->ClockDivFactor) / - cp->ClockMulFactor)); - else - gap = abs(mode->Clock - - ((scrp->clock[i] * cp->ClockDivFactor) / - cp->ClockMulFactor)); - if (gap > minimumGap) { - status = MODE_NOCLOCK; - continue; - } - - DivFactor = cp->ClockDivFactor; - MulFactor = cp->ClockMulFactor; - ModePrivFlags = cp->PrivFlags; - extraFlags = k; - clockIndex = i; - break; - } - } - if (cp == NULL) - return status; - } - - /* Fill in the mode parameters */ - if (scrp->progClock) { - mode->ClockIndex = -1; - mode->SynthClock = (mode->Clock * MulFactor) / DivFactor; - } else { - mode->Clock = (scrp->clock[clockIndex] * DivFactor) / MulFactor; - mode->ClockIndex = clockIndex; - mode->SynthClock = scrp->clock[clockIndex]; - if (extraFlags & V_CLKDIV2) { - mode->Clock /= 2; - mode->SynthClock /= 2; - } - } - mode->PrivFlags = ModePrivFlags; - - return MODE_OK; -} - -/* - * xf86ValidateModes - * - * This function takes a set of mode names, modes and limiting conditions, - * and selects a set of modes and parameters based on those conditions. - * - * This function takes the following parameters: - * scrp ScrnInfoPtr - * availModes the list of modes available for the monitor - * modeNames (optional) list of mode names that the screen is requesting - * clockRanges a list of clock ranges - * linePitches (optional) a list of line pitches - * minPitch (optional) minimum line pitch (in pixels) - * maxPitch (optional) maximum line pitch (in pixels) - * pitchInc (mandatory) pitch increment (in bits) - * minHeight (optional) minimum virtual height (in pixels) - * maxHeight (optional) maximum virtual height (in pixels) - * virtualX (optional) virtual width requested (in pixels) - * virtualY (optional) virtual height requested (in pixels) - * apertureSize size of video aperture (in bytes) - * strategy how to decide which mode to use from multiple modes with - * the same name - * - * In addition, the following fields from the ScrnInfoRec are used: - * clocks a list of discrete clocks - * numClocks number of discrete clocks - * progClock clock is programmable - * monitor pointer to structure for monitor section - * fbFormat format of the framebuffer - * videoRam video memory size - * maxHValue maximum horizontal timing value - * maxVValue maximum vertical timing value - * xInc horizontal timing increment (defaults to 8 pixels) - * - * The function fills in the following ScrnInfoRec fields: - * modePool A subset of the modes available to the monitor which - * are compatible with the driver. - * modes one mode entry for each of the requested modes, with the - * status field filled in to indicate if the mode has been - * accepted or not. - * virtualX the resulting virtual width - * virtualY the resulting virtual height - * displayWidth the resulting line pitch - * - * The function's return value is the number of matching modes found, or -1 - * if an unrecoverable error was encountered. - */ - -int -xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, - char **modeNames, ClockRangePtr clockRanges, - int *linePitches, int minPitch, int maxPitch, int pitchInc, - int minHeight, int maxHeight, int virtualX, int virtualY, - int apertureSize, LookupModeFlags strategy) -{ - DisplayModePtr p, q, r, new, last, *endp; - int i, numModes = 0; - ModeStatus status; - int linePitch = -1, virtX = 0, virtY = 0; - int newLinePitch, newVirtX, newVirtY; - int modeSize; /* in pixels */ - Bool validateAllDefaultModes = FALSE; - Bool userModes = FALSE; - int saveType; - PixmapFormatRec *BankFormat; - ClockRangePtr cp; - ClockRangesPtr storeClockRanges; - struct monitor_ranges *mon_range = NULL; - double targetRefresh = 0.0; - int numTimings = 0; - range hsync[MAX_HSYNC]; - range vrefresh[MAX_VREFRESH]; - -#ifdef DEBUG - ErrorF("xf86ValidateModes(%p, %p, %p, %p,\n\t\t %p, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x)\n", - scrp, availModes, modeNames, clockRanges, - linePitches, minPitch, maxPitch, pitchInc, - minHeight, maxHeight, virtualX, virtualY, - apertureSize, strategy - ); -#endif - - /* Some sanity checking */ - if (scrp == NULL || scrp->name == NULL || !scrp->monitor || - (!scrp->progClock && scrp->numClocks == 0)) { - ErrorF("xf86ValidateModes: called with invalid scrnInfoRec\n"); - return -1; - } - if (linePitches != NULL && linePitches[0] <= 0) { - ErrorF("xf86ValidateModes: called with invalid linePitches\n"); - return -1; - } - if (pitchInc <= 0) { - ErrorF("xf86ValidateModes: called with invalid pitchInc\n"); - return -1; - } - if ((virtualX > 0) != (virtualY > 0)) { - ErrorF("xf86ValidateModes: called with invalid virtual resolution\n"); - return -1; - } - - /* - * Probe monitor so that we can enforce/warn about its limits. - * If one or more DS_RANGES descriptions are present, use the parameters - * that they provide. Otherwise, deduce limits based on the modes that - * are shown as supported via standard and detailed timings. - * - * XXX The full potential of the DDC/EDID data still isn't being tapped. - */ - if (scrp->monitor->DDC) { - MonPtr monitor = scrp->monitor; - xf86MonPtr DDC = (xf86MonPtr)(scrp->monitor->DDC); - int i, j; - float hmin = 1e6, hmax = 0.0, vmin = 1e6, vmax = 0.0; - float h; - struct std_timings *t; - struct detailed_timings *dt; - - numTimings = 0; - for (i = 0; i < DET_TIMINGS; i++) { - switch (DDC->det_mon[i].type) { - case DS_RANGES: - mon_range = &DDC->det_mon[i].section.ranges; - hsync[numTimings].lo = mon_range->min_h; - hsync[numTimings].hi = mon_range->max_h; - vrefresh[numTimings].lo = mon_range->min_v; - vrefresh[numTimings].hi = mon_range->max_v; - numTimings++; - break; - - case DS_STD_TIMINGS: - t = DDC->det_mon[i].section.std_t; - for (j = 0; j < 5; j++) { - if (t[j].hsize > 256) { /* sanity check */ - if (t[j].refresh < vmin) - vmin = t[i].refresh; - if (t[j].refresh > vmax) - vmax = t[i].refresh; - /* - * For typical modes this is a reasonable estimate - * of the horizontal sync rate. - */ - h = t[j].refresh * 1.07 * t[j].vsize / 1000.0; - if (h < hmin) - hmin = h; - if (h > hmax) - hmax = h; - } - } - break; - - case DT: - dt = &DDC->det_mon[i].section.d_timings; - if (dt->clock > 15000000) { /* sanity check */ - float v; - h = (float)dt->clock / (dt->h_active + dt->h_blanking); - v = h / (dt->v_active + dt->v_blanking); - h /= 1000.0; - if (dt->interlaced) - v /= 2.0; - - if (v < vmin) - vmin = v; - if (v > vmax) - vmax = v; - if (h < hmin) - hmin = h; - if (h > hmax) - hmax = h; - } - break; - } - - if (numTimings > MAX_HSYNC) - break; - } - - if (numTimings == 0) { - t = DDC->timings2; - for (i = 0; i < STD_TIMINGS; i++) { - if (t[i].hsize > 256) { /* sanity check */ - if (t[i].refresh < vmin) - vmin = t[i].refresh; - if (t[i].refresh > vmax) - vmax = t[i].refresh; - /* - * For typical modes this is a reasonable estimate - * of the horizontal sync rate. - */ - h = t[i].refresh * 1.07 * t[i].vsize / 1000.0; - if (h < hmin) - hmin = h; - if (h > hmax) - hmax = h; - } - } - - if (hmax > 0.0) { - hsync[numTimings].lo = hmin; - hsync[numTimings].hi = hmax; - vrefresh[numTimings].lo = vmin; - vrefresh[numTimings].hi = vmax; - numTimings++; - } - } - - if (numTimings > 0) { - -#ifdef DEBUG - for (i = 0; i < numTimings; i++) { - ErrorF("DDC - Hsync %.1f-%.1f kHz - Vrefresh %.1f-%.1f Hz\n", - hsync[i].lo, hsync[i].hi, - vrefresh[i].lo, vrefresh[i].hi); - } -#endif - -#define DDC_SYNC_TOLERANCE SYNC_TOLERANCE - if (monitor->nHsync > 0) { - for (i = 0; i < monitor->nHsync; i++) { - Bool good = FALSE; - for (j = 0; j < numTimings; j++) { - if ((1.0 - DDC_SYNC_TOLERANCE) * hsync[j].lo <= - monitor->hsync[i].lo && - (1.0 + DDC_SYNC_TOLERANCE) * hsync[j].hi >= - monitor->hsync[i].hi) { - good = TRUE; - break; - } - } - if (!good) { - xf86DrvMsg(scrp->scrnIndex, X_WARNING, - "config file hsync range %g-%gkHz not within DDC " - "hsync ranges.\n", - monitor->hsync[i].lo, monitor->hsync[i].hi); - } - } - } - - if (monitor->nVrefresh > 0) { - for (i = 0; i < monitor->nVrefresh; i++) { - Bool good = FALSE; - for (j = 0; j < numTimings; j++) { - if ((1.0 - DDC_SYNC_TOLERANCE) * vrefresh[j].lo <= - monitor->vrefresh[0].lo && - (1.0 + DDC_SYNC_TOLERANCE) * vrefresh[j].hi >= - monitor->vrefresh[0].hi) { - good = TRUE; - break; - } - } - if (!good) { - xf86DrvMsg(scrp->scrnIndex, X_WARNING, - "config file vrefresh range %g-%gHz not within DDC " - "vrefresh ranges.\n", - monitor->vrefresh[i].lo, monitor->vrefresh[i].hi); - } - } - } - } - } - - /* - * If requested by the driver, allow missing hsync and/or vrefresh ranges - * in the monitor section. - */ - if (strategy & LOOKUP_OPTIONAL_TOLERANCES) { - strategy &= ~LOOKUP_OPTIONAL_TOLERANCES; - } else { - const char *type = ""; - - if (scrp->monitor->nHsync <= 0) { - if (numTimings > 0) { - scrp->monitor->nHsync = numTimings; - for (i = 0; i < numTimings; i++) { - scrp->monitor->hsync[i].lo = hsync[i].lo; - scrp->monitor->hsync[i].hi = hsync[i].hi; - } - } else { - scrp->monitor->hsync[0].lo = 28; - scrp->monitor->hsync[0].hi = 33; - scrp->monitor->nHsync = 1; - } - type = "default "; - } - for (i = 0; i < scrp->monitor->nHsync; i++) { - if (scrp->monitor->hsync[i].lo == scrp->monitor->hsync[i].hi) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "%s: Using %shsync value of %.2f kHz\n", - scrp->monitor->id, type, - scrp->monitor->hsync[i].lo); - else - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "%s: Using %shsync range of %.2f-%.2f kHz\n", - scrp->monitor->id, type, - scrp->monitor->hsync[i].lo, - scrp->monitor->hsync[i].hi); - } - - type = ""; - if (scrp->monitor->nVrefresh <= 0) { - if (numTimings > 0) { - scrp->monitor->nVrefresh = numTimings; - for (i = 0; i < numTimings; i++) { - scrp->monitor->vrefresh[i].lo = vrefresh[i].lo; - scrp->monitor->vrefresh[i].hi = vrefresh[i].hi; - } - } else { - scrp->monitor->vrefresh[0].lo = 43; - scrp->monitor->vrefresh[0].hi = 72; - scrp->monitor->nVrefresh = 1; - } - type = "default "; - } - for (i = 0; i < scrp->monitor->nVrefresh; i++) { - if (scrp->monitor->vrefresh[i].lo == scrp->monitor->vrefresh[i].hi) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "%s: Using %svrefresh value of %.2f Hz\n", - scrp->monitor->id, type, - scrp->monitor->vrefresh[i].lo); - else - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "%s: Using %svrefresh range of %.2f-%.2f Hz\n", - scrp->monitor->id, type, - scrp->monitor->vrefresh[i].lo, - scrp->monitor->vrefresh[i].hi); - } - } - - /* - * Store the clockRanges for later use by the VidMode extension. Must - * also store the strategy, since ClockDiv2 flag is stored there. - */ - storeClockRanges = scrp->clockRanges; - while (storeClockRanges != NULL) { - storeClockRanges = storeClockRanges->next; - } - for (cp = clockRanges; cp != NULL; cp = cp->next, - storeClockRanges = storeClockRanges->next) { - storeClockRanges = xnfalloc(sizeof(ClockRanges)); - if (scrp->clockRanges == NULL) - scrp->clockRanges = storeClockRanges; - memcpy(storeClockRanges, cp, sizeof(ClockRange)); - storeClockRanges->strategy = strategy; - } - - /* Determine which pixmap format to pass to miScanLineWidth() */ - if (scrp->depth > 4) - BankFormat = &scrp->fbFormat; - else - BankFormat = xf86GetPixFormat(scrp, 1); /* >not< scrp->depth! */ - - if (scrp->xInc <= 0) - scrp->xInc = 8; /* Suitable for VGA and others */ - -#define _VIRTUALX(x) ((((x) + scrp->xInc - 1) / scrp->xInc) * scrp->xInc) - - /* - * Determine maxPitch if it wasn't given explicitly. Note linePitches - * always takes precedence if is non-NULL. In that case the minPitch and - * maxPitch values passed are ignored. - */ - if (linePitches) { - minPitch = maxPitch = linePitches[0]; - for (i = 1; linePitches[i] > 0; i++) { - if (linePitches[i] > maxPitch) - maxPitch = linePitches[i]; - if (linePitches[i] < minPitch) - minPitch = linePitches[i]; - } - } - - /* Initial check of virtual size against other constraints */ - scrp->virtualFrom = X_PROBED; - /* - * Initialise virtX and virtY if the values are fixed. - */ - if (virtualY > 0) { - if (maxHeight > 0 && virtualY > maxHeight) { - xf86DrvMsg(scrp->scrnIndex, X_ERROR, - "Virtual height (%d) is too large for the hardware " - "(max %d)\n", virtualY, maxHeight); - return -1; - } - - if (minHeight > 0 && virtualY < minHeight) { - xf86DrvMsg(scrp->scrnIndex, X_ERROR, - "Virtual height (%d) is too small for the hardware " - "(min %d)\n", virtualY, minHeight); - return -1; - } - - virtualX = _VIRTUALX(virtualX); - if (linePitches != NULL) { - for (i = 0; linePitches[i] != 0; i++) { - if ((linePitches[i] >= virtualX) && - (linePitches[i] == - miScanLineWidth(virtualX, virtualY, linePitches[i], - apertureSize, BankFormat, pitchInc))) { - linePitch = linePitches[i]; - break; - } - } - } else { - linePitch = miScanLineWidth(virtualX, virtualY, minPitch, - apertureSize, BankFormat, pitchInc); - } - - if ((linePitch < minPitch) || (linePitch > maxPitch)) { - xf86DrvMsg(scrp->scrnIndex, X_ERROR, - "Virtual width (%d) is too large for the hardware " - "(max %d)\n", virtualX, maxPitch); - return -1; - } - - if (!xf86CheckModeSize(scrp, linePitch, virtualX, virtualY)) { - xf86DrvMsg(scrp->scrnIndex, X_ERROR, - "Virtual size (%dx%d) (pitch %d) exceeds video memory\n", - virtualX, virtualY, linePitch); - return -1; - } - - virtX = virtualX; - virtY = virtualY; - scrp->virtualFrom = X_CONFIG; - } - - /* Print clock ranges and scaled clocks */ - xf86ShowClockRanges(scrp, clockRanges); - - /* - * If scrp->modePool hasn't been setup yet, set it up now. This allows the - * modes that the driver definitely can't use to be weeded out early. Note - * that a modePool mode's prev field is used to hold a pointer to the - * member of the scrp->modes list for which a match was considered. - */ - if (scrp->modePool == NULL) { - q = NULL; - for (p = availModes; p != NULL; p = p->next) { - status = xf86InitialCheckModeForDriver(scrp, p, clockRanges, - strategy, maxPitch, - virtualX, virtualY); - - if (status == MODE_OK) { - status = xf86CheckModeForMonitor(p, scrp->monitor); - } - - if (status == MODE_OK) { - new = xnfalloc(sizeof(DisplayModeRec)); - *new = *p; - new->next = NULL; - if (!q) { - scrp->modePool = new; - } else { - q->next = new; - } - new->prev = NULL; - q = new; - q->name = xnfstrdup(p->name); - q->status = MODE_OK; - } else { - if (p->type & M_T_BUILTIN) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using built-in mode \"%s\" (%s)\n", - p->name, xf86ModeStatusToString(status)); - else if (p->type & M_T_DEFAULT) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using default mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(status)); - else - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(status)); - } - } - - if (scrp->modePool == NULL) { - xf86DrvMsg(scrp->scrnIndex, X_WARNING, "Mode pool is empty\n"); - return 0; - } - } else { - for (p = scrp->modePool; p != NULL; p = p->next) { - p->prev = NULL; - p->status = MODE_OK; - } - } - - /* - * Go through the mode pool and see if any modes match the target - * refresh rate, (if specified). If no modes match, abandon the target. - */ - targetRefresh = xf86SetRealOption(scrp->options, - "TargetRefresh", 0.0); - if (targetRefresh > 0.0) { - for (p = scrp->modePool; p != NULL; p = p->next) { - if (ModeVRefresh(p) > targetRefresh * (1.0 - SYNC_TOLERANCE)) - break; - } - if (!p) - targetRefresh = 0.0; - } - - if (targetRefresh > 0.0) { - xf86DrvMsg(scrp->scrnIndex, X_CONFIG, - "Target refresh rate is %.1f Hz\n", targetRefresh); - } - - /* - * Allocate one entry in scrp->modes for each named mode. - */ - while (scrp->modes) - xf86DeleteMode(&scrp->modes, scrp->modes); - endp = &scrp->modes; - last = NULL; - if (modeNames != NULL) { - for (i = 0; modeNames[i] != NULL; i++) { - userModes = TRUE; - new = xnfcalloc(1, sizeof(DisplayModeRec)); - new->prev = last; - new->type = M_T_USERDEF; - new->name = xnfalloc(strlen(modeNames[i]) + 1); - strcpy(new->name, modeNames[i]); - if (new->prev) - new->prev->next = new; - *endp = last = new; - endp = &new->next; - } - } - - /* Lookup each mode */ -#ifdef RANDR - if (!xf86Info.disableRandR -#ifdef PANORAMIX - && noPanoramiXExtension -#endif - ) - validateAllDefaultModes = TRUE; -#endif - - for (p = scrp->modes; ; p = p->next) { - Bool repeat; - - /* - * If the supplied mode names don't produce a valid mode, scan through - * unconsidered modePool members until one survives validation. This - * is done in decreasing order by mode pixel area. - */ - - if (p == NULL) { - if ((numModes > 0) && !validateAllDefaultModes) - break; - - validateAllDefaultModes = TRUE; - r = NULL; - modeSize = 0; - for (q = scrp->modePool; q != NULL; q = q->next) { - if ((q->prev == NULL) && (q->status == MODE_OK)) { - /* - * Deal with the case where this mode wasn't considered - * because of a builtin mode of the same name. - */ - for (p = scrp->modes; p != NULL; p = p->next) { - if ((p->status != MODE_OK) && - !strcmp(p->name, q->name)) - break; - } - - if (p != NULL) - q->prev = p; - else { - /* - * A quick check to not allow default modes with - * horizontal timing parameters that CRTs may have - * problems with. - */ - if ((q->type & M_T_DEFAULT) && - ((double)q->HTotal / (double)q->HDisplay) < 1.15) - continue; - - /* - * If there is a target refresh rate, skip modes that - * don't match up. - */ - if (ModeVRefresh(q) < - (1.0 - SYNC_TOLERANCE) * targetRefresh) - continue; - - if (modeSize < (q->HDisplay * q->VDisplay)) { - r = q; - modeSize = q->HDisplay * q->VDisplay; - } - } - } - } - - if (r == NULL) - break; - - p = xnfcalloc(1, sizeof(DisplayModeRec)); - p->prev = last; - p->name = xnfalloc(strlen(r->name) + 1); - if (!userModes) - p->type = M_T_USERDEF; - strcpy(p->name, r->name); - if (p->prev) - p->prev->next = p; - *endp = last = p; - endp = &p->next; - } - - repeat = FALSE; - lookupNext: - if (repeat && ((status = p->status) != MODE_OK)) { - if (p->type & M_T_BUILTIN) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using built-in mode \"%s\" (%s)\n", - p->name, xf86ModeStatusToString(status)); - else if (p->type & M_T_DEFAULT) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using default mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(status)); - else - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(status)); - } - saveType = p->type; - status = xf86LookupMode(scrp, p, clockRanges, strategy); - if (repeat && status == MODE_NOMODE) { - continue; - } - if (status != MODE_OK) { - if (p->type & M_T_BUILTIN) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using built-in mode \"%s\" (%s)\n", - p->name, xf86ModeStatusToString(status)); - else if (p->type & M_T_DEFAULT) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using default mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(status)); - else - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(status)); - } - if (status == MODE_ERROR) { - ErrorF("xf86ValidateModes: " - "unexpected result from xf86LookupMode()\n"); - return -1; - } - if (status != MODE_OK) { - if (p->status == MODE_OK) - p->status = status; - continue; - } - p->type |= saveType; - repeat = TRUE; - - newLinePitch = linePitch; - newVirtX = virtX; - newVirtY = virtY; - - /* - * Don't let non-user defined modes increase the virtual size - */ - if (!(p->type & M_T_USERDEF) && (numModes > 0)) { - if (p->HDisplay > virtX) { - p->status = MODE_VIRTUAL_X; - goto lookupNext; - } - if (p->VDisplay > virtY) { - p->status = MODE_VIRTUAL_Y; - goto lookupNext; - } - } - /* - * Adjust virtual width and height if the mode is too large for the - * current values and if they are not fixed. - */ - if (virtualX <= 0 && p->HDisplay > newVirtX) - newVirtX = _VIRTUALX(p->HDisplay); - if (virtualY <= 0 && p->VDisplay > newVirtY) { - if (maxHeight > 0 && p->VDisplay > maxHeight) { - p->status = MODE_VIRTUAL_Y; /* ? */ - goto lookupNext; - } - newVirtY = p->VDisplay; - } - - /* - * If virtual resolution is to be increased, revalidate it. - */ - if ((virtX != newVirtX) || (virtY != newVirtY)) { - if (linePitches != NULL) { - newLinePitch = -1; - for (i = 0; linePitches[i] != 0; i++) { - if ((linePitches[i] >= newVirtX) && - (linePitches[i] >= linePitch) && - (linePitches[i] == - miScanLineWidth(newVirtX, newVirtY, linePitches[i], - apertureSize, BankFormat, pitchInc))) { - newLinePitch = linePitches[i]; - break; - } - } - } else { - if (linePitch < minPitch) - linePitch = minPitch; - newLinePitch = miScanLineWidth(newVirtX, newVirtY, linePitch, - apertureSize, BankFormat, - pitchInc); - } - if ((newLinePitch < minPitch) || (newLinePitch > maxPitch)) { - p->status = MODE_BAD_WIDTH; - goto lookupNext; - } - - /* - * Check that the pixel area required by the new virtual height - * and line pitch isn't too large. - */ - if (!xf86CheckModeSize(scrp, newLinePitch, newVirtX, newVirtY)) { - p->status = MODE_MEM_VIRT; - goto lookupNext; - } - } - - if (scrp->ValidMode) { - /* - * Give the driver a final say, passing it the proposed virtual - * geometry. - */ - scrp->virtualX = newVirtX; - scrp->virtualY = newVirtY; - scrp->displayWidth = newLinePitch; - p->status = (scrp->ValidMode)(scrp->scrnIndex, p, FALSE, - MODECHECK_FINAL); - - if (p->status != MODE_OK) { - goto lookupNext; - } - } - - /* Mode has passed all the tests */ - virtX = newVirtX; - virtY = newVirtY; - linePitch = newLinePitch; - p->status = MODE_OK; - numModes++; - } - -#undef _VIRTUALX - - /* Update the ScrnInfoRec parameters */ - - scrp->virtualX = virtX; - scrp->virtualY = virtY; - scrp->displayWidth = linePitch; - - if (numModes <= 0) - return 0; - - /* Make the mode list into a circular list by joining up the ends */ - p = scrp->modes; - while (p->next != NULL) - p = p->next; - /* p is now the last mode on the list */ - p->next = scrp->modes; - scrp->modes->prev = p; - - if (minHeight > 0 && virtY < minHeight) { - xf86DrvMsg(scrp->scrnIndex, X_ERROR, - "Virtual height (%d) is too small for the hardware " - "(min %d)\n", virtY, minHeight); - return -1; - } - - return numModes; -} - -/* - * xf86DeleteMode - * - * This function removes a mode from a list of modes. - * - * There are different types of mode lists: - * - * - singly linked linear lists, ending in NULL - * - doubly linked linear lists, starting and ending in NULL - * - doubly linked circular lists - * - */ - -void -xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode) -{ - /* Catch the easy/insane cases */ - if (modeList == NULL || *modeList == NULL || mode == NULL) - return; - - /* If the mode is at the start of the list, move the start of the list */ - if (*modeList == mode) - *modeList = mode->next; - - /* If mode is the only one on the list, set the list to NULL */ - if ((mode == mode->prev) && (mode == mode->next)) { - *modeList = NULL; - } else { - if ((mode->prev != NULL) && (mode->prev->next == mode)) - mode->prev->next = mode->next; - if ((mode->next != NULL) && (mode->next->prev == mode)) - mode->next->prev = mode->prev; - } - - xfree(mode->name); - xfree(mode); -} - -/* - * xf86PruneDriverModes - * - * Remove modes from the driver's mode list which have been marked as - * invalid. - */ - -void -xf86PruneDriverModes(ScrnInfoPtr scrp) -{ - DisplayModePtr first, p, n; - - p = scrp->modes; - if (p == NULL) - return; - - do { - if (!(first = scrp->modes)) - return; - n = p->next; - if (p->status != MODE_OK) { -#if 0 - if (p->type & M_T_BUILTIN) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using built-in mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(p->status)); - else if (p->type & M_T_DEFAULT) - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using default mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(p->status)); - else - xf86DrvMsg(scrp->scrnIndex, X_INFO, - "Not using mode \"%s\" (%s)\n", p->name, - xf86ModeStatusToString(p->status)); -#endif - xf86DeleteMode(&(scrp->modes), p); - } - p = n; - } while (p != NULL && p != first); - - /* modePool is no longer needed, turf it */ - while (scrp->modePool) { - /* - * A modePool mode's prev field is used to hold a pointer to the - * member of the scrp->modes list for which a match was considered. - * Clear that pointer first, otherwise xf86DeleteMode might get - * confused - */ - scrp->modePool->prev = NULL; - xf86DeleteMode(&scrp->modePool, scrp->modePool); - } -} - - -/* - * xf86SetCrtcForModes - * - * Goes through the screen's mode list, and initialises the Crtc - * parameters for each mode. The initialisation includes adjustments - * for interlaced and double scan modes. - */ -void -xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags) -{ - DisplayModePtr p; - - /* - * Store adjustFlags for use with the VidMode extension. There is an - * implicit assumption here that SetCrtcForModes is called once. - */ - scrp->adjustFlags = adjustFlags; - - p = scrp->modes; - if (p == NULL) - return; - - do { - xf86SetModeCrtc(p, adjustFlags); -#ifdef DEBUG - ErrorF("%sMode %s: %d (%d) %d %d (%d) %d %d (%d) %d %d (%d) %d\n", - (p->type & M_T_DEFAULT) ? "Default " : "", - p->name, p->CrtcHDisplay, p->CrtcHBlankStart, - p->CrtcHSyncStart, p->CrtcHSyncEnd, p->CrtcHBlankEnd, - p->CrtcHTotal, p->CrtcVDisplay, p->CrtcVBlankStart, - p->CrtcVSyncStart, p->CrtcVSyncEnd, p->CrtcVBlankEnd, - p->CrtcVTotal); -#endif - p = p->next; - } while (p != NULL && p != scrp->modes); -} - - -static void -add(char **p, char *new) -{ - *p = xnfrealloc(*p, strlen(*p) + strlen(new) + 2); - strcat(*p, " "); - strcat(*p, new); -} - -static void -PrintModeline(int scrnIndex,DisplayModePtr mode) -{ - char tmp[256]; - char *flags = xnfcalloc(1, 1); - - if (mode->HSkew) { - snprintf(tmp, 256, "hskew %i", mode->HSkew); - add(&flags, tmp); - } - if (mode->VScan) { - snprintf(tmp, 256, "vscan %i", mode->VScan); - add(&flags, tmp); - } - if (mode->Flags & V_INTERLACE) add(&flags, "interlace"); - if (mode->Flags & V_CSYNC) add(&flags, "composite"); - if (mode->Flags & V_DBLSCAN) add(&flags, "doublescan"); - if (mode->Flags & V_BCAST) add(&flags, "bcast"); - if (mode->Flags & V_PHSYNC) add(&flags, "+hsync"); - if (mode->Flags & V_NHSYNC) add(&flags, "-hsync"); - if (mode->Flags & V_PVSYNC) add(&flags, "+vsync"); - if (mode->Flags & V_NVSYNC) add(&flags, "-vsync"); - if (mode->Flags & V_PCSYNC) add(&flags, "+csync"); - if (mode->Flags & V_NCSYNC) add(&flags, "-csync"); -#if 0 - if (mode->Flags & V_CLKDIV2) add(&flags, "vclk/2"); -#endif - xf86DrvMsgVerb(scrnIndex, X_INFO, 3, - "Modeline \"%s\" %6.2f %i %i %i %i %i %i %i %i%s\n", - mode->name, mode->Clock/1000., mode->HDisplay, - mode->HSyncStart, mode->HSyncEnd, mode->HTotal, - mode->VDisplay, mode->VSyncStart, mode->VSyncEnd, - mode->VTotal, flags); - xfree(flags); -} - -void -xf86PrintModes(ScrnInfoPtr scrp) -{ - DisplayModePtr p; - float hsync, refresh = 0; - char *desc, *desc2, *prefix, *uprefix; - - if (scrp == NULL) - return; - - xf86DrvMsg(scrp->scrnIndex, scrp->virtualFrom, "Virtual size is %dx%d " - "(pitch %d)\n", scrp->virtualX, scrp->virtualY, - scrp->displayWidth); - - p = scrp->modes; - if (p == NULL) - return; - - do { - desc = desc2 = ""; - hsync = ModeHSync(p); - refresh = ModeVRefresh(p); - if (p->Flags & V_INTERLACE) { - desc = " (I)"; - } - if (p->Flags & V_DBLSCAN) { - desc = " (D)"; - } - if (p->VScan > 1) { - desc2 = " (VScan)"; - } - if (p->type & M_T_BUILTIN) - prefix = "Built-in mode"; - else if (p->type & M_T_DEFAULT) - prefix = "Default mode"; - else - prefix = "Mode"; - if (p->type & M_T_USERDEF) - uprefix = "*"; - else - uprefix = " "; - if (hsync == 0 || refresh == 0) { - if (p->name) - xf86DrvMsg(scrp->scrnIndex, X_CONFIG, - "%s%s \"%s\"\n", uprefix, prefix, p->name); - else - xf86DrvMsg(scrp->scrnIndex, X_PROBED, - "%s%s %dx%d (unnamed)\n", - uprefix, prefix, p->HDisplay, p->VDisplay); - } else if (p->Clock == p->SynthClock) { - xf86DrvMsg(scrp->scrnIndex, X_CONFIG, - "%s%s \"%s\": %.1f MHz, %.1f kHz, %.1f Hz%s%s\n", - uprefix, prefix, p->name, p->Clock / 1000.0, - hsync, refresh, desc, desc2); - } else { - xf86DrvMsg(scrp->scrnIndex, X_CONFIG, - "%s%s \"%s\": %.1f MHz (scaled from %.1f MHz), " - "%.1f kHz, %.1f Hz%s%s\n", - uprefix, prefix, p->name, p->Clock / 1000.0, - p->SynthClock / 1000.0, hsync, refresh, desc, desc2); - } - if (hsync != 0 && refresh != 0) - PrintModeline(scrp->scrnIndex,p); - p = p->next; - } while (p != NULL && p != scrp->modes); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Module.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Module.h deleted file mode 100644 index 84c3e32c3..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Module.h +++ /dev/null @@ -1,226 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Module.h,v 1.37 2003/08/24 17:36:54 dawes Exp $ */ - -/* - * Copyright (c) 1997-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * This file contains the parts of the loader interface that are visible - * to modules. This is the only loader-related header that modules should - * include. - * - * It should include a bare minimum of other headers. - * - * Longer term, the module/loader code should probably live directly under - * Xserver/. - * - * XXX This file arguably belongs in xfree86/loader/. - */ - -#ifndef _XF86MODULE_H -#define _XF86MODULE_H - -#include "misc.h" -#include "xf86Version.h" -#ifndef NULL -#define NULL ((void *)0) -#endif - -typedef enum { - LD_RESOLV_IFDONE = 0, /* only check if no more - delays pending */ - LD_RESOLV_NOW = 1, /* finish one delay step */ - LD_RESOLV_FORCE = 2 /* force checking... */ -} LoaderResolveOptions; - -#define DEFAULT_LIST ((char *)-1) - -/* This indicates a special module that doesn't have the usual entry point */ -#define EXTERN_MODULE ((pointer)-1) - -/* Built-in ABI classes. These definitions must not be changed. */ -#define ABI_CLASS_NONE NULL -#define ABI_CLASS_ANSIC "X.Org ANSI C Emulation" -#define ABI_CLASS_VIDEODRV "X.Org Video Driver" -#define ABI_CLASS_XINPUT "X.Org XInput driver" -#define ABI_CLASS_EXTENSION "X.Org Server Extension" -#define ABI_CLASS_FONT "X.Org Font Renderer" - -#define ABI_MINOR_MASK 0x0000FFFF -#define ABI_MAJOR_MASK 0xFFFF0000 -#define GET_ABI_MINOR(v) ((v) & ABI_MINOR_MASK) -#define GET_ABI_MAJOR(v) (((v) & ABI_MAJOR_MASK) >> 16) -#define SET_ABI_VERSION(maj, min) \ - ((((maj) << 16) & ABI_MAJOR_MASK) | ((min) & ABI_MINOR_MASK)) - -/* - * ABI versions. Each version has a major and minor revision. Modules - * using lower minor revisions must work with servers of a higher minor - * revision. There is no compatibility between different major revisions. - * Whenever the ABI_ANSIC_VERSION is changed, the others must also be - * changed. The minor revision mask is 0x0000FFFF and the major revision - * mask is 0xFFFF0000. - */ -#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 2) -#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(0, 8) -#define ABI_XINPUT_VERSION SET_ABI_VERSION(0, 5) -#define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 2) -#define ABI_FONT_VERSION SET_ABI_VERSION(0, 4) - -#define MODINFOSTRING1 0xef23fdc5 -#define MODINFOSTRING2 0x10dc023a - -#ifndef MODULEVENDORSTRING -#ifndef __OS2ELF__ -#define MODULEVENDORSTRING "X.Org Foundation" -#else -#define MODULEVENDORSTRING "X.Org Foundation - OS2" -#endif -#endif - -/* Error return codes for errmaj. New codes must only be added at the end. */ -typedef enum { - LDR_NOERROR = 0, - LDR_NOMEM, /* memory allocation failed */ - LDR_NOENT, /* Module file does not exist */ - LDR_NOSUBENT, /* pre-requsite file to be sub-loaded does not exist */ - LDR_NOSPACE, /* internal module array full */ - LDR_NOMODOPEN, /* module file could not be opened (check errmin) */ - LDR_UNKTYPE, /* file is not a recognized module type */ - LDR_NOLOAD, /* type specific loader failed */ - LDR_ONCEONLY, /* Module should only be loaded once (not an error) */ - LDR_NOPORTOPEN, /* could not open port (check errmin) */ - LDR_NOHARDWARE, /* could not query/initialize the hardware device */ - LDR_MISMATCH, /* the module didn't match the spec'd requirments */ - LDR_BADUSAGE, /* LoadModule is called with bad arguments */ - LDR_INVALID, /* The module doesn't have a valid ModuleData object */ - LDR_BADOS, /* The module doesn't support the OS */ - LDR_MODSPECIFIC /* A module-specific error in the SetupProc */ -} LoaderErrorCode; - -/* - * Some common module classes. The moduleclass can be used to identify - * that modules loaded are of the correct type. This is a finer - * classification than the ABI classes even though the default set of - * classes have the same names. For example, not all modules that require - * the video driver ABI are themselves video drivers. - */ -#define MOD_CLASS_NONE NULL -#define MOD_CLASS_VIDEODRV "X.Org Video Driver" -#define MOD_CLASS_XINPUT "X.Org XInput Driver" -#define MOD_CLASS_FONT "X.Org Font Renderer" -#define MOD_CLASS_EXTENSION "X.Org Server Extension" - -/* This structure is expected to be returned by the initfunc */ -typedef struct { - const char * modname; /* name of module, e.g. "foo" */ - const char * vendor; /* vendor specific string */ - CARD32 _modinfo1_; /* constant MODINFOSTRING1/2 to find */ - CARD32 _modinfo2_; /* infoarea with a binary editor or sign tool */ - CARD32 xf86version; /* contains XF86_VERSION_CURRENT */ - CARD8 majorversion; /* module-specific major version */ - CARD8 minorversion; /* module-specific minor version */ - CARD16 patchlevel; /* module-specific patch level */ - const char * abiclass; /* ABI class that the module uses */ - CARD32 abiversion; /* ABI version */ - const char * moduleclass; /* module class description */ - CARD32 checksum[4]; /* contains a digital signature of the */ - /* version info structure */ -} XF86ModuleVersionInfo; - -/* - * This structure can be used to callers of LoadModule and LoadSubModule to - * specify version and/or ABI requirements. - */ -typedef struct { - CARD8 majorversion; /* module-specific major version */ - CARD8 minorversion; /* moudle-specific minor version */ - CARD16 patchlevel; /* module-specific patch level */ - const char * abiclass; /* ABI class that the module uses */ - CARD32 abiversion; /* ABI version */ - const char * moduleclass; /* module class */ -} XF86ModReqInfo; - -/* values to indicate unspecified fields in XF86ModReqInfo. */ -#define MAJOR_UNSPEC 0xFF -#define MINOR_UNSPEC 0xFF -#define PATCH_UNSPEC 0xFFFF -#define ABI_VERS_UNSPEC 0xFFFFFFFF - -#define MODULE_VERSION_NUMERIC(maj, min, patch) \ - ((((maj) & 0xFF) << 24) | (((min) & 0xFF) << 16) | (patch & 0xFFFF)) -#define GET_MODULE_MAJOR_VERSION(vers) (((vers) >> 24) & 0xFF) -#define GET_MODULE_MINOR_VERSION(vers) (((vers) >> 16) & 0xFF) -#define GET_MODULE_PATCHLEVEL(vers) ((vers) & 0xFFFF) - -#define INITARGS void - -typedef void (*InitExtension)(INITARGS); - -typedef struct { - InitExtension initFunc; - const char * name; - Bool *disablePtr; - InitExtension setupFunc; - const char ** initDependencies; -} ExtensionModule; - -extern ExtensionModule *ExtensionModuleList; - -/* Prototypes for Loader functions that are exported to modules */ -#ifndef IN_LOADER -/* Prototypes with opaque pointers for use by modules */ -pointer LoadSubModule(pointer, const char *, const char **, - const char **, pointer, const XF86ModReqInfo *, - int *, int *); -void UnloadSubModule(pointer); -void LoadFont(pointer); -void UnloadModule (pointer); -#endif -pointer LoaderSymbol(const char *); -char **LoaderListDirs(const char **, const char **); -void LoaderFreeDirList(char **); -void LoaderErrorMsg(const char *, const char *, int, int); -void LoadExtension(ExtensionModule *, Bool); -void LoaderRefSymLists(const char **, ...); -void LoaderRefSymbols(const char *, ...); -void LoaderReqSymLists(const char **, ...); -void LoaderReqSymbols(const char *, ...); -int LoaderCheckUnresolved(int); -void LoaderGetOS(const char **name, int *major, int *minor, int *teeny); - -typedef pointer (*ModuleSetupProc)(pointer, pointer, int *, int *); -typedef void (*ModuleTearDownProc)(pointer); -#define MODULESETUPPROTO(func) pointer func(pointer, pointer, int*, int*) -#define MODULETEARDOWNPROTO(func) void func(pointer) - -typedef struct { - XF86ModuleVersionInfo * vers; - ModuleSetupProc setup; - ModuleTearDownProc teardown; -} XF86ModuleData; - -#endif /* _XF86STR_H */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Opt.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Opt.h deleted file mode 100644 index 718732353..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Opt.h +++ /dev/null @@ -1,114 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Opt.h,v 1.15 2003/10/08 14:30:38 dawes Exp $ */ - -/* - * Copyright (c) 1998-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* Option handling things that ModuleSetup procs can use */ - -#ifndef _XF86_OPT_H_ -#define _XF86_OPT_H_ - -typedef struct { - double freq; - int units; -} OptFrequency; - -typedef union { - unsigned long num; - char * str; - double realnum; - Bool bool; - OptFrequency freq; -} ValueUnion; - -typedef enum { - OPTV_NONE = 0, - OPTV_INTEGER, - OPTV_STRING, /* a non-empty string */ - OPTV_ANYSTR, /* Any string, including an empty one */ - OPTV_REAL, - OPTV_BOOLEAN, - OPTV_FREQ -} OptionValueType; - -typedef enum { - OPTUNITS_HZ = 1, - OPTUNITS_KHZ, - OPTUNITS_MHZ -} OptFreqUnits; - -typedef struct { - int token; - const char* name; - OptionValueType type; - ValueUnion value; - Bool found; -} OptionInfoRec, *OptionInfoPtr; - -int xf86SetIntOption(pointer optlist, const char *name, int deflt); -double xf86SetRealOption(pointer optlist, const char *name, double deflt); -char *xf86SetStrOption(pointer optlist, const char *name, char *deflt); -int xf86SetBoolOption(pointer list, const char *name, int deflt ); -int xf86CheckIntOption(pointer optlist, const char *name, int deflt); -double xf86CheckRealOption(pointer optlist, const char *name, double deflt); -char *xf86CheckStrOption(pointer optlist, const char *name, char *deflt); -int xf86CheckBoolOption(pointer list, const char *name, int deflt ); -pointer xf86AddNewOption(pointer head, const char *name, const char *val ); -pointer xf86NewOption(char *name, char *value ); -pointer xf86NextOption(pointer list ); -pointer xf86OptionListCreate(const char **options, int count, int used); -pointer xf86OptionListMerge(pointer head, pointer tail); -void xf86OptionListFree(pointer opt); -char *xf86OptionName(pointer opt); -char *xf86OptionValue(pointer opt); -void xf86OptionListReport(pointer parm); -pointer xf86FindOption(pointer options, const char *name); -char *xf86FindOptionValue(pointer options, const char *name); -void xf86MarkOptionUsed(pointer option); -void xf86MarkOptionUsedByName(pointer options, const char *name); -Bool xf86CheckIfOptionUsed(pointer option); -Bool xf86CheckIfOptionUsedByName(pointer options, const char *name); -void xf86ShowUnusedOptions(int scrnIndex, pointer options); -void xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo); -OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, int token); -const char *xf86TokenToOptName(const OptionInfoRec *table, int token); -Bool xf86IsOptionSet(const OptionInfoRec *table, int token); -char *xf86GetOptValString(const OptionInfoRec *table, int token); -Bool xf86GetOptValInteger(const OptionInfoRec *table, int token, int *value); -Bool xf86GetOptValULong(const OptionInfoRec *table, int token, unsigned long *value); -Bool xf86GetOptValReal(const OptionInfoRec *table, int token, double *value); -Bool xf86GetOptValFreq(const OptionInfoRec *table, int token, - OptFreqUnits expectedUnits, double *value); -Bool xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value); -Bool xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def); -int xf86NameCmp(const char *s1, const char *s2); -char *xf86NormalizeName(const char *s); -pointer xf86ReplaceIntOption(pointer optlist, const char *name, const int val); -pointer xf86ReplaceRealOption(pointer optlist, const char *name, const double val); -pointer xf86ReplaceBoolOption(pointer optlist, const char *name, const Bool val); -pointer xf86ReplaceStrOption(pointer optlist, const char *name, const char* val); -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Option.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Option.c deleted file mode 100644 index 9bffdee70..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Option.c +++ /dev/null @@ -1,884 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Option.c,v 1.29 2003/10/18 12:34:19 dawes Exp $ */ -/* - * Copyright (c) 1998-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * Author: David Dawes - * - * This file includes public option handling functions. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include "os.h" -#include "xf86.h" -#include "xf86Xinput.h" -#include "xf86Optrec.h" - -static Bool ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p, - Bool markUsed); - -/* - * xf86CollectOptions collects the options from each of the config file - * sections used by the screen and puts the combined list in pScrn->options. - * This function requires that the following have been initialised: - * - * pScrn->confScreen - * pScrn->Entities[i]->device - * pScrn->display - * pScrn->monitor - * - * The extraOpts parameter may optionally contain a list of additional options - * to include. - * - * The order of precedence for options is: - * - * extraOpts, display, confScreen, monitor, device - */ - -void -xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts) -{ - XF86OptionPtr tmp; - XF86OptionPtr extras = (XF86OptionPtr)extraOpts; - GDevPtr device; - - int i; - - pScrn->options = NULL; - - for (i=pScrn->numEntities - 1; i >= 0; i--) { - device = xf86GetDevFromEntity(pScrn->entityList[i], - pScrn->entityInstanceList[i]); - if (device && device->options) { - tmp = xf86optionListDup(device->options); - if (pScrn->options) - xf86optionListMerge(pScrn->options,tmp); - else - pScrn->options = tmp; - } - } - if (pScrn->monitor->options) { - tmp = xf86optionListDup(pScrn->monitor->options); - if (pScrn->options) - pScrn->options = xf86optionListMerge(pScrn->options, tmp); - else - pScrn->options = tmp; - } - if (pScrn->confScreen->options) { - tmp = xf86optionListDup(pScrn->confScreen->options); - if (pScrn->options) - pScrn->options = xf86optionListMerge(pScrn->options, tmp); - else - pScrn->options = tmp; - } - if (pScrn->display->options) { - tmp = xf86optionListDup(pScrn->display->options); - if (pScrn->options) - pScrn->options = xf86optionListMerge(pScrn->options, tmp); - else - pScrn->options = tmp; - } - if (extras) { - tmp = xf86optionListDup(extras); - if (pScrn->options) - pScrn->options = xf86optionListMerge(pScrn->options, tmp); - else - pScrn->options = tmp; - } -} - -/* - * xf86CollectInputOptions collects the options for an InputDevice. - * This function requires that the following has been initialised: - * - * pInfo->conf_idev - * - * The extraOpts parameter may optionally contain a list of additional options - * to include. - * - * The order of precedence for options is: - * - * extraOpts, pInfo->conf_idev->extraOptions, - * pInfo->conf_idev->commonOptions, defaultOpts - */ - -void -xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts, - pointer extraOpts) -{ - XF86OptionPtr tmp; - XF86OptionPtr extras = (XF86OptionPtr)extraOpts; - - pInfo->options = NULL; - if (defaultOpts) { - pInfo->options = xf86OptionListCreate(defaultOpts, -1, 0); - } - if (pInfo->conf_idev->commonOptions) { - tmp = xf86optionListDup(pInfo->conf_idev->commonOptions); - if (pInfo->options) - pInfo->options = xf86optionListMerge(pInfo->options, tmp); - else - pInfo->options = tmp; - } - if (pInfo->conf_idev->extraOptions) { - tmp = xf86optionListDup(pInfo->conf_idev->extraOptions); - if (pInfo->options) - pInfo->options = xf86optionListMerge(pInfo->options, tmp); - else - pInfo->options = tmp; - } - if (extras) { - tmp = xf86optionListDup(extras); - if (pInfo->options) - pInfo->options = xf86optionListMerge(pInfo->options, tmp); - else - pInfo->options = tmp; - } -} - -/* Created for new XInput stuff -- essentially extensions to the parser */ - -static int -LookupIntOption(pointer optlist, const char *name, int deflt, Bool markUsed) -{ - OptionInfoRec o; - - o.name = name; - o.type = OPTV_INTEGER; - if (ParseOptionValue(-1, optlist, &o, markUsed)) - deflt = o.value.num; - return deflt; -} - - -static double -LookupRealOption(pointer optlist, const char *name, double deflt, - Bool markUsed) -{ - OptionInfoRec o; - - o.name = name; - o.type = OPTV_REAL; - if (ParseOptionValue(-1, optlist, &o, markUsed)) - deflt = o.value.realnum; - return deflt; -} - - -static char * -LookupStrOption(pointer optlist, const char *name, char *deflt, Bool markUsed) -{ - OptionInfoRec o; - - o.name = name; - o.type = OPTV_STRING; - if (ParseOptionValue(-1, optlist, &o, markUsed)) - deflt = o.value.str; - if (deflt) - return xstrdup(deflt); - else - return NULL; -} - - -static int -LookupBoolOption(pointer optlist, const char *name, int deflt, Bool markUsed) -{ - OptionInfoRec o; - - o.name = name; - o.type = OPTV_BOOLEAN; - if (ParseOptionValue(-1, optlist, &o, markUsed)) - deflt = o.value.bool; - return deflt; -} - -/* These xf86Set* functions are intended for use by non-screen specific code */ - -int -xf86SetIntOption(pointer optlist, const char *name, int deflt) -{ - return LookupIntOption(optlist, name, deflt, TRUE); -} - - -double -xf86SetRealOption(pointer optlist, const char *name, double deflt) -{ - return LookupRealOption(optlist, name, deflt, TRUE); -} - - -char * -xf86SetStrOption(pointer optlist, const char *name, char *deflt) -{ - return LookupStrOption(optlist, name, deflt, TRUE); -} - - -int -xf86SetBoolOption(pointer optlist, const char *name, int deflt) -{ - return LookupBoolOption(optlist, name, deflt, TRUE); -} - -/* - * These are like the Set*Option functions, but they don't mark the options - * as used. - */ -int -xf86CheckIntOption(pointer optlist, const char *name, int deflt) -{ - return LookupIntOption(optlist, name, deflt, FALSE); -} - - -double -xf86CheckRealOption(pointer optlist, const char *name, double deflt) -{ - return LookupRealOption(optlist, name, deflt, FALSE); -} - - -char * -xf86CheckStrOption(pointer optlist, const char *name, char *deflt) -{ - return LookupStrOption(optlist, name, deflt, FALSE); -} - - -int -xf86CheckBoolOption(pointer optlist, const char *name, int deflt) -{ - return LookupBoolOption(optlist, name, deflt, FALSE); -} - -/* - * addNewOption() has the required property of replacing the option value - * if the option is already present. - */ -pointer -xf86ReplaceIntOption(pointer optlist, const char *name, const int val) -{ - char *tmp = xnfalloc(16); - sprintf(tmp,"%i",val); - return xf86AddNewOption(optlist,name,tmp); -} - -pointer -xf86ReplaceRealOption(pointer optlist, const char *name, const double val) -{ - char *tmp = xnfalloc(32); - snprintf(tmp,32,"%f",val); - return xf86AddNewOption(optlist,name,tmp); -} - -pointer -xf86ReplaceBoolOption(pointer optlist, const char *name, const Bool val) -{ - return xf86AddNewOption(optlist,name,val?"True":"False"); -} - -pointer -xf86ReplaceStrOption(pointer optlist, const char *name, const char* val) -{ - return xf86AddNewOption(optlist,name,val); -} - -pointer -xf86AddNewOption(pointer head, const char *name, const char *val) -{ - /* XXX These should actually be allocated in the parser library. */ - char *tmp = strdup(val); - char *tmp_name = strdup(name); - - return xf86addNewOption(head, tmp_name, tmp); -} - - -pointer -xf86NewOption(char *name, char *value) -{ - return xf86newOption(name, value); -} - - -pointer -xf86NextOption(pointer list) -{ - return xf86nextOption(list); -} - -pointer -xf86OptionListCreate(const char **options, int count, int used) -{ - return xf86optionListCreate(options, count, used); -} - -pointer -xf86OptionListMerge(pointer head, pointer tail) -{ - return xf86optionListMerge(head, tail); -} - -void -xf86OptionListFree(pointer opt) -{ - xf86optionListFree(opt); -} - -char * -xf86OptionName(pointer opt) -{ - return xf86optionName(opt); -} - -char * -xf86OptionValue(pointer opt) -{ - return xf86optionValue(opt); -} - -void -xf86OptionListReport(pointer parm) -{ - XF86OptionPtr opts = parm; - - while(opts) { - if (xf86optionValue(opts)) - xf86ErrorFVerb(5, "\tOption \"%s\" \"%s\"\n", - xf86optionName(opts), xf86optionValue(opts)); - else - xf86ErrorFVerb( 5, "\tOption \"%s\"\n", xf86optionName(opts)); - opts = xf86nextOption(opts); - } -} - -/* End of XInput-caused section */ - -pointer -xf86FindOption(pointer options, const char *name) -{ - return xf86findOption(options, name); -} - - -char * -xf86FindOptionValue(pointer options, const char *name) -{ - return xf86findOptionValue(options, name); -} - - -void -xf86MarkOptionUsed(pointer option) -{ - if (option != NULL) - ((XF86OptionPtr)option)->opt_used = TRUE; -} - - -void -xf86MarkOptionUsedByName(pointer options, const char *name) -{ - XF86OptionPtr opt; - - opt = xf86findOption(options, name); - if (opt != NULL) - opt->opt_used = TRUE; -} - -Bool -xf86CheckIfOptionUsed(pointer option) -{ - if (option != NULL) - return ((XF86OptionPtr)option)->opt_used; - else - return FALSE; -} - -Bool -xf86CheckIfOptionUsedByName(pointer options, const char *name) -{ - XF86OptionPtr opt; - - opt = xf86findOption(options, name); - if (opt != NULL) - return opt->opt_used; - else - return FALSE; -} - -void -xf86ShowUnusedOptions(int scrnIndex, pointer options) -{ - XF86OptionPtr opt = options; - - while (opt) { - if (opt->opt_name && !opt->opt_used) { - xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" is not used\n", - opt->opt_name); - } - opt = opt->list.next; - } -} - - -static Bool -GetBoolValue(OptionInfoPtr p, const char *s) -{ - if (*s == '\0') { - p->value.bool = TRUE; - } else { - if (xf86NameCmp(s, "1") == 0) - p->value.bool = TRUE; - else if (xf86NameCmp(s, "on") == 0) - p->value.bool = TRUE; - else if (xf86NameCmp(s, "true") == 0) - p->value.bool = TRUE; - else if (xf86NameCmp(s, "yes") == 0) - p->value.bool = TRUE; - else if (xf86NameCmp(s, "0") == 0) - p->value.bool = FALSE; - else if (xf86NameCmp(s, "off") == 0) - p->value.bool = FALSE; - else if (xf86NameCmp(s, "false") == 0) - p->value.bool = FALSE; - else if (xf86NameCmp(s, "no") == 0) - p->value.bool = FALSE; - else - return FALSE; - } - return TRUE; -} - -static Bool -ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p, - Bool markUsed) -{ - char *s, *end; - Bool wasUsed = FALSE; - - if ((s = xf86findOptionValue(options, p->name)) != NULL) { - if (markUsed) { - wasUsed = xf86CheckIfOptionUsedByName(options, p->name); - xf86MarkOptionUsedByName(options, p->name); - } - switch (p->type) { - case OPTV_INTEGER: - if (*s == '\0') { - xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires an integer value\n", - p->name); - p->found = FALSE; - } else { - p->value.num = strtoul(s, &end, 0); - if (*end == '\0') { - p->found = TRUE; - } else { - xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires an integer value\n", - p->name); - p->found = FALSE; - } - } - break; - case OPTV_STRING: - if (*s == '\0') { - xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires an string value\n", - p->name); - p->found = FALSE; - } else { - p->value.str = s; - p->found = TRUE; - } - break; - case OPTV_ANYSTR: - p->value.str = s; - p->found = TRUE; - break; - case OPTV_REAL: - if (*s == '\0') { - xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires a floating point value\n", - p->name); - p->found = FALSE; - } else { - p->value.realnum = strtod(s, &end); - if (*end == '\0') { - p->found = TRUE; - } else { - xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires a floating point value\n", - p->name); - p->found = FALSE; - } - } - break; - case OPTV_BOOLEAN: - if (GetBoolValue(p, s)) { - p->found = TRUE; - } else { - xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires a boolean value\n", p->name); - p->found = FALSE; - } - break; - case OPTV_FREQ: - if (*s == '\0') { - xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires a frequency value\n", - p->name); - p->found = FALSE; - } else { - double freq = strtod(s, &end); - int units = 0; - - if (end != s) { - p->found = TRUE; - if (!xf86NameCmp(end, "Hz")) - units = 1; - else if (!xf86NameCmp(end, "kHz") || - !xf86NameCmp(end, "k")) - units = 1000; - else if (!xf86NameCmp(end, "MHz") || - !xf86NameCmp(end, "M")) - units = 1000000; - else { - xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires a frequency value\n", - p->name); - p->found = FALSE; - } - if (p->found) - freq *= (double)units; - } else { - xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires a frequency value\n", - p->name); - p->found = FALSE; - } - if (p->found) { - p->value.freq.freq = freq; - p->value.freq.units = units; - } - } - break; - case OPTV_NONE: - /* Should never get here */ - p->found = FALSE; - break; - } - if (p->found && markUsed) { - int verb = 2; - if (wasUsed) - verb = 4; - xf86DrvMsgVerb(scrnIndex, X_CONFIG, verb, "Option \"%s\"", p->name); - if (!(p->type == OPTV_BOOLEAN && *s == 0)) { - xf86ErrorFVerb(verb, " \"%s\"", s); - } - xf86ErrorFVerb(verb, "\n"); - } - } else if (p->type == OPTV_BOOLEAN) { - /* Look for matches with options with or without a "No" prefix. */ - char *n, *newn; - OptionInfoRec opt; - - n = xf86NormalizeName(p->name); - if (!n) { - p->found = FALSE; - return FALSE; - } - if (strncmp(n, "no", 2) == 0) { - newn = n + 2; - } else { - xfree(n); - n = xalloc(strlen(p->name) + 2 + 1); - if (!n) { - p->found = FALSE; - return FALSE; - } - strcpy(n, "No"); - strcat(n, p->name); - newn = n; - } - if ((s = xf86findOptionValue(options, newn)) != NULL) { - if (markUsed) - xf86MarkOptionUsedByName(options, newn); - if (GetBoolValue(&opt, s)) { - p->value.bool = !opt.value.bool; - p->found = TRUE; - } else { - xf86DrvMsg(scrnIndex, X_WARNING, - "Option \"%s\" requires a boolean value\n", newn); - p->found = FALSE; - } - } else { - p->found = FALSE; - } - if (p->found && markUsed) { - xf86DrvMsgVerb(scrnIndex, X_CONFIG, 2, "Option \"%s\"", newn); - if (*s != 0) { - xf86ErrorFVerb(2, " \"%s\"", s); - } - xf86ErrorFVerb(2, "\n"); - } - xfree(n); - } else { - p->found = FALSE; - } - return p->found; -} - - -void -xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo) -{ - OptionInfoPtr p; - - for (p = optinfo; p->name != NULL; p++) { - ParseOptionValue(scrnIndex, options, p, TRUE); - } -} - - -OptionInfoPtr -xf86TokenToOptinfo(const OptionInfoRec *table, int token) -{ - const OptionInfoRec *p, *match = NULL, *set = NULL; - - if (!table) { - ErrorF("xf86TokenToOptinfo: table is NULL\n"); - return NULL; - } - - for (p = table; p->token >= 0; p++) { - if (p->token == token) { - match = p; - if (p->found) - set = p; - } - } - - if (set) - return (OptionInfoPtr)set; - else if (match) - return (OptionInfoPtr)match; - else - return NULL; -} - - -const char * -xf86TokenToOptName(const OptionInfoRec *table, int token) -{ - const OptionInfoRec *p; - - p = xf86TokenToOptinfo(table, token); - return p->name; -} - - -Bool -xf86IsOptionSet(const OptionInfoRec *table, int token) -{ - OptionInfoPtr p; - - p = xf86TokenToOptinfo(table, token); - return (p && p->found); -} - - -char * -xf86GetOptValString(const OptionInfoRec *table, int token) -{ - OptionInfoPtr p; - - p = xf86TokenToOptinfo(table, token); - if (p && p->found) - return p->value.str; - else - return NULL; -} - - -Bool -xf86GetOptValInteger(const OptionInfoRec *table, int token, int *value) -{ - OptionInfoPtr p; - - p = xf86TokenToOptinfo(table, token); - if (p && p->found) { - *value = p->value.num; - return TRUE; - } else - return FALSE; -} - - -Bool -xf86GetOptValULong(const OptionInfoRec *table, int token, unsigned long *value) -{ - OptionInfoPtr p; - - p = xf86TokenToOptinfo(table, token); - if (p && p->found) { - *value = p->value.num; - return TRUE; - } else - return FALSE; -} - - -Bool -xf86GetOptValReal(const OptionInfoRec *table, int token, double *value) -{ - OptionInfoPtr p; - - p = xf86TokenToOptinfo(table, token); - if (p && p->found) { - *value = p->value.realnum; - return TRUE; - } else - return FALSE; -} - - -Bool -xf86GetOptValFreq(const OptionInfoRec *table, int token, - OptFreqUnits expectedUnits, double *value) -{ - OptionInfoPtr p; - - p = xf86TokenToOptinfo(table, token); - if (p && p->found) { - if (p->value.freq.units > 0) { - /* Units give, so the scaling is known. */ - switch (expectedUnits) { - case OPTUNITS_HZ: - *value = p->value.freq.freq; - break; - case OPTUNITS_KHZ: - *value = p->value.freq.freq / 1000.0; - break; - case OPTUNITS_MHZ: - *value = p->value.freq.freq / 1000000.0; - break; - } - } else { - /* No units given, so try to guess the scaling. */ - switch (expectedUnits) { - case OPTUNITS_HZ: - *value = p->value.freq.freq; - break; - case OPTUNITS_KHZ: - if (p->value.freq.freq > 1000.0) - *value = p->value.freq.freq / 1000.0; - else - *value = p->value.freq.freq; - break; - case OPTUNITS_MHZ: - if (p->value.freq.freq > 1000000.0) - *value = p->value.freq.freq / 1000000.0; - else if (p->value.freq.freq > 1000.0) - *value = p->value.freq.freq / 1000.0; - else - *value = p->value.freq.freq; - } - } - return TRUE; - } else - return FALSE; -} - - -Bool -xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value) -{ - OptionInfoPtr p; - - p = xf86TokenToOptinfo(table, token); - if (p && p->found) { - *value = p->value.bool; - return TRUE; - } else - return FALSE; -} - - -Bool -xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def) -{ - OptionInfoPtr p; - - p = xf86TokenToOptinfo(table, token); - if (p && p->found) { - return p->value.bool; - } else - return def; -} - - -int -xf86NameCmp(const char *s1, const char *s2) -{ - return xf86nameCompare(s1, s2); -} - -char * -xf86NormalizeName(const char *s) -{ - char *ret, *q; - const char *p; - - if (s == NULL) - return NULL; - - ret = xalloc(strlen(s) + 1); - for (p = s, q = ret; *p != 0; p++) { - switch (*p) { - case '_': - case ' ': - case '\t': - continue; - default: - if (isupper(*p)) - *q++ = tolower(*p); - else - *q++ = *p; - } - } - *q = '\0'; - return ret; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86PM.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86PM.c deleted file mode 100644 index 0262be3df..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86PM.c +++ /dev/null @@ -1,225 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PM.c,v 3.9 2003/08/24 17:36:54 dawes Exp $ */ -/* - * Copyright (c) 2000-2002 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Xinput.h" - -int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num) = NULL; -pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event) = NULL; - -static Bool suspended = FALSE; - -static int -eventName(pmEvent event, char **str) -{ - switch(event) { - case XF86_APM_SYS_STANDBY: *str="System Standby Request"; return 0; - case XF86_APM_SYS_SUSPEND: *str="System Suspend Request"; return 0; - case XF86_APM_CRITICAL_SUSPEND: *str="Critical Suspend"; return 0; - case XF86_APM_USER_STANDBY: *str="User System Standby Request"; return 0; - case XF86_APM_USER_SUSPEND: *str="User System Suspend Request"; return 0; - case XF86_APM_STANDBY_RESUME: *str="System Standby Resume"; return 0; - case XF86_APM_NORMAL_RESUME: *str="Normal Resume System"; return 0; - case XF86_APM_CRITICAL_RESUME: *str="Critical Resume System"; return 0; - case XF86_APM_LOW_BATTERY: *str="Battery Low"; return 3; - case XF86_APM_POWER_STATUS_CHANGE: *str="Power Status Change";return 3; - case XF86_APM_UPDATE_TIME: *str="Update Time";return 3; - case XF86_APM_CAPABILITY_CHANGED: *str="Capability Changed"; return 3; - case XF86_APM_STANDBY_FAILED: *str="Standby Request Failed"; return 0; - case XF86_APM_SUSPEND_FAILED: *str="Suspend Request Failed"; return 0; - default: *str="Unknown Event"; return 0; - } -} - -static void -suspend (pmEvent event, Bool undo) -{ - int i; - InputInfoPtr pInfo; - - xf86inSuspend = TRUE; - - for (i = 0; i < xf86NumScreens; i++) { - xf86EnableAccess(xf86Screens[i]); - if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE); - } -#if !defined(__EMX__) - pInfo = xf86InputDevs; - while (pInfo) { - DisableDevice(pInfo->dev); - pInfo = pInfo->next; - } -#endif - xf86EnterServerState(SETUP); - for (i = 0; i < xf86NumScreens; i++) { - xf86EnableAccess(xf86Screens[i]); - if (xf86Screens[i]->PMEvent) - xf86Screens[i]->PMEvent(i,event,undo); - else { - xf86Screens[i]->LeaveVT(i, 0); - xf86Screens[i]->vtSema = FALSE; - } - } - xf86AccessLeave(); - xf86AccessLeaveState(); -} - -static void -resume(pmEvent event, Bool undo) -{ - int i; - InputInfoPtr pInfo; - - xf86AccessEnter(); - xf86EnterServerState(SETUP); - for (i = 0; i < xf86NumScreens; i++) { - xf86EnableAccess(xf86Screens[i]); - if (xf86Screens[i]->PMEvent) - xf86Screens[i]->PMEvent(i,event,undo); - else { - xf86Screens[i]->vtSema = TRUE; - xf86Screens[i]->EnterVT(i, 0); - } - } - xf86EnterServerState(OPERATING); - for (i = 0; i < xf86NumScreens; i++) { - xf86EnableAccess(xf86Screens[i]); - if (xf86Screens[i]->EnableDisableFBAccess) - (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE); - } - SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); -#if !defined(__EMX__) - pInfo = xf86InputDevs; - while (pInfo) { - EnableDevice(pInfo->dev); - pInfo = pInfo->next; - } -#endif - xf86inSuspend = FALSE; -} - -static void -DoApmEvent(pmEvent event, Bool undo) -{ - /* - * we leave that as a global function for now. I don't know if - * this might cause problems in the future. It is a global server - * variable therefore it needs to be in a server info structure - */ - int i, setup = 0; - - switch(event) { -#if 0 - case XF86_APM_SYS_STANDBY: - case XF86_APM_USER_STANDBY: -#endif - case XF86_APM_SYS_SUSPEND: - case XF86_APM_CRITICAL_SUSPEND: /*do we want to delay a critical suspend?*/ - case XF86_APM_USER_SUSPEND: - /* should we do this ? */ - if (!undo && !suspended) { - suspend(event,undo); - suspended = TRUE; - } else if (undo && suspended) { - resume(event,undo); - suspended = FALSE; - } - break; -#if 0 - case XF86_APM_STANDBY_RESUME: -#endif - case XF86_APM_NORMAL_RESUME: - case XF86_APM_CRITICAL_RESUME: - if (suspended) { - resume(event,undo); - suspended = FALSE; - } - break; - default: - for (i = 0; i < xf86NumScreens; i++) { - if (xf86Screens[i]->PMEvent) { - if (!setup) xf86EnterServerState(SETUP); - setup = 1; - xf86EnableAccess(xf86Screens[i]); - xf86Screens[i]->PMEvent(i,event,undo); - } - } - if (setup) xf86EnterServerState(OPERATING); - break; - } -} - -#define MAX_NO_EVENTS 8 - -void -xf86HandlePMEvents(int fd, pointer data) -{ - pmEvent events[MAX_NO_EVENTS]; - int i,n; - Bool wait = FALSE; - - if (!xf86PMGetEventFromOs) - return; - - if ((n = xf86PMGetEventFromOs(fd,events,MAX_NO_EVENTS))) { - do { - for (i = 0; i < n; i++) { - char *str = NULL; - int verb = eventName(events[i],&str); - - xf86MsgVerb(X_INFO,verb,"PM Event received: %s\n",str); - DoApmEvent(events[i],FALSE); - switch (xf86PMConfirmEventToOs(fd,events[i])) { - case PM_WAIT: - wait = TRUE; - break; - case PM_CONTINUE: - wait = FALSE; - break; - case PM_FAILED: - DoApmEvent(events[i],TRUE); - wait = FALSE; - break; - default: - break; - } - } - if (wait) - n = xf86PMGetEventFromOs(fd,events,MAX_NO_EVENTS); - else - break; - } while (1); - } -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86PciInfo.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86PciInfo.h deleted file mode 100644 index 183797e24..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86PciInfo.h +++ /dev/null @@ -1,726 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.156 2003/10/30 15:26:33 tsi Exp $ */ - -/* - * Copyright (c) 1995-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * This file contains macros for the PCI Vendor and Device IDs for video - * cards plus a few other things that are needed in drivers or elsewhere. - * This information is used in several ways: - * 1. It is used by drivers and/or other code. - * 2. It is used by the pciid2c.pl script to determine what vendor data to - * include in the pcidata module that the X server loads. - * 3. A side-effect of 2. affects how config-generation works for - * otherwise "unknown" cards. - * - * Don't add entries here for vendors that don't make video cards, - * or for non-video devices unless they're needed by a driver or elsewhere. - * A comprehensive set of PCI vendor, device and subsystem data is - * auto-generated from the ../etc/pci.ids file using the pciids2c.pl script, - * and is used in both the scanpci module and the scanpci utility. Don't - * modify the pci.ids file. If new/corrected entries are required, add them - * to ../etc/extrapci.ids. - */ - -#ifndef _XF86_PCIINFO_H -#define _XF86_PCIINFO_H - -/* PCI Pseudo Vendor */ -#define PCI_VENDOR_GENERIC 0x00FF - -#define PCI_VENDOR_REAL3D 0x003D -#define PCI_VENDOR_COMPAQ 0x0E11 -#define PCI_VENDOR_ATI 0x1002 -#define PCI_VENDOR_AVANCE 0x1005 -#define PCI_VENDOR_TSENG 0x100C -#define PCI_VENDOR_NS 0x100B -#define PCI_VENDOR_WEITEK 0x100E -#define PCI_VENDOR_VIDEOLOGIC 0x1010 -#define PCI_VENDOR_DIGITAL 0x1011 -#define PCI_VENDOR_CIRRUS 0x1013 -#define PCI_VENDOR_AMD 0x1022 -#define PCI_VENDOR_TRIDENT 0x1023 -#define PCI_VENDOR_ALI 0x1025 -#define PCI_VENDOR_DELL 0x1028 -#define PCI_VENDOR_MATROX 0x102B -#define PCI_VENDOR_CHIPSTECH 0x102C -#define PCI_VENDOR_MIRO 0x1031 -#define PCI_VENDOR_NEC 0x1033 -#define PCI_VENDOR_SIS 0x1039 -#define PCI_VENDOR_HP 0x103C -#define PCI_VENDOR_SGS 0x104A -#define PCI_VENDOR_TI 0x104C -#define PCI_VENDOR_SONY 0x104D -#define PCI_VENDOR_OAK 0x104E -#define PCI_VENDOR_MOTOROLA 0x1057 -#define PCI_VENDOR_NUMNINE 0x105D -#define PCI_VENDOR_CYRIX 0x1078 -#define PCI_VENDOR_SUN 0x108E -#define PCI_VENDOR_DIAMOND 0x1092 -#define PCI_VENDOR_BROOKTREE 0x109E -#define PCI_VENDOR_NEOMAGIC 0x10C8 -#define PCI_VENDOR_NVIDIA 0x10DE -#define PCI_VENDOR_IMS 0x10E0 -#define PCI_VENDOR_INTEGRAPHICS 0x10EA -#define PCI_VENDOR_ALLIANCE 0x1142 -#define PCI_VENDOR_RENDITION 0x1163 -#define PCI_VENDOR_3DFX 0x121A -#define PCI_VENDOR_SMI 0x126F -#define PCI_VENDOR_TRITECH 0x1292 -#define PCI_VENDOR_NVIDIA_SGS 0x12D2 -#define PCI_VENDOR_VMWARE 0x15AD -#define PCI_VENDOR_3DLABS 0x3D3D -#define PCI_VENDOR_AVANCE_2 0x4005 -#define PCI_VENDOR_HERCULES 0x4843 -#define PCI_VENDOR_S3 0x5333 -#define PCI_VENDOR_INTEL 0x8086 -#define PCI_VENDOR_ARK 0xEDD8 - - -/* Generic */ -#define PCI_CHIP_VGA 0x0000 -#define PCI_CHIP_8514 0x0001 - -/* Real 3D */ -#define PCI_CHIP_I740_PCI 0x00D1 - -/* Compaq */ -#define PCI_CHIP_QV1280 0x3033 - -/* ATI */ -#define PCI_CHIP_RV380_3150 0x3150 -#define PCI_CHIP_RV380_3151 0x3151 -#define PCI_CHIP_RV380_3152 0x3152 -#define PCI_CHIP_RV380_3153 0x3153 -#define PCI_CHIP_RV380_3154 0x3154 -#define PCI_CHIP_RV380_3156 0x3156 -#define PCI_CHIP_RV380_3E50 0x3E50 -#define PCI_CHIP_RV380_3E51 0x3E51 -#define PCI_CHIP_RV380_3E52 0x3E52 -#define PCI_CHIP_RV380_3E53 0x3E53 -#define PCI_CHIP_RV380_3E54 0x3E54 -#define PCI_CHIP_RV380_3E56 0x3E56 -#define PCI_CHIP_RS100_4136 0x4136 -#define PCI_CHIP_RS200_4137 0x4137 -#define PCI_CHIP_R300_AD 0x4144 -#define PCI_CHIP_R300_AE 0x4145 -#define PCI_CHIP_R300_AF 0x4146 -#define PCI_CHIP_R300_AG 0x4147 -#define PCI_CHIP_R350_AH 0x4148 -#define PCI_CHIP_R350_AI 0x4149 -#define PCI_CHIP_R350_AJ 0x414A -#define PCI_CHIP_R350_AK 0x414B -#define PCI_CHIP_RV350_AP 0x4150 -#define PCI_CHIP_RV350_AQ 0x4151 -#define PCI_CHIP_RV360_AR 0x4152 -#define PCI_CHIP_RV350_AS 0x4153 -#define PCI_CHIP_RV350_AT 0x4154 -#define PCI_CHIP_RV350_4155 0x4155 -#define PCI_CHIP_RV350_AV 0x4156 -#define PCI_CHIP_MACH32 0x4158 -#define PCI_CHIP_RS250_4237 0x4237 -#define PCI_CHIP_R200_BB 0x4242 -#define PCI_CHIP_R200_BC 0x4243 -#define PCI_CHIP_RS100_4336 0x4336 -#define PCI_CHIP_RS200_4337 0x4337 -#define PCI_CHIP_MACH64CT 0x4354 -#define PCI_CHIP_MACH64CX 0x4358 -#define PCI_CHIP_RS250_4437 0x4437 -#define PCI_CHIP_MACH64ET 0x4554 -#define PCI_CHIP_MACH64GB 0x4742 -#define PCI_CHIP_MACH64GD 0x4744 -#define PCI_CHIP_MACH64GI 0x4749 -#define PCI_CHIP_MACH64GL 0x474C -#define PCI_CHIP_MACH64GM 0x474D -#define PCI_CHIP_MACH64GN 0x474E -#define PCI_CHIP_MACH64GO 0x474F -#define PCI_CHIP_MACH64GP 0x4750 -#define PCI_CHIP_MACH64GQ 0x4751 -#define PCI_CHIP_MACH64GR 0x4752 -#define PCI_CHIP_MACH64GS 0x4753 -#define PCI_CHIP_MACH64GT 0x4754 -#define PCI_CHIP_MACH64GU 0x4755 -#define PCI_CHIP_MACH64GV 0x4756 -#define PCI_CHIP_MACH64GW 0x4757 -#define PCI_CHIP_MACH64GX 0x4758 -#define PCI_CHIP_MACH64GY 0x4759 -#define PCI_CHIP_MACH64GZ 0x475A -#define PCI_CHIP_RV250_Id 0x4964 -#define PCI_CHIP_RV250_Ie 0x4965 -#define PCI_CHIP_RV250_If 0x4966 -#define PCI_CHIP_RV250_Ig 0x4967 -#define PCI_CHIP_R420_JH 0x4A48 -#define PCI_CHIP_R420_JI 0x4A49 -#define PCI_CHIP_R420_JJ 0x4A4A -#define PCI_CHIP_R420_JK 0x4A4B -#define PCI_CHIP_R420_JL 0x4A4C -#define PCI_CHIP_R420_JM 0x4A4D -#define PCI_CHIP_R420_JN 0x4A4E -#define PCI_CHIP_R420_4A4F 0x4A4F -#define PCI_CHIP_R420_JP 0x4A50 -#define PCI_CHIP_R481_4B49 0x4B49 -#define PCI_CHIP_R481_4B4A 0x4B4A -#define PCI_CHIP_R481_4B4B 0x4B4B -#define PCI_CHIP_R481_4B4C 0x4B4C -#define PCI_CHIP_MACH64LB 0x4C42 -#define PCI_CHIP_MACH64LD 0x4C44 -#define PCI_CHIP_RAGE128LE 0x4C45 -#define PCI_CHIP_RAGE128LF 0x4C46 -#define PCI_CHIP_MACH64LG 0x4C47 -#define PCI_CHIP_MACH64LI 0x4C49 -#define PCI_CHIP_MACH64LM 0x4C4D -#define PCI_CHIP_MACH64LN 0x4C4E -#define PCI_CHIP_MACH64LP 0x4C50 -#define PCI_CHIP_MACH64LQ 0x4C51 -#define PCI_CHIP_MACH64LR 0x4C52 -#define PCI_CHIP_MACH64LS 0x4C53 -#define PCI_CHIP_RADEON_LW 0x4C57 -#define PCI_CHIP_RADEON_LX 0x4C58 -#define PCI_CHIP_RADEON_LY 0x4C59 -#define PCI_CHIP_RADEON_LZ 0x4C5A -#define PCI_CHIP_RV250_Ld 0x4C64 -#define PCI_CHIP_RV250_Le 0x4C65 -#define PCI_CHIP_RV250_Lf 0x4C66 -#define PCI_CHIP_RV250_Lg 0x4C67 -#define PCI_CHIP_RV250_Ln 0x4C6E -#define PCI_CHIP_RAGE128MF 0x4D46 -#define PCI_CHIP_RAGE128ML 0x4D4C -#define PCI_CHIP_R300_ND 0x4E44 -#define PCI_CHIP_R300_NE 0x4E45 -#define PCI_CHIP_R300_NF 0x4E46 -#define PCI_CHIP_R300_NG 0x4E47 -#define PCI_CHIP_R350_NH 0x4E48 -#define PCI_CHIP_R350_NI 0x4E49 -#define PCI_CHIP_R360_NJ 0x4E4A -#define PCI_CHIP_R350_NK 0x4E4B -#define PCI_CHIP_RV350_NP 0x4E50 -#define PCI_CHIP_RV350_NQ 0x4E51 -#define PCI_CHIP_RV350_NR 0x4E52 -#define PCI_CHIP_RV350_NS 0x4E53 -#define PCI_CHIP_RV350_NT 0x4E54 -#define PCI_CHIP_RV350_NV 0x4E56 -#define PCI_CHIP_RAGE128PA 0x5041 -#define PCI_CHIP_RAGE128PB 0x5042 -#define PCI_CHIP_RAGE128PC 0x5043 -#define PCI_CHIP_RAGE128PD 0x5044 -#define PCI_CHIP_RAGE128PE 0x5045 -#define PCI_CHIP_RAGE128PF 0x5046 -#define PCI_CHIP_RAGE128PG 0x5047 -#define PCI_CHIP_RAGE128PH 0x5048 -#define PCI_CHIP_RAGE128PI 0x5049 -#define PCI_CHIP_RAGE128PJ 0x504A -#define PCI_CHIP_RAGE128PK 0x504B -#define PCI_CHIP_RAGE128PL 0x504C -#define PCI_CHIP_RAGE128PM 0x504D -#define PCI_CHIP_RAGE128PN 0x504E -#define PCI_CHIP_RAGE128PO 0x504F -#define PCI_CHIP_RAGE128PP 0x5050 -#define PCI_CHIP_RAGE128PQ 0x5051 -#define PCI_CHIP_RAGE128PR 0x5052 -#define PCI_CHIP_RAGE128PS 0x5053 -#define PCI_CHIP_RAGE128PT 0x5054 -#define PCI_CHIP_RAGE128PU 0x5055 -#define PCI_CHIP_RAGE128PV 0x5056 -#define PCI_CHIP_RAGE128PW 0x5057 -#define PCI_CHIP_RAGE128PX 0x5058 -#define PCI_CHIP_RADEON_QD 0x5144 -#define PCI_CHIP_RADEON_QE 0x5145 -#define PCI_CHIP_RADEON_QF 0x5146 -#define PCI_CHIP_RADEON_QG 0x5147 -#define PCI_CHIP_R200_QH 0x5148 -#define PCI_CHIP_R200_QI 0x5149 -#define PCI_CHIP_R200_QJ 0x514A -#define PCI_CHIP_R200_QK 0x514B -#define PCI_CHIP_R200_QL 0x514C -#define PCI_CHIP_R200_QM 0x514D -#define PCI_CHIP_R200_QN 0x514E -#define PCI_CHIP_R200_QO 0x514F -#define PCI_CHIP_RV200_QW 0x5157 -#define PCI_CHIP_RV200_QX 0x5158 -#define PCI_CHIP_RV100_QY 0x5159 -#define PCI_CHIP_RV100_QZ 0x515A -#define PCI_CHIP_RN50_515E 0x515E -#define PCI_CHIP_RAGE128RE 0x5245 -#define PCI_CHIP_RAGE128RF 0x5246 -#define PCI_CHIP_RAGE128RG 0x5247 -#define PCI_CHIP_RAGE128RK 0x524B -#define PCI_CHIP_RAGE128RL 0x524C -#define PCI_CHIP_RAGE128SE 0x5345 -#define PCI_CHIP_RAGE128SF 0x5346 -#define PCI_CHIP_RAGE128SG 0x5347 -#define PCI_CHIP_RAGE128SH 0x5348 -#define PCI_CHIP_RAGE128SK 0x534B -#define PCI_CHIP_RAGE128SL 0x534C -#define PCI_CHIP_RAGE128SM 0x534D -#define PCI_CHIP_RAGE128SN 0x534E -#define PCI_CHIP_RAGE128TF 0x5446 -#define PCI_CHIP_RAGE128TL 0x544C -#define PCI_CHIP_RAGE128TR 0x5452 -#define PCI_CHIP_RAGE128TS 0x5453 -#define PCI_CHIP_RAGE128TT 0x5454 -#define PCI_CHIP_RAGE128TU 0x5455 -#define PCI_CHIP_RV370_5460 0x5460 -#define PCI_CHIP_RV370_5461 0x5461 -#define PCI_CHIP_RV370_5462 0x5462 -#define PCI_CHIP_RV370_5463 0x5463 -#define PCI_CHIP_RV370_5464 0x5464 -#define PCI_CHIP_RV370_5465 0x5465 -#define PCI_CHIP_RV370_5466 0x5466 -#define PCI_CHIP_RV370_5467 0x5467 -#define PCI_CHIP_R423_UH 0x5548 -#define PCI_CHIP_R423_UI 0x5549 -#define PCI_CHIP_R423_UJ 0x554A -#define PCI_CHIP_R423_UK 0x554B -#define PCI_CHIP_R430_554C 0x554C -#define PCI_CHIP_R430_554D 0x554D -#define PCI_CHIP_R430_554E 0x554E -#define PCI_CHIP_R430_554F 0x554F -#define PCI_CHIP_R423_5550 0x5550 -#define PCI_CHIP_R423_UQ 0x5551 -#define PCI_CHIP_R423_UR 0x5552 -#define PCI_CHIP_R423_UT 0x5554 -#define PCI_CHIP_RV410_564A 0x564A -#define PCI_CHIP_RV410_564B 0x564B -#define PCI_CHIP_RV410_5652 0x5652 -#define PCI_CHIP_RV410_5653 0x5653 -#define PCI_CHIP_MACH64VT 0x5654 -#define PCI_CHIP_MACH64VU 0x5655 -#define PCI_CHIP_MACH64VV 0x5656 -#define PCI_CHIP_RS300_5834 0x5834 -#define PCI_CHIP_RS300_5835 0x5835 -#define PCI_CHIP_RS300_5836 0x5836 -#define PCI_CHIP_RS300_5837 0x5837 -#define PCI_CHIP_RS480_5954 0x5954 -#define PCI_CHIP_RS480_5955 0x5955 -#define PCI_CHIP_RV280_5960 0x5960 -#define PCI_CHIP_RV280_5961 0x5961 -#define PCI_CHIP_RV280_5962 0x5962 -#define PCI_CHIP_RV280_5964 0x5964 -#define PCI_CHIP_RV280_5965 0x5965 -#define PCI_CHIP_RN50_5969 0x5969 -#define PCI_CHIP_RS482_5974 0x5974 -#define PCI_CHIP_RS482_5975 0x5975 -#define PCI_CHIP_RS400_5A41 0x5A41 -#define PCI_CHIP_RS400_5A42 0x5A42 -#define PCI_CHIP_RC410_5A61 0x5A61 -#define PCI_CHIP_RC410_5A62 0x5A62 -#define PCI_CHIP_RV370_5B60 0x5B60 -#define PCI_CHIP_RV370_5B61 0x5B61 -#define PCI_CHIP_RV370_5B62 0x5B62 -#define PCI_CHIP_RV370_5B63 0x5B63 -#define PCI_CHIP_RV370_5B64 0x5B64 -#define PCI_CHIP_RV370_5B65 0x5B65 -#define PCI_CHIP_RV370_5B66 0x5B66 -#define PCI_CHIP_RV370_5B67 0x5B67 -#define PCI_CHIP_RV280_5C61 0x5C61 -#define PCI_CHIP_RV280_5C63 0x5C63 -#define PCI_CHIP_R430_5D48 0x5D48 -#define PCI_CHIP_R430_5D49 0x5D49 -#define PCI_CHIP_R430_5D4A 0x5D4A -#define PCI_CHIP_R480_5D4C 0x5D4C -#define PCI_CHIP_R480_5D4D 0x5D4D -#define PCI_CHIP_R480_5D4E 0x5D4E -#define PCI_CHIP_R480_5D4F 0x5D4F -#define PCI_CHIP_R480_5D50 0x5D50 -#define PCI_CHIP_R480_5D52 0x5D52 -#define PCI_CHIP_R423_5D57 0x5D57 -#define PCI_CHIP_RV410_5E48 0x5E48 -#define PCI_CHIP_RV410_5E4A 0x5E4A -#define PCI_CHIP_RV410_5E4B 0x5E4B -#define PCI_CHIP_RV410_5E4C 0x5E4C -#define PCI_CHIP_RV410_5E4D 0x5E4D -#define PCI_CHIP_RV410_5E4F 0x5E4F -#define PCI_CHIP_RS350_7834 0x7834 -#define PCI_CHIP_RS350_7835 0x7835 - -/* Avance Logic */ -#define PCI_CHIP_ALG2064 0x2064 -#define PCI_CHIP_ALG2301 0x2301 -#define PCI_CHIP_ALG2501 0x2501 - -/* Tseng */ -#define PCI_CHIP_ET4000_W32P_A 0x3202 -#define PCI_CHIP_ET4000_W32P_B 0x3205 -#define PCI_CHIP_ET4000_W32P_D 0x3206 -#define PCI_CHIP_ET4000_W32P_C 0x3207 -#define PCI_CHIP_ET6000 0x3208 -#define PCI_CHIP_ET6300 0x4702 - -/* Weitek */ -#define PCI_CHIP_P9000 0x9001 -#define PCI_CHIP_P9100 0x9100 - -/* Digital */ -#define PCI_CHIP_DC21050 0x0001 -#define PCI_CHIP_DEC21030 0x0004 -#define PCI_CHIP_TGA2 0x000D - -/* Cirrus Logic */ -#define PCI_CHIP_GD7548 0x0038 -#define PCI_CHIP_GD7555 0x0040 -#define PCI_CHIP_GD5430 0x00A0 -#define PCI_CHIP_GD5434_4 0x00A4 -#define PCI_CHIP_GD5434_8 0x00A8 -#define PCI_CHIP_GD5436 0x00AC -#define PCI_CHIP_GD5446 0x00B8 -#define PCI_CHIP_GD5480 0x00BC -#define PCI_CHIP_GD5462 0x00D0 -#define PCI_CHIP_GD5464 0x00D4 -#define PCI_CHIP_GD5464BD 0x00D5 -#define PCI_CHIP_GD5465 0x00D6 -#define PCI_CHIP_6729 0x1100 -#define PCI_CHIP_6832 0x1110 -#define PCI_CHIP_GD7542 0x1200 -#define PCI_CHIP_GD7543 0x1202 -#define PCI_CHIP_GD7541 0x1204 - -/* AMD */ -#define PCI_CHIP_AMD761 0x700E - -/* Trident */ -#define PCI_CHIP_2100 0x2100 -#define PCI_CHIP_8400 0x8400 -#define PCI_CHIP_8420 0x8420 -#define PCI_CHIP_8500 0x8500 -#define PCI_CHIP_8520 0x8520 -#define PCI_CHIP_8600 0x8600 -#define PCI_CHIP_8620 0x8620 -#define PCI_CHIP_8820 0x8820 -#define PCI_CHIP_9320 0x9320 -#define PCI_CHIP_9388 0x9388 -#define PCI_CHIP_9397 0x9397 -#define PCI_CHIP_939A 0x939A -#define PCI_CHIP_9420 0x9420 -#define PCI_CHIP_9440 0x9440 -#define PCI_CHIP_9520 0x9520 -#define PCI_CHIP_9525 0x9525 -#define PCI_CHIP_9540 0x9540 -#define PCI_CHIP_9660 0x9660 -#define PCI_CHIP_9750 0x9750 -#define PCI_CHIP_9850 0x9850 -#define PCI_CHIP_9880 0x9880 -#define PCI_CHIP_9910 0x9910 - -/* ALI */ -#define PCI_CHIP_M1435 0x1435 - -/* Matrox */ -#define PCI_CHIP_MGA2085 0x0518 -#define PCI_CHIP_MGA2064 0x0519 -#define PCI_CHIP_MGA1064 0x051A -#define PCI_CHIP_MGA2164 0x051B -#define PCI_CHIP_MGA2164_AGP 0x051F -#define PCI_CHIP_MGAG200_PCI 0x0520 -#define PCI_CHIP_MGAG200 0x0521 -#define PCI_CHIP_MGAG400 0x0525 -#define PCI_CHIP_MGAG550 0x2527 -#define PCI_CHIP_IMPRESSION 0x0D10 -#define PCI_CHIP_MGAG100_PCI 0x1000 -#define PCI_CHIP_MGAG100 0x1001 - -#define PCI_CARD_G400_TH 0x2179 -#define PCI_CARD_MILL_G200_SD 0xFF00 -#define PCI_CARD_PROD_G100_SD 0xFF01 -#define PCI_CARD_MYST_G200_SD 0xFF02 -#define PCI_CARD_MILL_G200_SG 0xFF03 -#define PCI_CARD_MARV_G200_SD 0xFF04 - -/* Chips & Tech */ -#define PCI_CHIP_65545 0x00D8 -#define PCI_CHIP_65548 0x00DC -#define PCI_CHIP_65550 0x00E0 -#define PCI_CHIP_65554 0x00E4 -#define PCI_CHIP_65555 0x00E5 -#define PCI_CHIP_68554 0x00F4 -#define PCI_CHIP_69000 0x00C0 -#define PCI_CHIP_69030 0x0C30 - -/* Miro */ -#define PCI_CHIP_ZR36050 0x5601 - -/* NEC */ -#define PCI_CHIP_POWER_VR 0x0046 - -/* SiS */ -#define PCI_CHIP_SG86C201 0x0001 -#define PCI_CHIP_SG86C202 0x0002 -#define PCI_CHIP_SG85C503 0x0008 -#define PCI_CHIP_SIS5597 0x0200 -/* Agregado por Carlos Duclos & Manuel Jander */ -#define PCI_CHIP_SIS82C204 0x0204 -#define PCI_CHIP_SG86C205 0x0205 -#define PCI_CHIP_SG86C215 0x0215 -#define PCI_CHIP_SG86C225 0x0225 -#define PCI_CHIP_85C501 0x0406 -#define PCI_CHIP_85C496 0x0496 -#define PCI_CHIP_85C601 0x0601 -#define PCI_CHIP_85C5107 0x5107 -#define PCI_CHIP_85C5511 0x5511 -#define PCI_CHIP_85C5513 0x5513 -#define PCI_CHIP_SIS5571 0x5571 -#define PCI_CHIP_SIS5597_2 0x5597 -#define PCI_CHIP_SIS530 0x6306 -#define PCI_CHIP_SIS6326 0x6326 -#define PCI_CHIP_SIS7001 0x7001 -#define PCI_CHIP_SIS300 0x0300 -#define PCI_CHIP_SIS315H 0x0310 -#define PCI_CHIP_SIS315PRO 0x0325 -#define PCI_CHIP_SIS330 0x0330 -#define PCI_CHIP_SIS630 0x6300 -#define PCI_CHIP_SIS540 0x5300 -#define PCI_CHIP_SIS550 0x5315 -#define PCI_CHIP_SIS650 0x6325 -#define PCI_CHIP_SIS730 0x7300 - -/* Hewlett-Packard */ -#define PCI_CHIP_ELROY 0x1054 -#define PCI_CHIP_ZX1_SBA 0x1229 -#define PCI_CHIP_ZX1_IOC 0x122A -#define PCI_CHIP_ZX1_LBA 0x122E /* a.k.a. Mercury */ -#define PCI_CHIP_ZX1_AGP8 0x12B4 /* a.k.a. QuickSilver */ -#define PCI_CHIP_ZX2_LBA 0x12EE -#define PCI_CHIP_ZX2_SBA 0x4030 -#define PCI_CHIP_ZX2_IOC 0x4031 - -/* SGS */ -#define PCI_CHIP_STG2000 0x0008 -#define PCI_CHIP_STG1764 0x0009 -#define PCI_CHIP_KYROII 0x0010 - -/* Texas Instruments */ -#define PCI_CHIP_TI_PERMEDIA 0x3D04 -#define PCI_CHIP_TI_PERMEDIA2 0x3D07 - -/* Oak */ -#define PCI_CHIP_OTI107 0x0107 - -/* Number Nine */ -#define PCI_CHIP_I128 0x2309 -#define PCI_CHIP_I128_2 0x2339 -#define PCI_CHIP_I128_T2R 0x493D -#define PCI_CHIP_I128_T2R4 0x5348 - -/* Sun */ -#define PCI_CHIP_EBUS 0x1000 -#define PCI_CHIP_HAPPY_MEAL 0x1001 -#define PCI_CHIP_SIMBA 0x5000 -#define PCI_CHIP_PSYCHO 0x8000 -#define PCI_CHIP_SCHIZO 0x8001 -#define PCI_CHIP_SABRE 0xA000 -#define PCI_CHIP_HUMMINGBIRD 0xA001 - -/* BrookTree */ -#define PCI_CHIP_BT848 0x0350 -#define PCI_CHIP_BT849 0x0351 - -/* NVIDIA */ -#define PCI_CHIP_NV1 0x0008 -#define PCI_CHIP_DAC64 0x0009 -#define PCI_CHIP_TNT 0x0020 -#define PCI_CHIP_TNT2 0x0028 -#define PCI_CHIP_UTNT2 0x0029 -#define PCI_CHIP_VTNT2 0x002C -#define PCI_CHIP_UVTNT2 0x002D -#define PCI_CHIP_ITNT2 0x00A0 -#define PCI_CHIP_GEFORCE_256 0x0100 -#define PCI_CHIP_GEFORCE_DDR 0x0101 -#define PCI_CHIP_QUADRO 0x0103 -#define PCI_CHIP_GEFORCE2_MX 0x0110 -#define PCI_CHIP_GEFORCE2_MX_100 0x0111 -#define PCI_CHIP_GEFORCE2_GO 0x0112 -#define PCI_CHIP_QUADRO2_MXR 0x0113 -#define PCI_CHIP_GEFORCE2_GTS 0x0150 -#define PCI_CHIP_GEFORCE2_TI 0x0151 -#define PCI_CHIP_GEFORCE2_ULTRA 0x0152 -#define PCI_CHIP_QUADRO2_PRO 0x0153 -#define PCI_CHIP_GEFORCE4_MX_460 0x0170 -#define PCI_CHIP_GEFORCE4_MX_440 0x0171 -#define PCI_CHIP_GEFORCE4_MX_420 0x0172 -#define PCI_CHIP_GEFORCE4_440_GO 0x0174 -#define PCI_CHIP_GEFORCE4_420_GO 0x0175 -#define PCI_CHIP_GEFORCE4_420_GO_M32 0x0176 -#define PCI_CHIP_QUADRO4_500XGL 0x0178 -#define PCI_CHIP_GEFORCE4_440_GO_M64 0x0179 -#define PCI_CHIP_QUADRO4_200 0x017A -#define PCI_CHIP_QUADRO4_550XGL 0x017B -#define PCI_CHIP_QUADRO4_500_GOGL 0x017C -#define PCI_CHIP_IGEFORCE2 0x01A0 -#define PCI_CHIP_GEFORCE3 0x0200 -#define PCI_CHIP_GEFORCE3_TI_200 0x0201 -#define PCI_CHIP_GEFORCE3_TI_500 0x0202 -#define PCI_CHIP_QUADRO_DCC 0x0203 -#define PCI_CHIP_GEFORCE4_TI_4600 0x0250 -#define PCI_CHIP_GEFORCE4_TI_4400 0x0251 -#define PCI_CHIP_GEFORCE4_TI_4200 0x0253 -#define PCI_CHIP_QUADRO4_900XGL 0x0258 -#define PCI_CHIP_QUADRO4_750XGL 0x0259 -#define PCI_CHIP_QUADRO4_700XGL 0x025B - -/* NVIDIA & SGS */ -#define PCI_CHIP_RIVA128 0x0018 - -/* IMS */ -#define PCI_CHIP_IMSTT128 0x9128 -#define PCI_CHIP_IMSTT3D 0x9135 - -/* Alliance Semiconductor */ -#define PCI_CHIP_AP6410 0x3210 -#define PCI_CHIP_AP6422 0x6422 -#define PCI_CHIP_AT24 0x6424 -#define PCI_CHIP_AT3D 0x643D - -/* 3dfx Interactive */ -#define PCI_CHIP_VOODOO_GRAPHICS 0x0001 -#define PCI_CHIP_VOODOO2 0x0002 -#define PCI_CHIP_BANSHEE 0x0003 -#define PCI_CHIP_VOODOO3 0x0005 -#define PCI_CHIP_VOODOO5 0x0009 - -#define PCI_CARD_VOODOO3_2000 0x0036 -#define PCI_CARD_VOODOO3_3000 0x003A - -/* Rendition */ -#define PCI_CHIP_V1000 0x0001 -#define PCI_CHIP_V2x00 0x2000 - -/* 3Dlabs */ -#define PCI_CHIP_300SX 0x0001 -#define PCI_CHIP_500TX 0x0002 -#define PCI_CHIP_DELTA 0x0003 -#define PCI_CHIP_PERMEDIA 0x0004 -#define PCI_CHIP_MX 0x0006 -#define PCI_CHIP_PERMEDIA2 0x0007 -#define PCI_CHIP_GAMMA 0x0008 -#define PCI_CHIP_PERMEDIA2V 0x0009 -#define PCI_CHIP_PERMEDIA3 0x000A -#define PCI_CHIP_PERMEDIA4 0x000C -#define PCI_CHIP_R4 0x000D -#define PCI_CHIP_GAMMA2 0x000E -#define PCI_CHIP_R4ALT 0x0011 - -/* S3 */ -#define PCI_CHIP_PLATO 0x0551 -#define PCI_CHIP_VIRGE 0x5631 -#define PCI_CHIP_TRIO 0x8811 -#define PCI_CHIP_AURORA64VP 0x8812 -#define PCI_CHIP_TRIO64UVP 0x8814 -#define PCI_CHIP_VIRGE_VX 0x883D -#define PCI_CHIP_868 0x8880 -#define PCI_CHIP_928 0x88B0 -#define PCI_CHIP_864_0 0x88C0 -#define PCI_CHIP_864_1 0x88C1 -#define PCI_CHIP_964_0 0x88D0 -#define PCI_CHIP_964_1 0x88D1 -#define PCI_CHIP_968 0x88F0 -#define PCI_CHIP_TRIO64V2_DXGX 0x8901 -#define PCI_CHIP_PLATO_PX 0x8902 -#define PCI_CHIP_Trio3D 0x8904 -#define PCI_CHIP_VIRGE_DXGX 0x8A01 -#define PCI_CHIP_VIRGE_GX2 0x8A10 -#define PCI_CHIP_Trio3D_2X 0x8A13 -#define PCI_CHIP_SAVAGE3D 0x8A20 -#define PCI_CHIP_SAVAGE3D_MV 0x8A21 -#define PCI_CHIP_SAVAGE4 0x8A22 -#define PCI_CHIP_PROSAVAGE_PM 0x8A25 -#define PCI_CHIP_PROSAVAGE_KM 0x8A26 -#define PCI_CHIP_VIRGE_MX 0x8C01 -#define PCI_CHIP_VIRGE_MXPLUS 0x8C02 -#define PCI_CHIP_VIRGE_MXP 0x8C03 -#define PCI_CHIP_SAVAGE_MX_MV 0x8C10 -#define PCI_CHIP_SAVAGE_MX 0x8C11 -#define PCI_CHIP_SAVAGE_IX_MV 0x8C12 -#define PCI_CHIP_SAVAGE_IX 0x8C13 -#define PCI_CHIP_SUPSAV_MX128 0x8C22 -#define PCI_CHIP_SUPSAV_MX64 0x8C24 -#define PCI_CHIP_SUPSAV_MX64C 0x8C26 -#define PCI_CHIP_SUPSAV_IX128SDR 0x8C2A -#define PCI_CHIP_SUPSAV_IX128DDR 0x8C2B -#define PCI_CHIP_SUPSAV_IX64SDR 0x8C2C -#define PCI_CHIP_SUPSAV_IX64DDR 0x8C2D -#define PCI_CHIP_SUPSAV_IXCSDR 0x8C2E -#define PCI_CHIP_SUPSAV_IXCDDR 0x8C2F -#define PCI_CHIP_S3TWISTER_P 0x8D01 -#define PCI_CHIP_S3TWISTER_K 0x8D02 -#define PCI_CHIP_PROSAVAGE_DDR 0x8D03 -#define PCI_CHIP_PROSAVAGE_DDRK 0x8D04 -#define PCI_CHIP_SAVAGE2000 0x9102 - -/* ARK Logic */ -#define PCI_CHIP_1000PV 0xA091 -#define PCI_CHIP_2000PV 0xA099 -#define PCI_CHIP_2000MT 0xA0A1 -#define PCI_CHIP_2000MI 0xA0A9 - -/* Tritech Microelectronics */ -#define PCI_CHIP_TR25202 0xFC02 - -/* Neomagic */ -#define PCI_CHIP_NM2070 0x0001 -#define PCI_CHIP_NM2090 0x0002 -#define PCI_CHIP_NM2093 0x0003 -#define PCI_CHIP_NM2097 0x0083 -#define PCI_CHIP_NM2160 0x0004 -#define PCI_CHIP_NM2200 0x0005 -#define PCI_CHIP_NM2230 0x0025 -#define PCI_CHIP_NM2360 0x0006 -#define PCI_CHIP_NM2380 0x0016 - -/* Intel */ -#define PCI_CHIP_I815_BRIDGE 0x1130 -#define PCI_CHIP_I815 0x1132 -#define PCI_CHIP_82801_P2P 0x244E -#define PCI_CHIP_845_G_BRIDGE 0x2560 -#define PCI_CHIP_845_G 0x2562 -#define PCI_CHIP_I830_M_BRIDGE 0x3575 -#define PCI_CHIP_I830_M 0x3577 -#define PCI_CHIP_I810_BRIDGE 0x7120 -#define PCI_CHIP_I810 0x7121 -#define PCI_CHIP_I810_DC100_BRIDGE 0x7122 -#define PCI_CHIP_I810_DC100 0x7123 -#define PCI_CHIP_I810_E_BRIDGE 0x7124 -#define PCI_CHIP_I810_E 0x7125 -#define PCI_CHIP_I740_AGP 0x7800 -#define PCI_CHIP_460GX_PXB 0x84CB -#define PCI_CHIP_460GX_SAC 0x84E0 -#define PCI_CHIP_460GX_GXB_2 0x84E2 /* PCI function 2 */ -#define PCI_CHIP_460GX_WXB 0x84E6 -#define PCI_CHIP_460GX_GXB_1 0x84EA /* PCI function 1 */ - -/* Silicon Motion Inc. */ -#define PCI_CHIP_SMI910 0x0910 -#define PCI_CHIP_SMI810 0x0810 -#define PCI_CHIP_SMI820 0x0820 -#define PCI_CHIP_SMI710 0x0710 -#define PCI_CHIP_SMI712 0x0712 -#define PCI_CHIP_SMI720 0x0720 -#define PCI_CHIP_SMI731 0x0730 - -/* VMware */ -#define PCI_CHIP_VMWARE0405 0x0405 -#define PCI_CHIP_VMWARE0710 0x0710 - -#endif /* _XF86_PCIINFO_H */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Priv.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Priv.h deleted file mode 100644 index f32fa768d..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Priv.h +++ /dev/null @@ -1,228 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.83 2004/01/27 01:31:45 dawes Exp $ */ - -/* - * Copyright (c) 1997-2002 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * This file contains declarations for private XFree86 functions and variables, - * and definitions of private macros. - * - * "private" means not available to video drivers. - */ - -#ifndef _XF86PRIV_H -#define _XF86PRIV_H - -#include "xf86Privstr.h" -#include "propertyst.h" - -/* - * Parameters set ONLY from the command line options - * The global state of these things is held in xf86InfoRec (when appropriate). - */ -extern const char *xf86ConfigFile; -extern Bool xf86AllowMouseOpenFail; -#ifdef XF86VIDMODE -extern Bool xf86VidModeDisabled; -extern Bool xf86VidModeAllowNonLocal; -#endif -#ifdef XF86MISC -extern Bool xf86MiscModInDevDisabled; -extern Bool xf86MiscModInDevAllowNonLocal; -#endif -extern Bool xf86fpFlag; -extern Bool xf86coFlag; -extern Bool xf86sFlag; -extern Bool xf86bsEnableFlag; -extern Bool xf86bsDisableFlag; -extern Bool xf86silkenMouseDisableFlag; -extern Bool xf86acpiDisableFlag; -extern char *xf86LayoutName; -extern char *xf86ScreenName; -extern char *xf86PointerName; -extern char *xf86KeyboardName; -#ifdef KEEPBPP -extern int xf86Bpp; -#endif -extern int xf86FbBpp; -extern int xf86Depth; -extern Pix24Flags xf86Pix24; -extern rgb xf86Weight; -extern Bool xf86FlipPixels; -extern Bool xf86BestRefresh; -extern Gamma xf86Gamma; -extern char *xf86ServerName; -extern Bool xf86ShowUnresolved; -extern PciBusId xf86IsolateDevice; - -/* Other parameters */ - -extern xf86InfoRec xf86Info; -extern const char *xf86InputDeviceList; -extern const char *xf86ModulePath; -extern MessageType xf86ModPathFrom; -extern const char *xf86LogFile; -extern MessageType xf86LogFileFrom; -extern Bool xf86LogFileWasOpened; -extern serverLayoutRec xf86ConfigLayout; -extern Pix24Flags xf86ConfigPix24; - -extern unsigned short xf86MouseCflags[]; -extern Bool xf86SupportedMouseTypes[]; -extern int xf86NumMouseTypes; - -#ifdef XFree86LOADER -extern DriverPtr *xf86DriverList; -extern ModuleInfoPtr *xf86ModuleInfoList; -extern int xf86NumModuleInfos; -#else -extern DriverPtr xf86DriverList[]; -#endif -extern int xf86NumDrivers; -extern Bool xf86Resetting; -extern Bool xf86Initialising; -extern Bool xf86ProbeFailed; -extern int xf86NumScreens; -extern pciVideoPtr *xf86PciVideoInfo; -extern xf86CurrentAccessRec xf86CurrentAccess; -extern const char *xf86VisualNames[]; -extern int xf86Verbose; /* verbosity level */ -extern int xf86LogVerbose; /* log file verbosity level */ -extern Bool xf86ProbeOnly; -extern Bool xf86DoProbe; -extern Bool xorgHWAccess; - -extern RootWinPropPtr *xf86RegisteredPropertiesTable; - -#ifndef DEFAULT_VERBOSE -#define DEFAULT_VERBOSE 0 -#endif -#ifndef DEFAULT_LOG_VERBOSE -#define DEFAULT_LOG_VERBOSE 3 -#endif -#ifndef DEFAULT_DPI -#define DEFAULT_DPI 75 -#endif - -#define DEFAULT_UNRESOLVED TRUE -#define DEFAULT_BEST_REFRESH FALSE - -/* Function Prototypes */ -#ifndef _NO_XF86_PROTOTYPES - -/* xf86Bus.c */ - -void xf86BusProbe(void); -void xf86ChangeBusIndex(int oldIndex, int newIndex); -void xf86AccessInit(void); -void xf86AccessEnter(void); -void xf86AccessLeave(void); -void xf86EntityInit(void); -void xf86EntityEnter(void); -void xf86EntityLeave(void); -void xf86AccessLeaveState(void); - -void xf86FindPrimaryDevice(void); -/* new RAC */ -void xf86ResourceBrokerInit(void); -void xf86PostProbe(void); -void xf86ClearEntityListForScreen(int scrnIndex); -void xf86AddDevToEntity(int entityIndex, GDevPtr dev); -extern void xf86PostPreInit(void); -extern void xf86PostScreenInit(void); -extern memType getValidBIOSBase(PCITAG tag, int num); -extern int pciTestMultiDeviceCard(int bus, int dev, int func, PCITAG** pTag); - -/* xf86Config.c */ - -Bool xf86PathIsAbsolute(const char *path); -Bool xf86PathIsSafe(const char *path); - -/* xf86DefaultModes */ - -extern DisplayModeRec xf86DefaultModes []; - -/* xf86DoScanPci.c */ - -void DoScanPci(int argc, char **argv, int i); - -/* xf86DoProbe.c */ -void DoProbeArgs(int argc, char **argv, int i); -void DoProbe(void); -void DoConfigure(void); - -/* xf86Events.c */ - -void xf86PostKbdEvent(unsigned key); -void xf86PostMseEvent(DeviceIntPtr device, int buttons, int dx, int dy); -void xf86Wakeup(pointer blockData, int err, pointer pReadmask); -void xf86SigHandler(int signo); -#ifdef MEMDEBUG -void xf86SigMemDebug(int signo); -#endif -void xf86HandlePMEvents(int fd, pointer data); -extern int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num); -extern pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event); -void xf86GrabServerCallback(CallbackListPtr *, pointer, pointer); - -/* xf86Helper.c */ -void xf86LogInit(void); -void xf86CloseLog(void); - -/* xf86Init.c */ -Bool xf86LoadModules(char **list, pointer *optlist); -int xf86SetVerbosity(int verb); -int xf86SetLogVerbosity(int verb); - -/* xf86Io.c */ - -void xf86KbdBell(int percent, DeviceIntPtr pKeyboard, pointer ctrl, - int unused); -void xf86KbdLeds(void); -void xf86UpdateKbdLeds(void); -void xf86KbdCtrl(DevicePtr pKeyboard, KeybdCtrl *ctrl); -void xf86InitKBD(Bool init); -int xf86KbdProc(DeviceIntPtr pKeyboard, int what); - -/* xf86Kbd.c */ - -void xf86KbdGetMapping(KeySymsPtr pKeySyms, CARD8 *pModMap); - -/* xf86Lock.c */ - -#ifdef USE_XF86_SERVERLOCK -void xf86UnlockServer(void); -#endif - -/* xf86XKB.c */ - -void xf86InitXkb(void); - -#endif /* _NO_XF86_PROTOTYPES */ - - -#endif /* _XF86PRIV_H */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Privstr.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Privstr.h deleted file mode 100644 index 2f15e14cb..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Privstr.h +++ /dev/null @@ -1,234 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.41 2004/01/27 01:31:45 dawes Exp $ */ - -/* - * Copyright (c) 1997-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * This file contains definitions of the private XFree86 data structures/types. - * None of the data structures here should be used by video drivers. - */ - -#ifndef _XF86PRIVSTR_H -#define _XF86PRIVSTR_H - -#include "xf86Pci.h" -#include "xf86str.h" - -/* PCI probe flags */ - -typedef enum { - PCIProbe1 = 0, - PCIProbe2, - PCIForceConfig1, - PCIForceConfig2, - PCIForceNone, - PCIOsConfig -} PciProbeType; - -typedef enum { - LogNone, - LogFlush, - LogSync -} Log; - -typedef enum { - SKNever, - SKWhenNeeded, - SKAlways -} SpecialKeysInDDX; - -/* - * xf86InfoRec contains global parameters which the video drivers never - * need to access. Global parameters which the video drivers do need - * should be individual globals. - */ - -typedef struct { - - /* keyboard part */ - DeviceIntPtr pKeyboard; - DeviceProc kbdProc; /* procedure for initializing */ - void (* kbdEvents)(void); /* proc for processing events */ - int consoleFd; - int kbdFd; - int vtno; - int kbdType; /* AT84 / AT101 */ - int kbdRate; - int kbdDelay; - int bell_pitch; - int bell_duration; - Bool autoRepeat; - unsigned long leds; - unsigned long xleds; - char * vtinit; - int scanPrefix; /* scancode-state */ - Bool capsLock; - Bool numLock; - Bool scrollLock; - Bool modeSwitchLock; - Bool composeLock; - Bool vtSysreq; - SpecialKeysInDDX ddxSpecialKeys; - Bool ActionKeyBindingsSet; -#if defined(SVR4) && defined(i386) - Bool panix106; -#endif /* SVR4 && i386 */ -#if defined(__OpenBSD__) || defined(__NetBSD__) - int wsKbdType; -#endif - - /* mouse part */ - DeviceIntPtr pMouse; -#ifdef XINPUT - pointer mouseLocal; -#endif - - /* event handler part */ - int lastEventTime; - Bool vtRequestsPending; - Bool inputPending; - Bool dontVTSwitch; - Bool dontZap; - Bool dontZoom; - Bool notrapSignals; /* don't exit cleanly - die at fault */ - Bool caughtSignal; - - /* graphics part */ - Bool sharedMonitor; - ScreenPtr currentScreen; -#if defined(CSRG_BASED) || defined(__FreeBSD_kernel__) - int screenFd; /* fd for memory mapped access to - * vga card */ - int consType; /* Which console driver? */ -#endif - -#ifdef XKB - /* - * would like to use an XkbComponentNamesRec here but can't without - * pulling in a bunch of header files. :-( - */ - char * xkbkeymap; - char * xkbkeycodes; - char * xkbtypes; - char * xkbcompat; - char * xkbsymbols; - char * xkbgeometry; - Bool xkbcomponents_specified; - char * xkbrules; - char * xkbmodel; - char * xkblayout; - char * xkbvariant; - char * xkboptions; -#endif - - /* Other things */ - Bool allowMouseOpenFail; - Bool vidModeEnabled; /* VidMode extension enabled */ - Bool vidModeAllowNonLocal; /* allow non-local VidMode - * connections */ - Bool miscModInDevEnabled; /* Allow input devices to be - * changed */ - Bool miscModInDevAllowNonLocal; - PciProbeType pciFlags; - Pix24Flags pixmap24; - MessageType pix24From; -#if defined(i386) || defined(__i386__) - Bool pc98; -#endif - Bool pmFlag; - Log log; - int estimateSizesAggressively; - Bool kbdCustomKeycodes; - Bool disableRandR; - MessageType randRFrom; - struct { - Bool disabled; /* enable/disable deactivating - * grabs or closing the - * connection to the grabbing - * client */ - ClientPtr override; /* client that disabled - * grab deactivation. - */ - Bool allowDeactivate; - Bool allowClosedown; - ServerGrabInfoRec server; - } grabInfo; -} xf86InfoRec, *xf86InfoPtr; - -#ifdef DPMSExtension -/* Private info for DPMS */ -typedef struct { - CloseScreenProcPtr CloseScreen; - Bool Enabled; - int Flags; -} DPMSRec, *DPMSPtr; -#endif - -#ifdef XF86VIDMODE -/* Private info for Video Mode Extentsion */ -typedef struct { - DisplayModePtr First; - DisplayModePtr Next; - int Flags; - CloseScreenProcPtr CloseScreen; -} VidModeRec, *VidModePtr; -#endif - -/* Information for root window properties. */ -typedef struct _RootWinProp { - struct _RootWinProp * next; - char * name; - Atom type; - short format; - long size; - pointer data; -} RootWinProp, *RootWinPropPtr; - -/* private resource types */ -#define ResNoAvoid ResBios - -/* ISC's cc can't handle ~ of UL constants, so explicitly type cast them. */ -#define XLED1 ((unsigned long) 0x00000001) -#define XLED2 ((unsigned long) 0x00000002) -#define XLED3 ((unsigned long) 0x00000004) -#define XLED4 ((unsigned long) 0x00000008) -#define XCAPS ((unsigned long) 0x20000000) -#define XNUM ((unsigned long) 0x40000000) -#define XSCR ((unsigned long) 0x80000000) -#define XCOMP ((unsigned long) 0x00008000) - -/* BSD console driver types (consType) */ -#if defined(CSRG_BASED) || defined(__FreeBSD_kernel__) -#define PCCONS 0 -#define CODRV011 1 -#define CODRV01X 2 -#define SYSCONS 8 -#define PCVT 16 -#define WSCONS 32 -#endif - -#endif /* _XF86PRIVSTR_H */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86RandR.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86RandR.c deleted file mode 100644 index 4fb844a0f..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86RandR.c +++ /dev/null @@ -1,438 +0,0 @@ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/xf86RandR.c,v 1.25 2005/10/30 17:38:49 twini Exp $ */ -/* - * $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86RandR.c,v 1.7tsi Exp $ - * - * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "os.h" -#include "mibank.h" -#include "globals.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86DDC.h" -#include "mipointer.h" -#include - -typedef struct _xf86RandRInfo { - CreateScreenResourcesProcPtr CreateScreenResources; - CloseScreenProcPtr CloseScreen; - int virtualX; - int virtualY; - int mmWidth; - int mmHeight; - Rotation rotation; -} XF86RandRInfoRec, *XF86RandRInfoPtr; - -static int xf86RandRIndex = -1; -static int xf86RandRGeneration; - -#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) (p)->devPrivates[xf86RandRIndex].ptr) - -static int -xf86RandRModeRefresh (DisplayModePtr mode) -{ - if (mode->VRefresh) - return (int) (mode->VRefresh + 0.5); - else - return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal + 0.5); -} - -static Bool -xf86RandRGetInfo (ScreenPtr pScreen, Rotation *rotations) -{ - RRScreenSizePtr pSize; - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); - XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); - DisplayModePtr mode; - int refresh0 = 60; - xorgRRModeMM RRModeMM; - - *rotations = RR_Rotate_0; - - for (mode = scrp->modes; ; mode = mode->next) - { - int refresh = xf86RandRModeRefresh (mode); - - if (mode == scrp->modes) - refresh0 = refresh; - - RRModeMM.mode = mode; - RRModeMM.virtX = randrp->virtualX; - RRModeMM.virtY = randrp->virtualY; - RRModeMM.mmWidth = randrp->mmWidth; - RRModeMM.mmHeight = randrp->mmHeight; - - if(scrp->DriverFunc) { - (*scrp->DriverFunc)(scrp, RR_GET_MODE_MM, &RRModeMM); - } - - pSize = RRRegisterSize (pScreen, - mode->HDisplay, mode->VDisplay, - RRModeMM.mmWidth, RRModeMM.mmHeight); - if (!pSize) - return FALSE; - RRRegisterRate (pScreen, pSize, refresh); - if (mode == scrp->currentMode && - mode->HDisplay == scrp->virtualX && mode->VDisplay == scrp->virtualY) - RRSetCurrentConfig (pScreen, randrp->rotation, refresh, pSize); - if (mode->next == scrp->modes) - break; - } - if (scrp->currentMode->HDisplay != randrp->virtualX || - scrp->currentMode->VDisplay != randrp->virtualY) - { - mode = scrp->modes; - - RRModeMM.mode = NULL; - RRModeMM.virtX = randrp->virtualX; - RRModeMM.virtY = randrp->virtualY; - RRModeMM.mmWidth = randrp->mmWidth; - RRModeMM.mmHeight = randrp->mmHeight; - - if(scrp->DriverFunc) { - (*scrp->DriverFunc)(scrp, RR_GET_MODE_MM, &RRModeMM); - } - - pSize = RRRegisterSize (pScreen, - randrp->virtualX, randrp->virtualY, - RRModeMM.mmWidth, RRModeMM.mmHeight); - if (!pSize) - return FALSE; - RRRegisterRate (pScreen, pSize, refresh0); - if (scrp->virtualX == randrp->virtualX && - scrp->virtualY == randrp->virtualY) - { - RRSetCurrentConfig (pScreen, randrp->rotation, refresh0, pSize); - } - } - - /* If there is driver support for randr, let it set our supported rotations */ - if(scrp->DriverFunc) { - xorgRRRotation RRRotation; - - RRRotation.RRRotations = *rotations; - if (!(*scrp->DriverFunc)(scrp, RR_GET_INFO, &RRRotation)) - return TRUE; - *rotations = RRRotation.RRRotations; - } - - return TRUE; -} - -static Bool -xf86RandRSetMode (ScreenPtr pScreen, - DisplayModePtr mode, - Bool useVirtual, - int mmWidth, - int mmHeight) -{ - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); - XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); - int oldWidth = pScreen->width; - int oldHeight = pScreen->height; - int oldmmWidth = pScreen->mmWidth; - int oldmmHeight = pScreen->mmHeight; - WindowPtr pRoot = WindowTable[pScreen->myNum]; - Bool ret = TRUE; - - if (pRoot) - (*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE); - if (useVirtual) - { - scrp->virtualX = randrp->virtualX; - scrp->virtualY = randrp->virtualY; - } - else - { - scrp->virtualX = mode->HDisplay; - scrp->virtualY = mode->VDisplay; - } - if(randrp->rotation & (RR_Rotate_90 | RR_Rotate_270)) - { - /* If the screen is rotated 90 or 270 degrees, swap the sizes. */ - pScreen->width = scrp->virtualY; - pScreen->height = scrp->virtualX; - pScreen->mmWidth = mmHeight; - pScreen->mmHeight = mmWidth; - } - else - { - pScreen->width = scrp->virtualX; - pScreen->height = scrp->virtualY; - pScreen->mmWidth = mmWidth; - pScreen->mmHeight = mmHeight; - } - if (!xf86SwitchMode (pScreen, mode)) - { - scrp->virtualX = pScreen->width = oldWidth; - scrp->virtualY = pScreen->height = oldHeight; - pScreen->mmWidth = oldmmWidth; - pScreen->mmHeight = oldmmHeight; - ret = FALSE; - } - /* - * Make sure the layout is correct - */ - xf86ReconfigureLayout(); - - /* - * Make sure the whole screen is visible - */ - xf86SetViewport (pScreen, pScreen->width, pScreen->height); - xf86SetViewport (pScreen, 0, 0); - if (pRoot) - (*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE); - return ret; -} - -static Bool -xf86RandRSetConfig (ScreenPtr pScreen, - Rotation rotation, - int rate, - RRScreenSizePtr pSize) -{ - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); - XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); - DisplayModePtr mode; - int px, py; - Bool useVirtual = FALSE; - Rotation oldRotation = randrp->rotation; - - miPointerPosition (&px, &py); - for (mode = scrp->modes; ; mode = mode->next) - { - if (mode->HDisplay == pSize->width && - mode->VDisplay == pSize->height && - (rate == 0 || xf86RandRModeRefresh (mode) == rate)) - break; - if (mode->next == scrp->modes) - { - if (pSize->width == randrp->virtualX && - pSize->height == randrp->virtualY) - { - mode = scrp->modes; - useVirtual = TRUE; - break; - } - return FALSE; - } - } - - if (randrp->rotation != rotation) { - - /* Have the driver do its thing. */ - if (scrp->DriverFunc) { - xorgRRRotation RRRotation; - RRRotation.RRConfig.rotation = rotation; - RRRotation.RRConfig.rate = rate; - RRRotation.RRConfig.width = pSize->width; - RRRotation.RRConfig.height = pSize->height; - - /* - * Currently we need to rely on HW support for rotation. - */ - if (!(*scrp->DriverFunc)(scrp, RR_SET_CONFIG, &RRRotation)) - return FALSE; - } else - return FALSE; - - randrp->rotation = rotation; - } - - if (!xf86RandRSetMode (pScreen, mode, useVirtual, pSize->mmWidth, pSize->mmHeight)) { - if(randrp->rotation != oldRotation) { - /* Have the driver undo its thing. */ - if (scrp->DriverFunc) { - xorgRRRotation RRRotation; - RRRotation.RRConfig.rotation = oldRotation; - RRRotation.RRConfig.rate = xf86RandRModeRefresh (scrp->currentMode); - RRRotation.RRConfig.width = pScreen->width; - RRRotation.RRConfig.height = pScreen->height; - (*scrp->DriverFunc)(scrp, RR_SET_CONFIG, &RRRotation); - } - - randrp->rotation = oldRotation; - } - return FALSE; - } - /* - * Move the cursor back where it belongs; SwitchMode repositions it - */ - if (pScreen == miPointerCurrentScreen ()) - { - px = (px >= pScreen->width ? (pScreen->width - 1) : px); - py = (py >= pScreen->height ? (pScreen->height - 1) : py); - - xf86SetViewport(pScreen, px, py); - - (*pScreen->SetCursorPosition) (pScreen, px, py, FALSE); - } - - return TRUE; -} - -/* - * Wait until the screen is initialized before whacking the - * sizes around; otherwise the screen pixmap will be allocated - * at the current mode size rather than the maximum size - */ -static Bool -xf86RandRCreateScreenResources (ScreenPtr pScreen) -{ - XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); -#if 0 - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); - DisplayModePtr mode; -#endif - - pScreen->CreateScreenResources = randrp->CreateScreenResources; - if (!(*pScreen->CreateScreenResources) (pScreen)) - return FALSE; - -#if 0 - mode = scrp->currentMode; - if (mode) - xf86RandRSetMode (pScreen, mode, TRUE); -#endif - - return TRUE; -} - -/* - * Reset size back to original - */ -static Bool -xf86RandRCloseScreen (int index, ScreenPtr pScreen) -{ - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); - XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); - - scrp->virtualX = pScreen->width = randrp->virtualX; - scrp->virtualY = pScreen->height = randrp->virtualY; - scrp->currentMode = scrp->modes; - pScreen->CloseScreen = randrp->CloseScreen; - xfree (randrp); - pScreen->devPrivates[xf86RandRIndex].ptr = 0; - return (*pScreen->CloseScreen) (index, pScreen); -} - -Rotation -xf86GetRotation(ScreenPtr pScreen) -{ - if (xf86RandRIndex == -1) - return RR_Rotate_0; - - return XF86RANDRINFO(pScreen)->rotation; -} - -/* Function to change RandR's idea of the virtual screen size */ -Bool -xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen, - int newvirtX, int newvirtY, int newmmWidth, int newmmHeight, - Bool resetMode) -{ - XF86RandRInfoPtr randrp; - - if (xf86RandRIndex == -1) - return FALSE; - - randrp = XF86RANDRINFO(pScreen); - if (randrp == NULL) - return FALSE; - - if (newvirtX > 0) - randrp->virtualX = newvirtX; - - if (newvirtY > 0) - randrp->virtualY = newvirtY; - - if (newmmWidth > 0) - randrp->mmWidth = newmmWidth; - - if (newmmHeight > 0) - randrp->mmHeight = newmmHeight; - - /* This is only for during server start */ - if (resetMode) { - return (xf86RandRSetMode(pScreen, - XF86SCRNINFO(pScreen)->currentMode, - TRUE, - pScreen->mmWidth, pScreen->mmHeight)); - } - - return TRUE; -} - -Bool -xf86RandRInit (ScreenPtr pScreen) -{ - rrScrPrivPtr rp; - XF86RandRInfoPtr randrp; - ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); - -#ifdef PANORAMIX - /* XXX disable RandR when using Xinerama */ - if (!noPanoramiXExtension) - return TRUE; -#endif - if (xf86RandRGeneration != serverGeneration) - { - xf86RandRIndex = AllocateScreenPrivateIndex(); - xf86RandRGeneration = serverGeneration; - } - - randrp = xalloc (sizeof (XF86RandRInfoRec)); - if (!randrp) - return FALSE; - - if (!RRScreenInit (pScreen)) - { - xfree (randrp); - return FALSE; - } - rp = rrGetScrPriv(pScreen); - rp->rrGetInfo = xf86RandRGetInfo; - rp->rrSetConfig = xf86RandRSetConfig; - - randrp->virtualX = scrp->virtualX; - randrp->virtualY = scrp->virtualY; - randrp->mmWidth = pScreen->mmWidth; - randrp->mmHeight = pScreen->mmHeight; - - randrp->CreateScreenResources = pScreen->CreateScreenResources; - pScreen->CreateScreenResources = xf86RandRCreateScreenResources; - - randrp->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = xf86RandRCloseScreen; - - randrp->rotation = RR_Rotate_0; - - pScreen->devPrivates[xf86RandRIndex].ptr = randrp; - return TRUE; -} - - diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Resources.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Resources.h deleted file mode 100644 index ce2c62bb3..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Resources.h +++ /dev/null @@ -1,140 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Resources.h,v 1.15 2003/08/24 17:36:55 dawes Exp $ */ - -/* - * Copyright (c) 1999-2002 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifndef _XF86_RESOURCES_H - -#define _XF86_RESOURCES_H - -#include "xf86str.h" - -#define _END {ResEnd,0,0} - -#define _VGA_EXCLUSIVE \ - {ResExcMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\ - {ResExcMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\ - {ResExcMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\ - {ResExcIoBlock | ResBios | ResBus, 0x03B0, 0x03BB},\ - {ResExcIoBlock | ResBios | ResBus, 0x03C0, 0x03DF} - -#define _VGA_SHARED \ - {ResShrMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\ - {ResShrMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\ - {ResShrMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\ - {ResShrIoBlock | ResBios | ResBus, 0x03B0, 0x03BB},\ - {ResShrIoBlock | ResBios | ResBus, 0x03C0, 0x03DF} - -#define _VGA_SHARED_MEM \ - {ResShrMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\ - {ResShrMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\ - {ResShrMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF} - -#define _VGA_SHARED_IO \ - {ResShrIoBlock | ResBios | ResBus, 0x03B0, 0x03BB},\ - {ResShrIoBlock | ResBios | ResBus, 0x03C0, 0x03DF} - -/* - * Exclusive unused VGA: resources unneeded but cannot be disabled. - * Like old Millennium. - */ -#define _VGA_EXCLUSIVE_UNUSED \ - {ResExcUusdMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\ - {ResExcUusdMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\ - {ResExcUusdMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\ - {ResExcUusdIoBlock | ResBios | ResBus, 0x03B0, 0x03BB},\ - {ResExcUusdIoBlock | ResBios | ResBus, 0x03C0, 0x03DF} - -/* - * Shared unused VGA: resources unneeded but cannot be disabled - * independently. This is used to determine if a device needs RAC. - */ -#define _VGA_SHARED_UNUSED \ - {ResShrUusdMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\ - {ResShrUusdMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\ - {ResShrUusdMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\ - {ResShrUusdIoBlock | ResBios | ResBus, 0x03B0, 0x03BB},\ - {ResShrUusdIoBlock | ResBios | ResBus, 0x03C0, 0x03DF} - -/* - * Sparse versions of the above for those adapters that respond to all ISA - * aliases of VGA ports. - */ -#define _VGA_EXCLUSIVE_SPARSE \ - {ResExcMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\ - {ResExcMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\ - {ResExcMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\ - {ResExcIoSparse | ResBios | ResBus, 0x03B0, 0x03F8},\ - {ResExcIoSparse | ResBios | ResBus, 0x03B8, 0x03FC},\ - {ResExcIoSparse | ResBios | ResBus, 0x03C0, 0x03E0} - -#define _VGA_SHARED_SPARSE \ - {ResShrMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\ - {ResShrMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\ - {ResShrMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\ - {ResShrIoSparse | ResBios | ResBus, 0x03B0, 0x03F8},\ - {ResShrIoSparse | ResBios | ResBus, 0x03B8, 0x03FC},\ - {ResShrIoSparse | ResBios | ResBus, 0x03C0, 0x03E0} - -#define _8514_EXCLUSIVE \ - {ResExcIoSparse | ResBios | ResBus, 0x02E8, 0x03F8} - -#define _8514_SHARED \ - {ResShrIoSparse | ResBios | ResBus, 0x02E8, 0x03F8} - -/* Predefined resources */ -extern resRange resVgaExclusive[]; -extern resRange resVgaShared[]; -extern resRange resVgaIoShared[]; -extern resRange resVgaMemShared[]; -extern resRange resVgaUnusedExclusive[]; -extern resRange resVgaUnusedShared[]; -extern resRange resVgaSparseExclusive[]; -extern resRange resVgaSparseShared[]; -extern resRange res8514Exclusive[]; -extern resRange res8514Shared[]; - -/* Less misleading aliases for xf86SetOperatingState() */ -#define resVgaMem resVgaMemShared -#define resVgaIo resVgaIoShared -#define resVga resVgaShared - -/* Old style names */ -#define RES_EXCLUSIVE_VGA resVgaExclusive -#define RES_SHARED_VGA resVgaShared -#define RES_EXCLUSIVE_8514 res8514Exclusive -#define RES_SHARED_8514 res8514Shared - -#define _PCI_AVOID_PC_STYLE \ - {ResExcIoSparse | ResBus, 0x0100, 0x0300},\ - {ResExcIoSparse | ResBus, 0x0200, 0x0200},\ - {ResExcMemBlock | ResBus, 0xA0000,0xFFFFF} - -extern resRange PciAvoid[]; - -#define RES_UNDEFINED NULL -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Versions.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Versions.c deleted file mode 100644 index 6de7d53c2..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Versions.c +++ /dev/null @@ -1,81 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Versions.c,v 1.2 2003/08/24 20:01:19 dawes Exp $ */ -/* - * Copyright (c) 2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86.h" -#include "xf86OSmouse.h" -#include "xf86OSKbd.h" - -static CARD32 registeredVersions[NUM_BUILTIN_IFS]; - -CARD32 -xf86GetBuiltinInterfaceVersion(BuiltinInterface iface, int flags) -{ - if (iface < 0 || iface >= NUM_BUILTIN_IFS) { - xf86Msg(X_ERROR, "xf86GetBuiltinInterfaceVersion: Unexpected interface" - "query: %d\n", iface); - return 0; - } - - if (registeredVersions[iface]) - return registeredVersions[iface]; - - /* Most built-in interfaces are handled this way. */ - switch (iface) { - case BUILTIN_IF_OSMOUSE: - return OS_MOUSE_VERSION_CURRENT; - case BUILTIN_IF_OSKBD: - return OS_KBD_VERSION_CURRENT; - default: - xf86Msg(X_ERROR, "xf86GetBuiltinInterfaceVersion: internal error: " - "interface %d not handled\n", iface); - return 0; - } -} - -Bool -xf86RegisterBuiltinInterfaceVersion(BuiltinInterface iface, CARD32 version, - int flags) -{ - if (iface < 0 || iface >= NUM_BUILTIN_IFS) { - xf86Msg(X_ERROR, "xf86RegisterBuiltinInterfaceVersion: " - "unexpected interface number: %d\n", iface); - return FALSE; - } - if (version == 0) { - xf86Msg(X_ERROR, "xf86RegisterBuiltinInterfaceVersion: " - "versions must be greater than zero\n"); - return FALSE; - } - registeredVersions[iface] = version; - return TRUE; -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86VidMode.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86VidMode.c deleted file mode 100644 index 81e4b969e..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86VidMode.c +++ /dev/null @@ -1,722 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c,v 1.17 2003/08/24 17:36:55 dawes Exp $ */ -/* - * Copyright (c) 1999-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * This file contains the VidMode functions required by the extension. - * These have been added to avoid the need for the higher level extension - * code to access the private XFree86 data structures directly. Wherever - * possible this code uses the functions in xf86Mode.c to do the work, - * so that two version of code that do similar things don't have to be - * maintained. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" - -#ifdef XF86VIDMODE -#include "vidmodeproc.h" -#include "xf86cmap.h" - -static int VidModeGeneration = 0; -static int VidModeIndex = -1; -static int VidModeCount = 0; -static Bool VidModeClose(int i, ScreenPtr pScreen); - -#define VMPTR(p) ((VidModePtr)(p)->devPrivates[VidModeIndex].ptr) - -#endif - -#ifdef DEBUG -# define DEBUG_P(x) ErrorF(x"\n"); -#else -# define DEBUG_P(x) /**/ -#endif - -Bool -VidModeExtensionInit(ScreenPtr pScreen) -{ -#ifdef XF86VIDMODE - VidModePtr pVidMode; - - DEBUG_P("VidModeExtensionInit"); - - if (!xf86GetVidModeEnabled()) { - DEBUG_P("!xf86GetVidModeEnabled()"); - return FALSE; - } - - if (serverGeneration != VidModeGeneration) { - if ((VidModeIndex = AllocateScreenPrivateIndex()) < 0) { - DEBUG_P("AllocateScreenPrivateIndex() failed"); - return FALSE; - } - VidModeGeneration = serverGeneration; - } - - if (!(pScreen->devPrivates[VidModeIndex].ptr = xcalloc(sizeof(VidModeRec), 1))) { - DEBUG_P("xcalloc failed"); - return FALSE; - } - - pVidMode = VMPTR(pScreen); - pVidMode->Flags = 0; - pVidMode->Next = NULL; - pVidMode->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = VidModeClose; - VidModeCount++; - return TRUE; -#else - DEBUG_P("no vidmode extension"); - return FALSE; -#endif -} - - -#ifdef XF86VIDMODE - -static Bool -VidModeClose(int i, ScreenPtr pScreen) -{ - VidModePtr pVidMode = VMPTR(pScreen); - - DEBUG_P("VidModeClose"); - - /* This shouldn't happen */ - if (!pVidMode) - return FALSE; - - pScreen->CloseScreen = pVidMode->CloseScreen; - - if (--VidModeCount == 0) { - if (pScreen->devPrivates[VidModeIndex].ptr) - xfree(pScreen->devPrivates[VidModeIndex].ptr); - pScreen->devPrivates[VidModeIndex].ptr = NULL; - VidModeIndex = -1; - } - return pScreen->CloseScreen(i, pScreen); -} - -Bool -VidModeAvailable(int scrnIndex) -{ - ScrnInfoPtr pScrn; - VidModePtr pVidMode; - - DEBUG_P("VidModeAvailable"); - - if (VidModeIndex < 0) { - DEBUG_P("VidModeIndex < 0"); - return FALSE; - } - - pScrn = xf86Screens[scrnIndex]; - if (pScrn == NULL) { - DEBUG_P("pScrn == NULL"); - return FALSE; - } - - pVidMode = VMPTR(pScrn->pScreen); - if (pVidMode) - return TRUE; - else { - DEBUG_P("pVidMode == NULL"); - return FALSE; - } -} - -Bool -VidModeGetCurrentModeline(int scrnIndex, pointer *mode, int *dotClock) -{ - ScrnInfoPtr pScrn; - - DEBUG_P("VidModeGetCurrentModeline"); - - if (!VidModeAvailable(scrnIndex)) - return FALSE; - - pScrn = xf86Screens[scrnIndex]; - *mode = (pointer)(pScrn->currentMode); - *dotClock = pScrn->currentMode->Clock; - - return TRUE; -} - -int -VidModeGetDotClock(int scrnIndex, int Clock) -{ - ScrnInfoPtr pScrn; - - DEBUG_P("VidModeGetDotClock"); - - if (!VidModeAvailable(scrnIndex)) - return 0; - - pScrn = xf86Screens[scrnIndex]; - if ((pScrn->progClock) || (Clock > MAXCLOCKS)) - return Clock; - else - return pScrn->clock[Clock]; -} - -int -VidModeGetNumOfClocks(int scrnIndex, Bool *progClock) -{ - ScrnInfoPtr pScrn; - - DEBUG_P("VidModeGetNumOfClocks"); - - if (!VidModeAvailable(scrnIndex)) - return 0; - - pScrn = xf86Screens[scrnIndex]; - if (pScrn->progClock){ - *progClock = TRUE; - return 0; - } else { - *progClock = FALSE; - return pScrn->numClocks; - } -} - -Bool -VidModeGetClocks(int scrnIndex, int *Clocks) -{ - ScrnInfoPtr pScrn; - int i; - - DEBUG_P("VidModeGetClocks"); - - if (!VidModeAvailable(scrnIndex)) - return FALSE; - - pScrn = xf86Screens[scrnIndex]; - - if (pScrn->progClock) - return FALSE; - - for (i = 0; i < pScrn->numClocks; i++) - *Clocks++ = pScrn->clock[i]; - - return TRUE; -} - - -Bool -VidModeGetFirstModeline(int scrnIndex, pointer *mode, int *dotClock) -{ - ScrnInfoPtr pScrn; - VidModePtr pVidMode; - - DEBUG_P("VidModeGetFirstModeline"); - - if (!VidModeAvailable(scrnIndex)) - return FALSE; - - pScrn = xf86Screens[scrnIndex]; - pVidMode = VMPTR(pScrn->pScreen); - pVidMode->First = pScrn->modes; - pVidMode->Next = pVidMode->First->next; - - if (pVidMode->First->status == MODE_OK) { - *mode = (pointer)(pVidMode->First); - *dotClock = VidModeGetDotClock(scrnIndex, pVidMode->First->Clock); - return TRUE; - } - - return VidModeGetNextModeline(scrnIndex, mode, dotClock); -} - -Bool -VidModeGetNextModeline(int scrnIndex, pointer *mode, int *dotClock) -{ - ScrnInfoPtr pScrn; - VidModePtr pVidMode; - DisplayModePtr p; - - DEBUG_P("VidModeGetNextModeline"); - - if (!VidModeAvailable(scrnIndex)) - return FALSE; - - pScrn = xf86Screens[scrnIndex]; - pVidMode = VMPTR(pScrn->pScreen); - - for (p = pVidMode->Next; p != NULL && p != pVidMode->First; p = p->next) { - if (p->status == MODE_OK) { - pVidMode->Next = p->next; - *mode = (pointer)p; - *dotClock = VidModeGetDotClock(scrnIndex, p->Clock); - return TRUE; - } - } - - return FALSE; -} - -Bool -VidModeDeleteModeline(int scrnIndex, pointer mode) -{ - ScrnInfoPtr pScrn; - - DEBUG_P("VidModeDeleteModeline"); - - if ((mode == NULL) || (!VidModeAvailable(scrnIndex))) - return FALSE; - - pScrn = xf86Screens[scrnIndex]; - xf86DeleteMode(&(pScrn->modes), (DisplayModePtr)mode); - return TRUE; -} - -Bool -VidModeZoomViewport(int scrnIndex, int zoom) -{ - ScrnInfoPtr pScrn; - - DEBUG_P("VidModeZoomViewPort"); - - if (!VidModeAvailable(scrnIndex)) - return FALSE; - - pScrn = xf86Screens[scrnIndex]; - xf86ZoomViewport(pScrn->pScreen, zoom); - return TRUE; -} - -Bool -VidModeSetViewPort(int scrnIndex, int x, int y) -{ - ScrnInfoPtr pScrn; - - DEBUG_P("VidModeSetViewPort"); - - if (!VidModeAvailable(scrnIndex)) - return FALSE; - - pScrn = xf86Screens[scrnIndex]; - pScrn->frameX0 = min( max(x, 0), - pScrn->virtualX - pScrn->currentMode->HDisplay ); - pScrn->frameX1 = pScrn->frameX0 + pScrn->currentMode->HDisplay - 1; - pScrn->frameY0 = min( max(y, 0), - pScrn->virtualY - pScrn->currentMode->VDisplay ); - pScrn->frameY1 = pScrn->frameY0 + pScrn->currentMode->VDisplay - 1; - if (pScrn->AdjustFrame != NULL) - (pScrn->AdjustFrame)(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - - return TRUE; -} - -Bool -VidModeGetViewPort(int scrnIndex, int *x, int *y) -{ - ScrnInfoPtr pScrn; - - DEBUG_P("VidModeGetViewPort"); - - if (!VidModeAvailable(scrnIndex)) - return FALSE; - - pScrn = xf86Screens[scrnIndex]; - *x = pScrn->frameX0; - *y = pScrn->frameY0; - return TRUE; -} - -Bool -VidModeSwitchMode(int scrnIndex, pointer mode) -{ - ScrnInfoPtr pScrn; - DisplayModePtr pTmpMode; - Bool retval; - - DEBUG_P("VidModeSwitchMode"); - - if (!VidModeAvailable(scrnIndex)) - return FALSE; - - pScrn = xf86Screens[scrnIndex]; - /* save in case we fail */ - pTmpMode = pScrn->currentMode; - /* Force a mode switch */ - pScrn->currentMode = NULL; - retval = xf86SwitchMode(pScrn->pScreen, mode); - /* we failed: restore it */ - if (retval == FALSE) - pScrn->currentMode = pTmpMode; - return retval; -} - -Bool -VidModeLockZoom(int scrnIndex, Bool lock) -{ - ScrnInfoPtr pScrn; - - DEBUG_P("VidModeLockZoom"); - - if (!VidModeAvailable(scrnIndex)) - return FALSE; - - pScrn = xf86Screens[scrnIndex]; - - if (xf86Info.dontZoom) - return FALSE; - - xf86LockZoom(pScrn->pScreen, lock); - return TRUE; -} - -Bool -VidModeGetMonitor(int scrnIndex, pointer *monitor) -{ - ScrnInfoPtr pScrn; - - DEBUG_P("VidModeGetMonitor"); - - if (!VidModeAvailable(scrnIndex)) - return FALSE; - - pScrn = xf86Screens[scrnIndex]; - *monitor = (pointer)(pScrn->monitor); - - return TRUE; -} - -ModeStatus -VidModeCheckModeForMonitor(int scrnIndex, pointer mode) -{ - ScrnInfoPtr pScrn; - - DEBUG_P("VidModeCheckModeForMonitor"); - - if ((mode == NULL) || (!VidModeAvailable(scrnIndex))) - return MODE_ERROR; - - pScrn = xf86Screens[scrnIndex]; - - return xf86CheckModeForMonitor((DisplayModePtr)mode, pScrn->monitor); -} - -ModeStatus -VidModeCheckModeForDriver(int scrnIndex, pointer mode) -{ - ScrnInfoPtr pScrn; - - DEBUG_P("VidModeCheckModeForDriver"); - - if ((mode == NULL) || (!VidModeAvailable(scrnIndex))) - return MODE_ERROR; - - pScrn = xf86Screens[scrnIndex]; - - return xf86CheckModeForDriver(pScrn, (DisplayModePtr)mode, 0); -} - -void -VidModeSetCrtcForMode(int scrnIndex, pointer mode) -{ - ScrnInfoPtr pScrn; - DisplayModePtr ScreenModes; - - DEBUG_P("VidModeSetCrtcForMode"); - - if ((mode == NULL) || (!VidModeAvailable(scrnIndex))) - return; - - /* Ugly hack so that the xf86Mode.c function can be used without change */ - pScrn = xf86Screens[scrnIndex]; - ScreenModes = pScrn->modes; - pScrn->modes = (DisplayModePtr)mode; - - xf86SetCrtcForModes(pScrn, pScrn->adjustFlags); - pScrn->modes = ScreenModes; - return; -} - -Bool -VidModeAddModeline(int scrnIndex, pointer mode) -{ - ScrnInfoPtr pScrn; - - DEBUG_P("VidModeAddModeline"); - - if ((mode == NULL) || (!VidModeAvailable(scrnIndex))) - return FALSE; - - pScrn = xf86Screens[scrnIndex]; - - ((DisplayModePtr)mode)->name = strdup(""); /* freed by deletemode */ - ((DisplayModePtr)mode)->status = MODE_OK; - ((DisplayModePtr)mode)->next = pScrn->modes->next; - ((DisplayModePtr)mode)->prev = pScrn->modes; - pScrn->modes->next = (DisplayModePtr)mode; - if( ((DisplayModePtr)mode)->next != NULL ) - ((DisplayModePtr)mode)->next->prev = (DisplayModePtr)mode; - - return TRUE; -} - -int -VidModeGetNumOfModes(int scrnIndex) -{ - pointer mode = NULL; - int dotClock= 0, nummodes = 0; - - DEBUG_P("VidModeGetNumOfModes"); - - if (!VidModeGetFirstModeline(scrnIndex, &mode, &dotClock)) - return nummodes; - - do { - nummodes++; - if (!VidModeGetNextModeline(scrnIndex, &mode, &dotClock)) - return nummodes; - } while (TRUE); -} - -Bool -VidModeSetGamma(int scrnIndex, float red, float green, float blue) -{ - ScrnInfoPtr pScrn; - Gamma gamma; - - DEBUG_P("VidModeSetGamma"); - - if (!VidModeAvailable(scrnIndex)) - return FALSE; - - pScrn = xf86Screens[scrnIndex]; - gamma.red = red; - gamma.green = green; - gamma.blue = blue; - if (xf86ChangeGamma(pScrn->pScreen, gamma) != Success) - return FALSE; - else - return TRUE; -} - -Bool -VidModeGetGamma(int scrnIndex, float *red, float *green, float *blue) -{ - ScrnInfoPtr pScrn; - - DEBUG_P("VidModeGetGamma"); - - if (!VidModeAvailable(scrnIndex)) - return FALSE; - - pScrn = xf86Screens[scrnIndex]; - *red = pScrn->gamma.red; - *green = pScrn->gamma.green; - *blue = pScrn->gamma.blue; - return TRUE; -} - -Bool -VidModeSetGammaRamp(int scrnIndex, int size, CARD16 *r, CARD16 *g, CARD16 *b) -{ - ScrnInfoPtr pScrn; - - if (!VidModeAvailable(scrnIndex)) - return FALSE; - - pScrn = xf86Screens[scrnIndex]; - xf86ChangeGammaRamp(pScrn->pScreen, size, r, g, b); - return TRUE; -} - -Bool -VidModeGetGammaRamp(int scrnIndex, int size, CARD16 *r, CARD16 *g, CARD16 *b) -{ - ScrnInfoPtr pScrn; - - if (!VidModeAvailable(scrnIndex)) - return FALSE; - - pScrn = xf86Screens[scrnIndex]; - xf86GetGammaRamp(pScrn->pScreen, size, r, g, b); - return TRUE; -} - -int -VidModeGetGammaRampSize(int scrnIndex) -{ - if (!VidModeAvailable(scrnIndex)) - return 0; - - return xf86GetGammaRampSize(xf86Screens[scrnIndex]->pScreen); -} - -pointer -VidModeCreateMode(void) -{ - DisplayModePtr mode; - - mode = xalloc(sizeof(DisplayModeRec)); - if (mode != NULL) { - mode->name = ""; - mode->VScan = 1; /* divides refresh rate. default = 1 */ - mode->Private = NULL; - mode->next = mode; - mode->prev = mode; - } - return mode; -} - -void -VidModeCopyMode(pointer modefrom, pointer modeto) -{ - memcpy(modeto, modefrom, sizeof(DisplayModeRec)); -} - - -int -VidModeGetModeValue(pointer mode, int valtyp) -{ - int ret = 0; - - switch (valtyp) { - case VIDMODE_H_DISPLAY: - ret = ((DisplayModePtr) mode)->HDisplay; - break; - case VIDMODE_H_SYNCSTART: - ret = ((DisplayModePtr)mode)->HSyncStart; - break; - case VIDMODE_H_SYNCEND: - ret = ((DisplayModePtr)mode)->HSyncEnd; - break; - case VIDMODE_H_TOTAL: - ret = ((DisplayModePtr)mode)->HTotal; - break; - case VIDMODE_H_SKEW: - ret = ((DisplayModePtr)mode)->HSkew; - break; - case VIDMODE_V_DISPLAY: - ret = ((DisplayModePtr)mode)->VDisplay; - break; - case VIDMODE_V_SYNCSTART: - ret = ((DisplayModePtr)mode)->VSyncStart; - break; - case VIDMODE_V_SYNCEND: - ret = ((DisplayModePtr)mode)->VSyncEnd; - break; - case VIDMODE_V_TOTAL: - ret = ((DisplayModePtr)mode)->VTotal; - break; - case VIDMODE_FLAGS: - ret = ((DisplayModePtr)mode)->Flags; - break; - case VIDMODE_CLOCK: - ret = ((DisplayModePtr)mode)->Clock; - break; - } - return ret; -} - -void -VidModeSetModeValue(pointer mode, int valtyp, int val) -{ - switch (valtyp) { - case VIDMODE_H_DISPLAY: - ((DisplayModePtr)mode)->HDisplay = val; - break; - case VIDMODE_H_SYNCSTART: - ((DisplayModePtr)mode)->HSyncStart = val; - break; - case VIDMODE_H_SYNCEND: - ((DisplayModePtr)mode)->HSyncEnd = val; - break; - case VIDMODE_H_TOTAL: - ((DisplayModePtr)mode)->HTotal = val; - break; - case VIDMODE_H_SKEW: - ((DisplayModePtr)mode)->HSkew = val; - break; - case VIDMODE_V_DISPLAY: - ((DisplayModePtr)mode)->VDisplay = val; - break; - case VIDMODE_V_SYNCSTART: - ((DisplayModePtr)mode)->VSyncStart = val; - break; - case VIDMODE_V_SYNCEND: - ((DisplayModePtr)mode)->VSyncEnd = val; - break; - case VIDMODE_V_TOTAL: - ((DisplayModePtr)mode)->VTotal = val; - break; - case VIDMODE_FLAGS: - ((DisplayModePtr)mode)->Flags = val; - break; - case VIDMODE_CLOCK: - ((DisplayModePtr)mode)->Clock = val; - break; - } - return; -} - -vidMonitorValue -VidModeGetMonitorValue(pointer monitor, int valtyp, int indx) -{ - vidMonitorValue ret; - - switch (valtyp) { - case VIDMODE_MON_VENDOR: - ret.ptr = (((MonPtr)monitor)->vendor); - break; - case VIDMODE_MON_MODEL: - ret.ptr = (((MonPtr)monitor)->model); - break; - case VIDMODE_MON_NHSYNC: - ret.i = ((MonPtr)monitor)->nHsync; - break; - case VIDMODE_MON_NVREFRESH: - ret.i = ((MonPtr)monitor)->nVrefresh; - break; - case VIDMODE_MON_HSYNC_LO: - ret.f = (100.0 * ((MonPtr)monitor)->hsync[indx].lo); - break; - case VIDMODE_MON_HSYNC_HI: - ret.f = (100.0 * ((MonPtr)monitor)->hsync[indx].hi); - break; - case VIDMODE_MON_VREFRESH_LO: - ret.f = (100.0 * ((MonPtr)monitor)->vrefresh[indx].lo); - break; - case VIDMODE_MON_VREFRESH_HI: - ret.f = (100.0 * ((MonPtr)monitor)->vrefresh[indx].hi); - break; - } - return ret; -} - - -#endif /* XF86VIDMODE */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86XKB.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86XKB.c deleted file mode 100644 index 68be17c3a..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86XKB.c +++ /dev/null @@ -1,82 +0,0 @@ -/* $XConsortium: xf86XKB.c /main/4 1996/02/04 09:28:04 kaleb $ */ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright -notice appear in all copies and that both that copyright -notice and this permission notice appear in supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ -/* - * Copyright (c) 1994-2002 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86XKB.c,v 3.12 2003/08/24 17:36:55 dawes Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#define NEED_EVENTS 1 -#include -#include -#include -#include "inputstr.h" -#include "scrnintstr.h" -#include "windowstr.h" -#include - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#define XF86_OS_PRIVS -#include "xf86_OSlib.h" - -#include - -void -xf86InitXkb(void) -{ -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Xinput.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Xinput.c deleted file mode 100644 index cc9e76361..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Xinput.c +++ /dev/null @@ -1,1513 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c,v 3.70 2003/11/03 05:11:02 tsi Exp $ */ -/* - * Copyright 1995-1999 by Frederic Lepied, France. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Frederic Lepied not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Frederic Lepied makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* - * Copyright (c) 2000-2002 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ -/* $XConsortium: xf86Xinput.c /main/14 1996/10/27 11:05:25 kaleb $ */ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c,v 1.7 2005/10/21 19:06:13 ajax Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#ifdef XINPUT -#include -#include -#endif -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Xinput.h" -#ifdef XINPUT -#include "XIstubs.h" -#endif -#include "mipointer.h" -#include "xf86InPriv.h" - -#ifdef DPMSExtension -#define DPMS_SERVER -#include -#include "dpmsproc.h" -#endif - -#ifdef XFreeXDGA -#include "dgaproc.h" -#endif - -#include "exevents.h" /* AddInputDevice */ -#include "exglobals.h" - -#define EXTENSION_PROC_ARGS void * -#include "extnsionst.h" -#include "extinit.h" /* LookupDeviceIntRec */ - -#include "windowstr.h" /* screenIsSaved */ - -#include - -#include "osdep.h" /* EnabledDevices */ -#include -#include "xf86_OSproc.h" /* sigio stuff */ - -/****************************************************************************** - * debugging macro - *****************************************************************************/ -#ifdef DBG -#undef DBG -#endif -#ifdef DEBUG -#undef DEBUG -#endif - -#define DEBUG 0 - -#if DEBUG -static int debug_level = 0; - -#define DBG(lvl, f) {if ((lvl) <= debug_level) f;} -#else -#define DBG(lvl, f) -#endif - -/****************************************************************************** - * macros - *****************************************************************************/ -#define ENQUEUE(e) xf86eqEnqueue((e)) - -/*********************************************************************** - * - * xf86AlwaysCoreControl -- - * - * Control proc for the integer feedback that controls the always - * core feature. - * - *********************************************************************** - */ -static void -xf86AlwaysCoreControl(DeviceIntPtr device, - IntegerCtrl *control) -{ -} - -/*********************************************************************** - * - * Core devices functions -- - * - * Test if device is the core device by checking the - * value of always core feedback and the inputInfo struct. - * - *********************************************************************** - */ -int -xf86IsCorePointer(DeviceIntPtr device) -{ - return(device == inputInfo.pointer); -} - -static int -xf86ShareCorePointer(DeviceIntPtr device) -{ - LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate; - - return((local->always_core_feedback && - local->always_core_feedback->ctrl.integer_displayed)); -} - -static Bool -xf86SendDragEvents(DeviceIntPtr device) -{ - LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate; - - if (inputInfo.pointer->button->buttonsDown > 0) - return (local->flags & XI86_SEND_DRAG_EVENTS); - else - return (TRUE); -} - -int -xf86IsCoreKeyboard(DeviceIntPtr device) -{ - LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate; - - return((local->flags & XI86_ALWAYS_CORE) || - (device == inputInfo.keyboard)); -} - -void -xf86XInputSetSendCoreEvents(LocalDevicePtr local, Bool always) -{ - if (always) { - local->flags |= XI86_ALWAYS_CORE; - } else { - local->flags &= ~XI86_ALWAYS_CORE; - } -} - -static int xf86CoreButtonState; - -/*********************************************************************** - * - * xf86CheckButton -- - * - * Test if the core pointer button state is coherent with - * the button event to send. - * - *********************************************************************** - */ -Bool -xf86CheckButton(int button, - int down) -{ - int check; - int bit = (1 << (button - 1)); - - check = xf86CoreButtonState & bit; - - DBG(5, ErrorF("xf86CheckButton " - "button=%d down=%d state=%d check=%d returns ", - button, down, xf86CoreButtonState, check)); - if ((check && down) || (!check && !down)) { - DBG(5, ErrorF("FALSE\n")); - return FALSE; - } - xf86CoreButtonState ^= bit; - - DBG(5, ErrorF("TRUE\n")); - return TRUE; -} - -/*********************************************************************** - * - * xf86ProcessCommonOptions -- - * - * Process global options. - * - *********************************************************************** - */ -void -xf86ProcessCommonOptions(LocalDevicePtr local, - pointer list) -{ - if (xf86SetBoolOption(list, "AlwaysCore", 0) || - xf86SetBoolOption(list, "SendCoreEvents", 0)) { - local->flags |= XI86_ALWAYS_CORE; - xf86Msg(X_CONFIG, "%s: always reports core events\n", local->name); - } - - if (xf86SetBoolOption(list, "CorePointer", 0)) { - local->flags |= XI86_CORE_POINTER; - xf86Msg(X_CONFIG, "%s: Core Pointer\n", local->name); - } - - if (xf86SetBoolOption(list, "CoreKeyboard", 0)) { - local->flags |= XI86_CORE_KEYBOARD; - xf86Msg(X_CONFIG, "%s: Core Keyboard\n", local->name); - } - - if (xf86SetBoolOption(list, "SendDragEvents", 1)) { - local->flags |= XI86_SEND_DRAG_EVENTS; - } else { - xf86Msg(X_CONFIG, "%s: doesn't report drag events\n", local->name); - } - - local->history_size = xf86SetIntOption(list, "HistorySize", 0); - - if (local->history_size > 0) { - xf86Msg(X_CONFIG, "%s: has a history of %d motions\n", local->name, - local->history_size); - } -} - -/*********************************************************************** - * - * xf86XinputFinalizeInit -- - * - * Create and initialize an integer feedback to control the always - * core feature. - * - *********************************************************************** - */ -void -xf86XinputFinalizeInit(DeviceIntPtr dev) -{ - LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate; - - local->dxremaind = 0.0; - local->dyremaind = 0.0; - - if (InitIntegerFeedbackClassDeviceStruct(dev, xf86AlwaysCoreControl) == FALSE) { - ErrorF("Unable to init integer feedback for always core feature\n"); - } else { - local->always_core_feedback = dev->intfeed; - dev->intfeed->ctrl.integer_displayed = (local->flags & XI86_ALWAYS_CORE) ? 1 : 0; - } -} - -/*********************************************************************** - * - * xf86ActivateDevice -- - * - * Initialize an input device. - * - *********************************************************************** - */ -void -xf86ActivateDevice(LocalDevicePtr local) -{ - DeviceIntPtr dev; - - if (local->flags & XI86_CONFIGURED) { - int open_on_init; - - open_on_init = local->flags & - (XI86_OPEN_ON_INIT | - XI86_ALWAYS_CORE | XI86_CORE_POINTER | XI86_CORE_KEYBOARD); - - dev = AddInputDevice(local->device_control, - open_on_init); - if (dev == NULL) - FatalError("Too many input devices"); - - local->atom = MakeAtom(local->type_name, - strlen(local->type_name), - TRUE); - AssignTypeAndName (dev, local->atom, local->name); - dev->public.devicePrivate = (pointer) local; - local->dev = dev; - - xf86XinputFinalizeInit(dev); - - /* - * XXX Can a single device instance be both core keyboard and - * core pointer? If so, this should be changed. - */ - if (local->flags & XI86_CORE_POINTER) - RegisterPointerDevice(dev); - else if (local->flags & XI86_CORE_KEYBOARD) - RegisterKeyboardDevice(dev); -#ifdef XINPUT - else - RegisterOtherDevice(dev); -#endif - - if (serverGeneration == 1) - xf86Msg(X_INFO, "XINPUT: Adding extended input device \"%s\" (type: %s)\n", - local->name, local->type_name); - } -} - - -#ifdef XINPUT -/*********************************************************************** - * - * Caller: ProcXOpenDevice - * - * This is the implementation-dependent routine to open an input device. - * Some implementations open all input devices when the server is first - * initialized, and never close them. Other implementations open only - * the X pointer and keyboard devices during server initialization, - * and only open other input devices when some client makes an - * XOpenDevice request. This entry point is for the latter type of - * implementation. - * - * If the physical device is not already open, do it here. In this case, - * you need to keep track of the fact that one or more clients has the - * device open, and physically close it when the last client that has - * it open does an XCloseDevice. - * - * The default implementation is to do nothing (assume all input devices - * are opened during X server initialization and kept open). - * - *********************************************************************** - */ - -void -OpenInputDevice(DeviceIntPtr dev, - ClientPtr client, - int *status) -{ - if (!dev->inited) { - *status = BadDevice; - } else { - if (!dev->public.on) { - if (!EnableDevice(dev)) { - *status = BadDevice; - } else { - /* to prevent ProcXOpenDevice to call EnableDevice again */ - dev->startup = FALSE; - } - } - } -} - - -/*********************************************************************** - * - * Caller: ProcXChangeKeyboardDevice - * - * This procedure does the implementation-dependent portion of the work - * needed to change the keyboard device. - * - * The X keyboard device has a FocusRec. If the device that has been - * made into the new X keyboard did not have a FocusRec, - * ProcXChangeKeyboardDevice will allocate one for it. - * - * If you do not want clients to be able to focus the old X keyboard - * device, call DeleteFocusClassDeviceStruct to free the FocusRec. - * - * If you support input devices with keys that you do not want to be - * used as the X keyboard, you need to check for them here and return - * a BadDevice error. - * - * The default implementation is to do nothing (assume you do want - * clients to be able to focus the old X keyboard). The commented-out - * sample code shows what you might do if you don't want the default. - * - *********************************************************************** - */ - -int -ChangeKeyboardDevice (DeviceIntPtr old_dev, DeviceIntPtr new_dev) -{ - /********************************************************************** - * DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c * - **********************************************************************/ - return !Success; -} - - -/*********************************************************************** - * - * Caller: ProcXChangePointerDevice - * - * This procedure does the implementation-dependent portion of the work - * needed to change the pointer device. - * - * The X pointer device does not have a FocusRec. If the device that - * has been made into the new X pointer had a FocusRec, - * ProcXChangePointerDevice will free it. - * - * If you want clients to be able to focus the old pointer device that - * has now become accessible through the input extension, you need to - * add a FocusRec to it here. - * - * The XChangePointerDevice protocol request also allows the client - * to choose which axes of the new pointer device are used to move - * the X cursor in the X- and Y- directions. If the axes are different - * than the default ones, you need to keep track of that here. - * - * If you support input devices with valuators that you do not want to be - * used as the X pointer, you need to check for them here and return a - * BadDevice error. - * - * The default implementation is to do nothing (assume you don't want - * clients to be able to focus the old X pointer). The commented-out - * sample code shows what you might do if you don't want the default. - * - *********************************************************************** - */ - -int -ChangePointerDevice ( - DeviceIntPtr old_dev, - DeviceIntPtr new_dev, - unsigned char x, - unsigned char y) -{ - /************************************************************************ - InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr* - - x_axis = x; * keep track of new x-axis* - y_axis = y; * keep track of new y-axis* - if (x_axis != 0 || y_axis != 1) - axes_changed = TRUE; * remember axes have changed* - else - axes_changed = FALSE; - *************************************************************************/ - - /* - * We don't allow axis swap or other exotic features. - */ - if (x == 0 && y == 1) { - LocalDevicePtr old_local = (LocalDevicePtr)old_dev->public.devicePrivate; - LocalDevicePtr new_local = (LocalDevicePtr)new_dev->public.devicePrivate; - - InitFocusClassDeviceStruct(old_dev); - - /* Restore Extended motion history information */ - old_dev->valuator->GetMotionProc = old_local->motion_history_proc; - old_dev->valuator->numMotionEvents = old_local->history_size; - - /* Save Extended motion history information */ - new_local->motion_history_proc = new_dev->valuator->GetMotionProc; - new_local->history_size = new_dev->valuator->numMotionEvents; - - /* Set Core motion history information */ - new_dev->valuator->GetMotionProc = miPointerGetMotionEvents; - new_dev->valuator->numMotionEvents = miPointerGetMotionBufferSize(); - - return Success; - } - else - return !Success; -} - - -/*********************************************************************** - * - * Caller: ProcXCloseDevice - * - * Take care of implementation-dependent details of closing a device. - * Some implementations may actually close the device, others may just - * remove this clients interest in that device. - * - * The default implementation is to do nothing (assume all input devices - * are initialized during X server initialization and kept open). - * - *********************************************************************** - */ - -void -CloseInputDevice (DeviceIntPtr d, ClientPtr client) -{ - ErrorF("ProcXCloseDevice to close or not ?\n"); -} - - -/*********************************************************************** - * - * Caller: ProcXListInputDevices - * - * This is the implementation-dependent routine to initialize an input - * device to the point that information about it can be listed. - * Some implementations open all input devices when the server is first - * initialized, and never close them. Other implementations open only - * the X pointer and keyboard devices during server initialization, - * and only open other input devices when some client makes an - * XOpenDevice request. If some other process has the device open, the - * server may not be able to get information about the device to list it. - * - * This procedure should be used by implementations that do not initialize - * all input devices at server startup. It should do device-dependent - * initialization for any devices not previously initialized, and call - * AddInputDevice for each of those devices so that a DeviceIntRec will be - * created for them. - * - * The default implementation is to do nothing (assume all input devices - * are initialized during X server initialization and kept open). - * The commented-out sample code shows what you might do if you don't want - * the default. - * - *********************************************************************** - */ - -void -AddOtherInputDevices () -{ -} - - -/**************************************************************************** - * - * Caller: ProcXSetDeviceMode - * - * Change the mode of an extension device. - * This function is used to change the mode of a device from reporting - * relative motion to reporting absolute positional information, and - * vice versa. - * The default implementation below is that no such devices are supported. - * - *********************************************************************** - */ - -int -SetDeviceMode (ClientPtr client, DeviceIntPtr dev, int mode) -{ - LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate; - - if (local->switch_mode) { - return (*local->switch_mode)(client, dev, mode); - } - else - return BadMatch; -} - - -/*********************************************************************** - * - * Caller: ProcXSetDeviceValuators - * - * Set the value of valuators on an extension input device. - * This function is used to set the initial value of valuators on - * those input devices that are capable of reporting either relative - * motion or an absolute position, and allow an initial position to be set. - * The default implementation below is that no such devices are supported. - * - *********************************************************************** - */ - -int -SetDeviceValuators (ClientPtr client, DeviceIntPtr dev, int *valuators, - int first_valuator, int num_valuators) -{ - return BadMatch; -} - - -/*********************************************************************** - * - * Caller: ProcXChangeDeviceControl - * - * Change the specified device controls on an extension input device. - * - *********************************************************************** - */ - -int -ChangeDeviceControl (ClientPtr client, DeviceIntPtr dev, xDeviceCtl *control) -{ - LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate; - - if (!local->control_proc) { - return (BadMatch); - } - else { - return (*local->control_proc)(local, control); - } -} -#endif - -/* - * adapted from mieq.c to support extended events - * - */ -#define QUEUE_SIZE 256 - -typedef struct _Event { - xEvent event; -#ifdef XINPUT - deviceValuator val; -#endif - ScreenPtr pScreen; -} EventRec, *EventPtr; - -typedef struct _EventQueue { - HWEventQueueType head, tail; - CARD32 lastEventTime; /* to avoid time running backwards */ - Bool lastMotion; - EventRec events[QUEUE_SIZE]; /* static allocation for signals */ - DevicePtr pKbd, pPtr; /* device pointer, to get funcs */ - ScreenPtr pEnqueueScreen; /* screen events are being delivered to */ - ScreenPtr pDequeueScreen; /* screen events are being dispatched to */ -} EventQueueRec, *EventQueuePtr; - -static EventQueueRec xf86EventQueue; - -Bool -xf86eqInit (DevicePtr pKbd, DevicePtr pPtr) -{ - xf86EventQueue.head = xf86EventQueue.tail = 0; - xf86EventQueue.lastEventTime = GetTimeInMillis (); - xf86EventQueue.pKbd = pKbd; - xf86EventQueue.pPtr = pPtr; - xf86EventQueue.lastMotion = FALSE; - xf86EventQueue.pEnqueueScreen = screenInfo.screens[0]; - xf86EventQueue.pDequeueScreen = xf86EventQueue.pEnqueueScreen; - SetInputCheck (&xf86EventQueue.head, &xf86EventQueue.tail); - return TRUE; -} - -/* - * Must be reentrant with ProcessInputEvents. Assumption: xf86eqEnqueue - * will never be interrupted. If this is called from both signal - * handlers and regular code, make sure the signal is suspended when - * called from regular code. - */ - -void -xf86eqEnqueue (xEvent *e) -{ - int oldtail, newtail; - Bool isMotion; -#ifdef XINPUT - int count; - - xf86AssertBlockedSIGIO ("xf86eqEnqueue"); - switch (e->u.u.type) { - case KeyPress: - case KeyRelease: -#ifdef XFreeXDGA - /* we do this here, because nobody seems to be calling - xf86PostKeyEvent(). We can't steal MotionNotify events here - because the motion-relative information has been lost already. */ - if(DGAStealKeyEvent(xf86EventQueue.pEnqueueScreen->myNum, e)) - return; -#endif - /* fall through */ - case ButtonPress: - case ButtonRelease: - case MotionNotify: - count = 1; - break; - default: -#ifdef XFreeXDGA - if (DGAIsDgaEvent (e)) - { - count = 1; - break; - } -#endif - if (!((deviceKeyButtonPointer *) e)->deviceid & MORE_EVENTS) { - count = 1; - } - else { - count = 2; - } - break; - } -#endif - - oldtail = xf86EventQueue.tail; - isMotion = e->u.u.type == MotionNotify; - if (isMotion && xf86EventQueue.lastMotion && oldtail != xf86EventQueue.head) { - if (oldtail == 0) - oldtail = QUEUE_SIZE; - oldtail = oldtail - 1; - } - else { - newtail = oldtail + 1; - if (newtail == QUEUE_SIZE) - newtail = 0; - /* Toss events which come in late */ - if (newtail == xf86EventQueue.head) - return; - xf86EventQueue.tail = newtail; - } - - xf86EventQueue.lastMotion = isMotion; - xf86EventQueue.events[oldtail].event = *e; -#ifdef XINPUT - if (count == 2) { - xf86EventQueue.events[oldtail].val = *((deviceValuator *) (((deviceKeyButtonPointer *) e)+1)); - } -#endif - /* - * Make sure that event times don't go backwards - this - * is "unnecessary", but very useful - */ - if (e->u.keyButtonPointer.time < xf86EventQueue.lastEventTime && - xf86EventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000) { - - xf86EventQueue.events[oldtail].event.u.keyButtonPointer.time = - xf86EventQueue.lastEventTime; - } - xf86EventQueue.events[oldtail].pScreen = xf86EventQueue.pEnqueueScreen; -} - -/* - * Call this from ProcessInputEvents() - */ -void -xf86eqProcessInputEvents () -{ - EventRec *e; - int x, y; - struct { - xEvent event; -#ifdef XINPUT - deviceValuator val; -#endif - } xe; -#ifdef XINPUT - DeviceIntPtr dev; - int id, count; - deviceKeyButtonPointer *dev_xe; -#endif - - while (xf86EventQueue.head != xf86EventQueue.tail) { - if (screenIsSaved == SCREEN_SAVER_ON) - SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset); -#ifdef DPMSExtension - if (DPMSPowerLevel != DPMSModeOn) - DPMSSet(DPMSModeOn); -#endif - - e = &xf86EventQueue.events[xf86EventQueue.head]; - /* - * Assumption - screen switching can only occur on motion events - */ - if (e->pScreen != xf86EventQueue.pDequeueScreen) { - xf86EventQueue.pDequeueScreen = e->pScreen; - x = e->event.u.keyButtonPointer.rootX; - y = e->event.u.keyButtonPointer.rootY; - if (xf86EventQueue.head == QUEUE_SIZE - 1) - xf86EventQueue.head = 0; - else - ++xf86EventQueue.head; - NewCurrentScreen (xf86EventQueue.pDequeueScreen, x, y); - } - else { - xe.event = e->event; - xe.val = e->val; - if (xf86EventQueue.head == QUEUE_SIZE - 1) - xf86EventQueue.head = 0; - else - ++xf86EventQueue.head; - switch (xe.event.u.u.type) { - case KeyPress: - case KeyRelease: - (*xf86EventQueue.pKbd->processInputProc) - (&xe.event, (DeviceIntPtr)xf86EventQueue.pKbd, 1); - break; -#ifdef XINPUT - case ButtonPress: - case ButtonRelease: - case MotionNotify: - (*(inputInfo.pointer->public.processInputProc)) - (&xe.event, (DeviceIntPtr)inputInfo.pointer, 1); - break; - - default: -#ifdef XFreeXDGA - if (DGADeliverEvent (xf86EventQueue.pDequeueScreen, &xe.event)) - break; -#endif - dev_xe = (deviceKeyButtonPointer *) &xe.event; - id = dev_xe->deviceid & DEVICE_BITS; - if (!(dev_xe->deviceid & MORE_EVENTS)) { - count = 1; - } - else { - count = 2; - } - dev = LookupDeviceIntRec(id); - if (dev == NULL) { - ErrorF("LookupDeviceIntRec id=0x%x not found\n", id); -/* FatalError("xf86eqProcessInputEvents : device not found.\n"); - */ - break; - } - if (!dev->public.processInputProc) { - FatalError("xf86eqProcessInputEvents : device has no input proc.\n"); - break; - } - (*dev->public.processInputProc)(&xe.event, dev, count); -#else - default: - (*xf86EventQueue.pPtr->processInputProc) - (&xe.event, (DeviceIntPtr)xf86EventQueue.pPtr, 1); -#endif - break; - } - } - } -} - -void -xf86eqSwitchScreen(ScreenPtr pScreen, - Bool fromDIX) -{ - xf86EventQueue.pEnqueueScreen = pScreen; - - if (fromDIX) - xf86EventQueue.pDequeueScreen = pScreen; -} - -/* - * convenient functions to post events - */ - -void -xf86PostMotionEvent(DeviceIntPtr device, - int is_absolute, - int first_valuator, - int num_valuators, - ...) -{ - va_list var; - int loop; - xEvent xE[2]; - deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE; - deviceValuator *xv = (deviceValuator*) xev+1; - LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate; - char *buff = 0; - Time current; - Bool is_core = xf86IsCorePointer(device); - Bool is_shared = xf86ShareCorePointer(device); - Bool drag = xf86SendDragEvents(device); - ValuatorClassPtr val = device->valuator; - int valuator[6]; - int oldaxis[6]; - int *axisvals; - int dx = 0, dy = 0; - float mult; - int x, y; - int loop_start; - int i; - int num; - - DBG(5, ErrorF("xf86PostMotionEvent BEGIN 0x%x(%s) is_core=%s is_shared=%s is_absolute=%s\n", - device, device->name, - is_core ? "True" : "False", - is_shared ? "True" : "False", - is_absolute ? "True" : "False")); - - xf86Info.lastEventTime = xev->time = current = GetTimeInMillis(); - - if (!is_core) { - if (HAS_MOTION_HISTORY(local)) { - buff = ((char *)local->motion_history + - (sizeof(INT32) * local->dev->valuator->numAxes + sizeof(Time)) * local->last); - } - } - - if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) { - ErrorF("Bad valuators reported for device \"%s\"\n", device->name); - return; - } - - axisvals = val->axisVal; - - va_start(var, num_valuators); - - loop_start = first_valuator; - for(loop=0; loop= 2 && loop_start == 0) { - - dx = valuator[0]; - dy = valuator[1]; - - /* - * Accelerate - */ - if (device->ptrfeed && device->ptrfeed->ctrl.num) { - /* modeled from xf86Events.c */ - if (device->ptrfeed->ctrl.threshold) { - if ((abs(dx) + abs(dy)) >= device->ptrfeed->ctrl.threshold) { - local->dxremaind = ((float)dx * (float)(device->ptrfeed->ctrl.num)) / - (float)(device->ptrfeed->ctrl.den) + local->dxremaind; - valuator[0] = (int)local->dxremaind; - local->dxremaind = local->dxremaind - (float)valuator[0]; - - local->dyremaind = ((float)dy * (float)(device->ptrfeed->ctrl.num)) / - (float)(device->ptrfeed->ctrl.den) + local->dyremaind; - valuator[1] = (int)local->dyremaind; - local->dyremaind = local->dyremaind - (float)valuator[1]; - } - } - else if (dx || dy) { - mult = pow((float)(dx*dx+dy*dy), - ((float)(device->ptrfeed->ctrl.num) / - (float)(device->ptrfeed->ctrl.den) - 1.0) / - 2.0) / 2.0; - if (dx) { - local->dxremaind = mult * (float)dx + local->dxremaind; - valuator[0] = (int)local->dxremaind; - local->dxremaind = local->dxremaind - (float)valuator[0]; - } - if (dy) { - local->dyremaind = mult * (float)dy + local->dyremaind; - valuator[1] = (int)local->dyremaind; - local->dyremaind = local->dyremaind - (float)valuator[1]; - } - } - DBG(6, ErrorF("xf86PostMotionEvent acceleration v0=%d v1=%d\n", - valuator[0], valuator[1])); - } - - /* - * Map current position back to device space in case - * the cursor was warped - */ - if (is_core || is_shared) - { - miPointerPosition (&x, &y); - if (local->reverse_conversion_proc) - (*local->reverse_conversion_proc)(local, x, y, axisvals); - else - { - axisvals[0] = x; - axisvals[1] = y; - } - } - } - - /* - * Update axes - */ - for (i = 0; i < num; i++) - { - oldaxis[i] = axisvals[loop_start + i]; - if (is_absolute) - axisvals[loop_start + i] = valuator[i]; - else - axisvals[loop_start + i] += valuator[i]; - } - - /* - * Deliver extension event - */ - if (!is_core) { - xev->type = DeviceMotionNotify; - xev->detail = 0; - xev->deviceid = device->id | MORE_EVENTS; - - xv->type = DeviceValuator; - xv->deviceid = device->id; - - xv->device_state = 0; - xv->num_valuators = num; - xv->first_valuator = loop_start; - memcpy (&xv->valuator0, &axisvals[loop_start], - sizeof(INT32)*xv->num_valuators); - - if (HAS_MOTION_HISTORY(local)) { - *(Time*)buff = current; - memcpy(buff+sizeof(Time)+sizeof(INT32)*xv->first_valuator, - &axisvals[loop_start], - sizeof(INT32)*xv->num_valuators); - } - ENQUEUE(xE); - } - - /* - * Deliver core event - */ - if (is_core || - (is_shared && num_valuators >= 2 && loop_start == 0)) { -#ifdef XFreeXDGA - /* - * Let DGA peek at the event and steal it - */ - xev->type = MotionNotify; - xev->detail = 0; - if (is_absolute) - { - dx = axisvals[0] - oldaxis[0]; - dy = axisvals[1] - oldaxis[1]; - } - if (DGAStealMouseEvent(xf86EventQueue.pEnqueueScreen->myNum, - xE, dx, dy)) - continue; -#endif - if (!(*local->conversion_proc)(local, loop_start, num, - axisvals[0], axisvals[1], - axisvals[2], axisvals[3], - axisvals[4], axisvals[5], - &x, &y)) - continue; - - if (drag) - miPointerAbsoluteCursor (x, y, current); - /* - * Retrieve the position - */ - miPointerPosition (&x, &y); - if (local->reverse_conversion_proc) - (*local->reverse_conversion_proc)(local, x, y, axisvals); - else - { - axisvals[0] = x; - axisvals[1] = y; - } - } - loop_start += 6; - } - } - va_end(var); - if (HAS_MOTION_HISTORY(local)) { - local->last = (local->last + 1) % device->valuator->numMotionEvents; - if (local->last == local->first) - local->first = (local->first + 1) % device->valuator->numMotionEvents; - } - DBG(5, ErrorF("xf86PostMotionEvent END 0x%x(%s) is_core=%s is_shared=%s\n", - device, device->name, - is_core ? "True" : "False", - is_shared ? "True" : "False")); -} - -void -xf86PostProximityEvent(DeviceIntPtr device, - int is_in, - int first_valuator, - int num_valuators, - ...) -{ - va_list var; - int loop; - xEvent xE[2]; - deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE; - deviceValuator *xv = (deviceValuator*) xev+1; - ValuatorClassPtr val = device->valuator; - Bool is_core = xf86IsCorePointer(device); - Bool is_absolute = val && ((val->mode & 1) == Relative); - - DBG(5, ErrorF("xf86PostProximityEvent BEGIN 0x%x(%s) prox=%s is_core=%s is_absolute=%s\n", - device, device->name, is_in ? "true" : "false", - is_core ? "True" : "False", - is_absolute ? "True" : "False")); - - if (is_core) { - return; - } - - if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) { - ErrorF("Bad valuators reported for device \"%s\"\n", device->name); - return; - } - - xev->type = is_in ? ProximityIn : ProximityOut; - xev->detail = 0; - xev->deviceid = device->id | MORE_EVENTS; - - xv->type = DeviceValuator; - xv->deviceid = device->id; - xv->device_state = 0; - - if ((device->valuator->mode & 1) == Relative) { - num_valuators = 0; - } - - if (num_valuators != 0) { - int *axisvals = val->axisVal; - - va_start(var, num_valuators); - - for(loop=0; loopvaluator0 = is_absolute ? va_arg(var, int) : axisvals[loop]; - break; - case 1: - xv->valuator1 = is_absolute ? va_arg(var, int) : axisvals[loop]; - break; - case 2: - xv->valuator2 = is_absolute ? va_arg(var, int) : axisvals[loop]; - break; - case 3: - xv->valuator3 = is_absolute ? va_arg(var, int) : axisvals[loop]; - break; - case 4: - xv->valuator4 = is_absolute ? va_arg(var, int) : axisvals[loop]; - break; - case 5: - xv->valuator5 = is_absolute ? va_arg(var, int) : axisvals[loop]; - break; - } - if ((loop % 6 == 5) || (loop == num_valuators - 1)) { - xf86Info.lastEventTime = xev->time = GetTimeInMillis(); - - xv->num_valuators = (loop % 6) + 1; - xv->first_valuator = first_valuator + (loop / 6) * 6; - ENQUEUE(xE); - } - } - va_end(var); - } - else { - /* no valuator */ - xf86Info.lastEventTime = xev->time = GetTimeInMillis(); - - xv->num_valuators = 0; - xv->first_valuator = 0; - ENQUEUE(xE); - } - DBG(5, ErrorF("xf86PostProximityEvent END 0x%x(%s) prox=%s is_core=%s is_absolute=%s\n", - device, device->name, is_in ? "true" : "false", - is_core ? "True" : "False", - is_absolute ? "True" : "False")); - -} - -void -xf86PostButtonEvent(DeviceIntPtr device, - int is_absolute, - int button, - int is_down, - int first_valuator, - int num_valuators, - ...) -{ - va_list var; - int loop; - xEvent xE[2]; - deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE; - deviceValuator *xv = (deviceValuator*) xev+1; - ValuatorClassPtr val = device->valuator; - Bool is_core = xf86IsCorePointer(device); - Bool is_shared = xf86ShareCorePointer(device); - - DBG(5, ErrorF("xf86PostButtonEvent BEGIN 0x%x(%s) button=%d down=%s is_core=%s is_shared=%s is_absolute=%s\n", - device, device->name, button, - is_down ? "True" : "False", - is_core ? "True" : "False", - is_shared ? "True" : "False", - is_absolute ? "True" : "False")); - - /* Check the core pointer button state not to send an inconsistent - * event. This can happen with the AlwaysCore feature. - */ - if ((is_core || is_shared) && - !xf86CheckButton(device->button->map[button], is_down)) - { - return; - } - - if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) { - ErrorF("Bad valuators reported for device \"%s\"\n", device->name); - return; - } - - if (!is_core) { - xev->type = is_down ? DeviceButtonPress : DeviceButtonRelease; - xev->detail = button; - xev->deviceid = device->id | MORE_EVENTS; - - xv->type = DeviceValuator; - xv->deviceid = device->id; - xv->device_state = 0; - - if (num_valuators != 0) { - int *axisvals = val->axisVal; - - va_start(var, num_valuators); - - for(loop=0; loopvaluator0 = is_absolute ? va_arg(var, int) : axisvals[loop]; - break; - case 1: - xv->valuator1 = is_absolute ? va_arg(var, int) : axisvals[loop]; - break; - case 2: - xv->valuator2 = is_absolute ? va_arg(var, int) : axisvals[loop]; - break; - case 3: - xv->valuator3 = is_absolute ? va_arg(var, int) : axisvals[loop]; - break; - case 4: - xv->valuator4 = is_absolute ? va_arg(var, int) : axisvals[loop]; - break; - case 5: - xv->valuator5 = is_absolute ? va_arg(var, int) : axisvals[loop]; - break; - } - if ((loop % 6 == 5) || (loop == num_valuators - 1)) { - xf86Info.lastEventTime = xev->time = GetTimeInMillis(); - xv->num_valuators = (loop % 6) + 1; - xv->first_valuator = first_valuator + (loop / 6) * 6; - ENQUEUE(xE); - - } - } - va_end(var); - } - else { - /* no valuator */ - xf86Info.lastEventTime = xev->time = GetTimeInMillis(); - xv->num_valuators = 0; - xv->first_valuator = 0; - ENQUEUE(xE); - } - } - - /* removed rootX/rootY as DIX sets these fields */ - if (is_core || is_shared) { - xE->u.u.type = is_down ? ButtonPress : ButtonRelease; - xE->u.u.detail = device->button->map[button]; - xf86Info.lastEventTime = xE->u.keyButtonPointer.time = GetTimeInMillis(); - -#ifdef XFreeXDGA - if (!DGAStealMouseEvent(xf86EventQueue.pEnqueueScreen->myNum, xE, 0, 0)) -#endif - ENQUEUE(xE); - } - DBG(5, ErrorF("xf86PostButtonEvent END\n")); -} - -void -xf86PostKeyEvent(DeviceIntPtr device, - unsigned int key_code, - int is_down, - int is_absolute, - int first_valuator, - int num_valuators, - ...) -{ - va_list var; - int loop; - xEvent xE[2]; - deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE; - deviceValuator *xv = (deviceValuator*) xev+1; - - va_start(var, num_valuators); - - for(loop=0; loopvaluator0 = va_arg(var, int); - break; - case 1: - xv->valuator1 = va_arg(var, int); - break; - case 2: - xv->valuator2 = va_arg(var, int); - break; - case 3: - xv->valuator3 = va_arg(var, int); - break; - case 4: - xv->valuator4 = va_arg(var, int); - break; - case 5: - xv->valuator5 = va_arg(var, int); - break; - } - if (((loop % 6 == 5) || (loop == num_valuators - 1))) { - xev->type = is_down ? DeviceKeyPress : DeviceKeyRelease; - xev->detail = key_code; - - xf86Info.lastEventTime = xev->time = GetTimeInMillis(); - xev->deviceid = device->id | MORE_EVENTS; - - xv->type = DeviceValuator; - xv->deviceid = device->id; - xv->device_state = 0; - /* if the device is in the relative mode we don't have to send valuators */ - xv->num_valuators = is_absolute ? (loop % 6) + 1 : 0; - xv->first_valuator = first_valuator + (loop / 6) * 6; - - ENQUEUE(xE); - /* if the device is in the relative mode only one event is needed */ - if (!is_absolute) break; - } - } - va_end(var); -} - -void -xf86PostKeyboardEvent(DeviceIntPtr device, - unsigned int key_code, - int is_down) -{ - xEvent xE[2]; - deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE; - - if (xf86IsCoreKeyboard(device)) { - xev->type = is_down ? KeyPress : KeyRelease; - } else { - xev->type = is_down ? DeviceKeyPress : DeviceKeyRelease; - } - xev->detail = key_code; - xf86Info.lastEventTime = xev->time = GetTimeInMillis(); - -#ifdef XFreeXDGA - /* if(!DGAStealKeyEvent(xf86EventQueue.pEnqueueScreen->myNum, xE)) */ -#endif - ENQUEUE(xE); -} - -/* - * Motion history management. - */ - -void -xf86MotionHistoryAllocate(LocalDevicePtr local) -{ - ValuatorClassPtr valuator = local->dev->valuator; - - if (!HAS_MOTION_HISTORY(local)) - return; - if (local->motion_history) xfree(local->motion_history); - local->motion_history = xalloc((sizeof(INT32) * valuator->numAxes + sizeof(Time)) - * valuator->numMotionEvents); - local->first = 0; - local->last = 0; -} - -int -xf86GetMotionEvents(DeviceIntPtr dev, - xTimecoord *buff, - unsigned long start, - unsigned long stop, - ScreenPtr pScreen) -{ - LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate; - ValuatorClassPtr valuator = dev->valuator; - int num = 0; - int loop = local->first; - int size; - Time current; - - if (!HAS_MOTION_HISTORY(local)) - return 0; - - size = (sizeof(INT32) * valuator->numAxes + sizeof(Time)); - - while (loop != local->last) { - current = *(Time*)(((char *)local->motion_history)+loop*size); - if (current > stop) - return num; - if (current >= start) { - memcpy(((char *)buff)+size*num, - ((char *)local->motion_history)+loop*size, size); - num++; - } - loop = (loop + 1) % valuator->numMotionEvents; - } - return num; -} - -LocalDevicePtr -xf86FirstLocalDevice() -{ - return xf86InputDevs; -} - -/* - * Cx - raw data from touch screen - * Sxhigh - scaled highest dimension - * (remember, this is of rows - 1 because of 0 origin) - * Sxlow - scaled lowest dimension - * Rxhigh - highest raw value from touch screen calibration - * Rxlow - lowest raw value from touch screen calibration - * - * This function is the same for X or Y coordinates. - * You may have to reverse the high and low values to compensate for - * different orgins on the touch screen vs X. - */ - -int -xf86ScaleAxis(int Cx, - int Sxhigh, - int Sxlow, - int Rxhigh, - int Rxlow ) -{ - int X; - int dSx = Sxhigh - Sxlow; - int dRx = Rxhigh - Rxlow; - - dSx = Sxhigh - Sxlow; - if (dRx) { - X = ((dSx * (Cx - Rxlow)) / dRx) + Sxlow; - } - else { - X = 0; - ErrorF ("Divide by Zero in xf86ScaleAxis"); - } - - if (X > Sxlow) - X = Sxlow; - if (X < Sxhigh) - X = Sxhigh; - - return (X); -} - -/* - * This function checks the given screen against the current screen and - * makes changes if appropriate. It should be called from an XInput driver's - * ReadInput function before any events are posted, if the device is screen - * specific like a touch screen. - */ -void -xf86XInputSetScreen(LocalDevicePtr local, - int screen_number, - int x, - int y) -{ - if ((xf86IsCorePointer(local->dev) || xf86ShareCorePointer(local->dev)) && - (miPointerCurrentScreen() != screenInfo.screens[screen_number])) { - miPointerSetNewScreen (screen_number, x, y); - } -} - - -void -xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval, - int resolution, int min_res, int max_res) -{ -#ifdef XINPUT - if (maxval == -1) { - if (axnum == 0) - maxval = screenInfo.screens[0]->width - 1; - else if (axnum == 1) - maxval = screenInfo.screens[0]->height - 1; - /* else? */ - } - InitValuatorAxisStruct(dev, axnum, minval, maxval, resolution, min_res, - max_res); -#endif -} - -/* - * Set the valuator values to be in synch with dix/event.c - * DefineInitialRootWindow(). - */ -void -xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum) -{ -#ifdef XINPUT - if (axnum == 0) - dev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2; - else if (axnum == 1) - dev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2; -#endif -} - -/* end of xf86Xinput.c */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Xinput.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86Xinput.h deleted file mode 100644 index 0c20f78fe..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86Xinput.h +++ /dev/null @@ -1,220 +0,0 @@ -/* $XConsortium: xf86Xinput.h /main/11 1996/10/27 11:05:29 kaleb $ */ -/* - * Copyright 1995-1999 by Frederic Lepied, France. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Frederic Lepied not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Frederic Lepied makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ - -/* - * Copyright (c) 2000-2002 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.36 2003/08/24 17:36:55 dawes Exp $ */ - -#ifndef _xf86Xinput_h -#define _xf86Xinput_h - -#ifndef NEED_EVENTS -#define NEED_EVENTS -#endif -#include "xf86str.h" -#include "inputstr.h" -#ifdef XINPUT -#include -#include -#include "XIstubs.h" -#endif - -/* Input device flags */ -#define XI86_OPEN_ON_INIT 0x01 /* open the device at startup time */ -#define XI86_CONFIGURED 0x02 /* the device has been configured */ -#define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */ -/* the device sends Xinput and core pointer events */ -#define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE -/* if the device is the core pointer or is sending core events, and - * SEND_DRAG_EVENTS is false, and a buttons is done, then no motion events - * (mouse drag action) are sent. This is mainly to allow a touch screen to be - * used with netscape and other browsers which do strange things if the mouse - * moves between button down and button up. With a touch screen, this motion - * is common due to the user's finger moving slightly. - */ -#define XI86_SEND_DRAG_EVENTS 0x08 -#define XI86_CORE_POINTER 0x10 /* device is the core pointer */ -#define XI86_CORE_KEYBOARD 0x20 /* device is the core keyboard */ -#define XI86_POINTER_CAPABLE 0x40 /* capable of being a core pointer */ -#define XI86_KEYBOARD_CAPABLE 0x80 /* capable of being a core keyboard */ - -#define XI_PRIVATE(dev) \ - (((LocalDevicePtr)((dev)->public.devicePrivate))->private) - -#ifdef DBG -#undef DBG -#endif -#define DBG(lvl, f) {if ((lvl) <= xf86GetVerbosity()) f;} - -#ifdef HAS_MOTION_HISTORY -#undef HAS_MOTION_HISTORY -#endif -#define HAS_MOTION_HISTORY(local) ((local)->dev->valuator && (local)->dev->valuator->numMotionEvents) - -#ifdef XINPUT -/* This holds the input driver entry and module information. */ -typedef struct _InputDriverRec { - int driverVersion; - char * driverName; - void (*Identify)(int flags); - struct _LocalDeviceRec *(*PreInit)(struct _InputDriverRec *drv, - IDevPtr dev, int flags); - void (*UnInit)(struct _InputDriverRec *drv, - struct _LocalDeviceRec *pInfo, - int flags); - pointer module; - int refCount; -} InputDriverRec, *InputDriverPtr; -#endif - -/* This is to input devices what the ScrnInfoRec is to screens. */ - -typedef struct _LocalDeviceRec { - struct _LocalDeviceRec *next; - char * name; - int flags; - - Bool (*device_control)(DeviceIntPtr device, int what); - void (*read_input)(struct _LocalDeviceRec *local); - int (*control_proc)(struct _LocalDeviceRec *local, - xDeviceCtl *control); - void (*close_proc)(struct _LocalDeviceRec *local); - int (*switch_mode)(ClientPtr client, DeviceIntPtr dev, - int mode); - Bool (*conversion_proc)(struct _LocalDeviceRec *local, - int first, int num, int v0, - int v1, int v2, int v3, int v4, - int v5, int *x, int *y); - Bool (*reverse_conversion_proc)( - struct _LocalDeviceRec *local, - int x, int y, int *valuators); - - int fd; - Atom atom; - DeviceIntPtr dev; - pointer private; - int private_flags; - pointer motion_history; - ValuatorMotionProcPtr motion_history_proc; - unsigned int history_size; /* only for configuration purpose */ - unsigned int first; - unsigned int last; - int old_x; - int old_y; - float dxremaind; - float dyremaind; - char * type_name; - IntegerFeedbackPtr always_core_feedback; - IDevPtr conf_idev; - InputDriverPtr drv; - pointer module; - pointer options; -} LocalDeviceRec, *LocalDevicePtr, InputInfoRec, *InputInfoPtr; - -typedef struct _DeviceAssocRec -{ - char * config_section_name; - LocalDevicePtr (*device_allocate)(void); -} DeviceAssocRec, *DeviceAssocPtr; - -/* xf86Globals.c */ -extern InputInfoPtr xf86InputDevs; - -/* xf86Xinput.c */ -int xf86IsCorePointer(DeviceIntPtr dev); -int xf86IsCoreKeyboard(DeviceIntPtr dev); -void xf86XInputSetSendCoreEvents(LocalDevicePtr local, Bool always); -#define xf86AlwaysCore(a,b) xf86XInputSetSendCoreEvents(a,b) - -void InitExtInput(void); -Bool xf86eqInit(DevicePtr pKbd, DevicePtr pPtr); -void xf86eqEnqueue(struct _xEvent *event); -void xf86eqProcessInputEvents (void); -void xf86eqSwitchScreen(ScreenPtr pScreen, Bool fromDIX); -void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute, - int first_valuator, int num_valuators, ...); -void xf86PostProximityEvent(DeviceIntPtr device, int is_in, - int first_valuator, int num_valuators, ...); -void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button, - int is_down, int first_valuator, int num_valuators, - ...); -void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down, - int is_absolute, int first_valuator, int num_valuators, - ...); -void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code, - int is_down); -void xf86MotionHistoryAllocate(LocalDevicePtr local); -int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff, - unsigned long start, unsigned long stop, - ScreenPtr pScreen); -void xf86XinputFinalizeInit(DeviceIntPtr dev); -Bool xf86CheckButton(int button, int down); -void xf86SwitchCoreDevice(LocalDevicePtr device, DeviceIntPtr core); -LocalDevicePtr xf86FirstLocalDevice(void); -int xf86ScaleAxis(int Cx, int Sxhigh, int Sxlow, int Rxhigh, int Rxlow); -void xf86XInputSetScreen(LocalDevicePtr local, int screen_number, int x, int y); -void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options); -void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, - int maxval, int resolution, int min_res, - int max_res); -void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum); -void xf86AddEnabledDevice(InputInfoPtr pInfo); -void xf86RemoveEnabledDevice(InputInfoPtr pInfo); - -/* xf86Helper.c */ -void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags); -void xf86DeleteInputDriver(int drvIndex); -InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags); -void xf86DeleteInput(InputInfoPtr pInp, int flags); - -/* xf86Option.c */ -void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts, - pointer extraOpts); - -#endif /* _xf86Xinput_h */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86cmap.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86cmap.c deleted file mode 100644 index b77e9fb47..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86cmap.c +++ /dev/null @@ -1,1123 +0,0 @@ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/xf86cmap.c,v 1.9 2005/09/05 07:43:51 daniels Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86cmap.c,v 1.25 2003/10/17 20:02:12 alanh Exp $ */ -/* - * Copyright (c) 1998-2001 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#if defined(_XOPEN_SOURCE) || defined(__QNXNTO__) \ - || (defined(sun) && defined(__SVR4)) -#include -#else -#define _XOPEN_SOURCE /* to get prototype for pow on some systems */ -#include -#undef _XOPEN_SOURCE -#endif - -#include -#include "misc.h" -#include -#include "colormapst.h" -#include "scrnintstr.h" - -#include "resource.h" - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86str.h" -#include "micmap.h" - -#ifdef XFreeXDGA -#define _XF86DGA_SERVER_ -#include -#include "dgaproc.h" -#endif - -#include "xf86cmap.h" - -#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \ - ((CMapScreenPtr) (pScreen)->devPrivates[CMapScreenIndex].ptr)->field) -#define SCREEN_EPILOGUE(pScreen, field, wrapper)\ - ((pScreen)->field = wrapper) - -#define LOAD_PALETTE(pmap, index) \ - ((pmap == miInstalledMaps[index]) && \ - ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || \ - xf86Screens[index]->vtSema || pScreenPriv->isDGAmode)) - - -typedef struct _CMapLink { - ColormapPtr cmap; - struct _CMapLink *next; -} CMapLink, *CMapLinkPtr; - -typedef struct { - ScrnInfoPtr pScrn; - CloseScreenProcPtr CloseScreen; - CreateColormapProcPtr CreateColormap; - DestroyColormapProcPtr DestroyColormap; - InstallColormapProcPtr InstallColormap; - StoreColorsProcPtr StoreColors; - Bool (*EnterVT)(int, int); - Bool (*SwitchMode)(int, DisplayModePtr, int); - int (*SetDGAMode)(int, int, DGADevicePtr); - int maxColors; - int sigRGBbits; - int gammaElements; - LOCO *gamma; - int *PreAllocIndices; - CMapLinkPtr maps; - unsigned int flags; - Bool isDGAmode; -} CMapScreenRec, *CMapScreenPtr; - -typedef struct { - int numColors; - LOCO *colors; - Bool recalculate; - int overscan; -} CMapColormapRec, *CMapColormapPtr; - -static unsigned long CMapGeneration = 0; -static int CMapScreenIndex = -1; -static int CMapColormapIndex = -1; - -static void CMapInstallColormap(ColormapPtr); -static void CMapStoreColors(ColormapPtr, int, xColorItem *); -static Bool CMapCloseScreen (int, ScreenPtr); -static Bool CMapCreateColormap (ColormapPtr); -static void CMapDestroyColormap (ColormapPtr); - -static Bool CMapEnterVT(int, int); -static Bool CMapSwitchMode(int, DisplayModePtr, int); -static int CMapSetDGAMode(int, int, DGADevicePtr); -static int CMapChangeGamma(int, Gamma); - -static void ComputeGamma(CMapScreenPtr); -static Bool CMapAllocateColormapPrivate(ColormapPtr); -static Bool CMapInitDefMap(ColormapPtr,int); -static void CMapRefreshColors(ColormapPtr, int, int*); -static void CMapSetOverscan(ColormapPtr, int, int *); -static void CMapReinstallMap(ColormapPtr); -static void CMapUnwrapScreen(ScreenPtr pScreen); - - - -Bool xf86HandleColormaps( - ScreenPtr pScreen, - int maxColors, - int sigRGBbits, - xf86LoadPaletteProc *loadPalette, - xf86SetOverscanProc *setOverscan, - unsigned int flags -){ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - ColormapPtr pDefMap = NULL; - CMapScreenPtr pScreenPriv; - LOCO *gamma; - int *indices; - int elements; - - if(!maxColors || !sigRGBbits || !loadPalette) - return FALSE; - - if(CMapGeneration != serverGeneration) { - if(((CMapScreenIndex = AllocateScreenPrivateIndex()) < 0) || - ((CMapColormapIndex = AllocateColormapPrivateIndex( - CMapInitDefMap)) < 0)) - return FALSE; - CMapGeneration = serverGeneration; - } - - elements = 1 << sigRGBbits; - - if(!(gamma = xalloc(elements * sizeof(LOCO)))) - return FALSE; - - if(!(indices = xalloc(maxColors * sizeof(int)))) { - xfree(gamma); - return FALSE; - } - - if(!(pScreenPriv = xalloc(sizeof(CMapScreenRec)))) { - xfree(gamma); - xfree(indices); - return FALSE; - } - - pScreen->devPrivates[CMapScreenIndex].ptr = (pointer)pScreenPriv; - - pScreenPriv->CloseScreen = pScreen->CloseScreen; - pScreenPriv->CreateColormap = pScreen->CreateColormap; - pScreenPriv->DestroyColormap = pScreen->DestroyColormap; - pScreenPriv->InstallColormap = pScreen->InstallColormap; - pScreenPriv->StoreColors = pScreen->StoreColors; - pScreen->CloseScreen = CMapCloseScreen; - pScreen->CreateColormap = CMapCreateColormap; - pScreen->DestroyColormap = CMapDestroyColormap; - pScreen->InstallColormap = CMapInstallColormap; - pScreen->StoreColors = CMapStoreColors; - - pScreenPriv->pScrn = pScrn; - pScrn->LoadPalette = loadPalette; - pScrn->SetOverscan = setOverscan; - pScreenPriv->maxColors = maxColors; - pScreenPriv->sigRGBbits = sigRGBbits; - pScreenPriv->gammaElements = elements; - pScreenPriv->gamma = gamma; - pScreenPriv->PreAllocIndices = indices; - pScreenPriv->maps = NULL; - pScreenPriv->flags = flags; - pScreenPriv->isDGAmode = FALSE; - - pScreenPriv->EnterVT = pScrn->EnterVT; - pScreenPriv->SwitchMode = pScrn->SwitchMode; - pScreenPriv->SetDGAMode = pScrn->SetDGAMode; - - if (!(flags & CMAP_LOAD_EVEN_IF_OFFSCREEN)) { - pScrn->EnterVT = CMapEnterVT; - if ((flags & CMAP_RELOAD_ON_MODE_SWITCH) && pScrn->SwitchMode) - pScrn->SwitchMode = CMapSwitchMode; - } -#ifdef XFreeXDGA - pScrn->SetDGAMode = CMapSetDGAMode; -#endif - pScrn->ChangeGamma = CMapChangeGamma; - - ComputeGamma(pScreenPriv); - - /* get the default map */ - - pDefMap = (ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP); - - if(!CMapAllocateColormapPrivate(pDefMap)) { - CMapUnwrapScreen(pScreen); - return FALSE; - } - - /* Force the initial map to be loaded */ - miInstalledMaps[pScreen->myNum] = NULL; - CMapInstallColormap(pDefMap); - return TRUE; -} - -static Bool -CMapInitDefMap(ColormapPtr cmap, int index) -{ - return TRUE; -} - - -/**** Screen functions ****/ - - -static Bool -CMapCloseScreen (int i, ScreenPtr pScreen) -{ - CMapUnwrapScreen(pScreen); - - return (*pScreen->CloseScreen) (i, pScreen); -} - -static Bool -CMapColormapUseMax(VisualPtr pVisual, CMapScreenPtr pScreenPriv) -{ - if (pVisual->nplanes > 16) - return TRUE; - return ((1 << pVisual->nplanes) > pScreenPriv->maxColors); -} - -static Bool -CMapAllocateColormapPrivate(ColormapPtr pmap) -{ - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr; - CMapColormapPtr pColPriv; - CMapLinkPtr pLink; - int numColors; - LOCO *colors; - - if (CMapColormapUseMax(pmap->pVisual, pScreenPriv)) - numColors = pmap->pVisual->ColormapEntries; - else - numColors = 1 << pmap->pVisual->nplanes; - - if(!(colors = xalloc(numColors * sizeof(LOCO)))) - return FALSE; - - if(!(pColPriv = xalloc(sizeof(CMapColormapRec)))) { - xfree(colors); - return FALSE; - } - - pmap->devPrivates[CMapColormapIndex].ptr = (pointer)pColPriv; - - pColPriv->numColors = numColors; - pColPriv->colors = colors; - pColPriv->recalculate = TRUE; - pColPriv->overscan = -1; - - /* add map to list */ - pLink = xalloc(sizeof(CMapLink)); - if(pLink) { - pLink->cmap = pmap; - pLink->next = pScreenPriv->maps; - pScreenPriv->maps = pLink; - } - - return TRUE; -} - -static Bool -CMapCreateColormap (ColormapPtr pmap) -{ - ScreenPtr pScreen = pmap->pScreen; - CMapScreenPtr pScreenPriv = - (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr; - Bool ret = FALSE; - - pScreen->CreateColormap = pScreenPriv->CreateColormap; - if((*pScreen->CreateColormap)(pmap)) { - if(CMapAllocateColormapPrivate(pmap)) - ret = TRUE; - } - pScreen->CreateColormap = CMapCreateColormap; - - return ret; -} - -static void -CMapDestroyColormap (ColormapPtr cmap) -{ - ScreenPtr pScreen = cmap->pScreen; - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr; - CMapColormapPtr pColPriv = - (CMapColormapPtr) cmap->devPrivates[CMapColormapIndex].ptr; - CMapLinkPtr prevLink = NULL, pLink = pScreenPriv->maps; - - if(pColPriv) { - if(pColPriv->colors) xfree(pColPriv->colors); - xfree(pColPriv); - } - - /* remove map from list */ - while(pLink) { - if(pLink->cmap == cmap) { - if(prevLink) - prevLink->next = pLink->next; - else - pScreenPriv->maps = pLink->next; - xfree(pLink); - break; - } - prevLink = pLink; - pLink = pLink->next; - } - - if(pScreenPriv->DestroyColormap) { - pScreen->DestroyColormap = pScreenPriv->DestroyColormap; - (*pScreen->DestroyColormap)(cmap); - pScreen->DestroyColormap = CMapDestroyColormap; - } -} - - - -static void -CMapStoreColors( - ColormapPtr pmap, - int ndef, - xColorItem *pdefs -){ - ScreenPtr pScreen = pmap->pScreen; - VisualPtr pVisual = pmap->pVisual; - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr; - int *indices = pScreenPriv->PreAllocIndices; - int num = ndef; - - /* At the moment this isn't necessary since there's nobody below us */ - pScreen->StoreColors = pScreenPriv->StoreColors; - (*pScreen->StoreColors)(pmap, ndef, pdefs); - pScreen->StoreColors = CMapStoreColors; - - /* should never get here for these */ - if( (pVisual->class == TrueColor) || - (pVisual->class == StaticColor) || - (pVisual->class == StaticGray)) - return; - - if(pVisual->class == DirectColor) { - CMapColormapPtr pColPriv = - (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr; - int i; - - if (CMapColormapUseMax(pVisual, pScreenPriv)) { - int index; - - num = 0; - while(ndef--) { - if(pdefs[ndef].flags & DoRed) { - index = (pdefs[ndef].pixel & pVisual->redMask) >> - pVisual->offsetRed; - i = num; - while(i--) - if(indices[i] == index) break; - if(i == -1) - indices[num++] = index; - } - if(pdefs[ndef].flags & DoGreen) { - index = (pdefs[ndef].pixel & pVisual->greenMask) >> - pVisual->offsetGreen; - i = num; - while(i--) - if(indices[i] == index) break; - if(i == -1) - indices[num++] = index; - } - if(pdefs[ndef].flags & DoBlue) { - index = (pdefs[ndef].pixel & pVisual->blueMask) >> - pVisual->offsetBlue; - i = num; - while(i--) - if(indices[i] == index) break; - if(i == -1) - indices[num++] = index; - } - } - - } else { - /* not really as overkill as it seems */ - num = pColPriv->numColors; - for(i = 0; i < pColPriv->numColors; i++) - indices[i] = i; - } - } else { - while(ndef--) - indices[ndef] = pdefs[ndef].pixel; - } - - CMapRefreshColors(pmap, num, indices); -} - - -static void -CMapInstallColormap(ColormapPtr pmap) -{ - ScreenPtr pScreen = pmap->pScreen; - int index = pScreen->myNum; - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr; - - if (pmap == miInstalledMaps[index]) - return; - - pScreen->InstallColormap = pScreenPriv->InstallColormap; - (*pScreen->InstallColormap)(pmap); - pScreen->InstallColormap = CMapInstallColormap; - - /* Important. We let the lower layers, namely DGA, - overwrite the choice of Colormap to install */ - if (miInstalledMaps[index]) - pmap = miInstalledMaps[index]; - - if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) && - (pmap->pVisual->class == TrueColor) && - CMapColormapUseMax(pmap->pVisual, pScreenPriv)) - return; - - if(LOAD_PALETTE(pmap, index)) - CMapReinstallMap(pmap); -} - - -/**** ScrnInfoRec functions ****/ - -static Bool -CMapEnterVT(int index, int flags) -{ - ScreenPtr pScreen = screenInfo.screens[index]; - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr; - - if((*pScreenPriv->EnterVT)(index, flags)) { - if(miInstalledMaps[index]) - CMapReinstallMap(miInstalledMaps[index]); - return TRUE; - } - return FALSE; -} - - -static Bool -CMapSwitchMode(int index, DisplayModePtr mode, int flags) -{ - ScreenPtr pScreen = screenInfo.screens[index]; - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr; - - if((*pScreenPriv->SwitchMode)(index, mode, flags)) { - if(miInstalledMaps[index]) - CMapReinstallMap(miInstalledMaps[index]); - return TRUE; - } - return FALSE; -} - -#ifdef XFreeXDGA -static int -CMapSetDGAMode(int index, int num, DGADevicePtr dev) -{ - ScreenPtr pScreen = screenInfo.screens[index]; - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr; - int ret; - - ret = (*pScreenPriv->SetDGAMode)(index, num, dev); - - pScreenPriv->isDGAmode = DGAActive(index); - - if(!pScreenPriv->isDGAmode && miInstalledMaps[index] - && xf86Screens[pScreen->myNum]->vtSema) - CMapReinstallMap(miInstalledMaps[index]); - - return ret; -} -#endif - - -/**** Utilities ****/ - -static void -CMapReinstallMap(ColormapPtr pmap) -{ - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr; - CMapColormapPtr cmapPriv = - (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr; - ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum]; - int i = cmapPriv->numColors; - int *indices = pScreenPriv->PreAllocIndices; - - while(i--) - indices[i] = i; - - if(cmapPriv->recalculate) - CMapRefreshColors(pmap, cmapPriv->numColors, indices); - else { - (*pScrn->LoadPalette)(pScrn, cmapPriv->numColors, - indices, cmapPriv->colors, pmap->pVisual); - if (pScrn->SetOverscan) { -#ifdef DEBUGOVERSCAN - ErrorF("SetOverscan() called from CMapReinstallMap\n"); -#endif - pScrn->SetOverscan(pScrn, cmapPriv->overscan); - } - } - - cmapPriv->recalculate = FALSE; -} - - -static void -CMapRefreshColors(ColormapPtr pmap, int defs, int* indices) -{ - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr; - CMapColormapPtr pColPriv = - (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr; - VisualPtr pVisual = pmap->pVisual; - ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum]; - int numColors, i; - LOCO *gamma, *colors; - EntryPtr entry; - int reds, greens, blues, maxValue, index, shift; - - numColors = pColPriv->numColors; - shift = 16 - pScreenPriv->sigRGBbits; - maxValue = (1 << pScreenPriv->sigRGBbits) - 1; - gamma = pScreenPriv->gamma; - colors = pColPriv->colors; - - reds = pVisual->redMask >> pVisual->offsetRed; - greens = pVisual->greenMask >> pVisual->offsetGreen; - blues = pVisual->blueMask >> pVisual->offsetBlue; - - switch(pVisual->class) { - case StaticGray: - for(i = 0; i <= numColors - 1; i++) { - index = i * maxValue / numColors; - colors[i].red = gamma[index].red; - colors[i].green = gamma[index].green; - colors[i].blue = gamma[index].blue; - } - break; - case TrueColor: - if (CMapColormapUseMax(pVisual, pScreenPriv)) { - for(i = 0; i <= reds; i++) - colors[i].red = gamma[i * maxValue / reds].red; - for(i = 0; i <= greens; i++) - colors[i].green = gamma[i * maxValue / greens].green; - for(i = 0; i <= blues; i++) - colors[i].blue = gamma[i * maxValue / blues].blue; - break; - } - for(i = 0; i < numColors; i++) { - colors[i].red = gamma[((i >> pVisual->offsetRed) & reds) * - maxValue / reds].red; - colors[i].green = gamma[((i >> pVisual->offsetGreen) & greens) * - maxValue / greens].green; - colors[i].blue = gamma[((i >> pVisual->offsetBlue) & blues) * - maxValue / blues].blue; - } - break; - case StaticColor: - case PseudoColor: - case GrayScale: - for(i = 0; i < defs; i++) { - index = indices[i]; - entry = (EntryPtr)&pmap->red[index]; - - if(entry->fShared) { - colors[index].red = - gamma[entry->co.shco.red->color >> shift].red; - colors[index].green = - gamma[entry->co.shco.green->color >> shift].green; - colors[index].blue = - gamma[entry->co.shco.blue->color >> shift].blue; - } else { - colors[index].red = - gamma[entry->co.local.red >> shift].red; - colors[index].green = - gamma[entry->co.local.green >> shift].green; - colors[index].blue = - gamma[entry->co.local.blue >> shift].blue; - } - } - break; - case DirectColor: - if (CMapColormapUseMax(pVisual, pScreenPriv)) { - for(i = 0; i < defs; i++) { - index = indices[i]; - if(index <= reds) - colors[index].red = - gamma[pmap->red[index].co.local.red >> shift].red; - if(index <= greens) - colors[index].green = - gamma[pmap->green[index].co.local.green >> shift].green; - if(index <= blues) - colors[index].blue = - gamma[pmap->blue[index].co.local.blue >> shift].blue; - - } - break; - } - for(i = 0; i < defs; i++) { - index = indices[i]; - - colors[index].red = gamma[pmap->red[ - (index >> pVisual->offsetRed) & reds - ].co.local.red >> shift].red; - colors[index].green = gamma[pmap->green[ - (index >> pVisual->offsetGreen) & greens - ].co.local.green >> shift].green; - colors[index].blue = gamma[pmap->blue[ - (index >> pVisual->offsetBlue) & blues - ].co.local.blue >> shift].blue; - } - break; - } - - - if(LOAD_PALETTE(pmap, pmap->pScreen->myNum)) - (*pScrn->LoadPalette)(pScreenPriv->pScrn, defs, indices, - colors, pmap->pVisual); - - if (pScrn->SetOverscan) - CMapSetOverscan(pmap, defs, indices); - -} - -static Bool -CMapCompareColors(LOCO *color1, LOCO *color2) -{ - /* return TRUE if the color1 is "closer" to black than color2 */ -#ifdef DEBUGOVERSCAN - ErrorF("#%02x%02x%02x vs #%02x%02x%02x (%d vs %d)\n", - color1->red, color1->green, color1->blue, - color2->red, color2->green, color2->blue, - color1->red + color1->green + color1->blue, - color2->red + color2->green + color2->blue); -#endif - return (color1->red + color1->green + color1->blue < - color2->red + color2->green + color2->blue); -} - -static void -CMapSetOverscan(ColormapPtr pmap, int defs, int *indices) -{ - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr; - CMapColormapPtr pColPriv = - (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr; - ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum]; - VisualPtr pVisual = pmap->pVisual; - int i; - LOCO *colors; - int index; - Bool newOverscan = FALSE; - int overscan, tmpOverscan; - - colors = pColPriv->colors; - overscan = pColPriv->overscan; - - /* - * Search for a new overscan index in the following cases: - * - * - The index hasn't yet been initialised.  In this case search - * for an index that is black or a close match to black. - * - * - The colour of the old index is changed. In this case search - * all indices for a black or close match to black. - * - * - The colour of the old index wasn't black. In this case only - * search the indices that were changed for a better match to black. - */ - - switch (pVisual->class) { - case StaticGray: - case TrueColor: - /* Should only come here once. Initialise the overscan index to 0 */ - overscan = 0; - newOverscan = TRUE; - break; - case StaticColor: - /* - * Only come here once, but search for the overscan in the same way - * as for the other cases. - */ - case DirectColor: - case PseudoColor: - case GrayScale: - if (overscan < 0 || overscan > pScreenPriv->maxColors - 1) { - /* Uninitialised */ - newOverscan = TRUE; - } else { - /* Check if the overscan was changed */ - for (i = 0; i < defs; i++) { - index = indices[i]; - if (index == overscan) { - newOverscan = TRUE; - break; - } - } - } - if (newOverscan) { - /* The overscan is either uninitialised or it has been changed */ - - if (overscan < 0 || overscan > pScreenPriv->maxColors - 1) - tmpOverscan = pScreenPriv->maxColors - 1; - else - tmpOverscan = overscan; - - /* search all entries for a close match to black */ - for (i = pScreenPriv->maxColors - 1; i >= 0; i--) { - if (colors[i].red == 0 && colors[i].green == 0 && - colors[i].blue == 0) { - overscan = i; -#ifdef DEBUGOVERSCAN - ErrorF("Black found at index 0x%02x\n", i); -#endif - break; - } else { -#ifdef DEBUGOVERSCAN - ErrorF("0x%02x: ", i); -#endif - if (CMapCompareColors(&colors[i], &colors[tmpOverscan])) { - tmpOverscan = i; -#ifdef DEBUGOVERSCAN - ErrorF("possible \"Black\" at index 0x%02x\n", i); -#endif - } - } - } - if (i < 0) - overscan = tmpOverscan; - } else { - /* Check of the old overscan wasn't black */ - if (colors[overscan].red != 0 || colors[overscan].green != 0 || - colors[overscan].blue != 0) { - int oldOverscan = tmpOverscan = overscan; - /* See of there is now a better match */ - for (i = 0; i < defs; i++) { - index = indices[i]; - if (colors[index].red == 0 && colors[index].green == 0 && - colors[index].blue == 0) { - overscan = index; -#ifdef DEBUGOVERSCAN - ErrorF("Black found at index 0x%02x\n", index); -#endif - break; - } else { -#ifdef DEBUGOVERSCAN - ErrorF("0x%02x: ", index); -#endif - if (CMapCompareColors(&colors[index], - &colors[tmpOverscan])) { - tmpOverscan = index; -#ifdef DEBUGOVERSCAN - ErrorF("possible \"Black\" at index 0x%02x\n", - index); -#endif - } - } - } - if (i == defs) - overscan = tmpOverscan; - if (overscan != oldOverscan) - newOverscan = TRUE; - } - } - break; - } - if (newOverscan) { - pColPriv->overscan = overscan; - if (LOAD_PALETTE(pmap, pmap->pScreen->myNum)) { -#ifdef DEBUGOVERSCAN - ErrorF("SetOverscan() called from CmapSetOverscan\n"); -#endif - pScrn->SetOverscan(pScreenPriv->pScrn, overscan); - } - } -} - -static void -CMapUnwrapScreen(ScreenPtr pScreen) -{ - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - - pScreen->CloseScreen = pScreenPriv->CloseScreen; - pScreen->CreateColormap = pScreenPriv->CreateColormap; - pScreen->DestroyColormap = pScreenPriv->DestroyColormap; - pScreen->InstallColormap = pScreenPriv->InstallColormap; - pScreen->StoreColors = pScreenPriv->StoreColors; - - pScrn->EnterVT = pScreenPriv->EnterVT; - pScrn->SwitchMode = pScreenPriv->SwitchMode; - pScrn->SetDGAMode = pScreenPriv->SetDGAMode; - - xfree(pScreenPriv->gamma); - xfree(pScreenPriv->PreAllocIndices); - xfree(pScreenPriv); -} - - -static void -ComputeGamma(CMapScreenPtr priv) -{ - int elements = priv->gammaElements - 1; - double RedGamma, GreenGamma, BlueGamma; - int i; - -#ifndef DONT_CHECK_GAMMA - /* This check is to catch drivers that are not initialising pScrn->gamma */ - if (priv->pScrn->gamma.red < GAMMA_MIN || - priv->pScrn->gamma.red > GAMMA_MAX || - priv->pScrn->gamma.green < GAMMA_MIN || - priv->pScrn->gamma.green > GAMMA_MAX || - priv->pScrn->gamma.blue < GAMMA_MIN || - priv->pScrn->gamma.blue > GAMMA_MAX) { - - xf86DrvMsgVerb(priv->pScrn->scrnIndex, X_WARNING, 0, - "The %s driver didn't call xf86SetGamma() to initialise\n" - "\tthe gamma values.\n", priv->pScrn->driverName); - xf86DrvMsgVerb(priv->pScrn->scrnIndex, X_WARNING, 0, - "PLEASE FIX THE `%s' DRIVER!\n", priv->pScrn->driverName); - priv->pScrn->gamma.red = 1.0; - priv->pScrn->gamma.green = 1.0; - priv->pScrn->gamma.blue = 1.0; - } -#endif - - RedGamma = 1.0 / (double)priv->pScrn->gamma.red; - GreenGamma = 1.0 / (double)priv->pScrn->gamma.green; - BlueGamma = 1.0 / (double)priv->pScrn->gamma.blue; - - for(i = 0; i <= elements; i++) { - if(RedGamma == 1.0) - priv->gamma[i].red = i; - else - priv->gamma[i].red = (CARD16)(pow((double)i/(double)elements, - RedGamma) * (double)elements + 0.5); - - if(GreenGamma == 1.0) - priv->gamma[i].green = i; - else - priv->gamma[i].green = (CARD16)(pow((double)i/(double)elements, - GreenGamma) * (double)elements + 0.5); - - if(BlueGamma == 1.0) - priv->gamma[i].blue = i; - else - priv->gamma[i].blue = (CARD16)(pow((double)i/(double)elements, - BlueGamma) * (double)elements + 0.5); - } -} - - -int -CMapChangeGamma( - int index, - Gamma gamma -){ - ScrnInfoPtr pScrn = xf86Screens[index]; - ScreenPtr pScreen = pScrn->pScreen; - CMapColormapPtr pColPriv; - CMapScreenPtr pScreenPriv; - CMapLinkPtr pLink; - - /* Is this sufficient checking ? */ - if(CMapScreenIndex == -1) - return BadImplementation; - - pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr; - if(!pScreenPriv) - return BadImplementation; - - if (gamma.red < GAMMA_MIN || gamma.red > GAMMA_MAX || - gamma.green < GAMMA_MIN || gamma.green > GAMMA_MAX || - gamma.blue < GAMMA_MIN || gamma.blue > GAMMA_MAX) - return BadValue; - - pScrn->gamma.red = gamma.red; - pScrn->gamma.green = gamma.green; - pScrn->gamma.blue = gamma.blue; - - ComputeGamma(pScreenPriv); - - /* mark all colormaps on this screen */ - pLink = pScreenPriv->maps; - while(pLink) { - pColPriv = - (CMapColormapPtr) pLink->cmap->devPrivates[CMapColormapIndex].ptr; - pColPriv->recalculate = TRUE; - pLink = pLink->next; - } - - if(miInstalledMaps[pScreen->myNum] && - ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || - pScrn->vtSema || pScreenPriv->isDGAmode)) { - ColormapPtr pMap = miInstalledMaps[pScreen->myNum]; - - if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) && - (pMap->pVisual->class == TrueColor) && - CMapColormapUseMax(pMap->pVisual, pScreenPriv)) { - - /* if the current map doesn't have a palette look - for another map to change the gamma on. */ - - pLink = pScreenPriv->maps; - while(pLink) { - if(pLink->cmap->pVisual->class == PseudoColor) - break; - pLink = pLink->next; - } - - if(pLink) { - /* need to trick CMapRefreshColors() into thinking - this is the currently installed map */ - miInstalledMaps[pScreen->myNum] = pLink->cmap; - CMapReinstallMap(pLink->cmap); - miInstalledMaps[pScreen->myNum] = pMap; - } - } else - CMapReinstallMap(pMap); - } - - return Success; -} - - -static void -ComputeGammaRamp ( - CMapScreenPtr priv, - unsigned short *red, - unsigned short *green, - unsigned short *blue -){ - int elements = priv->gammaElements; - LOCO *entry = priv->gamma; - int shift = 16 - priv->sigRGBbits; - - while(elements--) { - entry->red = *(red++) >> shift; - entry->green = *(green++) >> shift; - entry->blue = *(blue++) >> shift; - entry++; - } -} - -int -xf86ChangeGammaRamp( - ScreenPtr pScreen, - int size, - unsigned short *red, - unsigned short *green, - unsigned short *blue -){ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - CMapColormapPtr pColPriv; - CMapScreenPtr pScreenPriv; - CMapLinkPtr pLink; - - if(CMapScreenIndex == -1) - return BadImplementation; - - pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr; - if(!pScreenPriv) - return BadImplementation; - - if(pScreenPriv->gammaElements != size) - return BadValue; - - ComputeGammaRamp(pScreenPriv, red, green, blue); - - /* mark all colormaps on this screen */ - pLink = pScreenPriv->maps; - while(pLink) { - pColPriv = - (CMapColormapPtr) pLink->cmap->devPrivates[CMapColormapIndex].ptr; - pColPriv->recalculate = TRUE; - pLink = pLink->next; - } - - if(miInstalledMaps[pScreen->myNum] && - ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || - pScrn->vtSema || pScreenPriv->isDGAmode)) { - ColormapPtr pMap = miInstalledMaps[pScreen->myNum]; - - if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) && - (pMap->pVisual->class == TrueColor) && - CMapColormapUseMax(pMap->pVisual, pScreenPriv)) { - - /* if the current map doesn't have a palette look - for another map to change the gamma on. */ - - pLink = pScreenPriv->maps; - while(pLink) { - if(pLink->cmap->pVisual->class == PseudoColor) - break; - pLink = pLink->next; - } - - if(pLink) { - /* need to trick CMapRefreshColors() into thinking - this is the currently installed map */ - miInstalledMaps[pScreen->myNum] = pLink->cmap; - CMapReinstallMap(pLink->cmap); - miInstalledMaps[pScreen->myNum] = pMap; - } - } else - CMapReinstallMap(pMap); - } - - return Success; -} - -int -xf86GetGammaRampSize(ScreenPtr pScreen) -{ - CMapScreenPtr pScreenPriv; - - if(CMapScreenIndex == -1) return 0; - - pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr; - if(!pScreenPriv) return 0; - - return pScreenPriv->gammaElements; -} - -int -xf86GetGammaRamp( - ScreenPtr pScreen, - int size, - unsigned short *red, - unsigned short *green, - unsigned short *blue -){ - CMapScreenPtr pScreenPriv; - LOCO *entry; - int shift, sigbits; - - if(CMapScreenIndex == -1) - return BadImplementation; - - pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr; - if(!pScreenPriv) - return BadImplementation; - - if(size > pScreenPriv->gammaElements) - return BadValue; - - entry = pScreenPriv->gamma; - sigbits = pScreenPriv->sigRGBbits; - - while(size--) { - *red = entry->red << (16 - sigbits); - *green = entry->green << (16 - sigbits); - *blue = entry->blue << (16 - sigbits); - shift = sigbits; - while(shift < 16) { - *red |= *red >> shift; - *green |= *green >> shift; - *blue |= *blue >> shift; - shift += sigbits; - } - red++; green++; blue++; - entry++; - } - - return Success; -} - -int -xf86ChangeGamma( - ScreenPtr pScreen, - Gamma gamma -){ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - - if(pScrn->ChangeGamma) - return (*pScrn->ChangeGamma)(pScreen->myNum, gamma); - - return Success; /* Success? */ -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86cmap.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86cmap.h deleted file mode 100644 index 4291b971a..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86cmap.h +++ /dev/null @@ -1,76 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86cmap.h,v 1.9 2003/10/17 20:02:12 alanh Exp $ */ - -/* - * Copyright (c) 1998-2001 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifndef _XF86CMAP_H -#define _XF86CMAP_H - -#include "xf86str.h" -#include "colormapst.h" - -#define CMAP_PALETTED_TRUECOLOR 0x0000001 -#define CMAP_RELOAD_ON_MODE_SWITCH 0x0000002 -#define CMAP_LOAD_EVEN_IF_OFFSCREEN 0x0000004 - -Bool xf86HandleColormaps( - ScreenPtr pScreen, - int maxCol, - int sigRGBbits, - xf86LoadPaletteProc *loadPalette, - xf86SetOverscanProc *setOverscan, - unsigned int flags -); - -int -xf86ChangeGamma( - ScreenPtr pScreen, - Gamma newGamma -); - -int -xf86ChangeGammaRamp( - ScreenPtr pScreen, - int size, - unsigned short *red, - unsigned short *green, - unsigned short *blue -); - -int xf86GetGammaRampSize(ScreenPtr pScreen); - -int -xf86GetGammaRamp( - ScreenPtr pScreen, - int size, - unsigned short *red, - unsigned short *green, - unsigned short *blue -); - -#endif /* _XF86CMAP_H */ - diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86fbBus.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86fbBus.c deleted file mode 100644 index 28a65302d..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86fbBus.c +++ /dev/null @@ -1,97 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbBus.c,v 1.3 2003/08/24 17:36:55 dawes Exp $ */ - -/* - * Copyright (c) 2000-2001 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * This file contains the interfaces to the bus-specific code - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Resources.h" - -#include "xf86Bus.h" - -#define XF86_OS_PRIVS -#define NEED_OS_RAC_PROTOS -#include "xf86_OSproc.h" - -#include "xf86RAC.h" - -Bool fbSlotClaimed = FALSE; - -int -xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active) -{ - EntityPtr p; - int num; - - num = xf86AllocateEntity(); - p = xf86Entities[num]; - p->driver = drvp; - p->chipset = 0; - p->busType = BUS_NONE; - p->active = active; - p->inUse = FALSE; - xf86AddDevToEntity(num, dev); - p->access = xnfcalloc(1,sizeof(EntityAccessRec)); - p->access->fallback = &AccessNULL; - p->access->pAccess = &AccessNULL; - p->busAcc = NULL; - - fbSlotClaimed = TRUE; - return num; -} - -/* - * Get the list of FB "slots" claimed by a screen - */ -int -xf86GetFbInfoForScreen(int scrnIndex) -{ - int num = 0; - int i; - EntityPtr p; - - for (i = 0; i < xf86Screens[scrnIndex]->numEntities; i++) { - p = xf86Entities[xf86Screens[scrnIndex]->entityList[i]]; - if (p->busType == BUS_NONE) { - num++; - } - } - return num; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86fbman.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86fbman.c deleted file mode 100644 index 31c84c49f..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86fbman.c +++ /dev/null @@ -1,1445 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.c,v 1.28 2003/11/03 05:11:03 tsi Exp $ */ - -/* - * Copyright (c) 1998-2001 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "misc.h" -#include "xf86.h" - -#include -#include "scrnintstr.h" -#include "regionstr.h" -#include "xf86fbman.h" - -/* -#define DEBUG -*/ - -static int xf86FBMangerIndex = -1; -static unsigned long xf86ManagerGeneration = 0; - -Bool xf86RegisterOffscreenManager( - ScreenPtr pScreen, - FBManagerFuncsPtr funcs -){ - - if(xf86ManagerGeneration != serverGeneration) { - if((xf86FBMangerIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - xf86ManagerGeneration = serverGeneration; - } - - pScreen->devPrivates[xf86FBMangerIndex].ptr = (pointer)funcs; - - return TRUE; -} - - -Bool -xf86FBManagerRunning(ScreenPtr pScreen) -{ - if(xf86FBMangerIndex < 0) - return FALSE; - if(!pScreen->devPrivates[xf86FBMangerIndex].ptr) - return FALSE; - - return TRUE; -} - -Bool -xf86RegisterFreeBoxCallback( - ScreenPtr pScreen, - FreeBoxCallbackProcPtr FreeBoxCallback, - pointer devPriv -){ - FBManagerFuncsPtr funcs; - - if(xf86FBMangerIndex < 0) - return FALSE; - if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr)) - return FALSE; - - return (*funcs->RegisterFreeBoxCallback)(pScreen, FreeBoxCallback, devPriv); -} - - -FBAreaPtr -xf86AllocateOffscreenArea( - ScreenPtr pScreen, - int w, int h, - int gran, - MoveAreaCallbackProcPtr moveCB, - RemoveAreaCallbackProcPtr removeCB, - pointer privData -){ - FBManagerFuncsPtr funcs; - - if(xf86FBMangerIndex < 0) - return NULL; - if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr)) - return NULL; - - return (*funcs->AllocateOffscreenArea)( - pScreen, w, h, gran, moveCB, removeCB, privData); -} - - -FBLinearPtr -xf86AllocateOffscreenLinear( - ScreenPtr pScreen, - int length, - int gran, - MoveLinearCallbackProcPtr moveCB, - RemoveLinearCallbackProcPtr removeCB, - pointer privData -){ - FBManagerFuncsPtr funcs; - - if(xf86FBMangerIndex < 0) - return NULL; - if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr)) - return NULL; - - return (*funcs->AllocateOffscreenLinear)( - pScreen, length, gran, moveCB, removeCB, privData); -} - - -void -xf86FreeOffscreenArea(FBAreaPtr area) -{ - FBManagerFuncsPtr funcs; - - if(!area) return; - - if(xf86FBMangerIndex < 0) - return; - if(!(funcs = - (FBManagerFuncsPtr)area->pScreen->devPrivates[xf86FBMangerIndex].ptr)) - return; - - (*funcs->FreeOffscreenArea)(area); - - return; -} - - -void -xf86FreeOffscreenLinear(FBLinearPtr linear) -{ - FBManagerFuncsPtr funcs; - - if(!linear) return; - - if(xf86FBMangerIndex < 0) - return; - if(!(funcs = - (FBManagerFuncsPtr)linear->pScreen->devPrivates[xf86FBMangerIndex].ptr)) - return; - - (*funcs->FreeOffscreenLinear)(linear); - - return; -} - - -Bool -xf86ResizeOffscreenArea( - FBAreaPtr resize, - int w, int h -){ - FBManagerFuncsPtr funcs; - - if(!resize) return FALSE; - - if(xf86FBMangerIndex < 0) - return FALSE; - if(!(funcs = - (FBManagerFuncsPtr)resize->pScreen->devPrivates[xf86FBMangerIndex].ptr)) - return FALSE; - - return (*funcs->ResizeOffscreenArea)(resize, w, h); -} - -Bool -xf86ResizeOffscreenLinear( - FBLinearPtr resize, - int size -){ - FBManagerFuncsPtr funcs; - - if(!resize) return FALSE; - - if(xf86FBMangerIndex < 0) - return FALSE; - if(!(funcs = - (FBManagerFuncsPtr)resize->pScreen->devPrivates[xf86FBMangerIndex].ptr)) - return FALSE; - - return (*funcs->ResizeOffscreenLinear)(resize, size); -} - - -Bool -xf86QueryLargestOffscreenArea( - ScreenPtr pScreen, - int *w, int *h, - int gran, - int preferences, - int severity -){ - FBManagerFuncsPtr funcs; - - *w = 0; - *h = 0; - - if(xf86FBMangerIndex < 0) - return FALSE; - if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr)) - return FALSE; - - return (*funcs->QueryLargestOffscreenArea)( - pScreen, w, h, gran, preferences, severity); -} - -Bool -xf86QueryLargestOffscreenLinear( - ScreenPtr pScreen, - int *size, - int gran, - int severity -){ - FBManagerFuncsPtr funcs; - - *size = 0; - - if(xf86FBMangerIndex < 0) - return FALSE; - if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr)) - return FALSE; - - return (*funcs->QueryLargestOffscreenLinear)( - pScreen, size, gran, severity); -} - - -Bool -xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen) -{ - FBManagerFuncsPtr funcs; - - if(xf86FBMangerIndex < 0) - return FALSE; - if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr)) - return FALSE; - - return (*funcs->PurgeOffscreenAreas)(pScreen); -} - -/************************************************************\ - - Below is a specific implementation of an offscreen manager. - -\************************************************************/ - -static unsigned long xf86FBGeneration = 0; -static int xf86FBScreenIndex = -1; - -typedef struct _FBLink { - FBArea area; - struct _FBLink *next; -} FBLink, *FBLinkPtr; - -typedef struct _FBLinearLink { - FBLinear linear; - int free; /* need to add free here as FBLinear is publicly accessible */ - FBAreaPtr area; /* only used if allocation came from XY area */ - struct _FBLinearLink *next; -} FBLinearLink, *FBLinearLinkPtr; - - -typedef struct { - ScreenPtr pScreen; - RegionPtr InitialBoxes; - RegionPtr FreeBoxes; - FBLinkPtr UsedAreas; - int NumUsedAreas; - FBLinearLinkPtr LinearAreas; - CloseScreenProcPtr CloseScreen; - int NumCallbacks; - FreeBoxCallbackProcPtr *FreeBoxesUpdateCallback; - DevUnion *devPrivates; -} FBManager, *FBManagerPtr; - - -static void -SendCallFreeBoxCallbacks(FBManagerPtr offman) -{ - int i = offman->NumCallbacks; - - while(i--) { - (*offman->FreeBoxesUpdateCallback[i])( - offman->pScreen, offman->FreeBoxes, offman->devPrivates[i].ptr); - } -} - -static Bool -localRegisterFreeBoxCallback( - ScreenPtr pScreen, - FreeBoxCallbackProcPtr FreeBoxCallback, - pointer devPriv -){ - FBManagerPtr offman; - FreeBoxCallbackProcPtr *newCallbacks; - DevUnion *newPrivates; - - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - - newCallbacks = xrealloc( offman->FreeBoxesUpdateCallback, - sizeof(FreeBoxCallbackProcPtr) * (offman->NumCallbacks + 1)); - - newPrivates = xrealloc(offman->devPrivates, - sizeof(DevUnion) * (offman->NumCallbacks + 1)); - - if(!newCallbacks || !newPrivates) - return FALSE; - - offman->FreeBoxesUpdateCallback = newCallbacks; - offman->devPrivates = newPrivates; - - offman->FreeBoxesUpdateCallback[offman->NumCallbacks] = FreeBoxCallback; - offman->devPrivates[offman->NumCallbacks].ptr = devPriv; - offman->NumCallbacks++; - - SendCallFreeBoxCallbacks(offman); - - return TRUE; -} - - -static FBAreaPtr -AllocateArea( - FBManagerPtr offman, - int w, int h, - int granularity, - MoveAreaCallbackProcPtr moveCB, - RemoveAreaCallbackProcPtr removeCB, - pointer privData -){ - ScreenPtr pScreen = offman->pScreen; - FBLinkPtr link = NULL; - FBAreaPtr area = NULL; - RegionRec NewReg; - int i, x = 0, num; - BoxPtr boxp; - - if(granularity <= 1) granularity = 0; - - boxp = REGION_RECTS(offman->FreeBoxes); - num = REGION_NUM_RECTS(offman->FreeBoxes); - - /* look through the free boxes */ - for(i = 0; i < num; i++, boxp++) { - x = boxp->x1; - if(granularity) { - int tmp = x % granularity; - if(tmp) x += (granularity - tmp); - } - - if(((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w)) - continue; - - link = xalloc(sizeof(FBLink)); - if(!link) return NULL; - - area = &(link->area); - link->next = offman->UsedAreas; - offman->UsedAreas = link; - offman->NumUsedAreas++; - break; - } - - /* try to boot a removeable one out if we are not expendable ourselves */ - if(!area && !removeCB) { - link = offman->UsedAreas; - - while(link) { - if(!link->area.RemoveAreaCallback) { - link = link->next; - continue; - } - - boxp = &(link->area.box); - x = boxp->x1; - if(granularity) { - int tmp = x % granularity; - if(tmp) x += (granularity - tmp); - } - - if(((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w)) { - link = link->next; - continue; - } - - /* bye, bye */ - (*link->area.RemoveAreaCallback)(&link->area); - REGION_INIT(pScreen, &NewReg, &(link->area.box), 1); - REGION_UNION(pScreen, offman->FreeBoxes, offman->FreeBoxes, &NewReg); - REGION_UNINIT(pScreen, &NewReg); - - area = &(link->area); - break; - } - } - - if(area) { - area->pScreen = pScreen; - area->granularity = granularity; - area->box.x1 = x; - area->box.x2 = x + w; - area->box.y1 = boxp->y1; - area->box.y2 = boxp->y1 + h; - area->MoveAreaCallback = moveCB; - area->RemoveAreaCallback = removeCB; - area->devPrivate.ptr = privData; - - REGION_INIT(pScreen, &NewReg, &(area->box), 1); - REGION_SUBTRACT(pScreen, offman->FreeBoxes, offman->FreeBoxes, &NewReg); - REGION_UNINIT(pScreen, &NewReg); - } - - return area; -} - -static FBAreaPtr -localAllocateOffscreenArea( - ScreenPtr pScreen, - int w, int h, - int gran, - MoveAreaCallbackProcPtr moveCB, - RemoveAreaCallbackProcPtr removeCB, - pointer privData -){ - FBManagerPtr offman; - FBAreaPtr area = NULL; - - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - - if((area = AllocateArea(offman, w, h, gran, moveCB, removeCB, privData))) - SendCallFreeBoxCallbacks(offman); - - return area; -} - - -static void -localFreeOffscreenArea(FBAreaPtr area) -{ - FBManagerPtr offman; - FBLinkPtr pLink, pLinkPrev = NULL; - RegionRec FreedRegion; - ScreenPtr pScreen; - - pScreen = area->pScreen; - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - - pLink = offman->UsedAreas; - if(!pLink) return; - - while(&(pLink->area) != area) { - pLinkPrev = pLink; - pLink = pLink->next; - if(!pLink) return; - } - - /* put the area back into the pool */ - REGION_INIT(pScreen, &FreedRegion, &(pLink->area.box), 1); - REGION_UNION(pScreen, offman->FreeBoxes, offman->FreeBoxes, &FreedRegion); - REGION_UNINIT(pScreen, &FreedRegion); - - if(pLinkPrev) - pLinkPrev->next = pLink->next; - else offman->UsedAreas = pLink->next; - - xfree(pLink); - offman->NumUsedAreas--; - - SendCallFreeBoxCallbacks(offman); -} - - - -static Bool -localResizeOffscreenArea( - FBAreaPtr resize, - int w, int h -){ - FBManagerPtr offman; - ScreenPtr pScreen; - BoxRec OrigArea; - RegionRec FreedReg; - FBAreaPtr area = NULL; - FBLinkPtr pLink, newLink, pLinkPrev = NULL; - - pScreen = resize->pScreen; - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - - /* find this link */ - if(!(pLink = offman->UsedAreas)) - return FALSE; - - while(&(pLink->area) != resize) { - pLinkPrev = pLink; - pLink = pLink->next; - if(!pLink) return FALSE; - } - - OrigArea.x1 = resize->box.x1; - OrigArea.x2 = resize->box.x2; - OrigArea.y1 = resize->box.y1; - OrigArea.y2 = resize->box.y2; - - /* if it's smaller, this is easy */ - - if((w <= (resize->box.x2 - resize->box.x1)) && - (h <= (resize->box.y2 - resize->box.y1))) { - RegionRec NewReg; - - resize->box.x2 = resize->box.x1 + w; - resize->box.y2 = resize->box.y1 + h; - - if((resize->box.y2 == OrigArea.y2) && - (resize->box.x2 == OrigArea.x2)) - return TRUE; - - REGION_INIT(pScreen, &FreedReg, &OrigArea, 1); - REGION_INIT(pScreen, &NewReg, &(resize->box), 1); - REGION_SUBTRACT(pScreen, &FreedReg, &FreedReg, &NewReg); - REGION_UNION(pScreen, offman->FreeBoxes, offman->FreeBoxes, &FreedReg); - REGION_UNINIT(pScreen, &FreedReg); - REGION_UNINIT(pScreen, &NewReg); - - SendCallFreeBoxCallbacks(offman); - - return TRUE; - } - - - /* otherwise we remove the old region */ - - REGION_INIT(pScreen, &FreedReg, &OrigArea, 1); - REGION_UNION(pScreen, offman->FreeBoxes, offman->FreeBoxes, &FreedReg); - - /* remove the old link */ - if(pLinkPrev) - pLinkPrev->next = pLink->next; - else offman->UsedAreas = pLink->next; - - /* and try to add a new one */ - - if((area = AllocateArea(offman, w, h, resize->granularity, - resize->MoveAreaCallback, resize->RemoveAreaCallback, - resize->devPrivate.ptr))) { - - /* copy data over to our link and replace the new with old */ - memcpy(resize, area, sizeof(FBArea)); - - pLinkPrev = NULL; - newLink = offman->UsedAreas; - - while(&(newLink->area) != area) { - pLinkPrev = newLink; - newLink = newLink->next; - } - - if(pLinkPrev) - pLinkPrev->next = newLink->next; - else offman->UsedAreas = newLink->next; - - pLink->next = offman->UsedAreas; - offman->UsedAreas = pLink; - - xfree(newLink); - - /* AllocateArea added one but we really only exchanged one */ - offman->NumUsedAreas--; - } else { - /* reinstate the old region */ - REGION_SUBTRACT(pScreen, offman->FreeBoxes, offman->FreeBoxes, &FreedReg); - REGION_UNINIT(pScreen, &FreedReg); - - pLink->next = offman->UsedAreas; - offman->UsedAreas = pLink; - return FALSE; - } - - - REGION_UNINIT(pScreen, &FreedReg); - - SendCallFreeBoxCallbacks(offman); - - return TRUE; -} - -static Bool -localQueryLargestOffscreenArea( - ScreenPtr pScreen, - int *width, int *height, - int granularity, - int preferences, - int severity -){ - FBManagerPtr offman; - RegionPtr newRegion = NULL; - BoxPtr pbox; - int nbox; - int x, w, h, area, oldArea; - - *width = *height = oldArea = 0; - - if(granularity <= 1) granularity = 0; - - if((preferences < 0) || (preferences > 3)) - return FALSE; - - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - - if(severity < 0) severity = 0; - if(severity > 2) severity = 2; - - switch(severity) { - case 2: - if(offman->NumUsedAreas) { - FBLinkPtr pLink; - RegionRec tmpRegion; - newRegion = REGION_CREATE(pScreen, NULL, 1); - REGION_COPY(pScreen, newRegion, offman->InitialBoxes); - pLink = offman->UsedAreas; - - while(pLink) { - if(!pLink->area.RemoveAreaCallback) { - REGION_INIT(pScreen, &tmpRegion, &(pLink->area.box), 1); - REGION_SUBTRACT(pScreen, newRegion, newRegion, &tmpRegion); - REGION_UNINIT(pScreen, &tmpRegion); - } - pLink = pLink->next; - } - - nbox = REGION_NUM_RECTS(newRegion); - pbox = REGION_RECTS(newRegion); - break; - } - case 1: - if(offman->NumUsedAreas) { - FBLinkPtr pLink; - RegionRec tmpRegion; - newRegion = REGION_CREATE(pScreen, NULL, 1); - REGION_COPY(pScreen, newRegion, offman->FreeBoxes); - pLink = offman->UsedAreas; - - while(pLink) { - if(pLink->area.RemoveAreaCallback) { - REGION_INIT(pScreen, &tmpRegion, &(pLink->area.box), 1); - REGION_APPEND(pScreen, newRegion, &tmpRegion); - REGION_UNINIT(pScreen, &tmpRegion); - } - pLink = pLink->next; - } - - nbox = REGION_NUM_RECTS(newRegion); - pbox = REGION_RECTS(newRegion); - break; - } - default: - nbox = REGION_NUM_RECTS(offman->FreeBoxes); - pbox = REGION_RECTS(offman->FreeBoxes); - break; - } - - while(nbox--) { - x = pbox->x1; - if(granularity) { - int tmp = x % granularity; - if(tmp) x += (granularity - tmp); - } - - w = pbox->x2 - x; - h = pbox->y2 - pbox->y1; - area = w * h; - - if(w > 0) { - Bool gotIt = FALSE; - switch(preferences) { - case FAVOR_AREA_THEN_WIDTH: - if((area > oldArea) || ((area == oldArea) && (w > *width))) - gotIt = TRUE; - break; - case FAVOR_AREA_THEN_HEIGHT: - if((area > oldArea) || ((area == oldArea) && (h > *height))) - gotIt = TRUE; - break; - case FAVOR_WIDTH_THEN_AREA: - if((w > *width) || ((w == *width) && (area > oldArea))) - gotIt = TRUE; - break; - case FAVOR_HEIGHT_THEN_AREA: - if((h > *height) || ((h == *height) && (area > oldArea))) - gotIt = TRUE; - break; - } - if(gotIt) { - *width = w; - *height = h; - oldArea = area; - } - } - pbox++; - } - - if(newRegion) - REGION_DESTROY(pScreen, newRegion); - - return TRUE; -} - -static Bool -localPurgeUnlockedOffscreenAreas(ScreenPtr pScreen) -{ - FBManagerPtr offman; - FBLinkPtr pLink, tmp, pPrev = NULL; - RegionRec FreedRegion; - Bool anyUsed = FALSE; - - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - - pLink = offman->UsedAreas; - if(!pLink) return TRUE; - - while(pLink) { - if(pLink->area.RemoveAreaCallback) { - (*pLink->area.RemoveAreaCallback)(&pLink->area); - - REGION_INIT(pScreen, &FreedRegion, &(pLink->area.box), 1); - REGION_APPEND(pScreen, offman->FreeBoxes, &FreedRegion); - REGION_UNINIT(pScreen, &FreedRegion); - - if(pPrev) - pPrev->next = pLink->next; - else offman->UsedAreas = pLink->next; - - tmp = pLink; - pLink = pLink->next; - xfree(tmp); - offman->NumUsedAreas--; - anyUsed = TRUE; - } else { - pPrev = pLink; - pLink = pLink->next; - } - } - - if(anyUsed) { - REGION_VALIDATE(pScreen, offman->FreeBoxes, &anyUsed); - SendCallFreeBoxCallbacks(offman); - } - - return TRUE; -} - -static void -LinearMoveCBWrapper(FBAreaPtr from, FBAreaPtr to) -{ - /* this will never get called */ -} - -static void -LinearRemoveCBWrapper(FBAreaPtr area) -{ - FBManagerPtr offman; - FBLinearLinkPtr pLink, pLinkPrev = NULL; - ScreenPtr pScreen = area->pScreen; - - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - - pLink = offman->LinearAreas; - if(!pLink) return; - - while(pLink->area != area) { - pLinkPrev = pLink; - pLink = pLink->next; - if(!pLink) return; - } - - /* give the user the callback it is expecting */ - (*pLink->linear.RemoveLinearCallback)(&(pLink->linear)); - - if(pLinkPrev) - pLinkPrev->next = pLink->next; - else offman->LinearAreas = pLink->next; - - xfree(pLink); -} - -#ifdef DEBUG -static void -Dump(FBLinearLinkPtr pLink) -{ - if (!pLink) ErrorF("MMmm, PLINK IS NULL!\n"); - - while (pLink) { - ErrorF(" Offset:%08x, Size:%08x, %s,%s\n", - pLink->linear.offset, - pLink->linear.size, - pLink->free ? "Free" : "Used", - pLink->area ? "Area" : "Linear"); - - pLink = pLink->next; - } -} -#endif - -static FBLinearPtr -AllocateLinear( - FBManagerPtr offman, - int size, - int granularity, - pointer privData -){ - ScreenPtr pScreen = offman->pScreen; - FBLinearLinkPtr linear = NULL; - FBLinearLinkPtr newlink = NULL; - int offset, end; - - if(size <= 0) return NULL; - - if (!offman->LinearAreas) return NULL; - - linear = offman->LinearAreas; - while (linear) { - /* Make sure we get a free area that's not an XY fallback case */ - if (!linear->area && linear->free) { - offset = (linear->linear.offset + granularity) & ~granularity; - end = offset+size; - if (end <= (linear->linear.offset + linear->linear.size)) - break; - } - linear = linear->next; - } - if (!linear) - return NULL; - - /* break left */ - if (offset > linear->linear.offset) { - newlink = xalloc(sizeof(FBLinearLink)); - if (!newlink) - return NULL; - newlink->area = NULL; - newlink->linear.offset = offset; - newlink->linear.size = linear->linear.size - (offset - linear->linear.offset); - newlink->free = 1; - newlink->next = linear->next; - linear->linear.size -= newlink->linear.size; - linear->next = newlink; - linear = newlink; - } - - /* break right */ - if (size < linear->linear.size) { - newlink = xalloc(sizeof(FBLinearLink)); - if (!newlink) - return NULL; - newlink->area = NULL; - newlink->linear.offset = offset + size; - newlink->linear.size = linear->linear.size - size; - newlink->free = 1; - newlink->next = linear->next; - linear->linear.size = size; - linear->next = newlink; - } - - /* p = middle block */ - linear->linear.granularity = granularity; - linear->free = 0; - linear->linear.pScreen = pScreen; - linear->linear.MoveLinearCallback = NULL; - linear->linear.RemoveLinearCallback = NULL; - linear->linear.devPrivate.ptr = NULL; - -#ifdef DEBUG - Dump(offman->LinearAreas); -#endif - - return &(linear->linear); -} - -static FBLinearPtr -localAllocateOffscreenLinear( - ScreenPtr pScreen, - int length, - int gran, - MoveLinearCallbackProcPtr moveCB, - RemoveLinearCallbackProcPtr removeCB, - pointer privData -){ - FBManagerPtr offman; - FBLinearLinkPtr link; - FBAreaPtr area; - FBLinearPtr linear = NULL; - BoxPtr extents; - int w, h, pitch; - - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - - /* Try to allocate from linear memory first...... */ -#ifdef DEBUG - ErrorF("ALLOCATING LINEAR\n"); -#endif - if ((linear = AllocateLinear(offman, length, gran, privData))) - return linear; - -#ifdef DEBUG - ErrorF("NOPE, ALLOCATING AREA\n"); -#endif - - if(!(link = xalloc(sizeof(FBLinearLink)))) - return NULL; - - /* No linear available, so try and pinch some from the XY areas */ - extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); - pitch = extents->x2 - extents->x1; - - if(gran && ((gran > pitch) || (pitch % gran))) { - /* we can't match the specified alignment with XY allocations */ - xfree(link); - return NULL; - } - - if(length < pitch) { /* special case */ - w = length; - h = 1; - } else { - w = pitch; - h = (length + pitch - 1) / pitch; - } - - if((area = localAllocateOffscreenArea(pScreen, w, h, gran, - moveCB ? LinearMoveCBWrapper : NULL, - removeCB ? LinearRemoveCBWrapper : NULL, - privData))) - { - link->area = area; - link->free = 0; - link->next = offman->LinearAreas; - offman->LinearAreas = link; - linear = &(link->linear); - linear->pScreen = pScreen; - linear->size = h * w; - linear->offset = (pitch * area->box.y1) + area->box.x1; - linear->granularity = gran; - linear->MoveLinearCallback = moveCB; - linear->RemoveLinearCallback = removeCB; - linear->devPrivate.ptr = privData; - } else - xfree(link); - -#ifdef DEBUG - Dump(offman->LinearAreas); -#endif - - return linear; -} - - -static void -localFreeOffscreenLinear(FBLinearPtr linear) -{ - FBManagerPtr offman; - FBLinearLinkPtr pLink, pLinkPrev = NULL; - ScreenPtr pScreen = linear->pScreen; - - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - - pLink = offman->LinearAreas; - if(!pLink) return; - - while(&(pLink->linear) != linear) { - pLinkPrev = pLink; - pLink = pLink->next; - if(!pLink) return; - } - - if(pLink->area) { /* really an XY area */ -#ifdef DEBUG - ErrorF("FREEING AREA\n"); -#endif - localFreeOffscreenArea(pLink->area); - if(pLinkPrev) - pLinkPrev->next = pLink->next; - else offman->LinearAreas = pLink->next; - xfree(pLink); -#ifdef DEBUG - Dump(offman->LinearAreas); -#endif - return; - } - - pLink->free = 1; - - if (pLink->next && pLink->next->free) { - FBLinearLinkPtr p = pLink->next; - pLink->linear.size += p->linear.size; - pLink->next = p->next; - free(p); - } - - if(pLinkPrev) { - if (pLinkPrev->next && pLinkPrev->next->free && !pLinkPrev->area) { - FBLinearLinkPtr p = pLinkPrev->next; - pLinkPrev->linear.size += p->linear.size; - pLinkPrev->next = p->next; - free(p); - } - } - -#ifdef DEBUG - ErrorF("FREEING LINEAR\n"); - Dump(offman->LinearAreas); -#endif -} - - -static Bool -localResizeOffscreenLinear(FBLinearPtr resize, int length) -{ - FBManagerPtr offman; - FBLinearLinkPtr pLink; - ScreenPtr pScreen = resize->pScreen; - - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - - pLink = offman->LinearAreas; - if(!pLink) return FALSE; - - while(&(pLink->linear) != resize) { - pLink = pLink->next; - if(!pLink) return FALSE; - } - - /* This could actually be alot smarter and try to move allocations - from XY to linear when available. For now if it was XY, we keep - it XY */ - - if(pLink->area) { /* really an XY area */ - BoxPtr extents; - int pitch, w, h; - - extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); - pitch = extents->x2 - extents->x1; - - if(length < pitch) { /* special case */ - w = length; - h = 1; - } else { - w = pitch; - h = (length + pitch - 1) / pitch; - } - - if(localResizeOffscreenArea(pLink->area, w, h)) { - resize->size = h * w; - resize->offset = (pitch * pLink->area->box.y1) + pLink->area->box.x1; - return TRUE; - } - } else { - /* TODO!!!! resize the linear area */ - } - - return FALSE; -} - - -static Bool -localQueryLargestOffscreenLinear( - ScreenPtr pScreen, - int *size, - int gran, - int priority -) -{ - FBManagerPtr offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - FBLinearLinkPtr pLink; - FBLinearLinkPtr pLinkRet; - - *size = 0; - - pLink = offman->LinearAreas; - - if (pLink && !pLink->area) { - pLinkRet = pLink; - while (pLink) { - if (pLink->free) { - if (pLink->linear.size > pLinkRet->linear.size) - pLinkRet = pLink; - } - pLink = pLink->next; - } - - if (pLinkRet->free) { - *size = pLinkRet->linear.size; - return TRUE; - } - } else { - int w, h; - - if(localQueryLargestOffscreenArea(pScreen, &w, &h, gran, - FAVOR_WIDTH_THEN_AREA, priority)) - { - FBManagerPtr offman; - BoxPtr extents; - - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); - if((extents->x2 - extents->x1) == w) - *size = w * h; - return TRUE; - } - } - - return FALSE; -} - - - -static FBManagerFuncs xf86FBManFuncs = { - localAllocateOffscreenArea, - localFreeOffscreenArea, - localResizeOffscreenArea, - localQueryLargestOffscreenArea, - localRegisterFreeBoxCallback, - localAllocateOffscreenLinear, - localFreeOffscreenLinear, - localResizeOffscreenLinear, - localQueryLargestOffscreenLinear, - localPurgeUnlockedOffscreenAreas - }; - - -static Bool -xf86FBCloseScreen (int i, ScreenPtr pScreen) -{ - FBLinkPtr pLink, tmp; - FBLinearLinkPtr pLinearLink, tmp2; - FBManagerPtr offman = - (FBManagerPtr) pScreen->devPrivates[xf86FBScreenIndex].ptr; - - - pScreen->CloseScreen = offman->CloseScreen; - - pLink = offman->UsedAreas; - while(pLink) { - tmp = pLink; - pLink = pLink->next; - xfree(tmp); - } - - pLinearLink = offman->LinearAreas; - while(pLinearLink) { - tmp2 = pLinearLink; - pLinearLink = pLinearLink->next; - xfree(tmp2); - } - - REGION_DESTROY(pScreen, offman->InitialBoxes); - REGION_DESTROY(pScreen, offman->FreeBoxes); - - xfree(offman->FreeBoxesUpdateCallback); - xfree(offman->devPrivates); - xfree(offman); - pScreen->devPrivates[xf86FBScreenIndex].ptr = NULL; - - return (*pScreen->CloseScreen) (i, pScreen); -} - -Bool -xf86InitFBManager( - ScreenPtr pScreen, - BoxPtr FullBox -){ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RegionRec ScreenRegion; - RegionRec FullRegion; - BoxRec ScreenBox; - Bool ret; - - ScreenBox.x1 = 0; - ScreenBox.y1 = 0; - ScreenBox.x2 = pScrn->virtualX; - ScreenBox.y2 = pScrn->virtualY; - - if((FullBox->x1 > ScreenBox.x1) || (FullBox->y1 > ScreenBox.y1) || - (FullBox->x2 < ScreenBox.x2) || (FullBox->y2 < ScreenBox.y2)) { - return FALSE; - } - - if (FullBox->y2 < FullBox->y1) return FALSE; - if (FullBox->x2 < FullBox->x2) return FALSE; - - REGION_INIT(pScreen, &ScreenRegion, &ScreenBox, 1); - REGION_INIT(pScreen, &FullRegion, FullBox, 1); - - REGION_SUBTRACT(pScreen, &FullRegion, &FullRegion, &ScreenRegion); - - ret = xf86InitFBManagerRegion(pScreen, &FullRegion); - - REGION_UNINIT(pScreen, &ScreenRegion); - REGION_UNINIT(pScreen, &FullRegion); - - return ret; -} - -Bool -xf86InitFBManagerArea( - ScreenPtr pScreen, - int PixelArea, - int Verbosity -) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - xRectangle Rect[3]; - RegionPtr pRegion, pScreenRegion; - int nRect; - Bool ret = FALSE; - - if (PixelArea < (pScrn->displayWidth * pScrn->virtualY)) - return FALSE; - - Rect[0].x = Rect[0].y = 0; - Rect[0].width = pScrn->displayWidth; - Rect[0].height = PixelArea / pScrn->displayWidth; - nRect = 1; - - /* Add a possible partial scanline */ - if ((Rect[1].height = Rect[1].width = PixelArea % pScrn->displayWidth)) { - Rect[1].x = 0; - Rect[1].y = Rect[0].height; - Rect[1].height = 1; - nRect++; - } - - /* Factor out virtual resolution */ - pRegion = RECTS_TO_REGION(pScreen, nRect, Rect, 0); - if (pRegion) { - if (!REGION_NAR(pRegion)) { - Rect[2].x = Rect[2].y = 0; - Rect[2].width = pScrn->virtualX; - Rect[2].height = pScrn->virtualY; - - pScreenRegion = RECTS_TO_REGION(pScreen, 1, &Rect[2], 0); - if (pScreenRegion) { - if (!REGION_NAR(pScreenRegion)) { - REGION_SUBTRACT(pScreen, pRegion, pRegion, pScreenRegion); - - ret = xf86InitFBManagerRegion(pScreen, pRegion); - - if (ret && xf86GetVerbosity() >= Verbosity) { - int scrnIndex = pScrn->scrnIndex; - - xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity, - "Largest offscreen areas (with overlaps):\n"); - - if (Rect[2].width < Rect[0].width) { - xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity, - "\t%d x %d rectangle at %d,0\n", - Rect[0].width - Rect[2].width, - Rect[0].height, - Rect[2].width); - } - if (Rect[2].width < Rect[1].width) { - xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity, - "\t%d x %d rectangle at %d,0\n", - Rect[1].width - Rect[2].width, - Rect[0].height + Rect[1].height, - Rect[2].width); - } - if (Rect[2].height < Rect[0].height) { - xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity, - "\t%d x %d rectangle at 0,%d\n", - Rect[0].width, - Rect[0].height - Rect[2].height, - Rect[2].height); - } - if (Rect[1].height) { - xf86DrvMsgVerb(scrnIndex, X_INFO, Verbosity, - "\t%d x %d rectangle at 0,%d\n", - Rect[1].width, - Rect[0].height - Rect[2].height + - Rect[1].height, - Rect[2].height); - } - } - } - - REGION_DESTROY(pScreen, pScreenRegion); - } - } - - REGION_DESTROY(pScreen, pRegion); - } - - return ret; -} - -Bool -xf86InitFBManagerRegion( - ScreenPtr pScreen, - RegionPtr FullRegion -){ - FBManagerPtr offman; - - if(REGION_NIL(FullRegion)) - return FALSE; - - if(xf86FBGeneration != serverGeneration) { - if((xf86FBScreenIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - xf86FBGeneration = serverGeneration; - } - - if(!xf86RegisterOffscreenManager(pScreen, &xf86FBManFuncs)) - return FALSE; - - offman = xalloc(sizeof(FBManager)); - if(!offman) return FALSE; - - pScreen->devPrivates[xf86FBScreenIndex].ptr = (pointer)offman; - - offman->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = xf86FBCloseScreen; - - offman->InitialBoxes = REGION_CREATE(pScreen, NULL, 1); - offman->FreeBoxes = REGION_CREATE(pScreen, NULL, 1); - - REGION_COPY(pScreen, offman->InitialBoxes, FullRegion); - REGION_COPY(pScreen, offman->FreeBoxes, FullRegion); - - offman->pScreen = pScreen; - offman->UsedAreas = NULL; - offman->LinearAreas = NULL; - offman->NumUsedAreas = 0; - offman->NumCallbacks = 0; - offman->FreeBoxesUpdateCallback = NULL; - offman->devPrivates = NULL; - - return TRUE; -} - -Bool -xf86InitFBManagerLinear( - ScreenPtr pScreen, - int offset, - int size -){ - FBManagerPtr offman; - FBLinearLinkPtr link; - FBLinearPtr linear; - - if (size <= 0) - return FALSE; - - /* we expect people to have called the Area setup first for pixmap cache */ - if (!pScreen->devPrivates[xf86FBScreenIndex].ptr) - return FALSE; - - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - - offman->LinearAreas = xalloc(sizeof(FBLinearLink)); - if (!offman->LinearAreas) - return FALSE; - - link = offman->LinearAreas; - link->area = NULL; - link->next = NULL; - link->free = 1; - linear = &(link->linear); - linear->pScreen = pScreen; - linear->size = size; - linear->offset = offset; - linear->granularity = 0; - linear->MoveLinearCallback = NULL; - linear->RemoveLinearCallback = NULL; - linear->devPrivate.ptr = NULL; - - return TRUE; -} - - -/* This is an implementation specific function and should - disappear after the next release. People should use the - real linear functions instead */ - -FBAreaPtr -xf86AllocateLinearOffscreenArea ( - ScreenPtr pScreen, - int length, - int gran, - MoveAreaCallbackProcPtr moveCB, - RemoveAreaCallbackProcPtr removeCB, - pointer privData -){ - FBManagerFuncsPtr funcs; - FBManagerPtr offman; - BoxPtr extents; - int w, h; - - if(xf86FBMangerIndex < 0) - return NULL; - if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr)) - return NULL; - - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - - extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); - w = extents->x2 - extents->x1; - - if(gran && ((gran > w) || (w % gran))) { - /* we can't match the specified alignment with XY allocations */ - return NULL; - } - - if(length <= w) { /* special case */ - h = 1; - w = length; - } else { - h = (length + w - 1) / w; - } - - return (*funcs->AllocateOffscreenArea)( - pScreen, w, h, gran, moveCB, removeCB, privData); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86fbman.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86fbman.h deleted file mode 100644 index adb26a1f1..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86fbman.h +++ /dev/null @@ -1,227 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.h,v 1.14 2003/10/09 12:40:54 alanh Exp $ */ - -/* - * Copyright (c) 1998-2001 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifndef _XF86FBMAN_H -#define _XF86FBMAN_H - - -#include "scrnintstr.h" -#include "regionstr.h" - - -#define FAVOR_AREA_THEN_WIDTH 0 -#define FAVOR_AREA_THEN_HEIGHT 1 -#define FAVOR_WIDTH_THEN_AREA 2 -#define FAVOR_HEIGHT_THEN_AREA 3 - -#define PRIORITY_LOW 0 -#define PRIORITY_NORMAL 1 -#define PRIORITY_EXTREME 2 - - -typedef struct _FBArea { - ScreenPtr pScreen; - BoxRec box; - int granularity; - void (*MoveAreaCallback)(struct _FBArea*, struct _FBArea*); - void (*RemoveAreaCallback)(struct _FBArea*); - DevUnion devPrivate; -} FBArea, *FBAreaPtr; - -typedef struct _FBLinear { - ScreenPtr pScreen; - int size; - int offset; - int granularity; - void (*MoveLinearCallback)(struct _FBLinear*, struct _FBLinear*); - void (*RemoveLinearCallback)(struct _FBLinear*); - DevUnion devPrivate; -} FBLinear, *FBLinearPtr; - -typedef void (*FreeBoxCallbackProcPtr)(ScreenPtr, RegionPtr, pointer); -typedef void (*MoveAreaCallbackProcPtr)(FBAreaPtr, FBAreaPtr); -typedef void (*RemoveAreaCallbackProcPtr)(FBAreaPtr); - -typedef void (*MoveLinearCallbackProcPtr)(FBLinearPtr, FBLinearPtr); -typedef void (*RemoveLinearCallbackProcPtr)(FBLinearPtr); - - -typedef struct { - FBAreaPtr (*AllocateOffscreenArea)( - ScreenPtr pScreen, - int w, int h, - int granularity, - MoveAreaCallbackProcPtr moveCB, - RemoveAreaCallbackProcPtr removeCB, - pointer privData); - void (*FreeOffscreenArea)(FBAreaPtr area); - Bool (*ResizeOffscreenArea)(FBAreaPtr area, int w, int h); - Bool (*QueryLargestOffscreenArea)( - ScreenPtr pScreen, - int *width, int *height, - int granularity, - int preferences, - int priority); - Bool (*RegisterFreeBoxCallback)( - ScreenPtr pScreen, - FreeBoxCallbackProcPtr FreeBoxCallback, - pointer devPriv); -/* linear functions */ - FBLinearPtr (*AllocateOffscreenLinear)( - ScreenPtr pScreen, - int size, - int granularity, - MoveLinearCallbackProcPtr moveCB, - RemoveLinearCallbackProcPtr removeCB, - pointer privData); - void (*FreeOffscreenLinear)(FBLinearPtr area); - Bool (*ResizeOffscreenLinear)(FBLinearPtr area, int size); - Bool (*QueryLargestOffscreenLinear)( - ScreenPtr pScreen, - int *size, - int granularity, - int priority); - Bool (*PurgeOffscreenAreas) (ScreenPtr); -} FBManagerFuncs, *FBManagerFuncsPtr; - - -Bool xf86RegisterOffscreenManager( - ScreenPtr pScreen, - FBManagerFuncsPtr funcs -); - -Bool -xf86InitFBManagerRegion( - ScreenPtr pScreen, - RegionPtr ScreenRegion -); - -Bool -xf86InitFBManagerArea( - ScreenPtr pScreen, - int PixalArea, - int Verbosity -); - -Bool -xf86InitFBManager( - ScreenPtr pScreen, - BoxPtr FullBox -); - -Bool -xf86InitFBManagerLinear( - ScreenPtr pScreen, - int offset, - int size -); - -Bool -xf86FBManagerRunning( - ScreenPtr pScreen -); - -FBAreaPtr -xf86AllocateOffscreenArea ( - ScreenPtr pScreen, - int w, int h, - int granularity, - MoveAreaCallbackProcPtr moveCB, - RemoveAreaCallbackProcPtr removeCB, - pointer privData -); - -FBAreaPtr -xf86AllocateLinearOffscreenArea ( - ScreenPtr pScreen, - int length, - int granularity, - MoveAreaCallbackProcPtr moveCB, - RemoveAreaCallbackProcPtr removeCB, - pointer privData -); - -FBLinearPtr -xf86AllocateOffscreenLinear ( - ScreenPtr pScreen, - int length, - int granularity, - MoveLinearCallbackProcPtr moveCB, - RemoveLinearCallbackProcPtr removeCB, - pointer privData -); - -void xf86FreeOffscreenArea(FBAreaPtr area); -void xf86FreeOffscreenLinear(FBLinearPtr area); - -Bool -xf86ResizeOffscreenArea( - FBAreaPtr resize, - int w, int h -); - -Bool -xf86ResizeOffscreenLinear( - FBLinearPtr resize, - int size -); - - -Bool -xf86RegisterFreeBoxCallback( - ScreenPtr pScreen, - FreeBoxCallbackProcPtr FreeBoxCallback, - pointer devPriv -); - -Bool -xf86PurgeUnlockedOffscreenAreas( - ScreenPtr pScreen -); - - -Bool -xf86QueryLargestOffscreenArea( - ScreenPtr pScreen, - int *width, int *height, - int granularity, - int preferences, - int priority -); - -Bool -xf86QueryLargestOffscreenLinear( - ScreenPtr pScreen, - int *size, - int granularity, - int priority -); - - -#endif /* _XF86FBMAN_H */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86isaBus.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86isaBus.c deleted file mode 100644 index 2cad85de8..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86isaBus.c +++ /dev/null @@ -1,142 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86isaBus.c,v 3.6 2003/08/24 17:36:55 dawes Exp $ */ -/* - * Copyright (c) 1997-2000 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - - -/* - * This file contains the interfaces to the bus-specific code - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Resources.h" - -#include "xf86Bus.h" - -#define XF86_OS_PRIVS -#define NEED_OS_RAC_PROTOS -#include "xf86_OSproc.h" - -#include "xf86RAC.h" - -Bool isaSlotClaimed = FALSE; - -/* - * If the slot requested is already in use, return FALSE. - * Otherwise, claim the slot for the screen requesting it. - */ - -int -xf86ClaimIsaSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active) -{ - EntityPtr p; - BusAccPtr pbap = xf86BusAccInfo; - int num; - - num = xf86AllocateEntity(); - p = xf86Entities[num]; - p->driver = drvp; - p->chipset = chipset; - p->busType = BUS_ISA; - p->active = active; - p->inUse = FALSE; - xf86AddDevToEntity(num, dev); - p->access = xnfcalloc(1,sizeof(EntityAccessRec)); - p->access->fallback = &AccessNULL; - p->access->pAccess = &AccessNULL; - p->busAcc = NULL; - while (pbap) { - if (pbap->type == BUS_ISA) - p->busAcc = pbap; - pbap = pbap->next; - } - isaSlotClaimed = TRUE; - return num; -} - -/* - * Get the list of ISA "slots" claimed by a screen - * - * Note: The ISA implementation here assumes that only one ISA "slot" type - * can be claimed by any one screen. That means a return value other than - * 0 or 1 isn't useful. - */ -int -xf86GetIsaInfoForScreen(int scrnIndex) -{ - int num = 0; - int i; - EntityPtr p; - - for (i = 0; i < xf86Screens[scrnIndex]->numEntities; i++) { - p = xf86Entities[xf86Screens[scrnIndex]->entityList[i]]; - if (p->busType == BUS_ISA) { - num++; - } - } - return num; -} - -/* - * Parse a BUS ID string, and return True if it is a ISA bus id. - */ - -Bool -xf86ParseIsaBusString(const char *busID) -{ - /* - * The format assumed to be "isa" or "isa:" - */ - return (StringToBusType(busID,NULL) == BUS_ISA); -} - - -/* - * xf86IsPrimaryIsa() -- return TRUE if primary device - * is ISA. - */ - -Bool -xf86IsPrimaryIsa(void) -{ - return ( primaryBus.type == BUS_ISA ); -} - -void -isaConvertRange2Host(resRange *pRange) -{ - return; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86noBus.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86noBus.c deleted file mode 100644 index 09f2f4407..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86noBus.c +++ /dev/null @@ -1,75 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86noBus.c,v 1.2 2003/08/24 17:36:55 dawes Exp $ */ - -/* - * Copyright (c) 2000-2002 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * This file contains the interfaces to the bus-specific code - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Resources.h" - -#include "xf86Bus.h" - -#define XF86_OS_PRIVS -#define NEED_OS_RAC_PROTOS -#include "xf86_OSproc.h" - -#include "xf86RAC.h" - -int -xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active) -{ - EntityPtr p; - int num; - - num = xf86AllocateEntity(); - p = xf86Entities[num]; - p->driver = drvp; - p->chipset = 0; - p->busType = BUS_NONE; - p->active = active; - p->inUse = FALSE; - xf86AddDevToEntity(num, dev); - p->access = xnfcalloc(1,sizeof(EntityAccessRec)); - p->access->fallback = &AccessNULL; - p->access->pAccess = &AccessNULL; - p->busAcc = NULL; - - return num; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86pciBus.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86pciBus.c deleted file mode 100644 index 8fa199872..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86pciBus.c +++ /dev/null @@ -1,3506 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.77 2003/11/03 05:11:03 tsi Exp $ */ -/* - * Copyright (c) 1997-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * This file contains the interfaces to the bus-specific code - */ -#define INCLUDE_DEPRECATED 1 - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include "os.h" -#include "Pci.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Resources.h" - -/* Bus-specific headers */ -#include "xf86PciData.h" - -#include "xf86Bus.h" - -#define XF86_OS_PRIVS -#define NEED_OS_RAC_PROTOS -#include "xf86_OSproc.h" - -#include "xf86RAC.h" - -/* Bus-specific globals */ -Bool pciSlotClaimed = FALSE; -pciConfigPtr *xf86PciInfo = NULL; /* Full PCI probe info */ -pciVideoPtr *xf86PciVideoInfo = NULL; /* PCI probe for video hw */ -pciAccPtr * xf86PciAccInfo = NULL; /* PCI access related */ - -/* pcidata globals */ -ScanPciSetupProcPtr xf86SetupPciIds = NULL; -ScanPciCloseProcPtr xf86ClosePciIds = NULL; -ScanPciFindByDeviceProcPtr xf86FindPciNamesByDevice = NULL; -ScanPciFindBySubsysProcPtr xf86FindPciNamesBySubsys = NULL; -ScanPciFindClassBySubsysProcPtr xf86FindPciClassBySubsys = NULL; -ScanPciFindClassByDeviceProcPtr xf86FindPciClassByDevice = NULL; - -static resPtr pciAvoidRes = NULL; - -/* PCI buses */ -static PciBusPtr xf86PciBus = NULL; -/* Bus-specific probe/sorting functions */ - -/* PCI classes that get included in xf86PciVideoInfo */ -#define PCIINFOCLASSES(b,s) \ - (((b) == PCI_CLASS_PREHISTORIC) || \ - ((b) == PCI_CLASS_DISPLAY) || \ - ((b) == PCI_CLASS_MULTIMEDIA && (s) == PCI_SUBCLASS_MULTIMEDIA_VIDEO) || \ - ((b) == PCI_CLASS_PROCESSOR && (s) == PCI_SUBCLASS_PROCESSOR_COPROC)) - -/* - * PCI classes that have messages printed always. The others are only - * have a message printed when the vendor/dev IDs are recognised. - */ -#define PCIALWAYSPRINTCLASSES(b,s) \ - (((b) == PCI_CLASS_PREHISTORIC && (s) == PCI_SUBCLASS_PREHISTORIC_VGA) || \ - ((b) == PCI_CLASS_DISPLAY) || \ - ((b) == PCI_CLASS_MULTIMEDIA && (s) == PCI_SUBCLASS_MULTIMEDIA_VIDEO)) - -/* - * PCI classes for which potentially destructive checking of the map sizes - * may be done. Any classes where this may be unsafe should be omitted - * from this list. - */ -#define PCINONSYSTEMCLASSES(b,s) PCIALWAYSPRINTCLASSES(b,s) - -/* - * PCI classes that use RAC - */ -#define PCISHAREDIOCLASSES(b,s) \ - (((b) == PCI_CLASS_PREHISTORIC && (s) == PCI_SUBCLASS_PREHISTORIC_VGA) || \ - ((b) == PCI_CLASS_DISPLAY && (s) == PCI_SUBCLASS_DISPLAY_VGA)) - -#define PCI_MEM32_LENGTH_MAX 0xFFFFFFFF - -#define B2M(tag,base) pciBusAddrToHostAddr(tag,PCI_MEM,base) -#define B2I(tag,base) pciBusAddrToHostAddr(tag,PCI_IO,base) -#define B2H(tag,base,type) (((type & ResPhysMask) == ResMem) ? \ - B2M(tag, base) : B2I(tag, base)) -#define M2B(tag,base) pciHostAddrToBusAddr(tag,PCI_MEM,base) -#define I2B(tag,base) pciHostAddrToBusAddr(tag,PCI_IO,base) -#define H2B(tag,base,type) (((type & ResPhysMask) == ResMem) ? \ - M2B(tag, base) : I2B(tag, base)) -#define TAG(pvp) (pciTag(pvp->bus,pvp->device,pvp->func)) -#define SIZE(size) ((1 << size) - 1) -#define PCI_SIZE(type,tag,size) (((type & ResPhysMask) == ResMem) \ - ? pciBusAddrToHostAddr(tag,PCI_MEM_SIZE,size) \ - : pciBusAddrToHostAddr(tag,PCI_IO_SIZE,size)) -#define PCI_M_RANGE(range,tag,begin,end,type) \ - { \ - RANGE(range, B2M(tag, begin), B2M(tag, end), \ - RANGE_TYPE(type, xf86GetPciDomain(tag))); \ - } -#define PCI_I_RANGE(range,tag,begin,end,type) \ - { \ - RANGE(range, B2I(tag, begin), B2I(tag, end), \ - RANGE_TYPE(type, xf86GetPciDomain(tag))); \ - } -#define PCI_X_RANGE(range,tag,begin,end,type) \ -{ if ((type & ResPhysMask) == ResMem) PCI_M_RANGE(range,tag,begin,end,type); \ - else PCI_I_RANGE(range,tag,begin,end,type); } -#define P_M_RANGE(range,tag,begin,size,type) \ - PCI_M_RANGE(range,tag,begin,(begin + SIZE(size)),type) -#define P_I_RANGE(range,tag,begin,size,type) \ - PCI_I_RANGE(range,tag,begin,(begin + SIZE(size)),type) -#define P_X_RANGE(range,tag,begin,size,type) \ -{ if ((type & ResPhysMask) == ResMem) P_M_RANGE(range,tag,begin,size,type); \ - else P_I_RANGE(range,tag,begin,size,type); } -#define PV_M_RANGE(range,pvp,i,type) \ - P_M_RANGE(range,TAG(pvp),pvp->memBase[i],pvp->size[i],type) -#define PV_B_RANGE(range,pvp,type) \ - P_M_RANGE(range,TAG(pvp),pvp->biosBase,pvp->biosSize,type) -#define PV_I_RANGE(range,pvp,i,type) \ - P_I_RANGE(range,TAG(pvp),pvp->ioBase[i],pvp->size[i],type) - -static void getPciClassFlags(pciConfigPtr *pcrpp); -static void pciConvertListToHost(int bus, int dev, int func, resPtr list); -static PciBusPtr xf86GetPciBridgeInfo(void); - -void -xf86FormatPciBusNumber(int busnum, char *buffer) -{ - /* 'buffer' should be at least 8 characters long */ - if (busnum < 256) - sprintf(buffer, "%d", busnum); - else - sprintf(buffer, "%d@%d", busnum & 0x00ff, busnum >> 8); -} - -static Bool -IsBaseUnassigned(CARD32 base) -{ - CARD32 mask; - - if (base & PCI_MAP_IO) - mask = ~PCI_MAP_IO_ATTR_MASK; - else - mask = ~PCI_MAP_MEMORY_ATTR_MASK; - - base &= mask; - return (!base || (base == mask)); -} - -static Bool -IsBaseUnassigned64(CARD32 base0, CARD32 base1) -{ - base0 &= ~PCI_MAP_MEMORY_ATTR_MASK; - base1 &= 0xffffffff; - - return ((!base0 && !base1) - || ((base0 == ~PCI_MAP_MEMORY_ATTR_MASK) - && (base1 == 0xffffffff))); -} - -static void -FindPCIVideoInfo(void) -{ - pciConfigPtr pcrp, *pcrpp; - int i = 0, j, k; - int num = 0; - pciVideoPtr info; - int DoIsolateDeviceCheck = 0; - - if (xf86IsolateDevice.bus || xf86IsolateDevice.device || xf86IsolateDevice.func) - DoIsolateDeviceCheck = 1; - pcrpp = xf86PciInfo = xf86scanpci(0); - getPciClassFlags(pcrpp); - - if (pcrpp == NULL) { - xf86PciVideoInfo = NULL; - return; - } - xf86PciBus = xf86GetPciBridgeInfo(); - - while ((pcrp = pcrpp[i])) { - int baseclass; - int subclass; - - if (pcrp->listed_class & 0xffff) { - baseclass = (pcrp->listed_class >> 8) & 0xff; - subclass = pcrp->listed_class & 0xff; - } else { - baseclass = pcrp->pci_base_class; - subclass = pcrp->pci_sub_class; - } - - if (PCIINFOCLASSES(baseclass, subclass) && - (DoIsolateDeviceCheck ? - (xf86IsolateDevice.bus == pcrp->busnum && - xf86IsolateDevice.device == pcrp->devnum && - xf86IsolateDevice.func == pcrp->funcnum) : 1)) { - num++; - xf86PciVideoInfo = xnfrealloc(xf86PciVideoInfo, - sizeof(pciVideoPtr) * (num + 1)); - xf86PciVideoInfo[num] = NULL; - info = xf86PciVideoInfo[num - 1] = xnfalloc(sizeof(pciVideoRec)); - info->validSize = FALSE; - info->vendor = pcrp->pci_vendor; - info->chipType = pcrp->pci_device; - info->chipRev = pcrp->pci_rev_id; - info->subsysVendor = pcrp->pci_subsys_vendor; - info->subsysCard = pcrp->pci_subsys_card; - info->bus = pcrp->busnum; - info->device = pcrp->devnum; - info->func = pcrp->funcnum; - info->class = baseclass; - info->subclass = pcrp->pci_sub_class; - info->interface = pcrp->pci_prog_if; - info->biosBase = PCIGETROM(pcrp->pci_baserom); - info->biosSize = pciGetBaseSize(pcrp->tag, 6, TRUE, NULL); - info->thisCard = pcrp; - info->validate = FALSE; -#ifdef INCLUDE_XF86_NO_DOMAIN - if ((PCISHAREDIOCLASSES(baseclass, subclass)) - && (pcrp->pci_command & PCI_CMD_IO_ENABLE) && - (pcrp->pci_prog_if == 0)) { - - /* - * Attempt to ensure that VGA is actually routed to this - * adapter on entry. This needs to be fixed when we finally - * grok host bridges (and multiple bus trees). - */ - j = info->bus; - while (TRUE) { - PciBusPtr pBus = xf86PciBus; - while (pBus && j != pBus->secondary) - pBus = pBus->next; - if (!pBus || !(pBus->brcontrol & PCI_PCI_BRIDGE_VGA_EN)) - break; - if (j == pBus->primary) { - if (primaryBus.type == BUS_NONE) { - /* assumption: primary adapter is always VGA */ - primaryBus.type = BUS_PCI; - primaryBus.id.pci.bus = pcrp->busnum; - primaryBus.id.pci.device = pcrp->devnum; - primaryBus.id.pci.func = pcrp->funcnum; - } else if (primaryBus.type < BUS_last) { - xf86Msg(X_NOTICE, - "More than one primary device found\n"); - primaryBus.type ^= (BusType)(-1); - } - break; - } - j = pBus->primary; - } - } -#endif - - for (j = 0; j < 6; j++) { - info->memBase[j] = 0; - info->ioBase[j] = 0; - if (PCINONSYSTEMCLASSES(baseclass, subclass)) { - info->size[j] = - pciGetBaseSize(pcrp->tag, j, TRUE, &info->validSize); - pcrp->minBasesize = info->validSize; - } else { - info->size[j] = pcrp->basesize[j]; - info->validSize = pcrp->minBasesize; - } - info->type[j] = 0; - } - - if (PCINONSYSTEMCLASSES(baseclass, subclass)) { - /* - * Check of a PCI base is unassigned. If so - * attempt to fix it. Validation will determine - * if the value was correct later on. - */ - CARD32 *base = &pcrp->pci_base0; - - for (j = 0; j < 6; j++) { - if (!PCI_MAP_IS64BITMEM(base[j])) { - if (info->size[j] && IsBaseUnassigned(base[j])) - base[j] = pciCheckForBrokenBase(pcrp->tag, j); - } else { - if (j == 5) /* bail out */ - break; - if (info->size[j] - && IsBaseUnassigned64(base[j],base[j+1])) { - base[j] = pciCheckForBrokenBase(pcrp->tag, j); - j++; - base[j] = pciCheckForBrokenBase(pcrp->tag, j); - } - } - } - } - - /* - * 64-bit base addresses are checked for and avoided on 32-bit - * platforms. - */ - for (j = 0; j < 6; ++j) { - CARD32 bar = (&pcrp->pci_base0)[j]; - - if (bar != 0) { - if (bar & PCI_MAP_IO) { - info->ioBase[j] = (memType)PCIGETIO(bar); - info->type[j] = bar & PCI_MAP_IO_ATTR_MASK; - } else { - info->type[j] = bar & PCI_MAP_MEMORY_ATTR_MASK; - info->memBase[j] = (memType)PCIGETMEMORY(bar); - if (PCI_MAP_IS64BITMEM(bar)) { - if (j == 5) { - xf86MsgVerb(X_WARNING, 0, - "****BAR5 specified as 64-bit wide, " - "which is not possible. " - "Ignoring BAR5.****\n"); - info->memBase[j] = 0; - } else { - CARD32 bar_hi = PCIGETMEMORY64HIGH((&pcrp->pci_base0)[j]); -#if defined(LONG64) || defined(WORD64) - /* 64 bit architecture */ - info->memBase[j] |= - (memType)bar_hi << 32; -#else - if (bar_hi != 0) - info->memBase[j] = 0; -#endif - ++j; /* Step over the next BAR */ - } - } - } - } - } - info->listed_class = pcrp->listed_class; - } - i++; - } - - /* If we haven't found a primary device try a different heuristic */ - if (primaryBus.type == BUS_NONE && num) { - for (i = 0; i < num; i++) { - info = xf86PciVideoInfo[i]; - pcrp = info->thisCard; - - if ((pcrp->pci_command & PCI_CMD_MEM_ENABLE) && - (num == 1 || - ((info->class == PCI_CLASS_DISPLAY) && - (info->subclass == PCI_SUBCLASS_DISPLAY_VGA)))) { - if (primaryBus.type == BUS_NONE) { - primaryBus.type = BUS_PCI; - primaryBus.id.pci.bus = pcrp->busnum; - primaryBus.id.pci.device = pcrp->devnum; - primaryBus.id.pci.func = pcrp->funcnum; - } else { - xf86Msg(X_NOTICE, - "More than one possible primary device found\n"); - primaryBus.type ^= (BusType)(-1); - } - } - } - } - - /* Print a summary of the video devices found */ - for (k = 0; k < num; k++) { - const char *vendorname = NULL, *chipname = NULL; - const char *prim = " "; - char busnum[8]; - Bool memdone = FALSE, iodone = FALSE; - - i = 0; - info = xf86PciVideoInfo[k]; - xf86FormatPciBusNumber(info->bus, busnum); - xf86FindPciNamesByDevice(info->vendor, info->chipType, - NOVENDOR, NOSUBSYS, - &vendorname, &chipname, NULL, NULL); - if ((!vendorname || !chipname) && - !PCIALWAYSPRINTCLASSES(info->class, info->subclass)) - continue; - if (xf86IsPrimaryPci(info)) - prim = "*"; - - xf86Msg(X_PROBED, "PCI:%s(%s:%d:%d) ", prim, busnum, info->device, - info->func); - if (vendorname) - xf86ErrorF("%s ", vendorname); - else - xf86ErrorF("unknown vendor (0x%04x) ", info->vendor); - if (chipname) - xf86ErrorF("%s ", chipname); - else - xf86ErrorF("unknown chipset (0x%04x) ", info->chipType); - xf86ErrorF("rev %d", info->chipRev); - for (i = 0; i < 6; i++) { - if (info->memBase[i] && - (info->memBase[i] < (memType)(-1 << info->size[i]))) { - if (!memdone) { - xf86ErrorF(", Mem @ "); - memdone = TRUE; - } else - xf86ErrorF(", "); - xf86ErrorF("0x%08lx/%d", info->memBase[i], info->size[i]); - } - } - for (i = 0; i < 6; i++) { - if (info->ioBase[i] && - (info->ioBase[i] < (memType)(-1 << info->size[i]))) { - if (!iodone) { - xf86ErrorF(", I/O @ "); - iodone = TRUE; - } else - xf86ErrorF(", "); - xf86ErrorF("0x%04lx/%d", info->ioBase[i], info->size[i]); - } - } - if (info->biosBase && - (info->biosBase < (memType)(-1 << info->biosSize))) - xf86ErrorF(", BIOS @ 0x%08lx/%d", info->biosBase, info->biosSize); - xf86ErrorF("\n"); - } -} - -/* - * fixPciSizeInfo() -- fix pci size info by testing it destructively - * (if not already done), fix pciVideoInfo and entry in the resource - * list. - */ -/* - * Note: once we have OS support to read the sizes GetBaseSize() will - * have to be wrapped by the OS layer. fixPciSizeInfo() should also - * be wrapped by the OS layer to do nothing if the size is always - * returned correctly by GetBaseSize(). It should however set validate - * in pciVideoRec if validation is required. ValidatePci() also needs - * to be wrapped by the OS layer. This may do nothing if the OS has - * already taken care of validation. fixPciResource() may be moved to - * OS layer with minimal changes. Once the wrapping layer is in place - * the common level and drivers should not reference these functions - * directly but thru the OS layer. - */ - -static void -fixPciSizeInfo(int entityIndex) -{ - pciVideoPtr pvp; - resPtr pAcc; - PCITAG tag; - int j; - - if (! (pvp = xf86GetPciInfoForEntity(entityIndex))) return; - if (pvp->validSize) return; - - tag = pciTag(pvp->bus,pvp->device,pvp->func); - - for (j = 0; j < 6; j++) { - pAcc = Acc; - if (pvp->memBase[j]) - while (pAcc) { - if (((pAcc->res_type & (ResPhysMask | ResBlock)) - == (ResMem | ResBlock)) - && (pAcc->block_begin == B2M(TAG(pvp),pvp->memBase[j])) - && (pAcc->block_end == B2M(TAG(pvp),pvp->memBase[j] - + SIZE(pvp->size[j])))) break; - pAcc = pAcc->next; - } - else if (pvp->ioBase[j]) - while (pAcc) { - if (((pAcc->res_type & (ResPhysMask | ResBlock)) == - (ResIo | ResBlock)) - && (pAcc->block_begin == B2I(TAG(pvp),pvp->ioBase[j])) - && (pAcc->block_end == B2I(TAG(pvp),pvp->ioBase[j] - + SIZE(pvp->size[j])))) break; - pAcc = pAcc->next; - } - else continue; - pvp->size[j] = pciGetBaseSize(tag, j, TRUE, &pvp->validSize); - if (pAcc) { - pAcc->block_end = pvp->memBase[j] ? - B2M(TAG(pvp),pvp->memBase[j] + SIZE(pvp->size[j])) - : B2I(TAG(pvp),pvp->ioBase[j] + SIZE(pvp->size[j])); - pAcc->res_type &= ~ResEstimated; - pAcc->res_type |= ResBios; - } - } - if (pvp->biosBase) { - pAcc = Acc; - while (pAcc) { - if (((pAcc->res_type & (ResPhysMask | ResBlock)) == - (ResMem | ResBlock)) - && (pAcc->block_begin == B2M(TAG(pvp),pvp->biosBase)) - && (pAcc->block_end == B2M(TAG(pvp),pvp->biosBase - + SIZE(pvp->biosSize)))) break; - pAcc = pAcc->next; - } - pvp->biosSize = pciGetBaseSize(tag, 6, TRUE, &pvp->validSize); - if (pAcc) { - pAcc->block_end = B2M(TAG(pvp),pvp->biosBase+SIZE(pvp->biosSize)); - pAcc->res_type &= ~ResEstimated; - pAcc->res_type |= ResBios; - } - } -} - -/* - * IO enable/disable related routines for PCI - */ -#define pArg ((pciArg*)arg) -#define SETBITS PCI_CMD_IO_ENABLE -static void -pciIoAccessEnable(void* arg) -{ -#ifdef DEBUG - ErrorF("pciIoAccessEnable: 0x%05lx\n", *(PCITAG *)arg); -#endif - pArg->ctrl |= SETBITS | PCI_CMD_MASTER_ENABLE; - pciWriteLong(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); -} - -static void -pciIoAccessDisable(void* arg) -{ -#ifdef DEBUG - ErrorF("pciIoAccessDisable: 0x%05lx\n", *(PCITAG *)arg); -#endif - pArg->ctrl &= ~SETBITS; - pciWriteLong(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); -} - -#undef SETBITS -#define SETBITS (PCI_CMD_IO_ENABLE | PCI_CMD_MEM_ENABLE) -static void -pciIo_MemAccessEnable(void* arg) -{ -#ifdef DEBUG - ErrorF("pciIo_MemAccessEnable: 0x%05lx\n", *(PCITAG *)arg); -#endif - pArg->ctrl |= SETBITS | PCI_CMD_MASTER_ENABLE; - pciWriteLong(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); -} - -static void -pciIo_MemAccessDisable(void* arg) -{ -#ifdef DEBUG - ErrorF("pciIo_MemAccessDisable: 0x%05lx\n", *(PCITAG *)arg); -#endif - pArg->ctrl &= ~SETBITS; - pciWriteLong(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); -} - -#undef SETBITS -#define SETBITS (PCI_CMD_MEM_ENABLE) -static void -pciMemAccessEnable(void* arg) -{ -#ifdef DEBUG - ErrorF("pciMemAccessEnable: 0x%05lx\n", *(PCITAG *)arg); -#endif - pArg->ctrl |= SETBITS | PCI_CMD_MASTER_ENABLE; - pciWriteLong(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); -} - -static void -pciMemAccessDisable(void* arg) -{ -#ifdef DEBUG - ErrorF("pciMemAccessDisable: 0x%05lx\n", *(PCITAG *)arg); -#endif - pArg->ctrl &= ~SETBITS; - pciWriteLong(pArg->tag, PCI_CMD_STAT_REG, pArg->ctrl); -} -#undef SETBITS -#undef pArg - - -/* move to OS layer */ -#define MASKBITS (PCI_PCI_BRIDGE_VGA_EN | PCI_PCI_BRIDGE_MASTER_ABORT_EN) -static void -pciBusAccessEnable(BusAccPtr ptr) -{ - PCITAG tag = ptr->busdep.pci.acc; - CARD16 ctrl; - -#ifdef DEBUG - ErrorF("pciBusAccessEnable: bus=%d\n", ptr->busdep.pci.bus); -#endif - ctrl = pciReadWord(tag, PCI_PCI_BRIDGE_CONTROL_REG); - if ((ctrl & MASKBITS) != PCI_PCI_BRIDGE_VGA_EN) { - ctrl = (ctrl | PCI_PCI_BRIDGE_VGA_EN) & - ~(PCI_PCI_BRIDGE_MASTER_ABORT_EN | PCI_PCI_BRIDGE_SECONDARY_RESET); - pciWriteWord(tag, PCI_PCI_BRIDGE_CONTROL_REG, ctrl); - } -} - -/* move to OS layer */ -static void -pciBusAccessDisable(BusAccPtr ptr) -{ - PCITAG tag = ptr->busdep.pci.acc; - CARD16 ctrl; - -#ifdef DEBUG - ErrorF("pciBusAccessDisable: bus=%d\n", ptr->busdep.pci.bus); -#endif - ctrl = pciReadWord(tag, PCI_PCI_BRIDGE_CONTROL_REG); - if (ctrl & MASKBITS) { - ctrl &= ~(MASKBITS | PCI_PCI_BRIDGE_SECONDARY_RESET); - pciWriteWord(tag, PCI_PCI_BRIDGE_CONTROL_REG, ctrl); - } -} -#undef MASKBITS - -/* move to OS layer */ -static void -pciDrvBusAccessEnable(BusAccPtr ptr) -{ - int bus = ptr->busdep.pci.bus; - -#ifdef DEBUG - ErrorF("pciDrvBusAccessEnable: bus=%d\n", bus); -#endif - (*pciBusInfo[bus]->funcs->pciControlBridge)(bus, - PCI_PCI_BRIDGE_VGA_EN, - PCI_PCI_BRIDGE_VGA_EN); -} - -/* move to OS layer */ -static void -pciDrvBusAccessDisable(BusAccPtr ptr) -{ - int bus = ptr->busdep.pci.bus; - -#ifdef DEBUG - ErrorF("pciDrvBusAccessDisable: bus=%d\n", bus); -#endif - (*pciBusInfo[bus]->funcs->pciControlBridge)(bus, - PCI_PCI_BRIDGE_VGA_EN, 0); -} - - -static void -pciSetBusAccess(BusAccPtr ptr) -{ -#ifdef DEBUG - ErrorF("pciSetBusAccess: route VGA to bus %d\n", ptr->busdep.pci.bus); -#endif - - if (!ptr->primary && !ptr->current) - return; - - if (ptr->current && ptr->current->disable_f) - (*ptr->current->disable_f)(ptr->current); - ptr->current = NULL; - - /* walk down */ - while (ptr->primary) { /* No enable for root bus */ - if (ptr != ptr->primary->current) { - if (ptr->primary->current && ptr->primary->current->disable_f) - (*ptr->primary->current->disable_f)(ptr->primary->current); - if (ptr->enable_f) - (*ptr->enable_f)(ptr); - ptr->primary->current = ptr; - } - ptr = ptr->primary; - } -} - -/* move to OS layer */ -static void -savePciState(PCITAG tag, pciSavePtr ptr) -{ - int i; - - ptr->command = pciReadLong(tag, PCI_CMD_STAT_REG); - for (i=0; i < 6; i++) - ptr->base[i] = pciReadLong(tag, PCI_CMD_BASE_REG + i*4); - ptr->biosBase = pciReadLong(tag, PCI_CMD_BIOS_REG); -} - -/* move to OS layer */ -static void -restorePciState(PCITAG tag, pciSavePtr ptr) -{ - int i; - - /* disable card before setting anything */ - pciSetBitsLong(tag, PCI_CMD_STAT_REG, - PCI_CMD_MEM_ENABLE | PCI_CMD_IO_ENABLE , 0); - pciWriteLong(tag,PCI_CMD_BIOS_REG, ptr->biosBase); - for (i=0; i<6; i++) - pciWriteLong(tag, PCI_CMD_BASE_REG + i*4, ptr->base[i]); - pciWriteLong(tag, PCI_CMD_STAT_REG, ptr->command); -} - -/* move to OS layer */ -static void -savePciBusState(BusAccPtr ptr) -{ - PCITAG tag = ptr->busdep.pci.acc; - - ptr->busdep.pci.save.control = - pciReadWord(tag, PCI_PCI_BRIDGE_CONTROL_REG) & - ~PCI_PCI_BRIDGE_SECONDARY_RESET; - /* Allow master aborts to complete normally on non-root buses */ - if (ptr->busdep.pci.save.control & PCI_PCI_BRIDGE_MASTER_ABORT_EN) - pciWriteWord(tag, PCI_PCI_BRIDGE_CONTROL_REG, - ptr->busdep.pci.save.control & ~PCI_PCI_BRIDGE_MASTER_ABORT_EN); -} - -/* move to OS layer */ -#define MASKBITS (PCI_PCI_BRIDGE_VGA_EN | PCI_PCI_BRIDGE_MASTER_ABORT_EN) -static void -restorePciBusState(BusAccPtr ptr) -{ - PCITAG tag = ptr->busdep.pci.acc; - CARD16 ctrl; - - /* Only restore the bits we've changed (and don't cause resets) */ - ctrl = pciReadWord(tag, PCI_PCI_BRIDGE_CONTROL_REG); - if ((ctrl ^ ptr->busdep.pci.save.control) & MASKBITS) { - ctrl &= ~(MASKBITS | PCI_PCI_BRIDGE_SECONDARY_RESET); - ctrl |= ptr->busdep.pci.save.control & MASKBITS; - pciWriteWord(tag, PCI_PCI_BRIDGE_CONTROL_REG, ctrl); - } -} -#undef MASKBITS - -/* move to OS layer */ -static void -savePciDrvBusState(BusAccPtr ptr) -{ - int bus = ptr->busdep.pci.bus; - - ptr->busdep.pci.save.control = - (*pciBusInfo[bus]->funcs->pciControlBridge)(bus, 0, 0); - /* Allow master aborts to complete normally on this bus */ - (*pciBusInfo[bus]->funcs->pciControlBridge)(bus, - PCI_PCI_BRIDGE_MASTER_ABORT_EN, - 0); -} - -/* move to OS layer */ -static void -restorePciDrvBusState(BusAccPtr ptr) -{ - int bus = ptr->busdep.pci.bus; - - (*pciBusInfo[bus]->funcs->pciControlBridge)(bus, (CARD16)(-1), - ptr->busdep.pci.save.control); -} - - -static void -disablePciBios(PCITAG tag) -{ - pciSetBitsLong(tag, PCI_CMD_BIOS_REG, PCI_CMD_BIOS_ENABLE, 0); -} - -/* ????? */ -static void -correctPciSize(memType base, memType oldsize, memType newsize, - unsigned long type) -{ - pciConfigPtr pcrp, *pcrpp; - pciVideoPtr pvp, *pvpp; - CARD32 *basep; - int i; - int old_bits = 0, new_bits = 0; - - if (oldsize + 1) while (oldsize & 1) { - old_bits ++; - oldsize >>= 1; - } - if (newsize + 1) while (newsize & 1) { - new_bits ++; - newsize >>= 1; - } - - for (pcrpp = xf86PciInfo, pcrp = *pcrpp; pcrp; pcrp = *++(pcrpp)) { - - /* Only process devices with type 0 headers */ - if ((pcrp->pci_header_type & 0x7f) != 0) - continue; - - basep = &pcrp->pci_base0; - for (i = 0; i < 6; i++) { - if (basep[i] && (pcrp->basesize[i] == old_bits)) { - if ((((type & ResPhysMask) == ResIo) && - PCI_MAP_IS_IO(basep[i]) && - B2I(pcrp->tag,PCIGETIO(basep[i]) == base)) || - (((type & ResPhysMask) == ResMem) && - PCI_MAP_IS_MEM(basep[i]) && - (((!PCI_MAP_IS64BITMEM(basep[i])) && - (B2M(pcrp->tag,PCIGETMEMORY(basep[i])) == base)) -#if defined(LONG64) || defined(WORD64) - || - (B2M(pcrp->tag,PCIGETMEMORY64(basep[i])) == base) -#else - || - (!basep[i+1] - && (B2M(pcrp->tag,PCIGETMEMORY(basep[i])) == base)) -#endif - ))) { - pcrp->basesize[i] = new_bits; - break; /* to next device */ - } - } - if (PCI_MAP_IS64BITMEM(basep[i])) i++; - } - } - - if (xf86PciVideoInfo) { - for (pvpp = xf86PciVideoInfo, pvp = *pvpp; pvp; pvp = *(++pvpp)) { - - for (i = 0; i < 6; i++) { - if (pvp->size[i] == old_bits) { - if ((((type & ResPhysMask) == ResIo) && pvp->ioBase[i] - && (B2I(TAG(pvp),pvp->ioBase[i]) == base)) || - (((type & ResPhysMask) == ResMem) && pvp->memBase[i] - && (B2M(TAG(pvp),pvp->memBase[i]) == base))) { - pvp->size[i] = new_bits; - break; /* to next device */ - } - } - } - } - } -} - -/* ????? */ -static void -removeOverlapsWithBridges(int busIndex, resPtr target) -{ - PciBusPtr pbp; - resPtr tmp,bridgeRes = NULL; - resRange range; - - if (!target) - return; - - if (!ResCanOverlap(&target->val)) - return; - - range = target->val; - - for (pbp=xf86PciBus; pbp; pbp = pbp->next) { - if (pbp->primary == busIndex) { - tmp = xf86DupResList(pbp->preferred_io); - bridgeRes = xf86JoinResLists(tmp,bridgeRes); - tmp = xf86DupResList(pbp->preferred_mem); - bridgeRes = xf86JoinResLists(tmp,bridgeRes); - tmp = xf86DupResList(pbp->preferred_pmem); - bridgeRes = xf86JoinResLists(tmp,bridgeRes); - } - } - - RemoveOverlaps(target, bridgeRes, TRUE, TRUE); - if (range.rEnd > target->block_end) { - correctPciSize(range.rBegin, range.rEnd - range.rBegin, - target->block_end - target->block_begin, - target->res_type); - xf86MsgVerb(X_INFO, 3, - "PCI %s resource overlap reduced 0x%08lx from 0x%08lx to 0x%08lx\n", - ((target->res_type & ResPhysMask) == ResMem) ? "Memory" : "I/O", - range.rBegin, range.rEnd, target->block_end); - } - xf86FreeResList(bridgeRes); -} - -/* ????? */ -static void -xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes) -{ - pciConfigPtr pcrp, *pcrpp; - pciVideoPtr pvp, *pvpp; - CARD32 *basep; - int i; - resPtr pRes, tmp; - resRange range; - long resMisc; - - if (activeRes) - *activeRes = NULL; - if (inactiveRes) - *inactiveRes = NULL; - - if (!activeRes || !inactiveRes || !xf86PciInfo) - return; - - if (xf86PciVideoInfo) - for (pvpp = xf86PciVideoInfo, pvp = *pvpp; pvp; pvp = *(++pvpp)) { - resPtr *res; - - if (PCINONSYSTEMCLASSES(pvp->class, pvp->subclass)) - resMisc = ResBios; - else - resMisc = 0; - - if (((pciConfigPtr)pvp->thisCard)->pci_command - & (PCI_CMD_IO_ENABLE | PCI_CMD_MEM_ENABLE)) - res = activeRes; - else - res = inactiveRes; - - if (!pvp->validSize) - resMisc |= ResEstimated; - - for (i = 0; i < 6; i++) { - if (pvp->ioBase[i] && - (pvp->ioBase[i] < (memType)(-1 << pvp->size[i]))) { - PV_I_RANGE(range,pvp,i,ResExcIoBlock | resMisc); - tmp = xf86AddResToList(NULL, &range, -1); - removeOverlapsWithBridges(pvp->bus,tmp); - *res = xf86JoinResLists(tmp,*res); - } else if (pvp->memBase[i] && - (pvp->memBase[i] < (memType)(-1 << pvp->size[i]))) { - PV_M_RANGE(range, pvp,i, ResExcMemBlock | resMisc); - tmp = xf86AddResToList(NULL, &range, -1); - removeOverlapsWithBridges(pvp->bus,tmp); - *res = xf86JoinResLists(tmp,*res); - } - } - /* FIXME!!!: Don't use BIOS resources for overlap - * checking but reserve them! - */ - if (pvp->biosBase && - (pvp->biosBase < (memType)(-1 << pvp->biosSize))) { - PV_B_RANGE(range, pvp, ResExcMemBlock | resMisc); - tmp = xf86AddResToList(NULL, &range, -1); - removeOverlapsWithBridges(pvp->bus,tmp); - *res = xf86JoinResLists(tmp,*res); - } - } - - for (pcrpp = xf86PciInfo, pcrp = *pcrpp; pcrp; pcrp = *++(pcrpp)) { - resPtr *res; - CARD8 baseclass, subclass; - - if (pcrp->listed_class & 0x0ffff) { - baseclass = pcrp->listed_class >> 8; - subclass = pcrp->listed_class; - } else { - baseclass = pcrp->pci_base_class; - subclass = pcrp->pci_sub_class; - } - - if (PCIINFOCLASSES(baseclass, subclass)) - continue; - - /* Only process devices with type 0 headers */ - if ((pcrp->pci_header_type & 0x7f) != 0) - continue; - - if (!pcrp->minBasesize) - resMisc = ResEstimated; - else - resMisc = 0; - - /* - * Allow resources allocated to host bridges to overlap. Perhaps, this - * needs to be specific to AGP-capable chipsets. AGP "memory" - * sometimes gets allocated within the range routed to the AGP bus. - */ - if ((baseclass == PCI_CLASS_BRIDGE) && - (subclass == PCI_SUBCLASS_BRIDGE_HOST)) - resMisc |= ResOverlap; - - basep = &pcrp->pci_base0; - for (i = 0; i < 6; i++) { - if (basep[i]) { - if (PCI_MAP_IS_IO(basep[i])) { - if (pcrp->pci_command & PCI_CMD_IO_ENABLE) - res = activeRes; - else - res = inactiveRes; - P_I_RANGE(range, pcrp->tag, PCIGETIO(basep[i]), - pcrp->basesize[i], ResExcIoBlock | resMisc) - } else if (!PCI_MAP_IS64BITMEM(basep[i])) { - if (pcrp->pci_command & PCI_CMD_MEM_ENABLE) - res = activeRes; - else - res = inactiveRes; - P_M_RANGE(range, pcrp->tag, PCIGETMEMORY(basep[i]), - pcrp->basesize[i], ResExcMemBlock | resMisc) - } else { - i++; -#if defined(LONG64) || defined(WORD64) - P_M_RANGE(range,pcrp->tag,PCIGETMEMORY64(basep[i - 1]), - pcrp->basesize[i - 1], ResExcMemBlock | resMisc) -#else - if (basep[i]) - continue; - P_M_RANGE(range, pcrp->tag, PCIGETMEMORY(basep[i - 1]), - pcrp->basesize[i - 1], ResExcMemBlock | resMisc) -#endif - if (pcrp->pci_command & PCI_CMD_MEM_ENABLE) - res = activeRes; - else - res = inactiveRes; - } - if (range.rBegin) { /* catch cases where PCI base is unset */ - tmp = xf86AddResToList(NULL, &range, -1); - removeOverlapsWithBridges(pcrp->busnum,tmp); - *res = xf86JoinResLists(tmp,*res); - } - } - } - - /* Ignore disabled non-video ROMs */ - if ((pcrp->pci_command & PCI_CMD_MEM_ENABLE) && - (pcrp->pci_baserom & PCI_MAP_ROM_DECODE_ENABLE)) { - P_M_RANGE(range,pcrp->tag,PCIGETROM(pcrp->pci_baserom), - pcrp->basesize[6], ResExcMemBlock | resMisc); - if (range.rBegin) { - tmp = xf86AddResToList(NULL, &range, -1); - removeOverlapsWithBridges(pcrp->busnum, tmp); - *activeRes = xf86JoinResLists(tmp, *activeRes); - } - } - } - - if (*activeRes) { - xf86MsgVerb(X_INFO, 3, "Active PCI resource ranges:\n"); - xf86PrintResList(3, *activeRes); - } - if (*inactiveRes) { - xf86MsgVerb(X_INFO, 3, "Inactive PCI resource ranges:\n"); - xf86PrintResList(3, *inactiveRes); - } - - /* - * Adjust ranges based on the assumption that there are no real - * overlaps in the PCI base allocations. This assumption should be - * reasonable in most cases. It may be possible to refine the - * approximated PCI base sizes by considering bus mapping information - * from PCI-PCI bridges. - */ - - if (*activeRes) { - /* Check for overlaps */ - for (pRes = *activeRes; pRes; pRes = pRes->next) { - if (ResCanOverlap(&pRes->val)) { - range = pRes->val; - - RemoveOverlaps(pRes, *activeRes, TRUE, TRUE); - RemoveOverlaps(pRes, *inactiveRes, TRUE, - (xf86Info.estimateSizesAggressively > 0)); - - if (range.rEnd > pRes->block_end) { - correctPciSize(range.rBegin, range.rEnd - range.rBegin, - pRes->block_end - pRes->block_begin, - pRes->res_type); - xf86MsgVerb(X_INFO, 3, - "PCI %s resource overlap reduced 0x%08lx" - " from 0x%08lx to 0x%08lx\n", - ((pRes->res_type & ResPhysMask) == ResMem) ? - "Memory" : "I/O", - range.rBegin, range.rEnd, pRes->block_end); - } - } - } - xf86MsgVerb(X_INFO, 3, - "Active PCI resource ranges after removing overlaps:\n"); - xf86PrintResList(3, *activeRes); - } - - if (*inactiveRes) { - /* Check for overlaps */ - for (pRes = *inactiveRes; pRes; pRes = pRes->next) { - if (ResCanOverlap(&pRes->val)) { - range = pRes->val; - - RemoveOverlaps(pRes, *activeRes, TRUE, - (xf86Info.estimateSizesAggressively > 1)); - RemoveOverlaps(pRes, *inactiveRes, TRUE, - (xf86Info.estimateSizesAggressively > 1)); - - if (range.rEnd > pRes->block_end) { - correctPciSize(range.rBegin, range.rEnd - range.rBegin, - pRes->block_end - pRes->block_begin, - pRes->res_type); - xf86MsgVerb(X_INFO, 3, - "PCI %s resource overlap reduced 0x%08lx" - " from 0x%08lx to 0x%08lx\n", - ((pRes->res_type & ResPhysMask) == ResMem) ? - "Memory" : "I/O", - range.rBegin, range.rEnd, pRes->block_end); - } - - } - } - xf86MsgVerb(X_INFO, 3, - "Inactive PCI resource ranges after removing overlaps:\n"); - xf86PrintResList(3, *inactiveRes); - } -} - -resPtr -ResourceBrokerInitPci(resPtr *osRes) -{ - resPtr activeRes, inactiveRes; - resPtr tmp; - - /* Get bus-specific system resources (PCI) */ - xf86GetPciRes(&activeRes, &inactiveRes); - - /* - * Adjust OS-reported resource ranges based on the assumption that there - * are no overlaps with the PCI base allocations. This should be a good - * assumption because writes to PCI address space won't be routed directly - * to host memory. - */ - - for (tmp = *osRes; tmp; tmp = tmp->next) - RemoveOverlaps(tmp, activeRes, FALSE, TRUE); - - xf86MsgVerb(X_INFO, 3, "OS-reported resource ranges after removing" - " overlaps with PCI:\n"); - xf86PrintResList(3, *osRes); - - pciAvoidRes = xf86AddRangesToList(pciAvoidRes,PciAvoid,-1); - for (tmp = pciAvoidRes; tmp; tmp = tmp->next) - RemoveOverlaps(tmp, activeRes, FALSE, TRUE); - tmp = xf86DupResList(*osRes); - pciAvoidRes = xf86JoinResLists(pciAvoidRes,tmp); - - return (xf86JoinResLists(activeRes,inactiveRes)); -} - - -/* - * PCI Resource modification - */ -static Bool -fixPciResource(int prt, memType alignment, pciVideoPtr pvp, unsigned long type) -{ - int res_n; - memType *p_base; - int *p_size; - unsigned char p_type; - resPtr AccTmp = NULL; - resPtr orgAcc = NULL; - resPtr *pAcc = &AccTmp; - resPtr avoid = NULL; - resRange range; - resPtr resSize = NULL; - resPtr w_tmp, w = NULL, w_2nd = NULL; - PCITAG tag; - PciBusPtr pbp = xf86PciBus; - pciConfigPtr pcp; - resPtr tmp; - - if (!pvp) return FALSE; - tag = pciTag(pvp->bus,pvp->device,pvp->func); - pcp = pvp->thisCard; - - type &= ResAccMask; - if (!type) type = ResShared; - if (prt < 6) { - if (pvp->memBase[prt]) { - type |= ResMem; - res_n = prt; - p_base = &(pvp->memBase[res_n]); - p_size = &(pvp->size[res_n]); - p_type = pvp->type[res_n]; - if (!PCI_MAP_IS64BITMEM(pvp->type[res_n])) { - PCI_M_RANGE(range,tag,0,0xffffffff,ResExcMemBlock); - resSize = xf86AddResToList(resSize,&range,-1); - } - } else if (pvp->ioBase[prt]){ - type |= ResIo; - res_n = prt; - p_base = &(pvp->ioBase[res_n]); - p_size = &(pvp->size[res_n]); - p_type = pvp->type[res_n]; - PCI_I_RANGE(range, tag, 0, 0xffffffff, ResExcIoBlock); - resSize = xf86AddResToList(resSize, &range, -1); - } else return FALSE; - } else if (prt == 6) { - type |= ResMem; - res_n = 0xff; /* special flag for bios rom */ - p_base = &(pvp->biosBase); - p_size = &(pvp->biosSize); - /* XXX This should also include the PCI_MAP_MEMORY_TYPE_MASK part */ - p_type = 0; - PCI_M_RANGE(range,tag,0,0xffffffff,ResExcMemBlock); - resSize = xf86AddResToList(resSize,&range,-1); - } else return FALSE; - - if (! *p_base) return FALSE; - - type |= (range.type & ResDomain) | ResBlock; - - /* setup avoid: PciAvoid is bus range: convert later */ - avoid = xf86DupResList(pciAvoidRes); - - while (pbp) { - if (pbp->secondary == pvp->bus) { - if ((type & ResPhysMask) == ResMem) { - if (((p_type & PCI_MAP_MEMORY_CACHABLE) -#if 0 /*EE*/ - || (res_n == 0xff)/* bios should also be prefetchable */ -#endif - )) { - if (pbp->preferred_pmem) - w = xf86FindIntersectOfLists(pbp->preferred_pmem, - ResRange); - else if (pbp->pmem) - w = xf86FindIntersectOfLists(pbp->pmem,ResRange); - - if (pbp->preferred_mem) - w_2nd = xf86FindIntersectOfLists(pbp->preferred_mem, - ResRange); - else if (pbp->mem) - w_2nd = xf86FindIntersectOfLists(pbp->mem, - ResRange); - } else { - if (pbp->preferred_mem) - w = xf86FindIntersectOfLists(pbp->preferred_mem, - ResRange); - else if (pbp->mem) - w = xf86FindIntersectOfLists(pbp->mem,ResRange); - } - } else { - if (pbp->preferred_io) - w = xf86FindIntersectOfLists(pbp->preferred_io,ResRange); - if (pbp->io) - w = xf86FindIntersectOfLists(pbp->io,ResRange); - } - } else if (pbp->primary == pvp->bus) { - if ((type & ResPhysMask) == ResMem) { - tmp = xf86DupResList(pbp->preferred_pmem); - avoid = xf86JoinResLists(avoid, tmp); - tmp = xf86DupResList(pbp->preferred_mem); - avoid = xf86JoinResLists(avoid, tmp); - } else { - tmp = xf86DupResList(pbp->preferred_io); - avoid = xf86JoinResLists(avoid, tmp); - } - } - pbp = pbp->next; - } - - /* convert bus based entries in avoid list to host base */ - pciConvertListToHost(pvp->bus,pvp->device,pvp->func, avoid); - - if (!w) - w = xf86DupResList(ResRange); - xf86MsgVerb(X_INFO, 3, "window:\n"); - xf86PrintResList(3, w); - xf86MsgVerb(X_INFO, 3, "resSize:\n"); - xf86PrintResList(3, resSize); - - if (resSize) { - w_tmp = w; - w = xf86FindIntersectOfLists(w,resSize); - xf86FreeResList(w_tmp); - if (w_2nd) { - w_tmp = w_2nd; - w_2nd = xf86FindIntersectOfLists(w_2nd,resSize); - xf86FreeResList(w_tmp); - } - xf86FreeResList(resSize); - } - xf86MsgVerb(X_INFO, 3, "window fixed:\n"); - xf86PrintResList(3, w); - - if (!alignment) - alignment = (1 << (*p_size)) - 1; - - /* Access list holds bios resources -- remove this one */ -#ifdef NOTYET - AccTmp = xf86DupResList(Acc); - while ((*pAcc)) { - if ((((*pAcc)->res_type & (type & ~ResAccMask)) - == (type & ~ResAccMask)) - && ((*pAcc)->block_begin == (B2H(tag,(*p_base),type))) - && ((*pAcc)->block_end == (B2H(tag, - (*p_base)+SIZE(*p_size),type)))) { - resPtr acc_tmp = (*pAcc)->next; - xfree((*pAcc)); - (*pAcc) = acc_tmp; - break; - } else - pAcc = &((*pAcc)->next); - } - /* check if we really need to fix anything */ - P_X_RANGE(range,tag,(*p_base),(*p_base) + SIZE((*p_size)),type); - if (!ChkConflict(&range,avoid,SETUP) - && !ChkConflict(&range,AccTmp,SETUP) - && ((B2H(tag,(*p_base),type) & PCI_SIZE(type,tag,alignment) - == range->block_begin) - && ((xf86IsSubsetOf(range,w) - || (w_2nd && xf86IsSubsetOf(range,w_2n))))) { -#ifdef DEBUG - ErrorF("nothing to fix\n"); -#endif - xf86FreeResList(AccTmp); - xf86FreeResList(w); - xf86FreeResList(w_2nd); - xf86FreeResList(avoid); - return TRUE; - } -#ifdef DEBUG - ErrorF("removing old resource\n"); -#endif - orgAcc = Acc; - Acc = AccTmp; -#else - orgAcc = xf86DupResList(Acc); - pAcc = &Acc; - while (*pAcc) { - if ((((*pAcc)->res_type & (ResTypeMask|ResExtMask)) == - (type & ~ResAccMask)) - && ((*pAcc)->block_begin == B2H(tag,(*p_base),type)) - && ((*pAcc)->block_end == B2H(tag,(*p_base) + SIZE(*p_size), - type))) { -#ifdef DEBUG - ErrorF("removing old resource\n"); -#endif - tmp = *pAcc; - *pAcc = (*pAcc)->next; - tmp->next = NULL; - xf86FreeResList(tmp); - break; - } else - pAcc = &((*pAcc)->next); - } -#endif - -#ifdef DEBUG - ErrorF("base: 0x%lx alignment: 0x%lx host alignment: 0x%lx size[bit]: 0x%x\n", - (*p_base),alignment,PCI_SIZE(type,tag,alignment),(*p_size)); - xf86MsgVerb(X_INFO, 3, "window:\n"); - xf86PrintResList(3, w); - if (w_2nd) - xf86MsgVerb(X_INFO, 3, "2nd window:\n"); - xf86PrintResList(3, w_2nd); - xf86ErrorFVerb(3,"avoid:\n"); - xf86PrintResList(3,avoid); -#endif - w_tmp = w; - while (w) { - if ((type & ResTypeMask) == (w->res_type & ResTypeMask)) { -#ifdef DEBUG - ErrorF("block_begin: 0x%lx block_end: 0x%lx\n",w->block_begin, - w->block_end); -#endif - range = xf86GetBlock(type,PCI_SIZE(type,tag,alignment + 1), - w->block_begin, w->block_end, - PCI_SIZE(type,tag,alignment),avoid); - if (range.type != ResEnd) - break; - } - w = w->next; - } - xf86FreeResList(w_tmp); - /* if unsuccessful and memory prefetchable try non-prefetchable */ - if (range.type == ResEnd && w_2nd) { - w_tmp = w_2nd; - while (w_2nd) { - if ((type & ResTypeMask) == (w_2nd->res_type & ResTypeMask)) { -#ifdef DEBUG - ErrorF("block_begin: 0x%lx block_end: 0x%lx\n",w_2nd->block_begin, - w_2nd->block_end); -#endif - range = xf86GetBlock(type,PCI_SIZE(type,tag,alignment + 1), - w_2nd->block_begin, w_2nd->block_end, - PCI_SIZE(type,tag,alignment),avoid); - if (range.type != ResEnd) - break; - } - w_2nd = w_2nd->next; - } - xf86FreeResList(w_tmp); - } - xf86FreeResList(avoid); - - if (range.type == ResEnd) { - xf86MsgVerb(X_ERROR,3,"Cannot find a replacement memory range\n"); - xf86FreeResList(Acc); - Acc = orgAcc; - return FALSE; - } - xf86FreeResList(orgAcc); -#ifdef DEBUG - ErrorF("begin: 0x%lx, end: 0x%lx\n",range.a,range.b); -#endif - - (*p_size) = 0; - while (alignment >> (*p_size)) - (*p_size)++; - (*p_base) = H2B(tag,range.rBegin,type); -#ifdef DEBUG - ErrorF("New PCI res %i base: 0x%lx, size: 0x%lx, type %s\n", - res_n,(*p_base),(1 << (*p_size)), - ((type & ResPhysMask) == ResMem) ? "Mem" : "Io"); -#endif - if (res_n != 0xff) { - if ((type & ResPhysMask) == ResMem) - pvp->memBase[prt] = range.rBegin; - else - pvp->ioBase[prt] = range.rBegin; - ((CARD32 *)(&(pcp->pci_base0)))[res_n] = - (CARD32)(*p_base) | (CARD32)(p_type); - pciWriteLong(tag, PCI_CMD_BASE_REG + res_n * sizeof(CARD32), - ((CARD32 *)(&(pcp->pci_base0)))[res_n]); - if (PCI_MAP_IS64BITMEM(p_type)) { -#if defined(LONG64) || defined(WORD64) - ((CARD32 *)(&(pcp->pci_base0)))[res_n + 1] = - (CARD32)(*p_base >> 32); - pciWriteLong(tag, PCI_CMD_BASE_REG + (res_n + 1) * sizeof(CARD32), - ((CARD32 *)(&(pcp->pci_base0)))[res_n + 1]); -#else - ((CARD32 *)(&(pcp->pci_base0)))[res_n + 1] = 0; - pciWriteLong(tag, PCI_CMD_BASE_REG + (res_n + 1) * sizeof(CARD32), - 0); -#endif - } - } else { - pvp->biosBase = range.rBegin; - pcp->pci_baserom = (pciReadLong(tag,PCI_CMD_BIOS_REG) & 0x01) | - (CARD32)(*p_base); - pciWriteLong(tag, PCI_CMD_BIOS_REG, pcp->pci_baserom); - } - /* @@@ fake BIOS allocated resource */ - range.type |= ResBios; - Acc = xf86AddResToList(Acc, &range,-1); - - return TRUE; - -} - -Bool -xf86FixPciResource(int entityIndex, int prt, memType alignment, - unsigned long type) -{ - pciVideoPtr pvp = xf86GetPciInfoForEntity(entityIndex); - return fixPciResource(prt, alignment, pvp, type); -} - -resPtr -xf86ReallocatePciResources(int entityIndex, resPtr pRes) -{ - pciVideoPtr pvp = xf86GetPciInfoForEntity(entityIndex); - resPtr pBad = NULL,pResTmp; - unsigned int prt = 0; - int i; - - if (!pvp) return pRes; - - while (pRes) { - switch (pRes->res_type & ResPhysMask) { - case ResMem: - if (pRes->block_begin == B2M(TAG(pvp),pvp->biosBase) && - pRes->block_end == B2M(TAG(pvp),pvp->biosBase - + SIZE(pvp->biosSize))) - prt = 6; - else for (i = 0 ; i < 6; i++) - if ((pRes->block_begin == B2M(TAG(pvp),pvp->memBase[i])) - && (pRes->block_end == B2M(TAG(pvp),pvp->memBase[i] - + SIZE(pvp->size[i])))) { - prt = i; - break; - } - break; - case ResIo: - for (i = 0 ; i < 6; i++) - if (pRes->block_begin == B2I(TAG(pvp),pvp->ioBase[i]) - && pRes->block_end == B2I(TAG(pvp),pvp->ioBase[i] - + SIZE(pvp->size[i]))) { - prt = i; - break; - } - break; - } - - if (!prt) return pRes; - - pResTmp = pRes->next; - if (! fixPciResource(prt, 0, pvp, pRes->res_type)) { - pRes->next = pBad; - pBad = pRes; - } else - xfree(pRes); - - pRes = pResTmp; - } - return pBad; -} - -/* - * BIOS releated - */ -memType -getValidBIOSBase(PCITAG tag, int num) -{ - pciVideoPtr pvp = NULL; - PciBusPtr pbp; - resPtr m = NULL; - resPtr tmp, avoid, mem = NULL; - resRange range; - memType ret; - int n = 0; - int i; - CARD32 biosSize, alignment; - - if (!xf86PciVideoInfo) return 0; - - while ((pvp = xf86PciVideoInfo[n++])) { - if (pciTag(pvp->bus,pvp->device,pvp->func) == tag) - break; - } - if (!pvp) return 0; - - biosSize = pvp->biosSize; - alignment = (1 << biosSize) - 1; - if (biosSize > 24) - biosSize = 24; - - switch ((romBaseSource)num) { - case ROM_BASE_PRESET: - return 0; /* This should not happen */ - case ROM_BASE_BIOS: - /* In some cases the BIOS base register contains the size mask */ - if ((memType)(-1 << biosSize) == PCIGETROM(pvp->biosBase)) - return 0; - /* Make sure we don't conflict with our own mem resources */ - for (i = 0; i < 6; i++) { - if (!pvp->memBase[i]) - continue; - P_M_RANGE(range,TAG(pvp),pvp->memBase[i],pvp->size[i], - ResExcMemBlock); - mem = xf86AddResToList(mem,&range,-1); - } - P_M_RANGE(range, TAG(pvp),pvp->biosBase,biosSize,ResExcMemBlock); - ret = pvp->biosBase; - break; - case ROM_BASE_MEM0: - case ROM_BASE_MEM1: - case ROM_BASE_MEM2: - case ROM_BASE_MEM3: - case ROM_BASE_MEM4: - case ROM_BASE_MEM5: - if (!pvp->memBase[num] || (pvp->size[num] < biosSize)) - return 0; - P_M_RANGE(range, TAG(pvp),pvp->memBase[num],biosSize, - ResExcMemBlock); - ret = pvp->memBase[num]; - break; - case ROM_BASE_FIND: - ret = 0; - break; - default: - return 0; /* This should not happen */ - } - - /* Now find the ranges for validation */ - avoid = xf86DupResList(pciAvoidRes); - pbp = xf86PciBus; - while (pbp) { - if (pbp->secondary == pvp->bus) { - if (pbp->preferred_pmem) - tmp = xf86DupResList(pbp->preferred_pmem); - else - tmp = xf86DupResList(pbp->pmem); - m = xf86JoinResLists(m,tmp); - if (pbp->preferred_mem) - tmp = xf86DupResList(pbp->preferred_mem); - else - tmp = xf86DupResList(pbp->mem); - m = xf86JoinResLists(m,tmp); - tmp = m; - while (tmp) { - tmp->block_end = min(tmp->block_end,PCI_MEM32_LENGTH_MAX); - tmp = tmp->next; - } - } else if ((pbp->primary == pvp->bus) && - (pbp->secondary >= 0) && - (pbp->primary != pbp->secondary)) { - tmp = xf86DupResList(pbp->preferred_pmem); - avoid = xf86JoinResLists(avoid, tmp); - tmp = xf86DupResList(pbp->pmem); - avoid = xf86JoinResLists(avoid, tmp); - tmp = xf86DupResList(pbp->preferred_mem); - avoid = xf86JoinResLists(avoid, tmp); - tmp = xf86DupResList(pbp->mem); - avoid = xf86JoinResLists(avoid, tmp); - } - pbp = pbp->next; - } - pciConvertListToHost(pvp->bus,pvp->device,pvp->func, avoid); - if (mem) - pciConvertListToHost(pvp->bus,pvp->device,pvp->func, mem); - - if (!ret) { - /* Return a possible window */ - while (m) { - range = xf86GetBlock(RANGE_TYPE(ResExcMemBlock, xf86GetPciDomain(tag)), - PCI_SIZE(ResMem, TAG(pvp), 1 << biosSize), - m->block_begin, m->block_end, - PCI_SIZE(ResMem, TAG(pvp), alignment), - avoid); - if (range.type != ResEnd) { - ret = M2B(TAG(pvp), range.rBase); - break; - } - m = m->next; - } - } else { -#if !defined(__ia64__) /* on ia64, trust the kernel, don't look for overlaps */ - if (!xf86IsSubsetOf(range, m) || - ChkConflict(&range, avoid, SETUP) - || (mem && ChkConflict(&range, mem, SETUP))) - ret = 0; -#endif - } - - xf86FreeResList(avoid); - xf86FreeResList(m); - return ret; -} - -/* - * xf86Bus.c interface - */ - -void -xf86PciProbe(void) -{ - /* - * Initialise the pcidata entry points. - */ -#ifdef XFree86LOADER - xf86SetupPciIds = (ScanPciSetupProcPtr)LoaderSymbol("ScanPciSetupPciIds"); - xf86ClosePciIds = (ScanPciCloseProcPtr)LoaderSymbol("ScanPciClosePciIds"); - xf86FindPciNamesByDevice = - (ScanPciFindByDeviceProcPtr)LoaderSymbol("ScanPciFindPciNamesByDevice"); - xf86FindPciNamesBySubsys = - (ScanPciFindBySubsysProcPtr)LoaderSymbol("ScanPciFindPciNamesBySubsys"); - xf86FindPciClassBySubsys = - (ScanPciFindClassBySubsysProcPtr)LoaderSymbol("ScanPciFindPciClassBySubsys"); - xf86FindPciClassByDevice = - (ScanPciFindClassByDeviceProcPtr)LoaderSymbol("ScanPciFindPciClassByDevice"); -#else - xf86SetupPciIds = ScanPciSetupPciIds; - xf86ClosePciIds = ScanPciClosePciIds; - xf86FindPciNamesByDevice = ScanPciFindPciNamesByDevice; - xf86FindPciNamesBySubsys = ScanPciFindPciNamesBySubsys; - xf86FindPciClassBySubsys = ScanPciFindPciClassBySubsys; - xf86FindPciClassByDevice = ScanPciFindPciClassByDevice; -#endif - - if (!xf86SetupPciIds()) - FatalError("xf86SetupPciIds() failed\n"); - - FindPCIVideoInfo(); -} - -static void alignBridgeRanges(PciBusPtr PciBusBase, PciBusPtr primary); - -static void -printBridgeInfo(PciBusPtr PciBus) -{ - char primary[8], secondary[8], subordinate[8], brbus[8]; - - xf86FormatPciBusNumber(PciBus->primary, primary); - xf86FormatPciBusNumber(PciBus->secondary, secondary); - xf86FormatPciBusNumber(PciBus->subordinate, subordinate); - xf86FormatPciBusNumber(PciBus->brbus, brbus); - - xf86MsgVerb(X_INFO, 3, "Bus %s: bridge is at (%s:%d:%d), (%s,%s,%s)," - " BCTRL: 0x%04x (VGA_EN is %s)\n", - secondary, brbus, PciBus->brdev, PciBus->brfunc, - primary, secondary, subordinate, PciBus->brcontrol, - (PciBus->brcontrol & PCI_PCI_BRIDGE_VGA_EN) ? - "set" : "cleared"); - if (PciBus->preferred_io) { - xf86MsgVerb(X_INFO, 3, - "Bus %s I/O range:\n", secondary); - xf86PrintResList(3, PciBus->preferred_io); - } - if (PciBus->preferred_mem) { - xf86MsgVerb(X_INFO, 3, - "Bus %s non-prefetchable memory range:\n", secondary); - xf86PrintResList(3, PciBus->preferred_mem); - } - if (PciBus->preferred_pmem) { - xf86MsgVerb(X_INFO, 3, - "Bus %s prefetchable memory range:\n", secondary); - xf86PrintResList(3, PciBus->preferred_pmem); - } -} - -static PciBusPtr -xf86GetPciBridgeInfo(void) -{ - const pciConfigPtr *pcrpp; - pciConfigPtr pcrp; - pciBusInfo_t *pBusInfo; - resRange range; - PciBusPtr PciBus, PciBusBase = NULL; - PciBusPtr *pnPciBus = &PciBusBase; - int MaxBus = 0; - int i, domain; - int primary, secondary, subordinate; - memType base, limit; - - resPtr pciBusAccWindows = xf86PciBusAccWindowsFromOS(); - - if (xf86PciInfo == NULL) - return NULL; - - /* Add each bridge */ - for (pcrpp = xf86PciInfo, pcrp = *pcrpp; pcrp; pcrp = *(++pcrpp)) { - if (pcrp->busnum > MaxBus) - MaxBus = pcrp->busnum; - if ((pcrp->pci_base_class == PCI_CLASS_BRIDGE) || - (((pcrp->listed_class >> 8) & 0xff) == PCI_CLASS_BRIDGE)) { - int sub_class; - sub_class = (pcrp->listed_class & 0xffff) ? - (pcrp->listed_class & 0xff) : pcrp->pci_sub_class; - domain = xf86GetPciDomain(pcrp->tag); - - switch (sub_class) { - case PCI_SUBCLASS_BRIDGE_PCI: - /* something fishy about the header? If so: just ignore! */ - if ((pcrp->pci_header_type & 0x7f) != 0x01) { - xf86MsgVerb(X_WARNING, 3, "PCI-PCI bridge at %x:%x:%x has" - " unexpected header: 0x%x", - pcrp->busnum, pcrp->devnum, - pcrp->funcnum, pcrp->pci_header_type); - break; - } - - domain = pcrp->busnum & 0x0000FF00; - primary = pcrp->busnum; - secondary = domain | pcrp->pci_secondary_bus_number; - subordinate = domain | pcrp->pci_subordinate_bus_number; - - /* Is this the correct bridge? If not, ignore it */ - pBusInfo = pcrp->businfo; - if (pBusInfo && (pcrp != pBusInfo->bridge)) { - xf86MsgVerb(X_WARNING, 3, "PCI bridge mismatch for bus %x:" - " %x:%x:%x and %x:%x:%x\n", secondary, - pcrp->busnum, pcrp->devnum, pcrp->funcnum, - pBusInfo->bridge->busnum, - pBusInfo->bridge->devnum, - pBusInfo->bridge->funcnum); - break; - } - - if (pBusInfo && pBusInfo->funcs->pciGetBridgeBuses) - (*pBusInfo->funcs->pciGetBridgeBuses)(secondary, - &primary, - &secondary, - &subordinate); - - if (!pcrp->fakeDevice && (primary >= secondary)) { - xf86MsgVerb(X_WARNING, 3, "Misconfigured PCI bridge" - " %x:%x:%x (%x,%x)\n", - pcrp->busnum, pcrp->devnum, pcrp->funcnum, - primary, secondary); - break; - } - - *pnPciBus = PciBus = xnfcalloc(1, sizeof(PciBusRec)); - pnPciBus = &PciBus->next; - - PciBus->primary = primary; - PciBus->secondary = secondary; - PciBus->subordinate = subordinate; - - PciBus->brbus = pcrp->busnum; - PciBus->brdev = pcrp->devnum; - PciBus->brfunc = pcrp->funcnum; - - PciBus->subclass = sub_class; - PciBus->interface = pcrp->pci_prog_if; - - if (pBusInfo && pBusInfo->funcs->pciControlBridge) - PciBus->brcontrol = - (*pBusInfo->funcs->pciControlBridge)(secondary, 0, 0); - else - PciBus->brcontrol = pcrp->pci_bridge_control; - - if (pBusInfo && pBusInfo->funcs->pciGetBridgeResources) { - (*pBusInfo->funcs->pciGetBridgeResources)(secondary, - (pointer *)&PciBus->preferred_io, - (pointer *)&PciBus->preferred_mem, - (pointer *)&PciBus->preferred_pmem); - break; - } - - if ((pcrp->pci_command & PCI_CMD_IO_ENABLE) && - (pcrp->pci_upper_io_base || pcrp->pci_io_base || - pcrp->pci_upper_io_limit || pcrp->pci_io_limit)) { - base = (pcrp->pci_upper_io_base << 16) | - ((pcrp->pci_io_base & 0xf0u) << 8); - limit = (pcrp->pci_upper_io_limit << 16) | - ((pcrp->pci_io_limit & 0xf0u) << 8) | 0x0fff; - /* - * Deal with bridge ISA mode (256 wide ranges spaced 1K - * apart, but only in the first 64K). - */ - if (pcrp->pci_bridge_control & PCI_PCI_BRIDGE_ISA_EN) { - while ((base <= (CARD16)(-1)) && (base <= limit)) { - PCI_I_RANGE(range, pcrp->tag, - base, base + (CARD8)(-1), - ResIo | ResBlock | ResExclusive); - PciBus->preferred_io = - xf86AddResToList(PciBus->preferred_io, - &range, -1); - base += 0x0400; - } - } - if (base <= limit) { - PCI_I_RANGE(range, pcrp->tag, base, limit, - ResIo | ResBlock | ResExclusive); - PciBus->preferred_io = - xf86AddResToList(PciBus->preferred_io, &range, -1); - } - } - if (pcrp->pci_command & PCI_CMD_MEM_ENABLE) { - /* - * The P2P spec requires these next two, but some bridges - * don't comply. Err on the side of caution, making the not - * so bold assumption that no bridge would ever re-route the - * bottom megabyte. - */ - if (pcrp->pci_mem_base || pcrp->pci_mem_limit) { - base = pcrp->pci_mem_base & 0xfff0u; - limit = pcrp->pci_mem_limit & 0xfff0u; - if (base <= limit) { - PCI_M_RANGE(range, pcrp->tag, - base << 16, (limit << 16) | 0x0fffff, - ResMem | ResBlock | ResExclusive); - PciBus->preferred_mem = - xf86AddResToList(PciBus->preferred_mem, &range, -1); - } - } - - if (pcrp->pci_prefetch_mem_base || - pcrp->pci_prefetch_mem_limit || - pcrp->pci_prefetch_upper_mem_base || - pcrp->pci_prefetch_upper_mem_limit) { - base = pcrp->pci_prefetch_mem_base & 0xfff0u; - limit = pcrp->pci_prefetch_mem_limit & 0xfff0u; -#if defined(LONG64) || defined(WORD64) - base |= (memType)pcrp->pci_prefetch_upper_mem_base << 16; - limit |= (memType)pcrp->pci_prefetch_upper_mem_limit << 16; -#endif - if (base <= limit) { - PCI_M_RANGE(range, pcrp->tag, - base << 16, (limit << 16) | 0xfffff, - ResMem | ResBlock | ResExclusive); - PciBus->preferred_pmem = - xf86AddResToList(PciBus->preferred_pmem, - &range, -1); - } - } - } - break; - - case PCI_SUBCLASS_BRIDGE_CARDBUS: - /* something fishy about the header? If so: just ignore! */ - if ((pcrp->pci_header_type & 0x7f) != 0x02) { - xf86MsgVerb(X_WARNING, 3, "PCI-CardBus bridge at %x:%x:%x" - " has unexpected header: 0x%x", - pcrp->busnum, pcrp->devnum, - pcrp->funcnum, pcrp->pci_header_type); - break; - } - - domain = pcrp->busnum & 0x0000FF00; - primary = pcrp->busnum; - secondary = domain | pcrp->pci_cb_cardbus_bus_number; - subordinate = domain | pcrp->pci_subordinate_bus_number; - - /* Is this the correct bridge? If not, ignore it */ - pBusInfo = pcrp->businfo; - if (pBusInfo && (pcrp != pBusInfo->bridge)) { - xf86MsgVerb(X_WARNING, 3, "CardBus bridge mismatch for bus" - " %x: %x:%x:%x and %x:%x:%x\n", secondary, - pcrp->busnum, pcrp->devnum, pcrp->funcnum, - pBusInfo->bridge->busnum, - pBusInfo->bridge->devnum, - pBusInfo->bridge->funcnum); - break; - } - - if (pBusInfo && pBusInfo->funcs->pciGetBridgeBuses) - (*pBusInfo->funcs->pciGetBridgeBuses)(secondary, - &primary, - &secondary, - &subordinate); - - if (primary >= secondary) { - if (pcrp->pci_cb_cardbus_bus_number != 0) - xf86MsgVerb(X_WARNING, 3, "Misconfigured CardBus" - " bridge %x:%x:%x (%x,%x)\n", - pcrp->busnum, pcrp->devnum, pcrp->funcnum, - primary, secondary); - break; - } - - *pnPciBus = PciBus = xnfcalloc(1, sizeof(PciBusRec)); - pnPciBus = &PciBus->next; - - PciBus->primary = primary; - PciBus->secondary = secondary; - PciBus->subordinate = subordinate; - - PciBus->brbus = pcrp->busnum; - PciBus->brdev = pcrp->devnum; - PciBus->brfunc = pcrp->funcnum; - - PciBus->subclass = sub_class; - PciBus->interface = pcrp->pci_prog_if; - - if (pBusInfo && pBusInfo->funcs->pciControlBridge) - PciBus->brcontrol = - (*pBusInfo->funcs->pciControlBridge)(secondary, 0, 0); - else - PciBus->brcontrol = pcrp->pci_bridge_control; - - if (pBusInfo && pBusInfo->funcs->pciGetBridgeResources) { - (*pBusInfo->funcs->pciGetBridgeResources)(secondary, - (pointer *)&PciBus->preferred_io, - (pointer *)&PciBus->preferred_mem, - (pointer *)&PciBus->preferred_pmem); - break; - } - - if (pcrp->pci_command & PCI_CMD_IO_ENABLE) { - if (pcrp->pci_cb_iobase0) { - base = PCI_CB_IOBASE(pcrp->pci_cb_iobase0); - limit = PCI_CB_IOLIMIT(pcrp->pci_cb_iolimit0); - - /* - * Deal with bridge ISA mode (256-wide ranges spaced 1K - * apart (start to start), but only in the first 64K). - */ - if (pcrp->pci_bridge_control & PCI_PCI_BRIDGE_ISA_EN) { - while ((base <= (CARD16)(-1)) && - (base <= limit)) { - PCI_I_RANGE(range, pcrp->tag, - base, base + (CARD8)(-1), - ResIo | ResBlock | ResExclusive); - PciBus->preferred_io = - xf86AddResToList(PciBus->preferred_io, - &range, -1); - base += 0x0400; - } - } - - if (base <= limit) { - PCI_I_RANGE(range, pcrp->tag, base, limit, - ResIo | ResBlock | ResExclusive); - PciBus->preferred_io = - xf86AddResToList(PciBus->preferred_io, - &range, -1); - } - } - - if (pcrp->pci_cb_iobase1) { - base = PCI_CB_IOBASE(pcrp->pci_cb_iobase1); - limit = PCI_CB_IOLIMIT(pcrp->pci_cb_iolimit1); - - /* - * Deal with bridge ISA mode (256-wide ranges spaced 1K - * apart (start to start), but only in the first 64K). - */ - if (pcrp->pci_bridge_control & PCI_PCI_BRIDGE_ISA_EN) { - while ((base <= (CARD16)(-1)) && - (base <= limit)) { - PCI_I_RANGE(range, pcrp->tag, - base, base + (CARD8)(-1), - ResIo | ResBlock | ResExclusive); - PciBus->preferred_io = - xf86AddResToList(PciBus->preferred_io, - &range, -1); - base += 0x0400; - } - } - - if (base <= limit) { - PCI_I_RANGE(range, pcrp->tag, base, limit, - ResIo | ResBlock | ResExclusive); - PciBus->preferred_io = - xf86AddResToList(PciBus->preferred_io, - &range, -1); - } - } - } - - if (pcrp->pci_command & PCI_CMD_MEM_ENABLE) { - if ((pcrp->pci_cb_membase0) && - (pcrp->pci_cb_membase0 <= pcrp->pci_cb_memlimit0)) { - PCI_M_RANGE(range, pcrp->tag, - pcrp->pci_cb_membase0 & ~0x0fff, - pcrp->pci_cb_memlimit0 | 0x0fff, - ResMem | ResBlock | ResExclusive); - if (pcrp->pci_bridge_control & - PCI_CB_BRIDGE_CTL_PREFETCH_MEM0) - PciBus->preferred_pmem = - xf86AddResToList(PciBus->preferred_pmem, - &range, -1); - else - PciBus->preferred_mem = - xf86AddResToList(PciBus->preferred_mem, - &range, -1); - } - if ((pcrp->pci_cb_membase1) && - (pcrp->pci_cb_membase1 <= pcrp->pci_cb_memlimit1)) { - PCI_M_RANGE(range, pcrp->tag, - pcrp->pci_cb_membase1 & ~0x0fff, - pcrp->pci_cb_memlimit1 | 0x0fff, - ResMem | ResBlock | ResExclusive); - if (pcrp->pci_bridge_control & - PCI_CB_BRIDGE_CTL_PREFETCH_MEM1) - PciBus->preferred_pmem = - xf86AddResToList(PciBus->preferred_pmem, - &range, -1); - else - PciBus->preferred_mem = - xf86AddResToList(PciBus->preferred_mem, - &range, -1); - } - } - - break; - - case PCI_SUBCLASS_BRIDGE_ISA: - case PCI_SUBCLASS_BRIDGE_EISA: - case PCI_SUBCLASS_BRIDGE_MC: - *pnPciBus = PciBus = xnfcalloc(1, sizeof(PciBusRec)); - pnPciBus = &PciBus->next; - PciBus->primary = pcrp->busnum; - PciBus->secondary = PciBus->subordinate = -1; - PciBus->brbus = pcrp->busnum; - PciBus->brdev = pcrp->devnum; - PciBus->brfunc = pcrp->funcnum; - PciBus->subclass = sub_class; - PciBus->brcontrol = PCI_PCI_BRIDGE_VGA_EN; - break; - - case PCI_SUBCLASS_BRIDGE_HOST: - /* Is this the correct bridge? If not, ignore bus info */ - pBusInfo = pcrp->businfo; - - if (!pBusInfo || pBusInfo == HOST_NO_BUS) - break; - - secondary = 0; - /* Find "secondary" bus segment */ - while (pBusInfo != pciBusInfo[secondary]) - secondary++; - if (pcrp != pBusInfo->bridge) { - xf86MsgVerb(X_WARNING, 3, "Host bridge mismatch for" - " bus %x: %x:%x:%x and %x:%x:%x\n", - pBusInfo->primary_bus, - pcrp->busnum, pcrp->devnum, pcrp->funcnum, - pBusInfo->bridge->busnum, - pBusInfo->bridge->devnum, - pBusInfo->bridge->funcnum); - pBusInfo = NULL; - } - - *pnPciBus = PciBus = xnfcalloc(1, sizeof(PciBusRec)); - pnPciBus = &PciBus->next; - - - PciBus->primary = PciBus->secondary = secondary; - PciBus->subordinate = pciNumBuses - 1; - - if (pBusInfo->funcs->pciGetBridgeBuses) - (*pBusInfo->funcs->pciGetBridgeBuses) - (secondary, - &PciBus->primary, - &PciBus->secondary, - &PciBus->subordinate); - - PciBus->brbus = pcrp->busnum; - PciBus->brdev = pcrp->devnum; - PciBus->brfunc = pcrp->funcnum; - - PciBus->subclass = sub_class; - - if (pBusInfo && pBusInfo->funcs->pciControlBridge) - PciBus->brcontrol = - (*pBusInfo->funcs->pciControlBridge)(secondary, 0, 0); - else - PciBus->brcontrol = PCI_PCI_BRIDGE_VGA_EN; - - if (pBusInfo && pBusInfo->funcs->pciGetBridgeResources) { - (*pBusInfo->funcs->pciGetBridgeResources) - (secondary, - (pointer *)&PciBus->preferred_io, - (pointer *)&PciBus->preferred_mem, - (pointer *)&PciBus->preferred_pmem); - break; - } - - PciBus->preferred_io = - xf86ExtractTypeFromList(pciBusAccWindows, - RANGE_TYPE(ResIo, domain)); - PciBus->preferred_mem = - xf86ExtractTypeFromList(pciBusAccWindows, - RANGE_TYPE(ResMem, domain)); - PciBus->preferred_pmem = - xf86ExtractTypeFromList(pciBusAccWindows, - RANGE_TYPE(ResMem, domain)); - break; - - default: - break; - } - } - } - for (i = 0; i <= MaxBus; i++) { /* find PCI buses not attached to bridge */ - if (!pciBusInfo[i]) - continue; - for (PciBus = PciBusBase; PciBus; PciBus = PciBus->next) - if (PciBus->secondary == i) break; - if (!PciBus) { /* We assume it's behind a HOST-PCI bridge */ - /* - * Find the 'smallest' free HOST-PCI bridge, where 'small' is in - * the order of pciTag(). - */ - PCITAG minTag = 0xFFFFFFFF, tag; - PciBusPtr PciBusFound = NULL; - for (PciBus = PciBusBase; PciBus; PciBus = PciBus->next) - if ((PciBus->subclass == PCI_SUBCLASS_BRIDGE_HOST) && - (PciBus->secondary == -1) && - ((tag = pciTag(PciBus->brbus,PciBus->brdev,PciBus->brfunc)) - < minTag) ) { - minTag = tag; - PciBusFound = PciBus; - } - if (PciBusFound) - PciBusFound->secondary = i; - else { /* if nothing found it may not be visible: create new */ - /* Find a device on this bus */ - domain = 0; - for (pcrpp = xf86PciInfo; (pcrp = *pcrpp); pcrpp++) { - if (pcrp->busnum == i) { - domain = xf86GetPciDomain(pcrp->tag); - break; - } - } - *pnPciBus = PciBus = xnfcalloc(1, sizeof(PciBusRec)); - pnPciBus = &PciBus->next; - PciBus->primary = PciBus->secondary = i; - PciBus->subclass = PCI_SUBCLASS_BRIDGE_HOST; - PciBus->brcontrol = PCI_PCI_BRIDGE_VGA_EN; - PciBus->preferred_io = - xf86ExtractTypeFromList(pciBusAccWindows, - RANGE_TYPE(ResIo, domain)); - PciBus->preferred_mem = - xf86ExtractTypeFromList(pciBusAccWindows, - RANGE_TYPE(ResMem, domain)); - PciBus->preferred_pmem = - xf86ExtractTypeFromList(pciBusAccWindows, - RANGE_TYPE(ResMem, domain)); - } - } - } - - for (PciBus = PciBusBase; PciBus; PciBus = PciBus->next) { - if (PciBus->primary == PciBus->secondary) { - alignBridgeRanges(PciBusBase, PciBus); - } - } - - for (PciBus = PciBusBase; PciBus; PciBus = PciBus->next) { - switch (PciBus->subclass) { - case PCI_SUBCLASS_BRIDGE_PCI: - if (PciBus->interface == PCI_IF_BRIDGE_PCI_SUBTRACTIVE) - xf86MsgVerb(X_INFO, 3, "Subtractive PCI-to-PCI bridge:\n"); - else - xf86MsgVerb(X_INFO, 3, "PCI-to-PCI bridge:\n"); - break; - case PCI_SUBCLASS_BRIDGE_CARDBUS: - xf86MsgVerb(X_INFO, 3, "PCI-to-CardBus bridge:\n"); - break; - case PCI_SUBCLASS_BRIDGE_HOST: - xf86MsgVerb(X_INFO, 3, "Host-to-PCI bridge:\n"); - break; - case PCI_SUBCLASS_BRIDGE_ISA: - xf86MsgVerb(X_INFO, 3, "PCI-to-ISA bridge:\n"); - break; - case PCI_SUBCLASS_BRIDGE_EISA: - xf86MsgVerb(X_INFO, 3, "PCI-to-EISA bridge:\n"); - break; - case PCI_SUBCLASS_BRIDGE_MC: - xf86MsgVerb(X_INFO, 3, "PCI-to-MCA bridge:\n"); - break; - default: - break; - } - printBridgeInfo(PciBus); - } - xf86FreeResList(pciBusAccWindows); - return PciBusBase; -} - -static void -alignBridgeRanges(PciBusPtr PciBusBase, PciBusPtr primary) -{ - PciBusPtr PciBus; - - for (PciBus = PciBusBase; PciBus; PciBus = PciBus->next) { - if ((PciBus != primary) && (PciBus->primary != -1) - && (PciBus->primary == primary->secondary)) { - resPtr tmp; - tmp = xf86FindIntersectOfLists(primary->preferred_io, - PciBus->preferred_io); - xf86FreeResList(PciBus->preferred_io); - PciBus->preferred_io = tmp; - tmp = xf86FindIntersectOfLists(primary->preferred_pmem, - PciBus->preferred_pmem); - xf86FreeResList(PciBus->preferred_pmem); - PciBus->preferred_pmem = tmp; - tmp = xf86FindIntersectOfLists(primary->preferred_mem, - PciBus->preferred_mem); - xf86FreeResList(PciBus->preferred_mem); - PciBus->preferred_mem = tmp; - - /* Deal with subtractive decoding */ - switch (PciBus->subclass) { - case PCI_SUBCLASS_BRIDGE_PCI: - if (PciBus->interface != PCI_IF_BRIDGE_PCI_SUBTRACTIVE) - break; - /* Fall through */ -#if 0 /* Not yet */ - case PCI_SUBCLASS_BRIDGE_ISA: - case PCI_SUBCLASS_BRIDGE_EISA: - case PCI_SUBCLASS_BRIDGE_MC: -#endif - if (!(PciBus->io = primary->io)) - PciBus->io = primary->preferred_io; - if (!(PciBus->mem = primary->mem)) - PciBus->mem = primary->preferred_mem; - if (!(PciBus->pmem = primary->pmem)) - PciBus->pmem = primary->preferred_pmem; - default: - break; - } - - alignBridgeRanges(PciBusBase, PciBus); - } - } -} - -void -ValidatePci(void) -{ - pciVideoPtr pvp, pvp1; - PciBusPtr pbp; - pciConfigPtr pcrp, *pcrpp; - CARD32 *basep; - resPtr Sys; - resRange range; - int n = 0, m, i; - - if (!xf86PciVideoInfo) return; - - /* - * Mark all pciInfoRecs that need to be validated. These are - * the ones which have been assigned to a screen. - */ - Sys = xf86DupResList(osRes); - /* Only validate graphics devices in use */ - for (i=0; inumEntities; m++) - if ((pvp = xf86GetPciInfoForEntity(xf86Screens[i]->entityList[m]))) - pvp->validate = TRUE; - } - - /* - * Collect all background PCI resources we need to validate against. - * These are all resources which don't belong to PCINONSYSTEMCLASSES - * and which have not been assigned to an entity. - */ - /* First get the PCIINFOCLASSES */ - m = 0; - while ((pvp = xf86PciVideoInfo[m++])) { - /* is it a PCINONSYSTEMCLASS? */ - if (PCINONSYSTEMCLASSES(pvp->class, pvp->subclass)) - continue; - /* has it an Entity assigned to it? */ - for (i=0; ibusType != BUS_PCI) - continue; - if (p->pciBusId.bus == pvp->bus - && p->pciBusId.device == pvp->device - && p->pciBusId.func == pvp->func) - break; - } - if (i != xf86NumEntities) /* found an Entity for this one */ - continue; - - for (i = 0; i<6; i++) { - if (pvp->ioBase[i]) { - PV_I_RANGE(range,pvp,i,ResExcIoBlock); - Sys = xf86AddResToList(Sys,&range,-1); - } else if (pvp->memBase[i]) { - PV_M_RANGE(range,pvp,i,ResExcMemBlock); - Sys = xf86AddResToList(Sys,&range,-1); - } - } - } - for (pcrpp = xf86PciInfo, pcrp = *pcrpp; pcrp; pcrp = *++(pcrpp)) { - - /* These were handled above */ - if (PCIINFOCLASSES(pcrp->pci_base_class, pcrp->pci_sub_class)) - continue; - - if ((pcrp->pci_header_type & 0x7f) || - !(pcrp->pci_command & (PCI_CMD_IO_ENABLE | PCI_CMD_MEM_ENABLE))) - continue; - - basep = &pcrp->pci_base0; - for (i = 0; i < 6; i++) { - if (basep[i]) { - if (PCI_MAP_IS_IO(basep[i])) { - if (!(pcrp->pci_command & PCI_CMD_IO_ENABLE)) - continue; - P_I_RANGE(range, pcrp->tag, PCIGETIO(basep[i]), - pcrp->basesize[i], ResExcIoBlock) - } else if (!PCI_MAP_IS64BITMEM(basep[i])) { - if (!(pcrp->pci_command & PCI_CMD_MEM_ENABLE)) - continue; - P_M_RANGE(range, pcrp->tag, PCIGETMEMORY(basep[i]), - pcrp->basesize[i], ResExcMemBlock) - } else { - i++; - if (!(pcrp->pci_command & PCI_CMD_MEM_ENABLE)) - continue; -#if defined(LONG64) || defined(WORD64) - P_M_RANGE(range, pcrp->tag, PCIGETMEMORY64(basep[i-1]), - pcrp->basesize[i-1], ResExcMemBlock) -#else - if (basep[i]) - continue; - P_M_RANGE(range, pcrp->tag, PCIGETMEMORY(basep[i-1]), - pcrp->basesize[i-1], ResExcMemBlock) -#endif - } - Sys = xf86AddResToList(Sys, &range, -1); - } - } - if ((pcrp->pci_baserom) && - (pcrp->pci_command & PCI_CMD_MEM_ENABLE) && - (pcrp->pci_baserom & PCI_MAP_ROM_DECODE_ENABLE)) { - P_M_RANGE(range,pcrp->tag,PCIGETROM(pcrp->pci_baserom), - pcrp->basesize[6],ResExcMemBlock); - Sys = xf86AddResToList(Sys, &range, -1); - } - } -#ifdef DEBUG - xf86MsgVerb(X_INFO, 3,"Sys:\n"); - xf86PrintResList(3,Sys); -#endif - - /* - * The order the video devices are listed in is - * just right: the lower buses come first. - * This way we attempt to fix a conflict of - * a lower bus device with a higher bus device - * where we have more room to find different - * resources. - */ - while ((pvp = xf86PciVideoInfo[n++])) { - resPtr res_mp = NULL, res_m_io = NULL; - resPtr NonSys; - resPtr tmp, avoid = NULL; - - if (!pvp->validate) continue; - NonSys = xf86DupResList(Sys); - m = n; - while ((pvp1 = xf86PciVideoInfo[m++])) { - if (!pvp1->validate) continue; - for (i = 0; i<6; i++) { - if (pvp1->ioBase[i]) { - PV_I_RANGE(range,pvp1,i,ResExcIoBlock); - NonSys = xf86AddResToList(NonSys,&range,-1); - } else if (pvp1->memBase[i]) { - PV_M_RANGE(range,pvp1,i,ResExcMemBlock); - NonSys = xf86AddResToList(NonSys,&range,-1); - } - } - } -#ifdef DEBUG - xf86MsgVerb(X_INFO, 3,"NonSys:\n"); - xf86PrintResList(3,NonSys); -#endif - pbp = xf86PciBus; - while (pbp) { - if (pbp->secondary == pvp->bus) { - if (pbp->preferred_pmem) { - /* keep prefetchable separate */ - res_mp = - xf86FindIntersectOfLists(pbp->preferred_pmem, ResRange); - } - if (pbp->pmem) { - res_mp = xf86FindIntersectOfLists(pbp->pmem, ResRange); - } - if (pbp->preferred_mem) { - res_m_io = - xf86FindIntersectOfLists(pbp->preferred_mem, ResRange); - } - if (pbp->mem) { - res_m_io = xf86FindIntersectOfLists(pbp->mem, ResRange); - } - if (pbp->preferred_io) { - res_m_io = xf86JoinResLists(res_m_io, - xf86FindIntersectOfLists(pbp->preferred_io, ResRange)); - } - if (pbp->io) { - res_m_io = xf86JoinResLists(res_m_io, - xf86FindIntersectOfLists(pbp->preferred_io, ResRange)); - } - } else if ((pbp->primary == pvp->bus) && - (pbp->secondary >= 0) && - (pbp->primary != pbp->secondary)) { - tmp = xf86DupResList(pbp->preferred_pmem); - avoid = xf86JoinResLists(avoid, tmp); - tmp = xf86DupResList(pbp->preferred_mem); - avoid = xf86JoinResLists(avoid, tmp); - tmp = xf86DupResList(pbp->preferred_io); - avoid = xf86JoinResLists(avoid, tmp); - } - pbp = pbp->next; - } - if (res_m_io == NULL) - res_m_io = xf86DupResList(ResRange); - - pciConvertListToHost(pvp->bus,pvp->device,pvp->func, avoid); - -#ifdef DEBUG - xf86MsgVerb(X_INFO, 3,"avoid:\n"); - xf86PrintResList(3,avoid); - xf86MsgVerb(X_INFO, 3,"prefetchable Memory:\n"); - xf86PrintResList(3,res_mp); - xf86MsgVerb(X_INFO, 3,"MEM/IO:\n"); - xf86PrintResList(3,res_m_io); -#endif - for (i = 0; i < 6; i++) { - int j; - resPtr own = NULL; - for (j = i+1; j < 6; j++) { - if (pvp->ioBase[j]) { - PV_I_RANGE(range,pvp,j,ResExcIoBlock); - own = xf86AddResToList(own,&range,-1); - } else if (pvp->memBase[j]) { - PV_M_RANGE(range,pvp,j,ResExcMemBlock); - own = xf86AddResToList(own,&range,-1); - } - } -#ifdef DEBUG - xf86MsgVerb(X_INFO, 3, "own:\n"); - xf86PrintResList(3, own); -#endif - if (pvp->ioBase[i]) { - PV_I_RANGE(range,pvp,i,ResExcIoBlock); - if (xf86IsSubsetOf(range,res_m_io) - && ! ChkConflict(&range,own,SETUP) - && ! ChkConflict(&range,avoid,SETUP) - && ! ChkConflict(&range,NonSys,SETUP)) { - xf86FreeResList(own); - continue; - } - xf86MsgVerb(X_WARNING, 0, - "****INVALID IO ALLOCATION**** b: 0x%lx e: 0x%lx " - "correcting\a\n", range.rBegin,range.rEnd); -#ifdef DEBUG - sleep(2); -#endif - fixPciResource(i, 0, pvp, range.type); - } else if (pvp->memBase[i]) { - PV_M_RANGE(range,pvp,i,ResExcMemBlock); - if (pvp->type[i] & PCI_MAP_MEMORY_CACHABLE) { - if (xf86IsSubsetOf(range,res_mp) - && ! ChkConflict(&range,own,SETUP) - && ! ChkConflict(&range,avoid,SETUP) - && ! ChkConflict(&range,NonSys,SETUP)) { - xf86FreeResList(own); - continue; - } - } - if (xf86IsSubsetOf(range,res_m_io) - && ! ChkConflict(&range,own,SETUP) - && ! ChkConflict(&range,avoid,SETUP) - && ! ChkConflict(&range,NonSys,SETUP)) { - xf86FreeResList(own); - continue; - } - xf86MsgVerb(X_WARNING, 0, - "****INVALID MEM ALLOCATION**** b: 0x%lx e: 0x%lx " - "correcting\a\n", range.rBegin,range.rEnd); - if (ChkConflict(&range,own,SETUP)) { - xf86MsgVerb(X_INFO,3,"own\n"); - xf86PrintResList(3,own); - } - if (ChkConflict(&range,avoid,SETUP)) { - xf86MsgVerb(X_INFO,3,"avoid\n"); - xf86PrintResList(3,avoid); - } - if (ChkConflict(&range,NonSys,SETUP)) { - xf86MsgVerb(X_INFO,3,"NonSys\n"); - xf86PrintResList(3,NonSys); - } - -#ifdef DEBUG - sleep(2); -#endif - fixPciResource(i, 0, pvp, range.type); - } - xf86FreeResList(own); - } - xf86FreeResList(avoid); - xf86FreeResList(NonSys); - xf86FreeResList(res_mp); - xf86FreeResList(res_m_io); - } - xf86FreeResList(Sys); -} - -resList -GetImplicitPciResources(int entityIndex) -{ - pciVideoPtr pvp; - int i; - resList list = NULL; - int num = 0; - - if (! (pvp = xf86GetPciInfoForEntity(entityIndex))) return NULL; - - for (i = 0; i < 6; i++) { - if (pvp->ioBase[i]) { - list = xnfrealloc(list,sizeof(resRange) * (++num)); - PV_I_RANGE(list[num - 1],pvp,i,ResShrIoBlock | ResBios); - } else if (pvp->memBase[i]) { - list = xnfrealloc(list,sizeof(resRange) * (++num)); - PV_M_RANGE(list[num - 1],pvp,i,ResShrMemBlock | ResBios); - } - } -#if 0 - if (pvp->biosBase) { - list = xnfrealloc(list,sizeof(resRange) * (++num)); - PV_B_RANGE(list[num - 1],pvp,ResShrMemBlock | ResBios); - } -#endif - list = xnfrealloc(list,sizeof(resRange) * (++num)); - list[num - 1].type = ResEnd; - - return list; -} - -void -initPciState(void) -{ - int i = 0; - int j = 0; - pciVideoPtr pvp; - pciAccPtr pcaccp; - - if (xf86PciAccInfo != NULL) - return; - - if (xf86PciVideoInfo == NULL) - return; - - while ((pvp = xf86PciVideoInfo[i]) != NULL) { - i++; - j++; - xf86PciAccInfo = xnfrealloc(xf86PciAccInfo, - sizeof(pciAccPtr) * (j + 1)); - xf86PciAccInfo[j] = NULL; - pcaccp = xf86PciAccInfo[j - 1] = xnfalloc(sizeof(pciAccRec)); - pcaccp->busnum = pvp->bus; - pcaccp->devnum = pvp->device; - pcaccp->funcnum = pvp->func; - pcaccp->arg.tag = pciTag(pvp->bus, pvp->device, pvp->func); - pcaccp->ioAccess.AccessDisable = pciIoAccessDisable; - pcaccp->ioAccess.AccessEnable = pciIoAccessEnable; - pcaccp->ioAccess.arg = &pcaccp->arg; - pcaccp->io_memAccess.AccessDisable = pciIo_MemAccessDisable; - pcaccp->io_memAccess.AccessEnable = pciIo_MemAccessEnable; - pcaccp->io_memAccess.arg = &pcaccp->arg; - pcaccp->memAccess.AccessDisable = pciMemAccessDisable; - pcaccp->memAccess.AccessEnable = pciMemAccessEnable; - pcaccp->memAccess.arg = &pcaccp->arg; - if (PCISHAREDIOCLASSES(pvp->class, pvp->subclass)) - pcaccp->ctrl = TRUE; - else - pcaccp->ctrl = FALSE; - savePciState(pcaccp->arg.tag, &pcaccp->save); - pcaccp->arg.ctrl = pcaccp->save.command; - } -} - -/* - * initPciBusState() - fill out the BusAccRec for a PCI bus. - * Theory: each bus is associated with one bridge connecting it - * to its parent bus. The address of a bridge is therefore stored - * in the BusAccRec of the bus it connects to. Each bus can - * have several bridges connecting secondary buses to it. Only one - * of these bridges can be open. Therefore the status of a bridge - * associated with a bus is stored in the BusAccRec of the parent - * the bridge connects to. The first member of the structure is - * a pointer to a function that open access to this bus. This function - * receives a pointer to the structure itself as argument. This - * design should be common to BusAccRecs of any type of buses we - * support. The remeinder of the structure is bus type specific. - * In this case it contains a pointer to the structure of the - * parent bus. Thus enabling access to a specific bus is simple: - * 1. Close any bridge going to secondary buses. - * 2. Climb down the ladder and enable any bridge on buses - * on the path from the CPU to this bus. - */ - -void -initPciBusState(void) -{ - BusAccPtr pbap, pbap_tmp; - PciBusPtr pbp = xf86PciBus; - pciBusInfo_t *pBusInfo; - - while (pbp) { - pbap = xnfcalloc(1,sizeof(BusAccRec)); - pbap->busdep.pci.bus = pbp->secondary; - pbap->busdep.pci.primary_bus = pbp->primary; - pbap->busdep_type = BUS_PCI; - pbap->busdep.pci.acc = PCITAG_SPECIAL; - - if ((pbp->secondary >= 0) && (pbp->secondary < pciNumBuses) && - (pBusInfo = pciBusInfo[pbp->secondary]) && - pBusInfo->funcs->pciControlBridge) { - pbap->type = BUS_PCI; - pbap->save_f = savePciDrvBusState; - pbap->restore_f = restorePciDrvBusState; - pbap->set_f = pciSetBusAccess; - pbap->enable_f = pciDrvBusAccessEnable; - pbap->disable_f = pciDrvBusAccessDisable; - savePciDrvBusState(pbap); - } else switch (pbp->subclass) { - case PCI_SUBCLASS_BRIDGE_HOST: - pbap->type = BUS_PCI; - pbap->set_f = pciSetBusAccess; - break; - case PCI_SUBCLASS_BRIDGE_PCI: - case PCI_SUBCLASS_BRIDGE_CARDBUS: - pbap->type = BUS_PCI; - pbap->save_f = savePciBusState; - pbap->restore_f = restorePciBusState; - pbap->set_f = pciSetBusAccess; - pbap->enable_f = pciBusAccessEnable; - pbap->disable_f = pciBusAccessDisable; - pbap->busdep.pci.acc = pciTag(pbp->brbus,pbp->brdev,pbp->brfunc); - savePciBusState(pbap); - break; - case PCI_SUBCLASS_BRIDGE_ISA: - case PCI_SUBCLASS_BRIDGE_EISA: - case PCI_SUBCLASS_BRIDGE_MC: - pbap->type = BUS_ISA; - pbap->set_f = pciSetBusAccess; - break; - } - pbap->next = xf86BusAccInfo; - xf86BusAccInfo = pbap; - pbp = pbp->next; - } - - pbap = xf86BusAccInfo; - - while (pbap) { - pbap->primary = NULL; - if (pbap->busdep_type == BUS_PCI - && pbap->busdep.pci.primary_bus > -1) { - pbap_tmp = xf86BusAccInfo; - while (pbap_tmp) { - if (pbap_tmp->busdep_type == BUS_PCI && - pbap_tmp->busdep.pci.bus == pbap->busdep.pci.primary_bus) { - /* Don't create loops */ - if (pbap == pbap_tmp) - break; - pbap->primary = pbap_tmp; - break; - } - pbap_tmp = pbap_tmp->next; - } - } - pbap = pbap->next; - } -} - -void -PciStateEnter(void) -{ - pciAccPtr paccp; - int i = 0; - - if (xf86PciAccInfo == NULL) - return; - - while ((paccp = xf86PciAccInfo[i]) != NULL) { - i++; - if (!paccp->ctrl) - continue; - savePciState(paccp->arg.tag, &paccp->save); - restorePciState(paccp->arg.tag, &paccp->restore); - paccp->arg.ctrl = paccp->restore.command; - } -} - -void -PciBusStateEnter(void) -{ - BusAccPtr pbap = xf86BusAccInfo; - - while (pbap) { - if (pbap->save_f) - pbap->save_f(pbap); - pbap = pbap->next; - } -} - -void -PciStateLeave(void) -{ - pciAccPtr paccp; - int i = 0; - - if (xf86PciAccInfo == NULL) - return; - - while ((paccp = xf86PciAccInfo[i]) != NULL) { - i++; - if (!paccp->ctrl) - continue; - savePciState(paccp->arg.tag, &paccp->restore); - restorePciState(paccp->arg.tag, &paccp->save); - } -} - -void -PciBusStateLeave(void) -{ - BusAccPtr pbap = xf86BusAccInfo; - - while (pbap) { - if (pbap->restore_f) - pbap->restore_f(pbap); - pbap = pbap->next; - } -} - -void -DisablePciAccess(void) -{ - int i = 0; - pciAccPtr paccp; - if (xf86PciAccInfo == NULL) - return; - - while ((paccp = xf86PciAccInfo[i]) != NULL) { - i++; - if (!paccp->ctrl) /* disable devices that are under control initially*/ - continue; - pciIo_MemAccessDisable(paccp->io_memAccess.arg); - } -} - -void -DisablePciBusAccess(void) -{ - BusAccPtr pbap = xf86BusAccInfo; - - while (pbap) { - if (pbap->disable_f) - pbap->disable_f(pbap); - if (pbap->primary) - pbap->primary->current = NULL; - pbap = pbap->next; - } -} - -/* - * Public functions - */ - -Bool -xf86IsPciDevPresent(int bus, int dev, int func) -{ - int i = 0; - pciConfigPtr pcp; - - while ((pcp = xf86PciInfo[i]) != NULL) { - if ((pcp->busnum == bus) - && (pcp->devnum == dev) - && (pcp->funcnum == func)) - return TRUE; - i++; - } - return FALSE; -} - -/* - * If the slot requested is already in use, return -1. - * Otherwise, claim the slot for the screen requesting it. - */ - -int -xf86ClaimPciSlot(int bus, int device, int func, DriverPtr drvp, - int chipset, GDevPtr dev, Bool active) -{ - EntityPtr p = NULL; - pciAccPtr *ppaccp = xf86PciAccInfo; - BusAccPtr pbap = xf86BusAccInfo; - - int num; - - if (xf86CheckPciSlot(bus, device, func)) { - num = xf86AllocateEntity(); - p = xf86Entities[num]; - p->driver = drvp; - p->chipset = chipset; - p->busType = BUS_PCI; - p->pciBusId.bus = bus; - p->pciBusId.device = device; - p->pciBusId.func = func; - p->active = active; - p->inUse = FALSE; - if (dev) - xf86AddDevToEntity(num, dev); - /* Here we initialize the access structure */ - p->access = xnfcalloc(1,sizeof(EntityAccessRec)); - while (ppaccp && *ppaccp) { - if ((*ppaccp)->busnum == bus - && (*ppaccp)->devnum == device - && (*ppaccp)->funcnum == func) { - p->access->fallback = &(*ppaccp)->io_memAccess; - p->access->pAccess = &(*ppaccp)->io_memAccess; - (*ppaccp)->ctrl = TRUE; /* mark control if not already */ - break; - } - ppaccp++; - } - if (!ppaccp || !*ppaccp) { - p->access->fallback = &AccessNULL; - p->access->pAccess = &AccessNULL; - } - - p->busAcc = NULL; - while (pbap) { - if (pbap->type == BUS_PCI && pbap->busdep.pci.bus == bus) - p->busAcc = pbap; - pbap = pbap->next; - } - fixPciSizeInfo(num); - - /* in case bios is enabled disable it */ - disablePciBios(pciTag(bus,device,func)); - pciSlotClaimed = TRUE; - - if (active) { - /* Map in this domain's I/O space */ - p->domainIO = xf86MapDomainIO(-1, VIDMEM_MMIO, - pciTag(bus, device, func), 0, 1); - } - - return num; - } else - return -1; -} - -/* - * Get xf86PciVideoInfo for a driver. - */ -pciVideoPtr * -xf86GetPciVideoInfo(void) -{ - return xf86PciVideoInfo; -} - -/* --- Used by ATI driver, but also more generally useful */ - -/* - * Get the full xf86scanpci data. - */ -pciConfigPtr * -xf86GetPciConfigInfo(void) -{ - return xf86PciInfo; -} - -/* - * Enable a device and route VGA to it. This is intended for a driver's - * Probe(), before creating EntityRec's. Only one device can be thus enabled - * at any one time, and should be disabled when the driver is done with it. - * - * The following special calls are also available: - * - * pvp == NULL && rt == NONE disable previously enabled device - * pvp != NULL && rt == NONE ensure device is disabled - * pvp == NULL && rt != NONE disable >all< subsequent calls to this function - * (done from xf86PostProbe()) - * The last combination has been removed! To do this cleanly we have - * to implement stages and need to test at each stage dependent function - * if it is allowed to execute. - * - * The device represented by pvp may not have been previously claimed. - */ -void -xf86SetPciVideo(pciVideoPtr pvp, resType rt) -{ - static BusAccPtr pbap = NULL; - static xf86AccessPtr pAcc = NULL; - static Bool DoneProbes = FALSE; - pciAccPtr pcaccp; - int i; - - if (DoneProbes) - return; - - /* Disable previous access */ - if (pAcc) { - if (pAcc->AccessDisable) - (*pAcc->AccessDisable)(pAcc->arg); - pAcc = NULL; - } - if (pbap) { - while (pbap->primary) { - if (pbap->disable_f) - (*pbap->disable_f)(pbap); - pbap->primary->current = NULL; - pbap = pbap->primary; - } - pbap = NULL; - } - - /* Check for xf86PostProbe's magic combo */ - if (!pvp) { - if (rt != NONE) - DoneProbes = TRUE; - return; - } - - /* Validate device */ - if (!xf86PciVideoInfo || !xf86PciAccInfo || !xf86BusAccInfo) - return; - - for (i = 0; pvp != xf86PciVideoInfo[i]; i++) - if (!xf86PciVideoInfo[i]) - return; - - /* Ignore request for claimed adapters */ - if (!xf86CheckPciSlot(pvp->bus, pvp->device, pvp->func)) - return; - - /* Find pciAccRec structure */ - for (i = 0; ; i++) { - if (!(pcaccp = xf86PciAccInfo[i])) - return; - if ((pvp->bus == pcaccp->busnum) && - (pvp->device == pcaccp->devnum) && - (pvp->func == pcaccp->funcnum)) - break; - } - - if (rt == NONE) { - /* This is a call to ensure the adapter is disabled */ - if (pcaccp->io_memAccess.AccessDisable) - (*pcaccp->io_memAccess.AccessDisable)(pcaccp->io_memAccess.arg); - return; - } - - /* Find BusAccRec structure */ - for (pbap = xf86BusAccInfo; ; pbap = pbap->next) { - if (!pbap) - return; - if (pvp->bus == pbap->busdep.pci.bus) - break; - } - - /* Route VGA */ - if (pbap->set_f) - (*pbap->set_f)(pbap); - - /* Enable device */ - switch (rt) { - case IO: - pAcc = &pcaccp->ioAccess; - break; - case MEM_IO: - pAcc = &pcaccp->io_memAccess; - break; - case MEM: - pAcc = &pcaccp->memAccess; - break; - default: /* no compiler noise */ - break; - } - - if (pAcc && pAcc->AccessEnable) - (*pAcc->AccessEnable)(pAcc->arg); -} - -/* - * Parse a BUS ID string, and return the PCI bus parameters if it was - * in the correct format for a PCI bus id. - */ - -Bool -xf86ParsePciBusString(const char *busID, int *bus, int *device, int *func) -{ - /* - * The format is assumed to be "bus[@domain]:device[:func]", where domain, - * bus, device and func are decimal integers. domain and func may be - * omitted and assumed to be zero, although doing this isn't encouraged. - */ - - char *p, *s, *d; - const char *id; - int i; - - if (StringToBusType(busID, &id) != BUS_PCI) - return FALSE; - - s = xstrdup(id); - p = strtok(s, ":"); - if (p == NULL || *p == 0) { - xfree(s); - return FALSE; - } - d = strpbrk(p, "@"); - if (d != NULL) { - *(d++) = 0; - for (i = 0; d[i] != 0; i++) { - if (!isdigit(d[i])) { - xfree(s); - return FALSE; - } - } - } - for (i = 0; p[i] != 0; i++) { - if (!isdigit(p[i])) { - xfree(s); - return FALSE; - } - } - *bus = atoi(p); - if (d != NULL && *d != 0) - *bus += atoi(d) << 8; - p = strtok(NULL, ":"); - if (p == NULL || *p == 0) { - xfree(s); - return FALSE; - } - for (i = 0; p[i] != 0; i++) { - if (!isdigit(p[i])) { - xfree(s); - return FALSE; - } - } - *device = atoi(p); - *func = 0; - p = strtok(NULL, ":"); - if (p == NULL || *p == 0) { - xfree(s); - return TRUE; - } - for (i = 0; p[i] != 0; i++) { - if (!isdigit(p[i])) { - xfree(s); - return FALSE; - } - } - *func = atoi(p); - xfree(s); - return TRUE; -} - -/* - * Compare a BUS ID string with a PCI bus id. Return TRUE if they match. - */ - -Bool -xf86ComparePciBusString(const char *busID, int bus, int device, int func) -{ - int ibus, idevice, ifunc; - - if (xf86ParsePciBusString(busID, &ibus, &idevice, &ifunc)) { - return bus == ibus && device == idevice && func == ifunc; - } else { - return FALSE; - } -} - -/* - * xf86IsPrimaryPci() -- return TRUE if primary device - * is PCI and bus, dev and func numbers match. - */ - -Bool -xf86IsPrimaryPci(pciVideoPtr pPci) -{ - if (primaryBus.type != BUS_PCI) return FALSE; - return (pPci->bus == primaryBus.id.pci.bus && - pPci->device == primaryBus.id.pci.device && - pPci->func == primaryBus.id.pci.func); -} - -/* - * xf86CheckPciGAType() -- return type of PCI graphics adapter. - */ -int -xf86CheckPciGAType(pciVideoPtr pPci) -{ - int i = 0; - pciConfigPtr pcp; - - while ((pcp = xf86PciInfo[i]) != NULL) { - if (pPci->bus == pcp->busnum && pPci->device == pcp->devnum - && pPci->func == pcp->funcnum) { - if (pcp->pci_base_class == PCI_CLASS_PREHISTORIC && - pcp->pci_sub_class == PCI_SUBCLASS_PREHISTORIC_VGA) - return PCI_CHIP_VGA ; - if (pcp->pci_base_class == PCI_CLASS_DISPLAY && - pcp->pci_sub_class == PCI_SUBCLASS_DISPLAY_VGA) { - if (pcp->pci_prog_if == 0) - return PCI_CHIP_VGA ; - if (pcp->pci_prog_if == 1) - return PCI_CHIP_8514; - } - return -1; - } - i++; - } - return -1; -} - -/* - * xf86GetPciInfoForEntity() -- Get the pciVideoRec of entity. - */ -pciVideoPtr -xf86GetPciInfoForEntity(int entityIndex) -{ - pciVideoPtr *ppPci; - EntityPtr p; - - if (entityIndex >= xf86NumEntities) - return NULL; - - p = xf86Entities[entityIndex]; - if (p->busType != BUS_PCI) - return NULL; - - for (ppPci = xf86PciVideoInfo; *ppPci != NULL; ppPci++) { - if (p->pciBusId.bus == (*ppPci)->bus && - p->pciBusId.device == (*ppPci)->device && - p->pciBusId.func == (*ppPci)->func) - return (*ppPci); - } - return NULL; -} - -int -xf86GetPciEntity(int bus, int dev, int func) -{ - int i; - - for (i = 0; i < xf86NumEntities; i++) { - EntityPtr p = xf86Entities[i]; - if (p->busType != BUS_PCI) continue; - - if (p->pciBusId.bus == bus && - p->pciBusId.device == dev && - p->pciBusId.func == func) - return i; - } - return -1; -} - -/* - * xf86CheckPciMemBase() checks that the memory base value matches one of the - * PCI base address register values for the given PCI device. - */ -Bool -xf86CheckPciMemBase(pciVideoPtr pPci, memType base) -{ - int i; - - for (i = 0; i < 6; i++) - if (base == pPci->memBase[i]) - return TRUE; - return FALSE; -} - -/* - * Check if the slot requested is free. If it is already in use, return FALSE. - */ - -Bool -xf86CheckPciSlot(int bus, int device, int func) -{ - int i; - EntityPtr p; - - for (i = 0; i < xf86NumEntities; i++) { - p = xf86Entities[i]; - /* Check if this PCI slot is taken */ - if (p->busType == BUS_PCI && p->pciBusId.bus == bus && - p->pciBusId.device == device && p->pciBusId.func == func) - return FALSE; - } - - return TRUE; -} - - -/* - * This used to load the scanpci module. The pcidata module is now used - * (which the server always loads early). The main difference between the - * two modules is size, and the scanpci module should only ever be loaded - * when the X server is run with the -scanpci flag. - * - * To make sure that the required information is present in the pcidata - * module, add a PCI_VENDOR_* macro for the relevant vendor to xf86PciInfo.h, - * and add the class override data to ../etc/extrapci.ids. - */ - -static void -getPciClassFlags(pciConfigPtr *pcrpp) -{ - pciConfigPtr pcrp; - int i = 0; - - if (!pcrpp) - return; - while ((pcrp = pcrpp[i])) { - if (!(pcrp->listed_class = - xf86FindPciClassBySubsys(pcrp->pci_subsys_vendor, - pcrp->pci_subsys_card))) { - pcrp->listed_class = - xf86FindPciClassByDevice(pcrp->pci_vendor, pcrp->pci_device); - } - i++; - } -} - -/* - * xf86FindPciVendorDevice() xf86FindPciClass(): These functions - * are meant to be used by the pci bios emulation. Some bioses - * need to see if there are _other_ chips of the same type around - * so by setting pvp_exclude one pci device can be explicitely - * _excluded if required. - */ -pciVideoPtr -xf86FindPciDeviceVendor(CARD16 vendorID, CARD16 deviceID, - char n, pciVideoPtr pvp_exclude) -{ - pciVideoPtr pvp, *ppvp; - n++; - - for (ppvp = xf86PciVideoInfo, pvp =*ppvp; pvp ; pvp = *(++ppvp)) { - if (pvp == pvp_exclude) continue; - if ((pvp->vendor == vendorID) && (pvp->chipType == deviceID)) { - if (!(--n)) break; - } - } - return pvp; -} - -pciVideoPtr -xf86FindPciClass(CARD8 intf, CARD8 subClass, CARD16 class, - char n, pciVideoPtr pvp_exclude) -{ - pciVideoPtr pvp, *ppvp; - n++; - - for (ppvp = xf86PciVideoInfo, pvp =*ppvp; pvp ; pvp = *(++ppvp)) { - if (pvp == pvp_exclude) continue; - if ((pvp->interface == intf) && (pvp->subclass == subClass) - && (pvp->class == class)) { - if (!(--n)) break; - } - } - return pvp; -} - -/* - * This attempts to detect a multi-device card and sets up a list - * of pci tags of the devices of this card. On some of these - * cards the BIOS is not visible from all chipsets. We therefore - * need to use the BIOS from a chipset where it is visible. - * We do the following heuristics: - * If we detect only identical pci devices on a bus we assume it's - * a multi-device card. This assumption isn't true always, however. - * One might just use identical cards on a bus. We therefore don't - * detect this situation when we set up the PCI video info. Instead - * we wait until an attempt to read the BIOS fails. - */ -int -pciTestMultiDeviceCard(int bus, int dev, int func, PCITAG** pTag) -{ - pciConfigPtr *ppcrp = xf86PciInfo; - pciConfigPtr pcrp = NULL; - int i,j; - Bool multicard = FALSE; - Bool multifunc = FALSE; - char str[256]; - char *str1; - - str1 = str; - if (!pTag) - return 0; - - *pTag = NULL; - - for (i=0; i < 8; i++) { - j = 0; - - while (ppcrp[j]) { - if (ppcrp[j]->busnum == bus && ppcrp[j]->funcnum == i) { - pcrp = ppcrp[j]; - break; - } - j++; - } - - if (!pcrp) return 0; - - /* - * we check all functions here: since multifunc devices need - * to implement func 0 we catch all devices on the bus when - * i = 0 - */ - if (pcrp->pci_header_type &0x80) - multifunc = TRUE; - - j = 0; - - while (ppcrp[j]) { - if (ppcrp[j]->busnum == bus && ppcrp[j]->funcnum == i - && ppcrp[j]->devnum != pcrp->devnum) { - /* don't test subsys ID here. It might be set by POST - - however some cards might not have been POSTed */ - if (ppcrp[j]->pci_device_vendor != pcrp->pci_device_vendor - || ppcrp[j]->pci_header_type != pcrp->pci_header_type ) - return 0; - else - multicard = TRUE; - } - j++; - } - if (!multifunc) - break; - } - - if (!multicard) - return 0; - - j = 0; - i = 0; - while (ppcrp[i]) { - if (ppcrp[i]->busnum == bus && ppcrp[i]->funcnum == func) { - str1 += sprintf(str1,"[%x:%x:%x]",ppcrp[i]->busnum, - ppcrp[i]->devnum,ppcrp[i]->funcnum); - *pTag = xnfrealloc(*pTag,sizeof(PCITAG) * (j + 1)); - (*pTag)[j++] = pciTag(ppcrp[i]->busnum, - ppcrp[i]->devnum,ppcrp[i]->funcnum); - } - i++; - } - xf86MsgVerb(X_INFO,3,"Multi Device Card detected: %s\n",str); - return j; -} - -static void -pciTagConvertRange2Host(PCITAG tag, resRange *pRange) -{ - if (!(pRange->type & ResBus)) - return; - - switch(pRange->type & ResPhysMask) { - case ResMem: - switch(pRange->type & ResExtMask) { - case ResBlock: - pRange->rBegin = pciBusAddrToHostAddr(tag,PCI_MEM, pRange->rBegin); - pRange->rEnd = pciBusAddrToHostAddr(tag,PCI_MEM, pRange->rEnd); - break; - case ResSparse: - pRange->rBase = pciBusAddrToHostAddr(tag,PCI_MEM_SPARSE_BASE, - pRange->rBegin); - pRange->rMask = pciBusAddrToHostAddr(tag,PCI_MEM_SPARSE_MASK, - pRange->rEnd); - break; - } - break; - case ResIo: - switch(pRange->type & ResExtMask) { - case ResBlock: - pRange->rBegin = pciBusAddrToHostAddr(tag,PCI_IO, pRange->rBegin); - pRange->rEnd = pciBusAddrToHostAddr(tag,PCI_IO, pRange->rEnd); - break; - case ResSparse: - pRange->rBase = pciBusAddrToHostAddr(tag,PCI_IO_SPARSE_BASE - , pRange->rBegin); - pRange->rMask = pciBusAddrToHostAddr(tag,PCI_IO_SPARSE_MASK - , pRange->rEnd); - break; - } - break; - } - - /* Set domain number */ - pRange->type &= ~(ResDomain | ResBus); - pRange->type |= xf86GetPciDomain(tag) << 24; -} - -static void -pciConvertListToHost(int bus, int dev, int func, resPtr list) -{ - PCITAG tag = pciTag(bus,dev,func); - while (list) { - pciTagConvertRange2Host(tag, &list->val); - list = list->next; - } -} - -static void -updateAccessInfoStatusControlInfo(PCITAG tag, CARD32 ctrl) -{ - int i; - - if (!xf86PciAccInfo) - return; - - for (i = 0; xf86PciAccInfo[i] != NULL; i++) { - if (xf86PciAccInfo[i]->arg.tag == tag) - xf86PciAccInfo[i]->arg.ctrl = ctrl; - } -} - -void -pciConvertRange2Host(int entityIndex, resRange *pRange) -{ - PCITAG tag; - pciVideoPtr pvp; - - pvp = xf86GetPciInfoForEntity(entityIndex); - if (!pvp) return; - tag = TAG(pvp); - pciTagConvertRange2Host(tag, pRange); -} - - -#ifdef INCLUDE_DEPRECATED -void -xf86EnablePciBusMaster(pciVideoPtr pPci, Bool enable) -{ - CARD32 temp; - PCITAG tag; - - if (!pPci) return; - - tag = pciTag(pPci->bus, pPci->device, pPci->func); - temp = pciReadLong(tag, PCI_CMD_STAT_REG); - if (enable) { - updateAccessInfoStatusControlInfo(tag, temp | PCI_CMD_MASTER_ENABLE); - pciWriteLong(tag, PCI_CMD_STAT_REG, temp | PCI_CMD_MASTER_ENABLE); - } else { - updateAccessInfoStatusControlInfo(tag, temp & ~PCI_CMD_MASTER_ENABLE); - pciWriteLong(tag, PCI_CMD_STAT_REG, temp & ~PCI_CMD_MASTER_ENABLE); - } -} -#endif /* INCLUDE_DEPRECATED */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86pciBus.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86pciBus.h deleted file mode 100644 index 75d82fbcf..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86pciBus.h +++ /dev/null @@ -1,99 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h,v 3.10 2003/08/24 17:36:56 dawes Exp $ */ - -/* - * Copyright (c) 1999-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef _XF86_PCI_BUS_H -#define _XF86_PCI_BUS_H - -#define PCITAG_SPECIAL pciTag(0xFF,0xFF,0xFF) - -typedef struct { - CARD32 command; - CARD32 base[6]; - CARD32 biosBase; -} pciSave, *pciSavePtr; - -typedef struct { - PCITAG tag; - CARD32 ctrl; -} pciArg; - -typedef struct { - int busnum; - int devnum; - int funcnum; - pciArg arg; - xf86AccessRec ioAccess; - xf86AccessRec io_memAccess; - xf86AccessRec memAccess; - pciSave save; - pciSave restore; - Bool ctrl; -} pciAccRec, *pciAccPtr; - -typedef union { - CARD16 control; -} pciBridgesSave, *pciBridgesSavePtr; - -typedef struct pciBusRec { - int brbus, brdev, brfunc; /* ID of the bridge to this bus */ - int primary, secondary, subordinate; - int subclass; /* bridge type */ - int interface; - resPtr preferred_io; /* I/O range */ - resPtr preferred_mem; /* non-prefetchable memory range */ - resPtr preferred_pmem; /* prefetchable memory range */ - resPtr io; /* for subtractive PCI-PCI bridges */ - resPtr mem; - resPtr pmem; - int brcontrol; /* bridge_control byte */ - struct pciBusRec *next; -} PciBusRec, *PciBusPtr; - -void xf86PciProbe(void); -void ValidatePci(void); -resList GetImplicitPciResources(int entityIndex); -void initPciState(void); -void initPciBusState(void); -void DisablePciAccess(void); -void DisablePciBusAccess(void); -void PciStateEnter(void); -void PciBusStateEnter(void); -void PciStateLeave(void); -void PciBusStateLeave(void); -resPtr ResourceBrokerInitPci(resPtr *osRes); -void pciConvertRange2Host(int entityIndex, resRange *pRange); -void isaConvertRange2Host(resRange *pRange); - -extern pciAccPtr * xf86PciAccInfo; - -#endif /* _XF86_PCI_BUS_H */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86sbusBus.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86sbusBus.c deleted file mode 100644 index 3d6576f52..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86sbusBus.c +++ /dev/null @@ -1,709 +0,0 @@ -/* - * SBUS bus-specific code. - * - * Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c,v 3.6 2001/03/03 22:16:35 tsi Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86Resources.h" -#include "xf86cmap.h" - -#include "xf86Bus.h" - -#include "xf86sbusBus.h" -#include "xf86Sbus.h" - -Bool sbusSlotClaimed = FALSE; - -static int xf86nSbusInfo; - -static void -CheckSbusDevice(const char *device, int fbNum) -{ - int fd, i; - struct fbgattr fbattr; - sbusDevicePtr psdp; - - fd = open(device, O_RDONLY, 0); - if (fd < 0) - return; - memset(&fbattr, 0, sizeof(fbattr)); - if (ioctl(fd, FBIOGATTR, &fbattr) < 0) { - if (ioctl(fd, FBIOGTYPE, &fbattr.fbtype) < 0) { - close(fd); - return; - } - } - close(fd); - for (i = 0; sbusDeviceTable[i].devId; i++) - if (sbusDeviceTable[i].fbType == fbattr.fbtype.fb_type) - break; - if (! sbusDeviceTable[i].devId) - return; - xf86SbusInfo = xnfrealloc(xf86SbusInfo, sizeof(psdp) * (++xf86nSbusInfo + 1)); - xf86SbusInfo[xf86nSbusInfo] = NULL; - xf86SbusInfo[xf86nSbusInfo - 1] = psdp = xnfcalloc(sizeof (sbusDevice), 1); - psdp->devId = sbusDeviceTable[i].devId; - psdp->fbNum = fbNum; - psdp->device = xnfstrdup(device); - psdp->width = fbattr.fbtype.fb_width; - psdp->height = fbattr.fbtype.fb_height; - psdp->fd = -1; -} - -void -xf86SbusProbe(void) -{ - int i, useProm = 0; - char fbDevName[32]; - sbusDevicePtr psdp, *psdpp; - - xf86SbusInfo = xalloc(sizeof(psdp)); - *xf86SbusInfo = NULL; - for (i = 0; i < 32; i++) { - sprintf(fbDevName, "/dev/fb%d", i); - CheckSbusDevice(fbDevName, i); - } - if (sparcPromInit() >= 0) { - useProm = 1; - sparcPromAssignNodes(); - } - for (psdpp = xf86SbusInfo; (psdp = *psdpp); psdpp++) { - for (i = 0; sbusDeviceTable[i].devId; i++) - if (sbusDeviceTable[i].devId == psdp->devId) - psdp->descr = sbusDeviceTable[i].descr; - /* - * If we can use PROM information and found the PROM node for this - * device, we can tell more about the card. - */ - if (useProm && psdp->node.node) { - char *prop, *promPath; - int len, chiprev, vmsize; - - switch (psdp->devId) { - case SBUS_DEVICE_MGX: - prop = sparcPromGetProperty(&psdp->node, "fb_size", &len); - if (prop && len == 4 && *(int *)prop == 0x400000) - psdp->descr = "Quantum 3D MGXplus with 4M VRAM"; - break; - case SBUS_DEVICE_CG6: - chiprev = 0; - vmsize = 0; - prop = sparcPromGetProperty(&psdp->node, "chiprev", &len); - if (prop && len == 4) - chiprev = *(int *)prop; - prop = sparcPromGetProperty(&psdp->node, "vmsize", &len); - if (prop && len == 4) - vmsize = *(int *)prop; - switch (chiprev) { - case 1: - case 2: - case 3: - case 4: - psdp->descr = "Sun Double width GX"; break; - case 5: - case 6: - case 7: - case 8: - case 9: - psdp->descr = "Sun Single width GX"; break; - case 11: - switch (vmsize) { - case 2: - psdp->descr = "Sun Turbo GX with 1M VSIMM"; break; - case 4: - psdp->descr = "Sun Turbo GX Plus"; break; - default: - psdp->descr = "Sun Turbo GX"; break; - } - } - break; - case SBUS_DEVICE_CG14: - prop = sparcPromGetProperty(&psdp->node, "reg", &len); - vmsize = 0; - if (prop && !(len % 12) && len > 0) - vmsize = *(int *)(prop + len - 4); - switch (vmsize) { - case 0x400000: - psdp->descr = "Sun SX with 4M VSIMM"; break; - case 0x800000: - psdp->descr = "Sun SX with 8M VSIMM"; break; - } - break; - case SBUS_DEVICE_LEO: - prop = sparcPromGetProperty(&psdp->node, "model", &len); - if (prop && len > 0 && !strstr(prop, "501-2503")) - psdp->descr = "Sun Turbo ZX"; - break; - case SBUS_DEVICE_TCX: - if (sparcPromGetBool(&psdp->node, "tcx-8-bit")) - psdp->descr = "Sun TCX (8bit)"; - else - psdp->descr = "Sun TCX (S24)"; - break; - case SBUS_DEVICE_FFB: - prop = sparcPromGetProperty(&psdp->node, "name", &len); - chiprev = 0; - prop = sparcPromGetProperty(&psdp->node, "board_type", &len); - if (prop && len == 4) - chiprev = *(int *)prop; - if (strstr (prop, "afb")) { - if (chiprev == 3) - psdp->descr = "Sun|Elite3D-M6 Horizontal"; - } else { - switch (chiprev) { - case 0x08: - psdp->descr = "Sun FFB 67MHz Creator"; break; - case 0x0b: - psdp->descr = "Sun FFB 67MHz Creator 3D"; break; - case 0x1b: - psdp->descr = "Sun FFB 75MHz Creator 3D"; break; - case 0x20: - case 0x28: - psdp->descr = "Sun FFB2 Vertical Creator"; break; - case 0x23: - case 0x2b: - psdp->descr = "Sun FFB2 Vertical Creator 3D"; break; - case 0x30: - psdp->descr = "Sun FFB2+ Vertical Creator"; break; - case 0x33: - psdp->descr = "Sun FFB2+ Vertical Creator 3D"; break; - case 0x40: - case 0x48: - psdp->descr = "Sun FFB2 Horizontal Creator"; break; - case 0x43: - case 0x4b: - psdp->descr = "Sun FFB2 Horizontal Creator 3D"; break; - } - } - break; - } - - xf86Msg(X_PROBED, "SBUS:(0x%08x) %s", psdp->node.node, psdp->descr); - promPath = sparcPromNode2Pathname (&psdp->node); - if (promPath) { - xf86ErrorF(" at %s", promPath); - xfree(promPath); - } - } else - xf86Msg(X_PROBED, "SBUS: %s", psdp->descr); - xf86ErrorF("\n"); - } - if (useProm) - sparcPromClose(); -} - -/* - * Parse a BUS ID string, and return the SBUS bus parameters if it was - * in the correct format for a SBUS bus id. - */ - -Bool -xf86ParseSbusBusString(const char *busID, int *fbNum) -{ - /* - * The format is assumed to be one of: - * "fbN", e.g. "fb1", which means the device corresponding to /dev/fbN - * "nameN", e.g. "cgsix0", which means Nth instance of card NAME - * "/prompath", e.g. "/sbus@0,10001000/cgsix@3,0" which is PROM pathname - * to the device. - */ - - const char *id; - int i, len; - - if (StringToBusType(busID, &id) != BUS_SBUS) - return FALSE; - - if (*id != '/') { - if (!strncmp (id, "fb", 2)) { - if (!isdigit(id[2])) - return FALSE; - *fbNum = atoi(id + 2); - return TRUE; - } else { - sbusDevicePtr *psdpp; - int devId; - - for (i = 0, len = 0; sbusDeviceTable[i].devId; i++) { - len = strlen(sbusDeviceTable[i].promName); - if (!strncmp (sbusDeviceTable[i].promName, id, len) - && isdigit(id[len])) - break; - } - devId = sbusDeviceTable[i].devId; - if (!devId) return FALSE; - i = atoi(id + len); - for (psdpp = xf86SbusInfo; *psdpp; ++psdpp) { - if ((*psdpp)->devId != devId) - continue; - if (!i) { - *fbNum = (*psdpp)->fbNum; - return TRUE; - } - i--; - } - } - return FALSE; - } - - if (sparcPromInit() >= 0) { - i = sparcPromPathname2Node(id); - sparcPromClose(); - if (i) { - sbusDevicePtr *psdpp; - for (psdpp = xf86SbusInfo; *psdpp; ++psdpp) { - if ((*psdpp)->node.node == i) { - *fbNum = (*psdpp)->fbNum; - return TRUE; - } - } - } - } - return FALSE; -} - -/* - * Compare a BUS ID string with a SBUS bus id. Return TRUE if they match. - */ - -Bool -xf86CompareSbusBusString(const char *busID, int fbNum) -{ - int iFbNum; - - if (xf86ParseSbusBusString(busID, &iFbNum)) { - return fbNum == iFbNum; - } else { - return FALSE; - } -} - -/* - * Check if the slot requested is free. If it is already in use, return FALSE. - */ - -Bool -xf86CheckSbusSlot(int fbNum) -{ - int i; - EntityPtr p; - - for (i = 0; i < xf86NumEntities; i++) { - p = xf86Entities[i]; - /* Check if this SBUS slot is taken */ - if (p->busType == BUS_SBUS && p->sbusBusId.fbNum == fbNum) - return FALSE; - } - - return TRUE; -} - -/* - * If the slot requested is already in use, return -1. - * Otherwise, claim the slot for the screen requesting it. - */ - -int -xf86ClaimSbusSlot(sbusDevicePtr psdp, DriverPtr drvp, - GDevPtr dev, Bool active) -{ - EntityPtr p = NULL; - - int num; - - if (xf86CheckSbusSlot(psdp->fbNum)) { - num = xf86AllocateEntity(); - p = xf86Entities[num]; - p->driver = drvp; - p->chipset = -1; - p->busType = BUS_SBUS; - xf86AddDevToEntity(num, dev); - p->sbusBusId.fbNum = psdp->fbNum; - p->active = active; - p->inUse = FALSE; - /* Here we initialize the access structure */ - p->access = xnfcalloc(1,sizeof(EntityAccessRec)); - p->access->fallback = &AccessNULL; - p->access->pAccess = &AccessNULL; - sbusSlotClaimed = TRUE; - return num; - } else - return -1; -} - -int -xf86MatchSbusInstances(const char *driverName, int sbusDevId, - GDevPtr *devList, int numDevs, DriverPtr drvp, - int **foundEntities) -{ - int i,j; - sbusDevicePtr psdp, *psdpp; - int numClaimedInstances = 0; - int allocatedInstances = 0; - int numFound = 0; - GDevPtr devBus = NULL; - GDevPtr dev = NULL; - int *retEntities = NULL; - int useProm = 0; - - struct Inst { - sbusDevicePtr sbus; - GDevPtr dev; - Bool claimed; /* BusID matches with a device section */ - } *instances = NULL; - - *foundEntities = NULL; - for (psdpp = xf86SbusInfo, psdp = *psdpp; psdp; psdp = *++psdpp) { - if (psdp->devId != sbusDevId) - continue; - if (psdp->fd == -2) - continue; - ++allocatedInstances; - instances = xnfrealloc(instances, - allocatedInstances * sizeof(struct Inst)); - instances[allocatedInstances - 1].sbus = psdp; - instances[allocatedInstances - 1].dev = NULL; - instances[allocatedInstances - 1].claimed = FALSE; - numFound++; - } - - /* - * This may be debatable, but if no SBUS devices with a matching vendor - * type is found, return zero now. It is probably not desirable to - * allow the config file to override this. - */ - if (allocatedInstances <= 0) { - xfree(instances); - return 0; - } - - if (xf86DoProbe) { - xfree(instances); - return numFound; - } - - if (sparcPromInit() >= 0) - useProm = 1; - - if (xf86DoConfigure && xf86DoConfigurePass1) { - GDevPtr pGDev; - int actualcards = 0; - for (i = 0; i < allocatedInstances; i++) { - actualcards++; - pGDev = xf86AddBusDeviceToConfigure(drvp->driverName, BUS_SBUS, - instances[i].sbus, -1); - if (pGDev) { - /* - * XF86Match???Instances() treat chipID and chipRev as - * overrides, so clobber them here. - */ - pGDev->chipID = pGDev->chipRev = -1; - } - } - xfree(instances); - if (useProm) - sparcPromClose(); - return actualcards; - } - -#ifdef DEBUG - ErrorF("%s instances found: %d\n", driverName, allocatedInstances); -#endif - - for (i = 0; i < allocatedInstances; i++) { - char *promPath = NULL; - - psdp = instances[i].sbus; - devBus = NULL; - dev = NULL; - if (useProm && psdp->node.node) - promPath = sparcPromNode2Pathname(&psdp->node); - - for (j = 0; j < numDevs; j++) { - if (devList[j]->busID && *devList[j]->busID) { - if (xf86CompareSbusBusString(devList[j]->busID, psdp->fbNum)) { - if (devBus) - xf86MsgVerb(X_WARNING,0, - "%s: More than one matching Device section for " - "instance (BusID: %s) found: %s\n", - driverName,devList[j]->identifier, - devList[j]->busID); - else - devBus = devList[j]; - } - } else { - if (!dev && !devBus) { - if (promPath) - xf86Msg(X_PROBED, "Assigning device section with no busID to SBUS:%s\n", - promPath); - else - xf86Msg(X_PROBED, "Assigning device section with no busID to SBUS:fb%d\n", - psdp->fbNum); - dev = devList[j]; - } else - xf86MsgVerb(X_WARNING, 0, - "%s: More than one matching Device section " - "found: %s\n", driverName, devList[j]->identifier); - } - } - if (devBus) dev = devBus; /* busID preferred */ - if (!dev && psdp->fd != -2) { - if (promPath) { - xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section " - "for instance (BusID SBUS:%s) found\n", - driverName, promPath); - } else - xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section " - "for instance (BusID SBUS:fb%d) found\n", - driverName, psdp->fbNum); - } else if (dev) { - numClaimedInstances++; - instances[i].claimed = TRUE; - instances[i].dev = dev; - } - if (promPath) - xfree(promPath); - } - -#ifdef DEBUG - ErrorF("%s instances found: %d\n", driverName, numClaimedInstances); -#endif - - /* - * Of the claimed instances, check that another driver hasn't already - * claimed its slot. - */ - numFound = 0; - for (i = 0; i < allocatedInstances && numClaimedInstances > 0; i++) { - if (!instances[i].claimed) - continue; - psdp = instances[i].sbus; - if (!xf86CheckSbusSlot(psdp->fbNum)) - continue; - -#ifdef DEBUG - ErrorF("%s: card at fb%d %08x is claimed by a Device section\n", - driverName, psdp->fbNum, psdp->node.node); -#endif - - /* Allocate an entry in the lists to be returned */ - numFound++; - retEntities = xnfrealloc(retEntities, numFound * sizeof(int)); - retEntities[numFound - 1] - = xf86ClaimSbusSlot(psdp, drvp, instances[i].dev,instances[i].dev->active ? - TRUE : FALSE); - } - xfree(instances); - if (numFound > 0) { - *foundEntities = retEntities; - } - - if (useProm) - sparcPromClose(); - - return numFound; -} - -/* - * xf86GetSbusInfoForEntity() -- Get the sbusDevicePtr of entity. - */ -sbusDevicePtr -xf86GetSbusInfoForEntity(int entityIndex) -{ - sbusDevicePtr *psdpp; - EntityPtr p = xf86Entities[entityIndex]; - - if (entityIndex >= xf86NumEntities - || p->busType != BUS_SBUS) return NULL; - - for (psdpp = xf86SbusInfo; *psdpp != NULL; psdpp++) { - if (p->sbusBusId.fbNum == (*psdpp)->fbNum) - return (*psdpp); - } - return NULL; -} - -int -xf86GetEntityForSbusInfo(sbusDevicePtr psdp) -{ - int i; - - for (i = 0; i < xf86NumEntities; i++) { - EntityPtr p = xf86Entities[i]; - if (p->busType != BUS_SBUS) continue; - - if (p->sbusBusId.fbNum == psdp->fbNum) - return i; - } - return -1; -} - -void -xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp) -{ - DisplayModePtr mode; - - mode = xnfcalloc(sizeof(DisplayModeRec), 1); - mode->name = "current"; - mode->next = mode; - mode->prev = mode; - mode->type = M_T_BUILTIN; - mode->Clock = 100000000; - mode->HDisplay = psdp->width; - mode->HSyncStart = psdp->width; - mode->HSyncEnd = psdp->width; - mode->HTotal = psdp->width; - mode->VDisplay = psdp->height; - mode->VSyncStart = psdp->height; - mode->VSyncEnd = psdp->height; - mode->VTotal = psdp->height; - mode->SynthClock = mode->Clock; - mode->CrtcHDisplay = mode->HDisplay; - mode->CrtcHSyncStart = mode->HSyncStart; - mode->CrtcHSyncEnd = mode->HSyncEnd; - mode->CrtcHTotal = mode->HTotal; - mode->CrtcVDisplay = mode->VDisplay; - mode->CrtcVSyncStart = mode->VSyncStart; - mode->CrtcVSyncEnd = mode->VSyncEnd; - mode->CrtcVTotal = mode->VTotal; - mode->CrtcHAdjusted = FALSE; - mode->CrtcVAdjusted = FALSE; - pScrn->modes = mode; - pScrn->virtualX = psdp->width; - pScrn->virtualY = psdp->height; -} - -static int sbusPaletteIndex = -1; -static unsigned long sbusPaletteGeneration = 0; -typedef struct _sbusCmap { - sbusDevicePtr psdp; - CloseScreenProcPtr CloseScreen; - Bool origCmapValid; - unsigned char origRed[16]; - unsigned char origGreen[16]; - unsigned char origBlue[16]; -} sbusCmapRec, *sbusCmapPtr; - -#define SBUSCMAPPTR(pScreen) ((sbusCmapPtr)((pScreen)->devPrivates[sbusPaletteIndex].ptr)) - -static void -xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, - LOCO *colors, VisualPtr pVisual) -{ - int i, index; - sbusCmapPtr cmap; - struct fbcmap fbcmap; - unsigned char *data = ALLOCATE_LOCAL(numColors*3); - - cmap = SBUSCMAPPTR(pScrn->pScreen); - if (!cmap) return; - fbcmap.count = 0; - fbcmap.index = indices[0]; - fbcmap.red = data; - fbcmap.green = data + numColors; - fbcmap.blue = fbcmap.green + numColors; - for (i = 0; i < numColors; i++) { - index = indices[i]; - if (fbcmap.count && index != fbcmap.index + fbcmap.count) { - ioctl (cmap->psdp->fd, FBIOPUTCMAP, &fbcmap); - fbcmap.count = 0; - fbcmap.index = index; - } - fbcmap.red[fbcmap.count] = colors[index].red; - fbcmap.green[fbcmap.count] = colors[index].green; - fbcmap.blue[fbcmap.count++] = colors[index].blue; - } - ioctl (cmap->psdp->fd, FBIOPUTCMAP, &fbcmap); - DEALLOCATE_LOCAL(data); -} - -static Bool -xf86SbusCmapCloseScreen(int i, ScreenPtr pScreen) -{ - sbusCmapPtr cmap; - struct fbcmap fbcmap; - - cmap = SBUSCMAPPTR(pScreen); - if (cmap->origCmapValid) { - fbcmap.index = 0; - fbcmap.count = 16; - fbcmap.red = cmap->origRed; - fbcmap.green = cmap->origGreen; - fbcmap.blue = cmap->origBlue; - ioctl (cmap->psdp->fd, FBIOPUTCMAP, &fbcmap); - } - pScreen->CloseScreen = cmap->CloseScreen; - xfree (cmap); - return (*pScreen->CloseScreen) (i, pScreen); -} - -Bool -xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp) -{ - sbusCmapPtr cmap; - struct fbcmap fbcmap; - unsigned char data[2]; - - if(sbusPaletteGeneration != serverGeneration) { - if((sbusPaletteIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - sbusPaletteGeneration = serverGeneration; - } - cmap = xnfcalloc(1, sizeof(sbusCmapRec)); - pScreen->devPrivates[sbusPaletteIndex].ptr = cmap; - cmap->psdp = psdp; - fbcmap.index = 0; - fbcmap.count = 16; - fbcmap.red = cmap->origRed; - fbcmap.green = cmap->origGreen; - fbcmap.blue = cmap->origBlue; - if (ioctl (psdp->fd, FBIOGETCMAP, &fbcmap) >= 0) - cmap->origCmapValid = TRUE; - fbcmap.index = 0; - fbcmap.count = 2; - fbcmap.red = data; - fbcmap.green = data; - fbcmap.blue = data; - if (pScreen->whitePixel == 0) { - data[0] = 255; - data[1] = 0; - } else { - data[0] = 0; - data[1] = 255; - } - ioctl (psdp->fd, FBIOPUTCMAP, &fbcmap); - cmap->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = xf86SbusCmapCloseScreen; - return xf86HandleColormaps(pScreen, 256, 8, - xf86SbusCmapLoadPalette, NULL, 0); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86sbusBus.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86sbusBus.h deleted file mode 100644 index 81c1b84ac..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86sbusBus.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * SBUS bus-specific declarations - * - * Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.h,v 3.4 2001/10/28 03:33:19 tsi Exp $ */ - -#ifndef _XF86_SBUSBUS_H -#define _XF86_SBUSBUS_H - -#include "xf86str.h" - -#define SBUS_DEVICE_BW2 0x0001 -#define SBUS_DEVICE_CG2 0x0002 -#define SBUS_DEVICE_CG3 0x0003 -#define SBUS_DEVICE_CG4 0x0004 -#define SBUS_DEVICE_CG6 0x0005 -#define SBUS_DEVICE_CG8 0x0006 -#define SBUS_DEVICE_CG12 0x0007 -#define SBUS_DEVICE_CG14 0x0008 -#define SBUS_DEVICE_LEO 0x0009 -#define SBUS_DEVICE_TCX 0x000a -#define SBUS_DEVICE_FFB 0x000b -#define SBUS_DEVICE_GT 0x000c -#define SBUS_DEVICE_MGX 0x000d - -typedef struct sbus_prom_node { - int node; - /* Because of misdesigned openpromio */ - int cookie[2]; -} sbusPromNode, *sbusPromNodePtr; - -typedef struct sbus_device { - int devId; - int fbNum; - int fd; - int width, height; - sbusPromNode node; - char *descr; - char *device; -} sbusDevice, *sbusDevicePtr; - -extern struct sbus_devtable { - int devId; - int fbType; - char *promName; - char *descr; -} sbusDeviceTable[]; - -void xf86SbusProbe(void); -extern sbusDevicePtr *xf86SbusInfo; - -int xf86MatchSbusInstances(const char *driverName, int sbusDevId, - GDevPtr *devList, int numDevs, DriverPtr drvp, - int **foundEntities); -sbusDevicePtr xf86GetSbusInfoForEntity(int entityIndex); -int xf86GetEntityForSbusInfo(sbusDevicePtr psdp); -void xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp); -pointer xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset, - unsigned long size); -void xf86UnmapSbusMem(sbusDevicePtr psdp, pointer addr, unsigned long size); -void xf86SbusHideOsHwCursor(sbusDevicePtr psdp); -void xf86SbusSetOsHwCursorCmap(sbusDevicePtr psdp, int bg, int fg); -Bool xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp); - -extern int promRootNode; - -int promGetSibling(int node); -int promGetChild(int node); -char * promGetProperty(const char *prop, int *lenp); -int promGetBool(const char *prop); - -int sparcPromInit(void); -void sparcPromClose(void); -char * sparcPromGetProperty(sbusPromNodePtr pnode, const char *prop, int *lenp); -int sparcPromGetBool(sbusPromNodePtr pnode, const char *prop); -void sparcPromAssignNodes(void); -char * sparcPromNode2Pathname(sbusPromNodePtr pnode); -int sparcPromPathname2Node(const char *pathName); - -#endif /* _XF86_SBUSBUS_H */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86str.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86str.h deleted file mode 100644 index 82faaaac1..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86str.h +++ /dev/null @@ -1,1140 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.97 2003/10/30 17:36:56 tsi Exp $ */ - -/* - * Copyright (c) 1997-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * This file contains definitions of the public XFree86 data structures/types. - * Any data structures that video drivers need to access should go here. - */ - -#ifndef _XF86STR_H -#define _XF86STR_H - -#include "misc.h" -#include "input.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "colormapst.h" -#include "xf86Module.h" -#include "xf86Opt.h" -#include "xf86Pci.h" - -/* - * memType is of the size of the addressable memory (machine size) - * usually unsigned long. - */ -typedef unsigned long memType; - -/* Video mode flags */ - -typedef enum { - V_PHSYNC = 0x0001, - V_NHSYNC = 0x0002, - V_PVSYNC = 0x0004, - V_NVSYNC = 0x0008, - V_INTERLACE = 0x0010, - V_DBLSCAN = 0x0020, - V_CSYNC = 0x0040, - V_PCSYNC = 0x0080, - V_NCSYNC = 0x0100, - V_HSKEW = 0x0200, /* hskew provided */ - V_BCAST = 0x0400, - V_PIXMUX = 0x1000, - V_DBLCLK = 0x2000, - V_CLKDIV2 = 0x4000 -} ModeFlags; - -typedef enum { - INTERLACE_HALVE_V = 0x0001 /* Halve V values for interlacing */ -} CrtcAdjustFlags; - -/* Flags passed to ChipValidMode() */ -typedef enum { - MODECHECK_INITIAL = 0, - MODECHECK_FINAL = 1 -} ModeCheckFlags; - -/* These are possible return values for xf86CheckMode() and ValidMode() */ -typedef enum { - MODE_OK = 0, /* Mode OK */ - MODE_HSYNC, /* hsync out of range */ - MODE_VSYNC, /* vsync out of range */ - MODE_H_ILLEGAL, /* mode has illegal horizontal timings */ - MODE_V_ILLEGAL, /* mode has illegal horizontal timings */ - MODE_BAD_WIDTH, /* requires an unsupported linepitch */ - MODE_NOMODE, /* no mode with a maching name */ - MODE_NO_INTERLACE, /* interlaced mode not supported */ - MODE_NO_DBLESCAN, /* doublescan mode not supported */ - MODE_NO_VSCAN, /* multiscan mode not supported */ - MODE_MEM, /* insufficient video memory */ - MODE_VIRTUAL_X, /* mode width too large for specified virtual size */ - MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */ - MODE_MEM_VIRT, /* insufficient video memory given virtual size */ - MODE_NOCLOCK, /* no fixed clock available */ - MODE_CLOCK_HIGH, /* clock required is too high */ - MODE_CLOCK_LOW, /* clock required is too low */ - MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */ - MODE_BAD_HVALUE, /* horizontal timing was out of range */ - MODE_BAD_VVALUE, /* vertical timing was out of range */ - MODE_BAD_VSCAN, /* VScan value out of range */ - MODE_HSYNC_NARROW, /* horizontal sync too narrow */ - MODE_HSYNC_WIDE, /* horizontal sync too wide */ - MODE_HBLANK_NARROW, /* horizontal blanking too narrow */ - MODE_HBLANK_WIDE, /* horizontal blanking too wide */ - MODE_VSYNC_NARROW, /* vertical sync too narrow */ - MODE_VSYNC_WIDE, /* vertical sync too wide */ - MODE_VBLANK_NARROW, /* vertical blanking too narrow */ - MODE_VBLANK_WIDE, /* vertical blanking too wide */ - MODE_PANEL, /* exceeds panel dimensions */ - MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */ - MODE_ONE_WIDTH, /* only one width is supported */ - MODE_ONE_HEIGHT, /* only one height is supported */ - MODE_ONE_SIZE, /* only one resolution is supported */ - MODE_BAD = -2, /* unspecified reason */ - MODE_ERROR = -1 /* error condition */ -} ModeStatus; - -# define M_T_BUILTIN 0x01 /* built-in mode */ -# define M_T_CLOCK_C (0x02 | M_T_BUILTIN) /* built-in mode - configure clock */ -# define M_T_CRTC_C (0x04 | M_T_BUILTIN) /* built-in mode - configure CRTC */ -# define M_T_CLOCK_CRTC_C (M_T_CLOCK_C | M_T_CRTC_C) - /* built-in mode - configure CRTC and clock */ -# define M_T_DEFAULT 0x10 /* (VESA) default modes */ -# define M_T_USERDEF 0x20 /* One of the modes from the config file */ - -/* Video mode */ -typedef struct _DisplayModeRec { - struct _DisplayModeRec * prev; - struct _DisplayModeRec * next; - char * name; /* identifier for the mode */ - ModeStatus status; - int type; - - /* These are the values that the user sees/provides */ - int Clock; /* pixel clock freq (kHz) */ - int HDisplay; /* horizontal timing */ - int HSyncStart; - int HSyncEnd; - int HTotal; - int HSkew; - int VDisplay; /* vertical timing */ - int VSyncStart; - int VSyncEnd; - int VTotal; - int VScan; - int Flags; - - /* These are the values the hardware uses */ - int ClockIndex; - int SynthClock; /* Actual clock freq to - * be programmed (kHz) */ - int CrtcHDisplay; - int CrtcHBlankStart; - int CrtcHSyncStart; - int CrtcHSyncEnd; - int CrtcHBlankEnd; - int CrtcHTotal; - int CrtcHSkew; - int CrtcVDisplay; - int CrtcVBlankStart; - int CrtcVSyncStart; - int CrtcVSyncEnd; - int CrtcVBlankEnd; - int CrtcVTotal; - Bool CrtcHAdjusted; - Bool CrtcVAdjusted; - int PrivSize; - INT32 * Private; - int PrivFlags; - - float HSync, VRefresh; -} DisplayModeRec, *DisplayModePtr; - -/* The monitor description */ - -#define MAX_HSYNC 8 -#define MAX_VREFRESH 8 - -typedef struct { float hi, lo; } range; - -typedef struct { CARD32 red, green, blue; } rgb; - -typedef struct { float red, green, blue; } Gamma; - -/* The permitted gamma range is 1 / GAMMA_MAX <= g <= GAMMA_MAX */ -#define GAMMA_MAX 10.0 -#define GAMMA_MIN (1.0 / GAMMA_MAX) -#define GAMMA_ZERO (GAMMA_MIN / 100.0) - -typedef struct { - char * id; - char * vendor; - char * model; - int nHsync; - range hsync[MAX_HSYNC]; - int nVrefresh; - range vrefresh[MAX_VREFRESH]; - DisplayModePtr Modes; /* Start of the monitor's mode list */ - DisplayModePtr Last; /* End of the monitor's mode list */ - Gamma gamma; /* Gamma of the monitor */ - int widthmm; - int heightmm; - pointer options; - pointer DDC; -} MonRec, *MonPtr; - -/* the list of clock ranges */ -typedef struct x_ClockRange { - struct x_ClockRange *next; - int minClock; /* (kHz) */ - int maxClock; /* (kHz) */ - int clockIndex; /* -1 for programmable clocks */ - Bool interlaceAllowed; - Bool doubleScanAllowed; - int ClockMulFactor; - int ClockDivFactor; - int PrivFlags; -} ClockRange, *ClockRangePtr; - -/* Need to store the strategy with clockRange for VidMode extension */ -typedef struct x_ClockRanges { - struct x_ClockRanges *next; - int minClock; - int maxClock; - int clockIndex; /* -1 for programmable clocks */ - Bool interlaceAllowed; - Bool doubleScanAllowed; - int ClockMulFactor; - int ClockDivFactor; - int PrivFlags; - int strategy; -} ClockRanges, *ClockRangesPtr; - -/* - * The driverFunc. xorgDriverFuncOp specifies the action driver should - * perform. If requested option is not supported function should return - * FALSE. pointer can be used to pass arguments to the function or - * to return data to the caller. - */ -typedef struct _ScrnInfoRec *ScrnInfoPtr; - -/* do not change order */ -typedef enum { - RR_GET_INFO, - RR_SET_CONFIG, - RR_GET_MODE_MM, - GET_REQUIRED_HW_INTERFACES = 10 -} xorgDriverFuncOp; - -typedef Bool xorgDriverFuncProc (ScrnInfoPtr, xorgDriverFuncOp, - pointer); - -/* RR_GET_INFO, RR_SET_CONFIG */ -typedef struct { - int rotation; - int rate; - int width; - int height; -} xorgRRConfig; - -typedef union { - short RRRotations; - xorgRRConfig RRConfig; -} xorgRRRotation, *xorgRRRotationPtr; - -/* RR_GET_MODE_MM */ -typedef struct { - DisplayModePtr mode; - int virtX; - int virtY; - int mmWidth; - int mmHeight; -} xorgRRModeMM, *xorgRRModeMMPtr; - -/* GET_REQUIRED_HW_INTERFACES */ -#define HW_IO 1 -#define HW_MMIO 2 -#define NEED_IO_ENABLED(x) (x & HW_IO) - -typedef CARD32 xorgHWFlags; - -/* - * The driver list struct. This contains the information required for each - * driver before a ScrnInfoRec has been allocated. - */ -struct _DriverRec; - -typedef struct { - int driverVersion; - char * driverName; - void (*Identify)(int flags); - Bool (*Probe)(struct _DriverRec *drv, int flags); - const OptionInfoRec * (*AvailableOptions)(int chipid, int bustype); - pointer module; - int refCount; -} DriverRec1; - -typedef struct _DriverRec { - int driverVersion; - char * driverName; - void (*Identify)(int flags); - Bool (*Probe)(struct _DriverRec *drv, int flags); - const OptionInfoRec * (*AvailableOptions)(int chipid, int bustype); - pointer module; - int refCount; - xorgDriverFuncProc *driverFunc; -} DriverRec, *DriverPtr; - -/* - * AddDriver flags - */ -#define HaveDriverFuncs 1 - - -#ifdef XFree86LOADER -/* - * The optional module list struct. This allows modules exporting helping - * functions to configuration tools, the Xserver, or any other - * application/module interested in such information. - */ -typedef struct _ModuleInfoRec { - int moduleVersion; - char * moduleName; - pointer module; - int refCount; - const OptionInfoRec * (*AvailableOptions)(void *unused); - pointer unused[8]; /* leave some space for more fields */ -} ModuleInfoRec, *ModuleInfoPtr; -#endif - -/* - * These are the private bus types. New types can be added here. Types - * required for the public interface should be added to xf86str.h, with - * function prototypes added to xf86.h. - */ - -/* Tolerate prior #include */ -#if defined(linux) && defined(_INPUT_H) -#undef BUS_NONE -#undef BUS_ISA -#undef BUS_PCI -#undef BUS_SBUS -#undef BUS_last -#endif - -typedef enum { - BUS_NONE, - BUS_ISA, - BUS_PCI, - BUS_SBUS, - BUS_last /* Keep last */ -} BusType; - -typedef struct { - int bus; - int device; - int func; -} PciBusId; - -typedef struct { - unsigned int dummy; -} IsaBusId; - -typedef struct { - int fbNum; -} SbusBusId; - -typedef struct _bus { - BusType type; - union { - IsaBusId isa; - PciBusId pci; - SbusBusId sbus; - } id; -} BusRec, *BusPtr; - -#define MAXCLOCKS 128 -typedef enum { - DAC_BPP8 = 0, - DAC_BPP16, - DAC_BPP24, - DAC_BPP32, - MAXDACSPEEDS -} DacSpeedIndex; - -typedef struct { - char * identifier; - char * vendor; - char * board; - char * chipset; - char * ramdac; - char * driver; - struct _confscreenrec * myScreenSection; - Bool claimed; - int dacSpeeds[MAXDACSPEEDS]; - int numclocks; - int clock[MAXCLOCKS]; - char * clockchip; - char * busID; - Bool active; - Bool inUse; - int videoRam; - int textClockFreq; - unsigned long BiosBase; /* Base address of video BIOS */ - unsigned long MemBase; /* Frame buffer base address */ - unsigned long IOBase; - int chipID; - int chipRev; - pointer options; - int irq; - int screen; /* For multi-CRTC cards */ -} GDevRec, *GDevPtr; - -typedef int (*FindIsaDevProc)(GDevPtr dev); - -typedef struct { - char * identifier; - char * driver; - pointer commonOptions; - pointer extraOptions; -} IDevRec, *IDevPtr; - -typedef struct { - int vendor; - int chipType; - int chipRev; - int subsysVendor; - int subsysCard; - int bus; - int device; - int func; - int class; - int subclass; - int interface; - memType memBase[6]; - memType ioBase[6]; - int size[6]; - unsigned char type[6]; - memType biosBase; - int biosSize; - pointer thisCard; - Bool validSize; - Bool validate; - CARD32 listed_class; -} pciVideoRec, *pciVideoPtr; - -typedef struct { - int frameX0; - int frameY0; - int virtualX; - int virtualY; - int depth; - int fbbpp; - rgb weight; - rgb blackColour; - rgb whiteColour; - int defaultVisual; - char ** modes; - pointer options; -} DispRec, *DispPtr; - -typedef struct _confxvportrec { - char * identifier; - pointer options; -} confXvPortRec, *confXvPortPtr; - -typedef struct _confxvadaptrec { - char * identifier; - int numports; - confXvPortPtr ports; - pointer options; -} confXvAdaptorRec, *confXvAdaptorPtr; - -typedef struct _confscreenrec { - char * id; - int screennum; - int defaultdepth; - int defaultbpp; - int defaultfbbpp; - MonPtr monitor; - GDevPtr device; - int numdisplays; - DispPtr displays; - int numxvadaptors; - confXvAdaptorPtr xvadaptors; - pointer options; -} confScreenRec, *confScreenPtr; - -typedef enum { - PosObsolete = -1, - PosAbsolute = 0, - PosRightOf, - PosLeftOf, - PosAbove, - PosBelow, - PosRelative -} PositionType; - -typedef struct _screenlayoutrec { - confScreenPtr screen; - char * topname; - confScreenPtr top; - char * bottomname; - confScreenPtr bottom; - char * leftname; - confScreenPtr left; - char * rightname; - confScreenPtr right; - PositionType where; - int x; - int y; - char * refname; - confScreenPtr refscreen; -} screenLayoutRec, *screenLayoutPtr; - -typedef struct _serverlayoutrec { - char * id; - screenLayoutPtr screens; - GDevPtr inactives; - IDevPtr inputs; - pointer options; -} serverLayoutRec, *serverLayoutPtr; - -typedef struct _confdribufferrec { - int count; - int size; - enum { - XF86DRI_WC_HINT = 0x0001 /* Placeholder: not implemented */ - } flags; -} confDRIBufferRec, *confDRIBufferPtr; - -typedef struct _confdrirec { - int group; - int mode; - int bufs_count; - confDRIBufferRec *bufs; -} confDRIRec, *confDRIPtr; - -/* These values should be adjusted when new fields are added to ScrnInfoRec */ -#define NUM_RESERVED_INTS 16 -#define NUM_RESERVED_POINTERS 15 -#define NUM_RESERVED_FUNCS 11 - -typedef pointer (*funcPointer)(void); - -/* flags for depth 24 pixmap options */ -typedef enum { - Pix24DontCare = 0, - Pix24Use24, - Pix24Use32 -} Pix24Flags; - -/* Power management events: so far we only support APM */ - -typedef enum { - XF86_APM_UNKNOWN = -1, - XF86_APM_SYS_STANDBY, - XF86_APM_SYS_SUSPEND, - XF86_APM_CRITICAL_SUSPEND, - XF86_APM_USER_STANDBY, - XF86_APM_USER_SUSPEND, - XF86_APM_STANDBY_RESUME, - XF86_APM_NORMAL_RESUME, - XF86_APM_CRITICAL_RESUME, - XF86_APM_LOW_BATTERY, - XF86_APM_POWER_STATUS_CHANGE, - XF86_APM_UPDATE_TIME, - XF86_APM_CAPABILITY_CHANGED, - XF86_APM_STANDBY_FAILED, - XF86_APM_SUSPEND_FAILED -} pmEvent; - -typedef enum { - PM_WAIT, - PM_CONTINUE, - PM_FAILED, - PM_NONE -} pmWait; - -/* - * The IO access enabler struct. This contains the address for - * the IOEnable/IODisable funcs for their specific bus along - * with a pointer to data needed by them - */ -typedef struct _AccessRec { - void (*AccessDisable)(void *arg); - void (*AccessEnable)(void *arg); - void *arg; -} xf86AccessRec, *xf86AccessPtr; - -typedef struct { - xf86AccessPtr mem; - xf86AccessPtr io; - xf86AccessPtr io_mem; -} xf86SetAccessFuncRec, *xf86SetAccessFuncPtr; - -/* bus-access-related types */ -typedef enum { - NONE, - IO, - MEM_IO, - MEM -} resType; - -typedef struct _EntityAccessRec { - xf86AccessPtr fallback; - xf86AccessPtr pAccess; - resType rt; - pointer busAcc; - struct _EntityAccessRec *next; -} EntityAccessRec, *EntityAccessPtr; - -typedef struct _CurrAccRec { - EntityAccessPtr pMemAccess; - EntityAccessPtr pIoAccess; -} xf86CurrentAccessRec, *xf86CurrentAccessPtr; - -/* new RAC */ - -/* Resource Type values */ -#define ResNone ((unsigned long)(-1)) - -#define ResMem 0x0001 -#define ResIo 0x0002 -#define ResIrq 0x0003 -#define ResDma 0x0004 -#define ResPciCfg 0x000e /* PCI Configuration space */ -#define ResPhysMask 0x000F - -#define ResExclusive 0x0010 -#define ResShared 0x0020 -#define ResAny 0x0040 -#define ResAccMask 0x0070 -#define ResUnused 0x0080 - -#define ResUnusedOpr 0x0100 -#define ResDisableOpr 0x0200 -#define ResOprMask 0x0300 - -#define ResBlock 0x0400 -#define ResSparse 0x0800 -#define ResExtMask 0x0C00 - -#define ResEstimated 0x001000 -#define ResInit 0x002000 -#define ResBios 0x004000 -#define ResMiscMask 0x00F000 - -#define ResBus 0x010000 -#define ResOverlap 0x020000 - -#if defined(__alpha__) && defined(linux) -# define ResDomain 0x1ff000000ul -#else -# define ResDomain 0xff000000ul -#endif -#define ResTypeMask (ResPhysMask | ResDomain) /* For conflict check */ - -#define ResEnd ResNone - -#define ResExcMemBlock (ResMem | ResExclusive | ResBlock) -#define ResExcIoBlock (ResIo | ResExclusive | ResBlock) -#define ResShrMemBlock (ResMem | ResShared | ResBlock) -#define ResShrIoBlock (ResIo | ResShared | ResBlock) -#define ResExcUusdMemBlock (ResMem | ResExclusive | ResUnused | ResBlock) -#define ResExcUusdIoBlock (ResIo | ResExclusive | ResUnused | ResBlock) -#define ResShrUusdMemBlock (ResMem | ResShared | ResUnused | ResBlock) -#define ResShrUusdIoBlock (ResIo | ResShared | ResUnused | ResBlock) -#define ResExcUusdMemSparse (ResMem | ResExclusive | ResUnused | ResSparse) -#define ResExcUusdIoSparse (ResIo | ResExclusive | ResUnused | ResSparse) -#define ResShrUusdMemSparse (ResMem | ResShared | ResUnused | ResSparse) -#define ResShrUusdIoSparse (ResIo | ResShared | ResUnused | ResSparse) - -#define ResExcMemSparse (ResMem | ResExclusive | ResSparse) -#define ResExcIoSparse (ResIo | ResExclusive | ResSparse) -#define ResShrMemSparse (ResMem | ResShared | ResSparse) -#define ResShrIoSparse (ResIo | ResShared | ResSparse) -#define ResUusdMemSparse (ResMem | ResUnused | ResSparse) -#define ResUusdIoSparse (ResIo | ResUnused | ResSparse) - -#define ResIsMem(r) (((r)->type & ResPhysMask) == ResMem) -#define ResIsIo(r) (((r)->type & ResPhysMask) == ResIo) -#define ResIsExclusive(r) (((r)->type & ResAccMask) == ResExclusive) -#define ResIsShared(r) (((r)->type & ResAccMask) == ResShared) -#define ResIsUnused(r) (((r)->type & ResAccMask) == ResUnused) -#define ResIsBlock(r) (((r)->type & ResExtMask) == ResBlock) -#define ResIsSparse(r) (((r)->type & ResExtMask) == ResSparse) -#define ResIsEstimated(r) (((r)->type & ResMiscMask) == ResEstimated) -#define ResCanOverlap(r) (ResIsEstimated(r) || ((r)->type & ResOverlap)) - -typedef struct { - unsigned long type; /* shared, exclusive, unused etc. */ - memType a; - memType b; -} resRange, *resList; - -#define RANGE_TYPE(type, domain) \ - (((unsigned long)(domain) << 24) | ((type) & ~ResBus)) -#define RANGE(r,u,v,t) {\ - (r).a = (u);\ - (r).b = (v);\ - (r).type = (t);\ - } - -#define rBase a -#define rMask b -#define rBegin a -#define rEnd b - -/* resource record */ -typedef struct _resRec *resPtr; -typedef struct _resRec { - resRange val; - int entityIndex; /* who owns the resource */ - resPtr next; -} resRec; - -#define sparse_base val.rBase -#define sparse_mask val.rMask -#define block_begin val.rBegin -#define block_end val.rEnd -#define res_type val.type - -typedef struct { - int numChipset; - resRange *resList; -} IsaChipsets; - -typedef struct { - int numChipset; - int PCIid; - resRange *resList; -} PciChipsets; - -/* Entity properties */ -typedef void (*EntityProc)(int entityIndex,pointer private); - -typedef struct _entityInfo { - int index; - BusRec location; - int chipset; - Bool active; - resPtr resources; - GDevPtr device; - DriverPtr driver; -} EntityInfoRec, *EntityInfoPtr; - -/* server states */ - -typedef enum { - SETUP, - OPERATING -} xf86State; - -typedef enum { - NOTIFY_SETUP_TRANSITION, - NOTIFY_SETUP, - NOTIFY_OPERATING, - NOTIFY_OPERATING_TRANSITION, - NOTIFY_ENABLE, - NOTIFY_ENTER, - NOTIFY_LEAVE -} xf86NotifyState; - -typedef void (*xf86StateChangeNotificationCallbackFunc)(xf86NotifyState state,pointer); - -/* DGA */ - -typedef struct { - int num; /* A unique identifier for the mode (num > 0) */ - DisplayModePtr mode; - int flags; /* DGA_CONCURRENT_ACCESS, etc... */ - int imageWidth; /* linear accessible portion (pixels) */ - int imageHeight; - int pixmapWidth; /* Xlib accessible portion (pixels) */ - int pixmapHeight; /* both fields ignored if no concurrent access */ - int bytesPerScanline; - int byteOrder; /* MSBFirst, LSBFirst */ - int depth; - int bitsPerPixel; - unsigned long red_mask; - unsigned long green_mask; - unsigned long blue_mask; - short visualClass; - int viewportWidth; - int viewportHeight; - int xViewportStep; /* viewport position granularity */ - int yViewportStep; - int maxViewportX; /* max viewport origin */ - int maxViewportY; - int viewportFlags; /* types of page flipping possible */ - int offset; /* offset into physical memory */ - unsigned char *address; /* server's mapped framebuffer */ - int reserved1; - int reserved2; -} DGAModeRec, *DGAModePtr; - -typedef struct { - DGAModePtr mode; - PixmapPtr pPix; -} DGADeviceRec, *DGADevicePtr; - -/* - * Flags for driver Probe() functions. - */ -#define PROBE_DEFAULT 0x00 -#define PROBE_DETECT 0x01 -#define PROBE_TRYHARD 0x02 - -/* - * Driver entry point types - */ - -typedef Bool xf86ProbeProc (DriverPtr, int); -typedef Bool xf86PreInitProc (ScrnInfoPtr, int); -typedef Bool xf86ScreenInitProc (int, ScreenPtr, int, char**); -typedef Bool xf86SwitchModeProc (int, DisplayModePtr, int); -typedef void xf86AdjustFrameProc (int, int, int, int); -typedef Bool xf86EnterVTProc (int, int); -typedef void xf86LeaveVTProc (int, int); -typedef void xf86FreeScreenProc (int, int); -typedef ModeStatus xf86ValidModeProc (int, DisplayModePtr, Bool, int); -typedef void xf86EnableDisableFBAccessProc(int, Bool); -typedef int xf86SetDGAModeProc (int, int, DGADevicePtr); -typedef int xf86ChangeGammaProc (int, Gamma); -typedef void xf86PointerMovedProc (int, int, int); -typedef Bool xf86PMEventProc (int, pmEvent, Bool); -typedef int xf86HandleMessageProc (int, const char*, const char*, char**); -typedef void xf86DPMSSetProc (ScrnInfoPtr, int, int); -typedef void xf86LoadPaletteProc (ScrnInfoPtr, int, int *, LOCO *, VisualPtr); -typedef void xf86SetOverscanProc (ScrnInfoPtr, int); - - -/* - * ScrnInfoRec - * - * There is one of these for each screen, and it holds all the screen-specific - * information. - * - * Note: the size and layout must be kept the same across versions. New - * fields are to be added in place of the "reserved*" fields. No fields - * are to be dependent on compile-time defines. - */ - - -typedef struct _ScrnInfoRec { - int driverVersion; - char * driverName; /* canonical name used in */ - /* the config file */ - ScreenPtr pScreen; /* Pointer to the ScreenRec */ - int scrnIndex; /* Number of this screen */ - Bool configured; /* Is this screen valid */ - int origIndex; /* initial number assigned to - * this screen before - * finalising the number of - * available screens */ - - /* Display-wide screenInfo values needed by this screen */ - int imageByteOrder; - int bitmapScanlineUnit; - int bitmapScanlinePad; - int bitmapBitOrder; - int numFormats; - PixmapFormatRec formats[MAXFORMATS]; - PixmapFormatRec fbFormat; - - int bitsPerPixel; /* fb bpp */ - Pix24Flags pixmap24; /* pixmap pref for depth 24 */ - int depth; /* depth of default visual */ - MessageType depthFrom; /* set from config? */ - MessageType bitsPerPixelFrom; /* set from config? */ - rgb weight; /* r/g/b weights */ - rgb mask; /* rgb masks */ - rgb offset; /* rgb offsets */ - int rgbBits; /* Number of bits in r/g/b */ - Gamma gamma; /* Gamma of the monitor */ - int defaultVisual; /* default visual class */ - int maxHValue; /* max horizontal timing */ - int maxVValue; /* max vertical timing value */ - int virtualX; /* Virtual width */ - int virtualY; /* Virtual height */ - int xInc; /* Horizontal timing increment */ - MessageType virtualFrom; /* set from config? */ - int displayWidth; /* memory pitch */ - int frameX0; /* viewport position */ - int frameY0; - int frameX1; - int frameY1; - int zoomLocked; /* Disallow mode changes */ - DisplayModePtr modePool; /* list of compatible modes */ - DisplayModePtr modes; /* list of actual modes */ - DisplayModePtr currentMode; /* current mode - * This was previously - * overloaded with the modes - * field, which is a pointer - * into a circular list */ - confScreenPtr confScreen; /* Screen config info */ - MonPtr monitor; /* Monitor information */ - DispPtr display; /* Display information */ - int * entityList; /* List of device entities */ - int numEntities; - int widthmm; /* physical display dimensions - * in mm */ - int heightmm; - int xDpi; /* width DPI */ - int yDpi; /* height DPI */ - char * name; /* Name to prefix messages */ - pointer driverPrivate; /* Driver private area */ - DevUnion * privates; /* Other privates can hook in - * here */ - DriverPtr drv; /* xf86DriverList[] entry */ - pointer module; /* Pointer to module head */ - int colorKey; - int overlayFlags; - - /* Some of these may be moved out of here into the driver private area */ - - char * chipset; /* chipset name */ - char * ramdac; /* ramdac name */ - char * clockchip; /* clock name */ - Bool progClock; /* clock is programmable */ - int numClocks; /* number of clocks */ - int clock[MAXCLOCKS]; /* list of clock frequencies */ - int videoRam; /* amount of video ram (kb) */ - unsigned long biosBase; /* Base address of video BIOS */ - unsigned long memPhysBase; /* Physical address of FB */ - unsigned long fbOffset; /* Offset of FB in the above */ - IOADDRESS domainIOBase; /* Domain I/O base address */ - int memClk; /* memory clock */ - int textClockFreq; /* clock of text mode */ - Bool flipPixels; /* swap default black/white */ - pointer options; - - int chipID; - int chipRev; - int racMemFlags; - int racIoFlags; - pointer access; - xf86CurrentAccessPtr CurrentAccess; - resType resourceType; - pointer busAccess; - - /* Allow screens to be enabled/disabled individually */ - Bool vtSema; - DevUnion pixmapPrivate; /* saved devPrivate from pixmap */ - - /* hw cursor moves at SIGIO time */ - Bool silkenMouse; - - /* Storage for clockRanges and adjustFlags for use with the VidMode ext */ - ClockRangesPtr clockRanges; - int adjustFlags; - - /* - * These can be used when the minor ABI version is incremented. - * The NUM_* parameters must be reduced appropriately to keep the - * structure size and alignment unchanged. - */ - int reservedInt[NUM_RESERVED_INTS]; - - int * entityInstanceList; - pointer reservedPtr[NUM_RESERVED_POINTERS]; - - /* - * Driver entry points. - * - */ - - xf86ProbeProc *Probe; - xf86PreInitProc *PreInit; - xf86ScreenInitProc *ScreenInit; - xf86SwitchModeProc *SwitchMode; - xf86AdjustFrameProc *AdjustFrame; - xf86EnterVTProc *EnterVT; - xf86LeaveVTProc *LeaveVT; - xf86FreeScreenProc *FreeScreen; - xf86ValidModeProc *ValidMode; - xf86EnableDisableFBAccessProc *EnableDisableFBAccess; - xf86SetDGAModeProc *SetDGAMode; - xf86ChangeGammaProc *ChangeGamma; - xf86PointerMovedProc *PointerMoved; - xf86PMEventProc *PMEvent; - xf86HandleMessageProc *HandleMessage; - xf86DPMSSetProc *DPMSSet; - xf86LoadPaletteProc *LoadPalette; - xf86SetOverscanProc *SetOverscan; - xorgDriverFuncProc *DriverFunc; - - /* - * This can be used when the minor ABI version is incremented. - * The NUM_* parameter must be reduced appropriately to keep the - * structure size and alignment unchanged. - */ - funcPointer reservedFuncs[NUM_RESERVED_FUNCS]; - -} ScrnInfoRec; - - -typedef struct { - Bool (*OpenFramebuffer)( - ScrnInfoPtr pScrn, - char **name, - unsigned char **mem, - int *size, - int *offset, - int *extra - ); - void (*CloseFramebuffer)(ScrnInfoPtr pScrn); - Bool (*SetMode)(ScrnInfoPtr pScrn, DGAModePtr pMode); - void (*SetViewport)(ScrnInfoPtr pScrn, int x, int y, int flags); - int (*GetViewport)(ScrnInfoPtr pScrn); - void (*Sync)(ScrnInfoPtr); - void (*FillRect)( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned long color - ); - void (*BlitRect)( - ScrnInfoPtr pScrn, - int srcx, int srcy, - int w, int h, - int dstx, int dsty - ); - void (*BlitTransRect)( - ScrnInfoPtr pScrn, - int srcx, int srcy, - int w, int h, - int dstx, int dsty, - unsigned long color - ); -} DGAFunctionRec, *DGAFunctionPtr; - -typedef struct { - int token; /* id of the token */ - const char * name; /* token name */ -} SymTabRec, *SymTabPtr; - -/* flags for xf86LookupMode */ -typedef enum { - LOOKUP_DEFAULT = 0, /* Use default mode lookup method */ - LOOKUP_BEST_REFRESH, /* Pick modes with best refresh */ - LOOKUP_CLOSEST_CLOCK, /* Pick modes with the closest clock */ - LOOKUP_LIST_ORDER, /* Pick first useful mode in list */ - LOOKUP_CLKDIV2 = 0x0100, /* Allow half clocks */ - LOOKUP_OPTIONAL_TOLERANCES = 0x0200 /* Allow missing hsync/vrefresh */ -} LookupModeFlags; - -#define NoDepth24Support 0x00 -#define Support24bppFb 0x01 /* 24bpp framebuffer supported */ -#define Support32bppFb 0x02 /* 32bpp framebuffer supported */ -#define SupportConvert24to32 0x04 /* Can convert 24bpp pixmap to 32bpp */ -#define SupportConvert32to24 0x08 /* Can convert 32bpp pixmap to 24bpp */ -#define PreferConvert24to32 0x10 /* prefer 24bpp pixmap to 32bpp conv */ -#define PreferConvert32to24 0x20 /* prefer 32bpp pixmap to 24bpp conv */ - - -/* For DPMS */ -typedef void (*DPMSSetProcPtr)(ScrnInfoPtr, int, int); - -/* Input handler proc */ -typedef void (*InputHandlerProc)(int fd, pointer data); - -/* These are used by xf86GetClocks */ -#define CLK_REG_SAVE -1 -#define CLK_REG_RESTORE -2 - -/* xf86Debug.c */ -#ifdef BUILDDEBUG -typedef struct { - long sec; - long usec; -} xf86TsRec, *xf86TsPtr; -#endif - -/* - * misc constants - */ -#define INTERLACE_REFRESH_WEIGHT 1.5 -#define SYNC_TOLERANCE 0.01 /* 1 percent */ -#define CLOCK_TOLERANCE 2000 /* Clock matching tolerance (2MHz) */ - - -#define OVERLAY_8_32_DUALFB 0x00000001 -#define OVERLAY_8_24_DUALFB 0x00000002 -#define OVERLAY_8_16_DUALFB 0x00000004 -#define OVERLAY_8_32_PLANAR 0x00000008 - -#if 0 -#define LD_RESOLV_IFDONE 0 /* only check if no more - delays pending */ -#define LD_RESOLV_NOW 1 /* finish one delay step */ -#define LD_RESOLV_FORCE 2 /* force checking... */ -#endif - -/* Values of xf86Info.mouseFlags */ -#define MF_CLEAR_DTR 1 -#define MF_CLEAR_RTS 2 - -/* Action Events */ -typedef enum { - ACTION_TERMINATE = 0, /* Terminate Server */ - ACTION_NEXT_MODE = 10, /* Switch to next video mode */ - ACTION_PREV_MODE, - ACTION_DISABLEGRAB = 20, /* Cancel server/pointer/kbd grabs */ - ACTION_CLOSECLIENT, /* Kill client holding grab */ - ACTION_SWITCHSCREEN = 100, /* VT switch */ - ACTION_SWITCHSCREEN_NEXT, - ACTION_SWITCHSCREEN_PREV, - ACTION_MESSAGE = 9999 /* Generic message passing */ -} ActionEvent; - -/* xf86Versions.c */ -/* - * Never change existing values, and always assign values explicitly. - * NUM_BUILTIN_IFS must always be the last entry. - */ -typedef enum { - BUILTIN_IF_OSMOUSE = 0, - BUILTIN_IF_OSKBD = 1, - NUM_BUILTIN_IFS -} BuiltinInterface; - -/* - * These are intentionally the same as the module version macros. - * It is possible to register a module as providing a specific interface, - * in which case the module's version is used. This feature isn't - * really ready for use yet though. - */ - -#define BUILTIN_INTERFACE_VERSION_NUMERIC(maj, min, patch) \ - ((((maj) & 0xFF) << 24) | (((min) & 0xFF) << 16) | (patch & 0xFFFF)) -#define GET_BUILTIN_INTERFACE_MAJOR_VERSION(vers) (((vers) >> 24) & 0xFF) -#define GET_BUILTIN_INTERFACE_MINOR_VERSION(vers) (((vers) >> 16) & 0xFF) -#define GET_BUILTIN_INTERFACE_PATCH_VERSION(vers) ((vers) & 0xFFFF) - -#endif /* _XF86STR_H */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86xv.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86xv.c deleted file mode 100644 index 35695bd9e..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86xv.c +++ /dev/null @@ -1,2050 +0,0 @@ -/* - * XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com) - */ -/* - * Copyright (c) 1998-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.c,v 1.37 2003/11/10 18:22:15 tsi Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include -#include -#include "scrnintstr.h" -#include "regionstr.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "mivalidate.h" -#include "validate.h" -#include "resource.h" -#include "gcstruct.h" -#include "dixstruct.h" - -#include -#include -#include "xvdix.h" -#ifdef XFree86LOADER -#include "xvmodproc.h" -#endif - -#include "xf86xvpriv.h" - - -/* XvScreenRec fields */ - -static Bool xf86XVCloseScreen(int, ScreenPtr); -static int xf86XVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *); - -/* XvAdaptorRec fields */ - -static int xf86XVAllocatePort(unsigned long, XvPortPtr, XvPortPtr*); -static int xf86XVFreePort(XvPortPtr); -static int xf86XVPutVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, - INT16, INT16, CARD16, CARD16); -static int xf86XVPutStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, - INT16, INT16, CARD16, CARD16); -static int xf86XVGetVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, - INT16, INT16, CARD16, CARD16); -static int xf86XVGetStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, - INT16, INT16, CARD16, CARD16); -static int xf86XVStopVideo(ClientPtr, XvPortPtr, DrawablePtr); -static int xf86XVSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32); -static int xf86XVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32*); -static int xf86XVQueryBestSize(ClientPtr, XvPortPtr, CARD8, - CARD16, CARD16,CARD16, CARD16, - unsigned int*, unsigned int*); -static int xf86XVPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, - INT16, INT16, CARD16, CARD16, - XvImagePtr, unsigned char*, Bool, - CARD16, CARD16); -static int xf86XVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr, - CARD16*, CARD16*, int*, int*); - - -/* ScreenRec fields */ - -static Bool xf86XVDestroyWindow(WindowPtr pWin); -static void xf86XVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2); -static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy); - -/* ScrnInfoRec functions */ - -static Bool xf86XVEnterVT(int, int); -static void xf86XVLeaveVT(int, int); -static void xf86XVAdjustFrame(int index, int x, int y, int flags); - -/* misc */ - -static Bool xf86XVInitAdaptors(ScreenPtr, XF86VideoAdaptorPtr*, int); - - -int XF86XVWindowIndex = -1; -int XF86XvScreenIndex = -1; -static unsigned long XF86XVGeneration = 0; -static unsigned long PortResource = 0; - -#ifdef XFree86LOADER -int (*XvGetScreenIndexProc)(void) = NULL; -unsigned long (*XvGetRTPortProc)(void) = NULL; -int (*XvScreenInitProc)(ScreenPtr) = NULL; -#else -int (*XvGetScreenIndexProc)(void) = XvGetScreenIndex; -unsigned long (*XvGetRTPortProc)(void) = XvGetRTPort; -int (*XvScreenInitProc)(ScreenPtr) = XvScreenInit; -#endif - - -#define GET_XV_SCREEN(pScreen) \ - ((XvScreenPtr)((pScreen)->devPrivates[XF86XvScreenIndex].ptr)) - -#define GET_XF86XV_SCREEN(pScreen) \ - ((XF86XVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr)) - -#define GET_XF86XV_WINDOW(pWin) \ - ((XF86XVWindowPtr)((pWin)->devPrivates[XF86XVWindowIndex].ptr)) - -static xf86XVInitGenericAdaptorPtr *GenDrivers = NULL; -static int NumGenDrivers = 0; - -int -xf86XVRegisterGenericAdaptorDriver( - xf86XVInitGenericAdaptorPtr InitFunc -){ - xf86XVInitGenericAdaptorPtr *newdrivers; - - newdrivers = xrealloc(GenDrivers, sizeof(xf86XVInitGenericAdaptorPtr) * - (1 + NumGenDrivers)); - if (!newdrivers) - return 0; - GenDrivers = newdrivers; - - GenDrivers[NumGenDrivers++] = InitFunc; - - return 1; -} - -int -xf86XVListGenericAdaptors( - ScrnInfoPtr pScrn, - XF86VideoAdaptorPtr **adaptors -){ - int i,j,n,num; - XF86VideoAdaptorPtr *DrivAdap,*new; - - num = 0; - *adaptors = NULL; - /* - * The v4l driver registers itself first, but can use surfaces registered - * by other drivers. So, call the v4l driver last. - */ - for (i = NumGenDrivers; --i >= 0; ) { - DrivAdap = NULL; - n = (*GenDrivers[i])(pScrn, &DrivAdap); - if (0 == n) - continue; - new = xrealloc(*adaptors, sizeof(XF86VideoAdaptorPtr) * (num+n)); - if (NULL == new) - continue; - *adaptors = new; - for (j = 0; j < n; j++, num++) - (*adaptors)[num] = DrivAdap[j]; - } - return num; -} - - -/**************** Offscreen surface stuff *******************/ - -typedef struct { - XF86OffscreenImagePtr images; - int num; -} OffscreenImageRec; - -static OffscreenImageRec OffscreenImages[MAXSCREENS]; - -Bool -xf86XVRegisterOffscreenImages( - ScreenPtr pScreen, - XF86OffscreenImagePtr images, - int num -){ - OffscreenImages[pScreen->myNum].num = num; - OffscreenImages[pScreen->myNum].images = images; - - return TRUE; -} - -XF86OffscreenImagePtr -xf86XVQueryOffscreenImages( - ScreenPtr pScreen, - int *num -){ - *num = OffscreenImages[pScreen->myNum].num; - return OffscreenImages[pScreen->myNum].images; -} - - -XF86VideoAdaptorPtr -xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr pScrn) -{ - return xcalloc(1, sizeof(XF86VideoAdaptorRec)); -} - -void -xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr) -{ - xfree(ptr); -} - - -Bool -xf86XVScreenInit( - ScreenPtr pScreen, - XF86VideoAdaptorPtr *adaptors, - int num -){ - ScrnInfoPtr pScrn; - XF86XVScreenPtr ScreenPriv; - XvScreenPtr pxvs; - - if(num <= 0 || - !XvGetScreenIndexProc || !XvGetRTPortProc || !XvScreenInitProc) - return FALSE; - - if(XF86XVGeneration != serverGeneration) { - if((XF86XVWindowIndex = AllocateWindowPrivateIndex()) < 0) - return FALSE; - XF86XVGeneration = serverGeneration; - } - - if(!AllocateWindowPrivate(pScreen,XF86XVWindowIndex,0)) - return FALSE; - - if(Success != (*XvScreenInitProc)(pScreen)) return FALSE; - - XF86XvScreenIndex = (*XvGetScreenIndexProc)(); - PortResource = (*XvGetRTPortProc)(); - - pxvs = GET_XV_SCREEN(pScreen); - - /* Anyone initializing the Xv layer must provide these two. - The Xv di layer calls them without even checking if they exist! */ - - pxvs->ddCloseScreen = xf86XVCloseScreen; - pxvs->ddQueryAdaptors = xf86XVQueryAdaptors; - - /* The Xv di layer provides us with a private hook so that we don't - have to allocate our own screen private. They also provide - a CloseScreen hook so that we don't have to wrap it. I'm not - sure that I appreciate that. */ - - ScreenPriv = xalloc(sizeof(XF86XVScreenRec)); - pxvs->devPriv.ptr = (pointer)ScreenPriv; - - if(!ScreenPriv) return FALSE; - - pScrn = xf86Screens[pScreen->myNum]; - - ScreenPriv->videoGC = NULL; /* for the helper */ - - ScreenPriv->DestroyWindow = pScreen->DestroyWindow; - ScreenPriv->WindowExposures = pScreen->WindowExposures; - ScreenPriv->ClipNotify = pScreen->ClipNotify; - ScreenPriv->EnterVT = pScrn->EnterVT; - ScreenPriv->LeaveVT = pScrn->LeaveVT; - ScreenPriv->AdjustFrame = pScrn->AdjustFrame; - - pScreen->DestroyWindow = xf86XVDestroyWindow; - pScreen->WindowExposures = xf86XVWindowExposures; - pScreen->ClipNotify = xf86XVClipNotify; - pScrn->EnterVT = xf86XVEnterVT; - pScrn->LeaveVT = xf86XVLeaveVT; - if(pScrn->AdjustFrame) - pScrn->AdjustFrame = xf86XVAdjustFrame; - - if(!xf86XVInitAdaptors(pScreen, adaptors, num)) - return FALSE; - - return TRUE; -} - -static void -xf86XVFreeAdaptor(XvAdaptorPtr pAdaptor) -{ - int i; - - xfree(pAdaptor->name); - - if(pAdaptor->pEncodings) { - XvEncodingPtr pEncode = pAdaptor->pEncodings; - - for(i = 0; i < pAdaptor->nEncodings; i++, pEncode++) - xfree(pEncode->name); - xfree(pAdaptor->pEncodings); - } - - xfree(pAdaptor->pFormats); - - if(pAdaptor->pPorts) { - XvPortPtr pPort = pAdaptor->pPorts; - XvPortRecPrivatePtr pPriv; - - for(i = 0; i < pAdaptor->nPorts; i++, pPort++) { - pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr; - if(pPriv) { - if(pPriv->clientClip) - REGION_DESTROY(pAdaptor->pScreen, pPriv->clientClip); - if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) - REGION_DESTROY(pAdaptor->pScreen, pPriv->pCompositeClip); - xfree(pPriv); - } - } - xfree(pAdaptor->pPorts); - } - - if(pAdaptor->nAttributes) { - XvAttributePtr pAttribute = pAdaptor->pAttributes; - - for(i = 0; i < pAdaptor->nAttributes; i++, pAttribute++) - xfree(pAttribute->name); - xfree(pAdaptor->pAttributes); - } - - xfree(pAdaptor->pImages); - xfree(pAdaptor->devPriv.ptr); -} - -static Bool -xf86XVInitAdaptors( - ScreenPtr pScreen, - XF86VideoAdaptorPtr *infoPtr, - int number -) { - XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - XF86VideoAdaptorPtr adaptorPtr; - XvAdaptorPtr pAdaptor, pa; - XvAdaptorRecPrivatePtr adaptorPriv; - int na, numAdaptor; - XvPortRecPrivatePtr portPriv; - XvPortPtr pPort, pp; - int numPort; - XF86AttributePtr attributePtr; - XvAttributePtr pAttribute, pat; - XF86VideoFormatPtr formatPtr; - XvFormatPtr pFormat, pf; - int numFormat, totFormat; - XF86VideoEncodingPtr encodingPtr; - XvEncodingPtr pEncode, pe; - XF86ImagePtr imagePtr; - XvImagePtr pImage, pi; - int numVisuals; - VisualPtr pVisual; - int i; - - pxvs->nAdaptors = 0; - pxvs->pAdaptors = NULL; - - if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec)))) - return FALSE; - - for(pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) { - adaptorPtr = infoPtr[na]; - - if(!adaptorPtr->StopVideo || !adaptorPtr->SetPortAttribute || - !adaptorPtr->GetPortAttribute || !adaptorPtr->QueryBestSize) - continue; - - /* client libs expect at least one encoding */ - if(!adaptorPtr->nEncodings || !adaptorPtr->pEncodings) - continue; - - pa->type = adaptorPtr->type; - - if(!adaptorPtr->PutVideo && !adaptorPtr->GetVideo) - pa->type &= ~XvVideoMask; - - if(!adaptorPtr->PutStill && !adaptorPtr->GetStill) - pa->type &= ~XvStillMask; - - if(!adaptorPtr->PutImage || !adaptorPtr->QueryImageAttributes) - pa->type &= ~XvImageMask; - - if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage && - !adaptorPtr->PutStill) - pa->type &= ~XvInputMask; - - if(!adaptorPtr->GetVideo && !adaptorPtr->GetStill) - pa->type &= ~XvOutputMask; - - if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask))) - continue; - if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask))) - continue; - - pa->pScreen = pScreen; - pa->ddAllocatePort = xf86XVAllocatePort; - pa->ddFreePort = xf86XVFreePort; - pa->ddPutVideo = xf86XVPutVideo; - pa->ddPutStill = xf86XVPutStill; - pa->ddGetVideo = xf86XVGetVideo; - pa->ddGetStill = xf86XVGetStill; - pa->ddStopVideo = xf86XVStopVideo; - pa->ddPutImage = xf86XVPutImage; - pa->ddSetPortAttribute = xf86XVSetPortAttribute; - pa->ddGetPortAttribute = xf86XVGetPortAttribute; - pa->ddQueryBestSize = xf86XVQueryBestSize; - pa->ddQueryImageAttributes = xf86XVQueryImageAttributes; - if((pa->name = xalloc(strlen(adaptorPtr->name) + 1))) - strcpy(pa->name, adaptorPtr->name); - - if(adaptorPtr->nEncodings && - (pEncode = xcalloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) { - - for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0; - i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++) - { - pe->id = encodingPtr->id; - pe->pScreen = pScreen; - if((pe->name = xalloc(strlen(encodingPtr->name) + 1))) - strcpy(pe->name, encodingPtr->name); - pe->width = encodingPtr->width; - pe->height = encodingPtr->height; - pe->rate.numerator = encodingPtr->rate.numerator; - pe->rate.denominator = encodingPtr->rate.denominator; - } - pa->nEncodings = adaptorPtr->nEncodings; - pa->pEncodings = pEncode; - } - - if(adaptorPtr->nImages && - (pImage = xcalloc(adaptorPtr->nImages, sizeof(XvImageRec)))) { - - for(i = 0, pi = pImage, imagePtr = adaptorPtr->pImages; - i < adaptorPtr->nImages; i++, pi++, imagePtr++) - { - pi->id = imagePtr->id; - pi->type = imagePtr->type; - pi->byte_order = imagePtr->byte_order; - memcpy(pi->guid, imagePtr->guid, 16); - pi->bits_per_pixel = imagePtr->bits_per_pixel; - pi->format = imagePtr->format; - pi->num_planes = imagePtr->num_planes; - pi->depth = imagePtr->depth; - pi->red_mask = imagePtr->red_mask; - pi->green_mask = imagePtr->green_mask; - pi->blue_mask = imagePtr->blue_mask; - pi->y_sample_bits = imagePtr->y_sample_bits; - pi->u_sample_bits = imagePtr->u_sample_bits; - pi->v_sample_bits = imagePtr->v_sample_bits; - pi->horz_y_period = imagePtr->horz_y_period; - pi->horz_u_period = imagePtr->horz_u_period; - pi->horz_v_period = imagePtr->horz_v_period; - pi->vert_y_period = imagePtr->vert_y_period; - pi->vert_u_period = imagePtr->vert_u_period; - pi->vert_v_period = imagePtr->vert_v_period; - memcpy(pi->component_order, imagePtr->component_order, 32); - pi->scanline_order = imagePtr->scanline_order; - } - pa->nImages = adaptorPtr->nImages; - pa->pImages = pImage; - } - - if(adaptorPtr->nAttributes && - (pAttribute = xcalloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec)))) - { - for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0; - i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) - { - pat->flags = attributePtr->flags; - pat->min_value = attributePtr->min_value; - pat->max_value = attributePtr->max_value; - if((pat->name = xalloc(strlen(attributePtr->name) + 1))) - strcpy(pat->name, attributePtr->name); - } - pa->nAttributes = adaptorPtr->nAttributes; - pa->pAttributes = pAttribute; - } - - - totFormat = adaptorPtr->nFormats; - - if(!(pFormat = xcalloc(totFormat, sizeof(XvFormatRec)))) { - xf86XVFreeAdaptor(pa); - continue; - } - for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats; - i < adaptorPtr->nFormats; i++, formatPtr++) - { - numVisuals = pScreen->numVisuals; - pVisual = pScreen->visuals; - - while(numVisuals--) { - if((pVisual->class == formatPtr->class) && - (pVisual->nplanes == formatPtr->depth)) { - - if(numFormat >= totFormat) { - void *moreSpace; - totFormat *= 2; - moreSpace = xrealloc(pFormat, - totFormat * sizeof(XvFormatRec)); - if(!moreSpace) break; - pFormat = moreSpace; - pf = pFormat + numFormat; - } - - pf->visual = pVisual->vid; - pf->depth = formatPtr->depth; - - pf++; - numFormat++; - } - pVisual++; - } - } - pa->nFormats = numFormat; - pa->pFormats = pFormat; - if(!numFormat) { - xf86XVFreeAdaptor(pa); - continue; - } - - if(!(adaptorPriv = xcalloc(1, sizeof(XvAdaptorRecPrivate)))) { - xf86XVFreeAdaptor(pa); - continue; - } - - adaptorPriv->flags = adaptorPtr->flags; - adaptorPriv->PutVideo = adaptorPtr->PutVideo; - adaptorPriv->PutStill = adaptorPtr->PutStill; - adaptorPriv->GetVideo = adaptorPtr->GetVideo; - adaptorPriv->GetStill = adaptorPtr->GetStill; - adaptorPriv->StopVideo = adaptorPtr->StopVideo; - adaptorPriv->SetPortAttribute = adaptorPtr->SetPortAttribute; - adaptorPriv->GetPortAttribute = adaptorPtr->GetPortAttribute; - adaptorPriv->QueryBestSize = adaptorPtr->QueryBestSize; - adaptorPriv->QueryImageAttributes = adaptorPtr->QueryImageAttributes; - adaptorPriv->PutImage = adaptorPtr->PutImage; - adaptorPriv->ReputImage = adaptorPtr->ReputImage; - - pa->devPriv.ptr = (pointer)adaptorPriv; - - if(!(pPort = xcalloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) { - xf86XVFreeAdaptor(pa); - continue; - } - for(pp = pPort, i = 0, numPort = 0; - i < adaptorPtr->nPorts; i++) { - - if(!(pp->id = FakeClientID(0))) - continue; - - if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate)))) - continue; - - if(!AddResource(pp->id, PortResource, pp)) { - xfree(portPriv); - continue; - } - - pp->pAdaptor = pa; - pp->pNotify = (XvPortNotifyPtr)NULL; - pp->pDraw = (DrawablePtr)NULL; - pp->client = (ClientPtr)NULL; - pp->grab.client = (ClientPtr)NULL; - pp->time = currentTime; - pp->devPriv.ptr = portPriv; - - portPriv->pScrn = pScrn; - portPriv->AdaptorRec = adaptorPriv; - portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr; - - pp++; - numPort++; - } - pa->nPorts = numPort; - pa->pPorts = pPort; - if(!numPort) { - xf86XVFreeAdaptor(pa); - continue; - } - - pa->base_id = pPort->id; - - pa++; - numAdaptor++; - } - - if(numAdaptor) { - pxvs->nAdaptors = numAdaptor; - pxvs->pAdaptors = pAdaptor; - } else { - xfree(pAdaptor); - return FALSE; - } - - return TRUE; -} - -/* Video should be clipped to the intersection of the window cliplist - and the client cliplist specified in the GC for which the video was - initialized. When we need to reclip a window, the GC that started - the video may not even be around anymore. That's why we save the - client clip from the GC when the video is initialized. We then - use xf86XVUpdateCompositeClip to calculate the new composite clip - when we need it. This is different from what DEC did. They saved - the GC and used it's clip list when they needed to reclip the window, - even if the client clip was different from the one the video was - initialized with. If the original GC was destroyed, they had to stop - the video. I like the new method better (MArk). - - This function only works for windows. Will need to rewrite when - (if) we support pixmap rendering. -*/ - -static void -xf86XVUpdateCompositeClip(XvPortRecPrivatePtr portPriv) -{ - RegionPtr pregWin, pCompositeClip; - WindowPtr pWin; - ScreenPtr pScreen; - Bool freeCompClip = FALSE; - - if(portPriv->pCompositeClip) - return; - - pWin = (WindowPtr)portPriv->pDraw; - pScreen = pWin->drawable.pScreen; - - /* get window clip list */ - if(portPriv->subWindowMode == IncludeInferiors) { - pregWin = NotClippedByChildren(pWin); - freeCompClip = TRUE; - } else - pregWin = &pWin->clipList; - - if(!portPriv->clientClip) { - portPriv->pCompositeClip = pregWin; - portPriv->FreeCompositeClip = freeCompClip; - return; - } - - pCompositeClip = REGION_CREATE(pScreen, NullBox, 1); - REGION_COPY(pScreen, pCompositeClip, portPriv->clientClip); - REGION_TRANSLATE(pScreen, pCompositeClip, - portPriv->pDraw->x + portPriv->clipOrg.x, - portPriv->pDraw->y + portPriv->clipOrg.y); - REGION_INTERSECT(pScreen, pCompositeClip, pregWin, pCompositeClip); - - portPriv->pCompositeClip = pCompositeClip; - portPriv->FreeCompositeClip = TRUE; - - if(freeCompClip) { - REGION_DESTROY(pScreen, pregWin); - } -} - -/* Save the current clientClip and update the CompositeClip whenever - we have a fresh GC */ - -static void -xf86XVCopyClip( - XvPortRecPrivatePtr portPriv, - GCPtr pGC -){ - ScreenPtr pScreen = pGC->pScreen; - - /* copy the new clip if it exists */ - if((pGC->clientClipType == CT_REGION) && pGC->clientClip) { - if(!portPriv->clientClip) - portPriv->clientClip = REGION_CREATE(pScreen, NullBox, 1); - /* Note: this is in window coordinates */ - REGION_COPY(pScreen, portPriv->clientClip, pGC->clientClip); - } else if(portPriv->clientClip) { /* free the old clientClip */ - REGION_DESTROY(pScreen, portPriv->clientClip); - portPriv->clientClip = NULL; - } - - /* get rid of the old clip list */ - if(portPriv->pCompositeClip && portPriv->FreeCompositeClip) { - REGION_DESTROY(pScreen, portPriv->pCompositeClip); - } - - portPriv->clipOrg = pGC->clipOrg; - portPriv->pCompositeClip = pGC->pCompositeClip; - portPriv->FreeCompositeClip = FALSE; - portPriv->subWindowMode = pGC->subWindowMode; -} - -static int -xf86XVRegetVideo(XvPortRecPrivatePtr portPriv) -{ - RegionRec WinRegion; - RegionRec ClipRegion; - BoxRec WinBox; - ScreenPtr pScreen; - int ret = Success; - Bool clippedAway = FALSE; - - pScreen = portPriv->pDraw->pScreen; - xf86XVUpdateCompositeClip(portPriv); - - /* translate the video region to the screen */ - WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x; - WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; - WinBox.x2 = WinBox.x1 + portPriv->drw_w; - WinBox.y2 = WinBox.y1 + portPriv->drw_h; - - /* clip to the window composite clip */ - REGION_INIT(pScreen, &WinRegion, &WinBox, 1); - REGION_NULL(pScreen, &ClipRegion); - REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); - - /* that's all if it's totally obscured */ - if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { - clippedAway = TRUE; - goto CLIP_VIDEO_BAILOUT; - } - - if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) { - REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion); - } - - ret = (*portPriv->AdaptorRec->GetVideo)(portPriv->pScrn, - portPriv->vid_x, portPriv->vid_y, - WinBox.x1, WinBox.y1, - portPriv->vid_w, portPriv->vid_h, - portPriv->drw_w, portPriv->drw_h, - &ClipRegion, portPriv->DevPriv.ptr); - - if(ret == Success) - portPriv->isOn = XV_ON; - -CLIP_VIDEO_BAILOUT: - - if((clippedAway || (ret != Success)) && portPriv->isOn == XV_ON) { - (*portPriv->AdaptorRec->StopVideo)( - portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); - portPriv->isOn = XV_PENDING; - } - - /* This clip was copied and only good for one shot */ - if(!portPriv->FreeCompositeClip) - portPriv->pCompositeClip = NULL; - - REGION_UNINIT(pScreen, &WinRegion); - REGION_UNINIT(pScreen, &ClipRegion); - - return ret; -} - - -static int -xf86XVReputVideo(XvPortRecPrivatePtr portPriv) -{ - RegionRec WinRegion; - RegionRec ClipRegion; - BoxRec WinBox; - ScreenPtr pScreen; - int ret = Success; - Bool clippedAway = FALSE; - - pScreen = portPriv->pDraw->pScreen; - - xf86XVUpdateCompositeClip(portPriv); - - /* translate the video region to the screen */ - WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x; - WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; - WinBox.x2 = WinBox.x1 + portPriv->drw_w; - WinBox.y2 = WinBox.y1 + portPriv->drw_h; - - /* clip to the window composite clip */ - REGION_INIT(pScreen, &WinRegion, &WinBox, 1); - REGION_NULL(pScreen, &ClipRegion); - REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); - - /* clip and translate to the viewport */ - if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { - RegionRec VPReg; - BoxRec VPBox; - - VPBox.x1 = portPriv->pScrn->frameX0; - VPBox.y1 = portPriv->pScrn->frameY0; - VPBox.x2 = portPriv->pScrn->frameX1; - VPBox.y2 = portPriv->pScrn->frameY1; - - REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(pScreen, &ClipRegion, &ClipRegion, &VPReg); - REGION_UNINIT(pScreen, &VPReg); - } - - /* that's all if it's totally obscured */ - if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { - clippedAway = TRUE; - goto CLIP_VIDEO_BAILOUT; - } - - /* bailout if we have to clip but the hardware doesn't support it */ - if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { - BoxPtr clipBox = REGION_RECTS(&ClipRegion); - if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || - (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) - { - clippedAway = TRUE; - goto CLIP_VIDEO_BAILOUT; - } - } - - if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) { - REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion); - } - - ret = (*portPriv->AdaptorRec->PutVideo)(portPriv->pScrn, - portPriv->vid_x, portPriv->vid_y, - WinBox.x1, WinBox.y1, - portPriv->vid_w, portPriv->vid_h, - portPriv->drw_w, portPriv->drw_h, - &ClipRegion, portPriv->DevPriv.ptr); - - if(ret == Success) portPriv->isOn = XV_ON; - -CLIP_VIDEO_BAILOUT: - - if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { - (*portPriv->AdaptorRec->StopVideo)( - portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); - portPriv->isOn = XV_PENDING; - } - - /* This clip was copied and only good for one shot */ - if(!portPriv->FreeCompositeClip) - portPriv->pCompositeClip = NULL; - - REGION_UNINIT(pScreen, &WinRegion); - REGION_UNINIT(pScreen, &ClipRegion); - - return ret; -} - -static int -xf86XVReputImage(XvPortRecPrivatePtr portPriv) -{ - RegionRec WinRegion; - RegionRec ClipRegion; - BoxRec WinBox; - ScreenPtr pScreen; - int ret = Success; - Bool clippedAway = FALSE; - - pScreen = portPriv->pDraw->pScreen; - - xf86XVUpdateCompositeClip(portPriv); - - /* translate the video region to the screen */ - WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x; - WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; - WinBox.x2 = WinBox.x1 + portPriv->drw_w; - WinBox.y2 = WinBox.y1 + portPriv->drw_h; - - /* clip to the window composite clip */ - REGION_INIT(pScreen, &WinRegion, &WinBox, 1); - REGION_NULL(pScreen, &ClipRegion); - REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); - - /* clip and translate to the viewport */ - if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { - RegionRec VPReg; - BoxRec VPBox; - - VPBox.x1 = portPriv->pScrn->frameX0; - VPBox.y1 = portPriv->pScrn->frameY0; - VPBox.x2 = portPriv->pScrn->frameX1; - VPBox.y2 = portPriv->pScrn->frameY1; - - REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(pScreen, &ClipRegion, &ClipRegion, &VPReg); - REGION_UNINIT(pScreen, &VPReg); - } - - /* that's all if it's totally obscured */ - if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { - clippedAway = TRUE; - goto CLIP_VIDEO_BAILOUT; - } - - /* bailout if we have to clip but the hardware doesn't support it */ - if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { - BoxPtr clipBox = REGION_RECTS(&ClipRegion); - if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || - (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) - { - clippedAway = TRUE; - goto CLIP_VIDEO_BAILOUT; - } - } - - if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) { - REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion); - } - - ret = (*portPriv->AdaptorRec->ReputImage)(portPriv->pScrn, - WinBox.x1, WinBox.y1, - &ClipRegion, portPriv->DevPriv.ptr); - - portPriv->isOn = (ret == Success) ? XV_ON : XV_OFF; - -CLIP_VIDEO_BAILOUT: - - if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { - (*portPriv->AdaptorRec->StopVideo)( - portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); - portPriv->isOn = XV_PENDING; - } - - /* This clip was copied and only good for one shot */ - if(!portPriv->FreeCompositeClip) - portPriv->pCompositeClip = NULL; - - REGION_UNINIT(pScreen, &WinRegion); - REGION_UNINIT(pScreen, &ClipRegion); - - return ret; -} - - -static int -xf86XVReputAllVideo(WindowPtr pWin, pointer data) -{ - XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin); - - while(WinPriv) { - if(WinPriv->PortRec->type == XvInputMask) - xf86XVReputVideo(WinPriv->PortRec); - else - xf86XVRegetVideo(WinPriv->PortRec); - WinPriv = WinPriv->next; - } - - return WT_WALKCHILDREN; -} - -static int -xf86XVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) -{ - XF86XVWindowPtr winPriv, PrivRoot; - - winPriv = PrivRoot = GET_XF86XV_WINDOW(pWin); - - /* Enlist our port in the window private */ - while(winPriv) { - if(winPriv->PortRec == portPriv) /* we're already listed */ - break; - winPriv = winPriv->next; - } - - if(!winPriv) { - winPriv = xalloc(sizeof(XF86XVWindowRec)); - if(!winPriv) return BadAlloc; - winPriv->PortRec = portPriv; - winPriv->next = PrivRoot; - pWin->devPrivates[XF86XVWindowIndex].ptr = (pointer)winPriv; - } - return Success; -} - - -static void -xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) -{ - XF86XVWindowPtr winPriv, prevPriv = NULL; - - winPriv = GET_XF86XV_WINDOW(pWin); - - while(winPriv) { - if(winPriv->PortRec == portPriv) { - if(prevPriv) - prevPriv->next = winPriv->next; - else - pWin->devPrivates[XF86XVWindowIndex].ptr = - (pointer)winPriv->next; - xfree(winPriv); - break; - } - prevPriv = winPriv; - winPriv = winPriv->next; - } - portPriv->pDraw = NULL; -} - -/**** ScreenRec fields ****/ - -static Bool -xf86XVDestroyWindow(WindowPtr pWin) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); - XF86XVWindowPtr tmp, WinPriv = GET_XF86XV_WINDOW(pWin); - int ret; - - while(WinPriv) { - XvPortRecPrivatePtr pPriv = WinPriv->PortRec; - - if(pPriv->isOn > XV_OFF) { - (*pPriv->AdaptorRec->StopVideo)( - pPriv->pScrn, pPriv->DevPriv.ptr, TRUE); - pPriv->isOn = XV_OFF; - } - - pPriv->pDraw = NULL; - tmp = WinPriv; - WinPriv = WinPriv->next; - xfree(tmp); - } - - pWin->devPrivates[XF86XVWindowIndex].ptr = NULL; - - pScreen->DestroyWindow = ScreenPriv->DestroyWindow; - ret = (*pScreen->DestroyWindow)(pWin); - pScreen->DestroyWindow = xf86XVDestroyWindow; - - return ret; -} - - -static void -xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); - XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin); - XF86XVWindowPtr pPrev; - XvPortRecPrivatePtr pPriv; - Bool AreasExposed; - - AreasExposed = (WinPriv && reg1 && REGION_NOTEMPTY(pScreen, reg1)); - - pScreen->WindowExposures = ScreenPriv->WindowExposures; - (*pScreen->WindowExposures)(pWin, reg1, reg2); - pScreen->WindowExposures = xf86XVWindowExposures; - - /* filter out XClearWindow/Area */ - if (!pWin->valdata) return; - - pPrev = NULL; - - while(WinPriv) { - pPriv = WinPriv->PortRec; - - /* Reput anyone with a reput function */ - - switch(pPriv->type) { - case XvInputMask: - xf86XVReputVideo(pPriv); - break; - case XvOutputMask: - xf86XVRegetVideo(pPriv); - break; - default: /* overlaid still/image*/ - if (pPriv->AdaptorRec->ReputImage) - xf86XVReputImage(pPriv); - else if(AreasExposed) { - XF86XVWindowPtr tmp; - - if (pPriv->isOn == XV_ON) { - (*pPriv->AdaptorRec->StopVideo)( - pPriv->pScrn, pPriv->DevPriv.ptr, FALSE); - pPriv->isOn = XV_PENDING; - } - pPriv->pDraw = NULL; - - if(!pPrev) - pWin->devPrivates[XF86XVWindowIndex].ptr = - (pointer)(WinPriv->next); - else - pPrev->next = WinPriv->next; - tmp = WinPriv; - WinPriv = WinPriv->next; - xfree(tmp); - continue; - } - break; - } - pPrev = WinPriv; - WinPriv = WinPriv->next; - } -} - - -static void -xf86XVClipNotify(WindowPtr pWin, int dx, int dy) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); - XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin); - XF86XVWindowPtr tmp, pPrev = NULL; - XvPortRecPrivatePtr pPriv; - Bool visible = (pWin->visibility == VisibilityUnobscured) || - (pWin->visibility == VisibilityPartiallyObscured); - - while(WinPriv) { - pPriv = WinPriv->PortRec; - - if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) - REGION_DESTROY(pScreen, pPriv->pCompositeClip); - - pPriv->pCompositeClip = NULL; - - /* Stop everything except images, but stop them too if the - window isn't visible. But we only remove the images. */ - - if(pPriv->type || !visible) { - if(pPriv->isOn == XV_ON) { - (*pPriv->AdaptorRec->StopVideo)( - pPriv->pScrn, pPriv->DevPriv.ptr, FALSE); - pPriv->isOn = XV_PENDING; - } - - if(!pPriv->type) { /* overlaid still/image */ - pPriv->pDraw = NULL; - - if(!pPrev) - pWin->devPrivates[XF86XVWindowIndex].ptr = - (pointer)(WinPriv->next); - else - pPrev->next = WinPriv->next; - tmp = WinPriv; - WinPriv = WinPriv->next; - xfree(tmp); - continue; - } - } - - pPrev = WinPriv; - WinPriv = WinPriv->next; - } - - if(ScreenPriv->ClipNotify) { - pScreen->ClipNotify = ScreenPriv->ClipNotify; - (*pScreen->ClipNotify)(pWin, dx, dy); - pScreen->ClipNotify = xf86XVClipNotify; - } -} - - - -/**** Required XvScreenRec fields ****/ - -static Bool -xf86XVCloseScreen(int i, ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); - XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); - XvAdaptorPtr pa; - int c; - - /* Clear offscreen images */ - (void)memset(&OffscreenImages[pScreen->myNum], 0, sizeof(OffscreenImages[0])); - - if(!ScreenPriv) return TRUE; - - if(ScreenPriv->videoGC) { - FreeGC(ScreenPriv->videoGC, 0); - ScreenPriv->videoGC = NULL; - } - - pScreen->DestroyWindow = ScreenPriv->DestroyWindow; - pScreen->WindowExposures = ScreenPriv->WindowExposures; - pScreen->ClipNotify = ScreenPriv->ClipNotify; - - pScrn->EnterVT = ScreenPriv->EnterVT; - pScrn->LeaveVT = ScreenPriv->LeaveVT; - pScrn->AdjustFrame = ScreenPriv->AdjustFrame; - - for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) { - xf86XVFreeAdaptor(pa); - } - - xfree(pxvs->pAdaptors); - xfree(ScreenPriv); - return TRUE; -} - - -static int -xf86XVQueryAdaptors( - ScreenPtr pScreen, - XvAdaptorPtr *p_pAdaptors, - int *p_nAdaptors -){ - XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); - - *p_nAdaptors = pxvs->nAdaptors; - *p_pAdaptors = pxvs->pAdaptors; - - return (Success); -} - - -/**** ScrnInfoRec fields ****/ - -static Bool -xf86XVEnterVT(int index, int flags) -{ - ScreenPtr pScreen = screenInfo.screens[index]; - XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); - Bool ret; - - ret = (*ScreenPriv->EnterVT)(index, flags); - - if(ret) WalkTree(pScreen, xf86XVReputAllVideo, 0); - - return ret; -} - -static void -xf86XVLeaveVT(int index, int flags) -{ - ScreenPtr pScreen = screenInfo.screens[index]; - XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); - XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); - XvAdaptorPtr pAdaptor; - XvPortPtr pPort; - XvPortRecPrivatePtr pPriv; - int i, j; - - for(i = 0; i < pxvs->nAdaptors; i++) { - pAdaptor = &pxvs->pAdaptors[i]; - for(j = 0; j < pAdaptor->nPorts; j++) { - pPort = &pAdaptor->pPorts[j]; - pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr; - if(pPriv->isOn > XV_OFF) { - - (*pPriv->AdaptorRec->StopVideo)( - pPriv->pScrn, pPriv->DevPriv.ptr, TRUE); - pPriv->isOn = XV_OFF; - - if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) - REGION_DESTROY(pScreen, pPriv->pCompositeClip); - - pPriv->pCompositeClip = NULL; - - if(!pPriv->type && pPriv->pDraw) { /* still */ - xf86XVRemovePortFromWindow((WindowPtr)pPriv->pDraw, pPriv); - } - } - } - } - - (*ScreenPriv->LeaveVT)(index, flags); -} - -static void -xf86XVAdjustFrame(int index, int x, int y, int flags) -{ - ScrnInfoPtr pScrn = xf86Screens[index]; - ScreenPtr pScreen = pScrn->pScreen; - XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); - XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); - WindowPtr pWin; - XvAdaptorPtr pa; - int c, i; - - if(ScreenPriv->AdjustFrame) { - pScrn->AdjustFrame = ScreenPriv->AdjustFrame; - (*pScrn->AdjustFrame)(index, x, y, flags); - pScrn->AdjustFrame = xf86XVAdjustFrame; - } - - for(c = pxvs->nAdaptors, pa = pxvs->pAdaptors; c > 0; c--, pa++) { - XvPortPtr pPort = pa->pPorts; - XvPortRecPrivatePtr pPriv; - - for(i = pa->nPorts; i > 0; i--, pPort++) { - pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr; - - if(!pPriv->type && (pPriv->isOn == XV_ON)) { /* overlaid still/image */ - - if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) - REGION_DESTROY(pScreen, pPriv->pCompositeClip); - - pPriv->pCompositeClip = NULL; - - pWin = (WindowPtr)pPriv->pDraw; - - if ((pPriv->AdaptorRec->ReputImage) && - ((pWin->visibility == VisibilityUnobscured) || - (pWin->visibility == VisibilityPartiallyObscured))) - { - xf86XVReputImage(pPriv); - } else { - (*pPriv->AdaptorRec->StopVideo)( - pPriv->pScrn, pPriv->DevPriv.ptr, FALSE); - xf86XVRemovePortFromWindow(pWin, pPriv); - pPriv->isOn = XV_PENDING; - continue; - } - } - } - } -} - - -/**** XvAdaptorRec fields ****/ - -static int -xf86XVAllocatePort( - unsigned long port, - XvPortPtr pPort, - XvPortPtr *ppPort -){ - *ppPort = pPort; - return Success; -} - - - -static int -xf86XVFreePort(XvPortPtr pPort) -{ - return Success; -} - - -static int -xf86XVPutVideo( - ClientPtr client, - DrawablePtr pDraw, - XvPortPtr pPort, - GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, - INT16 drw_x, INT16 drw_y, - CARD16 drw_w, CARD16 drw_h -){ - XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - int result; - - /* No dumping video to pixmaps... For now anyhow */ - if(pDraw->type != DRAWABLE_WINDOW) { - pPort->pDraw = (DrawablePtr)NULL; - return BadAlloc; - } - - /* If we are changing windows, unregister our port in the old window */ - if(portPriv->pDraw && (portPriv->pDraw != pDraw)) - xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); - - /* Register our port with the new window */ - result = xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv); - if(result != Success) return result; - - portPriv->pDraw = pDraw; - portPriv->type = XvInputMask; - - /* save a copy of these parameters */ - portPriv->vid_x = vid_x; portPriv->vid_y = vid_y; - portPriv->vid_w = vid_w; portPriv->vid_h = vid_h; - portPriv->drw_x = drw_x; portPriv->drw_y = drw_y; - portPriv->drw_w = drw_w; portPriv->drw_h = drw_h; - - /* make sure we have the most recent copy of the clientClip */ - xf86XVCopyClip(portPriv, pGC); - - /* To indicate to the DI layer that we were successful */ - pPort->pDraw = pDraw; - - if(!portPriv->pScrn->vtSema) return Success; /* Success ? */ - - return(xf86XVReputVideo(portPriv)); -} - -static int -xf86XVPutStill( - ClientPtr client, - DrawablePtr pDraw, - XvPortPtr pPort, - GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, - INT16 drw_x, INT16 drw_y, - CARD16 drw_w, CARD16 drw_h -){ - XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - ScreenPtr pScreen; - RegionRec WinRegion; - RegionRec ClipRegion; - BoxRec WinBox; - int ret = Success; - Bool clippedAway = FALSE; - - if (pDraw->type != DRAWABLE_WINDOW) - return BadAlloc; - - if(!portPriv->pScrn->vtSema) return Success; /* Success ? */ - - pScreen = pDraw->pScreen; - - WinBox.x1 = pDraw->x + drw_x; - WinBox.y1 = pDraw->y + drw_y; - WinBox.x2 = WinBox.x1 + drw_w; - WinBox.y2 = WinBox.y1 + drw_h; - - REGION_INIT(pScreen, &WinRegion, &WinBox, 1); - REGION_NULL(pScreen, &ClipRegion); - REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); - - if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { - RegionRec VPReg; - BoxRec VPBox; - - VPBox.x1 = portPriv->pScrn->frameX0; - VPBox.y1 = portPriv->pScrn->frameY0; - VPBox.x2 = portPriv->pScrn->frameX1; - VPBox.y2 = portPriv->pScrn->frameY1; - - REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(pScreen, &ClipRegion, &ClipRegion, &VPReg); - REGION_UNINIT(pScreen, &VPReg); - } - - if(portPriv->pDraw) { - xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); - } - - if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { - clippedAway = TRUE; - goto PUT_STILL_BAILOUT; - } - - if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { - BoxPtr clipBox = REGION_RECTS(&ClipRegion); - if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || - (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) - { - clippedAway = TRUE; - goto PUT_STILL_BAILOUT; - } - } - - if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) { - REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion); - } - - ret = (*portPriv->AdaptorRec->PutStill)(portPriv->pScrn, - vid_x, vid_y, WinBox.x1, WinBox.y1, - vid_w, vid_h, drw_w, drw_h, - &ClipRegion, portPriv->DevPriv.ptr); - - if((ret == Success) && - (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_STILLS)) { - - xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv); - portPriv->isOn = XV_ON; - portPriv->pDraw = pDraw; - portPriv->drw_x = drw_x; portPriv->drw_y = drw_y; - portPriv->drw_w = drw_w; portPriv->drw_h = drw_h; - portPriv->type = 0; /* no mask means it's transient and should - not be reput once it's removed */ - pPort->pDraw = pDraw; /* make sure we can get stop requests */ - } - -PUT_STILL_BAILOUT: - - if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { - (*portPriv->AdaptorRec->StopVideo)( - portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); - portPriv->isOn = XV_PENDING; - } - - REGION_UNINIT(pScreen, &WinRegion); - REGION_UNINIT(pScreen, &ClipRegion); - - return ret; -} - -static int -xf86XVGetVideo( - ClientPtr client, - DrawablePtr pDraw, - XvPortPtr pPort, - GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, - INT16 drw_x, INT16 drw_y, - CARD16 drw_w, CARD16 drw_h -){ - XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - int result; - - /* No pixmaps... For now anyhow */ - if(pDraw->type != DRAWABLE_WINDOW) { - pPort->pDraw = (DrawablePtr)NULL; - return BadAlloc; - } - - /* If we are changing windows, unregister our port in the old window */ - if(portPriv->pDraw && (portPriv->pDraw != pDraw)) - xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); - - /* Register our port with the new window */ - result = xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv); - if(result != Success) return result; - - portPriv->pDraw = pDraw; - portPriv->type = XvOutputMask; - - /* save a copy of these parameters */ - portPriv->vid_x = vid_x; portPriv->vid_y = vid_y; - portPriv->vid_w = vid_w; portPriv->vid_h = vid_h; - portPriv->drw_x = drw_x; portPriv->drw_y = drw_y; - portPriv->drw_w = drw_w; portPriv->drw_h = drw_h; - - /* make sure we have the most recent copy of the clientClip */ - xf86XVCopyClip(portPriv, pGC); - - /* To indicate to the DI layer that we were successful */ - pPort->pDraw = pDraw; - - if(!portPriv->pScrn->vtSema) return Success; /* Success ? */ - - return(xf86XVRegetVideo(portPriv)); -} - -static int -xf86XVGetStill( - ClientPtr client, - DrawablePtr pDraw, - XvPortPtr pPort, - GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, - INT16 drw_x, INT16 drw_y, - CARD16 drw_w, CARD16 drw_h -){ - XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - ScreenPtr pScreen; - RegionRec WinRegion; - RegionRec ClipRegion; - BoxRec WinBox; - int ret = Success; - Bool clippedAway = FALSE; - - if (pDraw->type != DRAWABLE_WINDOW) - return BadAlloc; - - if(!portPriv->pScrn->vtSema) return Success; /* Success ? */ - - pScreen = pDraw->pScreen; - - WinBox.x1 = pDraw->x + drw_x; - WinBox.y1 = pDraw->y + drw_y; - WinBox.x2 = WinBox.x1 + drw_w; - WinBox.y2 = WinBox.y1 + drw_h; - - REGION_INIT(pScreen, &WinRegion, &WinBox, 1); - REGION_NULL(pScreen, &ClipRegion); - REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); - - if(portPriv->pDraw) { - xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); - } - - if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { - clippedAway = TRUE; - goto GET_STILL_BAILOUT; - } - - if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) { - REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion); - } - - ret = (*portPriv->AdaptorRec->GetStill)(portPriv->pScrn, - vid_x, vid_y, WinBox.x1, WinBox.y1, - vid_w, vid_h, drw_w, drw_h, - &ClipRegion, portPriv->DevPriv.ptr); - -GET_STILL_BAILOUT: - - if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { - (*portPriv->AdaptorRec->StopVideo)( - portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); - portPriv->isOn = XV_PENDING; - } - - REGION_UNINIT(pScreen, &WinRegion); - REGION_UNINIT(pScreen, &ClipRegion); - - return ret; -} - - - -static int -xf86XVStopVideo( - ClientPtr client, - XvPortPtr pPort, - DrawablePtr pDraw -){ - XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - - if(pDraw->type != DRAWABLE_WINDOW) - return BadAlloc; - - xf86XVRemovePortFromWindow((WindowPtr)pDraw, portPriv); - - if(!portPriv->pScrn->vtSema) return Success; /* Success ? */ - - /* Must free resources. */ - - if(portPriv->isOn > XV_OFF) { - (*portPriv->AdaptorRec->StopVideo)( - portPriv->pScrn, portPriv->DevPriv.ptr, TRUE); - portPriv->isOn = XV_OFF; - } - - return Success; -} - -static int -xf86XVSetPortAttribute( - ClientPtr client, - XvPortPtr pPort, - Atom attribute, - INT32 value -){ - XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - - return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->pScrn, - attribute, value, portPriv->DevPriv.ptr)); -} - - -static int -xf86XVGetPortAttribute( - ClientPtr client, - XvPortPtr pPort, - Atom attribute, - INT32 *p_value -){ - XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - - return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->pScrn, - attribute, p_value, portPriv->DevPriv.ptr)); -} - - - -static int -xf86XVQueryBestSize( - ClientPtr client, - XvPortPtr pPort, - CARD8 motion, - CARD16 vid_w, CARD16 vid_h, - CARD16 drw_w, CARD16 drw_h, - unsigned int *p_w, unsigned int *p_h -){ - XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - - (*portPriv->AdaptorRec->QueryBestSize)(portPriv->pScrn, - (Bool)motion, vid_w, vid_h, drw_w, drw_h, - p_w, p_h, portPriv->DevPriv.ptr); - - return Success; -} - - -static int -xf86XVPutImage( - ClientPtr client, - DrawablePtr pDraw, - XvPortPtr pPort, - GCPtr pGC, - INT16 src_x, INT16 src_y, - CARD16 src_w, CARD16 src_h, - INT16 drw_x, INT16 drw_y, - CARD16 drw_w, CARD16 drw_h, - XvImagePtr format, - unsigned char* data, - Bool sync, - CARD16 width, CARD16 height -){ - XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - ScreenPtr pScreen; - RegionRec WinRegion; - RegionRec ClipRegion; - BoxRec WinBox; - int ret = Success; - Bool clippedAway = FALSE; - - if (pDraw->type != DRAWABLE_WINDOW) - return BadAlloc; - - if(!portPriv->pScrn->vtSema) return Success; /* Success ? */ - - pScreen = pDraw->pScreen; - - WinBox.x1 = pDraw->x + drw_x; - WinBox.y1 = pDraw->y + drw_y; - WinBox.x2 = WinBox.x1 + drw_w; - WinBox.y2 = WinBox.y1 + drw_h; - - REGION_INIT(pScreen, &WinRegion, &WinBox, 1); - REGION_NULL(pScreen, &ClipRegion); - REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); - - if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { - RegionRec VPReg; - BoxRec VPBox; - - VPBox.x1 = portPriv->pScrn->frameX0; - VPBox.y1 = portPriv->pScrn->frameY0; - VPBox.x2 = portPriv->pScrn->frameX1 + 1; - VPBox.y2 = portPriv->pScrn->frameY1 + 1; - - REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(pScreen, &ClipRegion, &ClipRegion, &VPReg); - REGION_UNINIT(pScreen, &VPReg); - } - - if(portPriv->pDraw) { - xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); - } - - if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { - clippedAway = TRUE; - goto PUT_IMAGE_BAILOUT; - } - - if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { - BoxPtr clipBox = REGION_RECTS(&ClipRegion); - if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || - (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) - { - clippedAway = TRUE; - goto PUT_IMAGE_BAILOUT; - } - } - - if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) { - REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion); - } - - ret = (*portPriv->AdaptorRec->PutImage)(portPriv->pScrn, - src_x, src_y, WinBox.x1, WinBox.y1, - src_w, src_h, drw_w, drw_h, format->id, data, width, height, - sync, &ClipRegion, portPriv->DevPriv.ptr); - - if((ret == Success) && - (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) { - - xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv); - portPriv->isOn = XV_ON; - portPriv->pDraw = pDraw; - portPriv->drw_x = drw_x; portPriv->drw_y = drw_y; - portPriv->drw_w = drw_w; portPriv->drw_h = drw_h; - portPriv->type = 0; /* no mask means it's transient and should - not be reput once it's removed */ - pPort->pDraw = pDraw; /* make sure we can get stop requests */ - } - -PUT_IMAGE_BAILOUT: - - if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) { - (*portPriv->AdaptorRec->StopVideo)( - portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); - portPriv->isOn = XV_PENDING; - } - - REGION_UNINIT(pScreen, &WinRegion); - REGION_UNINIT(pScreen, &ClipRegion); - - return ret; -} - - -static int -xf86XVQueryImageAttributes( - ClientPtr client, - XvPortPtr pPort, - XvImagePtr format, - CARD16 *width, - CARD16 *height, - int *pitches, - int *offsets -){ - XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - - return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->pScrn, - format->id, width, height, pitches, offsets); -} - -void -xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes) -{ - XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen); - DrawablePtr root = &WindowTable[pScreen->myNum]->drawable; - XID pval[2]; - BoxPtr pbox = REGION_RECTS(clipboxes); - int i, nbox = REGION_NUM_RECTS(clipboxes); - xRectangle *rects; - - if(!xf86Screens[pScreen->myNum]->vtSema) return; - - if(!ScreenPriv->videoGC) { - int status; - pval[0] = key; - pval[1] = IncludeInferiors; - ScreenPriv->videoGC = CreateGC(root, GCForeground | GCSubwindowMode, - pval, &status); - if(!ScreenPriv->videoGC) return; - ValidateGC(root, ScreenPriv->videoGC); - } else if (key != ScreenPriv->videoGC->fgPixel){ - pval[0] = key; - ChangeGC(ScreenPriv->videoGC, GCForeground, pval); - ValidateGC(root, ScreenPriv->videoGC); - } - - rects = ALLOCATE_LOCAL(nbox * sizeof(xRectangle)); - - for(i = 0; i < nbox; i++, pbox++) { - rects[i].x = pbox->x1; - rects[i].y = pbox->y1; - rects[i].width = pbox->x2 - pbox->x1; - rects[i].height = pbox->y2 - pbox->y1; - } - - (*ScreenPriv->videoGC->ops->PolyFillRect)( - root, ScreenPriv->videoGC, nbox, rects); - - DEALLOCATE_LOCAL(rects); -} - -/* xf86XVClipVideoHelper - - - Takes the dst box in standard X BoxRec form (top and left - edges inclusive, bottom and right exclusive). The new dst - box is returned. The source boundaries are given (x1, y1 - inclusive, x2, y2 exclusive) and returned are the new source - boundaries in 16.16 fixed point. -*/ - -#define DummyScreen screenInfo.screens[0] - -Bool -xf86XVClipVideoHelper( - BoxPtr dst, - INT32 *xa, - INT32 *xb, - INT32 *ya, - INT32 *yb, - RegionPtr reg, - INT32 width, - INT32 height -){ - double xsw, xdw, ysw, ydw; - INT32 delta; - BoxPtr extents = REGION_EXTENTS(DummyScreen, reg); - int diff; - - xsw = (*xb - *xa) << 16; - xdw = dst->x2 - dst->x1; - ysw = (*yb - *ya) << 16; - ydw = dst->y2 - dst->y1; - - *xa <<= 16; *xb <<= 16; - *ya <<= 16; *yb <<= 16; - - diff = extents->x1 - dst->x1; - if (diff > 0) { - dst->x1 = extents->x1; - *xa += (diff * xsw) / xdw; - } - diff = dst->x2 - extents->x2; - if (diff > 0) { - dst->x2 = extents->x2; - *xb -= (diff * xsw) / xdw; - } - diff = extents->y1 - dst->y1; - if (diff > 0) { - dst->y1 = extents->y1; - *ya += (diff * ysw) / ydw; - } - diff = dst->y2 - extents->y2; - if (diff > 0) { - dst->y2 = extents->y2; - *yb -= (diff * ysw) / ydw; - } - - if (*xa < 0) { - diff = (((-*xa) * xdw) + xsw - 1) / xsw; - dst->x1 += diff; - *xa += (diff * xsw) / xdw; - } - delta = *xb - (width << 16); - if (delta > 0) { - diff = ((delta * xdw) + xsw - 1) / xsw; - dst->x2 -= diff; - *xb -= (diff * xsw) / xdw; - } - if (*xa >= *xb) return FALSE; - - if (*ya < 0) { - diff = (((-*ya) * ydw) + ysw - 1) / ysw; - dst->y1 += diff; - *ya += (diff * ysw) / ydw; - } - delta = *yb - (height << 16); - if (delta > 0) { - diff = ((delta * ydw) + ysw - 1) / ysw; - dst->y2 -= diff; - *yb -= (diff * ysw) / ydw; - } - if (*ya >= *yb) return FALSE; - - if ((dst->x1 > extents->x1) || (dst->x2 < extents->x2) || - (dst->y1 > extents->y1) || (dst->y2 < extents->y2)) - { - RegionRec clipReg; - REGION_INIT(DummyScreen, &clipReg, dst, 1); - REGION_INTERSECT(DummyScreen, reg, reg, &clipReg); - REGION_UNINIT(DummyScreen, &clipReg); - } - return TRUE; -} - -void -xf86XVCopyYUV12ToPacked( - const void *srcy, - const void *srcv, - const void *srcu, - void *dst, - int srcPitchy, - int srcPitchuv, - int dstPitch, - int h, - int w -){ - CARD32 *Dst; - const CARD8 *Y, *U, *V; - int i, j; - - w >>= 1; - - for (j = 0; j < h; j++) { - Dst = dst; - Y = srcy; V = srcv; U = srcu; - i = w; - while (i >= 4) { -#if X_BYTE_ORDER == X_LITTLE_ENDIAN - Dst[0] = Y[0] | (Y[1] << 16) | (U[0] << 8) | (V[0] << 24); - Dst[1] = Y[2] | (Y[3] << 16) | (U[1] << 8) | (V[1] << 24); - Dst[2] = Y[4] | (Y[5] << 16) | (U[2] << 8) | (V[2] << 24); - Dst[3] = Y[6] | (Y[7] << 16) | (U[3] << 8) | (V[3] << 24); -#else - /* This assumes a little-endian framebuffer */ - Dst[0] = (Y[0] << 24) | (Y[1] << 8) | (U[0] << 16) | V[0]; - Dst[1] = (Y[2] << 24) | (Y[3] << 8) | (U[1] << 16) | V[1]; - Dst[2] = (Y[4] << 24) | (Y[5] << 8) | (U[2] << 16) | V[2]; - Dst[3] = (Y[6] << 24) | (Y[7] << 8) | (U[3] << 16) | V[3]; -#endif - Dst += 4; Y += 8; V += 4; U += 4; - i -= 4; - } - - while (i--) { -#if X_BYTE_ORDER == X_LITTLE_ENDIAN - Dst[0] = Y[0] | (Y[1] << 16) | (U[0] << 8) | (V[0] << 24); -#else - /* This assumes a little-endian framebuffer */ - Dst[0] = (Y[0] << 24) | (Y[1] << 8) | (U[0] << 16) | V[0]; -#endif - Dst++; Y += 2; V++; U++; - } - - dst = (CARD8 *)dst + dstPitch; - srcy = (const CARD8 *)srcy + srcPitchy; - if (j & 1) { - srcu = (const CARD8 *)srcu + srcPitchuv; - srcv = (const CARD8 *)srcv + srcPitchuv; - } - } -} - -void -xf86XVCopyPacked( - const void *src, - void *dst, - int srcPitch, - int dstPitch, - int h, - int w -){ - const CARD32 *Src; - CARD32 *Dst; - int i; - - w >>= 1; - while (--h >= 0) { - do { - Dst = dst; Src = src; - i = w; - while (i >= 4) { - Dst[0] = Src[0]; - Dst[1] = Src[1]; - Dst[2] = Src[2]; - Dst[3] = Src[3]; - Dst += 4; Src += 4; i -= 4; - } - if (!i) break; - Dst[0] = Src[0]; - if (i == 1) break; - Dst[1] = Src[1]; - if (i == 2) break; - Dst[2] = Src[2]; - } while (0); - - src = (const CARD8 *)src + srcPitch; - dst = (CARD8 *)dst + dstPitch; - } -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86xv.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86xv.h deleted file mode 100644 index 316d6c9e5..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86xv.h +++ /dev/null @@ -1,271 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.h,v 1.25 2003/08/24 17:36:56 dawes Exp $ */ - -/* - * Copyright (c) 1998-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifndef _XF86XV_H_ -#define _XF86XV_H_ - -#include "xvdix.h" -#include "xf86str.h" - -#define VIDEO_NO_CLIPPING 0x00000001 -#define VIDEO_INVERT_CLIPLIST 0x00000002 -#define VIDEO_OVERLAID_IMAGES 0x00000004 -#define VIDEO_OVERLAID_STILLS 0x00000008 -#define VIDEO_CLIP_TO_VIEWPORT 0x00000010 - -typedef struct { - int id; - int type; - int byte_order; - unsigned char guid[16]; - int bits_per_pixel; - int format; - int num_planes; - - /* for RGB formats only */ - int depth; - unsigned int red_mask; - unsigned int green_mask; - unsigned int blue_mask; - - /* for YUV formats only */ - unsigned int y_sample_bits; - unsigned int u_sample_bits; - unsigned int v_sample_bits; - unsigned int horz_y_period; - unsigned int horz_u_period; - unsigned int horz_v_period; - unsigned int vert_y_period; - unsigned int vert_u_period; - unsigned int vert_v_period; - char component_order[32]; - int scanline_order; -} XF86ImageRec, *XF86ImagePtr; - - -typedef struct { - ScrnInfoPtr pScrn; - int id; - unsigned short width, height; - int *pitches; /* bytes */ - int *offsets; /* in bytes from start of framebuffer */ - DevUnion devPrivate; -} XF86SurfaceRec, *XF86SurfacePtr; - - -typedef int (* PutVideoFuncPtr)( ScrnInfoPtr pScrn, - short vid_x, short vid_y, short drw_x, short drw_y, - short vid_w, short vid_h, short drw_w, short drw_h, - RegionPtr clipBoxes, pointer data ); -typedef int (* PutStillFuncPtr)( ScrnInfoPtr pScrn, - short vid_x, short vid_y, short drw_x, short drw_y, - short vid_w, short vid_h, short drw_w, short drw_h, - RegionPtr clipBoxes, pointer data ); -typedef int (* GetVideoFuncPtr)( ScrnInfoPtr pScrn, - short vid_x, short vid_y, short drw_x, short drw_y, - short vid_w, short vid_h, short drw_w, short drw_h, - RegionPtr clipBoxes, pointer data ); -typedef int (* GetStillFuncPtr)( ScrnInfoPtr pScrn, - short vid_x, short vid_y, short drw_x, short drw_y, - short vid_w, short vid_h, short drw_w, short drw_h, - RegionPtr clipBoxes, pointer data ); -typedef void (* StopVideoFuncPtr)(ScrnInfoPtr pScrn, pointer data, Bool Exit); -typedef int (* SetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, Atom attribute, - INT32 value, pointer data); -typedef int (* GetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, Atom attribute, - INT32 *value, pointer data); -typedef void (* QueryBestSizeFuncPtr)(ScrnInfoPtr pScrn, Bool motion, - short vid_w, short vid_h, short drw_w, short drw_h, - unsigned int *p_w, unsigned int *p_h, pointer data); -typedef int (* PutImageFuncPtr)( ScrnInfoPtr pScrn, - short src_x, short src_y, short drw_x, short drw_y, - short src_w, short src_h, short drw_w, short drw_h, - int image, unsigned char* buf, short width, short height, Bool Sync, - RegionPtr clipBoxes, pointer data ); -typedef int (* ReputImageFuncPtr)( ScrnInfoPtr pScrn, short drw_x, short drw_y, - RegionPtr clipBoxes, pointer data ); -typedef int (*QueryImageAttributesFuncPtr)(ScrnInfoPtr pScrn, - int image, unsigned short *width, unsigned short *height, - int *pitches, int *offsets); - -typedef enum { - XV_OFF, - XV_PENDING, - XV_ON -} XvStatus; - -/*** this is what the driver needs to fill out ***/ - -typedef struct { - int id; - char *name; - unsigned short width, height; - XvRationalRec rate; -} XF86VideoEncodingRec, *XF86VideoEncodingPtr; - -typedef struct { - char depth; - short class; -} XF86VideoFormatRec, *XF86VideoFormatPtr; - -typedef struct { - int flags; - int min_value; - int max_value; - char *name; -} XF86AttributeRec, *XF86AttributePtr; - -typedef struct { - unsigned int type; - int flags; - char *name; - int nEncodings; - XF86VideoEncodingPtr pEncodings; - int nFormats; - XF86VideoFormatPtr pFormats; - int nPorts; - DevUnion *pPortPrivates; - int nAttributes; - XF86AttributePtr pAttributes; - int nImages; - XF86ImagePtr pImages; - PutVideoFuncPtr PutVideo; - PutStillFuncPtr PutStill; - GetVideoFuncPtr GetVideo; - GetStillFuncPtr GetStill; - StopVideoFuncPtr StopVideo; - SetPortAttributeFuncPtr SetPortAttribute; - GetPortAttributeFuncPtr GetPortAttribute; - QueryBestSizeFuncPtr QueryBestSize; - PutImageFuncPtr PutImage; - ReputImageFuncPtr ReputImage; - QueryImageAttributesFuncPtr QueryImageAttributes; -} XF86VideoAdaptorRec, *XF86VideoAdaptorPtr; - -typedef struct { - XF86ImagePtr image; - int flags; - int (*alloc_surface)(ScrnInfoPtr pScrn, - int id, - unsigned short width, - unsigned short height, - XF86SurfacePtr surface); - int (*free_surface)(XF86SurfacePtr surface); - int (*display) (XF86SurfacePtr surface, - short vid_x, short vid_y, - short drw_x, short drw_y, - short vid_w, short vid_h, - short drw_w, short drw_h, - RegionPtr clipBoxes); - int (*stop) (XF86SurfacePtr surface); - int (*getAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 *value); - int (*setAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 value); - int max_width; - int max_height; - int num_attributes; - XF86AttributePtr attributes; -} XF86OffscreenImageRec, *XF86OffscreenImagePtr; - -Bool -xf86XVScreenInit( - ScreenPtr pScreen, - XF86VideoAdaptorPtr *Adaptors, - int num -); - -typedef int (* xf86XVInitGenericAdaptorPtr)(ScrnInfoPtr pScrn, - XF86VideoAdaptorPtr **Adaptors); - -int -xf86XVRegisterGenericAdaptorDriver( - xf86XVInitGenericAdaptorPtr InitFunc -); - -int -xf86XVListGenericAdaptors( - ScrnInfoPtr pScrn, - XF86VideoAdaptorPtr **Adaptors -); - -Bool -xf86XVRegisterOffscreenImages( - ScreenPtr pScreen, - XF86OffscreenImagePtr images, - int num -); - -XF86OffscreenImagePtr -xf86XVQueryOffscreenImages( - ScreenPtr pScreen, - int *num -); - -XF86VideoAdaptorPtr xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr pScrn); - -void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr); - -void -xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes); - -Bool -xf86XVClipVideoHelper( - BoxPtr dst, - INT32 *xa, - INT32 *xb, - INT32 *ya, - INT32 *yb, - RegionPtr reg, - INT32 width, - INT32 height -); - -void -xf86XVCopyYUV12ToPacked( - const void *srcy, - const void *srcv, - const void *srcu, - void *dst, - int srcPitchy, - int srcPitchuv, - int dstPitch, - int h, - int w -); - -void -xf86XVCopyPacked( - const void *src, - void *dst, - int srcPitch, - int dstPitch, - int h, - int w -); - -#endif /* _XF86XV_H_ */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86xvmc.c b/nx-X11/programs/Xserver/hw/xfree86/common/xf86xvmc.c deleted file mode 100644 index a39e1bd4d..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86xvmc.c +++ /dev/null @@ -1,243 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xvmc.c,v 1.6 2003/10/08 22:31:59 mvojkovi Exp $ */ - -/* - * Copyright (c) 2001-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include -#include -#include "scrnintstr.h" -#include "resource.h" -#include "dixstruct.h" - -#ifdef XFree86LOADER -#include "xvmodproc.h" -#endif - -#include "xf86xvpriv.h" -#include "xf86xvmc.h" - -#ifdef XFree86LOADER -int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr) = NULL; -#else -int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr) = XvMCScreenInit; -#endif - - -typedef struct { - CloseScreenProcPtr CloseScreen; - int num_adaptors; - XF86MCAdaptorPtr *adaptors; - XvMCAdaptorPtr dixinfo; -} xf86XvMCScreenRec, *xf86XvMCScreenPtr; - -static unsigned long XF86XvMCGeneration = 0; -static int XF86XvMCScreenIndex = -1; - -#define XF86XVMC_GET_PRIVATE(pScreen) \ - (xf86XvMCScreenPtr)((pScreen)->devPrivates[XF86XvMCScreenIndex].ptr) - - -static int -xf86XvMCCreateContext ( - XvPortPtr pPort, - XvMCContextPtr pContext, - int *num_priv, - CARD32 **priv -) -{ - xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); - ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; - - pContext->port_priv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - - return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateContext)( - pScrn, pContext, num_priv, priv); -} - -static void -xf86XvMCDestroyContext ( XvMCContextPtr pContext) -{ - xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); - ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; - - (*pScreenPriv->adaptors[pContext->adapt_num]->DestroyContext)( - pScrn, pContext); -} - -static int -xf86XvMCCreateSurface ( - XvMCSurfacePtr pSurface, - int *num_priv, - CARD32 **priv -) -{ - XvMCContextPtr pContext = pSurface->context; - xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); - ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; - - return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateSurface)( - pScrn, pSurface, num_priv, priv); -} - -static void -xf86XvMCDestroySurface (XvMCSurfacePtr pSurface) -{ - XvMCContextPtr pContext = pSurface->context; - xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); - ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; - - (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySurface)( - pScrn, pSurface); -} - -static int -xf86XvMCCreateSubpicture ( - XvMCSubpicturePtr pSubpicture, - int *num_priv, - CARD32 **priv -) -{ - XvMCContextPtr pContext = pSubpicture->context; - xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); - ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; - - return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateSubpicture)( - pScrn, pSubpicture, num_priv, priv); -} - -static void -xf86XvMCDestroySubpicture (XvMCSubpicturePtr pSubpicture) -{ - XvMCContextPtr pContext = pSubpicture->context; - xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); - ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; - - (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySubpicture)( - pScrn, pSubpicture); -} - - -static Bool -xf86XvMCCloseScreen (int i, ScreenPtr pScreen) -{ - xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pScreen); - - pScreen->CloseScreen = pScreenPriv->CloseScreen; - - xfree(pScreenPriv->dixinfo); - xfree(pScreenPriv); - - return (*pScreen->CloseScreen)(i, pScreen); -} - -Bool xf86XvMCScreenInit( - ScreenPtr pScreen, - int num_adaptors, - XF86MCAdaptorPtr *adaptors -) -{ - XvMCAdaptorPtr pAdapt; - xf86XvMCScreenPtr pScreenPriv; - XvScreenPtr pxvs = - (XvScreenPtr)(pScreen->devPrivates[XF86XvScreenIndex].ptr); - - int i, j; - - if(!XvMCScreenInitProc) return FALSE; - - if(XF86XvMCGeneration != serverGeneration) { - if((XF86XvMCScreenIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - XF86XvMCGeneration = serverGeneration; - } - - if(!(pAdapt = xalloc(sizeof(XvMCAdaptorRec) * num_adaptors))) - return FALSE; - - if(!(pScreenPriv = xalloc(sizeof(xf86XvMCScreenRec)))) { - xfree(pAdapt); - return FALSE; - } - - pScreen->devPrivates[XF86XvMCScreenIndex].ptr = (pointer)pScreenPriv; - - pScreenPriv->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = xf86XvMCCloseScreen; - - pScreenPriv->num_adaptors = num_adaptors; - pScreenPriv->adaptors = adaptors; - pScreenPriv->dixinfo = pAdapt; - - for(i = 0; i < num_adaptors; i++) { - pAdapt[i].xv_adaptor = NULL; - for(j = 0; j < pxvs->nAdaptors; j++) { - if(!strcmp((*adaptors)->name, pxvs->pAdaptors[j].name)) { - pAdapt[i].xv_adaptor = &(pxvs->pAdaptors[j]); - break; - } - } - if(!pAdapt[i].xv_adaptor) { - /* no adaptor by that name */ - xfree(pAdapt); - return FALSE; - } - pAdapt[i].num_surfaces = (*adaptors)->num_surfaces; - pAdapt[i].surfaces = (XvMCSurfaceInfoPtr*)((*adaptors)->surfaces); - pAdapt[i].num_subpictures = (*adaptors)->num_subpictures; - pAdapt[i].subpictures = (XvImagePtr*)((*adaptors)->subpictures); - pAdapt[i].CreateContext = xf86XvMCCreateContext; - pAdapt[i].DestroyContext = xf86XvMCDestroyContext; - pAdapt[i].CreateSurface = xf86XvMCCreateSurface; - pAdapt[i].DestroySurface = xf86XvMCDestroySurface; - pAdapt[i].CreateSubpicture = xf86XvMCCreateSubpicture; - pAdapt[i].DestroySubpicture = xf86XvMCDestroySubpicture; - adaptors++; - } - - if(Success != (*XvMCScreenInitProc)(pScreen, num_adaptors, pAdapt)) - return FALSE; - - return TRUE; -} - -XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec (void) -{ - return xcalloc(1, sizeof(XF86MCAdaptorRec)); -} - -void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor) -{ - xfree(adaptor); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86xvmc.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86xvmc.h deleted file mode 100644 index 0b073aac8..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86xvmc.h +++ /dev/null @@ -1,164 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h,v 1.7 2003/10/08 22:31:59 mvojkovi Exp $ */ - -/* - * Copyright (c) 2001 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifndef _XF86XVMC_H -#define _XF86XVMC_H - -#include "xvmcext.h" -#include "xf86xv.h" - -typedef struct { - int num_xvimages; - int *xvimage_ids; /* reference the subpictures in the XF86MCAdaptorRec */ -} XF86MCImageIDList; - -typedef struct { - int surface_type_id; /* Driver generated. Must be unique on the port */ - int chroma_format; - int color_description; /* no longer used */ - unsigned short max_width; - unsigned short max_height; - unsigned short subpicture_max_width; - unsigned short subpicture_max_height; - int mc_type; - int flags; - XF86MCImageIDList *compatible_subpictures; /* can be null, if none */ -} XF86MCSurfaceInfoRec, *XF86MCSurfaceInfoPtr; - - -/* - xf86XvMCCreateContextProc - - DIX will fill everything out in the context except the driver_priv. - The port_priv holds the private data specified for the port when - Xv was initialized by the driver. - The driver may store whatever it wants in driver_priv and edit - the width, height and flags. If the driver wants to return something - to the client it can allocate space in priv and specify the number - of 32 bit words in num_priv. This must be dynamically allocated - space because DIX will free it after it passes it to the client. -*/ - - -typedef int (*xf86XvMCCreateContextProcPtr) ( - ScrnInfoPtr pScrn, - XvMCContextPtr context, - int *num_priv, - CARD32 **priv -); - -typedef void (*xf86XvMCDestroyContextProcPtr) ( - ScrnInfoPtr pScrn, - XvMCContextPtr context -); - -/* - xf86XvMCCreateSurfaceProc - - DIX will fill everything out in the surface except the driver_priv. - The driver may store whatever it wants in driver_priv. The driver - may pass data back to the client in the same manner as the - xf86XvMCCreateContextProc. -*/ - - -typedef int (*xf86XvMCCreateSurfaceProcPtr) ( - ScrnInfoPtr pScrn, - XvMCSurfacePtr surface, - int *num_priv, - CARD32 **priv -); - -typedef void (*xf86XvMCDestroySurfaceProcPtr) ( - ScrnInfoPtr pScrn, - XvMCSurfacePtr surface -); - -/* - xf86XvMCCreateSubpictureProc - - DIX will fill everything out in the subpicture except the driver_priv, - num_palette_entries, entry_bytes and component_order. The driver may - store whatever it wants in driver_priv and edit the width and height. - If it is a paletted subpicture the driver needs to fill out the - num_palette_entries, entry_bytes and component_order. These are - not communicated to the client until the time the surface is - created. - - The driver may pass data back to the client in the same manner as the - xf86XvMCCreateContextProc. -*/ - - -typedef int (*xf86XvMCCreateSubpictureProcPtr) ( - ScrnInfoPtr pScrn, - XvMCSubpicturePtr subpicture, - int *num_priv, - CARD32 **priv -); - -typedef void (*xf86XvMCDestroySubpictureProcPtr) ( - ScrnInfoPtr pScrn, - XvMCSubpicturePtr subpicture -); - - -typedef struct { - char *name; - int num_surfaces; - XF86MCSurfaceInfoPtr *surfaces; - int num_subpictures; - XF86ImagePtr *subpictures; - xf86XvMCCreateContextProcPtr CreateContext; - xf86XvMCDestroyContextProcPtr DestroyContext; - xf86XvMCCreateSurfaceProcPtr CreateSurface; - xf86XvMCDestroySurfaceProcPtr DestroySurface; - xf86XvMCCreateSubpictureProcPtr CreateSubpicture; - xf86XvMCDestroySubpictureProcPtr DestroySubpicture; -} XF86MCAdaptorRec, *XF86MCAdaptorPtr; - -/* - xf86XvMCScreenInit - - Unlike Xv, the adaptor data is not copied from this structure. - This structure's data is used so it must stick around for the - life of the server. Note that it's an array of pointers not - an array of structures. -*/ - -Bool xf86XvMCScreenInit( - ScreenPtr pScreen, - int num_adaptors, - XF86MCAdaptorPtr *adaptors -); - -XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec (void); -void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor); - -#endif /* _XF86XVMC_H */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xf86xvpriv.h b/nx-X11/programs/Xserver/hw/xfree86/common/xf86xvpriv.h deleted file mode 100644 index 0d1efdafb..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xf86xvpriv.h +++ /dev/null @@ -1,86 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xvpriv.h,v 1.2 2003/08/24 17:36:56 dawes Exp $ */ - -/* - * Copyright (c) 2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifndef _XF86XVPRIV_H_ -#define _XF86XVPRIV_H_ - -#include "xf86xv.h" - -/*** These are DDX layer privates ***/ - -extern int XF86XvScreenIndex; - -typedef struct { - DestroyWindowProcPtr DestroyWindow; - ClipNotifyProcPtr ClipNotify; - WindowExposuresProcPtr WindowExposures; - void (*AdjustFrame)(int, int, int, int); - Bool (*EnterVT)(int, int); - void (*LeaveVT)(int, int); - GCPtr videoGC; -} XF86XVScreenRec, *XF86XVScreenPtr; - -typedef struct { - int flags; - PutVideoFuncPtr PutVideo; - PutStillFuncPtr PutStill; - GetVideoFuncPtr GetVideo; - GetStillFuncPtr GetStill; - StopVideoFuncPtr StopVideo; - SetPortAttributeFuncPtr SetPortAttribute; - GetPortAttributeFuncPtr GetPortAttribute; - QueryBestSizeFuncPtr QueryBestSize; - PutImageFuncPtr PutImage; - ReputImageFuncPtr ReputImage; - QueryImageAttributesFuncPtr QueryImageAttributes; -} XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr; - -typedef struct { - ScrnInfoPtr pScrn; - DrawablePtr pDraw; - unsigned char type; - unsigned int subWindowMode; - DDXPointRec clipOrg; - RegionPtr clientClip; - RegionPtr pCompositeClip; - Bool FreeCompositeClip; - XvAdaptorRecPrivatePtr AdaptorRec; - XvStatus isOn; - Bool moved; - int vid_x, vid_y, vid_w, vid_h; - int drw_x, drw_y, drw_w, drw_h; - DevUnion DevPriv; -} XvPortRecPrivate, *XvPortRecPrivatePtr; - -typedef struct _XF86XVWindowRec{ - XvPortRecPrivatePtr PortRec; - struct _XF86XVWindowRec *next; -} XF86XVWindowRec, *XF86XVWindowPtr; - -#endif /* _XF86XVPRIV_H_ */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xisb.c b/nx-X11/programs/Xserver/hw/xfree86/common/xisb.c deleted file mode 100644 index 4ffc3ede4..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xisb.c +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 1997 Metro Link Incorporated - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of the Metro Link shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Metro Link. - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xisb.c,v 1.5 2000/11/06 19:24:07 dawes Exp $ */ - -/* - X Input Serial Buffer routines for use in any XInput driver that accesses - a serial device. -*/ - - -/***************************************************************************** - * Standard Headers - ****************************************************************************/ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifdef __UNIXOS2__ -#define I_NEED_OS2_H -#endif - -#include -#include -#include -#include -#include -#include -#include "xisb.h" - -/***************************************************************************** - * Local Headers - ****************************************************************************/ - -/***************************************************************************** - * Variables without includable headers - ****************************************************************************/ - -/***************************************************************************** - * Local Variables - ****************************************************************************/ - -/***************************************************************************** - * Function Definitions - ****************************************************************************/ - -XISBuffer * -XisbNew (int fd, xf86ssize_t size) -{ - XISBuffer *b; - - b = xalloc (sizeof (XISBuffer)); - if (!b) - return (NULL); - b->buf = xalloc ((sizeof (unsigned char) * size)); - if (!b->buf) - { - xfree (b); - return (NULL); - } - - b->fd = fd; - b->trace = 0; - b->block_duration = 0; - b->current = 1; /* force it to be past the end to trigger initial read */ - b->end = 0; - b->buffer_size = size; - return (b); -} - -void -XisbFree (XISBuffer *b) -{ - xfree (b->buf); - xfree (b); -} - -int -XisbRead (XISBuffer *b) -{ - int ret; - - if (b->current >= b->end) - { - if (b->block_duration >= 0) - { - if (xf86WaitForInput (b->fd, b->block_duration) < 1) - return (-1); - } - else - { - /* - * automatically clear it so if XisbRead is called in a loop - * the next call will make sure there is data with select and - * thus prevent a blocking read - */ - b->block_duration = 0; - } - - ret = xf86ReadSerial (b->fd, b->buf, b->buffer_size); - switch (ret) - { - case 0: - return (-1); /* timeout */ - case -1: - return (-2); /* error */ - default: - b->end = ret; - b->current = 0; - break; - } - } - if (b->trace) - ErrorF ("read 0x%02x (%c)\n", b->buf[b->current], - isprint(b->buf[b->current])?b->buf[b->current]:'.'); - - return (b->buf[b->current++]); -} - -/* the only purpose of this function is to provide output tracing */ -xf86ssize_t -XisbWrite (XISBuffer *b, unsigned char *msg, xf86ssize_t len) -{ - if (b->trace) - { - int i = 0; - for (i = 0; i < len; i++) - ErrorF ("\t\twrote 0x%02x (%c)\n", msg[i], msg[i]); - } - return (xf86WriteSerial (b->fd, msg, len)); -} - -/* turn tracing of this buffer on (1) or off (0) */ -void -XisbTrace (XISBuffer *b, int trace) -{ - b->trace = trace; -} - -/* - * specify a block_duration of -1 when you know the buffer's fd is ready to - * read. After a read, it is automatically set to 0 so that the next read - * will use check to select for data and prevent a block. - * It is the caller's responsibility to set the block_duration to -1 if it - * knows that there is data to read (because the main select loop triggered - * the read) and want's to avoid the unnecessary overhead of the select call - * - * a zero or positive block duration will cause the select to block for the - * give duration in usecs. - */ - -void -XisbBlockDuration (XISBuffer *b, int block_duration) -{ - b->block_duration = block_duration; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xisb.h b/nx-X11/programs/Xserver/hw/xfree86/common/xisb.h deleted file mode 100644 index 39ae2ee11..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xisb.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1997 Metro Link Incorporated - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of the Metro Link shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Metro Link. - * - */ -/* $XFree86$ */ - -#ifndef _xisb_H_ -#define _xisb_H_ - -/****************************************************************************** - * Definitions - * structs, typedefs, #defines, enums - *****************************************************************************/ - -typedef struct _XISBuffer -{ - int fd; - int trace; - int block_duration; - xf86ssize_t current; /* bytes read */ - xf86ssize_t end; - xf86ssize_t buffer_size; - unsigned char *buf; -} XISBuffer; - -/****************************************************************************** - * Declarations - * variables: use xisb_LOC in front - * of globals. - * put locals in the .c file. - *****************************************************************************/ -XISBuffer * XisbNew (int fd, xf86ssize_t size); -void XisbFree (XISBuffer *b); -int XisbRead (XISBuffer *b); -xf86ssize_t XisbWrite (XISBuffer *b, unsigned char *msg, xf86ssize_t len); -void XisbTrace (XISBuffer *b, int trace); -void XisbBlockDuration (XISBuffer *b, int block_duration); - -/* - * DO NOT PUT ANYTHING AFTER THIS ENDIF - */ -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/common/xorgHelper.c b/nx-X11/programs/Xserver/hw/xfree86/common/xorgHelper.c deleted file mode 100644 index 408583da8..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/common/xorgHelper.c +++ /dev/null @@ -1,24 +0,0 @@ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/xorgHelper.c,v 1.6 2005/07/03 08:53:42 daniels Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "os.h" -#include "servermd.h" -#include "pixmapstr.h" -#include "windowstr.h" -#include "propertyst.h" -#include "gcstruct.h" -#include "loaderProcs.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xorgVersion.h" - - -CARD32 -xorgGetVersion() -{ - return XORG_VERSION_CURRENT; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/Imakefile deleted file mode 100644 index 648fdc762..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/Imakefile +++ /dev/null @@ -1,130 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/Imakefile,v 3.61 2003/11/03 05:11:51 tsi Exp $ - - - - - -XCOMM $XdotOrg: xc/programs/Xserver/hw/xfree86/os-support/Imakefile,v 1.6 2005/12/01 02:15:38 ajax Exp $ -XCOMM $XConsortium: Imakefile /main/9 1996/10/25 15:38:46 kaleb $ - -#include - -#define IHaveSubdirs - -#if defined(i386Architecture) || defined(ia64Architecture) || \ - (defined(SunArchitecture) && defined(SparcArchitecture)) || \ - (defined(KFreeBSDArchitecture) && defined(AlphaArchitecture)) || \ - (defined(KFreeBSDArchitecture) && defined(Sparc64Architecture)) || \ - (defined(KFreeBSDArchitecture) && defined(PpcArchitecture)) || \ - (defined(KNetBSDArchitecture) && defined(AlphaArchitecture)) || \ - (defined(KNetBSDArchitecture) && defined(PpcArchitecture)) || \ - (defined(KNetBSDArchitecture) && defined(SparcArchitecture)) || \ - defined(KOpenBSDArchitecture) || defined(SGIArchitecture) || \ - (defined(LynxOSArchitecture) && defined(PpcArchitecture)) || \ - defined(AMD64Architecture) || defined(LinuxArchitecture) || \ - defined(GNUMachArchitecture) -BUS_SUBDIR = bus -#endif - -#if defined(QNX4Architecture) -OS_SUBDIR = qnx4 -#endif - -#if defined(NTOArchitecture) -OS_SUBDIR = nto -#endif - -#if defined(SVR3Architecture) -# if defined(i386ScoArchitecture) -OS_SUBDIR = sco -# else -OS_SUBDIR = sysv -# endif -#endif - -#if defined(SVR4Architecture) -# if defined(SunArchitecture) -OS_SUBDIR = sunos -# elif defined(PmaxOSArchitecture) -OS_SUBDIR = pmax -# elif defined(DguxArchitecture) -OS_SUBDIR = dgux -# elif defined(SGIArchitecture) -OS_SUBDIR = irix -# elif defined(UnixWareArchitecture) -OS_SUBDIR = usl -# else -OS_SUBDIR = sysv -# endif -#endif - -#if defined(LinuxArchitecture) -OS_SUBDIR = linux -#endif - -#if defined(LynxOSArchitecture) -OS_SUBDIR = lynxos -#endif - -#if defined(KFreeBSDArchitecture) || defined(NetBSDArchitecture) || \ - defined(OpenBSDArchitecture) -OS_SUBDIR = bsd -#endif - -#if defined(BSDOSArchitecture) -OS_SUBDIR = bsdi -#endif - -#if defined(GNUMachArchitecture) -OS_SUBDIR = hurd -#endif - -#if defined(OS2Architecture) -OS_SUBDIR = os2 -#endif - -#if defined(i386Sco325Architecture) -OS_SUBDIR = sco -#endif - -#if !DoLoadableServer - -#if BuildXF86DRI -DRM_SRC = $(OS_SUBDIR)/drm/?*.c -DRM_OBJ = $(OS_SUBDIR)/drm/?*.o -DRM_DONES = $(OS_SUBDIR)/drm/DONE -#endif - -#endif - -LIBDRM_DIR = ../../../../../extras/drm/libdrm - -SUBDIRS = $(OS_SUBDIR) $(BUS_SUBDIR) misc - -SRCS = $(OS_SUBDIR)/?*.c $(BUS_SUBDIR)/?*.c misc/?*.c $(DRM_SRC) -OBJS = $(OS_SUBDIR)/?*.o $(BUS_SUBDIR)/?*.o misc/?*.o $(DRM_OBJ) - -DONES = $(OS_SUBDIR)/DONE $(BUS_SUBDIR)/DONE misc/DONE $(DRM_DONES) - -#if HasParallelMake -MakeMutex($(SUBDIRS) $(OBJS) $(DONES)) -#endif - -#if HasGnuMake || HasBsdMake -$(DONES): $(SUBDIRS) -#endif - -NormalDepLibraryTarget(xf86_os,$(SUBDIRS) $(DONES),$(OBJS)) - -ForceSubdirs($(SUBDIRS)) - -DependSubdirs($(SUBDIRS)) - -LinkSourceFile(xf86drm.h,$(LIBDRM_DIR)) - -InstallDriverSDKNonExecFile(xf86_OSproc.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86_OSlib.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86_ansic.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86_libc.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(xf86drm.h,$(DRIVERSDKINCLUDEDIR)) -InstallDriverSDKNonExecFile(assyntax.h,$(DRIVERSDKINCLUDEDIR)) diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/README.OS-lib b/nx-X11/programs/Xserver/hw/xfree86/os-support/README.OS-lib deleted file mode 100644 index 43312e4e8..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/README.OS-lib +++ /dev/null @@ -1,506 +0,0 @@ - - README for XFree86 OS-support Layer - ----------------------------------- - -Contents --------- - 1) Overview - 2) Directory Layout - 3) Adding a new OS - 4) OS Support API - -1 - Overview ------------- - This directory contains the OS support layer functions for the XFree86 -servers. In addition, some miscellaneous server support functions (not -OS-dependent) are included here, to take advantage of the fact that this -library comes last in the linking order. - -Most of the functionality required to support a new OS is encapsulated in -this library. It is hoped that all OS-specific details can be encapsulated, -but that is not likely ever to be completely possible. Hence some minor -changes will wind up being made in other parts of the server. The major -design principles for this library are maintainability, readability, and -portability. Sometimes these goals conflict; some somewhat arbitrary choices -have been made in implementation. - -2 - Directory Layout --------------------- - os-support/ Contains headers and documentation; no code - misc/ Non-OS-specific miscellaneous functions that - fit best into the link architecture this way. - shared/ Contains files with functions used by more than one - OS. These are symlinked into the OS subdirectories - at build time via Imakefile rules. This is alway - preferable to reproducing functions in more than one - OS library. - bsd/ OS support for the 386BSD/NetBSD/FreeBSD operating - systems. - bsdi/ OS support for the BSD/386 operating system. - linux/ OS support for the Linux operating system. - os2/ OS support for OS/2 2.11 and OS/2 Warp - sco/ OS support for the SCO SVR3.x operating system. - solx86/ OS support for the Solaris x86 operating system. - sysv/ OS support for all SVR4.0 and SVR4.2, and for - ISC and AT&T SVR3.2 operating systems. - -3 - Adding A New OS -------------------- - Adding a support for a new operating system entails implementing all of -the functions described in the API below. Many of these functions are no-ops -for many operating systems, and appropriate files with dummy declarations are -available in the 'shared' subdirectory. - -If your OS is sufficiently similar to an existing OS, you can make use of -the existing subdirectory. One of the reasons for implementing this OS -library was the unmaintainability of the spagetti-#ifdef code that existed -before. You should try to avoid cluttering the code with #ifdef's. If -you find that the subdirectory is getting cluttered, split off into a -seperate subdirectory (e.g. as was done for SCO, rather than cluttering -the 'sysv' subdirectory). You can split functions out of an existing -subdirectory into the 'shared' subdirectory, if that is appropriate. Just -remember to update the Imakefile for the old subdirectory. - -You will still likely have to make some small changes to other parts of -the server. You should not put OS-specific #define's or #include's anywhere -else in the server. These should all go in the "xf86_OSlib.h" header file -in this directory. - -4 - OS Support API ------------------ -void xf86OpenConsole(void) -{ - /* - * Open console device, activate VTs, etc, etc. Fill in requisite - * pieces of xf86Info. Most of this code comes from xf86Init.c - */ -} - -void xf86CloseConsole(void) -{ - /* - * Close console at server exit. - */ -} - -Bool xf86VTSwitchPending(void) -{ - /* - * Returns TRUE iff there is a VT switch operation pending for - * the server. In the USL VT model, this is indicated via a - * signal handler. Should return FALSE always for OSs without - * VTs. - */ -} - -Bool xf86VTSwitchAway(void) -{ - /* - * Handles the OS-specific action for switching away from the active - * VT. Returns FALSE if the switch away fails. Should return - * FALSE always for OSs without VTs (then again, this function - * should never be called in that case). - */ -} - -Bool xf86VTSwitchTo(void) -{ - /* - * Handles the OS-specific action for switching to the active VT. - * Returns FALSE if the switch to fails. Should return TRUE - * always for OSs without VTs (then again, this function should - * never be called in that case). - */ -} - -Bool xf86LinearVidMem(void) -{ - /* - * Returns TRUE if the OS supports mapping linear frame buffers - * (ie memory at addresses above physical memory). - */ -} - -pointer xf86MapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - /* - * Handle mapping the video memory. Returns (pointer *)0 for - * failure; causes server exit. It is allowable to call FatalError() - * from inside this function and exit directly. - */ -} - -void xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - /* - * Handle unmapping the video memory. This should undo what - * xf86MapVidMem() does. Base is a pointer obtained from - * a previous call to xf86MapVidMem(). - */ -} - -void xf86MapDisplay(int ScreenNum, int Region) -{ - /* - * For OSs that require the screen be mapped when entering a VT. - * A dummy function will be defined for OSs that don't require - * this (or don't have VTs at all). - */ -} - -void xf86UnMapDisplay(int ScreenNum, int Region) -{ - /* - * For Os that require that the screen be unmapped when leaving a - * VT. A dummy function will be defined for OSs that don't require - * this (or don't have VTs at all). - */ -} - -int xf86ReadBIOS(unsigned long Base, unsigned long Offset, - unsigned char *Buf, int Len) -{ - /* - * Read Len bytes from the BIOS at address Base, offset Offset, - * into buffer Buf. Returns -1 for failure or if the OS does - * not support reading the BIOS. This causes a driver probe - * to fail, but does not cause the server to abort. - */ -} - - -void xf86EnableIOPorts(int ScreenNum) -{ - /* - * Enables I/O permissions. The OS layer should - * enable all I/O port access. - */ -} - -void xf86DisableIOPorts(int ScreenNum) -{ - /* - * Disables I/O permissions. - */ -} - -Bool xf86DisableInterrupts(void) -{ - /* - * Disable interrupts if allowed for this OS. Returns FALSE if - * this is not allowed or if the attempt fails for some reason. - */ -} - -void xf86EnableInterrupts(void) -{ - /* - * Reenable interrupts - */ -} - -int xf86ProcessArgument(int argc, char *argv[], int i) -{ - /* - * Process OS-specific command-line arguments. See - * ddxProcessArgument() for more info. - */ -} - -void xf86UseMsg(void) -{ - /* - * Print list of OS-specific command-line arguments. See - * ddxUseMsg() for more info. - */ -} - -void xf86SoundKbdBell(int loudness, int pitch, int duration) -{ - /* - * Sound the keyboard bell. pitch is in Hz, duration in ms, - * loudness is in the range 0-100 (0 -> off). For systems - * where the loudness can't be controlled, scale the duration - * by loudness/50. - */ -} - -void xf86SetKbdLeds(int leds) -{ - /* - * Set the keyboard LEDs to the state indicated in leds - */ -} - -int xf86GetKbdLeds(void) -{ - /* - * Return the state of the keyboard LEDs. If the OS doesn't - * support this, return 0. - */ -} - -void xf86SetKbdRepeat(char rad) -{ - /* - * Set the keyboard repeat rate and delay according the - * the rad value. The lower 5 bits determine the repeat - * rate (lower value -> higher rate). The next 2 bits - * determine the delay. - * This should possibly be changed to take separate rate and - * delay parameters. - */ -} - -void xf86KbdInit(void) -{ - /* - * Save initial keyboard state. This is called at the start of - * each server generation. - */ -} - -int xf86KbdOn(void) -{ - /* - * Set the keyboard up for use with X. This is called whenever - * the server becomes active (ie at the start of each generation and - * whenever its VT becomes active). Return the file descriptor - * for keyboard input. Return -1 if there is no file descriptor - * to add as an input device. If there are errors encountered, - * call FatalError(). A return value of -1 is not considered an - * error condition. - */ -} - -int xf86KbdOff(void) -{ - /* - * Return the keyboard to the state saved by xf86KbdInit(). This is - * called at the end of a server generation, and also when the - * server's VT ceases being active. Returns the keyboard file - * descriptor. Returns -1 if there is no file descriptor to be - * removed as an input device. Errors should be handled the same - * way as in xf86KbdOn(). - */ -} - -void xf86KbdEvents(void) -{ - /* - * Read characters from the keyboard device, and post the events - * by calling xf86PostKbdEvent(). Read as much as is available - * without waiting. - */ -} - -void xf86SetMouseSpeed(int old, int new, unsigned cflag) -{ - /* - * Set the speed of the mouse port. old is the previous speed, - * new is the new speed, and cflag is the value of the termio[s] - * c_cflag field. For mice that have programmable speed operation, - * this should send the appropriate commands to the mouse. - */ -} - -void xf86MouseInit(void) -{ - /* - * This is called at the start of each server generation. In most - * cases this is a noop. If the mouse must not be opened/closed - * when VT switching, the open should be done here. - */ -} - -int xf86MousedOn(void) -{ - /* - * Set the mouse up for use with X. This is called whenever - * the server becomes active (ie at the start of each generation and - * whenever its VT becomes active). This function normally opens - * the mouse device, and may call xf86SetupMouse() to initialise - * the mouse parameters. Return the file descriptor for mouse input. - * Return -1 if there is no file descriptor to add as an input - * device. If there are errors encountered, call FatalError(). - * A return value of -1 is not considered an error condition. - */ -} - -int xf86MouseOff(Bool doclose) -{ - /* - * Release the mouse from use with X. This is called at the end - * of a server generation (with doclose==TRUE), and also when the - * server's VT ceases being active (with doclose==FALSE). If the - * mouse should not be opened/closed when VT switching, the close - * should be done here when doclose==TRUE. For other systems, the - * mouse device should be closed regardless of the doclose value. - * Returns the mouse file descriptor. Returns -1 if there is no - * file descriptor to be removed as an input device. Errors - * should be handled the same way as in xf86MouseOn(). - */ -} - -void xf86MouseEvents(void) -{ - /* - * Read characters from the mouse device, and post the events - * by calling xf86PostMseEvent(). Read as much as is available - * without waiting. If the OS doesn't handle the mouse protocol - * translation, xf86MouseProtocol() may be called to do the - * translation and event posting. If the OS does handle the protocol - * translation, MOUSE_PROTOCOL_IN_KERNEL should be #define'd in - * xf86_OSlib.h. - */ -} - -int xf86OsMouseProc(DevicePtr pPointer, int what) -{ - /* - * Implements the device-proc for the pointer device when an - * OS-based mouse driver is being used (as opposed to the - * server's internal mouse driver). Implemented as any other - * device-proc in the server. - * - * This function only needs to be implemented if USE_OSMOUSE is - * defined for the OS. - */ -} - -int xf86OsMouseEvents(void) -{ - /* - * When supporting an OS-based mouse driver (as opposed to the - * server's internal mouse driver), read some events from the device - * and post them to the DIX layer through xf86PostMseEvent(). - * - * This function only needs to be implemented if USE_OSMOUSE is - * defined for the OS. - */ -} - -void xf86OsMouseOption(int token, pointer lex_ptr) -{ - /* - * Used in parsing an OsMouse keyword from the Xconfig file. - * Passed the token type and a pointer to the token value. - * The function should do whatever is appropriate for the OS's - * mouse driver. - * - * This function only needs to be implemented if USE_OSMOUSE is - * defined for the OS. - */ -} - -/* - * The following functions are simply wrappers around the OS specific - * libc functions - */ - -void * -xf86memmove(void * dest, const void * src, INT32 n) -{ - return(memmove(dest,src,n)); -} - -void * -xf86memset(void * s, int c, INT32 n) -{ - return(memset(s,c,n)); -} - -void * -xf86memcpy(void * dest, const void * src, INT32 n) -{ - return(memcpy(dest,src,n)); -} - -int -xf86memcmp(const void * s1, const void * s2, INT32 n) -{ - return(memcmp(s1,s2,n)); -} - -char * -xf86strcat(char * dest, const char * src) -{ - return(strcat(dest,src)); -} - -char * -xf86strcpy(char * dest, const char * src) -{ - return(strcpy(dest,src)); -} - -int -xf86strcmp(const char * s1, const char * s2) -{ - return(strcmp(s1,s2)); -} - -int -xf86strncmp(const char * s1, const char * s2, INT32 n) -{ - return(strncmp(s1,s2,n)); -} - -size_t -xf86strlen(const char * s) -{ - return(strlen(s)); -} - -void -xf86getsecs(INT32 * secs, INT32 * usecs) -{ - struct timeval tv; - - gettimeofday(&tv, NULL); - *secs = tv.tv_sec; - *usecs= tv.tv_usec; - - return; -} - -double -xf86exp(double x) -{ - return(exp(x)); -} - -double -xf86log(double x) -{ - return(log(x)); -} - -double -xf86pow(double x, double y) -{ - return(pow(x,y)); -} - -double -xf86sqrt(double x) -{ - return(sqrt(x)); -} - -double -xf86cos(double x) -{ - return(cos(x)); -} - - - - -$XFree86: xc/programs/Xserver/hw/xfree86/os-support/README.OS-lib,v 3.9 2001/07/23 13:15:48 dawes Exp $ - - - - - -$XConsortium: README.OS-lib /main/5 1996/02/21 17:50:28 kaleb $ diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/assyntax.h b/nx-X11/programs/Xserver/hw/xfree86/os-support/assyntax.h deleted file mode 100644 index 13cc2f3e0..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/assyntax.h +++ /dev/null @@ -1,753 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/assyntax.h,v 3.13 2003/08/24 17:37:03 dawes Exp $ */ - -#ifndef __ASSYNTAX_H__ -#define __ASSYNTAX_H__ - -/* - * Copyright 1992 Vrije Universiteit, The Netherlands - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of the Vrije Universiteit not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. The Vrije Universiteit makes no - * representations about the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - * - * The Vrije Universiteit DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL The Vrije Universiteit BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Copyright (c) 1993-1999 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* $XConsortium: assyntax.h /main/5 1996/02/21 17:50:49 kaleb $ */ - - /* - * assyntax.h - * - * Select the syntax appropriate to the 386 assembler being used - * To add support for more assemblers add more columns to the CHOICE - * macro. Note that register names must also have uppercase names - * to avoid macro recursion. e.g., #define ah %ah recurses! - * - * NB 1. Some of the macros for certain assemblers imply that the code is to - * run in protected mode!! Caveat emptor. - * - * NB 2. 486 specific instructions are not included. This is to discourage - * their accidental use in code that is intended to run on 386 and 486 - * systems. - * - * Supported assemblers: - * - * (a) AT&T SysVr4 as(1): default - * (b) GNU Assembler gas: define USE_GAS or GNU_ASSEMBLER - * (c) Amsterdam Compiler kit: define ACK_ASSEMBLER - * - * The following naming conventions have been used to identify the various - * data types: - * _SR = segment register version - * Integer: - * _Q = quadword = 64 bits - * _L = long = 32 bits - * _W = short = 16 bits - * _B = byte = 8 bits - * Floating-point: - * _X = m80real = 80 bits - * _D = double = 64 bits - * _S = single = 32 bits - * - * Author: Gregory J. Sharp, Sept 1992 - * Vrije Universiteit, Amsterdam, The Netherlands - */ - -#if defined(USE_GAS) && !defined(GNU_ASSEMBLER) -#define GNU_ASSEMBLER -#endif - -#if (defined(__STDC__) && !defined(UNIXCPP)) || (defined (sun) && defined (i386) && defined (SVR4) && defined (__STDC__) && !defined (__GNUC__)) -#define CONCAT(x, y) x ## y -#else -#define CONCAT(x, y) x/**/y -#endif - -#ifdef ACK_ASSEMBLER - -/* Assume we write code for 32-bit protected mode! */ - -/* Redefine register names for GAS & AT&T assemblers */ -#define AL al -#define AH ah -#define AX ax -#define EAX ax -#define BL bl -#define BH bh -#define BX bx -#define EBX bx -#define CL cl -#define CH ch -#define CX cx -#define ECX cx -#define DL dl -#define DH dh -#define DX dx -#define EDX dx -#define BP bp -#define EBP bp -#define SI si -#define ESI si -#define DI di -#define EDI di -#define SP sp -#define ESP sp -#define CS cs -#define SS ss -#define DS ds -#define ES es -#define FS fs -#define GS gs -/* Control Registers */ -#define CR0 cr0 -#define CR1 cr1 -#define CR2 cr2 -#define CR3 cr3 -/* Debug Registers */ -#define DR0 dr0 -#define DR1 dr1 -#define DR2 dr2 -#define DR3 dr3 -#define DR4 dr4 -#define DR5 dr5 -#define DR6 dr6 -#define DR7 dr7 -/* Floating-point Stack */ -#define ST st - -#define AS_BEGIN .sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text - - -#define _WTOG o16 /* word toggle for _W instructions */ -#define _LTOG /* long toggle for _L instructions */ -#define ADDR_TOGGLE a16 -#define OPSZ_TOGGLE o16 -#define USE16 .use16 -#define USE32 .use32 - -#define CHOICE(a,b,c) c - -#else /* AT&T or GAS */ - -/* Redefine register names for GAS & AT&T assemblers */ -#define AL %al -#define AH %ah -#define AX %ax -#define EAX %eax -#define BL %bl -#define BH %bh -#define BX %bx -#define EBX %ebx -#define CL %cl -#define CH %ch -#define CX %cx -#define ECX %ecx -#define DL %dl -#define DH %dh -#define DX %dx -#define EDX %edx -#define BP %bp -#define EBP %ebp -#define SI %si -#define ESI %esi -#define DI %di -#define EDI %edi -#define SP %sp -#define ESP %esp -#define CS %cs -#define SS %ss -#define DS %ds -#define ES %es -#define FS %fs -#define GS %gs -/* Control Registers */ -#define CR0 %cr0 -#define CR1 %cr1 -#define CR2 %cr2 -#define CR3 %cr3 -/* Debug Registers */ -#define DR0 %db0 -#define DR1 %db1 -#define DR2 %db2 -#define DR3 %db3 -#define DR4 %db4 -#define DR5 %db5 -#define DR6 %db6 -#define DR7 %db7 -/* Floating-point Stack */ -#define ST %st - -#define AS_BEGIN -#define USE16 -#define USE32 - -#ifdef GNU_ASSEMBLER - -#define ADDR_TOGGLE aword -#define OPSZ_TOGGLE word - -#define CHOICE(a,b,c) b - -#else -/* - * AT&T ASSEMBLER SYNTAX - * ********************* - */ -#define CHOICE(a,b,c) a - -#define ADDR_TOGGLE addr16 -#define OPSZ_TOGGLE data16 - -#endif /* GNU_ASSEMBLER */ -#endif /* ACK_ASSEMBLER */ - - -#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) -#define GLNAME(a) a -#else -#define GLNAME(a) CONCAT(_,a) -#endif - - - /****************************************/ - /* */ - /* Select the various choices */ - /* */ - /****************************************/ - - -/* Redefine assembler directives */ -/*********************************/ -#define GLOBL CHOICE(.globl, .globl, .extern) -#define ALIGNTEXT4 CHOICE(.align 4, .align ARG2(2,0x90), .align 4) -#define ALIGNTEXT2 CHOICE(.align 2, .align ARG2(1,0x90), .align 2) -/* ALIGNTEXT4ifNOP is the same as ALIGNTEXT4, but only if the space is - * guaranteed to be filled with NOPs. Otherwise it does nothing. - */ -#define ALIGNTEXT4ifNOP CHOICE(.align 4, .align ARG2(2,0x90), /*can't do it*/) -#define ALIGNDATA4 CHOICE(.align 4, .align ARG2(2,0x0), .align 4) -#define ALIGNDATA2 CHOICE(.align 2, .align ARG2(1,0x0), .align 2) -#define FILE(s) CHOICE(.file s, .file s, .file s) -#define STRING(s) CHOICE(.string s, .asciz s, .asciz s) -#define D_LONG CHOICE(.long, .long, .data4) -#define D_WORD CHOICE(.value, .short, .data2) -#define D_BYTE CHOICE(.byte, .byte, .data1) -#define SPACE CHOICE(.comm, .space, .space) -#define COMM CHOICE(.comm, .comm, .comm) -#define SEG_DATA CHOICE(.data, .data, .sect .data) -#define SEG_TEXT CHOICE(.text, .text, .sect .text) -#define SEG_BSS CHOICE(.bss, .bss, .sect .bss) - -#ifdef GNU_ASSEMBLER -#define D_SPACE(n) . = . + n -#else -#define D_SPACE(n) .space n -#endif - -/* Addressing Modes */ -/* Immediate Mode */ -#define ADDR(a) CHOICE(CONCAT($,a), CONCAT($,a), a) -#define CONST(a) CHOICE(CONCAT($,a), CONCAT($,a), a) - -/* Indirect Mode */ -#define CONTENT(a) CHOICE(a, a, (a)) /* take contents of variable */ -#define REGIND(a) CHOICE((a), (a), (a)) /* Register a indirect */ -/* Register b indirect plus displacement a */ -#define REGOFF(a, b) CHOICE(a(b), a(b), a(b)) -/* Reg indirect Base + Index + Displacement - this is mainly for 16-bit mode - * which has no scaling - */ -#define REGBID(b,i,d) CHOICE(d(b,i), d(b,i), d(b)(i)) -/* Reg indirect Base + (Index * Scale) + Displacement */ -#define REGBISD(b,i,s,d) CHOICE(d(b,i,s), d(b,i,s), d(b)(i*s)) -/* Displaced Scaled Index: */ -#define REGDIS(d,i,s) CHOICE(d(,i,s), d(,i,s), d(i * s)) -/* Indexed Base: */ -#define REGBI(b,i) CHOICE((b,i), (b,i), (b)(i)) -/* Displaced Base: */ -#define REGDB(d,b) CHOICE(d(b), d(b), d(b)) -/* Variable indirect: */ -#define VARINDIRECT(var) CHOICE(*var, *var, (var)) -/* Use register contents as jump/call target: */ -#define CODEPTR(reg) CHOICE(*reg, *reg, reg) - -/* For expressions requiring bracketing - * eg. (CRT0_PM | CRT_EM) - */ - -#define EXPR(a) CHOICE([a], (a), [a]) -#define ENOT(a) CHOICE(0!a, ~a, ~a) -#define EMUL(a,b) CHOICE(a\*b, a*b, a*b) -#define EDIV(a,b) CHOICE(a\/b, a/b, a/b) - -/* - * We have to beat the problem of commas within arguments to choice. - * eg. choice (add a,b, add b,a) will get argument mismatch. Luckily ANSI - * and other known cpp definitions evaluate arguments before substitution - * so the following works. - */ -#define ARG2(a, b) a,b -#define ARG3(a,b,c) a,b,c - -/* Redefine assembler commands */ -#define AAA CHOICE(aaa, aaa, aaa) -#define AAD CHOICE(aad, aad, aad) -#define AAM CHOICE(aam, aam, aam) -#define AAS CHOICE(aas, aas, aas) -#define ADC_L(a, b) CHOICE(adcl ARG2(a,b), adcl ARG2(a,b), _LTOG adc ARG2(b,a)) -#define ADC_W(a, b) CHOICE(adcw ARG2(a,b), adcw ARG2(a,b), _WTOG adc ARG2(b,a)) -#define ADC_B(a, b) CHOICE(adcb ARG2(a,b), adcb ARG2(a,b), adcb ARG2(b,a)) -#define ADD_L(a, b) CHOICE(addl ARG2(a,b), addl ARG2(a,b), _LTOG add ARG2(b,a)) -#define ADD_W(a, b) CHOICE(addw ARG2(a,b), addw ARG2(a,b), _WTOG add ARG2(b,a)) -#define ADD_B(a, b) CHOICE(addb ARG2(a,b), addb ARG2(a,b), addb ARG2(b,a)) -#define AND_L(a, b) CHOICE(andl ARG2(a,b), andl ARG2(a,b), _LTOG and ARG2(b,a)) -#define AND_W(a, b) CHOICE(andw ARG2(a,b), andw ARG2(a,b), _WTOG and ARG2(b,a)) -#define AND_B(a, b) CHOICE(andb ARG2(a,b), andb ARG2(a,b), andb ARG2(b,a)) -#define ARPL(a,b) CHOICE(arpl ARG2(a,b), arpl ARG2(a,b), arpl ARG2(b,a)) -#define BOUND_L(a, b) CHOICE(boundl ARG2(a,b), boundl ARG2(b,a), _LTOG bound ARG2(b,a)) -#define BOUND_W(a, b) CHOICE(boundw ARG2(a,b), boundw ARG2(b,a), _WTOG bound ARG2(b,a)) -#define BSF_L(a, b) CHOICE(bsfl ARG2(a,b), bsfl ARG2(a,b), _LTOG bsf ARG2(b,a)) -#define BSF_W(a, b) CHOICE(bsfw ARG2(a,b), bsfw ARG2(a,b), _WTOG bsf ARG2(b,a)) -#define BSR_L(a, b) CHOICE(bsrl ARG2(a,b), bsrl ARG2(a,b), _LTOG bsr ARG2(b,a)) -#define BSR_W(a, b) CHOICE(bsrw ARG2(a,b), bsrw ARG2(a,b), _WTOG bsr ARG2(b,a)) -#define BT_L(a, b) CHOICE(btl ARG2(a,b), btl ARG2(a,b), _LTOG bt ARG2(b,a)) -#define BT_W(a, b) CHOICE(btw ARG2(a,b), btw ARG2(a,b), _WTOG bt ARG2(b,a)) -#define BTC_L(a, b) CHOICE(btcl ARG2(a,b), btcl ARG2(a,b), _LTOG btc ARG2(b,a)) -#define BTC_W(a, b) CHOICE(btcw ARG2(a,b), btcw ARG2(a,b), _WTOG btc ARG2(b,a)) -#define BTR_L(a, b) CHOICE(btrl ARG2(a,b), btrl ARG2(a,b), _LTOG btr ARG2(b,a)) -#define BTR_W(a, b) CHOICE(btrw ARG2(a,b), btrw ARG2(a,b), _WTOG btr ARG2(b,a)) -#define BTS_L(a, b) CHOICE(btsl ARG2(a,b), btsl ARG2(a,b), _LTOG bts ARG2(b,a)) -#define BTS_W(a, b) CHOICE(btsw ARG2(a,b), btsw ARG2(a,b), _WTOG bts ARG2(b,a)) -#define CALL(a) CHOICE(call a, call a, call a) -#define CALLF(s,a) CHOICE(lcall ARG2(s,a), lcall ARG2(s,a), callf s:a) -#define CBW CHOICE(cbtw, cbw, cbw) -#define CWDE CHOICE(cwtd, cwde, cwde) -#define CLC CHOICE(clc, clc, clc) -#define CLD CHOICE(cld, cld, cld) -#define CLI CHOICE(cli, cli, cli) -#define CLTS CHOICE(clts, clts, clts) -#define CMC CHOICE(cmc, cmc, cmc) -#define CMP_L(a, b) CHOICE(cmpl ARG2(a,b), cmpl ARG2(a,b), _LTOG cmp ARG2(b,a)) -#define CMP_W(a, b) CHOICE(cmpw ARG2(a,b), cmpw ARG2(a,b), _WTOG cmp ARG2(b,a)) -#define CMP_B(a, b) CHOICE(cmpb ARG2(a,b), cmpb ARG2(a,b), cmpb ARG2(b,a)) -#define CMPS_L CHOICE(cmpsl, cmpsl, _LTOG cmps) -#define CMPS_W CHOICE(cmpsw, cmpsw, _WTOG cmps) -#define CMPS_B CHOICE(cmpsb, cmpsb, cmpsb) -#define CWD CHOICE(cwtl, cwd, cwd) -#define CDQ CHOICE(cltd, cdq, cdq) -#define DAA CHOICE(daa, daa, daa) -#define DAS CHOICE(das, das, das) -#define DEC_L(a) CHOICE(decl a, decl a, _LTOG dec a) -#define DEC_W(a) CHOICE(decw a, decw a, _WTOG dec a) -#define DEC_B(a) CHOICE(decb a, decb a, decb a) -#define DIV_L(a) CHOICE(divl a, divl a, div a) -#define DIV_W(a) CHOICE(divw a, divw a, div a) -#define DIV_B(a) CHOICE(divb a, divb a, divb a) -#define ENTER(a,b) CHOICE(enter ARG2(a,b), enter ARG2(a,b), enter ARG2(b,a)) -#define HLT CHOICE(hlt, hlt, hlt) -#define IDIV_L(a) CHOICE(idivl a, idivl a, _LTOG idiv a) -#define IDIV_W(a) CHOICE(idivw a, idivw a, _WTOG idiv a) -#define IDIV_B(a) CHOICE(idivb a, idivb a, idivb a) -/* More forms than this for imul!! */ -#define IMUL_L(a, b) CHOICE(imull ARG2(a,b), imull ARG2(a,b), _LTOG imul ARG2(b,a)) -#define IMUL_W(a, b) CHOICE(imulw ARG2(a,b), imulw ARG2(a,b), _WTOG imul ARG2(b,a)) -#define IMUL_B(a) CHOICE(imulb a, imulb a, imulb a) -#define IN_L CHOICE(inl (DX), inl ARG2(DX,EAX), _LTOG in DX) -#define IN_W CHOICE(inw (DX), inw ARG2(DX,AX), _WTOG in DX) -#define IN_B CHOICE(inb (DX), inb ARG2(DX,AL), inb DX) -/* Please AS code writer: use the following ONLY, if you refer to ports<256 - * directly, but not in IN1_W(DX), for instance, even if IN1_ looks nicer - */ -#if defined (sun) -#define IN1_L(a) CHOICE(inl (a), inl ARG2(a,EAX), _LTOG in a) -#define IN1_W(a) CHOICE(inw (a), inw ARG2(a,AX), _WTOG in a) -#define IN1_B(a) CHOICE(inb (a), inb ARG2(a,AL), inb a) -#else -#define IN1_L(a) CHOICE(inl a, inl ARG2(a,EAX), _LTOG in a) -#define IN1_W(a) CHOICE(inw a, inw ARG2(a,AX), _WTOG in a) -#define IN1_B(a) CHOICE(inb a, inb ARG2(a,AL), inb a) -#endif -#define INC_L(a) CHOICE(incl a, incl a, _LTOG inc a) -#define INC_W(a) CHOICE(incw a, incw a, _WTOG inc a) -#define INC_B(a) CHOICE(incb a, incb a, incb a) -#define INS_L CHOICE(insl, insl, _LTOG ins) -#define INS_W CHOICE(insw, insw, _WTOG ins) -#define INS_B CHOICE(insb, insb, insb) -#define INT(a) CHOICE(int a, int a, int a) -#define INT3 CHOICE(int CONST(3), int3, int CONST(3)) -#define INTO CHOICE(into, into, into) -#define IRET CHOICE(iret, iret, iret) -#define IRETD CHOICE(iret, iret, iretd) -#define JA(a) CHOICE(ja a, ja a, ja a) -#define JAE(a) CHOICE(jae a, jae a, jae a) -#define JB(a) CHOICE(jb a, jb a, jb a) -#define JBE(a) CHOICE(jbe a, jbe a, jbe a) -#define JC(a) CHOICE(jc a, jc a, jc a) -#define JE(a) CHOICE(je a, je a, je a) -#define JG(a) CHOICE(jg a, jg a, jg a) -#define JGE(a) CHOICE(jge a, jge a, jge a) -#define JL(a) CHOICE(jl a, jl a, jl a) -#define JLE(a) CHOICE(jle a, jle a, jle a) -#define JNA(a) CHOICE(jna a, jna a, jna a) -#define JNAE(a) CHOICE(jnae a, jnae a, jnae a) -#define JNB(a) CHOICE(jnb a, jnb a, jnb a) -#define JNBE(a) CHOICE(jnbe a, jnbe a, jnbe a) -#define JNC(a) CHOICE(jnc a, jnc a, jnc a) -#define JNE(a) CHOICE(jne a, jne a, jne a) -#define JNG(a) CHOICE(jng a, jng a, jng a) -#define JNGE(a) CHOICE(jnge a, jnge a, jnge a) -#define JNL(a) CHOICE(jnl a, jnl a, jnl a) -#define JNLE(a) CHOICE(jnle a, jnle a, jnle a) -#define JNO(a) CHOICE(jno a, jno a, jno a) -#define JNP(a) CHOICE(jnp a, jnp a, jnp a) -#define JNS(a) CHOICE(jns a, jns a, jns a) -#define JNZ(a) CHOICE(jnz a, jnz a, jnz a) -#define JO(a) CHOICE(jo a, jo a, jo a) -#define JP(a) CHOICE(jp a, jp a, jp a) -#define JPE(a) CHOICE(jpe a, jpe a, jpe a) -#define JPO(a) CHOICE(jpo a, jpo a, jpo a) -#define JS(a) CHOICE(js a, js a, js a) -#define JZ(a) CHOICE(jz a, jz a, jz a) -#define JMP(a) CHOICE(jmp a, jmp a, jmp a) -#define JMPF(s,a) CHOICE(ljmp ARG2(s,a), ljmp ARG2(s,a), jmpf s:a) -#define LAHF CHOICE(lahf, lahf, lahf) -#if !defined(_REAL_MODE) && !defined(_V86_MODE) -#define LAR(a, b) CHOICE(lar ARG2(a, b), lar ARG2(a, b), lar ARG2(b, a)) -#endif -#define LEA_L(a, b) CHOICE(leal ARG2(a,b), leal ARG2(a,b), _LTOG lea ARG2(b,a)) -#define LEA_W(a, b) CHOICE(leaw ARG2(a,b), leaw ARG2(a,b), _WTOG lea ARG2(b,a)) -#define LEAVE CHOICE(leave, leave, leave) -#define LGDT(a) CHOICE(lgdt a, lgdt a, lgdt a) -#define LIDT(a) CHOICE(lidt a, lidt a, lidt a) -#define LDS(a, b) CHOICE(ldsl ARG2(a,b), lds ARG2(a,b), lds ARG2(b,a)) -#define LES(a, b) CHOICE(lesl ARG2(a,b), les ARG2(a,b), les ARG2(b,a)) -#define LFS(a, b) CHOICE(lfsl ARG2(a,b), lfs ARG2(a,b), lfs ARG2(b,a)) -#define LGS(a, b) CHOICE(lgsl ARG2(a,b), lgs ARG2(a,b), lgs ARG2(b,a)) -#define LSS(a, b) CHOICE(lssl ARG2(a,b), lss ARG2(a,b), lss ARG2(b,a)) -#define LLDT(a) CHOICE(lldt a, lldt a, lldt a) -#define LMSW(a) CHOICE(lmsw a, lmsw a, lmsw a) -#define LOCK CHOICE(lock, lock, lock) -#define LODS_L CHOICE(lodsl, lodsl, _LTOG lods) -#define LODS_W CHOICE(lodsw, lodsw, _WTOG lods) -#define LODS_B CHOICE(lodsb, lodsb, lodsb) -#define LOOP(a) CHOICE(loop a, loop a, loop a) -#define LOOPE(a) CHOICE(loope a, loope a, loope a) -#define LOOPZ(a) CHOICE(loopz a, loopz a, loopz a) -#define LOOPNE(a) CHOICE(loopne a, loopne a, loopne a) -#define LOOPNZ(a) CHOICE(loopnz a, loopnz a, loopnz a) -#if !defined(_REAL_MODE) && !defined(_V86_MODE) -#define LSL(a, b) CHOICE(lsl ARG2(a,b), lsl ARG2(a,b), lsl ARG2(b,a)) -#endif -#define LTR(a) CHOICE(ltr a, ltr a, ltr a) -#define MOV_SR(a, b) CHOICE(movw ARG2(a,b), mov ARG2(a,b), mov ARG2(b,a)) -#define MOV_L(a, b) CHOICE(movl ARG2(a,b), movl ARG2(a,b), _LTOG mov ARG2(b,a)) -#define MOV_W(a, b) CHOICE(movw ARG2(a,b), movw ARG2(a,b), _WTOG mov ARG2(b,a)) -#define MOV_B(a, b) CHOICE(movb ARG2(a,b), movb ARG2(a,b), movb ARG2(b,a)) -#define MOVS_L CHOICE(movsl, movsl, _LTOG movs) -#define MOVS_W CHOICE(movsw, movsw, _WTOG movs) -#define MOVS_B CHOICE(movsb, movsb, movsb) -#define MOVSX_BL(a, b) CHOICE(movsbl ARG2(a,b), movsbl ARG2(a,b), movsx ARG2(b,a)) -#define MOVSX_BW(a, b) CHOICE(movsbw ARG2(a,b), movsbw ARG2(a,b), movsx ARG2(b,a)) -#define MOVSX_WL(a, b) CHOICE(movswl ARG2(a,b), movswl ARG2(a,b), movsx ARG2(b,a)) -#define MOVZX_BL(a, b) CHOICE(movzbl ARG2(a,b), movzbl ARG2(a,b), movzx ARG2(b,a)) -#define MOVZX_BW(a, b) CHOICE(movzbw ARG2(a,b), movzbw ARG2(a,b), movzx ARG2(b,a)) -#define MOVZX_WL(a, b) CHOICE(movzwl ARG2(a,b), movzwl ARG2(a,b), movzx ARG2(b,a)) -#define MUL_L(a) CHOICE(mull a, mull a, _LTOG mul a) -#define MUL_W(a) CHOICE(mulw a, mulw a, _WTOG mul a) -#define MUL_B(a) CHOICE(mulb a, mulb a, mulb a) -#define NEG_L(a) CHOICE(negl a, negl a, _LTOG neg a) -#define NEG_W(a) CHOICE(negw a, negw a, _WTOG neg a) -#define NEG_B(a) CHOICE(negb a, negb a, negb a) -#define NOP CHOICE(nop, nop, nop) -#define NOT_L(a) CHOICE(notl a, notl a, _LTOG not a) -#define NOT_W(a) CHOICE(notw a, notw a, _WTOG not a) -#define NOT_B(a) CHOICE(notb a, notb a, notb a) -#define OR_L(a,b) CHOICE(orl ARG2(a,b), orl ARG2(a,b), _LTOG or ARG2(b,a)) -#define OR_W(a,b) CHOICE(orw ARG2(a,b), orw ARG2(a,b), _WTOG or ARG2(b,a)) -#define OR_B(a,b) CHOICE(orb ARG2(a,b), orb ARG2(a,b), orb ARG2(b,a)) -#define OUT_L CHOICE(outl (DX), outl ARG2(EAX,DX), _LTOG out DX) -#define OUT_W CHOICE(outw (DX), outw ARG2(AX,DX), _WTOG out DX) -#define OUT_B CHOICE(outb (DX), outb ARG2(AL,DX), outb DX) -/* Please AS code writer: use the following ONLY, if you refer to ports<256 - * directly, but not in OUT1_W(DX), for instance, even if OUT1_ looks nicer - */ -#define OUT1_L(a) CHOICE(outl (a), outl ARG2(EAX,a), _LTOG out a) -#define OUT1_W(a) CHOICE(outw (a), outw ARG2(AX,a), _WTOG out a) -#define OUT1_B(a) CHOICE(outb (a), outb ARG2(AL,a), outb a) -#define OUTS_L CHOICE(outsl, outsl, _LTOG outs) -#define OUTS_W CHOICE(outsw, outsw, _WTOG outs) -#define OUTS_B CHOICE(outsb, outsb, outsb) -#define POP_SR(a) CHOICE(pop a, pop a, pop a) -#define POP_L(a) CHOICE(popl a, popl a, _LTOG pop a) -#define POP_W(a) CHOICE(popw a, popw a, _WTOG pop a) -#define POPA_L CHOICE(popal, popal, _LTOG popa) -#define POPA_W CHOICE(popaw, popaw, _WTOG popa) -#define POPF_L CHOICE(popfl, popfl, _LTOG popf) -#define POPF_W CHOICE(popfw, popfw, _WTOG popf) -#define PUSH_SR(a) CHOICE(push a, push a, push a) -#define PUSH_L(a) CHOICE(pushl a, pushl a, _LTOG push a) -#define PUSH_W(a) CHOICE(pushw a, pushw a, _WTOG push a) -#define PUSH_B(a) CHOICE(push a, pushb a, push a) -#define PUSHA_L CHOICE(pushal, pushal, _LTOG pusha) -#define PUSHA_W CHOICE(pushaw, pushaw, _WTOG pusha) -#define PUSHF_L CHOICE(pushfl, pushfl, _LTOG pushf) -#define PUSHF_W CHOICE(pushfw, pushfw, _WTOG pushf) -#define RCL_L(a, b) CHOICE(rcll ARG2(a,b), rcll ARG2(a,b), _LTOG rcl ARG2(b,a)) -#define RCL_W(a, b) CHOICE(rclw ARG2(a,b), rclw ARG2(a,b), _WTOG rcl ARG2(b,a)) -#define RCL_B(a, b) CHOICE(rclb ARG2(a,b), rclb ARG2(a,b), rclb ARG2(b,a)) -#define RCR_L(a, b) CHOICE(rcrl ARG2(a,b), rcrl ARG2(a,b), _LTOG rcr ARG2(b,a)) -#define RCR_W(a, b) CHOICE(rcrw ARG2(a,b), rcrw ARG2(a,b), _WTOG rcr ARG2(b,a)) -#define RCR_B(a, b) CHOICE(rcrb ARG2(a,b), rcrb ARG2(a,b), rcrb ARG2(b,a)) -#define ROL_L(a, b) CHOICE(roll ARG2(a,b), roll ARG2(a,b), _LTOG rol ARG2(b,a)) -#define ROL_W(a, b) CHOICE(rolw ARG2(a,b), rolw ARG2(a,b), _WTOG rol ARG2(b,a)) -#define ROL_B(a, b) CHOICE(rolb ARG2(a,b), rolb ARG2(a,b), rolb ARG2(b,a)) -#define ROR_L(a, b) CHOICE(rorl ARG2(a,b), rorl ARG2(a,b), _LTOG ror ARG2(b,a)) -#define ROR_W(a, b) CHOICE(rorw ARG2(a,b), rorw ARG2(a,b), _WTOG ror ARG2(b,a)) -#define ROR_B(a, b) CHOICE(rorb ARG2(a,b), rorb ARG2(a,b), rorb ARG2(b,a)) -#define REP CHOICE(rep ;, rep ;, repe) -#define REPE CHOICE(repz ;, repe ;, repe) -#define REPNE CHOICE(repnz ;, repne ;, repne) -#define REPNZ REPNE -#define REPZ REPE -#define RET CHOICE(ret, ret, ret) -#define SAHF CHOICE(sahf, sahf, sahf) -#define SAL_L(a, b) CHOICE(sall ARG2(a,b), sall ARG2(a,b), _LTOG sal ARG2(b,a)) -#define SAL_W(a, b) CHOICE(salw ARG2(a,b), salw ARG2(a,b), _WTOG sal ARG2(b,a)) -#define SAL_B(a, b) CHOICE(salb ARG2(a,b), salb ARG2(a,b), salb ARG2(b,a)) -#define SAR_L(a, b) CHOICE(sarl ARG2(a,b), sarl ARG2(a,b), _LTOG sar ARG2(b,a)) -#define SAR_W(a, b) CHOICE(sarw ARG2(a,b), sarw ARG2(a,b), _WTOG sar ARG2(b,a)) -#define SAR_B(a, b) CHOICE(sarb ARG2(a,b), sarb ARG2(a,b), sarb ARG2(b,a)) -#define SBB_L(a, b) CHOICE(sbbl ARG2(a,b), sbbl ARG2(a,b), _LTOG sbb ARG2(b,a)) -#define SBB_W(a, b) CHOICE(sbbw ARG2(a,b), sbbw ARG2(a,b), _WTOG sbb ARG2(b,a)) -#define SBB_B(a, b) CHOICE(sbbb ARG2(a,b), sbbb ARG2(a,b), sbbb ARG2(b,a)) -#define SCAS_L CHOICE(scasl, scasl, _LTOG scas) -#define SCAS_W CHOICE(scasw, scasw, _WTOG scas) -#define SCAS_B CHOICE(scasb, scasb, scasb) -#define SETA(a) CHOICE(seta a, seta a, seta a) -#define SETAE(a) CHOICE(setae a, setae a, setae a) -#define SETB(a) CHOICE(setb a, setb a, setb a) -#define SETBE(a) CHOICE(setbe a, setbe a, setbe a) -#define SETC(a) CHOICE(setc a, setb a, setb a) -#define SETE(a) CHOICE(sete a, sete a, sete a) -#define SETG(a) CHOICE(setg a, setg a, setg a) -#define SETGE(a) CHOICE(setge a, setge a, setge a) -#define SETL(a) CHOICE(setl a, setl a, setl a) -#define SETLE(a) CHOICE(setle a, setle a, setle a) -#define SETNA(a) CHOICE(setna a, setna a, setna a) -#define SETNAE(a) CHOICE(setnae a, setnae a, setnae a) -#define SETNB(a) CHOICE(setnb a, setnb a, setnb a) -#define SETNBE(a) CHOICE(setnbe a, setnbe a, setnbe a) -#define SETNC(a) CHOICE(setnc a, setnb a, setnb a) -#define SETNE(a) CHOICE(setne a, setne a, setne a) -#define SETNG(a) CHOICE(setng a, setng a, setng a) -#define SETNGE(a) CHOICE(setnge a, setnge a, setnge a) -#define SETNL(a) CHOICE(setnl a, setnl a, setnl a) -#define SETNLE(a) CHOICE(setnle a, setnle a, setnle a) -#define SETNO(a) CHOICE(setno a, setno a, setno a) -#define SETNP(a) CHOICE(setnp a, setnp a, setnp a) -#define SETNS(a) CHOICE(setns a, setns a, setna a) -#define SETNZ(a) CHOICE(setnz a, setnz a, setnz a) -#define SETO(a) CHOICE(seto a, seto a, seto a) -#define SETP(a) CHOICE(setp a, setp a, setp a) -#define SETPE(a) CHOICE(setpe a, setpe a, setpe a) -#define SETPO(a) CHOICE(setpo a, setpo a, setpo a) -#define SETS(a) CHOICE(sets a, sets a, seta a) -#define SETZ(a) CHOICE(setz a, setz a, setz a) -#define SGDT(a) CHOICE(sgdt a, sgdt a, sgdt a) -#define SIDT(a) CHOICE(sidt a, sidt a, sidt a) -#define SHL_L(a, b) CHOICE(shll ARG2(a,b), shll ARG2(a,b), _LTOG shl ARG2(b,a)) -#define SHL_W(a, b) CHOICE(shlw ARG2(a,b), shlw ARG2(a,b), _WTOG shl ARG2(b,a)) -#define SHL_B(a, b) CHOICE(shlb ARG2(a,b), shlb ARG2(a,b), shlb ARG2(b,a)) -#define SHLD_L(a,b,c) CHOICE(shldl ARG3(a,b,c), shldl ARG3(a,b,c), _LTOG shld ARG3(c,b,a)) -#define SHLD2_L(a,b) CHOICE(shldl ARG2(a,b), shldl ARG3(CL,a,b), _LTOG shld ARG3(b,a,CL)) -#define SHLD_W(a,b,c) CHOICE(shldw ARG3(a,b,c), shldw ARG3(a,b,c), _WTOG shld ARG3(c,b,a)) -#define SHLD2_W(a,b) CHOICE(shldw ARG2(a,b), shldw ARG3(CL,a,b), _WTOG shld ARG3(b,a,CL)) -#define SHR_L(a, b) CHOICE(shrl ARG2(a,b), shrl ARG2(a,b), _LTOG shr ARG2(b,a)) -#define SHR_W(a, b) CHOICE(shrw ARG2(a,b), shrw ARG2(a,b), _WTOG shr ARG2(b,a)) -#define SHR_B(a, b) CHOICE(shrb ARG2(a,b), shrb ARG2(a,b), shrb ARG2(b,a)) -#define SHRD_L(a,b,c) CHOICE(shrdl ARG3(a,b,c), shrdl ARG3(a,b,c), _LTOG shrd ARG3(c,b,a)) -#define SHRD2_L(a,b) CHOICE(shrdl ARG2(a,b), shrdl ARG3(CL,a,b), _LTOG shrd ARG3(b,a,CL)) -#define SHRD_W(a,b,c) CHOICE(shrdw ARG3(a,b,c), shrdw ARG3(a,b,c), _WTOG shrd ARG3(c,b,a)) -#define SHRD2_W(a,b) CHOICE(shrdw ARG2(a,b), shrdw ARG3(CL,a,b), _WTOG shrd ARG3(b,a,CL)) -#define SLDT(a) CHOICE(sldt a, sldt a, sldt a) -#define SMSW(a) CHOICE(smsw a, smsw a, smsw a) -#define STC CHOICE(stc, stc, stc) -#define STD CHOICE(std, std, std) -#define STI CHOICE(sti, sti, sti) -#define STOS_L CHOICE(stosl, stosl, _LTOG stos) -#define STOS_W CHOICE(stosw, stosw, _WTOG stos) -#define STOS_B CHOICE(stosb, stosb, stosb) -#define STR(a) CHOICE(str a, str a, str a) -#define SUB_L(a, b) CHOICE(subl ARG2(a,b), subl ARG2(a,b), _LTOG sub ARG2(b,a)) -#define SUB_W(a, b) CHOICE(subw ARG2(a,b), subw ARG2(a,b), _WTOG sub ARG2(b,a)) -#define SUB_B(a, b) CHOICE(subb ARG2(a,b), subb ARG2(a,b), subb ARG2(b,a)) -#define TEST_L(a, b) CHOICE(testl ARG2(a,b), testl ARG2(a,b), _LTOG test ARG2(b,a)) -#define TEST_W(a, b) CHOICE(testw ARG2(a,b), testw ARG2(a,b), _WTOG test ARG2(b,a)) -#define TEST_B(a, b) CHOICE(testb ARG2(a,b), testb ARG2(a,b), testb ARG2(b,a)) -#define VERR(a) CHOICE(verr a, verr a, verr a) -#define VERW(a) CHOICE(verw a, verw a, verw a) -#define WAIT CHOICE(wait, wait, wait) -#define XCHG_L(a, b) CHOICE(xchgl ARG2(a,b), xchgl ARG2(a,b), _LTOG xchg ARG2(b,a)) -#define XCHG_W(a, b) CHOICE(xchgw ARG2(a,b), xchgw ARG2(a,b), _WTOG xchg ARG2(b,a)) -#define XCHG_B(a, b) CHOICE(xchgb ARG2(a,b), xchgb ARG2(a,b), xchgb ARG2(b,a)) -#define XLAT CHOICE(xlat, xlat, xlat) -#define XOR_L(a, b) CHOICE(xorl ARG2(a,b), xorl ARG2(a,b), _LTOG xor ARG2(b,a)) -#define XOR_W(a, b) CHOICE(xorw ARG2(a,b), xorw ARG2(a,b), _WTOG xor ARG2(b,a)) -#define XOR_B(a, b) CHOICE(xorb ARG2(a,b), xorb ARG2(a,b), xorb ARG2(b,a)) - - -/* Floating Point Instructions */ -#define F2XM1 CHOICE(f2xm1, f2xm1, f2xm1) -#define FABS CHOICE(fabs, fabs, fabs) -#define FADD_D(a) CHOICE(faddl a, faddl a, faddd a) -#define FADD_S(a) CHOICE(fadds a, fadds a, fadds a) -#define FADD2(a, b) CHOICE(fadd ARG2(a,b), fadd ARG2(a,b), fadd ARG2(b,a)) -#define FADDP(a, b) CHOICE(faddp ARG2(a,b), faddp ARG2(a,b), faddp ARG2(b,a)) -#define FIADD_L(a) CHOICE(fiaddl a, fiaddl a, fiaddl a) -#define FIADD_W(a) CHOICE(fiadd a, fiadds a, fiadds a) -#define FBLD(a) CHOICE(fbld a, fbld a, fbld a) -#define FBSTP(a) CHOICE(fbstp a, fbstp a, fbstp a) -#define FCHS CHOICE(fchs, fchs, fchs) -#define FCLEX CHOICE(fclex, wait; fnclex, wait; fclex) -#define FNCLEX CHOICE(fnclex, fnclex, fclex) -#define FCOM(a) CHOICE(fcom a, fcom a, fcom a) -#define FCOM_D(a) CHOICE(fcoml a, fcoml a, fcomd a) -#define FCOM_S(a) CHOICE(fcoms a, fcoms a, fcoms a) -#define FCOMP(a) CHOICE(fcomp a, fcomp a, fcomp a) -#define FCOMP_D(a) CHOICE(fcompl a, fcompl a, fcompd a) -#define FCOMP_S(a) CHOICE(fcomps a, fcomps a, fcomps a) -#define FCOMPP CHOICE(fcompp, fcompp, fcompp) -#define FCOS CHOICE(fcos, fcos, fcos) -#define FDECSTP CHOICE(fdecstp, fdecstp, fdecstp) -#define FDIV_D(a) CHOICE(fdivl a, fdivl a, fdivd a) -#define FDIV_S(a) CHOICE(fdivs a, fdivs a, fdivs a) -#define FDIV2(a, b) CHOICE(fdiv ARG2(a,b), fdiv ARG2(a,b), fdiv ARG2(b,a)) -#define FDIVP(a, b) CHOICE(fdivp ARG2(a,b), fdivp ARG2(a,b), fdivp ARG2(b,a)) -#define FIDIV_L(a) CHOICE(fidivl a, fidivl a, fidivl a) -#define FIDIV_W(a) CHOICE(fidiv a, fidivs a, fidivs a) -#define FDIVR_D(a) CHOICE(fdivrl a, fdivrl a, fdivrd a) -#define FDIVR_S(a) CHOICE(fdivrs a, fdivrs a, fdivrs a) -#define FDIVR2(a, b) CHOICE(fdivr ARG2(a,b), fdivr ARG2(a,b), fdivr ARG2(b,a)) -#define FDIVRP(a, b) CHOICE(fdivrp ARG2(a,b), fdivrp ARG2(a,b), fdivrp ARG2(b,a)) -#define FIDIVR_L(a) CHOICE(fidivrl a, fidivrl a, fidivrl a) -#define FIDIVR_W(a) CHOICE(fidivr a, fidivrs a, fidivrs a) -#define FFREE(a) CHOICE(ffree a, ffree a, ffree a) -#define FICOM_L(a) CHOICE(ficoml a, ficoml a, ficoml a) -#define FICOM_W(a) CHOICE(ficom a, ficoms a, ficoms a) -#define FICOMP_L(a) CHOICE(ficompl a, ficompl a, ficompl a) -#define FICOMP_W(a) CHOICE(ficomp a, ficomps a, ficomps a) -#define FILD_Q(a) CHOICE(fildll a, fildq a, fildq a) -#define FILD_L(a) CHOICE(fildl a, fildl a, fildl a) -#define FILD_W(a) CHOICE(fild a, filds a, filds a) -#define FINCSTP CHOICE(fincstp, fincstp, fincstp) -#define FINIT CHOICE(finit, wait; fninit, wait; finit) -#define FNINIT CHOICE(fninit, fninit, finit) -#define FIST_L(a) CHOICE(fistl a, fistl a, fistl a) -#define FIST_W(a) CHOICE(fist a, fists a, fists a) -#define FISTP_Q(a) CHOICE(fistpll a, fistpq a, fistpq a) -#define FISTP_L(a) CHOICE(fistpl a, fistpl a, fistpl a) -#define FISTP_W(a) CHOICE(fistp a, fistps a, fistps a) -#define FLD_X(a) CHOICE(fldt a, fldt a, fldx a) /* 80 bit data type! */ -#define FLD_D(a) CHOICE(fldl a, fldl a, fldd a) -#define FLD_S(a) CHOICE(flds a, flds a, flds a) -#define FLD1 CHOICE(fld1, fld1, fld1) -#define FLDL2T CHOICE(fldl2t, fldl2t, fldl2t) -#define FLDL2E CHOICE(fldl2e, fldl2e, fldl2e) -#define FLDPI CHOICE(fldpi, fldpi, fldpi) -#define FLDLG2 CHOICE(fldlg2, fldlg2, fldlg2) -#define FLDLN2 CHOICE(fldln2, fldln2, fldln2) -#define FLDZ CHOICE(fldz, fldz, fldz) -#define FLDCW(a) CHOICE(fldcw a, fldcw a, fldcw a) -#define FLDENV(a) CHOICE(fldenv a, fldenv a, fldenv a) -#define FMUL_S(a) CHOICE(fmuls a, fmuls a, fmuls a) -#define FMUL_D(a) CHOICE(fmull a, fmull a, fmuld a) -#define FMUL2(a, b) CHOICE(fmul ARG2(a,b), fmul ARG2(a,b), fmul ARG2(b,a)) -#define FMULP(a, b) CHOICE(fmulp ARG2(a,b), fmulp ARG2(a,b), fmulp ARG2(b,a)) -#define FIMUL_L(a) CHOICE(fimull a, fimull a, fimull a) -#define FIMUL_W(a) CHOICE(fimul a, fimuls a, fimuls a) -#define FNOP CHOICE(fnop, fnop, fnop) -#define FPATAN CHOICE(fpatan, fpatan, fpatan) -#define FPREM CHOICE(fprem, fprem, fprem) -#define FPREM1 CHOICE(fprem1, fprem1, fprem1) -#define FPTAN CHOICE(fptan, fptan, fptan) -#define FRNDINT CHOICE(frndint, frndint, frndint) -#define FRSTOR(a) CHOICE(frstor a, frstor a, frstor a) -#define FSAVE(a) CHOICE(fsave a, wait; fnsave a, wait; fsave a) -#define FNSAVE(a) CHOICE(fnsave a, fnsave a, fsave a) -#define FSCALE CHOICE(fscale, fscale, fscale) -#define FSIN CHOICE(fsin, fsin, fsin) -#define FSINCOS CHOICE(fsincos, fsincos, fsincos) -#define FSQRT CHOICE(fsqrt, fsqrt, fsqrt) -#define FST_D(a) CHOICE(fstl a, fstl a, fstd a) -#define FST_S(a) CHOICE(fsts a, fsts a, fsts a) -#define FSTP_X(a) CHOICE(fstpt a, fstpt a, fstpx a) -#define FSTP_D(a) CHOICE(fstpl a, fstpl a, fstpd a) -#define FSTP_S(a) CHOICE(fstps a, fstps a, fstps a) -#define FSTCW(a) CHOICE(fstcw a, wait; fnstcw a, wait; fstcw a) -#define FNSTCW(a) CHOICE(fnstcw a, fnstcw a, fstcw a) -#define FSTENV(a) CHOICE(fstenv a, wait; fnstenv a, fstenv a) -#define FNSTENV(a) CHOICE(fnstenv a, fnstenv a, fstenv a) -#define FSTSW(a) CHOICE(fstsw a, wait; fnstsw a, wait; fstsw a) -#define FNSTSW(a) CHOICE(fnstsw a, fnstsw a, fstsw a) -#define FSUB_S(a) CHOICE(fsubs a, fsubs a, fsubs a) -#define FSUB_D(a) CHOICE(fsubl a, fsubl a, fsubd a) -#define FSUB2(a, b) CHOICE(fsub ARG2(a,b), fsub ARG2(a,b), fsub ARG2(b,a)) -#define FSUBP(a, b) CHOICE(fsubp ARG2(a,b), fsubp ARG2(a,b), fsubp ARG2(b,a)) -#define FISUB_L(a) CHOICE(fisubl a, fisubl a, fisubl a) -#define FISUB_W(a) CHOICE(fisub a, fisubs a, fisubs a) -#define FSUBR_S(a) CHOICE(fsubrs a, fsubrs a, fsubrs a) -#define FSUBR_D(a) CHOICE(fsubrl a, fsubrl a, fsubrd a) -#define FSUBR2(a, b) CHOICE(fsubr ARG2(a,b), fsubr ARG2(a,b), fsubr ARG2(b,a)) -#define FSUBRP(a, b) CHOICE(fsubrp ARG2(a,b), fsubrp ARG2(a,b), fsubrp ARG2(b,a)) -#define FISUBR_L(a) CHOICE(fisubrl a, fisubrl a, fisubrl a) -#define FISUBR_W(a) CHOICE(fisubr a, fisubrs a, fisubrs a) -#define FTST CHOICE(ftst, ftst, ftst) -#define FUCOM(a) CHOICE(fucom a, fucom a, fucom a) -#define FUCOMP(a) CHOICE(fucomp a, fucomp a, fucomp a) -#define FUCOMPP CHOICE(fucompp, fucompp, fucompp) -#define FWAIT CHOICE(wait, wait, wait) -#define FXAM CHOICE(fxam, fxam, fxam) -#define FXCH(a) CHOICE(fxch a, fxch a, fxch a) -#define FXTRACT CHOICE(fxtract, fxtract, fxtract) -#define FYL2X CHOICE(fyl2x, fyl2x, fyl2x) -#define FYL2XP1 CHOICE(fyl2xp1, fyl2xp1, fyl2xp1) - -#endif /* __ASSYNTAX_H__ */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile deleted file mode 100644 index 00309690e..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile +++ /dev/null @@ -1,242 +0,0 @@ -XCOMM $XConsortium: Imakefile /main/12 1996/10/27 11:06:35 kaleb $ - - - - - -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile,v 3.61 2003/10/07 22:30:00 herrb Exp $ - -#include - -#if defined(KFreeBSDArchitecture) || defined(NetBSDArchitecture) || defined(OpenBSDArchitecture) -#if BuildXInputExt -# if JoystickSupport - JOYSTICK_SRC = bsd_jstk.c -# endif -# if DoLoadableServer -SHARED_CFLAGS = PositionIndependentCFlags -# else -# if JoystickSupport - JOYSTICK_OBJ = bsd_jstk.o -# endif -# endif -#endif -#endif - -#if defined(NetBSDArchitecture) \ - && ((OSMajorVersion == 1 && OSMinorVersion >= 1) || OSMajorVersion >= 2) -# if defined(AlphaArchitecture) - IOPERMDEFINES = -DUSE_ALPHA_PIO -# elif defined(ArcArchitecture) - IOPERMDEFINES = -DUSE_ARC_MMAP -# elif defined(Arm32Architecture) - IOPERMDEFINES = -DUSE_ARM32_MMAP -# elif defined(PpcArchitecture) || \ - defined(Sparc64Architecture) - IOPERM_SRC = ioperm_noop.c - IOPERM_OBJ = ioperm_noop.o -# else - IOPERMDEFINES = -DUSE_I386_IOPL -# endif -#elif defined(OpenBSDArchitecture) -# if defined(i386Architecture) - IOPERMDEFINES = -DUSE_I386_IOPL -# elif defined(AMD64Architecture) - IOPERMDEFINES = -DUSE_AMD64_IOPL -# else - IOPERM_SRC = ioperm_noop.c - IOPERM_OBJ = ioperm_noop.o -# endif -#elif defined(KFreeBSDArchitecture) -# if defined(i386Architecture) || defined(AMD64Architecture) - IOPERMDEFINES = -DUSE_DEV_IO -# elif defined(AlphaBsdArchitecture) - IOPERMDEFINES = -DUSE_ALPHA_PORTS -# else - IOPERM_SRC = ioperm_noop.c - IOPERM_OBJ = ioperm_noop.o -# endif -#endif - -#if BuildXF86DRI -DRI_SRC = sigio.c -DRI_OBJ = sigio.o -#endif - -MOUSESRC = bsd_mouse.c -MOUSEOBJ = bsd_mouse.o - -KBDSRC = bsd_kbd.c bsd_KbdMap.c at_scancode.c -KBDOBJ = bsd_kbd.o bsd_KbdMap.o at_scancode.o - -#if HasMTRRSupport -MTRRDEFINES = -DHAS_MTRR_SUPPORT -#endif - -#if defined(NetBSDArchitecture) && defined(HasMTRRBuiltin) -MTRRDEFINES = -DHAS_MTRR_BUILTIN -#endif - -SYSVIPCDEFINES = -DHAVE_SYSV_IPC - -#if UsbMouseSupport -USBMOUSEDEFINES1 = -DUSBMOUSE_SUPPORT -#if !HasLibUsb -LIBUSBINCLUDES = -Ilibusb -#define IHaveSubdirs -SUBDIRS = libusb -#else -#if HasLibUsbHid -USBMOUSEDEFINES2 = -DHAS_LIB_USB_HID -#endif -#endif -#endif -USBMOUSEDEFINES = $(USBMOUSEDEFINES1) $(USBMOUSEDEFINES2) - -#if (defined(OpenBSDArchitecture) || defined(NetBSDArchitecture)) && defined(i386Architecture) -# if !defined(HasApmKqueue) || !HasApmKqueue -APMSRC = bsd_apm.c -APMOBJ = bsd_apm.o -# else -APMSRC = bsd_kqueue_apm.c -APMOBJ = bsd_kqueue_apm.o -# endif -#else -APMSRC = pm_noop.c -APMOBJ = pm_noop.o -#endif - -#if defined(KFreeBSDArchitecture) && (OSMajorVersion > 2) -KMODSRC = bsd_kmod.c -KMODOBJ = bsd_kmod.o -#else -KMODSRC = kmod_noop.c -KMODOBJ = kmod_noop.o -#endif - -#if defined(i386Architecture) || defined(ia64Architecture) -RES_SRC=stdResource.c -RES_OBJ=stdResource.o -#else -RES_SRC=bsdResource.c -RES_OBJ=bsdResource.o -#endif - -#if defined(AlphaArchitecture) -AXP_SRC=bsd_ev56.c xf86Axp.c bsd_axp.c -AXP_OBJ=bsd_ev56.o xf86Axp.o bsd_axp.o -#endif - -#if (defined(KFreeBSDArchitecture) || defined(NetBSDArchitecture) || \ - defined(OpenBSDArchitecture)) && HasAgpGart -AGP_SRC=lnx_agp.c -AGP_OBJ=lnx_agp.o -#else -AGP_SRC=agp_noop.c -AGP_OBJ=agp_noop.o -#endif - -#if defined(i386Architecture) || defined(AMD64Architecture) -VIDEO_SRC = i386_video.c -VIDEO_OBJ = i386_video.o -#elif defined(AlphaArchitecture) -VIDEO_SRC = alpha_video.c -VIDEO_OBJ = alpha_video.o -#elif defined(PpcArchitecture) -VIDEO_SRC = ppc_video.c -VIDEO_OBJ = ppc_video.o -#elif defined(Arm32Architecture) -VIDEO_SRC = arm_video.c -VIDEO_OBJ = arm_video.o -#elif defined(SparcArchitecture) || defined(Sparc64Architecture) -VIDEO_SRC = sparc64_video.c -VIDEO_OBJ = sparc64_video.o -#else -#error Unknown architecture ! -#endif - -SRCS = bsd_init.c $(VIDEO_SRC) bsd_io.c bsd_VTsw.c \ - libc_wrapper.c $(IOPERM_SRC) std_kbdEv.c posix_tty.c $(MOUSESRC) \ - $(RES_SRC) stdPci.c vidmem.c $(JOYSTICK_SRC) sigio.c $(APMSRC) \ - $(AXP_SRC) $(KMODSRC) $(AGP_SRC) $(KBDSRC) - -OBJS = bsd_init.o $(VIDEO_OBJ) bsd_io.o bsd_VTsw.o \ - libc_wrapper.o $(IOPERM_OBJ) std_kbdEv.o posix_tty.o $(MOUSEOBJ) \ - $(RES_OBJ) stdPci.o vidmem.o $(JOYSTICK_OBJ) sigio.o $(APMOBJ) \ - $(AXP_OBJ) $(KMODOBJ) $(AGP_OBJ) $(KBDOBJ) - -INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/mi $(APINCLUDES) \ - $(LIBUSBINCLUDES) -I$(XF86OSSRC)/shared -I$(DRMSRCDIR)/shared-core - -CONSDEFINES = XFree86ConsoleDefines -RESDEFINES = -DUSESTDRES - -#if defined(HasNetBSDApertureDriver) && HasNetBSDApertureDriver -APDEFINES = -DHAS_APERTURE_DRV -#endif - -DEFINES = $(CONSDEFINES) $(APDEFINES) $(IOPERMDEFINES) $(RESDEFINES) \ - $(MTRRDEFINES) $(USBMOUSEDEFINES) $(SYSVIPCDEFINES) - -#if defined(AlphaArchitecture) -SpecialObjectRule(bsd_ev56.o, bsd_ev56.c, -mcpu=ev56) -#endif - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() - -#if BuildXF86DRI -#define IHaveSubdirs -SUBDIRS = drm - -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) -#endif - -#if BuildXInputExt -# if DoLoadableServer -# if JoystickSupport -AllTarget(bsd_jstk.o) -#if 0 -InstallDynamicModule(bsd_jstk.o,$(MODULEDIR),input) -#endif -# endif -# endif -#endif - -#if !defined(NetBSDArchitecture) && !defined(OpenBSDArchitecture) || \ - !defined(i386Architecture) -LinkSourceFile(pm_noop.c,../shared) -#endif -LinkSourceFile(ioperm_noop.c,../shared) -LinkSourceFile(std_kbdEv.c,../shared) -LinkSourceFile(at_scancode.c,../shared) -LinkSourceFile(posix_tty.c,../shared) -LinkSourceFile(libc_wrapper.c,../shared) -LinkSourceFile(stdResource.c,../shared) -LinkSourceFile(stdPci.c,../shared) -LinkSourceFile(vidmem.c,../shared) -LinkSourceFile(sigio.c,../shared) -LinkSourceFile(kmod_noop.c,../shared) -#if (defined(KFreeBSDArchitecture) || defined(NetBSDArchitecture) || \ - defined(OpenBSDArchitecture)) && HasAgpGart -LinkSourceFile(lnx_agp.c,../linux) -#else -LinkSourceFile(agp_noop.c,../shared) -#endif -#if defined(AlphaArchitecture) -LinkSourceFile(xf86Axp.c,../shared) -#endif - -DependTarget() - -#if UsbMouseSupport && !HasLibUsb -MakeSubdirs($(SUBDIRS)) - -DependSubdirs($(SUBDIRS)) -#endif - -#if 0 -InstallDriverSDKDynamicModule(bsd_jstk.o,$(DRIVERSDKMODULEDIR)) -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/alpha_video.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/alpha_video.c deleted file mode 100644 index ca0f0f8e7..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/alpha_video.c +++ /dev/null @@ -1,735 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/alpha_video.c,v 1.6 2003/12/30 15:18:30 herrb Exp $ */ -/* - * Copyright 1992 by Rich Murphey - * Copyright 1993 by David Wexelblat - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Rich Murphey and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Rich Murphey and - * David Wexelblat make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/* $XConsortium: bsd_video.c /main/10 1996/10/25 11:37:57 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" - -#include -#ifndef __NetBSD__ -# include -# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -# include -# endif -# else -# include -#endif - -#include "xf86Axp.h" - -#include "xf86_OSlib.h" -#include "xf86OSpriv.h" - -#if defined(__NetBSD__) && !defined(MAP_FILE) -#define MAP_FLAGS MAP_SHARED -#else -#define MAP_FLAGS (MAP_FILE | MAP_SHARED) -#endif - -#ifndef MAP_FAILED -#define MAP_FAILED ((caddr_t)-1) -#endif - -axpDevice bsdGetAXP(void); - -#ifndef __NetBSD__ -extern unsigned long dense_base(void); - -static int axpSystem = -1; -static unsigned long hae_thresh; -static unsigned long hae_mask; -static unsigned long bus_base; -static unsigned long sparse_size; - -static unsigned long -memory_base(void) -{ - static unsigned long base = 0; - - if (base == 0) { - size_t len = sizeof(base); - int error; -#ifdef __OpenBSD__ - int mib[3]; - - mib[0] = CTL_MACHDEP; - mib[1] = CPU_CHIPSET; - mib[2] = CPU_CHIPSET_MEM; - - if ((error = sysctl(mib, 3, &base, &len, NULL, 0)) < 0) -#else - if ((error = sysctlbyname("hw.chipset.memory", &base, &len, - 0, 0)) < 0) -#endif - FatalError("xf86MapVidMem: can't find memory\n"); - } - - return base; -} - -static int -has_bwx(void) -{ - static int bwx = 0; - size_t len = sizeof(bwx); - int error; -#ifdef __OpenBSD__ - int mib[3]; - - mib[0] = CTL_MACHDEP; - mib[1] = CPU_CHIPSET; - mib[2] = CPU_CHIPSET_BWX; - - if ((error = sysctl(mib, 3, &bwx, &len, NULL, 0)) < 0) - return FALSE; - else - return bwx; -#else - if ((error = sysctlbyname("hw.chipset.bwx", &bwx, &len, 0, 0)) < 0) - return FALSE; - else - return bwx; -#endif -} -#else /* __NetBSD__ */ -static unsigned long hae_thresh = (1UL << 24); -static unsigned long hae_mask = 0xf8000000UL; /* XXX - should use xf86AXP.c */ -static struct alpha_bus_window *abw; -static int abw_count = -1; - -static void -init_abw(void) -{ - if (abw_count < 0) { - abw_count = alpha_bus_getwindows(ALPHA_BUS_TYPE_PCI_MEM, &abw); - if (abw_count <= 0) - FatalError("init_abw: alpha_bus_getwindows failed\n"); - } -} - -static int -has_bwx(void) -{ - if (abw_count < 0) - init_abw(); - - xf86Msg(X_INFO, "has_bwx = %d\n", - abw[0].abw_abst.abst_flags & ABST_BWX ? 1 : 0); /* XXXX */ - return abw[0].abw_abst.abst_flags & ABST_BWX; -} - -static unsigned long -dense_base(void) -{ - if (abw_count < 0) - init_abw(); - - /* XXX check abst_flags for ABST_DENSE just to be safe? */ - xf86Msg(X_INFO, "dense base = %#lx\n", - abw[0].abw_abst.abst_sys_start); /* XXXX */ - return abw[0].abw_abst.abst_sys_start; -} - -static unsigned long -memory_base(void) -{ - if (abw_count < 0) - init_abw(); - - if (abw_count > 0) { - xf86Msg(X_INFO, "memory base = %#lx\n", - abw[1].abw_abst.abst_sys_start); /* XXXX */ - return abw[1].abw_abst.abst_sys_start; - } else { - xf86Msg(X_INFO, "no memory base\n"); /* XXXX */ - return 0; - } -} -#endif /* __NetBSD__ */ - -#define BUS_BASE dense_base() -#define BUS_BASE_BWX memory_base() - -/***************************************************************************/ -/* Video Memory Mapping section */ -/***************************************************************************/ - -#ifdef __OpenBSD__ -#define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\ - "\tin /etc/sysctl.conf and reboot your machine\n" \ - "\trefer to xf86(4) for details" -#endif - -static Bool useDevMem = FALSE; -static int devMemFd = -1; - -#ifdef HAS_APERTURE_DRV -#define DEV_APERTURE "/dev/xf86" -#endif -#define DEV_MEM "/dev/mem" - -static pointer mapVidMem(int, unsigned long, unsigned long, int); -static void unmapVidMem(int, pointer, unsigned long); -static pointer mapVidMemSparse(int, unsigned long, unsigned long, int); -static void unmapVidMemSparse(int, pointer, unsigned long); - -/* - * Check if /dev/mem can be mmap'd. If it can't print a warning when - * "warn" is TRUE. - */ -static void -checkDevMem(Bool warn) -{ - static Bool devMemChecked = FALSE; - int fd; - pointer base; - - if (devMemChecked) - return; - devMemChecked = TRUE; - -#ifdef HAS_APERTURE_DRV - /* Try the aperture driver first */ - if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0) { - /* Try to map a page at the VGA address */ - base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE, - MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE); - - if (base != MAP_FAILED) { - munmap((caddr_t)base, 4096); - devMemFd = fd; - useDevMem = TRUE; - xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n", - DEV_APERTURE); - return; - } else { - if (warn) { - xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n", - DEV_APERTURE, strerror(errno)); - } - } - } -#endif - if ((fd = open(DEV_MEM, O_RDWR)) >= 0) { - /* Try to map a page at the VGA address */ - base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE, - MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE); - - if (base != MAP_FAILED) { - munmap((caddr_t)base, 4096); - devMemFd = fd; - useDevMem = TRUE; - return; - } else { - if (warn) { - xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n", - DEV_MEM, strerror(errno)); - } - } - } - if (warn) { -#ifndef HAS_APERTURE_DRV - xf86Msg(X_WARNING, "checkDevMem: failed to open/mmap %s (%s)\n", - DEV_MEM, strerror(errno)); -#else -#ifndef __OpenBSD__ - xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" - "\t(%s)\n", DEV_APERTURE, DEV_MEM, strerror(errno)); -#else /* __OpenBSD__ */ - xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" - "\t(%s)\n%s", DEV_APERTURE, DEV_MEM, strerror(errno), - SYSCTL_MSG); -#endif /* __OpenBSD__ */ -#endif - xf86ErrorF("\tlinear framebuffer access unavailable\n"); - } - useDevMem = FALSE; - return; -} - -void -xf86OSInitVidMem(VidMemInfoPtr pVidMem) -{ - checkDevMem(TRUE); - pVidMem->linearSupported = useDevMem; - - if (has_bwx()) { - xf86Msg(X_PROBED,"Machine type has 8/16 bit access\n"); - pVidMem->mapMem = mapVidMem; - pVidMem->unmapMem = unmapVidMem; - } else { - xf86Msg(X_PROBED,"Machine needs sparse mapping\n"); - pVidMem->mapMem = mapVidMemSparse; - pVidMem->unmapMem = unmapVidMemSparse; -#ifndef __NetBSD__ - if (axpSystem == -1) - axpSystem = bsdGetAXP(); - hae_thresh = xf86AXPParams[axpSystem].hae_thresh; - hae_mask = xf86AXPParams[axpSystem].hae_mask; - sparse_size = xf86AXPParams[axpSystem].size; -#endif /* __NetBSD__ */ - } - pVidMem->initialised = TRUE; -} - -static pointer -mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) -{ - pointer base; - - checkDevMem(FALSE); - Base = Base & ((1L<<32) - 1); - - if (useDevMem) - { - if (devMemFd < 0) - { - FatalError("xf86MapVidMem: failed to open %s (%s)\n", - DEV_MEM, strerror(errno)); - } - base = mmap((caddr_t)0, Size, - (flags & VIDMEM_READONLY) ? - PROT_READ : (PROT_READ | PROT_WRITE), - MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX); - if (base == MAP_FAILED) - { - FatalError("%s: could not mmap %s [s=%lx,a=%lx] (%s)\n", - "xf86MapVidMem", DEV_MEM, Size, Base, - strerror(errno)); - } - return(base); - } - - /* else, mmap /dev/vga */ - if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000) - { - FatalError("%s: Address 0x%lx outside allowable range\n", - "xf86MapVidMem", Base); - } - base = mmap(0, Size, - (flags & VIDMEM_READONLY) ? - PROT_READ : (PROT_READ | PROT_WRITE), - MAP_FLAGS, xf86Info.screenFd, - (unsigned long)Base + BUS_BASE); - if (base == MAP_FAILED) - { - FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n", - strerror(errno)); - } - return(base); -} - -static void -unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - munmap((caddr_t)Base, Size); -} - -/* - * Read BIOS via mmap()ing DEV_MEM - */ - -int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ - unsigned char *ptr; - int psize; - int mlen; - - checkDevMem(TRUE); - if (devMemFd == -1) { - return(-1); - } - - psize = xf86getpagesize(); - Offset += Base & (psize - 1); - Base &= ~(psize - 1); - mlen = (Offset + Len + psize - 1) & ~(psize - 1); - ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ, - MAP_SHARED, devMemFd, (off_t)Base+BUS_BASE); - if ((long)ptr == -1) - { - xf86Msg(X_WARNING, - "xf86ReadBIOS: %s mmap[s=%x,a=%lx,o=%lx] failed (%s)\n", - DEV_MEM, Len, Base, Offset, strerror(errno)); - return(-1); - } -#ifdef DEBUG - xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n", - Base, ptr[0] | (ptr[1] << 8)); -#endif - (void)memcpy(Buf, (void *)(ptr + Offset), Len); - (void)munmap((caddr_t)ptr, mlen); -#ifdef DEBUG - xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)" - "-> %02x %02x %02x %02x...\n", - Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]); -#endif - return(Len); -} - - -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) - -extern int ioperm(unsigned long from, unsigned long num, int on); - -Bool -xf86EnableIO() -{ - if (!ioperm(0, 65536, TRUE)) - return TRUE; - return FALSE; -} - -void -xf86DisableIO() -{ - return; -} - -#endif /* __FreeBSD_kernel__ || __OpenBSD__ */ - -#ifdef USE_ALPHA_PIO - -Bool -xf86EnableIO() -{ - alpha_pci_io_enable(1); - return TRUE; -} - -void -xf86DisableIO() -{ - alpha_pci_io_enable(0); -} - -#endif /* USE_ALPHA_PIO */ - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -Bool -xf86DisableInterrupts() -{ - - return(TRUE); -} - -void -xf86EnableInterrupts() -{ - return; -} - - -#define vuip volatile unsigned int * - -static unsigned long msb_set = 0; -static pointer memSBase = 0; -static pointer memBase = 0; - -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); -extern void -writeDenseNB16(int Value, pointer Base, register unsigned long Offset); -extern void -writeDenseNB32(int Value, pointer Base, register unsigned long Offset); -extern void -writeDense8(int Value, pointer Base, register unsigned long Offset); -extern void -writeDense16(int Value, pointer Base, register unsigned long Offset); -extern void -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); -static void -writeSparseNB16(int Value, pointer Base, register unsigned long Offset); -static void -writeSparseNB32(int Value, pointer Base, register unsigned long Offset); -static void -writeSparse8(int Value, pointer Base, register unsigned long Offset); -static void -writeSparse16(int Value, pointer Base, register unsigned long Offset); -static void -writeSparse32(int Value, pointer Base, register unsigned long Offset); - -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -extern int sysarch(int, void *); -#endif - -struct parms { - u_int64_t hae; -}; - -#ifndef __NetBSD__ -static int -sethae(u_int64_t hae) -{ -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -#ifndef ALPHA_SETHAE -#define ALPHA_SETHAE 0 -#endif - struct parms p; - p.hae = hae; - return (sysarch(ALPHA_SETHAE, (char *)&p)); -#endif -#ifdef __OpenBSD__ - return -1; -#endif -} -#endif /* __NetBSD__ */ - -static pointer -mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags) -{ - static Bool was_here = FALSE; - - if (!was_here) { - was_here = TRUE; - - checkDevMem(FALSE); - - xf86WriteMmio8 = writeSparse8; - xf86WriteMmio16 = writeSparse16; - xf86WriteMmio32 = writeSparse32; - xf86WriteMmioNB8 = writeSparseNB8; - xf86WriteMmioNB16 = writeSparseNB16; - xf86WriteMmioNB32 = writeSparseNB32; - xf86ReadMmio8 = readSparse8; - xf86ReadMmio16 = readSparse16; - xf86ReadMmio32 = readSparse32; - - memBase = mmap((caddr_t)0, 0x100000000, - PROT_READ | PROT_WRITE, - MAP_SHARED, devMemFd, - (off_t) BUS_BASE); - memSBase = mmap((caddr_t)0, 0x100000000, - PROT_READ | PROT_WRITE, - MAP_SHARED, devMemFd, - (off_t) BUS_BASE_BWX); - - if (memSBase == MAP_FAILED || memBase == MAP_FAILED) { - FatalError("xf86MapVidMem: Could not mmap framebuffer (%s)\n", - strerror(errno)); - } - } - return (pointer)((unsigned long)memBase + Base); -} - -static void -unmapVidMemSparse(int ScreenNum, pointer Base, unsigned long Size) -{ -} - -static int -readSparse8(pointer Base, register unsigned long Offset) -{ - register unsigned long result, shift; - register unsigned long msb; - mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)memBase; - shift = (Offset & 0x3) << 3; - if (Offset >= (hae_thresh)) { - msb = Offset & hae_mask; - Offset -= msb; - if (msb_set != msb) { -#ifndef __NetBSD__ - sethae(msb); -#endif - msb_set = msb; - } - } - result = *(vuip) ((unsigned long)memSBase + (Offset << 5)); - result >>= shift; - return 0xffUL & result; -} - -static int -readSparse16(pointer Base, register unsigned long Offset) -{ - register unsigned long result, shift; - register unsigned long msb; - - mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)memBase; - shift = (Offset & 0x2) << 3; - if (Offset >= (hae_thresh)) { - msb = Offset & hae_mask; - Offset -= msb; - if (msb_set != msb) { -#ifndef __NetBSD__ - sethae(msb); -#endif - msb_set = msb; - } - } - result = *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))); - result >>= shift; - return 0xffffUL & result; -} - -static int -readSparse32(pointer Base, register unsigned long Offset) -{ - mem_barrier(); - return *(vuip)((unsigned long)Base+(Offset)); -} - -static void -writeSparse8(int Value, pointer Base, register unsigned long Offset) -{ - register unsigned long msb; - register unsigned int b = Value & 0xffU; - - write_mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)memBase; - if (Offset >= (hae_thresh)) { - msb = Offset & hae_mask; - Offset -= msb; - if (msb_set != msb) { -#ifndef __NetBSD__ - sethae(msb); -#endif - msb_set = msb; - } - } - *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101; -} - -static void -writeSparse16(int Value, pointer Base, register unsigned long Offset) -{ - register unsigned long msb; - register unsigned int w = Value & 0xffffU; - - write_mem_barrier(); - Offset += (unsigned long)Base - (unsigned long)memBase; - if (Offset >= (hae_thresh)) { - msb = Offset & hae_mask; - Offset -= msb; - if (msb_set != msb) { -#ifndef __NetBSD__ - sethae(msb); -#endif - msb_set = msb; - } - } - *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) = - w * 0x00010001; - -} - -static void -writeSparse32(int Value, pointer Base, register unsigned long Offset) -{ - write_mem_barrier(); - *(vuip)((unsigned long)Base + (Offset)) = Value; - return; -} - -static void -writeSparseNB8(int Value, pointer Base, register unsigned long Offset) -{ - register unsigned long msb; - register unsigned int b = Value & 0xffU; - - Offset += (unsigned long)Base - (unsigned long)memBase; - if (Offset >= (hae_thresh)) { - msb = Offset & hae_mask; - Offset -= msb; - if (msb_set != msb) { -#ifndef __NetBSD__ - sethae(msb); -#endif - msb_set = msb; - } - } - *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101; -} - -static void -writeSparseNB16(int Value, pointer Base, register unsigned long Offset) -{ - register unsigned long msb; - register unsigned int w = Value & 0xffffU; - - Offset += (unsigned long)Base - (unsigned long)memBase; - if (Offset >= (hae_thresh)) { - msb = Offset & hae_mask ; - Offset -= msb; - if (msb_set != msb) { -#ifndef __NetBSD__ - sethae(msb); -#endif - msb_set = msb; - } - } - *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) = - w * 0x00010001; -} - -static void -writeSparseNB32(int Value, pointer Base, register unsigned long Offset) -{ - *(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; - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/arm_video.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/arm_video.c deleted file mode 100644 index 98fb8f993..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/arm_video.c +++ /dev/null @@ -1,690 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/arm_video.c,v 1.1tsi Exp $ */ -/* - * Copyright 1992 by Rich Murphey - * Copyright 1993 by David Wexelblat - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Rich Murphey and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Rich Murphey and - * David Wexelblat make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/* - * The ARM32 code here carries the following copyright: - * - * Copyright 1997 - * Digital Equipment Corporation. All rights reserved. - * This software is furnished under license and may be used and copied only in - * accordance with the following terms and conditions. Subject to these - * conditions, you may download, copy, install, use, modify and distribute - * this software in source and/or binary form. No title or ownership is - * transferred hereby. - * - * 1) Any source code used, modified or distributed must reproduce and retain - * this copyright notice and list of conditions as they appear in the - * source file. - * - * 2) No right is granted to use any trade name, trademark, or logo of Digital - * Equipment Corporation. Neither the "Digital Equipment Corporation" - * name nor any trademark or logo of Digital Equipment Corporation may be - * used to endorse or promote products derived from this software without - * the prior written permission of Digital Equipment Corporation. - * - * 3) This software is provided "AS-IS" and any express or implied warranties, - * including but not limited to, any implied warranties of merchantability, - * fitness for a particular purpose, or non-infringement are disclaimed. - * In no event shall DIGITAL be liable for any damages whatsoever, and in - * particular, DIGITAL shall not be liable for special, indirect, - * consequential, or incidental damages or damages for lost profits, loss - * of revenue or loss of use, whether such damages arise in contract, - * negligence, tort, under statute, in equity, at law or otherwise, even - * if advised of the possibility of such damage. - * - */ - -/* $XConsortium: bsd_video.c /main/10 1996/10/25 11:37:57 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86OSpriv.h" - -#ifdef __arm32__ -#include "machine/devmap.h" -struct memAccess -{ - int ioctl; - struct map_info memInfo; - pointer regionVirtBase; - Bool Checked; - Bool OK; -}; - -static pointer xf86MapInfoMap(); -static void xf86MapInfoUnmap(); -static struct memAccess *checkMapInfo(); -extern int vgaPhysLinearBase; - -/* A memAccess structure is needed for each possible region */ -struct memAccess vgaMemInfo = { CONSOLE_GET_MEM_INFO, NULL, NULL, - FALSE, FALSE }; -struct memAccess linearMemInfo = { CONSOLE_GET_LINEAR_INFO, NULL, NULL, - FALSE, FALSE }; -struct memAccess ioMemInfo = { CONSOLE_GET_IO_INFO, NULL, NULL, - FALSE, FALSE }; -#endif /* __arm32__ */ - -#if defined(__NetBSD__) && !defined(MAP_FILE) -#define MAP_FLAGS MAP_SHARED -#else -#define MAP_FLAGS (MAP_FILE | MAP_SHARED) -#endif - -#ifndef MAP_FAILED -#define MAP_FAILED ((caddr_t)-1) -#endif - - -#define BUS_BASE 0L -#define BUS_BASE_BWX 0L - - -/***************************************************************************/ -/* Video Memory Mapping section */ -/***************************************************************************/ - -static Bool useDevMem = FALSE; -static int devMemFd = -1; - -#define DEV_MEM "/dev/mem" - -static pointer mapVidMem(int, unsigned long, unsigned long, int); -static void unmapVidMem(int, pointer, unsigned long); - -/* - * Check if /dev/mem can be mmap'd. If it can't print a warning when - * "warn" is TRUE. - */ -static void -checkDevMem(Bool warn) -{ - static Bool devMemChecked = FALSE; - int fd; - pointer base; - - if (devMemChecked) - return; - devMemChecked = TRUE; - - if ((fd = open(DEV_MEM, O_RDWR)) >= 0) - { - /* Try to map a page at the VGA address */ - base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE, - MAP_FLAGS, fd, (off_t)0xA0000 + BUS_BASE); - - if (base != MAP_FAILED) - { - munmap((caddr_t)base, 4096); - devMemFd = fd; - useDevMem = TRUE; - return; - } else { - /* This should not happen */ - if (warn) - { - xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n", - DEV_MEM, strerror(errno)); - } - useDevMem = FALSE; - return; - } - } - if (warn) - { - xf86Msg(X_WARNING, "checkDevMem: failed to open %s (%s)\n", - DEV_MEM, strerror(errno)); - } - useDevMem = FALSE; - return; -} - -void -xf86OSInitVidMem(VidMemInfoPtr pVidMem) -{ - - checkDevMem(TRUE); - pVidMem->linearSupported = useDevMem; - pVidMem->mapMem = armMapVidMem; - pVidMem->unmapVidMem = armUnmapVidMem; - - pVidMem->initialised = TRUE; -} - -static pointer -mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) -{ - pointer base; - - checkDevMem(FALSE); - - if (useDevMem) - { - if (devMemFd < 0) - { - FatalError("xf86MapVidMem: failed to open %s (%s)\n", - DEV_MEM, strerror(errno)); - } - base = mmap((caddr_t)0, Size, - (flags & VIDMEM_READONLY) ? - PROT_READ : (PROT_READ | PROT_WRITE), - MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX); - if (base == MAP_FAILED) - { - FatalError("%s: could not mmap %s [s=%x,a=%x] (%s)\n", - "xf86MapVidMem", DEV_MEM, Size, Base, - strerror(errno)); - } - return(base); - } - - /* else, mmap /dev/vga */ - if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000) - { - FatalError("%s: Address 0x%x outside allowable range\n", - "xf86MapVidMem", Base); - } - base = mmap(0, Size, - (flags & VIDMEM_READONLY) ? - PROT_READ : (PROT_READ | PROT_WRITE), - MAP_FLAGS, xf86Info.screenFd, - (unsigned long)Base - 0xA0000); - if (base == MAP_FAILED) - { - FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)\n", - strerror(errno)); - } - return(base); -} - -static void -unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - munmap((caddr_t)Base, Size); -} - -/* - * Read BIOS via mmap()ing DEV_MEM - */ - -int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ - unsigned char *ptr; - int psize; - int mlen; - - checkDevMem(TRUE); - if (devMemFd == -1) { - return(-1); - } - - psize = xf86getpagesize(); - Offset += Base & (psize - 1); - Base &= ~(psize - 1); - mlen = (Offset + Len + psize - 1) & ~(psize - 1); - ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ, - MAP_SHARED, devMemFd, (off_t)Base+BUS_BASE); - if ((long)ptr == -1) - { - xf86Msg(X_WARNING, - "xf86ReadBIOS: %s mmap[s=%x,a=%x,o=%x] failed (%s)\n", - DEV_MEM, Len, Base, Offset, strerror(errno)); - return(-1); - } -#ifdef DEBUG - ErrorF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n", - Base, ptr[0] | (ptr[1] << 8)); -#endif - (void)memcpy(Buf, (void *)(ptr + Offset), Len); - (void)munmap((caddr_t)ptr, mlen); -#ifdef DEBUG - xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)" - "-> %02x %02x %02x %02x...\n", - Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]); -#endif - return(Len); -} - - -/* XXX This needs to be updated for the ND */ - -/* -** Find out whether the console driver provides memory mapping information -** for the specified region and return the map_info pointer. Print a warning if required. -*/ -static struct memAccess * -checkMapInfo(Bool warn, int Region) -{ - struct memAccess *memAccP; - - switch (Region) - { - case VGA_REGION: - memAccP = &vgaMemInfo; - break; - - case LINEAR_REGION: - memAccP = &linearMemInfo; - break; - - case MMIO_REGION: - memAccP = &ioMemInfo; - break; - - default: - return NULL; - break; - } - - if(!memAccP->Checked) - { - if(ioctl(xf86Info.screenFd, memAccP->ioctl, &(memAccP->memInfo)) == -1) - { - if(warn) - { - xf86Msg(X_WARNING, - "checkMapInfo: failed to get map info for region %d\n\t(%s)\n", - Region, strerror(errno)); - } - } - else - { - if(memAccP->memInfo.u.map_info_mmap.map_offset - != MAP_INFO_UNKNOWN) - memAccP->OK = TRUE; - } - memAccP->Checked = TRUE; - } - if (memAccP->OK) - { - return memAccP; - } - else - { - return NULL; - } -} - -static pointer -xf86MapInfoMap(struct memAccess *memInfoP, pointer Base, unsigned long Size) -{ - struct map_info *mapInfoP = &(memInfoP->memInfo); - - if (mapInfoP->u.map_info_mmap.map_size == MAP_INFO_UNKNOWN) - { - Size = (unsigned long)Base + Size; - } - else - { - Size = mapInfoP->u.map_info_mmap.map_size; - } - - switch(mapInfoP->method) - { - case MAP_MMAP: - /* Need to remap if size is unknown because we may not have - mapped the whole region initially */ - if(memInfoP->regionVirtBase == NULL || - mapInfoP->u.map_info_mmap.map_size == MAP_INFO_UNKNOWN) - { - if((memInfoP->regionVirtBase = - mmap((caddr_t)0, - Size, - PROT_READ | PROT_WRITE, - MAP_SHARED, - xf86Info.screenFd, - (unsigned long)mapInfoP->u.map_info_mmap.map_offset)) - == (pointer)-1) - { - FatalError("xf86MapInfoMap: Failed to map memory at 0x%x\n\t%s\n", - mapInfoP->u.map_info_mmap.map_offset, strerror(errno)); - } - if(mapInfoP->u.map_info_mmap.internal_offset > 0) - memInfoP->regionVirtBase += - mapInfoP->u.map_info_mmap.internal_offset; - } - break; - - default: - FatalError("xf86MapInfoMap: Unsuported mapping method\n"); - break; - } - - return (pointer)((int)memInfoP->regionVirtBase + (int)Base); -} - -static void -xf86MapInfoUnmap(struct memAccess *memInfoP, unsigned long Size) -{ - struct map_info *mapInfoP = &(memInfoP->memInfo); - - switch(mapInfoP->method) - { - case MAP_MMAP: - if(memInfoP->regionVirtBase != NULL) - { - if(mapInfoP->u.map_info_mmap.map_size != MAP_INFO_UNKNOWN) - Size = mapInfoP->u.map_info_mmap.map_size; - munmap((caddr_t)memInfoP->regionVirtBase, Size); - memInfoP->regionVirtBase = NULL; - } - break; - default: - FatalError("xf86MapInfoMap: Unsuported mapping method\n"); - break; - } -} - -static pointer -armMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) -{ - struct memAccess *memInfoP; - - if((memInfoP = checkMapInfo(FALSE, Region)) != NULL) - { - /* - ** xf86 passes in a physical address offset from the start - ** of physical memory, but xf86MapInfoMap expects an - ** offset from the start of the specified region - it gets - ** the physical address of the region from the display driver. - */ - switch(Region) - { - case LINEAR_REGION: - if (vgaPhysLinearBase) - { - Base -= vgaPhysLinearBase; - } - break; - case VGA_REGION: - Base -= 0xA0000; - break; - } - - base = xf86MapInfoMap(memInfoP, Base, Size); - return (base); - } - return mapVidMem(ScreenNum, Base, Size, flags); -} - -static void -armUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - struct memAccess *memInfoP; - - if((memInfoP = checkMapInfo(FALSE, Region)) != NULL) - { - xf86MapInfoUnmap(memInfoP, Base, Size); - } - unmapVidMem(ScreenNum, Base, Size); -} - -#ifdef USE_DEV_IO -static int IoFd = -1; - -Bool -xf86EnableIO() -{ - if (IoFd >= 0) - return TRUE; - - if ((IoFd = open("/dev/io", O_RDWR)) == -1) - { - xf86Msg(X_WARNING,"xf86EnableIO: " - "Failed to open /dev/io for extended I/O\n"); - return FALSE; - } - return TRUE; -} - -void -xf86DisableIO() -{ - if (IoFd < 0) - return; - - close(IoFd); - IoFd = -1; - return; -} - -#endif - -#if defined(USE_ARC_MMAP) || defined(__arm32__) - -Bool -xf86EnableIO() -{ - int fd; - pointer base; - - if (ExtendedEnabled) - return TRUE; - - if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) { - /* Try to map a page at the pccons I/O space */ - base = (pointer)mmap((caddr_t)0, 65536, PROT_READ | PROT_WRITE, - MAP_FLAGS, fd, (off_t)0x0000); - - if (base != (pointer)-1) { - IOPortBase = base; - } - else { - xf86Msg(X_WARNING,"EnableIO: failed to mmap %s (%s)\n", - "/dev/ttyC0", strerror(errno)); - return FALSE; - } - } - else { - xf86Msg("EnableIO: failed to open %s (%s)\n", - "/dev/ttyC0", strerror(errno)); - return FALSE; - } - - ExtendedEnabled = TRUE; - - return TRUE; -} - -void -xf86DisableIO() -{ - return; -} - -#endif /* USE_ARC_MMAP */ - - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -Bool -xf86DisableInterrupts() -{ - - return(TRUE); -} - -void -xf86EnableInterrupts() -{ - - return; -} - - - -#if 0 -/* - * XXX This is here for reference. It needs to be handled differently for the - * ND. - */ -#if defined(USE_ARC_MMAP) || defined(__arm32__) - -#ifdef USE_ARM32_MMAP -#define DEV_MEM_IOBASE 0x43000000 -#endif - -static Bool ScreenEnabled[MAXSCREENS]; -static Bool ExtendedEnabled = FALSE; -static Bool InitDone = FALSE; - -Bool -xf86EnableIOPorts(ScreenNum) -int ScreenNum; -{ - int i; - int fd; - pointer base; - -#ifdef __arm32__ - struct memAccess *memInfoP; - int *Size; -#endif - - ScreenEnabled[ScreenNum] = TRUE; - - if (ExtendedEnabled) - return TRUE; - -#ifdef USE_ARC_MMAP - if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) { - /* Try to map a page at the pccons I/O space */ - base = (pointer)mmap((caddr_t)0, 65536, PROT_READ | PROT_WRITE, - MAP_FLAGS, fd, (off_t)0x0000); - - if (base != (pointer)-1) { - IOPortBase = base; - } - else { - xf86Msg(X_ERROR, - "EnableIOPorts: failed to mmap %s (%s)\n", - "/dev/ttyC0", strerror(errno)); - } - } - else { - xf86Msg(X_ERROR, "EnableIOPorts: failed to open %s (%s)\n", - "/dev/ttyC0", strerror(errno)); - } -#endif - -#ifdef __arm32__ - IOPortBase = (unsigned int)-1; - - if((memInfoP = checkMapInfo(TRUE, MMIO_REGION)) != NULL) - { - /* - * xf86MapInfoMap maps an offset from the start of video IO - * space (e.g. 0x3B0), but IOPortBase is expected to map to - * physical address 0x000, so subtract the start of video I/O - * space from the result. This is safe for now becase we - * actually mmap the start of the page, then the start of video - * I/O space is added as an internal offset. - */ - IOPortBase = (unsigned int)xf86MapInfoMap(memInfoP, - (caddr_t)0x0, 0L) - - memInfoP->memInfo.u.map_info_mmap.internal_offset; - ExtendedEnabled = TRUE; - return TRUE; - } -#ifdef USE_ARM32_MMAP - checkDevMem(TRUE); - - if (devMemFd >= 0 && useDevMem) - { - base = (pointer)mmap((caddr_t)0, 0x400, PROT_READ | PROT_WRITE, - MAP_FLAGS, devMemFd, (off_t)DEV_MEM_IOBASE); - - if (base != (pointer)-1) - IOPortBase = (unsigned int)base; - } - - if (IOPortBase == (unsigned int)-1) - { - xf86Msg(X_WARNING,"xf86EnableIOPorts: failed to open mem device or map IO base. \n\ -Make sure you have the Aperture Driver installed, or a kernel built with the INSECURE option\n"); - return FALSE; - } -#else - /* We don't have the IOBASE, so we can't map the address */ - xf86Msg(X_WARNING,"xf86EnableIOPorts: failed to open mem device or map IO base. \n\ -Try building the server with USE_ARM32_MMAP defined\n"); - return FALSE; -#endif -#endif - - ExtendedEnabled = TRUE; - - return TRUE; -} - -void -xf86DisableIOPorts(ScreenNum) -int ScreenNum; -{ - int i; -#ifdef __arm32__ - struct memAccess *memInfoP; -#endif - - ScreenEnabled[ScreenNum] = FALSE; - -#ifdef __arm32__ - if((memInfoP = checkMapInfo(FALSE, MMIO_REGION)) != NULL) - { - xf86MapInfoUnmap(memInfoP, 0); - } -#endif - -#ifdef USE_ARM32_MMAP - if (!ExtendedEnabled) - return; - - for (i = 0; i < MAXSCREENS; i++) - if (ScreenEnabled[i]) - return; - - munmap((caddr_t)IOPortBase, 0x400); - IOPortBase = (unsigned int)-1; - ExtendedEnabled = FALSE; -#endif - - return; -} - -#endif /* USE_ARC_MMAP || USE_ARM32_MMAP */ -#endif - - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c deleted file mode 100644 index d38230a83..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c +++ /dev/null @@ -1,194 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c,v 1.6 2001/02/16 14:45:10 tsi Exp $ */ - -/* Resource information code */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Privstr.h" -#include "xf86Pci.h" -#include "xf86Resources.h" -#define NEED_OS_RAC_PROTOS -#include "xf86_OSlib.h" - -/* Avoid Imakefile changes */ -#include "bus/Pci.h" - -resRange PciAvoid[] = {_PCI_AVOID_PC_STYLE, _END}; - -#ifdef INCLUDE_XF86_NO_DOMAIN - -#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__) - -resPtr -xf86BusAccWindowsFromOS(void) -{ - resPtr ret = NULL; - resRange range; - - RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - - RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - return ret; -} - -resPtr -xf86PciBusAccWindowsFromOS(void) -{ - resPtr ret = NULL; - resRange range; - - /* - * Only allow the upper half of the pci memory range to be used - * for allocation. The lower half includes magic regions for DMA. - * XXX this is not right for XP1000's and similar where we use the - * region 0x40000000-0xbfffffff for DMA but this only matters if - * the bios screws up the pci region mappings. - */ - RANGE(range, 0x80000000, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - - RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - return ret; -} - -#ifdef INCLUDE_UNUSED - -resPtr -xf86IsaBusAccWindowsFromOS(void) -{ - resPtr ret = NULL; - resRange range; - - RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - - RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - return ret; -} - -#endif /* INCLUDE_UNUSED */ - -resPtr -xf86AccResFromOS(resPtr ret) -{ - resRange range; - - /* - * Fallback is to claim the following areas: - * - * 0x000c0000 - 0x000effff location of VGA and other extensions ROMS - */ - - RANGE(range, 0x000c0000, 0x000effff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - - /* - * Fallback would be to claim well known ports in the 0x0 - 0x3ff range - * along with their sparse I/O aliases, but that's too imprecise. Instead - * claim a bare minimum here. - */ - RANGE(range, 0x00000000, 0x000000ff, ResExcIoBlock); /* For mainboard */ - ret = xf86AddResToList(ret, &range, -1); - - /* - * At minimum, the top and bottom resources must be claimed, so that - * resources that are (or appear to be) unallocated can be relocated. - */ - RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); -/* RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); */ - RANGE(range, 0xffffffff, 0xffffffff, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - - /* XXX add others */ - return ret; -} - -#elif defined(__powerpc__) - -resPtr -xf86BusAccWindowsFromOS(void) -{ - resPtr ret = NULL; - resRange range; - - RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - - RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - return ret; -} - -resPtr -xf86PciBusAccWindowsFromOS(void) -{ - resPtr ret = NULL; - resRange range; - - RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - - RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - return ret; -} - -#ifdef INCLUDE_UNUSED - -resPtr -xf86IsaBusAccWindowsFromOS(void) -{ - resPtr ret = NULL; - resRange range; - - RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - - RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - return ret; -} - -#endif /* INCLUDE_UNUSED */ - -resPtr -xf86AccResFromOS(resPtr ret) -{ - resRange range; - - /* - * At minimum, the top and bottom resources must be claimed, so that - * resources that are (or appear to be) unallocated can be relocated. - */ - RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x0000ffff, 0x0000ffff, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - - return ret; -} - -#else - -#error : Put your platform dependent code here!! - -#endif - -#endif /* INCLUDE_XF86_NO_DOMAIN */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_KbdMap.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_KbdMap.c deleted file mode 100644 index d225c1f38..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_KbdMap.c +++ /dev/null @@ -1,1087 +0,0 @@ -/* $XFree86$ */ - -/* - * Slightly modified xf86KbdBSD.c which is - * - * Derived from xf86Kbd.c by S_ren Schmidt (sos@login.dkuug.dk) - * which is Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * and from xf86KbdCODrv.c by Holger Veit - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "input.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86Xinput.h" -#include "xf86OSKbd.h" -#include "atKeynames.h" -#include "xf86Keymap.h" -#include "bsd_kbd.h" - -#if (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)) && defined(GIO_KEYMAP) -#define KD_GET_ENTRY(i,n) \ - eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]] - -static unsigned char remap[NUM_KEYCODES] = { - 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */ - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */ - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */ - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */ - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */ - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */ - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */ - 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */ - 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */ - 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */ - 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */ -}; - -/* This table assumes the ibm code page 437 coding for characters - * > 0x80. They are returned in this form by PCVT */ -static KeySym eascii_to_x[512] = { - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, - NoSymbol, XK_Return, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_Escape, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_space, XK_exclam, XK_quotedbl, XK_numbersign, - XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, - XK_parenleft, XK_parenright, XK_asterisk, XK_plus, - XK_comma, XK_minus, XK_period, XK_slash, - XK_0, XK_1, XK_2, XK_3, - XK_4, XK_5, XK_6, XK_7, - XK_8, XK_9, XK_colon, XK_semicolon, - XK_less, XK_equal, XK_greater, XK_question, - XK_at, XK_A, XK_B, XK_C, - XK_D, XK_E, XK_F, XK_G, - XK_H, XK_I, XK_J, XK_K, - XK_L, XK_M, XK_N, XK_O, - XK_P, XK_Q, XK_R, XK_S, - XK_T, XK_U, XK_V, XK_W, - XK_X, XK_Y, XK_Z, XK_bracketleft, - XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, - XK_grave, XK_a, XK_b, XK_c, - XK_d, XK_e, XK_f, XK_g, - XK_h, XK_i, XK_j, XK_k, - XK_l, XK_m, XK_n, XK_o, - XK_p, XK_q, XK_r, XK_s, - XK_t, XK_u, XK_v, XK_w, - XK_x, XK_y, XK_z, XK_braceleft, - XK_bar, XK_braceright, XK_asciitilde, XK_Delete, - XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex, - XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla, - XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis, - XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring, - XK_Eacute, XK_ae, XK_AE, XK_ocircumflex, - XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave, - XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent, - XK_sterling, XK_yen, XK_paragraph, XK_section, - XK_aacute, XK_iacute, XK_oacute, XK_uacute, - XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine, - XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf, - XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi, - XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau, - XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta, - XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection, - XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal, - XK_topintegral, XK_botintegral, XK_division, XK_similarequal, - XK_degree, NoSymbol, NoSymbol, XK_radical, - XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol, - - /* - * special marked entries (256 + x) - */ - - /* This has been checked against what syscons actually does */ - NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R, - XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L, - XK_ISO_Left_Tab,XK_Control_L, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_F1, - XK_F2, XK_F3, XK_F4, XK_F5, - XK_F6, XK_F7, XK_F8, XK_F9, - XK_F10, XK_F11, XK_F12, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_Control_R, XK_Alt_R, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol -}; - -#ifdef __OpenBSD__ -/* don't mark AltR and CtrlR for remapping, since they - * cannot be remapped by pccons */ -static unsigned char pccons_remap[128] = { - 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */ - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */ - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */ - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */ - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */ - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */ - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */ - 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */ - 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */ - 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 - 0x77 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */ -}; - -/* This table assumes an iso8859_1 encoding for the characters - * > 80, as returned by pccons */ -static KeySym latin1_to_x[256] = { - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, - NoSymbol, XK_Return, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_Escape, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_space, XK_exclam, XK_quotedbl, XK_numbersign, - XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, - XK_parenleft, XK_parenright, XK_asterisk, XK_plus, - XK_comma, XK_minus, XK_period, XK_slash, - XK_0, XK_1, XK_2, XK_3, - XK_4, XK_5, XK_6, XK_7, - XK_8, XK_9, XK_colon, XK_semicolon, - XK_less, XK_equal, XK_greater, XK_question, - XK_at, XK_A, XK_B, XK_C, - XK_D, XK_E, XK_F, XK_G, - XK_H, XK_I, XK_J, XK_K, - XK_L, XK_M, XK_N, XK_O, - XK_P, XK_Q, XK_R, XK_S, - XK_T, XK_U, XK_V, XK_W, - XK_X, XK_Y, XK_Z, XK_bracketleft, - XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, - XK_grave, XK_a, XK_b, XK_c, - XK_d, XK_e, XK_f, XK_g, - XK_h, XK_i, XK_j, XK_k, - XK_l, XK_m, XK_n, XK_o, - XK_p, XK_q, XK_r, XK_s, - XK_t, XK_u, XK_v, XK_w, - XK_x, XK_y, XK_z, XK_braceleft, - XK_bar, XK_braceright, XK_asciitilde, XK_Delete, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling, - XK_currency, XK_yen, XK_brokenbar, XK_section, - XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft, - XK_notsign, XK_hyphen, XK_registered, XK_macron, - XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior, - XK_acute, XK_mu, XK_paragraph, XK_periodcentered, - XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright, - XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown, - XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde, - XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla, - XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis, - XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis, - XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute, - XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply, - XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex, - XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp, - XK_agrave, XK_aacute, XK_acircumflex, XK_atilde, - XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla, - XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis, - XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis, - XK_eth, XK_ntilde, XK_ograve, XK_oacute, - XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division, - XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex, - XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis - }; -#endif - -#ifdef SYSCONS_SUPPORT -static -unsigned char sysconsCODEMap[] = { - KEY_KP_Enter, KEY_RCtrl, KEY_KP_Divide, KEY_Print, - KEY_AltLang, KEY_KP_7, KEY_KP_8, KEY_KP_9, - KEY_KP_4, KEY_KP_6, KEY_KP_1, KEY_KP_2, - KEY_KP_3, KEY_KP_0, KEY_KP_Decimal, KEY_Pause, - KEY_LMeta, KEY_RMeta, KEY_Menu, KEY_Break -}; -static -TransMapRec sysconsCODE = { - 0x59, - 0x6d, - sysconsCODEMap -}; -#endif -#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ - -#ifdef WSCONS_SUPPORT - -static CARD8 wsUsbMap[] = { - /* 0 */ KEY_NOTUSED, - /* 1 */ KEY_NOTUSED, - /* 2 */ KEY_NOTUSED, - /* 3 */ KEY_NOTUSED, - /* 4 */ KEY_A, - /* 5 */ KEY_B, - /* 6 */ KEY_C, - /* 7 */ KEY_D, - /* 8 */ KEY_E, - /* 9 */ KEY_F, - /* 10 */ KEY_G, - /* 11 */ KEY_H, - /* 12 */ KEY_I, - /* 13 */ KEY_J, - /* 14 */ KEY_K, - /* 15 */ KEY_L, - /* 16 */ KEY_M, - /* 17 */ KEY_N, - /* 18 */ KEY_O, - /* 19 */ KEY_P, - /* 20 */ KEY_Q, - /* 21 */ KEY_R, - /* 22 */ KEY_S, - /* 23 */ KEY_T, - /* 24 */ KEY_U, - /* 25 */ KEY_V, - /* 26 */ KEY_W, - /* 27 */ KEY_X, - /* 28 */ KEY_Y, - /* 29 */ KEY_Z, - /* 30 */ KEY_1, /* 1 !*/ - /* 31 */ KEY_2, /* 2 @ */ - /* 32 */ KEY_3, /* 3 # */ - /* 33 */ KEY_4, /* 4 $ */ - /* 34 */ KEY_5, /* 5 % */ - /* 35 */ KEY_6, /* 6 ^ */ - /* 36 */ KEY_7, /* 7 & */ - /* 37 */ KEY_8, /* 8 * */ - /* 38 */ KEY_9, /* 9 ( */ - /* 39 */ KEY_0, /* 0 ) */ - /* 40 */ KEY_Enter, /* Return */ - /* 41 */ KEY_Escape, /* Escape */ - /* 42 */ KEY_BackSpace, /* Backspace Delete */ - /* 43 */ KEY_Tab, /* Tab */ - /* 44 */ KEY_Space, /* Space */ - /* 45 */ KEY_Minus, /* - _ */ - /* 46 */ KEY_Equal, /* = + */ - /* 47 */ KEY_LBrace, /* [ { */ - /* 48 */ KEY_RBrace, /* ] } */ - /* 49 */ KEY_BSlash, /* \ | */ - /* 50 */ KEY_BSlash2, /* \ _ # ~ on some keyboards */ - /* 51 */ KEY_SemiColon, /* ; : */ - /* 52 */ KEY_Quote, /* ' " */ - /* 53 */ KEY_Tilde, /* ` ~ */ - /* 54 */ KEY_Comma, /* , < */ - /* 55 */ KEY_Period, /* . > */ - /* 56 */ KEY_Slash, /* / ? */ - /* 57 */ KEY_CapsLock, /* Caps Lock */ - /* 58 */ KEY_F1, /* F1 */ - /* 59 */ KEY_F2, /* F2 */ - /* 60 */ KEY_F3, /* F3 */ - /* 61 */ KEY_F4, /* F4 */ - /* 62 */ KEY_F5, /* F5 */ - /* 63 */ KEY_F6, /* F6 */ - /* 64 */ KEY_F7, /* F7 */ - /* 65 */ KEY_F8, /* F8 */ - /* 66 */ KEY_F9, /* F9 */ - /* 67 */ KEY_F10, /* F10 */ - /* 68 */ KEY_F11, /* F11 */ - /* 69 */ KEY_F12, /* F12 */ - /* 70 */ KEY_Print, /* PrintScrn SysReq */ - /* 71 */ KEY_ScrollLock, /* Scroll Lock */ - /* 72 */ KEY_Pause, /* Pause Break */ - /* 73 */ KEY_Insert, /* Insert XXX Help on some Mac Keyboards */ - /* 74 */ KEY_Home, /* Home */ - /* 75 */ KEY_PgUp, /* Page Up */ - /* 76 */ KEY_Delete, /* Delete */ - /* 77 */ KEY_End, /* End */ - /* 78 */ KEY_PgDown, /* Page Down */ - /* 79 */ KEY_Right, /* Right Arrow */ - /* 80 */ KEY_Left, /* Left Arrow */ - /* 81 */ KEY_Down, /* Down Arrow */ - /* 82 */ KEY_Up, /* Up Arrow */ - /* 83 */ KEY_NumLock, /* Num Lock */ - /* 84 */ KEY_KP_Divide, /* Keypad / */ - /* 85 */ KEY_KP_Multiply, /* Keypad * */ - /* 86 */ KEY_KP_Minus, /* Keypad - */ - /* 87 */ KEY_KP_Plus, /* Keypad + */ - /* 88 */ KEY_KP_Enter, /* Keypad Enter */ - /* 89 */ KEY_KP_1, /* Keypad 1 End */ - /* 90 */ KEY_KP_2, /* Keypad 2 Down */ - /* 91 */ KEY_KP_3, /* Keypad 3 Pg Down */ - /* 92 */ KEY_KP_4, /* Keypad 4 Left */ - /* 93 */ KEY_KP_5, /* Keypad 5 */ - /* 94 */ KEY_KP_6, /* Keypad 6 */ - /* 95 */ KEY_KP_7, /* Keypad 7 Home */ - /* 96 */ KEY_KP_8, /* Keypad 8 Up */ - /* 97 */ KEY_KP_9, /* KEypad 9 Pg Up */ - /* 98 */ KEY_KP_0, /* Keypad 0 Ins */ - /* 99 */ KEY_KP_Decimal, /* Keypad . Del */ - /* 100 */ KEY_Less, /* < > on some keyboards */ - /* 101 */ KEY_Menu, /* Menu */ - /* 102 */ KEY_NOTUSED, - /* 103 */ KEY_KP_Equal, /* Keypad = on Mac keyboards */ - /* 104 */ KEY_NOTUSED, - /* 105 */ KEY_NOTUSED, - /* 106 */ KEY_NOTUSED, - /* 107 */ KEY_NOTUSED, - /* 108 */ KEY_NOTUSED, - /* 109 */ KEY_NOTUSED, - /* 110 */ KEY_NOTUSED, - /* 111 */ KEY_NOTUSED, - /* 112 */ KEY_NOTUSED, - /* 113 */ KEY_NOTUSED, - /* 114 */ KEY_NOTUSED, - /* 115 */ KEY_NOTUSED, - /* 116 */ KEY_NOTUSED, - /* 117 */ KEY_NOTUSED, - /* 118 */ KEY_NOTUSED, - /* 119 */ KEY_NOTUSED, - /* 120 */ KEY_NOTUSED, - /* 121 */ KEY_NOTUSED, - /* 122 */ KEY_NOTUSED, - /* 123 */ KEY_NOTUSED, - /* 124 */ KEY_NOTUSED, - /* 125 */ KEY_NOTUSED, - /* 126 */ KEY_NOTUSED, - /* 127 */ KEY_NOTUSED, - /* 128 */ KEY_NOTUSED, - /* 129 */ KEY_NOTUSED, - /* 130 */ KEY_NOTUSED, - /* 131 */ KEY_NOTUSED, - /* 132 */ KEY_NOTUSED, - /* 133 */ KEY_NOTUSED, - /* 134 */ KEY_NOTUSED, - /* 135 */ KEY_NOTUSED, - /* 136 */ KEY_NOTUSED, - /* 137 */ KEY_NOTUSED, - /* 138 */ KEY_NOTUSED, - /* 139 */ KEY_NOTUSED, - /* 140 */ KEY_NOTUSED, - /* 141 */ KEY_NOTUSED, - /* 142 */ KEY_NOTUSED, - /* 143 */ KEY_NOTUSED, - /* 144 */ KEY_NOTUSED, - /* 145 */ KEY_NOTUSED, - /* 146 */ KEY_NOTUSED, - /* 147 */ KEY_NOTUSED, - /* 148 */ KEY_NOTUSED, - /* 149 */ KEY_NOTUSED, - /* 150 */ KEY_NOTUSED, - /* 151 */ KEY_NOTUSED, - /* 152 */ KEY_NOTUSED, - /* 153 */ KEY_NOTUSED, - /* 154 */ KEY_NOTUSED, - /* 155 */ KEY_NOTUSED, - /* 156 */ KEY_NOTUSED, - /* 157 */ KEY_NOTUSED, - /* 158 */ KEY_NOTUSED, - /* 159 */ KEY_NOTUSED, - /* 160 */ KEY_NOTUSED, - /* 161 */ KEY_NOTUSED, - /* 162 */ KEY_NOTUSED, - /* 163 */ KEY_NOTUSED, - /* 164 */ KEY_NOTUSED, - /* 165 */ KEY_NOTUSED, - /* 166 */ KEY_NOTUSED, - /* 167 */ KEY_NOTUSED, - /* 168 */ KEY_NOTUSED, - /* 169 */ KEY_NOTUSED, - /* 170 */ KEY_NOTUSED, - /* 171 */ KEY_NOTUSED, - /* 172 */ KEY_NOTUSED, - /* 173 */ KEY_NOTUSED, - /* 174 */ KEY_NOTUSED, - /* 175 */ KEY_NOTUSED, - /* 176 */ KEY_NOTUSED, - /* 177 */ KEY_NOTUSED, - /* 178 */ KEY_NOTUSED, - /* 179 */ KEY_NOTUSED, - /* 180 */ KEY_NOTUSED, - /* 181 */ KEY_NOTUSED, - /* 182 */ KEY_NOTUSED, - /* 183 */ KEY_NOTUSED, - /* 184 */ KEY_NOTUSED, - /* 185 */ KEY_NOTUSED, - /* 186 */ KEY_NOTUSED, - /* 187 */ KEY_NOTUSED, - /* 188 */ KEY_NOTUSED, - /* 189 */ KEY_NOTUSED, - /* 190 */ KEY_NOTUSED, - /* 191 */ KEY_NOTUSED, - /* 192 */ KEY_NOTUSED, - /* 193 */ KEY_NOTUSED, - /* 194 */ KEY_NOTUSED, - /* 195 */ KEY_NOTUSED, - /* 196 */ KEY_NOTUSED, - /* 197 */ KEY_NOTUSED, - /* 198 */ KEY_NOTUSED, - /* 199 */ KEY_NOTUSED, - /* 200 */ KEY_NOTUSED, - /* 201 */ KEY_NOTUSED, - /* 202 */ KEY_NOTUSED, - /* 203 */ KEY_NOTUSED, - /* 204 */ KEY_NOTUSED, - /* 205 */ KEY_NOTUSED, - /* 206 */ KEY_NOTUSED, - /* 207 */ KEY_NOTUSED, - /* 208 */ KEY_NOTUSED, - /* 209 */ KEY_NOTUSED, - /* 210 */ KEY_NOTUSED, - /* 211 */ KEY_NOTUSED, - /* 212 */ KEY_NOTUSED, - /* 213 */ KEY_NOTUSED, - /* 214 */ KEY_NOTUSED, - /* 215 */ KEY_NOTUSED, - /* 216 */ KEY_NOTUSED, - /* 217 */ KEY_NOTUSED, - /* 218 */ KEY_NOTUSED, - /* 219 */ KEY_NOTUSED, - /* 220 */ KEY_NOTUSED, - /* 221 */ KEY_NOTUSED, - /* 222 */ KEY_NOTUSED, - /* 223 */ KEY_NOTUSED, - /* 224 */ KEY_LCtrl, /* Left Control */ - /* 225 */ KEY_ShiftL, /* Left Shift */ - /* 226 */ KEY_Alt, /* Left Alt */ - /* 227 */ KEY_LMeta, /* Left Meta */ - /* 228 */ KEY_RCtrl, /* Right Control */ - /* 229 */ KEY_ShiftR, /* Right Shift */ - /* 230 */ KEY_AltLang, /* Right Alt, AKA AltGr */ - /* 231 */ KEY_LMeta, /* Right Meta XXX */ -}; -#define WS_USB_MAP_SIZE (sizeof(wsUsbMap)/sizeof(unsigned char)) - -static -TransMapRec wsUsb = { - 0, - WS_USB_MAP_SIZE, - wsUsbMap -}; - -/* Map for adb keyboards */ -static CARD8 wsAdbMap[] = { - /* 0 */ KEY_A, - /* 1 */ KEY_S, - /* 2 */ KEY_D, - /* 3 */ KEY_F, - /* 4 */ KEY_H, - /* 5 */ KEY_G, - /* 6 */ KEY_Z, - /* 7 */ KEY_X, - /* 8 */ KEY_C, - /* 9 */ KEY_V, - /* 10 */ KEY_UNKNOWN, /* @ # on french keyboards */ - /* 11 */ KEY_B, - /* 12 */ KEY_Q, - /* 13 */ KEY_W, - /* 14 */ KEY_E, - /* 15 */ KEY_R, - /* 16 */ KEY_Y, - /* 17 */ KEY_T, - /* 18 */ KEY_1, - /* 19 */ KEY_2, - /* 20 */ KEY_3, - /* 21 */ KEY_4, - /* 22 */ KEY_6, - /* 23 */ KEY_5, - /* 24 */ KEY_Equal, - /* 25 */ KEY_9, - /* 26 */ KEY_7, - /* 27 */ KEY_Minus, - /* 28 */ KEY_8, - /* 29 */ KEY_0, - /* 30 */ KEY_RBrace, - /* 31 */ KEY_O, - /* 32 */ KEY_U, - /* 33 */ KEY_LBrace, - /* 34 */ KEY_I, - /* 35 */ KEY_P, - /* 36 */ KEY_Enter, - /* 37 */ KEY_L, - /* 38 */ KEY_J, - /* 39 */ KEY_Quote, - /* 40 */ KEY_K, - /* 41 */ KEY_SemiColon, - /* 42 */ KEY_BSlash, - /* 43 */ KEY_Comma, - /* 44 */ KEY_Slash, - /* 45 */ KEY_N, - /* 46 */ KEY_M, - /* 47 */ KEY_Period, - /* 48 */ KEY_Tab, - /* 49 */ KEY_Space, - /* 50 */ KEY_Tilde, - /* 51 */ KEY_Delete, - /* 52 */ KEY_AltLang, - /* 53 */ KEY_Escape, - /* 54 */ KEY_LCtrl, - /* 55 */ KEY_Alt, - /* 56 */ KEY_ShiftL, - /* 57 */ KEY_CapsLock, - /* 58 */ KEY_LMeta, - /* 59 */ KEY_Left, - /* 60 */ KEY_Right, - /* 61 */ KEY_Down, - /* 62 */ KEY_Up, - /* 63 */ KEY_UNKNOWN, /* Fn */ - /* 64 */ KEY_NOTUSED, - /* 65 */ KEY_KP_Decimal, - /* 66 */ KEY_NOTUSED, - /* 67 */ KEY_KP_Multiply, - /* 68 */ KEY_NOTUSED, - /* 69 */ KEY_KP_Plus, - /* 70 */ KEY_NOTUSED, - /* 71 */ KEY_UNKNOWN, /* Clear */ - /* 72 */ KEY_NOTUSED, - /* 73 */ KEY_NOTUSED, - /* 74 */ KEY_NOTUSED, - /* 75 */ KEY_KP_Divide, - /* 76 */ KEY_KP_Enter, - /* 77 */ KEY_NOTUSED, - /* 78 */ KEY_KP_Minus, - /* 79 */ KEY_NOTUSED, - /* 80 */ KEY_NOTUSED, - /* 81 */ KEY_KP_Equal, /* Keypad = */ - /* 82 */ KEY_KP_0, - /* 83 */ KEY_KP_1, - /* 84 */ KEY_KP_2, - /* 85 */ KEY_KP_3, - /* 86 */ KEY_KP_4, - /* 87 */ KEY_KP_5, - /* 88 */ KEY_KP_6, - /* 89 */ KEY_KP_7, - /* 90 */ KEY_NOTUSED, - /* 91 */ KEY_KP_8, - /* 92 */ KEY_KP_9, - /* 93 */ KEY_NOTUSED, - /* 94 */ KEY_NOTUSED, - /* 95 */ KEY_UNKNOWN, /* Keypad , */ - /* 96 */ KEY_F5, - /* 97 */ KEY_F6, - /* 98 */ KEY_F7, - /* 99 */ KEY_F3, - /* 100 */ KEY_F8, - /* 101 */ KEY_F9, - /* 102 */ KEY_NOTUSED, - /* 103 */ KEY_F11, - /* 104 */ KEY_NOTUSED, - /* 105 */ KEY_NOTUSED, - /* 106 */ KEY_KP_Enter, - /* 107 */ KEY_NOTUSED, - /* 108 */ KEY_NOTUSED, - /* 109 */ KEY_F10, - /* 110 */ KEY_NOTUSED, - /* 111 */ KEY_F12, - /* 112 */ KEY_NOTUSED, - /* 113 */ KEY_NOTUSED, - /* 114 */ KEY_NOTUSED, - /* 115 */ KEY_Home, - /* 116 */ KEY_PgUp, - /* 117 */ KEY_NOTUSED, - /* 118 */ KEY_F4, - /* 119 */ KEY_End, - /* 120 */ KEY_F2, - /* 121 */ KEY_PgDown, - /* 122 */ KEY_F1 -}; -#define WS_ADB_MAP_SIZE (sizeof(wsAdbMap)/sizeof(unsigned char)) - -static -TransMapRec wsAdb = { - 0, - WS_ADB_MAP_SIZE, - wsAdbMap -}; - -static CARD8 wsSunMap[] = { - /* 0x00 */ KEY_Help, - /* 0x01 */ KEY_L1, /* stop */ - /* 0x02 */ KEY_AudioLower, /* BrightnessDown / S-VolumeDown */ - /* 0x03 */ KEY_L2, /* again */ - /* 0x04 */ KEY_AudioRaise, /* BridgtnessUp / S-VolumeUp */ - /* 0x05 */ KEY_F1, - /* 0x06 */ KEY_F2, - /* 0x07 */ KEY_F10, - /* 0x08 */ KEY_F3, - /* 0x09 */ KEY_F11, - /* 0x0a */ KEY_F4, - /* 0x0b */ KEY_F12, - /* 0x0c */ KEY_F5, - /* 0x0d */ KEY_AltLang, - /* 0x0e */ KEY_F6, - /* 0x0f */ KEY_NOTUSED, - /* 0x10 */ KEY_F7, - /* 0x11 */ KEY_F8, - /* 0x12 */ KEY_F9, - /* 0x13 */ KEY_Alt, - /* 0x14 */ KEY_Up, - /* 0x15 */ KEY_Pause, - /* 0x16 */ KEY_Print, - /* 0x17 */ KEY_ScrollLock, - /* 0x18 */ KEY_Left, - /* 0x19 */ KEY_L3, /* props */ - /* 0x1a */ KEY_L4, /* undo */ - /* 0x1b */ KEY_Down, - /* 0x1c */ KEY_Right, - /* 0x1d */ KEY_Escape, - /* 0x1e */ KEY_1, - /* 0x1f */ KEY_2, - /* 0x20 */ KEY_3, - /* 0x21 */ KEY_4, - /* 0x22 */ KEY_5, - /* 0x23 */ KEY_6, - /* 0x24 */ KEY_7, - /* 0x25 */ KEY_8, - /* 0x26 */ KEY_9, - /* 0x27 */ KEY_0, - /* 0x28 */ KEY_Minus, - /* 0x29 */ KEY_Equal, - /* 0x2a */ KEY_Tilde, - /* 0x2b */ KEY_BackSpace, - /* 0x2c */ KEY_Insert, - /* 0x2d */ KEY_Mute, /* Audio Mute */ - /* 0x2e */ KEY_KP_Divide, - /* 0x2f */ KEY_KP_Multiply, - /* 0x30 */ KEY_NOTUSED, - /* 0x31 */ KEY_L5, /* front */ - /* 0x32 */ KEY_KP_Decimal, - /* 0x33 */ KEY_L6, /* copy */ - /* 0x34 */ KEY_Home, - /* 0x35 */ KEY_Tab, - /* 0x36 */ KEY_Q, - /* 0x37 */ KEY_W, - /* 0x38 */ KEY_E, - /* 0x39 */ KEY_R, - /* 0x3a */ KEY_T, - /* 0x3b */ KEY_Y, - /* 0x3c */ KEY_U, - /* 0x3d */ KEY_I, - /* 0x3e */ KEY_O, - /* 0x3f */ KEY_P, - /* 0x40 */ KEY_LBrace, - /* 0x41 */ KEY_RBrace, - /* 0x42 */ KEY_Delete, - /* 0x43 */ KEY_Menu, /* compose */ - /* 0x44 */ KEY_KP_7, - /* 0x45 */ KEY_KP_8, - /* 0x46 */ KEY_KP_9, - /* 0x47 */ KEY_KP_Minus, - /* 0x48 */ KEY_L7, /* open */ - /* 0x49 */ KEY_L8, /* paste */ - /* 0x4a */ KEY_End, - /* 0x4b */ KEY_NOTUSED, - /* 0x4c */ KEY_LCtrl, - /* 0x4d */ KEY_A, - /* 0x4e */ KEY_S, - /* 0x4f */ KEY_D, - /* 0x50 */ KEY_F, - /* 0x51 */ KEY_G, - /* 0x52 */ KEY_H, - /* 0x53 */ KEY_J, - /* 0x54 */ KEY_K, - /* 0x55 */ KEY_L, - /* 0x56 */ KEY_SemiColon, - /* 0x57 */ KEY_Quote, - /* 0x58 */ KEY_BSlash, - /* 0x59 */ KEY_Enter, - /* 0x5a */ KEY_KP_Enter, - /* 0x5b */ KEY_KP_4, - /* 0x5c */ KEY_KP_5, - /* 0x5d */ KEY_KP_6, - /* 0x5e */ KEY_KP_0, - /* 0x5f */ KEY_L9, /* find */ - /* 0x60 */ KEY_PgUp, - /* 0x61 */ KEY_L10, /* cut */ - /* 0x62 */ KEY_NumLock, - /* 0x63 */ KEY_ShiftL, - /* 0x64 */ KEY_Z, - /* 0x65 */ KEY_X, - /* 0x66 */ KEY_C, - /* 0x67 */ KEY_V, - /* 0x68 */ KEY_B, - /* 0x69 */ KEY_N, - /* 0x6a */ KEY_M, - /* 0x6b */ KEY_Comma, - /* 0x6c */ KEY_Period, - /* 0x6d */ KEY_Slash, - /* 0x6e */ KEY_ShiftR, - /* 0x6f */ KEY_NOTUSED, /* linefeed */ - /* 0x70 */ KEY_KP_1, - /* 0x71 */ KEY_KP_2, - /* 0x72 */ KEY_KP_3, - /* 0x73 */ KEY_NOTUSED, - /* 0x74 */ KEY_NOTUSED, - /* 0x75 */ KEY_NOTUSED, - /* 0x76 */ KEY_NOTUSED, /* help */ - /* 0x77 */ KEY_CapsLock, - /* 0x78 */ KEY_LMeta, - /* 0x79 */ KEY_Space, - /* 0x7a */ KEY_RMeta, - /* 0x7b */ KEY_PgDown, - /* 0x7c */ KEY_Less, /* < > on some keyboards */ - /* 0x7d */ KEY_KP_Plus, - /* 0x7e */ KEY_NOTUSED, - /* 0x7f */ KEY_NOTUSED -}; -#define WS_SUN_MAP_SIZE (sizeof(wsSunMap)/sizeof(unsigned char)) - -static -TransMapRec wsSun = { - 0, - WS_SUN_MAP_SIZE, - wsSunMap -}; - -#endif /* WSCONS_SUPPORT */ - -/*ARGSUSED*/ - -/* - * KbdGetMapping -- - * Get the national keyboard mapping. The keyboard type is set, a new map - * and the modifiermap is computed. - */ - -void -KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - KeySym *k; - int i; - -#ifndef __bsdi__ - switch (pKbd->consType) { - -#ifdef PCCONS_SUPPORT - case PCCONS: -#if defined(__OpenBSD__) - /* - * on OpenBSD, the pccons keymap is programmable, too - */ - { - pccons_keymap_t keymap[KB_NUM_KEYS]; - if (ioctl(pInfo->fd, CONSOLE_GET_KEYMAP, &keymap) != -1) { - for (i = 0; i < KB_NUM_KEYS; i++) - if (pccons_remap[i]) { - k = map + (pccons_remap[i] << 2); - switch (keymap[i].type) { - case KB_ASCII: - /* For ASCII keys, there is only one char in the keymap */ - k[0] = latin1_to_x[(unsigned char)keymap[i].unshift[0]]; - k[1] = latin1_to_x[(unsigned char)keymap[i].shift[0]]; - k[2] = latin1_to_x[(unsigned char)keymap[i].altgr[0]]; - k[3] = latin1_to_x[(unsigned char)keymap[i].shift_altgr[0]]; - break; - case KB_SCROLL: - k[0] = XK_Scroll_Lock; - goto special; - case KB_NUM: - k[0] = XK_Num_Lock; - goto special; - case KB_CAPS: - k[0] = XK_Caps_Lock; - goto special; - case KB_SHIFT: - switch (keymap[i].unshift[0]) { - case 1: - /* left shift */ - k[0] = XK_Shift_L; - break; - case 2: - /* right shift */ - k[0] = XK_Shift_R; - break; - default: - k[0] = NoSymbol; - } - goto special; - case KB_CTL: - k[0] = XK_Control_L; - goto special; - case KB_ALT: - k[0] = XK_Alt_L; - goto special; - case KB_FUNC: - switch (keymap[i].unshift[2]) { - case 'M': - k[0] = XK_F1; - break; - case 'N': - k[0] = XK_F2; - break; - case 'O': - k[0] = XK_F3; - break; - case 'P': - k[0] = XK_F4; - break; - case 'Q': - k[0] = XK_F5; - break; - case 'R': - k[0] = XK_F6; - break; - case 'S': - k[0] = XK_F7; - break; - case 'T': - k[0] = XK_F8; - break; - case 'U': - k[0] = XK_F9; - break; - case 'V': - k[0] = XK_F10; - break; - case 'W': - k[0] = XK_F11; - break; - case 'X': - k[0] = XK_F12; - break; - default: - k[0] = NoSymbol; - break; - } - goto special; - default: - k[0] = NoSymbol; - special: - k[1] = k[2] = k[3] = NoSymbol; - } - } - } else { - ErrorF("Can't read pccons keymap\n"); - } - } -#endif /* __OpenBSD__ */ - break; -#endif - -/* - * XXX wscons has no GIO_KEYMAP - */ -#if (defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)) && defined(GIO_KEYMAP) - case SYSCONS: - case PCVT: - { - keymap_t keymap; - - if (ioctl(pInfo->fd, GIO_KEYMAP, &keymap) != -1) { - for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++) - if (remap[i]) { - k = map + (remap[i] << 2); - k[0] = KD_GET_ENTRY(i,0); /* non-shifed */ - k[1] = KD_GET_ENTRY(i,1); /* shifted */ - k[2] = KD_GET_ENTRY(i,4); /* alt */ - k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */ - if (k[3] == k[2]) k[3] = NoSymbol; - if (k[2] == k[1]) k[2] = NoSymbol; - if (k[1] == k[0]) k[1] = NoSymbol; - if (k[0] == k[2] && k[1] == k[3]) - k[2] = k[3] = NoSymbol; - } - } - } - break; -#endif /* SYSCONS || PCVT */ - - } -#endif /* !bsdi */ - - /* - * compute the modifier map - */ - for (i = 0; i < MAP_LENGTH; i++) - pModMap[i] = NoSymbol; /* make sure it is restored */ - - for (k = map, i = MIN_KEYCODE; - i < (NUM_KEYCODES + MIN_KEYCODE); - i++, k += 4) - - switch(*k) { - - case XK_Shift_L: - case XK_Shift_R: - pModMap[i] = ShiftMask; - break; - - case XK_Control_L: - case XK_Control_R: - pModMap[i] = ControlMask; - break; - - case XK_Caps_Lock: - pModMap[i] = LockMask; - break; - - case XK_Alt_L: - case XK_Alt_R: - pModMap[i] = AltMask; - break; - - case XK_Num_Lock: - pModMap[i] = NumLockMask; - break; - - case XK_Scroll_Lock: - pModMap[i] = ScrollLockMask; - break; - - /* kana support */ - case XK_Kana_Lock: - case XK_Kana_Shift: - pModMap[i] = KanaMask; - break; - - /* alternate toggle for multinational support */ - case XK_Mode_switch: - pModMap[i] = AltLangMask; - break; - - } - - pKbd->kbdType = 0; - - pKeySyms->map = map; - pKeySyms->mapWidth = GLYPHS_PER_KEY; - pKeySyms->minKeyCode = MIN_KEYCODE; - pKeySyms->maxKeyCode = MAX_KEYCODE; - - switch(pKbd->consType) { -#ifdef SYSCONS_SUPPORT - case SYSCONS: - if (pKbd->CustomKeycodes) - pKbd->scancodeMap = &sysconsCODE; - else - pKbd->RemapScanCode = ATScancode; - break; -#endif -#if defined(PCCONS_SUPPORT) || defined (PCVT_SUPPORT) - case PCCONS: - case PCVT: - pKbd->RemapScanCode = ATScancode; - break; -#endif -#ifdef WSCONS_SUPPORT - case WSCONS: - if (!pKbd->isConsole) { - switch (pKbd->wsKbdType) { - case WSKBD_TYPE_PC_XT: - case WSKBD_TYPE_PC_AT: - pKbd->RemapScanCode = ATScancode; - break; - case WSKBD_TYPE_USB: - pKbd->scancodeMap = &wsUsb; - break; -#ifdef WSKBD_TYPE_ADB - case WSKBD_TYPE_ADB: - pKbd->scancodeMap = &wsAdb; - break; -#endif -#ifdef WSKBD_TYPE_SUN -#ifdef WSKBD_TYPE_SUN5 - case WSKBD_TYPE_SUN5: -#endif - case WSKBD_TYPE_SUN: - pKbd->scancodeMap = &wsSun; - break; -#endif - default: - ErrorF("Unknown wskbd type %d\n", pKbd->wsKbdType); - } - } else { - pKbd->RemapScanCode = ATScancode; - } - break; -#endif - } - return; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_VTsw.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_VTsw.c deleted file mode 100644 index d97782dc6..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_VTsw.c +++ /dev/null @@ -1,96 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_VTsw.c,v 3.5.4.3 1998/06/05 16:23:03 dawes Exp $ */ -/* - * Derived from VTsw_usl.c which is - * Copyright 1993 by David Wexelblat - * by S_ren Schmidt (sos@login.dkuug.dk) - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of David Wexelblat not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. David Wexelblat makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: bsd_VTsw.c /main/4 1996/02/21 17:50:57 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -/* - * Handle the VT-switching interface for OSs that use USL-style ioctl()s - * (the bsd, sysv, sco, and linux subdirs). - */ - -/* - * This function is the signal handler for the VT-switching signal. It - * is only referenced inside the OS-support layer. - */ -void -xf86VTRequest(int sig) -{ -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) { - xf86Info.vtRequestsPending = TRUE; - } -#endif - return; -} - -Bool -xf86VTSwitchPending() -{ -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) { - return(xf86Info.vtRequestsPending ? TRUE : FALSE); - } -#endif - return FALSE; -} - -Bool -xf86VTSwitchAway() -{ -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) { - xf86Info.vtRequestsPending = FALSE; - if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0) - return(FALSE); - else - return(TRUE); - } -#endif - return FALSE; -} - -Bool -xf86VTSwitchTo() -{ -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) { - xf86Info.vtRequestsPending = FALSE; - if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) - return(FALSE); - else - return(TRUE); - } -#endif - return(TRUE); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_apm.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_apm.c deleted file mode 100644 index c8e204307..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_apm.c +++ /dev/null @@ -1,141 +0,0 @@ -/* $XFree86$ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" -#define XF86_OS_PRIVS -#include "xf86_OSproc.h" -#include "xf86_OSlib.h" - -#include - -#define APM_DEVICE "/dev/apm" - -static pointer APMihPtr = NULL; -static void bsdCloseAPM(void); - -static struct { - u_int apmBsd; - pmEvent xf86; -} bsdToXF86Array [] = { - { APM_STANDBY_REQ, XF86_APM_SYS_STANDBY }, - { APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND }, - { APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME }, - { APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME }, - { APM_BATTERY_LOW, XF86_APM_LOW_BATTERY }, - { APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE }, - { APM_UPDATE_TIME, XF86_APM_UPDATE_TIME }, - { APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND }, - { APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY }, - { APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND }, - { APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME }, -#ifdef APM_CAPABILITY_CHANGE - { APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED }, -#endif -}; - -#define numApmEvents (sizeof(bsdToXF86Array) / sizeof(bsdToXF86Array[0])) - -static pmEvent -bsdToXF86(int type) -{ - int i; - - for (i = 0; i < numApmEvents; i++) { - if (type == bsdToXF86Array[i].apmBsd) { - return bsdToXF86Array[i].xf86; - } - } - return XF86_APM_UNKNOWN; -} - -/* - * APM events can be requested direclty from /dev/apm - */ -static int -bsdPMGetEventFromOS(int fd, pmEvent *events, int num) -{ - struct apm_event_info bsdEvent; - int i; - - for (i = 0; i < num; i++) { - - if (ioctl(fd, APM_IOC_NEXTEVENT, &bsdEvent) < 0) { - if (errno != EAGAIN) { - xf86Msg(X_WARNING, "bsdPMGetEventFromOS: APM_IOC_NEXTEVENT" - " errno = %d\n", errno); - } - break; - } - events[i] = bsdToXF86(bsdEvent.type); - } - return i; -} - -/* - * XXX This won't work on /dev/apm ! - * We should either use /dev/apm_ctl (and kill apmd(8)) - * or talk to apmd (but its protocol is not publically available)... - */ -static pmWait -bsdPMConfirmEventToOs(int fd, pmEvent event) -{ - switch (event) { - case XF86_APM_SYS_STANDBY: - case XF86_APM_USER_STANDBY: - if (ioctl( fd, APM_IOC_STANDBY, NULL ) == 0) - return PM_WAIT; /* should we stop the Xserver in standby, too? */ - else - return PM_NONE; - case XF86_APM_SYS_SUSPEND: - case XF86_APM_CRITICAL_SUSPEND: - case XF86_APM_USER_SUSPEND: - if (ioctl( fd, APM_IOC_SUSPEND, NULL ) == 0) - return PM_WAIT; - else - return PM_NONE; - 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; - default: - return PM_NONE; - } -} - -PMClose -xf86OSPMOpen(void) -{ - int fd; - - if (APMihPtr || !xf86Info.pmFlag) { - return NULL; - } - - if ((fd = open(APM_DEVICE, O_RDWR)) == -1) { - return NULL; - } - xf86PMGetEventFromOs = bsdPMGetEventFromOS; - xf86PMConfirmEventToOs = bsdPMConfirmEventToOs; - APMihPtr = xf86AddInputHandler(fd, xf86HandlePMEvents, NULL); - return bsdCloseAPM; -} - -static void -bsdCloseAPM(void) -{ - int fd; - - if (APMihPtr) { - fd = xf86RemoveInputHandler(APMihPtr); - close(fd); - APMihPtr = NULL; - } -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c deleted file mode 100644 index 00b928a5e..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c +++ /dev/null @@ -1,73 +0,0 @@ -/* $XFree86: bsd_axp.c,v 1.2 2002/10/29 23:19:13 herrb Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Axp.h" -#include -#include "xf86_OSlib.h" -#include -#include - -axpDevice bsdGetAXP(void); - -/* - * BSD does a very nice job providing system information to - * user space programs. Unfortunately it doesn't provide all - * the information required. Therefore we just obtain the - * system type and look up the rest from a list we maintain - * ourselves. - */ - -typedef struct { - char *name; - int type; -} _AXP; - -static _AXP axpList[] = { - {"apecs",APECS}, - {"pyxis",PYXIS}, - {"cia",CIA}, - {"irongate",IRONGATE}, - {"lca",LCA}, - {"t2",T2}, - {"tsunami",TSUNAMI}, - {NULL,NONE} -}; - -axpDevice -bsdGetAXP(void) -{ - int i; - char sysname[64]; - size_t len = sizeof(sysname); - -#ifdef __OpenBSD__ - int mib[3]; - int error; - - mib[0] = CTL_MACHDEP; - mib[1] = CPU_CHIPSET; - mib[2] = CPU_CHIPSET_TYPE; - - if ((error = sysctl(mib, 3, &sysname, &len, NULL, 0)) < 0) -#else - if ((sysctlbyname("hw.chipset.type", &sysname, &len, - 0, 0)) < 0) -#endif - FatalError("bsdGetAXP: can't find machine type\n"); -#ifdef DEBUG - xf86Msg(X_INFO,"AXP is a: %s\n",sysname); -#endif - for (i=0;;i++) { - if (axpList[i].name == NULL) - return NONE; - if (!strcmp(sysname, axpList[i].name)) - return axpList[i].type; - } -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c deleted file mode 100644 index 62952a343..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c +++ /dev/null @@ -1,91 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c,v 1.1 2000/03/05 16:59:17 dawes Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "input.h" -#include "scrnintstr.h" -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86OSpriv.h" - -int readDense8(pointer Base, register unsigned long Offset); -int readDense16(pointer Base, register unsigned long Offset); -int readDense32(pointer Base, register unsigned long Offset); -void -writeDenseNB8(int Value, pointer Base, register unsigned long Offset); -void -writeDenseNB16(int Value, pointer Base, register unsigned long Offset); -void -writeDenseNB32(int Value, pointer Base, register unsigned long Offset); -void -writeDense8(int Value, pointer Base, register unsigned long Offset); -void -writeDense16(int Value, pointer Base, register unsigned long Offset); -void -writeDense32(int Value, pointer Base, register unsigned long Offset); - -int -readDense8(pointer Base, register unsigned long Offset) -{ - mem_barrier(); - return *(volatile CARD8*) ((unsigned long)Base+(Offset)); -} - -int -readDense16(pointer Base, register unsigned long Offset) -{ - mem_barrier(); - return *(volatile CARD16*) ((unsigned long)Base+(Offset)); -} - -int -readDense32(pointer Base, register unsigned long Offset) -{ - mem_barrier(); - return *(volatile CARD32*)((unsigned long)Base+(Offset)); -} - -void -writeDenseNB8(int Value, pointer Base, register unsigned long Offset) -{ - *(volatile CARD8*)((unsigned long)Base+(Offset)) = Value; -} - -void -writeDenseNB16(int Value, pointer Base, register unsigned long Offset) -{ - *(volatile CARD16*)((unsigned long)Base + (Offset)) = Value; -} - -void -writeDenseNB32(int Value, pointer Base, register unsigned long Offset) -{ - *(volatile CARD32*)((unsigned long)Base+(Offset)) = Value; -} - -void -writeDense8(int Value, pointer Base, register unsigned long Offset) -{ - write_mem_barrier(); - *(volatile CARD8 *)((unsigned long)Base+(Offset)) = Value; -} - -void -writeDense16(int Value, pointer Base, register unsigned long Offset) -{ - write_mem_barrier(); - *(volatile CARD16 *)((unsigned long)Base+(Offset)) = Value; -} - -void -writeDense32(int Value, pointer Base, register unsigned long Offset) -{ - write_mem_barrier(); - *(volatile CARD32 *)((unsigned long)Base+(Offset)) = Value; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c deleted file mode 100644 index 4d883a2be..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c +++ /dev/null @@ -1,738 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c,v 3.21 2003/09/24 02:43:34 dawes Exp $ */ -/* - * Copyright 1992 by Rich Murphey - * Copyright 1993 by David Wexelblat - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Rich Murphey and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Rich Murphey and - * David Wexelblat make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: bsd_init.c /main/8 1996/10/23 13:13:05 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#include -#include -#include -#include - -static Bool KeepTty = FALSE; -static int devConsoleFd = -1; -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) -static int VTnum = -1; -static int initialVT = -1; -#endif - -#ifdef PCCONS_SUPPORT -/* Stock 0.1 386bsd pccons console driver interface */ -#ifndef __OpenBSD__ -# define PCCONS_CONSOLE_DEV1 "/dev/ttyv0" -#else -# define PCCONS_CONSOLE_DEV1 "/dev/ttyC0" -#endif -#define PCCONS_CONSOLE_DEV2 "/dev/vga" -#define PCCONS_CONSOLE_MODE O_RDWR|O_NDELAY -#endif - -#ifdef SYSCONS_SUPPORT -/* The FreeBSD 1.1 version syscons driver uses /dev/ttyv0 */ -#define SYSCONS_CONSOLE_DEV1 "/dev/ttyv0" -#define SYSCONS_CONSOLE_DEV2 "/dev/vga" -#define SYSCONS_CONSOLE_MODE O_RDWR|O_NDELAY -#endif - -#ifdef PCVT_SUPPORT -/* Hellmuth Michaelis' pcvt driver */ -#ifndef __OpenBSD__ -# define PCVT_CONSOLE_DEV "/dev/ttyv0" -#else -# define PCVT_CONSOLE_DEV "/dev/ttyC0" -#endif -#define PCVT_CONSOLE_MODE O_RDWR|O_NDELAY -#endif - -#if defined(WSCONS_SUPPORT) && defined(__NetBSD__) -/* NetBSD's new console driver */ -#define WSCONS_PCVT_COMPAT_CONSOLE_DEV "/dev/ttyE0" -#endif - -#ifdef __GLIBC__ -#define setpgrp setpgid -#endif - -#define CHECK_DRIVER_MSG \ - "Check your kernel's console driver configuration and /dev entries" - -static char *supported_drivers[] = { -#ifdef PCCONS_SUPPORT - "pccons (with X support)", -#endif -#ifdef SYSCONS_SUPPORT - "syscons", -#endif -#ifdef PCVT_SUPPORT - "pcvt", -#endif -#ifdef WSCONS_SUPPORT - "wscons", -#endif -}; - - -/* - * Functions to probe for the existance of a supported console driver. - * Any function returns either a valid file descriptor (driver probed - * succesfully), -1 (driver not found), or uses FatalError() if the - * driver was found but proved to not support the required mode to run - * an X server. - */ - -typedef int (*xf86ConsOpen_t)(void); - -#ifdef PCCONS_SUPPORT -static int xf86OpenPccons(void); -#endif /* PCCONS_SUPPORT */ - -#ifdef SYSCONS_SUPPORT -static int xf86OpenSyscons(void); -#endif /* SYSCONS_SUPPORT */ - -#ifdef PCVT_SUPPORT -static int xf86OpenPcvt(void); -#endif /* PCVT_SUPPORT */ - -#ifdef WSCONS_SUPPORT -static int xf86OpenWScons(void); -#endif - -/* - * The sequence of the driver probes is important; start with the - * driver that is best distinguishable, and end with the most generic - * driver. (Otherwise, pcvt would also probe as syscons, and either - * pcvt or syscons might succesfully probe as pccons.) - */ -static xf86ConsOpen_t xf86ConsTab[] = { -#ifdef PCVT_SUPPORT - xf86OpenPcvt, -#endif -#ifdef SYSCONS_SUPPORT - xf86OpenSyscons, -#endif -#ifdef PCCONS_SUPPORT - xf86OpenPccons, -#endif -#ifdef WSCONS_SUPPORT - xf86OpenWScons, -#endif - (xf86ConsOpen_t)NULL -}; - - -void -xf86OpenConsole() -{ - int i, fd = -1; - xf86ConsOpen_t *driver; -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - int result; - struct utsname uts; - vtmode_t vtmode; -#endif - - if (serverGeneration == 1) - { - /* check if we are run with euid==0 */ - if (geteuid() != 0) - { - FatalError("xf86OpenConsole: Server must be suid root"); - } - - if (!KeepTty) - { - /* - * detaching the controlling tty solves problems of kbd character - * loss. This is not interesting for CO driver, because it is - * exclusive. - */ - setpgrp(0, getpid()); - if ((i = open("/dev/tty",O_RDWR)) >= 0) - { - ioctl(i,TIOCNOTTY,(char *)0); - close(i); - } - } - - /* detect which driver we are running on */ - for (driver = xf86ConsTab; *driver; driver++) - { - if ((fd = (*driver)()) >= 0) - break; - } - - /* Check that a supported console driver was found */ - if (fd < 0) - { - char cons_drivers[80] = {0, }; - for (i = 0; i < sizeof(supported_drivers) / sizeof(char *); i++) - { - if (i) - { - strcat(cons_drivers, ", "); - } - strcat(cons_drivers, supported_drivers[i]); - } - FatalError( - "%s: No console driver found\n\tSupported drivers: %s\n\t%s", - "xf86OpenConsole", cons_drivers, CHECK_DRIVER_MSG); - } -#if 0 /* stdin is already closed in OsInit() */ - fclose(stdin); -#endif - xf86Info.consoleFd = fd; - xf86Info.screenFd = fd; - - switch (xf86Info.consType) - { -#ifdef PCCONS_SUPPORT - case PCCONS: - if (ioctl (xf86Info.consoleFd, CONSOLE_X_MODE_ON, 0) < 0) - { - FatalError("%s: CONSOLE_X_MODE_ON failed (%s)\n%s", - "xf86OpenConsole", strerror(errno), - CHECK_DRIVER_MSG); - } - /* - * Hack to prevent keyboard hanging when syslogd closes - * /dev/console - */ - if ((devConsoleFd = open("/dev/console", O_WRONLY,0)) < 0) - { - xf86Msg(X_WARNING, - "xf86OpenConsole: couldn't open /dev/console (%s)\n", - strerror(errno)); - } - break; -#endif -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - case SYSCONS: - /* as of FreeBSD 2.2.8, syscons driver does not need the #1 vt - * switching anymore. Here we check for FreeBSD 3.1 and up. - * Add cases for other *BSD that behave the same. - */ -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - uname (&uts); - i = atof(uts.release) * 100; - if (i >= 310) goto acquire_vt; -#endif - /* otherwise fall through */ - case PCVT: - /* - * First activate the #1 VT. This is a hack to allow a server - * to be started while another one is active. There should be - * a better way. - */ - if (initialVT != 1) { - - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) != 0) - { - xf86Msg(X_WARNING, - "xf86OpenConsole: VT_ACTIVATE failed\n"); - } - sleep(1); - } - -acquire_vt: - /* - * now get the VT - */ - SYSCALL(result = - ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno)); - if (result != 0) - { - xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); - } - SYSCALL(result = - ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno)); - if (result != 0) - { - xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n"); - } - - signal(SIGUSR1, xf86VTRequest); - - vtmode.mode = VT_PROCESS; - vtmode.relsig = SIGUSR1; - vtmode.acqsig = SIGUSR1; - vtmode.frsig = SIGUSR1; - if (ioctl(xf86Info.consoleFd, VT_SETMODE, &vtmode) < 0) - { - FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed"); - } -#if !defined(USE_DEV_IO) && !defined(USE_I386_IOPL) - if (ioctl(xf86Info.consoleFd, KDENABIO, 0) < 0) - { - FatalError("xf86OpenConsole: KDENABIO failed (%s)", - strerror(errno)); - } -#endif - if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) - { - FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed"); - } - break; -#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ -#ifdef WSCONS_SUPPORT - case WSCONS: - fprintf(stderr, "xf86OpenConsole\n"); - /* xf86Info.consoleFd = open("/dev/wskbd0", 0); */ - break; -#endif - } - } - else - { - /* serverGeneration != 1 */ -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) - { - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) - { - xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); - } - } -#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ - } - return; -} - - -#ifdef PCCONS_SUPPORT - -static int -xf86OpenPccons() -{ - int fd = -1; - - if ((fd = open(PCCONS_CONSOLE_DEV1, PCCONS_CONSOLE_MODE, 0)) - >= 0 || - (fd = open(PCCONS_CONSOLE_DEV2, PCCONS_CONSOLE_MODE, 0)) - >= 0) - { - if (ioctl(fd, CONSOLE_X_MODE_OFF, 0) < 0) - { - FatalError( - "%s: CONSOLE_X_MODE_OFF failed (%s)\n%s\n%s", - "xf86OpenPccons", - strerror(errno), - "Was expecting pccons driver with X support", - CHECK_DRIVER_MSG); - } - xf86Info.consType = PCCONS; - xf86Msg(X_PROBED, "Using pccons driver with X support\n"); - } - return fd; -} - -#endif /* PCCONS_SUPPORT */ - -#ifdef SYSCONS_SUPPORT - -static int -xf86OpenSyscons() -{ - int fd = -1; - vtmode_t vtmode; - char vtname[12]; - struct stat status; - long syscons_version; - MessageType from; - - /* Check for syscons */ - if ((fd = open(SYSCONS_CONSOLE_DEV1, SYSCONS_CONSOLE_MODE, 0)) >= 0 - || (fd = open(SYSCONS_CONSOLE_DEV2, SYSCONS_CONSOLE_MODE, 0)) >= 0) - { - if (ioctl(fd, VT_GETMODE, &vtmode) >= 0) - { - /* Get syscons version */ - if (ioctl(fd, CONS_GETVERS, &syscons_version) < 0) - { - syscons_version = 0; - } - - xf86Info.vtno = VTnum; - from = X_CMDLINE; - -#ifdef VT_GETACTIVE - if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0) - initialVT = -1; -#endif - if (xf86Info.vtno == -1) - { - /* - * For old syscons versions (<0x100), VT_OPENQRY returns - * the current VT rather than the next free VT. In this - * case, the server gets started on the current VT instead - * of the next free VT. - */ - -#if 0 - /* check for the fixed VT_OPENQRY */ - if (syscons_version >= 0x100) - { -#endif - if (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) - { - /* No free VTs */ - xf86Info.vtno = -1; - } -#if 0 - } -#endif - - if (xf86Info.vtno == -1) - { - /* - * All VTs are in use. If initialVT was found, use it. - * Otherwise, if stdin is a VT, use that one. - * XXX stdin is already closed, so this won't work. - */ - if (initialVT != -1) - { - xf86Info.vtno = initialVT; - } - else if ((fstat(0, &status) >= 0) - && S_ISCHR(status.st_mode) - && (ioctl(0, VT_GETMODE, &vtmode) >= 0)) - { - /* stdin is a VT */ - xf86Info.vtno = minor(status.st_rdev) + 1; - } - else - { - if (syscons_version >= 0x100) - { - FatalError("%s: Cannot find a free VT", - "xf86OpenSyscons"); - } - /* Should no longer reach here */ - FatalError("%s: %s %s\n\t%s %s", - "xf86OpenSyscons", - "syscons versions prior to 1.0 require", - "either the", - "server's stdin be a VT", - "or the use of the vtxx server option"); - } - } - from = X_PROBED; - } - - close(fd); -#ifndef __OpenBSD__ - sprintf(vtname, "/dev/ttyv%01x", xf86Info.vtno - 1); -#else - sprintf(vtname, "/dev/ttyC%01x", xf86Info.vtno - 1); -#endif - if ((fd = open(vtname, SYSCONS_CONSOLE_MODE, 0)) < 0) - { - FatalError("xf86OpenSyscons: Cannot open %s (%s)", - vtname, strerror(errno)); - } - if (ioctl(fd, VT_GETMODE, &vtmode) < 0) - { - FatalError("xf86OpenSyscons: VT_GETMODE failed"); - } - xf86Info.consType = SYSCONS; - xf86Msg(X_PROBED, "Using syscons driver with X support"); - if (syscons_version >= 0x100) - { - xf86ErrorF(" (version %ld.%ld)\n", syscons_version >> 8, - syscons_version & 0xFF); - } - else - { - xf86ErrorF(" (version 0.x)\n"); - } - xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno); - } - else - { - /* VT_GETMODE failed, probably not syscons */ - close(fd); - fd = -1; - } - } - return fd; -} - -#endif /* SYSCONS_SUPPORT */ - - -#ifdef PCVT_SUPPORT - -static int -xf86OpenPcvt() -{ - /* This looks much like syscons, since pcvt is API compatible */ - int fd = -1; - vtmode_t vtmode; - char vtname[12], *vtprefix; - struct stat status; - struct pcvtid pcvt_version; - -#ifndef __OpenBSD__ - vtprefix = "/dev/ttyv"; -#else - vtprefix = "/dev/ttyC"; -#endif - - fd = open(PCVT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0); -#ifdef WSCONS_PCVT_COMPAT_CONSOLE_DEV - if (fd < 0) - { - fd = open(WSCONS_PCVT_COMPAT_CONSOLE_DEV, PCVT_CONSOLE_MODE, 0); - vtprefix = "/dev/ttyE"; - } -#endif - if (fd >= 0) - { - if (ioctl(fd, VGAPCVTID, &pcvt_version) >= 0) - { - if(ioctl(fd, VT_GETMODE, &vtmode) < 0) - { - FatalError("%s: VT_GETMODE failed\n%s%s\n%s", - "xf86OpenPcvt", - "Found pcvt driver but X11 seems to be", - " not supported.", CHECK_DRIVER_MSG); - } - - xf86Info.vtno = VTnum; - - if (ioctl(fd, VT_GETACTIVE, &initialVT) < 0) - initialVT = -1; - - if (xf86Info.vtno == -1) - { - if (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) - { - /* No free VTs */ - xf86Info.vtno = -1; - } - - if (xf86Info.vtno == -1) - { - /* - * All VTs are in use. If initialVT was found, use it. - * Otherwise, if stdin is a VT, use that one. - * XXX stdin is already closed, so this won't work. - */ - if (initialVT != -1) - { - xf86Info.vtno = initialVT; - } - else if ((fstat(0, &status) >= 0) - && S_ISCHR(status.st_mode) - && (ioctl(0, VT_GETMODE, &vtmode) >= 0)) - { - /* stdin is a VT */ - xf86Info.vtno = minor(status.st_rdev) + 1; - } - else - { - FatalError("%s: Cannot find a free VT", - "xf86OpenPcvt"); - } - } - } - - close(fd); - sprintf(vtname, "%s%01x", vtprefix, xf86Info.vtno - 1); - if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) - { - FatalError("xf86OpenPcvt: Cannot open %s (%s)", - vtname, strerror(errno)); - } - if (ioctl(fd, VT_GETMODE, &vtmode) < 0) - { - FatalError("xf86OpenPcvt: VT_GETMODE failed"); - } - xf86Info.consType = PCVT; -#ifdef WSCONS_SUPPORT - xf86Msg(X_PROBED, - "Using wscons driver in pcvt compatibility mode " - "(version %d.%d)\n", - pcvt_version.rmajor, pcvt_version.rminor); -#else - xf86Msg(X_PROBED, "Using pcvt driver (version %d.%d)\n", - pcvt_version.rmajor, pcvt_version.rminor); -#endif - } - else - { - /* Not pcvt */ - close(fd); - fd = -1; - } - } - return fd; -} - -#endif /* PCVT_SUPPORT */ - -#ifdef WSCONS_SUPPORT - -static int -xf86OpenWScons() -{ - int fd = -1; - int mode = WSDISPLAYIO_MODE_MAPPED; - int i; - char ttyname[16]; - - /* XXX Is this ok? */ - for (i = 0; i < 8; i++) { -#if defined(__NetBSD__) - sprintf(ttyname, "/dev/ttyE%d", i); -#elif defined(__OpenBSD__) - sprintf(ttyname, "/dev/ttyC%d", i); -#endif - if ((fd = open(ttyname, 2)) != -1) - break; - } - if (fd != -1) { - if (ioctl(fd, WSDISPLAYIO_SMODE, &mode) < 0) { - FatalError("%s: WSDISPLAYIO_MODE_MAPPED failed (%s)\n%s", - "xf86OpenConsole", strerror(errno), - CHECK_DRIVER_MSG); - } - xf86Info.consType = WSCONS; - xf86Msg(X_PROBED, "Using wscons driver\n"); - } - return fd; -} - -#endif /* WSCONS_SUPPORT */ - -void -xf86CloseConsole() -{ -#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) - struct vt_mode VT; -#endif - - switch (xf86Info.consType) - { -#ifdef PCCONS_SUPPORT - case PCCONS: - ioctl (xf86Info.consoleFd, CONSOLE_X_MODE_OFF, 0); - break; -#endif /* PCCONS_SUPPORT */ -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - case SYSCONS: - case PCVT: - ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); /* Back to text mode */ - if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) - { - VT.mode = VT_AUTO; - ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */ - } -#if !defined(USE_DEV_IO) && !defined(USE_I386_IOPL) - if (ioctl(xf86Info.consoleFd, KDDISABIO, 0) < 0) - { - xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)", - strerror(errno)); - } -#endif - if (initialVT != -1) - ioctl(xf86Info.consoleFd, VT_ACTIVATE, initialVT); - break; -#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ -#ifdef WSCONS_SUPPORT - case WSCONS: - { - int mode = WSDISPLAYIO_MODE_EMUL; - ioctl(xf86Info.screenFd, WSDISPLAYIO_SMODE, &mode); - break; - } -#endif - } - - if (xf86Info.screenFd != xf86Info.consoleFd) - { - close(xf86Info.screenFd); - close(xf86Info.consoleFd); - if ((xf86Info.consoleFd = open("/dev/console",O_RDONLY,0)) <0) - { - xf86FatalError("xf86CloseConsole: Cannot open /dev/console (%s)", - strerror(errno)); - } - } - close(xf86Info.consoleFd); - if (devConsoleFd >= 0) - close(devConsoleFd); - return; -} - -int -xf86ProcessArgument(int argc, char *argv[], int i) -{ - /* - * Keep server from detaching from controlling tty. This is useful - * when debugging (so the server can receive keyboard signals. - */ - if (!strcmp(argv[i], "-keeptty")) - { - KeepTty = TRUE; - return(1); - } -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - if ((argv[i][0] == 'v') && (argv[i][1] == 't')) - { - if (sscanf(argv[i], "vt%2d", &VTnum) == 0 || - VTnum < 1 || VTnum > 12) - { - UseMsg(); - VTnum = -1; - return(0); - } - return(1); - } -#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ - return(0); -} - -void -xf86UseMsg() -{ -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - ErrorF("vtXX use the specified VT number (1-12)\n"); -#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ - ErrorF("-keeptty "); - ErrorF("don't detach controlling tty (for debugging only)\n"); - return; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c deleted file mode 100644 index 3b1f58889..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c +++ /dev/null @@ -1,294 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_io.c,v 3.22 2002/05/18 21:15:16 herrb Exp $ */ -/* - * Copyright 1992 by Rich Murphey - * Copyright 1993 by David Dawes - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Rich Murphey and David Dawes - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Rich Murphey and - * David Dawes make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * RICH MURPHEY AND DAVID DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID DAWES BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: bsd_io.c /main/11 1996/10/19 18:06:07 kaleb $ */ - -#define NEED_EVENTS -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#ifdef WSCONS_SUPPORT -#define KBD_FD(i) ((i).kbdFd != -1 ? (i).kbdFd : (i).consoleFd) -#endif - -void -xf86SoundKbdBell(int loudness, int pitch, int duration) -{ -#ifdef WSCONS_SUPPORT - struct wskbd_bell_data wsb; -#endif - - if (loudness && pitch) - { -#ifdef PCCONS_SUPPORT - int data[2]; -#endif - - switch (xf86Info.consType) { - -#ifdef PCCONS_SUPPORT - case PCCONS: - data[0] = pitch; - data[1] = (duration * loudness) / 50; - ioctl(xf86Info.consoleFd, CONSOLE_X_BELL, data); - break; -#endif -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - case SYSCONS: - case PCVT: - ioctl(xf86Info.consoleFd, KDMKTONE, - ((1193190 / pitch) & 0xffff) | - (((unsigned long)duration*loudness/50)<<16)); - break; -#endif -#if defined (WSCONS_SUPPORT) - case WSCONS: - wsb.which = WSKBD_BELL_DOALL; - wsb.pitch = pitch; - wsb.period = duration; - wsb.volume = loudness; - ioctl(KBD_FD(xf86Info), WSKBDIO_COMPLEXBELL, - &wsb); - break; -#endif - } - } -} - -void -xf86SetKbdLeds(int leds) -{ - switch (xf86Info.consType) { - - case PCCONS: - break; -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - case SYSCONS: - case PCVT: - ioctl(xf86Info.consoleFd, KDSETLED, leds); - break; -#endif -#if defined(WSCONS_SUPPORT) - case WSCONS: - ioctl(KBD_FD(xf86Info), WSKBDIO_SETLEDS, &leds); - break; -#endif - } -} - -int -xf86GetKbdLeds() -{ - int leds = 0; - - switch (xf86Info.consType) { - - case PCCONS: - break; -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - case SYSCONS: - case PCVT: - ioctl(xf86Info.consoleFd, KDGETLED, &leds); - break; -#endif -#if defined(WSCONS_SUPPORT) - case WSCONS: - ioctl(KBD_FD(xf86Info), WSKBDIO_GETLEDS, &leds); - break; -#endif - } - return(leds); -} - -void -xf86SetKbdRepeat(char rad) -{ - switch (xf86Info.consType) { - - case PCCONS: - break; -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - case SYSCONS: - case PCVT: - ioctl(xf86Info.consoleFd, KDSETRAD, rad); - break; -#endif - } -} - -#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) -static struct termios kbdtty; -#endif - -void -xf86KbdInit() -{ - switch (xf86Info.consType) { - -#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - case PCCONS: - case SYSCONS: - case PCVT: - tcgetattr(xf86Info.consoleFd, &kbdtty); - break; -#endif -#if defined WSCONS_SUPPORT - case WSCONS: - if (xf86Info.kbdFd != -1) - xf86FlushInput(xf86Info.kbdFd); - else - tcgetattr(xf86Info.consoleFd, &kbdtty); - break; -#endif - } -} - -int -xf86KbdOn() -{ - struct termios nTty; -#ifdef WSCONS_SUPPORT - int option; -#endif - - - switch (xf86Info.consType) { - -#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) - case SYSCONS: - case PCCONS: - case PCVT: - nTty = kbdtty; - nTty.c_iflag = IGNPAR | IGNBRK; - nTty.c_oflag = 0; - nTty.c_cflag = CREAD | CS8; - nTty.c_lflag = 0; - nTty.c_cc[VTIME] = 0; - nTty.c_cc[VMIN] = 1; - cfsetispeed(&nTty, 9600); - cfsetospeed(&nTty, 9600); - tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty); - -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW); -#endif - break; -#endif -#ifdef WSCONS_SUPPORT - case WSCONS: - if (xf86Info.kbdFd == -1) { - nTty = kbdtty; - nTty.c_iflag = IGNPAR | IGNBRK; - nTty.c_oflag = 0; - nTty.c_cflag = CREAD | CS8; - nTty.c_lflag = 0; - nTty.c_cc[VTIME] = 0; - nTty.c_cc[VMIN] = 1; - cfsetispeed(&nTty, 9600); - cfsetospeed(&nTty, 9600); - tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty); - option = WSKBD_RAW; - if (ioctl(xf86Info.consoleFd, WSKBDIO_SETMODE, - &option) == -1) - FatalError("can't switch keyboard to raw mode. " - "Enable support for it in the kernel\n" - "or use for example:\n\n" - "Option \"Protocol\" \"wskbd\"\n" - "Option \"Device\" \"/dev/wskbd0\"\n" - "\nin your XF86Config(5) file\n"); - } else { - return xf86Info.kbdFd; - } -#endif - } - return(xf86Info.consoleFd); -} - -int -xf86KbdOff() -{ -#ifdef WSCONS_SUPPORT - int option; -#endif - - switch (xf86Info.consType) { - -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - case SYSCONS: - case PCVT: - ioctl(xf86Info.consoleFd, KDSKBMODE, K_XLATE); - /* FALL THROUGH */ -#endif -#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) - case PCCONS: - tcsetattr(xf86Info.consoleFd, TCSANOW, &kbdtty); - break; -#endif -#ifdef WSCONS_SUPPORT - case WSCONS: - if (xf86Info.kbdFd != -1) { - return xf86Info.kbdFd; - } else { - option = WSKBD_TRANSLATED; - ioctl(xf86Info.consoleFd, WSKBDIO_SETMODE, &option); - tcsetattr(xf86Info.consoleFd, TCSANOW, &kbdtty); - } - break; -#endif - } - return(xf86Info.consoleFd); -} - -#ifdef WSCONS_SUPPORT - -#define NUMEVENTS 64 - -void -xf86WSKbdEvents(void) -{ - static struct wscons_event events[NUMEVENTS]; - int n, i; - - n = read(xf86Info.kbdFd, events, sizeof events); - if (n <= 0) - return; - n /= sizeof(struct wscons_event); - for (i = 0; i < n; i++) - xf86PostWSKbdEvent(&events[i]); -} - -#endif /* WSCONS_SUPPORT */ - - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_jstk.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_jstk.c deleted file mode 100644 index 00f457b88..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_jstk.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright 1995 by Frederic Lepied, France. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Frederic Lepied not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Frederic Lepied makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ - -/* Modified for FreeBSD by David Dawes */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_jstk.c,v 3.7 1998/07/25 16:56:34 dawes Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include - -#ifdef XFree86LOADER -#include "misc.h" -#include "xf86_libc.h" -#endif -#include "xf86.h" - -#define JS_RETURN sizeof(struct joystick) - -/*********************************************************************** - * - * xf86JoystickOn -- - * - * open the device and init timeout according to the device value. - * - *********************************************************************** - */ - -int -xf86JoystickOn(char * name, int *timeout, int *centerX, int *centerY) -{ - int status; - int changed = 0; - int timeinmicros; - struct joystick js; - -#ifdef DEBUG - ErrorF("xf86JoystickOn: %s\n", name); -#endif - - if ((status = open(name, O_RDWR | O_NDELAY, 0)) < 0) - { - xf86Msg(X_WARNING, "xf86JoystickOn: Cannot open joystick '%s' (%s)\n", - name, strerror(errno)); - return -1; - } - - if (*timeout <= 0) { - /* Use the current setting */ - ioctl(status, JOY_GETTIMEOUT, (char *)&timeinmicros); - *timeout = timeinmicros / 1000; - if (*timeout == 0) - *timeout = 1; - changed = 1; - } - /* Maximum allowed timeout in the FreeBSD driver is 10ms */ - if (*timeout > 10) { - *timeout = 10; - changed = 1; - } - - if (changed) - xf86Msg(X_PROBED, "Joystick: timeout value = %d\n", *timeout); - - timeinmicros = *timeout * 1000; - - /* Assume the joystick is centred when this is called */ - read(status, &js, JS_RETURN); - if (*centerX < 0) { - *centerX = js.x; - xf86Msg(X_PROBED, "Joystick: CenterX set to %d\n", *centerX); - } - if (*centerY < 0) { - *centerY = js.y; - xf86Msg(X_PROBED, "Joystick: CenterY set to %d\n", *centerY); - } - - return status; -} - -/*********************************************************************** - * - * xf86JoystickInit -- - * - * called when X device is initialized. - * - *********************************************************************** - */ - -void -xf86JoystickInit() -{ - return; -} - -/*********************************************************************** - * - * xf86JoystickOff -- - * - * close the handle. - * - *********************************************************************** - */ - -int -xf86JoystickOff(int *fd, int doclose) -{ - int oldfd; - - if (((oldfd = *fd) >= 0) && doclose) { - close(*fd); - *fd = -1; - } - return oldfd; -} - -/*********************************************************************** - * - * xf86JoystickGetState -- - * - * return the state of buttons and the position of the joystick. - * - *********************************************************************** - */ - -int -xf86JoystickGetState(int fd, int *x, int *y, int *buttons) -{ - struct joystick js; - int status; - - status = read(fd, &js, JS_RETURN); - - if (status != JS_RETURN) - { - Error("Joystick read"); - return 0; - } - - *x = js.x; - *y = js.y; - *buttons = js.b1 | (js.b2 << 1); -#ifdef DEBUG - ErrorF("xf86JoystickGetState: x = %d, y = %d, buttons = %d\n", *x, *y, - *buttons); -#endif - - return 1; -} - -#ifdef XFree86LOADER -/* - * Entry point for XFree86 Loader - */ -void -bsd_jstkModuleInit(pointer *data, INT32 *magic) -{ - *magic = MAGIC_DONE; - *data = NULL; -} -#endif -/* end of bsd_jstk.c */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.c deleted file mode 100644 index 18219e5bc..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.c +++ /dev/null @@ -1,573 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.c,v 1.8 2003/11/04 03:16:58 tsi Exp $ */ - -/* - * Copyright (c) 2002 by The XFree86 Project, Inc. - * Author: Ivan Pascal. - * - * Based on the code from bsd_io.c which is - * Copyright 1992 by Rich Murphey - * Copyright 1993 by David Dawes - */ - -#define NEED_EVENTS -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#include "xf86Xinput.h" -#include "xf86OSKbd.h" -#include "atKeynames.h" -#include "bsd_kbd.h" - -extern Bool VTSwitchEnabled; -#ifdef USE_VT_SYSREQ -extern Bool VTSysreqToggle; -#endif - -static KbdProtocolRec protocols[] = { - {"standard", PROT_STD }, -#ifdef WSCONS_SUPPORT - {"wskbd", PROT_WSCONS }, -#endif - { NULL, PROT_UNKNOWN_KBD } -}; - -typedef struct { - struct termios kbdtty; -} BsdKbdPrivRec, *BsdKbdPrivPtr; - -static -int KbdInit(InputInfoPtr pInfo, int what) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - BsdKbdPrivPtr priv = (BsdKbdPrivPtr) pKbd->private; - - if (pKbd->isConsole) { - switch (pKbd->consType) { -#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) || defined (WSCONS_SUPPORT) - case PCCONS: - case SYSCONS: - case PCVT: -#if defined WSCONS_SUPPORT - case WSCONS: -#endif - tcgetattr(pInfo->fd, &(priv->kbdtty)); -#endif - break; - } - } - - return Success; -} - -static void -SetKbdLeds(InputInfoPtr pInfo, int leds) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - int real_leds = 0; - -#ifdef LED_CAP - if (leds & XLED1) real_leds |= LED_CAP; -#endif -#ifdef LED_NUM - if (leds & XLED2) real_leds |= LED_NUM; -#endif -#ifdef LED_SCR - if (leds & XLED3) real_leds |= LED_SCR; - if (leds & XLED4) real_leds |= LED_SCR; -#endif - - switch (pKbd->consType) { - - case PCCONS: - break; -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - case SYSCONS: - case PCVT: - ioctl(pInfo->fd, KDSETLED, real_leds); - break; -#endif -#if defined(WSCONS_SUPPORT) - case WSCONS: - ioctl(pInfo->fd, WSKBDIO_SETLEDS, &real_leds); - break; -#endif - } -} - -static int -GetKbdLeds(InputInfoPtr pInfo) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - int leds = 0, real_leds = 0; - - switch (pKbd->consType) { - case PCCONS: - break; -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - case SYSCONS: - case PCVT: - ioctl(pInfo->fd, KDGETLED, &real_leds); - break; -#endif -#if defined(WSCONS_SUPPORT) - case WSCONS: - ioctl(pInfo->fd, WSKBDIO_GETLEDS, &real_leds); - break; -#endif - } - -#ifdef LED_CAP - if (real_leds & LED_CAP) leds |= XLED1; -#endif -#ifdef LED_NUM - if (real_leds & LED_NUM) leds |= XLED2; -#endif -#ifdef LED_SCR - if (real_leds & LED_SCR) leds |= XLED3; -#endif - - return(leds); -} - -static void -SetKbdRepeat(InputInfoPtr pInfo, char rad) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - switch (pKbd->consType) { - - case PCCONS: - break; -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - case SYSCONS: - case PCVT: - ioctl(pInfo->fd, KDSETRAD, rad); - break; -#endif - } -} - -static int -KbdOn(InputInfoPtr pInfo, int what) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; -#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) - BsdKbdPrivPtr priv = (BsdKbdPrivPtr) pKbd->private; - struct termios nTty; -#endif -#ifdef WSCONS_SUPPORT - int option; -#endif - - if (pKbd->isConsole) { - switch (pKbd->consType) { - -#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) - case SYSCONS: - case PCCONS: - case PCVT: -#ifdef WSCONS_SUPPORT - case WSCONS: -#endif - nTty = priv->kbdtty; - nTty.c_iflag = IGNPAR | IGNBRK; - nTty.c_oflag = 0; - nTty.c_cflag = CREAD | CS8; - nTty.c_lflag = 0; - nTty.c_cc[VTIME] = 0; - nTty.c_cc[VMIN] = 1; - cfsetispeed(&nTty, 9600); - cfsetospeed(&nTty, 9600); - if (tcsetattr(pInfo->fd, TCSANOW, &nTty) < 0) { - xf86Msg(X_ERROR, "KbdOn: tcsetattr: %s\n", - strerror(errno)); - } - break; -#endif - } -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) || defined (WSCONS_SUPPORT) - switch (pKbd->consType) { - case SYSCONS: - case PCVT: -#ifdef K_CODE - if (pKbd->CustomKeycodes) - ioctl(pInfo->fd, KDSKBMODE, K_CODE); - else - ioctl(pInfo->fd, KDSKBMODE, K_RAW); -#else - ioctl(pInfo->fd, KDSKBMODE, K_RAW); -#endif - break; -#endif -#ifdef WSCONS_SUPPORT - case WSCONS: - option = WSKBD_RAW; - if (ioctl(pInfo->fd, WSKBDIO_SETMODE, &option) == -1) { - FatalError("can't switch keyboard to raw mode. " - "Enable support for it in the kernel\n" - "or use for example:\n\n" - "Option \"Protocol\" \"wskbd\"\n" - "Option \"Device\" \"/dev/wskbd0\"\n" - "\nin your xorg.conf(5) file\n"); - } - break; -#endif - } - } - return Success; -} - -static int -KbdOff(InputInfoPtr pInfo, int what) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - BsdKbdPrivPtr priv = (BsdKbdPrivPtr) pKbd->private; -#ifdef WSCONS_SUPPORT - int option; -#endif - - if (pKbd->isConsole) { - switch (pKbd->consType) { -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - case SYSCONS: - case PCVT: - ioctl(pInfo->fd, KDSKBMODE, K_XLATE); - /* FALL THROUGH */ -#endif -#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) - case PCCONS: - tcsetattr(pInfo->fd, TCSANOW, &(priv->kbdtty)); - break; -#endif -#ifdef WSCONS_SUPPORT - case WSCONS: - option = WSKBD_TRANSLATED; - ioctl(xf86Info.consoleFd, WSKBDIO_SETMODE, &option); - tcsetattr(pInfo->fd, TCSANOW, &(priv->kbdtty)); - break; -#endif - } - } - return Success; -} - -static void -SoundBell(InputInfoPtr pInfo, int loudness, int pitch, int duration) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; -#ifdef WSCONS_SUPPORT - struct wskbd_bell_data wsb; -#endif - - if (loudness && pitch) { - switch (pKbd->consType) { -#ifdef PCCONS_SUPPORT - case PCCONS: - { int data[2]; - data[0] = pitch; - data[1] = (duration * loudness) / 50; - ioctl(pInfo->fd, CONSOLE_X_BELL, data); - break; - } -#endif -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - case SYSCONS: - case PCVT: - ioctl(pInfo->fd, KDMKTONE, - ((1193190 / pitch) & 0xffff) | - (((unsigned long)duration*loudness/50)<<16)); - break; -#endif -#if defined (WSCONS_SUPPORT) - case WSCONS: - wsb.which = WSKBD_BELL_DOALL; - wsb.pitch = pitch; - wsb.period = duration; - wsb.volume = loudness; - ioctl(pInfo->fd, WSKBDIO_COMPLEXBELL, &wsb); - break; -#endif - } - } -} - -#define ModifierSet(k) ((modifiers & (k)) == (k)) - -static -Bool SpecialKey(InputInfoPtr pInfo, int key, Bool down, int modifiers) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - - if(!pKbd->vtSwitchSupported) - return FALSE; - - if ((ModifierSet(ControlMask | AltMask)) || - (ModifierSet(ControlMask | AltLangMask))) { - if (VTSwitchEnabled && !xf86Info.vtSysreq && !xf86Info.dontVTSwitch) { - switch (key) { - case KEY_F1: - case KEY_F2: - case KEY_F3: - case KEY_F4: - case KEY_F5: - case KEY_F6: - case KEY_F7: - case KEY_F8: - case KEY_F9: - case KEY_F10: -#ifdef VT_ACTIVATE - if (down) { - ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1); - return TRUE; - } -#endif - case KEY_F11: - case KEY_F12: -#ifdef VT_ACTIVATE - if (down) { - ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11); - return TRUE; - } -#endif - } - } - } -#ifdef USE_VT_SYSREQ - if (VTSwitchEnabled && xf86Info.vtSysreq && !xf86Info.dontVTSwitch) { - switch (key) { - case KEY_F1: - case KEY_F2: - case KEY_F3: - case KEY_F4: - case KEY_F5: - case KEY_F6: - case KEY_F7: - case KEY_F8: - case KEY_F9: - case KEY_F10: - if (VTSysreqToggle && down) { - ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1); - VTSysreqToggle = FALSE; - return TRUE; - } - break; - case KEY_F11: - case KEY_F12: - if (VTSysreqToggle && down) { - ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11); - VTSysreqToggle = FALSE; - return TRUE; - } - break; - /* Ignore these keys -- ie don't let them cancel an alt-sysreq */ - case KEY_Alt: - case KEY_AltLang: - break; - case KEY_SysReqest: - if ((ModifierSet(AltMask) || ModifierSet(AltLangMask)) && down) - VTSysreqToggle = TRUE; - break; - default: - /* - * We only land here when Alt-SysReq is followed by a - * non-switching key. - */ - if (VTSysreqToggle) - VTSysreqToggle = FALSE; - } - } -#endif /* USE_VT_SYSREQ */ - - return FALSE; -} - -static void -stdReadInput(InputInfoPtr pInfo) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - unsigned char rBuf[64]; - int nBytes, i; - if ((nBytes = read( pInfo->fd, (char *)rBuf, sizeof(rBuf))) > 0) { - for (i = 0; i < nBytes; i++) - pKbd->PostEvent(pInfo, rBuf[i] & 0x7f, - rBuf[i] & 0x80 ? FALSE : TRUE); - } -} - -#ifdef WSCONS_SUPPORT - -static void -WSReadInput(InputInfoPtr pInfo) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - struct wscons_event events[64]; - int type; - int blocked, n, i; - - if ((n = read( pInfo->fd, events, sizeof(events))) > 0) { - n /= sizeof(struct wscons_event); - for (i = 0; i < n; i++) { - type = events[i].type; - if (type == WSCONS_EVENT_KEY_UP || type == WSCONS_EVENT_KEY_DOWN) { - /* It seems better to block SIGIO there */ - blocked = xf86BlockSIGIO(); - pKbd->PostEvent(pInfo, (unsigned int)(events[i].value), - type == WSCONS_EVENT_KEY_DOWN ? TRUE : FALSE); - xf86UnblockSIGIO(blocked); - } - } /* for */ - } -} - -static void -printWsType(char *type, char *devname) -{ - xf86Msg(X_PROBED, "%s: Keyboard type: %s\n", type, devname); -} -#endif - -static Bool -OpenKeyboard(InputInfoPtr pInfo) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - int i; - KbdProtocolId prot = PROT_UNKNOWN_KBD; - char *s; - - s = xf86SetStrOption(pInfo->options, "Protocol", NULL); - for (i = 0; protocols[i].name; i++) { - if (xf86NameCmp(s, protocols[i].name) == 0) { - prot = protocols[i].id; - break; - } - } - - switch (prot) { - case PROT_STD: - pInfo->read_input = stdReadInput; - break; -#ifdef WSCONS_SUPPORT - case PROT_WSCONS: - pInfo->read_input = WSReadInput; - break; -#endif - default: - xf86Msg(X_ERROR,"\"%s\" is not a valid keyboard protocol name\n", s); - xfree(s); - return FALSE; - } - xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, s); - xfree(s); - - s = xf86SetStrOption(pInfo->options, "Device", NULL); - if (s == NULL) { - if (prot == PROT_WSCONS) { - xf86Msg(X_ERROR,"A \"device\" option is required with" - " the \"wskbd\" keyboard protocol\n"); - return FALSE; - } else { - pInfo->fd = xf86Info.consoleFd; - pKbd->isConsole = TRUE; - pKbd->consType = xf86Info.consType; - } - } else { - pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL); - if (pInfo->fd == -1) { - xf86Msg(X_ERROR, "%s: cannot open \"%s\"\n", pInfo->name, s); - xfree(s); - return FALSE; - } - pKbd->isConsole = FALSE; - pKbd->consType = xf86Info.consType; - xfree(s); - } - -#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) - if (pKbd->isConsole && - ((pKbd->consType == SYSCONS) || (pKbd->consType == PCVT))) - pKbd->vtSwitchSupported = TRUE; -#endif - -#ifdef WSCONS_SUPPORT - if( prot == PROT_WSCONS) { - pKbd->consType = WSCONS; - /* Find out keyboard type */ - if (ioctl(pInfo->fd, WSKBDIO_GTYPE, &(pKbd->wsKbdType)) == -1) { - xf86Msg(X_ERROR, "%s: cannot get keyboard type", pInfo->name); - close(pInfo->fd); - return FALSE; - } - switch (pKbd->wsKbdType) { - case WSKBD_TYPE_PC_XT: - printWsType("XT", pInfo->name); - break; - case WSKBD_TYPE_PC_AT: - printWsType("AT", pInfo->name); - break; - case WSKBD_TYPE_USB: - printWsType("USB", pInfo->name); - break; -#ifdef WSKBD_TYPE_ADB - case WSKBD_TYPE_ADB: - printWsType("ADB", pInfo->name); - break; -#endif -#ifdef WSKBD_TYPE_SUN - case WSKBD_TYPE_SUN: - printWsType("Sun", pInfo->name); - break; -#endif -#ifdef WSKBD_TYPE_SUN5 - case WSKBD_TYPE_SUN5: - xf86Msg(X_PROBED, "Keyboard type: Sun5\n"); - break; -#endif - default: - xf86Msg(X_ERROR, "%s: Unsupported wskbd type \"%d\"", - pInfo->name, pKbd->wsKbdType); - close(pInfo->fd); - return FALSE; - } - } -#endif - return TRUE; -} - -Bool -xf86OSKbdPreInit(InputInfoPtr pInfo) -{ - KbdDevPtr pKbd = pInfo->private; - - pKbd->KbdInit = KbdInit; - pKbd->KbdOn = KbdOn; - pKbd->KbdOff = KbdOff; - pKbd->Bell = SoundBell; - pKbd->SetLeds = SetKbdLeds; - pKbd->GetLeds = GetKbdLeds; - pKbd->SetKbdRepeat = SetKbdRepeat; - pKbd->KbdGetMapping = KbdGetMapping; - pKbd->SpecialKey = SpecialKey; - - pKbd->RemapScanCode = NULL; - pKbd->GetSpecialKey = NULL; - - pKbd->OpenKeyboard = OpenKeyboard; - pKbd->vtSwitchSupported = FALSE; - pKbd->CustomKeycodes = FALSE; - - pKbd->private = xcalloc(sizeof(BsdKbdPrivRec), 1); - if (pKbd->private == NULL) { - xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n"); - return FALSE; - } - return TRUE; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.h b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.h deleted file mode 100644 index 7b9cd434e..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kbd.h +++ /dev/null @@ -1,5 +0,0 @@ -/* $XFree86$ */ - -extern void KbdGetMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms, - CARD8 *pModMap); - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kmod.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kmod.c deleted file mode 100644 index ecaf78028..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kmod.c +++ /dev/null @@ -1,31 +0,0 @@ -/* $XFree86$ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include - -#include "xf86_OSproc.h" -#include "xf86_ansic.h" - -/* - * Load a FreeBSD kernel module. - * This is used by the DRI/DRM to load a DRM kernel module when - * the X server starts. It could be used for other purposes in the future. - * Input: - * modName - name of the kernel module (Ex: "tdfx") - * Return: - * 0 for failure, 1 for success - */ -int xf86LoadKernelModule(const char *modName) -{ - if (kldload(modName) != -1) - return 1; - else - return 0; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c deleted file mode 100644 index 5215d54e4..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c +++ /dev/null @@ -1,203 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c,v 1.5 2002/07/30 23:24:32 herrb Exp $ */ -/* - * Copyright (C) 2001 The XFree86 Project, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES - * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR - * THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from the XFree86 Project. - */ -/* $OpenBSD: bsd_kqueue_apm.c,v 1.5 2002/07/30 23:07:42 matthieu Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" -#define XF86_OS_PRIVS -#include "xf86_OSproc.h" -#include "xf86_OSlib.h" - -#include -#include - -#define _PATH_APM_SOCKET "/var/run/apmdev" -#define _PATH_APM_DEV "/dev/apm" -#define _PATH_APM_CTLDEV "/dev/apmctl" - -static pointer APMihPtr = NULL; -static int devFd = -1; -static int ctlFd = -1; -static void bsdCloseAPM(void); - -static struct { - u_int apmBsd; - pmEvent xf86; -} bsdToXF86Array [] = { - { APM_STANDBY_REQ, XF86_APM_SYS_STANDBY }, - { APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND }, - { APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME }, - { APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME }, - { APM_BATTERY_LOW, XF86_APM_LOW_BATTERY }, - { APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE }, - { APM_UPDATE_TIME, XF86_APM_UPDATE_TIME }, - { APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND }, - { APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY }, - { APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND }, - { APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME }, -#ifdef APM_CAPABILITY_CHANGE - { APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED }, -#endif -}; - -#define numApmEvents (sizeof(bsdToXF86Array) / sizeof(bsdToXF86Array[0])) - -static pmEvent -bsdToXF86(int type) -{ - int i; - - for (i = 0; i < numApmEvents; i++) { - if (type == bsdToXF86Array[i].apmBsd) { - return bsdToXF86Array[i].xf86; - } - } - return XF86_APM_UNKNOWN; -} - -/* - * APM events can be requested direclty from /dev/apm - */ -static int -bsdPMGetEventFromOS(int kq, pmEvent *events, int num) -{ - struct kevent ev; - int i, result; - struct timespec ts = { 0, 0 }; - - for (i = 0; i < num; i++) { - result = kevent(kq, NULL, 0, &ev, 1, &ts); - if (result == 0 || APM_EVENT_TYPE(ev.data) == APM_NOEVENT) { - /* no event */ - break; - } else if (result < 0) { - xf86Msg(X_WARNING, "bsdPMGetEventFromOS: kevent returns" - " errno = %d\n", errno); - break; - } - events[i] = bsdToXF86(APM_EVENT_TYPE(ev.data)); - } - return i; -} - -/* - * If apmd(8) is running, he will get the events and handle them, - * so, we've nothing to do here. - * Otherwise, opening /dev/apmctl will succeed and we have to send the - * confirmations to /dev/apmctl. - */ -static pmWait -bsdPMConfirmEventToOs(int dummyfd, pmEvent event) -{ - if (ctlFd < 0) { - if ((ctlFd = open(_PATH_APM_CTLDEV, O_RDWR)) < 0) { - return PM_NONE; - } - } - /* apmctl open succeedeed */ - switch (event) { - case XF86_APM_SYS_STANDBY: - case XF86_APM_USER_STANDBY: - if (ioctl( ctlFd, APM_IOC_STANDBY, NULL ) == 0) - return PM_WAIT; /* should we stop the Xserver in standby, too? */ - else - return PM_NONE; - - case XF86_APM_SYS_SUSPEND: - case XF86_APM_CRITICAL_SUSPEND: - case XF86_APM_USER_SUSPEND: - if (ioctl( ctlFd, APM_IOC_SUSPEND, NULL ) == 0) - return PM_WAIT; - else - return PM_NONE; - break; - 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; - break; - default: - return PM_NONE; - } -} - -PMClose -xf86OSPMOpen(void) -{ - int kq; - struct kevent ev; - - if (APMihPtr || !xf86Info.pmFlag) { - return NULL; - } - if ((devFd = open(_PATH_APM_DEV, O_RDONLY)) == -1) { - return NULL; - } - if ((kq = kqueue()) <= 0) { - close(devFd); - return NULL; - } - EV_SET(&ev, devFd, EVFILT_READ, EV_ADD | EV_ENABLE | EV_CLEAR, - 0, 0, NULL); - if (kevent(kq, &ev, 1, NULL, 0, NULL) < 0) { - close(devFd); - return NULL; - } - - xf86PMGetEventFromOs = bsdPMGetEventFromOS; - xf86PMConfirmEventToOs = bsdPMConfirmEventToOs; - APMihPtr = xf86AddInputHandler(kq, xf86HandlePMEvents, NULL); - return bsdCloseAPM; -} - -static void -bsdCloseAPM(void) -{ - int kq; - - if (APMihPtr) { - kq = xf86RemoveInputHandler(APMihPtr); - close(devFd); - devFd = -1; - close(kq); - if (ctlFd >= 0) { - close(ctlFd); - ctlFd = -1; - } - APMihPtr = NULL; - } -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c deleted file mode 100644 index 6ef300197..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c +++ /dev/null @@ -1,792 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c,v 1.28 2004/02/06 17:15:36 tsi Exp $ */ - -/* - * Copyright (c) 1999-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86Xinput.h" -#include "xf86OSmouse.h" -#include "xisb.h" -#include "mipointer.h" -#ifdef WSCONS_SUPPORT -#include -#endif -#ifdef USBMOUSE_SUPPORT -#ifdef HAS_LIB_USB_HID -#include -#else -#include "usb.h" -#endif - -#include -#ifdef USB_GET_REPORT_ID -#define USB_NEW_HID -#endif - -#define HUP_GENERIC_DESKTOP 0x0001 -#define HUP_BUTTON 0x0009 - -#define HUG_X 0x0030 -#define HUG_Y 0x0031 -#define HUG_Z 0x0032 -#define HUG_WHEEL 0x0038 - -#define HID_USAGE2(p,u) (((p) << 16) | u) - -/* The UMS mices have middle button as number 3 */ -#define UMS_BUT(i) ((i) == 0 ? 2 : (i) == 1 ? 0 : (i) == 2 ? 1 : (i)) -#endif /* USBMOUSE_SUPPORT */ - -#ifdef USBMOUSE_SUPPORT -static void usbSigioReadInput (int fd, void *closure); -#endif - -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -/* These are for FreeBSD */ -#define DEFAULT_MOUSE_DEV "/dev/mouse" -#define DEFAULT_SYSMOUSE_DEV "/dev/sysmouse" -#define DEFAULT_PS2_DEV "/dev/psm0" - -static const char *mouseDevs[] = { - DEFAULT_MOUSE_DEV, - DEFAULT_SYSMOUSE_DEV, - DEFAULT_PS2_DEV, - NULL -}; -#elif defined(__OpenBSD__) && defined(WSCONS_SUPPORT) -/* Only wsmouse mices are autoconfigured for now on OpenBSD */ -#define DEFAULT_WSMOUSE_DEV "/dev/wsmouse" -#define DEFAULT_WSMOUSE0_DEV "/dev/wsmouse0" - -static const char *mouseDevs[] = { - DEFAULT_WSMOUSE_DEV, - DEFAULT_WSMOUSE0_DEV, - NULL -}; -#endif - -static int -SupportedInterfaces(void) -{ -#if defined(__NetBSD__) - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO; -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_MISC; -#else - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO; -#endif -} - -/* Names of protocols that are handled internally here. */ -static const char *internalNames[] = { -#if defined(WSCONS_SUPPORT) - "WSMouse", -#endif -#if defined(USBMOUSE_SUPPORT) - "usb", -#endif - NULL -}; - -/* - * Names of MSC_MISC protocols that the OS supports. These are decoded by - * main "mouse" driver. - */ -static const char *miscNames[] = { -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - "SysMouse", -#endif - NULL -}; - -static const char ** -BuiltinNames(void) -{ - return internalNames; -} - -static Bool -CheckProtocol(const char *protocol) -{ - int i; - - for (i = 0; internalNames[i]; i++) - if (xf86NameCmp(protocol, internalNames[i]) == 0) - return TRUE; - for (i = 0; miscNames[i]; i++) - if (xf86NameCmp(protocol, miscNames[i]) == 0) - return TRUE; - return FALSE; -} - -static const char * -DefaultProtocol(void) -{ -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - return "Auto"; -#elif defined(__OpenBSD__) && defined(WSCONS_SUPPORT) - return "WSMouse"; -#else - return NULL; -#endif -} - -#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && defined(MOUSE_PROTO_SYSMOUSE) -static struct { - int dproto; - const char *name; -} devproto[] = { - { MOUSE_PROTO_MS, "Microsoft" }, - { MOUSE_PROTO_MSC, "MouseSystems" }, - { MOUSE_PROTO_LOGI, "Logitech" }, - { MOUSE_PROTO_MM, "MMSeries" }, - { MOUSE_PROTO_LOGIMOUSEMAN, "MouseMan" }, - { MOUSE_PROTO_BUS, "BusMouse" }, - { MOUSE_PROTO_INPORT, "BusMouse" }, - { MOUSE_PROTO_PS2, "PS/2" }, - { MOUSE_PROTO_HITTAB, "MMHitTab" }, - { MOUSE_PROTO_GLIDEPOINT, "GlidePoint" }, - { MOUSE_PROTO_INTELLI, "Intellimouse" }, - { MOUSE_PROTO_THINK, "ThinkingMouse" }, - { MOUSE_PROTO_SYSMOUSE, "SysMouse" } -}; - -static const char * -SetupAuto(InputInfoPtr pInfo, int *protoPara) -{ - int i; - mousehw_t hw; - mousemode_t mode; - - if (pInfo->fd == -1) - return NULL; - - /* set the driver operation level, if applicable */ - i = 1; - ioctl(pInfo->fd, MOUSE_SETLEVEL, &i); - - /* interrogate the driver and get some intelligence on the device. */ - hw.iftype = MOUSE_IF_UNKNOWN; - hw.model = MOUSE_MODEL_GENERIC; - ioctl(pInfo->fd, MOUSE_GETHWINFO, &hw); - xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: hw.iftype is %d, hw.model is %d\n", - pInfo->name, hw.iftype, hw.model); - if (ioctl(pInfo->fd, MOUSE_GETMODE, &mode) == 0) { - for (i = 0; i < sizeof(devproto)/sizeof(devproto[0]); ++i) { - if (mode.protocol == devproto[i].dproto) { - /* override some parameters */ - if (protoPara) { - protoPara[4] = mode.packetsize; - protoPara[0] = mode.syncmask[0]; - protoPara[1] = mode.syncmask[1]; - } - xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n", - pInfo->name, devproto[i].name); - return devproto[i].name; - } - } - } - return NULL; -} - -static void -SetSysMouseRes(InputInfoPtr pInfo, const char *protocol, int rate, int res) -{ - mousemode_t mode; - MouseDevPtr pMse; - - pMse = pInfo->private; - - mode.rate = rate > 0 ? rate : -1; - mode.resolution = res > 0 ? res : -1; - mode.accelfactor = -1; -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - if (pMse->autoProbe || - (protocol && xf86NameCmp(protocol, "SysMouse") == 0)) { - /* - * As the FreeBSD sysmouse driver defaults to protocol level 0 - * everytime it is opened we enforce protocol level 1 again at - * this point. - */ - mode.level = 1; - } else - mode.level = -1; -#else - mode.level = -1; -#endif - ioctl(pInfo->fd, MOUSE_SETMODE, &mode); -} -#endif - -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - -#define MOUSED_PID_FILE "/var/run/moused.pid" - -/* - * Try to check if moused is running. DEFAULT_SYSMOUSE_DEV is useless without - * it. There doesn't seem to be a better way of checking. - */ -static Bool -MousedRunning(void) -{ - FILE *f = NULL; - unsigned int pid; - - if ((f = fopen(MOUSED_PID_FILE, "r")) != NULL) { - if (fscanf(f, "%u", &pid) == 1 && pid > 0) { - if (kill(pid, 0) == 0) { - fclose(f); - return TRUE; - } - } - fclose(f); - } - return FALSE; -} - -static const char * -FindDevice(InputInfoPtr pInfo, const char *protocol, int flags) -{ - int fd = -1; - const char **pdev, *dev = NULL; - Bool devMouse = FALSE; - struct stat devMouseStat; - struct stat sb; - - for (pdev = mouseDevs; *pdev; pdev++) { - SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK)); - if (fd == -1) { -#ifdef DEBUG - ErrorF("Cannot open %s (%s)\n", *pdev, strerror(errno)); -#endif - } else { - /* - * /dev/mouse is held until checks for matches with other devices - * are done. This is so that when it points to /dev/sysmouse, - * the test for whether /dev/sysmouse is usable can be made. - */ - if (!strcmp(*pdev, DEFAULT_MOUSE_DEV)) { - if (fstat(fd, &devMouseStat) == 0) - devMouse = TRUE; - close(fd); - continue; - } else if (!strcmp(*pdev, DEFAULT_SYSMOUSE_DEV)) { - /* Check if /dev/mouse is the same as /dev/sysmouse. */ - if (devMouse && fstat(fd, &sb) == 0 && - devMouseStat.st_dev == sb.st_dev && - devMouseStat.st_ino == sb.st_ino) { - /* If the same, use /dev/sysmouse. */ - devMouse = FALSE; - } - close(fd); - if (MousedRunning()) - break; - else { -#ifdef DEBUG - ErrorF("moused isn't running\n"); -#endif - } - } else { - close(fd); - break; - } - } - } - - if (*pdev) - dev = *pdev; - else if (devMouse) - dev = DEFAULT_MOUSE_DEV; - - if (dev) { - /* Set the Device option. */ - pInfo->conf_idev->commonOptions = - xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", dev); - xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n", - pInfo->name, dev); - } - - return *pdev; -} -#endif - -#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) - -/* Only support wsmouse configuration for now */ -static const char * -SetupAuto(InputInfoPtr pInfo, int *protoPara) -{ - - xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n", - pInfo->name, "wsmouse"); - return "wsmouse"; -} - -static void -SetMouseRes(InputInfoPtr pInfo, const char *protocol, int rate, int res) -{ - - xf86MsgVerb(X_INFO, 3, "%s: SetMouseRes: protocol %s rate %d res %d\n", - pInfo->name, protocol, rate, res); -} - -static const char * -FindDevice(InputInfoPtr pInfo, const char *protocol, int flags) -{ - int fd = -1; - const char **pdev; - - for (pdev = mouseDevs; *pdev; pdev++) { - SYSCALL(fd = open(*pdev, O_RDWR | O_NONBLOCK)); - if (fd != -1) { - /* Set the Device option. */ - pInfo->conf_idev->commonOptions = - xf86AddNewOption(pInfo->conf_idev->commonOptions, - "Device", *pdev); - xf86Msg(X_INFO, "%s: found Device \"%s\"\n", - pInfo->name, *pdev); - close(fd); - break; - } - } - return *pdev; -} -#endif /* __OpenBSD__ && WSCONS_SUPPORT */ - -#ifdef WSCONS_SUPPORT -#define NUMEVENTS 64 - -static void -wsconsReadInput(InputInfoPtr pInfo) -{ - MouseDevPtr pMse; - static struct wscons_event eventList[NUMEVENTS]; - int n, c; - struct wscons_event *event = eventList; - unsigned char *pBuf; - - pMse = pInfo->private; - - XisbBlockDuration(pMse->buffer, -1); - pBuf = (unsigned char *)eventList; - n = 0; - while ((c = XisbRead(pMse->buffer)) >= 0 && n < sizeof(eventList)) { - pBuf[n++] = (unsigned char)c; - } - - if (n == 0) - return; - - n /= sizeof(struct wscons_event); - while( n-- ) { - int buttons = pMse->lastButtons; - int dx = 0, dy = 0, dz = 0, dw = 0; - switch (event->type) { - case WSCONS_EVENT_MOUSE_UP: -#define BUTBIT (1 << (event->value <= 2 ? 2 - event->value : event->value)) - buttons &= ~BUTBIT; - break; - case WSCONS_EVENT_MOUSE_DOWN: - buttons |= BUTBIT; - break; - case WSCONS_EVENT_MOUSE_DELTA_X: - dx = event->value; - break; - case WSCONS_EVENT_MOUSE_DELTA_Y: - dy = -event->value; - break; -#ifdef WSCONS_EVENT_MOUSE_DELTA_Z - case WSCONS_EVENT_MOUSE_DELTA_Z: - dz = event->value; - break; -#endif - default: - xf86Msg(X_WARNING, "%s: bad wsmouse event type=%d\n", pInfo->name, - event->type); - ++event; - continue; - } - - pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw); - ++event; - } - return; -} - - -/* This function is called when the protocol is "wsmouse". */ -static Bool -wsconsPreInit(InputInfoPtr pInfo, const char *protocol, int flags) -{ - MouseDevPtr pMse = pInfo->private; - - pMse->protocol = protocol; - xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol); - - /* Collect the options, and process the common options. */ - xf86CollectInputOptions(pInfo, NULL, NULL); - xf86ProcessCommonOptions(pInfo, pInfo->options); - - /* Check if the device can be opened. */ - pInfo->fd = xf86OpenSerial(pInfo->options); - if (pInfo->fd == -1) { - if (xf86GetAllowMouseOpenFail()) - xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); - else { - xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name); - xfree(pMse); - return FALSE; - } - } - xf86CloseSerial(pInfo->fd); - pInfo->fd = -1; - - /* Process common mouse options (like Emulate3Buttons, etc). */ - pMse->CommonOptions(pInfo); - - /* Setup the local input proc. */ - pInfo->read_input = wsconsReadInput; - pMse->xisbscale = sizeof(struct wscons_event); - - pInfo->flags |= XI86_CONFIGURED; - return TRUE; -} -#endif - -#if defined(USBMOUSE_SUPPORT) - -typedef struct _UsbMseRec { - int packetSize; - int iid; - hid_item_t loc_x; /* x locator item */ - hid_item_t loc_y; /* y locator item */ - hid_item_t loc_z; /* z (wheel) locator item */ - hid_item_t loc_btn[MSE_MAXBUTTONS]; /* buttons locator items */ - unsigned char *buffer; -} UsbMseRec, *UsbMsePtr; - -static int -usbMouseProc(DeviceIntPtr pPointer, int what) -{ - InputInfoPtr pInfo; - MouseDevPtr pMse; - UsbMsePtr pUsbMse; - unsigned char map[MSE_MAXBUTTONS + 1]; - int nbuttons; - - pInfo = pPointer->public.devicePrivate; - pMse = pInfo->private; - pMse->device = pPointer; - pUsbMse = pMse->mousePriv; - - switch (what) { - case DEVICE_INIT: - pPointer->public.on = FALSE; - - for (nbuttons = 0; nbuttons < MSE_MAXBUTTONS; ++nbuttons) - map[nbuttons + 1] = nbuttons + 1; - - InitPointerDeviceStruct((DevicePtr)pPointer, - map, - min(pMse->buttons, MSE_MAXBUTTONS), - miPointerGetMotionEvents, - pMse->Ctrl, - miPointerGetMotionBufferSize()); - - /* X valuator */ - xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1); - xf86InitValuatorDefaults(pPointer, 0); - /* Y valuator */ - xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1); - xf86InitValuatorDefaults(pPointer, 1); - xf86MotionHistoryAllocate(pInfo); - break; - - case DEVICE_ON: - pInfo->fd = xf86OpenSerial(pInfo->options); - if (pInfo->fd == -1) - xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); - else { - pMse->buffer = XisbNew(pInfo->fd, pUsbMse->packetSize); - if (!pMse->buffer) { - xfree(pMse); - xf86CloseSerial(pInfo->fd); - pInfo->fd = -1; - } else { - xf86FlushInput(pInfo->fd); - if (!xf86InstallSIGIOHandler (pInfo->fd, usbSigioReadInput, - pInfo)) - AddEnabledDevice(pInfo->fd); - } - } - pMse->lastButtons = 0; - pMse->lastMappedButtons = 0; - pMse->emulateState = 0; - pPointer->public.on = TRUE; - break; - - case DEVICE_OFF: - case DEVICE_CLOSE: - if (pInfo->fd != -1) { - RemoveEnabledDevice(pInfo->fd); - if (pUsbMse->packetSize > 8 && pUsbMse->buffer) { - xfree(pUsbMse->buffer); - } - if (pMse->buffer) { - XisbFree(pMse->buffer); - pMse->buffer = NULL; - } - xf86CloseSerial(pInfo->fd); - pInfo->fd = -1; - } - pPointer->public.on = FALSE; - usleep(300000); - break; - } - return Success; -} - -static void -usbReadInput(InputInfoPtr pInfo) -{ - MouseDevPtr pMse; - UsbMsePtr pUsbMse; - int buttons = pMse->lastButtons; - int dx = 0, dy = 0, dz = 0, dw = 0; - int n, c; - unsigned char *pBuf; - - pMse = pInfo->private; - pUsbMse = pMse->mousePriv; - - XisbBlockDuration(pMse->buffer, -1); - pBuf = pUsbMse->buffer; - n = 0; - while ((c = XisbRead(pMse->buffer)) >= 0 && n < pUsbMse->packetSize) { - pBuf[n++] = (unsigned char)c; - } - if (n == 0) - return; - if (n != pUsbMse->packetSize) { - xf86Msg(X_WARNING, "%s: incomplete packet, size %d\n", pInfo->name, - n); - } - /* discard packets with an id that don't match the mouse */ - /* XXX this is probably not the right thing */ - if (pUsbMse->iid != 0) { - if (*pBuf++ != pUsbMse->iid) - return; - } - dx = hid_get_data(pBuf, &pUsbMse->loc_x); - dy = hid_get_data(pBuf, &pUsbMse->loc_y); - dz = hid_get_data(pBuf, &pUsbMse->loc_z); - - buttons = 0; - for (n = 0; n < pMse->buttons; n++) { - if (hid_get_data(pBuf, &pUsbMse->loc_btn[n])) - buttons |= (1 << UMS_BUT(n)); - } - pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw); - return; -} - -static void -usbSigioReadInput (int fd, void *closure) -{ - usbReadInput ((InputInfoPtr) closure); -} - -/* This function is called when the protocol is "usb". */ -static Bool -usbPreInit(InputInfoPtr pInfo, const char *protocol, int flags) -{ - MouseDevPtr pMse = pInfo->private; - UsbMsePtr pUsbMse; - report_desc_t reportDesc; - int i; - - pUsbMse = xalloc(sizeof(UsbMseRec)); - if (pUsbMse == NULL) { - xf86Msg(X_ERROR, "%s: cannot allocate UsbMouseRec\n", pInfo->name); - xfree(pMse); - return FALSE; - } - - pMse->protocol = protocol; - xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol); - - /* Collect the options, and process the common options. */ - xf86CollectInputOptions(pInfo, NULL, NULL); - xf86ProcessCommonOptions(pInfo, pInfo->options); - - /* Check if the device can be opened. */ - pInfo->fd = xf86OpenSerial(pInfo->options); - if (pInfo->fd == -1) { - if (xf86GetAllowMouseOpenFail()) - xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); - else { - xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name); - xfree(pUsbMse); - xfree(pMse); - return FALSE; - } - } - /* Get USB informations */ - reportDesc = hid_get_report_desc(pInfo->fd); - /* Get packet size & iid */ -#ifdef USB_NEW_HID - if (ioctl(pInfo->fd, USB_GET_REPORT_ID, &pUsbMse->iid) == -1) { - xf86Msg(X_ERROR, "Error ioctl USB_GET_REPORT_ID on %s : %s\n", - pInfo->name, strerror(errno)); - return FALSE; - } - pUsbMse->packetSize = hid_report_size(reportDesc, hid_input, - pUsbMse->iid); -#else - pUsbMse->packetSize = hid_report_size(reportDesc, hid_input, - &pUsbMse->iid); -#endif - /* Allocate buffer */ - if (pUsbMse->packetSize <= 8) { - pUsbMse->buffer = pMse->protoBuf; - } else { - pUsbMse->buffer = xalloc(pUsbMse->packetSize); - } - if (pUsbMse->buffer == NULL) { - xf86Msg(X_ERROR, "%s: cannot allocate buffer\n", pInfo->name); - xfree(pUsbMse); - xfree(pMse); - xf86CloseSerial(pInfo->fd); - return FALSE; - } -#ifdef USB_NEW_HID - if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), - hid_input, &pUsbMse->loc_x, pUsbMse->iid) < 0) { - xf86Msg(X_WARNING, "%s: no x locator\n", pInfo->name); - } - if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), - hid_input, &pUsbMse->loc_y, pUsbMse->iid) < 0) { - xf86Msg(X_WARNING, "%s: no y locator\n", pInfo->name); - } - if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL), - hid_input, &pUsbMse->loc_z, pUsbMse->iid) < 0) { - } -#else - if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), - hid_input, &pUsbMse->loc_x) < 0) { - xf86Msg(X_WARNING, "%s: no x locator\n", pInfo->name); - } - if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), - hid_input, &pUsbMse->loc_y) < 0) { - xf86Msg(X_WARNING, "%s: no y locator\n", pInfo->name); - } - if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL), - hid_input, &pUsbMse->loc_z) < 0) { - } -#endif - /* Probe for number of buttons */ - for (i = 1; i <= MSE_MAXBUTTONS; i++) { - if (!hid_locate(reportDesc, HID_USAGE2(HUP_BUTTON, i), - hid_input, &pUsbMse->loc_btn[i-1] -#ifdef USB_NEW_HID - , pUsbMse->iid -#endif - )) - break; - } - pMse->buttons = i-1; - - xf86CloseSerial(pInfo->fd); - pInfo->fd = -1; - - /* Private structure */ - pMse->mousePriv = pUsbMse; - - /* Process common mouse options (like Emulate3Buttons, etc). */ - pMse->CommonOptions(pInfo); - - /* Setup the local procs. */ - pInfo->device_control = usbMouseProc; - pInfo->read_input = usbReadInput; - - pInfo->flags |= XI86_CONFIGURED; - return TRUE; -} -#endif /* USBMOUSE */ - -static Bool -bsdMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags) -{ - /* The protocol is guaranteed to be one of the internalNames[] */ -#ifdef WSCONS_SUPPORT - if (xf86NameCmp(protocol, "WSMouse") == 0) { - return wsconsPreInit(pInfo, protocol, flags); - } -#endif -#ifdef USBMOUSE_SUPPORT - if (xf86NameCmp(protocol, "usb") == 0) { - return usbPreInit(pInfo, protocol, flags); - } -#endif - return TRUE; -} - -OSMouseInfoPtr -xf86OSMouseInit(int flags) -{ - OSMouseInfoPtr p; - - p = xcalloc(sizeof(OSMouseInfoRec), 1); - if (!p) - return NULL; - p->SupportedInterfaces = SupportedInterfaces; - p->BuiltinNames = BuiltinNames; - p->DefaultProtocol = DefaultProtocol; - p->CheckProtocol = CheckProtocol; -#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && defined(MOUSE_PROTO_SYSMOUSE) - p->SetupAuto = SetupAuto; - p->SetPS2Res = SetSysMouseRes; - p->SetBMRes = SetSysMouseRes; - p->SetMiscRes = SetSysMouseRes; -#endif -#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) - p->SetupAuto = SetupAuto; - p->SetMiscRes = SetMouseRes; -#endif -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) - p->FindDevice = FindDevice; -#endif - p->PreInit = bsdMousePreInit; - return p; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile deleted file mode 100644 index 9cb04a516..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile +++ /dev/null @@ -1,63 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile,v 1.14 2003/05/08 21:49:01 herrb Exp $ -XCOMM $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile,v 1.7 1999/09/14 19:55:15 faith Exp $ - -#define IHaveModules -#include - -#if DoLoadableServer -MSRC = drmmodule.c -MOBJ = drmmodule.o -#endif - -#if BuildXF86DRI -#if HasMTRRSupport -MTRR_DEFINES = -DHAS_MTRR_SUPPORT -#endif - -#if defined(KFreeBSDArchitecture) -OS_SUBDIR = freebsd -#elif defined(NetBSDArchitecture) -OS_SUBDIR = netbsd -#elif defined(OpenBSDArchitecture) -OS_SUBDIR = openbsd -#else -OS_SUBDIR = extensions -#endif - - SRCS = xf86drm.c \ - xf86drmHash.c \ - xf86drmRandom.c \ - xf86drmSL.c \ - $(MSRC) - - OBJS = xf86drm.o \ - xf86drmHash.o \ - xf86drmRandom.o \ - xf86drmSL.o \ - $(MOBJ) - -INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) -I$(EXTINCSRC) -I../.. -I$(DRMSRCDIR)/bsd-core \ - -I$(DRMSRCDIR)/shared-core - -DEFINES = $(MTRR_DEFINES) $(GLX_DEFINES) - -ModuleObjectRule() -LibraryModuleTarget(drm,$(OBJS)) -NormalLintTarget($(SRCS)) - -InstallLibraryModule(drm,$(MODULEDIR),$(OS_SUBDIR)) -#endif - -DependTarget() - -LIBDRM_DIR = ../../../../../../../extras/drm/libdrm -#if DoLoadableServer -LinkSourceFile(drmmodule.c,$(XF86OSSRC)/linux/drm) -#endif -LinkSourceFile(xf86drm.c,$(LIBDRM_DIR)) -LinkSourceFile(xf86drmHash.c,$(LIBDRM_DIR)) -LinkSourceFile(xf86drmRandom.c,$(LIBDRM_DIR)) -LinkSourceFile(xf86drmSL.c,$(LIBDRM_DIR)) - -InstallDriverSDKLibraryModule(drm,$(DRIVERSDKMODULEDIR),$(OS_SUBDIR)) diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/i386_video.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/i386_video.c deleted file mode 100644 index 3f4cdb010..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/i386_video.c +++ /dev/null @@ -1,999 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/i386_video.c,v 1.4 2003/09/24 02:43:34 dawes Exp $ */ -/* - * Copyright 1992 by Rich Murphey - * Copyright 1993 by David Wexelblat - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Rich Murphey and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Rich Murphey and - * David Wexelblat make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/* $XConsortium: bsd_video.c /main/10 1996/10/25 11:37:57 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" - -#include -#include - -#ifdef HAS_MTRR_SUPPORT -#ifndef __NetBSD__ -#include -#include -#else -#include "memrange.h" -#endif -#define X_MTRR_ID "XFree86" -#endif - -#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) -#include -#include -#include -#endif - -#if defined(__OpenBSD__) && defined(__amd64__) -#include -#include -#endif - -#include "xf86_OSlib.h" -#include "xf86OSpriv.h" - -#if defined(__NetBSD__) && !defined(MAP_FILE) -#define MAP_FLAGS MAP_SHARED -#else -#define MAP_FLAGS (MAP_FILE | MAP_SHARED) -#endif - -#ifndef MAP_FAILED -#define MAP_FAILED ((caddr_t)-1) -#endif - -#ifdef __OpenBSD__ -#define SYSCTL_MSG "\tCheck that you have set 'machdep.allowaperture=1'\n"\ - "\tin /etc/sysctl.conf and reboot your machine\n" \ - "\trefer to xf86(4) for details" -#define SYSCTL_MSG2 \ - "Check that you have set 'machdep.allowaperture=2'\n" \ - "\tin /etc/sysctl.conf and reboot your machine\n" \ - "\trefer to xf86(4) for details" -#endif - -/***************************************************************************/ -/* Video Memory Mapping section */ -/***************************************************************************/ - -static Bool useDevMem = FALSE; -static int devMemFd = -1; - -#ifdef HAS_APERTURE_DRV -#define DEV_APERTURE "/dev/xf86" -#endif -#define DEV_MEM "/dev/mem" - -static pointer mapVidMem(int, unsigned long, unsigned long, int); -static void unmapVidMem(int, pointer, unsigned long); - -#ifdef HAS_MTRR_SUPPORT -static pointer setWC(int, unsigned long, unsigned long, Bool, MessageType); -static void undoWC(int, pointer); -static Bool cleanMTRR(void); -#endif -#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) -static pointer NetBSDsetWC(int, unsigned long, unsigned long, Bool, - MessageType); -static void NetBSDundoWC(int, pointer); -#endif -#if defined(__amd64__) && defined(__OpenBSD__) -static pointer amd64setWC(int, unsigned long, unsigned long, Bool, - MessageType); -static void amd64undoWC(int, pointer); -#endif - -/* - * Check if /dev/mem can be mmap'd. If it can't print a warning when - * "warn" is TRUE. - */ -static void -checkDevMem(Bool warn) -{ - static Bool devMemChecked = FALSE; - int fd; - pointer base; - - if (devMemChecked) - return; - devMemChecked = TRUE; - - if ((fd = open(DEV_MEM, O_RDWR)) >= 0) - { - /* Try to map a page at the VGA address */ - base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE, - MAP_FLAGS, fd, (off_t)0xA0000); - - if (base != MAP_FAILED) - { - munmap((caddr_t)base, 4096); - devMemFd = fd; - useDevMem = TRUE; - return; - } else { - /* This should not happen */ - if (warn) - { - xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n", - DEV_MEM, strerror(errno)); - } - useDevMem = FALSE; - return; - } - } -#ifndef HAS_APERTURE_DRV - if (warn) - { - xf86Msg(X_WARNING, "checkDevMem: failed to open %s (%s)\n", - DEV_MEM, strerror(errno)); - } - useDevMem = FALSE; - return; -#else - /* Failed to open /dev/mem, try the aperture driver */ - if ((fd = open(DEV_APERTURE, O_RDWR)) >= 0) - { - /* Try to map a page at the VGA address */ - base = mmap((caddr_t)0, 4096, PROT_READ | PROT_WRITE, - MAP_FLAGS, fd, (off_t)0xA0000); - - if (base != MAP_FAILED) - { - munmap((caddr_t)base, 4096); - devMemFd = fd; - useDevMem = TRUE; - xf86Msg(X_INFO, "checkDevMem: using aperture driver %s\n", - DEV_APERTURE); - return; - } else { - - if (warn) - { - xf86Msg(X_WARNING, "checkDevMem: failed to mmap %s (%s)\n", - DEV_APERTURE, strerror(errno)); - } - } - } else { - if (warn) - { -#ifndef __OpenBSD__ - xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" - "\t(%s)\n", DEV_MEM, DEV_APERTURE, strerror(errno)); -#else /* __OpenBSD__ */ - xf86Msg(X_WARNING, "checkDevMem: failed to open %s and %s\n" - "\t(%s)\n%s", DEV_MEM, DEV_APERTURE, strerror(errno), - SYSCTL_MSG); -#endif /* __OpenBSD__ */ - } - } - - useDevMem = FALSE; - return; - -#endif -} - -void -xf86OSInitVidMem(VidMemInfoPtr pVidMem) -{ - checkDevMem(TRUE); - pVidMem->linearSupported = useDevMem; - pVidMem->mapMem = mapVidMem; - pVidMem->unmapMem = unmapVidMem; - -#ifdef HAS_MTRR_SUPPORT - if (useDevMem) { - if (cleanMTRR()) { - pVidMem->setWC = setWC; - pVidMem->undoWC = undoWC; - } - } -#endif -#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) - pVidMem->setWC = NetBSDsetWC; - pVidMem->undoWC = NetBSDundoWC; -#endif -#if defined(__amd64__) && defined(__OpenBSD__) - pVidMem->setWC = amd64setWC; - pVidMem->undoWC = amd64undoWC; -#endif - pVidMem->initialised = TRUE; -} - -static pointer -mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) -{ - pointer base; - - checkDevMem(FALSE); - - if (useDevMem) - { - if (devMemFd < 0) - { - FatalError("xf86MapVidMem: failed to open %s (%s)", - DEV_MEM, strerror(errno)); - } - base = mmap((caddr_t)0, Size, - (flags & VIDMEM_READONLY) ? - PROT_READ : (PROT_READ | PROT_WRITE), - MAP_FLAGS, devMemFd, (off_t)Base); - if (base == MAP_FAILED) - { - FatalError("%s: could not mmap %s [s=%lx,a=%lx] (%s)", - "xf86MapVidMem", DEV_MEM, Size, Base, - strerror(errno)); - } - return(base); - } - - /* else, mmap /dev/vga */ - if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000) - { - FatalError("%s: Address 0x%lx outside allowable range", - "xf86MapVidMem", Base); - } - base = mmap(0, Size, - (flags & VIDMEM_READONLY) ? - PROT_READ : (PROT_READ | PROT_WRITE), - MAP_FLAGS, xf86Info.screenFd, - (unsigned long)Base - 0xA0000 - ); - if (base == MAP_FAILED) - { - FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s)", - strerror(errno)); - } - return(base); -} - -static void -unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - munmap((caddr_t)Base, Size); -} - -/* - * Read BIOS via mmap()ing DEV_MEM - */ - -int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ - unsigned char *ptr; - int psize; - int mlen; - - checkDevMem(TRUE); - if (devMemFd == -1) { - return(-1); - } - - psize = xf86getpagesize(); - Offset += Base & (psize - 1); - Base &= ~(psize - 1); - mlen = (Offset + Len + psize - 1) & ~(psize - 1); - ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ, - MAP_SHARED, devMemFd, (off_t)Base); - if ((long)ptr == -1) - { - xf86Msg(X_WARNING, - "xf86ReadBIOS: %s mmap[s=%x,a=%lx,o=%lx] failed (%s)\n", - DEV_MEM, Len, Base, Offset, strerror(errno)); -#ifdef __OpenBSD__ - if (Base < 0xa0000) { - xf86Msg(X_WARNING, SYSCTL_MSG2); - } -#endif - return(-1); - } -#ifdef DEBUG - ErrorF("xf86ReadBIOS: BIOS at 0x%08x has signature 0x%04x\n", - Base, ptr[0] | (ptr[1] << 8)); -#endif - (void)memcpy(Buf, (void *)(ptr + Offset), Len); - (void)munmap((caddr_t)ptr, mlen); -#ifdef DEBUG - xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS(%x, %x, Buf, %x)" - "-> %02x %02x %02x %02x...\n", - Base, Offset, Len, Buf[0], Buf[1], Buf[2], Buf[3]); -#endif - return(Len); -} - -#ifdef USE_I386_IOPL -/***************************************************************************/ -/* I/O Permissions section */ -/***************************************************************************/ - -static Bool ExtendedEnabled = FALSE; - -Bool -xf86EnableIO() -{ - if (ExtendedEnabled) - return TRUE; - - if (i386_iopl(TRUE) < 0) - { -#ifndef __OpenBSD__ - xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O", - "xf86EnableIO"); -#else - xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O\n%s", - "xf86EnableIO", SYSCTL_MSG); -#endif - return FALSE; - } - ExtendedEnabled = TRUE; - - return TRUE; -} - -void -xf86DisableIO() -{ - if (!ExtendedEnabled) - return; - - i386_iopl(FALSE); - ExtendedEnabled = FALSE; - - return; -} - -#endif /* USE_I386_IOPL */ - -#ifdef USE_AMD64_IOPL -/***************************************************************************/ -/* I/O Permissions section */ -/***************************************************************************/ - -static Bool ExtendedEnabled = FALSE; - -Bool -xf86EnableIO() -{ - if (ExtendedEnabled) - return TRUE; - - if (amd64_iopl(TRUE) < 0) - { -#ifndef __OpenBSD__ - xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O", - "xf86EnableIO"); -#else - xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O\n%s", - "xf86EnableIO", SYSCTL_MSG); -#endif - return FALSE; - } - ExtendedEnabled = TRUE; - - return TRUE; -} - -void -xf86DisableIO() -{ - if (!ExtendedEnabled) - return; - - if (amd64_iopl(FALSE) == 0) { - ExtendedEnabled = FALSE; - } - /* Otherwise, the X server has revoqued its root uid, - and thus cannot give up IO privileges any more */ - - return; -} - -#endif /* USE_AMD64_IOPL */ - -#ifdef USE_DEV_IO -static int IoFd = -1; - -Bool -xf86EnableIO() -{ - if (IoFd >= 0) - return TRUE; - - if ((IoFd = open("/dev/io", O_RDWR)) == -1) - { - xf86Msg(X_WARNING,"xf86EnableIO: " - "Failed to open /dev/io for extended I/O"); - return FALSE; - } - return TRUE; -} - -void -xf86DisableIO() -{ - if (IoFd < 0) - return; - - close(IoFd); - IoFd = -1; - return; -} - -#endif - - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -Bool -xf86DisableInterrupts() -{ - -#ifdef __GNUC__ - __asm__ __volatile__("cli"); -#else - asm("cli"); -#endif /* __GNUC__ */ - - return(TRUE); -} - -void -xf86EnableInterrupts() -{ - -#ifdef __GNUC__ - __asm__ __volatile__("sti"); -#else - asm("sti"); -#endif /* __GNUC__ */ - - return; -} - - -#ifdef __NetBSD__ -/***************************************************************************/ -/* Set TV output mode */ -/***************************************************************************/ -void -xf86SetTVOut(int mode) -{ - switch (xf86Info.consType) - { -#ifdef PCCONS_SUPPORT - case PCCONS:{ - - if (ioctl (xf86Info.consoleFd, CONSOLE_X_TV_ON, &mode) < 0) - { - xf86Msg(X_WARNING, - "xf86SetTVOut: Could not set console to TV output, %s\n", - strerror(errno)); - } - } - break; -#endif /* PCCONS_SUPPORT */ - - default: - FatalError("Xf86SetTVOut: Unsupported console"); - break; - } - return; -} - -void -xf86SetRGBOut() -{ - switch (xf86Info.consType) - { -#ifdef PCCONS_SUPPORT - case PCCONS:{ - - if (ioctl (xf86Info.consoleFd, CONSOLE_X_TV_OFF, 0) < 0) - { - xf86Msg(X_WARNING, - "xf86SetTVOut: Could not set console to RGB output, %s\n", - strerror(errno)); - } - } - break; -#endif /* PCCONS_SUPPORT */ - - default: - FatalError("Xf86SetTVOut: Unsupported console"); - break; - } - return; -} -#endif - -#ifdef HAS_MTRR_SUPPORT -/* memory range (MTRR) support for FreeBSD */ - -/* - * This code is experimental. Some parts may be overkill, and other parts - * may be incomplete. - */ - -/* - * getAllRanges returns the full list of memory ranges with attributes set. - */ - -static struct mem_range_desc * -getAllRanges(int *nmr) -{ - struct mem_range_desc *mrd; - struct mem_range_op mro; - - /* - * Find how many ranges there are. If this fails, then the kernel - * probably doesn't have MTRR support. - */ - mro.mo_arg[0] = 0; - if (ioctl(devMemFd, MEMRANGE_GET, &mro)) - return NULL; - *nmr = mro.mo_arg[0]; - mrd = xnfalloc(*nmr * sizeof(struct mem_range_desc)); - mro.mo_arg[0] = *nmr; - mro.mo_desc = mrd; - if (ioctl(devMemFd, MEMRANGE_GET, &mro)) { - xfree(mrd); - return NULL; - } - return mrd; -} - -/* - * cleanMTRR removes any memory attribute that may be left by a previous - * X server. Normally there won't be any, but this takes care of the - * case where a server crashed without being able finish cleaning up. - */ - -static Bool -cleanMTRR() -{ - struct mem_range_desc *mrd; - struct mem_range_op mro; - int nmr, i; - - /* This shouldn't happen */ - if (devMemFd < 0) - return FALSE; - - if (!(mrd = getAllRanges(&nmr))) - return FALSE; - - for (i = 0; i < nmr; i++) { - if (strcmp(mrd[i].mr_owner, X_MTRR_ID) == 0 && - (mrd[i].mr_flags & MDF_ACTIVE)) { -#ifdef DEBUG - ErrorF("Clean for (0x%lx,0x%lx)\n", - (unsigned long)mrd[i].mr_base, - (unsigned long)rd[i].mr_len); -#endif - if (mrd[i].mr_flags & MDF_FIXACTIVE) { - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - mrd[i].mr_flags = MDF_UNCACHEABLE; - } else { - mro.mo_arg[0] = MEMRANGE_SET_REMOVE; - } - mro.mo_desc = mrd + i; - ioctl(devMemFd, MEMRANGE_SET, &mro); - } - } -#ifdef DEBUG - sleep(10); -#endif - xfree(mrd); - return TRUE; -} - -typedef struct x_RangeRec { - struct mem_range_desc mrd; - Bool wasWC; - struct x_RangeRec * next; -} RangeRec, *RangePtr; - -static void -freeRangeList(RangePtr range) -{ - RangePtr rp; - - while (range) { - rp = range; - range = rp->next; - xfree(rp); - } -} - -static RangePtr -dupRangeList(RangePtr list) -{ - RangePtr new = NULL, rp, p; - - rp = list; - while (rp) { - p = xnfalloc(sizeof(RangeRec)); - *p = *rp; - p->next = new; - new = p; - rp = rp->next; - } - return new; -} - -static RangePtr -sortRangeList(RangePtr list) -{ - RangePtr rp1, rp2, copy, sorted = NULL, minp, prev, minprev; - unsigned long minBase; - - /* Sort by base address */ - rp1 = copy = dupRangeList(list); - while (rp1) { - minBase = rp1->mrd.mr_base; - minp = rp1; - minprev = NULL; - prev = rp1; - rp2 = rp1->next; - while (rp2) { - if (rp2->mrd.mr_base < minBase) { - minBase = rp2->mrd.mr_base; - minp = rp2; - minprev = prev; - } - prev = rp2; - rp2 = rp2->next; - } - if (minprev) { - minprev->next = minp->next; - rp1 = copy; - } else { - rp1 = minp->next; - } - minp->next = sorted; - sorted = minp; - } - return sorted; -} - -/* - * findRanges returns a list of ranges that overlap the specified range. - */ - -static void -findRanges(unsigned long base, unsigned long size, RangePtr *ucp, RangePtr *wcp) -{ - struct mem_range_desc *mrd; - int nmr, i; - RangePtr rp, *p; - - if (!(mrd = getAllRanges(&nmr))) - return; - - for (i = 0; i < nmr; i++) { - if ((mrd[i].mr_flags & MDF_ACTIVE) && - mrd[i].mr_base < base + size && - mrd[i].mr_base + mrd[i].mr_len > base) { - if (mrd[i].mr_flags & MDF_WRITECOMBINE) - p = wcp; - else if (mrd[i].mr_flags & MDF_UNCACHEABLE) - p = ucp; - else - continue; - rp = xnfalloc(sizeof(RangeRec)); - rp->mrd = mrd[i]; - rp->next = *p; - *p = rp; - } - } - xfree(mrd); -} - -/* - * This checks if the existing overlapping ranges fully cover the requested - * range. Is this overkill? - */ - -static Bool -fullCoverage(unsigned long base, unsigned long size, RangePtr overlap) -{ - RangePtr rp1, sorted = NULL; - unsigned long end; - - sorted = sortRangeList(overlap); - /* Look for gaps */ - rp1 = sorted; - end = base + size; - while (rp1) { - if (rp1->mrd.mr_base > base) { - freeRangeList(sorted); - return FALSE; - } else { - base = rp1->mrd.mr_base + rp1->mrd.mr_len; - } - if (base >= end) { - freeRangeList(sorted); - return TRUE; - } - rp1 = rp1->next; - } - freeRangeList(sorted); - return FALSE; -} - -static pointer -addWC(int screenNum, unsigned long base, unsigned long size, MessageType from) -{ - RangePtr uc = NULL, wc = NULL, retlist = NULL; - struct mem_range_desc mrd; - struct mem_range_op mro; - - findRanges(base, size, &uc, &wc); - - /* See of the full range is already WC */ - if (!uc && fullCoverage(base, size, wc)) { - xf86DrvMsg(screenNum, from, - "Write-combining range (0x%lx,0x%lx) was already set\n", - base, size); - return NULL; - } - - /* Otherwise, try to add the new range */ - mrd.mr_base = base; - mrd.mr_len = size; - strcpy(mrd.mr_owner, X_MTRR_ID); - mrd.mr_flags = MDF_WRITECOMBINE; - mro.mo_desc = &mrd; - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - if (ioctl(devMemFd, MEMRANGE_SET, &mro)) { - xf86DrvMsg(screenNum, X_WARNING, - "Failed to set write-combining range " - "(0x%lx,0x%lx)\n", base, size); - return NULL; - } else { - xf86DrvMsg(screenNum, from, - "Write-combining range (0x%lx,0x%lx)\n", base, size); - retlist = xnfalloc(sizeof(RangeRec)); - retlist->mrd = mrd; - retlist->wasWC = FALSE; - retlist->next = NULL; - return retlist; - } -} - -static pointer -delWC(int screenNum, unsigned long base, unsigned long size, MessageType from) -{ - RangePtr uc = NULL, wc = NULL, retlist = NULL; - struct mem_range_desc mrd; - struct mem_range_op mro; - - findRanges(base, size, &uc, &wc); - - /* - * See of the full range is already not WC, or if there is full - * coverage from UC ranges. - */ - if (!wc || fullCoverage(base, size, uc)) { - xf86DrvMsg(screenNum, from, - "Write-combining range (0x%lx,0x%lx) was already clear\n", - base, size); - return NULL; - } - - /* Otherwise, try to add the new range */ - mrd.mr_base = base; - mrd.mr_len = size; - strcpy(mrd.mr_owner, X_MTRR_ID); - mrd.mr_flags = MDF_UNCACHEABLE; - mro.mo_desc = &mrd; - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - if (ioctl(devMemFd, MEMRANGE_SET, &mro)) { - xf86DrvMsg(screenNum, X_WARNING, - "Failed to remove write-combining range " - "(0x%lx,0x%lx)\n", base, size); - /* XXX Should then remove all of the overlapping WC ranges */ - return NULL; - } else { - xf86DrvMsg(screenNum, from, - "Removed Write-combining range (0x%lx,0x%lx)\n", - base, size); - retlist = xnfalloc(sizeof(RangeRec)); - retlist->mrd = mrd; - retlist->wasWC = TRUE; - retlist->next = NULL; - return retlist; - } -} - -static pointer -setWC(int screenNum, unsigned long base, unsigned long size, Bool enable, - MessageType from) -{ - if (enable) - return addWC(screenNum, base, size, from); - else - return delWC(screenNum, base, size, from); -} - -static void -undoWC(int screenNum, pointer list) -{ - RangePtr rp; - struct mem_range_op mro; - Bool failed; - - rp = list; - while (rp) { -#ifdef DEBUG - ErrorF("Undo for (0x%lx,0x%lx), %d\n", - (unsigned long)rp->mrd.mr_base, - (unsigned long)rp->mrd.mr_len, rp->wasWC); -#endif - failed = FALSE; - if (rp->wasWC) { - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - rp->mrd.mr_flags = MDF_WRITECOMBINE; - strcpy(rp->mrd.mr_owner, "unknown"); - } else { - mro.mo_arg[0] = MEMRANGE_SET_REMOVE; - } - mro.mo_desc = &rp->mrd; - - if (ioctl(devMemFd, MEMRANGE_SET, &mro)) { - if (!rp->wasWC) { - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - rp->mrd.mr_flags = MDF_UNCACHEABLE; - strcpy(rp->mrd.mr_owner, "unknown"); - if (ioctl(devMemFd, MEMRANGE_SET, &mro)) - failed = TRUE; - } else - failed = TRUE; - } - if (failed) { - xf86DrvMsg(screenNum, X_WARNING, - "Failed to restore MTRR range (0x%lx,0x%lx)\n", - (unsigned long)rp->mrd.mr_base, - (unsigned long)rp->mrd.mr_len); - } - rp = rp->next; - } -} - -#endif /* HAS_MTRR_SUPPORT */ - - -#if defined(HAS_MTRR_BUILTIN) && defined(__NetBSD__) -static pointer -NetBSDsetWC(int screenNum, unsigned long base, unsigned long size, Bool enable, - MessageType from) -{ - struct mtrr *mtrrp; - int n; - - xf86DrvMsg(screenNum, X_WARNING, - "%s MTRR %lx - %lx\n", enable ? "set" : "remove", - base, (base + size)); - - mtrrp = xnfalloc(sizeof (struct mtrr)); - mtrrp->base = base; - mtrrp->len = size; - mtrrp->type = MTRR_TYPE_WC; - - /* - * MTRR_PRIVATE will make this MTRR get reset automatically - * if this process exits, so we have no need for an explicit - * cleanup operation when starting a new server. - */ - - if (enable) - mtrrp->flags = MTRR_VALID | MTRR_PRIVATE; - else - mtrrp->flags = 0; - n = 1; - - if (i386_set_mtrr(mtrrp, &n) < 0) { - xfree(mtrrp); - return NULL; - } - return mtrrp; -} - -static void -NetBSDundoWC(int screenNum, pointer list) -{ - struct mtrr *mtrrp = (struct mtrr *)list; - int n; - - if (mtrrp == NULL) - return; - n = 1; - mtrrp->flags &= ~MTRR_VALID; - i386_set_mtrr(mtrrp, &n); - xfree(mtrrp); -} -#endif - -#if defined(__OpenBSD__) && defined(__amd64__) -static pointer -amd64setWC(int screenNum, unsigned long base, unsigned long size, Bool enable, - MessageType from) -{ - struct mtrr *mtrrp; - int n; - - xf86DrvMsg(screenNum, X_WARNING, - "%s MTRR %lx - %lx\n", enable ? "set" : "remove", - base, (base + size)); - - mtrrp = xnfalloc(sizeof (struct mtrr)); - mtrrp->base = base; - mtrrp->len = size; - mtrrp->type = MTRR_TYPE_WC; - - /* - * MTRR_PRIVATE will make this MTRR get reset automatically - * if this process exits, so we have no need for an explicit - * cleanup operation when starting a new server. - */ - - if (enable) - mtrrp->flags = MTRR_VALID | MTRR_PRIVATE; - else - mtrrp->flags = 0; - n = 1; - - if (amd64_set_mtrr(mtrrp, &n) < 0) { - xfree(mtrrp); - return NULL; - } - return mtrrp; -} - -static void -amd64undoWC(int screenNum, pointer list) -{ - struct mtrr *mtrrp = (struct mtrr *)list; - int n; - - if (mtrrp == NULL) - return; - n = 1; - mtrrp->flags &= ~MTRR_VALID; - amd64_set_mtrr(mtrrp, &n); - xfree(mtrrp); -} -#endif /* OpenBSD/amd64 */ - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/Imakefile deleted file mode 100644 index 15b784797..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/Imakefile +++ /dev/null @@ -1,10 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/libusb/Imakefile,v 1.1.2.1 1999/12/01 12:49:27 hohndel Exp $ - -#include - -SRCS = data.c descr.c parse.c usage.c -OBJS = data.o descr.o parse.o usage.o - -NormalLibraryObjectRule() -NormalLibraryTarget(usb,$(OBJS)) -DependTarget() diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/data.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/data.c deleted file mode 100644 index 0ac1a63bc..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/data.c +++ /dev/null @@ -1,95 +0,0 @@ -/* $NetBSD: data.c,v 1.6 1999/09/20 04:48:12 lukem Exp $ */ - -/* - * Copyright (c) 1999 Lennart Augustsson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/libusb/data.c,v 1.1.2.2 1999/12/03 10:12:41 hohndel Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "usb.h" - -int -hid_get_data(void *p, hid_item_t *h) -{ - unsigned char *buf; - unsigned int hpos; - unsigned int hsize; - int data; - int i, end, offs; - - _DIAGASSERT(p != NULL); - _DIAGASSERT(h != NULL); - - buf = p; - hpos = h->pos; /* bit position of data */ - hsize = h->report_size; /* bit length of data */ - - if (hsize == 0) - return (0); - offs = hpos / 8; - end = (hpos + hsize) / 8 - offs; - data = 0; - for (i = 0; i <= end; i++) - data |= buf[offs + i] << (i*8); - data >>= hpos % 8; - data &= (1 << hsize) - 1; - if (h->logical_minimum < 0) { - /* Need to sign extend */ - hsize = sizeof data * 8 - hsize; - data = (data << hsize) >> hsize; - } - return (data); -} - -void -hid_set_data(void *p, hid_item_t *h, int data) -{ - unsigned char *buf; - unsigned int hpos; - unsigned int hsize; - int i, end, offs; - - _DIAGASSERT(p != NULL); - _DIAGASSERT(h != NULL); - - buf = p; - hpos = h->pos; /* bit position of data */ - hsize = h->report_size; /* bit length of data */ - - if (hsize != 32) - data &= (1 << hsize) - 1; - data <<= (hpos % 8); - - offs = hpos / 8; - end = (hpos + hsize) / 8 - offs; - data = 0; - for (i = 0; i <= end; i++) - buf[offs + i] |= (data >> (i*8)) & 0xff; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/descr.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/descr.c deleted file mode 100644 index 2306d2f58..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/descr.c +++ /dev/null @@ -1,76 +0,0 @@ -/* $NetBSD: descr.c,v 1.7 1999/10/13 17:48:04 drochner Exp $ */ - -/* - * Copyright (c) 1999 Lennart Augustsson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/libusb/descr.c,v 1.1.2.2 1999/12/03 10:12:42 hohndel Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include "usb.h" -#include "usbvar.h" - -report_desc_t -hid_get_report_desc(fd) - int fd; -{ - struct usb_ctl_report_desc rep; - report_desc_t r; - - _DIAGASSERT(fd != -1); - - rep.size = 0; - if (ioctl(fd, USB_GET_REPORT_DESC, &rep) < 0) - return (0); - r = malloc(sizeof *r + rep.size); - if (r == 0) { - errno = ENOMEM; - return (0); - } - r->size = rep.size; - memcpy(r->data, rep.data, (unsigned int)rep.size); - return (r); -} - -void -hid_dispose_report_desc(r) - report_desc_t r; -{ - - free(r); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/parse.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/parse.c deleted file mode 100644 index feff9779a..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/parse.c +++ /dev/null @@ -1,404 +0,0 @@ -/* $NetBSD: parse.c,v 1.7 1999/10/13 17:48:04 drochner Exp $ */ - -/* - * Copyright (c) 1999 Lennart Augustsson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/libusb/parse.c,v 1.1.2.2 1999/12/03 10:12:42 hohndel Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include - -#include -#include - -#include "usb.h" -#include "usbvar.h" - -#define MAXUSAGE 100 -struct hid_data { - u_char *start; - u_char *end; - u_char *p; - hid_item_t cur; - unsigned int usages[MAXUSAGE]; - int nusage; - int minset; - int multi; - int multimax; - int kindset; -}; - -static int min(int x, int y) { return x < y ? x : y; } - -static void -hid_clear_local(hid_item_t *c) -{ - - _DIAGASSERT(c != NULL); - - c->usage = 0; - c->usage_minimum = 0; - c->usage_maximum = 0; - c->designator_index = 0; - c->designator_minimum = 0; - c->designator_maximum = 0; - c->string_index = 0; - c->string_minimum = 0; - c->string_maximum = 0; - c->set_delimiter = 0; -} - -hid_data_t -hid_start_parse(report_desc_t d, int kindset) -{ - struct hid_data *s; - - _DIAGASSERT(d != NULL); - - s = malloc(sizeof *s); - memset(s, 0, sizeof *s); - s->start = s->p = d->data; - s->end = d->data + d->size; - s->kindset = kindset; - return (s); -} - -void -hid_end_parse(hid_data_t s) -{ - - _DIAGASSERT(s != NULL); - - while (s->cur.next) { - hid_item_t *hi = s->cur.next->next; - free(s->cur.next); - s->cur.next = hi; - } - free(s); -} - -int -hid_get_item(hid_data_t s, hid_item_t *h) -{ - hid_item_t *c; - unsigned int bTag = 0, bType = 0, bSize; - unsigned char *data; - int dval; - unsigned char *p; - hid_item_t *hi; - int i; - - _DIAGASSERT(s != NULL); - _DIAGASSERT(h != NULL); - - c = &s->cur; - - top: - if (s->multimax) { - if (s->multi < s->multimax) { - c->usage = s->usages[min(s->multi, s->nusage-1)]; - s->multi++; - *h = *c; - c->pos += c->report_size; - h->next = 0; - return (1); - } else { - c->report_count = s->multimax; - s->multimax = 0; - s->nusage = 0; - hid_clear_local(c); - } - } - for (;;) { - p = s->p; - if (p >= s->end) - return (0); - - bSize = *p++; - if (bSize == 0xfe) { - /* long item */ - bSize = *p++; - bSize |= *p++ << 8; - bTag = *p++; - data = p; - p += bSize; - } else { - /* short item */ - bTag = bSize >> 4; - bType = (bSize >> 2) & 3; - bSize &= 3; - if (bSize == 3) bSize = 4; - data = p; - p += bSize; - } - s->p = p; - /* - * The spec is unclear if the data is signed or unsigned. - */ - switch(bSize) { - case 0: - dval = 0; - break; - case 1: - dval = (int8_t)*data++; - break; - case 2: - dval = *data++; - dval |= *data++ << 8; - dval = (int16_t)dval; - break; - case 4: - dval = *data++; - dval |= *data++ << 8; - dval |= *data++ << 16; - dval |= *data++ << 24; - break; - default: - return (-1); - } - - switch (bType) { - case 0: /* Main */ - switch (bTag) { - case 8: /* Input */ - if (!(s->kindset & (1 << hid_input))) - continue; - c->kind = hid_input; - c->flags = dval; - ret: - if (c->flags & HIO_VARIABLE) { - s->multimax = c->report_count; - s->multi = 0; - c->report_count = 1; - if (s->minset) { - for (i = c->usage_minimum; - i <= c->usage_maximum; - i++) { - s->usages[s->nusage] = i; - if (s->nusage < MAXUSAGE-1) - s->nusage++; - } - s->minset = 0; - } - goto top; - } else { - if (s->minset) - c->usage = c->usage_minimum; - *h = *c; - h->next = 0; - c->pos += c->report_size * c->report_count; - hid_clear_local(c); - s->minset = 0; - return (1); - } - case 9: /* Output */ - if (!(s->kindset & (1 << hid_output))) - continue; - c->kind = hid_output; - c->flags = dval; - goto ret; - case 10: /* Collection */ - c->kind = hid_collection; - c->collection = dval; - c->collevel++; - *h = *c; - hid_clear_local(c); - s->nusage = 0; - return (1); - case 11: /* Feature */ - if (!(s->kindset & (1 << hid_feature))) - continue; - c->kind = hid_feature; - c->flags = dval; - goto ret; - case 12: /* End collection */ - c->kind = hid_endcollection; - c->collevel--; - *h = *c; - hid_clear_local(c); - s->nusage = 0; - return (1); - default: - return (-2); - } - - case 1: /* Global */ - switch (bTag) { - case 0: - c->_usage_page = dval << 16; - break; - case 1: - c->logical_minimum = dval; - break; - case 2: - c->logical_maximum = dval; - break; - case 3: - c->physical_maximum = dval; - break; - case 4: - c->physical_maximum = dval; - break; - case 5: - c->unit_exponent = dval; - break; - case 6: - c->unit = dval; - break; - case 7: - c->report_size = dval; - break; - case 8: - c->report_ID = dval; - break; - case 9: - c->report_count = dval; - break; - case 10: /* Push */ - hi = malloc(sizeof *hi); - *hi = s->cur; - c->next = hi; - break; - case 11: /* Pop */ - hi = c->next; - s->cur = *hi; - free(hi); - break; - default: - return (-3); - } - break; - case 2: /* Local */ - switch (bTag) { - case 0: - if (bSize == 1) - dval = c->_usage_page | (dval&0xff); - else if (bSize == 2) - dval = c->_usage_page | (dval&0xffff); - c->usage = dval; - if (s->nusage < MAXUSAGE) - s->usages[s->nusage++] = dval; - /* else XXX */ - break; - case 1: - s->minset = 1; - if (bSize == 1) - dval = c->_usage_page | (dval&0xff); - else if (bSize == 2) - dval = c->_usage_page | (dval&0xffff); - c->usage_minimum = dval; - break; - case 2: - if (bSize == 1) - dval = c->_usage_page | (dval&0xff); - else if (bSize == 2) - dval = c->_usage_page | (dval&0xffff); - c->usage_maximum = dval; - break; - case 3: - c->designator_index = dval; - break; - case 4: - c->designator_minimum = dval; - break; - case 5: - c->designator_maximum = dval; - break; - case 7: - c->string_index = dval; - break; - case 8: - c->string_minimum = dval; - break; - case 9: - c->string_maximum = dval; - break; - case 10: - c->set_delimiter = dval; - break; - default: - return (-4); - } - break; - default: - return (-5); - } - } -} - -int -hid_report_size(report_desc_t r, enum hid_kind k, int *idp) -{ - struct hid_data *d; - hid_item_t h; - int size, id; - - _DIAGASSERT(r != NULL); - /* idp may be NULL */ - - id = 0; - if (idp) - *idp = 0; - memset(&h, 0, sizeof h); - for (d = hid_start_parse(r, 1<kind == k && !(h->flags & HIO_CONST) && h->usage == u) { - hid_end_parse(d); - return (1); - } - } - hid_end_parse(d); - h->report_size = 0; - return (0); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usage.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usage.c deleted file mode 100644 index f909ee691..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usage.c +++ /dev/null @@ -1,199 +0,0 @@ -/* $NetBSD: usage.c,v 1.4 1999/07/02 15:46:53 simonb Exp $ */ - -/* - * Copyright (c) 1999 Lennart Augustsson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/libusb/usage.c,v 1.1.2.2 1999/12/03 10:12:42 hohndel Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include - -#include "usb.h" - -#define _PATH_HIDTABLE "/usr/share/misc/usb_hid_usages" - -struct usage_in_page { - char *name; - int usage; -}; - -static struct usage_page { - char *name; - int usage; - struct usage_in_page *page_contents; - int pagesize, pagesizemax; -} *pages; -static int npages, npagesmax; - -#ifdef DEBUG -void -dump_hid_table(void) -{ - int i, j; - - for (i = 0; i < npages; i++) { - printf("%d\t%s\n", pages[i].usage, pages[i].name); - for (j = 0; j < pages[i].pagesize; j++) { - printf("\t%d\t%s\n", pages[i].page_contents[j].usage, - pages[i].page_contents[j].name); - } - } -} -#endif - -void -hid_init(char *hidname) -{ - FILE *f; - char line[100], name[100], *p, *n; - int no; - int lineno; - struct usage_page *curpage = 0; - - if (hidname == 0) - hidname = _PATH_HIDTABLE; - - f = fopen(hidname, "r"); - if (f == NULL) - err(1, "%s", hidname); - for (lineno = 1; ; lineno++) { - if (fgets(line, sizeof line, f) == NULL) - break; - if (line[0] == '#') - continue; - for (p = line; *p && isspace(*p); p++) - ; - if (!*p) - continue; - if (sscanf(line, " * %[^\n]", name) == 1) - no = -1; - else if (sscanf(line, " 0x%x %[^\n]", &no, name) != 2 && - sscanf(line, " %d %[^\n]", &no, name) != 2) - errx(1, "file %s, line %d, syntax error\n", - hidname, lineno); - for (p = name; *p; p++) - if (isspace(*p) || *p == '.') - *p = '_'; - n = strdup(name); - if (!n) - err(1, "strdup"); - if (isspace(line[0])) { - if (!curpage) - errx(1, "file %s, line %d, syntax error\n", - hidname, lineno); - if (curpage->pagesize >= curpage->pagesizemax) { - curpage->pagesizemax += 10; - curpage->page_contents = - realloc(curpage->page_contents, - curpage->pagesizemax * - sizeof (struct usage_in_page)); - if (!curpage->page_contents) - err(1, "realloc"); - } - curpage->page_contents[curpage->pagesize].name = n; - curpage->page_contents[curpage->pagesize].usage = no; - curpage->pagesize++; - } else { - if (npages >= npagesmax) { - if (pages == 0) { - npagesmax = 5; - pages = malloc(npagesmax * - sizeof (struct usage_page)); - } else { - npagesmax += 5; - pages = realloc(pages, - npagesmax * - sizeof (struct usage_page)); - } - if (!pages) - err(1, "alloc"); - } - curpage = &pages[npages++]; - curpage->name = n; - curpage->usage = no; - curpage->pagesize = 0; - curpage->pagesizemax = 10; - curpage->page_contents = - malloc(curpage->pagesizemax * - sizeof (struct usage_in_page)); - if (!curpage->page_contents) - err(1, "malloc"); - } - } - fclose(f); -#ifdef DEBUG - dump_hid_table(); -#endif -} - -char * -hid_usage_page(int i) -{ - static char b[10]; - int k; - - if (!pages) - errx(1, "no hid table\n"); - - for (k = 0; k < npages; k++) - if (pages[k].usage == i) - return pages[k].name; - sprintf(b, "0x%02x", i); - return b; -} - -char * -hid_usage_in_page(unsigned int u) -{ - int page = HID_PAGE(u); - int i = HID_USAGE(u); - static char b[100]; - int j, k, us; - - for (k = 0; k < npages; k++) - if (pages[k].usage == page) - break; - if (k >= npages) - goto bad; - for (j = 0; j < pages[k].pagesize; j++) { - us = pages[k].page_contents[j].usage; - if (us == -1) { - sprintf(b, pages[k].page_contents[j].name, i); - return b; - } - if (us == i) - return pages[k].page_contents[j].name; - } - bad: - sprintf(b, "0x%02x", i); - return b; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usb.3 b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usb.3 deleted file mode 100644 index db0b1b08f..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usb.3 +++ /dev/null @@ -1,191 +0,0 @@ -.\" $NetBSD: usb.3,v 1.9 1999/11/08 22:33:40 augustss Exp $ -.\" -.\" Copyright (c) 1999 Lennart Augustsson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $XFree86: xc/programs/Xserver/hw/xfree86/os-support/libusb/usb.3,v 1.1.2.2 1999/12/03 10:12:42 hohndel Exp $ -.\" -.Dd May 11, 1999 -.Dt USB 3 -.Os -.Sh NAME -.Nm usb , -.Nm hid_get_report_desc , -.Nm hid_dispose_report_desc , -.Nm hid_start_parse , -.Nm hid_end_parse , -.Nm hid_get_item , -.Nm hid_report_size , -.Nm hid_locate , -.Nm hid_usage_page , -.Nm hid_usage_in_page , -.Nm hid_init , -.Nm hid_get_data , -.Nm hid_set_data -.Nd USB HID access routines -.Sh LIBRARY -.Lb libusb -.Sh SYNOPSIS -.Fd #include -.Ft report_desc_t -.Fn hid_get_report_desc "int file" -.Ft void -.Fn hid_dispose_report_desc "report_desc_t d" -.Ft hid_data_t -.Fn hid_start_parse "report_desc_t d" "int kindset" -.Ft void -.Fn hid_end_parse "hid_data_t s" -.Ft int -.Fn hid_get_item "hid_data_t s" "hid_item_t *h" -.Ft int -.Fn hid_report_size "report_desc_t d" "hid_kind_t k" "int *idp" -.Ft int -.Fn hid_locate "report_desc_t d" "u_int usage" "hid_kind_t k" "hid_item_t *h" -.Ft char * -.Fn hid_usage_page "int i" -.Ft char * -.Fn hid_usage_in_page "u_int u" -.Ft void -.Fn hid_init "char *file" -.Ft int -.Fn hid_get_data "void *data" "hid_item_t *h" -.Ft void -.Fn hid_set_data "void *data" "hid_item_t *h" "u_int data" -.Sh DESCRIPTION -The -.Nm -library provides routines to extract data from USB Human Interface Devices. -.Ss INTRODUCTION -USB HID devices send and receive data layed out a device dependent -way. The -.Nm -library contains routines to extract the -.Em report descriptor -which contains the data layout information and then use this information. -.Pp -The routines can be divided into four parts: extraction of the descriptor, -parsing of the descriptor, translating to/from symbolic names, and -data manipulation. -.Ss DESCRIPTOR FUNCTIONS -A report descriptor can be obtained by calling -.Fn hid_get_report_desc -with a file descriptor obtained by opening a -.Xr uhid 4 -device. -When the report descriptor is no longer needed it should be freed -by calling -.Fn hid_dispose_report_desc . -The type -.Fa report_desc_t -is opaque and should be used when calling the parsing functions. -.Ss DESCRIPTOR PARSING FUNCTIONS -To parse the report descriptor the -.Fn hid_start_parse -function should be called with a report descriptor and a set that -describes which items that are interesting. The set is obtained -by oring together values -.Fa "(1 << k)" -where -.Fa k -is an item of type -.Fa hid_kind_t . -The function returns -.Fa NULL -if the initialization fails, otherwise an opaque value to be used -in subsequent calls. -After parsing the -.Fn hid_end_parse -function should be called to free internal data structures. -.Pp -To iterate through all the items in the report descriptor -.Fn hid_get_item -should be called while it returns a value greater than 0. -When the report descriptor ends it will returns 0; a syntax -error within the report descriptor will cause a return value less -than 0. -The struct pointed to by -.Fa h -will be filled with the relevant data for the item. -The definition of -.Fa hid_item_t -can be found in -.Pa -and the meaning of the components in the USB HID documentation. -.Pp -Data should be read/written to the device in the size of -the report. The size of a report (of a certain kind) can be -computed by the -.Fn hid_report_size -function. If the report is prefixed by an ID byte it is -stored at -.Fa idp , -otherwise it will contain 0. -.Pp -To locate a single item the -.Fn hid_locate -function can be used. It should be given the usage code of -the item and its kind and it will fill the item and return -non-zero if the item was found. -.Pp -.Ss NAME TRANSLATION FUNCTIONS -The function -.Fn hid_usage_page -will return the symbolic name of a usage page, and the function -.Fn hid_usage_in_page -will return the symbolic name of the usage within the page. -Both these functions may return a pointer to static data. -Before either of these functions can be called the usage table -must be parsed, this is done by calling -.Fn hid_init -with the name of the table. Passing -.Fa NULL -to this function will cause it to use the default table. -.Ss DATA EXTRACTION FUNCTIONS -Given the data obtained from a HID device and an item in the -report descriptor the -.Fn hid_get_data -function extracts the value of the item. -Conversely -.Fn hid_set_data -can be used to put data into a report (which must be zeroed first). -.Sh EXAMPLE -Not yet. -.Sh FILES -.Pa /usr/share/misc/usb_hid_usages -The default HID usage table. -.Sh BUGS -This man page is woefully incomplete. -.Sh SEE ALSO -The -.Tn USB -specifications can be found at -.Dv http://www.usb.org/developers/docs.htm . -.Pp -.Xr hid 4 , -.Xr usb 4 . -.Sh HISTORY -The -.Nm -library first appeared in -.Nx 1.5 . diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usb.h b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usb.h deleted file mode 100644 index 445428118..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usb.h +++ /dev/null @@ -1,95 +0,0 @@ -/* $NetBSD: usb.h,v 1.5 1999/07/02 15:46:53 simonb Exp $ */ - -/* - * Copyright (c) 1999 Lennart Augustsson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/libusb/usb.h,v 1.1.2.2 1999/12/03 10:12:43 hohndel Exp $ */ - -#define _DIAGASSERT(e) assert(e) - -typedef struct report_desc *report_desc_t; - -typedef struct hid_data *hid_data_t; - -typedef enum hid_kind { - hid_input, hid_output, hid_feature, hid_collection, hid_endcollection -}hid_kind_t; - -typedef struct hid_item { - /* Global */ - int _usage_page; - int logical_minimum; - int logical_maximum; - int physical_minimum; - int physical_maximum; - int unit_exponent; - int unit; - int report_size; - int report_ID; - int report_count; - /* Local */ - unsigned int usage; - int usage_minimum; - int usage_maximum; - int designator_index; - int designator_minimum; - int designator_maximum; - int string_index; - int string_minimum; - int string_maximum; - int set_delimiter; - /* Misc */ - int collection; - int collevel; - enum hid_kind kind; - unsigned int flags; - /* Absolute data position (bits) */ - unsigned int pos; - /* */ - struct hid_item *next; -} hid_item_t; - -#define HID_PAGE(u) ((u) >> 16) -#define HID_USAGE(u) ((u) & 0xffff) - -/* Obtaining a report descriptor, descr.c: */ -report_desc_t hid_get_report_desc __P((int file)); -void hid_dispose_report_desc __P((report_desc_t)); - -/* Parsing of a HID report descriptor, parse.c: */ -hid_data_t hid_start_parse __P((report_desc_t d, int kindset)); -void hid_end_parse __P((hid_data_t s)); -int hid_get_item __P((hid_data_t s, hid_item_t *h)); -int hid_report_size __P((report_desc_t d, enum hid_kind k, int *idp)); -int hid_locate __P((report_desc_t d, unsigned int usage, enum hid_kind k, hid_item_t *h)); - -/* Conversion to/from usage names, usage.c: */ -char *hid_usage_page __P((int i)); -char *hid_usage_in_page __P((unsigned int u)); -void hid_init __P((char *file)); - -/* Extracting/insertion of data, data.c: */ -int hid_get_data __P((void *p, hid_item_t *h)); -void hid_set_data __P((void *p, hid_item_t *h, int data)); diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usb_hid_usages b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usb_hid_usages deleted file mode 100644 index 02f122028..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usb_hid_usages +++ /dev/null @@ -1,1079 +0,0 @@ -# $NetBSD: usb_hid_usages,v 1.3 1999/07/02 15:46:53 simonb Exp $ -# -# USB HID usage table -# Syntax: -# - lines that do not start with a white space give the number and name of -# a usage page. -# - lines that start with a white space give the number and name of -# a usage with the last given page. -# If the number is * then the line matches all usages and the name -# is a printf formatting string that will be given the usage number. -# -# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/libusb/usb_hid_usages,v 1.1.2.2 1999/12/03 10:12:43 hohndel Exp $ -# -1 Generic Desktop - 0x00 Undefined - 0x01 Pointer - 0x02 Mouse - 0x03 Reserved - 0x04 Joystick - 0x05 Game Pad - 0x06 Keyboard - 0x07 Keypad - 0x08 Multi-axis Controller - 0x30 X - 0x31 Y - 0x32 Z - 0x33 Rx - 0x34 Ry - 0x35 Rz - 0x36 Slider - 0x37 Dial - 0x38 Wheel - 0x39 Hat Switch - 0x3A Counted Buffer - 0x3B Byte Count - 0x3C Motion Wakeup - 0x40 Vx - 0x41 Vy - 0x42 Vz - 0x43 Vbrx - 0x44 Vbry - 0x45 Vbrx - 0x46 Vno - 0x80 System Control - 0x81 System Power Down - 0x82 System Sleep - 0x83 System Wake Up - 0x84 System Context Menu - 0x85 System Main Menu - 0x86 System App Menu - 0x87 System Menu Help - 0x88 System Menu Exit - 0x89 System Menu Select - 0x8A System Menu Right - 0x8B System Menu Left - 0x8C System Menu Up - 0x8D System Menu Down - 0x90 D-pad Up - 0x91 D-pad Down - 0x92 D-pad Right - 0x93 D-pad Left - -2 Simulation Controls - 0x00 Undefined - 0x01 Flight Simulation Device - 0x02 Automobile Simulation Device - 0x03 Tank Simulation Device - 0x04 Spaceship Simulation Device - 0x05 Submarine Simulation Device - 0x06 Sailing Simulation Device - 0x07 Motorcycle Simulation Device - 0x08 Sports Simulation Device - 0x09 Airplane Simulation Device - 0x0A Helicopter Simulation Device - 0x0B Magic Carpet Simulation Device - 0x0C Bicycle - 0x20 Flight Control Stick - 0x21 Flight Stick - 0x22 Cyclic Control - 0x23 Cyclic Trim - 0x24 Flight Yoke - 0x25 Track Control - 0x26 Driving Control - 0xB0 Aileron - 0xB1 Aileron Trim - 0xB2 Anti-Torque Control - 0xB3 Auto-pilot Enable - 0xB4 Chaff Release - 0xB5 Collective Control - 0xB6 Dive Brake - 0xB7 Electronic Counter Measures - 0xB8 Elevator - 0xB9 Elevator Trim - 0xBA Rudder - 0xBB Throttle - 0xBC Flight Communication - 0xBD Flare Release - 0xBE Landing Gear - 0xBF Toe Brake - 0xC0 Trigger - 0xC1 Weapons Arm - 0xC2 Weapons Select - 0xC3 Wing Flaps - 0xC4 Accelerator - 0xC5 Brake - 0xC6 Clutch - 0xC7 Shifter - 0xC8 Steering - 0xC9 Turret Direction - 0xCA Barrel Elevation - 0xCB Dive Plane - 0xCC Ballast - 0xCD Bicycle Crank - 0xCE Handle Bars - 0xCF Front Brake - 0xD0 Rear Brake - -3 VR Controls - 0x00 Unidentified - 0x01 Belt - 0x02 Body Suit - 0x03 Flexor - 0x04 Glove - 0x05 Head Tracker - 0x06 Head Mounted Display - 0x07 Hand Tracker - 0x08 Oculometer - 0x09 Vest - 0x0A Animatronic Device - 0x20 Stereo Enable - 0x21 Display Enable - -4 Sports Controls - 0x00 Unidentified - 0x01 Baseball Bat - 0x02 Golf Club - 0x03 Rowing Machine - 0x04 Treadmill - 0x30 Oar - 0x31 Slope - 0x32 Rate - 0x33 Stick Speed - 0x34 Stick Face Angle - 0x35 Stick Heel/Toe - 0x36 Stick Follow Through - 0x37 Stick Tempo - 0x38 Stick Type - 0x39 Stick Height - 0x50 Putter - 0x51 1 Iron - 0x52 2 Iron - 0x53 3 Iron - 0x54 4 Iron - 0x55 5 Iron - 0x56 6 Iron - 0x57 7 Iron - 0x58 8 Iron - 0x59 9 Iron - 0x5A 10 Iron - 0x5B 11 Iron - 0x5C Sand Wedge - 0x5D Loft Wedge - 0x5E Power Wedge - 0x5F 1 Wood - 0x60 3 Wood - 0x61 5 Wood - 0x62 7 Wood - 0x63 9 Wood - -5 Game Controls - 0x00 Undefined - 0x01 3D Game Controller - 0x02 Pinball Device - 0x03 Gun Device - 0x20 Point of View - 0x21 Turn Right/Left - 0x22 Pitch Right/Left - 0x23 Roll Forward/Backward - 0x24 Move Right/Left - 0x25 Move Forward/Backward - 0x26 Move Up/Down - 0x27 Lean Right/Left - 0x28 Lean Forward/Backward - 0x29 Height of POV - 0x2A Flipper - 0x2B Secondary Flipper - 0x2C Bump - 0x2D New Game - 0x2E Shoot Ball - 0x2F Player - 0x30 Gun Bolt - 0x31 Gun Clip - 0x32 Gun Selector - 0x33 Gun Single Shot - 0x34 Gun Burst - 0x35 Gun Automatic - 0x36 Gun Safety - 0x37 Gamepad Fire/Jump - 0x39 Gamepad Trigger - -7 Keyboard - 0x00 Reserved (no event indicated) - 0x01 Keyboard ErrorRollOver - 0x02 Keyboard POSTFail - 0x03 Keyboard ErrorUndefined - 0x04 Keyboard a and A - 0x05 Keyboard b and B - 0x06 Keyboard c and C - 0x07 Keyboard d and D - 0x08 Keyboard e and E - 0x09 Keyboard f and F - 0x0A Keyboard g and G - 0x0B Keyboard h and H - 0x0C Keyboard i and I - 0x0D Keyboard j and J - 0x0E Keyboard k and K - 0x0F Keyboard l and L - 0x10 Keyboard m and M - 0x11 Keyboard n and N - 0x12 Keyboard o and O - 0x13 Keyboard p and P - 0x14 Keyboard q and Q - 0x15 Keyboard r and R - 0x16 Keyboard s and S - 0x17 Keyboard t and T - 0x18 Keyboard u and U - 0x19 Keyboard v and V - 0x1A Keyboard w and W - 0x1B Keyboard x and X - 0x1C Keyboard y and Y - 0x1D Keyboard z and Z - 0x1E Keyboard 1 and ! - 0x1F Keyboard 2 and @ - 0x20 Keyboard 3 and # - 0x21 Keyboard 4 and $ - 0x22 Keyboard 5 and % - 0x23 Keyboard 6 and ^ - 0x24 Keyboard 7 and & - 0x25 Keyboard 8 and * - 0x26 Keyboard 9 and ( - 0x27 Keyboard 0 and ) - 0x28 Keyboard Return (ENTER) - 0x29 Keyboard ESCAPE - 0x2A Keyboard DELETE (Backspace) - 0x2B Keyboard Tab - 0x2C Keyboard Spacebar - 0x2D Keyboard - and (underscore) - 0x2E Keyboard = and + - 0x2F Keyboard [ and { - 0x30 Keyboard ] and } - 0x31 Keyboard \ and | - 0x32 Keyboard Non-US # and ~ - 0x33 Keyboard ; and : - 0x34 Keyboard ' and " - 0x35 Keyboard Grave Accent and Tilde - 0x36 Keyboard, and < - 0x37 Keyboard . and > - 0x38 Keyboard / and ? - 0x39 Keyboard Caps Lock - 0x3A Keyboard F1 - 0x3B Keyboard F2 - 0x3C Keyboard F3 - 0x3D Keyboard F4 - 0x3E Keyboard F5 - 0x3F Keyboard F6 - 0x40 Keyboard F7 - 0x41 Keyboard F8 - 0x42 Keyboard F9 - 0x43 Keyboard F10 - 0x44 Keyboard F11 - 0x45 Keyboard F12 - 0x46 Keyboard PrintScreen - 0x47 Keyboard Scroll Lock - 0x48 Keyboard Pause - 0x49 Keyboard Insert - 0x4A Keyboard Home - 0x4B Keyboard PageUp - 0x4C Keyboard Delete Forward - 0x4D Keyboard End - 0x4E Keyboard PageDown - 0x4F Keyboard RightArrow - 0x50 Keyboard LeftArrow - 0x51 Keyboard DownArrow - 0x52 Keyboard UpArrow - 0x53 Keypad Num Lock and Clear - 0x54 Keypad / - 0x55 Keypad * - 0x56 Keypad - - 0x57 Keypad + - 0x58 Keypad ENTER - 0x59 Keypad 1 and End - 0x5A Keypad 2 and Down Arrow - 0x5B Keypad 3 and PageDn - 0x5C Keypad 4 and Left Arrow - 0x5D Keypad 5 - 0x5E Keypad 6 and Right Arrow - 0x5F Keypad 7 and Home - 0x60 Keypad 8 and Up Arrow - 0x61 Keypad 9 and PageUp - 0x62 Keypad 0 and Insert - 0x63 Keypad . and Delete - 0x64 Keyboard Non-US \ and | - 0x65 Keyboard Application - 0x66 Keyboard Power - 0x67 Keypad = - 0x68 Keyboard F13 - 0x69 Keyboard F14 - 0x6A Keyboard F15 - 0x6B Keyboard F16 - 0x6C Keyboard F17 - 0x6D Keyboard F18 - 0x6E Keyboard F19 - 0x6F Keyboard F20 - 0x70 Keyboard F21 - 0x71 Keyboard F22 - 0x72 Keyboard F23 - 0x73 Keyboard F24 - 0x74 Keyboard Execute - 0x75 Keyboard Help - 0x76 Keyboard Menu - 0x77 Keyboard Select - 0x78 Keyboard Stop - 0x79 Keyboard Again - 0x7A Keyboard Undo - 0x7B Keyboard Cut - 0x7C Keyboard Copy - 0x7D Keyboard Paste - 0x7E Keyboard Find - 0x7F Keyboard Mute - 0x80 Keyboard Volume Up - 0x81 Keyboard Volume Down - 0x82 Keyboard Locking Caps Lock - 0x83 Keyboard Locking Num Lock - 0x84 Keyboard Locking Scroll Lock - 0x85 Keypad Comma - 0x86 Keypad Equal Sign - 0x87 Keyboard International1 - 0x88 Keyboard International2 - 0x89 Keyboard International3 - 0x8A Keyboard International4 - 0x8B Keyboard International5 - 0x8C Keyboard International6 - 0x8D Keyboard International7 - 0x8E Keyboard International8 - 0x8F Keyboard International9 - 0x90 Keyboard LANG1 - 0x91 Keyboard LANG2 - 0x92 Keyboard LANG3 - 0x93 Keyboard LANG4 - 0x94 Keyboard LANG5 - 0x95 Keyboard LANG6 - 0x96 Keyboard LANG7 - 0x97 Keyboard LANG8 - 0x98 Keyboard LANG9 - 0x99 Keyboard Alternate Erase - 0x9A Keyboard SysReq/Attention - 0x9B Keyboard Cancel - 0x9C Keyboard Clear - 0x9D Keyboard Prior - 0x9E Keyboard Return - 0x9F Keyboard Separator - 0xA0 Keyboard Out - 0xA1 Keyboard Oper - 0xA2 Keyboard Clear/Again - 0xA3 Keyboard CrSel/Props - 0xA4 Keyboard ExSel - 0xE0 Keyboard LeftControl - 0xE1 Keyboard LeftShift - 0xE2 Keyboard LeftAlt - 0xE3 Keyboard Left GUI - 0xE4 Keyboard RightControl - 0xE5 Keyboard RightShift - 0xE6 Keyboard RightAlt - 0xE7 Keyboard Right GUI - -8 LEDs - 0x00 Undefined - 0x01 Num Lock - 0x02 Caps Lock - 0x03 Scroll Lock - 0x04 Compose - 0x05 Kana - 0x06 Power - 0x07 Shift - 0x08 Do Not Disturb - 0x09 Mute - 0x0A Tone Enable - 0x0B High Cut Filter - 0x0C Low Cut Filter - 0x0D Equalizer Enable - 0x0E Sound Field On - 0x0F Surround Field On - 0x10 Repeat - 0x11 Stereo - 0x12 Sampling Rate Detect - 0x13 Spinning - 0x14 CAV - 0x15 CLV - 0x16 Recording Format Detect - 0x17 Off-Hook - 0x18 Ring - 0x19 Message Waiting - 0x1A Data Mode - 0x1B Battery Operation - 0x1C Battery OK - 0x1D Battery Low - 0x1E Speaker - 0x1F Head Set - 0x20 Hold - 0x21 Microphone - 0x22 Coverage - 0x23 Night Mode - 0x24 Send Calls - 0x25 Call Pickup - 0x26 Conference - 0x27 Stand-by - 0x28 Camera On - 0x29 Camera Off - 0x2A On-Line - 0x2B Off-Line - 0x2C Busy - 0x2D Ready - 0x2E Paper-Out - 0x2F Paper-Jam - 0x30 Remote - 0x31 Forward - 0x32 Reverse - 0x33 Stop - 0x34 Rewind - 0x35 Fast Forward - 0x36 Play - 0x37 Pause - 0x38 Record - 0x39 Error - 0x3A Usage Selected Indicator - 0x3B Usage In Use Indicator - 0x3C Usage Multi Mode Indicator - 0x3D Indicator On - 0x3E Indicator Flash - 0x3F Indicator Slow Blink - 0x40 Indicator Fast Blink - 0x41 Indicator Off - 0x42 Flash On Time - 0x43 Slow Blink On Time - 0x44 Slow Blink Off Time - 0x45 Fast Blink On Time - 0x46 Fast Blink Off Time - 0x47 Usage Indicator Color - 0x48 Red - 0x49 Green - 0x4A Amber - 0x4B Generic Indicator - 0x4C System Suspend - 0x4D External Power Connected - 0x4C-FFFF Reserved - -9 Button - 0x00 No Button Pressed - * Button %d - -10 Ordinal - 0x00 Unused - * Instance %d - -11 Telephony - 0x00 Unassigned - 0x01 Phone - 0x02 Answering Machine - 0x03 Message Controls - 0x04 Handset - 0x05 Headset - 0x06 Telephony Key Pad - 0x07 Programmable Button - 0x20 Hook Switch - 0x21 Flash - 0x22 Feature - 0x23 Hold - 0x24 Redial - 0x25 Transfer - 0x26 Drop - 0x27 Park - 0x28 Forward Calls - 0x29 Alternate Function - 0x2A Line - 0x2B Speaker Phone - 0x2C Conference - 0x2D Ring Enable - 0x2E Ring Select - 0x2F Phone Mute - 0x30 Caller ID - 0x50 Speed Dial - 0x51 Store Number - 0x52 Recall Number - 0x53 Phone Directory - 0x70 Voice Mail - 0x71 Screen Calls - 0x72 Do Not Disturb - 0x73 Message - 0x74 Answer On/Off - 0x90 Inside Dial Tone - 0x91 Outside Dial Tone - 0x92 Inside Ring Tone - 0x93 Outside Ring Tone - 0x94 Priority Ring Tone - 0x95 Inside Ringback - 0x96 Priority Ringback - 0x97 Line Busy Tone - 0x98 Reorder Tone - 0x99 Call Waiting Tone - 0x9A Confirmation Tone 1 - 0x9B Confirmation Tone 2 - 0x9C Tones Off - 0xB0 Phone Key 0 - 0xB1 Phone Key 1 - 0xB2 Phone Key 2 - 0xB3 Phone Key 3 - 0xB4 Phone Key 4 - 0xB5 Phone Key 5 - 0xB6 Phone Key 6 - 0xB7 Phone Key 7 - 0xB8 Phone Key 8 - 0xB9 Phone Key 9 - 0xBA Phone Key Star - 0xBB Phone Key Pound - 0xBC Phone Key A - 0xBD Phone Key B - 0xBE Phone Key C - 0xBF Phone Key D - -12 Consumer - 0x00 Unassigned - 0x01 Consumer Control - 0x02 Numeric Key Pad - 0x03 Programmable Buttons - 0x20 +10 - 0x21 +100 - 0x22 AM/PM - 0x30 Power - 0x31 Reset - 0x32 Sleep - 0x33 Sleep After - 0x34 Sleep Mode - 0x35 Illumination - 0x36 Function Buttons - 0x40 Menu - 0x41 Menu Pick - 0x42 Menu Up - 0x43 Menu Down - 0x44 Menu Left - 0x45 Menu Right - 0x46 Menu Escape - 0x47 Menu Value Increase - 0x48 Menu Value Decrease - 0x60 Data On Screen - 0x61 Closed Caption - 0x62 Closed Caption Select - 0x63 VCR/TV - 0x64 Broadcast Mode - 0x65 Snapshot - 0x66 Still - 0x80 Selection - 0x81 Assign Selection - 0x82 Mode Step - 0x83 Recall Last - 0x84 Enter Channel - 0x85 Order Movie - 0x86 Channel - 0x87 Media Selection - 0x88 Media Select Computer - 0x89 Media Select TV - 0x8A Media Select WWW - 0x8B Media Select DVD - 0x8C Media Select Telephone - 0x8D Media Select Program Guide - 0x8E Media Select Video Phone - 0x8F Media Select Games - 0x90 Media Select Messages - 0x91 Media Select CD - 0x92 Media Select VCR - 0x93 Media Select Tuner - 0x94 Quit - 0x95 Help - 0x96 Media Select Tape - 0x97 Media Select Cable - 0x98 Media Select Satellite - 0x99 Media Select Security - 0x9A Media Select Home - 0x9B Media Select Call - 0x9C Channel Increment - 0x9D Channel Decrement - 0x9E Media Select SAP - 0xA0 VCR Plus - 0xA1 Once - 0xA2 Daily - 0xA3 Weekly - 0xA4 Monthly - 0xB0 Play - 0xB1 Pause - 0xB2 Record - 0xB3 Fast Forward - 0xB4 Rewind - 0xB5 Scan Next Track - 0xB6 Scan Previous Track - 0xB7 Stop - 0xB8 Eject - 0xB9 Random Play - 0xBA Select DisC - 0xBB Enter Disc - 0xBC Repeat - 0xBD Tracking - 0xBE Track Normal - 0xBF Slow Tracking - 0xC0 Frame Forward - 0xC1 Frame Back - 0xC2 Mark - 0xC3 Clear Mark - 0xC4 Repeat From Mark - 0xC5 Return To Mark - 0xC6 Search Mark Forward - 0xC7 Search Mark Backwards - 0xC8 Counter Reset - 0xC9 Show Counter - 0xCA Tracking Increment - 0xCB Tracking Decrement - 0xE0 Volume - 0xE1 Balance - 0xE2 Mute - 0xE3 Bass - 0xE4 Treble - 0xE5 Bass Boost - 0xE6 Surround Mode - 0xE7 Loudness - 0xE8 MPX - 0xE9 Volume Up - 0xEA Volume Down - 0xF0 Speed Select - 0xF1 Playback Speed - 0xF2 Standard Play - 0xF3 Long Play - 0xF4 Extended Play - 0xF5 Slow - 0x100 Fan Enable - 0x101 Fan Speed - 0x102 Light - 0x103 Light Illumination Level - 0x104 Climate Control Enable - 0x105 Room Temperature - 0x106 Security Enable - 0x107 Fire Alarm - 0x108 Police Alarm - 0x150 Balance Right - 0x151 Balance Left - 0x152 Bass Increment - 0x153 Bass Decrement - 0x154 Treble Increment - 0x155 Treble Decrement - 0x160 Speaker System - 0x161 Channel Left - 0x162 Channel Right - 0x163 Channel Center - 0x164 Channel Front - 0x165 Channel Center Front - 0x166 Channel Side - 0x167 Channel Surround - 0x168 Channel Low Frequency Enhancement - 0x169 Channel Top - 0x16A Channel Unknown - 0x170 Sub-channel - 0x171 Sub-channel Increment - 0x172 Sub-channel Decrement - 0x173 Alternate Audio Increment - 0x174 Alternate Audio Decrement - 0x180 Application Launch Buttons - 0x181 AL Launch Button Configuration Tool - 0x182 AL Programmable Button Configuration - 0x183 AL Consumer Control Configuration - 0x184 AL Word Processor - 0x185 AL Text Editor - 0x186 AL Spreadsheet - 0x187 AL Graphics Editor - 0x188 AL Presentation App - 0x189 AL Database App - 0x18A AL Email Reader - 0x18B AL Newsreader - 0x18C AL Voicemail - 0x18D AL Contacts/Address Book - 0x18E AL Calendar/Schedule - 0x18F AL Task/Project Manager - 0x190 AL Log/Journal/Timecard - 0x191 AL Checkbook/Finance - 0x192 AL Calculator - 0x193 AL A/V Capture/Playback - 0x194 AL Local Machine Browser - 0x195 AL LAN/WAN Browser - 0x196 AL Internet Browser - 0x197 AL Remote Networking/ISP Connect - 0x198 AL Network Conference - 0x199 AL Network Chat - 0x19A AL Telephony/Dialer - 0x19B AL Logon - 0x19C AL Logoff - 0x19D AL Logon/Logoff - 0x19E AL Terminal Lock/Screensaver - 0x19F AL Control Panel - 0x1A0 AL Command Line Processor/Run - 0x1A1 AL Process/Task Manager - 0x1A2 AL Select Tast/Application - 0x1A3 AL Next Task/Application - 0x1A4 AL Previous Task/Application - 0x1A5 AL Preemptive Halt Task/Application - 0x200 Generic GUI Application Controls - 0x201 AC New - 0x202 AC Open - 0x203 AC Close - 0x204 AC Exit - 0x205 AC Maximize - 0x206 AC Minimize - 0x207 AC Save - 0x208 AC Print - 0x209 AC Properties - 0x21A AC Undo - 0x21B AC Copy - 0x21C AC Cut - 0x21D AC Paste - 0x21E AC Select All - 0x21F AC Find - 0x220 AC Find and Replace - 0x221 AC Search - 0x222 AC Go To - 0x223 AC Home - 0x224 AC Back - 0x225 AC Forward - 0x226 AC Stop - 0x227 AC Refresh - 0x228 AC Previous Link - 0x229 AC Next Link - 0x22A AC Bookmarks - 0x22B AC History - 0x22C AC Subscriptions - 0x22D AC Zoom In - 0x22E AC Zoom Out - 0x22F AC Zoom - 0x230 AC Full Screen View - 0x231 AC Normal View - 0x232 AC View Toggle - 0x233 AC Scroll Up - 0x234 AC Scroll Down - 0x235 AC Scroll - 0x236 AC Pan Left - 0x237 AC Pan Right - 0x238 AC Pan - 0x239 AC New Window - 0x23A AC Tile Horizontally - 0x23B AC Tile Vertically - 0x23C AC Format - -13 Digitizer - 0x00 Undefined - 0x01 Digitizer - 0x02 Pen - 0x03 Light Pen - 0x04 Touch Screen - 0x05 Touch Pad - 0x06 White Board - 0x07 Coordinate Measuring Machine - 0x08 3-D Digitizer - 0x09 Stereo Plotter - 0x0A Articulated Arm - 0x0B Armature - 0x0C Multiple Point Digitizer - 0x0D Free Space Wand - 0x20 Stylus - 0x21 Puck - 0x22 Finger - 0x30 Tip Pressure - 0x31 Barrel Pressure - 0x32 In Range - 0x33 Touch - 0x34 Untouch - 0x35 Tap - 0x36 Quality - 0x37 Data Valid - 0x38 Transducer Index - 0x39 Tablet Function Keys - 0x3A Program Change Keys - 0x3B Battery Strength - 0x3C Invert - 0x3D X Tilt - 0x3E Y Tilt - 0x3F Azimuth - 0x40 Altitude - 0x41 Twist - 0x42 Tip Switch - 0x43 Secondary Tip Switch - 0x44 Barrel Switch - 0x45 Eraser - 0x46 Tablet Pick - -15 Physical Interface Device - -16 Unicode - * Unicode Char u%04x - -20 Alphnumeric Display - 0x00 Undefined - 0x01 Alphanumeric Display - 0x20 Display Attributes Report - 0x21 ASCII Character Set - 0x22 Data Read Back - 0x23 Font Read Back - 0x24 Display Control Report - 0x25 Clear Display - 0x26 Display Enable - 0x27 Screen Saver Delay - 0x28 Screen Saver Enable - 0x29 Vertical Scroll - 0x2A Horizontal Scroll - 0x2B Character Report - 0x2C Display Data - 0x2D Display Status - 0x2E Stat Not Ready - 0x2F Stat Ready - 0x30 Err Not a loadable character - 0x31 Err Font data cannot be read - 0x32 Cursor Position Report - 0x33 Row - 0x34 Column - 0x35 Rows - 0x36 Columns - 0x37 Cursor Pixel Positioning - 0x38 Cursor Mode - 0x39 Cursor Enable - 0x3A Cursor Blink - 0x3B Font Report - 0x3C Font Data - 0x3D Character Width - 0x3E Character Height - 0x3F Character Spacing Horizontal - 0x40 Character Spacing Vertical - 0x41 Unicode Character Set - -128 Monitor - 0x00 Undefined - 0x01 Monitor Control - 0x02 EDID Information - 0x03 VDIF Information - 0x04 VESA Version - 0x05 On Screen Display - 0x06 Auto Size Center - 0x07 Polarity Horz Synch - 0x08 Polarity Vert Synch - 0x09 Sync Type - 0x0A Screen Position - 0x0B Horizontal Frequency - 0x0C Vertical Frequency - -129 Monitor Enumerated Values - 0x00 unassigned - * ENUM %d - -130 VESA Virtual Controls - 0x10 Brightness - 0x12 Contrast - 0x16 Video Gain Red - 0x18 Video Gain Green - 0x1A Video Gain Blue - 0x1C Focus - 0x20 Horizontal Position - 0x22 Horizontal Size - 0x24 Horizontal Pincushion - 0x26 Horizontal Pincushion Balance - 0x28 Horizontal Misconvergence - 0x2A Horizontal Linearity - 0x2C Horizontal Linearity Balance - 0x30 Vertical Position - 0x32 Vertical Size - 0x34 Vertical Pincushion - 0x36 Vertical Pincushion Balance - 0x38 Vertical Misconvergence - 0x3A Vertical Linearity - 0x3C Vertical Linearity Balance - 0x40 Parallelogram Distortion - 0x42 Trapezoidal Distortion - 0x44 Tilt - 0x46 Top Corner Distortion Control - 0x48 Top Corner Distortion Balance - 0x4A Bottom Corner Distortion Control - 0x4C Bottom Corner Distortion Balance - 0x56 Moiré Horizontal - 0x58 Moiré Vertical - 0x5E Input Level Select - 0x60 Input Source Select - 0x62 Stereo Mode - 0x6C Video Black Level Red - 0x6E Video Black Level Green - 0x70 Video Black Level Blue - -131 VESA Command - 0x00 Undefined - 0x01 Settings - 0x02 Degauss - -132 Power Device - 0x00 Undefined - 0x01 iName - 0x02 PresentStatus - 0x03 ChangedStatus - 0x04 UPS - 0x05 PowerSupply - 0x10 BatterySystem - 0x11 BatterySystemID - 0x12 Battery - 0x13 BatteryID - 0x14 Charger - 0x15 ChargerID - 0x16 PowerConverter - 0x17 PowerConverterID - 0x18 OutletSystem - 0x19 OutletSystemID - 0x1A Input - 0x1B InputID - 0x1C Output - 0x1D OutputID - 0x1E Flow - 0x1F FlowID - 0x20 Outlet - 0x21 OutletID - 0x22 Gang - 0x23 GangID - 0x24 Sink - 0x25 SinkID - 0x30 Voltage - 0x31 Current - 0x32 Frequency - 0x33 ApparentPower - 0x34 ActivePower - 0x35 PercentLoad - 0x36 Temperature - 0x37 Humidity - 0x40 ConfigVoltage - 0x41 ConfigCurrent - 0x42 ConfigFrequency - 0x43 ConfigApparentPower - 0x44 ConfigActivePower - 0x45 ConfigPercentLoad - 0x46 ConfigTemperature - 0x47 ConfigHumidity - 0x50 SwitchOnControl - 0x51 SwitchOffControl - 0x52 ToggleControl - 0x53 LowVoltageTransfer - 0x54 HighVoltageTransfer - 0x55 DelayBeforeReboot - 0x56 DelayBeforeStartup - 0x57 DelayBeforeShutdown - 0x58 Test - 0x59 Vendorspecificcommand - 0x60 Present - 0x61 Good - 0x62 InternalFailure - 0x63 VoltageOutOfRange - 0x64 FrequencyOutOfRange - 0x65 Overload - 0x66 OverCharged - 0x67 OverTemperature - 0x68 ShutdownRequested - 0x69 ShutdownImminent - 0x6A VendorSpecificAnswerValid - 0x6B SwitchOn/Off - 0x6C Switcheble - 0x6D Used - 0x6E Boost - 0x6F Buck - 0x70 Initialized - 0x71 Tested - -133 Battery System - 0x00 Undefined - 0x01 SMBBatteryMode - 0x02 SMBBatteryStatus - 0x03 SMBAlarmWarning - 0x04 SMBChargerMode - 0x05 SMBChargerStatus - 0x06 SMBChargerSpecInfo - 0x07 SMBSelectorState - 0x08 SMBSelectorPreset - 0x09 SMBSelectorInfo - 0x10 OptionalMfgFunction1 - 0x11 OptionalMfgFunction2 - 0x12 OptionalMfgFunction3 - 0x13 OptionalMfgFunction4 - 0x14 OptionalMfgFunction5 - 0x15 ConnectionToSMBus - 0x16 OutputConnection - 0x17 ChargerConnection - 0x18 BatteryInsertion - 0x19 Usenext - 0x1A OKToUse - 0x28 ManufacturerAccess - 0x29 RemainingCapacityLimit - 0x2A RemainingTimeLimit - 0x2B AtRate - 0x2C CapacityMode - 0x2D BroadcastToCharger - 0x2E PrimaryBattery - 0x2F ChargeController - 0x40 TerminateCharge - 0x41 TermminateDischarge - 0x42 BelowRemainingCapacityLimit - 0x43 RemainingTimeLimitExpired - 0x44 Charging - 0x45 Discharging - 0x46 FullyCharged - 0x47 FullyDischarged - 0x48 ConditionningFlag - 0x49 AtRateOK - 0x4A SMBErrorCode - 0x4B NeedReplacement - 0x60 AtRateTimeToFull - 0x61 AtRateTimeToEmpty - 0x62 AverageCurrent - 0x63 Maxerror - 0x64 RelativeStateOfCharge - 0x65 AbsoluteStateOfCharge - 0x66 RemainingCapacity - 0x67 FullChargeCapacity - 0x68 RunTimeToEmpty - 0x69 AverageTimeToEmpty - 0x6A AverageTimeToFull - 0x6B CycleCount - 0x80 BattPackModelLevel - 0x81 InternalChargeController - 0x82 PrimaryBatterySupport - 0x83 DesignCapacity - 0x84 SpecificationInfo - 0x85 ManufacturerDate - 0x86 SerialNumber - 0x87 iManufacturerName - 0x88 iDevicename - 0x89 iDeviceChemistery - 0x8A iManufacturerData - 0x8B Rechargeable - 0x8C WarningCapacityLimit - 0x8D CapacityGranularity1 - 0x8E CapacityGranularity2 - 0xC0 InhibitCharge - 0xC1 EnablePolling - 0xC2 ResetToZero - 0xD0 ACPresent - 0xD1 BatteryPresent - 0xD2 PowerFail - 0xD3 AlarmInhibited - 0xD4 ThermistorUnderRange - 0xD5 ThermistorHot - 0xD6 ThermistorCold - 0xD7 ThermistorOverRange - 0xD8 VoltageOutOfRange - 0xD9 CurrentOutOfRange - 0xDA CurrentNotRegulated - 0xDB VoltageNotRegulated - 0xDC MasterMode - 0xDD ChargerBattery/HostControlled - 0xF0 ChargerSpecInfo - 0xF1 ChargerSpecRef - 0xF2 Level2 - 0xF3 Level3 - -140 Bar Code Scanner - -141 Scale Device - -144 Camera Control - -145 Arcade Device - -# Some Micro$oft non-standard extensions -0xff00 Microsoft - 0xe9 Base Up - 0xea Base Down diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usbvar.h b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usbvar.h deleted file mode 100644 index 60883dd47..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/libusb/usbvar.h +++ /dev/null @@ -1,34 +0,0 @@ -/* $NetBSD: usbvar.h,v 1.2 1999/05/11 21:15:46 augustss Exp $ */ - -/* - * Copyright (c) 1999 Lennart Augustsson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/libusb/usbvar.h,v 1.1.2.2 1999/12/03 10:12:43 hohndel Exp $ */ - -struct report_desc { - unsigned int size; - unsigned char data[1]; -}; - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/memrange.h b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/memrange.h deleted file mode 100644 index 0f4b270f4..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/memrange.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Memory range attribute operations, peformed on /dev/mem - * - * $FreeBSD: src/sys/sys/memrange.h,v 1.4 1999/12/29 04:24:44 peter Exp $ - */ -/* $XFree86$ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef _MEMRANGE_H -#define _MEMRANGE_H - -/* Memory range attributes */ -#define MDF_UNCACHEABLE (1<<0) /* region not cached */ -#define MDF_WRITECOMBINE (1<<1) /* region supports "write combine" - * action */ -#define MDF_WRITETHROUGH (1<<2) /* write-through cached */ -#define MDF_WRITEBACK (1<<3) /* write-back cached */ -#define MDF_WRITEPROTECT (1<<4) /* read-only region */ -#define MDF_ATTRMASK (0x00ffffff) - -#define MDF_FIXBASE (1<<24) /* fixed base */ -#define MDF_FIXLEN (1<<25) /* fixed length */ -#define MDF_FIRMWARE (1<<26) /* set by firmware (XXX not useful?) */ -#define MDF_ACTIVE (1<<27) /* currently active */ -#define MDF_BOGUS (1<<28) /* we don't like it */ -#define MDF_FIXACTIVE (1<<29) /* can't be turned off */ -#define MDF_BUSY (1<<30) /* range is in use */ - -struct mem_range_desc { - u_int64_t mr_base; - u_int64_t mr_len; - int mr_flags; - char mr_owner[8]; -}; - -struct mem_range_op { - struct mem_range_desc *mo_desc; - int mo_arg[2]; -#define MEMRANGE_SET_UPDATE 0 -#define MEMRANGE_SET_REMOVE 1 - /* XXX want a flag that says "set and undo when I exit" */ -}; -#define MEMRANGE_GET _IOWR('m', 50, struct mem_range_op) -#define MEMRANGE_SET _IOW('m', 51, struct mem_range_op) - -#ifdef _KERNEL - -struct mem_range_softc; -struct mem_range_ops { - void (*init) __P((struct mem_range_softc * sc)); - int (*set) __P((struct mem_range_softc * sc, struct mem_range_desc * mrd, int *arg)); - void (*initAP) __P((struct mem_range_softc * sc)); -}; - -struct mem_range_softc { - struct mem_range_ops *mr_op; - int mr_cap; - int mr_ndesc; - struct mem_range_desc *mr_desc; -}; - -extern struct mem_range_softc mem_range_softc; - -extern int mem_range_attr_get __P((struct mem_range_desc * mrd, int *arg)); -extern int mem_range_attr_set __P((struct mem_range_desc * mrd, int *arg)); -extern void mem_range_AP_init __P((void)); -#endif - -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/ppc_video.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/ppc_video.c deleted file mode 100644 index edcb20c1b..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/ppc_video.c +++ /dev/null @@ -1,141 +0,0 @@ -/* $XFree86: ppc_video.c,v 1.5 2003/03/14 13:46:04 tsi Exp $ */ -/* - * Copyright 1992 by Rich Murphey - * Copyright 1993 by David Wexelblat - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Rich Murphey and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Rich Murphey and - * David Wexelblat make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/* $XConsortium: bsd_video.c /main/10 1996/10/25 11:37:57 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" - -#include "xf86_OSlib.h" -#include "xf86OSpriv.h" - -#include "bus/Pci.h" - -#ifndef MAP_FAILED -#define MAP_FAILED ((caddr_t)-1) -#endif - - -/***************************************************************************/ -/* Video Memory Mapping section */ -/***************************************************************************/ - -#ifndef __OpenBSD__ -#define DEV_MEM "/dev/mem" -#else -#define DEV_MEM "/dev/xf86" -#endif - -static pointer ppcMapVidMem(int, unsigned long, unsigned long, int flags); -static void ppcUnmapVidMem(int, pointer, unsigned long); - -void -xf86OSInitVidMem(VidMemInfoPtr pVidMem) -{ - pVidMem->linearSupported = TRUE; - pVidMem->mapMem = ppcMapVidMem; - pVidMem->unmapMem = ppcUnmapVidMem; - pVidMem->initialised = TRUE; -} - - -volatile unsigned char *ioBase = MAP_FAILED; - -static pointer -ppcMapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) -{ - int fd = xf86Info.screenFd; - pointer base; -#ifdef DEBUG - xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", - Base, Size, fd); -#endif - - base = mmap(0, Size, - (flags & VIDMEM_READONLY) ? - PROT_READ : (PROT_READ | PROT_WRITE), - MAP_SHARED, fd, Base); - if (base == MAP_FAILED) - FatalError("%s: could not mmap screen [s=%x,a=%x] (%s)", - "xf86MapVidMem", Size, Base, strerror(errno)); - - return base; -} - -static void -ppcUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - munmap(Base, Size); -} - -int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ - int rv; - static int kmem = -1; - - if (kmem == -1) { - kmem = open(DEV_MEM, 2); - if (kmem == -1) { - FatalError("xf86ReadBIOS: open %s", DEV_MEM); - } - } - -#ifdef DEBUG - xf86MsgVerb(X_INFO, 3, "xf86ReadBIOS() %lx %lx, %x\n", - Base, Offset, Len); -#endif - - - lseek(kmem, Base + Offset, 0); - rv = read(kmem, Buf, Len); - - return rv; -} - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -Bool -xf86DisableInterrupts() -{ - - return(TRUE); -} - -void -xf86EnableInterrupts() -{ - - return; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/sparc64_video.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/sparc64_video.c deleted file mode 100644 index d9dfcca31..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsd/sparc64_video.c +++ /dev/null @@ -1,113 +0,0 @@ -/* $XFree86: sparc64_video.c,v 1.2 2003/03/14 13:46:04 tsi Exp $ */ -/* - * Copyright 1992 by Rich Murphey - * Copyright 1993 by David Wexelblat - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Rich Murphey and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Rich Murphey and - * David Wexelblat make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - - -/* $XConsortium: bsd_video.c /main/10 1996/10/25 11:37:57 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" - -#include "xf86_OSlib.h" -#include "xf86OSpriv.h" - -#ifndef MAP_FAILED -#define MAP_FAILED ((caddr_t)-1) -#endif - -/***************************************************************************/ -/* Video Memory Mapping section */ -/***************************************************************************/ - -static pointer sparc64MapVidMem(int, unsigned long, unsigned long, int); -static void sparc64UnmapVidMem(int, pointer, unsigned long); - -void -xf86OSInitVidMem(VidMemInfoPtr pVidMem) -{ - pVidMem->linearSupported = TRUE; - pVidMem->mapMem = sparc64MapVidMem; - pVidMem->unmapMem = sparc64UnmapVidMem; - pVidMem->initialised = TRUE; -} - -static pointer -sparc64MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, - int flags) -{ - int fd = xf86Info.screenFd; - pointer base; - -#ifdef DEBUG - xf86MsgVerb(X_INFO, 3, "mapVidMem %lx, %lx, fd = %d", - Base, Size, fd); -#endif - - base = mmap(0, Size, - (flags & VIDMEM_READONLY) ? - PROT_READ : (PROT_READ | PROT_WRITE), - MAP_SHARED, fd, Base); - if (base == MAP_FAILED) - FatalError("%s: could not mmap screen [s=%x,a=%x] (%s)", - "xf86MapVidMem", Size, Base, strerror(errno)); - return base; -} - -static void -sparc64UnmapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - munmap(Base, Size); -} - -int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ - - return (0); -} - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -Bool -xf86DisableInterrupts() -{ - - return(TRUE); -} - -void -xf86EnableInterrupts() -{ - - return; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile deleted file mode 100644 index 820f76c20..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile +++ /dev/null @@ -1,46 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsdi/Imakefile,v 3.14 2002/10/11 01:46:58 dawes Exp $ - - - - -XCOMM $XConsortium: Imakefile /main/4 1996/09/28 17:23:38 rws $ - -#include - -MOUSESRC = bsdi_mouse.c -MOUSEOBJ = bsdi_mouse.o - -SRCS = bsdi_init.c bsdi_video.c bsdi_io.c bios_devmem.c \ - VTsw_noop.c std_kbdEv.c posix_tty.c $(MOUSESRC) \ - libc_wrapper.c stdResource.c stdPci.c sigiostubs.c pm_noop.c \ - kmod_noop.c agp_noop.c - -OBJS = bsdi_init.o bsdi_video.o bsdi_io.o bios_devmem.o \ - VTsw_noop.o std_kbdEv.o posix_tty.o $(MOUSEOBJ) \ - libc_wrapper.o stdResource.o stdPci.o sigiostubs.o pm_noop.o \ - kmod_noop.o agp_noop.o - -INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) -I$(EXTINCSRC) - -RESDEFINES = -DUSESTDRES - -DEFINES = $(RESDEFINES) - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() - -LinkSourceFile(bios_devmem.c,../shared) -LinkSourceFile(VTsw_noop.c,../shared) -LinkSourceFile(std_kbdEv.c,../shared) -LinkSourceFile(posix_tty.c,../shared) -LinkSourceFile(libc_wrapper.c,../shared) -LinkSourceFile(stdResource.c,../shared) -LinkSourceFile(stdPci.c,../shared) -LinkSourceFile(sigiostubs.c,../shared) -LinkSourceFile(pm_noop.c,../shared) -LinkSourceFile(kmod_noop.c,../shared) -LinkSourceFile(agp_noop.c,../shared) - -DependTarget() - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_init.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_init.c deleted file mode 100644 index 5a166ed26..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_init.c +++ /dev/null @@ -1,156 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_init.c,v 3.5.4.2 1998/06/05 16:23:08 dawes Exp $ */ -/* - * Copyright 1992 by Rich Murphey - * Copyright 1993 by David Wexelblat - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Rich Murphey and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Rich Murphey and - * David Wexelblat make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: bsdi_init.c /main/5 1996/02/21 17:51:15 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "input.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -extern Bool RunFromSmartParent; - -static Bool KeepTty = FALSE; - -#if BSD >= 199306 -static void -NonBlockConsoleOff() -{ - register int i; - - i = fcntl(2, F_GETFL, 0); - if (i >= 0) - (void) fcntl(2, F_SETFL, i & ~FNDELAY); -} -#endif - -void -xf86OpenConsole() -{ - int i, fd; - - if (serverGeneration == 1) - { - /* check if we're run with euid==0 */ - if (geteuid() != 0) - { - FatalError("xf86OpenConsole: Server must be suid root\n"); - } - - if (!KeepTty) - { -#if BSD >= 199306 - if (RunFromSmartParent) { - if (atexit(NonBlockConsoleOff)) - xf86Msg(X_WARNING, - "InitOutput: can't register NBIO exit handler\n"); - i = fcntl(2, F_GETFL, 0); - if (i >= 0) - i = fcntl(2, F_SETFL, i | FNDELAY); - if (i < 0) - xf86Msg(X_WARNING, - "InitOutput: can't put stderr in non-block mode\n"); - } -#else - /* - * detaching the controlling tty solves problems of kbd character - * loss. This is not interesting for CO driver, because it is - * exclusive. - */ - setpgrp(0, getpid()); - if ((i = open("/dev/tty",O_RDWR)) >= 0) - { - ioctl(i,TIOCNOTTY,(char *)0); - close(i); - } -#endif - } - - if ((xf86Info.consoleFd = open("/dev/kbd", O_RDWR|O_NDELAY,0)) < 0) - { - FatalError("xf86OpenConsole: Cannot open /dev/kbd (%s)\n", - strerror(errno)); - } - if ((xf86Info.screenFd = open("/dev/vga", O_RDWR|O_NDELAY,0)) < 0) - { - FatalError("xf86OpenConsole: Cannot open /dev/vga (%s)\n", - strerror(errno)); - } - - if (ioctl(xf86Info.consoleFd, PCCONIOCRAW, 0) < 0) - { - FatalError("%s: PCCONIOCRAW failed (%s)\n", - "xf86OpenConsole", strerror(errno)); - } - } - return; -} - -void -xf86CloseConsole() -{ - ioctl (xf86Info.consoleFd, PCCONIOCCOOK, 0); - - if (xf86Info.screenFd != xf86Info.consoleFd) - { - close(xf86Info.screenFd); - } - close(xf86Info.consoleFd); - return; -} - -int -xf86ProcessArgument (int argc, char *argv[], int i) -{ - /* - * Keep server from detaching from controlling tty. This is useful - * when debugging (so the server can receive keyboard signals. - */ - if (!strcmp(argv[i], "-keeptty")) - { - KeepTty = TRUE; - return(1); - } - return(0); -} - -void -xf86UseMsg() -{ - ErrorF("-keeptty "); - ErrorF("don't detach controlling tty (for debugging only)\n"); - return; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_io.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_io.c deleted file mode 100644 index e37bf308c..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_io.c +++ /dev/null @@ -1,110 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_io.c,v 3.13 2002/10/11 01:40:34 dawes Exp $ */ -/* - * Copyright 1992 by Rich Murphey - * Copyright 1993 by David Dawes - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Rich Murphey and David Dawes - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Rich Murphey and - * David Dawes make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * RICH MURPHEY AND DAVID DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID DAWES BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: bsdi_io.c /main/10 1996/10/19 18:06:13 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -void -xf86SoundKbdBell(int loudness, int pitch, int duration) -{ - if (loudness && pitch) - { - int data[2]; - - data[0] = pitch; - data[1] = (duration * loudness) / 50; - ioctl(xf86Info.consoleFd, PCCONIOCBEEP, data); - } -} - -void -xf86SetKbdLeds(int leds) -{ - ioctl(xf86Info.consoleFd, PCCONIOCSETLED, &leds); -} - -int -xf86GetKbdLeds() -{ - return(0); -} - -void -xf86SetKbdRepeat(char rad) -{ - return; -} - -static struct termio kbdtty; - -void -xf86KbdInit() -{ - tcgetattr(xf86Info.consoleFd, &kbdtty); -} - -int -xf86KbdOn() -{ - struct termios nTty; - - nTty = kbdtty; - nTty.c_iflag = IGNPAR | IGNBRK; - nTty.c_oflag = 0; - nTty.c_cflag = CREAD | CS8; - nTty.c_lflag = 0; - nTty.c_cc[VTIME] = 0; - nTty.c_cc[VMIN] = 1; - cfsetispeed(&nTty, 9600); - cfsetospeed(&nTty, 9600); - tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty); - return(xf86Info.consoleFd); -} - -int -xf86KbdOff() -{ - tcsetattr(xf86Info.consoleFd, TCSANOW, &kbdtty); - return(xf86Info.consoleFd); -} - -#include "xf86OSKbd.h" - -Bool -xf86OSKbdPreInit(InputInfoPtr pInfo) -{ - return FALSE; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_mouse.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_mouse.c deleted file mode 100644 index fb50cfcee..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_mouse.c +++ /dev/null @@ -1,34 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_mouse.c,v 1.1 1999/05/22 08:40:10 dawes Exp $ */ - -/* - * Copyright 1999 by The XFree86 Project, Inc. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Xinput.h" -#include "xf86OSmouse.h" - -static int -SupportedInterfaces(void) -{ - /* XXX This needs to be checked. */ - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO; -} - -OSMouseInfoPtr -xf86OSMouseInit(int flags) -{ - OSMouseInfoPtr p; - - p = xcalloc(sizeof(OSMouseInfoRec), 1); - if (!p) - return NULL; - p->SupportedInterfaces = SupportedInterfaces; - return p; -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_video.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_video.c deleted file mode 100644 index 5b1e474c7..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_video.c +++ /dev/null @@ -1,182 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsdi/bsdi_video.c,v 3.10 2003/03/14 13:46:05 tsi Exp $ */ -/* - * Copyright 1992 by Rich Murphey - * Copyright 1993 by David Wexelblat - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Rich Murphey and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Rich Murphey and - * David Wexelblat make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * RICH MURPHEY AND DAVID WEXELBLAT DISCLAIM ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: bsdi_video.c /main/4 1996/02/21 17:51:22 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "input.h" -#include "scrnintstr.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86OSpriv.h" - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -/***************************************************************************/ -/* Video Memory Mapping section */ -/***************************************************************************/ - -pointer -xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) -{ - pointer base; - - /* just try the mapping, and either it will work, or not */ - base = mmap(0, Size, - (Flags & VIDMEM_READONLY) ? - PROT_READ : (PROT_READ | PROT_WRITE), - MAP_FILE, xf86Info.screenFd, Base - 0xA0000); - if (base == MAP_FAILED) - { - FatalError("xf86MapVidMem: Could not mmap /dev/vga (%s) at 0x%x\n", - strerror(errno), Base); - } - return(base); -} - -void -xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - munmap((caddr_t)Base, Size); -} - -Bool -xf86LinearVidMem() -{ - return(TRUE); -} - -/***************************************************************************/ -/* I/O Permissions section */ -/***************************************************************************/ - -/* - * BSDI has a single system-wide TSS I/O bitmap that covers ports up to - * 0xFFFF. By default, the TSS has ports 0x3B0-0x3DF enabled. - * - * It also allows the IOPL to be enabled or disabled on a per-process - * basis. Here, we use the IOPL only. - */ - -static Bool ExtendedEnabled = FALSE; - -Bool -xf86EnableIO() -{ - if (ExtendedEnabled) - return TRUE; - - if (ioctl(xf86Info.consoleFd, PCCONENABIOPL, 0) < 0) - { - xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O\n", - "xf86EnableIOPorts"); - return FALSE; - } - ExtendedEnabled = TRUE; - return TRUE; -} - -void -xf86DisableIO() -{ - if (!ExtendedEnabled) - return; - - ioctl(xf86Info.consoleFd, PCCONDISABIOPL, 0); - ExtendedEnabled = FALSE; -} - - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -Bool -xf86DisableInterrupts() -{ - if (!ExtendedEnabled) - { - if (ioctl(xf86Info.consoleFd, PCCONENABIOPL, 0) < 0) - { - return(FALSE); - } - } - -#ifdef __GNUC__ - __asm__ __volatile__("cli"); -#else - asm("cli"); -#endif /* __GNUC__ */ - - if (!ExtendedEnabled) - { - ioctl(xf86Info.consoleFd, PCCONDISABIOPL, 0); - } - - return(TRUE); -} - -void -xf86EnableInterrupts() -{ - if (!ExtendedEnabled) - { - ioctl(xf86Info.consoleFd, PCCONENABIOPL, 0); - } - -#ifdef __GNUC__ - __asm__ __volatile__("sti"); -#else - asm("sti"); -#endif /* __GNUC__ */ - - if (!ExtendedEnabled) - { - ioctl(xf86Info.consoleFd, PCCONDISABIOPL, 0); - } - - return; -} - -void -xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base, - unsigned long Size) -{ -} - -Bool -xf86CheckMTRR(int ScreenNum) -{ - return FALSE; -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.c deleted file mode 100644 index 255dfa12f..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.c +++ /dev/null @@ -1,470 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.c,v 1.4 2003/08/29 21:08:06 tsi Exp $ */ -/* - * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from the - * XFree86 Project. - */ - -/* - * This file contains the glue necessary for support of Intel's 460GX chipset. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "460gxPCI.h" -#include "xf86.h" -#include "Pci.h" - -/* 460GX register definitions */ -/* SAC at 0:10:0 */ -#define CBN 0x0040 -/* SAC at CBN:0:0 */ -#define DEVNPRES 0x0070 -/* SAC at CBN:1[0-7]:0 */ -#define BUSNO 0x0048 -#define SUBNO 0x0049 -#define VGASE 0x0080 -#define PCIS 0x0084 -#define IOR 0x008C -#define IORD 0x008E /* CBN:10:0 only */ -/* PXB at CBN:1[0-7]:1 */ -#define ERRCMD 0x0046 - -static int cbn_460gx = -1; -static CARD32 cbdevs_460gx = 0; -static CARD16 iord_460gx; -static int busno_460gx[8], subno_460gx[8]; -static CARD8 pcis_460gx[8], ior_460gx[8]; -static CARD8 has_err_460gx[8], err_460gx[8]; -static CARD8 iomap_460gx[16]; /* One for each 4k */ -static pciBusFuncs_t BusFuncs_460gx; - -static pciConfigPtr -Verify460GXBus(int bus) -{ - pciConfigPtr pPCI; - - if ((bus < 0) || (bus >= pciNumBuses) || - !pciBusInfo[bus] || !(pPCI = pciBusInfo[bus]->bridge) || - (pPCI->busnum != cbn_460gx) || (pPCI->funcnum != 0) || - (pPCI->devnum < 0x10) || (pPCI->devnum > 0x17)) - return NULL; - - return pPCI; -} - -/* - * This function is called to emulate the various settings in a P2P or CardBus - * bridge's control register using one of a 460GX's SAC host bridges. - */ -static CARD16 -Control460GXBridge(int bus, CARD16 mask, CARD16 value) -{ - pciConfigPtr pPCI; - PCITAG tag; - CARD16 current = 0; - CARD8 tmp; - - if ((pPCI = Verify460GXBus(bus))) { - /* Start with VGA enablement */ - tmp = pciReadByte(pPCI->tag, VGASE); - if (tmp & 0x01) { - current |= PCI_PCI_BRIDGE_VGA_EN; - if ((mask & PCI_PCI_BRIDGE_VGA_EN) && - !(value & PCI_PCI_BRIDGE_VGA_EN)) - pciWriteByte(pPCI->tag, VGASE, tmp & ~0x01); - } else { - if (mask & value & PCI_PCI_BRIDGE_VGA_EN) - pciWriteByte(pPCI->tag, VGASE, tmp | 0x01); - } - - /* Move on to master abort failure enablement */ - if (has_err_460gx[pPCI->devnum - 0x10]) { - tag = PCI_MAKE_TAG(pPCI->busnum, pPCI->devnum, pPCI->funcnum + 1); - tmp = pciReadByte(tag, ERRCMD); - if (tmp & 0x01) { - current |= PCI_PCI_BRIDGE_MASTER_ABORT_EN; - if ((mask & PCI_PCI_BRIDGE_MASTER_ABORT_EN) && - !(value & PCI_PCI_BRIDGE_MASTER_ABORT_EN)) - pciWriteByte(tag, ERRCMD, tmp & ~0x01); - } else { - if (mask & value & PCI_PCI_BRIDGE_MASTER_ABORT_EN) - pciWriteByte(tag, ERRCMD, tmp | 0x01); - } - } - - /* Put emulation of any other P2P bridge control here */ - } - - return (current & ~mask) | (value & mask); -} - -/* - * Retrieve various bus numbers representing the connections provided by 460GX - * host bridges. - */ -static void -Get460GXBridgeBuses(int bus, int *primary, int *secondary, int *subordinate) -{ - pciConfigPtr pPCI = Verify460GXBus(bus); - int i; - - /* The returned bus numbers are initialised by the caller */ - - if (!pPCI) - return; - - i = pPCI->devnum - 0x10; - - /* These are not modified, so no need to re-read them */ - if (primary) - *primary = pPCI->busnum; - if (secondary) - *secondary = busno_460gx[i]; - if (subordinate) - *subordinate = subno_460gx[i]; -} - -/* Retrieves a list of the resources routed to a host bridge's secondary bus */ -static void -Get460GXBridgeResources(int bus, - pointer *ppIoRes, - pointer *ppMemRes, - pointer *ppPmemRes) -{ - pciConfigPtr pPCI = Verify460GXBus(bus); - resRange range; - unsigned int i, j; - - if (ppIoRes) { - xf86FreeResList(*ppIoRes); - *ppIoRes = NULL; - - if (pPCI) { - for (i = 0; i <= 0x0F; i++) { - if (iomap_460gx[i] != pPCI->devnum) - continue; - - RANGE(range, i << 12, ((i + 1) << 12) - 1, - RANGE_TYPE(ResExcIoBlock, 0)); - *ppIoRes = xf86AddResToList(*ppIoRes, &range, -1); - } - } - } - - if (ppMemRes) { - xf86FreeResList(*ppMemRes); - *ppMemRes = NULL; - - if (pPCI) { - if (!(i = (pPCI->devnum - 0x10))) - j = 127; /* (4GB - 32M) / 32M */ - else - j = pcis_460gx[i - 1] & 0x7F; - - i = pcis_460gx[i] & 0x7F; - if (i < j) { - RANGE(range, i << 25, (j << 25) - 1, - RANGE_TYPE(ResExcMemBlock, 0)); - *ppMemRes = xf86AddResToList(*ppMemRes, &range, -1); - } - } - } - - if (ppPmemRes) { - xf86FreeResList(*ppPmemRes); - *ppPmemRes = NULL; - } -} - -/* - * This checks for, and validates, the presence of the 460GX chipset, and sets - * cbn_460gx to a positive value accordingly. This function returns TRUE if - * the chipset scan is to be stopped, or FALSE if the scan is to move on to the - * next chipset. - */ - -Bool -xorgProbe460GX(scanpciWrapperOpt flags) -{ - pciBusInfo_t *pBusInfo; - PCITAG tag; - - /* Bus zero should already be set up */ - if (!(pBusInfo = pciBusInfo[0])) { - cbn_460gx = -1; - return FALSE; - } - /* First look for a 460GX's primary host bridge */ - tag = PCI_MAKE_TAG(0, 0x10, 0); - if (pciReadLong(tag, PCI_ID_REG) == DEVID(VENDOR_INTEL, CHIP_460GX_SAC)) { - return TRUE; - } - - cbn_460gx = -1; - - return FALSE; -} - -void -xf86PreScan460GX(void) -{ - pciBusInfo_t *pBusInfo; - PCITAG tag; - CARD32 tmp; - int i, devno; - - if (!(pBusInfo = pciBusInfo[0])) - return; - - /* Get CBN (Chipset bus number) */ - tag = PCI_MAKE_TAG(0, 0x10, 0); - if (!(cbn_460gx = (unsigned int)pciReadByte(tag, CBN))) { - /* Sanity check failed */ - cbn_460gx = -1; - return; - } - - if (pciNumBuses <= cbn_460gx) - pciNumBuses = cbn_460gx + 1; - - /* Set up bus CBN */ - if (!pciBusInfo[cbn_460gx]) { - pciBusInfo[cbn_460gx] = xnfalloc(sizeof(pciBusInfo_t)); - *pciBusInfo[cbn_460gx] = *pBusInfo; - } - - tag = PCI_MAKE_TAG(cbn_460gx, 0, 0); - if (pciReadLong(tag, PCI_ID_REG) != DEVID(VENDOR_INTEL, CHIP_460GX_SAC)) { - /* Sanity check failed */ - cbn_460gx = -1; - return; - } - - /* - * Find out which CBN devices the firmware thinks are present. Of these, - * we are only interested in devices 0x10 through 0x17. - */ - cbdevs_460gx = pciReadLong(tag, DEVNPRES); - - for (i = 0, devno = 0x10; devno <= 0x17; i++, devno++) { - tag = PCI_MAKE_TAG(cbn_460gx, devno, 0); - if (pciReadLong(tag, PCI_ID_REG) != - DEVID(VENDOR_INTEL, CHIP_460GX_SAC)) { - /* Sanity check failed */ - cbn_460gx = -1; - return; - } - - if (devno == 0x10) - iord_460gx = pciReadWord(tag, IORD); - - busno_460gx[i] = (unsigned int)pciReadByte(tag, BUSNO); - subno_460gx[i] = (unsigned int)pciReadByte(tag, SUBNO); - pcis_460gx[i] = pciReadByte(tag, PCIS); - ior_460gx[i] = pciReadByte(tag, IOR); - - has_err_460gx[i] = err_460gx[i] = 0; /* Insurance */ - - tag = PCI_MAKE_TAG(cbn_460gx, devno, 1); - tmp = pciReadLong(tag, PCI_ID_REG); - switch (tmp) { - case DEVID(VENDOR_INTEL, CHIP_460GX_PXB): - case DEVID(VENDOR_INTEL, CHIP_460GX_WXB): - if (cbdevs_460gx & (1 << devno)) { - /* Sanity check failed */ - cbn_460gx = -1; - return; - } - - /* - * XXX I don't have WXB docs, but PCI register dumps indicate that - * the registers we are interested in are consistent with those of - * the PXB. - */ - err_460gx[i] = pciReadByte(tag, ERRCMD); - has_err_460gx[i] = 1; - break; - - case DEVID(VENDOR_INTEL, CHIP_460GX_GXB_1): - if (cbdevs_460gx & (1 << devno)) { - /* Sanity check failed */ - cbn_460gx = -1; - return; - } - - /* - * XXX GXB isn't documented to have an ERRCMD register, nor any - * other means of failing master aborts. For now, assume master - * aborts are always allowed to complete normally. - */ - break; - - default: - if (((CARD16)(tmp + 1U) <= (CARD16)1U) && - (cbdevs_460gx & (1U << devno))) - break; - /* Sanity check failed */ - cbn_460gx = -1; - return; - } - } - - /* Allow master aborts to complete normally */ - for (i = 0, devno = 0x10; devno <= 0x17; i++, devno++) { - if (!(err_460gx[i] & 0x01)) - continue; - - pciWriteByte(PCI_MAKE_TAG(cbn_460gx, devno, 1), - ERRCMD, err_460gx[i] & ~0x01); - } - - /* - * The 460GX spec says that any access to buses higher than CBN will be - * master-aborted. It seems possible however that this is not the case in - * all 460GX implementations. For now, limit the bus scan to CBN, unless - * we have already found a higher bus number. - */ - for (i = 0; subno_460gx[i] < cbn_460gx; ) { - if (++i < 8) - continue; - - pciMaxBusNum = cbn_460gx + 1; - break; - } - - return; -} - -/* This does some 460GX-related processing after the PCI bus scan */ -void -xf86PostScan460GX(void) -{ - pciConfigPtr pPCI, *ppPCI; - pciBusInfo_t *pBusInfo; - int i, j, devno; - - if (cbn_460gx <= 0) - return; - - /* Set up our extra bus functions */ - BusFuncs_460gx = *(pciBusInfo[0]->funcs); - BusFuncs_460gx.pciControlBridge = Control460GXBridge; - BusFuncs_460gx.pciGetBridgeBuses = Get460GXBridgeBuses; - BusFuncs_460gx.pciGetBridgeResources = Get460GXBridgeResources; - - /* - * Mark all host bridges so that they are ignored by the upper-level - * xf86GetPciBridgeInfo() function. This marking is later clobbered by the - * tail end of xf86scanpci() for those bridges that actually have bus - * segments associated with them. - */ - ppPCI = xf86scanpci(0); /* Recursion is only apparent */ - while ((pPCI = *ppPCI++)) { - if ((pPCI->pci_base_class == PCI_CLASS_BRIDGE) && - (pPCI->pci_sub_class == PCI_SUBCLASS_BRIDGE_HOST)) - pPCI->businfo = HOST_NO_BUS; - } - - ppPCI = xf86scanpci(0); /* Recursion is only apparent */ - j = 0; - - /* - * Fix up CBN bus linkage. This is somewhat arbitrary. The bridge chosen - * for this must be a CBN device so that bus CBN can be recognised as the - * root segment. It also cannot be any of the bus expanders (devices - * CBN:0x10:0 through CBN:0x17:0 nor any of their functions). For now, we - * chose the SAC host bridge at CBN:0:0. - */ - pBusInfo = pciBusInfo[cbn_460gx]; - pBusInfo->bridge = pciBusInfo[0]->bridge; /* Just in case */ - while ((pPCI = *ppPCI++)) { - if (pPCI->busnum < cbn_460gx) - continue; - if (pPCI->busnum > cbn_460gx) - break; - if (pPCI->devnum < 0) - continue; - if (pPCI->devnum > 0) - break; - if (pPCI->funcnum < 0) - continue; - if (pPCI->funcnum > 0) - break; - - pBusInfo->bridge = pPCI; - pBusInfo->secondary = FALSE; - pBusInfo->primary_bus = cbn_460gx; - break; - } - - for (i = 0, devno = 0x10; devno <= 0x17; i++, devno++) { - /* Restore ERRCMD registers */ - if (err_460gx[i] & 0x01) - pciWriteByte(PCI_MAKE_TAG(cbn_460gx, devno, 1), - ERRCMD, err_460gx[i]); - - if (!(cbdevs_460gx & (1 << devno))) { - while ((pPCI = *ppPCI++)) { - if (pPCI->busnum < cbn_460gx) - continue; - if (pPCI->busnum > cbn_460gx) - break; - if (pPCI->devnum < devno) - continue; - if (pPCI->devnum > devno) - break; - if (pPCI->funcnum < 0) - continue; - if (pPCI->funcnum > 0) - break; - - if ((pBusInfo == pciBusInfo[busno_460gx[i]])) - break; - - /* Fix bus linkage */ - pBusInfo->bridge = pPCI; - pBusInfo->secondary = TRUE; - pBusInfo->primary_bus = cbn_460gx; - - /* Plug in chipset routines */ - pBusInfo->funcs = &BusFuncs_460gx; - break; - } - } - - /* Decode IOR registers */ - for(; j <= (ior_460gx[i] & 0x0F); j++) - iomap_460gx[j] = devno; - } - - /* The bottom 4k of I/O space is always routed to PCI0a */ - iomap_460gx[0] = 0x10; - - /* Decode IORD register */ - for (j = 1; j <= 0x0F; j++) - if (iord_460gx & (1 << j)) - iomap_460gx[j] = 0x10; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.h b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.h deleted file mode 100644 index 65a19b2f0..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.h +++ /dev/null @@ -1,42 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/460gxPCI.h,v 1.1 2003/01/02 18:12:48 tsi Exp $ */ -/* - * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from the - * XFree86 Project. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef PCI_460GX_H -#define PCI_460GX_H 1 - -#include -#include - -Bool xorgProbe460GX(scanpciWrapperOpt flags); -void xf86PreScan460GX(void); -void xf86PostScan460GX(void); - -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/Imakefile deleted file mode 100644 index bae6ee7c2..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/Imakefile +++ /dev/null @@ -1,165 +0,0 @@ -XCOMM $XConsortium: Imakefile /main/16 1996/10/27 18:07:43 kaleb $ - - - - -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile,v 1.29tsi Exp $ - -#include - -#if defined(LinuxArchitecture) && defined(AlphaArchitecture) - -XCOMM Alpha (Linux) PCI driver - -PCIDRVRSRC = axpPci.c -PCIDRVROBJ = axpPci.o - -#elif defined(LinuxArchitecture) && defined(SparcArchitecture) - -XCOMM Sparc SBUS driver and generic Linux PCI driver - -PCIDRVRSRC = sparcPci.c linuxPci.c -PCIDRVROBJ = sparcPci.o linuxPci.o -SBUSDRVSRC = Sbus.c -SBUSDRVOBJ = Sbus.o - -#elif defined(SunArchitecture) && defined(SparcArchitecture) - -XCOMM Sparc SBUS & PCI drivers - -PCIDRVRSRC = sparcPci.c -PCIDRVROBJ = sparcPci.o -SBUSDRVSRC = Sbus.c -SBUSDRVOBJ = Sbus.o - -#elif defined(LinuxArchitecture) && \ - (defined(PpcArchitecture) || \ - defined(Ppc64Architecture) || \ - defined(MipsArchitecture) || \ - defined(ia64Architecture) || \ - defined(Mc68020Architecture) || \ - defined(Arm32Architecture) || \ - defined(HPArchitecture) || \ - defined(s390Architecture) || \ - defined(SuperHArchitecture) || \ - defined(SuperHebArchitecture)) - -XCOMM generic linux PCI driver (using /proc/bus/pci, requires kernel 2.2) - -PCIDRVRSRC = linuxPci.c -PCIDRVROBJ = linuxPci.o - -#elif defined(OpenBSDArchitecture) && \ - (defined(PpcArchitecture) || \ - defined(AlphaArchitecture) || \ - defined(Sparc64Architecture)) - -XCOMM OpenBSD/alpha, OpenBSD/powerpc and OpenBSD/sparc64 - -PCIDRVRSRC = freebsdPci.c -PCIDRVROBJ = freebsdPci.o - -#elif defined(NetBSDArchitecture) && defined(PpcArchitecture) - -XCOMM NetBSD/powerpc - -PCIDRVRSRC = netbsdPci.c -PCIDRVROBJ = netbsdPci.o - -#elif defined(FreeBSDArchitecture) && defined(PpcArchitecture) - -XCOMM FreeBSD/PowerPC PCI driver (using /dev/pci) - -PCIDRVRSRC = freebsdPci.c -PCIDRVROBJ = freebsdPci.o - -#elif defined(PpcArchitecture) - -XCOMM PowerPC PCI drivers - -PCIDRVRSRC = ppcPci.c -PCIDRVROBJ = ppcPci.o - -#elif defined(LinuxArchitecture) && \ - (defined(i386Architecture) || defined(AMD64Architecture)) - -XCOMM ix86 PCI driver with OS fallback for Linux - -PCIDRVRSRC = ix86Pci.c linuxPci.c -PCIDRVROBJ = ix86Pci.o linuxPci.o - -#elif defined(KFreeBSDArchitecture) && \ - (defined(AlphaArchitecture) || defined(AMD64Architecture)) - -XCOMM generic FreeBSD PCI driver (using /dev/pci) - -PCIDRVRSRC = freebsdPci.c -PCIDRVROBJ = freebsdPci.o - -#elif defined(KFreeBSDArchitecture) && defined(Sparc64Architecture) - -XCOMM Sparc SBUS & PCI drivers - -PCIDRVRSRC = freebsdPci.c -PCIDRVROBJ = freebsdPci.o -SBUSDRVSRC = Sbus.c -SBUSDRVOBJ = Sbus.o - -#elif defined(NetBSDArchitecture) && defined(AlphaArchitecture) - -XCOMM Alpha (NetBSD) PCI driver - -PCIDRVRSRC = netbsdPci.c -PCIDRVROBJ = netbsdPci.o - -#elif defined(i386Architecture) || \ - defined(ia64Architecture) || \ - defined(AMD64Architecture) - -XCOMM ix86 PCI driver - -PCIDRVRSRC = ix86Pci.c -PCIDRVROBJ = ix86Pci.o -XCOMM PCIDRVRSRC = linuxPci.c -XCOMM PCIDRVROBJ = linuxPci.o - -#else -XCOMM no PCI driver -- shouldn't get here -#endif - -#if defined(SparcArchitecture) -# if !defined(SunArchitecture) -PCIARCHSRC = sparcPci.c -PCIARCHOBJ = sparcPci.o -# endif -#elif defined(ia64Architecture) -PCIARCHSRC = 460gxPCI.c e8870PCI.c zx1PCI.c altixPCI.c -PCIARCHOBJ = 460gxPCI.o e8870PCI.o zx1PCI.o altixPCI.o -#endif - -SRCS = Pci.c $(PCIDRVRSRC) $(SBUSDRVSRC) $(PCIARCHSRC) -OBJS = Pci.o $(PCIDRVROBJ) $(SBUSDRVOBJ) $(PCIARCHOBJ) - -INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) - -NormalLibraryObjectRule() -SubdirLibraryRule($(OBJS)) - -/* - * egcs 1.1.2 as provided with some Linux distributions has an optimisation - * bug that results in bad code for this file. - */ -#if Egcs112Bug -SpecialCObjectRule(Pci,NullParameter,-O0) -#endif - -#if defined(SunArchitecture) && defined(SparcArchitecture) - -LFS_DEFINES = `getconf LFS_CFLAGS` - -SpecialCObjectRule(sparcPci,NullParameter,$(LFS_DEFINES)) - -#endif - -DependTarget() diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/Pci.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/Pci.c deleted file mode 100644 index 4e71eb614..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/Pci.c +++ /dev/null @@ -1,1453 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.82 2004/01/16 15:39:04 tsi Exp $ */ -/* - * Pci.c - New server PCI access functions - * - * The XFree86 server PCI access functions have been reimplemented as a - * framework that allows each supported platform/OS to have their own - * platform/OS specific pci driver. - * - * All of the public PCI access functions exported to the other parts of - * the server are declared in Pci.h and defined herein. These include: - * pciInit() - Initialize PCI access functions - * pciFindFirst() - Find a PCI device by dev/vend id - * pciFindNext() - Find another PCI device by dev/vend id - * pciReadLong() - Read a 32 bit value from a device's cfg space - * pciReadWord() - Read a 16 bit value from a device's cfg space - * pciReadByte() - Read an 8 bit value from a device's cfg space - * pciWriteLong() - Write a 32 bit value to a device's cfg space - * pciWriteWord() - Write a 16 bit value to a device's cfg space - * pciWriteByte() - Write an 8 bit value to a device's cfg space - * pciSetBitsLong() - Write a 32 bit value against a mask - * pciSetBitsByte() - Write an 8 bit value against a mask - * pciTag() - Return tag for a given PCI bus, device, & - * function - * pciBusAddrToHostAddr() - Convert a PCI address to a host address - * pciHostAddrToBusAddr() - Convert a host address to a PCI address - * pciGetBaseSize() - Returns the number of bits in a PCI base - * addr mapping - * xf86MapPciMem() - Like xf86MapVidMem() except function expects - * a PCI address and a PCITAG that identifies - * a PCI device - * xf86ReadPciBIOS() - Like xf86ReadBIOS() but can handle PCI/host - * address translation and BIOS decode enabling - * xf86scanpci() - Return info about all PCI devices - * xf86GetPciDomain() - Return domain number from a PCITAG - * xf86MapDomainMemory() - Like xf86MapPciMem() but can handle - * domain/host address translation - * xf86MapDomainIO() - Maps PCI I/O spaces - * xf86ReadDomainMemory() - Like xf86ReadPciBIOS() but can handle - * domain/host address translation - * - * The actual PCI backend driver is selected by the pciInit() function - * (see below) using either compile time definitions, run-time checks, - * or both. - * - * Certain generic functions are provided that make the implementation - * of certain well behaved platforms (e.g. those supporting PCI config - * mechanism 1 or some thing close to it) very easy. - * - * Less well behaved platforms/OS's can roll their own functions. - * - * To add support for another platform/OS, add a call to fooPciInit() within - * pciInit() below under the correct compile time definition or run-time - * conditional. - * - * The fooPciInit() procedure must do three things: - * 1) Initialize the pciBusTable[] for all primary PCI buses including - * the per domain PCI access functions (readLong, writeLong, - * addrBusToHost, and addrHostToBus). - * - * 2) Add entries to pciBusTable[] for configured secondary buses. This - * step may be skipped if a platform is using the generic findFirst/ - * findNext functions because these procedures will automatically - * discover and add secondary buses dynamically. - * - * 3) Overide default settings for global PCI access functions if - * required. These include pciFindFirstFP, pciFindNextFP, - * Of course, if you choose not to use one of the generic - * functions, you will need to provide a platform specifc replacement. - * - * Gary Barton - * Concurrent Computer Corporation - * garyb@gate.net - * - */ - -/* - * Copyright 1998 by Concurrent Computer Corporation - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Concurrent Computer - * Corporation not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Concurrent Computer Corporation makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * Copyright 1998 by Metro Link Incorporated - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * This software is derived from the original XFree86 PCI code - * which includes the following copyright notices as well: - * - * Copyright 1995 by Robin Cutshaw - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of the above listed copyright holder(s) - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. The above listed - * copyright holder(s) make(s) no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * This code is also based heavily on the code in FreeBSD-current, which was - * written by Wolfgang Stanglmeier, and contains the following copyright: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -/* - * Copyright (c) 1999-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include "compiler.h" -#include "xf86.h" -#include "xf86Priv.h" -#define XF86_OS_PRIVS -#include "xf86_OSproc.h" -#include "Pci.h" - -#define PCI_MFDEV_SUPPORT 1 /* Include PCI multifunction device support */ -#define PCI_BRIDGE_SUPPORT 1 /* Include support for PCI-to-PCI bridges */ - -/* - * Global data - */ -static int pciInitialized = 0; - -CARD32 pciDevid; /* Requested device/vendor ID (after mask) */ -CARD32 pciDevidMask; /* Bit mask applied (AND) before comparison */ - /* of real devid's with requested */ - -int pciBusNum; /* Bus Number of current device */ -int pciDevNum; /* Device number of current device */ -int pciFuncNum; /* Function number of current device */ -PCITAG pciDeviceTag; /* Tag for current device */ - -pciBusInfo_t *pciBusInfo[MAX_PCI_BUSES] = { NULL, }; -int pciNumBuses = 0; /* Actual number of PCI buses */ -int pciMaxBusNum = MAX_PCI_BUSES; -static Bool inProbe = FALSE; - -static pciConfigPtr pci_devp[MAX_PCI_DEVICES + 1] = {NULL, }; - -/* - * Platform specific PCI function pointers. - * - * NOTE: A platform/OS specific pci init procedure can override these defaults - * by setting them to the appropriate platform dependent functions. - */ -PCITAG (*pciFindFirstFP)(void) = pciGenFindFirst; -PCITAG (*pciFindNextFP)(void) = pciGenFindNext; - -/* - * pciInit - choose correct platform/OS specific PCI init routine - */ -void -pciInit() -{ - if (pciInitialized) - return; - - pciInitialized = 1; - - /* XXX */ -#if defined(DEBUGPCI) - if (DEBUGPCI >= xf86Verbose) - xf86Verbose = DEBUGPCI; -#endif - - ARCH_PCI_INIT(); -#if defined(ARCH_PCI_OS_INIT) - if (pciNumBuses <= 0) - ARCH_PCI_OS_INIT(); -#endif -} - -PCITAG -pciFindFirst(CARD32 id, CARD32 mask) -{ -#ifdef DEBUGPCI - ErrorF("pciFindFirst(0x%lx, 0x%lx), pciInit = %d\n", id, mask, pciInitialized); -#endif - pciInit(); - - pciDevid = id & mask; - pciDevidMask = mask; - - return((*pciFindFirstFP)()); -} - -PCITAG -pciFindNext(void) -{ -#ifdef DEBUGPCI - ErrorF("pciFindNext(), pciInit = %d\n", pciInitialized); -#endif - pciInit(); - - return((*pciFindNextFP)()); -} - -CARD32 -pciReadLong(PCITAG tag, int offset) -{ - int bus = PCI_BUS_FROM_TAG(tag); - -#ifdef DEBUGPCI - ErrorF("pciReadLong(0x%lx, %d)\n", tag, offset); -#endif - pciInit(); - - if ((bus >= 0) && ((bus < pciNumBuses) || inProbe) && pciBusInfo[bus] && - pciBusInfo[bus]->funcs->pciReadLong) { - CARD32 rv = (*pciBusInfo[bus]->funcs->pciReadLong)(tag, offset); - - PCITRACE(1, ("pciReadLong: tag=0x%x [b=%d,d=%d,f=%d] returns 0x%08x\n", - tag, bus, PCI_DEV_FROM_TAG(tag), PCI_FUNC_FROM_TAG(tag), rv)); - return(rv); - } - - return(PCI_NOT_FOUND); -} - -CARD16 -pciReadWord(PCITAG tag, int offset) -{ - CARD32 tmp; - int shift = (offset & 3) * 8; - int aligned_offset = offset & ~3; - int bus = PCI_BUS_FROM_TAG(tag); - - if (shift != 0 && shift != 16) - FatalError("pciReadWord: Alignment error: Cannot read 16 bits " - "at offset %d\n", offset); - - pciInit(); - - if ((bus >= 0) && ((bus < pciNumBuses) || inProbe) && pciBusInfo[bus] && - pciBusInfo[bus]->funcs->pciReadWord) { - CARD32 rv = (*pciBusInfo[bus]->funcs->pciReadWord)(tag, offset); - - return(rv); - } else { - tmp = pciReadLong(tag, aligned_offset); - - return((CARD16)((tmp >> shift) & 0xffff)); - } -} - -CARD8 -pciReadByte(PCITAG tag, int offset) -{ - CARD32 tmp; - int shift = (offset & 3) * 8; - int aligned_offset = offset & ~3; - int bus = PCI_BUS_FROM_TAG(tag); - - pciInit(); - - if ((bus >= 0) && ((bus < pciNumBuses) || inProbe) && pciBusInfo[bus] && - pciBusInfo[bus]->funcs->pciReadByte) { - CARD8 rv = (*pciBusInfo[bus]->funcs->pciReadByte)(tag, offset); - - return(rv); - } else { - tmp = pciReadLong(tag, aligned_offset); - - return((CARD8)((tmp >> shift) & 0xff)); - } -} - -void -pciWriteLong(PCITAG tag, int offset, CARD32 val) -{ - int bus = PCI_BUS_FROM_TAG(tag); - - pciInit(); - - if ((bus >= 0) && (bus < pciNumBuses) && pciBusInfo[bus] && - pciBusInfo[bus]->funcs->pciWriteLong) - (*pciBusInfo[bus]->funcs->pciWriteLong)(tag, offset, val); -} - -void -pciWriteWord(PCITAG tag, int offset, CARD16 val) -{ - CARD32 tmp; - int aligned_offset = offset & ~3; - int shift = (offset & 3) * 8; - int bus = PCI_BUS_FROM_TAG(tag); - - if (shift != 0 && shift != 16) - FatalError("pciWriteWord: Alignment Error: Cannot read 16 bits " - "from offset %d\n", offset); - - pciInit(); - - if ((bus >= 0) && (bus < pciNumBuses) && pciBusInfo[bus] && - pciBusInfo[bus]->funcs->pciWriteWord) { - (*pciBusInfo[bus]->funcs->pciWriteWord)(tag, offset, val); - } else { - tmp = pciReadLong(tag, aligned_offset); - - tmp &= ~(0xffffL << shift); - tmp |= (((CARD32)val) << shift); - - pciWriteLong(tag, aligned_offset, tmp); - } -} - -void -pciWriteByte(PCITAG tag, int offset, CARD8 val) -{ - CARD32 tmp; - int aligned_offset = offset & ~3; - int shift = (offset & 3) *8 ; - int bus = PCI_BUS_FROM_TAG(tag); - - pciInit(); - - if ((bus >= 0) && (bus < pciNumBuses) && pciBusInfo[bus] && - pciBusInfo[bus]->funcs->pciWriteByte) { - (*pciBusInfo[bus]->funcs->pciWriteByte)(tag, offset, val); - } else { - - tmp = pciReadLong(tag, aligned_offset); - - tmp &= ~(0xffL << shift); - tmp |= (((CARD32)val) << shift); - - pciWriteLong(tag, aligned_offset, tmp); - } -} - -void -pciSetBitsLong(PCITAG tag, int offset, CARD32 mask, CARD32 val) -{ - int bus = PCI_BUS_FROM_TAG(tag); - -#ifdef DEBUGPCI - ErrorF("pciReadLong(0x%lx, %d)\n", tag, offset); -#endif - pciInit(); - - if ((bus >= 0) && (bus < pciNumBuses) && pciBusInfo[bus] && - pciBusInfo[bus]->funcs->pciSetBitsLong) { - (*pciBusInfo[bus]->funcs->pciSetBitsLong)(tag, offset, mask, val); - } -} - -void -pciSetBitsByte(PCITAG tag, int offset, CARD8 mask, CARD8 val) -{ - CARD32 tmp_mask, tmp_val; - int aligned_offset = offset & ~3; - int shift = (offset & 3) *8 ; - - tmp_mask = mask << shift; - tmp_val = val << shift; - pciSetBitsLong(tag, aligned_offset, tmp_mask, tmp_val); -} - -ADDRESS -pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr) -{ - int bus = PCI_BUS_FROM_TAG(tag); - - pciInit(); - - if ((bus >= 0) && (bus < pciNumBuses) && pciBusInfo[bus] && - pciBusInfo[bus]->funcs->pciAddrBusToHost) - return (*pciBusInfo[bus]->funcs->pciAddrBusToHost)(tag, type, addr); - else - return(addr); -} - -ADDRESS -pciHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr) -{ - int bus = PCI_BUS_FROM_TAG(tag); - - pciInit(); - - if ((bus >= 0) && (bus < pciNumBuses) && pciBusInfo[bus] && - pciBusInfo[bus]->funcs->pciAddrHostToBus) - return (*pciBusInfo[bus]->funcs->pciAddrHostToBus)(tag, type, addr); - else - return(addr); -} - -/* - * pciGetBaseSize() returns the size of a PCI base address mapping in bits. - * The index identifies the base register: 0-5 are the six standard registers, - * and 6 is the ROM base register. If destructive is TRUE, it will write - * to the base address register to get an accurate result. Otherwise it - * makes a conservative guess based on the alignment of the already allocated - * address. If the result is accurate (ie, not an over-estimate), this is - * indicated by setting *min to TRUE (when min is non-NULL). This happens - * when either the destructive flag is set, the information is supplied by - * the OS if the OS supports this. - */ - -int -pciGetBaseSize(PCITAG tag, int index, Bool destructive, Bool *min) -{ - int offset; - CARD32 addr1; - CARD32 addr2; - CARD32 mask1; - CARD32 mask2; - int bits = 0; - - /* - * Eventually a function for this should be added to pciBusFuncs_t, but for - * now we'll just use a simple method based on the alignment of the already - * allocated address. - */ - - /* - * silently ignore bogus index values. Valid values are 0-6. 0-5 are - * the 6 base address registers, and 6 is the ROM base address register. - */ - if (index < 0 || index > 6) - return 0; - - pciInit(); - - if (xf86GetPciSizeFromOS(tag, index, &bits)) { - if (min) - *min = TRUE; - return bits; - } - - if (min) - *min = destructive; - - /* Get the PCI offset */ - if (index == 6) - offset = PCI_MAP_ROM_REG; - else - offset = PCI_MAP_REG_START + (index << 2); - - addr1 = pciReadLong(tag, offset); - /* - * Check if this is the second part of a 64 bit address. - * XXX need to check how endianness affects 64 bit addresses. - */ - if (index > 0 && index < 6) { - addr2 = pciReadLong(tag, offset - 4); - if (PCI_MAP_IS_MEM(addr2) && PCI_MAP_IS64BITMEM(addr2)) - return 0; - } - - if (destructive) { - pciWriteLong(tag, offset, 0xffffffff); - mask1 = pciReadLong(tag, offset); - pciWriteLong(tag, offset, addr1); - } else { - mask1 = addr1; - } - - /* Check if this is the first part of a 64 bit address. */ - if (index < 5 && PCI_MAP_IS_MEM(mask1) && PCI_MAP_IS64BITMEM(mask1)) { - if (PCIGETMEMORY(mask1) == 0) { - addr2 = pciReadLong(tag, offset + 4); - if (destructive) { - pciWriteLong(tag, offset + 4, 0xffffffff); - mask2 = pciReadLong(tag, offset + 4); - pciWriteLong(tag, offset + 4, addr2); - } else { - mask2 = addr2; - } - if (mask2 == 0) - return 0; - bits = 32; - while ((mask2 & 1) == 0) { - bits++; - mask2 >>= 1; - } - if (bits > 32) - return bits; - } - } - if (index < 6) - if (PCI_MAP_IS_MEM(mask1)) - mask1 = PCIGETMEMORY(mask1); - else - mask1 = PCIGETIO(mask1); - else - mask1 = PCIGETROM(mask1); - if (mask1 == 0) - return 0; - bits = 0; - while ((mask1 & 1) == 0) { - bits++; - mask1 >>= 1; - } - /* I/O maps can be no larger than 8 bits */ - - if ((index < 6) && PCI_MAP_IS_IO(addr1) && bits > 8) - bits = 8; - /* ROM maps can be no larger than 24 bits */ - if (index == 6 && bits > 24) - bits = 24; - return bits; -} - -PCITAG -pciTag(int busnum, int devnum, int funcnum) -{ - return(PCI_MAKE_TAG(busnum,devnum,funcnum)); -} - -#if defined(PCI_MFDEV_SUPPORT) || defined(PowerMAX_OS) - -Bool -pciMfDev(int busnum, int devnum) -{ - PCITAG tag0, tag1; - CARD32 id0, id1, val; - - /* Detect a multi-function device that complies to the PCI 2.0 spec */ - - tag0 = PCI_MAKE_TAG(busnum, devnum, 0); - id0 = pciReadLong(tag0, PCI_ID_REG); - if ((CARD16)(id0 + 1) <= (CARD16)1UL) - return FALSE; - - val = pciReadLong(tag0, PCI_HEADER_MISC) & 0x00ff0000; - if ((val != 0x00ff0000) && (val & PCI_HEADER_MULTIFUNCTION)) - return TRUE; - - /* - * Now, to find non-compliant devices... - * If there is a valid ID for function 1 and the ID for func 0 and 1 - * are different, or the base0 values of func 0 and 1 are differend, - * then assume there is a multi-function device. - */ - tag1 = PCI_MAKE_TAG(busnum, devnum, 1); - id1 = pciReadLong(tag1, PCI_ID_REG); - if ((CARD16)(id1 + 1) <= (CARD16)1UL) - return FALSE; - - /* Vendor IDs should match */ - if ((id0 ^ id1) & 0x0000ffff) - return FALSE; - - if ((id0 != id1) || - /* Note the following test is valid for header types 0, 1 and 2 */ - (pciReadLong(tag0, PCI_MAP_REG_START) != - pciReadLong(tag1, PCI_MAP_REG_START))) - return TRUE; - - return FALSE; -} - -#endif - -/* - * Generic find/read/write functions - */ -PCITAG -pciGenFindNext(void) -{ - CARD32 devid, tmp; - int sec_bus, pri_bus; - static int previousBus = 0; - Bool speculativeProbe = FALSE; - unsigned char base_class, sub_class; - -#ifdef DEBUGPCI - ErrorF("pciGenFindNext\n"); -#endif - - for (;;) { - -#ifdef DEBUGPCI - ErrorF("pciGenFindNext: pciBusNum %d\n", pciBusNum); -#endif - if (pciBusNum == -1) { - /* - * Start at top of the order - */ - if (pciNumBuses <= 0) - return(PCI_NOT_FOUND); - - /* Skip ahead to the first bus defined by pciInit() */ - for (pciBusNum = 0; !pciBusInfo[pciBusNum]; ++pciBusNum); - pciFuncNum = 0; - pciDevNum = 0; - previousBus = pciBusNum; /* make sure previousBus exists */ - } else { -#ifdef PCI_MFDEV_SUPPORT -#ifdef DEBUGPCI - ErrorF("pciGenFindNext: pciFuncNum %d\n", pciFuncNum); -#endif - /* - * Somewhere in middle of order. Determine who's - * next up - */ - if (pciFuncNum == 0) { - /* - * Is current dev a multifunction device? - */ - if (!speculativeProbe && pciMfDev(pciBusNum, pciDevNum)) - /* Probe for other functions */ - pciFuncNum = 1; - else - /* - * No more functions this device. Next - * device please - */ - pciDevNum ++; - } else if (++pciFuncNum >= 8) { - /* No more functions for this device. Next device please */ - pciFuncNum = 0; - pciDevNum ++; - } -#else - pciDevNum ++; -#endif - if (pciDevNum >= 32 || - !pciBusInfo[pciBusNum] || - pciDevNum >= pciBusInfo[pciBusNum]->numDevices) { -#ifdef DEBUGPCI - ErrorF("pciGenFindNext: next bus\n"); -#endif - /* - * No more devices for this bus. Next bus please - */ - if (speculativeProbe) { - NextSpeculativeBus: - xfree(pciBusInfo[pciBusNum]); - pciBusInfo[pciBusNum] = NULL; - speculativeProbe = FALSE; - } - - if (++pciBusNum >= pciMaxBusNum) { -#ifdef DEBUGPCI - ErrorF("pciGenFindNext: out of buses\n"); -#endif - /* No more buses. All done for now */ - return(PCI_NOT_FOUND); - } - - pciDevNum = 0; - } - } - -#ifdef DEBUGPCI - ErrorF("pciGenFindNext: pciBusInfo[%d] = 0x%lx\n", pciBusNum, pciBusInfo[pciBusNum]); -#endif - if (!pciBusInfo[pciBusNum]) { - pciBusInfo[pciBusNum] = xnfalloc(sizeof(pciBusInfo_t)); - *pciBusInfo[pciBusNum] = *pciBusInfo[previousBus]; - - speculativeProbe = TRUE; - } - - /* - * At this point, pciBusNum, pciDevNum, and pciFuncNum have been - * advanced to the next device. Compute the tag, and read the - * device/vendor ID field. - */ -#ifdef DEBUGPCI - ErrorF("pciGenFindNext: [%d, %d, %d]\n", pciBusNum, pciDevNum, pciFuncNum); -#endif - pciDeviceTag = PCI_MAKE_TAG(pciBusNum, pciDevNum, pciFuncNum); - inProbe = TRUE; - devid = pciReadLong(pciDeviceTag, PCI_ID_REG); - inProbe = FALSE; -#ifdef DEBUGPCI - ErrorF("pciGenFindNext: pciDeviceTag = 0x%lx, devid = 0x%lx\n", pciDeviceTag, devid); -#endif - if ((CARD16)(devid + 1U) <= (CARD16)1UL) - continue; /* Nobody home. Next device please */ - - /* - * Some devices mis-decode configuration cycles in such a way as to - * create phantom buses. - */ - if (speculativeProbe && (pciDevNum == 0) && (pciFuncNum == 0) && - (PCI_BUS_NO_DOMAIN(pciBusNum) > 0)) { - for (;;) { - if (++pciDevNum >= pciBusInfo[pciBusNum]->numDevices) - goto NextSpeculativeBus; - if (devid != - pciReadLong(PCI_MAKE_TAG(pciBusNum, pciDevNum, 0), - PCI_ID_REG)) - break; - } - - pciDevNum = 0; - } - - if (pciNumBuses <= pciBusNum) - pciNumBuses = pciBusNum + 1; - - speculativeProbe = FALSE; - previousBus = pciBusNum; - -#ifdef PCI_BRIDGE_SUPPORT - /* - * Before checking for a specific devid, look for enabled - * PCI to PCI bridge devices. If one is found, create and - * initialize a bus info record (if one does not already exist). - */ - tmp = pciReadLong(pciDeviceTag, PCI_CLASS_REG); - base_class = PCI_CLASS_EXTRACT(tmp); - sub_class = PCI_SUBCLASS_EXTRACT(tmp); - if ((base_class == PCI_CLASS_BRIDGE) && - ((sub_class == PCI_SUBCLASS_BRIDGE_PCI) || - (sub_class == PCI_SUBCLASS_BRIDGE_CARDBUS))) { - tmp = pciReadLong(pciDeviceTag, PCI_PCI_BRIDGE_BUS_REG); - sec_bus = PCI_SECONDARY_BUS_EXTRACT(tmp, pciDeviceTag); - pri_bus = PCI_PRIMARY_BUS_EXTRACT(tmp, pciDeviceTag); -#ifdef DEBUGPCI - ErrorF("pciGenFindNext: pri_bus %d sec_bus %d\n", - pri_bus, sec_bus); -#endif - if (pciBusNum != pri_bus) { - /* Some bridges do not implement the primary bus register */ - if ((PCI_BUS_NO_DOMAIN(pri_bus) != 0) || - (sub_class != PCI_SUBCLASS_BRIDGE_CARDBUS)) - xf86Msg(X_WARNING, - "pciGenFindNext: primary bus mismatch on PCI" - " bridge 0x%08lx (0x%02x, 0x%02x)\n", - pciDeviceTag, pciBusNum, pri_bus); - pri_bus = pciBusNum; - } - if ((pri_bus < sec_bus) && (sec_bus < pciMaxBusNum) && - pciBusInfo[pri_bus]) { - /* - * Found a secondary PCI bus - */ - if (!pciBusInfo[sec_bus]) { - pciBusInfo[sec_bus] = xnfalloc(sizeof(pciBusInfo_t)); - - /* Copy parents settings... */ - *pciBusInfo[sec_bus] = *pciBusInfo[pri_bus]; - } - - /* ...but not everything same as parent */ - pciBusInfo[sec_bus]->primary_bus = pri_bus; - pciBusInfo[sec_bus]->secondary = TRUE; - pciBusInfo[sec_bus]->numDevices = 32; - - if (pciNumBuses <= sec_bus) - pciNumBuses = sec_bus + 1; - } - } -#endif - - /* - * Does this device match the requested devid after - * applying mask? - */ -#ifdef DEBUGPCI - ErrorF("pciGenFindNext: pciDevidMask = 0x%lx, pciDevid = 0x%lx\n", pciDevidMask, pciDevid); -#endif - if ((devid & pciDevidMask) == pciDevid) - /* Yes - Return it. Otherwise, next device */ - return(pciDeviceTag); /* got a match */ - - } /* for */ - /*NOTREACHED*/ -} - -PCITAG -pciGenFindFirst(void) -{ - /* Reset PCI bus number to start from top */ - pciBusNum = -1; - - return pciGenFindNext(); -} - -CARD32 -pciByteSwap(CARD32 u) -{ -#if X_BYTE_ORDER == X_BIG_ENDIAN -# if defined(__powerpc__) && defined(PowerMAX_OS) - CARD32 tmp; - - __inst_stwbrx(u, &tmp, 0); - - return(tmp); - -# else /* !PowerMAX_OS */ - - return lswapl(u); - -# endif /* !PowerMAX_OS */ - -#else /* !BIG_ENDIAN */ - - return(u); - -#endif -} - -ADDRESS -pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS addr) -{ - return(addr); -} - -pciConfigPtr * -xf86scanpci(int flags) -{ - pciConfigPtr devp; - pciBusInfo_t *busp; - int idx = 0, i; - PCITAG tag; - static Bool done = FALSE; - - /* - * if we haven't found PCI devices checking for pci_devp may - * result in an endless recursion if platform/OS specific PCI - * bus probing code calls this function from with in it. - */ - if (done || pci_devp[0]) - return pci_devp; - - done = TRUE; - - pciInit(); - -#ifdef XF86SCANPCI_WRAPPER - XF86SCANPCI_WRAPPER(SCANPCI_INIT); -#endif - - tag = pciFindFirst(0,0); /* 0 mask means match any valid device */ - /* Check if no devices, return now */ - if (tag == PCI_NOT_FOUND) { -#ifdef XF86SCANPCI_WRAPPER - XF86SCANPCI_WRAPPER(SCANPCI_TERM); -#endif - return NULL; - } - -#ifdef DEBUGPCI - ErrorF("xf86scanpci: tag = 0x%lx\n", tag); -#endif -#ifndef OLD_FORMAT - xf86MsgVerb(X_INFO, 2, "PCI: PCI scan (all values are in hex)\n"); -#endif - - while (idx < MAX_PCI_DEVICES && tag != PCI_NOT_FOUND) { - devp = xcalloc(1, sizeof(pciDevice)); - if (!devp) { - xf86Msg(X_ERROR, - "xf86scanpci: Out of memory after %d devices!!\n", idx); - return (pciConfigPtr *)NULL; - } - - /* Identify pci device by bus, dev, func, and tag */ - devp->tag = tag; - devp->busnum = PCI_BUS_FROM_TAG(tag); - devp->devnum = PCI_DEV_FROM_TAG(tag); - devp->funcnum = PCI_FUNC_FROM_TAG(tag); - - /* Read config space for this device */ - for (i = 0; i < 17; i++) /* PCI hdr plus 1st dev spec dword */ - devp->cfgspc.dwords[i] = pciReadLong(tag, i * sizeof(CARD32)); - - /* Some broken devices don't implement this field... */ - if (devp->pci_header_type == 0xff) - devp->pci_header_type = 0; - - switch (devp->pci_header_type & 0x7f) { - case 0: - /* Get base address sizes for type 0 headers */ - for (i = 0; i < 7; i++) - devp->basesize[i] = - pciGetBaseSize(tag, i, FALSE, &devp->minBasesize); - break; - - case 1: - case 2: - /* Allow master aborts to complete normally on secondary buses */ - if (!(devp->pci_bridge_control & PCI_PCI_BRIDGE_MASTER_ABORT_EN)) - break; - pciWriteByte(tag, PCI_PCI_BRIDGE_CONTROL_REG, - devp->pci_bridge_control & - ~(PCI_PCI_BRIDGE_MASTER_ABORT_EN | - PCI_PCI_BRIDGE_SECONDARY_RESET)); - break; - - default: - break; - } - -#ifdef OLD_FORMAT - xf86MsgVerb(X_INFO, 2, "PCI: BusID 0x%.2x,0x%02x,0x%1x " - "ID 0x%04x,0x%04x Rev 0x%02x Class 0x%02x,0x%02x\n", - devp->busnum, devp->devnum, devp->funcnum, - devp->pci_vendor, devp->pci_device, devp->pci_rev_id, - devp->pci_base_class, devp->pci_sub_class); -#else - xf86MsgVerb(X_INFO, 2, "PCI: %.2x:%02x:%1x: chip %04x,%04x" - " card %04x,%04x rev %02x class %02x,%02x,%02x hdr %02x\n", - devp->busnum, devp->devnum, devp->funcnum, - devp->pci_vendor, devp->pci_device, - devp->pci_subsys_vendor, devp->pci_subsys_card, - devp->pci_rev_id, devp->pci_base_class, - devp->pci_sub_class, devp->pci_prog_if, - devp->pci_header_type); -#endif - - pci_devp[idx++] = devp; - tag = pciFindNext(); - -#ifdef DEBUGPCI - ErrorF("xf86scanpci: tag = pciFindNext = 0x%lx\n", tag); -#endif - } - - /* Restore modified data (in reverse order), and link buses */ - while (--idx >= 0) { - devp = pci_devp[idx]; - switch (devp->pci_header_type & 0x7f) { - case 0: - if ((devp->pci_base_class != PCI_CLASS_BRIDGE) || - (devp->pci_sub_class != PCI_SUBCLASS_BRIDGE_HOST)) - break; - pciBusInfo[devp->busnum]->bridge = devp; - pciBusInfo[devp->busnum]->primary_bus = devp->busnum; - break; - - case 1: - case 2: - i = PCI_SECONDARY_BUS_EXTRACT(devp->pci_pp_bus_register, devp->tag); - if (i > devp->busnum) { - if (pciBusInfo[i]) { - pciBusInfo[i]->bridge = devp; - /* - * The back link needs to be set here, and is unlikely to - * change. - */ - devp->businfo = pciBusInfo[i]; - } -#ifdef ARCH_PCI_PCI_BRIDGE - ARCH_PCI_PCI_BRIDGE(devp); -#endif - } - if (!(devp->pci_bridge_control & PCI_PCI_BRIDGE_MASTER_ABORT_EN)) - break; - pciWriteByte(devp->tag, PCI_PCI_BRIDGE_CONTROL_REG, - devp->pci_bridge_control & ~PCI_PCI_BRIDGE_SECONDARY_RESET); - break; - - default: - break; - } - } - -#ifdef XF86SCANPCI_WRAPPER - XF86SCANPCI_WRAPPER(SCANPCI_TERM); -#endif - - /* - * Lastly, link bridges to their secondary bus, after the architecture has - * had a chance to modify these assignments. - */ - for (idx = 0; idx < pciNumBuses; idx++) { - if (!(busp = pciBusInfo[idx]) || !(devp = busp->bridge)) - continue; - devp->businfo = busp; - } - -#ifndef OLD_FORMAT - xf86MsgVerb(X_INFO, 2, "PCI: End of PCI scan\n"); -#endif - - return pci_devp; -} - -CARD32 -pciCheckForBrokenBase(PCITAG Tag,int basereg) -{ - pciWriteLong(Tag, PCI_MAP_REG_START + (basereg << 2), 0xffffffff); - return pciReadLong(Tag, PCI_MAP_REG_START + (basereg << 2)); -} - -#if defined(INCLUDE_XF86_MAP_PCI_MEM) - -pointer -xf86MapPciMem(int ScreenNum, int Flags, PCITAG Tag, ADDRESS Base, - unsigned long Size) -{ - ADDRESS hostbase = pciBusAddrToHostAddr(Tag, PCI_MEM,Base); - pointer base; - CARD32 save = 0; - - /* - * If there are possible read side-effects, disable memory while - * doing the mapping. - */ - if (Flags & VIDMEM_READSIDEEFFECT) { - save = pciReadLong(Tag, PCI_CMD_STAT_REG); - pciWriteLong(Tag, PCI_CMD_STAT_REG, - save & ~PCI_CMD_MEM_ENABLE); - } - base = xf86MapDomainMemory(ScreenNum, Flags, Tag, hostbase, Size); - if (!base) { - FatalError("xf86MapPciMem: Could not mmap PCI memory " - "[base=0x%lx,hostbase=0x%lx,size=%lx] (%s)\n", - Base, hostbase, Size, strerror(errno)); - } - /* - * If read side-effects, do whatever might be needed to prevent - * unintended reads, then restore PCI_CMD_STAT_REG. - */ - if (Flags & VIDMEM_READSIDEEFFECT) { - xf86MapReadSideEffects(ScreenNum, Flags, base, Size); - pciWriteLong(Tag, PCI_CMD_STAT_REG, save); - } - return((pointer)base); -} - -static int -handlePciBIOS(PCITAG Tag, int basereg, - int (*func)(PCITAG, CARD8*, ADDRESS, pointer), - pointer args) -{ - CARD32 romsave = 0; - int i; - romBaseSource b_reg; - ADDRESS hostbase; - CARD8 tmp[64]; - int ret = 0; - - romsave = pciReadLong(Tag, PCI_MAP_ROM_REG); - - for (i = ROM_BASE_PRESET; i <= ROM_BASE_FIND; i++) { - memType savebase = 0, newbase, romaddr; - - switch (i) { - case ROM_BASE_PRESET: - /* Does the driver have a preference? */ - if (basereg > ROM_BASE_PRESET && basereg <= ROM_BASE_FIND) - b_reg = basereg; - else - b_reg = ++i; - break; - case ROM_BASE_FIND: - /* - * If we have something that looks like a valid address - * in romsave, it's probably not going to help to try - * to guess a new address and reprogram it. - */ - if (PCIGETROM(romsave)) { - pciWriteLong(Tag, PCI_MAP_ROM_REG, PCI_MAP_ROM_ADDRESS_MASK); - if (romsave != pciReadLong(Tag, PCI_MAP_ROM_REG)) { - pciWriteLong(Tag, PCI_MAP_ROM_REG, romsave); - continue; - } - } - default: - b_reg = i; - } - - if (!(newbase = getValidBIOSBase(Tag, b_reg))) - continue; /* no valid address found */ - - romaddr = PCIGETROM(newbase); - - /* if we use a mem base save it and move it out of the way */ - if (b_reg >= 0 && b_reg <= 5) { - savebase = pciReadLong(Tag, PCI_MAP_REG_START+(b_reg<<2)); - xf86MsgVerb(X_INFO,5,"xf86ReadPciBios: modifying membase[%i]" - " for device %i:%i:%i\n", basereg, - (int)PCI_BUS_FROM_TAG(Tag), (int)PCI_DEV_FROM_TAG(Tag), - (int)PCI_FUNC_FROM_TAG(Tag)); - pciWriteLong(Tag, PCI_MAP_REG_START + (b_reg << 2), - (CARD32)~0); - } - /* Set ROM base address and enable ROM address decoding */ - pciWriteLong(Tag, PCI_MAP_ROM_REG, romaddr - | PCI_MAP_ROM_DECODE_ENABLE); - - hostbase = pciBusAddrToHostAddr(Tag, PCI_MEM, PCIGETROM(romaddr)); - - if ((xf86ReadDomainMemory(Tag, hostbase, sizeof(tmp), tmp) != - sizeof(tmp)) || - (tmp[0] != 0x55) || (tmp[1] != 0xaa) || !tmp[2] ) { - /* Restore the base registers if they were changed. */ - pciWriteLong(Tag, PCI_MAP_ROM_REG, romsave); - if (savebase) pciWriteLong(Tag, PCI_MAP_REG_START + (b_reg << 2), - (CARD32) savebase); - - /* No BIOS found: try another address */ - continue; - } - - ret = (*func)(Tag, tmp, hostbase, args); - - /* Restore the base register if it was changed. */ - if (savebase) pciWriteLong(Tag, PCI_MAP_REG_START + (b_reg << 2), - (CARD32) savebase); - /* Restore ROM address decoding */ - pciWriteLong(Tag, PCI_MAP_ROM_REG, romsave); - - return ret; - } - /* Restore ROM address decoding */ - pciWriteLong(Tag, PCI_MAP_ROM_REG, romsave); - return 0; -} - -typedef struct { - unsigned long Offset; - int Len; - unsigned char *Buf; - PciBiosType BiosType; -} readBios, *readBiosPtr; - -static int -readPciBios(PCITAG Tag, CARD8* tmp, ADDRESS hostbase, pointer args) -{ - unsigned int image_length = 0; - readBiosPtr rd = args; - int ret; - - /* We found a PCI BIOS Image. Now we look for the correct type */ - while ((tmp[0] == 0x55) && (tmp[1] == 0xAA)) { - unsigned short data_off = tmp[0x18] | (tmp[0x19] << 8); - unsigned char data[0x18]; - unsigned char type; - - if ((xf86ReadDomainMemory(Tag, hostbase + data_off, sizeof(data), data) - != sizeof(data)) || - (data[0] != 'P') || - (data[1] != 'C') || - (data[2] != 'I') || - (data[3] != 'R')) - break; - type = data[0x14]; -#ifdef PRINT_PCI - ErrorF("data segment in BIOS: 0x%x, type: 0x%x\n", data_off, type); -#endif - if (type != rd->BiosType) { /* not correct image: find next one */ - unsigned char indicator = data[0x15]; - unsigned int i_length; - if (indicator & 0x80) /* last image */ - break; - i_length = (data[0x10] | (data[0x11] << 8)) << 9; -#ifdef PRINT_PCI - ErrorF("data image length: 0x%x, ind: 0x%x\n", - image_length, indicator); -#endif - hostbase += i_length; - if (xf86ReadDomainMemory(Tag, hostbase, sizeof(tmp), tmp) - != sizeof(tmp)) - break; - continue; - } - /* OK, we have a PCI BIOS Image of the correct type */ - - if (rd->BiosType == PCI_BIOS_PC) - image_length = tmp[2] << 9; - else - image_length = (data[0x10] | (data[0x11] << 8)) << 9; -#ifdef PRINT_PCI - ErrorF("BIOS length: 0x%x\n", image_length); -#endif - break; - } - - ret = 0; - if (image_length) { - - /* - * if no length is given return the full lenght, - * Offset 0. Beware: Area pointed to by Buf must - * be large enough! - */ - if (rd->Len == 0) { - rd->Len = image_length; - rd->Offset = 0; - } - if ((rd->Offset) > (image_length)) { - xf86Msg(X_WARNING,"xf86ReadPciBios: requesting data past " - "end of BIOS %li > %i\n",(rd->Offset) , (image_length)); - } else { - if ((rd->Offset + rd->Len) > (image_length)) { - rd->Len = (image_length) - rd->Offset; - xf86MsgVerb(X_INFO,3,"Truncating PCI BIOS Length to %i\n",rd->Len); - } - } - - /* Read BIOS */ - ret = xf86ReadDomainMemory(Tag, hostbase + rd->Offset, rd->Len, rd->Buf); - } - - return ret; -} - -static int -getPciBIOSTypes(PCITAG Tag, CARD8* tmp, ADDRESS hostbase, pointer arg) -{ - int n = 0; - PciBiosType *Buf = arg; - - /* We found a PCI BIOS Image. Now we collect the types type */ - do { - unsigned short data_off = tmp[0x18] | (tmp[0x19] << 8); - unsigned char data[0x16]; - unsigned int i_length; - - if ((xf86ReadDomainMemory(Tag, hostbase + data_off, sizeof(data), data) - != sizeof(data)) || - (data[0] != 'P') || - (data[1] != 'C') || - (data[2] != 'I') || - (data[3] != 'R')) - break; - - if (data[0x14] >= PCI_BIOS_OTHER) - *Buf++ = PCI_BIOS_OTHER; - else - *Buf++ = data[0x14]; - - n++; - if (data[0x15] & 0x80) /* last image */ - break; -#ifdef PRINT_PCI - ErrorF("data segment in BIOS: 0x%x, type: 0x%x\n", data_off, type); -#endif - i_length = (data[0x10] | (data[0x11] << 8)) << 9; -#ifdef PRINT_PCI - ErrorF("data image length: 0x%x, ind: 0x%x\n", - image_length, indicator); -#endif - hostbase += i_length; - if (xf86ReadDomainMemory(Tag, hostbase, sizeof(tmp), tmp) - != sizeof(tmp)) - break; - continue; - } while ((tmp[0] == 0x55) && (tmp[1] == 0xAA)); - return n; -} - -typedef CARD32 (*ReadProcPtr)(PCITAG, int); -typedef void (*WriteProcPtr)(PCITAG, int, CARD32); - -static int -HandlePciBios(PCITAG Tag, int basereg, - int (*func)(PCITAG, CARD8*, ADDRESS, pointer), - pointer ptr) -{ - int n, num; - CARD32 Acc1, Acc2; - PCITAG *pTag; - int i; - - n = handlePciBIOS(Tag,basereg,func,ptr); - if (n) - return n; - - num = pciTestMultiDeviceCard(PCI_BUS_FROM_TAG(Tag), - PCI_DEV_FROM_TAG(Tag), - PCI_FUNC_FROM_TAG(Tag),&pTag); - - if (!num) return 0; - -#define PCI_ENA (PCI_CMD_MEM_ENABLE | PCI_CMD_IO_ENABLE) - Acc1 = pciReadLong(Tag, PCI_CMD_STAT_REG); - pciWriteLong(Tag, PCI_CMD_STAT_REG, (Acc1 & ~PCI_ENA)); - - for (i = 0; i < num; i++) { - Acc2 = pciReadLong(pTag[i], PCI_CMD_STAT_REG); - pciWriteLong(pTag[i], PCI_CMD_STAT_REG, (Acc2 | PCI_ENA)); - - n = handlePciBIOS(pTag[i],0,func,ptr); - - pciWriteLong(pTag[i], PCI_CMD_STAT_REG, Acc2); - if (n) - break; - } - pciWriteLong(Tag, PCI_CMD_STAT_REG, Acc1); - return n; -} - -int -xf86ReadPciBIOS(unsigned long Offset, PCITAG Tag, int basereg, - unsigned char *Buf, int Len) -{ - return xf86ReadPciBIOSByType(Offset, Tag, basereg, Buf, Len, PCI_BIOS_PC); -} - -int -xf86ReadPciBIOSByType(unsigned long Offset, PCITAG Tag, int basereg, - unsigned char *Buf, int Len, PciBiosType Type) -{ - - readBios rb; - rb.Offset = Offset; - rb.Len = Len; - rb.Buf = Buf; - rb.BiosType = Type; - - return HandlePciBios(Tag, basereg, readPciBios, &rb); -} - -int -xf86GetAvailablePciBIOSTypes(PCITAG Tag, int basereg, PciBiosType *Buf) -{ - return HandlePciBios(Tag, basereg, getPciBIOSTypes, (pointer) Buf); -} - -#endif /* INCLUDE_XF86_MAP_PCI_MEM */ - -#ifdef INCLUDE_XF86_NO_DOMAIN - -int -xf86GetPciDomain(PCITAG Tag) -{ - return 0; -} - -pointer -xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, - ADDRESS Base, unsigned long Size) -{ - return xf86MapVidMem(ScreenNum, Flags, Base, Size); -} - -IOADDRESS -xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag, - IOADDRESS Base, unsigned long Size) -{ - return Base; -} - -int -xf86ReadDomainMemory(PCITAG Tag, ADDRESS Base, int Len, unsigned char *Buf) -{ - int ret, length, rlength; - - /* Read in 64kB chunks */ - ret = 0; - while ((length = Len) > 0) { - if (length > 0x010000) length = 0x010000; - rlength = xf86ReadBIOS(Base, 0, Buf, length); - if (rlength < 0) { - ret = rlength; - break; - } - ret += rlength; - if (rlength < length) break; - Base += rlength; - Buf += rlength; - Len -= rlength; - } - - return ret; -} - -#endif /* INCLUDE_XF86_NO_DOMAIN */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/Pci.h b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/Pci.h deleted file mode 100644 index 70293d3f4..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/Pci.h +++ /dev/null @@ -1,449 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h,v 1.45 2004/02/02 03:55:31 dawes Exp $ */ -/* - * Copyright 1998 by Concurrent Computer Corporation - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Concurrent Computer - * Corporation not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Concurrent Computer Corporation makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * Copyright 1998 by Metro Link Incorporated - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * This file is derived in part from the original xf86_PCI.h that included - * following copyright message: - * - * Copyright 1995 by Robin Cutshaw - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of the above listed copyright holder(s) - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. The above listed - * copyright holder(s) make(s) no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* - * Copyright (c) 1999-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - - -/* - * This file has the private Pci definitions. The public ones are imported - * from xf86Pci.h. Drivers should not use this file. - */ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef _PCI_H -#define _PCI_H 1 - -#include -#include -#include "xf86Pci.h" -#include "xf86PciInfo.h" - -/* - * Global Definitions - */ -#define MAX_PCI_DEVICES 128 /* Max number of devices accomodated */ - /* by xf86scanpci */ -#if defined(sun) && defined(SVR4) && defined(sparc) -# define MAX_PCI_BUSES 4096 /* Max number of PCI buses */ -#elif defined(__alpha__) && defined (linux) -# define MAX_PCI_DOMAINS 512 -# define PCI_DOM_MASK 0x01fful -# define MAX_PCI_BUSES (MAX_PCI_DOMAINS*256) /* 256 per domain */ -#else -# define MAX_PCI_BUSES 256 /* Max number of PCI buses */ -#endif - -#define DEVID(vendor, device) \ - ((CARD32)((PCI_##device << 16) | PCI_##vendor)) - -#ifndef PCI_DOM_MASK -# define PCI_DOM_MASK 0x0ffu -#endif -#define PCI_DOMBUS_MASK (((PCI_DOM_MASK) << 8) | 0x0ffu) - -/* - * "b" contains an optional domain number. - */ -#define PCI_MAKE_TAG(b,d,f) ((((b) & (PCI_DOMBUS_MASK)) << 16) | \ - (((d) & 0x00001fu) << 11) | \ - (((f) & 0x000007u) << 8)) - -#define PCI_MAKE_BUS(d,b) ((((d) & (PCI_DOM_MASK)) << 8) | ((b) & 0xffu)) - -#define PCI_DOM_FROM_TAG(tag) (((tag) >> 24) & (PCI_DOM_MASK)) -#define PCI_BUS_FROM_TAG(tag) (((tag) >> 16) & (PCI_DOMBUS_MASK)) -#define PCI_DEV_FROM_TAG(tag) (((tag) & 0x0000f800u) >> 11) -#define PCI_FUNC_FROM_TAG(tag) (((tag) & 0x00000700u) >> 8) - -#define PCI_DFN_FROM_TAG(tag) (((tag) & 0x0000ff00u) >> 8) -#define PCI_BDEV_FROM_TAG(tag) ((tag) & 0x00fff800u) - -#define PCI_DOM_FROM_BUS(bus) (((bus) >> 8) & (PCI_DOM_MASK)) -#define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu) -#define PCI_TAG_NO_DOMAIN(tag) ((tag) & 0x00ffff00u) - -/* - * Macros for bus numbers found in P2P headers. - */ -#define PCI_PRIMARY_BUS_EXTRACT(x, tag) \ - ((((x) & PCI_PRIMARY_BUS_MASK ) >> 0) | (PCI_DOM_FROM_TAG(tag) << 8)) -#define PCI_SECONDARY_BUS_EXTRACT(x, tag) \ - ((((x) & PCI_SECONDARY_BUS_MASK ) >> 8) | (PCI_DOM_FROM_TAG(tag) << 8)) -#define PCI_SUBORDINATE_BUS_EXTRACT(x, tag) \ - ((((x) & PCI_SUBORDINATE_BUS_MASK) >> 16) | (PCI_DOM_FROM_TAG(tag) << 8)) - -#define PCI_PRIMARY_BUS_INSERT(x, y) \ - (((x) & ~PCI_PRIMARY_BUS_MASK ) | (((y) & 0xffu) << 0)) -#define PCI_SECONDARY_BUS_INSERT(x, y) \ - (((x) & ~PCI_SECONDARY_BUS_MASK ) | (((y) & 0xffu) << 8)) -#define PCI_SUBORDINATE_BUS_INSERT(x, y) \ - (((x) & ~PCI_SUBORDINATE_BUS_MASK) | (((y) & 0xffu) << 16)) - -/* Ditto for CardBus bridges */ -#define PCI_CB_PRIMARY_BUS_EXTRACT(x, tag) \ - PCI_PRIMARY_BUS_EXTRACT(x, tag) -#define PCI_CB_CARDBUS_BUS_EXTRACT(x, tag) \ - PCI_SECONDARY_BUS_EXTRACT(x, tag) -#define PCI_CB_SUBORDINATE_BUS_EXTRACT(x, tag) \ - PCI_SUBORDINATE_BUS_EXTRACT(x, tag) - -#define PCI_CB_PRIMARY_BUS_INSERT(x, tag) \ - PCI_PRIMARY_BUS_INSERT(x, tag) -#define PCI_CB_CARDBUS_BUS_INSERT(x, tag) \ - PCI_SECONDARY_BUS_INSERT(x, tag) -#define PCI_CB_SUBORDINATE_BUS_INSERT(x, tag) \ - PCI_SUBORDINATE_BUS_INSERT(x, tag) - -#if X_BYTE_ORDER == X_BIG_ENDIAN -#define PCI_CPU(val) (((val >> 24) & 0x000000ff) | \ - ((val >> 8) & 0x0000ff00) | \ - ((val << 8) & 0x00ff0000) | \ - ((val << 24) & 0xff000000)) -#define PCI_CPU16(val) (((val >> 8) & 0x000000ff) | \ - ((val << 8) & 0x0000ff00)) -#else -#define PCI_CPU(val) (val) -#define PCI_CPU16(val) (val) -#endif - -/* - * Debug Macros/Definitions - */ -/* #define DEBUGPCI 2 */ /* Disable/enable trace in PCI code */ - -#if defined(DEBUGPCI) - -# define PCITRACE(lvl,printfargs) \ - if (lvl > xf86Verbose) { \ - ErrorF printfargs; \ - } - -#else /* !defined(DEBUGPCI) */ - -# define PCITRACE(lvl,printfargs) - -#endif /* !defined(DEBUGPCI) */ - -/* - * PCI Config mechanism definitions - */ -#define PCI_EN 0x80000000 - -#define PCI_CFGMECH1_ADDRESS_REG 0xCF8 -#define PCI_CFGMECH1_DATA_REG 0xCFC - -#define PCI_CFGMECH1_MAXDEV 32 - -/* - * Select architecture specific PCI init function - */ -#if defined(__alpha__) -# if defined(linux) -# define ARCH_PCI_INIT axpPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# elif defined(__FreeBSD__) || defined(__OpenBSD__) -# define ARCH_PCI_INIT freebsdPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# define INCLUDE_XF86_NO_DOMAIN -# elif defined(__NetBSD__) -# define ARCH_PCI_INIT netbsdPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# define INCLUDE_XF86_NO_DOMAIN -# endif -#elif defined(__arm__) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# define INCLUDE_XF86_NO_DOMAIN -# endif -#elif defined(__hppa__) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# define INCLUDE_XF86_NO_DOMAIN -# endif -#elif defined(__ia64__) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# elif defined(FreeBSD) -# define ARCH_PCI_INIT freebsdPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# define INCLUDE_XF86_NO_DOMAIN -# endif -# define XF86SCANPCI_WRAPPER ia64ScanPCIWrapper -#elif defined(__i386__) || defined(i386) -# define ARCH_PCI_INIT ix86PciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# define INCLUDE_XF86_NO_DOMAIN -# if defined(linux) -# define ARCH_PCI_OS_INIT linuxPciInit -# endif -#elif defined(__mc68000__) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# define INCLUDE_XF86_NO_DOMAIN -# endif -#elif defined(__mips__) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# define INCLUDE_XF86_NO_DOMAIN -# endif -#elif defined(__powerpc__) || defined(__powerpc64__) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# define INCLUDE_XF86_NO_DOMAIN /* Needs kernel work to remove */ -# elif defined(__FreeBSD__) || defined(__OpenBSD__) -# define ARCH_PCI_INIT freebsdPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# define INCLUDE_XF86_NO_DOMAIN -# elif defined(__NetBSD__) -# define ARCH_PCI_INIT netbsdPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# define INCLUDE_XF86_NO_DOMAIN -# elif defined(PowerMAX_OS) /* This port is broken */ -# define ARCH_PCI_INIT ppcPciInit -# else -# define ARCH_PCI_INIT ppcPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# define INCLUDE_XF86_NO_DOMAIN -# endif -#elif defined(__s390__) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# define INCLUDE_XF86_NO_DOMAIN -# endif -#elif defined(__sh__) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# define INCLUDE_XF86_NO_DOMAIN -# endif -#elif defined(__sparc__) || defined(sparc) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# elif defined(sun) -# define ARCH_PCI_INIT sparcPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# elif (defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__sparc64__) -# define ARCH_PCI_INIT freebsdPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# define INCLUDE_XF86_NO_DOMAIN -# endif -# if !defined(__FreeBSD__) -# define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge -# endif -#elif defined(__amd64__) || defined(__amd64) -# if defined(__FreeBSD__) -# define ARCH_PCI_INIT freebsdPciInit -# else -# define ARCH_PCI_INIT ix86PciInit -# endif -# define INCLUDE_XF86_MAP_PCI_MEM -# define INCLUDE_XF86_NO_DOMAIN -# if defined(linux) -# define ARCH_PCI_OS_INIT linuxPciInit -# endif -#endif - -#ifndef ARCH_PCI_INIT -#error No PCI support available for this architecture/OS combination -#endif - -extern void ARCH_PCI_INIT(void); -#if defined(ARCH_PCI_OS_INIT) -extern void ARCH_PCI_OS_INIT(void); -#endif - -#if defined(ARCH_PCI_PCI_BRIDGE) -extern void ARCH_PCI_PCI_BRIDGE(pciConfigPtr pPCI); -#endif - -#if defined(XF86SCANPCI_WRAPPER) -typedef enum { - SCANPCI_INIT, - SCANPCI_TERM -} scanpciWrapperOpt; -extern void XF86SCANPCI_WRAPPER(scanpciWrapperOpt flags); -#endif - -/* - * Table of functions used to access a specific PCI bus domain - * (e.g. a primary PCI bus and all of its secondaries) - */ -typedef struct pci_bus_funcs { - CARD32 (*pciReadLong)(PCITAG, int); - void (*pciWriteLong)(PCITAG, int, CARD32); - void (*pciSetBitsLong)(PCITAG, int, CARD32, CARD32); - ADDRESS (*pciAddrHostToBus)(PCITAG, PciAddrType, ADDRESS); - ADDRESS (*pciAddrBusToHost)(PCITAG, PciAddrType, ADDRESS); - /* - * The next three are optional. If NULL, the corresponding function is - * to be performed generically. - */ - CARD16 (*pciControlBridge)(int, CARD16, CARD16); - void (*pciGetBridgeBuses)(int, int *, int *, int *); - /* Use pointer's to avoid #include recursion */ - void (*pciGetBridgeResources)(int, pointer *, pointer *, pointer *); - - /* These are optional and will be implemented using read long - * if not present. */ - CARD8 (*pciReadByte)(PCITAG, int); - void (*pciWriteByte)(PCITAG, int, CARD8); - CARD16 (*pciReadWord)(PCITAG, int); - void (*pciWriteWord)(PCITAG, int, CARD16); - -} pciBusFuncs_t, *pciBusFuncs_p; - -/* - * pciBusInfo_t - One structure per defined PCI bus - */ -typedef struct pci_bus_info { - unsigned char configMech; /* PCI config type to use */ - unsigned char numDevices; /* Range of valid devnums */ - unsigned char secondary; /* Boolean: bus is a secondary */ - int primary_bus; /* Parent bus */ -#ifdef PowerMAX_OS - unsigned long ppc_io_base; /* PowerPC I/O spc membase */ - unsigned long ppc_io_size; /* PowerPC I/O spc size */ -#endif - pciBusFuncs_p funcs; /* PCI access functions */ - void *pciBusPriv; /* Implementation private data */ - pciConfigPtr bridge; /* bridge that opens this bus */ -} pciBusInfo_t; - -#define HOST_NO_BUS ((pciBusInfo_t *)(-1)) - -/* configMech values */ -#define PCI_CFG_MECH_UNKNOWN 0 /* Not yet known */ -#define PCI_CFG_MECH_1 1 /* Most machines */ -#define PCI_CFG_MECH_2 2 /* Older PC's */ -#define PCI_CFG_MECH_OTHER 3 /* Something else */ - -/* Generic PCI service functions and helpers */ -PCITAG pciGenFindFirst(void); -PCITAG pciGenFindNext(void); -CARD32 pciCfgMech1Read(PCITAG tag, int offset); -void pciCfgMech1Write(PCITAG tag, int offset, CARD32 val); -void pciCfgMech1SetBits(PCITAG tag, int offset, CARD32 mask, - CARD32 val); -CARD32 pciByteSwap(CARD32); -Bool pciMfDev(int, int); -ADDRESS pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS); - -extern PCITAG (*pciFindFirstFP)(void); -extern PCITAG (*pciFindNextFP)(void); - -extern CARD32 pciDevid; -extern CARD32 pciDevidMask; - -extern int pciMaxBusNum; - -extern int pciBusNum; -extern int pciDevNum; -extern int pciFuncNum; -extern PCITAG pciDeviceTag; - -extern pciBusInfo_t *pciBusInfo[]; - -#endif /* _PCI_H */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c deleted file mode 100644 index 168bc669e..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c +++ /dev/null @@ -1,637 +0,0 @@ -/* - * SBUS and OpenPROM access functions. - * - * Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c,v 1.2tsi Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#ifdef sun -#include -#endif -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#include "xf86sbusBus.h" -#include "xf86Sbus.h" - -int promRootNode; - -static int promFd = -1; -static int promCurrentNode; -static int promOpenCount = 0; -static int promP1275 = -1; -#define MAX_PROP 128 -#define MAX_VAL (4096-128-4) -static struct openpromio *promOpio; - -sbusDevicePtr *xf86SbusInfo = NULL; - -struct sbus_devtable sbusDeviceTable[] = { - { SBUS_DEVICE_BW2, FBTYPE_SUN2BW, "bwtwo", "Sun Monochrome (bwtwo)" }, - { SBUS_DEVICE_CG2, FBTYPE_SUN2COLOR, "cgtwo", "Sun Color2 (cgtwo)" }, - { SBUS_DEVICE_CG3, FBTYPE_SUN3COLOR, "cgthree", "Sun Color3 (cgthree)" }, - { SBUS_DEVICE_CG4, FBTYPE_SUN4COLOR, "cgfour", "Sun Color4 (cgfour)" }, - { SBUS_DEVICE_CG6, FBTYPE_SUNFAST_COLOR, "cgsix", "Sun GX" }, - { SBUS_DEVICE_CG8, FBTYPE_MEMCOLOR, "cgeight", "Sun CG8/RasterOps" }, - { SBUS_DEVICE_CG12, FBTYPE_SUNGP3, "cgtwelve", "Sun GS (cgtwelve)" }, - { SBUS_DEVICE_CG14, FBTYPE_MDICOLOR, "cgfourteen", "Sun SX" }, - { SBUS_DEVICE_GT, FBTYPE_SUNGT, "gt", "Sun Graphics Tower" }, - { SBUS_DEVICE_MGX, -1, "mgx", "Quantum 3D MGXplus" }, - { SBUS_DEVICE_LEO, FBTYPE_SUNLEO, "leo", "Sun ZX or Turbo ZX" }, - { SBUS_DEVICE_TCX, FBTYPE_TCXCOLOR, "tcx", "Sun TCX" }, - { SBUS_DEVICE_FFB, FBTYPE_CREATOR, "ffb", "Sun FFB" }, - { SBUS_DEVICE_FFB, FBTYPE_CREATOR, "afb", "Sun Elite3D" }, - { 0, 0, NULL } -}; - -int -promGetSibling(int node) -{ - promOpio->oprom_size = sizeof(int); - - if (node == -1) return 0; - *(int *)promOpio->oprom_array = node; - if (ioctl(promFd, OPROMNEXT, promOpio) < 0) - return 0; - promCurrentNode = *(int *)promOpio->oprom_array; - return *(int *)promOpio->oprom_array; -} - -int -promGetChild(int node) -{ - promOpio->oprom_size = sizeof(int); - - if (!node || node == -1) return 0; - *(int *)promOpio->oprom_array = node; - if (ioctl(promFd, OPROMCHILD, promOpio) < 0) - return 0; - promCurrentNode = *(int *)promOpio->oprom_array; - return *(int *)promOpio->oprom_array; -} - -char * -promGetProperty(const char *prop, int *lenp) -{ - promOpio->oprom_size = MAX_VAL; - - strcpy(promOpio->oprom_array, prop); - if (ioctl(promFd, OPROMGETPROP, promOpio) < 0) - return 0; - if (lenp) *lenp = promOpio->oprom_size; - return promOpio->oprom_array; -} - -int -promGetBool(const char *prop) -{ - promOpio->oprom_size = 0; - - *(int *)promOpio->oprom_array = 0; - for (;;) { - promOpio->oprom_size = MAX_PROP; - if (ioctl(promFd, OPROMNXTPROP, promOpio) < 0) - return 0; - if (!promOpio->oprom_size) - return 0; - if (!strcmp(promOpio->oprom_array, prop)) - return 1; - } -} - -#define PROM_NODE_SIBLING 0x01 -#define PROM_NODE_PREF 0x02 -#define PROM_NODE_SBUS 0x04 -#define PROM_NODE_EBUS 0x08 -#define PROM_NODE_PCI 0x10 - -static int -promSetNode(sbusPromNodePtr pnode) -{ - int node; - - if (!pnode->node || pnode->node == -1) - return -1; - if (pnode->cookie[0] & PROM_NODE_SIBLING) - node = promGetSibling(pnode->cookie[1]); - else - node = promGetChild(pnode->cookie[1]); - if (pnode->node != node) - return -1; - return 0; -} - -static void -promIsP1275(void) -{ -#ifdef linux - FILE *f; - char buffer[1024]; - - if (promP1275 != -1) - return; - promP1275 = 0; - f = fopen("/proc/cpuinfo","r"); - if (!f) return; - while (fgets(buffer, 1024, f) != NULL) - if (!strncmp (buffer, "type", 4) && strstr (buffer, "sun4u")) { - promP1275 = 1; - break; - } - fclose(f); -#elif defined(sun) - struct utsname buffer; - - if ((uname(&buffer) >= 0) && !strcmp(buffer.machine, "sun4u")) - promP1275 = TRUE; - else - promP1275 = FALSE; -#elif defined(__FreeBSD__) - promP1275 = TRUE; -#else -#error Missing promIsP1275() function for this OS -#endif -} - -void -sparcPromClose(void) -{ - if (promOpenCount > 1) { - promOpenCount--; - return; - } - if (promFd != -1) { - close(promFd); - promFd = -1; - } - if (promOpio) { - xfree(promOpio); - promOpio = NULL; - } - promOpenCount = 0; -} - -int -sparcPromInit(void) -{ - if (promOpenCount) { - promOpenCount++; - return 0; - } - promFd = open("/dev/openprom", O_RDONLY, 0); - if (promFd == -1) - return -1; - promOpio = (struct openpromio *)xalloc(4096); - if (!promOpio) { - sparcPromClose(); - return -1; - } - promRootNode = promGetSibling(0); - if (!promRootNode) { - sparcPromClose(); - return -1; - } - promIsP1275(); - promOpenCount++; - - return 0; -} - -char * -sparcPromGetProperty(sbusPromNodePtr pnode, const char *prop, int *lenp) -{ - if (promSetNode(pnode)) - return NULL; - return promGetProperty(prop, lenp); -} - -int -sparcPromGetBool(sbusPromNodePtr pnode, const char *prop) -{ - if (promSetNode(pnode)) - return 0; - return promGetBool(prop); -} - -static void -promWalkAssignNodes(int node, int oldnode, int flags, sbusDevicePtr *devicePtrs) -{ - int nextnode; - int len, sbus = flags & PROM_NODE_SBUS; - char *prop; - int devId, i, j; - sbusPromNode pNode, pNode2; - - prop = promGetProperty("device_type", &len); - if (prop && (len > 0)) do { - if (!strcmp(prop, "display")) { - prop = promGetProperty("name", &len); - if (!prop || len <= 0) - break; - while ((*prop >= 'A' && *prop <= 'Z') || *prop == ',') - prop++; - for (i = 0; sbusDeviceTable[i].devId; i++) - if (!strcmp(prop, sbusDeviceTable[i].promName)) - break; - devId = sbusDeviceTable[i].devId; - if (!devId) - break; - if (!sbus) { - if (devId == SBUS_DEVICE_FFB) { - /* - * All /SUNW,ffb outside of SBUS tree come before all - * /SUNW,afb outside of SBUS tree in Linux. - */ - if (!strcmp(prop, "afb")) - flags |= PROM_NODE_PREF; - } else if (devId != SBUS_DEVICE_CG14) - break; - } - for (i = 0; i < 32; i++) { - if (!devicePtrs[i] || devicePtrs[i]->devId != devId) - continue; - if (devicePtrs[i]->node.node) { - if ((devicePtrs[i]->node.cookie[0] & ~PROM_NODE_SIBLING) <= - (flags & ~PROM_NODE_SIBLING)) - continue; - for (j = i + 1, pNode = devicePtrs[i]->node; j < 32; j++) { - if (!devicePtrs[j] || devicePtrs[j]->devId != devId) - continue; - pNode2 = devicePtrs[j]->node; - devicePtrs[j]->node = pNode; - pNode = pNode2; - } - } - devicePtrs[i]->node.node = node; - devicePtrs[i]->node.cookie[0] = flags; - devicePtrs[i]->node.cookie[1] = oldnode; - break; - } - break; - } - } while (0); - - prop = promGetProperty("name", &len); - if (prop && len > 0) { - if (!strcmp(prop, "sbus") || !strcmp(prop, "sbi")) - sbus = PROM_NODE_SBUS; - } - - nextnode = promGetChild(node); - if (nextnode) - promWalkAssignNodes(nextnode, node, sbus, devicePtrs); - - nextnode = promGetSibling(node); - if (nextnode) - promWalkAssignNodes(nextnode, node, PROM_NODE_SIBLING | sbus, devicePtrs); -} - -void -sparcPromAssignNodes(void) -{ - sbusDevicePtr psdp, *psdpp; - int n, holes = 0, i, j; - FILE *f; - sbusDevicePtr devicePtrs[32]; - - (void)memset(devicePtrs, 0, sizeof(devicePtrs)); - for (psdpp = xf86SbusInfo, n = 0; (psdp = *psdpp); psdpp++, n++) { - if (psdp->fbNum != n) - holes = 1; - devicePtrs[psdp->fbNum] = psdp; - } - if (holes && (f = fopen("/proc/fb", "r")) != NULL) { - /* We could not open one of fb devices, check /proc/fb to see what - * were the types of the cards missed. */ - char buffer[64]; - int fbNum, devId; - static struct { - int devId; - char *prefix; - } procFbPrefixes[] = { - { SBUS_DEVICE_BW2, "BWtwo" }, - { SBUS_DEVICE_CG14, "CGfourteen" }, - { SBUS_DEVICE_CG6, "CGsix" }, - { SBUS_DEVICE_CG3, "CGthree" }, - { SBUS_DEVICE_FFB, "Creator" }, - { SBUS_DEVICE_FFB, "Elite 3D" }, - { SBUS_DEVICE_LEO, "Leo" }, - { SBUS_DEVICE_TCX, "TCX" }, - { 0, NULL }, - }; - - while (fscanf(f, "%d %63s\n", &fbNum, buffer) == 2) { - for (i = 0; procFbPrefixes[i].devId; i++) - if (! strncmp(procFbPrefixes[i].prefix, buffer, - strlen(procFbPrefixes[i].prefix))) - break; - devId = procFbPrefixes[i].devId; - if (! devId) continue; - if (devicePtrs[fbNum]) { - if (devicePtrs[fbNum]->devId != devId) - xf86ErrorF("Inconsistent /proc/fb with FBIOGATTR\n"); - } else if (!devicePtrs[fbNum]) { - devicePtrs[fbNum] = psdp = xnfcalloc(sizeof (sbusDevice), 1); - psdp->devId = devId; - psdp->fbNum = fbNum; - psdp->fd = -2; - } - } - fclose(f); - } - promGetSibling(0); - promWalkAssignNodes(promRootNode, 0, PROM_NODE_PREF, devicePtrs); - for (i = 0, j = 0; i < 32; i++) - if (devicePtrs[i] && devicePtrs[i]->fbNum == -1) - j++; - xf86SbusInfo = xnfrealloc(xf86SbusInfo, sizeof(psdp) * (n + j + 1)); - for (i = 0, psdpp = xf86SbusInfo; i < 32; i++) - if (devicePtrs[i]) { - if (devicePtrs[i]->fbNum == -1) { - memmove(psdpp + 1, psdpp, sizeof(psdpp) * (n + 1)); - *psdpp = devicePtrs[i]; - } else - n--; - } -} - -static char * -promGetReg(int type) -{ - char *prop; - int len; - static char regstr[40]; - - regstr[0] = 0; - prop = promGetProperty("reg", &len); - if (prop && len >= 4) { - unsigned int *reg = (unsigned int *)prop; - if (!promP1275 || (type == PROM_NODE_SBUS) || (type == PROM_NODE_EBUS)) - sprintf (regstr, "@%x,%x", reg[0], reg[1]); - else if (type == PROM_NODE_PCI) { - if ((reg[0] >> 8) & 7) - sprintf (regstr, "@%x,%x", (reg[0] >> 11) & 0x1f, (reg[0] >> 8) & 7); - else - sprintf (regstr, "@%x", (reg[0] >> 11) & 0x1f); - } else if (len == 4) - sprintf (regstr, "@%x", reg[0]); - else { - unsigned int regs[2]; - - /* Things get more complicated on UPA. If upa-portid exists, - then address is @upa-portid,second-int-in-reg, otherwise - it is @first-int-in-reg/16,second-int-in-reg (well, probably - upa-portid always exists, but just to be safe). */ - memcpy (regs, reg, sizeof(regs)); - prop = promGetProperty("upa-portid", &len); - if (prop && len == 4) { - reg = (unsigned int *)prop; - sprintf (regstr, "@%x,%x", reg[0], regs[1]); - } else - sprintf (regstr, "@%x,%x", regs[0] >> 4, regs[1]); - } - } - return regstr; -} - -static int -promWalkNode2Pathname(char *path, int parent, int node, int searchNode, int type) -{ - int nextnode; - int len, ntype = type; - char *prop, *p; - - prop = promGetProperty("name", &len); - *path = '/'; - if (!prop || len <= 0) - return 0; - if ((!strcmp(prop, "sbus") || !strcmp(prop, "sbi")) && !type) - ntype = PROM_NODE_SBUS; - else if (!strcmp(prop, "ebus") && type == PROM_NODE_PCI) - ntype = PROM_NODE_EBUS; - else if (!strcmp(prop, "pci") && !type) - ntype = PROM_NODE_PCI; - strcpy (path + 1, prop); - p = promGetReg(type); - if (*p) - strcat (path, p); - if (node == searchNode) - return 1; - nextnode = promGetChild(node); - if (nextnode && - promWalkNode2Pathname(strchr(path, 0), node, nextnode, searchNode, ntype)) - return 1; - nextnode = promGetSibling(node); - if (nextnode && - promWalkNode2Pathname(path, parent, nextnode, searchNode, type)) - return 1; - return 0; -} - -char * -sparcPromNode2Pathname(sbusPromNodePtr pnode) -{ - char *ret; - - if (!pnode->node) return NULL; - ret = xalloc(4096); - if (!ret) return NULL; - if (promWalkNode2Pathname(ret, promRootNode, promGetChild(promRootNode), pnode->node, 0)) - return ret; - xfree(ret); - return NULL; -} - -static int -promWalkPathname2Node(char *name, char *regstr, int parent, int type) -{ - int len, node, ret; - char *prop, *p; - - for (;;) { - prop = promGetProperty("name", &len); - if (!prop || len <= 0) - return 0; - if ((!strcmp(prop, "sbus") || !strcmp(prop, "sbi")) && !type) - type = PROM_NODE_SBUS; - else if (!strcmp(prop, "ebus") && type == PROM_NODE_PCI) - type = PROM_NODE_EBUS; - else if (!strcmp(prop, "pci") && !type) - type = PROM_NODE_PCI; - for (node = promGetChild(parent); node; node = promGetSibling(node)) { - prop = promGetProperty("name", &len); - if (!prop || len <= 0) - continue; - if (*name && strcmp(name, prop)) - continue; - if (*regstr) { - p = promGetReg(type); - if (! *p || strcmp(p + 1, regstr)) - continue; - } - break; - } - if (!node) { - for (node = promGetChild(parent); node; node = promGetSibling(node)) { - ret = promWalkPathname2Node(name, regstr, node, type); - if (ret) return ret; - } - return 0; - } - name = strchr(regstr, 0) + 1; - if (! *name) - return node; - p = strchr(name, '/'); - if (p) - *p = 0; - else - p = strchr(name, 0); - regstr = strchr(name, '@'); - if (regstr) - *regstr++ = 0; - else - regstr = p; - if (name == regstr) - return 0; - parent = node; - } -} - -int -sparcPromPathname2Node(const char *pathName) -{ - int i; - char *name, *regstr, *p; - - i = strlen(pathName); - name = xalloc(i + 2); - if (! name) return 0; - strcpy (name, pathName); - name [i + 1] = 0; - if (name[0] != '/') - return 0; - p = strchr(name + 1, '/'); - if (p) - *p = 0; - else - p = strchr(name, 0); - regstr = strchr(name, '@'); - if (regstr) - *regstr++ = 0; - else - regstr = p; - if (name + 1 == regstr) - return 0; - promGetSibling(0); - i = promWalkPathname2Node(name + 1, regstr, promRootNode, 0); - xfree(name); - return i; -} - -pointer -xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset, unsigned long size) -{ - pointer ret; - unsigned long pagemask = xf86getpagesize() - 1; - unsigned long off = offset & ~pagemask; - unsigned long len = ((offset + size + pagemask) & ~pagemask) - off; - - if (psdp->fd == -1) { - psdp->fd = open(psdp->device, O_RDWR); - if (psdp->fd == -1) - return NULL; - } else if (psdp->fd < 0) - return NULL; - - ret = (pointer) mmap (NULL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE, - psdp->fd, off); - if (ret == (pointer) -1) { - ret = (pointer) mmap (NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, - psdp->fd, off); - } - if (ret == (pointer) -1) - return NULL; - - return (char *)ret + (offset - off); -} - -void -xf86UnmapSbusMem(sbusDevicePtr psdp, pointer addr, unsigned long size) -{ - unsigned long mask = xf86getpagesize() - 1; - unsigned long base = (unsigned long)addr & ~mask; - unsigned long len = (((unsigned long)addr + size + mask) & ~mask) - base; - - munmap ((pointer)base, len); -} - -/* Tell OS that we are driving the HW cursor ourselves. */ -void -xf86SbusHideOsHwCursor(sbusDevicePtr psdp) -{ - struct fbcursor fbcursor; - unsigned char zeros[8]; - - memset(&fbcursor, 0, sizeof(fbcursor)); - memset(&zeros, 0, sizeof(zeros)); - fbcursor.cmap.count = 2; - fbcursor.cmap.red = zeros; - fbcursor.cmap.green = zeros; - fbcursor.cmap.blue = zeros; - fbcursor.image = (char *)zeros; - fbcursor.mask = (char *)zeros; - fbcursor.size.x = 32; - fbcursor.size.y = 1; - fbcursor.set = FB_CUR_SETALL; - ioctl(psdp->fd, FBIOSCURSOR, &fbcursor); -} - -/* Set HW cursor colormap. */ -void -xf86SbusSetOsHwCursorCmap(sbusDevicePtr psdp, int bg, int fg) -{ - struct fbcursor fbcursor; - unsigned char red[2], green[2], blue[2]; - - memset(&fbcursor, 0, sizeof(fbcursor)); - red[0] = bg >> 16; - green[0] = bg >> 8; - blue[0] = bg; - red[1] = fg >> 16; - green[1] = fg >> 8; - blue[1] = fg; - fbcursor.cmap.count = 2; - fbcursor.cmap.red = red; - fbcursor.cmap.green = green; - fbcursor.cmap.blue = blue; - fbcursor.set = FB_CUR_SETCMAP; - ioctl(psdp->fd, FBIOSCURSOR, &fbcursor); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/altixPCI.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/altixPCI.c deleted file mode 100644 index 010f6619a..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/altixPCI.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * This file contains the glue necessary for support of SGI's Altix chipset. - */ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "altixPCI.h" -#include "xf86.h" -#include "Pci.h" - -/* - * get_dev_on_bus - Return the first device we find on segnum, busnum - * - * Walk all the PCI devices and return the first one found on segnum, busnum. - * There may be a better way to do this in some xf86* function I don't know - * about. - */ -static pciDevice *get_dev_on_bus(unsigned int segnum, unsigned int busnum) -{ - pciDevice **pdev = xf86scanpci(0); - int i; - - for (i = 0; pdev[i] != NULL; i++) - if (PCI_DOM_FROM_TAG(pdev[i]->tag) == segnum && - pdev[i]->busnum == busnum) - return pdev[i]; - /* Should never get here... */ - ErrorF("No PCI device found on %04x:%02x??", segnum, busnum); - return NULL; -} - -/* - * get_bridge_info - fill in the bridge info for bus_info based on pdev - * - * Find the parent bus for pdev if it exists, otherwise assume pdev *is* - * the parent bus. We need this on Altix because our bridges are transparent. - */ -static void get_bridge_info(pciBusInfo_t *bus_info, pciDevice *pdev) -{ - unsigned int parent_segnum, segnum = PCI_DOM_FROM_TAG(pdev->tag); - unsigned int parent_busnum, busnum = pdev->busnum; - char bridge_path[] = "/sys/class/pci_bus/0000:00/bridge"; - char bridge_target[] = "../../../devices/pci0000:00"; - - /* Path to this device's bridge */ - sprintf(bridge_path, "/sys/class/pci_bus/%04x:%02x/bridge", segnum, - busnum); - - if (readlink(bridge_path, bridge_target, strlen(bridge_target)) < 0) { - perror("failed to dereference bridge link"); - ErrorF("failed to dereference bridge link, aborting\n"); - exit(-1); - } - - sscanf(bridge_target, "../../../devices/pci%04x:%02x", &parent_segnum, - &parent_busnum); - - /* - * If there's no bridge or the bridge points to the device, use - * pdev as the bridge - */ - if (segnum == parent_segnum && busnum == parent_busnum) { - bus_info->bridge = pdev; - bus_info->secondary = FALSE; - bus_info->primary_bus = busnum; - } else { - bus_info->bridge = get_dev_on_bus(parent_segnum, - parent_busnum); - bus_info->secondary = TRUE; - bus_info->primary_bus = parent_busnum; - } - pdev->businfo = bus_info; - pdev->pci_base_class = PCI_CLASS_DISPLAY; - pdev->pci_sub_class = PCI_SUBCLASS_PREHISTORIC_VGA; -} - -void xf86PreScanAltix(void) -{ - /* Nothing to see here... */ -} - -void xf86PostScanAltix(void) -{ - pciConfigPtr *pdev; - pciBusInfo_t *bus_info; - int prevBusNum, curBusNum, idx; - - /* - * Altix PCI bridges are invisible to userspace, so we make each device - * look like it's its own bridge unless it actually has a parent (as in - * the case of PCI to PCI bridges). - */ - bus_info = pciBusInfo[0]; - pdev = xf86scanpci(0); - prevBusNum = curBusNum = pdev[0]->busnum; - bus_info = pciBusInfo[curBusNum]; - bus_info->bridge = pdev[0]; - bus_info->secondary = FALSE; - bus_info->primary_bus = curBusNum; - - /* Walk all the PCI devices, assigning their bridge info */ - for (idx = 0; pdev[idx] != NULL; idx++) { - if (pdev[idx]->busnum == prevBusNum) - continue; /* Already fixed up this bus */ - - curBusNum = pdev[idx]->busnum; - bus_info = pciBusInfo[curBusNum]; - - /* - * Fill in bus_info for pdev. The bridge field will either - * be pdev[idx] or a device on the parent bus. - */ - get_bridge_info(bus_info, pdev[idx]); - prevBusNum = curBusNum; - } - return; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/altixPCI.h b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/altixPCI.h deleted file mode 100644 index 2a738f362..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/altixPCI.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef PCI_ALTIX_H -#define PCI_ALTIX_H 1 - -#include -#include - -Bool xorgProbeAltix(scanpciWrapperOpt flags); -void xf86PreScanAltix(void); -void xf86PostScanAltix(void); - -/* Some defines for PCI */ -#define VENDOR_SGI 0x10A9 -#define CHIP_TIO_CA 0x1010 -#define CHIP_PIC_PCI 0x1011 - -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/axpPci.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/axpPci.c deleted file mode 100644 index 08c7fbd39..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/axpPci.c +++ /dev/null @@ -1,478 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/axpPci.c,v 1.14 2002/12/11 02:44:28 dawes Exp $ */ -/* - * Copyright 1998 by Concurrent Computer Corporation - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Concurrent Computer - * Corporation not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Concurrent Computer Corporation makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * Copyright 1998 by Metro Link Incorporated - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "compiler.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "Pci.h" - -#include -#include "../linux/lnx.h" /* for _iobase */ - -/* - * Alpha/Linux platform specific PCI access functions - */ -static CARD32 axpPciCfgRead(PCITAG tag, int off); -static void axpPciCfgWrite(PCITAG, int off, CARD32 val); -static void axpPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits); - -static pciBusFuncs_t axpFuncs0 = { -/* pciReadLong */ axpPciCfgRead, -/* pciWriteLong */ axpPciCfgWrite, -/* pciSetBitsLong */ axpPciCfgSetBits, -/* pciAddrHostToBus */ pciAddrNOOP, -/* pciAddrBusToHost */ pciAddrNOOP -}; - -typedef struct _axpDomainRec { - int domain, hose; - int root_bus; - unsigned long dense_io, sparse_io; - unsigned long dense_mem, sparse_mem; - IOADDRESS mapped_io; -} axpDomainRec, *axpDomainPtr; - -#define MAX_DOMAINS (MAX_PCI_BUSES / 256) -static axpDomainPtr xf86DomainInfo[MAX_DOMAINS] = { NULL, }; -static int pciNumDomains = 0; - -/* - * For debug, domain assignment can start downward from a fixed base - * (instead of up from 0) by defining FORCE_HIGH_DOMAINS. This allows - * debug of large domain numbers and sparse domain numbering on systems - * which don't have as many hoses. - */ -#if 0 -# define FORCE_HIGH_DOMAINS MAX_DOMAINS /* assign domains downward from here */ -#endif - -/* - * If FORCE_HIGH_DOMAINS is set, make sure it's not larger than the - * max domain - */ -#if defined(FORCE_HIGH_DOMAINS) && (FORCE_HIGH_DOMAINS > MAX_DOMAINS) -# undef FORCE_HIGH_DOMAINS -# define FORCE_HIGH_DOMAINS MAX_DOMAINS -#endif - -static int -axpSetupDomains(void) -{ - axpDomainRec axpDomain; - int numDomains = 0; - int hose; - -#ifndef INCLUDE_XF86_NO_DOMAIN - -#ifdef FORCE_HIGH_DOMAINS - xf86Msg(X_WARNING, - "DEBUG OPTION FORCE_HIGH_DOMAINS in use - DRI will *NOT* work\n"); - numDomains = FORCE_HIGH_DOMAINS; -#endif - - /* - * Since each hose has a different address space, hoses are a perfect - * overlay for domains, so set up one domain for each hose present - * in the system. We have to loop through all possible hoses because - * some systems allow sparse I/O controllers. - */ - for(hose = 0; hose < MAX_DOMAINS; hose++) { - axpDomain.root_bus = _iobase(IOBASE_ROOT_BUS, hose, -1, -1); - if (axpDomain.root_bus < 0) continue; - - axpDomain.hose = hose; - -#ifndef FORCE_HIGH_DOMAINS - - axpDomain.domain = axpDomain.hose = hose; - numDomains = axpDomain.domain + 1; - -#else /* FORCE_HIGH_DOMAINS */ - - axpDomain.domain = numDomains - hose - 1; - - xf86Msg(X_WARNING, - "FORCE_HIGH_DOMAINS - assigned hose %d to domain %d\n", - axpDomain.hose, axpDomain.domain); - -#endif /* FORCE_HIGH_DOMAINS */ - - axpDomain.dense_io = _iobase(IOBASE_DENSE_IO, hose, -1, -1); - axpDomain.sparse_io = _iobase(IOBASE_SPARSE_IO, hose, -1, -1); - axpDomain.mapped_io = 0; - axpDomain.dense_mem = _iobase(IOBASE_DENSE_MEM, hose, -1, -1); - axpDomain.sparse_mem = _iobase(IOBASE_SPARSE_MEM, hose, -1, -1); - - xf86DomainInfo[axpDomain.domain] = xnfalloc(sizeof(axpDomainRec)); - *(xf86DomainInfo[axpDomain.domain]) = axpDomain; - - /* - * For now, only allow a single domain (hose) on sparse i/o systems. - * - * Allowing multiple domains on sparse systems would require: - * 1) either - * a) revamping the sparse video mapping code to allow - * for multiple unrelated address regions - * -- OR -- - * b) implementing sparse mapping directly in - * xf86MapDomainMemory - * 2) revaming read/write sparse routines to correctly handle - * the solution to 1) - * 3) implementing a sparse I/O system (mapping, inX/outX) - * independent of glibc, since the glibc version only - * supports hose 0 - */ - if (axpDomain.sparse_io) { - if (_iobase(IOBASE_ROOT_BUS, hose + 1, -1, -1) >= 0) { - /* - * It's a sparse i/o system with (at least) one more hose, - * show a message indicating that video is constrained to - * hose 0 - */ - xf86Msg(X_INFO, - "Sparse I/O system - constraining video to hose 0\n"); - } - break; - } - } - -#else /* INCLUDE_XF86_NO_DOMAIN */ - - /* - * domain support is not included, so just set up a single domain (0) - * to represent the first hose so that axpPciInit will still have - * be able to set up the root bus - */ - xf86DomainInfo[0] = xnfalloc(sizeof(axpDomainRec)); - *(xf86DomainInfo[0]) = axpDomain; - numDomains = 1; - -#endif /* INCLUDE_XF86_NO_DOMAIN */ - - return numDomains; -} - -void -axpPciInit() -{ - axpDomainPtr pDomain; - int domain, bus; - - pciNumDomains = axpSetupDomains(); - - for(domain = 0; domain < pciNumDomains; domain++) { - if (!(pDomain = xf86DomainInfo[domain])) continue; - - /* - * Since any bridged buses will be behind a probed pci-pci bridge, - * only set up the root bus for each domain (hose) and the bridged - * buses will be set up as they are found. - */ - bus = PCI_MAKE_BUS(domain, 0); - pciBusInfo[bus] = xnfalloc(sizeof(pciBusInfo_t)); - (void)memset(pciBusInfo[bus], 0, sizeof(pciBusInfo_t)); - - pciBusInfo[bus]->configMech = PCI_CFG_MECH_OTHER; - pciBusInfo[bus]->numDevices = 32; - pciBusInfo[bus]->funcs = &axpFuncs0; - pciBusInfo[bus]->pciBusPriv = pDomain; - - pciNumBuses = bus + 1; - } - - pciFindFirstFP = pciGenFindFirst; - pciFindNextFP = pciGenFindNext; -} - -/* - * Alpha/Linux PCI configuration space access routines - */ -static int -axpPciBusFromTag(PCITAG tag) -{ - pciBusInfo_t *pBusInfo; - axpDomainPtr pDomain; - int bus, dfn; - - bus = PCI_BUS_FROM_TAG(tag); - if ((bus >= pciNumBuses) - || !(pBusInfo = pciBusInfo[bus]) - || !(pDomain = pBusInfo->pciBusPriv) - || (pDomain->domain != PCI_DOM_FROM_TAG(tag))) return -1; - - bus = PCI_BUS_NO_DOMAIN(bus) + pDomain->root_bus; - dfn = PCI_DFN_FROM_TAG(tag); - if (_iobase(IOBASE_HOSE, -1, bus, dfn) != pDomain->hose) return -1; - - return bus; -} - -static CARD32 -axpPciCfgRead(PCITAG tag, int off) -{ - int bus, dfn; - CARD32 val = 0xffffffff; - - if ((bus = axpPciBusFromTag(tag)) >= 0) { - dfn = PCI_DFN_FROM_TAG(tag); - - syscall(__NR_pciconfig_read, bus, dfn, off, 4, &val); - } - return(val); -} - -static void -axpPciCfgWrite(PCITAG tag, int off, CARD32 val) -{ - int bus, dfn; - - if ((bus = axpPciBusFromTag(tag)) >= 0) { - dfn = PCI_DFN_FROM_TAG(tag); - syscall(__NR_pciconfig_write, bus, dfn, off, 4, &val); - } -} - -static void -axpPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits) -{ - int bus, dfn; - CARD32 val = 0xffffffff; - - if ((bus = axpPciBusFromTag(tag)) >= 0) { - dfn = PCI_DFN_FROM_TAG(tag); - - syscall(__NR_pciconfig_read, bus, dfn, off, 4, &val); - val = (val & ~mask) | (bits & mask); - syscall(__NR_pciconfig_write, bus, dfn, off, 4, &val); - } -} - -#ifndef INCLUDE_XF86_NO_DOMAIN - -/* - * Alpha/Linux addressing domain support - */ - -int -xf86GetPciDomain(PCITAG Tag) -{ - return PCI_DOM_FROM_TAG(Tag); -} - -pointer -xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, - ADDRESS Base, unsigned long Size) -{ - axpDomainPtr pDomain; - int domain = PCI_DOM_FROM_TAG(Tag); - - if ((domain < 0) || (domain >= pciNumDomains) || - !(pDomain = xf86DomainInfo[domain])) - FatalError("%s called with invalid parameters\n", __FUNCTION__); - - /* - * xf86MapVidMem already does what we need, but remember to subtract - * _bus_base() (the physical dense memory root of hose 0) since - * xf86MapVidMem is expecting an offset relative to _bus_base() rather - * than an actual physical address. - */ - return xf86MapVidMem(ScreenNum, Flags, - pDomain->dense_mem + Base - _bus_base(), Size); -} - -IOADDRESS -xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag, - IOADDRESS Base, unsigned long Size) -{ - axpDomainPtr pDomain; - int domain = PCI_DOM_FROM_TAG(Tag); - - if ((domain < 0) || (domain >= pciNumDomains) || - !(pDomain = xf86DomainInfo[domain])) - FatalError("%s called with invalid parameters\n", __FUNCTION__); - - /* - * Use glibc inx/outx routines for sparse I/O, so just return the - * base [this is ok since we also constrain sparse I/O systems to - * a single domain in axpSetupDomains()] - */ - if (pDomain->sparse_io) return Base; - - /* - * I/O addresses on Alpha are really just different physical memory - * addresses that the system corelogic turns into I/O commands on the - * bus, so just use xf86MapVidMem to map I/O as well, but remember - * to subtract _bus_base() (the physical dense memory root of hose 0) - * since xf86MapVidMem is expecting an offset relative to _bus_base() - * rather than an actual physical address. - * - * Map the entire I/O space (64kB) at once and only once. - */ - if (!pDomain->mapped_io) - pDomain->mapped_io = (IOADDRESS)xf86MapVidMem(ScreenNum, Flags, - pDomain->dense_io - _bus_base(), - 0x10000); - - return pDomain->mapped_io + Base; -} - -int -xf86ReadDomainMemory(PCITAG Tag, ADDRESS Base, int Len, unsigned char *Buf) -{ - static unsigned long pagemask = 0; - unsigned char *MappedAddr; - unsigned long MapSize; - ADDRESS MapBase; - int i; - - if (!pagemask) pagemask = xf86getpagesize() - 1; - - /* Ensure page boundaries */ - MapBase = Base & ~pagemask; - MapSize = ((Base + Len + pagemask) & ~pagemask) - MapBase; - - /* - * VIDMEM_MMIO in order to get sparse mapping on sparse memory systems - * so we can use mmio functions to read (that way we can really get byte - * at a time reads on dense memory systems with byte/word instructions. - */ - MappedAddr = xf86MapDomainMemory(-1, VIDMEM_READONLY | VIDMEM_MMIO, - Tag, MapBase, MapSize); - - for (i = 0; i < Len; i++) { - *Buf++ = xf86ReadMmio8(MappedAddr, Base - MapBase + i); - } - - xf86UnMapVidMem(-1, MappedAddr, MapSize); - return Len; -} - -resPtr -xf86PciBusAccWindowsFromOS(void) -{ - resPtr pRes = NULL; - resRange range; - int domain; - - for(domain = 0; domain < pciNumDomains; domain++) { - if (!xf86DomainInfo[domain]) continue; - - RANGE(range, 0, 0xffffffffUL, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - - RANGE(range, 0, 0x0000ffffUL, - RANGE_TYPE(ResExcIoBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - } - - return pRes; -} - -resPtr -xf86BusAccWindowsFromOS(void) -{ - return xf86PciBusAccWindowsFromOS(); -} - -resPtr -xf86AccResFromOS(resPtr pRes) -{ - resRange range; - int domain; - - for(domain = 0; domain < pciNumDomains; domain++) { - if (!xf86DomainInfo[domain]) continue; - - /* - * Fallback is to claim the following areas: - * - * 0x000c0000 - 0x000effff location of VGA and other extensions ROMS - */ - - RANGE(range, 0x000c0000, 0x000effff, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - - /* - * Fallback would be to claim well known ports in the 0x0 - 0x3ff - * range along with their sparse I/O aliases, but that's too - * imprecise. Instead claim a bare minimum here. - */ - RANGE(range, 0x00000000, 0x000000ff, - RANGE_TYPE(ResExcIoBlock, domain)); /* For mainboard */ - pRes = xf86AddResToList(pRes, &range, -1); - - /* - * At minimum, the top and bottom resources must be claimed, so that - * resources that are (or appear to be) unallocated can be relocated. - */ - RANGE(range, 0x00000000, 0x00000000, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - RANGE(range, 0xffffffff, 0xffffffff, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); -/* RANGE(range, 0x00000000, 0x00000000, - RANGE_TYPE(ResExcIoBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); */ - RANGE(range, 0xffffffff, 0xffffffff, - RANGE_TYPE(ResExcIoBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - } - - return pRes; -} - -#endif /* !INCLUDE_XF86_NO_DOMAIN */ - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.c deleted file mode 100644 index 65b0c0474..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.c +++ /dev/null @@ -1,64 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.c,v 1.2 2003/07/17 15:08:22 tsi Exp $ */ -/* - * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from the - * XFree86 Project. - */ - -/* - * This file contains the glue necessary for support of Intel's E8870 chipset. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "e8870PCI.h" -#include "xf86.h" -#include "Pci.h" - -Bool -xorgProbeE8870(scanpciWrapperOpt flags) -{ - PCITAG tag; - - /* Look for an E8870's Hub interface */ - tag = PCI_MAKE_TAG(0, 0x1E, 0); - if (pciReadLong(tag, PCI_ID_REG) == DEVID(VENDOR_INTEL, CHIP_82801_P2P)) - return TRUE; - - return FALSE; -} - -void -xf86PreScanE8870(void) -{ - /* XXX Fill me in... */ - return; -} - -void -xf86PostScanE8870(void) -{ - /* XXX Fill me in... */ -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.h b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.h deleted file mode 100644 index 9efa0ed6d..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.h +++ /dev/null @@ -1,42 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/e8870PCI.h,v 1.1 2003/02/23 20:26:49 tsi Exp $ */ -/* - * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from the - * XFree86 Project. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef PCI_E8870_H -#define PCI_E8870_H 1 - -#include -#include - -Bool xorgProbeE8870(scanpciWrapperOpt flags); -void xf86PreScanE8870(void); -void xf86PostScanE8870(void); - -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c deleted file mode 100644 index f6d6f8a6d..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c +++ /dev/null @@ -1,171 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/freebsdPci.c,v 1.4 2002/07/24 19:06:52 tsi Exp $ */ -/* - * Copyright 1998 by Concurrent Computer Corporation - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Concurrent Computer - * Corporation not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Concurrent Computer Corporation makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * Copyright 1998 by Metro Link Incorporated - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "compiler.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "Pci.h" - -#include - -/* - * freebsd platform specific PCI access functions -- using /dev/pci - * needs kernel version 2.2.x - */ -static CARD32 freebsdPciCfgRead(PCITAG tag, int off); -static void freebsdPciCfgWrite(PCITAG, int off, CARD32 val); -static void freebsdPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits); - -static pciBusFuncs_t freebsdFuncs0 = { -/* pciReadLong */ freebsdPciCfgRead, -/* pciWriteLong */ freebsdPciCfgWrite, -/* pciSetBitsLong */ freebsdPciCfgSetBits, -/* pciAddrHostToBus */ pciAddrNOOP, -/* pciAddrBusToHost */ pciAddrNOOP -}; - -static pciBusInfo_t freebsdPci0 = { -/* configMech */ PCI_CFG_MECH_OTHER, -/* numDevices */ 32, -/* secondary */ FALSE, -/* primary_bus */ 0, -#ifdef PowerMAX_OS -/* ppc_io_base */ 0, -/* ppc_io_size */ 0, -#endif -/* funcs */ &freebsdFuncs0, -/* pciBusPriv */ NULL, -/* bridge */ NULL -}; - -#if !defined(__OpenBSD__) && !defined(__FreeBSD__) -#if X_BYTE_ORDER == X_BIG_ENDIAN -#ifdef __sparc__ -#ifndef ASI_PL -#define ASI_PL 0x88 -#endif -#define PCI_CPU(val) ({ \ -int __ret; \ -__asm__ __volatile__("lduwa [%1] %2, %0" : "=r" (__ret) : "r" (&val), "i" (ASI_PL)); \ -__ret; \ -}) -#else -#define PCI_CPU(val) (((val >> 24) & 0x000000ff) | \ - ((val >> 8) & 0x0000ff00) | \ - ((val << 8) & 0x00ff0000) | \ - ((val << 24) & 0xff000000)) -#endif -#else -#define PCI_CPU(val) (val) -#endif -#else /* ! OpenBSD */ -/* OpenBSD has already the bytes in the right order - for all architectures */ -#define PCI_CPU(val) (val) -#endif - - -#define BUS(tag) (((tag)>>16)&0xff) -#define DFN(tag) (((tag)>>8)&0xff) - -static int pciFd = -1; - -void -freebsdPciInit() -{ - pciFd = open("/dev/pci", O_RDWR); - if (pciFd < 0) - return; - - pciNumBuses = 1; - pciBusInfo[0] = &freebsdPci0; - pciFindFirstFP = pciGenFindFirst; - pciFindNextFP = pciGenFindNext; -} - -static CARD32 -freebsdPciCfgRead(PCITAG tag, int off) -{ - struct pci_io io; - int error; - io.pi_sel.pc_bus = BUS(tag); - io.pi_sel.pc_dev = DFN(tag) >> 3; - io.pi_sel.pc_func = DFN(tag) & 7; - io.pi_reg = off; - io.pi_width = 4; - error = ioctl(pciFd, PCIOCREAD, &io); - if (error) - return ~0; - return PCI_CPU(io.pi_data); -} - -static void -freebsdPciCfgWrite(PCITAG tag, int off, CARD32 val) -{ - struct pci_io io; - io.pi_sel.pc_bus = BUS(tag); - io.pi_sel.pc_dev = DFN(tag) >> 3; - io.pi_sel.pc_func = DFN(tag) & 7; - io.pi_reg = off; - io.pi_width = 4; - io.pi_data = PCI_CPU(val); - ioctl(pciFd, PCIOCWRITE, &io); -} - -static void -freebsdPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits) -{ - CARD32 val = freebsdPciCfgRead(tag, off); - val = (val & ~mask) | (bits & mask); - freebsdPciCfgWrite(tag, off, val); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c deleted file mode 100644 index 6e2b650d1..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c +++ /dev/null @@ -1,704 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c,v 1.25 2003/09/24 02:43:34 dawes Exp $ */ -/* - * ix86Pci.c - x86 PCI driver - * - * The XFree86 server PCI access functions have been reimplemented as a - * framework that allows each supported platform/OS to have their own - * platform/OS specific PCI driver. - * - * Most of the code of these functions was simply lifted from the - * Intel architecture specifric portion of the original Xfree86 - * PCI code in hw/xfree86/common_hw/xf86_PCI.C... - * - * Gary Barton - * Concurrent Computer Corporation - * garyb@gate.net - */ - -/* - * Copyright 1998 by Concurrent Computer Corporation - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Concurrent Computer - * Corporation not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Concurrent Computer Corporation makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * Copyright 1998 by Metro Link Incorporated - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * This software is derived from the original XFree86 PCI code - * which includes the following copyright notices as well: - * - * Copyright 1995 by Robin Cutshaw - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of the above listed copyright holder(s) - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. The above listed - * copyright holder(s) make(s) no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * This code is also based heavily on the code in FreeBSD-current, which was - * written by Wolfgang Stanglmeier, and contains the following copyright: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Copyright (c) 1999-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "compiler.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "Pci.h" - -#ifdef PC98 -#define outb(port,data) _outb(port,data) -#define outl(port,data) _outl(port,data) -#define inb(port) _inb(port) -#define inl(port) _inl(port) -#endif - -#define PCI_CFGMECH2_ENABLE_REG 0xCF8 -#ifdef PC98 -#define PCI_CFGMECH2_FORWARD_REG 0xCF9 -#else -#define PCI_CFGMECH2_FORWARD_REG 0xCFA -#endif - -#define PCI_CFGMECH2_MAXDEV 16 - -#define PCI_ADDR_FROM_TAG_CFG1(tag,reg) (PCI_EN | tag | (reg & 0xfc)) -#define PCI_FORWARD_FROM_TAG(tag) PCI_BUS_FROM_TAG(tag) -#define PCI_ENABLE_FROM_TAG(tag) (0xf0 | (((tag) & 0x00000700) >> 7)) -#define PCI_ADDR_FROM_TAG_CFG2(tag,reg) (0xc000 | (((tag) & 0x0000f800) >> 3) \ - | (reg & 0xfc)) - -/* - * Intel x86 platform specific PCI access functions - */ -static CARD32 ix86PciReadLongSetup(PCITAG tag, int off); -static void ix86PciWriteLongSetup(PCITAG, int off, CARD32 val); -static void ix86PciSetBitsLongSetup(PCITAG, int off, CARD32 mask, CARD32 val); -static CARD32 ix86PciReadLongCFG1(PCITAG tag, int off); -static void ix86PciWriteLongCFG1(PCITAG, int off, CARD32 val); -static void ix86PciSetBitsLongCFG1(PCITAG, int off, CARD32 mask, CARD32 val); -static CARD32 ix86PciReadLongCFG2(PCITAG tag, int off); -static void ix86PciWriteLongCFG2(PCITAG, int off, CARD32 val); -static void ix86PciSetBitsLongCFG2(PCITAG, int off, CARD32 mask, CARD32 val); - -static pciBusFuncs_t ix86Funcs0 = { -/* pciReadLong */ ix86PciReadLongSetup, -/* pciWriteLong */ ix86PciWriteLongSetup, -/* pciSetBitsLong */ ix86PciSetBitsLongSetup, -/* pciAddrHostToBus */ pciAddrNOOP, -/* pciAddrBusToHost */ pciAddrNOOP -}; - -static pciBusFuncs_t ix86Funcs1 = { -/* pciReadLong */ ix86PciReadLongCFG1, -/* pciWriteLong */ ix86PciWriteLongCFG1, -/* pciSetBitsLong */ ix86PciSetBitsLongCFG1, -/* pciAddrHostToBus */ pciAddrNOOP, -/* pciAddrBusToHost */ pciAddrNOOP -}; - -static pciBusFuncs_t ix86Funcs2 = { -/* pciReadLong */ ix86PciReadLongCFG2, -/* pciWriteLong */ ix86PciWriteLongCFG2, -/* pciSetBitsLong */ ix86PciSetBitsLongCFG2, -/* pciAddrHostToBus */ pciAddrNOOP, -/* pciAddrBusToHost */ pciAddrNOOP -}; - -static pciBusInfo_t ix86Pci0 = { -/* configMech */ PCI_CFG_MECH_UNKNOWN, /* Set by ix86PciInit() */ -/* numDevices */ 0, /* Set by ix86PciInit() */ -/* secondary */ FALSE, -/* primary_bus */ 0, -#ifdef PowerMAX_OS -/* ppc_io_base */ 0, -/* ppc_io_size */ 0, -#endif -/* funcs */ &ix86Funcs0, /* Set by ix86PciInit() */ -/* pciBusPriv */ NULL, -/* bridge */ NULL -}; - -static Bool -ix86PciBusCheck(void) -{ - PCITAG tag; - CARD32 id, class; - CARD8 device; - - for (device = 0; device < ix86Pci0.numDevices; device++) { - tag = PCI_MAKE_TAG(0, device, 0); - id = (*ix86Pci0.funcs->pciReadLong)(tag, PCI_ID_REG); - - if ((CARD16)(id + 1U) <= (CARD16)1UL) - continue; - - /* The rest of this is inspired by the Linux kernel */ - class = (*ix86Pci0.funcs->pciReadLong)(tag, PCI_CLASS_REG); - - /* Ignore revision id and programming interface */ - switch (class >> 16) { - case (PCI_CLASS_PREHISTORIC << 8) | PCI_SUBCLASS_PREHISTORIC_MISC: - /* Check for vendors of known buggy chipsets */ - id &= 0x0000ffff; - if ((id == PCI_VENDOR_INTEL) || (id == PCI_VENDOR_COMPAQ)) - return TRUE; - continue; - - case (PCI_CLASS_PREHISTORIC << 8) | PCI_SUBCLASS_PREHISTORIC_VGA: - case (PCI_CLASS_DISPLAY << 8) | PCI_SUBCLASS_DISPLAY_VGA: - case (PCI_CLASS_BRIDGE << 8) | PCI_SUBCLASS_BRIDGE_HOST: - return TRUE; - - default: - break; - } - } - return FALSE; -} - -static -void ix86PciSelectCfgmech(void) -{ - static Bool beenhere = FALSE; - CARD32 mode1Res1 = 0, mode1Res2 = 0, oldVal1 = 0; - CARD8 mode2Res1 = 0, mode2Res2 = 0, oldVal2 = 0; - int stages = 0; - - if (beenhere) - return; /* Been there, done that */ - - beenhere = TRUE; - - /* - * Determine if motherboard chipset supports PCI Config Mech 1 or 2 - * We rely on xf86Info.pciFlags to tell which mechanisms to try.... - */ - switch (xf86Info.pciFlags) { - - case PCIOsConfig: -#ifdef ARCH_PCI_OS_INIT - return; -#endif - - case PCIProbe1: - if (!xf86EnableIO()) - return; - - xf86MsgVerb(X_INFO, 2, - "PCI: Probing config type using method 1\n"); - oldVal1 = inl(PCI_CFGMECH1_ADDRESS_REG); - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("Checking config type 1:\n" - "\tinitial value of MODE1_ADDR_REG is 0x%08x\n", oldVal1); - ErrorF("\tChecking that all bits in mask 0x7f000000 are clear\n"); - } -#endif - - /* Assuming config type 1 to start with */ - if ((oldVal1 & 0x7f000000) == 0) { - - stages |= 0x01; - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue indicates possibly config type 1\n"); - ErrorF("\tWriting 32-bit value 0x%08x to MODE1_ADDR_REG\n", PCI_EN); -#if 0 - ErrorF("\tWriting 8-bit value 0x00 to MODE1_ADDR_REG + 3\n"); -#endif - } -#endif - - ix86Pci0.configMech = PCI_CFG_MECH_1; - ix86Pci0.numDevices = PCI_CFGMECH1_MAXDEV; - ix86Pci0.funcs = &ix86Funcs1; - - outl(PCI_CFGMECH1_ADDRESS_REG, PCI_EN); - -#if 0 - /* - * This seems to cause some Neptune-based PCI machines to switch - * from config type 1 to config type 2 - */ - outb(PCI_CFGMECH1_ADDRESS_REG + 3, 0); -#endif - mode1Res1 = inl(PCI_CFGMECH1_ADDRESS_REG); - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue read back from MODE1_ADDR_REG is 0x%08x\n", - mode1Res1); - ErrorF("\tRestoring original contents of MODE1_ADDR_REG\n"); - } -#endif - - outl(PCI_CFGMECH1_ADDRESS_REG, oldVal1); - - if (mode1Res1) { - - stages |= 0x02; - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue read back is non-zero, and indicates possible" - " config type 1\n"); - } -#endif - - if (ix86PciBusCheck()) { - -#ifdef DEBUGPCI - if (xf86Verbose > 2) - ErrorF("\tBus check Confirms this: "); -#endif - - xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n"); - xf86MsgVerb(X_INFO, 3, - "PCI: stages = 0x%02x, oldVal1 = 0x%08lx, mode1Res1" - " = 0x%08lx\n", stages, (unsigned long)oldVal1, - (unsigned long)mode1Res1); - return; - } - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tBus check fails to confirm this, continuing type 1" - " check ...\n"); - } -#endif - - } - - stages |= 0x04; - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tWriting 0xff000001 to MODE1_ADDR_REG\n"); - } -#endif - outl(PCI_CFGMECH1_ADDRESS_REG, 0xff000001); - mode1Res2 = inl(PCI_CFGMECH1_ADDRESS_REG); - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue read back from MODE1_ADDR_REG is 0x%08x\n", - mode1Res2); - ErrorF("\tRestoring original contents of MODE1_ADDR_REG\n"); - } -#endif - - outl(PCI_CFGMECH1_ADDRESS_REG, oldVal1); - - if ((mode1Res2 & 0x80000001) == 0x80000000) { - - stages |= 0x08; - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue read back has only the msb set\n" - "\tThis indicates possible config type 1\n"); - } -#endif - - if (ix86PciBusCheck()) { - -#ifdef DEBUGPCI - if (xf86Verbose > 2) - ErrorF("\tBus check Confirms this: "); -#endif - - xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n"); - xf86MsgVerb(X_INFO, 3, - "PCI: stages = 0x%02x, oldVal1 = 0x%08lx,\n" - "\tmode1Res1 = 0x%08lx, mode1Res2 = 0x%08lx\n", - stages, (unsigned long)oldVal1, - (unsigned long)mode1Res1, (unsigned long)mode1Res2); - return; - } - -#ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tBus check fails to confirm this.\n"); - } -#endif - - } - } - - xf86MsgVerb(X_INFO, 3, "PCI: Standard check for type 1 failed.\n"); - xf86MsgVerb(X_INFO, 3, "PCI: stages = 0x%02x, oldVal1 = 0x%08lx,\n" - "\tmode1Res1 = 0x%08lx, mode1Res2 = 0x%08lx\n", - stages, (unsigned long)oldVal1, (unsigned long)mode1Res1, - (unsigned long)mode1Res2); - - /* Try config type 2 */ - oldVal2 = inb(PCI_CFGMECH2_ENABLE_REG); - if ((oldVal2 & 0xf0) == 0) { - ix86Pci0.configMech = PCI_CFG_MECH_2; - ix86Pci0.numDevices = PCI_CFGMECH2_MAXDEV; - ix86Pci0.funcs = &ix86Funcs2; - - outb(PCI_CFGMECH2_ENABLE_REG, 0x0e); - mode2Res1 = inb(PCI_CFGMECH2_ENABLE_REG); - outb(PCI_CFGMECH2_ENABLE_REG, oldVal2); - - if (mode2Res1 == 0x0e) { - if (ix86PciBusCheck()) { - xf86MsgVerb(X_INFO, 2, "PCI: Config type is 2\n"); - return; - } - } - } - break; /* } */ - - case PCIProbe2: /* { */ - if (!xf86EnableIO()) - return; - - /* The scanpci-style detection method */ - - xf86MsgVerb(X_INFO, 2, "PCI: Probing config type using method 2\n"); - - outb(PCI_CFGMECH2_ENABLE_REG, 0x00); - outb(PCI_CFGMECH2_FORWARD_REG, 0x00); - mode2Res1 = inb(PCI_CFGMECH2_ENABLE_REG); - mode2Res2 = inb(PCI_CFGMECH2_FORWARD_REG); - - if (mode2Res1 == 0 && mode2Res2 == 0) { - xf86MsgVerb(X_INFO, 2, "PCI: Config type is 2\n"); - ix86Pci0.configMech = PCI_CFG_MECH_2; - ix86Pci0.numDevices = PCI_CFGMECH2_MAXDEV; - ix86Pci0.funcs = &ix86Funcs2; - return; - } - - oldVal1 = inl(PCI_CFGMECH1_ADDRESS_REG); - outl(PCI_CFGMECH1_ADDRESS_REG, PCI_EN); - mode1Res1 = inl(PCI_CFGMECH1_ADDRESS_REG); - outl(PCI_CFGMECH1_ADDRESS_REG, oldVal1); - if (mode1Res1 == PCI_EN) { - xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n"); - ix86Pci0.configMech = PCI_CFG_MECH_1; - ix86Pci0.numDevices = PCI_CFGMECH1_MAXDEV; - ix86Pci0.funcs = &ix86Funcs1; - return; - } - break; /* } */ - - case PCIForceConfig1: - if (!xf86EnableIO()) - return; - - xf86MsgVerb(X_INFO, 2, "PCI: Forcing config type 1\n"); - - ix86Pci0.configMech = PCI_CFG_MECH_1; - ix86Pci0.numDevices = PCI_CFGMECH1_MAXDEV; - ix86Pci0.funcs = &ix86Funcs1; - return; - - case PCIForceConfig2: - if (!xf86EnableIO()) - return; - - xf86MsgVerb(X_INFO, 2, "PCI: Forcing config type 2\n"); - - ix86Pci0.configMech = PCI_CFG_MECH_2; - ix86Pci0.numDevices = PCI_CFGMECH2_MAXDEV; - ix86Pci0.funcs = &ix86Funcs2; - return; - - case PCIForceNone: - break; - } - - /* No PCI found */ - ix86Pci0.configMech = PCI_CFG_MECH_UNKNOWN; - xf86MsgVerb(X_INFO, 2, "PCI: No PCI bus found or probed for\n"); -} - -#if 0 -static pciTagRec -ix86PcibusTag(CARD8 bus, CARD8 cardnum, CARD8 func) -{ - pciTagRec tag; - - tag.cfg1 = 0; - - if (func > 7 || cardnum >= pciBusInfo[bus]->numDevices) - return tag; - - switch (ix86Pci0.configMech) { - case PCI_CFG_MECH_1: - tag.cfg1 = PCI_EN | ((CARD32)bus << 16) | - ((CARD32)cardnum << 11) | - ((CARD32)func << 8); - break; - - case PCI_CFG_MECH_2: - tag.cfg2.port = 0xc000 | ((CARD16)cardnum << 8); - tag.cfg2.enable = 0xf0 | (func << 1); - tag.cfg2.forward = bus; - break; - } - - return tag; -} -#endif - -static CARD32 -ix86PciReadLongSetup(PCITAG Tag, int reg) -{ - ix86PciSelectCfgmech(); - return (*ix86Pci0.funcs->pciReadLong)(Tag,reg); -} - -static CARD32 -ix86PciReadLongCFG1(PCITAG Tag, int reg) -{ - CARD32 addr, data = 0; - -#ifdef DEBUGPCI - ErrorF("ix86PciReadLong 0x%lx, %d\n", Tag, reg); -#endif - - addr = PCI_ADDR_FROM_TAG_CFG1(Tag,reg); - outl(PCI_CFGMECH1_ADDRESS_REG, addr); - data = inl(PCI_CFGMECH1_DATA_REG); - outl(PCI_CFGMECH1_ADDRESS_REG, 0); - -#ifdef DEBUGPCI - ErrorF("ix86PciReadLong 0x%lx\n", data); -#endif - - return data; -} - -static CARD32 -ix86PciReadLongCFG2(PCITAG Tag, int reg) -{ - CARD32 addr, data = 0; - CARD8 forward, enable; - -#ifdef DEBUGPCI - ErrorF("ix86PciReadLong 0x%lx, %d\n", Tag, reg); -#endif - - forward = PCI_FORWARD_FROM_TAG(Tag); - enable = PCI_ENABLE_FROM_TAG(Tag); - addr = PCI_ADDR_FROM_TAG_CFG2(Tag,reg); - - outb(PCI_CFGMECH2_ENABLE_REG, enable); - outb(PCI_CFGMECH2_FORWARD_REG, forward); - data = inl((CARD16)addr); - outb(PCI_CFGMECH2_ENABLE_REG, 0); - outb(PCI_CFGMECH2_FORWARD_REG, 0); - -#ifdef DEBUGPCI - ErrorF("ix86PciReadLong 0x%lx\n", data); -#endif - - return data; -} - -static void -ix86PciWriteLongSetup(PCITAG Tag, int reg, CARD32 data) -{ - ix86PciSelectCfgmech(); - (*ix86Pci0.funcs->pciWriteLong)(Tag,reg,data); -} - -static void -ix86PciWriteLongCFG1(PCITAG Tag, int reg, CARD32 data) -{ - CARD32 addr; - - addr = PCI_ADDR_FROM_TAG_CFG1(Tag,reg); - outl(PCI_CFGMECH1_ADDRESS_REG, addr); - outl(PCI_CFGMECH1_DATA_REG, data); - outl(PCI_CFGMECH1_ADDRESS_REG, 0); -} - -static void -ix86PciWriteLongCFG2(PCITAG Tag, int reg, CARD32 data) -{ - CARD32 addr; - CARD8 forward, enable; - - forward = PCI_FORWARD_FROM_TAG(Tag); - enable = PCI_ENABLE_FROM_TAG(Tag); - addr = PCI_ADDR_FROM_TAG_CFG2(Tag,reg); - - outb(PCI_CFGMECH2_ENABLE_REG, enable); - outb(PCI_CFGMECH2_FORWARD_REG, forward); - outl((CARD16)addr, data); - outb(PCI_CFGMECH2_ENABLE_REG, 0); - outb(PCI_CFGMECH2_FORWARD_REG, 0); -} - -static void -ix86PciSetBitsLongSetup(PCITAG Tag, int reg, CARD32 mask, CARD32 val) -{ - ix86PciSelectCfgmech(); - (*ix86Pci0.funcs->pciSetBitsLong)(Tag,reg,mask,val); -} - -static void -ix86PciSetBitsLongCFG1(PCITAG Tag, int reg, CARD32 mask, CARD32 val) -{ - CARD32 addr, data = 0; - -#ifdef DEBUGPCI - ErrorF("ix86PciSetBitsLong 0x%lx, %d\n", Tag, reg); -#endif - - addr = PCI_ADDR_FROM_TAG_CFG1(Tag,reg); - outl(PCI_CFGMECH1_ADDRESS_REG, addr); - data = inl(PCI_CFGMECH1_DATA_REG); - data = (data & ~mask) | (val & mask); - outl(PCI_CFGMECH1_DATA_REG, data); - outl(PCI_CFGMECH1_ADDRESS_REG, 0); -} - -static void -ix86PciSetBitsLongCFG2(PCITAG Tag, int reg, CARD32 mask, CARD32 val) -{ - CARD32 addr, data = 0; - CARD8 enable, forward; - -#ifdef DEBUGPCI - ErrorF("ix86PciSetBitsLong 0x%lx, %d\n", Tag, reg); -#endif - - forward = PCI_FORWARD_FROM_TAG(Tag); - enable = PCI_ENABLE_FROM_TAG(Tag); - addr = PCI_ADDR_FROM_TAG_CFG2(Tag,reg); - - outb(PCI_CFGMECH2_ENABLE_REG, enable); - outb(PCI_CFGMECH2_FORWARD_REG, forward); - data = inl((CARD16)addr); - data = (data & ~mask) | (val & mask); - outl((CARD16)addr, data); - outb(PCI_CFGMECH2_ENABLE_REG, 0); - outb(PCI_CFGMECH2_FORWARD_REG, 0); -} - -void -ix86PciInit() -{ - /* Initialize pciBusInfo[] array and function pointers */ - pciNumBuses = 1; - pciBusInfo[0] = &ix86Pci0; - pciFindFirstFP = pciGenFindFirst; - pciFindNextFP = pciGenFindNext; - - /* Make sure that there is a PCI bus present. */ - ix86PciSelectCfgmech(); - if (ix86Pci0.configMech == PCI_CFG_MECH_UNKNOWN) { - pciNumBuses = 0; - pciBusInfo[0] = NULL; - } -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c deleted file mode 100644 index 40fb4604b..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c +++ /dev/null @@ -1,894 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c,v 1.9 2002/09/24 16:14:16 tsi Exp $ */ -/* - * Copyright 1998 by Concurrent Computer Corporation - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Concurrent Computer - * Corporation not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Concurrent Computer Corporation makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * Copyright 1998 by Metro Link Incorporated - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "compiler.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "Pci.h" - -/* - * linux platform specific PCI access functions -- using /proc/bus/pci - * needs kernel version 2.2.x - */ -static CARD32 linuxPciCfgRead(PCITAG tag, int off); -static void linuxPciCfgWrite(PCITAG, int off, CARD32 val); -static void linuxPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits); -static ADDRESS linuxTransAddrBusToHost(PCITAG tag, PciAddrType type, ADDRESS addr); -#if defined(__powerpc__) -static ADDRESS linuxPpcBusAddrToHostAddr(PCITAG, PciAddrType, ADDRESS); -static ADDRESS linuxPpcHostAddrToBusAddr(PCITAG, PciAddrType, ADDRESS); -#endif - -static CARD8 linuxPciCfgReadByte(PCITAG tag, int off); -static void linuxPciCfgWriteByte(PCITAG tag, int off, CARD8 val); -static CARD16 linuxPciCfgReadWord(PCITAG tag, int off); -static void linuxPciCfgWriteWord(PCITAG tag, int off, CARD16 val); - -static pciBusFuncs_t linuxFuncs0 = { -/* pciReadLong */ linuxPciCfgRead, -/* pciWriteLong */ linuxPciCfgWrite, -/* pciSetBitsLong */ linuxPciCfgSetBits, -#if defined(__powerpc__) -/* pciAddrHostToBus */ linuxPpcHostAddrToBusAddr, -/* pciAddrBusToHost */ linuxPpcBusAddrToHostAddr, -#else -/* pciAddrHostToBus */ pciAddrNOOP, -/* pciAddrBusToHost */ linuxTransAddrBusToHost, -#endif - -/* pciControlBridge */ NULL, -/* pciGetBridgeBuses */ NULL, -/* pciGetBridgeResources */ NULL, - -/* pciReadByte */ linuxPciCfgReadByte, -/* pciWriteByte */ linuxPciCfgWriteByte, - -/* pciReadWord */ linuxPciCfgReadWord, -/* pciWriteWord */ linuxPciCfgWriteWord, -}; - -static pciBusInfo_t linuxPci0 = { -/* configMech */ PCI_CFG_MECH_OTHER, -/* numDevices */ 32, -/* secondary */ FALSE, -/* primary_bus */ 0, -#ifdef PowerMAX_OS -/* ppc_io_base */ 0, -/* ppc_io_size */ 0, -#endif -/* funcs */ &linuxFuncs0, -/* pciBusPriv */ NULL, -/* bridge */ NULL -}; - -void -linuxPciInit() -{ - struct stat st; - if ((xf86Info.pciFlags == PCIForceNone) || - (-1 == stat("/proc/bus/pci", &st))) { - /* when using this as default for all linux architectures, - we'll need a fallback for 2.0 kernels here */ - return; - } - pciNumBuses = 1; - pciBusInfo[0] = &linuxPci0; - pciFindFirstFP = pciGenFindFirst; - pciFindNextFP = pciGenFindNext; -} - -static int -linuxPciOpenFile(PCITAG tag, Bool write) -{ - static int lbus,ldev,lfunc,fd = -1,is_write = 0; - int bus, dev, func; - char file[32]; - struct stat ignored; - - bus = PCI_BUS_FROM_TAG(tag); - dev = PCI_DEV_FROM_TAG(tag); - func = PCI_FUNC_FROM_TAG(tag); - if (fd == -1 || (write && (!is_write)) - || bus != lbus || dev != ldev || func != lfunc) { - if (fd != -1) - close(fd); - if (bus < 256) { - sprintf(file,"/proc/bus/pci/%02x",bus); - if (stat(file, &ignored) < 0) - sprintf(file, "/proc/bus/pci/0000:%02x/%02x.%1x", - bus, dev, func); - else - sprintf(file, "/proc/bus/pci/%02x/%02x.%1x", - bus, dev, func); - } else { - sprintf(file,"/proc/bus/pci/%04x",bus); - if (stat(file, &ignored) < 0) - sprintf(file, "/proc/bus/pci/0000:%04x/%02x.%1x", - bus, dev, func); - else - sprintf(file, "/proc/bus/pci/%04x/%02x.%1x", - bus, dev, func); - } - if (write) { - fd = open(file,O_RDWR); - if (fd != -1) is_write = TRUE; - } else switch (is_write) { - case TRUE: - fd = open(file,O_RDWR); - if (fd > -1) - break; - default: - fd = open(file,O_RDONLY); - is_write = FALSE; - } - - lbus = bus; - ldev = dev; - lfunc = func; - } - return fd; -} - -static CARD32 -linuxPciCfgRead(PCITAG tag, int off) -{ - int fd; - CARD32 val = 0xffffffff; - - if (-1 != (fd = linuxPciOpenFile(tag,FALSE))) { - lseek(fd,off,SEEK_SET); - read(fd,&val,4); - } - return PCI_CPU(val); -} - -static void -linuxPciCfgWrite(PCITAG tag, int off, CARD32 val) -{ - int fd; - - if (-1 != (fd = linuxPciOpenFile(tag,TRUE))) { - lseek(fd,off,SEEK_SET); - val = PCI_CPU(val); - write(fd,&val,4); - } -} - -static void -linuxPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits) -{ - int fd; - CARD32 val = 0xffffffff; - - if (-1 != (fd = linuxPciOpenFile(tag,TRUE))) { - lseek(fd,off,SEEK_SET); - read(fd,&val,4); - val = PCI_CPU(val); - val = (val & ~mask) | (bits & mask); - val = PCI_CPU(val); - lseek(fd,off,SEEK_SET); - write(fd,&val,4); - } -} - -/* - * This function will convert a BAR address into a host address - * suitable for passing into the mmap function of a /proc/bus - * device. - */ -ADDRESS linuxTransAddrBusToHost(PCITAG tag, PciAddrType type, ADDRESS addr) -{ - ADDRESS ret = xf86GetOSOffsetFromPCI(tag, PCI_MEM|PCI_IO, addr); - - if (ret) - return ret; - - /* - * if it is not a BAR address, it must be legacy, (or wrong) - * return it as is.. - */ - return addr; -} - - -#if defined(__powerpc__) - -#ifndef __NR_pciconfig_iobase -#define __NR_pciconfig_iobase 200 -#endif - -static ADDRESS -linuxPpcBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr) -{ - if (type == PCI_MEM) - { - ADDRESS membase = syscall(__NR_pciconfig_iobase, 1, - PCI_BUS_FROM_TAG(tag), PCI_DFN_FROM_TAG(tag)); - return (addr + membase); - } - else if (type == PCI_IO) - { - ADDRESS iobase = syscall(__NR_pciconfig_iobase, 2, - PCI_BUS_FROM_TAG(tag), PCI_DFN_FROM_TAG(tag)); - return (addr + iobase); - } - else return addr; -} - -static ADDRESS -linuxPpcHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr) -{ - if (type == PCI_MEM) - { - ADDRESS membase = syscall(__NR_pciconfig_iobase, 1, - PCI_BUS_FROM_TAG(tag), PCI_DFN_FROM_TAG(tag)); - return (addr - membase); - } - else if (type == PCI_IO) - { - ADDRESS iobase = syscall(__NR_pciconfig_iobase, 2, - PCI_BUS_FROM_TAG(tag), PCI_DFN_FROM_TAG(tag)); - return (addr - iobase); - } - else return addr; -} - -#endif /* __powerpc__ */ - -static CARD8 -linuxPciCfgReadByte(PCITAG tag, int off) -{ - int fd; - CARD8 val = 0xff; - - if (-1 != (fd = linuxPciOpenFile(tag,FALSE))) { - lseek(fd,off,SEEK_SET); - read(fd,&val,1); - } - - return val; -} - -static void -linuxPciCfgWriteByte(PCITAG tag, int off, CARD8 val) -{ - int fd; - - if (-1 != (fd = linuxPciOpenFile(tag,TRUE))) { - lseek(fd,off,SEEK_SET); - write(fd, &val, 1); - } -} - -static CARD16 -linuxPciCfgReadWord(PCITAG tag, int off) -{ - int fd; - CARD16 val = 0xff; - - if (-1 != (fd = linuxPciOpenFile(tag,FALSE))) { - lseek(fd, off, SEEK_SET); - read(fd, &val, 2); - } - - return PCI_CPU16(val); -} - -static void -linuxPciCfgWriteWord(PCITAG tag, int off, CARD16 val) -{ - int fd; - - if (-1 != (fd = linuxPciOpenFile(tag,TRUE))) { - lseek(fd, off, SEEK_SET); - val = PCI_CPU16(val); - write(fd, &val, 2); - } -} - -#ifndef INCLUDE_XF86_NO_DOMAIN - -/* - * Compiling the following simply requires the presence of . - * Actually running this is another matter altogether... - * - * This scheme requires that the kernel allow mmap()'ing of a host bridge's I/O - * and memory spaces through its /proc/bus/pci/BUS/DFN entry. Which one is - * determined by a prior ioctl(). - * - * For the sparc64 port, this means 2.4.12 or later. For ppc, this - * functionality is almost, but not quite there yet. Alpha and other kernel - * ports to multi-domain architectures still need to implement this. - * - * This scheme is also predicated on the use of an IOADDRESS compatible type to - * designate I/O addresses. Although IOADDRESS is defined as an unsigned - * integral type, it is actually the virtual address of, i.e. a pointer to, the - * I/O port to access. And so, the inX/outX macros in "compiler.h" need to be - * #define'd appropriately (as is done on SPARC's). - * - * Another requirement to port this scheme to another multi-domain architecture - * is to add the appropriate entries in the pciControllerSizes array below. - * - * TO DO: Address the deleterious reaction some host bridges have to master - * aborts. This is already done for secondary PCI buses, but not yet - * for accesses to primary buses (except for the SPARC port, where - * master aborts are avoided during PCI scans). - */ - -#include - -#ifndef PCIIOC_BASE /* Ioctls for /proc/bus/pci/X/Y nodes. */ -#define PCIIOC_BASE ('P' << 24 | 'C' << 16 | 'I' << 8) - -/* Get controller for PCI device. */ -#define PCIIOC_CONTROLLER (PCIIOC_BASE | 0x00) -/* Set mmap state to I/O space. */ -#define PCIIOC_MMAP_IS_IO (PCIIOC_BASE | 0x01) -/* Set mmap state to MEM space. */ -#define PCIIOC_MMAP_IS_MEM (PCIIOC_BASE | 0x02) -/* Enable/disable write-combining. */ -#define PCIIOC_WRITE_COMBINE (PCIIOC_BASE | 0x03) - -#endif - -/* This probably shouldn't be Linux-specific */ -static pciConfigPtr -xf86GetPciHostConfigFromTag(PCITAG Tag) -{ - int bus = PCI_BUS_FROM_TAG(Tag); - pciBusInfo_t *pBusInfo; - - while ((bus < pciNumBuses) && (pBusInfo = pciBusInfo[bus])) { - if (bus == pBusInfo->primary_bus) - return pBusInfo->bridge; - bus = pBusInfo->primary_bus; - } - - return NULL; /* Bad data */ -} - -/* - * This is ugly, but until I can extract this information from the kernel, - * it'll have to do. The default I/O space size is 64K, and 4G for memory. - * Anything else needs to go in this table. (PowerPC folk take note.) - * - * Note that Linux/SPARC userland is 32-bit, so 4G overflows to zero here. - * - * Please keep this table in ascending vendor/device order. - */ -static struct pciSizes { - unsigned short vendor, device; - unsigned long io_size, mem_size; -} pciControllerSizes[] = { - { - PCI_VENDOR_SUN, PCI_CHIP_PSYCHO, - 1U << 16, 1U << 31 - }, - { - PCI_VENDOR_SUN, PCI_CHIP_SCHIZO, - 1U << 24, 1U << 31 /* ??? */ - }, - { - PCI_VENDOR_SUN, PCI_CHIP_SABRE, - 1U << 24, (unsigned long)(1ULL << 32) - }, - { - PCI_VENDOR_SUN, PCI_CHIP_HUMMINGBIRD, - 1U << 24, (unsigned long)(1ULL << 32) - } -}; -#define NUM_SIZES (sizeof(pciControllerSizes) / sizeof(pciControllerSizes[0])) - -static unsigned long -linuxGetIOSize(PCITAG Tag) -{ - pciConfigPtr pPCI; - int i; - - /* Find host bridge */ - if ((pPCI = xf86GetPciHostConfigFromTag(Tag))) { - /* Look up vendor/device */ - for (i = 0; i < NUM_SIZES; i++) { - if (pPCI->pci_vendor > pciControllerSizes[i].vendor) - continue; - if (pPCI->pci_vendor < pciControllerSizes[i].vendor) - break; - if (pPCI->pci_device > pciControllerSizes[i].device) - continue; - if (pPCI->pci_device < pciControllerSizes[i].device) - break; - return pciControllerSizes[i].io_size; - } - } - - return 1U << 16; /* Default to 64K */ -} - -static void -linuxGetSizes(PCITAG Tag, unsigned long *io_size, unsigned long *mem_size) -{ - pciConfigPtr pPCI; - int i; - - *io_size = (1U << 16); /* Default to 64K */ - *mem_size = (unsigned long)(1ULL << 32); /* Default to 4G */ - - /* Find host bridge */ - if ((pPCI = xf86GetPciHostConfigFromTag(Tag))) { - /* Look up vendor/device */ - for (i = 0; i < NUM_SIZES; i++) { - if (pPCI->pci_vendor > pciControllerSizes[i].vendor) - continue; - if (pPCI->pci_vendor < pciControllerSizes[i].vendor) - break; - if (pPCI->pci_device > pciControllerSizes[i].device) - continue; - if (pPCI->pci_device < pciControllerSizes[i].device) - break; - *io_size = pciControllerSizes[i].io_size; - *mem_size = pciControllerSizes[i].mem_size; - break; - } - } -} - -int -xf86GetPciDomain(PCITAG Tag) -{ - pciConfigPtr pPCI; - int fd, result; - - pPCI = xf86GetPciHostConfigFromTag(Tag); - - if (pPCI && (result = PCI_DOM_FROM_BUS(pPCI->busnum))) - return result; - - if (!pPCI || pPCI->fakeDevice) - return 1; /* Domain 0 is reserved */ - - if ((fd = linuxPciOpenFile(pPCI ? pPCI->tag : 0,FALSE)) < 0) - return 0; - - if ((result = ioctl(fd, PCIIOC_CONTROLLER, 0)) < 0) - return 0; - - return result + 1; /* Domain 0 is reserved */ -} - -static pointer -linuxMapPci(int ScreenNum, int Flags, PCITAG Tag, - ADDRESS Base, unsigned long Size, int mmap_ioctl) -{ - do { - pciConfigPtr pPCI; - unsigned char *result; - ADDRESS realBase, Offset; - int fd, mmapflags, prot; - - xf86InitVidMem(); - - pPCI = xf86GetPciHostConfigFromTag(Tag); - - if (((fd = linuxPciOpenFile(pPCI ? pPCI->tag : 0,FALSE)) < 0) || - (ioctl(fd, mmap_ioctl, 0) < 0)) - break; - -/* Note: IA-64 doesn't compile this and doesn't need to */ -#ifdef __ia64__ - -# ifndef MAP_WRITECOMBINED -# define MAP_WRITECOMBINED 0x00010000 -# endif -# ifndef MAP_NONCACHED -# define MAP_NONCACHED 0x00020000 -# endif - - if (Flags & VIDMEM_FRAMEBUFFER) - mmapflags = MAP_SHARED | MAP_WRITECOMBINED; - else - mmapflags = MAP_SHARED | MAP_NONCACHED; - -#else /* !__ia64__ */ - - mmapflags = (Flags & VIDMEM_FRAMEBUFFER) / VIDMEM_FRAMEBUFFER; - - if (ioctl(fd, PCIIOC_WRITE_COMBINE, mmapflags) < 0) - break; - - mmapflags = MAP_SHARED; - -#endif /* ?__ia64__ */ - - /* Align to page boundary */ - realBase = Base & ~(getpagesize() - 1); - Offset = Base - realBase; - - if (Flags & VIDMEM_READONLY) - prot = PROT_READ; - else - prot = PROT_READ | PROT_WRITE; - - result = mmap(NULL, Size + Offset, prot, mmapflags, fd, realBase); - - if (!result || ((pointer)result == MAP_FAILED)) - return NULL; - - xf86MakeNewMapping(ScreenNum, Flags, realBase, Size + Offset, result); - - return result + Offset; - } while (0); - - if (mmap_ioctl == PCIIOC_MMAP_IS_MEM) - return xf86MapVidMem(ScreenNum, Flags, Base, Size); - - return NULL; -} - -#define MAX_DOMAINS 257 -static pointer DomainMmappedIO[MAX_DOMAINS]; -static pointer DomainMmappedMem[MAX_DOMAINS]; - -static int -linuxOpenLegacy(PCITAG Tag, char *name) -{ -#define PREFIX "/sys/class/pci_bus/%04x:%02x/%s" - char *path; - int domain, bus; - pciBusInfo_t *pBusInfo; - pciConfigPtr bridge = NULL; - int fd; - - path = xalloc(strlen(PREFIX) + strlen(name)); - if (!path) - return -1; - - for (;;) { - domain = xf86GetPciDomain(Tag); - bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(Tag)); - - /* Domain 0 is reserved -- see xf86GetPciDomain() */ - if ((domain <= 0) || (domain >= MAX_DOMAINS)) - FatalError("linuxOpenLegacy(): domain out of range\n"); - - sprintf(path, PREFIX, domain - 1, bus, name); - fd = open(path, O_RDWR); - if (fd >= 0) { - xfree(path); - return fd; - } - - pBusInfo = pciBusInfo[bus]; - if (!pBusInfo || (bridge == pBusInfo->bridge) || - !(bridge = pBusInfo->bridge)) { - xfree(path); - return -1; - } - - Tag = bridge->tag; - } - - xfree(path); - return fd; -} - -/* - * xf86MapDomainMemory - memory map PCI domain memory - * - * This routine maps the memory region in the domain specified by Tag and - * returns a pointer to it. The pointer is saved for future use if it's in - * the legacy ISA memory space (memory in a domain between 0 and 1MB). - */ -pointer -xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, - ADDRESS Base, unsigned long Size) -{ - int domain = xf86GetPciDomain(Tag); - int fd; - - /* - * We use /proc/bus/pci on non-legacy addresses or if the Linux sysfs - * legacy_mem interface is unavailable. - */ - if (Base > 1024*1024) - return linuxMapPci(ScreenNum, Flags, Tag, Base, Size, - PCIIOC_MMAP_IS_MEM); - - if ((fd = linuxOpenLegacy(Tag, "legacy_mem")) < 0) - return linuxMapPci(ScreenNum, Flags, Tag, Base, Size, - PCIIOC_MMAP_IS_MEM); - - - /* If we haven't already mapped this legacy space, try to. */ - if (!DomainMmappedMem[domain]) { - DomainMmappedMem[domain] = mmap(NULL, 1024*1024, PROT_READ|PROT_WRITE, - MAP_SHARED, fd, 0); - if (DomainMmappedMem[domain] == MAP_FAILED) { - close(fd); - perror("mmap failure"); - FatalError("xf86MapDomainMem(): mmap() failure\n"); - } - } - - close(fd); - return (pointer)((char *)DomainMmappedMem[domain] + Base); -} - -/* - * xf86MapDomainIO - map I/O space in this domain - * - * Each domain has a legacy ISA I/O space. This routine will try to - * map it using the Linux sysfs legacy_io interface. If that fails, - * it'll fall back to using /proc/bus/pci. - * - * If the legacy_io interface *does* exist, the file descriptor (fd below) - * will be saved in the DomainMmappedIO array in the upper bits of the - * pointer. Callers will do I/O with small port numbers (<64k values), so - * the platform I/O code can extract the port number and the fd, lseek to - * the port number in the legacy_io file, and issue the read or write. - * - * This has no means of returning failure, so all errors are fatal - */ -IOADDRESS -xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag, - IOADDRESS Base, unsigned long Size) -{ - int domain = xf86GetPciDomain(Tag); - int fd; - - if ((domain <= 0) || (domain >= MAX_DOMAINS)) - FatalError("xf86MapDomainIO(): domain out of range\n"); - - if (DomainMmappedIO[domain]) - return (IOADDRESS)DomainMmappedIO[domain] + Base; - - /* Permanently map all of I/O space */ - if ((fd = linuxOpenLegacy(Tag, "legacy_io")) < 0) { - DomainMmappedIO[domain] = linuxMapPci(ScreenNum, Flags, Tag, - 0, linuxGetIOSize(Tag), - PCIIOC_MMAP_IS_IO); - /* ia64 can't mmap legacy IO port space */ - if (!DomainMmappedIO[domain]) - return Base; - } - else { /* legacy_io file exists, encode fd */ - DomainMmappedIO[domain] = (pointer)(fd << 24); - } - - return (IOADDRESS)DomainMmappedIO[domain] + Base; -} - -/* - * xf86ReadDomainMemory - copy from domain memory into a caller supplied buffer - */ -int -xf86ReadDomainMemory(PCITAG Tag, ADDRESS Base, int Len, unsigned char *Buf) -{ - unsigned char *ptr, *src; - ADDRESS offset; - unsigned long size; - int len, pagemask = getpagesize() - 1; - - unsigned int i, dom, bus, dev, func; - unsigned int fd; - char file[256]; - struct stat st; - - dom = PCI_DOM_FROM_TAG(Tag); - bus = PCI_BUS_FROM_TAG(Tag); - dev = PCI_DEV_FROM_TAG(Tag); - func = PCI_FUNC_FROM_TAG(Tag); - sprintf(file, "/sys/devices/pci%04x:%02x/%04x:%02x:%02x.%1x/rom", - dom, bus, dom, bus, dev, func); - - /* - * If the caller wants the ROM and the sysfs rom interface exists, - * try to use it instead of reading it from /proc/bus/pci. - */ - if (((Base & 0xfffff) == 0xC0000) && (stat(file, &st) == 0)) { - if ((fd = open(file, O_RDWR))) - Base = 0x0; - - /* enable the ROM first */ - write(fd, "1", 2); - lseek(fd, 0, SEEK_SET); - - /* copy the ROM until we hit Len, EOF or read error */ - for (i = 0; i < Len && read(fd, Buf, 1) > 0; Buf++, i++) - ; - - write(fd, "0", 2); - close(fd); - - return Len; - } - - /* Ensure page boundaries */ - offset = Base & ~pagemask; - size = ((Base + Len + pagemask) & ~pagemask) - offset; - - ptr = xf86MapDomainMemory(-1, VIDMEM_READONLY, Tag, offset, size); - - if (!ptr) - return -1; - - /* Using memcpy() here can hang the system */ - src = ptr + (Base - offset); - for (len = Len; len-- > 0;) - *Buf++ = *src++; - - xf86UnMapVidMem(-1, ptr, size); - - return Len; -} - -resPtr -xf86BusAccWindowsFromOS(void) -{ - pciConfigPtr *ppPCI, pPCI; - resPtr pRes = NULL; - resRange range; - unsigned long io_size, mem_size; - int domain; - - if ((ppPCI = xf86scanpci(0))) { - for (; (pPCI = *ppPCI); ppPCI++) { - if ((pPCI->pci_base_class != PCI_CLASS_BRIDGE) || - (pPCI->pci_sub_class != PCI_SUBCLASS_BRIDGE_HOST)) - continue; - - domain = xf86GetPciDomain(pPCI->tag); - linuxGetSizes(pPCI->tag, &io_size, &mem_size); - - RANGE(range, 0, (ADDRESS)(mem_size - 1), - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - - RANGE(range, 0, (IOADDRESS)(io_size - 1), - RANGE_TYPE(ResExcIoBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - - if (domain <= 0) - break; - } - } - - return pRes; -} - -resPtr -xf86PciBusAccWindowsFromOS(void) -{ - pciConfigPtr *ppPCI, pPCI; - resPtr pRes = NULL; - resRange range; - unsigned long io_size, mem_size; - int domain; - - if ((ppPCI = xf86scanpci(0))) { - for (; (pPCI = *ppPCI); ppPCI++) { - if ((pPCI->pci_base_class != PCI_CLASS_BRIDGE) || - (pPCI->pci_sub_class != PCI_SUBCLASS_BRIDGE_HOST)) - continue; - - domain = xf86GetPciDomain(pPCI->tag); - linuxGetSizes(pPCI->tag, &io_size, &mem_size); - - RANGE(range, 0, (ADDRESS)(mem_size - 1), - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - - RANGE(range, 0, (IOADDRESS)(io_size - 1), - RANGE_TYPE(ResExcIoBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - - if (domain <= 0) - break; - } - } - - return pRes; -} - - -resPtr -xf86AccResFromOS(resPtr pRes) -{ - pciConfigPtr *ppPCI, pPCI; - resRange range; - unsigned long io_size, mem_size; - int domain; - - if ((ppPCI = xf86scanpci(0))) { - for (; (pPCI = *ppPCI); ppPCI++) { - if ((pPCI->pci_base_class != PCI_CLASS_BRIDGE) || - (pPCI->pci_sub_class != PCI_SUBCLASS_BRIDGE_HOST)) - continue; - - domain = xf86GetPciDomain(pPCI->tag); - linuxGetSizes(pPCI->tag, &io_size, &mem_size); - - /* - * At minimum, the top and bottom resources must be claimed, so - * that resources that are (or appear to be) unallocated can be - * relocated. - */ - RANGE(range, 0x00000000u, 0x0009ffffu, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - RANGE(range, 0x000c0000u, 0x000effffu, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - RANGE(range, 0x000f0000u, 0x000fffffu, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - - RANGE(range, (ADDRESS)(mem_size - 1), (ADDRESS)(mem_size - 1), - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - - RANGE(range, 0x00000000u, 0x00000000u, - RANGE_TYPE(ResExcIoBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - RANGE(range, (IOADDRESS)(io_size - 1), (IOADDRESS)(io_size - 1), - RANGE_TYPE(ResExcIoBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - - if (domain <= 0) - break; - } - } - - return pRes; -} - -#endif /* !INCLUDE_XF86_NO_DOMAIN */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/netbsdPci.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/netbsdPci.c deleted file mode 100644 index 7dbbfdec7..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/netbsdPci.c +++ /dev/null @@ -1,132 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/netbsdPci.c,v 1.4 2003/08/24 17:37:04 dawes Exp $ */ -/* - * Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE - * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project - * shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written - * authorization from the XFree86 Project. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86OSpriv.h" - -#include "Pci.h" - -static CARD32 netbsdPciConfRead(PCITAG, int); -static void netbsdPciConfWrite(PCITAG, int, CARD32); -static void netbsdPciSetBits(PCITAG, int, CARD32, CARD32); - -static int devpci = -1; - -static pciBusFuncs_t netbsdFuncs0 = { -/* pciReadLong */ netbsdPciConfRead, -/* pciWriteLong */ netbsdPciConfWrite, -/* pciSetBitsLong */ netbsdPciSetBits, -/* pciAddrHostToBus */ pciAddrNOOP, -/* pciAddrBusToHost */ pciAddrNOOP -}; - -static pciBusInfo_t netbsdPci0 = { -/* configMech */ PCI_CFG_MECH_OTHER, -/* numDevices */ 32, -/* secondary */ FALSE, -/* primary_bus */ 0, -/* funcs */ &netbsdFuncs0, -/* pciBusPriv */ NULL, -/* bridge */ NULL -}; - -void -netbsdPciInit() -{ - struct pciio_businfo pci_businfo; - - devpci = open("/dev/pci0", O_RDWR); - if (devpci == -1) - FatalError("netbsdPciInit: can't open /dev/pci0\n"); - - pciNumBuses = 1; - pciBusInfo[0] = &netbsdPci0; - pciFindFirstFP = pciGenFindFirst; - pciFindNextFP = pciGenFindNext; - /* use businfo to get the number of devs */ - if (ioctl(devpci, PCI_IOC_BUSINFO, &pci_businfo) != 0) - FatalError("netbsdPciInit: not a PCI bus device"); - netbsdPci0.numDevices = pci_businfo.maxdevs; -} - -static CARD32 -netbsdPciConfRead(PCITAG tag, int reg) -{ - struct pciio_bdf_cfgreg bdfr; - - bdfr.bus = PCI_BUS_FROM_TAG(tag); - bdfr.device = PCI_DEV_FROM_TAG(tag); - bdfr.function = PCI_FUNC_FROM_TAG(tag); - bdfr.cfgreg.reg = reg; - - if (ioctl(devpci, PCI_IOC_BDF_CFGREAD, &bdfr) == -1) - FatalError("netbsdPciConfRead: failed on %d/%d/%d\n", - bdfr.bus, bdfr.device, bdfr.function); - - return (bdfr.cfgreg.val); -} - -static void -netbsdPciConfWrite(PCITAG tag, int reg, CARD32 val) -{ - struct pciio_bdf_cfgreg bdfr; - - bdfr.bus = PCI_BUS_FROM_TAG(tag); - bdfr.device = PCI_DEV_FROM_TAG(tag); - bdfr.function = PCI_FUNC_FROM_TAG(tag); - bdfr.cfgreg.reg = reg; - bdfr.cfgreg.val = val; - - if (ioctl(devpci, PCI_IOC_BDF_CFGWRITE, &bdfr) == -1) - FatalError("netbsdPciConfWrite: failed on %d/%d/%d\n", - bdfr.bus, bdfr.device, bdfr.function); -} - -static void -netbsdPciSetBits(PCITAG tag, int reg, CARD32 mask, CARD32 bits) -{ - CARD32 val; - - val = netbsdPciConfRead(tag, reg); - val = (val & ~mask) | (bits & mask); - netbsdPciConfWrite(tag, reg, val); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c deleted file mode 100644 index 7a438af67..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c +++ /dev/null @@ -1,311 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c,v 1.8 2002/07/24 19:06:52 tsi Exp $ */ -/* - * ppcPci.c - PowerPC PCI access functions - * - * PCI driver functions supporting Motorola PowerPC platforms - * including Powerstack(RiscPC/RiscPC+), PowerStackII, MTX, and - * MVME 160x/260x/360x/460x VME boards - * - * Gary Barton - * Concurrent Computer Corporation - * garyb@gate.net - * - */ - -/* - * Copyright 1998 by Concurrent Computer Corporation - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Concurrent Computer - * Corporation not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Concurrent Computer Corporation makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * Copyright 1998 by Metro Link Incorporated - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "compiler.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "Pci.h" - -#ifndef MAP_FAILED -#define MAP_FAILED (pointer)(-1) -#endif - -void -ppcPciInit() -{ -#if defined(PowerMAX_OS) - extern void pmaxPciInit(void); - - pmaxPciInit(); - -#else - - static void motoppcPciInit(void); - motoppcPciInit(); - -#endif -} - -#if defined(PowerMAX_OS) - -/* - * Motorola PowerPC platform support - * - * The following code should support the MVME 1600 & 2600 VME boards - * as well as the various PowerStack and RiscPC models. All of these - * machines support PCI config mechanism #1 and use the std config - * address and data regs locations: - * cfg address reg = 0xcf8 (PCI I/O) - * cfg data reg = 0xcfc (PCI I/O) - * - * The moto machines do have different address maps on either side - * of the PCI-host bridge though. - */ -static ADDRESS motoppcBusAddrToHostAddr(PCITAG, PciAddrType, ADDRESS); -static ADDRESS motoppcHostAddrToBusAddr(PCITAG, PciAddrType, ADDRESS); -static CARD32 pciCfgMech1Read(PCITAG tag, int offset); -static void pciCfgMech1Write(PCITAG tag, int offset, CARD32 val); -static void pciCfgMech1SetBits(PCITAG tag, int offset, - CARD32 mask, CARD32 val); - - -static pciBusFuncs_t motoppcFuncs0 = { -/* pciReadLong */ pciCfgMech1Read, -/* pciWriteLong */ pciCfgMech1Write, -/* pciSetBitsLong */ pciCfgMech1SetBits, -/* pciAddrHostToBus */ motoppcHostAddrToBusAddr, -/* pciAddrBusToHost */ motoppcBusAddrToHostAddr -}; - -static pciBusInfo_t motoppcPci0 = { -/* configMech */ PCI_CFG_MECH_1, -/* numDevices */ 32, -/* secondary */ FALSE, -/* primary_bus */ 0, -#ifdef PowerMAX_OS -/* ppc_io_base */ 0x80000000, -/* ppc_io_size */ 64 * 1024, -#endif -/* funcs */ &motoppcFuncs0, -/* pciBusPriv */ NULL, -/* bridge */ NULL -}; - -extern volatile unsigned char *ioBase; - -static void -motoppcPciInit() -{ - pciNumBuses = 1; - pciBusInfo[0] = &motoppcPci0; - pciFindFirstFP = pciGenFindFirst; - pciFindNextFP = pciGenFindNext; - - if (!xf86EnableIO()) - FatalError("motoppcPciInit: EnableIO failed\n"); - - if (ioBase == MAP_FAILED) { - ppcPciIoMap(0); /* Make inb/outb et al work for pci0 and its secondaries */ - - if (ioBase == MAP_FAILED) { - FatalError("motoppcPciInit: Cannot map pci0 I/O segment!!!\n"); - /*NOTREACHED*/ - } - } -} - -extern unsigned long motoPciMemBase = 0; - -#if defined(Lynx) && defined(__powerpc__) -extern unsigned long motoPciMemLen = 0x40000000; -#else -extern unsigned long motoPciMemLen = 0x3f000000; -#endif - -extern unsigned long motoPciMemBaseCPU = 0xc0000000; - -static ADDRESS -motoppcBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr) -{ - unsigned long addr_l = (unsigned long)addr; - - if (type == PCI_MEM) { - if (addr_l >= motoPciMemBase && addr_l < motoPciMemLen) - /* - * PCI memory space addresses [0-0x3effffff] are - * are seen at [0xc0000000,0xfeffffff] on moto host - */ - return((ADDRESS)((motoPciMemBaseCPU - motoPciMemBase) + addr_l)); - - else if (addr_l >= 0x80000000) - /* - * Moto host memory [0,0x7fffffff] is seen at - * [0x80000000,0xffffffff] on PCI bus - */ - return((ADDRESS)(addr_l & 0x7fffffff)); - else - FatalError("motoppcBusAddrToHostAddr: PCI addr 0x%x is not accessible to host!!!\n", - addr_l); - } else - return addr; - - /*NOTREACHED*/ -} - -static ADDRESS -motoppcHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr) -{ - unsigned long addr_l = (unsigned long)addr; - - if (type == PCI_MEM) { - if (addr_l < 0x80000000) - /* - * Moto host memory [0,0x7fffffff] is seen at - * [0x80000000,0xffffffff] on PCI bus - */ - return((ADDRESS)(0x80000000 | addr_l)); - - else if (addr_l >= motoPciMemBaseCPU && addr_l < motoPciMemBaseCPU + motoPciMemLen) - /* - * PCI memory space addresses [0-0x3effffff] are - * are seen at [0xc0000000,0xfeffffff] on moto host - */ - return((ADDRESS)(addr_l - (motoPciMemBaseCPU - motoPciMemBase))); - - else - FatalError("motoppcHostAddrToBusAddr: Host addr 0x%x is not accessible to PCI!!!\n", - addr_l); - } else - return addr; - - /*NOTREACHED*/ -} - -#if defined (__powerpc__) -static int buserr_detected; - -static -void buserr(int sig) -{ - buserr_detected = 1; -} -#endif - -static CARD32 -pciCfgMech1Read(PCITAG tag, int offset) -{ - unsigned long rv = 0xffffffff; -#ifdef DEBUGPCI - ErrorF("pciCfgMech1Read(tag=%08x,offset=%08x)\n", tag, offset); -#endif - -#if defined(__powerpc__) - signal(SIGBUS, buserr); - buserr_detected = 0; -#endif - - outl(0xCF8, PCI_EN | tag | (offset & 0xfc)); - rv = inl(0xCFC); - -#if defined(__powerpc__) - signal(SIGBUS, SIG_DFL); - if (buserr_detected) - { -#ifdef DEBUGPCI - ErrorF("pciCfgMech1Read() BUS ERROR\n"); -#endif - return(0xffffffff); - } - else -#endif - return(rv); -} - -static void -pciCfgMech1Write(PCITAG tag, int offset, CARD32 val) -{ -#ifdef DEBUGPCI - ErrorF("pciCfgMech1Write(tag=%08x,offset=%08x,val=%08x)\n", - tag, offset,val); -#endif - -#if defined(__powerpc__) - signal(SIGBUS, SIG_IGN); -#endif - - outl(0xCF8, PCI_EN | tag | (offset & 0xfc)); -#if defined(Lynx) && defined(__powerpc__) - outb(0x80, 0x00); /* without this the next access fails - * on my Powerstack system when we use - * assembler inlines for outl */ -#endif - outl(0xCFC, val); - -#if defined(__powerpc__) - signal(SIGBUS, SIG_DFL); -#endif -} - -static void -pciCfgMech1SetBits(PCITAG tag, int offset, CARD32 mask, CARD32 val) -{ - unsigned long rv = 0xffffffff; - -#if defined(__powerpc__) - signal(SIGBUS, buserr); -#endif - - outl(0xCF8, PCI_EN | tag | (offset & 0xfc)); - rv = inl(0xCFC); - rv = (rv & ~mask) | val; - outl(0xCFC, rv); - -#if defined(__powerpc__) - signal(SIGBUS, SIG_DFL); -#endif -} - -#endif /* PowerMAX_OS */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c deleted file mode 100644 index 48e10ede4..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c +++ /dev/null @@ -1,1052 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c,v 1.14 2003/08/24 17:37:04 dawes Exp $ */ -/* - * Copyright (C) 2001-2003 The XFree86 Project, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from the - * XFree86 Project. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "Pci.h" -#include "xf86sbusBus.h" - -#if defined(sun) - -extern char *apertureDevName; -static int apertureFd = -1; - -/* - * A version of xf86MapVidMem() that allows for 64-bit displacements (but not - * sizes). Areas thus mapped can be unmapped by xf86UnMapVidMem(). - */ -static pointer -sparcMapAperture(int iScreen, int Flags, - unsigned long long Base, unsigned long Size) -{ - pointer result; - static int lastFlags = 0; - - /* Assume both Base & Size are multiples of the page size */ - - if ((apertureFd < 0) || (Flags != lastFlags)) { - if (apertureFd >= 0) - close(apertureFd); - lastFlags = Flags; - apertureFd = open(apertureDevName, - (Flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR); - if (apertureFd < 0) - FatalError("sparcMapAperture: open failure: %s\n", - strerror(errno)); - } - - result = mmap(NULL, Size, - (Flags & VIDMEM_READONLY) ? - PROT_READ : (PROT_READ | PROT_WRITE), - MAP_SHARED, apertureFd, (off_t)Base); - - if (result == MAP_FAILED) - FatalError("sparcMapAperture: mmap failure: %s\n", strerror(errno)); - - return result; -} - -/* - * Platform-specific bus privates. - */ -typedef struct _sparcDomainRec { - unsigned long long io_addr, io_size; - unsigned long long mem_addr, mem_size; - pointer pci, io; - int bus_min, bus_max; - unsigned char dfn_mask[256 / 8]; -} sparcDomainRec, *sparcDomainPtr; - -#define SetBitInMap(bit, map) \ - do { \ - int _bit = (bit); \ - (map)[_bit >> 3] |= 1 << (_bit & 7); \ - } while (0) - -#define IsBitSetInMap(bit, map) \ - ((map)[(bit) >> 3] & (1 << ((bit) & 7))) - -/* - * Domain 0 is reserved for the one that represents the system as a whole, i.e. - * the one without any resource relocations. - */ -#define MAX_DOMAINS (MAX_PCI_BUSES / 256) -static sparcDomainPtr xf86DomainInfo[MAX_DOMAINS]; -static int pciNumDomains = 1; - -/* Variables that are assigned this must be declared volatile */ -#define PciReg(base, tag, off, type) \ - *(volatile type *)(pointer)((char *)(base) + \ - (PCI_TAG_NO_DOMAIN(tag) | (off))) - -/* Generic SPARC PCI access functions */ -static CARD32 -sparcPciCfgRead32(PCITAG tag, int off) -{ - pciBusInfo_t *pBusInfo; - sparcDomainPtr pDomain; - volatile CARD32 result = (CARD32)(-1); /* Must be volatile */ - int bus; - - if ((off >= 0) && (off <= 252) && !(off & 3) && - ((bus = PCI_BUS_FROM_TAG(tag)) < pciNumBuses) && - (pBusInfo = pciBusInfo[bus]) && (pDomain = pBusInfo->pciBusPriv) && - (bus >= pDomain->bus_min) && (bus < pDomain->bus_max) && - ((bus > pDomain->bus_min) || - IsBitSetInMap(PCI_DFN_FROM_TAG(tag), pDomain->dfn_mask))) { - result = PciReg(pDomain->pci, tag, off, CARD32); - - result = PCI_CPU(result); - } - - return result; -} - -static void -sparcPciCfgWrite32(PCITAG tag, int off, CARD32 val) -{ - pciBusInfo_t *pBusInfo; - sparcDomainPtr pDomain; - int bus; - - if ((off < 0) || (off > 252) || (off & 3) || - ((bus = PCI_BUS_FROM_TAG(tag)) >= pciNumBuses) || - !(pBusInfo = pciBusInfo[bus]) || !(pDomain = pBusInfo->pciBusPriv) || - (bus < pDomain->bus_min) || (bus >= pDomain->bus_max) || - ((bus == pDomain->bus_min) && - !IsBitSetInMap(PCI_DFN_FROM_TAG(tag), pDomain->dfn_mask))) - return; - - val = PCI_CPU(val); - PciReg(pDomain->pci, tag, off, CARD32) = val; -} - -static void -sparcPciCfgSetBits32(PCITAG tag, int off, CARD32 mask, CARD32 bits) -{ - CARD32 PciVal; - - PciVal = sparcPciCfgRead32(tag, off); - PciVal &= ~mask; - PciVal |= bits; - sparcPciCfgWrite32(tag, off, PciVal); -} - -static pciBusFuncs_t sparcPCIFunctions = -{ - sparcPciCfgRead32, - sparcPciCfgWrite32, - sparcPciCfgSetBits32, - pciAddrNOOP, - pciAddrNOOP -}; - -/* - * Sabre-specific versions of the above because of its peculiar access size - * requirements. - */ -static CARD32 -sabrePciCfgRead32(PCITAG tag, int off) -{ - pciBusInfo_t *pBusInfo; - sparcDomainPtr pDomain; - volatile CARD32 result; /* Must be volatile */ - int bus; - - if (PCI_BDEV_FROM_TAG(tag)) - return sparcPciCfgRead32(tag, off); - - if (PCI_FUNC_FROM_TAG(tag) || (off < 0) || (off > 252) || (off & 3) || - ((bus = PCI_BUS_FROM_TAG(tag)) >= pciNumBuses) || - !(pBusInfo = pciBusInfo[bus]) || !(pDomain = pBusInfo->pciBusPriv) || - (bus != pDomain->bus_min)) - return (CARD32)(-1); - - if (off < 8) { - result = (PciReg(pDomain->pci, tag, off, CARD16) << 16) | - PciReg(pDomain->pci, tag, off + 2, CARD16); - return PCI_CPU(result); - } - - result = (PciReg(pDomain->pci, tag, off + 3, CARD8) << 24) | - (PciReg(pDomain->pci, tag, off + 2, CARD8) << 16) | - (PciReg(pDomain->pci, tag, off + 1, CARD8) << 8) | - (PciReg(pDomain->pci, tag, off , CARD8) ); - return result; -} - -static void -sabrePciCfgWrite32(PCITAG tag, int off, CARD32 val) -{ - pciBusInfo_t *pBusInfo; - sparcDomainPtr pDomain; - int bus; - - if (PCI_BDEV_FROM_TAG(tag)) - sparcPciCfgWrite32(tag, off, val); - else if (!PCI_FUNC_FROM_TAG(tag) && - (off >= 0) && (off <= 252) && !(off & 3) && - ((bus = PCI_BUS_FROM_TAG(tag)) < pciNumBuses) && - (pBusInfo = pciBusInfo[bus]) && - (pDomain = pBusInfo->pciBusPriv) && - (bus == pDomain->bus_min)) { - if (off < 8) { - val = PCI_CPU(val); - PciReg(pDomain->pci, tag, off , CARD16) = val >> 16; - PciReg(pDomain->pci, tag, off + 2, CARD16) = val; - } else { - PciReg(pDomain->pci, tag, off , CARD8) = val; - PciReg(pDomain->pci, tag, off + 1, CARD8) = val >> 8; - PciReg(pDomain->pci, tag, off + 2, CARD8) = val >> 16; - PciReg(pDomain->pci, tag, off + 3, CARD8) = val >> 24; - } - } -} - -static void -sabrePciCfgSetBits32(PCITAG tag, int off, CARD32 mask, CARD32 bits) -{ - CARD32 PciVal; - - PciVal = sabrePciCfgRead32(tag, off); - PciVal &= ~mask; - PciVal |= bits; - sabrePciCfgWrite32(tag, off, PciVal); -} - -static pciBusFuncs_t sabrePCIFunctions = -{ - sabrePciCfgRead32, - sabrePciCfgWrite32, - sabrePciCfgSetBits32, - pciAddrNOOP, - pciAddrNOOP -}; - -static int pagemask; - -/* Scan PROM for all PCI host bridges in the system */ -void -sparcPciInit(void) -{ - int node, node2; - - if (!xf86LinearVidMem()) - return; - - apertureFd = open(apertureDevName, O_RDWR); - if (apertureFd < 0) { - xf86Msg(X_ERROR, - "sparcPciInit: open failure: %s\n", strerror(errno)); - return; - } - - sparcPromInit(); - pagemask = xf86getpagesize() - 1; - - for (node = promGetChild(promRootNode); - node; - node = promGetSibling(node)) { - unsigned long long pci_addr; - sparcDomainRec domain; - sparcDomainPtr pDomain; - pciBusFuncs_p pFunctions; - char *prop_val; - int prop_len, bus; - - prop_val = promGetProperty("name", &prop_len); - /* Some PROMs include the trailing null; some don't */ - if (!prop_val || (prop_len < 3) || (prop_len > 4) || - strcmp(prop_val, "pci")) - continue; - - prop_val = promGetProperty("model", &prop_len); - if (!prop_val || (prop_len <= 0)) { - prop_val = promGetProperty("compatible", &prop_len); - if (!prop_val || (prop_len <= 0)) - continue; - } - - pFunctions = &sparcPCIFunctions; - (void)memset(&domain, 0, sizeof(domain)); - - if (!strncmp("SUNW,sabre", prop_val, prop_len) || - !strncmp("pci108e,a000", prop_val, prop_len) || - !strncmp("pci108e,a001", prop_val, prop_len)) { - /* - * There can only be one "Sabre" bridge in a system. It provides - * PCI configuration space, a 24-bit I/O space and a 32-bit memory - * space, all three of which are at fixed physical CPU addresses. - */ - static Bool sabre_seen = FALSE; - - xf86Msg(X_INFO, - "Sabre or Hummingbird PCI host bridge found (\"%s\")\n", - prop_val); - - /* There can only be one Sabre */ - if (sabre_seen) - continue; - sabre_seen = TRUE; - - /* Get "bus-range" property */ - prop_val = promGetProperty("bus-range", &prop_len); - if (!prop_val || (prop_len != 8) || - (((unsigned int *)prop_val)[0]) || - (((unsigned int *)prop_val)[1] >= 256)) - continue; - - pci_addr = 0x01fe01000000ull; - domain.io_addr = 0x01fe02000000ull; - domain.io_size = 0x000001000000ull; - domain.mem_addr = 0x01ff00000000ull; - domain.mem_size = 0x000100000000ull; - domain.bus_min = 0; /* Always */ - domain.bus_max = ((int *)prop_val)[1]; - - pFunctions = &sabrePCIFunctions; - } else - if (!strncmp("SUNW,psycho", prop_val, prop_len) || - !strncmp("pci108e,8000", prop_val, prop_len)) { - /* - * A "Psycho" host bridge provides two PCI interfaces, each with - * its own 16-bit I/O and 31-bit memory spaces. Both share the - * same PCI configuration space. Here, they are assigned separate - * domain numbers to prevent unintentional I/O and/or memory - * resource conflicts. - */ - xf86Msg(X_INFO, - "Psycho PCI host bridge found (\"%s\")\n", prop_val); - - /* Get "bus-range" property */ - prop_val = promGetProperty("bus-range", &prop_len); - if (!prop_val || (prop_len != 8) || - (((unsigned int *)prop_val)[1] >= 256) || - (((unsigned int *)prop_val)[0] > ((unsigned int *)prop_val)[1])) - continue; - - domain.bus_min = ((int *)prop_val)[0]; - domain.bus_max = ((int *)prop_val)[1]; - - /* Get "ranges" property */ - prop_val = promGetProperty("ranges", &prop_len); - if (!prop_val || (prop_len != 112) || - prop_val[0] || (prop_val[28] != 0x01u) || - (prop_val[56] != 0x02u) || (prop_val[84] != 0x03u) || - (((unsigned int *)prop_val)[4] != 0x01000000u) || - ((unsigned int *)prop_val)[5] || - ((unsigned int *)prop_val)[12] || - (((unsigned int *)prop_val)[13] != 0x00010000u) || - ((unsigned int *)prop_val)[19] || - (((unsigned int *)prop_val)[20] != 0x80000000u) || - ((((unsigned int *)prop_val)[11] & ~0x00010000u) != - 0x02000000u) || - (((unsigned int *)prop_val)[18] & ~0x80000000u) || - (((unsigned int *)prop_val)[3] != - ((unsigned int *)prop_val)[10]) || - (((unsigned int *)prop_val)[17] != - ((unsigned int *)prop_val)[24]) || - (((unsigned int *)prop_val)[18] != - ((unsigned int *)prop_val)[25]) || - (((unsigned int *)prop_val)[19] != - ((unsigned int *)prop_val)[26]) || - (((unsigned int *)prop_val)[20] != - ((unsigned int *)prop_val)[27])) - continue; - - /* Use memcpy() to avoid alignment issues */ - (void)memcpy(&pci_addr, prop_val + 12, - sizeof(pci_addr)); - (void)memcpy(&domain.io_addr, prop_val + 40, - sizeof(domain.io_addr)); - (void)memcpy(&domain.mem_addr, prop_val + 68, - sizeof(domain.mem_addr)); - - domain.io_size = 0x000000010000ull; - domain.mem_size = 0x000080000000ull; - } else - if (!strncmp("SUNW,schizo", prop_val, prop_len) || - !strncmp("pci108e,8001", prop_val, prop_len)) { - /* - * I have no docs on the "Schizo", but judging from the Linux - * kernel, it also provides two PCI domains. Each PCI - * configuration space is the usual 16M in size, followed by a - * variable-length I/O space. Each domain also provides a - * variable-length memory space. The kernel seems to think the I/O - * spaces are 16M long, and the memory spaces, 2G, but these - * assumptions are actually only present in source code comments. - * Sun has, however, confirmed to me the validity of these - * assumptions. - */ - volatile unsigned long long mem_match, mem_mask, io_match, io_mask; - unsigned long Offset; - pointer pSchizo; - - xf86Msg(X_INFO, - "Schizo PCI host bridge found (\"%s\")\n", prop_val); - - /* Get "bus-range" property */ - prop_val = promGetProperty("bus-range", &prop_len); - if (!prop_val || (prop_len != 8) || - (((unsigned int *)prop_val)[1] >= 256) || - (((unsigned int *)prop_val)[0] > ((unsigned int *)prop_val)[1])) - continue; - - domain.bus_min = ((int *)prop_val)[0]; - domain.bus_max = ((int *)prop_val)[1]; - - /* Get "reg" property */ - prop_val = promGetProperty("reg", &prop_len); - if (!prop_val || (prop_len != 48)) - continue; - - /* Temporarily map some of Schizo's registers */ - pSchizo = sparcMapAperture(-1, VIDMEM_MMIO, - ((unsigned long long *)prop_val)[2] - 0x000000010000ull, - 0x00010000ul); - - /* Determine where PCI config, I/O and memory spaces reside */ - if ((((unsigned long long *)prop_val)[0] & 0x000000700000ull) == - 0x000000600000ull) - Offset = 0x0040; - else - Offset = 0x0060; - - mem_match = PciReg(pSchizo, 0, Offset, unsigned long long); - mem_mask = PciReg(pSchizo, 0, Offset + 8, unsigned long long); - io_match = PciReg(pSchizo, 0, Offset + 16, unsigned long long); - io_mask = PciReg(pSchizo, 0, Offset + 24, unsigned long long); - - /* Unmap Schizo registers */ - xf86UnMapVidMem(-1, pSchizo, 0x00010000ul); - - /* Calculate sizes */ - mem_mask = (((mem_mask - 1) ^ mem_mask) >> 1) + 1; - io_mask = (((io_mask - 1) ^ io_mask ) >> 1) + 1; - - if (io_mask <= 0x000001000000ull) /* Nothing left for I/O */ - continue; - - domain.mem_addr = mem_match & ~0x8000000000000000ull; - domain.mem_size = mem_mask; - pci_addr = io_match & ~0x8000000000000000ull; - domain.io_addr = pci_addr + 0x0000000001000000ull; - domain.io_size = io_mask - 0x0000000001000000ull; - } else { - xf86Msg(X_WARNING, "Unknown PCI host bridge: \"%s\"\n", prop_val); - continue; - } - - /* Only map as much PCI configuration as we need */ - domain.pci = (char *)sparcMapAperture(-1, VIDMEM_MMIO, - pci_addr + PCI_MAKE_TAG(domain.bus_min, 0, 0), - PCI_MAKE_TAG(domain.bus_max - domain.bus_min + 1, 0, 0)) - - PCI_MAKE_TAG(domain.bus_min, 0, 0); - - /* Allocate a domain record */ - pDomain = xnfalloc(sizeof(sparcDomainRec)); - *pDomain = domain; - - /* - * Allocate and prime pciBusInfo records. These are allocated one at a - * time because those for empty buses are eventually released. - */ - bus = pDomain->bus_min = - PCI_MAKE_BUS(pciNumDomains, domain.bus_min); - pciNumBuses = pDomain->bus_max = - PCI_MAKE_BUS(pciNumDomains, domain.bus_max) + 1; - - pciBusInfo[bus] = xnfcalloc(1, sizeof(pciBusInfo_t)); - pciBusInfo[bus]->configMech = PCI_CFG_MECH_OTHER; - pciBusInfo[bus]->numDevices = 32; - pciBusInfo[bus]->funcs = pFunctions; - pciBusInfo[bus]->pciBusPriv = pDomain; - while (++bus < pciNumBuses) { - pciBusInfo[bus] = xnfalloc(sizeof(pciBusInfo_t)); - *(pciBusInfo[bus]) = *(pciBusInfo[bus - 1]); - pciBusInfo[bus]->funcs = &sparcPCIFunctions; - } - - /* Next domain, please... */ - xf86DomainInfo[pciNumDomains++] = pDomain; - - /* - * OK, enough of the straight-forward stuff. Time to deal with some - * brokenness... - * - * The PCI specs require that when a bus transaction remains unclaimed - * for too long, the master entity on that bus is to cancel the - * transaction it issued or passed on with a master abort. Two - * outcomes are possible: - * - * - the master abort can be treated as an error that is propogated - * back through the bus tree to the entity that ultimately originated - * the transaction; or - * - the transaction can be allowed to complete normally, which means - * that writes are ignored and reads return all ones. - * - * In the first case, if the CPU happens to be at the tail end of the - * tree path through one of its host bridges, it will be told there is - * a hardware mal-function, despite being generated by software. - * - * For a software function (be it firmware, OS or userland application) - * to determine how a PCI bus tree is populated, it must be able to - * detect when master aborts occur. Obviously, PCI discovery is much - * simpler when master aborts are allowed to complete normally. - * - * Unfortunately, a number of non-Intel PCI implementations have chosen - * to treat master aborts as severe errors. The net effect is to - * cripple PCI discovery algorithms in userland. - * - * On SPARCs, master aborts cause a number of different behaviours, - * including delivering a signal to the userland application, rebooting - * the system, "dropping down" to firmware, or, worst of all, bus - * lockouts. Even in the first case, the SIGBUS signal that is - * eventually generated isn't delivered in a timely enough fashion to - * allow an application to reliably detect the master abort that - * ultimately caused it. - * - * This can be somewhat mitigated. On all architectures, master aborts - * that occur on secondary buses can be forced to complete normally - * because the PCI-to-PCI bridges that serve them are governed by an - * industry-wide specification. (This is just another way of saying - * that whatever justification there might be for erroring out master - * aborts is deemed by the industry as insufficient to generate more - * PCI non-compliance than there already is...) - * - * This leaves us with master aborts that occur on primary buses. - * There is no specification for host-to-PCI bridges. Bridges used in - * SPARCs can be told to ignore all PCI errors, but not specifically - * master aborts. Not only is this too coarse-grained, but - * master-aborted read transactions on the primary bus end up returning - * garbage rather than all ones. - * - * I have elected to work around this the only way I can think of doing - * so right now. The following scans an additional PROM level and - * builds a device/function map for the primary bus. I can only hope - * this PROM information represents all devices on the primary bus, - * rather than only a subset of them. - * - * Master aborts are useful in other ways too, that are not addressed - * here. These include determining whether or not a domain provides - * VGA, or if a PCI device actually implements PCI disablement. - * - * --- TSI @ UQV 2001.09.19 - */ - for (node2 = promGetChild(node); - node2; - node2 = promGetSibling(node2)) { - /* Get "reg" property */ - prop_val = promGetProperty("reg", &prop_len); - if (!prop_val || (prop_len % 20)) - continue; - - /* - * It's unnecessary to scan the entire "reg" property, but I'll do - * so anyway. - */ - prop_len /= 20; - for (; prop_len--; prop_val += 20) - SetBitInMap(PCI_DFN_FROM_TAG(*(PCITAG *)prop_val), - pDomain->dfn_mask); - } - - /* Assume the host bridge is device 0, function 0 on its bus */ - SetBitInMap(0, pDomain->dfn_mask); - } - - sparcPromClose(); - - close(apertureFd); - apertureFd = -1; -} - -#ifndef INCLUDE_XF86_NO_DOMAIN - -int -xf86GetPciDomain(PCITAG Tag) -{ - return PCI_DOM_FROM_TAG(Tag); -} - -pointer -xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, - ADDRESS Base, unsigned long Size) -{ - sparcDomainPtr pDomain; - pointer result; - int domain = PCI_DOM_FROM_TAG(Tag); - - if ((domain <= 0) || (domain >= pciNumDomains) || - !(pDomain = xf86DomainInfo[domain]) || - (((unsigned long long)Base + (unsigned long long)Size) > - pDomain->mem_size)) - FatalError("xf86MapDomainMemory() called with invalid parameters.\n"); - - result = sparcMapAperture(ScreenNum, Flags, pDomain->mem_addr + Base, Size); - - if (apertureFd >= 0) { - close(apertureFd); - apertureFd = -1; - } - - return result; -} - -IOADDRESS -xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag, - IOADDRESS Base, unsigned long Size) -{ - sparcDomainPtr pDomain; - int domain = PCI_DOM_FROM_TAG(Tag); - - if ((domain <= 0) || (domain >= pciNumDomains) || - !(pDomain = xf86DomainInfo[domain]) || - (((unsigned long long)Base + (unsigned long long)Size) > - pDomain->io_size)) - FatalError("xf86MapDomainIO() called with invalid parameters.\n"); - - /* Permanently map all of I/O space */ - if (!pDomain->io) { - pDomain->io = sparcMapAperture(ScreenNum, Flags, - pDomain->io_addr, pDomain->io_size); - - if (apertureFd >= 0) { - close(apertureFd); - apertureFd = -1; - } - } - - return (IOADDRESS)pDomain->io + Base; -} - -int -xf86ReadDomainMemory(PCITAG Tag, ADDRESS Base, int Len, unsigned char *Buf) -{ - unsigned char *ptr, *src; - ADDRESS offset; - unsigned long size; - int len; - - /* Ensure page boundaries */ - offset = Base & ~pagemask; - size = ((Base + Len + pagemask) & ~pagemask) - offset; - - ptr = xf86MapDomainMemory(-1, VIDMEM_READONLY, Tag, offset, size); - - /* Using memcpy() here hangs the system */ - src = ptr + (Base - offset); - for (len = Len; len-- > 0;) - *Buf++ = *src++; - - xf86UnMapVidMem(-1, ptr, size); - - return Len; -} - -resPtr -xf86BusAccWindowsFromOS(void) -{ - sparcDomainPtr pDomain; - resPtr pRes = NULL; - resRange range; - int domain; - - for (domain = 1; domain < pciNumDomains; domain++) { - if (!(pDomain = xf86DomainInfo[domain])) - continue; - - RANGE(range, 0, pDomain->mem_size - 1, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - - RANGE(range, 0, pDomain->io_size - 1, - RANGE_TYPE(ResExcIoBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - } - - return pRes; -} - -resPtr -xf86PciBusAccWindowsFromOS(void) -{ - sparcDomainPtr pDomain; - resPtr pRes = NULL; - resRange range; - int domain; - - for (domain = 1; domain < pciNumDomains; domain++) { - if (!(pDomain = xf86DomainInfo[domain])) - continue; - - RANGE(range, 0, pDomain->mem_size - 1, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - - RANGE(range, 0, pDomain->io_size - 1, - RANGE_TYPE(ResExcIoBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - } - - return pRes; -} - -resPtr -xf86AccResFromOS(resPtr pRes) -{ - sparcDomainPtr pDomain; - resRange range; - int domain; - - for (domain = 1; domain < pciNumDomains; domain++) { - if (!(pDomain = xf86DomainInfo[domain])) - continue; - - /* - * At minimum, the top and bottom resources must be claimed, so that - * resources that are (or appear to be) unallocated can be relocated. - */ - RANGE(range, 0x00000000u, 0x0009ffffu, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - RANGE(range, 0x000c0000u, 0x000effffu, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - RANGE(range, 0x000f0000u, 0x000fffffu, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - - RANGE(range, pDomain->mem_size - 1, pDomain->mem_size - 1, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - - RANGE(range, 0x00000000u, 0x00000000u, - RANGE_TYPE(ResExcIoBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - RANGE(range, pDomain->io_size - 1, pDomain->io_size - 1, - RANGE_TYPE(ResExcIoBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - } - - return pRes; -} - -#endif /* !INCLUDE_XF86_NO_DOMAIN */ - -#endif /* defined(sun) */ - -#if defined(ARCH_PCI_PCI_BRIDGE) - -/* Definitions specific to Sun's APB P2P bridge (a.k.a. Simba) */ -#define APB_IO_ADDRESS_MAP 0xDE -#define APB_MEM_ADDRESS_MAP 0xDF - -/* - * Simba's can only occur on bus 0. Furthermore, Simba's must have a non-zero - * device/function number because the Sabre interface they must connect to - * occupies the 0:0:0 slot. Also, there can be only one Sabre interface in the - * system, and therefore, only one Simba function can route any particular - * resource. Thus, it is appropriate to use a single set of static variables - * to hold the tag of the Simba function routing a VGA resource range at any - * one time, and to test these variables for non-zero to determine whether or - * not the Sabre would master-abort a VGA access (and kill the system). - * - * The trick is to determine when it is safe to re-route VGA, because doing so - * re-routes much more. - */ -static PCITAG simbavgaIOTag = 0, simbavgaMemTag = 0; -static Bool simbavgaRoutingAllow = TRUE; - -/* - * Scan the bus subtree rooted at 'bus' for a non-display device that might be - * decoding the bottom 2 MB of I/O space and/or the bottom 512 MB of memory - * space. Reset simbavgaRoutingAllow if such a device is found. - * - * XXX For now, this is very conservative and should be made less so as the - * need arises. - */ -static void -simbaCheckBus(CARD16 pcicommand, int bus) -{ - pciConfigPtr pPCI, *ppPCI = xf86scanpci(0); - - while ((pPCI = *ppPCI++)) { - if (pPCI->busnum < bus) - continue; - if (pPCI->busnum > bus) - break; - - /* XXX Assume all devices respect PCI disablement */ - if (!(pcicommand & pPCI->pci_command)) - continue; - - /* XXX This doesn't deal with mis-advertised classes */ - switch (pPCI->pci_base_class) { - case PCI_CLASS_PREHISTORIC: - if (pPCI->pci_sub_class == PCI_SUBCLASS_PREHISTORIC_VGA) - continue; /* Ignore VGA */ - break; - - case PCI_CLASS_DISPLAY: - continue; - - case PCI_CLASS_BRIDGE: - switch (pPCI->pci_sub_class) { - case PCI_SUBCLASS_BRIDGE_PCI: - case PCI_SUBCLASS_BRIDGE_CARDBUS: - /* Scan secondary bus */ - /* XXX First check bridge routing? */ - simbaCheckBus(pcicommand & pPCI->pci_command, - PCI_SECONDARY_BUS_EXTRACT(pPCI->pci_pp_bus_register, - pPCI->tag)); - if (!simbavgaRoutingAllow) - return; - - default: - break; - } - - default: - break; - } - - /* - * XXX We could check the device's bases here, but PCI doesn't limit - * the device's decoding to them. - */ - - simbavgaRoutingAllow = FALSE; - break; - } -} - -static pciConfigPtr -simbaVerifyBus(int bus) -{ - pciConfigPtr pPCI; - if ((bus < 0) || (bus >= pciNumBuses) || - !pciBusInfo[bus] || !(pPCI = pciBusInfo[bus]->bridge) || - (pPCI->pci_device_vendor != DEVID(VENDOR_SUN, CHIP_SIMBA))) - return NULL; - - return pPCI; -} - -static CARD16 -simbaControlBridge(int bus, CARD16 mask, CARD16 value) -{ - pciConfigPtr pPCI; - CARD16 current = 0, tmp; - CARD8 iomap, memmap; - - if ((pPCI = simbaVerifyBus(bus))) { - /* - * The Simba does not implement VGA enablement as described in the P2P - * spec. It does however route I/O and memory in large enough chunks - * so that we can determine were VGA resources would be routed - * (including ISA VGA I/O aliases). We can allow changes to that - * routing only under certain circumstances. - */ - iomap = pciReadByte(pPCI->tag, APB_IO_ADDRESS_MAP); - memmap = pciReadByte(pPCI->tag, APB_MEM_ADDRESS_MAP); - if (iomap & memmap & 0x01) { - current |= PCI_PCI_BRIDGE_VGA_EN; - if ((mask & PCI_PCI_BRIDGE_VGA_EN) && - !(value & PCI_PCI_BRIDGE_VGA_EN)) { - if (!simbavgaRoutingAllow) { - xf86MsgVerb(X_WARNING, 3, "Attempt to disable VGA routing" - " through Simba at %x:%x:%x disallowed.\n", - pPCI->busnum, pPCI->devnum, pPCI->funcnum); - value |= PCI_PCI_BRIDGE_VGA_EN; - } else { - pciWriteByte(pPCI->tag, APB_IO_ADDRESS_MAP, - iomap & ~0x01); - pciWriteByte(pPCI->tag, APB_MEM_ADDRESS_MAP, - memmap & ~0x01); - simbavgaIOTag = simbavgaMemTag = 0; - } - } - } else { - if (mask & value & PCI_PCI_BRIDGE_VGA_EN) { - if (!simbavgaRoutingAllow) { - xf86MsgVerb(X_WARNING, 3, "Attempt to enable VGA routing" - " through Simba at %x:%x:%x disallowed.\n", - pPCI->busnum, pPCI->devnum, pPCI->funcnum); - value &= ~PCI_PCI_BRIDGE_VGA_EN; - } else { - if (pPCI->tag != simbavgaIOTag) { - if (simbavgaIOTag) { - tmp = pciReadByte(simbavgaIOTag, - APB_IO_ADDRESS_MAP); - pciWriteByte(simbavgaIOTag, APB_IO_ADDRESS_MAP, - tmp & ~0x01); - } - - pciWriteByte(pPCI->tag, APB_IO_ADDRESS_MAP, - iomap | 0x01); - simbavgaIOTag = pPCI->tag; - } - - if (pPCI->tag != simbavgaMemTag) { - if (simbavgaMemTag) { - tmp = pciReadByte(simbavgaMemTag, - APB_MEM_ADDRESS_MAP); - pciWriteByte(simbavgaMemTag, APB_MEM_ADDRESS_MAP, - tmp & ~0x01); - } - - pciWriteByte(pPCI->tag, APB_MEM_ADDRESS_MAP, - memmap | 0x01); - simbavgaMemTag = pPCI->tag; - } - } - } - } - - /* Move on to master abort failure enablement (as per P2P spec) */ - tmp = pciReadWord(pPCI->tag, PCI_PCI_BRIDGE_CONTROL_REG); - current |= tmp; - if (tmp & PCI_PCI_BRIDGE_MASTER_ABORT_EN) { - if ((mask & PCI_PCI_BRIDGE_MASTER_ABORT_EN) && - !(value & PCI_PCI_BRIDGE_MASTER_ABORT_EN)) - pciWriteWord(pPCI->tag, PCI_PCI_BRIDGE_CONTROL_REG, - tmp & ~PCI_PCI_BRIDGE_MASTER_ABORT_EN); - } else { - if (mask & value & PCI_PCI_BRIDGE_MASTER_ABORT_EN) - pciWriteWord(pPCI->tag, PCI_PCI_BRIDGE_CONTROL_REG, - tmp | PCI_PCI_BRIDGE_MASTER_ABORT_EN); - } - - /* Insert emulation of other P2P controls here */ - } - - return (current & ~mask) | (value & mask); -} - -static void -simbaGetBridgeResources(int bus, - pointer *ppIoRes, - pointer *ppMemRes, - pointer *ppPmemRes) -{ - pciConfigPtr pPCI = simbaVerifyBus(bus); - resRange range; - int i; - - if (!pPCI) - return; - - if (ppIoRes) { - xf86FreeResList(*ppIoRes); - *ppIoRes = NULL; - - if (pPCI->pci_command & PCI_CMD_IO_ENABLE) { - unsigned char iomap = pciReadByte(pPCI->tag, APB_IO_ADDRESS_MAP); - if (simbavgaRoutingAllow) - iomap |= 0x01; - for (i = 0; i < 8; i++) { - if (iomap & (1 << i)) { - RANGE(range, i << 21, ((i + 1) << 21) - 1, - RANGE_TYPE(ResExcIoBlock, - xf86GetPciDomain(pPCI->tag))); - *ppIoRes = xf86AddResToList(*ppIoRes, &range, -1); - } - } - } - } - - if (ppMemRes) { - xf86FreeResList(*ppMemRes); - *ppMemRes = NULL; - - if (pPCI->pci_command & PCI_CMD_MEM_ENABLE) { - unsigned char memmap = pciReadByte(pPCI->tag, APB_MEM_ADDRESS_MAP); - if (simbavgaRoutingAllow) - memmap |= 0x01; - for (i = 0; i < 8; i++) { - if (memmap & (1 << i)) { - RANGE(range, i << 29, ((i + 1) << 29) - 1, - RANGE_TYPE(ResExcMemBlock, - xf86GetPciDomain(pPCI->tag))); - *ppMemRes = xf86AddResToList(*ppMemRes, &range, -1); - } - } - } - } - - if (ppPmemRes) { - xf86FreeResList(*ppPmemRes); - *ppPmemRes = NULL; - } -} - -void ARCH_PCI_PCI_BRIDGE(pciConfigPtr pPCI) -{ - static pciBusFuncs_t simbaBusFuncs; - pciBusInfo_t *pBusInfo; - CARD16 pcicommand; - - if (pPCI->pci_device_vendor != DEVID(VENDOR_SUN, CHIP_SIMBA)) - return; - - pBusInfo = pPCI->businfo; - - simbaBusFuncs = *(pBusInfo->funcs); - simbaBusFuncs.pciControlBridge = simbaControlBridge; - simbaBusFuncs.pciGetBridgeResources = simbaGetBridgeResources; - - pBusInfo->funcs = &simbaBusFuncs; - - if (!simbavgaRoutingAllow) - return; - - pcicommand = 0; - - if (pciReadByte(pPCI->tag, APB_IO_ADDRESS_MAP) & 0x01) { - pcicommand |= PCI_CMD_IO_ENABLE; - simbavgaIOTag = pPCI->tag; - } - - if (pciReadByte(pPCI->tag, APB_MEM_ADDRESS_MAP) & 0x01) { - pcicommand |= PCI_CMD_MEM_ENABLE; - simbavgaMemTag = pPCI->tag; - } - - if (!pcicommand) - return; - - simbaCheckBus(pcicommand, - PCI_SECONDARY_BUS_EXTRACT(pPCI->pci_pp_bus_register, pPCI->tag)); -} - -#endif /* defined(ARCH_PCI_PCI_BRIDGE) */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h deleted file mode 100644 index a8b7ef492..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h +++ /dev/null @@ -1,807 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h,v 1.39 2003/08/24 17:37:05 dawes Exp $ */ -/* - * Copyright 1998 by Concurrent Computer Corporation - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Concurrent Computer - * Corporation not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Concurrent Computer Corporation makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * Copyright 1998 by Metro Link Incorporated - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * This file is derived in part from the original xf86_PCI.h that included - * following copyright message: - * - * Copyright 1995 by Robin Cutshaw - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of the above listed copyright holder(s) - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. The above listed - * copyright holder(s) make(s) no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* - * Copyright (c) 1999-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - - -/* - * This file contains just the public interface to the PCI code. - * Drivers should use this file rather than Pci.h. - */ - -#ifndef _XF86PCI_H -#define _XF86PCI_H 1 -#include -#include -#include "misc.h" - -#define PCI_NOT_FOUND 0xFFFFFFFFU - -/* - * PCI cfg space definitions (e.g. stuff right out of the PCI spec) - */ - -/* Device identification register */ -#define PCI_ID_REG 0x00 - -/* Command and status register */ -#define PCI_CMD_STAT_REG 0x04 -#define PCI_CMD_BASE_REG 0x10 -#define PCI_CMD_BIOS_REG 0x30 -#define PCI_CMD_MASK 0xffff -#define PCI_CMD_IO_ENABLE 0x01 -#define PCI_CMD_MEM_ENABLE 0x02 -#define PCI_CMD_MASTER_ENABLE 0x04 -#define PCI_CMD_SPECIAL_ENABLE 0x08 -#define PCI_CMD_INVALIDATE_ENABLE 0x10 -#define PCI_CMD_PALETTE_ENABLE 0x20 -#define PCI_CMD_PARITY_ENABLE 0x40 -#define PCI_CMD_STEPPING_ENABLE 0x80 -#define PCI_CMD_SERR_ENABLE 0x100 -#define PCI_CMD_BACKTOBACK_ENABLE 0x200 -#define PCI_CMD_BIOS_ENABLE 0x01 - -/* base class */ -#define PCI_CLASS_REG 0x08 -#define PCI_CLASS_MASK 0xff000000 -#define PCI_CLASS_SHIFT 24 -#define PCI_CLASS_EXTRACT(x) \ - (((x) & PCI_CLASS_MASK) >> PCI_CLASS_SHIFT) - -/* base class values */ -#define PCI_CLASS_PREHISTORIC 0x00 -#define PCI_CLASS_MASS_STORAGE 0x01 -#define PCI_CLASS_NETWORK 0x02 -#define PCI_CLASS_DISPLAY 0x03 -#define PCI_CLASS_MULTIMEDIA 0x04 -#define PCI_CLASS_MEMORY 0x05 -#define PCI_CLASS_BRIDGE 0x06 -#define PCI_CLASS_COMMUNICATIONS 0x07 -#define PCI_CLASS_SYSPERIPH 0x08 -#define PCI_CLASS_INPUT 0x09 -#define PCI_CLASS_DOCKING 0x0a -#define PCI_CLASS_PROCESSOR 0x0b -#define PCI_CLASS_SERIALBUS 0x0c -#define PCI_CLASS_WIRELESS 0x0d -#define PCI_CLASS_I2O 0x0e -#define PCI_CLASS_SATELLITE 0x0f -#define PCI_CLASS_CRYPT 0x10 -#define PCI_CLASS_DATA_ACQUISTION 0x11 -#define PCI_CLASS_UNDEFINED 0xff - -/* sub class */ -#define PCI_SUBCLASS_MASK 0x00ff0000 -#define PCI_SUBCLASS_SHIFT 16 -#define PCI_SUBCLASS_EXTRACT(x) \ - (((x) & PCI_SUBCLASS_MASK) >> PCI_SUBCLASS_SHIFT) - -/* Sub class values */ -/* 0x00 prehistoric subclasses */ -#define PCI_SUBCLASS_PREHISTORIC_MISC 0x00 -#define PCI_SUBCLASS_PREHISTORIC_VGA 0x01 - -/* 0x01 mass storage subclasses */ -#define PCI_SUBCLASS_MASS_STORAGE_SCSI 0x00 -#define PCI_SUBCLASS_MASS_STORAGE_IDE 0x01 -#define PCI_SUBCLASS_MASS_STORAGE_FLOPPY 0x02 -#define PCI_SUBCLASS_MASS_STORAGE_IPI 0x03 -#define PCI_SUBCLASS_MASS_STORAGE_MISC 0x80 - -/* 0x02 network subclasses */ -#define PCI_SUBCLASS_NETWORK_ETHERNET 0x00 -#define PCI_SUBCLASS_NETWORK_TOKENRING 0x01 -#define PCI_SUBCLASS_NETWORK_FDDI 0x02 -#define PCI_SUBCLASS_NETWORK_MISC 0x80 - -/* 0x03 display subclasses */ -#define PCI_SUBCLASS_DISPLAY_VGA 0x00 -#define PCI_SUBCLASS_DISPLAY_XGA 0x01 -#define PCI_SUBCLASS_DISPLAY_MISC 0x80 - -/* 0x04 multimedia subclasses */ -#define PCI_SUBCLASS_MULTIMEDIA_VIDEO 0x00 -#define PCI_SUBCLASS_MULTIMEDIA_AUDIO 0x01 -#define PCI_SUBCLASS_MULTIMEDIA_MISC 0x80 - -/* 0x05 memory subclasses */ -#define PCI_SUBCLASS_MEMORY_RAM 0x00 -#define PCI_SUBCLASS_MEMORY_FLASH 0x01 -#define PCI_SUBCLASS_MEMORY_MISC 0x80 - -/* 0x06 bridge subclasses */ -#define PCI_SUBCLASS_BRIDGE_HOST 0x00 -#define PCI_SUBCLASS_BRIDGE_ISA 0x01 -#define PCI_SUBCLASS_BRIDGE_EISA 0x02 -#define PCI_SUBCLASS_BRIDGE_MC 0x03 -#define PCI_SUBCLASS_BRIDGE_PCI 0x04 -#define PCI_SUBCLASS_BRIDGE_PCMCIA 0x05 -#define PCI_SUBCLASS_BRIDGE_NUBUS 0x06 -#define PCI_SUBCLASS_BRIDGE_CARDBUS 0x07 -#define PCI_SUBCLASS_BRIDGE_RACEWAY 0x08 -#define PCI_SUBCLASS_BRIDGE_MISC 0x80 -#define PCI_IF_BRIDGE_PCI_SUBTRACTIVE 0x01 - -/* 0x07 communications controller subclasses */ -#define PCI_SUBCLASS_COMMUNICATIONS_SERIAL 0x00 -#define PCI_SUBCLASS_COMMUNICATIONS_PARALLEL 0x01 -#define PCI_SUBCLASS_COMMUNICATIONS_MULTISERIAL 0x02 -#define PCI_SUBCLASS_COMMUNICATIONS_MODEM 0x03 -#define PCI_SUBCLASS_COMMUNICATIONS_MISC 0x80 - -/* 0x08 generic system peripherals subclasses */ -#define PCI_SUBCLASS_SYSPERIPH_PIC 0x00 -#define PCI_SUBCLASS_SYSPERIPH_DMA 0x01 -#define PCI_SUBCLASS_SYSPERIPH_TIMER 0x02 -#define PCI_SUBCLASS_SYSPERIPH_RTC 0x03 -#define PCI_SUBCLASS_SYSPERIPH_HOTPCI 0x04 -#define PCI_SUBCLASS_SYSPERIPH_MISC 0x80 - -/* 0x09 input device subclasses */ -#define PCI_SUBCLASS_INPUT_KEYBOARD 0x00 -#define PCI_SUBCLASS_INPUT_DIGITIZER 0x01 -#define PCI_SUBCLASS_INPUT_MOUSE 0x02 -#define PCI_SUBCLASS_INPUT_SCANNER 0x03 -#define PCI_SUBCLASS_INPUT_GAMEPORT 0x04 -#define PCI_SUBCLASS_INPUT_MISC 0x80 - -/* 0x0a docking station subclasses */ -#define PCI_SUBCLASS_DOCKING_GENERIC 0x00 -#define PCI_SUBCLASS_DOCKING_MISC 0x80 - -/* 0x0b processor subclasses */ -#define PCI_SUBCLASS_PROCESSOR_386 0x00 -#define PCI_SUBCLASS_PROCESSOR_486 0x01 -#define PCI_SUBCLASS_PROCESSOR_PENTIUM 0x02 -#define PCI_SUBCLASS_PROCESSOR_ALPHA 0x10 -#define PCI_SUBCLASS_PROCESSOR_POWERPC 0x20 -#define PCI_SUBCLASS_PROCESSOR_MIPS 0x30 -#define PCI_SUBCLASS_PROCESSOR_COPROC 0x40 - -/* 0x0c serial bus controller subclasses */ -#define PCI_SUBCLASS_SERIAL_FIREWIRE 0x00 -#define PCI_SUBCLASS_SERIAL_ACCESS 0x01 -#define PCI_SUBCLASS_SERIAL_SSA 0x02 -#define PCI_SUBCLASS_SERIAL_USB 0x03 -#define PCI_SUBCLASS_SERIAL_FIBRECHANNEL 0x04 -#define PCI_SUBCLASS_SERIAL_SMBUS 0x05 - -/* 0x0d wireless controller subclasses */ -#define PCI_SUBCLASS_WIRELESS_IRDA 0x00 -#define PCI_SUBCLASS_WIRELESS_CONSUMER_IR 0x01 -#define PCI_SUBCLASS_WIRELESS_RF 0x02 -#define PCI_SUBCLASS_WIRELESS_MISC 0x80 - -/* 0x0e intelligent I/O controller subclasses */ -#define PCI_SUBCLASS_I2O_I2O 0x00 - -/* 0x0f satellite communications controller subclasses */ -#define PCI_SUBCLASS_SATELLITE_TV 0x01 -#define PCI_SUBCLASS_SATELLITE_AUDIO 0x02 -#define PCI_SUBCLASS_SATELLITE_VOICE 0x03 -#define PCI_SUBCLASS_SATELLITE_DATA 0x04 - -/* 0x10 encryption/decryption controller subclasses */ -#define PCI_SUBCLASS_CRYPT_NET_COMPUTING 0x00 -#define PCI_SUBCLASS_CRYPT_ENTERTAINMENT 0x10 -#define PCI_SUBCLASS_CRYPT_MISC 0x80 - -/* 0x11 data acquisition and signal processing controller subclasses */ -#define PCI_SUBCLASS_DATAACQ_DPIO 0x00 -#define PCI_SUBCLASS_DATAACQ_MISC 0x80 - - -/* Header */ -#define PCI_HEADER_MISC 0x0c -#define PCI_HEADER_MULTIFUNCTION 0x00800000 - -/* Interrupt configration register */ -#define PCI_INTERRUPT_REG 0x3c -#define PCI_INTERRUPT_PIN_MASK 0x0000ff00 -#define PCI_INTERRUPT_PIN_EXTRACT(x) \ - ((((x) & PCI_INTERRUPT_PIN_MASK) >> 8) & 0xff) -#define PCI_INTERRUPT_PIN_NONE 0x00 -#define PCI_INTERRUPT_PIN_A 0x01 -#define PCI_INTERRUPT_PIN_B 0x02 -#define PCI_INTERRUPT_PIN_C 0x03 -#define PCI_INTERRUPT_PIN_D 0x04 - -#define PCI_INTERRUPT_LINE_MASK 0x000000ff -#define PCI_INTERRUPT_LINE_EXTRACT(x) \ - ((((x) & PCI_INTERRUPT_LINE_MASK) >> 0) & 0xff) -#define PCI_INTERRUPT_LINE_INSERT(x,v) \ - (((x) & ~PCI_INTERRUPT_LINE_MASK) | ((v) << 0)) - -/* Base registers */ -#define PCI_MAP_REG_START 0x10 -#define PCI_MAP_REG_END 0x28 -#define PCI_MAP_ROM_REG 0x30 - -#define PCI_MAP_MEMORY 0x00000000 -#define PCI_MAP_IO 0x00000001 - -#define PCI_MAP_MEMORY_TYPE 0x00000007 -#define PCI_MAP_IO_TYPE 0x00000003 - -#define PCI_MAP_MEMORY_TYPE_32BIT 0x00000000 -#define PCI_MAP_MEMORY_TYPE_32BIT_1M 0x00000002 -#define PCI_MAP_MEMORY_TYPE_64BIT 0x00000004 -#define PCI_MAP_MEMORY_TYPE_MASK 0x00000006 -#define PCI_MAP_MEMORY_CACHABLE 0x00000008 -#define PCI_MAP_MEMORY_ATTR_MASK 0x0000000e -#define PCI_MAP_MEMORY_ADDRESS_MASK 0xfffffff0 - -#define PCI_MAP_IO_ATTR_MASK 0x00000003 - -#define PCI_MAP_IS_IO(b) ((b) & PCI_MAP_IO) -#define PCI_MAP_IS_MEM(b) (!PCI_MAP_IS_IO(b)) - -#define PCI_MAP_IS64BITMEM(b) \ - (((b) & PCI_MAP_MEMORY_TYPE) == PCI_MAP_MEMORY_TYPE_64BIT) - -#define PCIGETMEMORY(b) ((b) & PCI_MAP_MEMORY_ADDRESS_MASK) -#define PCIGETMEMORY64HIGH(b) (*((CARD32*)&(b) + 1)) -#define PCIGETMEMORY64(b) \ - (PCIGETMEMORY(b) | ((CARD64)PCIGETMEMORY64HIGH(b) << 32)) - -#define PCI_MAP_IO_ADDRESS_MASK 0xfffffffc - -#define PCIGETIO(b) ((b) & PCI_MAP_IO_ADDRESS_MASK) - -#define PCI_MAP_ROM_DECODE_ENABLE 0x00000001 -#define PCI_MAP_ROM_ADDRESS_MASK 0xfffff800 - -#define PCIGETROM(b) ((b) & PCI_MAP_ROM_ADDRESS_MASK) - -/* PCI-PCI bridge mapping registers */ -#define PCI_PCI_BRIDGE_BUS_REG 0x18 -#define PCI_SUBORDINATE_BUS_MASK 0x00ff0000 -#define PCI_SECONDARY_BUS_MASK 0x0000ff00 -#define PCI_PRIMARY_BUS_MASK 0x000000ff - -#define PCI_PCI_BRIDGE_IO_REG 0x1c -#define PCI_PCI_BRIDGE_MEM_REG 0x20 -#define PCI_PCI_BRIDGE_PMEM_REG 0x24 - -#define PCI_PPB_IOBASE_EXTRACT(x) (((x) << 8) & 0xFF00) -#define PCI_PPB_IOLIMIT_EXTRACT(x) (((x) << 0) & 0xFF00) - -#define PCI_PPB_MEMBASE_EXTRACT(x) (((x) << 16) & 0xFFFF0000) -#define PCI_PPB_MEMLIMIT_EXTRACT(x) (((x) << 0) & 0xFFFF0000) - -#define PCI_PCI_BRIDGE_CONTROL_REG 0x3E -#define PCI_PCI_BRIDGE_PARITY_EN 0x01 -#define PCI_PCI_BRIDGE_SERR_EN 0x02 -#define PCI_PCI_BRIDGE_ISA_EN 0x04 -#define PCI_PCI_BRIDGE_VGA_EN 0x08 -#define PCI_PCI_BRIDGE_MASTER_ABORT_EN 0x20 -#define PCI_PCI_BRIDGE_SECONDARY_RESET 0x40 -#define PCI_PCI_BRIDGE_FAST_B2B_EN 0x80 -/* header type 2 extensions */ -#define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 /* CardBus reset */ -#define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 /* Enable interrupt for 16-bit cards */ -#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 -#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200 -#define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400 - -#define PCI_CB_SEC_STATUS_REG 0x16 /* Secondary status */ -#define PCI_CB_PRIMARY_BUS_REG 0x18 /* PCI bus number */ -#define PCI_CB_CARD_BUS_REG 0x19 /* CardBus bus number */ -#define PCI_CB_SUBORDINATE_BUS_REG 0x1a /* Subordinate bus number */ -#define PCI_CB_LATENCY_TIMER_REG 0x1b /* CardBus latency timer */ -#define PCI_CB_MEM_BASE_0_REG 0x1c -#define PCI_CB_MEM_LIMIT_0_REG 0x20 -#define PCI_CB_MEM_BASE_1_REG 0x24 -#define PCI_CB_MEM_LIMIT_1_REG 0x28 -#define PCI_CB_IO_BASE_0_REG 0x2c -#define PCI_CB_IO_LIMIT_0_REG 0x30 -#define PCI_CB_IO_BASE_1_REG 0x34 -#define PCI_CB_IO_LIMIT_1_REG 0x38 -#define PCI_CB_BRIDGE_CONTROL_REG 0x3E - -#define PCI_CB_IO_RANGE_MASK ~0x03 -#define PCI_CB_IOBASE(x) (x & PCI_CB_IO_RANGE_MASK) -#define PCI_CB_IOLIMIT(x) ((x & PCI_CB_IO_RANGE_MASK) + 3) - -/* Subsystem identification register */ -#define PCI_SUBSYSTEM_ID_REG 0x2c - -/* User defined cfg space regs */ -#define PCI_REG_USERCONFIG 0x40 -#define PCI_OPTION_REG 0x40 - -/* - * Typedefs, etc... - */ - -/* Primitive Types */ -typedef unsigned long ADDRESS; /* Memory/PCI address */ -typedef unsigned long IOADDRESS; /* Must be large enough for a pointer */ -typedef unsigned long PCITAG; - -/* - * PCI configuration space - */ -typedef struct pci_cfg_regs { - /* start of official PCI config space header */ - union { /* Offset 0x0 - 0x3 */ - CARD32 device_vendor; - struct { -#if X_BYTE_ORDER == X_BIG_ENDIAN - CARD16 device; - CARD16 vendor; -#else - CARD16 vendor; - CARD16 device; -#endif - } dv; - } dv_id; - - union { /* Offset 0x4 - 0x8 */ - CARD32 status_command; - struct { -#if X_BYTE_ORDER == X_BIG_ENDIAN - CARD16 status; - CARD16 command; -#else - CARD16 command; - CARD16 status; -#endif - } sc; - } stat_cmd; - - union { /* Offset 0x8 - 0xb */ - CARD32 class_revision; - struct { -#if X_BYTE_ORDER == X_BIG_ENDIAN - CARD8 base_class; - CARD8 sub_class; - CARD8 prog_if; - CARD8 rev_id; -#else - CARD8 rev_id; - CARD8 prog_if; - CARD8 sub_class; - CARD8 base_class; -#endif - } cr; - } class_rev; - - union { /* Offset 0xc - 0xf */ - CARD32 bist_header_latency_cache; - struct { -#if X_BYTE_ORDER == X_BIG_ENDIAN - CARD8 bist; - CARD8 header_type; - CARD8 latency_timer; - CARD8 cache_line_size; -#else - CARD8 cache_line_size; - CARD8 latency_timer; - CARD8 header_type; - CARD8 bist; -#endif - } bhlc; - } bhlc; - union { /* Offset 0x10 - 0x3b */ - struct { /* header type 2 */ - CARD32 cg_rsrvd1; /* 0x10 */ -#if X_BYTE_ORDER == X_BIG_ENDIAN - CARD16 secondary_status; /* 0x16 */ - CARD16 cg_rsrvd2; /* 0x14 */ - - union { - CARD32 cg_bus_reg; - struct { - CARD8 latency_timer; /* 0x1b */ - CARD8 subordinate_bus_number; /* 0x1a */ - CARD8 cardbus_bus_number; /* 0x19 */ - CARD8 primary_bus_number; /* 0x18 */ - } cgbr; - } cgbr; -#else - CARD16 cg_rsrvd2; /* 0x14 */ - CARD16 secondary_status; /* 0x16 */ - - union { - CARD32 cg_bus_reg; - struct { - CARD8 primary_bus_number; /* 0x18 */ - CARD8 cardbus_bus_number; /* 0x19 */ - CARD8 subordinate_bus_number; /* 0x1a */ - CARD8 latency_timer; /* 0x1b */ - } cgbr; - } cgbr; -#endif - CARD32 mem_base0; /* 0x1c */ - CARD32 mem_limit0; /* 0x20 */ - CARD32 mem_base1; /* 0x24 */ - CARD32 mem_limit1; /* 0x28 */ - CARD32 io_base0; /* 0x2c */ - CARD32 io_limit0; /* 0x30 */ - CARD32 io_base1; /* 0x34 */ - CARD32 io_limit1; /* 0x38 */ - } cg; - struct { - union { /* Offset 0x10 - 0x27 */ - struct { /* header type 0 */ - CARD32 dv_base0; - CARD32 dv_base1; - CARD32 dv_base2; - CARD32 dv_base3; - CARD32 dv_base4; - CARD32 dv_base5; - } dv; - struct { /* header type 1 */ - CARD32 bg_rsrvd[2]; -#if X_BYTE_ORDER == X_BIG_ENDIAN - union { - CARD32 pp_bus_reg; - struct { - CARD8 secondary_latency_timer; - CARD8 subordinate_bus_number; - CARD8 secondary_bus_number; - CARD8 primary_bus_number; - } ppbr; - } ppbr; - - CARD16 secondary_status; - CARD8 io_limit; - CARD8 io_base; - - CARD16 mem_limit; - CARD16 mem_base; - - CARD16 prefetch_mem_limit; - CARD16 prefetch_mem_base; -#else - union { - CARD32 pp_bus_reg; - struct { - CARD8 primary_bus_number; - CARD8 secondary_bus_number; - CARD8 subordinate_bus_number; - CARD8 secondary_latency_timer; - } ppbr; - } ppbr; - - CARD8 io_base; - CARD8 io_limit; - CARD16 secondary_status; - - CARD16 mem_base; - CARD16 mem_limit; - - CARD16 prefetch_mem_base; - CARD16 prefetch_mem_limit; -#endif - } bg; - } bc; - union { /* Offset 0x28 - 0x2b */ - CARD32 rsvd1; - CARD32 pftch_umem_base; - CARD32 cardbus_cis_ptr; - } um_c_cis; - union { /* Offset 0x2c - 0x2f */ - CARD32 subsys_card_vendor; - CARD32 pftch_umem_limit; - CARD32 rsvd2; - struct { -#if X_BYTE_ORDER == X_BIG_ENDIAN - CARD16 subsys_card; - CARD16 subsys_vendor; -#else - CARD16 subsys_vendor; - CARD16 subsys_card; -#endif - } ssys; - } um_ssys_id; - union { /* Offset 0x30 - 0x33 */ - CARD32 baserom; - struct { -#if X_BYTE_ORDER == X_BIG_ENDIAN - CARD16 io_ulimit; - CARD16 io_ubase; -#else - CARD16 io_ubase; - CARD16 io_ulimit; -#endif - } b_u_io; - } uio_rom; - struct { - CARD32 rsvd3; /* Offset 0x34 - 0x37 */ - CARD32 rsvd4; /* Offset 0x38 - 0x3b */ - } rsvd; - } cd; - } cx; - union { /* Offset 0x3c - 0x3f */ - union { /* header type 0 */ - CARD32 max_min_ipin_iline; - struct { -#if X_BYTE_ORDER == X_BIG_ENDIAN - CARD8 max_lat; - CARD8 min_gnt; - CARD8 int_pin; - CARD8 int_line; -#else - CARD8 int_line; - CARD8 int_pin; - CARD8 min_gnt; - CARD8 max_lat; -#endif - } mmii; - } mmii; - struct { /* header type 1 */ -#if X_BYTE_ORDER == X_BIG_ENDIAN - CARD16 bridge_control; /* upper 8 bits reserved */ - CARD8 rsvd2; - CARD8 rsvd1; -#else - CARD8 rsvd1; - CARD8 rsvd2; - CARD16 bridge_control; /* upper 8 bits reserved */ -#endif - } bctrl; - } bm; - union { /* Offset 0x40 - 0xff */ - CARD32 dwords[48]; - CARD8 bytes[192]; - } devspf; -} pciCfgRegs; - -typedef union pci_cfg_spc { - pciCfgRegs regs; - CARD32 dwords[256/sizeof(CARD32)]; - CARD8 bytes[256/sizeof(CARD8)]; -} pciCfgSpc; - -/* - * Data structure returned by xf86scanpci including contents of - * PCI config space header - */ -typedef struct pci_device { - PCITAG tag; - int busnum; - int devnum; - int funcnum; - pciCfgSpc cfgspc; - int basesize[7]; /* number of bits in base addr allocations */ - Bool minBasesize; - CARD32 listed_class; - pointer businfo; /* pointer to secondary's bus info structure */ - Bool fakeDevice; /* Device added by system chipset support */ -} pciDevice, *pciConfigPtr; - -typedef enum { - PCI_MEM, - PCI_MEM_SIZE, - PCI_MEM_SPARSE_BASE, - PCI_MEM_SPARSE_MASK, - PCI_IO, - PCI_IO_SIZE, - PCI_IO_SPARSE_BASE, - PCI_IO_SPARSE_MASK -} PciAddrType; - -#define pci_device_vendor cfgspc.regs.dv_id.device_vendor -#define pci_vendor cfgspc.regs.dv_id.dv.vendor -#define pci_device cfgspc.regs.dv_id.dv.device -#define pci_status_command cfgspc.regs.stat_cmd.status_command -#define pci_command cfgspc.regs.stat_cmd.sc.command -#define pci_status cfgspc.regs.stat_cmd.sc.status -#define pci_class_revision cfgspc.regs.class_rev.class_revision -#define pci_rev_id cfgspc.regs.class_rev.cr.rev_id -#define pci_prog_if cfgspc.regs.class_rev.cr.prog_if -#define pci_sub_class cfgspc.regs.class_rev.cr.sub_class -#define pci_base_class cfgspc.regs.class_rev.cr.base_class -#define pci_bist_header_latency_cache cfgspc.regs.bhlc.bist_header_latency_cache -#define pci_cache_line_size cfgspc.regs.bhlc.bhlc.cache_line_size -#define pci_latency_timer cfgspc.regs.bhlc.bhlc.latency_timer -#define pci_header_type cfgspc.regs.bhlc.bhlc.header_type -#define pci_bist cfgspc.regs.bhlc.bhlc.bist -#define pci_cb_secondary_status cfgspc.regs.cx.cg.secondary_status -#define pci_cb_bus_register cfgspc.regs.cx.cg.cgbr.cg_bus_reg -#define pci_cb_primary_bus_number cfgspc.regs.cx.cg.cgbr.cgbr.primary_bus_number -#define pci_cb_cardbus_bus_number cfgspc.regs.cx.cg.cgbr.cgbr.cardbus_bus_number -#define pci_cb_subordinate_bus_number cfgspc.regs.cx.cg.cgbr.cgbr.subordinate_bus_number -#define pci_cb_latency_timer cfgspc.regs.cx.cg.cgbr.cgbr.latency_timer -#define pci_cb_membase0 cfgspc.regs.cx.cg.mem_base0 -#define pci_cb_memlimit0 cfgspc.regs.cx.cg.mem_limit0 -#define pci_cb_membase1 cfgspc.regs.cx.cg.mem_base1 -#define pci_cb_memlimit1 cfgspc.regs.cx.cg.mem_limit1 -#define pci_cb_iobase0 cfgspc.regs.cx.cg.io_base0 -#define pci_cb_iolimit0 cfgspc.regs.cx.cg.io_limit0 -#define pci_cb_iobase1 cfgspc.regs.cx.cg.io_base1 -#define pci_cb_iolimit1 cfgspc.regs.cx.cg.io_limit1 -#define pci_base0 cfgspc.regs.cx.cd.bc.dv.dv_base0 -#define pci_base1 cfgspc.regs.cx.cd.bc.dv.dv_base1 -#define pci_base2 cfgspc.regs.cx.cd.bc.dv.dv_base2 -#define pci_base3 cfgspc.regs.cx.cd.bc.dv.dv_base3 -#define pci_base4 cfgspc.regs.cx.cd.bc.dv.dv_base4 -#define pci_base5 cfgspc.regs.cx.cd.bc.dv.dv_base5 -#define pci_cardbus_cis_ptr cfgspc.regs.cx.cd.umem_c_cis.cardbus_cis_ptr -#define pci_subsys_card_vendor cfgspc.regs.cx.cd.um_ssys_id.subsys_card_vendor -#define pci_subsys_vendor cfgspc.regs.cx.cd.um_ssys_id.ssys.subsys_vendor -#define pci_subsys_card cfgspc.regs.cx.cd.um_ssys_id.ssys.subsys_card -#define pci_baserom cfgspc.regs.cx.cd.uio_rom.baserom -#define pci_pp_bus_register cfgspc.regs.cx.cd.bc.bg.ppbr.pp_bus_reg -#define pci_primary_bus_number cfgspc.regs.cx.cd.bc.bg.ppbr.ppbr.primary_bus_number -#define pci_secondary_bus_number cfgspc.regs.cx.cd.bc.bg.ppbr.ppbr.secondary_bus_number -#define pci_subordinate_bus_number cfgspc.regs.cx.cd.bc.bg.ppbr.ppbr.subordinate_bus_number -#define pci_secondary_latency_timer cfgspc.regs.cx.cd.bc.bg.ppbr.ppbr.secondary_latency_timer -#define pci_io_base cfgspc.regs.cx.cd.bc.bg.io_base -#define pci_io_limit cfgspc.regs.cx.cd.bc.bg.io_limit -#define pci_secondary_status cfgspc.regs.cx.cd.bc.bg.secondary_status -#define pci_mem_base cfgspc.regs.cx.cd.bc.bg.mem_base -#define pci_mem_limit cfgspc.regs.cx.cd.bc.bg.mem_limit -#define pci_prefetch_mem_base cfgspc.regs.cx.cd.bc.bg.prefetch_mem_base -#define pci_prefetch_mem_limit cfgspc.regs.cx.cd.bc.bg.prefetch_mem_limit -#define pci_rsvd1 cfgspc.regs.cx.cd.um_c_cis.rsvd1 -#define pci_rsvd2 cfgspc.regs.cx.cd.um_ssys_id.rsvd2 -#define pci_prefetch_upper_mem_base cfgspc.regs.cx.cd.um_c_cis.pftch_umem_base -#define pci_prefetch_upper_mem_limit cfgspc.regs.cx.cd.um_ssys_id.pftch_umem_limit -#define pci_upper_io_base cfgspc.regs.cx.cd.uio_rom.b_u_io.io_ubase -#define pci_upper_io_limit cfgspc.regs.cx.cd.uio_rom.b_u_io.io_ulimit -#define pci_int_line cfgspc.regs.bm.mmii.mmii.int_line -#define pci_int_pin cfgspc.regs.bm.mmii.mmii.int_pin -#define pci_min_gnt cfgspc.regs.bm.mmii.mmii.min_gnt -#define pci_max_lat cfgspc.regs.bm.mmii.mmii.max_lat -#define pci_max_min_ipin_iline cfgspc.regs.bm.mmii.max_min_ipin_iline -#define pci_bridge_control cfgspc.regs.bm.bctrl.bridge_control -#define pci_user_config cfgspc.regs.devspf.dwords[0] -#define pci_user_config_0 cfgspc.regs.devspf.bytes[0] -#define pci_user_config_1 cfgspc.regs.devspf.bytes[1] -#define pci_user_config_2 cfgspc.regs.devspf.bytes[2] -#define pci_user_config_3 cfgspc.regs.devspf.bytes[3] - -typedef enum { - PCI_BIOS_PC = 0, - PCI_BIOS_OPEN_FIRMARE, - PCI_BIOS_HP_PA_RISC, - PCI_BIOS_OTHER -} PciBiosType; - -/* Public PCI access functions */ -void pciInit(void); -PCITAG pciFindFirst(CARD32 id, CARD32 mask); -PCITAG pciFindNext(void); -CARD32 pciReadLong(PCITAG tag, int offset); -CARD16 pciReadWord(PCITAG tag, int offset); -CARD8 pciReadByte(PCITAG tag, int offset); -void pciWriteLong(PCITAG tag, int offset, CARD32 val); -void pciWriteWord(PCITAG tag, int offset, CARD16 val); -void pciWriteByte(PCITAG tag, int offset, CARD8 val); -void pciSetBitsLong(PCITAG tag, int offset, CARD32 mask, CARD32 val); -void pciSetBitsByte(PCITAG tag, int offset, CARD8 mask, CARD8 val); -ADDRESS pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr); -ADDRESS pciHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr); -PCITAG pciTag(int busnum, int devnum, int funcnum); -int pciGetBaseSize(PCITAG tag, int indx, Bool destructive, Bool *min); -CARD32 pciCheckForBrokenBase(PCITAG tag,int basereg); -pointer xf86MapPciMem(int ScreenNum, int Flags, PCITAG Tag, - ADDRESS Base, unsigned long Size); -int xf86ReadPciBIOS(unsigned long Offset, PCITAG Tag, int basereg, - unsigned char *Buf, int Len); -int xf86ReadPciBIOSByType(unsigned long Offset, PCITAG Tag, - int basereg, unsigned char *Buf, - int Len, PciBiosType Type); -int xf86GetAvailablePciBIOSTypes(PCITAG Tag, int basereg, - PciBiosType *Buf); -pciConfigPtr *xf86scanpci(int flags); - -extern int pciNumBuses; - -/* Domain access functions. Some of these probably shouldn't be public */ -int xf86GetPciDomain(PCITAG tag); -pointer xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, - ADDRESS Base, unsigned long Size); -IOADDRESS xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag, - IOADDRESS Base, unsigned long Size); -int xf86ReadDomainMemory(PCITAG Tag, ADDRESS Base, int Len, - unsigned char *Buf); - -typedef enum { - ROM_BASE_PRESET = -2, - ROM_BASE_BIOS, - ROM_BASE_MEM0 = 0, - ROM_BASE_MEM1, - ROM_BASE_MEM2, - ROM_BASE_MEM3, - ROM_BASE_MEM4, - ROM_BASE_MEM5, - ROM_BASE_FIND -} romBaseSource; - -#endif /* _XF86PCI_H */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h deleted file mode 100644 index 21b05cba4..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Platform specific SBUS and OpenPROM access declarations. - * - * Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h,v 1.3 2001/04/20 17:02:43 tsi Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef _XF86_SBUS_H -#define _XF86_SBUS_H - -#if defined(linux) -#include -#include -#include -#include -#elif defined(SVR4) -#include -#include -#elif defined(__OpenBSD__) && defined(__sparc64__) -/* XXX */ -#elif defined(CSRG_BASED) -#if defined(__FreeBSD__) -#include -#include -#include -#else -#include -#endif -#else -#include -#endif - -#ifndef FBTYPE_SUNGP3 -#define FBTYPE_SUNGP3 -1 -#endif -#ifndef FBTYPE_MDICOLOR -#define FBTYPE_MDICOLOR -1 -#endif -#ifndef FBTYPE_SUNLEO -#define FBTYPE_SUNLEO -1 -#endif -#ifndef FBTYPE_TCXCOLOR -#define FBTYPE_TCXCOLOR -1 -#endif -#ifndef FBTYPE_CREATOR -#define FBTYPE_CREATOR -1 -#endif - -#endif /* _XF86_SBUS_H */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.c deleted file mode 100644 index 3d219c86f..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.c +++ /dev/null @@ -1,1133 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.c,v 1.8 2004/01/16 15:39:38 tsi Exp $ */ -/* - * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from the - * XFree86 Project. - */ - -/* - * This file contains the glue necessary for support of HP's ZX1 chipset. - * Keep in mind that this chipset is used in both Itanium2 and PA-RISC - * architectures. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "zx1PCI.h" -#include "xf86.h" -#include "xf86_OSlib.h" -#include "Pci.h" - -#define MIO_BASE 0xFED00000UL /* mio register base */ -#define MIO_SIZE 0x00002000UL /* 8k, minimum */ - -/* ZX1 mio register definitions */ -#define MIO_FUNCTION0 0x0000U - -#define MODULE_INFO 0x0100U -#define STATUS_CONTROL 0x0108U -#define DILLON_PRESENT 0x02UL - -#define LMMIO_DIR_BASE0 0x0300U -#define LMMIO_DIR_MASK0 0x0308U -#define LMMIO_DIR_ROUTE0 0x0310U -#define LMMIO_DIR_BASE1 0x0318U -#define LMMIO_DIR_MASK1 0x0320U -#define LMMIO_DIR_ROUTE1 0x0328U -#define LMMIO_DIR_BASE2 0x0330U -#define LMMIO_DIR_MASK2 0x0338U -#define LMMIO_DIR_ROUTE2 0x0340U -#define LMMIO_DIR_BASE3 0x0348U -#define LMMIO_DIR_MASK3 0x0350U -#define LMMIO_DIR_ROUTE3 0x0358U -#define LMMIO_DIST_BASE 0x0360U -#define LMMIO_DIST_MASK 0x0368U -#define LMMIO_DIST_ROUTE 0x0370U -#define GMMIO_DIST_BASE 0x0378U -#define PORT_DISABLE 0x02UL -#define MAP_TO_LMMIO 0x04UL -#define GMMIO_DIST_MASK 0x0380U -#define GMMIO_DIST_ROUTE 0x0388U -#define IOS_DIST_BASE 0x0390U -#define IOS_DIST_MASK 0x0398U -#define IOS_DIST_ROUTE 0x03A0U -#define ROPE_CONFIG_BASE 0x03A8U -#define VGA_ROUTE 0x03B0U -#define VGA_ENABLE 0x8000000000000000UL -#define VGA_LIGHT 0x4000000000000000UL - -#define IOS_DIR_BASE 0x03C0U -#define IOS_DIR_MASK 0x03C8U -#define IOS_DIR_ROUTE 0x03D0U -#define IOS_BASE 0x03D8U - -#define MIO_FUNCTION1 0x1000U - -#define ROPE_CONFIG 0x1040U -#define ROPE_D0 0x0100UL -#define ROPE_D2 0x0200UL -#define ROPE_D4 0x0400UL -#define ROPE_D6 0x0800UL -#define ROPE_Q0 0x1000UL -#define ROPE_Q4 0x2000UL - -#define LBA_PORT0_CNTRL 0x1200U -#define LBA_PORT1_CNTRL 0x1208U -#define LBA_PORT2_CNTRL 0x1210U -#define LBA_PORT3_CNTRL 0x1218U -#define LBA_PORT4_CNTRL 0x1220U -#define LBA_PORT5_CNTRL 0x1228U -#define LBA_PORT6_CNTRL 0x1230U -#define LBA_PORT7_CNTRL 0x1238U -#define LBA_RESET_FUNCTION 0x0000000001UL -#define LBA_CLEAR_ERROR 0x0000000010UL -#define LBA_HARD_FAIL 0x0000000040UL -#define LBA_RESET_COMPLETE 0x0100000000UL - -#define ROPE_PAGE_CONTROL 0x1418U - -/* - * Total ioa configuration space size is actually 128k, but we only need the - * first 64k. - */ -#define IOA_SIZE 0x00010000UL - -/* ZX1 ioa register definitions */ -#define IOA_CONFIG_ADDR 0x0040U -#define IOA_CONFIG_DATA 0x0048U - -#define IOA_SECONDARY_BUS 0x0058U -#define IOA_SUBORDINATE_BUS 0x0059U - -#define IOA_CONTROL 0x0108U -#define IOA_RESET_FUNCTION 0x0000000001UL -#define IOA_FORWARD_VGA 0x0000000008UL -#define IOA_CLEAR_ERROR 0x0000000010UL -#define IOA_HARD_FAIL 0x0000000040UL -#define IOA_RESET_COMPLETE 0x0100000000UL - -#define IOA_LMMIO_BASE 0x0200U -#define IOA_LMMIO_MASK 0x0208U -#define IOA_GMMIO_BASE 0x0210U -#define IOA_GMMIO_MASK 0x0218U -#define IOA_WLMMIO_BASE 0x0220U -#define IOA_WLMMIO_MASK 0x0228U -#define IOA_WGMMIO_BASE 0x0230U -#define IOA_WGMMIO_MASK 0x0238U -#define IOA_IOS_BASE 0x0240U -#define IOA_IOS_MASK 0x0248U -#define IOA_ELMMIO_BASE 0x0250U -#define IOA_ELMMIO_MASK 0x0258U -#define IOA_EIOS_BASE 0x0260U -#define IOA_EIOS_MASK 0x0268U -#define IOA_GLOBAL_MASK 0x0270U -#define IOA_SLAVE_CONTROL 0x0278U -#define IOA_VGA_PEER_ENABLE 0x2000UL -#define IOA_MSI_BASE 0x0280U -#define IOA_MSI_MASK 0x0288U - -#define IOA_DMA_BASE 0x02B0U -#define IOA_DMA_MASK 0x02B8U - -#define IOA_ERROR_CONFIG 0x0680U -#define IOA_ERROR_PIOWRITE 0x0001UL -#define IOA_ERROR_PIOREAD 0x0002UL -#define IOA_ERROR_DMAWRITE 0x0004UL -#define IOA_ERROR_DMAREAD 0x0008UL -#define IOA_ERROR_CONFIG_MASTER 0x0010UL -#define IOA_ERROR_SMART 0x0020UL -#define IOA_ERROR_FATAL_SERR 0x0040UL -#define IOA_ERROR_ASSERT_SERR 0x0080UL -/* ? 0x0100UL */ -#define IOA_ERROR_LOOPBACK 0x0200UL -#define IOA_ERROR_CONFIG_TARGET 0x0400UL -#define IOA_ERROR_IO_MASTER 0x0800UL -#define IOA_ERROR_IO_TARGET 0x1000UL -#define IOA_ERROR_MEM_MASTER 0x2000UL -#define IOA_ERROR_MEM_TARGET 0x4000UL -#define IOA_ERROR_HF_IO_FATAL 0x8000UL - -#define RANGE_ENABLE 0x01UL /* In various base registers */ - -#define IO_MASK ((1UL << 16) - 1UL) -#define LMMIO_MASK ((1UL << 32) - 1UL) -#ifdef __ia64__ -#define GMMIO_MASK ((1UL << 44) - 1UL) -#else /* PA-RISC */ -#define GMMIO_MASK ((1UL << 40) - 1UL) -#endif - -#define PDH_START 0xFF000000UL -#define PDH_LAST 0xFFFFFFFFUL - -static CARD8 *pZX1mio = NULL, - *pZX1ioa = NULL; - -/* Per-rope data */ -static INT8 zx1_ropemap[8]; -static CARD32 zx1_pciids[8]; -static CARD64 zx1_lbacntl[8]; -static int zx1_busno[8], zx1_subno[8]; - -/* Array of Booleans for non-empty buses */ -static INT8 zx1_busnmpt[MAX_PCI_BUSES]; - -static pciBusFuncs_t zx1BusFuncs; -static int zx1_fakebus = -1; -static Bool zx1_hasvga = FALSE; - -static pointer pZX1IoRes[8], pZX1MemRes[8]; /* Rope resources */ - -/* Non-PCI configuration space access macros */ -#define MIO_BYTE(offset) \ - (*(volatile CARD8 *)(pointer)(pZX1mio + (offset))) -#define MIO_WORD(offset) \ - (*(volatile CARD16 *)(pointer)(pZX1mio + (offset))) -#define MIO_LONG(offset) \ - (*(volatile CARD32 *)(pointer)(pZX1mio + (offset))) -#define MIO_QUAD(offset) \ - (*(volatile CARD64 *)(pointer)(pZX1mio + (offset))) -#define IOA_BYTE(ioa, offset) \ - (*(volatile CARD8 *)(pointer)(pZX1ioa + ((offset) + ((ioa) << 13)))) -#define IOA_WORD(ioa, offset) \ - (*(volatile CARD16 *)(pointer)(pZX1ioa + ((offset) + ((ioa) << 13)))) -#define IOA_LONG(ioa, offset) \ - (*(volatile CARD32 *)(pointer)(pZX1ioa + ((offset) + ((ioa) << 13)))) -#define IOA_QUAD(ioa, offset) \ - (*(volatile CARD64 *)(pointer)(pZX1ioa + ((offset) + ((ioa) << 13)))) - -/* Range definitions */ -#define MAX_RANGE 16 -static CARD64 bot[MAX_RANGE], top[MAX_RANGE], msk[MAX_RANGE], siz[MAX_RANGE]; -static INT8 *pDecode[MAX_RANGE]; -static int nRange = 0; - -/* Track a resource range and assign a granularity to it */ -static void -SetRange(CARD64 base, CARD64 last, CARD8 width) -{ - int i; - - bot[nRange] = base; - top[nRange] = last; - msk[nRange] = (CARD64)(-1L); - if (base) - msk[nRange] &= (base ^ (base - 1UL)) >> 1; - if (last + 1UL) - msk[nRange] &= (last ^ (last + 1UL)) >> 1; - if (width < 64) - msk[nRange] &= (1UL << width) - 1UL; - - /* Look for overlapping ranges */ - for (i = 0; i < nRange; i++) { - if ((bot[i] > top[i]) || - (top[nRange] < bot[i]) || - (top[i] < bot[nRange])) - continue; - - /* Merge in overlapping range */ - if (bot[nRange] > bot[i]) - bot[nRange] = bot[i]; - if (top[nRange] < top[i]) - top[nRange] = top[i]; - - /* Assign finer granularity */ - msk[nRange] &= msk[i]; - bot[i] = 1UL; - top[i] = 0; - } - - nRange++; -} - -/* Lookup granularity associated with the range containing 'base' */ -static int -GetRange(CARD64 base) -{ - int i; - - for (i = 0; i < nRange; i++) { - if ((bot[i] > top[i]) || - (base < bot[i]) || - (base > top[i])) - continue; - - if (pDecode[i]) - break; - - /* Allocate decoding array */ - msk[i]++; - siz[i] = ((top[i] - bot[i] + 1UL) / msk[i]) + 1UL; - pDecode[i] = xnfalloc(siz[i]); - (void)memset(pDecode[i], -1, siz[i]); - break; - } - - return i; -} - -/* - * Verify that 'bus' is a rope's secondary bus and return the pciConfigPtr of - * the associated fake PCI-to-PCI bridge. - */ -static pciConfigPtr -VerifyZX1Bus(int bus) -{ - pciConfigPtr pPCI; - - if ((bus < 0) || (bus >= pciNumBuses) || - !pciBusInfo[bus] || !(pPCI = pciBusInfo[bus]->bridge) || - (pPCI->busnum != zx1_fakebus) || (pPCI->funcnum != 0) || - (pPCI->devnum < 0x10) || (pPCI->devnum > 0x17)) - return NULL; - - return pPCI; -} - -/* - * This function is called to emulate the various settings in a P2P or CardBus - * bridge's control register on a ZX1-based system. - */ -static CARD16 -ControlZX1Bridge(int bus, CARD16 mask, CARD16 value) -{ - pciConfigPtr pPCI; - CARD64 tmp1, tmp2, tmp3, ropenum; - CARD16 current = 0; - - if ((pPCI = VerifyZX1Bus(bus))) { - ropenum = pPCI->devnum & 0x07; - - /* - * Start with VGA enablement. This preserves the "VGA-lite" bit - * in mio's VGA_ROUTE register, and the VPE bit in each ioa's - * SLAVE_CONTROL register. - */ - tmp1 = MIO_QUAD(VGA_ROUTE); - tmp2 = IOA_QUAD(ropenum, IOA_CONTROL) & - ~(IOA_RESET_FUNCTION | IOA_CLEAR_ERROR); - if ((tmp1 & VGA_ENABLE) && ((tmp1 & 0x07UL) == ropenum)) { - current |= PCI_PCI_BRIDGE_VGA_EN; - if ((mask & PCI_PCI_BRIDGE_VGA_EN) && - !(value & PCI_PCI_BRIDGE_VGA_EN)) { - MIO_QUAD(VGA_ROUTE) = tmp1 & ~VGA_ENABLE; - tmp2 &= ~IOA_FORWARD_VGA; - IOA_QUAD(ropenum, IOA_CONTROL) = tmp2; - } - } else if (mask & value & PCI_PCI_BRIDGE_VGA_EN) { - if (!zx1_hasvga) { - xf86MsgVerb(X_WARNING, 3, - "HP ZX1: Attempt to enable VGA routing to bus %d" - " through rope %ld disallowed\n", bus, ropenum); - value &= ~PCI_PCI_BRIDGE_VGA_EN; - } else { - if (tmp1 & VGA_ENABLE) { - /* - * VGA is routed somewhere else. Disable it. - */ - MIO_QUAD(VGA_ROUTE) = 0UL; - tmp3 = IOA_QUAD(tmp1 & 0x07UL, IOA_CONTROL); - if (tmp3 & IOA_FORWARD_VGA) - IOA_QUAD(tmp1 & 0x07UL, IOA_CONTROL) = tmp3 & - ~(IOA_RESET_FUNCTION | IOA_FORWARD_VGA | - IOA_CLEAR_ERROR); - } - if (!(tmp2 & IOA_FORWARD_VGA)) { - tmp2 |= IOA_FORWARD_VGA; - IOA_QUAD(ropenum, IOA_CONTROL) = tmp2; - } - tmp1 = (tmp1 & ~0x07UL) | ropenum | VGA_ENABLE; - MIO_QUAD(VGA_ROUTE) = tmp1; - } - } - - /* Move on to master abort failure enablement */ - tmp1 = MIO_QUAD((ropenum << 3) + LBA_PORT0_CNTRL) & - ~(LBA_RESET_FUNCTION | LBA_CLEAR_ERROR); - if ((tmp1 & LBA_HARD_FAIL) || (tmp2 & IOA_HARD_FAIL)) { - current |= PCI_PCI_BRIDGE_MASTER_ABORT_EN; - if ((mask & PCI_PCI_BRIDGE_MASTER_ABORT_EN) && - !(value & PCI_PCI_BRIDGE_MASTER_ABORT_EN)) { - if (tmp1 & LBA_HARD_FAIL) - MIO_QUAD((ropenum << 3) + LBA_PORT0_CNTRL) = - tmp1 & ~LBA_HARD_FAIL; - if (tmp2 & IOA_HARD_FAIL) { - tmp2 &= ~IOA_HARD_FAIL; - IOA_QUAD(ropenum, IOA_CONTROL) = tmp2; - } - } - } else { - if (mask & value & PCI_PCI_BRIDGE_MASTER_ABORT_EN) { - if (!(tmp1 & LBA_HARD_FAIL)) - MIO_QUAD((ropenum << 3) + LBA_PORT0_CNTRL) = - tmp1 | LBA_HARD_FAIL; - if (!(tmp2 & IOA_HARD_FAIL)) { - tmp2 |= IOA_HARD_FAIL; - IOA_QUAD(ropenum, IOA_CONTROL) = tmp2; - } - } - } - - /* Put emulation of any other P2P bridge control here */ - } - - return (current & ~mask) | (value & mask); -} - -/* Retrieves a list of the resources routed to a rope's secondary bus */ -static void -GetZX1BridgeResources(int bus, - pointer *ppIoRes, - pointer *ppMemRes, - pointer *ppPmemRes) -{ - pciConfigPtr pPCI = VerifyZX1Bus(bus); - - if (ppIoRes) { - xf86FreeResList(*ppIoRes); - *ppIoRes = - pPCI ? xf86DupResList(pZX1IoRes[pPCI->devnum & 0x07]) : NULL; - } - - if (ppMemRes) { - xf86FreeResList(*ppMemRes); - *ppMemRes = - pPCI ? xf86DupResList(pZX1MemRes[pPCI->devnum & 0x07]) : NULL; - } - - if (ppPmemRes) { - xf86FreeResList(*ppPmemRes); - *ppPmemRes = NULL; - } -} - -/* The fake bus */ -static CARD32 -zx1FakeReadLong(PCITAG tag, int offset) -{ - FatalError("zx1FakeReadLong(0x%lX, 0x%X) called\n", - (unsigned long)tag, offset); -} - -static void -zx1FakeWriteLong(PCITAG tag, int offset, CARD32 val) -{ - FatalError("zx1FakeWriteLong(0x%lX, 0x%X, 0x%08X) called\n", - (unsigned long)tag, offset, val); -} - -static void -zx1FakeSetBits(PCITAG tag, int offset, CARD32 mask, CARD32 bits) -{ - CARD32 val; - - val = zx1FakeReadLong(tag, offset); - val &= ~mask; - val |= bits; - zx1FakeWriteLong(tag, offset, val); -} - -static pciBusFuncs_t zx1FakeBusFuncs = { - zx1FakeReadLong, - zx1FakeWriteLong, - zx1FakeSetBits -}; - -static pciBusInfo_t zx1FakeBus = { - 0, /* configMech -- copied from bus 0 */ - 0, /* numDevices -- copied from bus 0 */ - FALSE, /* secondary */ - 0, /* primary_bus -- dynamically set */ -#ifdef PowerMAX_OS - 0, /* ppc_io_base -- ignored */ - 0, /* ppc_io_size -- ignored */ -#endif - &zx1FakeBusFuncs, /* funcs */ - NULL, /* pciBusPriv -- none */ - NULL, /* bridge -- dynamically set */ -}; - -void -xf86PreScanZX1(void) -{ - resRange range; - unsigned long mapSize = xf86getpagesize(); - unsigned long tmp, base, ioaaddr; - unsigned long flagsd, based, lastd, maskd, routed; - unsigned long flags0, base0, last0, mask0, route0; - unsigned long flags1, base1, last1, mask1, route1; - unsigned long flags2, base2, last2, mask2, route2; - unsigned long flags3, base3, last3, mask3, route3; - unsigned long flagsg, baseg, lastg, maskg, routeg; - unsigned long flagsl, basel, lastl; - int i, rope; - - /* Map mio registers (minimum 8k) */ - if (mapSize < MIO_SIZE) - mapSize = MIO_SIZE; - - if (!(pZX1mio = xf86MapVidMem(-1, VIDMEM_MMIO, MIO_BASE, mapSize))) - return; - - /* Look for ZX1's SBA and IOC */ - if (((MIO_LONG(MIO_FUNCTION0 + PCI_ID_REG) != - DEVID(VENDOR_HP, CHIP_ZX1_SBA)) || - (MIO_LONG(MIO_FUNCTION1 + PCI_ID_REG) != - DEVID(VENDOR_HP, CHIP_ZX1_IOC))) && - ((MIO_LONG(MIO_FUNCTION0 + PCI_ID_REG) != - DEVID(VENDOR_HP, CHIP_ZX2_SBA)) || - (MIO_LONG(MIO_FUNCTION1 + PCI_ID_REG) != - DEVID(VENDOR_HP, CHIP_ZX2_IOC)))) { - xf86UnMapVidMem(-1, pZX1mio, mapSize); - pZX1mio = NULL; - return; - } - - /* Map rope configuration space */ - ioaaddr = MIO_QUAD(ROPE_CONFIG_BASE); - if (!(ioaaddr & RANGE_ENABLE) || /* No ropes */ - ((ioaaddr = ioaaddr & ~RANGE_ENABLE) & 0x01FFFFUL) || /* Not aligned */ - !(pZX1ioa = xf86MapVidMem(-1, VIDMEM_MMIO, ioaaddr, IOA_SIZE))) { - xf86UnMapVidMem(-1, pZX1mio, mapSize); - pZX1mio = NULL; - return; - } - - for (i = 0; i < 8; i++) { - zx1_ropemap[i] = i; - zx1_lbacntl[i] = 0; - xf86FreeResList(pZX1IoRes[i]); - xf86FreeResList(pZX1MemRes[i]); - pZX1IoRes[i] = pZX1MemRes[i] = NULL; - } - - /* - * Determine which of 8 possible ropes exist in the system. This is done - * by looking at their "coupling" to generate a list of candidates, - * whittling this list down by factoring in ROPE_PAGE_CONTROL register - * contents, then poking each candidate's configuration space to determine - * its existence. - */ - tmp = MIO_QUAD(ROPE_CONFIG); - if (tmp & ROPE_D0) - zx1_ropemap[1] = 0; - if (tmp & ROPE_D2) - zx1_ropemap[3] = 2; - if (tmp & ROPE_D4) - zx1_ropemap[5] = 4; - if (tmp & ROPE_D6) - zx1_ropemap[7] = 6; - if (tmp & ROPE_Q0) - zx1_ropemap[1] = zx1_ropemap[2] = zx1_ropemap[3] = 0; - if (tmp & ROPE_Q4) - zx1_ropemap[5] = zx1_ropemap[6] = zx1_ropemap[7] = 4; - - /* - * zx2 should allow better probing support via hard-fails, so no need to - * use the ROPE_PAGE_CONTROL register. Also, zx2 always has ropes 3 & 7 - * active regardless of bundling. - */ - if (MIO_LONG(MIO_FUNCTION0 + PCI_ID_REG) != - DEVID(VENDOR_HP, CHIP_ZX2_SBA)) { - - tmp = MIO_QUAD(ROPE_PAGE_CONTROL); - for (i = 0; i < 8; i++, tmp >>= 8) - if (!(CARD8)tmp) - zx1_ropemap[i] = -1; - } else { - zx1_ropemap[3] = 3; - zx1_ropemap[7] = 7; - } - - for (i = 0; i < 8; ) { - if (zx1_ropemap[i] == i) { - - /* Prevent hard-fails */ - zx1_lbacntl[i] = MIO_QUAD((i << 3) + LBA_PORT0_CNTRL) & - ~(LBA_RESET_FUNCTION | LBA_CLEAR_ERROR); - if (zx1_lbacntl[i] & LBA_HARD_FAIL) - MIO_QUAD((i << 3) + LBA_PORT0_CNTRL) = - zx1_lbacntl[i] & ~LBA_HARD_FAIL; - - /* Poke for an ioa */ - zx1_pciids[i] = IOA_LONG(i, PCI_ID_REG); - switch (zx1_pciids[i]) { - case DEVID(VENDOR_HP, CHIP_ELROY): - case DEVID(VENDOR_HP, CHIP_ZX1_LBA): /* Mercury */ - case DEVID(VENDOR_HP, CHIP_ZX1_AGP8): /* QuickSilver */ - case DEVID(VENDOR_HP, CHIP_ZX2_LBA): - /* Expected vendor/device IDs */ - zx1_busno[i] = - (unsigned int)IOA_BYTE(i, IOA_SECONDARY_BUS); - zx1_subno[i] = - (unsigned int)IOA_BYTE(i, IOA_SUBORDINATE_BUS); - break; - - default: - if ((CARD16)(zx1_pciids[i] + 1U) > (CARD16)1U) - xf86MsgVerb(X_NOTICE, 0, - "HP ZX1: Unexpected vendor/device id 0x%08X" - " on rope %d\n", zx1_pciids[i], i); - /* Nobody home, or not the "right" kind of rope guest */ - - /* - * Restore hard-fail setting. For "active" ropes, this is done - * later. - */ - if (zx1_lbacntl[i] & LBA_HARD_FAIL) { - MIO_QUAD((i << 3) + LBA_PORT0_CNTRL) = zx1_lbacntl[i]; - zx1_lbacntl[i] = 0; - } - - /* Ignore this rope and its couplings */ - do { - zx1_ropemap[i++] = -1; - } while ((i < 8) && (zx1_ropemap[i] < i)); - continue; /* Avoid over-incrementing 'i' */ - } - } - i++; - } - - /* Determine if VGA is currently routed */ - tmp = MIO_QUAD(VGA_ROUTE); - if (tmp & VGA_ENABLE) - zx1_hasvga = TRUE; - - /* - * Decode mio resource "coarse" routing (i.e. ignoring VGA). Due to the - * rather unusual flexibility of this chipset, this is done in a number of - * stages. For each of I/O and memory, first decode the relevant registers - * to generate ranges with an associated granularity. Overlapping ranges - * are merged into a larger range with the finer granularity. Each - * original range is then more thoroughly decoded using the granularity - * associated with the merged range that contains it. The result is then - * converted into resource lists for the common layer. - * - * Note that this doesn't care whether or not read-only bits are actually - * set as documented, nor that mask bits are contiguous. This does, - * however, factor in upper limits on I/O, LMMIO anf GMMIO addresses, and - * thus assumes high-order address bits are ignored rather than decoded. - * For example, an I/O address of 0x76543210 will be treated as 0x3210 - * rather than considered out-of-range. In part, this handling is a - * consequence of the fact that high-order mask bits are zeroes instead of - * ones. - */ - - flagsd = 0; based = 0; lastd = 0; maskd = 0; routed = 0; - flags0 = 0; base0 = 0; last0 = 0; mask0 = 0; route0 = 0; - flags1 = 0; base1 = 0; last1 = 0; mask1 = 0; route1 = 0; - flags2 = 0; base2 = 0; last2 = 0; mask2 = 0; route2 = 0; - flags3 = 0; base3 = 0; last3 = 0; mask3 = 0; route3 = 0; - flagsg = 0; baseg = 0; lastg = 0; maskg = 0; routeg = 0; - flagsl = 0; basel = 0; lastl = 0; - - if ((tmp = MIO_QUAD(IOS_DIST_BASE)) & RANGE_ENABLE) { - flagsd = RANGE_ENABLE; - maskd = MIO_QUAD(IOS_DIST_MASK); - based = tmp & maskd & (~RANGE_ENABLE & IO_MASK); - lastd = based | (~maskd & IO_MASK); - routed = MIO_QUAD(IOS_DIST_ROUTE) >> 58; - SetRange(based, lastd, routed); - } - - if ((tmp = MIO_QUAD(IOS_DIR_BASE)) & RANGE_ENABLE) { - flags0 = RANGE_ENABLE; - mask0 = MIO_QUAD(IOS_DIR_MASK); - base0 = tmp & mask0 & (~RANGE_ENABLE & IO_MASK); - last0 = base0 | (~mask0 & IO_MASK); - route0 = MIO_QUAD(IOS_DIR_ROUTE) & 0x07U; - SetRange(base0, last0, 64); - } - - if (flagsd) { - i = GetRange(based); - for (tmp = based; tmp <= lastd; tmp += msk[i]) { - if ((tmp & maskd) == based) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = zx1_ropemap[(tmp >> routed) & 0x07U]; - } - } - - flagsd = 0; - } - - if (flags0) { - i = GetRange(base0); - for (tmp = base0; tmp <= last0; tmp += msk[i]) { - if ((tmp & mask0) == base0) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = zx1_ropemap[route0]; - } - } - - flags0 = 0; - } - - for (i = 0; i < nRange; i++) { - if (!pDecode[i]) - continue; - - rope = pDecode[i][0]; - for (base = tmp = 0; ++tmp < siz[i]; ) { - if (rope == pDecode[i][tmp]) - continue; - - if (rope >= 0) { - RANGE(range, (base * msk[i]) + bot[i], - (tmp * msk[i]) + bot[i] - 1UL, - RANGE_TYPE(ResExcIoBlock, 0)); - pZX1IoRes[rope] = - xf86AddResToList(pZX1IoRes[rope], &range, -1); - } - - base = tmp; - rope = pDecode[i][base]; - } - - xfree(pDecode[i]); - pDecode[i] = NULL; - } - - nRange = 0; - - /* - * Move on to CPU memory access decoding. For now, don't tell the common - * layer about CPU memory ranges that are either relocated to 0 or - * translated into PCI I/O. - */ - - SetRange(MIO_BASE, MIO_BASE + MIO_SIZE - 1UL, 64); /* mio */ - SetRange(ioaaddr, ioaaddr + ((IOA_SIZE << 1) - 1UL), 64); /* ioa */ - SetRange(PDH_START, PDH_LAST, 64); /* PDH */ - - SetRange(MIO_BASE, LMMIO_MASK, 64); /* Completeness */ - - if ((tmp = MIO_QUAD(LMMIO_DIST_BASE)) & RANGE_ENABLE) { - flagsd = RANGE_ENABLE; - maskd = MIO_QUAD(LMMIO_DIST_MASK); - based = tmp & maskd & (~RANGE_ENABLE & LMMIO_MASK); - lastd = based | (~maskd & LMMIO_MASK); - routed = MIO_QUAD(LMMIO_DIST_ROUTE) >> 58; - SetRange(based, lastd, routed); - } - - if ((tmp = MIO_QUAD(LMMIO_DIR_BASE0)) & RANGE_ENABLE) { - flags0 = RANGE_ENABLE; - mask0 = MIO_QUAD(LMMIO_DIR_MASK0); - base0 = tmp & mask0 & (~RANGE_ENABLE & LMMIO_MASK); - last0 = base0 | (~mask0 & LMMIO_MASK); - route0 = MIO_QUAD(LMMIO_DIR_ROUTE0) & 0x07U; - SetRange(base0, last0, 64); - } - - if ((tmp = MIO_QUAD(LMMIO_DIR_BASE1)) & RANGE_ENABLE) { - flags1 = RANGE_ENABLE; - mask1 = MIO_QUAD(LMMIO_DIR_MASK1); - base1 = tmp & mask1 & (~RANGE_ENABLE & LMMIO_MASK); - last1 = base1 | (~mask1 & LMMIO_MASK); - route1 = MIO_QUAD(LMMIO_DIR_ROUTE1) & 0x07U; - SetRange(base1, last1, 64); - } - - if ((tmp = MIO_QUAD(LMMIO_DIR_BASE2)) & RANGE_ENABLE) { - flags2 = RANGE_ENABLE; - mask2 = MIO_QUAD(LMMIO_DIR_MASK2); - base2 = tmp & mask2 & (~RANGE_ENABLE & LMMIO_MASK); - last2 = base2 | (~mask2 & LMMIO_MASK); - route2 = MIO_QUAD(LMMIO_DIR_ROUTE2) & 0x07U; - SetRange(base2, last2, 64); - } - - if ((tmp = MIO_QUAD(LMMIO_DIR_BASE3)) & RANGE_ENABLE) { - flags3 = RANGE_ENABLE; - mask3 = MIO_QUAD(LMMIO_DIR_MASK3); - base3 = tmp & mask3 & (~RANGE_ENABLE & LMMIO_MASK); - last3 = base3 | (~mask3 & LMMIO_MASK); - route3 = MIO_QUAD(LMMIO_DIR_ROUTE3) & 0x07U; - SetRange(base3, last3, 64); - } - - if ((tmp = MIO_QUAD(GMMIO_DIST_BASE)) & RANGE_ENABLE) { - flagsg = tmp & (RANGE_ENABLE | PORT_DISABLE | MAP_TO_LMMIO); - maskg = MIO_QUAD(GMMIO_DIST_MASK); - baseg = tmp & maskg & - (~(RANGE_ENABLE | PORT_DISABLE | MAP_TO_LMMIO) & GMMIO_MASK); - lastg = baseg | (~maskg & GMMIO_MASK); - tmp = routeg = MIO_QUAD(GMMIO_DIST_ROUTE) >> 58; - if (!(flagsg & (PORT_DISABLE & MAP_TO_LMMIO)) && (tmp > 26)) - tmp = 26; - SetRange(baseg, lastg, tmp); - } - - if ((tmp = MIO_QUAD(IOS_BASE)) & RANGE_ENABLE) { - flagsl = RANGE_ENABLE; - basel = tmp & (~RANGE_ENABLE & GMMIO_MASK); - lastl = basel | 0x001FFFFFUL; - SetRange(basel, lastl, 64); - } - - if (flagsd) { - i = GetRange(based); - for (tmp = based; tmp <= lastd; tmp += msk[i]) { - if ((tmp & maskd) == based) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = zx1_ropemap[(tmp >> routed) & 0x07U]; - } - } - - flagsd = 0; - } - - /* LMMIO distributed range does not address anything beyond 0xFED00000 */ - i = GetRange(MIO_BASE); - for (tmp = MIO_BASE; tmp <= LMMIO_MASK; tmp += msk[i]) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = -1; - } - - /* Dillon space can sometimes be redirected to rope 0 */ - tmp = MIO_QUAD(STATUS_CONTROL); - if (!(tmp & DILLON_PRESENT)) { - i = GetRange(PDH_START); - for (tmp = PDH_START; tmp <= PDH_LAST; tmp += msk[i]) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = zx1_ropemap[0]; - } - } - - if (flagsg) { - unsigned long mask = (0x07UL << routeg) | maskg; - - i = GetRange(baseg); - for (tmp = baseg; tmp <= lastg; tmp += msk[i]) { - if ((tmp & maskg) == baseg) { - base = (tmp - bot[i]) / msk[i]; - - if ((flagsg & MAP_TO_LMMIO) || - (!(flagsg & PORT_DISABLE) && - (tmp <= ((tmp & mask) | 0x03FFFFFFUL)))) { - pDecode[i][base] = -1; - } else { - pDecode[i][base] = zx1_ropemap[(tmp >> routeg) & 0x07U]; - } - } - } - - flagsg = 0; - } - - if (flagsl) { - i = GetRange(basel); - for (tmp = basel; tmp <= lastl; tmp += msk[i]) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = -1; - } - - flagsl = 0; - } - - /* For now, assume directed LMMIO ranges don't overlap with each other */ - if (flags0) { - i = GetRange(base0); - for (tmp = base0; tmp <= last0; tmp += msk[i]) { - if ((tmp & mask0) == base0) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = zx1_ropemap[route0]; - } - } - - flags0 = 0; - } - - if (flags1) { - i = GetRange(base1); - for (tmp = base1; tmp <= last1; tmp += msk[i]) { - if ((tmp & mask1) == base1) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = zx1_ropemap[route1]; - } - } - - flags1 = 0; - } - - if (flags2) { - i = GetRange(base2); - for (tmp = base2; tmp <= last2; tmp += msk[i]) { - if ((tmp & mask2) == base2) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = zx1_ropemap[route2]; - } - } - - flags2 = 0; - } - - if (flags3) { - i = GetRange(base3); - for (tmp = base3; tmp <= last3; tmp += msk[i]) { - if ((tmp & mask3) == base3) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = zx1_ropemap[route3]; - } - } - - flags3 = 0; - } - - /* Claim iao config area */ - i = GetRange(ioaaddr); - for (tmp = ioaaddr; tmp < ioaaddr + (IOA_SIZE << 1); tmp += msk[i]) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = -1; - } - - /* Claim mio config area */ - i = GetRange(MIO_BASE); - for (tmp = MIO_BASE; tmp < (MIO_BASE + MIO_SIZE); tmp += msk[i]) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = -1; - } - - for (i = 0; i < nRange; i++) { - if (!pDecode[i]) - continue; - - rope = pDecode[i][0]; - for (base = tmp = 0; ++tmp < siz[i]; ) { - if (rope == pDecode[i][tmp]) - continue; - - if (rope >= 0) { - RANGE(range, (base * msk[i]) + bot[i], - (tmp * msk[i]) + bot[i] - 1UL, - RANGE_TYPE(ResExcMemBlock, 0)); - pZX1MemRes[rope] = - xf86AddResToList(pZX1MemRes[rope], &range, -1); - } - - base = tmp; - rope = pDecode[i][base]; - } - - xfree(pDecode[i]); - pDecode[i] = NULL; - } - - nRange = 0; - - return; -} - -/* This is called to finalise the results of a PCI bus scan */ -void -xf86PostScanZX1(void) -{ - pciConfigPtr pPCI, *ppPCI, *ppPCI2; - pciBusInfo_t *pBusInfo; - int i, idx; - - if (!pZX1mio) - return; - - (void)memset(zx1_busnmpt, FALSE, sizeof(zx1_busnmpt)); - pBusInfo = pciBusInfo[0]; - - /* - * Certain 2.4 & 2.5 Linux kernels add fake PCI devices. Remove them to - * prevent any possible interference with our PCI validation. - * - * Also, if VGA isn't routed on server entry, determine if VGA routing - * needs to be enabled while the server is running. - */ - idx = 0; - ppPCI = ppPCI2 = xf86scanpci(0); /* Recursion is only apparent */ - while ((pPCI = *ppPCI2++)) { - switch (pPCI->pci_device_vendor) { - case DEVID(VENDOR_HP, CHIP_ELROY): - case DEVID(VENDOR_HP, CHIP_ZX1_SBA): /* Pluto function 0 */ - case DEVID(VENDOR_HP, CHIP_ZX1_IOC): /* Pluto function 1 */ - case DEVID(VENDOR_HP, CHIP_ZX1_LBA): /* Mercury */ - case DEVID(VENDOR_HP, CHIP_ZX1_AGP8): /* QuickSilver */ - case DEVID(VENDOR_HP, CHIP_ZX2_SBA): - case DEVID(VENDOR_HP, CHIP_ZX2_IOC): - case DEVID(VENDOR_HP, CHIP_ZX2_LBA): - xfree(pPCI); /* Remove it */ - continue; - - default: - *ppPCI++ = pPCI; - idx++; - - zx1_busnmpt[pPCI->busnum] = TRUE; - - if (zx1_hasvga) - continue; - - switch (pPCI->pci_base_class) { - case PCI_CLASS_PREHISTORIC: - if (pPCI->pci_sub_class == PCI_SUBCLASS_PREHISTORIC_VGA) - break; - continue; - - case PCI_CLASS_DISPLAY: - if (pPCI->pci_sub_class == PCI_SUBCLASS_DISPLAY_VGA) - break; - continue; - - default: - continue; - } - - zx1_hasvga = TRUE; - continue; - } - } - - /* - * Restore hard-fail settings and figure out the actual secondary and - * subordinate bus numbers. - */ - for (i = 0; i < 8; i++) { - if (zx1_ropemap[i] != i) - continue; - - if (zx1_lbacntl[i] & LBA_HARD_FAIL) - MIO_QUAD((i << 3) + LBA_PORT0_CNTRL) = zx1_lbacntl[i]; - - while ((zx1_busno[i] < zx1_subno[i]) && !pciBusInfo[zx1_subno[i]]) - zx1_subno[i]--; - - if (zx1_fakebus <= zx1_subno[i]) - zx1_fakebus = zx1_subno[i] + 1; - - while (!zx1_busnmpt[zx1_busno[i]]) { - if (zx1_busno[i]) /* Info for bus zero is in static storage */ - xfree(pciBusInfo[zx1_busno[i]]); - pciBusInfo[zx1_busno[i]++] = NULL; - if (zx1_busno[i] > zx1_subno[i]) - break; - } - } - - if (zx1_fakebus >= pciNumBuses) { - if (zx1_fakebus >= pciMaxBusNum) - FatalError("HP ZX1: No room for fake PCI bus\n"); - pciNumBuses = zx1_fakebus + 1; - } - - /* Set up our extra bus functions */ - zx1BusFuncs = *(pBusInfo->funcs); - zx1BusFuncs.pciControlBridge = ControlZX1Bridge; - zx1BusFuncs.pciGetBridgeResources = GetZX1BridgeResources; - - /* Set up our own fake bus to act as the root segment */ - zx1FakeBus.configMech = pBusInfo->configMech; - zx1FakeBus.numDevices = pBusInfo->numDevices; - zx1FakeBus.primary_bus = zx1_fakebus; - pciBusInfo[zx1_fakebus] = &zx1FakeBus; - - /* Add the fake bus' host bridge */ - if (++idx >= MAX_PCI_DEVICES) - FatalError("HP ZX1: No room for fake Host-to-PCI bridge\n"); - *ppPCI++ = zx1FakeBus.bridge = pPCI = xnfcalloc(1, sizeof(pciDevice)); - pPCI->tag = PCI_MAKE_TAG(zx1_fakebus, 0, 0); - pPCI->busnum = zx1_fakebus; - /* pPCI->devnum = pPCI->funcnum = 0; */ - pPCI->pci_device_vendor = DEVID(VENDOR_HP, CHIP_ZX1_SBA); - pPCI->pci_base_class = PCI_CLASS_BRIDGE; - /* pPCI->pci_sub_class = PCI_SUBCLASS_BRIDGE_HOST; */ - pPCI->fakeDevice = TRUE; - -#ifdef OLD_FORMAT - xf86MsgVerb(X_INFO, 2, "PCI: BusID 0x%.2x,0x%02x,0x%1x " - "ID 0x%04x,0x%04x Rev 0x%02x Class 0x%02x,0x%02x\n", - pPCI->busnum, pPCI->devnum, pPCI->funcnum, - pPCI->pci_vendor, pPCI->pci_device, pPCI->pci_rev_id, - pPCI->pci_base_class, pPCI->pci_sub_class); -#else - xf86MsgVerb(X_INFO, 2, "PCI: %.2x:%02x:%1x: chip %04x,%04x" - " card %04x,%04x rev %02x class %02x,%02x,%02x hdr %02x\n", - pPCI->busnum, pPCI->devnum, pPCI->funcnum, - pPCI->pci_vendor, pPCI->pci_device, - pPCI->pci_subsys_vendor, pPCI->pci_subsys_card, - pPCI->pci_rev_id, pPCI->pci_base_class, - pPCI->pci_sub_class, pPCI->pci_prog_if, - pPCI->pci_header_type); -#endif - - /* Add a fake PCI-to-PCI bridge to represent each active rope */ - for (i = 0; i < 8; i++) { - if ((zx1_ropemap[i] != i) || (zx1_busno[i] > zx1_subno[i]) || - !(pBusInfo = pciBusInfo[zx1_busno[i]])) - continue; - - if (++idx >= MAX_PCI_DEVICES) - FatalError("HP ZX1: No room for fake PCI-to-PCI bridge\n"); - *ppPCI++ = pPCI = xnfcalloc(1, sizeof(pciDevice)); - pPCI->busnum = zx1_fakebus; - pPCI->devnum = i | 0x10; - /* pPCI->funcnum = 0; */ - pPCI->tag = PCI_MAKE_TAG(zx1_fakebus, pPCI->devnum, 0); - pPCI->pci_device_vendor = zx1_pciids[i]; - pPCI->pci_base_class = PCI_CLASS_BRIDGE; - pPCI->pci_sub_class = PCI_SUBCLASS_BRIDGE_PCI; - pPCI->pci_header_type = 1; - pPCI->pci_primary_bus_number = zx1_fakebus; - pPCI->pci_secondary_bus_number = zx1_busno[i]; - pPCI->pci_subordinate_bus_number = zx1_subno[i]; - pPCI->fakeDevice = TRUE; - - pBusInfo->bridge = pPCI; - pBusInfo->secondary = TRUE; - pBusInfo->primary_bus = zx1_fakebus; - - /* Plug in chipset routines */ - pBusInfo->funcs = &zx1BusFuncs; - - /* Set bridge control register for scanpci utility */ - pPCI->pci_bridge_control = ControlZX1Bridge(zx1_busno[i], 0, 0); - -#ifdef OLD_FORMAT - xf86MsgVerb(X_INFO, 2, "PCI: BusID 0x%.2x,0x%02x,0x%1x " - "ID 0x%04x,0x%04x Rev 0x%02x Class 0x%02x,0x%02x\n", - pPCI->busnum, pPCI->devnum, pPCI->funcnum, - pPCI->pci_vendor, pPCI->pci_device, pPCI->pci_rev_id, - pPCI->pci_base_class, pPCI->pci_sub_class); -#else - xf86MsgVerb(X_INFO, 2, "PCI: %.2x:%02x:%1x: chip %04x,%04x" - " card %04x,%04x rev %02x class %02x,%02x,%02x hdr %02x\n", - pPCI->busnum, pPCI->devnum, pPCI->funcnum, - pPCI->pci_vendor, pPCI->pci_device, - pPCI->pci_subsys_vendor, pPCI->pci_subsys_card, - pPCI->pci_rev_id, pPCI->pci_base_class, - pPCI->pci_sub_class, pPCI->pci_prog_if, - pPCI->pci_header_type); -#endif - } - - *ppPCI = NULL; /* Terminate array */ -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.h b/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.h deleted file mode 100644 index 2795b4459..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.h +++ /dev/null @@ -1,40 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/zx1PCI.h,v 1.1 2003/02/23 20:26:49 tsi Exp $ */ -/* - * Copyright (C) 2002-2003 The XFree86 Project, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from the - * XFree86 Project. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef PCI_ZX1_H -#define PCI_ZX1_H 1 - -#include - -void xf86PreScanZX1(void); -void xf86PostScanZX1(void); - -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile deleted file mode 100644 index 261bd6bab..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile +++ /dev/null @@ -1,35 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/Imakefile,v 1.8 2002/10/11 01:46:59 dawes Exp $ -#include - -BIOS_MOD = bios_DGmmap - -SRCS = dgux_init.c dgux_video.c IO_utils.c dgux_io.c $(BIOS_MOD).c VTsw_noop.c \ - dgux_kbd.c dgux_kbdEv.c dgux_tty.c std_mouse.c std_mseEv.c \ - stdResource.c stdPci.c sigiostubs.c pm_noop.c kmod_noop.c agp_noop.c - -OBJS = dgux_init.o dgux_video.o IO_utils.o dgux_io.o $(BIOS_MOD).o VTsw_noop.o \ - dgux_kbd.o dgux_kbdEv.o dgux_tty.o std_mouse.o std_mseEv.o \ - stdResource.o stdPci.o sigiostubs.o pm_noop.o kmod_noop.o agp_noop.o - -INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) -I$(EXTINCSRC) - -RESDEFINES = -DUSESTDRES - -DEFINES = $(RESDEFINES) - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() - -LinkSourceFile(VTsw_noop,../shared) -LinkSourceFile(IO_utils,../shared) -LinkSourceFile(std_mouse,../shared) -LinkSourceFile(std_mseEv,../shared) -LinkSourceFile(stdResource.c,../shared) -LinkSourceFile(stdPci.c,../shared) -LinkSourceFile(sigiostubs.c,../shared) -LinkSourceFile(pm_noop.c,../shared) -LinkSourceFile(kmod_noop.c,../shared) -LinkSourceFile(agp_noop.c,../shared) - -DependTarget() diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/bios_DGmmap.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/bios_DGmmap.c deleted file mode 100644 index 95aad7a12..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/bios_DGmmap.c +++ /dev/null @@ -1,70 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/bios_DGmmap.c,v 1.3 2000/02/11 22:36:02 dawes Exp $ */ -/* - * INTEL DG/UX RELEASE 4.20 MU03 - * Copyright 1997 Takis Psarogiannakopoulos Cambridge,UK - * - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation. - * XCONSORTIUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FITNESS, IN NO EVENT SHALL XCONSORTIUM BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "input.h" -#include "scrnintstr.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -/* - * Read the BIOS via mmap() to the device /dev/mem. - */ -int xf86ReadBIOS(Base, Offset, Buf, Len) -unsigned long Base; -unsigned long Offset; -unsigned char *Buf; -int Len; -{ - int fd; - unsigned char *ptr; - int psize; - int mlen; - - if ((fd = open(DEV_MEM, O_RDONLY)) < 0) - { - ErrorF("xf86ReadBios: Failed to open %s (%s)\n", DEV_MEM, - strerror(errno)); - return(-1); - } - psize = xf86getpagesize(); - Offset += Base & (psize - 1); - Base &= ~(psize - 1); - mlen = (Offset + Len + psize - 1) & ~(psize - 1); - ptr = (unsigned char *)mmap((caddr_t)0, mlen, PROT_READ, MAP_SHARED, - fd, (off_t)Base); - if ((int)ptr == -1) - { - ErrorF("xf86ReadBios: %s mmap failed\n", DEV_MEM); - close(fd); - return(-1); - } - (void)memcpy(Buf, (void *)(ptr + Offset), Len); - (void)munmap((caddr_t)ptr, mlen); - (void)close(fd); - return(Len); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_init.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_init.c deleted file mode 100644 index b7282a004..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_init.c +++ /dev/null @@ -1,182 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_init.c,v 1.1 1998/12/13 07:37:46 dawes Exp $ */ -/* - * INTEL DG/UX RELEASE 4.20 MU03 - * Copyright 1997 Takis Psarogiannakopoulos Cambridge,UK - * - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation. - * XCONSORTIUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FITNESS, IN NO EVENT SHALL XCONSORTIUM BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "input.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Procs.h" -#include "xf86_OSlib.h" - -static Bool KeepTty = FALSE; -static Bool Protect0 = FALSE; -static int VTnum = -1; - -extern void xf86VTRequest( - int -); - -void xf86OpenConsole() -{ - int i; - int fd; - char vtname[14]; - - if (serverGeneration == 1) - { - /* check if we're run with euid==0 */ - if (geteuid() != 0) - { - FatalError("xf86OpenConsole: Server must be suid root\n"); - } - if (Protect0) - { - int fd = -1; - - if ((fd = open("/dev/zero", O_RDONLY, 0)) < 0) - { - ErrorF("xf86OpenConsole: cannot open /dev/zero (%s)\n", - strerror(errno)); - } - else - { - if ((int)mmap(0, 0x1000, PROT_NONE, - MAP_FIXED | MAP_SHARED, fd, 0) == -1) - { - ErrorF("xf86OpenConsole: failed to protect page 0 (%s)\n", - strerror(errno)); - } - close(fd); - } - } - if (VTnum != -1) - { - xf86Info.vtno = VTnum; - } - else - { - if ((fd = open("/dev/console",O_WRONLY,0)) < 0) - { - FatalError( - "xf86OpenConsole: Cannot open system tty (/dev/console), (%s)\n", - strerror(errno)); - } - close(fd); - } - xf86Info.vtno=0; - ErrorF(" (Intel DG/ux: using VT number: systty%d)\n\n", xf86Info.vtno); - - sprintf(vtname,"/dev/console"); - - xf86Config(FALSE); /* Read XF86Config */ - - if (!KeepTty) - { - setpgrp(); - } - - if ((xf86Info.consoleFd = open("/dev/console", O_RDWR|O_NDELAY, 0)) < 0) - { - FatalError("xf86OpenConsole: Cannot open %s (%s)\n", - vtname, strerror(errno)); - } - - - - if ((xf86Info.kbdFd = open("/dev/keybd", O_RDONLY|O_NDELAY, 0)) < 0) - { - FatalError("xf86OpenConsole: Cannot open keyboard (/dev/keybd), (%s)\n", strerror(errno)); - } - /* change ownerships and Grab all other system consoles */ - chown(vtname, getuid(), getgid()); - chown("/dev/syscon", getuid(), getgid()); - chown("/dev/systty", getuid(), getgid()); - if (!KeepTty) - { - /* - * Detach from the controlling tty to avoid char loss - */ - if ((i = open("/dev/tty",O_RDWR)) >= 0) - { - ioctl(i, TIOCNOTTY, 0); - close(i); - } - } - } - else - { - /* serverGeneration != 1 */ - if (!xf86VTSema) - sleep(5); - } - return; -} - -void xf86CloseConsole() -{ - close(xf86Info.kbdFd); /* Close the keyboard */ - close(xf86Info.consoleFd); /* Close the system console */ - return; -} - -int xf86ProcessArgument(argc, argv, i) -int argc; -char *argv[]; -int i; -{ - if (!strcmp(argv[i], "-keeptty")) - { - KeepTty = TRUE; - return(1); - } - if (!strcmp(argv[i], "-protect0")) - { - Protect0 = TRUE; - return(1); - } - if ((argv[i][0] == 'v') && (argv[i][1] == 't')) - { - if (sscanf(argv[i], "vt%2d", &VTnum) == 0) - { - UseMsg(); - VTnum = -1; - return(0); - } - return(1); - } - return(0); -} - -void xf86UseMsg() -{ - ErrorF("-keeptty "); - ErrorF("don't detach controlling tty (for debugging only)\n"); - return; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_io.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_io.c deleted file mode 100644 index b66051f63..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_io.c +++ /dev/null @@ -1,96 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_io.c,v 1.3 2002/10/11 01:40:34 dawes Exp $ */ -/* - * INTEL DG/UX RELEASE 4.20 MU03 - * Copyright 1997 Takis Psarogiannakopoulos Cambridge,UK - * - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation. - * XCONSORTIUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FITNESS, IN NO EVENT SHALL XCONSORTIUM BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#define NEED_EVENTS -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "inputstr.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#include "xf86Procs.h" -#include "xf86_OSlib.h" - - - -void xf86SoundKbdBell(loudness, pitch, duration) -int loudness; -int pitch; -int duration; -{ - if (loudness && pitch) - { - - /* - * We use KBD_TONE_HIGH to avoid putting the server - * to sleep - */ - ioctl(xf86Info.kbdFd, KBD_TONE_HIGH, - ((1193190 / pitch) & 0xffff) | - (((unsigned long)duration * - loudness / 50) << 16)); - - } -} - - - -void xf86MouseInit(mouse) -MouseDevPtr mouse; -{ - return; -} - - - -/* Added for DG/ux: only RDONLY will not crash the Xserver */ -int xf86MouseOn(mouse) -MouseDevPtr mouse; -{ - if ((mouse->mseFd = open(mouse->mseDevice, O_RDONLY|O_NDELAY)) < 0) - { - if (xf86Info.allowMouseOpenFail) { - ErrorF("Cannot open mouse (%s) - Continuing...\n", - strerror(errno)); - return(-2); - } - FatalError("Cannot open mouse (%s)\n", strerror(errno)); - } - - xf86SetupMouse(mouse); - - /* Flush any pending input */ - ioctl(mouse->mseFd, TCFLSH, 0); - return(mouse->mseFd); -} - -#include "xf86OSKbd.h" - -Bool -xf86OSKbdPreInit(InputInfoPtr pInfo) -{ - return FALSE; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_kbd.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_kbd.c deleted file mode 100644 index 7c25fb390..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_kbd.c +++ /dev/null @@ -1,120 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_kbd.c,v 1.1 1998/12/13 07:37:46 dawes Exp $ */ -/* - * INTEL DG/UX RELEASE 4.20 MU03 - * Copyright 1997 Takis Psarogiannakopoulos Cambridge,UK - * - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation. - * XCONSORTIUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FITNESS, IN NO EVENT SHALL XCONSORTIUM BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/* *Contents* - - 1 xf86KbdSetLeds - 2 xf86KbdGetLeds - 3 xf86SetKbdRepeat - 4 xf86KbdInit() - 5 xf86KbdOn() - 6 xf86KbdOff() - -*/ - - -#define NEED_EVENTS -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "inputstr.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#include "xf86Procs.h" -#include "xf86_OSlib.h" - - -static struct termios kbdtty; - - -/* ADDED FOR INTEL DGUX */ -void xf86SetKbdLeds(leds) -int leds; -{ - ioctl(xf86Info.kbdFd, KBD_SET_LED, leds); -} - - - -/* ADDED FOR INTEL DGUX */ -int xf86GetKbdLeds() -{ - int leds; - - ioctl(xf86Info.kbdFd, KBD_GET_STATE, &leds); - return(leds); -} - -/* ADDED FOR INTEL DGUX */ -void xf86SetKbdRepeat(char rad) -{ - return; -} - - - - -/* ADDED FOR INTEL DGUX */ - -void xf86KbdInit() -{ - tcgetattr(xf86Info.kbdFd, &kbdtty); -} - - - - - -/* ADDED FOR INTEL DGUX */ - -int xf86KbdOn() -{ - struct termios nTty; - - nTty = kbdtty; - nTty.c_iflag = IGNPAR | IGNBRK; - nTty.c_oflag = 0; - nTty.c_cflag = CREAD | CS8; - nTty.c_lflag = 0; - nTty.c_cc[VTIME] = 0; - nTty.c_cc[VMIN] = 1; - cfsetispeed(&nTty, 9600); - cfsetospeed(&nTty, 9600); - tcsetattr(xf86Info.kbdFd, TCSANOW, &nTty); - return(xf86Info.kbdFd); -} - - - - - -/* Intel DG/ux */ -int xf86KbdOff() -{ - tcsetattr(xf86Info.kbdFd, TCSANOW, &kbdtty); - return(xf86Info.kbdFd); -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_kbdEv.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_kbdEv.c deleted file mode 100644 index 1651f20d8..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_kbdEv.c +++ /dev/null @@ -1,47 +0,0 @@ -/* $XFree86$ */ -/* - * INTEL DG/UX RELEASE 4.20 MU02 - * Copyright 1997 Takis Psarogiannakopoulos Cambridge,UK - * - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation. - * XCONSORTIUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FITNESS, IN NO EVENT SHALL XCONSORTIUM BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - - -#define NEED_EVENTS -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "inputstr.h" -#include "scrnintstr.h" - -#include "xf86Procs.h" -#include "xf86_OSlib.h" - -void xf86KbdEvents() -{ - unsigned char rBuf[64]; - int nBytes, i; - - if ((nBytes = read( xf86Info.kbdFd, (char *)rBuf, sizeof(rBuf))) > 0) - { - for (i = 0; i < nBytes; i++) - xf86PostKbdEvent(rBuf[i]); - } -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_tty.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_tty.c deleted file mode 100644 index b6dee0421..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_tty.c +++ /dev/null @@ -1,175 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_tty.c,v 1.1 1998/12/13 07:37:47 dawes Exp $ */ -/* - * INTEL DG/UX RELEASE 4.20 MU03 - * Copyright 1997 Takis Psarogiannakopoulos Cambridge,UK - * - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation. - * XCONSORTIUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FITNESS, IN NO EVENT SHALL XCONSORTIUM BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* BSD (POSIX) Flavor tty for ix86 DG/ux R4.20MU03 */ - -#define NEED_EVENTS -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "inputstr.h" -#include "scrnintstr.h" - -#include "xf86Procs.h" -#include "xf86_OSlib.h" -#include "xf86_Config.h" - -static Bool not_a_tty = FALSE; - -void xf86SetMouseSpeed(mouse, old, new, cflag) -MouseDevPtr mouse; -int old; -int new; -unsigned cflag; -{ - struct termios tty; - char *c; - - if (not_a_tty) - return; - - if (tcgetattr(mouse->mseFd, &tty) < 0) - { - not_a_tty = TRUE; - ErrorF("Warning: %s unable to get status of mouse fd (%s)\n", - mouse->mseDevice, strerror(errno)); - return; - } - - /* this will query the initial baudrate only once */ - if (mouse->oldBaudRate < 0) { - switch (cfgetispeed(&tty)) - { - case B9600: - mouse->oldBaudRate = 9600; - break; - case B4800: - mouse->oldBaudRate = 4800; - break; - case B2400: - mouse->oldBaudRate = 2400; - break; - case B1200: - default: - mouse->oldBaudRate = 1200; - break; - } - } - - tty.c_iflag = IGNBRK | IGNPAR; - tty.c_oflag = 0; - tty.c_lflag = 0; - tty.c_cflag = (tcflag_t)cflag; - tty.c_cc[VTIME] = 0; - tty.c_cc[VMIN] = 1; - - switch (old) - { - case 9600: - cfsetispeed(&tty, B9600); - cfsetospeed(&tty, B9600); - break; - case 4800: - cfsetispeed(&tty, B4800); - cfsetospeed(&tty, B4800); - break; - case 2400: - cfsetispeed(&tty, B2400); - cfsetospeed(&tty, B2400); - break; - case 1200: - default: - cfsetispeed(&tty, B1200); - cfsetospeed(&tty, B1200); - } - - if (tcsetattr(mouse->mseFd, TCSADRAIN, &tty) < 0) - { - if (xf86Info.allowMouseOpenFail) { - ErrorF("Unable to set status of mouse fd (%s) - Continuing...\n", - strerror(errno)); - return; - } - xf86FatalError("Unable to set status of mouse fd (%s)\n", - strerror(errno)); - } - - switch (new) - { - case 9600: - c = "*q"; - cfsetispeed(&tty, B9600); - cfsetospeed(&tty, B9600); - break; - case 4800: - c = "*p"; - cfsetispeed(&tty, B4800); - cfsetospeed(&tty, B4800); - break; - case 2400: - c = "*o"; - cfsetispeed(&tty, B2400); - cfsetospeed(&tty, B2400); - break; - case 1200: - default: - c = "*n"; - cfsetispeed(&tty, B1200); - cfsetospeed(&tty, B1200); - } - - if (mouse->mseType == P_LOGIMAN || mouse->mseType == P_LOGI) - { - if (write(mouse->mseFd, c, 2) != 2) - { - if (xf86AllowMouseOpenFail) { - ErrorF("Unable to write to mouse fd (%s) - Continuing...\n", - strerror(errno)); - return; - } - xf86FatalError("Unable to write to mouse fd (%s)\n", - strerror(errno)); - } - } - usleep(100000); - - if (tcsetattr(mouse->mseFd, TCSADRAIN, &tty) < 0) - { - if (xf86AllowMouseOpenFail) { - ErrorF("Unable to set status of mouse fd (%s) - Continuing...\n", - strerror(errno)); - return; - } - xf86FatalError("Unable to set status of mouse fd (%s)\n", - strerror(errno)); - } -} - -/* ADDED FOR X 3.3.2.3 */ -int -xf86FlushInput(fd) -int fd; -{ - return tcflush(fd, TCIFLUSH); -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_video.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_video.c deleted file mode 100644 index 25336d68a..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/dgux/dgux_video.c +++ /dev/null @@ -1,441 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/dgux/dgux_video.c,v 1.6tsi Exp $ */ -/* - * INTEL DG/UX RELEASE 4.20 MU03 - * Copyright 1997 Takis Psarogiannakopoulos Cambridge,UK - * - * - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation. - * XFREE86 PROJECT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FITNESS, IN NO EVENT SHALL XCONSORTIUM BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "input.h" -#include "scrnintstr.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -/* Stuff for the SET_IOPL() ,RESET_IOPL() */ -/* #include */ -static int io_takis; -int set_takis; - - -/***************************************************************************/ -/* SET_IOPL() and RESET_IOPL() section for ix86 DG/ux 4.20MU03 */ -/***************************************************************************/ - - -int SET_IOPL() -{ - io_takis=open("/dev/console", O_RDWR,0); - if ((io_takis) < 0) - { - return(-1); - } - set_takis = ioctl(io_takis,KDENABIO,0); - - if (set_takis < 0) - { - return(-1); - } - return(1); -} - - - - -void RESET_IOPL() -{ - - ioctl(io_takis,KDDISABIO,0); - close(io_takis); - return; - -} - -/***************************************************************************/ -/* DG/ux Video Memory Mapping part */ -/***************************************************************************/ - -#undef HAS_SVR3_MMAPDRV /* ix86 DG/ux is a typical SVR4 without SVR3_MMAPDRV */ - -Bool xf86LinearVidMem() -{ - return(TRUE); -} - -pointer -xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) -{ - pointer base; - int fd; - - fd = open(DEV_MEM, (Flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR); - if (fd < 0) - { - FatalError("xf86MapVidMem: failed to open %s (%s)\n", - DEV_MEM, strerror(errno)); - } - base = mmap((caddr_t)0, Size, - (Flags & VIDMEM_READONLY) ? - PROT_READ : (PROT_READ | PROT_WRITE), - MAP_SHARED, fd, (off_t)Base); - close(fd); - if (base == MAP_FAILED) - { - FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n", - "xf86MapVidMem", Size, Base, strerror(errno)); - } - - return(base); -} - -void xf86UnMapVidMem(ScreenNum, Region, Base, Size) -int ScreenNum; -int Region; -pointer Base; -unsigned long Size; -{ - munmap(Base, Size); -} - -/***************************************************************************/ -/* I/O Permissions section */ -/***************************************************************************/ - -#define ALWAYS_USE_EXTENDED -#ifdef ALWAYS_USE_EXTENDED - -static Bool ScreenEnabled[MAXSCREENS]; -static Bool ExtendedEnabled = FALSE; -static Bool InitDone = FALSE; - -void -xf86ClearIOPortList(ScreenNum) -int ScreenNum; -{ - if (!InitDone) - { - int i; - for (i = 0; i < MAXSCREENS; i++) - ScreenEnabled[i] = FALSE; - InitDone = TRUE; - } - return; -} - -void -xf86AddIOPorts(ScreenNum, NumPorts, Ports) -int ScreenNum; -int NumPorts; -unsigned *Ports; -{ - return; -} - -void -xf86EnableIOPorts(ScreenNum) -int ScreenNum; -{ - int i; - - ScreenEnabled[ScreenNum] = TRUE; - - if (ExtendedEnabled) - return; - - if (SET_IOPL() < 0) - { - FatalError("%s: Failed to set IOPL for extended I/O\n", - "xf86EnableIOPorts"); - } - ExtendedEnabled = TRUE; - - return; -} - -void -xf86DisableIOPorts(ScreenNum) -int ScreenNum; -{ - int i; - - ScreenEnabled[ScreenNum] = FALSE; - - if (!ExtendedEnabled) - return; - - for (i = 0; i < MAXSCREENS; i++) - if (ScreenEnabled[i]) - return; - - RESET_IOPL(); - ExtendedEnabled = FALSE; - - return; -} - -#else /* !ALWAYS_USE_EXTENDED */ - -#define DISABLED 0 -#define NON_EXTENDED 1 -#define EXTENDED 2 - -static unsigned *EnabledPorts[MAXSCREENS]; -static int NumEnabledPorts[MAXSCREENS]; -static Bool ScreenEnabled[MAXSCREENS]; -static Bool ExtendedPorts[MAXSCREENS]; -static Bool ExtendedEnabled = FALSE; -static Bool InitDone = FALSE; -static struct kd_disparam OrigParams; - -void xf86ClearIOPortList(ScreenNum) -int ScreenNum; -{ - if (!InitDone) - { - xf86InitPortLists(EnabledPorts, NumEnabledPorts, ScreenEnabled, - ExtendedPorts, MAXSCREENS); - if (ioctl(xf86Info.consoleFd, KDDISPTYPE, &OrigParams) < 0) - { - FatalError("%s: Could not get display parameters\n", - "xf86ClearIOPortList"); - } - InitDone = TRUE; - return; - } - ExtendedPorts[ScreenNum] = FALSE; - if (EnabledPorts[ScreenNum] != (unsigned *)NULL) - xfree(EnabledPorts[ScreenNum]); - EnabledPorts[ScreenNum] = (unsigned *)NULL; - NumEnabledPorts[ScreenNum] = 0; -} - -void xf86AddIOPorts(ScreenNum, NumPorts, Ports) -int ScreenNum; -int NumPorts; -unsigned *Ports; -{ - int i; - - if (!InitDone) - { - FatalError("xf86AddIOPorts: I/O control lists not initialised\n"); - } - EnabledPorts[ScreenNum] = xrealloc(EnabledPorts[ScreenNum], - (NumEnabledPorts[ScreenNum]+NumPorts)*sizeof(unsigned)); - for (i = 0; i < NumPorts; i++) - { - EnabledPorts[ScreenNum][NumEnabledPorts[ScreenNum] + i] = - Ports[i]; - if (Ports[i] > 0x3FF) - ExtendedPorts[ScreenNum] = TRUE; - } - NumEnabledPorts[ScreenNum] += NumPorts; -} - -void xf86EnableIOPorts(ScreenNum) -int ScreenNum; -{ - struct kd_disparam param; - int i, j; - - if (ScreenEnabled[ScreenNum]) - return; - - for (i = 0; i < MAXSCREENS; i++) - { - if (ExtendedPorts[i] && (ScreenEnabled[i] || i == ScreenNum)) - { - if (SET_IOPL() < 0) - { - FatalError("%s: Failed to set IOPL for extended I/O\n", - "xf86EnableIOPorts"); - } - ExtendedEnabled = TRUE; - break; - } - } - if (ExtendedEnabled && i == MAXSCREENS) - { - RESET_IOPL(); - ExtendedEnabled = FALSE; - } - if (ioctl(xf86Info.consoleFd, KDDISPTYPE, ¶m) < 0) - { - FatalError("%s: Could not get display parameters\n", - "xf86EnableIOPorts"); - } - for (i = 0; i < NumEnabledPorts[ScreenNum]; i++) - { - unsigned port = EnabledPorts[ScreenNum][i]; - - if (port > 0x3FF) - continue; - - if (!xf86CheckPorts(port, EnabledPorts, NumEnabledPorts, - ScreenEnabled, MAXSCREENS)) - { - continue; - } - for (j=0; j < MKDIOADDR; j++) - { - if (param.ioaddr[j] == port) - { - break; - } - } - if (j == MKDIOADDR) - { - if (ioctl(xf86Info.consoleFd, KDADDIO, port) < 0) - { - FatalError("%s: Failed to enable port 0x%x\n", - "xf86EnableIOPorts", port); - } - } - } - if (ioctl(xf86Info.consoleFd, KDENABIO, 0) < 0) - { - FatalError("xf86EnableIOPorts: I/O port enable failed (%s)\n", - strerror(errno)); - } - ScreenEnabled[ScreenNum] = TRUE; - return; -} - -void xf86DisableIOPorts(ScreenNum) -int ScreenNum; -{ - struct kd_disparam param; - int i, j; - - if (!ScreenEnabled[ScreenNum]) - return; - - ScreenEnabled[ScreenNum] = FALSE; - for (i = 0; i < MAXSCREENS; i++) - { - if (ScreenEnabled[i] && ExtendedPorts[i]) - break; - } - if (ExtendedEnabled && i == MAXSCREENS) - { - RESET_IOPL(); - ExtendedEnabled = FALSE; - } - /* Turn off I/O before changing the access list */ - ioctl(xf86Info.consoleFd, KDDISABIO, 0); - if (ioctl(xf86Info.consoleFd, KDDISPTYPE, ¶m) < 0) - { - ErrorF("%s: Could not get display parameters\n", - "xf86DisableIOPorts"); - return; - } - - for (i=0; i < MKDIOADDR; i++) - { - if (param.ioaddr[i] == 0) - { - break; - } - if (!xf86CheckPorts(param.ioaddr[i], EnabledPorts, - NumEnabledPorts, ScreenEnabled, MAXSCREENS)) - { - continue; - } - for (j=0; j < MKDIOADDR; j++) - { - if (param.ioaddr[i] == OrigParams.ioaddr[j]) - { - /* - * Port was one of the original ones; don't - * touch it. - */ - break; - } - } - if (j == MKDIOADDR) - { - /* - * We added this port, so remove it. - */ - ioctl(xf86Info.consoleFd, KDDELIO, param.ioaddr[i]); - } - } - for (i = 0; i < MAXSCREENS; i++) - { - if (ScreenEnabled[i]) - { - ioctl(xf86Info.consoleFd, KDENABIO, 0); - break; - } - } - return; -} -#endif - -void xf86DisableIOPrivs() -{ - if (ExtendedEnabled) - RESET_IOPL(); - return; -} - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - - -Bool xf86DisableInterrupts() -{ - -#ifdef __GNUC__ - __asm__ __volatile__("cli"); -#else - asm("cli"); -#endif /* __GNUC__ */ - - return(TRUE); -} - -void xf86EnableInterrupts() -{ - -#ifdef __GNUC__ - __asm__ __volatile__("sti"); -#else - asm("sti"); -#endif /* __GNUC__ */ - - return; -} - - -void -xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base, - unsigned long Size) -{ -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile deleted file mode 100644 index 7716ed348..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile +++ /dev/null @@ -1,40 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/Imakefile,v 1.14 2002/10/11 01:46:59 dawes Exp $ - -#include - -BIOS_MOD = bios_mmap - -MOUSESRC = hurd_mouse.c -MOUSEOBJ = hurd_mouse.o - -SRCS = hurd_init.c hurd_video.c hurd_io.c libc_wrapper.c $(BIOS_MOD).c \ - VTsw_noop.c posix_tty.c $(MOUSESRC) \ - stdResource.c stdPci.c sigiostubs.c pm_noop.c kmod_noop.c agp_noop.c - -OBJS = hurd_init.o hurd_video.o hurd_io.o libc_wrapper.o $(BIOS_MOD).o \ - VTsw_noop.o posix_tty.o $(MOUSEOBJ) \ - stdResource.o stdPci.o sigiostubs.o pm_noop.o kmod_noop.o agp_noop.o - -INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/mi - -RESDEFINES = -DUSESTDRES - -DEFINES = $(RESDEFINES) - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() - - -LinkSourceFile(VTsw_noop.c,../shared) -LinkSourceFile(posix_tty.c,../shared) -LinkSourceFile(libc_wrapper.c,../shared) -LinkSourceFile(stdResource.c,../shared) -LinkSourceFile(stdPci.c,../shared) -LinkSourceFile(sigiostubs.c,../shared) -LinkSourceFile(pm_noop.c,../shared) -LinkSourceFile(kmod_noop.c,../shared) -LinkSourceFile(agp_noop.c,../shared) - -DependTarget() - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/bios_mmap.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/bios_mmap.c deleted file mode 100644 index 132e755e2..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/bios_mmap.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 1997 by UCHIYAMA Yasushi - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of UCHIYAMA Yasushi not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. UCHIYAMA Yasushi makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XFree86$ */ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include - -#include - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#define BIOS_SIZE 0x20000 - -int -xf86ReadBIOS(unsigned long Base,unsigned long Offset,unsigned char *Buf,int Len) -{ - mach_port_t device,iopl_dev; - memory_object_t iopl_mem; - vm_address_t addr = (vm_address_t)0; /* serach starting address */ - kern_return_t err; - - - err = get_privileged_ports (NULL, &device); - if( err ) - { - errno = err; - FatalError("xf86ReadBIOS() can't get_privileged_ports. (%s)\n",strerror(errno)); - } - err = device_open(device,D_READ|D_WRITE,"iopl",&iopl_dev); - mach_port_deallocate (mach_task_self (), device); - if( err ) - { - errno = err; - FatalError("xf86ReadBIOS() can't device_open. (%s)\n",strerror(errno)); - } - err = device_map(iopl_dev,VM_PROT_READ|VM_PROT_WRITE, Base , BIOS_SIZE ,&iopl_mem,0); - if( err ) - { - errno = err; - FatalError("xf86ReadBIOS() can't device_map. (%s)\n",strerror(errno)); - } - err = vm_map(mach_task_self(), - &addr, - BIOS_SIZE, - 0, - TRUE, - iopl_mem, - Base, - FALSE, - VM_PROT_READ|VM_PROT_WRITE, - VM_PROT_READ|VM_PROT_WRITE, - VM_INHERIT_SHARE); - mach_port_deallocate(mach_task_self(),iopl_mem); - if( err ) - { - errno = err; - FatalError("xf86ReadBIOS() can't vm_map. (%s)\n",strerror(errno)); - } - - memcpy(Buf,(void*)((int)addr + Offset), Len); - - err = vm_deallocate(mach_task_self(), addr, BIOS_SIZE); - if( err ) - { - errno = err; - FatalError("xf86ReadBIOS() can't vm_deallocate. (%s)\n",strerror(errno)); - } - - return Len; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/hurd_init.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/hurd_init.c deleted file mode 100644 index aec5b3d46..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/hurd_init.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 1997,1998 by UCHIYAMA Yasushi - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of UCHIYAMA Yasushi not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. UCHIYAMA Yasushi makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_init.c,v 1.1 1998/08/16 10:25:48 dawes Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -#include "input.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#include -#include -#include -#include -#include -#include - -int -xf86ProcessArgument( int argc,char **argv, int i ) -{ - return 0; -} -void -xf86UseMsg() -{ - return; -} - - -void -xf86OpenConsole() -{ - if( serverGeneration == 1 ) - { - kern_return_t err; - mach_port_t device; - int fd; - err = get_privileged_ports( NULL, &device ); - if( err ) - { - errno = err; - FatalError( "xf86KbdInit can't get_privileged_ports. (%s)\n" , strerror(errno) ); - } - mach_port_deallocate (mach_task_self (), device); - - if( ( fd = open( "/dev/kbd" , O_RDONLY|O_NONBLOCK ) ) < 0 ) - { - fprintf( stderr , "Cannot open keyboard (%s)\n",strerror(errno) ); - exit(1); - } - xf86Info.consoleFd = fd; - } - return; -} - -void -xf86CloseConsole() -{ - close( xf86Info.consoleFd ); - return; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/hurd_io.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/hurd_io.c deleted file mode 100644 index 32b4bc71d..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/hurd_io.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 1997,1998 by UCHIYAMA Yasushi - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of UCHIYAMA Yasushi not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. UCHIYAMA Yasushi makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_io.c,v 1.8 2002/10/11 01:40:35 dawes Exp $ */ - -#define NEED_EVENTS -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "inputstr.h" -#include "scrnintstr.h" -#include "mipointer.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#include -#include -#include -#include -#include -#include -#include - -typedef unsigned short kev_type; /* kd event type */ -typedef unsigned char Scancode; - -struct mouse_motion { - short mm_deltaX; /* units? */ - short mm_deltaY; -}; - -typedef struct { - kev_type type; /* see below */ - struct timeval time; /* timestamp */ - union { /* value associated with event */ - boolean_t up; /* MOUSE_LEFT .. MOUSE_RIGHT */ - Scancode sc; /* KEYBD_EVENT */ - struct mouse_motion mmotion; /* MOUSE_MOTION */ - } value; -} kd_event; - -/* - * kd_event ID's. - */ -#define MOUSE_LEFT 1 /* mouse left button up/down */ -#define MOUSE_MIDDLE 2 -#define MOUSE_RIGHT 3 -#define MOUSE_MOTION 4 /* mouse motion */ -#define KEYBD_EVENT 5 /* key up/down */ - -/*********************************************************************** - * Keyboard - **********************************************************************/ -void -xf86SoundKbdBell(int loudness,int pitch,int duration) -{ - return; -} - -void -xf86SetKbdLeds(int leds) -{ - return; -} - -int -xf86GetKbdLeds() -{ - return 0; -} - -void -xf86SetKbdRepeat(char rad) -{ - return; -} - -void -xf86KbdInit() -{ - return; -} -int -xf86KbdOn() -{ - int data = 1; - if( ioctl( xf86Info.consoleFd, _IOW('k', 1, int),&data) < 0) - FatalError("Cannot set event mode on keyboard (%s)\n",strerror(errno)); - return xf86Info.consoleFd; -} -int -xf86KbdOff() -{ - int data = 2; - if( ioctl( xf86Info.consoleFd, _IOW('k', 1, int),&data) < 0) - FatalError("can't reset keyboard mode (%s)\n",strerror(errno)); -} - -void -xf86KbdEvents() -{ - kd_event ke; - while( read(xf86Info.consoleFd, &ke, sizeof(ke)) == sizeof(ke) ) - xf86PostKbdEvent(ke.value.sc); -} - -#include "xf86OSKbd.h" - -Bool -xf86OSKbdPreInit(InputInfoPtr pInfo) -{ - return FALSE; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/hurd_mouse.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/hurd_mouse.c deleted file mode 100644 index 84a5c46da..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/hurd_mouse.c +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Copyright 1997,1998 by UCHIYAMA Yasushi - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of UCHIYAMA Yasushi not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. UCHIYAMA Yasushi makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_mouse.c,v 1.7 2000/02/10 22:33:44 dawes Exp $ */ - -#define NEED_EVENTS -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "inputstr.h" -#include "scrnintstr.h" -#include "mipointer.h" - -#include "xf86.h" -#include "xf86Xinput.h" -#include "xf86OSmouse.h" -#include "xf86_OSlib.h" - -#include -#include -#include -#include -#include -#include -#include - -typedef unsigned short kev_type; /* kd event type */ -typedef unsigned char Scancode; - -struct mouse_motion { - short mm_deltaX; /* units? */ - short mm_deltaY; -}; - -typedef struct { - kev_type type; /* see below */ - struct timeval time; /* timestamp */ - union { /* value associated with event */ - boolean_t up; /* MOUSE_LEFT .. MOUSE_RIGHT */ - Scancode sc; /* KEYBD_EVENT */ - struct mouse_motion mmotion; /* MOUSE_MOTION */ - } value; -} kd_event; - -/* - * kd_event ID's. - */ -#define MOUSE_LEFT 1 /* mouse left button up/down */ -#define MOUSE_MIDDLE 2 -#define MOUSE_RIGHT 3 -#define MOUSE_MOTION 4 /* mouse motion */ -#define KEYBD_EVENT 5 /* key up/down */ - -#define NUMEVENTS 64 - -/* - * OsMouseProc -- - * Handle the initialization, etc. of a mouse - */ -static int -OsMouseProc(DeviceIntPtr pPointer, int what) -{ - InputInfoPtr pInfo; - MouseDevPtr pMse; - unsigned char map[MSE_MAXBUTTONS + 1]; - int nbuttons; - - pInfo = pPointer->public.devicePrivate; - pMse = pInfo->private; - pMse->device = pPointer; - - switch (what) { - case DEVICE_INIT: - pPointer->public.on = FALSE; - - for (nbuttons = 0; nbuttons < MSE_MAXBUTTONS; ++nbuttons) - map[nbuttons + 1] = nbuttons + 1; - - InitPointerDeviceStruct((DevicePtr)pPointer, - map, - min(pMse->buttons, MSE_MAXBUTTONS), - miPointerGetMotionEvents, - pMse->Ctrl, - miPointerGetMotionBufferSize()); - - /* X valuator */ - xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1); - xf86InitValuatorDefaults(pPointer, 0); - /* Y valuator */ - xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1); - xf86InitValuatorDefaults(pPointer, 1); - xf86MotionHistoryAllocate(pInfo); - break; - - case DEVICE_ON: - pInfo->fd = xf86OpenSerial(pInfo->options); - if (pInfo->fd == -1) - xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); - else { - pMse->buffer = XisbNew(pInfo->fd, - NUMEVENTS * sizeof(kd_event)); - if (!pMse->buffer) { - xfree(pMse); - xf86CloseSerial(pInfo->fd); - pInfo->fd = -1; - } else { - xf86FlushInput(pInfo->fd); - AddEnabledDevice(pInfo->fd); - } - } - pMse->lastButtons = 0; - pMse->lastMappedButtons = 0; - pMse->emulateState = 0; - pPointer->public.on = TRUE; - break; - - case DEVICE_OFF: - case DEVICE_CLOSE: - if (pInfo->fd != -1) { - RemoveEnabledDevice(pInfo->fd); - if (pMse->buffer) { - XisbFree(pMse->buffer); - pMse->buffer = NULL; - } - xf86CloseSerial(pInfo->fd); - pInfo->fd = -1; - } - pPointer->public.on = FALSE; - usleep(300000); - break; - } - return Success; -} - -/* - * OsMouseReadInput -- - * Get some events from our queue. Process all outstanding events now. - */ -static void -OsMouseReadInput(InputInfoPtr pInfo) -{ - MouseDevPtr pMse; - static kd_event eventList[NUMEVENTS]; - int n, c; - kd_event *event = eventList; - unsigned char *pBuf; - - pMse = pInfo->private; - - XisbBlockDuration(pMse->buffer, -1); - pBuf = (unsigned char *)eventList; - n = 0; - while ((c = XisbRead(pMse->buffer)) >= 0 && n < sizeof(eventList)) - pBuf[n++] = (unsigned char)c; - - if (n == 0) - return; - - n /= sizeof(kd_event); - while( n-- ) { - int buttons = pMse->lastButtons; - int dx = 0, dy = 0; - switch (event->type) { - case MOUSE_RIGHT: - buttons = buttons & 6 |(event->value.up ? 0 : 1); - break; - case MOUSE_MIDDLE: - buttons = buttons & 5 |(event->value.up ? 0 : 2); - break; - case MOUSE_LEFT: - buttons = buttons & 3 |(event->value.up ? 0 : 4) ; - break; - case MOUSE_MOTION: - dx = event->value.mmotion.mm_deltaX; - dy = - event->value.mmotion.mm_deltaY; - break; - default: - ErrorF("Bad mouse event (%d)\n",event->type); - continue; - } - pMse->PostEvent(pInfo, buttons, dx, dy, 0, 0); - ++event; - } - return; -} - -static Bool -OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags) -{ - MouseDevPtr pMse; - - /* This is called when the protocol is "OSMouse". */ - - pMse = pInfo->private; - pMse->protocol = protocol; - xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol); - - /* Collect the options, and process the common options. */ - xf86CollectInputOptions(pInfo, NULL, NULL); - xf86ProcessCommonOptions(pInfo, pInfo->options); - - /* Check if the device can be opened. */ - pInfo->fd = xf86OpenSerial(pInfo->options); - if (pInfo->fd == -1) { - if (xf86GetAllowMouseOpenFail()) - xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); - else { - xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name); - xfree(pMse); - return FALSE; - } - } - xf86CloseSerial(pInfo->fd); - pInfo->fd = -1; - - /* Process common mouse options (like Emulate3Buttons, etc). */ - pMse->CommonOptions(pInfo); - - /* Setup the local procs. */ - pInfo->device_control = OsMouseProc; - pInfo->read_input = OsMouseReadInput; - - pInfo->flags |= XI86_CONFIGURED; - return TRUE; -} - -static int -SupportedInterfaces(void) -{ - /* XXX Need to check this. */ - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO; -} - -static const char *internalNames[] = { - "OSMouse", - NULL -}; - -static const char ** -BuiltinNames(void) -{ - return internalNames; -} - -static Bool -CheckProtocol(const char *protocol) -{ - int i; - - for (i = 0; internalNames[i]; i++) - if (xf86NameCmp(protocol, internalNames[i]) == 0) - return TRUE; - return FALSE; -} - -/* XXX Is this appropriate? If not, this function should be removed. */ -static const char * -DefaultProtocol(void) -{ - return "OSMouse"; -} - -OSMouseInfoPtr -xf86OSMouseInit(int flags) -{ - OSMouseInfoPtr p; - - p = xcalloc(sizeof(OSMouseInfoRec), 1); - if (!p) - return NULL; - p->SupportedInterfaces = SupportedInterfaces; - p->BuiltinNames = BuiltinNames; - p->DefaultProtocol = DefaultProtocol; - p->CheckProtocol = CheckProtocol; - p->PreInit = OsMousePreInit; - return p; -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/hurd_video.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/hurd_video.c deleted file mode 100644 index ecb8df1db..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/hurd/hurd_video.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright 1997, 1998 by UCHIYAMA Yasushi - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of UCHIYAMA Yasushi not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. UCHIYAMA Yasushi makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/hurd/hurd_video.c,v 1.3 1999/04/29 12:24:52 dawes Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include - -#include -#include "input.h" -#include "scrnintstr.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -/************************************************************************** - * Video Memory Mapping section - ***************************************************************************/ -pointer -xf86MapVidMem(int ScreenNum,int Flags, unsigned long Base, unsigned long Size) -{ - mach_port_t device,iopl_dev; - memory_object_t iopl_mem; - kern_return_t err; - vm_address_t addr=(vm_address_t)0; - - err = get_privileged_ports (NULL, &device); - if( err ) - { - errno = err; - FatalError("xf86MapVidMem() can't get_privileged_ports. (%s)\n",strerror(errno)); - } - err = device_open(device,D_READ|D_WRITE,"iopl",&iopl_dev); - mach_port_deallocate (mach_task_self(), device); - if( err ) - { - errno = err; - FatalError("xf86MapVidMem() can't device_open. (%s)\n",strerror(errno)); - } - - err = device_map(iopl_dev,VM_PROT_READ|VM_PROT_WRITE, Base , Size ,&iopl_mem,0); - if( err ) - { - errno = err; - FatalError("xf86MapVidMem() can't device_map. (%s)\n",strerror(errno)); - } - err = vm_map(mach_task_self(), - &addr, - Size, - 0, /* mask */ - TRUE, /* anywhere */ - iopl_mem, - (vm_offset_t)Base, - FALSE, /* copy on write */ - VM_PROT_READ|VM_PROT_WRITE, - VM_PROT_READ|VM_PROT_WRITE, - VM_INHERIT_SHARE); - mach_port_deallocate(mach_task_self(),iopl_mem); - if( err ) - { - errno = err; - FatalError("xf86MapVidMem() can't vm_map.(iopl_mem) (%s)\n",strerror(errno)); - } - mach_port_deallocate(mach_task_self(),iopl_dev); - if( err ) - { - errno = err; - FatalError("xf86MapVidMem() can't mach_port_deallocate.(iopl_dev) (%s)\n",strerror(errno)); - } - return (pointer)addr; -} - -void -xf86UnMapVidMem(int ScreenNum,pointer Base,unsigned long Size) -{ - kern_return_t err = vm_deallocate(mach_task_self(), (int)Base, Size); - if( err ) - { - errno = err; - ErrorF("xf86UnMapVidMem: can't dealloc framebuffer space (%s)\n",strerror(errno)); - } - return; -} - -Bool -xf86LinearVidMem() -{ - return(TRUE); -} - -/************************************************************************** - * I/O Permissions section - ***************************************************************************/ -Bool -xf86EnableIO() -{ - return TRUE; -} - -void -xf86DisableIO() -{ - return; -} - -void -xf86ClearIOPortList(int ScreenNum) -{ - return; -} -void -xf86AddIOPorts(int ScreenNum,int NumPorts,unsigned int *Ports) -{ - return; -} -void -xf86EnableIOPorts(int ScreenNum) -{ - return; -} - -void -xf86DisableIOPorts(int ScreenNum) -{ - return; -} -void -xf86DisableIOPrivs() -{ - return; -} -/************************************************************************** - * Interrupt Handling section - **************************************************************************/ -Bool -xf86DisableInterrupts() -{ - return TRUE; -} -void -xf86EnableInterrupts() -{ - return; -} - -void -xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base, - unsigned long Size) -{ -} - -Bool -xf86CheckMTRR(int s) -{ - return FALSE; -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/int10Defines.h b/nx-X11/programs/Xserver/hw/xfree86/os-support/int10Defines.h deleted file mode 100644 index 56e10cf67..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/int10Defines.h +++ /dev/null @@ -1,90 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h,v 1.4 2003/08/24 17:37:03 dawes Exp $ */ -/* - * Copyright (c) 2000-2001 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef _INT10DEFINES_H_ -#define _INT10DEFINES_H_ 1 - -#ifdef _VM86_LINUX - -#include - -#define CPU_R(type,name,num) \ - (((type *)&(((struct vm86_struct *)REG->cpuRegs)->regs.name))[num]) -#define CPU_RD(name,num) CPU_R(CARD32,name,num) -#define CPU_RW(name,num) CPU_R(CARD16,name,num) -#define CPU_RB(name,num) CPU_R(CARD8,name,num) - -#define X86_EAX CPU_RD(eax,0) -#define X86_EBX CPU_RD(ebx,0) -#define X86_ECX CPU_RD(ecx,0) -#define X86_EDX CPU_RD(edx,0) -#define X86_ESI CPU_RD(esi,0) -#define X86_EDI CPU_RD(edi,0) -#define X86_EBP CPU_RD(ebp,0) -#define X86_EIP CPU_RD(eip,0) -#define X86_ESP CPU_RD(esp,0) -#define X86_EFLAGS CPU_RD(eflags,0) - -#define X86_FLAGS CPU_RW(eflags,0) -#define X86_AX CPU_RW(eax,0) -#define X86_BX CPU_RW(ebx,0) -#define X86_CX CPU_RW(ecx,0) -#define X86_DX CPU_RW(edx,0) -#define X86_SI CPU_RW(esi,0) -#define X86_DI CPU_RW(edi,0) -#define X86_BP CPU_RW(ebp,0) -#define X86_IP CPU_RW(eip,0) -#define X86_SP CPU_RW(esp,0) -#define X86_CS CPU_RW(cs,0) -#define X86_DS CPU_RW(ds,0) -#define X86_ES CPU_RW(es,0) -#define X86_SS CPU_RW(ss,0) -#define X86_FS CPU_RW(fs,0) -#define X86_GS CPU_RW(gs,0) - -#define X86_AL CPU_RB(eax,0) -#define X86_BL CPU_RB(ebx,0) -#define X86_CL CPU_RB(ecx,0) -#define X86_DL CPU_RB(edx,0) - -#define X86_AH CPU_RB(eax,1) -#define X86_BH CPU_RB(ebx,1) -#define X86_CH CPU_RB(ecx,1) -#define X86_DH CPU_RB(edx,1) - -#elif defined(_X86EMU) - -#include "xf86x86emu.h" - -#endif - -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/Imakefile deleted file mode 100644 index 8ef246842..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/Imakefile +++ /dev/null @@ -1,142 +0,0 @@ -XCOMM $XConsortium: Imakefile /main/10 1996/10/19 18:06:19 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/Imakefile,v 3.45 2002/09/16 18:06:13 eich Exp $ - -#include - -#if BuildXInputExt -# if JoystickSupport - JOYSTICK_SRC = lnx_jstk.c -# endif -# if DoLoadableServer -SHARED_CFLAGS = PositionIndependentCFlags -# else -# if JoystickSupport - JOYSTICK_OBJ = lnx_jstk.o -# endif -# endif -#endif - -#if HasMTRRSupport -MTRRDEFINES = -DHAS_MTRR_SUPPORT -#endif - -DRI_SRC = sigio.c -DRI_OBJ = sigio.o - -MOUSESRC = lnx_mouse.c -MOUSEOBJ = lnx_mouse.o - -KBDSRC = lnx_kbd.c lnx_KbdMap.c at_scancode.c -KBDOBJ = lnx_kbd.o lnx_KbdMap.o at_scancode.o - -#if defined(i386Architecture) || defined(ia64Architecture) || defined(AMD64Architecture) -RES_SRCS=stdResource.c -RES_OBJS=stdResource.o -#else -RES_SRCS=lnxResource.c -RES_OBJS=lnxResource.o -#endif - -#if defined(AlphaArchitecture) -PLATFORM_SRC=lnx_ev56.c xf86Axp.c lnx_axp.c -PLATFORM_OBJ=lnx_ev56.o xf86Axp.o lnx_axp.o -#endif -#if defined (ia64Architecture) -PLATFORM_SRC=ia64Pci.c lnx_ia64.c -PLATFORM_OBJ=ia64Pci.o lnx_ia64.o -PLATFORM_DEFINES=-DOS_PROBE_PCI_CHIPSET=lnxProbePciChipset -#endif - -#if DoOSFontRestore -FONTSRC=lnx_font.c -FONTOBJ=lnx_font.o -# ifndef FontRestoreCheckOsVersion -# define FontRestoreCheckOsVersion YES -# endif -FONT_DEFINES=-DDO_OS_FONTRESTORE -DCHECK_OS_VERSION=FontRestoreCheckOsVersion -#endif - -SRCS = lnx_init.c lnx_video.c lnx_io.c libc_wrapper.c bios_mmap.c \ - VTsw_usl.c std_kbdEv.c posix_tty.c lnx_acpi.c $(MOUSESRC) \ - lnx_pci.c vidmem.c lnx_apm.c $(JOYSTICK_SRC) $(DRI_SRC) $(RES_SRCS) \ - $(PLATFORM_SRC) lnx_kmod.c lnx_agp.c $(FONTSRC) $(KBDSRC) /*wcHelper.c*/ - -OBJS = lnx_init.o lnx_video.o lnx_io.o libc_wrapper.o bios_mmap.o \ - VTsw_usl.o std_kbdEv.o posix_tty.o lnx_acpi.o $(MOUSEOBJ) \ - lnx_pci.o vidmem.o lnx_apm.o $(JOYSTICK_OBJ) $(DRI_OBJ) $(RES_OBJS) \ - $(PLATFORM_OBJ) lnx_kmod.o lnx_agp.o $(FONTOBJ) $(KBDOBJ) /*wcHelper.o*/ - -INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(XF86OSSRC)/shared \ - -I$(XF86OSSRC)/bus -I$(DRMSRCDIR)/shared-core - -RESDEFINES = -DUSESTDRES - -DEFINES = $(MTRRDEFINES) $(RESDEFINES) $(PLATFORM_DEFINES) $(FONT_DEFINES) -DHAVE_SYSV_IPC - -#if defined(AlphaArchitecture) -SpecialObjectRule(lnx_ev56.o, lnx_ev56.c, -mcpu=ev56) -#endif - -#if DoOSFontRestore -SpecialObjectRule(VTsw_usl.o, VTsw_usl.c, -DOSHEADER=\"lnx.h\" -DOSSWITCHAWAY="lnx_switchaway()") -#endif - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() - -#if BuildXF86DRI -DRISUBDIR = drm -#endif -TESTVAR = XF86INT10_BUILD - -#if XF86INT10_BUILD > X86EMU_GENERIC -INT10SUBDIR = int10 -#endif - -#if BuildXF86DRI || (XF86INT10_BUILD > X86EMU_GENERIC) -#define IHaveSubdirs -SUBDIRS = $(DRISUBDIR) $(INT10SUBDIR) -#endif - -#ifdef IHaveSubdirs -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) -#endif - -#if BuildXInputExt -# if DoLoadableServer -# if JoystickSupport -AllTarget(lnx_jstk.o) -#if 0 -InstallDynamicModule(lnx_jstk.o,$(MODULEDIR),input) -#endif -# endif -# endif -#endif - -LinkSourceFile(bios_mmap.c,../shared) -LinkSourceFile(std_kbdEv.c,../shared) -LinkSourceFile(at_scancode.c,../shared) -LinkSourceFile(posix_tty.c,../shared) -LinkSourceFile(libc_wrapper.c,../shared) -LinkSourceFile(vidmem.c,../shared) -LinkSourceFile(VTsw_usl.c,../shared) -LinkSourceFile(kmod_noop.c,../shared) - -LinkSourceFile($(DRI_SRC),../shared) - -#if defined(i386Architecture) || defined(ia64Architecture) || defined (AMD64Architecture) -LinkSourceFile(stdResource.c,../shared) -#endif -#if defined(AlphaArchitecture) -LinkSourceFile(xf86Axp.c,../shared) -#endif -#if defined(ia64Architecture) -LinkSourceFile(ia64Pci.c,../shared) -#endif -DependTarget() - -#if 0 -InstallDriverSDKDynamicModule(lnx_jstk.o,$(DRIVERSDKMODULEDIR)) -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile deleted file mode 100644 index 54511fbe0..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile +++ /dev/null @@ -1,64 +0,0 @@ -XCOMM $XFree86: Imakefile,v 1.13 2002/10/30 12:52:32 alanh Exp $ - -#define IHaveModules -#include - -#if DoLoadableServer -MSRC = drmmodule.c -MOBJ = drmmodule.o -#endif - -#if BuildXF86DRI -#if HasMTRRSupport -MTRR_DEFINES = -DHAS_MTRR_SUPPORT -#endif - - SRCS = xf86drm.c \ - xf86drmHash.c \ - xf86drmRandom.c \ - xf86drmSL.c \ - $(MSRC) - - OBJS = xf86drm.o \ - xf86drmHash.o \ - xf86drmRandom.o \ - xf86drmSL.o \ - $(MOBJ) - -INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) -I$(EXTINCSRC) -I../.. -I$(DRMSRCDIR)/linux-core \ - -I$(DRMSRCDIR)/shared-core - -DEFINES = $(MTRR_DEFINES) $(GLX_DEFINES) - -LIBDRM_DIR = ../../../../../../../extras/drm/libdrm - -LinkSourceFile(xf86drm.c,$(LIBDRM_DIR)) -LinkSourceFile(xf86drmHash.c,$(LIBDRM_DIR)) -LinkSourceFile(xf86drmRandom.c,$(LIBDRM_DIR)) -LinkSourceFile(xf86drmSL.c,$(LIBDRM_DIR)) - -#if DoLoadableServer - -ModuleObjectRule() -LibraryModuleTarget(drm,$(OBJS)) -NormalLintTarget($(SRCS)) - -#ifdef LinuxArchitecture -InstallLibraryModule(drm,$(MODULEDIR),linux) -#endif - -#else - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() - -#endif - - -DependTarget() -#endif - - - -InstallDriverSDKLibraryModule(drm,$(DRIVERSDKMODULEDIR),linux) diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/drm/drmmodule.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/drm/drmmodule.c deleted file mode 100644 index fd751e756..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/drm/drmmodule.c +++ /dev/null @@ -1,60 +0,0 @@ -/* drmmodule.c -- Module initialization - * Created: Fri Jun 4 09:05:48 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: Rickard E. (Rik) Faith - * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/drmmodule.c,v 1.2 2000/02/23 04:47:22 martin Exp $ - * - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86Module.h" - -static MODULESETUPPROTO(drmSetup); - -static XF86ModuleVersionInfo VersRec = -{ - "drm", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_EXTENSION, - ABI_EXTENSION_VERSION, - MOD_CLASS_NONE, - {0,0,0,0} -}; - -XF86ModuleData drmModuleData = { &VersRec, drmSetup, NULL }; - -static pointer -drmSetup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - return (void *)1; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile deleted file mode 100644 index 6a23e75e5..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile +++ /dev/null @@ -1,77 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/Imakefile,v 1.15 2003/06/12 14:12:36 eich Exp $ - -#define IHaveModules - -#include - -#define IHaveSubdirs - - -#if defined(XF86INT10_BUILD) && \ - ( !defined(DoLoadableServer) || !defined(Int10SubLibs)) -#define DoSingleLib -# if XF86INT10_BUILD == X86VM -EXPOBJS = vm86/helper_exec.o vm86/linux_vm86.o vm86/xf86int10.o -SUBDIRS = vm86 -# elif XF86INT10_BUILD == X86EMU_OS -EXPOBJS = x86emu/x86emu.o x86emu/xf86int10.o x86emu/helper_exec.o \ - x86emu/xf86x86emu.o -SUBDIRS = x86emu -# endif -#else -SUBDIRS = vm86 x86emu -LNXDEF = -DDoSubModules -#endif - - -#ifdef IHaveSubdirs -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) -#endif - -SRCS = pci.c xf86int10module.c helper_mem.c linux.c -OBJS = pci.o xf86int10module.o helper_mem.o linux.o - - -LinkSourceFile(helper_mem.c,$(XF86SRC)/int10) -LinkSourceFile(pci.c,$(XF86SRC)/int10) -LinkSourceFile(xf86int10module.c,$(XF86SRC)/int10) - - -INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/int10 \ - -I$(XF86OSSRC) \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(X86EMUINCLUDES) - -DEFINES=-DHAVE_SYSV_IPC $(X86EMUDEFINES) $(EXTRADEFINES) - -#if defined(i386Architecture) || defined (AMD64Architecture) -EXTRADEFINES=-D_PC -#endif - - -SpecialObjectRule(linux.o, linux.c, -DHAVE_SYSV_IPC $(LNXDEF)) - - -#if defined(XF86INT10_BUILD) && XF86INT10_BUILD > X86EMU_GENERIC - -ModuleObjectRule() - -#if HasParallelMake && defined (DoSingleLib) -MakeMutex($(SUBDIRS) $(EXPOBJS) $(DONES)) -#endif - -LibraryModuleTarget(int10, $(OBJS) $(EXPOBJS)) - -InstallLibraryModule(int10,$(MODULEDIR),linux) - -all:: - @(set -x; cd ../..; \ - RemoveFile(LibraryTargetName(int10)); \ - $(LN) linux/int10/LibraryTargetName(int10) . ) - -InstallDriverSDKLibraryModule(int10,$(DRIVERSDKMODULEDIR),.) - -#endif - -DependTarget() - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c deleted file mode 100644 index b8e821cd1..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c +++ /dev/null @@ -1,649 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.32 2004/02/05 18:24:59 eich Exp $ */ -/* - * linux specific part of the int10 module - * Copyright 1999, 2000, 2001, 2002, 2003, 2004 Egbert Eich - */ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86_ansic.h" -#include "xf86Pci.h" -#include "compiler.h" -#define _INT10_PRIVATE -#include "xf86int10.h" -#ifdef __sparc__ -#define DEV_MEM "/dev/fb" -#else -#define DEV_MEM "/dev/mem" -#endif -#ifndef XFree86LOADER -#include -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif -#endif -#define ALLOC_ENTRIES(x) ((V_RAM / x) - 1) -#define SHMERRORPTR (pointer)(-1) - -static int counter = 0; -static unsigned long int10Generation = 0; - -static CARD8 read_b(xf86Int10InfoPtr pInt, int addr); -static CARD16 read_w(xf86Int10InfoPtr pInt, int addr); -static CARD32 read_l(xf86Int10InfoPtr pInt, int addr); -static void write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val); -static void write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val); -static void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val); - -int10MemRec linuxMem = { - read_b, - read_w, - read_l, - write_b, - write_w, - write_l -}; - -typedef struct { - int lowMem; - int highMem; - char* base; - char* base_high; - int screen; - char* alloc; -} linuxInt10Priv; - -#if defined DoSubModules - -typedef enum { - INT10_NOT_LOADED, - INT10_LOADED_VM86, - INT10_LOADED_X86EMU, - INT10_LOAD_FAILED -} Int10LinuxSubModuleState; - -static Int10LinuxSubModuleState loadedSubModule = INT10_NOT_LOADED; - -static Int10LinuxSubModuleState int10LinuxLoadSubModule(ScrnInfoPtr pScrn); - -#endif /* DoSubModules */ - -xf86Int10InfoPtr -xf86InitInt10(int entityIndex) -{ - return xf86ExtendedInitInt10(entityIndex, 0); -} - -xf86Int10InfoPtr -xf86ExtendedInitInt10(int entityIndex, int Flags) -{ - xf86Int10InfoPtr pInt = NULL; - CARD8 *bios_base; - int screen; - int fd; - 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; - memType cs; - legacyVGARec vga; - xf86int10BiosLocation bios; - Bool videoBiosMapped = FALSE; - - if (int10Generation != serverGeneration) { - counter = 0; - int10Generation = serverGeneration; - } - - screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex; - - options = xf86HandleInt10Options(xf86Screens[screen],entityIndex); - - if (int10skip(options)) { - xfree(options); - return NULL; - } - -#if defined DoSubModules - if (loadedSubModule == INT10_NOT_LOADED) - loadedSubModule = int10LinuxLoadSubModule(xf86Screens[screen]); - - if (loadedSubModule == INT10_LOAD_FAILED) - return NULL; -#endif - - if ((!vidMem) || (!sysMem)) { - if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) { - if (!sysMem) { -#ifdef DEBUG - ErrorF("Mapping sys bios area\n"); -#endif - 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) { -#ifdef DEBUG - ErrorF("Mapping VRAM area\n"); -#endif - 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->scrnIndex = screen; - pInt->entityIndex = entityIndex; - if (!xf86Int10ExecSetup(pInt)) - 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)); - - if (!xf86IsEntityPrimary(entityIndex)) { -#ifdef DEBUG - ErrorF("Mapping high memory area\n"); -#endif - 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 { -#ifdef DEBUG - ErrorF("Mapping Video BIOS\n"); -#endif - 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; - -#ifdef DEBUG - ErrorF("Mapping 640kB area\n"); -#endif - 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; - base = shmat(low_mem, 0, 0); - if (base == SHMERRORPTR) { - xf86DrvMsg(screen, X_ERROR, - "shmat(low_mem) error: %s\n",strerror(errno)); - goto error3; - } - ((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; - - if (!MapCurrentInt10(pInt)) - goto error3; - - Int10Current = pInt; - -#ifdef DEBUG - ErrorF("Mapping int area\n"); -#endif - if (xf86ReadBIOS(0, 0, (unsigned char *)0, LOW_PAGE_SIZE) < 0) { - xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n"); - goto error3; - } -#ifdef DEBUG - ErrorF("done\n"); -#endif - /* - * Read in everything between V_BIOS and SYS_BIOS as some system BIOSes - * have executable code there. Note that xf86ReadBIOS() can only bring in - * 64K bytes at a time. - */ - if (!videoBiosMapped) { - (void)memset((pointer)V_BIOS, 0, SYS_BIOS - V_BIOS); -#ifdef DEBUG - ErrorF("Reading BIOS\n"); -#endif - 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", cs); -#ifdef DEBUG - ErrorF("done\n"); -#endif - } - - xf86int10ParseBiosLocation(options,&bios); - - if (xf86IsEntityPrimary(entityIndex) - && !(initPrimary(options))) { - if (bios.bus == BUS_ISA && bios.location.legacy) { - xf86DrvMsg(screen, X_CONFIG, - "Overriding BIOS location: 0x%x\n", - bios.location.legacy); - cs = bios.location.legacy >> 4; - bios_base = (unsigned char *)(cs << 4); - if (!int10_check_bios(screen, cs, bios_base)) { - xf86DrvMsg(screen, X_ERROR, - "No V_BIOS at specified address 0x%lx\n",cs << 4); - goto error3; - } - } else { - if (bios.bus == BUS_PCI) { - xf86DrvMsg(screen, X_WARNING, - "Option BiosLocation for primary device ignored: " - "It points to PCI.\n"); - xf86DrvMsg(screen, X_WARNING, - "You must set Option InitPrimary also\n"); - } - - cs = ((CARD16*)0)[(0x10<<1) + 1]; - - bios_base = (unsigned char *)(cs << 4); - - if (!int10_check_bios(screen, cs, bios_base)) { - cs = ((CARD16*)0)[(0x42 << 1) + 1]; - bios_base = (unsigned char *)(cs << 4); - if (!int10_check_bios(screen, cs, bios_base)) { - cs = V_BIOS >> 4; - bios_base = (unsigned char *)(cs << 4); - if (!int10_check_bios(screen, cs, bios_base)) { - xf86DrvMsg(screen, X_ERROR, "No V_BIOS found\n"); - goto error3; - } - } - } - } - - xf86DrvMsg(screen, X_INFO, "Primary V_BIOS segment is: 0x%lx\n", cs); - - pInt->BIOSseg = cs; - 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 { - EntityInfoPtr pEnt = xf86GetEntityInfo(pInt->entityIndex); - BusType location_type; - - if (bios.bus != BUS_NONE) { - switch (location_type = bios.bus) { - case BUS_PCI: - xf86DrvMsg(screen,X_CONFIG,"Overriding bios location: " - "PCI:%i:%i%i\n",bios.location.pci.bus, - bios.location.pci.dev,bios.location.pci.func); - break; - case BUS_ISA: - if (bios.location.legacy) - xf86DrvMsg(screen,X_CONFIG,"Overriding bios location: " - "Legacy:0x%x\n",bios.location.legacy); - else - xf86DrvMsg(screen,X_CONFIG,"Overriding bios location: " - "Legacy\n"); - break; - default: - break; - } - } else - location_type = pEnt->location.type; - - switch (location_type) { - case BUS_PCI: - { - int pci_entity; - - if (bios.bus == BUS_PCI) - pci_entity = xf86GetPciEntity(bios.location.pci.bus, - bios.location.pci.dev, - bios.location.pci.func); - else - pci_entity = pInt->entityIndex; - if (!mapPciRom(pci_entity, (unsigned char *)(V_BIOS))) { - xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS\n"); - goto error3; - } - pInt->BIOSseg = V_BIOS >> 4; - break; - } - case BUS_ISA: - if (bios.bus == BUS_ISA && bios.location.legacy) { - cs = bios.location.legacy >> 4; - bios_base = (unsigned char *)(cs << 4); - if (!int10_check_bios(screen, cs, bios_base)) { - xf86DrvMsg(screen,X_ERROR,"No V_BIOS found " - "on override address %p\n",bios_base); - goto error3; - } - } else { - cs = ((CARD16*)0)[(0x10<<1)+1]; - bios_base = (unsigned char *)(cs << 4); - - if (!int10_check_bios(screen, cs, bios_base)) { - cs = ((CARD16*)0)[(0x42<<1)+1]; - bios_base = (unsigned char *)(cs << 4); - if (!int10_check_bios(screen, cs, bios_base)) { - cs = V_BIOS >> 4; - bios_base = (unsigned char *)(cs << 4); - if (!int10_check_bios(screen, cs, bios_base)) { - xf86DrvMsg(screen,X_ERROR,"No V_BIOS found\n"); - goto error3; - } - } - } - } - xf86DrvMsg(screen,X_INFO,"Primary V_BIOS segment is: 0x%lx\n",cs); - pInt->BIOSseg = cs; - break; - default: - goto error3; - } - xfree(pEnt); - pInt->num = 0xe6; - reset_int_vect(pInt); - set_return_trap(pInt); - LockLegacyVGA(pInt, &vga); - xf86ExecX86int10(pInt); - UnlockLegacyVGA(pInt, &vga); - } -#ifdef DEBUG - dprint(0xc0000, 0x20); -#endif - - xfree(options); - return pInt; - -error3: - if (base_high) - shmdt(base_high); - shmdt(base); - shmdt(0); - if (base_high) - shmdt((char*)HIGH_MEM); - shmctl(low_mem, IPC_RMID, NULL); - Int10Current = NULL; -error2: - if (high_mem > -1) - shmctl(high_mem, IPC_RMID,NULL); -error1: - if (vMem) - munmap(vMem, SYS_BIOS - V_BIOS); - xfree(((linuxInt10Priv*)pInt->private)->alloc); - xfree(pInt->private); -error0: - xfree(options); - xfree(pInt); - return NULL; -} - -Bool -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)); - } - 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; - } - - 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; - } - } 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; -} - -void -xf86FreeInt10(xf86Int10InfoPtr pInt) -{ - if (!pInt) - return; - -#ifdef _PC - 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; - } - - 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); - xfree(((linuxInt10Priv*)pInt->private)->alloc); - xfree(pInt->private); - xfree(pInt); -} - -void * -xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off) -{ - int pagesize = getpagesize(); - int num_pages = ALLOC_ENTRIES(pagesize); - 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 (i == (num_pages - num)) - return NULL; - - for (j = i; j < (i + num); j++) - ((linuxInt10Priv*)pInt->private)->alloc[j] = 1; - - *off = (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 i; - - for (i = first; i < (first + num); i++) - ((linuxInt10Priv*)pInt->private)->alloc[i] = 0; -} - -static CARD8 -read_b(xf86Int10InfoPtr pInt, int addr) -{ - return *((CARD8 *)(memType)addr); -} - -static CARD16 -read_w(xf86Int10InfoPtr pInt, int addr) -{ - return *((CARD16 *)(memType)addr); -} - -static CARD32 -read_l(xf86Int10InfoPtr pInt, int addr) -{ - return *((CARD32 *)(memType)addr); -} - -static void -write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val) -{ - *((CARD8 *)(memType)addr) = val; -} - -static void -write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val) -{ - *((CARD16 *)(memType)addr) = val; -} - -static -void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val) -{ - *((CARD32 *)(memType) addr) = val; -} - -pointer -xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr) -{ - if (addr < V_RAM) - return ((linuxInt10Priv*)pInt->private)->base + addr; - else if (addr < V_BIOS) - 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 defined DoSubModules - -static Bool -vm86_tst(void) -{ - int __res; - -#ifdef __PIC__ - /* 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)); -#else - __asm__ __volatile__("int $0x80\n\t" - :"=a" (__res):"a" ((int)113), - "b" ((struct vm86_struct *)NULL)); -#endif - - if (__res < 0 && __res == -ENOSYS) - return FALSE; - - return TRUE; -} - -static Int10LinuxSubModuleState -int10LinuxLoadSubModule(ScrnInfoPtr pScrn) -{ - if (vm86_tst()) { - if (xf86LoadSubModule(pScrn,"vm86")) - return INT10_LOADED_VM86; - } - if (xf86LoadSubModule(pScrn,"x86emu")) - return INT10_LOADED_X86EMU; - - return INT10_LOAD_FAILED; -} - -#endif /* DoSubModules */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/vm86/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/vm86/Imakefile deleted file mode 100644 index 522369894..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/vm86/Imakefile +++ /dev/null @@ -1,55 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/vm86/Imakefile,v 1.2 2003/06/12 14:12:37 eich Exp $ - -#define IHaveModules - -#include - -SRCS1 = linux_vm86.c helper_exec.c xf86int10.c -OBJS1 = linux_vm86.o helper_exec.o xf86int10.o - -#if defined(DoLoadableServer) && defined(Int10SubLibs) -SUBMODSRCS = xf86vm86module.c -SUBMODOBJS = xf86vm86module.o -#endif - -OBJS = $(SUBMODOBJS) $(OBJS1) -SRCS = $(SUBMODSRCS) $(SRCS1) - -LinkSourceFile(helper_exec.c,$(XF86SRC)/int10) -LinkSourceFile(xf86int10.c,$(XF86SRC)/int10) -LinkFile(xf86vm86module.c,$(XF86SRC)/int10/xf86int10module.c) - - -INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/int10 \ - -I$(XF86OSSRC) \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(X86EMUINCLUDES) - -DEFINES=-DHAVE_SYSV_IPC $(X86EMUDEFINES) $(EXTRADEFINES) - -#if defined(i386Architecture) || defined (AMD64Architecture) -EXTRADEFINES=-D_PC -#endif - -SpecialObjectRule(xf86vm86module.o, xf86vm86module.c, -DMOD_NAME=vm86) -SpecialObjectRule(helper_exec.o, helper_exec.c, -D_VM86_LINUX) -SpecialObjectRule(xf86int10.o, xf86int10.c, -D_VM86_LINUX -DSHOW_ALL_DEVICES) -SpecialObjectRule(linux_vm86.o, linux_vm86.c, -D_VM86_LINUX) - -ModuleObjectRule() - -#if defined(DoLoadableServer) && defined(Int10SubLibs) -LibraryModuleTarget(vm86, $(OBJS)) -InstallLibraryModule(vm86,$(MODULEDIR),linux) - -all:: - @(set -x; cd ../..; \ - RemoveFile(LibraryTargetName(vm86)); \ - $(LN) linux/int10/vm86/LibraryTargetName(vm86) . ) - -InstallDriverSDKLibraryModule(vm86,$(DRIVERSDKMODULEDIR),.) -#else -SubdirLibraryRule($(OBJS)) -#endif - -DependTarget() - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c deleted file mode 100644 index e99cde8da..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c +++ /dev/null @@ -1,302 +0,0 @@ -/* $XFree86$ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86_ansic.h" -#include "xf86Pci.h" -#include "compiler.h" -#define _INT10_PRIVATE -#include "xf86int10.h" - -#define REG pInt - -#ifdef _VM86_LINUX -#include "int10Defines.h" - -static int vm86_rep(struct vm86_struct *ptr); -static struct vm86_struct vm86_s; - -Bool -xf86Int10ExecSetup(xf86Int10InfoPtr pInt) -{ -#define VM86S ((struct vm86_struct *)pInt->cpuRegs) - - pInt->cpuRegs = &vm86_s; - VM86S->flags = 0; - VM86S->screen_bitmap = 0; - VM86S->cpu_type = CPU_586; - memset(&VM86S->int_revectored, 0xff, sizeof(VM86S->int_revectored)); - memset(&VM86S->int21_revectored, 0xff, sizeof(VM86S->int21_revectored)); - return TRUE; -} - -/* get the linear address */ -#define LIN_PREF_SI ((pref_seg << 4) + X86_SI) -#define LWECX ((prefix66 ^ prefix67) ? X86_ECX : X86_CX) -#define LWECX_ZERO {if (prefix66 ^ prefix67) X86_ECX = 0; else X86_CX = 0;} -#define DF (1 << 10) - -/* vm86 fault handling */ -static Bool -vm86_GP_fault(xf86Int10InfoPtr pInt) -{ - unsigned char *csp, *lina; - CARD32 org_eip; - int pref_seg; - int done, is_rep, prefix66, prefix67; - - csp = lina = SEG_ADR((unsigned char *), X86_CS, IP); - - is_rep = 0; - prefix66 = prefix67 = 0; - pref_seg = -1; - - /* 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; - } - } while (!done); - 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; - - case 0xf4: -#ifdef DEBUG - ErrorF("hlt at %p\n", lina); -#endif - 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; - - 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; - } /* end of switch() */ - return TRUE; -} - -static int -do_vm86(xf86Int10InfoPtr pInt) -{ - int retval, signo; - - xf86InterceptSignals(&signo); - retval = vm86_rep(VM86S); - 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; - } - - switch (VM86_TYPE(retval)) { - case VM86_UNKNOWN: - 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; - 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; - 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; - 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; - } - - return 1; -} - -void -xf86ExecX86int10(xf86Int10InfoPtr pInt) -{ - int sig = setup_int(pInt); - - if (int_handler(pInt)) - while(do_vm86(pInt)) {}; - - finish_int(pInt, sig); -} - -static int -vm86_rep(struct vm86_struct *ptr) -{ - int __res; - -#ifdef __PIC__ - /* 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)); -#else - __asm__ __volatile__("push %%gs\n\t" - "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; -} - -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/x86emu/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/x86emu/Imakefile deleted file mode 100644 index 8a0dc4463..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/int10/x86emu/Imakefile +++ /dev/null @@ -1,86 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/x86emu/Imakefile,v 1.2 2003/06/12 14:12:37 eich Exp $ - -#define IHaveModules - -#include - -SRCS1 = xf86x86emu.c helper_exec.c xf86int10.c -OBJS1 = xf86x86emu.o helper_exec.o xf86int10.o - -#if defined(DoLoadableServer) && defined(Int10SubLibs) -SUBMODSRCS = xf86x86emumodule.c -SUBMODOBJS = xf86x86emumodule.o -#endif - -SRCS2 = $(SUBMODSRCS) $(SRCS1) -OBJS2 = $(SUBMODOBJS) $(OBJS1) - -LinkSourceFile(helper_exec.c,$(XF86SRC)/int10) -LinkSourceFile(xf86int10.c,$(XF86SRC)/int10) -LinkSourceFile(xf86x86emu.c,$(XF86SRC)/int10) -LinkFile(xf86x86emumodule.c,$(XF86SRC)/int10/xf86int10module.c) - - -INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/int10 \ - -I$(XF86OSSRC) \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(X86EMUINCLUDES) - -DEFINES=-DHAVE_SYSV_IPC $(X86EMUDEFINES) $(EXTRADEFINES) - -#if defined(i386Architecture) || defined (AMD64Architecture) -EXTRADEFINES=-D_PC -#endif - -SpecialObjectRule(xf86x86emumodule.o, xf86x86emumodule.c, -DMOD_NAME=x86emu) -SpecialObjectRule(helper_exec.o, helper_exec.c, -D_X86EMU) -SpecialObjectRule(xf86int10.o, xf86int10.c, -D_X86EMU -DSHOW_ALL_DEVICES) -SpecialObjectRule(linux.o, linux.c, -D_X86EMU -DHAVE_SYSV_IPC) - -X86TOPDIR = $(TOP)/extras/x86emu -X86SRCDIR = $(X86TOPDIR)/src/x86emu -X86EMUINCLUDES = $(X86TOPDIR)/include -I$(X86SRCDIR) -# if DoLoadableServer -X86EMUMODDEFS = -DNO_SYS_HEADERS -# endif - -X86EMUDEFINES = -D__DRIVER__ -DFORCE_POST -D_CEXPORT= -DNO_LONG_LONG $(X86EMUMODDEFS) - -#if !defined(X86EMU_LIBPATH) -X86EMUSRCS = x86emu.c -X86EMUOBJS = x86emu.o - -LinkSourceFile(x86emu.c,$(XF86SRC)/int10) -LinkSourceFile(debug.c,$(X86SRCDIR)) -LinkSourceFile(decode.c,$(X86SRCDIR)) -LinkSourceFile(fpu.c,$(X86SRCDIR)) -LinkSourceFile(ops.c,$(X86SRCDIR)) -LinkSourceFile(ops2.c,$(X86SRCDIR)) -LinkSourceFile(prim_ops.c,$(X86SRCDIR)) -LinkSourceFile(sys.c,$(X86SRCDIR)) -#else -BuildObjectFromLibraryWithPath(X86EMU_LIBPATH,x86emu,x86emu) -X86EMUOBJS = x86emu.o -#endif - -SRCS = $(SRCS2) $(X86EMUSRCS) -OBJS = $(OBJS2) $(X86EMUOBJS) - -ModuleObjectRule() - -#if defined(DoLoadableServer) && defined(Int10SubLibs) -LibraryModuleTarget(x86emu, $(OBJS)) - -InstallLibraryModule(x86emu,$(MODULEDIR),linux) - -all:: - @(set -x; cd ../..; \ - RemoveFile(LibraryTargetName(x86emu)); \ - $(LN) linux/int10/x86emu/LibraryTargetName(x86emu) . ) - -InstallDriverSDKLibraryModule(x86emu,$(DRIVERSDKMODULEDIR),.) -#else -SubdirLibraryRule($(OBJS)) -#endif - -DependTarget() - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx.h b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx.h deleted file mode 100644 index 68ad34011..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx.h +++ /dev/null @@ -1,55 +0,0 @@ -/* $XFree86: Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef LNX_H_ -# ifdef __alpha__ -extern unsigned long _bus_base __P ((void)) __attribute__ ((const)); -extern unsigned long _bus_base_sparse __P ((void)) __attribute__ ((const)); -extern int iopl __P ((int __level)); - -/* new pciconfig_iobase syscall added in 2.2.15 and 2.3.99 */ -# include -# include -extern long (*_iobase)(unsigned, int, int, int); - -/* - * _iobase deals with the case the __NR_pciconfig_iobase is either undefined - * or unsupported by the kernel, but we need to make sure that the `which' - * argument symbols are defined. - */ -# ifndef IOBASE_HOSE -# define IOBASE_HOSE 0 -# endif -# ifndef IOBASE_SPARSE_MEM -# define IOBASE_SPARSE_MEM 1 -# endif -# ifndef IOBASE_DENSE_MEM -# define IOBASE_DENSE_MEM 2 -# endif -# ifndef IOBASE_SPARSE_IO -# define IOBASE_SPARSE_IO 3 -# endif -# ifndef IOBASE_DENSE_IO -# define IOBASE_DENSE_IO 4 -# endif -# ifndef IOBASE_ROOT_BUS -# define IOBASE_ROOT_BUS 5 -# endif -# ifndef IOBASE_FROM_HOSE -# define IOBASE_FROM_HOSE 0x10000 -# endif -# endif /* __alpha__ */ - -# if defined(DO_OS_FONTRESTORE) -Bool lnx_savefont(void); -Bool lnx_restorefont(void); -Bool lnx_switchaway(void); -void lnx_freefontdata(void); -# endif - -#define LNX_H_ - -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c deleted file mode 100644 index 690d3bc8f..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c +++ /dev/null @@ -1,291 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v 3.18 2002/01/25 21:56:19 tsi Exp $ */ - -/* Resource information code */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Privstr.h" -#include "xf86Pci.h" -#include "xf86Resources.h" -#define NEED_OS_RAC_PROTOS -#include "xf86_OSlib.h" -#include "lnx.h" - -/* Avoid Imakefile changes */ -#include "bus/Pci.h" - -resRange PciAvoid[] = -{ -#if !defined(__sparc__) || !defined(INCLUDE_XF86_NO_DOMAIN) - _PCI_AVOID_PC_STYLE, -#endif - _END -}; - -#ifdef INCLUDE_XF86_NO_DOMAIN - -#ifdef __alpha__ - -resPtr -xf86BusAccWindowsFromOS(void) -{ - resPtr ret = NULL; - resRange range; - - RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - - RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - return ret; -} - -resPtr -xf86PciBusAccWindowsFromOS(void) -{ - resPtr ret = NULL; - resRange range; - /* - * On the Alpha the first 16MB of every 128 Mb segment in - * sparse address space are an image of the ISA bus range - */ - if (_bus_base_sparse()) { - RANGE(range, 0x00000000, 0x07ffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x09000000, 0x0fffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x11000000, 0x17ffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x19000000, 0x1fffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x21000000, 0x27ffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x29000000, 0x2fffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x31000000, 0x37ffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x39000000, 0x3fffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x41000000, 0x47ffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x49000000, 0x4fffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x51000000, 0x57ffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x59000000, 0x5fffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x61000000, 0x67ffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x69000000, 0x6fffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x71000000, 0x77ffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x79000000, 0x7fffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x81000000, 0x87ffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x89000000, 0x8fffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x91000000, 0x97ffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x99000000, 0x9fffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xa1000000, 0xa7ffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xa9000000, 0xafffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xb1000000, 0xb7ffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xb9000000, 0xbfffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xc1000000, 0xc7ffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xc9000000, 0xcfffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xd1000000, 0xd7ffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xd9000000, 0xdfffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xe1000000, 0xe7ffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xe9000000, 0xefffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xf1000000, 0xf7ffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xf9000000, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - } else { - RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - } - RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - return ret; -} - -#ifdef INCLUDE_UNUSED - -resPtr -xf86IsaBusAccWindowsFromOS(void) -{ - resPtr ret = NULL; - resRange range; - - RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - - RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - return ret; -} - -#endif /* INCLUDE_UNUSED */ - -resPtr -xf86AccResFromOS(resPtr ret) -{ - resRange range; - - /* - * Fallback is to claim the following areas: - * - * 0x000c0000 - 0x000effff location of VGA and other extensions ROMS - */ - - RANGE(range, 0x000c0000, 0x000effff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - - /* - * Fallback would be to claim well known ports in the 0x0 - 0x3ff range - * along with their sparse I/O aliases, but that's too imprecise. Instead - * claim a bare minimum here. - */ - RANGE(range, 0x00000000, 0x000000ff, ResExcIoBlock); /* For mainboard */ - ret = xf86AddResToList(ret, &range, -1); - - /* - * At minimum, the top and bottom resources must be claimed, so that - * resources that are (or appear to be) unallocated can be relocated. - */ - RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); -/* RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); */ - RANGE(range, 0xffffffff, 0xffffffff, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - - /* XXX add others */ - return ret; -} - -#elif defined(__powerpc__) || \ - defined(__sparc__) || \ - defined(__mips__) || \ - defined(__sh__) || \ - defined(__mc68000__) || \ - defined(__arm__) || \ - defined(__s390__) || \ - defined(__hppa__) - - /* - * XXX this isn't exactly correct but it will get the server working - * for now until we get something better. - */ - -resPtr -xf86BusAccWindowsFromOS(void) -{ - resPtr ret = NULL; - resRange range; - - RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - -#if defined(__sparc__) || defined(__powerpc__) - RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock); -#else - RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); -#endif - ret = xf86AddResToList(ret, &range, -1); - return ret; -} - -resPtr -xf86PciBusAccWindowsFromOS(void) -{ - resPtr ret = NULL; - resRange range; - - RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - -#if defined(__sparc__) || defined(__powerpc__) - RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock); -#else - RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); -#endif - ret = xf86AddResToList(ret, &range, -1); - return ret; -} - -#ifdef INCLUDE_UNUSED - -resPtr -xf86IsaBusAccWindowsFromOS(void) -{ - resPtr ret = NULL; - resRange range; - - RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - -#if defined(__sparc__) || defined(__powerpc__) - RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock); -#else - RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); -#endif - ret = xf86AddResToList(ret, &range, -1); - return ret; -} - -#endif /* INCLUDE_UNUSED */ - -resPtr -xf86AccResFromOS(resPtr ret) -{ - resRange range; - - /* - * At minimum, the top and bottom resources must be claimed, so that - * resources that are (or appear to be) unallocated can be relocated. - */ - RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); -#if defined(__sparc__) || defined(__powerpc__) - RANGE(range, 0x00ffffff, 0x00ffffff, ResExcIoBlock); -#else - RANGE(range, 0x0000ffff, 0x0000ffff, ResExcIoBlock); -#endif - ret = xf86AddResToList(ret, &range, -1); - - return ret; -} - -#else - -#error : Put your platform dependent code here!! - -#endif - -#endif /* INCLUDE_XF86_NO_DOMAIN */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_KbdMap.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_KbdMap.c deleted file mode 100644 index 3a5a57b8c..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_KbdMap.c +++ /dev/null @@ -1,606 +0,0 @@ -/* $XFree86$ */ - -/* - * Slightly modified xf86KbdLnx.c which is - * - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "input.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86Xinput.h" -#include "xf86OSKbd.h" -#include "atKeynames.h" - -#include "xf86Keymap.h" - -#include "lnx_kbd.h" - -/*ARGSUSED*/ - -/* - * KbdGetMapping -- - * Get the national keyboard mapping. The keyboard type is set, a new map - * and the modifiermap is computed. - */ - -static void readKernelMapping(InputInfoPtr pInfo, - KeySymsPtr pKeySyms, CARD8 *pModMap); -void -KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - KeySym *k; - char type; - int i; - - readKernelMapping(pInfo, pKeySyms, pModMap); - - /* - * compute the modifier map - */ - for (i = 0; i < MAP_LENGTH; i++) - pModMap[i] = NoSymbol; /* make sure it is restored */ - - for (k = map, i = MIN_KEYCODE; - i < (NUM_KEYCODES + MIN_KEYCODE); - i++, k += 4) - - switch(*k) { - - case XK_Shift_L: - case XK_Shift_R: - pModMap[i] = ShiftMask; - break; - - case XK_Control_L: - case XK_Control_R: - pModMap[i] = ControlMask; - break; - - case XK_Caps_Lock: - pModMap[i] = LockMask; - break; - - case XK_Alt_L: - case XK_Alt_R: - pModMap[i] = AltMask; - break; - - case XK_Num_Lock: - pModMap[i] = NumLockMask; - break; - - case XK_Scroll_Lock: - pModMap[i] = ScrollLockMask; - break; - - /* kana support */ - case XK_Kana_Lock: - case XK_Kana_Shift: - pModMap[i] = KanaMask; - break; - - /* alternate toggle for multinational support */ - case XK_Mode_switch: - pModMap[i] = AltLangMask; - break; - - } - - pKbd->kbdType = ioctl(pInfo->fd, KDGKBTYPE, &type) != -1 ? type : KB_101; - - pKeySyms->map = map; - pKeySyms->mapWidth = GLYPHS_PER_KEY; - pKeySyms->minKeyCode = MIN_KEYCODE; - pKeySyms->maxKeyCode = MAX_KEYCODE; -} - -#include - -static KeySym linux_to_x[256] = { - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_Escape, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_space, XK_exclam, XK_quotedbl, XK_numbersign, - XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, - XK_parenleft, XK_parenright, XK_asterisk, XK_plus, - XK_comma, XK_minus, XK_period, XK_slash, - XK_0, XK_1, XK_2, XK_3, - XK_4, XK_5, XK_6, XK_7, - XK_8, XK_9, XK_colon, XK_semicolon, - XK_less, XK_equal, XK_greater, XK_question, - XK_at, XK_A, XK_B, XK_C, - XK_D, XK_E, XK_F, XK_G, - XK_H, XK_I, XK_J, XK_K, - XK_L, XK_M, XK_N, XK_O, - XK_P, XK_Q, XK_R, XK_S, - XK_T, XK_U, XK_V, XK_W, - XK_X, XK_Y, XK_Z, XK_bracketleft, - XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, - XK_grave, XK_a, XK_b, XK_c, - XK_d, XK_e, XK_f, XK_g, - XK_h, XK_i, XK_j, XK_k, - XK_l, XK_m, XK_n, XK_o, - XK_p, XK_q, XK_r, XK_s, - XK_t, XK_u, XK_v, XK_w, - XK_x, XK_y, XK_z, XK_braceleft, - XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling, - XK_currency, XK_yen, XK_brokenbar, XK_section, - XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft, - XK_notsign, XK_hyphen, XK_registered, XK_macron, - XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior, - XK_acute, XK_mu, XK_paragraph, XK_periodcentered, - XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright, - XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown, - XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde, - XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla, - XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis, - XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis, - XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute, - XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply, - XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex, - XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp, - XK_agrave, XK_aacute, XK_acircumflex, XK_atilde, - XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla, - XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis, - XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis, - XK_eth, XK_ntilde, XK_ograve, XK_oacute, - XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division, - XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex, - XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis -}; - -/* - * Maps the AT keycodes to Linux keycodes - */ -static unsigned char at2lnx[NUM_KEYCODES] = -{ - 0x01, /* KEY_Escape */ 0x02, /* KEY_1 */ - 0x03, /* KEY_2 */ 0x04, /* KEY_3 */ - 0x05, /* KEY_4 */ 0x06, /* KEY_5 */ - 0x07, /* KEY_6 */ 0x08, /* KEY_7 */ - 0x09, /* KEY_8 */ 0x0a, /* KEY_9 */ - 0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */ - 0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */ - 0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */ - 0x11, /* KEY_W */ 0x12, /* KEY_E */ - 0x13, /* KEY_R */ 0x14, /* KEY_T */ - 0x15, /* KEY_Y */ 0x16, /* KEY_U */ - 0x17, /* KEY_I */ 0x18, /* KEY_O */ - 0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */ - 0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */ - 0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */ - 0x1f, /* KEY_S */ 0x20, /* KEY_D */ - 0x21, /* KEY_F */ 0x22, /* KEY_G */ - 0x23, /* KEY_H */ 0x24, /* KEY_J */ - 0x25, /* KEY_K */ 0x26, /* KEY_L */ - 0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */ - 0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */ - 0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */ - 0x2d, /* KEY_X */ 0x2e, /* KEY_C */ - 0x2f, /* KEY_V */ 0x30, /* KEY_B */ - 0x31, /* KEY_N */ 0x32, /* KEY_M */ - 0x33, /* KEY_Comma */ 0x34, /* KEY_Period */ - 0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */ - 0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */ - 0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */ - 0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */ - 0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */ - 0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */ - 0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */ - 0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */ - 0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */ - 0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */ - 0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */ - 0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */ - 0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */ - 0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */ - 0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */ - 0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */ - 0x00, /* 0x55 */ 0x56, /* KEY_Less */ - 0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */ - 0x66, /* KEY_Home */ 0x67, /* KEY_Up */ - 0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */ - 0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */ - 0x6b, /* KEY_End */ 0x6c, /* KEY_Down */ - 0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */ - 0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */ - 0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */ - 0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */ - 0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */ - 0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */ - 0x7A, /* KEY_Menu/FOCUS_PF11*/0x00, /* 0x6e */ - 0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */ - 0x00, /* 0x71 */ 0x00, /* 0x72 */ - 0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */ - 0x00, /* 0x75 */ 0x00, /* 0x76 */ - 0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */ - 0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */ - 0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */ - 0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */ - 0x00, /* 0x7f */ -}; -#define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0])) - -#define NUM_CUSTOMKEYS NR_KEYS - -static void -readKernelMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - KeySym *k; - int i; - int maxkey; - static unsigned char tbl[GLYPHS_PER_KEY] = - { - 0, /* unshifted */ - 1, /* shifted */ - 0, /* modeswitch unshifted */ - 0 /* modeswitch shifted */ - }; - - /* - * Read the mapping from the kernel. - * Since we're still using the XFree86 scancode->AT keycode mapping - * routines, we need to convert the AT keycodes to Linux keycodes, - * then translate the Linux keysyms into X keysyms. - * - * First, figure out which tables to use for the modeswitch columns - * above, from the XF86Config fields. - */ - tbl[2] = 8; /* alt */ - tbl[3] = tbl[2] | 1; - - if (pKbd->CustomKeycodes) { - k = map; - maxkey = NUM_CUSTOMKEYS; - } - else { - k = map+GLYPHS_PER_KEY; - maxkey = NUM_AT2LNX; - } - - for (i = 0; i < maxkey; ++i) - { - struct kbentry kbe; - int j; - - if (pKbd->CustomKeycodes) - kbe.kb_index = i; - else - kbe.kb_index = at2lnx[i]; - - for (j = 0; j < GLYPHS_PER_KEY; ++j, ++k) - { - unsigned short kval; - - *k = NoSymbol; - - kbe.kb_table = tbl[j]; - if ( - (!pKbd->CustomKeycodes && kbe.kb_index == 0) || - ioctl(pInfo->fd, KDGKBENT, &kbe)) - continue; - - kval = KVAL(kbe.kb_value); - switch (KTYP(kbe.kb_value)) - { - case KT_LATIN: - case KT_LETTER: - *k = linux_to_x[kval]; - break; - - case KT_FN: - if (kval <= 19) - *k = XK_F1 + kval; - else switch (kbe.kb_value) - { - case K_FIND: - *k = XK_Home; /* or XK_Find */ - break; - case K_INSERT: - *k = XK_Insert; - break; - case K_REMOVE: - *k = XK_Delete; - break; - case K_SELECT: - *k = XK_End; /* or XK_Select */ - break; - case K_PGUP: - *k = XK_Prior; - break; - case K_PGDN: - *k = XK_Next; - break; - case K_HELP: - *k = XK_Help; - break; - case K_DO: - *k = XK_Execute; - break; - case K_PAUSE: - *k = XK_Pause; - break; - case K_MACRO: - *k = XK_Menu; - break; - default: - break; - } - break; - - case KT_SPEC: - switch (kbe.kb_value) - { - case K_ENTER: - *k = XK_Return; - break; - case K_BREAK: - *k = XK_Break; - break; - case K_CAPS: - *k = XK_Caps_Lock; - break; - case K_NUM: - *k = XK_Num_Lock; - break; - case K_HOLD: - *k = XK_Scroll_Lock; - break; - case K_COMPOSE: - *k = XK_Multi_key; - break; - default: - break; - } - break; - - case KT_PAD: - switch (kbe.kb_value) - { - case K_PPLUS: - *k = XK_KP_Add; - break; - case K_PMINUS: - *k = XK_KP_Subtract; - break; - case K_PSTAR: - *k = XK_KP_Multiply; - break; - case K_PSLASH: - *k = XK_KP_Divide; - break; - case K_PENTER: - *k = XK_KP_Enter; - break; - case K_PCOMMA: - *k = XK_KP_Separator; - break; - case K_PDOT: - *k = XK_KP_Decimal; - break; - case K_PPLUSMINUS: - *k = XK_KP_Subtract; - break; - default: - if (kval <= 9) - *k = XK_KP_0 + kval; - break; - } - break; - - /* - * KT_DEAD keys are for accelerated diacritical creation. - */ - case KT_DEAD: - switch (kbe.kb_value) - { - case K_DGRAVE: - *k = XK_dead_grave; - break; - case K_DACUTE: - *k = XK_dead_acute; - break; - case K_DCIRCM: - *k = XK_dead_circumflex; - break; - case K_DTILDE: - *k = XK_dead_tilde; - break; - case K_DDIERE: - *k = XK_dead_diaeresis; - break; - } - break; - - case KT_CUR: - switch (kbe.kb_value) - { - case K_DOWN: - *k = XK_Down; - break; - case K_LEFT: - *k = XK_Left; - break; - case K_RIGHT: - *k = XK_Right; - break; - case K_UP: - *k = XK_Up; - break; - } - break; - - case KT_SHIFT: - switch (kbe.kb_value) - { - case K_ALTGR: - *k = XK_Alt_R; - break; - case K_ALT: - *k = (kbe.kb_index == 0x64 ? - XK_Alt_R : XK_Alt_L); - break; - case K_CTRL: - *k = (kbe.kb_index == 0x61 ? - XK_Control_R : XK_Control_L); - break; - case K_CTRLL: - *k = XK_Control_L; - break; - case K_CTRLR: - *k = XK_Control_R; - break; - case K_SHIFT: - *k = (kbe.kb_index == 0x36 ? - XK_Shift_R : XK_Shift_L); - break; - case K_SHIFTL: - *k = XK_Shift_L; - break; - case K_SHIFTR: - *k = XK_Shift_R; - break; - default: - break; - } - break; - - /* - * KT_ASCII keys accumulate a 3 digit decimal number that gets - * emitted when the shift state changes. We can't emulate that. - */ - case KT_ASCII: - break; - - case KT_LOCK: - if (kbe.kb_value == K_SHIFTLOCK) - *k = XK_Shift_Lock; - break; - - default: - break; - } - } - - if (k[-1] == k[-2]) k[-1] = NoSymbol; - if (k[-2] == k[-3]) k[-2] = NoSymbol; - if (k[-3] == k[-4]) k[-3] = NoSymbol; - if (k[-4] == k[-2] && k[-3] == k[-1]) k[-2] = k[-1] = NoSymbol; - if (k[-1] == k[-4] && k[-2] == k[-3] && k[-2] == NoSymbol) k[-1] =NoSymbol; - } - - if (!pKbd->CustomKeycodes) - return; - - /* - * Find the Mapping for the special server functions - */ - pKbd->specialMap = (TransMapPtr) xcalloc(NUM_CUSTOMKEYS, 1); - if (pKbd->specialMap != NULL) { - pKbd->specialMap->end = NUM_CUSTOMKEYS; - pKbd->specialMap->map = (unsigned char*) xcalloc(NUM_CUSTOMKEYS, 1); - if (pKbd->specialMap == NULL) { - xfree(pKbd->specialMap); - pKbd->specialMap = NULL; - } - } - if (pKbd->specialMap == NULL) { - xf86Msg(X_ERROR, "%s can't allocate \"special map\"\n", pInfo->name); - return; - } - - for (i = 0; i < NUM_CUSTOMKEYS; ++i) { - struct kbentry kbe; - int special = 0; - - kbe.kb_index = i; - kbe.kb_table = 0; /* Plain map */ - if (!ioctl(pInfo->fd, KDGKBENT, &kbe)) - switch (kbe.kb_value) { - case K(KT_LATIN,0x7f): /* This catches DEL too... But who cares? */ - special = KEY_BackSpace; - break; - case K_PMINUS: - special = KEY_KP_Minus; - break; - case K_PPLUS: - special = KEY_KP_Plus; - break; - case K_F1: - special = KEY_F1; - break; - case K_F2: - special = KEY_F2; - break; - case K_F3: - special = KEY_F3; - break; - case K_F4: - special = KEY_F4; - break; - case K_F5: - special = KEY_F5; - break; - case K_F6: - special = KEY_F6; - break; - case K_F7: - special = KEY_F7; - break; - case K_F8: - special = KEY_F8; - break; - case K_F9: - special = KEY_F9; - break; - case K_F10: - special = KEY_F10; - break; - case K_F11: - special = KEY_F11; - break; - case K_F12: - special = KEY_F12; - break; - case K_ALT: - special = KEY_Alt; - break; - case K_ALTGR: - special = KEY_AltLang; - break; - case K_CONS: - special = KEY_SysReqest; - break; - } - pKbd->specialMap->map[i] = special; - } -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_acpi.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_acpi.c deleted file mode 100644 index 9d1dea77d..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_acpi.c +++ /dev/null @@ -1,170 +0,0 @@ -#include "X.h" -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" -#define XF86_OS_PRIVS -#include "xf86_OSproc.h" -#include -#include -#include -#include -#include -#include -#include - -#define ACPI_SOCKET "/var/run/acpid.socket" -#define ACPI_EVENTS "/proc/acpi/event" - -#define ACPI_VIDEO_NOTIFY_SWITCH 0x80 -#define ACPI_VIDEO_NOTIFY_PROBE 0x81 -#define ACPI_VIDEO_NOTIFY_CYCLE 0x82 -#define ACPI_VIDEO_NOTIFY_NEXT_OUTPUT 0x83 -#define ACPI_VIDEO_NOTIFY_PREV_OUTPUT 0x84 - -#define ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS 0x82 -#define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x83 -#define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x84 -#define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x85 -#define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x86 - -#define ACPI_VIDEO_HEAD_INVALID (~0u - 1) -#define ACPI_VIDEO_HEAD_END (~0u) - -static void lnxCloseACPI(void); -static pointer ACPIihPtr = NULL; -PMClose lnxACPIOpen(void); - -#define LINE_LENGTH 80 - -static int -lnxACPIGetEventFromOs(int fd, pmEvent *events, int num) -{ - char ev[LINE_LENGTH]; - int n; - - memset(ev, 0, LINE_LENGTH); - - n = read( fd, ev, LINE_LENGTH ); - - /* Check that we have a video event */ - if (strstr(ev, "video") == ev) { - char *video = NULL; - char *GFX = NULL; - char *notify = NULL; - char *data = NULL; /* doesn't appear to be used in the kernel */ - unsigned long int notify_l, data_l; - - video = strtok(ev, "video"); - - GFX = strtok(NULL, " "); -#if 0 - ErrorF("GFX: %s\n",GFX); -#endif - - notify = strtok(NULL, " "); - notify_l = strtoul(notify, NULL, 16); -#if 0 - ErrorF("notify: 0x%lx\n",notify_l); -#endif - - data = strtok(NULL, " "); - data_l = strtoul(data, NULL, 16); -#if 0 - ErrorF("data: 0x%lx\n",data_l); -#endif - - /* We currently don't differentiate between any event */ - switch (notify_l) { - case ACPI_VIDEO_NOTIFY_SWITCH: - break; - case ACPI_VIDEO_NOTIFY_PROBE: - break; - case ACPI_VIDEO_NOTIFY_CYCLE: - break; - case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: - break; - case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: - break; - default: - break; - } - - /* Deal with all ACPI events as a capability change */ - events[0] = XF86_APM_CAPABILITY_CHANGED; - - return 1; - } - - return 0; -} - -static pmWait -lnxACPIConfirmEventToOs(int fd, pmEvent event) -{ - /* No ability to send back to the kernel in ACPI */ - switch (event) { - default: - return PM_NONE; - } -} - -PMClose -lnxACPIOpen(void) -{ - int fd; - struct sockaddr_un addr; - int r = -1; - -#ifdef DEBUG - ErrorF("ACPI: OSPMOpen called\n"); -#endif - if (ACPIihPtr || !xf86Info.pmFlag) - return NULL; - -#ifdef DEBUG - ErrorF("ACPI: Opening device\n"); -#endif - if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) > -1) { - memset(&addr, 0, sizeof(addr)); - addr.sun_family = AF_UNIX; - strcpy(addr.sun_path, ACPI_SOCKET); - if ((r = connect(fd, (struct sockaddr*)&addr, sizeof(addr))) == -1) { - shutdown(fd, 2); - close(fd); - fd = -1; - } - } - - /* acpid's socket isn't available, so try going direct */ - if (fd == -1) { - if ((fd = open(ACPI_EVENTS, O_RDONLY)) < 0) { - xf86MsgVerb(X_WARNING,3,"Open ACPI failed (%s) (%s)\n", ACPI_EVENTS, - strerror(errno)); - return NULL; - } - } - - xf86PMGetEventFromOs = lnxACPIGetEventFromOs; - xf86PMConfirmEventToOs = lnxACPIConfirmEventToOs; - ACPIihPtr = xf86AddInputHandler(fd,xf86HandlePMEvents,NULL); - xf86MsgVerb(X_INFO,3,"Open ACPI successful (%s)\n", (r != -1) ? ACPI_SOCKET : ACPI_EVENTS); - - return lnxCloseACPI; -} - -static void -lnxCloseACPI(void) -{ - int fd; - -#ifdef DEBUG - ErrorF("ACPI: Closing device\n"); -#endif - if (ACPIihPtr) { - fd = xf86RemoveInputHandler(ACPIihPtr); - shutdown(fd, 2); - close(fd); - ACPIihPtr = NULL; - } -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c deleted file mode 100644 index 6a5c83db2..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c +++ /dev/null @@ -1,371 +0,0 @@ -/* - * Abstraction of the AGP GART interface. - * - * This version is for both Linux and FreeBSD. - * - * Copyright © 2000 VA Linux Systems, Inc. - * Copyright © 2001 The XFree86 Project, Inc. - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c,v 3.11 2003/04/03 22:47:42 dawes Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86OSpriv.h" - -#if defined(linux) -#include -#include -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) -#include -#include -#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() -{ - return GARTInit(-1); -} - -AgpInfoPtr -xf86GetAGPInfo(int screenNum) -{ - struct _agp_info agpinf; - AgpInfoPtr info; - - if (!GARTInit(screenNum)) - return NULL; - - - if ((info = xcalloc(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 %d total, %d 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; - } - - if (ioctl(gartFd, AGPIOC_DEALLOCATE, (int *)key) != 0) { - 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/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c deleted file mode 100644 index bd78d877f..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c +++ /dev/null @@ -1,192 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_apm.c,v 3.12 2001/12/24 22:54:31 dawes Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" -#define XF86_OS_PRIVS -#include "xf86_OSproc.h" -#include "lnx.h" -#include -#include -#include -#include -#include -#include -#include - -#define APM_PROC "/proc/apm" -#define APM_DEVICE "/dev/apm_bios" - -#ifndef APM_STANDBY_FAILED -# define APM_STANDBY_FAILED 0xf000 -#endif -#ifndef APM_SUSPEND_FAILED -# define APM_SUSPEND_FAILED 0xf001 -#endif - -static PMClose lnxAPMOpen(void); -extern PMClose lnxACPIOpen(void); -static void lnxCloseAPM(void); -static pointer APMihPtr = NULL; - -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 }, -#if defined(APM_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 } -#endif -}; - -#define numApmEvents (sizeof(LinuxToXF86) / sizeof(LinuxToXF86[0])) - -/* - * APM is still under construction. - * I'm not sure if the places where I initialize/deinitialize - * apm is correct. Also I don't know what to do in SETUP state. - * This depends if wakeup gets called in this situation, too. - * Also we need to check if the action that is taken on an - * event is reasonable. - */ -static int -lnxPMGetEventFromOs(int fd, pmEvent *events, int num) -{ - int i,j,n; - apm_event_t linuxEvents[8]; - - if ((n = read( fd, linuxEvents, num * sizeof(apm_event_t) )) == -1) - return 0; - n /= sizeof(apm_event_t); - if (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; - } - return n; -} - -static pmWait -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; - 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; - 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; - default: - return PM_NONE; - } -} - -PMClose -xf86OSPMOpen(void) -{ - PMClose ret = NULL; - - /* Favour ACPI over APM, but only when enabled */ - - if (!xf86acpiDisableFlag) - ret = lnxACPIOpen(); - - if (!ret) - ret = lnxAPMOpen(); - - return ret; -} - -static PMClose -lnxAPMOpen(void) -{ - int fd, pfd; - -#ifdef DEBUG - ErrorF("APM: OSPMOpen called\n"); -#endif - if (APMihPtr || !xf86Info.pmFlag) - return NULL; - -#ifdef DEBUG - ErrorF("APM: Opening device\n"); -#endif - 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 = xf86AddInputHandler(fd,xf86HandlePMEvents,NULL); - xf86MsgVerb(X_INFO,3,"Open APM successful\n"); - return lnxCloseAPM; - } - xf86MsgVerb(X_INFO,3,"No APM support in BIOS or kernel\n"); - return NULL; -} - -static void -lnxCloseAPM(void) -{ - int fd; - -#ifdef DEBUG - ErrorF("APM: Closing device\n"); -#endif - if (APMihPtr) { - fd = xf86RemoveInputHandler(APMihPtr); - close(fd); - APMihPtr = NULL; - } -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c deleted file mode 100644 index fd47a5559..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c +++ /dev/null @@ -1,200 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c,v 1.3 2001/02/15 11:03:56 alanh Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "shared/xf86Axp.h" - -axpDevice lnxGetAXP(void); - -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,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); -#ifdef DEBUG - ErrorF("CPU %s\n",cpu); -#endif - break; - case 5: - sscanf(res, "system type : %s",systype); -#ifdef DEBUG - ErrorF("system type : %s\n",systype); -#endif - break; - case 6: - sscanf(res, "system variation : %s",sysvari); -#ifdef DEBUG - ErrorF("system variation: %s\n",sysvari); -#endif - 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); -} - -/* - * pciconfig_iobase wrappers and dynamic i/o selection - */ -#include -#include -#include - -/* glibc versions (single hose only) */ -extern void _outb(char val, unsigned long port); -extern void _outw(short val, unsigned long port); -extern void _outl(int val, unsigned long port); -extern unsigned int _inb(unsigned long port); -extern unsigned int _inw(unsigned long port); -extern unsigned int _inl(unsigned long port); - -extern void _dense_outb(char, unsigned long); -extern void _dense_outw(short, unsigned long); -extern void _dense_outl(int, unsigned long); -extern unsigned int _dense_inb(unsigned long); -extern unsigned int _dense_inw(unsigned long); -extern unsigned int _dense_inl(unsigned long); - -void (*_alpha_outb)(char, unsigned long) = _outb; -void (*_alpha_outw)(short, unsigned long) = _outw; -void (*_alpha_outl)(int, unsigned long) = _outl; -unsigned int (*_alpha_inb)(unsigned long) = _inb; -unsigned int (*_alpha_inw)(unsigned long) = _inw; -unsigned int (*_alpha_inl)(unsigned long) = _inl; - -static long _alpha_iobase_query(unsigned, int, int, int); -long (*_iobase)(unsigned, int, int, int) = _alpha_iobase_query; - -static long -_alpha_iobase(unsigned flags, int hose, int bus, int devfn) -{ -#ifdef __NR_pciconfig_iobase - if (bus < 0) { - bus = hose; - flags |= IOBASE_FROM_HOSE; - } - - return syscall(__NR_pciconfig_iobase, flags, bus, devfn); -#else - return -ENOSYS -#endif -} - -static long -_alpha_iobase_legacy(unsigned flags, int hose, int bus, int devfn) -{ - if (hose > 0) return -ENODEV; - if (flags & IOBASE_DENSE_MEM) return _bus_base(); - if (flags & IOBASE_SPARSE_MEM) return _bus_base_sparse(); - return 0; -} - -static long -_alpha_iobase_query(unsigned flags, int hose, int bus, int devfn) -{ - /* - * Only use iobase if the syscall is supported *and* it's - * a dense io system - */ - if (_alpha_iobase(IOBASE_DENSE_IO, 0, 0, 0) > 0) { - /* - * The syscall worked and it's a dense io system - take over the - * io subsystem - */ - _iobase = _alpha_iobase; - -#ifndef INCLUDE_XF86_NO_DOMAIN - /* - * Only take over the inx/outx functions if this is a dense I/O - * system *and* addressing domains are being used. The dense I/O - * routines expect I/O to be mapped (as done in xf86MapDomainIO) - */ - _alpha_outb = _dense_outb; - _alpha_outw = _dense_outw; - _alpha_outl = _dense_outl; - _alpha_inb = _dense_inb; - _alpha_inw = _dense_inw; - _alpha_inl = _dense_inl; -#endif /* !INCLUDE_XF86_NO_DOMAIN */ - } else _iobase = _alpha_iobase_legacy; - - return _iobase(flags, hose, bus, devfn); -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c deleted file mode 100644 index 63077e907..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c +++ /dev/null @@ -1,151 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c,v 3.5 2000/02/17 13:45:49 dawes Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "input.h" -#include "scrnintstr.h" -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86OSpriv.h" - -int readDense8(pointer Base, register unsigned long Offset); -int readDense16(pointer Base, register unsigned long Offset); -int readDense32(pointer Base, register unsigned long Offset); -void -writeDenseNB8(int Value, pointer Base, register unsigned long Offset); -void -writeDenseNB16(int Value, pointer Base, register unsigned long Offset); -void -writeDenseNB32(int Value, pointer Base, register unsigned long Offset); -void -writeDense8(int Value, pointer Base, register unsigned long Offset); -void -writeDense16(int Value, pointer Base, register unsigned long Offset); -void -writeDense32(int Value, pointer Base, register unsigned long Offset); - -int -readDense8(pointer Base, register unsigned long Offset) -{ - mem_barrier(); - return *(volatile CARD8*) ((unsigned long)Base+(Offset)); -} - -int -readDense16(pointer Base, register unsigned long Offset) -{ - mem_barrier(); - return *(volatile CARD16*) ((unsigned long)Base+(Offset)); -} - -int -readDense32(pointer Base, register unsigned long Offset) -{ - mem_barrier(); - return *(volatile CARD32*)((unsigned long)Base+(Offset)); -} - -void -writeDenseNB8(int Value, pointer Base, register unsigned long Offset) -{ - *(volatile CARD8*)((unsigned long)Base+(Offset)) = Value; -} - -void -writeDenseNB16(int Value, pointer Base, register unsigned long Offset) -{ - *(volatile CARD16*)((unsigned long)Base + (Offset)) = Value; -} - -void -writeDenseNB32(int Value, pointer Base, register unsigned long Offset) -{ - *(volatile CARD32*)((unsigned long)Base+(Offset)) = Value; -} - -void -writeDense8(int Value, pointer Base, register unsigned long Offset) -{ - write_mem_barrier(); - *(volatile CARD8 *)((unsigned long)Base+(Offset)) = Value; -} - -void -writeDense16(int Value, pointer Base, register unsigned long Offset) -{ - write_mem_barrier(); - *(volatile CARD16 *)((unsigned long)Base+(Offset)) = Value; -} - -void -writeDense32(int Value, pointer Base, register unsigned long Offset) -{ - write_mem_barrier(); - *(volatile CARD32 *)((unsigned long)Base+(Offset)) = Value; -} - - -#ifndef INCLUDE_XF86_NO_DOMAIN - -void -_dense_outb(char val, unsigned long port) -{ - if ((port & ~0xffff) == 0) return _outb(val, port); - - write_mem_barrier(); - *(volatile CARD8 *)port = val; -} - -void -_dense_outw(short val, unsigned long port) -{ - if ((port & ~0xffff) == 0) return _outw(val, port); - - write_mem_barrier(); - *(volatile CARD16 *)port = val; -} - -void -_dense_outl(int val, unsigned long port) -{ - if ((port & ~0xffff) == 0) return _outl(val, port); - - write_mem_barrier(); - *(volatile CARD32 *)port = val; -} - -unsigned int -_dense_inb(unsigned long port) -{ - if ((port & ~0xffff) == 0) return _inb(port); - - mem_barrier(); - return *(volatile CARD8 *)port; -} - -unsigned int -_dense_inw(unsigned long port) -{ - if ((port & ~0xffff) == 0) return _inw(port); - - mem_barrier(); - return *(volatile CARD16 *)port; -} - -unsigned int -_dense_inl(unsigned long port) -{ - if ((port & ~0xffff) == 0) return _inl(port); - - mem_barrier(); - return *(volatile CARD32 *)port; -} - -#endif /* !INCLUDE_XF86_NO_DOMAIN */ - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_font.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_font.c deleted file mode 100644 index e9a5b6aef..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_font.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Copyright 2004, Egbert Eich - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * EGBERT EICH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- - * NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of Egbert Eich shall not - * be used in advertising or otherwise to promote the sale, use or other deal- - *ings in this Software without prior written authorization from Egbert Eich. - * - */ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "lnx.h" - -#include -#include -#include - -struct { - int width; - int height; - int charcount; - unsigned char *data; -} lnxfont = { 0, 0, 0, NULL }; - - -static Bool -getfont(int *width, int *height, - int *charcount, unsigned char *data) -{ - struct console_font_op op; - struct consolefontdesc ds; - int result; - - op.op = KD_FONT_OP_GET; - op.width = *width; - op.height = *height; - op.charcount = *charcount; - op.data = data; - op.flags = 0; - - SYSCALL(result = ioctl(xf86Info.consoleFd, KDFONTOP, &op)); -#ifdef DEBUG - ErrorF("Console font read: h: %i count: %i\n",op.height,op.charcount); -#endif - - if (!result) { - - *width = op.width; - *height = op.height; - *charcount = op.charcount; - - return TRUE; - } - - if (errno != ENOSYS && errno != EINVAL) - return FALSE; - - /* GIO_FONTX fallback */ - ds.charcount = *charcount; - ds.charheight = *height; - ds.chardata = (char *)data; - *width = 8; - - SYSCALL(result = ioctl(xf86Info.consoleFd, GIO_FONTX, &ds)); - - if (!result) { - - *charcount = ds.charcount; - *height = ds.charheight; - - return TRUE; - } - - if (errno != ENOSYS && errno != EINVAL) - return FALSE; - - /* GIO_FONT fallback */ - if (*charcount < 256) - return FALSE; - - SYSCALL(result = ioctl(xf86Info.consoleFd, GIO_FONT, data)); - - if (!result) { - *height = 0; - *charcount = 512; - return TRUE; - } - - return FALSE; - -} - -#define VERSION_LEN 31 - -Bool -lnx_savefont(void) -{ - unsigned char *fontdata; -#if CHECK_OS_VERSION - char kernel_version[VERSION_LEN + 1]; - int k_major, k_minor, k_release; -#endif - int size; - int fd; - int width = 32, height = 32, charcount = 2048; - -#ifdef DEBUG - ErrorF("SAVE font\n"); -#endif - -#if CHECK_OS_VERSION - /* Check if the kernel has full support for this */ - if ((fd = open ("/proc/sys/kernel/osrelease",O_RDONLY)) == -1) { - close (fd); - return TRUE; - } - size = read(fd, kernel_version, VERSION_LEN); - close (fd); - - if (size < 0) - return TRUE; - - size = sscanf(kernel_version, "%d.%d.%d",&k_major,&k_minor,&k_release); - if (size < 3 - || (k_major < 2) - || ((k_major == 2) - && ((k_minor < 6) - || ( k_minor == 6 - && k_release < 11)))) - return TRUE; -#endif - - /* if we are in fbdev mode we don't bother saving fonts */ - if ((fd = open ("/dev/fb0",O_RDWR)) != -1) { - close (fd); - return TRUE; - } - - if (!getfont(&width, &height, &charcount, NULL)) { - xf86Msg(X_WARNING, - "lnx_savefont: cannot obtain font info\n"); - goto error; - } else if (charcount == 2048) { - xf86Msg(X_WARNING, "lnx_savefont: " - "kernel bug: kernel doesn't report font info\n"); - return FALSE; - } - - size = (width + 7)/8 * 32 * charcount; - fontdata = (unsigned char *)xnfalloc(size); - if (!fontdata) { - xf86Msg(X_WARNING, - "lnx_savefont: cannot allocate memory to save font\n"); - goto error; - } - - if (!getfont(&width, &height, &charcount, fontdata)) { - xf86Msg(X_WARNING,"lnx_savefont: cannot read font data\n"); - goto error; - } - lnxfont.width = width; - lnxfont.height = height; - lnxfont.charcount = charcount; - lnxfont.data = fontdata; - - return TRUE; - - error: - return FALSE; -} - -static Bool -setfont(int width, int height, - int charcount, unsigned char *data) -{ - struct console_font_op op; - struct consolefontdesc ds; - int result; - - op.op = KD_FONT_OP_SET; - op.flags = 0; - op.charcount = charcount; - op.width = width; - op.height = height; - op.data = data; - - SYSCALL(result = ioctl(xf86Info.consoleFd, KDFONTOP, &op)); - - if (!result) - return TRUE; - - if (errno != ENOSYS && errno != EINVAL) - return FALSE; - - /* PIO_FONTX fallback */ - if (width != 8) - return FALSE; - - ds.charcount = charcount; - ds.chardata = (char *)data; - ds.charheight = height; - SYSCALL(result = ioctl(xf86Info.consoleFd, PIO_FONTX, &ds)); - - if (!result) - return TRUE; - - if (errno != ENOSYS && errno != EINVAL) - return FALSE; - - /* PIO_FONT fallback */ - SYSCALL(result = ioctl(xf86Info.consoleFd, PIO_FONT, data)); - - if (!result) - return TRUE; - - return FALSE; -} - -Bool -lnx_restorefont(void) -{ - if (lnxfont.data == NULL) - return FALSE; -#ifdef DEBUG - ErrorF("RESTORE font\n"); -#endif -#if 0 - /* must wack the height to make the kernel reprogram the VGA registers */ - if (!setfont(lnxfont.width, lnxfont.height + 1, lnxfont.charcount, - lnxfont.data)) { - xf86Msg(X_WARNING,"lnx_fontretore: cannot write font data\n"); - return FALSE; - } -#endif - if (!setfont(lnxfont.width, lnxfont.height, lnxfont.charcount, - lnxfont.data)) { - xf86Msg(X_WARNING,"lnx_restorefont: cannot write font data\n"); - return FALSE; - } - - return TRUE; -} - -Bool -lnx_switchaway(void) -{ - Bool ret; - - /* temporarily switch to text mode */ - ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); - ret = lnx_restorefont(); - ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS); - return ret; -} - -void -lnx_freefontdata(void) -{ - if (lnxfont.data == NULL) - return; - - xfree(lnxfont.data); - lnxfont.data = NULL; - lnxfont.width = lnxfont.height = lnxfont.charcount = 0; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_ia64.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_ia64.c deleted file mode 100644 index 5f742d01f..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_ia64.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2004, Egbert Eich - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * EGBERT EICH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- - * NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of Egbert Eich shall not - * be used in advertising or otherwise to promote the sale, use or other deal- - *ings in this Software without prior written authorization from Egbert Eich. - * - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include - -#include "ia64Pci.h" -#include "Pci.h" - -#if defined OS_PROBE_PCI_CHIPSET -IA64Chipset OS_PROBE_PCI_CHIPSET(scanpciWrapperOpt flags) -{ - struct stat unused; - struct utsname utsName; - - if (!stat("/proc/bus/mckinley/zx1",&unused) - || !stat("/proc/bus/mckinley/zx2",&unused)) - return ZX1_CHIPSET; - - if (!stat("/proc/sgi_sn/licenseID", &unused)) { - int major, minor, patch; - char *c; - - /* We need a 2.6.11 or better kernel for Altix support */ - uname(&utsName); - c = utsName.release; - - major = atoi(c); - c = strstr(c, ".") + 1; - minor = atoi(c); - c = strstr(c, ".") + 1; - patch = atoi(c); - - if (major < 2 || (major == 2 && minor < 6) || - (major == 2 && minor == 6 && patch < 11)) { - ErrorF("Kernel 2.6.11 or better needed for Altix support\n"); - return NONE_CHIPSET; - } - return ALTIX_CHIPSET; - } - - return NONE_CHIPSET; -} -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c deleted file mode 100644 index 1eb0f33fe..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c +++ /dev/null @@ -1,415 +0,0 @@ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c,v 1.9 2005/08/26 07:35:55 daniels Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c,v 3.14 2001/10/31 22:50:30 tsi Exp $ */ -/* - * Copyright 1992 by Orest Zborowski - * Copyright 1993 by David Wexelblat - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Orest Zborowski and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Orest Zborowski - * and David Wexelblat make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * OREST ZBOROWSKI AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID WEXELBLAT BE LIABLE - * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: lnx_init.c /main/7 1996/10/23 18:46:30 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "lnx.h" - -#include - -#ifdef USE_DEV_FB -extern char *getenv(const char *); -#include -char *fb_dev_name; -#endif - -static Bool KeepTty = FALSE; -static int VTnum = -1; -static Bool VTSwitch = TRUE; -static Bool ShareVTs = FALSE; -static int activeVT = -1; - -static int vtPermSave[4]; -static char vtname[11]; - -static int -saveVtPerms(void) -{ - /* We need to use stat to get permissions. */ - struct stat svtp; - - /* Do them numerically ordered, hard coded tty0 first. */ - if (stat("/dev/tty0", &svtp) != 0) - return 0; - vtPermSave[0] = (int)svtp.st_uid; - vtPermSave[1] = (int)svtp.st_gid; - - /* Now check the console we are dealing with. */ - if (stat(vtname, &svtp) != 0) - return 0; - vtPermSave[2] = (int)svtp.st_uid; - vtPermSave[3] = (int)svtp.st_gid; - - return 1; -} - -static void -restoreVtPerms(void) -{ - /* Set the terminal permissions back to before we started. */ - chown("/dev/tty0", vtPermSave[0], vtPermSave[1]); - chown(vtname, vtPermSave[2], vtPermSave[3]); -} - -void -xf86OpenConsole(void) -{ - int i, fd = -1; - struct vt_mode VT; - struct vt_stat vts; - MessageType from = X_PROBED; -#ifdef USE_DEV_FB - struct fb_var_screeninfo var; - int fbfd; -#endif - char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL }; - char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL }; - - 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 (VTnum != -1) { - xf86Info.vtno = VTnum; - 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 (ShareVTs) - { - if (ioctl(fd, VT_GETSTATE, &vts) == 0) - xf86Info.vtno = vts.v_active; - else - FatalError("xf86OpenConsole: Cannot find the current" - " VT (%s)\n", strerror(errno)); - } else { - if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) || - (xf86Info.vtno == -1)) - FatalError("xf86OpenConsole: Cannot find a free VT: %s\n", - strerror(errno)); - } - close(fd); - } - -#ifdef USE_DEV_FB - if (!ShareVTs) - { - fb_dev_name=getenv("FRAMEBUFFER"); - if (!fb_dev_name) - fb_dev_name="/dev/fb0current"; - - if ((fbfd = open(fb_dev_name, O_RDONLY)) < 0) - FatalError("xf86OpenConsole: Cannot open %s (%s)\n", - fb_dev_name, strerror(errno)); - - if (ioctl(fbfd, FBIOGET_VSCREENINFO, &var) < 0) - FatalError("xf86OpenConsole: Unable to get screen info %s\n", - strerror(errno)); - } -#endif - 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) { - sprintf(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)); - - if (!ShareVTs) - { - /* - * Grab the vt ownership before we overwrite it. - * Hard coded /dev/tty0 into this function as well for below. - */ - if (!saveVtPerms()) - xf86Msg(X_WARNING, - "xf86OpenConsole: Could not save ownership of VT\n"); - - /* change ownership of the vt */ - if (chown(vtname, getuid(), getgid()) < 0) - xf86Msg(X_WARNING,"xf86OpenConsole: chown %s failed: %s\n", - vtname, strerror(errno)); - - /* - * the current VT device we're running on is not "console", we want - * to grab all consoles too - * - * Why is this needed?? - */ - if (chown("/dev/tty0", getuid(), getgid()) < 0) - xf86Msg(X_WARNING,"xf86OpenConsole: chown /dev/tty0 failed: %s\n", - 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. - */ - if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts) < 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) { - ioctl(i, TIOCNOTTY, 0); - close(i); - } - } -#endif - - if (!ShareVTs) - { -#if defined(DO_OS_FONTRESTORE) - lnx_savefont(); -#endif - /* - * now get the VT - */ - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0) - xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed: %s\n", - strerror(errno)); - - if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) < 0) - xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed: %s\n", - strerror(errno)); - - if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) - FatalError("xf86OpenConsole: VT_GETMODE failed %s\n", - strerror(errno)); - - signal(SIGUSR1, xf86VTRequest); - - VT.mode = VT_PROCESS; - VT.relsig = SIGUSR1; - VT.acqsig = SIGUSR1; - - if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0) - FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed: %s\n", - strerror(errno)); - - if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) - FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n", - strerror(errno)); - - /* we really should have a InitOSInputDevices() function instead - * of Init?$#*&Device(). So I just place it here */ - -#ifdef USE_DEV_FB - /* copy info to new console */ - var.yoffset=0; - var.xoffset=0; - if (ioctl(fbfd, FBIOPUT_VSCREENINFO, &var)) - FatalError("Unable to set screen info\n"); - close(fbfd); -#endif - } else { /* ShareVTs */ - close(xf86Info.consoleFd); - } - signal(SIGUSR2, xf86ReloadInputDevs); - } else { /* serverGeneration != 1 */ - if (!ShareVTs && VTSwitch) - { - /* - * now get the VT - */ - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0) - xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed %s\n", - strerror(errno)); - } - - if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) < 0) - xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed %s\n", - strerror(errno)); - } - return; -} - -void -xf86CloseConsole() -{ - struct vt_mode VT; -#if defined(DO_OS_FONTRESTORE) - struct vt_stat vts; - int vtno = -1; -#endif - - if (ShareVTs) return; - -#if defined(DO_OS_FONTRESTORE) - if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts) < 0) - xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETSTATE failed: %s\n", - strerror(errno)); - else - vtno = vts.v_active; -#endif - - /* Back to text mode ... */ - if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT) < 0) - xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n", - strerror(errno)); - - if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) - xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETMODE failed: %s\n", - strerror(errno)); - else { - /* set dflt vt handling */ - VT.mode = VT_AUTO; - if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0) - xf86Msg(X_WARNING, "xf86CloseConsole: VT_SETMODE failed: %s\n", - strerror(errno)); - } - - if (VTSwitch) - { - /* - * Perform a switch back to the active VT when we were started - */ - if (activeVT >= 0) { - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, activeVT) < 0) - xf86Msg(X_WARNING, "xf86CloseConsole: VT_ACTIVATE failed: %s\n", - strerror(errno)); - activeVT = -1; - } - -#if defined(DO_OS_FONTRESTORE) - if (xf86Info.vtno == vtno) /* check if we are active */ - lnx_restorefont(); - lnx_freefontdata(); -#endif - } - close(xf86Info.consoleFd); /* make the vt-manager happy */ - - restoreVtPerms(); /* restore the permissions */ - - return; -} - -int -xf86ProcessArgument(int argc, char *argv[], int i) -{ - /* - * Keep server from detaching from controlling tty. This is useful - * when debugging (so the server can receive keyboard signals. - */ - if (!strcmp(argv[i], "-keeptty")) - { - KeepTty = TRUE; - return(1); - } - if (!strcmp(argv[i], "-novtswitch")) - { - VTSwitch = FALSE; - return(1); - } - if (!strcmp(argv[i], "-sharevts")) - { - ShareVTs = TRUE; - return(1); - } - if ((argv[i][0] == 'v') && (argv[i][1] == 't')) - { - if (sscanf(argv[i], "vt%2d", &VTnum) == 0) - { - UseMsg(); - VTnum = -1; - return(0); - } - return(1); - } - return(0); -} - -void -xf86UseMsg() -{ - ErrorF("vtXX use the specified VT number\n"); - ErrorF("-keeptty "); - ErrorF("don't detach controlling tty (for debugging only)\n"); - ErrorF("-novtswitch don't immediately switch to new VT\n"); - ErrorF("-sharevts share VTs with another X server\n"); - return; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c deleted file mode 100644 index 47df0dfb6..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c +++ /dev/null @@ -1,275 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c,v 3.25 2003/08/19 17:32:34 tsi Exp $ */ -/* - * Copyright 1992 by Orest Zborowski - * Copyright 1993 by David Dawes - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Orest Zborowski and David Dawes - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Orest Zborowski - * and David Dawes make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * OREST ZBOROWSKI AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID DAWES BE LIABLE - * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: lnx_io.c /main/8 1996/10/19 18:06:28 kaleb $ */ - -#define NEED_EVENTS -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#define KBC_TIMEOUT 250 /* Timeout in ms for sending to keyboard controller */ - -void -xf86SoundKbdBell(int loudness, int pitch, int duration) -{ - if (loudness && pitch) - { - ioctl(xf86Info.consoleFd, KDMKTONE, - ((1193190 / pitch) & 0xffff) | - (((unsigned long)duration * - loudness / 50) << 16)); - } -} - -void -xf86SetKbdLeds(int leds) -{ - ioctl(xf86Info.consoleFd, KDSETLED, leds); -} - -int -xf86GetKbdLeds() -{ - int leds = 0; - - ioctl(xf86Info.consoleFd, KDGETLED, &leds); - return(leds); -} - -/* kbd rate stuff based on kbdrate.c from Rik Faith et.al. - * from util-linux-2.9t package */ - -#include -#include -#ifdef __sparc__ -#include -#include -#endif - -/* Deal with spurious kernel header change in struct kbd_repeat. - We undo this define after the routine using that struct is over, - so as not to interfere with other 'rate' elements. */ -#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) -# define rate period -# endif -#endif - -static int -KDKBDREP_ioctl_ok(int rate, int delay) { -#if defined(KDKBDREP) && !defined(__sparc__) - /* This ioctl is defined in but is not - implemented anywhere - must be in some m68k patches. */ - struct kbd_repeat kbdrep_s; - - /* don't change, just test */ - kbdrep_s.rate = -1; - kbdrep_s.delay = -1; - if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) { - return 0; - } - /* do the change */ - if (rate == 0) /* switch repeat off */ - kbdrep_s.rate = 0; - else - kbdrep_s.rate = 10000 / rate; /* convert cps to msec */ - if (kbdrep_s.rate < 1) - kbdrep_s.rate = 1; - kbdrep_s.delay = delay; - if (kbdrep_s.delay < 1) - kbdrep_s.delay = 1; - - if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) { - return 0; - } - - return 1; /* success! */ -#else /* no KDKBDREP */ - return 0; -#endif /* KDKBDREP */ -} - -#undef rate - -/* Undo the earlier define for the struct kbd_repeat problem. */ -#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) -# undef rate -# endif -#endif - -static int -KIOCSRATE_ioctl_ok(int rate, int delay) { -#ifdef KIOCSRATE - struct kbd_rate kbdrate_s; - int fd; - - fd = open("/dev/kbd", O_RDONLY); - if (fd == -1) - return 0; - - kbdrate_s.rate = (rate + 5) / 10; /* must be integer, so round up */ - kbdrate_s.delay = delay * HZ / 1000; /* convert ms to Hz */ - if (kbdrate_s.rate > 50) - kbdrate_s.rate = 50; - - if (ioctl( fd, KIOCSRATE, &kbdrate_s )) { - return 0; - } - - close( fd ); - - return 1; -#else /* no KIOCSRATE */ - return 0; -#endif /* KIOCSRATE */ -} - -void xf86SetKbdRepeat(char rad) -{ -#ifdef __sparc__ - int rate = 500; /* Default rate */ - int delay = 200; /* Default delay */ -#else - int rate = 300; /* Default rate */ - int delay = 250; /* Default delay */ -#endif - -#if defined(__alpha__) || defined (__i386__) || defined(__ia64__) - int i; - int timeout; - int value = 0x7f; /* Maximum delay with slowest rate */ - - static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150, - 133, 120, 109, 100, 92, 86, 80, 75, 67, - 60, 55, 50, 46, 43, 40, 37, 33, 30, 27, - 25, 23, 21, 20 }; -#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int )) - - static int valid_delays[] = { 250, 500, 750, 1000 }; -#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int )) -#endif - - if (xf86Info.kbdRate >= 0) - rate = xf86Info.kbdRate * 10; - if (xf86Info.kbdDelay >= 0) - delay = xf86Info.kbdDelay; - - if(KDKBDREP_ioctl_ok(rate, delay)) /* m68k? */ - return; - - if(KIOCSRATE_ioctl_ok(rate, delay)) /* sparc? */ - return; - - if (xf86IsPc98()) - return; - -#if defined(__alpha__) || defined (__i386__) || defined(__ia64__) - - /* The ioport way */ - - for (i = 0; i < RATE_COUNT; i++) - if (rate >= valid_rates[i]) { - value &= 0x60; - value |= i; - break; - } - - for (i = 0; i < DELAY_COUNT; i++) - if (delay <= valid_delays[i]) { - value &= 0x1f; - value |= i << 5; - break; - } - - timeout = KBC_TIMEOUT; - while (((inb(0x64) & 2) == 2) && --timeout) - usleep(1000); /* wait */ - - if (timeout == 0) - return; - - outb(0x60, 0xf3); /* set typematic rate */ - while (((inb(0x64) & 2) == 2) && --timeout) - usleep(1000); /* wait */ - - usleep(10000); - outb(0x60, value); - -#endif /* __alpha__ || __i386__ || __ia64__ */ -} - -static int kbdtrans; -static struct termios kbdtty; - -void -xf86KbdInit() -{ - ioctl (xf86Info.consoleFd, KDGKBMODE, &kbdtrans); - tcgetattr (xf86Info.consoleFd, &kbdtty); -} - -int -xf86KbdOn() -{ - struct termios nTty; - -#ifdef __powerpc__ - if (xf86Info.kbdCustomKeycodes) - ioctl(xf86Info.consoleFd, KDSKBMODE, K_MEDIUMRAW); - else -#endif - ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW); - - nTty = kbdtty; - 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; - cfsetispeed(&nTty, 9600); - cfsetospeed(&nTty, 9600); - tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty); - return(xf86Info.consoleFd); -} - -int -xf86KbdOff() -{ - ioctl(xf86Info.consoleFd, KDSKBMODE, kbdtrans); - tcsetattr(xf86Info.consoleFd, TCSANOW, &kbdtty); - return(xf86Info.consoleFd); -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_jstk.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_jstk.c deleted file mode 100644 index dafdc0594..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_jstk.c +++ /dev/null @@ -1,188 +0,0 @@ -/* $XConsortium: lnx_jstk.c /main/7 1996/02/21 17:51:36 kaleb $ */ -/* Id: lnx_jstk.c,v 1.1 1995/12/20 14:06:09 lepied Exp */ -/* - * Copyright 1995 by Frederic Lepied, France. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Frederic Lepied not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Frederic Lepied makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_jstk.c,v 3.8.2.1 1998/06/05 16:23:12 dawes Exp $ */ - -static const char rcs_id[] = "Id: lnx_jstk.c,v 1.1 1995/12/20 14:06:09 lepied Exp"; - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#define inline __inline__ -#include -#include -#include - -#ifdef XFree86LOADER -#include "xf86.h" -#include "xf86_ansic.h" -#endif - -#if !defined(JSIOCGTIMELIMIT) -/* make 2.1.x joystick.h backward compatable */ -#define JSIOCGTIMELIMIT JS_GET_TIMELIMIT -#define JSIOCSTIMELIMIT JS_SET_TIMELIMIT -#define js_status JS_DATA_TYPE -#endif - - -/*********************************************************************** - * - * xf86JoystickOn -- - * - * open the device and init timeout according to the device value. - * - *********************************************************************** - */ - -int -xf86JoystickOn(char *name, int *timeout, int *centerX, int *centerY) -{ - int fd; - struct js_status js; - -#ifdef DEBUG - ErrorF("xf86JoystickOn %s\n", name); -#endif - - if ((fd = open(name, O_RDWR | O_NDELAY, 0)) < 0) - { - xf86Msg(X_WARNING, "Cannot open joystick '%s' (%s)\n", name, - strerror(errno)); - return -1; - } - - if (*timeout == 0) { - if (ioctl (fd, JSIOCGTIMELIMIT, timeout) == -1) { - Error("joystick JSIOCGTIMELIMIT ioctl"); - } - else { - xf86Msg(X_CONFIG, "Joystick: timeout value = %d\n", *timeout); - } - } - else { - if (ioctl(fd, JSIOCSTIMELIMIT, timeout) == -1) { - Error("joystick JSIOCSTIMELIMIT ioctl"); - } - } - - /* Assume the joystick is centred when this is called */ - read(fd, &js, JS_RETURN); - if (*centerX < 0) { - *centerX = js.x; - xf86Msg(X_CONFIG, "Joystick: CenterX set to %d\n", *centerX); - } - if (*centerY < 0) { - *centerY = js.y; - xf86Msg(X_CONFIG, "Joystick: CenterY set to %d\n", *centerY); - } - - return fd; -} - -/*********************************************************************** - * - * xf86JoystickInit -- - * - * called when X device is initialized. - * - *********************************************************************** - */ - -void -xf86JoystickInit() -{ - return; -} - -/*********************************************************************** - * - * xf86JoystickOff -- - * - * close the handle. - * - *********************************************************************** - */ - -int -xf86JoystickOff(int *fd, int doclose) -{ - int oldfd; - - if (((oldfd = *fd) >= 0) && doclose) { - close(*fd); - *fd = -1; - } - return oldfd; -} - -/*********************************************************************** - * - * xf86JoystickGetState -- - * - * return the state of buttons and the position of the joystick. - * - *********************************************************************** - */ - -int -xf86JoystickGetState(int fd, int *x, int *y, int *buttons) -{ - struct js_status js; - int status; - - status = read(fd, &js, JS_RETURN); - - if (status != JS_RETURN) - { - Error("Joystick read"); - return 0; - } - - *x = js.x; - *y = js.y; - *buttons = js.buttons; - - return 1; -} - -#ifdef XFree86LOADER -/* - * Entry point for XFree86 Loader - */ -void -linux_jstkModuleInit(pointer *data, INT32 *magic) -{ - *magic = MAGIC_DONE; - *data = NULL; -} -#endif - -/* end of lnx_jstk.c */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c deleted file mode 100644 index b1fc95b56..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c +++ /dev/null @@ -1,559 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.c,v 1.4 2003/11/03 05:11:52 tsi Exp $ */ - -/* - * Copyright (c) 2002 by The XFree86 Project, Inc. - * Author: Ivan Pascal. - * - * Based on the code from lnx_io.c which is - * Copyright 1992 by Orest Zborowski - * Copyright 1993 by David Dawes - */ - -#define NEED_EVENTS -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#include "xf86Xinput.h" -#include "xf86OSKbd.h" -#include "atKeynames.h" -#if defined(DO_OS_FONTRESTORE) -#include "lnx.h" -#endif -#include "lnx_kbd.h" - -#define KBC_TIMEOUT 250 /* Timeout in ms for sending to keyboard controller */ - -static KbdProtocolRec protocols[] = { - {"standard", PROT_STD }, - { NULL, PROT_UNKNOWN_KBD } -}; - -extern Bool VTSwitchEnabled; -#ifdef USE_VT_SYSREQ -extern Bool VTSysreqToggle; -#endif - -static void -SoundBell(InputInfoPtr pInfo, int loudness, int pitch, int duration) -{ - if (loudness && pitch) - { - ioctl(pInfo->fd, KDMKTONE, - ((1193190 / pitch) & 0xffff) | - (((unsigned long)duration * - loudness / 50) << 16)); - } -} - -static void -SetKbdLeds(InputInfoPtr pInfo, int leds) -{ - int real_leds = 0; - -#if defined (__sparc__) - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - if (pKbd->sunKbd) { - if (leds & 0x08) real_leds |= XLED1; - if (leds & 0x04) real_leds |= XLED3; - if (leds & 0x02) real_leds |= XLED4; - if (leds & 0x01) real_leds |= XLED2; - leds = real_leds; - real_leds = 0; - } -#endif /* defined (__sparc__) */ -#ifdef LED_CAP - if (leds & XLED1) real_leds |= LED_CAP; - if (leds & XLED2) real_leds |= LED_NUM; - if (leds & XLED3) real_leds |= LED_SCR; -#ifdef LED_COMP - if (leds & XLED4) real_leds |= LED_COMP; -#else - if (leds & XLED4) real_leds |= LED_SCR; -#endif -#endif - ioctl(pInfo->fd, KDSETLED, real_leds); -} - -static int -GetKbdLeds(InputInfoPtr pInfo) -{ - int real_leds, leds = 0; - - ioctl(pInfo->fd, KDGETLED, &real_leds); - - if (real_leds & LED_CAP) leds |= XLED1; - if (real_leds & LED_NUM) leds |= XLED2; - if (real_leds & LED_SCR) leds |= XLED3; - - return(leds); -} - -/* kbd rate stuff based on kbdrate.c from Rik Faith et.al. - * from util-linux-2.9t package */ - -#include -#include -#ifdef __sparc__ -#include -#include -#endif - -/* Deal with spurious kernel header change in struct kbd_repeat. - We undo this define after the routine using that struct is over, - so as not to interfere with other 'rate' elements. */ -#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) -# define rate period -# endif -#endif - -static int -KDKBDREP_ioctl_ok(int rate, int delay) { -#if defined(KDKBDREP) && !defined(__sparc__) - /* This ioctl is defined in but is not - implemented anywhere - must be in some m68k patches. */ - struct kbd_repeat kbdrep_s; - - /* don't change, just test */ - kbdrep_s.rate = -1; - kbdrep_s.delay = -1; - if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) { - return 0; - } - - /* do the change */ - if (rate == 0) /* switch repeat off */ - kbdrep_s.rate = 0; - else - kbdrep_s.rate = 10000 / rate; /* convert cps to msec */ - if (kbdrep_s.rate < 1) - kbdrep_s.rate = 1; - kbdrep_s.delay = delay; - if (kbdrep_s.delay < 1) - kbdrep_s.delay = 1; - - if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) { - return 0; - } - - return 1; /* success! */ -#else /* no KDKBDREP */ - return 0; -#endif /* KDKBDREP */ -} - -#undef rate - -/* Undo the earlier define for the struct kbd_repeat problem. */ -#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION) -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,42) -# undef rate -# endif -#endif - -static int -KIOCSRATE_ioctl_ok(int rate, int delay) { -#ifdef KIOCSRATE - struct kbd_rate kbdrate_s; - int fd; - - fd = open("/dev/kbd", O_RDONLY); - if (fd == -1) - return 0; - - kbdrate_s.rate = (rate + 5) / 10; /* must be integer, so round up */ - kbdrate_s.delay = delay * HZ / 1000; /* convert ms to Hz */ - if (kbdrate_s.rate > 50) - kbdrate_s.rate = 50; - - if (ioctl( fd, KIOCSRATE, &kbdrate_s )) { - return 0; - } - - close( fd ); - - return 1; -#else /* no KIOCSRATE */ - return 0; -#endif /* KIOCSRATE */ -} - -#undef rate - -static void -SetKbdRepeat(InputInfoPtr pInfo, char rad) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - int i; - int timeout; - int value = 0x7f; /* Maximum delay with slowest rate */ - -#ifdef __sparc__ - int rate = 500; /* Default rate */ - int delay = 200; /* Default delay */ -#else - int rate = 300; /* Default rate */ - int delay = 250; /* Default delay */ -#endif - - static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150, - 133, 120, 109, 100, 92, 86, 80, 75, 67, - 60, 55, 50, 46, 43, 40, 37, 33, 30, 27, - 25, 23, 21, 20 }; -#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int )) - - static int valid_delays[] = { 250, 500, 750, 1000 }; -#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int )) - - if (pKbd->rate >= 0) - rate = pKbd->rate * 10; - if (pKbd->delay >= 0) - delay = pKbd->delay; - - if(KDKBDREP_ioctl_ok(rate, delay)) /* m68k? */ - return; - - if(KIOCSRATE_ioctl_ok(rate, delay)) /* sparc? */ - return; - - if (xf86IsPc98()) - return; - -#if defined(__alpha__) || defined (__i386__) || defined(__ia64__) - - if (!xorgHWAccess) { - if (xf86EnableIO()) - xorgHWAccess = TRUE; - else - return; - } - - /* The ioport way */ - - for (i = 0; i < RATE_COUNT; i++) - if (rate >= valid_rates[i]) { - value &= 0x60; - value |= i; - break; - } - - for (i = 0; i < DELAY_COUNT; i++) - if (delay <= valid_delays[i]) { - value &= 0x1f; - value |= i << 5; - break; - } - - timeout = KBC_TIMEOUT; - while (((inb(0x64) & 2) == 2) && --timeout) - usleep(1000); /* wait */ - - if (timeout == 0) - return; - - outb(0x60, 0xf3); /* set typematic rate */ - while (((inb(0x64) & 2) == 2) && --timeout) - usleep(1000); /* wait */ - - usleep(10000); - outb(0x60, value); - -#endif /* __alpha__ || __i386__ || __ia64__ */ -} - -typedef struct { - int kbdtrans; - struct termios kbdtty; -} LnxKbdPrivRec, *LnxKbdPrivPtr; - -static int -KbdInit(InputInfoPtr pInfo, int what) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - LnxKbdPrivPtr priv = (LnxKbdPrivPtr) pKbd->private; - - if (pKbd->isConsole) { - ioctl (pInfo->fd, KDGKBMODE, &(priv->kbdtrans)); - tcgetattr (pInfo->fd, &(priv->kbdtty)); - } - if (!pKbd->CustomKeycodes) { - pKbd->RemapScanCode = ATScancode; - } - - return Success; -} - -static int -KbdOn(InputInfoPtr pInfo, int what) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - LnxKbdPrivPtr priv = (LnxKbdPrivPtr) pKbd->private; - struct termios nTty; - - if (pKbd->isConsole) { - if (pKbd->CustomKeycodes) - ioctl(pInfo->fd, KDSKBMODE, K_MEDIUMRAW); - else - ioctl(pInfo->fd, KDSKBMODE, K_RAW); - - nTty = priv->kbdtty; - 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; - cfsetispeed(&nTty, 9600); - cfsetospeed(&nTty, 9600); - tcsetattr(pInfo->fd, TCSANOW, &nTty); - } - return Success; -} - -static int -KbdOff(InputInfoPtr pInfo, int what) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - LnxKbdPrivPtr priv = (LnxKbdPrivPtr) pKbd->private; - - if (pKbd->isConsole) { - ioctl(pInfo->fd, KDSKBMODE, priv->kbdtrans); - tcsetattr(pInfo->fd, TCSANOW, &(priv->kbdtty)); - } - return Success; -} - -static int -GetSpecialKey(InputInfoPtr pInfo, int scanCode) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - int specialkey = scanCode; - -#if defined (__sparc__) - if (pKbd->sunKbd) { - switch (scanCode) { - case 0x2b: specialkey = KEY_BackSpace; break; - case 0x47: specialkey = KEY_KP_Minus; break; - case 0x7d: specialkey = KEY_KP_Plus; break; - /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */ - case 0x05: specialkey = KEY_F1; break; - case 0x06: specialkey = KEY_F2; break; - case 0x08: specialkey = KEY_F3; break; - case 0x0a: specialkey = KEY_F4; break; - case 0x0c: specialkey = KEY_F5; break; - case 0x0e: specialkey = KEY_F6; break; - case 0x10: specialkey = KEY_F7; break; - case 0x11: specialkey = KEY_F8; break; - case 0x12: specialkey = KEY_F9; break; - case 0x07: specialkey = KEY_F10; break; - case 0x09: specialkey = KEY_F11; break; - case 0x0b: specialkey = KEY_F12; break; - default: specialkey = 0; break; - } - return specialkey; - } -#endif - - if (pKbd->CustomKeycodes) { - specialkey = pKbd->specialMap->map[scanCode]; - } - return specialkey; -} - -#define ModifierSet(k) ((modifiers & (k)) == (k)) - -static -Bool SpecialKey(InputInfoPtr pInfo, int key, Bool down, int modifiers) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - - if(!pKbd->vtSwitchSupported) - return FALSE; - - if ((ModifierSet(ControlMask | AltMask)) || - (ModifierSet(ControlMask | AltLangMask))) { - if (VTSwitchEnabled && !xf86Info.vtSysreq && !xf86Info.dontVTSwitch) { - switch (key) { - case KEY_F1: - case KEY_F2: - case KEY_F3: - case KEY_F4: - case KEY_F5: - case KEY_F6: - case KEY_F7: - case KEY_F8: - case KEY_F9: - case KEY_F10: - if (down) { - ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1); - return TRUE; - } - case KEY_F11: - case KEY_F12: - if (down) { - ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11); - return TRUE; - } - } - } - } -#ifdef USE_VT_SYSREQ - if (VTSwitchEnabled && xf86Info.vtSysreq && !xf86Info.dontVTSwitch) { - switch (key) { - case KEY_F1: - case KEY_F2: - case KEY_F3: - case KEY_F4: - case KEY_F5: - case KEY_F6: - case KEY_F7: - case KEY_F8: - case KEY_F9: - case KEY_F10: - if (VTSysreqToggle && down) { - ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1); - VTSysreqToggle = FALSE; - return TRUE; - } - break; - case KEY_F11: - case KEY_F12: - if (VTSysreqToggle && down) { - ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11); - VTSysreqToggle = FALSE; - return TRUE; - } - break; - /* Ignore these keys -- ie don't let them cancel an alt-sysreq */ - case KEY_Alt: - case KEY_AltLang: - break; - case KEY_SysReqest: - if ((ModifierSet(AltMask) || ModifierSet(AltLangMask)) && down) - VTSysreqToggle = TRUE; - break; - default: - /* - * We only land here when Alt-SysReq is followed by a - * non-switching key. - */ - if (VTSysreqToggle) - VTSysreqToggle = FALSE; - } - } -#endif /* USE_VT_SYSREQ */ - return FALSE; -} - -static void -stdReadInput(InputInfoPtr pInfo) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - unsigned char rBuf[64]; - int nBytes, i; - if ((nBytes = read( pInfo->fd, (char *)rBuf, sizeof(rBuf))) > 0) { - for (i = 0; i < nBytes; i++) - pKbd->PostEvent(pInfo, rBuf[i] & 0x7f, - rBuf[i] & 0x80 ? FALSE : TRUE); - } -} - -static Bool -OpenKeyboard(InputInfoPtr pInfo) -{ - KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; - int i; - KbdProtocolId prot = PROT_UNKNOWN_KBD; - char *s; - - s = xf86SetStrOption(pInfo->options, "Protocol", NULL); - for (i = 0; protocols[i].name; i++) { - if (xf86NameCmp(s, protocols[i].name) == 0) { - prot = protocols[i].id; - break; - } - } - - switch (prot) { - case PROT_STD: - pInfo->read_input = stdReadInput; - break; - default: - xf86Msg(X_ERROR,"\"%s\" is not a valid keyboard protocol name\n", s); - xfree(s); - return FALSE; - } - - xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, s); - xfree(s); - - s = xf86SetStrOption(pInfo->options, "Device", NULL); - if (s == NULL) { - pInfo->fd = xf86Info.consoleFd; - pKbd->isConsole = TRUE; - } else { - pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL); - if (pInfo->fd == -1) { - xf86Msg(X_ERROR, "%s: cannot open \"%s\"\n", pInfo->name, s); - xfree(s); - return FALSE; - } - pKbd->isConsole = FALSE; - xfree(s); - } - - if (pKbd->isConsole) - pKbd->vtSwitchSupported = TRUE; - - return TRUE; -} - -Bool -xf86OSKbdPreInit(InputInfoPtr pInfo) -{ - KbdDevPtr pKbd = pInfo->private; - - pKbd->KbdInit = KbdInit; - pKbd->KbdOn = KbdOn; - pKbd->KbdOff = KbdOff; - pKbd->Bell = SoundBell; - pKbd->SetLeds = SetKbdLeds; - pKbd->GetLeds = GetKbdLeds; - pKbd->SetKbdRepeat = SetKbdRepeat; - pKbd->KbdGetMapping = KbdGetMapping; - pKbd->SpecialKey = SpecialKey; - - pKbd->RemapScanCode = NULL; - pKbd->GetSpecialKey = GetSpecialKey; - - pKbd->OpenKeyboard = OpenKeyboard; - pKbd->vtSwitchSupported = FALSE; - - pKbd->private = xcalloc(sizeof(LnxKbdPrivRec), 1); - if (pKbd->private == NULL) { - xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n"); - return FALSE; - } - -#if defined(__powerpc__) - { - FILE *f; - f = fopen("/proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes","r"); - if (f) { - if (fgetc(f) == '0') - pKbd->CustomKeycodes = TRUE; - fclose(f); - } - } -#endif - return TRUE; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.h b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.h deleted file mode 100644 index 7b9cd434e..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_kbd.h +++ /dev/null @@ -1,5 +0,0 @@ -/* $XFree86$ */ - -extern void KbdGetMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms, - CARD8 *pModMap); - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c deleted file mode 100644 index c211d115a..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c +++ /dev/null @@ -1,113 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c,v 3.5 2001/10/01 13:44:14 eich Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include "xf86_OSlib.h" -#include "xf86.h" - - -#define MODPROBE_PATH_FILE "/proc/sys/kernel/modprobe" -#define MAX_PATH 1024 - - -#if 0 -/* XFree86 #defines execl to be the xf86execl() function which does - * a fork AND exec. We don't want that. We want the regular, - * standard execl(). - */ -#ifdef execl -#undef execl -#endif -#endif - - -/* - * Load a Linux kernel module. - * This is used by the DRI/DRM to load a DRM kernel module when - * the X server starts. It could be used for other purposes in the future. - * Input: - * modName - name of the kernel module (Ex: "tdfx") - * Return: - * 0 for failure, 1 for success - */ -int -xf86LoadKernelModule(const char *modName) -{ - char mpPath[MAX_PATH] = ""; - int fd = -1, status, n; - pid_t pid; - - /* get the path to the modprobe program */ - fd = open(MODPROBE_PATH_FILE, O_RDONLY); - if (fd >= 0) { - int count = read(fd, mpPath, MAX_PATH - 1); - if (count <= 0) { - mpPath[0] = 0; - } - else if (mpPath[count - 1] == '\n') { - mpPath[count - 1] = 0; /* replaces \n with \0 */ - } - close(fd); - /* if this worked, mpPath will be "/sbin/modprobe" or similar. */ - } - - if (mpPath[0] == 0) { - /* we failed to get the path from the system, use a default */ - strcpy(mpPath, "/sbin/modprobe"); - } - - /* now fork/exec the modprobe command */ - /* - * It would be good to capture stdout/stderr so that it can be directed - * to the log file. modprobe errors currently are missing from the log - * file. - */ - switch (pid = fork()) { - case 0: /* child */ - /* change real/effective user ID to 0/0 as we need to - * preinstall agpgart module for some DRM modules - */ - if (setreuid(0,0)) { - xf86Msg(X_WARNING,"LoadKernelModule: " - "Setting of real/effective user Id to 0/0 failed"); - } - setenv("PATH","/sbin",1); - n = execl(mpPath, "modprobe", modName, NULL); - xf86Msg(X_WARNING,"LoadKernelModule %s\n",strerror(errno)); - exit(EXIT_FAILURE); /* if we get here the child's exec failed */ - break; - case -1: /* fork failed */ - return 0; - default: /* fork worked */ - { - /* XXX we loop over waitpid() because it sometimes fails on - * the first attempt. Don't know why! - */ - int count = 0, p; - do { - p = waitpid(pid, &status, 0); - } while (p == -1 && count++ < 4); - - if (p == -1) { - return 0; - } - - if (WIFEXITED(status) && WEXITSTATUS(status) == 0) { - return 1; /* success! */ - } - else { - return 0; - } - } - } - - /* never get here */ - return 0; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_mouse.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_mouse.c deleted file mode 100644 index d73c69853..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_mouse.c +++ /dev/null @@ -1,206 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_mouse.c,v 1.2 2003/10/08 14:58:30 dawes Exp $ */ - -/* - * Copyright 1999 by The XFree86 Project, Inc. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Xinput.h" -#include "xf86OSmouse.h" -#include "xf86_OSlib.h" -#include -#include -#include - -static int -SupportedInterfaces(void) -{ - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO; -} - -static const char * -DefaultProtocol(void) -{ - return "Auto"; -} - -#define DEFAULT_MOUSE_DEV "/dev/mouse" -#define DEFAULT_PS2_DEV "/dev/psaux" -#define DEFAULT_GPM_DATA_DEV "/dev/gpmdata" -#define DEFAULT_GPM_CTL_DEV "/dev/gpmdata" - -static const char *mouseDevs[] = { - DEFAULT_MOUSE_DEV, - DEFAULT_PS2_DEV, - DEFAULT_GPM_DATA_DEV, - NULL -}; - -typedef enum { - MOUSE_PROTO_UNKNOWN = 0, - MOUSE_PROTO_SERIAL, - MOUSE_PROTO_PS2, - MOUSE_PROTO_MSC, - MOUSE_PROTO_GPM -} protocolTypes; - -static struct { - protocolTypes proto; - const char *name; -} devproto[] = { - { MOUSE_PROTO_UNKNOWN, NULL }, - { MOUSE_PROTO_PS2, "PS/2" }, - { MOUSE_PROTO_MSC, "MouseSystems" }, - { MOUSE_PROTO_GPM, "GPM" } -}; - -static const char * -FindDevice(InputInfoPtr pInfo, const char *protocol, int flags) -{ - int fd = -1; - const char **pdev; - - for (pdev = mouseDevs; *pdev; pdev++) { - SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK | O_EXCL)); - if (fd == -1) { -#ifdef DEBUG - ErrorF("Cannot open %s (%s)\n", *pdev, strerror(errno)); -#endif - } else - break; - } - - if (*pdev) { - close(fd); - /* Set the Device option. */ - pInfo->conf_idev->commonOptions = - xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", *pdev); - xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n", - pInfo->name, *pdev); - } - - return *pdev; -} - -static const char * -GuessProtocol(InputInfoPtr pInfo, int flags) -{ - int fd = -1; - const char *dev; - char *realdev; - struct stat sbuf; - int i; - int proto = MOUSE_PROTO_UNKNOWN; - - dev = xf86SetStrOption(pInfo->conf_idev->commonOptions, "Device", NULL); - if (!dev) { -#ifdef DEBUG - ErrorF("xf86SetStrOption failed to return the device name\n"); -#endif - return NULL; - } - /* Look at the device name to guess the protocol. */ - realdev = NULL; - if (strcmp(dev, DEFAULT_MOUSE_DEV) == 0) { - if (lstat(dev, &sbuf) != 0) { -#ifdef DEBUG - ErrorF("lstat failed for %s (%s)\n", dev, strerror(errno)); -#endif - return NULL; - } - if (S_ISLNK(sbuf.st_mode)) { - realdev = xnfalloc(PATH_MAX + 1); - i = readlink(dev, realdev, PATH_MAX); - if (i <= 0) { -#ifdef DEBUG - ErrorF("readlink failed for %s (%s)\n", dev, strerror(errno)); -#endif - xfree(realdev); - return NULL; - } - realdev[i] = '\0'; - } - } - if (!realdev) - realdev = xnfstrdup(dev); - else { - /* If realdev doesn't contain a '/' then prepend "/dev/" */ - if (!strchr(realdev, '/')) { - char *tmp = xnfalloc(strlen(realdev) + 5 + 1); - sprintf(tmp, "/dev/%s", realdev); - xfree(realdev); - realdev = tmp; - } - } - - if (strcmp(realdev, DEFAULT_PS2_DEV) == 0) - proto = MOUSE_PROTO_PS2; - else if (strcmp(realdev, DEFAULT_GPM_DATA_DEV) == 0) - proto = MOUSE_PROTO_MSC; - else if (strcmp(realdev, DEFAULT_GPM_CTL_DEV) == 0) - proto = MOUSE_PROTO_GPM; - xfree(realdev); - /* - * If the protocol can't be guessed from the device name, - * try to characterise it. - */ - if (proto == MOUSE_PROTO_UNKNOWN) { - SYSCALL (fd = open(dev, O_RDWR | O_NONBLOCK | O_EXCL)); - if (isatty(fd)) { - /* Serial PnP has already failed, so give up. */ - } else { - if (fstat(fd, &sbuf) != 0) { -#ifdef DEBUG - ErrorF("fstat failed for %s (%s)\n", dev, strerror(errno)); -#endif - close(fd); - return NULL; - } - if (S_ISFIFO(sbuf.st_mode)) { - /* Assume GPM data in MSC format. */ - proto = MOUSE_PROTO_MSC; - } else { - /* Default to PS/2 */ - proto = MOUSE_PROTO_PS2; - } - } - close(fd); - } - if (proto == MOUSE_PROTO_UNKNOWN) { - xf86Msg(X_ERROR, "%s: GuessProtocol: Cannot find mouse protocol.\n", - pInfo->name); - return NULL; - } else { - for (i = 0; i < sizeof(devproto)/sizeof(devproto[0]); i++) { - if (devproto[i].proto == proto) { - xf86Msg(X_INFO, - "%s: GuessProtocol: " - "setting mouse protocol to \"%s\"\n", - pInfo->name, devproto[i].name); - return devproto[i].name; - } - } - } - return NULL; -} - -OSMouseInfoPtr -xf86OSMouseInit(int flags) -{ - OSMouseInfoPtr p; - - p = xcalloc(sizeof(OSMouseInfoRec), 1); - if (!p) - return NULL; - p->SupportedInterfaces = SupportedInterfaces; - p->DefaultProtocol = DefaultProtocol; - p->FindDevice = FindDevice; - p->GuessProtocol = GuessProtocol; - return p; -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c deleted file mode 100644 index cec9226c8..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c +++ /dev/null @@ -1,230 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c,v 3.8 2002/04/09 15:59:37 tsi Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" -#define XF86_OS_PRIVS -#include "xf86_OSproc.h" -#include "xf86Pci.h" - -#ifdef __sparc__ -#define PCIADDR_TYPE long long -#define PCIADDR_IGNORE_FMT "%*x" -#define PCIADDR_FMT "%llx" -#else -#define PCIADDR_TYPE long -#define PCIADDR_IGNORE_FMT "%*x" -#define PCIADDR_FMT "%lx" -#endif - -FILE *xf86OSLinuxPCIFile = NULL; - -Bool -xf86GetPciSizeFromOS(PCITAG tag, int index, int* bits) -{ - char c[0x200]; - char *res; - unsigned int bus, devfn, dev, fn; - unsigned PCIADDR_TYPE size[7]; - unsigned int num; - signed PCIADDR_TYPE Size; - - if (index > 7) - return FALSE; - - if (!xf86OSLinuxPCIFile && \ - !(xf86OSLinuxPCIFile = fopen("/proc/bus/pci/devices","r"))) - return FALSE; - do { - res = fgets(c,0x1ff,xf86OSLinuxPCIFile); - if (res) { - num = sscanf(res, - /*bus+dev vendorid deviceid irq */ - "%02x%02x\t%*04x%*04x\t%*x" - /* 7 PCI resource base addresses */ - "\t" PCIADDR_IGNORE_FMT - "\t" PCIADDR_IGNORE_FMT - "\t" PCIADDR_IGNORE_FMT - "\t" PCIADDR_IGNORE_FMT - "\t" PCIADDR_IGNORE_FMT - "\t" PCIADDR_IGNORE_FMT - "\t" PCIADDR_IGNORE_FMT - /* 7 PCI resource sizes, and then optionally a driver name */ - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT, - &bus,&devfn,&size[0],&size[1],&size[2],&size[3], - &size[4],&size[5],&size[6]); - if (num != 9) { /* apparantly not 2.3 style */ - fseek(xf86OSLinuxPCIFile, 0L, SEEK_SET); - return FALSE; - } - dev = devfn >> 3; - fn = devfn & 0x7; - if (tag == pciTag(bus,dev,fn)) { - *bits = 0; - if (size[index] != 0) { - Size = size[index] - ((PCIADDR_TYPE) 1); - while (Size & ((PCIADDR_TYPE) 0x01)) { - Size = Size >> ((PCIADDR_TYPE) 1); - (*bits)++; - } - } - fseek(xf86OSLinuxPCIFile, 0L, SEEK_SET); - return TRUE; - } - } - } while (res); - - fseek(xf86OSLinuxPCIFile, 0L, SEEK_SET); - return FALSE; -} - - - -/* Query the kvirt address (64bit) of a BAR range from TAG */ -Bool -xf86GetPciOffsetFromOS(PCITAG tag, int index, unsigned long* bases) -{ - FILE *file; - char c[0x200]; - char *res; - unsigned int bus, devfn, dev, fn; - unsigned PCIADDR_TYPE offset[7]; - unsigned int num; - - if (index > 7) - return FALSE; - - if (!(file = fopen("/proc/bus/pci/devices","r"))) - return FALSE; - do { - res = fgets(c,0x1ff,file); - if (res) { - num = sscanf(res, - /*bus+dev vendorid deviceid irq */ - "%02x%02x\t%*04x%*04x\t%*x" - /* 7 PCI resource base addresses */ - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - /* 7 PCI resource sizes, and then optionally a driver name */ - "\t" PCIADDR_IGNORE_FMT - "\t" PCIADDR_IGNORE_FMT - "\t" PCIADDR_IGNORE_FMT - "\t" PCIADDR_IGNORE_FMT - "\t" PCIADDR_IGNORE_FMT - "\t" PCIADDR_IGNORE_FMT - "\t" PCIADDR_IGNORE_FMT, - &bus,&devfn,&offset[0],&offset[1],&offset[2],&offset[3], - &offset[4],&offset[5],&offset[6]); - if (num != 9) { /* apparantly not 2.3 style */ - fclose(file); - return FALSE; - } - - dev = devfn >> 3; - fn = devfn & 0x7; - if (tag == pciTag(bus,dev,fn)) { - /* return the offset for the index requested */ - *bases = offset[index]; - fclose(file); - return TRUE; - } - } - } while (res); - - fclose(file); - return FALSE; -} - -/* Query the kvirt address (64bit) of a BAR range from size for a given TAG */ -unsigned long -xf86GetOSOffsetFromPCI(PCITAG tag, int space, unsigned long base) -{ - FILE *file; - char c[0x200]; - char *res; - unsigned int bus, devfn, dev, fn; - unsigned PCIADDR_TYPE offset[7]; - unsigned PCIADDR_TYPE size[7]; - unsigned int num; - unsigned int ndx; - - if (!(file = fopen("/proc/bus/pci/devices","r"))) - return 0; - do { - res = fgets(c,0x1ff,file); - if (res) { - num = sscanf(res, - /*bus+dev vendorid deviceid irq */ - "%02x%02x\t%*04x%*04x\t%*x" - /* 7 PCI resource base addresses */ - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - /* 7 PCI resource sizes, and then optionally a driver name */ - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT - "\t" PCIADDR_FMT, - &bus,&devfn,&offset[0],&offset[1],&offset[2],&offset[3], - &offset[4],&offset[5],&offset[6], &size[0], &size[1], &size[2], - &size[3], &size[4], &size[5], &size[6]); - if (num != 16) { /* apparantly not 2.3 style */ - fclose(file); - return 0; - } - - dev = devfn >> 3; - fn = devfn & 0x7; - if (tag == pciTag(bus,dev,fn)) { - /* ok now look through all the BAR values of this device */ - for (ndx=0; ndx<7; ndx++) { - unsigned long savePtr; - /* - * remember to lop of the last 4bits of the BAR values as they are - * memory attributes - */ - if (ndx == 6) - savePtr = (0xFFFFFFF0) & - pciReadLong(tag, PCI_CMD_BIOS_REG); - else /* this the ROM bar */ - savePtr = (0xFFFFFFF0) & - pciReadLong(tag, PCI_CMD_BASE_REG + (0x4 * ndx)); - - /* find the index of the incoming base */ - if (base >= savePtr && base <= (savePtr + size[ndx])) { - fclose(file); - return (offset[ndx] & ~(0xFUL)) + (base - savePtr); - } - } - } - } - } while (res); - - fclose(file); - return 0; - -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c deleted file mode 100644 index 577439c54..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c +++ /dev/null @@ -1,1169 +0,0 @@ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 1.10 2005/09/19 18:38:26 alanc Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.67 2003/06/25 18:27:07 eich Exp $ */ -/* - * Copyright 1992 by Orest Zborowski - * Copyright 1993 by David Wexelblat - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Orest Zborowski and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Orest Zborowski - * and David Wexelblat make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * OREST ZBOROWSKI AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID WEXELBLAT BE LIABLE - * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: lnx_video.c /main/9 1996/10/19 18:06:34 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include - -#include -#include "input.h" -#include "scrnintstr.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86OSpriv.h" -#include "lnx.h" -#ifdef __alpha__ -#include "shared/xf86Axp.h" -#endif - -#ifdef HAS_MTRR_SUPPORT -#include -#endif - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -static Bool ExtendedEnabled = FALSE; - -#ifdef __ia64__ - -#include "compiler.h" -#include - -#elif !defined(__powerpc__) && \ - !defined(__mc68000__) && \ - !defined(__sparc__) && \ - !defined(__mips__) - -/* - * Due to conflicts with "compiler.h", don't rely on to declare - * these. - */ -extern int ioperm(unsigned long __from, unsigned long __num, int __turn_on); -extern int iopl(int __level); - -#endif - -#ifdef __alpha__ - -# ifdef LIBC_IS_FIXED -extern void sethae(unsigned long hae); -# else -# include -# define sethae(x) syscall(301,x); -# endif - -/* define to test the Sparse addressing on a non-Jensen */ -# ifdef TEST_JENSEN_CODE -# define isJensen (1) -# else -# define isJensen (axpSystem == JENSEN) -# endif - -# define BUS_BASE bus_base - -#else - -#define BUS_BASE (0) - -#endif /* __alpha__ */ - -/***************************************************************************/ -/* Video Memory Mapping section */ -/***************************************************************************/ - -static pointer mapVidMem(int, unsigned long, unsigned long, int); -static void unmapVidMem(int, pointer, unsigned long); -#if defined (__alpha__) -static pointer mapVidMemSparse(int, unsigned long, unsigned long, int); -extern axpDevice lnxGetAXP(void); -static void unmapVidMemSparse(int, pointer, unsigned long); -# if defined(JENSEN_SUPPORT) -static pointer mapVidMemJensen(int, unsigned long, unsigned long, int); -static void unmapVidMemJensen(int, pointer, unsigned long); -# endif -static axpDevice axpSystem = -1; -static Bool needSparse; -static unsigned long hae_thresh; -static unsigned long hae_mask; -static unsigned long bus_base; -static unsigned long sparse_size; -#endif - -#ifdef HAS_MTRR_SUPPORT - -#define SPLIT_WC_REGIONS 1 - -static pointer setWC(int, unsigned long, unsigned long, Bool, MessageType); -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. */ -static int mtrr_fd = MTRR_FD_UNOPENED; - -/* Open /proc/mtrr. FALSE on failure. Will always fail on Linux 2.0, - and will fail on Linux 2.2 with MTRR support configured out, - so verbosity should be chosen appropriately. */ -static Bool -mtrr_open(int verbosity) -{ - /* Only report absence of /proc/mtrr once. */ - static Bool warned = FALSE; - - char **fn; - static char *mtrr_files[] = { - "/dev/cpu/mtrr", /* Possible future name */ - "/proc/mtrr", /* Current name */ - NULL - }; - - if (mtrr_fd == MTRR_FD_UNOPENED) { - /* So open it. */ - for (fn = mtrr_files; mtrr_fd < 0 && *fn; fn++) - mtrr_fd = open(*fn, 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; -} - -/* - * We maintain a list of WC regions for each physical mapping so they can - * be undone when unmapping. - */ - -struct mtrr_wc_region { - 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) -{ - /* 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 = xalloc(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 { - xfree(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) -{ - struct mtrr_gentry gent; - struct mtrr_wc_region *wcreturn = NULL, **wcr; - - if (!mtrr_open(2)) - 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); - } - } - } - return wcreturn; -} - - -static struct mtrr_wc_region * -mtrr_add_wc_region(int screenNum, unsigned long base, unsigned long size, - MessageType from) -{ - struct mtrr_wc_region **wcr, *wcreturn, *curwcr; - - /* - * There can be only one.... - */ - - 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. */ - - if (!mtrr_open(from == X_CONFIG ? 0 : 2)) - return wcreturn; - - *wcr = curwcr = xalloc(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; - -#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; -#ifdef DEBUG - ErrorF("WC_BASE: 0x%lx WC_END: 0x%lx\n",base,base+d_size-1); -#endif - 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; - xfree(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; - xfree(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); -} - -static void -undoWC(int screenNum, pointer regioninfo) -{ - mtrr_undo_wc_region(screenNum, regioninfo); -} - -#endif /* HAS_MTRR_SUPPORT */ - -void -xf86OSInitVidMem(VidMemInfoPtr pVidMem) -{ - 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; - sparse_size = xf86AXPParams[axpSystem].size; - } - bus_base = _bus_base(); - } - if (isJensen) { -# ifndef JENSEN_SUPPORT - FatalError("Jensen is not supported any more\n" - "If you are intereseted in fixing Jensen support\n" - "please contact xfree86@xfree86.org\n"); -# else - xf86Msg(X_INFO,"Machine type is Jensen\n"); - pVidMem->mapMem = mapVidMemJensen; - pVidMem->unmapMem = unmapVidMemJensen; -# endif /* JENSEN_SUPPORT */ - } else 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__ */ - - -#ifdef HAS_MTRR_SUPPORT - pVidMem->setWC = setWC; - pVidMem->undoWC = undoWC; -#endif - 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) -{ - return NULL; -} -#else -static pointer -mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) -{ - pointer base; - int fd; - int mapflags = MAP_SHARED; - int prot; - memType realBase, alignOff; - - realBase = Base & ~(getpagesize() - 1); - alignOff = Base - realBase; -#ifdef DEBUG - ErrorF("base: %lx, realBase: %lx, alignOff: %lx \n", - Base,realBase,alignOff); -#endif - -#if defined(__ia64__) -#ifndef MAP_WRITECOMBINED -#define MAP_WRITECOMBINED 0x00010000 -#endif -#ifndef MAP_NONCACHED -#define MAP_NONCACHED 0x00020000 -#endif - if(flags & VIDMEM_FRAMEBUFFER) - mapflags |= MAP_WRITECOMBINED; - else - 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); -#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 (flags & VIDMEM_READONLY) - prot = PROT_READ; - else - 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); - close(fd); - if (base == MAP_FAILED) { - FatalError("xf86MapVidMem: Could not mmap framebuffer" - " (0x%08lx,0x%lx) (%s)\n", Base, Size, - strerror(errno)); - } -#ifdef DEBUG - ErrorF("base: %lx aligned base: %lx\n",base, base + alignOff); -#endif - return (char *)base + alignOff; -} -#endif /* !(__sparc__) */ - -static void -unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - memType alignOff = (memType)Base - - ((memType)Base & ~(getpagesize() - 1)); - -#ifdef DEBUG - ErrorF("alignment offset: %lx\n",alignOff); -#endif - munmap((caddr_t)((memType)Base - alignOff), (Size + alignOff)); -} - - -/***************************************************************************/ -/* I/O Permissions section */ -/***************************************************************************/ - -#if defined(__powerpc__) -volatile unsigned char *ioBase = NULL; - -#ifndef __NR_pciconfig_iobase -#define __NR_pciconfig_iobase 200 -#endif - -#endif - -Bool -xf86EnableIO(void) -{ -#if defined(__powerpc__) - int fd; - unsigned int ioBase_phys; -#endif - - if (ExtendedEnabled) - return TRUE; - -#if defined(__powerpc__) - 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); -/* 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; - } -#endif - } - close(fd); -#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) - 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__) - ioperm(0x40,4,0); /* trap access to the timer chip */ - ioperm(0x60,4,0); /* trap access to the keyboard controller */ -# endif -#endif - ExtendedEnabled = TRUE; - - return TRUE; -} - -void -xf86DisableIO(void) -{ - if (!ExtendedEnabled) - return; -#if defined(__powerpc__) - munmap(ioBase, 0x20000); - ioBase = NULL; -#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) - iopl(0); - ioperm(0, 1024, 0); -#endif - ExtendedEnabled = FALSE; - - return; -} - - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -/* XXX The #ifdefs should be made simpler. */ - -Bool -xf86DisableInterrupts() -{ -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__sh__) && !defined(__hppa__) - if (!ExtendedEnabled) - if (iopl(3) || ioperm(0, 1024, 1)) - return (FALSE); -#endif -#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) || defined(__arm__) || defined(__sh__) || defined(__ia64__) || defined(__hppa__) -#else -# ifdef __GNUC__ -# if defined(__ia64__) -# if 0 - __asm__ __volatile__ (";; rsm psr.i;; srlz.d" ::: "memory"); -# endif -# else - __asm__ __volatile__("cli"); -# endif -# else - asm("cli"); -# endif -#endif -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__ia64__) && !defined(__hppa__) - if (!ExtendedEnabled) { - iopl(0); - ioperm(0, 1024, 0); - } - -#endif - return (TRUE); -} - -void -xf86EnableInterrupts() -{ -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__sh__) && !defined(__hppa__) - if (!ExtendedEnabled) - if (iopl(3) || ioperm(0, 1024, 1)) - return; -#endif -#if defined(__alpha__) || defined(__mc68000__) || defined(__powerpc__) || defined(__sparc__) || defined(__mips__) || defined(__arm__) || defined(__sh__) || defined(__ia64__) || defined(__hppa__) -#else -# ifdef __GNUC__ -# if defined(__ia64__) -# if 0 - __asm__ __volatile__ (";; ssm psr.i;; srlz.d" ::: "memory"); -# endif -# else - __asm__ __volatile__("sti"); -# endif -# else - asm("sti"); -# endif -#endif -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__ia64__) && !defined(__hppa__) - if (!ExtendedEnabled) { - iopl(0); - ioperm(0, 1024, 0); - } -#endif - return; -} - -#if defined (__alpha__) - -#define vuip volatile unsigned int * - -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); -extern void -writeDenseNB16(int Value, pointer Base, register unsigned long Offset); -extern void -writeDenseNB32(int Value, pointer Base, register unsigned long Offset); -extern void -writeDense8(int Value, pointer Base, register unsigned long Offset); -extern void -writeDense16(int Value, pointer Base, register unsigned long Offset); -extern void -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); -static void -writeSparseNB16(int Value, pointer Base, register unsigned long Offset); -static void -writeSparseNB32(int Value, pointer Base, register unsigned long Offset); -static void -writeSparse8(int Value, pointer Base, register unsigned long Offset); -static void -writeSparse16(int Value, pointer Base, register unsigned long Offset); -static void -writeSparse32(int Value, pointer Base, register unsigned long Offset); - -#define DENSE_BASE 0x2ff00000000UL -#define SPARSE_BASE 0x30000000000UL - -static unsigned long msb_set = 0; - -static pointer -mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags) -{ - int fd, prot; - unsigned long ret, rets = 0; - - 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; - } - - 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)); - } - -#if 0 - 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; - else - 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)); - - /* - * Do SPARSE mmap only when MMIO and not MMIO_32BIT, or FRAMEBUFFER - * and SPARSE (which should require the use of read/write macros). - * - * By not SPARSE mmapping an 8MB framebuffer, we can save approx. 256K - * 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)); - } - - close(fd); - - if (ret == (unsigned long)MAP_FAILED) { - FatalError("xf86MapVidMemSparse: Could not (dense) mmap fb (%s)\n", - 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)); - } - } - -#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); - else - 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; -} - -static void -unmapVidMemSparse(int ScreenNum, pointer Base, unsigned long Size) -{ - unsigned long Offset = (unsigned long)Base - DENSE_BASE; -#if 1 - xf86Msg(X_INFO,"unmapVidMemSparse: unmapping Base 0x%lx Size 0x%lx\n", - Base, Size); -#endif - /* Unmap DENSE always. */ - 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); -} - -static int -readSparse8(pointer Base, register unsigned long Offset) -{ - register unsigned long result, shift; - register unsigned long msb; - - mem_barrier(); - 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; - } - } - - mem_barrier(); - result = *(vuip) (SPARSE_BASE + (Offset << 5)); - result >>= shift; - return 0xffUL & result; -} - -static int -readSparse16(pointer Base, register unsigned long Offset) -{ - register unsigned long result, shift; - register unsigned long msb; - - mem_barrier(); - 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; - } - } - - mem_barrier(); - result = *(vuip)(SPARSE_BASE + (Offset<<5) + (1<<(5-2))); - result >>= shift; - return 0xffffUL & result; -} - -static int -readSparse32(pointer Base, register unsigned long Offset) -{ - /* NOTE: this is really using DENSE. */ - mem_barrier(); - return *(vuip)((unsigned long)Base+(Offset)); -} - -static void -writeSparse8(int Value, pointer Base, register unsigned long Offset) -{ - register unsigned long msb; - register unsigned int b = Value & 0xffU; - - write_mem_barrier(); - 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; - } - } - - write_mem_barrier(); - *(vuip) (SPARSE_BASE + (Offset << 5)) = b * 0x01010101; -} - -static void -writeSparse16(int Value, pointer Base, register unsigned long Offset) -{ - register unsigned long msb; - register unsigned int w = Value & 0xffffU; - - write_mem_barrier(); - 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; - } - } - - write_mem_barrier(); - *(vuip)(SPARSE_BASE + (Offset<<5) + (1<<(5-2))) = w * 0x00010001; -} - -static void -writeSparse32(int Value, pointer Base, register unsigned long Offset) -{ - /* NOTE: this is really using DENSE. */ - write_mem_barrier(); - *(vuip)((unsigned long)Base + (Offset)) = Value; - return; -} - -static void -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; - if (Offset >= hae_thresh) { - msb = Offset & hae_mask; - Offset -= msb; - if (msb_set != msb) { - sethae(msb); - msb_set = msb; - } - } - *(vuip) (SPARSE_BASE + (Offset << 5)) = b * 0x01010101; -} - -static void -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; - if (Offset >= hae_thresh) { - msb = Offset & hae_mask; - Offset -= msb; - if (msb_set != msb) { - sethae(msb); - msb_set = msb; - } - } - *(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; - 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; - -#ifdef JENSEN_SUPPORT - -static int -readSparseJensen8(pointer Base, register unsigned long Offset); -static int -readSparseJensen16(pointer Base, register unsigned long Offset); -static int -readSparseJensen32(pointer Base, register unsigned long Offset); -static void -writeSparseJensen8(int Value, pointer Base, register unsigned long Offset); -static void -writeSparseJensen16(int Value, pointer Base, register unsigned long Offset); -static void -writeSparseJensen32(int Value, pointer Base, register unsigned long Offset); -static void -writeSparseJensenNB8(int Value, pointer Base, register unsigned long Offset); -static void -writeSparseJensenNB16(int Value, pointer Base, register unsigned long Offset); -static void -writeSparseJensenNB32(int Value, pointer Base, register unsigned long Offset); - -/* - * The Jensen lacks dense memory, thus we have to address the bus via - * the sparse addressing scheme. - * - * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996 - */ - -#ifdef TEST_JENSEN_CODE -#define SPARSE (5) -#else -#define SPARSE (7) -#endif - -#define JENSEN_SHIFT(x) ((long)x<>= shift; - return 0xffUL & result; -} - -static int -readSparseJensen16(pointer Base, register unsigned long Offset) -{ - register unsigned long result, shift; - - mem_barrier(); - shift = (Offset & 0x2) << 3; - - result = *(vuip)((unsigned long)Base+(Offset<>= shift; - return 0xffffUL & result; -} - -static int -readSparseJensen32(pointer Base, register unsigned long Offset) -{ - register unsigned long result; - - mem_barrier(); - result = *(vuip)((unsigned long)Base+(Offset< - -#if AllowSIGIO -SIGIO=sigio -#else -SIGIO=sigiostubs -#endif - -#if !defined(PpcArchitecture) -#if HasMTRRSupport -MTRRDEFINES = -DHAS_MTRR_SUPPORT -#endif -IOPERM_SRCS=ioperm_noop.c -IOPERM_OBJS=ioperm_noop.o -#endif - -#if defined(PpcArchitecture) -PPC_SRCS=lynx_noinline.c lynx_ppc.c -PPC_OBJS=lynx_noinline.o lynx_ppc.o -#endif - -MOUSESRC = lynx_mouse.c -MOUSEOBJ = lynx_mouse.o - -SRCS = lynx_init.c lynx_video.c lynx_io.c lynx_mmap.c \ - VTsw_usl.c std_kbdEv.c posix_tty.c $(MOUSESRC) \ - $(IOPERM_SRCS) $(PPC_SRCS) libc_wrapper.c stdResource.c stdPci.c \ - vidmem.c $(SIGIO).c pm_noop.c kmod_noop.c agp_noop.c - -OBJS = lynx_init.o lynx_video.o lynx_io.o lynx_mmap.o \ - VTsw_usl.o std_kbdEv.o posix_tty.o $(MOUSEOBJ) \ - $(IOPERM_OBJS) $(PPC_OBJS) libc_wrapper.o stdResource.o stdPci.o \ - vidmem.o $(SIGIO).o pm_noop.o kmod_noop.o agp_noop.o - -INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) -I$(EXTINCSRC) \ - -I$(ENV_PREFIX)/sys/lynx.os -I$(DRMSRCDIR)/shared-core - -RESDEFINES = -DUSESTDRES - -DEFINES = $(RESDEFINES) $(MTRRDEFINES) - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() - -#if !defined(PpcArchitecture) -LinkSourceFile(ioperm_noop.c,../shared) -#endif -LinkSourceFile(VTsw_usl.c,../shared) -LinkSourceFile(std_kbdEv.c,../shared) -LinkSourceFile(posix_tty.c,../shared) -LinkSourceFile(libc_wrapper.c,../shared) -LinkSourceFile(stdResource.c,../shared) -LinkSourceFile(stdPci.c,../shared) -LinkSourceFile(vidmem.c,../shared) -LinkSourceFile($(SIGIO).c,../shared) -LinkSourceFile(pm_noop.c,../shared) -LinkSourceFile(kmod_noop.c,../shared) -LinkSourceFile(agp_noop.c,../shared) - -DependTarget() diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_init.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_init.c deleted file mode 100644 index 84db50127..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_init.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright 1993 by Thomas Mueller - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Mueller not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Mueller makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS MUELLER BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ - - -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_init.c,v 3.2 1998/07/25 16:56:45 dawes Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -static int VTnum = -1; - -void -xf86OpenConsole() -{ - struct vt_mode VT; - char vtname1[11]; - int fd, pgrp; - MessageType from = X_PROBED; - - if (serverGeneration == 1) - { - /* check if we're run with euid==0 */ - if (geteuid() != 0) - { - FatalError("xf86OpenConsole: Server must be suid root\n"); - } - - /* - * setup the virtual terminal manager - * NOTE: - * We use the out-of-the-box atc terminal driver, - * not the GE contributed vdt driver. - * Also, we do setup signals for VT switching which - * is not really necessary because we don't feed the - * VT switch keystrokes to the kernel in xf86Events.c - * (it bombs occasionally...) - */ - if (VTnum != -1) - { - xf86Info.vtno = VTnum; - from = X_CMDLINE; - } - else - { - /* We could use /dev/con which is usually a symlink - * to /dev/atc0 but one could configure the system - * to use a serial line as console device, so to - * be sure we take /dev/atc0. - */ - if ((fd = open("/dev/atc0",O_WRONLY,0)) < 0) - { - FatalError( - "xf86OpenConsole: Cannot open /dev/atc0 (%s)\n", - strerror(errno)); - } - if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) || - (xf86Info.vtno == -1)) - { - FatalError("xf86OpenConsole: Cannot find a free VT\n"); - } - close(fd); - } - xf86Msg(from, "using VT number %d\n", xf86Info.vtno); - - sprintf(vtname1,"/dev/atc%d",xf86Info.vtno); - - pgrp = getpgrp(); /* POSIX version ! */ - ioctl(xf86Info.consoleFd, TIOCSPGRP, &pgrp); - - if ((xf86Info.consoleFd = open(vtname1,O_RDWR|O_NDELAY,0)) < 0) - { - FatalError( - "xf86OpenConsole: Cannot open %s (%s)\n", - vtname1, strerror(errno)); - } - /* change ownership of the vt */ - chown(vtname1, getuid(), getgid()); - - /* - * now get the VT - */ - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) - { - xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); - } - if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) - { - FatalError("xf86OpenConsole: VT_GETMODE failed\n"); - } - - /* for future use... */ - signal(SIGUSR1, xf86VTRequest); - - VT.mode = VT_PROCESS; - VT.relsig = SIGUSR1; - VT.acqsig = SIGUSR1; - if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0) - { - FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n"); - } - } - else - { - /* serverGeneration != 1 */ - /* - * now get the VT - */ - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) - { - xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); - } - /* - * If the server doesn't have the VT when the reset occurs, - * this is to make sure we don't continue until the activate - * signal is received. - */ - if (!xf86Screens[0]->vtSema) - sleep(5); - } - return; -} - -void -xf86CloseConsole() -{ - struct vt_mode VT; - -#if 0 - ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno); - ioctl(xf86Info.consoleFd, VT_WAITACTIVE, 0); -#endif - if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) - { - VT.mode = VT_AUTO; - ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* set dflt vt handling */ - } - close(xf86Info.consoleFd); /* make the vt-manager happy */ - return; -} - -int -xf86ProcessArgument(int argc, char *argv[], int i) -{ - if ((argv[i][0] == 'v') && (argv[i][1] == 't')) - { - if (sscanf(argv[i], "vt%2d", &VTnum) == 0) - { - UseMsg(); - VTnum = -1; - return(0); - } - return(1); - } - return(0); -} - -void -xf86UseMsg() -{ - ErrorF("vtXX use the specified VT number\n"); - return; -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_io.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_io.c deleted file mode 100644 index afd3f8962..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_io.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright 1993 by Thomas Mueller - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Mueller not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Mueller makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS MUELLER BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_io.c,v 3.9 2002/10/11 01:40:35 dawes Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#if defined(KDMKTONE) || defined(KIOCSOUND) -/* Lynx 2.2.1 has sophisticated atc stuff.... */ -void -xf86SoundKbdBell(int loudness, int pitch, int duration) -{ - if (loudness && pitch) - { -#ifdef KDMKTONE - /* - * If we have KDMKTONE use it to avoid putting the server - * to sleep - */ - ioctl(xf86Info.consoleFd, KDMKTONE, - (pitch & 0xffff) | - (((unsigned long)duration * - loudness / 50) << 16)); -#else - ioctl(xf86Info.consoleFd, KIOCSOUND, pitch); - usleep(xf86Info.bell_duration * loudness * 20); - ioctl(xf86Info.consoleFd, KIOCSOUND, 0); -#endif - } -} - -#else - -/* this is pulled from /sys/drivers/vt100/atbeep.c */ - -#define SPEAKER_CONTROL 0x61 -#define TIMER_CONTROL 0x43 -#define TIMER_DATA 0x42 -#define TIMER_LOAD_CMD 0xb6 - -#define TIMER_CONSTANT 1193280 -#define FREQ_LO(f) ((TIMER_CONSTANT / (f)) % 256) -#define FREQ_HI(f) ((TIMER_CONSTANT / (f)) / 256) - -void -xf86SoundKbdBell(int loudness, int pitch, int duration) -{ - int flo = FREQ_LO(pitch); - int fhi = FREQ_HI(pitch); - - outb(TIMER_CONTROL, TIMER_LOAD_CMD); - outb(TIMER_DATA, flo); - outb(TIMER_DATA, fhi); - - /* speaker on */ - outb(SPEAKER_CONTROL, inb(SPEAKER_CONTROL) | 3); - usleep(xf86Info.bell_duration * loudness * 20); - /* speaker off */ - outb(SPEAKER_CONTROL, inb(SPEAKER_CONTROL) & ~3); -} -#endif - -void -xf86SetKbdLeds(int leds) -{ -#ifdef KBD_SET_LEDS - ioctl(xf86Info.consoleFd, KBD_SET_LEDS, &leds); -#endif -} - -int -xf86GetKbdLeds() -{ -#ifdef KBD_SET_LEDS - int leds; - - if (ioctl(xf86Info.consoleFd, KBD_SET_LEDS, &leds) < 0) - return 0; - - return leds; -#endif - return 0; -} - -void -xf86SetKbdRepeat(char rad) -{ -} - -static struct termio kbdtty; - -void -xf86KbdInit() -{ - ioctl(xf86Info.consoleFd, TCGETA, &kbdtty); -} - -int -xf86KbdOn() -{ - struct termio nTty; - - /* set CAPS_LOCK to behave as CAPS_LOCK not as CTRL */ - write(xf86Info.consoleFd, "\033<", 2); - - /* enable scan mode */ - ioctl(xf86Info.consoleFd, TIO_ENSCANMODE, NULL); - - nTty = kbdtty; - 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; - ioctl(xf86Info.consoleFd, TCSETA, &nTty); - - return(xf86Info.consoleFd); -} - -int -xf86KbdOff() -{ - /* disable scan mode */ - ioctl(xf86Info.consoleFd, TIO_DISSCANMODE, NULL); - ioctl(xf86Info.consoleFd, TCSETA, &kbdtty); - return(xf86Info.consoleFd); -} - -#include "xf86OSKbd.h" - -Bool -xf86OSKbdPreInit(InputInfoPtr pInfo) -{ - return FALSE; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_mmap.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_mmap.c deleted file mode 100644 index c00b6700f..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_mmap.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 1993 by Thomas Mueller - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Mueller not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Mueller makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS MUELLER BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_mmap.c,v 3.5 1998/08/29 05:43:58 dawes Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -/* - * Read BIOS using smem_create facility - */ - -int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ -#if defined(__powerpc__) - xf86Msg(X_WARNING, "xf86ReadBios: no BIOS-probe on PowerPC\n"); - return(-1); -#else - char *p; - int mlen; - - mlen = (Offset + Len + 4095) & ~4095; - p = smem_create("BIOS-probe", (char *)Base, mlen, SM_READ); - if (p == NULL) - { - /* check if there is a stale segment around */ - if (smem_remove("BIOS-probe") == 0) { - xf86Msg(X_INFO, - "xf86ReadBios: removed stale smem_ segment\n"); - p = smem_create("BIOS-probe", (char *)Base, mlen, SM_READ); - } - if (p == NULL) { - xf86Msg(X_WARNING, "xf86ReadBios: Failed to smem_create " - "Base %x len %x %s \n", - Base, mlen, strerror(errno)); - return(-1); - } - } - memcpy(Buf, p + Offset, Len); - smem_create(NULL, p, 0, SM_DETACH); - smem_remove("BIOS-probe"); - return(Len); -#endif -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_mouse.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_mouse.c deleted file mode 100644 index 68aca5d38..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_mouse.c +++ /dev/null @@ -1,34 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_mouse.c,v 1.1 1999/05/22 08:40:14 dawes Exp $ */ - -/* - * Copyright 1999 by The XFree86 Project, Inc. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Xinput.h" -#include "xf86OSmouse.h" - -static int -SupportedInterfaces(void) -{ - /* XXX Need to check this. */ - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO; -} - -OSMouseInfoPtr -xf86OSMouseInit(int flags) -{ - OSMouseInfoPtr p; - - p = xcalloc(sizeof(OSMouseInfoRec), 1); - if (!p) - return NULL; - p->SupportedInterfaces = SupportedInterfaces; - return p; -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c deleted file mode 100644 index 1c12f62f9..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c +++ /dev/null @@ -1,178 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_noinline.c,v 3.5 2000/07/31 23:25:18 tsi Exp $ */ -/* - * Copyright 1998 by Metro Link Incorporated - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#if /* NO_INLINE && */ defined(__powerpc__) - -#include "xf86Pci.h" - -extern volatile unsigned char *ioBase; - -void -eieio() -{ - __asm__ __volatile__ ("eieio"); -} - -unsigned long -ldl_brx(volatile unsigned char *base, int ndx) -{ - register unsigned long tmp = *(volatile unsigned long *)(base+ndx); - return( ((tmp & 0x000000ff) << 24) | - ((tmp & 0x0000ff00) << 8) | - ((tmp & 0x00ff0000) >> 8) | - ((tmp & 0xff000000) >> 24) ); -} - -unsigned short -ldw_brx(volatile unsigned char *base, int ndx) -{ - register unsigned short tmp = *(volatile unsigned short *)(base+ndx); - return((tmp << 8) | (tmp >> 8)); -} - -void -stl_brx(unsigned long val, volatile unsigned char *base, int ndx) -{ - unsigned char *p = (unsigned char *)&val; - unsigned long tmp = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | (p[0] << 0); - *(volatile unsigned long *)(base+ndx) = tmp; -} - -void -stw_brx(unsigned short val, volatile unsigned char *base, int ndx) -{ - unsigned char *p = (unsigned char *)&val; - unsigned short tmp = (p[1] << 8) | p[0]; - *(volatile unsigned short *)(base+ndx) = tmp; -} - -void -outb(IOADDRESS port, unsigned char value) -{ - *((volatile unsigned char *)(ioBase + port)) = value; eieio(); -} - -void -outw(IOADDRESS port, unsigned short value) -{ - stw_brx(value, ioBase, port); eieio(); -} - -void -outl(IOADDRESS port, unsigned int value) -{ - stl_brx(value, ioBase, port); eieio(); -} - -unsigned char -inb(IOADDRESS port) -{ - unsigned char val; - - val = *((volatile unsigned char *)(ioBase + port)); eieio(); - return(val); -} - -unsigned short -inw(IOADDRESS port) -{ - unsigned short val; - - val = ldw_brx(ioBase, port); eieio(); - return(val); -} - -unsigned int -inl(IOADDRESS port) -{ - unsigned int val; - - val = ldl_brx(ioBase, port); eieio(); - return(val); -} - -unsigned long -ldl_u(void *p) -{ - return (((*(unsigned char *)(p)) | - (*((unsigned char *)(p)+1)<<8) | - (*((unsigned char *)(p)+2)<<16) | - (*((unsigned char *)(p)+3)<<24))); -} - -unsigned long -ldq_u(void *p) -{ - return ldl_u(p); -} - -unsigned short -ldw_u(void *p) -{ - return(((*(unsigned char *)(p)) | - (*((unsigned char *)(p)+1)<<8))); -} - -void -stl_u(unsigned long v, void *p) -{ - - (*(unsigned char *)(p)) = (v); - (*((unsigned char *)(p)+1)) = ((v) >> 8); - (*((unsigned char *)(p)+2)) = ((v) >> 16); - (*((unsigned char *)(p)+3)) = ((v) >> 24); -} - -void -stq_u(unsigned long v, void *p) -{ - stl_u(v,p); -} - -void -stw_u(unsigned short v, void *p) -{ - (*(unsigned char *)(p)) = (v); - (*((unsigned char *)(p)+1)) = ((v) >> 8); -} - - -void -mem_barrier(void) -{ - __asm__ __volatile__("eieio"); -} - -void -write_mem_barrier(void) -{ - __asm__ __volatile__("eieio"); -} - -#endif /* NO_INLINE && __powerpc__ */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.S b/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.S deleted file mode 100644 index 3865850d1..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.S +++ /dev/null @@ -1,70 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.S,v 1.1 1999/07/10 07:24:49 dawes Exp $ */ -/* - * Copyright 1998 by Metro Link Incorporated - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - - .file "ppc.s" -.toc - .csect .text[PR] - .balign 4 - .globl ppc_flush_icache - .globl .ppc_flush_icache -.csect ppc_flush_icache[DS] -ppc_flush_icache: - .long .ppc_flush_icache, TOC[tc0], 0 -.csect .text[PR] -.ppc_flush_icache: - mflr 0 - stw 31,-4(1) - stw 0,8(1) - stwu 1,-64(1) - mr 31,1 - stw 3,88(31) - li 6, 0 /* __inst_dcbf (addr, 0); */ - dcbf 3, 6 - li 5, 32 /* __inst_dcbf (addr, LINESIZE); */ - dcbf 3, 5 - sync /* __inst_sync (); */ - li 4,0 /* __inst_icbi (addr, 0); */ - icbi 3,4 - li 7,32 /* __inst_icbi (addr, LINESIZE); */ - icbi 3,7 - sync /* __inst_sync (); */ - isync /* __inst_isync (); */ -L..1: - lwz 1,0(1) - lwz 0,8(1) - mtlr 0 - lwz 31,-4(1) - blr -LT..ppc_flush_icache: - .long 0 - .byte 0,0,32,97,128,1,1,1 - .long 0 - .long LT..ppc_flush_icache-.ppc_flush_icache - .short 16 - .byte "ppc_flush_icache" - .byte 31 -_section_.text: - .csect .data[RW] - .long _section_.text diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.c deleted file mode 100644 index 12fa3bcae..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.c +++ /dev/null @@ -1,52 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.S,v 1.1 1999/07/10 07:24:49 dawes Exp $ */ -/* - * Copyright 1998 by Metro Link Incorporated - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -void ppc_flush_icache() -{ -__asm__ __volatile__ (" \ - mflr 0 ;\ - stw 31,-4(1) ;\ - stw 0,8(1) ;\ - stwu 1,-64(1) ;\ - mr 31,1 ;\ - stw 3,88(31) ;\ - li 6, 0 ;\ - dcbf 3, 6 ;\ - li 5, 32 ;\ - dcbf 3, 5 ;\ - sync ;\ - li 4,0 ;\ - icbi 3,4 ;\ - li 7,32 ;\ - icbi 3,7 ;\ - sync ;\ - isync ;\ - lwz 1,0(1) ;\ - lwz 0,8(1) ;\ - mtlr 0 ;\ - lwz 31,-4(1) ;\ - blr ;\ -"); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c deleted file mode 100644 index 5d0949091..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c +++ /dev/null @@ -1,711 +0,0 @@ -/* - * Copyright 1993 by Thomas Mueller - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Mueller not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Mueller makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS MUELLER BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c,v 3.17 2000/10/28 01:42:27 mvojkovi Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "input.h" -#include "scrnintstr.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86OSpriv.h" - -#if defined(__powerpc__) - -# if defined(USE_MACHINE_ABSOLUTE) -# include -# else -# define __USER_SPACE_INCLUDE -# include -# endif - -void ppcPciIoMap(int bus); -#endif - -#if 0 -#define DEBUG -#endif - -#ifdef HAS_MTRR_SUPPORT -#include -#define X_MTRR_ID "XFree86" - -static pointer setWC(int, unsigned long, unsigned long, Bool, MessageType); -static void undoWC(int, pointer); -static Bool cleanMTRR(void); -static int devMemFd = -1; -#define MTRR_DEVICE "/dev/mtrr" -#endif - - -#if !defined(NO_MMAP) -#include - -int smem_remove(char *name) -{ - return(0); -} - -char *smem_create(char *name, char *arg_addr, long size, int mode) -{ - int fd; - void *addr = 0; - char *retval; - size_t len = size; - int prot = PROT_READ|PROT_WRITE|PROT_UNCACHE; - int flags = MAP_SHARED; - off_t off = (off_t)arg_addr; - - if ((fd = open("/dev/mem" , O_RDWR)) < 0) - { - retval = (char *)-1; - } - else - { - if (mode == SM_DETACH) - { - munmap(arg_addr, len); - retval = 0; - } - else - { - if ((retval = mmap (addr, len, prot, flags, fd, off) ) == MAP_FAILED) - { - retval = (char *)-1; - } - } - - close(fd); - } - - return(retval); -} - -#endif - - -/***************************************************************************/ -/* Video Memory Mapping section */ -/***************************************************************************/ - -typedef struct -{ - char name[16]; - unsigned long Base; - unsigned long Size; - char *ptr; - int RefCnt; -} -_SMEMS; - -#define MAX_SMEMS 16 - -static _SMEMS smems[MAX_SMEMS]; - - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -static void -smemCleanup(void) -{ - int i; - - for (i = 0; i < MAX_SMEMS; i++) { - if (*smems[i].name && smems[i].ptr) { - (void)smem_create(NULL, smems[i].ptr, 0, SM_DETACH); - (void)smem_remove(smems[i].name); - *smems[i].name = '\0'; - smems[i].ptr = NULL; - smems[i].Base = 0; - smems[i].Size = 0; - smems[i].RefCnt = 0; - } - } -} - -static pointer -MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) -{ - static int once; - int free_slot = -1; - int i; - - if (!once) - { - atexit(smemCleanup); - once = 1; - } - for (i = 0; i < MAX_SMEMS; i++) - { - if (!*smems[i].name && free_slot == -1) - free_slot = i; - if (smems[i].Base == Base && smems[i].Size == Size - && *smems[i].name) { - smems[i].RefCnt++; - return smems[i].ptr; - } - } - if (i == MAX_SMEMS && free_slot == -1) - { - FatalError("MapVidMem: failed to smem_create Base %x Size %x (out of SMEMS entries)\n", - Base, Size); - } - - i = free_slot; - sprintf(smems[i].name, "Video-%d", i); - smems[i].Base = Base; - smems[i].Size = Size; - - xf86MsgVerb(X_INFO, 3, "MapVidMem: Base=0x%x Size=0x%x\n", - Base, Size); - -#if defined(__powerpc__) - if (((unsigned long)Base & PHYS_IO_MEM_START) != PHYS_IO_MEM_START) { - Base = Base | PHYS_IO_MEM_START; - } -#endif - - smems[i].ptr = smem_create(smems[i].name, (char *)Base, Size, SM_READ|SM_WRITE); - smems[i].RefCnt = 1; - if (smems[i].ptr == NULL) - { - /* check if there is a stale segment around */ - if (smem_remove(smems[i].name) == 0) { - xf86Msg(X_INFO, - "MapVidMem: removed stale smem_ segment %s\n", - smems[i].name); - smems[i].ptr = smem_create(smems[i].name, - (char *)Base, Size, SM_READ|SM_WRITE); - } - if (smems[i].ptr == NULL) { - *smems[i].name = '\0'; - FatalError("MapVidMem: failed to smem_create Base %x Size %x (%s)\n", - Base, Size, strerror(errno)); - } - } - xf86MsgVerb(X_INFO, 3, "MapVidMem: Base=0x%x Size=0x%x Ptr=0x%x\n", - Base, Size, smems[i].ptr); - return smems[i].ptr; -} - -static void -UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - int i; - - xf86MsgVerb(X_INFO, 3, "UnMapVidMem: Base/Ptr=0x%x Size=0x%x\n", - Base, Size); - for (i = 0; i < MAX_SMEMS; i++) - { - if (*smems[i].name && smems[i].ptr == Base - && smems[i].Size == Size) - { - if (--smems[i].RefCnt > 0) - return; - - (void)smem_create(NULL, smems[i].ptr, 0, SM_DETACH); - xf86MsgVerb(X_INFO, 3, - "UnMapVidMem: smem_create(%s, 0x%08x, ... " - "SM_DETACH)\n", smems[i].name, smems[i].ptr); - (void)smem_remove(smems[i].name); - *smems[i].name = '\0'; - smems[i].RefCnt = 0; - return; - } - } - xf86MsgVerb(X_WARNING, 2, - "UnMapVidMem: no SMEM found for Base = %lx Size = %lx\n", - Base, Size); -} - - -void -xf86OSInitVidMem(VidMemInfoPtr pVidMem) -{ - pVidMem->linearSupported = TRUE; - pVidMem->mapMem = MapVidMem; - pVidMem->unmapMem = UnMapVidMem; - pVidMem->setWC = 0; - pVidMem->undoWC = 0; -#ifdef HAS_MTRR_SUPPORT - if (cleanMTRR()) { - pVidMem->setWC = setWC; - pVidMem->undoWC = undoWC; - } -#endif - pVidMem->initialised = TRUE; -} - - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -Bool -xf86DisableInterrupts() -{ - return(TRUE); -} - -void -xf86EnableInterrupts() -{ - return; -} - -/***************************************************************************/ -/* I/O Permissions section for PowerPC */ -/***************************************************************************/ - -#if defined(__powerpc__) - -volatile unsigned char *ioBase = MAP_FAILED; -volatile unsigned char *pciConfBase = MAP_FAILED; - -static int IOEnabled; - - -static void -removeIOSmem(void) -{ - smem_create(NULL, (char *) ioBase, 0, SM_DETACH); - smem_remove("IOBASE"); - ioBase = MAP_FAILED; -} - -Bool -xf86EnableIO() -{ - if (IOEnabled++ == 0) { - ioBase = (unsigned char *) smem_create("IOBASE", - (char *)PHYS_ISA_IO_SPACE, 64*1024, SM_READ|SM_WRITE); - if (ioBase == MAP_FAILED) { - --IOEnabled; - xf86Msg(X_WARNING,"xf86EnableIO: Failed to map I/O\n"); - return FALSE; - } else { -#ifdef DEBUG - ErrorF("xf86EnableIO: mapped I/O at vaddr 0x%08x\n", - ioBase); -#endif - atexit(removeIOSmem); - } - } - return TRUE; -} - -void -xf86DisableIO() -{ - if (!IOEnabled) - return; - - if (--IOEnabled == 0) - removeIOSmem(); - return; -} - -#if 0 -void -xf86DisableIOPrivs(void) -{ - return; -} -#endif -void -ppcPciIoMap(int bus) -{ - xf86EnableIO(); -} - -#endif - - -#ifdef HAS_MTRR_SUPPORT -/* memory range (MTRR) support for LynxOS (taken from BSD MTRR support) */ - -/* - * This code is experimental. Some parts may be overkill, and other parts - * may be incomplete. - */ - -/* - * getAllRanges returns the full list of memory ranges with attributes set. - */ - -static struct mem_range_desc * -getAllRanges(int *nmr) -{ - struct mem_range_desc *mrd; - struct mem_range_op mro; - - /* - * Find how many ranges there are. If this fails, then the kernel - * probably doesn't have MTRR support. - */ - mro.mo_arg[0] = 0; - if (ioctl(devMemFd, MEMRANGE_GET, &mro)) - return NULL; - *nmr = mro.mo_arg[0]; - mrd = xnfalloc(*nmr * sizeof(struct mem_range_desc)); - mro.mo_arg[0] = *nmr; - mro.mo_desc = mrd; - if (ioctl(devMemFd, MEMRANGE_GET, &mro)) { - xfree(mrd); - return NULL; - } - return mrd; -} - -/* - * cleanMTRR removes any memory attribute that may be left by a previous - * X server. Normally there won't be any, but this takes care of the - * case where a server crashed without being able finish cleaning up. - */ - -static Bool -cleanMTRR() -{ - struct mem_range_desc *mrd; - struct mem_range_op mro; - int nmr, i; - - /* This shouldn't happen */ - if (devMemFd < 0) { - if ((devMemFd = open(MTRR_DEVICE, O_RDONLY)) < 0) { -perror("open MTRR"); - return FALSE; - } - } - - if (!(mrd = getAllRanges(&nmr))) - return FALSE; - - for (i = 0; i < nmr; i++) { - if (strcmp(mrd[i].mr_owner, X_MTRR_ID) == 0 && - (mrd[i].mr_flags & MDF_ACTIVE)) { -#ifdef DEBUG - ErrorF("Clean for (0x%lx,0x%lx)\n", - (unsigned long)mrd[i].mr_base, - (unsigned long)mrd[i].mr_len); -#endif - if (mrd[i].mr_flags & MDF_FIXACTIVE) { - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - mrd[i].mr_flags = MDF_UNCACHEABLE; - } else { - mro.mo_arg[0] = MEMRANGE_SET_REMOVE; - } - mro.mo_desc = mrd + i; - ioctl(devMemFd, MEMRANGE_SET, &mro); - } - } -#ifdef DEBUG - sleep(10); -#endif - xfree(mrd); - return TRUE; -} - -typedef struct x_RangeRec { - struct mem_range_desc mrd; - Bool wasWC; - struct x_RangeRec * next; -} RangeRec, *RangePtr; - -static void -freeRangeList(RangePtr range) -{ - RangePtr rp; - - while (range) { - rp = range; - range = rp->next; - xfree(rp); - } -} - -static RangePtr -dupRangeList(RangePtr list) -{ - RangePtr new = NULL, rp, p; - - rp = list; - while (rp) { - p = xnfalloc(sizeof(RangeRec)); - *p = *rp; - p->next = new; - new = p; - rp = rp->next; - } - return new; -} - -static RangePtr -sortRangeList(RangePtr list) -{ - RangePtr rp1, rp2, copy, sorted = NULL, minp, prev, minprev; - unsigned long minBase; - - /* Sort by base address */ - rp1 = copy = dupRangeList(list); - while (rp1) { - minBase = rp1->mrd.mr_base; - minp = rp1; - minprev = NULL; - prev = rp1; - rp2 = rp1->next; - while (rp2) { - if (rp2->mrd.mr_base < minBase) { - minBase = rp2->mrd.mr_base; - minp = rp2; - minprev = prev; - } - prev = rp2; - rp2 = rp2->next; - } - if (minprev) { - minprev->next = minp->next; - rp1 = copy; - } else { - rp1 = minp->next; - } - minp->next = sorted; - sorted = minp; - } - return sorted; -} - -/* - * findRanges returns a list of ranges that overlap the specified range. - */ - -static void -findRanges(unsigned long base, unsigned long size, RangePtr *ucp, RangePtr *wcp) -{ - struct mem_range_desc *mrd; - int nmr, i; - RangePtr rp, *p; - - if (!(mrd = getAllRanges(&nmr))) - return; - - for (i = 0; i < nmr; i++) { - if ((mrd[i].mr_flags & MDF_ACTIVE) && - mrd[i].mr_base < base + size && - mrd[i].mr_base + mrd[i].mr_len > base) { - if (mrd[i].mr_flags & MDF_WRITECOMBINE) - p = wcp; - else if (mrd[i].mr_flags & MDF_UNCACHEABLE) - p = ucp; - else - continue; - rp = xnfalloc(sizeof(RangeRec)); - rp->mrd = mrd[i]; - rp->next = *p; - *p = rp; - } - } - xfree(mrd); -} - -/* - * This checks if the existing overlapping ranges fully cover the requested - * range. Is this overkill? - */ - -static Bool -fullCoverage(unsigned long base, unsigned long size, RangePtr overlap) -{ - RangePtr rp1, sorted = NULL; - unsigned long end; - - sorted = sortRangeList(overlap); - /* Look for gaps */ - rp1 = sorted; - end = base + size; - while (rp1) { - if (rp1->mrd.mr_base > base) { - freeRangeList(sorted); - return FALSE; - } else { - base = rp1->mrd.mr_base + rp1->mrd.mr_len; - } - if (base >= end) { - freeRangeList(sorted); - return TRUE; - } - rp1 = rp1->next; - } - freeRangeList(sorted); - return FALSE; -} - -static pointer -addWC(int screenNum, unsigned long base, unsigned long size, MessageType from) -{ - RangePtr uc = NULL, wc = NULL, retlist = NULL; - struct mem_range_desc mrd; - struct mem_range_op mro; - - findRanges(base, size, &uc, &wc); - - /* See of the full range is already WC */ - if (!uc && fullCoverage(base, size, wc)) { - xf86DrvMsg(screenNum, from, - "Write-combining range (0x%lx,0x%lx) was already set\n", - base, size); - return NULL; - } - - /* Otherwise, try to add the new range */ - mrd.mr_base = base; - mrd.mr_len = size; - strcpy(mrd.mr_owner, X_MTRR_ID); - mrd.mr_flags = MDF_WRITECOMBINE; - mro.mo_desc = &mrd; - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - if (ioctl(devMemFd, MEMRANGE_SET, &mro)) { - xf86DrvMsg(screenNum, X_WARNING, - "Failed to set write-combining range " - "(0x%lx,0x%lx)\n", base, size); - return NULL; - } else { - xf86DrvMsg(screenNum, from, - "Write-combining range (0x%lx,0x%lx)\n", base, size); - retlist = xnfalloc(sizeof(RangeRec)); - retlist->mrd = mrd; - retlist->wasWC = FALSE; - retlist->next = NULL; - return retlist; - } -} - -static pointer -delWC(int screenNum, unsigned long base, unsigned long size, MessageType from) -{ - RangePtr uc = NULL, wc = NULL, retlist = NULL; - struct mem_range_desc mrd; - struct mem_range_op mro; - - findRanges(base, size, &uc, &wc); - - /* - * See of the full range is already not WC, or if there is full - * coverage from UC ranges. - */ - if (!wc || fullCoverage(base, size, uc)) { - xf86DrvMsg(screenNum, from, - "Write-combining range (0x%lx,0x%lx) was already clear\n", - base, size); - return NULL; - } - - /* Otherwise, try to add the new range */ - mrd.mr_base = base; - mrd.mr_len = size; - strcpy(mrd.mr_owner, X_MTRR_ID); - mrd.mr_flags = MDF_UNCACHEABLE; - mro.mo_desc = &mrd; - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - if (ioctl(devMemFd, MEMRANGE_SET, &mro)) { - xf86DrvMsg(screenNum, X_WARNING, - "Failed to remove write-combining range " - "(0x%lx,0x%lx)\n", base, size); - /* XXX Should then remove all of the overlapping WC ranges */ - return NULL; - } else { - xf86DrvMsg(screenNum, from, - "Removed Write-combining range (0x%lx,0x%lx)\n", - base, size); - retlist = xnfalloc(sizeof(RangeRec)); - retlist->mrd = mrd; - retlist->wasWC = TRUE; - retlist->next = NULL; - return retlist; - } -} - -static pointer -setWC(int screenNum, unsigned long base, unsigned long size, Bool enable, - MessageType from) -{ - if (enable) - return addWC(screenNum, base, size, from); - else - return delWC(screenNum, base, size, from); -} - -static void -undoWC(int screenNum, pointer list) -{ - RangePtr rp; - struct mem_range_op mro; - Bool failed; - - rp = list; - while (rp) { -#ifdef DEBUG - ErrorF("Undo for (0x%lx,0x%lx), %d\n", - (unsigned long)rp->mrd.mr_base, - (unsigned long)rp->mrd.mr_len, rp->wasWC); -#endif - failed = FALSE; - if (rp->wasWC) { - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - rp->mrd.mr_flags = MDF_WRITECOMBINE; - strcpy(rp->mrd.mr_owner, "unknown"); - } else { - mro.mo_arg[0] = MEMRANGE_SET_REMOVE; - } - mro.mo_desc = &rp->mrd; - - if (ioctl(devMemFd, MEMRANGE_SET, &mro)) { - if (!rp->wasWC) { - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - rp->mrd.mr_flags = MDF_UNCACHEABLE; - strcpy(rp->mrd.mr_owner, "unknown"); - if (ioctl(devMemFd, MEMRANGE_SET, &mro)) - failed = TRUE; - } else - failed = TRUE; - } - if (failed) { - xf86DrvMsg(screenNum, X_WARNING, - "Failed to restore MTRR range (0x%lx,0x%lx)\n", - (unsigned long)rp->mrd.mr_base, - (unsigned long)rp->mrd.mr_len); - } - rp = rp->next; - } -} - -#endif /* HAS_MTRR_SUPPORT */ - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/BUSmemcpy.S b/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/BUSmemcpy.S deleted file mode 100644 index 373723c7d..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/BUSmemcpy.S +++ /dev/null @@ -1,153 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/BUSmemcpy.s,v 1.2 1998/07/25 16:56:49 dawes Exp $ */ -/****************************************************************************** - Copyright 1993 by Glenn G. Lai - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Glenn G. Lai not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -Glenn G. Lai DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -Glenn G. Lai -P.O. Box 4314 -Austin, Tx 78765 -(glenn@cs.utexas.edu) -8/9/93 -******************************************************************************/ -/* $XConsortium: BUSmemcpy.s /main/4 1996/02/21 17:39:34 kaleb $ */ - -/* - * Modified to use long-alignment of video memory rather than word-alignment - * to improve performance for LocalBus video cards. Function names changed - * from ISAToMem and MemToISA to BusToMem and MemToBus. - * - * David Dawes , 25 August 1993. - */ - - -#include "assyntax.h" - - FILE("BUSmemcpy.s") - - AS_BEGIN - -/* BusToMem copies from video memory to main memory - MemToBus copies from main memory to video memory - - void xf86BusToMem(unsigned char *dst, unsigned char *src, int len); - void xf86MemToBus(unsigned char *dst, unsigned char *src, int len); -*/ - -#define dst REGOFF(4,ESP) -#define src REGOFF(8,ESP) -#define len REGOFF(12,ESP) - - GLOBL GLNAME(xf86BusToMem) - GLOBL GLNAME(xf86MemToBus) - - SEG_DATA -copyright: - STRING("Copyright 8/9/1993 by Glenn G. Lai") - - SEG_TEXT - ALIGNTEXT4 -GLNAME(xf86BusToMem): - CLD - PUSH_L (ESI) - MOV_L (EDI, EDX) - - MOV_L (src, ESI) - MOV_L (dst, EDI) - MOV_L (len, ECX) - - CMP_L (CONST(7), ECX) - JC (quickBM) - - TEST_L (CONST(1), ESI) - JZ (BwM) - - MOVS_B - DEC_L (ECX) - -BwM: - TEST_L (CONST(2), ESI) - JZ (BlM) - - MOVS_W - DEC_L (ECX) - DEC_L (ECX) - -BlM: - MOV_L (ECX, EAX) - AND_L (CONST(3), EAX) - SHR_L (CONST(2), ECX) - REP - MOVS_L - MOV_L (EAX, ECX) -quickBM: - OR_L (ECX, ECX) - JZ (return) - REP - MOVS_B -return: - POP_L (ESI) - MOV_L (EDX, EDI) - RET -/************************/ - - ALIGNTEXT4 -GLNAME(xf86MemToBus): - CLD - PUSH_L (ESI) - MOV_L (EDI, EDX) - - MOV_L (src, ESI) - MOV_L (dst, EDI) - MOV_L (len, ECX) - - CMP_L (CONST(7), ECX) - JC (quickMB) - - TEST_L (CONST(1), EDI) - JZ (MwB) - - MOVS_B - DEC_L (ECX) - -MwB: - TEST_L (CONST(2), EDI) - JZ (MlB) - - MOVS_W - DEC_L (ECX) - DEC_L (ECX) - -MlB: - MOV_L (ECX, EAX) - AND_L (CONST(3), EAX) - SHR_L (CONST(2), ECX) - REP - MOVS_L - MOV_L (EAX, ECX) -quickMB: - OR_L (ECX, ECX) - JZ (return) - REP - MOVS_B - - POP_L (ESI) - MOV_L (EDX, EDI) - RET - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/BUSmemcpy.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/BUSmemcpy.c deleted file mode 100644 index 9ff14396c..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/BUSmemcpy.c +++ /dev/null @@ -1,413 +0,0 @@ - -/**************************************************************************** - - For Alpha Linux, BusToMem() and MemToBus() can be simply memcpy(), BUT: - we need to prevent unaligned operations when accessing DENSE space on the BUS, - as the video memory is mmap'd that way. The below code does this. - -NOTE: we could simply use the "memcpy()" from LIBC here, but that, currently, is - not as fast. - -Thanks to Linus Torvalds for contributing this code. - -****************************************************************************/ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/BUSmemcpy.c,v 1.3 1999/12/03 19:17:44 eich Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#ifdef __alpha__ - -#include "compiler.h" - -/* - * The Jensen lacks dense memory, thus we have to address the bus via - * the sparse addressing scheme. These routines are only used in s3im.c - * Non time critical code uses SlowBCopy_{from/to} bus. - * - * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996 - */ - -#ifdef TEST_JENSEN_CODE /* define to test the Sparse addressing on a non-Jensen */ -#define LWORD_CODING (0x18) -#define SPARSE (5) -#else -#define LWORD_CODING (0x60) -#define SPARSE (7) -#endif - -void -xf86JensenMemToBus(char *Base, long dst, long src, int count) -{ - if( ((long)src^((long)dst)) & 3) { - /* src & dst are NOT aligned to each other */ - unsigned long addr; - unsigned long low_word, high_word,last_read; - long rm,loop; - unsigned long tmp,org,org2,mask,src_org,count_org; - - src_org=src; - count_org=count; - - /* add EISA longword coding and round off*/ - addr = (long)(Base+(dst< 4 ) { - last_read = src_org+count_org - 1; - __asm__("ldq_u %0,%1" - :"=r" (high_word):"m" (*(unsigned long *)(src+4))); - __asm__("extll %1,%2,%0" - :"=r" (low_word) - :"r" (low_word), "r" ((unsigned long)(src))); - __asm__("extlh %1,%2,%0" - :"=r" (tmp) - :"r" (high_word), "r" ((unsigned long)(src))); - tmp |= low_word; - src += 4; - __asm__("mskqh %1,%2,%0" - :"=r" (tmp) - :"r" (tmp), "r" (rm)); - __asm__("mskql %1,%2,%0" - :"=r" (org2) - :"r" (org), "r" (rm)); - tmp |= org2; - - loop = (count-4) >> 2; /* loop eqv. count>=4 ; count -= 4 */ - while (loop) { - /* tmp to be stored completly -- need to read next word*/ - low_word = high_word; - *(volatile unsigned int *) (addr) = tmp; - __asm__("ldq_u %0,%1" - :"=r" (high_word):"m" (*(unsigned long*)(src+4))); - loop --; - __asm__("extll %1,%2,%0" - :"=r" (low_word) - :"r" (low_word), "r" ((unsigned long)src)); - __asm__("extlh %1,%2,%0" - :"=r" (tmp) - :"r" (high_word), "r" ((unsigned long)src)); - src += 4; - tmp |= low_word; - addr += 4< 4 */ - __asm__("ldq_u %0,%1" - :"=r" (high_word):"m" (*(unsigned long *)(src+4))); - __asm__("extll %1,%2,%0" - :"=r" (low_word) - :"r" (low_word), "r" ((unsigned long)(src))); - __asm__("extlh %1,%2,%0" - :"=r" (tmp) - :"r" (high_word), "r" ((unsigned long)(src))); - tmp |= low_word; - if( count < 4 ) { - - mask = -1; - __asm__("mskqh %1,%2,%0" - :"=r" (mask) - :"r" (mask), "r" (rm)); - __asm__("mskql %1,%2,%0" - :"=r" (mask) - :"r" (mask), "r" (count)); - tmp = (tmp & mask) | (org & ~mask); - *(volatile unsigned int *) (addr) = tmp; - return; - } else { - __asm__("mskqh %1,%2,%0" - :"=r" (tmp) - :"r" (tmp), "r" (rm)); - __asm__("mskql %1,%2,%0" - :"=r" (org2) - :"r" (org), "r" (rm)); - - tmp |= org2; - *(volatile unsigned int *) (addr) = tmp; - return; - } - } - } else { /* src & dst are aligned to each other */ - unsigned long addr; - unsigned int tmp,org,rm; - unsigned int *src_r; - - /* add EISA longword coding and round off*/ - addr = (long)(Base+(dst< 4) { - *(volatile unsigned int *) addr = tmp; - addr += 4<>= ((addr>>SPARSE) & 3) * 8; - *dst++ = (char) result; - addr += 1<= 0){ - int i; - - result = *(volatile int *) (addr+LWORD_CODING); - for(i=4;i--;) { - *dst++ = (char) result; - result >>= 8; - } - addr += 4<>= ((addr>>SPARSE) & 3) * 8; - *dst++ = (char) result; - addr += 1<= 0)", resulting in a - * explicit compare against 0 (instead of just using the proper "blt reg, xx" or - * "bge reg, xx"). I hope alpha-gcc will be fixed to notice this eventually.. - */ - -/* - * This should be done in one go with ldq_u*2/mask/stq_u. Do it - * with a macro so that we can fix it up later.. - */ -#define ALIGN_DEST_TO8(d,s,n) \ - while (d & 7) { \ - if (n <= 0) return; \ - n--; \ - *(char *) d = *(char *) s; \ - d++; s++; \ - } - -/* - * This should similarly be done with ldq_u*2/mask/stq. The destination - * is aligned, but we don't fill in a full quad-word - */ -#define DO_REST(d,s,n) \ - while (n > 0) { \ - n--; \ - *(char *) d = *(char *) s; \ - d++; s++; \ - } - -/* - * This should be done with ldq/mask/stq. The source and destination are - * aligned, but we don't fill in a full quad-word - */ -#define DO_REST_ALIGNED(d,s,n) DO_REST(d,s,n) - -/* - * This does unaligned memory copies. We want to avoid storing to - * an unaligned address, as that would do a read-modify-write cycle. - * We also want to avoid double-reading the unaligned reads. - * - * Note the ordering to try to avoid load (and address generation) latencies. - */ -static __inline__ void __memcpy_unaligned(unsigned long d, unsigned long s, long n) -{ - ALIGN_DEST_TO8(d,s,n); - n -= 8; /* to avoid compare against 8 in the loop */ - if (n >= 0) { - unsigned long low_word, high_word; - __asm__("ldq_u %0,%1":"=r" (low_word):"m" (*(unsigned long *) s)); - do { - unsigned long tmp; - __asm__("ldq_u %0,%1":"=r" (high_word):"m" (*(unsigned long *)(s+8))); - n -= 8; - __asm__("extql %1,%2,%0" - :"=r" (low_word) - :"r" (low_word), "r" (s)); - __asm__("extqh %1,%2,%0" - :"=r" (tmp) - :"r" (high_word), "r" (s)); - s += 8; - *(unsigned long *) d = low_word | tmp; - d += 8; - low_word = high_word; - } while (n >= 0); - } - n += 8; - DO_REST(d,s,n); -} - -/* - * Hmm.. Strange. The __asm__ here is there to make gcc use a integer register - * for the load-store. I don't know why, but it would seem that using a floating - * point register for the move seems to slow things down (very small difference, - * though). - * - * Note the ordering to try to avoid load (and address generation) latencies. - */ -static __inline__ void __memcpy_aligned(unsigned long d, unsigned long s, long n) -{ - ALIGN_DEST_TO8(d,s,n); - n -= 8; - while (n >= 0) { - unsigned long tmp; - __asm__("ldq %0,%1":"=r" (tmp):"m" (*(unsigned long *) s)); - n -= 8; - s += 8; - *(unsigned long *) d = tmp; - d += 8; - } - n += 8; - DO_REST_ALIGNED(d,s,n); -} - -static unsigned long __memcpy(unsigned long dest, unsigned long src, int n) -{ - if (!((dest ^ src) & 7)) { - __memcpy_aligned(dest, src, n); - return dest; - } - __memcpy_unaligned(dest, src, n); - return dest; -} - -#else /* __alpha__ */ - -void -xf86BusToMem(unsigned char *dst, unsigned char *src, int len) -{ - memcpy(dst, src, len); -} -void -xf86MemToBus(unsigned char *dst, unsigned char *src, int len) -{ - memcpy(dst, src, len); -} - -#endif /* __alpha__ */ diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/Delay.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/Delay.c deleted file mode 100644 index 33d0789fd..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/Delay.c +++ /dev/null @@ -1,44 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/Delay.c,v 3.3 2000/12/08 20:13:38 eich Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifdef __UNIXOS2__ -#define I_NEED_OS2_H -#endif -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#include - -void -xf86UDelay(long usec) -{ -#if 0 - struct timeval start, interrupt; -#else - int sigio; - - sigio = xf86BlockSIGIO(); - xf86usleep(usec); - xf86UnblockSIGIO(sigio); -#endif - -#if 0 - gettimeofday(&start,NULL); - - do { - usleep(usec); - gettimeofday(&interrupt,NULL); - - if ((usec = usec - (interrupt.tv_sec - start.tv_sec) * 1000000 - - (interrupt.tv_usec - start.tv_usec)) < 0) - break; - start = interrupt; - } while (1); -#endif -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/IODelay.S b/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/IODelay.S deleted file mode 100644 index 685584653..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/IODelay.S +++ /dev/null @@ -1,53 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/IODelay.s,v 1.2 1998/07/25 16:56:49 dawes Exp $ */ -/******************************************************************************* - Copyright 1994 by Glenn G. Lai - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyr notice appear in all copies and that -both that copyr notice and this permission notice appear in -supporting documentation, and that the name of Glenn G. Lai not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -Glenn G. Lai DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -Glenn G. Lai -P.O. Box 4314 -Austin, Tx 78765 -glenn@cs.utexas.edu) -7/21/94 -*******************************************************************************/ -/* $XConsortium: IODelay.s /main/4 1996/02/21 17:40:21 kaleb $ */ - -/* - * All we really need is a delay of about 40ns for I/O recovery for just - * about any occasion, but we'll be more conservative here: On a - * 100-MHz CPU, produce at least a delay of 1,000ns. - */ - -#include "assyntax.h" - - FILE("DACDelay.s") - - AS_BEGIN - - GLOBL GLNAME(xf86IODelay) - - SEG_TEXT - ALIGNTEXT4 -GLNAME(xf86IODelay): - MOV_L (CONST(100), EAX) -delay_it: - DEC_L (EAX) - JNE (delay_it) - RET - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/IODelay.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/IODelay.c deleted file mode 100644 index 697c07f61..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/IODelay.c +++ /dev/null @@ -1,28 +0,0 @@ - -/* $XConsortium: IODelay.c /main/1 1996/05/07 17:13:43 kaleb $ */ -/******************************************************************************* - Stub for Alpha Linux -*******************************************************************************/ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/IODelay.c,v 1.1.2.1 1998/06/04 17:35:59 dawes Exp $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -/* - * All we really need is a delay of about 40ns for I/O recovery for just - * about any occasion, but we'll be more conservative here: On a - * 100-MHz CPU, produce at least a delay of 1,000ns. - */ -void -xf86IODelay() -{ - xf86UDelay(1); -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/Imakefile deleted file mode 100644 index d6122f52a..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/Imakefile +++ /dev/null @@ -1,54 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile,v 3.13 2003/12/30 15:21:06 herrb Exp $ -XCOMM $XdotOrg: xc/programs/Xserver/hw/xfree86/os-support/misc/Imakefile,v 1.2 2004/04/23 19:54:11 eich Exp $ - - - -XCOMM $XConsortium: Imakefile /main/4 1996/09/28 17:24:12 rws $ - -#include - - -#if defined(i386Architecture) && !defined(cygwinArchitecture) \ - && !defined(OS2Architecture) -XSRCS = BUSmemcpy.S IODelay.S SlowBcopy.S -XOBJS = BUSmemcpy.o IODelay.o SlowBcopy.o -#else -XSRCS = BUSmemcpy.c IODelay.c SlowBcopy.c -XOBJS = BUSmemcpy.o IODelay.o SlowBcopy.o -#if defined(NetBSDArchitecture) -BUSmemcpy.o: BUSmemcpy.c -IODelay.o: IODelay.c -SlowBcopy.o: SlowBcopy.c -#endif -#endif - -#if HasGcc || HasGcc2 -ILHACKSRCS = xf86_IlHack.c -ILHACKOBJS = xf86_IlHack.o -#elif NeedPortIO -ILHACKOBJS = PortIO.o -#endif - -SRCS = xf86_Util.c Delay.c $(ILHACKSRCS) $(XSRCS) - -OBJS = xf86_Util.o Delay.o $(ILHACKOBJS) $(XOBJS) - -INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() - -#if defined(i386Architecture) && !defined(cygwinArchitecture) \ - && !defined(OS2Architecture) -ObjectFromAsmSource(BUSmemcpy,NullParameter) -ObjectFromAsmSource(IODelay,NullParameter) -ObjectFromAsmSource(SlowBcopy,NullParameter) -#endif - -#ifdef NeedPortIO -ObjectFromAsmSource(PortIO,NullParameter) -#endif - -DependTarget() - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/PortIO.S b/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/PortIO.S deleted file mode 100644 index 75db31156..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/PortIO.S +++ /dev/null @@ -1,57 +0,0 @@ -/* $XFree86$ */ - -/* Port I/O functions for platforms with no inlining. */ - -#include "assyntax.h" - - FILE("PortIO.s") - - AS_BEGIN - - GLOBL GLNAME(outb) - GLOBL GLNAME(outw) - GLOBL GLNAME(outl) - GLOBL GLNAME(inb) - GLOBL GLNAME(inw) - GLOBL GLNAME(inl) - - SEG_TEXT - ALIGNTEXT4 -GLNAME(outb): - MOV_L (REGOFF(4,ESP), EDX) - MOV_L (REGOFF(8,ESP), EAX) - OUT_B - RET - - ALIGNTEXT4 -GLNAME(outw): - MOV_L (REGOFF(4,ESP), EDX) - MOV_L (REGOFF(8,ESP), EAX) - OUT_W - RET - - ALIGNTEXT4 -GLNAME(outl): - MOV_L (REGOFF(4,ESP), EDX) - MOV_L (REGOFF(8,ESP), EAX) - OUT_L - RET - - ALIGNTEXT4 -GLNAME(inb): - MOV_L (REGOFF(4,ESP), EDX) - IN_B - RET - - ALIGNTEXT4 -GLNAME(inw): - MOV_L (REGOFF(4,ESP), EDX) - IN_L - RET - - ALIGNTEXT4 -GLNAME(inl): - MOV_L (REGOFF(4,ESP), EDX) - IN_L - RET - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.S b/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.S deleted file mode 100644 index 9fd73a0f9..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.S +++ /dev/null @@ -1,108 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.s,v 1.2 1998/07/25 16:56:50 dawes Exp $ */ -/******************************************************************************* - Copyright 1994 by Glenn G. Lai - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyr notice appear in all copies and that -both that copyr notice and this permission notice appear in -supporting documentation, and that the name of Glenn G. Lai not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -Glenn G. Lai DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -Glenn G. Lai -P.O. Box 4314 -Austin, Tx 78765 -glenn@cs.utexas.edu) -7/21/94 -*******************************************************************************/ -/* $XConsortium: SlowBcopy.s /main/4 1996/02/21 17:40:52 kaleb $ */ - -/* - * Modified from the output generated by GCC - * - * Create a dependency that should be immune from the effect of register - * renaming as is commonly seen in superscalar processors. This should - * insert a minimum of 100-ns delays between reads/writes at clock rates - * up to 100 MHz---GGL - * - * Slowbcopy(char *src, char *dst, int count) - * - */ - -#include "assyntax.h" - - FILE("SlowBcopy.s") - - AS_BEGIN - -gcc2_compiled.: -___gnu_compiled_c: - - GLOBL GLNAME(xf86SlowBcopy) - - SEG_TEXT - ALIGNTEXT4 -GLNAME(xf86SlowBcopy): - PUSH_L (EBP) - MOV_L (ESP,EBP) - PUSH_L (ESI) - PUSH_L (EBX) - MOV_L (REGOFF(8,EBP),ECX) - MOV_L (REGOFF(12,EBP),EDX) - MOV_L (REGOFF(16,EBP),ESI) - XOR_L (EAX,EAX) - CMP_L (ESI,EAX) - JGE (L3) - - ALIGNTEXT4 -L5: - MOV_B (REGIND(ECX),BL) - - MOV_B (BL, BH) - MOV_B (BH, BL) - MOV_B (BL, BH) - MOV_B (BH, BL) - MOV_B (BL, BH) - MOV_B (BH, BL) - MOV_B (BL, BH) - MOV_B (BH, BL) - MOV_B (BL, BH) - MOV_B (BH, BL) - - MOV_B (BL,REGIND(EDX)) - - INC_L (ECX) - DEC_L (ECX) - INC_L (ECX) - DEC_L (ECX) - INC_L (ECX) - DEC_L (ECX) - INC_L (ECX) - DEC_L (ECX) - INC_L (ECX) - DEC_L (ECX) - - INC_L (ECX) - INC_L (EDX) - INC_L (EAX) - CMP_L (ESI,EAX) - JL (L5) -L3: - LEA_L (REGOFF(-8,EBP),ESP) - POP_L (EBX) - POP_L (ESI) - MOV_L (EBP,ESP) - POP_L (EBP) - RET - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.c deleted file mode 100644 index ec2c67ffa..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.c +++ /dev/null @@ -1,114 +0,0 @@ - -/* $XConsortium: SlowBcopy.c /main/1 1996/05/07 17:14:10 kaleb $ */ -/******************************************************************************* - for Alpha Linux -*******************************************************************************/ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.c,v 1.6tsi Exp $ */ - -/* - * Create a dependency that should be immune from the effect of register - * renaming as is commonly seen in superscalar processors. This should - * insert a minimum of 100-ns delays between reads/writes at clock rates - * up to 100 MHz---GGL - * - * Slowbcopy(char *src, char *dst, int count) - * - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "compiler.h" - -/* The outb() isn't needed on my machine, but who knows ... -- ost */ -void -xf86SlowBcopy(unsigned char *src, unsigned char *dst, int len) -{ - while(len--) - { - *dst++ = *src++; -#if !defined(__sparc__) && \ - !defined(__powerpc__) && \ - !defined(__mips__) && \ - !defined(__ia64__) - outb(0x80, 0x00); -#endif - } -} - -#ifdef __alpha__ -/* - * The Jensen lacks dense memory, thus we have to address the bus via - * the sparse addressing scheme. Time critical code uses routines from - * BUSmemcpy.c - * - * Martin Ostermann (ost@comnets.rwth-aachen.de) - Apr.-Sep. 1996 - */ - -#ifdef linux - -unsigned long _bus_base(void); - -#ifdef TEST_JENSEN_CODE /* define to test the Sparse addressing on a non-Jensen */ -#define SPARSE (5) -#else -#define SPARSE (7) -#endif - -#define isJensen() (!_bus_base()) - -#else - -#define isJensen() 0 -#define SPARSE 0 - -#endif - -void -xf86SlowBCopyFromBus(unsigned char *src, unsigned char *dst, int count) -{ - if (isJensen()) - { - unsigned long addr; - long result; - - addr = (unsigned long) src; - while( count ){ - result = *(volatile int *) addr; - result >>= ((addr>>SPARSE) & 3) * 8; - *dst++ = (unsigned char) (0xffUL & result); - addr += 1< -#endif - -#include "compiler.h" diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/xf86_Util.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/xf86_Util.c deleted file mode 100644 index afcdd5b69..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/misc/xf86_Util.c +++ /dev/null @@ -1,96 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/xf86_Util.c,v 3.7 1999/01/14 13:05:05 dawes Exp $ */ -/* - * Copyright 1993 by David Wexelblat - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of David Wexelblat not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. David Wexelblat makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: xf86_Util.c /main/5 1996/10/23 13:13:10 kaleb $ */ - -/* - * This file is for utility functions that will be shared by other pieces - * of the system. Putting things here ensure that all the linking order - * dependencies are dealt with, as this library will be linked in last. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -/* To prevent empty source file warnings */ -int _xf86misc; - -#if 0 -/* For use only with gcc */ -#ifdef __GNUC__ - -#include "os.h" - -char * -debug_alloca(char *file, int line, int size) -{ - char *ptr; - - ptr = Xalloc(size); - ErrorF("Alloc: %s line %d; ptr = 0x%x, length = %d\n", file, line, - ptr, size); - return ptr; -} - -void -debug_dealloca(char *file, int line, char *ptr) -{ - ErrorF("Dealloc: %s line %d; ptr = 0x%x\n", file, line, ptr); - Xfree(ptr); -} -#endif -#endif - -#if defined(ISC) || defined(Lynx) - -#include - -/* Needed for apm_driver.c */ -/* These functions are modeled after the functions inside gnu's libc */ - -static double -copysign(double x, double y) -{ - x = fabs(x); - return y < 0 ? - x : x; -} - -double -RInt(double x) -{ - double s,t; - const double one = 1.0; - const static double L = 4503599627370496.0E0; - - if (x!=x) - return(x); - if (copysign(x,one) >= L) - return(x); - s = copysign(L,x); - t = x + s; - return (t - s); -} -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/Imakefile deleted file mode 100644 index fb7132182..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/Imakefile +++ /dev/null @@ -1,37 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/Imakefile,v 1.7 2002/10/11 01:46:59 dawes Exp $ -XCOMM - -#include - - -SRCS = nto_io.c nto_init.c nto_kbdEv.c nto_ioperm.c nto_video.c \ - VTsw_noop.c posix_tty.c kmod_noop.c agp_noop.c stdResource.c \ - stdPci.c libc_wrapper.c sigiostubs.c pm_noop.c nto_mouse.c - -OBJS = nto_io.o nto_init.o nto_kbdEv.o nto_ioperm.o nto_video.o \ - VTsw_noop.o posix_tty.o kmod_noop.o agp_noop.o stdResource.o \ - stdPci.o libc_wrapper.o sigiostubs.o pm_noop.o nto_mouse.o - -INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) - -RESDEFINES = -DUSESTDRES - -DEFINES = $(RESDEFINES) - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() - - -LinkSourceFile(libc_wrapper.c,../shared) -LinkSourceFile(sigiostubs.c,../shared) -LinkSourceFile(pm_noop.c,../shared) -LinkSourceFile(stdResource.c,../shared) -LinkSourceFile(stdPci.c,../shared) - -LinkSourceFile(VTsw_noop.c,../shared) -LinkSourceFile(posix_tty.c,../shared) -LinkSourceFile(kmod_noop.c,../shared) -LinkSourceFile(agp_noop.c,../shared) - -DependTarget() diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/README b/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/README deleted file mode 100644 index 8d262fe08..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/README +++ /dev/null @@ -1,29 +0,0 @@ -XFree86 on NTO - -Status: -Everything builds, and appears to work. Libraries are built as shared. - -Building: -Buiding is done as cross-development from QNX4. What you'll need: - -QNX4 4.24+ -Neutrino 2.0 x86 runtime and development packages for QNX4 host. -Various QNX4 utilities, such as pdksh, cpp etc. - -To build: - -type (from the xc/ directory) -BOOTSTRAPCFLAGS="-D__QNXNTO__ -Di386 -D__GNUC__" make World 2>&1 | tee make.log - -you can also make PPC or MIPS clients (-DPPC or -DMIPS): -BOOTSTRAPCFLAGS="-D__QNXNTO__ -DPPC -D__GNUC__" make World 2>&1 | tee make.log - -Let the build run, and then examine make.log for any errors. - - -Note that we'll very soon be able to build X natively on NTO... - -Sebastien Marineau -sebastien@qnx.com - -$XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/README,v 1.1.2.1 1999/07/29 09:40:14 hohndel Exp $ diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_init.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_init.c deleted file mode 100644 index 726a8a5ac..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_init.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (c) Copyright 1998 by Sebastien Marineau - * - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * SEBASTIEN MARINEAU BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Sebastien Marineau shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Sebastien Marineau. - * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_init.c,v 1.2 1999/12/27 00:45:45 robin Exp $ - */ - -/* This module contains the NTO-specific functions used at server init. - */ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -extern int NTO_con_fd; - -void -xf86UseMsg() -{ - ErrorF("No NTO-specific usage options available at this time\n"); - return; -} - -int -xf86ProcessArgument(argc, argv, i) -int argc; -char **argv; -int i; -{ - - return 0; - -} - - -/* Right now, OpenConsole() does not do much; later, we may want to handle - * console switching and so on.... - */ - -void -xf86OpenConsole() -{ - unsigned flags; - - - ThreadCtl(_NTO_TCTL_IO, 0); - - if((NTO_con_fd = open("/dev/con1", O_RDWR)) == -1) { - ErrorF("Unable to open console\n"); - return; - } - - /* Make the console invisible to prevent devc-con from touching hardware */ - flags = _CONCTL_INVISIBLE | _CONCTL_INVISIBLE_CHG; - devctl(NTO_con_fd, DCMD_CHR_SERCTL, &flags, sizeof flags, 0); - - return; -} - -void -xf86CloseConsole() -{ - unsigned flags; - - /* Make console visible again */ - flags = _CONCTL_INVISIBLE_CHG; - devctl(NTO_con_fd, DCMD_CHR_SERCTL, &flags, sizeof flags, 0); - close(NTO_con_fd); - - return; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_io.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_io.c deleted file mode 100644 index 9c32afd35..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_io.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * (c) Copyright 1998 by Sebastien Marineau - * - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * SEBASTIEN MARINEAU BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Sebastien Marineau shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Sebastien Marineau. - * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_io.c,v 1.4 2002/10/11 01:40:35 dawes Exp $ - */ - -/* This module contains the NTO-specific functions to access the keyboard - * and the console. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -int NTO_kbd_fd = -1; -int NTO_con_fd = -1; - -void -xf86SoundKbdBell(loudness, pitch, duration) -int loudness, pitch, duration; -{ - -/* Come back and fix! */ -ErrorF("xf86SoundKbdBell: to implement\n"); -} - -void -xf86SetKbdLeds(leds) -int leds; -{ - -ErrorF("xf86SetKbdLeds: to implement\n"); -} - -int -xf86GetKbdLeds() -{ - int leds; - - leds = 0; - ErrorF("xf86GetKbdLeds: to implement\n"); - return(leds); -} - -/* This is a no-op for now */ -void -xf86SetKbdRepeat(rad) -char rad; -{ - return; -} - - -/* Need to open keyboard here ? */ -void -xf86KbdInit() -{ - - ErrorF("xf86KbdInit: to implement\n"); - return; -} - - -int xf86KbdOn() -{ - /* Here, we need to open /dev/kbd */ - NTO_kbd_fd = open("/dev/kbd", O_RDWR | O_NONBLOCK); - ErrorF("Opened keyboard device, handle %d\n",NTO_kbd_fd); - return(NTO_kbd_fd); -} - -int xf86KbdOff() -{ - close(NTO_kbd_fd); - NTO_kbd_fd = -1; - return (-1); -} - -#include "xf86OSKbd.h" - -Bool -xf86OSKbdPreInit(InputInfoPtr pInfo) -{ - return FALSE; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_ioperm.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_ioperm.c deleted file mode 100644 index 67a771ff6..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_ioperm.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 1998 by Sebastien Marineau - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of David Wexelblat not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Sebastien Marineau makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * SEBASTIEN MARINEAU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_ioperm.c,v 1.2 1999/12/27 00:45:45 robin Exp $ - */ - -/* I/O functions to enable access to I/O ports under Neutrino */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include - - -Bool xf86EnableIO() -{ - ErrorF("xf86EnableIO: enabling I/O access\n"); - if(ThreadCtl(_NTO_TCTL_IO, 0)) { - ErrorF("xf86EnableIO: could not set I/O privilege, errno %d\n",errno); - return FALSE; - } - return TRUE; -} - -void xf86DisableIO() -{ - return; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_kbdEv.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_kbdEv.c deleted file mode 100644 index a028de6b6..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_kbdEv.c +++ /dev/null @@ -1,53 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_kbdEv.c,v 1.2 1999/12/27 00:45:46 robin Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Dawes - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Thomas Roell and David Dawes - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Thomas Roell and - * David Dawes makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * THOMAS ROELL AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: std_kbdEv.c /main/4 1996/03/11 10:47:33 kaleb $ */ - -#define NEED_EVENTS -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "inputstr.h" -#include "scrnintstr.h" - -#include "xf86_OSlib.h" - -extern int NTO_kbd_fd; - -void xf86KbdEvents() -{ - unsigned char rBuf[64]; - int nBytes, i; - - if ((nBytes = read( NTO_kbd_fd, (char *)rBuf, sizeof(rBuf))) > 0) { - for (i = 0; i < nBytes; i++) { - xf86PostKbdEvent(rBuf[i]); - } - } -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_mouse.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_mouse.c deleted file mode 100644 index 2dda8aa32..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_mouse.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Written by Frank Liu Oct 10, 2001 - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_mouse.c,v 1.1 2001/11/16 16:47:56 dawes Exp $ */ - - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Xinput.h" -#include "xf86OSmouse.h" - -/* copied from mipointer.h */ -extern int miPointerGetMotionEvents( - DeviceIntPtr /*pPtr*/, - xTimecoord * /*coords*/, - unsigned long /*start*/, - unsigned long /*stop*/, - ScreenPtr /*pScreen*/ -); - -#include -#define NUMEVENTS 64 /* don't want to stuck in the mouse read loop */ - -/* - * OsMouseReadInput -- - * Get some events from our queue. Process outstanding events now. - */ -static void -OsMouseReadInput(InputInfoPtr pInfo) -{ - int n = 0; - int buttons, col, row; - struct _mouse_packet mp; - MouseDevPtr pMse; - - pMse = pInfo->private; - - while ( (read(pInfo->fd, &mp, sizeof(struct _mouse_packet)) > 0 ) - && (n < NUMEVENTS ) ) - { - col = mp.dx; - row = -mp.dy; - buttons = mp.hdr.buttons; - pMse->PostEvent(pInfo, buttons, col, row, 0, 0); - n++; - } -} - -/* - * OsMouseProc -- - * Handle the initialization, etc. of a mouse - */ -static int -OsMouseProc(pPointer, what) -DeviceIntPtr pPointer; -int what; -{ - int nbuttons; - unsigned char map[MSE_MAXBUTTONS + 1]; - MouseDevPtr pMse; - InputInfoPtr pInfo; - - pInfo = pPointer->public.devicePrivate; - pMse = pInfo->private; - pMse->device = pPointer; - - switch (what) { - case DEVICE_INIT: - pPointer->public.on = FALSE; - - for (nbuttons = 0; nbuttons < MSE_MAXBUTTONS; ++nbuttons) - map[nbuttons + 1] = nbuttons + 1; - - InitPointerDeviceStruct((DevicePtr)pPointer, - map, - min(pMse->buttons, MSE_MAXBUTTONS), - miPointerGetMotionEvents, - pMse->Ctrl, - miPointerGetMotionBufferSize()); - - /* X valuator */ - xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1); - xf86InitValuatorDefaults(pPointer, 0); - /* Y valuator */ - xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1); - xf86InitValuatorDefaults(pPointer, 1); - xf86MotionHistoryAllocate(pInfo); - break; - - case DEVICE_ON: - pInfo->fd = xf86OpenSerial(pInfo->options); - if (pInfo->fd == -1) - xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); - else { - AddEnabledDevice(pInfo->fd); - } - pMse->lastButtons = 0; - pMse->lastMappedButtons = 0; - pMse->emulateState = 0; - pPointer->public.on = TRUE; - break; - - case DEVICE_CLOSE: - case DEVICE_OFF: - if (pInfo->fd != -1) { - RemoveEnabledDevice(pInfo->fd); - xf86CloseSerial(pInfo->fd); - pInfo->fd = -1; - } - pPointer->public.on = FALSE; - break; - } - return (Success); -} - -static int -SupportedInterfaces(void) -{ - /* FIXME: Is this correct? Should we just return MSE_MISC? */ - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_MISC | MSE_AUTO; -} - -static const char *internalNames[] = { - "OSMouse", - NULL -}; - -static const char ** -BuiltinNames(void) -{ - return internalNames; -} - -static Bool -CheckProtocol(const char *protocol) -{ - int i; - - for (i = 0; internalNames[i]; i++) - if (xf86NameCmp(protocol, internalNames[i]) == 0) - return TRUE; - return FALSE; -} - -/* XXX Is this appropriate? If not, this function should be removed. */ -static const char * -DefaultProtocol(void) -{ - return "OSMouse"; -} - -static Bool -OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags) -{ - MouseDevPtr pMse; - - /* This is called when the protocol is "OSMouse". */ - - pMse = pInfo->private; - pMse->protocol = protocol; - xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol); - - /* Collect the options, and process the common options. */ - xf86CollectInputOptions(pInfo, NULL, NULL); - xf86ProcessCommonOptions(pInfo, pInfo->options); - - /* Check if the device can be opened. */ - pInfo->fd = xf86OpenSerial(pInfo->options); - if (pInfo->fd == -1) { - if (xf86GetAllowMouseOpenFail()) - xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); - else { - xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name); - xfree(pMse); - return FALSE; - } - } - xf86CloseSerial(pInfo->fd); - pInfo->fd = -1; - - /* Process common mouse options (like Emulate3Buttons, etc). */ - pMse->CommonOptions(pInfo); - - /* Setup the local procs. */ - pInfo->device_control = OsMouseProc; - pInfo->read_input = OsMouseReadInput; - - pInfo->flags |= XI86_CONFIGURED; - return TRUE; -} - -OSMouseInfoPtr -xf86OSMouseInit(int flags) -{ - OSMouseInfoPtr p; - - p = xcalloc(sizeof(OSMouseInfoRec), 1); - if (!p) - return NULL; - p->SupportedInterfaces = SupportedInterfaces; - p->BuiltinNames = BuiltinNames; - p->DefaultProtocol = DefaultProtocol; - p->CheckProtocol = CheckProtocol; - p->PreInit = OsMousePreInit; - return p; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_video.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_video.c deleted file mode 100644 index f78f6864a..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/nto/nto_video.c +++ /dev/null @@ -1,170 +0,0 @@ -/* (c) Copyright 1998 by Sebastien Marineau - * - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * SEBASTIEN MARINEAU BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Sebastien Marineau shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Sebastien Marineau. - * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/nto/nto_video.c,v 1.3tsi Exp $ - */ - -/* This module contains the NTO-specific functions to deal with video - * framebuffer access and interrupts. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - - -/* These are the interrupt enabling/disabling functions. - */ - -void xf86EnableInterrupts() -{ - InterruptEnable(); -} - -Bool xf86DisableInterrupts() -{ - InterruptDisable(); - return 0; -} - -/* These are the routines to map/unmap video memory... */ - -Bool xf86LinearVidMem() -{ - /* Yes we can... */ - return(TRUE); -} - -/* This is our shmem "Physical" handle */ -int NTO_PhMem_fd = -1; - - -/* Map a chunk of physical video memory, using mmap */ -pointer -xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) -{ - int fd; - pointer base; - - if(NTO_PhMem_fd < 0) { - if ((fd = open("/dev/mem", O_RDWR, 0777)) < 0) { - FatalError("xf86MapVidMem: Failed to open /dev/mem\n"); - } - NTO_PhMem_fd = fd; - } - - base = mmap((caddr_t)0, Size, - (Flags & VIDMEM_READONLY) ? PROT_READ : (PROT_READ | PROT_WRITE), - MAP_SHARED, NTO_PhMem_fd, (off_t)Base); - - ErrorF("MapVidMem: addr %08x size %08x addr %08x\n", Base, Size, base); - if ((long)base == -1) { - FatalError("xf86MapVidMem: Failed to mmap video memory\n"); - } - - return base; -} - -/* ARGSUSED */ -void -xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - - ErrorF("xf86UnmapVidMem: base %x size %x\n", Base, Size); - munmap((caddr_t) Base, Size); - -} - -/* Finally, this function allows us to read the video BIOS content */ - -int -xf86ReadBIOS(Base, Offset, Buf, Len) -unsigned long Base, Offset; -unsigned char *Buf; -int Len; -{ - unsigned char * VirtBase; - - ErrorF("xf86ReadBIOS: base %x offset %x len %x\n", Base, Offset, Len); - - if (NTO_PhMem_fd == -1) { - if ((NTO_PhMem_fd = open("/dev/mem", O_RDWR, 0777)) < 0) { - FatalError("xf86ReadBIOS: cannot open Physical memory\n"); - } - } - - /* Use mmap to map BIOS region. Note the restrictions on - * mmap alignement of offset variable (which must be on a page - * boundary). - */ - VirtBase = (unsigned char *) mmap(0, (size_t)((Offset & 0x7fff) + Len), PROT_READ, - MAP_SHARED, NTO_PhMem_fd, (off_t) (Base + (Offset & 0xffff8000))); - if((long)VirtBase == -1) { - FatalError( "xf86ReadBIOS: Could not mmap BIOS memory space, errno=%i\n", errno); - } - - /* So now we have our mapping to the BIOS region */ - - /* Do a sanity check on what we have just mapped */ - if (((off_t)((off_t)Offset & 0x7FFF) != (off_t)0) && - (VirtBase[0] != 0x55) && - (VirtBase[1] != 0xaa)) { - ErrorF( "xf86ReadBIOS: BIOS sanity check failed, addr=%x\n", - (int)Base + Offset); - munmap(VirtBase, (Offset & 0x7fff) + Len); - return -1; - } - - /* Things look good: copy BIOS data */ - memcpy(Buf, VirtBase + (Offset & 0x7fff), Len); - munmap(VirtBase, (Offset & 0x7fff) + Len); - - return Len; -} - -void -xf86MapReadSideEffects(int ScreenNum, int Flags, pointer base, - unsigned long Size) -{ - return; -} - -Bool -xf86CheckMTRR(int s) -{ - return FALSE; -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/Imakefile deleted file mode 100644 index 6659da9be..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/Imakefile +++ /dev/null @@ -1,45 +0,0 @@ -XCOMM $XConsortium: Imakefile /main/7 1996/09/28 17:24:18 rws $ - - - - - -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/Imakefile,v 3.20 2002/10/17 02:22:48 dawes Exp $ -#include - -BIOS_MOD = os2_bios - -SRCS = os2_init.c os2_video.c os2_io.c $(BIOS_MOD).c \ - os2_ioperm.c os2_VTsw.c os2_mouse.c os2_KbdEv.c os2_stubs.c \ - os2_select.c os2_diag.c libc_wrapper.c stdResource.c stdPci.c \ - vidmem.c sigiostubs.c pm_noop.c kmod_noop.c agp_noop.c os2_serial.c \ - os2_kbd.c - -OBJS = os2_init.o os2_video.o os2_io.o $(BIOS_MOD).o \ - os2_ioperm.o os2_VTsw.o os2_mouse.o os2_kbdEv.o os2_stubs.o \ - os2_select.o os2_diag.o libc_wrapper.o stdResource.o stdPci.o \ - vidmem.o sigiostubs.o pm_noop.o kmod_noop.o agp_noop.o os2_serial.o \ - os2_kbd.o - -INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(SERVERSRC)/mi -I$(XINCLUDESRC) -I$(EXTINCSRC) - -RESDEFINES = -DUSESTDRES - -DEFINES = $(RESDEFINES) - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() -NormalAsmObjectRule() - -LinkSourceFile(VTsw_noop.c,../shared) -LinkSourceFile(libc_wrapper.c,../shared) -LinkSourceFile(stdResource.c,../shared) -LinkSourceFile(stdPci.c,../shared) -LinkSourceFile(vidmem.c,../shared) -LinkSourceFile(sigiostubs.c,../shared) -LinkSourceFile(pm_noop.c,../shared) -LinkSourceFile(kmod_noop.c,../shared) -LinkSourceFile(agp_noop.c,../shared) - -DependTarget() diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/README b/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/README deleted file mode 100644 index d07059eed..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/README +++ /dev/null @@ -1,78 +0,0 @@ -Information on files in this directory --------------------------------------- -\xc\programs\xserver\hw\xfree86\os-support\os2 - -The files in this directory form the OS-dependent porting layer of -XFree86 for OS/2. They are the work of: - - Holger Veit - Sebastien Marineau - -Some functions which were absent from OS/2, -such as direct access to IO ports and the mapping of physical memory, -are implemented in a device-driver written for this purpose by Holger Veit -. The driver also implements several functions -necessary for xterm. -The driver should be installed in the config.sys with a line: - -DEVICE=path\XF86SUP.SYS - -The following gives a brief overview of the implementation of the -porting layer, and lists some of the "gotchas" when modifying the source. - -BIOS and physical memory mapping: This is handled by the functions in XF86SUP.SYS driver. - -IO permission: Handled by a function in the XF86SUP.SYS driver. Essentially, IO permissions -are granted for the whole Xserver at server initialisation. The device-driver sets the IOPL -level to ring 3 for the Xserver, which in essence gives it the same IO privileges that a -device-driver has. Note the danger here: the Xserver can write to any IO port it wishes, -and can disable interrupts (something which it does), thus can potentially hang the system. - -VT switching (switching back and forth to the WPS): This is handled by the keyboard driver, -i.e. the stardard keyboard sequences (CTRL-ESC etc.) trigger the switch back to PM. The -Xserver is notified of switches by the VIO function VIOSavRedrawWait(), which is run in -a separate thread. When a switch to/from PM is requested, this function call unblocks, and -the Xserver either saves or restores the video buffer and video mode. Note that semaphores -are used to communicate with the main Xserver thread, and handle cases such as server -reset while the server has lost focus etc. -A similar mechanism is used to handle hard-error popups. A thread is run which blocks -on the VIOModeWait() function. When a hard-error notification occurs, the Xserver attempts -to recover by resetting the screen. Note that, due to some (probable) bugs in the OS/2 -video drivers, this does not always work as expected. According to the specs, the OS/2 -video drivers are supposed to restore the palette when returning from a hard-error. This -does not seem to be always the case..... so the palette in X may be screwed up after the -hard-error. - -Keyboard input: because X needs all keyboard event to function (both keypresses, key -releases, for all keys), the keyboard input was implemented by registering a keyboard -monitor for the Xserver. The keyboard monitor is run in a separate thread, and sends -the keystrokes back to the Xserver main thread through a queue. Another thread is -also started, whose purpose is to "eat" the keystrokes returned by KbdCharIn(). Note that -the monitor was necessary because the OS/2 keyboard driver does not pass all keystrokes -to the application calling KbdCharIn(). - -Mouse input: This was implemented similarly to the keyboard input: mouse events are -read in a thread, which then passes them to the main Xserver thread through a queue. - -Select: this unix and emx function has been reimplemented and optimized for the xserver. -Because of the need to handle input from pipes, sockets, the mouse and keyboard (which -select() in unix does but the EMX select does not), it was decided to rewrite it in -order to minimize CPU usage and maximize responsiveness. Essentially, select() blocks on -a MuxWait semaphore, and unblocks when input is available from pipes, the mouse and the -keyboard. The MuxWait semaphore times out every timeslice, so that sockets can be checked -for activity (unfortunately, sockets are not well-handled in the OS/2 TCPIP and one cannot -attach a semaphore to a socket). There is also the possibility of using the high-resolution -timer (found in Merlin) to check sockets more often than every timeslice. -*** Important: in order to maximize speed, certain shortcuts are utilized in this -implementation of select(), which makes it unsuitable as a general-purpose function. Also, -it is imperative that the EMX select() never be called from the Xserver! *** - - -If you wish to modify the source, be aware that there may be very good reasons as -to why certain things were done this way. Usually, if certain function implementations -appear unnecessarily complicated, it is probably because there were subtle problems -with the simpler solutions. Due to the complexity of the Xserver code, and the -differences between OS/2 and unix, there are many potential pitfalls. - -$XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/README,v 3.1 1996/01/30 15:26:27 dawes Exp $ - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/int10/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/int10/Imakefile deleted file mode 100644 index a323229bf..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/int10/Imakefile +++ /dev/null @@ -1,110 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/int10/Imakefile,v 1.1 2000/04/05 18:13:55 dawes Exp $ - -#define IHaveModules - -#include - -SRCS1 = pci.c xf86int10module.c helper_exec.c helper_mem.c xf86int10.c -OBJS1 = pci.o xf86int10module.o helper_exec.o helper_mem.o xf86int10.o - -LinkSourceFile(helper_mem.c,$(XF86SRC)/int10) -LinkSourceFile(helper_exec.c,$(XF86SRC)/int10) -LinkSourceFile(xf86int10.c,$(XF86SRC)/int10) -LinkSourceFile(pci.c,$(XF86SRC)/int10) -LinkSourceFile(xf86int10module.c,$(XF86SRC)/int10) -LinkSourceFile(xf86x86emu.c,$(XF86SRC)/int10) -LinkSourceFile(generic.c,$(XF86SRC)/int10) - -INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/int10 \ - -I$(XF86OSSRC) \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) - -DEFINES=-DHAVE_SYSV_IPC - -#if 0 -/* debugging stuff */ -#DEFINES =-D_PC -#undef XF86INT10_BUILD -#define XF86INT10_BUILD X86EMU_GENERIC -#define X86EMU_LIBPATH /usr/local/lib -#endif - -#if defined(i386Architecture) -DEFINES =-D_PC -#endif - -/* XXX keep this temporarily for reference */ -#if 0 -#if (XF86INT10_BUILD == X86EMU_GENERIC) - -SRCS = $(SRCS1) xf86x86emu.c generic.c -OBJS = $(OBJS1) xf86x86emu.o generic.o x86emu.o -SpecialObjectRule(pci.o, pci.c, -D_X86EMU) -SpecialObjectRule(helper_exec.o, helper_exec.c, -D_X86EMU) -SpecialObjectRule(xf86int10.o, xf86int10.c, -D_X86EMU -DSHOW_ALL_DEVICES) -SpecialObjectRule(generic.o, generic.c, -D_X86EMU) -SpecialObjectRule(xf86x86emu.o, xf86x86emu.c, -D_X86EMU) -BuildObjectFromLibraryWithPath(X86EMU_LIBPATH,x86emu,x86emu) -#endif -#endif - -#if defined(XF86INT10_BUILD) && (XF86INT10_BUILD == X86VM) - -SRCS = $(SRCS1) linux.c -OBJS = $(OBJS1) linux.o -SpecialObjectRule(pci.o, pci.c, -D_VM86_LINUX) -SpecialObjectRule(helper_exec.o, helper_exec.c, -D_VM86_LINUX) -SpecialObjectRule(xf86int10.o, xf86int10.c, -D_VM86_LINUX -DSHOW_ALL_DEVICES) -SpecialObjectRule(linux.o, linux.c, -D_VM86_LINUX -DHAVE_SYSV_IPC) - -#elif (XF86INT10_BUILD == X86EMU_OS) - -SpecialObjectRule(pci.o, pci.c, -D_X86EMU) -SpecialObjectRule(helper_exec.o, helper_exec.c, -D_X86EMU) -SpecialObjectRule(xf86int10.o, xf86int10.c, -D_X86EMU -DSHOW_ALL_DEVICES) -SpecialObjectRule(linux.o, linux.c, -D_X86EMU -DHAVE_SYSV_IPC) - -X86TOPDIR = $(TOP)/extras/x86emu -X86SRCDIR = $(X86TOPDIR)/src/x86emu -X86EMUINCLUDES = -I$(X86TOPDIR)/include -I$(X86SRCDIR) - -# if !defined(X86EMU_LIBPATH) -X86EMUSRCS = debug.c decode.c fpu.c ops.c ops2.c prim_ops.c sys.c -X86EMUOBJS = debug.o decode.o fpu.o ops.o ops2.o prim_ops.o sys.o - -LinkSourceFile(debug.c,$(X86SRCDIR)) -LinkSourceFile(decode.c,$(X86SRCDIR)) -LinkSourceFile(fpu.c,$(X86SRCDIR)) -LinkSourceFile(ops.c,$(X86SRCDIR)) -LinkSourceFile(ops2.c,$(X86SRCDIR)) -LinkSourceFile(prim_ops.c,$(X86SRCDIR)) -LinkSourceFile(sys.c,$(X86SRCDIR)) -# else -BuildObjectFromLibraryWithPath(X86EMU_LIBPATH,x86emu,x86emu) -X86EMUOBJS = x86emu.o -# endif - -SRCS = $(SRCS1) xf86x86emu.c linux.c $(X86EMUSRCS) -OBJS = $(OBJS1) xf86x86emu.o linux.o $(X86EMUOBJS) - -#endif - -#if defined(XF86INT10_BUILD) && XF86INT10_BUILD > X86EMU_GENERIC - -LibraryModuleTarget(int10, $(OBJS)) - -InstallLibraryModule(int10,$(MODULEDIR),linux) - -all:: - @(set -x; cd ../..; \ - RemoveFile(LibraryTargetName(int10)); \ - $(LN) linux/int10/LibraryTargetName(int10) . ) - -InstallDriverSDKLibraryModule(int10,$(DRIVERSDKMODULEDIR),.) - -InstallDriverSDKNonExecFile(../../int10/xf86int10.h,$(DRIVERSDKINCLUDEDIR)) - -#endif - -DependTarget() - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c deleted file mode 100644 index d01cfb373..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c +++ /dev/null @@ -1,452 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c,v 1.3 2001/04/30 14:34:58 tsi Exp $ */ -/* - * XFree86 int10 module - * execute BIOS int 10h calls in x86 real mode environment - * Copyright 1999 Egbert Eich - */ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86.h" -#include "xf86str.h" -#include "xf86_OSproc.h" -#include "xf86_ansic.h" -#include "xf86Pci.h" -#include "compiler.h" -#define _INT10_PRIVATE -#include "xf86int10.h" -#include "int10Defines.h" - -static CARD8 read_b(xf86Int10InfoPtr pInt,int addr); -static CARD16 read_w(xf86Int10InfoPtr pInt,int addr); -static CARD32 read_l(xf86Int10InfoPtr pInt,int addr); -static void write_b(xf86Int10InfoPtr pInt,int addr, CARD8 val); -static void write_w(xf86Int10InfoPtr pInt,int addr, CARD16 val); -static void write_l(xf86Int10InfoPtr pInt,int addr, CARD32 val); - -/* - * the emulator cannot pass a pointer to the current xf86Int10InfoRec - * to the memory access functions therefore store it here. - */ - -typedef struct { - int shift; - int pagesize_1; - int entries; - void* vRam; - memType *alloc_rec; -} genericInt10Priv; - -#define INTPriv(x) ((genericInt10Priv*)x->private) - -int10MemRec genericMem = { - read_b, - read_w, - read_l, - write_b, - write_w, - write_l -}; - -static void MapVRam(xf86Int10InfoPtr pInt); -static void UnmapVRam(xf86Int10InfoPtr pInt); -static void setupTable(xf86Int10InfoPtr pInt, memType address, - int loc,int size); - -static void *sysMem = NULL; - -xf86Int10InfoPtr -xf86InitInt10(int entityIndex) -{ - xf86Int10InfoPtr pInt; - int screen; - void* intMem; - void* vbiosMem; - int pagesize; - int entries; - int shift; - legacyVGARec vga; - - screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex; - - if (int10skip(xf86Screens[screen],entityIndex)) - return NULL; - - pInt = (xf86Int10InfoPtr)xnfcalloc(1,sizeof(xf86Int10InfoRec)); - pInt->entityIndex = entityIndex; - if (!xf86Int10ExecSetup(pInt)) - goto error0; - pInt->mem = &genericMem; - pagesize = xf86getpagesize(); - pInt->private = (pointer)xnfcalloc(1,sizeof(genericInt10Priv)); - entries = SYS_SIZE / pagesize; - - pInt->scrnIndex = screen; - INTPriv(pInt)->pagesize_1 = pagesize - 1; - INTPriv(pInt)->entries = entries; - INTPriv(pInt)->alloc_rec = - xnfcalloc(1,sizeof(memType) * entries); - for (shift = 0 ; (pagesize >> shift) ; shift++) {}; - shift -= 1; - INTPriv(pInt)->shift = shift; - - /* - * we need to map video RAM MMIO as some chipsets map mmio - * registers into this range. - */ - - MapVRam(pInt); - intMem = xnfalloc(pagesize); - setupTable(pInt,(memType)intMem,0,pagesize); - vbiosMem = xnfalloc(V_BIOS_SIZE); - -#ifdef _PC - if (!sysMem) - sysMem = xf86MapVidMem(screen,VIDMEM_FRAMEBUFFER,SYS_BIOS,BIOS_SIZE); - setupTable(pInt,(memType)sysMem,SYS_BIOS,BIOS_SIZE); - if (xf86ReadBIOS(0,0,(unsigned char *)intMem,LOW_PAGE_SIZE) < 0) { - xf86DrvMsg(screen,X_ERROR,"Cannot read int vect\n"); - goto error1; - } - if (xf86IsEntityPrimary(entityIndex)) { - int size; - int cs = MEM_RW(pInt,((0x10<<2)+2)); - -int i,k,m; -char buf[100], hx[10]; -for (i=0; i<0x100; i+=16) { -sprintf(buf,"%04x: ",i); -for (k=0; k<16; k++) { - m = MEM_RB(pInt,i+k); - sprintf(hx,"%02x ",((unsigned)m)&0xff); - strcat(buf,hx); -} -xf86DrvMsg(screen,X_INFO,"%s\n",buf); -} - - - - xf86DrvMsg(screen,X_INFO,"Primary V_BIOS segmant is: 0x%x\n",cs); - if (xf86ReadBIOS(cs << 4,0,(unsigned char *)vbiosMem, - 0x10) < 0) { - xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (1)\n"); - goto error1; - } - if (!((*(CARD8*)vbiosMem == 0x55) - && (*((CARD8*)vbiosMem + 1) == 0xAA))) { - xf86DrvMsg(screen,X_ERROR,"No V_BIOS found\n"); - goto error1; - } - - size = *((CARD8*)vbiosMem + 2) * 512; - if (xf86ReadBIOS(cs << 4,0,vbiosMem, size) < 0) { - xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (2)\n"); - goto error1; - } - - setupTable(pInt,(memType)vbiosMem,cs<<4,size); - set_return_trap(pInt); - pInt->BIOSseg = cs; - } else { - reset_int_vect(pInt); - set_return_trap(pInt); - if (!mapPciRom(pInt,(unsigned char *)(vbiosMem))) { - xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (3)\n"); - goto error1; - } - setupTable(pInt,(memType)vbiosMem,V_BIOS,V_BIOS_SIZE); - pInt->BIOSseg = V_BIOS >> 4; - pInt->num = 0xe6; - LockLegacyVGA(pInt, &vga); - xf86ExecX86int10(pInt); - UnlockLegacyVGA(pInt, &vga); - } -#else - if (!sysMem) { - sysMem = xnfalloc(BIOS_SIZE); - setup_system_bios((memType)sysMem); - } - setupTable(pInt,(memType)sysMem,SYS_BIOS,BIOS_SIZE); - setup_int_vect(pInt); - set_return_trap(pInt); - if (!mapPciRom(pInt,(unsigned char *)(vbiosMem))) { - xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (4)\n"); - goto error1; - } - setupTable(pInt,(memType)vbiosMem,V_BIOS,V_BIOS_SIZE); - pInt->BIOSseg = V_BIOS >> 4; - pInt->num = 0xe6; - LockLegacyVGA(pInt, &vga); - xf86ExecX86int10(pInt); - UnlockLegacyVGA(pInt, &vga); -#endif - return pInt; - - error1: - xfree(vbiosMem); - xfree(intMem); - UnmapVRam(pInt); - xfree(INTPriv(pInt)->alloc_rec); - xfree(pInt->private); - error0: - xfree(pInt); - - return NULL; -} - -static void -MapVRam(xf86Int10InfoPtr pInt) -{ - int screen = pInt->scrnIndex; - int pagesize = INTPriv(pInt)->pagesize_1 + 1; - int size = ((VRAM_SIZE + pagesize - 1)/pagesize) * pagesize; - INTPriv(pInt)->vRam = xf86MapVidMem(screen,VIDMEM_MMIO,V_RAM,size); -} - -static void -UnmapVRam(xf86Int10InfoPtr pInt) -{ - int screen = pInt->scrnIndex; - int pagesize = INTPriv(pInt)->pagesize_1 + 1; - int size = ((VRAM_SIZE + pagesize - 1)/pagesize) * pagesize; - - xf86UnMapVidMem(screen,INTPriv(pInt)->vRam,size); -} - -Bool -MapCurrentInt10(xf86Int10InfoPtr pInt) -{ - /* nothing to do here */ - return TRUE; -} - -void -xf86FreeInt10(xf86Int10InfoPtr pInt) -{ - int pagesize; - - if (!pInt) - return; - pagesize = INTPriv(pInt)->pagesize_1 + 1; - if (Int10Current == pInt) - Int10Current = NULL; - xfree(INTPriv(pInt)->alloc_rec[V_BIOS/pagesize]); - xfree(INTPriv(pInt)->alloc_rec[0]); - UnmapVRam(pInt); - xfree(INTPriv(pInt)->alloc_rec); - xfree(pInt->private); - xfree(pInt); -} - -void * -xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off) -{ - void* addr; - int pagesize = INTPriv(pInt)->pagesize_1 + 1; - int num_pages = INTPriv(pInt)->entries; - int i,j; - - for (i=0;ialloc_rec[i] == 0) { - for (j=i;j < num + i;j++) - if ((INTPriv(pInt)->alloc_rec[j] != 0)) - break; - if (j == num + i) - break; - else - i = i + num; - } - } - if (i == num_pages - num) - return NULL; - - *off = i * pagesize; - addr = xnfalloc(pagesize * num); - setupTable(pInt,(memType)addr,*off,pagesize * num); - - return addr; -} - -void -xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num) -{ - int num_pages = INTPriv(pInt)->entries; - int i,j; - for (i = 0;ialloc_rec[i]==(memType)pbase) { - for (j = 0; j < num; j++) - INTPriv(pInt)->alloc_rec[i] = 0; - break; - } - xfree(pbase); - return; -} - -static void -setupTable(xf86Int10InfoPtr pInt, memType address,int loc,int size) -{ - int pagesize = INTPriv(pInt)->pagesize_1 + 1; - int i,j,num; - - i = loc / pagesize; - num = (size + pagesize - 1)/ pagesize; /* round up to the nearest page */ - /* boudary if size is not */ - /* multiple of pagesize */ - for (j = 0; jalloc_rec[i+j] = address; - address += pagesize; - } -} - -#define OFF(addr) \ - ((addr) & (INTPriv(pInt)->pagesize_1)) -#define SHIFT \ - (INTPriv(pInt)->shift) -#define BASE(addr,shift) \ - (INTPriv(pInt)->alloc_rec[addr >> shift]) -#define V_ADDR(addr,shift,off) \ - (BASE(addr,shift) + (off)) -#define VRAM_ADDR(addr) (addr - 0xA0000) -#define VRAM_BASE (INTPriv(pInt)->vRam) - -#define VRAM(addr) ((addr >= 0xA0000) && (addr <= 0xBFFFF)) -#define V_ADDR_RB(addr,shift,off) \ - (VRAM(addr)) ? MMIO_IN8((CARD8*)VRAM_BASE,VRAM_ADDR(addr)) \ - : *(CARD8*) V_ADDR(addr,shift,off) -#define V_ADDR_RW(addr,shift,off) \ - (VRAM(addr)) ? MMIO_IN16((CARD16*)VRAM_BASE,VRAM_ADDR(addr)) \ - : ldw_u((pointer)V_ADDR(addr,shift,off)) -#define V_ADDR_RL(addr,shift,off) \ - (VRAM(addr)) ? MMIO_IN32((CARD32*)VRAM_BASE,VRAM_ADDR(addr)) \ - : ldl_u((pointer)V_ADDR(addr,shift,off)) - -#define V_ADDR_WB(addr,shift,off,val) \ - if(VRAM(addr)) \ - MMIO_OUT8((CARD8*)VRAM_BASE,VRAM_ADDR(addr),val); \ - else \ - *(CARD8*) V_ADDR(addr,shift,off) = val; -#define V_ADDR_WW(addr,shift,off,val) \ - if(VRAM(addr)) \ - MMIO_OUT16((CARD16*)VRAM_BASE,VRAM_ADDR(addr),val); \ - else \ - stw_u((val),(pointer)(V_ADDR(addr,shift,off))); - -#define V_ADDR_WL(addr,shift,off,val) \ - if (VRAM(addr)) \ - MMIO_OUT32((CARD32*)VRAM_BASE,VRAM_ADDR(addr),val); \ - else \ - stl_u(val,(pointer)(V_ADDR(addr,shift,off))); - -static CARD8 -read_b(xf86Int10InfoPtr pInt, int addr) -{ - if (!BASE(addr,SHIFT)) return 0xff; - - return V_ADDR_RB(addr,SHIFT,OFF(addr)); -} - -static CARD16 -read_w(xf86Int10InfoPtr pInt, int addr) -{ - int shift = SHIFT; - int off = OFF(addr); - - if (!BASE(addr,shift)) return 0xffff; - -#if X_BYTE_ORDER == X_BIG_ENDIAN - return ((V_ADDR_RB(addr,shift,off)) - || ((V_ADDR_RB(addr,shift,off + 1)) << 8)); -#else - if (OFF(addr + 1) > 0) { - return V_ADDR_RW(addr,SHIFT,OFF(addr)); - } else { - return ((V_ADDR_RB(addr,shift,off + 1)) - || ((V_ADDR_RB(addr,shift,off)) << 8)); - } -#endif -} - -static CARD32 -read_l(xf86Int10InfoPtr pInt, int addr) -{ - int shift = SHIFT; - int off = OFF(addr); - - if (!BASE(addr,shift)) return 0xffffffff; - -#if X_BYTE_ORDER == X_BIG_ENDIAN - return ((V_ADDR_RB(addr,shift,off)) - || ((V_ADDR_RB(addr,shift,off + 1)) << 8) - || ((V_ADDR_RB(addr,shift,off + 2)) << 16) - || ((V_ADDR_RB(addr,shift,off + 3)) << 24)); -#else - if (OFF(addr + 3) > 2) { - return V_ADDR_RL(addr,SHIFT,OFF(addr)); - } else { - return ((V_ADDR_RB(addr,shift,off + 3)) - || ((V_ADDR_RB(addr,shift,off + 2)) << 8) - || ((V_ADDR_RB(addr,shift,off + 1)) << 16) - || ((V_ADDR_RB(addr,shift,off)) << 24)); - } -#endif -} - -static void -write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val) -{ - if (!BASE(addr,SHIFT)) return; - - V_ADDR_WB(addr,SHIFT,OFF(addr),val); -} - -static void -write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val) -{ - int shift = SHIFT; - int off = OFF(addr); - - if (!BASE(addr,shift)) return; - -#if X_BYTE_ORDER == X_BIG_ENDIAN - V_ADDR_WB(addr,shift,off,val); - V_ADDR_WB(addr,shift,off + 1,val >> 8); -#else - if (OFF(addr + 1) > 0) { - V_ADDR_WW(addr,shift,OFF(addr),val); - } else { - V_ADDR_WB(addr,shift,off + 1,val); - V_ADDR_WB(addr,shift,off,val >> 8); - } -#endif -} - -static void -write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val) -{ - int shift = SHIFT; - int off = OFF(addr); - if (!BASE(addr,shift)) return; - -#if X_BYTE_ORDER == X_BIG_ENDIAN - V_ADDR_WB(addr,shift,off,val); - V_ADDR_WB(addr,shift,off + 1, val >> 8); - V_ADDR_WB(addr,shift,off + 2, val >> 16); - V_ADDR_WB(addr,shift,off + 3, val >> 24); -#else - if (OFF(addr + 3) > 2) { - V_ADDR_WL(addr,shift,OFF(addr),val); - } else { - V_ADDR_WB(addr,shift,off + 3, val); - V_ADDR_WB(addr,shift,off + 2, val >> 8); - V_ADDR_WB(addr,shift,off + 1, val >> 16); - V_ADDR_WB(addr,shift,off, val >> 24); - } -#endif -} - -pointer -xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr) -{ - return (pointer) V_ADDR(addr,SHIFT,OFF(addr)); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_VTsw.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_VTsw.c deleted file mode 100644 index e050a62cb..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_VTsw.c +++ /dev/null @@ -1,340 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_VTsw.c,v 3.13 2003/06/10 17:03:54 dawes Exp $ */ -/* - * Copyright 1993 by David Wexelblat - * Modified 1996 by Sebastien Marineau - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of David Wexelblat not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. David Wexelblat makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: os2_VTsw.c /main/7 1996/05/13 16:37:55 kaleb $ */ - -#define I_NEED_OS2_H -#define NEED_EVENTS -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "input.h" -#include "scrnintstr.h" - -#define INCL_WINSWITCHLIST -#define INCL_VIO -#define INCL_KBD -#define INCL_DOSPROCESS -#define INCL_DOSSEMAPHORES -#define INCL_DOSERRORS -#undef RT_FONT -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "atKeynames.h" - -BOOL SwitchedToWPS=FALSE; -BOOL WaitingForAccess=FALSE; -void os2PostKbdEvent(); -HEV hevServerHasFocus; -HEV hevSwitchRequested; -HEV hevErrorPopupDetected; -extern HEV hevPopupPending; -extern HEV hSwitchToSem; -BOOL os2PopupErrorPending=FALSE; - -/* - * Added OS/2 code to handle switching back to WPS - */ - - -Bool xf86VTSwitchPending() -{ - return(xf86Info.vtRequestsPending ? TRUE : FALSE); -} - -Bool xf86VTSwitchAway() -{ - APIRET rc; - ULONG drive; - - xf86Info.vtRequestsPending=FALSE; - SwitchedToWPS=TRUE; - - rc = DosQuerySysInfo(5,5,&drive,sizeof(drive)); - rc = DosSuppressPopUps(0x0000L,drive+96); /* Disable popups */ - DosPostEventSem(hevSwitchRequested); - usleep(30000); - return(TRUE); -} - -Bool xf86VTSwitchTo() -{ - APIRET rc; - ULONG drive,postCount; - - xf86Info.vtRequestsPending=FALSE; - SwitchedToWPS=FALSE; - rc = DosResetEventSem(hSwitchToSem,&postCount); - DosPostEventSem(hevSwitchRequested); - rc = DosQuerySysInfo(5,5,&drive,sizeof(drive)); - rc = DosSuppressPopUps(0x0001L,drive+96); /* Disable popups */ - - /* We reset the state of the control key */ - os2PostKbdEvent(KEY_LCtrl,1); - os2PostKbdEvent(KEY_LCtrl,0); - os2PostKbdEvent(KEY_RCtrl,1); - os2PostKbdEvent(KEY_RCtrl,0); - os2PostKbdEvent(KEY_Alt,1); - os2PostKbdEvent(KEY_Alt,0); - return(TRUE); -} - - -/* This function is run as a thread and will notify of switch-to/switch-away events */ -void os2VideoNotify(arg) -void * arg; -{ - USHORT Indic; - USHORT NotifyType; - APIRET rc; - ULONG postCount; - Bool FirstTime=TRUE; - int timeout_count; - - rc=DosCreateEventSem(NULL,&hevServerHasFocus,0L,FALSE); - rc=DosPostEventSem(hevServerHasFocus); - rc=DosCreateEventSem(NULL,&hevSwitchRequested,0L,FALSE); - rc=DosPostEventSem(hevSwitchRequested); - - - while(1) { - Indic=0; - rc=VioSavRedrawWait(Indic,&NotifyType,(HVIO)0); - -/* Here we handle the semaphore used to indicate wether we have screen access */ - if(NotifyType==0) rc=DosResetEventSem(hevServerHasFocus,&postCount); - if(FirstTime){ - FirstTime=FALSE; - if(NotifyType==1) NotifyType=65535; /* In case a redraw is requested on first call */ - } - - if(NotifyType==1){ -/* Notify os2PseudoSelect() that we are back */ - rc=DosPostEventSem(hSwitchToSem); - if (rc) xf86Msg(X_ERROR,"Post SwitchToSem returned %d\n"); -/* Sanity check */ - if (!SwitchedToWPS) { - xf86Msg(X_ERROR, - "Abnormal switching back to server detected\n"); - } - } - -/* Here we set the semaphore used to indicate switching request */ - - if((NotifyType!=65535)&&(!WaitingForAccess)) { - rc=DosResetEventSem(hevSwitchRequested,&postCount); - xf86Info.vtRequestsPending=TRUE; -/* Then wait for semaphore to be posted once switch is complete. Wait 20 secs, then kill server */ - timeout_count=0; - rc=DosSetPriority(2,3,0,1); - do { - rc=DosWaitEventSem(hevSwitchRequested,1000L); - if(rc==ERROR_TIMEOUT){ - timeout_count++; - if(timeout_count>25){ - xf86Msg(X_ERROR, - "Server timeout on VT switch request. Server was killed\n"); - DosExit(1L,0); - } - if(WaitingForAccess) { /* The server is resetting */ - DosPostEventSem(hevSwitchRequested); - xf86Info.vtRequestsPending=FALSE; - } - } - } while (rc==ERROR_TIMEOUT); - rc=DosSetPriority(2,2,0,1); - } - if(NotifyType==1) rc=DosPostEventSem(hevServerHasFocus); - if((NotifyType==0)&&(!SwitchedToWPS)) - xf86Msg(X_ERROR, - "Abnormal switching away from server!\n"); - } /* endwhile */ - -/* End of thread */ -} - -/* This function is run as a thread and will notify of hard-error events */ -void os2HardErrorNotify(arg) -void * arg; -{ - USHORT Indic; - USHORT NotifyType; - APIRET rc; - ULONG postCount; - - rc=DosCreateEventSem(NULL,&hevErrorPopupDetected,0L,FALSE); - rc=DosPostEventSem(hevErrorPopupDetected); - os2PopupErrorPending=FALSE; - - while(1) { - Indic=0; - rc=VioModeWait(Indic,&NotifyType,(HVIO)0); - if(NotifyType==0){ - os2PopupErrorPending=TRUE; - rc=DosPostEventSem(hSwitchToSem); - rc=DosResetEventSem(hevErrorPopupDetected,&postCount); - rc=DosWaitEventSem(hevErrorPopupDetected,20000L); - if(rc==ERROR_TIMEOUT) GiveUp(0); /* Shutdown on timeout of semaphore */ - } - } /* endwhile */ - -/* End of thread */ -} - -static BOOL is_redirected = FALSE; - -static void -redirect_output(void) -{ - /* hv300996 create redirect file on boot drive, instead - * anywhere you are just standing - */ - char buf[20],dr[3]; - ULONG drive; - APIRET rc; - - if (is_redirected) return; - - if ((rc = DosQuerySysInfo(5,5,&drive,sizeof(drive))) != 0) - dr[0] = 0; - else { - dr[0] = drive+96; - dr[1] = ':'; - dr[2] = 0; - } - sprintf(buf,"%s\\xf86log.os2",dr); - - ErrorF("\nThis is the XFree86/OS2-4.0 server\n"); - ErrorF("\nAll output from now on will be redirected to %s\n",buf); - freopen(buf,"w",stderr); - - is_redirected = TRUE; -} - -void -os2ServerVideoAccess() -{ - APIRET rc; - ULONG fgSession; - ULONG length=4; - CHAR Status; - - /* Redirect output as early as possible */ - /* redirect_output(); */ - /* too many logfiles, server will log to /usr/adm */ - -/* Wait for screen access. This is called at server reset or at server startup */ -/* Here we do some waiting until this session comes in the foreground before * - * going any further. This is because we may have been started in the bg */ - - if(serverGeneration==1){ - rc=VioScrLock(0, &Status, (HVIO)0); - while(Status != 0){ - rc=VioScrLock(0, &Status, (HVIO)0); - DosSleep(1000); - } - VioScrUnLock((HVIO)0); - return; - } - WaitingForAccess=TRUE; - rc=DosWaitEventSem(hevServerHasFocus,SEM_INDEFINITE_WAIT); - WaitingForAccess=FALSE; - SwitchedToWPS=FALSE; /* In case server has reset while we were switched to WPS */ -} - -/* This next function will attempt to recover from a hard error popup - * with an EnterLeave call - */ - -void os2RecoverFromPopup() -{ - int j; - ULONG postCount; - - if (os2PopupErrorPending) { -#if 0 - for (j = 0; j < screenInfo.numScreens; j++) - (XF86SCRNINFO(screenInfo.screens[j])->EnterLeaveVT)(LEAVE, j); - for (j = 0; j < screenInfo.numScreens; j++) - (XF86SCRNINFO(screenInfo.screens[j])->EnterLeaveVT)(ENTER, j); -#endif - DosResetEventSem(hSwitchToSem,&postCount); - - for (j = 0; j < xf86NumScreens; j++) { - if (xf86Screens[j]->EnableDisableFBAccess) - (*xf86Screens[j]->EnableDisableFBAccess)(j, FALSE); - } - xf86EnterServerState(SETUP); - for (j = 0; j < xf86NumScreens; j++) - xf86Screens[j]->LeaveVT(j, 0); - for (j = 0; j < xf86NumScreens; j++) { - xf86Screens[j]->EnterVT(j, 0); - } - xf86EnterServerState(OPERATING); - for (j = 0; j < xf86NumScreens; j++) { - if (xf86Screens[j]->EnableDisableFBAccess) - (*xf86Screens[j]->EnableDisableFBAccess)(j, TRUE); - } - - /* We reset the state of the control key */ - os2PostKbdEvent(KEY_LCtrl,1); - os2PostKbdEvent(KEY_LCtrl,0); - os2PostKbdEvent(KEY_RCtrl,1); - os2PostKbdEvent(KEY_RCtrl,0); - os2PostKbdEvent(KEY_Alt,1); - os2PostKbdEvent(KEY_Alt,0); - - /* Turn screen saver off when switching back */ - SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset); - os2PopupErrorPending=FALSE; - DosPostEventSem(hevErrorPopupDetected); - } -} - -/* This checks wether a popup event is waiting. The semaphore would be reset - * by the XF86VIO.DLL function - */ - -void os2CheckPopupPending() -{ - int j; - ULONG postCount; - - return; /* For now this is a no-op */ - -#if 0 - DosQueryEventSem(hevPopupPending,&postCount); - if (postCount==0) { /* We have a popup pending */ -#if 0 - for (j = 0; j < screenInfo.numScreens; j++) - (XF86SCRNINFO(screenInfo.screens[j])->EnterLeaveVT)(LEAVE, j); -#endif - DosPostEventSem(hevPopupPending); - } -#endif -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_bios.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_bios.c deleted file mode 100644 index 4069ad745..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_bios.c +++ /dev/null @@ -1,143 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_bios.c,v 3.10 2000/04/05 18:13:52 dawes Exp $ */ -/* - * (c) Copyright 1994 by Holger Veit - * - * Modified 1996 by Sebastien Marineau - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * HOLGER VEIT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Holger Veit shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Holger Veit. - * - */ -/* $XConsortium: os2_bios.c /main/5 1996/10/27 11:48:45 kaleb $ */ - -#define I_NEED_OS2_H -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "input.h" -#include "scrnintstr.h" - -#define INCL_32 -#define INCL_DOS -#define INCL_DOSFILEMGR -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -/* - * Read BIOS via xf86sup.SYS device driver - */ - -static APIRET doioctl(HFILE fd,ULONG addr,ULONG len,unsigned char* dbuf) -{ - UCHAR *dta; - ULONG plen,dlen; - APIRET rc; - - struct { - ULONG command; - ULONG physaddr; - USHORT numbytes; - } par; - - /* prepare parameter and data packets for ioctl */ - par.command = 0; - par.physaddr = addr; - par.numbytes = dlen = len; - plen = sizeof(par); - - /* issue call to get a readonly copy of BIOS ROM */ - rc = DosDevIOCtl(fd, (ULONG)0x76, (ULONG)0x64, - (PVOID)&par, (ULONG)plen, (PULONG)&plen, - (PVOID)dbuf, (ULONG)dlen, (PULONG)&dlen); - - return rc; -} - -int xf86ReadBIOS(Base, Offset, Buf, Len) -unsigned long Base; -unsigned long Offset; -unsigned char *Buf; -int Len; -{ - HFILE fd; - int i; - ULONG action; - APIRET rc; - ULONG Phys_address; - UCHAR* dta; - int off, chunksz,lensave; - - /* allocate dta */ - dta = (UCHAR*)xalloc(Len); - - Phys_address=Base+Offset; - - /* open the special device pmap$ (default with OS/2) */ - if (DosOpen((PSZ)"PMAP$", (PHFILE)&fd, (PULONG)&action, - (ULONG)0, FILE_SYSTEM, FILE_OPEN, - OPEN_SHARE_DENYNONE|OPEN_FLAGS_NOINHERIT|OPEN_ACCESS_READONLY, - (ULONG)0) != 0) { - FatalError("xf86ReadBIOS: install DEVICE=path\\xf86sup.SYS!"); - return -1; - } - - /* copy 32K at a time */ - off = 0; - lensave = Len; - while (Len > 0) { - chunksz = (Len > 32768) ? 32768 : Len; - Len -= chunksz; - rc = doioctl(fd,(ULONG)Phys_address,chunksz,dta+off); - if (rc != 0) { - FatalError("xf86ReadBIOS: BIOS map failed, addr=%lx, rc=%d\n", - Phys_address,rc); - xfree(dta); - DosClose(fd); - return -1; - } - off += chunksz; - } - - /* - * Sanity check... No longer fatal, as some PS/1 and PS/2 fail here but still work. - * S. Marineau, 10/10/96 - */ -#if 0 - if ((Phys_address & 0x7fff) != 0 && - (dta[0] != 0x55 || dta[1] != 0xaa)) { - FatalError("BIOS sanity check failed, addr=%x\nPlease report if you encounter problems\n", - Phys_address); - } -#endif - - /* copy data to buffer */ - memcpy(Buf, dta, lensave); - xfree(dta); - - /* close device */ - DosClose(fd); - - return(lensave); -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_diag.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_diag.c deleted file mode 100644 index f321df5c2..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_diag.c +++ /dev/null @@ -1,263 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_diag.c,v 3.7 2000/04/05 18:13:52 dawes Exp $ */ -/* - * (c) Copyright 1997 by Holger Veit - * - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * HOLGER VEIT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Holger Veit shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Holger Veit. - * - */ -/* $XConsortium$ */ - -/* This file checks whether the user has installed the system correctly, - * to avoid the numerous questions why this or that does not work - */ - -#define I_NEED_OS2_H -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "input.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#define INCL_DOSFILEMGR -#define INCL_KBD -#define INCL_VIO -#define INCL_DOSMISC -#define INCL_DOSPROCESS -#define INCL_DOSSEMAPHORES -#define INCL_DOSMODULEMGR -#define INCL_DOSFILEMGR -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#include -#include -#include - -static BOOL diag_checks = FALSE; - -/* from Eberhard to check for the right EMX version */ -static void -check_emx (void) -{ - ULONG rc; - HMODULE hmod; - char name[CCHMAXPATH]; - char fail[9]; - - if (_emx_rev < 50) { - xf86Msg(X_ERROR,"This program requires emx.dll revision 50 (0.9c fix 2) " - "or later.\n"); - rc = DosLoadModule (fail, sizeof (fail), "emx", &hmod); - if (rc == 0) { - rc = DosQueryModuleName (hmod, sizeof (name), name); - if (rc == 0) - xf86Msg(X_ERROR,"Please delete or update `%s'.\n", name); - DosFreeModule (hmod); - } - exit (2); - } -} - -static void -check_bsl(const char *var) -{ - char *t1 = strrchr(var,'\\'); - if (strchr(var,'/')) { - xf86Msg(X_WARNING, - "\"%s\" must exclusively use backward slashes \"\\\"\n", - var); - } - if (t1 && *(t1+1)=='\0') { - xf86Msg(X_WARNING, - "\"%s\" mustn't end with \"\\\"\n",var); - *t1 = '\0'; - } -} - - -static void -check_fsl(const char *var) -{ - char *t1 = strrchr(var,'/'); - if (strchr(var,'\\')) { - xf86Msg(X_WARNING, - "\"%s\" must exclusively use forward slashes \"/\"\n", - var); - } -} - - -static void -check_long(const char* path) -{ - FILE *f; - char n[300]; - - sprintf(n,"%s\\xf86_test_for_very_long_filename",path); - f = fopen(n,"w"); - if (f==NULL) { - xf86Msg(X_WARNING, - "\"%s\" does not accept long filenames\nmust reside on HPFS or similar\n", - path); - } else { - fclose(f); - unlink(n); - } -} - -static char * -check_env_present(const char *env) -{ - char *e = getenv(env); - if (!e) { - xf86Msg(X_WARNING, - "You have no \"%s\" environment variable, but need one\n", - env); - return 0; - } - return e; -} - -void os2_checkinstallation(void) -{ - char *emxopt, *tmp, *home, *logname, *termcap; - char hostname[256], *display, *hostvar, *s, *h; - struct hostent *hent; - struct in_addr *in; - int i; - - if (diag_checks) return; - diag_checks = TRUE; - - /* test whether the EMX version is okay */ - check_emx(); - - /* Check a number of environment variables */ - emxopt = getenv("EMXOPT"); - if (emxopt) { - for (i=0; ih_name); - while ((s= *(hent->h_aliases)) != NULL) { - xf86Msg(X_INFO, - " alias: \"%s\"\n",s); - hent->h_aliases++; - } - xf86Msg(X_INFO, - " addr type = %d, addr length = %d\n", - hent->h_addrtype, hent->h_length); - if (hent->h_addrtype == AF_INET) { - while ((in= (struct in_addr*)*(hent->h_addr_list++)) != NULL) { - xf86Msg(X_INFO, - " IP address: \"%s\"\n", - inet_ntoa(*in)); - } - } else { - xf86Msg(X_INFO, - "Addrtype should be %d: Check network setup and install TCP/IP support correctly\n", - AF_INET); - } - } -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_init.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_init.c deleted file mode 100644 index 81b2689b8..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_init.c +++ /dev/null @@ -1,244 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_init.c,v 3.18 2003/11/29 01:48:31 dawes Exp $ */ -/* - * (c) Copyright 1994 by Holger Veit - * - * Modified 1996 Sebastien Marineau - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * HOLGER VEIT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Holger Veit shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Holger Veit. - * - */ -/* $XConsortium: os2_init.c /main/9 1996/10/19 18:07:13 kaleb $ */ - -#define I_NEED_OS2_H -#define INCL_DOSFILEMGR -#define INCL_KBD -#define INCL_VIO -#define INCL_DOSMISC -#define INCL_DOSPROCESS -#define INCL_DOSSEMAPHORES -#define INCL_DOSMODULEMGR -#define INCL_DOSFILEMGR -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include "input.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -VIOMODEINFO OriginalVideoMode; -void os2VideoNotify(); -void os2HardErrorNotify(); -void os2KbdMonitorThread(); -void os2KbdBitBucketThread(); -HEV hevPopupPending; -extern HEV hKbdSem; -extern BOOL os2HRTimerFlag; -static unsigned short cw; -extern void os2_checkinstallation(); /* os2_diag.c */ - -void xf86OpenConsole() -{ - /* try to catch problems before they become obvious */ - os2_checkinstallation(); - - if (serverGeneration == 1) { - HKBD fd; - ULONG drive; - ULONG dummy; - KBDHWID hwid; - APIRET rc; - int VioTid; - ULONG actual_handles; - LONG new_handles; - - /* hv 250197 workaround for xkb-Problem: switch to X11ROOT drive */ - char *x11r = getenv("X11ROOT"); - /* Make sure X11ROOT is set before we go further sm280297 */ - if (x11r == NULL){ - xf86Msg(X_ERROR, - "Environment variable X11ROOT is not set! Aborting...\n"); - exit(1); - } - if (_chdir2(x11r) < 0) { - xf86Msg(X_ERROR,"Cannot change to X11ROOT directory!\n"); - } - - xf86Msg(X_INFO,"Console opened\n"); - OriginalVideoMode.cb=sizeof(VIOMODEINFO); - rc=VioGetMode(&OriginalVideoMode,(HVIO)0); - if(rc!=0) - xf86Msg(X_ERROR, - "Could not get original video mode. RC=%d\n",rc); - xf86Info.consoleFd = -1; - - /* Set the number of handles to higher than the default 20. Set to 80 which should be plenty */ - new_handles = 0; - rc = DosSetRelMaxFH(&new_handles,&actual_handles); - if (actual_handles < 80) { - new_handles = 80 - actual_handles; - rc = DosSetRelMaxFH(&new_handles,&actual_handles); - xf86Msg(X_INFO,"Increased number of available handles to %d\n", - actual_handles); - } - - /* grab the keyboard */ - rc = KbdGetFocus(0,0); - if (rc != 0) - FatalError("xf86OpenConsole: cannot grab kbd focus, rc=%d\n",rc); - - /* open the keyboard */ - rc = KbdOpen(&fd); - if (rc != 0) - FatalError("xf86OpenConsole: cannot open keyboard, rc=%d\n",rc); - xf86Info.consoleFd = fd; - - xf86Msg(X_INFO,"Keyboard opened\n"); - - /* assign logical keyboard */ - KbdFreeFocus(0); - rc = KbdGetFocus(0,fd); - if (rc != 0) - FatalError("xf86OpenConsole: cannot set local kbd focus, rc=%d\n",rc); - -/* Create kbd queue semaphore */ - - rc = DosCreateEventSem(NULL,&hKbdSem,DC_SEM_SHARED,TRUE); - if (rc != 0) - FatalError("xf86OpenConsole: cannot create keyboard queue semaphore, rc=%d\n",rc); - -/* Create popup semaphore */ - - rc = DosCreateEventSem("\\SEM32\\XF86PUP",&hevPopupPending,DC_SEM_SHARED,1); - if (rc) - xf86Msg(X_ERROR, - "Could not create popup semaphore! RC=%d\n",rc); -#if 0 - rc=VioRegister("xf86vio","XF86POPUP_SUBCLASS",0x20002004L,0L); - if (rc) { - FatalError("Could not register XF86VIO.DLL module. Please install in LIBPATH! RC=%d\n", - rc); - } -#endif - -/* Start up the VIO monitor thread */ - VioTid=_beginthread(os2VideoNotify,NULL,0x4000,(void *)NULL); - xf86Msg(X_INFO,"Started Vio thread, Tid=%d\n",VioTid); - rc=DosSetPriority(2,3,0,VioTid); - -/* Start up the hard-error VIO monitor thread */ - VioTid=_beginthread(os2HardErrorNotify,NULL,0x4000,(void *)NULL); - xf86Msg(X_INFO,"Started hard error Vio mode monitor thread, Tid=%d\n", - VioTid); - rc=DosSetPriority(2,3,0,VioTid); - -/* We have to set the codepage before the keyboard monitor is registered */ - rc = KbdSetCp(0,0,fd); - if(rc != 0) - FatalError("xf86OpenConsole: cannot set keyboard codepage, rc=%d\n",rc); - -/* Start up the kbd monitor thread */ - VioTid=_beginthread(os2KbdMonitorThread,NULL,0x4000,(void *)NULL); - xf86Msg(X_INFO,"Started Kbd monitor thread, Tid=%d\n",VioTid); - rc=DosSetPriority(2,3,0,VioTid); - -/* Disable hard-errors through DosError */ - rc = DosQuerySysInfo(5,5,&drive,sizeof(drive)); - rc = DosSuppressPopUps(0x0001L,drive+96); /* Disable popups */ - - hwid.cb = sizeof(hwid); /* fix crash on P9000 */ - rc = KbdGetHWID(&hwid, fd); - if (rc == 0) { - switch (hwid.idKbd) { - default: - case 0xab54: /* 88/89 key */ - case 0: /*unknown*/ - case 1: /*real AT 84 key*/ - xf86Info.kbdType = KB_84; break; - case 0xab85: /* 122 key */ - FatalError("Unsupported extended 122key keyboard found!\n",0); - case 0xab41: /* 101/102 key */ - xf86Info.kbdType = KB_101; break; - } - } else - xf86Info.kbdType = KB_84; /*defensive*/ - -/* Start up the Kbd bit-bucket thread. We don't want to leave the kbd events in the driver queue */ - VioTid=_beginthread(os2KbdBitBucketThread,NULL,0x2000,(void *)NULL); - xf86Msg(X_INFO,"Started Kbd bit-bucket thread, Tid=%d\n",VioTid); - -/* fg271103: set control word of FPU to default value to prevent SIGFPE in GLX (and elsewhere?) */ - -#define DEFAULT_X86_FPU 0x037f - - cw = _control87(DEFAULT_X86_FPU, 0xFFFF); - xf86Msg(X_INFO,"Checking FPCW: %#x\n",cw); - - if (cw != DEFAULT_X86_FPU) { - cw = _control87(0,0); - xf86Msg(X_INFO,"Set FPCW to %#x\n",cw); - } - - } - return; -} - -void xf86CloseConsole() -{ - APIRET rc; - ULONG drive; - - if (xf86Info.consoleFd != -1) { - KbdClose(xf86Info.consoleFd); - } - VioSetMode(&OriginalVideoMode,(HVIO)0); - rc = DosQuerySysInfo(5,5,&drive,sizeof(drive)); - rc = DosSuppressPopUps(0x0000L,drive+96); /* Reenable popups */ - rc = DosCloseEventSem(hevPopupPending); - rc = VioDeRegister(); - return; -} - -/* ARGSUSED */ - -int xf86ProcessArgument (argc, argv, i) -int argc; -char *argv[]; -int i; -{ - return 0; -} - -void xf86UseMsg() -{ - return; -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_io.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_io.c deleted file mode 100644 index e6570aeb9..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_io.c +++ /dev/null @@ -1,257 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_io.c,v 3.19 2003/11/17 22:20:41 dawes Exp $ */ -/* - * (c) Copyright 1994,1999 by Holger Veit - * - * Modified 1996 by Sebastien Marineau - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * HOLGER VEIT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Holger Veit shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Holger Veit. - * - */ -/* $XConsortium: os2_io.c /main/9 1996/05/13 16:38:07 kaleb $ */ - -#define I_NEED_OS2_H -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "compiler.h" -#include - -#define INCL_DOSPROCESS -#define INCL_KBD -#define INCL_MOU -#define INCL_DOSDEVIOCTL -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -int os2MouseQueueQuery(); -int os2KbdQueueQuery(); -void os2RecoverFromPopup(); -void os2CheckPopupPending(); -extern BOOL os2PopupErrorPending; -int _select2 (int, fd_set *, fd_set *,fd_set *, struct timeval *); - - -/***************************************************************************/ - -void xf86SoundKbdBell(loudness, pitch, duration) -int loudness; -int pitch; -int duration; -{ - DosBeep((ULONG)pitch, (ULONG)duration); -} - -void xf86SetKbdLeds(leds) -int leds; -{ - KBDINFO kinfo; - APIRET rc; - - rc = KbdGetStatus(&kinfo,(HKBD)xf86Info.consoleFd); - if (!rc) { - kinfo.fsMask = 0x10; - kinfo.fsState &= ~0x70; - kinfo.fsState |= (leds&0x70); - KbdSetStatus(&kinfo,(HKBD)xf86Info.consoleFd); - } -} - -int xf86GetKbdLeds() -{ - KBDINFO kinfo; - APIRET rc; - - rc = KbdGetStatus(&kinfo,(HKBD)xf86Info.consoleFd); - return rc ? 0 : kinfo.fsState & 0x70; -} - -void xf86SetKbdRepeat(char rad) -{ - int rc; - int delay = 250; /* Default delay */ - int rate = 30; /* Default repeat rate */ - - struct { - USHORT Delay; - USHORT Rate; - } rateDelay; - - ULONG rateDelaySize = sizeof(rateDelay); - - /*notyet*/ - return; - - if (xf86Info.kbdRate >= 0) - rate = xf86Info.kbdRate; - if (xf86Info.kbdDelay >= 0) - delay = xf86Info.kbdDelay; - - rateDelay.Delay = delay; - rateDelay.Rate = rate; - - xf86Msg(X_INFO,"Setting typematic rate: Delay=%d, Rate=%d\n",delay,rate); - - rc = DosDevIOCtl( (HFILE) xf86Info.consoleFd, - IOCTL_KEYBOARD, - KBD_SETTYPAMATICRATE, - &rateDelay, - rateDelaySize, - &rateDelaySize, - NULL, - 0, - NULL); - if (rc!=0) { - xf86Msg(X_ERROR,"xf86SetKbdRepeat: DosDevIOCtl returned %d\n",rc); - } -} - -void xf86KbdInit() -{ - /*none required*/ -} - - -USHORT OrigKbdState; -USHORT OrigKbdInterim; - -typedef struct { - USHORT state; - UCHAR makeCode; - UCHAR breakCode; - USHORT keyID; -} HOTKEYPARAM; - - -int xf86KbdOn() -{ - KBDINFO info; - APIRET rc; - int i,k; - ULONG len; - - - KbdGetStatus(&info,(HKBD)xf86Info.consoleFd); - OrigKbdState=info.fsMask; - OrigKbdInterim=info.fsInterim; - info.fsMask &= ~0x09; - info.fsMask |= 0x136; - info.fsInterim &= ~0x20; - KbdSetStatus(&info,(HKBD)xf86Info.consoleFd); - return -1; -} - -int xf86KbdOff() -{ - ULONG len; - APIRET rc; - KBDINFO info; - - info.fsMask=OrigKbdState; - info.fsInterim=OrigKbdInterim; - KbdSetStatus(&info,(HKBD)xf86Info.consoleFd); - return -1; -} - -#if 0 /*OBSOLETE*/ -void xf86MouseInit(mouse) -MouseDevPtr mouse; -{ - HMOU fd; - APIRET rc; - USHORT nbut; - - if (serverGeneration == 1) { - rc = MouOpen((PSZ)NULL,(PHMOU)&fd); - if (rc != 0) - FatalError("Cannot open mouse, rc=%d\n", rc); - mouse->mseFd = fd; - } - - /* flush mouse queue */ - MouFlushQue(fd); - - /* check buttons */ - rc = MouGetNumButtons(&nbut,fd); - if (rc == 0) - xf86Msg(X_INFO,"OsMouse has %d button(s).\n",nbut); -} -#endif - -#if 0 /*OBSOLETE*/ -int xf86MouseOn(mouse) -MouseDevPtr mouse; -{ -#if 0 - HMOU fd; - APIRET rc; - USHORT nbut; -#endif - xf86Msg (X_ERROR, - "Calling MouseOn, a bad thing.... Must be some bug in the code!\n"); - -#if 0 - if (serverGeneration == 1) { - rc = MouOpen((PSZ)NULL,(PHMOU)&fd); - if (rc != 0) - FatalError("Cannot open mouse, rc=%d\n", rc); - mouse->mseFd = fd; - } - - /* flush mouse queue */ - MouFlushQue(fd); - - /* check buttons */ - rc = MouGetNumButtons(&nbut,fd); - if (rc == 0) - xf86Msg(X_INFO,"OsMouse has %d button(s).\n",nbut); - - return (mouse->mseFd); -#endif -} -#endif - -#if 0 /*OBSOLETE*/ -/* This table is a bit irritating, because these mouse types are infact - * defined in the OS/2 kernel, but I want to force the user to put - * "OsMouse" in the config file, and not worry about the particular mouse - * type that is connected. - */ -Bool xf86SupportedMouseTypes[] = -{ - FALSE, /* Microsoft */ - FALSE, /* MouseSystems */ - FALSE, /* MMSeries */ - FALSE, /* Logitech */ - FALSE, /* BusMouse */ - FALSE, /* MouseMan */ - FALSE, /* PS/2 */ - FALSE, /* Hitachi Tablet */ -}; - -int xf86NumMouseTypes = sizeof(xf86SupportedMouseTypes) / - sizeof(xf86SupportedMouseTypes[0]); -#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_ioperm.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_ioperm.c deleted file mode 100644 index c03bb96af..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_ioperm.c +++ /dev/null @@ -1,140 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_ioperm.c,v 3.5 1997/08/26 10:01:38 hohndel Exp $ */ -/* - * Copyright 1993 by David Wexelblat - * Modified 1996 by Sebastien Marineau - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of David Wexelblat not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. David Wexelblat makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: os2_ioperm.c /main/4 1996/04/18 16:50:01 kaleb $ */ - - - -#define I_NEED_OS2_H -#define INCL_32 -#define INCL_DOS -#define INCL_DOSFILEMGR -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -/* - * To access I/O ports under OS/2, we use the xf86sup.sys driver. - * For the moment, we use a function which basically grants IO priviledge - * to the whole server. NOTE: Once the server is running, we should - * change this to use inline IO functions through the callgate returned by - * the fastio$ driver. - */ - -int ioEnabled=FALSE; -ULONG action; -char *ioDrvPath = "/dev/fastio$"; -USHORT callgate[3]={0,0,0}; - - -Bool xf86EnableIO() -{ - -HFILE hfd; - ULONG dlen; - APIRET rc; - - /* no need to call multiple times */ - if (ioEnabled) return TRUE; - - if (DosOpen((PSZ)ioDrvPath, (PHFILE)&hfd, (PULONG)&action, - (ULONG)0, FILE_SYSTEM, FILE_OPEN, - OPEN_SHARE_DENYNONE|OPEN_FLAGS_NOINHERIT|OPEN_ACCESS_READONLY, - (ULONG)0) != 0) { - xf86Msg(X_ERROR,"Error opening fastio$ driver...\n"); - xf86Msg(X_ERROR,"Please install xf86sup.sys in config.sys!\n"); - return FALSE; - } - callgate[0] = callgate[1] = 0; - -/* Get callgate from driver for fast io to ports and other stuff */ - - rc = DosDevIOCtl(hfd, (ULONG)0x76, (ULONG)0x64, - NULL, 0, NULL, - (ULONG*)&callgate[2], sizeof(USHORT), &dlen); - if (rc) { - xf86Msg(X_ERROR, - "EnableIOPorts failed, rc=%d, dlen=%d; emergency exit\n", - rc,dlen); - DosClose(hfd); - return FALSE; - } - -/* Calling callgate with function 13 sets IOPL for the program */ - - asm volatile ("movl $13,%%ebx;.byte 0xff,0x1d;.long _callgate" - : /*no outputs */ - : /*no inputs */ - : "eax","ebx","ecx","edx","cc"); - - ioEnabled = TRUE; - DosClose(hfd); - return TRUE; -} - -void xf86DisableIO() -{ -HFILE hfd; - ULONG dlen; - APIRET rc; - - /* no need to call multiple times */ - if (!ioEnabled) return; - - if (DosOpen((PSZ)ioDrvPath, (PHFILE)&hfd, (PULONG)&action, - (ULONG)0, FILE_SYSTEM, FILE_OPEN, - OPEN_SHARE_DENYNONE|OPEN_FLAGS_NOINHERIT|OPEN_ACCESS_READONLY, - (ULONG)0) != 0) { - xf86Msg(X_ERROR,"Error opening fastio$ driver...\n"); - xf86Msg(X_ERROR,"Please install xf86sup.sys in config.sys!\n"); - return; - } - callgate[0] = callgate[1] = 0; - - rc = DosDevIOCtl(hfd, (ULONG)0x76, (ULONG)0x64, - NULL, 0, NULL, - (ULONG*)&callgate[2], sizeof(USHORT), &dlen); - if (rc) { - xf86Msg(X_ERROR,"DisableIOPorts failed, rc=%d, dlen=%d\n", - rc,dlen); - DosClose(hfd); - return; - } - -/* Function 14 of callgate brings program back to ring 3 */ - - asm volatile ("movl $14,%%ebx;.byte 0xff,0x1d;.long _callgate" - : /*no outputs */ - : /*no inputs */ - : "eax","ebx","ecx","edx","cc"); - ioEnabled=FALSE; - DosClose(hfd); - return; - -} - diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_kbd.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_kbd.c deleted file mode 100644 index f99f12c0f..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_kbd.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copied from os2_io.c which is - * - * (c) Copyright 1994,1999 by Holger Veit - * - * Modified 1996 by Sebastien Marineau - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * HOLGER VEIT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Holger Veit shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Holger Veit. - * - */ -/* $XFree86$ */ - -#define I_NEED_OS2_H -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "compiler.h" -#include - -#define INCL_DOSPROCESS -#define INCL_KBD -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86Xinput.h" -#include "xf86OSKbd.h" - - - -/***************************************************************************/ - -static void SoundKbdBell(loudness, pitch, duration) -int loudness; -int pitch; -int duration; -{ - DosBeep((ULONG)pitch, (ULONG)duration); -} - -static void SetKbdLeds(pInfo, leds) -InputInfoPtr pInfo; -int leds; -{ - KBDINFO kinfo; - APIRET rc; - - rc = KbdGetStatus(&kinfo,(HKBD)xf86Info.consoleFd); - if (!rc) { - kinfo.fsMask = 0x10; - kinfo.fsState &= ~0x70; - kinfo.fsState |= (leds&0x70); - KbdSetStatus(&kinfo,(HKBD)xf86Info.consoleFd); - } -} - -static int GetKbdLeds(pInfo) -InputInfoPtr pInfo; -{ - KBDINFO kinfo; - APIRET rc; - - rc = KbdGetStatus(&kinfo,(HKBD)xf86Info.consoleFd); - return rc ? 0 : kinfo.fsState & 0x70; -} - -static void SetKbdRepeat(pInfo, rad) -InputInfoPtr pInfo; -char rad; -{ - /*notyet*/ -} - -static void KbdInit(pInfo) -InputInfoPtr pInfo; -{ - /*none required*/ - xf86Msg(X_INFO,"XKB module: Keyboard initialized\n"); -} - - -static USHORT OrigKbdState; -static USHORT OrigKbdInterim; - -typedef struct { - USHORT state; - UCHAR makeCode; - UCHAR breakCode; - USHORT keyID; -} HOTKEYPARAM; - - -static int KbdOn(pInfo) -InputInfoPtr pInfo; -{ - KBDINFO info; - - KbdGetStatus(&info,(HKBD)xf86Info.consoleFd); - OrigKbdState=info.fsMask; - OrigKbdInterim=info.fsInterim; - info.fsMask &= ~0x09; - info.fsMask |= 0x136; - info.fsInterim &= ~0x20; - KbdSetStatus(&info,(HKBD)xf86Info.consoleFd); - return -1; -} - -static int KbdOff(pInfo) -InputInfoPtr pInfo; -{ - KBDINFO info; - - info.fsMask=OrigKbdState; - info.fsInterim=OrigKbdInterim; - KbdSetStatus(&info,(HKBD)xf86Info.consoleFd); - return -1; -} - -Bool -xf86OSKbdPreInit(InputInfoPtr pInfo) -{ - KbdDevPtr pKbd = pInfo->private; - - pKbd->KbdInit = KbdInit; - pKbd->KbdOn = KbdOn; - pKbd->KbdOff = KbdOff; - pKbd->Bell = SoundKbdBell; - pKbd->SetLeds = SetKbdLeds; - pKbd->GetLeds = GetKbdLeds; - pKbd->SetKbdRepeat = SetKbdRepeat; - - pKbd->vtSwitchSupported = FALSE; - - /* not yet */ - return FALSE; -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_kbdEv.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_kbdEv.c deleted file mode 100644 index 861fbf089..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_kbdEv.c +++ /dev/null @@ -1,511 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_kbdEv.c,v 3.16 2002/05/31 18:46:01 dawes Exp $ */ -/* - * (c) Copyright 1994,1996,1999 by Holger Veit - * - * Modified 1996 Sebastien Marineau - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * HOLGER VEIT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Holger Veit shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Holger Veit. - * - */ -/* $XConsortium: os2_kbdEv.c /main/10 1996/10/27 11:48:48 kaleb $ */ - -#define I_NEED_OS2_H -#define NEED_EVENTS -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "misc.h" -#include "inputstr.h" -#include "scrnintstr.h" - -#define INCL_KBD -#define INCL_DOSMONITORS -#define INCL_WINSWITCHLIST -#define INCL_DOSQUEUES -#undef RT_FONT /* must discard this */ -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "atKeynames.h" - -/* Attention! these lines copied from ../../common/xf86Events.c */ -#define XE_POINTER 1 -#define XE_KEYBOARD 2 - -#ifdef XKB -extern Bool noXkbExtension; -#endif - -#ifdef XTESTEXT1 - -#define XTestSERVER_SIDE -#include -extern short xtest_mousex; -extern short xtest_mousey; -extern int on_steal_input; -extern Bool XTestStealKeyData(); -extern void XTestStealMotionData(); - -#ifdef XINPUT -#define ENQUEUE(ev, code, direction, dev_type) \ - (ev)->u.u.detail = (code); \ - (ev)->u.u.type = (direction); \ - if (!on_steal_input || \ - XTestStealKeyData((ev)->u.u.detail, (ev)->u.u.type, dev_type, \ - xtest_mousex, xtest_mousey)) \ - xf86eqEnqueue((ev)) -#else -#define ENQUEUE(ev, code, direction, dev_type) \ - (ev)->u.u.detail = (code); \ - (ev)->u.u.type = (direction); \ - if (!on_steal_input || \ - XTestStealKeyData((ev)->u.u.detail, (ev)->u.u.type, dev_type, \ - xtest_mousex, xtest_mousey)) \ - mieqEnqueue((ev)) -#endif - -#define MOVEPOINTER(dx, dy, time) \ - if (on_steal_input) \ - XTestStealMotionData(dx, dy, XE_POINTER, xtest_mousex, xtest_mousey); \ - miPointerDeltaCursor (dx, dy, time) - -#else /* ! XTESTEXT1 */ - -#ifdef XINPUT -#define ENQUEUE(ev, code, direction, dev_type) \ - (ev)->u.u.detail = (code); \ - (ev)->u.u.type = (direction); \ - xf86eqEnqueue((ev)) -#else -#define ENQUEUE(ev, code, direction, dev_type) \ - (ev)->u.u.detail = (code); \ - (ev)->u.u.type = (direction); \ - mieqEnqueue((ev)) -#endif -#define MOVEPOINTER(dx, dy, time) \ - miPointerDeltaCursor (dx, dy, time) - -#endif -/* end of include */ - -HQUEUE hKbdQueue; -HEV hKbdSem; -int last_status; -int lastStatus; -int lastShiftState; -extern BOOL SwitchedToWPS; - -void os2PostKbdEvent(); - -int os2KbdQueueQuery() -{ - ULONG numElements,postCount; - - (void)DosQueryQueue(hKbdQueue,&numElements); - if (numElements!=0) return 0; /* We have something in queue */ - - DosResetEventSem(hKbdSem,&postCount); - return 1; -} - - -void xf86KbdEvents() -{ - KBDKEYINFO keybuf; - ULONG numElements; - REQUESTDATA requestData; - ULONG dataLength, postCount; - PVOID dummy; - BYTE elemPriority; - int scan, down; - static int last; - USHORT ModState; - int i; - - while(DosReadQueue(hKbdQueue, - &requestData,&dataLength,&dummy, - 0L,1L,&elemPriority,hKbdSem) == 0) { - - /* xf86Msg(X_INFO, - "Got queue element. data=%d, scancode =%d,up=%d, ddflag %d\n", - requestData.ulData, - (requestData.ulData&0x7F00)>>8, - requestData.ulData&0x8000, - requestData.ulData>>16);*/ - - scan=(requestData.ulData&0x7F00)>>8; - - /* the separate cursor keys return 0xe0/scan */ - if ((requestData.ulData & 0x3F0000)==0x20000) scan=0; - if (requestData.ulData & 0x800000) { - switch (scan) { - -/* BUG ALERT: IBM has in its keyboard driver a 122 key keyboard, which - * uses the "server generated scancodes" from atKeynames.h as real scan codes. - * We wait until some poor guy with such a keyboard will break the whole - * card house though... - */ - case KEY_KP_7: scan = KEY_Home; break; - case KEY_KP_8: scan = KEY_Up; break; - case KEY_KP_9: scan = KEY_PgUp; break; - case KEY_KP_4: scan = KEY_Left; break; - case KEY_KP_5: scan = KEY_Begin; break; - case KEY_KP_6: scan = KEY_Right; break; - case KEY_KP_1: scan = KEY_End; break; - case KEY_KP_2: scan = KEY_Down; break; - case KEY_KP_3: scan = KEY_PgDown; break; - case KEY_KP_0: scan = KEY_Insert; break; - case KEY_KP_Decimal: scan = KEY_Delete; break; - case KEY_Enter: scan = KEY_KP_Enter; break; - case KEY_LCtrl: scan = KEY_RCtrl; break; - case KEY_KP_Multiply: scan = KEY_Print; break; - case KEY_Slash: scan = KEY_KP_Divide; break; - case KEY_Alt: scan = KEY_AltLang; break; - case KEY_ScrollLock: scan = KEY_Break; break; - case 0x5b: scan = KEY_LMeta; break; - case 0x5c: scan = KEY_RMeta; break; - case 0x5d: scan = KEY_Menu; break; - default: - /* virtual shifts: ignore */ - scan = 0; break; - } - } - - down = (requestData.ulData&0x8000) ? FALSE : TRUE; - if (scan!=0) os2PostKbdEvent(scan, down); - } - (void)DosResetEventSem(hKbdSem,&postCount); -} - -/* - * xf86PostKbdEvent -- - * Translate the raw hardware KbdEvent into an XEvent, and tell DIX - * about it. Scancode preprocessing and so on is done ... - * - * OS/2 specific xf86PostKbdEvent(key) has been moved from common/xf86Events.c - * as some things differ, and I didn't want to scatter this routine with - * ifdefs further (hv). - */ - -void os2PostKbdEvent(unsigned scanCode, Bool down) -{ - KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key; - Bool updateLeds = FALSE; - Bool UsePrefix = FALSE; - Bool Direction = FALSE; - xEvent kevent; - KeySym *keysym; - int keycode; - static int lockkeys = 0; - - /* - * and now get some special keysequences - */ - if ((ModifierDown(ControlMask | AltMask)) || - (ModifierDown(ControlMask | AltLangMask))) { - switch (scanCode) { - case KEY_BackSpace: - if (!xf86Info.dontZap) GiveUp(0); - return; - case KEY_KP_Minus: /* Keypad - */ - if (!xf86Info.dontZoom) { - if (down) - xf86ZoomViewport(xf86Info.currentScreen, -1); - return; - } - break; - case KEY_KP_Plus: /* Keypad + */ - if (!xf86Info.dontZoom) { - if (down) - xf86ZoomViewport(xf86Info.currentScreen, 1); - return; - } - break; - } - } - - /* CTRL-ESC is std OS/2 hotkey for going back to PM and popping up - * window list... handled by keyboard driverand PM if you tell it. This is - * what we have done, and thus should never detect this key combo */ - if (ModifierDown(ControlMask) && scanCode==KEY_Escape) { - /* eat it */ - return; - } else if (ModifierDown(AltLangMask|AltMask) && scanCode==KEY_Escape) { - /* same here */ - return; - } - - /* - * Now map the scancodes to real X-keycodes ... - */ - keycode = scanCode + MIN_KEYCODE; - keysym = (keyc->curKeySyms.map + - keyc->curKeySyms.mapWidth * - (keycode - keyc->curKeySyms.minKeyCode)); -#ifdef XKB - if (noXkbExtension) { -#endif - /* Filter autorepeated caps/num/scroll lock keycodes. */ - -#define CAPSFLAG 0x01 -#define NUMFLAG 0x02 -#define SCROLLFLAG 0x04 -#define MODEFLAG 0x08 - if (down) { - switch (keysym[0]) { - case XK_Caps_Lock: - if (lockkeys & CAPSFLAG) - return; - else - lockkeys |= CAPSFLAG; - break; - case XK_Num_Lock: - if (lockkeys & NUMFLAG) - return; - else - lockkeys |= NUMFLAG; - break; - case XK_Scroll_Lock: - if (lockkeys & SCROLLFLAG) - return; - else - lockkeys |= SCROLLFLAG; - break; - } - - if (keysym[1] == XF86XK_ModeLock) { - if (lockkeys & MODEFLAG) - return; - else - lockkeys |= MODEFLAG; - } - } else { - switch (keysym[0]) { - case XK_Caps_Lock: - lockkeys &= ~CAPSFLAG; - break; - case XK_Num_Lock: - lockkeys &= ~NUMFLAG; - break; - case XK_Scroll_Lock: - lockkeys &= ~SCROLLFLAG; - break; - } - - if (keysym[1] == XF86XK_ModeLock) - lockkeys &= ~MODEFLAG; - } - - /* - * LockKey special handling: - * ignore releases, toggle on & off on presses. - * Don't deal with the Caps_Lock keysym directly, - * but check the lock modifier - */ -#ifndef PC98 - if (keyc->modifierMap[keycode] & LockMask || - keysym[0] == XK_Scroll_Lock || - keysym[1] == XF86XK_ModeLock || - keysym[0] == XK_Num_Lock) { - Bool flag; - - if (!down) return; - flag = !KeyPressed(keycode); - if (!flag) down = !down; - - if (keyc->modifierMap[keycode] & LockMask) - xf86Info.capsLock = flag; - if (keysym[0] == XK_Num_Lock) - xf86Info.numLock = flag; - if (keysym[0] == XK_Scroll_Lock) - xf86Info.scrollLock = flag; - if (keysym[1] == XF86XK_ModeLock) - xf86Info.modeSwitchLock = flag; - updateLeds = TRUE; - } -#endif /* not PC98 */ - - /* normal, non-keypad keys */ - if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) { - /* magic ALT_L key on AT84 keyboards for multilingual support */ - if (xf86Info.kbdType == KB_84 && - ModifierDown(AltMask) && - keysym[2] != NoSymbol) { - UsePrefix = TRUE; - Direction = TRUE; - } - } - -#ifdef XKB /* Warning: got position wrong first time */ - } -#endif - - /* check for an autorepeat-event */ - if ((down && KeyPressed(keycode)) && - (xf86Info.autoRepeat != AutoRepeatModeOn || keyc->modifierMap[keycode])) - return; - - xf86Info.lastEventTime = - kevent.u.keyButtonPointer.time = - GetTimeInMillis(); - - /* - * And now send these prefixes ... - * NOTE: There cannot be multiple Mode_Switch keys !!!! - */ - if (UsePrefix) { - ENQUEUE(&kevent, - keyc->modifierKeyMap[keyc->maxKeysPerModifier*7], - Direction ? KeyPress : KeyRelease, - XE_KEYBOARD); - ENQUEUE(&kevent, - keycode, - down ? KeyPress : KeyRelease, - XE_KEYBOARD); - ENQUEUE(&kevent, - keyc->modifierKeyMap[keyc->maxKeysPerModifier*7], - Direction ? KeyRelease : KeyPress, - XE_KEYBOARD); - } else { -#ifdef XFreeDGA - if (((ScrnInfoPtr)(xf86Info.currentScreen->devPrivates[xf86ScreenIndex].ptr))->directMode&XF86DGADirectKeyb) { - XF86DirectVideoKeyEvent(&kevent, - keycode, - down ? KeyPress : KeyRelease); - } else -#endif - { - ENQUEUE(&kevent, - keycode, - down ? KeyPress : KeyRelease, - XE_KEYBOARD); - } - } - - if (updateLeds) xf86KbdLeds(); -} - -#pragma pack(1) -struct KeyPacket { - unsigned short mnflags; - KBDKEYINFO cp; - unsigned short ddflags; -}; -#pragma pack() - -/* The next function runs as a thread. It registers a monitor on the kbd - * driver, and uses that to get keystrokes. This is because the standard - * OS/2 keyboard driver does not send keyboard release events. A queue - * is used to communicate with the main thread to send keystrokes */ - -void os2KbdMonitorThread(void* arg) -{ - struct KeyPacket packet; - APIRET rc; - USHORT length,print_flag; - ULONG queueParam; - HMONITOR hKbdMonitor; - MONIN monInbuf; - MONOUT monOutbuf; - char queueName[128]; - -#if 0 - monInbuf=(MONIN *)_tmalloc(2*sizeof(MONIN)); - if (monInbuf==NULL) { - xf86Msg(X_ERROR, - "Could not allocate memory in kbd monitor thread!\n"); - exit(1); - } - monOutbuf=(MONOUT *) &monInbuf[1]; -#endif - - monInbuf.cb=sizeof(MONIN); - monOutbuf.cb=sizeof(MONOUT); - - rc = DosMonOpen("KBD$",&hKbdMonitor); - xf86Msg(X_INFO,"Opened kbd monitor, rc=%d\n",rc); - rc = DosMonReg(hKbdMonitor, - (PBYTE)&monInbuf,(PBYTE)&monOutbuf,(USHORT)2,(USHORT)-1); - xf86Msg(X_INFO,"Kbd monitor registered, rc=%d\n",rc); - if (rc) { - DosMonClose(hKbdMonitor); - exit(1); - } - - /* create a queue */ - sprintf(queueName,"\\QUEUES\\XF86KBD\\%d",getpid()); - rc = DosCreateQueue(&hKbdQueue,0L,queueName); - xf86Msg(X_INFO,"Kbd Queue created, rc=%d\n",rc); - (void)DosPurgeQueue(hKbdQueue); - - while (1) { - length = sizeof(packet); - rc = DosMonRead((PBYTE)&monInbuf,0,(PBYTE)&packet,&length); - if (rc) { - xf86Msg(X_ERROR, - "DosMonRead returned bad RC! rc=%d\n",rc); - DosMonClose(hKbdMonitor); - exit(1); - } - queueParam = packet.mnflags+(packet.ddflags<<16); - if (packet.mnflags&0x7F00) - DosWriteQueue(hKbdQueue,queueParam,0L,NULL,0L); - /*xf86Msg(X_INFO,"Wrote a char to queue, rc=%d\n",rc); */ - print_flag = packet.ddflags & 0x1F; - - /*xf86Msg(X_INFO,"Kbd Monitor: Key press %d, scan code %d, ddflags %d\n", - packet.mnflags&0x8000,(packet.mnflags&0x7F00)>>8,packet.ddflags); - */ - - /* This line will swallow print-screen keypresses */ - if (print_flag == 0x13 || print_flag == 0x14 || - print_flag == 0x15 || print_flag == 0x16) - rc = 0; - else - rc = DosMonWrite((PBYTE)&monOutbuf,(PBYTE)&packet,length); - if (rc) { - xf86Msg(X_ERROR, - "DosMonWrite returned bad RC! rc=%d\n",rc); - DosMonClose(hKbdMonitor); - exit(1); - } - } - - DosCloseQueue(hKbdQueue); - DosMonClose(hKbdMonitor); -} - -void os2KbdBitBucketThread(void* arg) -{ - KBDKEYINFO key; - while (1) { - if (xf86Info.consoleFd != -1) { - KbdCharIn(&key,1,xf86Info.consoleFd); - usleep(100000); - } else - usleep(500000); - } -} diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_mouse.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_mouse.c deleted file mode 100644 index e1fd52c2e..000000000 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/os2/os2_mouse.c +++ /dev/null @@ -1,653 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_mouse.c,v 3.17 2002/05/31 18:46:02 dawes Exp $ */ -/* - * (c) Copyright 1994,1999,2000 by Holger Veit - * - * Modified (c) 1996 Sebastien Marineau - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * HOLGER VEIT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Holger Veit shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Holger Veit. - * - */ -/* $XConsortium: os2_mouse.c /main/10 1996/10/27 11:48:51 kaleb $ */ - -#define I_NEED_OS2_H -#define NEED_EVENTS -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "misc.h" -#include "inputstr.h" -#include "scrnintstr.h" - -#include "compiler.h" - -#define INCL_DOSFILEMGR -#define INCL_DOSQUEUES -#define INCL_MOU -#undef RT_FONT -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86Config.h" - -#include "xf86Xinput.h" -#include "xf86OSmouse.h" -#include "mipointer.h" - -/* The following support code was copied from mouse.c */ - -/********************************************************************** - * - * Emulate3Button support code - * - **********************************************************************/ - - -/* - * Lets create a simple finite-state machine for 3 button emulation: - * - * We track buttons 1 and 3 (left and right). There are 11 states: - * 0 ground - initial state - * 1 delayed left - left pressed, waiting for right - * 2 delayed right - right pressed, waiting for left - * 3 pressed middle - right and left pressed, emulated middle sent - * 4 pressed left - left pressed and sent - * 5 pressed right - right pressed and sent - * 6 released left - left released after emulated middle - * 7 released right - right released after emulated middle - * 8 repressed left - left pressed after released left - * 9 repressed right - right pressed after released right - * 10 pressed both - both pressed, not emulating middle - * - * At each state, we need handlers for the following events - * 0: no buttons down - * 1: left button down - * 2: right button down - * 3: both buttons down - * 4: emulate3Timeout passed without a button change - * Note that button events are not deltas, they are the set of buttons being - * pressed now. It's possible (ie, mouse hardware does it) to go from (eg) - * left down to right down without anything in between, so all cases must be - * handled. - * - * a handler consists of three values: - * 0: action1 - * 1: action2 - * 2: new emulation state - * - * action > 0: ButtonPress - * action = 0: nothing - * action < 0: ButtonRelease - * - * The comment preceeding each section is the current emulation state. - * The comments to the right are of the form - *