Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2010 Red Hat Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  *
0022  * Authors: Ben Skeggs
0023  */
0024 #include "mem.h"
0025 #include "vmm.h"
0026 
0027 #include <nvif/class.h>
0028 
0029 /* Map from compressed to corresponding uncompressed storage type.
0030  * The value 0xff represents an invalid storage type.
0031  */
0032 const u8 *
0033 gf100_mmu_kind(struct nvkm_mmu *mmu, int *count, u8 *invalid)
0034 {
0035     static const u8
0036     kind[256] = {
0037         0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0xff, 0x01, /* 0x00 */
0038         0x01, 0x01, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff,
0039         0xff, 0x11, 0xff, 0xff, 0xff, 0xff, 0xff, 0x11, /* 0x10 */
0040         0x11, 0x11, 0x11, 0xff, 0xff, 0xff, 0xff, 0xff,
0041         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x26, 0x27, /* 0x20 */
0042         0x28, 0x29, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0043         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x30 */
0044         0xff, 0xff, 0x26, 0x27, 0x28, 0x29, 0x26, 0x27,
0045         0x28, 0x29, 0xff, 0xff, 0xff, 0xff, 0x46, 0xff, /* 0x40 */
0046         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0047         0xff, 0x46, 0x46, 0x46, 0x46, 0xff, 0xff, 0xff, /* 0x50 */
0048         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0049         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x60 */
0050         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0051         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x70 */
0052         0xff, 0xff, 0xff, 0x7b, 0xff, 0xff, 0xff, 0xff,
0053         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7b, 0x7b, /* 0x80 */
0054         0x7b, 0x7b, 0xff, 0x8b, 0x8c, 0x8d, 0x8e, 0xff,
0055         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x90 */
0056         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0057         0xff, 0xff, 0xff, 0x8b, 0x8c, 0x8d, 0x8e, 0xa7, /* 0xa0 */
0058         0xa8, 0xa9, 0xaa, 0xff, 0xff, 0xff, 0xff, 0xff,
0059         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0xb0 */
0060         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa7,
0061         0xa8, 0xa9, 0xaa, 0xc3, 0xff, 0xff, 0xff, 0xff, /* 0xc0 */
0062         0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xc3, 0xc3,
0063         0xc3, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0xd0 */
0064         0xfe, 0xff, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfe,
0065         0xfe, 0xff, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xff, /* 0xe0 */
0066         0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xfe, 0xff,
0067         0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, /* 0xf0 */
0068         0xfe, 0xfe, 0xfe, 0xfe, 0xff, 0xfd, 0xfe, 0xff
0069     };
0070 
0071     *count = ARRAY_SIZE(kind);
0072     *invalid = 0xff;
0073     return kind;
0074 }
0075 
0076 static const struct nvkm_mmu_func
0077 gf100_mmu = {
0078     .dma_bits = 40,
0079     .mmu = {{ -1, -1, NVIF_CLASS_MMU_GF100}},
0080     .mem = {{ -1,  0, NVIF_CLASS_MEM_GF100}, gf100_mem_new, gf100_mem_map },
0081     .vmm = {{ -1, -1, NVIF_CLASS_VMM_GF100}, gf100_vmm_new },
0082     .kind = gf100_mmu_kind,
0083     .kind_sys = true,
0084 };
0085 
0086 int
0087 gf100_mmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
0088           struct nvkm_mmu **pmmu)
0089 {
0090     return nvkm_mmu_new_(&gf100_mmu, device, type, inst, pmmu);
0091 }