summaryrefslogtreecommitdiffstats
path: root/sys/boot/alpha
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1998-10-31 17:12:32 +0000
committerdfr <dfr@FreeBSD.org>1998-10-31 17:12:32 +0000
commit29a470890d941fb3684c87bc547351fad2ba4d44 (patch)
treeb5dea2cf9f55e398ae5a1d6c40fd5b7cf6a1f892 /sys/boot/alpha
parent052ed056ae42a100f0a42e542cc07049bba598ae (diff)
downloadFreeBSD-src-29a470890d941fb3684c87bc547351fad2ba4d44.zip
FreeBSD-src-29a470890d941fb3684c87bc547351fad2ba4d44.tar.gz
* Extend the memory available for the heap from 256k to 512k.
* Embed the stack into the bss section for loader and netboot. This is required for netboot since otherwise the stack would be inside our heap. * Install loader and netboot in /boot by default. * Fix getbootfile so that it searches for a ',' instead of a ';' when terminating the filename.
Diffstat (limited to 'sys/boot/alpha')
-rw-r--r--sys/boot/alpha/Makefile.inc2
-rw-r--r--sys/boot/alpha/boot1/Makefile4
-rw-r--r--sys/boot/alpha/boot2/Makefile3
-rw-r--r--sys/boot/alpha/common/main.c52
-rw-r--r--sys/boot/alpha/libalpha/srmdisk.c23
-rw-r--r--sys/boot/alpha/libalpha/start.S15
-rw-r--r--sys/boot/alpha/netboot/Makefile3
7 files changed, 84 insertions, 18 deletions
diff --git a/sys/boot/alpha/Makefile.inc b/sys/boot/alpha/Makefile.inc
index b8f2470..abb4f65 100644
--- a/sys/boot/alpha/Makefile.inc
+++ b/sys/boot/alpha/Makefile.inc
@@ -6,5 +6,3 @@ DPADD+= ${DESTDIR}/${LIBDIR}/libstand.a
LIBSTANDDIR= ${.CURDIR}/../../../../lib/libstand
LIBSTAND= -lstand
LIBALPHA= ${.OBJDIR}/../libalpha/libalpha.a
-
-BINDIR= /usr/mdec
diff --git a/sys/boot/alpha/boot1/Makefile b/sys/boot/alpha/boot1/Makefile
index 98f6c9d..3edaf04 100644
--- a/sys/boot/alpha/boot1/Makefile
+++ b/sys/boot/alpha/boot1/Makefile
@@ -15,6 +15,7 @@ CFLAGS+= -I${.CURDIR}/..
CFLAGS+= -DSECONDARY_LOAD_ADDRESS=${SECONDARY_LOAD_ADDRESS} -DMINIMAL
NOMAN=1
STRIP=
+BINDIR?= /usr/mdec
BOOT_RELOC = ${PRIMARY_LOAD_ADDRESS}
@@ -36,10 +37,9 @@ ${PROG}: ${PROG}.nosym
.include <bsd.prog.mk>
start.o: ${.CURDIR}/../libalpha/start.S
- ${CC} -c -DPRIMARY_BOOTBLOCK $<
+ ${CC} -c ${CFLAGS} $<
${PROG}.sym: ${OBJS} ${LIBKERN}
${LD} -M -Ttext ${BOOT_RELOC} -N -e start -o ${PROG}.sym ${OBJS} \
${LIBSTAND} ${LIBALPHA} ${LIBSTAND} > ${.OBJDIR}/${PROG}.list
size ${PROG}.sym
-
diff --git a/sys/boot/alpha/boot2/Makefile b/sys/boot/alpha/boot2/Makefile
index 5b58e49..5ee39b9 100644
--- a/sys/boot/alpha/boot2/Makefile
+++ b/sys/boot/alpha/boot2/Makefile
@@ -30,6 +30,7 @@ CFLAGS+= -I${LIBSTANDDIR}
CFLAGS+= -I${.CURDIR}/..
CRT= start.o
STRIP=
+BINDIR?= /boot
all: ${BASE}
@@ -47,7 +48,7 @@ ${BASE}.sym: ${OBJS} ${LIBSTAND} ${LIBALPHA} ${CRT} vers.o setdef0.o setdef1.o
# Other fragments still to be brought in from ../Makfile.booters?
start.o: ${.CURDIR}/../libalpha/start.S
- ${CC} -c $<
+ ${CC} -c ${CFLAGS} $<
setdef0.o: setdefs.h
diff --git a/sys/boot/alpha/common/main.c b/sys/boot/alpha/common/main.c
index 44847cd..2776b08 100644
--- a/sys/boot/alpha/common/main.c
+++ b/sys/boot/alpha/common/main.c
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: main.c,v 1.6 1998/10/19 09:12:41 dfr Exp $
+ * $Id: main.c,v 1.7 1998/10/24 00:31:21 msmith Exp $
*/
@@ -63,6 +63,50 @@ memsize()
return total;
}
+static void
+extend_heap()
+{
+ struct rpb *hwrpb = (struct rpb *)HWRPB_ADDR;
+ struct mddt *mddtp;
+ struct mddt_cluster *memc;
+ int i;
+ unsigned long total = 0;
+ unsigned long startpfn;
+ vm_offset_t startva;
+ vm_offset_t startpte;
+
+ /*
+ * Find the last usable memory cluster and add some of its pages
+ * to our address space. The 256k allowed by the firmware isn't quite
+ * adequate for our needs.
+ */
+ mddtp = (struct mddt *)(((caddr_t)hwrpb) + hwrpb->rpb_memdat_off);
+ for (i = mddtp->mddt_cluster_cnt - 1; i >= 0; i--) {
+ memc = &mddtp->mddt_clusters[i];
+ if (!(memc->mddt_usage & (MDDT_NONVOLATILE | MDDT_PALCODE)))
+ break;
+ }
+
+ /*
+ * We want to extend the heap from 256k to 512k. With 8k pages
+ * (assumed), we need 32 pages. We take pages from the end of the
+ * last usable memory region, taking care to avoid the memory used
+ * by the kernel's message buffer. We allow 4 pages for the
+ * message buffer.
+ */
+ startpfn = memc->mddt_pfn + memc->mddt_pg_cnt - 4 - 32;
+ startva = 0x20040000;
+ startpte = 0x40000000
+ + (((startva >> 23) & 0x3ff) << PAGE_SHIFT)
+ + (((startva >> 13) & 0x3ff) << 3);
+
+ for (i = 0; i < 32; i++) {
+ u_int64_t pte;
+ pte = ((startpfn + i) << 32) | 0x1101;
+ *(u_int64_t *) (startpte + 8 * i) = pte;
+ }
+}
+
void
main(void)
{
@@ -74,16 +118,16 @@ main(void)
* alloc() is usable. The stack is buried inside us, so this is
* safe.
*/
- setheap((void *)end, (void *)0x20040000);
+ extend_heap();
+ setheap((void *)end, (void *)0x20080000);
#ifdef LOADER
/*
* If this is the two stage disk loader, add the memory used by
* the first stage to the heap.
*/
-#define STACK_SIZE 16384
free_region((void *)PRIMARY_LOAD_ADDRESS,
- (void *)SECONDARY_LOAD_ADDRESS - STACK_SIZE);
+ (void *)SECONDARY_LOAD_ADDRESS);
#endif
/*
diff --git a/sys/boot/alpha/libalpha/srmdisk.c b/sys/boot/alpha/libalpha/srmdisk.c
index f7427bd..bd74ba7 100644
--- a/sys/boot/alpha/libalpha/srmdisk.c
+++ b/sys/boot/alpha/libalpha/srmdisk.c
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: srmdisk.c,v 1.1.1.1 1998/08/21 03:17:42 msmith Exp $
*/
/*
@@ -63,6 +63,7 @@ static int bd_init(void);
static int bd_strategy(void *devdata, int flag, daddr_t dblk, size_t size, void *buf, size_t *rsize);
static int bd_open(struct open_file *f, void *vdev);
static int bd_close(struct open_file *f);
+static void bd_print(int verbose);
struct open_disk {
int od_fd;
@@ -84,7 +85,8 @@ struct devsw srmdisk = {
bd_strategy,
bd_open,
bd_close,
- noioctl
+ noioctl,
+ bd_print
};
/*
@@ -120,6 +122,23 @@ bd_init(void)
}
/*
+ * Print information about disks
+ */
+static void
+bd_print(int verbose)
+{
+ int i;
+ char line[80];
+
+ for (i = 0; i < nbdinfo; i++) {
+ sprintf(line, " disk%d: SRM drive %s", i, bdinfo[i].bd_name);
+ pager_output(line);
+ /* XXX more detail? */
+ pager_output("\n");
+ }
+}
+
+/*
* Attempt to open the disk described by (dev) for use by (f).
*
* Note that the philosophy here is "give them exactly what
diff --git a/sys/boot/alpha/libalpha/start.S b/sys/boot/alpha/libalpha/start.S
index 53063ab..39c3e48 100644
--- a/sys/boot/alpha/libalpha/start.S
+++ b/sys/boot/alpha/libalpha/start.S
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: start.S,v 1.1.1.1 1998/08/21 03:17:42 msmith Exp $
* From: $NetBSD: start.S,v 1.4 1998/03/28 00:54:15 cgd Exp $
*/
@@ -51,16 +51,15 @@ NESTED(start, 1, ENTRY_FRAME, ra, 0, 0)
Lstartgp:
LDGP(pv)
-#ifndef PRIMARY_BOOTBLOCK
- lda sp,start /* start stack below text */
- lda sp,-ENTRY_FRAME(sp)
-#endif
-
lda a0,_edata
lda a1,_end
subq a1,a0,a1
CALL(bzero)
+#if defined(NETBOOT) || defined(LOADER)
+ lda sp,stack + 8192 - ENTRY_FRAME
+#endif
+
CALL(main) /* transfer to C */
XLEAF(_rtt, 0)
@@ -83,3 +82,7 @@ LEAF(cpu_number, 0)
call_pal PAL_VMS_mfpr_whami
RET
END(cpu_number)
+
+#if defined(NETBOOT) || defined(LOADER)
+BSS(stack, 8192)
+#endif
diff --git a/sys/boot/alpha/netboot/Makefile b/sys/boot/alpha/netboot/Makefile
index 92e1839..927522c 100644
--- a/sys/boot/alpha/netboot/Makefile
+++ b/sys/boot/alpha/netboot/Makefile
@@ -28,6 +28,7 @@ CFLAGS+= -I${LIBSTANDDIR}
CFLAGS+= -I${.CURDIR}/..
CRT= start.o
STRIP=
+BINDIR?= /boot
all: ${BASE}
@@ -48,7 +49,7 @@ ${BASE}.sym: ${OBJS} ${LIBSTAND} ${LIBALPHA} ${CRT} vers.o setdef0.o setdef1.o
vers.o ${LIBSTAND} ${LIBALPHA} ${LIBSTAND} >${.OBJDIR}/${BASE}.list
start.o: ${.CURDIR}/../libalpha/start.S
- ${CC} -c -DPRIMARY_BOOTBLOCK $<
+ ${CC} -c ${CFLAGS} $<
setdef0.o: setdefs.h
OpenPOWER on IntegriCloud