diff options
-rw-r--r-- | sys/arch/octeon/dev/octcf.c | 12 | ||||
-rw-r--r-- | sys/arch/octeon/include/octeonvar.h | 69 | ||||
-rw-r--r-- | sys/arch/octeon/octeon/machdep.c | 76 |
3 files changed, 88 insertions, 69 deletions
diff --git a/sys/arch/octeon/dev/octcf.c b/sys/arch/octeon/dev/octcf.c index ccba97d1063..c6bc39bf5da 100644 --- a/sys/arch/octeon/dev/octcf.c +++ b/sys/arch/octeon/dev/octcf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: octcf.c,v 1.7 2011/07/06 04:49:35 matthew Exp $ */ +/* $OpenBSD: octcf.c,v 1.8 2013/03/15 09:18:19 jasper Exp $ */ /* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */ /* @@ -85,6 +85,7 @@ #include <octeon/dev/iobusvar.h> #include <octeon/dev/octeonreg.h> +#include <machine/octeonvar.h> #define OCTCF_REG_SIZE 8 #define ATAPARAMS_SIZE 512 @@ -159,8 +160,15 @@ int octcf_get_params(struct octcf_softc *, struct ataparams *); bus_space_write_2(wd->sc_iot, wd->sc_ioh, reg & 0x6, val) int -octcfprobe(struct device *parent, void *match_, void *aux) +octcfprobe(struct device *parent, void *match, void *aux) { + extern uint64_t cf_found; + + if (cf_found == 0) { + OCTCFDEBUG_PRINT(("octcfprobe: No cf bus found\n"), DEBUG_FUNCS | DEBUG_PROBE); + return 0; + } + return 1; } diff --git a/sys/arch/octeon/include/octeonvar.h b/sys/arch/octeon/include/octeonvar.h index b4cff927f81..6f081821983 100644 --- a/sys/arch/octeon/include/octeonvar.h +++ b/sys/arch/octeon/include/octeonvar.h @@ -192,6 +192,75 @@ struct octeon_fau_map { #define OCTEON_POW_GROUP_CORE1_TASK_7 15 #ifdef _KERNEL +struct boot_desc { + uint32_t desc_ver; + uint32_t desc_size; + uint64_t stack_top; + uint64_t heap_start; + uint64_t heap_end; + uint64_t __unused17; + uint64_t __unused16; + uint32_t __unused18; + uint32_t __unused15; + uint32_t __unused14; + uint32_t argc; + uint32_t argv[64]; + uint32_t flags; + uint32_t core_mask; + uint32_t dram_size; + uint32_t phy_mem_desc_addr; + uint32_t debugger_flag_addr; + uint32_t eclock; + uint32_t __unused10; + uint32_t __unused9; + uint16_t __unused8; + uint8_t __unused7; + uint8_t __unused6; + uint16_t __unused5; + uint8_t __unused4; + uint8_t __unused3; + uint8_t __unused2[20]; + uint8_t __unused1[6]; + uint8_t __unused0; + uint64_t boot_info_addr; +}; + +struct boot_info { + uint32_t ver_major; + uint32_t ver_minor; + uint64_t stack_top; + uint64_t heap_start; + uint64_t heap_end; + uint64_t boot_desc_addr; + uint32_t exception_base_addr; + uint32_t stack_size; + uint32_t flags; + uint32_t core_mask; + uint32_t dram_size; + uint32_t phys_mem_desc_addr; + uint32_t debugger_flags_addr; + uint32_t eclock; + uint32_t dclock; + uint32_t __unused0; + uint16_t board_type; + uint8_t board_rev_major; + uint8_t board_rev_minor; + uint16_t __unused1; + uint8_t __unused2; + uint8_t __unused3; + char board_serial[20]; + uint8_t mac_addr_base[6]; + uint8_t mac_addr_count; + uint64_t cf_common_addr; + uint64_t cf_attr_addr; + uint64_t led_display_addr; + uint32_t dfaclock; + uint32_t config_flags; +}; + +/* Contains the address for the CF bus, if one was found. */ +uint64_t cf_found; + extern struct octeon_config octeon_configuration; void octeon_bus_io_init(bus_space_tag_t, void *); diff --git a/sys/arch/octeon/octeon/machdep.c b/sys/arch/octeon/octeon/machdep.c index 0d24067f29b..da37fdbbf52 100644 --- a/sys/arch/octeon/octeon/machdep.c +++ b/sys/arch/octeon/octeon/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.24 2013/03/13 14:30:57 jasper Exp $ */ +/* $OpenBSD: machdep.c,v 1.25 2013/03/15 09:18:19 jasper Exp $ */ /* * Copyright (c) 2009, 2010 Miodrag Vallat. @@ -80,72 +80,7 @@ #include <octeon/dev/iobusvar.h> #include <octeon/dev/octeonreg.h> - -struct boot_desc { - uint32_t desc_ver; - uint32_t desc_size; - uint64_t stack_top; - uint64_t heap_start; - uint64_t heap_end; - uint64_t __unused17; - uint64_t __unused16; - uint32_t __unused18; - uint32_t __unused15; - uint32_t __unused14; - uint32_t argc; - uint32_t argv[64]; - uint32_t flags; - uint32_t core_mask; - uint32_t dram_size; - uint32_t phy_mem_desc_addr; - uint32_t debugger_flag_addr; - uint32_t eclock; - uint32_t __unused10; - uint32_t __unused9; - uint16_t __unused8; - uint8_t __unused7; - uint8_t __unused6; - uint16_t __unused5; - uint8_t __unused4; - uint8_t __unused3; - uint8_t __unused2[20]; - uint8_t __unused1[6]; - uint8_t __unused0; - uint64_t boot_info_addr; -}; - -struct boot_info { - uint32_t ver_major; - uint32_t ver_minor; - uint64_t stack_top; - uint64_t heap_start; - uint64_t heap_end; - uint64_t boot_desc_addr; - uint32_t exception_base_addr; - uint32_t stack_size; - uint32_t flags; - uint32_t core_mask; - uint32_t dram_size; - uint32_t phys_mem_desc_addr; - uint32_t debugger_flags_addr; - uint32_t eclock; - uint32_t dclock; - uint32_t __unused0; - uint16_t board_type; - uint8_t board_rev_major; - uint8_t board_rev_minor; - uint16_t __unused1; - uint8_t __unused2; - uint8_t __unused3; - char board_serial[20]; - uint8_t mac_addr_base[6]; - uint8_t mac_addr_count; - uint64_t cf_common_addr; - uint64_t cf_attr_addr; - uint64_t led_display_addr; - uint32_t dfaclock; - uint32_t config_flags; -}; +#include <machine/octeonvar.h> #define BOARD_TYPE_SIM 1 @@ -315,6 +250,7 @@ mips_init(__register_t a0, __register_t a1, __register_t a2 __unused, extern char start[], edata[], end[]; extern char exception[], e_exception[]; extern void xtlb_miss; + extern uint64_t cf_found; boot_desc = (struct boot_desc *)a3; boot_info = @@ -428,6 +364,12 @@ mips_init(__register_t a0, __register_t a1, __register_t a2 __unused, tlb_init(bootcpu_hwinfo.tlbsize); /* + * Save some initial values needed for device configuration. + */ + + bcopy(&boot_info->cf_common_addr, &cf_found, sizeof(cf_found)); + + /* * Get a console, very early but after initial mapping setup. */ |