Ejemplo n.º 1
0
void
freeall(void)
{
#ifdef __notyet__
	struct ml *m;

	/* Release chunks on freelist... */
	while ((m = freelist.lh_first) != NULL) {
		LIST_REMOVE(m, list);
		OF_release(m, m->size);
	}

	/* ...and allocated list. */
	while ((m = allocatedlist.lh_first) != NULL) {
		LIST_REMOVE(m, list);
		OF_release(m, m->size);
	}
#endif /* __notyet__ */
}
Ejemplo n.º 2
0
void
OF_chain(void *virt, u_int size, void (*entry)(), void *arg, u_int len)
{
	/*
	 * This is a REALLY dirty hack till the firmware gets this going
	 */
	if (size > 0)
		OF_release(virt, size);

	entry(0, 0, openfirmware, arg, len);
}
Ejemplo n.º 3
0
void
OF_chain(void *virt, u_int size, boot_entry_t entry, void *arg, u_int len)
{
	/*
	 * This is a REALLY dirty hack till the firmware gets this going
	 */
#if 0
	OF_release(virt, size);
#endif
	entry(0, 0, openfirmware, arg, len);
}
Ejemplo n.º 4
0
int
run_loadfile(u_long *marks, int howto)
{
	char bootline[512];		/* Should check size? */
	u_int32_t entry;
	char *cp;
	void *ssym, *esym;

	strlcpy(bootline, opened_name, sizeof bootline);
	cp = bootline + strlen(bootline);
	*cp++ = ' ';
        *cp = '-';
        if (howto & RB_ASKNAME)
                *++cp = 'a';
        if (howto & RB_CONFIG)
                *++cp = 'c';
        if (howto & RB_SINGLE)
                *++cp = 's';
        if (howto & RB_KDB)
                *++cp = 'd';
        if (*cp == '-')
		*--cp = 0;
	else
		*++cp = 0;

	entry = marks[MARK_ENTRY];
	ssym = (void *)marks[MARK_SYM];
	esym = (void *)marks[MARK_END];
	{
		u_int32_t lastpage;
		lastpage = roundup(marks[MARK_END], NBPG);
		OF_release((void*)lastpage, CLAIM_LIMIT - lastpage);
	}

	chain((void *)entry, bootline, ssym, esym);

	_rtt();
	return 0;
}
Ejemplo n.º 5
0
void
ofw_release_heap(void)
{
    OF_release(heap_base, heap_size);
}
Ejemplo n.º 6
0
void
main(void)
{
	extern char bootprog_name[], bootprog_rev[];
	int chosen;
	char bootline[512];		/* Should check size? */
	char *cp, *startbuf, *endbuf;
	u_long marks[MARK_MAX], size;
	u_int32_t entry;
	void *ssym, *esym;

	printf("\n");
	printf(">> %s, Revision %s\n", bootprog_name, bootprog_rev);

	/*
	 * Get the boot arguments from Openfirmware
	 */
	if ((chosen = OF_finddevice("/chosen")) == -1 ||
	    OF_getprop(chosen, "bootpath", bootdev, sizeof bootdev) < 0 ||
	    OF_getprop(chosen, "bootargs", bootline, sizeof bootline) < 0) {
		printf("Invalid Openfirmware environment\n");
		OF_exit();
	}

	prom2boot(bootdev);
	parseargs(bootline, &boothowto);
	DPRINTF("bootline=%s\n", bootline);

	/*
	 * Per the ARM OpenFirmware bindings, the firmware must
	 * allocate and map at least 6MB of physical memory starting
	 * at VA 0xf0000000.  We have been loaded at 0xf0000000,
	 * and the memory after us has been unmapped and freed.
	 * We expect to load the kernel at 0xf0100000, so we will
	 * allocate 5MB of virtual memory starting there, and
	 * unmap/free what we don't use.
	 */
	startbuf = OF_claim((void *) 0xf0100000, (5 * 1024 * 1024), 0);
	if (startbuf != (void *) 0xf0100000) {
		printf("Unable to claim buffer for kernel\n");
		OF_exit();
	}
	endbuf = startbuf + (5 * 1024 * 1024);

	for (;;) {
		int i;

		if (boothowto & RB_ASKNAME) {
			printf("Boot: ");
			gets(bootline);
			parseargs(bootline, &boothowto);
		}

		if (bootline[0]) {
			kernels[0] = bootline;
			kernels[1] = NULL;
		}

		for (i = 0; kernels[i]; i++) {
			DPRINTF("Trying %s\n", kernels[i]);

			marks[MARK_START] = 0xf0100000;
			if (loadfile(kernels[i], marks, LOAD_KERNEL) >= 0)
				goto loaded;
		}

		boothowto |= RB_ASKNAME;
	}
 loaded:
	/*
	 * Okay, kernel is loaded, free the extra memory at the end.
	 * Round to the ARM OpenFirmare page size (4k).
	 */
	cp = (char *) ((marks[MARK_END] + 0xfff) & ~0xfff);
	size = (u_long) (endbuf - cp);
	if (size)
		OF_release(cp, size);

#ifdef	__notyet__
	OF_setprop(chosen, "bootpath", opened_name, strlen(opened_name) + 1);
	cp = bootline;
#else
	strcpy(bootline, opened_name);
	cp = bootline + strlen(bootline);
	*cp++ = ' ';
#endif
	*cp = '-';
	if (boothowto & RB_ASKNAME)
		*++cp = 'a';
	if (boothowto & RB_SINGLE)
		*++cp = 's';
	if (boothowto & RB_KDB)
		*++cp = 'd';
	if (*cp == '-')
#ifdef	__notyet__
		*cp = 0;
#else
		*--cp = 0;
#endif
	else