diff options
| author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-06-17 21:16:55 -0400 |
|---|---|---|
| committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-06-17 21:16:55 -0400 |
| commit | 4b337c5f245b6587ba844ac7bb13c313a2912f7b (patch) | |
| tree | 999c6a6580b76a083c8efb9dabff709d1c49fcd0 /include | |
| parent | 492b057c426e4aa747484958e18e9da29003985d (diff) | |
| parent | 3fe0344faf7fdcb158bd5c1a9aec960a8d70c8e8 (diff) | |
Merge commit 'origin/master' into next
Diffstat (limited to 'include')
92 files changed, 4532 insertions, 319 deletions
diff --git a/include/Kbuild b/include/Kbuild index fe36accd4328..8d226bfa2696 100644 --- a/include/Kbuild +++ b/include/Kbuild | |||
| @@ -9,3 +9,4 @@ header-y += rdma/ | |||
| 9 | header-y += video/ | 9 | header-y += video/ |
| 10 | header-y += drm/ | 10 | header-y += drm/ |
| 11 | header-y += xen/ | 11 | header-y += xen/ |
| 12 | header-y += scsi/ | ||
diff --git a/include/asm-generic/kmap_types.h b/include/asm-generic/kmap_types.h index 58c33055c304..54e8b3d956b7 100644 --- a/include/asm-generic/kmap_types.h +++ b/include/asm-generic/kmap_types.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #ifndef _ASM_GENERIC_KMAP_TYPES_H | 1 | #ifndef _ASM_GENERIC_KMAP_TYPES_H |
| 2 | #define _ASM_GENERIC_KMAP_TYPES_H | 2 | #define _ASM_GENERIC_KMAP_TYPES_H |
| 3 | 3 | ||
| 4 | #ifdef CONFIG_DEBUG_HIGHMEM | 4 | #ifdef __WITH_KM_FENCE |
| 5 | # define D(n) __KM_FENCE_##n , | 5 | # define D(n) __KM_FENCE_##n , |
| 6 | #else | 6 | #else |
| 7 | # define D(n) | 7 | # define D(n) |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index f8634ab53b8f..45c18672b093 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
| @@ -254,8 +254,8 @@ | |||
| 254 | {0x1002, 0x940A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \ | 254 | {0x1002, 0x940A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \ |
| 255 | {0x1002, 0x940B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \ | 255 | {0x1002, 0x940B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \ |
| 256 | {0x1002, 0x940F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \ | 256 | {0x1002, 0x940F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \ |
| 257 | {0x1002, 0x94A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \ | 257 | {0x1002, 0x94A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 258 | {0x1002, 0x94A1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \ | 258 | {0x1002, 0x94A1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 259 | {0x1002, 0x94B1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \ | 259 | {0x1002, 0x94B1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \ |
| 260 | {0x1002, 0x94B3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \ | 260 | {0x1002, 0x94B3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \ |
| 261 | {0x1002, 0x94B5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \ | 261 | {0x1002, 0x94B5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \ |
| @@ -273,8 +273,8 @@ | |||
| 273 | {0x1002, 0x9456, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ | 273 | {0x1002, 0x9456, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ |
| 274 | {0x1002, 0x945A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 274 | {0x1002, 0x945A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 275 | {0x1002, 0x945B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 275 | {0x1002, 0x945B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 276 | {0x1002, 0x9460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 276 | {0x1002, 0x9460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ |
| 277 | {0x1002, 0x9462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 277 | {0x1002, 0x9462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ |
| 278 | {0x1002, 0x946A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 278 | {0x1002, 0x946A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 279 | {0x1002, 0x946B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 279 | {0x1002, 0x946B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 280 | {0x1002, 0x947A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 280 | {0x1002, 0x947A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h index fe3e3a4b4aed..41862e9a4c20 100644 --- a/include/drm/radeon_drm.h +++ b/include/drm/radeon_drm.h | |||
| @@ -496,6 +496,16 @@ typedef struct { | |||
| 496 | #define DRM_RADEON_SETPARAM 0x19 | 496 | #define DRM_RADEON_SETPARAM 0x19 |
| 497 | #define DRM_RADEON_SURF_ALLOC 0x1a | 497 | #define DRM_RADEON_SURF_ALLOC 0x1a |
| 498 | #define DRM_RADEON_SURF_FREE 0x1b | 498 | #define DRM_RADEON_SURF_FREE 0x1b |
| 499 | /* KMS ioctl */ | ||
| 500 | #define DRM_RADEON_GEM_INFO 0x1c | ||
| 501 | #define DRM_RADEON_GEM_CREATE 0x1d | ||
| 502 | #define DRM_RADEON_GEM_MMAP 0x1e | ||
| 503 | #define DRM_RADEON_GEM_PREAD 0x21 | ||
| 504 | #define DRM_RADEON_GEM_PWRITE 0x22 | ||
| 505 | #define DRM_RADEON_GEM_SET_DOMAIN 0x23 | ||
| 506 | #define DRM_RADEON_GEM_WAIT_IDLE 0x24 | ||
| 507 | #define DRM_RADEON_CS 0x26 | ||
| 508 | #define DRM_RADEON_INFO 0x27 | ||
| 499 | 509 | ||
| 500 | #define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) | 510 | #define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) |
| 501 | #define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) | 511 | #define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) |
| @@ -524,6 +534,17 @@ typedef struct { | |||
| 524 | #define DRM_IOCTL_RADEON_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t) | 534 | #define DRM_IOCTL_RADEON_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t) |
| 525 | #define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t) | 535 | #define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t) |
| 526 | #define DRM_IOCTL_RADEON_SURF_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t) | 536 | #define DRM_IOCTL_RADEON_SURF_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t) |
| 537 | /* KMS */ | ||
| 538 | #define DRM_IOCTL_RADEON_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_INFO, struct drm_radeon_gem_info) | ||
| 539 | #define DRM_IOCTL_RADEON_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_CREATE, struct drm_radeon_gem_create) | ||
| 540 | #define DRM_IOCTL_RADEON_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_MMAP, struct drm_radeon_gem_mmap) | ||
| 541 | #define DRM_IOCTL_RADEON_GEM_PREAD DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PREAD, struct drm_radeon_gem_pread) | ||
| 542 | #define DRM_IOCTL_RADEON_GEM_PWRITE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PWRITE, struct drm_radeon_gem_pwrite) | ||
| 543 | #define DRM_IOCTL_RADEON_GEM_SET_DOMAIN DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_DOMAIN, struct drm_radeon_gem_set_domain) | ||
| 544 | #define DRM_IOCTL_RADEON_GEM_WAIT_IDLE DRM_IOW(DRM_COMMAND_BASE + DRM_RADEON_GEM_WAIT_IDLE, struct drm_radeon_gem_wait_idle) | ||
| 545 | #define DRM_IOCTL_RADEON_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_CS, struct drm_radeon_cs) | ||
| 546 | #define DRM_IOCTL_RADEON_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INFO, struct drm_radeon_info) | ||
| 547 | |||
| 527 | 548 | ||
| 528 | typedef struct drm_radeon_init { | 549 | typedef struct drm_radeon_init { |
| 529 | enum { | 550 | enum { |
| @@ -682,6 +703,7 @@ typedef struct drm_radeon_indirect { | |||
| 682 | #define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */ | 703 | #define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */ |
| 683 | #define RADEON_PARAM_FB_LOCATION 14 /* FB location */ | 704 | #define RADEON_PARAM_FB_LOCATION 14 /* FB location */ |
| 684 | #define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */ | 705 | #define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */ |
| 706 | #define RADEON_PARAM_DEVICE_ID 16 | ||
| 685 | 707 | ||
| 686 | typedef struct drm_radeon_getparam { | 708 | typedef struct drm_radeon_getparam { |
| 687 | int param; | 709 | int param; |
| @@ -751,4 +773,112 @@ typedef struct drm_radeon_surface_free { | |||
| 751 | #define DRM_RADEON_VBLANK_CRTC1 1 | 773 | #define DRM_RADEON_VBLANK_CRTC1 1 |
| 752 | #define DRM_RADEON_VBLANK_CRTC2 2 | 774 | #define DRM_RADEON_VBLANK_CRTC2 2 |
| 753 | 775 | ||
| 776 | /* | ||
| 777 | * Kernel modesetting world below. | ||
| 778 | */ | ||
| 779 | #define RADEON_GEM_DOMAIN_CPU 0x1 | ||
| 780 | #define RADEON_GEM_DOMAIN_GTT 0x2 | ||
| 781 | #define RADEON_GEM_DOMAIN_VRAM 0x4 | ||
| 782 | |||
| 783 | struct drm_radeon_gem_info { | ||
| 784 | uint64_t gart_size; | ||
| 785 | uint64_t vram_size; | ||
| 786 | uint64_t vram_visible; | ||
| 787 | }; | ||
| 788 | |||
| 789 | #define RADEON_GEM_NO_BACKING_STORE 1 | ||
| 790 | |||
| 791 | struct drm_radeon_gem_create { | ||
| 792 | uint64_t size; | ||
| 793 | uint64_t alignment; | ||
| 794 | uint32_t handle; | ||
| 795 | uint32_t initial_domain; | ||
| 796 | uint32_t flags; | ||
| 797 | }; | ||
| 798 | |||
| 799 | struct drm_radeon_gem_mmap { | ||
| 800 | uint32_t handle; | ||
| 801 | uint32_t pad; | ||
| 802 | uint64_t offset; | ||
| 803 | uint64_t size; | ||
| 804 | uint64_t addr_ptr; | ||
| 805 | }; | ||
| 806 | |||
| 807 | struct drm_radeon_gem_set_domain { | ||
| 808 | uint32_t handle; | ||
| 809 | uint32_t read_domains; | ||
| 810 | uint32_t write_domain; | ||
| 811 | }; | ||
| 812 | |||
| 813 | struct drm_radeon_gem_wait_idle { | ||
| 814 | uint32_t handle; | ||
| 815 | uint32_t pad; | ||
| 816 | }; | ||
| 817 | |||
| 818 | struct drm_radeon_gem_busy { | ||
| 819 | uint32_t handle; | ||
| 820 | uint32_t busy; | ||
| 821 | }; | ||
| 822 | |||
| 823 | struct drm_radeon_gem_pread { | ||
| 824 | /** Handle for the object being read. */ | ||
| 825 | uint32_t handle; | ||
| 826 | uint32_t pad; | ||
| 827 | /** Offset into the object to read from */ | ||
| 828 | uint64_t offset; | ||
| 829 | /** Length of data to read */ | ||
| 830 | uint64_t size; | ||
| 831 | /** Pointer to write the data into. */ | ||
| 832 | /* void *, but pointers are not 32/64 compatible */ | ||
| 833 | uint64_t data_ptr; | ||
| 834 | }; | ||
| 835 | |||
| 836 | struct drm_radeon_gem_pwrite { | ||
| 837 | /** Handle for the object being written to. */ | ||
| 838 | uint32_t handle; | ||
| 839 | uint32_t pad; | ||
| 840 | /** Offset into the object to write to */ | ||
| 841 | uint64_t offset; | ||
| 842 | /** Length of data to write */ | ||
| 843 | uint64_t size; | ||
| 844 | /** Pointer to read the data from. */ | ||
| 845 | /* void *, but pointers are not 32/64 compatible */ | ||
| 846 | uint64_t data_ptr; | ||
| 847 | }; | ||
| 848 | |||
| 849 | #define RADEON_CHUNK_ID_RELOCS 0x01 | ||
| 850 | #define RADEON_CHUNK_ID_IB 0x02 | ||
| 851 | |||
| 852 | struct drm_radeon_cs_chunk { | ||
| 853 | uint32_t chunk_id; | ||
| 854 | uint32_t length_dw; | ||
| 855 | uint64_t chunk_data; | ||
| 856 | }; | ||
| 857 | |||
| 858 | struct drm_radeon_cs_reloc { | ||
| 859 | uint32_t handle; | ||
| 860 | uint32_t read_domains; | ||
| 861 | uint32_t write_domain; | ||
| 862 | uint32_t flags; | ||
| 863 | }; | ||
| 864 | |||
| 865 | struct drm_radeon_cs { | ||
| 866 | uint32_t num_chunks; | ||
| 867 | uint32_t cs_id; | ||
| 868 | /* this points to uint64_t * which point to cs chunks */ | ||
| 869 | uint64_t chunks; | ||
| 870 | /* updates to the limits after this CS ioctl */ | ||
| 871 | uint64_t gart_limit; | ||
| 872 | uint64_t vram_limit; | ||
| 873 | }; | ||
| 874 | |||
| 875 | #define RADEON_INFO_DEVICE_ID 0x00 | ||
| 876 | #define RADEON_INFO_NUM_GB_PIPES 0x01 | ||
| 877 | |||
| 878 | struct drm_radeon_info { | ||
| 879 | uint32_t request; | ||
| 880 | uint32_t pad; | ||
| 881 | uint64_t value; | ||
| 882 | }; | ||
| 883 | |||
| 754 | #endif | 884 | #endif |
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h new file mode 100644 index 000000000000..cd22ab4b495c --- /dev/null +++ b/include/drm/ttm/ttm_bo_api.h | |||
| @@ -0,0 +1,618 @@ | |||
| 1 | /************************************************************************** | ||
| 2 | * | ||
| 3 | * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA | ||
| 4 | * All Rights Reserved. | ||
| 5 | * | ||
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 7 | * copy of this software and associated documentation files (the | ||
| 8 | * "Software"), to deal in the Software without restriction, including | ||
| 9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
| 10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
| 11 | * permit persons to whom the Software is furnished to do so, subject to | ||
| 12 | * the following conditions: | ||
| 13 | * | ||
| 14 | * The above copyright notice and this permission notice (including the | ||
| 15 | * next paragraph) shall be included in all copies or substantial portions | ||
| 16 | * of the Software. | ||
| 17 | * | ||
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
| 21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
| 22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
| 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
| 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 25 | * | ||
| 26 | **************************************************************************/ | ||
| 27 | /* | ||
| 28 | * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> | ||
| 29 | */ | ||
| 30 | |||
| 31 | #ifndef _TTM_BO_API_H_ | ||
| 32 | #define _TTM_BO_API_H_ | ||
| 33 | |||
| 34 | #include "drm_hashtab.h" | ||
| 35 | #include <linux/kref.h> | ||
| 36 | #include <linux/list.h> | ||
| 37 | #include <linux/wait.h> | ||
| 38 | #include <linux/mutex.h> | ||
| 39 | #include <linux/mm.h> | ||
| 40 | #include <linux/rbtree.h> | ||
| 41 | #include <linux/bitmap.h> | ||
| 42 | |||
| 43 | struct ttm_bo_device; | ||
| 44 | |||
| 45 | struct drm_mm_node; | ||
| 46 | |||
| 47 | /** | ||
| 48 | * struct ttm_mem_reg | ||
| 49 | * | ||
| 50 | * @mm_node: Memory manager node. | ||
| 51 | * @size: Requested size of memory region. | ||
| 52 | * @num_pages: Actual size of memory region in pages. | ||
| 53 | * @page_alignment: Page alignment. | ||
| 54 | * @placement: Placement flags. | ||
| 55 | * | ||
| 56 | * Structure indicating the placement and space resources used by a | ||
| 57 | * buffer object. | ||
| 58 | */ | ||
| 59 | |||
| 60 | struct ttm_mem_reg { | ||
| 61 | struct drm_mm_node *mm_node; | ||
| 62 | unsigned long size; | ||
| 63 | unsigned long num_pages; | ||
| 64 | uint32_t page_alignment; | ||
| 65 | uint32_t mem_type; | ||
| 66 | uint32_t placement; | ||
| 67 | }; | ||
| 68 | |||
| 69 | /** | ||
| 70 | * enum ttm_bo_type | ||
| 71 | * | ||
| 72 | * @ttm_bo_type_device: These are 'normal' buffers that can | ||
| 73 | * be mmapped by user space. Each of these bos occupy a slot in the | ||
| 74 | * device address space, that can be used for normal vm operations. | ||
| 75 | * | ||
| 76 | * @ttm_bo_type_user: These are user-space memory areas that are made | ||
| 77 | * available to the GPU by mapping the buffer pages into the GPU aperture | ||
| 78 | * space. These buffers cannot be mmaped from the device address space. | ||
| 79 | * | ||
| 80 | * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers, | ||
| 81 | * but they cannot be accessed from user-space. For kernel-only use. | ||
| 82 | */ | ||
| 83 | |||
| 84 | enum ttm_bo_type { | ||
| 85 | ttm_bo_type_device, | ||
| 86 | ttm_bo_type_user, | ||
| 87 | ttm_bo_type_kernel | ||
| 88 | }; | ||
| 89 | |||
| 90 | struct ttm_tt; | ||
| 91 | |||
| 92 | /** | ||
| 93 | * struct ttm_buffer_object | ||
| 94 | * | ||
| 95 | * @bdev: Pointer to the buffer object device structure. | ||
| 96 | * @buffer_start: The virtual user-space start address of ttm_bo_type_user | ||
| 97 | * buffers. | ||
| 98 | * @type: The bo type. | ||
| 99 | * @destroy: Destruction function. If NULL, kfree is used. | ||
| 100 | * @num_pages: Actual number of pages. | ||
| 101 | * @addr_space_offset: Address space offset. | ||
| 102 | * @acc_size: Accounted size for this object. | ||
| 103 | * @kref: Reference count of this buffer object. When this refcount reaches | ||
| 104 | * zero, the object is put on the delayed delete list. | ||
| 105 | * @list_kref: List reference count of this buffer object. This member is | ||
| 106 | * used to avoid destruction while the buffer object is still on a list. | ||
| 107 | * Lru lists may keep one refcount, the delayed delete list, and kref != 0 | ||
| 108 | * keeps one refcount. When this refcount reaches zero, | ||
| 109 | * the object is destroyed. | ||
| 110 | * @event_queue: Queue for processes waiting on buffer object status change. | ||
| 111 | * @lock: spinlock protecting mostly synchronization members. | ||
| 112 | * @proposed_placement: Proposed placement for the buffer. Changed only by the | ||
| 113 | * creator prior to validation as opposed to bo->mem.proposed_flags which is | ||
| 114 | * changed by the implementation prior to a buffer move if it wants to outsmart | ||
| 115 | * the buffer creator / user. This latter happens, for example, at eviction. | ||
| 116 | * @mem: structure describing current placement. | ||
| 117 | * @persistant_swap_storage: Usually the swap storage is deleted for buffers | ||
| 118 | * pinned in physical memory. If this behaviour is not desired, this member | ||
| 119 | * holds a pointer to a persistant shmem object. | ||
| 120 | * @ttm: TTM structure holding system pages. | ||
| 121 | * @evicted: Whether the object was evicted without user-space knowing. | ||
| 122 | * @cpu_writes: For synchronization. Number of cpu writers. | ||
| 123 | * @lru: List head for the lru list. | ||
| 124 | * @ddestroy: List head for the delayed destroy list. | ||
| 125 | * @swap: List head for swap LRU list. | ||
| 126 | * @val_seq: Sequence of the validation holding the @reserved lock. | ||
| 127 | * Used to avoid starvation when many processes compete to validate the | ||
| 128 | * buffer. This member is protected by the bo_device::lru_lock. | ||
| 129 | * @seq_valid: The value of @val_seq is valid. This value is protected by | ||
| 130 | * the bo_device::lru_lock. | ||
| 131 | * @reserved: Deadlock-free lock used for synchronization state transitions. | ||
| 132 | * @sync_obj_arg: Opaque argument to synchronization object function. | ||
| 133 | * @sync_obj: Pointer to a synchronization object. | ||
| 134 | * @priv_flags: Flags describing buffer object internal state. | ||
| 135 | * @vm_rb: Rb node for the vm rb tree. | ||
| 136 | * @vm_node: Address space manager node. | ||
| 137 | * @offset: The current GPU offset, which can have different meanings | ||
| 138 | * depending on the memory type. For SYSTEM type memory, it should be 0. | ||
| 139 | * @cur_placement: Hint of current placement. | ||
| 140 | * | ||
| 141 | * Base class for TTM buffer object, that deals with data placement and CPU | ||
| 142 | * mappings. GPU mappings are really up to the driver, but for simpler GPUs | ||
| 143 | * the driver can usually use the placement offset @offset directly as the | ||
| 144 | * GPU virtual address. For drivers implementing multiple | ||
| 145 | * GPU memory manager contexts, the driver should manage the address space | ||
| 146 | * in these contexts separately and use these objects to get the correct | ||
| 147 | * placement and caching for these GPU maps. This makes it possible to use | ||
| 148 | * these objects for even quite elaborate memory management schemes. | ||
| 149 | * The destroy member, the API visibility of this object makes it possible | ||
| 150 | * to derive driver specific types. | ||
| 151 | */ | ||
| 152 | |||
| 153 | struct ttm_buffer_object { | ||
| 154 | /** | ||
| 155 | * Members constant at init. | ||
| 156 | */ | ||
| 157 | |||
| 158 | struct ttm_bo_device *bdev; | ||
| 159 | unsigned long buffer_start; | ||
| 160 | enum ttm_bo_type type; | ||
| 161 | void (*destroy) (struct ttm_buffer_object *); | ||
| 162 | unsigned long num_pages; | ||
| 163 | uint64_t addr_space_offset; | ||
| 164 | size_t acc_size; | ||
| 165 | |||
| 166 | /** | ||
| 167 | * Members not needing protection. | ||
| 168 | */ | ||
| 169 | |||
| 170 | struct kref kref; | ||
| 171 | struct kref list_kref; | ||
| 172 | wait_queue_head_t event_queue; | ||
| 173 | spinlock_t lock; | ||
| 174 | |||
| 175 | /** | ||
| 176 | * Members protected by the bo::reserved lock. | ||
| 177 | */ | ||
| 178 | |||
| 179 | uint32_t proposed_placement; | ||
| 180 | struct ttm_mem_reg mem; | ||
| 181 | struct file *persistant_swap_storage; | ||
| 182 | struct ttm_tt *ttm; | ||
| 183 | bool evicted; | ||
| 184 | |||
| 185 | /** | ||
| 186 | * Members protected by the bo::reserved lock only when written to. | ||
| 187 | */ | ||
| 188 | |||
| 189 | atomic_t cpu_writers; | ||
| 190 | |||
| 191 | /** | ||
| 192 | * Members protected by the bdev::lru_lock. | ||
| 193 | */ | ||
| 194 | |||
| 195 | struct list_head lru; | ||
| 196 | struct list_head ddestroy; | ||
| 197 | struct list_head swap; | ||
| 198 | uint32_t val_seq; | ||
| 199 | bool seq_valid; | ||
| 200 | |||
| 201 | /** | ||
| 202 | * Members protected by the bdev::lru_lock | ||
| 203 | * only when written to. | ||
| 204 | */ | ||
| 205 | |||
| 206 | atomic_t reserved; | ||
| 207 | |||
| 208 | |||
| 209 | /** | ||
| 210 | * Members protected by the bo::lock | ||
| 211 | */ | ||
| 212 | |||
| 213 | void *sync_obj_arg; | ||
| 214 | void *sync_obj; | ||
| 215 | unsigned long priv_flags; | ||
| 216 | |||
| 217 | /** | ||
| 218 | * Members protected by the bdev::vm_lock | ||
| 219 | */ | ||
| 220 | |||
| 221 | struct rb_node vm_rb; | ||
| 222 | struct drm_mm_node *vm_node; | ||
| 223 | |||
| 224 | |||
| 225 | /** | ||
| 226 | * Special members that are protected by the reserve lock | ||
| 227 | * and the bo::lock when written to. Can be read with | ||
| 228 | * either of these locks held. | ||
| 229 | */ | ||
| 230 | |||
| 231 | unsigned long offset; | ||
| 232 | uint32_t cur_placement; | ||
| 233 | }; | ||
| 234 | |||
| 235 | /** | ||
| 236 | * struct ttm_bo_kmap_obj | ||
| 237 | * | ||
| 238 | * @virtual: The current kernel virtual address. | ||
| 239 | * @page: The page when kmap'ing a single page. | ||
| 240 | * @bo_kmap_type: Type of bo_kmap. | ||
| 241 | * | ||
| 242 | * Object describing a kernel mapping. Since a TTM bo may be located | ||
| 243 | * in various memory types with various caching policies, the | ||
| 244 | * mapping can either be an ioremap, a vmap, a kmap or part of a | ||
| 245 | * premapped region. | ||
| 246 | */ | ||
| 247 | |||
| 248 | struct ttm_bo_kmap_obj { | ||
| 249 | void *virtual; | ||
| 250 | struct page *page; | ||
| 251 | enum { | ||
| 252 | ttm_bo_map_iomap, | ||
| 253 | ttm_bo_map_vmap, | ||
| 254 | ttm_bo_map_kmap, | ||
| 255 | ttm_bo_map_premapped, | ||
| 256 | } bo_kmap_type; | ||
| 257 | }; | ||
| 258 | |||
| 259 | /** | ||
| 260 | * ttm_bo_reference - reference a struct ttm_buffer_object | ||
| 261 | * | ||
| 262 | * @bo: The buffer object. | ||
| 263 | * | ||
| 264 | * Returns a refcounted pointer to a buffer object. | ||
| 265 | */ | ||
| 266 | |||
| 267 | static inline struct ttm_buffer_object * | ||
| 268 | ttm_bo_reference(struct ttm_buffer_object *bo) | ||
| 269 | { | ||
| 270 | kref_get(&bo->kref); | ||
| 271 | return bo; | ||
| 272 | } | ||
| 273 | |||
| 274 | /** | ||
| 275 | * ttm_bo_wait - wait for buffer idle. | ||
| 276 | * | ||
| 277 | * @bo: The buffer object. | ||
| 278 | * @interruptible: Use interruptible wait. | ||
| 279 | * @no_wait: Return immediately if buffer is busy. | ||
| 280 | * | ||
| 281 | * This function must be called with the bo::mutex held, and makes | ||
| 282 | * sure any previous rendering to the buffer is completed. | ||
| 283 | * Note: It might be necessary to block validations before the | ||
| 284 | * wait by reserving the buffer. | ||
| 285 | * Returns -EBUSY if no_wait is true and the buffer is busy. | ||
| 286 | * Returns -ERESTART if interrupted by a signal. | ||
| 287 | */ | ||
| 288 | extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy, | ||
| 289 | bool interruptible, bool no_wait); | ||
| 290 | /** | ||
| 291 | * ttm_buffer_object_validate | ||
| 292 | * | ||
| 293 | * @bo: The buffer object. | ||
| 294 | * @proposed_placement: Proposed_placement for the buffer object. | ||
| 295 | * @interruptible: Sleep interruptible if sleeping. | ||
| 296 | * @no_wait: Return immediately if the buffer is busy. | ||
| 297 | * | ||
| 298 | * Changes placement and caching policy of the buffer object | ||
| 299 | * according to bo::proposed_flags. | ||
| 300 | * Returns | ||
| 301 | * -EINVAL on invalid proposed_flags. | ||
| 302 | * -ENOMEM on out-of-memory condition. | ||
| 303 | * -EBUSY if no_wait is true and buffer busy. | ||
| 304 | * -ERESTART if interrupted by a signal. | ||
| 305 | */ | ||
| 306 | extern int ttm_buffer_object_validate(struct ttm_buffer_object *bo, | ||
| 307 | uint32_t proposed_placement, | ||
| 308 | bool interruptible, bool no_wait); | ||
| 309 | /** | ||
| 310 | * ttm_bo_unref | ||
| 311 | * | ||
| 312 | * @bo: The buffer object. | ||
| 313 | * | ||
| 314 | * Unreference and clear a pointer to a buffer object. | ||
| 315 | */ | ||
| 316 | extern void ttm_bo_unref(struct ttm_buffer_object **bo); | ||
| 317 | |||
| 318 | /** | ||
| 319 | * ttm_bo_synccpu_write_grab | ||
| 320 | * | ||
| 321 | * @bo: The buffer object: | ||
| 322 | * @no_wait: Return immediately if buffer is busy. | ||
| 323 | * | ||
| 324 | * Synchronizes a buffer object for CPU RW access. This means | ||
| 325 | * blocking command submission that affects the buffer and | ||
| 326 | * waiting for buffer idle. This lock is recursive. | ||
| 327 | * Returns | ||
| 328 | * -EBUSY if the buffer is busy and no_wait is true. | ||
| 329 | * -ERESTART if interrupted by a signal. | ||
| 330 | */ | ||
| 331 | |||
| 332 | extern int | ||
| 333 | ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait); | ||
| 334 | /** | ||
| 335 | * ttm_bo_synccpu_write_release: | ||
| 336 | * | ||
| 337 | * @bo : The buffer object. | ||
| 338 | * | ||
| 339 | * Releases a synccpu lock. | ||
| 340 | */ | ||
| 341 | extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo); | ||
| 342 | |||
| 343 | /** | ||
| 344 | * ttm_buffer_object_init | ||
| 345 | * | ||
| 346 | * @bdev: Pointer to a ttm_bo_device struct. | ||
| 347 | * @bo: Pointer to a ttm_buffer_object to be initialized. | ||
| 348 | * @size: Requested size of buffer object. | ||
| 349 | * @type: Requested type of buffer object. | ||
| 350 | * @flags: Initial placement flags. | ||
| 351 | * @page_alignment: Data alignment in pages. | ||
| 352 | * @buffer_start: Virtual address of user space data backing a | ||
| 353 | * user buffer object. | ||
| 354 | * @interruptible: If needing to sleep to wait for GPU resources, | ||
| 355 | * sleep interruptible. | ||
| 356 | * @persistant_swap_storage: Usually the swap storage is deleted for buffers | ||
| 357 | * pinned in physical memory. If this behaviour is not desired, this member | ||
| 358 | * holds a pointer to a persistant shmem object. Typically, this would | ||
| 359 | * point to the shmem object backing a GEM object if TTM is used to back a | ||
| 360 | * GEM user interface. | ||
| 361 | * @acc_size: Accounted size for this object. | ||
| 362 | * @destroy: Destroy function. Use NULL for kfree(). | ||
| 363 | * | ||
| 364 | * This function initializes a pre-allocated struct ttm_buffer_object. | ||
| 365 | * As this object may be part of a larger structure, this function, | ||
| 366 | * together with the @destroy function, | ||
| 367 | * enables driver-specific objects derived from a ttm_buffer_object. | ||
| 368 | * On successful return, the object kref and list_kref are set to 1. | ||
| 369 | * Returns | ||
| 370 | * -ENOMEM: Out of memory. | ||
| 371 | * -EINVAL: Invalid placement flags. | ||
| 372 | * -ERESTART: Interrupted by signal while sleeping waiting for resources. | ||
| 373 | */ | ||
| 374 | |||
| 375 | extern int ttm_buffer_object_init(struct ttm_bo_device *bdev, | ||
| 376 | struct ttm_buffer_object *bo, | ||
| 377 | unsigned long size, | ||
| 378 | enum ttm_bo_type type, | ||
| 379 | uint32_t flags, | ||
| 380 | uint32_t page_alignment, | ||
| 381 | unsigned long buffer_start, | ||
| 382 | bool interrubtible, | ||
| 383 | struct file *persistant_swap_storage, | ||
| 384 | size_t acc_size, | ||
| 385 | void (*destroy) (struct ttm_buffer_object *)); | ||
| 386 | /** | ||
| 387 | * ttm_bo_synccpu_object_init | ||
| 388 | * | ||
| 389 | * @bdev: Pointer to a ttm_bo_device struct. | ||
| 390 | * @bo: Pointer to a ttm_buffer_object to be initialized. | ||
| 391 | * @size: Requested size of buffer object. | ||
| 392 | * @type: Requested type of buffer object. | ||
| 393 | * @flags: Initial placement flags. | ||
| 394 | * @page_alignment: Data alignment in pages. | ||
| 395 | * @buffer_start: Virtual address of user space data backing a | ||
| 396 | * user buffer object. | ||
| 397 | * @interruptible: If needing to sleep while waiting for GPU resources, | ||
| 398 | * sleep interruptible. | ||
| 399 | * @persistant_swap_storage: Usually the swap storage is deleted for buffers | ||
| 400 | * pinned in physical memory. If this behaviour is not desired, this member | ||
| 401 | * holds a pointer to a persistant shmem object. Typically, this would | ||
| 402 | * point to the shmem object backing a GEM object if TTM is used to back a | ||
| 403 | * GEM user interface. | ||
| 404 | * @p_bo: On successful completion *p_bo points to the created object. | ||
| 405 | * | ||
| 406 | * This function allocates a ttm_buffer_object, and then calls | ||
| 407 | * ttm_buffer_object_init on that object. | ||
| 408 | * The destroy function is set to kfree(). | ||
| 409 | * Returns | ||
| 410 | * -ENOMEM: Out of memory. | ||
| 411 | * -EINVAL: Invalid placement flags. | ||
| 412 | * -ERESTART: Interrupted by signal while waiting for resources. | ||
| 413 | */ | ||
| 414 | |||
| 415 | extern int ttm_buffer_object_create(struct ttm_bo_device *bdev, | ||
| 416 | unsigned long size, | ||
| 417 | enum ttm_bo_type type, | ||
| 418 | uint32_t flags, | ||
| 419 | uint32_t page_alignment, | ||
| 420 | unsigned long buffer_start, | ||
| 421 | bool interruptible, | ||
| 422 | struct file *persistant_swap_storage, | ||
| 423 | struct ttm_buffer_object **p_bo); | ||
| 424 | |||
| 425 | /** | ||
| 426 | * ttm_bo_check_placement | ||
| 427 | * | ||
| 428 | * @bo: the buffer object. | ||
| 429 | * @set_flags: placement flags to set. | ||
| 430 | * @clr_flags: placement flags to clear. | ||
| 431 | * | ||
| 432 | * Performs minimal validity checking on an intended change of | ||
| 433 | * placement flags. | ||
| 434 | * Returns | ||
| 435 | * -EINVAL: Intended change is invalid or not allowed. | ||
| 436 | */ | ||
| 437 | |||
| 438 | extern int ttm_bo_check_placement(struct ttm_buffer_object *bo, | ||
| 439 | uint32_t set_flags, uint32_t clr_flags); | ||
| 440 | |||
| 441 | /** | ||
| 442 | * ttm_bo_init_mm | ||
| 443 | * | ||
| 444 | * @bdev: Pointer to a ttm_bo_device struct. | ||
| 445 | * @mem_type: The memory type. | ||
| 446 | * @p_offset: offset for managed area in pages. | ||
| 447 | * @p_size: size managed area in pages. | ||
| 448 | * | ||
| 449 | * Initialize a manager for a given memory type. | ||
| 450 | * Note: if part of driver firstopen, it must be protected from a | ||
| 451 | * potentially racing lastclose. | ||
| 452 | * Returns: | ||
| 453 | * -EINVAL: invalid size or memory type. | ||
| 454 | * -ENOMEM: Not enough memory. | ||
| 455 | * May also return driver-specified errors. | ||
| 456 | */ | ||
| 457 | |||
| 458 | extern int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type, | ||
| 459 | unsigned long p_offset, unsigned long p_size); | ||
| 460 | /** | ||
| 461 | * ttm_bo_clean_mm | ||
| 462 | * | ||
| 463 | * @bdev: Pointer to a ttm_bo_device struct. | ||
| 464 | * @mem_type: The memory type. | ||
| 465 | * | ||
| 466 | * Take down a manager for a given memory type after first walking | ||
| 467 | * the LRU list to evict any buffers left alive. | ||
| 468 | * | ||
| 469 | * Normally, this function is part of lastclose() or unload(), and at that | ||
| 470 | * point there shouldn't be any buffers left created by user-space, since | ||
| 471 | * there should've been removed by the file descriptor release() method. | ||
| 472 | * However, before this function is run, make sure to signal all sync objects, | ||
| 473 | * and verify that the delayed delete queue is empty. The driver must also | ||
| 474 | * make sure that there are no NO_EVICT buffers present in this memory type | ||
| 475 | * when the call is made. | ||
| 476 | * | ||
| 477 | * If this function is part of a VT switch, the caller must make sure that | ||
| 478 | * there are no appications currently validating buffers before this | ||
| 479 | * function is called. The caller can do that by first taking the | ||
| 480 | * struct ttm_bo_device::ttm_lock in write mode. | ||
| 481 | * | ||
| 482 | * Returns: | ||
| 483 | * -EINVAL: invalid or uninitialized memory type. | ||
| 484 | * -EBUSY: There are still buffers left in this memory type. | ||
| 485 | */ | ||
| 486 | |||
| 487 | extern int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type); | ||
| 488 | |||
| 489 | /** | ||
| 490 | * ttm_bo_evict_mm | ||
| 491 | * | ||
| 492 | * @bdev: Pointer to a ttm_bo_device struct. | ||
| 493 | * @mem_type: The memory type. | ||
| 494 | * | ||
| 495 | * Evicts all buffers on the lru list of the memory type. | ||
| 496 | * This is normally part of a VT switch or an | ||
| 497 | * out-of-memory-space-due-to-fragmentation handler. | ||
| 498 | * The caller must make sure that there are no other processes | ||
| 499 | * currently validating buffers, and can do that by taking the | ||
| 500 | * struct ttm_bo_device::ttm_lock in write mode. | ||
| 501 | * | ||
| 502 | * Returns: | ||
| 503 | * -EINVAL: Invalid or uninitialized memory type. | ||
| 504 | * -ERESTART: The call was interrupted by a signal while waiting to | ||
| 505 | * evict a buffer. | ||
| 506 | */ | ||
| 507 | |||
| 508 | extern int ttm_bo_evict_mm(struct ttm_bo_device *bdev, unsigned mem_type); | ||
| 509 | |||
| 510 | /** | ||
| 511 | * ttm_kmap_obj_virtual | ||
| 512 | * | ||
| 513 | * @map: A struct ttm_bo_kmap_obj returned from ttm_bo_kmap. | ||
| 514 | * @is_iomem: Pointer to an integer that on return indicates 1 if the | ||
| 515 | * virtual map is io memory, 0 if normal memory. | ||
| 516 | * | ||
| 517 | * Returns the virtual address of a buffer object area mapped by ttm_bo_kmap. | ||
| 518 | * If *is_iomem is 1 on return, the virtual address points to an io memory area, | ||
| 519 | * that should strictly be accessed by the iowriteXX() and similar functions. | ||
| 520 | */ | ||
| 521 | |||
| 522 | static inline void *ttm_kmap_obj_virtual(struct ttm_bo_kmap_obj *map, | ||
| 523 | bool *is_iomem) | ||
| 524 | { | ||
| 525 | *is_iomem = (map->bo_kmap_type == ttm_bo_map_iomap || | ||
| 526 | map->bo_kmap_type == ttm_bo_map_premapped); | ||
| 527 | return map->virtual; | ||
| 528 | } | ||
| 529 | |||
| 530 | /** | ||
| 531 | * ttm_bo_kmap | ||
| 532 | * | ||
| 533 | * @bo: The buffer object. | ||
| 534 | * @start_page: The first page to map. | ||
| 535 | * @num_pages: Number of pages to map. | ||
| 536 | * @map: pointer to a struct ttm_bo_kmap_obj representing the map. | ||
| 537 | * | ||
| 538 | * Sets up a kernel virtual mapping, using ioremap, vmap or kmap to the | ||
| 539 | * data in the buffer object. The ttm_kmap_obj_virtual function can then be | ||
| 540 | * used to obtain a virtual address to the data. | ||
| 541 | * | ||
| 542 | * Returns | ||
| 543 | * -ENOMEM: Out of memory. | ||
| 544 | * -EINVAL: Invalid range. | ||
| 545 | */ | ||
| 546 | |||
| 547 | extern int ttm_bo_kmap(struct ttm_buffer_object *bo, unsigned long start_page, | ||
| 548 | unsigned long num_pages, struct ttm_bo_kmap_obj *map); | ||
| 549 | |||
| 550 | /** | ||
| 551 | * ttm_bo_kunmap | ||
| 552 | * | ||
| 553 | * @map: Object describing the map to unmap. | ||
| 554 | * | ||
| 555 | * Unmaps a kernel map set up by ttm_bo_kmap. | ||
| 556 | */ | ||
| 557 | |||
| 558 | extern void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map); | ||
| 559 | |||
| 560 | #if 0 | ||
| 561 | #endif | ||
| 562 | |||
| 563 | /** | ||
| 564 | * ttm_fbdev_mmap - mmap fbdev memory backed by a ttm buffer object. | ||
| 565 | * | ||
| 566 | * @vma: vma as input from the fbdev mmap method. | ||
| 567 | * @bo: The bo backing the address space. The address space will | ||
| 568 | * have the same size as the bo, and start at offset 0. | ||
| 569 | * | ||
| 570 | * This function is intended to be called by the fbdev mmap method | ||
| 571 | * if the fbdev address space is to be backed by a bo. | ||
| 572 | */ | ||
| 573 | |||
| 574 | extern int ttm_fbdev_mmap(struct vm_area_struct *vma, | ||
| 575 | struct ttm_buffer_object *bo); | ||
| 576 | |||
| 577 | /** | ||
| 578 | * ttm_bo_mmap - mmap out of the ttm device address space. | ||
| 579 | * | ||
| 580 | * @filp: filp as input from the mmap method. | ||
| 581 | * @vma: vma as input from the mmap method. | ||
| 582 | * @bdev: Pointer to the ttm_bo_device with the address space manager. | ||
| 583 | * | ||
| 584 | * This function is intended to be called by the device mmap method. | ||
| 585 | * if the device address space is to be backed by the bo manager. | ||
| 586 | */ | ||
| 587 | |||
| 588 | extern int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma, | ||
| 589 | struct ttm_bo_device *bdev); | ||
| 590 | |||
| 591 | /** | ||
| 592 | * ttm_bo_io | ||
| 593 | * | ||
| 594 | * @bdev: Pointer to the struct ttm_bo_device. | ||
| 595 | * @filp: Pointer to the struct file attempting to read / write. | ||
| 596 | * @wbuf: User-space pointer to address of buffer to write. NULL on read. | ||
| 597 | * @rbuf: User-space pointer to address of buffer to read into. | ||
| 598 | * Null on write. | ||
| 599 | * @count: Number of bytes to read / write. | ||
| 600 | * @f_pos: Pointer to current file position. | ||
| 601 | * @write: 1 for read, 0 for write. | ||
| 602 | * | ||
| 603 | * This function implements read / write into ttm buffer objects, and is | ||
| 604 | * intended to | ||
| 605 | * be called from the fops::read and fops::write method. | ||
| 606 | * Returns: | ||
| 607 | * See man (2) write, man(2) read. In particular, | ||
| 608 | * the function may return -EINTR if | ||
| 609 | * interrupted by a signal. | ||
| 610 | */ | ||
| 611 | |||
| 612 | extern ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp, | ||
| 613 | const char __user *wbuf, char __user *rbuf, | ||
| 614 | size_t count, loff_t *f_pos, bool write); | ||
| 615 | |||
| 616 | extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev); | ||
| 617 | |||
| 618 | #endif | ||
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h new file mode 100644 index 000000000000..62ed733c52a2 --- /dev/null +++ b/include/drm/ttm/ttm_bo_driver.h | |||
| @@ -0,0 +1,867 @@ | |||
| 1 | /************************************************************************** | ||
| 2 | * | ||
| 3 | * Copyright (c) 2006-2009 Vmware, Inc., Palo Alto, CA., USA | ||
| 4 | * All Rights Reserved. | ||
| 5 | * | ||
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 7 | * copy of this software and associated documentation files (the | ||
| 8 | * "Software"), to deal in the Software without restriction, including | ||
| 9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
| 10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
| 11 | * permit persons to whom the Software is furnished to do so, subject to | ||
| 12 | * the following conditions: | ||
| 13 | * | ||
| 14 | * The above copyright notice and this permission notice (including the | ||
| 15 | * next paragraph) shall be included in all copies or substantial portions | ||
| 16 | * of the Software. | ||
| 17 | * | ||
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
| 21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
| 22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
| 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
| 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 25 | * | ||
| 26 | **************************************************************************/ | ||
| 27 | /* | ||
| 28 | * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> | ||
| 29 | */ | ||
| 30 | #ifndef _TTM_BO_DRIVER_H_ | ||
| 31 | #define _TTM_BO_DRIVER_H_ | ||
| 32 | |||
| 33 | #include "ttm/ttm_bo_api.h" | ||
| 34 | #include "ttm/ttm_memory.h" | ||
| 35 | #include "drm_mm.h" | ||
| 36 | #include "linux/workqueue.h" | ||
| 37 | #include "linux/fs.h" | ||
| 38 | #include "linux/spinlock.h" | ||
| 39 | |||
| 40 | struct ttm_backend; | ||
| 41 | |||
| 42 | struct ttm_backend_func { | ||
| 43 | /** | ||
| 44 | * struct ttm_backend_func member populate | ||
| 45 | * | ||
| 46 | * @backend: Pointer to a struct ttm_backend. | ||
| 47 | * @num_pages: Number of pages to populate. | ||
| 48 | * @pages: Array of pointers to ttm pages. | ||
| 49 | * @dummy_read_page: Page to be used instead of NULL pages in the | ||
| 50 | * array @pages. | ||
| 51 | * | ||
| 52 | * Populate the backend with ttm pages. Depending on the backend, | ||
| 53 | * it may or may not copy the @pages array. | ||
| 54 | */ | ||
| 55 | int (*populate) (struct ttm_backend *backend, | ||
| 56 | unsigned long num_pages, struct page **pages, | ||
| 57 | struct page *dummy_read_page); | ||
| 58 | /** | ||
| 59 | * struct ttm_backend_func member clear | ||
| 60 | * | ||
| 61 | * @backend: Pointer to a struct ttm_backend. | ||
| 62 | * | ||
| 63 | * This is an "unpopulate" function. Release all resources | ||
| 64 | * allocated with populate. | ||
| 65 | */ | ||
| 66 | void (*clear) (struct ttm_backend *backend); | ||
| 67 | |||
| 68 | /** | ||
| 69 | * struct ttm_backend_func member bind | ||
| 70 | * | ||
| 71 | * @backend: Pointer to a struct ttm_backend. | ||
| 72 | * @bo_mem: Pointer to a struct ttm_mem_reg describing the | ||
| 73 | * memory type and location for binding. | ||
| 74 | * | ||
| 75 | * Bind the backend pages into the aperture in the location | ||
| 76 | * indicated by @bo_mem. This function should be able to handle | ||
| 77 | * differences between aperture- and system page sizes. | ||
| 78 | */ | ||
| 79 | int (*bind) (struct ttm_backend *backend, struct ttm_mem_reg *bo_mem); | ||
| 80 | |||
| 81 | /** | ||
| 82 | * struct ttm_backend_func member unbind | ||
| 83 | * | ||
| 84 | * @backend: Pointer to a struct ttm_backend. | ||
| 85 | * | ||
| 86 | * Unbind previously bound backend pages. This function should be | ||
| 87 | * able to handle differences between aperture- and system page sizes. | ||
| 88 | */ | ||
| 89 | int (*unbind) (struct ttm_backend *backend); | ||
| 90 | |||
| 91 | /** | ||
| 92 | * struct ttm_backend_func member destroy | ||
| 93 | * | ||
| 94 | * @backend: Pointer to a struct ttm_backend. | ||
| 95 | * | ||
| 96 | * Destroy the backend. | ||
| 97 | */ | ||
| 98 | void (*destroy) (struct ttm_backend *backend); | ||
| 99 | }; | ||
| 100 | |||
| 101 | /** | ||
| 102 | * struct ttm_backend | ||
| 103 | * | ||
| 104 | * @bdev: Pointer to a struct ttm_bo_device. | ||
| 105 | * @flags: For driver use. | ||
| 106 | * @func: Pointer to a struct ttm_backend_func that describes | ||
| 107 | * the backend methods. | ||
| 108 | * | ||
| 109 | */ | ||
| 110 | |||
| 111 | struct ttm_backend { | ||
| 112 | struct ttm_bo_device *bdev; | ||
| 113 | uint32_t flags; | ||
| 114 | struct ttm_backend_func *func; | ||
| 115 | }; | ||
| 116 | |||
| 117 | #define TTM_PAGE_FLAG_VMALLOC (1 << 0) | ||
| 118 | #define TTM_PAGE_FLAG_USER (1 << 1) | ||
| 119 | #define TTM_PAGE_FLAG_USER_DIRTY (1 << 2) | ||
| 120 | #define TTM_PAGE_FLAG_WRITE (1 << 3) | ||
| 121 | #define TTM_PAGE_FLAG_SWAPPED (1 << 4) | ||
| 122 | #define TTM_PAGE_FLAG_PERSISTANT_SWAP (1 << 5) | ||
| 123 | #define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6) | ||
| 124 | |||
| 125 | enum ttm_caching_state { | ||
| 126 | tt_uncached, | ||
| 127 | tt_wc, | ||
| 128 | tt_cached | ||
| 129 | }; | ||
| 130 | |||
| 131 | /** | ||
| 132 | * struct ttm_tt | ||
| 133 | * | ||
| 134 | * @dummy_read_page: Page to map where the ttm_tt page array contains a NULL | ||
| 135 | * pointer. | ||
| 136 | * @pages: Array of pages backing the data. | ||
| 137 | * @first_himem_page: Himem pages are put last in the page array, which | ||
| 138 | * enables us to run caching attribute changes on only the first part | ||
| 139 | * of the page array containing lomem pages. This is the index of the | ||
| 140 | * first himem page. | ||
| 141 | * @last_lomem_page: Index of the last lomem page in the page array. | ||
| 142 | * @num_pages: Number of pages in the page array. | ||
| 143 | * @bdev: Pointer to the current struct ttm_bo_device. | ||
| 144 | * @be: Pointer to the ttm backend. | ||
| 145 | * @tsk: The task for user ttm. | ||
| 146 | * @start: virtual address for user ttm. | ||
| 147 | * @swap_storage: Pointer to shmem struct file for swap storage. | ||
| 148 | * @caching_state: The current caching state of the pages. | ||
| 149 | * @state: The current binding state of the pages. | ||
| 150 | * | ||
| 151 | * This is a structure holding the pages, caching- and aperture binding | ||
| 152 | * status for a buffer object that isn't backed by fixed (VRAM / AGP) | ||
| 153 | * memory. | ||
| 154 | */ | ||
| 155 | |||
| 156 | struct ttm_tt { | ||
| 157 | struct page *dummy_read_page; | ||
| 158 | struct page **pages; | ||
| 159 | long first_himem_page; | ||
| 160 | long last_lomem_page; | ||
| 161 | uint32_t page_flags; | ||
| 162 | unsigned long num_pages; | ||
| 163 | struct ttm_bo_device *bdev; | ||
| 164 | struct ttm_backend *be; | ||
| 165 | struct task_struct *tsk; | ||
| 166 | unsigned long start; | ||
| 167 | struct file *swap_storage; | ||
| 168 | enum ttm_caching_state caching_state; | ||
| 169 | enum { | ||
| 170 | tt_bound, | ||
| 171 | tt_unbound, | ||
| 172 | tt_unpopulated, | ||
| 173 | } state; | ||
| 174 | }; | ||
| 175 | |||
| 176 | #define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */ | ||
| 177 | #define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */ | ||
| 178 | #define TTM_MEMTYPE_FLAG_NEEDS_IOREMAP (1 << 2) /* Fixed memory needs ioremap | ||
| 179 | before kernel access. */ | ||
| 180 | #define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */ | ||
| 181 | |||
| 182 | /** | ||
| 183 | * struct ttm_mem_type_manager | ||
| 184 | * | ||
| 185 | * @has_type: The memory type has been initialized. | ||
| 186 | * @use_type: The memory type is enabled. | ||
| 187 | * @flags: TTM_MEMTYPE_XX flags identifying the traits of the memory | ||
| 188 | * managed by this memory type. | ||
| 189 | * @gpu_offset: If used, the GPU offset of the first managed page of | ||
| 190 | * fixed memory or the first managed location in an aperture. | ||
| 191 | * @io_offset: The io_offset of the first managed page of IO memory or | ||
| 192 | * the first managed location in an aperture. For TTM_MEMTYPE_FLAG_CMA | ||
| 193 | * memory, this should be set to NULL. | ||
| 194 | * @io_size: The size of a managed IO region (fixed memory or aperture). | ||
| 195 | * @io_addr: Virtual kernel address if the io region is pre-mapped. For | ||
| 196 | * TTM_MEMTYPE_FLAG_NEEDS_IOREMAP there is no pre-mapped io map and | ||
| 197 | * @io_addr should be set to NULL. | ||
| 198 | * @size: Size of the managed region. | ||
| 199 | * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX, | ||
| 200 | * as defined in ttm_placement_common.h | ||
| 201 | * @default_caching: The default caching policy used for a buffer object | ||
| 202 | * placed in this memory type if the user doesn't provide one. | ||
| 203 | * @manager: The range manager used for this memory type. FIXME: If the aperture | ||
| 204 | * has a page size different from the underlying system, the granularity | ||
| 205 | * of this manager should take care of this. But the range allocating code | ||
| 206 | * in ttm_bo.c needs to be modified for this. | ||
| 207 | * @lru: The lru list for this memory type. | ||
| 208 | * | ||
| 209 | * This structure is used to identify and manage memory types for a device. | ||
| 210 | * It's set up by the ttm_bo_driver::init_mem_type method. | ||
| 211 | */ | ||
| 212 | |||
| 213 | struct ttm_mem_type_manager { | ||
| 214 | |||
| 215 | /* | ||
| 216 | * No protection. Constant from start. | ||
| 217 | */ | ||
| 218 | |||
| 219 | bool has_type; | ||
| 220 | bool use_type; | ||
| 221 | uint32_t flags; | ||
| 222 | unsigned long gpu_offset; | ||
| 223 | unsigned long io_offset; | ||
| 224 | unsigned long io_size; | ||
| 225 | void *io_addr; | ||
| 226 | uint64_t size; | ||
| 227 | uint32_t available_caching; | ||
| 228 | uint32_t default_caching; | ||
| 229 | |||
| 230 | /* | ||
| 231 | * Protected by the bdev->lru_lock. | ||
| 232 | * TODO: Consider one lru_lock per ttm_mem_type_manager. | ||
| 233 | * Plays ill with list removal, though. | ||
| 234 | */ | ||
| 235 | |||
| 236 | struct drm_mm manager; | ||
| 237 | struct list_head lru; | ||
| 238 | }; | ||
| 239 | |||
| 240 | /** | ||
| 241 | * struct ttm_bo_driver | ||
| 242 | * | ||
| 243 | * @mem_type_prio: Priority array of memory types to place a buffer object in | ||
| 244 | * if it fits without evicting buffers from any of these memory types. | ||
| 245 | * @mem_busy_prio: Priority array of memory types to place a buffer object in | ||
| 246 | * if it needs to evict buffers to make room. | ||
| 247 | * @num_mem_type_prio: Number of elements in the @mem_type_prio array. | ||
| 248 | * @num_mem_busy_prio: Number of elements in the @num_mem_busy_prio array. | ||
| 249 | * @create_ttm_backend_entry: Callback to create a struct ttm_backend. | ||
| 250 | * @invalidate_caches: Callback to invalidate read caches when a buffer object | ||
| 251 | * has been evicted. | ||
| 252 | * @init_mem_type: Callback to initialize a struct ttm_mem_type_manager | ||
| 253 | * structure. | ||
| 254 | * @evict_flags: Callback to obtain placement flags when a buffer is evicted. | ||
| 255 | * @move: Callback for a driver to hook in accelerated functions to | ||
| 256 | * move a buffer. | ||
| 257 | * If set to NULL, a potentially slow memcpy() move is used. | ||
| 258 | * @sync_obj_signaled: See ttm_fence_api.h | ||
| 259 | * @sync_obj_wait: See ttm_fence_api.h | ||
| 260 | * @sync_obj_flush: See ttm_fence_api.h | ||
| 261 | * @sync_obj_unref: See ttm_fence_api.h | ||
| 262 | * @sync_obj_ref: See ttm_fence_api.h | ||
| 263 | */ | ||
| 264 | |||
| 265 | struct ttm_bo_driver { | ||
| 266 | const uint32_t *mem_type_prio; | ||
| 267 | const uint32_t *mem_busy_prio; | ||
| 268 | uint32_t num_mem_type_prio; | ||
| 269 | uint32_t num_mem_busy_prio; | ||
| 270 | |||
| 271 | /** | ||
| 272 | * struct ttm_bo_driver member create_ttm_backend_entry | ||
| 273 | * | ||
| 274 | * @bdev: The buffer object device. | ||
| 275 | * | ||
| 276 | * Create a driver specific struct ttm_backend. | ||
| 277 | */ | ||
| 278 | |||
| 279 | struct ttm_backend *(*create_ttm_backend_entry) | ||
| 280 | (struct ttm_bo_device *bdev); | ||
| 281 | |||
| 282 | /** | ||
| 283 | * struct ttm_bo_driver member invalidate_caches | ||
| 284 | * | ||
| 285 | * @bdev: the buffer object device. | ||
| 286 | * @flags: new placement of the rebound buffer object. | ||
| 287 | * | ||
| 288 | * A previosly evicted buffer has been rebound in a | ||
| 289 | * potentially new location. Tell the driver that it might | ||
| 290 | * consider invalidating read (texture) caches on the next command | ||
| 291 | * submission as a consequence. | ||
| 292 | */ | ||
| 293 | |||
| 294 | int (*invalidate_caches) (struct ttm_bo_device *bdev, uint32_t flags); | ||
| 295 | int (*init_mem_type) (struct ttm_bo_device *bdev, uint32_t type, | ||
| 296 | struct ttm_mem_type_manager *man); | ||
| 297 | /** | ||
| 298 | * struct ttm_bo_driver member evict_flags: | ||
| 299 | * | ||
| 300 | * @bo: the buffer object to be evicted | ||
| 301 | * | ||
| 302 | * Return the bo flags for a buffer which is not mapped to the hardware. | ||
| 303 | * These will be placed in proposed_flags so that when the move is | ||
| 304 | * finished, they'll end up in bo->mem.flags | ||
| 305 | */ | ||
| 306 | |||
| 307 | uint32_t(*evict_flags) (struct ttm_buffer_object *bo); | ||
| 308 | /** | ||
| 309 | * struct ttm_bo_driver member move: | ||
| 310 | * | ||
| 311 | * @bo: the buffer to move | ||
| 312 | * @evict: whether this motion is evicting the buffer from | ||
| 313 | * the graphics address space | ||
| 314 | * @interruptible: Use interruptible sleeps if possible when sleeping. | ||
| 315 | * @no_wait: whether this should give up and return -EBUSY | ||
| 316 | * if this move would require sleeping | ||
| 317 | * @new_mem: the new memory region receiving the buffer | ||
| 318 | * | ||
| 319 | * Move a buffer between two memory regions. | ||
| 320 | */ | ||
| 321 | int (*move) (struct ttm_buffer_object *bo, | ||
| 322 | bool evict, bool interruptible, | ||
| 323 | bool no_wait, struct ttm_mem_reg *new_mem); | ||
| 324 | |||
| 325 | /** | ||
| 326 | * struct ttm_bo_driver_member verify_access | ||
| 327 | * | ||
| 328 | * @bo: Pointer to a buffer object. | ||
| 329 | * @filp: Pointer to a struct file trying to access the object. | ||
| 330 | * | ||
| 331 | * Called from the map / write / read methods to verify that the | ||
| 332 | * caller is permitted to access the buffer object. | ||
| 333 | * This member may be set to NULL, which will refuse this kind of | ||
| 334 | * access for all buffer objects. | ||
| 335 | * This function should return 0 if access is granted, -EPERM otherwise. | ||
| 336 | */ | ||
| 337 | int (*verify_access) (struct ttm_buffer_object *bo, | ||
| 338 | struct file *filp); | ||
| 339 | |||
| 340 | /** | ||
| 341 | * In case a driver writer dislikes the TTM fence objects, | ||
| 342 | * the driver writer can replace those with sync objects of | ||
| 343 | * his / her own. If it turns out that no driver writer is | ||
| 344 | * using these. I suggest we remove these hooks and plug in | ||
| 345 | * fences directly. The bo driver needs the following functionality: | ||
| 346 | * See the corresponding functions in the fence object API | ||
| 347 | * documentation. | ||
| 348 | */ | ||
| 349 | |||
| 350 | bool (*sync_obj_signaled) (void *sync_obj, void *sync_arg); | ||
| 351 | int (*sync_obj_wait) (void *sync_obj, void *sync_arg, | ||
| 352 | bool lazy, bool interruptible); | ||
| 353 | int (*sync_obj_flush) (void *sync_obj, void *sync_arg); | ||
| 354 | void (*sync_obj_unref) (void **sync_obj); | ||
| 355 | void *(*sync_obj_ref) (void *sync_obj); | ||
| 356 | }; | ||
| 357 | |||
| 358 | #define TTM_NUM_MEM_TYPES 8 | ||
| 359 | |||
| 360 | #define TTM_BO_PRIV_FLAG_MOVING 0 /* Buffer object is moving and needs | ||
| 361 | idling before CPU mapping */ | ||
| 362 | #define TTM_BO_PRIV_FLAG_MAX 1 | ||
| 363 | /** | ||
| 364 | * struct ttm_bo_device - Buffer object driver device-specific data. | ||
| 365 | * | ||
| 366 | * @mem_glob: Pointer to a struct ttm_mem_global object for accounting. | ||
| 367 | * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver. | ||
| 368 | * @count: Current number of buffer object. | ||
| 369 | * @pages: Current number of pinned pages. | ||
| 370 | * @dummy_read_page: Pointer to a dummy page used for mapping requests | ||
| 371 | * of unpopulated pages. | ||
| 372 | * @shrink: A shrink callback object used for buffre object swap. | ||
| 373 | * @ttm_bo_extra_size: Extra size (sizeof(struct ttm_buffer_object) excluded) | ||
| 374 | * used by a buffer object. This is excluding page arrays and backing pages. | ||
| 375 | * @ttm_bo_size: This is @ttm_bo_extra_size + sizeof(struct ttm_buffer_object). | ||
| 376 | * @man: An array of mem_type_managers. | ||
| 377 | * @addr_space_mm: Range manager for the device address space. | ||
| 378 | * lru_lock: Spinlock that protects the buffer+device lru lists and | ||
| 379 | * ddestroy lists. | ||
| 380 | * @nice_mode: Try nicely to wait for buffer idle when cleaning a manager. | ||
| 381 | * If a GPU lockup has been detected, this is forced to 0. | ||
| 382 | * @dev_mapping: A pointer to the struct address_space representing the | ||
| 383 | * device address space. | ||
| 384 | * @wq: Work queue structure for the delayed delete workqueue. | ||
| 385 | * | ||
| 386 | */ | ||
| 387 | |||
| 388 | struct ttm_bo_device { | ||
| 389 | |||
| 390 | /* | ||
| 391 | * Constant after bo device init / atomic. | ||
| 392 | */ | ||
| 393 | |||
| 394 | struct ttm_mem_global *mem_glob; | ||
| 395 | struct ttm_bo_driver *driver; | ||
| 396 | struct page *dummy_read_page; | ||
| 397 | struct ttm_mem_shrink shrink; | ||
| 398 | |||
| 399 | size_t ttm_bo_extra_size; | ||
| 400 | size_t ttm_bo_size; | ||
| 401 | |||
| 402 | rwlock_t vm_lock; | ||
| 403 | /* | ||
| 404 | * Protected by the vm lock. | ||
| 405 | */ | ||
| 406 | struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES]; | ||
| 407 | struct rb_root addr_space_rb; | ||
| 408 | struct drm_mm addr_space_mm; | ||
| 409 | |||
| 410 | /* | ||
| 411 | * Might want to change this to one lock per manager. | ||
| 412 | */ | ||
| 413 | spinlock_t lru_lock; | ||
| 414 | /* | ||
| 415 | * Protected by the lru lock. | ||
| 416 | */ | ||
| 417 | struct list_head ddestroy; | ||
| 418 | struct list_head swap_lru; | ||
| 419 | |||
| 420 | /* | ||
| 421 | * Protected by load / firstopen / lastclose /unload sync. | ||
| 422 | */ | ||
| 423 | |||
| 424 | bool nice_mode; | ||
| 425 | struct address_space *dev_mapping; | ||
| 426 | |||
| 427 | /* | ||
| 428 | * Internal protection. | ||
| 429 | */ | ||
| 430 | |||
| 431 | struct delayed_work wq; | ||
| 432 | }; | ||
| 433 | |||
| 434 | /** | ||
| 435 | * ttm_flag_masked | ||
| 436 | * | ||
| 437 | * @old: Pointer to the result and original value. | ||
| 438 | * @new: New value of bits. | ||
| 439 | * @mask: Mask of bits to change. | ||
| 440 | * | ||
| 441 | * Convenience function to change a number of bits identified by a mask. | ||
| 442 | */ | ||
| 443 | |||
| 444 | static inline uint32_t | ||
| 445 | ttm_flag_masked(uint32_t *old, uint32_t new, uint32_t mask) | ||
| 446 | { | ||
| 447 | *old ^= (*old ^ new) & mask; | ||
| 448 | return *old; | ||
| 449 | } | ||
| 450 | |||
| 451 | /** | ||
| 452 | * ttm_tt_create | ||
| 453 | * | ||
| 454 | * @bdev: pointer to a struct ttm_bo_device: | ||
| 455 | * @size: Size of the data needed backing. | ||
| 456 | * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags. | ||
| 457 | * @dummy_read_page: See struct ttm_bo_device. | ||
| 458 | * | ||
| 459 | * Create a struct ttm_tt to back data with system memory pages. | ||
| 460 | * No pages are actually allocated. | ||
| 461 | * Returns: | ||
| 462 | * NULL: Out of memory. | ||
| 463 | */ | ||
| 464 | extern struct ttm_tt *ttm_tt_create(struct ttm_bo_device *bdev, | ||
| 465 | unsigned long size, | ||
| 466 | uint32_t page_flags, | ||
| 467 | struct page *dummy_read_page); | ||
| 468 | |||
| 469 | /** | ||
| 470 | * ttm_tt_set_user: | ||
| 471 | * | ||
| 472 | * @ttm: The struct ttm_tt to populate. | ||
| 473 | * @tsk: A struct task_struct for which @start is a valid user-space address. | ||
| 474 | * @start: A valid user-space address. | ||
| 475 | * @num_pages: Size in pages of the user memory area. | ||
| 476 | * | ||
| 477 | * Populate a struct ttm_tt with a user-space memory area after first pinning | ||
| 478 | * the pages backing it. | ||
| 479 | * Returns: | ||
| 480 | * !0: Error. | ||
| 481 | */ | ||
| 482 | |||
| 483 | extern int ttm_tt_set_user(struct ttm_tt *ttm, | ||
| 484 | struct task_struct *tsk, | ||
| 485 | unsigned long start, unsigned long num_pages); | ||
| 486 | |||
| 487 | /** | ||
| 488 | * ttm_ttm_bind: | ||
| 489 | * | ||
| 490 | * @ttm: The struct ttm_tt containing backing pages. | ||
| 491 | * @bo_mem: The struct ttm_mem_reg identifying the binding location. | ||
| 492 | * | ||
| 493 | * Bind the pages of @ttm to an aperture location identified by @bo_mem | ||
| 494 | */ | ||
| 495 | extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem); | ||
| 496 | |||
| 497 | /** | ||
| 498 | * ttm_ttm_destroy: | ||
| 499 | * | ||
| 500 | * @ttm: The struct ttm_tt. | ||
| 501 | * | ||
| 502 | * Unbind, unpopulate and destroy a struct ttm_tt. | ||
| 503 | */ | ||
| 504 | extern void ttm_tt_destroy(struct ttm_tt *ttm); | ||
| 505 | |||
| 506 | /** | ||
| 507 | * ttm_ttm_unbind: | ||
| 508 | * | ||
| 509 | * @ttm: The struct ttm_tt. | ||
| 510 | * | ||
| 511 | * Unbind a struct ttm_tt. | ||
| 512 | */ | ||
| 513 | extern void ttm_tt_unbind(struct ttm_tt *ttm); | ||
| 514 | |||
| 515 | /** | ||
| 516 | * ttm_ttm_destroy: | ||
| 517 | * | ||
| 518 | * @ttm: The struct ttm_tt. | ||
| 519 | * @index: Index of the desired page. | ||
| 520 | * | ||
| 521 | * Return a pointer to the struct page backing @ttm at page | ||
| 522 | * index @index. If the page is unpopulated, one will be allocated to | ||
| 523 | * populate that index. | ||
| 524 | * | ||
| 525 | * Returns: | ||
| 526 | * NULL on OOM. | ||
| 527 | */ | ||
| 528 | extern struct page *ttm_tt_get_page(struct ttm_tt *ttm, int index); | ||
| 529 | |||
| 530 | /** | ||
| 531 | * ttm_tt_cache_flush: | ||
| 532 | * | ||
| 533 | * @pages: An array of pointers to struct page:s to flush. | ||
| 534 | * @num_pages: Number of pages to flush. | ||
| 535 | * | ||
| 536 | * Flush the data of the indicated pages from the cpu caches. | ||
| 537 | * This is used when changing caching attributes of the pages from | ||
| 538 | * cache-coherent. | ||
| 539 | */ | ||
| 540 | extern void ttm_tt_cache_flush(struct page *pages[], unsigned long num_pages); | ||
| 541 | |||
| 542 | /** | ||
| 543 | * ttm_tt_set_placement_caching: | ||
| 544 | * | ||
| 545 | * @ttm A struct ttm_tt the backing pages of which will change caching policy. | ||
| 546 | * @placement: Flag indicating the desired caching policy. | ||
| 547 | * | ||
| 548 | * This function will change caching policy of any default kernel mappings of | ||
| 549 | * the pages backing @ttm. If changing from cached to uncached or | ||
| 550 | * write-combined, | ||
| 551 | * all CPU caches will first be flushed to make sure the data of the pages | ||
| 552 | * hit RAM. This function may be very costly as it involves global TLB | ||
| 553 | * and cache flushes and potential page splitting / combining. | ||
| 554 | */ | ||
| 555 | extern int ttm_tt_set_placement_caching(struct ttm_tt *ttm, uint32_t placement); | ||
| 556 | extern int ttm_tt_swapout(struct ttm_tt *ttm, | ||
| 557 | struct file *persistant_swap_storage); | ||
| 558 | |||
| 559 | /* | ||
| 560 | * ttm_bo.c | ||
| 561 | */ | ||
| 562 | |||
| 563 | /** | ||
| 564 | * ttm_mem_reg_is_pci | ||
| 565 | * | ||
| 566 | * @bdev: Pointer to a struct ttm_bo_device. | ||
| 567 | * @mem: A valid struct ttm_mem_reg. | ||
| 568 | * | ||
| 569 | * Returns true if the memory described by @mem is PCI memory, | ||
| 570 | * false otherwise. | ||
| 571 | */ | ||
| 572 | extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev, | ||
| 573 | struct ttm_mem_reg *mem); | ||
| 574 | |||
| 575 | /** | ||
| 576 | * ttm_bo_mem_space | ||
| 577 | * | ||
| 578 | * @bo: Pointer to a struct ttm_buffer_object. the data of which | ||
| 579 | * we want to allocate space for. | ||
| 580 | * @proposed_placement: Proposed new placement for the buffer object. | ||
| 581 | * @mem: A struct ttm_mem_reg. | ||
| 582 | * @interruptible: Sleep interruptible when sliping. | ||
| 583 | * @no_wait: Don't sleep waiting for space to become available. | ||
| 584 | * | ||
| 585 | * Allocate memory space for the buffer object pointed to by @bo, using | ||
| 586 | * the placement flags in @mem, potentially evicting other idle buffer objects. | ||
| 587 | * This function may sleep while waiting for space to become available. | ||
| 588 | * Returns: | ||
| 589 | * -EBUSY: No space available (only if no_wait == 1). | ||
| 590 | * -ENOMEM: Could not allocate memory for the buffer object, either due to | ||
| 591 | * fragmentation or concurrent allocators. | ||
| 592 | * -ERESTART: An interruptible sleep was interrupted by a signal. | ||
| 593 | */ | ||
| 594 | extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, | ||
| 595 | uint32_t proposed_placement, | ||
| 596 | struct ttm_mem_reg *mem, | ||
| 597 | bool interruptible, bool no_wait); | ||
| 598 | /** | ||
| 599 | * ttm_bo_wait_for_cpu | ||
| 600 | * | ||
| 601 | * @bo: Pointer to a struct ttm_buffer_object. | ||
| 602 | * @no_wait: Don't sleep while waiting. | ||
| 603 | * | ||
| 604 | * Wait until a buffer object is no longer sync'ed for CPU access. | ||
| 605 | * Returns: | ||
| 606 | * -EBUSY: Buffer object was sync'ed for CPU access. (only if no_wait == 1). | ||
| 607 | * -ERESTART: An interruptible sleep was interrupted by a signal. | ||
| 608 | */ | ||
| 609 | |||
| 610 | extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait); | ||
| 611 | |||
| 612 | /** | ||
| 613 | * ttm_bo_pci_offset - Get the PCI offset for the buffer object memory. | ||
| 614 | * | ||
| 615 | * @bo Pointer to a struct ttm_buffer_object. | ||
| 616 | * @bus_base On return the base of the PCI region | ||
| 617 | * @bus_offset On return the byte offset into the PCI region | ||
| 618 | * @bus_size On return the byte size of the buffer object or zero if | ||
| 619 | * the buffer object memory is not accessible through a PCI region. | ||
| 620 | * | ||
| 621 | * Returns: | ||
| 622 | * -EINVAL if the buffer object is currently not mappable. | ||
| 623 | * 0 otherwise. | ||
| 624 | */ | ||
| 625 | |||
| 626 | extern int ttm_bo_pci_offset(struct ttm_bo_device *bdev, | ||
| 627 | struct ttm_mem_reg *mem, | ||
| 628 | unsigned long *bus_base, | ||
| 629 | unsigned long *bus_offset, | ||
| 630 | unsigned long *bus_size); | ||
| 631 | |||
| 632 | extern int ttm_bo_device_release(struct ttm_bo_device *bdev); | ||
| 633 | |||
| 634 | /** | ||
| 635 | * ttm_bo_device_init | ||
| 636 | * | ||
| 637 | * @bdev: A pointer to a struct ttm_bo_device to initialize. | ||
| 638 | * @mem_global: A pointer to an initialized struct ttm_mem_global. | ||
| 639 | * @driver: A pointer to a struct ttm_bo_driver set up by the caller. | ||
| 640 | * @file_page_offset: Offset into the device address space that is available | ||
| 641 | * for buffer data. This ensures compatibility with other users of the | ||
| 642 | * address space. | ||
| 643 | * | ||
| 644 | * Initializes a struct ttm_bo_device: | ||
| 645 | * Returns: | ||
| 646 | * !0: Failure. | ||
| 647 | */ | ||
| 648 | extern int ttm_bo_device_init(struct ttm_bo_device *bdev, | ||
| 649 | struct ttm_mem_global *mem_glob, | ||
| 650 | struct ttm_bo_driver *driver, | ||
| 651 | uint64_t file_page_offset); | ||
| 652 | |||
| 653 | /** | ||
| 654 | * ttm_bo_reserve: | ||
| 655 | * | ||
| 656 | * @bo: A pointer to a struct ttm_buffer_object. | ||
| 657 | * @interruptible: Sleep interruptible if waiting. | ||
| 658 | * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY. | ||
| 659 | * @use_sequence: If @bo is already reserved, Only sleep waiting for | ||
| 660 | * it to become unreserved if @sequence < (@bo)->sequence. | ||
| 661 | * | ||
| 662 | * Locks a buffer object for validation. (Or prevents other processes from | ||
| 663 | * locking it for validation) and removes it from lru lists, while taking | ||
| 664 | * a number of measures to prevent deadlocks. | ||
| 665 | * | ||
| 666 | * Deadlocks may occur when two processes try to reserve multiple buffers in | ||
| 667 | * different order, either by will or as a result of a buffer being evicted | ||
| 668 | * to make room for a buffer already reserved. (Buffers are reserved before | ||
| 669 | * they are evicted). The following algorithm prevents such deadlocks from | ||
| 670 | * occuring: | ||
| 671 | * 1) Buffers are reserved with the lru spinlock held. Upon successful | ||
| 672 | * reservation they are removed from the lru list. This stops a reserved buffer | ||
| 673 | * from being evicted. However the lru spinlock is released between the time | ||
| 674 | * a buffer is selected for eviction and the time it is reserved. | ||
| 675 | * Therefore a check is made when a buffer is reserved for eviction, that it | ||
| 676 | * is still the first buffer in the lru list, before it is removed from the | ||
| 677 | * list. @check_lru == 1 forces this check. If it fails, the function returns | ||
| 678 | * -EINVAL, and the caller should then choose a new buffer to evict and repeat | ||
| 679 | * the procedure. | ||
| 680 | * 2) Processes attempting to reserve multiple buffers other than for eviction, | ||
| 681 | * (typically execbuf), should first obtain a unique 32-bit | ||
| 682 | * validation sequence number, | ||
| 683 | * and call this function with @use_sequence == 1 and @sequence == the unique | ||
| 684 | * sequence number. If upon call of this function, the buffer object is already | ||
| 685 | * reserved, the validation sequence is checked against the validation | ||
| 686 | * sequence of the process currently reserving the buffer, | ||
| 687 | * and if the current validation sequence is greater than that of the process | ||
| 688 | * holding the reservation, the function returns -EAGAIN. Otherwise it sleeps | ||
| 689 | * waiting for the buffer to become unreserved, after which it retries | ||
| 690 | * reserving. | ||
| 691 | * The caller should, when receiving an -EAGAIN error | ||
| 692 | * release all its buffer reservations, wait for @bo to become unreserved, and | ||
| 693 | * then rerun the validation with the same validation sequence. This procedure | ||
| 694 | * will always guarantee that the process with the lowest validation sequence | ||
| 695 | * will eventually succeed, preventing both deadlocks and starvation. | ||
| 696 | * | ||
| 697 | * Returns: | ||
| 698 | * -EAGAIN: The reservation may cause a deadlock. | ||
| 699 | * Release all buffer reservations, wait for @bo to become unreserved and | ||
| 700 | * try again. (only if use_sequence == 1). | ||
| 701 | * -ERESTART: A wait for the buffer to become unreserved was interrupted by | ||
| 702 | * a signal. Release all buffer reservations and return to user-space. | ||
| 703 | */ | ||
| 704 | extern int ttm_bo_reserve(struct ttm_buffer_object *bo, | ||
| 705 | bool interruptible, | ||
| 706 | bool no_wait, bool use_sequence, uint32_t sequence); | ||
| 707 | |||
| 708 | /** | ||
| 709 | * ttm_bo_unreserve | ||
| 710 | * | ||
| 711 | * @bo: A pointer to a struct ttm_buffer_object. | ||
| 712 | * | ||
| 713 | * Unreserve a previous reservation of @bo. | ||
| 714 | */ | ||
| 715 | extern void ttm_bo_unreserve(struct ttm_buffer_object *bo); | ||
| 716 | |||
| 717 | /** | ||
| 718 | * ttm_bo_wait_unreserved | ||
| 719 | * | ||
| 720 | * @bo: A pointer to a struct ttm_buffer_object. | ||
| 721 | * | ||
| 722 | * Wait for a struct ttm_buffer_object to become unreserved. | ||
| 723 | * This is typically used in the execbuf code to relax cpu-usage when | ||
| 724 | * a potential deadlock condition backoff. | ||
| 725 | */ | ||
| 726 | extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo, | ||
| 727 | bool interruptible); | ||
| 728 | |||
| 729 | /** | ||
| 730 | * ttm_bo_block_reservation | ||
| 731 | * | ||
| 732 | * @bo: A pointer to a struct ttm_buffer_object. | ||
| 733 | * @interruptible: Use interruptible sleep when waiting. | ||
| 734 | * @no_wait: Don't sleep, but rather return -EBUSY. | ||
| 735 | * | ||
| 736 | * Block reservation for validation by simply reserving the buffer. | ||
| 737 | * This is intended for single buffer use only without eviction, | ||
| 738 | * and thus needs no deadlock protection. | ||
| 739 | * | ||
| 740 | * Returns: | ||
| 741 | * -EBUSY: If no_wait == 1 and the buffer is already reserved. | ||
| 742 | * -ERESTART: If interruptible == 1 and the process received a signal | ||
| 743 | * while sleeping. | ||
| 744 | */ | ||
| 745 | extern int ttm_bo_block_reservation(struct ttm_buffer_object *bo, | ||
| 746 | bool interruptible, bool no_wait); | ||
| 747 | |||
| 748 | /** | ||
| 749 | * ttm_bo_unblock_reservation | ||
| 750 | * | ||
| 751 | * @bo: A pointer to a struct ttm_buffer_object. | ||
| 752 | * | ||
| 753 | * Unblocks reservation leaving lru lists untouched. | ||
| 754 | */ | ||
| 755 | extern void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo); | ||
| 756 | |||
| 757 | /* | ||
| 758 | * ttm_bo_util.c | ||
| 759 | */ | ||
| 760 | |||
| 761 | /** | ||
| 762 | * ttm_bo_move_ttm | ||
| 763 | * | ||
| 764 | * @bo: A pointer to a struct ttm_buffer_object. | ||
| 765 | * @evict: 1: This is an eviction. Don't try to pipeline. | ||
| 766 | * @no_wait: Never sleep, but rather return with -EBUSY. | ||
| 767 | * @new_mem: struct ttm_mem_reg indicating where to move. | ||
| 768 | * | ||
| 769 | * Optimized move function for a buffer object with both old and | ||
| 770 | * new placement backed by a TTM. The function will, if successful, | ||
| 771 | * free any old aperture space, and set (@new_mem)->mm_node to NULL, | ||
| 772 | * and update the (@bo)->mem placement flags. If unsuccessful, the old | ||
| 773 | * data remains untouched, and it's up to the caller to free the | ||
| 774 | * memory space indicated by @new_mem. | ||
| 775 | * Returns: | ||
| 776 | * !0: Failure. | ||
| 777 | */ | ||
| 778 | |||
| 779 | extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo, | ||
| 780 | bool evict, bool no_wait, | ||
| 781 | struct ttm_mem_reg *new_mem); | ||
| 782 | |||
| 783 | /** | ||
| 784 | * ttm_bo_move_memcpy | ||
| 785 | * | ||
| 786 | * @bo: A pointer to a struct ttm_buffer_object. | ||
| 787 | * @evict: 1: This is an eviction. Don't try to pipeline. | ||
| 788 | * @no_wait: Never sleep, but rather return with -EBUSY. | ||
| 789 | * @new_mem: struct ttm_mem_reg indicating where to move. | ||
| 790 | * | ||
| 791 | * Fallback move function for a mappable buffer object in mappable memory. | ||
| 792 | * The function will, if successful, | ||
| 793 | * free any old aperture space, and set (@new_mem)->mm_node to NULL, | ||
| 794 | * and update the (@bo)->mem placement flags. If unsuccessful, the old | ||
| 795 | * data remains untouched, and it's up to the caller to free the | ||
| 796 | * memory space indicated by @new_mem. | ||
| 797 | * Returns: | ||
| 798 | * !0: Failure. | ||
| 799 | */ | ||
| 800 | |||
| 801 | extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, | ||
| 802 | bool evict, | ||
| 803 | bool no_wait, struct ttm_mem_reg *new_mem); | ||
| 804 | |||
| 805 | /** | ||
| 806 | * ttm_bo_free_old_node | ||
| 807 | * | ||
| 808 | * @bo: A pointer to a struct ttm_buffer_object. | ||
| 809 | * | ||
| 810 | * Utility function to free an old placement after a successful move. | ||
| 811 | */ | ||
| 812 | extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo); | ||
| 813 | |||
| 814 | /** | ||
| 815 | * ttm_bo_move_accel_cleanup. | ||
| 816 | * | ||
| 817 | * @bo: A pointer to a struct ttm_buffer_object. | ||
| 818 | * @sync_obj: A sync object that signals when moving is complete. | ||
| 819 | * @sync_obj_arg: An argument to pass to the sync object idle / wait | ||
| 820 | * functions. | ||
| 821 | * @evict: This is an evict move. Don't return until the buffer is idle. | ||
| 822 | * @no_wait: Never sleep, but rather return with -EBUSY. | ||
| 823 | * @new_mem: struct ttm_mem_reg indicating where to move. | ||
| 824 | * | ||
| 825 | * Accelerated move function to be called when an accelerated move | ||
| 826 | * has been scheduled. The function will create a new temporary buffer object | ||
| 827 | * representing the old placement, and put the sync object on both buffer | ||
| 828 | * objects. After that the newly created buffer object is unref'd to be | ||
| 829 | * destroyed when the move is complete. This will help pipeline | ||
| 830 | * buffer moves. | ||
| 831 | */ | ||
| 832 | |||
| 833 | extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, | ||
| 834 | void *sync_obj, | ||
| 835 | void *sync_obj_arg, | ||
| 836 | bool evict, bool no_wait, | ||
| 837 | struct ttm_mem_reg *new_mem); | ||
| 838 | /** | ||
| 839 | * ttm_io_prot | ||
| 840 | * | ||
| 841 | * @c_state: Caching state. | ||
| 842 | * @tmp: Page protection flag for a normal, cached mapping. | ||
| 843 | * | ||
| 844 | * Utility function that returns the pgprot_t that should be used for | ||
| 845 | * setting up a PTE with the caching model indicated by @c_state. | ||
| 846 | */ | ||
| 847 | extern pgprot_t ttm_io_prot(enum ttm_caching_state c_state, pgprot_t tmp); | ||
| 848 | |||
| 849 | #if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) | ||
| 850 | #define TTM_HAS_AGP | ||
| 851 | #include <linux/agp_backend.h> | ||
| 852 | |||
| 853 | /** | ||
| 854 | * ttm_agp_backend_init | ||
| 855 | * | ||
| 856 | * @bdev: Pointer to a struct ttm_bo_device. | ||
| 857 | * @bridge: The agp bridge this device is sitting on. | ||
| 858 | * | ||
| 859 | * Create a TTM backend that uses the indicated AGP bridge as an aperture | ||
| 860 | * for TT memory. This function uses the linux agpgart interface to | ||
| 861 | * bind and unbind memory backing a ttm_tt. | ||
| 862 | */ | ||
| 863 | extern struct ttm_backend *ttm_agp_backend_init(struct ttm_bo_device *bdev, | ||
| 864 | struct agp_bridge_data *bridge); | ||
| 865 | #endif | ||
| 866 | |||
| 867 | #endif | ||
diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h new file mode 100644 index 000000000000..d8b8f042c4f1 --- /dev/null +++ b/include/drm/ttm/ttm_memory.h | |||
| @@ -0,0 +1,153 @@ | |||
| 1 | /************************************************************************** | ||
| 2 | * | ||
| 3 | * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA | ||
| 4 | * All Rights Reserved. | ||
| 5 | * | ||
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 7 | * copy of this software and associated documentation files (the | ||
| 8 | * "Software"), to deal in the Software without restriction, including | ||
| 9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
| 10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
| 11 | * permit persons to whom the Software is furnished to do so, subject to | ||
| 12 | * the following conditions: | ||
| 13 | * | ||
| 14 | * The above copyright notice and this permission notice (including the | ||
| 15 | * next paragraph) shall be included in all copies or substantial portions | ||
| 16 | * of the Software. | ||
| 17 | * | ||
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
| 21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
| 22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
| 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
| 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 25 | * | ||
| 26 | **************************************************************************/ | ||
| 27 | |||
| 28 | #ifndef TTM_MEMORY_H | ||
| 29 | #define TTM_MEMORY_H | ||
| 30 | |||
| 31 | #include <linux/workqueue.h> | ||
| 32 | #include <linux/spinlock.h> | ||
| 33 | #include <linux/wait.h> | ||
| 34 | #include <linux/errno.h> | ||
| 35 | |||
| 36 | /** | ||
| 37 | * struct ttm_mem_shrink - callback to shrink TTM memory usage. | ||
| 38 | * | ||
| 39 | * @do_shrink: The callback function. | ||
| 40 | * | ||
| 41 | * Arguments to the do_shrink functions are intended to be passed using | ||
| 42 | * inheritance. That is, the argument class derives from struct ttm_mem_srink, | ||
| 43 | * and can be accessed using container_of(). | ||
| 44 | */ | ||
| 45 | |||
| 46 | struct ttm_mem_shrink { | ||
| 47 | int (*do_shrink) (struct ttm_mem_shrink *); | ||
| 48 | }; | ||
| 49 | |||
| 50 | /** | ||
| 51 | * struct ttm_mem_global - Global memory accounting structure. | ||
| 52 | * | ||
| 53 | * @shrink: A single callback to shrink TTM memory usage. Extend this | ||
| 54 | * to a linked list to be able to handle multiple callbacks when needed. | ||
| 55 | * @swap_queue: A workqueue to handle shrinking in low memory situations. We | ||
| 56 | * need a separate workqueue since it will spend a lot of time waiting | ||
| 57 | * for the GPU, and this will otherwise block other workqueue tasks(?) | ||
| 58 | * At this point we use only a single-threaded workqueue. | ||
| 59 | * @work: The workqueue callback for the shrink queue. | ||
| 60 | * @queue: Wait queue for processes suspended waiting for memory. | ||
| 61 | * @lock: Lock to protect the @shrink - and the memory accounting members, | ||
| 62 | * that is, essentially the whole structure with some exceptions. | ||
| 63 | * @emer_memory: Lowmem memory limit available for root. | ||
| 64 | * @max_memory: Lowmem memory limit available for non-root. | ||
| 65 | * @swap_limit: Lowmem memory limit where the shrink workqueue kicks in. | ||
| 66 | * @used_memory: Currently used lowmem memory. | ||
| 67 | * @used_total_memory: Currently used total (lowmem + highmem) memory. | ||
| 68 | * @total_memory_swap_limit: Total memory limit where the shrink workqueue | ||
| 69 | * kicks in. | ||
| 70 | * @max_total_memory: Total memory available to non-root processes. | ||
| 71 | * @emer_total_memory: Total memory available to root processes. | ||
| 72 | * | ||
| 73 | * Note that this structure is not per device. It should be global for all | ||
| 74 | * graphics devices. | ||
| 75 | */ | ||
| 76 | |||
| 77 | struct ttm_mem_global { | ||
| 78 | struct ttm_mem_shrink *shrink; | ||
| 79 | struct workqueue_struct *swap_queue; | ||
| 80 | struct work_struct work; | ||
| 81 | wait_queue_head_t queue; | ||
| 82 | spinlock_t lock; | ||
| 83 | uint64_t emer_memory; | ||
| 84 | uint64_t max_memory; | ||
| 85 | uint64_t swap_limit; | ||
| 86 | uint64_t used_memory; | ||
| 87 | uint64_t used_total_memory; | ||
| 88 | uint64_t total_memory_swap_limit; | ||
| 89 | uint64_t max_total_memory; | ||
| 90 | uint64_t emer_total_memory; | ||
| 91 | }; | ||
| 92 | |||
| 93 | /** | ||
| 94 | * ttm_mem_init_shrink - initialize a struct ttm_mem_shrink object | ||
| 95 | * | ||
| 96 | * @shrink: The object to initialize. | ||
| 97 | * @func: The callback function. | ||
| 98 | */ | ||
| 99 | |||
| 100 | static inline void ttm_mem_init_shrink(struct ttm_mem_shrink *shrink, | ||
| 101 | int (*func) (struct ttm_mem_shrink *)) | ||
| 102 | { | ||
| 103 | shrink->do_shrink = func; | ||
| 104 | } | ||
| 105 | |||
| 106 | /** | ||
| 107 | * ttm_mem_register_shrink - register a struct ttm_mem_shrink object. | ||
| 108 | * | ||
| 109 | * @glob: The struct ttm_mem_global object to register with. | ||
| 110 | * @shrink: An initialized struct ttm_mem_shrink object to register. | ||
| 111 | * | ||
| 112 | * Returns: | ||
| 113 | * -EBUSY: There's already a callback registered. (May change). | ||
| 114 | */ | ||
| 115 | |||
| 116 | static inline int ttm_mem_register_shrink(struct ttm_mem_global *glob, | ||
| 117 | struct ttm_mem_shrink *shrink) | ||
| 118 | { | ||
| 119 | spin_lock(&glob->lock); | ||
| 120 | if (glob->shrink != NULL) { | ||
| 121 | spin_unlock(&glob->lock); | ||
| 122 | return -EBUSY; | ||
| 123 | } | ||
| 124 | glob->shrink = shrink; | ||
| 125 | spin_unlock(&glob->lock); | ||
| 126 | return 0; | ||
| 127 | } | ||
| 128 | |||
| 129 | /** | ||
| 130 | * ttm_mem_unregister_shrink - unregister a struct ttm_mem_shrink object. | ||
| 131 | * | ||
| 132 | * @glob: The struct ttm_mem_global object to unregister from. | ||
| 133 | * @shrink: A previously registert struct ttm_mem_shrink object. | ||
| 134 | * | ||
| 135 | */ | ||
| 136 | |||
| 137 | static inline void ttm_mem_unregister_shrink(struct ttm_mem_global *glob, | ||
| 138 | struct ttm_mem_shrink *shrink) | ||
| 139 | { | ||
| 140 | spin_lock(&glob->lock); | ||
| 141 | BUG_ON(glob->shrink != shrink); | ||
| 142 | glob->shrink = NULL; | ||
| 143 | spin_unlock(&glob->lock); | ||
| 144 | } | ||
| 145 | |||
| 146 | extern int ttm_mem_global_init(struct ttm_mem_global *glob); | ||
| 147 | extern void ttm_mem_global_release(struct ttm_mem_global *glob); | ||
| 148 | extern int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory, | ||
| 149 | bool no_wait, bool interruptible, bool himem); | ||
| 150 | extern void ttm_mem_global_free(struct ttm_mem_global *glob, | ||
| 151 | uint64_t amount, bool himem); | ||
| 152 | extern size_t ttm_round_pot(size_t size); | ||
| 153 | #endif | ||
diff --git a/include/drm/ttm/ttm_module.h b/include/drm/ttm/ttm_module.h new file mode 100644 index 000000000000..889a4c7958ae --- /dev/null +++ b/include/drm/ttm/ttm_module.h | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | /************************************************************************** | ||
| 2 | * | ||
| 3 | * Copyright 2008-2009 VMware, Inc., Palo Alto, CA., USA | ||
| 4 | * All Rights Reserved. | ||
| 5 | * | ||
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 7 | * copy of this software and associated documentation files (the | ||
| 8 | * "Software"), to deal in the Software without restriction, including | ||
| 9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
| 10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
| 11 | * permit persons to whom the Software is furnished to do so, subject to | ||
| 12 | * the following conditions: | ||
| 13 | * | ||
| 14 | * The above copyright notice and this permission notice (including the | ||
| 15 | * next paragraph) shall be included in all copies or substantial portions | ||
| 16 | * of the Software. | ||
| 17 | * | ||
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
| 21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
| 22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
| 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
| 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 25 | * | ||
| 26 | **************************************************************************/ | ||
| 27 | /* | ||
| 28 | * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> | ||
| 29 | */ | ||
| 30 | |||
| 31 | #ifndef _TTM_MODULE_H_ | ||
| 32 | #define _TTM_MODULE_H_ | ||
| 33 | |||
| 34 | #include <linux/kernel.h> | ||
| 35 | |||
| 36 | #define TTM_PFX "[TTM]" | ||
| 37 | |||
| 38 | enum ttm_global_types { | ||
| 39 | TTM_GLOBAL_TTM_MEM = 0, | ||
| 40 | TTM_GLOBAL_TTM_BO, | ||
| 41 | TTM_GLOBAL_TTM_OBJECT, | ||
| 42 | TTM_GLOBAL_NUM | ||
| 43 | }; | ||
| 44 | |||
| 45 | struct ttm_global_reference { | ||
| 46 | enum ttm_global_types global_type; | ||
| 47 | size_t size; | ||
| 48 | void *object; | ||
| 49 | int (*init) (struct ttm_global_reference *); | ||
| 50 | void (*release) (struct ttm_global_reference *); | ||
| 51 | }; | ||
| 52 | |||
| 53 | extern void ttm_global_init(void); | ||
| 54 | extern void ttm_global_release(void); | ||
| 55 | extern int ttm_global_item_ref(struct ttm_global_reference *ref); | ||
| 56 | extern void ttm_global_item_unref(struct ttm_global_reference *ref); | ||
| 57 | |||
| 58 | #endif /* _TTM_MODULE_H_ */ | ||
diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h new file mode 100644 index 000000000000..c84ff153a564 --- /dev/null +++ b/include/drm/ttm/ttm_placement.h | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | /************************************************************************** | ||
| 2 | * | ||
| 3 | * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA | ||
| 4 | * All Rights Reserved. | ||
| 5 | * | ||
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 7 | * copy of this software and associated documentation files (the | ||
| 8 | * "Software"), to deal in the Software without restriction, including | ||
| 9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
| 10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
| 11 | * permit persons to whom the Software is furnished to do so, subject to | ||
| 12 | * the following conditions: | ||
| 13 | * | ||
| 14 | * The above copyright notice and this permission notice (including the | ||
| 15 | * next paragraph) shall be included in all copies or substantial portions | ||
| 16 | * of the Software. | ||
| 17 | * | ||
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
| 21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
| 22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
| 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
| 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 25 | * | ||
| 26 | **************************************************************************/ | ||
| 27 | /* | ||
| 28 | * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> | ||
| 29 | */ | ||
| 30 | |||
| 31 | #ifndef _TTM_PLACEMENT_H_ | ||
| 32 | #define _TTM_PLACEMENT_H_ | ||
| 33 | /* | ||
| 34 | * Memory regions for data placement. | ||
| 35 | */ | ||
| 36 | |||
| 37 | #define TTM_PL_SYSTEM 0 | ||
| 38 | #define TTM_PL_TT 1 | ||
| 39 | #define TTM_PL_VRAM 2 | ||
| 40 | #define TTM_PL_PRIV0 3 | ||
| 41 | #define TTM_PL_PRIV1 4 | ||
| 42 | #define TTM_PL_PRIV2 5 | ||
| 43 | #define TTM_PL_PRIV3 6 | ||
| 44 | #define TTM_PL_PRIV4 7 | ||
| 45 | #define TTM_PL_PRIV5 8 | ||
| 46 | #define TTM_PL_SWAPPED 15 | ||
| 47 | |||
| 48 | #define TTM_PL_FLAG_SYSTEM (1 << TTM_PL_SYSTEM) | ||
| 49 | #define TTM_PL_FLAG_TT (1 << TTM_PL_TT) | ||
| 50 | #define TTM_PL_FLAG_VRAM (1 << TTM_PL_VRAM) | ||
| 51 | #define TTM_PL_FLAG_PRIV0 (1 << TTM_PL_PRIV0) | ||
| 52 | #define TTM_PL_FLAG_PRIV1 (1 << TTM_PL_PRIV1) | ||
| 53 | #define TTM_PL_FLAG_PRIV2 (1 << TTM_PL_PRIV2) | ||
| 54 | #define TTM_PL_FLAG_PRIV3 (1 << TTM_PL_PRIV3) | ||
| 55 | #define TTM_PL_FLAG_PRIV4 (1 << TTM_PL_PRIV4) | ||
| 56 | #define TTM_PL_FLAG_PRIV5 (1 << TTM_PL_PRIV5) | ||
| 57 | #define TTM_PL_FLAG_SWAPPED (1 << TTM_PL_SWAPPED) | ||
| 58 | #define TTM_PL_MASK_MEM 0x0000FFFF | ||
| 59 | |||
| 60 | /* | ||
| 61 | * Other flags that affects data placement. | ||
| 62 | * TTM_PL_FLAG_CACHED indicates cache-coherent mappings | ||
| 63 | * if available. | ||
| 64 | * TTM_PL_FLAG_SHARED means that another application may | ||
| 65 | * reference the buffer. | ||
| 66 | * TTM_PL_FLAG_NO_EVICT means that the buffer may never | ||
| 67 | * be evicted to make room for other buffers. | ||
| 68 | */ | ||
| 69 | |||
| 70 | #define TTM_PL_FLAG_CACHED (1 << 16) | ||
| 71 | #define TTM_PL_FLAG_UNCACHED (1 << 17) | ||
| 72 | #define TTM_PL_FLAG_WC (1 << 18) | ||
| 73 | #define TTM_PL_FLAG_SHARED (1 << 20) | ||
| 74 | #define TTM_PL_FLAG_NO_EVICT (1 << 21) | ||
| 75 | |||
| 76 | #define TTM_PL_MASK_CACHING (TTM_PL_FLAG_CACHED | \ | ||
| 77 | TTM_PL_FLAG_UNCACHED | \ | ||
| 78 | TTM_PL_FLAG_WC) | ||
| 79 | |||
| 80 | #define TTM_PL_MASK_MEMTYPE (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING) | ||
| 81 | |||
| 82 | /* | ||
| 83 | * Access flags to be used for CPU- and GPU- mappings. | ||
| 84 | * The idea is that the TTM synchronization mechanism will | ||
| 85 | * allow concurrent READ access and exclusive write access. | ||
| 86 | * Currently GPU- and CPU accesses are exclusive. | ||
| 87 | */ | ||
| 88 | |||
| 89 | #define TTM_ACCESS_READ (1 << 0) | ||
| 90 | #define TTM_ACCESS_WRITE (1 << 1) | ||
| 91 | |||
| 92 | #endif | ||
diff --git a/include/linux/adfs_fs.h b/include/linux/adfs_fs.h index ef788c2085a1..b19801f73890 100644 --- a/include/linux/adfs_fs.h +++ b/include/linux/adfs_fs.h | |||
| @@ -41,8 +41,6 @@ struct adfs_discrecord { | |||
| 41 | #define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3) | 41 | #define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3) |
| 42 | 42 | ||
| 43 | #ifdef __KERNEL__ | 43 | #ifdef __KERNEL__ |
| 44 | #include <linux/adfs_fs_i.h> | ||
| 45 | #include <linux/adfs_fs_sb.h> | ||
| 46 | /* | 44 | /* |
| 47 | * Calculate the boot block checksum on an ADFS drive. Note that this will | 45 | * Calculate the boot block checksum on an ADFS drive. Note that this will |
| 48 | * appear to be correct if the sector contains all zeros, so also check that | 46 | * appear to be correct if the sector contains all zeros, so also check that |
| @@ -60,17 +58,6 @@ static inline int adfs_checkbblk(unsigned char *ptr) | |||
| 60 | 58 | ||
| 61 | return (result & 0xff) != ptr[511]; | 59 | return (result & 0xff) != ptr[511]; |
| 62 | } | 60 | } |
| 63 | |||
| 64 | static inline struct adfs_sb_info *ADFS_SB(struct super_block *sb) | ||
| 65 | { | ||
| 66 | return sb->s_fs_info; | ||
| 67 | } | ||
| 68 | |||
| 69 | static inline struct adfs_inode_info *ADFS_I(struct inode *inode) | ||
| 70 | { | ||
| 71 | return container_of(inode, struct adfs_inode_info, vfs_inode); | ||
| 72 | } | ||
| 73 | |||
| 74 | #endif | 61 | #endif |
| 75 | 62 | ||
| 76 | #endif | 63 | #endif |
diff --git a/include/linux/adfs_fs_i.h b/include/linux/adfs_fs_i.h deleted file mode 100644 index cb543034e54f..000000000000 --- a/include/linux/adfs_fs_i.h +++ /dev/null | |||
| @@ -1,24 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * linux/include/linux/adfs_fs_i.h | ||
| 3 | * | ||
| 4 | * Copyright (C) 1997 Russell King | ||
| 5 | */ | ||
| 6 | |||
| 7 | #ifndef _ADFS_FS_I | ||
| 8 | #define _ADFS_FS_I | ||
| 9 | |||
| 10 | /* | ||
| 11 | * adfs file system inode data in memory | ||
| 12 | */ | ||
| 13 | struct adfs_inode_info { | ||
| 14 | loff_t mmu_private; | ||
| 15 | unsigned long parent_id; /* object id of parent */ | ||
| 16 | __u32 loadaddr; /* RISC OS load address */ | ||
| 17 | __u32 execaddr; /* RISC OS exec address */ | ||
| 18 | unsigned int filetype; /* RISC OS file type */ | ||
| 19 | unsigned int attr; /* RISC OS permissions */ | ||
| 20 | unsigned int stamped:1; /* RISC OS file has date/time */ | ||
| 21 | struct inode vfs_inode; | ||
| 22 | }; | ||
| 23 | |||
| 24 | #endif | ||
diff --git a/include/linux/adfs_fs_sb.h b/include/linux/adfs_fs_sb.h deleted file mode 100644 index d9bf05c02ccc..000000000000 --- a/include/linux/adfs_fs_sb.h +++ /dev/null | |||
| @@ -1,38 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * linux/include/linux/adfs_fs_sb.h | ||
| 3 | * | ||
| 4 | * Copyright (C) 1997-1999 Russell King | ||
| 5 | */ | ||
| 6 | |||
| 7 | #ifndef _ADFS_FS_SB | ||
| 8 | #define _ADFS_FS_SB | ||
| 9 | |||
| 10 | /* | ||
| 11 | * Forward-declare this | ||
| 12 | */ | ||
| 13 | struct adfs_discmap; | ||
| 14 | struct adfs_dir_ops; | ||
| 15 | |||
| 16 | /* | ||
| 17 | * ADFS file system superblock data in memory | ||
| 18 | */ | ||
| 19 | struct adfs_sb_info { | ||
| 20 | struct adfs_discmap *s_map; /* bh list containing map */ | ||
| 21 | struct adfs_dir_ops *s_dir; /* directory operations */ | ||
| 22 | |||
| 23 | uid_t s_uid; /* owner uid */ | ||
| 24 | gid_t s_gid; /* owner gid */ | ||
| 25 | umode_t s_owner_mask; /* ADFS owner perm -> unix perm */ | ||
| 26 | umode_t s_other_mask; /* ADFS other perm -> unix perm */ | ||
| 27 | |||
| 28 | __u32 s_ids_per_zone; /* max. no ids in one zone */ | ||
| 29 | __u32 s_idlen; /* length of ID in map */ | ||
| 30 | __u32 s_map_size; /* sector size of a map */ | ||
| 31 | unsigned long s_size; /* total size (in blocks) of this fs */ | ||
| 32 | signed int s_map2blk; /* shift left by this for map->sector */ | ||
| 33 | unsigned int s_log2sharesize;/* log2 share size */ | ||
| 34 | __le32 s_version; /* disc format version */ | ||
| 35 | unsigned int s_namelen; /* maximum number of characters in name */ | ||
| 36 | }; | ||
| 37 | |||
| 38 | #endif | ||
diff --git a/include/linux/bug.h b/include/linux/bug.h index 54398d2c6d8d..d276b5510c83 100644 --- a/include/linux/bug.h +++ b/include/linux/bug.h | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | #ifndef _LINUX_BUG_H | 1 | #ifndef _LINUX_BUG_H |
| 2 | #define _LINUX_BUG_H | 2 | #define _LINUX_BUG_H |
| 3 | 3 | ||
| 4 | #include <linux/module.h> | ||
| 5 | #include <asm/bug.h> | 4 | #include <asm/bug.h> |
| 6 | 5 | ||
| 7 | enum bug_trap_type { | 6 | enum bug_trap_type { |
| @@ -24,10 +23,6 @@ const struct bug_entry *find_bug(unsigned long bugaddr); | |||
| 24 | 23 | ||
| 25 | enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs); | 24 | enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs); |
| 26 | 25 | ||
| 27 | int module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *, | ||
| 28 | struct module *); | ||
| 29 | void module_bug_cleanup(struct module *); | ||
| 30 | |||
| 31 | /* These are defined by the architecture */ | 26 | /* These are defined by the architecture */ |
| 32 | int is_valid_bugaddr(unsigned long addr); | 27 | int is_valid_bugaddr(unsigned long addr); |
| 33 | 28 | ||
| @@ -38,13 +33,6 @@ static inline enum bug_trap_type report_bug(unsigned long bug_addr, | |||
| 38 | { | 33 | { |
| 39 | return BUG_TRAP_TYPE_BUG; | 34 | return BUG_TRAP_TYPE_BUG; |
| 40 | } | 35 | } |
| 41 | static inline int module_bug_finalize(const Elf_Ehdr *hdr, | ||
| 42 | const Elf_Shdr *sechdrs, | ||
| 43 | struct module *mod) | ||
| 44 | { | ||
| 45 | return 0; | ||
| 46 | } | ||
| 47 | static inline void module_bug_cleanup(struct module *mod) {} | ||
| 48 | 36 | ||
| 49 | #endif /* CONFIG_GENERIC_BUG */ | 37 | #endif /* CONFIG_GENERIC_BUG */ |
| 50 | #endif /* _LINUX_BUG_H */ | 38 | #endif /* _LINUX_BUG_H */ |
diff --git a/include/linux/c2port.h b/include/linux/c2port.h index 7b5a2388ba67..2a5cd867c365 100644 --- a/include/linux/c2port.h +++ b/include/linux/c2port.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #include <linux/device.h> | 12 | #include <linux/device.h> |
| 13 | #include <linux/kmemcheck.h> | ||
| 13 | 14 | ||
| 14 | #define C2PORT_NAME_LEN 32 | 15 | #define C2PORT_NAME_LEN 32 |
| 15 | 16 | ||
| @@ -20,8 +21,10 @@ | |||
| 20 | /* Main struct */ | 21 | /* Main struct */ |
| 21 | struct c2port_ops; | 22 | struct c2port_ops; |
| 22 | struct c2port_device { | 23 | struct c2port_device { |
| 24 | kmemcheck_bitfield_begin(flags); | ||
| 23 | unsigned int access:1; | 25 | unsigned int access:1; |
| 24 | unsigned int flash_access:1; | 26 | unsigned int flash_access:1; |
| 27 | kmemcheck_bitfield_end(flags); | ||
| 25 | 28 | ||
| 26 | int id; | 29 | int id; |
| 27 | char name[C2PORT_NAME_LEN]; | 30 | char name[C2PORT_NAME_LEN]; |
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index 05ea1dd7d681..a5740fc4d04b 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h | |||
| @@ -18,7 +18,6 @@ | |||
| 18 | 18 | ||
| 19 | extern int number_of_cpusets; /* How many cpusets are defined in system? */ | 19 | extern int number_of_cpusets; /* How many cpusets are defined in system? */ |
| 20 | 20 | ||
| 21 | extern int cpuset_init_early(void); | ||
| 22 | extern int cpuset_init(void); | 21 | extern int cpuset_init(void); |
| 23 | extern void cpuset_init_smp(void); | 22 | extern void cpuset_init_smp(void); |
| 24 | extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask); | 23 | extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask); |
| @@ -27,7 +26,6 @@ extern void cpuset_cpus_allowed_locked(struct task_struct *p, | |||
| 27 | extern nodemask_t cpuset_mems_allowed(struct task_struct *p); | 26 | extern nodemask_t cpuset_mems_allowed(struct task_struct *p); |
| 28 | #define cpuset_current_mems_allowed (current->mems_allowed) | 27 | #define cpuset_current_mems_allowed (current->mems_allowed) |
| 29 | void cpuset_init_current_mems_allowed(void); | 28 | void cpuset_init_current_mems_allowed(void); |
| 30 | void cpuset_update_task_memory_state(void); | ||
| 31 | int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask); | 29 | int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask); |
| 32 | 30 | ||
| 33 | extern int __cpuset_node_allowed_softwall(int node, gfp_t gfp_mask); | 31 | extern int __cpuset_node_allowed_softwall(int node, gfp_t gfp_mask); |
| @@ -92,9 +90,13 @@ extern void rebuild_sched_domains(void); | |||
| 92 | 90 | ||
| 93 | extern void cpuset_print_task_mems_allowed(struct task_struct *p); | 91 | extern void cpuset_print_task_mems_allowed(struct task_struct *p); |
| 94 | 92 | ||
| 93 | static inline void set_mems_allowed(nodemask_t nodemask) | ||
| 94 | { | ||
| 95 | current->mems_allowed = nodemask; | ||
| 96 | } | ||
| 97 | |||
| 95 | #else /* !CONFIG_CPUSETS */ | 98 | #else /* !CONFIG_CPUSETS */ |
| 96 | 99 | ||
| 97 | static inline int cpuset_init_early(void) { return 0; } | ||
| 98 | static inline int cpuset_init(void) { return 0; } | 100 | static inline int cpuset_init(void) { return 0; } |
| 99 | static inline void cpuset_init_smp(void) {} | 101 | static inline void cpuset_init_smp(void) {} |
| 100 | 102 | ||
| @@ -116,7 +118,6 @@ static inline nodemask_t cpuset_mems_allowed(struct task_struct *p) | |||
| 116 | 118 | ||
| 117 | #define cpuset_current_mems_allowed (node_states[N_HIGH_MEMORY]) | 119 | #define cpuset_current_mems_allowed (node_states[N_HIGH_MEMORY]) |
| 118 | static inline void cpuset_init_current_mems_allowed(void) {} | 120 | static inline void cpuset_init_current_mems_allowed(void) {} |
| 119 | static inline void cpuset_update_task_memory_state(void) {} | ||
| 120 | 121 | ||
| 121 | static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask) | 122 | static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask) |
| 122 | { | 123 | { |
| @@ -188,6 +189,10 @@ static inline void cpuset_print_task_mems_allowed(struct task_struct *p) | |||
| 188 | { | 189 | { |
| 189 | } | 190 | } |
| 190 | 191 | ||
| 192 | static inline void set_mems_allowed(nodemask_t nodemask) | ||
| 193 | { | ||
| 194 | } | ||
| 195 | |||
| 191 | #endif /* !CONFIG_CPUSETS */ | 196 | #endif /* !CONFIG_CPUSETS */ |
| 192 | 197 | ||
| 193 | #endif /* _LINUX_CPUSET_H */ | 198 | #endif /* _LINUX_CPUSET_H */ |
diff --git a/include/linux/device.h b/include/linux/device.h index a4a7b10aaa48..ed4e39f2c423 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -114,6 +114,8 @@ extern int bus_unregister_notifier(struct bus_type *bus, | |||
| 114 | #define BUS_NOTIFY_BOUND_DRIVER 0x00000003 /* driver bound to device */ | 114 | #define BUS_NOTIFY_BOUND_DRIVER 0x00000003 /* driver bound to device */ |
| 115 | #define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be | 115 | #define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be |
| 116 | unbound */ | 116 | unbound */ |
| 117 | #define BUS_NOTIFY_UNBOUND_DRIVER 0x00000005 /* driver is unbound | ||
| 118 | from the device */ | ||
| 117 | 119 | ||
| 118 | extern struct kset *bus_get_kset(struct bus_type *bus); | 120 | extern struct kset *bus_get_kset(struct bus_type *bus); |
| 119 | extern struct klist *bus_get_device_klist(struct bus_type *bus); | 121 | extern struct klist *bus_get_device_klist(struct bus_type *bus); |
| @@ -192,6 +194,7 @@ struct class { | |||
| 192 | struct kobject *dev_kobj; | 194 | struct kobject *dev_kobj; |
| 193 | 195 | ||
| 194 | int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); | 196 | int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); |
| 197 | char *(*nodename)(struct device *dev); | ||
| 195 | 198 | ||
| 196 | void (*class_release)(struct class *class); | 199 | void (*class_release)(struct class *class); |
| 197 | void (*dev_release)(struct device *dev); | 200 | void (*dev_release)(struct device *dev); |
| @@ -287,6 +290,7 @@ struct device_type { | |||
| 287 | const char *name; | 290 | const char *name; |
| 288 | struct attribute_group **groups; | 291 | struct attribute_group **groups; |
| 289 | int (*uevent)(struct device *dev, struct kobj_uevent_env *env); | 292 | int (*uevent)(struct device *dev, struct kobj_uevent_env *env); |
| 293 | char *(*nodename)(struct device *dev); | ||
| 290 | void (*release)(struct device *dev); | 294 | void (*release)(struct device *dev); |
| 291 | 295 | ||
| 292 | struct dev_pm_ops *pm; | 296 | struct dev_pm_ops *pm; |
| @@ -486,6 +490,7 @@ extern struct device *device_find_child(struct device *dev, void *data, | |||
| 486 | extern int device_rename(struct device *dev, char *new_name); | 490 | extern int device_rename(struct device *dev, char *new_name); |
| 487 | extern int device_move(struct device *dev, struct device *new_parent, | 491 | extern int device_move(struct device *dev, struct device *new_parent, |
| 488 | enum dpm_order dpm_order); | 492 | enum dpm_order dpm_order); |
| 493 | extern const char *device_get_nodename(struct device *dev, const char **tmp); | ||
| 489 | 494 | ||
| 490 | /* | 495 | /* |
| 491 | * Root device objects for grouping under /sys/devices | 496 | * Root device objects for grouping under /sys/devices |
diff --git a/include/linux/eisa.h b/include/linux/eisa.h index e61c0be2a459..6925249a5ac6 100644 --- a/include/linux/eisa.h +++ b/include/linux/eisa.h | |||
| @@ -78,12 +78,12 @@ static inline void eisa_driver_unregister (struct eisa_driver *edrv) { } | |||
| 78 | /* Mimics pci.h... */ | 78 | /* Mimics pci.h... */ |
| 79 | static inline void *eisa_get_drvdata (struct eisa_device *edev) | 79 | static inline void *eisa_get_drvdata (struct eisa_device *edev) |
| 80 | { | 80 | { |
| 81 | return edev->dev.driver_data; | 81 | return dev_get_drvdata(&edev->dev); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | static inline void eisa_set_drvdata (struct eisa_device *edev, void *data) | 84 | static inline void eisa_set_drvdata (struct eisa_device *edev, void *data) |
| 85 | { | 85 | { |
| 86 | edev->dev.driver_data = data; | 86 | dev_set_drvdata(&edev->dev, data); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | /* The EISA root device. There's rumours about machines with multiple | 89 | /* The EISA root device. There's rumours about machines with multiple |
diff --git a/include/linux/fb.h b/include/linux/fb.h index 330c4b1bfcaa..dd68358996b7 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
| @@ -677,6 +677,9 @@ struct fb_ops { | |||
| 677 | /* get capability given var */ | 677 | /* get capability given var */ |
| 678 | void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps, | 678 | void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps, |
| 679 | struct fb_var_screeninfo *var); | 679 | struct fb_var_screeninfo *var); |
| 680 | |||
| 681 | /* teardown any resources to do with this framebuffer */ | ||
| 682 | void (*fb_destroy)(struct fb_info *info); | ||
| 680 | }; | 683 | }; |
| 681 | 684 | ||
| 682 | #ifdef CONFIG_FB_TILEBLITTING | 685 | #ifdef CONFIG_FB_TILEBLITTING |
| @@ -786,6 +789,8 @@ struct fb_tile_ops { | |||
| 786 | #define FBINFO_MISC_USEREVENT 0x10000 /* event request | 789 | #define FBINFO_MISC_USEREVENT 0x10000 /* event request |
| 787 | from userspace */ | 790 | from userspace */ |
| 788 | #define FBINFO_MISC_TILEBLITTING 0x20000 /* use tile blitting */ | 791 | #define FBINFO_MISC_TILEBLITTING 0x20000 /* use tile blitting */ |
| 792 | #define FBINFO_MISC_FIRMWARE 0x40000 /* a replaceable firmware | ||
| 793 | inited framebuffer */ | ||
| 789 | 794 | ||
| 790 | /* A driver may set this flag to indicate that it does want a set_par to be | 795 | /* A driver may set this flag to indicate that it does want a set_par to be |
| 791 | * called every time when fbcon_switch is executed. The advantage is that with | 796 | * called every time when fbcon_switch is executed. The advantage is that with |
| @@ -854,7 +859,12 @@ struct fb_info { | |||
| 854 | u32 state; /* Hardware state i.e suspend */ | 859 | u32 state; /* Hardware state i.e suspend */ |
| 855 | void *fbcon_par; /* fbcon use-only private area */ | 860 | void *fbcon_par; /* fbcon use-only private area */ |
| 856 | /* From here on everything is device dependent */ | 861 | /* From here on everything is device dependent */ |
| 857 | void *par; | 862 | void *par; |
| 863 | /* we need the PCI or similiar aperture base/size not | ||
| 864 | smem_start/size as smem_start may just be an object | ||
| 865 | allocated inside the aperture so may not actually overlap */ | ||
| 866 | resource_size_t aperture_base; | ||
| 867 | resource_size_t aperture_size; | ||
| 858 | }; | 868 | }; |
| 859 | 869 | ||
| 860 | #ifdef MODULE | 870 | #ifdef MODULE |
| @@ -893,7 +903,7 @@ struct fb_info { | |||
| 893 | #define fb_writeq sbus_writeq | 903 | #define fb_writeq sbus_writeq |
| 894 | #define fb_memset sbus_memset_io | 904 | #define fb_memset sbus_memset_io |
| 895 | 905 | ||
| 896 | #elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) | 906 | #elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__) |
| 897 | 907 | ||
| 898 | #define fb_readb __raw_readb | 908 | #define fb_readb __raw_readb |
| 899 | #define fb_readw __raw_readw | 909 | #define fb_readw __raw_readw |
diff --git a/include/linux/firewire.h b/include/linux/firewire.h new file mode 100644 index 000000000000..e584b7215e8b --- /dev/null +++ b/include/linux/firewire.h | |||
| @@ -0,0 +1,358 @@ | |||
| 1 | #ifndef _LINUX_FIREWIRE_H | ||
| 2 | #define _LINUX_FIREWIRE_H | ||
| 3 | |||
| 4 | #include <linux/completion.h> | ||
| 5 | #include <linux/device.h> | ||
| 6 | #include <linux/kernel.h> | ||
| 7 | #include <linux/kref.h> | ||
| 8 | #include <linux/list.h> | ||
| 9 | #include <linux/mutex.h> | ||
| 10 | #include <linux/spinlock.h> | ||
| 11 | #include <linux/sysfs.h> | ||
| 12 | #include <linux/timer.h> | ||
| 13 | #include <linux/types.h> | ||
| 14 | #include <linux/workqueue.h> | ||
| 15 | |||
| 16 | #include <asm/atomic.h> | ||
| 17 | #include <asm/byteorder.h> | ||
| 18 | |||
| 19 | #define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args) | ||
| 20 | #define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args) | ||
| 21 | |||
| 22 | static inline void fw_memcpy_from_be32(void *_dst, void *_src, size_t size) | ||
| 23 | { | ||
| 24 | u32 *dst = _dst; | ||
| 25 | __be32 *src = _src; | ||
| 26 | int i; | ||
| 27 | |||
| 28 | for (i = 0; i < size / 4; i++) | ||
| 29 | dst[i] = be32_to_cpu(src[i]); | ||
| 30 | } | ||
| 31 | |||
| 32 | static inline void fw_memcpy_to_be32(void *_dst, void *_src, size_t size) | ||
| 33 | { | ||
| 34 | fw_memcpy_from_be32(_dst, _src, size); | ||
| 35 | } | ||
| 36 | #define CSR_REGISTER_BASE 0xfffff0000000ULL | ||
| 37 | |||
| 38 | /* register offsets are relative to CSR_REGISTER_BASE */ | ||
| 39 | #define CSR_STATE_CLEAR 0x0 | ||
| 40 | #define CSR_STATE_SET 0x4 | ||
| 41 | #define CSR_NODE_IDS 0x8 | ||
| 42 | #define CSR_RESET_START 0xc | ||
| 43 | #define CSR_SPLIT_TIMEOUT_HI 0x18 | ||
| 44 | #define CSR_SPLIT_TIMEOUT_LO 0x1c | ||
| 45 | #define CSR_CYCLE_TIME 0x200 | ||
| 46 | #define CSR_BUS_TIME 0x204 | ||
| 47 | #define CSR_BUSY_TIMEOUT 0x210 | ||
| 48 | #define CSR_BUS_MANAGER_ID 0x21c | ||
| 49 | #define CSR_BANDWIDTH_AVAILABLE 0x220 | ||
| 50 | #define CSR_CHANNELS_AVAILABLE 0x224 | ||
| 51 | #define CSR_CHANNELS_AVAILABLE_HI 0x224 | ||
| 52 | #define CSR_CHANNELS_AVAILABLE_LO 0x228 | ||
| 53 | #define CSR_BROADCAST_CHANNEL 0x234 | ||
| 54 | #define CSR_CONFIG_ROM 0x400 | ||
| 55 | #define CSR_CONFIG_ROM_END 0x800 | ||
| 56 | #define CSR_FCP_COMMAND 0xB00 | ||
| 57 | #define CSR_FCP_RESPONSE 0xD00 | ||
| 58 | #define CSR_FCP_END 0xF00 | ||
| 59 | #define CSR_TOPOLOGY_MAP 0x1000 | ||
| 60 | #define CSR_TOPOLOGY_MAP_END 0x1400 | ||
| 61 | #define CSR_SPEED_MAP 0x2000 | ||
| 62 | #define CSR_SPEED_MAP_END 0x3000 | ||
| 63 | |||
| 64 | #define CSR_OFFSET 0x40 | ||
| 65 | #define CSR_LEAF 0x80 | ||
| 66 | #define CSR_DIRECTORY 0xc0 | ||
| 67 | |||
| 68 | #define CSR_DESCRIPTOR 0x01 | ||
| 69 | #define CSR_VENDOR 0x03 | ||
| 70 | #define CSR_HARDWARE_VERSION 0x04 | ||
| 71 | #define CSR_NODE_CAPABILITIES 0x0c | ||
| 72 | #define CSR_UNIT 0x11 | ||
| 73 | #define CSR_SPECIFIER_ID 0x12 | ||
| 74 | #define CSR_VERSION 0x13 | ||
| 75 | #define CSR_DEPENDENT_INFO 0x14 | ||
| 76 | #define CSR_MODEL 0x17 | ||
| 77 | #define CSR_INSTANCE 0x18 | ||
| 78 | #define CSR_DIRECTORY_ID 0x20 | ||
| 79 | |||
| 80 | struct fw_csr_iterator { | ||
| 81 | u32 *p; | ||
| 82 | u32 *end; | ||
| 83 | }; | ||
| 84 | |||
| 85 | void fw_csr_iterator_init(struct fw_csr_iterator *ci, u32 *p); | ||
| 86 | int fw_csr_iterator_next(struct fw_csr_iterator *ci, int *key, int *value); | ||
| 87 | |||
| 88 | extern struct bus_type fw_bus_type; | ||
| 89 | |||
| 90 | struct fw_card_driver; | ||
| 91 | struct fw_node; | ||
| 92 | |||
| 93 | struct fw_card { | ||
| 94 | const struct fw_card_driver *driver; | ||
| 95 | struct device *device; | ||
| 96 | struct kref kref; | ||
| 97 | struct completion done; | ||
| 98 | |||
| 99 | int node_id; | ||
| 100 | int generation; | ||
| 101 | int current_tlabel; | ||
| 102 | u64 tlabel_mask; | ||
| 103 | struct list_head transaction_list; | ||
| 104 | struct timer_list flush_timer; | ||
| 105 | unsigned long reset_jiffies; | ||
| 106 | |||
| 107 | unsigned long long guid; | ||
| 108 | unsigned max_receive; | ||
| 109 | int link_speed; | ||
| 110 | int config_rom_generation; | ||
| 111 | |||
| 112 | spinlock_t lock; /* Take this lock when handling the lists in | ||
| 113 | * this struct. */ | ||
| 114 | struct fw_node *local_node; | ||
| 115 | struct fw_node *root_node; | ||
| 116 | struct fw_node *irm_node; | ||
| 117 | u8 color; /* must be u8 to match the definition in struct fw_node */ | ||
| 118 | int gap_count; | ||
| 119 | bool beta_repeaters_present; | ||
| 120 | |||
| 121 | int index; | ||
| 122 | |||
| 123 | struct list_head link; | ||
| 124 | |||
| 125 | /* Work struct for BM duties. */ | ||
| 126 | struct delayed_work work; | ||
| 127 | int bm_retries; | ||
| 128 | int bm_generation; | ||
| 129 | |||
| 130 | bool broadcast_channel_allocated; | ||
| 131 | u32 broadcast_channel; | ||
| 132 | u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4]; | ||
| 133 | }; | ||
| 134 | |||
| 135 | static inline struct fw_card *fw_card_get(struct fw_card *card) | ||
| 136 | { | ||
| 137 | kref_get(&card->kref); | ||
| 138 | |||
| 139 | return card; | ||
| 140 | } | ||
| 141 | |||
| 142 | void fw_card_release(struct kref *kref); | ||
| 143 | |||
| 144 | static inline void fw_card_put(struct fw_card *card) | ||
| 145 | { | ||
| 146 | kref_put(&card->kref, fw_card_release); | ||
| 147 | } | ||
| 148 | |||
| 149 | struct fw_attribute_group { | ||
| 150 | struct attribute_group *groups[2]; | ||
| 151 | struct attribute_group group; | ||
| 152 | struct attribute *attrs[12]; | ||
| 153 | }; | ||
| 154 | |||
| 155 | enum fw_device_state { | ||
| 156 | FW_DEVICE_INITIALIZING, | ||
| 157 | FW_DEVICE_RUNNING, | ||
| 158 | FW_DEVICE_GONE, | ||
| 159 | FW_DEVICE_SHUTDOWN, | ||
| 160 | }; | ||
| 161 | |||
| 162 | /* | ||
| 163 | * Note, fw_device.generation always has to be read before fw_device.node_id. | ||
| 164 | * Use SMP memory barriers to ensure this. Otherwise requests will be sent | ||
| 165 | * to an outdated node_id if the generation was updated in the meantime due | ||
| 166 | * to a bus reset. | ||
| 167 | * | ||
| 168 | * Likewise, fw-core will take care to update .node_id before .generation so | ||
| 169 | * that whenever fw_device.generation is current WRT the actual bus generation, | ||
| 170 | * fw_device.node_id is guaranteed to be current too. | ||
| 171 | * | ||
| 172 | * The same applies to fw_device.card->node_id vs. fw_device.generation. | ||
| 173 | * | ||
| 174 | * fw_device.config_rom and fw_device.config_rom_length may be accessed during | ||
| 175 | * the lifetime of any fw_unit belonging to the fw_device, before device_del() | ||
| 176 | * was called on the last fw_unit. Alternatively, they may be accessed while | ||
| 177 | * holding fw_device_rwsem. | ||
| 178 | */ | ||
| 179 | struct fw_device { | ||
| 180 | atomic_t state; | ||
| 181 | struct fw_node *node; | ||
| 182 | int node_id; | ||
| 183 | int generation; | ||
| 184 | unsigned max_speed; | ||
| 185 | struct fw_card *card; | ||
| 186 | struct device device; | ||
| 187 | |||
| 188 | struct mutex client_list_mutex; | ||
| 189 | struct list_head client_list; | ||
| 190 | |||
| 191 | u32 *config_rom; | ||
| 192 | size_t config_rom_length; | ||
| 193 | int config_rom_retries; | ||
| 194 | unsigned is_local:1; | ||
| 195 | unsigned max_rec:4; | ||
| 196 | unsigned cmc:1; | ||
| 197 | unsigned irmc:1; | ||
| 198 | unsigned bc_implemented:2; | ||
| 199 | |||
| 200 | struct delayed_work work; | ||
| 201 | struct fw_attribute_group attribute_group; | ||
| 202 | }; | ||
| 203 | |||
| 204 | static inline struct fw_device *fw_device(struct device *dev) | ||
| 205 | { | ||
| 206 | return container_of(dev, struct fw_device, device); | ||
| 207 | } | ||
| 208 | |||
| 209 | static inline int fw_device_is_shutdown(struct fw_device *device) | ||
| 210 | { | ||
| 211 | return atomic_read(&device->state) == FW_DEVICE_SHUTDOWN; | ||
| 212 | } | ||
| 213 | |||
| 214 | static inline struct fw_device *fw_device_get(struct fw_device *device) | ||
| 215 | { | ||
| 216 | get_device(&device->device); | ||
| 217 | |||
| 218 | return device; | ||
| 219 | } | ||
| 220 | |||
| 221 | static inline void fw_device_put(struct fw_device *device) | ||
| 222 | { | ||
| 223 | put_device(&device->device); | ||
| 224 | } | ||
| 225 | |||
| 226 | int fw_device_enable_phys_dma(struct fw_device *device); | ||
| 227 | |||
| 228 | /* | ||
| 229 | * fw_unit.directory must not be accessed after device_del(&fw_unit.device). | ||
| 230 | */ | ||
| 231 | struct fw_unit { | ||
| 232 | struct device device; | ||
| 233 | u32 *directory; | ||
| 234 | struct fw_attribute_group attribute_group; | ||
| 235 | }; | ||
| 236 | |||
| 237 | static inline struct fw_unit *fw_unit(struct device *dev) | ||
| 238 | { | ||
| 239 | return container_of(dev, struct fw_unit, device); | ||
| 240 | } | ||
| 241 | |||
| 242 | static inline struct fw_unit *fw_unit_get(struct fw_unit *unit) | ||
| 243 | { | ||
| 244 | get_device(&unit->device); | ||
| 245 | |||
| 246 | return unit; | ||
| 247 | } | ||
| 248 | |||
| 249 | static inline void fw_unit_put(struct fw_unit *unit) | ||
| 250 | { | ||
| 251 | put_device(&unit->device); | ||
| 252 | } | ||
| 253 | |||
| 254 | static inline struct fw_device *fw_parent_device(struct fw_unit *unit) | ||
| 255 | { | ||
| 256 | return fw_device(unit->device.parent); | ||
| 257 | } | ||
| 258 | |||
| 259 | struct ieee1394_device_id; | ||
| 260 | |||
| 261 | struct fw_driver { | ||
| 262 | struct device_driver driver; | ||
| 263 | /* Called when the parent device sits through a bus reset. */ | ||
| 264 | void (*update)(struct fw_unit *unit); | ||
| 265 | const struct ieee1394_device_id *id_table; | ||
| 266 | }; | ||
| 267 | |||
| 268 | struct fw_packet; | ||
| 269 | struct fw_request; | ||
| 270 | |||
| 271 | typedef void (*fw_packet_callback_t)(struct fw_packet *packet, | ||
| 272 | struct fw_card *card, int status); | ||
| 273 | typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode, | ||
| 274 | void *data, size_t length, | ||
| 275 | void *callback_data); | ||
| 276 | /* | ||
| 277 | * Important note: The callback must guarantee that either fw_send_response() | ||
| 278 | * or kfree() is called on the @request. | ||
| 279 | */ | ||
| 280 | typedef void (*fw_address_callback_t)(struct fw_card *card, | ||
| 281 | struct fw_request *request, | ||
| 282 | int tcode, int destination, int source, | ||
| 283 | int generation, int speed, | ||
| 284 | unsigned long long offset, | ||
| 285 | void *data, size_t length, | ||
| 286 | void *callback_data); | ||
| 287 | |||
| 288 | struct fw_packet { | ||
| 289 | int speed; | ||
| 290 | int generation; | ||
| 291 | u32 header[4]; | ||
| 292 | size_t header_length; | ||
| 293 | void *payload; | ||
| 294 | size_t payload_length; | ||
| 295 | dma_addr_t payload_bus; | ||
| 296 | u32 timestamp; | ||
| 297 | |||
| 298 | /* | ||
| 299 | * This callback is called when the packet transmission has | ||
| 300 | * completed; for successful transmission, the status code is | ||
| 301 | * the ack received from the destination, otherwise it's a | ||
| 302 | * negative errno: ENOMEM, ESTALE, ETIMEDOUT, ENODEV, EIO. | ||
| 303 | * The callback can be called from tasklet context and thus | ||
| 304 | * must never block. | ||
| 305 | */ | ||
| 306 | fw_packet_callback_t callback; | ||
| 307 | int ack; | ||
| 308 | struct list_head link; | ||
| 309 | void *driver_data; | ||
| 310 | }; | ||
| 311 | |||
| 312 | struct fw_transaction { | ||
| 313 | int node_id; /* The generation is implied; it is always the current. */ | ||
| 314 | int tlabel; | ||
| 315 | int timestamp; | ||
| 316 | struct list_head link; | ||
| 317 | |||
| 318 | struct fw_packet packet; | ||
| 319 | |||
| 320 | /* | ||
| 321 | * The data passed to the callback is valid only during the | ||
| 322 | * callback. | ||
| 323 | */ | ||
| 324 | fw_transaction_callback_t callback; | ||
| 325 | void *callback_data; | ||
| 326 | }; | ||
| 327 | |||
| 328 | struct fw_address_handler { | ||
| 329 | u64 offset; | ||
| 330 | size_t length; | ||
| 331 | fw_address_callback_t address_callback; | ||
| 332 | void *callback_data; | ||
| 333 | struct list_head link; | ||
| 334 | }; | ||
| 335 | |||
| 336 | struct fw_address_region { | ||
| 337 | u64 start; | ||
| 338 | u64 end; | ||
| 339 | }; | ||
| 340 | |||
| 341 | extern const struct fw_address_region fw_high_memory_region; | ||
| 342 | |||
| 343 | int fw_core_add_address_handler(struct fw_address_handler *handler, | ||
| 344 | const struct fw_address_region *region); | ||
| 345 | void fw_core_remove_address_handler(struct fw_address_handler *handler); | ||
| 346 | void fw_send_response(struct fw_card *card, | ||
| 347 | struct fw_request *request, int rcode); | ||
| 348 | void fw_send_request(struct fw_card *card, struct fw_transaction *t, | ||
| 349 | int tcode, int destination_id, int generation, int speed, | ||
| 350 | unsigned long long offset, void *payload, size_t length, | ||
| 351 | fw_transaction_callback_t callback, void *callback_data); | ||
| 352 | int fw_cancel_transaction(struct fw_card *card, | ||
| 353 | struct fw_transaction *transaction); | ||
| 354 | int fw_run_transaction(struct fw_card *card, int tcode, int destination_id, | ||
| 355 | int generation, int speed, unsigned long long offset, | ||
| 356 | void *payload, size_t length); | ||
| 357 | |||
| 358 | #endif /* _LINUX_FIREWIRE_H */ | ||
diff --git a/include/linux/firmware-map.h b/include/linux/firmware-map.h index cca686b39123..875451f1373a 100644 --- a/include/linux/firmware-map.h +++ b/include/linux/firmware-map.h | |||
| @@ -24,21 +24,17 @@ | |||
| 24 | */ | 24 | */ |
| 25 | #ifdef CONFIG_FIRMWARE_MEMMAP | 25 | #ifdef CONFIG_FIRMWARE_MEMMAP |
| 26 | 26 | ||
| 27 | int firmware_map_add(resource_size_t start, resource_size_t end, | 27 | int firmware_map_add(u64 start, u64 end, const char *type); |
| 28 | const char *type); | 28 | int firmware_map_add_early(u64 start, u64 end, const char *type); |
| 29 | int firmware_map_add_early(resource_size_t start, resource_size_t end, | ||
| 30 | const char *type); | ||
| 31 | 29 | ||
| 32 | #else /* CONFIG_FIRMWARE_MEMMAP */ | 30 | #else /* CONFIG_FIRMWARE_MEMMAP */ |
| 33 | 31 | ||
| 34 | static inline int firmware_map_add(resource_size_t start, resource_size_t end, | 32 | static inline int firmware_map_add(u64 start, u64 end, const char *type) |
| 35 | const char *type) | ||
| 36 | { | 33 | { |
| 37 | return 0; | 34 | return 0; |
| 38 | } | 35 | } |
| 39 | 36 | ||
| 40 | static inline int firmware_map_add_early(resource_size_t start, | 37 | static inline int firmware_map_add_early(u64 start, u64 end, const char *type) |
| 41 | resource_size_t end, const char *type) | ||
| 42 | { | 38 | { |
| 43 | return 0; | 39 | return 0; |
| 44 | } | 40 | } |
diff --git a/include/linux/firmware.h b/include/linux/firmware.h index c8ecf5b2a207..d31544628436 100644 --- a/include/linux/firmware.h +++ b/include/linux/firmware.h | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
| 6 | #include <linux/compiler.h> | 6 | #include <linux/compiler.h> |
| 7 | 7 | ||
| 8 | #define FIRMWARE_NAME_MAX 30 | ||
| 9 | #define FW_ACTION_NOHOTPLUG 0 | 8 | #define FW_ACTION_NOHOTPLUG 0 |
| 10 | #define FW_ACTION_HOTPLUG 1 | 9 | #define FW_ACTION_HOTPLUG 1 |
| 11 | 10 | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index ede84fa7da5d..74a57938c880 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -879,7 +879,7 @@ struct file_ra_state { | |||
| 879 | there are only # of pages ahead */ | 879 | there are only # of pages ahead */ |
| 880 | 880 | ||
| 881 | unsigned int ra_pages; /* Maximum readahead window */ | 881 | unsigned int ra_pages; /* Maximum readahead window */ |
| 882 | int mmap_miss; /* Cache miss stat for mmap accesses */ | 882 | unsigned int mmap_miss; /* Cache miss stat for mmap accesses */ |
| 883 | loff_t prev_pos; /* Cache last read() position */ | 883 | loff_t prev_pos; /* Cache last read() position */ |
| 884 | }; | 884 | }; |
| 885 | 885 | ||
| @@ -1919,8 +1919,9 @@ extern void __init vfs_caches_init(unsigned long); | |||
| 1919 | 1919 | ||
| 1920 | extern struct kmem_cache *names_cachep; | 1920 | extern struct kmem_cache *names_cachep; |
| 1921 | 1921 | ||
| 1922 | #define __getname() kmem_cache_alloc(names_cachep, GFP_KERNEL) | 1922 | #define __getname_gfp(gfp) kmem_cache_alloc(names_cachep, (gfp)) |
| 1923 | #define __putname(name) kmem_cache_free(names_cachep, (void *)(name)) | 1923 | #define __getname() __getname_gfp(GFP_KERNEL) |
| 1924 | #define __putname(name) kmem_cache_free(names_cachep, (void *)(name)) | ||
| 1924 | #ifndef CONFIG_AUDITSYSCALL | 1925 | #ifndef CONFIG_AUDITSYSCALL |
| 1925 | #define putname(name) __putname(name) | 1926 | #define putname(name) __putname(name) |
| 1926 | #else | 1927 | #else |
| @@ -2036,9 +2037,6 @@ extern int __invalidate_device(struct block_device *); | |||
| 2036 | extern int invalidate_partition(struct gendisk *, int); | 2037 | extern int invalidate_partition(struct gendisk *, int); |
| 2037 | #endif | 2038 | #endif |
| 2038 | extern int invalidate_inodes(struct super_block *); | 2039 | extern int invalidate_inodes(struct super_block *); |
| 2039 | unsigned long __invalidate_mapping_pages(struct address_space *mapping, | ||
| 2040 | pgoff_t start, pgoff_t end, | ||
| 2041 | bool be_atomic); | ||
| 2042 | unsigned long invalidate_mapping_pages(struct address_space *mapping, | 2040 | unsigned long invalidate_mapping_pages(struct address_space *mapping, |
| 2043 | pgoff_t start, pgoff_t end); | 2041 | pgoff_t start, pgoff_t end); |
| 2044 | 2042 | ||
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 7cbd38d363a2..45fc320a53c6 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
| @@ -142,7 +142,7 @@ struct gendisk { | |||
| 142 | * disks that can't be partitioned. */ | 142 | * disks that can't be partitioned. */ |
| 143 | 143 | ||
| 144 | char disk_name[DISK_NAME_LEN]; /* name of major driver */ | 144 | char disk_name[DISK_NAME_LEN]; /* name of major driver */ |
| 145 | 145 | char *(*nodename)(struct gendisk *gd); | |
| 146 | /* Array of pointers to partitions indexed by partno. | 146 | /* Array of pointers to partitions indexed by partno. |
| 147 | * Protected with matching bdev lock but stat and other | 147 | * Protected with matching bdev lock but stat and other |
| 148 | * non-critical accesses use RCU. Always access through | 148 | * non-critical accesses use RCU. Always access through |
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 3760e7c5de02..cfdb35d71bca 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <linux/stddef.h> | 5 | #include <linux/stddef.h> |
| 6 | #include <linux/linkage.h> | 6 | #include <linux/linkage.h> |
| 7 | #include <linux/topology.h> | 7 | #include <linux/topology.h> |
| 8 | #include <linux/mmdebug.h> | ||
| 8 | 9 | ||
| 9 | struct vm_area_struct; | 10 | struct vm_area_struct; |
| 10 | 11 | ||
| @@ -20,7 +21,8 @@ struct vm_area_struct; | |||
| 20 | #define __GFP_DMA ((__force gfp_t)0x01u) | 21 | #define __GFP_DMA ((__force gfp_t)0x01u) |
| 21 | #define __GFP_HIGHMEM ((__force gfp_t)0x02u) | 22 | #define __GFP_HIGHMEM ((__force gfp_t)0x02u) |
| 22 | #define __GFP_DMA32 ((__force gfp_t)0x04u) | 23 | #define __GFP_DMA32 ((__force gfp_t)0x04u) |
| 23 | 24 | #define __GFP_MOVABLE ((__force gfp_t)0x08u) /* Page is movable */ | |
| 25 | #define GFP_ZONEMASK (__GFP_DMA|__GFP_HIGHMEM|__GFP_DMA32|__GFP_MOVABLE) | ||
| 24 | /* | 26 | /* |
| 25 | * Action modifiers - doesn't change the zoning | 27 | * Action modifiers - doesn't change the zoning |
| 26 | * | 28 | * |
| @@ -50,9 +52,20 @@ struct vm_area_struct; | |||
| 50 | #define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */ | 52 | #define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */ |
| 51 | #define __GFP_THISNODE ((__force gfp_t)0x40000u)/* No fallback, no policies */ | 53 | #define __GFP_THISNODE ((__force gfp_t)0x40000u)/* No fallback, no policies */ |
| 52 | #define __GFP_RECLAIMABLE ((__force gfp_t)0x80000u) /* Page is reclaimable */ | 54 | #define __GFP_RECLAIMABLE ((__force gfp_t)0x80000u) /* Page is reclaimable */ |
| 53 | #define __GFP_MOVABLE ((__force gfp_t)0x100000u) /* Page is movable */ | ||
| 54 | 55 | ||
| 55 | #define __GFP_BITS_SHIFT 21 /* Room for 21 __GFP_FOO bits */ | 56 | #ifdef CONFIG_KMEMCHECK |
| 57 | #define __GFP_NOTRACK ((__force gfp_t)0x200000u) /* Don't track with kmemcheck */ | ||
| 58 | #else | ||
| 59 | #define __GFP_NOTRACK ((__force gfp_t)0) | ||
| 60 | #endif | ||
| 61 | |||
| 62 | /* | ||
| 63 | * This may seem redundant, but it's a way of annotating false positives vs. | ||
| 64 | * allocations that simply cannot be supported (e.g. page tables). | ||
| 65 | */ | ||
| 66 | #define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK) | ||
| 67 | |||
| 68 | #define __GFP_BITS_SHIFT 22 /* Room for 22 __GFP_FOO bits */ | ||
| 56 | #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) | 69 | #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) |
| 57 | 70 | ||
| 58 | /* This equals 0, but use constants in case they ever change */ | 71 | /* This equals 0, but use constants in case they ever change */ |
| @@ -115,24 +128,105 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags) | |||
| 115 | ((gfp_flags & __GFP_RECLAIMABLE) != 0); | 128 | ((gfp_flags & __GFP_RECLAIMABLE) != 0); |
| 116 | } | 129 | } |
| 117 | 130 | ||
| 118 | static inline enum zone_type gfp_zone(gfp_t flags) | 131 | #ifdef CONFIG_HIGHMEM |
| 119 | { | 132 | #define OPT_ZONE_HIGHMEM ZONE_HIGHMEM |
| 133 | #else | ||
| 134 | #define OPT_ZONE_HIGHMEM ZONE_NORMAL | ||
| 135 | #endif | ||
| 136 | |||
| 120 | #ifdef CONFIG_ZONE_DMA | 137 | #ifdef CONFIG_ZONE_DMA |
| 121 | if (flags & __GFP_DMA) | 138 | #define OPT_ZONE_DMA ZONE_DMA |
| 122 | return ZONE_DMA; | 139 | #else |
| 140 | #define OPT_ZONE_DMA ZONE_NORMAL | ||
| 123 | #endif | 141 | #endif |
| 142 | |||
| 124 | #ifdef CONFIG_ZONE_DMA32 | 143 | #ifdef CONFIG_ZONE_DMA32 |
| 125 | if (flags & __GFP_DMA32) | 144 | #define OPT_ZONE_DMA32 ZONE_DMA32 |
| 126 | return ZONE_DMA32; | 145 | #else |
| 146 | #define OPT_ZONE_DMA32 ZONE_NORMAL | ||
| 127 | #endif | 147 | #endif |
| 128 | if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) == | 148 | |
| 129 | (__GFP_HIGHMEM | __GFP_MOVABLE)) | 149 | /* |
| 130 | return ZONE_MOVABLE; | 150 | * GFP_ZONE_TABLE is a word size bitstring that is used for looking up the |
| 131 | #ifdef CONFIG_HIGHMEM | 151 | * zone to use given the lowest 4 bits of gfp_t. Entries are ZONE_SHIFT long |
| 132 | if (flags & __GFP_HIGHMEM) | 152 | * and there are 16 of them to cover all possible combinations of |
| 133 | return ZONE_HIGHMEM; | 153 | * __GFP_DMA, __GFP_DMA32, __GFP_MOVABLE and __GFP_HIGHMEM |
| 154 | * | ||
| 155 | * The zone fallback order is MOVABLE=>HIGHMEM=>NORMAL=>DMA32=>DMA. | ||
| 156 | * But GFP_MOVABLE is not only a zone specifier but also an allocation | ||
| 157 | * policy. Therefore __GFP_MOVABLE plus another zone selector is valid. | ||
| 158 | * Only 1bit of the lowest 3 bit (DMA,DMA32,HIGHMEM) can be set to "1". | ||
| 159 | * | ||
| 160 | * bit result | ||
| 161 | * ================= | ||
| 162 | * 0x0 => NORMAL | ||
| 163 | * 0x1 => DMA or NORMAL | ||
| 164 | * 0x2 => HIGHMEM or NORMAL | ||
| 165 | * 0x3 => BAD (DMA+HIGHMEM) | ||
| 166 | * 0x4 => DMA32 or DMA or NORMAL | ||
| 167 | * 0x5 => BAD (DMA+DMA32) | ||
| 168 | * 0x6 => BAD (HIGHMEM+DMA32) | ||
| 169 | * 0x7 => BAD (HIGHMEM+DMA32+DMA) | ||
| 170 | * 0x8 => NORMAL (MOVABLE+0) | ||
| 171 | * 0x9 => DMA or NORMAL (MOVABLE+DMA) | ||
| 172 | * 0xa => MOVABLE (Movable is valid only if HIGHMEM is set too) | ||
| 173 | * 0xb => BAD (MOVABLE+HIGHMEM+DMA) | ||
| 174 | * 0xc => DMA32 (MOVABLE+HIGHMEM+DMA32) | ||
| 175 | * 0xd => BAD (MOVABLE+DMA32+DMA) | ||
| 176 | * 0xe => BAD (MOVABLE+DMA32+HIGHMEM) | ||
| 177 | * 0xf => BAD (MOVABLE+DMA32+HIGHMEM+DMA) | ||
| 178 | * | ||
| 179 | * ZONES_SHIFT must be <= 2 on 32 bit platforms. | ||
| 180 | */ | ||
| 181 | |||
| 182 | #if 16 * ZONES_SHIFT > BITS_PER_LONG | ||
| 183 | #error ZONES_SHIFT too large to create GFP_ZONE_TABLE integer | ||
| 184 | #endif | ||
| 185 | |||
| 186 | #define GFP_ZONE_TABLE ( \ | ||
| 187 | (ZONE_NORMAL << 0 * ZONES_SHIFT) \ | ||
| 188 | | (OPT_ZONE_DMA << __GFP_DMA * ZONES_SHIFT) \ | ||
| 189 | | (OPT_ZONE_HIGHMEM << __GFP_HIGHMEM * ZONES_SHIFT) \ | ||
| 190 | | (OPT_ZONE_DMA32 << __GFP_DMA32 * ZONES_SHIFT) \ | ||
| 191 | | (ZONE_NORMAL << __GFP_MOVABLE * ZONES_SHIFT) \ | ||
| 192 | | (OPT_ZONE_DMA << (__GFP_MOVABLE | __GFP_DMA) * ZONES_SHIFT) \ | ||
| 193 | | (ZONE_MOVABLE << (__GFP_MOVABLE | __GFP_HIGHMEM) * ZONES_SHIFT)\ | ||
| 194 | | (OPT_ZONE_DMA32 << (__GFP_MOVABLE | __GFP_DMA32) * ZONES_SHIFT)\ | ||
| 195 | ) | ||
| 196 | |||
| 197 | /* | ||
| 198 | * GFP_ZONE_BAD is a bitmap for all combination of __GFP_DMA, __GFP_DMA32 | ||
| 199 | * __GFP_HIGHMEM and __GFP_MOVABLE that are not permitted. One flag per | ||
| 200 | * entry starting with bit 0. Bit is set if the combination is not | ||
| 201 | * allowed. | ||
| 202 | */ | ||
| 203 | #define GFP_ZONE_BAD ( \ | ||
| 204 | 1 << (__GFP_DMA | __GFP_HIGHMEM) \ | ||
| 205 | | 1 << (__GFP_DMA | __GFP_DMA32) \ | ||
| 206 | | 1 << (__GFP_DMA32 | __GFP_HIGHMEM) \ | ||
| 207 | | 1 << (__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM) \ | ||
| 208 | | 1 << (__GFP_MOVABLE | __GFP_HIGHMEM | __GFP_DMA) \ | ||
| 209 | | 1 << (__GFP_MOVABLE | __GFP_DMA32 | __GFP_DMA) \ | ||
| 210 | | 1 << (__GFP_MOVABLE | __GFP_DMA32 | __GFP_HIGHMEM) \ | ||
| 211 | | 1 << (__GFP_MOVABLE | __GFP_DMA32 | __GFP_DMA | __GFP_HIGHMEM)\ | ||
| 212 | ) | ||
| 213 | |||
| 214 | static inline enum zone_type gfp_zone(gfp_t flags) | ||
| 215 | { | ||
| 216 | enum zone_type z; | ||
| 217 | int bit = flags & GFP_ZONEMASK; | ||
| 218 | |||
| 219 | z = (GFP_ZONE_TABLE >> (bit * ZONES_SHIFT)) & | ||
| 220 | ((1 << ZONES_SHIFT) - 1); | ||
| 221 | |||
| 222 | if (__builtin_constant_p(bit)) | ||
| 223 | BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1); | ||
| 224 | else { | ||
| 225 | #ifdef CONFIG_DEBUG_VM | ||
| 226 | BUG_ON((GFP_ZONE_BAD >> bit) & 1); | ||
| 134 | #endif | 227 | #endif |
| 135 | return ZONE_NORMAL; | 228 | } |
| 229 | return z; | ||
| 136 | } | 230 | } |
| 137 | 231 | ||
| 138 | /* | 232 | /* |
| @@ -172,30 +266,19 @@ static inline void arch_alloc_page(struct page *page, int order) { } | |||
| 172 | #endif | 266 | #endif |
| 173 | 267 | ||
| 174 | struct page * | 268 | struct page * |
| 175 | __alloc_pages_internal(gfp_t gfp_mask, unsigned int order, | 269 | __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, |
| 176 | struct zonelist *zonelist, nodemask_t *nodemask); | 270 | struct zonelist *zonelist, nodemask_t *nodemask); |
| 177 | 271 | ||
| 178 | static inline struct page * | 272 | static inline struct page * |
| 179 | __alloc_pages(gfp_t gfp_mask, unsigned int order, | 273 | __alloc_pages(gfp_t gfp_mask, unsigned int order, |
| 180 | struct zonelist *zonelist) | 274 | struct zonelist *zonelist) |
| 181 | { | 275 | { |
| 182 | return __alloc_pages_internal(gfp_mask, order, zonelist, NULL); | 276 | return __alloc_pages_nodemask(gfp_mask, order, zonelist, NULL); |
| 183 | } | 277 | } |
| 184 | 278 | ||
| 185 | static inline struct page * | ||
| 186 | __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, | ||
| 187 | struct zonelist *zonelist, nodemask_t *nodemask) | ||
| 188 | { | ||
| 189 | return __alloc_pages_internal(gfp_mask, order, zonelist, nodemask); | ||
| 190 | } | ||
| 191 | |||
| 192 | |||
| 193 | static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, | 279 | static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, |
| 194 | unsigned int order) | 280 | unsigned int order) |
| 195 | { | 281 | { |
| 196 | if (unlikely(order >= MAX_ORDER)) | ||
| 197 | return NULL; | ||
| 198 | |||
| 199 | /* Unknown node is current node */ | 282 | /* Unknown node is current node */ |
| 200 | if (nid < 0) | 283 | if (nid < 0) |
| 201 | nid = numa_node_id(); | 284 | nid = numa_node_id(); |
| @@ -203,15 +286,20 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, | |||
| 203 | return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); | 286 | return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); |
| 204 | } | 287 | } |
| 205 | 288 | ||
| 289 | static inline struct page *alloc_pages_exact_node(int nid, gfp_t gfp_mask, | ||
| 290 | unsigned int order) | ||
| 291 | { | ||
| 292 | VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES); | ||
| 293 | |||
| 294 | return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); | ||
| 295 | } | ||
| 296 | |||
| 206 | #ifdef CONFIG_NUMA | 297 | #ifdef CONFIG_NUMA |
| 207 | extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order); | 298 | extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order); |
| 208 | 299 | ||
| 209 | static inline struct page * | 300 | static inline struct page * |
| 210 | alloc_pages(gfp_t gfp_mask, unsigned int order) | 301 | alloc_pages(gfp_t gfp_mask, unsigned int order) |
| 211 | { | 302 | { |
| 212 | if (unlikely(order >= MAX_ORDER)) | ||
| 213 | return NULL; | ||
| 214 | |||
| 215 | return alloc_pages_current(gfp_mask, order); | 303 | return alloc_pages_current(gfp_mask, order); |
| 216 | } | 304 | } |
| 217 | extern struct page *alloc_page_vma(gfp_t gfp_mask, | 305 | extern struct page *alloc_page_vma(gfp_t gfp_mask, |
| @@ -248,4 +336,16 @@ void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp); | |||
| 248 | void drain_all_pages(void); | 336 | void drain_all_pages(void); |
| 249 | void drain_local_pages(void *dummy); | 337 | void drain_local_pages(void *dummy); |
| 250 | 338 | ||
| 339 | extern bool oom_killer_disabled; | ||
| 340 | |||
| 341 | static inline void oom_killer_disable(void) | ||
| 342 | { | ||
| 343 | oom_killer_disabled = true; | ||
| 344 | } | ||
| 345 | |||
| 346 | static inline void oom_killer_enable(void) | ||
| 347 | { | ||
| 348 | oom_killer_disabled = false; | ||
| 349 | } | ||
| 350 | |||
| 251 | #endif /* __LINUX_GFP_H */ | 351 | #endif /* __LINUX_GFP_H */ |
diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 1fcb7126a01f..211ff4497269 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h | |||
| @@ -55,7 +55,9 @@ static inline void *kmap(struct page *page) | |||
| 55 | return page_address(page); | 55 | return page_address(page); |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | #define kunmap(page) do { (void) (page); } while (0) | 58 | static inline void kunmap(struct page *page) |
| 59 | { | ||
| 60 | } | ||
| 59 | 61 | ||
| 60 | static inline void *kmap_atomic(struct page *page, enum km_type idx) | 62 | static inline void *kmap_atomic(struct page *page, enum km_type idx) |
| 61 | { | 63 | { |
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 03be7f29ca01..a05a5ef33391 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
| @@ -11,6 +11,8 @@ | |||
| 11 | 11 | ||
| 12 | struct ctl_table; | 12 | struct ctl_table; |
| 13 | 13 | ||
| 14 | int PageHuge(struct page *page); | ||
| 15 | |||
| 14 | static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) | 16 | static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) |
| 15 | { | 17 | { |
| 16 | return vma->vm_flags & VM_HUGETLB; | 18 | return vma->vm_flags & VM_HUGETLB; |
| @@ -61,6 +63,11 @@ void hugetlb_change_protection(struct vm_area_struct *vma, | |||
| 61 | 63 | ||
| 62 | #else /* !CONFIG_HUGETLB_PAGE */ | 64 | #else /* !CONFIG_HUGETLB_PAGE */ |
| 63 | 65 | ||
| 66 | static inline int PageHuge(struct page *page) | ||
| 67 | { | ||
| 68 | return 0; | ||
| 69 | } | ||
| 70 | |||
| 64 | static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) | 71 | static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) |
| 65 | { | 72 | { |
| 66 | return 0; | 73 | return 0; |
diff --git a/include/linux/init.h b/include/linux/init.h index b2189803f19a..8c2c9989626d 100644 --- a/include/linux/init.h +++ b/include/linux/init.h | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | * sign followed by value, e.g.: | 29 | * sign followed by value, e.g.: |
| 30 | * | 30 | * |
| 31 | * static int init_variable __initdata = 0; | 31 | * static int init_variable __initdata = 0; |
| 32 | * static char linux_logo[] __initdata = { 0x32, 0x36, ... }; | 32 | * static const char linux_logo[] __initconst = { 0x32, 0x36, ... }; |
| 33 | * | 33 | * |
| 34 | * Don't forget to initialize data not at file scope, i.e. within a function, | 34 | * Don't forget to initialize data not at file scope, i.e. within a function, |
| 35 | * as gcc otherwise puts the data into the bss section and not into the init | 35 | * as gcc otherwise puts the data into the bss section and not into the init |
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 28b1f30601b5..5368fbdc7801 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
| @@ -15,18 +15,6 @@ | |||
| 15 | extern struct files_struct init_files; | 15 | extern struct files_struct init_files; |
| 16 | extern struct fs_struct init_fs; | 16 | extern struct fs_struct init_fs; |
| 17 | 17 | ||
| 18 | #define INIT_MM(name) \ | ||
| 19 | { \ | ||
| 20 | .mm_rb = RB_ROOT, \ | ||
| 21 | .pgd = swapper_pg_dir, \ | ||
| 22 | .mm_users = ATOMIC_INIT(2), \ | ||
| 23 | .mm_count = ATOMIC_INIT(1), \ | ||
| 24 | .mmap_sem = __RWSEM_INITIALIZER(name.mmap_sem), \ | ||
| 25 | .page_table_lock = __SPIN_LOCK_UNLOCKED(name.page_table_lock), \ | ||
| 26 | .mmlist = LIST_HEAD_INIT(name.mmlist), \ | ||
| 27 | .cpu_vm_mask = CPU_MASK_ALL, \ | ||
| 28 | } | ||
| 29 | |||
| 30 | #define INIT_SIGNALS(sig) { \ | 18 | #define INIT_SIGNALS(sig) { \ |
| 31 | .count = ATOMIC_INIT(1), \ | 19 | .count = ATOMIC_INIT(1), \ |
| 32 | .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\ | 20 | .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\ |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index c41e812e9d5e..2721f07e9354 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
| @@ -472,6 +472,20 @@ static inline void tasklet_hi_schedule(struct tasklet_struct *t) | |||
| 472 | __tasklet_hi_schedule(t); | 472 | __tasklet_hi_schedule(t); |
| 473 | } | 473 | } |
| 474 | 474 | ||
| 475 | extern void __tasklet_hi_schedule_first(struct tasklet_struct *t); | ||
| 476 | |||
| 477 | /* | ||
| 478 | * This version avoids touching any other tasklets. Needed for kmemcheck | ||
| 479 | * in order not to take any page faults while enqueueing this tasklet; | ||
| 480 | * consider VERY carefully whether you really need this or | ||
| 481 | * tasklet_hi_schedule()... | ||
| 482 | */ | ||
| 483 | static inline void tasklet_hi_schedule_first(struct tasklet_struct *t) | ||
| 484 | { | ||
| 485 | if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state)) | ||
| 486 | __tasklet_hi_schedule_first(t); | ||
| 487 | } | ||
| 488 | |||
| 475 | 489 | ||
| 476 | static inline void tasklet_disable_nosync(struct tasklet_struct *t) | 490 | static inline void tasklet_disable_nosync(struct tasklet_struct *t) |
| 477 | { | 491 | { |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 1b2e1747df1a..c5a71c38a95f 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -408,7 +408,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
| 408 | * | 408 | * |
| 409 | * Use tracing_on/tracing_off when you want to quickly turn on or off | 409 | * Use tracing_on/tracing_off when you want to quickly turn on or off |
| 410 | * tracing. It simply enables or disables the recording of the trace events. | 410 | * tracing. It simply enables or disables the recording of the trace events. |
| 411 | * This also corresponds to the user space debugfs/tracing/tracing_on | 411 | * This also corresponds to the user space /sys/kernel/debug/tracing/tracing_on |
| 412 | * file, which gives a means for the kernel and userspace to interact. | 412 | * file, which gives a means for the kernel and userspace to interact. |
| 413 | * Place a tracing_off() in the kernel where you want tracing to end. | 413 | * Place a tracing_off() in the kernel where you want tracing to end. |
| 414 | * From user space, examine the trace, and then echo 1 > tracing_on | 414 | * From user space, examine the trace, and then echo 1 > tracing_on |
diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h new file mode 100644 index 000000000000..47b39b7c7e84 --- /dev/null +++ b/include/linux/kmemcheck.h | |||
| @@ -0,0 +1,153 @@ | |||
| 1 | #ifndef LINUX_KMEMCHECK_H | ||
| 2 | #define LINUX_KMEMCHECK_H | ||
| 3 | |||
| 4 | #include <linux/mm_types.h> | ||
| 5 | #include <linux/types.h> | ||
| 6 | |||
| 7 | #ifdef CONFIG_KMEMCHECK | ||
| 8 | extern int kmemcheck_enabled; | ||
| 9 | |||
| 10 | /* The slab-related functions. */ | ||
| 11 | void kmemcheck_alloc_shadow(struct page *page, int order, gfp_t flags, int node); | ||
| 12 | void kmemcheck_free_shadow(struct page *page, int order); | ||
| 13 | void kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object, | ||
| 14 | size_t size); | ||
| 15 | void kmemcheck_slab_free(struct kmem_cache *s, void *object, size_t size); | ||
| 16 | |||
| 17 | void kmemcheck_pagealloc_alloc(struct page *p, unsigned int order, | ||
| 18 | gfp_t gfpflags); | ||
| 19 | |||
| 20 | void kmemcheck_show_pages(struct page *p, unsigned int n); | ||
| 21 | void kmemcheck_hide_pages(struct page *p, unsigned int n); | ||
| 22 | |||
| 23 | bool kmemcheck_page_is_tracked(struct page *p); | ||
| 24 | |||
| 25 | void kmemcheck_mark_unallocated(void *address, unsigned int n); | ||
| 26 | void kmemcheck_mark_uninitialized(void *address, unsigned int n); | ||
| 27 | void kmemcheck_mark_initialized(void *address, unsigned int n); | ||
| 28 | void kmemcheck_mark_freed(void *address, unsigned int n); | ||
| 29 | |||
| 30 | void kmemcheck_mark_unallocated_pages(struct page *p, unsigned int n); | ||
| 31 | void kmemcheck_mark_uninitialized_pages(struct page *p, unsigned int n); | ||
| 32 | void kmemcheck_mark_initialized_pages(struct page *p, unsigned int n); | ||
| 33 | |||
| 34 | int kmemcheck_show_addr(unsigned long address); | ||
| 35 | int kmemcheck_hide_addr(unsigned long address); | ||
| 36 | |||
| 37 | #else | ||
| 38 | #define kmemcheck_enabled 0 | ||
| 39 | |||
| 40 | static inline void | ||
| 41 | kmemcheck_alloc_shadow(struct page *page, int order, gfp_t flags, int node) | ||
| 42 | { | ||
| 43 | } | ||
| 44 | |||
| 45 | static inline void | ||
| 46 | kmemcheck_free_shadow(struct page *page, int order) | ||
| 47 | { | ||
| 48 | } | ||
| 49 | |||
| 50 | static inline void | ||
| 51 | kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object, | ||
| 52 | size_t size) | ||
| 53 | { | ||
| 54 | } | ||
| 55 | |||
| 56 | static inline void kmemcheck_slab_free(struct kmem_cache *s, void *object, | ||
| 57 | size_t size) | ||
| 58 | { | ||
| 59 | } | ||
| 60 | |||
| 61 | static inline void kmemcheck_pagealloc_alloc(struct page *p, | ||
| 62 | unsigned int order, gfp_t gfpflags) | ||
| 63 | { | ||
| 64 | } | ||
| 65 | |||
| 66 | static inline bool kmemcheck_page_is_tracked(struct page *p) | ||
| 67 | { | ||
| 68 | return false; | ||
| 69 | } | ||
| 70 | |||
| 71 | static inline void kmemcheck_mark_unallocated(void *address, unsigned int n) | ||
| 72 | { | ||
| 73 | } | ||
| 74 | |||
| 75 | static inline void kmemcheck_mark_uninitialized(void *address, unsigned int n) | ||
| 76 | { | ||
| 77 | } | ||
| 78 | |||
| 79 | static inline void kmemcheck_mark_initialized(void *address, unsigned int n) | ||
| 80 | { | ||
| 81 | } | ||
| 82 | |||
| 83 | static inline void kmemcheck_mark_freed(void *address, unsigned int n) | ||
| 84 | { | ||
| 85 | } | ||
| 86 | |||
| 87 | static inline void kmemcheck_mark_unallocated_pages(struct page *p, | ||
| 88 | unsigned int n) | ||
| 89 | { | ||
| 90 | } | ||
| 91 | |||
| 92 | static inline void kmemcheck_mark_uninitialized_pages(struct page *p, | ||
| 93 | unsigned int n) | ||
| 94 | { | ||
| 95 | } | ||
| 96 | |||
| 97 | static inline void kmemcheck_mark_initialized_pages(struct page *p, | ||
| 98 | unsigned int n) | ||
| 99 | { | ||
| 100 | } | ||
| 101 | |||
| 102 | #endif /* CONFIG_KMEMCHECK */ | ||
| 103 | |||
| 104 | /* | ||
| 105 | * Bitfield annotations | ||
| 106 | * | ||
| 107 | * How to use: If you have a struct using bitfields, for example | ||
| 108 | * | ||
| 109 | * struct a { | ||
| 110 | * int x:8, y:8; | ||
| 111 | * }; | ||
| 112 | * | ||
| 113 | * then this should be rewritten as | ||
| 114 | * | ||
| 115 | * struct a { | ||
| 116 | * kmemcheck_bitfield_begin(flags); | ||
| 117 | * int x:8, y:8; | ||
| 118 | * kmemcheck_bitfield_end(flags); | ||
| 119 | * }; | ||
| 120 | * | ||
| 121 | * Now the "flags_begin" and "flags_end" members may be used to refer to the | ||
| 122 | * beginning and end, respectively, of the bitfield (and things like | ||
| 123 | * &x.flags_begin is allowed). As soon as the struct is allocated, the bit- | ||
| 124 | * fields should be annotated: | ||
| 125 | * | ||
| 126 | * struct a *a = kmalloc(sizeof(struct a), GFP_KERNEL); | ||
| 127 | * kmemcheck_annotate_bitfield(a, flags); | ||
| 128 | * | ||
| 129 | * Note: We provide the same definitions for both kmemcheck and non- | ||
| 130 | * kmemcheck kernels. This makes it harder to introduce accidental errors. It | ||
| 131 | * is also allowed to pass NULL pointers to kmemcheck_annotate_bitfield(). | ||
| 132 | */ | ||
| 133 | #define kmemcheck_bitfield_begin(name) \ | ||
| 134 | int name##_begin[0]; | ||
| 135 | |||
| 136 | #define kmemcheck_bitfield_end(name) \ | ||
| 137 | int name##_end[0]; | ||
| 138 | |||
| 139 | #define kmemcheck_annotate_bitfield(ptr, name) \ | ||
| 140 | do if (ptr) { \ | ||
| 141 | int _n = (long) &((ptr)->name##_end) \ | ||
| 142 | - (long) &((ptr)->name##_begin); \ | ||
| 143 | BUILD_BUG_ON(_n < 0); \ | ||
| 144 | \ | ||
| 145 | kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \ | ||
| 146 | } while (0) | ||
| 147 | |||
| 148 | #define kmemcheck_annotate_variable(var) \ | ||
| 149 | do { \ | ||
| 150 | kmemcheck_mark_initialized(&(var), sizeof(var)); \ | ||
| 151 | } while (0) \ | ||
| 152 | |||
| 153 | #endif /* LINUX_KMEMCHECK_H */ | ||
diff --git a/include/linux/linux_logo.h b/include/linux/linux_logo.h index 08a92969c76e..ca5bd91d12e1 100644 --- a/include/linux/linux_logo.h +++ b/include/linux/linux_logo.h | |||
| @@ -32,6 +32,22 @@ struct linux_logo { | |||
| 32 | const unsigned char *data; | 32 | const unsigned char *data; |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | extern const struct linux_logo logo_linux_mono; | ||
| 36 | extern const struct linux_logo logo_linux_vga16; | ||
| 37 | extern const struct linux_logo logo_linux_clut224; | ||
| 38 | extern const struct linux_logo logo_blackfin_vga16; | ||
| 39 | extern const struct linux_logo logo_blackfin_clut224; | ||
| 40 | extern const struct linux_logo logo_dec_clut224; | ||
| 41 | extern const struct linux_logo logo_mac_clut224; | ||
| 42 | extern const struct linux_logo logo_parisc_clut224; | ||
| 43 | extern const struct linux_logo logo_sgi_clut224; | ||
| 44 | extern const struct linux_logo logo_sun_clut224; | ||
| 45 | extern const struct linux_logo logo_superh_mono; | ||
| 46 | extern const struct linux_logo logo_superh_vga16; | ||
| 47 | extern const struct linux_logo logo_superh_clut224; | ||
| 48 | extern const struct linux_logo logo_m32r_clut224; | ||
| 49 | extern const struct linux_logo logo_spe_clut224; | ||
| 50 | |||
| 35 | extern const struct linux_logo *fb_find_logo(int depth); | 51 | extern const struct linux_logo *fb_find_logo(int depth); |
| 36 | #ifdef CONFIG_FB_LOGO_EXTRA | 52 | #ifdef CONFIG_FB_LOGO_EXTRA |
| 37 | extern void fb_append_extra_logo(const struct linux_logo *logo, | 53 | extern void fb_append_extra_logo(const struct linux_logo *logo, |
diff --git a/include/linux/lis3lv02d.h b/include/linux/lis3lv02d.h new file mode 100644 index 000000000000..ad651f4e45ac --- /dev/null +++ b/include/linux/lis3lv02d.h | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | #ifndef __LIS3LV02D_H_ | ||
| 2 | #define __LIS3LV02D_H_ | ||
| 3 | |||
| 4 | struct lis3lv02d_platform_data { | ||
| 5 | /* please note: the 'click' feature is only supported for | ||
| 6 | * LIS[32]02DL variants of the chip and will be ignored for | ||
| 7 | * others */ | ||
| 8 | #define LIS3_CLICK_SINGLE_X (1 << 0) | ||
| 9 | #define LIS3_CLICK_DOUBLE_X (1 << 1) | ||
| 10 | #define LIS3_CLICK_SINGLE_Y (1 << 2) | ||
| 11 | #define LIS3_CLICK_DOUBLE_Y (1 << 3) | ||
| 12 | #define LIS3_CLICK_SINGLE_Z (1 << 4) | ||
| 13 | #define LIS3_CLICK_DOUBLE_Z (1 << 5) | ||
| 14 | unsigned char click_flags; | ||
| 15 | unsigned char click_thresh_x; | ||
| 16 | unsigned char click_thresh_y; | ||
| 17 | unsigned char click_thresh_z; | ||
| 18 | unsigned char click_time_limit; | ||
| 19 | unsigned char click_latency; | ||
| 20 | unsigned char click_window; | ||
| 21 | |||
| 22 | #define LIS3_IRQ1_DISABLE (0 << 0) | ||
| 23 | #define LIS3_IRQ1_FF_WU_1 (1 << 0) | ||
| 24 | #define LIS3_IRQ1_FF_WU_2 (2 << 0) | ||
| 25 | #define LIS3_IRQ1_FF_WU_12 (3 << 0) | ||
| 26 | #define LIS3_IRQ1_DATA_READY (4 << 0) | ||
| 27 | #define LIS3_IRQ1_CLICK (7 << 0) | ||
| 28 | #define LIS3_IRQ2_DISABLE (0 << 3) | ||
| 29 | #define LIS3_IRQ2_FF_WU_1 (1 << 3) | ||
| 30 | #define LIS3_IRQ2_FF_WU_2 (2 << 3) | ||
| 31 | #define LIS3_IRQ2_FF_WU_12 (3 << 3) | ||
| 32 | #define LIS3_IRQ2_DATA_READY (4 << 3) | ||
| 33 | #define LIS3_IRQ2_CLICK (7 << 3) | ||
| 34 | #define LIS3_IRQ_OPEN_DRAIN (1 << 6) | ||
| 35 | #define LIS3_IRQ_ACTIVE_HIGH (1 << 7) | ||
| 36 | unsigned char irq_cfg; | ||
| 37 | }; | ||
| 38 | |||
| 39 | #endif /* __LIS3LV02D_H_ */ | ||
diff --git a/include/linux/major.h b/include/linux/major.h index 058ec15dd060..6a8ca98c9a96 100644 --- a/include/linux/major.h +++ b/include/linux/major.h | |||
| @@ -145,6 +145,7 @@ | |||
| 145 | #define UNIX98_PTY_MAJOR_COUNT 8 | 145 | #define UNIX98_PTY_MAJOR_COUNT 8 |
| 146 | #define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT) | 146 | #define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT) |
| 147 | 147 | ||
| 148 | #define DRBD_MAJOR 147 | ||
| 148 | #define RTF_MAJOR 150 | 149 | #define RTF_MAJOR 150 |
| 149 | #define RAW_MAJOR 162 | 150 | #define RAW_MAJOR 162 |
| 150 | 151 | ||
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 25b9ca93d232..45add35dda1b 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
| @@ -94,6 +94,7 @@ extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem, | |||
| 94 | extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem, | 94 | extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem, |
| 95 | int priority); | 95 | int priority); |
| 96 | int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg); | 96 | int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg); |
| 97 | int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg); | ||
| 97 | unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, | 98 | unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, |
| 98 | struct zone *zone, | 99 | struct zone *zone, |
| 99 | enum lru_list lru); | 100 | enum lru_list lru); |
| @@ -239,6 +240,12 @@ mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg) | |||
| 239 | return 1; | 240 | return 1; |
| 240 | } | 241 | } |
| 241 | 242 | ||
| 243 | static inline int | ||
| 244 | mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg) | ||
| 245 | { | ||
| 246 | return 1; | ||
| 247 | } | ||
| 248 | |||
| 242 | static inline unsigned long | 249 | static inline unsigned long |
| 243 | mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, struct zone *zone, | 250 | mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, struct zone *zone, |
| 244 | enum lru_list lru) | 251 | enum lru_list lru) |
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index beb6ec99cfef..052117744629 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h | |||
| @@ -41,6 +41,7 @@ struct miscdevice { | |||
| 41 | struct list_head list; | 41 | struct list_head list; |
| 42 | struct device *parent; | 42 | struct device *parent; |
| 43 | struct device *this_device; | 43 | struct device *this_device; |
| 44 | const char *devnode; | ||
| 44 | }; | 45 | }; |
| 45 | 46 | ||
| 46 | extern int misc_register(struct miscdevice * misc); | 47 | extern int misc_register(struct miscdevice * misc); |
diff --git a/include/linux/mm.h b/include/linux/mm.h index ad613ed66ab0..d88d6fc530ad 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | 7 | ||
| 8 | #include <linux/gfp.h> | 8 | #include <linux/gfp.h> |
| 9 | #include <linux/list.h> | 9 | #include <linux/list.h> |
| 10 | #include <linux/mmdebug.h> | ||
| 11 | #include <linux/mmzone.h> | 10 | #include <linux/mmzone.h> |
| 12 | #include <linux/rbtree.h> | 11 | #include <linux/rbtree.h> |
| 13 | #include <linux/prio_tree.h> | 12 | #include <linux/prio_tree.h> |
| @@ -725,7 +724,7 @@ static inline int shmem_lock(struct file *file, int lock, | |||
| 725 | return 0; | 724 | return 0; |
| 726 | } | 725 | } |
| 727 | #endif | 726 | #endif |
| 728 | struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags); | 727 | struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); |
| 729 | 728 | ||
| 730 | int shmem_zero_setup(struct vm_area_struct *); | 729 | int shmem_zero_setup(struct vm_area_struct *); |
| 731 | 730 | ||
| @@ -793,6 +792,8 @@ int copy_page_range(struct mm_struct *dst, struct mm_struct *src, | |||
| 793 | struct vm_area_struct *vma); | 792 | struct vm_area_struct *vma); |
| 794 | void unmap_mapping_range(struct address_space *mapping, | 793 | void unmap_mapping_range(struct address_space *mapping, |
| 795 | loff_t const holebegin, loff_t const holelen, int even_cows); | 794 | loff_t const holebegin, loff_t const holelen, int even_cows); |
| 795 | int follow_pfn(struct vm_area_struct *vma, unsigned long address, | ||
| 796 | unsigned long *pfn); | ||
| 796 | int follow_phys(struct vm_area_struct *vma, unsigned long address, | 797 | int follow_phys(struct vm_area_struct *vma, unsigned long address, |
| 797 | unsigned int flags, unsigned long *prot, resource_size_t *phys); | 798 | unsigned int flags, unsigned long *prot, resource_size_t *phys); |
| 798 | int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, | 799 | int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, |
| @@ -824,8 +825,11 @@ static inline int handle_mm_fault(struct mm_struct *mm, | |||
| 824 | extern int make_pages_present(unsigned long addr, unsigned long end); | 825 | extern int make_pages_present(unsigned long addr, unsigned long end); |
| 825 | extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); | 826 | extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); |
| 826 | 827 | ||
| 827 | int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, | 828 | int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, |
| 828 | int len, int write, int force, struct page **pages, struct vm_area_struct **vmas); | 829 | unsigned long start, int len, int write, int force, |
| 830 | struct page **pages, struct vm_area_struct **vmas); | ||
| 831 | int get_user_pages_fast(unsigned long start, int nr_pages, int write, | ||
| 832 | struct page **pages); | ||
| 829 | 833 | ||
| 830 | extern int try_to_release_page(struct page * page, gfp_t gfp_mask); | 834 | extern int try_to_release_page(struct page * page, gfp_t gfp_mask); |
| 831 | extern void do_invalidatepage(struct page *page, unsigned long offset); | 835 | extern void do_invalidatepage(struct page *page, unsigned long offset); |
| @@ -850,19 +854,6 @@ extern int mprotect_fixup(struct vm_area_struct *vma, | |||
| 850 | unsigned long end, unsigned long newflags); | 854 | unsigned long end, unsigned long newflags); |
| 851 | 855 | ||
| 852 | /* | 856 | /* |
| 853 | * get_user_pages_fast provides equivalent functionality to get_user_pages, | ||
| 854 | * operating on current and current->mm (force=0 and doesn't return any vmas). | ||
| 855 | * | ||
| 856 | * get_user_pages_fast may take mmap_sem and page tables, so no assumptions | ||
| 857 | * can be made about locking. get_user_pages_fast is to be implemented in a | ||
| 858 | * way that is advantageous (vs get_user_pages()) when the user memory area is | ||
| 859 | * already faulted in and present in ptes. However if the pages have to be | ||
| 860 | * faulted in, it may turn out to be slightly slower). | ||
| 861 | */ | ||
| 862 | int get_user_pages_fast(unsigned long start, int nr_pages, int write, | ||
| 863 | struct page **pages); | ||
| 864 | |||
| 865 | /* | ||
| 866 | * A callback you can register to apply pressure to ageable caches. | 857 | * A callback you can register to apply pressure to ageable caches. |
| 867 | * | 858 | * |
| 868 | * 'shrink' is passed a count 'nr_to_scan' and a 'gfpmask'. It should | 859 | * 'shrink' is passed a count 'nr_to_scan' and a 'gfpmask'. It should |
| @@ -1061,7 +1052,8 @@ extern int __meminit __early_pfn_to_nid(unsigned long pfn); | |||
| 1061 | extern void set_dma_reserve(unsigned long new_dma_reserve); | 1052 | extern void set_dma_reserve(unsigned long new_dma_reserve); |
| 1062 | extern void memmap_init_zone(unsigned long, int, unsigned long, | 1053 | extern void memmap_init_zone(unsigned long, int, unsigned long, |
| 1063 | unsigned long, enum memmap_context); | 1054 | unsigned long, enum memmap_context); |
| 1064 | extern void setup_per_zone_pages_min(void); | 1055 | extern void setup_per_zone_wmarks(void); |
| 1056 | extern void calculate_zone_inactive_ratio(struct zone *zone); | ||
| 1065 | extern void mem_init(void); | 1057 | extern void mem_init(void); |
| 1066 | extern void __init mmap_init(void); | 1058 | extern void __init mmap_init(void); |
| 1067 | extern void show_mem(void); | 1059 | extern void show_mem(void); |
| @@ -1178,8 +1170,6 @@ void task_dirty_inc(struct task_struct *tsk); | |||
| 1178 | #define VM_MAX_READAHEAD 128 /* kbytes */ | 1170 | #define VM_MAX_READAHEAD 128 /* kbytes */ |
| 1179 | #define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */ | 1171 | #define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */ |
| 1180 | 1172 | ||
| 1181 | int do_page_cache_readahead(struct address_space *mapping, struct file *filp, | ||
| 1182 | pgoff_t offset, unsigned long nr_to_read); | ||
| 1183 | int force_page_cache_readahead(struct address_space *mapping, struct file *filp, | 1173 | int force_page_cache_readahead(struct address_space *mapping, struct file *filp, |
| 1184 | pgoff_t offset, unsigned long nr_to_read); | 1174 | pgoff_t offset, unsigned long nr_to_read); |
| 1185 | 1175 | ||
| @@ -1197,6 +1187,9 @@ void page_cache_async_readahead(struct address_space *mapping, | |||
| 1197 | unsigned long size); | 1187 | unsigned long size); |
| 1198 | 1188 | ||
| 1199 | unsigned long max_sane_readahead(unsigned long nr); | 1189 | unsigned long max_sane_readahead(unsigned long nr); |
| 1190 | unsigned long ra_submit(struct file_ra_state *ra, | ||
| 1191 | struct address_space *mapping, | ||
| 1192 | struct file *filp); | ||
| 1200 | 1193 | ||
| 1201 | /* Do stack extension */ | 1194 | /* Do stack extension */ |
| 1202 | extern int expand_stack(struct vm_area_struct *vma, unsigned long address); | 1195 | extern int expand_stack(struct vm_area_struct *vma, unsigned long address); |
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 0e80e26ecf21..7acc8439d9b3 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
| @@ -98,6 +98,14 @@ struct page { | |||
| 98 | #ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS | 98 | #ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS |
| 99 | unsigned long debug_flags; /* Use atomic bitops on this */ | 99 | unsigned long debug_flags; /* Use atomic bitops on this */ |
| 100 | #endif | 100 | #endif |
| 101 | |||
| 102 | #ifdef CONFIG_KMEMCHECK | ||
| 103 | /* | ||
| 104 | * kmemcheck wants to track the status of each byte in a page; this | ||
| 105 | * is a pointer to such a status block. NULL if not tracked. | ||
| 106 | */ | ||
| 107 | void *shadow; | ||
| 108 | #endif | ||
| 101 | }; | 109 | }; |
| 102 | 110 | ||
| 103 | /* | 111 | /* |
| @@ -232,6 +240,8 @@ struct mm_struct { | |||
| 232 | 240 | ||
| 233 | unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ | 241 | unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ |
| 234 | 242 | ||
| 243 | s8 oom_adj; /* OOM kill score adjustment (bit shift) */ | ||
| 244 | |||
| 235 | cpumask_t cpu_vm_mask; | 245 | cpumask_t cpu_vm_mask; |
| 236 | 246 | ||
| 237 | /* Architecture-specific MM context */ | 247 | /* Architecture-specific MM context */ |
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h index c7211ab6dd4b..39751c8cde9c 100644 --- a/include/linux/mmc/sdio_ids.h +++ b/include/linux/mmc/sdio_ids.h | |||
| @@ -28,4 +28,12 @@ | |||
| 28 | #define SDIO_DEVICE_ID_MARVELL_8688WLAN 0x9104 | 28 | #define SDIO_DEVICE_ID_MARVELL_8688WLAN 0x9104 |
| 29 | #define SDIO_DEVICE_ID_MARVELL_8688BT 0x9105 | 29 | #define SDIO_DEVICE_ID_MARVELL_8688BT 0x9105 |
| 30 | 30 | ||
| 31 | #define SDIO_VENDOR_ID_SIANO 0x039a | ||
| 32 | #define SDIO_DEVICE_ID_SIANO_NOVA_B0 0x0201 | ||
| 33 | #define SDIO_DEVICE_ID_SIANO_NICE 0x0202 | ||
| 34 | #define SDIO_DEVICE_ID_SIANO_VEGA_A0 0x0300 | ||
| 35 | #define SDIO_DEVICE_ID_SIANO_VENICE 0x0301 | ||
| 36 | #define SDIO_DEVICE_ID_SIANO_NOVA_A0 0x1100 | ||
| 37 | #define SDIO_DEVICE_ID_SIANO_STELLAR 0x5347 | ||
| 38 | |||
| 31 | #endif | 39 | #endif |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index a47c879e1304..889598537370 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
| @@ -50,9 +50,6 @@ extern int page_group_by_mobility_disabled; | |||
| 50 | 50 | ||
| 51 | static inline int get_pageblock_migratetype(struct page *page) | 51 | static inline int get_pageblock_migratetype(struct page *page) |
| 52 | { | 52 | { |
| 53 | if (unlikely(page_group_by_mobility_disabled)) | ||
| 54 | return MIGRATE_UNMOVABLE; | ||
| 55 | |||
| 56 | return get_pageblock_flags_group(page, PB_migrate, PB_migrate_end); | 53 | return get_pageblock_flags_group(page, PB_migrate, PB_migrate_end); |
| 57 | } | 54 | } |
| 58 | 55 | ||
| @@ -86,13 +83,8 @@ enum zone_stat_item { | |||
| 86 | NR_ACTIVE_ANON, /* " " " " " */ | 83 | NR_ACTIVE_ANON, /* " " " " " */ |
| 87 | NR_INACTIVE_FILE, /* " " " " " */ | 84 | NR_INACTIVE_FILE, /* " " " " " */ |
| 88 | NR_ACTIVE_FILE, /* " " " " " */ | 85 | NR_ACTIVE_FILE, /* " " " " " */ |
| 89 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
| 90 | NR_UNEVICTABLE, /* " " " " " */ | 86 | NR_UNEVICTABLE, /* " " " " " */ |
| 91 | NR_MLOCK, /* mlock()ed pages found and moved off LRU */ | 87 | NR_MLOCK, /* mlock()ed pages found and moved off LRU */ |
| 92 | #else | ||
| 93 | NR_UNEVICTABLE = NR_ACTIVE_FILE, /* avoid compiler errors in dead code */ | ||
| 94 | NR_MLOCK = NR_ACTIVE_FILE, | ||
| 95 | #endif | ||
| 96 | NR_ANON_PAGES, /* Mapped anonymous pages */ | 88 | NR_ANON_PAGES, /* Mapped anonymous pages */ |
| 97 | NR_FILE_MAPPED, /* pagecache pages mapped into pagetables. | 89 | NR_FILE_MAPPED, /* pagecache pages mapped into pagetables. |
| 98 | only modified from process context */ | 90 | only modified from process context */ |
| @@ -135,11 +127,7 @@ enum lru_list { | |||
| 135 | LRU_ACTIVE_ANON = LRU_BASE + LRU_ACTIVE, | 127 | LRU_ACTIVE_ANON = LRU_BASE + LRU_ACTIVE, |
| 136 | LRU_INACTIVE_FILE = LRU_BASE + LRU_FILE, | 128 | LRU_INACTIVE_FILE = LRU_BASE + LRU_FILE, |
| 137 | LRU_ACTIVE_FILE = LRU_BASE + LRU_FILE + LRU_ACTIVE, | 129 | LRU_ACTIVE_FILE = LRU_BASE + LRU_FILE + LRU_ACTIVE, |
| 138 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
| 139 | LRU_UNEVICTABLE, | 130 | LRU_UNEVICTABLE, |
| 140 | #else | ||
| 141 | LRU_UNEVICTABLE = LRU_ACTIVE_FILE, /* avoid compiler errors in dead code */ | ||
| 142 | #endif | ||
| 143 | NR_LRU_LISTS | 131 | NR_LRU_LISTS |
| 144 | }; | 132 | }; |
| 145 | 133 | ||
| @@ -159,13 +147,20 @@ static inline int is_active_lru(enum lru_list l) | |||
| 159 | 147 | ||
| 160 | static inline int is_unevictable_lru(enum lru_list l) | 148 | static inline int is_unevictable_lru(enum lru_list l) |
| 161 | { | 149 | { |
| 162 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
| 163 | return (l == LRU_UNEVICTABLE); | 150 | return (l == LRU_UNEVICTABLE); |
| 164 | #else | ||
| 165 | return 0; | ||
| 166 | #endif | ||
| 167 | } | 151 | } |
| 168 | 152 | ||
| 153 | enum zone_watermarks { | ||
| 154 | WMARK_MIN, | ||
| 155 | WMARK_LOW, | ||
| 156 | WMARK_HIGH, | ||
| 157 | NR_WMARK | ||
| 158 | }; | ||
| 159 | |||
| 160 | #define min_wmark_pages(z) (z->watermark[WMARK_MIN]) | ||
| 161 | #define low_wmark_pages(z) (z->watermark[WMARK_LOW]) | ||
| 162 | #define high_wmark_pages(z) (z->watermark[WMARK_HIGH]) | ||
| 163 | |||
| 169 | struct per_cpu_pages { | 164 | struct per_cpu_pages { |
| 170 | int count; /* number of pages in the list */ | 165 | int count; /* number of pages in the list */ |
| 171 | int high; /* high watermark, emptying needed */ | 166 | int high; /* high watermark, emptying needed */ |
| @@ -278,7 +273,10 @@ struct zone_reclaim_stat { | |||
| 278 | 273 | ||
| 279 | struct zone { | 274 | struct zone { |
| 280 | /* Fields commonly accessed by the page allocator */ | 275 | /* Fields commonly accessed by the page allocator */ |
| 281 | unsigned long pages_min, pages_low, pages_high; | 276 | |
| 277 | /* zone watermarks, access with *_wmark_pages(zone) macros */ | ||
| 278 | unsigned long watermark[NR_WMARK]; | ||
| 279 | |||
| 282 | /* | 280 | /* |
| 283 | * We don't know if the memory that we're going to allocate will be freeable | 281 | * We don't know if the memory that we're going to allocate will be freeable |
| 284 | * or/and it will be released eventually, so to avoid totally wasting several | 282 | * or/and it will be released eventually, so to avoid totally wasting several |
| @@ -323,9 +321,9 @@ struct zone { | |||
| 323 | 321 | ||
| 324 | /* Fields commonly accessed by the page reclaim scanner */ | 322 | /* Fields commonly accessed by the page reclaim scanner */ |
| 325 | spinlock_t lru_lock; | 323 | spinlock_t lru_lock; |
| 326 | struct { | 324 | struct zone_lru { |
| 327 | struct list_head list; | 325 | struct list_head list; |
| 328 | unsigned long nr_scan; | 326 | unsigned long nr_saved_scan; /* accumulated for batching */ |
| 329 | } lru[NR_LRU_LISTS]; | 327 | } lru[NR_LRU_LISTS]; |
| 330 | 328 | ||
| 331 | struct zone_reclaim_stat reclaim_stat; | 329 | struct zone_reclaim_stat reclaim_stat; |
diff --git a/include/linux/module.h b/include/linux/module.h index a7bc6e7b43a7..505f20dcc1c7 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
| @@ -697,4 +697,21 @@ static inline void module_remove_modinfo_attrs(struct module *mod) | |||
| 697 | 697 | ||
| 698 | #define __MODULE_STRING(x) __stringify(x) | 698 | #define __MODULE_STRING(x) __stringify(x) |
| 699 | 699 | ||
| 700 | |||
| 701 | #ifdef CONFIG_GENERIC_BUG | ||
| 702 | int module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *, | ||
| 703 | struct module *); | ||
| 704 | void module_bug_cleanup(struct module *); | ||
| 705 | |||
| 706 | #else /* !CONFIG_GENERIC_BUG */ | ||
| 707 | |||
| 708 | static inline int module_bug_finalize(const Elf_Ehdr *hdr, | ||
| 709 | const Elf_Shdr *sechdrs, | ||
| 710 | struct module *mod) | ||
| 711 | { | ||
| 712 | return 0; | ||
| 713 | } | ||
| 714 | static inline void module_bug_cleanup(struct module *mod) {} | ||
| 715 | #endif /* CONFIG_GENERIC_BUG */ | ||
| 716 | |||
| 700 | #endif /* _LINUX_MODULE_H */ | 717 | #endif /* _LINUX_MODULE_H */ |
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h index 6316fafe5c2a..6913b71d9ab2 100644 --- a/include/linux/mtd/ubi.h +++ b/include/linux/mtd/ubi.h | |||
| @@ -132,6 +132,39 @@ struct ubi_device_info { | |||
| 132 | dev_t cdev; | 132 | dev_t cdev; |
| 133 | }; | 133 | }; |
| 134 | 134 | ||
| 135 | /* | ||
| 136 | * enum - volume notification types. | ||
| 137 | * @UBI_VOLUME_ADDED: volume has been added | ||
| 138 | * @UBI_VOLUME_REMOVED: start volume volume | ||
| 139 | * @UBI_VOLUME_RESIZED: volume size has been re-sized | ||
| 140 | * @UBI_VOLUME_RENAMED: volume name has been re-named | ||
| 141 | * @UBI_VOLUME_UPDATED: volume name has been updated | ||
| 142 | * | ||
| 143 | * These constants define which type of event has happened when a volume | ||
| 144 | * notification function is invoked. | ||
| 145 | */ | ||
| 146 | enum { | ||
| 147 | UBI_VOLUME_ADDED, | ||
| 148 | UBI_VOLUME_REMOVED, | ||
| 149 | UBI_VOLUME_RESIZED, | ||
| 150 | UBI_VOLUME_RENAMED, | ||
| 151 | UBI_VOLUME_UPDATED, | ||
| 152 | }; | ||
| 153 | |||
| 154 | /* | ||
| 155 | * struct ubi_notification - UBI notification description structure. | ||
| 156 | * @di: UBI device description object | ||
| 157 | * @vi: UBI volume description object | ||
| 158 | * | ||
| 159 | * UBI notifiers are called with a pointer to an object of this type. The | ||
| 160 | * object describes the notification. Namely, it provides a description of the | ||
| 161 | * UBI device and UBI volume the notification informs about. | ||
| 162 | */ | ||
| 163 | struct ubi_notification { | ||
| 164 | struct ubi_device_info di; | ||
| 165 | struct ubi_volume_info vi; | ||
| 166 | }; | ||
| 167 | |||
| 135 | /* UBI descriptor given to users when they open UBI volumes */ | 168 | /* UBI descriptor given to users when they open UBI volumes */ |
| 136 | struct ubi_volume_desc; | 169 | struct ubi_volume_desc; |
| 137 | 170 | ||
| @@ -141,6 +174,10 @@ void ubi_get_volume_info(struct ubi_volume_desc *desc, | |||
| 141 | struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode); | 174 | struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode); |
| 142 | struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name, | 175 | struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name, |
| 143 | int mode); | 176 | int mode); |
| 177 | int ubi_register_volume_notifier(struct notifier_block *nb, | ||
| 178 | int ignore_existing); | ||
| 179 | int ubi_unregister_volume_notifier(struct notifier_block *nb); | ||
| 180 | |||
| 144 | void ubi_close_volume(struct ubi_volume_desc *desc); | 181 | void ubi_close_volume(struct ubi_volume_desc *desc); |
| 145 | int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, | 182 | int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, |
| 146 | int len, int check); | 183 | int len, int check); |
diff --git a/include/linux/nls.h b/include/linux/nls.h index 52b1a76c1b43..d47beef08dfd 100644 --- a/include/linux/nls.h +++ b/include/linux/nls.h | |||
| @@ -3,8 +3,23 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/init.h> | 4 | #include <linux/init.h> |
| 5 | 5 | ||
| 6 | /* unicode character */ | 6 | /* Unicode has changed over the years. Unicode code points no longer |
| 7 | typedef __u16 wchar_t; | 7 | * fit into 16 bits; as of Unicode 5 valid code points range from 0 |
| 8 | * to 0x10ffff (17 planes, where each plane holds 65536 code points). | ||
| 9 | * | ||
| 10 | * The original decision to represent Unicode characters as 16-bit | ||
| 11 | * wchar_t values is now outdated. But plane 0 still includes the | ||
| 12 | * most commonly used characters, so we will retain it. The newer | ||
| 13 | * 32-bit unicode_t type can be used when it is necessary to | ||
| 14 | * represent the full Unicode character set. | ||
| 15 | */ | ||
| 16 | |||
| 17 | /* Plane-0 Unicode character */ | ||
| 18 | typedef u16 wchar_t; | ||
| 19 | #define MAX_WCHAR_T 0xffff | ||
| 20 | |||
| 21 | /* Arbitrary Unicode character */ | ||
| 22 | typedef u32 unicode_t; | ||
| 8 | 23 | ||
| 9 | struct nls_table { | 24 | struct nls_table { |
| 10 | const char *charset; | 25 | const char *charset; |
| @@ -21,6 +36,13 @@ struct nls_table { | |||
| 21 | /* this value hold the maximum octet of charset */ | 36 | /* this value hold the maximum octet of charset */ |
| 22 | #define NLS_MAX_CHARSET_SIZE 6 /* for UTF-8 */ | 37 | #define NLS_MAX_CHARSET_SIZE 6 /* for UTF-8 */ |
| 23 | 38 | ||
| 39 | /* Byte order for UTF-16 strings */ | ||
| 40 | enum utf16_endian { | ||
| 41 | UTF16_HOST_ENDIAN, | ||
| 42 | UTF16_LITTLE_ENDIAN, | ||
| 43 | UTF16_BIG_ENDIAN | ||
| 44 | }; | ||
| 45 | |||
| 24 | /* nls.c */ | 46 | /* nls.c */ |
| 25 | extern int register_nls(struct nls_table *); | 47 | extern int register_nls(struct nls_table *); |
| 26 | extern int unregister_nls(struct nls_table *); | 48 | extern int unregister_nls(struct nls_table *); |
| @@ -28,10 +50,11 @@ extern struct nls_table *load_nls(char *); | |||
| 28 | extern void unload_nls(struct nls_table *); | 50 | extern void unload_nls(struct nls_table *); |
| 29 | extern struct nls_table *load_nls_default(void); | 51 | extern struct nls_table *load_nls_default(void); |
| 30 | 52 | ||
| 31 | extern int utf8_mbtowc(wchar_t *, const __u8 *, int); | 53 | extern int utf8_to_utf32(const u8 *s, int len, unicode_t *pu); |
| 32 | extern int utf8_mbstowcs(wchar_t *, const __u8 *, int); | 54 | extern int utf32_to_utf8(unicode_t u, u8 *s, int maxlen); |
| 33 | extern int utf8_wctomb(__u8 *, wchar_t, int); | 55 | extern int utf8s_to_utf16s(const u8 *s, int len, wchar_t *pwcs); |
| 34 | extern int utf8_wcstombs(__u8 *, const wchar_t *, int); | 56 | extern int utf16s_to_utf8s(const wchar_t *pwcs, int len, |
| 57 | enum utf16_endian endian, u8 *s, int maxlen); | ||
| 35 | 58 | ||
| 36 | static inline unsigned char nls_tolower(struct nls_table *t, unsigned char c) | 59 | static inline unsigned char nls_tolower(struct nls_table *t, unsigned char c) |
| 37 | { | 60 | { |
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index 848025cd7087..829b94b156f2 100644 --- a/include/linux/nodemask.h +++ b/include/linux/nodemask.h | |||
| @@ -408,6 +408,19 @@ static inline int num_node_state(enum node_states state) | |||
| 408 | #define next_online_node(nid) next_node((nid), node_states[N_ONLINE]) | 408 | #define next_online_node(nid) next_node((nid), node_states[N_ONLINE]) |
| 409 | 409 | ||
| 410 | extern int nr_node_ids; | 410 | extern int nr_node_ids; |
| 411 | extern int nr_online_nodes; | ||
| 412 | |||
| 413 | static inline void node_set_online(int nid) | ||
| 414 | { | ||
| 415 | node_set_state(nid, N_ONLINE); | ||
| 416 | nr_online_nodes = num_node_state(N_ONLINE); | ||
| 417 | } | ||
| 418 | |||
| 419 | static inline void node_set_offline(int nid) | ||
| 420 | { | ||
| 421 | node_clear_state(nid, N_ONLINE); | ||
| 422 | nr_online_nodes = num_node_state(N_ONLINE); | ||
| 423 | } | ||
| 411 | #else | 424 | #else |
| 412 | 425 | ||
| 413 | static inline int node_state(int node, enum node_states state) | 426 | static inline int node_state(int node, enum node_states state) |
| @@ -434,7 +447,10 @@ static inline int num_node_state(enum node_states state) | |||
| 434 | #define first_online_node 0 | 447 | #define first_online_node 0 |
| 435 | #define next_online_node(nid) (MAX_NUMNODES) | 448 | #define next_online_node(nid) (MAX_NUMNODES) |
| 436 | #define nr_node_ids 1 | 449 | #define nr_node_ids 1 |
| 450 | #define nr_online_nodes 1 | ||
| 437 | 451 | ||
| 452 | #define node_set_online(node) node_set_state((node), N_ONLINE) | ||
| 453 | #define node_set_offline(node) node_clear_state((node), N_ONLINE) | ||
| 438 | #endif | 454 | #endif |
| 439 | 455 | ||
| 440 | #define node_online_map node_states[N_ONLINE] | 456 | #define node_online_map node_states[N_ONLINE] |
| @@ -454,9 +470,6 @@ static inline int num_node_state(enum node_states state) | |||
| 454 | #define node_online(node) node_state((node), N_ONLINE) | 470 | #define node_online(node) node_state((node), N_ONLINE) |
| 455 | #define node_possible(node) node_state((node), N_POSSIBLE) | 471 | #define node_possible(node) node_state((node), N_POSSIBLE) |
| 456 | 472 | ||
| 457 | #define node_set_online(node) node_set_state((node), N_ONLINE) | ||
| 458 | #define node_set_offline(node) node_clear_state((node), N_ONLINE) | ||
| 459 | |||
| 460 | #define for_each_node(node) for_each_node_state(node, N_POSSIBLE) | 473 | #define for_each_node(node) for_each_node_state(node, N_POSSIBLE) |
| 461 | #define for_each_online_node(node) for_each_node_state(node, N_ONLINE) | 474 | #define for_each_online_node(node) for_each_node_state(node, N_ONLINE) |
| 462 | 475 | ||
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 62214c7d2d93..e2e5ce543595 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
| @@ -95,9 +95,7 @@ enum pageflags { | |||
| 95 | PG_reclaim, /* To be reclaimed asap */ | 95 | PG_reclaim, /* To be reclaimed asap */ |
| 96 | PG_buddy, /* Page is free, on buddy lists */ | 96 | PG_buddy, /* Page is free, on buddy lists */ |
| 97 | PG_swapbacked, /* Page is backed by RAM/swap */ | 97 | PG_swapbacked, /* Page is backed by RAM/swap */ |
| 98 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
| 99 | PG_unevictable, /* Page is "unevictable" */ | 98 | PG_unevictable, /* Page is "unevictable" */ |
| 100 | #endif | ||
| 101 | #ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT | 99 | #ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT |
| 102 | PG_mlocked, /* Page is vma mlocked */ | 100 | PG_mlocked, /* Page is vma mlocked */ |
| 103 | #endif | 101 | #endif |
| @@ -120,7 +118,6 @@ enum pageflags { | |||
| 120 | PG_savepinned = PG_dirty, | 118 | PG_savepinned = PG_dirty, |
| 121 | 119 | ||
| 122 | /* SLOB */ | 120 | /* SLOB */ |
| 123 | PG_slob_page = PG_active, | ||
| 124 | PG_slob_free = PG_private, | 121 | PG_slob_free = PG_private, |
| 125 | 122 | ||
| 126 | /* SLUB */ | 123 | /* SLUB */ |
| @@ -203,7 +200,6 @@ PAGEFLAG(SavePinned, savepinned); /* Xen */ | |||
| 203 | PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) | 200 | PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) |
| 204 | PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked) | 201 | PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked) |
| 205 | 202 | ||
| 206 | __PAGEFLAG(SlobPage, slob_page) | ||
| 207 | __PAGEFLAG(SlobFree, slob_free) | 203 | __PAGEFLAG(SlobFree, slob_free) |
| 208 | 204 | ||
| 209 | __PAGEFLAG(SlubFrozen, slub_frozen) | 205 | __PAGEFLAG(SlubFrozen, slub_frozen) |
| @@ -248,14 +244,8 @@ PAGEFLAG_FALSE(SwapCache) | |||
| 248 | SETPAGEFLAG_NOOP(SwapCache) CLEARPAGEFLAG_NOOP(SwapCache) | 244 | SETPAGEFLAG_NOOP(SwapCache) CLEARPAGEFLAG_NOOP(SwapCache) |
| 249 | #endif | 245 | #endif |
| 250 | 246 | ||
| 251 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
| 252 | PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable) | 247 | PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable) |
| 253 | TESTCLEARFLAG(Unevictable, unevictable) | 248 | TESTCLEARFLAG(Unevictable, unevictable) |
| 254 | #else | ||
| 255 | PAGEFLAG_FALSE(Unevictable) TESTCLEARFLAG_FALSE(Unevictable) | ||
| 256 | SETPAGEFLAG_NOOP(Unevictable) CLEARPAGEFLAG_NOOP(Unevictable) | ||
| 257 | __CLEARPAGEFLAG_NOOP(Unevictable) | ||
| 258 | #endif | ||
| 259 | 249 | ||
| 260 | #ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT | 250 | #ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT |
| 261 | #define MLOCK_PAGES 1 | 251 | #define MLOCK_PAGES 1 |
| @@ -382,12 +372,6 @@ static inline void __ClearPageTail(struct page *page) | |||
| 382 | 372 | ||
| 383 | #endif /* !PAGEFLAGS_EXTENDED */ | 373 | #endif /* !PAGEFLAGS_EXTENDED */ |
| 384 | 374 | ||
| 385 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
| 386 | #define __PG_UNEVICTABLE (1 << PG_unevictable) | ||
| 387 | #else | ||
| 388 | #define __PG_UNEVICTABLE 0 | ||
| 389 | #endif | ||
| 390 | |||
| 391 | #ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT | 375 | #ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT |
| 392 | #define __PG_MLOCKED (1 << PG_mlocked) | 376 | #define __PG_MLOCKED (1 << PG_mlocked) |
| 393 | #else | 377 | #else |
| @@ -403,7 +387,7 @@ static inline void __ClearPageTail(struct page *page) | |||
| 403 | 1 << PG_private | 1 << PG_private_2 | \ | 387 | 1 << PG_private | 1 << PG_private_2 | \ |
| 404 | 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \ | 388 | 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \ |
| 405 | 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \ | 389 | 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \ |
| 406 | __PG_UNEVICTABLE | __PG_MLOCKED) | 390 | 1 << PG_unevictable | __PG_MLOCKED) |
| 407 | 391 | ||
| 408 | /* | 392 | /* |
| 409 | * Flags checked when a page is prepped for return by the page allocator. | 393 | * Flags checked when a page is prepped for return by the page allocator. |
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 34da5230faab..aec3252afcf5 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h | |||
| @@ -22,9 +22,7 @@ enum mapping_flags { | |||
| 22 | AS_EIO = __GFP_BITS_SHIFT + 0, /* IO error on async write */ | 22 | AS_EIO = __GFP_BITS_SHIFT + 0, /* IO error on async write */ |
| 23 | AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */ | 23 | AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */ |
| 24 | AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */ | 24 | AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */ |
| 25 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
| 26 | AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */ | 25 | AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */ |
| 27 | #endif | ||
| 28 | }; | 26 | }; |
| 29 | 27 | ||
| 30 | static inline void mapping_set_error(struct address_space *mapping, int error) | 28 | static inline void mapping_set_error(struct address_space *mapping, int error) |
| @@ -37,8 +35,6 @@ static inline void mapping_set_error(struct address_space *mapping, int error) | |||
| 37 | } | 35 | } |
| 38 | } | 36 | } |
| 39 | 37 | ||
| 40 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
| 41 | |||
| 42 | static inline void mapping_set_unevictable(struct address_space *mapping) | 38 | static inline void mapping_set_unevictable(struct address_space *mapping) |
| 43 | { | 39 | { |
| 44 | set_bit(AS_UNEVICTABLE, &mapping->flags); | 40 | set_bit(AS_UNEVICTABLE, &mapping->flags); |
| @@ -55,14 +51,6 @@ static inline int mapping_unevictable(struct address_space *mapping) | |||
| 55 | return test_bit(AS_UNEVICTABLE, &mapping->flags); | 51 | return test_bit(AS_UNEVICTABLE, &mapping->flags); |
| 56 | return !!mapping; | 52 | return !!mapping; |
| 57 | } | 53 | } |
| 58 | #else | ||
| 59 | static inline void mapping_set_unevictable(struct address_space *mapping) { } | ||
| 60 | static inline void mapping_clear_unevictable(struct address_space *mapping) { } | ||
| 61 | static inline int mapping_unevictable(struct address_space *mapping) | ||
| 62 | { | ||
| 63 | return 0; | ||
| 64 | } | ||
| 65 | #endif | ||
| 66 | 54 | ||
| 67 | static inline gfp_t mapping_gfp_mask(struct address_space * mapping) | 55 | static inline gfp_t mapping_gfp_mask(struct address_space * mapping) |
| 68 | { | 56 | { |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 72698d89e767..8e366bb0705f 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -124,6 +124,14 @@ typedef int __bitwise pci_power_t; | |||
| 124 | #define PCI_UNKNOWN ((pci_power_t __force) 5) | 124 | #define PCI_UNKNOWN ((pci_power_t __force) 5) |
| 125 | #define PCI_POWER_ERROR ((pci_power_t __force) -1) | 125 | #define PCI_POWER_ERROR ((pci_power_t __force) -1) |
| 126 | 126 | ||
| 127 | /* Remember to update this when the list above changes! */ | ||
| 128 | extern const char *pci_power_names[]; | ||
| 129 | |||
| 130 | static inline const char *pci_power_name(pci_power_t state) | ||
| 131 | { | ||
| 132 | return pci_power_names[1 + (int) state]; | ||
| 133 | } | ||
| 134 | |||
| 127 | #define PCI_PM_D2_DELAY 200 | 135 | #define PCI_PM_D2_DELAY 200 |
| 128 | #define PCI_PM_D3_WAIT 10 | 136 | #define PCI_PM_D3_WAIT 10 |
| 129 | #define PCI_PM_BUS_WAIT 50 | 137 | #define PCI_PM_BUS_WAIT 50 |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index aa01d38c9971..a3b000365795 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
| @@ -104,6 +104,7 @@ | |||
| 104 | #define PCI_CLASS_SERIAL_USB_UHCI 0x0c0300 | 104 | #define PCI_CLASS_SERIAL_USB_UHCI 0x0c0300 |
| 105 | #define PCI_CLASS_SERIAL_USB_OHCI 0x0c0310 | 105 | #define PCI_CLASS_SERIAL_USB_OHCI 0x0c0310 |
| 106 | #define PCI_CLASS_SERIAL_USB_EHCI 0x0c0320 | 106 | #define PCI_CLASS_SERIAL_USB_EHCI 0x0c0320 |
| 107 | #define PCI_CLASS_SERIAL_USB_XHCI 0x0c0330 | ||
| 107 | #define PCI_CLASS_SERIAL_FIBER 0x0c04 | 108 | #define PCI_CLASS_SERIAL_FIBER 0x0c04 |
| 108 | #define PCI_CLASS_SERIAL_SMBUS 0x0c05 | 109 | #define PCI_CLASS_SERIAL_SMBUS 0x0c05 |
| 109 | 110 | ||
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index b67bb5d7b221..8dc5123b6305 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
| @@ -36,8 +36,8 @@ extern struct device platform_bus; | |||
| 36 | 36 | ||
| 37 | extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int); | 37 | extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int); |
| 38 | extern int platform_get_irq(struct platform_device *, unsigned int); | 38 | extern int platform_get_irq(struct platform_device *, unsigned int); |
| 39 | extern struct resource *platform_get_resource_byname(struct platform_device *, unsigned int, char *); | 39 | extern struct resource *platform_get_resource_byname(struct platform_device *, unsigned int, const char *); |
| 40 | extern int platform_get_irq_byname(struct platform_device *, char *); | 40 | extern int platform_get_irq_byname(struct platform_device *, const char *); |
| 41 | extern int platform_add_devices(struct platform_device **, int); | 41 | extern int platform_add_devices(struct platform_device **, int); |
| 42 | 42 | ||
| 43 | extern struct platform_device *platform_device_register_simple(const char *, int id, | 43 | extern struct platform_device *platform_device_register_simple(const char *, int id, |
diff --git a/include/linux/poll.h b/include/linux/poll.h index 8c24ef8d9976..fa287f25138d 100644 --- a/include/linux/poll.h +++ b/include/linux/poll.h | |||
| @@ -32,6 +32,7 @@ typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_ | |||
| 32 | 32 | ||
| 33 | typedef struct poll_table_struct { | 33 | typedef struct poll_table_struct { |
| 34 | poll_queue_proc qproc; | 34 | poll_queue_proc qproc; |
| 35 | unsigned long key; | ||
| 35 | } poll_table; | 36 | } poll_table; |
| 36 | 37 | ||
| 37 | static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) | 38 | static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) |
| @@ -43,10 +44,12 @@ static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_addres | |||
| 43 | static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc) | 44 | static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc) |
| 44 | { | 45 | { |
| 45 | pt->qproc = qproc; | 46 | pt->qproc = qproc; |
| 47 | pt->key = ~0UL; /* all events enabled */ | ||
| 46 | } | 48 | } |
| 47 | 49 | ||
| 48 | struct poll_table_entry { | 50 | struct poll_table_entry { |
| 49 | struct file *filp; | 51 | struct file *filp; |
| 52 | unsigned long key; | ||
| 50 | wait_queue_t wait; | 53 | wait_queue_t wait; |
| 51 | wait_queue_head_t *wait_address; | 54 | wait_queue_head_t *wait_address; |
| 52 | }; | 55 | }; |
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index 355f6e80db0d..c5da74918096 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h | |||
| @@ -167,6 +167,8 @@ radix_tree_gang_lookup_slot(struct radix_tree_root *root, void ***results, | |||
| 167 | unsigned long first_index, unsigned int max_items); | 167 | unsigned long first_index, unsigned int max_items); |
| 168 | unsigned long radix_tree_next_hole(struct radix_tree_root *root, | 168 | unsigned long radix_tree_next_hole(struct radix_tree_root *root, |
| 169 | unsigned long index, unsigned long max_scan); | 169 | unsigned long index, unsigned long max_scan); |
| 170 | unsigned long radix_tree_prev_hole(struct radix_tree_root *root, | ||
| 171 | unsigned long index, unsigned long max_scan); | ||
| 170 | int radix_tree_preload(gfp_t gfp_mask); | 172 | int radix_tree_preload(gfp_t gfp_mask); |
| 171 | void radix_tree_init(void); | 173 | void radix_tree_init(void); |
| 172 | void *radix_tree_tag_set(struct radix_tree_root *root, | 174 | void *radix_tree_tag_set(struct radix_tree_root *root, |
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h index 8670f1575fe1..29f8599e6bea 100644 --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #ifndef _LINUX_RING_BUFFER_H | 1 | #ifndef _LINUX_RING_BUFFER_H |
| 2 | #define _LINUX_RING_BUFFER_H | 2 | #define _LINUX_RING_BUFFER_H |
| 3 | 3 | ||
| 4 | #include <linux/kmemcheck.h> | ||
| 4 | #include <linux/mm.h> | 5 | #include <linux/mm.h> |
| 5 | #include <linux/seq_file.h> | 6 | #include <linux/seq_file.h> |
| 6 | 7 | ||
| @@ -11,7 +12,10 @@ struct ring_buffer_iter; | |||
| 11 | * Don't refer to this struct directly, use functions below. | 12 | * Don't refer to this struct directly, use functions below. |
| 12 | */ | 13 | */ |
| 13 | struct ring_buffer_event { | 14 | struct ring_buffer_event { |
| 15 | kmemcheck_bitfield_begin(bitfield); | ||
| 14 | u32 type_len:5, time_delta:27; | 16 | u32 type_len:5, time_delta:27; |
| 17 | kmemcheck_bitfield_end(bitfield); | ||
| 18 | |||
| 15 | u32 array[]; | 19 | u32 array[]; |
| 16 | }; | 20 | }; |
| 17 | 21 | ||
diff --git a/include/linux/rmap.h b/include/linux/rmap.h index b35bc0e19cd9..216d024f830d 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h | |||
| @@ -83,7 +83,8 @@ static inline void page_dup_rmap(struct page *page, struct vm_area_struct *vma, | |||
| 83 | /* | 83 | /* |
| 84 | * Called from mm/vmscan.c to handle paging out | 84 | * Called from mm/vmscan.c to handle paging out |
| 85 | */ | 85 | */ |
| 86 | int page_referenced(struct page *, int is_locked, struct mem_cgroup *cnt); | 86 | int page_referenced(struct page *, int is_locked, |
| 87 | struct mem_cgroup *cnt, unsigned long *vm_flags); | ||
| 87 | int try_to_unmap(struct page *, int ignore_refs); | 88 | int try_to_unmap(struct page *, int ignore_refs); |
| 88 | 89 | ||
| 89 | /* | 90 | /* |
| @@ -105,18 +106,11 @@ unsigned long page_address_in_vma(struct page *, struct vm_area_struct *); | |||
| 105 | */ | 106 | */ |
| 106 | int page_mkclean(struct page *); | 107 | int page_mkclean(struct page *); |
| 107 | 108 | ||
| 108 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
| 109 | /* | 109 | /* |
| 110 | * called in munlock()/munmap() path to check for other vmas holding | 110 | * called in munlock()/munmap() path to check for other vmas holding |
| 111 | * the page mlocked. | 111 | * the page mlocked. |
| 112 | */ | 112 | */ |
| 113 | int try_to_munlock(struct page *); | 113 | int try_to_munlock(struct page *); |
| 114 | #else | ||
| 115 | static inline int try_to_munlock(struct page *page) | ||
| 116 | { | ||
| 117 | return 0; /* a.k.a. SWAP_SUCCESS */ | ||
| 118 | } | ||
| 119 | #endif | ||
| 120 | 114 | ||
| 121 | #else /* !CONFIG_MMU */ | 115 | #else /* !CONFIG_MMU */ |
| 122 | 116 | ||
| @@ -124,7 +118,7 @@ static inline int try_to_munlock(struct page *page) | |||
| 124 | #define anon_vma_prepare(vma) (0) | 118 | #define anon_vma_prepare(vma) (0) |
| 125 | #define anon_vma_link(vma) do {} while (0) | 119 | #define anon_vma_link(vma) do {} while (0) |
| 126 | 120 | ||
| 127 | #define page_referenced(page,l,cnt) TestClearPageReferenced(page) | 121 | #define page_referenced(page, locked, cnt, flags) TestClearPageReferenced(page) |
| 128 | #define try_to_unmap(page, refs) SWAP_FAIL | 122 | #define try_to_unmap(page, refs) SWAP_FAIL |
| 129 | 123 | ||
| 130 | static inline int page_mkclean(struct page *page) | 124 | static inline int page_mkclean(struct page *page) |
diff --git a/include/linux/sched.h b/include/linux/sched.h index c900aa530070..02042e7f2196 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -674,7 +674,7 @@ struct user_struct { | |||
| 674 | struct task_group *tg; | 674 | struct task_group *tg; |
| 675 | #ifdef CONFIG_SYSFS | 675 | #ifdef CONFIG_SYSFS |
| 676 | struct kobject kobj; | 676 | struct kobject kobj; |
| 677 | struct work_struct work; | 677 | struct delayed_work work; |
| 678 | #endif | 678 | #endif |
| 679 | #endif | 679 | #endif |
| 680 | 680 | ||
| @@ -1178,7 +1178,6 @@ struct task_struct { | |||
| 1178 | * a short time | 1178 | * a short time |
| 1179 | */ | 1179 | */ |
| 1180 | unsigned char fpu_counter; | 1180 | unsigned char fpu_counter; |
| 1181 | s8 oomkilladj; /* OOM kill score adjustment (bit shift). */ | ||
| 1182 | #ifdef CONFIG_BLK_DEV_IO_TRACE | 1181 | #ifdef CONFIG_BLK_DEV_IO_TRACE |
| 1183 | unsigned int btrace_seq; | 1182 | unsigned int btrace_seq; |
| 1184 | #endif | 1183 | #endif |
| @@ -1318,7 +1317,8 @@ struct task_struct { | |||
| 1318 | /* Thread group tracking */ | 1317 | /* Thread group tracking */ |
| 1319 | u32 parent_exec_id; | 1318 | u32 parent_exec_id; |
| 1320 | u32 self_exec_id; | 1319 | u32 self_exec_id; |
| 1321 | /* Protection of (de-)allocation: mm, files, fs, tty, keyrings */ | 1320 | /* Protection of (de-)allocation: mm, files, fs, tty, keyrings, mems_allowed, |
| 1321 | * mempolicy */ | ||
| 1322 | spinlock_t alloc_lock; | 1322 | spinlock_t alloc_lock; |
| 1323 | 1323 | ||
| 1324 | #ifdef CONFIG_GENERIC_HARDIRQS | 1324 | #ifdef CONFIG_GENERIC_HARDIRQS |
| @@ -1386,8 +1386,7 @@ struct task_struct { | |||
| 1386 | cputime_t acct_timexpd; /* stime + utime since last update */ | 1386 | cputime_t acct_timexpd; /* stime + utime since last update */ |
| 1387 | #endif | 1387 | #endif |
| 1388 | #ifdef CONFIG_CPUSETS | 1388 | #ifdef CONFIG_CPUSETS |
| 1389 | nodemask_t mems_allowed; | 1389 | nodemask_t mems_allowed; /* Protected by alloc_lock */ |
| 1390 | int cpuset_mems_generation; | ||
| 1391 | int cpuset_mem_spread_rotor; | 1390 | int cpuset_mem_spread_rotor; |
| 1392 | #endif | 1391 | #endif |
| 1393 | #ifdef CONFIG_CGROUPS | 1392 | #ifdef CONFIG_CGROUPS |
| @@ -1410,7 +1409,7 @@ struct task_struct { | |||
| 1410 | struct list_head perf_counter_list; | 1409 | struct list_head perf_counter_list; |
| 1411 | #endif | 1410 | #endif |
| 1412 | #ifdef CONFIG_NUMA | 1411 | #ifdef CONFIG_NUMA |
| 1413 | struct mempolicy *mempolicy; | 1412 | struct mempolicy *mempolicy; /* Protected by alloc_lock */ |
| 1414 | short il_next; | 1413 | short il_next; |
| 1415 | #endif | 1414 | #endif |
| 1416 | atomic_t fs_excl; /* holding fs exclusive resources */ | 1415 | atomic_t fs_excl; /* holding fs exclusive resources */ |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index fa51293f2708..63ef24bc01d0 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #define _LINUX_SKBUFF_H | 15 | #define _LINUX_SKBUFF_H |
| 16 | 16 | ||
| 17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
| 18 | #include <linux/kmemcheck.h> | ||
| 18 | #include <linux/compiler.h> | 19 | #include <linux/compiler.h> |
| 19 | #include <linux/time.h> | 20 | #include <linux/time.h> |
| 20 | #include <linux/cache.h> | 21 | #include <linux/cache.h> |
| @@ -343,6 +344,7 @@ struct sk_buff { | |||
| 343 | }; | 344 | }; |
| 344 | }; | 345 | }; |
| 345 | __u32 priority; | 346 | __u32 priority; |
| 347 | kmemcheck_bitfield_begin(flags1); | ||
| 346 | __u8 local_df:1, | 348 | __u8 local_df:1, |
| 347 | cloned:1, | 349 | cloned:1, |
| 348 | ip_summed:2, | 350 | ip_summed:2, |
| @@ -353,6 +355,7 @@ struct sk_buff { | |||
| 353 | ipvs_property:1, | 355 | ipvs_property:1, |
| 354 | peeked:1, | 356 | peeked:1, |
| 355 | nf_trace:1; | 357 | nf_trace:1; |
| 358 | kmemcheck_bitfield_end(flags1); | ||
| 356 | __be16 protocol; | 359 | __be16 protocol; |
| 357 | 360 | ||
| 358 | void (*destructor)(struct sk_buff *skb); | 361 | void (*destructor)(struct sk_buff *skb); |
| @@ -372,12 +375,16 @@ struct sk_buff { | |||
| 372 | __u16 tc_verd; /* traffic control verdict */ | 375 | __u16 tc_verd; /* traffic control verdict */ |
| 373 | #endif | 376 | #endif |
| 374 | #endif | 377 | #endif |
| 378 | |||
| 379 | kmemcheck_bitfield_begin(flags2); | ||
| 375 | #ifdef CONFIG_IPV6_NDISC_NODETYPE | 380 | #ifdef CONFIG_IPV6_NDISC_NODETYPE |
| 376 | __u8 ndisc_nodetype:2; | 381 | __u8 ndisc_nodetype:2; |
| 377 | #endif | 382 | #endif |
| 378 | #if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE) | 383 | #if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE) |
| 379 | __u8 do_not_encrypt:1; | 384 | __u8 do_not_encrypt:1; |
| 380 | #endif | 385 | #endif |
| 386 | kmemcheck_bitfield_end(flags2); | ||
| 387 | |||
| 381 | /* 0/13/14 bit hole */ | 388 | /* 0/13/14 bit hole */ |
| 382 | 389 | ||
| 383 | #ifdef CONFIG_NET_DMA | 390 | #ifdef CONFIG_NET_DMA |
diff --git a/include/linux/slab.h b/include/linux/slab.h index 219b8fb4651d..2da8372519f5 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
| @@ -64,6 +64,13 @@ | |||
| 64 | 64 | ||
| 65 | #define SLAB_NOLEAKTRACE 0x00800000UL /* Avoid kmemleak tracing */ | 65 | #define SLAB_NOLEAKTRACE 0x00800000UL /* Avoid kmemleak tracing */ |
| 66 | 66 | ||
| 67 | /* Don't track use of uninitialized memory */ | ||
| 68 | #ifdef CONFIG_KMEMCHECK | ||
| 69 | # define SLAB_NOTRACK 0x01000000UL | ||
| 70 | #else | ||
| 71 | # define SLAB_NOTRACK 0x00000000UL | ||
| 72 | #endif | ||
| 73 | |||
| 67 | /* The following flags affect the page allocator grouping pages by mobility */ | 74 | /* The following flags affect the page allocator grouping pages by mobility */ |
| 68 | #define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ | 75 | #define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ |
| 69 | #define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */ | 76 | #define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */ |
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h index 713f841ecaa9..850d057500de 100644 --- a/include/linux/slab_def.h +++ b/include/linux/slab_def.h | |||
| @@ -16,6 +16,87 @@ | |||
| 16 | #include <linux/compiler.h> | 16 | #include <linux/compiler.h> |
| 17 | #include <linux/kmemtrace.h> | 17 | #include <linux/kmemtrace.h> |
| 18 | 18 | ||
| 19 | /* | ||
| 20 | * struct kmem_cache | ||
| 21 | * | ||
| 22 | * manages a cache. | ||
| 23 | */ | ||
| 24 | |||
| 25 | struct kmem_cache { | ||
| 26 | /* 1) per-cpu data, touched during every alloc/free */ | ||
| 27 | struct array_cache *array[NR_CPUS]; | ||
| 28 | /* 2) Cache tunables. Protected by cache_chain_mutex */ | ||
| 29 | unsigned int batchcount; | ||
| 30 | unsigned int limit; | ||
| 31 | unsigned int shared; | ||
| 32 | |||
| 33 | unsigned int buffer_size; | ||
| 34 | u32 reciprocal_buffer_size; | ||
| 35 | /* 3) touched by every alloc & free from the backend */ | ||
| 36 | |||
| 37 | unsigned int flags; /* constant flags */ | ||
| 38 | unsigned int num; /* # of objs per slab */ | ||
| 39 | |||
| 40 | /* 4) cache_grow/shrink */ | ||
| 41 | /* order of pgs per slab (2^n) */ | ||
| 42 | unsigned int gfporder; | ||
| 43 | |||
| 44 | /* force GFP flags, e.g. GFP_DMA */ | ||
| 45 | gfp_t gfpflags; | ||
| 46 | |||
| 47 | size_t colour; /* cache colouring range */ | ||
| 48 | unsigned int colour_off; /* colour offset */ | ||
| 49 | struct kmem_cache *slabp_cache; | ||
| 50 | unsigned int slab_size; | ||
| 51 | unsigned int dflags; /* dynamic flags */ | ||
| 52 | |||
| 53 | /* constructor func */ | ||
| 54 | void (*ctor)(void *obj); | ||
| 55 | |||
| 56 | /* 5) cache creation/removal */ | ||
| 57 | const char *name; | ||
| 58 | struct list_head next; | ||
| 59 | |||
| 60 | /* 6) statistics */ | ||
| 61 | #ifdef CONFIG_DEBUG_SLAB | ||
| 62 | unsigned long num_active; | ||
| 63 | unsigned long num_allocations; | ||
| 64 | unsigned long high_mark; | ||
| 65 | unsigned long grown; | ||
| 66 | unsigned long reaped; | ||
| 67 | unsigned long errors; | ||
| 68 | unsigned long max_freeable; | ||
| 69 | unsigned long node_allocs; | ||
| 70 | unsigned long node_frees; | ||
| 71 | unsigned long node_overflow; | ||
| 72 | atomic_t allochit; | ||
| 73 | atomic_t allocmiss; | ||
| 74 | atomic_t freehit; | ||
| 75 | atomic_t freemiss; | ||
| 76 | |||
| 77 | /* | ||
| 78 | * If debugging is enabled, then the allocator can add additional | ||
| 79 | * fields and/or padding to every object. buffer_size contains the total | ||
| 80 | * object size including these internal fields, the following two | ||
| 81 | * variables contain the offset to the user object and its size. | ||
| 82 | */ | ||
| 83 | int obj_offset; | ||
| 84 | int obj_size; | ||
| 85 | #endif /* CONFIG_DEBUG_SLAB */ | ||
| 86 | |||
| 87 | /* | ||
| 88 | * We put nodelists[] at the end of kmem_cache, because we want to size | ||
| 89 | * this array to nr_node_ids slots instead of MAX_NUMNODES | ||
| 90 | * (see kmem_cache_init()) | ||
| 91 | * We still use [MAX_NUMNODES] and not [1] or [0] because cache_cache | ||
| 92 | * is statically defined, so we reserve the max number of nodes. | ||
| 93 | */ | ||
| 94 | struct kmem_list3 *nodelists[MAX_NUMNODES]; | ||
| 95 | /* | ||
| 96 | * Do not add fields after nodelists[] | ||
| 97 | */ | ||
| 98 | }; | ||
| 99 | |||
| 19 | /* Size description struct for general caches. */ | 100 | /* Size description struct for general caches. */ |
| 20 | struct cache_sizes { | 101 | struct cache_sizes { |
| 21 | size_t cs_size; | 102 | size_t cs_size; |
diff --git a/include/linux/smp.h b/include/linux/smp.h index a69db820eed6..9e3d8af09207 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h | |||
| @@ -177,7 +177,6 @@ static inline void init_call_single_data(void) | |||
| 177 | 177 | ||
| 178 | #define get_cpu() ({ preempt_disable(); smp_processor_id(); }) | 178 | #define get_cpu() ({ preempt_disable(); smp_processor_id(); }) |
| 179 | #define put_cpu() preempt_enable() | 179 | #define put_cpu() preempt_enable() |
| 180 | #define put_cpu_no_resched() preempt_enable_no_resched() | ||
| 181 | 180 | ||
| 182 | /* | 181 | /* |
| 183 | * Callback to arch code if there's nosmp or maxcpus=0 on the | 182 | * Callback to arch code if there's nosmp or maxcpus=0 on the |
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h index 1a8cecc4f38c..51efbef38fb0 100644 --- a/include/linux/stacktrace.h +++ b/include/linux/stacktrace.h | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | struct task_struct; | 4 | struct task_struct; |
| 5 | 5 | ||
| 6 | #ifdef CONFIG_STACKTRACE | 6 | #ifdef CONFIG_STACKTRACE |
| 7 | struct task_struct; | ||
| 8 | |||
| 7 | struct stack_trace { | 9 | struct stack_trace { |
| 8 | unsigned int nr_entries, max_entries; | 10 | unsigned int nr_entries, max_entries; |
| 9 | unsigned long *entries; | 11 | unsigned long *entries; |
| @@ -11,6 +13,7 @@ struct stack_trace { | |||
| 11 | }; | 13 | }; |
| 12 | 14 | ||
| 13 | extern void save_stack_trace(struct stack_trace *trace); | 15 | extern void save_stack_trace(struct stack_trace *trace); |
| 16 | extern void save_stack_trace_bp(struct stack_trace *trace, unsigned long bp); | ||
| 14 | extern void save_stack_trace_tsk(struct task_struct *tsk, | 17 | extern void save_stack_trace_tsk(struct task_struct *tsk, |
| 15 | struct stack_trace *trace); | 18 | struct stack_trace *trace); |
| 16 | 19 | ||
diff --git a/include/linux/swap.h b/include/linux/swap.h index d476aad3ff57..0cedf31af0b0 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
| @@ -129,9 +129,10 @@ enum { | |||
| 129 | 129 | ||
| 130 | #define SWAP_CLUSTER_MAX 32 | 130 | #define SWAP_CLUSTER_MAX 32 |
| 131 | 131 | ||
| 132 | #define SWAP_MAP_MAX 0x7fff | 132 | #define SWAP_MAP_MAX 0x7ffe |
| 133 | #define SWAP_MAP_BAD 0x8000 | 133 | #define SWAP_MAP_BAD 0x7fff |
| 134 | 134 | #define SWAP_HAS_CACHE 0x8000 /* There is a swap cache of entry. */ | |
| 135 | #define SWAP_COUNT_MASK (~SWAP_HAS_CACHE) | ||
| 135 | /* | 136 | /* |
| 136 | * The in-memory structure used to track swap areas. | 137 | * The in-memory structure used to track swap areas. |
| 137 | */ | 138 | */ |
| @@ -235,7 +236,6 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order) | |||
| 235 | } | 236 | } |
| 236 | #endif | 237 | #endif |
| 237 | 238 | ||
| 238 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
| 239 | extern int page_evictable(struct page *page, struct vm_area_struct *vma); | 239 | extern int page_evictable(struct page *page, struct vm_area_struct *vma); |
| 240 | extern void scan_mapping_unevictable_pages(struct address_space *); | 240 | extern void scan_mapping_unevictable_pages(struct address_space *); |
| 241 | 241 | ||
| @@ -244,24 +244,6 @@ extern int scan_unevictable_handler(struct ctl_table *, int, struct file *, | |||
| 244 | void __user *, size_t *, loff_t *); | 244 | void __user *, size_t *, loff_t *); |
| 245 | extern int scan_unevictable_register_node(struct node *node); | 245 | extern int scan_unevictable_register_node(struct node *node); |
| 246 | extern void scan_unevictable_unregister_node(struct node *node); | 246 | extern void scan_unevictable_unregister_node(struct node *node); |
| 247 | #else | ||
| 248 | static inline int page_evictable(struct page *page, | ||
| 249 | struct vm_area_struct *vma) | ||
| 250 | { | ||
| 251 | return 1; | ||
| 252 | } | ||
| 253 | |||
| 254 | static inline void scan_mapping_unevictable_pages(struct address_space *mapping) | ||
| 255 | { | ||
| 256 | } | ||
| 257 | |||
| 258 | static inline int scan_unevictable_register_node(struct node *node) | ||
| 259 | { | ||
| 260 | return 0; | ||
| 261 | } | ||
| 262 | |||
| 263 | static inline void scan_unevictable_unregister_node(struct node *node) { } | ||
| 264 | #endif | ||
| 265 | 247 | ||
| 266 | extern int kswapd_run(int nid); | 248 | extern int kswapd_run(int nid); |
| 267 | 249 | ||
| @@ -274,7 +256,7 @@ extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *); | |||
| 274 | 256 | ||
| 275 | #ifdef CONFIG_SWAP | 257 | #ifdef CONFIG_SWAP |
| 276 | /* linux/mm/page_io.c */ | 258 | /* linux/mm/page_io.c */ |
| 277 | extern int swap_readpage(struct file *, struct page *); | 259 | extern int swap_readpage(struct page *); |
| 278 | extern int swap_writepage(struct page *page, struct writeback_control *wbc); | 260 | extern int swap_writepage(struct page *page, struct writeback_control *wbc); |
| 279 | extern void end_swap_bio_read(struct bio *bio, int err); | 261 | extern void end_swap_bio_read(struct bio *bio, int err); |
| 280 | 262 | ||
| @@ -300,9 +282,11 @@ extern long total_swap_pages; | |||
| 300 | extern void si_swapinfo(struct sysinfo *); | 282 | extern void si_swapinfo(struct sysinfo *); |
| 301 | extern swp_entry_t get_swap_page(void); | 283 | extern swp_entry_t get_swap_page(void); |
| 302 | extern swp_entry_t get_swap_page_of_type(int); | 284 | extern swp_entry_t get_swap_page_of_type(int); |
| 303 | extern int swap_duplicate(swp_entry_t); | 285 | extern void swap_duplicate(swp_entry_t); |
| 286 | extern int swapcache_prepare(swp_entry_t); | ||
| 304 | extern int valid_swaphandles(swp_entry_t, unsigned long *); | 287 | extern int valid_swaphandles(swp_entry_t, unsigned long *); |
| 305 | extern void swap_free(swp_entry_t); | 288 | extern void swap_free(swp_entry_t); |
| 289 | extern void swapcache_free(swp_entry_t, struct page *page); | ||
| 306 | extern int free_swap_and_cache(swp_entry_t); | 290 | extern int free_swap_and_cache(swp_entry_t); |
| 307 | extern int swap_type_of(dev_t, sector_t, struct block_device **); | 291 | extern int swap_type_of(dev_t, sector_t, struct block_device **); |
| 308 | extern unsigned int count_swap_pages(int, int); | 292 | extern unsigned int count_swap_pages(int, int); |
| @@ -370,12 +354,20 @@ static inline void show_swap_cache_info(void) | |||
| 370 | } | 354 | } |
| 371 | 355 | ||
| 372 | #define free_swap_and_cache(swp) is_migration_entry(swp) | 356 | #define free_swap_and_cache(swp) is_migration_entry(swp) |
| 373 | #define swap_duplicate(swp) is_migration_entry(swp) | 357 | #define swapcache_prepare(swp) is_migration_entry(swp) |
| 358 | |||
| 359 | static inline void swap_duplicate(swp_entry_t swp) | ||
| 360 | { | ||
| 361 | } | ||
| 374 | 362 | ||
| 375 | static inline void swap_free(swp_entry_t swp) | 363 | static inline void swap_free(swp_entry_t swp) |
| 376 | { | 364 | { |
| 377 | } | 365 | } |
| 378 | 366 | ||
| 367 | static inline void swapcache_free(swp_entry_t swp, struct page *page) | ||
| 368 | { | ||
| 369 | } | ||
| 370 | |||
| 379 | static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask, | 371 | static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask, |
| 380 | struct vm_area_struct *vma, unsigned long addr) | 372 | struct vm_area_struct *vma, unsigned long addr) |
| 381 | { | 373 | { |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 418d90f5effe..fa4242cdade8 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
| @@ -434,6 +434,7 @@ asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg); | |||
| 434 | asmlinkage long sys_fcntl64(unsigned int fd, | 434 | asmlinkage long sys_fcntl64(unsigned int fd, |
| 435 | unsigned int cmd, unsigned long arg); | 435 | unsigned int cmd, unsigned long arg); |
| 436 | #endif | 436 | #endif |
| 437 | asmlinkage long sys_pipe(int __user *fildes); | ||
| 437 | asmlinkage long sys_pipe2(int __user *fildes, int flags); | 438 | asmlinkage long sys_pipe2(int __user *fildes, int flags); |
| 438 | asmlinkage long sys_dup(unsigned int fildes); | 439 | asmlinkage long sys_dup(unsigned int fildes); |
| 439 | asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd); | 440 | asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd); |
| @@ -751,8 +752,6 @@ asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *, | |||
| 751 | asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int, | 752 | asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int, |
| 752 | struct timespec __user *, const sigset_t __user *, | 753 | struct timespec __user *, const sigset_t __user *, |
| 753 | size_t); | 754 | size_t); |
| 754 | asmlinkage long sys_pipe2(int __user *, int); | ||
| 755 | asmlinkage long sys_pipe(int __user *); | ||
| 756 | 755 | ||
| 757 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]); | 756 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]); |
| 758 | 757 | ||
diff --git a/include/linux/timex.h b/include/linux/timex.h index 9910e3bd5b31..e6967d10d9e5 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h | |||
| @@ -280,6 +280,9 @@ extern int do_adjtimex(struct timex *); | |||
| 280 | 280 | ||
| 281 | int read_current_timer(unsigned long *timer_val); | 281 | int read_current_timer(unsigned long *timer_val); |
| 282 | 282 | ||
| 283 | /* The clock frequency of the i8253/i8254 PIT */ | ||
| 284 | #define PIT_TICK_RATE 1193182ul | ||
| 285 | |||
| 283 | #endif /* KERNEL */ | 286 | #endif /* KERNEL */ |
| 284 | 287 | ||
| 285 | #endif /* LINUX_TIMEX_H */ | 288 | #endif /* LINUX_TIMEX_H */ |
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 14df7e635d43..b9dc4ca0246f 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
| @@ -198,7 +198,7 @@ static inline void tracepoint_synchronize_unregister(void) | |||
| 198 | * * This is how the trace record is structured and will | 198 | * * This is how the trace record is structured and will |
| 199 | * * be saved into the ring buffer. These are the fields | 199 | * * be saved into the ring buffer. These are the fields |
| 200 | * * that will be exposed to user-space in | 200 | * * that will be exposed to user-space in |
| 201 | * * /debug/tracing/events/<*>/format. | 201 | * * /sys/kernel/debug/tracing/events/<*>/format. |
| 202 | * * | 202 | * * |
| 203 | * * The declared 'local variable' is called '__entry' | 203 | * * The declared 'local variable' is called '__entry' |
| 204 | * * | 204 | * * |
| @@ -258,7 +258,7 @@ static inline void tracepoint_synchronize_unregister(void) | |||
| 258 | * tracepoint callback (this is used by programmatic plugins and | 258 | * tracepoint callback (this is used by programmatic plugins and |
| 259 | * can also by used by generic instrumentation like SystemTap), and | 259 | * can also by used by generic instrumentation like SystemTap), and |
| 260 | * it is also used to expose a structured trace record in | 260 | * it is also used to expose a structured trace record in |
| 261 | * /debug/tracing/events/. | 261 | * /sys/kernel/debug/tracing/events/. |
| 262 | */ | 262 | */ |
| 263 | 263 | ||
| 264 | #define TRACE_EVENT(name, proto, args, struct, assign, print) \ | 264 | #define TRACE_EVENT(name, proto, args, struct, assign, print) \ |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 3aa2cd1f8d08..84929e914034 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
| @@ -36,6 +36,7 @@ struct wusb_dev; | |||
| 36 | * - configs have one (often) or more interfaces; | 36 | * - configs have one (often) or more interfaces; |
| 37 | * - interfaces have one (usually) or more settings; | 37 | * - interfaces have one (usually) or more settings; |
| 38 | * - each interface setting has zero or (usually) more endpoints. | 38 | * - each interface setting has zero or (usually) more endpoints. |
| 39 | * - a SuperSpeed endpoint has a companion descriptor | ||
| 39 | * | 40 | * |
| 40 | * And there might be other descriptors mixed in with those. | 41 | * And there might be other descriptors mixed in with those. |
| 41 | * | 42 | * |
| @@ -44,6 +45,19 @@ struct wusb_dev; | |||
| 44 | 45 | ||
| 45 | struct ep_device; | 46 | struct ep_device; |
| 46 | 47 | ||
| 48 | /* For SS devices */ | ||
| 49 | /** | ||
| 50 | * struct usb_host_ss_ep_comp - Valid for SuperSpeed devices only | ||
| 51 | * @desc: endpoint companion descriptor, wMaxPacketSize in native byteorder | ||
| 52 | * @extra: descriptors following this endpoint companion descriptor | ||
| 53 | * @extralen: how many bytes of "extra" are valid | ||
| 54 | */ | ||
| 55 | struct usb_host_ss_ep_comp { | ||
| 56 | struct usb_ss_ep_comp_descriptor desc; | ||
| 57 | unsigned char *extra; /* Extra descriptors */ | ||
| 58 | int extralen; | ||
| 59 | }; | ||
| 60 | |||
| 47 | /** | 61 | /** |
| 48 | * struct usb_host_endpoint - host-side endpoint descriptor and queue | 62 | * struct usb_host_endpoint - host-side endpoint descriptor and queue |
| 49 | * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder | 63 | * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder |
| @@ -51,6 +65,7 @@ struct ep_device; | |||
| 51 | * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) | 65 | * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) |
| 52 | * with one or more transfer descriptors (TDs) per urb | 66 | * with one or more transfer descriptors (TDs) per urb |
| 53 | * @ep_dev: ep_device for sysfs info | 67 | * @ep_dev: ep_device for sysfs info |
| 68 | * @ss_ep_comp: companion descriptor information for this endpoint | ||
| 54 | * @extra: descriptors following this endpoint in the configuration | 69 | * @extra: descriptors following this endpoint in the configuration |
| 55 | * @extralen: how many bytes of "extra" are valid | 70 | * @extralen: how many bytes of "extra" are valid |
| 56 | * @enabled: URBs may be submitted to this endpoint | 71 | * @enabled: URBs may be submitted to this endpoint |
| @@ -63,6 +78,7 @@ struct usb_host_endpoint { | |||
| 63 | struct list_head urb_list; | 78 | struct list_head urb_list; |
| 64 | void *hcpriv; | 79 | void *hcpriv; |
| 65 | struct ep_device *ep_dev; /* For sysfs info */ | 80 | struct ep_device *ep_dev; /* For sysfs info */ |
| 81 | struct usb_host_ss_ep_comp *ss_ep_comp; /* For SS devices */ | ||
| 66 | 82 | ||
| 67 | unsigned char *extra; /* Extra descriptors */ | 83 | unsigned char *extra; /* Extra descriptors */ |
| 68 | int extralen; | 84 | int extralen; |
| @@ -336,7 +352,6 @@ struct usb_bus { | |||
| 336 | #ifdef CONFIG_USB_DEVICEFS | 352 | #ifdef CONFIG_USB_DEVICEFS |
| 337 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ | 353 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ |
| 338 | #endif | 354 | #endif |
| 339 | struct device *dev; /* device for this bus */ | ||
| 340 | 355 | ||
| 341 | #if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) | 356 | #if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) |
| 342 | struct mon_bus *mon_bus; /* non-null when associated */ | 357 | struct mon_bus *mon_bus; /* non-null when associated */ |
| @@ -363,6 +378,7 @@ struct usb_tt; | |||
| 363 | * struct usb_device - kernel's representation of a USB device | 378 | * struct usb_device - kernel's representation of a USB device |
| 364 | * @devnum: device number; address on a USB bus | 379 | * @devnum: device number; address on a USB bus |
| 365 | * @devpath: device ID string for use in messages (e.g., /port/...) | 380 | * @devpath: device ID string for use in messages (e.g., /port/...) |
| 381 | * @route: tree topology hex string for use with xHCI | ||
| 366 | * @state: device state: configured, not attached, etc. | 382 | * @state: device state: configured, not attached, etc. |
| 367 | * @speed: device speed: high/full/low (or error) | 383 | * @speed: device speed: high/full/low (or error) |
| 368 | * @tt: Transaction Translator info; used with low/full speed dev, highspeed hub | 384 | * @tt: Transaction Translator info; used with low/full speed dev, highspeed hub |
| @@ -420,6 +436,7 @@ struct usb_tt; | |||
| 420 | * @skip_sys_resume: skip the next system resume | 436 | * @skip_sys_resume: skip the next system resume |
| 421 | * @wusb_dev: if this is a Wireless USB device, link to the WUSB | 437 | * @wusb_dev: if this is a Wireless USB device, link to the WUSB |
| 422 | * specific data for the device. | 438 | * specific data for the device. |
| 439 | * @slot_id: Slot ID assigned by xHCI | ||
| 423 | * | 440 | * |
| 424 | * Notes: | 441 | * Notes: |
| 425 | * Usbcore drivers should not set usbdev->state directly. Instead use | 442 | * Usbcore drivers should not set usbdev->state directly. Instead use |
| @@ -428,6 +445,7 @@ struct usb_tt; | |||
| 428 | struct usb_device { | 445 | struct usb_device { |
| 429 | int devnum; | 446 | int devnum; |
| 430 | char devpath [16]; | 447 | char devpath [16]; |
| 448 | u32 route; | ||
| 431 | enum usb_device_state state; | 449 | enum usb_device_state state; |
| 432 | enum usb_device_speed speed; | 450 | enum usb_device_speed speed; |
| 433 | 451 | ||
| @@ -503,6 +521,7 @@ struct usb_device { | |||
| 503 | unsigned skip_sys_resume:1; | 521 | unsigned skip_sys_resume:1; |
| 504 | #endif | 522 | #endif |
| 505 | struct wusb_dev *wusb_dev; | 523 | struct wusb_dev *wusb_dev; |
| 524 | int slot_id; | ||
| 506 | }; | 525 | }; |
| 507 | #define to_usb_device(d) container_of(d, struct usb_device, dev) | 526 | #define to_usb_device(d) container_of(d, struct usb_device, dev) |
| 508 | 527 | ||
| @@ -869,6 +888,8 @@ struct usb_driver { | |||
| 869 | * struct usb_device_driver - identifies USB device driver to usbcore | 888 | * struct usb_device_driver - identifies USB device driver to usbcore |
| 870 | * @name: The driver name should be unique among USB drivers, | 889 | * @name: The driver name should be unique among USB drivers, |
| 871 | * and should normally be the same as the module name. | 890 | * and should normally be the same as the module name. |
| 891 | * @nodename: Callback to provide a naming hint for a possible | ||
| 892 | * device node to create. | ||
| 872 | * @probe: Called to see if the driver is willing to manage a particular | 893 | * @probe: Called to see if the driver is willing to manage a particular |
| 873 | * device. If it is, probe returns zero and uses dev_set_drvdata() | 894 | * device. If it is, probe returns zero and uses dev_set_drvdata() |
| 874 | * to associate driver-specific data with the device. If unwilling | 895 | * to associate driver-specific data with the device. If unwilling |
| @@ -912,6 +933,7 @@ extern struct bus_type usb_bus_type; | |||
| 912 | */ | 933 | */ |
| 913 | struct usb_class_driver { | 934 | struct usb_class_driver { |
| 914 | char *name; | 935 | char *name; |
| 936 | char *(*nodename)(struct device *dev); | ||
| 915 | const struct file_operations *fops; | 937 | const struct file_operations *fops; |
| 916 | int minor_base; | 938 | int minor_base; |
| 917 | }; | 939 | }; |
| @@ -1041,7 +1063,9 @@ typedef void (*usb_complete_t)(struct urb *); | |||
| 1041 | * @setup_dma: For control transfers with URB_NO_SETUP_DMA_MAP set, the | 1063 | * @setup_dma: For control transfers with URB_NO_SETUP_DMA_MAP set, the |
| 1042 | * device driver has provided this DMA address for the setup packet. | 1064 | * device driver has provided this DMA address for the setup packet. |
| 1043 | * The host controller driver should use this in preference to | 1065 | * The host controller driver should use this in preference to |
| 1044 | * setup_packet. | 1066 | * setup_packet, but the HCD may chose to ignore the address if it must |
| 1067 | * copy the setup packet into internal structures. Therefore, setup_packet | ||
| 1068 | * must always point to a valid buffer. | ||
| 1045 | * @start_frame: Returns the initial frame for isochronous transfers. | 1069 | * @start_frame: Returns the initial frame for isochronous transfers. |
| 1046 | * @number_of_packets: Lists the number of ISO transfer buffers. | 1070 | * @number_of_packets: Lists the number of ISO transfer buffers. |
| 1047 | * @interval: Specifies the polling interval for interrupt or isochronous | 1071 | * @interval: Specifies the polling interval for interrupt or isochronous |
| @@ -1177,6 +1201,8 @@ struct urb { | |||
| 1177 | unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ | 1201 | unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ |
| 1178 | void *transfer_buffer; /* (in) associated data buffer */ | 1202 | void *transfer_buffer; /* (in) associated data buffer */ |
| 1179 | dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ | 1203 | dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ |
| 1204 | struct usb_sg_request *sg; /* (in) scatter gather buffer list */ | ||
| 1205 | int num_sgs; /* (in) number of entries in the sg list */ | ||
| 1180 | u32 transfer_buffer_length; /* (in) data buffer length */ | 1206 | u32 transfer_buffer_length; /* (in) data buffer length */ |
| 1181 | u32 actual_length; /* (return) actual transfer length */ | 1207 | u32 actual_length; /* (return) actual transfer length */ |
| 1182 | unsigned char *setup_packet; /* (in) setup packet (control only) */ | 1208 | unsigned char *setup_packet; /* (in) setup packet (control only) */ |
| @@ -1422,8 +1448,8 @@ struct usb_sg_request { | |||
| 1422 | int status; | 1448 | int status; |
| 1423 | size_t bytes; | 1449 | size_t bytes; |
| 1424 | 1450 | ||
| 1425 | /* | 1451 | /* private: |
| 1426 | * members below are private: to usbcore, | 1452 | * members below are private to usbcore, |
| 1427 | * and are not provided for driver access! | 1453 | * and are not provided for driver access! |
| 1428 | */ | 1454 | */ |
| 1429 | spinlock_t lock; | 1455 | spinlock_t lock; |
| @@ -1558,6 +1584,9 @@ extern void usb_unregister_notify(struct notifier_block *nb); | |||
| 1558 | #define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \ | 1584 | #define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \ |
| 1559 | format "\n" , ## arg) | 1585 | format "\n" , ## arg) |
| 1560 | 1586 | ||
| 1587 | /* debugfs stuff */ | ||
| 1588 | extern struct dentry *usb_debug_root; | ||
| 1589 | |||
| 1561 | #endif /* __KERNEL__ */ | 1590 | #endif /* __KERNEL__ */ |
| 1562 | 1591 | ||
| 1563 | #endif | 1592 | #endif |
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h index 8cb025fef634..b5744bc218ab 100644 --- a/include/linux/usb/audio.h +++ b/include/linux/usb/audio.h | |||
| @@ -24,10 +24,75 @@ | |||
| 24 | #define USB_SUBCLASS_AUDIOCONTROL 0x01 | 24 | #define USB_SUBCLASS_AUDIOCONTROL 0x01 |
| 25 | #define USB_SUBCLASS_AUDIOSTREAMING 0x02 | 25 | #define USB_SUBCLASS_AUDIOSTREAMING 0x02 |
| 26 | #define USB_SUBCLASS_MIDISTREAMING 0x03 | 26 | #define USB_SUBCLASS_MIDISTREAMING 0x03 |
| 27 | #define USB_SUBCLASS_VENDOR_SPEC 0xff | ||
| 27 | 28 | ||
| 29 | /* A.5 Audio Class-Specific AC interface Descriptor Subtypes*/ | ||
| 30 | #define HEADER 0x01 | ||
| 31 | #define INPUT_TERMINAL 0x02 | ||
| 32 | #define OUTPUT_TERMINAL 0x03 | ||
| 33 | #define MIXER_UNIT 0x04 | ||
| 34 | #define SELECTOR_UNIT 0x05 | ||
| 35 | #define FEATURE_UNIT 0x06 | ||
| 36 | #define PROCESSING_UNIT 0x07 | ||
| 37 | #define EXTENSION_UNIT 0x08 | ||
| 38 | |||
| 39 | #define AS_GENERAL 0x01 | ||
| 40 | #define FORMAT_TYPE 0x02 | ||
| 41 | #define FORMAT_SPECIFIC 0x03 | ||
| 42 | |||
| 43 | #define EP_GENERAL 0x01 | ||
| 44 | |||
| 45 | #define MS_GENERAL 0x01 | ||
| 46 | #define MIDI_IN_JACK 0x02 | ||
| 47 | #define MIDI_OUT_JACK 0x03 | ||
| 48 | |||
| 49 | /* endpoint attributes */ | ||
| 50 | #define EP_ATTR_MASK 0x0c | ||
| 51 | #define EP_ATTR_ASYNC 0x04 | ||
| 52 | #define EP_ATTR_ADAPTIVE 0x08 | ||
| 53 | #define EP_ATTR_SYNC 0x0c | ||
| 54 | |||
| 55 | /* cs endpoint attributes */ | ||
| 56 | #define EP_CS_ATTR_SAMPLE_RATE 0x01 | ||
| 57 | #define EP_CS_ATTR_PITCH_CONTROL 0x02 | ||
| 58 | #define EP_CS_ATTR_FILL_MAX 0x80 | ||
| 59 | |||
| 60 | /* Audio Class specific Request Codes */ | ||
| 61 | #define USB_AUDIO_SET_INTF 0x21 | ||
| 62 | #define USB_AUDIO_SET_ENDPOINT 0x22 | ||
| 63 | #define USB_AUDIO_GET_INTF 0xa1 | ||
| 64 | #define USB_AUDIO_GET_ENDPOINT 0xa2 | ||
| 65 | |||
| 66 | #define SET_ 0x00 | ||
| 67 | #define GET_ 0x80 | ||
| 68 | |||
| 69 | #define _CUR 0x1 | ||
| 70 | #define _MIN 0x2 | ||
| 71 | #define _MAX 0x3 | ||
| 72 | #define _RES 0x4 | ||
| 73 | #define _MEM 0x5 | ||
| 74 | |||
| 75 | #define SET_CUR (SET_ | _CUR) | ||
| 76 | #define GET_CUR (GET_ | _CUR) | ||
| 77 | #define SET_MIN (SET_ | _MIN) | ||
| 78 | #define GET_MIN (GET_ | _MIN) | ||
| 79 | #define SET_MAX (SET_ | _MAX) | ||
| 80 | #define GET_MAX (GET_ | _MAX) | ||
| 81 | #define SET_RES (SET_ | _RES) | ||
| 82 | #define GET_RES (GET_ | _RES) | ||
| 83 | #define SET_MEM (SET_ | _MEM) | ||
| 84 | #define GET_MEM (GET_ | _MEM) | ||
| 85 | |||
| 86 | #define GET_STAT 0xff | ||
| 87 | |||
| 88 | #define USB_AC_TERMINAL_UNDEFINED 0x100 | ||
| 89 | #define USB_AC_TERMINAL_STREAMING 0x101 | ||
| 90 | #define USB_AC_TERMINAL_VENDOR_SPEC 0x1FF | ||
| 91 | |||
| 92 | /* Terminal Control Selectors */ | ||
| 28 | /* 4.3.2 Class-Specific AC Interface Descriptor */ | 93 | /* 4.3.2 Class-Specific AC Interface Descriptor */ |
| 29 | struct usb_ac_header_descriptor { | 94 | struct usb_ac_header_descriptor { |
| 30 | __u8 bLength; /* 8+n */ | 95 | __u8 bLength; /* 8 + n */ |
| 31 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ | 96 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ |
| 32 | __u8 bDescriptorSubtype; /* USB_MS_HEADER */ | 97 | __u8 bDescriptorSubtype; /* USB_MS_HEADER */ |
| 33 | __le16 bcdADC; /* 0x0100 */ | 98 | __le16 bcdADC; /* 0x0100 */ |
| @@ -36,7 +101,7 @@ struct usb_ac_header_descriptor { | |||
| 36 | __u8 baInterfaceNr[]; /* [n] */ | 101 | __u8 baInterfaceNr[]; /* [n] */ |
| 37 | } __attribute__ ((packed)); | 102 | } __attribute__ ((packed)); |
| 38 | 103 | ||
| 39 | #define USB_DT_AC_HEADER_SIZE(n) (8+(n)) | 104 | #define USB_DT_AC_HEADER_SIZE(n) (8 + (n)) |
| 40 | 105 | ||
| 41 | /* As above, but more useful for defining your own descriptors: */ | 106 | /* As above, but more useful for defining your own descriptors: */ |
| 42 | #define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \ | 107 | #define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \ |
| @@ -50,4 +115,200 @@ struct usb_ac_header_descriptor_##n { \ | |||
| 50 | __u8 baInterfaceNr[n]; \ | 115 | __u8 baInterfaceNr[n]; \ |
| 51 | } __attribute__ ((packed)) | 116 | } __attribute__ ((packed)) |
| 52 | 117 | ||
| 118 | /* 4.3.2.1 Input Terminal Descriptor */ | ||
| 119 | struct usb_input_terminal_descriptor { | ||
| 120 | __u8 bLength; /* in bytes: 12 */ | ||
| 121 | __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ | ||
| 122 | __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */ | ||
| 123 | __u8 bTerminalID; /* Constant uniquely terminal ID */ | ||
| 124 | __le16 wTerminalType; /* USB Audio Terminal Types */ | ||
| 125 | __u8 bAssocTerminal; /* ID of the Output Terminal associated */ | ||
| 126 | __u8 bNrChannels; /* Number of logical output channels */ | ||
| 127 | __le16 wChannelConfig; | ||
| 128 | __u8 iChannelNames; | ||
| 129 | __u8 iTerminal; | ||
| 130 | } __attribute__ ((packed)); | ||
| 131 | |||
| 132 | #define USB_DT_AC_INPUT_TERMINAL_SIZE 12 | ||
| 133 | |||
| 134 | #define USB_AC_INPUT_TERMINAL_UNDEFINED 0x200 | ||
| 135 | #define USB_AC_INPUT_TERMINAL_MICROPHONE 0x201 | ||
| 136 | #define USB_AC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202 | ||
| 137 | #define USB_AC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203 | ||
| 138 | #define USB_AC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204 | ||
| 139 | #define USB_AC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205 | ||
| 140 | #define USB_AC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206 | ||
| 141 | |||
| 142 | /* 4.3.2.2 Output Terminal Descriptor */ | ||
| 143 | struct usb_output_terminal_descriptor { | ||
| 144 | __u8 bLength; /* in bytes: 9 */ | ||
| 145 | __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ | ||
| 146 | __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */ | ||
| 147 | __u8 bTerminalID; /* Constant uniquely terminal ID */ | ||
| 148 | __le16 wTerminalType; /* USB Audio Terminal Types */ | ||
| 149 | __u8 bAssocTerminal; /* ID of the Input Terminal associated */ | ||
| 150 | __u8 bSourceID; /* ID of the connected Unit or Terminal*/ | ||
| 151 | __u8 iTerminal; | ||
| 152 | } __attribute__ ((packed)); | ||
| 153 | |||
| 154 | #define USB_DT_AC_OUTPUT_TERMINAL_SIZE 9 | ||
| 155 | |||
| 156 | #define USB_AC_OUTPUT_TERMINAL_UNDEFINED 0x300 | ||
| 157 | #define USB_AC_OUTPUT_TERMINAL_SPEAKER 0x301 | ||
| 158 | #define USB_AC_OUTPUT_TERMINAL_HEADPHONES 0x302 | ||
| 159 | #define USB_AC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303 | ||
| 160 | #define USB_AC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304 | ||
| 161 | #define USB_AC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305 | ||
| 162 | #define USB_AC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306 | ||
| 163 | #define USB_AC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307 | ||
| 164 | |||
| 165 | /* Set bControlSize = 2 as default setting */ | ||
| 166 | #define USB_DT_AC_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2) | ||
| 167 | |||
| 168 | /* As above, but more useful for defining your own descriptors: */ | ||
| 169 | #define DECLARE_USB_AC_FEATURE_UNIT_DESCRIPTOR(ch) \ | ||
| 170 | struct usb_ac_feature_unit_descriptor_##ch { \ | ||
| 171 | __u8 bLength; \ | ||
| 172 | __u8 bDescriptorType; \ | ||
| 173 | __u8 bDescriptorSubtype; \ | ||
| 174 | __u8 bUnitID; \ | ||
| 175 | __u8 bSourceID; \ | ||
| 176 | __u8 bControlSize; \ | ||
| 177 | __le16 bmaControls[ch + 1]; \ | ||
| 178 | __u8 iFeature; \ | ||
| 179 | } __attribute__ ((packed)) | ||
| 180 | |||
| 181 | /* 4.5.2 Class-Specific AS Interface Descriptor */ | ||
| 182 | struct usb_as_header_descriptor { | ||
| 183 | __u8 bLength; /* in bytes: 7 */ | ||
| 184 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ | ||
| 185 | __u8 bDescriptorSubtype; /* AS_GENERAL */ | ||
| 186 | __u8 bTerminalLink; /* Terminal ID of connected Terminal */ | ||
| 187 | __u8 bDelay; /* Delay introduced by the data path */ | ||
| 188 | __le16 wFormatTag; /* The Audio Data Format */ | ||
| 189 | } __attribute__ ((packed)); | ||
| 190 | |||
| 191 | #define USB_DT_AS_HEADER_SIZE 7 | ||
| 192 | |||
| 193 | #define USB_AS_AUDIO_FORMAT_TYPE_I_UNDEFINED 0x0 | ||
| 194 | #define USB_AS_AUDIO_FORMAT_TYPE_I_PCM 0x1 | ||
| 195 | #define USB_AS_AUDIO_FORMAT_TYPE_I_PCM8 0x2 | ||
| 196 | #define USB_AS_AUDIO_FORMAT_TYPE_I_IEEE_FLOAT 0x3 | ||
| 197 | #define USB_AS_AUDIO_FORMAT_TYPE_I_ALAW 0x4 | ||
| 198 | #define USB_AS_AUDIO_FORMAT_TYPE_I_MULAW 0x5 | ||
| 199 | |||
| 200 | struct usb_as_format_type_i_continuous_descriptor { | ||
| 201 | __u8 bLength; /* in bytes: 8 + (ns * 3) */ | ||
| 202 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ | ||
| 203 | __u8 bDescriptorSubtype; /* FORMAT_TYPE */ | ||
| 204 | __u8 bFormatType; /* FORMAT_TYPE_1 */ | ||
| 205 | __u8 bNrChannels; /* physical channels in the stream */ | ||
| 206 | __u8 bSubframeSize; /* */ | ||
| 207 | __u8 bBitResolution; | ||
| 208 | __u8 bSamFreqType; | ||
| 209 | __u8 tLowerSamFreq[3]; | ||
| 210 | __u8 tUpperSamFreq[3]; | ||
| 211 | } __attribute__ ((packed)); | ||
| 212 | |||
| 213 | #define USB_AS_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14 | ||
| 214 | |||
| 215 | struct usb_as_formate_type_i_discrete_descriptor { | ||
| 216 | __u8 bLength; /* in bytes: 8 + (ns * 3) */ | ||
| 217 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ | ||
| 218 | __u8 bDescriptorSubtype; /* FORMAT_TYPE */ | ||
| 219 | __u8 bFormatType; /* FORMAT_TYPE_1 */ | ||
| 220 | __u8 bNrChannels; /* physical channels in the stream */ | ||
| 221 | __u8 bSubframeSize; /* */ | ||
| 222 | __u8 bBitResolution; | ||
| 223 | __u8 bSamFreqType; | ||
| 224 | __u8 tSamFreq[][3]; | ||
| 225 | } __attribute__ ((packed)); | ||
| 226 | |||
| 227 | #define DECLARE_USB_AS_FORMAT_TYPE_I_DISCRETE_DESC(n) \ | ||
| 228 | struct usb_as_formate_type_i_discrete_descriptor_##n { \ | ||
| 229 | __u8 bLength; \ | ||
| 230 | __u8 bDescriptorType; \ | ||
| 231 | __u8 bDescriptorSubtype; \ | ||
| 232 | __u8 bFormatType; \ | ||
| 233 | __u8 bNrChannels; \ | ||
| 234 | __u8 bSubframeSize; \ | ||
| 235 | __u8 bBitResolution; \ | ||
| 236 | __u8 bSamFreqType; \ | ||
| 237 | __u8 tSamFreq[n][3]; \ | ||
| 238 | } __attribute__ ((packed)) | ||
| 239 | |||
| 240 | #define USB_AS_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3)) | ||
| 241 | |||
| 242 | #define USB_AS_FORMAT_TYPE_UNDEFINED 0x0 | ||
| 243 | #define USB_AS_FORMAT_TYPE_I 0x1 | ||
| 244 | #define USB_AS_FORMAT_TYPE_II 0x2 | ||
| 245 | #define USB_AS_FORMAT_TYPE_III 0x3 | ||
| 246 | |||
| 247 | #define USB_AS_ENDPOINT_ASYNC (1 << 2) | ||
| 248 | #define USB_AS_ENDPOINT_ADAPTIVE (2 << 2) | ||
| 249 | #define USB_AS_ENDPOINT_SYNC (3 << 2) | ||
| 250 | |||
| 251 | struct usb_as_iso_endpoint_descriptor { | ||
| 252 | __u8 bLength; /* in bytes: 7 */ | ||
| 253 | __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */ | ||
| 254 | __u8 bDescriptorSubtype; /* EP_GENERAL */ | ||
| 255 | __u8 bmAttributes; | ||
| 256 | __u8 bLockDelayUnits; | ||
| 257 | __le16 wLockDelay; | ||
| 258 | }; | ||
| 259 | #define USB_AS_ISO_ENDPOINT_DESC_SIZE 7 | ||
| 260 | |||
| 261 | #define FU_CONTROL_UNDEFINED 0x00 | ||
| 262 | #define MUTE_CONTROL 0x01 | ||
| 263 | #define VOLUME_CONTROL 0x02 | ||
| 264 | #define BASS_CONTROL 0x03 | ||
| 265 | #define MID_CONTROL 0x04 | ||
| 266 | #define TREBLE_CONTROL 0x05 | ||
| 267 | #define GRAPHIC_EQUALIZER_CONTROL 0x06 | ||
| 268 | #define AUTOMATIC_GAIN_CONTROL 0x07 | ||
| 269 | #define DELAY_CONTROL 0x08 | ||
| 270 | #define BASS_BOOST_CONTROL 0x09 | ||
| 271 | #define LOUDNESS_CONTROL 0x0a | ||
| 272 | |||
| 273 | #define FU_MUTE (1 << (MUTE_CONTROL - 1)) | ||
| 274 | #define FU_VOLUME (1 << (VOLUME_CONTROL - 1)) | ||
| 275 | #define FU_BASS (1 << (BASS_CONTROL - 1)) | ||
| 276 | #define FU_MID (1 << (MID_CONTROL - 1)) | ||
| 277 | #define FU_TREBLE (1 << (TREBLE_CONTROL - 1)) | ||
| 278 | #define FU_GRAPHIC_EQ (1 << (GRAPHIC_EQUALIZER_CONTROL - 1)) | ||
| 279 | #define FU_AUTO_GAIN (1 << (AUTOMATIC_GAIN_CONTROL - 1)) | ||
| 280 | #define FU_DELAY (1 << (DELAY_CONTROL - 1)) | ||
| 281 | #define FU_BASS_BOOST (1 << (BASS_BOOST_CONTROL - 1)) | ||
| 282 | #define FU_LOUDNESS (1 << (LOUDNESS_CONTROL - 1)) | ||
| 283 | |||
| 284 | struct usb_audio_control { | ||
| 285 | struct list_head list; | ||
| 286 | const char *name; | ||
| 287 | u8 type; | ||
| 288 | int data[5]; | ||
| 289 | int (*set)(struct usb_audio_control *con, u8 cmd, int value); | ||
| 290 | int (*get)(struct usb_audio_control *con, u8 cmd); | ||
| 291 | }; | ||
| 292 | |||
| 293 | static inline int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value) | ||
| 294 | { | ||
| 295 | con->data[cmd] = value; | ||
| 296 | |||
| 297 | return 0; | ||
| 298 | } | ||
| 299 | |||
| 300 | static inline int generic_get_cmd(struct usb_audio_control *con, u8 cmd) | ||
| 301 | { | ||
| 302 | return con->data[cmd]; | ||
| 303 | } | ||
| 304 | |||
| 305 | struct usb_audio_control_selector { | ||
| 306 | struct list_head list; | ||
| 307 | struct list_head control; | ||
| 308 | u8 id; | ||
| 309 | const char *name; | ||
| 310 | u8 type; | ||
| 311 | struct usb_descriptor_header *desc; | ||
| 312 | }; | ||
| 313 | |||
| 53 | #endif /* __LINUX_USB_AUDIO_H */ | 314 | #endif /* __LINUX_USB_AUDIO_H */ |
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index b145119a90da..93223638f702 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h | |||
| @@ -191,6 +191,8 @@ struct usb_ctrlrequest { | |||
| 191 | #define USB_DT_WIRE_ADAPTER 0x21 | 191 | #define USB_DT_WIRE_ADAPTER 0x21 |
| 192 | #define USB_DT_RPIPE 0x22 | 192 | #define USB_DT_RPIPE 0x22 |
| 193 | #define USB_DT_CS_RADIO_CONTROL 0x23 | 193 | #define USB_DT_CS_RADIO_CONTROL 0x23 |
| 194 | /* From the USB 3.0 spec */ | ||
| 195 | #define USB_DT_SS_ENDPOINT_COMP 0x30 | ||
| 194 | 196 | ||
| 195 | /* Conventional codes for class-specific descriptors. The convention is | 197 | /* Conventional codes for class-specific descriptors. The convention is |
| 196 | * defined in the USB "Common Class" Spec (3.11). Individual class specs | 198 | * defined in the USB "Common Class" Spec (3.11). Individual class specs |
| @@ -535,6 +537,20 @@ static inline int usb_endpoint_is_isoc_out( | |||
| 535 | 537 | ||
| 536 | /*-------------------------------------------------------------------------*/ | 538 | /*-------------------------------------------------------------------------*/ |
| 537 | 539 | ||
| 540 | /* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */ | ||
| 541 | struct usb_ss_ep_comp_descriptor { | ||
| 542 | __u8 bLength; | ||
| 543 | __u8 bDescriptorType; | ||
| 544 | |||
| 545 | __u8 bMaxBurst; | ||
| 546 | __u8 bmAttributes; | ||
| 547 | __u16 wBytesPerInterval; | ||
| 548 | } __attribute__ ((packed)); | ||
| 549 | |||
| 550 | #define USB_DT_SS_EP_COMP_SIZE 6 | ||
| 551 | |||
| 552 | /*-------------------------------------------------------------------------*/ | ||
| 553 | |||
| 538 | /* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */ | 554 | /* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */ |
| 539 | struct usb_qualifier_descriptor { | 555 | struct usb_qualifier_descriptor { |
| 540 | __u8 bLength; | 556 | __u8 bLength; |
| @@ -752,6 +768,7 @@ enum usb_device_speed { | |||
| 752 | USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ | 768 | USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ |
| 753 | USB_SPEED_HIGH, /* usb 2.0 */ | 769 | USB_SPEED_HIGH, /* usb 2.0 */ |
| 754 | USB_SPEED_VARIABLE, /* wireless (usb 2.5) */ | 770 | USB_SPEED_VARIABLE, /* wireless (usb 2.5) */ |
| 771 | USB_SPEED_SUPER, /* usb 3.0 */ | ||
| 755 | }; | 772 | }; |
| 756 | 773 | ||
| 757 | enum usb_device_state { | 774 | enum usb_device_state { |
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index acd7b0f06c8a..4f6bb3d2160e 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
| @@ -124,6 +124,7 @@ struct usb_function { | |||
| 124 | void (*suspend)(struct usb_function *); | 124 | void (*suspend)(struct usb_function *); |
| 125 | void (*resume)(struct usb_function *); | 125 | void (*resume)(struct usb_function *); |
| 126 | 126 | ||
| 127 | /* private: */ | ||
| 127 | /* internals */ | 128 | /* internals */ |
| 128 | struct list_head list; | 129 | struct list_head list; |
| 129 | }; | 130 | }; |
| @@ -219,6 +220,7 @@ struct usb_configuration { | |||
| 219 | 220 | ||
| 220 | struct usb_composite_dev *cdev; | 221 | struct usb_composite_dev *cdev; |
| 221 | 222 | ||
| 223 | /* private: */ | ||
| 222 | /* internals */ | 224 | /* internals */ |
| 223 | struct list_head list; | 225 | struct list_head list; |
| 224 | struct list_head functions; | 226 | struct list_head functions; |
| @@ -321,6 +323,7 @@ struct usb_composite_dev { | |||
| 321 | 323 | ||
| 322 | struct usb_configuration *config; | 324 | struct usb_configuration *config; |
| 323 | 325 | ||
| 326 | /* private: */ | ||
| 324 | /* internals */ | 327 | /* internals */ |
| 325 | struct usb_device_descriptor desc; | 328 | struct usb_device_descriptor desc; |
| 326 | struct list_head configs; | 329 | struct list_head configs; |
diff --git a/include/linux/usb/langwell_otg.h b/include/linux/usb/langwell_otg.h new file mode 100644 index 000000000000..e115ae6df1da --- /dev/null +++ b/include/linux/usb/langwell_otg.h | |||
| @@ -0,0 +1,177 @@ | |||
| 1 | /* | ||
| 2 | * Intel Langwell USB OTG transceiver driver | ||
| 3 | * Copyright (C) 2008, Intel Corporation. | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms and conditions of the GNU General Public License, | ||
| 7 | * version 2, as published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 12 | * more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License along with | ||
| 15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
| 16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 17 | * | ||
| 18 | */ | ||
| 19 | |||
| 20 | #ifndef __LANGWELL_OTG_H__ | ||
| 21 | #define __LANGWELL_OTG_H__ | ||
| 22 | |||
| 23 | /* notify transceiver driver about OTG events */ | ||
| 24 | extern void langwell_update_transceiver(void); | ||
| 25 | /* HCD register bus driver */ | ||
| 26 | extern int langwell_register_host(struct pci_driver *host_driver); | ||
| 27 | /* HCD unregister bus driver */ | ||
| 28 | extern void langwell_unregister_host(struct pci_driver *host_driver); | ||
| 29 | /* DCD register bus driver */ | ||
| 30 | extern int langwell_register_peripheral(struct pci_driver *client_driver); | ||
| 31 | /* DCD unregister bus driver */ | ||
| 32 | extern void langwell_unregister_peripheral(struct pci_driver *client_driver); | ||
| 33 | /* No silent failure, output warning message */ | ||
| 34 | extern void langwell_otg_nsf_msg(unsigned long message); | ||
| 35 | |||
| 36 | #define CI_USBCMD 0x30 | ||
| 37 | # define USBCMD_RST BIT(1) | ||
| 38 | # define USBCMD_RS BIT(0) | ||
| 39 | #define CI_USBSTS 0x34 | ||
| 40 | # define USBSTS_SLI BIT(8) | ||
| 41 | # define USBSTS_URI BIT(6) | ||
| 42 | # define USBSTS_PCI BIT(2) | ||
| 43 | #define CI_PORTSC1 0x74 | ||
| 44 | # define PORTSC_PP BIT(12) | ||
| 45 | # define PORTSC_LS (BIT(11) | BIT(10)) | ||
| 46 | # define PORTSC_SUSP BIT(7) | ||
| 47 | # define PORTSC_CCS BIT(0) | ||
| 48 | #define CI_HOSTPC1 0xb4 | ||
| 49 | # define HOSTPC1_PHCD BIT(22) | ||
| 50 | #define CI_OTGSC 0xf4 | ||
| 51 | # define OTGSC_DPIE BIT(30) | ||
| 52 | # define OTGSC_1MSE BIT(29) | ||
| 53 | # define OTGSC_BSEIE BIT(28) | ||
| 54 | # define OTGSC_BSVIE BIT(27) | ||
| 55 | # define OTGSC_ASVIE BIT(26) | ||
| 56 | # define OTGSC_AVVIE BIT(25) | ||
| 57 | # define OTGSC_IDIE BIT(24) | ||
| 58 | # define OTGSC_DPIS BIT(22) | ||
| 59 | # define OTGSC_1MSS BIT(21) | ||
| 60 | # define OTGSC_BSEIS BIT(20) | ||
| 61 | # define OTGSC_BSVIS BIT(19) | ||
| 62 | # define OTGSC_ASVIS BIT(18) | ||
| 63 | # define OTGSC_AVVIS BIT(17) | ||
| 64 | # define OTGSC_IDIS BIT(16) | ||
| 65 | # define OTGSC_DPS BIT(14) | ||
| 66 | # define OTGSC_1MST BIT(13) | ||
| 67 | # define OTGSC_BSE BIT(12) | ||
| 68 | # define OTGSC_BSV BIT(11) | ||
| 69 | # define OTGSC_ASV BIT(10) | ||
| 70 | # define OTGSC_AVV BIT(9) | ||
| 71 | # define OTGSC_ID BIT(8) | ||
| 72 | # define OTGSC_HABA BIT(7) | ||
| 73 | # define OTGSC_HADP BIT(6) | ||
| 74 | # define OTGSC_IDPU BIT(5) | ||
| 75 | # define OTGSC_DP BIT(4) | ||
| 76 | # define OTGSC_OT BIT(3) | ||
| 77 | # define OTGSC_HAAR BIT(2) | ||
| 78 | # define OTGSC_VC BIT(1) | ||
| 79 | # define OTGSC_VD BIT(0) | ||
| 80 | # define OTGSC_INTEN_MASK (0x7f << 24) | ||
| 81 | # define OTGSC_INTSTS_MASK (0x7f << 16) | ||
| 82 | #define CI_USBMODE 0xf8 | ||
| 83 | # define USBMODE_CM (BIT(1) | BIT(0)) | ||
| 84 | # define USBMODE_IDLE 0 | ||
| 85 | # define USBMODE_DEVICE 0x2 | ||
| 86 | # define USBMODE_HOST 0x3 | ||
| 87 | |||
| 88 | #define INTR_DUMMY_MASK (USBSTS_SLI | USBSTS_URI | USBSTS_PCI) | ||
| 89 | |||
| 90 | struct otg_hsm { | ||
| 91 | /* Input */ | ||
| 92 | int a_bus_resume; | ||
| 93 | int a_bus_suspend; | ||
| 94 | int a_conn; | ||
| 95 | int a_sess_vld; | ||
| 96 | int a_srp_det; | ||
| 97 | int a_vbus_vld; | ||
| 98 | int b_bus_resume; | ||
| 99 | int b_bus_suspend; | ||
| 100 | int b_conn; | ||
| 101 | int b_se0_srp; | ||
| 102 | int b_sess_end; | ||
| 103 | int b_sess_vld; | ||
| 104 | int id; | ||
| 105 | |||
| 106 | /* Internal variables */ | ||
| 107 | int a_set_b_hnp_en; | ||
| 108 | int b_srp_done; | ||
| 109 | int b_hnp_enable; | ||
| 110 | |||
| 111 | /* Timeout indicator for timers */ | ||
| 112 | int a_wait_vrise_tmout; | ||
| 113 | int a_wait_bcon_tmout; | ||
| 114 | int a_aidl_bdis_tmout; | ||
| 115 | int b_ase0_brst_tmout; | ||
| 116 | int b_bus_suspend_tmout; | ||
| 117 | int b_srp_res_tmout; | ||
| 118 | |||
| 119 | /* Informative variables */ | ||
| 120 | int a_bus_drop; | ||
| 121 | int a_bus_req; | ||
| 122 | int a_clr_err; | ||
| 123 | int a_suspend_req; | ||
| 124 | int b_bus_req; | ||
| 125 | |||
| 126 | /* Output */ | ||
| 127 | int drv_vbus; | ||
| 128 | int loc_conn; | ||
| 129 | int loc_sof; | ||
| 130 | |||
| 131 | /* Others */ | ||
| 132 | int b_bus_suspend_vld; | ||
| 133 | }; | ||
| 134 | |||
| 135 | #define TA_WAIT_VRISE 100 | ||
| 136 | #define TA_WAIT_BCON 30000 | ||
| 137 | #define TA_AIDL_BDIS 15000 | ||
| 138 | #define TB_ASE0_BRST 5000 | ||
| 139 | #define TB_SE0_SRP 2 | ||
| 140 | #define TB_SRP_RES 100 | ||
| 141 | #define TB_BUS_SUSPEND 500 | ||
| 142 | |||
| 143 | struct langwell_otg_timer { | ||
| 144 | unsigned long expires; /* Number of count increase to timeout */ | ||
| 145 | unsigned long count; /* Tick counter */ | ||
| 146 | void (*function)(unsigned long); /* Timeout function */ | ||
| 147 | unsigned long data; /* Data passed to function */ | ||
| 148 | struct list_head list; | ||
| 149 | }; | ||
| 150 | |||
| 151 | struct langwell_otg { | ||
| 152 | struct otg_transceiver otg; | ||
| 153 | struct otg_hsm hsm; | ||
| 154 | void __iomem *regs; | ||
| 155 | unsigned region; | ||
| 156 | struct pci_driver *host_ops; | ||
| 157 | struct pci_driver *client_ops; | ||
| 158 | struct pci_dev *pdev; | ||
| 159 | struct work_struct work; | ||
| 160 | struct workqueue_struct *qwork; | ||
| 161 | spinlock_t lock; | ||
| 162 | spinlock_t wq_lock; | ||
| 163 | }; | ||
| 164 | |||
| 165 | static inline struct langwell_otg *otg_to_langwell(struct otg_transceiver *otg) | ||
| 166 | { | ||
| 167 | return container_of(otg, struct langwell_otg, otg); | ||
| 168 | } | ||
| 169 | |||
| 170 | #ifdef DEBUG | ||
| 171 | #define otg_dbg(fmt, args...) \ | ||
| 172 | printk(KERN_DEBUG fmt , ## args) | ||
| 173 | #else | ||
| 174 | #define otg_dbg(fmt, args...) \ | ||
| 175 | do { } while (0) | ||
| 176 | #endif /* DEBUG */ | ||
| 177 | #endif /* __LANGWELL_OTG_H__ */ | ||
diff --git a/include/linux/usb/langwell_udc.h b/include/linux/usb/langwell_udc.h new file mode 100644 index 000000000000..c949178a6530 --- /dev/null +++ b/include/linux/usb/langwell_udc.h | |||
| @@ -0,0 +1,310 @@ | |||
| 1 | /* | ||
| 2 | * Intel Langwell USB Device Controller driver | ||
| 3 | * Copyright (C) 2008-2009, Intel Corporation. | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms and conditions of the GNU General Public License, | ||
| 7 | * version 2, as published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 12 | * more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License along with | ||
| 15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
| 16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 17 | * | ||
| 18 | */ | ||
| 19 | |||
| 20 | #ifndef __LANGWELL_UDC_H | ||
| 21 | #define __LANGWELL_UDC_H | ||
| 22 | |||
| 23 | |||
| 24 | /* MACRO defines */ | ||
| 25 | #define CAP_REG_OFFSET 0x0 | ||
| 26 | #define OP_REG_OFFSET 0x28 | ||
| 27 | |||
| 28 | #define DMA_ADDR_INVALID (~(dma_addr_t)0) | ||
| 29 | |||
| 30 | #define DQH_ALIGNMENT 2048 | ||
| 31 | #define DTD_ALIGNMENT 64 | ||
| 32 | #define DMA_BOUNDARY 4096 | ||
| 33 | |||
| 34 | #define EP0_MAX_PKT_SIZE 64 | ||
| 35 | #define EP_DIR_IN 1 | ||
| 36 | #define EP_DIR_OUT 0 | ||
| 37 | |||
| 38 | #define FLUSH_TIMEOUT 1000 | ||
| 39 | #define RESET_TIMEOUT 1000 | ||
| 40 | #define SETUPSTAT_TIMEOUT 100 | ||
| 41 | #define PRIME_TIMEOUT 100 | ||
| 42 | |||
| 43 | |||
| 44 | /* device memory space registers */ | ||
| 45 | |||
| 46 | /* Capability Registers, BAR0 + CAP_REG_OFFSET */ | ||
| 47 | struct langwell_cap_regs { | ||
| 48 | /* offset: 0x0 */ | ||
| 49 | u8 caplength; /* offset of Operational Register */ | ||
| 50 | u8 _reserved3; | ||
| 51 | u16 hciversion; /* H: BCD encoding of host version */ | ||
| 52 | u32 hcsparams; /* H: host port steering logic capability */ | ||
| 53 | u32 hccparams; /* H: host multiple mode control capability */ | ||
| 54 | #define HCC_LEN BIT(17) /* Link power management (LPM) capability */ | ||
| 55 | u8 _reserved4[0x20-0xc]; | ||
| 56 | /* offset: 0x20 */ | ||
| 57 | u16 dciversion; /* BCD encoding of device version */ | ||
| 58 | u8 _reserved5[0x24-0x22]; | ||
| 59 | u32 dccparams; /* overall device controller capability */ | ||
| 60 | #define HOSTCAP BIT(8) /* host capable */ | ||
| 61 | #define DEVCAP BIT(7) /* device capable */ | ||
| 62 | #define DEN(d) \ | ||
| 63 | (((d)>>0)&0x1f) /* bits 4:0, device endpoint number */ | ||
| 64 | } __attribute__ ((packed)); | ||
| 65 | |||
| 66 | |||
| 67 | /* Operational Registers, BAR0 + OP_REG_OFFSET */ | ||
| 68 | struct langwell_op_regs { | ||
| 69 | /* offset: 0x28 */ | ||
| 70 | u32 extsts; | ||
| 71 | #define EXTS_TI1 BIT(4) /* general purpose timer interrupt 1 */ | ||
| 72 | #define EXTS_TI1TI0 BIT(3) /* general purpose timer interrupt 0 */ | ||
| 73 | #define EXTS_TI1UPI BIT(2) /* USB host periodic interrupt */ | ||
| 74 | #define EXTS_TI1UAI BIT(1) /* USB host asynchronous interrupt */ | ||
| 75 | #define EXTS_TI1NAKI BIT(0) /* NAK interrupt */ | ||
| 76 | u32 extintr; | ||
| 77 | #define EXTI_TIE1 BIT(4) /* general purpose timer interrupt enable 1 */ | ||
| 78 | #define EXTI_TIE0 BIT(3) /* general purpose timer interrupt enable 0 */ | ||
| 79 | #define EXTI_UPIE BIT(2) /* USB host periodic interrupt enable */ | ||
| 80 | #define EXTI_UAIE BIT(1) /* USB host asynchronous interrupt enable */ | ||
| 81 | #define EXTI_NAKE BIT(0) /* NAK interrupt enable */ | ||
| 82 | /* offset: 0x30 */ | ||
| 83 | u32 usbcmd; | ||
| 84 | #define CMD_HIRD(u) \ | ||
| 85 | (((u)>>24)&0xf) /* bits 27:24, host init resume duration */ | ||
| 86 | #define CMD_ITC(u) \ | ||
| 87 | (((u)>>16)&0xff) /* bits 23:16, interrupt threshold control */ | ||
| 88 | #define CMD_PPE BIT(15) /* per-port change events enable */ | ||
| 89 | #define CMD_ATDTW BIT(14) /* add dTD tripwire */ | ||
| 90 | #define CMD_SUTW BIT(13) /* setup tripwire */ | ||
| 91 | #define CMD_ASPE BIT(11) /* asynchronous schedule park mode enable */ | ||
| 92 | #define CMD_FS2 BIT(10) /* frame list size */ | ||
| 93 | #define CMD_ASP1 BIT(9) /* asynchronous schedule park mode count */ | ||
| 94 | #define CMD_ASP0 BIT(8) | ||
| 95 | #define CMD_LR BIT(7) /* light host/device controller reset */ | ||
| 96 | #define CMD_IAA BIT(6) /* interrupt on async advance doorbell */ | ||
| 97 | #define CMD_ASE BIT(5) /* asynchronous schedule enable */ | ||
| 98 | #define CMD_PSE BIT(4) /* periodic schedule enable */ | ||
| 99 | #define CMD_FS1 BIT(3) | ||
| 100 | #define CMD_FS0 BIT(2) | ||
| 101 | #define CMD_RST BIT(1) /* controller reset */ | ||
| 102 | #define CMD_RUNSTOP BIT(0) /* run/stop */ | ||
| 103 | u32 usbsts; | ||
| 104 | #define STS_PPCI(u) \ | ||
| 105 | (((u)>>16)&0xffff) /* bits 31:16, port-n change detect */ | ||
| 106 | #define STS_AS BIT(15) /* asynchronous schedule status */ | ||
| 107 | #define STS_PS BIT(14) /* periodic schedule status */ | ||
| 108 | #define STS_RCL BIT(13) /* reclamation */ | ||
| 109 | #define STS_HCH BIT(12) /* HC halted */ | ||
| 110 | #define STS_ULPII BIT(10) /* ULPI interrupt */ | ||
| 111 | #define STS_SLI BIT(8) /* DC suspend */ | ||
| 112 | #define STS_SRI BIT(7) /* SOF received */ | ||
| 113 | #define STS_URI BIT(6) /* USB reset received */ | ||
| 114 | #define STS_AAI BIT(5) /* interrupt on async advance */ | ||
| 115 | #define STS_SEI BIT(4) /* system error */ | ||
| 116 | #define STS_FRI BIT(3) /* frame list rollover */ | ||
| 117 | #define STS_PCI BIT(2) /* port change detect */ | ||
| 118 | #define STS_UEI BIT(1) /* USB error interrupt */ | ||
| 119 | #define STS_UI BIT(0) /* USB interrupt */ | ||
| 120 | u32 usbintr; | ||
| 121 | /* bits 31:16, per-port interrupt enable */ | ||
| 122 | #define INTR_PPCE(u) (((u)>>16)&0xffff) | ||
| 123 | #define INTR_ULPIE BIT(10) /* ULPI enable */ | ||
| 124 | #define INTR_SLE BIT(8) /* DC sleep/suspend enable */ | ||
| 125 | #define INTR_SRE BIT(7) /* SOF received enable */ | ||
| 126 | #define INTR_URE BIT(6) /* USB reset enable */ | ||
| 127 | #define INTR_AAE BIT(5) /* interrupt on async advance enable */ | ||
| 128 | #define INTR_SEE BIT(4) /* system error enable */ | ||
| 129 | #define INTR_FRE BIT(3) /* frame list rollover enable */ | ||
| 130 | #define INTR_PCE BIT(2) /* port change detect enable */ | ||
| 131 | #define INTR_UEE BIT(1) /* USB error interrupt enable */ | ||
| 132 | #define INTR_UE BIT(0) /* USB interrupt enable */ | ||
| 133 | u32 frindex; /* frame index */ | ||
| 134 | #define FRINDEX_MASK (0x3fff << 0) | ||
| 135 | u32 ctrldssegment; /* not used */ | ||
| 136 | u32 deviceaddr; | ||
| 137 | #define USBADR_SHIFT 25 | ||
| 138 | #define USBADR(d) \ | ||
| 139 | (((d)>>25)&0x7f) /* bits 31:25, device address */ | ||
| 140 | #define USBADR_MASK (0x7f << 25) | ||
| 141 | #define USBADRA BIT(24) /* device address advance */ | ||
| 142 | u32 endpointlistaddr;/* endpoint list top memory address */ | ||
| 143 | /* bits 31:11, endpoint list pointer */ | ||
| 144 | #define EPBASE(d) (((d)>>11)&0x1fffff) | ||
| 145 | #define ENDPOINTLISTADDR_MASK (0x1fffff << 11) | ||
| 146 | u32 ttctrl; /* H: TT operatin, not used */ | ||
| 147 | /* offset: 0x50 */ | ||
| 148 | u32 burstsize; /* burst size of data movement */ | ||
| 149 | #define TXPBURST(b) \ | ||
| 150 | (((b)>>8)&0xff) /* bits 15:8, TX burst length */ | ||
| 151 | #define RXPBURST(b) \ | ||
| 152 | (((b)>>0)&0xff) /* bits 7:0, RX burst length */ | ||
| 153 | u32 txfilltuning; /* TX tuning */ | ||
| 154 | u32 txttfilltuning; /* H: TX TT tuning */ | ||
| 155 | u32 ic_usb; /* control the IC_USB FS/LS transceiver */ | ||
| 156 | /* offset: 0x60 */ | ||
| 157 | u32 ulpi_viewport; /* indirect access to ULPI PHY */ | ||
| 158 | #define ULPIWU BIT(31) /* ULPI wakeup */ | ||
| 159 | #define ULPIRUN BIT(30) /* ULPI read/write run */ | ||
| 160 | #define ULPIRW BIT(29) /* ULPI read/write control */ | ||
| 161 | #define ULPISS BIT(27) /* ULPI sync state */ | ||
| 162 | #define ULPIPORT(u) \ | ||
| 163 | (((u)>>24)&7) /* bits 26:24, ULPI port number */ | ||
| 164 | #define ULPIADDR(u) \ | ||
| 165 | (((u)>>16)&0xff) /* bits 23:16, ULPI data address */ | ||
| 166 | #define ULPIDATRD(u) \ | ||
| 167 | (((u)>>8)&0xff) /* bits 15:8, ULPI data read */ | ||
| 168 | #define ULPIDATWR(u) \ | ||
| 169 | (((u)>>0)&0xff) /* bits 7:0, ULPI date write */ | ||
| 170 | u8 _reserved6[0x70-0x64]; | ||
| 171 | /* offset: 0x70 */ | ||
| 172 | u32 configflag; /* H: not used */ | ||
| 173 | u32 portsc1; /* port status */ | ||
| 174 | #define DA(p) \ | ||
| 175 | (((p)>>25)&0x7f) /* bits 31:25, device address */ | ||
| 176 | #define PORTS_SSTS (BIT(24) | BIT(23)) /* suspend status */ | ||
| 177 | #define PORTS_WKOC BIT(22) /* wake on over-current enable */ | ||
| 178 | #define PORTS_WKDS BIT(21) /* wake on disconnect enable */ | ||
| 179 | #define PORTS_WKCN BIT(20) /* wake on connect enable */ | ||
| 180 | #define PORTS_PTC(p) (((p)>>16)&0xf) /* bits 19:16, port test control */ | ||
| 181 | #define PORTS_PIC (BIT(15) | BIT(14)) /* port indicator control */ | ||
| 182 | #define PORTS_PO BIT(13) /* port owner */ | ||
| 183 | #define PORTS_PP BIT(12) /* port power */ | ||
| 184 | #define PORTS_LS (BIT(11) | BIT(10)) /* line status */ | ||
| 185 | #define PORTS_SLP BIT(9) /* suspend using L1 */ | ||
| 186 | #define PORTS_PR BIT(8) /* port reset */ | ||
| 187 | #define PORTS_SUSP BIT(7) /* suspend */ | ||
| 188 | #define PORTS_FPR BIT(6) /* force port resume */ | ||
| 189 | #define PORTS_OCC BIT(5) /* over-current change */ | ||
| 190 | #define PORTS_OCA BIT(4) /* over-current active */ | ||
| 191 | #define PORTS_PEC BIT(3) /* port enable/disable change */ | ||
| 192 | #define PORTS_PE BIT(2) /* port enable/disable */ | ||
| 193 | #define PORTS_CSC BIT(1) /* connect status change */ | ||
| 194 | #define PORTS_CCS BIT(0) /* current connect status */ | ||
| 195 | u8 _reserved7[0xb4-0x78]; | ||
| 196 | /* offset: 0xb4 */ | ||
| 197 | u32 devlc; /* control LPM and each USB port behavior */ | ||
| 198 | /* bits 31:29, parallel transceiver select */ | ||
| 199 | #define LPM_PTS(d) (((d)>>29)&7) | ||
| 200 | #define LPM_STS BIT(28) /* serial transceiver select */ | ||
| 201 | #define LPM_PTW BIT(27) /* parallel transceiver width */ | ||
| 202 | #define LPM_PSPD(d) (((d)>>25)&3) /* bits 26:25, port speed */ | ||
| 203 | #define LPM_PSPD_MASK (BIT(26) | BIT(25)) | ||
| 204 | #define LPM_SPEED_FULL 0 | ||
| 205 | #define LPM_SPEED_LOW 1 | ||
| 206 | #define LPM_SPEED_HIGH 2 | ||
| 207 | #define LPM_SRT BIT(24) /* shorten reset time */ | ||
| 208 | #define LPM_PFSC BIT(23) /* port force full speed connect */ | ||
| 209 | #define LPM_PHCD BIT(22) /* PHY low power suspend clock disable */ | ||
| 210 | #define LPM_STL BIT(16) /* STALL reply to LPM token */ | ||
| 211 | #define LPM_BA(d) \ | ||
| 212 | (((d)>>1)&0x7ff) /* bits 11:1, BmAttributes */ | ||
| 213 | #define LPM_NYT_ACK BIT(0) /* NYET/ACK reply to LPM token */ | ||
| 214 | u8 _reserved8[0xf4-0xb8]; | ||
| 215 | /* offset: 0xf4 */ | ||
| 216 | u32 otgsc; /* On-The-Go status and control */ | ||
| 217 | #define OTGSC_DPIE BIT(30) /* data pulse interrupt enable */ | ||
| 218 | #define OTGSC_MSE BIT(29) /* 1 ms timer interrupt enable */ | ||
| 219 | #define OTGSC_BSEIE BIT(28) /* B session end interrupt enable */ | ||
| 220 | #define OTGSC_BSVIE BIT(27) /* B session valid interrupt enable */ | ||
| 221 | #define OTGSC_ASVIE BIT(26) /* A session valid interrupt enable */ | ||
| 222 | #define OTGSC_AVVIE BIT(25) /* A VBUS valid interrupt enable */ | ||
| 223 | #define OTGSC_IDIE BIT(24) /* USB ID interrupt enable */ | ||
| 224 | #define OTGSC_DPIS BIT(22) /* data pulse interrupt status */ | ||
| 225 | #define OTGSC_MSS BIT(21) /* 1 ms timer interrupt status */ | ||
| 226 | #define OTGSC_BSEIS BIT(20) /* B session end interrupt status */ | ||
| 227 | #define OTGSC_BSVIS BIT(19) /* B session valid interrupt status */ | ||
| 228 | #define OTGSC_ASVIS BIT(18) /* A session valid interrupt status */ | ||
| 229 | #define OTGSC_AVVIS BIT(17) /* A VBUS valid interrupt status */ | ||
| 230 | #define OTGSC_IDIS BIT(16) /* USB ID interrupt status */ | ||
| 231 | #define OTGSC_DPS BIT(14) /* data bus pulsing status */ | ||
| 232 | #define OTGSC_MST BIT(13) /* 1 ms timer toggle */ | ||
| 233 | #define OTGSC_BSE BIT(12) /* B session end */ | ||
| 234 | #define OTGSC_BSV BIT(11) /* B session valid */ | ||
| 235 | #define OTGSC_ASV BIT(10) /* A session valid */ | ||
| 236 | #define OTGSC_AVV BIT(9) /* A VBUS valid */ | ||
| 237 | #define OTGSC_USBID BIT(8) /* USB ID */ | ||
| 238 | #define OTGSC_HABA BIT(7) /* hw assist B-disconnect to A-connect */ | ||
| 239 | #define OTGSC_HADP BIT(6) /* hw assist data pulse */ | ||
| 240 | #define OTGSC_IDPU BIT(5) /* ID pullup */ | ||
| 241 | #define OTGSC_DP BIT(4) /* data pulsing */ | ||
| 242 | #define OTGSC_OT BIT(3) /* OTG termination */ | ||
| 243 | #define OTGSC_HAAR BIT(2) /* hw assist auto reset */ | ||
| 244 | #define OTGSC_VC BIT(1) /* VBUS charge */ | ||
| 245 | #define OTGSC_VD BIT(0) /* VBUS discharge */ | ||
| 246 | u32 usbmode; | ||
| 247 | #define MODE_VBPS BIT(5) /* R/W VBUS power select */ | ||
| 248 | #define MODE_SDIS BIT(4) /* R/W stream disable mode */ | ||
| 249 | #define MODE_SLOM BIT(3) /* R/W setup lockout mode */ | ||
| 250 | #define MODE_ENSE BIT(2) /* endian select */ | ||
| 251 | #define MODE_CM(u) (((u)>>0)&3) /* bits 1:0, controller mode */ | ||
| 252 | #define MODE_IDLE 0 | ||
| 253 | #define MODE_DEVICE 2 | ||
| 254 | #define MODE_HOST 3 | ||
| 255 | u8 _reserved9[0x100-0xfc]; | ||
| 256 | /* offset: 0x100 */ | ||
| 257 | u32 endptnak; | ||
| 258 | #define EPTN(e) \ | ||
| 259 | (((e)>>16)&0xffff) /* bits 31:16, TX endpoint NAK */ | ||
| 260 | #define EPRN(e) \ | ||
| 261 | (((e)>>0)&0xffff) /* bits 15:0, RX endpoint NAK */ | ||
| 262 | u32 endptnaken; | ||
| 263 | #define EPTNE(e) \ | ||
| 264 | (((e)>>16)&0xffff) /* bits 31:16, TX endpoint NAK enable */ | ||
| 265 | #define EPRNE(e) \ | ||
| 266 | (((e)>>0)&0xffff) /* bits 15:0, RX endpoint NAK enable */ | ||
| 267 | u32 endptsetupstat; | ||
| 268 | #define SETUPSTAT_MASK (0xffff << 0) /* bits 15:0 */ | ||
| 269 | #define EP0SETUPSTAT_MASK 1 | ||
| 270 | u32 endptprime; | ||
| 271 | /* bits 31:16, prime endpoint transmit buffer */ | ||
| 272 | #define PETB(e) (((e)>>16)&0xffff) | ||
| 273 | /* bits 15:0, prime endpoint receive buffer */ | ||
| 274 | #define PERB(e) (((e)>>0)&0xffff) | ||
| 275 | /* offset: 0x110 */ | ||
| 276 | u32 endptflush; | ||
| 277 | /* bits 31:16, flush endpoint transmit buffer */ | ||
| 278 | #define FETB(e) (((e)>>16)&0xffff) | ||
| 279 | /* bits 15:0, flush endpoint receive buffer */ | ||
| 280 | #define FERB(e) (((e)>>0)&0xffff) | ||
| 281 | u32 endptstat; | ||
| 282 | /* bits 31:16, endpoint transmit buffer ready */ | ||
| 283 | #define ETBR(e) (((e)>>16)&0xffff) | ||
| 284 | /* bits 15:0, endpoint receive buffer ready */ | ||
| 285 | #define ERBR(e) (((e)>>0)&0xffff) | ||
| 286 | u32 endptcomplete; | ||
| 287 | /* bits 31:16, endpoint transmit complete event */ | ||
| 288 | #define ETCE(e) (((e)>>16)&0xffff) | ||
| 289 | /* bits 15:0, endpoint receive complete event */ | ||
| 290 | #define ERCE(e) (((e)>>0)&0xffff) | ||
| 291 | /* offset: 0x11c */ | ||
| 292 | u32 endptctrl[16]; | ||
| 293 | #define EPCTRL_TXE BIT(23) /* TX endpoint enable */ | ||
| 294 | #define EPCTRL_TXR BIT(22) /* TX data toggle reset */ | ||
| 295 | #define EPCTRL_TXI BIT(21) /* TX data toggle inhibit */ | ||
| 296 | #define EPCTRL_TXT(e) (((e)>>18)&3) /* bits 19:18, TX endpoint type */ | ||
| 297 | #define EPCTRL_TXT_SHIFT 18 | ||
| 298 | #define EPCTRL_TXD BIT(17) /* TX endpoint data source */ | ||
| 299 | #define EPCTRL_TXS BIT(16) /* TX endpoint STALL */ | ||
| 300 | #define EPCTRL_RXE BIT(7) /* RX endpoint enable */ | ||
| 301 | #define EPCTRL_RXR BIT(6) /* RX data toggle reset */ | ||
| 302 | #define EPCTRL_RXI BIT(5) /* RX data toggle inhibit */ | ||
| 303 | #define EPCTRL_RXT(e) (((e)>>2)&3) /* bits 3:2, RX endpoint type */ | ||
| 304 | #define EPCTRL_RXT_SHIFT 2 /* bits 19:18, TX endpoint type */ | ||
| 305 | #define EPCTRL_RXD BIT(1) /* RX endpoint data sink */ | ||
| 306 | #define EPCTRL_RXS BIT(0) /* RX endpoint STALL */ | ||
| 307 | } __attribute__ ((packed)); | ||
| 308 | |||
| 309 | #endif /* __LANGWELL_UDC_H */ | ||
| 310 | |||
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index 1aaa826396a1..2443c0e7a80c 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h | |||
| @@ -80,10 +80,10 @@ struct otg_transceiver { | |||
| 80 | 80 | ||
| 81 | /* for board-specific init logic */ | 81 | /* for board-specific init logic */ |
| 82 | extern int otg_set_transceiver(struct otg_transceiver *); | 82 | extern int otg_set_transceiver(struct otg_transceiver *); |
| 83 | #ifdef CONFIG_NOP_USB_XCEIV | 83 | |
| 84 | /* sometimes transceivers are accessed only through e.g. ULPI */ | ||
| 84 | extern void usb_nop_xceiv_register(void); | 85 | extern void usb_nop_xceiv_register(void); |
| 85 | extern void usb_nop_xceiv_unregister(void); | 86 | extern void usb_nop_xceiv_unregister(void); |
| 86 | #endif | ||
| 87 | 87 | ||
| 88 | 88 | ||
| 89 | /* for usb host and peripheral controller drivers */ | 89 | /* for usb host and peripheral controller drivers */ |
diff --git a/include/linux/usb/r8a66597.h b/include/linux/usb/r8a66597.h new file mode 100644 index 000000000000..e9f0384fa20c --- /dev/null +++ b/include/linux/usb/r8a66597.h | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | /* | ||
| 2 | * R8A66597 driver platform data | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009 Renesas Solutions Corp. | ||
| 5 | * | ||
| 6 | * Author : Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License as published by | ||
| 10 | * the Free Software Foundation; version 2 of the License. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #ifndef __LINUX_USB_R8A66597_H | ||
| 24 | #define __LINUX_USB_R8A66597_H | ||
| 25 | |||
| 26 | #define R8A66597_PLATDATA_XTAL_12MHZ 0x01 | ||
| 27 | #define R8A66597_PLATDATA_XTAL_24MHZ 0x02 | ||
| 28 | #define R8A66597_PLATDATA_XTAL_48MHZ 0x03 | ||
| 29 | |||
| 30 | struct r8a66597_platdata { | ||
| 31 | /* This ops can controll port power instead of DVSTCTR register. */ | ||
| 32 | void (*port_power)(int port, int power); | ||
| 33 | |||
| 34 | /* (external controller only) set R8A66597_PLATDATA_XTAL_nnMHZ */ | ||
| 35 | unsigned xtal:2; | ||
| 36 | |||
| 37 | /* set one = 3.3V, set zero = 1.5V */ | ||
| 38 | unsigned vif:1; | ||
| 39 | |||
| 40 | /* set one = big endian, set zero = little endian */ | ||
| 41 | unsigned endian:1; | ||
| 42 | }; | ||
| 43 | #endif | ||
| 44 | |||
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 8cdfed738fe4..44801d26a37a 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | #include <linux/kref.h> | 16 | #include <linux/kref.h> |
| 17 | #include <linux/mutex.h> | 17 | #include <linux/mutex.h> |
| 18 | #include <linux/sysrq.h> | ||
| 18 | 19 | ||
| 19 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ | 20 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ |
| 20 | #define SERIAL_TTY_MINORS 254 /* loads of devices :) */ | 21 | #define SERIAL_TTY_MINORS 254 /* loads of devices :) */ |
| @@ -26,6 +27,13 @@ | |||
| 26 | /* parity check flag */ | 27 | /* parity check flag */ |
| 27 | #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) | 28 | #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) |
| 28 | 29 | ||
| 30 | enum port_dev_state { | ||
| 31 | PORT_UNREGISTERED, | ||
| 32 | PORT_REGISTERING, | ||
| 33 | PORT_REGISTERED, | ||
| 34 | PORT_UNREGISTERING, | ||
| 35 | }; | ||
| 36 | |||
| 29 | /** | 37 | /** |
| 30 | * usb_serial_port: structure for the specific ports of a device. | 38 | * usb_serial_port: structure for the specific ports of a device. |
| 31 | * @serial: pointer back to the struct usb_serial owner of this port. | 39 | * @serial: pointer back to the struct usb_serial owner of this port. |
| @@ -91,12 +99,17 @@ struct usb_serial_port { | |||
| 91 | int write_urb_busy; | 99 | int write_urb_busy; |
| 92 | __u8 bulk_out_endpointAddress; | 100 | __u8 bulk_out_endpointAddress; |
| 93 | 101 | ||
| 102 | int tx_bytes_flight; | ||
| 103 | int urbs_in_flight; | ||
| 104 | |||
| 94 | wait_queue_head_t write_wait; | 105 | wait_queue_head_t write_wait; |
| 95 | struct work_struct work; | 106 | struct work_struct work; |
| 96 | char throttled; | 107 | char throttled; |
| 97 | char throttle_req; | 108 | char throttle_req; |
| 98 | char console; | 109 | char console; |
| 110 | unsigned long sysrq; /* sysrq timeout */ | ||
| 99 | struct device dev; | 111 | struct device dev; |
| 112 | enum port_dev_state dev_state; | ||
| 100 | }; | 113 | }; |
| 101 | #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) | 114 | #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) |
| 102 | 115 | ||
| @@ -181,8 +194,10 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data) | |||
| 181 | * This will be called when the struct usb_serial structure is fully set | 194 | * This will be called when the struct usb_serial structure is fully set |
| 182 | * set up. Do any local initialization of the device, or any private | 195 | * set up. Do any local initialization of the device, or any private |
| 183 | * memory structure allocation at this point in time. | 196 | * memory structure allocation at this point in time. |
| 184 | * @shutdown: pointer to the driver's shutdown function. This will be | 197 | * @disconnect: pointer to the driver's disconnect function. This will be |
| 185 | * called when the device is removed from the system. | 198 | * called when the device is unplugged or unbound from the driver. |
| 199 | * @release: pointer to the driver's release function. This will be called | ||
| 200 | * when the usb_serial data structure is about to be destroyed. | ||
| 186 | * @usb_driver: pointer to the struct usb_driver that controls this | 201 | * @usb_driver: pointer to the struct usb_driver that controls this |
| 187 | * device. This is necessary to allow dynamic ids to be added to | 202 | * device. This is necessary to allow dynamic ids to be added to |
| 188 | * the driver from sysfs. | 203 | * the driver from sysfs. |
| @@ -207,12 +222,14 @@ struct usb_serial_driver { | |||
| 207 | struct device_driver driver; | 222 | struct device_driver driver; |
| 208 | struct usb_driver *usb_driver; | 223 | struct usb_driver *usb_driver; |
| 209 | struct usb_dynids dynids; | 224 | struct usb_dynids dynids; |
| 225 | int max_in_flight_urbs; | ||
| 210 | 226 | ||
| 211 | int (*probe)(struct usb_serial *serial, const struct usb_device_id *id); | 227 | int (*probe)(struct usb_serial *serial, const struct usb_device_id *id); |
| 212 | int (*attach)(struct usb_serial *serial); | 228 | int (*attach)(struct usb_serial *serial); |
| 213 | int (*calc_num_ports) (struct usb_serial *serial); | 229 | int (*calc_num_ports) (struct usb_serial *serial); |
| 214 | 230 | ||
| 215 | void (*shutdown)(struct usb_serial *serial); | 231 | void (*disconnect)(struct usb_serial *serial); |
| 232 | void (*release)(struct usb_serial *serial); | ||
| 216 | 233 | ||
| 217 | int (*port_probe)(struct usb_serial_port *port); | 234 | int (*port_probe)(struct usb_serial_port *port); |
| 218 | int (*port_remove)(struct usb_serial_port *port); | 235 | int (*port_remove)(struct usb_serial_port *port); |
| @@ -294,9 +311,16 @@ extern void usb_serial_generic_read_bulk_callback(struct urb *urb); | |||
| 294 | extern void usb_serial_generic_write_bulk_callback(struct urb *urb); | 311 | extern void usb_serial_generic_write_bulk_callback(struct urb *urb); |
| 295 | extern void usb_serial_generic_throttle(struct tty_struct *tty); | 312 | extern void usb_serial_generic_throttle(struct tty_struct *tty); |
| 296 | extern void usb_serial_generic_unthrottle(struct tty_struct *tty); | 313 | extern void usb_serial_generic_unthrottle(struct tty_struct *tty); |
| 297 | extern void usb_serial_generic_shutdown(struct usb_serial *serial); | 314 | extern void usb_serial_generic_disconnect(struct usb_serial *serial); |
| 315 | extern void usb_serial_generic_release(struct usb_serial *serial); | ||
| 298 | extern int usb_serial_generic_register(int debug); | 316 | extern int usb_serial_generic_register(int debug); |
| 299 | extern void usb_serial_generic_deregister(void); | 317 | extern void usb_serial_generic_deregister(void); |
| 318 | extern void usb_serial_generic_resubmit_read_urb(struct usb_serial_port *port, | ||
| 319 | gfp_t mem_flags); | ||
| 320 | extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port, | ||
| 321 | unsigned int ch); | ||
| 322 | extern int usb_serial_handle_break(struct usb_serial_port *port); | ||
| 323 | |||
| 300 | 324 | ||
| 301 | extern int usb_serial_bus_register(struct usb_serial_driver *device); | 325 | extern int usb_serial_bus_register(struct usb_serial_driver *device); |
| 302 | extern void usb_serial_bus_deregister(struct usb_serial_driver *device); | 326 | extern void usb_serial_bus_deregister(struct usb_serial_driver *device); |
diff --git a/include/linux/utsname.h b/include/linux/utsname.h index 11232676bfff..3656b300de3a 100644 --- a/include/linux/utsname.h +++ b/include/linux/utsname.h | |||
| @@ -22,12 +22,12 @@ struct old_utsname { | |||
| 22 | }; | 22 | }; |
| 23 | 23 | ||
| 24 | struct new_utsname { | 24 | struct new_utsname { |
| 25 | char sysname[65]; | 25 | char sysname[__NEW_UTS_LEN + 1]; |
| 26 | char nodename[65]; | 26 | char nodename[__NEW_UTS_LEN + 1]; |
| 27 | char release[65]; | 27 | char release[__NEW_UTS_LEN + 1]; |
| 28 | char version[65]; | 28 | char version[__NEW_UTS_LEN + 1]; |
| 29 | char machine[65]; | 29 | char machine[__NEW_UTS_LEN + 1]; |
| 30 | char domainname[65]; | 30 | char domainname[__NEW_UTS_LEN + 1]; |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | #ifdef __KERNEL__ | 33 | #ifdef __KERNEL__ |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index ebb2ea6b4995..f24eceecc5a6 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
| @@ -347,7 +347,8 @@ struct v4l2_pix_format { | |||
| 347 | #define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */ | 347 | #define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */ |
| 348 | #define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */ | 348 | #define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */ |
| 349 | #define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ | 349 | #define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ |
| 350 | #define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */ | 350 | #define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */ |
| 351 | #define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ | ||
| 351 | 352 | ||
| 352 | /* | 353 | /* |
| 353 | * F O R M A T E N U M E R A T I O N | 354 | * F O R M A T E N U M E R A T I O N |
diff --git a/include/linux/vlynq.h b/include/linux/vlynq.h new file mode 100644 index 000000000000..8f6a95882b09 --- /dev/null +++ b/include/linux/vlynq.h | |||
| @@ -0,0 +1,161 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2006, 2007 Eugene Konev <ejka@openwrt.org> | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation; either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program; if not, write to the Free Software | ||
| 16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 17 | */ | ||
| 18 | |||
| 19 | #ifndef __VLYNQ_H__ | ||
| 20 | #define __VLYNQ_H__ | ||
| 21 | |||
| 22 | #include <linux/device.h> | ||
| 23 | #include <linux/module.h> | ||
| 24 | #include <linux/types.h> | ||
| 25 | |||
| 26 | #define VLYNQ_NUM_IRQS 32 | ||
| 27 | |||
| 28 | struct vlynq_mapping { | ||
| 29 | u32 size; | ||
| 30 | u32 offset; | ||
| 31 | }; | ||
| 32 | |||
| 33 | enum vlynq_divisor { | ||
| 34 | vlynq_div_auto = 0, | ||
| 35 | vlynq_ldiv1, | ||
| 36 | vlynq_ldiv2, | ||
| 37 | vlynq_ldiv3, | ||
| 38 | vlynq_ldiv4, | ||
| 39 | vlynq_ldiv5, | ||
| 40 | vlynq_ldiv6, | ||
| 41 | vlynq_ldiv7, | ||
| 42 | vlynq_ldiv8, | ||
| 43 | vlynq_rdiv1, | ||
| 44 | vlynq_rdiv2, | ||
| 45 | vlynq_rdiv3, | ||
| 46 | vlynq_rdiv4, | ||
| 47 | vlynq_rdiv5, | ||
| 48 | vlynq_rdiv6, | ||
| 49 | vlynq_rdiv7, | ||
| 50 | vlynq_rdiv8, | ||
| 51 | vlynq_div_external | ||
| 52 | }; | ||
| 53 | |||
| 54 | struct vlynq_device_id { | ||
| 55 | u32 id; | ||
| 56 | enum vlynq_divisor divisor; | ||
| 57 | unsigned long driver_data; | ||
| 58 | }; | ||
| 59 | |||
| 60 | struct vlynq_regs; | ||
| 61 | struct vlynq_device { | ||
| 62 | u32 id, dev_id; | ||
| 63 | int local_irq; | ||
| 64 | int remote_irq; | ||
| 65 | enum vlynq_divisor divisor; | ||
| 66 | u32 regs_start, regs_end; | ||
| 67 | u32 mem_start, mem_end; | ||
| 68 | u32 irq_start, irq_end; | ||
| 69 | int irq; | ||
| 70 | int enabled; | ||
| 71 | struct vlynq_regs *local; | ||
| 72 | struct vlynq_regs *remote; | ||
| 73 | struct device dev; | ||
| 74 | }; | ||
| 75 | |||
| 76 | struct vlynq_driver { | ||
| 77 | char *name; | ||
| 78 | struct vlynq_device_id *id_table; | ||
| 79 | int (*probe)(struct vlynq_device *dev, struct vlynq_device_id *id); | ||
| 80 | void (*remove)(struct vlynq_device *dev); | ||
| 81 | struct device_driver driver; | ||
| 82 | }; | ||
| 83 | |||
| 84 | struct plat_vlynq_ops { | ||
| 85 | int (*on)(struct vlynq_device *dev); | ||
| 86 | void (*off)(struct vlynq_device *dev); | ||
| 87 | }; | ||
| 88 | |||
| 89 | static inline struct vlynq_driver *to_vlynq_driver(struct device_driver *drv) | ||
| 90 | { | ||
| 91 | return container_of(drv, struct vlynq_driver, driver); | ||
| 92 | } | ||
| 93 | |||
| 94 | static inline struct vlynq_device *to_vlynq_device(struct device *device) | ||
| 95 | { | ||
| 96 | return container_of(device, struct vlynq_device, dev); | ||
| 97 | } | ||
| 98 | |||
| 99 | extern struct bus_type vlynq_bus_type; | ||
| 100 | |||
| 101 | extern int __vlynq_register_driver(struct vlynq_driver *driver, | ||
| 102 | struct module *owner); | ||
| 103 | |||
| 104 | static inline int vlynq_register_driver(struct vlynq_driver *driver) | ||
| 105 | { | ||
| 106 | return __vlynq_register_driver(driver, THIS_MODULE); | ||
| 107 | } | ||
| 108 | |||
| 109 | static inline void *vlynq_get_drvdata(struct vlynq_device *dev) | ||
| 110 | { | ||
| 111 | return dev_get_drvdata(&dev->dev); | ||
| 112 | } | ||
| 113 | |||
| 114 | static inline void vlynq_set_drvdata(struct vlynq_device *dev, void *data) | ||
| 115 | { | ||
| 116 | dev_set_drvdata(&dev->dev, data); | ||
| 117 | } | ||
| 118 | |||
| 119 | static inline u32 vlynq_mem_start(struct vlynq_device *dev) | ||
| 120 | { | ||
| 121 | return dev->mem_start; | ||
| 122 | } | ||
| 123 | |||
| 124 | static inline u32 vlynq_mem_end(struct vlynq_device *dev) | ||
| 125 | { | ||
| 126 | return dev->mem_end; | ||
| 127 | } | ||
| 128 | |||
| 129 | static inline u32 vlynq_mem_len(struct vlynq_device *dev) | ||
| 130 | { | ||
| 131 | return dev->mem_end - dev->mem_start + 1; | ||
| 132 | } | ||
| 133 | |||
| 134 | static inline int vlynq_virq_to_irq(struct vlynq_device *dev, int virq) | ||
| 135 | { | ||
| 136 | int irq = dev->irq_start + virq; | ||
| 137 | if ((irq < dev->irq_start) || (irq > dev->irq_end)) | ||
| 138 | return -EINVAL; | ||
| 139 | |||
| 140 | return irq; | ||
| 141 | } | ||
| 142 | |||
| 143 | static inline int vlynq_irq_to_virq(struct vlynq_device *dev, int irq) | ||
| 144 | { | ||
| 145 | if ((irq < dev->irq_start) || (irq > dev->irq_end)) | ||
| 146 | return -EINVAL; | ||
| 147 | |||
| 148 | return irq - dev->irq_start; | ||
| 149 | } | ||
| 150 | |||
| 151 | extern void vlynq_unregister_driver(struct vlynq_driver *driver); | ||
| 152 | extern int vlynq_enable_device(struct vlynq_device *dev); | ||
| 153 | extern void vlynq_disable_device(struct vlynq_device *dev); | ||
| 154 | extern int vlynq_set_local_mapping(struct vlynq_device *dev, u32 tx_offset, | ||
| 155 | struct vlynq_mapping *mapping); | ||
| 156 | extern int vlynq_set_remote_mapping(struct vlynq_device *dev, u32 tx_offset, | ||
| 157 | struct vlynq_mapping *mapping); | ||
| 158 | extern int vlynq_set_local_irq(struct vlynq_device *dev, int virq); | ||
| 159 | extern int vlynq_set_remote_irq(struct vlynq_device *dev, int virq); | ||
| 160 | |||
| 161 | #endif /* __VLYNQ_H__ */ | ||
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 524cd1b28ecb..81a97cf8f0a0 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h | |||
| @@ -36,12 +36,14 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, | |||
| 36 | FOR_ALL_ZONES(PGSTEAL), | 36 | FOR_ALL_ZONES(PGSTEAL), |
| 37 | FOR_ALL_ZONES(PGSCAN_KSWAPD), | 37 | FOR_ALL_ZONES(PGSCAN_KSWAPD), |
| 38 | FOR_ALL_ZONES(PGSCAN_DIRECT), | 38 | FOR_ALL_ZONES(PGSCAN_DIRECT), |
| 39 | #ifdef CONFIG_NUMA | ||
| 40 | PGSCAN_ZONE_RECLAIM_FAILED, | ||
| 41 | #endif | ||
| 39 | PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL, | 42 | PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL, |
| 40 | PAGEOUTRUN, ALLOCSTALL, PGROTATED, | 43 | PAGEOUTRUN, ALLOCSTALL, PGROTATED, |
| 41 | #ifdef CONFIG_HUGETLB_PAGE | 44 | #ifdef CONFIG_HUGETLB_PAGE |
| 42 | HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL, | 45 | HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL, |
| 43 | #endif | 46 | #endif |
| 44 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
| 45 | UNEVICTABLE_PGCULLED, /* culled to noreclaim list */ | 47 | UNEVICTABLE_PGCULLED, /* culled to noreclaim list */ |
| 46 | UNEVICTABLE_PGSCANNED, /* scanned for reclaimability */ | 48 | UNEVICTABLE_PGSCANNED, /* scanned for reclaimability */ |
| 47 | UNEVICTABLE_PGRESCUED, /* rescued from noreclaim list */ | 49 | UNEVICTABLE_PGRESCUED, /* rescued from noreclaim list */ |
| @@ -50,7 +52,6 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, | |||
| 50 | UNEVICTABLE_PGCLEARED, /* on COW, page truncate */ | 52 | UNEVICTABLE_PGCLEARED, /* on COW, page truncate */ |
| 51 | UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */ | 53 | UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */ |
| 52 | UNEVICTABLE_MLOCKFREED, | 54 | UNEVICTABLE_MLOCKFREED, |
| 53 | #endif | ||
| 54 | NR_VM_EVENT_ITEMS | 55 | NR_VM_EVENT_ITEMS |
| 55 | }; | 56 | }; |
| 56 | 57 | ||
diff --git a/include/media/adv7343.h b/include/media/adv7343.h new file mode 100644 index 000000000000..d6f8a4e1a1fc --- /dev/null +++ b/include/media/adv7343.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | /* | ||
| 2 | * ADV7343 header file | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU General Public License as | ||
| 8 | * published by the Free Software Foundation version 2. | ||
| 9 | * | ||
| 10 | * This program is distributed .as is. WITHOUT ANY WARRANTY of any | ||
| 11 | * kind, whether express or implied; without even the implied warranty | ||
| 12 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #ifndef ADV7343_H | ||
| 17 | #define ADV7343_H | ||
| 18 | |||
| 19 | #define ADV7343_COMPOSITE_ID (0) | ||
| 20 | #define ADV7343_COMPONENT_ID (1) | ||
| 21 | #define ADV7343_SVIDEO_ID (2) | ||
| 22 | |||
| 23 | #endif /* End of #ifndef ADV7343_H */ | ||
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h index 07963d705400..3ad4ed5402fb 100644 --- a/include/media/ir-kbd-i2c.h +++ b/include/media/ir-kbd-i2c.h | |||
| @@ -7,7 +7,7 @@ struct IR_i2c; | |||
| 7 | 7 | ||
| 8 | struct IR_i2c { | 8 | struct IR_i2c { |
| 9 | IR_KEYTAB_TYPE *ir_codes; | 9 | IR_KEYTAB_TYPE *ir_codes; |
| 10 | struct i2c_client c; | 10 | struct i2c_client *c; |
| 11 | struct input_dev *input; | 11 | struct input_dev *input; |
| 12 | struct ir_input_state ir; | 12 | struct ir_input_state ir; |
| 13 | 13 | ||
| @@ -15,7 +15,15 @@ struct IR_i2c { | |||
| 15 | unsigned char old; | 15 | unsigned char old; |
| 16 | 16 | ||
| 17 | struct delayed_work work; | 17 | struct delayed_work work; |
| 18 | char name[32]; | ||
| 18 | char phys[32]; | 19 | char phys[32]; |
| 19 | int (*get_key)(struct IR_i2c*, u32*, u32*); | 20 | int (*get_key)(struct IR_i2c*, u32*, u32*); |
| 20 | }; | 21 | }; |
| 22 | |||
| 23 | /* Can be passed when instantiating an ir_video i2c device */ | ||
| 24 | struct IR_i2c_init_data { | ||
| 25 | IR_KEYTAB_TYPE *ir_codes; | ||
| 26 | const char *name; | ||
| 27 | int (*get_key)(struct IR_i2c*, u32*, u32*); | ||
| 28 | }; | ||
| 21 | #endif | 29 | #endif |
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 37013688af44..23ecead35e7a 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h | |||
| @@ -60,7 +60,7 @@ struct soc_camera_file { | |||
| 60 | 60 | ||
| 61 | struct soc_camera_host { | 61 | struct soc_camera_host { |
| 62 | struct list_head list; | 62 | struct list_head list; |
| 63 | struct device dev; | 63 | struct device *dev; |
| 64 | unsigned char nr; /* Host number */ | 64 | unsigned char nr; /* Host number */ |
| 65 | void *priv; | 65 | void *priv; |
| 66 | const char *drv_name; | 66 | const char *drv_name; |
| @@ -92,11 +92,16 @@ struct soc_camera_host_ops { | |||
| 92 | #define SOCAM_SENSOR_INVERT_VSYNC (1 << 3) | 92 | #define SOCAM_SENSOR_INVERT_VSYNC (1 << 3) |
| 93 | #define SOCAM_SENSOR_INVERT_DATA (1 << 4) | 93 | #define SOCAM_SENSOR_INVERT_DATA (1 << 4) |
| 94 | 94 | ||
| 95 | struct i2c_board_info; | ||
| 96 | |||
| 95 | struct soc_camera_link { | 97 | struct soc_camera_link { |
| 96 | /* Camera bus id, used to match a camera and a bus */ | 98 | /* Camera bus id, used to match a camera and a bus */ |
| 97 | int bus_id; | 99 | int bus_id; |
| 98 | /* Per camera SOCAM_SENSOR_* bus flags */ | 100 | /* Per camera SOCAM_SENSOR_* bus flags */ |
| 99 | unsigned long flags; | 101 | unsigned long flags; |
| 102 | int i2c_adapter_id; | ||
| 103 | struct i2c_board_info *board_info; | ||
| 104 | const char *module_name; | ||
| 100 | /* Optional callbacks to power on or off and reset the sensor */ | 105 | /* Optional callbacks to power on or off and reset the sensor */ |
| 101 | int (*power)(struct device *, int); | 106 | int (*power)(struct device *, int); |
| 102 | int (*reset)(struct device *); | 107 | int (*reset)(struct device *); |
| @@ -107,6 +112,7 @@ struct soc_camera_link { | |||
| 107 | */ | 112 | */ |
| 108 | int (*set_bus_param)(struct soc_camera_link *, unsigned long flags); | 113 | int (*set_bus_param)(struct soc_camera_link *, unsigned long flags); |
| 109 | unsigned long (*query_bus_param)(struct soc_camera_link *); | 114 | unsigned long (*query_bus_param)(struct soc_camera_link *); |
| 115 | void (*free_bus)(struct soc_camera_link *); | ||
| 110 | }; | 116 | }; |
| 111 | 117 | ||
| 112 | static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev) | 118 | static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev) |
| @@ -116,7 +122,7 @@ static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev) | |||
| 116 | 122 | ||
| 117 | static inline struct soc_camera_host *to_soc_camera_host(struct device *dev) | 123 | static inline struct soc_camera_host *to_soc_camera_host(struct device *dev) |
| 118 | { | 124 | { |
| 119 | return container_of(dev, struct soc_camera_host, dev); | 125 | return dev_get_drvdata(dev); |
| 120 | } | 126 | } |
| 121 | 127 | ||
| 122 | extern int soc_camera_host_register(struct soc_camera_host *ici); | 128 | extern int soc_camera_host_register(struct soc_camera_host *ici); |
diff --git a/include/media/tuner.h b/include/media/tuner.h index 7d4e2db78076..cbf97f45fbec 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h | |||
| @@ -124,6 +124,8 @@ | |||
| 124 | #define TUNER_XC5000 76 /* Xceive Silicon Tuner */ | 124 | #define TUNER_XC5000 76 /* Xceive Silicon Tuner */ |
| 125 | #define TUNER_TCL_MF02GIP_5N 77 /* TCL MF02GIP_5N */ | 125 | #define TUNER_TCL_MF02GIP_5N 77 /* TCL MF02GIP_5N */ |
| 126 | #define TUNER_PHILIPS_FMD1216MEX_MK3 78 | 126 | #define TUNER_PHILIPS_FMD1216MEX_MK3 78 |
| 127 | #define TUNER_PHILIPS_FM1216MK5 79 | ||
| 128 | #define TUNER_PHILIPS_FQ1216LME_MK3 80 /* Active loopthrough, no FM */ | ||
| 127 | 129 | ||
| 128 | /* tv card specific */ | 130 | /* tv card specific */ |
| 129 | #define TDA9887_PRESENT (1<<0) | 131 | #define TDA9887_PRESENT (1<<0) |
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h index 1be461a29077..4d7e2272c42f 100644 --- a/include/media/v4l2-chip-ident.h +++ b/include/media/v4l2-chip-ident.h | |||
| @@ -137,6 +137,12 @@ enum { | |||
| 137 | /* module saa7191: just ident 7191 */ | 137 | /* module saa7191: just ident 7191 */ |
| 138 | V4L2_IDENT_SAA7191 = 7191, | 138 | V4L2_IDENT_SAA7191 = 7191, |
| 139 | 139 | ||
| 140 | /* module ths7303: just ident 7303 */ | ||
| 141 | V4L2_IDENT_THS7303 = 7303, | ||
| 142 | |||
| 143 | /* module adv7343: just ident 7343 */ | ||
| 144 | V4L2_IDENT_ADV7343 = 7343, | ||
| 145 | |||
| 140 | /* module wm8739: just ident 8739 */ | 146 | /* module wm8739: just ident 8739 */ |
| 141 | V4L2_IDENT_WM8739 = 8739, | 147 | V4L2_IDENT_WM8739 = 8739, |
| 142 | 148 | ||
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h index 0dd3e8e8653e..5d5d550e63ad 100644 --- a/include/media/v4l2-device.h +++ b/include/media/v4l2-device.h | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | basic V4L2 device-level support. | 30 | basic V4L2 device-level support. |
| 31 | */ | 31 | */ |
| 32 | 32 | ||
| 33 | #define V4L2_DEVICE_NAME_SIZE (BUS_ID_SIZE + 16) | 33 | #define V4L2_DEVICE_NAME_SIZE (20 + 16) |
| 34 | 34 | ||
| 35 | struct v4l2_device { | 35 | struct v4l2_device { |
| 36 | /* dev->driver_data points to this struct. | 36 | /* dev->driver_data points to this struct. |
| @@ -53,10 +53,31 @@ struct v4l2_device { | |||
| 53 | dev may be NULL in rare cases (ISA devices). In that case you | 53 | dev may be NULL in rare cases (ISA devices). In that case you |
| 54 | must fill in the v4l2_dev->name field before calling this function. */ | 54 | must fill in the v4l2_dev->name field before calling this function. */ |
| 55 | int __must_check v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev); | 55 | int __must_check v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev); |
| 56 | |||
| 57 | /* Optional function to initialize the name field of struct v4l2_device using | ||
| 58 | the driver name and a driver-global atomic_t instance. | ||
| 59 | This function will increment the instance counter and returns the instance | ||
| 60 | value used in the name. | ||
| 61 | |||
| 62 | Example: | ||
| 63 | |||
| 64 | static atomic_t drv_instance = ATOMIC_INIT(0); | ||
| 65 | |||
| 66 | ... | ||
| 67 | |||
| 68 | instance = v4l2_device_set_name(&v4l2_dev, "foo", &drv_instance); | ||
| 69 | |||
| 70 | The first time this is called the name field will be set to foo0 and | ||
| 71 | this function returns 0. If the name ends with a digit (e.g. cx18), | ||
| 72 | then the name will be set to cx18-0 since cx180 looks really odd. */ | ||
| 73 | int v4l2_device_set_name(struct v4l2_device *v4l2_dev, const char *basename, | ||
| 74 | atomic_t *instance); | ||
| 75 | |||
| 56 | /* Set v4l2_dev->dev to NULL. Call when the USB parent disconnects. | 76 | /* Set v4l2_dev->dev to NULL. Call when the USB parent disconnects. |
| 57 | Since the parent disappears this ensures that v4l2_dev doesn't have an | 77 | Since the parent disappears this ensures that v4l2_dev doesn't have an |
| 58 | invalid parent pointer. */ | 78 | invalid parent pointer. */ |
| 59 | void v4l2_device_disconnect(struct v4l2_device *v4l2_dev); | 79 | void v4l2_device_disconnect(struct v4l2_device *v4l2_dev); |
| 80 | |||
| 60 | /* Unregister all sub-devices and any other resources related to v4l2_dev. */ | 81 | /* Unregister all sub-devices and any other resources related to v4l2_dev. */ |
| 61 | void v4l2_device_unregister(struct v4l2_device *v4l2_dev); | 82 | void v4l2_device_unregister(struct v4l2_device *v4l2_dev); |
| 62 | 83 | ||
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 17856081c809..a503e1cee78b 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h | |||
| @@ -230,12 +230,16 @@ struct v4l2_subdev_ops { | |||
| 230 | 230 | ||
| 231 | #define V4L2_SUBDEV_NAME_SIZE 32 | 231 | #define V4L2_SUBDEV_NAME_SIZE 32 |
| 232 | 232 | ||
| 233 | /* Set this flag if this subdev is a i2c device. */ | ||
| 234 | #define V4L2_SUBDEV_FL_IS_I2C (1U << 0) | ||
| 235 | |||
| 233 | /* Each instance of a subdev driver should create this struct, either | 236 | /* Each instance of a subdev driver should create this struct, either |
| 234 | stand-alone or embedded in a larger struct. | 237 | stand-alone or embedded in a larger struct. |
| 235 | */ | 238 | */ |
| 236 | struct v4l2_subdev { | 239 | struct v4l2_subdev { |
| 237 | struct list_head list; | 240 | struct list_head list; |
| 238 | struct module *owner; | 241 | struct module *owner; |
| 242 | u32 flags; | ||
| 239 | struct v4l2_device *v4l2_dev; | 243 | struct v4l2_device *v4l2_dev; |
| 240 | const struct v4l2_subdev_ops *ops; | 244 | const struct v4l2_subdev_ops *ops; |
| 241 | /* name must be unique */ | 245 | /* name must be unique */ |
| @@ -264,6 +268,7 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd, | |||
| 264 | BUG_ON(!ops || !ops->core); | 268 | BUG_ON(!ops || !ops->core); |
| 265 | sd->ops = ops; | 269 | sd->ops = ops; |
| 266 | sd->v4l2_dev = NULL; | 270 | sd->v4l2_dev = NULL; |
| 271 | sd->flags = 0; | ||
| 267 | sd->name[0] = '\0'; | 272 | sd->name[0] = '\0'; |
| 268 | sd->grp_id = 0; | 273 | sd->grp_id = 0; |
| 269 | sd->priv = NULL; | 274 | sd->priv = NULL; |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index 20a6957af870..47004f35cc7e 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #define _INET_SOCK_H | 17 | #define _INET_SOCK_H |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | #include <linux/kmemcheck.h> | ||
| 20 | #include <linux/string.h> | 21 | #include <linux/string.h> |
| 21 | #include <linux/types.h> | 22 | #include <linux/types.h> |
| 22 | #include <linux/jhash.h> | 23 | #include <linux/jhash.h> |
| @@ -66,14 +67,16 @@ struct inet_request_sock { | |||
| 66 | __be32 loc_addr; | 67 | __be32 loc_addr; |
| 67 | __be32 rmt_addr; | 68 | __be32 rmt_addr; |
| 68 | __be16 rmt_port; | 69 | __be16 rmt_port; |
| 69 | u16 snd_wscale : 4, | 70 | kmemcheck_bitfield_begin(flags); |
| 70 | rcv_wscale : 4, | 71 | u16 snd_wscale : 4, |
| 72 | rcv_wscale : 4, | ||
| 71 | tstamp_ok : 1, | 73 | tstamp_ok : 1, |
| 72 | sack_ok : 1, | 74 | sack_ok : 1, |
| 73 | wscale_ok : 1, | 75 | wscale_ok : 1, |
| 74 | ecn_ok : 1, | 76 | ecn_ok : 1, |
| 75 | acked : 1, | 77 | acked : 1, |
| 76 | no_srccheck: 1; | 78 | no_srccheck: 1; |
| 79 | kmemcheck_bitfield_end(flags); | ||
| 77 | struct ip_options *opt; | 80 | struct ip_options *opt; |
| 78 | }; | 81 | }; |
| 79 | 82 | ||
| @@ -199,9 +202,12 @@ static inline int inet_sk_ehashfn(const struct sock *sk) | |||
| 199 | static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops) | 202 | static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops) |
| 200 | { | 203 | { |
| 201 | struct request_sock *req = reqsk_alloc(ops); | 204 | struct request_sock *req = reqsk_alloc(ops); |
| 205 | struct inet_request_sock *ireq = inet_rsk(req); | ||
| 202 | 206 | ||
| 203 | if (req != NULL) | 207 | if (req != NULL) { |
| 204 | inet_rsk(req)->opt = NULL; | 208 | kmemcheck_annotate_bitfield(ireq, flags); |
| 209 | ireq->opt = NULL; | ||
| 210 | } | ||
| 205 | 211 | ||
| 206 | return req; | 212 | return req; |
| 207 | } | 213 | } |
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index 4b8ece22b8e9..b63b80fac567 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #define _INET_TIMEWAIT_SOCK_ | 16 | #define _INET_TIMEWAIT_SOCK_ |
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | #include <linux/kmemcheck.h> | ||
| 19 | #include <linux/list.h> | 20 | #include <linux/list.h> |
| 20 | #include <linux/module.h> | 21 | #include <linux/module.h> |
| 21 | #include <linux/timer.h> | 22 | #include <linux/timer.h> |
| @@ -127,10 +128,12 @@ struct inet_timewait_sock { | |||
| 127 | __be32 tw_rcv_saddr; | 128 | __be32 tw_rcv_saddr; |
| 128 | __be16 tw_dport; | 129 | __be16 tw_dport; |
| 129 | __u16 tw_num; | 130 | __u16 tw_num; |
| 131 | kmemcheck_bitfield_begin(flags); | ||
| 130 | /* And these are ours. */ | 132 | /* And these are ours. */ |
| 131 | __u8 tw_ipv6only:1, | 133 | __u8 tw_ipv6only:1, |
| 132 | tw_transparent:1; | 134 | tw_transparent:1; |
| 133 | /* 15 bits hole, try to pack */ | 135 | /* 14 bits hole, try to pack */ |
| 136 | kmemcheck_bitfield_end(flags); | ||
| 134 | __u16 tw_ipv6_offset; | 137 | __u16 tw_ipv6_offset; |
| 135 | unsigned long tw_ttd; | 138 | unsigned long tw_ttd; |
| 136 | struct inet_bind_bucket *tw_tb; | 139 | struct inet_bind_bucket *tw_tb; |
diff --git a/include/net/sock.h b/include/net/sock.h index 010e14a93c92..95bd3fd75f94 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -218,9 +218,11 @@ struct sock { | |||
| 218 | #define sk_hash __sk_common.skc_hash | 218 | #define sk_hash __sk_common.skc_hash |
| 219 | #define sk_prot __sk_common.skc_prot | 219 | #define sk_prot __sk_common.skc_prot |
| 220 | #define sk_net __sk_common.skc_net | 220 | #define sk_net __sk_common.skc_net |
| 221 | kmemcheck_bitfield_begin(flags); | ||
| 221 | unsigned char sk_shutdown : 2, | 222 | unsigned char sk_shutdown : 2, |
| 222 | sk_no_check : 2, | 223 | sk_no_check : 2, |
| 223 | sk_userlocks : 4; | 224 | sk_userlocks : 4; |
| 225 | kmemcheck_bitfield_end(flags); | ||
| 224 | unsigned char sk_protocol; | 226 | unsigned char sk_protocol; |
| 225 | unsigned short sk_type; | 227 | unsigned short sk_type; |
| 226 | int sk_rcvbuf; | 228 | int sk_rcvbuf; |
diff --git a/include/scsi/Kbuild b/include/scsi/Kbuild new file mode 100644 index 000000000000..33b2750e9283 --- /dev/null +++ b/include/scsi/Kbuild | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | header-y += scsi.h | ||
| 2 | header-y += scsi_netlink.h | ||
| 3 | header-y += scsi_netlink_fc.h | ||
| 4 | header-y += scsi_bsg_fc.h | ||
diff --git a/include/scsi/scsi_bsg_fc.h b/include/scsi/scsi_bsg_fc.h new file mode 100644 index 000000000000..a4b233318179 --- /dev/null +++ b/include/scsi/scsi_bsg_fc.h | |||
| @@ -0,0 +1,322 @@ | |||
| 1 | /* | ||
| 2 | * FC Transport BSG Interface | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008 James Smart, Emulex Corporation | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #ifndef SCSI_BSG_FC_H | ||
| 23 | #define SCSI_BSG_FC_H | ||
| 24 | |||
| 25 | /* | ||
| 26 | * This file intended to be included by both kernel and user space | ||
| 27 | */ | ||
| 28 | |||
| 29 | #include <scsi/scsi.h> | ||
| 30 | |||
| 31 | /* | ||
| 32 | * FC Transport SGIO v4 BSG Message Support | ||
| 33 | */ | ||
| 34 | |||
| 35 | /* Default BSG request timeout (in seconds) */ | ||
| 36 | #define FC_DEFAULT_BSG_TIMEOUT (10 * HZ) | ||
| 37 | |||
| 38 | |||
| 39 | /* | ||
| 40 | * Request Message Codes supported by the FC Transport | ||
| 41 | */ | ||
| 42 | |||
| 43 | /* define the class masks for the message codes */ | ||
| 44 | #define FC_BSG_CLS_MASK 0xF0000000 /* find object class */ | ||
| 45 | #define FC_BSG_HST_MASK 0x80000000 /* fc host class */ | ||
| 46 | #define FC_BSG_RPT_MASK 0x40000000 /* fc rport class */ | ||
| 47 | |||
| 48 | /* fc_host Message Codes */ | ||
| 49 | #define FC_BSG_HST_ADD_RPORT (FC_BSG_HST_MASK | 0x00000001) | ||
| 50 | #define FC_BSG_HST_DEL_RPORT (FC_BSG_HST_MASK | 0x00000002) | ||
| 51 | #define FC_BSG_HST_ELS_NOLOGIN (FC_BSG_HST_MASK | 0x00000003) | ||
| 52 | #define FC_BSG_HST_CT (FC_BSG_HST_MASK | 0x00000004) | ||
| 53 | #define FC_BSG_HST_VENDOR (FC_BSG_HST_MASK | 0x000000FF) | ||
| 54 | |||
| 55 | /* fc_rport Message Codes */ | ||
| 56 | #define FC_BSG_RPT_ELS (FC_BSG_RPT_MASK | 0x00000001) | ||
| 57 | #define FC_BSG_RPT_CT (FC_BSG_RPT_MASK | 0x00000002) | ||
| 58 | |||
| 59 | |||
| 60 | |||
| 61 | /* | ||
| 62 | * FC Address Identifiers in Message Structures : | ||
| 63 | * | ||
| 64 | * Whenever a command payload contains a FC Address Identifier | ||
| 65 | * (aka port_id), the value is effectively in big-endian | ||
| 66 | * order, thus the array elements are decoded as follows: | ||
| 67 | * element [0] is bits 23:16 of the FC Address Identifier | ||
| 68 | * element [1] is bits 15:8 of the FC Address Identifier | ||
| 69 | * element [2] is bits 7:0 of the FC Address Identifier | ||
| 70 | */ | ||
| 71 | |||
| 72 | |||
| 73 | /* | ||
| 74 | * FC Host Messages | ||
| 75 | */ | ||
| 76 | |||
| 77 | /* FC_BSG_HST_ADDR_PORT : */ | ||
| 78 | |||
| 79 | /* Request: | ||
| 80 | * This message requests the FC host to login to the remote port | ||
| 81 | * at the specified N_Port_Id. The remote port is to be enumerated | ||
| 82 | * with the transport upon completion of the login. | ||
| 83 | */ | ||
| 84 | struct fc_bsg_host_add_rport { | ||
| 85 | uint8_t reserved; | ||
| 86 | |||
| 87 | /* FC Address Identier of the remote port to login to */ | ||
| 88 | uint8_t port_id[3]; | ||
| 89 | }; | ||
| 90 | |||
| 91 | /* Response: | ||
| 92 | * There is no additional response data - fc_bsg_reply->result is sufficient | ||
| 93 | */ | ||
| 94 | |||
| 95 | |||
| 96 | /* FC_BSG_HST_DEL_RPORT : */ | ||
| 97 | |||
| 98 | /* Request: | ||
| 99 | * This message requests the FC host to remove an enumerated | ||
| 100 | * remote port and to terminate the login to it. | ||
| 101 | * | ||
| 102 | * Note: The driver is free to reject this request if it desires to | ||
| 103 | * remain logged in with the remote port. | ||
| 104 | */ | ||
| 105 | struct fc_bsg_host_del_rport { | ||
| 106 | uint8_t reserved; | ||
| 107 | |||
| 108 | /* FC Address Identier of the remote port to logout of */ | ||
| 109 | uint8_t port_id[3]; | ||
| 110 | }; | ||
| 111 | |||
| 112 | /* Response: | ||
| 113 | * There is no additional response data - fc_bsg_reply->result is sufficient | ||
| 114 | */ | ||
| 115 | |||
| 116 | |||
| 117 | /* FC_BSG_HST_ELS_NOLOGIN : */ | ||
| 118 | |||
| 119 | /* Request: | ||
| 120 | * This message requests the FC_Host to send an ELS to a specific | ||
| 121 | * N_Port_ID. The host does not need to log into the remote port, | ||
| 122 | * nor does it need to enumerate the rport for further traffic | ||
| 123 | * (although, the FC host is free to do so if it desires). | ||
| 124 | */ | ||
| 125 | struct fc_bsg_host_els { | ||
| 126 | /* | ||
| 127 | * ELS Command Code being sent (must be the same as byte 0 | ||
| 128 | * of the payload) | ||
| 129 | */ | ||
| 130 | uint8_t command_code; | ||
| 131 | |||
| 132 | /* FC Address Identier of the remote port to send the ELS to */ | ||
| 133 | uint8_t port_id[3]; | ||
| 134 | }; | ||
| 135 | |||
| 136 | /* Response: | ||
| 137 | */ | ||
| 138 | /* fc_bsg_ctels_reply->status values */ | ||
| 139 | #define FC_CTELS_STATUS_OK 0x00000000 | ||
| 140 | #define FC_CTELS_STATUS_REJECT 0x00000001 | ||
| 141 | #define FC_CTELS_STATUS_P_RJT 0x00000002 | ||
| 142 | #define FC_CTELS_STATUS_F_RJT 0x00000003 | ||
| 143 | #define FC_CTELS_STATUS_P_BSY 0x00000004 | ||
| 144 | #define FC_CTELS_STATUS_F_BSY 0x00000006 | ||
| 145 | struct fc_bsg_ctels_reply { | ||
| 146 | /* | ||
| 147 | * Note: An ELS LS_RJT may be reported in 2 ways: | ||
| 148 | * a) A status of FC_CTELS_STATUS_OK is returned. The caller | ||
| 149 | * is to look into the ELS receive payload to determine | ||
| 150 | * LS_ACC or LS_RJT (by contents of word 0). The reject | ||
| 151 | * data will be in word 1. | ||
| 152 | * b) A status of FC_CTELS_STATUS_REJECT is returned, The | ||
| 153 | * rjt_data field will contain valid data. | ||
| 154 | * | ||
| 155 | * Note: ELS LS_ACC is determined by an FC_CTELS_STATUS_OK, and | ||
| 156 | * the receive payload word 0 indicates LS_ACC | ||
| 157 | * (e.g. value is 0x02xxxxxx). | ||
| 158 | * | ||
| 159 | * Note: Similarly, a CT Reject may be reported in 2 ways: | ||
| 160 | * a) A status of FC_CTELS_STATUS_OK is returned. The caller | ||
| 161 | * is to look into the CT receive payload to determine | ||
| 162 | * Accept or Reject (by contents of word 2). The reject | ||
| 163 | * data will be in word 3. | ||
| 164 | * b) A status of FC_CTELS_STATUS_REJECT is returned, The | ||
| 165 | * rjt_data field will contain valid data. | ||
| 166 | * | ||
| 167 | * Note: x_RJT/BSY status will indicae that the rjt_data field | ||
| 168 | * is valid and contains the reason/explanation values. | ||
| 169 | */ | ||
| 170 | uint32_t status; /* See FC_CTELS_STATUS_xxx */ | ||
| 171 | |||
| 172 | /* valid if status is not FC_CTELS_STATUS_OK */ | ||
| 173 | struct { | ||
| 174 | uint8_t action; /* fragment_id for CT REJECT */ | ||
| 175 | uint8_t reason_code; | ||
| 176 | uint8_t reason_explanation; | ||
| 177 | uint8_t vendor_unique; | ||
| 178 | } rjt_data; | ||
| 179 | }; | ||
| 180 | |||
| 181 | |||
| 182 | /* FC_BSG_HST_CT : */ | ||
| 183 | |||
| 184 | /* Request: | ||
| 185 | * This message requests that a CT Request be performed with the | ||
| 186 | * indicated N_Port_ID. The driver is responsible for logging in with | ||
| 187 | * the fabric and/or N_Port_ID, etc as per FC rules. This request does | ||
| 188 | * not mandate that the driver must enumerate the destination in the | ||
| 189 | * transport. The driver is allowed to decide whether to enumerate it, | ||
| 190 | * and whether to tear it down after the request. | ||
| 191 | */ | ||
| 192 | struct fc_bsg_host_ct { | ||
| 193 | uint8_t reserved; | ||
| 194 | |||
| 195 | /* FC Address Identier of the remote port to send the ELS to */ | ||
| 196 | uint8_t port_id[3]; | ||
| 197 | |||
| 198 | /* | ||
| 199 | * We need words 0-2 of the generic preamble for the LLD's | ||
| 200 | */ | ||
| 201 | uint32_t preamble_word0; /* revision & IN_ID */ | ||
| 202 | uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */ | ||
| 203 | uint32_t preamble_word2; /* Cmd Code, Max Size */ | ||
| 204 | |||
| 205 | }; | ||
| 206 | /* Response: | ||
| 207 | * | ||
| 208 | * The reply structure is an fc_bsg_ctels_reply structure | ||
| 209 | */ | ||
| 210 | |||
| 211 | |||
| 212 | /* FC_BSG_HST_VENDOR : */ | ||
| 213 | |||
| 214 | /* Request: | ||
| 215 | * Note: When specifying vendor_id, be sure to read the Vendor Type and ID | ||
| 216 | * formatting requirements specified in scsi_netlink.h | ||
| 217 | */ | ||
| 218 | struct fc_bsg_host_vendor { | ||
| 219 | /* | ||
| 220 | * Identifies the vendor that the message is formatted for. This | ||
| 221 | * should be the recipient of the message. | ||
| 222 | */ | ||
| 223 | uint64_t vendor_id; | ||
| 224 | |||
| 225 | /* start of vendor command area */ | ||
| 226 | uint32_t vendor_cmd[0]; | ||
| 227 | }; | ||
| 228 | |||
| 229 | /* Response: | ||
| 230 | */ | ||
| 231 | struct fc_bsg_host_vendor_reply { | ||
| 232 | /* start of vendor response area */ | ||
| 233 | uint32_t vendor_rsp[0]; | ||
| 234 | }; | ||
| 235 | |||
| 236 | |||
| 237 | |||
| 238 | /* | ||
| 239 | * FC Remote Port Messages | ||
| 240 | */ | ||
| 241 | |||
| 242 | /* FC_BSG_RPT_ELS : */ | ||
| 243 | |||
| 244 | /* Request: | ||
| 245 | * This message requests that an ELS be performed with the rport. | ||
| 246 | */ | ||
| 247 | struct fc_bsg_rport_els { | ||
| 248 | /* | ||
| 249 | * ELS Command Code being sent (must be the same as | ||
| 250 | * byte 0 of the payload) | ||
| 251 | */ | ||
| 252 | uint8_t els_code; | ||
| 253 | }; | ||
| 254 | |||
| 255 | /* Response: | ||
| 256 | * | ||
| 257 | * The reply structure is an fc_bsg_ctels_reply structure | ||
| 258 | */ | ||
| 259 | |||
| 260 | |||
| 261 | /* FC_BSG_RPT_CT : */ | ||
| 262 | |||
| 263 | /* Request: | ||
| 264 | * This message requests that a CT Request be performed with the rport. | ||
| 265 | */ | ||
| 266 | struct fc_bsg_rport_ct { | ||
| 267 | /* | ||
| 268 | * We need words 0-2 of the generic preamble for the LLD's | ||
| 269 | */ | ||
| 270 | uint32_t preamble_word0; /* revision & IN_ID */ | ||
| 271 | uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */ | ||
| 272 | uint32_t preamble_word2; /* Cmd Code, Max Size */ | ||
| 273 | }; | ||
| 274 | /* Response: | ||
| 275 | * | ||
| 276 | * The reply structure is an fc_bsg_ctels_reply structure | ||
| 277 | */ | ||
| 278 | |||
| 279 | |||
| 280 | |||
| 281 | |||
| 282 | /* request (CDB) structure of the sg_io_v4 */ | ||
| 283 | struct fc_bsg_request { | ||
| 284 | uint32_t msgcode; | ||
| 285 | union { | ||
| 286 | struct fc_bsg_host_add_rport h_addrport; | ||
| 287 | struct fc_bsg_host_del_rport h_delrport; | ||
| 288 | struct fc_bsg_host_els h_els; | ||
| 289 | struct fc_bsg_host_ct h_ct; | ||
| 290 | struct fc_bsg_host_vendor h_vendor; | ||
| 291 | |||
| 292 | struct fc_bsg_rport_els r_els; | ||
| 293 | struct fc_bsg_rport_ct r_ct; | ||
| 294 | } rqst_data; | ||
| 295 | }; | ||
| 296 | |||
| 297 | |||
| 298 | /* response (request sense data) structure of the sg_io_v4 */ | ||
| 299 | struct fc_bsg_reply { | ||
| 300 | /* | ||
| 301 | * The completion result. Result exists in two forms: | ||
| 302 | * if negative, it is an -Exxx system errno value. There will | ||
| 303 | * be no further reply information supplied. | ||
| 304 | * else, it's the 4-byte scsi error result, with driver, host, | ||
| 305 | * msg and status fields. The per-msgcode reply structure | ||
| 306 | * will contain valid data. | ||
| 307 | */ | ||
| 308 | uint32_t result; | ||
| 309 | |||
| 310 | /* If there was reply_payload, how much was recevied ? */ | ||
| 311 | uint32_t reply_payload_rcv_len; | ||
| 312 | |||
| 313 | union { | ||
| 314 | struct fc_bsg_host_vendor_reply vendor_reply; | ||
| 315 | |||
| 316 | struct fc_bsg_ctels_reply ctels_reply; | ||
| 317 | } reply_data; | ||
| 318 | }; | ||
| 319 | |||
| 320 | |||
| 321 | #endif /* SCSI_BSG_FC_H */ | ||
| 322 | |||
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index d123ca84e732..b62a097b3ecb 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
| @@ -478,6 +478,15 @@ struct scsi_host_template { | |||
| 478 | * module_init/module_exit. | 478 | * module_init/module_exit. |
| 479 | */ | 479 | */ |
| 480 | struct list_head legacy_hosts; | 480 | struct list_head legacy_hosts; |
| 481 | |||
| 482 | /* | ||
| 483 | * Vendor Identifier associated with the host | ||
| 484 | * | ||
| 485 | * Note: When specifying vendor_id, be sure to read the | ||
| 486 | * Vendor Type and ID formatting requirements specified in | ||
| 487 | * scsi_netlink.h | ||
| 488 | */ | ||
| 489 | u64 vendor_id; | ||
| 481 | }; | 490 | }; |
| 482 | 491 | ||
| 483 | /* | 492 | /* |
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index 68a8d873bbd9..fc50bd64aa4e 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h | |||
| @@ -33,7 +33,6 @@ | |||
| 33 | 33 | ||
| 34 | struct scsi_transport_template; | 34 | struct scsi_transport_template; |
| 35 | 35 | ||
| 36 | |||
| 37 | /* | 36 | /* |
| 38 | * FC Port definitions - Following FC HBAAPI guidelines | 37 | * FC Port definitions - Following FC HBAAPI guidelines |
| 39 | * | 38 | * |
| @@ -352,6 +351,7 @@ struct fc_rport { /* aka fc_starget_attrs */ | |||
| 352 | struct delayed_work fail_io_work; | 351 | struct delayed_work fail_io_work; |
| 353 | struct work_struct stgt_delete_work; | 352 | struct work_struct stgt_delete_work; |
| 354 | struct work_struct rport_delete_work; | 353 | struct work_struct rport_delete_work; |
| 354 | struct request_queue *rqst_q; /* bsg support */ | ||
| 355 | } __attribute__((aligned(sizeof(unsigned long)))); | 355 | } __attribute__((aligned(sizeof(unsigned long)))); |
| 356 | 356 | ||
| 357 | /* bit field values for struct fc_rport "flags" field: */ | 357 | /* bit field values for struct fc_rport "flags" field: */ |
| @@ -514,6 +514,9 @@ struct fc_host_attrs { | |||
| 514 | struct workqueue_struct *work_q; | 514 | struct workqueue_struct *work_q; |
| 515 | char devloss_work_q_name[20]; | 515 | char devloss_work_q_name[20]; |
| 516 | struct workqueue_struct *devloss_work_q; | 516 | struct workqueue_struct *devloss_work_q; |
| 517 | |||
| 518 | /* bsg support */ | ||
| 519 | struct request_queue *rqst_q; | ||
| 517 | }; | 520 | }; |
| 518 | 521 | ||
| 519 | #define shost_to_fc_host(x) \ | 522 | #define shost_to_fc_host(x) \ |
| @@ -579,6 +582,47 @@ struct fc_host_attrs { | |||
| 579 | (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q) | 582 | (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q) |
| 580 | 583 | ||
| 581 | 584 | ||
| 585 | struct fc_bsg_buffer { | ||
| 586 | unsigned int payload_len; | ||
| 587 | int sg_cnt; | ||
| 588 | struct scatterlist *sg_list; | ||
| 589 | }; | ||
| 590 | |||
| 591 | /* Values for fc_bsg_job->state_flags (bitflags) */ | ||
| 592 | #define FC_RQST_STATE_INPROGRESS 0 | ||
| 593 | #define FC_RQST_STATE_DONE 1 | ||
| 594 | |||
| 595 | struct fc_bsg_job { | ||
| 596 | struct Scsi_Host *shost; | ||
| 597 | struct fc_rport *rport; | ||
| 598 | struct device *dev; | ||
| 599 | struct request *req; | ||
| 600 | spinlock_t job_lock; | ||
| 601 | unsigned int state_flags; | ||
| 602 | unsigned int ref_cnt; | ||
| 603 | void (*job_done)(struct fc_bsg_job *); | ||
| 604 | |||
| 605 | struct fc_bsg_request *request; | ||
| 606 | struct fc_bsg_reply *reply; | ||
| 607 | unsigned int request_len; | ||
| 608 | unsigned int reply_len; | ||
| 609 | /* | ||
| 610 | * On entry : reply_len indicates the buffer size allocated for | ||
| 611 | * the reply. | ||
| 612 | * | ||
| 613 | * Upon completion : the message handler must set reply_len | ||
| 614 | * to indicates the size of the reply to be returned to the | ||
| 615 | * caller. | ||
| 616 | */ | ||
| 617 | |||
| 618 | /* DMA payloads for the request/response */ | ||
| 619 | struct fc_bsg_buffer request_payload; | ||
| 620 | struct fc_bsg_buffer reply_payload; | ||
| 621 | |||
| 622 | void *dd_data; /* Used for driver-specific storage */ | ||
| 623 | }; | ||
| 624 | |||
| 625 | |||
| 582 | /* The functions by which the transport class and the driver communicate */ | 626 | /* The functions by which the transport class and the driver communicate */ |
| 583 | struct fc_function_template { | 627 | struct fc_function_template { |
| 584 | void (*get_rport_dev_loss_tmo)(struct fc_rport *); | 628 | void (*get_rport_dev_loss_tmo)(struct fc_rport *); |
| @@ -614,9 +658,14 @@ struct fc_function_template { | |||
| 614 | int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64, int); | 658 | int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64, int); |
| 615 | int (* it_nexus_response)(struct Scsi_Host *, u64, int); | 659 | int (* it_nexus_response)(struct Scsi_Host *, u64, int); |
| 616 | 660 | ||
| 661 | /* bsg support */ | ||
| 662 | int (*bsg_request)(struct fc_bsg_job *); | ||
| 663 | int (*bsg_timeout)(struct fc_bsg_job *); | ||
| 664 | |||
| 617 | /* allocation lengths for host-specific data */ | 665 | /* allocation lengths for host-specific data */ |
| 618 | u32 dd_fcrport_size; | 666 | u32 dd_fcrport_size; |
| 619 | u32 dd_fcvport_size; | 667 | u32 dd_fcvport_size; |
| 668 | u32 dd_bsg_size; | ||
| 620 | 669 | ||
| 621 | /* | 670 | /* |
| 622 | * The driver sets these to tell the transport class it | 671 | * The driver sets these to tell the transport class it |
| @@ -737,7 +786,6 @@ fc_vport_set_state(struct fc_vport *vport, enum fc_vport_state new_state) | |||
| 737 | vport->vport_state = new_state; | 786 | vport->vport_state = new_state; |
| 738 | } | 787 | } |
| 739 | 788 | ||
| 740 | |||
| 741 | struct scsi_transport_template *fc_attach_transport( | 789 | struct scsi_transport_template *fc_attach_transport( |
| 742 | struct fc_function_template *); | 790 | struct fc_function_template *); |
| 743 | void fc_release_transport(struct scsi_transport_template *); | 791 | void fc_release_transport(struct scsi_transport_template *); |
diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h index 286e9628ed8b..7497a383b1a4 100644 --- a/include/scsi/scsi_transport_spi.h +++ b/include/scsi/scsi_transport_spi.h | |||
| @@ -36,8 +36,10 @@ struct spi_transport_attrs { | |||
| 36 | unsigned int width:1; /* 0 - narrow, 1 - wide */ | 36 | unsigned int width:1; /* 0 - narrow, 1 - wide */ |
| 37 | unsigned int max_width:1; | 37 | unsigned int max_width:1; |
| 38 | unsigned int iu:1; /* Information Units enabled */ | 38 | unsigned int iu:1; /* Information Units enabled */ |
| 39 | unsigned int max_iu:1; | ||
| 39 | unsigned int dt:1; /* DT clocking enabled */ | 40 | unsigned int dt:1; /* DT clocking enabled */ |
| 40 | unsigned int qas:1; /* Quick Arbitration and Selection enabled */ | 41 | unsigned int qas:1; /* Quick Arbitration and Selection enabled */ |
| 42 | unsigned int max_qas:1; | ||
| 41 | unsigned int wr_flow:1; /* Write Flow control enabled */ | 43 | unsigned int wr_flow:1; /* Write Flow control enabled */ |
| 42 | unsigned int rd_strm:1; /* Read streaming enabled */ | 44 | unsigned int rd_strm:1; /* Read streaming enabled */ |
| 43 | unsigned int rti:1; /* Retain Training Information */ | 45 | unsigned int rti:1; /* Retain Training Information */ |
| @@ -77,8 +79,10 @@ struct spi_host_attrs { | |||
| 77 | #define spi_width(x) (((struct spi_transport_attrs *)&(x)->starget_data)->width) | 79 | #define spi_width(x) (((struct spi_transport_attrs *)&(x)->starget_data)->width) |
| 78 | #define spi_max_width(x) (((struct spi_transport_attrs *)&(x)->starget_data)->max_width) | 80 | #define spi_max_width(x) (((struct spi_transport_attrs *)&(x)->starget_data)->max_width) |
| 79 | #define spi_iu(x) (((struct spi_transport_attrs *)&(x)->starget_data)->iu) | 81 | #define spi_iu(x) (((struct spi_transport_attrs *)&(x)->starget_data)->iu) |
| 82 | #define spi_max_iu(x) (((struct spi_transport_attrs *)&(x)->starget_data)->max_iu) | ||
| 80 | #define spi_dt(x) (((struct spi_transport_attrs *)&(x)->starget_data)->dt) | 83 | #define spi_dt(x) (((struct spi_transport_attrs *)&(x)->starget_data)->dt) |
| 81 | #define spi_qas(x) (((struct spi_transport_attrs *)&(x)->starget_data)->qas) | 84 | #define spi_qas(x) (((struct spi_transport_attrs *)&(x)->starget_data)->qas) |
| 85 | #define spi_max_qas(x) (((struct spi_transport_attrs *)&(x)->starget_data)->max_qas) | ||
| 82 | #define spi_wr_flow(x) (((struct spi_transport_attrs *)&(x)->starget_data)->wr_flow) | 86 | #define spi_wr_flow(x) (((struct spi_transport_attrs *)&(x)->starget_data)->wr_flow) |
| 83 | #define spi_rd_strm(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rd_strm) | 87 | #define spi_rd_strm(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rd_strm) |
| 84 | #define spi_rti(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rti) | 88 | #define spi_rti(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rti) |
diff --git a/include/video/s1d13xxxfb.h b/include/video/s1d13xxxfb.h index c3b2a2aa7140..f0736cff2ca3 100644 --- a/include/video/s1d13xxxfb.h +++ b/include/video/s1d13xxxfb.h | |||
| @@ -136,6 +136,15 @@ | |||
| 136 | #define S1DREG_DELAYOFF 0xFFFE | 136 | #define S1DREG_DELAYOFF 0xFFFE |
| 137 | #define S1DREG_DELAYON 0xFFFF | 137 | #define S1DREG_DELAYON 0xFFFF |
| 138 | 138 | ||
| 139 | #define BBLT_FIFO_EMPTY 0x00 | ||
| 140 | #define BBLT_FIFO_NOT_EMPTY 0x40 | ||
| 141 | #define BBLT_FIFO_NOT_FULL 0x30 | ||
| 142 | #define BBLT_FIFO_HALF_FULL 0x20 | ||
| 143 | #define BBLT_FIFO_FULL 0x10 | ||
| 144 | |||
| 145 | #define BBLT_SOLID_FILL 0x0c | ||
| 146 | |||
| 147 | |||
| 139 | /* Note: all above defines should go in separate header files | 148 | /* Note: all above defines should go in separate header files |
| 140 | when implementing other S1D13xxx chip support. */ | 149 | when implementing other S1D13xxx chip support. */ |
| 141 | 150 | ||
