1 /* $NetBSD: century_bios.c,v 1.3 2006/05/05 18:04:41 thorpej Exp $ */
4 * Copyright (c) 2004 Shigeyuki Fukushima.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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
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
;
61 bios_board_init(void *info_block
, u_int sysclk_base
)
64 /* Initialize cache info for memcpy, etc. */
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;
77 bios_board_memsize_get(void)
79 return board_mem_size
;
83 bios_board_info_set(void)
88 /* Initialize board properties dictionary */
91 pn
= prop_number_create_integer(board_mem_size
);
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
));
100 if (prop_dictionary_set(board_properties
, "emac0-mac-addr",
102 panic("setting emac0-mac-addr");
103 prop_object_release(pd
);
105 pn
= prop_number_create_integer(board_cpu_speed
);
107 if (prop_dictionary_set(board_properties
, "processor-frequency",
109 panic("setting processor-frequency");
110 prop_object_release(pn
);
112 pn
= prop_number_create_integer(board_plb_speed
);
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
);
120 if (prop_dictionary_set(board_properties
, "pci-frequency", pn
) == false)
121 panic("setting pci-frequency");
122 prop_object_release(pn
);
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
);