1/* 2 * Copyright 2012 Red Hat Inc. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included in 12 * all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 * 22 * Authors: Ben Skeggs, Ilia Mirkin 23 */ 24 25#include <engine/xtensa.h> 26#include <engine/bsp.h> 27 28/******************************************************************************* 29 * BSP object classes 30 ******************************************************************************/ 31 32static struct nouveau_oclass 33nv84_bsp_sclass[] = { 34 { 0x74b0, &nouveau_object_ofuncs }, 35 {}, 36}; 37 38/******************************************************************************* 39 * BSP context 40 ******************************************************************************/ 41 42static struct nouveau_oclass 43nv84_bsp_cclass = { 44 .handle = NV_ENGCTX(BSP, 0x84), 45 .ofuncs = &(struct nouveau_ofuncs) { 46 .ctor = _nouveau_xtensa_engctx_ctor, 47 .dtor = _nouveau_engctx_dtor, 48 .init = _nouveau_engctx_init, 49 .fini = _nouveau_engctx_fini, 50 .rd32 = _nouveau_engctx_rd32, 51 .wr32 = _nouveau_engctx_wr32, 52 }, 53}; 54 55/******************************************************************************* 56 * BSP engine/subdev functions 57 ******************************************************************************/ 58 59static int 60nv84_bsp_ctor(struct nouveau_object *parent, struct nouveau_object *engine, 61 struct nouveau_oclass *oclass, void *data, u32 size, 62 struct nouveau_object **pobject) 63{ 64 struct nouveau_xtensa *priv; 65 int ret; 66 67 ret = nouveau_xtensa_create(parent, engine, oclass, 0x103000, true, 68 "PBSP", "bsp", &priv); 69 *pobject = nv_object(priv); 70 if (ret) 71 return ret; 72 73 nv_subdev(priv)->unit = 0x04008000; 74 nv_engine(priv)->cclass = &nv84_bsp_cclass; 75 nv_engine(priv)->sclass = nv84_bsp_sclass; 76 priv->fifo_val = 0x1111; 77 priv->unkd28 = 0x90044; 78 return 0; 79} 80 81struct nouveau_oclass 82nv84_bsp_oclass = { 83 .handle = NV_ENGINE(BSP, 0x84), 84 .ofuncs = &(struct nouveau_ofuncs) { 85 .ctor = nv84_bsp_ctor, 86 .dtor = _nouveau_xtensa_dtor, 87 .init = _nouveau_xtensa_init, 88 .fini = _nouveau_xtensa_fini, 89 .rd32 = _nouveau_xtensa_rd32, 90 .wr32 = _nouveau_xtensa_wr32, 91 }, 92}; 93