| .. | .. |
|---|
| 23 | 23 | #include "head.h" |
|---|
| 24 | 24 | |
|---|
| 25 | 25 | #include <nvif/cl507d.h> |
|---|
| 26 | +#include <nvif/push507c.h> |
|---|
| 27 | +#include <nvif/timer.h> |
|---|
| 28 | + |
|---|
| 29 | +#include <nvhw/class/cl507d.h> |
|---|
| 26 | 30 | |
|---|
| 27 | 31 | #include "nouveau_bo.h" |
|---|
| 28 | 32 | |
|---|
| 29 | | -void |
|---|
| 33 | +int |
|---|
| 30 | 34 | core507d_update(struct nv50_core *core, u32 *interlock, bool ntfy) |
|---|
| 31 | 35 | { |
|---|
| 32 | | - u32 *push; |
|---|
| 33 | | - if ((push = evo_wait(&core->chan, 5))) { |
|---|
| 34 | | - if (ntfy) { |
|---|
| 35 | | - evo_mthd(push, 0x0084, 1); |
|---|
| 36 | | - evo_data(push, 0x80000000 | NV50_DISP_CORE_NTFY); |
|---|
| 37 | | - } |
|---|
| 38 | | - evo_mthd(push, 0x0080, 2); |
|---|
| 39 | | - evo_data(push, interlock[NV50_DISP_INTERLOCK_BASE] | |
|---|
| 40 | | - interlock[NV50_DISP_INTERLOCK_OVLY]); |
|---|
| 41 | | - evo_data(push, 0x00000000); |
|---|
| 42 | | - evo_kick(push, &core->chan); |
|---|
| 36 | + struct nvif_push *push = core->chan.push; |
|---|
| 37 | + int ret; |
|---|
| 38 | + |
|---|
| 39 | + if ((ret = PUSH_WAIT(push, 5))) |
|---|
| 40 | + return ret; |
|---|
| 41 | + |
|---|
| 42 | + if (ntfy) { |
|---|
| 43 | + PUSH_MTHD(push, NV507D, SET_NOTIFIER_CONTROL, |
|---|
| 44 | + NVDEF(NV507D, SET_NOTIFIER_CONTROL, MODE, WRITE) | |
|---|
| 45 | + NVVAL(NV507D, SET_NOTIFIER_CONTROL, OFFSET, NV50_DISP_CORE_NTFY >> 2) | |
|---|
| 46 | + NVDEF(NV507D, SET_NOTIFIER_CONTROL, NOTIFY, ENABLE)); |
|---|
| 43 | 47 | } |
|---|
| 48 | + |
|---|
| 49 | + PUSH_MTHD(push, NV507D, UPDATE, interlock[NV50_DISP_INTERLOCK_BASE] | |
|---|
| 50 | + interlock[NV50_DISP_INTERLOCK_OVLY] | |
|---|
| 51 | + NVDEF(NV507D, UPDATE, NOT_DRIVER_FRIENDLY, FALSE) | |
|---|
| 52 | + NVDEF(NV507D, UPDATE, NOT_DRIVER_UNFRIENDLY, FALSE) | |
|---|
| 53 | + NVDEF(NV507D, UPDATE, INHIBIT_INTERRUPTS, FALSE), |
|---|
| 54 | + |
|---|
| 55 | + SET_NOTIFIER_CONTROL, |
|---|
| 56 | + NVDEF(NV507D, SET_NOTIFIER_CONTROL, NOTIFY, DISABLE)); |
|---|
| 57 | + |
|---|
| 58 | + return PUSH_KICK(push); |
|---|
| 44 | 59 | } |
|---|
| 45 | 60 | |
|---|
| 46 | 61 | int |
|---|
| .. | .. |
|---|
| 48 | 63 | struct nvif_device *device) |
|---|
| 49 | 64 | { |
|---|
| 50 | 65 | s64 time = nvif_msec(device, 2000ULL, |
|---|
| 51 | | - if (nouveau_bo_rd32(bo, offset / 4)) |
|---|
| 66 | + if (NVBO_TD32(bo, offset, NV_DISP_CORE_NOTIFIER_1, COMPLETION_0, DONE, ==, TRUE)) |
|---|
| 52 | 67 | break; |
|---|
| 53 | 68 | usleep_range(1, 2); |
|---|
| 54 | 69 | ); |
|---|
| .. | .. |
|---|
| 58 | 73 | void |
|---|
| 59 | 74 | core507d_ntfy_init(struct nouveau_bo *bo, u32 offset) |
|---|
| 60 | 75 | { |
|---|
| 61 | | - nouveau_bo_wr32(bo, offset / 4, 0x00000000); |
|---|
| 76 | + NVBO_WR32(bo, offset, NV_DISP_CORE_NOTIFIER_1, COMPLETION_0, |
|---|
| 77 | + NVDEF(NV_DISP_CORE_NOTIFIER_1, COMPLETION_0, DONE, FALSE)); |
|---|
| 62 | 78 | } |
|---|
| 63 | 79 | |
|---|
| 64 | | -void |
|---|
| 80 | +int |
|---|
| 81 | +core507d_read_caps(struct nv50_disp *disp) |
|---|
| 82 | +{ |
|---|
| 83 | + struct nvif_push *push = disp->core->chan.push; |
|---|
| 84 | + int ret; |
|---|
| 85 | + |
|---|
| 86 | + ret = PUSH_WAIT(push, 6); |
|---|
| 87 | + if (ret) |
|---|
| 88 | + return ret; |
|---|
| 89 | + |
|---|
| 90 | + PUSH_MTHD(push, NV507D, SET_NOTIFIER_CONTROL, |
|---|
| 91 | + NVDEF(NV507D, SET_NOTIFIER_CONTROL, MODE, WRITE) | |
|---|
| 92 | + NVVAL(NV507D, SET_NOTIFIER_CONTROL, OFFSET, NV50_DISP_CORE_NTFY >> 2) | |
|---|
| 93 | + NVDEF(NV507D, SET_NOTIFIER_CONTROL, NOTIFY, ENABLE)); |
|---|
| 94 | + |
|---|
| 95 | + PUSH_MTHD(push, NV507D, GET_CAPABILITIES, 0x00000000); |
|---|
| 96 | + |
|---|
| 97 | + PUSH_MTHD(push, NV507D, SET_NOTIFIER_CONTROL, |
|---|
| 98 | + NVDEF(NV507D, SET_NOTIFIER_CONTROL, NOTIFY, DISABLE)); |
|---|
| 99 | + |
|---|
| 100 | + return PUSH_KICK(push); |
|---|
| 101 | +} |
|---|
| 102 | + |
|---|
| 103 | +int |
|---|
| 104 | +core507d_caps_init(struct nouveau_drm *drm, struct nv50_disp *disp) |
|---|
| 105 | +{ |
|---|
| 106 | + struct nv50_core *core = disp->core; |
|---|
| 107 | + struct nouveau_bo *bo = disp->sync; |
|---|
| 108 | + s64 time; |
|---|
| 109 | + int ret; |
|---|
| 110 | + |
|---|
| 111 | + NVBO_WR32(bo, NV50_DISP_CORE_NTFY, NV_DISP_CORE_NOTIFIER_1, CAPABILITIES_1, |
|---|
| 112 | + NVDEF(NV_DISP_CORE_NOTIFIER_1, CAPABILITIES_1, DONE, FALSE)); |
|---|
| 113 | + |
|---|
| 114 | + ret = core507d_read_caps(disp); |
|---|
| 115 | + if (ret < 0) |
|---|
| 116 | + return ret; |
|---|
| 117 | + |
|---|
| 118 | + time = nvif_msec(core->chan.base.device, 2000ULL, |
|---|
| 119 | + if (NVBO_TD32(bo, NV50_DISP_CORE_NTFY, |
|---|
| 120 | + NV_DISP_CORE_NOTIFIER_1, CAPABILITIES_1, DONE, ==, TRUE)) |
|---|
| 121 | + break; |
|---|
| 122 | + usleep_range(1, 2); |
|---|
| 123 | + ); |
|---|
| 124 | + if (time < 0) |
|---|
| 125 | + NV_ERROR(drm, "core caps notifier timeout\n"); |
|---|
| 126 | + |
|---|
| 127 | + return 0; |
|---|
| 128 | +} |
|---|
| 129 | + |
|---|
| 130 | +int |
|---|
| 65 | 131 | core507d_init(struct nv50_core *core) |
|---|
| 66 | 132 | { |
|---|
| 67 | | - u32 *push; |
|---|
| 68 | | - if ((push = evo_wait(&core->chan, 2))) { |
|---|
| 69 | | - evo_mthd(push, 0x0088, 1); |
|---|
| 70 | | - evo_data(push, core->chan.sync.handle); |
|---|
| 71 | | - evo_kick(push, &core->chan); |
|---|
| 72 | | - } |
|---|
| 133 | + struct nvif_push *push = core->chan.push; |
|---|
| 134 | + int ret; |
|---|
| 135 | + |
|---|
| 136 | + if ((ret = PUSH_WAIT(push, 2))) |
|---|
| 137 | + return ret; |
|---|
| 138 | + |
|---|
| 139 | + PUSH_MTHD(push, NV507D, SET_CONTEXT_DMA_NOTIFIER, core->chan.sync.handle); |
|---|
| 140 | + return PUSH_KICK(push); |
|---|
| 73 | 141 | } |
|---|
| 74 | 142 | |
|---|
| 75 | 143 | static const struct nv50_core_func |
|---|
| 76 | 144 | core507d = { |
|---|
| 77 | 145 | .init = core507d_init, |
|---|
| 78 | 146 | .ntfy_init = core507d_ntfy_init, |
|---|
| 147 | + .caps_init = core507d_caps_init, |
|---|
| 79 | 148 | .ntfy_wait_done = core507d_ntfy_wait_done, |
|---|
| 80 | 149 | .update = core507d_update, |
|---|
| 81 | 150 | .head = &head507d, |
|---|
| .. | .. |
|---|
| 99 | 168 | |
|---|
| 100 | 169 | ret = nv50_dmac_create(&drm->client.device, &disp->disp->object, |
|---|
| 101 | 170 | &oclass, 0, &args, sizeof(args), |
|---|
| 102 | | - disp->sync->bo.offset, &core->chan); |
|---|
| 171 | + disp->sync->offset, &core->chan); |
|---|
| 103 | 172 | if (ret) { |
|---|
| 104 | 173 | NV_ERROR(drm, "core%04x allocation failed: %d\n", oclass, ret); |
|---|
| 105 | 174 | return ret; |
|---|