File: [local] / sys / arch / mvmeppc / mvmeppc / autoconf.c (download)
Revision 1.1.1.1 (vendor branch), Tue Mar 4 16:07:46 2008 UTC (16 years, 3 months ago) by nbrk
Branch: OPENBSD_4_2_BASE, MAIN
CVS Tags: jornada-partial-support-wip, HEAD Changes since 1.1: +0 -0 lines
Import of OpenBSD 4.2 release kernel tree with initial code to support
Jornada 720/728, StrongARM 1110-based handheld PC.
At this point kernel roots on NFS and boots into vfs_mountroot() and traps.
What is supported:
- glass console, Jornada framebuffer (jfb) works in 16bpp direct color mode
(needs some palette tweaks for non black/white/blue colors, i think)
- saic, SA11x0 interrupt controller (needs cleanup)
- sacom, SA11x0 UART (supported only as boot console for now)
- SA11x0 GPIO controller fully supported (but can't handle multiple interrupt
handlers on one gpio pin)
- sassp, SSP port on SA11x0 that attaches spibus
- Jornada microcontroller (jmcu) to control kbd, battery, etc throught
the SPI bus (wskbd attaches on jmcu, but not tested)
- tod functions seem work
- initial code for SA-1111 (chip companion) : this is TODO
Next important steps, i think:
- gpio and intc on sa1111
- pcmcia support for sa11x0 (and sa1111 help logic)
- REAL root on nfs when we have PCMCIA support (we may use any of supported pccard NICs)
- root on wd0! (using already supported PCMCIA-ATA)
|
/* $OpenBSD: autoconf.c,v 1.19 2007/06/01 23:14:07 deraadt Exp $ */
/*
* Copyright (c) 1996, 1997 Per Fogelstrom
* Copyright (c) 1995 Theo de Raadt
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department and Ralph Campbell.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Utah Hdr: autoconf.c 1.31 91/01/21
*
* from: @(#)autoconf.c 8.1 (Berkeley) 6/10/93
* $Id: autoconf.c,v 1.1.1.1 2008/03/04 16:07:46 nbrk Exp $
*/
/*
* Setup the system to run on the current machine.
*
* cpu_configure() is called at boot time. Available
* devices are determined (from possibilities mentioned in ioconf.c),
* and the drivers are initialized.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/disklabel.h>
#include <sys/conf.h>
#include <sys/reboot.h>
#include <sys/device.h>
#include <machine/autoconf.h>
#include <machine/bugio.h>
extern void dumpconf(void);
struct device *getdevunit(char *, int);
void calc_delayconst(void); /* clock.c */
/*
* The following several variables are related to
* the configuration process, and are used in initializing
* the machine.
*/
int cold = 1; /* if 1, still working on cold-start */
int bootdev; /* boot device as provided by locore */
struct device *bootdv = NULL;
/*
* Configure all devices found that we know about.
* This is done at boot time.
*/
void
cpu_configure()
{
(void)splhigh(); /* To be really sure.. */
calc_delayconst();
if (config_rootfound("mainbus", "mainbus") == 0)
panic("no mainbus found");
ppc_intr_enable(1);
spl0();
/*
* We can not select the root device yet, because we use bugtty
* as the console for now, and it requires the clock to be ticking
* for proper operation (think boot -a ...)
*/
cold = 0;
}
void
diskconf(void)
{
printf("boot device: %s\n",
(bootdv != NULL) ? bootdv->dv_xname : "<unknown>");
setroot(bootdv, 0, RB_USERREQ);
#if 0
dumpconf();
#endif
}
/*
* Crash dump handling.
*/
u_long dumpmag = 0x8fca0101; /* magic number */
int dumpsize = 0; /* size of dump in pages */
long dumplo = -1; /* blocks */
/*
* This is called by configure to set dumplo and dumpsize.
* Dumps always skip the first CLBYTES of disk space
* in case there might be a disk label stored there.
* If there is extra space, put dump at the end to
* reduce the chance that swapping trashes it.
*/
#if 0
void
dumpconf(void)
{
int nblks; /* size of dump area */
if (dumpdev == NODEV ||
(nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0)
return;
if (nblks <= ctod(1))
return;
dumpsize = btoc(IOM_END + ctob(dumpmem_high));
/* Always skip the first CLBYTES, in case there is a label there. */
if (dumplo < ctod(1))
dumplo = ctod(1);
/* Put dump at end of partition, and make it fit. */
if (dumpsize > dtoc(nblks - dumplo))
dumpsize = dtoc(nblks - dumplo);
if (dumplo < nblks - ctod(dumpsize))
dumplo = nblks - ctod(dumpsize);
}
#endif
/*
* find a device matching "name" and unit number
*/
struct device *
getdevunit(name, unit)
char *name;
int unit;
{
struct device *dev = TAILQ_FIRST(&alldevs);
char num[10], fullname[16];
int lunit;
/* compute length of name and decimal expansion of unit number */
snprintf(num, sizeof num, "%d", unit);
lunit = strlen(num);
if (strlen(name) + lunit >= sizeof(fullname) - 1)
panic("config_attach: device name too long");
strlcpy(fullname, name, sizeof fullname);
strlcat(fullname, num, sizeof fullname);
while (strcmp(dev->dv_xname, fullname) != 0) {
if ((dev = TAILQ_NEXT(dev, dv_list)) == NULL)
return NULL;
}
return dev;
}
struct nam2blk nam2blk[] = {
{ "wd", 0 },
{ "sd", 2 },
{ "raid", 19 },
{ NULL, -1 }
};