initial push

This commit is contained in:
Bernd Mueller
2026-06-17 13:44:30 +02:00
commit adfd70813f
372 changed files with 146450 additions and 0 deletions

20
m68k/driver/sco/Makefile Normal file
View File

@@ -0,0 +1,20 @@
CFLAGS= -DSCO -D_INKERNEL=1 -DUSE_PST=1 -I..
DRIVER= bdm
all: Driver.o
Driver.o: ../bdm.h ../bdm.c sco.c
$(CC) $(CFLAGS) -c -o Driver.o sco.c
install: Driver.o
if /etc/conf/bin/idcheck -p $(DRIVER); \
then \
/etc/conf/bin/idinstall -k -a $(DRIVER); \
else \
/etc/conf/bin/idinstall -k -u $(DRIVER); \
fi
clean:
rm -f Driver.o

1
m68k/driver/sco/Master Normal file
View File

@@ -0,0 +1 @@
bdm Iocirw Hci bdm 0 0 0 4 -1

8
m68k/driver/sco/Node Normal file
View File

@@ -0,0 +1,8 @@
bdm bdmcp0 c 0
bdm bdmcp1 c 1
bdm bdmcp2 c 2
bdm bdmcp3 c 3
bdm bdmcf0 c 4
bdm bdmcf1 c 5
bdm bdmcf2 c 6
bdm bdmcf3 c 7

51
m68k/driver/sco/README Normal file
View File

@@ -0,0 +1,51 @@
How to use the SCO BDM driver
-----------------------------
1. Type "make" to build the driver. I have only tested it when compiled
with the SCO compiler. It does compile with "gcc", so you may be in
luck if thats the path taht you follow.
2. Edit "System" and set the entry that corresponds to your parallel port
to 'Y'.
3. Login as root and type "make install". This will put the driver into
the kernel.
4. Re-build the kernel by running "/etc/conf/bin/idbuild -y" as root, and
the reboot to activate the driver.
5. Build yourself a GDB with BDM support (documented somewhere else :-)
6. Run gdb on the executable you want to debug. At the prompt turn on BDM
with "target bdm /dev/XXXX". The driver automatically installs all the
possible devices in /dev:
/dev/bdmcp0 - CPU32 on LP0
/dev/bdmcp1 - CPU32 on LP1
/dev/bdmcp2 - CPU32 on LP2
/dev/bdmcp3 - CPU32 on LP3
/dev/bdmcf0 - Coldfire on LP0
/dev/bdmcf1 - Coldfire on LP1
/dev/bdmcf2 - Coldfire on LP2
/dev/bdmcf3 - Coldfire on LP3
7. Happy debugging.
Compiling the rest of the tree
------------------------------
1. The Makfile in the lib directory needs the ranlib removed and some
other options like -Wall taken out for the SCO compiler.
2. The Makefile in the test directory needs the "-lbfd -liberty" taken
out.
3. If you do want to use parts of the library that require the BFD library
then you will have to work through that on your own :-)
Copyright (C) 1999 David McCullough (davidm@stallion.oz.au)

36
m68k/driver/sco/Space.c Normal file
View File

@@ -0,0 +1,36 @@
/****************************************************************************/
/*
* Do all our LP setup through the standard System/Sdevice setup
*/
/****************************************************************************/
#include "config.h"
/****************************************************************************/
unsigned int bdm_ports[] = {
#ifdef BDM_0
BDM_0_SIOA,
#else
-1,
#endif
#ifdef BDM_1
BDM_1_SIOA,
#else
-1,
#endif
#ifdef BDM_2
BDM_2_SIOA,
#else
-1,
#endif
#ifdef BDM_3
BDM_3_SIOA,
#else
-1,
#endif
};
int bdm_debug_level = 0;
/****************************************************************************/

4
m68k/driver/sco/System Normal file
View File

@@ -0,0 +1,4 @@
bdm Y 0 0 0 0 378 37b 0 0
bdm N 1 0 0 0 278 27b 0 0
bdm N 2 0 0 0 3bc 3bf 0 0
bdm N 3 0 0 0 2bc 2bf 0 0

276
m68k/driver/sco/sco.c Normal file
View File

