1 1.6 matt /* $NetBSD: ibm40x_machdep.c,v 1.6 2011/06/18 06:41:41 matt Exp $ */ 2 1.1 shige 3 1.1 shige /* 4 1.1 shige * Copyright 2001, 2002 Wasabi Systems, Inc. 5 1.1 shige * All rights reserved. 6 1.1 shige * 7 1.1 shige * Written by Eduardo Horvath and Simon Burge for Wasabi Systems, Inc. 8 1.1 shige * 9 1.1 shige * Redistribution and use in source and binary forms, with or without 10 1.1 shige * modification, are permitted provided that the following conditions 11 1.1 shige * are met: 12 1.1 shige * 1. Redistributions of source code must retain the above copyright 13 1.1 shige * notice, this list of conditions and the following disclaimer. 14 1.1 shige * 2. Redistributions in binary form must reproduce the above copyright 15 1.1 shige * notice, this list of conditions and the following disclaimer in the 16 1.1 shige * documentation and/or other materials provided with the distribution. 17 1.1 shige * 3. All advertising materials mentioning features or use of this software 18 1.1 shige * must display the following acknowledgement: 19 1.1 shige * This product includes software developed for the NetBSD Project by 20 1.1 shige * Wasabi Systems, Inc. 21 1.1 shige * 4. The name of Wasabi Systems, Inc. may not be used to endorse 22 1.1 shige * or promote products derived from this software without specific prior 23 1.1 shige * written permission. 24 1.1 shige * 25 1.1 shige * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND 26 1.1 shige * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 27 1.1 shige * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28 1.1 shige * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 29 1.1 shige * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 1.1 shige * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 1.1 shige * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 1.1 shige * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 1.1 shige * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 1.1 shige * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 1.1 shige * POSSIBILITY OF SUCH DAMAGE. 36 1.1 shige */ 37 1.1 shige 38 1.1 shige /* 39 1.1 shige * Copyright (C) 1995, 1996 Wolfgang Solfrank. 40 1.1 shige * Copyright (C) 1995, 1996 TooLs GmbH. 41 1.1 shige * All rights reserved. 42 1.1 shige * 43 1.1 shige * Redistribution and use in source and binary forms, with or without 44 1.1 shige * modification, are permitted provided that the following conditions 45 1.1 shige * are met: 46 1.1 shige * 1. Redistributions of source code must retain the above copyright 47 1.1 shige * notice, this list of conditions and the following disclaimer. 48 1.1 shige * 2. Redistributions in binary form must reproduce the above copyright 49 1.1 shige * notice, this list of conditions and the following disclaimer in the 50 1.1 shige * documentation and/or other materials provided with the distribution. 51 1.1 shige * 3. All advertising materials mentioning features or use of this software 52 1.1 shige * must display the following acknowledgement: 53 1.1 shige * This product includes software developed by TooLs GmbH. 54 1.1 shige * 4. The name of TooLs GmbH may not be used to endorse or promote products 55 1.1 shige * derived from this software without specific prior written permission. 56 1.1 shige * 57 1.1 shige * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 58 1.1 shige * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 59 1.1 shige * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 60 1.1 shige * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 61 1.1 shige * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 62 1.1 shige * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 63 1.1 shige * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 64 1.1 shige * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 65 1.1 shige * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 66 1.1 shige * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 67 1.1 shige */ 68 1.1 shige 69 1.1 shige #include <sys/cdefs.h> 70 1.6 matt __KERNEL_RCSID(0, "$NetBSD: ibm40x_machdep.c,v 1.6 2011/06/18 06:41:41 matt Exp $"); 71 1.1 shige 72 1.1 shige #include <sys/param.h> 73 1.1 shige #include <sys/exec.h> 74 1.1 shige #include <sys/systm.h> 75 1.6 matt #include <sys/cpu.h> 76 1.1 shige 77 1.1 shige #include <machine/powerpc.h> 78 1.1 shige 79 1.6 matt #include <powerpc/ibm4xx/cpu.h> 80 1.6 matt 81 1.1 shige /* 82 1.1 shige * Global variables used here and there 83 1.1 shige */ 84 1.4 shige #define MEMREGIONS (8) 85 1.1 shige struct mem_region physmemr[MEMREGIONS]; /* Hard code memory */ 86 1.1 shige struct mem_region availmemr[MEMREGIONS];/* Who's supposed to set these up? */ 87 1.1 shige 88 1.1 shige void 89 1.3 shige ibm40x_memsize_init(u_int memsize, u_int startkernel) 90 1.1 shige { 91 1.3 shige 92 1.4 shige /* Initialize cache info for memcpy, etc. */ 93 1.4 shige cpu_probe_cache(); 94 1.1 shige 95 1.1 shige memset(physmemr, 0, sizeof physmemr); 96 1.1 shige memset(availmemr, 0, sizeof availmemr); 97 1.4 shige 98 1.4 shige /* Setup physical memory */ 99 1.1 shige physmemr[0].start = 0; 100 1.3 shige physmemr[0].size = memsize & ~PGOFSET; 101 1.4 shige 102 1.4 shige /* Setup availabl memory, lower memory reserved by evb-BIOS */ 103 1.1 shige availmemr[0].start = startkernel; 104 1.3 shige availmemr[0].size = memsize - availmemr[0].start; 105 1.1 shige } 106 1.1 shige 107 1.1 shige void 108 1.1 shige mem_regions(struct mem_region **mem, struct mem_region **avail) 109 1.1 shige { 110 1.1 shige *mem = physmemr; 111 1.1 shige *avail = availmemr; 112 1.1 shige } 113