From 674cefd4fe4b537a20a10edcb4ec5df55facca8e Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Mon, 26 Mar 2007 19:43:48 +1000 Subject: nouveau: move card initialisation into the drm The PGRAPH init for the various cards will need cleaning up at some point, a lot of the values written there are per-context state left over from the all the hardcoding done in the ddx. It's possible some cards get broken by this commit, let me know. Tested on: NV5, NV18, NV28, NV35, NV40, NV4E --- shared-core/nouveau_drv.h | 65 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 3 deletions(-) (limited to 'shared-core/nouveau_drv.h') diff --git a/shared-core/nouveau_drv.h b/shared-core/nouveau_drv.h index 265479f8..debee8e4 100644 --- a/shared-core/nouveau_drv.h +++ b/shared-core/nouveau_drv.h @@ -34,7 +34,7 @@ #define DRIVER_MAJOR 0 #define DRIVER_MINOR 0 -#define DRIVER_PATCHLEVEL 5 +#define DRIVER_PATCHLEVEL 6 #define NOUVEAU_FAMILY 0x0000FFFF #define NOUVEAU_FLAGS 0xFFFF0000 @@ -99,6 +99,33 @@ struct nouveau_config { } cmdbuf; }; +struct nouveau_engine_func { + struct { + int (*Init)(drm_device_t *dev); + void (*Takedown)(drm_device_t *dev); + } Mc; + + struct { + int (*Init)(drm_device_t *dev); + void (*Takedown)(drm_device_t *dev); + } Timer; + + struct { + int (*Init)(drm_device_t *dev); + void (*Takedown)(drm_device_t *dev); + } Fb; + + struct { + int (*Init)(drm_device_t *dev); + void (*Takedown)(drm_device_t *dev); + } Graph; + + struct { + int (*Init)(drm_device_t *dev); + void (*Takedown)(drm_device_t *dev); + } Fifo; +}; + typedef struct drm_nouveau_private { /* the card type, takes NV_* as values */ int card_type; @@ -113,6 +140,8 @@ typedef struct drm_nouveau_private { int fifo_alloc_count; struct nouveau_fifo fifos[NV_MAX_FIFO_NUMBER]; + struct nouveau_engine_func Engine; + /* RAMIN configuration, RAMFC, RAMHT and RAMRO offsets */ uint32_t ramin_size; uint32_t ramht_offset; @@ -154,6 +183,7 @@ extern int nouveau_unload(struct drm_device *dev); extern int nouveau_ioctl_getparam(DRM_IOCTL_ARGS); extern int nouveau_ioctl_setparam(DRM_IOCTL_ARGS); extern void nouveau_wait_for_idle(struct drm_device *dev); +extern int nouveau_ioctl_card_init(DRM_IOCTL_ARGS); /* nouveau_mem.c */ extern uint64_t nouveau_mem_fb_amount(struct drm_device *dev); @@ -164,8 +194,7 @@ extern struct mem_block* nouveau_mem_alloc(struct drm_device *dev, int alignment extern void nouveau_mem_free(struct drm_device* dev, struct mem_block*); extern int nouveau_mem_init(struct drm_device *dev); extern void nouveau_mem_close(struct drm_device *dev); -extern int nouveau_instmem_init(struct drm_device *dev, - uint32_t offset); +extern int nouveau_instmem_init(struct drm_device *dev); extern struct mem_block* nouveau_instmem_alloc(struct drm_device *dev, uint32_t size, uint32_t align); extern void nouveau_instmem_free(struct drm_device *dev, @@ -179,6 +208,7 @@ extern void nouveau_instmem_w32(drm_nouveau_private_t *dev_priv, /* nouveau_fifo.c */ extern int nouveau_fifo_init(drm_device_t *dev); extern int nouveau_fifo_number(drm_device_t *dev); +extern int nouveau_fifo_ctx_size(drm_device_t *dev); extern void nouveau_fifo_cleanup(drm_device_t *dev, DRMFILE filp); extern int nouveau_fifo_owner(drm_device_t *dev, DRMFILE filp, int channel); extern void nouveau_fifo_free(drm_device_t *dev, int channel); @@ -202,31 +232,60 @@ extern void nouveau_irq_preinstall(drm_device_t*); extern void nouveau_irq_postinstall(drm_device_t*); extern void nouveau_irq_uninstall(drm_device_t*); +/* nv04_fb.c */ +extern int nv04_fb_init(drm_device_t *dev); +extern void nv04_fb_takedown(drm_device_t *dev); + +/* nv10_fb.c */ +extern int nv10_fb_init(drm_device_t *dev); +extern void nv10_fb_takedown(drm_device_t *dev); + +/* nv40_fb.c */ +extern int nv40_fb_init(drm_device_t *dev); +extern void nv40_fb_takedown(drm_device_t *dev); + /* nv04_graph.c */ extern void nouveau_nv04_context_switch(drm_device_t *dev); extern int nv04_graph_init(drm_device_t *dev); +extern void nv04_graph_takedown(drm_device_t *dev); extern int nv04_graph_context_create(drm_device_t *dev, int channel); /* nv10_graph.c */ extern void nouveau_nv10_context_switch(drm_device_t *dev); extern int nv10_graph_init(drm_device_t *dev); +extern void nv10_graph_takedown(drm_device_t *dev); extern int nv10_graph_context_create(drm_device_t *dev, int channel); /* nv20_graph.c */ extern void nouveau_nv20_context_switch(drm_device_t *dev); extern int nv20_graph_init(drm_device_t *dev); +extern void nv20_graph_takedown(drm_device_t *dev); extern int nv20_graph_context_create(drm_device_t *dev, int channel); /* nv30_graph.c */ extern int nv30_graph_init(drm_device_t *dev); +extern void nv30_graph_takedown(drm_device_t *dev); extern int nv30_graph_context_create(drm_device_t *dev, int channel); /* nv40_graph.c */ extern int nv40_graph_init(drm_device_t *dev); +extern void nv40_graph_takedown(drm_device_t *dev); extern int nv40_graph_context_create(drm_device_t *dev, int channel); extern void nv40_graph_context_save_current(drm_device_t *dev); extern void nv40_graph_context_restore(drm_device_t *dev, int channel); +/* nv04_mc.c */ +extern int nv04_mc_init(drm_device_t *dev); +extern void nv04_mc_takedown(drm_device_t *dev); + +/* nv40_mc.c */ +extern int nv40_mc_init(drm_device_t *dev); +extern void nv40_mc_takedown(drm_device_t *dev); + +/* nv04_timer.c */ +extern int nv04_timer_init(drm_device_t *dev); +extern void nv04_timer_takedown(drm_device_t *dev); + extern long nouveau_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); -- cgit v1.2.3