-/* $OpenBSD: amdcf.c,v 1.6 2018/05/30 14:53:56 fcambus Exp $ */
+/* $OpenBSD: amdcf.c,v 1.7 2021/01/30 14:59:13 visa Exp $ */
/*
* Copyright (c) 2007, Juniper Networks, Inc.
return 0;
/* Only for DSR machines */
- if (octeon_boot_info->board_type != BOARD_TYPE_DSR_500)
+ if (octeon_board != BOARD_DLINK_DSR_500)
return 0;
return 1;
-/* $OpenBSD: cn30xxgmx.c,v 1.47 2020/09/08 15:46:36 visa Exp $ */
+/* $OpenBSD: cn30xxgmx.c,v 1.48 2021/01/30 14:59:13 visa Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
* > ...
*/
- switch (octeon_boot_info->board_type) {
+ switch (octeon_board) {
default:
/* Default parameter of CN30XX */
clk_tx_setting = 24;
clk_rx_setting = 24;
break;
- case BOARD_TYPE_UBIQUITI_E100:
- case BOARD_TYPE_UBIQUITI_E120:
+ case BOARD_UBIQUITI_E100:
+ case BOARD_UBIQUITI_E120:
clk_tx_setting = 16;
clk_rx_setting = 0;
break;
-/* $OpenBSD: cn30xxsmi.c,v 1.7 2019/09/28 22:20:25 deraadt Exp $ */
+/* $OpenBSD: cn30xxsmi.c,v 1.8 2021/01/30 14:59:13 visa Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
if (smi == NULL)
return ENOENT;
- switch (octeon_boot_info->board_type) {
- case BOARD_TYPE_UBIQUITI_E100:
- case BOARD_TYPE_UBIQUITI_E120:
+ switch (octeon_board) {
+ case BOARD_UBIQUITI_E100:
+ case BOARD_UBIQUITI_E120:
if (port > 2)
return ENOENT;
reg = 7 - port;
break;
- case BOARD_TYPE_CN3010_EVB_HS5:
+ case BOARD_CN3010_EVB_HS5:
if (port >= nitems(cam0100_phys))
return ENOENT;
reg = cam0100_phys[port];
-/* $OpenBSD: octrtc.c,v 1.12 2020/06/30 14:47:16 visa Exp $ */
+/* $OpenBSD: octrtc.c,v 1.13 2021/01/30 14:59:13 visa Exp $ */
/*
* Copyright (c) 2013, 2014 Paul Irofti.
};
-static const uint16_t no_rtc_boards[] = {
- BOARD_TYPE_UBIQUITI_E100,
- BOARD_TYPE_UBIQUITI_E120,
- BOARD_TYPE_UBIQUITI_E200,
- BOARD_TYPE_UBIQUITI_E220,
- BOARD_TYPE_UBIQUITI_E300,
- BOARD_TYPE_UBIQUITI_E1000,
- BOARD_TYPE_RHINOLABS_SHASTA
+static const enum octeon_board no_rtc_boards[] = {
+ BOARD_UBIQUITI_E100,
+ BOARD_UBIQUITI_E120,
+ BOARD_UBIQUITI_E200,
+ BOARD_UBIQUITI_E220,
+ BOARD_UBIQUITI_E300,
+ BOARD_UBIQUITI_E1000,
+ BOARD_RHINOLABS_UTM8,
};
int
if (strcmp(maa->maa_name, cf->cf_driver->cd_name) != 0)
return 0;
for (i = 0; i < nitems(no_rtc_boards); i++)
- if (octeon_boot_info->board_type == no_rtc_boards[i])
+ if (octeon_board == no_rtc_boards[i])
return 0;
return 1;
}
-/* $OpenBSD: octeonvar.h,v 1.49 2020/09/04 15:18:05 visa Exp $ */
+/* $OpenBSD: octeonvar.h,v 1.50 2021/01/30 14:59:14 visa Exp $ */
/* $NetBSD: maltavar.h,v 1.3 2002/03/18 10:10:16 simonb Exp $ */
/*-
cnmac_stat_count
};
-/*
- * Octeon board types known to work with OpenBSD/octeon.
- * NB: BOARD_TYPE_UBIQUITI_E100 is also used by other vendors, but we don't run
- * on those boards yet.
- */
-#define BOARD_TYPE_CN3010_EVB_HS5 11
-#define BOARD_TYPE_UBIQUITI_E100 20002
-#define BOARD_TYPE_UBIQUITI_E200 20003
-#define BOARD_TYPE_UBIQUITI_E120 20004
-#define BOARD_TYPE_UBIQUITI_E220 20005
-#define BOARD_TYPE_UBIQUITI_E1000 20010
-#define BOARD_TYPE_RHINOLABS_SHASTA 20012
-#define BOARD_TYPE_DSR_500 20015
-#define BOARD_TYPE_UBIQUITI_E300 20300
-
#if defined(_KERNEL) || defined(_STANDALONE)
#define OCTEON_ARGV_MAX 64
+/*
+ * OCTEON board types recognized by OpenBSD/octeon.
+ *
+ * It is fine to use BOARD_UNKNOWN when the board does not need
+ * special treatment.
+ */
+enum octeon_board {
+ BOARD_UNKNOWN,
+ BOARD_CN3010_EVB_HS5,
+ BOARD_DLINK_DSR_500,
+ BOARD_RHINOLABS_UTM8,
+ BOARD_UBIQUITI_E100,
+ BOARD_UBIQUITI_E120,
+ BOARD_UBIQUITI_E200,
+ BOARD_UBIQUITI_E220,
+ BOARD_UBIQUITI_E300,
+ BOARD_UBIQUITI_E1000,
+};
+
struct boot_desc {
uint32_t desc_ver;
uint32_t desc_size;
uint64_t size;
};
+extern enum octeon_board octeon_board;
extern struct boot_desc *octeon_boot_desc;
extern struct boot_info *octeon_boot_info;
-/* $OpenBSD: machdep.c,v 1.127 2020/07/18 08:37:44 visa Exp $ */
+/* $OpenBSD: machdep.c,v 1.128 2021/01/30 14:59:14 visa Exp $ */
/*
* Copyright (c) 2009, 2010 Miodrag Vallat.
extern struct timecounter cp0_timecounter;
extern uint8_t dt_blob_start[];
+enum octeon_board octeon_board;
struct boot_desc *octeon_boot_desc;
struct boot_info *octeon_boot_info;
void octeon_tlb_init(void);
static void process_bootargs(void);
static uint64_t get_ncpusfound(void);
+static enum octeon_board get_octeon_board(void);
cons_decl(octuart);
struct consdev uartcons = cons_init(octuart);
bootcpu_hwinfo.clock / 1000000);
cpu_cpuspeed = octeon_cpuspeed;
-
ncpusfound = get_ncpusfound();
+ octeon_board = get_octeon_board();
process_bootargs();
return ncpus;
}
+static enum octeon_board
+get_octeon_board(void)
+{
+ switch (octeon_boot_info->board_type) {
+ case 11:
+ return BOARD_CN3010_EVB_HS5;
+ case 20002:
+ return BOARD_UBIQUITI_E100;
+ case 20003:
+ return BOARD_UBIQUITI_E200;
+ case 20004:
+ return BOARD_UBIQUITI_E120;
+ case 20005:
+ return BOARD_UBIQUITI_E220;
+ case 20010:
+ return BOARD_UBIQUITI_E1000;
+ case 20012:
+ return BOARD_RHINOLABS_UTM8;
+ case 20015:
+ return BOARD_DLINK_DSR_500;
+ case 20300:
+ return BOARD_UBIQUITI_E300;
+ default:
+ break;
+ }
+
+ return BOARD_UNKNOWN;
+}
+
static void
process_bootargs(void)
{