1 1.1 pooka /* $NetBSD: init_board.c,v 1.1 2011/01/26 01:18:54 pooka Exp $ */ 2 1.1 pooka 3 1.1 pooka /*- 4 1.1 pooka * Copyright (c) 2010 The NetBSD Foundation, Inc. 5 1.1 pooka * All rights reserved. 6 1.1 pooka * 7 1.1 pooka * This code was written by Alessandro Forin and Neil Pittman 8 1.1 pooka * at Microsoft Research and contributed to The NetBSD Foundation 9 1.1 pooka * by Microsoft Corporation. 10 1.1 pooka * 11 1.1 pooka * Redistribution and use in source and binary forms, with or without 12 1.1 pooka * modification, are permitted provided that the following conditions 13 1.1 pooka * are met: 14 1.1 pooka * 1. Redistributions of source code must retain the above copyright 15 1.1 pooka * notice, this list of conditions and the following disclaimer. 16 1.1 pooka * 2. Redistributions in binary form must reproduce the above copyright 17 1.1 pooka * notice, this list of conditions and the following disclaimer in the 18 1.1 pooka * documentation and/or other materials provided with the distribution. 19 1.1 pooka * 20 1.1 pooka * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 21 1.1 pooka * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 1.1 pooka * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 1.1 pooka * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 24 1.1 pooka * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 1.1 pooka * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 1.1 pooka * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 1.1 pooka * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 1.1 pooka * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 1.1 pooka * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 1.1 pooka * POSSIBILITY OF SUCH DAMAGE. 31 1.1 pooka */ 32 1.1 pooka 33 1.1 pooka #include <sys/types.h> 34 1.1 pooka #include <mips/cpuregs.h> 35 1.1 pooka #include <stand/common/common.h> 36 1.1 pooka #include <stand/common/prom_iface.h> 37 1.1 pooka 38 1.1 pooka int board_config = 0; 39 1.1 pooka int mem_config = 0; 40 1.1 pooka 41 1.1 pooka int 42 1.1 pooka init_board(void) 43 1.1 pooka { 44 1.1 pooka int i = 0; 45 1.1 pooka if (init_usart()) 46 1.1 pooka i |= BOARD_HAS_USART; 47 1.1 pooka if ((mem_config = init_memory()) != 0) 48 1.1 pooka i |= BOARD_HAS_MEM_OK; 49 1.1 pooka if (0 == aceprobe(0)) 50 1.1 pooka i |= BOARD_HAS_DISK0; 51 1.1 pooka if (0 == aceprobe(1)) 52 1.1 pooka i |= BOARD_HAS_DISK1; 53 1.1 pooka if (enic_present(0)) 54 1.1 pooka i |= BOARD_HAS_NET; 55 1.1 pooka board_config = i; 56 1.1 pooka return i; 57 1.1 pooka } 58 1.1 pooka 59 1.1 pooka int getsysid(void) 60 1.1 pooka { 61 1.1 pooka int systype = XS_ML40x; 62 1.1 pooka 63 1.1 pooka /* If it looks like a duck.. 64 1.1 pooka * ML402: 1 SRAM, 1 DRAM, 0 Ether 65 1.1 pooka * ML50x: 0 SRAM, 1 DRAM, 1 Ether 66 1.1 pooka * BEE3: 0 SRAM, 2 DRAM, 1 Ether 67 1.1 pooka * NB: mem_config returns (nfl<<16) | (nsr << 8) | (ndr << 0); 68 1.1 pooka */ 69 1.1 pooka if (board_config & BOARD_HAS_NET) { 70 1.1 pooka if ((mem_config & 0xffff) == 2) 71 1.1 pooka systype = XS_BE3; 72 1.1 pooka else 73 1.1 pooka systype = XS_ML50x; 74 1.1 pooka } 75 1.1 pooka 76 1.1 pooka return MAKESYSID(1,1,systype,MIPS_eMIPS); 77 1.1 pooka } 78 1.1 pooka 79