Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / evbppc / obs405 / dev / century_bios.c
blob8810fe871a132b4534aa14fefec5c41fcb3619b3
1 /* $NetBSD: century_bios.c,v 1.3 2006/05/05 18:04:41 thorpej Exp $ */
3 /*
4 * Copyright (c) 2004 Shigeyuki Fukushima.
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following
14 * disclaimer in the documentation and/or other materials provided
15 * with the distribution.
16 * 3. The name of the author may not be used to endorse or promote
17 * products derived from this software without specific prior
18 * written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
21 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
24 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
26 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
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.
33 #include <sys/cdefs.h>
34 __KERNEL_RCSID(0, "$NetBSD: century_bios.c,v 1.3 2006/05/05 18:04:41 thorpej Exp $");
36 #include <sys/param.h>
37 #include <sys/systm.h>
39 #include <machine/cpu.h>
40 #include <machine/century_bios.h>
43 * OpenBlockS S/R Board configuration structure.
45 * IBM405GP Monitor (Ver. 1.8, REV-01 H/W)
46 * Century Version (MA-300) (Oct. 30, 2001)
48 struct board_bios_data {
49 unsigned char mac_address_local[6];
50 unsigned char boot_mode;
51 unsigned char mem_size; /* MB */
54 static struct board_bios_data board_bios;
55 static unsigned int board_mem_size;
56 static unsigned int board_cpu_speed;
57 static unsigned int board_plb_speed;
58 static unsigned int board_pci_speed;
60 void
61 bios_board_init(void *info_block, u_int sysclk_base)
64 /* Initialize cache info for memcpy, etc. */
65 cpu_probe_cache();
67 /* Save info block */
68 memcpy(&board_bios, info_block, sizeof(board_bios));
69 board_mem_size = board_bios.mem_size * 1024 * 1024;
71 board_cpu_speed = 0x0bebc200;
72 board_plb_speed = 0x05f5e100;
73 board_pci_speed = 0x01f78a40;
76 unsigned int
77 bios_board_memsize_get(void)
79 return board_mem_size;
82 void
83 bios_board_info_set(void)
85 prop_number_t pn;
86 prop_data_t pd;
88 /* Initialize board properties dictionary */
89 board_info_init();
91 pn = prop_number_create_integer(board_mem_size);
92 KASSERT(pn != NULL);
93 if (prop_dictionary_set(board_properties, "mem-size", pn) == false)
94 panic("setting mem-size");
95 prop_object_release(pn);
97 pd = prop_data_create_data_nocopy(board_bios.mac_address_local,
98 sizeof(board_bios.mac_address_local));
99 KASSERT(pd != NULL);
100 if (prop_dictionary_set(board_properties, "emac0-mac-addr",
101 pd) == false)
102 panic("setting emac0-mac-addr");
103 prop_object_release(pd);
105 pn = prop_number_create_integer(board_cpu_speed);
106 KASSERT(pn != NULL);
107 if (prop_dictionary_set(board_properties, "processor-frequency",
108 pn) == false)
109 panic("setting processor-frequency");
110 prop_object_release(pn);
112 pn = prop_number_create_integer(board_plb_speed);
113 KASSERT(pn != NULL);
114 if (prop_dictionary_set(board_properties, "plb-frequency", pn) == false)
115 panic("setting plb-frequency");
116 prop_object_release(pn);
118 pn = prop_number_create_integer(board_pci_speed);
119 KASSERT(pn != NULL);
120 if (prop_dictionary_set(board_properties, "pci-frequency", pn) == false)
121 panic("setting pci-frequency");
122 prop_object_release(pn);
126 void
127 bios_board_print(void)
130 printf("Board config data:\n");
131 printf(" mem_size = %u\n", board_mem_size);
132 printf(" mac_address_local = %02x:%02x:%02x:%02x:%02x:%02x\n",
133 board_bios.mac_address_local[0], board_bios.mac_address_local[1],
134 board_bios.mac_address_local[2], board_bios.mac_address_local[3],
135 board_bios.mac_address_local[4], board_bios.mac_address_local[5]);
136 printf(" processor_speed = %u\n", board_cpu_speed);
137 printf(" plb_speed = %u\n", board_plb_speed);
138 printf(" pci_speed = %u\n", board_pci_speed);