Tue Mar 30 01:50:13 2021 UTC ()
- Document IBM/AMCC Walnut is supported by this file.
- Misc style fixes.


(rin)
diff -r1.6 -r1.7 src/sys/arch/powerpc/ibm4xx/openbios/openbios.c

cvs diff -r1.6 -r1.7 src/sys/arch/powerpc/ibm4xx/openbios/openbios.c (expand / switch to unified diff)

--- src/sys/arch/powerpc/ibm4xx/openbios/openbios.c 2021/03/30 01:47:45 1.6
+++ src/sys/arch/powerpc/ibm4xx/openbios/openbios.c 2021/03/30 01:50:13 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: openbios.c,v 1.6 2021/03/30 01:47:45 rin Exp $ */ 1/* $NetBSD: openbios.c,v 1.7 2021/03/30 01:50:13 rin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2004 Shigeyuki Fukushima. 4 * Copyright (c) 2004 Shigeyuki Fukushima.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above 12 * 2. Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following 13 * copyright notice, this list of conditions and the following
14 * disclaimer in the documentation and/or other materials provided 14 * disclaimer in the documentation and/or other materials provided
@@ -21,39 +21,40 @@ @@ -21,39 +21,40 @@
21 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
24 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
26 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: openbios.c,v 1.6 2021/03/30 01:47:45 rin Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: openbios.c,v 1.7 2021/03/30 01:50:13 rin Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/cpu.h> 38#include <sys/cpu.h>
39 39
40#include <powerpc/ibm4xx/cpu.h> 40#include <powerpc/ibm4xx/cpu.h>
41#include <powerpc/ibm4xx/openbios.h> 41#include <powerpc/ibm4xx/openbios.h>
42 42
43/* 43/*
44 * Board configuration structure from the OpenBIOS. 44 * Board configuration structure from the OpenBIOS.
45 * 45 *
46 * Supported (XXX): 46 * Supported (XXX):
 47 * IBM/AMCC Walnut PowerPC 405GP Evaluation Board
47 * 405GPr 1.2 ROM Monitor (5/25/02) 48 * 405GPr 1.2 ROM Monitor (5/25/02)
48 */ 49 */
49struct board_bios_data { 50struct board_bios_data {
50 unsigned char usr_config_ver[4]; 51 unsigned char usr_config_ver[4];
51 unsigned char rom_sw_ver[30]; 52 unsigned char rom_sw_ver[30];
52 unsigned int mem_size; 53 unsigned int mem_size;
53 unsigned char mac_address_local[6]; 54 unsigned char mac_address_local[6];
54 unsigned char mac_address_pci[6]; 55 unsigned char mac_address_pci[6];
55 unsigned int processor_speed; 56 unsigned int processor_speed;
56 unsigned int plb_speed; 57 unsigned int plb_speed;
57 unsigned int pci_speed; 58 unsigned int pci_speed;
58}; 59};
59 60
@@ -63,26 +64,27 @@ void @@ -63,26 +64,27 @@ void
63openbios_board_init(void *info_block) 64openbios_board_init(void *info_block)
64{ 65{
65 66
66 /* Initialize cache info for memcpy, etc. */ 67 /* Initialize cache info for memcpy, etc. */
67 cpu_probe_cache(); 68 cpu_probe_cache();
68 69
69 /* Save info block */ 70 /* Save info block */
70 memcpy(&board_bios, info_block, sizeof(board_bios)); 71 memcpy(&board_bios, info_block, sizeof(board_bios));
71} 72}
72 73
73unsigned int 74unsigned int
74openbios_board_memsize_get(void) 75openbios_board_memsize_get(void)
75{ 76{
 77
76 return board_bios.mem_size; 78 return board_bios.mem_size;
77} 79}
78 80
79void 81void
80openbios_board_info_set(void) 82openbios_board_info_set(void)
81{ 83{
82 prop_number_t pn; 84 prop_number_t pn;
83 prop_string_t ps; 85 prop_string_t ps;
84 prop_data_t pd; 86 prop_data_t pd;
85 87
86 /* Initialize board properties database */ 88 /* Initialize board properties database */
87 board_info_init(); 89 board_info_init();
88 90
@@ -132,27 +134,26 @@ openbios_board_info_set(void) @@ -132,27 +134,26 @@ openbios_board_info_set(void)
132 pn = prop_number_create_integer(board_bios.plb_speed); 134 pn = prop_number_create_integer(board_bios.plb_speed);
133 KASSERT(pn != NULL); 135 KASSERT(pn != NULL);
134 if (prop_dictionary_set(board_properties, "plb-frequency", pn) == false) 136 if (prop_dictionary_set(board_properties, "plb-frequency", pn) == false)
135 panic("setting plb-frequency"); 137 panic("setting plb-frequency");
136 prop_object_release(pn); 138 prop_object_release(pn);
137 139
138 pn = prop_number_create_integer(board_bios.pci_speed); 140 pn = prop_number_create_integer(board_bios.pci_speed);
139 KASSERT(pn != NULL); 141 KASSERT(pn != NULL);
140 if (prop_dictionary_set(board_properties, "pci-frequency", pn) == false) 142 if (prop_dictionary_set(board_properties, "pci-frequency", pn) == false)
141 panic("setting pci-frequency"); 143 panic("setting pci-frequency");
142 prop_object_release(pn); 144 prop_object_release(pn);
143} 145}
144 146
145 
146void 147void
147openbios_board_print(void) 148openbios_board_print(void)
148{ 149{
149 150
150 printf("Board config data:\n"); 151 printf("Board config data:\n");
151 printf(" usr_config_ver = %s\n", board_bios.usr_config_ver); 152 printf(" usr_config_ver = %s\n", board_bios.usr_config_ver);
152 printf(" rom_sw_ver = %s\n", board_bios.rom_sw_ver); 153 printf(" rom_sw_ver = %s\n", board_bios.rom_sw_ver);
153 printf(" mem_size = %u\n", board_bios.mem_size); 154 printf(" mem_size = %u\n", board_bios.mem_size);
154 printf(" mac_address_local = %02x:%02x:%02x:%02x:%02x:%02x\n", 155 printf(" mac_address_local = %02x:%02x:%02x:%02x:%02x:%02x\n",
155 board_bios.mac_address_local[0], board_bios.mac_address_local[1], 156 board_bios.mac_address_local[0], board_bios.mac_address_local[1],
156 board_bios.mac_address_local[2], board_bios.mac_address_local[3], 157 board_bios.mac_address_local[2], board_bios.mac_address_local[3],
157 board_bios.mac_address_local[4], board_bios.mac_address_local[5]); 158 board_bios.mac_address_local[4], board_bios.mac_address_local[5]);
158 printf(" mac_address_pci = %02x:%02x:%02x:%02x:%02x:%02x\n", 159 printf(" mac_address_pci = %02x:%02x:%02x:%02x:%02x:%02x\n",