11.1Sskrll/* $NetBSD: locore_ingenic.S,v 1.1 2017/05/21 06:49:13 skrll Exp $ */ 21.1Sskrll 31.1Sskrll/*- 41.1Sskrll * Copyright (c) 2017 The NetBSD Foundation, Inc. 51.1Sskrll * All rights reserved. 61.1Sskrll * 71.1Sskrll * This code is derived from software contributed to The NetBSD Foundation 81.1Sskrll * by Nick Hudson 91.1Sskrll * 101.1Sskrll * Redistribution and use in source and binary forms, with or without 111.1Sskrll * modification, are permitted provided that the following conditions 121.1Sskrll * are met: 131.1Sskrll * 1. Redistributions of source code must retain the above copyright 141.1Sskrll * notice, this list of conditions and the following disclaimer. 151.1Sskrll * 2. Redistributions in binary form must reproduce the above copyright 161.1Sskrll * notice, this list of conditions and the following disclaimer in the 171.1Sskrll * documentation and/or other materials provided with the distribution. 181.1Sskrll * 191.1Sskrll * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 201.1Sskrll * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 211.1Sskrll * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 221.1Sskrll * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 231.1Sskrll * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 241.1Sskrll * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 251.1Sskrll * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 261.1Sskrll * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 271.1Sskrll * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 281.1Sskrll * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 291.1Sskrll * POSSIBILITY OF SUCH DAMAGE. 301.1Sskrll */ 311.1Sskrll 321.1Sskrll#include <mips/asm.h> 331.1SskrllRCSID("$NetBSD: locore_ingenic.S,v 1.1 2017/05/21 06:49:13 skrll Exp $") 341.1Sskrll 351.1Sskrll#include <mips/cpuregs.h> 361.1Sskrll#include <mips/ingenic/ingenic_coreregs.h> 371.1Sskrll 381.1Sskrll#include "assym.h" 391.1Sskrll 401.1Sskrll .set noreorder 411.1Sskrll .set noat 421.1Sskrll .set arch=mips32r2 431.1Sskrll 441.1Sskrll .text 451.1Sskrll 461.1Sskrll/* 471.1Sskrll * uint32_t mips_cp0_corectrl_read(void) 481.1Sskrll * 491.1Sskrll * Return the current value of the CP0 Core Control register. 501.1Sskrll */ 511.1SskrllLEAF(mips_cp0_corectrl_read) 521.1Sskrll mfc0 v0, CP0_CORE_CTRL 531.1Sskrll jr ra 541.1Sskrll nop 551.1SskrllEND(mips_cp0_corectrl_read) 561.1Sskrll 571.1Sskrll/* 581.1Sskrll * void mips_cp0_corectrl_write(uint32_t) 591.1Sskrll * 601.1Sskrll * Set the value of the CP0 Core Control register. 611.1Sskrll */ 621.1SskrllLEAF(mips_cp0_corectrl_write) 631.1Sskrll mtc0 a0, CP0_CORE_CTRL 641.1Sskrll jr.hb ra 651.1Sskrll nop 661.1SskrllEND(mips_cp0_corectrl_write) 671.1Sskrll 681.1Sskrll/* 691.1Sskrll * uint32_t mips_cp0_corestatus_read(void) 701.1Sskrll * 711.1Sskrll * Return the current value of the CP0 Core Status register. 721.1Sskrll */ 731.1SskrllLEAF(mips_cp0_corestatus_read) 741.1Sskrll mfc0 v0, CP0_CORE_STATUS 751.1Sskrll jr ra 761.1Sskrll nop 771.1SskrllEND(mips_cp0_corestatus_read) 781.1Sskrll 791.1Sskrll/* 801.1Sskrll * void mips_cp0_corestatus_write(uint32_t) 811.1Sskrll * 821.1Sskrll * Set the value of the CP0 Core Status register. 831.1Sskrll */ 841.1SskrllLEAF(mips_cp0_corestatus_write) 851.1Sskrll mtc0 a0, CP0_CORE_STATUS 861.1Sskrll jr.hb ra 871.1Sskrll nop 881.1SskrllEND(mips_cp0_corestatus_write) 891.1Sskrll 901.1Sskrll 911.1Sskrll/* 921.1Sskrll * uint32_t mips_cp0_corereim_read(void) 931.1Sskrll * 941.1Sskrll * Return the current value of the CP0 Reset Entry & IRQ Mask register. 951.1Sskrll */ 961.1SskrllLEAF(mips_cp0_corereim_read) 971.1Sskrll mfc0 v0, CP0_CORE_REIM 981.1Sskrll jr ra 991.1Sskrll nop 1001.1SskrllEND(mips_cp0_corereim_read) 1011.1Sskrll 1021.1Sskrll/* 1031.1Sskrll * void mips_cp0_corereim_write(uint32_t) 1041.1Sskrll * 1051.1Sskrll * Set the value of the CP0 Core Reset Entry & IRQ Mask register. 1061.1Sskrll */ 1071.1SskrllLEAF(mips_cp0_corereim_write) 1081.1Sskrll mtc0 a0, CP0_CORE_REIM 1091.1Sskrll jr.hb ra 1101.1Sskrll nop 1111.1SskrllEND(mips_cp0_corereim_write) 1121.1Sskrll 1131.1Sskrll 1141.1Sskrll/* 1151.1Sskrll * uintptr_t mips_cp0_corembox_read(u_int sel) 1161.1Sskrll * 1171.1Sskrll * Return the current value of the selected CP0 Mailbox register. 1181.1Sskrll */ 1191.1SskrllLEAF(mips_cp0_corembox_read) 1201.1Sskrll sll a0, 2 1211.1Sskrll PTR_LA t9, 1f 1221.1Sskrll PTR_ADDU t9, a0 1231.1Sskrll jr t9 1241.1Sskrll nop 1251.1Sskrll1: 1261.1Sskrll jr ra 1271.1Sskrll mfc0 v0, CP0_CORE0_MBOX 1281.1Sskrll jr ra 1291.1Sskrll mfc0 v0, CP0_CORE1_MBOX 1301.1Sskrll jr ra 1311.1SskrllEND(mips_cp0_corembox_read) 1321.1Sskrll 1331.1Sskrll/* 1341.1Sskrll * void mips_cp0_watchlo_write(u_int sel, uinte32_t val) 1351.1Sskrll * 1361.1Sskrll * Set the current value of the selected CP0 Mailbox register. 1371.1Sskrll */ 1381.1SskrllLEAF(mips_cp0_corembox_write) 1391.1Sskrll sll a0, 2 1401.1Sskrll PTR_LA t9, 1f 1411.1Sskrll PTR_ADDU t9, a0 1421.1Sskrll jr t9 1431.1Sskrll nop 1441.1Sskrll1: 1451.1Sskrll jr.hb ra 1461.1Sskrll mtc0 a1, CP0_CORE0_MBOX 1471.1Sskrll jr.hb ra 1481.1Sskrll mtc0 a1, CP0_CORE1_MBOX 1491.1Sskrll jr.hb ra 1501.1SskrllEND(mips_cp0_corembox_write) 151