sb_scd.c (203697) | sb_scd.c (205364) |
---|---|
1/*- 2 * Copyright (c) 2009 Neelkanth Natu 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2009 Neelkanth Natu 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/mips/sibyte/sb_scd.c 203697 2010-02-09 06:24:43Z neel $"); | 28__FBSDID("$FreeBSD: head/sys/mips/sibyte/sb_scd.c 205364 2010-03-20 05:49:06Z neel $"); |
29 30#include <sys/param.h> 31#include <sys/kernel.h> 32#include <sys/systm.h> 33#include <sys/module.h> 34#include <sys/bus.h> 35 36#include <machine/resource.h> --- 14 unchanged lines hidden (view full) --- 51#define GET_VAL_64(x, b, n) (((x) >> (b)) & ((1ULL << (n)) - 1)) 52 53#define SYSREV_ADDR MIPS_PHYS_TO_KSEG1(0x10020000) 54#define SYSREV_NUM_PROCESSORS(x) GET_VAL_64((x), 24, 4) 55 56#define SYSCFG_ADDR MIPS_PHYS_TO_KSEG1(0x10020008) 57#define SYSCFG_PLLDIV(x) GET_VAL_64((x), 7, 5) 58 | 29 30#include <sys/param.h> 31#include <sys/kernel.h> 32#include <sys/systm.h> 33#include <sys/module.h> 34#include <sys/bus.h> 35 36#include <machine/resource.h> --- 14 unchanged lines hidden (view full) --- 51#define GET_VAL_64(x, b, n) (((x) >> (b)) & ((1ULL << (n)) - 1)) 52 53#define SYSREV_ADDR MIPS_PHYS_TO_KSEG1(0x10020000) 54#define SYSREV_NUM_PROCESSORS(x) GET_VAL_64((x), 24, 4) 55 56#define SYSCFG_ADDR MIPS_PHYS_TO_KSEG1(0x10020008) 57#define SYSCFG_PLLDIV(x) GET_VAL_64((x), 7, 5) 58 |
59#define ZBBUS_CYCLE_COUNT_ADDR MIPS_PHYS_TO_KSEG1(0x10030000) 60 |
|
59#define INTSRC_MASK_ADDR(cpu) \ 60 (MIPS_PHYS_TO_KSEG1(0x10020028) | ((cpu) << 13)) 61 62#define INTSRC_MAP_ADDR(cpu, intsrc) \ 63 (MIPS_PHYS_TO_KSEG1(0x10020200) | ((cpu) << 13)) + (intsrc * 8) 64 65#define MAILBOX_SET_ADDR(cpu) \ 66 (MIPS_PHYS_TO_KSEG1(0x100200C8) | ((cpu) << 13)) --- 11 unchanged lines hidden (view full) --- 78static void 79sb_write_syscfg(uint64_t val) 80{ 81 82 sb_store64(SYSCFG_ADDR, val); 83} 84 85uint64_t | 61#define INTSRC_MASK_ADDR(cpu) \ 62 (MIPS_PHYS_TO_KSEG1(0x10020028) | ((cpu) << 13)) 63 64#define INTSRC_MAP_ADDR(cpu, intsrc) \ 65 (MIPS_PHYS_TO_KSEG1(0x10020200) | ((cpu) << 13)) + (intsrc * 8) 66 67#define MAILBOX_SET_ADDR(cpu) \ 68 (MIPS_PHYS_TO_KSEG1(0x100200C8) | ((cpu) << 13)) --- 11 unchanged lines hidden (view full) --- 80static void 81sb_write_syscfg(uint64_t val) 82{ 83 84 sb_store64(SYSCFG_ADDR, val); 85} 86 87uint64_t |
88sb_zbbus_cycle_count(void) 89{ 90 91 return (sb_load64(ZBBUS_CYCLE_COUNT_ADDR)); 92} 93 94uint64_t |
|
86sb_cpu_speed(void) 87{ 88 int plldiv; 89 const uint64_t MHZ = 1000000; 90 91 plldiv = SYSCFG_PLLDIV(sb_read_syscfg()); 92 if (plldiv == 0) { 93 printf("PLL_DIV is 0 - assuming 6 (300MHz).\n"); --- 192 unchanged lines hidden --- | 95sb_cpu_speed(void) 96{ 97 int plldiv; 98 const uint64_t MHZ = 1000000; 99 100 plldiv = SYSCFG_PLLDIV(sb_read_syscfg()); 101 if (plldiv == 0) { 102 printf("PLL_DIV is 0 - assuming 6 (300MHz).\n"); --- 192 unchanged lines hidden --- |