@@ -0,0 +1,276 @@
/****************************************************************************/
/*
* Motorola Background Debug Mode Driver for SCO based on the linux one
* which it needs to compile.
*
* Copyright (C) 1999 David McCullough (davidm@stallion.oz.au)
*
* 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 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* 22/10/1999 -- CCJ (ccj@acm.org)
* Altered to match the split driver code.
*
*/
#define BDM_DEFAULT_DEBUG 0
#include <sys/param.h>
#include <sys/types.h>
#include <sys/immu.h>
#include <sys/dir.h>
#include <sys/user.h>
#include <sys/sysmacros.h>
#include <sys/errno.h>
#include <sys/conf.h>
#include "bdm.h"
/****************************************************************************
* UNIX driver support routines *
****************************************************************************/
/*
* Big hack to get around differences in outb under SCO
*/
void
bdm_outb (int port, int value)
{
outb (port, value);
}
#define outb(value, port) bdm_outb (port, value)
/****************************************************************************
* Other tings we need to compile *
****************************************************************************/
#define PRINTF printf
#define udelay(x) bdm_delay (x)
#define MINOR(x) minor (x)
/****************************************************************************
* Delay for a while so target can keep up. *
****************************************************************************/
static void
bdm_delay (int counter)
{
while (counter--)
__asm ("nop");
}
/****************************************************************************
* Wait a longer while. This function sleeps *
****************************************************************************/
static void
bdm_sleep (u_int time)
{
delay(time);
}
/****************************************************************************
* OS worker functions. *
****************************************************************************/
static int
os_claim_io_ports (unsigned int base, unsigned int num)
{
return 0;
}
static int
os_release_io_ports (unsigned int base, unsigned int num)
{
return 0;
}
static int
os_copy_in (void *dst, void *src, int size)
{
if (copyin (src, dst, size) < 0)
return EFAULT;
return 0;
}
static int
os_copy_out (void *dst, void *src, int size)
{
if (copyout (src, dst, size) < 0)
return EFAULT;
return 0;
}
static void
os_lock_module ()
{
}
static void
os_unlock_module ()
{
}
/****************************************************************************
* Include the BBM code *
****************************************************************************/
#include "bdm.c"
/****************************************************************************
* The real driver code starts here *
****************************************************************************/
int
bdminit ()
{
int minor, found;
static char hex_digit[] = "0123456789ABCDEF";
/*
* Set up port numbers
*/
found = 0;
for (minor = 0;
minor < (sizeof bdm_device_info / sizeof bdm_device_info[0]);
minor++) {
extern int bdm_ports[], bdm_debug_level; /* see Space.c */
int port, i;
struct BDM *self = &bdm_device_info[minor];
/*
* First set the default debug level. I use a variable
* here so I can set it with a debugger or just change
* space.c and rebuild the kernel.
*/
self->debugFlag = bdm_debug_level;
/*
* Choose a port number
*/
i = BDM_IFACE_MINOR (minor);
if (i >= 0 && i < 4)
port = bdm_ports[i];
else
port = -1;
if (port == -1) {
self->exists = 0;
continue;
}
/*
* See if the port exists
*/
self->exists = 1;
outb (0x00, port);
udelay (50);
if (inb (port) != 0x00) {
self->exists = -1;
if (self->debugFlag)
printk("BDM driver cannot detect device %d(addr=0x%x).\n",
BDM_IFACE_MINOR(minor), port);
}
bcopy ("bdm\0\0\0", self->name, 6);
self->name[4] = hex_digit[(minor & 0xf0) >> 4];
self->name[5] = hex_digit[minor & 0xf];
self->portBase = self->dataPort = port;
self->statusPort = port + 1;
self->controlPort = port + 2;
switch (BDM_IFACE (minor)) {
case BDM_CPU32_PD: cpu32_pd_init_self (self); break;
case BDM_CPU32_ICD: cpu32_icd_init_self (self); break;
case BDM_COLDFIRE_PE: cf_pe_init_self (self); break;
default:
self->exists = -2;
if (self->debugFlag)
printk("BDM driver has no interface for minor number %d\n",
minor);
break;
}
if (self->exists) {
printcfg("bdm", port, 4, -1, -1,
"%d minor=%d v%d.%d, " __DATE__ ", " __TIME__,
self->exists, minor,
BDM_DRV_VERSION >> 8, BDM_DRV_VERSION & 0xff);
found++;
if (self->exists < 0)
self->exists = 0;
}
}
if (!found)
printcfg("bdm", 0, 0, -1, -1,
"NO-PORTS v%d.%d, " __DATE__ ", " __TIME__,
BDM_DRV_VERSION >> 8, BDM_DRV_VERSION & 0xff);
return(0);
}
/******************************************************************************/
int
bdmopen (dev_t dev, int flag, int type)
{
u.u_error = bdm_open (MINOR(dev));
return 0;
}
/******************************************************************************/
int
bdmclose (dev_t dev, int flag, int type)
{
u.u_error = bdm_close (MINOR(dev));
return 0;
}
/******************************************************************************/
int
bdmioctl (dev_t dev, int cmd, int arg, int mode)
{
u.u_error = bdm_ioctl (MINOR(dev), cmd, arg);
return 0;
}
/******************************************************************************/
int
bdmread (dev_t dev)
{
u.u_error = bdm_read (MINOR (dev), u.u_base, u.u_count);
u.u_base += u.u_count;
u.u_count = 0;
return(0);
}
/******************************************************************************/
int
bdmwrite (dev_t dev)
{
u.u_error = bdm_write (MINOR (dev), u.u_base, u.u_count);
u.u_base += u.u_count;
u.u_count = 0;
return (0);
}
/******************************************************************************/