diff options
author | Takuya ASADA <syuu@cvs.openbsd.org> | 2010-09-21 06:21:01 +0000 |
---|---|---|
committer | Takuya ASADA <syuu@cvs.openbsd.org> | 2010-09-21 06:21:01 +0000 |
commit | 9772e878fcc8735796600fca247bec45766ee70d (patch) | |
tree | 72ca7deedb508531ebfc310d2c2280a11cc090fd /sys/arch | |
parent | 47c5fac231715cddf9f7a050ec077f2f874af358 (diff) |
Remove bootinfo.c which has license issue. ok deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/octeon/conf/files.octeon | 3 | ||||
-rw-r--r-- | sys/arch/octeon/include/bootinfo.h | 33 | ||||
-rw-r--r-- | sys/arch/octeon/octeon/bootinfo.c | 244 | ||||
-rw-r--r-- | sys/arch/octeon/octeon/machdep.c | 27 |
4 files changed, 14 insertions, 293 deletions
diff --git a/sys/arch/octeon/conf/files.octeon b/sys/arch/octeon/conf/files.octeon index 52b9e20c806..928fb8997ac 100644 --- a/sys/arch/octeon/conf/files.octeon +++ b/sys/arch/octeon/conf/files.octeon @@ -1,4 +1,4 @@ -# $OpenBSD: files.octeon,v 1.1 2010/09/20 06:32:30 syuu Exp $ +# $OpenBSD: files.octeon,v 1.2 2010/09/21 06:21:00 syuu Exp $ # Standard stanzas config(8) can't run without maxpartitions 16 @@ -18,7 +18,6 @@ file arch/octeon/octeon/disksubr.c disk file arch/octeon/octeon/lock_machdep.c multiprocessor file arch/octeon/octeon/machdep.c file arch/octeon/octeon/mutex.c -file arch/octeon/octeon/bootinfo.c include "dev/ata/files.ata" include "dev/atapiscsi/files.atapiscsi" diff --git a/sys/arch/octeon/include/bootinfo.h b/sys/arch/octeon/include/bootinfo.h deleted file mode 100644 index fcb453543b2..00000000000 --- a/sys/arch/octeon/include/bootinfo.h +++ /dev/null @@ -1,33 +0,0 @@ -/* $OpenBSD: bootinfo.h,v 1.1 2010/09/20 06:32:30 syuu Exp $ */ - -/* - * Copyright (c) 2010 Takuya Asada. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _BOOTINFO_H_ -#define _BOOTINFO_H_ - -void octeon_boot_params_init(register_t); -unsigned long octeon_get_clock_rate(void); - -#endif diff --git a/sys/arch/octeon/octeon/bootinfo.c b/sys/arch/octeon/octeon/bootinfo.c deleted file mode 100644 index 609ffd191b3..00000000000 --- a/sys/arch/octeon/octeon/bootinfo.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - **************************************************************************************** - * - * APP/BOOT DESCRIPTOR STUFF - * - **************************************************************************************** - */ - -/* Define the struct that is initialized by the bootloader used by the - * startup code. - * - * Copyright (c) 2004, 2005, 2006 Cavium Networks. - * - * The authors hereby grant permission to use, copy, modify, distribute, - * and license this software and its documentation for any purpose, provided - * that existing copyright notices are retained in all copies and that this - * notice is included verbatim in any distributions. No written agreement, - * license, or royalty fee is required for any of the authorized uses. - * Modifications to this software may be copyrighted by their authors - * and need not follow the licensing terms described here, provided that - * the new terms are clearly indicated on the first page of each file where - * they apply. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/types.h> -#include <machine/octeon_pcmap_regs.h> -#include <machine/bootinfo.h> - -#define OCTEON_CURRENT_DESC_VERSION 6 -#define OCTEON_ARGV_MAX_ARGS (64) -#define OCTOEN_SERIAL_LEN 20 - -#define MAX_APP_DESC_ADDR 0xffffffffafffffff - -typedef struct { - /* Start of block referenced by assembly code - do not change! */ - uint32_t desc_version; - uint32_t desc_size; - - uint64_t stack_top; - uint64_t heap_base; - uint64_t heap_end; - uint64_t entry_point; /* Only used by bootloader */ - uint64_t desc_vaddr; - /* End of This block referenced by assembly code - do not change! */ - - uint32_t exception_base_addr; - uint32_t stack_size; - uint32_t heap_size; - uint32_t argc; /* Argc count for application */ - uint32_t argv[OCTEON_ARGV_MAX_ARGS]; - uint32_t flags; - uint32_t core_mask; - uint32_t dram_size; /**< DRAM size in megabyes */ - uint32_t phy_mem_desc_addr; /**< physical address of free memory descriptor block*/ - uint32_t debugger_flags_base_addr; /**< used to pass flags from app to debugger */ - uint32_t eclock_hz; /**< CPU clock speed, in hz */ - uint32_t dclock_hz; /**< DRAM clock speed, in hz */ - uint32_t spi_clock_hz; /**< SPI4 clock in hz */ - uint16_t board_type; - uint8_t board_rev_major; - uint8_t board_rev_minor; - uint16_t chip_type; - uint8_t chip_rev_major; - uint8_t chip_rev_minor; - char board_serial_number[OCTOEN_SERIAL_LEN]; - uint8_t mac_addr_base[6]; - uint8_t mac_addr_count; - uint64_t cvmx_desc_vaddr; -} octeon_boot_descriptor_t; - - -typedef struct { - uint32_t major_version; - uint32_t minor_version; - - uint64_t stack_top; - uint64_t heap_base; - uint64_t heap_end; - uint64_t desc_vaddr; - - uint32_t exception_base_addr; - uint32_t stack_size; - uint32_t flags; - uint32_t core_mask; - uint32_t dram_size; /**< DRAM size in megabyes */ - uint32_t phy_mem_desc_addr; /**< physical address of free memory descriptor block*/ - uint32_t debugger_flags_base_addr; /**< used to pass flags from app to debugger */ - uint32_t eclock_hz; /**< CPU clock speed, in hz */ - uint32_t dclock_hz; /**< DRAM clock speed, in hz */ - uint32_t spi_clock_hz; /**< SPI4 clock in hz */ - uint16_t board_type; - uint8_t board_rev_major; - uint8_t board_rev_minor; - uint16_t chip_type; - uint8_t chip_rev_major; - uint8_t chip_rev_minor; - char board_serial_number[OCTOEN_SERIAL_LEN]; - uint8_t mac_addr_base[6]; - uint8_t mac_addr_count; -} cvmx_bootinfo_t; - -uint32_t octeon_cpu_clock; -uint64_t octeon_dram; -uint32_t octeon_bd_ver = 0, octeon_cvmx_bd_ver = 0, octeon_board_rev_major, octeon_board_rev_minor, octeon_board_type; -uint8_t octeon_mac_addr[6] = { 0 }; -int octeon_core_mask, octeon_mac_addr_count; -int octeon_chip_rev_major = 0, octeon_chip_rev_minor = 0, octeon_chip_type = 0; - -static octeon_boot_descriptor_t *app_desc_ptr; -static cvmx_bootinfo_t *cvmx_desc_ptr; - -#define OCTEON_BOARD_TYPE_NONE 0 -#define OCTEON_BOARD_TYPE_SIM 1 -#define OCTEON_BOARD_TYPE_CN3010_EVB_HS5 11 - -#define OCTEON_CLOCK_MIN (100 * 1000 * 1000) -#define OCTEON_CLOCK_MAX (800 * 1000 * 1000) -#define OCTEON_DRAM_DEFAULT (256 * 1024 * 1024) -#define OCTEON_DRAM_MIN 30 -#define OCTEON_DRAM_MAX 3000 - - -int -octeon_board_real(void) -{ - switch (octeon_board_type) { - case OCTEON_BOARD_TYPE_NONE: - case OCTEON_BOARD_TYPE_SIM: - return 0; - case OCTEON_BOARD_TYPE_CN3010_EVB_HS5: - /* - * XXX - * The CAM-0100 identifies itself as type 11, revision 0.0, - * despite its being rather real. Disable the revision check - * for type 11. - */ - return 1; - default: - if (octeon_board_rev_major == 0) - return 0; - return 1; - } -} - -static void -octeon_process_app_desc_ver_unknown(void) -{ - printf(" Unknown Boot-Descriptor: Using Defaults\n"); - - octeon_cpu_clock = OCTEON_CLOCK_DEFAULT; - octeon_dram = OCTEON_DRAM_DEFAULT; - octeon_board_rev_major = octeon_board_rev_minor = octeon_board_type = 0; - octeon_core_mask = 1; - octeon_chip_type = octeon_chip_rev_major = octeon_chip_rev_minor = 0; - octeon_mac_addr[0] = 0x00; octeon_mac_addr[1] = 0x0f; - octeon_mac_addr[2] = 0xb7; octeon_mac_addr[3] = 0x10; - octeon_mac_addr[4] = 0x09; octeon_mac_addr[5] = 0x06; - octeon_mac_addr_count = 1; -} - -static int -octeon_process_app_desc_ver_6(void) -{ - /* XXX Why is 0x00000000ffffffffULL a bad value? */ - if (app_desc_ptr->cvmx_desc_vaddr == 0 || - app_desc_ptr->cvmx_desc_vaddr == 0xfffffffful) { - printf ("Bad cvmx_desc_ptr %p\n", cvmx_desc_ptr); - return 1; - } - cvmx_desc_ptr = - (cvmx_bootinfo_t *)(__intptr_t)app_desc_ptr->cvmx_desc_vaddr; - cvmx_desc_ptr = - (cvmx_bootinfo_t *) ((__intptr_t)cvmx_desc_ptr | CKSEG0_BASE); - octeon_cvmx_bd_ver = (cvmx_desc_ptr->major_version * 100) + - cvmx_desc_ptr->minor_version; - if (cvmx_desc_ptr->major_version != 1) { - panic("Incompatible CVMX descriptor from bootloader: %d.%d %p\n", - (int) cvmx_desc_ptr->major_version, - (int) cvmx_desc_ptr->minor_version, cvmx_desc_ptr); - } - - octeon_core_mask = cvmx_desc_ptr->core_mask; - octeon_cpu_clock = cvmx_desc_ptr->eclock_hz; - octeon_board_type = cvmx_desc_ptr->board_type; - octeon_board_rev_major = cvmx_desc_ptr->board_rev_major; - octeon_board_rev_minor = cvmx_desc_ptr->board_rev_minor; - octeon_chip_type = cvmx_desc_ptr->chip_type; - octeon_chip_rev_major = cvmx_desc_ptr->chip_rev_major; - octeon_chip_rev_minor = cvmx_desc_ptr->chip_rev_minor; - octeon_mac_addr[0] = cvmx_desc_ptr->mac_addr_base[0]; - octeon_mac_addr[1] = cvmx_desc_ptr->mac_addr_base[1]; - octeon_mac_addr[2] = cvmx_desc_ptr->mac_addr_base[2]; - octeon_mac_addr[3] = cvmx_desc_ptr->mac_addr_base[3]; - octeon_mac_addr[4] = cvmx_desc_ptr->mac_addr_base[4]; - octeon_mac_addr[5] = cvmx_desc_ptr->mac_addr_base[5]; - octeon_mac_addr_count = cvmx_desc_ptr->mac_addr_count; - - if (app_desc_ptr->dram_size > 16*1024*1024) - octeon_dram = (uint64_t)app_desc_ptr->dram_size; - else - octeon_dram = (uint64_t)app_desc_ptr->dram_size << 20; - return 0; -} - -void -octeon_boot_params_init(register_t ptr) -{ - int bad_desc = 1; - - if (ptr != 0 && ptr < MAX_APP_DESC_ADDR) { - app_desc_ptr = (octeon_boot_descriptor_t *)(__intptr_t)ptr; - octeon_bd_ver = app_desc_ptr->desc_version; - if (app_desc_ptr->desc_version < 6) - panic("Your boot code is too old to be supported.\n"); - if (app_desc_ptr->desc_version >= 6) - bad_desc = octeon_process_app_desc_ver_6(); - } - if (bad_desc) - octeon_process_app_desc_ver_unknown(); - - printf("Boot Descriptor Ver: %u -> %u/%u", - octeon_bd_ver, octeon_cvmx_bd_ver/100, octeon_cvmx_bd_ver%100); - printf(" CPU clock: %uMHz Core Mask: %#x\n", octeon_cpu_clock/1000000, octeon_core_mask); - printf(" Dram: %u MB", (uint32_t)(octeon_dram >> 20)); - printf(" Board Type: %u Revision: %u/%u\n", - octeon_board_type, octeon_board_rev_major, octeon_board_rev_minor); - printf(" Octeon Chip: %u Rev %u/%u", - octeon_chip_type, octeon_chip_rev_major, octeon_chip_rev_minor); - - printf(" Mac Address %02X.%02X.%02X.%02X.%02X.%02X (%d)\n", - octeon_mac_addr[0], octeon_mac_addr[1], octeon_mac_addr[2], - octeon_mac_addr[3], octeon_mac_addr[4], octeon_mac_addr[5], - octeon_mac_addr_count); -} - -unsigned long -octeon_get_clock_rate(void) -{ - return octeon_cpu_clock; -} diff --git a/sys/arch/octeon/octeon/machdep.c b/sys/arch/octeon/octeon/machdep.c index 5ba3545e715..e5749c3863d 100644 --- a/sys/arch/octeon/octeon/machdep.c +++ b/sys/arch/octeon/octeon/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.1 2010/09/20 06:32:30 syuu Exp $ */ +/* $OpenBSD: machdep.c,v 1.2 2010/09/21 06:21:00 syuu Exp $ */ /* * Copyright (c) 2009, 2010 Miodrag Vallat. @@ -81,7 +81,6 @@ #include <octeon/dev/obiovar.h> #include <octeon/dev/octeonreg.h> -#include <machine/bootinfo.h> /* The following is used externally (sysctl_hw) */ char machine[] = MACHINE; /* Machine "architecture" */ @@ -161,10 +160,13 @@ octeon_memory_init(void) physmem = endpfn - startpfn; uint32_t realmem_bytes; +#if 0 if (octeon_board_real()) { realmem_bytes = (octeon_dram - PAGE_SIZE); realmem_bytes &= ~(PAGE_SIZE - 1); - } else { + } else +#endif + { /* Simulator we limit to 96 meg */ realmem_bytes = (96 << 20); } @@ -172,6 +174,7 @@ octeon_memory_init(void) memset((void*)phys_avail,0,sizeof(phys_avail)); phys_avail[0] = (CKSEG0_TO_PHYS((uint64_t)&end) + PAGE_SIZE ) & ~(PAGE_SIZE - 1); +#if 0 if (octeon_board_real()) { if (realmem_bytes > OCTEON_DRAM_FIRST_256_END) phys_avail[1] = OCTEON_DRAM_FIRST_256_END; @@ -180,7 +183,9 @@ octeon_memory_init(void) realmem_bytes -= OCTEON_DRAM_FIRST_256_END; realmem_bytes &= ~(PAGE_SIZE - 1); mem_layout[0].mem_last_page = atop(phys_avail[1]); - } else { + } else +#endif + { /* Simulator gets 96Meg period. */ phys_avail[1] = (96 << 20); } @@ -232,7 +237,9 @@ octeon_memory_init(void) } #endif realmem = physmem; +#if 0 printf("Total DRAM Size 0x%016X\n", (uint32_t) octeon_dram); +#endif for(i=0;phys_avail[i];i+=2){ printf("Bank %d = 0x%016lX -> 0x%016lX\n",i>>1, (long)phys_avail[i], (long)phys_avail[i+1]); @@ -253,7 +260,6 @@ mips_init(__register_t a0, __register_t a1, __register_t a2 __unused, __register_t a3) { uint prid; - u_long cpuspeed; vaddr_t xtlb_handler; int i; @@ -291,17 +297,10 @@ mips_init(__register_t a0, __register_t a1, __register_t a2 __unused, ekern = end; } - octeon_boot_params_init(a3); - prid = cp0_get_prid(); - /* - * Figure out processor clock speed. - * Hopefully the processor speed, in Hertz, will not overflow - * uint32_t... - */ - cpuspeed = octeon_get_clock_rate(); - bootcpu_hwinfo.clock = cpuspeed; + /* XXX: We should get clockrate from boot descriptor */ + bootcpu_hwinfo.clock = 500000000; /* * Look at arguments passed to us and compute boothowto. |