Home | History | Annotate | Line # | Download | only in iq80310
iq80310_machdep.c revision 1.86.14.3
      1  1.86.14.3  pgoyette /*	$NetBSD: iq80310_machdep.c,v 1.86.14.3 2018/11/26 01:52:22 pgoyette Exp $	*/
      2       1.12   thorpej 
      3       1.12   thorpej /*
      4       1.48   thorpej  * Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc.
      5       1.12   thorpej  * All rights reserved.
      6       1.12   thorpej  *
      7       1.12   thorpej  * Written by Jason R. Thorpe for Wasabi Systems, Inc.
      8       1.12   thorpej  *
      9       1.12   thorpej  * Redistribution and use in source and binary forms, with or without
     10       1.12   thorpej  * modification, are permitted provided that the following conditions
     11       1.12   thorpej  * are met:
     12       1.12   thorpej  * 1. Redistributions of source code must retain the above copyright
     13       1.12   thorpej  *    notice, this list of conditions and the following disclaimer.
     14       1.12   thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     15       1.12   thorpej  *    notice, this list of conditions and the following disclaimer in the
     16       1.12   thorpej  *    documentation and/or other materials provided with the distribution.
     17       1.12   thorpej  * 3. All advertising materials mentioning features or use of this software
     18       1.12   thorpej  *    must display the following acknowledgement:
     19       1.12   thorpej  *	This product includes software developed for the NetBSD Project by
     20       1.12   thorpej  *	Wasabi Systems, Inc.
     21       1.12   thorpej  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
     22       1.12   thorpej  *    or promote products derived from this software without specific prior
     23       1.12   thorpej  *    written permission.
     24       1.12   thorpej  *
     25       1.12   thorpej  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
     26       1.12   thorpej  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     27       1.12   thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     28       1.12   thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
     29       1.12   thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     30       1.12   thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     31       1.12   thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     32       1.12   thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     33       1.12   thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     34       1.12   thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     35       1.12   thorpej  * POSSIBILITY OF SUCH DAMAGE.
     36       1.12   thorpej  */
     37        1.1      matt 
     38        1.1      matt /*
     39        1.1      matt  * Copyright (c) 1997,1998 Mark Brinicombe.
     40        1.1      matt  * Copyright (c) 1997,1998 Causality Limited.
     41        1.1      matt  * All rights reserved.
     42        1.1      matt  *
     43        1.1      matt  * Redistribution and use in source and binary forms, with or without
     44        1.1      matt  * modification, are permitted provided that the following conditions
     45        1.1      matt  * are met:
     46        1.1      matt  * 1. Redistributions of source code must retain the above copyright
     47        1.1      matt  *    notice, this list of conditions and the following disclaimer.
     48        1.1      matt  * 2. Redistributions in binary form must reproduce the above copyright
     49        1.1      matt  *    notice, this list of conditions and the following disclaimer in the
     50        1.1      matt  *    documentation and/or other materials provided with the distribution.
     51        1.1      matt  * 3. All advertising materials mentioning features or use of this software
     52        1.1      matt  *    must display the following acknowledgement:
     53        1.1      matt  *	This product includes software developed by Mark Brinicombe
     54        1.1      matt  *	for the NetBSD Project.
     55        1.1      matt  * 4. The name of the company nor the name of the author may be used to
     56        1.1      matt  *    endorse or promote products derived from this software without specific
     57        1.1      matt  *    prior written permission.
     58        1.1      matt  *
     59        1.1      matt  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
     60        1.1      matt  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     61        1.1      matt  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     62        1.1      matt  * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
     63        1.1      matt  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     64        1.1      matt  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     65        1.1      matt  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     66        1.1      matt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     67        1.1      matt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     68        1.1      matt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     69        1.1      matt  * SUCH DAMAGE.
     70        1.1      matt  *
     71       1.79       wiz  * Machine dependent functions for kernel setup for Intel IQ80310 evaluation
     72        1.2   thorpej  * boards using RedBoot firmware.
     73        1.1      matt  */
     74       1.61     lukem 
     75       1.61     lukem #include <sys/cdefs.h>
     76  1.86.14.3  pgoyette __KERNEL_RCSID(0, "$NetBSD: iq80310_machdep.c,v 1.86.14.3 2018/11/26 01:52:22 pgoyette Exp $");
     77        1.1      matt 
     78  1.86.14.1  pgoyette #include "opt_arm_debug.h"
     79  1.86.14.2  pgoyette #include "opt_console.h"
     80        1.1      matt #include "opt_ddb.h"
     81        1.1      matt #include "opt_pmap_debug.h"
     82        1.1      matt 
     83        1.1      matt #include <sys/param.h>
     84        1.1      matt #include <sys/device.h>
     85        1.1      matt #include <sys/systm.h>
     86        1.1      matt #include <sys/kernel.h>
     87        1.1      matt #include <sys/exec.h>
     88        1.1      matt #include <sys/proc.h>
     89        1.1      matt #include <sys/msgbuf.h>
     90        1.1      matt #include <sys/reboot.h>
     91        1.1      matt #include <sys/termios.h>
     92       1.50     ragge #include <sys/ksyms.h>
     93       1.84      matt #include <sys/bus.h>
     94       1.84      matt #include <sys/cpu.h>
     95        1.1      matt 
     96       1.47   thorpej #include <uvm/uvm_extern.h>
     97       1.47   thorpej 
     98        1.1      matt #include <dev/cons.h>
     99        1.1      matt 
    100        1.1      matt #include <machine/db_machdep.h>
    101        1.1      matt #include <ddb/db_sym.h>
    102        1.1      matt #include <ddb/db_extern.h>
    103        1.1      matt 
    104        1.1      matt #include <machine/bootconfig.h>
    105       1.84      matt #include <arm/locore.h>
    106       1.10   thorpej #include <arm/undefined.h>
    107        1.1      matt 
    108       1.16   thorpej #include <arm/arm32/machdep.h>
    109       1.16   thorpej 
    110        1.1      matt #include <arm/xscale/i80312reg.h>
    111        1.1      matt #include <arm/xscale/i80312var.h>
    112        1.1      matt 
    113        1.3   thorpej #include <dev/pci/ppbreg.h>
    114        1.3   thorpej 
    115        1.2   thorpej #include <evbarm/iq80310/iq80310reg.h>
    116        1.2   thorpej #include <evbarm/iq80310/iq80310var.h>
    117        1.2   thorpej #include <evbarm/iq80310/obiovar.h>
    118        1.2   thorpej 
    119       1.50     ragge #include "ksyms.h"
    120       1.54   thorpej 
    121       1.54   thorpej /* Kernel text starts 2MB in from the bottom of the kernel address space. */
    122       1.54   thorpej #define	KERNEL_TEXT_BASE	(KERNEL_BASE + 0x00200000)
    123       1.56   thorpej #define	KERNEL_VM_BASE		(KERNEL_BASE + 0x01000000)
    124       1.57   thorpej 
    125       1.57   thorpej /*
    126       1.57   thorpej  * The range 0xc1000000 - 0xccffffff is available for kernel VM space
    127       1.57   thorpej  * Core-logic registers and I/O mappings occupy 0xfd000000 - 0xffffffff
    128       1.57   thorpej  */
    129       1.57   thorpej #define KERNEL_VM_SIZE		0x0C000000
    130        1.1      matt 
    131        1.1      matt BootConfig bootconfig;		/* Boot config storage */
    132        1.1      matt char *boot_args = NULL;
    133        1.1      matt char *boot_file = NULL;
    134        1.1      matt 
    135       1.85      matt vaddr_t physical_start;
    136       1.85      matt vaddr_t physical_freestart;
    137       1.85      matt vaddr_t physical_freeend;
    138       1.85      matt vaddr_t physical_end;
    139        1.1      matt u_int free_pages;
    140        1.1      matt 
    141        1.1      matt /*int debug_flags;*/
    142        1.1      matt #ifndef PMAP_STATIC_L1S
    143        1.1      matt int max_processes = 64;			/* Default number */
    144        1.1      matt #endif	/* !PMAP_STATIC_L1S */
    145        1.1      matt 
    146        1.8   thorpej pv_addr_t minidataclean;
    147        1.1      matt 
    148       1.85      matt paddr_t msgbufphys;
    149        1.1      matt 
    150        1.1      matt #ifdef PMAP_DEBUG
    151        1.1      matt extern int pmap_debug_level;
    152        1.1      matt #endif
    153        1.1      matt 
    154       1.27   thorpej #define KERNEL_PT_SYS		0	/* L2 table for mapping zero page */
    155       1.27   thorpej 
    156       1.27   thorpej #define KERNEL_PT_KERNEL	1	/* L2 table for mapping kernel */
    157       1.62   thorpej #define	KERNEL_PT_KERNEL_NUM	4
    158       1.27   thorpej 
    159       1.27   thorpej 					/* L2 table for mapping i80312 */
    160       1.27   thorpej #define	KERNEL_PT_IOPXS		(KERNEL_PT_KERNEL + KERNEL_PT_KERNEL_NUM)
    161       1.27   thorpej 
    162       1.27   thorpej 					/* L2 tables for mapping kernel VM */
    163       1.27   thorpej #define KERNEL_PT_VMDATA	(KERNEL_PT_IOPXS + 1)
    164       1.32     chris #define	KERNEL_PT_VMDATA_NUM	4	/* start with 16MB of KVM */
    165        1.1      matt #define NUM_KERNEL_PTS		(KERNEL_PT_VMDATA + KERNEL_PT_VMDATA_NUM)
    166        1.1      matt 
    167       1.27   thorpej pv_addr_t kernel_pt_table[NUM_KERNEL_PTS];
    168        1.1      matt 
    169        1.1      matt /* Prototypes */
    170        1.1      matt 
    171        1.2   thorpej void	consinit(void);
    172        1.1      matt 
    173        1.1      matt #include "com.h"
    174        1.2   thorpej #if NCOM > 0
    175        1.1      matt #include <dev/ic/comreg.h>
    176        1.1      matt #include <dev/ic/comvar.h>
    177        1.1      matt #endif
    178        1.1      matt 
    179       1.20   thorpej /*
    180       1.20   thorpej  * Define the default console speed for the board.  This is generally
    181       1.20   thorpej  * what the firmware provided with the board defaults to.
    182       1.20   thorpej  */
    183        1.1      matt #ifndef CONSPEED
    184       1.20   thorpej #define CONSPEED B115200
    185       1.20   thorpej #endif /* ! CONSPEED */
    186       1.20   thorpej 
    187       1.20   thorpej #ifndef CONUNIT
    188       1.20   thorpej #define	CONUNIT	0
    189        1.1      matt #endif
    190       1.20   thorpej 
    191        1.1      matt #ifndef CONMODE
    192        1.1      matt #define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
    193       1.15   thorpej #endif
    194        1.1      matt 
    195        1.1      matt int comcnspeed = CONSPEED;
    196        1.1      matt int comcnmode = CONMODE;
    197       1.15   thorpej int comcnunit = CONUNIT;
    198        1.1      matt 
    199        1.1      matt /*
    200        1.1      matt  * void cpu_reboot(int howto, char *bootstr)
    201        1.1      matt  *
    202        1.1      matt  * Reboots the system
    203        1.1      matt  *
    204        1.1      matt  * Deal with any syncing, unmounting, dumping and shutdown hooks,
    205        1.1      matt  * then reset the CPU.
    206        1.1      matt  */
    207        1.1      matt void
    208        1.1      matt cpu_reboot(int howto, char *bootstr)
    209        1.1      matt {
    210        1.1      matt 
    211        1.1      matt 	/*
    212        1.1      matt 	 * If we are still cold then hit the air brakes
    213        1.1      matt 	 * and crash to earth fast
    214        1.1      matt 	 */
    215        1.1      matt 	if (cold) {
    216        1.1      matt 		doshutdownhooks();
    217       1.71    dyoung 		pmf_system_shutdown(boothowto);
    218        1.1      matt 		printf("The operating system has halted.\n");
    219        1.1      matt 		printf("Please press any key to reboot.\n\n");
    220        1.1      matt 		cngetc();
    221        1.1      matt 		printf("rebooting...\n");
    222        1.1      matt 		cpu_reset();
    223        1.1      matt 		/*NOTREACHED*/
    224        1.1      matt 	}
    225        1.1      matt 
    226        1.1      matt 	/* Disable console buffering */
    227        1.1      matt 
    228        1.1      matt 	/*
    229        1.1      matt 	 * If RB_NOSYNC was not specified sync the discs.
    230        1.2   thorpej 	 * Note: Unless cold is set to 1 here, syslogd will die during the
    231        1.2   thorpej 	 * unmount.  It looks like syslogd is getting woken up only to find
    232        1.2   thorpej 	 * that it cannot page part of the binary in as the filesystem has
    233        1.2   thorpej 	 * been unmounted.
    234        1.1      matt 	 */
    235        1.1      matt 	if (!(howto & RB_NOSYNC))
    236        1.1      matt 		bootsync();
    237        1.1      matt 
    238        1.1      matt 	/* Say NO to interrupts */
    239        1.1      matt 	splhigh();
    240        1.1      matt 
    241        1.1      matt 	/* Do a dump if requested. */
    242        1.1      matt 	if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP)
    243        1.1      matt 		dumpsys();
    244        1.1      matt 
    245        1.1      matt 	/* Run any shutdown hooks */
    246        1.1      matt 	doshutdownhooks();
    247        1.1      matt 
    248       1.71    dyoung 	pmf_system_shutdown(boothowto);
    249       1.71    dyoung 
    250        1.1      matt 	/* Make sure IRQ's are disabled */
    251        1.1      matt 	IRQdisable;
    252        1.1      matt 
    253        1.1      matt 	if (howto & RB_HALT) {
    254       1.40   thorpej 		iq80310_7seg('.', '.');
    255        1.1      matt 		printf("The operating system has halted.\n");
    256        1.1      matt 		printf("Please press any key to reboot.\n\n");
    257        1.1      matt 		cngetc();
    258        1.1      matt 	}
    259        1.1      matt 
    260        1.1      matt 	printf("rebooting...\n");
    261        1.1      matt 	cpu_reset();
    262        1.1      matt 	/*NOTREACHED*/
    263        1.1      matt }
    264        1.1      matt 
    265       1.59   thorpej /* Static device mappings. */
    266       1.59   thorpej static const struct pmap_devmap iq80310_devmap[] = {
    267        1.2   thorpej     /*
    268        1.2   thorpej      * Map the on-board devices VA == PA so that we can access them
    269        1.2   thorpej      * with the MMU on or off.
    270        1.2   thorpej      */
    271        1.2   thorpej     {
    272        1.2   thorpej 	IQ80310_OBIO_BASE,
    273        1.2   thorpej 	IQ80310_OBIO_BASE,
    274        1.2   thorpej 	IQ80310_OBIO_SIZE,
    275       1.21   thorpej 	VM_PROT_READ|VM_PROT_WRITE,
    276       1.21   thorpej 	PTE_NOCACHE,
    277        1.2   thorpej     },
    278       1.59   thorpej     {
    279       1.59   thorpej 	IQ80310_PIOW_VBASE,
    280       1.59   thorpej 	I80312_PCI_XLATE_PIOW_BASE,
    281       1.59   thorpej 	I80312_PCI_XLATE_IOSIZE,
    282       1.59   thorpej 	VM_PROT_READ|VM_PROT_WRITE,
    283       1.59   thorpej 	PTE_NOCACHE,
    284       1.59   thorpej     },
    285       1.59   thorpej     {
    286       1.59   thorpej 	IQ80310_SIOW_VBASE,
    287       1.59   thorpej 	I80312_PCI_XLATE_SIOW_BASE,
    288       1.59   thorpej 	I80312_PCI_XLATE_IOSIZE,
    289       1.59   thorpej 	VM_PROT_READ|VM_PROT_WRITE,
    290       1.59   thorpej 	PTE_NOCACHE,
    291       1.59   thorpej     },
    292       1.59   thorpej     {
    293       1.59   thorpej 	IQ80310_80312_VBASE,
    294       1.59   thorpej 	I80312_PMMR_BASE,
    295       1.59   thorpej 	I80312_PMMR_SIZE,
    296       1.59   thorpej 	VM_PROT_READ|VM_PROT_WRITE,
    297       1.59   thorpej 	PTE_NOCACHE,
    298       1.59   thorpej     },
    299        1.2   thorpej 
    300        1.1      matt     {
    301        1.1      matt 	0,
    302        1.1      matt 	0,
    303        1.1      matt 	0,
    304        1.1      matt 	0,
    305       1.21   thorpej 	0,
    306        1.1      matt     }
    307        1.1      matt };
    308        1.1      matt 
    309        1.1      matt /*
    310        1.2   thorpej  * u_int initarm(...)
    311        1.1      matt  *
    312        1.1      matt  * Initial entry point on startup. This gets called before main() is
    313        1.1      matt  * entered.
    314        1.1      matt  * It should be responsible for setting up everything that must be
    315        1.1      matt  * in place when main is called.
    316        1.1      matt  * This includes
    317        1.1      matt  *   Taking a copy of the boot configuration structure.
    318        1.1      matt  *   Initialising the physical console so characters can be printed.
    319        1.1      matt  *   Setting up page tables for the kernel
    320        1.1      matt  *   Relocating the kernel to the bottom of physical memory
    321        1.1      matt  */
    322        1.1      matt u_int
    323       1.16   thorpej initarm(void *arg)
    324        1.1      matt {
    325       1.38   thorpej 	extern vaddr_t xscale_cache_clean_addr;
    326       1.46   thorpej #ifdef DIAGNOSTIC
    327        1.8   thorpej 	extern vsize_t xscale_minidata_clean_size;
    328       1.46   thorpej #endif
    329        1.1      matt 	int loop;
    330        1.1      matt 	int loop1;
    331        1.1      matt 	u_int l1pagetable;
    332        1.2   thorpej 	paddr_t memstart;
    333        1.2   thorpej 	psize_t memsize;
    334        1.2   thorpej 
    335        1.2   thorpej 	/*
    336        1.2   thorpej 	 * Clear out the 7-segment display.  Whee, the first visual
    337        1.2   thorpej 	 * indication that we're running kernel code.
    338        1.2   thorpej 	 */
    339        1.2   thorpej 	iq80310_7seg(' ', ' ');
    340        1.1      matt 
    341        1.1      matt 	/*
    342        1.1      matt 	 * Heads up ... Setup the CPU / MMU / TLB functions
    343        1.1      matt 	 */
    344        1.1      matt 	if (set_cpufuncs())
    345       1.63       wiz 		panic("CPU not recognized!");
    346        1.1      matt 
    347        1.2   thorpej 	/* Calibrate the delay loop. */
    348        1.2   thorpej 	iq80310_calibrate_delay();
    349        1.1      matt 
    350        1.1      matt 	/*
    351        1.2   thorpej 	 * Since we map the on-board devices VA==PA, and the kernel
    352        1.2   thorpej 	 * is running VA==PA, it's possible for us to initialize
    353        1.2   thorpej 	 * the console now.
    354        1.1      matt 	 */
    355        1.2   thorpej 	consinit();
    356        1.1      matt 
    357       1.55   thorpej #ifdef VERBOSE_INIT_ARM
    358        1.1      matt 	/* Talk to the user */
    359        1.2   thorpej 	printf("\nNetBSD/evbarm (IQ80310) booting ...\n");
    360       1.55   thorpej #endif
    361        1.1      matt 
    362        1.1      matt 	/*
    363        1.3   thorpej 	 * Reset the secondary PCI bus.  RedBoot doesn't stop devices
    364        1.3   thorpej 	 * on the PCI bus before handing us control, so we have to
    365        1.3   thorpej 	 * do this.
    366        1.3   thorpej 	 *
    367        1.3   thorpej 	 * XXX This is arguably a bug in RedBoot, and doing this reset
    368        1.3   thorpej 	 * XXX could be problematic in the future if we encounter an
    369        1.3   thorpej 	 * XXX application where the PPB in the i80312 is used as a
    370        1.3   thorpej 	 * XXX PPB.
    371        1.3   thorpej 	 */
    372        1.3   thorpej 	{
    373        1.3   thorpej 		uint32_t reg;
    374        1.3   thorpej 
    375       1.55   thorpej #ifdef VERBOSE_INIT_ARM
    376        1.3   thorpej 		printf("Resetting secondary PCI bus...\n");
    377       1.55   thorpej #endif
    378        1.3   thorpej 		reg = bus_space_read_4(&obio_bs_tag,
    379        1.3   thorpej 		    I80312_PMMR_BASE + I80312_PPB_BASE, PPB_REG_BRIDGECONTROL);
    380        1.3   thorpej 		bus_space_write_4(&obio_bs_tag,
    381        1.3   thorpej 		    I80312_PMMR_BASE + I80312_PPB_BASE, PPB_REG_BRIDGECONTROL,
    382        1.3   thorpej 		    reg | PPB_BC_SECONDARY_RESET);
    383        1.3   thorpej 		delay(10 * 1000);	/* 10ms enough? */
    384        1.3   thorpej 		bus_space_write_4(&obio_bs_tag,
    385        1.3   thorpej 		    I80312_PMMR_BASE + I80312_PPB_BASE, PPB_REG_BRIDGECONTROL,
    386        1.3   thorpej 		    reg);
    387        1.3   thorpej 	}
    388        1.3   thorpej 
    389        1.3   thorpej 	/*
    390       1.33   thorpej 	 * We are currently running with the MMU enabled and the
    391       1.33   thorpej 	 * entire address space mapped VA==PA, except for the
    392       1.33   thorpej 	 * first 64M of RAM is also double-mapped at 0xc0000000.
    393       1.33   thorpej 	 * There is an L1 page table at 0xa0004000.
    394        1.1      matt 	 */
    395        1.1      matt 
    396        1.2   thorpej 	/*
    397       1.65       abs 	 * Fetch the SDRAM start/size from the i80312 SDRAM configuration
    398        1.2   thorpej 	 * registers.
    399        1.2   thorpej 	 */
    400        1.3   thorpej 	i80312_sdram_bounds(&obio_bs_tag, I80312_PMMR_BASE + I80312_MEM_BASE,
    401        1.3   thorpej 	    &memstart, &memsize);
    402        1.2   thorpej 
    403       1.55   thorpej #ifdef VERBOSE_INIT_ARM
    404        1.1      matt 	printf("initarm: Configuring system ...\n");
    405       1.55   thorpej #endif
    406        1.1      matt 
    407        1.2   thorpej 	/* Fake bootconfig structure for the benefit of pmap.c */
    408       1.68       wiz 	/* XXX must make the memory description h/w independent */
    409        1.2   thorpej 	bootconfig.dramblocks = 1;
    410        1.2   thorpej 	bootconfig.dram[0].address = memstart;
    411       1.47   thorpej 	bootconfig.dram[0].pages = memsize / PAGE_SIZE;
    412        1.2   thorpej 
    413        1.1      matt 	/*
    414        1.1      matt 	 * Set up the variables that define the availablilty of
    415        1.2   thorpej 	 * physical memory.  For now, we're going to set
    416        1.2   thorpej 	 * physical_freestart to 0xa0200000 (where the kernel
    417        1.2   thorpej 	 * was loaded), and allocate the memory we need downwards.
    418       1.33   thorpej 	 * If we get too close to the L1 table that we set up, we
    419       1.33   thorpej 	 * will panic.  We will update physical_freestart and
    420       1.33   thorpej 	 * physical_freeend later to reflect what pmap_bootstrap()
    421        1.2   thorpej 	 * wants to see.
    422        1.2   thorpej 	 *
    423        1.2   thorpej 	 * XXX pmap_bootstrap() needs an enema.
    424        1.1      matt 	 */
    425        1.2   thorpej 	physical_start = bootconfig.dram[0].address;
    426       1.47   thorpej 	physical_end = physical_start + (bootconfig.dram[0].pages * PAGE_SIZE);
    427        1.2   thorpej 
    428        1.2   thorpej 	physical_freestart = 0xa0009000UL;
    429        1.2   thorpej 	physical_freeend = 0xa0200000UL;
    430        1.2   thorpej 
    431       1.47   thorpej 	physmem = (physical_end - physical_start) / PAGE_SIZE;
    432        1.1      matt 
    433       1.55   thorpej #ifdef VERBOSE_INIT_ARM
    434        1.1      matt 	/* Tell the user about the memory */
    435        1.1      matt 	printf("physmemory: %d pages at 0x%08lx -> 0x%08lx\n", physmem,
    436        1.1      matt 	    physical_start, physical_end - 1);
    437       1.55   thorpej #endif
    438        1.1      matt 
    439        1.1      matt 	/*
    440        1.2   thorpej 	 * Okay, the kernel starts 2MB in from the bottom of physical
    441        1.2   thorpej 	 * memory.  We are going to allocate our bootstrap pages downwards
    442        1.2   thorpej 	 * from there.
    443        1.2   thorpej 	 *
    444        1.2   thorpej 	 * We need to allocate some fixed page tables to get the kernel
    445        1.2   thorpej 	 * going.  We allocate one page directory and a number of page
    446        1.2   thorpej 	 * tables and store the physical addresses in the kernel_pt_table
    447        1.2   thorpej 	 * array.
    448        1.1      matt 	 *
    449        1.2   thorpej 	 * The kernel page directory must be on a 16K boundary.  The page
    450       1.65       abs 	 * tables must be on 4K boundaries.  What we do is allocate the
    451        1.2   thorpej 	 * page directory on the first 16K boundary that we encounter, and
    452        1.2   thorpej 	 * the page tables on 4K boundaries otherwise.  Since we allocate
    453        1.2   thorpej 	 * at least 3 L2 page tables, we are guaranteed to encounter at
    454        1.2   thorpej 	 * least one 16K aligned region.
    455        1.1      matt 	 */
    456        1.1      matt 
    457        1.1      matt #ifdef VERBOSE_INIT_ARM
    458        1.1      matt 	printf("Allocating page tables\n");
    459        1.1      matt #endif
    460        1.1      matt 
    461       1.47   thorpej 	free_pages = (physical_freeend - physical_freestart) / PAGE_SIZE;
    462        1.1      matt 
    463        1.1      matt #ifdef VERBOSE_INIT_ARM
    464        1.2   thorpej 	printf("freestart = 0x%08lx, free_pages = %d (0x%08x)\n",
    465        1.1      matt 	       physical_freestart, free_pages, free_pages);
    466        1.1      matt #endif
    467        1.1      matt 
    468        1.1      matt 	/* Define a macro to simplify memory allocation */
    469        1.2   thorpej #define	valloc_pages(var, np)				\
    470        1.2   thorpej 	alloc_pages((var).pv_pa, (np));			\
    471        1.1      matt 	(var).pv_va = KERNEL_BASE + (var).pv_pa - physical_start;
    472        1.1      matt 
    473        1.2   thorpej #define alloc_pages(var, np)				\
    474       1.47   thorpej 	physical_freeend -= ((np) * PAGE_SIZE);		\
    475        1.2   thorpej 	if (physical_freeend < physical_freestart)	\
    476        1.2   thorpej 		panic("initarm: out of memory");	\
    477        1.2   thorpej 	(var) = physical_freeend;			\
    478        1.2   thorpej 	free_pages -= (np);				\
    479       1.47   thorpej 	memset((char *)(var), 0, ((np) * PAGE_SIZE));
    480        1.1      matt 
    481        1.1      matt 	loop1 = 0;
    482        1.1      matt 	for (loop = 0; loop <= NUM_KERNEL_PTS; ++loop) {
    483        1.1      matt 		/* Are we 16KB aligned for an L1 ? */
    484       1.37   thorpej 		if (((physical_freeend - L1_TABLE_SIZE) & (L1_TABLE_SIZE - 1)) == 0
    485        1.1      matt 		    && kernel_l1pt.pv_pa == 0) {
    486       1.47   thorpej 			valloc_pages(kernel_l1pt, L1_TABLE_SIZE / PAGE_SIZE);
    487        1.1      matt 		} else {
    488       1.48   thorpej 			valloc_pages(kernel_pt_table[loop1],
    489       1.48   thorpej 			    L2_TABLE_SIZE / PAGE_SIZE);
    490        1.1      matt 			++loop1;
    491        1.1      matt 		}
    492        1.1      matt 	}
    493        1.1      matt 
    494        1.1      matt 	/* This should never be able to happen but better confirm that. */
    495       1.37   thorpej 	if (!kernel_l1pt.pv_pa || (kernel_l1pt.pv_pa & (L1_TABLE_SIZE-1)) != 0)
    496       1.45    provos 		panic("initarm: Failed to align the kernel page directory");
    497        1.1      matt 
    498        1.1      matt 	/*
    499        1.1      matt 	 * Allocate a page for the system page mapped to V0x00000000
    500        1.1      matt 	 * This page will just contain the system vectors and can be
    501        1.1      matt 	 * shared by all processes.
    502        1.1      matt 	 */
    503        1.1      matt 	alloc_pages(systempage.pv_pa, 1);
    504        1.1      matt 
    505        1.1      matt 	/* Allocate stacks for all modes */
    506        1.1      matt 	valloc_pages(irqstack, IRQ_STACK_SIZE);
    507        1.1      matt 	valloc_pages(abtstack, ABT_STACK_SIZE);
    508        1.1      matt 	valloc_pages(undstack, UND_STACK_SIZE);
    509        1.1      matt 	valloc_pages(kernelstack, UPAGES);
    510        1.1      matt 
    511        1.8   thorpej 	/* Allocate enough pages for cleaning the Mini-Data cache. */
    512       1.47   thorpej 	KASSERT(xscale_minidata_clean_size <= PAGE_SIZE);
    513        1.8   thorpej 	valloc_pages(minidataclean, 1);
    514        1.8   thorpej 
    515        1.1      matt #ifdef VERBOSE_INIT_ARM
    516        1.2   thorpej 	printf("IRQ stack: p0x%08lx v0x%08lx\n", irqstack.pv_pa,
    517        1.2   thorpej 	    irqstack.pv_va);
    518        1.2   thorpej 	printf("ABT stack: p0x%08lx v0x%08lx\n", abtstack.pv_pa,
    519        1.2   thorpej 	    abtstack.pv_va);
    520        1.2   thorpej 	printf("UND stack: p0x%08lx v0x%08lx\n", undstack.pv_pa,
    521        1.2   thorpej 	    undstack.pv_va);
    522        1.2   thorpej 	printf("SVC stack: p0x%08lx v0x%08lx\n", kernelstack.pv_pa,
    523        1.2   thorpej 	    kernelstack.pv_va);
    524        1.1      matt #endif
    525        1.1      matt 
    526        1.2   thorpej 	/*
    527        1.2   thorpej 	 * XXX Defer this to later so that we can reclaim the memory
    528        1.2   thorpej 	 * XXX used by the RedBoot page tables.
    529        1.2   thorpej 	 */
    530       1.47   thorpej 	alloc_pages(msgbufphys, round_page(MSGBUFSIZE) / PAGE_SIZE);
    531        1.1      matt 
    532        1.1      matt 	/*
    533        1.1      matt 	 * Ok we have allocated physical pages for the primary kernel
    534        1.1      matt 	 * page tables
    535        1.1      matt 	 */
    536        1.1      matt 
    537        1.1      matt #ifdef VERBOSE_INIT_ARM
    538        1.2   thorpej 	printf("Creating L1 page table at 0x%08lx\n", kernel_l1pt.pv_pa);
    539        1.1      matt #endif
    540        1.1      matt 
    541        1.1      matt 	/*
    542       1.24     skrll 	 * Now we start construction of the L1 page table
    543        1.1      matt 	 * We start by mapping the L2 page tables into the L1.
    544        1.1      matt 	 * This means that we can replace L1 mappings later on if necessary
    545        1.1      matt 	 */
    546        1.1      matt 	l1pagetable = kernel_l1pt.pv_pa;
    547        1.1      matt 
    548        1.1      matt 	/* Map the L2 pages tables in the L1 page table */
    549       1.49   thorpej 	pmap_link_l2pt(l1pagetable, ARM_VECTORS_HIGH & ~(0x00400000 - 1),
    550       1.27   thorpej 	    &kernel_pt_table[KERNEL_PT_SYS]);
    551       1.27   thorpej 	for (loop = 0; loop < KERNEL_PT_KERNEL_NUM; loop++)
    552       1.27   thorpej 		pmap_link_l2pt(l1pagetable, KERNEL_BASE + loop * 0x00400000,
    553       1.27   thorpej 		    &kernel_pt_table[KERNEL_PT_KERNEL + loop]);
    554       1.23   thorpej 	pmap_link_l2pt(l1pagetable, IQ80310_IOPXS_VBASE,
    555       1.27   thorpej 	    &kernel_pt_table[KERNEL_PT_IOPXS]);
    556       1.27   thorpej 	for (loop = 0; loop < KERNEL_PT_VMDATA_NUM; loop++)
    557       1.23   thorpej 		pmap_link_l2pt(l1pagetable, KERNEL_VM_BASE + loop * 0x00400000,
    558       1.27   thorpej 		    &kernel_pt_table[KERNEL_PT_VMDATA + loop]);
    559       1.32     chris 
    560       1.32     chris 	/* update the top of the kernel VM */
    561       1.33   thorpej 	pmap_curmaxkvaddr =
    562       1.35   thorpej 	    KERNEL_VM_BASE + (KERNEL_PT_VMDATA_NUM * 0x00400000);
    563        1.1      matt 
    564        1.1      matt #ifdef VERBOSE_INIT_ARM
    565        1.1      matt 	printf("Mapping kernel\n");
    566        1.1      matt #endif
    567        1.1      matt 
    568        1.1      matt 	/* Now we fill in the L2 pagetable for the kernel static code/data */
    569        1.1      matt 	{
    570        1.2   thorpej 		extern char etext[], _end[];
    571        1.2   thorpej 		size_t textsize = (uintptr_t) etext - KERNEL_TEXT_BASE;
    572        1.2   thorpej 		size_t totalsize = (uintptr_t) _end - KERNEL_TEXT_BASE;
    573        1.1      matt 		u_int logical;
    574        1.1      matt 
    575       1.14   thorpej 		textsize = (textsize + PGOFSET) & ~PGOFSET;
    576        1.1      matt 		totalsize = (totalsize + PGOFSET) & ~PGOFSET;
    577        1.2   thorpej 
    578        1.2   thorpej 		logical = 0x00200000;	/* offset of kernel in RAM */
    579        1.2   thorpej 
    580       1.27   thorpej 		logical += pmap_map_chunk(l1pagetable, KERNEL_BASE + logical,
    581        1.1      matt 		    physical_start + logical, textsize,
    582       1.25   thorpej 		    VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
    583       1.27   thorpej 		logical += pmap_map_chunk(l1pagetable, KERNEL_BASE + logical,
    584        1.1      matt 		    physical_start + logical, totalsize - textsize,
    585       1.25   thorpej 		    VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
    586        1.1      matt 	}
    587        1.1      matt 
    588        1.1      matt #ifdef VERBOSE_INIT_ARM
    589        1.1      matt 	printf("Constructing L2 page tables\n");
    590        1.1      matt #endif
    591        1.1      matt 
    592        1.1      matt 	/* Map the stack pages */
    593       1.27   thorpej 	pmap_map_chunk(l1pagetable, irqstack.pv_va, irqstack.pv_pa,
    594       1.47   thorpej 	    IRQ_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
    595       1.27   thorpej 	pmap_map_chunk(l1pagetable, abtstack.pv_va, abtstack.pv_pa,
    596       1.47   thorpej 	    ABT_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
    597       1.27   thorpej 	pmap_map_chunk(l1pagetable, undstack.pv_va, undstack.pv_pa,
    598       1.47   thorpej 	    UND_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
    599       1.27   thorpej 	pmap_map_chunk(l1pagetable, kernelstack.pv_va, kernelstack.pv_pa,
    600       1.47   thorpej 	    UPAGES * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
    601       1.25   thorpej 
    602       1.48   thorpej 	pmap_map_chunk(l1pagetable, kernel_l1pt.pv_va, kernel_l1pt.pv_pa,
    603       1.48   thorpej 	    L1_TABLE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE);
    604       1.48   thorpej 
    605       1.48   thorpej 	for (loop = 0; loop < NUM_KERNEL_PTS; ++loop) {
    606       1.48   thorpej 		pmap_map_chunk(l1pagetable, kernel_pt_table[loop].pv_va,
    607       1.48   thorpej 		    kernel_pt_table[loop].pv_pa, L2_TABLE_SIZE,
    608       1.48   thorpej 		    VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE);
    609       1.48   thorpej 	}
    610        1.1      matt 
    611        1.8   thorpej 	/* Map the Mini-Data cache clean area. */
    612       1.38   thorpej 	xscale_setup_minidata(l1pagetable, minidataclean.pv_va,
    613       1.38   thorpej 	    minidataclean.pv_pa);
    614        1.8   thorpej 
    615       1.36   thorpej 	/* Map the vector page. */
    616       1.49   thorpej 	pmap_map_entry(l1pagetable, ARM_VECTORS_HIGH, systempage.pv_pa,
    617       1.22   thorpej 	    VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
    618        1.1      matt 
    619       1.59   thorpej 	/* Map the statically mapped devices. */
    620       1.59   thorpej 	pmap_devmap_bootstrap(l1pagetable, iq80310_devmap);
    621        1.8   thorpej 
    622        1.8   thorpej 	/*
    623        1.8   thorpej 	 * Give the XScale global cache clean code an appropriately
    624        1.8   thorpej 	 * sized chunk of unmapped VA space starting at 0xff000000
    625        1.8   thorpej 	 * (our device mappings end before this address).
    626        1.8   thorpej 	 */
    627        1.8   thorpej 	xscale_cache_clean_addr = 0xff000000U;
    628        1.1      matt 
    629        1.1      matt 	/*
    630        1.1      matt 	 * Now we have the real page tables in place so we can switch to them.
    631        1.2   thorpej 	 * Once this is done we will be running with the REAL kernel page
    632        1.2   thorpej 	 * tables.
    633        1.2   thorpej 	 */
    634        1.2   thorpej 
    635        1.2   thorpej 	/*
    636        1.2   thorpej 	 * Update the physical_freestart/physical_freeend/free_pages
    637        1.2   thorpej 	 * variables.
    638        1.1      matt 	 */
    639        1.2   thorpej 	{
    640        1.2   thorpej 		extern char _end[];
    641        1.2   thorpej 
    642       1.33   thorpej 		physical_freestart = physical_start +
    643       1.33   thorpej 		    (((((uintptr_t) _end) + PGOFSET) & ~PGOFSET) -
    644       1.33   thorpej 		     KERNEL_BASE);
    645        1.2   thorpej 		physical_freeend = physical_end;
    646       1.47   thorpej 		free_pages =
    647       1.47   thorpej 		    (physical_freeend - physical_freestart) / PAGE_SIZE;
    648        1.2   thorpej 	}
    649        1.1      matt 
    650        1.1      matt 	/* Switch tables */
    651        1.1      matt #ifdef VERBOSE_INIT_ARM
    652        1.2   thorpej 	printf("freestart = 0x%08lx, free_pages = %d (0x%x)\n",
    653        1.1      matt 	       physical_freestart, free_pages, free_pages);
    654        1.1      matt 	printf("switching to new L1 page table  @%#lx...", kernel_l1pt.pv_pa);
    655        1.1      matt #endif
    656       1.48   thorpej 	cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT);
    657       1.83      matt 	cpu_setttb(kernel_l1pt.pv_pa, true);
    658       1.30   thorpej 	cpu_tlb_flushID();
    659       1.48   thorpej 	cpu_domains(DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2));
    660       1.48   thorpej 
    661       1.48   thorpej 	/*
    662       1.48   thorpej 	 * Moved from cpu_startup() as data_abort_handler() references
    663       1.48   thorpej 	 * this during uvm init
    664       1.48   thorpej 	 */
    665       1.76     rmind 	uvm_lwp_setuarea(&lwp0, kernelstack.pv_va);
    666        1.1      matt 
    667        1.1      matt #ifdef VERBOSE_INIT_ARM
    668        1.1      matt 	printf("done!\n");
    669        1.1      matt #endif
    670        1.1      matt 
    671        1.1      matt #ifdef VERBOSE_INIT_ARM
    672        1.1      matt 	printf("bootstrap done.\n");
    673        1.1      matt #endif
    674        1.1      matt 
    675       1.49   thorpej 	arm32_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
    676        1.1      matt 
    677        1.1      matt 	/*
    678        1.1      matt 	 * Pages were allocated during the secondary bootstrap for the
    679        1.1      matt 	 * stacks for different CPU modes.
    680        1.1      matt 	 * We must now set the r13 registers in the different CPU modes to
    681        1.1      matt 	 * point to these stacks.
    682        1.1      matt 	 * Since the ARM stacks use STMFD etc. we must set r13 to the top end
    683        1.1      matt 	 * of the stack memory.
    684        1.1      matt 	 */
    685       1.55   thorpej #ifdef VERBOSE_INIT_ARM
    686        1.1      matt 	printf("init subsystems: stacks ");
    687       1.55   thorpej #endif
    688        1.1      matt 
    689       1.47   thorpej 	set_stackptr(PSR_IRQ32_MODE,
    690       1.47   thorpej 	    irqstack.pv_va + IRQ_STACK_SIZE * PAGE_SIZE);
    691       1.47   thorpej 	set_stackptr(PSR_ABT32_MODE,
    692       1.47   thorpej 	    abtstack.pv_va + ABT_STACK_SIZE * PAGE_SIZE);
    693       1.47   thorpej 	set_stackptr(PSR_UND32_MODE,
    694       1.47   thorpej 	    undstack.pv_va + UND_STACK_SIZE * PAGE_SIZE);
    695        1.1      matt 
    696        1.1      matt 	/*
    697        1.1      matt 	 * Well we should set a data abort handler.
    698        1.2   thorpej 	 * Once things get going this will change as we will need a proper
    699        1.2   thorpej 	 * handler.
    700        1.1      matt 	 * Until then we will use a handler that just panics but tells us
    701        1.1      matt 	 * why.
    702        1.1      matt 	 * Initialisation of the vectors will just panic on a data abort.
    703       1.64       abs 	 * This just fills in a slightly better one.
    704        1.1      matt 	 */
    705       1.55   thorpej #ifdef VERBOSE_INIT_ARM
    706        1.1      matt 	printf("vectors ");
    707       1.55   thorpej #endif
    708        1.1      matt 	data_abort_handler_address = (u_int)data_abort_handler;
    709        1.1      matt 	prefetch_abort_handler_address = (u_int)prefetch_abort_handler;
    710        1.1      matt 	undefined_handler_address = (u_int)undefinedinstruction_bounce;
    711        1.1      matt 
    712        1.1      matt 	/* Initialise the undefined instruction handlers */
    713       1.55   thorpej #ifdef VERBOSE_INIT_ARM
    714        1.1      matt 	printf("undefined ");
    715       1.55   thorpej #endif
    716        1.1      matt 	undefined_init();
    717        1.1      matt 
    718       1.42   thorpej 	/* Load memory into UVM. */
    719       1.55   thorpej #ifdef VERBOSE_INIT_ARM
    720       1.42   thorpej 	printf("page ");
    721       1.55   thorpej #endif
    722       1.86    cherry 	uvm_md_init();
    723       1.42   thorpej 	uvm_page_physload(atop(physical_freestart), atop(physical_freeend),
    724       1.42   thorpej 	    atop(physical_freestart), atop(physical_freeend),
    725       1.42   thorpej 	    VM_FREELIST_DEFAULT);
    726       1.42   thorpej 
    727  1.86.14.3  pgoyette 	/* Boot strap pmap telling it where managed kernel virtual memory is */
    728       1.55   thorpej #ifdef VERBOSE_INIT_ARM
    729        1.1      matt 	printf("pmap ");
    730       1.55   thorpej #endif
    731       1.70      matt 	pmap_bootstrap(KERNEL_VM_BASE, KERNEL_VM_BASE + KERNEL_VM_SIZE);
    732        1.1      matt 
    733        1.1      matt 	/* Setup the IRQ system */
    734       1.55   thorpej #ifdef VERBOSE_INIT_ARM
    735        1.1      matt 	printf("irq ");
    736       1.55   thorpej #endif
    737       1.18   thorpej 	iq80310_intr_init();
    738       1.55   thorpej 
    739       1.55   thorpej #ifdef VERBOSE_INIT_ARM
    740        1.1      matt 	printf("done.\n");
    741       1.55   thorpej #endif
    742        1.1      matt 
    743        1.1      matt #ifdef DDB
    744        1.1      matt 	db_machine_init();
    745        1.1      matt 	if (boothowto & RB_KDB)
    746        1.1      matt 		Debugger();
    747        1.1      matt #endif
    748        1.1      matt 
    749        1.1      matt 	/* We return the new stack pointer address */
    750        1.1      matt 	return(kernelstack.pv_va + USPACE_SVC_STACK_TOP);
    751        1.1      matt }
    752        1.1      matt 
    753        1.1      matt void
    754        1.1      matt consinit(void)
    755        1.1      matt {
    756       1.15   thorpej 	static const bus_addr_t comcnaddrs[] = {
    757       1.15   thorpej 		IQ80310_UART2,		/* com0 (J9) */
    758       1.15   thorpej 		IQ80310_UART1,		/* com1 (J10) */
    759       1.15   thorpej 	};
    760        1.2   thorpej 	static int consinit_called;
    761        1.1      matt 
    762        1.1      matt 	if (consinit_called != 0)
    763        1.1      matt 		return;
    764        1.1      matt 
    765        1.1      matt 	consinit_called = 1;
    766       1.60   thorpej 
    767       1.60   thorpej 	/*
    768       1.60   thorpej 	 * Console devices are mapped VA==PA.  Our devmap reflects
    769       1.60   thorpej 	 * this, so register it now so drivers can map the console
    770       1.60   thorpej 	 * device.
    771       1.60   thorpej 	 */
    772       1.60   thorpej 	pmap_devmap_register(iq80310_devmap);
    773        1.1      matt 
    774        1.2   thorpej #if NCOM > 0
    775       1.15   thorpej 	if (comcnattach(&obio_bs_tag, comcnaddrs[comcnunit], comcnspeed,
    776       1.58   thorpej 	    COM_FREQ, COM_TYPE_NORMAL, comcnmode))
    777       1.19   thorpej 		panic("can't init serial console @%lx", comcnaddrs[comcnunit]);
    778        1.1      matt #else
    779       1.19   thorpej 	panic("serial console @%lx not configured", comcnaddrs[comcnunit]);
    780        1.1      matt #endif
    781        1.1      matt }
    782