| .. | .. |
|---|
| 1 | | -/* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 1 | +/* SPDX-License-Identifier: MIT */ |
|---|
| 2 | 2 | #ifndef __NVIF_DEVICE_H__ |
|---|
| 3 | 3 | #define __NVIF_DEVICE_H__ |
|---|
| 4 | 4 | |
|---|
| .. | .. |
|---|
| 18 | 18 | struct nvif_user user; |
|---|
| 19 | 19 | }; |
|---|
| 20 | 20 | |
|---|
| 21 | | -int nvif_device_init(struct nvif_object *, u32 handle, s32 oclass, void *, u32, |
|---|
| 22 | | - struct nvif_device *); |
|---|
| 23 | | -void nvif_device_fini(struct nvif_device *); |
|---|
| 21 | +int nvif_device_ctor(struct nvif_object *, const char *name, u32 handle, |
|---|
| 22 | + s32 oclass, void *, u32, struct nvif_device *); |
|---|
| 23 | +void nvif_device_dtor(struct nvif_device *); |
|---|
| 24 | 24 | u64 nvif_device_time(struct nvif_device *); |
|---|
| 25 | | - |
|---|
| 26 | | -/* Delay based on GPU time (ie. PTIMER). |
|---|
| 27 | | - * |
|---|
| 28 | | - * Will return -ETIMEDOUT unless the loop was terminated with 'break', |
|---|
| 29 | | - * where it will return the number of nanoseconds taken instead. |
|---|
| 30 | | - */ |
|---|
| 31 | | -#define nvif_nsec(d,n,cond...) ({ \ |
|---|
| 32 | | - struct nvif_device *_device = (d); \ |
|---|
| 33 | | - u64 _nsecs = (n), _time0 = nvif_device_time(_device); \ |
|---|
| 34 | | - s64 _taken = 0; \ |
|---|
| 35 | | - \ |
|---|
| 36 | | - do { \ |
|---|
| 37 | | - cond \ |
|---|
| 38 | | - } while (_taken = nvif_device_time(_device) - _time0, _taken < _nsecs);\ |
|---|
| 39 | | - \ |
|---|
| 40 | | - if (_taken >= _nsecs) \ |
|---|
| 41 | | - _taken = -ETIMEDOUT; \ |
|---|
| 42 | | - _taken; \ |
|---|
| 43 | | -}) |
|---|
| 44 | | -#define nvif_usec(d,u,cond...) nvif_nsec((d), (u) * 1000, ##cond) |
|---|
| 45 | | -#define nvif_msec(d,m,cond...) nvif_usec((d), (m) * 1000, ##cond) |
|---|
| 46 | 25 | |
|---|
| 47 | 26 | /*XXX*/ |
|---|
| 48 | 27 | #include <subdev/bios.h> |
|---|