1 1.82 msaitoh /* $NetBSD: integrator_machdep.c,v 1.82 2023/06/24 05:43:26 msaitoh Exp $ */ 2 1.1 rearnsha 3 1.1 rearnsha /* 4 1.23 rearnsha * Copyright (c) 2001,2002 ARM Ltd 5 1.1 rearnsha * All rights reserved. 6 1.1 rearnsha * 7 1.1 rearnsha * Redistribution and use in source and binary forms, with or without 8 1.1 rearnsha * modification, are permitted provided that the following conditions 9 1.1 rearnsha * are met: 10 1.1 rearnsha * 1. Redistributions of source code must retain the above copyright 11 1.1 rearnsha * notice, this list of conditions and the following disclaimer. 12 1.1 rearnsha * 2. Redistributions in binary form must reproduce the above copyright 13 1.1 rearnsha * notice, this list of conditions and the following disclaimer in the 14 1.1 rearnsha * documentation and/or other materials provided with the distribution. 15 1.1 rearnsha * 3. The name of the company may not be used to endorse or promote 16 1.1 rearnsha * products derived from this software without specific prior written 17 1.1 rearnsha * permission. 18 1.1 rearnsha * 19 1.23 rearnsha * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND 20 1.23 rearnsha * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 1.23 rearnsha * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 1.23 rearnsha * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARM LTD 23 1.23 rearnsha * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 1.23 rearnsha * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 1.23 rearnsha * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 1.23 rearnsha * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 1.23 rearnsha * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 1.23 rearnsha * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 1.23 rearnsha * POSSIBILITY OF SUCH DAMAGE. 30 1.23 rearnsha */ 31 1.23 rearnsha 32 1.23 rearnsha /* 33 1.1 rearnsha * Copyright (c) 1997,1998 Mark Brinicombe. 34 1.1 rearnsha * Copyright (c) 1997,1998 Causality Limited. 35 1.1 rearnsha * All rights reserved. 36 1.1 rearnsha * 37 1.1 rearnsha * Redistribution and use in source and binary forms, with or without 38 1.1 rearnsha * modification, are permitted provided that the following conditions 39 1.1 rearnsha * are met: 40 1.1 rearnsha * 1. Redistributions of source code must retain the above copyright 41 1.1 rearnsha * notice, this list of conditions and the following disclaimer. 42 1.1 rearnsha * 2. Redistributions in binary form must reproduce the above copyright 43 1.1 rearnsha * notice, this list of conditions and the following disclaimer in the 44 1.1 rearnsha * documentation and/or other materials provided with the distribution. 45 1.1 rearnsha * 3. All advertising materials mentioning features or use of this software 46 1.1 rearnsha * must display the following acknowledgement: 47 1.1 rearnsha * This product includes software developed by Mark Brinicombe 48 1.1 rearnsha * for the NetBSD Project. 49 1.1 rearnsha * 4. The name of the company nor the name of the author may be used to 50 1.1 rearnsha * endorse or promote products derived from this software without specific 51 1.1 rearnsha * prior written permission. 52 1.1 rearnsha * 53 1.1 rearnsha * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 54 1.1 rearnsha * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 55 1.1 rearnsha * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 56 1.1 rearnsha * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 57 1.1 rearnsha * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 58 1.1 rearnsha * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 59 1.1 rearnsha * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 60 1.1 rearnsha * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 61 1.1 rearnsha * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 62 1.1 rearnsha * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 63 1.1 rearnsha * SUCH DAMAGE. 64 1.1 rearnsha * 65 1.67 wiz * Machine dependent functions for kernel setup for integrator board 66 1.1 rearnsha * 67 1.1 rearnsha * Created : 24/11/97 68 1.1 rearnsha */ 69 1.43 lukem 70 1.43 lukem #include <sys/cdefs.h> 71 1.82 msaitoh __KERNEL_RCSID(0, "$NetBSD: integrator_machdep.c,v 1.82 2023/06/24 05:43:26 msaitoh Exp $"); 72 1.1 rearnsha 73 1.75 skrll #include "opt_arm_debug.h" 74 1.76 skrll #include "opt_console.h" 75 1.1 rearnsha #include "opt_ddb.h" 76 1.1 rearnsha 77 1.1 rearnsha #include <sys/param.h> 78 1.1 rearnsha #include <sys/device.h> 79 1.1 rearnsha #include <sys/systm.h> 80 1.1 rearnsha #include <sys/kernel.h> 81 1.1 rearnsha #include <sys/exec.h> 82 1.1 rearnsha #include <sys/proc.h> 83 1.1 rearnsha #include <sys/msgbuf.h> 84 1.1 rearnsha #include <sys/reboot.h> 85 1.1 rearnsha #include <sys/termios.h> 86 1.32 ragge #include <sys/ksyms.h> 87 1.74 matt #include <sys/bus.h> 88 1.74 matt #include <sys/cpu.h> 89 1.74 matt #include <sys/intr.h> 90 1.1 rearnsha 91 1.31 thorpej #include <uvm/uvm_extern.h> 92 1.31 thorpej 93 1.1 rearnsha #include <dev/cons.h> 94 1.1 rearnsha 95 1.1 rearnsha #include <machine/db_machdep.h> 96 1.1 rearnsha #include <ddb/db_sym.h> 97 1.1 rearnsha #include <ddb/db_extern.h> 98 1.1 rearnsha 99 1.1 rearnsha #include <machine/bootconfig.h> 100 1.74 matt #include <arm/locore.h> 101 1.6 thorpej #include <arm/undefined.h> 102 1.1 rearnsha 103 1.23 rearnsha #include <arm/arm32/machdep.h> 104 1.23 rearnsha 105 1.1 rearnsha #include <evbarm/integrator/integrator_boot.h> 106 1.1 rearnsha 107 1.1 rearnsha #include "pci.h" 108 1.32 ragge #include "ksyms.h" 109 1.1 rearnsha 110 1.1 rearnsha void ifpga_reset(void) __attribute__((noreturn)); 111 1.36 thorpej 112 1.40 thorpej /* 113 1.40 thorpej * The range 0xc1000000 - 0xccffffff is available for kernel VM space 114 1.40 thorpej * Core-logic registers and I/O mappings occupy 0xfd000000 - 0xffffffff 115 1.40 thorpej */ 116 1.73 skrll #define KERNEL_VM_BASE (KERNEL_BASE + 0x01000000) 117 1.40 thorpej #define KERNEL_VM_SIZE 0x0C000000 118 1.36 thorpej 119 1.1 rearnsha BootConfig bootconfig; /* Boot config storage */ 120 1.1 rearnsha char *boot_args = NULL; 121 1.1 rearnsha char *boot_file = NULL; 122 1.1 rearnsha 123 1.1 rearnsha /* Prototypes */ 124 1.1 rearnsha 125 1.23 rearnsha static void integrator_sdram_bounds (paddr_t *, psize_t *); 126 1.1 rearnsha 127 1.23 rearnsha void consinit(void); 128 1.1 rearnsha 129 1.1 rearnsha /* A load of console goo. */ 130 1.1 rearnsha #include "vga.h" 131 1.23 rearnsha #if NVGA > 0 132 1.1 rearnsha #include <dev/ic/mc6845reg.h> 133 1.1 rearnsha #include <dev/ic/pcdisplayvar.h> 134 1.1 rearnsha #include <dev/ic/vgareg.h> 135 1.1 rearnsha #include <dev/ic/vgavar.h> 136 1.1 rearnsha #endif 137 1.1 rearnsha 138 1.1 rearnsha #include "pckbc.h" 139 1.23 rearnsha #if NPCKBC > 0 140 1.1 rearnsha #include <dev/ic/i8042reg.h> 141 1.1 rearnsha #include <dev/ic/pckbcvar.h> 142 1.1 rearnsha #endif 143 1.1 rearnsha 144 1.1 rearnsha #include "com.h" 145 1.23 rearnsha #if NCOM > 0 146 1.1 rearnsha #include <dev/ic/comreg.h> 147 1.1 rearnsha #include <dev/ic/comvar.h> 148 1.1 rearnsha #ifndef CONCOMADDR 149 1.1 rearnsha #define CONCOMADDR 0x3f8 150 1.1 rearnsha #endif 151 1.1 rearnsha #endif 152 1.1 rearnsha 153 1.23 rearnsha /* 154 1.23 rearnsha * Define the default console speed for the board. This is generally 155 1.23 rearnsha * what the firmware provided with the board defaults to. 156 1.23 rearnsha */ 157 1.30 mycroft #ifndef CONSPEED 158 1.1 rearnsha #define CONSPEED B115200 159 1.1 rearnsha #endif 160 1.1 rearnsha #ifndef CONMODE 161 1.1 rearnsha #define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */ 162 1.1 rearnsha #endif 163 1.1 rearnsha 164 1.1 rearnsha int comcnspeed = CONSPEED; 165 1.1 rearnsha int comcnmode = CONMODE; 166 1.1 rearnsha 167 1.1 rearnsha #include "plcom.h" 168 1.1 rearnsha #if (NPLCOM > 0) 169 1.1 rearnsha #include <evbarm/dev/plcomreg.h> 170 1.1 rearnsha #include <evbarm/dev/plcomvar.h> 171 1.1 rearnsha 172 1.1 rearnsha #include <evbarm/ifpga/ifpgamem.h> 173 1.1 rearnsha #include <evbarm/ifpga/ifpgareg.h> 174 1.1 rearnsha #include <evbarm/ifpga/ifpgavar.h> 175 1.1 rearnsha #endif 176 1.1 rearnsha 177 1.1 rearnsha #ifndef CONSDEVNAME 178 1.1 rearnsha #define CONSDEVNAME "plcom" 179 1.1 rearnsha #endif 180 1.1 rearnsha 181 1.1 rearnsha #ifndef PLCONSPEED 182 1.1 rearnsha #define PLCONSPEED B38400 183 1.1 rearnsha #endif 184 1.1 rearnsha #ifndef PLCONMODE 185 1.1 rearnsha #define PLCONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */ 186 1.1 rearnsha #endif 187 1.1 rearnsha #ifndef PLCOMCNUNIT 188 1.1 rearnsha #define PLCOMCNUNIT -1 189 1.1 rearnsha #endif 190 1.1 rearnsha 191 1.1 rearnsha int plcomcnspeed = PLCONSPEED; 192 1.1 rearnsha int plcomcnmode = PLCONMODE; 193 1.1 rearnsha 194 1.1 rearnsha #if 0 195 1.1 rearnsha extern struct consdev kcomcons; 196 1.1 rearnsha static void kcomcnputc(dev_t, int); 197 1.1 rearnsha #endif 198 1.1 rearnsha 199 1.1 rearnsha /* 200 1.1 rearnsha * void cpu_reboot(int howto, char *bootstr) 201 1.1 rearnsha * 202 1.1 rearnsha * Reboots the system 203 1.1 rearnsha * 204 1.1 rearnsha * Deal with any syncing, unmounting, dumping and shutdown hooks, 205 1.1 rearnsha * then reset the CPU. 206 1.1 rearnsha */ 207 1.1 rearnsha void 208 1.23 rearnsha cpu_reboot(int howto, char *bootstr) 209 1.1 rearnsha { 210 1.1 rearnsha 211 1.1 rearnsha /* 212 1.1 rearnsha * If we are still cold then hit the air brakes 213 1.1 rearnsha * and crash to earth fast 214 1.1 rearnsha */ 215 1.1 rearnsha if (cold) { 216 1.1 rearnsha doshutdownhooks(); 217 1.59 dyoung pmf_system_shutdown(boothowto); 218 1.1 rearnsha printf("The operating system has halted.\n"); 219 1.1 rearnsha printf("Please press any key to reboot.\n\n"); 220 1.1 rearnsha cngetc(); 221 1.1 rearnsha printf("rebooting...\n"); 222 1.1 rearnsha ifpga_reset(); 223 1.1 rearnsha /*NOTREACHED*/ 224 1.1 rearnsha } 225 1.1 rearnsha 226 1.1 rearnsha /* Disable console buffering */ 227 1.1 rearnsha 228 1.1 rearnsha /* 229 1.1 rearnsha * If RB_NOSYNC was not specified sync the discs. 230 1.23 rearnsha * Note: Unless cold is set to 1 here, syslogd will die during the 231 1.23 rearnsha * unmount. It looks like syslogd is getting woken up only to find 232 1.23 rearnsha * that it cannot page part of the binary in as the filesystem has 233 1.23 rearnsha * been unmounted. 234 1.1 rearnsha */ 235 1.1 rearnsha if (!(howto & RB_NOSYNC)) 236 1.1 rearnsha bootsync(); 237 1.1 rearnsha 238 1.1 rearnsha /* Say NO to interrupts */ 239 1.1 rearnsha splhigh(); 240 1.1 rearnsha 241 1.1 rearnsha /* Do a dump if requested. */ 242 1.1 rearnsha if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP) 243 1.1 rearnsha dumpsys(); 244 1.78 skrll 245 1.1 rearnsha /* Run any shutdown hooks */ 246 1.1 rearnsha doshutdownhooks(); 247 1.1 rearnsha 248 1.59 dyoung pmf_system_shutdown(boothowto); 249 1.59 dyoung 250 1.1 rearnsha /* Make sure IRQ's are disabled */ 251 1.1 rearnsha IRQdisable; 252 1.1 rearnsha 253 1.1 rearnsha if (howto & RB_HALT) { 254 1.1 rearnsha printf("The operating system has halted.\n"); 255 1.1 rearnsha printf("Please press any key to reboot.\n\n"); 256 1.1 rearnsha cngetc(); 257 1.1 rearnsha } 258 1.1 rearnsha 259 1.1 rearnsha printf("rebooting...\n"); 260 1.1 rearnsha ifpga_reset(); 261 1.1 rearnsha /*NOTREACHED*/ 262 1.1 rearnsha } 263 1.1 rearnsha 264 1.42 thorpej /* Statically mapped devices. */ 265 1.42 thorpej static const struct pmap_devmap integrator_devmap[] = { 266 1.1 rearnsha #if NPLCOM > 0 && defined(PLCONSOLE) 267 1.81 skrll DEVMAP_ENTRY( 268 1.23 rearnsha UART0_BOOT_BASE, 269 1.23 rearnsha IFPGA_IO_BASE + IFPGA_UART0, 270 1.81 skrll 1024 * 1024 271 1.81 skrll ), 272 1.23 rearnsha 273 1.81 skrll DEVMAP_ENTRY( 274 1.23 rearnsha UART1_BOOT_BASE, 275 1.23 rearnsha IFPGA_IO_BASE + IFPGA_UART1, 276 1.81 skrll 1024 * 1024 277 1.81 skrll ), 278 1.1 rearnsha #endif 279 1.1 rearnsha #if NPCI > 0 280 1.81 skrll DEVMAP_ENTRY( 281 1.23 rearnsha IFPGA_PCI_IO_VBASE, 282 1.23 rearnsha IFPGA_PCI_IO_BASE, 283 1.81 skrll IFPGA_PCI_IO_VSIZE 284 1.81 skrll ), 285 1.23 rearnsha 286 1.81 skrll DEVMAP_ENTRY( 287 1.23 rearnsha IFPGA_PCI_CONF_VBASE, 288 1.23 rearnsha IFPGA_PCI_CONF_BASE, 289 1.81 skrll IFPGA_PCI_CONF_VSIZE 290 1.81 skrll ), 291 1.1 rearnsha #endif 292 1.1 rearnsha 293 1.81 skrll DEVMAP_ENTRY_END 294 1.1 rearnsha }; 295 1.1 rearnsha 296 1.1 rearnsha /* 297 1.77 skrll * vaddr_t initarm(...) 298 1.1 rearnsha * 299 1.1 rearnsha * Initial entry point on startup. This gets called before main() is 300 1.1 rearnsha * entered. 301 1.1 rearnsha * It should be responsible for setting up everything that must be 302 1.1 rearnsha * in place when main is called. 303 1.1 rearnsha * This includes 304 1.1 rearnsha * Taking a copy of the boot configuration structure. 305 1.1 rearnsha * Initialising the physical console so characters can be printed. 306 1.1 rearnsha * Setting up page tables for the kernel 307 1.1 rearnsha * Relocating the kernel to the bottom of physical memory 308 1.1 rearnsha */ 309 1.1 rearnsha 310 1.77 skrll vaddr_t 311 1.23 rearnsha initarm(void *arg) 312 1.1 rearnsha { 313 1.73 skrll extern int KERNEL_BASE_phys[]; 314 1.23 rearnsha paddr_t memstart; 315 1.23 rearnsha psize_t memsize; 316 1.71 matt 317 1.1 rearnsha /* 318 1.1 rearnsha * Heads up ... Setup the CPU / MMU / TLB functions 319 1.1 rearnsha */ 320 1.1 rearnsha if (set_cpufuncs()) 321 1.73 skrll panic("cpu not recognized!"); 322 1.1 rearnsha 323 1.73 skrll /* map some peripheral registers */ 324 1.1 rearnsha 325 1.73 skrll pmap_devmap_bootstrap((vaddr_t)armreg_ttbr_read() & -L1_TABLE_SIZE, 326 1.73 skrll integrator_devmap); 327 1.69 skrll 328 1.73 skrll cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT); 329 1.69 skrll 330 1.73 skrll consinit(); 331 1.1 rearnsha 332 1.1 rearnsha /* Talk to the user */ 333 1.73 skrll #define BDSTR(s) _BDSTR(s) 334 1.73 skrll #define _BDSTR(s) #s 335 1.73 skrll printf("\nNetBSD/evbarm (" BDSTR(EVBARM_BOARDTYPE) ") booting ...\n"); 336 1.1 rearnsha 337 1.1 rearnsha /* 338 1.23 rearnsha * Fetch the SDRAM start/size from the CM configuration registers. 339 1.1 rearnsha */ 340 1.23 rearnsha integrator_sdram_bounds(&memstart, &memsize); 341 1.1 rearnsha 342 1.73 skrll #if defined(INTEGRATOR_CP) 343 1.73 skrll /* 344 1.73 skrll * XXX QEMU reports SDRAM starting at 0x100000, but presents a flat 345 1.73 skrll * physical memory model. Set memstart to 0x0, so arm32_bootmem_init 346 1.73 skrll * doesn't get fooled later. 347 1.73 skrll */ 348 1.73 skrll memstart = 0; 349 1.73 skrll #endif 350 1.73 skrll 351 1.38 thorpej #ifdef VERBOSE_INIT_ARM 352 1.1 rearnsha printf("initarm: Configuring system ...\n"); 353 1.38 thorpej #endif 354 1.1 rearnsha 355 1.23 rearnsha /* Fake bootconfig structure for the benefit of pmap.c */ 356 1.23 rearnsha /* XXX must make the memory description h/w independent */ 357 1.23 rearnsha bootconfig.dramblocks = 1; 358 1.23 rearnsha bootconfig.dram[0].address = memstart; 359 1.31 thorpej bootconfig.dram[0].pages = memsize / PAGE_SIZE; 360 1.80 skrll bootconfig.dram[0].flags = BOOT_DRAM_CAN_DMA; 361 1.23 rearnsha 362 1.73 skrll arm32_bootmem_init(bootconfig.dram[0].address, 363 1.73 skrll bootconfig.dram[0].pages * PAGE_SIZE, (unsigned int) KERNEL_BASE_phys); 364 1.1 rearnsha 365 1.73 skrll arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_LOW, 0, integrator_devmap, 366 1.73 skrll false); 367 1.1 rearnsha 368 1.38 thorpej #ifdef VERBOSE_INIT_ARM 369 1.1 rearnsha printf("done.\n"); 370 1.38 thorpej #endif 371 1.1 rearnsha 372 1.73 skrll return initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, NULL, 0); 373 1.1 rearnsha } 374 1.1 rearnsha 375 1.1 rearnsha void 376 1.1 rearnsha consinit(void) 377 1.1 rearnsha { 378 1.1 rearnsha static int consinit_called = 0; 379 1.1 rearnsha #if 0 380 1.1 rearnsha char *console = CONSDEVNAME; 381 1.1 rearnsha #endif 382 1.1 rearnsha 383 1.1 rearnsha if (consinit_called != 0) 384 1.1 rearnsha return; 385 1.1 rearnsha 386 1.1 rearnsha consinit_called = 1; 387 1.1 rearnsha 388 1.1 rearnsha #if NPLCOM > 0 && defined(PLCONSOLE) 389 1.1 rearnsha if (PLCOMCNUNIT == 0) { 390 1.73 skrll extern struct bus_space ifpga_common_bs_tag; 391 1.69 skrll static struct plcom_instance ifpga_pi1 = { 392 1.73 skrll #if defined(INTEGRATOR_CP) 393 1.73 skrll .pi_type = PLCOM_TYPE_PL011, 394 1.73 skrll #else 395 1.69 skrll .pi_type = PLCOM_TYPE_PL010, 396 1.73 skrll #endif 397 1.73 skrll .pi_iot = &ifpga_common_bs_tag, 398 1.69 skrll .pi_size = IFPGA_UART_SIZE, 399 1.73 skrll .pi_iobase = IFPGA_UART0 400 1.69 skrll }; 401 1.69 skrll 402 1.69 skrll if (plcomcnattach(&ifpga_pi1, plcomcnspeed, IFPGA_UART_CLK, 403 1.69 skrll plcomcnmode, PLCOMCNUNIT)) 404 1.1 rearnsha panic("can't init serial console"); 405 1.1 rearnsha return; 406 1.1 rearnsha } else if (PLCOMCNUNIT == 1) { 407 1.73 skrll extern struct bus_space ifpga_common_bs_tag; 408 1.69 skrll static struct plcom_instance ifpga_pi1 = { 409 1.73 skrll #if defined(INTEGRATOR_CP) 410 1.73 skrll .pi_type = PLCOM_TYPE_PL011, 411 1.73 skrll #else 412 1.69 skrll .pi_type = PLCOM_TYPE_PL010, 413 1.73 skrll #endif 414 1.73 skrll .pi_iot = &ifpga_common_bs_tag, 415 1.69 skrll .pi_size = IFPGA_UART_SIZE, 416 1.73 skrll .pi_iobase = IFPGA_UART1 417 1.69 skrll }; 418 1.69 skrll 419 1.69 skrll if (plcomcnattach(&ifpga_pi1, plcomcnspeed, IFPGA_UART_CLK, 420 1.69 skrll plcomcnmode, PLCOMCNUNIT)) 421 1.1 rearnsha panic("can't init serial console"); 422 1.1 rearnsha return; 423 1.1 rearnsha } 424 1.1 rearnsha #endif 425 1.1 rearnsha #if (NCOM > 0) 426 1.1 rearnsha if (comcnattach(&isa_io_bs_tag, CONCOMADDR, comcnspeed, 427 1.41 thorpej COM_FREQ, COM_TYPE_NORMAL, comcnmode)) 428 1.1 rearnsha panic("can't init serial console @%x", CONCOMADDR); 429 1.1 rearnsha return; 430 1.1 rearnsha #endif 431 1.1 rearnsha panic("No serial console configured"); 432 1.23 rearnsha } 433 1.23 rearnsha 434 1.23 rearnsha static void 435 1.23 rearnsha integrator_sdram_bounds(paddr_t *memstart, psize_t *memsize) 436 1.23 rearnsha { 437 1.78 skrll volatile unsigned long *cm_sdram 438 1.23 rearnsha = (volatile unsigned long *)0x10000020; 439 1.46 rearnsha volatile unsigned long *cm_stat 440 1.46 rearnsha = (volatile unsigned long *)0x10000010; 441 1.23 rearnsha 442 1.46 rearnsha *memstart = *cm_stat & 0x00ff0000; 443 1.23 rearnsha 444 1.46 rearnsha /* 445 1.46 rearnsha * Although the SSRAM overlaps the SDRAM, we can use the wrap-around 446 1.46 rearnsha * to access the entire bank. 447 1.46 rearnsha */ 448 1.23 rearnsha switch ((*cm_sdram >> 2) & 0x7) 449 1.23 rearnsha { 450 1.23 rearnsha case 0: 451 1.23 rearnsha *memsize = 16 * 1024 * 1024; 452 1.23 rearnsha break; 453 1.23 rearnsha case 1: 454 1.23 rearnsha *memsize = 32 * 1024 * 1024; 455 1.23 rearnsha break; 456 1.23 rearnsha case 2: 457 1.23 rearnsha *memsize = 64 * 1024 * 1024; 458 1.23 rearnsha break; 459 1.23 rearnsha case 3: 460 1.23 rearnsha *memsize = 128 * 1024 * 1024; 461 1.23 rearnsha break; 462 1.23 rearnsha case 4: 463 1.46 rearnsha /* With 256M of memory there is no wrap-around. */ 464 1.46 rearnsha *memsize = 256 * 1024 * 1024 - *memstart; 465 1.23 rearnsha break; 466 1.23 rearnsha default: 467 1.82 msaitoh printf("CM_SDRAM returns unknown value, using 16M\n"); 468 1.23 rearnsha *memsize = 16 * 1024 * 1024; 469 1.23 rearnsha break; 470 1.23 rearnsha } 471 1.1 rearnsha } 472