2 * Copyright 2018 Red Hat Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
24 #include <core/memory.h>
25 #include <subdev/timer.h>
28 tu102_bar_bar2_wait(struct nvkm_bar
*bar
)
30 struct nvkm_device
*device
= bar
->subdev
.device
;
31 nvkm_msec(device
, 2000,
32 if (!(nvkm_rd32(device
, 0xb80f50) & 0x0000000c))
38 tu102_bar_bar2_fini(struct nvkm_bar
*bar
)
40 nvkm_mask(bar
->subdev
.device
, 0xb80f48, 0x80000000, 0x00000000);
44 tu102_bar_bar2_init(struct nvkm_bar
*base
)
46 struct nvkm_device
*device
= base
->subdev
.device
;
47 struct gf100_bar
*bar
= gf100_bar(base
);
48 u32 addr
= nvkm_memory_addr(bar
->bar
[0].inst
) >> 12;
51 nvkm_wr32(device
, 0xb80f48, 0x80000000 | addr
);
55 tu102_bar_bar1_wait(struct nvkm_bar
*bar
)
57 struct nvkm_device
*device
= bar
->subdev
.device
;
58 nvkm_msec(device
, 2000,
59 if (!(nvkm_rd32(device
, 0xb80f50) & 0x00000003))
65 tu102_bar_bar1_fini(struct nvkm_bar
*bar
)
67 nvkm_mask(bar
->subdev
.device
, 0xb80f40, 0x80000000, 0x00000000);
71 tu102_bar_bar1_init(struct nvkm_bar
*base
)
73 struct nvkm_device
*device
= base
->subdev
.device
;
74 struct gf100_bar
*bar
= gf100_bar(base
);
75 const u32 addr
= nvkm_memory_addr(bar
->bar
[1].inst
) >> 12;
76 nvkm_wr32(device
, 0xb80f40, 0x80000000 | addr
);
79 static const struct nvkm_bar_func
81 .dtor
= gf100_bar_dtor
,
82 .oneinit
= gf100_bar_oneinit
,
83 .bar1
.init
= tu102_bar_bar1_init
,
84 .bar1
.fini
= tu102_bar_bar1_fini
,
85 .bar1
.wait
= tu102_bar_bar1_wait
,
86 .bar1
.vmm
= gf100_bar_bar1_vmm
,
87 .bar2
.init
= tu102_bar_bar2_init
,
88 .bar2
.fini
= tu102_bar_bar2_fini
,
89 .bar2
.wait
= tu102_bar_bar2_wait
,
90 .bar2
.vmm
= gf100_bar_bar2_vmm
,
91 .flush
= g84_bar_flush
,
95 tu102_bar_new(struct nvkm_device
*device
, int index
, struct nvkm_bar
**pbar
)
97 return gf100_bar_new_(&tu102_bar
, device
, index
, pbar
);