Wed Jul 24 02:46:49 2013 UTC ()
Replace extra data in struct drm_local_map by a union.

This is a tagged union; only certain variants, specified by the map's
type, need a bus space handle and a drm bus map.  They will also need
a bus space tag later.  Other variants use other data, with more to
be added in the future, probably.


(riastradh)
diff -r1.1.1.1.2.36 -r1.1.1.1.2.37 src/sys/external/bsd/drm2/dist/include/drm/drmP.h

cvs diff -r1.1.1.1.2.36 -r1.1.1.1.2.37 src/sys/external/bsd/drm2/dist/include/drm/Attic/drmP.h (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/include/drm/Attic/drmP.h 2013/07/24 02:45:06 1.1.1.1.2.36
+++ src/sys/external/bsd/drm2/dist/include/drm/Attic/drmP.h 2013/07/24 02:46:49 1.1.1.1.2.37
@@ -654,28 +654,50 @@ struct drm_bus_map { @@ -654,28 +654,50 @@ struct drm_bus_map {
654/** 654/**
655 * Kernel side of a mapping 655 * Kernel side of a mapping
656 */ 656 */
657struct drm_local_map { 657struct drm_local_map {
658 resource_size_t offset; /**< Requested physical address (0 for SAREA)*/ 658 resource_size_t offset; /**< Requested physical address (0 for SAREA)*/
659 unsigned long size; /**< Requested physical size (bytes) */ 659 unsigned long size; /**< Requested physical size (bytes) */
660 enum drm_map_type type; /**< Type of memory to map */ 660 enum drm_map_type type; /**< Type of memory to map */
661 enum drm_map_flags flags; /**< Flags */ 661 enum drm_map_flags flags; /**< Flags */
662 void *handle; /**< User-space: "Handle" to pass to mmap() */ 662 void *handle; /**< User-space: "Handle" to pass to mmap() */
663 /**< Kernel-space: kernel-virtual address */ 663 /**< Kernel-space: kernel-virtual address */
664 int mtrr; /**< MTRR slot used */ 664 int mtrr; /**< MTRR slot used */
665 665
666#ifdef __NetBSD__ 666#ifdef __NetBSD__
667 bus_space_handle_t bsh; 667 union {
668 struct drm_bus_map *bus_map; 668 /* _DRM_FRAME_BUFFER, _DRM_AGP, _DRM_REGISTERS */
 669 /* XXX mtrr should be moved into this case too. */
 670 struct {
 671 /*
 672 * XXX bst seems like a waste of space, but not
 673 * all accessors have the drm_device handy.
 674 */
 675 bus_space_tag_t bst;
 676 bus_space_handle_t bsh;
 677 struct drm_bus_map *bus_map;
 678 } bus_space;
 679
 680 /* _DRM_CONSISTENT */
 681 struct drm_dma_handle *dmah;
 682
 683 /* _DRM_SCATTER_GATHER */
 684#if 0 /* XXX stored in dev->sg instead */
 685 struct drm_sg_mem *sg;
 686#endif
 687
 688 /* _DRM_SHM */
 689 /* XXX Anything? uvm object? */
 690 } lm_data;
669#endif 691#endif
670}; 692};
671 693
672typedef struct drm_local_map drm_local_map_t; 694typedef struct drm_local_map drm_local_map_t;
673 695
674/** 696/**
675 * Mappings list 697 * Mappings list
676 */ 698 */
677struct drm_map_list { 699struct drm_map_list {
678 struct list_head head; /**< list head */ 700 struct list_head head; /**< list head */
679 struct drm_hash_item hash; 701 struct drm_hash_item hash;
680 struct drm_local_map *map; /**< mapping */ 702 struct drm_local_map *map; /**< mapping */
681 uint64_t user_token; 703 uint64_t user_token;