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