xref: /netbsd-src/sys/arch/powerpc/ibm4xx/ibm40x_machdep.c (revision 1fd2c684c9742de0d0bf309a40327249ab7b0305)
1*1fd2c684Smatt /*	$NetBSD: ibm40x_machdep.c,v 1.6 2011/06/18 06:41:41 matt Exp $	*/
22977d5a8Sshige 
32977d5a8Sshige /*
42977d5a8Sshige  * Copyright 2001, 2002 Wasabi Systems, Inc.
52977d5a8Sshige  * All rights reserved.
62977d5a8Sshige  *
72977d5a8Sshige  * Written by Eduardo Horvath and Simon Burge for Wasabi Systems, Inc.
82977d5a8Sshige  *
92977d5a8Sshige  * Redistribution and use in source and binary forms, with or without
102977d5a8Sshige  * modification, are permitted provided that the following conditions
112977d5a8Sshige  * are met:
122977d5a8Sshige  * 1. Redistributions of source code must retain the above copyright
132977d5a8Sshige  *    notice, this list of conditions and the following disclaimer.
142977d5a8Sshige  * 2. Redistributions in binary form must reproduce the above copyright
152977d5a8Sshige  *    notice, this list of conditions and the following disclaimer in the
162977d5a8Sshige  *    documentation and/or other materials provided with the distribution.
172977d5a8Sshige  * 3. All advertising materials mentioning features or use of this software
182977d5a8Sshige  *    must display the following acknowledgement:
192977d5a8Sshige  *      This product includes software developed for the NetBSD Project by
202977d5a8Sshige  *      Wasabi Systems, Inc.
212977d5a8Sshige  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
222977d5a8Sshige  *    or promote products derived from this software without specific prior
232977d5a8Sshige  *    written permission.
242977d5a8Sshige  *
252977d5a8Sshige  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
262977d5a8Sshige  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
272977d5a8Sshige  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
282977d5a8Sshige  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
292977d5a8Sshige  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
302977d5a8Sshige  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
312977d5a8Sshige  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
322977d5a8Sshige  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
332977d5a8Sshige  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
342977d5a8Sshige  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
352977d5a8Sshige  * POSSIBILITY OF SUCH DAMAGE.
362977d5a8Sshige  */
372977d5a8Sshige 
382977d5a8Sshige /*
392977d5a8Sshige  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
402977d5a8Sshige  * Copyright (C) 1995, 1996 TooLs GmbH.
412977d5a8Sshige  * All rights reserved.
422977d5a8Sshige  *
432977d5a8Sshige  * Redistribution and use in source and binary forms, with or without
442977d5a8Sshige  * modification, are permitted provided that the following conditions
452977d5a8Sshige  * are met:
462977d5a8Sshige  * 1. Redistributions of source code must retain the above copyright
472977d5a8Sshige  *    notice, this list of conditions and the following disclaimer.
482977d5a8Sshige  * 2. Redistributions in binary form must reproduce the above copyright
492977d5a8Sshige  *    notice, this list of conditions and the following disclaimer in the
502977d5a8Sshige  *    documentation and/or other materials provided with the distribution.
512977d5a8Sshige  * 3. All advertising materials mentioning features or use of this software
522977d5a8Sshige  *    must display the following acknowledgement:
532977d5a8Sshige  *	This product includes software developed by TooLs GmbH.
542977d5a8Sshige  * 4. The name of TooLs GmbH may not be used to endorse or promote products
552977d5a8Sshige  *    derived from this software without specific prior written permission.
562977d5a8Sshige  *
572977d5a8Sshige  * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
582977d5a8Sshige  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
592977d5a8Sshige  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
602977d5a8Sshige  * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
612977d5a8Sshige  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
622977d5a8Sshige  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
632977d5a8Sshige  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
642977d5a8Sshige  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
652977d5a8Sshige  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
662977d5a8Sshige  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
672977d5a8Sshige  */
682977d5a8Sshige 
692977d5a8Sshige #include <sys/cdefs.h>
70*1fd2c684Smatt __KERNEL_RCSID(0, "$NetBSD: ibm40x_machdep.c,v 1.6 2011/06/18 06:41:41 matt Exp $");
712977d5a8Sshige 
722977d5a8Sshige #include <sys/param.h>
732977d5a8Sshige #include <sys/exec.h>
742977d5a8Sshige #include <sys/systm.h>
75*1fd2c684Smatt #include <sys/cpu.h>
762977d5a8Sshige 
772977d5a8Sshige #include <machine/powerpc.h>
782977d5a8Sshige 
79*1fd2c684Smatt #include <powerpc/ibm4xx/cpu.h>
80*1fd2c684Smatt 
812977d5a8Sshige /*
822977d5a8Sshige  * Global variables used here and there
832977d5a8Sshige  */
8495b24072Sshige #define MEMREGIONS	(8)
852977d5a8Sshige struct mem_region physmemr[MEMREGIONS];	/* Hard code memory */
862977d5a8Sshige struct mem_region availmemr[MEMREGIONS];/* Who's supposed to set these up? */
872977d5a8Sshige 
882977d5a8Sshige void
ibm40x_memsize_init(u_int memsize,u_int startkernel)89ce880a59Sshige ibm40x_memsize_init(u_int memsize, u_int startkernel)
902977d5a8Sshige {
91ce880a59Sshige 
922977d5a8Sshige 	/* Initialize cache info for memcpy, etc. */
932977d5a8Sshige 	cpu_probe_cache();
942977d5a8Sshige 
952977d5a8Sshige 	memset(physmemr, 0, sizeof physmemr);
962977d5a8Sshige 	memset(availmemr, 0, sizeof availmemr);
9795b24072Sshige 
9895b24072Sshige 	/* Setup physical memory */
992977d5a8Sshige 	physmemr[0].start = 0;
100ce880a59Sshige 	physmemr[0].size = memsize & ~PGOFSET;
10195b24072Sshige 
10295b24072Sshige 	/* Setup availabl memory, lower memory reserved by evb-BIOS */
1032977d5a8Sshige 	availmemr[0].start = startkernel;
104ce880a59Sshige 	availmemr[0].size = memsize - availmemr[0].start;
1052977d5a8Sshige }
1062977d5a8Sshige 
1072977d5a8Sshige void
mem_regions(struct mem_region ** mem,struct mem_region ** avail)1082977d5a8Sshige mem_regions(struct mem_region **mem, struct mem_region **avail)
1092977d5a8Sshige {
1102977d5a8Sshige 	*mem = physmemr;
1112977d5a8Sshige 	*avail = availmemr;
1122977d5a8Sshige }
113