diff options
Diffstat (limited to 'nvkm/include')
92 files changed, 0 insertions, 4196 deletions
diff --git a/nvkm/include/core/client.h b/nvkm/include/core/client.h deleted file mode 100644 index 827c4e972..000000000 --- a/nvkm/include/core/client.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef __NOUVEAU_CLIENT_H__ -#define __NOUVEAU_CLIENT_H__ - -#include <core/namedb.h> - -struct nouveau_client { - struct nouveau_namedb namedb; - struct nouveau_handle *root; - struct nouveau_object *device; - char name[32]; - u32 debug; - struct nouveau_vm *vm; - bool super; - void *data; - - int (*ntfy)(const void *, u32, const void *, u32); - struct nvkm_client_notify *notify[16]; -}; - -static inline struct nouveau_client * -nv_client(void *obj) -{ -#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA - if (unlikely(!nv_iclass(obj, NV_CLIENT_CLASS))) - nv_assert("BAD CAST -> NvClient, %08x", nv_hclass(obj)); -#endif - return obj; -} - -static inline struct nouveau_client * -nouveau_client(void *obj) -{ - struct nouveau_object *client = nv_object(obj); - while (client && !(nv_iclass(client, NV_CLIENT_CLASS))) - client = client->parent; - return (void *)client; -} - -#define nouveau_client_create(n,c,oc,od,d) \ - nouveau_client_create_((n), (c), (oc), (od), sizeof(**d), (void **)d) - -int nouveau_client_create_(const char *name, u64 device, const char *cfg, - const char *dbg, int, void **); -#define nouveau_client_destroy(p) \ - nouveau_namedb_destroy(&(p)->base) - -int nouveau_client_init(struct nouveau_client *); -int nouveau_client_fini(struct nouveau_client *, bool suspend); -const char *nouveau_client_name(void *obj); - -int nvkm_client_notify_new(struct nouveau_object *, struct nvkm_event *, - void *data, u32 size); -int nvkm_client_notify_del(struct nouveau_client *, int index); -int nvkm_client_notify_get(struct nouveau_client *, int index); -int nvkm_client_notify_put(struct nouveau_client *, int index); - -#endif diff --git a/nvkm/include/core/debug.h b/nvkm/include/core/debug.h deleted file mode 100644 index 8092e2e90..000000000 --- a/nvkm/include/core/debug.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __NOUVEAU_DEBUG_H__ -#define __NOUVEAU_DEBUG_H__ - -extern int nv_info_debug_level; - -#define NV_DBG_FATAL 0 -#define NV_DBG_ERROR 1 -#define NV_DBG_WARN 2 -#define NV_DBG_INFO nv_info_debug_level -#define NV_DBG_DEBUG 4 -#define NV_DBG_TRACE 5 -#define NV_DBG_PARANOIA 6 -#define NV_DBG_SPAM 7 - -#define NV_DBG_INFO_NORMAL 3 -#define NV_DBG_INFO_SILENT NV_DBG_DEBUG - -#define nv_debug_level(a) nv_info_debug_level = NV_DBG_INFO_##a - -#endif diff --git a/nvkm/include/core/device.h b/nvkm/include/core/device.h deleted file mode 100644 index 21a055aca..000000000 --- a/nvkm/include/core/device.h +++ /dev/null @@ -1,147 +0,0 @@ -#ifndef __NOUVEAU_DEVICE_H__ -#define __NOUVEAU_DEVICE_H__ - -#include <core/object.h> -#include <core/subdev.h> -#include <core/engine.h> -#include <core/event.h> - -enum nv_subdev_type { - NVDEV_ENGINE_DEVICE, - NVDEV_SUBDEV_VBIOS, - - /* All subdevs from DEVINIT to DEVINIT_LAST will be created before - * *any* of them are initialised. This subdev category is used - * for any subdevs that the VBIOS init table parsing may call out - * to during POST. - */ - NVDEV_SUBDEV_DEVINIT, - NVDEV_SUBDEV_IBUS, - NVDEV_SUBDEV_GPIO, - NVDEV_SUBDEV_I2C, - NVDEV_SUBDEV_DEVINIT_LAST = NVDEV_SUBDEV_I2C, - - /* This grouping of subdevs are initialised right after they've - * been created, and are allowed to assume any subdevs in the - * list above them exist and have been initialised. - */ - NVDEV_SUBDEV_FUSE, - NVDEV_SUBDEV_MXM, - NVDEV_SUBDEV_MC, - NVDEV_SUBDEV_BUS, - NVDEV_SUBDEV_TIMER, - NVDEV_SUBDEV_FB, - NVDEV_SUBDEV_LTC, - NVDEV_SUBDEV_INSTMEM, - NVDEV_SUBDEV_VM, - NVDEV_SUBDEV_BAR, - NVDEV_SUBDEV_PWR, - NVDEV_SUBDEV_VOLT, - NVDEV_SUBDEV_THERM, - NVDEV_SUBDEV_CLOCK, - - NVDEV_ENGINE_FIRST, - NVDEV_ENGINE_DMAOBJ = NVDEV_ENGINE_FIRST, - NVDEV_ENGINE_IFB, - NVDEV_ENGINE_FIFO, - NVDEV_ENGINE_SW, - NVDEV_ENGINE_GR, - NVDEV_ENGINE_MPEG, - NVDEV_ENGINE_ME, - NVDEV_ENGINE_VP, - NVDEV_ENGINE_CRYPT, - NVDEV_ENGINE_BSP, - NVDEV_ENGINE_PPP, - NVDEV_ENGINE_COPY0, - NVDEV_ENGINE_COPY1, - NVDEV_ENGINE_COPY2, - NVDEV_ENGINE_VIC, - NVDEV_ENGINE_VENC, - NVDEV_ENGINE_DISP, - NVDEV_ENGINE_PERFMON, - - NVDEV_SUBDEV_NR, -}; - -struct nouveau_device { - struct nouveau_engine engine; - struct list_head head; - - struct pci_dev *pdev; - struct platform_device *platformdev; - u64 handle; - - struct nvkm_event event; - - const char *cfgopt; - const char *dbgopt; - const char *name; - const char *cname; - u64 disable_mask; - - enum { - NV_04 = 0x04, - NV_10 = 0x10, - NV_11 = 0x11, - NV_20 = 0x20, - NV_30 = 0x30, - NV_40 = 0x40, - NV_50 = 0x50, - NV_C0 = 0xc0, - NV_E0 = 0xe0, - GM100 = 0x110, - } card_type; - u32 chipset; - u8 chiprev; - u32 crystal; - - struct nouveau_oclass *oclass[NVDEV_SUBDEV_NR]; - struct nouveau_object *subdev[NVDEV_SUBDEV_NR]; - - struct { - struct notifier_block nb; - } acpi; -}; - -int nouveau_device_list(u64 *name, int size); - -struct nouveau_device *nv_device(void *obj); - -static inline bool -nv_device_match(struct nouveau_object *object, u16 dev, u16 ven, u16 sub) -{ - struct nouveau_device *device = nv_device(object); - return device->pdev->device == dev && - device->pdev->subsystem_vendor == ven && - device->pdev->subsystem_device == sub; -} - -static inline bool -nv_device_is_pci(struct nouveau_device *device) -{ - return device->pdev != NULL; -} - -static inline bool -nv_device_is_cpu_coherent(struct nouveau_device *device) -{ - return (!IS_ENABLED(CONFIG_ARM) && nv_device_is_pci(device)); -} - -static inline struct device * -nv_device_base(struct nouveau_device *device) -{ - return nv_device_is_pci(device) ? &device->pdev->dev : - &device->platformdev->dev; -} - -resource_size_t -nv_device_resource_start(struct nouveau_device *device, unsigned int bar); - -resource_size_t -nv_device_resource_len(struct nouveau_device *device, unsigned int bar); - -int -nv_device_get_irq(struct nouveau_device *device, bool stall); - -#endif diff --git a/nvkm/include/core/engctx.h b/nvkm/include/core/engctx.h deleted file mode 100644 index dbc6a3e6d..000000000 --- a/nvkm/include/core/engctx.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef __NOUVEAU_ENGCTX_H__ -#define __NOUVEAU_ENGCTX_H__ - -#include <core/object.h> -#include <core/gpuobj.h> - -#include <subdev/vm.h> - -#define NV_ENGCTX_(eng,var) (NV_ENGCTX_CLASS | ((var) << 8) | (eng)) -#define NV_ENGCTX(name,var) NV_ENGCTX_(NVDEV_ENGINE_##name, (var)) - -struct nouveau_engctx { - struct nouveau_gpuobj gpuobj; - struct nouveau_vma vma; - struct list_head head; - unsigned long save; - u64 addr; -}; - -static inline struct nouveau_engctx * -nv_engctx(void *obj) -{ -#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA - if (unlikely(!nv_iclass(obj, NV_ENGCTX_CLASS))) - nv_assert("BAD CAST -> NvEngCtx, %08x", nv_hclass(obj)); -#endif - return obj; -} - -#define nouveau_engctx_create(p,e,c,g,s,a,f,d) \ - nouveau_engctx_create_((p), (e), (c), (g), (s), (a), (f), \ - sizeof(**d), (void **)d) - -int nouveau_engctx_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, struct nouveau_object *, - u32 size, u32 align, u32 flags, - int length, void **data); -void nouveau_engctx_destroy(struct nouveau_engctx *); -int nouveau_engctx_init(struct nouveau_engctx *); -int nouveau_engctx_fini(struct nouveau_engctx *, bool suspend); - -int _nouveau_engctx_ctor(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, void *, u32, - struct nouveau_object **); -void _nouveau_engctx_dtor(struct nouveau_object *); -int _nouveau_engctx_init(struct nouveau_object *); -int _nouveau_engctx_fini(struct nouveau_object *, bool suspend); -#define _nouveau_engctx_rd32 _nouveau_gpuobj_rd32 -#define _nouveau_engctx_wr32 _nouveau_gpuobj_wr32 - -struct nouveau_object *nouveau_engctx_get(struct nouveau_engine *, u64 addr); -void nouveau_engctx_put(struct nouveau_object *); - -#endif diff --git a/nvkm/include/core/engine.h b/nvkm/include/core/engine.h deleted file mode 100644 index d7ebd35ef..000000000 --- a/nvkm/include/core/engine.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef __NOUVEAU_ENGINE_H__ -#define __NOUVEAU_ENGINE_H__ - -#include <core/object.h> -#include <core/subdev.h> - -#define NV_ENGINE_(eng,var) (NV_ENGINE_CLASS | ((var) << 8) | (eng)) -#define NV_ENGINE(name,var) NV_ENGINE_(NVDEV_ENGINE_##name, (var)) - -struct nouveau_engine { - struct nouveau_subdev subdev; - struct nouveau_oclass *cclass; - struct nouveau_oclass *sclass; - - struct list_head contexts; - spinlock_t lock; - - void (*tile_prog)(struct nouveau_engine *, int region); - int (*tlb_flush)(struct nouveau_engine *); -}; - -static inline struct nouveau_engine * -nv_engine(void *obj) -{ -#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA - if (unlikely(!nv_iclass(obj, NV_ENGINE_CLASS))) - nv_assert("BAD CAST -> NvEngine, %08x", nv_hclass(obj)); -#endif - return obj; -} - -static inline int -nv_engidx(struct nouveau_engine *engine) -{ - return nv_subidx(&engine->subdev); -} - -struct nouveau_engine *nouveau_engine(void *obj, int idx); - -#define nouveau_engine_create(p,e,c,d,i,f,r) \ - nouveau_engine_create_((p), (e), (c), (d), (i), (f), \ - sizeof(**r),(void **)r) - -#define nouveau_engine_destroy(p) \ - nouveau_subdev_destroy(&(p)->subdev) -#define nouveau_engine_init(p) \ - nouveau_subdev_init(&(p)->subdev) -#define nouveau_engine_fini(p,s) \ - nouveau_subdev_fini(&(p)->subdev, (s)) - -int nouveau_engine_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, bool, const char *, - const char *, int, void **); - -#define _nouveau_engine_dtor _nouveau_subdev_dtor -#define _nouveau_engine_init _nouveau_subdev_init -#define _nouveau_engine_fini _nouveau_subdev_fini - -#endif diff --git a/nvkm/include/core/enum.h b/nvkm/include/core/enum.h deleted file mode 100644 index 4fc62bb8c..000000000 --- a/nvkm/include/core/enum.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __NOUVEAU_ENUM_H__ -#define __NOUVEAU_ENUM_H__ - -struct nouveau_enum { - u32 value; - const char *name; - const void *data; - u32 data2; -}; - -const struct nouveau_enum * -nouveau_enum_find(const struct nouveau_enum *, u32 value); - -const struct nouveau_enum * -nouveau_enum_print(const struct nouveau_enum *en, u32 value); - -struct nouveau_bitfield { - u32 mask; - const char *name; -}; - -void nouveau_bitfield_print(const struct nouveau_bitfield *, u32 value); - -#endif diff --git a/nvkm/include/core/event.h b/nvkm/include/core/event.h deleted file mode 100644 index 928765289..000000000 --- a/nvkm/include/core/event.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __NVKM_EVENT_H__ -#define __NVKM_EVENT_H__ - -#include <core/notify.h> - -struct nvkm_event_func { - int (*ctor)(struct nouveau_object *, void *data, u32 size, - struct nvkm_notify *); - void (*send)(void *data, u32 size, struct nvkm_notify *); - void (*init)(struct nvkm_event *, int type, int index); - void (*fini)(struct nvkm_event *, int type, int index); -}; - -struct nvkm_event { - const struct nvkm_event_func *func; - - int types_nr; - int index_nr; - - spinlock_t refs_lock; - spinlock_t list_lock; - struct list_head list; - int *refs; -}; - -int nvkm_event_init(const struct nvkm_event_func *func, - int types_nr, int index_nr, - struct nvkm_event *); -void nvkm_event_fini(struct nvkm_event *); -void nvkm_event_get(struct nvkm_event *, u32 types, int index); -void nvkm_event_put(struct nvkm_event *, u32 types, int index); -void nvkm_event_send(struct nvkm_event *, u32 types, int index, - void *data, u32 size); - -#endif diff --git a/nvkm/include/core/gpuobj.h b/nvkm/include/core/gpuobj.h deleted file mode 100644 index c262c2505..000000000 --- a/nvkm/include/core/gpuobj.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef __NOUVEAU_GPUOBJ_H__ -#define __NOUVEAU_GPUOBJ_H__ - -#include <core/object.h> -#include <core/device.h> -#include <core/parent.h> -#include <core/mm.h> - -struct nouveau_vma; -struct nouveau_vm; - -#define NVOBJ_FLAG_ZERO_ALLOC 0x00000001 -#define NVOBJ_FLAG_ZERO_FREE 0x00000002 -#define NVOBJ_FLAG_HEAP 0x00000004 - -struct nouveau_gpuobj { - struct nouveau_object object; - struct nouveau_object *parent; - struct nouveau_mm_node *node; - struct nouveau_mm heap; - - u32 flags; - u64 addr; - u32 size; -}; - -static inline struct nouveau_gpuobj * -nv_gpuobj(void *obj) -{ -#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA - if (unlikely(!nv_iclass(obj, NV_GPUOBJ_CLASS))) - nv_assert("BAD CAST -> NvGpuObj, %08x", nv_hclass(obj)); -#endif - return obj; -} - -#define nouveau_gpuobj_create(p,e,c,v,g,s,a,f,d) \ - nouveau_gpuobj_create_((p), (e), (c), (v), (g), (s), (a), (f), \ - sizeof(**d), (void **)d) -#define nouveau_gpuobj_init(p) nouveau_object_init(&(p)->object) -#define nouveau_gpuobj_fini(p,s) nouveau_object_fini(&(p)->object, (s)) -int nouveau_gpuobj_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, u32 pclass, - struct nouveau_object *, u32 size, u32 align, - u32 flags, int length, void **); -void nouveau_gpuobj_destroy(struct nouveau_gpuobj *); - -int nouveau_gpuobj_new(struct nouveau_object *, struct nouveau_object *, - u32 size, u32 align, u32 flags, - struct nouveau_gpuobj **); -int nouveau_gpuobj_dup(struct nouveau_object *, struct nouveau_gpuobj *, - struct nouveau_gpuobj **); - -int nouveau_gpuobj_map(struct nouveau_gpuobj *, u32 acc, struct nouveau_vma *); -int nouveau_gpuobj_map_vm(struct nouveau_gpuobj *, struct nouveau_vm *, - u32 access, struct nouveau_vma *); -void nouveau_gpuobj_unmap(struct nouveau_vma *); - -static inline void -nouveau_gpuobj_ref(struct nouveau_gpuobj *obj, struct nouveau_gpuobj **ref) -{ - nouveau_object_ref(&obj->object, (struct nouveau_object **)ref); -} - -void _nouveau_gpuobj_dtor(struct nouveau_object *); -int _nouveau_gpuobj_init(struct nouveau_object *); -int _nouveau_gpuobj_fini(struct nouveau_object *, bool); -u32 _nouveau_gpuobj_rd32(struct nouveau_object *, u64); -void _nouveau_gpuobj_wr32(struct nouveau_object *, u64, u32); - -#endif diff --git a/nvkm/include/core/handle.h b/nvkm/include/core/handle.h deleted file mode 100644 index d22a59138..000000000 --- a/nvkm/include/core/handle.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef __NOUVEAU_HANDLE_H__ -#define __NOUVEAU_HANDLE_H__ - -struct nouveau_handle { - struct nouveau_namedb *namedb; - struct list_head node; - - struct list_head head; - struct list_head tree; - u32 name; - u32 priv; - - u8 route; - u64 token; - - struct nouveau_handle *parent; - struct nouveau_object *object; -}; - -int nouveau_handle_create(struct nouveau_object *, u32 parent, u32 handle, - struct nouveau_object *, struct nouveau_handle **); -void nouveau_handle_destroy(struct nouveau_handle *); -int nouveau_handle_init(struct nouveau_handle *); -int nouveau_handle_fini(struct nouveau_handle *, bool suspend); - -struct nouveau_object * -nouveau_handle_ref(struct nouveau_object *, u32 name); - -struct nouveau_handle *nouveau_handle_get_class(struct nouveau_object *, u16); -struct nouveau_handle *nouveau_handle_get_vinst(struct nouveau_object *, u64); -struct nouveau_handle *nouveau_handle_get_cinst(struct nouveau_object *, u32); -void nouveau_handle_put(struct nouveau_handle *); - -#endif diff --git a/nvkm/include/core/intr.h b/nvkm/include/core/intr.h deleted file mode 100644 index d2599746e..000000000 --- a/nvkm/include/core/intr.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __NOUVEAU_INTR_H__ -#define __NOUVEAU_INTR_H__ - -struct nouveau_device; - -void nouveau_intr(struct nouveau_device *); - -#endif diff --git a/nvkm/include/core/ioctl.h b/nvkm/include/core/ioctl.h deleted file mode 100644 index ac7935c24..000000000 --- a/nvkm/include/core/ioctl.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __NVKM_IOCTL_H__ -#define __NVKM_IOCTL_H__ - -int nvkm_ioctl(struct nouveau_client *, bool, void *, u32, void **); - -#endif diff --git a/nvkm/include/core/mm.h b/nvkm/include/core/mm.h deleted file mode 100644 index bfe693154..000000000 --- a/nvkm/include/core/mm.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __NOUVEAU_MM_H__ -#define __NOUVEAU_MM_H__ - -struct nouveau_mm_node { - struct list_head nl_entry; - struct list_head fl_entry; - struct list_head rl_entry; - -#define NVKM_MM_HEAP_ANY 0x00 - u8 heap; -#define NVKM_MM_TYPE_NONE 0x00 -#define NVKM_MM_TYPE_HOLE 0xff - u8 type; - u32 offset; - u32 length; -}; - -struct nouveau_mm { - struct list_head nodes; - struct list_head free; - - u32 block_size; - int heap_nodes; -}; - -static inline bool -nouveau_mm_initialised(struct nouveau_mm *mm) -{ - return mm->block_size != 0; -} - -int nouveau_mm_init(struct nouveau_mm *, u32 offset, u32 length, u32 block); -int nouveau_mm_fini(struct nouveau_mm *); -int nouveau_mm_head(struct nouveau_mm *, u8 heap, u8 type, u32 size_max, - u32 size_min, u32 align, struct nouveau_mm_node **); -int nouveau_mm_tail(struct nouveau_mm *, u8 heap, u8 type, u32 size_max, - u32 size_min, u32 align, struct nouveau_mm_node **); -void nouveau_mm_free(struct nouveau_mm *, struct nouveau_mm_node **); - -#endif diff --git a/nvkm/include/core/namedb.h b/nvkm/include/core/namedb.h deleted file mode 100644 index 98e666b1e..000000000 --- a/nvkm/include/core/namedb.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef __NOUVEAU_NAMEDB_H__ -#define __NOUVEAU_NAMEDB_H__ - -#include <core/parent.h> - -struct nouveau_handle; - -struct nouveau_namedb { - struct nouveau_parent parent; - rwlock_t lock; - struct list_head list; -}; - -static inline struct nouveau_namedb * -nv_namedb(void *obj) -{ -#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA - if (unlikely(!nv_iclass(obj, NV_NAMEDB_CLASS))) - nv_assert("BAD CAST -> NvNameDB, %08x", nv_hclass(obj)); -#endif - return obj; -} - -#define nouveau_namedb_create(p,e,c,v,s,m,d) \ - nouveau_namedb_create_((p), (e), (c), (v), (s), (m), \ - sizeof(**d), (void **)d) -#define nouveau_namedb_init(p) \ - nouveau_parent_init(&(p)->parent) -#define nouveau_namedb_fini(p,s) \ - nouveau_parent_fini(&(p)->parent, (s)) -#define nouveau_namedb_destroy(p) \ - nouveau_parent_destroy(&(p)->parent) - -int nouveau_namedb_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, u32 pclass, - struct nouveau_oclass *, u64 engcls, - int size, void **); - -int _nouveau_namedb_ctor(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, void *, u32, - struct nouveau_object **); -#define _nouveau_namedb_dtor _nouveau_parent_dtor -#define _nouveau_namedb_init _nouveau_parent_init -#define _nouveau_namedb_fini _nouveau_parent_fini - -int nouveau_namedb_insert(struct nouveau_namedb *, u32 name, - struct nouveau_object *, struct nouveau_handle *); -void nouveau_namedb_remove(struct nouveau_handle *); - -struct nouveau_handle *nouveau_namedb_get(struct nouveau_namedb *, u32); -struct nouveau_handle *nouveau_namedb_get_class(struct nouveau_namedb *, u16); -struct nouveau_handle *nouveau_namedb_get_vinst(struct nouveau_namedb *, u64); -struct nouveau_handle *nouveau_namedb_get_cinst(struct nouveau_namedb *, u32); -void nouveau_namedb_put(struct nouveau_handle *); - -#endif diff --git a/nvkm/include/core/notify.h b/nvkm/include/core/notify.h deleted file mode 100644 index a7c3c5f57..000000000 --- a/nvkm/include/core/notify.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __NVKM_NOTIFY_H__ -#define __NVKM_NOTIFY_H__ - -struct nvkm_notify { - struct nvkm_event *event; - struct list_head head; -#define NVKM_NOTIFY_USER 0 -#define NVKM_NOTIFY_WORK 1 - unsigned long flags; - int block; -#define NVKM_NOTIFY_DROP 0 -#define NVKM_NOTIFY_KEEP 1 - int (*func)(struct nvkm_notify *); - - /* set by nvkm_event ctor */ - u32 types; - int index; - u32 size; - - struct work_struct work; - /* this is const for a *very* good reason - the data might be on the - * stack from an irq handler. if you're not core/notify.c then you - * should probably think twice before casting it away... - */ - const void *data; -}; - -int nvkm_notify_init(struct nouveau_object *, struct nvkm_event *, - int (*func)(struct nvkm_notify *), bool work, - void *data, u32 size, u32 reply, - struct nvkm_notify *); -void nvkm_notify_fini(struct nvkm_notify *); -void nvkm_notify_get(struct nvkm_notify *); -void nvkm_notify_put(struct nvkm_notify *); -void nvkm_notify_send(struct nvkm_notify *, void *data, u32 size); - -#endif diff --git a/nvkm/include/core/object.h b/nvkm/include/core/object.h deleted file mode 100644 index 64c0038f1..000000000 --- a/nvkm/include/core/object.h +++ /dev/null @@ -1,206 +0,0 @@ -#ifndef __NOUVEAU_OBJECT_H__ -#define __NOUVEAU_OBJECT_H__ - -#include <core/os.h> -#include <core/printk.h> - -#define NV_PARENT_CLASS 0x80000000 -#define NV_NAMEDB_CLASS 0x40000000 -#define NV_CLIENT_CLASS 0x20000000 -#define NV_SUBDEV_CLASS 0x10000000 -#define NV_ENGINE_CLASS 0x08000000 -#define NV_MEMOBJ_CLASS 0x04000000 -#define NV_GPUOBJ_CLASS 0x02000000 -#define NV_ENGCTX_CLASS 0x01000000 -#define NV_OBJECT_CLASS 0x0000ffff - -struct nouveau_object { - struct nouveau_oclass *oclass; - struct nouveau_object *parent; - struct nouveau_engine *engine; - atomic_t refcount; - atomic_t usecount; -#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA -#define NOUVEAU_OBJECT_MAGIC 0x75ef0bad - struct list_head list; - u32 _magic; -#endif -}; - -static inline struct nouveau_object * -nv_object(void *obj) -{ -#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA - if (likely(obj)) { - struct nouveau_object *object = obj; - if (unlikely(object->_magic != NOUVEAU_OBJECT_MAGIC)) - nv_assert("BAD CAST -> NvObject, invalid magic"); - } -#endif - return obj; -} - -#define nouveau_object_create(p,e,c,s,d) \ - nouveau_object_create_((p), (e), (c), (s), sizeof(**d), (void **)d) -int nouveau_object_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, u32, int size, void **); -void nouveau_object_destroy(struct nouveau_object *); -int nouveau_object_init(struct nouveau_object *); -int nouveau_object_fini(struct nouveau_object *, bool suspend); - -int _nouveau_object_ctor(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, void *, u32, - struct nouveau_object **); - -extern struct nouveau_ofuncs nouveau_object_ofuncs; - -/* Don't allocate dynamically, because lockdep needs lock_class_keys to be in - * ".data". */ -struct nouveau_oclass { - u32 handle; - struct nouveau_ofuncs * const ofuncs; - struct nouveau_omthds * const omthds; - struct lock_class_key lock_class_key; -}; - -#define nv_oclass(o) nv_object(o)->oclass -#define nv_hclass(o) nv_oclass(o)->handle -#define nv_iclass(o,i) (nv_hclass(o) & (i)) -#define nv_mclass(o) nv_iclass(o, NV_OBJECT_CLASS) - -static inline struct nouveau_object * -nv_pclass(struct nouveau_object *parent, u32 oclass) -{ - while (parent && !nv_iclass(parent, oclass)) - parent = parent->parent; - return parent; -} - -struct nouveau_omthds { - u32 start; - u32 limit; - int (*call)(struct nouveau_object *, u32, void *, u32); -}; - -struct nvkm_event; -struct nouveau_ofuncs { - int (*ctor)(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, void *data, u32 size, - struct nouveau_object **); - void (*dtor)(struct nouveau_object *); - int (*init)(struct nouveau_object *); - int (*fini)(struct nouveau_object *, bool suspend); - int (*mthd)(struct nouveau_object *, u32, void *, u32); - int (*ntfy)(struct nouveau_object *, u32, struct nvkm_event **); - int (* map)(struct nouveau_object *, u64 *, u32 *); - u8 (*rd08)(struct nouveau_object *, u64 offset); - u16 (*rd16)(struct nouveau_object *, u64 offset); - u32 (*rd32)(struct nouveau_object *, u64 offset); - void (*wr08)(struct nouveau_object *, u64 offset, u8 data); - void (*wr16)(struct nouveau_object *, u64 offset, u16 data); - void (*wr32)(struct nouveau_object *, u64 offset, u32 data); -}; - -static inline struct nouveau_ofuncs * -nv_ofuncs(void *obj) -{ - return nv_oclass(obj)->ofuncs; -} - -int nouveau_object_ctor(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, void *, u32, - struct nouveau_object **); -void nouveau_object_ref(struct nouveau_object *, struct nouveau_object **); -int nouveau_object_inc(struct nouveau_object *); -int nouveau_object_dec(struct nouveau_object *, bool suspend); - -void nouveau_object_debug(void); - -static inline int -nv_exec(void *obj, u32 mthd, void *data, u32 size) -{ - struct nouveau_omthds *method = nv_oclass(obj)->omthds; - - while (method && method->call) { - if (mthd >= method->start && mthd <= method->limit) - return method->call(obj, mthd, data, size); - method++; - } - - return -EINVAL; -} - -static inline int -nv_call(void *obj, u32 mthd, u32 data) -{ - return nv_exec(obj, mthd, &data, sizeof(data)); -} - -static inline u8 -nv_ro08(void *obj, u64 addr) -{ - u8 data = nv_ofuncs(obj)->rd08(obj, addr); - nv_spam(obj, "nv_ro08 0x%08llx 0x%02x\n", addr, data); - return data; -} - -static inline u16 -nv_ro16(void *obj, u64 addr) -{ - u16 data = nv_ofuncs(obj)->rd16(obj, addr); - nv_spam(obj, "nv_ro16 0x%08llx 0x%04x\n", addr, data); - return data; -} - -static inline u32 -nv_ro32(void *obj, u64 addr) -{ - u32 data = nv_ofuncs(obj)->rd32(obj, addr); - nv_spam(obj, "nv_ro32 0x%08llx 0x%08x\n", addr, data); - return data; -} - -static inline void -nv_wo08(void *obj, u64 addr, u8 data) -{ - nv_spam(obj, "nv_wo08 0x%08llx 0x%02x\n", addr, data); - nv_ofuncs(obj)->wr08(obj, addr, data); -} - -static inline void -nv_wo16(void *obj, u64 addr, u16 data) -{ - nv_spam(obj, "nv_wo16 0x%08llx 0x%04x\n", addr, data); - nv_ofuncs(obj)->wr16(obj, addr, data); -} - -static inline void -nv_wo32(void *obj, u64 addr, u32 data) -{ - nv_spam(obj, "nv_wo32 0x%08llx 0x%08x\n", addr, data); - nv_ofuncs(obj)->wr32(obj, addr, data); -} - -static inline u32 -nv_mo32(void *obj, u64 addr, u32 mask, u32 data) -{ - u32 temp = nv_ro32(obj, addr); - nv_wo32(obj, addr, (temp & ~mask) | data); - return temp; -} - -static inline int -nv_memcmp(void *obj, u32 addr, const char *str, u32 len) -{ - unsigned char c1, c2; - - while (len--) { - c1 = nv_ro08(obj, addr++); - c2 = *(str++); - if (c1 != c2) - return c1 - c2; - } - return 0; -} - -#endif diff --git a/nvkm/include/core/option.h b/nvkm/include/core/option.h deleted file mode 100644 index ed0558478..000000000 --- a/nvkm/include/core/option.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __NOUVEAU_OPTION_H__ -#define __NOUVEAU_OPTION_H__ - -#include <core/os.h> - -const char *nouveau_stropt(const char *optstr, const char *opt, int *len); -bool nouveau_boolopt(const char *optstr, const char *opt, bool value); - -int nouveau_dbgopt(const char *optstr, const char *sub); - -/* compares unterminated string 'str' with zero-terminated string 'cmp' */ -static inline int -strncasecmpz(const char *str, const char *cmp, size_t len) -{ - if (strlen(cmp) != len) - return len; - return strncasecmp(str, cmp, len); -} - -#endif diff --git a/nvkm/include/core/parent.h b/nvkm/include/core/parent.h deleted file mode 100644 index 4e2345a5c..000000000 --- a/nvkm/include/core/parent.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef __NOUVEAU_PARENT_H__ -#define __NOUVEAU_PARENT_H__ - -#include <core/device.h> -#include <core/object.h> - -struct nouveau_sclass { - struct nouveau_sclass *sclass; - struct nouveau_engine *engine; - struct nouveau_oclass *oclass; -}; - -struct nouveau_parent { - struct nouveau_object object; - - struct nouveau_sclass *sclass; - u64 engine; - - int (*context_attach)(struct nouveau_object *, - struct nouveau_object *); - int (*context_detach)(struct nouveau_object *, bool suspend, - struct nouveau_object *); - - int (*object_attach)(struct nouveau_object *parent, - struct nouveau_object *object, u32 name); - void (*object_detach)(struct nouveau_object *parent, int cookie); -}; - -static inline struct nouveau_parent * -nv_parent(void *obj) -{ -#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA - if (unlikely(!(nv_iclass(obj, NV_PARENT_CLASS)))) - nv_assert("BAD CAST -> NvParent, %08x", nv_hclass(obj)); -#endif - return obj; -} - -#define nouveau_parent_create(p,e,c,v,s,m,d) \ - nouveau_parent_create_((p), (e), (c), (v), (s), (m), \ - sizeof(**d), (void **)d) -#define nouveau_parent_init(p) \ - nouveau_object_init(&(p)->object) -#define nouveau_parent_fini(p,s) \ - nouveau_object_fini(&(p)->object, (s)) - -int nouveau_parent_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, u32 pclass, - struct nouveau_oclass *, u64 engcls, - int size, void **); -void nouveau_parent_destroy(struct nouveau_parent *); - -void _nouveau_parent_dtor(struct nouveau_object *); -#define _nouveau_parent_init nouveau_object_init -#define _nouveau_parent_fini nouveau_object_fini - -int nouveau_parent_sclass(struct nouveau_object *, u16 handle, - struct nouveau_object **pengine, - struct nouveau_oclass **poclass); -int nouveau_parent_lclass(struct nouveau_object *, u32 *, int); - -#endif diff --git a/nvkm/include/core/printk.h b/nvkm/include/core/printk.h deleted file mode 100644 index 451b6ed20..000000000 --- a/nvkm/include/core/printk.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __NOUVEAU_PRINTK_H__ -#define __NOUVEAU_PRINTK_H__ - -#include <core/os.h> -#include <core/debug.h> - -struct nouveau_object; - -void __printf(3, 4) -nv_printk_(struct nouveau_object *, int, const char *, ...); - -#define nv_printk(o,l,f,a...) do { \ - if (NV_DBG_##l <= CONFIG_NOUVEAU_DEBUG) \ - nv_printk_(nv_object(o), NV_DBG_##l, f, ##a); \ -} while(0) - -#define nv_fatal(o,f,a...) nv_printk((o), FATAL, f, ##a) -#define nv_error(o,f,a...) nv_printk((o), ERROR, f, ##a) -#define nv_warn(o,f,a...) nv_printk((o), WARN, f, ##a) -#define nv_info(o,f,a...) nv_printk((o), INFO, f, ##a) -#define nv_debug(o,f,a...) nv_printk((o), DEBUG, f, ##a) -#define nv_trace(o,f,a...) nv_printk((o), TRACE, f, ##a) -#define nv_spam(o,f,a...) nv_printk((o), SPAM, f, ##a) -#define nv_ioctl(o,f,a...) nv_trace(nouveau_client(o), "ioctl: "f, ##a) - -#define nv_assert(f,a...) do { \ - if (NV_DBG_FATAL <= CONFIG_NOUVEAU_DEBUG) \ - nv_printk_(NULL, NV_DBG_FATAL, f "\n", ##a); \ - BUG_ON(1); \ -} while(0) - -#endif diff --git a/nvkm/include/core/ramht.h b/nvkm/include/core/ramht.h deleted file mode 100644 index e51014337..000000000 --- a/nvkm/include/core/ramht.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __NOUVEAU_RAMHT_H__ -#define __NOUVEAU_RAMHT_H__ - -#include <core/gpuobj.h> - -struct nouveau_ramht { - struct nouveau_gpuobj gpuobj; - int bits; -}; - -int nouveau_ramht_insert(struct nouveau_ramht *, int chid, - u32 handle, u32 context); -void nouveau_ramht_remove(struct nouveau_ramht *, int cookie); -int nouveau_ramht_new(struct nouveau_object *, struct nouveau_object *, - u32 size, u32 align, struct nouveau_ramht **); - -static inline void -nouveau_ramht_ref(struct nouveau_ramht *obj, struct nouveau_ramht **ref) -{ - nouveau_gpuobj_ref(&obj->gpuobj, (struct nouveau_gpuobj **)ref); -} - -#endif diff --git a/nvkm/include/core/subdev.h b/nvkm/include/core/subdev.h deleted file mode 100644 index 68f1c419d..000000000 --- a/nvkm/include/core/subdev.h +++ /dev/null @@ -1,120 +0,0 @@ -#ifndef __NOUVEAU_SUBDEV_H__ -#define __NOUVEAU_SUBDEV_H__ - -#include <core/object.h> - -#define NV_SUBDEV_(sub,var) (NV_SUBDEV_CLASS | ((var) << 8) | (sub)) -#define NV_SUBDEV(name,var) NV_SUBDEV_(NVDEV_SUBDEV_##name, (var)) - -struct nouveau_subdev { - struct nouveau_object object; - struct mutex mutex; - const char *name; - void __iomem *mmio; - u32 debug; - u32 unit; - - void (*intr)(struct nouveau_subdev *); -}; - -static inline struct nouveau_subdev * -nv_subdev(void *obj) -{ -#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA - if (unlikely(!nv_iclass(obj, NV_SUBDEV_CLASS))) - nv_assert("BAD CAST -> NvSubDev, %08x", nv_hclass(obj)); -#endif - return obj; -} - -static inline int -nv_subidx(struct nouveau_subdev *subdev) -{ - return nv_hclass(subdev) & 0xff; -} - -struct nouveau_subdev *nouveau_subdev(void *obj, int idx); - -#define nouveau_subdev_create(p,e,o,v,s,f,d) \ - nouveau_subdev_create_((p), (e), (o), (v), (s), (f), \ - sizeof(**d),(void **)d) - -int nouveau_subdev_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, u32 pclass, - const char *sname, const char *fname, - int size, void **); -void nouveau_subdev_destroy(struct nouveau_subdev *); -int nouveau_subdev_init(struct nouveau_subdev *); -int nouveau_subdev_fini(struct nouveau_subdev *, bool suspend); -void nouveau_subdev_reset(struct nouveau_object *); - -void _nouveau_subdev_dtor(struct nouveau_object *); -int _nouveau_subdev_init(struct nouveau_object *); -int _nouveau_subdev_fini(struct nouveau_object *, bool suspend); - -#define s_printk(s,l,f,a...) do { \ - if ((s)->debug >= OS_DBG_##l) { \ - nv_printk((s)->base.parent, (s)->name, l, f, ##a); \ - } \ -} while(0) - -static inline u8 -nv_rd08(void *obj, u32 addr) -{ - struct nouveau_subdev *subdev = nv_subdev(obj); - u8 data = ioread8(subdev->mmio + addr); - nv_spam(subdev, "nv_rd08 0x%06x 0x%02x\n", addr, data); - return data; -} - -static inline u16 -nv_rd16(void *obj, u32 addr) -{ - struct nouveau_subdev *subdev = nv_subdev(obj); - u16 data = ioread16_native(subdev->mmio + addr); - nv_spam(subdev, "nv_rd16 0x%06x 0x%04x\n", addr, data); - return data; -} - -static inline u32 -nv_rd32(void *obj, u32 addr) -{ - struct nouveau_subdev *subdev = nv_subdev(obj); - u32 data = ioread32_native(subdev->mmio + addr); - nv_spam(subdev, "nv_rd32 0x%06x 0x%08x\n", addr, data); - return data; -} - -static inline void -nv_wr08(void *obj, u32 addr, u8 data) -{ - struct nouveau_subdev *subdev = nv_subdev(obj); - nv_spam(subdev, "nv_wr08 0x%06x 0x%02x\n", addr, data); - iowrite8(data, subdev->mmio + addr); -} - -static inline void -nv_wr16(void *obj, u32 addr, u16 data) -{ - struct nouveau_subdev *subdev = nv_subdev(obj); - nv_spam(subdev, "nv_wr16 0x%06x 0x%04x\n", addr, data); - iowrite16_native(data, subdev->mmio + addr); -} - -static inline void -nv_wr32(void *obj, u32 addr, u32 data) -{ - struct nouveau_subdev *subdev = nv_subdev(obj); - nv_spam(subdev, "nv_wr32 0x%06x 0x%08x\n", addr, data); - iowrite32_native(data, subdev->mmio + addr); -} - -static inline u32 -nv_mask(void *obj, u32 addr, u32 mask, u32 data) -{ - u32 temp = nv_rd32(obj, addr); - nv_wr32(obj, addr, (temp & ~mask) | data); - return temp; -} - -#endif diff --git a/nvkm/include/engine/bsp.h b/nvkm/include/engine/bsp.h deleted file mode 100644 index 67662e2c4..000000000 --- a/nvkm/include/engine/bsp.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __NOUVEAU_BSP_H__ -#define __NOUVEAU_BSP_H__ - -extern struct nouveau_oclass nv84_bsp_oclass; -extern struct nouveau_oclass nv98_bsp_oclass; -extern struct nouveau_oclass nvc0_bsp_oclass; -extern struct nouveau_oclass nve0_bsp_oclass; - -#endif diff --git a/nvkm/include/engine/copy.h b/nvkm/include/engine/copy.h deleted file mode 100644 index 316a28ae5..000000000 --- a/nvkm/include/engine/copy.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __NOUVEAU_COPY_H__ -#define __NOUVEAU_COPY_H__ - -void nva3_copy_intr(struct nouveau_subdev *); - -extern struct nouveau_oclass nva3_copy_oclass; -extern struct nouveau_oclass nvc0_copy0_oclass; -extern struct nouveau_oclass nvc0_copy1_oclass; -extern struct nouveau_oclass nve0_copy0_oclass; -extern struct nouveau_oclass nve0_copy1_oclass; -extern struct nouveau_oclass nve0_copy2_oclass; - -#endif diff --git a/nvkm/include/engine/crypt.h b/nvkm/include/engine/crypt.h deleted file mode 100644 index db975618e..000000000 --- a/nvkm/include/engine/crypt.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __NOUVEAU_CRYPT_H__ -#define __NOUVEAU_CRYPT_H__ - -extern struct nouveau_oclass nv84_crypt_oclass; -extern struct nouveau_oclass nv98_crypt_oclass; - -#endif diff --git a/nvkm/include/engine/device.h b/nvkm/include/engine/device.h deleted file mode 100644 index 672d3c8f4..000000000 --- a/nvkm/include/engine/device.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __NOUVEAU_SUBDEV_DEVICE_H__ -#define __NOUVEAU_SUBDEV_DEVICE_H__ - -#include <core/device.h> - -struct platform_device; - -enum nv_bus_type { - NOUVEAU_BUS_PCI, - NOUVEAU_BUS_PLATFORM, -}; - -#define nouveau_device_create(p,t,n,s,c,d,u) \ - nouveau_device_create_((void *)(p), (t), (n), (s), (c), (d), \ - sizeof(**u), (void **)u) - -int nouveau_device_create_(void *, enum nv_bus_type type, u64 name, - const char *sname, const char *cfg, const char *dbg, - int, void **); - -int nv04_identify(struct nouveau_device *); -int nv10_identify(struct nouveau_device *); -int nv20_identify(struct nouveau_device *); -int nv30_identify(struct nouveau_device *); -int nv40_identify(struct nouveau_device *); -int nv50_identify(struct nouveau_device *); -int nvc0_identify(struct nouveau_device *); -int nve0_identify(struct nouveau_device *); -int gm100_identify(struct nouveau_device *); - -struct nouveau_device *nouveau_device_find(u64 name); - -#endif diff --git a/nvkm/include/engine/disp.h b/nvkm/include/engine/disp.h deleted file mode 100644 index 626508d8d..000000000 --- a/nvkm/include/engine/disp.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef __NOUVEAU_DISP_H__ -#define __NOUVEAU_DISP_H__ - -#include <core/object.h> -#include <core/engine.h> -#include <core/device.h> -#include <core/event.h> - -struct nouveau_disp { - struct nouveau_engine base; - - struct list_head outp; - - struct nvkm_event hpd; - struct nvkm_event vblank; -}; - -static inline struct nouveau_disp * -nouveau_disp(void *obj) -{ - return (void *)nouveau_engine(obj, NVDEV_ENGINE_DISP); -} - -extern struct nouveau_oclass *nv04_disp_oclass; -extern struct nouveau_oclass *nv50_disp_oclass; -extern struct nouveau_oclass *nv84_disp_oclass; -extern struct nouveau_oclass *nva0_disp_oclass; -extern struct nouveau_oclass *nv94_disp_oclass; -extern struct nouveau_oclass *nva3_disp_oclass; -extern struct nouveau_oclass *nvd0_disp_oclass; -extern struct nouveau_oclass *nve0_disp_oclass; -extern struct nouveau_oclass *nvf0_disp_oclass; -extern struct nouveau_oclass *gm107_disp_oclass; -extern struct nouveau_oclass *gm204_disp_oclass; - -#endif diff --git a/nvkm/include/engine/dmaobj.h b/nvkm/include/engine/dmaobj.h deleted file mode 100644 index 1b283a7b7..000000000 --- a/nvkm/include/engine/dmaobj.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef __NOUVEAU_DMAOBJ_H__ -#define __NOUVEAU_DMAOBJ_H__ - -#include <core/object.h> -#include <core/engine.h> - -struct nouveau_gpuobj; - -struct nouveau_dmaobj { - struct nouveau_object base; - u32 target; - u32 access; - u64 start; - u64 limit; -}; - -struct nouveau_dmaeng { - struct nouveau_engine base; - - /* creates a "physical" dma object from a struct nouveau_dmaobj */ - int (*bind)(struct nouveau_dmaobj *dmaobj, - struct nouveau_object *parent, - struct nouveau_gpuobj **); -}; - -extern struct nouveau_oclass *nv04_dmaeng_oclass; -extern struct nouveau_oclass *nv50_dmaeng_oclass; -extern struct nouveau_oclass *nvc0_dmaeng_oclass; -extern struct nouveau_oclass *nvd0_dmaeng_oclass; - -#endif diff --git a/nvkm/include/engine/falcon.h b/nvkm/include/engine/falcon.h deleted file mode 100644 index 181aa7da5..000000000 --- a/nvkm/include/engine/falcon.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef __NOUVEAU_FALCON_H__ -#define __NOUVEAU_FALCON_H__ - -#include <core/engine.h> -#include <core/engctx.h> -#include <core/gpuobj.h> - -struct nouveau_falcon_chan { - struct nouveau_engctx base; -}; - -#define nouveau_falcon_context_create(p,e,c,g,s,a,f,d) \ - nouveau_engctx_create((p), (e), (c), (g), (s), (a), (f), (d)) -#define nouveau_falcon_context_destroy(d) \ - nouveau_engctx_destroy(&(d)->base) -#define nouveau_falcon_context_init(d) \ - nouveau_engctx_init(&(d)->base) -#define nouveau_falcon_context_fini(d,s) \ - nouveau_engctx_fini(&(d)->base, (s)) - -#define _nouveau_falcon_context_ctor _nouveau_engctx_ctor -#define _nouveau_falcon_context_dtor _nouveau_engctx_dtor -#define _nouveau_falcon_context_init _nouveau_engctx_init -#define _nouveau_falcon_context_fini _nouveau_engctx_fini -#define _nouveau_falcon_context_rd32 _nouveau_engctx_rd32 -#define _nouveau_falcon_context_wr32 _nouveau_engctx_wr32 - -struct nouveau_falcon_data { - bool external; -}; - -struct nouveau_falcon { - struct nouveau_engine base; - - u32 addr; - u8 version; - u8 secret; - - struct nouveau_gpuobj *core; - bool external; - - struct { - u32 limit; - u32 *data; - u32 size; - } code; - - struct { - u32 limit; - u32 *data; - u32 size; - } data; -}; - -#define nv_falcon(priv) (&(priv)->base) - -#define nouveau_falcon_create(p,e,c,b,d,i,f,r) \ - nouveau_falcon_create_((p), (e), (c), (b), (d), (i), (f), \ - sizeof(**r),(void **)r) -#define nouveau_falcon_destroy(p) \ - nouveau_engine_destroy(&(p)->base) -#define nouveau_falcon_init(p) ({ \ - struct nouveau_falcon *falcon = (p); \ - _nouveau_falcon_init(nv_object(falcon)); \ -}) -#define nouveau_falcon_fini(p,s) ({ \ - struct nouveau_falcon *falcon = (p); \ - _nouveau_falcon_fini(nv_object(falcon), (s)); \ -}) - -int nouveau_falcon_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, u32, bool, const char *, - const char *, int, void **); - -void nouveau_falcon_intr(struct nouveau_subdev *subdev); - -#define _nouveau_falcon_dtor _nouveau_engine_dtor -int _nouveau_falcon_init(struct nouveau_object *); -int _nouveau_falcon_fini(struct nouveau_object *, bool); -u32 _nouveau_falcon_rd32(struct nouveau_object *, u64); -void _nouveau_falcon_wr32(struct nouveau_object *, u64, u32); - -#endif diff --git a/nvkm/include/engine/fifo.h b/nvkm/include/engine/fifo.h deleted file mode 100644 index 27f05de8f..000000000 --- a/nvkm/include/engine/fifo.h +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef __NOUVEAU_FIFO_H__ -#define __NOUVEAU_FIFO_H__ - -#include <core/namedb.h> -#include <core/gpuobj.h> -#include <core/engine.h> -#include <core/event.h> - -struct nouveau_fifo_chan { - struct nouveau_namedb namedb; - struct nouveau_dmaobj *pushdma; - struct nouveau_gpuobj *pushgpu; - void __iomem *user; - u64 addr; - u32 size; - u16 chid; - atomic_t refcnt; /* NV04_NVSW_SET_REF */ -}; - -static inline struct nouveau_fifo_chan * -nouveau_fifo_chan(void *obj) -{ - return (void *)nv_namedb(obj); -} - -#define nouveau_fifo_channel_create(p,e,c,b,a,s,n,m,d) \ - nouveau_fifo_channel_create_((p), (e), (c), (b), (a), (s), (n), \ - (m), sizeof(**d), (void **)d) -#define nouveau_fifo_channel_init(p) \ - nouveau_namedb_init(&(p)->namedb) -#define nouveau_fifo_channel_fini(p,s) \ - nouveau_namedb_fini(&(p)->namedb, (s)) - -int nouveau_fifo_channel_create_(struct nouveau_object *, - struct nouveau_object *, - struct nouveau_oclass *, - int bar, u32 addr, u32 size, u32 push, - u64 engmask, int len, void **); -void nouveau_fifo_channel_destroy(struct nouveau_fifo_chan *); - -#define _nouveau_fifo_channel_init _nouveau_namedb_init -#define _nouveau_fifo_channel_fini _nouveau_namedb_fini - -void _nouveau_fifo_channel_dtor(struct nouveau_object *); -int _nouveau_fifo_channel_map(struct nouveau_object *, u64 *, u32 *); -u32 _nouveau_fifo_channel_rd32(struct nouveau_object *, u64); -void _nouveau_fifo_channel_wr32(struct nouveau_object *, u64, u32); -int _nouveau_fifo_channel_ntfy(struct nouveau_object *, u32, struct nvkm_event **); - -struct nouveau_fifo_base { - struct nouveau_gpuobj gpuobj; -}; - -#define nouveau_fifo_context_create(p,e,c,g,s,a,f,d) \ - nouveau_gpuobj_create((p), (e), (c), 0, (g), (s), (a), (f), (d)) -#define nouveau_fifo_context_destroy(p) \ - nouveau_gpuobj_destroy(&(p)->gpuobj) -#define nouveau_fifo_context_init(p) \ - nouveau_gpuobj_init(&(p)->gpuobj) -#define nouveau_fifo_context_fini(p,s) \ - nouveau_gpuobj_fini(&(p)->gpuobj, (s)) - -#define _nouveau_fifo_context_dtor _nouveau_gpuobj_dtor -#define _nouveau_fifo_context_init _nouveau_gpuobj_init -#define _nouveau_fifo_context_fini _nouveau_gpuobj_fini -#define _nouveau_fifo_context_rd32 _nouveau_gpuobj_rd32 -#define _nouveau_fifo_context_wr32 _nouveau_gpuobj_wr32 - -struct nouveau_fifo { - struct nouveau_engine base; - - struct nvkm_event cevent; /* channel creation event */ - struct nvkm_event uevent; /* async user trigger */ - - struct nouveau_object **channel; - spinlock_t lock; - u16 min; - u16 max; - - int (*chid)(struct nouveau_fifo *, struct nouveau_object *); - void (*pause)(struct nouveau_fifo *, unsigned long *); - void (*start)(struct nouveau_fifo *, unsigned long *); -}; - -static inline struct nouveau_fifo * -nouveau_fifo(void *obj) -{ - return (void *)nouveau_engine(obj, NVDEV_ENGINE_FIFO); -} - -#define nouveau_fifo_create(o,e,c,fc,lc,d) \ - nouveau_fifo_create_((o), (e), (c), (fc), (lc), sizeof(**d), (void **)d) -#define nouveau_fifo_init(p) \ - nouveau_engine_init(&(p)->base) -#define nouveau_fifo_fini(p,s) \ - nouveau_engine_fini(&(p)->base, (s)) - -int nouveau_fifo_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, int min, int max, - int size, void **); -void nouveau_fifo_destroy(struct nouveau_fifo *); -const char * -nouveau_client_name_for_fifo_chid(struct nouveau_fifo *fifo, u32 chid); - -#define _nouveau_fifo_init _nouveau_engine_init -#define _nouveau_fifo_fini _nouveau_engine_fini - -extern struct nouveau_oclass *nv04_fifo_oclass; -extern struct nouveau_oclass *nv10_fifo_oclass; -extern struct nouveau_oclass *nv17_fifo_oclass; -extern struct nouveau_oclass *nv40_fifo_oclass; -extern struct nouveau_oclass *nv50_fifo_oclass; -extern struct nouveau_oclass *nv84_fifo_oclass; -extern struct nouveau_oclass *nvc0_fifo_oclass; -extern struct nouveau_oclass *nve0_fifo_oclass; -extern struct nouveau_oclass *gk20a_fifo_oclass; -extern struct nouveau_oclass *nv108_fifo_oclass; - -int nouveau_fifo_uevent_ctor(struct nouveau_object *, void *, u32, - struct nvkm_notify *); -void nouveau_fifo_uevent(struct nouveau_fifo *); - -void nv04_fifo_intr(struct nouveau_subdev *); -int nv04_fifo_context_attach(struct nouveau_object *, struct nouveau_object *); - -#endif diff --git a/nvkm/include/engine/graph.h b/nvkm/include/engine/graph.h deleted file mode 100644 index d61dcb7d6..000000000 --- a/nvkm/include/engine/graph.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef __NOUVEAU_GRAPH_H__ -#define __NOUVEAU_GRAPH_H__ - -#include <core/engine.h> -#include <core/engctx.h> -#include <core/enum.h> - -struct nouveau_graph_chan { - struct nouveau_engctx base; -}; - -#define nouveau_graph_context_create(p,e,c,g,s,a,f,d) \ - nouveau_engctx_create((p), (e), (c), (g), (s), (a), (f), (d)) -#define nouveau_graph_context_destroy(d) \ - nouveau_engctx_destroy(&(d)->base) -#define nouveau_graph_context_init(d) \ - nouveau_engctx_init(&(d)->base) -#define nouveau_graph_context_fini(d,s) \ - nouveau_engctx_fini(&(d)->base, (s)) - -#define _nouveau_graph_context_dtor _nouveau_engctx_dtor -#define _nouveau_graph_context_init _nouveau_engctx_init -#define _nouveau_graph_context_fini _nouveau_engctx_fini -#define _nouveau_graph_context_rd32 _nouveau_engctx_rd32 -#define _nouveau_graph_context_wr32 _nouveau_engctx_wr32 - -struct nouveau_graph { - struct nouveau_engine base; - - /* Returns chipset-specific counts of units packed into an u64. - */ - u64 (*units)(struct nouveau_graph *); -}; - -static inline struct nouveau_graph * -nouveau_graph(void *obj) -{ - return (void *)nouveau_engine(obj, NVDEV_ENGINE_GR); -} - -#define nouveau_graph_create(p,e,c,y,d) \ - nouveau_engine_create((p), (e), (c), (y), "PGRAPH", "graphics", (d)) -#define nouveau_graph_destroy(d) \ - nouveau_engine_destroy(&(d)->base) -#define nouveau_graph_init(d) \ - nouveau_engine_init(&(d)->base) -#define nouveau_graph_fini(d,s) \ - nouveau_engine_fini(&(d)->base, (s)) - -#define _nouveau_graph_dtor _nouveau_engine_dtor -#define _nouveau_graph_init _nouveau_engine_init -#define _nouveau_graph_fini _nouveau_engine_fini - -extern struct nouveau_oclass nv04_graph_oclass; -extern struct nouveau_oclass nv10_graph_oclass; -extern struct nouveau_oclass nv20_graph_oclass; -extern struct nouveau_oclass nv25_graph_oclass; -extern struct nouveau_oclass nv2a_graph_oclass; -extern struct nouveau_oclass nv30_graph_oclass; -extern struct nouveau_oclass nv34_graph_oclass; -extern struct nouveau_oclass nv35_graph_oclass; -extern struct nouveau_oclass nv40_graph_oclass; -extern struct nouveau_oclass nv50_graph_oclass; -extern struct nouveau_oclass *nvc0_graph_oclass; -extern struct nouveau_oclass *nvc1_graph_oclass; -extern struct nouveau_oclass *nvc4_graph_oclass; -extern struct nouveau_oclass *nvc8_graph_oclass; -extern struct nouveau_oclass *nvd7_graph_oclass; -extern struct nouveau_oclass *nvd9_graph_oclass; -extern struct nouveau_oclass *nve4_graph_oclass; -extern struct nouveau_oclass *gk20a_graph_oclass; -extern struct nouveau_oclass *nvf0_graph_oclass; -extern struct nouveau_oclass *gk110b_graph_oclass; -extern struct nouveau_oclass *nv108_graph_oclass; -extern struct nouveau_oclass *gm107_graph_oclass; - -extern const struct nouveau_bitfield nv04_graph_nsource[]; -extern struct nouveau_ofuncs nv04_graph_ofuncs; -bool nv04_graph_idle(void *obj); - -extern const struct nouveau_bitfield nv10_graph_intr_name[]; -extern const struct nouveau_bitfield nv10_graph_nstatus[]; - -extern const struct nouveau_enum nv50_data_error_names[]; - -#endif diff --git a/nvkm/include/engine/mpeg.h b/nvkm/include/engine/mpeg.h deleted file mode 100644 index 9b0d93819..000000000 --- a/nvkm/include/engine/mpeg.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef __NOUVEAU_MPEG_H__ -#define __NOUVEAU_MPEG_H__ - -#include <core/engine.h> -#include <core/engctx.h> - -struct nouveau_mpeg_chan { - struct nouveau_engctx base; -}; - -#define nouveau_mpeg_context_create(p,e,c,g,s,a,f,d) \ - nouveau_engctx_create((p), (e), (c), (g), (s), (a), (f), (d)) -#define nouveau_mpeg_context_destroy(d) \ - nouveau_engctx_destroy(&(d)->base) -#define nouveau_mpeg_context_init(d) \ - nouveau_engctx_init(&(d)->base) -#define nouveau_mpeg_context_fini(d,s) \ - nouveau_engctx_fini(&(d)->base, (s)) - -#define _nouveau_mpeg_context_dtor _nouveau_engctx_dtor -#define _nouveau_mpeg_context_init _nouveau_engctx_init -#define _nouveau_mpeg_context_fini _nouveau_engctx_fini -#define _nouveau_mpeg_context_rd32 _nouveau_engctx_rd32 -#define _nouveau_mpeg_context_wr32 _nouveau_engctx_wr32 - -struct nouveau_mpeg { - struct nouveau_engine base; -}; - -#define nouveau_mpeg_create(p,e,c,d) \ - nouveau_engine_create((p), (e), (c), true, "PMPEG", "mpeg", (d)) -#define nouveau_mpeg_destroy(d) \ - nouveau_engine_destroy(&(d)->base) -#define nouveau_mpeg_init(d) \ - nouveau_engine_init(&(d)->base) -#define nouveau_mpeg_fini(d,s) \ - nouveau_engine_fini(&(d)->base, (s)) - -#define _nouveau_mpeg_dtor _nouveau_engine_dtor -#define _nouveau_mpeg_init _nouveau_engine_init -#define _nouveau_mpeg_fini _nouveau_engine_fini - -extern struct nouveau_oclass nv31_mpeg_oclass; -extern struct nouveau_oclass nv40_mpeg_oclass; -extern struct nouveau_oclass nv44_mpeg_oclass; -extern struct nouveau_oclass nv50_mpeg_oclass; -extern struct nouveau_oclass nv84_mpeg_oclass; -extern struct nouveau_ofuncs nv31_mpeg_ofuncs; -extern struct nouveau_oclass nv31_mpeg_cclass; -extern struct nouveau_oclass nv31_mpeg_sclass[]; -extern struct nouveau_oclass nv40_mpeg_sclass[]; -void nv31_mpeg_intr(struct nouveau_subdev *); -void nv31_mpeg_tile_prog(struct nouveau_engine *, int); -int nv31_mpeg_init(struct nouveau_object *); - -extern struct nouveau_ofuncs nv50_mpeg_ofuncs; -int nv50_mpeg_context_ctor(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, void *, u32, - struct nouveau_object **); -void nv50_mpeg_intr(struct nouveau_subdev *); -int nv50_mpeg_init(struct nouveau_object *); - -#endif diff --git a/nvkm/include/engine/perfmon.h b/nvkm/include/engine/perfmon.h deleted file mode 100644 index 251c8545c..000000000 --- a/nvkm/include/engine/perfmon.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __NVKM_PERFMON_H__ -#define __NVKM_PERFMON_H__ - -#include <core/device.h> -#include <core/engine.h> -#include <core/engctx.h> - -struct nouveau_perfdom; -struct nouveau_perfctr; -struct nouveau_perfmon { - struct nouveau_engine base; - - struct nouveau_perfctx *context; - void *profile_data; - - struct list_head domains; - u32 sequence; - - /*XXX: temp for daemon backend */ - u32 pwr[8]; - u32 last; -}; - -static inline struct nouveau_perfmon * -nouveau_perfmon(void *obj) -{ - return (void *)nouveau_engine(obj, NVDEV_ENGINE_PERFMON); -} - -extern struct nouveau_oclass *nv40_perfmon_oclass; -extern struct nouveau_oclass *nv50_perfmon_oclass; -extern struct nouveau_oclass *nv84_perfmon_oclass; -extern struct nouveau_oclass *nva3_perfmon_oclass; -extern struct nouveau_oclass nvc0_perfmon_oclass; -extern struct nouveau_oclass nve0_perfmon_oclass; -extern struct nouveau_oclass nvf0_perfmon_oclass; - -#endif diff --git a/nvkm/include/engine/ppp.h b/nvkm/include/engine/ppp.h deleted file mode 100644 index 0a66781e8..000000000 --- a/nvkm/include/engine/ppp.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __NOUVEAU_PPP_H__ -#define __NOUVEAU_PPP_H__ - -extern struct nouveau_oclass nv98_ppp_oclass; -extern struct nouveau_oclass nvc0_ppp_oclass; - -#endif diff --git a/nvkm/include/engine/software.h b/nvkm/include/engine/software.h deleted file mode 100644 index 23a462b50..000000000 --- a/nvkm/include/engine/software.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef __NOUVEAU_SOFTWARE_H__ -#define __NOUVEAU_SOFTWARE_H__ - -#include <core/engine.h> -#include <core/engctx.h> - -struct nouveau_software_chan { - struct nouveau_engctx base; - - int (*flip)(void *); - void *flip_data; -}; - -#define nouveau_software_context_create(p,e,c,d) \ - nouveau_engctx_create((p), (e), (c), (p), 0, 0, 0, (d)) -#define nouveau_software_context_destroy(d) \ - nouveau_engctx_destroy(&(d)->base) -#define nouveau_software_context_init(d) \ - nouveau_engctx_init(&(d)->base) -#define nouveau_software_context_fini(d,s) \ - nouveau_engctx_fini(&(d)->base, (s)) - -#define _nouveau_software_context_dtor _nouveau_engctx_dtor -#define _nouveau_software_context_init _nouveau_engctx_init -#define _nouveau_software_context_fini _nouveau_engctx_fini - -struct nouveau_software { - struct nouveau_engine base; -}; - -#define nouveau_software_create(p,e,c,d) \ - nouveau_engine_create((p), (e), (c), true, "SW", "software", (d)) -#define nouveau_software_destroy(d) \ - nouveau_engine_destroy(&(d)->base) -#define nouveau_software_init(d) \ - nouveau_engine_init(&(d)->base) -#define nouveau_software_fini(d,s) \ - nouveau_engine_fini(&(d)->base, (s)) - -#define _nouveau_software_dtor _nouveau_engine_dtor -#define _nouveau_software_init _nouveau_engine_init -#define _nouveau_software_fini _nouveau_engine_fini - -extern struct nouveau_oclass *nv04_software_oclass; -extern struct nouveau_oclass *nv10_software_oclass; -extern struct nouveau_oclass *nv50_software_oclass; -extern struct nouveau_oclass *nvc0_software_oclass; - -void nv04_software_intr(struct nouveau_subdev *); - -#endif diff --git a/nvkm/include/engine/vp.h b/nvkm/include/engine/vp.h deleted file mode 100644 index 39baebec7..000000000 --- a/nvkm/include/engine/vp.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __NOUVEAU_VP_H__ -#define __NOUVEAU_VP_H__ - -extern struct nouveau_oclass nv84_vp_oclass; -extern struct nouveau_oclass nv98_vp_oclass; -extern struct nouveau_oclass nvc0_vp_oclass; -extern struct nouveau_oclass nve0_vp_oclass; - -#endif diff --git a/nvkm/include/engine/xtensa.h b/nvkm/include/engine/xtensa.h deleted file mode 100644 index 306100f31..000000000 --- a/nvkm/include/engine/xtensa.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __NOUVEAU_XTENSA_H__ -#define __NOUVEAU_XTENSA_H__ - -#include <core/engine.h> -#include <core/engctx.h> -#include <core/gpuobj.h> - -struct nouveau_xtensa { - struct nouveau_engine base; - - u32 addr; - struct nouveau_gpuobj *gpu_fw; - u32 fifo_val; - u32 unkd28; -}; - -#define nouveau_xtensa_create(p,e,c,b,d,i,f,r) \ - nouveau_xtensa_create_((p), (e), (c), (b), (d), (i), (f), \ - sizeof(**r),(void **)r) - -int _nouveau_xtensa_engctx_ctor(struct nouveau_object *, - struct nouveau_object *, - struct nouveau_oclass *, void *, u32, - struct nouveau_object **); - -void _nouveau_xtensa_intr(struct nouveau_subdev *); -int nouveau_xtensa_create_(struct nouveau_object *, - struct nouveau_object *, - struct nouveau_oclass *, u32, bool, - const char *, const char *, - int, void **); -#define _nouveau_xtensa_dtor _nouveau_engine_dtor -int _nouveau_xtensa_init(struct nouveau_object *); -int _nouveau_xtensa_fini(struct nouveau_object *, bool); -u32 _nouveau_xtensa_rd32(struct nouveau_object *, u64); -void _nouveau_xtensa_wr32(struct nouveau_object *, u64, u32); - -#endif diff --git a/nvkm/include/nvif/class.h b/nvkm/include/nvif/class.h deleted file mode 120000 index f1ac4859e..000000000 --- a/nvkm/include/nvif/class.h +++ /dev/null @@ -1 +0,0 @@ -../../../nvif/class.h
\ No newline at end of file diff --git a/nvkm/include/nvif/event.h b/nvkm/include/nvif/event.h deleted file mode 120000 index 1b798538a..000000000 --- a/nvkm/include/nvif/event.h +++ /dev/null @@ -1 +0,0 @@ -../../../nvif/event.h
\ No newline at end of file diff --git a/nvkm/include/nvif/ioctl.h b/nvkm/include/nvif/ioctl.h deleted file mode 120000 index 8569c8690..000000000 --- a/nvkm/include/nvif/ioctl.h +++ /dev/null @@ -1 +0,0 @@ -../../../nvif/ioctl.h
\ No newline at end of file diff --git a/nvkm/include/nvif/unpack.h b/nvkm/include/nvif/unpack.h deleted file mode 120000 index 69d99292b..000000000 --- a/nvkm/include/nvif/unpack.h +++ /dev/null @@ -1 +0,0 @@ -../../../nvif/unpack.h
\ No newline at end of file diff --git a/nvkm/include/subdev/bar.h b/nvkm/include/subdev/bar.h deleted file mode 100644 index 960e33a30..000000000 --- a/nvkm/include/subdev/bar.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __NOUVEAU_BAR_H__ -#define __NOUVEAU_BAR_H__ - -#include <core/subdev.h> -#include <core/device.h> - -struct nouveau_mem; -struct nouveau_vma; - -struct nouveau_bar { - struct nouveau_subdev base; - - int (*alloc)(struct nouveau_bar *, struct nouveau_object *, - struct nouveau_mem *, struct nouveau_object **); - - int (*kmap)(struct nouveau_bar *, struct nouveau_mem *, - u32 flags, struct nouveau_vma *); - int (*umap)(struct nouveau_bar *, struct nouveau_mem *, - u32 flags, struct nouveau_vma *); - void (*unmap)(struct nouveau_bar *, struct nouveau_vma *); - void (*flush)(struct nouveau_bar *); - - /* whether the BAR supports to be ioremapped WC or should be uncached */ - bool iomap_uncached; -}; - -static inline struct nouveau_bar * -nouveau_bar(void *obj) -{ - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_BAR); -} - -extern struct nouveau_oclass nv50_bar_oclass; -extern struct nouveau_oclass nvc0_bar_oclass; -extern struct nouveau_oclass gk20a_bar_oclass; - -#endif diff --git a/nvkm/include/subdev/bios.h b/nvkm/include/subdev/bios.h deleted file mode 100644 index 39528a9f3..000000000 --- a/nvkm/include/subdev/bios.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __NOUVEAU_BIOS_H__ -#define __NOUVEAU_BIOS_H__ - -#include <core/subdev.h> -#include <core/device.h> - -struct nouveau_bios { - struct nouveau_subdev base; - u32 size; - u8 *data; - - u32 bmp_offset; - u32 bit_offset; - - struct { - u8 major; - u8 chip; - u8 minor; - u8 micro; - u8 patch; - } version; -}; - -static inline struct nouveau_bios * -nouveau_bios(void *obj) -{ - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_VBIOS); -} - -u8 nvbios_checksum(const u8 *data, int size); -u16 nvbios_findstr(const u8 *data, int size, const char *str, int len); - -extern struct nouveau_oclass nouveau_bios_oclass; - -#endif diff --git a/nvkm/include/subdev/bios/M0203.h b/nvkm/include/subdev/bios/M0203.h deleted file mode 100644 index 1f84d3612..000000000 --- a/nvkm/include/subdev/bios/M0203.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef __NVBIOS_M0203_H__ -#define __NVBIOS_M0203_H__ - -struct nvbios_M0203T { -#define M0203T_TYPE_RAMCFG 0x00 - u8 type; - u16 pointer; -}; - -u32 nvbios_M0203Te(struct nouveau_bios *, u8 *ver, u8 *hdr, u8 *cnt, u8 *len); -u32 nvbios_M0203Tp(struct nouveau_bios *, u8 *ver, u8 *hdr, u8 *cnt, u8 *len, - struct nvbios_M0203T *); - -struct nvbios_M0203E { -#define M0203E_TYPE_DDR2 0x0 -#define M0203E_TYPE_DDR3 0x1 -#define M0203E_TYPE_GDDR3 0x2 -#define M0203E_TYPE_GDDR5 0x3 -#define M0203E_TYPE_SKIP 0xf - u8 type; - u8 strap; - u8 group; -}; - -u32 nvbios_M0203Ee(struct nouveau_bios *, int idx, u8 *ver, u8 *hdr); -u32 nvbios_M0203Ep(struct nouveau_bios *, int idx, u8 *ver, u8 *hdr, - struct nvbios_M0203E *); -u32 nvbios_M0203Em(struct nouveau_bios *, u8 ramcfg, u8 *ver, u8 *hdr, - struct nvbios_M0203E *); - -#endif diff --git a/nvkm/include/subdev/bios/M0205.h b/nvkm/include/subdev/bios/M0205.h deleted file mode 100644 index e171120ce..000000000 --- a/nvkm/include/subdev/bios/M0205.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __NVBIOS_M0205_H__ -#define __NVBIOS_M0205_H__ - -struct nvbios_M0205T { - u16 freq; -}; - -u32 nvbios_M0205Te(struct nouveau_bios *, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, u8 *snr, u8 *ssz); -u32 nvbios_M0205Tp(struct nouveau_bios *, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, u8 *snr, u8 *ssz, - struct nvbios_M0205T *); - -struct nvbios_M0205E { - u8 type; -}; - -u32 nvbios_M0205Ee(struct nouveau_bios *, int idx, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len); -u32 nvbios_M0205Ep(struct nouveau_bios *, int idx, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, - struct nvbios_M0205E *); - -struct nvbios_M0205S { - u8 data; -}; - -u32 nvbios_M0205Se(struct nouveau_bios *, int ent, int idx, u8 *ver, u8 *hdr); -u32 nvbios_M0205Sp(struct nouveau_bios *, int ent, int idx, u8 *ver, u8 *hdr, - struct nvbios_M0205S *); - -#endif diff --git a/nvkm/include/subdev/bios/M0209.h b/nvkm/include/subdev/bios/M0209.h deleted file mode 100644 index 67dc50d83..000000000 --- a/nvkm/include/subdev/bios/M0209.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __NVBIOS_M0209_H__ -#define __NVBIOS_M0209_H__ - -u32 nvbios_M0209Te(struct nouveau_bios *, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, u8 *snr, u8 *ssz); - -struct nvbios_M0209E { - u8 v00_40; - u8 bits; - u8 modulo; - u8 v02_40; - u8 v02_07; - u8 v03; -}; - -u32 nvbios_M0209Ee(struct nouveau_bios *, int idx, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len); -u32 nvbios_M0209Ep(struct nouveau_bios *, int idx, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, - struct nvbios_M0209E *); - -struct nvbios_M0209S { - u32 data[0x200]; -}; - -u32 nvbios_M0209Se(struct nouveau_bios *, int ent, int idx, u8 *ver, u8 *hdr); -u32 nvbios_M0209Sp(struct nouveau_bios *, int ent, int idx, u8 *ver, u8 *hdr, - struct nvbios_M0209S *); - -#endif diff --git a/nvkm/include/subdev/bios/P0260.h b/nvkm/include/subdev/bios/P0260.h deleted file mode 100644 index bba01ab1e..000000000 --- a/nvkm/include/subdev/bios/P0260.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __NVBIOS_P0260_H__ -#define __NVBIOS_P0260_H__ - -u32 nvbios_P0260Te(struct nouveau_bios *, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, u8 *xnr, u8 *xsz); - -struct nvbios_P0260E { - u32 data; -}; - -u32 nvbios_P0260Ee(struct nouveau_bios *, int idx, u8 *ver, u8 *hdr); -u32 nvbios_P0260Ep(struct nouveau_bios *, int idx, u8 *ver, u8 *hdr, - struct nvbios_P0260E *); - -struct nvbios_P0260X { - u32 data; -}; - -u32 nvbios_P0260Xe(struct nouveau_bios *, int idx, u8 *ver, u8 *hdr); -u32 nvbios_P0260Xp(struct nouveau_bios *, int idx, u8 *ver, u8 *hdr, - struct nvbios_P0260X *); - -#endif diff --git a/nvkm/include/subdev/bios/bit.h b/nvkm/include/subdev/bios/bit.h deleted file mode 100644 index 73f060b07..000000000 --- a/nvkm/include/subdev/bios/bit.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __NVBIOS_BIT_H__ -#define __NVBIOS_BIT_H__ - -struct bit_entry { - u8 id; - u8 version; - u16 length; - u16 offset; -}; - -int bit_entry(struct nouveau_bios *, u8 id, struct bit_entry *); - -#endif diff --git a/nvkm/include/subdev/bios/bmp.h b/nvkm/include/subdev/bios/bmp.h deleted file mode 100644 index 10e4dbca6..000000000 --- a/nvkm/include/subdev/bios/bmp.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef __NVBIOS_BMP_H__ -#define __NVBIOS_BMP_H__ - -static inline u16 -bmp_version(struct nouveau_bios *bios) -{ - if (bios->bmp_offset) { - return nv_ro08(bios, bios->bmp_offset + 5) << 8 | - nv_ro08(bios, bios->bmp_offset + 6); - } - - return 0x0000; -} - -static inline u16 -bmp_mem_init_table(struct nouveau_bios *bios) -{ - if (bmp_version(bios) >= 0x0300) - return nv_ro16(bios, bios->bmp_offset + 24); - return 0x0000; -} - -static inline u16 -bmp_sdr_seq_table(struct nouveau_bios *bios) -{ - if (bmp_version(bios) >= 0x0300) - return nv_ro16(bios, bios->bmp_offset + 26); - return 0x0000; -} - -static inline u16 -bmp_ddr_seq_table(struct nouveau_bios *bios) -{ - if (bmp_version(bios) >= 0x0300) - return nv_ro16(bios, bios->bmp_offset + 28); - return 0x0000; -} - -#endif diff --git a/nvkm/include/subdev/bios/boost.h b/nvkm/include/subdev/bios/boost.h deleted file mode 100644 index 662b20726..000000000 --- a/nvkm/include/subdev/bios/boost.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __NVBIOS_BOOST_H__ -#define __NVBIOS_BOOST_H__ - -u16 nvbios_boostTe(struct nouveau_bios *, u8 *, u8 *, u8 *, u8 *, u8 *, u8 *); - -struct nvbios_boostE { - u8 pstate; - u32 min; - u32 max; -}; - -u16 nvbios_boostEe(struct nouveau_bios *, int idx, u8 *, u8 *, u8 *, u8 *); -u16 nvbios_boostEp(struct nouveau_bios *, int idx, u8 *, u8 *, u8 *, u8 *, - struct nvbios_boostE *); -u16 nvbios_boostEm(struct nouveau_bios *, u8, u8 *, u8 *, u8 *, u8 *, - struct nvbios_boostE *); - -struct nvbios_boostS { - u8 domain; - u8 percent; - u32 min; - u32 max; -}; - -u16 nvbios_boostSe(struct nouveau_bios *, int, u16, u8 *, u8 *, u8, u8); -u16 nvbios_boostSp(struct nouveau_bios *, int, u16, u8 *, u8 *, u8, u8, - struct nvbios_boostS *); - -#endif diff --git a/nvkm/include/subdev/bios/conn.h b/nvkm/include/subdev/bios/conn.h deleted file mode 100644 index f3930c27c..000000000 --- a/nvkm/include/subdev/bios/conn.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef __NVBIOS_CONN_H__ -#define __NVBIOS_CONN_H__ - -enum dcb_connector_type { - DCB_CONNECTOR_VGA = 0x00, - DCB_CONNECTOR_TV_0 = 0x10, - DCB_CONNECTOR_TV_1 = 0x11, - DCB_CONNECTOR_TV_3 = 0x13, - DCB_CONNECTOR_DVI_I = 0x30, - DCB_CONNECTOR_DVI_D = 0x31, - DCB_CONNECTOR_DMS59_0 = 0x38, - DCB_CONNECTOR_DMS59_1 = 0x39, - DCB_CONNECTOR_LVDS = 0x40, - DCB_CONNECTOR_LVDS_SPWG = 0x41, - DCB_CONNECTOR_DP = 0x46, - DCB_CONNECTOR_eDP = 0x47, - DCB_CONNECTOR_HDMI_0 = 0x60, - DCB_CONNECTOR_HDMI_1 = 0x61, - DCB_CONNECTOR_HDMI_C = 0x63, - DCB_CONNECTOR_DMS59_DP0 = 0x64, - DCB_CONNECTOR_DMS59_DP1 = 0x65, - DCB_CONNECTOR_NONE = 0xff -}; - -struct nvbios_connT { -}; - -u32 nvbios_connTe(struct nouveau_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len); -u32 nvbios_connTp(struct nouveau_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len, - struct nvbios_connT *info); - -struct nvbios_connE { - u8 type; - u8 location; - u8 hpd; - u8 dp; - u8 di; - u8 sr; - u8 lcdid; -}; - -u32 nvbios_connEe(struct nouveau_bios *bios, u8 idx, u8 *ver, u8 *hdr); -u32 nvbios_connEp(struct nouveau_bios *bios, u8 idx, u8 *ver, u8 *hdr, - struct nvbios_connE *info); - -#endif diff --git a/nvkm/include/subdev/bios/cstep.h b/nvkm/include/subdev/bios/cstep.h deleted file mode 100644 index a80a43809..000000000 --- a/nvkm/include/subdev/bios/cstep.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __NVBIOS_CSTEP_H__ -#define __NVBIOS_CSTEP_H__ - -u16 nvbios_cstepTe(struct nouveau_bios *, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, u8 *xnr, u8 *xsz); - -struct nvbios_cstepE { - u8 pstate; - u8 index; -}; - -u16 nvbios_cstepEe(struct nouveau_bios *, int idx, u8 *ver, u8 *hdr); -u16 nvbios_cstepEp(struct nouveau_bios *, int idx, u8 *ver, u8 *hdr, - struct nvbios_cstepE *); -u16 nvbios_cstepEm(struct nouveau_bios *, u8 pstate, u8 *ver, u8 *hdr, - struct nvbios_cstepE *); - -struct nvbios_cstepX { - u32 freq; - u8 unkn[2]; - u8 voltage; -}; - -u16 nvbios_cstepXe(struct nouveau_bios *, int idx, u8 *ver, u8 *hdr); -u16 nvbios_cstepXp(struct nouveau_bios *, int idx, u8 *ver, u8 *hdr, - struct nvbios_cstepX *); - -#endif diff --git a/nvkm/include/subdev/bios/dcb.h b/nvkm/include/subdev/bios/dcb.h deleted file mode 100644 index 123270e98..000000000 --- a/nvkm/include/subdev/bios/dcb.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __NVBIOS_DCB_H__ -#define __NVBIOS_DCB_H__ - -struct nouveau_bios; - -enum dcb_output_type { - DCB_OUTPUT_ANALOG = 0x0, - DCB_OUTPUT_TV = 0x1, - DCB_OUTPUT_TMDS = 0x2, - DCB_OUTPUT_LVDS = 0x3, - DCB_OUTPUT_DP = 0x6, - DCB_OUTPUT_EOL = 0xe, - DCB_OUTPUT_UNUSED = 0xf, - DCB_OUTPUT_ANY = -1, -}; - -struct dcb_output { - int index; /* may not be raw dcb index if merging has happened */ - u16 hasht; - u16 hashm; - enum dcb_output_type type; - uint8_t i2c_index; - uint8_t heads; - uint8_t connector; - uint8_t bus; - uint8_t location; - uint8_t or; - uint8_t link; - bool duallink_possible; - uint8_t extdev; - union { - struct sor_conf { - int link; - } sorconf; - struct { - int maxfreq; - } crtconf; - struct { - struct sor_conf sor; - bool use_straps_for_mode; - bool use_acpi_for_edid; - bool use_power_scripts; - } lvdsconf; - struct { - bool has_component_output; - } tvconf; - struct { - struct sor_conf sor; - int link_nr; - int link_bw; - } dpconf; - struct { - struct sor_conf sor; - int slave_addr; - } tmdsconf; - }; - bool i2c_upper_default; -}; - -u16 dcb_table(struct nouveau_bios *, u8 *ver, u8 *hdr, u8 *ent, u8 *len); -u16 dcb_outp(struct nouveau_bios *, u8 idx, u8 *ver, u8 *len); -u16 dcb_outp_parse(struct nouveau_bios *, u8 idx, u8 *, u8 *, - struct dcb_output *); -u16 dcb_outp_match(struct nouveau_bios *, u16 type, u16 mask, u8 *, u8 *, - struct dcb_output *); -int dcb_outp_foreach(struct nouveau_bios *, void *data, int (*exec) - (struct nouveau_bios *, void *, int index, u16 entry)); - -#endif diff --git a/nvkm/include/subdev/bios/dfp.h b/nvkm/include/subdev/bios/dfp.h deleted file mode 100644 index 50cb52c11..000000000 --- a/nvkm/include/subdev/bios/dfp.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef __NVBIOS_DFP_H__ -#define __NVBIOS_DFP_H__ - -#endif diff --git a/nvkm/include/subdev/bios/disp.h b/nvkm/include/subdev/bios/disp.h deleted file mode 100644 index c35937e2f..000000000 --- a/nvkm/include/subdev/bios/disp.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef __NVBIOS_DISP_H__ -#define __NVBIOS_DISP_H__ - -u16 nvbios_disp_table(struct nouveau_bios *, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, u8 *sub); - -struct nvbios_disp { - u16 data; -}; - -u16 nvbios_disp_entry(struct nouveau_bios *, u8 idx, - u8 *ver, u8 *hdr__, u8 *sub); -u16 nvbios_disp_parse(struct nouveau_bios *, u8 idx, - u8 *ver, u8 *hdr__, u8 *sub, - struct nvbios_disp *); - -struct nvbios_outp { - u16 type; - u16 mask; - u16 script[3]; -}; - -u16 nvbios_outp_entry(struct nouveau_bios *, u8 idx, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len); -u16 nvbios_outp_parse(struct nouveau_bios *, u8 idx, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, - struct nvbios_outp *); -u16 nvbios_outp_match(struct nouveau_bios *, u16 type, u16 mask, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, - struct nvbios_outp *); - - -struct nvbios_ocfg { - u16 match; - u16 clkcmp[2]; -}; - -u16 nvbios_ocfg_entry(struct nouveau_bios *, u16 outp, u8 idx, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len); -u16 nvbios_ocfg_parse(struct nouveau_bios *, u16 outp, u8 idx, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, - struct nvbios_ocfg *); -u16 nvbios_ocfg_match(struct nouveau_bios *, u16 outp, u16 type, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, - struct nvbios_ocfg *); -u16 nvbios_oclk_match(struct nouveau_bios *, u16 cmp, u32 khz); - -#endif diff --git a/nvkm/include/subdev/bios/dp.h b/nvkm/include/subdev/bios/dp.h deleted file mode 100644 index 728206e21..000000000 --- a/nvkm/include/subdev/bios/dp.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __NVBIOS_DP_H__ -#define __NVBIOS_DP_H__ - -struct nvbios_dpout { - u16 type; - u16 mask; - u8 flags; - u32 script[5]; - u32 lnkcmp; -}; - -u16 nvbios_dpout_parse(struct nouveau_bios *, u8 idx, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, - struct nvbios_dpout *); -u16 nvbios_dpout_match(struct nouveau_bios *, u16 type, u16 mask, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, - struct nvbios_dpout *); - -struct nvbios_dpcfg { - u8 pc; - u8 dc; - u8 pe; - u8 tx_pu; -}; - -u16 -nvbios_dpcfg_parse(struct nouveau_bios *, u16 outp, u8 idx, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, - struct nvbios_dpcfg *); -u16 -nvbios_dpcfg_match(struct nouveau_bios *, u16 outp, u8 pc, u8 vs, u8 pe, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, - struct nvbios_dpcfg *); - -#endif diff --git a/nvkm/include/subdev/bios/extdev.h b/nvkm/include/subdev/bios/extdev.h deleted file mode 100644 index 949fee3af..000000000 --- a/nvkm/include/subdev/bios/extdev.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __NVBIOS_EXTDEV_H__ -#define __NVBIOS_EXTDEV_H__ - -struct nouveau_bios; - -enum nvbios_extdev_type { - NVBIOS_EXTDEV_LM89 = 0x02, - NVBIOS_EXTDEV_VT1103M = 0x40, - NVBIOS_EXTDEV_PX3540 = 0x41, - NVBIOS_EXTDEV_VT1105M = 0x42, /* or close enough... */ - NVBIOS_EXTDEV_ADT7473 = 0x70, /* can also be a LM64 */ - NVBIOS_EXTDEV_HDCP_EEPROM = 0x90, - NVBIOS_EXTDEV_NONE = 0xff, -}; - -struct nvbios_extdev_func { - u8 type; - u8 addr; - u8 bus; -}; - -int -nvbios_extdev_parse(struct nouveau_bios *, int, struct nvbios_extdev_func *); - -int -nvbios_extdev_find(struct nouveau_bios *, enum nvbios_extdev_type, - struct nvbios_extdev_func *); - - -#endif diff --git a/nvkm/include/subdev/bios/fan.h b/nvkm/include/subdev/bios/fan.h deleted file mode 100644 index 119d0874e..000000000 --- a/nvkm/include/subdev/bios/fan.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __NVBIOS_FAN_H__ -#define __NVBIOS_FAN_H__ - -#include <subdev/bios/therm.h> - -u16 nvbios_fan_parse(struct nouveau_bios *bios, struct nvbios_therm_fan *fan); - -#endif diff --git a/nvkm/include/subdev/bios/gpio.h b/nvkm/include/subdev/bios/gpio.h deleted file mode 100644 index c7b2e586b..000000000 --- a/nvkm/include/subdev/bios/gpio.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef __NVBIOS_GPIO_H__ -#define __NVBIOS_GPIO_H__ - -enum dcb_gpio_func_name { - DCB_GPIO_PANEL_POWER = 0x01, - DCB_GPIO_TVDAC0 = 0x0c, - DCB_GPIO_TVDAC1 = 0x2d, - DCB_GPIO_FAN = 0x09, - DCB_GPIO_FAN_SENSE = 0x3d, - DCB_GPIO_UNUSED = 0xff, - DCB_GPIO_VID0 = 0x04, - DCB_GPIO_VID1 = 0x05, - DCB_GPIO_VID2 = 0x06, - DCB_GPIO_VID3 = 0x1a, - DCB_GPIO_VID4 = 0x73, - DCB_GPIO_VID5 = 0x74, - DCB_GPIO_VID6 = 0x75, - DCB_GPIO_VID7 = 0x76, -}; - -#define DCB_GPIO_LOG_DIR 0x02 -#define DCB_GPIO_LOG_DIR_OUT 0x00 -#define DCB_GPIO_LOG_DIR_IN 0x02 -#define DCB_GPIO_LOG_VAL 0x01 -#define DCB_GPIO_LOG_VAL_LO 0x00 -#define DCB_GPIO_LOG_VAL_HI 0x01 - -struct dcb_gpio_func { - u8 func; - u8 line; - u8 log[2]; - - /* so far, "param" seems to only have an influence on PWM-related - * GPIOs such as FAN_CONTROL and PANEL_BACKLIGHT_LEVEL. - * if param equals 1, hardware PWM is available - * if param equals 0, the host should toggle the GPIO itself - */ - u8 param; -}; - -u16 dcb_gpio_table(struct nouveau_bios *, u8 *ver, u8 *hdr, u8 *cnt, u8 *len); -u16 dcb_gpio_entry(struct nouveau_bios *, int idx, int ent, u8 *ver, u8 *len); -u16 dcb_gpio_parse(struct nouveau_bios *, int idx, int ent, u8 *ver, u8 *len, - struct dcb_gpio_func *); -u16 dcb_gpio_match(struct nouveau_bios *, int idx, u8 func, u8 line, - u8 *ver, u8 *len, struct dcb_gpio_func *); - -#endif diff --git a/nvkm/include/subdev/bios/i2c.h b/nvkm/include/subdev/bios/i2c.h deleted file mode 100644 index c9bb11289..000000000 --- a/nvkm/include/subdev/bios/i2c.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __NVBIOS_I2C_H__ -#define __NVBIOS_I2C_H__ - -struct nouveau_bios; - -enum dcb_i2c_type { - /* matches bios type field prior to ccb 4.1 */ - DCB_I2C_NV04_BIT = 0x00, - DCB_I2C_NV4E_BIT = 0x04, - DCB_I2C_NVIO_BIT = 0x05, - DCB_I2C_NVIO_AUX = 0x06, - /* made up - mostly */ - DCB_I2C_PMGR = 0x80, - DCB_I2C_UNUSED = 0xff -}; - -struct dcb_i2c_entry { - enum dcb_i2c_type type; - u8 drive; - u8 sense; - u8 share; - u8 auxch; -}; - -u16 dcb_i2c_table(struct nouveau_bios *, u8 *ver, u8 *hdr, u8 *cnt, u8 *len); -u16 dcb_i2c_entry(struct nouveau_bios *, u8 index, u8 *ver, u8 *len); -int dcb_i2c_parse(struct nouveau_bios *, u8 index, struct dcb_i2c_entry *); - -#endif diff --git a/nvkm/include/subdev/bios/image.h b/nvkm/include/subdev/bios/image.h deleted file mode 100644 index 3348b4580..000000000 --- a/nvkm/include/subdev/bios/image.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __NVBIOS_IMAGE_H__ -#define __NVBIOS_IMAGE_H__ - -struct nvbios_image { - u32 base; - u32 size; - u8 type; - bool last; -}; - -bool nvbios_image(struct nouveau_bios *, int, struct nvbios_image *); - -#endif diff --git a/nvkm/include/subdev/bios/init.h b/nvkm/include/subdev/bios/init.h deleted file mode 100644 index ca2f6bf37..000000000 --- a/nvkm/include/subdev/bios/init.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef __NVBIOS_INIT_H__ -#define __NVBIOS_INIT_H__ - -struct nvbios_init { - struct nouveau_subdev *subdev; - struct nouveau_bios *bios; - u16 offset; - struct dcb_output *outp; - int crtc; - - /* internal state used during parsing */ - u8 execute; - u32 nested; - u16 repeat; - u16 repend; - u32 ramcfg; -}; - -int nvbios_exec(struct nvbios_init *); -int nvbios_init(struct nouveau_subdev *, bool execute); - -#endif diff --git a/nvkm/include/subdev/bios/mxm.h b/nvkm/include/subdev/bios/mxm.h deleted file mode 100644 index 5572e6041..000000000 --- a/nvkm/include/subdev/bios/mxm.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __NVBIOS_MXM_H__ -#define __NVBIOS_MXM_H__ - -u16 mxm_table(struct nouveau_bios *, u8 *ver, u8 *hdr); - -u8 mxm_sor_map(struct nouveau_bios *, u8 conn); -u8 mxm_ddc_map(struct nouveau_bios *, u8 port); - -#endif diff --git a/nvkm/include/subdev/bios/npde.h b/nvkm/include/subdev/bios/npde.h deleted file mode 100644 index b18413d95..000000000 --- a/nvkm/include/subdev/bios/npde.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __NVBIOS_NPDE_H__ -#define __NVBIOS_NPDE_H__ - -struct nvbios_npdeT { - u32 image_size; - bool last; -}; - -u32 nvbios_npdeTe(struct nouveau_bios *, u32); -u32 nvbios_npdeTp(struct nouveau_bios *, u32, struct nvbios_npdeT *); - -#endif diff --git a/nvkm/include/subdev/bios/pcir.h b/nvkm/include/subdev/bios/pcir.h deleted file mode 100644 index 3d634a06d..000000000 --- a/nvkm/include/subdev/bios/pcir.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __NVBIOS_PCIR_H__ -#define __NVBIOS_PCIR_H__ - -struct nvbios_pcirT { - u16 vendor_id; - u16 device_id; - u8 class_code[3]; - u32 image_size; - u16 image_rev; - u8 image_type; - bool last; -}; - -u32 nvbios_pcirTe(struct nouveau_bios *, u32, u8 *ver, u16 *hdr); -u32 nvbios_pcirTp(struct nouveau_bios *, u32, u8 *ver, u16 *hdr, - struct nvbios_pcirT *); - -#endif diff --git a/nvkm/include/subdev/bios/perf.h b/nvkm/include/subdev/bios/perf.h deleted file mode 100644 index 16ff06ec2..000000000 --- a/nvkm/include/subdev/bios/perf.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef __NVBIOS_PERF_H__ -#define __NVBIOS_PERF_H__ - -struct nouveau_bios; - -u16 nvbios_perf_table(struct nouveau_bios *, u8 *ver, u8 *hdr, - u8 *cnt, u8 *len, u8 *snr, u8 *ssz); - -struct nvbios_perfE { - u8 pstate; - u8 fanspeed; - u8 voltage; - u32 core; - u32 shader; - u32 memory; - u32 vdec; - u32 disp; - u32 script; -}; - -u16 nvbios_perf_entry(struct nouveau_bios *, int idx, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len); -u16 nvbios_perfEp(struct nouveau_bios *, int idx, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, struct nvbios_perfE *); - -struct nvbios_perfS { - union { - struct { - u32 freq; - } v40; - }; -}; - -u32 nvbios_perfSe(struct nouveau_bios *, u32 data, int idx, - u8 *ver, u8 *hdr, u8 cnt, u8 len); -u32 nvbios_perfSp(struct nouveau_bios *, u32 data, int idx, - u8 *ver, u8 *hdr, u8 cnt, u8 len, struct nvbios_perfS *); - -struct nvbios_perf_fan { - u32 pwm_divisor; -}; - -int -nvbios_perf_fan_parse(struct nouveau_bios *, struct nvbios_perf_fan *); - - -#endif diff --git a/nvkm/include/subdev/bios/pll.h b/nvkm/include/subdev/bios/pll.h deleted file mode 100644 index b2f3d4d0a..000000000 --- a/nvkm/include/subdev/bios/pll.h +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef __NVBIOS_PLL_H__ -#define __NVBIOS_PLL_H__ - -/*XXX: kill me */ -struct nouveau_pll_vals { - union { - struct { -#ifdef __BIG_ENDIAN - uint8_t N1, M1, N2, M2; -#else - uint8_t M1, N1, M2, N2; -#endif - }; - struct { - uint16_t NM1, NM2; - } __attribute__((packed)); - }; - int log2P; - - int refclk; -}; - -struct nouveau_bios; - -/* these match types in pll limits table version 0x40, - * nouveau uses them on all chipsets internally where a - * specific pll needs to be referenced, but the exact - * register isn't known. - */ -enum nvbios_pll_type { - PLL_CORE = 0x01, - PLL_SHADER = 0x02, - PLL_UNK03 = 0x03, - PLL_MEMORY = 0x04, - PLL_VDEC = 0x05, - PLL_UNK40 = 0x40, - PLL_UNK41 = 0x41, - PLL_UNK42 = 0x42, - PLL_VPLL0 = 0x80, - PLL_VPLL1 = 0x81, - PLL_VPLL2 = 0x82, - PLL_VPLL3 = 0x83, - PLL_MAX = 0xff -}; - -struct nvbios_pll { - enum nvbios_pll_type type; - u32 reg; - u32 refclk; - - u8 min_p; - u8 max_p; - u8 bias_p; - - /* - * for most pre nv50 cards setting a log2P of 7 (the common max_log2p - * value) is no different to 6 (at least for vplls) so allowing the MNP - * calc to use 7 causes the generated clock to be out by a factor of 2. - * however, max_log2p cannot be fixed-up during parsing as the - * unmodified max_log2p value is still needed for setting mplls, hence - * an additional max_usable_log2p member - */ - u8 max_p_usable; - - struct { - u32 min_freq; - u32 max_freq; - u32 min_inputfreq; - u32 max_inputfreq; - u8 min_m; - u8 max_m; - u8 min_n; - u8 max_n; - } vco1, vco2; -}; - -int nvbios_pll_parse(struct nouveau_bios *, u32 type, struct nvbios_pll *); - -#endif diff --git a/nvkm/include/subdev/bios/pmu.h b/nvkm/include/subdev/bios/pmu.h deleted file mode 100644 index 9de593dea..000000000 --- a/nvkm/include/subdev/bios/pmu.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __NVBIOS_PMU_H__ -#define __NVBIOS_PMU_H__ - -struct nvbios_pmuT { -}; - -u32 nvbios_pmuTe(struct nouveau_bios *, u8 *ver, u8 *hdr, u8 *cnt, u8 *len); -u32 nvbios_pmuTp(struct nouveau_bios *, u8 *ver, u8 *hdr, u8 *cnt, u8 *len, - struct nvbios_pmuT *); - -struct nvbios_pmuE { - u8 type; - u32 data; -}; - -u32 nvbios_pmuEe(struct nouveau_bios *, int idx, u8 *ver, u8 *hdr); -u32 nvbios_pmuEp(struct nouveau_bios *, int idx, u8 *ver, u8 *hdr, - struct nvbios_pmuE *); - -struct nvbios_pmuR { - u32 boot_addr_pmu; - u32 boot_addr; - u32 boot_size; - u32 code_addr_pmu; - u32 code_addr; - u32 code_size; - u32 init_addr_pmu; - - u32 data_addr_pmu; - u32 data_addr; - u32 data_size; - u32 args_addr_pmu; -}; - -bool nvbios_pmuRm(struct nouveau_bios *, u8 type, struct nvbios_pmuR *); - -#endif diff --git a/nvkm/include/subdev/bios/ramcfg.h b/nvkm/include/subdev/bios/ramcfg.h deleted file mode 100644 index 4a0e0ceb4..000000000 --- a/nvkm/include/subdev/bios/ramcfg.h +++ /dev/null @@ -1,145 +0,0 @@ -#ifndef __NVBIOS_RAMCFG_H__ -#define __NVBIOS_RAMCFG_H__ - -struct nouveau_bios; - -struct nvbios_ramcfg { - unsigned rammap_ver; - unsigned rammap_hdr; - unsigned rammap_min; - unsigned rammap_max; - union { - struct { - unsigned rammap_10_04_02:1; - unsigned rammap_10_04_08:1; - }; - struct { - unsigned rammap_11_08_01:1; - unsigned rammap_11_08_0c:2; - unsigned rammap_11_08_10:1; - unsigned rammap_11_09_01ff:9; - unsigned rammap_11_0a_03fe:9; - unsigned rammap_11_0a_0400:1; - unsigned rammap_11_0a_0800:1; - unsigned rammap_11_0b_01f0:5; - unsigned rammap_11_0b_0200:1; - unsigned rammap_11_0b_0400:1; - unsigned rammap_11_0b_0800:1; - unsigned rammap_11_0d:8; - unsigned rammap_11_0e:8; - unsigned rammap_11_0f:8; - unsigned rammap_11_11_0c:2; - }; - }; - - unsigned ramcfg_ver; - unsigned ramcfg_hdr; - unsigned ramcfg_timing; - union { - struct { - unsigned ramcfg_10_02_01:1; - unsigned ramcfg_10_02_02:1; - unsigned ramcfg_10_02_04:1; - unsigned ramcfg_10_02_08:1; - unsigned ramcfg_10_02_10:1; - unsigned ramcfg_10_02_20:1; - unsigned ramcfg_10_DLLoff:1; - unsigned ramcfg_10_03_0f:4; - unsigned ramcfg_10_04_01:1; - unsigned ramcfg_10_05:8; - unsigned ramcfg_10_06:8; - unsigned ramcfg_10_07:8; - unsigned ramcfg_10_08:8; - unsigned ramcfg_10_09_0f:4; - unsigned ramcfg_10_09_f0:4; - }; - struct { - unsigned ramcfg_11_01_01:1; - unsigned ramcfg_11_01_02:1; - unsigned ramcfg_11_01_04:1; - unsigned ramcfg_11_01_08:1; - unsigned ramcfg_11_01_10:1; - unsigned ramcfg_11_01_20:1; - unsigned ramcfg_11_01_40:1; - unsigned ramcfg_11_01_80:1; - unsigned ramcfg_11_02_03:2; - unsigned ramcfg_11_02_04:1; - unsigned ramcfg_11_02_08:1; - unsigned ramcfg_11_02_10:1; - unsigned ramcfg_11_02_40:1; - unsigned ramcfg_11_02_80:1; - unsigned ramcfg_11_03_0f:4; - unsigned ramcfg_11_03_30:2; - unsigned ramcfg_11_03_c0:2; - unsigned ramcfg_11_03_f0:4; - unsigned ramcfg_11_04:8; - unsigned ramcfg_11_06:8; - unsigned ramcfg_11_07_02:1; - unsigned ramcfg_11_07_04:1; - unsigned ramcfg_11_07_08:1; - unsigned ramcfg_11_07_10:1; - unsigned ramcfg_11_07_40:1; - unsigned ramcfg_11_07_80:1; - unsigned ramcfg_11_08_01:1; - unsigned ramcfg_11_08_02:1; - unsigned ramcfg_11_08_04:1; - unsigned ramcfg_11_08_08:1; - unsigned ramcfg_11_08_10:1; - unsigned ramcfg_11_08_20:1; - unsigned ramcfg_11_09:8; - }; - }; - - unsigned timing_ver; - unsigned timing_hdr; - unsigned timing[11]; - union { - struct { - unsigned timing_10_WR:8; - unsigned timing_10_WTR:8; - unsigned timing_10_CL:8; - unsigned timing_10_RC:8; - /*empty: 4 */ - unsigned timing_10_RFC:8; /* Byte 5 */ - /*empty: 6 */ - unsigned timing_10_RAS:8; /* Byte 7 */ - /*empty: 8 */ - unsigned timing_10_RP:8; /* Byte 9 */ - unsigned timing_10_RCDRD:8; - unsigned timing_10_RCDWR:8; - unsigned timing_10_RRD:8; - unsigned timing_10_13:8; - unsigned timing_10_ODT:3; - /* empty: 15 */ - unsigned timing_10_16:8; - /* empty: 17 */ - unsigned timing_10_18:8; - unsigned timing_10_CWL:8; - unsigned timing_10_20:8; - unsigned timing_10_21:8; - /* empty: 22, 23 */ - unsigned timing_10_24:8; - }; - struct { - unsigned timing_20_2e_03:2; - unsigned timing_20_2e_30:2; - unsigned timing_20_2e_c0:2; - unsigned timing_20_2f_03:2; - unsigned timing_20_2c_003f:6; - unsigned timing_20_2c_1fc0:7; - unsigned timing_20_30_f8:5; - unsigned timing_20_30_07:3; - unsigned timing_20_31_0007:3; - unsigned timing_20_31_0078:4; - unsigned timing_20_31_0780:4; - unsigned timing_20_31_0800:1; - unsigned timing_20_31_7000:3; - unsigned timing_20_31_8000:1; - }; - }; -}; - -u8 nvbios_ramcfg_count(struct nouveau_bios *); -u8 nvbios_ramcfg_index(struct nouveau_subdev *); - -#endif diff --git a/nvkm/include/subdev/bios/rammap.h b/nvkm/include/subdev/bios/rammap.h deleted file mode 100644 index 47e021d3e..000000000 --- a/nvkm/include/subdev/bios/rammap.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef __NVBIOS_RAMMAP_H__ -#define __NVBIOS_RAMMAP_H__ - -struct nvbios_ramcfg; - -u32 nvbios_rammapTe(struct nouveau_bios *, u8 *ver, u8 *hdr, - u8 *cnt, u8 *len, u8 *snr, u8 *ssz); - -u32 nvbios_rammapEe(struct nouveau_bios *, int idx, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len); -u32 nvbios_rammapEp(struct nouveau_bios *, int idx, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, - struct nvbios_ramcfg *); -u32 nvbios_rammapEm(struct nouveau_bios *, u16 mhz, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, - struct nvbios_ramcfg *); - -u32 nvbios_rammapSe(struct nouveau_bios *, u32 data, - u8 ever, u8 ehdr, u8 ecnt, u8 elen, int idx, - u8 *ver, u8 *hdr); -u32 nvbios_rammapSp(struct nouveau_bios *, u32 data, - u8 ever, u8 ehdr, u8 ecnt, u8 elen, int idx, - u8 *ver, u8 *hdr, - struct nvbios_ramcfg *); - -#endif diff --git a/nvkm/include/subdev/bios/therm.h b/nvkm/include/subdev/bios/therm.h deleted file mode 100644 index 295d093f3..000000000 --- a/nvkm/include/subdev/bios/therm.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef __NVBIOS_THERM_H__ -#define __NVBIOS_THERM_H__ - -struct nouveau_bios; - -struct nvbios_therm_threshold { - u8 temp; - u8 hysteresis; -}; - -struct nvbios_therm_sensor { - /* diode */ - s16 slope_mult; - s16 slope_div; - s16 offset_num; - s16 offset_den; - s8 offset_constant; - - /* thresholds */ - struct nvbios_therm_threshold thrs_fan_boost; - struct nvbios_therm_threshold thrs_down_clock; - struct nvbios_therm_threshold thrs_critical; - struct nvbios_therm_threshold thrs_shutdown; -}; - -enum nvbios_therm_fan_type { - NVBIOS_THERM_FAN_UNK = 0, - NVBIOS_THERM_FAN_TOGGLE = 1, - NVBIOS_THERM_FAN_PWM = 2, -}; - -/* no vbios have more than 6 */ -#define NOUVEAU_TEMP_FAN_TRIP_MAX 10 -struct nouveau_therm_trip_point { - int fan_duty; - int temp; - int hysteresis; -}; - -enum nvbios_therm_fan_mode { - NVBIOS_THERM_FAN_TRIP = 0, - NVBIOS_THERM_FAN_LINEAR = 1, - NVBIOS_THERM_FAN_OTHER = 2, -}; - -struct nvbios_therm_fan { - enum nvbios_therm_fan_type type; - - u32 pwm_freq; - - u8 min_duty; - u8 max_duty; - - u16 bump_period; - u16 slow_down_period; - - enum nvbios_therm_fan_mode fan_mode; - struct nouveau_therm_trip_point trip[NOUVEAU_TEMP_FAN_TRIP_MAX]; - u8 nr_fan_trip; - u8 linear_min_temp; - u8 linear_max_temp; -}; - -enum nvbios_therm_domain { - NVBIOS_THERM_DOMAIN_CORE, - NVBIOS_THERM_DOMAIN_AMBIENT, -}; - -int -nvbios_therm_sensor_parse(struct nouveau_bios *, enum nvbios_therm_domain, - struct nvbios_therm_sensor *); - -int -nvbios_therm_fan_parse(struct nouveau_bios *, struct nvbios_therm_fan *); - - -#endif diff --git a/nvkm/include/subdev/bios/timing.h b/nvkm/include/subdev/bios/timing.h deleted file mode 100644 index 76d914b67..000000000 --- a/nvkm/include/subdev/bios/timing.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __NVBIOS_TIMING_H__ -#define __NVBIOS_TIMING_H__ - -struct nvbios_ramcfg; - -u16 nvbios_timingTe(struct nouveau_bios *, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, u8 *snr, u8 *ssz); -u16 nvbios_timingEe(struct nouveau_bios *, int idx, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len); -u16 nvbios_timingEp(struct nouveau_bios *, int idx, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, - struct nvbios_ramcfg *); - -#endif diff --git a/nvkm/include/subdev/bios/vmap.h b/nvkm/include/subdev/bios/vmap.h deleted file mode 100644 index ad5a8f20e..000000000 --- a/nvkm/include/subdev/bios/vmap.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __NVBIOS_VMAP_H__ -#define __NVBIOS_VMAP_H__ - -struct nouveau_bios; - -struct nvbios_vmap { -}; - -u16 nvbios_vmap_table(struct nouveau_bios *, u8 *ver, u8 *hdr, u8 *cnt, u8 *len); -u16 nvbios_vmap_parse(struct nouveau_bios *, u8 *ver, u8 *hdr, u8 *cnt, u8 *len, - struct nvbios_vmap *); - -struct nvbios_vmap_entry { - u8 unk0; - u8 link; - u32 min; - u32 max; - s32 arg[6]; -}; - -u16 nvbios_vmap_entry(struct nouveau_bios *, int idx, u8 *ver, u8 *len); -u16 nvbios_vmap_entry_parse(struct nouveau_bios *, int idx, u8 *ver, u8 *len, - struct nvbios_vmap_entry *); - -#endif diff --git a/nvkm/include/subdev/bios/volt.h b/nvkm/include/subdev/bios/volt.h deleted file mode 100644 index 6a11dcd59..000000000 --- a/nvkm/include/subdev/bios/volt.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __NVBIOS_VOLT_H__ -#define __NVBIOS_VOLT_H__ - -struct nouveau_bios; - -struct nvbios_volt { - u8 vidmask; - u32 min; - u32 max; - u32 base; - s16 step; -}; - -u16 nvbios_volt_table(struct nouveau_bios *, u8 *ver, u8 *hdr, u8 *cnt, u8 *len); -u16 nvbios_volt_parse(struct nouveau_bios *, u8 *ver, u8 *hdr, u8 *cnt, u8 *len, - struct nvbios_volt *); - -struct nvbios_volt_entry { - u32 voltage; - u8 vid; -}; - -u16 nvbios_volt_entry(struct nouveau_bios *, int idx, u8 *ver, u8 *len); -u16 nvbios_volt_entry_parse(struct nouveau_bios *, int idx, u8 *ver, u8 *len, - struct nvbios_volt_entry *); - -#endif diff --git a/nvkm/include/subdev/bios/xpio.h b/nvkm/include/subdev/bios/xpio.h deleted file mode 100644 index 360baab52..000000000 --- a/nvkm/include/subdev/bios/xpio.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __NVBIOS_XPIO_H__ -#define __NVBIOS_XPIO_H__ - -#define NVBIOS_XPIO_FLAG_AUX 0x10 -#define NVBIOS_XPIO_FLAG_AUX0 0x00 -#define NVBIOS_XPIO_FLAG_AUX1 0x10 - -struct nvbios_xpio { - u8 type; - u8 addr; - u8 flags; -}; - -u16 dcb_xpio_table(struct nouveau_bios *, u8 idx, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len); -u16 dcb_xpio_parse(struct nouveau_bios *, u8 idx, - u8 *ver, u8 *hdr, u8 *cnt, u8 *len, struct nvbios_xpio *); - -#endif diff --git a/nvkm/include/subdev/bus.h b/nvkm/include/subdev/bus.h deleted file mode 100644 index 2d40f0c2f..000000000 --- a/nvkm/include/subdev/bus.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef __NOUVEAU_BUS_H__ -#define __NOUVEAU_BUS_H__ - -#include <core/subdev.h> -#include <core/device.h> - -struct nouveau_bus_intr { - u32 stat; - u32 unit; -}; - -struct nouveau_bus { - struct nouveau_subdev base; - int (*hwsq_exec)(struct nouveau_bus *, u32 *, u32); - u32 hwsq_size; -}; - -static inline struct nouveau_bus * -nouveau_bus(void *obj) -{ - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_BUS); -} - -#define nouveau_bus_create(p, e, o, d) \ - nouveau_subdev_create_((p), (e), (o), 0, "PBUS", "master", \ - sizeof(**d), (void **)d) -#define nouveau_bus_destroy(p) \ - nouveau_subdev_destroy(&(p)->base) -#define nouveau_bus_init(p) \ - nouveau_subdev_init(&(p)->base) -#define nouveau_bus_fini(p, s) \ - nouveau_subdev_fini(&(p)->base, (s)) - -#define _nouveau_bus_dtor _nouveau_subdev_dtor -#define _nouveau_bus_init _nouveau_subdev_init -#define _nouveau_bus_fini _nouveau_subdev_fini - -extern struct nouveau_oclass *nv04_bus_oclass; -extern struct nouveau_oclass *nv31_bus_oclass; -extern struct nouveau_oclass *nv50_bus_oclass; -extern struct nouveau_oclass *nv94_bus_oclass; -extern struct nouveau_oclass *nvc0_bus_oclass; - -/* interface to sequencer */ -struct nouveau_hwsq; -int nouveau_hwsq_init(struct nouveau_bus *, struct nouveau_hwsq **); -int nouveau_hwsq_fini(struct nouveau_hwsq **, bool exec); -void nouveau_hwsq_wr32(struct nouveau_hwsq *, u32 addr, u32 data); -void nouveau_hwsq_setf(struct nouveau_hwsq *, u8 flag, int data); -void nouveau_hwsq_wait(struct nouveau_hwsq *, u8 flag, u8 data); -void nouveau_hwsq_nsec(struct nouveau_hwsq *, u32 nsec); - -#endif diff --git a/nvkm/include/subdev/clock.h b/nvkm/include/subdev/clock.h deleted file mode 100644 index 39ad2d2ce..000000000 --- a/nvkm/include/subdev/clock.h +++ /dev/null @@ -1,166 +0,0 @@ -#ifndef __NOUVEAU_CLOCK_H__ -#define __NOUVEAU_CLOCK_H__ - -#include <core/device.h> -#include <core/subdev.h> - -struct nouveau_pll_vals; -struct nvbios_pll; - -enum nv_clk_src { - nv_clk_src_crystal, - nv_clk_src_href, - - nv_clk_src_hclk, - nv_clk_src_hclkm3, - nv_clk_src_hclkm3d2, - nv_clk_src_hclkm2d3, /* NVAA */ - nv_clk_src_hclkm4, /* NVAA */ - nv_clk_src_cclk, /* NVAA */ - - nv_clk_src_host, - - nv_clk_src_sppll0, - nv_clk_src_sppll1, - - nv_clk_src_mpllsrcref, - nv_clk_src_mpllsrc, - nv_clk_src_mpll, - nv_clk_src_mdiv, - - nv_clk_src_core, - nv_clk_src_core_intm, - nv_clk_src_shader, - - nv_clk_src_mem, - - nv_clk_src_gpc, - nv_clk_src_rop, - nv_clk_src_hubk01, - nv_clk_src_hubk06, - nv_clk_src_hubk07, - nv_clk_src_copy, - nv_clk_src_daemon, - nv_clk_src_disp, - nv_clk_src_vdec, - - nv_clk_src_dom6, - - nv_clk_src_max, -}; - -struct nouveau_cstate { - struct list_head head; - u8 voltage; - u32 domain[nv_clk_src_max]; -}; - -struct nouveau_pstate { - struct list_head head; - struct list_head list; /* c-states */ - struct nouveau_cstate base; - u8 pstate; - u8 fanspeed; -}; - -struct nouveau_clock { - struct nouveau_subdev base; - - struct nouveau_clocks *domains; - struct nouveau_pstate bstate; - - struct list_head states; - int state_nr; - - struct work_struct work; - wait_queue_head_t wait; - atomic_t waiting; - - struct nvkm_notify pwrsrc_ntfy; - int pwrsrc; - int pstate; /* current */ - int ustate_ac; /* user-requested (-1 disabled, -2 perfmon) */ - int ustate_dc; /* user-requested (-1 disabled, -2 perfmon) */ - int astate; /* perfmon adjustment (base) */ - int tstate; /* thermal adjustment (max-) */ - int dstate; /* display adjustment (min+) */ - - bool allow_reclock; - - int (*read)(struct nouveau_clock *, enum nv_clk_src); - int (*calc)(struct nouveau_clock *, struct nouveau_cstate *); - int (*prog)(struct nouveau_clock *); - void (*tidy)(struct nouveau_clock *); - - /*XXX: die, these are here *only* to support the completely - * bat-shit insane what-was-nouveau_hw.c code - */ - int (*pll_calc)(struct nouveau_clock *, struct nvbios_pll *, - int clk, struct nouveau_pll_vals *pv); - int (*pll_prog)(struct nouveau_clock *, u32 reg1, - struct nouveau_pll_vals *pv); -}; - -static inline struct nouveau_clock * -nouveau_clock(void *obj) -{ - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_CLOCK); -} - -struct nouveau_clocks { - enum nv_clk_src name; - u8 bios; /* 0xff for none */ -#define NVKM_CLK_DOM_FLAG_CORE 0x01 - u8 flags; - const char *mname; - int mdiv; -}; - -#define nouveau_clock_create(p,e,o,i,r,s,n,d) \ - nouveau_clock_create_((p), (e), (o), (i), (r), (s), (n), sizeof(**d), \ - (void **)d) -#define nouveau_clock_destroy(p) ({ \ - struct nouveau_clock *clk = (p); \ - _nouveau_clock_dtor(nv_object(clk)); \ -}) -#define nouveau_clock_init(p) ({ \ - struct nouveau_clock *clk = (p); \ - _nouveau_clock_init(nv_object(clk)); \ -}) -#define nouveau_clock_fini(p,s) ({ \ - struct nouveau_clock *clk = (p); \ - _nouveau_clock_fini(nv_object(clk), (s)); \ -}) - -int nouveau_clock_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, - struct nouveau_clocks *, struct nouveau_pstate *, - int, bool, int, void **); -void _nouveau_clock_dtor(struct nouveau_object *); -int _nouveau_clock_init(struct nouveau_object *); -int _nouveau_clock_fini(struct nouveau_object *, bool); - -extern struct nouveau_oclass nv04_clock_oclass; -extern struct nouveau_oclass nv40_clock_oclass; -extern struct nouveau_oclass *nv50_clock_oclass; -extern struct nouveau_oclass *nv84_clock_oclass; -extern struct nouveau_oclass *nvaa_clock_oclass; -extern struct nouveau_oclass nva3_clock_oclass; -extern struct nouveau_oclass nvc0_clock_oclass; -extern struct nouveau_oclass nve0_clock_oclass; -extern struct nouveau_oclass gk20a_clock_oclass; - -int nv04_clock_pll_set(struct nouveau_clock *, u32 type, u32 freq); -int nv04_clock_pll_calc(struct nouveau_clock *, struct nvbios_pll *, - int clk, struct nouveau_pll_vals *); -int nv04_clock_pll_prog(struct nouveau_clock *, u32 reg1, - struct nouveau_pll_vals *); -int nva3_clock_pll_calc(struct nouveau_clock *, struct nvbios_pll *, - int clk, struct nouveau_pll_vals *); - -int nouveau_clock_ustate(struct nouveau_clock *, int req, int pwr); -int nouveau_clock_astate(struct nouveau_clock *, int req, int rel, bool wait); -int nouveau_clock_dstate(struct nouveau_clock *, int req, int rel); -int nouveau_clock_tstate(struct nouveau_clock *, int req, int rel); - -#endif diff --git a/nvkm/include/subdev/devinit.h b/nvkm/include/subdev/devinit.h deleted file mode 100644 index b627d5329..000000000 --- a/nvkm/include/subdev/devinit.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __NOUVEAU_DEVINIT_H__ -#define __NOUVEAU_DEVINIT_H__ - -#include <core/subdev.h> -#include <core/device.h> - -struct nouveau_devinit { - struct nouveau_subdev base; - bool post; - void (*meminit)(struct nouveau_devinit *); - int (*pll_set)(struct nouveau_devinit *, u32 type, u32 freq); - u32 (*mmio)(struct nouveau_devinit *, u32 addr); -}; - -static inline struct nouveau_devinit * -nouveau_devinit(void *obj) -{ - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_DEVINIT); -} - -extern struct nouveau_oclass *nv04_devinit_oclass; -extern struct nouveau_oclass *nv05_devinit_oclass; -extern struct nouveau_oclass *nv10_devinit_oclass; -extern struct nouveau_oclass *nv1a_devinit_oclass; -extern struct nouveau_oclass *nv20_devinit_oclass; -extern struct nouveau_oclass *nv50_devinit_oclass; -extern struct nouveau_oclass *nv84_devinit_oclass; -extern struct nouveau_oclass *nv98_devinit_oclass; -extern struct nouveau_oclass *nva3_devinit_oclass; -extern struct nouveau_oclass *nvaf_devinit_oclass; -extern struct nouveau_oclass *nvc0_devinit_oclass; -extern struct nouveau_oclass *gm107_devinit_oclass; -extern struct nouveau_oclass *gm204_devinit_oclass; - -#endif diff --git a/nvkm/include/subdev/fb.h b/nvkm/include/subdev/fb.h deleted file mode 100644 index 889603fbb..000000000 --- a/nvkm/include/subdev/fb.h +++ /dev/null @@ -1,159 +0,0 @@ -#ifndef __NOUVEAU_FB_H__ -#define __NOUVEAU_FB_H__ - -#include <core/subdev.h> -#include <core/device.h> -#include <core/mm.h> - -#include <subdev/vm.h> - -/* memory type/access flags, do not match hardware values */ -#define NV_MEM_ACCESS_RO 1 -#define NV_MEM_ACCESS_WO 2 -#define NV_MEM_ACCESS_RW (NV_MEM_ACCESS_RO | NV_MEM_ACCESS_WO) -#define NV_MEM_ACCESS_SYS 4 -#define NV_MEM_ACCESS_VM 8 -#define NV_MEM_ACCESS_NOSNOOP 16 - -#define NV_MEM_TARGET_VRAM 0 -#define NV_MEM_TARGET_PCI 1 -#define NV_MEM_TARGET_PCI_NOSNOOP 2 -#define NV_MEM_TARGET_VM 3 -#define NV_MEM_TARGET_GART 4 - -#define NV_MEM_TYPE_VM 0x7f -#define NV_MEM_COMP_VM 0x03 - -struct nouveau_mem { - struct drm_device *dev; - - struct nouveau_vma bar_vma; - struct nouveau_vma vma[2]; - u8 page_shift; - - struct nouveau_mm_node *tag; - struct list_head regions; - dma_addr_t *pages; - u32 memtype; - u64 offset; - u64 size; - struct sg_table *sg; -}; - -struct nouveau_fb_tile { - struct nouveau_mm_node *tag; - u32 addr; - u32 limit; - u32 pitch; - u32 zcomp; -}; - -struct nouveau_fb { - struct nouveau_subdev base; - - bool (*memtype_valid)(struct nouveau_fb *, u32 memtype); - - struct nouveau_ram *ram; - - struct nouveau_mm vram; - struct nouveau_mm tags; - - struct { - struct nouveau_fb_tile region[16]; - int regions; - void (*init)(struct nouveau_fb *, int i, u32 addr, u32 size, - u32 pitch, u32 flags, struct nouveau_fb_tile *); - void (*comp)(struct nouveau_fb *, int i, u32 size, u32 flags, - struct nouveau_fb_tile *); - void (*fini)(struct nouveau_fb *, int i, - struct nouveau_fb_tile *); - void (*prog)(struct nouveau_fb *, int i, - struct nouveau_fb_tile *); - } tile; -}; - -static inline struct nouveau_fb * -nouveau_fb(void *obj) -{ - /* fbram uses this before device subdev pointer is valid */ - if (nv_iclass(obj, NV_SUBDEV_CLASS) && - nv_subidx(obj) == NVDEV_SUBDEV_FB) - return obj; - - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_FB); -} - -extern struct nouveau_oclass *nv04_fb_oclass; -extern struct nouveau_oclass *nv10_fb_oclass; -extern struct nouveau_oclass *nv1a_fb_oclass; -extern struct nouveau_oclass *nv20_fb_oclass; -extern struct nouveau_oclass *nv25_fb_oclass; -extern struct nouveau_oclass *nv30_fb_oclass; -extern struct nouveau_oclass *nv35_fb_oclass; -extern struct nouveau_oclass *nv36_fb_oclass; -extern struct nouveau_oclass *nv40_fb_oclass; -extern struct nouveau_oclass *nv41_fb_oclass; -extern struct nouveau_oclass *nv44_fb_oclass; -extern struct nouveau_oclass *nv46_fb_oclass; -extern struct nouveau_oclass *nv47_fb_oclass; -extern struct nouveau_oclass *nv49_fb_oclass; -extern struct nouveau_oclass *nv4e_fb_oclass; -extern struct nouveau_oclass *nv50_fb_oclass; -extern struct nouveau_oclass *nv84_fb_oclass; -extern struct nouveau_oclass *nva3_fb_oclass; -extern struct nouveau_oclass *nvaa_fb_oclass; -extern struct nouveau_oclass *nvaf_fb_oclass; -extern struct nouveau_oclass *nvc0_fb_oclass; -extern struct nouveau_oclass *nve0_fb_oclass; -extern struct nouveau_oclass *gk20a_fb_oclass; -extern struct nouveau_oclass *gm107_fb_oclass; - -#include <subdev/bios/ramcfg.h> - -struct nouveau_ram_data { - struct list_head head; - struct nvbios_ramcfg bios; - u32 freq; -}; - -struct nouveau_ram { - struct nouveau_object base; - enum { - NV_MEM_TYPE_UNKNOWN = 0, - NV_MEM_TYPE_STOLEN, - NV_MEM_TYPE_SGRAM, - NV_MEM_TYPE_SDRAM, - NV_MEM_TYPE_DDR1, - NV_MEM_TYPE_DDR2, - NV_MEM_TYPE_DDR3, - NV_MEM_TYPE_GDDR2, - NV_MEM_TYPE_GDDR3, - NV_MEM_TYPE_GDDR4, - NV_MEM_TYPE_GDDR5 - } type; - u64 stolen; - u64 size; - u32 tags; - - int ranks; - int parts; - int part_mask; - - int (*get)(struct nouveau_fb *, u64 size, u32 align, - u32 size_nc, u32 type, struct nouveau_mem **); - void (*put)(struct nouveau_fb *, struct nouveau_mem **); - - int (*calc)(struct nouveau_fb *, u32 freq); - int (*prog)(struct nouveau_fb *); - void (*tidy)(struct nouveau_fb *); - u32 freq; - u32 mr[16]; - u32 mr1_nuts; - - struct nouveau_ram_data *next; - struct nouveau_ram_data former; - struct nouveau_ram_data xition; - struct nouveau_ram_data target; -}; - -#endif diff --git a/nvkm/include/subdev/fb/regsnv04.h b/nvkm/include/subdev/fb/regsnv04.h deleted file mode 100644 index 0f7fc0c52..000000000 --- a/nvkm/include/subdev/fb/regsnv04.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __NOUVEAU_FB_REGS_04_H__ -#define __NOUVEAU_FB_REGS_04_H__ - -#define NV04_PFB_BOOT_0 0x00100000 -# define NV04_PFB_BOOT_0_RAM_AMOUNT 0x00000003 -# define NV04_PFB_BOOT_0_RAM_AMOUNT_32MB 0x00000000 -# define NV04_PFB_BOOT_0_RAM_AMOUNT_4MB 0x00000001 -# define NV04_PFB_BOOT_0_RAM_AMOUNT_8MB 0x00000002 -# define NV04_PFB_BOOT_0_RAM_AMOUNT_16MB 0x00000003 -# define NV04_PFB_BOOT_0_RAM_WIDTH_128 0x00000004 -# define NV04_PFB_BOOT_0_RAM_TYPE 0x00000028 -# define NV04_PFB_BOOT_0_RAM_TYPE_SGRAM_8MBIT 0x00000000 -# define NV04_PFB_BOOT_0_RAM_TYPE_SGRAM_16MBIT 0x00000008 -# define NV04_PFB_BOOT_0_RAM_TYPE_SGRAM_16MBIT_4BANK 0x00000010 -# define NV04_PFB_BOOT_0_RAM_TYPE_SDRAM_16MBIT 0x00000018 -# define NV04_PFB_BOOT_0_RAM_TYPE_SDRAM_64MBIT 0x00000020 -# define NV04_PFB_BOOT_0_RAM_TYPE_SDRAM_64MBITX16 0x00000028 -# define NV04_PFB_BOOT_0_UMA_ENABLE 0x00000100 -# define NV04_PFB_BOOT_0_UMA_SIZE 0x0000f000 - -#endif diff --git a/nvkm/include/subdev/fuse.h b/nvkm/include/subdev/fuse.h deleted file mode 100644 index cc6b02fec..000000000 --- a/nvkm/include/subdev/fuse.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __NOUVEAU_FUSE_H__ -#define __NOUVEAU_FUSE_H__ - -#include <core/subdev.h> -#include <core/device.h> - -struct nouveau_fuse { - struct nouveau_subdev base; -}; - -static inline struct nouveau_fuse * -nouveau_fuse(void *obj) -{ - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_FUSE); -} - -#define nouveau_fuse_create(p, e, o, d) \ - nouveau_fuse_create_((p), (e), (o), sizeof(**d), (void **)d) - -int nouveau_fuse_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, int, void **); -void _nouveau_fuse_dtor(struct nouveau_object *); -int _nouveau_fuse_init(struct nouveau_object *); -#define _nouveau_fuse_fini _nouveau_subdev_fini - -extern struct nouveau_oclass g80_fuse_oclass; -extern struct nouveau_oclass gf100_fuse_oclass; -extern struct nouveau_oclass gm107_fuse_oclass; - -#endif diff --git a/nvkm/include/subdev/gpio.h b/nvkm/include/subdev/gpio.h deleted file mode 100644 index 8b60c5de6..000000000 --- a/nvkm/include/subdev/gpio.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef __NOUVEAU_GPIO_H__ -#define __NOUVEAU_GPIO_H__ - -#include <core/subdev.h> -#include <core/device.h> -#include <core/event.h> - -#include <subdev/bios.h> -#include <subdev/bios/gpio.h> - -struct nvkm_gpio_ntfy_req { -#define NVKM_GPIO_HI 0x01 -#define NVKM_GPIO_LO 0x02 -#define NVKM_GPIO_TOGGLED 0x03 - u8 mask; - u8 line; -}; - -struct nvkm_gpio_ntfy_rep { - u8 mask; -}; - -struct nouveau_gpio { - struct nouveau_subdev base; - - struct nvkm_event event; - - void (*reset)(struct nouveau_gpio *, u8 func); - int (*find)(struct nouveau_gpio *, int idx, u8 tag, u8 line, - struct dcb_gpio_func *); - int (*set)(struct nouveau_gpio *, int idx, u8 tag, u8 line, int state); - int (*get)(struct nouveau_gpio *, int idx, u8 tag, u8 line); -}; - -static inline struct nouveau_gpio * -nouveau_gpio(void *obj) -{ - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_GPIO); -} - -extern struct nouveau_oclass *nv10_gpio_oclass; -extern struct nouveau_oclass *nv50_gpio_oclass; -extern struct nouveau_oclass *nv94_gpio_oclass; -extern struct nouveau_oclass *nvd0_gpio_oclass; -extern struct nouveau_oclass *nve0_gpio_oclass; - -#endif diff --git a/nvkm/include/subdev/i2c.h b/nvkm/include/subdev/i2c.h deleted file mode 100644 index a400e67f2..000000000 --- a/nvkm/include/subdev/i2c.h +++ /dev/null @@ -1,136 +0,0 @@ -#ifndef __NOUVEAU_I2C_H__ -#define __NOUVEAU_I2C_H__ - -#include <core/subdev.h> -#include <core/device.h> - -#include <subdev/bios.h> -#include <subdev/bios/i2c.h> - -#define NV_I2C_PORT(n) (0x00 + (n)) -#define NV_I2C_AUX(n) (0x10 + (n)) -#define NV_I2C_EXT(n) (0x20 + (n)) -#define NV_I2C_DEFAULT(n) (0x80 + (n)) - -#define NV_I2C_TYPE_DCBI2C(n) (0x0000 | (n)) -#define NV_I2C_TYPE_EXTDDC(e) (0x0005 | (e) << 8) -#define NV_I2C_TYPE_EXTAUX(e) (0x0006 | (e) << 8) - -struct nvkm_i2c_ntfy_req { -#define NVKM_I2C_PLUG 0x01 -#define NVKM_I2C_UNPLUG 0x02 -#define NVKM_I2C_IRQ 0x04 -#define NVKM_I2C_DONE 0x08 -#define NVKM_I2C_ANY 0x0f - u8 mask; - u8 port; -}; - -struct nvkm_i2c_ntfy_rep { - u8 mask; -}; - -struct nouveau_i2c_port { - struct nouveau_object base; - struct i2c_adapter adapter; - struct mutex mutex; - - struct list_head head; - u8 index; - int aux; - - const struct nouveau_i2c_func *func; -}; - -struct nouveau_i2c_func { - void (*drive_scl)(struct nouveau_i2c_port *, int); - void (*drive_sda)(struct nouveau_i2c_port *, int); - int (*sense_scl)(struct nouveau_i2c_port *); - int (*sense_sda)(struct nouveau_i2c_port *); - - int (*aux)(struct nouveau_i2c_port *, bool, u8, u32, u8 *, u8); - int (*pattern)(struct nouveau_i2c_port *, int pattern); - int (*lnk_ctl)(struct nouveau_i2c_port *, int nr, int bw, bool enh); - int (*drv_ctl)(struct nouveau_i2c_port *, int lane, int sw, int pe); -}; - -struct nouveau_i2c_board_info { - struct i2c_board_info dev; - u8 udelay; /* set to 0 to use the standard delay */ -}; - -struct nouveau_i2c { - struct nouveau_subdev base; - struct nvkm_event event; - - struct nouveau_i2c_port *(*find)(struct nouveau_i2c *, u8 index); - struct nouveau_i2c_port *(*find_type)(struct nouveau_i2c *, u16 type); - int (*acquire_pad)(struct nouveau_i2c_port *, unsigned long timeout); - void (*release_pad)(struct nouveau_i2c_port *); - int (*acquire)(struct nouveau_i2c_port *, unsigned long timeout); - void (*release)(struct nouveau_i2c_port *); - int (*identify)(struct nouveau_i2c *, int index, - const char *what, struct nouveau_i2c_board_info *, - bool (*match)(struct nouveau_i2c_port *, - struct i2c_board_info *, void *), void *); - - wait_queue_head_t wait; - struct list_head ports; -}; - -static inline struct nouveau_i2c * -nouveau_i2c(void *obj) -{ - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_I2C); -} - -extern struct nouveau_oclass *nv04_i2c_oclass; -extern struct nouveau_oclass *nv4e_i2c_oclass; -extern struct nouveau_oclass *nv50_i2c_oclass; -extern struct nouveau_oclass *nv94_i2c_oclass; -extern struct nouveau_oclass *nvd0_i2c_oclass; -extern struct nouveau_oclass *gf117_i2c_oclass; -extern struct nouveau_oclass *nve0_i2c_oclass; -extern struct nouveau_oclass *gm204_i2c_oclass; - -static inline int -nv_rdi2cr(struct nouveau_i2c_port *port, u8 addr, u8 reg) -{ - u8 val; - struct i2c_msg msgs[] = { - { .addr = addr, .flags = 0, .len = 1, .buf = ® }, - { .addr = addr, .flags = I2C_M_RD, .len = 1, .buf = &val }, - }; - - int ret = i2c_transfer(&port->adapter, msgs, 2); - if (ret != 2) - return -EIO; - - return val; -} - -static inline int -nv_wri2cr(struct nouveau_i2c_port *port, u8 addr, u8 reg, u8 val) -{ - u8 buf[2] = { reg, val }; - struct i2c_msg msgs[] = { - { .addr = addr, .flags = 0, .len = 2, .buf = buf }, - }; - - int ret = i2c_transfer(&port->adapter, msgs, 1); - if (ret != 1) - return -EIO; - - return 0; -} - -static inline bool -nv_probe_i2c(struct nouveau_i2c_port *port, u8 addr) -{ - return nv_rdi2cr(port, addr, 0) >= 0; -} - -int nv_rdaux(struct nouveau_i2c_port *, u32 addr, u8 *data, u8 size); -int nv_wraux(struct nouveau_i2c_port *, u32 addr, u8 *data, u8 size); - -#endif diff --git a/nvkm/include/subdev/ibus.h b/nvkm/include/subdev/ibus.h deleted file mode 100644 index b6387d27e..000000000 --- a/nvkm/include/subdev/ibus.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __NOUVEAU_IBUS_H__ -#define __NOUVEAU_IBUS_H__ - -#include <core/subdev.h> -#include <core/device.h> - -struct nouveau_ibus { - struct nouveau_subdev base; -}; - -static inline struct nouveau_ibus * -nouveau_ibus(void *obj) -{ - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_IBUS); -} - -#define nouveau_ibus_create(p,e,o,d) \ - nouveau_subdev_create_((p), (e), (o), 0, "PIBUS", "ibus", \ - sizeof(**d), (void **)d) -#define nouveau_ibus_destroy(p) \ - nouveau_subdev_destroy(&(p)->base) -#define nouveau_ibus_init(p) \ - nouveau_subdev_init(&(p)->base) -#define nouveau_ibus_fini(p,s) \ - nouveau_subdev_fini(&(p)->base, (s)) - -#define _nouveau_ibus_dtor _nouveau_subdev_dtor -#define _nouveau_ibus_init _nouveau_subdev_init -#define _nouveau_ibus_fini _nouveau_subdev_fini - -extern struct nouveau_oclass nvc0_ibus_oclass; -extern struct nouveau_oclass nve0_ibus_oclass; -extern struct nouveau_oclass gk20a_ibus_oclass; - -#endif diff --git a/nvkm/include/subdev/instmem.h b/nvkm/include/subdev/instmem.h deleted file mode 100644 index 4953e6c6c..000000000 --- a/nvkm/include/subdev/instmem.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef __NOUVEAU_INSTMEM_H__ -#define __NOUVEAU_INSTMEM_H__ - -#include <core/subdev.h> -#include <core/device.h> -#include <core/mm.h> - -struct nouveau_instobj { - struct nouveau_object base; - struct list_head head; - u32 *suspend; - u64 addr; - u32 size; -}; - -static inline struct nouveau_instobj * -nv_memobj(void *obj) -{ -#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA - if (unlikely(!nv_iclass(obj, NV_MEMOBJ_CLASS))) - nv_assert("BAD CAST -> NvMemObj, %08x", nv_hclass(obj)); -#endif - return obj; -} - -struct nouveau_instmem { - struct nouveau_subdev base; - struct list_head list; - - u32 reserved; - int (*alloc)(struct nouveau_instmem *, struct nouveau_object *, - u32 size, u32 align, struct nouveau_object **); -}; - -static inline struct nouveau_instmem * -nouveau_instmem(void *obj) -{ - /* nv04/nv40 impls need to create objects in their constructor, - * which is before the subdev pointer is valid - */ - if (nv_iclass(obj, NV_SUBDEV_CLASS) && - nv_subidx(obj) == NVDEV_SUBDEV_INSTMEM) - return obj; - - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_INSTMEM); -} - -extern struct nouveau_oclass *nv04_instmem_oclass; -extern struct nouveau_oclass *nv40_instmem_oclass; -extern struct nouveau_oclass *nv50_instmem_oclass; - -#endif diff --git a/nvkm/include/subdev/ltc.h b/nvkm/include/subdev/ltc.h deleted file mode 100644 index 432717a42..000000000 --- a/nvkm/include/subdev/ltc.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __NOUVEAU_LTC_H__ -#define __NOUVEAU_LTC_H__ - -#include <core/subdev.h> -#include <core/device.h> - -#define NOUVEAU_LTC_MAX_ZBC_CNT 16 - -struct nouveau_mm_node; - -struct nouveau_ltc { - struct nouveau_subdev base; - - int (*tags_alloc)(struct nouveau_ltc *, u32 count, - struct nouveau_mm_node **); - void (*tags_free)(struct nouveau_ltc *, struct nouveau_mm_node **); - void (*tags_clear)(struct nouveau_ltc *, u32 first, u32 count); - - int zbc_min; - int zbc_max; - int (*zbc_color_get)(struct nouveau_ltc *, int index, const u32[4]); - int (*zbc_depth_get)(struct nouveau_ltc *, int index, const u32); -}; - -static inline struct nouveau_ltc * -nouveau_ltc(void *obj) -{ - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_LTC); -} - -extern struct nouveau_oclass *gf100_ltc_oclass; -extern struct nouveau_oclass *gk104_ltc_oclass; -extern struct nouveau_oclass *gm107_ltc_oclass; - -#endif diff --git a/nvkm/include/subdev/mc.h b/nvkm/include/subdev/mc.h deleted file mode 100644 index af7926f3a..000000000 --- a/nvkm/include/subdev/mc.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef __NOUVEAU_MC_H__ -#define __NOUVEAU_MC_H__ - -#include <core/subdev.h> -#include <core/device.h> - -struct nouveau_mc { - struct nouveau_subdev base; - bool use_msi; - unsigned int irq; - void (*unk260)(struct nouveau_mc *, u32); -}; - -static inline struct nouveau_mc * -nouveau_mc(void *obj) -{ - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_MC); -} - -extern struct nouveau_oclass *nv04_mc_oclass; -extern struct nouveau_oclass *nv40_mc_oclass; -extern struct nouveau_oclass *nv44_mc_oclass; -extern struct nouveau_oclass *nv4c_mc_oclass; -extern struct nouveau_oclass *nv50_mc_oclass; -extern struct nouveau_oclass *nv94_mc_oclass; -extern struct nouveau_oclass *nv98_mc_oclass; -extern struct nouveau_oclass *nvc0_mc_oclass; -extern struct nouveau_oclass *nvc3_mc_oclass; -extern struct nouveau_oclass *gk20a_mc_oclass; - -#endif diff --git a/nvkm/include/subdev/mxm.h b/nvkm/include/subdev/mxm.h deleted file mode 100644 index 94b8af23c..000000000 --- a/nvkm/include/subdev/mxm.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __NOUVEAU_MXM_H__ -#define __NOUVEAU_MXM_H__ - -#include <core/subdev.h> -#include <core/device.h> - -#define MXM_SANITISE_DCB 0x00000001 - -struct nouveau_mxm { - struct nouveau_subdev base; - u32 action; - u8 *mxms; -}; - -static inline struct nouveau_mxm * -nouveau_mxm(void *obj) -{ - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_MXM); -} - -#define nouveau_mxm_create(p,e,o,d) \ - nouveau_mxm_create_((p), (e), (o), sizeof(**d), (void **)d) -#define nouveau_mxm_init(p) \ - nouveau_subdev_init(&(p)->base) -#define nouveau_mxm_fini(p,s) \ - nouveau_subdev_fini(&(p)->base, (s)) -int nouveau_mxm_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, int, void **); -void nouveau_mxm_destroy(struct nouveau_mxm *); - -#define _nouveau_mxm_dtor _nouveau_subdev_dtor -#define _nouveau_mxm_init _nouveau_subdev_init -#define _nouveau_mxm_fini _nouveau_subdev_fini - -extern struct nouveau_oclass nv50_mxm_oclass; - -#endif diff --git a/nvkm/include/subdev/pwr.h b/nvkm/include/subdev/pwr.h deleted file mode 100644 index 83f85ac15..000000000 --- a/nvkm/include/subdev/pwr.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef __NOUVEAU_PWR_H__ -#define __NOUVEAU_PWR_H__ - -#include <core/subdev.h> -#include <core/device.h> - -struct nouveau_pwr { - struct nouveau_subdev base; - - struct { - u32 base; - u32 size; - } send; - - struct { - u32 base; - u32 size; - - struct work_struct work; - wait_queue_head_t wait; - u32 process; - u32 message; - u32 data[2]; - } recv; - - int (*message)(struct nouveau_pwr *, u32[2], u32, u32, u32, u32); - void (*pgob)(struct nouveau_pwr *, bool); -}; - -static inline struct nouveau_pwr * -nouveau_pwr(void *obj) -{ - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_PWR); -} - -extern struct nouveau_oclass *nva3_pwr_oclass; -extern struct nouveau_oclass *nvc0_pwr_oclass; -extern struct nouveau_oclass *nvd0_pwr_oclass; -extern struct nouveau_oclass *gk104_pwr_oclass; -extern struct nouveau_oclass *nv108_pwr_oclass; -extern struct nouveau_oclass *gk20a_pwr_oclass; - -/* interface to MEMX process running on PPWR */ -struct nouveau_memx; -int nouveau_memx_init(struct nouveau_pwr *, struct nouveau_memx **); -int nouveau_memx_fini(struct nouveau_memx **, bool exec); -void nouveau_memx_wr32(struct nouveau_memx *, u32 addr, u32 data); -void nouveau_memx_wait(struct nouveau_memx *, - u32 addr, u32 mask, u32 data, u32 nsec); -void nouveau_memx_nsec(struct nouveau_memx *, u32 nsec); -void nouveau_memx_wait_vblank(struct nouveau_memx *); -void nouveau_memx_train(struct nouveau_memx *); -int nouveau_memx_train_result(struct nouveau_pwr *, u32 *, int); -void nouveau_memx_block(struct nouveau_memx *); -void nouveau_memx_unblock(struct nouveau_memx *); - -#endif diff --git a/nvkm/include/subdev/therm.h b/nvkm/include/subdev/therm.h deleted file mode 100644 index 42f9574a0..000000000 --- a/nvkm/include/subdev/therm.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef __NOUVEAU_THERM_H__ -#define __NOUVEAU_THERM_H__ - -#include <core/device.h> -#include <core/subdev.h> - -enum nouveau_therm_fan_mode { - NOUVEAU_THERM_CTRL_NONE = 0, - NOUVEAU_THERM_CTRL_MANUAL = 1, - NOUVEAU_THERM_CTRL_AUTO = 2, -}; - -enum nouveau_therm_attr_type { - NOUVEAU_THERM_ATTR_FAN_MIN_DUTY = 0, - NOUVEAU_THERM_ATTR_FAN_MAX_DUTY = 1, - NOUVEAU_THERM_ATTR_FAN_MODE = 2, - - NOUVEAU_THERM_ATTR_THRS_FAN_BOOST = 10, - NOUVEAU_THERM_ATTR_THRS_FAN_BOOST_HYST = 11, - NOUVEAU_THERM_ATTR_THRS_DOWN_CLK = 12, - NOUVEAU_THERM_ATTR_THRS_DOWN_CLK_HYST = 13, - NOUVEAU_THERM_ATTR_THRS_CRITICAL = 14, - NOUVEAU_THERM_ATTR_THRS_CRITICAL_HYST = 15, - NOUVEAU_THERM_ATTR_THRS_SHUTDOWN = 16, - NOUVEAU_THERM_ATTR_THRS_SHUTDOWN_HYST = 17, -}; - -struct nouveau_therm { - struct nouveau_subdev base; - - int (*pwm_ctrl)(struct nouveau_therm *, int line, bool); - int (*pwm_get)(struct nouveau_therm *, int line, u32 *, u32 *); - int (*pwm_set)(struct nouveau_therm *, int line, u32, u32); - int (*pwm_clock)(struct nouveau_therm *, int line); - - int (*fan_get)(struct nouveau_therm *); - int (*fan_set)(struct nouveau_therm *, int); - int (*fan_sense)(struct nouveau_therm *); - - int (*temp_get)(struct nouveau_therm *); - - int (*attr_get)(struct nouveau_therm *, enum nouveau_therm_attr_type); - int (*attr_set)(struct nouveau_therm *, - enum nouveau_therm_attr_type, int); -}; - -static inline struct nouveau_therm * -nouveau_therm(void *obj) -{ - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_THERM); -} - -#define nouveau_therm_create(p,e,o,d) \ - nouveau_therm_create_((p), (e), (o), sizeof(**d), (void **)d) -#define nouveau_therm_destroy(p) ({ \ - struct nouveau_therm *therm = (p); \ - _nouveau_therm_dtor(nv_object(therm)); \ -}) -#define nouveau_therm_init(p) ({ \ - struct nouveau_therm *therm = (p); \ - _nouveau_therm_init(nv_object(therm)); \ -}) -#define nouveau_therm_fini(p,s) ({ \ - struct nouveau_therm *therm = (p); \ - _nouveau_therm_init(nv_object(therm), (s)); \ -}) - -int nouveau_therm_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, int, void **); -void _nouveau_therm_dtor(struct nouveau_object *); -int _nouveau_therm_init(struct nouveau_object *); -int _nouveau_therm_fini(struct nouveau_object *, bool); - -int nouveau_therm_cstate(struct nouveau_therm *, int, int); - -extern struct nouveau_oclass nv40_therm_oclass; -extern struct nouveau_oclass nv50_therm_oclass; -extern struct nouveau_oclass nv84_therm_oclass; -extern struct nouveau_oclass nva3_therm_oclass; -extern struct nouveau_oclass nvd0_therm_oclass; -extern struct nouveau_oclass gm107_therm_oclass; - -#endif diff --git a/nvkm/include/subdev/timer.h b/nvkm/include/subdev/timer.h deleted file mode 100644 index 36b5184e3..000000000 --- a/nvkm/include/subdev/timer.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef __NOUVEAU_TIMER_H__ -#define __NOUVEAU_TIMER_H__ - -#include <core/subdev.h> -#include <core/device.h> - -struct nouveau_alarm { - struct list_head head; - u64 timestamp; - void (*func)(struct nouveau_alarm *); -}; - -static inline void -nouveau_alarm_init(struct nouveau_alarm *alarm, - void (*func)(struct nouveau_alarm *)) -{ - INIT_LIST_HEAD(&alarm->head); - alarm->func = func; -} - -bool nouveau_timer_wait_eq(void *, u64 nsec, u32 addr, u32 mask, u32 data); -bool nouveau_timer_wait_ne(void *, u64 nsec, u32 addr, u32 mask, u32 data); -bool nouveau_timer_wait_cb(void *, u64 nsec, bool (*func)(void *), void *data); -void nouveau_timer_alarm(void *, u32 nsec, struct nouveau_alarm *); -void nouveau_timer_alarm_cancel(void *, struct nouveau_alarm *); - -#define NV_WAIT_DEFAULT 2000000000ULL -#define nv_wait(o,a,m,v) \ - nouveau_timer_wait_eq((o), NV_WAIT_DEFAULT, (a), (m), (v)) -#define nv_wait_ne(o,a,m,v) \ - nouveau_timer_wait_ne((o), NV_WAIT_DEFAULT, (a), (m), (v)) -#define nv_wait_cb(o,c,d) \ - nouveau_timer_wait_cb((o), NV_WAIT_DEFAULT, (c), (d)) - -struct nouveau_timer { - struct nouveau_subdev base; - u64 (*read)(struct nouveau_timer *); - void (*alarm)(struct nouveau_timer *, u64 time, struct nouveau_alarm *); - void (*alarm_cancel)(struct nouveau_timer *, struct nouveau_alarm *); -}; - -static inline struct nouveau_timer * -nouveau_timer(void *obj) -{ - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_TIMER); -} - -#define nouveau_timer_create(p,e,o,d) \ - nouveau_subdev_create_((p), (e), (o), 0, "PTIMER", "timer", \ - sizeof(**d), (void **)d) -#define nouveau_timer_destroy(p) \ - nouveau_subdev_destroy(&(p)->base) -#define nouveau_timer_init(p) \ - nouveau_subdev_init(&(p)->base) -#define nouveau_timer_fini(p,s) \ - nouveau_subdev_fini(&(p)->base, (s)) - -int nouveau_timer_create_(struct nouveau_object *, struct nouveau_engine *, - struct nouveau_oclass *, int size, void **); - -extern struct nouveau_oclass nv04_timer_oclass; -extern struct nouveau_oclass gk20a_timer_oclass; - -#endif diff --git a/nvkm/include/subdev/vga.h b/nvkm/include/subdev/vga.h deleted file mode 100644 index fee09ad81..000000000 --- a/nvkm/include/subdev/vga.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __NOUVEAU_VGA_H__ -#define __NOUVEAU_VGA_H__ - -#include <core/os.h> - -/* access to various legacy io ports */ -u8 nv_rdport(void *obj, int head, u16 port); -void nv_wrport(void *obj, int head, u16 port, u8 value); - -/* VGA Sequencer */ -u8 nv_rdvgas(void *obj, int head, u8 index); -void nv_wrvgas(void *obj, int head, u8 index, u8 value); - -/* VGA Graphics */ -u8 nv_rdvgag(void *obj, int head, u8 index); -void nv_wrvgag(void *obj, int head, u8 index, u8 value); - -/* VGA CRTC */ -u8 nv_rdvgac(void *obj, int head, u8 index); -void nv_wrvgac(void *obj, int head, u8 index, u8 value); - -/* VGA indexed port access dispatcher */ -u8 nv_rdvgai(void *obj, int head, u16 port, u8 index); -void nv_wrvgai(void *obj, int head, u16 port, u8 index, u8 value); - -bool nv_lockvgac(void *obj, bool lock); -u8 nv_rdvgaowner(void *obj); -void nv_wrvgaowner(void *obj, u8); - -#endif diff --git a/nvkm/include/subdev/vm.h b/nvkm/include/subdev/vm.h deleted file mode 100644 index d56585f1c..000000000 --- a/nvkm/include/subdev/vm.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2010 Red Hat Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: Ben Skeggs - */ - -#ifndef __NOUVEAU_VM_H__ -#define __NOUVEAU_VM_H__ - -#include <core/object.h> -#include <core/subdev.h> -#include <core/device.h> -#include <core/mm.h> - -struct nouveau_vm_pgt { - struct nouveau_gpuobj *obj[2]; - u32 refcount[2]; -}; - -struct nouveau_vm_pgd { - struct list_head head; - struct nouveau_gpuobj *obj; -}; - -struct nouveau_gpuobj; -struct nouveau_mem; - -struct nouveau_vma { - struct list_head head; - int refcount; - struct nouveau_vm *vm; - struct nouveau_mm_node *node; - u64 offset; - u32 access; -}; - -struct nouveau_vm { - struct nouveau_vmmgr *vmm; - struct nouveau_mm mm; - struct kref refcount; - - struct list_head pgd_list; - atomic_t engref[NVDEV_SUBDEV_NR]; - - struct nouveau_vm_pgt *pgt; - u32 fpde; - u32 lpde; -}; - -struct nouveau_vmmgr { - struct nouveau_subdev base; - - u64 limit; - u8 dma_bits; - u32 pgt_bits; - u8 spg_shift; - u8 lpg_shift; - - int (*create)(struct nouveau_vmmgr *, u64 offset, u64 length, - u64 mm_offset, struct nouveau_vm **); - - void (*map_pgt)(struct nouveau_gpuobj *pgd, u32 pde, - struct nouveau_gpuobj *pgt[2]); - void (*map)(struct nouveau_vma *, struct nouveau_gpuobj *, - struct nouveau_mem *, u32 pte, u32 cnt, - u64 phys, u64 delta); - void (*map_sg)(struct nouveau_vma *, struct nouveau_gpuobj *, - struct nouveau_mem *, u32 pte, u32 cnt, dma_addr_t *); - void (*unmap)(struct nouveau_gpuobj *pgt, u32 pte, u32 cnt); - void (*flush)(struct nouveau_vm *); -}; - -static inline struct nouveau_vmmgr * -nouveau_vmmgr(void *obj) -{ - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_VM); -} - -#define nouveau_vmmgr_create(p,e,o,i,f,d) \ - nouveau_subdev_create((p), (e), (o), 0, (i), (f), (d)) -#define nouveau_vmmgr_destroy(p) \ - nouveau_subdev_destroy(&(p)->base) -#define nouveau_vmmgr_init(p) \ - nouveau_subdev_init(&(p)->base) -#define nouveau_vmmgr_fini(p,s) \ - nouveau_subdev_fini(&(p)->base, (s)) - -#define _nouveau_vmmgr_dtor _nouveau_subdev_dtor -#define _nouveau_vmmgr_init _nouveau_subdev_init -#define _nouveau_vmmgr_fini _nouveau_subdev_fini - -extern struct nouveau_oclass nv04_vmmgr_oclass; -extern struct nouveau_oclass nv41_vmmgr_oclass; -extern struct nouveau_oclass nv44_vmmgr_oclass; -extern struct nouveau_oclass nv50_vmmgr_oclass; -extern struct nouveau_oclass nvc0_vmmgr_oclass; - -int nv04_vm_create(struct nouveau_vmmgr *, u64, u64, u64, - struct nouveau_vm **); -void nv04_vmmgr_dtor(struct nouveau_object *); - -/* nouveau_vm.c */ -int nouveau_vm_create(struct nouveau_vmmgr *, u64 offset, u64 length, - u64 mm_offset, u32 block, struct nouveau_vm **); -int nouveau_vm_new(struct nouveau_device *, u64 offset, u64 length, - u64 mm_offset, struct nouveau_vm **); -int nouveau_vm_ref(struct nouveau_vm *, struct nouveau_vm **, - struct nouveau_gpuobj *pgd); -int nouveau_vm_get(struct nouveau_vm *, u64 size, u32 page_shift, - u32 access, struct nouveau_vma *); -void nouveau_vm_put(struct nouveau_vma *); -void nouveau_vm_map(struct nouveau_vma *, struct nouveau_mem *); -void nouveau_vm_map_at(struct nouveau_vma *, u64 offset, struct nouveau_mem *); -void nouveau_vm_unmap(struct nouveau_vma *); -void nouveau_vm_unmap_at(struct nouveau_vma *, u64 offset, u64 length); - -#endif diff --git a/nvkm/include/subdev/volt.h b/nvkm/include/subdev/volt.h deleted file mode 100644 index 13e9a83ce..000000000 --- a/nvkm/include/subdev/volt.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef __NOUVEAU_VOLT_H__ -#define __NOUVEAU_VOLT_H__ - -#include <core/subdev.h> -#include <core/device.h> - -struct nouveau_voltage { - u32 uv; - u8 id; -}; - -struct nouveau_volt { - struct nouveau_subdev base; - - int (*vid_get)(struct nouveau_volt *); - int (*get)(struct nouveau_volt *); - int (*vid_set)(struct nouveau_volt *, u8 vid); - int (*set)(struct nouveau_volt *, u32 uv); - int (*set_id)(struct nouveau_volt *, u8 id, int condition); - - u8 vid_mask; - u8 vid_nr; - struct { - u32 uv; - u8 vid; - } vid[256]; -}; - -static inline struct nouveau_volt * -nouveau_volt(void *obj) -{ - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_VOLT); -} - -#define nouveau_volt_create(p, e, o, d) \ - nouveau_volt_create_((p), (e), (o), sizeof(**d), (void **)d) -#define nouveau_volt_destroy(p) ({ \ - struct nouveau_volt *v = (p); \ - _nouveau_volt_dtor(nv_object(v)); \ -}) -#define nouveau_volt_init(p) ({ \ - struct nouveau_volt *v = (p); \ - _nouveau_volt_init(nv_object(v)); \ -}) -#define nouveau_volt_fini(p,s) \ - nouveau_subdev_fini((p), (s)) - -int nouveau_volt_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, int, void **); -void _nouveau_volt_dtor(struct nouveau_object *); -int _nouveau_volt_init(struct nouveau_object *); -#define _nouveau_volt_fini _nouveau_subdev_fini - -extern struct nouveau_oclass nv40_volt_oclass; -extern struct nouveau_oclass gk20a_volt_oclass; - -int nouveau_voltgpio_init(struct nouveau_volt *); -int nouveau_voltgpio_get(struct nouveau_volt *); -int nouveau_voltgpio_set(struct nouveau_volt *, u8); - -#endif |