- Enable PnP and ISA PnP code.

- Use the ISA PnP enumerator.
 - Use the new linker set code, throw out the gensetdefs stuff.
 - Produce an intermediate loader image that has symbols stripped, to aid
 - in debugging.
 - Supply ISA port access functions required for ISA PnP
This commit is contained in:
Mike Smith 1998-10-21 20:10:33 +00:00
parent c90625d230
commit d8ef941c2f
3 changed files with 59 additions and 26 deletions

View File

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.11 1998/10/12 01:03:00 rnordier Exp $ # $Id: Makefile,v 1.12 1998/10/14 07:08:16 peter Exp $
BASE= loader BASE= loader
PROG= ${BASE} PROG= ${BASE}
@ -11,8 +11,8 @@ BINDIR?= /boot
SRCS= main.c conf.c SRCS= main.c conf.c
# Enable PnP and ISA-PnP code. # Enable PnP and ISA-PnP code.
#HAVE_PNP= yes HAVE_PNP= yes
#HAVE_ISABUS= yes HAVE_ISABUS= yes
# Always add MI sources # Always add MI sources
.PATH: ${.CURDIR}/../../common .PATH: ${.CURDIR}/../../common
@ -20,8 +20,7 @@ SRCS= main.c conf.c
CFLAGS+= -I${.CURDIR}/../../common CFLAGS+= -I${.CURDIR}/../../common
CFLAGS+= -I${.CURDIR}/../../.. -I. CFLAGS+= -I${.CURDIR}/../../.. -I.
CLEANFILES+= vers.c vers.o ${BASE}.list setdef0.o setdef1.o setdefs.h \ CLEANFILES+= vers.c vers.o ${BASE}.list ${BASE}.bin
gensetdefs.o gensetdefs ${BASE}.bin
CFLAGS+= -Wall CFLAGS+= -Wall
LDFLAGS= -nostdlib -static -Ttext 0x1000 LDFLAGS= -nostdlib -static -Ttext 0x1000
@ -49,6 +48,9 @@ CFLAGS+= -I${.CURDIR}/../btx/lib
# BTX is expecting ELF components # BTX is expecting ELF components
CFLAGS+= -elf CFLAGS+= -elf
# New linker set code
CFLAGS+= -DNEW_LINKER_SET
# Debug me! # Debug me!
#CFLAGS+= -g #CFLAGS+= -g
#LDFLAGS+= -g #LDFLAGS+= -g
@ -61,30 +63,26 @@ ${BASE}: ${BASE}.bin ${BTXLDR} ${BTXKERN}
btxld -v -f aout -e 0x100000 -o ${.TARGET} -l ${BTXLDR} -b ${BTXKERN} \ btxld -v -f aout -e 0x100000 -o ${.TARGET} -l ${BTXLDR} -b ${BTXKERN} \
${BASE}.bin ${BASE}.bin
${BASE}.bin: ${OBJS} ${LIBI386} vers.o setdef0.o setdef1.o ${BASE}.bin: ${BASE}.sym
${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} setdef0.o ${OBJS} vers.o setdef1.o \ cp ${.ALLSRC} ${.TARGET}
strip ${.TARGET}
# Cannot use ${OBJS} above this line
.include <bsd.prog.mk>
${BASE}.sym: ${OBJS} ${LIBI386} vers.o
${CC} ${LDFLAGS} -o ${.TARGET} ${BTXCRT} ${OBJS} vers.o \
${LIBSTAND} ${LIBI386} ${LIBSTAND} ${LIBSTAND} ${LIBI386} ${LIBSTAND}
setdef0.o: setdefs.h # If it's not there, don't consider it a target
.if exists(${.CURDIR}/../../../i386/include)
setdef1.o: setdefs.h beforedepend ${OBJS}: machine
machine: machine:
ln -sf ${.CURDIR}/../../../i386/include machine ln -sf ${.CURDIR}/../../../i386/include machine
.endif
CLEANFILES+= machine CLEANFILES+= machine
.include <bsd.prog.mk>
# Linker set gymnastics
setdefs.h: gensetdefs ${OBJS}
@echo Generating linker sets
@./gensetdefs ${OBJS} >setdefs.h
gensetdefs: gensetdefs.o
${CC} -static gensetdefs.o -o $@
gensetdefs.o: gensetdefs.c
${CC} -c $<
beforedepend ${OBJS}: machine

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: conf.c,v 1.6 1998/09/30 19:48:42 peter Exp $ * $Id: conf.c,v 1.7 1998/10/07 02:39:32 msmith Exp $
*/ */
#include <stand.h> #include <stand.h>
@ -88,7 +88,7 @@ extern struct pnphandler isapnphandler;
/* extern struct pnphandler pcipnphandler;*/ /* extern struct pnphandler pcipnphandler;*/
struct pnphandler *pnphandlers[] = { struct pnphandler *pnphandlers[] = {
/* &isapnphandler, */ &isapnphandler,
/* &pcipnphandler, */ /* &pcipnphandler, */
NULL NULL
}; };

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: main.c,v 1.10 1998/10/03 18:27:50 rnordier Exp $ * $Id: main.c,v 1.11 1998/10/04 09:12:54 msmith Exp $
*/ */
/* /*
@ -58,6 +58,8 @@ static struct bootinfo *initial_bootinfo;
struct arch_switch archsw; /* MI/MD interface boundary */ struct arch_switch archsw; /* MI/MD interface boundary */
static void extract_currdev(void); static void extract_currdev(void);
static int isa_inb(int port);
static void isa_outb(int port, int value);
/* from vers.c */ /* from vers.c */
extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[]; extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[];
@ -118,6 +120,8 @@ main(void)
archsw.arch_copyin = i386_copyin; archsw.arch_copyin = i386_copyin;
archsw.arch_copyout = i386_copyout; archsw.arch_copyout = i386_copyout;
archsw.arch_readin = i386_readin; archsw.arch_readin = i386_readin;
archsw.arch_isainb = isa_inb;
archsw.arch_isaoutb = isa_outb;
interact(); /* doesn't return */ interact(); /* doesn't return */
} }
@ -195,3 +199,34 @@ command_heap(int argc, char *argv[])
printf("heap base at %p, top at %p\n", end, sbrk(0)); printf("heap base at %p, top at %p\n", end, sbrk(0));
return(CMD_OK); return(CMD_OK);
} }
/* ISA bus access functions for PnP, derived from <machine/cpufunc.h> */
static int
isa_inb(int port)
{
u_char data;
if (__builtin_constant_p(port) &&
(((port) & 0xffff) < 0x100) &&
((port) < 0x10000)) {
__asm __volatile("inb %1,%0" : "=a" (data) : "id" ((u_short)(port)));
} else {
__asm __volatile("inb %%dx,%0" : "=a" (data) : "d" (port));
}
return(data);
}
static void
isa_outb(int port, int value)
{
u_char al = value;
if (__builtin_constant_p(port) &&
(((port) & 0xffff) < 0x100) &&
((port) < 0x10000)) {
__asm __volatile("outb %0,%1" : : "a" (al), "id" ((u_short)(port)));
} else {
__asm __volatile("outb %0,%%dx" : : "a" (al), "d" (port));
}
}