Index: xfree/xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c =================================================================== RCS file: /cvsroot/xsrc/xfree/xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c,v retrieving revision 1.1.1.4 diff -u -r1.1.1.4 xf86Kbd.c --- xfree/xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c 2002/01/19 15:06:53 1.1.1.4 +++ xfree/xc/programs/Xserver/hw/xfree86/common/xf86Kbd.c 2002/01/28 16:32:25 @@ -41,14 +41,15 @@ #if defined(KDGKBTYPE) && \ !defined(Lynx) && \ !defined(__EMX__) && !defined(__mips__) && \ - !defined(__arm32__) && !defined(__GNU__) && !defined(__QNX__) + !defined(__arm32__) && !defined(__GNU__) && !defined(__QNX__) && \ + !defined(CSRG_BASED) #define HAS_GETKBTYPE #endif #if defined(GIO_KEYMAP) && \ !defined(Lynx) && \ !defined(__EMX__) && !defined(__mips__) && \ !defined(__arm32__) && !defined(__GNU__) && !defined(DGUX) && \ - !defined(__QNX__) + !defined(__QNX__) && !defined(CSRG_BASED) #define HAS_GETKEYMAP #define KD_GET_ENTRY(i,n) \ Index: xfree/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h =================================================================== RCS file: /cvsroot/xsrc/xfree/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v retrieving revision 1.1.1.4 diff -u -r1.1.1.4 r128.h --- xfree/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h 2002/01/19 15:08:56 1.1.1.4 +++ xfree/xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h 2002/01/28 16:32:26 @@ -63,7 +63,7 @@ #define R128_DEBUG 0 /* Turn off debugging output */ #define R128_TIMEOUT 2000000 /* Fall out of wait loops after this count */ -#define R128_MMIOSIZE 0x80000 +#define R128_MMIOSIZE 0x4000 #define R128_VBIOS_SIZE 0x00010000 Index: xfree/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c =================================================================== RCS file: /cvsroot/xsrc/xfree/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v retrieving revision 1.1.1.4 diff -u -r1.1.1.4 r128_driver.c --- xfree/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c 2002/01/19 15:09:00 1.1.1.4 +++ xfree/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c 2002/01/28 16:32:32 @@ -1614,7 +1614,7 @@ static Bool R128PreInitInt10(ScrnInfoPtr pScrn, xf86Int10InfoPtr *ppInt10) { R128InfoPtr info = R128PTR(pScrn); -#if 1 && !defined(__alpha__) +#if 1 && !defined(__alpha__) && !defined(__powerpc__) /* int10 is broken on some Alphas */ if (xf86LoadSubModule(pScrn, "int10")) { xf86LoaderReqSymLists(int10Symbols, NULL); Index: xfree/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h =================================================================== RCS file: /cvsroot/xsrc/xfree/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v retrieving revision 1.1.1.4 diff -u -r1.1.1.4 xf86_OSlib.h --- xfree/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h 2002/01/19 15:11:57 1.1.1.4 +++ xfree/xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h 2002/01/28 16:32:33 @@ -544,6 +544,7 @@ # if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT) # define USE_VT_SYSREQ +# include # endif #endif /* CSRG_BASED */ Index: xfree/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c =================================================================== RCS file: /cvsroot/xsrc/xfree/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c,v retrieving revision 1.8 diff -u -r1.8 bsd_video.c --- xfree/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c 2002/01/19 23:19:35 1.8 +++ xfree/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c 2002/01/28 16:32:35 @@ -732,12 +732,13 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, int Len) { +#if 0 int rv; int kmem; - kmem = open("/dev/kmem", 2); + kmem = open("/dev/mem", 2); if (kmem == -1) { - FatalError("xf86ReadBIOS: open /dev/kmem\n"); + FatalError("xf86ReadBIOS: open /dev/mem\n"); } #ifdef DEBUG @@ -755,6 +756,9 @@ close(kmem); return rv; +#else + return -1; +#endif } Index: xfree/xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile =================================================================== RCS file: /cvsroot/xsrc/xfree/xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile,v retrieving revision 1.5 diff -u -r1.5 Imakefile --- xfree/xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile 2002/01/19 23:19:35 1.5 +++ xfree/xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile 2002/01/28 16:32:35 @@ -47,6 +47,13 @@ PCIDRVRSRC = freebsdPci.c PCIDRVROBJ = freebsdPci.o +#elif defined(NetBSDArchitecture) && defined(PpcArchitecture) + +XCOMM NetBSD/powerpc + +PCIDRVRSRC = macppcPci.c +PCIDRVROBJ = macppcPci.o + #elif defined(PpcArchitecture) XCOMM PowerPC PCI drivers =================================================================== --- /dev/null Mon Jan 28 17:31:43 2002 +++ xfree/xc/programs/Xserver/hw/xfree86/os-support/bus/macppcPci.c Sun Jan 27 19:07:33 2002 @@ -0,0 +1,384 @@ +#include +#include +#include +#include +#include + +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86OSpriv.h" + +#include "Pci.h" + +#undef PCHB_DEBUG +#define UNINORTH + +#ifdef PCHB_DEBUG +# define DPRINTF ErrorF +#else +# define DPRINTF while (0) ErrorF +#endif + +CARD32 banditPciConfRead(PCITAG, int); +void banditPciConfWrite(PCITAG, int, CARD32); +CARD32 gracklePciConfRead(PCITAG, int); +void gracklePciConfWrite(PCITAG, int, CARD32); +CARD32 uninorthPciConfRead(PCITAG, int); +void uninorthPciConfWrite(PCITAG, int, CARD32); + +void macppcPciSetBits(PCITAG, int, CARD32, CARD32); + +int open(const char *, int); /* XXX */ + +static int kmem = -1; + +pciBusInfo_t macppcPci0 = { +/* configMech */ PCI_CFG_MECH_OTHER, +/* numDevices */ 32, +/* secondary */ FALSE, +/* primary_bus */ 0, +/* ppc_io_base */ 0, /* XXX */ +/* ppc_io_size */ 0, /* XXX */ +/* funcs */ { + pciReadLongNULL, + pciWriteLongNULL, + macppcPciSetBits, + pciAddrNOOP, + pciAddrNOOP + }, +/* pciBusPriv */ NULL +}; + +void +ppcPciInit() +{ + pciNumBuses = 1; + pciBusInfo[0] = &macppcPci0; + pciFindFirstFP = pciGenFindFirst; + pciFindNextFP = pciGenFindNext; + + kmem = open("/dev/mem", 2); + if (kmem == -1) + FatalError("ppcPciInit: /dev/mem\n"); + +#if 0 + if (xf86Info.pcitype == NULL) { + ErrorF("Option \"PCI type\" is not set\n"); + FatalError("Please set PCI type in your XF86Config"); + } else if (strcasecmp(xf86Info.pcitype, "bandit") == 0) { + pciBusInfo[0]->funcs.pciReadLong = banditPciConfRead; + pciBusInfo[0]->funcs.pciWriteLong = banditPciConfWrite; + } else if (strcasecmp(xf86Info.pcitype, "grackle") == 0) { + pciBusInfo[0]->funcs.pciReadLong = gracklePciConfRead; + pciBusInfo[0]->funcs.pciWriteLong = gracklePciConfWrite; + } else if (strcasecmp(xf86Info.pcitype, "uninorth") == 0) { +#endif + pciBusInfo[0]->funcs.pciReadLong = uninorthPciConfRead; + pciBusInfo[0]->funcs.pciWriteLong = uninorthPciConfWrite; +#if 0 + } else { + FatalError("Invalid PCI type \"%s\"\n", xf86Info.pcitype); + } + + xf86Msg(X_CONFIG, "PCI-HOST bridge is %s\n", xf86Info.pcitype); +#endif +} + +#define BANDIT_BASE 0xf2000000 +#define BANDIT_ADDR (BANDIT_BASE + 0x800000) +#define BANDIT_DATA (BANDIT_BASE + 0xc00000) + +#define GRACKLE_ADDR 0xfec00000 +#define GRACKLE_DATA 0xfee00000 + +#define UNINORTH_BASE 0xf0000000 +#define UNINORTH_ADDR (UNINORTH_BASE + 0x800000) +#define UNINORTH_DATA (UNINORTH_BASE + 0xc00000) + +CARD32 +banditPciConfRead(PCITAG tag, int reg) +{ + CARD32 val = 0xffffffff; + u_int bus, dev, func; + u_int x; + + bus = PCI_BUS_FROM_TAG(tag); + dev = PCI_DEV_FROM_TAG(tag); + func = PCI_FUNC_FROM_TAG(tag); + + if (bus > 0) + return val; /* XXX for now */ + if (dev < 11) + return val; + + DPRINTF("pciConfRead: PCI(%d:%d:%d)[0x%02x]", bus, dev, func, reg); + + if (dev > 31 || func > 7 || reg < 0 || reg > 255 || (reg & 3) != 0) + FatalError("pciConfRead: Illegal range\n"); + + x = bswap32((1 << dev) | (func << 8) | reg); + lseek(kmem, BANDIT_ADDR, 0); /* addr port */ + write(kmem, &x, 4); + lseek(kmem, BANDIT_ADDR, 0); + read(kmem, &x, 4); /* XXX dummy read */ + + lseek(kmem, BANDIT_DATA, 0); /* data port */ + read(kmem, &x, 4); + val = bswap32(x); + + x = 0; + lseek(kmem, BANDIT_ADDR, 0); + write(kmem, &x, 4); + lseek(kmem, BANDIT_ADDR, 0); + read(kmem, &x, 4); + + DPRINTF("--> 0x%lx\n", val); + return val; +} + +void +banditPciConfWrite(PCITAG tag, int reg, CARD32 val) +{ + u_int bus, dev, func; + u_int x; + + bus = PCI_BUS_FROM_TAG(tag); + dev = PCI_DEV_FROM_TAG(tag); + func = PCI_FUNC_FROM_TAG(tag); + + DPRINTF("pciConfWrite: PCI(%d:%d:%d)[0x%02x] = 0x%x\n", + bus, dev, func, reg, val); + + if (bus > 0 || dev < 11 || + dev > 31 || func > 7 || reg < 0 || reg > 255 || (reg & 3) != 0) + FatalError("pciConfWrite: Illegal range\n"); + + /* XXX Don't disable mem_enable */ + if (reg == 4) + val |= PCI_CMD_MEM_ENABLE; + + x = bswap32((1 << dev) | (func << 8) | reg); + lseek(kmem, BANDIT_ADDR, 0); /* addr port */ + write(kmem, &x, 4); + lseek(kmem, BANDIT_ADDR, 0); + read(kmem, &x, 4); /* dummy read */ + + x = bswap32(val); + lseek(kmem, BANDIT_DATA, 0); /* data port */ + write(kmem, &x, 4); + + x = 0; + lseek(kmem, BANDIT_ADDR, 0); + write(kmem, &x, 4); + lseek(kmem, BANDIT_ADDR, 0); + read(kmem, &x, 4); +} + +CARD32 +uninorthPciConfRead(PCITAG tag, int reg) +{ + CARD32 val = 0xffffffff; + u_int bus, dev, func; + u_int x; + paddr_t daddr = (reg & 0x04) == 0 ? UNINORTH_DATA : UNINORTH_DATA + 4; + + bus = PCI_BUS_FROM_TAG(tag); + dev = PCI_DEV_FROM_TAG(tag); + func = PCI_FUNC_FROM_TAG(tag); + + if (bus > 0) + return val; /* XXX for now */ + if (dev < 11) + return val; + + DPRINTF("pciConfRead: PCI(%d:%d:%d)[0x%02x]", bus, dev, func, reg); + + if (dev > 31 || func > 7 || reg < 0 || reg > 255 || (reg & 3) != 0) + FatalError("pciConfRead: Illegal range\n"); + + x = bswap32((1 << dev) | (func << 8) | reg); + lseek(kmem, UNINORTH_ADDR, 0); /* addr port */ + write(kmem, &x, 4); + lseek(kmem, UNINORTH_ADDR, 0); + read(kmem, &x, 4); /* XXX dummy read */ + + lseek(kmem, daddr, 0); /* data port */ + read(kmem, &x, 4); + val = bswap32(x); + + x = 0; + lseek(kmem, UNINORTH_ADDR, 0); + write(kmem, &x, 4); + lseek(kmem, UNINORTH_ADDR, 0); + read(kmem, &x, 4); + + DPRINTF("--> 0x%lx\n", val); + return val; +} + +void +uninorthPciConfWrite(PCITAG tag, int reg, CARD32 val) +{ + u_int bus, dev, func; + u_int x; + paddr_t daddr = (reg & 0x04) == 0 ? UNINORTH_DATA : UNINORTH_DATA + 4; + + bus = PCI_BUS_FROM_TAG(tag); + dev = PCI_DEV_FROM_TAG(tag); + func = PCI_FUNC_FROM_TAG(tag); + + DPRINTF("pciConfWrite: PCI(%d:%d:%d)[0x%02x] = 0x%x\n", + bus, dev, func, reg, val); + + if (bus > 0 || dev < 11 || + dev > 31 || func > 7 || reg < 0 || reg > 255 || (reg & 3) != 0) + FatalError("pciConfWrite: Illegal range\n"); + + /* XXX Don't disable mem_enable */ + if (reg == 4) + val |= PCI_CMD_MEM_ENABLE; + + x = bswap32((1 << dev) | (func << 8) | reg); + lseek(kmem, UNINORTH_ADDR, 0); /* addr port */ + write(kmem, &x, 4); + lseek(kmem, UNINORTH_ADDR, 0); + read(kmem, &x, 4); /* dummy read */ + + x = bswap32(val); + lseek(kmem, daddr, 0); /* data port */ + write(kmem, &x, 4); + + x = 0; + lseek(kmem, UNINORTH_ADDR, 0); + write(kmem, &x, 4); + lseek(kmem, UNINORTH_ADDR, 0); + read(kmem, &x, 4); +} + +CARD32 +gracklePciConfRead(PCITAG tag, int reg) +{ + CARD32 val = 0xffffffff; + u_int bus, dev, func; + u_int x; + + bus = PCI_BUS_FROM_TAG(tag); + dev = PCI_DEV_FROM_TAG(tag); + func = PCI_FUNC_FROM_TAG(tag); + + if (bus > 0) + return val; /* XXX for now */ + + DPRINTF("pciConfRead: PCI(%d:%d:%d)[0x%02x]", bus, dev, func, reg); + + if (dev > 31 || func > 7 || reg < 0 || reg > 255 || (reg & 3) != 0) + FatalError("pciConfRead: Illegal range\n"); + + x = bswap32(0x80000000 | (bus << 16) | (dev << 11) | (func << 8) | reg); + lseek(kmem, GRACKLE_ADDR, 0); /* addr port */ + write(kmem, &x, 4); + lseek(kmem, GRACKLE_ADDR, 0); + read(kmem, &x, 4); /* XXX dummy read */ + + lseek(kmem, GRACKLE_DATA, 0); + read(kmem, &x, 4); + val = bswap32(x); + + x = 0; + lseek(kmem, GRACKLE_ADDR, 0); + write(kmem, &x, 4); + lseek(kmem, GRACKLE_ADDR, 0); + read(kmem, &x, 4); + + DPRINTF("--> 0x%lx\n", val); + return val; +} + +void +gracklePciConfWrite(PCITAG tag, int reg, CARD32 val) +{ + u_int bus, dev, func; + u_int x; + + bus = PCI_BUS_FROM_TAG(tag); + dev = PCI_DEV_FROM_TAG(tag); + func = PCI_FUNC_FROM_TAG(tag); + + DPRINTF("pciConfWrite: PCI(%d:%d:%d)[0x%02x] = 0x%x\n", + bus, dev, func, reg, val); + + if (bus > 0 || + dev > 31 || func > 7 || reg < 0 || reg > 255 || (reg & 3) != 0) + FatalError("pciConfWrite: Illegal range\n"); + + /* XXX Don't disable mem_enable */ + if (reg == 4) + val |= PCI_CMD_MEM_ENABLE; + + x = bswap32(0x80000000 | (bus << 16) | (dev << 11) | (func << 8) | reg); + lseek(kmem, GRACKLE_ADDR, 0); /* addr port */ + write(kmem, &x, 4); + lseek(kmem, GRACKLE_ADDR, 0); + read(kmem, &x, 4); /* dummy read */ + + x = bswap32(val); + lseek(kmem, GRACKLE_DATA, 0); + write(kmem, &x, 4); + + x = 0; + lseek(kmem, GRACKLE_ADDR, 0); + write(kmem, &x, 4); + lseek(kmem, GRACKLE_ADDR, 0); + read(kmem, &x, 4); +} + +void +macppcPciSetBits(PCITAG tag, int reg, CARD32 mask, CARD32 bits) +{ + CARD32 val; + + DPRINTF("pciSetBits\n"); + + val = pciBusInfo[0]->funcs.pciReadLong(tag, reg); + val = (val & ~mask) | (bits & mask); + pciBusInfo[0]->funcs.pciWriteLong(tag, reg, val); +} + + +#include "compiler.h" + +u_int +debug_inb(u_short port, int line, char *file) +{ + FatalError("inb() called from %s line %d\n", file, line); +} + +u_int +debug_inw(u_short port, int line, char *file) +{ + FatalError("inw() called from %s line %d\n", file, line); +} + +u_int +debug_inl(u_short port, int line, char *file) +{ + FatalError("inl() called from %s line %d\n", file, line); +} + +void +debug_outb(u_short port, u_char value, int line, char *file) +{ + FatalError("outb() called from %s line %d\n", file, line); +} + +void +debug_outw(u_short port, u_short value, int line, char *file) +{ + FatalError("outw() called from %s line %d\n", file, line); +} + +void +debug_outl(u_short port, u_int value, int line, char *file) +{ + FatalError("outl() called from %s line %d\n", file, line); +}