Index: [thread] [date] [subject] [author]
  From: Frank W. Miller <fwmiller@cs.umd.edu>
  To  : ggi-develop@eskimo.com
  Date: Tue, 7 Jul 1998 12:05:32 -0400 (EDT)

Re: here we go...

Well, I've decided I don't like you Makefiles already...  :(

Here's what I'm trying to do.  I have the two kgicon distributions
I mentioned earlier.  I have them untarred into a single directory,
called kgicon.  The du looks like this

36      ./video/kgi/accel/Cirrus
26      ./video/kgi/accel/IBM
40      ./video/kgi/accel/Matrox
58      ./video/kgi/accel/S3
14      ./video/kgi/accel/generic
34      ./video/kgi/accel/Tseng
18      ./video/kgi/accel/Cyrix
26      ./video/kgi/accel/WD
262     ./video/kgi/accel
8       ./video/kgi/chipset/.stubs/CVS
14      ./video/kgi/chipset/.stubs
42      ./video/kgi/chipset/ATI
60      ./video/kgi/chipset/Chips
244     ./video/kgi/chipset/Cirrus
62      ./video/kgi/chipset/Hercules
198     ./video/kgi/chipset/IBM
168     ./video/kgi/chipset/Matrox
398     ./video/kgi/chipset/S3
286     ./video/kgi/chipset/Tseng
116     ./video/kgi/chipset/Cyrix
216     ./video/kgi/chipset/WD
1812    ./video/kgi/chipset
8       ./video/kgi/clock/.stubs/CVS
14      ./video/kgi/clock/.stubs
78      ./video/kgi/clock/fixed
176     ./video/kgi/clock/prog
280     ./video/kgi/clock
6       ./video/kgi/include/Chips
56      ./video/kgi/include/Matrox
100     ./video/kgi/include/S3
46      ./video/kgi/include/ATI
12      ./video/kgi/include/ATT
38      ./video/kgi/include/Cirrus
6       ./video/kgi/include/Hercules
64      ./video/kgi/include/IBM
8       ./video/kgi/include/ICS
8       ./video/kgi/include/SC
26      ./video/kgi/include/TI
30      ./video/kgi/include/Tseng
40      ./video/kgi/include/Cyrix
98      ./video/kgi/include/WD
540     ./video/kgi/include
8       ./video/kgi/monitor/.stub/CVS
14      ./video/kgi/monitor/.stub
38      ./video/kgi/monitor/monosync
132     ./video/kgi/monitor/multisync
34      ./video/kgi/monitor/timelist
242     ./video/kgi/monitor
42      ./video/kgi/ramdac/ATT
8       ./video/kgi/ramdac/.stubs/CVS
14      ./video/kgi/ramdac/.stubs
8       ./video/kgi/ramdac/Bt
22      ./video/kgi/ramdac/Chips
46      ./video/kgi/ramdac/Cirrus
22      ./video/kgi/ramdac/Cyrix
36      ./video/kgi/ramdac/IBM
32      ./video/kgi/ramdac/ICS
26      ./video/kgi/ramdac/Matrox
22      ./video/kgi/ramdac/S3
34      ./video/kgi/ramdac/SC
48      ./video/kgi/ramdac/TI
18      ./video/kgi/ramdac/Tseng
14      ./video/kgi/ramdac/none
396     ./video/kgi/ramdac
3704    ./video/kgi
3706    ./video
14      ./roadrunner/include/kgi
16      ./roadrunner/include
18      ./roadrunner
188     ./linux/include/kgi
190     ./linux/include
192     ./linux
3918    .

Now, I've written a system.h in the roadrunner/include/kgi directory.
It looks like this:

/*
 * --------------------------------------------------------------------------
 * OS and architecture dependent parts of GGI *
 * --------------------------------------------------------------------------
 * 
 * Copyright (C) 1997, Steffen Seeger
 * 
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2, or (at your option) any later
 * version.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program; see the file COPYING.  If not, write to the Free Software
 * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 * 
 * ---------------------------------------------------------------------------
 */

#ifndef _KGI_SYSTEM_H
#define _KGI_SYSTEM_H

#include <kgi/debug.h>
#include <kgi/errno.h>

#define KB      *(1024)
#define MB      *(1024*1024)
#define GB      *(1024*1024*1024)

/*
 * NOTE: This should make porting easier later. Porting KGI to another system
 * would hopefully mean only to rewrite this header file once all OS specific
 * stuff is in here. Currently, this is heavily Linux dependent.
 */

/*
 * ---------------------------------------------------------------------------
 * Basic data types
 * ---------------------------------------------------------------------------
 */

typedef signed char sint8;
typedef unsigned char uint8;

typedef signed short sint16;
typedef unsigned short uint16;

typedef signed int sint32;
typedef unsigned int uint32;

#if defined(GGI_NEED_64BIT)
typedef signed long long sint64;
typedef unsigned long long uint64;
#endif

typedef float   real4;
typedef double  real8;

typedef signed int ggi_sint;
typedef unsigned int ggi_uint;

#if defined(KGI_NEED_64BIT)
typedef signed long long sintl;
typedef unsigned long long uintl;
#else
typedef signed long sintl;
typedef unsigned long uintl;
#endif

typedef float   real;
typedef double  reall;


#define BITS_PER(x)     (sizeof(x)*8)


/*
 * Per region, we have a physical and a virtual address space and certain
 * information is stored with each region. As this is common to all regions,
 * let's make life easier.
 */

#define DECLARE_IOSPACE(iospace, phys_t, virt_t)                          \
typedef phys_t iospace ## _addr;        /* the physical address type    */\
typedef virt_t iospace ## _vaddr;       /* the virtual address type     */\
struct iospace ## _region {                                               \
        iospace ## _vaddr baseptr;      /* virtual base address         */\
        iospace ## _addr base;          /* physical base address        */\
        iospace ## _addr size;          /* size of region               */\
        iospace ## _addr decode;        /* decoded phys address lines   */\
        char *name;                     /* name of the region           */\
}

/*
 * Intel style in/out I/O space
 */

DECLARE_IOSPACE(io, uint16, uint16);
#define IO_NULL         ((io_vaddr) 0)


#include <sys.h>


extern inline   ggi_sint
io_check_region(struct io_region * r)
{
    return 0;                            /* EOK */
}

extern inline   io_vaddr
io_claim_region(struct io_region * r)
{
    return r->baseptr = r->base;
}

extern inline   io_vaddr
io_free_region(struct io_region * r)
{
    return r->baseptr = IO_NULL;
}

extern inline   io_vaddr
io_alloc_region(struct io_region * r)
{
    return IO_NULL;
}

extern inline   uint8
io_in8(io_vaddr addr)
{
    return _inb(addr);
}

extern inline   uint16
io_in16(io_vaddr addr)
{
    return _inw(addr);
}

extern inline   uint32
io_in32(io_vaddr addr)
{
    return _inl(addr);
}

extern inline void
io_ins8(io_vaddr addr, void *buf, ggi_uint cnt)
{
    _insb(addr, buf, cnt);
}

extern inline void
io_ins16(io_vaddr addr, void *buf, ggi_uint cnt)
{
    _insw(addr, buf, cnt);
}

extern inline void
io_ins32(io_vaddr addr, void *buf, ggi_uint cnt)
{
    _insl(addr, buf, cnt);
}

extern inline void
io_out8(uint8 val, io_vaddr addr)
{
    _outb(val, addr);
}

extern inline void
io_out16(uint16 val, io_vaddr addr)
{
    _outw(val, addr);
}

extern inline void
io_out32(uint32 val, io_vaddr addr)
{
    _outl(val, addr);
}

extern inline void
io_outs8(io_vaddr addr, void *buf, ggi_uint cnt)
{
    _outsb(addr, buf, cnt);
}

extern inline void
io_outs16(io_vaddr addr, void *buf, ggi_uint cnt)
{
    _outsw(addr, buf, cnt);
}

extern inline void
io_outs32(io_vaddr addr, void *buf, ggi_uint cnt)
{
    _outsl(addr, buf, cnt);
}

/*
 * Memory I/O space *
 */

DECLARE_IOSPACE(mem, uint32, void *);
#define MEM_NULL        ((mem_vaddr) 0)

#include <linux/mm.h>

extern inline   ggi_sint
mem_check_region(struct mem_region * r)
{
    return 0;                            /* EOK */
}

extern inline   mem_vaddr
mem_claim_region(struct mem_region * r)
{
    return r->baseptr = r->base;
}

extern inline   mem_vaddr
mem_free_region(struct mem_region * r)
{
    return r->baseptr = NULL;
}

extern inline   mem_vaddr
mem_alloc_region(struct mem_region * r)
{
    return MEM_NULL;
}

extern inline   uint8
mem_in8(mem_vaddr addr)
{
    return loadbyte(addr);
}

extern inline   uint16
mem_in16(mem_vaddr addr)
{
    return loadword(addr);
}

extern inline   uint32
mem_in32(mem_vaddr addr)
{
    return loaddword(addr);
}

extern inline void
mem_out8(uint8 val, mem_vaddr addr)
{
    storebyte(val, addr);
}

extern inline void
mem_out16(uint16 val, mem_vaddr addr)
{
    storeword(val, addr);
}

extern inline void
mem_out32(uint32 val, mem_vaddr addr)
{
    storedword(val, addr);
}

#define MEM_INS(x) \
extern inline void mem_ins##x(mem_vaddr addr, uint##x *buf, ggi_uint cnt)       
\
{                                                               \
        while (cnt--) {                                         \
                                                                \
                *(buf++) = mem_in##x(addr);                     \
        }                                                       \
}

#define MEM_OUTS(x) \
extern inline void mem_outs##x(mem_vaddr addr, uint##x *buf, ggi_uint cnt)      
\
{                                                               \
        while (cnt--) {                                         \
                                                                \
                mem_out##x(*(buf++), addr);                     \
        }                                                       \
}

MEM_INS(8)
MEM_INS(16)
MEM_INS(32)
MEM_OUTS(8)
MEM_OUTS(16)
MEM_OUTS(32)
#undef  MEM_OUTS
#undef  MEM_INS

/*
 * PCI configuration space
 */


/* XXX Skip this for now */


#endif




OK, so far so good.  Now I'm trying to make in the video/kgi directory.
First thing is, my find does not support mindepth.  I'm running BSDi 2.1.
I got around that by basically removing the SUBDIRS definition and
replacing the make all rule with this:

all:
##      set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i all; done
        $(MAKE) -C accel all
        $(MAKE) -C chipset all
        $(MAKE) -C clock all
        $(MAKE) -C monitor all
        $(MAKE) -C ramdac all
        $(MAKE) fbcon-kgi.o

Now it appears that the TOPLEVEL variable is not being set correctly
in accel/Makefile.  The main Makefile includes this line

export TOPLEVEL := $(shell pwd)

which appears not to be working.  So, any thoughts on all this?  Am I on
the right track or completely off base...


Thanks,
FM

--
Frank W. Miller                           Department of Computer Science
fwmiller@cs.umd.edu                               University of Maryland
http://www.cs.umd.edu/~fwmiller             College Park, Maryland 20742

Index: [thread] [date] [subject] [author]