diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2008-11-24 13:54:37 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2008-11-24 13:54:37 -0500 |
commit | 3e1d7a6219ab64e13b10b1a77c0625db9a8bd8db (patch) | |
tree | c682da7317845d7b1336e3d8498cf83bdf8f5900 /include/linux | |
parent | 42569c39917a08e8de1e8b5685463be7b74baebd (diff) | |
parent | 13d428afc007fcfcd6deeb215618f54cf9c0cae6 (diff) |
Merge branch 'linus' into core/futexes
Diffstat (limited to 'include/linux')
326 files changed, 18139 insertions, 2654 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index b68ec09399be..e531783e5d78 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -107,6 +107,7 @@ header-y += keyctl.h | |||
107 | header-y += limits.h | 107 | header-y += limits.h |
108 | header-y += magic.h | 108 | header-y += magic.h |
109 | header-y += major.h | 109 | header-y += major.h |
110 | header-y += map_to_7segment.h | ||
110 | header-y += matroxfb.h | 111 | header-y += matroxfb.h |
111 | header-y += meye.h | 112 | header-y += meye.h |
112 | header-y += minix_fs.h | 113 | header-y += minix_fs.h |
@@ -126,6 +127,7 @@ header-y += pci_regs.h | |||
126 | header-y += pfkeyv2.h | 127 | header-y += pfkeyv2.h |
127 | header-y += pg.h | 128 | header-y += pg.h |
128 | header-y += phantom.h | 129 | header-y += phantom.h |
130 | header-y += phonet.h | ||
129 | header-y += pkt_cls.h | 131 | header-y += pkt_cls.h |
130 | header-y += pkt_sched.h | 132 | header-y += pkt_sched.h |
131 | header-y += posix_types.h | 133 | header-y += posix_types.h |
@@ -180,6 +182,8 @@ unifdef-y += audit.h | |||
180 | unifdef-y += auto_fs.h | 182 | unifdef-y += auto_fs.h |
181 | unifdef-y += auxvec.h | 183 | unifdef-y += auxvec.h |
182 | unifdef-y += binfmts.h | 184 | unifdef-y += binfmts.h |
185 | unifdef-y += blktrace_api.h | ||
186 | unifdef-y += byteorder.h | ||
183 | unifdef-y += capability.h | 187 | unifdef-y += capability.h |
184 | unifdef-y += capi.h | 188 | unifdef-y += capi.h |
185 | unifdef-y += cciss_ioctl.h | 189 | unifdef-y += cciss_ioctl.h |
@@ -232,6 +236,7 @@ unifdef-y += if_fddi.h | |||
232 | unifdef-y += if_frad.h | 236 | unifdef-y += if_frad.h |
233 | unifdef-y += if_ltalk.h | 237 | unifdef-y += if_ltalk.h |
234 | unifdef-y += if_link.h | 238 | unifdef-y += if_link.h |
239 | unifdef-y += if_phonet.h | ||
235 | unifdef-y += if_pppol2tp.h | 240 | unifdef-y += if_pppol2tp.h |
236 | unifdef-y += if_pppox.h | 241 | unifdef-y += if_pppox.h |
237 | unifdef-y += if_tr.h | 242 | unifdef-y += if_tr.h |
@@ -336,6 +341,7 @@ unifdef-y += soundcard.h | |||
336 | unifdef-y += stat.h | 341 | unifdef-y += stat.h |
337 | unifdef-y += stddef.h | 342 | unifdef-y += stddef.h |
338 | unifdef-y += string.h | 343 | unifdef-y += string.h |
344 | unifdef-y += swab.h | ||
339 | unifdef-y += synclink.h | 345 | unifdef-y += synclink.h |
340 | unifdef-y += sysctl.h | 346 | unifdef-y += sysctl.h |
341 | unifdef-y += tcp.h | 347 | unifdef-y += tcp.h |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 702f79dad16a..fba8051fb297 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -94,18 +94,10 @@ int acpi_parse_mcfg (struct acpi_table_header *header); | |||
94 | void acpi_table_print_madt_entry (struct acpi_subtable_header *madt); | 94 | void acpi_table_print_madt_entry (struct acpi_subtable_header *madt); |
95 | 95 | ||
96 | /* the following four functions are architecture-dependent */ | 96 | /* the following four functions are architecture-dependent */ |
97 | #ifdef CONFIG_HAVE_ARCH_PARSE_SRAT | ||
98 | #define NR_NODE_MEMBLKS MAX_NUMNODES | ||
99 | #define acpi_numa_slit_init(slit) do {} while (0) | ||
100 | #define acpi_numa_processor_affinity_init(pa) do {} while (0) | ||
101 | #define acpi_numa_memory_affinity_init(ma) do {} while (0) | ||
102 | #define acpi_numa_arch_fixup() do {} while (0) | ||
103 | #else | ||
104 | void acpi_numa_slit_init (struct acpi_table_slit *slit); | 97 | void acpi_numa_slit_init (struct acpi_table_slit *slit); |
105 | void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa); | 98 | void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa); |
106 | void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); | 99 | void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); |
107 | void acpi_numa_arch_fixup(void); | 100 | void acpi_numa_arch_fixup(void); |
108 | #endif | ||
109 | 101 | ||
110 | #ifdef CONFIG_ACPI_HOTPLUG_CPU | 102 | #ifdef CONFIG_ACPI_HOTPLUG_CPU |
111 | /* Arch dependent functions for cpu hotplug support */ | 103 | /* Arch dependent functions for cpu hotplug support */ |
@@ -171,8 +163,6 @@ struct acpi_pci_driver { | |||
171 | int acpi_pci_register_driver(struct acpi_pci_driver *driver); | 163 | int acpi_pci_register_driver(struct acpi_pci_driver *driver); |
172 | void acpi_pci_unregister_driver(struct acpi_pci_driver *driver); | 164 | void acpi_pci_unregister_driver(struct acpi_pci_driver *driver); |
173 | 165 | ||
174 | #ifdef CONFIG_ACPI_EC | ||
175 | |||
176 | extern int ec_read(u8 addr, u8 *val); | 166 | extern int ec_read(u8 addr, u8 *val); |
177 | extern int ec_write(u8 addr, u8 val); | 167 | extern int ec_write(u8 addr, u8 val); |
178 | extern int ec_transaction(u8 command, | 168 | extern int ec_transaction(u8 command, |
@@ -180,8 +170,6 @@ extern int ec_transaction(u8 command, | |||
180 | u8 *rdata, unsigned rdata_len, | 170 | u8 *rdata, unsigned rdata_len, |
181 | int force_poll); | 171 | int force_poll); |
182 | 172 | ||
183 | #endif /*CONFIG_ACPI_EC*/ | ||
184 | |||
185 | #if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE) | 173 | #if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE) |
186 | 174 | ||
187 | typedef void (*wmi_notify_handler) (u32 value, void *context); | 175 | typedef void (*wmi_notify_handler) (u32 value, void *context); |
@@ -202,6 +190,50 @@ extern bool wmi_has_guid(const char *guid); | |||
202 | 190 | ||
203 | #endif /* CONFIG_ACPI_WMI */ | 191 | #endif /* CONFIG_ACPI_WMI */ |
204 | 192 | ||
193 | #define ACPI_VIDEO_OUTPUT_SWITCHING 0x0001 | ||
194 | #define ACPI_VIDEO_DEVICE_POSTING 0x0002 | ||
195 | #define ACPI_VIDEO_ROM_AVAILABLE 0x0004 | ||
196 | #define ACPI_VIDEO_BACKLIGHT 0x0008 | ||
197 | #define ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR 0x0010 | ||
198 | #define ACPI_VIDEO_BACKLIGHT_FORCE_VIDEO 0x0020 | ||
199 | #define ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VENDOR 0x0040 | ||
200 | #define ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VIDEO 0x0080 | ||
201 | #define ACPI_VIDEO_BACKLIGHT_DMI_VENDOR 0x0100 | ||
202 | #define ACPI_VIDEO_BACKLIGHT_DMI_VIDEO 0x0200 | ||
203 | #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR 0x0400 | ||
204 | #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO 0x0800 | ||
205 | |||
206 | #if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) | ||
207 | |||
208 | extern long acpi_video_get_capabilities(acpi_handle graphics_dev_handle); | ||
209 | extern long acpi_is_video_device(struct acpi_device *device); | ||
210 | extern int acpi_video_backlight_support(void); | ||
211 | extern int acpi_video_display_switch_support(void); | ||
212 | |||
213 | #else | ||
214 | |||
215 | static inline long acpi_video_get_capabilities(acpi_handle graphics_dev_handle) | ||
216 | { | ||
217 | return 0; | ||
218 | } | ||
219 | |||
220 | static inline long acpi_is_video_device(struct acpi_device *device) | ||
221 | { | ||
222 | return 0; | ||
223 | } | ||
224 | |||
225 | static inline int acpi_video_backlight_support(void) | ||
226 | { | ||
227 | return 0; | ||
228 | } | ||
229 | |||
230 | static inline int acpi_video_display_switch_support(void) | ||
231 | { | ||
232 | return 0; | ||
233 | } | ||
234 | |||
235 | #endif /* defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) */ | ||
236 | |||
205 | extern int acpi_blacklisted(void); | 237 | extern int acpi_blacklisted(void); |
206 | #ifdef CONFIG_DMI | 238 | #ifdef CONFIG_DMI |
207 | extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); | 239 | extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); |
diff --git a/include/linux/aer.h b/include/linux/aer.h index f2518141de88..f7df1eefc107 100644 --- a/include/linux/aer.h +++ b/include/linux/aer.h | |||
@@ -10,7 +10,6 @@ | |||
10 | #if defined(CONFIG_PCIEAER) | 10 | #if defined(CONFIG_PCIEAER) |
11 | /* pci-e port driver needs this function to enable aer */ | 11 | /* pci-e port driver needs this function to enable aer */ |
12 | extern int pci_enable_pcie_error_reporting(struct pci_dev *dev); | 12 | extern int pci_enable_pcie_error_reporting(struct pci_dev *dev); |
13 | extern int pci_find_aer_capability(struct pci_dev *dev); | ||
14 | extern int pci_disable_pcie_error_reporting(struct pci_dev *dev); | 13 | extern int pci_disable_pcie_error_reporting(struct pci_dev *dev); |
15 | extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); | 14 | extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); |
16 | #else | 15 | #else |
@@ -18,10 +17,6 @@ static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev) | |||
18 | { | 17 | { |
19 | return -EINVAL; | 18 | return -EINVAL; |
20 | } | 19 | } |
21 | static inline int pci_find_aer_capability(struct pci_dev *dev) | ||
22 | { | ||
23 | return 0; | ||
24 | } | ||
25 | static inline int pci_disable_pcie_error_reporting(struct pci_dev *dev) | 20 | static inline int pci_disable_pcie_error_reporting(struct pci_dev *dev) |
26 | { | 21 | { |
27 | return -EINVAL; | 22 | return -EINVAL; |
diff --git a/include/linux/aio.h b/include/linux/aio.h index 09b276c35227..f6b8cf99b596 100644 --- a/include/linux/aio.h +++ b/include/linux/aio.h | |||
@@ -204,12 +204,21 @@ struct kioctx { | |||
204 | /* prototypes */ | 204 | /* prototypes */ |
205 | extern unsigned aio_max_size; | 205 | extern unsigned aio_max_size; |
206 | 206 | ||
207 | #ifdef CONFIG_AIO | ||
207 | extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb); | 208 | extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb); |
208 | extern int aio_put_req(struct kiocb *iocb); | 209 | extern int aio_put_req(struct kiocb *iocb); |
209 | extern void kick_iocb(struct kiocb *iocb); | 210 | extern void kick_iocb(struct kiocb *iocb); |
210 | extern int aio_complete(struct kiocb *iocb, long res, long res2); | 211 | extern int aio_complete(struct kiocb *iocb, long res, long res2); |
211 | struct mm_struct; | 212 | struct mm_struct; |
212 | extern void exit_aio(struct mm_struct *mm); | 213 | extern void exit_aio(struct mm_struct *mm); |
214 | #else | ||
215 | static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; } | ||
216 | static inline int aio_put_req(struct kiocb *iocb) { return 0; } | ||
217 | static inline void kick_iocb(struct kiocb *iocb) { } | ||
218 | static inline int aio_complete(struct kiocb *iocb, long res, long res2) { return 0; } | ||
219 | struct mm_struct; | ||
220 | static inline void exit_aio(struct mm_struct *mm) { } | ||
221 | #endif /* CONFIG_AIO */ | ||
213 | 222 | ||
214 | #define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait) | 223 | #define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait) |
215 | 224 | ||
diff --git a/include/linux/ata.h b/include/linux/ata.h index 8a12d718c169..a53318b8cbd0 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #define __LINUX_ATA_H__ | 30 | #define __LINUX_ATA_H__ |
31 | 31 | ||
32 | #include <linux/types.h> | 32 | #include <linux/types.h> |
33 | #include <asm/byteorder.h> | ||
33 | 34 | ||
34 | /* defines only for the constants which don't work well as enums */ | 35 | /* defines only for the constants which don't work well as enums */ |
35 | #define ATA_DMA_BOUNDARY 0xffffUL | 36 | #define ATA_DMA_BOUNDARY 0xffffUL |
@@ -88,6 +89,7 @@ enum { | |||
88 | ATA_ID_DLF = 128, | 89 | ATA_ID_DLF = 128, |
89 | ATA_ID_CSFO = 129, | 90 | ATA_ID_CSFO = 129, |
90 | ATA_ID_CFA_POWER = 160, | 91 | ATA_ID_CFA_POWER = 160, |
92 | ATA_ID_ROT_SPEED = 217, | ||
91 | ATA_ID_PIO4 = (1 << 1), | 93 | ATA_ID_PIO4 = (1 << 1), |
92 | 94 | ||
93 | ATA_ID_SERNO_LEN = 20, | 95 | ATA_ID_SERNO_LEN = 20, |
@@ -557,6 +559,15 @@ static inline int ata_id_has_flush(const u16 *id) | |||
557 | return id[ATA_ID_COMMAND_SET_2] & (1 << 12); | 559 | return id[ATA_ID_COMMAND_SET_2] & (1 << 12); |
558 | } | 560 | } |
559 | 561 | ||
562 | static inline int ata_id_flush_enabled(const u16 *id) | ||
563 | { | ||
564 | if (ata_id_has_flush(id) == 0) | ||
565 | return 0; | ||
566 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) | ||
567 | return 0; | ||
568 | return id[ATA_ID_CFS_ENABLE_2] & (1 << 12); | ||
569 | } | ||
570 | |||
560 | static inline int ata_id_has_flush_ext(const u16 *id) | 571 | static inline int ata_id_has_flush_ext(const u16 *id) |
561 | { | 572 | { |
562 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) | 573 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
@@ -564,6 +575,19 @@ static inline int ata_id_has_flush_ext(const u16 *id) | |||
564 | return id[ATA_ID_COMMAND_SET_2] & (1 << 13); | 575 | return id[ATA_ID_COMMAND_SET_2] & (1 << 13); |
565 | } | 576 | } |
566 | 577 | ||
578 | static inline int ata_id_flush_ext_enabled(const u16 *id) | ||
579 | { | ||
580 | if (ata_id_has_flush_ext(id) == 0) | ||
581 | return 0; | ||
582 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) | ||
583 | return 0; | ||
584 | /* | ||
585 | * some Maxtor disks have bit 13 defined incorrectly | ||
586 | * so check bit 10 too | ||
587 | */ | ||
588 | return (id[ATA_ID_CFS_ENABLE_2] & 0x2400) == 0x2400; | ||
589 | } | ||
590 | |||
567 | static inline int ata_id_has_lba48(const u16 *id) | 591 | static inline int ata_id_has_lba48(const u16 *id) |
568 | { | 592 | { |
569 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) | 593 | if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) |
@@ -573,6 +597,15 @@ static inline int ata_id_has_lba48(const u16 *id) | |||
573 | return id[ATA_ID_COMMAND_SET_2] & (1 << 10); | 597 | return id[ATA_ID_COMMAND_SET_2] & (1 << 10); |
574 | } | 598 | } |
575 | 599 | ||
600 | static inline int ata_id_lba48_enabled(const u16 *id) | ||
601 | { | ||
602 | if (ata_id_has_lba48(id) == 0) | ||
603 | return 0; | ||
604 | if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) | ||
605 | return 0; | ||
606 | return id[ATA_ID_CFS_ENABLE_2] & (1 << 10); | ||
607 | } | ||
608 | |||
576 | static inline int ata_id_hpa_enabled(const u16 *id) | 609 | static inline int ata_id_hpa_enabled(const u16 *id) |
577 | { | 610 | { |
578 | /* Yes children, word 83 valid bits cover word 82 data */ | 611 | /* Yes children, word 83 valid bits cover word 82 data */ |
@@ -644,7 +677,15 @@ static inline unsigned int ata_id_major_version(const u16 *id) | |||
644 | 677 | ||
645 | static inline int ata_id_is_sata(const u16 *id) | 678 | static inline int ata_id_is_sata(const u16 *id) |
646 | { | 679 | { |
647 | return ata_id_major_version(id) >= 5 && id[ATA_ID_HW_CONFIG] == 0; | 680 | /* |
681 | * See if word 93 is 0 AND drive is at least ATA-5 compatible | ||
682 | * verifying that word 80 by casting it to a signed type -- | ||
683 | * this trick allows us to filter out the reserved values of | ||
684 | * 0x0000 and 0xffff along with the earlier ATA revisions... | ||
685 | */ | ||
686 | if (id[ATA_ID_HW_CONFIG] == 0 && (short)id[ATA_ID_MAJOR_VER] >= 0x0020) | ||
687 | return 1; | ||
688 | return 0; | ||
648 | } | 689 | } |
649 | 690 | ||
650 | static inline int ata_id_has_tpm(const u16 *id) | 691 | static inline int ata_id_has_tpm(const u16 *id) |
@@ -667,6 +708,15 @@ static inline int ata_id_has_dword_io(const u16 *id) | |||
667 | return 0; | 708 | return 0; |
668 | } | 709 | } |
669 | 710 | ||
711 | static inline int ata_id_has_unload(const u16 *id) | ||
712 | { | ||
713 | if (ata_id_major_version(id) >= 7 && | ||
714 | (id[ATA_ID_CFSSE] & 0xC000) == 0x4000 && | ||
715 | id[ATA_ID_CFSSE] & (1 << 13)) | ||
716 | return 1; | ||
717 | return 0; | ||
718 | } | ||
719 | |||
670 | static inline int ata_id_current_chs_valid(const u16 *id) | 720 | static inline int ata_id_current_chs_valid(const u16 *id) |
671 | { | 721 | { |
672 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command | 722 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command |
@@ -691,6 +741,11 @@ static inline int ata_id_is_cfa(const u16 *id) | |||
691 | return 0; | 741 | return 0; |
692 | } | 742 | } |
693 | 743 | ||
744 | static inline int ata_id_is_ssd(const u16 *id) | ||
745 | { | ||
746 | return id[ATA_ID_ROT_SPEED] == 0x01; | ||
747 | } | ||
748 | |||
694 | static inline int ata_drive_40wire(const u16 *dev_id) | 749 | static inline int ata_drive_40wire(const u16 *dev_id) |
695 | { | 750 | { |
696 | if (ata_id_is_sata(dev_id)) | 751 | if (ata_id_is_sata(dev_id)) |
@@ -727,6 +782,76 @@ static inline int atapi_id_dmadir(const u16 *dev_id) | |||
727 | return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000); | 782 | return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000); |
728 | } | 783 | } |
729 | 784 | ||
785 | /* | ||
786 | * ata_id_is_lba_capacity_ok() performs a sanity check on | ||
787 | * the claimed LBA capacity value for the device. | ||
788 | * | ||
789 | * Returns 1 if LBA capacity looks sensible, 0 otherwise. | ||
790 | * | ||
791 | * It is called only once for each device. | ||
792 | */ | ||
793 | static inline int ata_id_is_lba_capacity_ok(u16 *id) | ||
794 | { | ||
795 | unsigned long lba_sects, chs_sects, head, tail; | ||
796 | |||
797 | /* No non-LBA info .. so valid! */ | ||
798 | if (id[ATA_ID_CYLS] == 0) | ||
799 | return 1; | ||
800 | |||
801 | lba_sects = ata_id_u32(id, ATA_ID_LBA_CAPACITY); | ||
802 | |||
803 | /* | ||
804 | * The ATA spec tells large drives to return | ||
805 | * C/H/S = 16383/16/63 independent of their size. | ||
806 | * Some drives can be jumpered to use 15 heads instead of 16. | ||
807 | * Some drives can be jumpered to use 4092 cyls instead of 16383. | ||
808 | */ | ||
809 | if ((id[ATA_ID_CYLS] == 16383 || | ||
810 | (id[ATA_ID_CYLS] == 4092 && id[ATA_ID_CUR_CYLS] == 16383)) && | ||
811 | id[ATA_ID_SECTORS] == 63 && | ||
812 | (id[ATA_ID_HEADS] == 15 || id[ATA_ID_HEADS] == 16) && | ||
813 | (lba_sects >= 16383 * 63 * id[ATA_ID_HEADS])) | ||
814 | return 1; | ||
815 | |||
816 | chs_sects = id[ATA_ID_CYLS] * id[ATA_ID_HEADS] * id[ATA_ID_SECTORS]; | ||
817 | |||
818 | /* perform a rough sanity check on lba_sects: within 10% is OK */ | ||
819 | if (lba_sects - chs_sects < chs_sects/10) | ||
820 | return 1; | ||
821 | |||
822 | /* some drives have the word order reversed */ | ||
823 | head = (lba_sects >> 16) & 0xffff; | ||
824 | tail = lba_sects & 0xffff; | ||
825 | lba_sects = head | (tail << 16); | ||
826 | |||
827 | if (lba_sects - chs_sects < chs_sects/10) { | ||
828 | *(__le32 *)&id[ATA_ID_LBA_CAPACITY] = __cpu_to_le32(lba_sects); | ||
829 | return 1; /* LBA capacity is (now) good */ | ||
830 | } | ||
831 | |||
832 | return 0; /* LBA capacity value may be bad */ | ||
833 | } | ||
834 | |||
835 | static inline void ata_id_to_hd_driveid(u16 *id) | ||
836 | { | ||
837 | #ifdef __BIG_ENDIAN | ||
838 | /* accessed in struct hd_driveid as 8-bit values */ | ||
839 | id[ATA_ID_MAX_MULTSECT] = __cpu_to_le16(id[ATA_ID_MAX_MULTSECT]); | ||
840 | id[ATA_ID_CAPABILITY] = __cpu_to_le16(id[ATA_ID_CAPABILITY]); | ||
841 | id[ATA_ID_OLD_PIO_MODES] = __cpu_to_le16(id[ATA_ID_OLD_PIO_MODES]); | ||
842 | id[ATA_ID_OLD_DMA_MODES] = __cpu_to_le16(id[ATA_ID_OLD_DMA_MODES]); | ||
843 | id[ATA_ID_MULTSECT] = __cpu_to_le16(id[ATA_ID_MULTSECT]); | ||
844 | |||
845 | /* as 32-bit values */ | ||
846 | *(u32 *)&id[ATA_ID_LBA_CAPACITY] = ata_id_u32(id, ATA_ID_LBA_CAPACITY); | ||
847 | *(u32 *)&id[ATA_ID_SPG] = ata_id_u32(id, ATA_ID_SPG); | ||
848 | |||
849 | /* as 64-bit value */ | ||
850 | *(u64 *)&id[ATA_ID_LBA_CAPACITY_2] = | ||
851 | ata_id_u64(id, ATA_ID_LBA_CAPACITY_2); | ||
852 | #endif | ||
853 | } | ||
854 | |||
730 | static inline int is_multi_taskfile(struct ata_taskfile *tf) | 855 | static inline int is_multi_taskfile(struct ata_taskfile *tf) |
731 | { | 856 | { |
732 | return (tf->command == ATA_CMD_READ_MULTI) || | 857 | return (tf->command == ATA_CMD_READ_MULTI) || |
diff --git a/include/linux/auto_dev-ioctl.h b/include/linux/auto_dev-ioctl.h new file mode 100644 index 000000000000..f4d05ccd731f --- /dev/null +++ b/include/linux/auto_dev-ioctl.h | |||
@@ -0,0 +1,157 @@ | |||
1 | /* | ||
2 | * Copyright 2008 Red Hat, Inc. All rights reserved. | ||
3 | * Copyright 2008 Ian Kent <raven@themaw.net> | ||
4 | * | ||
5 | * This file is part of the Linux kernel and is made available under | ||
6 | * the terms of the GNU General Public License, version 2, or at your | ||
7 | * option, any later version, incorporated herein by reference. | ||
8 | */ | ||
9 | |||
10 | #ifndef _LINUX_AUTO_DEV_IOCTL_H | ||
11 | #define _LINUX_AUTO_DEV_IOCTL_H | ||
12 | |||
13 | #include <linux/types.h> | ||
14 | |||
15 | #define AUTOFS_DEVICE_NAME "autofs" | ||
16 | |||
17 | #define AUTOFS_DEV_IOCTL_VERSION_MAJOR 1 | ||
18 | #define AUTOFS_DEV_IOCTL_VERSION_MINOR 0 | ||
19 | |||
20 | #define AUTOFS_DEVID_LEN 16 | ||
21 | |||
22 | #define AUTOFS_DEV_IOCTL_SIZE sizeof(struct autofs_dev_ioctl) | ||
23 | |||
24 | /* | ||
25 | * An ioctl interface for autofs mount point control. | ||
26 | */ | ||
27 | |||
28 | /* | ||
29 | * All the ioctls use this structure. | ||
30 | * When sending a path size must account for the total length | ||
31 | * of the chunk of memory otherwise is is the size of the | ||
32 | * structure. | ||
33 | */ | ||
34 | |||
35 | struct autofs_dev_ioctl { | ||
36 | __u32 ver_major; | ||
37 | __u32 ver_minor; | ||
38 | __u32 size; /* total size of data passed in | ||
39 | * including this struct */ | ||
40 | __s32 ioctlfd; /* automount command fd */ | ||
41 | |||
42 | __u32 arg1; /* Command parameters */ | ||
43 | __u32 arg2; | ||
44 | |||
45 | char path[0]; | ||
46 | }; | ||
47 | |||
48 | static inline void init_autofs_dev_ioctl(struct autofs_dev_ioctl *in) | ||
49 | { | ||
50 | in->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR; | ||
51 | in->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR; | ||
52 | in->size = sizeof(struct autofs_dev_ioctl); | ||
53 | in->ioctlfd = -1; | ||
54 | in->arg1 = 0; | ||
55 | in->arg2 = 0; | ||
56 | return; | ||
57 | } | ||
58 | |||
59 | /* | ||
60 | * If you change this make sure you make the corresponding change | ||
61 | * to autofs-dev-ioctl.c:lookup_ioctl() | ||
62 | */ | ||
63 | enum { | ||
64 | /* Get various version info */ | ||
65 | AUTOFS_DEV_IOCTL_VERSION_CMD = 0x71, | ||
66 | AUTOFS_DEV_IOCTL_PROTOVER_CMD, | ||
67 | AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD, | ||
68 | |||
69 | /* Open mount ioctl fd */ | ||
70 | AUTOFS_DEV_IOCTL_OPENMOUNT_CMD, | ||
71 | |||
72 | /* Close mount ioctl fd */ | ||
73 | AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD, | ||
74 | |||
75 | /* Mount/expire status returns */ | ||
76 | AUTOFS_DEV_IOCTL_READY_CMD, | ||
77 | AUTOFS_DEV_IOCTL_FAIL_CMD, | ||
78 | |||
79 | /* Activate/deactivate autofs mount */ | ||
80 | AUTOFS_DEV_IOCTL_SETPIPEFD_CMD, | ||
81 | AUTOFS_DEV_IOCTL_CATATONIC_CMD, | ||
82 | |||
83 | /* Expiry timeout */ | ||
84 | AUTOFS_DEV_IOCTL_TIMEOUT_CMD, | ||
85 | |||
86 | /* Get mount last requesting uid and gid */ | ||
87 | AUTOFS_DEV_IOCTL_REQUESTER_CMD, | ||
88 | |||
89 | /* Check for eligible expire candidates */ | ||
90 | AUTOFS_DEV_IOCTL_EXPIRE_CMD, | ||
91 | |||
92 | /* Request busy status */ | ||
93 | AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD, | ||
94 | |||
95 | /* Check if path is a mountpoint */ | ||
96 | AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD, | ||
97 | }; | ||
98 | |||
99 | #define AUTOFS_IOCTL 0x93 | ||
100 | |||
101 | #define AUTOFS_DEV_IOCTL_VERSION \ | ||
102 | _IOWR(AUTOFS_IOCTL, \ | ||
103 | AUTOFS_DEV_IOCTL_VERSION_CMD, struct autofs_dev_ioctl) | ||
104 | |||
105 | #define AUTOFS_DEV_IOCTL_PROTOVER \ | ||
106 | _IOWR(AUTOFS_IOCTL, \ | ||
107 | AUTOFS_DEV_IOCTL_PROTOVER_CMD, struct autofs_dev_ioctl) | ||
108 | |||
109 | #define AUTOFS_DEV_IOCTL_PROTOSUBVER \ | ||
110 | _IOWR(AUTOFS_IOCTL, \ | ||
111 | AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD, struct autofs_dev_ioctl) | ||
112 | |||
113 | #define AUTOFS_DEV_IOCTL_OPENMOUNT \ | ||
114 | _IOWR(AUTOFS_IOCTL, \ | ||
115 | AUTOFS_DEV_IOCTL_OPENMOUNT_CMD, struct autofs_dev_ioctl) | ||
116 | |||
117 | #define AUTOFS_DEV_IOCTL_CLOSEMOUNT \ | ||
118 | _IOWR(AUTOFS_IOCTL, \ | ||
119 | AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD, struct autofs_dev_ioctl) | ||
120 | |||
121 | #define AUTOFS_DEV_IOCTL_READY \ | ||
122 | _IOWR(AUTOFS_IOCTL, \ | ||
123 | AUTOFS_DEV_IOCTL_READY_CMD, struct autofs_dev_ioctl) | ||
124 | |||
125 | #define AUTOFS_DEV_IOCTL_FAIL \ | ||
126 | _IOWR(AUTOFS_IOCTL, \ | ||
127 | AUTOFS_DEV_IOCTL_FAIL_CMD, struct autofs_dev_ioctl) | ||
128 | |||
129 | #define AUTOFS_DEV_IOCTL_SETPIPEFD \ | ||
130 | _IOWR(AUTOFS_IOCTL, \ | ||
131 | AUTOFS_DEV_IOCTL_SETPIPEFD_CMD, struct autofs_dev_ioctl) | ||
132 | |||
133 | #define AUTOFS_DEV_IOCTL_CATATONIC \ | ||
134 | _IOWR(AUTOFS_IOCTL, \ | ||
135 | AUTOFS_DEV_IOCTL_CATATONIC_CMD, struct autofs_dev_ioctl) | ||
136 | |||
137 | #define AUTOFS_DEV_IOCTL_TIMEOUT \ | ||
138 | _IOWR(AUTOFS_IOCTL, \ | ||
139 | AUTOFS_DEV_IOCTL_TIMEOUT_CMD, struct autofs_dev_ioctl) | ||
140 | |||
141 | #define AUTOFS_DEV_IOCTL_REQUESTER \ | ||
142 | _IOWR(AUTOFS_IOCTL, \ | ||
143 | AUTOFS_DEV_IOCTL_REQUESTER_CMD, struct autofs_dev_ioctl) | ||
144 | |||
145 | #define AUTOFS_DEV_IOCTL_EXPIRE \ | ||
146 | _IOWR(AUTOFS_IOCTL, \ | ||
147 | AUTOFS_DEV_IOCTL_EXPIRE_CMD, struct autofs_dev_ioctl) | ||
148 | |||
149 | #define AUTOFS_DEV_IOCTL_ASKUMOUNT \ | ||
150 | _IOWR(AUTOFS_IOCTL, \ | ||
151 | AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD, struct autofs_dev_ioctl) | ||
152 | |||
153 | #define AUTOFS_DEV_IOCTL_ISMOUNTPOINT \ | ||
154 | _IOWR(AUTOFS_IOCTL, \ | ||
155 | AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD, struct autofs_dev_ioctl) | ||
156 | |||
157 | #endif /* _LINUX_AUTO_DEV_IOCTL_H */ | ||
diff --git a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h index b785c6f8644d..2253716d4b92 100644 --- a/include/linux/auto_fs4.h +++ b/include/linux/auto_fs4.h | |||
@@ -23,12 +23,17 @@ | |||
23 | #define AUTOFS_MIN_PROTO_VERSION 3 | 23 | #define AUTOFS_MIN_PROTO_VERSION 3 |
24 | #define AUTOFS_MAX_PROTO_VERSION 5 | 24 | #define AUTOFS_MAX_PROTO_VERSION 5 |
25 | 25 | ||
26 | #define AUTOFS_PROTO_SUBVERSION 0 | 26 | #define AUTOFS_PROTO_SUBVERSION 1 |
27 | 27 | ||
28 | /* Mask for expire behaviour */ | 28 | /* Mask for expire behaviour */ |
29 | #define AUTOFS_EXP_IMMEDIATE 1 | 29 | #define AUTOFS_EXP_IMMEDIATE 1 |
30 | #define AUTOFS_EXP_LEAVES 2 | 30 | #define AUTOFS_EXP_LEAVES 2 |
31 | 31 | ||
32 | #define AUTOFS_TYPE_ANY 0x0000 | ||
33 | #define AUTOFS_TYPE_INDIRECT 0x0001 | ||
34 | #define AUTOFS_TYPE_DIRECT 0x0002 | ||
35 | #define AUTOFS_TYPE_OFFSET 0x0004 | ||
36 | |||
32 | /* Daemon notification packet types */ | 37 | /* Daemon notification packet types */ |
33 | enum autofs_notify { | 38 | enum autofs_notify { |
34 | NFY_NONE, | 39 | NFY_NONE, |
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 0a24d5550eb3..bee52abb8a4d 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
@@ -175,6 +175,8 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio); | |||
175 | * BDI_CAP_READ_MAP: Can be mapped for reading | 175 | * BDI_CAP_READ_MAP: Can be mapped for reading |
176 | * BDI_CAP_WRITE_MAP: Can be mapped for writing | 176 | * BDI_CAP_WRITE_MAP: Can be mapped for writing |
177 | * BDI_CAP_EXEC_MAP: Can be mapped for execution | 177 | * BDI_CAP_EXEC_MAP: Can be mapped for execution |
178 | * | ||
179 | * BDI_CAP_SWAP_BACKED: Count shmem/tmpfs objects as swap-backed. | ||
178 | */ | 180 | */ |
179 | #define BDI_CAP_NO_ACCT_DIRTY 0x00000001 | 181 | #define BDI_CAP_NO_ACCT_DIRTY 0x00000001 |
180 | #define BDI_CAP_NO_WRITEBACK 0x00000002 | 182 | #define BDI_CAP_NO_WRITEBACK 0x00000002 |
@@ -184,6 +186,7 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio); | |||
184 | #define BDI_CAP_WRITE_MAP 0x00000020 | 186 | #define BDI_CAP_WRITE_MAP 0x00000020 |
185 | #define BDI_CAP_EXEC_MAP 0x00000040 | 187 | #define BDI_CAP_EXEC_MAP 0x00000040 |
186 | #define BDI_CAP_NO_ACCT_WB 0x00000080 | 188 | #define BDI_CAP_NO_ACCT_WB 0x00000080 |
189 | #define BDI_CAP_SWAP_BACKED 0x00000100 | ||
187 | 190 | ||
188 | #define BDI_CAP_VMFLAGS \ | 191 | #define BDI_CAP_VMFLAGS \ |
189 | (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) | 192 | (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) |
@@ -248,6 +251,11 @@ static inline bool bdi_cap_account_writeback(struct backing_dev_info *bdi) | |||
248 | BDI_CAP_NO_WRITEBACK)); | 251 | BDI_CAP_NO_WRITEBACK)); |
249 | } | 252 | } |
250 | 253 | ||
254 | static inline bool bdi_cap_swap_backed(struct backing_dev_info *bdi) | ||
255 | { | ||
256 | return bdi->capabilities & BDI_CAP_SWAP_BACKED; | ||
257 | } | ||
258 | |||
251 | static inline bool mapping_cap_writeback_dirty(struct address_space *mapping) | 259 | static inline bool mapping_cap_writeback_dirty(struct address_space *mapping) |
252 | { | 260 | { |
253 | return bdi_cap_writeback_dirty(mapping->backing_dev_info); | 261 | return bdi_cap_writeback_dirty(mapping->backing_dev_info); |
@@ -258,4 +266,9 @@ static inline bool mapping_cap_account_dirty(struct address_space *mapping) | |||
258 | return bdi_cap_account_dirty(mapping->backing_dev_info); | 266 | return bdi_cap_account_dirty(mapping->backing_dev_info); |
259 | } | 267 | } |
260 | 268 | ||
269 | static inline bool mapping_cap_swap_backed(struct address_space *mapping) | ||
270 | { | ||
271 | return bdi_cap_swap_backed(mapping->backing_dev_info); | ||
272 | } | ||
273 | |||
261 | #endif /* _LINUX_BACKING_DEV_H */ | 274 | #endif /* _LINUX_BACKING_DEV_H */ |
diff --git a/include/linux/bcd.h b/include/linux/bcd.h index 7ac518e3c152..22ea563ba3eb 100644 --- a/include/linux/bcd.h +++ b/include/linux/bcd.h | |||
@@ -1,12 +1,3 @@ | |||
1 | /* Permission is hereby granted to copy, modify and redistribute this code | ||
2 | * in terms of the GNU Library General Public License, Version 2 or later, | ||
3 | * at your option. | ||
4 | */ | ||
5 | |||
6 | /* macros to translate to/from binary and binary-coded decimal (frequently | ||
7 | * found in RTC chips). | ||
8 | */ | ||
9 | |||
10 | #ifndef _BCD_H | 1 | #ifndef _BCD_H |
11 | #define _BCD_H | 2 | #define _BCD_H |
12 | 3 | ||
@@ -15,11 +6,4 @@ | |||
15 | unsigned bcd2bin(unsigned char val) __attribute_const__; | 6 | unsigned bcd2bin(unsigned char val) __attribute_const__; |
16 | unsigned char bin2bcd(unsigned val) __attribute_const__; | 7 | unsigned char bin2bcd(unsigned val) __attribute_const__; |
17 | 8 | ||
18 | #define BCD2BIN(val) bcd2bin(val) | ||
19 | #define BIN2BCD(val) bin2bcd(val) | ||
20 | |||
21 | /* backwards compat */ | ||
22 | #define BCD_TO_BIN(val) ((val)=BCD2BIN(val)) | ||
23 | #define BIN_TO_BCD(val) ((val)=BIN2BCD(val)) | ||
24 | |||
25 | #endif /* _BCD_H */ | 9 | #endif /* _BCD_H */ |
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index 826f62350805..7394b5b349ff 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
@@ -36,6 +36,10 @@ struct linux_binprm{ | |||
36 | unsigned long p; /* current top of mem */ | 36 | unsigned long p; /* current top of mem */ |
37 | unsigned int sh_bang:1, | 37 | unsigned int sh_bang:1, |
38 | misc_bang:1; | 38 | misc_bang:1; |
39 | #ifdef __alpha__ | ||
40 | unsigned int taso:1; | ||
41 | #endif | ||
42 | unsigned int recursion_depth; | ||
39 | struct file * file; | 43 | struct file * file; |
40 | int e_uid, e_gid; | 44 | int e_uid, e_gid; |
41 | kernel_cap_t cap_post_exec_permitted; | 45 | kernel_cap_t cap_post_exec_permitted; |
@@ -58,6 +62,7 @@ struct linux_binprm{ | |||
58 | #define BINPRM_FLAGS_EXECFD_BIT 1 | 62 | #define BINPRM_FLAGS_EXECFD_BIT 1 |
59 | #define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT) | 63 | #define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT) |
60 | 64 | ||
65 | #define BINPRM_MAX_RECURSION 4 | ||
61 | 66 | ||
62 | /* | 67 | /* |
63 | * This structure defines the functions that are used to load the binary formats that | 68 | * This structure defines the functions that are used to load the binary formats that |
diff --git a/include/linux/bio.h b/include/linux/bio.h index 0933a14e6414..6a642098e5c3 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -26,21 +26,8 @@ | |||
26 | 26 | ||
27 | #ifdef CONFIG_BLOCK | 27 | #ifdef CONFIG_BLOCK |
28 | 28 | ||
29 | /* Platforms may set this to teach the BIO layer about IOMMU hardware. */ | ||
30 | #include <asm/io.h> | 29 | #include <asm/io.h> |
31 | 30 | ||
32 | #if defined(BIO_VMERGE_MAX_SIZE) && defined(BIO_VMERGE_BOUNDARY) | ||
33 | #define BIOVEC_VIRT_START_SIZE(x) (bvec_to_phys(x) & (BIO_VMERGE_BOUNDARY - 1)) | ||
34 | #define BIOVEC_VIRT_OVERSIZE(x) ((x) > BIO_VMERGE_MAX_SIZE) | ||
35 | #else | ||
36 | #define BIOVEC_VIRT_START_SIZE(x) 0 | ||
37 | #define BIOVEC_VIRT_OVERSIZE(x) 0 | ||
38 | #endif | ||
39 | |||
40 | #ifndef BIO_VMERGE_BOUNDARY | ||
41 | #define BIO_VMERGE_BOUNDARY 0 | ||
42 | #endif | ||
43 | |||
44 | #define BIO_DEBUG | 31 | #define BIO_DEBUG |
45 | 32 | ||
46 | #ifdef BIO_DEBUG | 33 | #ifdef BIO_DEBUG |
@@ -88,25 +75,21 @@ struct bio { | |||
88 | /* Number of segments in this BIO after | 75 | /* Number of segments in this BIO after |
89 | * physical address coalescing is performed. | 76 | * physical address coalescing is performed. |
90 | */ | 77 | */ |
91 | unsigned short bi_phys_segments; | 78 | unsigned int bi_phys_segments; |
92 | |||
93 | /* Number of segments after physical and DMA remapping | ||
94 | * hardware coalescing is performed. | ||
95 | */ | ||
96 | unsigned short bi_hw_segments; | ||
97 | 79 | ||
98 | unsigned int bi_size; /* residual I/O count */ | 80 | unsigned int bi_size; /* residual I/O count */ |
99 | 81 | ||
100 | /* | 82 | /* |
101 | * To keep track of the max hw size, we account for the | 83 | * To keep track of the max segment size, we account for the |
102 | * sizes of the first and last virtually mergeable segments | 84 | * sizes of the first and last mergeable segments in this bio. |
103 | * in this bio | ||
104 | */ | 85 | */ |
105 | unsigned int bi_hw_front_size; | 86 | unsigned int bi_seg_front_size; |
106 | unsigned int bi_hw_back_size; | 87 | unsigned int bi_seg_back_size; |
107 | 88 | ||
108 | unsigned int bi_max_vecs; /* max bvl_vecs we can hold */ | 89 | unsigned int bi_max_vecs; /* max bvl_vecs we can hold */ |
109 | 90 | ||
91 | unsigned int bi_comp_cpu; /* completion CPU */ | ||
92 | |||
110 | struct bio_vec *bi_io_vec; /* the actual vec list */ | 93 | struct bio_vec *bi_io_vec; /* the actual vec list */ |
111 | 94 | ||
112 | bio_end_io_t *bi_end_io; | 95 | bio_end_io_t *bi_end_io; |
@@ -126,11 +109,14 @@ struct bio { | |||
126 | #define BIO_UPTODATE 0 /* ok after I/O completion */ | 109 | #define BIO_UPTODATE 0 /* ok after I/O completion */ |
127 | #define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */ | 110 | #define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */ |
128 | #define BIO_EOF 2 /* out-out-bounds error */ | 111 | #define BIO_EOF 2 /* out-out-bounds error */ |
129 | #define BIO_SEG_VALID 3 /* nr_hw_seg valid */ | 112 | #define BIO_SEG_VALID 3 /* bi_phys_segments valid */ |
130 | #define BIO_CLONED 4 /* doesn't own data */ | 113 | #define BIO_CLONED 4 /* doesn't own data */ |
131 | #define BIO_BOUNCED 5 /* bio is a bounce bio */ | 114 | #define BIO_BOUNCED 5 /* bio is a bounce bio */ |
132 | #define BIO_USER_MAPPED 6 /* contains user pages */ | 115 | #define BIO_USER_MAPPED 6 /* contains user pages */ |
133 | #define BIO_EOPNOTSUPP 7 /* not supported */ | 116 | #define BIO_EOPNOTSUPP 7 /* not supported */ |
117 | #define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */ | ||
118 | #define BIO_NULL_MAPPED 9 /* contains invalid user pages */ | ||
119 | #define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */ | ||
134 | #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) | 120 | #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) |
135 | 121 | ||
136 | /* | 122 | /* |
@@ -144,18 +130,36 @@ struct bio { | |||
144 | /* | 130 | /* |
145 | * bio bi_rw flags | 131 | * bio bi_rw flags |
146 | * | 132 | * |
147 | * bit 0 -- read (not set) or write (set) | 133 | * bit 0 -- data direction |
134 | * If not set, bio is a read from device. If set, it's a write to device. | ||
148 | * bit 1 -- rw-ahead when set | 135 | * bit 1 -- rw-ahead when set |
149 | * bit 2 -- barrier | 136 | * bit 2 -- barrier |
150 | * bit 3 -- fail fast, don't want low level driver retries | 137 | * Insert a serialization point in the IO queue, forcing previously |
151 | * bit 4 -- synchronous I/O hint: the block layer will unplug immediately | 138 | * submitted IO to be completed before this oen is issued. |
139 | * bit 3 -- synchronous I/O hint: the block layer will unplug immediately | ||
140 | * Note that this does NOT indicate that the IO itself is sync, just | ||
141 | * that the block layer will not postpone issue of this IO by plugging. | ||
142 | * bit 4 -- metadata request | ||
143 | * Used for tracing to differentiate metadata and data IO. May also | ||
144 | * get some preferential treatment in the IO scheduler | ||
145 | * bit 5 -- discard sectors | ||
146 | * Informs the lower level device that this range of sectors is no longer | ||
147 | * used by the file system and may thus be freed by the device. Used | ||
148 | * for flash based storage. | ||
149 | * bit 6 -- fail fast device errors | ||
150 | * bit 7 -- fail fast transport errors | ||
151 | * bit 8 -- fail fast driver errors | ||
152 | * Don't want driver retries for any fast fail whatever the reason. | ||
152 | */ | 153 | */ |
153 | #define BIO_RW 0 | 154 | #define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */ |
154 | #define BIO_RW_AHEAD 1 | 155 | #define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */ |
155 | #define BIO_RW_BARRIER 2 | 156 | #define BIO_RW_BARRIER 2 |
156 | #define BIO_RW_FAILFAST 3 | 157 | #define BIO_RW_SYNC 3 |
157 | #define BIO_RW_SYNC 4 | 158 | #define BIO_RW_META 4 |
158 | #define BIO_RW_META 5 | 159 | #define BIO_RW_DISCARD 5 |
160 | #define BIO_RW_FAILFAST_DEV 6 | ||
161 | #define BIO_RW_FAILFAST_TRANSPORT 7 | ||
162 | #define BIO_RW_FAILFAST_DRIVER 8 | ||
159 | 163 | ||
160 | /* | 164 | /* |
161 | * upper 16 bits of bi_rw define the io priority of this bio | 165 | * upper 16 bits of bi_rw define the io priority of this bio |
@@ -182,17 +186,21 @@ struct bio { | |||
182 | #define bio_sectors(bio) ((bio)->bi_size >> 9) | 186 | #define bio_sectors(bio) ((bio)->bi_size >> 9) |
183 | #define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER)) | 187 | #define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER)) |
184 | #define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC)) | 188 | #define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC)) |
185 | #define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST)) | 189 | #define bio_failfast_dev(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_DEV)) |
190 | #define bio_failfast_transport(bio) \ | ||
191 | ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_TRANSPORT)) | ||
192 | #define bio_failfast_driver(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_DRIVER)) | ||
186 | #define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD)) | 193 | #define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD)) |
187 | #define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META)) | 194 | #define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META)) |
188 | #define bio_empty_barrier(bio) (bio_barrier(bio) && !(bio)->bi_size) | 195 | #define bio_discard(bio) ((bio)->bi_rw & (1 << BIO_RW_DISCARD)) |
196 | #define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio)) | ||
189 | 197 | ||
190 | static inline unsigned int bio_cur_sectors(struct bio *bio) | 198 | static inline unsigned int bio_cur_sectors(struct bio *bio) |
191 | { | 199 | { |
192 | if (bio->bi_vcnt) | 200 | if (bio->bi_vcnt) |
193 | return bio_iovec(bio)->bv_len >> 9; | 201 | return bio_iovec(bio)->bv_len >> 9; |
194 | 202 | else /* dataless requests such as discard */ | |
195 | return 0; | 203 | return bio->bi_size >> 9; |
196 | } | 204 | } |
197 | 205 | ||
198 | static inline void *bio_data(struct bio *bio) | 206 | static inline void *bio_data(struct bio *bio) |
@@ -228,16 +236,18 @@ static inline void *bio_data(struct bio *bio) | |||
228 | #define __BVEC_END(bio) bio_iovec_idx((bio), (bio)->bi_vcnt - 1) | 236 | #define __BVEC_END(bio) bio_iovec_idx((bio), (bio)->bi_vcnt - 1) |
229 | #define __BVEC_START(bio) bio_iovec_idx((bio), (bio)->bi_idx) | 237 | #define __BVEC_START(bio) bio_iovec_idx((bio), (bio)->bi_idx) |
230 | 238 | ||
239 | /* Default implementation of BIOVEC_PHYS_MERGEABLE */ | ||
240 | #define __BIOVEC_PHYS_MERGEABLE(vec1, vec2) \ | ||
241 | ((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2))) | ||
242 | |||
231 | /* | 243 | /* |
232 | * allow arch override, for eg virtualized architectures (put in asm/io.h) | 244 | * allow arch override, for eg virtualized architectures (put in asm/io.h) |
233 | */ | 245 | */ |
234 | #ifndef BIOVEC_PHYS_MERGEABLE | 246 | #ifndef BIOVEC_PHYS_MERGEABLE |
235 | #define BIOVEC_PHYS_MERGEABLE(vec1, vec2) \ | 247 | #define BIOVEC_PHYS_MERGEABLE(vec1, vec2) \ |
236 | ((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2))) | 248 | __BIOVEC_PHYS_MERGEABLE(vec1, vec2) |
237 | #endif | 249 | #endif |
238 | 250 | ||
239 | #define BIOVEC_VIRT_MERGEABLE(vec1, vec2) \ | ||
240 | ((((bvec_to_phys((vec1)) + (vec1)->bv_len) | bvec_to_phys((vec2))) & (BIO_VMERGE_BOUNDARY - 1)) == 0) | ||
241 | #define __BIO_SEG_BOUNDARY(addr1, addr2, mask) \ | 251 | #define __BIO_SEG_BOUNDARY(addr1, addr2, mask) \ |
242 | (((addr1) | (mask)) == (((addr2) - 1) | (mask))) | 252 | (((addr1) | (mask)) == (((addr2) - 1) | (mask))) |
243 | #define BIOVEC_SEG_BOUNDARY(q, b1, b2) \ | 253 | #define BIOVEC_SEG_BOUNDARY(q, b1, b2) \ |
@@ -319,15 +329,14 @@ struct bio_pair { | |||
319 | atomic_t cnt; | 329 | atomic_t cnt; |
320 | int error; | 330 | int error; |
321 | }; | 331 | }; |
322 | extern struct bio_pair *bio_split(struct bio *bi, mempool_t *pool, | 332 | extern struct bio_pair *bio_split(struct bio *bi, int first_sectors); |
323 | int first_sectors); | ||
324 | extern mempool_t *bio_split_pool; | ||
325 | extern void bio_pair_release(struct bio_pair *dbio); | 333 | extern void bio_pair_release(struct bio_pair *dbio); |
326 | 334 | ||
327 | extern struct bio_set *bioset_create(int, int); | 335 | extern struct bio_set *bioset_create(int, int); |
328 | extern void bioset_free(struct bio_set *); | 336 | extern void bioset_free(struct bio_set *); |
329 | 337 | ||
330 | extern struct bio *bio_alloc(gfp_t, int); | 338 | extern struct bio *bio_alloc(gfp_t, int); |
339 | extern struct bio *bio_kmalloc(gfp_t, int); | ||
331 | extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); | 340 | extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); |
332 | extern void bio_put(struct bio *); | 341 | extern void bio_put(struct bio *); |
333 | extern void bio_free(struct bio *, struct bio_set *); | 342 | extern void bio_free(struct bio *, struct bio_set *); |
@@ -335,7 +344,6 @@ extern void bio_free(struct bio *, struct bio_set *); | |||
335 | extern void bio_endio(struct bio *, int); | 344 | extern void bio_endio(struct bio *, int); |
336 | struct request_queue; | 345 | struct request_queue; |
337 | extern int bio_phys_segments(struct request_queue *, struct bio *); | 346 | extern int bio_phys_segments(struct request_queue *, struct bio *); |
338 | extern int bio_hw_segments(struct request_queue *, struct bio *); | ||
339 | 347 | ||
340 | extern void __bio_clone(struct bio *, struct bio *); | 348 | extern void __bio_clone(struct bio *, struct bio *); |
341 | extern struct bio *bio_clone(struct bio *, gfp_t); | 349 | extern struct bio *bio_clone(struct bio *, gfp_t); |
@@ -346,12 +354,14 @@ extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); | |||
346 | extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, | 354 | extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, |
347 | unsigned int, unsigned int); | 355 | unsigned int, unsigned int); |
348 | extern int bio_get_nr_vecs(struct block_device *); | 356 | extern int bio_get_nr_vecs(struct block_device *); |
357 | extern sector_t bio_sector_offset(struct bio *, unsigned short, unsigned int); | ||
349 | extern struct bio *bio_map_user(struct request_queue *, struct block_device *, | 358 | extern struct bio *bio_map_user(struct request_queue *, struct block_device *, |
350 | unsigned long, unsigned int, int); | 359 | unsigned long, unsigned int, int, gfp_t); |
351 | struct sg_iovec; | 360 | struct sg_iovec; |
361 | struct rq_map_data; | ||
352 | extern struct bio *bio_map_user_iov(struct request_queue *, | 362 | extern struct bio *bio_map_user_iov(struct request_queue *, |
353 | struct block_device *, | 363 | struct block_device *, |
354 | struct sg_iovec *, int, int); | 364 | struct sg_iovec *, int, int, gfp_t); |
355 | extern void bio_unmap_user(struct bio *); | 365 | extern void bio_unmap_user(struct bio *); |
356 | extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int, | 366 | extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int, |
357 | gfp_t); | 367 | gfp_t); |
@@ -359,15 +369,25 @@ extern struct bio *bio_copy_kern(struct request_queue *, void *, unsigned int, | |||
359 | gfp_t, int); | 369 | gfp_t, int); |
360 | extern void bio_set_pages_dirty(struct bio *bio); | 370 | extern void bio_set_pages_dirty(struct bio *bio); |
361 | extern void bio_check_pages_dirty(struct bio *bio); | 371 | extern void bio_check_pages_dirty(struct bio *bio); |
362 | extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int); | 372 | extern struct bio *bio_copy_user(struct request_queue *, struct rq_map_data *, |
363 | extern struct bio *bio_copy_user_iov(struct request_queue *, struct sg_iovec *, | 373 | unsigned long, unsigned int, int, gfp_t); |
364 | int, int); | 374 | extern struct bio *bio_copy_user_iov(struct request_queue *, |
375 | struct rq_map_data *, struct sg_iovec *, | ||
376 | int, int, gfp_t); | ||
365 | extern int bio_uncopy_user(struct bio *); | 377 | extern int bio_uncopy_user(struct bio *); |
366 | void zero_fill_bio(struct bio *bio); | 378 | void zero_fill_bio(struct bio *bio); |
367 | extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *); | 379 | extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *); |
368 | extern unsigned int bvec_nr_vecs(unsigned short idx); | 380 | extern unsigned int bvec_nr_vecs(unsigned short idx); |
369 | 381 | ||
370 | /* | 382 | /* |
383 | * Allow queuer to specify a completion CPU for this bio | ||
384 | */ | ||
385 | static inline void bio_set_completion_cpu(struct bio *bio, unsigned int cpu) | ||
386 | { | ||
387 | bio->bi_comp_cpu = cpu; | ||
388 | } | ||
389 | |||
390 | /* | ||
371 | * bio_set is used to allow other portions of the IO system to | 391 | * bio_set is used to allow other portions of the IO system to |
372 | * allocate their own private memory pools for bio and iovec structures. | 392 | * allocate their own private memory pools for bio and iovec structures. |
373 | * These memory pools in turn all allocate from the bio_slab | 393 | * These memory pools in turn all allocate from the bio_slab |
@@ -445,6 +465,14 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx, | |||
445 | __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) | 465 | __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) |
446 | #define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) | 466 | #define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) |
447 | 467 | ||
468 | /* | ||
469 | * Check whether this bio carries any data or not. A NULL bio is allowed. | ||
470 | */ | ||
471 | static inline int bio_has_data(struct bio *bio) | ||
472 | { | ||
473 | return bio && bio->bi_io_vec != NULL; | ||
474 | } | ||
475 | |||
448 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | 476 | #if defined(CONFIG_BLK_DEV_INTEGRITY) |
449 | 477 | ||
450 | #define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)])) | 478 | #define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)])) |
@@ -458,14 +486,7 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx, | |||
458 | #define bip_for_each_vec(bvl, bip, i) \ | 486 | #define bip_for_each_vec(bvl, bip, i) \ |
459 | __bip_for_each_vec(bvl, bip, i, (bip)->bip_idx) | 487 | __bip_for_each_vec(bvl, bip, i, (bip)->bip_idx) |
460 | 488 | ||
461 | static inline int bio_integrity(struct bio *bio) | 489 | #define bio_integrity(bio) (bio->bi_integrity != NULL) |
462 | { | ||
463 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | ||
464 | return bio->bi_integrity != NULL; | ||
465 | #else | ||
466 | return 0; | ||
467 | #endif | ||
468 | } | ||
469 | 490 | ||
470 | extern struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *, gfp_t, unsigned int, struct bio_set *); | 491 | extern struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *, gfp_t, unsigned int, struct bio_set *); |
471 | extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); | 492 | extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); |
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 89781fd48859..a08c33a26ca9 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h | |||
@@ -110,7 +110,6 @@ extern int __bitmap_weight(const unsigned long *bitmap, int bits); | |||
110 | 110 | ||
111 | extern int bitmap_scnprintf(char *buf, unsigned int len, | 111 | extern int bitmap_scnprintf(char *buf, unsigned int len, |
112 | const unsigned long *src, int nbits); | 112 | const unsigned long *src, int nbits); |
113 | extern int bitmap_scnprintf_len(unsigned int nr_bits); | ||
114 | extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user, | 113 | extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user, |
115 | unsigned long *dst, int nbits); | 114 | unsigned long *dst, int nbits); |
116 | extern int bitmap_parse_user(const char __user *ubuf, unsigned int ulen, | 115 | extern int bitmap_parse_user(const char __user *ubuf, unsigned int ulen, |
@@ -130,6 +129,7 @@ extern void bitmap_fold(unsigned long *dst, const unsigned long *orig, | |||
130 | extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order); | 129 | extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order); |
131 | extern void bitmap_release_region(unsigned long *bitmap, int pos, int order); | 130 | extern void bitmap_release_region(unsigned long *bitmap, int pos, int order); |
132 | extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order); | 131 | extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order); |
132 | extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits); | ||
133 | 133 | ||
134 | #define BITMAP_LAST_WORD_MASK(nbits) \ | 134 | #define BITMAP_LAST_WORD_MASK(nbits) \ |
135 | ( \ | 135 | ( \ |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 53ea933cf60b..a135256b272c 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -16,7 +16,9 @@ | |||
16 | #include <linux/bio.h> | 16 | #include <linux/bio.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/stringify.h> | 18 | #include <linux/stringify.h> |
19 | #include <linux/gfp.h> | ||
19 | #include <linux/bsg.h> | 20 | #include <linux/bsg.h> |
21 | #include <linux/smp.h> | ||
20 | 22 | ||
21 | #include <asm/scatterlist.h> | 23 | #include <asm/scatterlist.h> |
22 | 24 | ||
@@ -54,7 +56,6 @@ enum rq_cmd_type_bits { | |||
54 | REQ_TYPE_PM_SUSPEND, /* suspend request */ | 56 | REQ_TYPE_PM_SUSPEND, /* suspend request */ |
55 | REQ_TYPE_PM_RESUME, /* resume request */ | 57 | REQ_TYPE_PM_RESUME, /* resume request */ |
56 | REQ_TYPE_PM_SHUTDOWN, /* shutdown request */ | 58 | REQ_TYPE_PM_SHUTDOWN, /* shutdown request */ |
57 | REQ_TYPE_FLUSH, /* flush request */ | ||
58 | REQ_TYPE_SPECIAL, /* driver defined type */ | 59 | REQ_TYPE_SPECIAL, /* driver defined type */ |
59 | REQ_TYPE_LINUX_BLOCK, /* generic block layer message */ | 60 | REQ_TYPE_LINUX_BLOCK, /* generic block layer message */ |
60 | /* | 61 | /* |
@@ -76,19 +77,20 @@ enum rq_cmd_type_bits { | |||
76 | * | 77 | * |
77 | */ | 78 | */ |
78 | enum { | 79 | enum { |
79 | /* | ||
80 | * just examples for now | ||
81 | */ | ||
82 | REQ_LB_OP_EJECT = 0x40, /* eject request */ | 80 | REQ_LB_OP_EJECT = 0x40, /* eject request */ |
83 | REQ_LB_OP_FLUSH = 0x41, /* flush device */ | 81 | REQ_LB_OP_FLUSH = 0x41, /* flush request */ |
82 | REQ_LB_OP_DISCARD = 0x42, /* discard sectors */ | ||
84 | }; | 83 | }; |
85 | 84 | ||
86 | /* | 85 | /* |
87 | * request type modified bits. first three bits match BIO_RW* bits, important | 86 | * request type modified bits. first two bits match BIO_RW* bits, important |
88 | */ | 87 | */ |
89 | enum rq_flag_bits { | 88 | enum rq_flag_bits { |
90 | __REQ_RW, /* not set, read. set, write */ | 89 | __REQ_RW, /* not set, read. set, write */ |
91 | __REQ_FAILFAST, /* no low level driver retries */ | 90 | __REQ_FAILFAST_DEV, /* no driver retries of device errors */ |
91 | __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */ | ||
92 | __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */ | ||
93 | __REQ_DISCARD, /* request to discard sectors */ | ||
92 | __REQ_SORTED, /* elevator knows about this request */ | 94 | __REQ_SORTED, /* elevator knows about this request */ |
93 | __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ | 95 | __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ |
94 | __REQ_HARDBARRIER, /* may not be passed by drive either */ | 96 | __REQ_HARDBARRIER, /* may not be passed by drive either */ |
@@ -111,7 +113,10 @@ enum rq_flag_bits { | |||
111 | }; | 113 | }; |
112 | 114 | ||
113 | #define REQ_RW (1 << __REQ_RW) | 115 | #define REQ_RW (1 << __REQ_RW) |
114 | #define REQ_FAILFAST (1 << __REQ_FAILFAST) | 116 | #define REQ_FAILFAST_DEV (1 << __REQ_FAILFAST_DEV) |
117 | #define REQ_FAILFAST_TRANSPORT (1 << __REQ_FAILFAST_TRANSPORT) | ||
118 | #define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER) | ||
119 | #define REQ_DISCARD (1 << __REQ_DISCARD) | ||
115 | #define REQ_SORTED (1 << __REQ_SORTED) | 120 | #define REQ_SORTED (1 << __REQ_SORTED) |
116 | #define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER) | 121 | #define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER) |
117 | #define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER) | 122 | #define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER) |
@@ -140,12 +145,14 @@ enum rq_flag_bits { | |||
140 | */ | 145 | */ |
141 | struct request { | 146 | struct request { |
142 | struct list_head queuelist; | 147 | struct list_head queuelist; |
143 | struct list_head donelist; | 148 | struct call_single_data csd; |
149 | int cpu; | ||
144 | 150 | ||
145 | struct request_queue *q; | 151 | struct request_queue *q; |
146 | 152 | ||
147 | unsigned int cmd_flags; | 153 | unsigned int cmd_flags; |
148 | enum rq_cmd_type_bits cmd_type; | 154 | enum rq_cmd_type_bits cmd_type; |
155 | unsigned long atomic_flags; | ||
149 | 156 | ||
150 | /* Maintain bio traversal state for part by part I/O submission. | 157 | /* Maintain bio traversal state for part by part I/O submission. |
151 | * hard_* are block layer internals, no driver should touch them! | 158 | * hard_* are block layer internals, no driver should touch them! |
@@ -190,13 +197,6 @@ struct request { | |||
190 | */ | 197 | */ |
191 | unsigned short nr_phys_segments; | 198 | unsigned short nr_phys_segments; |
192 | 199 | ||
193 | /* Number of scatter-gather addr+len pairs after | ||
194 | * physical and DMA remapping hardware coalescing is performed. | ||
195 | * This is the number of scatter-gather entries the driver | ||
196 | * will actually have to deal with after DMA mapping is done. | ||
197 | */ | ||
198 | unsigned short nr_hw_segments; | ||
199 | |||
200 | unsigned short ioprio; | 200 | unsigned short ioprio; |
201 | 201 | ||
202 | void *special; | 202 | void *special; |
@@ -220,6 +220,8 @@ struct request { | |||
220 | void *data; | 220 | void *data; |
221 | void *sense; | 221 | void *sense; |
222 | 222 | ||
223 | unsigned long deadline; | ||
224 | struct list_head timeout_list; | ||
223 | unsigned int timeout; | 225 | unsigned int timeout; |
224 | int retries; | 226 | int retries; |
225 | 227 | ||
@@ -233,6 +235,11 @@ struct request { | |||
233 | struct request *next_rq; | 235 | struct request *next_rq; |
234 | }; | 236 | }; |
235 | 237 | ||
238 | static inline unsigned short req_get_ioprio(struct request *req) | ||
239 | { | ||
240 | return req->ioprio; | ||
241 | } | ||
242 | |||
236 | /* | 243 | /* |
237 | * State information carried for REQ_TYPE_PM_SUSPEND and REQ_TYPE_PM_RESUME | 244 | * State information carried for REQ_TYPE_PM_SUSPEND and REQ_TYPE_PM_RESUME |
238 | * requests. Some step values could eventually be made generic. | 245 | * requests. Some step values could eventually be made generic. |
@@ -252,6 +259,7 @@ typedef void (request_fn_proc) (struct request_queue *q); | |||
252 | typedef int (make_request_fn) (struct request_queue *q, struct bio *bio); | 259 | typedef int (make_request_fn) (struct request_queue *q, struct bio *bio); |
253 | typedef int (prep_rq_fn) (struct request_queue *, struct request *); | 260 | typedef int (prep_rq_fn) (struct request_queue *, struct request *); |
254 | typedef void (unplug_fn) (struct request_queue *); | 261 | typedef void (unplug_fn) (struct request_queue *); |
262 | typedef int (prepare_discard_fn) (struct request_queue *, struct request *); | ||
255 | 263 | ||
256 | struct bio_vec; | 264 | struct bio_vec; |
257 | struct bvec_merge_data { | 265 | struct bvec_merge_data { |
@@ -265,6 +273,15 @@ typedef int (merge_bvec_fn) (struct request_queue *, struct bvec_merge_data *, | |||
265 | typedef void (prepare_flush_fn) (struct request_queue *, struct request *); | 273 | typedef void (prepare_flush_fn) (struct request_queue *, struct request *); |
266 | typedef void (softirq_done_fn)(struct request *); | 274 | typedef void (softirq_done_fn)(struct request *); |
267 | typedef int (dma_drain_needed_fn)(struct request *); | 275 | typedef int (dma_drain_needed_fn)(struct request *); |
276 | typedef int (lld_busy_fn) (struct request_queue *q); | ||
277 | |||
278 | enum blk_eh_timer_return { | ||
279 | BLK_EH_NOT_HANDLED, | ||
280 | BLK_EH_HANDLED, | ||
281 | BLK_EH_RESET_TIMER, | ||
282 | }; | ||
283 | |||
284 | typedef enum blk_eh_timer_return (rq_timed_out_fn)(struct request *); | ||
268 | 285 | ||
269 | enum blk_queue_state { | 286 | enum blk_queue_state { |
270 | Queue_down, | 287 | Queue_down, |
@@ -307,10 +324,13 @@ struct request_queue | |||
307 | make_request_fn *make_request_fn; | 324 | make_request_fn *make_request_fn; |
308 | prep_rq_fn *prep_rq_fn; | 325 | prep_rq_fn *prep_rq_fn; |
309 | unplug_fn *unplug_fn; | 326 | unplug_fn *unplug_fn; |
327 | prepare_discard_fn *prepare_discard_fn; | ||
310 | merge_bvec_fn *merge_bvec_fn; | 328 | merge_bvec_fn *merge_bvec_fn; |
311 | prepare_flush_fn *prepare_flush_fn; | 329 | prepare_flush_fn *prepare_flush_fn; |
312 | softirq_done_fn *softirq_done_fn; | 330 | softirq_done_fn *softirq_done_fn; |
331 | rq_timed_out_fn *rq_timed_out_fn; | ||
313 | dma_drain_needed_fn *dma_drain_needed; | 332 | dma_drain_needed_fn *dma_drain_needed; |
333 | lld_busy_fn *lld_busy_fn; | ||
314 | 334 | ||
315 | /* | 335 | /* |
316 | * Dispatch queue sorting | 336 | * Dispatch queue sorting |
@@ -385,6 +405,10 @@ struct request_queue | |||
385 | unsigned int nr_sorted; | 405 | unsigned int nr_sorted; |
386 | unsigned int in_flight; | 406 | unsigned int in_flight; |
387 | 407 | ||
408 | unsigned int rq_timeout; | ||
409 | struct timer_list timeout; | ||
410 | struct list_head timeout_list; | ||
411 | |||
388 | /* | 412 | /* |
389 | * sg stuff | 413 | * sg stuff |
390 | */ | 414 | */ |
@@ -421,6 +445,10 @@ struct request_queue | |||
421 | #define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */ | 445 | #define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */ |
422 | #define QUEUE_FLAG_BIDI 9 /* queue supports bidi requests */ | 446 | #define QUEUE_FLAG_BIDI 9 /* queue supports bidi requests */ |
423 | #define QUEUE_FLAG_NOMERGES 10 /* disable merge attempts */ | 447 | #define QUEUE_FLAG_NOMERGES 10 /* disable merge attempts */ |
448 | #define QUEUE_FLAG_SAME_COMP 11 /* force complete on same CPU */ | ||
449 | #define QUEUE_FLAG_FAIL_IO 12 /* fake timeout */ | ||
450 | #define QUEUE_FLAG_STACKABLE 13 /* supports request stacking */ | ||
451 | #define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */ | ||
424 | 452 | ||
425 | static inline int queue_is_locked(struct request_queue *q) | 453 | static inline int queue_is_locked(struct request_queue *q) |
426 | { | 454 | { |
@@ -526,26 +554,36 @@ enum { | |||
526 | #define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) | 554 | #define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) |
527 | #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) | 555 | #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) |
528 | #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) | 556 | #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) |
557 | #define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) | ||
529 | #define blk_queue_flushing(q) ((q)->ordseq) | 558 | #define blk_queue_flushing(q) ((q)->ordseq) |
559 | #define blk_queue_stackable(q) \ | ||
560 | test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags) | ||
530 | 561 | ||
531 | #define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) | 562 | #define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) |
532 | #define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC) | 563 | #define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC) |
533 | #define blk_special_request(rq) ((rq)->cmd_type == REQ_TYPE_SPECIAL) | 564 | #define blk_special_request(rq) ((rq)->cmd_type == REQ_TYPE_SPECIAL) |
534 | #define blk_sense_request(rq) ((rq)->cmd_type == REQ_TYPE_SENSE) | 565 | #define blk_sense_request(rq) ((rq)->cmd_type == REQ_TYPE_SENSE) |
535 | 566 | ||
536 | #define blk_noretry_request(rq) ((rq)->cmd_flags & REQ_FAILFAST) | 567 | #define blk_failfast_dev(rq) ((rq)->cmd_flags & REQ_FAILFAST_DEV) |
568 | #define blk_failfast_transport(rq) ((rq)->cmd_flags & REQ_FAILFAST_TRANSPORT) | ||
569 | #define blk_failfast_driver(rq) ((rq)->cmd_flags & REQ_FAILFAST_DRIVER) | ||
570 | #define blk_noretry_request(rq) (blk_failfast_dev(rq) || \ | ||
571 | blk_failfast_transport(rq) || \ | ||
572 | blk_failfast_driver(rq)) | ||
537 | #define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED) | 573 | #define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED) |
538 | 574 | ||
539 | #define blk_account_rq(rq) (blk_rq_started(rq) && blk_fs_request(rq)) | 575 | #define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq))) |
540 | 576 | ||
541 | #define blk_pm_suspend_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND) | 577 | #define blk_pm_suspend_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND) |
542 | #define blk_pm_resume_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_RESUME) | 578 | #define blk_pm_resume_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_RESUME) |
543 | #define blk_pm_request(rq) \ | 579 | #define blk_pm_request(rq) \ |
544 | (blk_pm_suspend_request(rq) || blk_pm_resume_request(rq)) | 580 | (blk_pm_suspend_request(rq) || blk_pm_resume_request(rq)) |
545 | 581 | ||
582 | #define blk_rq_cpu_valid(rq) ((rq)->cpu != -1) | ||
546 | #define blk_sorted_rq(rq) ((rq)->cmd_flags & REQ_SORTED) | 583 | #define blk_sorted_rq(rq) ((rq)->cmd_flags & REQ_SORTED) |
547 | #define blk_barrier_rq(rq) ((rq)->cmd_flags & REQ_HARDBARRIER) | 584 | #define blk_barrier_rq(rq) ((rq)->cmd_flags & REQ_HARDBARRIER) |
548 | #define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA) | 585 | #define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA) |
586 | #define blk_discard_rq(rq) ((rq)->cmd_flags & REQ_DISCARD) | ||
549 | #define blk_bidi_rq(rq) ((rq)->next_rq != NULL) | 587 | #define blk_bidi_rq(rq) ((rq)->next_rq != NULL) |
550 | #define blk_empty_barrier(rq) (blk_barrier_rq(rq) && blk_fs_request(rq) && !(rq)->hard_nr_sectors) | 588 | #define blk_empty_barrier(rq) (blk_barrier_rq(rq) && blk_fs_request(rq) && !(rq)->hard_nr_sectors) |
551 | /* rq->queuelist of dequeued request must be list_empty() */ | 589 | /* rq->queuelist of dequeued request must be list_empty() */ |
@@ -592,7 +630,8 @@ static inline void blk_clear_queue_full(struct request_queue *q, int rw) | |||
592 | #define RQ_NOMERGE_FLAGS \ | 630 | #define RQ_NOMERGE_FLAGS \ |
593 | (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER) | 631 | (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER) |
594 | #define rq_mergeable(rq) \ | 632 | #define rq_mergeable(rq) \ |
595 | (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && blk_fs_request((rq))) | 633 | (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \ |
634 | (blk_discard_rq(rq) || blk_fs_request((rq)))) | ||
596 | 635 | ||
597 | /* | 636 | /* |
598 | * q->prep_rq_fn return values | 637 | * q->prep_rq_fn return values |
@@ -637,6 +676,12 @@ static inline void blk_queue_bounce(struct request_queue *q, struct bio **bio) | |||
637 | } | 676 | } |
638 | #endif /* CONFIG_MMU */ | 677 | #endif /* CONFIG_MMU */ |
639 | 678 | ||
679 | struct rq_map_data { | ||
680 | struct page **pages; | ||
681 | int page_order; | ||
682 | int nr_entries; | ||
683 | }; | ||
684 | |||
640 | struct req_iterator { | 685 | struct req_iterator { |
641 | int i; | 686 | int i; |
642 | struct bio *bio; | 687 | struct bio *bio; |
@@ -664,14 +709,18 @@ extern void __blk_put_request(struct request_queue *, struct request *); | |||
664 | extern struct request *blk_get_request(struct request_queue *, int, gfp_t); | 709 | extern struct request *blk_get_request(struct request_queue *, int, gfp_t); |
665 | extern void blk_insert_request(struct request_queue *, struct request *, int, void *); | 710 | extern void blk_insert_request(struct request_queue *, struct request *, int, void *); |
666 | extern void blk_requeue_request(struct request_queue *, struct request *); | 711 | extern void blk_requeue_request(struct request_queue *, struct request *); |
712 | extern int blk_rq_check_limits(struct request_queue *q, struct request *rq); | ||
713 | extern int blk_lld_busy(struct request_queue *q); | ||
714 | extern int blk_insert_cloned_request(struct request_queue *q, | ||
715 | struct request *rq); | ||
667 | extern void blk_plug_device(struct request_queue *); | 716 | extern void blk_plug_device(struct request_queue *); |
668 | extern void blk_plug_device_unlocked(struct request_queue *); | 717 | extern void blk_plug_device_unlocked(struct request_queue *); |
669 | extern int blk_remove_plug(struct request_queue *); | 718 | extern int blk_remove_plug(struct request_queue *); |
670 | extern void blk_recount_segments(struct request_queue *, struct bio *); | 719 | extern void blk_recount_segments(struct request_queue *, struct bio *); |
671 | extern int scsi_cmd_ioctl(struct file *, struct request_queue *, | 720 | extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t, |
672 | struct gendisk *, unsigned int, void __user *); | 721 | unsigned int, void __user *); |
673 | extern int sg_scsi_ioctl(struct file *, struct request_queue *, | 722 | extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, |
674 | struct gendisk *, struct scsi_ioctl_command __user *); | 723 | struct scsi_ioctl_command __user *); |
675 | 724 | ||
676 | /* | 725 | /* |
677 | * Temporary export, until SCSI gets fixed up. | 726 | * Temporary export, until SCSI gets fixed up. |
@@ -705,11 +754,14 @@ extern void __blk_stop_queue(struct request_queue *q); | |||
705 | extern void __blk_run_queue(struct request_queue *); | 754 | extern void __blk_run_queue(struct request_queue *); |
706 | extern void blk_run_queue(struct request_queue *); | 755 | extern void blk_run_queue(struct request_queue *); |
707 | extern void blk_start_queueing(struct request_queue *); | 756 | extern void blk_start_queueing(struct request_queue *); |
708 | extern int blk_rq_map_user(struct request_queue *, struct request *, void __user *, unsigned long); | 757 | extern int blk_rq_map_user(struct request_queue *, struct request *, |
758 | struct rq_map_data *, void __user *, unsigned long, | ||
759 | gfp_t); | ||
709 | extern int blk_rq_unmap_user(struct bio *); | 760 | extern int blk_rq_unmap_user(struct bio *); |
710 | extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, unsigned int, gfp_t); | 761 | extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, unsigned int, gfp_t); |
711 | extern int blk_rq_map_user_iov(struct request_queue *, struct request *, | 762 | extern int blk_rq_map_user_iov(struct request_queue *, struct request *, |
712 | struct sg_iovec *, int, unsigned int); | 763 | struct rq_map_data *, struct sg_iovec *, int, |
764 | unsigned int, gfp_t); | ||
713 | extern int blk_execute_rq(struct request_queue *, struct gendisk *, | 765 | extern int blk_execute_rq(struct request_queue *, struct gendisk *, |
714 | struct request *, int); | 766 | struct request *, int); |
715 | extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, | 767 | extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, |
@@ -750,12 +802,15 @@ extern int __blk_end_request(struct request *rq, int error, | |||
750 | extern int blk_end_bidi_request(struct request *rq, int error, | 802 | extern int blk_end_bidi_request(struct request *rq, int error, |
751 | unsigned int nr_bytes, unsigned int bidi_bytes); | 803 | unsigned int nr_bytes, unsigned int bidi_bytes); |
752 | extern void end_request(struct request *, int); | 804 | extern void end_request(struct request *, int); |
753 | extern void end_queued_request(struct request *, int); | ||
754 | extern void end_dequeued_request(struct request *, int); | ||
755 | extern int blk_end_request_callback(struct request *rq, int error, | 805 | extern int blk_end_request_callback(struct request *rq, int error, |
756 | unsigned int nr_bytes, | 806 | unsigned int nr_bytes, |
757 | int (drv_callback)(struct request *)); | 807 | int (drv_callback)(struct request *)); |
758 | extern void blk_complete_request(struct request *); | 808 | extern void blk_complete_request(struct request *); |
809 | extern void __blk_complete_request(struct request *); | ||
810 | extern void blk_abort_request(struct request *); | ||
811 | extern void blk_abort_queue(struct request_queue *); | ||
812 | extern void blk_update_request(struct request *rq, int error, | ||
813 | unsigned int nr_bytes); | ||
759 | 814 | ||
760 | /* | 815 | /* |
761 | * blk_end_request() takes bytes instead of sectors as a complete size. | 816 | * blk_end_request() takes bytes instead of sectors as a complete size. |
@@ -790,12 +845,16 @@ extern void blk_queue_update_dma_pad(struct request_queue *, unsigned int); | |||
790 | extern int blk_queue_dma_drain(struct request_queue *q, | 845 | extern int blk_queue_dma_drain(struct request_queue *q, |
791 | dma_drain_needed_fn *dma_drain_needed, | 846 | dma_drain_needed_fn *dma_drain_needed, |
792 | void *buf, unsigned int size); | 847 | void *buf, unsigned int size); |
848 | extern void blk_queue_lld_busy(struct request_queue *q, lld_busy_fn *fn); | ||
793 | extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); | 849 | extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); |
794 | extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn); | 850 | extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn); |
795 | extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *); | 851 | extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *); |
796 | extern void blk_queue_dma_alignment(struct request_queue *, int); | 852 | extern void blk_queue_dma_alignment(struct request_queue *, int); |
797 | extern void blk_queue_update_dma_alignment(struct request_queue *, int); | 853 | extern void blk_queue_update_dma_alignment(struct request_queue *, int); |
798 | extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *); | 854 | extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *); |
855 | extern void blk_queue_set_discard(struct request_queue *, prepare_discard_fn *); | ||
856 | extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *); | ||
857 | extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); | ||
799 | extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); | 858 | extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); |
800 | extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); | 859 | extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); |
801 | extern int blk_do_ordered(struct request_queue *, struct request **); | 860 | extern int blk_do_ordered(struct request_queue *, struct request **); |
@@ -806,7 +865,6 @@ extern void blk_ordered_complete_seq(struct request_queue *, unsigned, int); | |||
806 | extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *); | 865 | extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *); |
807 | extern void blk_dump_rq_flags(struct request *, char *); | 866 | extern void blk_dump_rq_flags(struct request *, char *); |
808 | extern void generic_unplug_device(struct request_queue *); | 867 | extern void generic_unplug_device(struct request_queue *); |
809 | extern void __generic_unplug_device(struct request_queue *); | ||
810 | extern long nr_blockdev_pages(void); | 868 | extern long nr_blockdev_pages(void); |
811 | 869 | ||
812 | int blk_get_queue(struct request_queue *); | 870 | int blk_get_queue(struct request_queue *); |
@@ -837,12 +895,23 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt, | |||
837 | } | 895 | } |
838 | 896 | ||
839 | extern int blkdev_issue_flush(struct block_device *, sector_t *); | 897 | extern int blkdev_issue_flush(struct block_device *, sector_t *); |
898 | extern int blkdev_issue_discard(struct block_device *, | ||
899 | sector_t sector, sector_t nr_sects, gfp_t); | ||
900 | |||
901 | static inline int sb_issue_discard(struct super_block *sb, | ||
902 | sector_t block, sector_t nr_blocks) | ||
903 | { | ||
904 | block <<= (sb->s_blocksize_bits - 9); | ||
905 | nr_blocks <<= (sb->s_blocksize_bits - 9); | ||
906 | return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_KERNEL); | ||
907 | } | ||
840 | 908 | ||
841 | /* | 909 | /* |
842 | * command filter functions | 910 | * command filter functions |
843 | */ | 911 | */ |
844 | extern int blk_verify_command(struct blk_cmd_filter *filter, | 912 | extern int blk_verify_command(struct blk_cmd_filter *filter, |
845 | unsigned char *cmd, int has_write_perm); | 913 | unsigned char *cmd, fmode_t has_write_perm); |
914 | extern void blk_unregister_filter(struct gendisk *disk); | ||
846 | extern void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter); | 915 | extern void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter); |
847 | 916 | ||
848 | #define MAX_PHYS_SEGMENTS 128 | 917 | #define MAX_PHYS_SEGMENTS 128 |
@@ -874,6 +943,13 @@ static inline int queue_dma_alignment(struct request_queue *q) | |||
874 | return q ? q->dma_alignment : 511; | 943 | return q ? q->dma_alignment : 511; |
875 | } | 944 | } |
876 | 945 | ||
946 | static inline int blk_rq_aligned(struct request_queue *q, void *addr, | ||
947 | unsigned int len) | ||
948 | { | ||
949 | unsigned int alignment = queue_dma_alignment(q) | q->dma_pad_mask; | ||
950 | return !((unsigned long)addr & alignment) && !(len & alignment); | ||
951 | } | ||
952 | |||
877 | /* assumes size > 256 */ | 953 | /* assumes size > 256 */ |
878 | static inline unsigned int blksize_bits(unsigned int size) | 954 | static inline unsigned int blksize_bits(unsigned int size) |
879 | { | 955 | { |
@@ -900,7 +976,7 @@ static inline void put_dev_sector(Sector p) | |||
900 | } | 976 | } |
901 | 977 | ||
902 | struct work_struct; | 978 | struct work_struct; |
903 | int kblockd_schedule_work(struct work_struct *work); | 979 | int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); |
904 | void kblockd_flush_work(struct work_struct *work); | 980 | void kblockd_flush_work(struct work_struct *work); |
905 | 981 | ||
906 | #define MODULE_ALIAS_BLOCKDEV(major,minor) \ | 982 | #define MODULE_ALIAS_BLOCKDEV(major,minor) \ |
@@ -945,49 +1021,19 @@ struct blk_integrity { | |||
945 | 1021 | ||
946 | extern int blk_integrity_register(struct gendisk *, struct blk_integrity *); | 1022 | extern int blk_integrity_register(struct gendisk *, struct blk_integrity *); |
947 | extern void blk_integrity_unregister(struct gendisk *); | 1023 | extern void blk_integrity_unregister(struct gendisk *); |
948 | extern int blk_integrity_compare(struct block_device *, struct block_device *); | 1024 | extern int blk_integrity_compare(struct gendisk *, struct gendisk *); |
949 | extern int blk_rq_map_integrity_sg(struct request *, struct scatterlist *); | 1025 | extern int blk_rq_map_integrity_sg(struct request *, struct scatterlist *); |
950 | extern int blk_rq_count_integrity_sg(struct request *); | 1026 | extern int blk_rq_count_integrity_sg(struct request *); |
951 | 1027 | ||
952 | static inline unsigned short blk_integrity_tuple_size(struct blk_integrity *bi) | 1028 | static inline |
953 | { | 1029 | struct blk_integrity *bdev_get_integrity(struct block_device *bdev) |
954 | if (bi) | ||
955 | return bi->tuple_size; | ||
956 | |||
957 | return 0; | ||
958 | } | ||
959 | |||
960 | static inline struct blk_integrity *bdev_get_integrity(struct block_device *bdev) | ||
961 | { | 1030 | { |
962 | return bdev->bd_disk->integrity; | 1031 | return bdev->bd_disk->integrity; |
963 | } | 1032 | } |
964 | 1033 | ||
965 | static inline unsigned int bdev_get_tag_size(struct block_device *bdev) | 1034 | static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk) |
966 | { | ||
967 | struct blk_integrity *bi = bdev_get_integrity(bdev); | ||
968 | |||
969 | if (bi) | ||
970 | return bi->tag_size; | ||
971 | |||
972 | return 0; | ||
973 | } | ||
974 | |||
975 | static inline int bdev_integrity_enabled(struct block_device *bdev, int rw) | ||
976 | { | 1035 | { |
977 | struct blk_integrity *bi = bdev_get_integrity(bdev); | 1036 | return disk->integrity; |
978 | |||
979 | if (bi == NULL) | ||
980 | return 0; | ||
981 | |||
982 | if (rw == READ && bi->verify_fn != NULL && | ||
983 | (bi->flags & INTEGRITY_FLAG_READ)) | ||
984 | return 1; | ||
985 | |||
986 | if (rw == WRITE && bi->generate_fn != NULL && | ||
987 | (bi->flags & INTEGRITY_FLAG_WRITE)) | ||
988 | return 1; | ||
989 | |||
990 | return 0; | ||
991 | } | 1037 | } |
992 | 1038 | ||
993 | static inline int blk_integrity_rq(struct request *rq) | 1039 | static inline int blk_integrity_rq(struct request *rq) |
@@ -1004,13 +1050,29 @@ static inline int blk_integrity_rq(struct request *rq) | |||
1004 | #define blk_rq_count_integrity_sg(a) (0) | 1050 | #define blk_rq_count_integrity_sg(a) (0) |
1005 | #define blk_rq_map_integrity_sg(a, b) (0) | 1051 | #define blk_rq_map_integrity_sg(a, b) (0) |
1006 | #define bdev_get_integrity(a) (0) | 1052 | #define bdev_get_integrity(a) (0) |
1007 | #define bdev_get_tag_size(a) (0) | 1053 | #define blk_get_integrity(a) (0) |
1008 | #define blk_integrity_compare(a, b) (0) | 1054 | #define blk_integrity_compare(a, b) (0) |
1009 | #define blk_integrity_register(a, b) (0) | 1055 | #define blk_integrity_register(a, b) (0) |
1010 | #define blk_integrity_unregister(a) do { } while (0); | 1056 | #define blk_integrity_unregister(a) do { } while (0); |
1011 | 1057 | ||
1012 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ | 1058 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ |
1013 | 1059 | ||
1060 | struct block_device_operations { | ||
1061 | int (*open) (struct block_device *, fmode_t); | ||
1062 | int (*release) (struct gendisk *, fmode_t); | ||
1063 | int (*locked_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | ||
1064 | int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | ||
1065 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | ||
1066 | int (*direct_access) (struct block_device *, sector_t, | ||
1067 | void **, unsigned long *); | ||
1068 | int (*media_changed) (struct gendisk *); | ||
1069 | int (*revalidate_disk) (struct gendisk *); | ||
1070 | int (*getgeo)(struct block_device *, struct hd_geometry *); | ||
1071 | struct module *owner; | ||
1072 | }; | ||
1073 | |||
1074 | extern int __blkdev_driver_ioctl(struct block_device *, fmode_t, unsigned int, | ||
1075 | unsigned long); | ||
1014 | #else /* CONFIG_BLOCK */ | 1076 | #else /* CONFIG_BLOCK */ |
1015 | /* | 1077 | /* |
1016 | * stubs for when the block layer is configured out | 1078 | * stubs for when the block layer is configured out |
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index d084b8d227a5..bdf505d33e77 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h | |||
@@ -1,8 +1,10 @@ | |||
1 | #ifndef BLKTRACE_H | 1 | #ifndef BLKTRACE_H |
2 | #define BLKTRACE_H | 2 | #define BLKTRACE_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | ||
4 | #include <linux/blkdev.h> | 5 | #include <linux/blkdev.h> |
5 | #include <linux/relay.h> | 6 | #include <linux/relay.h> |
7 | #endif | ||
6 | 8 | ||
7 | /* | 9 | /* |
8 | * Trace categories | 10 | * Trace categories |
@@ -21,6 +23,8 @@ enum blktrace_cat { | |||
21 | BLK_TC_NOTIFY = 1 << 10, /* special message */ | 23 | BLK_TC_NOTIFY = 1 << 10, /* special message */ |
22 | BLK_TC_AHEAD = 1 << 11, /* readahead */ | 24 | BLK_TC_AHEAD = 1 << 11, /* readahead */ |
23 | BLK_TC_META = 1 << 12, /* metadata */ | 25 | BLK_TC_META = 1 << 12, /* metadata */ |
26 | BLK_TC_DISCARD = 1 << 13, /* discard requests */ | ||
27 | BLK_TC_DRV_DATA = 1 << 14, /* binary per-driver data */ | ||
24 | 28 | ||
25 | BLK_TC_END = 1 << 15, /* only 16-bits, reminder */ | 29 | BLK_TC_END = 1 << 15, /* only 16-bits, reminder */ |
26 | }; | 30 | }; |
@@ -47,6 +51,8 @@ enum blktrace_act { | |||
47 | __BLK_TA_SPLIT, /* bio was split */ | 51 | __BLK_TA_SPLIT, /* bio was split */ |
48 | __BLK_TA_BOUNCE, /* bio was bounced */ | 52 | __BLK_TA_BOUNCE, /* bio was bounced */ |
49 | __BLK_TA_REMAP, /* bio was remapped */ | 53 | __BLK_TA_REMAP, /* bio was remapped */ |
54 | __BLK_TA_ABORT, /* request aborted */ | ||
55 | __BLK_TA_DRV_DATA, /* driver-specific binary data */ | ||
50 | }; | 56 | }; |
51 | 57 | ||
52 | /* | 58 | /* |
@@ -77,6 +83,8 @@ enum blktrace_notify { | |||
77 | #define BLK_TA_SPLIT (__BLK_TA_SPLIT) | 83 | #define BLK_TA_SPLIT (__BLK_TA_SPLIT) |
78 | #define BLK_TA_BOUNCE (__BLK_TA_BOUNCE) | 84 | #define BLK_TA_BOUNCE (__BLK_TA_BOUNCE) |
79 | #define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE)) | 85 | #define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE)) |
86 | #define BLK_TA_ABORT (__BLK_TA_ABORT | BLK_TC_ACT(BLK_TC_QUEUE)) | ||
87 | #define BLK_TA_DRV_DATA (__BLK_TA_DRV_DATA | BLK_TC_ACT(BLK_TC_DRV_DATA)) | ||
80 | 88 | ||
81 | #define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY)) | 89 | #define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY)) |
82 | #define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY)) | 90 | #define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY)) |
@@ -89,17 +97,17 @@ enum blktrace_notify { | |||
89 | * The trace itself | 97 | * The trace itself |
90 | */ | 98 | */ |
91 | struct blk_io_trace { | 99 | struct blk_io_trace { |
92 | u32 magic; /* MAGIC << 8 | version */ | 100 | __u32 magic; /* MAGIC << 8 | version */ |
93 | u32 sequence; /* event number */ | 101 | __u32 sequence; /* event number */ |
94 | u64 time; /* in microseconds */ | 102 | __u64 time; /* in microseconds */ |
95 | u64 sector; /* disk offset */ | 103 | __u64 sector; /* disk offset */ |
96 | u32 bytes; /* transfer length */ | 104 | __u32 bytes; /* transfer length */ |
97 | u32 action; /* what happened */ | 105 | __u32 action; /* what happened */ |
98 | u32 pid; /* who did it */ | 106 | __u32 pid; /* who did it */ |
99 | u32 device; /* device number */ | 107 | __u32 device; /* device number */ |
100 | u32 cpu; /* on what cpu did it happen */ | 108 | __u32 cpu; /* on what cpu did it happen */ |
101 | u16 error; /* completion error */ | 109 | __u16 error; /* completion error */ |
102 | u16 pdu_len; /* length of data after this trace */ | 110 | __u16 pdu_len; /* length of data after this trace */ |
103 | }; | 111 | }; |
104 | 112 | ||
105 | /* | 113 | /* |
@@ -117,6 +125,23 @@ enum { | |||
117 | Blktrace_stopped, | 125 | Blktrace_stopped, |
118 | }; | 126 | }; |
119 | 127 | ||
128 | #define BLKTRACE_BDEV_SIZE 32 | ||
129 | |||
130 | /* | ||
131 | * User setup structure passed with BLKTRACESTART | ||
132 | */ | ||
133 | struct blk_user_trace_setup { | ||
134 | char name[BLKTRACE_BDEV_SIZE]; /* output */ | ||
135 | __u16 act_mask; /* input */ | ||
136 | __u32 buf_size; /* input */ | ||
137 | __u32 buf_nr; /* input */ | ||
138 | __u64 start_lba; | ||
139 | __u64 end_lba; | ||
140 | __u32 pid; | ||
141 | }; | ||
142 | |||
143 | #ifdef __KERNEL__ | ||
144 | #if defined(CONFIG_BLK_DEV_IO_TRACE) | ||
120 | struct blk_trace { | 145 | struct blk_trace { |
121 | int trace_state; | 146 | int trace_state; |
122 | struct rchan *rchan; | 147 | struct rchan *rchan; |
@@ -133,21 +158,6 @@ struct blk_trace { | |||
133 | atomic_t dropped; | 158 | atomic_t dropped; |
134 | }; | 159 | }; |
135 | 160 | ||
136 | /* | ||
137 | * User setup structure passed with BLKTRACESTART | ||
138 | */ | ||
139 | struct blk_user_trace_setup { | ||
140 | char name[BDEVNAME_SIZE]; /* output */ | ||
141 | u16 act_mask; /* input */ | ||
142 | u32 buf_size; /* input */ | ||
143 | u32 buf_nr; /* input */ | ||
144 | u64 start_lba; | ||
145 | u64 end_lba; | ||
146 | u32 pid; | ||
147 | }; | ||
148 | |||
149 | #ifdef __KERNEL__ | ||
150 | #if defined(CONFIG_BLK_DEV_IO_TRACE) | ||
151 | extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *); | 161 | extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *); |
152 | extern void blk_trace_shutdown(struct request_queue *); | 162 | extern void blk_trace_shutdown(struct request_queue *); |
153 | extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *); | 163 | extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *); |
@@ -195,6 +205,9 @@ static inline void blk_add_trace_rq(struct request_queue *q, struct request *rq, | |||
195 | if (likely(!bt)) | 205 | if (likely(!bt)) |
196 | return; | 206 | return; |
197 | 207 | ||
208 | if (blk_discard_rq(rq)) | ||
209 | rw |= (1 << BIO_RW_DISCARD); | ||
210 | |||
198 | if (blk_pc_request(rq)) { | 211 | if (blk_pc_request(rq)) { |
199 | what |= BLK_TC_ACT(BLK_TC_PC); | 212 | what |= BLK_TC_ACT(BLK_TC_PC); |
200 | __blk_add_trace(bt, 0, rq->data_len, rw, what, rq->errors, sizeof(rq->cmd), rq->cmd); | 213 | __blk_add_trace(bt, 0, rq->data_len, rw, what, rq->errors, sizeof(rq->cmd), rq->cmd); |
@@ -307,6 +320,34 @@ static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio, | |||
307 | __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r); | 320 | __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r); |
308 | } | 321 | } |
309 | 322 | ||
323 | /** | ||
324 | * blk_add_driver_data - Add binary message with driver-specific data | ||
325 | * @q: queue the io is for | ||
326 | * @rq: io request | ||
327 | * @data: driver-specific data | ||
328 | * @len: length of driver-specific data | ||
329 | * | ||
330 | * Description: | ||
331 | * Some drivers might want to write driver-specific data per request. | ||
332 | * | ||
333 | **/ | ||
334 | static inline void blk_add_driver_data(struct request_queue *q, | ||
335 | struct request *rq, | ||
336 | void *data, size_t len) | ||
337 | { | ||
338 | struct blk_trace *bt = q->blk_trace; | ||
339 | |||
340 | if (likely(!bt)) | ||
341 | return; | ||
342 | |||
343 | if (blk_pc_request(rq)) | ||
344 | __blk_add_trace(bt, 0, rq->data_len, 0, BLK_TA_DRV_DATA, | ||
345 | rq->errors, len, data); | ||
346 | else | ||
347 | __blk_add_trace(bt, rq->hard_sector, rq->hard_nr_sectors << 9, | ||
348 | 0, BLK_TA_DRV_DATA, rq->errors, len, data); | ||
349 | } | ||
350 | |||
310 | extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev, | 351 | extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev, |
311 | char __user *arg); | 352 | char __user *arg); |
312 | extern int blk_trace_startstop(struct request_queue *q, int start); | 353 | extern int blk_trace_startstop(struct request_queue *q, int start); |
@@ -320,6 +361,7 @@ extern int blk_trace_remove(struct request_queue *q); | |||
320 | #define blk_add_trace_generic(q, rq, rw, what) do { } while (0) | 361 | #define blk_add_trace_generic(q, rq, rw, what) do { } while (0) |
321 | #define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0) | 362 | #define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0) |
322 | #define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0) | 363 | #define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0) |
364 | #define blk_add_driver_data(q, rq, data, len) do {} while (0) | ||
323 | #define do_blk_trace_setup(q, name, dev, buts) (-ENOTTY) | 365 | #define do_blk_trace_setup(q, name, dev, buts) (-ENOTTY) |
324 | #define blk_trace_setup(q, name, dev, arg) (-ENOTTY) | 366 | #define blk_trace_setup(q, name, dev, arg) (-ENOTTY) |
325 | #define blk_trace_startstop(q, start) (-ENOTTY) | 367 | #define blk_trace_startstop(q, start) (-ENOTTY) |
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index eadaab44015f..3ce64b90118c 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h | |||
@@ -322,7 +322,7 @@ static inline void wait_on_buffer(struct buffer_head *bh) | |||
322 | 322 | ||
323 | static inline int trylock_buffer(struct buffer_head *bh) | 323 | static inline int trylock_buffer(struct buffer_head *bh) |
324 | { | 324 | { |
325 | return likely(!test_and_set_bit(BH_Lock, &bh->b_state)); | 325 | return likely(!test_and_set_bit_lock(BH_Lock, &bh->b_state)); |
326 | } | 326 | } |
327 | 327 | ||
328 | static inline void lock_buffer(struct buffer_head *bh) | 328 | static inline void lock_buffer(struct buffer_head *bh) |
diff --git a/include/linux/byteorder/Kbuild b/include/linux/byteorder/Kbuild index 1133d5f9d818..fbaa7f9cee32 100644 --- a/include/linux/byteorder/Kbuild +++ b/include/linux/byteorder/Kbuild | |||
@@ -1,3 +1,4 @@ | |||
1 | unifdef-y += big_endian.h | 1 | unifdef-y += big_endian.h |
2 | unifdef-y += little_endian.h | 2 | unifdef-y += little_endian.h |
3 | unifdef-y += swab.h | 3 | unifdef-y += swab.h |
4 | unifdef-y += swabb.h | ||
diff --git a/include/linux/byteorder/big_endian.h b/include/linux/byteorder/big_endian.h index 44f95b92393b..1cba3f3efe5f 100644 --- a/include/linux/byteorder/big_endian.h +++ b/include/linux/byteorder/big_endian.h | |||
@@ -10,6 +10,7 @@ | |||
10 | 10 | ||
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <linux/byteorder/swab.h> | 12 | #include <linux/byteorder/swab.h> |
13 | #include <linux/byteorder/swabb.h> | ||
13 | 14 | ||
14 | #define __constant_htonl(x) ((__force __be32)(__u32)(x)) | 15 | #define __constant_htonl(x) ((__force __be32)(__u32)(x)) |
15 | #define __constant_ntohl(x) ((__force __u32)(__be32)(x)) | 16 | #define __constant_ntohl(x) ((__force __u32)(__be32)(x)) |
diff --git a/include/linux/byteorder/little_endian.h b/include/linux/byteorder/little_endian.h index 4cc170a31762..cedc1b5a289c 100644 --- a/include/linux/byteorder/little_endian.h +++ b/include/linux/byteorder/little_endian.h | |||
@@ -10,6 +10,7 @@ | |||
10 | 10 | ||
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <linux/byteorder/swab.h> | 12 | #include <linux/byteorder/swab.h> |
13 | #include <linux/byteorder/swabb.h> | ||
13 | 14 | ||
14 | #define __constant_htonl(x) ((__force __be32)___constant_swab32((x))) | 15 | #define __constant_htonl(x) ((__force __be32)___constant_swab32((x))) |
15 | #define __constant_ntohl(x) ___constant_swab32((__force __be32)(x)) | 16 | #define __constant_ntohl(x) ___constant_swab32((__force __be32)(x)) |
diff --git a/include/linux/c2port.h b/include/linux/c2port.h new file mode 100644 index 000000000000..7b5a2388ba67 --- /dev/null +++ b/include/linux/c2port.h | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | * Silicon Labs C2 port Linux support | ||
3 | * | ||
4 | * Copyright (c) 2007 Rodolfo Giometti <giometti@linux.it> | ||
5 | * Copyright (c) 2007 Eurotech S.p.A. <info@eurotech.it> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License version 2 as published by | ||
9 | * the Free Software Foundation | ||
10 | */ | ||
11 | |||
12 | #include <linux/device.h> | ||
13 | |||
14 | #define C2PORT_NAME_LEN 32 | ||
15 | |||
16 | /* | ||
17 | * C2 port basic structs | ||
18 | */ | ||
19 | |||
20 | /* Main struct */ | ||
21 | struct c2port_ops; | ||
22 | struct c2port_device { | ||
23 | unsigned int access:1; | ||
24 | unsigned int flash_access:1; | ||
25 | |||
26 | int id; | ||
27 | char name[C2PORT_NAME_LEN]; | ||
28 | struct c2port_ops *ops; | ||
29 | struct mutex mutex; /* prevent races during read/write */ | ||
30 | |||
31 | struct device *dev; | ||
32 | |||
33 | void *private_data; | ||
34 | }; | ||
35 | |||
36 | /* Basic operations */ | ||
37 | struct c2port_ops { | ||
38 | /* Flash layout */ | ||
39 | unsigned short block_size; /* flash block size in bytes */ | ||
40 | unsigned short blocks_num; /* flash blocks number */ | ||
41 | |||
42 | /* Enable or disable the access to C2 port */ | ||
43 | void (*access)(struct c2port_device *dev, int status); | ||
44 | |||
45 | /* Set C2D data line as input/output */ | ||
46 | void (*c2d_dir)(struct c2port_device *dev, int dir); | ||
47 | |||
48 | /* Read/write C2D data line */ | ||
49 | int (*c2d_get)(struct c2port_device *dev); | ||
50 | void (*c2d_set)(struct c2port_device *dev, int status); | ||
51 | |||
52 | /* Write C2CK clock line */ | ||
53 | void (*c2ck_set)(struct c2port_device *dev, int status); | ||
54 | }; | ||
55 | |||
56 | /* | ||
57 | * Exported functions | ||
58 | */ | ||
59 | |||
60 | #define to_class_dev(obj) container_of((obj), struct class_device, kobj) | ||
61 | #define to_c2port_device(obj) container_of((obj), struct c2port_device, class) | ||
62 | |||
63 | extern struct c2port_device *c2port_device_register(char *name, | ||
64 | struct c2port_ops *ops, void *devdata); | ||
65 | extern void c2port_device_unregister(struct c2port_device *dev); | ||
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index 5db265ea60f6..0b49e08d3cb0 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h | |||
@@ -987,11 +987,11 @@ struct cdrom_device_ops { | |||
987 | }; | 987 | }; |
988 | 988 | ||
989 | /* the general block_device operations structure: */ | 989 | /* the general block_device operations structure: */ |
990 | extern int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip, | 990 | extern int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev, |
991 | struct file *fp); | 991 | fmode_t mode); |
992 | extern int cdrom_release(struct cdrom_device_info *cdi, struct file *fp); | 992 | extern void cdrom_release(struct cdrom_device_info *cdi, fmode_t mode); |
993 | extern int cdrom_ioctl(struct file *file, struct cdrom_device_info *cdi, | 993 | extern int cdrom_ioctl(struct cdrom_device_info *cdi, struct block_device *bdev, |
994 | struct inode *ip, unsigned int cmd, unsigned long arg); | 994 | fmode_t mode, unsigned int cmd, unsigned long arg); |
995 | extern int cdrom_media_changed(struct cdrom_device_info *); | 995 | extern int cdrom_media_changed(struct cdrom_device_info *); |
996 | 996 | ||
997 | extern int register_cdrom(struct cdrom_device_info *cdi); | 997 | extern int register_cdrom(struct cdrom_device_info *cdi); |
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index c98dd7cb7076..1164963c3a85 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -9,12 +9,12 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/sched.h> | 11 | #include <linux/sched.h> |
12 | #include <linux/kref.h> | ||
13 | #include <linux/cpumask.h> | 12 | #include <linux/cpumask.h> |
14 | #include <linux/nodemask.h> | 13 | #include <linux/nodemask.h> |
15 | #include <linux/rcupdate.h> | 14 | #include <linux/rcupdate.h> |
16 | #include <linux/cgroupstats.h> | 15 | #include <linux/cgroupstats.h> |
17 | #include <linux/prio_heap.h> | 16 | #include <linux/prio_heap.h> |
17 | #include <linux/rwsem.h> | ||
18 | 18 | ||
19 | #ifdef CONFIG_CGROUPS | 19 | #ifdef CONFIG_CGROUPS |
20 | 20 | ||
@@ -25,7 +25,6 @@ struct cgroup; | |||
25 | 25 | ||
26 | extern int cgroup_init_early(void); | 26 | extern int cgroup_init_early(void); |
27 | extern int cgroup_init(void); | 27 | extern int cgroup_init(void); |
28 | extern void cgroup_init_smp(void); | ||
29 | extern void cgroup_lock(void); | 28 | extern void cgroup_lock(void); |
30 | extern bool cgroup_lock_live_group(struct cgroup *cgrp); | 29 | extern bool cgroup_lock_live_group(struct cgroup *cgrp); |
31 | extern void cgroup_unlock(void); | 30 | extern void cgroup_unlock(void); |
@@ -137,6 +136,15 @@ struct cgroup { | |||
137 | * release_list_lock | 136 | * release_list_lock |
138 | */ | 137 | */ |
139 | struct list_head release_list; | 138 | struct list_head release_list; |
139 | |||
140 | /* pids_mutex protects the fields below */ | ||
141 | struct rw_semaphore pids_mutex; | ||
142 | /* Array of process ids in the cgroup */ | ||
143 | pid_t *tasks_pids; | ||
144 | /* How many files are using the current tasks_pids array */ | ||
145 | int pids_use_count; | ||
146 | /* Length of the current tasks_pids array */ | ||
147 | int pids_length; | ||
140 | }; | 148 | }; |
141 | 149 | ||
142 | /* A css_set is a structure holding pointers to a set of | 150 | /* A css_set is a structure holding pointers to a set of |
@@ -149,7 +157,7 @@ struct cgroup { | |||
149 | struct css_set { | 157 | struct css_set { |
150 | 158 | ||
151 | /* Reference count */ | 159 | /* Reference count */ |
152 | struct kref ref; | 160 | atomic_t refcount; |
153 | 161 | ||
154 | /* | 162 | /* |
155 | * List running through all cgroup groups in the same hash | 163 | * List running through all cgroup groups in the same hash |
@@ -326,7 +334,8 @@ struct cgroup_subsys { | |||
326 | */ | 334 | */ |
327 | void (*mm_owner_changed)(struct cgroup_subsys *ss, | 335 | void (*mm_owner_changed)(struct cgroup_subsys *ss, |
328 | struct cgroup *old, | 336 | struct cgroup *old, |
329 | struct cgroup *new); | 337 | struct cgroup *new, |
338 | struct task_struct *p); | ||
330 | int subsys_id; | 339 | int subsys_id; |
331 | int active; | 340 | int active; |
332 | int disabled; | 341 | int disabled; |
@@ -338,8 +347,6 @@ struct cgroup_subsys { | |||
338 | struct cgroupfs_root *root; | 347 | struct cgroupfs_root *root; |
339 | 348 | ||
340 | struct list_head sibling; | 349 | struct list_head sibling; |
341 | |||
342 | void *private; | ||
343 | }; | 350 | }; |
344 | 351 | ||
345 | #define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys; | 352 | #define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys; |
@@ -393,11 +400,13 @@ void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it); | |||
393 | int cgroup_scan_tasks(struct cgroup_scanner *scan); | 400 | int cgroup_scan_tasks(struct cgroup_scanner *scan); |
394 | int cgroup_attach_task(struct cgroup *, struct task_struct *); | 401 | int cgroup_attach_task(struct cgroup *, struct task_struct *); |
395 | 402 | ||
403 | void cgroup_mm_owner_callbacks(struct task_struct *old, | ||
404 | struct task_struct *new); | ||
405 | |||
396 | #else /* !CONFIG_CGROUPS */ | 406 | #else /* !CONFIG_CGROUPS */ |
397 | 407 | ||
398 | static inline int cgroup_init_early(void) { return 0; } | 408 | static inline int cgroup_init_early(void) { return 0; } |
399 | static inline int cgroup_init(void) { return 0; } | 409 | static inline int cgroup_init(void) { return 0; } |
400 | static inline void cgroup_init_smp(void) {} | ||
401 | static inline void cgroup_fork(struct task_struct *p) {} | 410 | static inline void cgroup_fork(struct task_struct *p) {} |
402 | static inline void cgroup_fork_callbacks(struct task_struct *p) {} | 411 | static inline void cgroup_fork_callbacks(struct task_struct *p) {} |
403 | static inline void cgroup_post_fork(struct task_struct *p) {} | 412 | static inline void cgroup_post_fork(struct task_struct *p) {} |
@@ -411,15 +420,9 @@ static inline int cgroupstats_build(struct cgroupstats *stats, | |||
411 | return -EINVAL; | 420 | return -EINVAL; |
412 | } | 421 | } |
413 | 422 | ||
423 | static inline void cgroup_mm_owner_callbacks(struct task_struct *old, | ||
424 | struct task_struct *new) {} | ||
425 | |||
414 | #endif /* !CONFIG_CGROUPS */ | 426 | #endif /* !CONFIG_CGROUPS */ |
415 | 427 | ||
416 | #ifdef CONFIG_MM_OWNER | ||
417 | extern void | ||
418 | cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new); | ||
419 | #else /* !CONFIG_MM_OWNER */ | ||
420 | static inline void | ||
421 | cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new) | ||
422 | { | ||
423 | } | ||
424 | #endif /* CONFIG_MM_OWNER */ | ||
425 | #endif /* _LINUX_CGROUP_H */ | 428 | #endif /* _LINUX_CGROUP_H */ |
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h index e2877454ec82..9c22396e8b50 100644 --- a/include/linux/cgroup_subsys.h +++ b/include/linux/cgroup_subsys.h | |||
@@ -48,3 +48,9 @@ SUBSYS(devices) | |||
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | /* */ | 50 | /* */ |
51 | |||
52 | #ifdef CONFIG_CGROUP_FREEZER | ||
53 | SUBSYS(freezer) | ||
54 | #endif | ||
55 | |||
56 | /* */ | ||
diff --git a/include/linux/clk.h b/include/linux/clk.h index 5ca8c6fddb56..778777316ea4 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h | |||
@@ -35,6 +35,8 @@ struct clk; | |||
35 | * clk_get may return different clock producers depending on @dev.) | 35 | * clk_get may return different clock producers depending on @dev.) |
36 | * | 36 | * |
37 | * Drivers must assume that the clock source is not enabled. | 37 | * Drivers must assume that the clock source is not enabled. |
38 | * | ||
39 | * clk_get should not be called from within interrupt context. | ||
38 | */ | 40 | */ |
39 | struct clk *clk_get(struct device *dev, const char *id); | 41 | struct clk *clk_get(struct device *dev, const char *id); |
40 | 42 | ||
@@ -76,6 +78,8 @@ unsigned long clk_get_rate(struct clk *clk); | |||
76 | * Note: drivers must ensure that all clk_enable calls made on this | 78 | * Note: drivers must ensure that all clk_enable calls made on this |
77 | * clock source are balanced by clk_disable calls prior to calling | 79 | * clock source are balanced by clk_disable calls prior to calling |
78 | * this function. | 80 | * this function. |
81 | * | ||
82 | * clk_put should not be called from within interrupt context. | ||
79 | */ | 83 | */ |
80 | void clk_put(struct clk *clk); | 84 | void clk_put(struct clk *clk); |
81 | 85 | ||
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 55e434feec99..f88d32f8ff7c 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
@@ -45,7 +45,8 @@ struct clocksource; | |||
45 | * @read: returns a cycle value | 45 | * @read: returns a cycle value |
46 | * @mask: bitmask for two's complement | 46 | * @mask: bitmask for two's complement |
47 | * subtraction of non 64 bit counters | 47 | * subtraction of non 64 bit counters |
48 | * @mult: cycle to nanosecond multiplier | 48 | * @mult: cycle to nanosecond multiplier (adjusted by NTP) |
49 | * @mult_orig: cycle to nanosecond multiplier (unadjusted by NTP) | ||
49 | * @shift: cycle to nanosecond divisor (power of two) | 50 | * @shift: cycle to nanosecond divisor (power of two) |
50 | * @flags: flags describing special properties | 51 | * @flags: flags describing special properties |
51 | * @vread: vsyscall based read | 52 | * @vread: vsyscall based read |
@@ -63,6 +64,7 @@ struct clocksource { | |||
63 | cycle_t (*read)(void); | 64 | cycle_t (*read)(void); |
64 | cycle_t mask; | 65 | cycle_t mask; |
65 | u32 mult; | 66 | u32 mult; |
67 | u32 mult_orig; | ||
66 | u32 shift; | 68 | u32 shift; |
67 | unsigned long flags; | 69 | unsigned long flags; |
68 | cycle_t (*vread)(void); | 70 | cycle_t (*vread)(void); |
@@ -77,6 +79,7 @@ struct clocksource { | |||
77 | /* timekeeping specific data, ignore */ | 79 | /* timekeeping specific data, ignore */ |
78 | cycle_t cycle_interval; | 80 | cycle_t cycle_interval; |
79 | u64 xtime_interval; | 81 | u64 xtime_interval; |
82 | u32 raw_interval; | ||
80 | /* | 83 | /* |
81 | * Second part is written at each timer interrupt | 84 | * Second part is written at each timer interrupt |
82 | * Keep it in a different cache line to dirty no | 85 | * Keep it in a different cache line to dirty no |
@@ -85,6 +88,7 @@ struct clocksource { | |||
85 | cycle_t cycle_last ____cacheline_aligned_in_smp; | 88 | cycle_t cycle_last ____cacheline_aligned_in_smp; |
86 | u64 xtime_nsec; | 89 | u64 xtime_nsec; |
87 | s64 error; | 90 | s64 error; |
91 | struct timespec raw_time; | ||
88 | 92 | ||
89 | #ifdef CONFIG_CLOCKSOURCE_WATCHDOG | 93 | #ifdef CONFIG_CLOCKSOURCE_WATCHDOG |
90 | /* Watchdog related data, used by the framework */ | 94 | /* Watchdog related data, used by the framework */ |
@@ -201,17 +205,19 @@ static inline void clocksource_calculate_interval(struct clocksource *c, | |||
201 | { | 205 | { |
202 | u64 tmp; | 206 | u64 tmp; |
203 | 207 | ||
204 | /* XXX - All of this could use a whole lot of optimization */ | 208 | /* Do the ns -> cycle conversion first, using original mult */ |
205 | tmp = length_nsec; | 209 | tmp = length_nsec; |
206 | tmp <<= c->shift; | 210 | tmp <<= c->shift; |
207 | tmp += c->mult/2; | 211 | tmp += c->mult_orig/2; |
208 | do_div(tmp, c->mult); | 212 | do_div(tmp, c->mult_orig); |
209 | 213 | ||
210 | c->cycle_interval = (cycle_t)tmp; | 214 | c->cycle_interval = (cycle_t)tmp; |
211 | if (c->cycle_interval == 0) | 215 | if (c->cycle_interval == 0) |
212 | c->cycle_interval = 1; | 216 | c->cycle_interval = 1; |
213 | 217 | ||
218 | /* Go back from cycles -> shifted ns, this time use ntp adjused mult */ | ||
214 | c->xtime_interval = (u64)c->cycle_interval * c->mult; | 219 | c->xtime_interval = (u64)c->cycle_interval * c->mult; |
220 | c->raw_interval = ((u64)c->cycle_interval * c->mult_orig) >> c->shift; | ||
215 | } | 221 | } |
216 | 222 | ||
217 | 223 | ||
diff --git a/include/linux/cnt32_to_63.h b/include/linux/cnt32_to_63.h index 8c0f9505b48c..7605fdd1eb65 100644 --- a/include/linux/cnt32_to_63.h +++ b/include/linux/cnt32_to_63.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/compiler.h> | 16 | #include <linux/compiler.h> |
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <asm/byteorder.h> | 18 | #include <asm/byteorder.h> |
19 | #include <asm/system.h> | ||
19 | 20 | ||
20 | /* this is used only to give gcc a clue about good code generation */ | 21 | /* this is used only to give gcc a clue about good code generation */ |
21 | union cnt32_to_63 { | 22 | union cnt32_to_63 { |
@@ -53,11 +54,19 @@ union cnt32_to_63 { | |||
53 | * needed increment. And any race in updating the value in memory is harmless | 54 | * needed increment. And any race in updating the value in memory is harmless |
54 | * as the same value would simply be stored more than once. | 55 | * as the same value would simply be stored more than once. |
55 | * | 56 | * |
56 | * The only restriction for the algorithm to work properly is that this | 57 | * The restrictions for the algorithm to work properly are: |
57 | * code must be executed at least once per each half period of the 32-bit | 58 | * |
58 | * counter to properly update the state bit in memory. This is usually not a | 59 | * 1) this code must be called at least once per each half period of the |
59 | * problem in practice, but if it is then a kernel timer could be scheduled | 60 | * 32-bit counter; |
60 | * to manage for this code to be executed often enough. | 61 | * |
62 | * 2) this code must not be preempted for a duration longer than the | ||
63 | * 32-bit counter half period minus the longest period between two | ||
64 | * calls to this code. | ||
65 | * | ||
66 | * Those requirements ensure proper update to the state bit in memory. | ||
67 | * This is usually not a problem in practice, but if it is then a kernel | ||
68 | * timer should be scheduled to manage for this code to be executed often | ||
69 | * enough. | ||
61 | * | 70 | * |
62 | * Note that the top bit (bit 63) in the returned value should be considered | 71 | * Note that the top bit (bit 63) in the returned value should be considered |
63 | * as garbage. It is not cleared here because callers are likely to use a | 72 | * as garbage. It is not cleared here because callers are likely to use a |
@@ -68,9 +77,10 @@ union cnt32_to_63 { | |||
68 | */ | 77 | */ |
69 | #define cnt32_to_63(cnt_lo) \ | 78 | #define cnt32_to_63(cnt_lo) \ |
70 | ({ \ | 79 | ({ \ |
71 | static volatile u32 __m_cnt_hi; \ | 80 | static u32 __m_cnt_hi; \ |
72 | union cnt32_to_63 __x; \ | 81 | union cnt32_to_63 __x; \ |
73 | __x.hi = __m_cnt_hi; \ | 82 | __x.hi = __m_cnt_hi; \ |
83 | smp_rmb(); \ | ||
74 | __x.lo = (cnt_lo); \ | 84 | __x.lo = (cnt_lo); \ |
75 | if (unlikely((s32)(__x.hi ^ __x.lo) < 0)) \ | 85 | if (unlikely((s32)(__x.hi ^ __x.lo) < 0)) \ |
76 | __m_cnt_hi = __x.hi = (__x.hi ^ 0x80000000) + (__x.hi >> 31); \ | 86 | __m_cnt_hi = __x.hi = (__x.hi ^ 0x80000000) + (__x.hi >> 31); \ |
diff --git a/include/linux/compat.h b/include/linux/compat.h index cf8d11cad5ae..f061a1ea1b74 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -78,7 +78,6 @@ typedef struct { | |||
78 | compat_sigset_word sig[_COMPAT_NSIG_WORDS]; | 78 | compat_sigset_word sig[_COMPAT_NSIG_WORDS]; |
79 | } compat_sigset_t; | 79 | } compat_sigset_t; |
80 | 80 | ||
81 | extern int cp_compat_stat(struct kstat *, struct compat_stat __user *); | ||
82 | extern int get_compat_timespec(struct timespec *, const struct compat_timespec __user *); | 81 | extern int get_compat_timespec(struct timespec *, const struct compat_timespec __user *); |
83 | extern int put_compat_timespec(const struct timespec *, struct compat_timespec __user *); | 82 | extern int put_compat_timespec(const struct timespec *, struct compat_timespec __user *); |
84 | 83 | ||
@@ -235,6 +234,11 @@ extern int get_compat_itimerspec(struct itimerspec *dst, | |||
235 | extern int put_compat_itimerspec(struct compat_itimerspec __user *dst, | 234 | extern int put_compat_itimerspec(struct compat_itimerspec __user *dst, |
236 | const struct itimerspec *src); | 235 | const struct itimerspec *src); |
237 | 236 | ||
237 | asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv, | ||
238 | struct timezone __user *tz); | ||
239 | asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv, | ||
240 | struct timezone __user *tz); | ||
241 | |||
238 | asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); | 242 | asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); |
239 | 243 | ||
240 | extern int compat_printk(const char *fmt, ...); | 244 | extern int compat_printk(const char *fmt, ...); |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index c8bd2daf95ec..98115d9d04da 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -44,6 +44,8 @@ extern void __chk_io_ptr(const volatile void __iomem *); | |||
44 | # error Sorry, your compiler is too old/not recognized. | 44 | # error Sorry, your compiler is too old/not recognized. |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #define notrace __attribute__((no_instrument_function)) | ||
48 | |||
47 | /* Intel compiler defines __GNUC__. So we will overwrite implementations | 49 | /* Intel compiler defines __GNUC__. So we will overwrite implementations |
48 | * coming from above header files here | 50 | * coming from above header files here |
49 | */ | 51 | */ |
@@ -190,7 +192,9 @@ extern void __chk_io_ptr(const volatile void __iomem *); | |||
190 | * ACCESS_ONCE() in different C statements. | 192 | * ACCESS_ONCE() in different C statements. |
191 | * | 193 | * |
192 | * This macro does absolutely -nothing- to prevent the CPU from reordering, | 194 | * This macro does absolutely -nothing- to prevent the CPU from reordering, |
193 | * merging, or refetching absolutely anything at any time. | 195 | * merging, or refetching absolutely anything at any time. Its main intended |
196 | * use is to mediate communication between process-level code and irq/NMI | ||
197 | * handlers, all running on the same CPU. | ||
194 | */ | 198 | */ |
195 | #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) | 199 | #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) |
196 | 200 | ||
diff --git a/include/linux/completion.h b/include/linux/completion.h index 02ef8835999c..4a6b604ef7e4 100644 --- a/include/linux/completion.h +++ b/include/linux/completion.h | |||
@@ -10,6 +10,18 @@ | |||
10 | 10 | ||
11 | #include <linux/wait.h> | 11 | #include <linux/wait.h> |
12 | 12 | ||
13 | /** | ||
14 | * struct completion - structure used to maintain state for a "completion" | ||
15 | * | ||
16 | * This is the opaque structure used to maintain the state for a "completion". | ||
17 | * Completions currently use a FIFO to queue threads that have to wait for | ||
18 | * the "completion" event. | ||
19 | * | ||
20 | * See also: complete(), wait_for_completion() (and friends _timeout, | ||
21 | * _interruptible, _interruptible_timeout, and _killable), init_completion(), | ||
22 | * and macros DECLARE_COMPLETION(), DECLARE_COMPLETION_ONSTACK(), and | ||
23 | * INIT_COMPLETION(). | ||
24 | */ | ||
13 | struct completion { | 25 | struct completion { |
14 | unsigned int done; | 26 | unsigned int done; |
15 | wait_queue_head_t wait; | 27 | wait_queue_head_t wait; |
@@ -21,6 +33,14 @@ struct completion { | |||
21 | #define COMPLETION_INITIALIZER_ONSTACK(work) \ | 33 | #define COMPLETION_INITIALIZER_ONSTACK(work) \ |
22 | ({ init_completion(&work); work; }) | 34 | ({ init_completion(&work); work; }) |
23 | 35 | ||
36 | /** | ||
37 | * DECLARE_COMPLETION: - declare and initialize a completion structure | ||
38 | * @work: identifier for the completion structure | ||
39 | * | ||
40 | * This macro declares and initializes a completion structure. Generally used | ||
41 | * for static declarations. You should use the _ONSTACK variant for automatic | ||
42 | * variables. | ||
43 | */ | ||
24 | #define DECLARE_COMPLETION(work) \ | 44 | #define DECLARE_COMPLETION(work) \ |
25 | struct completion work = COMPLETION_INITIALIZER(work) | 45 | struct completion work = COMPLETION_INITIALIZER(work) |
26 | 46 | ||
@@ -29,6 +49,13 @@ struct completion { | |||
29 | * completions - so we use the _ONSTACK() variant for those that | 49 | * completions - so we use the _ONSTACK() variant for those that |
30 | * are on the kernel stack: | 50 | * are on the kernel stack: |
31 | */ | 51 | */ |
52 | /** | ||
53 | * DECLARE_COMPLETION_ONSTACK: - declare and initialize a completion structure | ||
54 | * @work: identifier for the completion structure | ||
55 | * | ||
56 | * This macro declares and initializes a completion structure on the kernel | ||
57 | * stack. | ||
58 | */ | ||
32 | #ifdef CONFIG_LOCKDEP | 59 | #ifdef CONFIG_LOCKDEP |
33 | # define DECLARE_COMPLETION_ONSTACK(work) \ | 60 | # define DECLARE_COMPLETION_ONSTACK(work) \ |
34 | struct completion work = COMPLETION_INITIALIZER_ONSTACK(work) | 61 | struct completion work = COMPLETION_INITIALIZER_ONSTACK(work) |
@@ -36,6 +63,13 @@ struct completion { | |||
36 | # define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work) | 63 | # define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work) |
37 | #endif | 64 | #endif |
38 | 65 | ||
66 | /** | ||
67 | * init_completion: - Initialize a dynamically allocated completion | ||
68 | * @x: completion structure that is to be initialized | ||
69 | * | ||
70 | * This inline function will initialize a dynamically created completion | ||
71 | * structure. | ||
72 | */ | ||
39 | static inline void init_completion(struct completion *x) | 73 | static inline void init_completion(struct completion *x) |
40 | { | 74 | { |
41 | x->done = 0; | 75 | x->done = 0; |
@@ -55,6 +89,13 @@ extern bool completion_done(struct completion *x); | |||
55 | extern void complete(struct completion *); | 89 | extern void complete(struct completion *); |
56 | extern void complete_all(struct completion *); | 90 | extern void complete_all(struct completion *); |
57 | 91 | ||
92 | /** | ||
93 | * INIT_COMPLETION: - reinitialize a completion structure | ||
94 | * @x: completion structure to be reinitialized | ||
95 | * | ||
96 | * This macro should be used to reinitialize a completion structure so it can | ||
97 | * be reused. This is especially important after complete_all() is used. | ||
98 | */ | ||
58 | #define INIT_COMPLETION(x) ((x).done = 0) | 99 | #define INIT_COMPLETION(x) ((x).done = 0) |
59 | 100 | ||
60 | 101 | ||
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h index b03f80a078be..d71f7c0f931b 100644 --- a/include/linux/console_struct.h +++ b/include/linux/console_struct.h | |||
@@ -53,7 +53,6 @@ struct vc_data { | |||
53 | unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */ | 53 | unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */ |
54 | struct console_font vc_font; /* Current VC font set */ | 54 | struct console_font vc_font; /* Current VC font set */ |
55 | unsigned short vc_video_erase_char; /* Background erase character */ | 55 | unsigned short vc_video_erase_char; /* Background erase character */ |
56 | unsigned short vc_scrl_erase_char; /* Erase character for scroll */ | ||
57 | /* VT terminal data */ | 56 | /* VT terminal data */ |
58 | unsigned int vc_state; /* Escape sequence parser state */ | 57 | unsigned int vc_state; /* Escape sequence parser state */ |
59 | unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ | 58 | unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ |
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index d7faf8808497..c2747ac2ae43 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
@@ -69,6 +69,7 @@ static inline void unregister_cpu_notifier(struct notifier_block *nb) | |||
69 | #endif | 69 | #endif |
70 | 70 | ||
71 | int cpu_up(unsigned int cpu); | 71 | int cpu_up(unsigned int cpu); |
72 | void notify_cpu_starting(unsigned int cpu); | ||
72 | extern void cpu_hotplug_init(void); | 73 | extern void cpu_hotplug_init(void); |
73 | extern void cpu_maps_update_begin(void); | 74 | extern void cpu_maps_update_begin(void); |
74 | extern void cpu_maps_update_done(void); | 75 | extern void cpu_maps_update_done(void); |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 6fd5668aa572..1ee608fd7b77 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
@@ -187,7 +187,8 @@ extern int __cpufreq_driver_target(struct cpufreq_policy *policy, | |||
187 | unsigned int relation); | 187 | unsigned int relation); |
188 | 188 | ||
189 | 189 | ||
190 | extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy); | 190 | extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy, |
191 | unsigned int cpu); | ||
191 | 192 | ||
192 | int cpufreq_register_governor(struct cpufreq_governor *governor); | 193 | int cpufreq_register_governor(struct cpufreq_governor *governor); |
193 | void cpufreq_unregister_governor(struct cpufreq_governor *governor); | 194 | void cpufreq_unregister_governor(struct cpufreq_governor *governor); |
@@ -226,7 +227,9 @@ struct cpufreq_driver { | |||
226 | unsigned int (*get) (unsigned int cpu); | 227 | unsigned int (*get) (unsigned int cpu); |
227 | 228 | ||
228 | /* optional */ | 229 | /* optional */ |
229 | unsigned int (*getavg) (unsigned int cpu); | 230 | unsigned int (*getavg) (struct cpufreq_policy *policy, |
231 | unsigned int cpu); | ||
232 | |||
230 | int (*exit) (struct cpufreq_policy *policy); | 233 | int (*exit) (struct cpufreq_policy *policy); |
231 | int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); | 234 | int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); |
232 | int (*resume) (struct cpufreq_policy *policy); | 235 | int (*resume) (struct cpufreq_policy *policy); |
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index d3219d73f8e6..21e1dd43e52a 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -5,6 +5,9 @@ | |||
5 | * Cpumasks provide a bitmap suitable for representing the | 5 | * Cpumasks provide a bitmap suitable for representing the |
6 | * set of CPU's in a system, one bit position per CPU number. | 6 | * set of CPU's in a system, one bit position per CPU number. |
7 | * | 7 | * |
8 | * The new cpumask_ ops take a "struct cpumask *"; the old ones | ||
9 | * use cpumask_t. | ||
10 | * | ||
8 | * See detailed comments in the file linux/bitmap.h describing the | 11 | * See detailed comments in the file linux/bitmap.h describing the |
9 | * data type on which these cpumasks are based. | 12 | * data type on which these cpumasks are based. |
10 | * | 13 | * |
@@ -31,7 +34,7 @@ | |||
31 | * will span the entire range of NR_CPUS. | 34 | * will span the entire range of NR_CPUS. |
32 | * . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . | 35 | * . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
33 | * | 36 | * |
34 | * The available cpumask operations are: | 37 | * The obsolescent cpumask operations are: |
35 | * | 38 | * |
36 | * void cpu_set(cpu, mask) turn on bit 'cpu' in mask | 39 | * void cpu_set(cpu, mask) turn on bit 'cpu' in mask |
37 | * void cpu_clear(cpu, mask) turn off bit 'cpu' in mask | 40 | * void cpu_clear(cpu, mask) turn off bit 'cpu' in mask |
@@ -138,7 +141,7 @@ | |||
138 | #include <linux/threads.h> | 141 | #include <linux/threads.h> |
139 | #include <linux/bitmap.h> | 142 | #include <linux/bitmap.h> |
140 | 143 | ||
141 | typedef struct { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; | 144 | typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; |
142 | extern cpumask_t _unused_cpumask_arg_; | 145 | extern cpumask_t _unused_cpumask_arg_; |
143 | 146 | ||
144 | #define cpu_set(cpu, dst) __cpu_set((cpu), &(dst)) | 147 | #define cpu_set(cpu, dst) __cpu_set((cpu), &(dst)) |
@@ -527,4 +530,556 @@ extern cpumask_t cpu_active_map; | |||
527 | #define for_each_online_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_online_map) | 530 | #define for_each_online_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_online_map) |
528 | #define for_each_present_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_present_map) | 531 | #define for_each_present_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_present_map) |
529 | 532 | ||
533 | /* These are the new versions of the cpumask operators: passed by pointer. | ||
534 | * The older versions will be implemented in terms of these, then deleted. */ | ||
535 | #define cpumask_bits(maskp) ((maskp)->bits) | ||
536 | |||
537 | #if NR_CPUS <= BITS_PER_LONG | ||
538 | #define CPU_BITS_ALL \ | ||
539 | { \ | ||
540 | [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \ | ||
541 | } | ||
542 | |||
543 | /* This produces more efficient code. */ | ||
544 | #define nr_cpumask_bits NR_CPUS | ||
545 | |||
546 | #else /* NR_CPUS > BITS_PER_LONG */ | ||
547 | |||
548 | #define CPU_BITS_ALL \ | ||
549 | { \ | ||
550 | [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \ | ||
551 | [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \ | ||
552 | } | ||
553 | |||
554 | #define nr_cpumask_bits nr_cpu_ids | ||
555 | #endif /* NR_CPUS > BITS_PER_LONG */ | ||
556 | |||
557 | /* verify cpu argument to cpumask_* operators */ | ||
558 | static inline unsigned int cpumask_check(unsigned int cpu) | ||
559 | { | ||
560 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | ||
561 | WARN_ON_ONCE(cpu >= nr_cpumask_bits); | ||
562 | #endif /* CONFIG_DEBUG_PER_CPU_MAPS */ | ||
563 | return cpu; | ||
564 | } | ||
565 | |||
566 | #if NR_CPUS == 1 | ||
567 | /* Uniprocessor. Assume all masks are "1". */ | ||
568 | static inline unsigned int cpumask_first(const struct cpumask *srcp) | ||
569 | { | ||
570 | return 0; | ||
571 | } | ||
572 | |||
573 | /* Valid inputs for n are -1 and 0. */ | ||
574 | static inline unsigned int cpumask_next(int n, const struct cpumask *srcp) | ||
575 | { | ||
576 | return n+1; | ||
577 | } | ||
578 | |||
579 | static inline unsigned int cpumask_next_zero(int n, const struct cpumask *srcp) | ||
580 | { | ||
581 | return n+1; | ||
582 | } | ||
583 | |||
584 | static inline unsigned int cpumask_next_and(int n, | ||
585 | const struct cpumask *srcp, | ||
586 | const struct cpumask *andp) | ||
587 | { | ||
588 | return n+1; | ||
589 | } | ||
590 | |||
591 | /* cpu must be a valid cpu, ie 0, so there's no other choice. */ | ||
592 | static inline unsigned int cpumask_any_but(const struct cpumask *mask, | ||
593 | unsigned int cpu) | ||
594 | { | ||
595 | return 1; | ||
596 | } | ||
597 | |||
598 | #define for_each_cpu(cpu, mask) \ | ||
599 | for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) | ||
600 | #define for_each_cpu_and(cpu, mask, and) \ | ||
601 | for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask, (void)and) | ||
602 | #else | ||
603 | /** | ||
604 | * cpumask_first - get the first cpu in a cpumask | ||
605 | * @srcp: the cpumask pointer | ||
606 | * | ||
607 | * Returns >= nr_cpu_ids if no cpus set. | ||
608 | */ | ||
609 | static inline unsigned int cpumask_first(const struct cpumask *srcp) | ||
610 | { | ||
611 | return find_first_bit(cpumask_bits(srcp), nr_cpumask_bits); | ||
612 | } | ||
613 | |||
614 | /** | ||
615 | * cpumask_next - get the next cpu in a cpumask | ||
616 | * @n: the cpu prior to the place to search (ie. return will be > @n) | ||
617 | * @srcp: the cpumask pointer | ||
618 | * | ||
619 | * Returns >= nr_cpu_ids if no further cpus set. | ||
620 | */ | ||
621 | static inline unsigned int cpumask_next(int n, const struct cpumask *srcp) | ||
622 | { | ||
623 | /* -1 is a legal arg here. */ | ||
624 | if (n != -1) | ||
625 | cpumask_check(n); | ||
626 | return find_next_bit(cpumask_bits(srcp), nr_cpumask_bits, n+1); | ||
627 | } | ||
628 | |||
629 | /** | ||
630 | * cpumask_next_zero - get the next unset cpu in a cpumask | ||
631 | * @n: the cpu prior to the place to search (ie. return will be > @n) | ||
632 | * @srcp: the cpumask pointer | ||
633 | * | ||
634 | * Returns >= nr_cpu_ids if no further cpus unset. | ||
635 | */ | ||
636 | static inline unsigned int cpumask_next_zero(int n, const struct cpumask *srcp) | ||
637 | { | ||
638 | /* -1 is a legal arg here. */ | ||
639 | if (n != -1) | ||
640 | cpumask_check(n); | ||
641 | return find_next_zero_bit(cpumask_bits(srcp), nr_cpumask_bits, n+1); | ||
642 | } | ||
643 | |||
644 | int cpumask_next_and(int n, const struct cpumask *, const struct cpumask *); | ||
645 | int cpumask_any_but(const struct cpumask *mask, unsigned int cpu); | ||
646 | |||
647 | /** | ||
648 | * for_each_cpu - iterate over every cpu in a mask | ||
649 | * @cpu: the (optionally unsigned) integer iterator | ||
650 | * @mask: the cpumask pointer | ||
651 | * | ||
652 | * After the loop, cpu is >= nr_cpu_ids. | ||
653 | */ | ||
654 | #define for_each_cpu(cpu, mask) \ | ||
655 | for ((cpu) = -1; \ | ||
656 | (cpu) = cpumask_next((cpu), (mask)), \ | ||
657 | (cpu) < nr_cpu_ids;) | ||
658 | |||
659 | /** | ||
660 | * for_each_cpu_and - iterate over every cpu in both masks | ||
661 | * @cpu: the (optionally unsigned) integer iterator | ||
662 | * @mask: the first cpumask pointer | ||
663 | * @and: the second cpumask pointer | ||
664 | * | ||
665 | * This saves a temporary CPU mask in many places. It is equivalent to: | ||
666 | * struct cpumask tmp; | ||
667 | * cpumask_and(&tmp, &mask, &and); | ||
668 | * for_each_cpu(cpu, &tmp) | ||
669 | * ... | ||
670 | * | ||
671 | * After the loop, cpu is >= nr_cpu_ids. | ||
672 | */ | ||
673 | #define for_each_cpu_and(cpu, mask, and) \ | ||
674 | for ((cpu) = -1; \ | ||
675 | (cpu) = cpumask_next_and((cpu), (mask), (and)), \ | ||
676 | (cpu) < nr_cpu_ids;) | ||
677 | #endif /* SMP */ | ||
678 | |||
679 | #define CPU_BITS_NONE \ | ||
680 | { \ | ||
681 | [0 ... BITS_TO_LONGS(NR_CPUS)-1] = 0UL \ | ||
682 | } | ||
683 | |||
684 | #define CPU_BITS_CPU0 \ | ||
685 | { \ | ||
686 | [0] = 1UL \ | ||
687 | } | ||
688 | |||
689 | /** | ||
690 | * cpumask_set_cpu - set a cpu in a cpumask | ||
691 | * @cpu: cpu number (< nr_cpu_ids) | ||
692 | * @dstp: the cpumask pointer | ||
693 | */ | ||
694 | static inline void cpumask_set_cpu(unsigned int cpu, struct cpumask *dstp) | ||
695 | { | ||
696 | set_bit(cpumask_check(cpu), cpumask_bits(dstp)); | ||
697 | } | ||
698 | |||
699 | /** | ||
700 | * cpumask_clear_cpu - clear a cpu in a cpumask | ||
701 | * @cpu: cpu number (< nr_cpu_ids) | ||
702 | * @dstp: the cpumask pointer | ||
703 | */ | ||
704 | static inline void cpumask_clear_cpu(int cpu, struct cpumask *dstp) | ||
705 | { | ||
706 | clear_bit(cpumask_check(cpu), cpumask_bits(dstp)); | ||
707 | } | ||
708 | |||
709 | /** | ||
710 | * cpumask_test_cpu - test for a cpu in a cpumask | ||
711 | * @cpu: cpu number (< nr_cpu_ids) | ||
712 | * @cpumask: the cpumask pointer | ||
713 | * | ||
714 | * No static inline type checking - see Subtlety (1) above. | ||
715 | */ | ||
716 | #define cpumask_test_cpu(cpu, cpumask) \ | ||
717 | test_bit(cpumask_check(cpu), (cpumask)->bits) | ||
718 | |||
719 | /** | ||
720 | * cpumask_test_and_set_cpu - atomically test and set a cpu in a cpumask | ||
721 | * @cpu: cpu number (< nr_cpu_ids) | ||
722 | * @cpumask: the cpumask pointer | ||
723 | * | ||
724 | * test_and_set_bit wrapper for cpumasks. | ||
725 | */ | ||
726 | static inline int cpumask_test_and_set_cpu(int cpu, struct cpumask *cpumask) | ||
727 | { | ||
728 | return test_and_set_bit(cpumask_check(cpu), cpumask_bits(cpumask)); | ||
729 | } | ||
730 | |||
731 | /** | ||
732 | * cpumask_setall - set all cpus (< nr_cpu_ids) in a cpumask | ||
733 | * @dstp: the cpumask pointer | ||
734 | */ | ||
735 | static inline void cpumask_setall(struct cpumask *dstp) | ||
736 | { | ||
737 | bitmap_fill(cpumask_bits(dstp), nr_cpumask_bits); | ||
738 | } | ||
739 | |||
740 | /** | ||
741 | * cpumask_clear - clear all cpus (< nr_cpu_ids) in a cpumask | ||
742 | * @dstp: the cpumask pointer | ||
743 | */ | ||
744 | static inline void cpumask_clear(struct cpumask *dstp) | ||
745 | { | ||
746 | bitmap_zero(cpumask_bits(dstp), nr_cpumask_bits); | ||
747 | } | ||
748 | |||
749 | /** | ||
750 | * cpumask_and - *dstp = *src1p & *src2p | ||
751 | * @dstp: the cpumask result | ||
752 | * @src1p: the first input | ||
753 | * @src2p: the second input | ||
754 | */ | ||
755 | static inline void cpumask_and(struct cpumask *dstp, | ||
756 | const struct cpumask *src1p, | ||
757 | const struct cpumask *src2p) | ||
758 | { | ||
759 | bitmap_and(cpumask_bits(dstp), cpumask_bits(src1p), | ||
760 | cpumask_bits(src2p), nr_cpumask_bits); | ||
761 | } | ||
762 | |||
763 | /** | ||
764 | * cpumask_or - *dstp = *src1p | *src2p | ||
765 | * @dstp: the cpumask result | ||
766 | * @src1p: the first input | ||
767 | * @src2p: the second input | ||
768 | */ | ||
769 | static inline void cpumask_or(struct cpumask *dstp, const struct cpumask *src1p, | ||
770 | const struct cpumask *src2p) | ||
771 | { | ||
772 | bitmap_or(cpumask_bits(dstp), cpumask_bits(src1p), | ||
773 | cpumask_bits(src2p), nr_cpumask_bits); | ||
774 | } | ||
775 | |||
776 | /** | ||
777 | * cpumask_xor - *dstp = *src1p ^ *src2p | ||
778 | * @dstp: the cpumask result | ||
779 | * @src1p: the first input | ||
780 | * @src2p: the second input | ||
781 | */ | ||
782 | static inline void cpumask_xor(struct cpumask *dstp, | ||
783 | const struct cpumask *src1p, | ||
784 | const struct cpumask *src2p) | ||
785 | { | ||
786 | bitmap_xor(cpumask_bits(dstp), cpumask_bits(src1p), | ||
787 | cpumask_bits(src2p), nr_cpumask_bits); | ||
788 | } | ||
789 | |||
790 | /** | ||
791 | * cpumask_andnot - *dstp = *src1p & ~*src2p | ||
792 | * @dstp: the cpumask result | ||
793 | * @src1p: the first input | ||
794 | * @src2p: the second input | ||
795 | */ | ||
796 | static inline void cpumask_andnot(struct cpumask *dstp, | ||
797 | const struct cpumask *src1p, | ||
798 | const struct cpumask *src2p) | ||
799 | { | ||
800 | bitmap_andnot(cpumask_bits(dstp), cpumask_bits(src1p), | ||
801 | cpumask_bits(src2p), nr_cpumask_bits); | ||
802 | } | ||
803 | |||
804 | /** | ||
805 | * cpumask_complement - *dstp = ~*srcp | ||
806 | * @dstp: the cpumask result | ||
807 | * @srcp: the input to invert | ||
808 | */ | ||
809 | static inline void cpumask_complement(struct cpumask *dstp, | ||
810 | const struct cpumask *srcp) | ||
811 | { | ||
812 | bitmap_complement(cpumask_bits(dstp), cpumask_bits(srcp), | ||
813 | nr_cpumask_bits); | ||
814 | } | ||
815 | |||
816 | /** | ||
817 | * cpumask_equal - *src1p == *src2p | ||
818 | * @src1p: the first input | ||
819 | * @src2p: the second input | ||
820 | */ | ||
821 | static inline bool cpumask_equal(const struct cpumask *src1p, | ||
822 | const struct cpumask *src2p) | ||
823 | { | ||
824 | return bitmap_equal(cpumask_bits(src1p), cpumask_bits(src2p), | ||
825 | nr_cpumask_bits); | ||
826 | } | ||
827 | |||
828 | /** | ||
829 | * cpumask_intersects - (*src1p & *src2p) != 0 | ||
830 | * @src1p: the first input | ||
831 | * @src2p: the second input | ||
832 | */ | ||
833 | static inline bool cpumask_intersects(const struct cpumask *src1p, | ||
834 | const struct cpumask *src2p) | ||
835 | { | ||
836 | return bitmap_intersects(cpumask_bits(src1p), cpumask_bits(src2p), | ||
837 | nr_cpumask_bits); | ||
838 | } | ||
839 | |||
840 | /** | ||
841 | * cpumask_subset - (*src1p & ~*src2p) == 0 | ||
842 | * @src1p: the first input | ||
843 | * @src2p: the second input | ||
844 | */ | ||
845 | static inline int cpumask_subset(const struct cpumask *src1p, | ||
846 | const struct cpumask *src2p) | ||
847 | { | ||
848 | return bitmap_subset(cpumask_bits(src1p), cpumask_bits(src2p), | ||
849 | nr_cpumask_bits); | ||
850 | } | ||
851 | |||
852 | /** | ||
853 | * cpumask_empty - *srcp == 0 | ||
854 | * @srcp: the cpumask to that all cpus < nr_cpu_ids are clear. | ||
855 | */ | ||
856 | static inline bool cpumask_empty(const struct cpumask *srcp) | ||
857 | { | ||
858 | return bitmap_empty(cpumask_bits(srcp), nr_cpumask_bits); | ||
859 | } | ||
860 | |||
861 | /** | ||
862 | * cpumask_full - *srcp == 0xFFFFFFFF... | ||
863 | * @srcp: the cpumask to that all cpus < nr_cpu_ids are set. | ||
864 | */ | ||
865 | static inline bool cpumask_full(const struct cpumask *srcp) | ||
866 | { | ||
867 | return bitmap_full(cpumask_bits(srcp), nr_cpumask_bits); | ||
868 | } | ||
869 | |||
870 | /** | ||
871 | * cpumask_weight - Count of bits in *srcp | ||
872 | * @srcp: the cpumask to count bits (< nr_cpu_ids) in. | ||
873 | */ | ||
874 | static inline unsigned int cpumask_weight(const struct cpumask *srcp) | ||
875 | { | ||
876 | return bitmap_weight(cpumask_bits(srcp), nr_cpumask_bits); | ||
877 | } | ||
878 | |||
879 | /** | ||
880 | * cpumask_shift_right - *dstp = *srcp >> n | ||
881 | * @dstp: the cpumask result | ||
882 | * @srcp: the input to shift | ||
883 | * @n: the number of bits to shift by | ||
884 | */ | ||
885 | static inline void cpumask_shift_right(struct cpumask *dstp, | ||
886 | const struct cpumask *srcp, int n) | ||
887 | { | ||
888 | bitmap_shift_right(cpumask_bits(dstp), cpumask_bits(srcp), n, | ||
889 | nr_cpumask_bits); | ||
890 | } | ||
891 | |||
892 | /** | ||
893 | * cpumask_shift_left - *dstp = *srcp << n | ||
894 | * @dstp: the cpumask result | ||
895 | * @srcp: the input to shift | ||
896 | * @n: the number of bits to shift by | ||
897 | */ | ||
898 | static inline void cpumask_shift_left(struct cpumask *dstp, | ||
899 | const struct cpumask *srcp, int n) | ||
900 | { | ||
901 | bitmap_shift_left(cpumask_bits(dstp), cpumask_bits(srcp), n, | ||
902 | nr_cpumask_bits); | ||
903 | } | ||
904 | |||
905 | /** | ||
906 | * cpumask_copy - *dstp = *srcp | ||
907 | * @dstp: the result | ||
908 | * @srcp: the input cpumask | ||
909 | */ | ||
910 | static inline void cpumask_copy(struct cpumask *dstp, | ||
911 | const struct cpumask *srcp) | ||
912 | { | ||
913 | bitmap_copy(cpumask_bits(dstp), cpumask_bits(srcp), nr_cpumask_bits); | ||
914 | } | ||
915 | |||
916 | /** | ||
917 | * cpumask_any - pick a "random" cpu from *srcp | ||
918 | * @srcp: the input cpumask | ||
919 | * | ||
920 | * Returns >= nr_cpu_ids if no cpus set. | ||
921 | */ | ||
922 | #define cpumask_any(srcp) cpumask_first(srcp) | ||
923 | |||
924 | /** | ||
925 | * cpumask_first_and - return the first cpu from *srcp1 & *srcp2 | ||
926 | * @src1p: the first input | ||
927 | * @src2p: the second input | ||
928 | * | ||
929 | * Returns >= nr_cpu_ids if no cpus set in both. See also cpumask_next_and(). | ||
930 | */ | ||
931 | #define cpumask_first_and(src1p, src2p) cpumask_next_and(-1, (src1p), (src2p)) | ||
932 | |||
933 | /** | ||
934 | * cpumask_any_and - pick a "random" cpu from *mask1 & *mask2 | ||
935 | * @mask1: the first input cpumask | ||
936 | * @mask2: the second input cpumask | ||
937 | * | ||
938 | * Returns >= nr_cpu_ids if no cpus set. | ||
939 | */ | ||
940 | #define cpumask_any_and(mask1, mask2) cpumask_first_and((mask1), (mask2)) | ||
941 | |||
942 | /** | ||
943 | * cpumask_of - the cpumask containing just a given cpu | ||
944 | * @cpu: the cpu (<= nr_cpu_ids) | ||
945 | */ | ||
946 | #define cpumask_of(cpu) (get_cpu_mask(cpu)) | ||
947 | |||
948 | /** | ||
949 | * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask * | ||
950 | * @bitmap: the bitmap | ||
951 | * | ||
952 | * There are a few places where cpumask_var_t isn't appropriate and | ||
953 | * static cpumasks must be used (eg. very early boot), yet we don't | ||
954 | * expose the definition of 'struct cpumask'. | ||
955 | * | ||
956 | * This does the conversion, and can be used as a constant initializer. | ||
957 | */ | ||
958 | #define to_cpumask(bitmap) \ | ||
959 | ((struct cpumask *)(1 ? (bitmap) \ | ||
960 | : (void *)sizeof(__check_is_bitmap(bitmap)))) | ||
961 | |||
962 | static inline int __check_is_bitmap(const unsigned long *bitmap) | ||
963 | { | ||
964 | return 1; | ||
965 | } | ||
966 | |||
967 | /** | ||
968 | * cpumask_size - size to allocate for a 'struct cpumask' in bytes | ||
969 | * | ||
970 | * This will eventually be a runtime variable, depending on nr_cpu_ids. | ||
971 | */ | ||
972 | static inline size_t cpumask_size(void) | ||
973 | { | ||
974 | /* FIXME: Once all cpumask assignments are eliminated, this | ||
975 | * can be nr_cpumask_bits */ | ||
976 | return BITS_TO_LONGS(NR_CPUS) * sizeof(long); | ||
977 | } | ||
978 | |||
979 | /* | ||
980 | * cpumask_var_t: struct cpumask for stack usage. | ||
981 | * | ||
982 | * Oh, the wicked games we play! In order to make kernel coding a | ||
983 | * little more difficult, we typedef cpumask_var_t to an array or a | ||
984 | * pointer: doing &mask on an array is a noop, so it still works. | ||
985 | * | ||
986 | * ie. | ||
987 | * cpumask_var_t tmpmask; | ||
988 | * if (!alloc_cpumask_var(&tmpmask, GFP_KERNEL)) | ||
989 | * return -ENOMEM; | ||
990 | * | ||
991 | * ... use 'tmpmask' like a normal struct cpumask * ... | ||
992 | * | ||
993 | * free_cpumask_var(tmpmask); | ||
994 | */ | ||
995 | #ifdef CONFIG_CPUMASK_OFFSTACK | ||
996 | typedef struct cpumask *cpumask_var_t; | ||
997 | |||
998 | bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags); | ||
999 | void alloc_bootmem_cpumask_var(cpumask_var_t *mask); | ||
1000 | void free_cpumask_var(cpumask_var_t mask); | ||
1001 | void free_bootmem_cpumask_var(cpumask_var_t mask); | ||
1002 | |||
1003 | #else | ||
1004 | typedef struct cpumask cpumask_var_t[1]; | ||
1005 | |||
1006 | static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) | ||
1007 | { | ||
1008 | return true; | ||
1009 | } | ||
1010 | |||
1011 | static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask) | ||
1012 | { | ||
1013 | } | ||
1014 | |||
1015 | static inline void free_cpumask_var(cpumask_var_t mask) | ||
1016 | { | ||
1017 | } | ||
1018 | |||
1019 | static inline void free_bootmem_cpumask_var(cpumask_var_t mask) | ||
1020 | { | ||
1021 | } | ||
1022 | #endif /* CONFIG_CPUMASK_OFFSTACK */ | ||
1023 | |||
1024 | /* The pointer versions of the maps, these will become the primary versions. */ | ||
1025 | #define cpu_possible_mask ((const struct cpumask *)&cpu_possible_map) | ||
1026 | #define cpu_online_mask ((const struct cpumask *)&cpu_online_map) | ||
1027 | #define cpu_present_mask ((const struct cpumask *)&cpu_present_map) | ||
1028 | #define cpu_active_mask ((const struct cpumask *)&cpu_active_map) | ||
1029 | |||
1030 | /* It's common to want to use cpu_all_mask in struct member initializers, | ||
1031 | * so it has to refer to an address rather than a pointer. */ | ||
1032 | extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS); | ||
1033 | #define cpu_all_mask to_cpumask(cpu_all_bits) | ||
1034 | |||
1035 | /* First bits of cpu_bit_bitmap are in fact unset. */ | ||
1036 | #define cpu_none_mask to_cpumask(cpu_bit_bitmap[0]) | ||
1037 | |||
1038 | /* Wrappers for arch boot code to manipulate normally-constant masks */ | ||
1039 | static inline void set_cpu_possible(unsigned int cpu, bool possible) | ||
1040 | { | ||
1041 | if (possible) | ||
1042 | cpumask_set_cpu(cpu, &cpu_possible_map); | ||
1043 | else | ||
1044 | cpumask_clear_cpu(cpu, &cpu_possible_map); | ||
1045 | } | ||
1046 | |||
1047 | static inline void set_cpu_present(unsigned int cpu, bool present) | ||
1048 | { | ||
1049 | if (present) | ||
1050 | cpumask_set_cpu(cpu, &cpu_present_map); | ||
1051 | else | ||
1052 | cpumask_clear_cpu(cpu, &cpu_present_map); | ||
1053 | } | ||
1054 | |||
1055 | static inline void set_cpu_online(unsigned int cpu, bool online) | ||
1056 | { | ||
1057 | if (online) | ||
1058 | cpumask_set_cpu(cpu, &cpu_online_map); | ||
1059 | else | ||
1060 | cpumask_clear_cpu(cpu, &cpu_online_map); | ||
1061 | } | ||
1062 | |||
1063 | static inline void set_cpu_active(unsigned int cpu, bool active) | ||
1064 | { | ||
1065 | if (active) | ||
1066 | cpumask_set_cpu(cpu, &cpu_active_map); | ||
1067 | else | ||
1068 | cpumask_clear_cpu(cpu, &cpu_active_map); | ||
1069 | } | ||
1070 | |||
1071 | static inline void init_cpu_present(const struct cpumask *src) | ||
1072 | { | ||
1073 | cpumask_copy(&cpu_present_map, src); | ||
1074 | } | ||
1075 | |||
1076 | static inline void init_cpu_possible(const struct cpumask *src) | ||
1077 | { | ||
1078 | cpumask_copy(&cpu_possible_map, src); | ||
1079 | } | ||
1080 | |||
1081 | static inline void init_cpu_online(const struct cpumask *src) | ||
1082 | { | ||
1083 | cpumask_copy(&cpu_online_map, src); | ||
1084 | } | ||
530 | #endif /* __LINUX_CPUMASK_H */ | 1085 | #endif /* __LINUX_CPUMASK_H */ |
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index 2691926fb506..8e540d32c9fe 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h | |||
@@ -74,8 +74,6 @@ static inline int cpuset_do_slab_mem_spread(void) | |||
74 | return current->flags & PF_SPREAD_SLAB; | 74 | return current->flags & PF_SPREAD_SLAB; |
75 | } | 75 | } |
76 | 76 | ||
77 | extern void cpuset_track_online_nodes(void); | ||
78 | |||
79 | extern int current_cpuset_is_being_rebound(void); | 77 | extern int current_cpuset_is_being_rebound(void); |
80 | 78 | ||
81 | extern void rebuild_sched_domains(void); | 79 | extern void rebuild_sched_domains(void); |
@@ -151,8 +149,6 @@ static inline int cpuset_do_slab_mem_spread(void) | |||
151 | return 0; | 149 | return 0; |
152 | } | 150 | } |
153 | 151 | ||
154 | static inline void cpuset_track_online_nodes(void) {} | ||
155 | |||
156 | static inline int current_cpuset_is_being_rebound(void) | 152 | static inline int current_cpuset_is_being_rebound(void) |
157 | { | 153 | { |
158 | return 0; | 154 | return 0; |
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h index 025e4f575103..2dac064d8359 100644 --- a/include/linux/crash_dump.h +++ b/include/linux/crash_dump.h | |||
@@ -8,17 +8,12 @@ | |||
8 | #include <linux/proc_fs.h> | 8 | #include <linux/proc_fs.h> |
9 | 9 | ||
10 | #define ELFCORE_ADDR_MAX (-1ULL) | 10 | #define ELFCORE_ADDR_MAX (-1ULL) |
11 | #define ELFCORE_ADDR_ERR (-2ULL) | ||
11 | 12 | ||
12 | #ifdef CONFIG_PROC_VMCORE | ||
13 | extern unsigned long long elfcorehdr_addr; | 13 | extern unsigned long long elfcorehdr_addr; |
14 | #else | ||
15 | static const unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX; | ||
16 | #endif | ||
17 | 14 | ||
18 | extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, | 15 | extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, |
19 | unsigned long, int); | 16 | unsigned long, int); |
20 | extern const struct file_operations proc_vmcore_operations; | ||
21 | extern struct proc_dir_entry *proc_vmcore; | ||
22 | 17 | ||
23 | /* Architecture code defines this if there are other possible ELF | 18 | /* Architecture code defines this if there are other possible ELF |
24 | * machine types, e.g. on bi-arch capable hardware. */ | 19 | * machine types, e.g. on bi-arch capable hardware. */ |
@@ -28,10 +23,43 @@ extern struct proc_dir_entry *proc_vmcore; | |||
28 | 23 | ||
29 | #define vmcore_elf_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x)) | 24 | #define vmcore_elf_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x)) |
30 | 25 | ||
26 | /* | ||
27 | * is_kdump_kernel() checks whether this kernel is booting after a panic of | ||
28 | * previous kernel or not. This is determined by checking if previous kernel | ||
29 | * has passed the elf core header address on command line. | ||
30 | * | ||
31 | * This is not just a test if CONFIG_CRASH_DUMP is enabled or not. It will | ||
32 | * return 1 if CONFIG_CRASH_DUMP=y and if kernel is booting after a panic of | ||
33 | * previous kernel. | ||
34 | */ | ||
35 | |||
31 | static inline int is_kdump_kernel(void) | 36 | static inline int is_kdump_kernel(void) |
32 | { | 37 | { |
33 | return (elfcorehdr_addr != ELFCORE_ADDR_MAX) ? 1 : 0; | 38 | return (elfcorehdr_addr != ELFCORE_ADDR_MAX) ? 1 : 0; |
34 | } | 39 | } |
40 | |||
41 | /* is_vmcore_usable() checks if the kernel is booting after a panic and | ||
42 | * the vmcore region is usable. | ||
43 | * | ||
44 | * This makes use of the fact that due to alignment -2ULL is not | ||
45 | * a valid pointer, much in the vain of IS_ERR(), except | ||
46 | * dealing directly with an unsigned long long rather than a pointer. | ||
47 | */ | ||
48 | |||
49 | static inline int is_vmcore_usable(void) | ||
50 | { | ||
51 | return is_kdump_kernel() && elfcorehdr_addr != ELFCORE_ADDR_ERR ? 1 : 0; | ||
52 | } | ||
53 | |||
54 | /* vmcore_unusable() marks the vmcore as unusable, | ||
55 | * without disturbing the logic of is_kdump_kernel() | ||
56 | */ | ||
57 | |||
58 | static inline void vmcore_unusable(void) | ||
59 | { | ||
60 | if (is_kdump_kernel()) | ||
61 | elfcorehdr_addr = ELFCORE_ADDR_ERR; | ||
62 | } | ||
35 | #else /* !CONFIG_CRASH_DUMP */ | 63 | #else /* !CONFIG_CRASH_DUMP */ |
36 | static inline int is_kdump_kernel(void) { return 0; } | 64 | static inline int is_kdump_kernel(void) { return 0; } |
37 | #endif /* CONFIG_CRASH_DUMP */ | 65 | #endif /* CONFIG_CRASH_DUMP */ |
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index c43dc47fdf75..3d2317e4af2e 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
@@ -38,6 +38,7 @@ | |||
38 | #define CRYPTO_ALG_TYPE_DIGEST 0x00000008 | 38 | #define CRYPTO_ALG_TYPE_DIGEST 0x00000008 |
39 | #define CRYPTO_ALG_TYPE_HASH 0x00000009 | 39 | #define CRYPTO_ALG_TYPE_HASH 0x00000009 |
40 | #define CRYPTO_ALG_TYPE_AHASH 0x0000000a | 40 | #define CRYPTO_ALG_TYPE_AHASH 0x0000000a |
41 | #define CRYPTO_ALG_TYPE_RNG 0x0000000c | ||
41 | 42 | ||
42 | #define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e | 43 | #define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e |
43 | #define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000c | 44 | #define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000c |
@@ -61,6 +62,14 @@ | |||
61 | #define CRYPTO_ALG_GENIV 0x00000200 | 62 | #define CRYPTO_ALG_GENIV 0x00000200 |
62 | 63 | ||
63 | /* | 64 | /* |
65 | * Set if the algorithm has passed automated run-time testing. Note that | ||
66 | * if there is no run-time testing for a given algorithm it is considered | ||
67 | * to have passed. | ||
68 | */ | ||
69 | |||
70 | #define CRYPTO_ALG_TESTED 0x00000400 | ||
71 | |||
72 | /* | ||
64 | * Transform masks and values (for crt_flags). | 73 | * Transform masks and values (for crt_flags). |
65 | */ | 74 | */ |
66 | #define CRYPTO_TFM_REQ_MASK 0x000fff00 | 75 | #define CRYPTO_TFM_REQ_MASK 0x000fff00 |
@@ -105,6 +114,7 @@ struct crypto_aead; | |||
105 | struct crypto_blkcipher; | 114 | struct crypto_blkcipher; |
106 | struct crypto_hash; | 115 | struct crypto_hash; |
107 | struct crypto_ahash; | 116 | struct crypto_ahash; |
117 | struct crypto_rng; | ||
108 | struct crypto_tfm; | 118 | struct crypto_tfm; |
109 | struct crypto_type; | 119 | struct crypto_type; |
110 | struct aead_givcrypt_request; | 120 | struct aead_givcrypt_request; |
@@ -290,6 +300,15 @@ struct compress_alg { | |||
290 | unsigned int slen, u8 *dst, unsigned int *dlen); | 300 | unsigned int slen, u8 *dst, unsigned int *dlen); |
291 | }; | 301 | }; |
292 | 302 | ||
303 | struct rng_alg { | ||
304 | int (*rng_make_random)(struct crypto_rng *tfm, u8 *rdata, | ||
305 | unsigned int dlen); | ||
306 | int (*rng_reset)(struct crypto_rng *tfm, u8 *seed, unsigned int slen); | ||
307 | |||
308 | unsigned int seedsize; | ||
309 | }; | ||
310 | |||
311 | |||
293 | #define cra_ablkcipher cra_u.ablkcipher | 312 | #define cra_ablkcipher cra_u.ablkcipher |
294 | #define cra_aead cra_u.aead | 313 | #define cra_aead cra_u.aead |
295 | #define cra_blkcipher cra_u.blkcipher | 314 | #define cra_blkcipher cra_u.blkcipher |
@@ -298,6 +317,7 @@ struct compress_alg { | |||
298 | #define cra_hash cra_u.hash | 317 | #define cra_hash cra_u.hash |
299 | #define cra_ahash cra_u.ahash | 318 | #define cra_ahash cra_u.ahash |
300 | #define cra_compress cra_u.compress | 319 | #define cra_compress cra_u.compress |
320 | #define cra_rng cra_u.rng | ||
301 | 321 | ||
302 | struct crypto_alg { | 322 | struct crypto_alg { |
303 | struct list_head cra_list; | 323 | struct list_head cra_list; |
@@ -325,6 +345,7 @@ struct crypto_alg { | |||
325 | struct hash_alg hash; | 345 | struct hash_alg hash; |
326 | struct ahash_alg ahash; | 346 | struct ahash_alg ahash; |
327 | struct compress_alg compress; | 347 | struct compress_alg compress; |
348 | struct rng_alg rng; | ||
328 | } cra_u; | 349 | } cra_u; |
329 | 350 | ||
330 | int (*cra_init)(struct crypto_tfm *tfm); | 351 | int (*cra_init)(struct crypto_tfm *tfm); |
@@ -430,6 +451,12 @@ struct compress_tfm { | |||
430 | u8 *dst, unsigned int *dlen); | 451 | u8 *dst, unsigned int *dlen); |
431 | }; | 452 | }; |
432 | 453 | ||
454 | struct rng_tfm { | ||
455 | int (*rng_gen_random)(struct crypto_rng *tfm, u8 *rdata, | ||
456 | unsigned int dlen); | ||
457 | int (*rng_reset)(struct crypto_rng *tfm, u8 *seed, unsigned int slen); | ||
458 | }; | ||
459 | |||
433 | #define crt_ablkcipher crt_u.ablkcipher | 460 | #define crt_ablkcipher crt_u.ablkcipher |
434 | #define crt_aead crt_u.aead | 461 | #define crt_aead crt_u.aead |
435 | #define crt_blkcipher crt_u.blkcipher | 462 | #define crt_blkcipher crt_u.blkcipher |
@@ -437,6 +464,7 @@ struct compress_tfm { | |||
437 | #define crt_hash crt_u.hash | 464 | #define crt_hash crt_u.hash |
438 | #define crt_ahash crt_u.ahash | 465 | #define crt_ahash crt_u.ahash |
439 | #define crt_compress crt_u.compress | 466 | #define crt_compress crt_u.compress |
467 | #define crt_rng crt_u.rng | ||
440 | 468 | ||
441 | struct crypto_tfm { | 469 | struct crypto_tfm { |
442 | 470 | ||
@@ -450,6 +478,7 @@ struct crypto_tfm { | |||
450 | struct hash_tfm hash; | 478 | struct hash_tfm hash; |
451 | struct ahash_tfm ahash; | 479 | struct ahash_tfm ahash; |
452 | struct compress_tfm compress; | 480 | struct compress_tfm compress; |
481 | struct rng_tfm rng; | ||
453 | } crt_u; | 482 | } crt_u; |
454 | 483 | ||
455 | struct crypto_alg *__crt_alg; | 484 | struct crypto_alg *__crt_alg; |
@@ -481,6 +510,10 @@ struct crypto_hash { | |||
481 | struct crypto_tfm base; | 510 | struct crypto_tfm base; |
482 | }; | 511 | }; |
483 | 512 | ||
513 | struct crypto_rng { | ||
514 | struct crypto_tfm base; | ||
515 | }; | ||
516 | |||
484 | enum { | 517 | enum { |
485 | CRYPTOA_UNSPEC, | 518 | CRYPTOA_UNSPEC, |
486 | CRYPTOA_ALG, | 519 | CRYPTOA_ALG, |
@@ -515,6 +548,8 @@ struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags); | |||
515 | struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask); | 548 | struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask); |
516 | void crypto_free_tfm(struct crypto_tfm *tfm); | 549 | void crypto_free_tfm(struct crypto_tfm *tfm); |
517 | 550 | ||
551 | int alg_test(const char *driver, const char *alg, u32 type, u32 mask); | ||
552 | |||
518 | /* | 553 | /* |
519 | * Transform helpers which query the underlying algorithm. | 554 | * Transform helpers which query the underlying algorithm. |
520 | */ | 555 | */ |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index efba1de629ac..a37359d0bad1 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -228,9 +228,9 @@ extern void d_delete(struct dentry *); | |||
228 | 228 | ||
229 | /* allocate/de-allocate */ | 229 | /* allocate/de-allocate */ |
230 | extern struct dentry * d_alloc(struct dentry *, const struct qstr *); | 230 | extern struct dentry * d_alloc(struct dentry *, const struct qstr *); |
231 | extern struct dentry * d_alloc_anon(struct inode *); | ||
232 | extern struct dentry * d_splice_alias(struct inode *, struct dentry *); | 231 | extern struct dentry * d_splice_alias(struct inode *, struct dentry *); |
233 | extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *); | 232 | extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *); |
233 | extern struct dentry * d_obtain_alias(struct inode *); | ||
234 | extern void shrink_dcache_sb(struct super_block *); | 234 | extern void shrink_dcache_sb(struct super_block *); |
235 | extern void shrink_dcache_parent(struct dentry *); | 235 | extern void shrink_dcache_parent(struct dentry *); |
236 | extern void shrink_dcache_for_umount(struct super_block *); | 236 | extern void shrink_dcache_for_umount(struct super_block *); |
@@ -287,6 +287,7 @@ static inline struct dentry *d_add_unique(struct dentry *entry, struct inode *in | |||
287 | 287 | ||
288 | /* used for rename() and baskets */ | 288 | /* used for rename() and baskets */ |
289 | extern void d_move(struct dentry *, struct dentry *); | 289 | extern void d_move(struct dentry *, struct dentry *); |
290 | extern struct dentry *d_ancestor(struct dentry *, struct dentry *); | ||
290 | 291 | ||
291 | /* appendix may either be NULL or be used for transname suffixes */ | 292 | /* appendix may either be NULL or be used for transname suffixes */ |
292 | extern struct dentry * d_lookup(struct dentry *, struct qstr *); | 293 | extern struct dentry * d_lookup(struct dentry *, struct qstr *); |
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index a90222e3297d..c17fd334e574 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
@@ -13,7 +13,6 @@ | |||
13 | 13 | ||
14 | struct dm_target; | 14 | struct dm_target; |
15 | struct dm_table; | 15 | struct dm_table; |
16 | struct dm_dev; | ||
17 | struct mapped_device; | 16 | struct mapped_device; |
18 | struct bio_vec; | 17 | struct bio_vec; |
19 | 18 | ||
@@ -70,8 +69,7 @@ typedef int (*dm_status_fn) (struct dm_target *ti, status_type_t status_type, | |||
70 | 69 | ||
71 | typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv); | 70 | typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv); |
72 | 71 | ||
73 | typedef int (*dm_ioctl_fn) (struct dm_target *ti, struct inode *inode, | 72 | typedef int (*dm_ioctl_fn) (struct dm_target *ti, unsigned int cmd, |
74 | struct file *filp, unsigned int cmd, | ||
75 | unsigned long arg); | 73 | unsigned long arg); |
76 | 74 | ||
77 | typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm, | 75 | typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm, |
@@ -84,13 +82,19 @@ void dm_error(const char *message); | |||
84 | */ | 82 | */ |
85 | void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev); | 83 | void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev); |
86 | 84 | ||
85 | struct dm_dev { | ||
86 | struct block_device *bdev; | ||
87 | fmode_t mode; | ||
88 | char name[16]; | ||
89 | }; | ||
90 | |||
87 | /* | 91 | /* |
88 | * Constructors should call these functions to ensure destination devices | 92 | * Constructors should call these functions to ensure destination devices |
89 | * are opened/closed correctly. | 93 | * are opened/closed correctly. |
90 | * FIXME: too many arguments. | 94 | * FIXME: too many arguments. |
91 | */ | 95 | */ |
92 | int dm_get_device(struct dm_target *ti, const char *path, sector_t start, | 96 | int dm_get_device(struct dm_target *ti, const char *path, sector_t start, |
93 | sector_t len, int mode, struct dm_dev **result); | 97 | sector_t len, fmode_t mode, struct dm_dev **result); |
94 | void dm_put_device(struct dm_target *ti, struct dm_dev *d); | 98 | void dm_put_device(struct dm_target *ti, struct dm_dev *d); |
95 | 99 | ||
96 | /* | 100 | /* |
@@ -202,6 +206,7 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid); | |||
202 | struct gendisk *dm_disk(struct mapped_device *md); | 206 | struct gendisk *dm_disk(struct mapped_device *md); |
203 | int dm_suspended(struct mapped_device *md); | 207 | int dm_suspended(struct mapped_device *md); |
204 | int dm_noflush_suspending(struct dm_target *ti); | 208 | int dm_noflush_suspending(struct dm_target *ti); |
209 | union map_info *dm_get_mapinfo(struct bio *bio); | ||
205 | 210 | ||
206 | /* | 211 | /* |
207 | * Geometry functions. | 212 | * Geometry functions. |
@@ -217,7 +222,7 @@ int dm_set_geometry(struct mapped_device *md, struct hd_geometry *geo); | |||
217 | /* | 222 | /* |
218 | * First create an empty table. | 223 | * First create an empty table. |
219 | */ | 224 | */ |
220 | int dm_table_create(struct dm_table **result, int mode, | 225 | int dm_table_create(struct dm_table **result, fmode_t mode, |
221 | unsigned num_targets, struct mapped_device *md); | 226 | unsigned num_targets, struct mapped_device *md); |
222 | 227 | ||
223 | /* | 228 | /* |
@@ -232,6 +237,11 @@ int dm_table_add_target(struct dm_table *t, const char *type, | |||
232 | int dm_table_complete(struct dm_table *t); | 237 | int dm_table_complete(struct dm_table *t); |
233 | 238 | ||
234 | /* | 239 | /* |
240 | * Unplug all devices in a table. | ||
241 | */ | ||
242 | void dm_table_unplug_all(struct dm_table *t); | ||
243 | |||
244 | /* | ||
235 | * Table reference counting. | 245 | * Table reference counting. |
236 | */ | 246 | */ |
237 | struct dm_table *dm_get_table(struct mapped_device *md); | 247 | struct dm_table *dm_get_table(struct mapped_device *md); |
@@ -243,7 +253,7 @@ void dm_table_put(struct dm_table *t); | |||
243 | */ | 253 | */ |
244 | sector_t dm_table_get_size(struct dm_table *t); | 254 | sector_t dm_table_get_size(struct dm_table *t); |
245 | unsigned int dm_table_get_num_targets(struct dm_table *t); | 255 | unsigned int dm_table_get_num_targets(struct dm_table *t); |
246 | int dm_table_get_mode(struct dm_table *t); | 256 | fmode_t dm_table_get_mode(struct dm_table *t); |
247 | struct mapped_device *dm_table_get_md(struct dm_table *t); | 257 | struct mapped_device *dm_table_get_md(struct dm_table *t); |
248 | 258 | ||
249 | /* | 259 | /* |
@@ -256,6 +266,11 @@ void dm_table_event(struct dm_table *t); | |||
256 | */ | 266 | */ |
257 | int dm_swap_table(struct mapped_device *md, struct dm_table *t); | 267 | int dm_swap_table(struct mapped_device *md, struct dm_table *t); |
258 | 268 | ||
269 | /* | ||
270 | * A wrapper around vmalloc. | ||
271 | */ | ||
272 | void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size); | ||
273 | |||
259 | /*----------------------------------------------------------------- | 274 | /*----------------------------------------------------------------- |
260 | * Macros. | 275 | * Macros. |
261 | *---------------------------------------------------------------*/ | 276 | *---------------------------------------------------------------*/ |
@@ -338,6 +353,9 @@ int dm_swap_table(struct mapped_device *md, struct dm_table *t); | |||
338 | */ | 353 | */ |
339 | #define dm_round_up(n, sz) (dm_div_up((n), (sz)) * (sz)) | 354 | #define dm_round_up(n, sz) (dm_div_up((n), (sz)) * (sz)) |
340 | 355 | ||
356 | #define dm_array_too_big(fixed, obj, num) \ | ||
357 | ((num) > (UINT_MAX - (fixed)) / (obj)) | ||
358 | |||
341 | static inline sector_t to_sector(unsigned long n) | 359 | static inline sector_t to_sector(unsigned long n) |
342 | { | 360 | { |
343 | return (n >> SECTOR_SHIFT); | 361 | return (n >> SECTOR_SHIFT); |
diff --git a/include/linux/device.h b/include/linux/device.h index 4d8372d135df..1a3686d15f98 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -90,6 +90,9 @@ int __must_check bus_for_each_drv(struct bus_type *bus, | |||
90 | struct device_driver *start, void *data, | 90 | struct device_driver *start, void *data, |
91 | int (*fn)(struct device_driver *, void *)); | 91 | int (*fn)(struct device_driver *, void *)); |
92 | 92 | ||
93 | void bus_sort_breadthfirst(struct bus_type *bus, | ||
94 | int (*compare)(const struct device *a, | ||
95 | const struct device *b)); | ||
93 | /* | 96 | /* |
94 | * Bus notifiers: Get notified of addition/removal of devices | 97 | * Bus notifiers: Get notified of addition/removal of devices |
95 | * and binding/unbinding of drivers to devices. | 98 | * and binding/unbinding of drivers to devices. |
@@ -199,6 +202,11 @@ struct class { | |||
199 | struct class_private *p; | 202 | struct class_private *p; |
200 | }; | 203 | }; |
201 | 204 | ||
205 | struct class_dev_iter { | ||
206 | struct klist_iter ki; | ||
207 | const struct device_type *type; | ||
208 | }; | ||
209 | |||
202 | extern struct kobject *sysfs_dev_block_kobj; | 210 | extern struct kobject *sysfs_dev_block_kobj; |
203 | extern struct kobject *sysfs_dev_char_kobj; | 211 | extern struct kobject *sysfs_dev_char_kobj; |
204 | extern int __must_check __class_register(struct class *class, | 212 | extern int __must_check __class_register(struct class *class, |
@@ -213,6 +221,13 @@ extern void class_unregister(struct class *class); | |||
213 | __class_register(class, &__key); \ | 221 | __class_register(class, &__key); \ |
214 | }) | 222 | }) |
215 | 223 | ||
224 | extern void class_dev_iter_init(struct class_dev_iter *iter, | ||
225 | struct class *class, | ||
226 | struct device *start, | ||
227 | const struct device_type *type); | ||
228 | extern struct device *class_dev_iter_next(struct class_dev_iter *iter); | ||
229 | extern void class_dev_iter_exit(struct class_dev_iter *iter); | ||
230 | |||
216 | extern int class_for_each_device(struct class *class, struct device *start, | 231 | extern int class_for_each_device(struct class *class, struct device *start, |
217 | void *data, | 232 | void *data, |
218 | int (*fn)(struct device *dev, void *data)); | 233 | int (*fn)(struct device *dev, void *data)); |
@@ -396,7 +411,7 @@ struct device { | |||
396 | spinlock_t devres_lock; | 411 | spinlock_t devres_lock; |
397 | struct list_head devres_head; | 412 | struct list_head devres_head; |
398 | 413 | ||
399 | struct list_head node; | 414 | struct klist_node knode_class; |
400 | struct class *class; | 415 | struct class *class; |
401 | dev_t devt; /* dev_t, creates the sysfs "dev" */ | 416 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
402 | struct attribute_group **groups; /* optional groups */ | 417 | struct attribute_group **groups; /* optional groups */ |
@@ -435,7 +450,7 @@ static inline void set_dev_node(struct device *dev, int node) | |||
435 | } | 450 | } |
436 | #endif | 451 | #endif |
437 | 452 | ||
438 | static inline void *dev_get_drvdata(struct device *dev) | 453 | static inline void *dev_get_drvdata(const struct device *dev) |
439 | { | 454 | { |
440 | return dev->driver_data; | 455 | return dev->driver_data; |
441 | } | 456 | } |
@@ -490,7 +505,6 @@ extern struct device *device_create(struct class *cls, struct device *parent, | |||
490 | dev_t devt, void *drvdata, | 505 | dev_t devt, void *drvdata, |
491 | const char *fmt, ...) | 506 | const char *fmt, ...) |
492 | __attribute__((format(printf, 5, 6))); | 507 | __attribute__((format(printf, 5, 6))); |
493 | #define device_create_drvdata device_create | ||
494 | extern void device_destroy(struct class *cls, dev_t devt); | 508 | extern void device_destroy(struct class *cls, dev_t devt); |
495 | 509 | ||
496 | /* | 510 | /* |
@@ -539,7 +553,11 @@ extern const char *dev_driver_string(const struct device *dev); | |||
539 | #define dev_info(dev, format, arg...) \ | 553 | #define dev_info(dev, format, arg...) \ |
540 | dev_printk(KERN_INFO , dev , format , ## arg) | 554 | dev_printk(KERN_INFO , dev , format , ## arg) |
541 | 555 | ||
542 | #ifdef DEBUG | 556 | #if defined(CONFIG_DYNAMIC_PRINTK_DEBUG) |
557 | #define dev_dbg(dev, format, ...) do { \ | ||
558 | dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ | ||
559 | } while (0) | ||
560 | #elif defined(DEBUG) | ||
543 | #define dev_dbg(dev, format, arg...) \ | 561 | #define dev_dbg(dev, format, arg...) \ |
544 | dev_printk(KERN_DEBUG , dev , format , ## arg) | 562 | dev_printk(KERN_DEBUG , dev , format , ## arg) |
545 | #else | 563 | #else |
@@ -555,6 +573,14 @@ extern const char *dev_driver_string(const struct device *dev); | |||
555 | ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; }) | 573 | ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; }) |
556 | #endif | 574 | #endif |
557 | 575 | ||
576 | /* | ||
577 | * dev_WARN() acts like dev_printk(), but with the key difference | ||
578 | * of using a WARN/WARN_ON to get the message out, including the | ||
579 | * file/line information and a backtrace. | ||
580 | */ | ||
581 | #define dev_WARN(dev, format, arg...) \ | ||
582 | WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg); | ||
583 | |||
558 | /* Create alias, so I can be autoloaded. */ | 584 | /* Create alias, so I can be autoloaded. */ |
559 | #define MODULE_ALIAS_CHARDEV(major,minor) \ | 585 | #define MODULE_ALIAS_CHARDEV(major,minor) \ |
560 | MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) | 586 | MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) |
diff --git a/include/linux/devpts_fs.h b/include/linux/devpts_fs.h index 154769cad3f3..5ce0e5fd712e 100644 --- a/include/linux/devpts_fs.h +++ b/include/linux/devpts_fs.h | |||
@@ -17,20 +17,31 @@ | |||
17 | 17 | ||
18 | #ifdef CONFIG_UNIX98_PTYS | 18 | #ifdef CONFIG_UNIX98_PTYS |
19 | 19 | ||
20 | int devpts_new_index(void); | 20 | int devpts_new_index(struct inode *ptmx_inode); |
21 | void devpts_kill_index(int idx); | 21 | void devpts_kill_index(struct inode *ptmx_inode, int idx); |
22 | int devpts_pty_new(struct tty_struct *tty); /* mknod in devpts */ | 22 | /* mknod in devpts */ |
23 | struct tty_struct *devpts_get_tty(int number); /* get tty structure */ | 23 | int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty); |
24 | void devpts_pty_kill(int number); /* unlink */ | 24 | /* get tty structure */ |
25 | struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number); | ||
26 | /* unlink */ | ||
27 | void devpts_pty_kill(struct tty_struct *tty); | ||
25 | 28 | ||
26 | #else | 29 | #else |
27 | 30 | ||
28 | /* Dummy stubs in the no-pty case */ | 31 | /* Dummy stubs in the no-pty case */ |
29 | static inline int devpts_new_index(void) { return -EINVAL; } | 32 | static inline int devpts_new_index(struct inode *ptmx_inode) { return -EINVAL; } |
30 | static inline void devpts_kill_index(int idx) { } | 33 | static inline void devpts_kill_index(struct inode *ptmx_inode, int idx) { } |
31 | static inline int devpts_pty_new(struct tty_struct *tty) { return -EINVAL; } | 34 | static inline int devpts_pty_new(struct inode *ptmx_inode, |
32 | static inline struct tty_struct *devpts_get_tty(int number) { return NULL; } | 35 | struct tty_struct *tty) |
33 | static inline void devpts_pty_kill(int number) { } | 36 | { |
37 | return -EINVAL; | ||
38 | } | ||
39 | static inline struct tty_struct *devpts_get_tty(struct inode *pts_inode, | ||
40 | int number) | ||
41 | { | ||
42 | return NULL; | ||
43 | } | ||
44 | static inline void devpts_pty_kill(struct tty_struct *tty) { } | ||
34 | 45 | ||
35 | #endif | 46 | #endif |
36 | 47 | ||
diff --git a/include/linux/dlm.h b/include/linux/dlm.h index 203a025e30e5..b9cd38603fd8 100644 --- a/include/linux/dlm.h +++ b/include/linux/dlm.h | |||
@@ -2,7 +2,7 @@ | |||
2 | ******************************************************************************* | 2 | ******************************************************************************* |
3 | ** | 3 | ** |
4 | ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | 4 | ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
5 | ** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. | 5 | ** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. |
6 | ** | 6 | ** |
7 | ** This copyrighted material is made available to anyone wishing to use, | 7 | ** This copyrighted material is made available to anyone wishing to use, |
8 | ** modify, copy, or redistribute it subject to the terms and conditions | 8 | ** modify, copy, or redistribute it subject to the terms and conditions |
@@ -65,9 +65,12 @@ struct dlm_lksb { | |||
65 | char * sb_lvbptr; | 65 | char * sb_lvbptr; |
66 | }; | 66 | }; |
67 | 67 | ||
68 | /* dlm_new_lockspace() flags */ | ||
69 | |||
68 | #define DLM_LSFL_NODIR 0x00000001 | 70 | #define DLM_LSFL_NODIR 0x00000001 |
69 | #define DLM_LSFL_TIMEWARN 0x00000002 | 71 | #define DLM_LSFL_TIMEWARN 0x00000002 |
70 | #define DLM_LSFL_FS 0x00000004 | 72 | #define DLM_LSFL_FS 0x00000004 |
73 | #define DLM_LSFL_NEWEXCL 0x00000008 | ||
71 | 74 | ||
72 | #ifdef __KERNEL__ | 75 | #ifdef __KERNEL__ |
73 | 76 | ||
diff --git a/include/linux/dlm_device.h b/include/linux/dlm_device.h index c6034508fed9..3060783c4191 100644 --- a/include/linux/dlm_device.h +++ b/include/linux/dlm_device.h | |||
@@ -26,7 +26,7 @@ | |||
26 | /* Version of the device interface */ | 26 | /* Version of the device interface */ |
27 | #define DLM_DEVICE_VERSION_MAJOR 6 | 27 | #define DLM_DEVICE_VERSION_MAJOR 6 |
28 | #define DLM_DEVICE_VERSION_MINOR 0 | 28 | #define DLM_DEVICE_VERSION_MINOR 0 |
29 | #define DLM_DEVICE_VERSION_PATCH 0 | 29 | #define DLM_DEVICE_VERSION_PATCH 1 |
30 | 30 | ||
31 | /* struct passed to the lock write */ | 31 | /* struct passed to the lock write */ |
32 | struct dlm_lock_params { | 32 | struct dlm_lock_params { |
diff --git a/include/linux/dm-region-hash.h b/include/linux/dm-region-hash.h new file mode 100644 index 000000000000..a9e652a41373 --- /dev/null +++ b/include/linux/dm-region-hash.h | |||
@@ -0,0 +1,104 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2003 Sistina Software Limited. | ||
3 | * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. | ||
4 | * | ||
5 | * Device-Mapper dirty region hash interface. | ||
6 | * | ||
7 | * This file is released under the GPL. | ||
8 | */ | ||
9 | |||
10 | #ifndef DM_REGION_HASH_H | ||
11 | #define DM_REGION_HASH_H | ||
12 | |||
13 | #include <linux/dm-dirty-log.h> | ||
14 | |||
15 | /*----------------------------------------------------------------- | ||
16 | * Region hash | ||
17 | *----------------------------------------------------------------*/ | ||
18 | struct dm_region_hash; | ||
19 | struct dm_region; | ||
20 | |||
21 | /* | ||
22 | * States a region can have. | ||
23 | */ | ||
24 | enum dm_rh_region_states { | ||
25 | DM_RH_CLEAN = 0x01, /* No writes in flight. */ | ||
26 | DM_RH_DIRTY = 0x02, /* Writes in flight. */ | ||
27 | DM_RH_NOSYNC = 0x04, /* Out of sync. */ | ||
28 | DM_RH_RECOVERING = 0x08, /* Under resynchronization. */ | ||
29 | }; | ||
30 | |||
31 | /* | ||
32 | * Region hash create/destroy. | ||
33 | */ | ||
34 | struct bio_list; | ||
35 | struct dm_region_hash *dm_region_hash_create( | ||
36 | void *context, void (*dispatch_bios)(void *context, | ||
37 | struct bio_list *bios), | ||
38 | void (*wakeup_workers)(void *context), | ||
39 | void (*wakeup_all_recovery_waiters)(void *context), | ||
40 | sector_t target_begin, unsigned max_recovery, | ||
41 | struct dm_dirty_log *log, uint32_t region_size, | ||
42 | region_t nr_regions); | ||
43 | void dm_region_hash_destroy(struct dm_region_hash *rh); | ||
44 | |||
45 | struct dm_dirty_log *dm_rh_dirty_log(struct dm_region_hash *rh); | ||
46 | |||
47 | /* | ||
48 | * Conversion functions. | ||
49 | */ | ||
50 | region_t dm_rh_bio_to_region(struct dm_region_hash *rh, struct bio *bio); | ||
51 | sector_t dm_rh_region_to_sector(struct dm_region_hash *rh, region_t region); | ||
52 | void *dm_rh_region_context(struct dm_region *reg); | ||
53 | |||
54 | /* | ||
55 | * Get region size and key (ie. number of the region). | ||
56 | */ | ||
57 | sector_t dm_rh_get_region_size(struct dm_region_hash *rh); | ||
58 | region_t dm_rh_get_region_key(struct dm_region *reg); | ||
59 | |||
60 | /* | ||
61 | * Get/set/update region state (and dirty log). | ||
62 | * | ||
63 | */ | ||
64 | int dm_rh_get_state(struct dm_region_hash *rh, region_t region, int may_block); | ||
65 | void dm_rh_set_state(struct dm_region_hash *rh, region_t region, | ||
66 | enum dm_rh_region_states state, int may_block); | ||
67 | |||
68 | /* Non-zero errors_handled leaves the state of the region NOSYNC */ | ||
69 | void dm_rh_update_states(struct dm_region_hash *rh, int errors_handled); | ||
70 | |||
71 | /* Flush the region hash and dirty log. */ | ||
72 | int dm_rh_flush(struct dm_region_hash *rh); | ||
73 | |||
74 | /* Inc/dec pending count on regions. */ | ||
75 | void dm_rh_inc_pending(struct dm_region_hash *rh, struct bio_list *bios); | ||
76 | void dm_rh_dec(struct dm_region_hash *rh, region_t region); | ||
77 | |||
78 | /* Delay bios on regions. */ | ||
79 | void dm_rh_delay(struct dm_region_hash *rh, struct bio *bio); | ||
80 | |||
81 | void dm_rh_mark_nosync(struct dm_region_hash *rh, | ||
82 | struct bio *bio, unsigned done, int error); | ||
83 | |||
84 | /* | ||
85 | * Region recovery control. | ||
86 | */ | ||
87 | |||
88 | /* Prepare some regions for recovery by starting to quiesce them. */ | ||
89 | void dm_rh_recovery_prepare(struct dm_region_hash *rh); | ||
90 | |||
91 | /* Try fetching a quiesced region for recovery. */ | ||
92 | struct dm_region *dm_rh_recovery_start(struct dm_region_hash *rh); | ||
93 | |||
94 | /* Report recovery end on a region. */ | ||
95 | void dm_rh_recovery_end(struct dm_region *reg, int error); | ||
96 | |||
97 | /* Returns number of regions with recovery work outstanding. */ | ||
98 | int dm_rh_recovery_in_flight(struct dm_region_hash *rh); | ||
99 | |||
100 | /* Start/stop recovery. */ | ||
101 | void dm_rh_start_recovery(struct dm_region_hash *rh); | ||
102 | void dm_rh_stop_recovery(struct dm_region_hash *rh); | ||
103 | |||
104 | #endif /* DM_REGION_HASH_H */ | ||
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 952e0f857ac9..ba9114ec5d3a 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -48,6 +48,11 @@ static inline int is_device_dma_capable(struct device *dev) | |||
48 | return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE; | 48 | return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE; |
49 | } | 49 | } |
50 | 50 | ||
51 | static inline int is_buffer_dma_capable(u64 mask, dma_addr_t addr, size_t size) | ||
52 | { | ||
53 | return addr + size <= mask; | ||
54 | } | ||
55 | |||
51 | #ifdef CONFIG_HAS_DMA | 56 | #ifdef CONFIG_HAS_DMA |
52 | #include <asm/dma-mapping.h> | 57 | #include <asm/dma-mapping.h> |
53 | #else | 58 | #else |
@@ -58,6 +63,13 @@ static inline int is_device_dma_capable(struct device *dev) | |||
58 | #define dma_sync_single dma_sync_single_for_cpu | 63 | #define dma_sync_single dma_sync_single_for_cpu |
59 | #define dma_sync_sg dma_sync_sg_for_cpu | 64 | #define dma_sync_sg dma_sync_sg_for_cpu |
60 | 65 | ||
66 | static inline u64 dma_get_mask(struct device *dev) | ||
67 | { | ||
68 | if (dev && dev->dma_mask && *dev->dma_mask) | ||
69 | return *dev->dma_mask; | ||
70 | return DMA_32BIT_MASK; | ||
71 | } | ||
72 | |||
61 | extern u64 dma_get_required_mask(struct device *dev); | 73 | extern u64 dma_get_required_mask(struct device *dev); |
62 | 74 | ||
63 | static inline unsigned int dma_get_max_seg_size(struct device *dev) | 75 | static inline unsigned int dma_get_max_seg_size(struct device *dev) |
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h new file mode 100644 index 000000000000..952df39c989d --- /dev/null +++ b/include/linux/dma_remapping.h | |||
@@ -0,0 +1,156 @@ | |||
1 | #ifndef _DMA_REMAPPING_H | ||
2 | #define _DMA_REMAPPING_H | ||
3 | |||
4 | /* | ||
5 | * VT-d hardware uses 4KiB page size regardless of host page size. | ||
6 | */ | ||
7 | #define VTD_PAGE_SHIFT (12) | ||
8 | #define VTD_PAGE_SIZE (1UL << VTD_PAGE_SHIFT) | ||
9 | #define VTD_PAGE_MASK (((u64)-1) << VTD_PAGE_SHIFT) | ||
10 | #define VTD_PAGE_ALIGN(addr) (((addr) + VTD_PAGE_SIZE - 1) & VTD_PAGE_MASK) | ||
11 | |||
12 | #define IOVA_PFN(addr) ((addr) >> PAGE_SHIFT) | ||
13 | #define DMA_32BIT_PFN IOVA_PFN(DMA_32BIT_MASK) | ||
14 | #define DMA_64BIT_PFN IOVA_PFN(DMA_64BIT_MASK) | ||
15 | |||
16 | |||
17 | /* | ||
18 | * 0: Present | ||
19 | * 1-11: Reserved | ||
20 | * 12-63: Context Ptr (12 - (haw-1)) | ||
21 | * 64-127: Reserved | ||
22 | */ | ||
23 | struct root_entry { | ||
24 | u64 val; | ||
25 | u64 rsvd1; | ||
26 | }; | ||
27 | #define ROOT_ENTRY_NR (VTD_PAGE_SIZE/sizeof(struct root_entry)) | ||
28 | static inline bool root_present(struct root_entry *root) | ||
29 | { | ||
30 | return (root->val & 1); | ||
31 | } | ||
32 | static inline void set_root_present(struct root_entry *root) | ||
33 | { | ||
34 | root->val |= 1; | ||
35 | } | ||
36 | static inline void set_root_value(struct root_entry *root, unsigned long value) | ||
37 | { | ||
38 | root->val |= value & VTD_PAGE_MASK; | ||
39 | } | ||
40 | |||
41 | struct context_entry; | ||
42 | static inline struct context_entry * | ||
43 | get_context_addr_from_root(struct root_entry *root) | ||
44 | { | ||
45 | return (struct context_entry *) | ||
46 | (root_present(root)?phys_to_virt( | ||
47 | root->val & VTD_PAGE_MASK) : | ||
48 | NULL); | ||
49 | } | ||
50 | |||
51 | /* | ||
52 | * low 64 bits: | ||
53 | * 0: present | ||
54 | * 1: fault processing disable | ||
55 | * 2-3: translation type | ||
56 | * 12-63: address space root | ||
57 | * high 64 bits: | ||
58 | * 0-2: address width | ||
59 | * 3-6: aval | ||
60 | * 8-23: domain id | ||
61 | */ | ||
62 | struct context_entry { | ||
63 | u64 lo; | ||
64 | u64 hi; | ||
65 | }; | ||
66 | #define context_present(c) ((c).lo & 1) | ||
67 | #define context_fault_disable(c) (((c).lo >> 1) & 1) | ||
68 | #define context_translation_type(c) (((c).lo >> 2) & 3) | ||
69 | #define context_address_root(c) ((c).lo & VTD_PAGE_MASK) | ||
70 | #define context_address_width(c) ((c).hi & 7) | ||
71 | #define context_domain_id(c) (((c).hi >> 8) & ((1 << 16) - 1)) | ||
72 | |||
73 | #define context_set_present(c) do {(c).lo |= 1;} while (0) | ||
74 | #define context_set_fault_enable(c) \ | ||
75 | do {(c).lo &= (((u64)-1) << 2) | 1;} while (0) | ||
76 | #define context_set_translation_type(c, val) \ | ||
77 | do { \ | ||
78 | (c).lo &= (((u64)-1) << 4) | 3; \ | ||
79 | (c).lo |= ((val) & 3) << 2; \ | ||
80 | } while (0) | ||
81 | #define CONTEXT_TT_MULTI_LEVEL 0 | ||
82 | #define context_set_address_root(c, val) \ | ||
83 | do {(c).lo |= (val) & VTD_PAGE_MASK; } while (0) | ||
84 | #define context_set_address_width(c, val) do {(c).hi |= (val) & 7;} while (0) | ||
85 | #define context_set_domain_id(c, val) \ | ||
86 | do {(c).hi |= ((val) & ((1 << 16) - 1)) << 8;} while (0) | ||
87 | #define context_clear_entry(c) do {(c).lo = 0; (c).hi = 0;} while (0) | ||
88 | |||
89 | /* | ||
90 | * 0: readable | ||
91 | * 1: writable | ||
92 | * 2-6: reserved | ||
93 | * 7: super page | ||
94 | * 8-11: available | ||
95 | * 12-63: Host physcial address | ||
96 | */ | ||
97 | struct dma_pte { | ||
98 | u64 val; | ||
99 | }; | ||
100 | #define dma_clear_pte(p) do {(p).val = 0;} while (0) | ||
101 | |||
102 | #define DMA_PTE_READ (1) | ||
103 | #define DMA_PTE_WRITE (2) | ||
104 | |||
105 | #define dma_set_pte_readable(p) do {(p).val |= DMA_PTE_READ;} while (0) | ||
106 | #define dma_set_pte_writable(p) do {(p).val |= DMA_PTE_WRITE;} while (0) | ||
107 | #define dma_set_pte_prot(p, prot) \ | ||
108 | do {(p).val = ((p).val & ~3) | ((prot) & 3); } while (0) | ||
109 | #define dma_pte_addr(p) ((p).val & VTD_PAGE_MASK) | ||
110 | #define dma_set_pte_addr(p, addr) do {\ | ||
111 | (p).val |= ((addr) & VTD_PAGE_MASK); } while (0) | ||
112 | #define dma_pte_present(p) (((p).val & 3) != 0) | ||
113 | |||
114 | struct intel_iommu; | ||
115 | |||
116 | struct dmar_domain { | ||
117 | int id; /* domain id */ | ||
118 | struct intel_iommu *iommu; /* back pointer to owning iommu */ | ||
119 | |||
120 | struct list_head devices; /* all devices' list */ | ||
121 | struct iova_domain iovad; /* iova's that belong to this domain */ | ||
122 | |||
123 | struct dma_pte *pgd; /* virtual address */ | ||
124 | spinlock_t mapping_lock; /* page table lock */ | ||
125 | int gaw; /* max guest address width */ | ||
126 | |||
127 | /* adjusted guest address width, 0 is level 2 30-bit */ | ||
128 | int agaw; | ||
129 | |||
130 | #define DOMAIN_FLAG_MULTIPLE_DEVICES 1 | ||
131 | int flags; | ||
132 | }; | ||
133 | |||
134 | /* PCI domain-device relationship */ | ||
135 | struct device_domain_info { | ||
136 | struct list_head link; /* link to domain siblings */ | ||
137 | struct list_head global; /* link to global list */ | ||
138 | u8 bus; /* PCI bus numer */ | ||
139 | u8 devfn; /* PCI devfn number */ | ||
140 | struct pci_dev *dev; /* it's NULL for PCIE-to-PCI bridge */ | ||
141 | struct dmar_domain *domain; /* pointer to domain */ | ||
142 | }; | ||
143 | |||
144 | extern int init_dmars(void); | ||
145 | extern void free_dmar_iommu(struct intel_iommu *iommu); | ||
146 | |||
147 | extern int dmar_disabled; | ||
148 | |||
149 | #ifndef CONFIG_DMAR_GFX_WA | ||
150 | static inline void iommu_prepare_gfx_mapping(void) | ||
151 | { | ||
152 | return; | ||
153 | } | ||
154 | #endif /* !CONFIG_DMAR_GFX_WA */ | ||
155 | |||
156 | #endif | ||
diff --git a/include/linux/dmar.h b/include/linux/dmar.h index 56c73b847551..f1984fc3e06d 100644 --- a/include/linux/dmar.h +++ b/include/linux/dmar.h | |||
@@ -25,9 +25,98 @@ | |||
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/msi.h> | 26 | #include <linux/msi.h> |
27 | 27 | ||
28 | #ifdef CONFIG_DMAR | 28 | #if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP) |
29 | struct intel_iommu; | 29 | struct intel_iommu; |
30 | 30 | ||
31 | struct dmar_drhd_unit { | ||
32 | struct list_head list; /* list of drhd units */ | ||
33 | struct acpi_dmar_header *hdr; /* ACPI header */ | ||
34 | u64 reg_base_addr; /* register base address*/ | ||
35 | struct pci_dev **devices; /* target device array */ | ||
36 | int devices_cnt; /* target device count */ | ||
37 | u8 ignored:1; /* ignore drhd */ | ||
38 | u8 include_all:1; | ||
39 | struct intel_iommu *iommu; | ||
40 | }; | ||
41 | |||
42 | extern struct list_head dmar_drhd_units; | ||
43 | |||
44 | #define for_each_drhd_unit(drhd) \ | ||
45 | list_for_each_entry(drhd, &dmar_drhd_units, list) | ||
46 | |||
47 | extern int dmar_table_init(void); | ||
48 | extern int dmar_dev_scope_init(void); | ||
49 | |||
50 | /* Intel IOMMU detection */ | ||
51 | extern void detect_intel_iommu(void); | ||
52 | |||
53 | |||
54 | extern int parse_ioapics_under_ir(void); | ||
55 | extern int alloc_iommu(struct dmar_drhd_unit *); | ||
56 | #else | ||
57 | static inline void detect_intel_iommu(void) | ||
58 | { | ||
59 | return; | ||
60 | } | ||
61 | |||
62 | static inline int dmar_table_init(void) | ||
63 | { | ||
64 | return -ENODEV; | ||
65 | } | ||
66 | #endif /* !CONFIG_DMAR && !CONFIG_INTR_REMAP */ | ||
67 | |||
68 | #ifdef CONFIG_INTR_REMAP | ||
69 | extern int intr_remapping_enabled; | ||
70 | extern int enable_intr_remapping(int); | ||
71 | |||
72 | struct irte { | ||
73 | union { | ||
74 | struct { | ||
75 | __u64 present : 1, | ||
76 | fpd : 1, | ||
77 | dst_mode : 1, | ||
78 | redir_hint : 1, | ||
79 | trigger_mode : 1, | ||
80 | dlvry_mode : 3, | ||
81 | avail : 4, | ||
82 | __reserved_1 : 4, | ||
83 | vector : 8, | ||
84 | __reserved_2 : 8, | ||
85 | dest_id : 32; | ||
86 | }; | ||
87 | __u64 low; | ||
88 | }; | ||
89 | |||
90 | union { | ||
91 | struct { | ||
92 | __u64 sid : 16, | ||
93 | sq : 2, | ||
94 | svt : 2, | ||
95 | __reserved_3 : 44; | ||
96 | }; | ||
97 | __u64 high; | ||
98 | }; | ||
99 | }; | ||
100 | extern int get_irte(int irq, struct irte *entry); | ||
101 | extern int modify_irte(int irq, struct irte *irte_modified); | ||
102 | extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count); | ||
103 | extern int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index, | ||
104 | u16 sub_handle); | ||
105 | extern int map_irq_to_irte_handle(int irq, u16 *sub_handle); | ||
106 | extern int clear_irte_irq(int irq, struct intel_iommu *iommu, u16 index); | ||
107 | extern int flush_irte(int irq); | ||
108 | extern int free_irte(int irq); | ||
109 | |||
110 | extern int irq_remapped(int irq); | ||
111 | extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev); | ||
112 | extern struct intel_iommu *map_ioapic_to_ir(int apic); | ||
113 | #else | ||
114 | #define irq_remapped(irq) (0) | ||
115 | #define enable_intr_remapping(mode) (-1) | ||
116 | #define intr_remapping_enabled (0) | ||
117 | #endif | ||
118 | |||
119 | #ifdef CONFIG_DMAR | ||
31 | extern const char *dmar_get_fault_reason(u8 fault_reason); | 120 | extern const char *dmar_get_fault_reason(u8 fault_reason); |
32 | 121 | ||
33 | /* Can't use the common MSI interrupt functions | 122 | /* Can't use the common MSI interrupt functions |
@@ -40,47 +129,30 @@ extern void dmar_msi_write(int irq, struct msi_msg *msg); | |||
40 | extern int dmar_set_interrupt(struct intel_iommu *iommu); | 129 | extern int dmar_set_interrupt(struct intel_iommu *iommu); |
41 | extern int arch_setup_dmar_msi(unsigned int irq); | 130 | extern int arch_setup_dmar_msi(unsigned int irq); |
42 | 131 | ||
43 | /* Intel IOMMU detection and initialization functions */ | 132 | extern int iommu_detected, no_iommu; |
44 | extern void detect_intel_iommu(void); | ||
45 | extern int intel_iommu_init(void); | ||
46 | |||
47 | extern int dmar_table_init(void); | ||
48 | extern int early_dmar_detect(void); | ||
49 | |||
50 | extern struct list_head dmar_drhd_units; | ||
51 | extern struct list_head dmar_rmrr_units; | 133 | extern struct list_head dmar_rmrr_units; |
52 | |||
53 | struct dmar_drhd_unit { | ||
54 | struct list_head list; /* list of drhd units */ | ||
55 | u64 reg_base_addr; /* register base address*/ | ||
56 | struct pci_dev **devices; /* target device array */ | ||
57 | int devices_cnt; /* target device count */ | ||
58 | u8 ignored:1; /* ignore drhd */ | ||
59 | u8 include_all:1; | ||
60 | struct intel_iommu *iommu; | ||
61 | }; | ||
62 | |||
63 | struct dmar_rmrr_unit { | 134 | struct dmar_rmrr_unit { |
64 | struct list_head list; /* list of rmrr units */ | 135 | struct list_head list; /* list of rmrr units */ |
136 | struct acpi_dmar_header *hdr; /* ACPI header */ | ||
65 | u64 base_address; /* reserved base address*/ | 137 | u64 base_address; /* reserved base address*/ |
66 | u64 end_address; /* reserved end address */ | 138 | u64 end_address; /* reserved end address */ |
67 | struct pci_dev **devices; /* target devices */ | 139 | struct pci_dev **devices; /* target devices */ |
68 | int devices_cnt; /* target device count */ | 140 | int devices_cnt; /* target device count */ |
69 | }; | 141 | }; |
70 | 142 | ||
71 | #define for_each_drhd_unit(drhd) \ | ||
72 | list_for_each_entry(drhd, &dmar_drhd_units, list) | ||
73 | #define for_each_rmrr_units(rmrr) \ | 143 | #define for_each_rmrr_units(rmrr) \ |
74 | list_for_each_entry(rmrr, &dmar_rmrr_units, list) | 144 | list_for_each_entry(rmrr, &dmar_rmrr_units, list) |
145 | /* Intel DMAR initialization functions */ | ||
146 | extern int intel_iommu_init(void); | ||
147 | extern int dmar_disabled; | ||
75 | #else | 148 | #else |
76 | static inline void detect_intel_iommu(void) | ||
77 | { | ||
78 | return; | ||
79 | } | ||
80 | static inline int intel_iommu_init(void) | 149 | static inline int intel_iommu_init(void) |
81 | { | 150 | { |
151 | #ifdef CONFIG_INTR_REMAP | ||
152 | return dmar_dev_scope_init(); | ||
153 | #else | ||
82 | return -ENODEV; | 154 | return -ENODEV; |
155 | #endif | ||
83 | } | 156 | } |
84 | |||
85 | #endif /* !CONFIG_DMAR */ | 157 | #endif /* !CONFIG_DMAR */ |
86 | #endif /* __DMAR_H__ */ | 158 | #endif /* __DMAR_H__ */ |
diff --git a/include/linux/dmi.h b/include/linux/dmi.h index 2a063b64133f..e5084eb5943a 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h | |||
@@ -2,29 +2,9 @@ | |||
2 | #define __DMI_H__ | 2 | #define __DMI_H__ |
3 | 3 | ||
4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
5 | #include <linux/mod_devicetable.h> | ||
5 | 6 | ||
6 | enum dmi_field { | 7 | /* enum dmi_field is in mod_devicetable.h */ |
7 | DMI_NONE, | ||
8 | DMI_BIOS_VENDOR, | ||
9 | DMI_BIOS_VERSION, | ||
10 | DMI_BIOS_DATE, | ||
11 | DMI_SYS_VENDOR, | ||
12 | DMI_PRODUCT_NAME, | ||
13 | DMI_PRODUCT_VERSION, | ||
14 | DMI_PRODUCT_SERIAL, | ||
15 | DMI_PRODUCT_UUID, | ||
16 | DMI_BOARD_VENDOR, | ||
17 | DMI_BOARD_NAME, | ||
18 | DMI_BOARD_VERSION, | ||
19 | DMI_BOARD_SERIAL, | ||
20 | DMI_BOARD_ASSET_TAG, | ||
21 | DMI_CHASSIS_VENDOR, | ||
22 | DMI_CHASSIS_TYPE, | ||
23 | DMI_CHASSIS_VERSION, | ||
24 | DMI_CHASSIS_SERIAL, | ||
25 | DMI_CHASSIS_ASSET_TAG, | ||
26 | DMI_STRING_MAX, | ||
27 | }; | ||
28 | 8 | ||
29 | enum dmi_device_type { | 9 | enum dmi_device_type { |
30 | DMI_DEV_TYPE_ANY = 0, | 10 | DMI_DEV_TYPE_ANY = 0, |
@@ -48,23 +28,6 @@ struct dmi_header { | |||
48 | u16 handle; | 28 | u16 handle; |
49 | }; | 29 | }; |
50 | 30 | ||
51 | /* | ||
52 | * DMI callbacks for problem boards | ||
53 | */ | ||
54 | struct dmi_strmatch { | ||
55 | u8 slot; | ||
56 | char *substr; | ||
57 | }; | ||
58 | |||
59 | struct dmi_system_id { | ||
60 | int (*callback)(const struct dmi_system_id *); | ||
61 | const char *ident; | ||
62 | struct dmi_strmatch matches[4]; | ||
63 | void *driver_data; | ||
64 | }; | ||
65 | |||
66 | #define DMI_MATCH(a, b) { a, b } | ||
67 | |||
68 | struct dmi_device { | 31 | struct dmi_device { |
69 | struct list_head list; | 32 | struct list_head list; |
70 | int type; | 33 | int type; |
diff --git a/include/linux/ds1286.h b/include/linux/ds1286.h index d8989860e4ce..45ea0aa0aeb9 100644 --- a/include/linux/ds1286.h +++ b/include/linux/ds1286.h | |||
@@ -8,8 +8,6 @@ | |||
8 | #ifndef __LINUX_DS1286_H | 8 | #ifndef __LINUX_DS1286_H |
9 | #define __LINUX_DS1286_H | 9 | #define __LINUX_DS1286_H |
10 | 10 | ||
11 | #include <asm/ds1286.h> | ||
12 | |||
13 | /********************************************************************** | 11 | /********************************************************************** |
14 | * register summary | 12 | * register summary |
15 | **********************************************************************/ | 13 | **********************************************************************/ |
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h index c8cbd90ba375..79a8ed8e6a7d 100644 --- a/include/linux/dvb/frontend.h +++ b/include/linux/dvb/frontend.h | |||
@@ -62,6 +62,7 @@ typedef enum fe_caps { | |||
62 | FE_CAN_HIERARCHY_AUTO = 0x100000, | 62 | FE_CAN_HIERARCHY_AUTO = 0x100000, |
63 | FE_CAN_8VSB = 0x200000, | 63 | FE_CAN_8VSB = 0x200000, |
64 | FE_CAN_16VSB = 0x400000, | 64 | FE_CAN_16VSB = 0x400000, |
65 | FE_HAS_EXTENDED_CAPS = 0x800000, // We need more bitspace for newer APIs, indicate this. | ||
65 | FE_NEEDS_BENDING = 0x20000000, // not supported anymore, don't use (frontend requires frequency bending) | 66 | FE_NEEDS_BENDING = 0x20000000, // not supported anymore, don't use (frontend requires frequency bending) |
66 | FE_CAN_RECOVER = 0x40000000, // frontend can recover from a cable unplug automatically | 67 | FE_CAN_RECOVER = 0x40000000, // frontend can recover from a cable unplug automatically |
67 | FE_CAN_MUTE_TS = 0x80000000 // frontend can stop spurious TS data output | 68 | FE_CAN_MUTE_TS = 0x80000000 // frontend can stop spurious TS data output |
@@ -147,7 +148,9 @@ typedef enum fe_code_rate { | |||
147 | FEC_6_7, | 148 | FEC_6_7, |
148 | FEC_7_8, | 149 | FEC_7_8, |
149 | FEC_8_9, | 150 | FEC_8_9, |
150 | FEC_AUTO | 151 | FEC_AUTO, |
152 | FEC_3_5, | ||
153 | FEC_9_10, | ||
151 | } fe_code_rate_t; | 154 | } fe_code_rate_t; |
152 | 155 | ||
153 | 156 | ||
@@ -160,7 +163,11 @@ typedef enum fe_modulation { | |||
160 | QAM_256, | 163 | QAM_256, |
161 | QAM_AUTO, | 164 | QAM_AUTO, |
162 | VSB_8, | 165 | VSB_8, |
163 | VSB_16 | 166 | VSB_16, |
167 | PSK_8, | ||
168 | APSK_16, | ||
169 | APSK_32, | ||
170 | DQPSK, | ||
164 | } fe_modulation_t; | 171 | } fe_modulation_t; |
165 | 172 | ||
166 | typedef enum fe_transmit_mode { | 173 | typedef enum fe_transmit_mode { |
@@ -239,6 +246,107 @@ struct dvb_frontend_event { | |||
239 | struct dvb_frontend_parameters parameters; | 246 | struct dvb_frontend_parameters parameters; |
240 | }; | 247 | }; |
241 | 248 | ||
249 | /* S2API Commands */ | ||
250 | #define DTV_UNDEFINED 0 | ||
251 | #define DTV_TUNE 1 | ||
252 | #define DTV_CLEAR 2 | ||
253 | #define DTV_FREQUENCY 3 | ||
254 | #define DTV_MODULATION 4 | ||
255 | #define DTV_BANDWIDTH_HZ 5 | ||
256 | #define DTV_INVERSION 6 | ||
257 | #define DTV_DISEQC_MASTER 7 | ||
258 | #define DTV_SYMBOL_RATE 8 | ||
259 | #define DTV_INNER_FEC 9 | ||
260 | #define DTV_VOLTAGE 10 | ||
261 | #define DTV_TONE 11 | ||
262 | #define DTV_PILOT 12 | ||
263 | #define DTV_ROLLOFF 13 | ||
264 | #define DTV_DISEQC_SLAVE_REPLY 14 | ||
265 | |||
266 | /* Basic enumeration set for querying unlimited capabilities */ | ||
267 | #define DTV_FE_CAPABILITY_COUNT 15 | ||
268 | #define DTV_FE_CAPABILITY 16 | ||
269 | #define DTV_DELIVERY_SYSTEM 17 | ||
270 | |||
271 | #define DTV_API_VERSION 35 | ||
272 | #define DTV_API_VERSION 35 | ||
273 | #define DTV_CODE_RATE_HP 36 | ||
274 | #define DTV_CODE_RATE_LP 37 | ||
275 | #define DTV_GUARD_INTERVAL 38 | ||
276 | #define DTV_TRANSMISSION_MODE 39 | ||
277 | #define DTV_HIERARCHY 40 | ||
278 | |||
279 | #define DTV_MAX_COMMAND DTV_HIERARCHY | ||
280 | |||
281 | typedef enum fe_pilot { | ||
282 | PILOT_ON, | ||
283 | PILOT_OFF, | ||
284 | PILOT_AUTO, | ||
285 | } fe_pilot_t; | ||
286 | |||
287 | typedef enum fe_rolloff { | ||
288 | ROLLOFF_35, /* Implied value in DVB-S, default for DVB-S2 */ | ||
289 | ROLLOFF_20, | ||
290 | ROLLOFF_25, | ||
291 | ROLLOFF_AUTO, | ||
292 | } fe_rolloff_t; | ||
293 | |||
294 | typedef enum fe_delivery_system { | ||
295 | SYS_UNDEFINED, | ||
296 | SYS_DVBC_ANNEX_AC, | ||
297 | SYS_DVBC_ANNEX_B, | ||
298 | SYS_DVBT, | ||
299 | SYS_DSS, | ||
300 | SYS_DVBS, | ||
301 | SYS_DVBS2, | ||
302 | SYS_DVBH, | ||
303 | SYS_ISDBT, | ||
304 | SYS_ISDBS, | ||
305 | SYS_ISDBC, | ||
306 | SYS_ATSC, | ||
307 | SYS_ATSCMH, | ||
308 | SYS_DMBTH, | ||
309 | SYS_CMMB, | ||
310 | SYS_DAB, | ||
311 | } fe_delivery_system_t; | ||
312 | |||
313 | struct dtv_cmds_h { | ||
314 | char *name; /* A display name for debugging purposes */ | ||
315 | |||
316 | __u32 cmd; /* A unique ID */ | ||
317 | |||
318 | /* Flags */ | ||
319 | __u32 set:1; /* Either a set or get property */ | ||
320 | __u32 buffer:1; /* Does this property use the buffer? */ | ||
321 | __u32 reserved:30; /* Align */ | ||
322 | }; | ||
323 | |||
324 | struct dtv_property { | ||
325 | __u32 cmd; | ||
326 | __u32 reserved[3]; | ||
327 | union { | ||
328 | __u32 data; | ||
329 | struct { | ||
330 | __u8 data[32]; | ||
331 | __u32 len; | ||
332 | __u32 reserved1[3]; | ||
333 | void *reserved2; | ||
334 | } buffer; | ||
335 | } u; | ||
336 | int result; | ||
337 | } __attribute__ ((packed)); | ||
338 | |||
339 | /* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */ | ||
340 | #define DTV_IOCTL_MAX_MSGS 64 | ||
341 | |||
342 | struct dtv_properties { | ||
343 | __u32 num; | ||
344 | struct dtv_property *props; | ||
345 | }; | ||
346 | |||
347 | #define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties) | ||
348 | #define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties) | ||
349 | |||
242 | 350 | ||
243 | /** | 351 | /** |
244 | * When set, this flag will disable any zigzagging or other "normal" tuning | 352 | * When set, this flag will disable any zigzagging or other "normal" tuning |
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h index 126e0c26cb09..25b823b81734 100644 --- a/include/linux/dvb/version.h +++ b/include/linux/dvb/version.h | |||
@@ -23,7 +23,7 @@ | |||
23 | #ifndef _DVBVERSION_H_ | 23 | #ifndef _DVBVERSION_H_ |
24 | #define _DVBVERSION_H_ | 24 | #define _DVBVERSION_H_ |
25 | 25 | ||
26 | #define DVB_API_VERSION 3 | 26 | #define DVB_API_VERSION 5 |
27 | #define DVB_API_VERSION_MINOR 2 | 27 | #define DVB_API_VERSION_MINOR 0 |
28 | 28 | ||
29 | #endif /*_DVBVERSION_H_*/ | 29 | #endif /*_DVBVERSION_H_*/ |
diff --git a/include/linux/dynamic_printk.h b/include/linux/dynamic_printk.h new file mode 100644 index 000000000000..2d528d009074 --- /dev/null +++ b/include/linux/dynamic_printk.h | |||
@@ -0,0 +1,93 @@ | |||
1 | #ifndef _DYNAMIC_PRINTK_H | ||
2 | #define _DYNAMIC_PRINTK_H | ||
3 | |||
4 | #define DYNAMIC_DEBUG_HASH_BITS 6 | ||
5 | #define DEBUG_HASH_TABLE_SIZE (1 << DYNAMIC_DEBUG_HASH_BITS) | ||
6 | |||
7 | #define TYPE_BOOLEAN 1 | ||
8 | |||
9 | #define DYNAMIC_ENABLED_ALL 0 | ||
10 | #define DYNAMIC_ENABLED_NONE 1 | ||
11 | #define DYNAMIC_ENABLED_SOME 2 | ||
12 | |||
13 | extern int dynamic_enabled; | ||
14 | |||
15 | /* dynamic_printk_enabled, and dynamic_printk_enabled2 are bitmasks in which | ||
16 | * bit n is set to 1 if any modname hashes into the bucket n, 0 otherwise. They | ||
17 | * use independent hash functions, to reduce the chance of false positives. | ||
18 | */ | ||
19 | extern long long dynamic_printk_enabled; | ||
20 | extern long long dynamic_printk_enabled2; | ||
21 | |||
22 | struct mod_debug { | ||
23 | char *modname; | ||
24 | char *logical_modname; | ||
25 | char *flag_names; | ||
26 | int type; | ||
27 | int hash; | ||
28 | int hash2; | ||
29 | } __attribute__((aligned(8))); | ||
30 | |||
31 | int register_dynamic_debug_module(char *mod_name, int type, char *share_name, | ||
32 | char *flags, int hash, int hash2); | ||
33 | |||
34 | #if defined(CONFIG_DYNAMIC_PRINTK_DEBUG) | ||
35 | extern int unregister_dynamic_debug_module(char *mod_name); | ||
36 | extern int __dynamic_dbg_enabled_helper(char *modname, int type, | ||
37 | int value, int hash); | ||
38 | |||
39 | #define __dynamic_dbg_enabled(module, type, value, level, hash) ({ \ | ||
40 | int __ret = 0; \ | ||
41 | if (unlikely((dynamic_printk_enabled & (1LL << DEBUG_HASH)) && \ | ||
42 | (dynamic_printk_enabled2 & (1LL << DEBUG_HASH2)))) \ | ||
43 | __ret = __dynamic_dbg_enabled_helper(module, type, \ | ||
44 | value, hash);\ | ||
45 | __ret; }) | ||
46 | |||
47 | #define dynamic_pr_debug(fmt, ...) do { \ | ||
48 | static char mod_name[] \ | ||
49 | __attribute__((section("__verbose_strings"))) \ | ||
50 | = KBUILD_MODNAME; \ | ||
51 | static struct mod_debug descriptor \ | ||
52 | __used \ | ||
53 | __attribute__((section("__verbose"), aligned(8))) = \ | ||
54 | { mod_name, mod_name, NULL, TYPE_BOOLEAN, DEBUG_HASH, DEBUG_HASH2 };\ | ||
55 | if (__dynamic_dbg_enabled(KBUILD_MODNAME, TYPE_BOOLEAN, \ | ||
56 | 0, 0, DEBUG_HASH)) \ | ||
57 | printk(KERN_DEBUG KBUILD_MODNAME ":" fmt, \ | ||
58 | ##__VA_ARGS__); \ | ||
59 | } while (0) | ||
60 | |||
61 | #define dynamic_dev_dbg(dev, format, ...) do { \ | ||
62 | static char mod_name[] \ | ||
63 | __attribute__((section("__verbose_strings"))) \ | ||
64 | = KBUILD_MODNAME; \ | ||
65 | static struct mod_debug descriptor \ | ||
66 | __used \ | ||
67 | __attribute__((section("__verbose"), aligned(8))) = \ | ||
68 | { mod_name, mod_name, NULL, TYPE_BOOLEAN, DEBUG_HASH, DEBUG_HASH2 };\ | ||
69 | if (__dynamic_dbg_enabled(KBUILD_MODNAME, TYPE_BOOLEAN, \ | ||
70 | 0, 0, DEBUG_HASH)) \ | ||
71 | dev_printk(KERN_DEBUG, dev, \ | ||
72 | KBUILD_MODNAME ": " format, \ | ||
73 | ##__VA_ARGS__); \ | ||
74 | } while (0) | ||
75 | |||
76 | #else | ||
77 | |||
78 | static inline int unregister_dynamic_debug_module(const char *mod_name) | ||
79 | { | ||
80 | return 0; | ||
81 | } | ||
82 | static inline int __dynamic_dbg_enabled_helper(char *modname, int type, | ||
83 | int value, int hash) | ||
84 | { | ||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | #define __dynamic_dbg_enabled(module, type, value, level, hash) ({ 0; }) | ||
89 | #define dynamic_pr_debug(fmt, ...) do { } while (0) | ||
90 | #define dynamic_dev_dbg(dev, format, ...) do { } while (0) | ||
91 | #endif | ||
92 | |||
93 | #endif | ||
diff --git a/include/linux/efi.h b/include/linux/efi.h index 807373d467f7..bb66feb164bd 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
@@ -208,6 +208,9 @@ typedef efi_status_t efi_set_virtual_address_map_t (unsigned long memory_map_siz | |||
208 | #define EFI_GLOBAL_VARIABLE_GUID \ | 208 | #define EFI_GLOBAL_VARIABLE_GUID \ |
209 | EFI_GUID( 0x8be4df61, 0x93ca, 0x11d2, 0xaa, 0x0d, 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c ) | 209 | EFI_GUID( 0x8be4df61, 0x93ca, 0x11d2, 0xaa, 0x0d, 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c ) |
210 | 210 | ||
211 | #define UV_SYSTEM_TABLE_GUID \ | ||
212 | EFI_GUID( 0x3b13a7d4, 0x633e, 0x11dd, 0x93, 0xec, 0xda, 0x25, 0x56, 0xd8, 0x95, 0x93 ) | ||
213 | |||
211 | typedef struct { | 214 | typedef struct { |
212 | efi_guid_t guid; | 215 | efi_guid_t guid; |
213 | unsigned long table; | 216 | unsigned long table; |
@@ -255,6 +258,7 @@ extern struct efi { | |||
255 | unsigned long boot_info; /* boot info table */ | 258 | unsigned long boot_info; /* boot info table */ |
256 | unsigned long hcdp; /* HCDP table */ | 259 | unsigned long hcdp; /* HCDP table */ |
257 | unsigned long uga; /* UGA table */ | 260 | unsigned long uga; /* UGA table */ |
261 | unsigned long uv_systab; /* UV system table */ | ||
258 | efi_get_time_t *get_time; | 262 | efi_get_time_t *get_time; |
259 | efi_set_time_t *set_time; | 263 | efi_set_time_t *set_time; |
260 | efi_get_wakeup_time_t *get_wakeup_time; | 264 | efi_get_wakeup_time_t *get_wakeup_time; |
diff --git a/include/linux/elevator.h b/include/linux/elevator.h index 639624b55fbe..92f6f634e3e6 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h | |||
@@ -112,6 +112,7 @@ extern struct request *elv_latter_request(struct request_queue *, struct request | |||
112 | extern int elv_register_queue(struct request_queue *q); | 112 | extern int elv_register_queue(struct request_queue *q); |
113 | extern void elv_unregister_queue(struct request_queue *q); | 113 | extern void elv_unregister_queue(struct request_queue *q); |
114 | extern int elv_may_queue(struct request_queue *, int); | 114 | extern int elv_may_queue(struct request_queue *, int); |
115 | extern void elv_abort_queue(struct request_queue *); | ||
115 | extern void elv_completed_request(struct request_queue *, struct request *); | 116 | extern void elv_completed_request(struct request_queue *, struct request *); |
116 | extern int elv_set_request(struct request_queue *, struct request *, gfp_t); | 117 | extern int elv_set_request(struct request_queue *, struct request *, gfp_t); |
117 | extern void elv_put_request(struct request_queue *, struct request *); | 118 | extern void elv_put_request(struct request_queue *, struct request *); |
@@ -173,15 +174,15 @@ enum { | |||
173 | #define rb_entry_rq(node) rb_entry((node), struct request, rb_node) | 174 | #define rb_entry_rq(node) rb_entry((node), struct request, rb_node) |
174 | 175 | ||
175 | /* | 176 | /* |
176 | * Hack to reuse the donelist list_head as the fifo time holder while | 177 | * Hack to reuse the csd.list list_head as the fifo time holder while |
177 | * the request is in the io scheduler. Saves an unsigned long in rq. | 178 | * the request is in the io scheduler. Saves an unsigned long in rq. |
178 | */ | 179 | */ |
179 | #define rq_fifo_time(rq) ((unsigned long) (rq)->donelist.next) | 180 | #define rq_fifo_time(rq) ((unsigned long) (rq)->csd.list.next) |
180 | #define rq_set_fifo_time(rq,exp) ((rq)->donelist.next = (void *) (exp)) | 181 | #define rq_set_fifo_time(rq,exp) ((rq)->csd.list.next = (void *) (exp)) |
181 | #define rq_entry_fifo(ptr) list_entry((ptr), struct request, queuelist) | 182 | #define rq_entry_fifo(ptr) list_entry((ptr), struct request, queuelist) |
182 | #define rq_fifo_clear(rq) do { \ | 183 | #define rq_fifo_clear(rq) do { \ |
183 | list_del_init(&(rq)->queuelist); \ | 184 | list_del_init(&(rq)->queuelist); \ |
184 | INIT_LIST_HEAD(&(rq)->donelist); \ | 185 | INIT_LIST_HEAD(&(rq)->csd.list); \ |
185 | } while (0) | 186 | } while (0) |
186 | 187 | ||
187 | /* | 188 | /* |
diff --git a/include/linux/elf.h b/include/linux/elf.h index edc3dac3f02f..0b61ca41a044 100644 --- a/include/linux/elf.h +++ b/include/linux/elf.h | |||
@@ -360,6 +360,7 @@ typedef struct elf64_shdr { | |||
360 | #define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ | 360 | #define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ |
361 | #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ | 361 | #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ |
362 | #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ | 362 | #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ |
363 | #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ | ||
363 | 364 | ||
364 | 365 | ||
365 | /* Note header in a PT_NOTE section */ | 366 | /* Note header in a PT_NOTE section */ |
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h index 2efe7b863cff..78c775a83f7c 100644 --- a/include/linux/ext2_fs.h +++ b/include/linux/ext2_fs.h | |||
@@ -47,7 +47,7 @@ | |||
47 | #ifdef EXT2FS_DEBUG | 47 | #ifdef EXT2FS_DEBUG |
48 | # define ext2_debug(f, a...) { \ | 48 | # define ext2_debug(f, a...) { \ |
49 | printk ("EXT2-fs DEBUG (%s, %d): %s:", \ | 49 | printk ("EXT2-fs DEBUG (%s, %d): %s:", \ |
50 | __FILE__, __LINE__, __FUNCTION__); \ | 50 | __FILE__, __LINE__, __func__); \ |
51 | printk (f, ## a); \ | 51 | printk (f, ## a); \ |
52 | } | 52 | } |
53 | #else | 53 | #else |
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index 80171ee89a22..d14f02918483 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h | |||
@@ -43,7 +43,7 @@ | |||
43 | #define ext3_debug(f, a...) \ | 43 | #define ext3_debug(f, a...) \ |
44 | do { \ | 44 | do { \ |
45 | printk (KERN_DEBUG "EXT3-fs DEBUG (%s, %d): %s:", \ | 45 | printk (KERN_DEBUG "EXT3-fs DEBUG (%s, %d): %s:", \ |
46 | __FILE__, __LINE__, __FUNCTION__); \ | 46 | __FILE__, __LINE__, __func__); \ |
47 | printk (KERN_DEBUG f, ## a); \ | 47 | printk (KERN_DEBUG f, ## a); \ |
48 | } while (0) | 48 | } while (0) |
49 | #else | 49 | #else |
@@ -380,6 +380,8 @@ struct ext3_inode { | |||
380 | #define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */ | 380 | #define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */ |
381 | #define EXT3_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ | 381 | #define EXT3_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ |
382 | #define EXT3_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ | 382 | #define EXT3_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ |
383 | #define EXT3_MOUNT_DATA_ERR_ABORT 0x400000 /* Abort on file data write | ||
384 | * error in ordered mode */ | ||
383 | 385 | ||
384 | /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */ | 386 | /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */ |
385 | #ifndef _LINUX_EXT2_FS_H | 387 | #ifndef _LINUX_EXT2_FS_H |
@@ -837,6 +839,8 @@ extern void ext3_truncate (struct inode *); | |||
837 | extern void ext3_set_inode_flags(struct inode *); | 839 | extern void ext3_set_inode_flags(struct inode *); |
838 | extern void ext3_get_inode_flags(struct ext3_inode_info *); | 840 | extern void ext3_get_inode_flags(struct ext3_inode_info *); |
839 | extern void ext3_set_aops(struct inode *inode); | 841 | extern void ext3_set_aops(struct inode *inode); |
842 | extern int ext3_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | ||
843 | u64 start, u64 len); | ||
840 | 844 | ||
841 | /* ioctl.c */ | 845 | /* ioctl.c */ |
842 | extern int ext3_ioctl (struct inode *, struct file *, unsigned int, | 846 | extern int ext3_ioctl (struct inode *, struct file *, unsigned int, |
@@ -869,7 +873,7 @@ extern void ext3_update_dynamic_rev (struct super_block *sb); | |||
869 | #define ext3_std_error(sb, errno) \ | 873 | #define ext3_std_error(sb, errno) \ |
870 | do { \ | 874 | do { \ |
871 | if ((errno)) \ | 875 | if ((errno)) \ |
872 | __ext3_std_error((sb), __FUNCTION__, (errno)); \ | 876 | __ext3_std_error((sb), __func__, (errno)); \ |
873 | } while (0) | 877 | } while (0) |
874 | 878 | ||
875 | /* | 879 | /* |
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h index 8c43b13a02fe..cf82d519be40 100644 --- a/include/linux/ext3_jbd.h +++ b/include/linux/ext3_jbd.h | |||
@@ -137,17 +137,17 @@ int __ext3_journal_dirty_metadata(const char *where, | |||
137 | handle_t *handle, struct buffer_head *bh); | 137 | handle_t *handle, struct buffer_head *bh); |
138 | 138 | ||
139 | #define ext3_journal_get_undo_access(handle, bh) \ | 139 | #define ext3_journal_get_undo_access(handle, bh) \ |
140 | __ext3_journal_get_undo_access(__FUNCTION__, (handle), (bh)) | 140 | __ext3_journal_get_undo_access(__func__, (handle), (bh)) |
141 | #define ext3_journal_get_write_access(handle, bh) \ | 141 | #define ext3_journal_get_write_access(handle, bh) \ |
142 | __ext3_journal_get_write_access(__FUNCTION__, (handle), (bh)) | 142 | __ext3_journal_get_write_access(__func__, (handle), (bh)) |
143 | #define ext3_journal_revoke(handle, blocknr, bh) \ | 143 | #define ext3_journal_revoke(handle, blocknr, bh) \ |
144 | __ext3_journal_revoke(__FUNCTION__, (handle), (blocknr), (bh)) | 144 | __ext3_journal_revoke(__func__, (handle), (blocknr), (bh)) |
145 | #define ext3_journal_get_create_access(handle, bh) \ | 145 | #define ext3_journal_get_create_access(handle, bh) \ |
146 | __ext3_journal_get_create_access(__FUNCTION__, (handle), (bh)) | 146 | __ext3_journal_get_create_access(__func__, (handle), (bh)) |
147 | #define ext3_journal_dirty_metadata(handle, bh) \ | 147 | #define ext3_journal_dirty_metadata(handle, bh) \ |
148 | __ext3_journal_dirty_metadata(__FUNCTION__, (handle), (bh)) | 148 | __ext3_journal_dirty_metadata(__func__, (handle), (bh)) |
149 | #define ext3_journal_forget(handle, bh) \ | 149 | #define ext3_journal_forget(handle, bh) \ |
150 | __ext3_journal_forget(__FUNCTION__, (handle), (bh)) | 150 | __ext3_journal_forget(__func__, (handle), (bh)) |
151 | 151 | ||
152 | int ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh); | 152 | int ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh); |
153 | 153 | ||
@@ -160,7 +160,7 @@ static inline handle_t *ext3_journal_start(struct inode *inode, int nblocks) | |||
160 | } | 160 | } |
161 | 161 | ||
162 | #define ext3_journal_stop(handle) \ | 162 | #define ext3_journal_stop(handle) \ |
163 | __ext3_journal_stop(__FUNCTION__, (handle)) | 163 | __ext3_journal_stop(__func__, (handle)) |
164 | 164 | ||
165 | static inline handle_t *ext3_journal_current_handle(void) | 165 | static inline handle_t *ext3_journal_current_handle(void) |
166 | { | 166 | { |
diff --git a/include/linux/fb.h b/include/linux/fb.h index 531ccd5f5960..75a81eaf3430 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
@@ -808,6 +808,7 @@ struct fb_tile_ops { | |||
808 | struct fb_info { | 808 | struct fb_info { |
809 | int node; | 809 | int node; |
810 | int flags; | 810 | int flags; |
811 | struct mutex lock; /* Lock for open/release/ioctl funcs */ | ||
811 | struct fb_var_screeninfo var; /* Current var */ | 812 | struct fb_var_screeninfo var; /* Current var */ |
812 | struct fb_fix_screeninfo fix; /* Current fix */ | 813 | struct fb_fix_screeninfo fix; /* Current fix */ |
813 | struct fb_monspecs monspecs; /* Current Monitor specs */ | 814 | struct fb_monspecs monspecs; /* Current Monitor specs */ |
diff --git a/include/linux/fd.h b/include/linux/fd.h index b6bd41d2b460..f5d194af07a8 100644 --- a/include/linux/fd.h +++ b/include/linux/fd.h | |||
@@ -15,10 +15,16 @@ struct floppy_struct { | |||
15 | sect, /* sectors per track */ | 15 | sect, /* sectors per track */ |
16 | head, /* nr of heads */ | 16 | head, /* nr of heads */ |
17 | track, /* nr of tracks */ | 17 | track, /* nr of tracks */ |
18 | stretch; /* !=0 means double track steps */ | 18 | stretch; /* bit 0 !=0 means double track steps */ |
19 | /* bit 1 != 0 means swap sides */ | ||
20 | /* bits 2..9 give the first sector */ | ||
21 | /* number (the LSB is flipped) */ | ||
19 | #define FD_STRETCH 1 | 22 | #define FD_STRETCH 1 |
20 | #define FD_SWAPSIDES 2 | 23 | #define FD_SWAPSIDES 2 |
21 | #define FD_ZEROBASED 4 | 24 | #define FD_ZEROBASED 4 |
25 | #define FD_SECTBASEMASK 0x3FC | ||
26 | #define FD_MKSECTBASE(s) (((s) ^ 1) << 2) | ||
27 | #define FD_SECTBASE(floppy) ((((floppy)->stretch & FD_SECTBASEMASK) >> 2) ^ 1) | ||
22 | 28 | ||
23 | unsigned char gap, /* gap1 size */ | 29 | unsigned char gap, /* gap1 size */ |
24 | 30 | ||
diff --git a/include/linux/fiemap.h b/include/linux/fiemap.h new file mode 100644 index 000000000000..671decbd2aeb --- /dev/null +++ b/include/linux/fiemap.h | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | * FS_IOC_FIEMAP ioctl infrastructure. | ||
3 | * | ||
4 | * Some portions copyright (C) 2007 Cluster File Systems, Inc | ||
5 | * | ||
6 | * Authors: Mark Fasheh <mfasheh@suse.com> | ||
7 | * Kalpak Shah <kalpak.shah@sun.com> | ||
8 | * Andreas Dilger <adilger@sun.com> | ||
9 | */ | ||
10 | |||
11 | #ifndef _LINUX_FIEMAP_H | ||
12 | #define _LINUX_FIEMAP_H | ||
13 | |||
14 | struct fiemap_extent { | ||
15 | __u64 fe_logical; /* logical offset in bytes for the start of | ||
16 | * the extent from the beginning of the file */ | ||
17 | __u64 fe_physical; /* physical offset in bytes for the start | ||
18 | * of the extent from the beginning of the disk */ | ||
19 | __u64 fe_length; /* length in bytes for this extent */ | ||
20 | __u64 fe_reserved64[2]; | ||
21 | __u32 fe_flags; /* FIEMAP_EXTENT_* flags for this extent */ | ||
22 | __u32 fe_reserved[3]; | ||
23 | }; | ||
24 | |||
25 | struct fiemap { | ||
26 | __u64 fm_start; /* logical offset (inclusive) at | ||
27 | * which to start mapping (in) */ | ||
28 | __u64 fm_length; /* logical length of mapping which | ||
29 | * userspace wants (in) */ | ||
30 | __u32 fm_flags; /* FIEMAP_FLAG_* flags for request (in/out) */ | ||
31 | __u32 fm_mapped_extents;/* number of extents that were mapped (out) */ | ||
32 | __u32 fm_extent_count; /* size of fm_extents array (in) */ | ||
33 | __u32 fm_reserved; | ||
34 | struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */ | ||
35 | }; | ||
36 | |||
37 | #define FIEMAP_MAX_OFFSET (~0ULL) | ||
38 | |||
39 | #define FIEMAP_FLAG_SYNC 0x00000001 /* sync file data before map */ | ||
40 | #define FIEMAP_FLAG_XATTR 0x00000002 /* map extended attribute tree */ | ||
41 | |||
42 | #define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR) | ||
43 | |||
44 | #define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent in file. */ | ||
45 | #define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data location unknown. */ | ||
46 | #define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location still pending. | ||
47 | * Sets EXTENT_UNKNOWN. */ | ||
48 | #define FIEMAP_EXTENT_ENCODED 0x00000008 /* Data can not be read | ||
49 | * while fs is unmounted */ | ||
50 | #define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs. | ||
51 | * Sets EXTENT_NO_BYPASS. */ | ||
52 | #define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be | ||
53 | * block aligned. */ | ||
54 | #define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata. | ||
55 | * Sets EXTENT_NOT_ALIGNED.*/ | ||
56 | #define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block. | ||
57 | * Sets EXTENT_NOT_ALIGNED.*/ | ||
58 | #define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but | ||
59 | * no data (i.e. zero). */ | ||
60 | #define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively | ||
61 | * support extents. Result | ||
62 | * merged for efficiency. */ | ||
63 | |||
64 | #endif /* _LINUX_FIEMAP_H */ | ||
diff --git a/include/linux/file.h b/include/linux/file.h index a20259e248a5..335a0a5c316e 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
@@ -19,10 +19,10 @@ struct file_operations; | |||
19 | struct vfsmount; | 19 | struct vfsmount; |
20 | struct dentry; | 20 | struct dentry; |
21 | extern int init_file(struct file *, struct vfsmount *mnt, | 21 | extern int init_file(struct file *, struct vfsmount *mnt, |
22 | struct dentry *dentry, mode_t mode, | 22 | struct dentry *dentry, fmode_t mode, |
23 | const struct file_operations *fop); | 23 | const struct file_operations *fop); |
24 | extern struct file *alloc_file(struct vfsmount *, struct dentry *dentry, | 24 | extern struct file *alloc_file(struct vfsmount *, struct dentry *dentry, |
25 | mode_t mode, const struct file_operations *fop); | 25 | fmode_t mode, const struct file_operations *fop); |
26 | 26 | ||
27 | static inline void fput_light(struct file *file, int fput_needed) | 27 | static inline void fput_light(struct file *file, int fput_needed) |
28 | { | 28 | { |
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h index 0f0e271f97fa..4d078e99c017 100644 --- a/include/linux/firewire-cdev.h +++ b/include/linux/firewire-cdev.h | |||
@@ -154,8 +154,13 @@ struct fw_cdev_event_iso_interrupt { | |||
154 | * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST | 154 | * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST |
155 | * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT | 155 | * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT |
156 | * | 156 | * |
157 | * Convenience union for userspace use. Events could be read(2) into a char | 157 | * Convenience union for userspace use. Events could be read(2) into an |
158 | * buffer and then cast to this union for further processing. | 158 | * appropriately aligned char buffer and then cast to this union for further |
159 | * processing. Note that for a request, response or iso_interrupt event, | ||
160 | * the data[] or header[] may make the size of the full event larger than | ||
161 | * sizeof(union fw_cdev_event). Also note that if you attempt to read(2) | ||
162 | * an event into a buffer that is not large enough for it, the data that does | ||
163 | * not fit will be discarded so that the next read(2) will return a new event. | ||
159 | */ | 164 | */ |
160 | union fw_cdev_event { | 165 | union fw_cdev_event { |
161 | struct fw_cdev_event_common common; | 166 | struct fw_cdev_event_common common; |
diff --git a/include/linux/freezer.h b/include/linux/freezer.h index deddeedf3257..5a361f85cfec 100644 --- a/include/linux/freezer.h +++ b/include/linux/freezer.h | |||
@@ -6,7 +6,7 @@ | |||
6 | #include <linux/sched.h> | 6 | #include <linux/sched.h> |
7 | #include <linux/wait.h> | 7 | #include <linux/wait.h> |
8 | 8 | ||
9 | #ifdef CONFIG_PM_SLEEP | 9 | #ifdef CONFIG_FREEZER |
10 | /* | 10 | /* |
11 | * Check if a process has been frozen | 11 | * Check if a process has been frozen |
12 | */ | 12 | */ |
@@ -39,29 +39,14 @@ static inline void clear_freeze_flag(struct task_struct *p) | |||
39 | clear_tsk_thread_flag(p, TIF_FREEZE); | 39 | clear_tsk_thread_flag(p, TIF_FREEZE); |
40 | } | 40 | } |
41 | 41 | ||
42 | /* | 42 | static inline bool should_send_signal(struct task_struct *p) |
43 | * Wake up a frozen process | ||
44 | * | ||
45 | * task_lock() is taken to prevent the race with refrigerator() which may | ||
46 | * occur if the freezing of tasks fails. Namely, without the lock, if the | ||
47 | * freezing of tasks failed, thaw_tasks() might have run before a task in | ||
48 | * refrigerator() could call frozen_process(), in which case the task would be | ||
49 | * frozen and no one would thaw it. | ||
50 | */ | ||
51 | static inline int thaw_process(struct task_struct *p) | ||
52 | { | 43 | { |
53 | task_lock(p); | 44 | return !(p->flags & PF_FREEZER_NOSIG); |
54 | if (frozen(p)) { | ||
55 | p->flags &= ~PF_FROZEN; | ||
56 | task_unlock(p); | ||
57 | wake_up_process(p); | ||
58 | return 1; | ||
59 | } | ||
60 | clear_freeze_flag(p); | ||
61 | task_unlock(p); | ||
62 | return 0; | ||
63 | } | 45 | } |
64 | 46 | ||
47 | /* Takes and releases task alloc lock using task_lock() */ | ||
48 | extern int thaw_process(struct task_struct *p); | ||
49 | |||
65 | extern void refrigerator(void); | 50 | extern void refrigerator(void); |
66 | extern int freeze_processes(void); | 51 | extern int freeze_processes(void); |
67 | extern void thaw_processes(void); | 52 | extern void thaw_processes(void); |
@@ -75,6 +60,15 @@ static inline int try_to_freeze(void) | |||
75 | return 0; | 60 | return 0; |
76 | } | 61 | } |
77 | 62 | ||
63 | extern bool freeze_task(struct task_struct *p, bool sig_only); | ||
64 | extern void cancel_freezing(struct task_struct *p); | ||
65 | |||
66 | #ifdef CONFIG_CGROUP_FREEZER | ||
67 | extern int cgroup_frozen(struct task_struct *task); | ||
68 | #else /* !CONFIG_CGROUP_FREEZER */ | ||
69 | static inline int cgroup_frozen(struct task_struct *task) { return 0; } | ||
70 | #endif /* !CONFIG_CGROUP_FREEZER */ | ||
71 | |||
78 | /* | 72 | /* |
79 | * The PF_FREEZER_SKIP flag should be set by a vfork parent right before it | 73 | * The PF_FREEZER_SKIP flag should be set by a vfork parent right before it |
80 | * calls wait_for_completion(&vfork) and reset right after it returns from this | 74 | * calls wait_for_completion(&vfork) and reset right after it returns from this |
@@ -166,7 +160,7 @@ static inline void set_freezable_with_signal(void) | |||
166 | } while (try_to_freeze()); \ | 160 | } while (try_to_freeze()); \ |
167 | __retval; \ | 161 | __retval; \ |
168 | }) | 162 | }) |
169 | #else /* !CONFIG_PM_SLEEP */ | 163 | #else /* !CONFIG_FREEZER */ |
170 | static inline int frozen(struct task_struct *p) { return 0; } | 164 | static inline int frozen(struct task_struct *p) { return 0; } |
171 | static inline int freezing(struct task_struct *p) { return 0; } | 165 | static inline int freezing(struct task_struct *p) { return 0; } |
172 | static inline void set_freeze_flag(struct task_struct *p) {} | 166 | static inline void set_freeze_flag(struct task_struct *p) {} |
@@ -191,6 +185,6 @@ static inline void set_freezable_with_signal(void) {} | |||
191 | #define wait_event_freezable_timeout(wq, condition, timeout) \ | 185 | #define wait_event_freezable_timeout(wq, condition, timeout) \ |
192 | wait_event_interruptible_timeout(wq, condition, timeout) | 186 | wait_event_interruptible_timeout(wq, condition, timeout) |
193 | 187 | ||
194 | #endif /* !CONFIG_PM_SLEEP */ | 188 | #endif /* !CONFIG_FREEZER */ |
195 | 189 | ||
196 | #endif /* FREEZER_H_INCLUDED */ | 190 | #endif /* FREEZER_H_INCLUDED */ |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 580b513668fe..0dcdd9458f4b 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -63,18 +63,23 @@ extern int dir_notify_enable; | |||
63 | #define MAY_ACCESS 16 | 63 | #define MAY_ACCESS 16 |
64 | #define MAY_OPEN 32 | 64 | #define MAY_OPEN 32 |
65 | 65 | ||
66 | #define FMODE_READ 1 | 66 | #define FMODE_READ ((__force fmode_t)1) |
67 | #define FMODE_WRITE 2 | 67 | #define FMODE_WRITE ((__force fmode_t)2) |
68 | 68 | ||
69 | /* Internal kernel extensions */ | 69 | /* Internal kernel extensions */ |
70 | #define FMODE_LSEEK 4 | 70 | #define FMODE_LSEEK ((__force fmode_t)4) |
71 | #define FMODE_PREAD 8 | 71 | #define FMODE_PREAD ((__force fmode_t)8) |
72 | #define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */ | 72 | #define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */ |
73 | 73 | ||
74 | /* File is being opened for execution. Primary users of this flag are | 74 | /* File is being opened for execution. Primary users of this flag are |
75 | distributed filesystems that can use it to achieve correct ETXTBUSY | 75 | distributed filesystems that can use it to achieve correct ETXTBUSY |
76 | behavior for cross-node execution/opening_for_writing of files */ | 76 | behavior for cross-node execution/opening_for_writing of files */ |
77 | #define FMODE_EXEC 16 | 77 | #define FMODE_EXEC ((__force fmode_t)16) |
78 | |||
79 | #define FMODE_NDELAY ((__force fmode_t)32) | ||
80 | #define FMODE_EXCL ((__force fmode_t)64) | ||
81 | #define FMODE_WRITE_IOCTL ((__force fmode_t)128) | ||
82 | #define FMODE_NDELAY_NOW ((__force fmode_t)256) | ||
78 | 83 | ||
79 | #define RW_MASK 1 | 84 | #define RW_MASK 1 |
80 | #define RWA_MASK 2 | 85 | #define RWA_MASK 2 |
@@ -86,7 +91,9 @@ extern int dir_notify_enable; | |||
86 | #define READ_META (READ | (1 << BIO_RW_META)) | 91 | #define READ_META (READ | (1 << BIO_RW_META)) |
87 | #define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) | 92 | #define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) |
88 | #define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC)) | 93 | #define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC)) |
89 | #define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER)) | 94 | #define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) |
95 | #define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD) | ||
96 | #define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER)) | ||
90 | 97 | ||
91 | #define SEL_IN 1 | 98 | #define SEL_IN 1 |
92 | #define SEL_OUT 2 | 99 | #define SEL_OUT 2 |
@@ -134,7 +141,7 @@ extern int dir_notify_enable; | |||
134 | /* | 141 | /* |
135 | * Superblock flags that can be altered by MS_REMOUNT | 142 | * Superblock flags that can be altered by MS_REMOUNT |
136 | */ | 143 | */ |
137 | #define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK) | 144 | #define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION) |
138 | 145 | ||
139 | /* | 146 | /* |
140 | * Old magic mount flag and mask | 147 | * Old magic mount flag and mask |
@@ -222,6 +229,7 @@ extern int dir_notify_enable; | |||
222 | #define BLKTRACESTART _IO(0x12,116) | 229 | #define BLKTRACESTART _IO(0x12,116) |
223 | #define BLKTRACESTOP _IO(0x12,117) | 230 | #define BLKTRACESTOP _IO(0x12,117) |
224 | #define BLKTRACETEARDOWN _IO(0x12,118) | 231 | #define BLKTRACETEARDOWN _IO(0x12,118) |
232 | #define BLKDISCARD _IO(0x12,119) | ||
225 | 233 | ||
226 | #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ | 234 | #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ |
227 | #define FIBMAP _IO(0x00,1) /* bmap access */ | 235 | #define FIBMAP _IO(0x00,1) /* bmap access */ |
@@ -231,6 +239,7 @@ extern int dir_notify_enable; | |||
231 | #define FS_IOC_SETFLAGS _IOW('f', 2, long) | 239 | #define FS_IOC_SETFLAGS _IOW('f', 2, long) |
232 | #define FS_IOC_GETVERSION _IOR('v', 1, long) | 240 | #define FS_IOC_GETVERSION _IOR('v', 1, long) |
233 | #define FS_IOC_SETVERSION _IOW('v', 2, long) | 241 | #define FS_IOC_SETVERSION _IOW('v', 2, long) |
242 | #define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap) | ||
234 | #define FS_IOC32_GETFLAGS _IOR('f', 1, int) | 243 | #define FS_IOC32_GETFLAGS _IOR('f', 1, int) |
235 | #define FS_IOC32_SETFLAGS _IOW('f', 2, int) | 244 | #define FS_IOC32_SETFLAGS _IOW('f', 2, int) |
236 | #define FS_IOC32_GETVERSION _IOR('v', 1, int) | 245 | #define FS_IOC32_GETVERSION _IOR('v', 1, int) |
@@ -291,6 +300,7 @@ extern int dir_notify_enable; | |||
291 | #include <linux/mutex.h> | 300 | #include <linux/mutex.h> |
292 | #include <linux/capability.h> | 301 | #include <linux/capability.h> |
293 | #include <linux/semaphore.h> | 302 | #include <linux/semaphore.h> |
303 | #include <linux/fiemap.h> | ||
294 | 304 | ||
295 | #include <asm/atomic.h> | 305 | #include <asm/atomic.h> |
296 | #include <asm/byteorder.h> | 306 | #include <asm/byteorder.h> |
@@ -479,13 +489,6 @@ struct address_space_operations { | |||
479 | int (*readpages)(struct file *filp, struct address_space *mapping, | 489 | int (*readpages)(struct file *filp, struct address_space *mapping, |
480 | struct list_head *pages, unsigned nr_pages); | 490 | struct list_head *pages, unsigned nr_pages); |
481 | 491 | ||
482 | /* | ||
483 | * ext3 requires that a successful prepare_write() call be followed | ||
484 | * by a commit_write() call - they must be balanced | ||
485 | */ | ||
486 | int (*prepare_write)(struct file *, struct page *, unsigned, unsigned); | ||
487 | int (*commit_write)(struct file *, struct page *, unsigned, unsigned); | ||
488 | |||
489 | int (*write_begin)(struct file *, struct address_space *mapping, | 492 | int (*write_begin)(struct file *, struct address_space *mapping, |
490 | loff_t pos, unsigned len, unsigned flags, | 493 | loff_t pos, unsigned len, unsigned flags, |
491 | struct page **pagep, void **fsdata); | 494 | struct page **pagep, void **fsdata); |
@@ -820,7 +823,7 @@ struct file { | |||
820 | const struct file_operations *f_op; | 823 | const struct file_operations *f_op; |
821 | atomic_long_t f_count; | 824 | atomic_long_t f_count; |
822 | unsigned int f_flags; | 825 | unsigned int f_flags; |
823 | mode_t f_mode; | 826 | fmode_t f_mode; |
824 | loff_t f_pos; | 827 | loff_t f_pos; |
825 | struct fown_struct f_owner; | 828 | struct fown_struct f_owner; |
826 | unsigned int f_uid, f_gid; | 829 | unsigned int f_uid, f_gid; |
@@ -942,6 +945,14 @@ struct lock_manager_operations { | |||
942 | int (*fl_change)(struct file_lock **, int); | 945 | int (*fl_change)(struct file_lock **, int); |
943 | }; | 946 | }; |
944 | 947 | ||
948 | struct lock_manager { | ||
949 | struct list_head list; | ||
950 | }; | ||
951 | |||
952 | void locks_start_grace(struct lock_manager *); | ||
953 | void locks_end_grace(struct lock_manager *); | ||
954 | int locks_in_grace(void); | ||
955 | |||
945 | /* that will die - we need it for nfs_lock_info */ | 956 | /* that will die - we need it for nfs_lock_info */ |
946 | #include <linux/nfs_fs_i.h> | 957 | #include <linux/nfs_fs_i.h> |
947 | 958 | ||
@@ -983,6 +994,13 @@ struct file_lock { | |||
983 | 994 | ||
984 | #include <linux/fcntl.h> | 995 | #include <linux/fcntl.h> |
985 | 996 | ||
997 | extern void send_sigio(struct fown_struct *fown, int fd, int band); | ||
998 | |||
999 | /* fs/sync.c */ | ||
1000 | extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset, | ||
1001 | loff_t endbyte, unsigned int flags); | ||
1002 | |||
1003 | #ifdef CONFIG_FILE_LOCKING | ||
986 | extern int fcntl_getlk(struct file *, struct flock __user *); | 1004 | extern int fcntl_getlk(struct file *, struct flock __user *); |
987 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, | 1005 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, |
988 | struct flock __user *); | 1006 | struct flock __user *); |
@@ -993,14 +1011,9 @@ extern int fcntl_setlk64(unsigned int, struct file *, unsigned int, | |||
993 | struct flock64 __user *); | 1011 | struct flock64 __user *); |
994 | #endif | 1012 | #endif |
995 | 1013 | ||
996 | extern void send_sigio(struct fown_struct *fown, int fd, int band); | ||
997 | extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); | 1014 | extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); |
998 | extern int fcntl_getlease(struct file *filp); | 1015 | extern int fcntl_getlease(struct file *filp); |
999 | 1016 | ||
1000 | /* fs/sync.c */ | ||
1001 | extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset, | ||
1002 | loff_t endbyte, unsigned int flags); | ||
1003 | |||
1004 | /* fs/locks.c */ | 1017 | /* fs/locks.c */ |
1005 | extern void locks_init_lock(struct file_lock *); | 1018 | extern void locks_init_lock(struct file_lock *); |
1006 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); | 1019 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); |
@@ -1022,7 +1035,37 @@ extern int vfs_setlease(struct file *, long, struct file_lock **); | |||
1022 | extern int lease_modify(struct file_lock **, int); | 1035 | extern int lease_modify(struct file_lock **, int); |
1023 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); | 1036 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); |
1024 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); | 1037 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); |
1025 | extern struct seq_operations locks_seq_operations; | 1038 | #else /* !CONFIG_FILE_LOCKING */ |
1039 | #define fcntl_getlk(a, b) ({ -EINVAL; }) | ||
1040 | #define fcntl_setlk(a, b, c, d) ({ -EACCES; }) | ||
1041 | #if BITS_PER_LONG == 32 | ||
1042 | #define fcntl_getlk64(a, b) ({ -EINVAL; }) | ||
1043 | #define fcntl_setlk64(a, b, c, d) ({ -EACCES; }) | ||
1044 | #endif | ||
1045 | #define fcntl_setlease(a, b, c) ({ 0; }) | ||
1046 | #define fcntl_getlease(a) ({ 0; }) | ||
1047 | #define locks_init_lock(a) ({ }) | ||
1048 | #define __locks_copy_lock(a, b) ({ }) | ||
1049 | #define locks_copy_lock(a, b) ({ }) | ||
1050 | #define locks_remove_posix(a, b) ({ }) | ||
1051 | #define locks_remove_flock(a) ({ }) | ||
1052 | #define posix_test_lock(a, b) ({ 0; }) | ||
1053 | #define posix_lock_file(a, b, c) ({ -ENOLCK; }) | ||
1054 | #define posix_lock_file_wait(a, b) ({ -ENOLCK; }) | ||
1055 | #define posix_unblock_lock(a, b) (-ENOENT) | ||
1056 | #define vfs_test_lock(a, b) ({ 0; }) | ||
1057 | #define vfs_lock_file(a, b, c, d) (-ENOLCK) | ||
1058 | #define vfs_cancel_lock(a, b) ({ 0; }) | ||
1059 | #define flock_lock_file_wait(a, b) ({ -ENOLCK; }) | ||
1060 | #define __break_lease(a, b) ({ 0; }) | ||
1061 | #define lease_get_mtime(a, b) ({ }) | ||
1062 | #define generic_setlease(a, b, c) ({ -EINVAL; }) | ||
1063 | #define vfs_setlease(a, b, c) ({ -EINVAL; }) | ||
1064 | #define lease_modify(a, b) ({ -EINVAL; }) | ||
1065 | #define lock_may_read(a, b, c) ({ 1; }) | ||
1066 | #define lock_may_write(a, b, c) ({ 1; }) | ||
1067 | #endif /* !CONFIG_FILE_LOCKING */ | ||
1068 | |||
1026 | 1069 | ||
1027 | struct fasync_struct { | 1070 | struct fasync_struct { |
1028 | int magic; | 1071 | int magic; |
@@ -1106,6 +1149,7 @@ struct super_block { | |||
1106 | char s_id[32]; /* Informational name */ | 1149 | char s_id[32]; /* Informational name */ |
1107 | 1150 | ||
1108 | void *s_fs_info; /* Filesystem private info */ | 1151 | void *s_fs_info; /* Filesystem private info */ |
1152 | fmode_t s_mode; | ||
1109 | 1153 | ||
1110 | /* | 1154 | /* |
1111 | * The next field is for VFS *only*. No filesystems have any business | 1155 | * The next field is for VFS *only*. No filesystems have any business |
@@ -1179,6 +1223,20 @@ extern void dentry_unhash(struct dentry *dentry); | |||
1179 | extern int file_permission(struct file *, int); | 1223 | extern int file_permission(struct file *, int); |
1180 | 1224 | ||
1181 | /* | 1225 | /* |
1226 | * VFS FS_IOC_FIEMAP helper definitions. | ||
1227 | */ | ||
1228 | struct fiemap_extent_info { | ||
1229 | unsigned int fi_flags; /* Flags as passed from user */ | ||
1230 | unsigned int fi_extents_mapped; /* Number of mapped extents */ | ||
1231 | unsigned int fi_extents_max; /* Size of fiemap_extent array */ | ||
1232 | struct fiemap_extent *fi_extents_start; /* Start of fiemap_extent | ||
1233 | * array */ | ||
1234 | }; | ||
1235 | int fiemap_fill_next_extent(struct fiemap_extent_info *info, u64 logical, | ||
1236 | u64 phys, u64 len, u32 flags); | ||
1237 | int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags); | ||
1238 | |||
1239 | /* | ||
1182 | * File types | 1240 | * File types |
1183 | * | 1241 | * |
1184 | * NOTE! These match bits 12..15 of stat.st_mode | 1242 | * NOTE! These match bits 12..15 of stat.st_mode |
@@ -1206,20 +1264,7 @@ int generic_osync_inode(struct inode *, struct address_space *, int); | |||
1206 | * to have different dirent layouts depending on the binary type. | 1264 | * to have different dirent layouts depending on the binary type. |
1207 | */ | 1265 | */ |
1208 | typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned); | 1266 | typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned); |
1209 | 1267 | struct block_device_operations; | |
1210 | struct block_device_operations { | ||
1211 | int (*open) (struct inode *, struct file *); | ||
1212 | int (*release) (struct inode *, struct file *); | ||
1213 | int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); | ||
1214 | long (*unlocked_ioctl) (struct file *, unsigned, unsigned long); | ||
1215 | long (*compat_ioctl) (struct file *, unsigned, unsigned long); | ||
1216 | int (*direct_access) (struct block_device *, sector_t, | ||
1217 | void **, unsigned long *); | ||
1218 | int (*media_changed) (struct gendisk *); | ||
1219 | int (*revalidate_disk) (struct gendisk *); | ||
1220 | int (*getgeo)(struct block_device *, struct hd_geometry *); | ||
1221 | struct module *owner; | ||
1222 | }; | ||
1223 | 1268 | ||
1224 | /* These macros are for out of kernel modules to test that | 1269 | /* These macros are for out of kernel modules to test that |
1225 | * the kernel supports the unlocked_ioctl and compat_ioctl | 1270 | * the kernel supports the unlocked_ioctl and compat_ioctl |
@@ -1287,6 +1332,8 @@ struct inode_operations { | |||
1287 | void (*truncate_range)(struct inode *, loff_t, loff_t); | 1332 | void (*truncate_range)(struct inode *, loff_t, loff_t); |
1288 | long (*fallocate)(struct inode *inode, int mode, loff_t offset, | 1333 | long (*fallocate)(struct inode *inode, int mode, loff_t offset, |
1289 | loff_t len); | 1334 | loff_t len); |
1335 | int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, | ||
1336 | u64 len); | ||
1290 | }; | 1337 | }; |
1291 | 1338 | ||
1292 | struct seq_file; | 1339 | struct seq_file; |
@@ -1531,7 +1578,6 @@ extern int get_sb_pseudo(struct file_system_type *, char *, | |||
1531 | struct vfsmount *mnt); | 1578 | struct vfsmount *mnt); |
1532 | extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); | 1579 | extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); |
1533 | int __put_super_and_need_restart(struct super_block *sb); | 1580 | int __put_super_and_need_restart(struct super_block *sb); |
1534 | void unnamed_dev_init(void); | ||
1535 | 1581 | ||
1536 | /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ | 1582 | /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ |
1537 | #define fops_get(fops) \ | 1583 | #define fops_get(fops) \ |
@@ -1554,9 +1600,12 @@ extern int vfs_statfs(struct dentry *, struct kstatfs *); | |||
1554 | /* /sys/fs */ | 1600 | /* /sys/fs */ |
1555 | extern struct kobject *fs_kobj; | 1601 | extern struct kobject *fs_kobj; |
1556 | 1602 | ||
1603 | extern int rw_verify_area(int, struct file *, loff_t *, size_t); | ||
1604 | |||
1557 | #define FLOCK_VERIFY_READ 1 | 1605 | #define FLOCK_VERIFY_READ 1 |
1558 | #define FLOCK_VERIFY_WRITE 2 | 1606 | #define FLOCK_VERIFY_WRITE 2 |
1559 | 1607 | ||
1608 | #ifdef CONFIG_FILE_LOCKING | ||
1560 | extern int locks_mandatory_locked(struct inode *); | 1609 | extern int locks_mandatory_locked(struct inode *); |
1561 | extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t); | 1610 | extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t); |
1562 | 1611 | ||
@@ -1587,8 +1636,6 @@ static inline int locks_verify_locked(struct inode *inode) | |||
1587 | return 0; | 1636 | return 0; |
1588 | } | 1637 | } |
1589 | 1638 | ||
1590 | extern int rw_verify_area(int, struct file *, loff_t *, size_t); | ||
1591 | |||
1592 | static inline int locks_verify_truncate(struct inode *inode, | 1639 | static inline int locks_verify_truncate(struct inode *inode, |
1593 | struct file *filp, | 1640 | struct file *filp, |
1594 | loff_t size) | 1641 | loff_t size) |
@@ -1609,6 +1656,15 @@ static inline int break_lease(struct inode *inode, unsigned int mode) | |||
1609 | return __break_lease(inode, mode); | 1656 | return __break_lease(inode, mode); |
1610 | return 0; | 1657 | return 0; |
1611 | } | 1658 | } |
1659 | #else /* !CONFIG_FILE_LOCKING */ | ||
1660 | #define locks_mandatory_locked(a) ({ 0; }) | ||
1661 | #define locks_mandatory_area(a, b, c, d, e) ({ 0; }) | ||
1662 | #define __mandatory_lock(a) ({ 0; }) | ||
1663 | #define mandatory_lock(a) ({ 0; }) | ||
1664 | #define locks_verify_locked(a) ({ 0; }) | ||
1665 | #define locks_verify_truncate(a, b, c) ({ 0; }) | ||
1666 | #define break_lease(a, b) ({ 0; }) | ||
1667 | #endif /* CONFIG_FILE_LOCKING */ | ||
1612 | 1668 | ||
1613 | /* fs/open.c */ | 1669 | /* fs/open.c */ |
1614 | 1670 | ||
@@ -1642,7 +1698,7 @@ extern struct block_device *bdget(dev_t); | |||
1642 | extern void bd_set_size(struct block_device *, loff_t size); | 1698 | extern void bd_set_size(struct block_device *, loff_t size); |
1643 | extern void bd_forget(struct inode *inode); | 1699 | extern void bd_forget(struct inode *inode); |
1644 | extern void bdput(struct block_device *); | 1700 | extern void bdput(struct block_device *); |
1645 | extern struct block_device *open_by_devnum(dev_t, unsigned); | 1701 | extern struct block_device *open_by_devnum(dev_t, fmode_t); |
1646 | #else | 1702 | #else |
1647 | static inline void bd_forget(struct inode *inode) {} | 1703 | static inline void bd_forget(struct inode *inode) {} |
1648 | #endif | 1704 | #endif |
@@ -1652,13 +1708,10 @@ extern const struct file_operations bad_sock_fops; | |||
1652 | extern const struct file_operations def_fifo_fops; | 1708 | extern const struct file_operations def_fifo_fops; |
1653 | #ifdef CONFIG_BLOCK | 1709 | #ifdef CONFIG_BLOCK |
1654 | extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); | 1710 | extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); |
1655 | extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long); | 1711 | extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); |
1656 | extern int blkdev_driver_ioctl(struct inode *inode, struct file *file, | ||
1657 | struct gendisk *disk, unsigned cmd, | ||
1658 | unsigned long arg); | ||
1659 | extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); | 1712 | extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); |
1660 | extern int blkdev_get(struct block_device *, mode_t, unsigned); | 1713 | extern int blkdev_get(struct block_device *, fmode_t); |
1661 | extern int blkdev_put(struct block_device *); | 1714 | extern int blkdev_put(struct block_device *, fmode_t); |
1662 | extern int bd_claim(struct block_device *, void *); | 1715 | extern int bd_claim(struct block_device *, void *); |
1663 | extern void bd_release(struct block_device *); | 1716 | extern void bd_release(struct block_device *); |
1664 | #ifdef CONFIG_SYSFS | 1717 | #ifdef CONFIG_SYSFS |
@@ -1682,15 +1735,17 @@ extern void chrdev_show(struct seq_file *,off_t); | |||
1682 | 1735 | ||
1683 | /* fs/block_dev.c */ | 1736 | /* fs/block_dev.c */ |
1684 | #define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ | 1737 | #define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ |
1738 | #define BDEVT_SIZE 10 /* Largest string for MAJ:MIN for blkdev */ | ||
1685 | 1739 | ||
1686 | #ifdef CONFIG_BLOCK | 1740 | #ifdef CONFIG_BLOCK |
1687 | #define BLKDEV_MAJOR_HASH_SIZE 255 | 1741 | #define BLKDEV_MAJOR_HASH_SIZE 255 |
1688 | extern const char *__bdevname(dev_t, char *buffer); | 1742 | extern const char *__bdevname(dev_t, char *buffer); |
1689 | extern const char *bdevname(struct block_device *bdev, char *buffer); | 1743 | extern const char *bdevname(struct block_device *bdev, char *buffer); |
1690 | extern struct block_device *lookup_bdev(const char *); | 1744 | extern struct block_device *lookup_bdev(const char *); |
1691 | extern struct block_device *open_bdev_excl(const char *, int, void *); | 1745 | extern struct block_device *open_bdev_exclusive(const char *, fmode_t, void *); |
1692 | extern void close_bdev_excl(struct block_device *); | 1746 | extern void close_bdev_exclusive(struct block_device *, fmode_t); |
1693 | extern void blkdev_show(struct seq_file *,off_t); | 1747 | extern void blkdev_show(struct seq_file *,off_t); |
1748 | |||
1694 | #else | 1749 | #else |
1695 | #define BLKDEV_MAJOR_HASH_SIZE 0 | 1750 | #define BLKDEV_MAJOR_HASH_SIZE 0 |
1696 | #endif | 1751 | #endif |
@@ -1718,6 +1773,9 @@ extern int fs_may_remount_ro(struct super_block *); | |||
1718 | */ | 1773 | */ |
1719 | #define bio_data_dir(bio) ((bio)->bi_rw & 1) | 1774 | #define bio_data_dir(bio) ((bio)->bi_rw & 1) |
1720 | 1775 | ||
1776 | extern void check_disk_size_change(struct gendisk *disk, | ||
1777 | struct block_device *bdev); | ||
1778 | extern int revalidate_disk(struct gendisk *); | ||
1721 | extern int check_disk_change(struct block_device *); | 1779 | extern int check_disk_change(struct block_device *); |
1722 | extern int __invalidate_device(struct block_device *); | 1780 | extern int __invalidate_device(struct block_device *); |
1723 | extern int invalidate_partition(struct gendisk *, int); | 1781 | extern int invalidate_partition(struct gendisk *, int); |
@@ -1776,6 +1834,11 @@ extern int inode_permission(struct inode *, int); | |||
1776 | extern int generic_permission(struct inode *, int, | 1834 | extern int generic_permission(struct inode *, int, |
1777 | int (*check_acl)(struct inode *, int)); | 1835 | int (*check_acl)(struct inode *, int)); |
1778 | 1836 | ||
1837 | static inline bool execute_ok(struct inode *inode) | ||
1838 | { | ||
1839 | return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); | ||
1840 | } | ||
1841 | |||
1779 | extern int get_write_access(struct inode *); | 1842 | extern int get_write_access(struct inode *); |
1780 | extern int deny_write_access(struct file *); | 1843 | extern int deny_write_access(struct file *); |
1781 | static inline void put_write_access(struct inode * inode) | 1844 | static inline void put_write_access(struct inode * inode) |
@@ -1980,6 +2043,9 @@ extern int vfs_fstat(unsigned int, struct kstat *); | |||
1980 | 2043 | ||
1981 | extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, | 2044 | extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, |
1982 | unsigned long arg); | 2045 | unsigned long arg); |
2046 | extern int generic_block_fiemap(struct inode *inode, | ||
2047 | struct fiemap_extent_info *fieinfo, u64 start, | ||
2048 | u64 len, get_block_t *get_block); | ||
1983 | 2049 | ||
1984 | extern void get_filesystem(struct file_system_type *fs); | 2050 | extern void get_filesystem(struct file_system_type *fs); |
1985 | extern void put_filesystem(struct file_system_type *fs); | 2051 | extern void put_filesystem(struct file_system_type *fs); |
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index 4e625e0094c8..708bab58d8d0 100644 --- a/include/linux/fsl_devices.h +++ b/include/linux/fsl_devices.h | |||
@@ -49,7 +49,8 @@ struct gianfar_platform_data { | |||
49 | u32 device_flags; | 49 | u32 device_flags; |
50 | /* board specific information */ | 50 | /* board specific information */ |
51 | u32 board_flags; | 51 | u32 board_flags; |
52 | char bus_id[MII_BUS_ID_SIZE]; | 52 | int mdio_bus; /* Bus controlled by us */ |
53 | char bus_id[MII_BUS_ID_SIZE]; /* Bus PHY is on */ | ||
53 | u32 phy_id; | 54 | u32 phy_id; |
54 | u8 mac_addr[6]; | 55 | u8 mac_addr[6]; |
55 | phy_interface_t interface; | 56 | phy_interface_t interface; |
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index a89513188ce7..00fbd5b245c9 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h | |||
@@ -188,7 +188,7 @@ static inline void fsnotify_close(struct file *file) | |||
188 | struct dentry *dentry = file->f_path.dentry; | 188 | struct dentry *dentry = file->f_path.dentry; |
189 | struct inode *inode = dentry->d_inode; | 189 | struct inode *inode = dentry->d_inode; |
190 | const char *name = dentry->d_name.name; | 190 | const char *name = dentry->d_name.name; |
191 | mode_t mode = file->f_mode; | 191 | fmode_t mode = file->f_mode; |
192 | u32 mask = (mode & FMODE_WRITE) ? IN_CLOSE_WRITE : IN_CLOSE_NOWRITE; | 192 | u32 mask = (mode & FMODE_WRITE) ? IN_CLOSE_WRITE : IN_CLOSE_NOWRITE; |
193 | 193 | ||
194 | if (S_ISDIR(inode->i_mode)) | 194 | if (S_ISDIR(inode->i_mode)) |
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index bb384068272e..703eb53cfa2b 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -1,10 +1,14 @@ | |||
1 | #ifndef _LINUX_FTRACE_H | 1 | #ifndef _LINUX_FTRACE_H |
2 | #define _LINUX_FTRACE_H | 2 | #define _LINUX_FTRACE_H |
3 | 3 | ||
4 | #ifdef CONFIG_FTRACE | ||
5 | |||
6 | #include <linux/linkage.h> | 4 | #include <linux/linkage.h> |
7 | #include <linux/fs.h> | 5 | #include <linux/fs.h> |
6 | #include <linux/ktime.h> | ||
7 | #include <linux/init.h> | ||
8 | #include <linux/types.h> | ||
9 | #include <linux/kallsyms.h> | ||
10 | |||
11 | #ifdef CONFIG_FUNCTION_TRACER | ||
8 | 12 | ||
9 | extern int ftrace_enabled; | 13 | extern int ftrace_enabled; |
10 | extern int | 14 | extern int |
@@ -32,15 +36,14 @@ void clear_ftrace_function(void); | |||
32 | 36 | ||
33 | extern void ftrace_stub(unsigned long a0, unsigned long a1); | 37 | extern void ftrace_stub(unsigned long a0, unsigned long a1); |
34 | 38 | ||
35 | #else /* !CONFIG_FTRACE */ | 39 | #else /* !CONFIG_FUNCTION_TRACER */ |
36 | # define register_ftrace_function(ops) do { } while (0) | 40 | # define register_ftrace_function(ops) do { } while (0) |
37 | # define unregister_ftrace_function(ops) do { } while (0) | 41 | # define unregister_ftrace_function(ops) do { } while (0) |
38 | # define clear_ftrace_function(ops) do { } while (0) | 42 | # define clear_ftrace_function(ops) do { } while (0) |
39 | #endif /* CONFIG_FTRACE */ | 43 | static inline void ftrace_kill(void) { } |
44 | #endif /* CONFIG_FUNCTION_TRACER */ | ||
40 | 45 | ||
41 | #ifdef CONFIG_DYNAMIC_FTRACE | 46 | #ifdef CONFIG_DYNAMIC_FTRACE |
42 | # define FTRACE_HASHBITS 10 | ||
43 | # define FTRACE_HASHSIZE (1<<FTRACE_HASHBITS) | ||
44 | 47 | ||
45 | enum { | 48 | enum { |
46 | FTRACE_FL_FREE = (1 << 0), | 49 | FTRACE_FL_FREE = (1 << 0), |
@@ -53,9 +56,9 @@ enum { | |||
53 | }; | 56 | }; |
54 | 57 | ||
55 | struct dyn_ftrace { | 58 | struct dyn_ftrace { |
56 | struct hlist_node node; | 59 | struct list_head list; |
57 | unsigned long ip; /* address of mcount call-site */ | 60 | unsigned long ip; /* address of mcount call-site */ |
58 | unsigned long flags; | 61 | unsigned long flags; |
59 | }; | 62 | }; |
60 | 63 | ||
61 | int ftrace_force_update(void); | 64 | int ftrace_force_update(void); |
@@ -66,18 +69,39 @@ extern int ftrace_ip_converted(unsigned long ip); | |||
66 | extern unsigned char *ftrace_nop_replace(void); | 69 | extern unsigned char *ftrace_nop_replace(void); |
67 | extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr); | 70 | extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr); |
68 | extern int ftrace_dyn_arch_init(void *data); | 71 | extern int ftrace_dyn_arch_init(void *data); |
69 | extern int ftrace_mcount_set(unsigned long *data); | ||
70 | extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code, | ||
71 | unsigned char *new_code); | ||
72 | extern int ftrace_update_ftrace_func(ftrace_func_t func); | 72 | extern int ftrace_update_ftrace_func(ftrace_func_t func); |
73 | extern void ftrace_caller(void); | 73 | extern void ftrace_caller(void); |
74 | extern void ftrace_call(void); | 74 | extern void ftrace_call(void); |
75 | extern void mcount_call(void); | 75 | extern void mcount_call(void); |
76 | 76 | ||
77 | /** | ||
78 | * ftrace_modify_code - modify code segment | ||
79 | * @ip: the address of the code segment | ||
80 | * @old_code: the contents of what is expected to be there | ||
81 | * @new_code: the code to patch in | ||
82 | * | ||
83 | * This is a very sensitive operation and great care needs | ||
84 | * to be taken by the arch. The operation should carefully | ||
85 | * read the location, check to see if what is read is indeed | ||
86 | * what we expect it to be, and then on success of the compare, | ||
87 | * it should write to the location. | ||
88 | * | ||
89 | * Return must be: | ||
90 | * 0 on success | ||
91 | * -EFAULT on error reading the location | ||
92 | * -EINVAL on a failed compare of the contents | ||
93 | * -EPERM on error writing to the location | ||
94 | * Any other value will be considered a failure. | ||
95 | */ | ||
96 | extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code, | ||
97 | unsigned char *new_code); | ||
98 | |||
77 | extern int skip_trace(unsigned long ip); | 99 | extern int skip_trace(unsigned long ip); |
78 | 100 | ||
79 | void ftrace_disable_daemon(void); | 101 | extern void ftrace_release(void *start, unsigned long size); |
80 | void ftrace_enable_daemon(void); | 102 | |
103 | extern void ftrace_disable_daemon(void); | ||
104 | extern void ftrace_enable_daemon(void); | ||
81 | 105 | ||
82 | #else | 106 | #else |
83 | # define skip_trace(ip) ({ 0; }) | 107 | # define skip_trace(ip) ({ 0; }) |
@@ -85,25 +109,27 @@ void ftrace_enable_daemon(void); | |||
85 | # define ftrace_set_filter(buf, len, reset) do { } while (0) | 109 | # define ftrace_set_filter(buf, len, reset) do { } while (0) |
86 | # define ftrace_disable_daemon() do { } while (0) | 110 | # define ftrace_disable_daemon() do { } while (0) |
87 | # define ftrace_enable_daemon() do { } while (0) | 111 | # define ftrace_enable_daemon() do { } while (0) |
112 | static inline void ftrace_release(void *start, unsigned long size) { } | ||
88 | #endif /* CONFIG_DYNAMIC_FTRACE */ | 113 | #endif /* CONFIG_DYNAMIC_FTRACE */ |
89 | 114 | ||
90 | /* totally disable ftrace - can not re-enable after this */ | 115 | /* totally disable ftrace - can not re-enable after this */ |
91 | void ftrace_kill(void); | 116 | void ftrace_kill(void); |
92 | void ftrace_kill_atomic(void); | ||
93 | 117 | ||
94 | static inline void tracer_disable(void) | 118 | static inline void tracer_disable(void) |
95 | { | 119 | { |
96 | #ifdef CONFIG_FTRACE | 120 | #ifdef CONFIG_FUNCTION_TRACER |
97 | ftrace_enabled = 0; | 121 | ftrace_enabled = 0; |
98 | #endif | 122 | #endif |
99 | } | 123 | } |
100 | 124 | ||
101 | /* Ftrace disable/restore without lock. Some synchronization mechanism | 125 | /* |
126 | * Ftrace disable/restore without lock. Some synchronization mechanism | ||
102 | * must be used to prevent ftrace_enabled to be changed between | 127 | * must be used to prevent ftrace_enabled to be changed between |
103 | * disable/restore. */ | 128 | * disable/restore. |
129 | */ | ||
104 | static inline int __ftrace_enabled_save(void) | 130 | static inline int __ftrace_enabled_save(void) |
105 | { | 131 | { |
106 | #ifdef CONFIG_FTRACE | 132 | #ifdef CONFIG_FUNCTION_TRACER |
107 | int saved_ftrace_enabled = ftrace_enabled; | 133 | int saved_ftrace_enabled = ftrace_enabled; |
108 | ftrace_enabled = 0; | 134 | ftrace_enabled = 0; |
109 | return saved_ftrace_enabled; | 135 | return saved_ftrace_enabled; |
@@ -114,7 +140,7 @@ static inline int __ftrace_enabled_save(void) | |||
114 | 140 | ||
115 | static inline void __ftrace_enabled_restore(int enabled) | 141 | static inline void __ftrace_enabled_restore(int enabled) |
116 | { | 142 | { |
117 | #ifdef CONFIG_FTRACE | 143 | #ifdef CONFIG_FUNCTION_TRACER |
118 | ftrace_enabled = enabled; | 144 | ftrace_enabled = enabled; |
119 | #endif | 145 | #endif |
120 | } | 146 | } |
@@ -157,9 +183,71 @@ static inline void __ftrace_enabled_restore(int enabled) | |||
157 | #ifdef CONFIG_TRACING | 183 | #ifdef CONFIG_TRACING |
158 | extern void | 184 | extern void |
159 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); | 185 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); |
186 | |||
187 | /** | ||
188 | * ftrace_printk - printf formatting in the ftrace buffer | ||
189 | * @fmt: the printf format for printing | ||
190 | * | ||
191 | * Note: __ftrace_printk is an internal function for ftrace_printk and | ||
192 | * the @ip is passed in via the ftrace_printk macro. | ||
193 | * | ||
194 | * This function allows a kernel developer to debug fast path sections | ||
195 | * that printk is not appropriate for. By scattering in various | ||
196 | * printk like tracing in the code, a developer can quickly see | ||
197 | * where problems are occurring. | ||
198 | * | ||
199 | * This is intended as a debugging tool for the developer only. | ||
200 | * Please refrain from leaving ftrace_printks scattered around in | ||
201 | * your code. | ||
202 | */ | ||
203 | # define ftrace_printk(fmt...) __ftrace_printk(_THIS_IP_, fmt) | ||
204 | extern int | ||
205 | __ftrace_printk(unsigned long ip, const char *fmt, ...) | ||
206 | __attribute__ ((format (printf, 2, 3))); | ||
207 | extern void ftrace_dump(void); | ||
160 | #else | 208 | #else |
161 | static inline void | 209 | static inline void |
162 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } | 210 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } |
211 | static inline int | ||
212 | ftrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 0))); | ||
213 | |||
214 | static inline int | ||
215 | ftrace_printk(const char *fmt, ...) | ||
216 | { | ||
217 | return 0; | ||
218 | } | ||
219 | static inline void ftrace_dump(void) { } | ||
220 | #endif | ||
221 | |||
222 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | ||
223 | extern void ftrace_init(void); | ||
224 | extern void ftrace_init_module(unsigned long *start, unsigned long *end); | ||
225 | #else | ||
226 | static inline void ftrace_init(void) { } | ||
227 | static inline void | ||
228 | ftrace_init_module(unsigned long *start, unsigned long *end) { } | ||
163 | #endif | 229 | #endif |
164 | 230 | ||
231 | |||
232 | struct boot_trace { | ||
233 | pid_t caller; | ||
234 | char func[KSYM_NAME_LEN]; | ||
235 | int result; | ||
236 | unsigned long long duration; /* usecs */ | ||
237 | ktime_t calltime; | ||
238 | ktime_t rettime; | ||
239 | }; | ||
240 | |||
241 | #ifdef CONFIG_BOOT_TRACER | ||
242 | extern void trace_boot(struct boot_trace *it, initcall_t fn); | ||
243 | extern void start_boot_trace(void); | ||
244 | extern void stop_boot_trace(void); | ||
245 | #else | ||
246 | static inline void trace_boot(struct boot_trace *it, initcall_t fn) { } | ||
247 | static inline void start_boot_trace(void) { } | ||
248 | static inline void stop_boot_trace(void) { } | ||
249 | #endif | ||
250 | |||
251 | |||
252 | |||
165 | #endif /* _LINUX_FTRACE_H */ | 253 | #endif /* _LINUX_FTRACE_H */ |
diff --git a/include/linux/fuse.h b/include/linux/fuse.h index 265635dc9908..350fe9767bbc 100644 --- a/include/linux/fuse.h +++ b/include/linux/fuse.h | |||
@@ -17,8 +17,14 @@ | |||
17 | * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in | 17 | * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in |
18 | * - add blksize field to fuse_attr | 18 | * - add blksize field to fuse_attr |
19 | * - add file flags field to fuse_read_in and fuse_write_in | 19 | * - add file flags field to fuse_read_in and fuse_write_in |
20 | * | ||
21 | * 7.10 | ||
22 | * - add nonseekable open flag | ||
20 | */ | 23 | */ |
21 | 24 | ||
25 | #ifndef _LINUX_FUSE_H | ||
26 | #define _LINUX_FUSE_H | ||
27 | |||
22 | #include <asm/types.h> | 28 | #include <asm/types.h> |
23 | #include <linux/major.h> | 29 | #include <linux/major.h> |
24 | 30 | ||
@@ -26,7 +32,7 @@ | |||
26 | #define FUSE_KERNEL_VERSION 7 | 32 | #define FUSE_KERNEL_VERSION 7 |
27 | 33 | ||
28 | /** Minor version number of this interface */ | 34 | /** Minor version number of this interface */ |
29 | #define FUSE_KERNEL_MINOR_VERSION 9 | 35 | #define FUSE_KERNEL_MINOR_VERSION 10 |
30 | 36 | ||
31 | /** The node ID of the root inode */ | 37 | /** The node ID of the root inode */ |
32 | #define FUSE_ROOT_ID 1 | 38 | #define FUSE_ROOT_ID 1 |
@@ -98,9 +104,11 @@ struct fuse_file_lock { | |||
98 | * | 104 | * |
99 | * FOPEN_DIRECT_IO: bypass page cache for this open file | 105 | * FOPEN_DIRECT_IO: bypass page cache for this open file |
100 | * FOPEN_KEEP_CACHE: don't invalidate the data cache on open | 106 | * FOPEN_KEEP_CACHE: don't invalidate the data cache on open |
107 | * FOPEN_NONSEEKABLE: the file is not seekable | ||
101 | */ | 108 | */ |
102 | #define FOPEN_DIRECT_IO (1 << 0) | 109 | #define FOPEN_DIRECT_IO (1 << 0) |
103 | #define FOPEN_KEEP_CACHE (1 << 1) | 110 | #define FOPEN_KEEP_CACHE (1 << 1) |
111 | #define FOPEN_NONSEEKABLE (1 << 2) | ||
104 | 112 | ||
105 | /** | 113 | /** |
106 | * INIT request/reply flags | 114 | * INIT request/reply flags |
@@ -409,3 +417,5 @@ struct fuse_dirent { | |||
409 | #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) | 417 | #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) |
410 | #define FUSE_DIRENT_SIZE(d) \ | 418 | #define FUSE_DIRENT_SIZE(d) \ |
411 | FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) | 419 | FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) |
420 | |||
421 | #endif /* _LINUX_FUSE_H */ | ||
diff --git a/include/linux/gameport.h b/include/linux/gameport.h index f64e29c0ef3f..0cd825f7363a 100644 --- a/include/linux/gameport.h +++ b/include/linux/gameport.h | |||
@@ -146,10 +146,11 @@ static inline void gameport_unpin_driver(struct gameport *gameport) | |||
146 | mutex_unlock(&gameport->drv_mutex); | 146 | mutex_unlock(&gameport->drv_mutex); |
147 | } | 147 | } |
148 | 148 | ||
149 | void __gameport_register_driver(struct gameport_driver *drv, struct module *owner); | 149 | int __gameport_register_driver(struct gameport_driver *drv, |
150 | static inline void gameport_register_driver(struct gameport_driver *drv) | 150 | struct module *owner, const char *mod_name); |
151 | static inline int __must_check gameport_register_driver(struct gameport_driver *drv) | ||
151 | { | 152 | { |
152 | __gameport_register_driver(drv, THIS_MODULE); | 153 | return __gameport_register_driver(drv, THIS_MODULE, KBUILD_MODNAME); |
153 | } | 154 | } |
154 | 155 | ||
155 | void gameport_unregister_driver(struct gameport_driver *drv); | 156 | void gameport_unregister_driver(struct gameport_driver *drv); |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index be4f5e5bfe06..3df7742ce246 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -11,20 +11,20 @@ | |||
11 | 11 | ||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <linux/kdev_t.h> | 13 | #include <linux/kdev_t.h> |
14 | #include <linux/rcupdate.h> | ||
14 | 15 | ||
15 | #ifdef CONFIG_BLOCK | 16 | #ifdef CONFIG_BLOCK |
16 | 17 | ||
17 | #define kobj_to_dev(k) container_of(k, struct device, kobj) | 18 | #define kobj_to_dev(k) container_of((k), struct device, kobj) |
18 | #define dev_to_disk(device) container_of(device, struct gendisk, dev) | 19 | #define dev_to_disk(device) container_of((device), struct gendisk, part0.__dev) |
19 | #define dev_to_part(device) container_of(device, struct hd_struct, dev) | 20 | #define dev_to_part(device) container_of((device), struct hd_struct, __dev) |
21 | #define disk_to_dev(disk) (&(disk)->part0.__dev) | ||
22 | #define part_to_dev(part) (&((part)->__dev)) | ||
20 | 23 | ||
21 | extern struct device_type part_type; | 24 | extern struct device_type part_type; |
22 | extern struct kobject *block_depr; | 25 | extern struct kobject *block_depr; |
23 | extern struct class block_class; | 26 | extern struct class block_class; |
24 | 27 | ||
25 | extern const struct seq_operations partitions_op; | ||
26 | extern const struct seq_operations diskstats_op; | ||
27 | |||
28 | enum { | 28 | enum { |
29 | /* These three have identical behaviour; use the second one if DOS FDISK gets | 29 | /* These three have identical behaviour; use the second one if DOS FDISK gets |
30 | confused about extended/logical partitions starting past cylinder 1023. */ | 30 | confused about extended/logical partitions starting past cylinder 1023. */ |
@@ -55,6 +55,9 @@ enum { | |||
55 | UNIXWARE_PARTITION = 0x63, /* Same as GNU_HURD and SCO Unix */ | 55 | UNIXWARE_PARTITION = 0x63, /* Same as GNU_HURD and SCO Unix */ |
56 | }; | 56 | }; |
57 | 57 | ||
58 | #define DISK_MAX_PARTS 256 | ||
59 | #define DISK_NAME_LEN 32 | ||
60 | |||
58 | #include <linux/major.h> | 61 | #include <linux/major.h> |
59 | #include <linux/device.h> | 62 | #include <linux/device.h> |
60 | #include <linux/smp.h> | 63 | #include <linux/smp.h> |
@@ -87,7 +90,7 @@ struct disk_stats { | |||
87 | struct hd_struct { | 90 | struct hd_struct { |
88 | sector_t start_sect; | 91 | sector_t start_sect; |
89 | sector_t nr_sects; | 92 | sector_t nr_sects; |
90 | struct device dev; | 93 | struct device __dev; |
91 | struct kobject *holder_dir; | 94 | struct kobject *holder_dir; |
92 | int policy, partno; | 95 | int policy, partno; |
93 | #ifdef CONFIG_FAIL_MAKE_REQUEST | 96 | #ifdef CONFIG_FAIL_MAKE_REQUEST |
@@ -100,6 +103,7 @@ struct hd_struct { | |||
100 | #else | 103 | #else |
101 | struct disk_stats dkstats; | 104 | struct disk_stats dkstats; |
102 | #endif | 105 | #endif |
106 | struct rcu_head rcu_head; | ||
103 | }; | 107 | }; |
104 | 108 | ||
105 | #define GENHD_FL_REMOVABLE 1 | 109 | #define GENHD_FL_REMOVABLE 1 |
@@ -108,100 +112,148 @@ struct hd_struct { | |||
108 | #define GENHD_FL_CD 8 | 112 | #define GENHD_FL_CD 8 |
109 | #define GENHD_FL_UP 16 | 113 | #define GENHD_FL_UP 16 |
110 | #define GENHD_FL_SUPPRESS_PARTITION_INFO 32 | 114 | #define GENHD_FL_SUPPRESS_PARTITION_INFO 32 |
111 | #define GENHD_FL_FAIL 64 | 115 | #define GENHD_FL_EXT_DEVT 64 /* allow extended devt */ |
116 | |||
117 | #define BLK_SCSI_MAX_CMDS (256) | ||
118 | #define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) | ||
119 | |||
120 | struct blk_scsi_cmd_filter { | ||
121 | unsigned long read_ok[BLK_SCSI_CMD_PER_LONG]; | ||
122 | unsigned long write_ok[BLK_SCSI_CMD_PER_LONG]; | ||
123 | struct kobject kobj; | ||
124 | }; | ||
125 | |||
126 | struct disk_part_tbl { | ||
127 | struct rcu_head rcu_head; | ||
128 | int len; | ||
129 | struct hd_struct *part[]; | ||
130 | }; | ||
112 | 131 | ||
113 | struct gendisk { | 132 | struct gendisk { |
133 | /* major, first_minor and minors are input parameters only, | ||
134 | * don't use directly. Use disk_devt() and disk_max_parts(). | ||
135 | */ | ||
114 | int major; /* major number of driver */ | 136 | int major; /* major number of driver */ |
115 | int first_minor; | 137 | int first_minor; |
116 | int minors; /* maximum number of minors, =1 for | 138 | int minors; /* maximum number of minors, =1 for |
117 | * disks that can't be partitioned. */ | 139 | * disks that can't be partitioned. */ |
118 | char disk_name[32]; /* name of major driver */ | 140 | |
119 | struct hd_struct **part; /* [indexed by minor] */ | 141 | char disk_name[DISK_NAME_LEN]; /* name of major driver */ |
142 | |||
143 | /* Array of pointers to partitions indexed by partno. | ||
144 | * Protected with matching bdev lock but stat and other | ||
145 | * non-critical accesses use RCU. Always access through | ||
146 | * helpers. | ||
147 | */ | ||
148 | struct disk_part_tbl *part_tbl; | ||
149 | struct hd_struct part0; | ||
150 | |||
120 | struct block_device_operations *fops; | 151 | struct block_device_operations *fops; |
121 | struct request_queue *queue; | 152 | struct request_queue *queue; |
122 | void *private_data; | 153 | void *private_data; |
123 | sector_t capacity; | ||
124 | 154 | ||
125 | int flags; | 155 | int flags; |
126 | struct device *driverfs_dev; // FIXME: remove | 156 | struct device *driverfs_dev; // FIXME: remove |
127 | struct device dev; | ||
128 | struct kobject *holder_dir; | ||
129 | struct kobject *slave_dir; | 157 | struct kobject *slave_dir; |
130 | 158 | ||
131 | struct timer_rand_state *random; | 159 | struct timer_rand_state *random; |
132 | int policy; | ||
133 | 160 | ||
134 | atomic_t sync_io; /* RAID */ | 161 | atomic_t sync_io; /* RAID */ |
135 | unsigned long stamp; | ||
136 | int in_flight; | ||
137 | #ifdef CONFIG_SMP | ||
138 | struct disk_stats *dkstats; | ||
139 | #else | ||
140 | struct disk_stats dkstats; | ||
141 | #endif | ||
142 | struct work_struct async_notify; | 162 | struct work_struct async_notify; |
143 | #ifdef CONFIG_BLK_DEV_INTEGRITY | 163 | #ifdef CONFIG_BLK_DEV_INTEGRITY |
144 | struct blk_integrity *integrity; | 164 | struct blk_integrity *integrity; |
145 | #endif | 165 | #endif |
166 | int node_id; | ||
146 | }; | 167 | }; |
147 | 168 | ||
148 | /* | 169 | static inline struct gendisk *part_to_disk(struct hd_struct *part) |
149 | * Macros to operate on percpu disk statistics: | ||
150 | * | ||
151 | * The __ variants should only be called in critical sections. The full | ||
152 | * variants disable/enable preemption. | ||
153 | */ | ||
154 | static inline struct hd_struct *get_part(struct gendisk *gendiskp, | ||
155 | sector_t sector) | ||
156 | { | 170 | { |
157 | struct hd_struct *part; | 171 | if (likely(part)) { |
158 | int i; | 172 | if (part->partno) |
159 | for (i = 0; i < gendiskp->minors - 1; i++) { | 173 | return dev_to_disk(part_to_dev(part)->parent); |
160 | part = gendiskp->part[i]; | 174 | else |
161 | if (part && part->start_sect <= sector | 175 | return dev_to_disk(part_to_dev(part)); |
162 | && sector < part->start_sect + part->nr_sects) | ||
163 | return part; | ||
164 | } | 176 | } |
165 | return NULL; | 177 | return NULL; |
166 | } | 178 | } |
167 | 179 | ||
168 | #ifdef CONFIG_SMP | 180 | static inline int disk_max_parts(struct gendisk *disk) |
169 | #define __disk_stat_add(gendiskp, field, addnd) \ | 181 | { |
170 | (per_cpu_ptr(gendiskp->dkstats, smp_processor_id())->field += addnd) | 182 | if (disk->flags & GENHD_FL_EXT_DEVT) |
183 | return DISK_MAX_PARTS; | ||
184 | return disk->minors; | ||
185 | } | ||
171 | 186 | ||
172 | #define disk_stat_read(gendiskp, field) \ | 187 | static inline bool disk_partitionable(struct gendisk *disk) |
173 | ({ \ | 188 | { |
174 | typeof(gendiskp->dkstats->field) res = 0; \ | 189 | return disk_max_parts(disk) > 1; |
175 | int i; \ | 190 | } |
176 | for_each_possible_cpu(i) \ | ||
177 | res += per_cpu_ptr(gendiskp->dkstats, i)->field; \ | ||
178 | res; \ | ||
179 | }) | ||
180 | 191 | ||
181 | static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) { | 192 | static inline dev_t disk_devt(struct gendisk *disk) |
182 | int i; | 193 | { |
194 | return disk_to_dev(disk)->devt; | ||
195 | } | ||
183 | 196 | ||
184 | for_each_possible_cpu(i) | 197 | static inline dev_t part_devt(struct hd_struct *part) |
185 | memset(per_cpu_ptr(gendiskp->dkstats, i), value, | 198 | { |
186 | sizeof(struct disk_stats)); | 199 | return part_to_dev(part)->devt; |
187 | } | 200 | } |
188 | 201 | ||
189 | #define __part_stat_add(part, field, addnd) \ | 202 | extern struct hd_struct *disk_get_part(struct gendisk *disk, int partno); |
190 | (per_cpu_ptr(part->dkstats, smp_processor_id())->field += addnd) | ||
191 | 203 | ||
192 | #define __all_stat_add(gendiskp, part, field, addnd, sector) \ | 204 | static inline void disk_put_part(struct hd_struct *part) |
193 | ({ \ | 205 | { |
194 | if (part) \ | 206 | if (likely(part)) |
195 | __part_stat_add(part, field, addnd); \ | 207 | put_device(part_to_dev(part)); |
196 | __disk_stat_add(gendiskp, field, addnd); \ | 208 | } |
197 | }) | 209 | |
210 | /* | ||
211 | * Smarter partition iterator without context limits. | ||
212 | */ | ||
213 | #define DISK_PITER_REVERSE (1 << 0) /* iterate in the reverse direction */ | ||
214 | #define DISK_PITER_INCL_EMPTY (1 << 1) /* include 0-sized parts */ | ||
215 | #define DISK_PITER_INCL_PART0 (1 << 2) /* include partition 0 */ | ||
216 | |||
217 | struct disk_part_iter { | ||
218 | struct gendisk *disk; | ||
219 | struct hd_struct *part; | ||
220 | int idx; | ||
221 | unsigned int flags; | ||
222 | }; | ||
223 | |||
224 | extern void disk_part_iter_init(struct disk_part_iter *piter, | ||
225 | struct gendisk *disk, unsigned int flags); | ||
226 | extern struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter); | ||
227 | extern void disk_part_iter_exit(struct disk_part_iter *piter); | ||
228 | |||
229 | extern struct hd_struct *disk_map_sector_rcu(struct gendisk *disk, | ||
230 | sector_t sector); | ||
231 | |||
232 | /* | ||
233 | * Macros to operate on percpu disk statistics: | ||
234 | * | ||
235 | * {disk|part|all}_stat_{add|sub|inc|dec}() modify the stat counters | ||
236 | * and should be called between disk_stat_lock() and | ||
237 | * disk_stat_unlock(). | ||
238 | * | ||
239 | * part_stat_read() can be called at any time. | ||
240 | * | ||
241 | * part_stat_{add|set_all}() and {init|free}_part_stats are for | ||
242 | * internal use only. | ||
243 | */ | ||
244 | #ifdef CONFIG_SMP | ||
245 | #define part_stat_lock() ({ rcu_read_lock(); get_cpu(); }) | ||
246 | #define part_stat_unlock() do { put_cpu(); rcu_read_unlock(); } while (0) | ||
247 | |||
248 | #define __part_stat_add(cpu, part, field, addnd) \ | ||
249 | (per_cpu_ptr((part)->dkstats, (cpu))->field += (addnd)) | ||
198 | 250 | ||
199 | #define part_stat_read(part, field) \ | 251 | #define part_stat_read(part, field) \ |
200 | ({ \ | 252 | ({ \ |
201 | typeof(part->dkstats->field) res = 0; \ | 253 | typeof((part)->dkstats->field) res = 0; \ |
202 | int i; \ | 254 | int i; \ |
203 | for_each_possible_cpu(i) \ | 255 | for_each_possible_cpu(i) \ |
204 | res += per_cpu_ptr(part->dkstats, i)->field; \ | 256 | res += per_cpu_ptr((part)->dkstats, i)->field; \ |
205 | res; \ | 257 | res; \ |
206 | }) | 258 | }) |
207 | 259 | ||
@@ -213,171 +265,107 @@ static inline void part_stat_set_all(struct hd_struct *part, int value) | |||
213 | memset(per_cpu_ptr(part->dkstats, i), value, | 265 | memset(per_cpu_ptr(part->dkstats, i), value, |
214 | sizeof(struct disk_stats)); | 266 | sizeof(struct disk_stats)); |
215 | } | 267 | } |
216 | |||
217 | #else /* !CONFIG_SMP */ | ||
218 | #define __disk_stat_add(gendiskp, field, addnd) \ | ||
219 | (gendiskp->dkstats.field += addnd) | ||
220 | #define disk_stat_read(gendiskp, field) (gendiskp->dkstats.field) | ||
221 | 268 | ||
222 | static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) | 269 | static inline int init_part_stats(struct hd_struct *part) |
223 | { | 270 | { |
224 | memset(&gendiskp->dkstats, value, sizeof (struct disk_stats)); | 271 | part->dkstats = alloc_percpu(struct disk_stats); |
272 | if (!part->dkstats) | ||
273 | return 0; | ||
274 | return 1; | ||
225 | } | 275 | } |
226 | 276 | ||
227 | #define __part_stat_add(part, field, addnd) \ | 277 | static inline void free_part_stats(struct hd_struct *part) |
228 | (part->dkstats.field += addnd) | ||
229 | |||
230 | #define __all_stat_add(gendiskp, part, field, addnd, sector) \ | ||
231 | ({ \ | ||
232 | if (part) \ | ||
233 | part->dkstats.field += addnd; \ | ||
234 | __disk_stat_add(gendiskp, field, addnd); \ | ||
235 | }) | ||
236 | |||
237 | #define part_stat_read(part, field) (part->dkstats.field) | ||
238 | |||
239 | static inline void part_stat_set_all(struct hd_struct *part, int value) | ||
240 | { | 278 | { |
241 | memset(&part->dkstats, value, sizeof(struct disk_stats)); | 279 | free_percpu(part->dkstats); |
242 | } | 280 | } |
243 | 281 | ||
244 | #endif /* CONFIG_SMP */ | 282 | #else /* !CONFIG_SMP */ |
283 | #define part_stat_lock() ({ rcu_read_lock(); 0; }) | ||
284 | #define part_stat_unlock() rcu_read_unlock() | ||
245 | 285 | ||
246 | #define disk_stat_add(gendiskp, field, addnd) \ | 286 | #define __part_stat_add(cpu, part, field, addnd) \ |
247 | do { \ | 287 | ((part)->dkstats.field += addnd) |
248 | preempt_disable(); \ | ||
249 | __disk_stat_add(gendiskp, field, addnd); \ | ||
250 | preempt_enable(); \ | ||
251 | } while (0) | ||
252 | |||
253 | #define __disk_stat_dec(gendiskp, field) __disk_stat_add(gendiskp, field, -1) | ||
254 | #define disk_stat_dec(gendiskp, field) disk_stat_add(gendiskp, field, -1) | ||
255 | |||
256 | #define __disk_stat_inc(gendiskp, field) __disk_stat_add(gendiskp, field, 1) | ||
257 | #define disk_stat_inc(gendiskp, field) disk_stat_add(gendiskp, field, 1) | ||
258 | |||
259 | #define __disk_stat_sub(gendiskp, field, subnd) \ | ||
260 | __disk_stat_add(gendiskp, field, -subnd) | ||
261 | #define disk_stat_sub(gendiskp, field, subnd) \ | ||
262 | disk_stat_add(gendiskp, field, -subnd) | ||
263 | |||
264 | #define part_stat_add(gendiskp, field, addnd) \ | ||
265 | do { \ | ||
266 | preempt_disable(); \ | ||
267 | __part_stat_add(gendiskp, field, addnd);\ | ||
268 | preempt_enable(); \ | ||
269 | } while (0) | ||
270 | |||
271 | #define __part_stat_dec(gendiskp, field) __part_stat_add(gendiskp, field, -1) | ||
272 | #define part_stat_dec(gendiskp, field) part_stat_add(gendiskp, field, -1) | ||
273 | |||
274 | #define __part_stat_inc(gendiskp, field) __part_stat_add(gendiskp, field, 1) | ||
275 | #define part_stat_inc(gendiskp, field) part_stat_add(gendiskp, field, 1) | ||
276 | |||
277 | #define __part_stat_sub(gendiskp, field, subnd) \ | ||
278 | __part_stat_add(gendiskp, field, -subnd) | ||
279 | #define part_stat_sub(gendiskp, field, subnd) \ | ||
280 | part_stat_add(gendiskp, field, -subnd) | ||
281 | |||
282 | #define all_stat_add(gendiskp, part, field, addnd, sector) \ | ||
283 | do { \ | ||
284 | preempt_disable(); \ | ||
285 | __all_stat_add(gendiskp, part, field, addnd, sector); \ | ||
286 | preempt_enable(); \ | ||
287 | } while (0) | ||
288 | |||
289 | #define __all_stat_dec(gendiskp, field, sector) \ | ||
290 | __all_stat_add(gendiskp, field, -1, sector) | ||
291 | #define all_stat_dec(gendiskp, field, sector) \ | ||
292 | all_stat_add(gendiskp, field, -1, sector) | ||
293 | |||
294 | #define __all_stat_inc(gendiskp, part, field, sector) \ | ||
295 | __all_stat_add(gendiskp, part, field, 1, sector) | ||
296 | #define all_stat_inc(gendiskp, part, field, sector) \ | ||
297 | all_stat_add(gendiskp, part, field, 1, sector) | ||
298 | |||
299 | #define __all_stat_sub(gendiskp, part, field, subnd, sector) \ | ||
300 | __all_stat_add(gendiskp, part, field, -subnd, sector) | ||
301 | #define all_stat_sub(gendiskp, part, field, subnd, sector) \ | ||
302 | all_stat_add(gendiskp, part, field, -subnd, sector) | ||
303 | |||
304 | /* Inlines to alloc and free disk stats in struct gendisk */ | ||
305 | #ifdef CONFIG_SMP | ||
306 | static inline int init_disk_stats(struct gendisk *disk) | ||
307 | { | ||
308 | disk->dkstats = alloc_percpu(struct disk_stats); | ||
309 | if (!disk->dkstats) | ||
310 | return 0; | ||
311 | return 1; | ||
312 | } | ||
313 | 288 | ||
314 | static inline void free_disk_stats(struct gendisk *disk) | 289 | #define part_stat_read(part, field) ((part)->dkstats.field) |
290 | |||
291 | static inline void part_stat_set_all(struct hd_struct *part, int value) | ||
315 | { | 292 | { |
316 | free_percpu(disk->dkstats); | 293 | memset(&part->dkstats, value, sizeof(struct disk_stats)); |
317 | } | 294 | } |
318 | 295 | ||
319 | static inline int init_part_stats(struct hd_struct *part) | 296 | static inline int init_part_stats(struct hd_struct *part) |
320 | { | 297 | { |
321 | part->dkstats = alloc_percpu(struct disk_stats); | ||
322 | if (!part->dkstats) | ||
323 | return 0; | ||
324 | return 1; | 298 | return 1; |
325 | } | 299 | } |
326 | 300 | ||
327 | static inline void free_part_stats(struct hd_struct *part) | 301 | static inline void free_part_stats(struct hd_struct *part) |
328 | { | 302 | { |
329 | free_percpu(part->dkstats); | ||
330 | } | ||
331 | |||
332 | #else /* CONFIG_SMP */ | ||
333 | static inline int init_disk_stats(struct gendisk *disk) | ||
334 | { | ||
335 | return 1; | ||
336 | } | 303 | } |
337 | 304 | ||
338 | static inline void free_disk_stats(struct gendisk *disk) | 305 | #endif /* CONFIG_SMP */ |
339 | { | ||
340 | } | ||
341 | 306 | ||
342 | static inline int init_part_stats(struct hd_struct *part) | 307 | #define part_stat_add(cpu, part, field, addnd) do { \ |
308 | __part_stat_add((cpu), (part), field, addnd); \ | ||
309 | if ((part)->partno) \ | ||
310 | __part_stat_add((cpu), &part_to_disk((part))->part0, \ | ||
311 | field, addnd); \ | ||
312 | } while (0) | ||
313 | |||
314 | #define part_stat_dec(cpu, gendiskp, field) \ | ||
315 | part_stat_add(cpu, gendiskp, field, -1) | ||
316 | #define part_stat_inc(cpu, gendiskp, field) \ | ||
317 | part_stat_add(cpu, gendiskp, field, 1) | ||
318 | #define part_stat_sub(cpu, gendiskp, field, subnd) \ | ||
319 | part_stat_add(cpu, gendiskp, field, -subnd) | ||
320 | |||
321 | static inline void part_inc_in_flight(struct hd_struct *part) | ||
343 | { | 322 | { |
344 | return 1; | 323 | part->in_flight++; |
324 | if (part->partno) | ||
325 | part_to_disk(part)->part0.in_flight++; | ||
345 | } | 326 | } |
346 | 327 | ||
347 | static inline void free_part_stats(struct hd_struct *part) | 328 | static inline void part_dec_in_flight(struct hd_struct *part) |
348 | { | 329 | { |
330 | part->in_flight--; | ||
331 | if (part->partno) | ||
332 | part_to_disk(part)->part0.in_flight--; | ||
349 | } | 333 | } |
350 | #endif /* CONFIG_SMP */ | ||
351 | 334 | ||
352 | /* drivers/block/ll_rw_blk.c */ | 335 | /* drivers/block/ll_rw_blk.c */ |
353 | extern void disk_round_stats(struct gendisk *disk); | 336 | extern void part_round_stats(int cpu, struct hd_struct *part); |
354 | extern void part_round_stats(struct hd_struct *part); | ||
355 | 337 | ||
356 | /* drivers/block/genhd.c */ | 338 | /* drivers/block/genhd.c */ |
357 | extern int get_blkdev_list(char *, int); | 339 | extern int get_blkdev_list(char *, int); |
358 | extern void add_disk(struct gendisk *disk); | 340 | extern void add_disk(struct gendisk *disk); |
359 | extern void del_gendisk(struct gendisk *gp); | 341 | extern void del_gendisk(struct gendisk *gp); |
360 | extern void unlink_gendisk(struct gendisk *gp); | 342 | extern void unlink_gendisk(struct gendisk *gp); |
361 | extern struct gendisk *get_gendisk(dev_t dev, int *part); | 343 | extern struct gendisk *get_gendisk(dev_t dev, int *partno); |
344 | extern struct block_device *bdget_disk(struct gendisk *disk, int partno); | ||
362 | 345 | ||
363 | extern void set_device_ro(struct block_device *bdev, int flag); | 346 | extern void set_device_ro(struct block_device *bdev, int flag); |
364 | extern void set_disk_ro(struct gendisk *disk, int flag); | 347 | extern void set_disk_ro(struct gendisk *disk, int flag); |
365 | 348 | ||
349 | static inline int get_disk_ro(struct gendisk *disk) | ||
350 | { | ||
351 | return disk->part0.policy; | ||
352 | } | ||
353 | |||
366 | /* drivers/char/random.c */ | 354 | /* drivers/char/random.c */ |
367 | extern void add_disk_randomness(struct gendisk *disk); | 355 | extern void add_disk_randomness(struct gendisk *disk); |
368 | extern void rand_initialize_disk(struct gendisk *disk); | 356 | extern void rand_initialize_disk(struct gendisk *disk); |
369 | 357 | ||
370 | static inline sector_t get_start_sect(struct block_device *bdev) | 358 | static inline sector_t get_start_sect(struct block_device *bdev) |
371 | { | 359 | { |
372 | return bdev->bd_contains == bdev ? 0 : bdev->bd_part->start_sect; | 360 | return bdev->bd_part->start_sect; |
373 | } | 361 | } |
374 | static inline sector_t get_capacity(struct gendisk *disk) | 362 | static inline sector_t get_capacity(struct gendisk *disk) |
375 | { | 363 | { |
376 | return disk->capacity; | 364 | return disk->part0.nr_sects; |
377 | } | 365 | } |
378 | static inline void set_capacity(struct gendisk *disk, sector_t size) | 366 | static inline void set_capacity(struct gendisk *disk, sector_t size) |
379 | { | 367 | { |
380 | disk->capacity = size; | 368 | disk->part0.nr_sects = size; |
381 | } | 369 | } |
382 | 370 | ||
383 | #ifdef CONFIG_SOLARIS_X86_PARTITION | 371 | #ifdef CONFIG_SOLARIS_X86_PARTITION |
@@ -527,11 +515,16 @@ struct unixware_disklabel { | |||
527 | #define ADDPART_FLAG_RAID 1 | 515 | #define ADDPART_FLAG_RAID 1 |
528 | #define ADDPART_FLAG_WHOLEDISK 2 | 516 | #define ADDPART_FLAG_WHOLEDISK 2 |
529 | 517 | ||
530 | extern dev_t blk_lookup_devt(const char *name, int part); | 518 | extern int blk_alloc_devt(struct hd_struct *part, dev_t *devt); |
531 | extern char *disk_name (struct gendisk *hd, int part, char *buf); | 519 | extern void blk_free_devt(dev_t devt); |
520 | extern dev_t blk_lookup_devt(const char *name, int partno); | ||
521 | extern char *disk_name (struct gendisk *hd, int partno, char *buf); | ||
532 | 522 | ||
523 | extern int disk_expand_part_tbl(struct gendisk *disk, int target); | ||
533 | extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); | 524 | extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); |
534 | extern int __must_check add_partition(struct gendisk *, int, sector_t, sector_t, int); | 525 | extern struct hd_struct * __must_check add_partition(struct gendisk *disk, |
526 | int partno, sector_t start, | ||
527 | sector_t len, int flags); | ||
535 | extern void delete_partition(struct gendisk *, int); | 528 | extern void delete_partition(struct gendisk *, int); |
536 | extern void printk_all_partitions(void); | 529 | extern void printk_all_partitions(void); |
537 | 530 | ||
@@ -546,16 +539,23 @@ extern void blk_register_region(dev_t devt, unsigned long range, | |||
546 | void *data); | 539 | void *data); |
547 | extern void blk_unregister_region(dev_t devt, unsigned long range); | 540 | extern void blk_unregister_region(dev_t devt, unsigned long range); |
548 | 541 | ||
549 | static inline struct block_device *bdget_disk(struct gendisk *disk, int index) | 542 | extern ssize_t part_size_show(struct device *dev, |
550 | { | 543 | struct device_attribute *attr, char *buf); |
551 | return bdget(MKDEV(disk->major, disk->first_minor) + index); | 544 | extern ssize_t part_stat_show(struct device *dev, |
552 | } | 545 | struct device_attribute *attr, char *buf); |
546 | #ifdef CONFIG_FAIL_MAKE_REQUEST | ||
547 | extern ssize_t part_fail_show(struct device *dev, | ||
548 | struct device_attribute *attr, char *buf); | ||
549 | extern ssize_t part_fail_store(struct device *dev, | ||
550 | struct device_attribute *attr, | ||
551 | const char *buf, size_t count); | ||
552 | #endif /* CONFIG_FAIL_MAKE_REQUEST */ | ||
553 | 553 | ||
554 | #else /* CONFIG_BLOCK */ | 554 | #else /* CONFIG_BLOCK */ |
555 | 555 | ||
556 | static inline void printk_all_partitions(void) { } | 556 | static inline void printk_all_partitions(void) { } |
557 | 557 | ||
558 | static inline dev_t blk_lookup_devt(const char *name, int part) | 558 | static inline dev_t blk_lookup_devt(const char *name, int partno) |
559 | { | 559 | { |
560 | dev_t devt = MKDEV(0, 0); | 560 | dev_t devt = MKDEV(0, 0); |
561 | return devt; | 561 | return devt; |
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h index c3c19f926e6f..14d0df0b5749 100644 --- a/include/linux/gfs2_ondisk.h +++ b/include/linux/gfs2_ondisk.h | |||
@@ -118,7 +118,11 @@ struct gfs2_sb { | |||
118 | 118 | ||
119 | char sb_lockproto[GFS2_LOCKNAME_LEN]; | 119 | char sb_lockproto[GFS2_LOCKNAME_LEN]; |
120 | char sb_locktable[GFS2_LOCKNAME_LEN]; | 120 | char sb_locktable[GFS2_LOCKNAME_LEN]; |
121 | /* In gfs1, quota and license dinodes followed */ | 121 | |
122 | struct gfs2_inum __pad3; /* Was quota inode in gfs1 */ | ||
123 | struct gfs2_inum __pad4; /* Was licence inode in gfs1 */ | ||
124 | #define GFS2_HAS_UUID 1 | ||
125 | __u8 sb_uuid[16]; /* The UUID, maybe 0 for backwards compat */ | ||
122 | }; | 126 | }; |
123 | 127 | ||
124 | /* | 128 | /* |
diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 730a20b83576..e10c49a5b96e 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | #else | 9 | #else |
10 | 10 | ||
11 | #include <linux/kernel.h> | ||
11 | #include <linux/types.h> | 12 | #include <linux/types.h> |
12 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
13 | 14 | ||
@@ -32,6 +33,8 @@ static inline int gpio_request(unsigned gpio, const char *label) | |||
32 | 33 | ||
33 | static inline void gpio_free(unsigned gpio) | 34 | static inline void gpio_free(unsigned gpio) |
34 | { | 35 | { |
36 | might_sleep(); | ||
37 | |||
35 | /* GPIO can never have been requested */ | 38 | /* GPIO can never have been requested */ |
36 | WARN_ON(1); | 39 | WARN_ON(1); |
37 | } | 40 | } |
diff --git a/include/linux/hid.h b/include/linux/hid.h index ac4e678a04ed..e5780f8c934a 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -67,6 +67,7 @@ | |||
67 | #include <linux/types.h> | 67 | #include <linux/types.h> |
68 | #include <linux/slab.h> | 68 | #include <linux/slab.h> |
69 | #include <linux/list.h> | 69 | #include <linux/list.h> |
70 | #include <linux/mod_devicetable.h> /* hid_device_id */ | ||
70 | #include <linux/timer.h> | 71 | #include <linux/timer.h> |
71 | #include <linux/workqueue.h> | 72 | #include <linux/workqueue.h> |
72 | #include <linux/input.h> | 73 | #include <linux/input.h> |
@@ -246,6 +247,19 @@ struct hid_item { | |||
246 | #define HID_FEATURE_REPORT 2 | 247 | #define HID_FEATURE_REPORT 2 |
247 | 248 | ||
248 | /* | 249 | /* |
250 | * HID connect requests | ||
251 | */ | ||
252 | |||
253 | #define HID_CONNECT_HIDINPUT 0x01 | ||
254 | #define HID_CONNECT_HIDINPUT_FORCE 0x02 | ||
255 | #define HID_CONNECT_HIDRAW 0x04 | ||
256 | #define HID_CONNECT_HIDDEV 0x08 | ||
257 | #define HID_CONNECT_HIDDEV_FORCE 0x10 | ||
258 | #define HID_CONNECT_FF 0x20 | ||
259 | #define HID_CONNECT_DEFAULT (HID_CONNECT_HIDINPUT|HID_CONNECT_HIDRAW| \ | ||
260 | HID_CONNECT_HIDDEV|HID_CONNECT_FF) | ||
261 | |||
262 | /* | ||
249 | * HID device quirks. | 263 | * HID device quirks. |
250 | */ | 264 | */ |
251 | 265 | ||
@@ -256,48 +270,11 @@ struct hid_item { | |||
256 | 270 | ||
257 | #define HID_QUIRK_INVERT 0x00000001 | 271 | #define HID_QUIRK_INVERT 0x00000001 |
258 | #define HID_QUIRK_NOTOUCH 0x00000002 | 272 | #define HID_QUIRK_NOTOUCH 0x00000002 |
259 | #define HID_QUIRK_IGNORE 0x00000004 | ||
260 | #define HID_QUIRK_NOGET 0x00000008 | 273 | #define HID_QUIRK_NOGET 0x00000008 |
261 | #define HID_QUIRK_HIDDEV 0x00000010 | ||
262 | #define HID_QUIRK_BADPAD 0x00000020 | 274 | #define HID_QUIRK_BADPAD 0x00000020 |
263 | #define HID_QUIRK_MULTI_INPUT 0x00000040 | 275 | #define HID_QUIRK_MULTI_INPUT 0x00000040 |
264 | #define HID_QUIRK_2WHEEL_MOUSE_HACK_7 0x00000080 | ||
265 | #define HID_QUIRK_2WHEEL_MOUSE_HACK_5 0x00000100 | ||
266 | #define HID_QUIRK_2WHEEL_MOUSE_HACK_ON 0x00000200 | ||
267 | #define HID_QUIRK_MIGHTYMOUSE 0x00000400 | ||
268 | #define HID_QUIRK_APPLE_HAS_FN 0x00000800 | ||
269 | #define HID_QUIRK_APPLE_FN_ON 0x00001000 | ||
270 | #define HID_QUIRK_INVERT_HWHEEL 0x00002000 | ||
271 | #define HID_QUIRK_APPLE_ISO_KEYBOARD 0x00004000 | ||
272 | #define HID_QUIRK_BAD_RELATIVE_KEYS 0x00008000 | ||
273 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 | 276 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 |
274 | #define HID_QUIRK_IGNORE_MOUSE 0x00020000 | ||
275 | #define HID_QUIRK_SONY_PS3_CONTROLLER 0x00040000 | ||
276 | #define HID_QUIRK_DUPLICATE_USAGES 0x00080000 | ||
277 | #define HID_QUIRK_RESET_LEDS 0x00100000 | ||
278 | #define HID_QUIRK_HIDINPUT 0x00200000 | ||
279 | #define HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL 0x00400000 | ||
280 | #define HID_QUIRK_LOGITECH_EXPANDED_KEYMAP 0x00800000 | ||
281 | #define HID_QUIRK_IGNORE_HIDINPUT 0x01000000 | ||
282 | #define HID_QUIRK_2WHEEL_MOUSE_HACK_B8 0x02000000 | ||
283 | #define HID_QUIRK_HWHEEL_WHEEL_INVERT 0x04000000 | ||
284 | #define HID_QUIRK_MICROSOFT_KEYS 0x08000000 | ||
285 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 | 277 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 |
286 | #define HID_QUIRK_APPLE_NUMLOCK_EMULATION 0x20000000 | ||
287 | |||
288 | /* | ||
289 | * Separate quirks for runtime report descriptor fixup | ||
290 | */ | ||
291 | |||
292 | #define HID_QUIRK_RDESC_CYMOTION 0x00000001 | ||
293 | #define HID_QUIRK_RDESC_LOGITECH 0x00000002 | ||
294 | #define HID_QUIRK_RDESC_SWAPPED_MIN_MAX 0x00000004 | ||
295 | #define HID_QUIRK_RDESC_PETALYNX 0x00000008 | ||
296 | #define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010 | ||
297 | #define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020 | ||
298 | #define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040 | ||
299 | #define HID_QUIRK_RDESC_MICROSOFT_RECV_1028 0x00000080 | ||
300 | #define HID_QUIRK_RDESC_SUNPLUS_WDESKTOP 0x00000100 | ||
301 | 278 | ||
302 | /* | 279 | /* |
303 | * This is the global environment of the parser. This information is | 280 | * This is the global environment of the parser. This information is |
@@ -411,12 +388,21 @@ struct hid_report_enum { | |||
411 | struct hid_control_fifo { | 388 | struct hid_control_fifo { |
412 | unsigned char dir; | 389 | unsigned char dir; |
413 | struct hid_report *report; | 390 | struct hid_report *report; |
391 | char *raw_report; | ||
392 | }; | ||
393 | |||
394 | struct hid_output_fifo { | ||
395 | struct hid_report *report; | ||
396 | char *raw_report; | ||
414 | }; | 397 | }; |
415 | 398 | ||
416 | #define HID_CLAIMED_INPUT 1 | 399 | #define HID_CLAIMED_INPUT 1 |
417 | #define HID_CLAIMED_HIDDEV 2 | 400 | #define HID_CLAIMED_HIDDEV 2 |
418 | #define HID_CLAIMED_HIDRAW 4 | 401 | #define HID_CLAIMED_HIDRAW 4 |
419 | 402 | ||
403 | #define HID_STAT_ADDED 1 | ||
404 | #define HID_STAT_PARSED 2 | ||
405 | |||
420 | #define HID_CTRL_RUNNING 1 | 406 | #define HID_CTRL_RUNNING 1 |
421 | #define HID_OUT_RUNNING 2 | 407 | #define HID_OUT_RUNNING 2 |
422 | #define HID_IN_RUNNING 3 | 408 | #define HID_IN_RUNNING 3 |
@@ -424,6 +410,7 @@ struct hid_control_fifo { | |||
424 | #define HID_SUSPENDED 5 | 410 | #define HID_SUSPENDED 5 |
425 | #define HID_CLEAR_HALT 6 | 411 | #define HID_CLEAR_HALT 6 |
426 | #define HID_DISCONNECTED 7 | 412 | #define HID_DISCONNECTED 7 |
413 | #define HID_STARTED 8 | ||
427 | 414 | ||
428 | struct hid_input { | 415 | struct hid_input { |
429 | struct list_head list; | 416 | struct list_head list; |
@@ -431,22 +418,34 @@ struct hid_input { | |||
431 | struct input_dev *input; | 418 | struct input_dev *input; |
432 | }; | 419 | }; |
433 | 420 | ||
421 | enum hid_type { | ||
422 | HID_TYPE_OTHER = 0, | ||
423 | HID_TYPE_USBMOUSE | ||
424 | }; | ||
425 | |||
426 | struct hid_driver; | ||
427 | struct hid_ll_driver; | ||
428 | |||
434 | struct hid_device { /* device report descriptor */ | 429 | struct hid_device { /* device report descriptor */ |
435 | __u8 *rdesc; | 430 | __u8 *rdesc; |
436 | unsigned rsize; | 431 | unsigned rsize; |
437 | struct hid_collection *collection; /* List of HID collections */ | 432 | struct hid_collection *collection; /* List of HID collections */ |
438 | unsigned collection_size; /* Number of allocated hid_collections */ | 433 | unsigned collection_size; /* Number of allocated hid_collections */ |
439 | unsigned maxcollection; /* Number of parsed collections */ | 434 | unsigned maxcollection; /* Number of parsed collections */ |
440 | unsigned maxapplication; /* Number of applications */ | 435 | unsigned maxapplication; /* Number of applications */ |
441 | unsigned short bus; /* BUS ID */ | 436 | __u16 bus; /* BUS ID */ |
442 | unsigned short vendor; /* Vendor ID */ | 437 | __u32 vendor; /* Vendor ID */ |
443 | unsigned short product; /* Product ID */ | 438 | __u32 product; /* Product ID */ |
444 | unsigned version; /* HID version */ | 439 | __u32 version; /* HID version */ |
440 | enum hid_type type; /* device type (mouse, kbd, ...) */ | ||
445 | unsigned country; /* HID country */ | 441 | unsigned country; /* HID country */ |
446 | struct hid_report_enum report_enum[HID_REPORT_TYPES]; | 442 | struct hid_report_enum report_enum[HID_REPORT_TYPES]; |
447 | 443 | ||
448 | struct device *dev; /* device */ | 444 | struct device dev; /* device */ |
445 | struct hid_driver *driver; | ||
446 | struct hid_ll_driver *ll_driver; | ||
449 | 447 | ||
448 | unsigned int status; /* see STAT flags above */ | ||
450 | unsigned claimed; /* Claimed by hidinput, hiddev? */ | 449 | unsigned claimed; /* Claimed by hidinput, hiddev? */ |
451 | unsigned quirks; /* Various quirks the device can pull on us */ | 450 | unsigned quirks; /* Various quirks the device can pull on us */ |
452 | 451 | ||
@@ -462,26 +461,29 @@ struct hid_device { /* device report descriptor */ | |||
462 | 461 | ||
463 | void *driver_data; | 462 | void *driver_data; |
464 | 463 | ||
465 | __s32 delayed_value; /* For A4 Tech mice hwheel quirk */ | 464 | /* temporary hid_ff handling (until moved to the drivers) */ |
466 | 465 | int (*ff_init)(struct hid_device *); | |
467 | /* device-specific function pointers */ | ||
468 | int (*hidinput_input_event) (struct input_dev *, unsigned int, unsigned int, int); | ||
469 | int (*hid_open) (struct hid_device *); | ||
470 | void (*hid_close) (struct hid_device *); | ||
471 | 466 | ||
472 | /* hiddev event handler */ | 467 | /* hiddev event handler */ |
468 | int (*hiddev_connect)(struct hid_device *, unsigned int); | ||
473 | void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field, | 469 | void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field, |
474 | struct hid_usage *, __s32); | 470 | struct hid_usage *, __s32); |
475 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); | 471 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); |
476 | 472 | ||
477 | /* handler for raw output data, used by hidraw */ | 473 | /* handler for raw output data, used by hidraw */ |
478 | int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); | 474 | int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); |
479 | #ifdef CONFIG_USB_HIDINPUT_POWERBOOK | ||
480 | unsigned long apple_pressed_fn[BITS_TO_LONGS(KEY_CNT)]; | ||
481 | unsigned long pb_pressed_numlock[BITS_TO_LONGS(KEY_CNT)]; | ||
482 | #endif | ||
483 | }; | 475 | }; |
484 | 476 | ||
477 | static inline void *hid_get_drvdata(struct hid_device *hdev) | ||
478 | { | ||
479 | return dev_get_drvdata(&hdev->dev); | ||
480 | } | ||
481 | |||
482 | static inline void hid_set_drvdata(struct hid_device *hdev, void *data) | ||
483 | { | ||
484 | dev_set_drvdata(&hdev->dev, data); | ||
485 | } | ||
486 | |||
485 | #define HID_GLOBAL_STACK_SIZE 4 | 487 | #define HID_GLOBAL_STACK_SIZE 4 |
486 | #define HID_COLLECTION_STACK_SIZE 4 | 488 | #define HID_COLLECTION_STACK_SIZE 4 |
487 | 489 | ||
@@ -510,6 +512,107 @@ struct hid_descriptor { | |||
510 | struct hid_class_descriptor desc[1]; | 512 | struct hid_class_descriptor desc[1]; |
511 | } __attribute__ ((packed)); | 513 | } __attribute__ ((packed)); |
512 | 514 | ||
515 | #define HID_DEVICE(b, ven, prod) \ | ||
516 | .bus = (b), \ | ||
517 | .vendor = (ven), .product = (prod) | ||
518 | |||
519 | #define HID_USB_DEVICE(ven, prod) HID_DEVICE(BUS_USB, ven, prod) | ||
520 | #define HID_BLUETOOTH_DEVICE(ven, prod) HID_DEVICE(BUS_BLUETOOTH, ven, prod) | ||
521 | |||
522 | #define HID_REPORT_ID(rep) \ | ||
523 | .report_type = (rep) | ||
524 | #define HID_USAGE_ID(uhid, utype, ucode) \ | ||
525 | .usage_hid = (uhid), .usage_type = (utype), .usage_code = (ucode) | ||
526 | /* we don't want to catch types and codes equal to 0 */ | ||
527 | #define HID_TERMINATOR (HID_ANY_ID - 1) | ||
528 | |||
529 | struct hid_report_id { | ||
530 | __u32 report_type; | ||
531 | }; | ||
532 | struct hid_usage_id { | ||
533 | __u32 usage_hid; | ||
534 | __u32 usage_type; | ||
535 | __u32 usage_code; | ||
536 | }; | ||
537 | |||
538 | /** | ||
539 | * struct hid_driver | ||
540 | * @name: driver name (e.g. "Footech_bar-wheel") | ||
541 | * @id_table: which devices is this driver for (must be non-NULL for probe | ||
542 | * to be called) | ||
543 | * @probe: new device inserted | ||
544 | * @remove: device removed (NULL if not a hot-plug capable driver) | ||
545 | * @report_table: on which reports to call raw_event (NULL means all) | ||
546 | * @raw_event: if report in report_table, this hook is called (NULL means nop) | ||
547 | * @usage_table: on which events to call event (NULL means all) | ||
548 | * @event: if usage in usage_table, this hook is called (NULL means nop) | ||
549 | * @report_fixup: called before report descriptor parsing (NULL means nop) | ||
550 | * @input_mapping: invoked on input registering before mapping an usage | ||
551 | * @input_mapped: invoked on input registering after mapping an usage | ||
552 | * | ||
553 | * raw_event and event should return 0 on no action performed, 1 when no | ||
554 | * further processing should be done and negative on error | ||
555 | * | ||
556 | * input_mapping shall return a negative value to completely ignore this usage | ||
557 | * (e.g. doubled or invalid usage), zero to continue with parsing of this | ||
558 | * usage by generic code (no special handling needed) or positive to skip | ||
559 | * generic parsing (needed special handling which was done in the hook already) | ||
560 | * input_mapped shall return negative to inform the layer that this usage | ||
561 | * should not be considered for further processing or zero to notify that | ||
562 | * no processing was performed and should be done in a generic manner | ||
563 | * Both these functions may be NULL which means the same behavior as returning | ||
564 | * zero from them. | ||
565 | */ | ||
566 | struct hid_driver { | ||
567 | char *name; | ||
568 | const struct hid_device_id *id_table; | ||
569 | |||
570 | int (*probe)(struct hid_device *dev, const struct hid_device_id *id); | ||
571 | void (*remove)(struct hid_device *dev); | ||
572 | |||
573 | const struct hid_report_id *report_table; | ||
574 | int (*raw_event)(struct hid_device *hdev, struct hid_report *report, | ||
575 | u8 *data, int size); | ||
576 | const struct hid_usage_id *usage_table; | ||
577 | int (*event)(struct hid_device *hdev, struct hid_field *field, | ||
578 | struct hid_usage *usage, __s32 value); | ||
579 | |||
580 | void (*report_fixup)(struct hid_device *hdev, __u8 *buf, | ||
581 | unsigned int size); | ||
582 | |||
583 | int (*input_mapping)(struct hid_device *hdev, | ||
584 | struct hid_input *hidinput, struct hid_field *field, | ||
585 | struct hid_usage *usage, unsigned long **bit, int *max); | ||
586 | int (*input_mapped)(struct hid_device *hdev, | ||
587 | struct hid_input *hidinput, struct hid_field *field, | ||
588 | struct hid_usage *usage, unsigned long **bit, int *max); | ||
589 | /* private: */ | ||
590 | struct device_driver driver; | ||
591 | }; | ||
592 | |||
593 | /** | ||
594 | * hid_ll_driver - low level driver callbacks | ||
595 | * @start: called on probe to start the device | ||
596 | * @stop: called on remove | ||
597 | * @open: called by input layer on open | ||
598 | * @close: called by input layer on close | ||
599 | * @hidinput_input_event: event input event (e.g. ff or leds) | ||
600 | * @parse: this method is called only once to parse the device data, | ||
601 | * shouldn't allocate anything to not leak memory | ||
602 | */ | ||
603 | struct hid_ll_driver { | ||
604 | int (*start)(struct hid_device *hdev); | ||
605 | void (*stop)(struct hid_device *hdev); | ||
606 | |||
607 | int (*open)(struct hid_device *hdev); | ||
608 | void (*close)(struct hid_device *hdev); | ||
609 | |||
610 | int (*hidinput_input_event) (struct input_dev *idev, unsigned int type, | ||
611 | unsigned int code, int value); | ||
612 | |||
613 | int (*parse)(struct hid_device *hdev); | ||
614 | }; | ||
615 | |||
513 | /* Applications from HID Usage Tables 4/8/99 Version 1.1 */ | 616 | /* Applications from HID Usage Tables 4/8/99 Version 1.1 */ |
514 | /* We ignore a few input applications that are not widely used */ | 617 | /* We ignore a few input applications that are not widely used */ |
515 | #define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002)) | 618 | #define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002)) |
@@ -520,43 +623,157 @@ struct hid_descriptor { | |||
520 | extern int hid_debug; | 623 | extern int hid_debug; |
521 | #endif | 624 | #endif |
522 | 625 | ||
626 | extern int hid_add_device(struct hid_device *); | ||
627 | extern void hid_destroy_device(struct hid_device *); | ||
628 | |||
629 | extern int __must_check __hid_register_driver(struct hid_driver *, | ||
630 | struct module *, const char *mod_name); | ||
631 | static inline int __must_check hid_register_driver(struct hid_driver *driver) | ||
632 | { | ||
633 | return __hid_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); | ||
634 | } | ||
635 | extern void hid_unregister_driver(struct hid_driver *); | ||
636 | |||
523 | extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); | 637 | extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); |
524 | extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report); | 638 | extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report); |
525 | extern int hidinput_connect(struct hid_device *); | 639 | extern int hidinput_connect(struct hid_device *hid, unsigned int force); |
526 | extern void hidinput_disconnect(struct hid_device *); | 640 | extern void hidinput_disconnect(struct hid_device *); |
527 | 641 | ||
528 | int hid_set_field(struct hid_field *, unsigned, __s32); | 642 | int hid_set_field(struct hid_field *, unsigned, __s32); |
529 | int hid_input_report(struct hid_device *, int type, u8 *, int, int); | 643 | int hid_input_report(struct hid_device *, int type, u8 *, int, int); |
530 | int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); | 644 | int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); |
531 | int hidinput_mapping_quirks(struct hid_usage *, struct input_dev *, unsigned long **, int *); | ||
532 | int hidinput_event_quirks(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); | ||
533 | int hidinput_apple_event(struct hid_device *, struct input_dev *, struct hid_usage *, __s32); | ||
534 | void hid_output_report(struct hid_report *report, __u8 *data); | 645 | void hid_output_report(struct hid_report *report, __u8 *data); |
535 | void hid_free_device(struct hid_device *device); | 646 | struct hid_device *hid_allocate_device(void); |
536 | struct hid_device *hid_parse_report(__u8 *start, unsigned size); | 647 | int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); |
648 | int hid_connect(struct hid_device *hid, unsigned int connect_mask); | ||
649 | |||
650 | /** | ||
651 | * hid_map_usage - map usage input bits | ||
652 | * | ||
653 | * @hidinput: hidinput which we are interested in | ||
654 | * @usage: usage to fill in | ||
655 | * @bit: pointer to input->{}bit (out parameter) | ||
656 | * @max: maximal valid usage->code to consider later (out parameter) | ||
657 | * @type: input event type (EV_KEY, EV_REL, ...) | ||
658 | * @c: code which corresponds to this usage and type | ||
659 | */ | ||
660 | static inline void hid_map_usage(struct hid_input *hidinput, | ||
661 | struct hid_usage *usage, unsigned long **bit, int *max, | ||
662 | __u8 type, __u16 c) | ||
663 | { | ||
664 | struct input_dev *input = hidinput->input; | ||
665 | |||
666 | usage->type = type; | ||
667 | usage->code = c; | ||
668 | |||
669 | switch (type) { | ||
670 | case EV_ABS: | ||
671 | *bit = input->absbit; | ||
672 | *max = ABS_MAX; | ||
673 | break; | ||
674 | case EV_REL: | ||
675 | *bit = input->relbit; | ||
676 | *max = REL_MAX; | ||
677 | break; | ||
678 | case EV_KEY: | ||
679 | *bit = input->keybit; | ||
680 | *max = KEY_MAX; | ||
681 | break; | ||
682 | case EV_LED: | ||
683 | *bit = input->ledbit; | ||
684 | *max = LED_MAX; | ||
685 | break; | ||
686 | } | ||
687 | } | ||
688 | |||
689 | /** | ||
690 | * hid_map_usage_clear - map usage input bits and clear the input bit | ||
691 | * | ||
692 | * The same as hid_map_usage, except the @c bit is also cleared in supported | ||
693 | * bits (@bit). | ||
694 | */ | ||
695 | static inline void hid_map_usage_clear(struct hid_input *hidinput, | ||
696 | struct hid_usage *usage, unsigned long **bit, int *max, | ||
697 | __u8 type, __u16 c) | ||
698 | { | ||
699 | hid_map_usage(hidinput, usage, bit, max, type, c); | ||
700 | clear_bit(c, *bit); | ||
701 | } | ||
702 | |||
703 | /** | ||
704 | * hid_parse - parse HW reports | ||
705 | * | ||
706 | * @hdev: hid device | ||
707 | * | ||
708 | * Call this from probe after you set up the device (if needed). Your | ||
709 | * report_fixup will be called (if non-NULL) after reading raw report from | ||
710 | * device before passing it to hid layer for real parsing. | ||
711 | */ | ||
712 | static inline int __must_check hid_parse(struct hid_device *hdev) | ||
713 | { | ||
714 | int ret; | ||
715 | |||
716 | if (hdev->status & HID_STAT_PARSED) | ||
717 | return 0; | ||
718 | |||
719 | ret = hdev->ll_driver->parse(hdev); | ||
720 | if (!ret) | ||
721 | hdev->status |= HID_STAT_PARSED; | ||
722 | |||
723 | return ret; | ||
724 | } | ||
725 | |||
726 | /** | ||
727 | * hid_hw_start - start underlaying HW | ||
728 | * | ||
729 | * @hdev: hid device | ||
730 | * @connect_mask: which outputs to connect, see HID_CONNECT_* | ||
731 | * | ||
732 | * Call this in probe function *after* hid_parse. This will setup HW buffers | ||
733 | * and start the device (if not deffered to device open). hid_hw_stop must be | ||
734 | * called if this was successfull. | ||
735 | */ | ||
736 | static inline int __must_check hid_hw_start(struct hid_device *hdev, | ||
737 | unsigned int connect_mask) | ||
738 | { | ||
739 | int ret = hdev->ll_driver->start(hdev); | ||
740 | if (ret || !connect_mask) | ||
741 | return ret; | ||
742 | ret = hid_connect(hdev, connect_mask); | ||
743 | if (ret) | ||
744 | hdev->ll_driver->stop(hdev); | ||
745 | return ret; | ||
746 | } | ||
747 | |||
748 | /** | ||
749 | * hid_hw_stop - stop underlaying HW | ||
750 | * | ||
751 | * @hdev: hid device | ||
752 | * | ||
753 | * This is usually called from remove function or from probe when something | ||
754 | * failed and hid_hw_start was called already. | ||
755 | */ | ||
756 | static inline void hid_hw_stop(struct hid_device *hdev) | ||
757 | { | ||
758 | hdev->ll_driver->stop(hdev); | ||
759 | } | ||
760 | |||
761 | void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, | ||
762 | int interrupt); | ||
763 | |||
764 | extern int hid_generic_init(void); | ||
765 | extern void hid_generic_exit(void); | ||
537 | 766 | ||
538 | /* HID quirks API */ | 767 | /* HID quirks API */ |
539 | u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct); | 768 | u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct); |
540 | int usbhid_quirks_init(char **quirks_param); | 769 | int usbhid_quirks_init(char **quirks_param); |
541 | void usbhid_quirks_exit(void); | 770 | void usbhid_quirks_exit(void); |
542 | void usbhid_fixup_report_descriptor(const u16, const u16, char *, unsigned, char **); | 771 | void usbhid_set_leds(struct hid_device *hid); |
543 | |||
544 | #ifdef CONFIG_HID_FF | ||
545 | int hid_ff_init(struct hid_device *hid); | ||
546 | 772 | ||
547 | int hid_lgff_init(struct hid_device *hid); | ||
548 | int hid_lg2ff_init(struct hid_device *hid); | ||
549 | int hid_plff_init(struct hid_device *hid); | ||
550 | int hid_tmff_init(struct hid_device *hid); | ||
551 | int hid_zpff_init(struct hid_device *hid); | ||
552 | #ifdef CONFIG_HID_PID | 773 | #ifdef CONFIG_HID_PID |
553 | int hid_pidff_init(struct hid_device *hid); | 774 | int hid_pidff_init(struct hid_device *hid); |
554 | #else | 775 | #else |
555 | static inline int hid_pidff_init(struct hid_device *hid) { return -ENODEV; } | 776 | #define hid_pidff_init NULL |
556 | #endif | ||
557 | |||
558 | #else | ||
559 | static inline int hid_ff_init(struct hid_device *hid) { return -1; } | ||
560 | #endif | 777 | #endif |
561 | 778 | ||
562 | #ifdef CONFIG_HID_DEBUG | 779 | #ifdef CONFIG_HID_DEBUG |
@@ -572,10 +789,23 @@ dbg_hid(const char *fmt, ...) | |||
572 | return 0; | 789 | return 0; |
573 | } | 790 | } |
574 | #define dbg_hid_line dbg_hid | 791 | #define dbg_hid_line dbg_hid |
575 | #endif | 792 | #endif /* HID_DEBUG */ |
576 | 793 | ||
577 | #define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ | 794 | #define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ |
578 | __FILE__ , ## arg) | 795 | __FILE__ , ## arg) |
579 | #endif | 796 | #endif /* HID_FF */ |
797 | |||
798 | #ifdef CONFIG_HID_COMPAT | ||
799 | #define HID_COMPAT_LOAD_DRIVER(name) \ | ||
800 | void hid_compat_##name(void) { } \ | ||
801 | EXPORT_SYMBOL(hid_compat_##name) | ||
802 | #else | ||
803 | #define HID_COMPAT_LOAD_DRIVER(name) | ||
804 | #endif /* HID_COMPAT */ | ||
805 | #define HID_COMPAT_CALL_DRIVER(name) do { \ | ||
806 | extern void hid_compat_##name(void); \ | ||
807 | hid_compat_##name(); \ | ||
808 | } while (0) | ||
809 | |||
580 | #endif | 810 | #endif |
581 | 811 | ||
diff --git a/include/linux/hiddev.h b/include/linux/hiddev.h index a416b904ba90..c760ae0eb6a1 100644 --- a/include/linux/hiddev.h +++ b/include/linux/hiddev.h | |||
@@ -182,26 +182,28 @@ struct hiddev_usage_ref_multi { | |||
182 | /* To traverse the input report descriptor info for a HID device, perform the | 182 | /* To traverse the input report descriptor info for a HID device, perform the |
183 | * following: | 183 | * following: |
184 | * | 184 | * |
185 | * rinfo.report_type = HID_REPORT_TYPE_INPUT; | 185 | * rinfo.report_type = HID_REPORT_TYPE_INPUT; |
186 | * rinfo.report_id = HID_REPORT_ID_FIRST; | 186 | * rinfo.report_id = HID_REPORT_ID_FIRST; |
187 | * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); | 187 | * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); |
188 | * | 188 | * |
189 | * while (ret >= 0) { | 189 | * while (ret >= 0) { |
190 | * for (i = 0; i < rinfo.num_fields; i++) { | 190 | * for (i = 0; i < rinfo.num_fields; i++) { |
191 | * finfo.report_type = rinfo.report_type; | 191 | * finfo.report_type = rinfo.report_type; |
192 | * finfo.report_id = rinfo.report_id; | 192 | * finfo.report_id = rinfo.report_id; |
193 | * finfo.field_index = i; | 193 | * finfo.field_index = i; |
194 | * ioctl(fd, HIDIOCGFIELDINFO, &finfo); | 194 | * ioctl(fd, HIDIOCGFIELDINFO, &finfo); |
195 | * for (j = 0; j < finfo.maxusage; j++) { | 195 | * for (j = 0; j < finfo.maxusage; j++) { |
196 | * uref.field_index = i; | 196 | * uref.report_type = rinfo.report_type; |
197 | * uref.usage_index = j; | 197 | * uref.report_id = rinfo.report_id; |
198 | * ioctl(fd, HIDIOCGUCODE, &uref); | 198 | * uref.field_index = i; |
199 | * ioctl(fd, HIDIOCGUSAGE, &uref); | 199 | * uref.usage_index = j; |
200 | * } | 200 | * ioctl(fd, HIDIOCGUCODE, &uref); |
201 | * } | 201 | * ioctl(fd, HIDIOCGUSAGE, &uref); |
202 | * rinfo.report_id |= HID_REPORT_ID_NEXT; | 202 | * } |
203 | * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); | 203 | * } |
204 | * } | 204 | * rinfo.report_id |= HID_REPORT_ID_NEXT; |
205 | * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); | ||
206 | * } | ||
205 | */ | 207 | */ |
206 | 208 | ||
207 | 209 | ||
@@ -217,7 +219,7 @@ struct hid_field; | |||
217 | struct hid_report; | 219 | struct hid_report; |
218 | 220 | ||
219 | #ifdef CONFIG_USB_HIDDEV | 221 | #ifdef CONFIG_USB_HIDDEV |
220 | int hiddev_connect(struct hid_device *); | 222 | int hiddev_connect(struct hid_device *hid, unsigned int force); |
221 | void hiddev_disconnect(struct hid_device *); | 223 | void hiddev_disconnect(struct hid_device *); |
222 | void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, | 224 | void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, |
223 | struct hid_usage *usage, __s32 value); | 225 | struct hid_usage *usage, __s32 value); |
@@ -225,7 +227,9 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report); | |||
225 | int __init hiddev_init(void); | 227 | int __init hiddev_init(void); |
226 | void hiddev_exit(void); | 228 | void hiddev_exit(void); |
227 | #else | 229 | #else |
228 | static inline int hiddev_connect(struct hid_device *hid) { return -1; } | 230 | static inline int hiddev_connect(struct hid_device *hid, |
231 | unsigned int force) | ||
232 | { return -1; } | ||
229 | static inline void hiddev_disconnect(struct hid_device *hid) { } | 233 | static inline void hiddev_disconnect(struct hid_device *hid) { } |
230 | static inline void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, | 234 | static inline void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, |
231 | struct hid_usage *usage, __s32 value) { } | 235 | struct hid_usage *usage, __s32 value) { } |
diff --git a/include/linux/hpet.h b/include/linux/hpet.h index 2dc29ce6c8e4..79f63a27bcef 100644 --- a/include/linux/hpet.h +++ b/include/linux/hpet.h | |||
@@ -37,6 +37,7 @@ struct hpet { | |||
37 | #define hpet_compare _u1._hpet_compare | 37 | #define hpet_compare _u1._hpet_compare |
38 | 38 | ||
39 | #define HPET_MAX_TIMERS (32) | 39 | #define HPET_MAX_TIMERS (32) |
40 | #define HPET_MAX_IRQ (32) | ||
40 | 41 | ||
41 | /* | 42 | /* |
42 | * HPET general capabilities register | 43 | * HPET general capabilities register |
@@ -64,7 +65,7 @@ struct hpet { | |||
64 | */ | 65 | */ |
65 | 66 | ||
66 | #define Tn_INT_ROUTE_CAP_MASK (0xffffffff00000000ULL) | 67 | #define Tn_INT_ROUTE_CAP_MASK (0xffffffff00000000ULL) |
67 | #define Tn_INI_ROUTE_CAP_SHIFT (32UL) | 68 | #define Tn_INT_ROUTE_CAP_SHIFT (32UL) |
68 | #define Tn_FSB_INT_DELCAP_MASK (0x8000UL) | 69 | #define Tn_FSB_INT_DELCAP_MASK (0x8000UL) |
69 | #define Tn_FSB_INT_DELCAP_SHIFT (15) | 70 | #define Tn_FSB_INT_DELCAP_SHIFT (15) |
70 | #define Tn_FSB_EN_CNF_MASK (0x4000UL) | 71 | #define Tn_FSB_EN_CNF_MASK (0x4000UL) |
@@ -91,23 +92,14 @@ struct hpet { | |||
91 | * exported interfaces | 92 | * exported interfaces |
92 | */ | 93 | */ |
93 | 94 | ||
94 | struct hpet_task { | ||
95 | void (*ht_func) (void *); | ||
96 | void *ht_data; | ||
97 | void *ht_opaque; | ||
98 | }; | ||
99 | |||
100 | struct hpet_data { | 95 | struct hpet_data { |
101 | unsigned long hd_phys_address; | 96 | unsigned long hd_phys_address; |
102 | void __iomem *hd_address; | 97 | void __iomem *hd_address; |
103 | unsigned short hd_nirqs; | 98 | unsigned short hd_nirqs; |
104 | unsigned short hd_flags; | ||
105 | unsigned int hd_state; /* timer allocated */ | 99 | unsigned int hd_state; /* timer allocated */ |
106 | unsigned int hd_irq[HPET_MAX_TIMERS]; | 100 | unsigned int hd_irq[HPET_MAX_TIMERS]; |
107 | }; | 101 | }; |
108 | 102 | ||
109 | #define HPET_DATA_PLATFORM 0x0001 /* platform call to hpet_alloc */ | ||
110 | |||
111 | static inline void hpet_reserve_timer(struct hpet_data *hd, int timer) | 103 | static inline void hpet_reserve_timer(struct hpet_data *hd, int timer) |
112 | { | 104 | { |
113 | hd->hd_state |= (1 << timer); | 105 | hd->hd_state |= (1 << timer); |
@@ -125,7 +117,7 @@ struct hpet_info { | |||
125 | unsigned short hi_timer; | 117 | unsigned short hi_timer; |
126 | }; | 118 | }; |
127 | 119 | ||
128 | #define HPET_INFO_PERIODIC 0x0001 /* timer is periodic */ | 120 | #define HPET_INFO_PERIODIC 0x0010 /* periodic-capable comparator */ |
129 | 121 | ||
130 | #define HPET_IE_ON _IO('h', 0x01) /* interrupt on */ | 122 | #define HPET_IE_ON _IO('h', 0x01) /* interrupt on */ |
131 | #define HPET_IE_OFF _IO('h', 0x02) /* interrupt off */ | 123 | #define HPET_IE_OFF _IO('h', 0x02) /* interrupt off */ |
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 6d93dce61cbb..3eba43878dcb 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -20,6 +20,8 @@ | |||
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/list.h> | 21 | #include <linux/list.h> |
22 | #include <linux/wait.h> | 22 | #include <linux/wait.h> |
23 | #include <linux/percpu.h> | ||
24 | |||
23 | 25 | ||
24 | struct hrtimer_clock_base; | 26 | struct hrtimer_clock_base; |
25 | struct hrtimer_cpu_base; | 27 | struct hrtimer_cpu_base; |
@@ -44,17 +46,20 @@ enum hrtimer_restart { | |||
44 | * hrtimer callback modes: | 46 | * hrtimer callback modes: |
45 | * | 47 | * |
46 | * HRTIMER_CB_SOFTIRQ: Callback must run in softirq context | 48 | * HRTIMER_CB_SOFTIRQ: Callback must run in softirq context |
47 | * HRTIMER_CB_IRQSAFE: Callback may run in hardirq context | 49 | * HRTIMER_CB_IRQSAFE_PERCPU: Callback must run in hardirq context |
48 | * HRTIMER_CB_IRQSAFE_NO_RESTART: Callback may run in hardirq context and | 50 | * Special mode for tick emulation and |
49 | * does not restart the timer | 51 | * scheduler timer. Such timers are per |
50 | * HRTIMER_CB_IRQSAFE_NO_SOFTIRQ: Callback must run in hardirq context | 52 | * cpu and not allowed to be migrated on |
51 | * Special mode for tick emultation | 53 | * cpu unplug. |
54 | * HRTIMER_CB_IRQSAFE_UNLOCKED: Callback should run in hardirq context | ||
55 | * with timer->base lock unlocked | ||
56 | * used for timers which call wakeup to | ||
57 | * avoid lock order problems with rq->lock | ||
52 | */ | 58 | */ |
53 | enum hrtimer_cb_mode { | 59 | enum hrtimer_cb_mode { |
54 | HRTIMER_CB_SOFTIRQ, | 60 | HRTIMER_CB_SOFTIRQ, |
55 | HRTIMER_CB_IRQSAFE, | 61 | HRTIMER_CB_IRQSAFE_PERCPU, |
56 | HRTIMER_CB_IRQSAFE_NO_RESTART, | 62 | HRTIMER_CB_IRQSAFE_UNLOCKED, |
57 | HRTIMER_CB_IRQSAFE_NO_SOFTIRQ, | ||
58 | }; | 63 | }; |
59 | 64 | ||
60 | /* | 65 | /* |
@@ -67,9 +72,10 @@ enum hrtimer_cb_mode { | |||
67 | * 0x02 callback function running | 72 | * 0x02 callback function running |
68 | * 0x04 callback pending (high resolution mode) | 73 | * 0x04 callback pending (high resolution mode) |
69 | * | 74 | * |
70 | * Special case: | 75 | * Special cases: |
71 | * 0x03 callback function running and enqueued | 76 | * 0x03 callback function running and enqueued |
72 | * (was requeued on another CPU) | 77 | * (was requeued on another CPU) |
78 | * 0x09 timer was migrated on CPU hotunplug | ||
73 | * The "callback function running and enqueued" status is only possible on | 79 | * The "callback function running and enqueued" status is only possible on |
74 | * SMP. It happens for example when a posix timer expired and the callback | 80 | * SMP. It happens for example when a posix timer expired and the callback |
75 | * queued a signal. Between dropping the lock which protects the posix timer | 81 | * queued a signal. Between dropping the lock which protects the posix timer |
@@ -87,13 +93,19 @@ enum hrtimer_cb_mode { | |||
87 | #define HRTIMER_STATE_ENQUEUED 0x01 | 93 | #define HRTIMER_STATE_ENQUEUED 0x01 |
88 | #define HRTIMER_STATE_CALLBACK 0x02 | 94 | #define HRTIMER_STATE_CALLBACK 0x02 |
89 | #define HRTIMER_STATE_PENDING 0x04 | 95 | #define HRTIMER_STATE_PENDING 0x04 |
96 | #define HRTIMER_STATE_MIGRATE 0x08 | ||
90 | 97 | ||
91 | /** | 98 | /** |
92 | * struct hrtimer - the basic hrtimer structure | 99 | * struct hrtimer - the basic hrtimer structure |
93 | * @node: red black tree node for time ordered insertion | 100 | * @node: red black tree node for time ordered insertion |
94 | * @expires: the absolute expiry time in the hrtimers internal | 101 | * @_expires: the absolute expiry time in the hrtimers internal |
95 | * representation. The time is related to the clock on | 102 | * representation. The time is related to the clock on |
96 | * which the timer is based. | 103 | * which the timer is based. Is setup by adding |
104 | * slack to the _softexpires value. For non range timers | ||
105 | * identical to _softexpires. | ||
106 | * @_softexpires: the absolute earliest expiry time of the hrtimer. | ||
107 | * The time which was given as expiry time when the timer | ||
108 | * was armed. | ||
97 | * @function: timer expiry callback function | 109 | * @function: timer expiry callback function |
98 | * @base: pointer to the timer base (per cpu and per clock) | 110 | * @base: pointer to the timer base (per cpu and per clock) |
99 | * @state: state information (See bit values above) | 111 | * @state: state information (See bit values above) |
@@ -111,16 +123,17 @@ enum hrtimer_cb_mode { | |||
111 | */ | 123 | */ |
112 | struct hrtimer { | 124 | struct hrtimer { |
113 | struct rb_node node; | 125 | struct rb_node node; |
114 | ktime_t expires; | 126 | ktime_t _expires; |
127 | ktime_t _softexpires; | ||
115 | enum hrtimer_restart (*function)(struct hrtimer *); | 128 | enum hrtimer_restart (*function)(struct hrtimer *); |
116 | struct hrtimer_clock_base *base; | 129 | struct hrtimer_clock_base *base; |
117 | unsigned long state; | 130 | unsigned long state; |
118 | enum hrtimer_cb_mode cb_mode; | ||
119 | struct list_head cb_entry; | 131 | struct list_head cb_entry; |
132 | enum hrtimer_cb_mode cb_mode; | ||
120 | #ifdef CONFIG_TIMER_STATS | 133 | #ifdef CONFIG_TIMER_STATS |
134 | int start_pid; | ||
121 | void *start_site; | 135 | void *start_site; |
122 | char start_comm[16]; | 136 | char start_comm[16]; |
123 | int start_pid; | ||
124 | #endif | 137 | #endif |
125 | }; | 138 | }; |
126 | 139 | ||
@@ -145,10 +158,8 @@ struct hrtimer_sleeper { | |||
145 | * @first: pointer to the timer node which expires first | 158 | * @first: pointer to the timer node which expires first |
146 | * @resolution: the resolution of the clock, in nanoseconds | 159 | * @resolution: the resolution of the clock, in nanoseconds |
147 | * @get_time: function to retrieve the current time of the clock | 160 | * @get_time: function to retrieve the current time of the clock |
148 | * @get_softirq_time: function to retrieve the current time from the softirq | ||
149 | * @softirq_time: the time when running the hrtimer queue in the softirq | 161 | * @softirq_time: the time when running the hrtimer queue in the softirq |
150 | * @offset: offset of this clock to the monotonic base | 162 | * @offset: offset of this clock to the monotonic base |
151 | * @reprogram: function to reprogram the timer event | ||
152 | */ | 163 | */ |
153 | struct hrtimer_clock_base { | 164 | struct hrtimer_clock_base { |
154 | struct hrtimer_cpu_base *cpu_base; | 165 | struct hrtimer_cpu_base *cpu_base; |
@@ -157,13 +168,9 @@ struct hrtimer_clock_base { | |||
157 | struct rb_node *first; | 168 | struct rb_node *first; |
158 | ktime_t resolution; | 169 | ktime_t resolution; |
159 | ktime_t (*get_time)(void); | 170 | ktime_t (*get_time)(void); |
160 | ktime_t (*get_softirq_time)(void); | ||
161 | ktime_t softirq_time; | 171 | ktime_t softirq_time; |
162 | #ifdef CONFIG_HIGH_RES_TIMERS | 172 | #ifdef CONFIG_HIGH_RES_TIMERS |
163 | ktime_t offset; | 173 | ktime_t offset; |
164 | int (*reprogram)(struct hrtimer *t, | ||
165 | struct hrtimer_clock_base *b, | ||
166 | ktime_t n); | ||
167 | #endif | 174 | #endif |
168 | }; | 175 | }; |
169 | 176 | ||
@@ -197,6 +204,71 @@ struct hrtimer_cpu_base { | |||
197 | #endif | 204 | #endif |
198 | }; | 205 | }; |
199 | 206 | ||
207 | static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time) | ||
208 | { | ||
209 | timer->_expires = time; | ||
210 | timer->_softexpires = time; | ||
211 | } | ||
212 | |||
213 | static inline void hrtimer_set_expires_range(struct hrtimer *timer, ktime_t time, ktime_t delta) | ||
214 | { | ||
215 | timer->_softexpires = time; | ||
216 | timer->_expires = ktime_add_safe(time, delta); | ||
217 | } | ||
218 | |||
219 | static inline void hrtimer_set_expires_range_ns(struct hrtimer *timer, ktime_t time, unsigned long delta) | ||
220 | { | ||
221 | timer->_softexpires = time; | ||
222 | timer->_expires = ktime_add_safe(time, ns_to_ktime(delta)); | ||
223 | } | ||
224 | |||
225 | static inline void hrtimer_set_expires_tv64(struct hrtimer *timer, s64 tv64) | ||
226 | { | ||
227 | timer->_expires.tv64 = tv64; | ||
228 | timer->_softexpires.tv64 = tv64; | ||
229 | } | ||
230 | |||
231 | static inline void hrtimer_add_expires(struct hrtimer *timer, ktime_t time) | ||
232 | { | ||
233 | timer->_expires = ktime_add_safe(timer->_expires, time); | ||
234 | timer->_softexpires = ktime_add_safe(timer->_softexpires, time); | ||
235 | } | ||
236 | |||
237 | static inline void hrtimer_add_expires_ns(struct hrtimer *timer, u64 ns) | ||
238 | { | ||
239 | timer->_expires = ktime_add_ns(timer->_expires, ns); | ||
240 | timer->_softexpires = ktime_add_ns(timer->_softexpires, ns); | ||
241 | } | ||
242 | |||
243 | static inline ktime_t hrtimer_get_expires(const struct hrtimer *timer) | ||
244 | { | ||
245 | return timer->_expires; | ||
246 | } | ||
247 | |||
248 | static inline ktime_t hrtimer_get_softexpires(const struct hrtimer *timer) | ||
249 | { | ||
250 | return timer->_softexpires; | ||
251 | } | ||
252 | |||
253 | static inline s64 hrtimer_get_expires_tv64(const struct hrtimer *timer) | ||
254 | { | ||
255 | return timer->_expires.tv64; | ||
256 | } | ||
257 | static inline s64 hrtimer_get_softexpires_tv64(const struct hrtimer *timer) | ||
258 | { | ||
259 | return timer->_softexpires.tv64; | ||
260 | } | ||
261 | |||
262 | static inline s64 hrtimer_get_expires_ns(const struct hrtimer *timer) | ||
263 | { | ||
264 | return ktime_to_ns(timer->_expires); | ||
265 | } | ||
266 | |||
267 | static inline ktime_t hrtimer_expires_remaining(const struct hrtimer *timer) | ||
268 | { | ||
269 | return ktime_sub(timer->_expires, timer->base->get_time()); | ||
270 | } | ||
271 | |||
200 | #ifdef CONFIG_HIGH_RES_TIMERS | 272 | #ifdef CONFIG_HIGH_RES_TIMERS |
201 | struct clock_event_device; | 273 | struct clock_event_device; |
202 | 274 | ||
@@ -217,6 +289,8 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer) | |||
217 | return timer->base->cpu_base->hres_active; | 289 | return timer->base->cpu_base->hres_active; |
218 | } | 290 | } |
219 | 291 | ||
292 | extern void hrtimer_peek_ahead_timers(void); | ||
293 | |||
220 | /* | 294 | /* |
221 | * The resolution of the clocks. The resolution value is returned in | 295 | * The resolution of the clocks. The resolution value is returned in |
222 | * the clock_getres() system call to give application programmers an | 296 | * the clock_getres() system call to give application programmers an |
@@ -239,6 +313,7 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer) | |||
239 | * is expired in the next softirq when the clock was advanced. | 313 | * is expired in the next softirq when the clock was advanced. |
240 | */ | 314 | */ |
241 | static inline void clock_was_set(void) { } | 315 | static inline void clock_was_set(void) { } |
316 | static inline void hrtimer_peek_ahead_timers(void) { } | ||
242 | 317 | ||
243 | static inline void hres_timers_resume(void) { } | 318 | static inline void hres_timers_resume(void) { } |
244 | 319 | ||
@@ -260,6 +335,10 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer) | |||
260 | extern ktime_t ktime_get(void); | 335 | extern ktime_t ktime_get(void); |
261 | extern ktime_t ktime_get_real(void); | 336 | extern ktime_t ktime_get_real(void); |
262 | 337 | ||
338 | |||
339 | DECLARE_PER_CPU(struct tick_device, tick_cpu_device); | ||
340 | |||
341 | |||
263 | /* Exported timer functions: */ | 342 | /* Exported timer functions: */ |
264 | 343 | ||
265 | /* Initialize timers: */ | 344 | /* Initialize timers: */ |
@@ -284,12 +363,25 @@ static inline void destroy_hrtimer_on_stack(struct hrtimer *timer) { } | |||
284 | /* Basic timer operations: */ | 363 | /* Basic timer operations: */ |
285 | extern int hrtimer_start(struct hrtimer *timer, ktime_t tim, | 364 | extern int hrtimer_start(struct hrtimer *timer, ktime_t tim, |
286 | const enum hrtimer_mode mode); | 365 | const enum hrtimer_mode mode); |
366 | extern int hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, | ||
367 | unsigned long range_ns, const enum hrtimer_mode mode); | ||
287 | extern int hrtimer_cancel(struct hrtimer *timer); | 368 | extern int hrtimer_cancel(struct hrtimer *timer); |
288 | extern int hrtimer_try_to_cancel(struct hrtimer *timer); | 369 | extern int hrtimer_try_to_cancel(struct hrtimer *timer); |
289 | 370 | ||
371 | static inline int hrtimer_start_expires(struct hrtimer *timer, | ||
372 | enum hrtimer_mode mode) | ||
373 | { | ||
374 | unsigned long delta; | ||
375 | ktime_t soft, hard; | ||
376 | soft = hrtimer_get_softexpires(timer); | ||
377 | hard = hrtimer_get_expires(timer); | ||
378 | delta = ktime_to_ns(ktime_sub(hard, soft)); | ||
379 | return hrtimer_start_range_ns(timer, soft, delta, mode); | ||
380 | } | ||
381 | |||
290 | static inline int hrtimer_restart(struct hrtimer *timer) | 382 | static inline int hrtimer_restart(struct hrtimer *timer) |
291 | { | 383 | { |
292 | return hrtimer_start(timer, timer->expires, HRTIMER_MODE_ABS); | 384 | return hrtimer_start_expires(timer, HRTIMER_MODE_ABS); |
293 | } | 385 | } |
294 | 386 | ||
295 | /* Query timers: */ | 387 | /* Query timers: */ |
@@ -346,6 +438,10 @@ extern long hrtimer_nanosleep_restart(struct restart_block *restart_block); | |||
346 | extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, | 438 | extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, |
347 | struct task_struct *tsk); | 439 | struct task_struct *tsk); |
348 | 440 | ||
441 | extern int schedule_hrtimeout_range(ktime_t *expires, unsigned long delta, | ||
442 | const enum hrtimer_mode mode); | ||
443 | extern int schedule_hrtimeout(ktime_t *expires, const enum hrtimer_mode mode); | ||
444 | |||
349 | /* Soft interrupt function to run the hrtimer queues: */ | 445 | /* Soft interrupt function to run the hrtimer queues: */ |
350 | extern void hrtimer_run_queues(void); | 446 | extern void hrtimer_run_queues(void); |
351 | extern void hrtimer_run_pending(void); | 447 | extern void hrtimer_run_pending(void); |
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 32e0ef0f6e1f..e1c8afc002c0 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -27,7 +27,7 @@ void unmap_hugepage_range(struct vm_area_struct *, | |||
27 | void __unmap_hugepage_range(struct vm_area_struct *, | 27 | void __unmap_hugepage_range(struct vm_area_struct *, |
28 | unsigned long, unsigned long, struct page *); | 28 | unsigned long, unsigned long, struct page *); |
29 | int hugetlb_prefault(struct address_space *, struct vm_area_struct *); | 29 | int hugetlb_prefault(struct address_space *, struct vm_area_struct *); |
30 | int hugetlb_report_meminfo(char *); | 30 | void hugetlb_report_meminfo(struct seq_file *); |
31 | int hugetlb_report_node_meminfo(int, char *); | 31 | int hugetlb_report_node_meminfo(int, char *); |
32 | unsigned long hugetlb_total_pages(void); | 32 | unsigned long hugetlb_total_pages(void); |
33 | int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, | 33 | int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, |
@@ -79,7 +79,9 @@ static inline unsigned long hugetlb_total_pages(void) | |||
79 | #define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) | 79 | #define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) |
80 | #define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) | 80 | #define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) |
81 | #define unmap_hugepage_range(vma, start, end, page) BUG() | 81 | #define unmap_hugepage_range(vma, start, end, page) BUG() |
82 | #define hugetlb_report_meminfo(buf) 0 | 82 | static inline void hugetlb_report_meminfo(struct seq_file *m) |
83 | { | ||
84 | } | ||
83 | #define hugetlb_report_node_meminfo(n, buf) 0 | 85 | #define hugetlb_report_node_meminfo(n, buf) 0 |
84 | #define follow_huge_pmd(mm, addr, pmd, write) NULL | 86 | #define follow_huge_pmd(mm, addr, pmd, write) NULL |
85 | #define follow_huge_pud(mm, addr, pud, write) NULL | 87 | #define follow_huge_pud(mm, addr, pud, write) NULL |
diff --git a/include/linux/i2c-algo-pcf.h b/include/linux/i2c-algo-pcf.h index 0177d280f733..0f91a957a690 100644 --- a/include/linux/i2c-algo-pcf.h +++ b/include/linux/i2c-algo-pcf.h | |||
@@ -31,7 +31,10 @@ struct i2c_algo_pcf_data { | |||
31 | int (*getpcf) (void *data, int ctl); | 31 | int (*getpcf) (void *data, int ctl); |
32 | int (*getown) (void *data); | 32 | int (*getown) (void *data); |
33 | int (*getclock) (void *data); | 33 | int (*getclock) (void *data); |
34 | void (*waitforpin) (void); | 34 | void (*waitforpin) (void *data); |
35 | |||
36 | void (*xfer_begin) (void *data); | ||
37 | void (*xfer_end) (void *data); | ||
35 | 38 | ||
36 | /* Multi-master lost arbitration back-off delay (msecs) | 39 | /* Multi-master lost arbitration back-off delay (msecs) |
37 | * This should be set by the bus adapter or knowledgable client | 40 | * This should be set by the bus adapter or knowledgable client |
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index bf34c5f4c051..01d67ba9e985 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h | |||
@@ -41,7 +41,6 @@ | |||
41 | #define I2C_DRIVERID_SAA7110 22 /* video decoder */ | 41 | #define I2C_DRIVERID_SAA7110 22 /* video decoder */ |
42 | #define I2C_DRIVERID_SAA5249 24 /* SAA5249 and compatibles */ | 42 | #define I2C_DRIVERID_SAA5249 24 /* SAA5249 and compatibles */ |
43 | #define I2C_DRIVERID_PCF8583 25 /* real time clock */ | 43 | #define I2C_DRIVERID_PCF8583 25 /* real time clock */ |
44 | #define I2C_DRIVERID_SAB3036 26 /* SAB3036 tuner */ | ||
45 | #define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */ | 44 | #define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */ |
46 | #define I2C_DRIVERID_TVMIXER 28 /* Mixer driver for tv cards */ | 45 | #define I2C_DRIVERID_TVMIXER 28 /* Mixer driver for tv cards */ |
47 | #define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */ | 46 | #define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */ |
@@ -61,7 +60,7 @@ | |||
61 | #define I2C_DRIVERID_WM8775 69 /* wm8775 audio processor */ | 60 | #define I2C_DRIVERID_WM8775 69 /* wm8775 audio processor */ |
62 | #define I2C_DRIVERID_CS53L32A 70 /* cs53l32a audio processor */ | 61 | #define I2C_DRIVERID_CS53L32A 70 /* cs53l32a audio processor */ |
63 | #define I2C_DRIVERID_CX25840 71 /* cx2584x video encoder */ | 62 | #define I2C_DRIVERID_CX25840 71 /* cx2584x video encoder */ |
64 | #define I2C_DRIVERID_SAA7127 72 /* saa7124 video encoder */ | 63 | #define I2C_DRIVERID_SAA7127 72 /* saa7127 video encoder */ |
65 | #define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */ | 64 | #define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */ |
66 | #define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */ | 65 | #define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */ |
67 | #define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */ | 66 | #define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */ |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 06115128047f..33a5992d4936 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -53,45 +53,44 @@ struct i2c_board_info; | |||
53 | * transmit one message at a time, a more complex version can be used to | 53 | * transmit one message at a time, a more complex version can be used to |
54 | * transmit an arbitrary number of messages without interruption. | 54 | * transmit an arbitrary number of messages without interruption. |
55 | */ | 55 | */ |
56 | extern int i2c_master_send(struct i2c_client *,const char* ,int); | 56 | extern int i2c_master_send(struct i2c_client *client, const char *buf, |
57 | extern int i2c_master_recv(struct i2c_client *,char* ,int); | 57 | int count); |
58 | extern int i2c_master_recv(struct i2c_client *client, char *buf, int count); | ||
58 | 59 | ||
59 | /* Transfer num messages. | 60 | /* Transfer num messages. |
60 | */ | 61 | */ |
61 | extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num); | 62 | extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, |
62 | 63 | int num); | |
63 | 64 | ||
64 | /* This is the very generalized SMBus access routine. You probably do not | 65 | /* This is the very generalized SMBus access routine. You probably do not |
65 | want to use this, though; one of the functions below may be much easier, | 66 | want to use this, though; one of the functions below may be much easier, |
66 | and probably just as fast. | 67 | and probably just as fast. |
67 | Note that we use i2c_adapter here, because you do not need a specific | 68 | Note that we use i2c_adapter here, because you do not need a specific |
68 | smbus adapter to call this function. */ | 69 | smbus adapter to call this function. */ |
69 | extern s32 i2c_smbus_xfer (struct i2c_adapter * adapter, u16 addr, | 70 | extern s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, |
70 | unsigned short flags, | 71 | unsigned short flags, char read_write, u8 command, |
71 | char read_write, u8 command, int size, | 72 | int size, union i2c_smbus_data *data); |
72 | union i2c_smbus_data * data); | ||
73 | 73 | ||
74 | /* Now follow the 'nice' access routines. These also document the calling | 74 | /* Now follow the 'nice' access routines. These also document the calling |
75 | conventions of i2c_smbus_xfer. */ | 75 | conventions of i2c_smbus_xfer. */ |
76 | 76 | ||
77 | extern s32 i2c_smbus_read_byte(struct i2c_client * client); | 77 | extern s32 i2c_smbus_read_byte(struct i2c_client *client); |
78 | extern s32 i2c_smbus_write_byte(struct i2c_client * client, u8 value); | 78 | extern s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value); |
79 | extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command); | 79 | extern s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command); |
80 | extern s32 i2c_smbus_write_byte_data(struct i2c_client * client, | 80 | extern s32 i2c_smbus_write_byte_data(struct i2c_client *client, |
81 | u8 command, u8 value); | 81 | u8 command, u8 value); |
82 | extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command); | 82 | extern s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command); |
83 | extern s32 i2c_smbus_write_word_data(struct i2c_client * client, | 83 | extern s32 i2c_smbus_write_word_data(struct i2c_client *client, |
84 | u8 command, u16 value); | 84 | u8 command, u16 value); |
85 | /* Returns the number of read bytes */ | 85 | /* Returns the number of read bytes */ |
86 | extern s32 i2c_smbus_read_block_data(struct i2c_client *client, | 86 | extern s32 i2c_smbus_read_block_data(struct i2c_client *client, |
87 | u8 command, u8 *values); | 87 | u8 command, u8 *values); |
88 | extern s32 i2c_smbus_write_block_data(struct i2c_client * client, | 88 | extern s32 i2c_smbus_write_block_data(struct i2c_client *client, |
89 | u8 command, u8 length, | 89 | u8 command, u8 length, const u8 *values); |
90 | const u8 *values); | ||
91 | /* Returns the number of read bytes */ | 90 | /* Returns the number of read bytes */ |
92 | extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, | 91 | extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, |
93 | u8 command, u8 length, u8 *values); | 92 | u8 command, u8 length, u8 *values); |
94 | extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client, | 93 | extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, |
95 | u8 command, u8 length, | 94 | u8 command, u8 length, |
96 | const u8 *values); | 95 | const u8 *values); |
97 | 96 | ||
@@ -169,7 +168,7 @@ struct i2c_driver { | |||
169 | /* a ioctl like command that can be used to perform specific functions | 168 | /* a ioctl like command that can be used to perform specific functions |
170 | * with the device. | 169 | * with the device. |
171 | */ | 170 | */ |
172 | int (*command)(struct i2c_client *client,unsigned int cmd, void *arg); | 171 | int (*command)(struct i2c_client *client, unsigned int cmd, void *arg); |
173 | 172 | ||
174 | struct device_driver driver; | 173 | struct device_driver driver; |
175 | const struct i2c_device_id *id_table; | 174 | const struct i2c_device_id *id_table; |
@@ -224,14 +223,14 @@ static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj) | |||
224 | return to_i2c_client(dev); | 223 | return to_i2c_client(dev); |
225 | } | 224 | } |
226 | 225 | ||
227 | static inline void *i2c_get_clientdata (struct i2c_client *dev) | 226 | static inline void *i2c_get_clientdata(const struct i2c_client *dev) |
228 | { | 227 | { |
229 | return dev_get_drvdata (&dev->dev); | 228 | return dev_get_drvdata(&dev->dev); |
230 | } | 229 | } |
231 | 230 | ||
232 | static inline void i2c_set_clientdata (struct i2c_client *dev, void *data) | 231 | static inline void i2c_set_clientdata(struct i2c_client *dev, void *data) |
233 | { | 232 | { |
234 | dev_set_drvdata (&dev->dev, data); | 233 | dev_set_drvdata(&dev->dev, data); |
235 | } | 234 | } |
236 | 235 | ||
237 | /** | 236 | /** |
@@ -240,6 +239,7 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data) | |||
240 | * @flags: to initialize i2c_client.flags | 239 | * @flags: to initialize i2c_client.flags |
241 | * @addr: stored in i2c_client.addr | 240 | * @addr: stored in i2c_client.addr |
242 | * @platform_data: stored in i2c_client.dev.platform_data | 241 | * @platform_data: stored in i2c_client.dev.platform_data |
242 | * @archdata: copied into i2c_client.dev.archdata | ||
243 | * @irq: stored in i2c_client.irq | 243 | * @irq: stored in i2c_client.irq |
244 | * | 244 | * |
245 | * I2C doesn't actually support hardware probing, although controllers and | 245 | * I2C doesn't actually support hardware probing, although controllers and |
@@ -259,6 +259,7 @@ struct i2c_board_info { | |||
259 | unsigned short flags; | 259 | unsigned short flags; |
260 | unsigned short addr; | 260 | unsigned short addr; |
261 | void *platform_data; | 261 | void *platform_data; |
262 | struct dev_archdata *archdata; | ||
262 | int irq; | 263 | int irq; |
263 | }; | 264 | }; |
264 | 265 | ||
@@ -272,7 +273,7 @@ struct i2c_board_info { | |||
272 | * fields (such as associated irq, or device-specific platform_data) | 273 | * fields (such as associated irq, or device-specific platform_data) |
273 | * are provided using conventional syntax. | 274 | * are provided using conventional syntax. |
274 | */ | 275 | */ |
275 | #define I2C_BOARD_INFO(dev_type,dev_addr) \ | 276 | #define I2C_BOARD_INFO(dev_type, dev_addr) \ |
276 | .type = (dev_type), .addr = (dev_addr) | 277 | .type = (dev_type), .addr = (dev_addr) |
277 | 278 | ||
278 | 279 | ||
@@ -306,10 +307,12 @@ extern void i2c_unregister_device(struct i2c_client *); | |||
306 | */ | 307 | */ |
307 | #ifdef CONFIG_I2C_BOARDINFO | 308 | #ifdef CONFIG_I2C_BOARDINFO |
308 | extern int | 309 | extern int |
309 | i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned n); | 310 | i2c_register_board_info(int busnum, struct i2c_board_info const *info, |
311 | unsigned n); | ||
310 | #else | 312 | #else |
311 | static inline int | 313 | static inline int |
312 | i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned n) | 314 | i2c_register_board_info(int busnum, struct i2c_board_info const *info, |
315 | unsigned n) | ||
313 | { | 316 | { |
314 | return 0; | 317 | return 0; |
315 | } | 318 | } |
@@ -328,11 +331,11 @@ struct i2c_algorithm { | |||
328 | using common I2C messages */ | 331 | using common I2C messages */ |
329 | /* master_xfer should return the number of messages successfully | 332 | /* master_xfer should return the number of messages successfully |
330 | processed, or a negative value on error */ | 333 | processed, or a negative value on error */ |
331 | int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs, | 334 | int (*master_xfer)(struct i2c_adapter *adap, struct i2c_msg *msgs, |
332 | int num); | 335 | int num); |
333 | int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, | 336 | int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, |
334 | unsigned short flags, char read_write, | 337 | unsigned short flags, char read_write, |
335 | u8 command, int size, union i2c_smbus_data * data); | 338 | u8 command, int size, union i2c_smbus_data *data); |
336 | 339 | ||
337 | /* To determine what the adapter supports */ | 340 | /* To determine what the adapter supports */ |
338 | u32 (*functionality) (struct i2c_adapter *); | 341 | u32 (*functionality) (struct i2c_adapter *); |
@@ -345,7 +348,7 @@ struct i2c_algorithm { | |||
345 | struct i2c_adapter { | 348 | struct i2c_adapter { |
346 | struct module *owner; | 349 | struct module *owner; |
347 | unsigned int id; | 350 | unsigned int id; |
348 | unsigned int class; | 351 | unsigned int class; /* classes to allow probing for */ |
349 | const struct i2c_algorithm *algo; /* the algorithm to access the bus */ | 352 | const struct i2c_algorithm *algo; /* the algorithm to access the bus */ |
350 | void *algo_data; | 353 | void *algo_data; |
351 | 354 | ||
@@ -369,14 +372,14 @@ struct i2c_adapter { | |||
369 | }; | 372 | }; |
370 | #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) | 373 | #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) |
371 | 374 | ||
372 | static inline void *i2c_get_adapdata (struct i2c_adapter *dev) | 375 | static inline void *i2c_get_adapdata(const struct i2c_adapter *dev) |
373 | { | 376 | { |
374 | return dev_get_drvdata (&dev->dev); | 377 | return dev_get_drvdata(&dev->dev); |
375 | } | 378 | } |
376 | 379 | ||
377 | static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data) | 380 | static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data) |
378 | { | 381 | { |
379 | dev_set_drvdata (&dev->dev, data); | 382 | dev_set_drvdata(&dev->dev, data); |
380 | } | 383 | } |
381 | 384 | ||
382 | /*flags for the client struct: */ | 385 | /*flags for the client struct: */ |
@@ -449,7 +452,7 @@ extern int i2c_probe(struct i2c_adapter *adapter, | |||
449 | const struct i2c_client_address_data *address_data, | 452 | const struct i2c_client_address_data *address_data, |
450 | int (*found_proc) (struct i2c_adapter *, int, int)); | 453 | int (*found_proc) (struct i2c_adapter *, int, int)); |
451 | 454 | ||
452 | extern struct i2c_adapter* i2c_get_adapter(int id); | 455 | extern struct i2c_adapter *i2c_get_adapter(int id); |
453 | extern void i2c_put_adapter(struct i2c_adapter *adap); | 456 | extern void i2c_put_adapter(struct i2c_adapter *adap); |
454 | 457 | ||
455 | 458 | ||
@@ -465,7 +468,7 @@ static inline int i2c_check_functionality(struct i2c_adapter *adap, u32 func) | |||
465 | return (func & i2c_get_functionality(adap)) == func; | 468 | return (func & i2c_get_functionality(adap)) == func; |
466 | } | 469 | } |
467 | 470 | ||
468 | /* Return id number for a specific adapter */ | 471 | /* Return the adapter number for a specific adapter */ |
469 | static inline int i2c_adapter_id(struct i2c_adapter *adap) | 472 | static inline int i2c_adapter_id(struct i2c_adapter *adap) |
470 | { | 473 | { |
471 | return adap->nr; | 474 | return adap->nr; |
@@ -526,7 +529,7 @@ struct i2c_msg { | |||
526 | 529 | ||
527 | #define I2C_FUNC_I2C 0x00000001 | 530 | #define I2C_FUNC_I2C 0x00000001 |
528 | #define I2C_FUNC_10BIT_ADDR 0x00000002 | 531 | #define I2C_FUNC_10BIT_ADDR 0x00000002 |
529 | #define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */ | 532 | #define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_NOSTART etc. */ |
530 | #define I2C_FUNC_SMBUS_PEC 0x00000008 | 533 | #define I2C_FUNC_SMBUS_PEC 0x00000008 |
531 | #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ | 534 | #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ |
532 | #define I2C_FUNC_SMBUS_QUICK 0x00010000 | 535 | #define I2C_FUNC_SMBUS_QUICK 0x00010000 |
@@ -541,30 +544,26 @@ struct i2c_msg { | |||
541 | #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 | 544 | #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 |
542 | #define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ | 545 | #define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ |
543 | #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ | 546 | #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ |
544 | #define I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 0x10000000 /* I2C-like block xfer */ | 547 | |
545 | #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2 0x20000000 /* w/ 2-byte reg. addr. */ | 548 | #define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \ |
546 | 549 | I2C_FUNC_SMBUS_WRITE_BYTE) | |
547 | #define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \ | 550 | #define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \ |
548 | I2C_FUNC_SMBUS_WRITE_BYTE) | 551 | I2C_FUNC_SMBUS_WRITE_BYTE_DATA) |
549 | #define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \ | 552 | #define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \ |
550 | I2C_FUNC_SMBUS_WRITE_BYTE_DATA) | 553 | I2C_FUNC_SMBUS_WRITE_WORD_DATA) |
551 | #define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \ | 554 | #define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \ |
552 | I2C_FUNC_SMBUS_WRITE_WORD_DATA) | 555 | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA) |
553 | #define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \ | 556 | #define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \ |
554 | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA) | 557 | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK) |
555 | #define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \ | 558 | |
556 | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK) | 559 | #define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \ |
557 | #define I2C_FUNC_SMBUS_I2C_BLOCK_2 (I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 | \ | 560 | I2C_FUNC_SMBUS_BYTE | \ |
558 | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2) | 561 | I2C_FUNC_SMBUS_BYTE_DATA | \ |
559 | 562 | I2C_FUNC_SMBUS_WORD_DATA | \ | |
560 | #define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \ | 563 | I2C_FUNC_SMBUS_PROC_CALL | \ |
561 | I2C_FUNC_SMBUS_BYTE | \ | 564 | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \ |
562 | I2C_FUNC_SMBUS_BYTE_DATA | \ | 565 | I2C_FUNC_SMBUS_I2C_BLOCK | \ |
563 | I2C_FUNC_SMBUS_WORD_DATA | \ | 566 | I2C_FUNC_SMBUS_PEC) |
564 | I2C_FUNC_SMBUS_PROC_CALL | \ | ||
565 | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \ | ||
566 | I2C_FUNC_SMBUS_I2C_BLOCK | \ | ||
567 | I2C_FUNC_SMBUS_PEC) | ||
568 | 567 | ||
569 | /* | 568 | /* |
570 | * Data for SMBus Messages | 569 | * Data for SMBus Messages |
@@ -574,7 +573,7 @@ union i2c_smbus_data { | |||
574 | __u8 byte; | 573 | __u8 byte; |
575 | __u16 word; | 574 | __u16 word; |
576 | __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */ | 575 | __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */ |
577 | /* and one more for user-space compatibility */ | 576 | /* and one more for user-space compatibility */ |
578 | }; | 577 | }; |
579 | 578 | ||
580 | /* i2c_smbus_xfer read or write markers */ | 579 | /* i2c_smbus_xfer read or write markers */ |
@@ -602,21 +601,21 @@ union i2c_smbus_data { | |||
602 | 601 | ||
603 | /* Default fill of many variables */ | 602 | /* Default fill of many variables */ |
604 | #define I2C_CLIENT_DEFAULTS {I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 603 | #define I2C_CLIENT_DEFAULTS {I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
605 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 604 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
606 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 605 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
607 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 606 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
608 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 607 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
609 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 608 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
610 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 609 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
611 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 610 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
612 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 611 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
613 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 612 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
614 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 613 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
615 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 614 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
616 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 615 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
617 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 616 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
618 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ | 617 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ |
619 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END} | 618 | I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END} |
620 | 619 | ||
621 | /* I2C_CLIENT_MODULE_PARM creates a module parameter, and puts it in the | 620 | /* I2C_CLIENT_MODULE_PARM creates a module parameter, and puts it in the |
622 | module header */ | 621 | module header */ |
@@ -625,7 +624,7 @@ union i2c_smbus_data { | |||
625 | static unsigned short var[I2C_CLIENT_MAX_OPTS] = I2C_CLIENT_DEFAULTS; \ | 624 | static unsigned short var[I2C_CLIENT_MAX_OPTS] = I2C_CLIENT_DEFAULTS; \ |
626 | static unsigned int var##_num; \ | 625 | static unsigned int var##_num; \ |
627 | module_param_array(var, short, &var##_num, 0); \ | 626 | module_param_array(var, short, &var##_num, 0); \ |
628 | MODULE_PARM_DESC(var,desc) | 627 | MODULE_PARM_DESC(var, desc) |
629 | 628 | ||
630 | #define I2C_CLIENT_MODULE_PARM_FORCE(name) \ | 629 | #define I2C_CLIENT_MODULE_PARM_FORCE(name) \ |
631 | I2C_CLIENT_MODULE_PARM(force_##name, \ | 630 | I2C_CLIENT_MODULE_PARM(force_##name, \ |
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h new file mode 100644 index 000000000000..fb604dcd38f1 --- /dev/null +++ b/include/linux/i2c/twl4030.h | |||
@@ -0,0 +1,343 @@ | |||
1 | /* | ||
2 | * twl4030.h - header for TWL4030 PM and audio CODEC device | ||
3 | * | ||
4 | * Copyright (C) 2005-2006 Texas Instruments, Inc. | ||
5 | * | ||
6 | * Based on tlv320aic23.c: | ||
7 | * Copyright (c) by Kai Svahn <kai.svahn@nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | * | ||
23 | */ | ||
24 | |||
25 | #ifndef __TWL4030_H_ | ||
26 | #define __TWL4030_H_ | ||
27 | |||
28 | /* | ||
29 | * Using the twl4030 core we address registers using a pair | ||
30 | * { module id, relative register offset } | ||
31 | * which that core then maps to the relevant | ||
32 | * { i2c slave, absolute register address } | ||
33 | * | ||
34 | * The module IDs are meaningful only to the twl4030 core code, | ||
35 | * which uses them as array indices to look up the first register | ||
36 | * address each module uses within a given i2c slave. | ||
37 | */ | ||
38 | |||
39 | /* Slave 0 (i2c address 0x48) */ | ||
40 | #define TWL4030_MODULE_USB 0x00 | ||
41 | |||
42 | /* Slave 1 (i2c address 0x49) */ | ||
43 | #define TWL4030_MODULE_AUDIO_VOICE 0x01 | ||
44 | #define TWL4030_MODULE_GPIO 0x02 | ||
45 | #define TWL4030_MODULE_INTBR 0x03 | ||
46 | #define TWL4030_MODULE_PIH 0x04 | ||
47 | #define TWL4030_MODULE_TEST 0x05 | ||
48 | |||
49 | /* Slave 2 (i2c address 0x4a) */ | ||
50 | #define TWL4030_MODULE_KEYPAD 0x06 | ||
51 | #define TWL4030_MODULE_MADC 0x07 | ||
52 | #define TWL4030_MODULE_INTERRUPTS 0x08 | ||
53 | #define TWL4030_MODULE_LED 0x09 | ||
54 | #define TWL4030_MODULE_MAIN_CHARGE 0x0A | ||
55 | #define TWL4030_MODULE_PRECHARGE 0x0B | ||
56 | #define TWL4030_MODULE_PWM0 0x0C | ||
57 | #define TWL4030_MODULE_PWM1 0x0D | ||
58 | #define TWL4030_MODULE_PWMA 0x0E | ||
59 | #define TWL4030_MODULE_PWMB 0x0F | ||
60 | |||
61 | /* Slave 3 (i2c address 0x4b) */ | ||
62 | #define TWL4030_MODULE_BACKUP 0x10 | ||
63 | #define TWL4030_MODULE_INT 0x11 | ||
64 | #define TWL4030_MODULE_PM_MASTER 0x12 | ||
65 | #define TWL4030_MODULE_PM_RECEIVER 0x13 | ||
66 | #define TWL4030_MODULE_RTC 0x14 | ||
67 | #define TWL4030_MODULE_SECURED_REG 0x15 | ||
68 | |||
69 | /* | ||
70 | * Read and write single 8-bit registers | ||
71 | */ | ||
72 | int twl4030_i2c_write_u8(u8 mod_no, u8 val, u8 reg); | ||
73 | int twl4030_i2c_read_u8(u8 mod_no, u8 *val, u8 reg); | ||
74 | |||
75 | /* | ||
76 | * Read and write several 8-bit registers at once. | ||
77 | * | ||
78 | * IMPORTANT: For twl4030_i2c_write(), allocate num_bytes + 1 | ||
79 | * for the value, and populate your data starting at offset 1. | ||
80 | */ | ||
81 | int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, u8 num_bytes); | ||
82 | int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, u8 num_bytes); | ||
83 | |||
84 | /*----------------------------------------------------------------------*/ | ||
85 | |||
86 | /* | ||
87 | * NOTE: at up to 1024 registers, this is a big chip. | ||
88 | * | ||
89 | * Avoid putting register declarations in this file, instead of into | ||
90 | * a driver-private file, unless some of the registers in a block | ||
91 | * need to be shared with other drivers. One example is blocks that | ||
92 | * have Secondary IRQ Handler (SIH) registers. | ||
93 | */ | ||
94 | |||
95 | #define TWL4030_SIH_CTRL_EXCLEN_MASK BIT(0) | ||
96 | #define TWL4030_SIH_CTRL_PENDDIS_MASK BIT(1) | ||
97 | #define TWL4030_SIH_CTRL_COR_MASK BIT(2) | ||
98 | |||
99 | /*----------------------------------------------------------------------*/ | ||
100 | |||
101 | /* | ||
102 | * GPIO Block Register offsets (use TWL4030_MODULE_GPIO) | ||
103 | */ | ||
104 | |||
105 | #define REG_GPIODATAIN1 0x0 | ||
106 | #define REG_GPIODATAIN2 0x1 | ||
107 | #define REG_GPIODATAIN3 0x2 | ||
108 | #define REG_GPIODATADIR1 0x3 | ||
109 | #define REG_GPIODATADIR2 0x4 | ||
110 | #define REG_GPIODATADIR3 0x5 | ||
111 | #define REG_GPIODATAOUT1 0x6 | ||
112 | #define REG_GPIODATAOUT2 0x7 | ||
113 | #define REG_GPIODATAOUT3 0x8 | ||
114 | #define REG_CLEARGPIODATAOUT1 0x9 | ||
115 | #define REG_CLEARGPIODATAOUT2 0xA | ||
116 | #define REG_CLEARGPIODATAOUT3 0xB | ||
117 | #define REG_SETGPIODATAOUT1 0xC | ||
118 | #define REG_SETGPIODATAOUT2 0xD | ||
119 | #define REG_SETGPIODATAOUT3 0xE | ||
120 | #define REG_GPIO_DEBEN1 0xF | ||
121 | #define REG_GPIO_DEBEN2 0x10 | ||
122 | #define REG_GPIO_DEBEN3 0x11 | ||
123 | #define REG_GPIO_CTRL 0x12 | ||
124 | #define REG_GPIOPUPDCTR1 0x13 | ||
125 | #define REG_GPIOPUPDCTR2 0x14 | ||
126 | #define REG_GPIOPUPDCTR3 0x15 | ||
127 | #define REG_GPIOPUPDCTR4 0x16 | ||
128 | #define REG_GPIOPUPDCTR5 0x17 | ||
129 | #define REG_GPIO_ISR1A 0x19 | ||
130 | #define REG_GPIO_ISR2A 0x1A | ||
131 | #define REG_GPIO_ISR3A 0x1B | ||
132 | #define REG_GPIO_IMR1A 0x1C | ||
133 | #define REG_GPIO_IMR2A 0x1D | ||
134 | #define REG_GPIO_IMR3A 0x1E | ||
135 | #define REG_GPIO_ISR1B 0x1F | ||
136 | #define REG_GPIO_ISR2B 0x20 | ||
137 | #define REG_GPIO_ISR3B 0x21 | ||
138 | #define REG_GPIO_IMR1B 0x22 | ||
139 | #define REG_GPIO_IMR2B 0x23 | ||
140 | #define REG_GPIO_IMR3B 0x24 | ||
141 | #define REG_GPIO_EDR1 0x28 | ||
142 | #define REG_GPIO_EDR2 0x29 | ||
143 | #define REG_GPIO_EDR3 0x2A | ||
144 | #define REG_GPIO_EDR4 0x2B | ||
145 | #define REG_GPIO_EDR5 0x2C | ||
146 | #define REG_GPIO_SIH_CTRL 0x2D | ||
147 | |||
148 | /* Up to 18 signals are available as GPIOs, when their | ||
149 | * pins are not assigned to another use (such as ULPI/USB). | ||
150 | */ | ||
151 | #define TWL4030_GPIO_MAX 18 | ||
152 | |||
153 | /*----------------------------------------------------------------------*/ | ||
154 | |||
155 | /* | ||
156 | * Keypad register offsets (use TWL4030_MODULE_KEYPAD) | ||
157 | * ... SIH/interrupt only | ||
158 | */ | ||
159 | |||
160 | #define TWL4030_KEYPAD_KEYP_ISR1 0x11 | ||
161 | #define TWL4030_KEYPAD_KEYP_IMR1 0x12 | ||
162 | #define TWL4030_KEYPAD_KEYP_ISR2 0x13 | ||
163 | #define TWL4030_KEYPAD_KEYP_IMR2 0x14 | ||
164 | #define TWL4030_KEYPAD_KEYP_SIR 0x15 /* test register */ | ||
165 | #define TWL4030_KEYPAD_KEYP_EDR 0x16 | ||
166 | #define TWL4030_KEYPAD_KEYP_SIH_CTRL 0x17 | ||
167 | |||
168 | /*----------------------------------------------------------------------*/ | ||
169 | |||
170 | /* | ||
171 | * Multichannel ADC register offsets (use TWL4030_MODULE_MADC) | ||
172 | * ... SIH/interrupt only | ||
173 | */ | ||
174 | |||
175 | #define TWL4030_MADC_ISR1 0x61 | ||
176 | #define TWL4030_MADC_IMR1 0x62 | ||
177 | #define TWL4030_MADC_ISR2 0x63 | ||
178 | #define TWL4030_MADC_IMR2 0x64 | ||
179 | #define TWL4030_MADC_SIR 0x65 /* test register */ | ||
180 | #define TWL4030_MADC_EDR 0x66 | ||
181 | #define TWL4030_MADC_SIH_CTRL 0x67 | ||
182 | |||
183 | /*----------------------------------------------------------------------*/ | ||
184 | |||
185 | /* | ||
186 | * Battery charger register offsets (use TWL4030_MODULE_INTERRUPTS) | ||
187 | */ | ||
188 | |||
189 | #define TWL4030_INTERRUPTS_BCIISR1A 0x0 | ||
190 | #define TWL4030_INTERRUPTS_BCIISR2A 0x1 | ||
191 | #define TWL4030_INTERRUPTS_BCIIMR1A 0x2 | ||
192 | #define TWL4030_INTERRUPTS_BCIIMR2A 0x3 | ||
193 | #define TWL4030_INTERRUPTS_BCIISR1B 0x4 | ||
194 | #define TWL4030_INTERRUPTS_BCIISR2B 0x5 | ||
195 | #define TWL4030_INTERRUPTS_BCIIMR1B 0x6 | ||
196 | #define TWL4030_INTERRUPTS_BCIIMR2B 0x7 | ||
197 | #define TWL4030_INTERRUPTS_BCISIR1 0x8 /* test register */ | ||
198 | #define TWL4030_INTERRUPTS_BCISIR2 0x9 /* test register */ | ||
199 | #define TWL4030_INTERRUPTS_BCIEDR1 0xa | ||
200 | #define TWL4030_INTERRUPTS_BCIEDR2 0xb | ||
201 | #define TWL4030_INTERRUPTS_BCIEDR3 0xc | ||
202 | #define TWL4030_INTERRUPTS_BCISIHCTRL 0xd | ||
203 | |||
204 | /*----------------------------------------------------------------------*/ | ||
205 | |||
206 | /* | ||
207 | * Power Interrupt block register offsets (use TWL4030_MODULE_INT) | ||
208 | */ | ||
209 | |||
210 | #define TWL4030_INT_PWR_ISR1 0x0 | ||
211 | #define TWL4030_INT_PWR_IMR1 0x1 | ||
212 | #define TWL4030_INT_PWR_ISR2 0x2 | ||
213 | #define TWL4030_INT_PWR_IMR2 0x3 | ||
214 | #define TWL4030_INT_PWR_SIR 0x4 /* test register */ | ||
215 | #define TWL4030_INT_PWR_EDR1 0x5 | ||
216 | #define TWL4030_INT_PWR_EDR2 0x6 | ||
217 | #define TWL4030_INT_PWR_SIH_CTRL 0x7 | ||
218 | |||
219 | /*----------------------------------------------------------------------*/ | ||
220 | |||
221 | struct twl4030_bci_platform_data { | ||
222 | int *battery_tmp_tbl; | ||
223 | unsigned int tblsize; | ||
224 | }; | ||
225 | |||
226 | /* TWL4030_GPIO_MAX (18) GPIOs, with interrupts */ | ||
227 | struct twl4030_gpio_platform_data { | ||
228 | int gpio_base; | ||
229 | unsigned irq_base, irq_end; | ||
230 | |||
231 | /* package the two LED signals as output-only GPIOs? */ | ||
232 | bool use_leds; | ||
233 | |||
234 | /* gpio-n should control VMMC(n+1) if BIT(n) in mmc_cd is set */ | ||
235 | u8 mmc_cd; | ||
236 | |||
237 | /* For gpio-N, bit (1 << N) in "pullups" is set if that pullup | ||
238 | * should be enabled. Else, if that bit is set in "pulldowns", | ||
239 | * that pulldown is enabled. Don't waste power by letting any | ||
240 | * digital inputs float... | ||
241 | */ | ||
242 | u32 pullups; | ||
243 | u32 pulldowns; | ||
244 | |||
245 | int (*setup)(struct device *dev, | ||
246 | unsigned gpio, unsigned ngpio); | ||
247 | int (*teardown)(struct device *dev, | ||
248 | unsigned gpio, unsigned ngpio); | ||
249 | }; | ||
250 | |||
251 | struct twl4030_madc_platform_data { | ||
252 | int irq_line; | ||
253 | }; | ||
254 | |||
255 | struct twl4030_keypad_data { | ||
256 | int rows; | ||
257 | int cols; | ||
258 | int *keymap; | ||
259 | int irq; | ||
260 | unsigned int keymapsize; | ||
261 | unsigned int rep:1; | ||
262 | }; | ||
263 | |||
264 | enum twl4030_usb_mode { | ||
265 | T2_USB_MODE_ULPI = 1, | ||
266 | T2_USB_MODE_CEA2011_3PIN = 2, | ||
267 | }; | ||
268 | |||
269 | struct twl4030_usb_data { | ||
270 | enum twl4030_usb_mode usb_mode; | ||
271 | }; | ||
272 | |||
273 | struct twl4030_platform_data { | ||
274 | unsigned irq_base, irq_end; | ||
275 | struct twl4030_bci_platform_data *bci; | ||
276 | struct twl4030_gpio_platform_data *gpio; | ||
277 | struct twl4030_madc_platform_data *madc; | ||
278 | struct twl4030_keypad_data *keypad; | ||
279 | struct twl4030_usb_data *usb; | ||
280 | |||
281 | /* REVISIT more to come ... _nothing_ should be hard-wired */ | ||
282 | }; | ||
283 | |||
284 | /*----------------------------------------------------------------------*/ | ||
285 | |||
286 | int twl4030_sih_setup(int module); | ||
287 | |||
288 | /* | ||
289 | * FIXME completely stop using TWL4030_IRQ_BASE ... instead, pass the | ||
290 | * IRQ data to subsidiary devices using platform device resources. | ||
291 | */ | ||
292 | |||
293 | /* IRQ information-need base */ | ||
294 | #include <mach/irqs.h> | ||
295 | /* TWL4030 interrupts */ | ||
296 | |||
297 | /* #define TWL4030_MODIRQ_GPIO (TWL4030_IRQ_BASE + 0) */ | ||
298 | #define TWL4030_MODIRQ_KEYPAD (TWL4030_IRQ_BASE + 1) | ||
299 | #define TWL4030_MODIRQ_BCI (TWL4030_IRQ_BASE + 2) | ||
300 | #define TWL4030_MODIRQ_MADC (TWL4030_IRQ_BASE + 3) | ||
301 | /* #define TWL4030_MODIRQ_USB (TWL4030_IRQ_BASE + 4) */ | ||
302 | /* #define TWL4030_MODIRQ_PWR (TWL4030_IRQ_BASE + 5) */ | ||
303 | |||
304 | #define TWL4030_PWRIRQ_PWRBTN (TWL4030_PWR_IRQ_BASE + 0) | ||
305 | /* #define TWL4030_PWRIRQ_CHG_PRES (TWL4030_PWR_IRQ_BASE + 1) */ | ||
306 | /* #define TWL4030_PWRIRQ_USB_PRES (TWL4030_PWR_IRQ_BASE + 2) */ | ||
307 | /* #define TWL4030_PWRIRQ_RTC (TWL4030_PWR_IRQ_BASE + 3) */ | ||
308 | /* #define TWL4030_PWRIRQ_HOT_DIE (TWL4030_PWR_IRQ_BASE + 4) */ | ||
309 | /* #define TWL4030_PWRIRQ_PWROK_TIMEOUT (TWL4030_PWR_IRQ_BASE + 5) */ | ||
310 | /* #define TWL4030_PWRIRQ_MBCHG (TWL4030_PWR_IRQ_BASE + 6) */ | ||
311 | /* #define TWL4030_PWRIRQ_SC_DETECT (TWL4030_PWR_IRQ_BASE + 7) */ | ||
312 | |||
313 | /* Rest are unsued currently*/ | ||
314 | |||
315 | /* Offsets to Power Registers */ | ||
316 | #define TWL4030_VDAC_DEV_GRP 0x3B | ||
317 | #define TWL4030_VDAC_DEDICATED 0x3E | ||
318 | #define TWL4030_VAUX1_DEV_GRP 0x17 | ||
319 | #define TWL4030_VAUX1_DEDICATED 0x1A | ||
320 | #define TWL4030_VAUX2_DEV_GRP 0x1B | ||
321 | #define TWL4030_VAUX2_DEDICATED 0x1E | ||
322 | #define TWL4030_VAUX3_DEV_GRP 0x1F | ||
323 | #define TWL4030_VAUX3_DEDICATED 0x22 | ||
324 | |||
325 | /* TWL4030 GPIO interrupt definitions */ | ||
326 | |||
327 | #define TWL4030_GPIO_IRQ_NO(n) (TWL4030_GPIO_IRQ_BASE + (n)) | ||
328 | |||
329 | /* | ||
330 | * Exported TWL4030 GPIO APIs | ||
331 | * | ||
332 | * WARNING -- use standard GPIO and IRQ calls instead; these will vanish. | ||
333 | */ | ||
334 | int twl4030_set_gpio_debounce(int gpio, int enable); | ||
335 | |||
336 | #if defined(CONFIG_TWL4030_BCI_BATTERY) || \ | ||
337 | defined(CONFIG_TWL4030_BCI_BATTERY_MODULE) | ||
338 | extern int twl4030charger_usb_en(int enable); | ||
339 | #else | ||
340 | static inline int twl4030charger_usb_en(int enable) { return 0; } | ||
341 | #endif | ||
342 | |||
343 | #endif /* End of __TWL4030_H */ | ||
diff --git a/include/linux/i2o.h b/include/linux/i2o.h index 75ae6d8aba4f..4c4e57d1f19d 100644 --- a/include/linux/i2o.h +++ b/include/linux/i2o.h | |||
@@ -570,7 +570,6 @@ struct i2o_controller { | |||
570 | #endif | 570 | #endif |
571 | spinlock_t lock; /* lock for controller | 571 | spinlock_t lock; /* lock for controller |
572 | configuration */ | 572 | configuration */ |
573 | |||
574 | void *driver_data[I2O_MAX_DRIVERS]; /* storage for drivers */ | 573 | void *driver_data[I2O_MAX_DRIVERS]; /* storage for drivers */ |
575 | }; | 574 | }; |
576 | 575 | ||
@@ -691,289 +690,22 @@ static inline u32 i2o_dma_high(dma_addr_t dma_addr) | |||
691 | }; | 690 | }; |
692 | #endif | 691 | #endif |
693 | 692 | ||
694 | /** | 693 | extern u16 i2o_sg_tablesize(struct i2o_controller *c, u16 body_size); |
695 | * i2o_sg_tablesize - Calculate the maximum number of elements in a SGL | 694 | extern dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr, |
696 | * @c: I2O controller for which the calculation should be done | ||
697 | * @body_size: maximum body size used for message in 32-bit words. | ||
698 | * | ||
699 | * Return the maximum number of SG elements in a SG list. | ||
700 | */ | ||
701 | static inline u16 i2o_sg_tablesize(struct i2o_controller *c, u16 body_size) | ||
702 | { | ||
703 | i2o_status_block *sb = c->status_block.virt; | ||
704 | u16 sg_count = | ||
705 | (sb->inbound_frame_size - sizeof(struct i2o_message) / 4) - | ||
706 | body_size; | ||
707 | |||
708 | if (c->pae_support) { | ||
709 | /* | ||
710 | * for 64-bit a SG attribute element must be added and each | ||
711 | * SG element needs 12 bytes instead of 8. | ||
712 | */ | ||
713 | sg_count -= 2; | ||
714 | sg_count /= 3; | ||
715 | } else | ||
716 | sg_count /= 2; | ||
717 | |||
718 | if (c->short_req && (sg_count > 8)) | ||
719 | sg_count = 8; | ||
720 | |||
721 | return sg_count; | ||
722 | }; | ||
723 | |||
724 | /** | ||
725 | * i2o_dma_map_single - Map pointer to controller and fill in I2O message. | ||
726 | * @c: I2O controller | ||
727 | * @ptr: pointer to the data which should be mapped | ||
728 | * @size: size of data in bytes | ||
729 | * @direction: DMA_TO_DEVICE / DMA_FROM_DEVICE | ||
730 | * @sg_ptr: pointer to the SG list inside the I2O message | ||
731 | * | ||
732 | * This function does all necessary DMA handling and also writes the I2O | ||
733 | * SGL elements into the I2O message. For details on DMA handling see also | ||
734 | * dma_map_single(). The pointer sg_ptr will only be set to the end of the | ||
735 | * SG list if the allocation was successful. | ||
736 | * | ||
737 | * Returns DMA address which must be checked for failures using | ||
738 | * dma_mapping_error(). | ||
739 | */ | ||
740 | static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr, | ||
741 | size_t size, | 695 | size_t size, |
742 | enum dma_data_direction direction, | 696 | enum dma_data_direction direction, |
743 | u32 ** sg_ptr) | 697 | u32 ** sg_ptr); |
744 | { | 698 | extern int i2o_dma_map_sg(struct i2o_controller *c, |
745 | u32 sg_flags; | ||
746 | u32 *mptr = *sg_ptr; | ||
747 | dma_addr_t dma_addr; | ||
748 | |||
749 | switch (direction) { | ||
750 | case DMA_TO_DEVICE: | ||
751 | sg_flags = 0xd4000000; | ||
752 | break; | ||
753 | case DMA_FROM_DEVICE: | ||
754 | sg_flags = 0xd0000000; | ||
755 | break; | ||
756 | default: | ||
757 | return 0; | ||
758 | } | ||
759 | |||
760 | dma_addr = dma_map_single(&c->pdev->dev, ptr, size, direction); | ||
761 | if (!dma_mapping_error(&c->pdev->dev, dma_addr)) { | ||
762 | #ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 | ||
763 | if ((sizeof(dma_addr_t) > 4) && c->pae_support) { | ||
764 | *mptr++ = cpu_to_le32(0x7C020002); | ||
765 | *mptr++ = cpu_to_le32(PAGE_SIZE); | ||
766 | } | ||
767 | #endif | ||
768 | |||
769 | *mptr++ = cpu_to_le32(sg_flags | size); | ||
770 | *mptr++ = cpu_to_le32(i2o_dma_low(dma_addr)); | ||
771 | #ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 | ||
772 | if ((sizeof(dma_addr_t) > 4) && c->pae_support) | ||
773 | *mptr++ = cpu_to_le32(i2o_dma_high(dma_addr)); | ||
774 | #endif | ||
775 | *sg_ptr = mptr; | ||
776 | } | ||
777 | return dma_addr; | ||
778 | }; | ||
779 | |||
780 | /** | ||
781 | * i2o_dma_map_sg - Map a SG List to controller and fill in I2O message. | ||
782 | * @c: I2O controller | ||
783 | * @sg: SG list to be mapped | ||
784 | * @sg_count: number of elements in the SG list | ||
785 | * @direction: DMA_TO_DEVICE / DMA_FROM_DEVICE | ||
786 | * @sg_ptr: pointer to the SG list inside the I2O message | ||
787 | * | ||
788 | * This function does all necessary DMA handling and also writes the I2O | ||
789 | * SGL elements into the I2O message. For details on DMA handling see also | ||
790 | * dma_map_sg(). The pointer sg_ptr will only be set to the end of the SG | ||
791 | * list if the allocation was successful. | ||
792 | * | ||
793 | * Returns 0 on failure or 1 on success. | ||
794 | */ | ||
795 | static inline int i2o_dma_map_sg(struct i2o_controller *c, | ||
796 | struct scatterlist *sg, int sg_count, | 699 | struct scatterlist *sg, int sg_count, |
797 | enum dma_data_direction direction, | 700 | enum dma_data_direction direction, |
798 | u32 ** sg_ptr) | 701 | u32 ** sg_ptr); |
799 | { | 702 | extern int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr, size_t len); |
800 | u32 sg_flags; | 703 | extern void i2o_dma_free(struct device *dev, struct i2o_dma *addr); |
801 | u32 *mptr = *sg_ptr; | 704 | extern int i2o_dma_realloc(struct device *dev, struct i2o_dma *addr, |
802 | 705 | size_t len); | |
803 | switch (direction) { | 706 | extern int i2o_pool_alloc(struct i2o_pool *pool, const char *name, |
804 | case DMA_TO_DEVICE: | 707 | size_t size, int min_nr); |
805 | sg_flags = 0x14000000; | 708 | extern void i2o_pool_free(struct i2o_pool *pool); |
806 | break; | ||
807 | case DMA_FROM_DEVICE: | ||
808 | sg_flags = 0x10000000; | ||
809 | break; | ||
810 | default: | ||
811 | return 0; | ||
812 | } | ||
813 | |||
814 | sg_count = dma_map_sg(&c->pdev->dev, sg, sg_count, direction); | ||
815 | if (!sg_count) | ||
816 | return 0; | ||
817 | |||
818 | #ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 | ||
819 | if ((sizeof(dma_addr_t) > 4) && c->pae_support) { | ||
820 | *mptr++ = cpu_to_le32(0x7C020002); | ||
821 | *mptr++ = cpu_to_le32(PAGE_SIZE); | ||
822 | } | ||
823 | #endif | ||
824 | |||
825 | while (sg_count-- > 0) { | ||
826 | if (!sg_count) | ||
827 | sg_flags |= 0xC0000000; | ||
828 | *mptr++ = cpu_to_le32(sg_flags | sg_dma_len(sg)); | ||
829 | *mptr++ = cpu_to_le32(i2o_dma_low(sg_dma_address(sg))); | ||
830 | #ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 | ||
831 | if ((sizeof(dma_addr_t) > 4) && c->pae_support) | ||
832 | *mptr++ = cpu_to_le32(i2o_dma_high(sg_dma_address(sg))); | ||
833 | #endif | ||
834 | sg = sg_next(sg); | ||
835 | } | ||
836 | *sg_ptr = mptr; | ||
837 | |||
838 | return 1; | ||
839 | }; | ||
840 | |||
841 | /** | ||
842 | * i2o_dma_alloc - Allocate DMA memory | ||
843 | * @dev: struct device pointer to the PCI device of the I2O controller | ||
844 | * @addr: i2o_dma struct which should get the DMA buffer | ||
845 | * @len: length of the new DMA memory | ||
846 | * @gfp_mask: GFP mask | ||
847 | * | ||
848 | * Allocate a coherent DMA memory and write the pointers into addr. | ||
849 | * | ||
850 | * Returns 0 on success or -ENOMEM on failure. | ||
851 | */ | ||
852 | static inline int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr, | ||
853 | size_t len, gfp_t gfp_mask) | ||
854 | { | ||
855 | struct pci_dev *pdev = to_pci_dev(dev); | ||
856 | int dma_64 = 0; | ||
857 | |||
858 | if ((sizeof(dma_addr_t) > 4) && (pdev->dma_mask == DMA_64BIT_MASK)) { | ||
859 | dma_64 = 1; | ||
860 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) | ||
861 | return -ENOMEM; | ||
862 | } | ||
863 | |||
864 | addr->virt = dma_alloc_coherent(dev, len, &addr->phys, gfp_mask); | ||
865 | |||
866 | if ((sizeof(dma_addr_t) > 4) && dma_64) | ||
867 | if (pci_set_dma_mask(pdev, DMA_64BIT_MASK)) | ||
868 | printk(KERN_WARNING "i2o: unable to set 64-bit DMA"); | ||
869 | |||
870 | if (!addr->virt) | ||
871 | return -ENOMEM; | ||
872 | |||
873 | memset(addr->virt, 0, len); | ||
874 | addr->len = len; | ||
875 | |||
876 | return 0; | ||
877 | }; | ||
878 | |||
879 | /** | ||
880 | * i2o_dma_free - Free DMA memory | ||
881 | * @dev: struct device pointer to the PCI device of the I2O controller | ||
882 | * @addr: i2o_dma struct which contains the DMA buffer | ||
883 | * | ||
884 | * Free a coherent DMA memory and set virtual address of addr to NULL. | ||
885 | */ | ||
886 | static inline void i2o_dma_free(struct device *dev, struct i2o_dma *addr) | ||
887 | { | ||
888 | if (addr->virt) { | ||
889 | if (addr->phys) | ||
890 | dma_free_coherent(dev, addr->len, addr->virt, | ||
891 | addr->phys); | ||
892 | else | ||
893 | kfree(addr->virt); | ||
894 | addr->virt = NULL; | ||
895 | } | ||
896 | }; | ||
897 | |||
898 | /** | ||
899 | * i2o_dma_realloc - Realloc DMA memory | ||
900 | * @dev: struct device pointer to the PCI device of the I2O controller | ||
901 | * @addr: pointer to a i2o_dma struct DMA buffer | ||
902 | * @len: new length of memory | ||
903 | * @gfp_mask: GFP mask | ||
904 | * | ||
905 | * If there was something allocated in the addr, free it first. If len > 0 | ||
906 | * than try to allocate it and write the addresses back to the addr | ||
907 | * structure. If len == 0 set the virtual address to NULL. | ||
908 | * | ||
909 | * Returns the 0 on success or negative error code on failure. | ||
910 | */ | ||
911 | static inline int i2o_dma_realloc(struct device *dev, struct i2o_dma *addr, | ||
912 | size_t len, gfp_t gfp_mask) | ||
913 | { | ||
914 | i2o_dma_free(dev, addr); | ||
915 | |||
916 | if (len) | ||
917 | return i2o_dma_alloc(dev, addr, len, gfp_mask); | ||
918 | |||
919 | return 0; | ||
920 | }; | ||
921 | |||
922 | /* | ||
923 | * i2o_pool_alloc - Allocate an slab cache and mempool | ||
924 | * @mempool: pointer to struct i2o_pool to write data into. | ||
925 | * @name: name which is used to identify cache | ||
926 | * @size: size of each object | ||
927 | * @min_nr: minimum number of objects | ||
928 | * | ||
929 | * First allocates a slab cache with name and size. Then allocates a | ||
930 | * mempool which uses the slab cache for allocation and freeing. | ||
931 | * | ||
932 | * Returns 0 on success or negative error code on failure. | ||
933 | */ | ||
934 | static inline int i2o_pool_alloc(struct i2o_pool *pool, const char *name, | ||
935 | size_t size, int min_nr) | ||
936 | { | ||
937 | pool->name = kmalloc(strlen(name) + 1, GFP_KERNEL); | ||
938 | if (!pool->name) | ||
939 | goto exit; | ||
940 | strcpy(pool->name, name); | ||
941 | |||
942 | pool->slab = | ||
943 | kmem_cache_create(pool->name, size, 0, SLAB_HWCACHE_ALIGN, NULL); | ||
944 | if (!pool->slab) | ||
945 | goto free_name; | ||
946 | |||
947 | pool->mempool = mempool_create_slab_pool(min_nr, pool->slab); | ||
948 | if (!pool->mempool) | ||
949 | goto free_slab; | ||
950 | |||
951 | return 0; | ||
952 | |||
953 | free_slab: | ||
954 | kmem_cache_destroy(pool->slab); | ||
955 | |||
956 | free_name: | ||
957 | kfree(pool->name); | ||
958 | |||
959 | exit: | ||
960 | return -ENOMEM; | ||
961 | }; | ||
962 | |||
963 | /* | ||
964 | * i2o_pool_free - Free slab cache and mempool again | ||
965 | * @mempool: pointer to struct i2o_pool which should be freed | ||
966 | * | ||
967 | * Note that you have to return all objects to the mempool again before | ||
968 | * calling i2o_pool_free(). | ||
969 | */ | ||
970 | static inline void i2o_pool_free(struct i2o_pool *pool) | ||
971 | { | ||
972 | mempool_destroy(pool->mempool); | ||
973 | kmem_cache_destroy(pool->slab); | ||
974 | kfree(pool->name); | ||
975 | }; | ||
976 | |||
977 | /* I2O driver (OSM) functions */ | 709 | /* I2O driver (OSM) functions */ |
978 | extern int i2o_driver_register(struct i2o_driver *); | 710 | extern int i2o_driver_register(struct i2o_driver *); |
979 | extern void i2o_driver_unregister(struct i2o_driver *); | 711 | extern void i2o_driver_unregister(struct i2o_driver *); |
diff --git a/include/linux/i7300_idle.h b/include/linux/i7300_idle.h new file mode 100644 index 000000000000..05a80c44513c --- /dev/null +++ b/include/linux/i7300_idle.h | |||
@@ -0,0 +1,83 @@ | |||
1 | |||
2 | #ifndef I7300_IDLE_H | ||
3 | #define I7300_IDLE_H | ||
4 | |||
5 | #include <linux/pci.h> | ||
6 | |||
7 | /* | ||
8 | * I/O AT controls (PCI bus 0 device 8 function 0) | ||
9 | * DIMM controls (PCI bus 0 device 16 function 1) | ||
10 | */ | ||
11 | #define IOAT_BUS 0 | ||
12 | #define IOAT_DEVFN PCI_DEVFN(8, 0) | ||
13 | #define MEMCTL_BUS 0 | ||
14 | #define MEMCTL_DEVFN PCI_DEVFN(16, 1) | ||
15 | |||
16 | struct fbd_ioat { | ||
17 | unsigned int vendor; | ||
18 | unsigned int ioat_dev; | ||
19 | }; | ||
20 | |||
21 | /* | ||
22 | * The i5000 chip-set has the same hooks as the i7300 | ||
23 | * but support is disabled by default because this driver | ||
24 | * has not been validated on that platform. | ||
25 | */ | ||
26 | #define SUPPORT_I5000 0 | ||
27 | |||
28 | static const struct fbd_ioat fbd_ioat_list[] = { | ||
29 | {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB}, | ||
30 | #if SUPPORT_I5000 | ||
31 | {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT}, | ||
32 | #endif | ||
33 | {0, 0} | ||
34 | }; | ||
35 | |||
36 | /* table of devices that work with this driver */ | ||
37 | static const struct pci_device_id pci_tbl[] = { | ||
38 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_FBD_CNB) }, | ||
39 | #if SUPPORT_I5000 | ||
40 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) }, | ||
41 | #endif | ||
42 | { } /* Terminating entry */ | ||
43 | }; | ||
44 | |||
45 | /* Check for known platforms with I/O-AT */ | ||
46 | static inline int i7300_idle_platform_probe(struct pci_dev **fbd_dev, | ||
47 | struct pci_dev **ioat_dev) | ||
48 | { | ||
49 | int i; | ||
50 | struct pci_dev *memdev, *dmadev; | ||
51 | |||
52 | memdev = pci_get_bus_and_slot(MEMCTL_BUS, MEMCTL_DEVFN); | ||
53 | if (!memdev) | ||
54 | return -ENODEV; | ||
55 | |||
56 | for (i = 0; pci_tbl[i].vendor != 0; i++) { | ||
57 | if (memdev->vendor == pci_tbl[i].vendor && | ||
58 | memdev->device == pci_tbl[i].device) { | ||
59 | break; | ||
60 | } | ||
61 | } | ||
62 | if (pci_tbl[i].vendor == 0) | ||
63 | return -ENODEV; | ||
64 | |||
65 | dmadev = pci_get_bus_and_slot(IOAT_BUS, IOAT_DEVFN); | ||
66 | if (!dmadev) | ||
67 | return -ENODEV; | ||
68 | |||
69 | for (i = 0; fbd_ioat_list[i].vendor != 0; i++) { | ||
70 | if (dmadev->vendor == fbd_ioat_list[i].vendor && | ||
71 | dmadev->device == fbd_ioat_list[i].ioat_dev) { | ||
72 | if (fbd_dev) | ||
73 | *fbd_dev = memdev; | ||
74 | if (ioat_dev) | ||
75 | *ioat_dev = dmadev; | ||
76 | |||
77 | return 0; | ||
78 | } | ||
79 | } | ||
80 | return -ENODEV; | ||
81 | } | ||
82 | |||
83 | #endif | ||
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h index 03067443198a..a93a8dd33118 100644 --- a/include/linux/icmpv6.h +++ b/include/linux/icmpv6.h | |||
@@ -40,16 +40,18 @@ struct icmp6hdr { | |||
40 | struct icmpv6_nd_ra { | 40 | struct icmpv6_nd_ra { |
41 | __u8 hop_limit; | 41 | __u8 hop_limit; |
42 | #if defined(__LITTLE_ENDIAN_BITFIELD) | 42 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
43 | __u8 reserved:4, | 43 | __u8 reserved:3, |
44 | router_pref:2, | 44 | router_pref:2, |
45 | home_agent:1, | ||
45 | other:1, | 46 | other:1, |
46 | managed:1; | 47 | managed:1; |
47 | 48 | ||
48 | #elif defined(__BIG_ENDIAN_BITFIELD) | 49 | #elif defined(__BIG_ENDIAN_BITFIELD) |
49 | __u8 managed:1, | 50 | __u8 managed:1, |
50 | other:1, | 51 | other:1, |
52 | home_agent:1, | ||
51 | router_pref:2, | 53 | router_pref:2, |
52 | reserved:4; | 54 | reserved:3; |
53 | #else | 55 | #else |
54 | #error "Please fix <asm/byteorder.h>" | 56 | #error "Please fix <asm/byteorder.h>" |
55 | #endif | 57 | #endif |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 1524829f73f2..54525be4b5f8 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -8,7 +8,7 @@ | |||
8 | 8 | ||
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/ioport.h> | 10 | #include <linux/ioport.h> |
11 | #include <linux/hdreg.h> | 11 | #include <linux/ata.h> |
12 | #include <linux/blkdev.h> | 12 | #include <linux/blkdev.h> |
13 | #include <linux/proc_fs.h> | 13 | #include <linux/proc_fs.h> |
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
18 | #include <linux/pci.h> | 18 | #include <linux/pci.h> |
19 | #include <linux/completion.h> | 19 | #include <linux/completion.h> |
20 | #include <linux/pm.h> | ||
20 | #ifdef CONFIG_BLK_DEV_IDEACPI | 21 | #ifdef CONFIG_BLK_DEV_IDEACPI |
21 | #include <acpi/acpi.h> | 22 | #include <acpi/acpi.h> |
22 | #endif | 23 | #endif |
@@ -47,12 +48,6 @@ typedef unsigned char byte; /* used everywhere */ | |||
47 | #define ERROR_RESET 3 /* Reset controller every 4th retry */ | 48 | #define ERROR_RESET 3 /* Reset controller every 4th retry */ |
48 | #define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ | 49 | #define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ |
49 | 50 | ||
50 | /* | ||
51 | * state flags | ||
52 | */ | ||
53 | |||
54 | #define DMA_PIO_RETRY 1 /* retrying in PIO */ | ||
55 | |||
56 | #define HWIF(drive) ((ide_hwif_t *)((drive)->hwif)) | 51 | #define HWIF(drive) ((ide_hwif_t *)((drive)->hwif)) |
57 | #define HWGROUP(drive) ((ide_hwgroup_t *)(HWIF(drive)->hwgroup)) | 52 | #define HWGROUP(drive) ((ide_hwgroup_t *)(HWIF(drive)->hwgroup)) |
58 | 53 | ||
@@ -87,12 +82,13 @@ struct ide_io_ports { | |||
87 | }; | 82 | }; |
88 | 83 | ||
89 | #define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) | 84 | #define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) |
90 | #define BAD_R_STAT (BUSY_STAT | ERR_STAT) | ||
91 | #define BAD_W_STAT (BAD_R_STAT | WRERR_STAT) | ||
92 | #define BAD_STAT (BAD_R_STAT | DRQ_STAT) | ||
93 | #define DRIVE_READY (READY_STAT | SEEK_STAT) | ||
94 | 85 | ||
95 | #define BAD_CRC (ABRT_ERR | ICRC_ERR) | 86 | #define BAD_R_STAT (ATA_BUSY | ATA_ERR) |
87 | #define BAD_W_STAT (BAD_R_STAT | ATA_DF) | ||
88 | #define BAD_STAT (BAD_R_STAT | ATA_DRQ) | ||
89 | #define DRIVE_READY (ATA_DRDY | ATA_DSC) | ||
90 | |||
91 | #define BAD_CRC (ATA_ABORTED | ATA_ICRC) | ||
96 | 92 | ||
97 | #define SATA_NR_PORTS (3) /* 16 possible ?? */ | 93 | #define SATA_NR_PORTS (3) /* 16 possible ?? */ |
98 | 94 | ||
@@ -125,24 +121,43 @@ struct ide_io_ports { | |||
125 | #define PARTN_BITS 6 /* number of minor dev bits for partitions */ | 121 | #define PARTN_BITS 6 /* number of minor dev bits for partitions */ |
126 | #define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */ | 122 | #define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */ |
127 | #define SECTOR_SIZE 512 | 123 | #define SECTOR_SIZE 512 |
128 | #define SECTOR_WORDS (SECTOR_SIZE / 4) /* number of 32bit words per sector */ | 124 | |
129 | #define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t))) | 125 | #define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t))) |
130 | 126 | ||
131 | /* | 127 | /* |
132 | * Timeouts for various operations: | 128 | * Timeouts for various operations: |
133 | */ | 129 | */ |
134 | #define WAIT_DRQ (HZ/10) /* 100msec - spec allows up to 20ms */ | 130 | enum { |
135 | #define WAIT_READY (5*HZ) /* 5sec - some laptops are very slow */ | 131 | /* spec allows up to 20ms */ |
136 | #define WAIT_PIDENTIFY (10*HZ) /* 10sec - should be less than 3ms (?), if all ATAPI CD is closed at boot */ | 132 | WAIT_DRQ = HZ / 10, /* 100ms */ |
137 | #define WAIT_WORSTCASE (30*HZ) /* 30sec - worst case when spinning up */ | 133 | /* some laptops are very slow */ |
138 | #define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */ | 134 | WAIT_READY = 5 * HZ, /* 5s */ |
139 | #define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */ | 135 | /* should be less than 3ms (?), if all ATAPI CD is closed at boot */ |
136 | WAIT_PIDENTIFY = 10 * HZ, /* 10s */ | ||
137 | /* worst case when spinning up */ | ||
138 | WAIT_WORSTCASE = 30 * HZ, /* 30s */ | ||
139 | /* maximum wait for an IRQ to happen */ | ||
140 | WAIT_CMD = 10 * HZ, /* 10s */ | ||
141 | /* Some drives require a longer IRQ timeout. */ | ||
142 | WAIT_FLOPPY_CMD = 50 * HZ, /* 50s */ | ||
143 | /* | ||
144 | * Some drives (for example, Seagate STT3401A Travan) require a very | ||
145 | * long timeout, because they don't return an interrupt or clear their | ||
146 | * BSY bit until after the command completes (even retension commands). | ||
147 | */ | ||
148 | WAIT_TAPE_CMD = 900 * HZ, /* 900s */ | ||
149 | /* minimum sleep time */ | ||
150 | WAIT_MIN_SLEEP = HZ / 50, /* 20ms */ | ||
151 | }; | ||
140 | 152 | ||
141 | /* | 153 | /* |
142 | * Op codes for special requests to be handled by ide_special_rq(). | 154 | * Op codes for special requests to be handled by ide_special_rq(). |
143 | * Values should be in the range of 0x20 to 0x3f. | 155 | * Values should be in the range of 0x20 to 0x3f. |
144 | */ | 156 | */ |
145 | #define REQ_DRIVE_RESET 0x20 | 157 | #define REQ_DRIVE_RESET 0x20 |
158 | #define REQ_DEVSET_EXEC 0x21 | ||
159 | #define REQ_PARK_HEADS 0x22 | ||
160 | #define REQ_UNPARK_HEADS 0x23 | ||
146 | 161 | ||
147 | /* | 162 | /* |
148 | * Check for an interrupt and acknowledge the interrupt status | 163 | * Check for an interrupt and acknowledge the interrupt status |
@@ -249,8 +264,6 @@ static inline int __ide_default_irq(unsigned long base) | |||
249 | * set_geometry : respecify drive geometry | 264 | * set_geometry : respecify drive geometry |
250 | * recalibrate : seek to cyl 0 | 265 | * recalibrate : seek to cyl 0 |
251 | * set_multmode : set multmode count | 266 | * set_multmode : set multmode count |
252 | * set_tune : tune interface for drive | ||
253 | * serviced : service command | ||
254 | * reserved : unused | 267 | * reserved : unused |
255 | */ | 268 | */ |
256 | typedef union { | 269 | typedef union { |
@@ -259,43 +272,11 @@ typedef union { | |||
259 | unsigned set_geometry : 1; | 272 | unsigned set_geometry : 1; |
260 | unsigned recalibrate : 1; | 273 | unsigned recalibrate : 1; |
261 | unsigned set_multmode : 1; | 274 | unsigned set_multmode : 1; |
262 | unsigned set_tune : 1; | 275 | unsigned reserved : 5; |
263 | unsigned serviced : 1; | ||
264 | unsigned reserved : 3; | ||
265 | } b; | 276 | } b; |
266 | } special_t; | 277 | } special_t; |
267 | 278 | ||
268 | /* | 279 | /* |
269 | * ATA-IDE Select Register, aka Device-Head | ||
270 | * | ||
271 | * head : always zeros here | ||
272 | * unit : drive select number: 0/1 | ||
273 | * bit5 : always 1 | ||
274 | * lba : using LBA instead of CHS | ||
275 | * bit7 : always 1 | ||
276 | */ | ||
277 | typedef union { | ||
278 | unsigned all : 8; | ||
279 | struct { | ||
280 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
281 | unsigned head : 4; | ||
282 | unsigned unit : 1; | ||
283 | unsigned bit5 : 1; | ||
284 | unsigned lba : 1; | ||
285 | unsigned bit7 : 1; | ||
286 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
287 | unsigned bit7 : 1; | ||
288 | unsigned lba : 1; | ||
289 | unsigned bit5 : 1; | ||
290 | unsigned unit : 1; | ||
291 | unsigned head : 4; | ||
292 | #else | ||
293 | #error "Please fix <asm/byteorder.h>" | ||
294 | #endif | ||
295 | } b; | ||
296 | } select_t, ata_select_t; | ||
297 | |||
298 | /* | ||
299 | * Status returned from various ide_ functions | 280 | * Status returned from various ide_ functions |
300 | */ | 281 | */ |
301 | typedef enum { | 282 | typedef enum { |
@@ -303,22 +284,205 @@ typedef enum { | |||
303 | ide_started, /* a drive operation was started, handler was set */ | 284 | ide_started, /* a drive operation was started, handler was set */ |
304 | } ide_startstop_t; | 285 | } ide_startstop_t; |
305 | 286 | ||
287 | enum { | ||
288 | IDE_TFLAG_LBA48 = (1 << 0), | ||
289 | IDE_TFLAG_FLAGGED = (1 << 2), | ||
290 | IDE_TFLAG_OUT_DATA = (1 << 3), | ||
291 | IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4), | ||
292 | IDE_TFLAG_OUT_HOB_NSECT = (1 << 5), | ||
293 | IDE_TFLAG_OUT_HOB_LBAL = (1 << 6), | ||
294 | IDE_TFLAG_OUT_HOB_LBAM = (1 << 7), | ||
295 | IDE_TFLAG_OUT_HOB_LBAH = (1 << 8), | ||
296 | IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE | | ||
297 | IDE_TFLAG_OUT_HOB_NSECT | | ||
298 | IDE_TFLAG_OUT_HOB_LBAL | | ||
299 | IDE_TFLAG_OUT_HOB_LBAM | | ||
300 | IDE_TFLAG_OUT_HOB_LBAH, | ||
301 | IDE_TFLAG_OUT_FEATURE = (1 << 9), | ||
302 | IDE_TFLAG_OUT_NSECT = (1 << 10), | ||
303 | IDE_TFLAG_OUT_LBAL = (1 << 11), | ||
304 | IDE_TFLAG_OUT_LBAM = (1 << 12), | ||
305 | IDE_TFLAG_OUT_LBAH = (1 << 13), | ||
306 | IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE | | ||
307 | IDE_TFLAG_OUT_NSECT | | ||
308 | IDE_TFLAG_OUT_LBAL | | ||
309 | IDE_TFLAG_OUT_LBAM | | ||
310 | IDE_TFLAG_OUT_LBAH, | ||
311 | IDE_TFLAG_OUT_DEVICE = (1 << 14), | ||
312 | IDE_TFLAG_WRITE = (1 << 15), | ||
313 | IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16), | ||
314 | IDE_TFLAG_IN_DATA = (1 << 17), | ||
315 | IDE_TFLAG_CUSTOM_HANDLER = (1 << 18), | ||
316 | IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19), | ||
317 | IDE_TFLAG_IN_HOB_FEATURE = (1 << 20), | ||
318 | IDE_TFLAG_IN_HOB_NSECT = (1 << 21), | ||
319 | IDE_TFLAG_IN_HOB_LBAL = (1 << 22), | ||
320 | IDE_TFLAG_IN_HOB_LBAM = (1 << 23), | ||
321 | IDE_TFLAG_IN_HOB_LBAH = (1 << 24), | ||
322 | IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL | | ||
323 | IDE_TFLAG_IN_HOB_LBAM | | ||
324 | IDE_TFLAG_IN_HOB_LBAH, | ||
325 | IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE | | ||
326 | IDE_TFLAG_IN_HOB_NSECT | | ||
327 | IDE_TFLAG_IN_HOB_LBA, | ||
328 | IDE_TFLAG_IN_FEATURE = (1 << 1), | ||
329 | IDE_TFLAG_IN_NSECT = (1 << 25), | ||
330 | IDE_TFLAG_IN_LBAL = (1 << 26), | ||
331 | IDE_TFLAG_IN_LBAM = (1 << 27), | ||
332 | IDE_TFLAG_IN_LBAH = (1 << 28), | ||
333 | IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL | | ||
334 | IDE_TFLAG_IN_LBAM | | ||
335 | IDE_TFLAG_IN_LBAH, | ||
336 | IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT | | ||
337 | IDE_TFLAG_IN_LBA, | ||
338 | IDE_TFLAG_IN_DEVICE = (1 << 29), | ||
339 | IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB | | ||
340 | IDE_TFLAG_IN_HOB, | ||
341 | IDE_TFLAG_TF = IDE_TFLAG_OUT_TF | | ||
342 | IDE_TFLAG_IN_TF, | ||
343 | IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE | | ||
344 | IDE_TFLAG_IN_DEVICE, | ||
345 | /* force 16-bit I/O operations */ | ||
346 | IDE_TFLAG_IO_16BIT = (1 << 30), | ||
347 | /* ide_task_t was allocated using kmalloc() */ | ||
348 | IDE_TFLAG_DYN = (1 << 31), | ||
349 | }; | ||
350 | |||
351 | struct ide_taskfile { | ||
352 | u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */ | ||
353 | |||
354 | u8 hob_feature; /* 1-5: additional data to support LBA48 */ | ||
355 | u8 hob_nsect; | ||
356 | u8 hob_lbal; | ||
357 | u8 hob_lbam; | ||
358 | u8 hob_lbah; | ||
359 | |||
360 | u8 data; /* 6: low data byte (for TASKFILE IOCTL) */ | ||
361 | |||
362 | union { /* Â 7: */ | ||
363 | u8 error; /* read: error */ | ||
364 | u8 feature; /* write: feature */ | ||
365 | }; | ||
366 | |||
367 | u8 nsect; /* 8: number of sectors */ | ||
368 | u8 lbal; /* 9: LBA low */ | ||
369 | u8 lbam; /* 10: LBA mid */ | ||
370 | u8 lbah; /* 11: LBA high */ | ||
371 | |||
372 | u8 device; /* 12: device select */ | ||
373 | |||
374 | union { /* 13: */ | ||
375 | u8 status; /*  read: status  */ | ||
376 | u8 command; /* write: command */ | ||
377 | }; | ||
378 | }; | ||
379 | |||
380 | typedef struct ide_task_s { | ||
381 | union { | ||
382 | struct ide_taskfile tf; | ||
383 | u8 tf_array[14]; | ||
384 | }; | ||
385 | u32 tf_flags; | ||
386 | int data_phase; | ||
387 | struct request *rq; /* copy of request */ | ||
388 | void *special; /* valid_t generally */ | ||
389 | } ide_task_t; | ||
390 | |||
391 | /* ATAPI packet command flags */ | ||
392 | enum { | ||
393 | /* set when an error is considered normal - no retry (ide-tape) */ | ||
394 | PC_FLAG_ABORT = (1 << 0), | ||
395 | PC_FLAG_SUPPRESS_ERROR = (1 << 1), | ||
396 | PC_FLAG_WAIT_FOR_DSC = (1 << 2), | ||
397 | PC_FLAG_DMA_OK = (1 << 3), | ||
398 | PC_FLAG_DMA_IN_PROGRESS = (1 << 4), | ||
399 | PC_FLAG_DMA_ERROR = (1 << 5), | ||
400 | PC_FLAG_WRITING = (1 << 6), | ||
401 | /* command timed out */ | ||
402 | PC_FLAG_TIMEDOUT = (1 << 7), | ||
403 | }; | ||
404 | |||
405 | /* | ||
406 | * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes. | ||
407 | * This is used for several packet commands (not for READ/WRITE commands). | ||
408 | */ | ||
409 | #define IDE_PC_BUFFER_SIZE 256 | ||
410 | |||
411 | struct ide_atapi_pc { | ||
412 | /* actual packet bytes */ | ||
413 | u8 c[12]; | ||
414 | /* incremented on each retry */ | ||
415 | int retries; | ||
416 | int error; | ||
417 | |||
418 | /* bytes to transfer */ | ||
419 | int req_xfer; | ||
420 | /* bytes actually transferred */ | ||
421 | int xferred; | ||
422 | |||
423 | /* data buffer */ | ||
424 | u8 *buf; | ||
425 | /* current buffer position */ | ||
426 | u8 *cur_pos; | ||
427 | int buf_size; | ||
428 | /* missing/available data on the current buffer */ | ||
429 | int b_count; | ||
430 | |||
431 | /* the corresponding request */ | ||
432 | struct request *rq; | ||
433 | |||
434 | unsigned long flags; | ||
435 | |||
436 | /* | ||
437 | * those are more or less driver-specific and some of them are subject | ||
438 | * to change/removal later. | ||
439 | */ | ||
440 | u8 pc_buf[IDE_PC_BUFFER_SIZE]; | ||
441 | |||
442 | /* idetape only */ | ||
443 | struct idetape_bh *bh; | ||
444 | char *b_data; | ||
445 | |||
446 | /* idescsi only for now */ | ||
447 | struct scatterlist *sg; | ||
448 | unsigned int sg_cnt; | ||
449 | |||
450 | struct scsi_cmnd *scsi_cmd; | ||
451 | void (*done) (struct scsi_cmnd *); | ||
452 | |||
453 | unsigned long timeout; | ||
454 | }; | ||
455 | |||
456 | struct ide_devset; | ||
306 | struct ide_driver_s; | 457 | struct ide_driver_s; |
307 | struct ide_settings_s; | ||
308 | 458 | ||
309 | #ifdef CONFIG_BLK_DEV_IDEACPI | 459 | #ifdef CONFIG_BLK_DEV_IDEACPI |
310 | struct ide_acpi_drive_link; | 460 | struct ide_acpi_drive_link; |
311 | struct ide_acpi_hwif_link; | 461 | struct ide_acpi_hwif_link; |
312 | #endif | 462 | #endif |
313 | 463 | ||
464 | struct ide_drive_s; | ||
465 | |||
466 | struct ide_disk_ops { | ||
467 | int (*check)(struct ide_drive_s *, const char *); | ||
468 | int (*get_capacity)(struct ide_drive_s *); | ||
469 | void (*setup)(struct ide_drive_s *); | ||
470 | void (*flush)(struct ide_drive_s *); | ||
471 | int (*init_media)(struct ide_drive_s *, struct gendisk *); | ||
472 | int (*set_doorlock)(struct ide_drive_s *, struct gendisk *, | ||
473 | int); | ||
474 | ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *, | ||
475 | sector_t); | ||
476 | int (*end_request)(struct ide_drive_s *, int, int); | ||
477 | int (*ioctl)(struct ide_drive_s *, struct block_device *, | ||
478 | fmode_t, unsigned int, unsigned long); | ||
479 | }; | ||
480 | |||
314 | /* ATAPI device flags */ | 481 | /* ATAPI device flags */ |
315 | enum { | 482 | enum { |
316 | IDE_AFLAG_DRQ_INTERRUPT = (1 << 0), | 483 | IDE_AFLAG_DRQ_INTERRUPT = (1 << 0), |
317 | IDE_AFLAG_MEDIA_CHANGED = (1 << 1), | ||
318 | 484 | ||
319 | /* ide-cd */ | 485 | /* ide-cd */ |
320 | /* Drive cannot lock the door. */ | ||
321 | IDE_AFLAG_NO_DOORLOCK = (1 << 2), | ||
322 | /* Drive cannot eject the disc. */ | 486 | /* Drive cannot eject the disc. */ |
323 | IDE_AFLAG_NO_EJECT = (1 << 3), | 487 | IDE_AFLAG_NO_EJECT = (1 << 3), |
324 | /* Drive is a pre ATAPI 1.2 drive. */ | 488 | /* Drive is a pre ATAPI 1.2 drive. */ |
@@ -348,25 +512,87 @@ enum { | |||
348 | IDE_AFLAG_LE_SPEED_FIELDS = (1 << 17), | 512 | IDE_AFLAG_LE_SPEED_FIELDS = (1 << 17), |
349 | 513 | ||
350 | /* ide-floppy */ | 514 | /* ide-floppy */ |
351 | /* Format in progress */ | ||
352 | IDE_AFLAG_FORMAT_IN_PROGRESS = (1 << 18), | ||
353 | /* Avoid commands not supported in Clik drive */ | 515 | /* Avoid commands not supported in Clik drive */ |
354 | IDE_AFLAG_CLIK_DRIVE = (1 << 19), | 516 | IDE_AFLAG_CLIK_DRIVE = (1 << 19), |
355 | /* Requires BH algorithm for packets */ | 517 | /* Requires BH algorithm for packets */ |
356 | IDE_AFLAG_ZIP_DRIVE = (1 << 20), | 518 | IDE_AFLAG_ZIP_DRIVE = (1 << 20), |
519 | /* Supports format progress report */ | ||
520 | IDE_AFLAG_SRFP = (1 << 22), | ||
357 | 521 | ||
358 | /* ide-tape */ | 522 | /* ide-tape */ |
359 | IDE_AFLAG_IGNORE_DSC = (1 << 21), | 523 | IDE_AFLAG_IGNORE_DSC = (1 << 23), |
360 | /* 0 When the tape position is unknown */ | 524 | /* 0 When the tape position is unknown */ |
361 | IDE_AFLAG_ADDRESS_VALID = (1 << 22), | 525 | IDE_AFLAG_ADDRESS_VALID = (1 << 24), |
362 | /* Device already opened */ | 526 | /* Device already opened */ |
363 | IDE_AFLAG_BUSY = (1 << 23), | 527 | IDE_AFLAG_BUSY = (1 << 25), |
364 | /* Attempt to auto-detect the current user block size */ | 528 | /* Attempt to auto-detect the current user block size */ |
365 | IDE_AFLAG_DETECT_BS = (1 << 24), | 529 | IDE_AFLAG_DETECT_BS = (1 << 26), |
366 | /* Currently on a filemark */ | 530 | /* Currently on a filemark */ |
367 | IDE_AFLAG_FILEMARK = (1 << 25), | 531 | IDE_AFLAG_FILEMARK = (1 << 27), |
368 | /* 0 = no tape is loaded, so we don't rewind after ejecting */ | 532 | /* 0 = no tape is loaded, so we don't rewind after ejecting */ |
369 | IDE_AFLAG_MEDIUM_PRESENT = (1 << 26) | 533 | IDE_AFLAG_MEDIUM_PRESENT = (1 << 28), |
534 | |||
535 | IDE_AFLAG_NO_AUTOCLOSE = (1 << 29), | ||
536 | }; | ||
537 | |||
538 | /* device flags */ | ||
539 | enum { | ||
540 | /* restore settings after device reset */ | ||
541 | IDE_DFLAG_KEEP_SETTINGS = (1 << 0), | ||
542 | /* device is using DMA for read/write */ | ||
543 | IDE_DFLAG_USING_DMA = (1 << 1), | ||
544 | /* okay to unmask other IRQs */ | ||
545 | IDE_DFLAG_UNMASK = (1 << 2), | ||
546 | /* don't attempt flushes */ | ||
547 | IDE_DFLAG_NOFLUSH = (1 << 3), | ||
548 | /* DSC overlap */ | ||
549 | IDE_DFLAG_DSC_OVERLAP = (1 << 4), | ||
550 | /* give potential excess bandwidth */ | ||
551 | IDE_DFLAG_NICE1 = (1 << 5), | ||
552 | /* device is physically present */ | ||
553 | IDE_DFLAG_PRESENT = (1 << 6), | ||
554 | /* device ejected hint */ | ||
555 | IDE_DFLAG_DEAD = (1 << 7), | ||
556 | /* id read from device (synthetic if not set) */ | ||
557 | IDE_DFLAG_ID_READ = (1 << 8), | ||
558 | IDE_DFLAG_NOPROBE = (1 << 9), | ||
559 | /* need to do check_media_change() */ | ||
560 | IDE_DFLAG_REMOVABLE = (1 << 10), | ||
561 | /* needed for removable devices */ | ||
562 | IDE_DFLAG_ATTACH = (1 << 11), | ||
563 | IDE_DFLAG_FORCED_GEOM = (1 << 12), | ||
564 | /* disallow setting unmask bit */ | ||
565 | IDE_DFLAG_NO_UNMASK = (1 << 13), | ||
566 | /* disallow enabling 32-bit I/O */ | ||
567 | IDE_DFLAG_NO_IO_32BIT = (1 << 14), | ||
568 | /* for removable only: door lock/unlock works */ | ||
569 | IDE_DFLAG_DOORLOCKING = (1 << 15), | ||
570 | /* disallow DMA */ | ||
571 | IDE_DFLAG_NODMA = (1 << 16), | ||
572 | /* powermanagment told us not to do anything, so sleep nicely */ | ||
573 | IDE_DFLAG_BLOCKED = (1 << 17), | ||
574 | /* ide-scsi emulation */ | ||
575 | IDE_DFLAG_SCSI = (1 << 18), | ||
576 | /* sleeping & sleep field valid */ | ||
577 | IDE_DFLAG_SLEEPING = (1 << 19), | ||
578 | IDE_DFLAG_POST_RESET = (1 << 20), | ||
579 | IDE_DFLAG_UDMA33_WARNED = (1 << 21), | ||
580 | IDE_DFLAG_LBA48 = (1 << 22), | ||
581 | /* status of write cache */ | ||
582 | IDE_DFLAG_WCACHE = (1 << 23), | ||
583 | /* used for ignoring ATA_DF */ | ||
584 | IDE_DFLAG_NOWERR = (1 << 24), | ||
585 | /* retrying in PIO */ | ||
586 | IDE_DFLAG_DMA_PIO_RETRY = (1 << 25), | ||
587 | IDE_DFLAG_LBA = (1 << 26), | ||
588 | /* don't unload heads */ | ||
589 | IDE_DFLAG_NO_UNLOAD = (1 << 27), | ||
590 | /* heads unloaded, please don't reset port */ | ||
591 | IDE_DFLAG_PARKED = (1 << 28), | ||
592 | IDE_DFLAG_MEDIA_CHANGED = (1 << 29), | ||
593 | /* write protect */ | ||
594 | IDE_DFLAG_WP = (1 << 30), | ||
595 | IDE_DFLAG_FORMAT_IN_PROGRESS = (1 << 31), | ||
370 | }; | 596 | }; |
371 | 597 | ||
372 | struct ide_drive_s { | 598 | struct ide_drive_s { |
@@ -378,72 +604,49 @@ struct ide_drive_s { | |||
378 | struct request *rq; /* current request */ | 604 | struct request *rq; /* current request */ |
379 | struct ide_drive_s *next; /* circular list of hwgroup drives */ | 605 | struct ide_drive_s *next; /* circular list of hwgroup drives */ |
380 | void *driver_data; /* extra driver data */ | 606 | void *driver_data; /* extra driver data */ |
381 | struct hd_driveid *id; /* drive model identification info */ | 607 | u16 *id; /* identification info */ |
382 | #ifdef CONFIG_IDE_PROC_FS | 608 | #ifdef CONFIG_IDE_PROC_FS |
383 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ | 609 | struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ |
384 | struct ide_settings_s *settings;/* /proc/ide/ drive settings */ | 610 | const struct ide_proc_devset *settings; /* /proc/ide/ drive settings */ |
385 | #endif | 611 | #endif |
386 | struct hwif_s *hwif; /* actually (ide_hwif_t *) */ | 612 | struct hwif_s *hwif; /* actually (ide_hwif_t *) */ |
387 | 613 | ||
614 | const struct ide_disk_ops *disk_ops; | ||
615 | |||
616 | unsigned long dev_flags; | ||
617 | |||
388 | unsigned long sleep; /* sleep until this time */ | 618 | unsigned long sleep; /* sleep until this time */ |
389 | unsigned long service_start; /* time we started last request */ | 619 | unsigned long service_start; /* time we started last request */ |
390 | unsigned long service_time; /* service time of last request */ | 620 | unsigned long service_time; /* service time of last request */ |
391 | unsigned long timeout; /* max time to wait for irq */ | 621 | unsigned long timeout; /* max time to wait for irq */ |
392 | 622 | ||
393 | special_t special; /* special action flags */ | 623 | special_t special; /* special action flags */ |
394 | select_t select; /* basic drive/head select reg value */ | ||
395 | 624 | ||
396 | u8 keep_settings; /* restore settings after drive reset */ | 625 | u8 select; /* basic drive/head select reg value */ |
397 | u8 using_dma; /* disk is using dma for read/write */ | ||
398 | u8 retry_pio; /* retrying dma capable host in pio */ | 626 | u8 retry_pio; /* retrying dma capable host in pio */ |
399 | u8 state; /* retry state */ | ||
400 | u8 waiting_for_dma; /* dma currently in progress */ | 627 | u8 waiting_for_dma; /* dma currently in progress */ |
401 | u8 unmask; /* okay to unmask other irqs */ | 628 | u8 dma; /* atapi dma flag */ |
402 | u8 noflush; /* don't attempt flushes */ | 629 | |
403 | u8 dsc_overlap; /* DSC overlap */ | ||
404 | u8 nice1; /* give potential excess bandwidth */ | ||
405 | |||
406 | unsigned present : 1; /* drive is physically present */ | ||
407 | unsigned dead : 1; /* device ejected hint */ | ||
408 | unsigned id_read : 1; /* 1=id read from disk 0 = synthetic */ | ||
409 | unsigned noprobe : 1; /* from: hdx=noprobe */ | ||
410 | unsigned removable : 1; /* 1 if need to do check_media_change */ | ||
411 | unsigned attach : 1; /* needed for removable devices */ | ||
412 | unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */ | ||
413 | unsigned no_unmask : 1; /* disallow setting unmask bit */ | ||
414 | unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */ | ||
415 | unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */ | ||
416 | unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ | ||
417 | unsigned nodma : 1; /* disallow DMA */ | ||
418 | unsigned remap_0_to_1 : 1; /* 0=noremap, 1=remap 0->1 (for EZDrive) */ | ||
419 | unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */ | ||
420 | unsigned scsi : 1; /* 0=default, 1=ide-scsi emulation */ | ||
421 | unsigned sleeping : 1; /* 1=sleeping & sleep field valid */ | ||
422 | unsigned post_reset : 1; | ||
423 | unsigned udma33_warned : 1; | ||
424 | |||
425 | u8 addressing; /* 0=28-bit, 1=48-bit, 2=48-bit doing 28-bit */ | ||
426 | u8 quirk_list; /* considered quirky, set for a specific host */ | 630 | u8 quirk_list; /* considered quirky, set for a specific host */ |
427 | u8 init_speed; /* transfer rate set at boot */ | 631 | u8 init_speed; /* transfer rate set at boot */ |
428 | u8 current_speed; /* current transfer rate set */ | 632 | u8 current_speed; /* current transfer rate set */ |
429 | u8 desired_speed; /* desired transfer rate set */ | 633 | u8 desired_speed; /* desired transfer rate set */ |
430 | u8 dn; /* now wide spread use */ | 634 | u8 dn; /* now wide spread use */ |
431 | u8 wcache; /* status of write cache */ | ||
432 | u8 acoustic; /* acoustic management */ | 635 | u8 acoustic; /* acoustic management */ |
433 | u8 media; /* disk, cdrom, tape, floppy, ... */ | 636 | u8 media; /* disk, cdrom, tape, floppy, ... */ |
434 | u8 ready_stat; /* min status value for drive ready */ | 637 | u8 ready_stat; /* min status value for drive ready */ |
435 | u8 mult_count; /* current multiple sector setting */ | 638 | u8 mult_count; /* current multiple sector setting */ |
436 | u8 mult_req; /* requested multiple sector setting */ | 639 | u8 mult_req; /* requested multiple sector setting */ |
437 | u8 tune_req; /* requested drive tuning setting */ | ||
438 | u8 io_32bit; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */ | 640 | u8 io_32bit; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */ |
439 | u8 bad_wstat; /* used for ignoring WRERR_STAT */ | 641 | u8 bad_wstat; /* used for ignoring ATA_DF */ |
440 | u8 nowerr; /* used for ignoring WRERR_STAT */ | ||
441 | u8 sect0; /* offset of first sector for DM6:DDO */ | ||
442 | u8 head; /* "real" number of heads */ | 642 | u8 head; /* "real" number of heads */ |
443 | u8 sect; /* "real" sectors per track */ | 643 | u8 sect; /* "real" sectors per track */ |
444 | u8 bios_head; /* BIOS/fdisk/LILO number of heads */ | 644 | u8 bios_head; /* BIOS/fdisk/LILO number of heads */ |
445 | u8 bios_sect; /* BIOS/fdisk/LILO sectors per track */ | 645 | u8 bios_sect; /* BIOS/fdisk/LILO sectors per track */ |
446 | 646 | ||
647 | /* delay this long before sending packet command */ | ||
648 | u8 pc_delay; | ||
649 | |||
447 | unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ | 650 | unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ |
448 | unsigned int cyl; /* "real" number of cyls */ | 651 | unsigned int cyl; /* "real" number of cyls */ |
449 | unsigned int drive_data; /* used by set_pio_mode/selectproc */ | 652 | unsigned int drive_data; /* used by set_pio_mode/selectproc */ |
@@ -455,6 +658,9 @@ struct ide_drive_s { | |||
455 | 658 | ||
456 | int lun; /* logical unit */ | 659 | int lun; /* logical unit */ |
457 | int crc_count; /* crc counter to reduce drive speed */ | 660 | int crc_count; /* crc counter to reduce drive speed */ |
661 | |||
662 | unsigned long debug_mask; /* debugging levels switch */ | ||
663 | |||
458 | #ifdef CONFIG_BLK_DEV_IDEACPI | 664 | #ifdef CONFIG_BLK_DEV_IDEACPI |
459 | struct ide_acpi_drive_link *acpidata; | 665 | struct ide_acpi_drive_link *acpidata; |
460 | #endif | 666 | #endif |
@@ -462,21 +668,32 @@ struct ide_drive_s { | |||
462 | struct device gendev; | 668 | struct device gendev; |
463 | struct completion gendev_rel_comp; /* to deal with device release() */ | 669 | struct completion gendev_rel_comp; /* to deal with device release() */ |
464 | 670 | ||
671 | /* current packet command */ | ||
672 | struct ide_atapi_pc *pc; | ||
673 | |||
465 | /* callback for packet commands */ | 674 | /* callback for packet commands */ |
466 | void (*pc_callback)(struct ide_drive_s *); | 675 | void (*pc_callback)(struct ide_drive_s *, int); |
676 | |||
677 | void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *); | ||
678 | int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *, | ||
679 | unsigned int, int); | ||
467 | 680 | ||
468 | unsigned long atapi_flags; | 681 | unsigned long atapi_flags; |
682 | |||
683 | struct ide_atapi_pc request_sense_pc; | ||
684 | struct request request_sense_rq; | ||
469 | }; | 685 | }; |
470 | 686 | ||
471 | typedef struct ide_drive_s ide_drive_t; | 687 | typedef struct ide_drive_s ide_drive_t; |
472 | 688 | ||
473 | #define to_ide_device(dev)container_of(dev, ide_drive_t, gendev) | 689 | #define to_ide_device(dev) container_of(dev, ide_drive_t, gendev) |
474 | 690 | ||
475 | #define IDE_CHIPSET_PCI_MASK \ | 691 | #define to_ide_drv(obj, cont_type) \ |
476 | ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx)) | 692 | container_of(obj, struct cont_type, kref) |
477 | #define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1) | 693 | |
694 | #define ide_drv_g(disk, cont_type) \ | ||
695 | container_of((disk)->private_data, struct cont_type, driver) | ||
478 | 696 | ||
479 | struct ide_task_s; | ||
480 | struct ide_port_info; | 697 | struct ide_port_info; |
481 | 698 | ||
482 | struct ide_tp_ops { | 699 | struct ide_tp_ops { |
@@ -510,6 +727,7 @@ extern const struct ide_tp_ops default_tp_ops; | |||
510 | * @resetproc: routine to reset controller after a disk reset | 727 | * @resetproc: routine to reset controller after a disk reset |
511 | * @maskproc: special host masking for drive selection | 728 | * @maskproc: special host masking for drive selection |
512 | * @quirkproc: check host's drive quirk list | 729 | * @quirkproc: check host's drive quirk list |
730 | * @clear_irq: clear IRQ | ||
513 | * | 731 | * |
514 | * @mdma_filter: filter MDMA modes | 732 | * @mdma_filter: filter MDMA modes |
515 | * @udma_filter: filter UDMA modes | 733 | * @udma_filter: filter UDMA modes |
@@ -526,6 +744,7 @@ struct ide_port_ops { | |||
526 | void (*resetproc)(ide_drive_t *); | 744 | void (*resetproc)(ide_drive_t *); |
527 | void (*maskproc)(ide_drive_t *, int); | 745 | void (*maskproc)(ide_drive_t *, int); |
528 | void (*quirkproc)(ide_drive_t *); | 746 | void (*quirkproc)(ide_drive_t *); |
747 | void (*clear_irq)(ide_drive_t *); | ||
529 | 748 | ||
530 | u8 (*mdma_filter)(ide_drive_t *); | 749 | u8 (*mdma_filter)(ide_drive_t *); |
531 | u8 (*udma_filter)(ide_drive_t *); | 750 | u8 (*udma_filter)(ide_drive_t *); |
@@ -565,7 +784,6 @@ typedef struct hwif_s { | |||
565 | u8 major; /* our major number */ | 784 | u8 major; /* our major number */ |
566 | u8 index; /* 0 for ide0; 1 for ide1; ... */ | 785 | u8 index; /* 0 for ide0; 1 for ide1; ... */ |
567 | u8 channel; /* for dual-port chips: 0=primary, 1=secondary */ | 786 | u8 channel; /* for dual-port chips: 0=primary, 1=secondary */ |
568 | u8 bus_state; /* power state of the IDE bus */ | ||
569 | 787 | ||
570 | u32 host_flags; | 788 | u32 host_flags; |
571 | 789 | ||
@@ -589,12 +807,16 @@ typedef struct hwif_s { | |||
589 | const struct ide_port_ops *port_ops; | 807 | const struct ide_port_ops *port_ops; |
590 | const struct ide_dma_ops *dma_ops; | 808 | const struct ide_dma_ops *dma_ops; |
591 | 809 | ||
592 | void (*ide_dma_clear_irq)(ide_drive_t *drive); | ||
593 | |||
594 | /* dma physical region descriptor table (cpu view) */ | 810 | /* dma physical region descriptor table (cpu view) */ |
595 | unsigned int *dmatable_cpu; | 811 | unsigned int *dmatable_cpu; |
596 | /* dma physical region descriptor table (dma view) */ | 812 | /* dma physical region descriptor table (dma view) */ |
597 | dma_addr_t dmatable_dma; | 813 | dma_addr_t dmatable_dma; |
814 | |||
815 | /* maximum number of PRD table entries */ | ||
816 | int prd_max_nents; | ||
817 | /* PRD entry size in bytes */ | ||
818 | int prd_ent_size; | ||
819 | |||
598 | /* Scatter-gather list used to build the above */ | 820 | /* Scatter-gather list used to build the above */ |
599 | struct scatterlist *sg_table; | 821 | struct scatterlist *sg_table; |
600 | int sg_max_nents; /* Maximum number of entries in it */ | 822 | int sg_max_nents; /* Maximum number of entries in it */ |
@@ -604,6 +826,8 @@ typedef struct hwif_s { | |||
604 | /* data phase of the active command (currently only valid for PIO/DMA) */ | 826 | /* data phase of the active command (currently only valid for PIO/DMA) */ |
605 | int data_phase; | 827 | int data_phase; |
606 | 828 | ||
829 | struct ide_task_s task; /* current command */ | ||
830 | |||
607 | unsigned int nsect; | 831 | unsigned int nsect; |
608 | unsigned int nleft; | 832 | unsigned int nleft; |
609 | struct scatterlist *cursg; | 833 | struct scatterlist *cursg; |
@@ -632,17 +856,18 @@ typedef struct hwif_s { | |||
632 | 856 | ||
633 | void *hwif_data; /* extra hwif data */ | 857 | void *hwif_data; /* extra hwif data */ |
634 | 858 | ||
635 | unsigned dma; | ||
636 | |||
637 | #ifdef CONFIG_BLK_DEV_IDEACPI | 859 | #ifdef CONFIG_BLK_DEV_IDEACPI |
638 | struct ide_acpi_hwif_link *acpidata; | 860 | struct ide_acpi_hwif_link *acpidata; |
639 | #endif | 861 | #endif |
640 | } ____cacheline_internodealigned_in_smp ide_hwif_t; | 862 | } ____cacheline_internodealigned_in_smp ide_hwif_t; |
641 | 863 | ||
864 | #define MAX_HOST_PORTS 4 | ||
865 | |||
642 | struct ide_host { | 866 | struct ide_host { |
643 | ide_hwif_t *ports[MAX_HWIFS]; | 867 | ide_hwif_t *ports[MAX_HOST_PORTS]; |
644 | unsigned int n_ports; | 868 | unsigned int n_ports; |
645 | struct device *dev[2]; | 869 | struct device *dev[2]; |
870 | unsigned int (*init_chipset)(struct pci_dev *); | ||
646 | unsigned long host_flags; | 871 | unsigned long host_flags; |
647 | void *host_priv; | 872 | void *host_priv; |
648 | }; | 873 | }; |
@@ -690,102 +915,116 @@ typedef struct ide_driver_s ide_driver_t; | |||
690 | 915 | ||
691 | extern struct mutex ide_setting_mtx; | 916 | extern struct mutex ide_setting_mtx; |
692 | 917 | ||
693 | int set_io_32bit(ide_drive_t *, int); | 918 | /* |
694 | int set_pio_mode(ide_drive_t *, int); | 919 | * configurable drive settings |
695 | int set_using_dma(ide_drive_t *, int); | 920 | */ |
696 | 921 | ||
697 | /* ATAPI packet command flags */ | 922 | #define DS_SYNC (1 << 0) |
698 | enum { | 923 | |
699 | /* set when an error is considered normal - no retry (ide-tape) */ | 924 | struct ide_devset { |
700 | PC_FLAG_ABORT = (1 << 0), | 925 | int (*get)(ide_drive_t *); |
701 | PC_FLAG_SUPPRESS_ERROR = (1 << 1), | 926 | int (*set)(ide_drive_t *, int); |
702 | PC_FLAG_WAIT_FOR_DSC = (1 << 2), | 927 | unsigned int flags; |
703 | PC_FLAG_DMA_OK = (1 << 3), | ||
704 | PC_FLAG_DMA_IN_PROGRESS = (1 << 4), | ||
705 | PC_FLAG_DMA_ERROR = (1 << 5), | ||
706 | PC_FLAG_WRITING = (1 << 6), | ||
707 | /* command timed out */ | ||
708 | PC_FLAG_TIMEDOUT = (1 << 7), | ||
709 | }; | 928 | }; |
710 | 929 | ||
711 | struct ide_atapi_pc { | 930 | #define __DEVSET(_flags, _get, _set) { \ |
712 | /* actual packet bytes */ | 931 | .flags = _flags, \ |
713 | u8 c[12]; | 932 | .get = _get, \ |
714 | /* incremented on each retry */ | 933 | .set = _set, \ |
715 | int retries; | 934 | } |
716 | int error; | ||
717 | 935 | ||
718 | /* bytes to transfer */ | 936 | #define ide_devset_get(name, field) \ |
719 | int req_xfer; | 937 | static int get_##name(ide_drive_t *drive) \ |
720 | /* bytes actually transferred */ | 938 | { \ |
721 | int xferred; | 939 | return drive->field; \ |
940 | } | ||
722 | 941 | ||
723 | /* data buffer */ | 942 | #define ide_devset_set(name, field) \ |
724 | u8 *buf; | 943 | static int set_##name(ide_drive_t *drive, int arg) \ |
725 | /* current buffer position */ | 944 | { \ |
726 | u8 *cur_pos; | 945 | drive->field = arg; \ |
727 | int buf_size; | 946 | return 0; \ |
728 | /* missing/available data on the current buffer */ | 947 | } |
729 | int b_count; | ||
730 | 948 | ||
731 | /* the corresponding request */ | 949 | #define ide_devset_get_flag(name, flag) \ |
732 | struct request *rq; | 950 | static int get_##name(ide_drive_t *drive) \ |
951 | { \ | ||
952 | return !!(drive->dev_flags & flag); \ | ||
953 | } | ||
733 | 954 | ||
734 | unsigned long flags; | 955 | #define ide_devset_set_flag(name, flag) \ |
956 | static int set_##name(ide_drive_t *drive, int arg) \ | ||
957 | { \ | ||
958 | if (arg) \ | ||
959 | drive->dev_flags |= flag; \ | ||
960 | else \ | ||
961 | drive->dev_flags &= ~flag; \ | ||
962 | return 0; \ | ||
963 | } | ||
735 | 964 | ||
736 | /* | 965 | #define __IDE_DEVSET(_name, _flags, _get, _set) \ |
737 | * those are more or less driver-specific and some of them are subject | 966 | const struct ide_devset ide_devset_##_name = \ |
738 | * to change/removal later. | 967 | __DEVSET(_flags, _get, _set) |
739 | */ | ||
740 | u8 pc_buf[256]; | ||
741 | 968 | ||
742 | /* idetape only */ | 969 | #define IDE_DEVSET(_name, _flags, _get, _set) \ |
743 | struct idetape_bh *bh; | 970 | static __IDE_DEVSET(_name, _flags, _get, _set) |
744 | char *b_data; | ||
745 | 971 | ||
746 | /* idescsi only for now */ | 972 | #define ide_devset_rw(_name, _func) \ |
747 | struct scatterlist *sg; | 973 | IDE_DEVSET(_name, 0, get_##_func, set_##_func) |
748 | unsigned int sg_cnt; | ||
749 | 974 | ||
750 | struct scsi_cmnd *scsi_cmd; | 975 | #define ide_devset_w(_name, _func) \ |
751 | void (*done) (struct scsi_cmnd *); | 976 | IDE_DEVSET(_name, 0, NULL, set_##_func) |
752 | 977 | ||
753 | unsigned long timeout; | 978 | #define ide_ext_devset_rw(_name, _func) \ |
754 | }; | 979 | __IDE_DEVSET(_name, 0, get_##_func, set_##_func) |
980 | |||
981 | #define ide_ext_devset_rw_sync(_name, _func) \ | ||
982 | __IDE_DEVSET(_name, DS_SYNC, get_##_func, set_##_func) | ||
983 | |||
984 | #define ide_decl_devset(_name) \ | ||
985 | extern const struct ide_devset ide_devset_##_name | ||
986 | |||
987 | ide_decl_devset(io_32bit); | ||
988 | ide_decl_devset(keepsettings); | ||
989 | ide_decl_devset(pio_mode); | ||
990 | ide_decl_devset(unmaskirq); | ||
991 | ide_decl_devset(using_dma); | ||
755 | 992 | ||
756 | #ifdef CONFIG_IDE_PROC_FS | 993 | #ifdef CONFIG_IDE_PROC_FS |
757 | /* | 994 | /* |
758 | * configurable drive settings | 995 | * /proc/ide interface |
759 | */ | 996 | */ |
760 | 997 | ||
761 | #define TYPE_INT 0 | 998 | #define ide_devset_rw_field(_name, _field) \ |
762 | #define TYPE_BYTE 1 | 999 | ide_devset_get(_name, _field); \ |
763 | #define TYPE_SHORT 2 | 1000 | ide_devset_set(_name, _field); \ |
1001 | IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) | ||
1002 | |||
1003 | #define ide_devset_rw_flag(_name, _field) \ | ||
1004 | ide_devset_get_flag(_name, _field); \ | ||
1005 | ide_devset_set_flag(_name, _field); \ | ||
1006 | IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name) | ||
1007 | |||
1008 | struct ide_proc_devset { | ||
1009 | const char *name; | ||
1010 | const struct ide_devset *setting; | ||
1011 | int min, max; | ||
1012 | int (*mulf)(ide_drive_t *); | ||
1013 | int (*divf)(ide_drive_t *); | ||
1014 | }; | ||
764 | 1015 | ||
765 | #define SETTING_READ (1 << 0) | 1016 | #define __IDE_PROC_DEVSET(_name, _min, _max, _mulf, _divf) { \ |
766 | #define SETTING_WRITE (1 << 1) | 1017 | .name = __stringify(_name), \ |
767 | #define SETTING_RW (SETTING_READ | SETTING_WRITE) | 1018 | .setting = &ide_devset_##_name, \ |
1019 | .min = _min, \ | ||
1020 | .max = _max, \ | ||
1021 | .mulf = _mulf, \ | ||
1022 | .divf = _divf, \ | ||
1023 | } | ||
768 | 1024 | ||
769 | typedef int (ide_procset_t)(ide_drive_t *, int); | 1025 | #define IDE_PROC_DEVSET(_name, _min, _max) \ |
770 | typedef struct ide_settings_s { | 1026 | __IDE_PROC_DEVSET(_name, _min, _max, NULL, NULL) |
771 | char *name; | ||
772 | int rw; | ||
773 | int data_type; | ||
774 | int min; | ||
775 | int max; | ||
776 | int mul_factor; | ||
777 | int div_factor; | ||
778 | void *data; | ||
779 | ide_procset_t *set; | ||
780 | int auto_remove; | ||
781 | struct ide_settings_s *next; | ||
782 | } ide_settings_t; | ||
783 | |||
784 | int ide_add_setting(ide_drive_t *, const char *, int, int, int, int, int, int, void *, ide_procset_t *set); | ||
785 | 1027 | ||
786 | /* | ||
787 | * /proc/ide interface | ||
788 | */ | ||
789 | typedef struct { | 1028 | typedef struct { |
790 | const char *name; | 1029 | const char *name; |
791 | mode_t mode; | 1030 | mode_t mode; |
@@ -802,8 +1041,6 @@ void ide_proc_unregister_port(ide_hwif_t *); | |||
802 | void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); | 1041 | void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); |
803 | void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); | 1042 | void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); |
804 | 1043 | ||
805 | void ide_add_generic_settings(ide_drive_t *); | ||
806 | |||
807 | read_proc_t proc_ide_read_capacity; | 1044 | read_proc_t proc_ide_read_capacity; |
808 | read_proc_t proc_ide_read_geometry; | 1045 | read_proc_t proc_ide_read_geometry; |
809 | 1046 | ||
@@ -831,41 +1068,58 @@ static inline void ide_proc_unregister_device(ide_drive_t *drive) { ; } | |||
831 | static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } | 1068 | static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } |
832 | static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } | 1069 | static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } |
833 | static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } | 1070 | static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } |
834 | static inline void ide_add_generic_settings(ide_drive_t *drive) { ; } | ||
835 | #define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0; | 1071 | #define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0; |
836 | #endif | 1072 | #endif |
837 | 1073 | ||
1074 | enum { | ||
1075 | /* enter/exit functions */ | ||
1076 | IDE_DBG_FUNC = (1 << 0), | ||
1077 | /* sense key/asc handling */ | ||
1078 | IDE_DBG_SENSE = (1 << 1), | ||
1079 | /* packet commands handling */ | ||
1080 | IDE_DBG_PC = (1 << 2), | ||
1081 | /* request handling */ | ||
1082 | IDE_DBG_RQ = (1 << 3), | ||
1083 | /* driver probing/setup */ | ||
1084 | IDE_DBG_PROBE = (1 << 4), | ||
1085 | }; | ||
1086 | |||
1087 | /* DRV_NAME has to be defined in the driver before using the macro below */ | ||
1088 | #define __ide_debug_log(lvl, fmt, args...) \ | ||
1089 | { \ | ||
1090 | if (unlikely(drive->debug_mask & lvl)) \ | ||
1091 | printk(KERN_INFO DRV_NAME ": " fmt, ## args); \ | ||
1092 | } | ||
1093 | |||
838 | /* | 1094 | /* |
839 | * Power Management step value (rq->pm->pm_step). | 1095 | * Power Management state machine (rq->pm->pm_step). |
840 | * | ||
841 | * The step value starts at 0 (ide_pm_state_start_suspend) for a | ||
842 | * suspend operation or 1000 (ide_pm_state_start_resume) for a | ||
843 | * resume operation. | ||
844 | * | 1096 | * |
845 | * For each step, the core calls the subdriver start_power_step() first. | 1097 | * For each step, the core calls ide_start_power_step() first. |
846 | * This can return: | 1098 | * This can return: |
847 | * - ide_stopped : In this case, the core calls us back again unless | 1099 | * - ide_stopped : In this case, the core calls us back again unless |
848 | * step have been set to ide_power_state_completed. | 1100 | * step have been set to ide_power_state_completed. |
849 | * - ide_started : In this case, the channel is left busy until an | 1101 | * - ide_started : In this case, the channel is left busy until an |
850 | * async event (interrupt) occurs. | 1102 | * async event (interrupt) occurs. |
851 | * Typically, start_power_step() will issue a taskfile request with | 1103 | * Typically, ide_start_power_step() will issue a taskfile request with |
852 | * do_rw_taskfile(). | 1104 | * do_rw_taskfile(). |
853 | * | 1105 | * |
854 | * Upon reception of the interrupt, the core will call complete_power_step() | 1106 | * Upon reception of the interrupt, the core will call ide_complete_power_step() |
855 | * with the error code if any. This routine should update the step value | 1107 | * with the error code if any. This routine should update the step value |
856 | * and return. It should not start a new request. The core will call | 1108 | * and return. It should not start a new request. The core will call |
857 | * start_power_step for the new step value, unless step have been set to | 1109 | * ide_start_power_step() for the new step value, unless step have been |
858 | * ide_power_state_completed. | 1110 | * set to IDE_PM_COMPLETED. |
859 | * | ||
860 | * Subdrivers are expected to define their own additional power | ||
861 | * steps from 1..999 for suspend and from 1001..1999 for resume, | ||
862 | * other values are reserved for future use. | ||
863 | */ | 1111 | */ |
864 | |||
865 | enum { | 1112 | enum { |
866 | ide_pm_state_completed = -1, | 1113 | IDE_PM_START_SUSPEND, |
867 | ide_pm_state_start_suspend = 0, | 1114 | IDE_PM_FLUSH_CACHE = IDE_PM_START_SUSPEND, |
868 | ide_pm_state_start_resume = 1000, | 1115 | IDE_PM_STANDBY, |
1116 | |||
1117 | IDE_PM_START_RESUME, | ||
1118 | IDE_PM_RESTORE_PIO = IDE_PM_START_RESUME, | ||
1119 | IDE_PM_IDLE, | ||
1120 | IDE_PM_RESTORE_DMA, | ||
1121 | |||
1122 | IDE_PM_COMPLETED, | ||
869 | }; | 1123 | }; |
870 | 1124 | ||
871 | /* | 1125 | /* |
@@ -876,8 +1130,6 @@ enum { | |||
876 | */ | 1130 | */ |
877 | struct ide_driver_s { | 1131 | struct ide_driver_s { |
878 | const char *version; | 1132 | const char *version; |
879 | u8 media; | ||
880 | unsigned supports_dsc_overlap : 1; | ||
881 | ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); | 1133 | ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); |
882 | int (*end_request)(ide_drive_t *, int, int); | 1134 | int (*end_request)(ide_drive_t *, int, int); |
883 | ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); | 1135 | ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); |
@@ -887,7 +1139,8 @@ struct ide_driver_s { | |||
887 | void (*resume)(ide_drive_t *); | 1139 | void (*resume)(ide_drive_t *); |
888 | void (*shutdown)(ide_drive_t *); | 1140 | void (*shutdown)(ide_drive_t *); |
889 | #ifdef CONFIG_IDE_PROC_FS | 1141 | #ifdef CONFIG_IDE_PROC_FS |
890 | ide_proc_entry_t *proc; | 1142 | ide_proc_entry_t * (*proc_entries)(ide_drive_t *); |
1143 | const struct ide_proc_devset * (*proc_devsets)(ide_drive_t *); | ||
891 | #endif | 1144 | #endif |
892 | }; | 1145 | }; |
893 | 1146 | ||
@@ -896,7 +1149,16 @@ struct ide_driver_s { | |||
896 | int ide_device_get(ide_drive_t *); | 1149 | int ide_device_get(ide_drive_t *); |
897 | void ide_device_put(ide_drive_t *); | 1150 | void ide_device_put(ide_drive_t *); |
898 | 1151 | ||
899 | int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); | 1152 | struct ide_ioctl_devset { |
1153 | unsigned int get_ioctl; | ||
1154 | unsigned int set_ioctl; | ||
1155 | const struct ide_devset *setting; | ||
1156 | }; | ||
1157 | |||
1158 | int ide_setting_ioctl(ide_drive_t *, struct block_device *, unsigned int, | ||
1159 | unsigned long, const struct ide_ioctl_devset *); | ||
1160 | |||
1161 | int generic_ide_ioctl(ide_drive_t *, struct block_device *, unsigned, unsigned long); | ||
900 | 1162 | ||
901 | extern int ide_vlb_clk; | 1163 | extern int ide_vlb_clk; |
902 | extern int ide_pci_clk; | 1164 | extern int ide_pci_clk; |
@@ -918,122 +1180,23 @@ ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); | |||
918 | 1180 | ||
919 | ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); | 1181 | ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); |
920 | 1182 | ||
921 | extern void ide_fix_driveid(struct hd_driveid *); | 1183 | void ide_fix_driveid(u16 *); |
922 | 1184 | ||
923 | extern void ide_fixstring(u8 *, const int, const int); | 1185 | extern void ide_fixstring(u8 *, const int, const int); |
924 | 1186 | ||
1187 | int ide_busy_sleep(ide_hwif_t *, unsigned long, int); | ||
1188 | |||
925 | int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); | 1189 | int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); |
926 | 1190 | ||
927 | extern ide_startstop_t ide_do_reset (ide_drive_t *); | 1191 | extern ide_startstop_t ide_do_reset (ide_drive_t *); |
928 | 1192 | ||
1193 | extern int ide_devset_execute(ide_drive_t *drive, | ||
1194 | const struct ide_devset *setting, int arg); | ||
1195 | |||
929 | extern void ide_do_drive_cmd(ide_drive_t *, struct request *); | 1196 | extern void ide_do_drive_cmd(ide_drive_t *, struct request *); |
930 | 1197 | ||
931 | extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); | 1198 | extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); |
932 | 1199 | ||
933 | enum { | ||
934 | IDE_TFLAG_LBA48 = (1 << 0), | ||
935 | IDE_TFLAG_FLAGGED = (1 << 2), | ||
936 | IDE_TFLAG_OUT_DATA = (1 << 3), | ||
937 | IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4), | ||
938 | IDE_TFLAG_OUT_HOB_NSECT = (1 << 5), | ||
939 | IDE_TFLAG_OUT_HOB_LBAL = (1 << 6), | ||
940 | IDE_TFLAG_OUT_HOB_LBAM = (1 << 7), | ||
941 | IDE_TFLAG_OUT_HOB_LBAH = (1 << 8), | ||
942 | IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE | | ||
943 | IDE_TFLAG_OUT_HOB_NSECT | | ||
944 | IDE_TFLAG_OUT_HOB_LBAL | | ||
945 | IDE_TFLAG_OUT_HOB_LBAM | | ||
946 | IDE_TFLAG_OUT_HOB_LBAH, | ||
947 | IDE_TFLAG_OUT_FEATURE = (1 << 9), | ||
948 | IDE_TFLAG_OUT_NSECT = (1 << 10), | ||
949 | IDE_TFLAG_OUT_LBAL = (1 << 11), | ||
950 | IDE_TFLAG_OUT_LBAM = (1 << 12), | ||
951 | IDE_TFLAG_OUT_LBAH = (1 << 13), | ||
952 | IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE | | ||
953 | IDE_TFLAG_OUT_NSECT | | ||
954 | IDE_TFLAG_OUT_LBAL | | ||
955 | IDE_TFLAG_OUT_LBAM | | ||
956 | IDE_TFLAG_OUT_LBAH, | ||
957 | IDE_TFLAG_OUT_DEVICE = (1 << 14), | ||
958 | IDE_TFLAG_WRITE = (1 << 15), | ||
959 | IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16), | ||
960 | IDE_TFLAG_IN_DATA = (1 << 17), | ||
961 | IDE_TFLAG_CUSTOM_HANDLER = (1 << 18), | ||
962 | IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19), | ||
963 | IDE_TFLAG_IN_HOB_FEATURE = (1 << 20), | ||
964 | IDE_TFLAG_IN_HOB_NSECT = (1 << 21), | ||
965 | IDE_TFLAG_IN_HOB_LBAL = (1 << 22), | ||
966 | IDE_TFLAG_IN_HOB_LBAM = (1 << 23), | ||
967 | IDE_TFLAG_IN_HOB_LBAH = (1 << 24), | ||
968 | IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL | | ||
969 | IDE_TFLAG_IN_HOB_LBAM | | ||
970 | IDE_TFLAG_IN_HOB_LBAH, | ||
971 | IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE | | ||
972 | IDE_TFLAG_IN_HOB_NSECT | | ||
973 | IDE_TFLAG_IN_HOB_LBA, | ||
974 | IDE_TFLAG_IN_FEATURE = (1 << 1), | ||
975 | IDE_TFLAG_IN_NSECT = (1 << 25), | ||
976 | IDE_TFLAG_IN_LBAL = (1 << 26), | ||
977 | IDE_TFLAG_IN_LBAM = (1 << 27), | ||
978 | IDE_TFLAG_IN_LBAH = (1 << 28), | ||
979 | IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL | | ||
980 | IDE_TFLAG_IN_LBAM | | ||
981 | IDE_TFLAG_IN_LBAH, | ||
982 | IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT | | ||
983 | IDE_TFLAG_IN_LBA, | ||
984 | IDE_TFLAG_IN_DEVICE = (1 << 29), | ||
985 | IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB | | ||
986 | IDE_TFLAG_IN_HOB, | ||
987 | IDE_TFLAG_TF = IDE_TFLAG_OUT_TF | | ||
988 | IDE_TFLAG_IN_TF, | ||
989 | IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE | | ||
990 | IDE_TFLAG_IN_DEVICE, | ||
991 | /* force 16-bit I/O operations */ | ||
992 | IDE_TFLAG_IO_16BIT = (1 << 30), | ||
993 | /* ide_task_t was allocated using kmalloc() */ | ||
994 | IDE_TFLAG_DYN = (1 << 31), | ||
995 | }; | ||
996 | |||
997 | struct ide_taskfile { | ||
998 | u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */ | ||
999 | |||
1000 | u8 hob_feature; /* 1-5: additional data to support LBA48 */ | ||
1001 | u8 hob_nsect; | ||
1002 | u8 hob_lbal; | ||
1003 | u8 hob_lbam; | ||
1004 | u8 hob_lbah; | ||
1005 | |||
1006 | u8 data; /* 6: low data byte (for TASKFILE IOCTL) */ | ||
1007 | |||
1008 | union { /* Â 7: */ | ||
1009 | u8 error; /* read: error */ | ||
1010 | u8 feature; /* write: feature */ | ||
1011 | }; | ||
1012 | |||
1013 | u8 nsect; /* 8: number of sectors */ | ||
1014 | u8 lbal; /* 9: LBA low */ | ||
1015 | u8 lbam; /* 10: LBA mid */ | ||
1016 | u8 lbah; /* 11: LBA high */ | ||
1017 | |||
1018 | u8 device; /* 12: device select */ | ||
1019 | |||
1020 | union { /* 13: */ | ||
1021 | u8 status; /*  read: status  */ | ||
1022 | u8 command; /* write: command */ | ||
1023 | }; | ||
1024 | }; | ||
1025 | |||
1026 | typedef struct ide_task_s { | ||
1027 | union { | ||
1028 | struct ide_taskfile tf; | ||
1029 | u8 tf_array[14]; | ||
1030 | }; | ||
1031 | u32 tf_flags; | ||
1032 | int data_phase; | ||
1033 | struct request *rq; /* copy of request */ | ||
1034 | void *special; /* valid_t generally */ | ||
1035 | } ide_task_t; | ||
1036 | |||
1037 | void ide_tf_dump(const char *, struct ide_taskfile *); | 1200 | void ide_tf_dump(const char *, struct ide_taskfile *); |
1038 | 1201 | ||
1039 | void ide_exec_command(ide_hwif_t *, u8); | 1202 | void ide_exec_command(ide_hwif_t *, u8); |
@@ -1049,6 +1212,8 @@ void ide_tf_read(ide_drive_t *, ide_task_t *); | |||
1049 | void ide_input_data(ide_drive_t *, struct request *, void *, unsigned int); | 1212 | void ide_input_data(ide_drive_t *, struct request *, void *, unsigned int); |
1050 | void ide_output_data(ide_drive_t *, struct request *, void *, unsigned int); | 1213 | void ide_output_data(ide_drive_t *, struct request *, void *, unsigned int); |
1051 | 1214 | ||
1215 | int ide_io_buffers(ide_drive_t *, struct ide_atapi_pc *, unsigned int, int); | ||
1216 | |||
1052 | extern void SELECT_DRIVE(ide_drive_t *); | 1217 | extern void SELECT_DRIVE(ide_drive_t *); |
1053 | void SELECT_MASK(ide_drive_t *, int); | 1218 | void SELECT_MASK(ide_drive_t *, int); |
1054 | 1219 | ||
@@ -1059,16 +1224,46 @@ extern int drive_is_ready(ide_drive_t *); | |||
1059 | 1224 | ||
1060 | void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); | 1225 | void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); |
1061 | 1226 | ||
1062 | ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, | 1227 | int ide_check_atapi_device(ide_drive_t *, const char *); |
1063 | ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry, | 1228 | |
1064 | void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *), | 1229 | void ide_init_pc(struct ide_atapi_pc *); |
1065 | void (*retry_pc)(ide_drive_t *), void (*dsc_handle)(ide_drive_t *), | 1230 | |
1066 | void (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned int, | 1231 | /* Disk head parking */ |
1067 | int)); | 1232 | extern wait_queue_head_t ide_park_wq; |
1068 | ide_startstop_t ide_transfer_pc(ide_drive_t *, struct ide_atapi_pc *, | 1233 | ssize_t ide_park_show(struct device *dev, struct device_attribute *attr, |
1069 | ide_handler_t *, unsigned int, ide_expiry_t *); | 1234 | char *buf); |
1070 | ide_startstop_t ide_issue_pc(ide_drive_t *, struct ide_atapi_pc *, | 1235 | ssize_t ide_park_store(struct device *dev, struct device_attribute *attr, |
1071 | ide_handler_t *, unsigned int, ide_expiry_t *); | 1236 | const char *buf, size_t len); |
1237 | |||
1238 | /* | ||
1239 | * Special requests for ide-tape block device strategy routine. | ||
1240 | * | ||
1241 | * In order to service a character device command, we add special requests to | ||
1242 | * the tail of our block device request queue and wait for their completion. | ||
1243 | */ | ||
1244 | enum { | ||
1245 | REQ_IDETAPE_PC1 = (1 << 0), /* packet command (first stage) */ | ||
1246 | REQ_IDETAPE_PC2 = (1 << 1), /* packet command (second stage) */ | ||
1247 | REQ_IDETAPE_READ = (1 << 2), | ||
1248 | REQ_IDETAPE_WRITE = (1 << 3), | ||
1249 | }; | ||
1250 | |||
1251 | int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *); | ||
1252 | |||
1253 | int ide_do_test_unit_ready(ide_drive_t *, struct gendisk *); | ||
1254 | int ide_do_start_stop(ide_drive_t *, struct gendisk *, int); | ||
1255 | int ide_set_media_lock(ide_drive_t *, struct gendisk *, int); | ||
1256 | void ide_create_request_sense_cmd(ide_drive_t *, struct ide_atapi_pc *); | ||
1257 | void ide_retry_pc(ide_drive_t *, struct gendisk *); | ||
1258 | |||
1259 | static inline unsigned long ide_scsi_get_timeout(struct ide_atapi_pc *pc) | ||
1260 | { | ||
1261 | return max_t(unsigned long, WAIT_CMD, pc->timeout - jiffies); | ||
1262 | } | ||
1263 | |||
1264 | int ide_scsi_expiry(ide_drive_t *); | ||
1265 | |||
1266 | ide_startstop_t ide_issue_pc(ide_drive_t *, unsigned int, ide_expiry_t *); | ||
1072 | 1267 | ||
1073 | ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); | 1268 | ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); |
1074 | 1269 | ||
@@ -1078,8 +1273,6 @@ int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16); | |||
1078 | int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); | 1273 | int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); |
1079 | 1274 | ||
1080 | int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); | 1275 | int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); |
1081 | int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long); | ||
1082 | int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long); | ||
1083 | 1276 | ||
1084 | extern int ide_driveid_update(ide_drive_t *); | 1277 | extern int ide_driveid_update(ide_drive_t *); |
1085 | extern int ide_config_drive_speed(ide_drive_t *, u8); | 1278 | extern int ide_config_drive_speed(ide_drive_t *, u8); |
@@ -1090,7 +1283,6 @@ extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout); | |||
1090 | 1283 | ||
1091 | extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); | 1284 | extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); |
1092 | 1285 | ||
1093 | extern int ide_spin_wait_hwgroup(ide_drive_t *); | ||
1094 | extern void ide_timer_expiry(unsigned long); | 1286 | extern void ide_timer_expiry(unsigned long); |
1095 | extern irqreturn_t ide_intr(int irq, void *dev_id); | 1287 | extern irqreturn_t ide_intr(int irq, void *dev_id); |
1096 | extern void do_ide_request(struct request_queue *); | 1288 | extern void do_ide_request(struct request_queue *); |
@@ -1227,6 +1419,14 @@ int ide_pci_init_two(struct pci_dev *, struct pci_dev *, | |||
1227 | const struct ide_port_info *, void *); | 1419 | const struct ide_port_info *, void *); |
1228 | void ide_pci_remove(struct pci_dev *); | 1420 | void ide_pci_remove(struct pci_dev *); |
1229 | 1421 | ||
1422 | #ifdef CONFIG_PM | ||
1423 | int ide_pci_suspend(struct pci_dev *, pm_message_t); | ||
1424 | int ide_pci_resume(struct pci_dev *); | ||
1425 | #else | ||
1426 | #define ide_pci_suspend NULL | ||
1427 | #define ide_pci_resume NULL | ||
1428 | #endif | ||
1429 | |||
1230 | void ide_map_sg(ide_drive_t *, struct request *); | 1430 | void ide_map_sg(ide_drive_t *, struct request *); |
1231 | void ide_init_sg_cmd(ide_drive_t *, struct request *); | 1431 | void ide_init_sg_cmd(ide_drive_t *, struct request *); |
1232 | 1432 | ||
@@ -1238,9 +1438,10 @@ struct drive_list_entry { | |||
1238 | const char *id_firmware; | 1438 | const char *id_firmware; |
1239 | }; | 1439 | }; |
1240 | 1440 | ||
1241 | int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *); | 1441 | int ide_in_drive_list(u16 *, const struct drive_list_entry *); |
1242 | 1442 | ||
1243 | #ifdef CONFIG_BLK_DEV_IDEDMA | 1443 | #ifdef CONFIG_BLK_DEV_IDEDMA |
1444 | int ide_dma_good_drive(ide_drive_t *); | ||
1244 | int __ide_dma_bad_drive(ide_drive_t *); | 1445 | int __ide_dma_bad_drive(ide_drive_t *); |
1245 | int ide_id_dma_bug(ide_drive_t *); | 1446 | int ide_id_dma_bug(ide_drive_t *); |
1246 | 1447 | ||
@@ -1258,25 +1459,29 @@ int ide_set_dma(ide_drive_t *); | |||
1258 | void ide_check_dma_crc(ide_drive_t *); | 1459 | void ide_check_dma_crc(ide_drive_t *); |
1259 | ide_startstop_t ide_dma_intr(ide_drive_t *); | 1460 | ide_startstop_t ide_dma_intr(ide_drive_t *); |
1260 | 1461 | ||
1462 | int ide_allocate_dma_engine(ide_hwif_t *); | ||
1463 | void ide_release_dma_engine(ide_hwif_t *); | ||
1464 | |||
1261 | int ide_build_sglist(ide_drive_t *, struct request *); | 1465 | int ide_build_sglist(ide_drive_t *, struct request *); |
1262 | void ide_destroy_dmatable(ide_drive_t *); | 1466 | void ide_destroy_dmatable(ide_drive_t *); |
1263 | 1467 | ||
1264 | #ifdef CONFIG_BLK_DEV_IDEDMA_SFF | 1468 | #ifdef CONFIG_BLK_DEV_IDEDMA_SFF |
1469 | int config_drive_for_dma(ide_drive_t *); | ||
1265 | extern int ide_build_dmatable(ide_drive_t *, struct request *); | 1470 | extern int ide_build_dmatable(ide_drive_t *, struct request *); |
1266 | int ide_allocate_dma_engine(ide_hwif_t *); | ||
1267 | void ide_release_dma_engine(ide_hwif_t *); | ||
1268 | |||
1269 | void ide_dma_host_set(ide_drive_t *, int); | 1471 | void ide_dma_host_set(ide_drive_t *, int); |
1270 | extern int ide_dma_setup(ide_drive_t *); | 1472 | extern int ide_dma_setup(ide_drive_t *); |
1271 | void ide_dma_exec_cmd(ide_drive_t *, u8); | 1473 | void ide_dma_exec_cmd(ide_drive_t *, u8); |
1272 | extern void ide_dma_start(ide_drive_t *); | 1474 | extern void ide_dma_start(ide_drive_t *); |
1273 | extern int __ide_dma_end(ide_drive_t *); | 1475 | int ide_dma_end(ide_drive_t *); |
1274 | int ide_dma_test_irq(ide_drive_t *); | 1476 | int ide_dma_test_irq(ide_drive_t *); |
1275 | extern void ide_dma_lost_irq(ide_drive_t *); | ||
1276 | extern void ide_dma_timeout(ide_drive_t *); | ||
1277 | extern const struct ide_dma_ops sff_dma_ops; | 1477 | extern const struct ide_dma_ops sff_dma_ops; |
1478 | #else | ||
1479 | static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; } | ||
1278 | #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ | 1480 | #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ |
1279 | 1481 | ||
1482 | void ide_dma_lost_irq(ide_drive_t *); | ||
1483 | void ide_dma_timeout(ide_drive_t *); | ||
1484 | |||
1280 | #else | 1485 | #else |
1281 | static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; } | 1486 | static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; } |
1282 | static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; } | 1487 | static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; } |
@@ -1287,11 +1492,8 @@ static inline void ide_dma_on(ide_drive_t *drive) { ; } | |||
1287 | static inline void ide_dma_verbose(ide_drive_t *drive) { ; } | 1492 | static inline void ide_dma_verbose(ide_drive_t *drive) { ; } |
1288 | static inline int ide_set_dma(ide_drive_t *drive) { return 1; } | 1493 | static inline int ide_set_dma(ide_drive_t *drive) { return 1; } |
1289 | static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } | 1494 | static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } |
1290 | #endif /* CONFIG_BLK_DEV_IDEDMA */ | ||
1291 | |||
1292 | #ifndef CONFIG_BLK_DEV_IDEDMA_SFF | ||
1293 | static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } | 1495 | static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } |
1294 | #endif | 1496 | #endif /* CONFIG_BLK_DEV_IDEDMA */ |
1295 | 1497 | ||
1296 | #ifdef CONFIG_BLK_DEV_IDEACPI | 1498 | #ifdef CONFIG_BLK_DEV_IDEACPI |
1297 | extern int ide_acpi_exec_tfs(ide_drive_t *drive); | 1499 | extern int ide_acpi_exec_tfs(ide_drive_t *drive); |
@@ -1319,7 +1521,6 @@ void ide_undecoded_slave(ide_drive_t *); | |||
1319 | 1521 | ||
1320 | void ide_port_apply_params(ide_hwif_t *); | 1522 | void ide_port_apply_params(ide_hwif_t *); |
1321 | 1523 | ||
1322 | struct ide_host *ide_host_alloc_all(const struct ide_port_info *, hw_regs_t **); | ||
1323 | struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **); | 1524 | struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **); |
1324 | void ide_host_free(struct ide_host *); | 1525 | void ide_host_free(struct ide_host *); |
1325 | int ide_host_register(struct ide_host *, const struct ide_port_info *, | 1526 | int ide_host_register(struct ide_host *, const struct ide_port_info *, |
@@ -1345,24 +1546,6 @@ const char *ide_xfer_verbose(u8 mode); | |||
1345 | extern void ide_toggle_bounce(ide_drive_t *drive, int on); | 1546 | extern void ide_toggle_bounce(ide_drive_t *drive, int on); |
1346 | extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); | 1547 | extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); |
1347 | 1548 | ||
1348 | static inline int ide_dev_has_iordy(struct hd_driveid *id) | ||
1349 | { | ||
1350 | return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0; | ||
1351 | } | ||
1352 | |||
1353 | static inline int ide_dev_is_sata(struct hd_driveid *id) | ||
1354 | { | ||
1355 | /* | ||
1356 | * See if word 93 is 0 AND drive is at least ATA-5 compatible | ||
1357 | * verifying that word 80 by casting it to a signed type -- | ||
1358 | * this trick allows us to filter out the reserved values of | ||
1359 | * 0x0000 and 0xffff along with the earlier ATA revisions... | ||
1360 | */ | ||
1361 | if (id->hw_config == 0 && (short)id->major_rev_num >= 0x0020) | ||
1362 | return 1; | ||
1363 | return 0; | ||
1364 | } | ||
1365 | |||
1366 | u64 ide_get_lba_addr(struct ide_taskfile *, int); | 1549 | u64 ide_get_lba_addr(struct ide_taskfile *, int); |
1367 | u8 ide_dump_status(ide_drive_t *, const char *, u8); | 1550 | u8 ide_dump_status(ide_drive_t *, const char *, u8); |
1368 | 1551 | ||
@@ -1434,13 +1617,6 @@ extern struct mutex ide_cfg_mtx; | |||
1434 | extern struct bus_type ide_bus_type; | 1617 | extern struct bus_type ide_bus_type; |
1435 | extern struct class *ide_port_class; | 1618 | extern struct class *ide_port_class; |
1436 | 1619 | ||
1437 | /* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */ | ||
1438 | #define ide_id_has_flush_cache(id) ((id)->cfs_enable_2 & 0x3000) | ||
1439 | |||
1440 | /* some Maxtor disks have bit 13 defined incorrectly so check bit 10 too */ | ||
1441 | #define ide_id_has_flush_cache_ext(id) \ | ||
1442 | (((id)->cfs_enable_2 & 0x2400) == 0x2400) | ||
1443 | |||
1444 | static inline void ide_dump_identify(u8 *id) | 1620 | static inline void ide_dump_identify(u8 *id) |
1445 | { | 1621 | { |
1446 | print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 2, id, 512, 0); | 1622 | print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 2, id, 512, 0); |
@@ -1451,10 +1627,10 @@ static inline int hwif_to_node(ide_hwif_t *hwif) | |||
1451 | return hwif->dev ? dev_to_node(hwif->dev) : -1; | 1627 | return hwif->dev ? dev_to_node(hwif->dev) : -1; |
1452 | } | 1628 | } |
1453 | 1629 | ||
1454 | static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive) | 1630 | static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive) |
1455 | { | 1631 | { |
1456 | ide_hwif_t *hwif = HWIF(drive); | 1632 | ide_drive_t *peer = &drive->hwif->drives[(drive->dn ^ 1) & 1]; |
1457 | 1633 | ||
1458 | return &hwif->drives[(drive->dn ^ 1) & 1]; | 1634 | return (peer->dev_flags & IDE_DFLAG_PRESENT) ? peer : NULL; |
1459 | } | 1635 | } |
1460 | #endif /* _IDE_H */ | 1636 | #endif /* _IDE_H */ |
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 7f4df7c7659d..14126bc36641 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
@@ -471,6 +471,11 @@ struct ieee80211s_hdr { | |||
471 | u8 eaddr3[6]; | 471 | u8 eaddr3[6]; |
472 | } __attribute__ ((packed)); | 472 | } __attribute__ ((packed)); |
473 | 473 | ||
474 | /* Mesh flags */ | ||
475 | #define MESH_FLAGS_AE_A4 0x1 | ||
476 | #define MESH_FLAGS_AE_A5_A6 0x2 | ||
477 | #define MESH_FLAGS_PS_DEEP 0x4 | ||
478 | |||
474 | /** | 479 | /** |
475 | * struct ieee80211_quiet_ie | 480 | * struct ieee80211_quiet_ie |
476 | * | 481 | * |
@@ -643,6 +648,9 @@ struct ieee80211_mgmt { | |||
643 | } u; | 648 | } u; |
644 | } __attribute__ ((packed)); | 649 | } __attribute__ ((packed)); |
645 | 650 | ||
651 | /* mgmt header + 1 byte category code */ | ||
652 | #define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u) | ||
653 | |||
646 | 654 | ||
647 | /* Control frames */ | 655 | /* Control frames */ |
648 | struct ieee80211_rts { | 656 | struct ieee80211_rts { |
@@ -708,12 +716,13 @@ struct ieee80211_ht_addt_info { | |||
708 | 716 | ||
709 | /* 802.11n HT capabilities masks */ | 717 | /* 802.11n HT capabilities masks */ |
710 | #define IEEE80211_HT_CAP_SUP_WIDTH 0x0002 | 718 | #define IEEE80211_HT_CAP_SUP_WIDTH 0x0002 |
711 | #define IEEE80211_HT_CAP_MIMO_PS 0x000C | 719 | #define IEEE80211_HT_CAP_SM_PS 0x000C |
712 | #define IEEE80211_HT_CAP_GRN_FLD 0x0010 | 720 | #define IEEE80211_HT_CAP_GRN_FLD 0x0010 |
713 | #define IEEE80211_HT_CAP_SGI_20 0x0020 | 721 | #define IEEE80211_HT_CAP_SGI_20 0x0020 |
714 | #define IEEE80211_HT_CAP_SGI_40 0x0040 | 722 | #define IEEE80211_HT_CAP_SGI_40 0x0040 |
715 | #define IEEE80211_HT_CAP_DELAY_BA 0x0400 | 723 | #define IEEE80211_HT_CAP_DELAY_BA 0x0400 |
716 | #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 | 724 | #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 |
725 | #define IEEE80211_HT_CAP_DSSSCCK40 0x1000 | ||
717 | /* 802.11n HT capability AMPDU settings */ | 726 | /* 802.11n HT capability AMPDU settings */ |
718 | #define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03 | 727 | #define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03 |
719 | #define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C | 728 | #define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C |
@@ -736,11 +745,26 @@ struct ieee80211_ht_addt_info { | |||
736 | #define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 | 745 | #define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 |
737 | #define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010 | 746 | #define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010 |
738 | 747 | ||
739 | /* MIMO Power Save Modes */ | 748 | /* block-ack parameters */ |
740 | #define WLAN_HT_CAP_MIMO_PS_STATIC 0 | 749 | #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 |
741 | #define WLAN_HT_CAP_MIMO_PS_DYNAMIC 1 | 750 | #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C |
742 | #define WLAN_HT_CAP_MIMO_PS_INVALID 2 | 751 | #define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0 |
743 | #define WLAN_HT_CAP_MIMO_PS_DISABLED 3 | 752 | #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000 |
753 | #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800 | ||
754 | |||
755 | /* | ||
756 | * A-PMDU buffer sizes | ||
757 | * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2) | ||
758 | */ | ||
759 | #define IEEE80211_MIN_AMPDU_BUF 0x8 | ||
760 | #define IEEE80211_MAX_AMPDU_BUF 0x40 | ||
761 | |||
762 | |||
763 | /* Spatial Multiplexing Power Save Modes */ | ||
764 | #define WLAN_HT_CAP_SM_PS_STATIC 0 | ||
765 | #define WLAN_HT_CAP_SM_PS_DYNAMIC 1 | ||
766 | #define WLAN_HT_CAP_SM_PS_INVALID 2 | ||
767 | #define WLAN_HT_CAP_SM_PS_DISABLED 3 | ||
744 | 768 | ||
745 | /* Authentication algorithms */ | 769 | /* Authentication algorithms */ |
746 | #define WLAN_AUTH_OPEN 0 | 770 | #define WLAN_AUTH_OPEN 0 |
diff --git a/include/linux/if.h b/include/linux/if.h index 5c9d1fa93fef..65246846c844 100644 --- a/include/linux/if.h +++ b/include/linux/if.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/compiler.h> /* for "__user" et al */ | 24 | #include <linux/compiler.h> /* for "__user" et al */ |
25 | 25 | ||
26 | #define IFNAMSIZ 16 | 26 | #define IFNAMSIZ 16 |
27 | #define IFALIASZ 256 | ||
27 | #include <linux/hdlc/ioctl.h> | 28 | #include <linux/hdlc/ioctl.h> |
28 | 29 | ||
29 | /* Standard interface flags (netdevice->flags). */ | 30 | /* Standard interface flags (netdevice->flags). */ |
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index e157c1399b61..7f3c735f422b 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h | |||
@@ -9,7 +9,7 @@ | |||
9 | * | 9 | * |
10 | * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | 10 | * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
11 | * Donald Becker, <becker@super.org> | 11 | * Donald Becker, <becker@super.org> |
12 | * Alan Cox, <alan@redhat.com> | 12 | * Alan Cox, <alan@lxorguk.ukuu.org.uk> |
13 | * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> | 13 | * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> |
14 | * | 14 | * |
15 | * This program is free software; you can redistribute it and/or | 15 | * This program is free software; you can redistribute it and/or |
@@ -56,6 +56,7 @@ | |||
56 | #define ETH_P_DIAG 0x6005 /* DEC Diagnostics */ | 56 | #define ETH_P_DIAG 0x6005 /* DEC Diagnostics */ |
57 | #define ETH_P_CUST 0x6006 /* DEC Customer use */ | 57 | #define ETH_P_CUST 0x6006 /* DEC Customer use */ |
58 | #define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */ | 58 | #define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */ |
59 | #define ETH_P_TEB 0x6558 /* Trans Ether Bridging */ | ||
59 | #define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */ | 60 | #define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */ |
60 | #define ETH_P_ATALK 0x809B /* Appletalk DDP */ | 61 | #define ETH_P_ATALK 0x809B /* Appletalk DDP */ |
61 | #define ETH_P_AARP 0x80F3 /* Appletalk AARP */ | 62 | #define ETH_P_AARP 0x80F3 /* Appletalk AARP */ |
@@ -74,8 +75,10 @@ | |||
74 | #define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport | 75 | #define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport |
75 | * over Ethernet | 76 | * over Ethernet |
76 | */ | 77 | */ |
78 | #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ | ||
77 | #define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ | 79 | #define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ |
78 | #define ETH_P_TIPC 0x88CA /* TIPC */ | 80 | #define ETH_P_TIPC 0x88CA /* TIPC */ |
81 | #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ | ||
79 | 82 | ||
80 | /* | 83 | /* |
81 | * Non DIX types. Won't clash for 1500 types. | 84 | * Non DIX types. Won't clash for 1500 types. |
@@ -99,6 +102,9 @@ | |||
99 | #define ETH_P_ECONET 0x0018 /* Acorn Econet */ | 102 | #define ETH_P_ECONET 0x0018 /* Acorn Econet */ |
100 | #define ETH_P_HDLC 0x0019 /* HDLC frames */ | 103 | #define ETH_P_HDLC 0x0019 /* HDLC frames */ |
101 | #define ETH_P_ARCNET 0x001A /* 1A for ArcNet :-) */ | 104 | #define ETH_P_ARCNET 0x001A /* 1A for ArcNet :-) */ |
105 | #define ETH_P_DSA 0x001B /* Distributed Switch Arch. */ | ||
106 | #define ETH_P_TRAILER 0x001C /* Trailer switch tagging */ | ||
107 | #define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */ | ||
102 | 108 | ||
103 | /* | 109 | /* |
104 | * This is an Ethernet frame header. | 110 | * This is an Ethernet frame header. |
diff --git a/include/linux/if_fddi.h b/include/linux/if_fddi.h index ae77daed6c2f..45de1046dbbf 100644 --- a/include/linux/if_fddi.h +++ b/include/linux/if_fddi.h | |||
@@ -12,7 +12,7 @@ | |||
12 | * if_fddi.h is based on previous if_ether.h and if_tr.h work by | 12 | * if_fddi.h is based on previous if_ether.h and if_tr.h work by |
13 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | 13 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
14 | * Donald Becker, <becker@super.org> | 14 | * Donald Becker, <becker@super.org> |
15 | * Alan Cox, <alan@redhat.com> | 15 | * Alan Cox, <alan@lxorguk.ukuu.org.uk> |
16 | * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> | 16 | * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> |
17 | * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be> | 17 | * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be> |
18 | * | 18 | * |
diff --git a/include/linux/if_hippi.h b/include/linux/if_hippi.h index 94d31ca7d71a..f0f23516bb59 100644 --- a/include/linux/if_hippi.h +++ b/include/linux/if_hippi.h | |||
@@ -9,7 +9,7 @@ | |||
9 | * | 9 | * |
10 | * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | 10 | * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
11 | * Donald Becker, <becker@super.org> | 11 | * Donald Becker, <becker@super.org> |
12 | * Alan Cox, <alan@redhat.com> | 12 | * Alan Cox, <alan@lxorguk.ukuu.org.uk> |
13 | * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> | 13 | * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> |
14 | * Jes Sorensen, <Jes.Sorensen@cern.ch> | 14 | * Jes Sorensen, <Jes.Sorensen@cern.ch> |
15 | * | 15 | * |
diff --git a/include/linux/if_link.h b/include/linux/if_link.h index 84c3492ae5cb..f9032c88716a 100644 --- a/include/linux/if_link.h +++ b/include/linux/if_link.h | |||
@@ -79,6 +79,7 @@ enum | |||
79 | IFLA_LINKINFO, | 79 | IFLA_LINKINFO, |
80 | #define IFLA_LINKINFO IFLA_LINKINFO | 80 | #define IFLA_LINKINFO IFLA_LINKINFO |
81 | IFLA_NET_NS_PID, | 81 | IFLA_NET_NS_PID, |
82 | IFLA_IFALIAS, | ||
82 | __IFLA_MAX | 83 | __IFLA_MAX |
83 | }; | 84 | }; |
84 | 85 | ||
diff --git a/include/linux/if_phonet.h b/include/linux/if_phonet.h new file mode 100644 index 000000000000..d70034bcec05 --- /dev/null +++ b/include/linux/if_phonet.h | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * File: if_phonet.h | ||
3 | * | ||
4 | * Phonet interface kernel definitions | ||
5 | * | ||
6 | * Copyright (C) 2008 Nokia Corporation. All rights reserved. | ||
7 | */ | ||
8 | #ifndef LINUX_IF_PHONET_H | ||
9 | #define LINUX_IF_PHONET_H | ||
10 | |||
11 | #define PHONET_MIN_MTU 6 /* pn_length = 0 */ | ||
12 | #define PHONET_MAX_MTU 65541 /* pn_length = 0xffff */ | ||
13 | #define PHONET_DEV_MTU PHONET_MAX_MTU | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | extern struct header_ops phonet_header_ops; | ||
17 | #endif | ||
18 | |||
19 | #endif | ||
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h index d4efe4014705..aeab2cb32a9c 100644 --- a/include/linux/if_tunnel.h +++ b/include/linux/if_tunnel.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _IF_TUNNEL_H_ | 2 | #define _IF_TUNNEL_H_ |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/ip.h> | ||
5 | 6 | ||
6 | #define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) | 7 | #define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) |
7 | #define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) | 8 | #define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) |
@@ -47,4 +48,22 @@ struct ip_tunnel_prl { | |||
47 | /* PRL flags */ | 48 | /* PRL flags */ |
48 | #define PRL_DEFAULT 0x0001 | 49 | #define PRL_DEFAULT 0x0001 |
49 | 50 | ||
51 | enum | ||
52 | { | ||
53 | IFLA_GRE_UNSPEC, | ||
54 | IFLA_GRE_LINK, | ||
55 | IFLA_GRE_IFLAGS, | ||
56 | IFLA_GRE_OFLAGS, | ||
57 | IFLA_GRE_IKEY, | ||
58 | IFLA_GRE_OKEY, | ||
59 | IFLA_GRE_LOCAL, | ||
60 | IFLA_GRE_REMOTE, | ||
61 | IFLA_GRE_TTL, | ||
62 | IFLA_GRE_TOS, | ||
63 | IFLA_GRE_PMTUDISC, | ||
64 | __IFLA_GRE_MAX, | ||
65 | }; | ||
66 | |||
67 | #define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1) | ||
68 | |||
50 | #endif /* _IF_TUNNEL_H_ */ | 69 | #endif /* _IF_TUNNEL_H_ */ |
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 9e7b49b8062d..a5cb0c3f6dcf 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
@@ -114,6 +114,8 @@ extern u16 vlan_dev_vlan_id(const struct net_device *dev); | |||
114 | 114 | ||
115 | extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, | 115 | extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, |
116 | u16 vlan_tci, int polling); | 116 | u16 vlan_tci, int polling); |
117 | extern int vlan_hwaccel_do_receive(struct sk_buff *skb); | ||
118 | |||
117 | #else | 119 | #else |
118 | static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev) | 120 | static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev) |
119 | { | 121 | { |
@@ -133,6 +135,11 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, | |||
133 | BUG(); | 135 | BUG(); |
134 | return NET_XMIT_SUCCESS; | 136 | return NET_XMIT_SUCCESS; |
135 | } | 137 | } |
138 | |||
139 | static inline int vlan_hwaccel_do_receive(struct sk_buff *skb) | ||
140 | { | ||
141 | return 0; | ||
142 | } | ||
136 | #endif | 143 | #endif |
137 | 144 | ||
138 | /** | 145 | /** |
diff --git a/include/linux/igmp.h b/include/linux/igmp.h index 7bb3c095c15b..f734a0ba0698 100644 --- a/include/linux/igmp.h +++ b/include/linux/igmp.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * Linux NET3: Internet Group Management Protocol [IGMP] | 2 | * Linux NET3: Internet Group Management Protocol [IGMP] |
3 | * | 3 | * |
4 | * Authors: | 4 | * Authors: |
5 | * Alan Cox <Alan.Cox@linux.org> | 5 | * Alan Cox <alan@lxorguk.ukuu.org.uk> |
6 | * | 6 | * |
7 | * Extended to talk the BSD extended IGMP protocol of mrouted 3.6 | 7 | * Extended to talk the BSD extended IGMP protocol of mrouted 3.6 |
8 | * | 8 | * |
diff --git a/include/linux/in.h b/include/linux/in.h index 4065313cd7ee..db458beef19d 100644 --- a/include/linux/in.h +++ b/include/linux/in.h | |||
@@ -75,6 +75,7 @@ struct in_addr { | |||
75 | #define IP_IPSEC_POLICY 16 | 75 | #define IP_IPSEC_POLICY 16 |
76 | #define IP_XFRM_POLICY 17 | 76 | #define IP_XFRM_POLICY 17 |
77 | #define IP_PASSSEC 18 | 77 | #define IP_PASSSEC 18 |
78 | #define IP_TRANSPARENT 19 | ||
78 | 79 | ||
79 | /* BSD compatibility */ | 80 | /* BSD compatibility */ |
80 | #define IP_RECVRETOPTS IP_RETOPTS | 81 | #define IP_RECVRETOPTS IP_RETOPTS |
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index c6f51ad52d5b..06fcdb45106b 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
@@ -25,6 +25,7 @@ struct in_device | |||
25 | struct in_ifaddr *ifa_list; /* IP ifaddr chain */ | 25 | struct in_ifaddr *ifa_list; /* IP ifaddr chain */ |
26 | rwlock_t mc_list_lock; | 26 | rwlock_t mc_list_lock; |
27 | struct ip_mc_list *mc_list; /* IP multicast filter chain */ | 27 | struct ip_mc_list *mc_list; /* IP multicast filter chain */ |
28 | int mc_count; /* Number of installed mcasts */ | ||
28 | spinlock_t mc_tomb_lock; | 29 | spinlock_t mc_tomb_lock; |
29 | struct ip_mc_list *mc_tomb; | 30 | struct ip_mc_list *mc_tomb; |
30 | unsigned long mr_v1_seen; | 31 | unsigned long mr_v1_seen; |
diff --git a/include/linux/init.h b/include/linux/init.h index 93538b696e3d..68cb0265d009 100644 --- a/include/linux/init.h +++ b/include/linux/init.h | |||
@@ -40,7 +40,7 @@ | |||
40 | 40 | ||
41 | /* These are for everybody (although not all archs will actually | 41 | /* These are for everybody (although not all archs will actually |
42 | discard it in modules) */ | 42 | discard it in modules) */ |
43 | #define __init __section(.init.text) __cold | 43 | #define __init __section(.init.text) __cold notrace |
44 | #define __initdata __section(.init.data) | 44 | #define __initdata __section(.init.data) |
45 | #define __initconst __section(.init.rodata) | 45 | #define __initconst __section(.init.rodata) |
46 | #define __exitdata __section(.exit.data) | 46 | #define __exitdata __section(.exit.data) |
@@ -112,21 +112,25 @@ | |||
112 | #define __FINIT .previous | 112 | #define __FINIT .previous |
113 | 113 | ||
114 | #define __INITDATA .section ".init.data","aw" | 114 | #define __INITDATA .section ".init.data","aw" |
115 | #define __INITRODATA .section ".init.rodata","a" | ||
115 | #define __FINITDATA .previous | 116 | #define __FINITDATA .previous |
116 | 117 | ||
117 | #define __DEVINIT .section ".devinit.text", "ax" | 118 | #define __DEVINIT .section ".devinit.text", "ax" |
118 | #define __DEVINITDATA .section ".devinit.data", "aw" | 119 | #define __DEVINITDATA .section ".devinit.data", "aw" |
120 | #define __DEVINITRODATA .section ".devinit.rodata", "a" | ||
119 | 121 | ||
120 | #define __CPUINIT .section ".cpuinit.text", "ax" | 122 | #define __CPUINIT .section ".cpuinit.text", "ax" |
121 | #define __CPUINITDATA .section ".cpuinit.data", "aw" | 123 | #define __CPUINITDATA .section ".cpuinit.data", "aw" |
124 | #define __CPUINITRODATA .section ".cpuinit.rodata", "a" | ||
122 | 125 | ||
123 | #define __MEMINIT .section ".meminit.text", "ax" | 126 | #define __MEMINIT .section ".meminit.text", "ax" |
124 | #define __MEMINITDATA .section ".meminit.data", "aw" | 127 | #define __MEMINITDATA .section ".meminit.data", "aw" |
128 | #define __MEMINITRODATA .section ".meminit.rodata", "a" | ||
125 | 129 | ||
126 | /* silence warnings when references are OK */ | 130 | /* silence warnings when references are OK */ |
127 | #define __REF .section ".ref.text", "ax" | 131 | #define __REF .section ".ref.text", "ax" |
128 | #define __REFDATA .section ".ref.data", "aw" | 132 | #define __REFDATA .section ".ref.data", "aw" |
129 | #define __REFCONST .section ".ref.rodata", "aw" | 133 | #define __REFCONST .section ".ref.rodata", "a" |
130 | 134 | ||
131 | #ifndef __ASSEMBLY__ | 135 | #ifndef __ASSEMBLY__ |
132 | /* | 136 | /* |
@@ -233,9 +237,6 @@ struct obs_kernel_param { | |||
233 | __attribute__((aligned((sizeof(long))))) \ | 237 | __attribute__((aligned((sizeof(long))))) \ |
234 | = { __setup_str_##unique_id, fn, early } | 238 | = { __setup_str_##unique_id, fn, early } |
235 | 239 | ||
236 | #define __setup_null_param(str, unique_id) \ | ||
237 | __setup_param(str, unique_id, NULL, 0) | ||
238 | |||
239 | #define __setup(str, fn) \ | 240 | #define __setup(str, fn) \ |
240 | __setup_param(str, fn, fn, 0) | 241 | __setup_param(str, fn, fn, 0) |
241 | 242 | ||
@@ -296,7 +297,6 @@ void __init parse_early_param(void); | |||
296 | void cleanup_module(void) __attribute__((alias(#exitfn))); | 297 | void cleanup_module(void) __attribute__((alias(#exitfn))); |
297 | 298 | ||
298 | #define __setup_param(str, unique_id, fn) /* nothing */ | 299 | #define __setup_param(str, unique_id, fn) /* nothing */ |
299 | #define __setup_null_param(str, unique_id) /* nothing */ | ||
300 | #define __setup(str, func) /* nothing */ | 300 | #define __setup(str, func) /* nothing */ |
301 | #endif | 301 | #endif |
302 | 302 | ||
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 021d8e720c79..23fd8909b9e5 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
@@ -170,6 +170,7 @@ extern struct group_info init_groups; | |||
170 | .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ | 170 | .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ |
171 | .fs_excl = ATOMIC_INIT(0), \ | 171 | .fs_excl = ATOMIC_INIT(0), \ |
172 | .pi_lock = __SPIN_LOCK_UNLOCKED(tsk.pi_lock), \ | 172 | .pi_lock = __SPIN_LOCK_UNLOCKED(tsk.pi_lock), \ |
173 | .timer_slack_ns = 50000, /* 50 usec default slack */ \ | ||
173 | .pids = { \ | 174 | .pids = { \ |
174 | [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \ | 175 | [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \ |
175 | [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \ | 176 | [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \ |
diff --git a/include/linux/inotify.h b/include/linux/inotify.h index bd578578a8b9..37ea2894b3c0 100644 --- a/include/linux/inotify.h +++ b/include/linux/inotify.h | |||
@@ -134,6 +134,8 @@ extern void inotify_remove_watch_locked(struct inotify_handle *, | |||
134 | struct inotify_watch *); | 134 | struct inotify_watch *); |
135 | extern void get_inotify_watch(struct inotify_watch *); | 135 | extern void get_inotify_watch(struct inotify_watch *); |
136 | extern void put_inotify_watch(struct inotify_watch *); | 136 | extern void put_inotify_watch(struct inotify_watch *); |
137 | extern int pin_inotify_watch(struct inotify_watch *); | ||
138 | extern void unpin_inotify_watch(struct inotify_watch *); | ||
137 | 139 | ||
138 | #else | 140 | #else |
139 | 141 | ||
@@ -228,6 +230,15 @@ static inline void put_inotify_watch(struct inotify_watch *watch) | |||
228 | { | 230 | { |
229 | } | 231 | } |
230 | 232 | ||
233 | extern inline int pin_inotify_watch(struct inotify_watch *watch) | ||
234 | { | ||
235 | return 0; | ||
236 | } | ||
237 | |||
238 | extern inline void unpin_inotify_watch(struct inotify_watch *watch) | ||
239 | { | ||
240 | } | ||
241 | |||
231 | #endif /* CONFIG_INOTIFY */ | 242 | #endif /* CONFIG_INOTIFY */ |
232 | 243 | ||
233 | #endif /* __KERNEL __ */ | 244 | #endif /* __KERNEL __ */ |
diff --git a/include/linux/input.h b/include/linux/input.h index a5802c9c81a4..5341e8251f8c 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -238,6 +238,7 @@ struct input_absinfo { | |||
238 | #define KEY_KPEQUAL 117 | 238 | #define KEY_KPEQUAL 117 |
239 | #define KEY_KPPLUSMINUS 118 | 239 | #define KEY_KPPLUSMINUS 118 |
240 | #define KEY_PAUSE 119 | 240 | #define KEY_PAUSE 119 |
241 | #define KEY_SCALE 120 /* AL Compiz Scale (Expose) */ | ||
241 | 242 | ||
242 | #define KEY_KPCOMMA 121 | 243 | #define KEY_KPCOMMA 121 |
243 | #define KEY_HANGEUL 122 | 244 | #define KEY_HANGEUL 122 |
@@ -322,6 +323,7 @@ struct input_absinfo { | |||
322 | #define KEY_PAUSECD 201 | 323 | #define KEY_PAUSECD 201 |
323 | #define KEY_PROG3 202 | 324 | #define KEY_PROG3 202 |
324 | #define KEY_PROG4 203 | 325 | #define KEY_PROG4 203 |
326 | #define KEY_DASHBOARD 204 /* AL Dashboard */ | ||
325 | #define KEY_SUSPEND 205 | 327 | #define KEY_SUSPEND 205 |
326 | #define KEY_CLOSE 206 /* AC Close */ | 328 | #define KEY_CLOSE 206 /* AC Close */ |
327 | #define KEY_PLAY 207 | 329 | #define KEY_PLAY 207 |
@@ -577,9 +579,22 @@ struct input_absinfo { | |||
577 | #define KEY_BRL_DOT9 0x1f9 | 579 | #define KEY_BRL_DOT9 0x1f9 |
578 | #define KEY_BRL_DOT10 0x1fa | 580 | #define KEY_BRL_DOT10 0x1fa |
579 | 581 | ||
582 | #define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */ | ||
583 | #define KEY_NUMERIC_1 0x201 /* and other keypads */ | ||
584 | #define KEY_NUMERIC_2 0x202 | ||
585 | #define KEY_NUMERIC_3 0x203 | ||
586 | #define KEY_NUMERIC_4 0x204 | ||
587 | #define KEY_NUMERIC_5 0x205 | ||
588 | #define KEY_NUMERIC_6 0x206 | ||
589 | #define KEY_NUMERIC_7 0x207 | ||
590 | #define KEY_NUMERIC_8 0x208 | ||
591 | #define KEY_NUMERIC_9 0x209 | ||
592 | #define KEY_NUMERIC_STAR 0x20a | ||
593 | #define KEY_NUMERIC_POUND 0x20b | ||
594 | |||
580 | /* We avoid low common keys in module aliases so they don't get huge. */ | 595 | /* We avoid low common keys in module aliases so they don't get huge. */ |
581 | #define KEY_MIN_INTERESTING KEY_MUTE | 596 | #define KEY_MIN_INTERESTING KEY_MUTE |
582 | #define KEY_MAX 0x1ff | 597 | #define KEY_MAX 0x2ff |
583 | #define KEY_CNT (KEY_MAX+1) | 598 | #define KEY_CNT (KEY_MAX+1) |
584 | 599 | ||
585 | /* | 600 | /* |
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h new file mode 100644 index 000000000000..3d017cfd245b --- /dev/null +++ b/include/linux/intel-iommu.h | |||
@@ -0,0 +1,363 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2006, Intel Corporation. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License along with | ||
14 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
15 | * Place - Suite 330, Boston, MA 02111-1307 USA. | ||
16 | * | ||
17 | * Copyright (C) 2006-2008 Intel Corporation | ||
18 | * Author: Ashok Raj <ashok.raj@intel.com> | ||
19 | * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> | ||
20 | */ | ||
21 | |||
22 | #ifndef _INTEL_IOMMU_H_ | ||
23 | #define _INTEL_IOMMU_H_ | ||
24 | |||
25 | #include <linux/types.h> | ||
26 | #include <linux/msi.h> | ||
27 | #include <linux/sysdev.h> | ||
28 | #include <linux/iova.h> | ||
29 | #include <linux/io.h> | ||
30 | #include <linux/dma_remapping.h> | ||
31 | #include <asm/cacheflush.h> | ||
32 | #include <asm/iommu.h> | ||
33 | |||
34 | /* | ||
35 | * Intel IOMMU register specification per version 1.0 public spec. | ||
36 | */ | ||
37 | |||
38 | #define DMAR_VER_REG 0x0 /* Arch version supported by this IOMMU */ | ||
39 | #define DMAR_CAP_REG 0x8 /* Hardware supported capabilities */ | ||
40 | #define DMAR_ECAP_REG 0x10 /* Extended capabilities supported */ | ||
41 | #define DMAR_GCMD_REG 0x18 /* Global command register */ | ||
42 | #define DMAR_GSTS_REG 0x1c /* Global status register */ | ||
43 | #define DMAR_RTADDR_REG 0x20 /* Root entry table */ | ||
44 | #define DMAR_CCMD_REG 0x28 /* Context command reg */ | ||
45 | #define DMAR_FSTS_REG 0x34 /* Fault Status register */ | ||
46 | #define DMAR_FECTL_REG 0x38 /* Fault control register */ | ||
47 | #define DMAR_FEDATA_REG 0x3c /* Fault event interrupt data register */ | ||
48 | #define DMAR_FEADDR_REG 0x40 /* Fault event interrupt addr register */ | ||
49 | #define DMAR_FEUADDR_REG 0x44 /* Upper address register */ | ||
50 | #define DMAR_AFLOG_REG 0x58 /* Advanced Fault control */ | ||
51 | #define DMAR_PMEN_REG 0x64 /* Enable Protected Memory Region */ | ||
52 | #define DMAR_PLMBASE_REG 0x68 /* PMRR Low addr */ | ||
53 | #define DMAR_PLMLIMIT_REG 0x6c /* PMRR low limit */ | ||
54 | #define DMAR_PHMBASE_REG 0x70 /* pmrr high base addr */ | ||
55 | #define DMAR_PHMLIMIT_REG 0x78 /* pmrr high limit */ | ||
56 | #define DMAR_IQH_REG 0x80 /* Invalidation queue head register */ | ||
57 | #define DMAR_IQT_REG 0x88 /* Invalidation queue tail register */ | ||
58 | #define DMAR_IQA_REG 0x90 /* Invalidation queue addr register */ | ||
59 | #define DMAR_ICS_REG 0x98 /* Invalidation complete status register */ | ||
60 | #define DMAR_IRTA_REG 0xb8 /* Interrupt remapping table addr register */ | ||
61 | |||
62 | #define OFFSET_STRIDE (9) | ||
63 | /* | ||
64 | #define dmar_readl(dmar, reg) readl(dmar + reg) | ||
65 | #define dmar_readq(dmar, reg) ({ \ | ||
66 | u32 lo, hi; \ | ||
67 | lo = readl(dmar + reg); \ | ||
68 | hi = readl(dmar + reg + 4); \ | ||
69 | (((u64) hi) << 32) + lo; }) | ||
70 | */ | ||
71 | static inline u64 dmar_readq(void __iomem *addr) | ||
72 | { | ||
73 | u32 lo, hi; | ||
74 | lo = readl(addr); | ||
75 | hi = readl(addr + 4); | ||
76 | return (((u64) hi) << 32) + lo; | ||
77 | } | ||
78 | |||
79 | static inline void dmar_writeq(void __iomem *addr, u64 val) | ||
80 | { | ||
81 | writel((u32)val, addr); | ||
82 | writel((u32)(val >> 32), addr + 4); | ||
83 | } | ||
84 | |||
85 | #define DMAR_VER_MAJOR(v) (((v) & 0xf0) >> 4) | ||
86 | #define DMAR_VER_MINOR(v) ((v) & 0x0f) | ||
87 | |||
88 | /* | ||
89 | * Decoding Capability Register | ||
90 | */ | ||
91 | #define cap_read_drain(c) (((c) >> 55) & 1) | ||
92 | #define cap_write_drain(c) (((c) >> 54) & 1) | ||
93 | #define cap_max_amask_val(c) (((c) >> 48) & 0x3f) | ||
94 | #define cap_num_fault_regs(c) ((((c) >> 40) & 0xff) + 1) | ||
95 | #define cap_pgsel_inv(c) (((c) >> 39) & 1) | ||
96 | |||
97 | #define cap_super_page_val(c) (((c) >> 34) & 0xf) | ||
98 | #define cap_super_offset(c) (((find_first_bit(&cap_super_page_val(c), 4)) \ | ||
99 | * OFFSET_STRIDE) + 21) | ||
100 | |||
101 | #define cap_fault_reg_offset(c) ((((c) >> 24) & 0x3ff) * 16) | ||
102 | #define cap_max_fault_reg_offset(c) \ | ||
103 | (cap_fault_reg_offset(c) + cap_num_fault_regs(c) * 16) | ||
104 | |||
105 | #define cap_zlr(c) (((c) >> 22) & 1) | ||
106 | #define cap_isoch(c) (((c) >> 23) & 1) | ||
107 | #define cap_mgaw(c) ((((c) >> 16) & 0x3f) + 1) | ||
108 | #define cap_sagaw(c) (((c) >> 8) & 0x1f) | ||
109 | #define cap_caching_mode(c) (((c) >> 7) & 1) | ||
110 | #define cap_phmr(c) (((c) >> 6) & 1) | ||
111 | #define cap_plmr(c) (((c) >> 5) & 1) | ||
112 | #define cap_rwbf(c) (((c) >> 4) & 1) | ||
113 | #define cap_afl(c) (((c) >> 3) & 1) | ||
114 | #define cap_ndoms(c) (((unsigned long)1) << (4 + 2 * ((c) & 0x7))) | ||
115 | /* | ||
116 | * Extended Capability Register | ||
117 | */ | ||
118 | |||
119 | #define ecap_niotlb_iunits(e) ((((e) >> 24) & 0xff) + 1) | ||
120 | #define ecap_iotlb_offset(e) ((((e) >> 8) & 0x3ff) * 16) | ||
121 | #define ecap_max_iotlb_offset(e) \ | ||
122 | (ecap_iotlb_offset(e) + ecap_niotlb_iunits(e) * 16) | ||
123 | #define ecap_coherent(e) ((e) & 0x1) | ||
124 | #define ecap_qis(e) ((e) & 0x2) | ||
125 | #define ecap_eim_support(e) ((e >> 4) & 0x1) | ||
126 | #define ecap_ir_support(e) ((e >> 3) & 0x1) | ||
127 | #define ecap_max_handle_mask(e) ((e >> 20) & 0xf) | ||
128 | |||
129 | |||
130 | /* IOTLB_REG */ | ||
131 | #define DMA_TLB_FLUSH_GRANU_OFFSET 60 | ||
132 | #define DMA_TLB_GLOBAL_FLUSH (((u64)1) << 60) | ||
133 | #define DMA_TLB_DSI_FLUSH (((u64)2) << 60) | ||
134 | #define DMA_TLB_PSI_FLUSH (((u64)3) << 60) | ||
135 | #define DMA_TLB_IIRG(type) ((type >> 60) & 7) | ||
136 | #define DMA_TLB_IAIG(val) (((val) >> 57) & 7) | ||
137 | #define DMA_TLB_READ_DRAIN (((u64)1) << 49) | ||
138 | #define DMA_TLB_WRITE_DRAIN (((u64)1) << 48) | ||
139 | #define DMA_TLB_DID(id) (((u64)((id) & 0xffff)) << 32) | ||
140 | #define DMA_TLB_IVT (((u64)1) << 63) | ||
141 | #define DMA_TLB_IH_NONLEAF (((u64)1) << 6) | ||
142 | #define DMA_TLB_MAX_SIZE (0x3f) | ||
143 | |||
144 | /* INVALID_DESC */ | ||
145 | #define DMA_CCMD_INVL_GRANU_OFFSET 61 | ||
146 | #define DMA_ID_TLB_GLOBAL_FLUSH (((u64)1) << 3) | ||
147 | #define DMA_ID_TLB_DSI_FLUSH (((u64)2) << 3) | ||
148 | #define DMA_ID_TLB_PSI_FLUSH (((u64)3) << 3) | ||
149 | #define DMA_ID_TLB_READ_DRAIN (((u64)1) << 7) | ||
150 | #define DMA_ID_TLB_WRITE_DRAIN (((u64)1) << 6) | ||
151 | #define DMA_ID_TLB_DID(id) (((u64)((id & 0xffff) << 16))) | ||
152 | #define DMA_ID_TLB_IH_NONLEAF (((u64)1) << 6) | ||
153 | #define DMA_ID_TLB_ADDR(addr) (addr) | ||
154 | #define DMA_ID_TLB_ADDR_MASK(mask) (mask) | ||
155 | |||
156 | /* PMEN_REG */ | ||
157 | #define DMA_PMEN_EPM (((u32)1)<<31) | ||
158 | #define DMA_PMEN_PRS (((u32)1)<<0) | ||
159 | |||
160 | /* GCMD_REG */ | ||
161 | #define DMA_GCMD_TE (((u32)1) << 31) | ||
162 | #define DMA_GCMD_SRTP (((u32)1) << 30) | ||
163 | #define DMA_GCMD_SFL (((u32)1) << 29) | ||
164 | #define DMA_GCMD_EAFL (((u32)1) << 28) | ||
165 | #define DMA_GCMD_WBF (((u32)1) << 27) | ||
166 | #define DMA_GCMD_QIE (((u32)1) << 26) | ||
167 | #define DMA_GCMD_SIRTP (((u32)1) << 24) | ||
168 | #define DMA_GCMD_IRE (((u32) 1) << 25) | ||
169 | |||
170 | /* GSTS_REG */ | ||
171 | #define DMA_GSTS_TES (((u32)1) << 31) | ||
172 | #define DMA_GSTS_RTPS (((u32)1) << 30) | ||
173 | #define DMA_GSTS_FLS (((u32)1) << 29) | ||
174 | #define DMA_GSTS_AFLS (((u32)1) << 28) | ||
175 | #define DMA_GSTS_WBFS (((u32)1) << 27) | ||
176 | #define DMA_GSTS_QIES (((u32)1) << 26) | ||
177 | #define DMA_GSTS_IRTPS (((u32)1) << 24) | ||
178 | #define DMA_GSTS_IRES (((u32)1) << 25) | ||
179 | |||
180 | /* CCMD_REG */ | ||
181 | #define DMA_CCMD_ICC (((u64)1) << 63) | ||
182 | #define DMA_CCMD_GLOBAL_INVL (((u64)1) << 61) | ||
183 | #define DMA_CCMD_DOMAIN_INVL (((u64)2) << 61) | ||
184 | #define DMA_CCMD_DEVICE_INVL (((u64)3) << 61) | ||
185 | #define DMA_CCMD_FM(m) (((u64)((m) & 0x3)) << 32) | ||
186 | #define DMA_CCMD_MASK_NOBIT 0 | ||
187 | #define DMA_CCMD_MASK_1BIT 1 | ||
188 | #define DMA_CCMD_MASK_2BIT 2 | ||
189 | #define DMA_CCMD_MASK_3BIT 3 | ||
190 | #define DMA_CCMD_SID(s) (((u64)((s) & 0xffff)) << 16) | ||
191 | #define DMA_CCMD_DID(d) ((u64)((d) & 0xffff)) | ||
192 | |||
193 | /* FECTL_REG */ | ||
194 | #define DMA_FECTL_IM (((u32)1) << 31) | ||
195 | |||
196 | /* FSTS_REG */ | ||
197 | #define DMA_FSTS_PPF ((u32)2) | ||
198 | #define DMA_FSTS_PFO ((u32)1) | ||
199 | #define dma_fsts_fault_record_index(s) (((s) >> 8) & 0xff) | ||
200 | |||
201 | /* FRCD_REG, 32 bits access */ | ||
202 | #define DMA_FRCD_F (((u32)1) << 31) | ||
203 | #define dma_frcd_type(d) ((d >> 30) & 1) | ||
204 | #define dma_frcd_fault_reason(c) (c & 0xff) | ||
205 | #define dma_frcd_source_id(c) (c & 0xffff) | ||
206 | /* low 64 bit */ | ||
207 | #define dma_frcd_page_addr(d) (d & (((u64)-1) << PAGE_SHIFT)) | ||
208 | |||
209 | #define IOMMU_WAIT_OP(iommu, offset, op, cond, sts) \ | ||
210 | do { \ | ||
211 | cycles_t start_time = get_cycles(); \ | ||
212 | while (1) { \ | ||
213 | sts = op(iommu->reg + offset); \ | ||
214 | if (cond) \ | ||
215 | break; \ | ||
216 | if (DMAR_OPERATION_TIMEOUT < (get_cycles() - start_time))\ | ||
217 | panic("DMAR hardware is malfunctioning\n"); \ | ||
218 | cpu_relax(); \ | ||
219 | } \ | ||
220 | } while (0) | ||
221 | |||
222 | #define QI_LENGTH 256 /* queue length */ | ||
223 | |||
224 | enum { | ||
225 | QI_FREE, | ||
226 | QI_IN_USE, | ||
227 | QI_DONE | ||
228 | }; | ||
229 | |||
230 | #define QI_CC_TYPE 0x1 | ||
231 | #define QI_IOTLB_TYPE 0x2 | ||
232 | #define QI_DIOTLB_TYPE 0x3 | ||
233 | #define QI_IEC_TYPE 0x4 | ||
234 | #define QI_IWD_TYPE 0x5 | ||
235 | |||
236 | #define QI_IEC_SELECTIVE (((u64)1) << 4) | ||
237 | #define QI_IEC_IIDEX(idx) (((u64)(idx & 0xffff) << 32)) | ||
238 | #define QI_IEC_IM(m) (((u64)(m & 0x1f) << 27)) | ||
239 | |||
240 | #define QI_IWD_STATUS_DATA(d) (((u64)d) << 32) | ||
241 | #define QI_IWD_STATUS_WRITE (((u64)1) << 5) | ||
242 | |||
243 | #define QI_IOTLB_DID(did) (((u64)did) << 16) | ||
244 | #define QI_IOTLB_DR(dr) (((u64)dr) << 7) | ||
245 | #define QI_IOTLB_DW(dw) (((u64)dw) << 6) | ||
246 | #define QI_IOTLB_GRAN(gran) (((u64)gran) >> (DMA_TLB_FLUSH_GRANU_OFFSET-4)) | ||
247 | #define QI_IOTLB_ADDR(addr) (((u64)addr) & VTD_PAGE_MASK) | ||
248 | #define QI_IOTLB_IH(ih) (((u64)ih) << 6) | ||
249 | #define QI_IOTLB_AM(am) (((u8)am)) | ||
250 | |||
251 | #define QI_CC_FM(fm) (((u64)fm) << 48) | ||
252 | #define QI_CC_SID(sid) (((u64)sid) << 32) | ||
253 | #define QI_CC_DID(did) (((u64)did) << 16) | ||
254 | #define QI_CC_GRAN(gran) (((u64)gran) >> (DMA_CCMD_INVL_GRANU_OFFSET-4)) | ||
255 | |||
256 | struct qi_desc { | ||
257 | u64 low, high; | ||
258 | }; | ||
259 | |||
260 | struct q_inval { | ||
261 | spinlock_t q_lock; | ||
262 | struct qi_desc *desc; /* invalidation queue */ | ||
263 | int *desc_status; /* desc status */ | ||
264 | int free_head; /* first free entry */ | ||
265 | int free_tail; /* last free entry */ | ||
266 | int free_cnt; | ||
267 | }; | ||
268 | |||
269 | #ifdef CONFIG_INTR_REMAP | ||
270 | /* 1MB - maximum possible interrupt remapping table size */ | ||
271 | #define INTR_REMAP_PAGE_ORDER 8 | ||
272 | #define INTR_REMAP_TABLE_REG_SIZE 0xf | ||
273 | |||
274 | #define INTR_REMAP_TABLE_ENTRIES 65536 | ||
275 | |||
276 | struct ir_table { | ||
277 | struct irte *base; | ||
278 | }; | ||
279 | #endif | ||
280 | |||
281 | struct iommu_flush { | ||
282 | int (*flush_context)(struct intel_iommu *iommu, u16 did, u16 sid, u8 fm, | ||
283 | u64 type, int non_present_entry_flush); | ||
284 | int (*flush_iotlb)(struct intel_iommu *iommu, u16 did, u64 addr, | ||
285 | unsigned int size_order, u64 type, int non_present_entry_flush); | ||
286 | }; | ||
287 | |||
288 | struct intel_iommu { | ||
289 | void __iomem *reg; /* Pointer to hardware regs, virtual addr */ | ||
290 | u64 cap; | ||
291 | u64 ecap; | ||
292 | int seg; | ||
293 | u32 gcmd; /* Holds TE, EAFL. Don't need SRTP, SFL, WBF */ | ||
294 | spinlock_t register_lock; /* protect register handling */ | ||
295 | int seq_id; /* sequence id of the iommu */ | ||
296 | |||
297 | #ifdef CONFIG_DMAR | ||
298 | unsigned long *domain_ids; /* bitmap of domains */ | ||
299 | struct dmar_domain **domains; /* ptr to domains */ | ||
300 | spinlock_t lock; /* protect context, domain ids */ | ||
301 | struct root_entry *root_entry; /* virtual address */ | ||
302 | |||
303 | unsigned int irq; | ||
304 | unsigned char name[7]; /* Device Name */ | ||
305 | struct msi_msg saved_msg; | ||
306 | struct sys_device sysdev; | ||
307 | struct iommu_flush flush; | ||
308 | #endif | ||
309 | struct q_inval *qi; /* Queued invalidation info */ | ||
310 | #ifdef CONFIG_INTR_REMAP | ||
311 | struct ir_table *ir_table; /* Interrupt remapping info */ | ||
312 | #endif | ||
313 | }; | ||
314 | |||
315 | static inline void __iommu_flush_cache( | ||
316 | struct intel_iommu *iommu, void *addr, int size) | ||
317 | { | ||
318 | if (!ecap_coherent(iommu->ecap)) | ||
319 | clflush_cache_range(addr, size); | ||
320 | } | ||
321 | |||
322 | extern struct dmar_drhd_unit * dmar_find_matched_drhd_unit(struct pci_dev *dev); | ||
323 | |||
324 | extern int alloc_iommu(struct dmar_drhd_unit *drhd); | ||
325 | extern void free_iommu(struct intel_iommu *iommu); | ||
326 | extern int dmar_enable_qi(struct intel_iommu *iommu); | ||
327 | extern void qi_global_iec(struct intel_iommu *iommu); | ||
328 | |||
329 | extern int qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid, | ||
330 | u8 fm, u64 type, int non_present_entry_flush); | ||
331 | extern int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr, | ||
332 | unsigned int size_order, u64 type, | ||
333 | int non_present_entry_flush); | ||
334 | |||
335 | extern void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); | ||
336 | |||
337 | void intel_iommu_domain_exit(struct dmar_domain *domain); | ||
338 | struct dmar_domain *intel_iommu_domain_alloc(struct pci_dev *pdev); | ||
339 | int intel_iommu_context_mapping(struct dmar_domain *domain, | ||
340 | struct pci_dev *pdev); | ||
341 | int intel_iommu_page_mapping(struct dmar_domain *domain, dma_addr_t iova, | ||
342 | u64 hpa, size_t size, int prot); | ||
343 | void intel_iommu_detach_dev(struct dmar_domain *domain, u8 bus, u8 devfn); | ||
344 | struct dmar_domain *intel_iommu_find_domain(struct pci_dev *pdev); | ||
345 | u64 intel_iommu_iova_to_pfn(struct dmar_domain *domain, u64 iova); | ||
346 | |||
347 | #ifdef CONFIG_DMAR | ||
348 | int intel_iommu_found(void); | ||
349 | #else /* CONFIG_DMAR */ | ||
350 | static inline int intel_iommu_found(void) | ||
351 | { | ||
352 | return 0; | ||
353 | } | ||
354 | #endif /* CONFIG_DMAR */ | ||
355 | |||
356 | extern void *intel_alloc_coherent(struct device *, size_t, dma_addr_t *, gfp_t); | ||
357 | extern void intel_free_coherent(struct device *, size_t, void *, dma_addr_t); | ||
358 | extern dma_addr_t intel_map_single(struct device *, phys_addr_t, size_t, int); | ||
359 | extern void intel_unmap_single(struct device *, dma_addr_t, size_t, int); | ||
360 | extern int intel_map_sg(struct device *, struct scatterlist *, int, int); | ||
361 | extern void intel_unmap_sg(struct device *, struct scatterlist *, int, int); | ||
362 | |||
363 | #endif | ||
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 58ff4e74b2f3..f58a0cf8929a 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -8,9 +8,12 @@ | |||
8 | #include <linux/preempt.h> | 8 | #include <linux/preempt.h> |
9 | #include <linux/cpumask.h> | 9 | #include <linux/cpumask.h> |
10 | #include <linux/irqreturn.h> | 10 | #include <linux/irqreturn.h> |
11 | #include <linux/irqnr.h> | ||
11 | #include <linux/hardirq.h> | 12 | #include <linux/hardirq.h> |
12 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
13 | #include <linux/irqflags.h> | 14 | #include <linux/irqflags.h> |
15 | #include <linux/smp.h> | ||
16 | #include <linux/percpu.h> | ||
14 | #include <asm/atomic.h> | 17 | #include <asm/atomic.h> |
15 | #include <asm/ptrace.h> | 18 | #include <asm/ptrace.h> |
16 | #include <asm/system.h> | 19 | #include <asm/system.h> |
@@ -252,6 +255,8 @@ enum | |||
252 | HRTIMER_SOFTIRQ, | 255 | HRTIMER_SOFTIRQ, |
253 | #endif | 256 | #endif |
254 | RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */ | 257 | RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */ |
258 | |||
259 | NR_SOFTIRQS | ||
255 | }; | 260 | }; |
256 | 261 | ||
257 | /* softirq mask and active fields moved to irq_cpustat_t in | 262 | /* softirq mask and active fields moved to irq_cpustat_t in |
@@ -271,6 +276,25 @@ extern void softirq_init(void); | |||
271 | extern void raise_softirq_irqoff(unsigned int nr); | 276 | extern void raise_softirq_irqoff(unsigned int nr); |
272 | extern void raise_softirq(unsigned int nr); | 277 | extern void raise_softirq(unsigned int nr); |
273 | 278 | ||
279 | /* This is the worklist that queues up per-cpu softirq work. | ||
280 | * | ||
281 | * send_remote_sendirq() adds work to these lists, and | ||
282 | * the softirq handler itself dequeues from them. The queues | ||
283 | * are protected by disabling local cpu interrupts and they must | ||
284 | * only be accessed by the local cpu that they are for. | ||
285 | */ | ||
286 | DECLARE_PER_CPU(struct list_head [NR_SOFTIRQS], softirq_work_list); | ||
287 | |||
288 | /* Try to send a softirq to a remote cpu. If this cannot be done, the | ||
289 | * work will be queued to the local cpu. | ||
290 | */ | ||
291 | extern void send_remote_softirq(struct call_single_data *cp, int cpu, int softirq); | ||
292 | |||
293 | /* Like send_remote_softirq(), but the caller must disable local cpu interrupts | ||
294 | * and compute the current cpu, passed in as 'this_cpu'. | ||
295 | */ | ||
296 | extern void __send_remote_softirq(struct call_single_data *cp, int cpu, | ||
297 | int this_cpu, int softirq); | ||
274 | 298 | ||
275 | /* Tasklets --- multithreaded analogue of BHs. | 299 | /* Tasklets --- multithreaded analogue of BHs. |
276 | 300 | ||
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h new file mode 100644 index 000000000000..82df31726a54 --- /dev/null +++ b/include/linux/io-mapping.h | |||
@@ -0,0 +1,125 @@ | |||
1 | /* | ||
2 | * Copyright © 2008 Keith Packard <keithp@keithp.com> | ||
3 | * | ||
4 | * This file is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of version 2 of the GNU General Public License | ||
6 | * as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program; if not, write to the Free Software Foundation, | ||
15 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | ||
16 | */ | ||
17 | |||
18 | #ifndef _LINUX_IO_MAPPING_H | ||
19 | #define _LINUX_IO_MAPPING_H | ||
20 | |||
21 | #include <linux/types.h> | ||
22 | #include <asm/io.h> | ||
23 | #include <asm/page.h> | ||
24 | #include <asm/iomap.h> | ||
25 | |||
26 | /* | ||
27 | * The io_mapping mechanism provides an abstraction for mapping | ||
28 | * individual pages from an io device to the CPU in an efficient fashion. | ||
29 | * | ||
30 | * See Documentation/io_mapping.txt | ||
31 | */ | ||
32 | |||
33 | /* this struct isn't actually defined anywhere */ | ||
34 | struct io_mapping; | ||
35 | |||
36 | #ifdef CONFIG_HAVE_ATOMIC_IOMAP | ||
37 | |||
38 | /* | ||
39 | * For small address space machines, mapping large objects | ||
40 | * into the kernel virtual space isn't practical. Where | ||
41 | * available, use fixmap support to dynamically map pages | ||
42 | * of the object at run time. | ||
43 | */ | ||
44 | |||
45 | static inline struct io_mapping * | ||
46 | io_mapping_create_wc(unsigned long base, unsigned long size) | ||
47 | { | ||
48 | return (struct io_mapping *) base; | ||
49 | } | ||
50 | |||
51 | static inline void | ||
52 | io_mapping_free(struct io_mapping *mapping) | ||
53 | { | ||
54 | } | ||
55 | |||
56 | /* Atomic map/unmap */ | ||
57 | static inline void * | ||
58 | io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset) | ||
59 | { | ||
60 | offset += (unsigned long) mapping; | ||
61 | return iomap_atomic_prot_pfn(offset >> PAGE_SHIFT, KM_USER0, | ||
62 | __pgprot(__PAGE_KERNEL_WC)); | ||
63 | } | ||
64 | |||
65 | static inline void | ||
66 | io_mapping_unmap_atomic(void *vaddr) | ||
67 | { | ||
68 | iounmap_atomic(vaddr, KM_USER0); | ||
69 | } | ||
70 | |||
71 | static inline void * | ||
72 | io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) | ||
73 | { | ||
74 | offset += (unsigned long) mapping; | ||
75 | return ioremap_wc(offset, PAGE_SIZE); | ||
76 | } | ||
77 | |||
78 | static inline void | ||
79 | io_mapping_unmap(void *vaddr) | ||
80 | { | ||
81 | iounmap(vaddr); | ||
82 | } | ||
83 | |||
84 | #else | ||
85 | |||
86 | /* Create the io_mapping object*/ | ||
87 | static inline struct io_mapping * | ||
88 | io_mapping_create_wc(unsigned long base, unsigned long size) | ||
89 | { | ||
90 | return (struct io_mapping *) ioremap_wc(base, size); | ||
91 | } | ||
92 | |||
93 | static inline void | ||
94 | io_mapping_free(struct io_mapping *mapping) | ||
95 | { | ||
96 | iounmap(mapping); | ||
97 | } | ||
98 | |||
99 | /* Atomic map/unmap */ | ||
100 | static inline void * | ||
101 | io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset) | ||
102 | { | ||
103 | return ((char *) mapping) + offset; | ||
104 | } | ||
105 | |||
106 | static inline void | ||
107 | io_mapping_unmap_atomic(void *vaddr) | ||
108 | { | ||
109 | } | ||
110 | |||
111 | /* Non-atomic map/unmap */ | ||
112 | static inline void * | ||
113 | io_mapping_map_wc(struct io_mapping *mapping, unsigned long offset) | ||
114 | { | ||
115 | return ((char *) mapping) + offset; | ||
116 | } | ||
117 | |||
118 | static inline void | ||
119 | io_mapping_unmap(void *vaddr) | ||
120 | { | ||
121 | } | ||
122 | |||
123 | #endif /* HAVE_ATOMIC_IOMAP */ | ||
124 | |||
125 | #endif /* _LINUX_IO_MAPPING_H */ | ||
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h index c975caf75385..3b068e5b5671 100644 --- a/include/linux/iommu-helper.h +++ b/include/linux/iommu-helper.h | |||
@@ -1,6 +1,20 @@ | |||
1 | #ifndef _LINUX_IOMMU_HELPER_H | ||
2 | #define _LINUX_IOMMU_HELPER_H | ||
3 | |||
4 | static inline unsigned long iommu_device_max_index(unsigned long size, | ||
5 | unsigned long offset, | ||
6 | u64 dma_mask) | ||
7 | { | ||
8 | if (size + offset > dma_mask) | ||
9 | return dma_mask - offset + 1; | ||
10 | else | ||
11 | return size; | ||
12 | } | ||
13 | |||
1 | extern int iommu_is_span_boundary(unsigned int index, unsigned int nr, | 14 | extern int iommu_is_span_boundary(unsigned int index, unsigned int nr, |
2 | unsigned long shift, | 15 | unsigned long shift, |
3 | unsigned long boundary_size); | 16 | unsigned long boundary_size); |
17 | extern void iommu_area_reserve(unsigned long *map, unsigned long i, int len); | ||
4 | extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, | 18 | extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, |
5 | unsigned long start, unsigned int nr, | 19 | unsigned long start, unsigned int nr, |
6 | unsigned long shift, | 20 | unsigned long shift, |
@@ -8,3 +22,8 @@ extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, | |||
8 | unsigned long align_mask); | 22 | unsigned long align_mask); |
9 | extern void iommu_area_free(unsigned long *map, unsigned long start, | 23 | extern void iommu_area_free(unsigned long *map, unsigned long start, |
10 | unsigned int nr); | 24 | unsigned int nr); |
25 | |||
26 | extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len, | ||
27 | unsigned long io_page_size); | ||
28 | |||
29 | #endif | ||
diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 350033e8f4e1..041e95aac2bf 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h | |||
@@ -34,7 +34,8 @@ struct resource_list { | |||
34 | */ | 34 | */ |
35 | #define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */ | 35 | #define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */ |
36 | 36 | ||
37 | #define IORESOURCE_IO 0x00000100 /* Resource type */ | 37 | #define IORESOURCE_TYPE_BITS 0x00000f00 /* Resource type */ |
38 | #define IORESOURCE_IO 0x00000100 | ||
38 | #define IORESOURCE_MEM 0x00000200 | 39 | #define IORESOURCE_MEM 0x00000200 |
39 | #define IORESOURCE_IRQ 0x00000400 | 40 | #define IORESOURCE_IRQ 0x00000400 |
40 | #define IORESOURCE_DMA 0x00000800 | 41 | #define IORESOURCE_DMA 0x00000800 |
@@ -108,6 +109,9 @@ extern struct resource iomem_resource; | |||
108 | 109 | ||
109 | extern int request_resource(struct resource *root, struct resource *new); | 110 | extern int request_resource(struct resource *root, struct resource *new); |
110 | extern int release_resource(struct resource *new); | 111 | extern int release_resource(struct resource *new); |
112 | extern void reserve_region_with_split(struct resource *root, | ||
113 | resource_size_t start, resource_size_t end, | ||
114 | const char *name); | ||
111 | extern int insert_resource(struct resource *parent, struct resource *new); | 115 | extern int insert_resource(struct resource *parent, struct resource *new); |
112 | extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new); | 116 | extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new); |
113 | extern int allocate_resource(struct resource *root, struct resource *new, | 117 | extern int allocate_resource(struct resource *root, struct resource *new, |
@@ -123,6 +127,10 @@ static inline resource_size_t resource_size(struct resource *res) | |||
123 | { | 127 | { |
124 | return res->end - res->start + 1; | 128 | return res->end - res->start + 1; |
125 | } | 129 | } |
130 | static inline unsigned long resource_type(struct resource *res) | ||
131 | { | ||
132 | return res->flags & IORESOURCE_TYPE_BITS; | ||
133 | } | ||
126 | 134 | ||
127 | /* Convenience shorthand with allocation */ | 135 | /* Convenience shorthand with allocation */ |
128 | #define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) | 136 | #define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) |
@@ -166,6 +174,7 @@ extern struct resource * __devm_request_region(struct device *dev, | |||
166 | 174 | ||
167 | extern void __devm_release_region(struct device *dev, struct resource *parent, | 175 | extern void __devm_release_region(struct device *dev, struct resource *parent, |
168 | resource_size_t start, resource_size_t n); | 176 | resource_size_t start, resource_size_t n); |
177 | extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size); | ||
169 | 178 | ||
170 | #endif /* __ASSEMBLY__ */ | 179 | #endif /* __ASSEMBLY__ */ |
171 | #endif /* _LINUX_IOPORT_H */ | 180 | #endif /* _LINUX_IOPORT_H */ |
diff --git a/include/linux/iova.h b/include/linux/iova.h new file mode 100644 index 000000000000..228f6c94b69c --- /dev/null +++ b/include/linux/iova.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2006, Intel Corporation. | ||
3 | * | ||
4 | * This file is released under the GPLv2. | ||
5 | * | ||
6 | * Copyright (C) 2006-2008 Intel Corporation | ||
7 | * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #ifndef _IOVA_H_ | ||
12 | #define _IOVA_H_ | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/rbtree.h> | ||
17 | #include <linux/dma-mapping.h> | ||
18 | |||
19 | /* IO virtual address start page frame number */ | ||
20 | #define IOVA_START_PFN (1) | ||
21 | |||
22 | /* iova structure */ | ||
23 | struct iova { | ||
24 | struct rb_node node; | ||
25 | unsigned long pfn_hi; /* IOMMU dish out addr hi */ | ||
26 | unsigned long pfn_lo; /* IOMMU dish out addr lo */ | ||
27 | }; | ||
28 | |||
29 | /* holds all the iova translations for a domain */ | ||
30 | struct iova_domain { | ||
31 | spinlock_t iova_alloc_lock;/* Lock to protect iova allocation */ | ||
32 | spinlock_t iova_rbtree_lock; /* Lock to protect update of rbtree */ | ||
33 | struct rb_root rbroot; /* iova domain rbtree root */ | ||
34 | struct rb_node *cached32_node; /* Save last alloced node */ | ||
35 | unsigned long dma_32bit_pfn; | ||
36 | }; | ||
37 | |||
38 | struct iova *alloc_iova_mem(void); | ||
39 | void free_iova_mem(struct iova *iova); | ||
40 | void free_iova(struct iova_domain *iovad, unsigned long pfn); | ||
41 | void __free_iova(struct iova_domain *iovad, struct iova *iova); | ||
42 | struct iova *alloc_iova(struct iova_domain *iovad, unsigned long size, | ||
43 | unsigned long limit_pfn, | ||
44 | bool size_aligned); | ||
45 | struct iova *reserve_iova(struct iova_domain *iovad, unsigned long pfn_lo, | ||
46 | unsigned long pfn_hi); | ||
47 | void copy_reserved_iova(struct iova_domain *from, struct iova_domain *to); | ||
48 | void init_iova_domain(struct iova_domain *iovad, unsigned long pfn_32bit); | ||
49 | struct iova *find_iova(struct iova_domain *iovad, unsigned long pfn); | ||
50 | void put_iova_domain(struct iova_domain *iovad); | ||
51 | |||
52 | #endif | ||
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h index ec6eb49af2d8..0f434a28fb58 100644 --- a/include/linux/ip_vs.h +++ b/include/linux/ip_vs.h | |||
@@ -242,4 +242,164 @@ struct ip_vs_daemon_user { | |||
242 | int syncid; | 242 | int syncid; |
243 | }; | 243 | }; |
244 | 244 | ||
245 | /* | ||
246 | * | ||
247 | * IPVS Generic Netlink interface definitions | ||
248 | * | ||
249 | */ | ||
250 | |||
251 | /* Generic Netlink family info */ | ||
252 | |||
253 | #define IPVS_GENL_NAME "IPVS" | ||
254 | #define IPVS_GENL_VERSION 0x1 | ||
255 | |||
256 | struct ip_vs_flags { | ||
257 | __be32 flags; | ||
258 | __be32 mask; | ||
259 | }; | ||
260 | |||
261 | /* Generic Netlink command attributes */ | ||
262 | enum { | ||
263 | IPVS_CMD_UNSPEC = 0, | ||
264 | |||
265 | IPVS_CMD_NEW_SERVICE, /* add service */ | ||
266 | IPVS_CMD_SET_SERVICE, /* modify service */ | ||
267 | IPVS_CMD_DEL_SERVICE, /* delete service */ | ||
268 | IPVS_CMD_GET_SERVICE, /* get service info */ | ||
269 | |||
270 | IPVS_CMD_NEW_DEST, /* add destination */ | ||
271 | IPVS_CMD_SET_DEST, /* modify destination */ | ||
272 | IPVS_CMD_DEL_DEST, /* delete destination */ | ||
273 | IPVS_CMD_GET_DEST, /* get destination info */ | ||
274 | |||
275 | IPVS_CMD_NEW_DAEMON, /* start sync daemon */ | ||
276 | IPVS_CMD_DEL_DAEMON, /* stop sync daemon */ | ||
277 | IPVS_CMD_GET_DAEMON, /* get sync daemon status */ | ||
278 | |||
279 | IPVS_CMD_SET_CONFIG, /* set config settings */ | ||
280 | IPVS_CMD_GET_CONFIG, /* get config settings */ | ||
281 | |||
282 | IPVS_CMD_SET_INFO, /* only used in GET_INFO reply */ | ||
283 | IPVS_CMD_GET_INFO, /* get general IPVS info */ | ||
284 | |||
285 | IPVS_CMD_ZERO, /* zero all counters and stats */ | ||
286 | IPVS_CMD_FLUSH, /* flush services and dests */ | ||
287 | |||
288 | __IPVS_CMD_MAX, | ||
289 | }; | ||
290 | |||
291 | #define IPVS_CMD_MAX (__IPVS_CMD_MAX - 1) | ||
292 | |||
293 | /* Attributes used in the first level of commands */ | ||
294 | enum { | ||
295 | IPVS_CMD_ATTR_UNSPEC = 0, | ||
296 | IPVS_CMD_ATTR_SERVICE, /* nested service attribute */ | ||
297 | IPVS_CMD_ATTR_DEST, /* nested destination attribute */ | ||
298 | IPVS_CMD_ATTR_DAEMON, /* nested sync daemon attribute */ | ||
299 | IPVS_CMD_ATTR_TIMEOUT_TCP, /* TCP connection timeout */ | ||
300 | IPVS_CMD_ATTR_TIMEOUT_TCP_FIN, /* TCP FIN wait timeout */ | ||
301 | IPVS_CMD_ATTR_TIMEOUT_UDP, /* UDP timeout */ | ||
302 | __IPVS_CMD_ATTR_MAX, | ||
303 | }; | ||
304 | |||
305 | #define IPVS_CMD_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1) | ||
306 | |||
307 | /* | ||
308 | * Attributes used to describe a service | ||
309 | * | ||
310 | * Used inside nested attribute IPVS_CMD_ATTR_SERVICE | ||
311 | */ | ||
312 | enum { | ||
313 | IPVS_SVC_ATTR_UNSPEC = 0, | ||
314 | IPVS_SVC_ATTR_AF, /* address family */ | ||
315 | IPVS_SVC_ATTR_PROTOCOL, /* virtual service protocol */ | ||
316 | IPVS_SVC_ATTR_ADDR, /* virtual service address */ | ||
317 | IPVS_SVC_ATTR_PORT, /* virtual service port */ | ||
318 | IPVS_SVC_ATTR_FWMARK, /* firewall mark of service */ | ||
319 | |||
320 | IPVS_SVC_ATTR_SCHED_NAME, /* name of scheduler */ | ||
321 | IPVS_SVC_ATTR_FLAGS, /* virtual service flags */ | ||
322 | IPVS_SVC_ATTR_TIMEOUT, /* persistent timeout */ | ||
323 | IPVS_SVC_ATTR_NETMASK, /* persistent netmask */ | ||
324 | |||
325 | IPVS_SVC_ATTR_STATS, /* nested attribute for service stats */ | ||
326 | __IPVS_SVC_ATTR_MAX, | ||
327 | }; | ||
328 | |||
329 | #define IPVS_SVC_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1) | ||
330 | |||
331 | /* | ||
332 | * Attributes used to describe a destination (real server) | ||
333 | * | ||
334 | * Used inside nested attribute IPVS_CMD_ATTR_DEST | ||
335 | */ | ||
336 | enum { | ||
337 | IPVS_DEST_ATTR_UNSPEC = 0, | ||
338 | IPVS_DEST_ATTR_ADDR, /* real server address */ | ||
339 | IPVS_DEST_ATTR_PORT, /* real server port */ | ||
340 | |||
341 | IPVS_DEST_ATTR_FWD_METHOD, /* forwarding method */ | ||
342 | IPVS_DEST_ATTR_WEIGHT, /* destination weight */ | ||
343 | |||
344 | IPVS_DEST_ATTR_U_THRESH, /* upper threshold */ | ||
345 | IPVS_DEST_ATTR_L_THRESH, /* lower threshold */ | ||
346 | |||
347 | IPVS_DEST_ATTR_ACTIVE_CONNS, /* active connections */ | ||
348 | IPVS_DEST_ATTR_INACT_CONNS, /* inactive connections */ | ||
349 | IPVS_DEST_ATTR_PERSIST_CONNS, /* persistent connections */ | ||
350 | |||
351 | IPVS_DEST_ATTR_STATS, /* nested attribute for dest stats */ | ||
352 | __IPVS_DEST_ATTR_MAX, | ||
353 | }; | ||
354 | |||
355 | #define IPVS_DEST_ATTR_MAX (__IPVS_DEST_ATTR_MAX - 1) | ||
356 | |||
357 | /* | ||
358 | * Attributes describing a sync daemon | ||
359 | * | ||
360 | * Used inside nested attribute IPVS_CMD_ATTR_DAEMON | ||
361 | */ | ||
362 | enum { | ||
363 | IPVS_DAEMON_ATTR_UNSPEC = 0, | ||
364 | IPVS_DAEMON_ATTR_STATE, /* sync daemon state (master/backup) */ | ||
365 | IPVS_DAEMON_ATTR_MCAST_IFN, /* multicast interface name */ | ||
366 | IPVS_DAEMON_ATTR_SYNC_ID, /* SyncID we belong to */ | ||
367 | __IPVS_DAEMON_ATTR_MAX, | ||
368 | }; | ||
369 | |||
370 | #define IPVS_DAEMON_ATTR_MAX (__IPVS_DAEMON_ATTR_MAX - 1) | ||
371 | |||
372 | /* | ||
373 | * Attributes used to describe service or destination entry statistics | ||
374 | * | ||
375 | * Used inside nested attributes IPVS_SVC_ATTR_STATS and IPVS_DEST_ATTR_STATS | ||
376 | */ | ||
377 | enum { | ||
378 | IPVS_STATS_ATTR_UNSPEC = 0, | ||
379 | IPVS_STATS_ATTR_CONNS, /* connections scheduled */ | ||
380 | IPVS_STATS_ATTR_INPKTS, /* incoming packets */ | ||
381 | IPVS_STATS_ATTR_OUTPKTS, /* outgoing packets */ | ||
382 | IPVS_STATS_ATTR_INBYTES, /* incoming bytes */ | ||
383 | IPVS_STATS_ATTR_OUTBYTES, /* outgoing bytes */ | ||
384 | |||
385 | IPVS_STATS_ATTR_CPS, /* current connection rate */ | ||
386 | IPVS_STATS_ATTR_INPPS, /* current in packet rate */ | ||
387 | IPVS_STATS_ATTR_OUTPPS, /* current out packet rate */ | ||
388 | IPVS_STATS_ATTR_INBPS, /* current in byte rate */ | ||
389 | IPVS_STATS_ATTR_OUTBPS, /* current out byte rate */ | ||
390 | __IPVS_STATS_ATTR_MAX, | ||
391 | }; | ||
392 | |||
393 | #define IPVS_STATS_ATTR_MAX (__IPVS_STATS_ATTR_MAX - 1) | ||
394 | |||
395 | /* Attributes used in response to IPVS_CMD_GET_INFO command */ | ||
396 | enum { | ||
397 | IPVS_INFO_ATTR_UNSPEC = 0, | ||
398 | IPVS_INFO_ATTR_VERSION, /* IPVS version number */ | ||
399 | IPVS_INFO_ATTR_CONN_TAB_SIZE, /* size of connection hash table */ | ||
400 | __IPVS_INFO_ATTR_MAX, | ||
401 | }; | ||
402 | |||
403 | #define IPVS_INFO_ATTR_MAX (__IPVS_INFO_ATTR_MAX - 1) | ||
404 | |||
245 | #endif /* _IP_VS_H */ | 405 | #endif /* _IP_VS_H */ |
diff --git a/include/linux/irq.h b/include/linux/irq.h index 8ccb462ea42c..d058c57be02d 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/spinlock.h> | 18 | #include <linux/spinlock.h> |
19 | #include <linux/cpumask.h> | 19 | #include <linux/cpumask.h> |
20 | #include <linux/irqreturn.h> | 20 | #include <linux/irqreturn.h> |
21 | #include <linux/irqnr.h> | ||
21 | #include <linux/errno.h> | 22 | #include <linux/errno.h> |
22 | 23 | ||
23 | #include <asm/irq.h> | 24 | #include <asm/irq.h> |
@@ -62,6 +63,7 @@ typedef void (*irq_flow_handler_t)(unsigned int irq, | |||
62 | #define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */ | 63 | #define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */ |
63 | #define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */ | 64 | #define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */ |
64 | #define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */ | 65 | #define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */ |
66 | #define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */ | ||
65 | 67 | ||
66 | #ifdef CONFIG_IRQ_PER_CPU | 68 | #ifdef CONFIG_IRQ_PER_CPU |
67 | # define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) | 69 | # define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) |
@@ -151,6 +153,7 @@ struct irq_chip { | |||
151 | * @name: flow handler name for /proc/interrupts output | 153 | * @name: flow handler name for /proc/interrupts output |
152 | */ | 154 | */ |
153 | struct irq_desc { | 155 | struct irq_desc { |
156 | unsigned int irq; | ||
154 | irq_flow_handler_t handle_irq; | 157 | irq_flow_handler_t handle_irq; |
155 | struct irq_chip *chip; | 158 | struct irq_chip *chip; |
156 | struct msi_desc *msi_desc; | 159 | struct msi_desc *msi_desc; |
@@ -169,7 +172,7 @@ struct irq_desc { | |||
169 | cpumask_t affinity; | 172 | cpumask_t affinity; |
170 | unsigned int cpu; | 173 | unsigned int cpu; |
171 | #endif | 174 | #endif |
172 | #if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE) | 175 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
173 | cpumask_t pending_mask; | 176 | cpumask_t pending_mask; |
174 | #endif | 177 | #endif |
175 | #ifdef CONFIG_PROC_FS | 178 | #ifdef CONFIG_PROC_FS |
@@ -178,8 +181,14 @@ struct irq_desc { | |||
178 | const char *name; | 181 | const char *name; |
179 | } ____cacheline_internodealigned_in_smp; | 182 | } ____cacheline_internodealigned_in_smp; |
180 | 183 | ||
184 | |||
181 | extern struct irq_desc irq_desc[NR_IRQS]; | 185 | extern struct irq_desc irq_desc[NR_IRQS]; |
182 | 186 | ||
187 | static inline struct irq_desc *irq_to_desc(unsigned int irq) | ||
188 | { | ||
189 | return (irq < nr_irqs) ? irq_desc + irq : NULL; | ||
190 | } | ||
191 | |||
183 | /* | 192 | /* |
184 | * Migration helpers for obsolete names, they will go away: | 193 | * Migration helpers for obsolete names, they will go away: |
185 | */ | 194 | */ |
@@ -197,19 +206,15 @@ extern int setup_irq(unsigned int irq, struct irqaction *new); | |||
197 | 206 | ||
198 | #ifdef CONFIG_GENERIC_HARDIRQS | 207 | #ifdef CONFIG_GENERIC_HARDIRQS |
199 | 208 | ||
200 | #ifndef handle_dynamic_tick | ||
201 | # define handle_dynamic_tick(a) do { } while (0) | ||
202 | #endif | ||
203 | |||
204 | #ifdef CONFIG_SMP | 209 | #ifdef CONFIG_SMP |
205 | 210 | ||
206 | #if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE) | 211 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
207 | 212 | ||
208 | void set_pending_irq(unsigned int irq, cpumask_t mask); | 213 | void set_pending_irq(unsigned int irq, cpumask_t mask); |
209 | void move_native_irq(int irq); | 214 | void move_native_irq(int irq); |
210 | void move_masked_irq(int irq); | 215 | void move_masked_irq(int irq); |
211 | 216 | ||
212 | #else /* CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE */ | 217 | #else /* CONFIG_GENERIC_PENDING_IRQ */ |
213 | 218 | ||
214 | static inline void move_irq(int irq) | 219 | static inline void move_irq(int irq) |
215 | { | 220 | { |
@@ -236,19 +241,14 @@ static inline void set_pending_irq(unsigned int irq, cpumask_t mask) | |||
236 | 241 | ||
237 | #endif /* CONFIG_SMP */ | 242 | #endif /* CONFIG_SMP */ |
238 | 243 | ||
239 | #ifdef CONFIG_IRQBALANCE | ||
240 | extern void set_balance_irq_affinity(unsigned int irq, cpumask_t mask); | ||
241 | #else | ||
242 | static inline void set_balance_irq_affinity(unsigned int irq, cpumask_t mask) | ||
243 | { | ||
244 | } | ||
245 | #endif | ||
246 | |||
247 | extern int no_irq_affinity; | 244 | extern int no_irq_affinity; |
248 | 245 | ||
249 | static inline int irq_balancing_disabled(unsigned int irq) | 246 | static inline int irq_balancing_disabled(unsigned int irq) |
250 | { | 247 | { |
251 | return irq_desc[irq].status & IRQ_NO_BALANCING_MASK; | 248 | struct irq_desc *desc; |
249 | |||
250 | desc = irq_to_desc(irq); | ||
251 | return desc->status & IRQ_NO_BALANCING_MASK; | ||
252 | } | 252 | } |
253 | 253 | ||
254 | /* Handle irq action chains: */ | 254 | /* Handle irq action chains: */ |
@@ -278,10 +278,8 @@ extern unsigned int __do_IRQ(unsigned int irq); | |||
278 | * irqchip-style controller then we call the ->handle_irq() handler, | 278 | * irqchip-style controller then we call the ->handle_irq() handler, |
279 | * and it calls __do_IRQ() if it's attached to an irqtype-style controller. | 279 | * and it calls __do_IRQ() if it's attached to an irqtype-style controller. |
280 | */ | 280 | */ |
281 | static inline void generic_handle_irq(unsigned int irq) | 281 | static inline void generic_handle_irq_desc(unsigned int irq, struct irq_desc *desc) |
282 | { | 282 | { |
283 | struct irq_desc *desc = irq_desc + irq; | ||
284 | |||
285 | #ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ | 283 | #ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ |
286 | desc->handle_irq(irq, desc); | 284 | desc->handle_irq(irq, desc); |
287 | #else | 285 | #else |
@@ -292,6 +290,11 @@ static inline void generic_handle_irq(unsigned int irq) | |||
292 | #endif | 290 | #endif |
293 | } | 291 | } |
294 | 292 | ||
293 | static inline void generic_handle_irq(unsigned int irq) | ||
294 | { | ||
295 | generic_handle_irq_desc(irq, irq_to_desc(irq)); | ||
296 | } | ||
297 | |||
295 | /* Handling of unhandled and spurious interrupts: */ | 298 | /* Handling of unhandled and spurious interrupts: */ |
296 | extern void note_interrupt(unsigned int irq, struct irq_desc *desc, | 299 | extern void note_interrupt(unsigned int irq, struct irq_desc *desc, |
297 | int action_ret); | 300 | int action_ret); |
@@ -324,7 +327,10 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, | |||
324 | static inline void __set_irq_handler_unlocked(int irq, | 327 | static inline void __set_irq_handler_unlocked(int irq, |
325 | irq_flow_handler_t handler) | 328 | irq_flow_handler_t handler) |
326 | { | 329 | { |
327 | irq_desc[irq].handle_irq = handler; | 330 | struct irq_desc *desc; |
331 | |||
332 | desc = irq_to_desc(irq); | ||
333 | desc->handle_irq = handler; | ||
328 | } | 334 | } |
329 | 335 | ||
330 | /* | 336 | /* |
@@ -352,13 +358,14 @@ extern void set_irq_noprobe(unsigned int irq); | |||
352 | extern void set_irq_probe(unsigned int irq); | 358 | extern void set_irq_probe(unsigned int irq); |
353 | 359 | ||
354 | /* Handle dynamic irq creation and destruction */ | 360 | /* Handle dynamic irq creation and destruction */ |
361 | extern unsigned int create_irq_nr(unsigned int irq_want); | ||
355 | extern int create_irq(void); | 362 | extern int create_irq(void); |
356 | extern void destroy_irq(unsigned int irq); | 363 | extern void destroy_irq(unsigned int irq); |
357 | 364 | ||
358 | /* Test to see if a driver has successfully requested an irq */ | 365 | /* Test to see if a driver has successfully requested an irq */ |
359 | static inline int irq_has_action(unsigned int irq) | 366 | static inline int irq_has_action(unsigned int irq) |
360 | { | 367 | { |
361 | struct irq_desc *desc = irq_desc + irq; | 368 | struct irq_desc *desc = irq_to_desc(irq); |
362 | return desc->action != NULL; | 369 | return desc->action != NULL; |
363 | } | 370 | } |
364 | 371 | ||
@@ -373,10 +380,10 @@ extern int set_irq_chip_data(unsigned int irq, void *data); | |||
373 | extern int set_irq_type(unsigned int irq, unsigned int type); | 380 | extern int set_irq_type(unsigned int irq, unsigned int type); |
374 | extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); | 381 | extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); |
375 | 382 | ||
376 | #define get_irq_chip(irq) (irq_desc[irq].chip) | 383 | #define get_irq_chip(irq) (irq_to_desc(irq)->chip) |
377 | #define get_irq_chip_data(irq) (irq_desc[irq].chip_data) | 384 | #define get_irq_chip_data(irq) (irq_to_desc(irq)->chip_data) |
378 | #define get_irq_data(irq) (irq_desc[irq].handler_data) | 385 | #define get_irq_data(irq) (irq_to_desc(irq)->handler_data) |
379 | #define get_irq_msi(irq) (irq_desc[irq].msi_desc) | 386 | #define get_irq_msi(irq) (irq_to_desc(irq)->msi_desc) |
380 | 387 | ||
381 | #endif /* CONFIG_GENERIC_HARDIRQS */ | 388 | #endif /* CONFIG_GENERIC_HARDIRQS */ |
382 | 389 | ||
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h new file mode 100644 index 000000000000..452c280c8115 --- /dev/null +++ b/include/linux/irqnr.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef _LINUX_IRQNR_H | ||
2 | #define _LINUX_IRQNR_H | ||
3 | |||
4 | #ifndef CONFIG_GENERIC_HARDIRQS | ||
5 | #include <asm/irq.h> | ||
6 | # define nr_irqs NR_IRQS | ||
7 | |||
8 | # define for_each_irq_desc(irq, desc) \ | ||
9 | for (irq = 0; irq < nr_irqs; irq++) | ||
10 | #else | ||
11 | extern int nr_irqs; | ||
12 | |||
13 | # define for_each_irq_desc(irq, desc) \ | ||
14 | for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++) | ||
15 | |||
16 | # define for_each_irq_desc_reverse(irq, desc) \ | ||
17 | for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1); \ | ||
18 | irq >= 0; irq--, desc--) | ||
19 | #endif | ||
20 | |||
21 | #define for_each_irq_nr(irq) \ | ||
22 | for (irq = 0; irq < nr_irqs; irq++) | ||
23 | |||
24 | #endif | ||
diff --git a/include/linux/isdn_ppp.h b/include/linux/isdn_ppp.h index 8687a7dc0632..4c218ee7587a 100644 --- a/include/linux/isdn_ppp.h +++ b/include/linux/isdn_ppp.h | |||
@@ -157,7 +157,7 @@ typedef struct { | |||
157 | 157 | ||
158 | typedef struct { | 158 | typedef struct { |
159 | int mp_mrru; /* unused */ | 159 | int mp_mrru; /* unused */ |
160 | struct sk_buff * frags; /* fragments sl list -- use skb->next */ | 160 | struct sk_buff_head frags; /* fragments sl list */ |
161 | long frames; /* number of frames in the frame list */ | 161 | long frames; /* number of frames in the frame list */ |
162 | unsigned int seq; /* last processed packet seq #: any packets | 162 | unsigned int seq; /* last processed packet seq #: any packets |
163 | * with smaller seq # will be dropped | 163 | * with smaller seq # will be dropped |
diff --git a/include/linux/ivtv.h b/include/linux/ivtv.h index 17ca64b5a66c..f2720280b9ec 100644 --- a/include/linux/ivtv.h +++ b/include/linux/ivtv.h | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include <linux/compiler.h> | 24 | #include <linux/compiler.h> |
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/videodev2.h> | ||
26 | 27 | ||
27 | /* ivtv knows several distinct output modes: MPEG streaming, | 28 | /* ivtv knows several distinct output modes: MPEG streaming, |
28 | YUV streaming, YUV updates through user DMA and the passthrough | 29 | YUV streaming, YUV updates through user DMA and the passthrough |
diff --git a/include/linux/jbd.h b/include/linux/jbd.h index 07a9b52a2654..346e2b80be7d 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h | |||
@@ -61,7 +61,7 @@ extern u8 journal_enable_debug; | |||
61 | do { \ | 61 | do { \ |
62 | if ((n) <= journal_enable_debug) { \ | 62 | if ((n) <= journal_enable_debug) { \ |
63 | printk (KERN_DEBUG "(%s, %d): %s: ", \ | 63 | printk (KERN_DEBUG "(%s, %d): %s: ", \ |
64 | __FILE__, __LINE__, __FUNCTION__); \ | 64 | __FILE__, __LINE__, __func__); \ |
65 | printk (f, ## a); \ | 65 | printk (f, ## a); \ |
66 | } \ | 66 | } \ |
67 | } while (0) | 67 | } while (0) |
@@ -816,6 +816,9 @@ struct journal_s | |||
816 | #define JFS_FLUSHED 0x008 /* The journal superblock has been flushed */ | 816 | #define JFS_FLUSHED 0x008 /* The journal superblock has been flushed */ |
817 | #define JFS_LOADED 0x010 /* The journal superblock has been loaded */ | 817 | #define JFS_LOADED 0x010 /* The journal superblock has been loaded */ |
818 | #define JFS_BARRIER 0x020 /* Use IDE barriers */ | 818 | #define JFS_BARRIER 0x020 /* Use IDE barriers */ |
819 | #define JFS_ABORT_ON_SYNCDATA_ERR 0x040 /* Abort the journal on file | ||
820 | * data write error in ordered | ||
821 | * mode */ | ||
819 | 822 | ||
820 | /* | 823 | /* |
821 | * Function declarations for the journaling transaction and buffer | 824 | * Function declarations for the journaling transaction and buffer |
@@ -908,7 +911,7 @@ extern int journal_set_features | |||
908 | (journal_t *, unsigned long, unsigned long, unsigned long); | 911 | (journal_t *, unsigned long, unsigned long, unsigned long); |
909 | extern int journal_create (journal_t *); | 912 | extern int journal_create (journal_t *); |
910 | extern int journal_load (journal_t *journal); | 913 | extern int journal_load (journal_t *journal); |
911 | extern void journal_destroy (journal_t *); | 914 | extern int journal_destroy (journal_t *); |
912 | extern int journal_recover (journal_t *journal); | 915 | extern int journal_recover (journal_t *journal); |
913 | extern int journal_wipe (journal_t *, int); | 916 | extern int journal_wipe (journal_t *, int); |
914 | extern int journal_skip_recovery (journal_t *); | 917 | extern int journal_skip_recovery (journal_t *); |
@@ -984,7 +987,7 @@ extern int cleanup_journal_tail(journal_t *); | |||
984 | 987 | ||
985 | #define jbd_ENOSYS() \ | 988 | #define jbd_ENOSYS() \ |
986 | do { \ | 989 | do { \ |
987 | printk (KERN_ERR "JBD unimplemented function %s\n", __FUNCTION__); \ | 990 | printk (KERN_ERR "JBD unimplemented function %s\n", __func__); \ |
988 | current->state = TASK_UNINTERRUPTIBLE; \ | 991 | current->state = TASK_UNINTERRUPTIBLE; \ |
989 | schedule(); \ | 992 | schedule(); \ |
990 | } while (1) | 993 | } while (1) |
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 3dd209007098..c7d106ef22e2 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -61,7 +61,7 @@ extern u8 jbd2_journal_enable_debug; | |||
61 | do { \ | 61 | do { \ |
62 | if ((n) <= jbd2_journal_enable_debug) { \ | 62 | if ((n) <= jbd2_journal_enable_debug) { \ |
63 | printk (KERN_DEBUG "(%s, %d): %s: ", \ | 63 | printk (KERN_DEBUG "(%s, %d): %s: ", \ |
64 | __FILE__, __LINE__, __FUNCTION__); \ | 64 | __FILE__, __LINE__, __func__); \ |
65 | printk (f, ## a); \ | 65 | printk (f, ## a); \ |
66 | } \ | 66 | } \ |
67 | } while (0) | 67 | } while (0) |
@@ -641,6 +641,11 @@ struct transaction_s | |||
641 | */ | 641 | */ |
642 | int t_handle_count; | 642 | int t_handle_count; |
643 | 643 | ||
644 | /* | ||
645 | * For use by the filesystem to store fs-specific data | ||
646 | * structures associated with the transaction | ||
647 | */ | ||
648 | struct list_head t_private_list; | ||
644 | }; | 649 | }; |
645 | 650 | ||
646 | struct transaction_run_stats_s { | 651 | struct transaction_run_stats_s { |
@@ -850,7 +855,8 @@ struct journal_s | |||
850 | */ | 855 | */ |
851 | struct block_device *j_dev; | 856 | struct block_device *j_dev; |
852 | int j_blocksize; | 857 | int j_blocksize; |
853 | unsigned long long j_blk_offset; | 858 | unsigned long long j_blk_offset; |
859 | char j_devname[BDEVNAME_SIZE+24]; | ||
854 | 860 | ||
855 | /* | 861 | /* |
856 | * Device which holds the client fs. For internal journal this will be | 862 | * Device which holds the client fs. For internal journal this will be |
@@ -934,6 +940,10 @@ struct journal_s | |||
934 | 940 | ||
935 | pid_t j_last_sync_writer; | 941 | pid_t j_last_sync_writer; |
936 | 942 | ||
943 | /* This function is called when a transaction is closed */ | ||
944 | void (*j_commit_callback)(journal_t *, | ||
945 | transaction_t *); | ||
946 | |||
937 | /* | 947 | /* |
938 | * Journal statistics | 948 | * Journal statistics |
939 | */ | 949 | */ |
@@ -966,6 +976,9 @@ struct journal_s | |||
966 | #define JBD2_FLUSHED 0x008 /* The journal superblock has been flushed */ | 976 | #define JBD2_FLUSHED 0x008 /* The journal superblock has been flushed */ |
967 | #define JBD2_LOADED 0x010 /* The journal superblock has been loaded */ | 977 | #define JBD2_LOADED 0x010 /* The journal superblock has been loaded */ |
968 | #define JBD2_BARRIER 0x020 /* Use IDE barriers */ | 978 | #define JBD2_BARRIER 0x020 /* Use IDE barriers */ |
979 | #define JBD2_ABORT_ON_SYNCDATA_ERR 0x040 /* Abort the journal on file | ||
980 | * data write error in ordered | ||
981 | * mode */ | ||
969 | 982 | ||
970 | /* | 983 | /* |
971 | * Function declarations for the journaling transaction and buffer | 984 | * Function declarations for the journaling transaction and buffer |
@@ -1059,7 +1072,7 @@ extern void jbd2_journal_clear_features | |||
1059 | (journal_t *, unsigned long, unsigned long, unsigned long); | 1072 | (journal_t *, unsigned long, unsigned long, unsigned long); |
1060 | extern int jbd2_journal_create (journal_t *); | 1073 | extern int jbd2_journal_create (journal_t *); |
1061 | extern int jbd2_journal_load (journal_t *journal); | 1074 | extern int jbd2_journal_load (journal_t *journal); |
1062 | extern void jbd2_journal_destroy (journal_t *); | 1075 | extern int jbd2_journal_destroy (journal_t *); |
1063 | extern int jbd2_journal_recover (journal_t *journal); | 1076 | extern int jbd2_journal_recover (journal_t *journal); |
1064 | extern int jbd2_journal_wipe (journal_t *, int); | 1077 | extern int jbd2_journal_wipe (journal_t *, int); |
1065 | extern int jbd2_journal_skip_recovery (journal_t *); | 1078 | extern int jbd2_journal_skip_recovery (journal_t *); |
@@ -1139,7 +1152,7 @@ extern int jbd2_cleanup_journal_tail(journal_t *); | |||
1139 | 1152 | ||
1140 | #define jbd_ENOSYS() \ | 1153 | #define jbd_ENOSYS() \ |
1141 | do { \ | 1154 | do { \ |
1142 | printk (KERN_ERR "JBD unimplemented function %s\n", __FUNCTION__); \ | 1155 | printk (KERN_ERR "JBD unimplemented function %s\n", __func__); \ |
1143 | current->state = TASK_UNINTERRUPTIBLE; \ | 1156 | current->state = TASK_UNINTERRUPTIBLE; \ |
1144 | schedule(); \ | 1157 | schedule(); \ |
1145 | } while (1) | 1158 | } while (1) |
diff --git a/include/linux/journal-head.h b/include/linux/journal-head.h index 8a62d1e84b9b..bb70ebb6a2d5 100644 --- a/include/linux/journal-head.h +++ b/include/linux/journal-head.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * buffer_head fields for JBD | 4 | * buffer_head fields for JBD |
5 | * | 5 | * |
6 | * 27 May 2001 Andrew Morton <akpm@digeo.com> | 6 | * 27 May 2001 Andrew Morton |
7 | * Created - pulled out of fs.h | 7 | * Created - pulled out of fs.h |
8 | */ | 8 | */ |
9 | 9 | ||
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index b96144887444..f3fe34391d8e 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h | |||
@@ -93,12 +93,10 @@ static inline void print_symbol(const char *fmt, unsigned long addr) | |||
93 | } | 93 | } |
94 | 94 | ||
95 | /* | 95 | /* |
96 | * Pretty-print a function pointer. | 96 | * Pretty-print a function pointer. This function is deprecated. |
97 | * | 97 | * Please use the "%pF" vsprintf format instead. |
98 | * ia64 and ppc64 function pointers are really function descriptors, | ||
99 | * which contain a pointer the real address. | ||
100 | */ | 98 | */ |
101 | static inline void print_fn_descriptor_symbol(const char *fmt, void *addr) | 99 | static inline void __deprecated print_fn_descriptor_symbol(const char *fmt, void *addr) |
102 | { | 100 | { |
103 | #if defined(CONFIG_IA64) || defined(CONFIG_PPC64) | 101 | #if defined(CONFIG_IA64) || defined(CONFIG_PPC64) |
104 | addr = *(void **)addr; | 102 | addr = *(void **)addr; |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 2651f805ba6d..dc7e0d0a6474 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/log2.h> | 16 | #include <linux/log2.h> |
17 | #include <linux/typecheck.h> | 17 | #include <linux/typecheck.h> |
18 | #include <linux/ratelimit.h> | 18 | #include <linux/ratelimit.h> |
19 | #include <linux/dynamic_printk.h> | ||
19 | #include <asm/byteorder.h> | 20 | #include <asm/byteorder.h> |
20 | #include <asm/bug.h> | 21 | #include <asm/bug.h> |
21 | 22 | ||
@@ -115,6 +116,8 @@ extern int _cond_resched(void); | |||
115 | # define might_resched() do { } while (0) | 116 | # define might_resched() do { } while (0) |
116 | #endif | 117 | #endif |
117 | 118 | ||
119 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP | ||
120 | void __might_sleep(char *file, int line); | ||
118 | /** | 121 | /** |
119 | * might_sleep - annotation for functions that can sleep | 122 | * might_sleep - annotation for functions that can sleep |
120 | * | 123 | * |
@@ -125,8 +128,6 @@ extern int _cond_resched(void); | |||
125 | * be bitten later when the calling function happens to sleep when it is not | 128 | * be bitten later when the calling function happens to sleep when it is not |
126 | * supposed to. | 129 | * supposed to. |
127 | */ | 130 | */ |
128 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP | ||
129 | void __might_sleep(char *file, int line); | ||
130 | # define might_sleep() \ | 131 | # define might_sleep() \ |
131 | do { __might_sleep(__FILE__, __LINE__); might_resched(); } while (0) | 132 | do { __might_sleep(__FILE__, __LINE__); might_resched(); } while (0) |
132 | #else | 133 | #else |
@@ -182,7 +183,7 @@ extern int vsscanf(const char *, const char *, va_list) | |||
182 | 183 | ||
183 | extern int get_option(char **str, int *pint); | 184 | extern int get_option(char **str, int *pint); |
184 | extern char *get_options(const char *str, int nints, int *ints); | 185 | extern char *get_options(const char *str, int nints, int *ints); |
185 | extern unsigned long long memparse(char *ptr, char **retptr); | 186 | extern unsigned long long memparse(const char *ptr, char **retptr); |
186 | 187 | ||
187 | extern int core_kernel_text(unsigned long addr); | 188 | extern int core_kernel_text(unsigned long addr); |
188 | extern int __kernel_text_address(unsigned long addr); | 189 | extern int __kernel_text_address(unsigned long addr); |
@@ -190,6 +191,30 @@ extern int kernel_text_address(unsigned long addr); | |||
190 | struct pid; | 191 | struct pid; |
191 | extern struct pid *session_of_pgrp(struct pid *pgrp); | 192 | extern struct pid *session_of_pgrp(struct pid *pgrp); |
192 | 193 | ||
194 | /* | ||
195 | * FW_BUG | ||
196 | * Add this to a message where you are sure the firmware is buggy or behaves | ||
197 | * really stupid or out of spec. Be aware that the responsible BIOS developer | ||
198 | * should be able to fix this issue or at least get a concrete idea of the | ||
199 | * problem by reading your message without the need of looking at the kernel | ||
200 | * code. | ||
201 | * | ||
202 | * Use it for definite and high priority BIOS bugs. | ||
203 | * | ||
204 | * FW_WARN | ||
205 | * Use it for not that clear (e.g. could the kernel messed up things already?) | ||
206 | * and medium priority BIOS bugs. | ||
207 | * | ||
208 | * FW_INFO | ||
209 | * Use this one if you want to tell the user or vendor about something | ||
210 | * suspicious, but generally harmless related to the firmware. | ||
211 | * | ||
212 | * Use it for information or very low priority BIOS bugs. | ||
213 | */ | ||
214 | #define FW_BUG "[Firmware Bug]: " | ||
215 | #define FW_WARN "[Firmware Warn]: " | ||
216 | #define FW_INFO "[Firmware Info]: " | ||
217 | |||
193 | #ifdef CONFIG_PRINTK | 218 | #ifdef CONFIG_PRINTK |
194 | asmlinkage int vprintk(const char *fmt, va_list args) | 219 | asmlinkage int vprintk(const char *fmt, va_list args) |
195 | __attribute__ ((format (printf, 1, 0))); | 220 | __attribute__ ((format (printf, 1, 0))); |
@@ -213,6 +238,9 @@ static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ | |||
213 | { return false; } | 238 | { return false; } |
214 | #endif | 239 | #endif |
215 | 240 | ||
241 | extern int printk_needs_cpu(int cpu); | ||
242 | extern void printk_tick(void); | ||
243 | |||
216 | extern void asmlinkage __attribute__((format(printf, 1, 2))) | 244 | extern void asmlinkage __attribute__((format(printf, 1, 2))) |
217 | early_printk(const char *fmt, ...); | 245 | early_printk(const char *fmt, ...); |
218 | 246 | ||
@@ -235,9 +263,10 @@ extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in | |||
235 | extern int panic_timeout; | 263 | extern int panic_timeout; |
236 | extern int panic_on_oops; | 264 | extern int panic_on_oops; |
237 | extern int panic_on_unrecovered_nmi; | 265 | extern int panic_on_unrecovered_nmi; |
238 | extern int tainted; | ||
239 | extern const char *print_tainted(void); | 266 | extern const char *print_tainted(void); |
240 | extern void add_taint(unsigned); | 267 | extern void add_taint(unsigned flag); |
268 | extern int test_taint(unsigned flag); | ||
269 | extern unsigned long get_taint(void); | ||
241 | extern int root_mountflags; | 270 | extern int root_mountflags; |
242 | 271 | ||
243 | /* Values used for system_state */ | 272 | /* Values used for system_state */ |
@@ -250,16 +279,17 @@ extern enum system_states { | |||
250 | SYSTEM_SUSPEND_DISK, | 279 | SYSTEM_SUSPEND_DISK, |
251 | } system_state; | 280 | } system_state; |
252 | 281 | ||
253 | #define TAINT_PROPRIETARY_MODULE (1<<0) | 282 | #define TAINT_PROPRIETARY_MODULE 0 |
254 | #define TAINT_FORCED_MODULE (1<<1) | 283 | #define TAINT_FORCED_MODULE 1 |
255 | #define TAINT_UNSAFE_SMP (1<<2) | 284 | #define TAINT_UNSAFE_SMP 2 |
256 | #define TAINT_FORCED_RMMOD (1<<3) | 285 | #define TAINT_FORCED_RMMOD 3 |
257 | #define TAINT_MACHINE_CHECK (1<<4) | 286 | #define TAINT_MACHINE_CHECK 4 |
258 | #define TAINT_BAD_PAGE (1<<5) | 287 | #define TAINT_BAD_PAGE 5 |
259 | #define TAINT_USER (1<<6) | 288 | #define TAINT_USER 6 |
260 | #define TAINT_DIE (1<<7) | 289 | #define TAINT_DIE 7 |
261 | #define TAINT_OVERRIDDEN_ACPI_TABLE (1<<8) | 290 | #define TAINT_OVERRIDDEN_ACPI_TABLE 8 |
262 | #define TAINT_WARN (1<<9) | 291 | #define TAINT_WARN 9 |
292 | #define TAINT_CRAP 10 | ||
263 | 293 | ||
264 | extern void dump_stack(void) __cold; | 294 | extern void dump_stack(void) __cold; |
265 | 295 | ||
@@ -288,28 +318,36 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
288 | return buf; | 318 | return buf; |
289 | } | 319 | } |
290 | 320 | ||
291 | #define pr_emerg(fmt, arg...) \ | 321 | #ifndef pr_fmt |
292 | printk(KERN_EMERG fmt, ##arg) | 322 | #define pr_fmt(fmt) fmt |
293 | #define pr_alert(fmt, arg...) \ | 323 | #endif |
294 | printk(KERN_ALERT fmt, ##arg) | 324 | |
295 | #define pr_crit(fmt, arg...) \ | 325 | #define pr_emerg(fmt, ...) \ |
296 | printk(KERN_CRIT fmt, ##arg) | 326 | printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) |
297 | #define pr_err(fmt, arg...) \ | 327 | #define pr_alert(fmt, ...) \ |
298 | printk(KERN_ERR fmt, ##arg) | 328 | printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) |
299 | #define pr_warning(fmt, arg...) \ | 329 | #define pr_crit(fmt, ...) \ |
300 | printk(KERN_WARNING fmt, ##arg) | 330 | printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) |
301 | #define pr_notice(fmt, arg...) \ | 331 | #define pr_err(fmt, ...) \ |
302 | printk(KERN_NOTICE fmt, ##arg) | 332 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
303 | #define pr_info(fmt, arg...) \ | 333 | #define pr_warning(fmt, ...) \ |
304 | printk(KERN_INFO fmt, ##arg) | 334 | printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
305 | 335 | #define pr_notice(fmt, ...) \ | |
306 | #ifdef DEBUG | 336 | printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
337 | #define pr_info(fmt, ...) \ | ||
338 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) | ||
339 | |||
307 | /* If you are writing a driver, please use dev_dbg instead */ | 340 | /* If you are writing a driver, please use dev_dbg instead */ |
308 | #define pr_debug(fmt, arg...) \ | 341 | #if defined(CONFIG_DYNAMIC_PRINTK_DEBUG) |
309 | printk(KERN_DEBUG fmt, ##arg) | 342 | #define pr_debug(fmt, ...) do { \ |
343 | dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \ | ||
344 | } while (0) | ||
345 | #elif defined(DEBUG) | ||
346 | #define pr_debug(fmt, ...) \ | ||
347 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) | ||
310 | #else | 348 | #else |
311 | #define pr_debug(fmt, arg...) \ | 349 | #define pr_debug(fmt, ...) \ |
312 | ({ if (0) printk(KERN_DEBUG fmt, ##arg); 0; }) | 350 | ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; }) |
313 | #endif | 351 | #endif |
314 | 352 | ||
315 | /* | 353 | /* |
@@ -486,4 +524,9 @@ struct sysinfo { | |||
486 | #define NUMA_BUILD 0 | 524 | #define NUMA_BUILD 0 |
487 | #endif | 525 | #endif |
488 | 526 | ||
527 | /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ | ||
528 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | ||
529 | # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD | ||
530 | #endif | ||
531 | |||
489 | #endif | 532 | #endif |
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index cf9f40a91c9c..4a145caeee07 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h | |||
@@ -39,19 +39,34 @@ DECLARE_PER_CPU(struct kernel_stat, kstat); | |||
39 | 39 | ||
40 | extern unsigned long long nr_context_switches(void); | 40 | extern unsigned long long nr_context_switches(void); |
41 | 41 | ||
42 | struct irq_desc; | ||
43 | |||
44 | static inline void kstat_incr_irqs_this_cpu(unsigned int irq, | ||
45 | struct irq_desc *desc) | ||
46 | { | ||
47 | kstat_this_cpu.irqs[irq]++; | ||
48 | } | ||
49 | |||
50 | static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) | ||
51 | { | ||
52 | return kstat_cpu(cpu).irqs[irq]; | ||
53 | } | ||
54 | |||
42 | /* | 55 | /* |
43 | * Number of interrupts per specific IRQ source, since bootup | 56 | * Number of interrupts per specific IRQ source, since bootup |
44 | */ | 57 | */ |
45 | static inline int kstat_irqs(int irq) | 58 | static inline unsigned int kstat_irqs(unsigned int irq) |
46 | { | 59 | { |
47 | int cpu, sum = 0; | 60 | unsigned int sum = 0; |
61 | int cpu; | ||
48 | 62 | ||
49 | for_each_possible_cpu(cpu) | 63 | for_each_possible_cpu(cpu) |
50 | sum += kstat_cpu(cpu).irqs[irq]; | 64 | sum += kstat_irqs_cpu(irq, cpu); |
51 | 65 | ||
52 | return sum; | 66 | return sum; |
53 | } | 67 | } |
54 | 68 | ||
69 | extern unsigned long long task_delta_exec(struct task_struct *); | ||
55 | extern void account_user_time(struct task_struct *, cputime_t); | 70 | extern void account_user_time(struct task_struct *, cputime_t); |
56 | extern void account_user_time_scaled(struct task_struct *, cputime_t); | 71 | extern void account_user_time_scaled(struct task_struct *, cputime_t); |
57 | extern void account_system_time(struct task_struct *, int, cputime_t); | 72 | extern void account_system_time(struct task_struct *, int, cputime_t); |
diff --git a/include/linux/key.h b/include/linux/key.h index c45c962d1cc5..1b70e35a71e3 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
@@ -299,6 +299,7 @@ extern void key_init(void); | |||
299 | #define key_validate(k) 0 | 299 | #define key_validate(k) 0 |
300 | #define key_serial(k) 0 | 300 | #define key_serial(k) 0 |
301 | #define key_get(k) ({ NULL; }) | 301 | #define key_get(k) ({ NULL; }) |
302 | #define key_revoke(k) do { } while(0) | ||
302 | #define key_put(k) do { } while(0) | 303 | #define key_put(k) do { } while(0) |
303 | #define key_ref_put(k) do { } while(0) | 304 | #define key_ref_put(k) do { } while(0) |
304 | #define make_key_ref(k, p) ({ NULL; }) | 305 | #define make_key_ref(k, p) ({ NULL; }) |
diff --git a/include/linux/klist.h b/include/linux/klist.h index 06c338ef7f1b..8ea98db223e5 100644 --- a/include/linux/klist.h +++ b/include/linux/klist.h | |||
@@ -38,7 +38,7 @@ extern void klist_init(struct klist *k, void (*get)(struct klist_node *), | |||
38 | void (*put)(struct klist_node *)); | 38 | void (*put)(struct klist_node *)); |
39 | 39 | ||
40 | struct klist_node { | 40 | struct klist_node { |
41 | struct klist *n_klist; | 41 | void *n_klist; /* never access directly */ |
42 | struct list_head n_node; | 42 | struct list_head n_node; |
43 | struct kref n_ref; | 43 | struct kref n_ref; |
44 | struct completion n_removed; | 44 | struct completion n_removed; |
@@ -57,7 +57,6 @@ extern int klist_node_attached(struct klist_node *n); | |||
57 | 57 | ||
58 | struct klist_iter { | 58 | struct klist_iter { |
59 | struct klist *i_klist; | 59 | struct klist *i_klist; |
60 | struct list_head *i_head; | ||
61 | struct klist_node *i_cur; | 60 | struct klist_node *i_cur; |
62 | }; | 61 | }; |
63 | 62 | ||
diff --git a/include/linux/kmod.h b/include/linux/kmod.h index a1a91577813c..92213a9194e1 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h | |||
@@ -99,4 +99,7 @@ struct file; | |||
99 | extern int call_usermodehelper_pipe(char *path, char *argv[], char *envp[], | 99 | extern int call_usermodehelper_pipe(char *path, char *argv[], char *envp[], |
100 | struct file **filp); | 100 | struct file **filp); |
101 | 101 | ||
102 | extern int usermodehelper_disable(void); | ||
103 | extern void usermodehelper_enable(void); | ||
104 | |||
102 | #endif /* __LINUX_KMOD_H__ */ | 105 | #endif /* __LINUX_KMOD_H__ */ |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 0be7795655fa..497b1d1f7a05 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -29,6 +29,7 @@ | |||
29 | * <jkenisto@us.ibm.com> and Prasanna S Panchamukhi | 29 | * <jkenisto@us.ibm.com> and Prasanna S Panchamukhi |
30 | * <prasanna@in.ibm.com> added function-return probes. | 30 | * <prasanna@in.ibm.com> added function-return probes. |
31 | */ | 31 | */ |
32 | #include <linux/linkage.h> | ||
32 | #include <linux/list.h> | 33 | #include <linux/list.h> |
33 | #include <linux/notifier.h> | 34 | #include <linux/notifier.h> |
34 | #include <linux/smp.h> | 35 | #include <linux/smp.h> |
@@ -47,7 +48,7 @@ | |||
47 | #define KPROBE_HIT_SSDONE 0x00000008 | 48 | #define KPROBE_HIT_SSDONE 0x00000008 |
48 | 49 | ||
49 | /* Attach to insert probes on any functions which should be ignored*/ | 50 | /* Attach to insert probes on any functions which should be ignored*/ |
50 | #define __kprobes __attribute__((__section__(".kprobes.text"))) | 51 | #define __kprobes __attribute__((__section__(".kprobes.text"))) notrace |
51 | 52 | ||
52 | struct kprobe; | 53 | struct kprobe; |
53 | struct pt_regs; | 54 | struct pt_regs; |
@@ -256,7 +257,7 @@ void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); | |||
256 | 257 | ||
257 | #else /* CONFIG_KPROBES */ | 258 | #else /* CONFIG_KPROBES */ |
258 | 259 | ||
259 | #define __kprobes /**/ | 260 | #define __kprobes notrace |
260 | struct jprobe; | 261 | struct jprobe; |
261 | struct kretprobe; | 262 | struct kretprobe; |
262 | 263 | ||
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 70a30651cd12..f18b86fa8655 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -311,22 +311,33 @@ struct kvm_s390_interrupt { | |||
311 | 311 | ||
312 | /* This structure represents a single trace buffer record. */ | 312 | /* This structure represents a single trace buffer record. */ |
313 | struct kvm_trace_rec { | 313 | struct kvm_trace_rec { |
314 | __u32 event:28; | 314 | /* variable rec_val |
315 | __u32 extra_u32:3; | 315 | * is split into: |
316 | __u32 cycle_in:1; | 316 | * bits 0 - 27 -> event id |
317 | * bits 28 -30 -> number of extra data args of size u32 | ||
318 | * bits 31 -> binary indicator for if tsc is in record | ||
319 | */ | ||
320 | __u32 rec_val; | ||
317 | __u32 pid; | 321 | __u32 pid; |
318 | __u32 vcpu_id; | 322 | __u32 vcpu_id; |
319 | union { | 323 | union { |
320 | struct { | 324 | struct { |
321 | __u64 cycle_u64; | 325 | __u64 timestamp; |
322 | __u32 extra_u32[KVM_TRC_EXTRA_MAX]; | 326 | __u32 extra_u32[KVM_TRC_EXTRA_MAX]; |
323 | } __attribute__((packed)) cycle; | 327 | } __attribute__((packed)) timestamp; |
324 | struct { | 328 | struct { |
325 | __u32 extra_u32[KVM_TRC_EXTRA_MAX]; | 329 | __u32 extra_u32[KVM_TRC_EXTRA_MAX]; |
326 | } nocycle; | 330 | } notimestamp; |
327 | } u; | 331 | } u; |
328 | }; | 332 | }; |
329 | 333 | ||
334 | #define TRACE_REC_EVENT_ID(val) \ | ||
335 | (0x0fffffff & (val)) | ||
336 | #define TRACE_REC_NUM_DATA_ARGS(val) \ | ||
337 | (0x70000000 & ((val) << 28)) | ||
338 | #define TRACE_REC_TCS(val) \ | ||
339 | (0x80000000 & ((val) << 31)) | ||
340 | |||
330 | #define KVMIO 0xAE | 341 | #define KVMIO 0xAE |
331 | 342 | ||
332 | /* | 343 | /* |
@@ -372,6 +383,10 @@ struct kvm_trace_rec { | |||
372 | #define KVM_CAP_MP_STATE 14 | 383 | #define KVM_CAP_MP_STATE 14 |
373 | #define KVM_CAP_COALESCED_MMIO 15 | 384 | #define KVM_CAP_COALESCED_MMIO 15 |
374 | #define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */ | 385 | #define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */ |
386 | #if defined(CONFIG_X86)||defined(CONFIG_IA64) | ||
387 | #define KVM_CAP_DEVICE_ASSIGNMENT 17 | ||
388 | #endif | ||
389 | #define KVM_CAP_IOMMU 18 | ||
375 | 390 | ||
376 | /* | 391 | /* |
377 | * ioctls for VM fds | 392 | * ioctls for VM fds |
@@ -401,6 +416,10 @@ struct kvm_trace_rec { | |||
401 | _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone) | 416 | _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone) |
402 | #define KVM_UNREGISTER_COALESCED_MMIO \ | 417 | #define KVM_UNREGISTER_COALESCED_MMIO \ |
403 | _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone) | 418 | _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone) |
419 | #define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \ | ||
420 | struct kvm_assigned_pci_dev) | ||
421 | #define KVM_ASSIGN_IRQ _IOR(KVMIO, 0x70, \ | ||
422 | struct kvm_assigned_irq) | ||
404 | 423 | ||
405 | /* | 424 | /* |
406 | * ioctls for vcpu fds | 425 | * ioctls for vcpu fds |
@@ -440,4 +459,51 @@ struct kvm_trace_rec { | |||
440 | #define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state) | 459 | #define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state) |
441 | #define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state) | 460 | #define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state) |
442 | 461 | ||
462 | #define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02) | ||
463 | #define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03) | ||
464 | #define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04) | ||
465 | #define KVM_TRC_IO_READ (KVM_TRC_HANDLER + 0x05) | ||
466 | #define KVM_TRC_IO_WRITE (KVM_TRC_HANDLER + 0x06) | ||
467 | #define KVM_TRC_CR_READ (KVM_TRC_HANDLER + 0x07) | ||
468 | #define KVM_TRC_CR_WRITE (KVM_TRC_HANDLER + 0x08) | ||
469 | #define KVM_TRC_DR_READ (KVM_TRC_HANDLER + 0x09) | ||
470 | #define KVM_TRC_DR_WRITE (KVM_TRC_HANDLER + 0x0A) | ||
471 | #define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B) | ||
472 | #define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C) | ||
473 | #define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D) | ||
474 | #define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E) | ||
475 | #define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F) | ||
476 | #define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10) | ||
477 | #define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11) | ||
478 | #define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12) | ||
479 | #define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13) | ||
480 | #define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14) | ||
481 | #define KVM_TRC_TDP_FAULT (KVM_TRC_HANDLER + 0x15) | ||
482 | #define KVM_TRC_GTLB_WRITE (KVM_TRC_HANDLER + 0x16) | ||
483 | #define KVM_TRC_STLB_WRITE (KVM_TRC_HANDLER + 0x17) | ||
484 | #define KVM_TRC_STLB_INVAL (KVM_TRC_HANDLER + 0x18) | ||
485 | #define KVM_TRC_PPC_INSTR (KVM_TRC_HANDLER + 0x19) | ||
486 | |||
487 | struct kvm_assigned_pci_dev { | ||
488 | __u32 assigned_dev_id; | ||
489 | __u32 busnr; | ||
490 | __u32 devfn; | ||
491 | __u32 flags; | ||
492 | union { | ||
493 | __u32 reserved[12]; | ||
494 | }; | ||
495 | }; | ||
496 | |||
497 | struct kvm_assigned_irq { | ||
498 | __u32 assigned_dev_id; | ||
499 | __u32 host_irq; | ||
500 | __u32 guest_irq; | ||
501 | __u32 flags; | ||
502 | union { | ||
503 | __u32 reserved[12]; | ||
504 | }; | ||
505 | }; | ||
506 | |||
507 | #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) | ||
508 | |||
443 | #endif | 509 | #endif |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 8525afc53107..bb92be2153bc 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -34,6 +34,10 @@ | |||
34 | #define KVM_REQ_MMU_RELOAD 3 | 34 | #define KVM_REQ_MMU_RELOAD 3 |
35 | #define KVM_REQ_TRIPLE_FAULT 4 | 35 | #define KVM_REQ_TRIPLE_FAULT 4 |
36 | #define KVM_REQ_PENDING_TIMER 5 | 36 | #define KVM_REQ_PENDING_TIMER 5 |
37 | #define KVM_REQ_UNHALT 6 | ||
38 | #define KVM_REQ_MMU_SYNC 7 | ||
39 | |||
40 | #define KVM_USERSPACE_IRQ_SOURCE_ID 0 | ||
37 | 41 | ||
38 | struct kvm_vcpu; | 42 | struct kvm_vcpu; |
39 | extern struct kmem_cache *kvm_vcpu_cache; | 43 | extern struct kmem_cache *kvm_vcpu_cache; |
@@ -279,12 +283,71 @@ void kvm_free_physmem(struct kvm *kvm); | |||
279 | 283 | ||
280 | struct kvm *kvm_arch_create_vm(void); | 284 | struct kvm *kvm_arch_create_vm(void); |
281 | void kvm_arch_destroy_vm(struct kvm *kvm); | 285 | void kvm_arch_destroy_vm(struct kvm *kvm); |
286 | void kvm_free_all_assigned_devices(struct kvm *kvm); | ||
282 | 287 | ||
283 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); | 288 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); |
284 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v); | 289 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v); |
285 | int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); | 290 | int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); |
286 | void kvm_vcpu_kick(struct kvm_vcpu *vcpu); | 291 | void kvm_vcpu_kick(struct kvm_vcpu *vcpu); |
287 | 292 | ||
293 | int kvm_is_mmio_pfn(pfn_t pfn); | ||
294 | |||
295 | struct kvm_irq_ack_notifier { | ||
296 | struct hlist_node link; | ||
297 | unsigned gsi; | ||
298 | void (*irq_acked)(struct kvm_irq_ack_notifier *kian); | ||
299 | }; | ||
300 | |||
301 | struct kvm_assigned_dev_kernel { | ||
302 | struct kvm_irq_ack_notifier ack_notifier; | ||
303 | struct work_struct interrupt_work; | ||
304 | struct list_head list; | ||
305 | int assigned_dev_id; | ||
306 | int host_busnr; | ||
307 | int host_devfn; | ||
308 | int host_irq; | ||
309 | int guest_irq; | ||
310 | int irq_requested; | ||
311 | int irq_source_id; | ||
312 | struct pci_dev *dev; | ||
313 | struct kvm *kvm; | ||
314 | }; | ||
315 | void kvm_set_irq(struct kvm *kvm, int irq_source_id, int irq, int level); | ||
316 | void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi); | ||
317 | void kvm_register_irq_ack_notifier(struct kvm *kvm, | ||
318 | struct kvm_irq_ack_notifier *kian); | ||
319 | void kvm_unregister_irq_ack_notifier(struct kvm *kvm, | ||
320 | struct kvm_irq_ack_notifier *kian); | ||
321 | int kvm_request_irq_source_id(struct kvm *kvm); | ||
322 | void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); | ||
323 | |||
324 | #ifdef CONFIG_DMAR | ||
325 | int kvm_iommu_map_pages(struct kvm *kvm, gfn_t base_gfn, | ||
326 | unsigned long npages); | ||
327 | int kvm_iommu_map_guest(struct kvm *kvm, | ||
328 | struct kvm_assigned_dev_kernel *assigned_dev); | ||
329 | int kvm_iommu_unmap_guest(struct kvm *kvm); | ||
330 | #else /* CONFIG_DMAR */ | ||
331 | static inline int kvm_iommu_map_pages(struct kvm *kvm, | ||
332 | gfn_t base_gfn, | ||
333 | unsigned long npages) | ||
334 | { | ||
335 | return 0; | ||
336 | } | ||
337 | |||
338 | static inline int kvm_iommu_map_guest(struct kvm *kvm, | ||
339 | struct kvm_assigned_dev_kernel | ||
340 | *assigned_dev) | ||
341 | { | ||
342 | return -ENODEV; | ||
343 | } | ||
344 | |||
345 | static inline int kvm_iommu_unmap_guest(struct kvm *kvm) | ||
346 | { | ||
347 | return 0; | ||
348 | } | ||
349 | #endif /* CONFIG_DMAR */ | ||
350 | |||
288 | static inline void kvm_guest_enter(void) | 351 | static inline void kvm_guest_enter(void) |
289 | { | 352 | { |
290 | account_system_vtime(current); | 353 | account_system_vtime(current); |
@@ -307,6 +370,11 @@ static inline gpa_t gfn_to_gpa(gfn_t gfn) | |||
307 | return (gpa_t)gfn << PAGE_SHIFT; | 370 | return (gpa_t)gfn << PAGE_SHIFT; |
308 | } | 371 | } |
309 | 372 | ||
373 | static inline hpa_t pfn_to_hpa(pfn_t pfn) | ||
374 | { | ||
375 | return (hpa_t)pfn << PAGE_SHIFT; | ||
376 | } | ||
377 | |||
310 | static inline void kvm_migrate_timers(struct kvm_vcpu *vcpu) | 378 | static inline void kvm_migrate_timers(struct kvm_vcpu *vcpu) |
311 | { | 379 | { |
312 | set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests); | 380 | set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests); |
@@ -326,6 +394,25 @@ struct kvm_stats_debugfs_item { | |||
326 | extern struct kvm_stats_debugfs_item debugfs_entries[]; | 394 | extern struct kvm_stats_debugfs_item debugfs_entries[]; |
327 | extern struct dentry *kvm_debugfs_dir; | 395 | extern struct dentry *kvm_debugfs_dir; |
328 | 396 | ||
397 | #define KVMTRACE_5D(evt, vcpu, d1, d2, d3, d4, d5, name) \ | ||
398 | trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \ | ||
399 | vcpu, 5, d1, d2, d3, d4, d5) | ||
400 | #define KVMTRACE_4D(evt, vcpu, d1, d2, d3, d4, name) \ | ||
401 | trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \ | ||
402 | vcpu, 4, d1, d2, d3, d4, 0) | ||
403 | #define KVMTRACE_3D(evt, vcpu, d1, d2, d3, name) \ | ||
404 | trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \ | ||
405 | vcpu, 3, d1, d2, d3, 0, 0) | ||
406 | #define KVMTRACE_2D(evt, vcpu, d1, d2, name) \ | ||
407 | trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \ | ||
408 | vcpu, 2, d1, d2, 0, 0, 0) | ||
409 | #define KVMTRACE_1D(evt, vcpu, d1, name) \ | ||
410 | trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \ | ||
411 | vcpu, 1, d1, 0, 0, 0, 0) | ||
412 | #define KVMTRACE_0D(evt, vcpu, name) \ | ||
413 | trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \ | ||
414 | vcpu, 0, 0, 0, 0, 0, 0) | ||
415 | |||
329 | #ifdef CONFIG_KVM_TRACE | 416 | #ifdef CONFIG_KVM_TRACE |
330 | int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg); | 417 | int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg); |
331 | void kvm_trace_cleanup(void); | 418 | void kvm_trace_cleanup(void); |
diff --git a/include/linux/lcd.h b/include/linux/lcd.h index 173febac6656..c67fecafff90 100644 --- a/include/linux/lcd.h +++ b/include/linux/lcd.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/device.h> | 11 | #include <linux/device.h> |
12 | #include <linux/mutex.h> | 12 | #include <linux/mutex.h> |
13 | #include <linux/notifier.h> | 13 | #include <linux/notifier.h> |
14 | #include <linux/fb.h> | ||
14 | 15 | ||
15 | /* Notes on locking: | 16 | /* Notes on locking: |
16 | * | 17 | * |
@@ -45,6 +46,8 @@ struct lcd_ops { | |||
45 | int (*get_contrast)(struct lcd_device *); | 46 | int (*get_contrast)(struct lcd_device *); |
46 | /* Set LCD panel contrast */ | 47 | /* Set LCD panel contrast */ |
47 | int (*set_contrast)(struct lcd_device *, int contrast); | 48 | int (*set_contrast)(struct lcd_device *, int contrast); |
49 | /* Set LCD panel mode (resolutions ...) */ | ||
50 | int (*set_mode)(struct lcd_device *, struct fb_videomode *); | ||
48 | /* Check if given framebuffer device is the one LCD is bound to; | 51 | /* Check if given framebuffer device is the one LCD is bound to; |
49 | return 0 if not, !=0 if it is. If NULL, lcd always matches the fb. */ | 52 | return 0 if not, !=0 if it is. If NULL, lcd always matches the fb. */ |
50 | int (*check_fb)(struct lcd_device *, struct fb_info *); | 53 | int (*check_fb)(struct lcd_device *, struct fb_info *); |
diff --git a/include/linux/leds.h b/include/linux/leds.h index d41ccb56146a..d3a73f5a48c3 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h | |||
@@ -123,7 +123,7 @@ extern void ledtrig_ide_activity(void); | |||
123 | */ | 123 | */ |
124 | struct led_info { | 124 | struct led_info { |
125 | const char *name; | 125 | const char *name; |
126 | char *default_trigger; | 126 | const char *default_trigger; |
127 | int flags; | 127 | int flags; |
128 | }; | 128 | }; |
129 | 129 | ||
@@ -135,7 +135,7 @@ struct led_platform_data { | |||
135 | /* For the leds-gpio driver */ | 135 | /* For the leds-gpio driver */ |
136 | struct gpio_led { | 136 | struct gpio_led { |
137 | const char *name; | 137 | const char *name; |
138 | char *default_trigger; | 138 | const char *default_trigger; |
139 | unsigned gpio; | 139 | unsigned gpio; |
140 | u8 active_low; | 140 | u8 active_low; |
141 | }; | 141 | }; |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 225bfc5bd9ec..59b0f1c807b5 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -146,6 +146,7 @@ enum { | |||
146 | ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */ | 146 | ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */ |
147 | ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */ | 147 | ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */ |
148 | ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ | 148 | ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ |
149 | ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */ | ||
149 | ATA_DFLAG_INIT_MASK = (1 << 24) - 1, | 150 | ATA_DFLAG_INIT_MASK = (1 << 24) - 1, |
150 | 151 | ||
151 | ATA_DFLAG_DETACH = (1 << 24), | 152 | ATA_DFLAG_DETACH = (1 << 24), |
@@ -244,6 +245,7 @@ enum { | |||
244 | ATA_TMOUT_BOOT = 30000, /* heuristic */ | 245 | ATA_TMOUT_BOOT = 30000, /* heuristic */ |
245 | ATA_TMOUT_BOOT_QUICK = 7000, /* heuristic */ | 246 | ATA_TMOUT_BOOT_QUICK = 7000, /* heuristic */ |
246 | ATA_TMOUT_INTERNAL_QUICK = 5000, | 247 | ATA_TMOUT_INTERNAL_QUICK = 5000, |
248 | ATA_TMOUT_MAX_PARK = 30000, | ||
247 | 249 | ||
248 | /* FIXME: GoVault needs 2s but we can't afford that without | 250 | /* FIXME: GoVault needs 2s but we can't afford that without |
249 | * parallel probing. 800ms is enough for iVDR disk | 251 | * parallel probing. 800ms is enough for iVDR disk |
@@ -319,8 +321,11 @@ enum { | |||
319 | ATA_EH_RESET = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, | 321 | ATA_EH_RESET = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, |
320 | ATA_EH_ENABLE_LINK = (1 << 3), | 322 | ATA_EH_ENABLE_LINK = (1 << 3), |
321 | ATA_EH_LPM = (1 << 4), /* link power management action */ | 323 | ATA_EH_LPM = (1 << 4), /* link power management action */ |
324 | ATA_EH_PARK = (1 << 5), /* unload heads and stop I/O */ | ||
322 | 325 | ||
323 | ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE, | 326 | ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE | ATA_EH_PARK, |
327 | ATA_EH_ALL_ACTIONS = ATA_EH_REVALIDATE | ATA_EH_RESET | | ||
328 | ATA_EH_ENABLE_LINK | ATA_EH_LPM, | ||
324 | 329 | ||
325 | /* ata_eh_info->flags */ | 330 | /* ata_eh_info->flags */ |
326 | ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ | 331 | ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ |
@@ -335,6 +340,9 @@ enum { | |||
335 | 340 | ||
336 | ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET, | 341 | ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET, |
337 | 342 | ||
343 | /* mask of flags to transfer *to* the slave link */ | ||
344 | ATA_EHI_TO_SLAVE_MASK = ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, | ||
345 | |||
338 | /* max tries if error condition is still set after ->error_handler */ | 346 | /* max tries if error condition is still set after ->error_handler */ |
339 | ATA_EH_MAX_TRIES = 5, | 347 | ATA_EH_MAX_TRIES = 5, |
340 | 348 | ||
@@ -364,6 +372,9 @@ enum { | |||
364 | ATA_HORKAGE_IPM = (1 << 7), /* Link PM problems */ | 372 | ATA_HORKAGE_IPM = (1 << 7), /* Link PM problems */ |
365 | ATA_HORKAGE_IVB = (1 << 8), /* cbl det validity bit bugs */ | 373 | ATA_HORKAGE_IVB = (1 << 8), /* cbl det validity bit bugs */ |
366 | ATA_HORKAGE_STUCK_ERR = (1 << 9), /* stuck ERR on next PACKET */ | 374 | ATA_HORKAGE_STUCK_ERR = (1 << 9), /* stuck ERR on next PACKET */ |
375 | ATA_HORKAGE_BRIDGE_OK = (1 << 10), /* no bridge limits */ | ||
376 | ATA_HORKAGE_ATAPI_MOD16_DMA = (1 << 11), /* use ATAPI DMA for commands | ||
377 | not multiple of 16 bytes */ | ||
367 | 378 | ||
368 | /* DMA mask for user DMA control: User visible values; DO NOT | 379 | /* DMA mask for user DMA control: User visible values; DO NOT |
369 | renumber */ | 380 | renumber */ |
@@ -452,6 +463,7 @@ enum link_pm { | |||
452 | MEDIUM_POWER, | 463 | MEDIUM_POWER, |
453 | }; | 464 | }; |
454 | extern struct device_attribute dev_attr_link_power_management_policy; | 465 | extern struct device_attribute dev_attr_link_power_management_policy; |
466 | extern struct device_attribute dev_attr_unload_heads; | ||
455 | extern struct device_attribute dev_attr_em_message_type; | 467 | extern struct device_attribute dev_attr_em_message_type; |
456 | extern struct device_attribute dev_attr_em_message; | 468 | extern struct device_attribute dev_attr_em_message; |
457 | extern struct device_attribute dev_attr_sw_activity; | 469 | extern struct device_attribute dev_attr_sw_activity; |
@@ -554,8 +566,8 @@ struct ata_ering { | |||
554 | struct ata_device { | 566 | struct ata_device { |
555 | struct ata_link *link; | 567 | struct ata_link *link; |
556 | unsigned int devno; /* 0 or 1 */ | 568 | unsigned int devno; /* 0 or 1 */ |
557 | unsigned long flags; /* ATA_DFLAG_xxx */ | ||
558 | unsigned int horkage; /* List of broken features */ | 569 | unsigned int horkage; /* List of broken features */ |
570 | unsigned long flags; /* ATA_DFLAG_xxx */ | ||
559 | struct scsi_device *sdev; /* attached SCSI device */ | 571 | struct scsi_device *sdev; /* attached SCSI device */ |
560 | #ifdef CONFIG_ATA_ACPI | 572 | #ifdef CONFIG_ATA_ACPI |
561 | acpi_handle acpi_handle; | 573 | acpi_handle acpi_handle; |
@@ -564,6 +576,7 @@ struct ata_device { | |||
564 | /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ | 576 | /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ |
565 | u64 n_sectors; /* size of device, if ATA */ | 577 | u64 n_sectors; /* size of device, if ATA */ |
566 | unsigned int class; /* ATA_DEV_xxx */ | 578 | unsigned int class; /* ATA_DEV_xxx */ |
579 | unsigned long unpark_deadline; | ||
567 | 580 | ||
568 | u8 pio_mode; | 581 | u8 pio_mode; |
569 | u8 dma_mode; | 582 | u8 dma_mode; |
@@ -621,6 +634,7 @@ struct ata_eh_context { | |||
621 | [ATA_EH_CMD_TIMEOUT_TABLE_SIZE]; | 634 | [ATA_EH_CMD_TIMEOUT_TABLE_SIZE]; |
622 | unsigned int classes[ATA_MAX_DEVICES]; | 635 | unsigned int classes[ATA_MAX_DEVICES]; |
623 | unsigned int did_probe_mask; | 636 | unsigned int did_probe_mask; |
637 | unsigned int unloaded_mask; | ||
624 | unsigned int saved_ncq_enabled; | 638 | unsigned int saved_ncq_enabled; |
625 | u8 saved_xfer_mode[ATA_MAX_DEVICES]; | 639 | u8 saved_xfer_mode[ATA_MAX_DEVICES]; |
626 | /* timestamp for the last reset attempt or success */ | 640 | /* timestamp for the last reset attempt or success */ |
@@ -688,7 +702,8 @@ struct ata_port { | |||
688 | unsigned int qc_active; | 702 | unsigned int qc_active; |
689 | int nr_active_links; /* #links with active qcs */ | 703 | int nr_active_links; /* #links with active qcs */ |
690 | 704 | ||
691 | struct ata_link link; /* host default link */ | 705 | struct ata_link link; /* host default link */ |
706 | struct ata_link *slave_link; /* see ata_slave_link_init() */ | ||
692 | 707 | ||
693 | int nr_pmp_links; /* nr of available PMP links */ | 708 | int nr_pmp_links; /* nr of available PMP links */ |
694 | struct ata_link *pmp_link; /* array of PMP links */ | 709 | struct ata_link *pmp_link; /* array of PMP links */ |
@@ -709,6 +724,7 @@ struct ata_port { | |||
709 | struct list_head eh_done_q; | 724 | struct list_head eh_done_q; |
710 | wait_queue_head_t eh_wait_q; | 725 | wait_queue_head_t eh_wait_q; |
711 | int eh_tries; | 726 | int eh_tries; |
727 | struct completion park_req_pending; | ||
712 | 728 | ||
713 | pm_message_t pm_mesg; | 729 | pm_message_t pm_mesg; |
714 | int *pm_result; | 730 | int *pm_result; |
@@ -772,8 +788,8 @@ struct ata_port_operations { | |||
772 | /* | 788 | /* |
773 | * Optional features | 789 | * Optional features |
774 | */ | 790 | */ |
775 | int (*scr_read)(struct ata_port *ap, unsigned int sc_reg, u32 *val); | 791 | int (*scr_read)(struct ata_link *link, unsigned int sc_reg, u32 *val); |
776 | int (*scr_write)(struct ata_port *ap, unsigned int sc_reg, u32 val); | 792 | int (*scr_write)(struct ata_link *link, unsigned int sc_reg, u32 val); |
777 | void (*pmp_attach)(struct ata_port *ap); | 793 | void (*pmp_attach)(struct ata_port *ap); |
778 | void (*pmp_detach)(struct ata_port *ap); | 794 | void (*pmp_detach)(struct ata_port *ap); |
779 | int (*enable_pm)(struct ata_port *ap, enum link_pm policy); | 795 | int (*enable_pm)(struct ata_port *ap, enum link_pm policy); |
@@ -895,6 +911,7 @@ extern void ata_port_disable(struct ata_port *); | |||
895 | extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); | 911 | extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); |
896 | extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, | 912 | extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, |
897 | const struct ata_port_info * const * ppi, int n_ports); | 913 | const struct ata_port_info * const * ppi, int n_ports); |
914 | extern int ata_slave_link_init(struct ata_port *ap); | ||
898 | extern int ata_host_start(struct ata_host *host); | 915 | extern int ata_host_start(struct ata_host *host); |
899 | extern int ata_host_register(struct ata_host *host, | 916 | extern int ata_host_register(struct ata_host *host, |
900 | struct scsi_host_template *sht); | 917 | struct scsi_host_template *sht); |
@@ -920,8 +937,8 @@ extern int sata_scr_valid(struct ata_link *link); | |||
920 | extern int sata_scr_read(struct ata_link *link, int reg, u32 *val); | 937 | extern int sata_scr_read(struct ata_link *link, int reg, u32 *val); |
921 | extern int sata_scr_write(struct ata_link *link, int reg, u32 val); | 938 | extern int sata_scr_write(struct ata_link *link, int reg, u32 val); |
922 | extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val); | 939 | extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val); |
923 | extern int ata_link_online(struct ata_link *link); | 940 | extern bool ata_link_online(struct ata_link *link); |
924 | extern int ata_link_offline(struct ata_link *link); | 941 | extern bool ata_link_offline(struct ata_link *link); |
925 | #ifdef CONFIG_PM | 942 | #ifdef CONFIG_PM |
926 | extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); | 943 | extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); |
927 | extern void ata_host_resume(struct ata_host *host); | 944 | extern void ata_host_resume(struct ata_host *host); |
@@ -1098,6 +1115,7 @@ extern void ata_std_error_handler(struct ata_port *ap); | |||
1098 | */ | 1115 | */ |
1099 | extern const struct ata_port_operations ata_base_port_ops; | 1116 | extern const struct ata_port_operations ata_base_port_ops; |
1100 | extern const struct ata_port_operations sata_port_ops; | 1117 | extern const struct ata_port_operations sata_port_ops; |
1118 | extern struct device_attribute *ata_common_sdev_attrs[]; | ||
1101 | 1119 | ||
1102 | #define ATA_BASE_SHT(drv_name) \ | 1120 | #define ATA_BASE_SHT(drv_name) \ |
1103 | .module = THIS_MODULE, \ | 1121 | .module = THIS_MODULE, \ |
@@ -1112,7 +1130,8 @@ extern const struct ata_port_operations sata_port_ops; | |||
1112 | .proc_name = drv_name, \ | 1130 | .proc_name = drv_name, \ |
1113 | .slave_configure = ata_scsi_slave_config, \ | 1131 | .slave_configure = ata_scsi_slave_config, \ |
1114 | .slave_destroy = ata_scsi_slave_destroy, \ | 1132 | .slave_destroy = ata_scsi_slave_destroy, \ |
1115 | .bios_param = ata_std_bios_param | 1133 | .bios_param = ata_std_bios_param, \ |
1134 | .sdev_attrs = ata_common_sdev_attrs | ||
1116 | 1135 | ||
1117 | #define ATA_NCQ_SHT(drv_name) \ | 1136 | #define ATA_NCQ_SHT(drv_name) \ |
1118 | ATA_BASE_SHT(drv_name), \ | 1137 | ATA_BASE_SHT(drv_name), \ |
@@ -1134,7 +1153,7 @@ static inline bool sata_pmp_attached(struct ata_port *ap) | |||
1134 | 1153 | ||
1135 | static inline int ata_is_host_link(const struct ata_link *link) | 1154 | static inline int ata_is_host_link(const struct ata_link *link) |
1136 | { | 1155 | { |
1137 | return link == &link->ap->link; | 1156 | return link == &link->ap->link || link == link->ap->slave_link; |
1138 | } | 1157 | } |
1139 | #else /* CONFIG_SATA_PMP */ | 1158 | #else /* CONFIG_SATA_PMP */ |
1140 | static inline bool sata_pmp_supported(struct ata_port *ap) | 1159 | static inline bool sata_pmp_supported(struct ata_port *ap) |
@@ -1167,7 +1186,7 @@ static inline int sata_srst_pmp(struct ata_link *link) | |||
1167 | printk("%sata%u: "fmt, lv, (ap)->print_id , ##args) | 1186 | printk("%sata%u: "fmt, lv, (ap)->print_id , ##args) |
1168 | 1187 | ||
1169 | #define ata_link_printk(link, lv, fmt, args...) do { \ | 1188 | #define ata_link_printk(link, lv, fmt, args...) do { \ |
1170 | if (sata_pmp_attached((link)->ap)) \ | 1189 | if (sata_pmp_attached((link)->ap) || (link)->ap->slave_link) \ |
1171 | printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \ | 1190 | printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \ |
1172 | (link)->pmp , ##args); \ | 1191 | (link)->pmp , ##args); \ |
1173 | else \ | 1192 | else \ |
@@ -1265,34 +1284,17 @@ static inline int ata_link_active(struct ata_link *link) | |||
1265 | return ata_tag_valid(link->active_tag) || link->sactive; | 1284 | return ata_tag_valid(link->active_tag) || link->sactive; |
1266 | } | 1285 | } |
1267 | 1286 | ||
1268 | static inline struct ata_link *ata_port_first_link(struct ata_port *ap) | 1287 | extern struct ata_link *__ata_port_next_link(struct ata_port *ap, |
1269 | { | 1288 | struct ata_link *link, |
1270 | if (sata_pmp_attached(ap)) | 1289 | bool dev_only); |
1271 | return ap->pmp_link; | ||
1272 | return &ap->link; | ||
1273 | } | ||
1274 | |||
1275 | static inline struct ata_link *ata_port_next_link(struct ata_link *link) | ||
1276 | { | ||
1277 | struct ata_port *ap = link->ap; | ||
1278 | |||
1279 | if (ata_is_host_link(link)) { | ||
1280 | if (!sata_pmp_attached(ap)) | ||
1281 | return NULL; | ||
1282 | return ap->pmp_link; | ||
1283 | } | ||
1284 | |||
1285 | if (++link < ap->nr_pmp_links + ap->pmp_link) | ||
1286 | return link; | ||
1287 | return NULL; | ||
1288 | } | ||
1289 | 1290 | ||
1290 | #define __ata_port_for_each_link(lk, ap) \ | 1291 | #define __ata_port_for_each_link(link, ap) \ |
1291 | for ((lk) = &(ap)->link; (lk); (lk) = ata_port_next_link(lk)) | 1292 | for ((link) = __ata_port_next_link((ap), NULL, false); (link); \ |
1293 | (link) = __ata_port_next_link((ap), (link), false)) | ||
1292 | 1294 | ||
1293 | #define ata_port_for_each_link(link, ap) \ | 1295 | #define ata_port_for_each_link(link, ap) \ |
1294 | for ((link) = ata_port_first_link(ap); (link); \ | 1296 | for ((link) = __ata_port_next_link((ap), NULL, true); (link); \ |
1295 | (link) = ata_port_next_link(link)) | 1297 | (link) = __ata_port_next_link((ap), (link), true)) |
1296 | 1298 | ||
1297 | #define ata_link_for_each_dev(dev, link) \ | 1299 | #define ata_link_for_each_dev(dev, link) \ |
1298 | for ((dev) = (link)->device; \ | 1300 | for ((dev) = (link)->device; \ |
diff --git a/include/linux/linkage.h b/include/linux/linkage.h index 56ba37394656..9fd1f859021b 100644 --- a/include/linux/linkage.h +++ b/include/linux/linkage.h | |||
@@ -4,8 +4,6 @@ | |||
4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
5 | #include <asm/linkage.h> | 5 | #include <asm/linkage.h> |
6 | 6 | ||
7 | #define notrace __attribute__((no_instrument_function)) | ||
8 | |||
9 | #ifdef __cplusplus | 7 | #ifdef __cplusplus |
10 | #define CPP_ASMLINKAGE extern "C" | 8 | #define CPP_ASMLINKAGE extern "C" |
11 | #else | 9 | #else |
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h index 3d25bcd139d1..e5872dc994c0 100644 --- a/include/linux/lockd/bind.h +++ b/include/linux/lockd/bind.h | |||
@@ -27,7 +27,6 @@ struct nlmsvc_binding { | |||
27 | struct nfs_fh *, | 27 | struct nfs_fh *, |
28 | struct file **); | 28 | struct file **); |
29 | void (*fclose)(struct file *); | 29 | void (*fclose)(struct file *); |
30 | unsigned long (*get_grace_period)(void); | ||
31 | }; | 30 | }; |
32 | 31 | ||
33 | extern struct nlmsvc_binding * nlmsvc_ops; | 32 | extern struct nlmsvc_binding * nlmsvc_ops; |
@@ -53,15 +52,7 @@ extern void nlmclnt_done(struct nlm_host *host); | |||
53 | 52 | ||
54 | extern int nlmclnt_proc(struct nlm_host *host, int cmd, | 53 | extern int nlmclnt_proc(struct nlm_host *host, int cmd, |
55 | struct file_lock *fl); | 54 | struct file_lock *fl); |
56 | extern int lockd_up(int proto); | 55 | extern int lockd_up(void); |
57 | extern void lockd_down(void); | 56 | extern void lockd_down(void); |
58 | 57 | ||
59 | unsigned long get_nfs_grace_period(void); | ||
60 | |||
61 | #ifdef CONFIG_NFSD_V4 | ||
62 | unsigned long get_nfs4_grace_period(void); | ||
63 | #else | ||
64 | static inline unsigned long get_nfs4_grace_period(void) {return 0;} | ||
65 | #endif | ||
66 | |||
67 | #endif /* LINUX_LOCKD_BIND_H */ | 58 | #endif /* LINUX_LOCKD_BIND_H */ |
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index dbb87ab282e8..b56d5aa9b194 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h | |||
@@ -12,6 +12,8 @@ | |||
12 | #ifdef __KERNEL__ | 12 | #ifdef __KERNEL__ |
13 | 13 | ||
14 | #include <linux/in.h> | 14 | #include <linux/in.h> |
15 | #include <linux/in6.h> | ||
16 | #include <net/ipv6.h> | ||
15 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
16 | #include <linux/kref.h> | 18 | #include <linux/kref.h> |
17 | #include <linux/utsname.h> | 19 | #include <linux/utsname.h> |
@@ -38,8 +40,9 @@ | |||
38 | */ | 40 | */ |
39 | struct nlm_host { | 41 | struct nlm_host { |
40 | struct hlist_node h_hash; /* doubly linked list */ | 42 | struct hlist_node h_hash; /* doubly linked list */ |
41 | struct sockaddr_in h_addr; /* peer address */ | 43 | struct sockaddr_storage h_addr; /* peer address */ |
42 | struct sockaddr_in h_saddr; /* our address (optional) */ | 44 | size_t h_addrlen; |
45 | struct sockaddr_storage h_srcaddr; /* our address (optional) */ | ||
43 | struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */ | 46 | struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */ |
44 | char * h_name; /* remote hostname */ | 47 | char * h_name; /* remote hostname */ |
45 | u32 h_version; /* interface version */ | 48 | u32 h_version; /* interface version */ |
@@ -61,18 +64,56 @@ struct nlm_host { | |||
61 | struct list_head h_granted; /* Locks in GRANTED state */ | 64 | struct list_head h_granted; /* Locks in GRANTED state */ |
62 | struct list_head h_reclaim; /* Locks in RECLAIM state */ | 65 | struct list_head h_reclaim; /* Locks in RECLAIM state */ |
63 | struct nsm_handle * h_nsmhandle; /* NSM status handle */ | 66 | struct nsm_handle * h_nsmhandle; /* NSM status handle */ |
67 | |||
68 | char h_addrbuf[48], /* address eyecatchers */ | ||
69 | h_srcaddrbuf[48]; | ||
64 | }; | 70 | }; |
65 | 71 | ||
66 | struct nsm_handle { | 72 | struct nsm_handle { |
67 | struct list_head sm_link; | 73 | struct list_head sm_link; |
68 | atomic_t sm_count; | 74 | atomic_t sm_count; |
69 | char * sm_name; | 75 | char * sm_name; |
70 | struct sockaddr_in sm_addr; | 76 | struct sockaddr_storage sm_addr; |
77 | size_t sm_addrlen; | ||
71 | unsigned int sm_monitored : 1, | 78 | unsigned int sm_monitored : 1, |
72 | sm_sticky : 1; /* don't unmonitor */ | 79 | sm_sticky : 1; /* don't unmonitor */ |
80 | char sm_addrbuf[48]; /* address eyecatcher */ | ||
73 | }; | 81 | }; |
74 | 82 | ||
75 | /* | 83 | /* |
84 | * Rigorous type checking on sockaddr type conversions | ||
85 | */ | ||
86 | static inline struct sockaddr_in *nlm_addr_in(const struct nlm_host *host) | ||
87 | { | ||
88 | return (struct sockaddr_in *)&host->h_addr; | ||
89 | } | ||
90 | |||
91 | static inline struct sockaddr *nlm_addr(const struct nlm_host *host) | ||
92 | { | ||
93 | return (struct sockaddr *)&host->h_addr; | ||
94 | } | ||
95 | |||
96 | static inline struct sockaddr_in *nlm_srcaddr_in(const struct nlm_host *host) | ||
97 | { | ||
98 | return (struct sockaddr_in *)&host->h_srcaddr; | ||
99 | } | ||
100 | |||
101 | static inline struct sockaddr *nlm_srcaddr(const struct nlm_host *host) | ||
102 | { | ||
103 | return (struct sockaddr *)&host->h_srcaddr; | ||
104 | } | ||
105 | |||
106 | static inline struct sockaddr_in *nsm_addr_in(const struct nsm_handle *handle) | ||
107 | { | ||
108 | return (struct sockaddr_in *)&handle->sm_addr; | ||
109 | } | ||
110 | |||
111 | static inline struct sockaddr *nsm_addr(const struct nsm_handle *handle) | ||
112 | { | ||
113 | return (struct sockaddr *)&handle->sm_addr; | ||
114 | } | ||
115 | |||
116 | /* | ||
76 | * Map an fl_owner_t into a unique 32-bit "pid" | 117 | * Map an fl_owner_t into a unique 32-bit "pid" |
77 | */ | 118 | */ |
78 | struct nlm_lockowner { | 119 | struct nlm_lockowner { |
@@ -166,7 +207,8 @@ int nlm_async_reply(struct nlm_rqst *, u32, const struct rpc_call_ops *); | |||
166 | struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl); | 207 | struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl); |
167 | void nlmclnt_finish_block(struct nlm_wait *block); | 208 | void nlmclnt_finish_block(struct nlm_wait *block); |
168 | int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout); | 209 | int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout); |
169 | __be32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *); | 210 | __be32 nlmclnt_grant(const struct sockaddr *addr, |
211 | const struct nlm_lock *lock); | ||
170 | void nlmclnt_recovery(struct nlm_host *); | 212 | void nlmclnt_recovery(struct nlm_host *); |
171 | int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); | 213 | int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); |
172 | void nlmclnt_next_cookie(struct nlm_cookie *); | 214 | void nlmclnt_next_cookie(struct nlm_cookie *); |
@@ -174,12 +216,14 @@ void nlmclnt_next_cookie(struct nlm_cookie *); | |||
174 | /* | 216 | /* |
175 | * Host cache | 217 | * Host cache |
176 | */ | 218 | */ |
177 | struct nlm_host *nlmclnt_lookup_host(const struct sockaddr_in *sin, | 219 | struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap, |
178 | int proto, u32 version, | 220 | const size_t salen, |
221 | const unsigned short protocol, | ||
222 | const u32 version, | ||
223 | const char *hostname); | ||
224 | struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, | ||
179 | const char *hostname, | 225 | const char *hostname, |
180 | unsigned int hostname_len); | 226 | const size_t hostname_len); |
181 | struct nlm_host *nlmsvc_lookup_host(struct svc_rqst *, const char *, | ||
182 | unsigned int); | ||
183 | struct rpc_clnt * nlm_bind_host(struct nlm_host *); | 227 | struct rpc_clnt * nlm_bind_host(struct nlm_host *); |
184 | void nlm_rebind_host(struct nlm_host *); | 228 | void nlm_rebind_host(struct nlm_host *); |
185 | struct nlm_host * nlm_get_host(struct nlm_host *); | 229 | struct nlm_host * nlm_get_host(struct nlm_host *); |
@@ -201,7 +245,7 @@ typedef int (*nlm_host_match_fn_t)(void *cur, struct nlm_host *ref); | |||
201 | */ | 245 | */ |
202 | __be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, | 246 | __be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, |
203 | struct nlm_host *, struct nlm_lock *, int, | 247 | struct nlm_host *, struct nlm_lock *, int, |
204 | struct nlm_cookie *); | 248 | struct nlm_cookie *, int); |
205 | __be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); | 249 | __be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); |
206 | __be32 nlmsvc_testlock(struct svc_rqst *, struct nlm_file *, | 250 | __be32 nlmsvc_testlock(struct svc_rqst *, struct nlm_file *, |
207 | struct nlm_host *, struct nlm_lock *, | 251 | struct nlm_host *, struct nlm_lock *, |
@@ -233,15 +277,82 @@ static inline struct inode *nlmsvc_file_inode(struct nlm_file *file) | |||
233 | return file->f_file->f_path.dentry->d_inode; | 277 | return file->f_file->f_path.dentry->d_inode; |
234 | } | 278 | } |
235 | 279 | ||
280 | static inline int __nlm_privileged_request4(const struct sockaddr *sap) | ||
281 | { | ||
282 | const struct sockaddr_in *sin = (struct sockaddr_in *)sap; | ||
283 | return (sin->sin_addr.s_addr == htonl(INADDR_LOOPBACK)) && | ||
284 | (ntohs(sin->sin_port) < 1024); | ||
285 | } | ||
286 | |||
287 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
288 | static inline int __nlm_privileged_request6(const struct sockaddr *sap) | ||
289 | { | ||
290 | const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap; | ||
291 | return (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK) && | ||
292 | (ntohs(sin6->sin6_port) < 1024); | ||
293 | } | ||
294 | #else /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ | ||
295 | static inline int __nlm_privileged_request6(const struct sockaddr *sap) | ||
296 | { | ||
297 | return 0; | ||
298 | } | ||
299 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ | ||
300 | |||
236 | /* | 301 | /* |
237 | * Compare two host addresses (needs modifying for ipv6) | 302 | * Ensure incoming requests are from local privileged callers. |
303 | * | ||
304 | * Return TRUE if sender is local and is connecting via a privileged port; | ||
305 | * otherwise return FALSE. | ||
238 | */ | 306 | */ |
239 | static inline int nlm_cmp_addr(const struct sockaddr_in *sin1, | 307 | static inline int nlm_privileged_requester(const struct svc_rqst *rqstp) |
240 | const struct sockaddr_in *sin2) | ||
241 | { | 308 | { |
309 | const struct sockaddr *sap = svc_addr(rqstp); | ||
310 | |||
311 | switch (sap->sa_family) { | ||
312 | case AF_INET: | ||
313 | return __nlm_privileged_request4(sap); | ||
314 | case AF_INET6: | ||
315 | return __nlm_privileged_request6(sap); | ||
316 | default: | ||
317 | return 0; | ||
318 | } | ||
319 | } | ||
320 | |||
321 | static inline int __nlm_cmp_addr4(const struct sockaddr *sap1, | ||
322 | const struct sockaddr *sap2) | ||
323 | { | ||
324 | const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1; | ||
325 | const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2; | ||
242 | return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr; | 326 | return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr; |
243 | } | 327 | } |
244 | 328 | ||
329 | static inline int __nlm_cmp_addr6(const struct sockaddr *sap1, | ||
330 | const struct sockaddr *sap2) | ||
331 | { | ||
332 | const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1; | ||
333 | const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2; | ||
334 | return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr); | ||
335 | } | ||
336 | |||
337 | /* | ||
338 | * Compare two host addresses | ||
339 | * | ||
340 | * Return TRUE if the addresses are the same; otherwise FALSE. | ||
341 | */ | ||
342 | static inline int nlm_cmp_addr(const struct sockaddr *sap1, | ||
343 | const struct sockaddr *sap2) | ||
344 | { | ||
345 | if (sap1->sa_family == sap2->sa_family) { | ||
346 | switch (sap1->sa_family) { | ||
347 | case AF_INET: | ||
348 | return __nlm_cmp_addr4(sap1, sap2); | ||
349 | case AF_INET6: | ||
350 | return __nlm_cmp_addr6(sap1, sap2); | ||
351 | } | ||
352 | } | ||
353 | return 0; | ||
354 | } | ||
355 | |||
245 | /* | 356 | /* |
246 | * Compare two NLM locks. | 357 | * Compare two NLM locks. |
247 | * When the second lock is of type F_UNLCK, this acts like a wildcard. | 358 | * When the second lock is of type F_UNLCK, this acts like a wildcard. |
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h index df18fa053bcd..d6b3a802c046 100644 --- a/include/linux/lockd/xdr.h +++ b/include/linux/lockd/xdr.h | |||
@@ -81,8 +81,6 @@ struct nlm_reboot { | |||
81 | unsigned int len; | 81 | unsigned int len; |
82 | u32 state; | 82 | u32 state; |
83 | __be32 addr; | 83 | __be32 addr; |
84 | __be32 vers; | ||
85 | __be32 proto; | ||
86 | }; | 84 | }; |
87 | 85 | ||
88 | /* | 86 | /* |
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 331e5f1c2d8e..29aec6e10020 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
@@ -331,10 +331,11 @@ static inline void lockdep_on(void) | |||
331 | # define lock_set_subclass(l, s, i) do { } while (0) | 331 | # define lock_set_subclass(l, s, i) do { } while (0) |
332 | # define lockdep_init() do { } while (0) | 332 | # define lockdep_init() do { } while (0) |
333 | # define lockdep_info() do { } while (0) | 333 | # define lockdep_info() do { } while (0) |
334 | # define lockdep_init_map(lock, name, key, sub) do { (void)(key); } while (0) | 334 | # define lockdep_init_map(lock, name, key, sub) \ |
335 | do { (void)(name); (void)(key); } while (0) | ||
335 | # define lockdep_set_class(lock, key) do { (void)(key); } while (0) | 336 | # define lockdep_set_class(lock, key) do { (void)(key); } while (0) |
336 | # define lockdep_set_class_and_name(lock, key, name) \ | 337 | # define lockdep_set_class_and_name(lock, key, name) \ |
337 | do { (void)(key); } while (0) | 338 | do { (void)(key); (void)(name); } while (0) |
338 | #define lockdep_set_class_and_subclass(lock, key, sub) \ | 339 | #define lockdep_set_class_and_subclass(lock, key, sub) \ |
339 | do { (void)(key); } while (0) | 340 | do { (void)(key); } while (0) |
340 | #define lockdep_set_subclass(lock, sub) do { } while (0) | 341 | #define lockdep_set_subclass(lock, sub) do { } while (0) |
diff --git a/include/linux/magic.h b/include/linux/magic.h index 1fa0c2ce4dec..f7f3fdddbef0 100644 --- a/include/linux/magic.h +++ b/include/linux/magic.h | |||
@@ -6,6 +6,10 @@ | |||
6 | #define AFS_SUPER_MAGIC 0x5346414F | 6 | #define AFS_SUPER_MAGIC 0x5346414F |
7 | #define AUTOFS_SUPER_MAGIC 0x0187 | 7 | #define AUTOFS_SUPER_MAGIC 0x0187 |
8 | #define CODA_SUPER_MAGIC 0x73757245 | 8 | #define CODA_SUPER_MAGIC 0x73757245 |
9 | #define DEBUGFS_MAGIC 0x64626720 | ||
10 | #define SYSFS_MAGIC 0x62656572 | ||
11 | #define SECURITYFS_MAGIC 0x73636673 | ||
12 | #define TMPFS_MAGIC 0x01021994 | ||
9 | #define EFS_SUPER_MAGIC 0x414A53 | 13 | #define EFS_SUPER_MAGIC 0x414A53 |
10 | #define EXT2_SUPER_MAGIC 0xEF53 | 14 | #define EXT2_SUPER_MAGIC 0xEF53 |
11 | #define EXT3_SUPER_MAGIC 0xEF53 | 15 | #define EXT3_SUPER_MAGIC 0xEF53 |
diff --git a/include/linux/major.h b/include/linux/major.h index 53d5fafd85c3..88249452b935 100644 --- a/include/linux/major.h +++ b/include/linux/major.h | |||
@@ -170,4 +170,6 @@ | |||
170 | 170 | ||
171 | #define VIOTAPE_MAJOR 230 | 171 | #define VIOTAPE_MAJOR 230 |
172 | 172 | ||
173 | #define BLOCK_EXT_MAJOR 259 | ||
174 | |||
173 | #endif | 175 | #endif |
diff --git a/include/linux/map_to_7segment.h b/include/linux/map_to_7segment.h new file mode 100644 index 000000000000..7df8432c4402 --- /dev/null +++ b/include/linux/map_to_7segment.h | |||
@@ -0,0 +1,187 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005 Henk Vergonet <Henk.Vergonet@gmail.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License as | ||
6 | * published by the Free Software Foundation; either version 2 of | ||
7 | * the License, or (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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | */ | ||
18 | |||
19 | #ifndef MAP_TO_7SEGMENT_H | ||
20 | #define MAP_TO_7SEGMENT_H | ||
21 | |||
22 | /* This file provides translation primitives and tables for the conversion | ||
23 | * of (ASCII) characters to a 7-segments notation. | ||
24 | * | ||
25 | * The 7 segment's wikipedia notation below is used as standard. | ||
26 | * See: http://en.wikipedia.org/wiki/Seven_segment_display | ||
27 | * | ||
28 | * Notation: +-a-+ | ||
29 | * f b | ||
30 | * +-g-+ | ||
31 | * e c | ||
32 | * +-d-+ | ||
33 | * | ||
34 | * Usage: | ||
35 | * | ||
36 | * Register a map variable, and fill it with a character set: | ||
37 | * static SEG7_DEFAULT_MAP(map_seg7); | ||
38 | * | ||
39 | * | ||
40 | * Then use for conversion: | ||
41 | * seg7 = map_to_seg7(&map_seg7, some_char); | ||
42 | * ... | ||
43 | * | ||
44 | * In device drivers it is recommended, if required, to make the char map | ||
45 | * accessible via the sysfs interface using the following scheme: | ||
46 | * | ||
47 | * static ssize_t show_map(struct device *dev, char *buf) { | ||
48 | * memcpy(buf, &map_seg7, sizeof(map_seg7)); | ||
49 | * return sizeof(map_seg7); | ||
50 | * } | ||
51 | * static ssize_t store_map(struct device *dev, const char *buf, size_t cnt) { | ||
52 | * if(cnt != sizeof(map_seg7)) | ||
53 | * return -EINVAL; | ||
54 | * memcpy(&map_seg7, buf, cnt); | ||
55 | * return cnt; | ||
56 | * } | ||
57 | * static DEVICE_ATTR(map_seg7, PERMS_RW, show_map, store_map); | ||
58 | * | ||
59 | * History: | ||
60 | * 2005-05-31 RFC linux-kernel@vger.kernel.org | ||
61 | */ | ||
62 | #include <linux/errno.h> | ||
63 | |||
64 | |||
65 | #define BIT_SEG7_A 0 | ||
66 | #define BIT_SEG7_B 1 | ||
67 | #define BIT_SEG7_C 2 | ||
68 | #define BIT_SEG7_D 3 | ||
69 | #define BIT_SEG7_E 4 | ||
70 | #define BIT_SEG7_F 5 | ||
71 | #define BIT_SEG7_G 6 | ||
72 | #define BIT_SEG7_RESERVED 7 | ||
73 | |||
74 | struct seg7_conversion_map { | ||
75 | unsigned char table[128]; | ||
76 | }; | ||
77 | |||
78 | static inline int map_to_seg7(struct seg7_conversion_map *map, int c) | ||
79 | { | ||
80 | return c >= 0 && c < sizeof(map->table) ? map->table[c] : -EINVAL; | ||
81 | } | ||
82 | |||
83 | #define SEG7_CONVERSION_MAP(_name, _map) \ | ||
84 | struct seg7_conversion_map _name = { .table = { _map } } | ||
85 | |||
86 | /* | ||
87 | * It is recommended to use a facility that allows user space to redefine | ||
88 | * custom character sets for LCD devices. Please use a sysfs interface | ||
89 | * as described above. | ||
90 | */ | ||
91 | #define MAP_TO_SEG7_SYSFS_FILE "map_seg7" | ||
92 | |||
93 | /******************************************************************************* | ||
94 | * ASCII conversion table | ||
95 | ******************************************************************************/ | ||
96 | |||
97 | #define _SEG7(l,a,b,c,d,e,f,g) \ | ||
98 | ( a<<BIT_SEG7_A | b<<BIT_SEG7_B | c<<BIT_SEG7_C | d<<BIT_SEG7_D | \ | ||
99 | e<<BIT_SEG7_E | f<<BIT_SEG7_F | g<<BIT_SEG7_G ) | ||
100 | |||
101 | #define _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \ | ||
102 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | ||
103 | |||
104 | #define _MAP_33_47_ASCII_SEG7_SYMBOL \ | ||
105 | _SEG7('!',0,0,0,0,1,1,0), _SEG7('"',0,1,0,0,0,1,0), _SEG7('#',0,1,1,0,1,1,0),\ | ||
106 | _SEG7('$',1,0,1,1,0,1,1), _SEG7('%',0,0,1,0,0,1,0), _SEG7('&',1,0,1,1,1,1,1),\ | ||
107 | _SEG7('\'',0,0,0,0,0,1,0),_SEG7('(',1,0,0,1,1,1,0), _SEG7(')',1,1,1,1,0,0,0),\ | ||
108 | _SEG7('*',0,1,1,0,1,1,1), _SEG7('+',0,1,1,0,0,0,1), _SEG7(',',0,0,0,0,1,0,0),\ | ||
109 | _SEG7('-',0,0,0,0,0,0,1), _SEG7('.',0,0,0,0,1,0,0), _SEG7('/',0,1,0,0,1,0,1), | ||
110 | |||
111 | #define _MAP_48_57_ASCII_SEG7_NUMERIC \ | ||
112 | _SEG7('0',1,1,1,1,1,1,0), _SEG7('1',0,1,1,0,0,0,0), _SEG7('2',1,1,0,1,1,0,1),\ | ||
113 | _SEG7('3',1,1,1,1,0,0,1), _SEG7('4',0,1,1,0,0,1,1), _SEG7('5',1,0,1,1,0,1,1),\ | ||
114 | _SEG7('6',1,0,1,1,1,1,1), _SEG7('7',1,1,1,0,0,0,0), _SEG7('8',1,1,1,1,1,1,1),\ | ||
115 | _SEG7('9',1,1,1,1,0,1,1), | ||
116 | |||
117 | #define _MAP_58_64_ASCII_SEG7_SYMBOL \ | ||
118 | _SEG7(':',0,0,0,1,0,0,1), _SEG7(';',0,0,0,1,0,0,1), _SEG7('<',1,0,0,0,0,1,1),\ | ||
119 | _SEG7('=',0,0,0,1,0,0,1), _SEG7('>',1,1,0,0,0,0,1), _SEG7('?',1,1,1,0,0,1,0),\ | ||
120 | _SEG7('@',1,1,0,1,1,1,1), | ||
121 | |||
122 | #define _MAP_65_90_ASCII_SEG7_ALPHA_UPPR \ | ||
123 | _SEG7('A',1,1,1,0,1,1,1), _SEG7('B',1,1,1,1,1,1,1), _SEG7('C',1,0,0,1,1,1,0),\ | ||
124 | _SEG7('D',1,1,1,1,1,1,0), _SEG7('E',1,0,0,1,1,1,1), _SEG7('F',1,0,0,0,1,1,1),\ | ||
125 | _SEG7('G',1,1,1,1,0,1,1), _SEG7('H',0,1,1,0,1,1,1), _SEG7('I',0,1,1,0,0,0,0),\ | ||
126 | _SEG7('J',0,1,1,1,0,0,0), _SEG7('K',0,1,1,0,1,1,1), _SEG7('L',0,0,0,1,1,1,0),\ | ||
127 | _SEG7('M',1,1,1,0,1,1,0), _SEG7('N',1,1,1,0,1,1,0), _SEG7('O',1,1,1,1,1,1,0),\ | ||
128 | _SEG7('P',1,1,0,0,1,1,1), _SEG7('Q',1,1,1,1,1,1,0), _SEG7('R',1,1,1,0,1,1,1),\ | ||
129 | _SEG7('S',1,0,1,1,0,1,1), _SEG7('T',0,0,0,1,1,1,1), _SEG7('U',0,1,1,1,1,1,0),\ | ||
130 | _SEG7('V',0,1,1,1,1,1,0), _SEG7('W',0,1,1,1,1,1,1), _SEG7('X',0,1,1,0,1,1,1),\ | ||
131 | _SEG7('Y',0,1,1,0,0,1,1), _SEG7('Z',1,1,0,1,1,0,1), | ||
132 | |||
133 | #define _MAP_91_96_ASCII_SEG7_SYMBOL \ | ||
134 | _SEG7('[',1,0,0,1,1,1,0), _SEG7('\\',0,0,1,0,0,1,1),_SEG7(']',1,1,1,1,0,0,0),\ | ||
135 | _SEG7('^',1,1,0,0,0,1,0), _SEG7('_',0,0,0,1,0,0,0), _SEG7('`',0,1,0,0,0,0,0), | ||
136 | |||
137 | #define _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ | ||
138 | _SEG7('A',1,1,1,0,1,1,1), _SEG7('b',0,0,1,1,1,1,1), _SEG7('c',0,0,0,1,1,0,1),\ | ||
139 | _SEG7('d',0,1,1,1,1,0,1), _SEG7('E',1,0,0,1,1,1,1), _SEG7('F',1,0,0,0,1,1,1),\ | ||
140 | _SEG7('G',1,1,1,1,0,1,1), _SEG7('h',0,0,1,0,1,1,1), _SEG7('i',0,0,1,0,0,0,0),\ | ||
141 | _SEG7('j',0,0,1,1,0,0,0), _SEG7('k',0,0,1,0,1,1,1), _SEG7('L',0,0,0,1,1,1,0),\ | ||
142 | _SEG7('M',1,1,1,0,1,1,0), _SEG7('n',0,0,1,0,1,0,1), _SEG7('o',0,0,1,1,1,0,1),\ | ||
143 | _SEG7('P',1,1,0,0,1,1,1), _SEG7('q',1,1,1,0,0,1,1), _SEG7('r',0,0,0,0,1,0,1),\ | ||
144 | _SEG7('S',1,0,1,1,0,1,1), _SEG7('T',0,0,0,1,1,1,1), _SEG7('u',0,0,1,1,1,0,0),\ | ||
145 | _SEG7('v',0,0,1,1,1,0,0), _SEG7('W',0,1,1,1,1,1,1), _SEG7('X',0,1,1,0,1,1,1),\ | ||
146 | _SEG7('y',0,1,1,1,0,1,1), _SEG7('Z',1,1,0,1,1,0,1), | ||
147 | |||
148 | #define _MAP_123_126_ASCII_SEG7_SYMBOL \ | ||
149 | _SEG7('{',1,0,0,1,1,1,0), _SEG7('|',0,0,0,0,1,1,0), _SEG7('}',1,1,1,1,0,0,0),\ | ||
150 | _SEG7('~',1,0,0,0,0,0,0), | ||
151 | |||
152 | /* Maps */ | ||
153 | |||
154 | /* This set tries to map as close as possible to the visible characteristics | ||
155 | * of the ASCII symbol, lowercase and uppercase letters may differ in | ||
156 | * presentation on the display. | ||
157 | */ | ||
158 | #define MAP_ASCII7SEG_ALPHANUM \ | ||
159 | _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \ | ||
160 | _MAP_33_47_ASCII_SEG7_SYMBOL \ | ||
161 | _MAP_48_57_ASCII_SEG7_NUMERIC \ | ||
162 | _MAP_58_64_ASCII_SEG7_SYMBOL \ | ||
163 | _MAP_65_90_ASCII_SEG7_ALPHA_UPPR \ | ||
164 | _MAP_91_96_ASCII_SEG7_SYMBOL \ | ||
165 | _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ | ||
166 | _MAP_123_126_ASCII_SEG7_SYMBOL | ||
167 | |||
168 | /* This set tries to map as close as possible to the symbolic characteristics | ||
169 | * of the ASCII character for maximum discrimination. | ||
170 | * For now this means all alpha chars are in lower case representations. | ||
171 | * (This for example facilitates the use of hex numbers with uppercase input.) | ||
172 | */ | ||
173 | #define MAP_ASCII7SEG_ALPHANUM_LC \ | ||
174 | _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \ | ||
175 | _MAP_33_47_ASCII_SEG7_SYMBOL \ | ||
176 | _MAP_48_57_ASCII_SEG7_NUMERIC \ | ||
177 | _MAP_58_64_ASCII_SEG7_SYMBOL \ | ||
178 | _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ | ||
179 | _MAP_91_96_ASCII_SEG7_SYMBOL \ | ||
180 | _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \ | ||
181 | _MAP_123_126_ASCII_SEG7_SYMBOL | ||
182 | |||
183 | #define SEG7_DEFAULT_MAP(_name) \ | ||
184 | SEG7_CONVERSION_MAP(_name,MAP_ASCII7SEG_ALPHANUM) | ||
185 | |||
186 | #endif /* MAP_TO_7SEGMENT_H */ | ||
187 | |||
diff --git a/include/linux/marker.h b/include/linux/marker.h index 1290653f9241..889196c7fbb1 100644 --- a/include/linux/marker.h +++ b/include/linux/marker.h | |||
@@ -160,4 +160,11 @@ extern int marker_probe_unregister_private_data(marker_probe_func *probe, | |||
160 | extern void *marker_get_private_data(const char *name, marker_probe_func *probe, | 160 | extern void *marker_get_private_data(const char *name, marker_probe_func *probe, |
161 | int num); | 161 | int num); |
162 | 162 | ||
163 | /* | ||
164 | * marker_synchronize_unregister must be called between the last marker probe | ||
165 | * unregistration and the end of module exit to make sure there is no caller | ||
166 | * executing a probe when it is freed. | ||
167 | */ | ||
168 | #define marker_synchronize_unregister() synchronize_sched() | ||
169 | |||
163 | #endif | 170 | #endif |
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index fdf3967e1397..1fbe14d39521 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -27,16 +27,13 @@ struct mm_struct; | |||
27 | 27 | ||
28 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | 28 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR |
29 | 29 | ||
30 | #define page_reset_bad_cgroup(page) ((page)->page_cgroup = 0) | ||
31 | |||
32 | extern struct page_cgroup *page_get_page_cgroup(struct page *page); | ||
33 | extern int mem_cgroup_charge(struct page *page, struct mm_struct *mm, | 30 | extern int mem_cgroup_charge(struct page *page, struct mm_struct *mm, |
34 | gfp_t gfp_mask); | 31 | gfp_t gfp_mask); |
35 | extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, | 32 | extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, |
36 | gfp_t gfp_mask); | 33 | gfp_t gfp_mask); |
34 | extern void mem_cgroup_move_lists(struct page *page, enum lru_list lru); | ||
37 | extern void mem_cgroup_uncharge_page(struct page *page); | 35 | extern void mem_cgroup_uncharge_page(struct page *page); |
38 | extern void mem_cgroup_uncharge_cache_page(struct page *page); | 36 | extern void mem_cgroup_uncharge_cache_page(struct page *page); |
39 | extern void mem_cgroup_move_lists(struct page *page, bool active); | ||
40 | extern int mem_cgroup_shrink_usage(struct mm_struct *mm, gfp_t gfp_mask); | 37 | extern int mem_cgroup_shrink_usage(struct mm_struct *mm, gfp_t gfp_mask); |
41 | 38 | ||
42 | extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, | 39 | extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, |
@@ -44,7 +41,7 @@ extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, | |||
44 | unsigned long *scanned, int order, | 41 | unsigned long *scanned, int order, |
45 | int mode, struct zone *z, | 42 | int mode, struct zone *z, |
46 | struct mem_cgroup *mem_cont, | 43 | struct mem_cgroup *mem_cont, |
47 | int active); | 44 | int active, int file); |
48 | extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask); | 45 | extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask); |
49 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); | 46 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); |
50 | 47 | ||
@@ -69,21 +66,11 @@ extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem, | |||
69 | extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem, | 66 | extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem, |
70 | int priority); | 67 | int priority); |
71 | 68 | ||
72 | extern long mem_cgroup_calc_reclaim_active(struct mem_cgroup *mem, | 69 | extern long mem_cgroup_calc_reclaim(struct mem_cgroup *mem, struct zone *zone, |
73 | struct zone *zone, int priority); | 70 | int priority, enum lru_list lru); |
74 | extern long mem_cgroup_calc_reclaim_inactive(struct mem_cgroup *mem, | ||
75 | struct zone *zone, int priority); | ||
76 | |||
77 | #else /* CONFIG_CGROUP_MEM_RES_CTLR */ | ||
78 | static inline void page_reset_bad_cgroup(struct page *page) | ||
79 | { | ||
80 | } | ||
81 | 71 | ||
82 | static inline struct page_cgroup *page_get_page_cgroup(struct page *page) | ||
83 | { | ||
84 | return NULL; | ||
85 | } | ||
86 | 72 | ||
73 | #else /* CONFIG_CGROUP_MEM_RES_CTLR */ | ||
87 | static inline int mem_cgroup_charge(struct page *page, | 74 | static inline int mem_cgroup_charge(struct page *page, |
88 | struct mm_struct *mm, gfp_t gfp_mask) | 75 | struct mm_struct *mm, gfp_t gfp_mask) |
89 | { | 76 | { |
@@ -159,14 +146,9 @@ static inline void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem, | |||
159 | { | 146 | { |
160 | } | 147 | } |
161 | 148 | ||
162 | static inline long mem_cgroup_calc_reclaim_active(struct mem_cgroup *mem, | 149 | static inline long mem_cgroup_calc_reclaim(struct mem_cgroup *mem, |
163 | struct zone *zone, int priority) | 150 | struct zone *zone, int priority, |
164 | { | 151 | enum lru_list lru) |
165 | return 0; | ||
166 | } | ||
167 | |||
168 | static inline long mem_cgroup_calc_reclaim_inactive(struct mem_cgroup *mem, | ||
169 | struct zone *zone, int priority) | ||
170 | { | 152 | { |
171 | return 0; | 153 | return 0; |
172 | } | 154 | } |
diff --git a/include/linux/mfd/da903x.h b/include/linux/mfd/da903x.h new file mode 100644 index 000000000000..cad314c12439 --- /dev/null +++ b/include/linux/mfd/da903x.h | |||
@@ -0,0 +1,201 @@ | |||
1 | #ifndef __LINUX_PMIC_DA903X_H | ||
2 | #define __LINUX_PMIC_DA903X_H | ||
3 | |||
4 | /* Unified sub device IDs for DA9030/DA9034 */ | ||
5 | enum { | ||
6 | DA9030_ID_LED_1, | ||
7 | DA9030_ID_LED_2, | ||
8 | DA9030_ID_LED_3, | ||
9 | DA9030_ID_LED_4, | ||
10 | DA9030_ID_LED_PC, | ||
11 | DA9030_ID_VIBRA, | ||
12 | DA9030_ID_WLED, | ||
13 | DA9030_ID_BUCK1, | ||
14 | DA9030_ID_BUCK2, | ||
15 | DA9030_ID_LDO1, | ||
16 | DA9030_ID_LDO2, | ||
17 | DA9030_ID_LDO3, | ||
18 | DA9030_ID_LDO4, | ||
19 | DA9030_ID_LDO5, | ||
20 | DA9030_ID_LDO6, | ||
21 | DA9030_ID_LDO7, | ||
22 | DA9030_ID_LDO8, | ||
23 | DA9030_ID_LDO9, | ||
24 | DA9030_ID_LDO10, | ||
25 | DA9030_ID_LDO11, | ||
26 | DA9030_ID_LDO12, | ||
27 | DA9030_ID_LDO13, | ||
28 | DA9030_ID_LDO14, | ||
29 | DA9030_ID_LDO15, | ||
30 | DA9030_ID_LDO16, | ||
31 | DA9030_ID_LDO17, | ||
32 | DA9030_ID_LDO18, | ||
33 | DA9030_ID_LDO19, | ||
34 | DA9030_ID_LDO_INT, /* LDO Internal */ | ||
35 | |||
36 | DA9034_ID_LED_1, | ||
37 | DA9034_ID_LED_2, | ||
38 | DA9034_ID_VIBRA, | ||
39 | DA9034_ID_WLED, | ||
40 | DA9034_ID_TOUCH, | ||
41 | |||
42 | DA9034_ID_BUCK1, | ||
43 | DA9034_ID_BUCK2, | ||
44 | DA9034_ID_LDO1, | ||
45 | DA9034_ID_LDO2, | ||
46 | DA9034_ID_LDO3, | ||
47 | DA9034_ID_LDO4, | ||
48 | DA9034_ID_LDO5, | ||
49 | DA9034_ID_LDO6, | ||
50 | DA9034_ID_LDO7, | ||
51 | DA9034_ID_LDO8, | ||
52 | DA9034_ID_LDO9, | ||
53 | DA9034_ID_LDO10, | ||
54 | DA9034_ID_LDO11, | ||
55 | DA9034_ID_LDO12, | ||
56 | DA9034_ID_LDO13, | ||
57 | DA9034_ID_LDO14, | ||
58 | DA9034_ID_LDO15, | ||
59 | }; | ||
60 | |||
61 | /* | ||
62 | * DA9030/DA9034 LEDs sub-devices uses generic "struct led_info" | ||
63 | * as the platform_data | ||
64 | */ | ||
65 | |||
66 | /* DA9030 flags for "struct led_info" | ||
67 | */ | ||
68 | #define DA9030_LED_RATE_ON (0 << 5) | ||
69 | #define DA9030_LED_RATE_052S (1 << 5) | ||
70 | #define DA9030_LED_DUTY_1_16 (0 << 3) | ||
71 | #define DA9030_LED_DUTY_1_8 (1 << 3) | ||
72 | #define DA9030_LED_DUTY_1_4 (2 << 3) | ||
73 | #define DA9030_LED_DUTY_1_2 (3 << 3) | ||
74 | |||
75 | #define DA9030_VIBRA_MODE_1P3V (0 << 1) | ||
76 | #define DA9030_VIBRA_MODE_2P7V (1 << 1) | ||
77 | #define DA9030_VIBRA_FREQ_1HZ (0 << 2) | ||
78 | #define DA9030_VIBRA_FREQ_2HZ (1 << 2) | ||
79 | #define DA9030_VIBRA_FREQ_4HZ (2 << 2) | ||
80 | #define DA9030_VIBRA_FREQ_8HZ (3 << 2) | ||
81 | #define DA9030_VIBRA_DUTY_ON (0 << 4) | ||
82 | #define DA9030_VIBRA_DUTY_75P (1 << 4) | ||
83 | #define DA9030_VIBRA_DUTY_50P (2 << 4) | ||
84 | #define DA9030_VIBRA_DUTY_25P (3 << 4) | ||
85 | |||
86 | /* DA9034 flags for "struct led_info" */ | ||
87 | #define DA9034_LED_RAMP (1 << 7) | ||
88 | |||
89 | /* DA9034 touch screen platform data */ | ||
90 | struct da9034_touch_pdata { | ||
91 | int interval_ms; /* sampling interval while pen down */ | ||
92 | int x_inverted; | ||
93 | int y_inverted; | ||
94 | }; | ||
95 | |||
96 | struct da903x_subdev_info { | ||
97 | int id; | ||
98 | const char *name; | ||
99 | void *platform_data; | ||
100 | }; | ||
101 | |||
102 | struct da903x_platform_data { | ||
103 | int num_subdevs; | ||
104 | struct da903x_subdev_info *subdevs; | ||
105 | }; | ||
106 | |||
107 | /* bit definitions for DA9030 events */ | ||
108 | #define DA9030_EVENT_ONKEY (1 << 0) | ||
109 | #define DA9030_EVENT_PWREN (1 << 1) | ||
110 | #define DA9030_EVENT_EXTON (1 << 2) | ||
111 | #define DA9030_EVENT_CHDET (1 << 3) | ||
112 | #define DA9030_EVENT_TBAT (1 << 4) | ||
113 | #define DA9030_EVENT_VBATMON (1 << 5) | ||
114 | #define DA9030_EVENT_VBATMON_TXON (1 << 6) | ||
115 | #define DA9030_EVENT_CHIOVER (1 << 7) | ||
116 | #define DA9030_EVENT_TCTO (1 << 8) | ||
117 | #define DA9030_EVENT_CCTO (1 << 9) | ||
118 | #define DA9030_EVENT_ADC_READY (1 << 10) | ||
119 | #define DA9030_EVENT_VBUS_4P4 (1 << 11) | ||
120 | #define DA9030_EVENT_VBUS_4P0 (1 << 12) | ||
121 | #define DA9030_EVENT_SESS_VALID (1 << 13) | ||
122 | #define DA9030_EVENT_SRP_DETECT (1 << 14) | ||
123 | #define DA9030_EVENT_WATCHDOG (1 << 15) | ||
124 | #define DA9030_EVENT_LDO15 (1 << 16) | ||
125 | #define DA9030_EVENT_LDO16 (1 << 17) | ||
126 | #define DA9030_EVENT_LDO17 (1 << 18) | ||
127 | #define DA9030_EVENT_LDO18 (1 << 19) | ||
128 | #define DA9030_EVENT_LDO19 (1 << 20) | ||
129 | #define DA9030_EVENT_BUCK2 (1 << 21) | ||
130 | |||
131 | /* bit definitions for DA9034 events */ | ||
132 | #define DA9034_EVENT_ONKEY (1 << 0) | ||
133 | #define DA9034_EVENT_EXTON (1 << 2) | ||
134 | #define DA9034_EVENT_CHDET (1 << 3) | ||
135 | #define DA9034_EVENT_TBAT (1 << 4) | ||
136 | #define DA9034_EVENT_VBATMON (1 << 5) | ||
137 | #define DA9034_EVENT_REV_IOVER (1 << 6) | ||
138 | #define DA9034_EVENT_CH_IOVER (1 << 7) | ||
139 | #define DA9034_EVENT_CH_TCTO (1 << 8) | ||
140 | #define DA9034_EVENT_CH_CCTO (1 << 9) | ||
141 | #define DA9034_EVENT_USB_DEV (1 << 10) | ||
142 | #define DA9034_EVENT_OTGCP_IOVER (1 << 11) | ||
143 | #define DA9034_EVENT_VBUS_4P55 (1 << 12) | ||
144 | #define DA9034_EVENT_VBUS_3P8 (1 << 13) | ||
145 | #define DA9034_EVENT_SESS_1P8 (1 << 14) | ||
146 | #define DA9034_EVENT_SRP_READY (1 << 15) | ||
147 | #define DA9034_EVENT_ADC_MAN (1 << 16) | ||
148 | #define DA9034_EVENT_ADC_AUTO4 (1 << 17) | ||
149 | #define DA9034_EVENT_ADC_AUTO5 (1 << 18) | ||
150 | #define DA9034_EVENT_ADC_AUTO6 (1 << 19) | ||
151 | #define DA9034_EVENT_PEN_DOWN (1 << 20) | ||
152 | #define DA9034_EVENT_TSI_READY (1 << 21) | ||
153 | #define DA9034_EVENT_UART_TX (1 << 22) | ||
154 | #define DA9034_EVENT_UART_RX (1 << 23) | ||
155 | #define DA9034_EVENT_HEADSET (1 << 25) | ||
156 | #define DA9034_EVENT_HOOKSWITCH (1 << 26) | ||
157 | #define DA9034_EVENT_WATCHDOG (1 << 27) | ||
158 | |||
159 | extern int da903x_register_notifier(struct device *dev, | ||
160 | struct notifier_block *nb, unsigned int events); | ||
161 | extern int da903x_unregister_notifier(struct device *dev, | ||
162 | struct notifier_block *nb, unsigned int events); | ||
163 | |||
164 | /* Status Query Interface */ | ||
165 | #define DA9030_STATUS_ONKEY (1 << 0) | ||
166 | #define DA9030_STATUS_PWREN1 (1 << 1) | ||
167 | #define DA9030_STATUS_EXTON (1 << 2) | ||
168 | #define DA9030_STATUS_CHDET (1 << 3) | ||
169 | #define DA9030_STATUS_TBAT (1 << 4) | ||
170 | #define DA9030_STATUS_VBATMON (1 << 5) | ||
171 | #define DA9030_STATUS_VBATMON_TXON (1 << 6) | ||
172 | #define DA9030_STATUS_MCLKDET (1 << 7) | ||
173 | |||
174 | #define DA9034_STATUS_ONKEY (1 << 0) | ||
175 | #define DA9034_STATUS_EXTON (1 << 2) | ||
176 | #define DA9034_STATUS_CHDET (1 << 3) | ||
177 | #define DA9034_STATUS_TBAT (1 << 4) | ||
178 | #define DA9034_STATUS_VBATMON (1 << 5) | ||
179 | #define DA9034_STATUS_PEN_DOWN (1 << 6) | ||
180 | #define DA9034_STATUS_MCLKDET (1 << 7) | ||
181 | #define DA9034_STATUS_USB_DEV (1 << 8) | ||
182 | #define DA9034_STATUS_HEADSET (1 << 9) | ||
183 | #define DA9034_STATUS_HOOKSWITCH (1 << 10) | ||
184 | #define DA9034_STATUS_REMCON (1 << 11) | ||
185 | #define DA9034_STATUS_VBUS_VALID_4P55 (1 << 12) | ||
186 | #define DA9034_STATUS_VBUS_VALID_3P8 (1 << 13) | ||
187 | #define DA9034_STATUS_SESS_VALID_1P8 (1 << 14) | ||
188 | #define DA9034_STATUS_SRP_READY (1 << 15) | ||
189 | |||
190 | extern int da903x_query_status(struct device *dev, unsigned int status); | ||
191 | |||
192 | |||
193 | /* NOTE: the two functions below are not intended for use outside | ||
194 | * of the DA9034 sub-device drivers | ||
195 | */ | ||
196 | extern int da903x_write(struct device *dev, int reg, uint8_t val); | ||
197 | extern int da903x_read(struct device *dev, int reg, uint8_t *val); | ||
198 | extern int da903x_update(struct device *dev, int reg, uint8_t val, uint8_t mask); | ||
199 | extern int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask); | ||
200 | extern int da903x_clr_bits(struct device *dev, int reg, uint8_t bit_mask); | ||
201 | #endif /* __LINUX_PMIC_DA903X_H */ | ||
diff --git a/include/linux/mfd/t7l66xb.h b/include/linux/mfd/t7l66xb.h index e83c7f2036f9..b4629818aea5 100644 --- a/include/linux/mfd/t7l66xb.h +++ b/include/linux/mfd/t7l66xb.h | |||
@@ -15,8 +15,6 @@ | |||
15 | #include <linux/mfd/tmio.h> | 15 | #include <linux/mfd/tmio.h> |
16 | 16 | ||
17 | struct t7l66xb_platform_data { | 17 | struct t7l66xb_platform_data { |
18 | int (*enable_clk32k)(struct platform_device *dev); | ||
19 | void (*disable_clk32k)(struct platform_device *dev); | ||
20 | int (*enable)(struct platform_device *dev); | 18 | int (*enable)(struct platform_device *dev); |
21 | int (*disable)(struct platform_device *dev); | 19 | int (*disable)(struct platform_device *dev); |
22 | int (*suspend)(struct platform_device *dev); | 20 | int (*suspend)(struct platform_device *dev); |
diff --git a/include/linux/mfd/tc6387xb.h b/include/linux/mfd/tc6387xb.h index fa06e0610b8e..b4888209494a 100644 --- a/include/linux/mfd/tc6387xb.h +++ b/include/linux/mfd/tc6387xb.h | |||
@@ -11,9 +11,6 @@ | |||
11 | #define MFD_TC6387XB_H | 11 | #define MFD_TC6387XB_H |
12 | 12 | ||
13 | struct tc6387xb_platform_data { | 13 | struct tc6387xb_platform_data { |
14 | int (*enable_clk32k)(struct platform_device *dev); | ||
15 | void (*disable_clk32k)(struct platform_device *dev); | ||
16 | |||
17 | int (*enable)(struct platform_device *dev); | 14 | int (*enable)(struct platform_device *dev); |
18 | int (*disable)(struct platform_device *dev); | 15 | int (*disable)(struct platform_device *dev); |
19 | int (*suspend)(struct platform_device *dev); | 16 | int (*suspend)(struct platform_device *dev); |
diff --git a/include/linux/mfd/tc6393xb.h b/include/linux/mfd/tc6393xb.h index fec7b3f7a81f..626e448205c5 100644 --- a/include/linux/mfd/tc6393xb.h +++ b/include/linux/mfd/tc6393xb.h | |||
@@ -17,12 +17,12 @@ | |||
17 | #ifndef MFD_TC6393XB_H | 17 | #ifndef MFD_TC6393XB_H |
18 | #define MFD_TC6393XB_H | 18 | #define MFD_TC6393XB_H |
19 | 19 | ||
20 | #include <linux/fb.h> | ||
21 | |||
20 | /* Also one should provide the CK3P6MI clock */ | 22 | /* Also one should provide the CK3P6MI clock */ |
21 | struct tc6393xb_platform_data { | 23 | struct tc6393xb_platform_data { |
22 | u16 scr_pll2cr; /* PLL2 Control */ | 24 | u16 scr_pll2cr; /* PLL2 Control */ |
23 | u16 scr_gper; /* GP Enable */ | 25 | u16 scr_gper; /* GP Enable */ |
24 | u32 scr_gpo_doecr; /* GPO Data OE Control */ | ||
25 | u32 scr_gpo_dsr; /* GPO Data Set */ | ||
26 | 26 | ||
27 | int (*enable)(struct platform_device *dev); | 27 | int (*enable)(struct platform_device *dev); |
28 | int (*disable)(struct platform_device *dev); | 28 | int (*disable)(struct platform_device *dev); |
@@ -31,15 +31,28 @@ struct tc6393xb_platform_data { | |||
31 | 31 | ||
32 | int irq_base; /* base for subdevice irqs */ | 32 | int irq_base; /* base for subdevice irqs */ |
33 | int gpio_base; | 33 | int gpio_base; |
34 | int (*setup)(struct platform_device *dev); | ||
35 | void (*teardown)(struct platform_device *dev); | ||
34 | 36 | ||
35 | struct tmio_nand_data *nand_data; | 37 | struct tmio_nand_data *nand_data; |
38 | struct tmio_fb_data *fb_data; | ||
39 | |||
40 | unsigned resume_restore : 1; /* make special actions | ||
41 | to preserve the state | ||
42 | on suspend/resume */ | ||
36 | }; | 43 | }; |
37 | 44 | ||
45 | extern int tc6393xb_lcd_mode(struct platform_device *fb, | ||
46 | const struct fb_videomode *mode); | ||
47 | extern int tc6393xb_lcd_set_power(struct platform_device *fb, bool on); | ||
48 | |||
38 | /* | 49 | /* |
39 | * Relative to irq_base | 50 | * Relative to irq_base |
40 | */ | 51 | */ |
41 | #define IRQ_TC6393_NAND 0 | 52 | #define IRQ_TC6393_NAND 0 |
42 | #define IRQ_TC6393_MMC 1 | 53 | #define IRQ_TC6393_MMC 1 |
54 | #define IRQ_TC6393_OHCI 2 | ||
55 | #define IRQ_TC6393_FB 4 | ||
43 | 56 | ||
44 | #define TC6393XB_NR_IRQS 8 | 57 | #define TC6393XB_NR_IRQS 8 |
45 | 58 | ||
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h index ec612e66391c..516d955ab8a1 100644 --- a/include/linux/mfd/tmio.h +++ b/include/linux/mfd/tmio.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef MFD_TMIO_H | 1 | #ifndef MFD_TMIO_H |
2 | #define MFD_TMIO_H | 2 | #define MFD_TMIO_H |
3 | 3 | ||
4 | #include <linux/fb.h> | ||
5 | |||
4 | #define tmio_ioread8(addr) readb(addr) | 6 | #define tmio_ioread8(addr) readb(addr) |
5 | #define tmio_ioread16(addr) readw(addr) | 7 | #define tmio_ioread16(addr) readw(addr) |
6 | #define tmio_ioread16_rep(r, b, l) readsw(r, b, l) | 8 | #define tmio_ioread16_rep(r, b, l) readsw(r, b, l) |
@@ -25,4 +27,21 @@ struct tmio_nand_data { | |||
25 | unsigned int num_partitions; | 27 | unsigned int num_partitions; |
26 | }; | 28 | }; |
27 | 29 | ||
30 | #define FBIO_TMIO_ACC_WRITE 0x7C639300 | ||
31 | #define FBIO_TMIO_ACC_SYNC 0x7C639301 | ||
32 | |||
33 | struct tmio_fb_data { | ||
34 | int (*lcd_set_power)(struct platform_device *fb_dev, | ||
35 | bool on); | ||
36 | int (*lcd_mode)(struct platform_device *fb_dev, | ||
37 | const struct fb_videomode *mode); | ||
38 | int num_modes; | ||
39 | struct fb_videomode *modes; | ||
40 | |||
41 | /* in mm: size of screen */ | ||
42 | int height; | ||
43 | int width; | ||
44 | }; | ||
45 | |||
46 | |||
28 | #endif | 47 | #endif |
diff --git a/include/linux/mfd/wm8350/audio.h b/include/linux/mfd/wm8350/audio.h new file mode 100644 index 000000000000..217bb22ebb8e --- /dev/null +++ b/include/linux/mfd/wm8350/audio.h | |||
@@ -0,0 +1,598 @@ | |||
1 | /* | ||
2 | * audio.h -- Audio Driver for Wolfson WM8350 PMIC | ||
3 | * | ||
4 | * Copyright 2007 Wolfson Microelectronics PLC | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_MFD_WM8350_AUDIO_H_ | ||
14 | #define __LINUX_MFD_WM8350_AUDIO_H_ | ||
15 | |||
16 | #include <linux/platform_device.h> | ||
17 | |||
18 | #define WM8350_CLOCK_CONTROL_1 0x28 | ||
19 | #define WM8350_CLOCK_CONTROL_2 0x29 | ||
20 | #define WM8350_FLL_CONTROL_1 0x2A | ||
21 | #define WM8350_FLL_CONTROL_2 0x2B | ||
22 | #define WM8350_FLL_CONTROL_3 0x2C | ||
23 | #define WM8350_FLL_CONTROL_4 0x2D | ||
24 | #define WM8350_DAC_CONTROL 0x30 | ||
25 | #define WM8350_DAC_DIGITAL_VOLUME_L 0x32 | ||
26 | #define WM8350_DAC_DIGITAL_VOLUME_R 0x33 | ||
27 | #define WM8350_DAC_LR_RATE 0x35 | ||
28 | #define WM8350_DAC_CLOCK_CONTROL 0x36 | ||
29 | #define WM8350_DAC_MUTE 0x3A | ||
30 | #define WM8350_DAC_MUTE_VOLUME 0x3B | ||
31 | #define WM8350_DAC_SIDE 0x3C | ||
32 | #define WM8350_ADC_CONTROL 0x40 | ||
33 | #define WM8350_ADC_DIGITAL_VOLUME_L 0x42 | ||
34 | #define WM8350_ADC_DIGITAL_VOLUME_R 0x43 | ||
35 | #define WM8350_ADC_DIVIDER 0x44 | ||
36 | #define WM8350_ADC_LR_RATE 0x46 | ||
37 | #define WM8350_INPUT_CONTROL 0x48 | ||
38 | #define WM8350_IN3_INPUT_CONTROL 0x49 | ||
39 | #define WM8350_MIC_BIAS_CONTROL 0x4A | ||
40 | #define WM8350_OUTPUT_CONTROL 0x4C | ||
41 | #define WM8350_JACK_DETECT 0x4D | ||
42 | #define WM8350_ANTI_POP_CONTROL 0x4E | ||
43 | #define WM8350_LEFT_INPUT_VOLUME 0x50 | ||
44 | #define WM8350_RIGHT_INPUT_VOLUME 0x51 | ||
45 | #define WM8350_LEFT_MIXER_CONTROL 0x58 | ||
46 | #define WM8350_RIGHT_MIXER_CONTROL 0x59 | ||
47 | #define WM8350_OUT3_MIXER_CONTROL 0x5C | ||
48 | #define WM8350_OUT4_MIXER_CONTROL 0x5D | ||
49 | #define WM8350_OUTPUT_LEFT_MIXER_VOLUME 0x60 | ||
50 | #define WM8350_OUTPUT_RIGHT_MIXER_VOLUME 0x61 | ||
51 | #define WM8350_INPUT_MIXER_VOLUME_L 0x62 | ||
52 | #define WM8350_INPUT_MIXER_VOLUME_R 0x63 | ||
53 | #define WM8350_INPUT_MIXER_VOLUME 0x64 | ||
54 | #define WM8350_LOUT1_VOLUME 0x68 | ||
55 | #define WM8350_ROUT1_VOLUME 0x69 | ||
56 | #define WM8350_LOUT2_VOLUME 0x6A | ||
57 | #define WM8350_ROUT2_VOLUME 0x6B | ||
58 | #define WM8350_BEEP_VOLUME 0x6F | ||
59 | #define WM8350_AI_FORMATING 0x70 | ||
60 | #define WM8350_ADC_DAC_COMP 0x71 | ||
61 | #define WM8350_AI_ADC_CONTROL 0x72 | ||
62 | #define WM8350_AI_DAC_CONTROL 0x73 | ||
63 | #define WM8350_AIF_TEST 0x74 | ||
64 | #define WM8350_JACK_PIN_STATUS 0xE7 | ||
65 | |||
66 | /* Bit values for R08 (0x08) */ | ||
67 | #define WM8350_CODEC_ISEL_1_5 0 /* x1.5 */ | ||
68 | #define WM8350_CODEC_ISEL_1_0 1 /* x1.0 */ | ||
69 | #define WM8350_CODEC_ISEL_0_75 2 /* x0.75 */ | ||
70 | #define WM8350_CODEC_ISEL_0_5 3 /* x0.5 */ | ||
71 | |||
72 | #define WM8350_VMID_OFF 0 | ||
73 | #define WM8350_VMID_500K 1 | ||
74 | #define WM8350_VMID_100K 2 | ||
75 | #define WM8350_VMID_10K 3 | ||
76 | |||
77 | /* | ||
78 | * R40 (0x28) - Clock Control 1 | ||
79 | */ | ||
80 | #define WM8350_TOCLK_RATE 0x4000 | ||
81 | #define WM8350_MCLK_SEL 0x0800 | ||
82 | #define WM8350_MCLK_DIV_MASK 0x0100 | ||
83 | #define WM8350_BCLK_DIV_MASK 0x00F0 | ||
84 | #define WM8350_OPCLK_DIV_MASK 0x0007 | ||
85 | |||
86 | /* | ||
87 | * R41 (0x29) - Clock Control 2 | ||
88 | */ | ||
89 | #define WM8350_LRC_ADC_SEL 0x8000 | ||
90 | #define WM8350_MCLK_DIR 0x0001 | ||
91 | |||
92 | /* | ||
93 | * R42 (0x2A) - FLL Control 1 | ||
94 | */ | ||
95 | #define WM8350_FLL_DITHER_WIDTH_MASK 0x3000 | ||
96 | #define WM8350_FLL_DITHER_HP 0x0800 | ||
97 | #define WM8350_FLL_OUTDIV_MASK 0x0700 | ||
98 | #define WM8350_FLL_RSP_RATE_MASK 0x00F0 | ||
99 | #define WM8350_FLL_RATE_MASK 0x0007 | ||
100 | |||
101 | /* | ||
102 | * R43 (0x2B) - FLL Control 2 | ||
103 | */ | ||
104 | #define WM8350_FLL_RATIO_MASK 0xF800 | ||
105 | #define WM8350_FLL_N_MASK 0x03FF | ||
106 | |||
107 | /* | ||
108 | * R44 (0x2C) - FLL Control 3 | ||
109 | */ | ||
110 | #define WM8350_FLL_K_MASK 0xFFFF | ||
111 | |||
112 | /* | ||
113 | * R45 (0x2D) - FLL Control 4 | ||
114 | */ | ||
115 | #define WM8350_FLL_FRAC 0x0020 | ||
116 | #define WM8350_FLL_SLOW_LOCK_REF 0x0010 | ||
117 | #define WM8350_FLL_CLK_SRC_MASK 0x0003 | ||
118 | |||
119 | /* | ||
120 | * R48 (0x30) - DAC Control | ||
121 | */ | ||
122 | #define WM8350_DAC_MONO 0x2000 | ||
123 | #define WM8350_AIF_LRCLKRATE 0x1000 | ||
124 | #define WM8350_DEEMP_MASK 0x0030 | ||
125 | #define WM8350_DACL_DATINV 0x0002 | ||
126 | #define WM8350_DACR_DATINV 0x0001 | ||
127 | |||
128 | /* | ||
129 | * R50 (0x32) - DAC Digital Volume L | ||
130 | */ | ||
131 | #define WM8350_DAC_VU 0x0100 | ||
132 | #define WM8350_DACL_VOL_MASK 0x00FF | ||
133 | |||
134 | /* | ||
135 | * R51 (0x33) - DAC Digital Volume R | ||
136 | */ | ||
137 | #define WM8350_DAC_VU 0x0100 | ||
138 | #define WM8350_DACR_VOL_MASK 0x00FF | ||
139 | |||
140 | /* | ||
141 | * R53 (0x35) - DAC LR Rate | ||
142 | */ | ||
143 | #define WM8350_DACLRC_ENA 0x0800 | ||
144 | #define WM8350_DACLRC_RATE_MASK 0x07FF | ||
145 | |||
146 | /* | ||
147 | * R54 (0x36) - DAC Clock Control | ||
148 | */ | ||
149 | #define WM8350_DACCLK_POL 0x0010 | ||
150 | #define WM8350_DAC_CLKDIV_MASK 0x0007 | ||
151 | |||
152 | /* | ||
153 | * R58 (0x3A) - DAC Mute | ||
154 | */ | ||
155 | #define WM8350_DAC_MUTE_ENA 0x4000 | ||
156 | |||
157 | /* | ||
158 | * R59 (0x3B) - DAC Mute Volume | ||
159 | */ | ||
160 | #define WM8350_DAC_MUTEMODE 0x4000 | ||
161 | #define WM8350_DAC_MUTERATE 0x2000 | ||
162 | #define WM8350_DAC_SB_FILT 0x1000 | ||
163 | |||
164 | /* | ||
165 | * R60 (0x3C) - DAC Side | ||
166 | */ | ||
167 | #define WM8350_ADC_TO_DACL_MASK 0x3000 | ||
168 | #define WM8350_ADC_TO_DACR_MASK 0x0C00 | ||
169 | |||
170 | /* | ||
171 | * R64 (0x40) - ADC Control | ||
172 | */ | ||
173 | #define WM8350_ADC_HPF_CUT_MASK 0x0300 | ||
174 | #define WM8350_ADCL_DATINV 0x0002 | ||
175 | #define WM8350_ADCR_DATINV 0x0001 | ||
176 | |||
177 | /* | ||
178 | * R66 (0x42) - ADC Digital Volume L | ||
179 | */ | ||
180 | #define WM8350_ADC_VU 0x0100 | ||
181 | #define WM8350_ADCL_VOL_MASK 0x00FF | ||
182 | |||
183 | /* | ||
184 | * R67 (0x43) - ADC Digital Volume R | ||
185 | */ | ||
186 | #define WM8350_ADC_VU 0x0100 | ||
187 | #define WM8350_ADCR_VOL_MASK 0x00FF | ||
188 | |||
189 | /* | ||
190 | * R68 (0x44) - ADC Divider | ||
191 | */ | ||
192 | #define WM8350_ADCL_DAC_SVOL_MASK 0x0F00 | ||
193 | #define WM8350_ADCR_DAC_SVOL_MASK 0x00F0 | ||
194 | #define WM8350_ADCCLK_POL 0x0008 | ||
195 | #define WM8350_ADC_CLKDIV_MASK 0x0007 | ||
196 | |||
197 | /* | ||
198 | * R70 (0x46) - ADC LR Rate | ||
199 | */ | ||
200 | #define WM8350_ADCLRC_ENA 0x0800 | ||
201 | #define WM8350_ADCLRC_RATE_MASK 0x07FF | ||
202 | |||
203 | /* | ||
204 | * R72 (0x48) - Input Control | ||
205 | */ | ||
206 | #define WM8350_IN2R_ENA 0x0400 | ||
207 | #define WM8350_IN1RN_ENA 0x0200 | ||
208 | #define WM8350_IN1RP_ENA 0x0100 | ||
209 | #define WM8350_IN2L_ENA 0x0004 | ||
210 | #define WM8350_IN1LN_ENA 0x0002 | ||
211 | #define WM8350_IN1LP_ENA 0x0001 | ||
212 | |||
213 | /* | ||
214 | * R73 (0x49) - IN3 Input Control | ||
215 | */ | ||
216 | #define WM8350_IN3R_SHORT 0x4000 | ||
217 | #define WM8350_IN3L_SHORT 0x0040 | ||
218 | |||
219 | /* | ||
220 | * R74 (0x4A) - Mic Bias Control | ||
221 | */ | ||
222 | #define WM8350_MICBSEL 0x4000 | ||
223 | #define WM8350_MCDTHR_MASK 0x001C | ||
224 | #define WM8350_MCDSCTHR_MASK 0x0003 | ||
225 | |||
226 | /* | ||
227 | * R76 (0x4C) - Output Control | ||
228 | */ | ||
229 | #define WM8350_OUT4_VROI 0x0800 | ||
230 | #define WM8350_OUT3_VROI 0x0400 | ||
231 | #define WM8350_OUT2_VROI 0x0200 | ||
232 | #define WM8350_OUT1_VROI 0x0100 | ||
233 | #define WM8350_OUT2_FB 0x0004 | ||
234 | #define WM8350_OUT1_FB 0x0001 | ||
235 | |||
236 | /* | ||
237 | * R77 (0x4D) - Jack Detect | ||
238 | */ | ||
239 | #define WM8350_JDL_ENA 0x8000 | ||
240 | #define WM8350_JDR_ENA 0x4000 | ||
241 | |||
242 | /* | ||
243 | * R78 (0x4E) - Anti Pop Control | ||
244 | */ | ||
245 | #define WM8350_ANTI_POP_MASK 0x0300 | ||
246 | #define WM8350_DIS_OP_LN4_MASK 0x00C0 | ||
247 | #define WM8350_DIS_OP_LN3_MASK 0x0030 | ||
248 | #define WM8350_DIS_OP_OUT2_MASK 0x000C | ||
249 | #define WM8350_DIS_OP_OUT1_MASK 0x0003 | ||
250 | |||
251 | /* | ||
252 | * R80 (0x50) - Left Input Volume | ||
253 | */ | ||
254 | #define WM8350_INL_MUTE 0x4000 | ||
255 | #define WM8350_INL_ZC 0x2000 | ||
256 | #define WM8350_IN_VU 0x0100 | ||
257 | #define WM8350_INL_VOL_MASK 0x00FC | ||
258 | |||
259 | /* | ||
260 | * R81 (0x51) - Right Input Volume | ||
261 | */ | ||
262 | #define WM8350_INR_MUTE 0x4000 | ||
263 | #define WM8350_INR_ZC 0x2000 | ||
264 | #define WM8350_IN_VU 0x0100 | ||
265 | #define WM8350_INR_VOL_MASK 0x00FC | ||
266 | |||
267 | /* | ||
268 | * R88 (0x58) - Left Mixer Control | ||
269 | */ | ||
270 | #define WM8350_DACR_TO_MIXOUTL 0x1000 | ||
271 | #define WM8350_DACL_TO_MIXOUTL 0x0800 | ||
272 | #define WM8350_IN3L_TO_MIXOUTL 0x0004 | ||
273 | #define WM8350_INR_TO_MIXOUTL 0x0002 | ||
274 | #define WM8350_INL_TO_MIXOUTL 0x0001 | ||
275 | |||
276 | /* | ||
277 | * R89 (0x59) - Right Mixer Control | ||
278 | */ | ||
279 | #define WM8350_DACR_TO_MIXOUTR 0x1000 | ||
280 | #define WM8350_DACL_TO_MIXOUTR 0x0800 | ||
281 | #define WM8350_IN3R_TO_MIXOUTR 0x0008 | ||
282 | #define WM8350_INR_TO_MIXOUTR 0x0002 | ||
283 | #define WM8350_INL_TO_MIXOUTR 0x0001 | ||
284 | |||
285 | /* | ||
286 | * R92 (0x5C) - OUT3 Mixer Control | ||
287 | */ | ||
288 | #define WM8350_DACL_TO_OUT3 0x0800 | ||
289 | #define WM8350_MIXINL_TO_OUT3 0x0100 | ||
290 | #define WM8350_OUT4_TO_OUT3 0x0008 | ||
291 | #define WM8350_MIXOUTL_TO_OUT3 0x0001 | ||
292 | |||
293 | /* | ||
294 | * R93 (0x5D) - OUT4 Mixer Control | ||
295 | */ | ||
296 | #define WM8350_DACR_TO_OUT4 0x1000 | ||
297 | #define WM8350_DACL_TO_OUT4 0x0800 | ||
298 | #define WM8350_OUT4_ATTN 0x0400 | ||
299 | #define WM8350_MIXINR_TO_OUT4 0x0200 | ||
300 | #define WM8350_OUT3_TO_OUT4 0x0004 | ||
301 | #define WM8350_MIXOUTR_TO_OUT4 0x0002 | ||
302 | #define WM8350_MIXOUTL_TO_OUT4 0x0001 | ||
303 | |||
304 | /* | ||
305 | * R96 (0x60) - Output Left Mixer Volume | ||
306 | */ | ||
307 | #define WM8350_IN3L_MIXOUTL_VOL_MASK 0x0E00 | ||
308 | #define WM8350_IN3L_MIXOUTL_VOL_SHIFT 9 | ||
309 | #define WM8350_INR_MIXOUTL_VOL_MASK 0x00E0 | ||
310 | #define WM8350_INR_MIXOUTL_VOL_SHIFT 5 | ||
311 | #define WM8350_INL_MIXOUTL_VOL_MASK 0x000E | ||
312 | #define WM8350_INL_MIXOUTL_VOL_SHIFT 1 | ||
313 | |||
314 | /* Bit values for R96 (0x60) */ | ||
315 | #define WM8350_IN3L_MIXOUTL_VOL_OFF 0 | ||
316 | #define WM8350_IN3L_MIXOUTL_VOL_M12DB 1 | ||
317 | #define WM8350_IN3L_MIXOUTL_VOL_M9DB 2 | ||
318 | #define WM8350_IN3L_MIXOUTL_VOL_M6DB 3 | ||
319 | #define WM8350_IN3L_MIXOUTL_VOL_M3DB 4 | ||
320 | #define WM8350_IN3L_MIXOUTL_VOL_0DB 5 | ||
321 | #define WM8350_IN3L_MIXOUTL_VOL_3DB 6 | ||
322 | #define WM8350_IN3L_MIXOUTL_VOL_6DB 7 | ||
323 | |||
324 | #define WM8350_INR_MIXOUTL_VOL_OFF 0 | ||
325 | #define WM8350_INR_MIXOUTL_VOL_M12DB 1 | ||
326 | #define WM8350_INR_MIXOUTL_VOL_M9DB 2 | ||
327 | #define WM8350_INR_MIXOUTL_VOL_M6DB 3 | ||
328 | #define WM8350_INR_MIXOUTL_VOL_M3DB 4 | ||
329 | #define WM8350_INR_MIXOUTL_VOL_0DB 5 | ||
330 | #define WM8350_INR_MIXOUTL_VOL_3DB 6 | ||
331 | #define WM8350_INR_MIXOUTL_VOL_6DB 7 | ||
332 | |||
333 | #define WM8350_INL_MIXOUTL_VOL_OFF 0 | ||
334 | #define WM8350_INL_MIXOUTL_VOL_M12DB 1 | ||
335 | #define WM8350_INL_MIXOUTL_VOL_M9DB 2 | ||
336 | #define WM8350_INL_MIXOUTL_VOL_M6DB 3 | ||
337 | #define WM8350_INL_MIXOUTL_VOL_M3DB 4 | ||
338 | #define WM8350_INL_MIXOUTL_VOL_0DB 5 | ||
339 | #define WM8350_INL_MIXOUTL_VOL_3DB 6 | ||
340 | #define WM8350_INL_MIXOUTL_VOL_6DB 7 | ||
341 | |||
342 | /* | ||
343 | * R97 (0x61) - Output Right Mixer Volume | ||
344 | */ | ||
345 | #define WM8350_IN3R_MIXOUTR_VOL_MASK 0xE000 | ||
346 | #define WM8350_IN3R_MIXOUTR_VOL_SHIFT 13 | ||
347 | #define WM8350_INR_MIXOUTR_VOL_MASK 0x00E0 | ||
348 | #define WM8350_INR_MIXOUTR_VOL_SHIFT 5 | ||
349 | #define WM8350_INL_MIXOUTR_VOL_MASK 0x000E | ||
350 | #define WM8350_INL_MIXOUTR_VOL_SHIFT 1 | ||
351 | |||
352 | /* Bit values for R96 (0x60) */ | ||
353 | #define WM8350_IN3R_MIXOUTR_VOL_OFF 0 | ||
354 | #define WM8350_IN3R_MIXOUTR_VOL_M12DB 1 | ||
355 | #define WM8350_IN3R_MIXOUTR_VOL_M9DB 2 | ||
356 | #define WM8350_IN3R_MIXOUTR_VOL_M6DB 3 | ||
357 | #define WM8350_IN3R_MIXOUTR_VOL_M3DB 4 | ||
358 | #define WM8350_IN3R_MIXOUTR_VOL_0DB 5 | ||
359 | #define WM8350_IN3R_MIXOUTR_VOL_3DB 6 | ||
360 | #define WM8350_IN3R_MIXOUTR_VOL_6DB 7 | ||
361 | |||
362 | #define WM8350_INR_MIXOUTR_VOL_OFF 0 | ||
363 | #define WM8350_INR_MIXOUTR_VOL_M12DB 1 | ||
364 | #define WM8350_INR_MIXOUTR_VOL_M9DB 2 | ||
365 | #define WM8350_INR_MIXOUTR_VOL_M6DB 3 | ||
366 | #define WM8350_INR_MIXOUTR_VOL_M3DB 4 | ||
367 | #define WM8350_INR_MIXOUTR_VOL_0DB 5 | ||
368 | #define WM8350_INR_MIXOUTR_VOL_3DB 6 | ||
369 | #define WM8350_INR_MIXOUTR_VOL_6DB 7 | ||
370 | |||
371 | #define WM8350_INL_MIXOUTR_VOL_OFF 0 | ||
372 | #define WM8350_INL_MIXOUTR_VOL_M12DB 1 | ||
373 | #define WM8350_INL_MIXOUTR_VOL_M9DB 2 | ||
374 | #define WM8350_INL_MIXOUTR_VOL_M6DB 3 | ||
375 | #define WM8350_INL_MIXOUTR_VOL_M3DB 4 | ||
376 | #define WM8350_INL_MIXOUTR_VOL_0DB 5 | ||
377 | #define WM8350_INL_MIXOUTR_VOL_3DB 6 | ||
378 | #define WM8350_INL_MIXOUTR_VOL_6DB 7 | ||
379 | |||
380 | /* | ||
381 | * R98 (0x62) - Input Mixer Volume L | ||
382 | */ | ||
383 | #define WM8350_IN3L_MIXINL_VOL_MASK 0x0E00 | ||
384 | #define WM8350_IN2L_MIXINL_VOL_MASK 0x000E | ||
385 | #define WM8350_INL_MIXINL_VOL 0x0001 | ||
386 | |||
387 | /* | ||
388 | * R99 (0x63) - Input Mixer Volume R | ||
389 | */ | ||
390 | #define WM8350_IN3R_MIXINR_VOL_MASK 0xE000 | ||
391 | #define WM8350_IN2R_MIXINR_VOL_MASK 0x00E0 | ||
392 | #define WM8350_INR_MIXINR_VOL 0x0001 | ||
393 | |||
394 | /* | ||
395 | * R100 (0x64) - Input Mixer Volume | ||
396 | */ | ||
397 | #define WM8350_OUT4_MIXIN_DST 0x8000 | ||
398 | #define WM8350_OUT4_MIXIN_VOL_MASK 0x000E | ||
399 | |||
400 | /* | ||
401 | * R104 (0x68) - LOUT1 Volume | ||
402 | */ | ||
403 | #define WM8350_OUT1L_MUTE 0x4000 | ||
404 | #define WM8350_OUT1L_ZC 0x2000 | ||
405 | #define WM8350_OUT1_VU 0x0100 | ||
406 | #define WM8350_OUT1L_VOL_MASK 0x00FC | ||
407 | #define WM8350_OUT1L_VOL_SHIFT 2 | ||
408 | |||
409 | /* | ||
410 | * R105 (0x69) - ROUT1 Volume | ||
411 | */ | ||
412 | #define WM8350_OUT1R_MUTE 0x4000 | ||
413 | #define WM8350_OUT1R_ZC 0x2000 | ||
414 | #define WM8350_OUT1_VU 0x0100 | ||
415 | #define WM8350_OUT1R_VOL_MASK 0x00FC | ||
416 | #define WM8350_OUT1R_VOL_SHIFT 2 | ||
417 | |||
418 | /* | ||
419 | * R106 (0x6A) - LOUT2 Volume | ||
420 | */ | ||
421 | #define WM8350_OUT2L_MUTE 0x4000 | ||
422 | #define WM8350_OUT2L_ZC 0x2000 | ||
423 | #define WM8350_OUT2_VU 0x0100 | ||
424 | #define WM8350_OUT2L_VOL_MASK 0x00FC | ||
425 | |||
426 | /* | ||
427 | * R107 (0x6B) - ROUT2 Volume | ||
428 | */ | ||
429 | #define WM8350_OUT2R_MUTE 0x4000 | ||
430 | #define WM8350_OUT2R_ZC 0x2000 | ||
431 | #define WM8350_OUT2R_INV 0x0400 | ||
432 | #define WM8350_OUT2R_INV_MUTE 0x0200 | ||
433 | #define WM8350_OUT2_VU 0x0100 | ||
434 | #define WM8350_OUT2R_VOL_MASK 0x00FC | ||
435 | |||
436 | /* | ||
437 | * R111 (0x6F) - BEEP Volume | ||
438 | */ | ||
439 | #define WM8350_IN3R_OUT2R_VOL_MASK 0x00E0 | ||
440 | |||
441 | /* | ||
442 | * R112 (0x70) - AI Formating | ||
443 | */ | ||
444 | #define WM8350_AIF_BCLK_INV 0x8000 | ||
445 | #define WM8350_AIF_TRI 0x2000 | ||
446 | #define WM8350_AIF_LRCLK_INV 0x1000 | ||
447 | #define WM8350_AIF_WL_MASK 0x0C00 | ||
448 | #define WM8350_AIF_FMT_MASK 0x0300 | ||
449 | |||
450 | /* | ||
451 | * R113 (0x71) - ADC DAC COMP | ||
452 | */ | ||
453 | #define WM8350_DAC_COMP 0x0080 | ||
454 | #define WM8350_DAC_COMPMODE 0x0040 | ||
455 | #define WM8350_ADC_COMP 0x0020 | ||
456 | #define WM8350_ADC_COMPMODE 0x0010 | ||
457 | #define WM8350_LOOPBACK 0x0001 | ||
458 | |||
459 | /* | ||
460 | * R114 (0x72) - AI ADC Control | ||
461 | */ | ||
462 | #define WM8350_AIFADC_PD 0x0080 | ||
463 | #define WM8350_AIFADCL_SRC 0x0040 | ||
464 | #define WM8350_AIFADCR_SRC 0x0020 | ||
465 | #define WM8350_AIFADC_TDM_CHAN 0x0010 | ||
466 | #define WM8350_AIFADC_TDM 0x0008 | ||
467 | |||
468 | /* | ||
469 | * R115 (0x73) - AI DAC Control | ||
470 | */ | ||
471 | #define WM8350_BCLK_MSTR 0x4000 | ||
472 | #define WM8350_AIFDAC_PD 0x0080 | ||
473 | #define WM8350_DACL_SRC 0x0040 | ||
474 | #define WM8350_DACR_SRC 0x0020 | ||
475 | #define WM8350_AIFDAC_TDM_CHAN 0x0010 | ||
476 | #define WM8350_AIFDAC_TDM 0x0008 | ||
477 | #define WM8350_DAC_BOOST_MASK 0x0003 | ||
478 | |||
479 | /* | ||
480 | * R116 (0x74) - AIF Test | ||
481 | */ | ||
482 | #define WM8350_CODEC_BYP 0x4000 | ||
483 | #define WM8350_AIFADC_WR_TST 0x2000 | ||
484 | #define WM8350_AIFADC_RD_TST 0x1000 | ||
485 | #define WM8350_AIFDAC_WR_TST 0x0800 | ||
486 | #define WM8350_AIFDAC_RD_TST 0x0400 | ||
487 | #define WM8350_AIFADC_ASYN 0x0020 | ||
488 | #define WM8350_AIFDAC_ASYN 0x0010 | ||
489 | |||
490 | /* | ||
491 | * R231 (0xE7) - Jack Status | ||
492 | */ | ||
493 | #define WM8350_JACK_R_LVL 0x0400 | ||
494 | |||
495 | /* | ||
496 | * WM8350 Platform setup | ||
497 | */ | ||
498 | #define WM8350_S_CURVE_NONE 0x0 | ||
499 | #define WM8350_S_CURVE_FAST 0x1 | ||
500 | #define WM8350_S_CURVE_MEDIUM 0x2 | ||
501 | #define WM8350_S_CURVE_SLOW 0x3 | ||
502 | |||
503 | #define WM8350_DISCHARGE_OFF 0x0 | ||
504 | #define WM8350_DISCHARGE_FAST 0x1 | ||
505 | #define WM8350_DISCHARGE_MEDIUM 0x2 | ||
506 | #define WM8350_DISCHARGE_SLOW 0x3 | ||
507 | |||
508 | #define WM8350_TIE_OFF_500R 0x0 | ||
509 | #define WM8350_TIE_OFF_30K 0x1 | ||
510 | |||
511 | /* | ||
512 | * Clock sources & directions | ||
513 | */ | ||
514 | #define WM8350_SYSCLK 0 | ||
515 | |||
516 | #define WM8350_MCLK_SEL_PLL_MCLK 0 | ||
517 | #define WM8350_MCLK_SEL_PLL_DAC 1 | ||
518 | #define WM8350_MCLK_SEL_PLL_ADC 2 | ||
519 | #define WM8350_MCLK_SEL_PLL_32K 3 | ||
520 | #define WM8350_MCLK_SEL_MCLK 5 | ||
521 | |||
522 | #define WM8350_MCLK_DIR_OUT 0 | ||
523 | #define WM8350_MCLK_DIR_IN 1 | ||
524 | |||
525 | /* clock divider id's */ | ||
526 | #define WM8350_ADC_CLKDIV 0 | ||
527 | #define WM8350_DAC_CLKDIV 1 | ||
528 | #define WM8350_BCLK_CLKDIV 2 | ||
529 | #define WM8350_OPCLK_CLKDIV 3 | ||
530 | #define WM8350_TO_CLKDIV 4 | ||
531 | #define WM8350_SYS_CLKDIV 5 | ||
532 | #define WM8350_DACLR_CLKDIV 6 | ||
533 | #define WM8350_ADCLR_CLKDIV 7 | ||
534 | |||
535 | /* ADC clock dividers */ | ||
536 | #define WM8350_ADCDIV_1 0x0 | ||
537 | #define WM8350_ADCDIV_1_5 0x1 | ||
538 | #define WM8350_ADCDIV_2 0x2 | ||
539 | #define WM8350_ADCDIV_3 0x3 | ||
540 | #define WM8350_ADCDIV_4 0x4 | ||
541 | #define WM8350_ADCDIV_5_5 0x5 | ||
542 | #define WM8350_ADCDIV_6 0x6 | ||
543 | |||
544 | /* ADC clock dividers */ | ||
545 | #define WM8350_DACDIV_1 0x0 | ||
546 | #define WM8350_DACDIV_1_5 0x1 | ||
547 | #define WM8350_DACDIV_2 0x2 | ||
548 | #define WM8350_DACDIV_3 0x3 | ||
549 | #define WM8350_DACDIV_4 0x4 | ||
550 | #define WM8350_DACDIV_5_5 0x5 | ||
551 | #define WM8350_DACDIV_6 0x6 | ||
552 | |||
553 | /* BCLK clock dividers */ | ||
554 | #define WM8350_BCLK_DIV_1 (0x0 << 4) | ||
555 | #define WM8350_BCLK_DIV_1_5 (0x1 << 4) | ||
556 | #define WM8350_BCLK_DIV_2 (0x2 << 4) | ||
557 | #define WM8350_BCLK_DIV_3 (0x3 << 4) | ||
558 | #define WM8350_BCLK_DIV_4 (0x4 << 4) | ||
559 | #define WM8350_BCLK_DIV_5_5 (0x5 << 4) | ||
560 | #define WM8350_BCLK_DIV_6 (0x6 << 4) | ||
561 | #define WM8350_BCLK_DIV_8 (0x7 << 4) | ||
562 | #define WM8350_BCLK_DIV_11 (0x8 << 4) | ||
563 | #define WM8350_BCLK_DIV_12 (0x9 << 4) | ||
564 | #define WM8350_BCLK_DIV_16 (0xa << 4) | ||
565 | #define WM8350_BCLK_DIV_22 (0xb << 4) | ||
566 | #define WM8350_BCLK_DIV_24 (0xc << 4) | ||
567 | #define WM8350_BCLK_DIV_32 (0xd << 4) | ||
568 | #define WM8350_BCLK_DIV_44 (0xe << 4) | ||
569 | #define WM8350_BCLK_DIV_48 (0xf << 4) | ||
570 | |||
571 | /* Sys (MCLK) clock dividers */ | ||
572 | #define WM8350_MCLK_DIV_1 (0x0 << 8) | ||
573 | #define WM8350_MCLK_DIV_2 (0x1 << 8) | ||
574 | |||
575 | /* OP clock dividers */ | ||
576 | #define WM8350_OPCLK_DIV_1 0x0 | ||
577 | #define WM8350_OPCLK_DIV_2 0x1 | ||
578 | #define WM8350_OPCLK_DIV_3 0x2 | ||
579 | #define WM8350_OPCLK_DIV_4 0x3 | ||
580 | #define WM8350_OPCLK_DIV_5_5 0x4 | ||
581 | #define WM8350_OPCLK_DIV_6 0x5 | ||
582 | |||
583 | /* DAI ID */ | ||
584 | #define WM8350_HIFI_DAI 0 | ||
585 | |||
586 | /* | ||
587 | * Audio interrupts. | ||
588 | */ | ||
589 | #define WM8350_IRQ_CODEC_JCK_DET_L 39 | ||
590 | #define WM8350_IRQ_CODEC_JCK_DET_R 40 | ||
591 | #define WM8350_IRQ_CODEC_MICSCD 41 | ||
592 | #define WM8350_IRQ_CODEC_MICD 42 | ||
593 | |||
594 | struct wm8350_codec { | ||
595 | struct platform_device *pdev; | ||
596 | }; | ||
597 | |||
598 | #endif | ||
diff --git a/include/linux/mfd/wm8350/comparator.h b/include/linux/mfd/wm8350/comparator.h new file mode 100644 index 000000000000..053788649452 --- /dev/null +++ b/include/linux/mfd/wm8350/comparator.h | |||
@@ -0,0 +1,167 @@ | |||
1 | /* | ||
2 | * comparator.h -- Comparator Aux ADC for Wolfson WM8350 PMIC | ||
3 | * | ||
4 | * Copyright 2007 Wolfson Microelectronics PLC | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef __LINUX_MFD_WM8350_COMPARATOR_H_ | ||
13 | #define __LINUX_MFD_WM8350_COMPARATOR_H_ | ||
14 | |||
15 | /* | ||
16 | * Registers | ||
17 | */ | ||
18 | |||
19 | #define WM8350_DIGITISER_CONTROL_1 0x90 | ||
20 | #define WM8350_DIGITISER_CONTROL_2 0x91 | ||
21 | #define WM8350_AUX1_READBACK 0x98 | ||
22 | #define WM8350_AUX2_READBACK 0x99 | ||
23 | #define WM8350_AUX3_READBACK 0x9A | ||
24 | #define WM8350_AUX4_READBACK 0x9B | ||
25 | #define WM8350_CHIP_TEMP_READBACK 0x9F | ||
26 | #define WM8350_GENERIC_COMPARATOR_CONTROL 0xA3 | ||
27 | #define WM8350_GENERIC_COMPARATOR_1 0xA4 | ||
28 | #define WM8350_GENERIC_COMPARATOR_2 0xA5 | ||
29 | #define WM8350_GENERIC_COMPARATOR_3 0xA6 | ||
30 | #define WM8350_GENERIC_COMPARATOR_4 0xA7 | ||
31 | |||
32 | /* | ||
33 | * R144 (0x90) - Digitiser Control (1) | ||
34 | */ | ||
35 | #define WM8350_AUXADC_CTC 0x4000 | ||
36 | #define WM8350_AUXADC_POLL 0x2000 | ||
37 | #define WM8350_AUXADC_HIB_MODE 0x1000 | ||
38 | #define WM8350_AUXADC_SEL8 0x0080 | ||
39 | #define WM8350_AUXADC_SEL7 0x0040 | ||
40 | #define WM8350_AUXADC_SEL6 0x0020 | ||
41 | #define WM8350_AUXADC_SEL5 0x0010 | ||
42 | #define WM8350_AUXADC_SEL4 0x0008 | ||
43 | #define WM8350_AUXADC_SEL3 0x0004 | ||
44 | #define WM8350_AUXADC_SEL2 0x0002 | ||
45 | #define WM8350_AUXADC_SEL1 0x0001 | ||
46 | |||
47 | /* | ||
48 | * R145 (0x91) - Digitiser Control (2) | ||
49 | */ | ||
50 | #define WM8350_AUXADC_MASKMODE_MASK 0x3000 | ||
51 | #define WM8350_AUXADC_CRATE_MASK 0x0700 | ||
52 | #define WM8350_AUXADC_CAL 0x0004 | ||
53 | #define WM8350_AUX_RBMODE 0x0002 | ||
54 | #define WM8350_AUXADC_WAIT 0x0001 | ||
55 | |||
56 | /* | ||
57 | * R152 (0x98) - AUX1 Readback | ||
58 | */ | ||
59 | #define WM8350_AUXADC_SCALE1_MASK 0x6000 | ||
60 | #define WM8350_AUXADC_REF1 0x1000 | ||
61 | #define WM8350_AUXADC_DATA1_MASK 0x0FFF | ||
62 | |||
63 | /* | ||
64 | * R153 (0x99) - AUX2 Readback | ||
65 | */ | ||
66 | #define WM8350_AUXADC_SCALE2_MASK 0x6000 | ||
67 | #define WM8350_AUXADC_REF2 0x1000 | ||
68 | #define WM8350_AUXADC_DATA2_MASK 0x0FFF | ||
69 | |||
70 | /* | ||
71 | * R154 (0x9A) - AUX3 Readback | ||
72 | */ | ||
73 | #define WM8350_AUXADC_SCALE3_MASK 0x6000 | ||
74 | #define WM8350_AUXADC_REF3 0x1000 | ||
75 | #define WM8350_AUXADC_DATA3_MASK 0x0FFF | ||
76 | |||
77 | /* | ||
78 | * R155 (0x9B) - AUX4 Readback | ||
79 | */ | ||
80 | #define WM8350_AUXADC_SCALE4_MASK 0x6000 | ||
81 | #define WM8350_AUXADC_REF4 0x1000 | ||
82 | #define WM8350_AUXADC_DATA4_MASK 0x0FFF | ||
83 | |||
84 | /* | ||
85 | * R156 (0x9C) - USB Voltage Readback | ||
86 | */ | ||
87 | #define WM8350_AUXADC_DATA_USB_MASK 0x0FFF | ||
88 | |||
89 | /* | ||
90 | * R157 (0x9D) - LINE Voltage Readback | ||
91 | */ | ||
92 | #define WM8350_AUXADC_DATA_LINE_MASK 0x0FFF | ||
93 | |||
94 | /* | ||
95 | * R158 (0x9E) - BATT Voltage Readback | ||
96 | */ | ||
97 | #define WM8350_AUXADC_DATA_BATT_MASK 0x0FFF | ||
98 | |||
99 | /* | ||
100 | * R159 (0x9F) - Chip Temp Readback | ||
101 | */ | ||
102 | #define WM8350_AUXADC_DATA_CHIPTEMP_MASK 0x0FFF | ||
103 | |||
104 | /* | ||
105 | * R163 (0xA3) - Generic Comparator Control | ||
106 | */ | ||
107 | #define WM8350_DCMP4_ENA 0x0008 | ||
108 | #define WM8350_DCMP3_ENA 0x0004 | ||
109 | #define WM8350_DCMP2_ENA 0x0002 | ||
110 | #define WM8350_DCMP1_ENA 0x0001 | ||
111 | |||
112 | /* | ||
113 | * R164 (0xA4) - Generic comparator 1 | ||
114 | */ | ||
115 | #define WM8350_DCMP1_SRCSEL_MASK 0xE000 | ||
116 | #define WM8350_DCMP1_GT 0x1000 | ||
117 | #define WM8350_DCMP1_THR_MASK 0x0FFF | ||
118 | |||
119 | /* | ||
120 | * R165 (0xA5) - Generic comparator 2 | ||
121 | */ | ||
122 | #define WM8350_DCMP2_SRCSEL_MASK 0xE000 | ||
123 | #define WM8350_DCMP2_GT 0x1000 | ||
124 | #define WM8350_DCMP2_THR_MASK 0x0FFF | ||
125 | |||
126 | /* | ||
127 | * R166 (0xA6) - Generic comparator 3 | ||
128 | */ | ||
129 | #define WM8350_DCMP3_SRCSEL_MASK 0xE000 | ||
130 | #define WM8350_DCMP3_GT 0x1000 | ||
131 | #define WM8350_DCMP3_THR_MASK 0x0FFF | ||
132 | |||
133 | /* | ||
134 | * R167 (0xA7) - Generic comparator 4 | ||
135 | */ | ||
136 | #define WM8350_DCMP4_SRCSEL_MASK 0xE000 | ||
137 | #define WM8350_DCMP4_GT 0x1000 | ||
138 | #define WM8350_DCMP4_THR_MASK 0x0FFF | ||
139 | |||
140 | /* | ||
141 | * Interrupts. | ||
142 | */ | ||
143 | #define WM8350_IRQ_AUXADC_DATARDY 16 | ||
144 | #define WM8350_IRQ_AUXADC_DCOMP4 17 | ||
145 | #define WM8350_IRQ_AUXADC_DCOMP3 18 | ||
146 | #define WM8350_IRQ_AUXADC_DCOMP2 19 | ||
147 | #define WM8350_IRQ_AUXADC_DCOMP1 20 | ||
148 | #define WM8350_IRQ_SYS_HYST_COMP_FAIL 21 | ||
149 | #define WM8350_IRQ_SYS_CHIP_GT115 22 | ||
150 | #define WM8350_IRQ_SYS_CHIP_GT140 23 | ||
151 | |||
152 | /* | ||
153 | * USB/2, LINE & BATT = ((VRTC * 2) / 4095)) * 10e6 uV | ||
154 | * Where VRTC = 2.7 V | ||
155 | */ | ||
156 | #define WM8350_AUX_COEFF 1319 | ||
157 | |||
158 | #define WM8350_AUXADC_AUX1 0 | ||
159 | #define WM8350_AUXADC_AUX2 1 | ||
160 | #define WM8350_AUXADC_AUX3 2 | ||
161 | #define WM8350_AUXADC_AUX4 3 | ||
162 | #define WM8350_AUXADC_USB 4 | ||
163 | #define WM8350_AUXADC_LINE 5 | ||
164 | #define WM8350_AUXADC_BATT 6 | ||
165 | #define WM8350_AUXADC_TEMP 7 | ||
166 | |||
167 | #endif | ||
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h new file mode 100644 index 000000000000..6ebf97f2a475 --- /dev/null +++ b/include/linux/mfd/wm8350/core.h | |||
@@ -0,0 +1,631 @@ | |||
1 | /* | ||
2 | * core.h -- Core Driver for Wolfson WM8350 PMIC | ||
3 | * | ||
4 | * Copyright 2007 Wolfson Microelectronics PLC | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_MFD_WM8350_CORE_H_ | ||
14 | #define __LINUX_MFD_WM8350_CORE_H_ | ||
15 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/mutex.h> | ||
18 | #include <linux/workqueue.h> | ||
19 | |||
20 | #include <linux/mfd/wm8350/audio.h> | ||
21 | #include <linux/mfd/wm8350/gpio.h> | ||
22 | #include <linux/mfd/wm8350/pmic.h> | ||
23 | #include <linux/mfd/wm8350/rtc.h> | ||
24 | #include <linux/mfd/wm8350/supply.h> | ||
25 | #include <linux/mfd/wm8350/wdt.h> | ||
26 | |||
27 | /* | ||
28 | * Register values. | ||
29 | */ | ||
30 | #define WM8350_RESET_ID 0x00 | ||
31 | #define WM8350_ID 0x01 | ||
32 | #define WM8350_SYSTEM_CONTROL_1 0x03 | ||
33 | #define WM8350_SYSTEM_CONTROL_2 0x04 | ||
34 | #define WM8350_SYSTEM_HIBERNATE 0x05 | ||
35 | #define WM8350_INTERFACE_CONTROL 0x06 | ||
36 | #define WM8350_POWER_MGMT_1 0x08 | ||
37 | #define WM8350_POWER_MGMT_2 0x09 | ||
38 | #define WM8350_POWER_MGMT_3 0x0A | ||
39 | #define WM8350_POWER_MGMT_4 0x0B | ||
40 | #define WM8350_POWER_MGMT_5 0x0C | ||
41 | #define WM8350_POWER_MGMT_6 0x0D | ||
42 | #define WM8350_POWER_MGMT_7 0x0E | ||
43 | |||
44 | #define WM8350_SYSTEM_INTERRUPTS 0x18 | ||
45 | #define WM8350_INT_STATUS_1 0x19 | ||
46 | #define WM8350_INT_STATUS_2 0x1A | ||
47 | #define WM8350_POWER_UP_INT_STATUS 0x1B | ||
48 | #define WM8350_UNDER_VOLTAGE_INT_STATUS 0x1C | ||
49 | #define WM8350_OVER_CURRENT_INT_STATUS 0x1D | ||
50 | #define WM8350_GPIO_INT_STATUS 0x1E | ||
51 | #define WM8350_COMPARATOR_INT_STATUS 0x1F | ||
52 | #define WM8350_SYSTEM_INTERRUPTS_MASK 0x20 | ||
53 | #define WM8350_INT_STATUS_1_MASK 0x21 | ||
54 | #define WM8350_INT_STATUS_2_MASK 0x22 | ||
55 | #define WM8350_POWER_UP_INT_STATUS_MASK 0x23 | ||
56 | #define WM8350_UNDER_VOLTAGE_INT_STATUS_MASK 0x24 | ||
57 | #define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25 | ||
58 | #define WM8350_GPIO_INT_STATUS_MASK 0x26 | ||
59 | #define WM8350_COMPARATOR_INT_STATUS_MASK 0x27 | ||
60 | |||
61 | #define WM8350_MAX_REGISTER 0xFF | ||
62 | |||
63 | /* | ||
64 | * Field Definitions. | ||
65 | */ | ||
66 | |||
67 | /* | ||
68 | * R0 (0x00) - Reset/ID | ||
69 | */ | ||
70 | #define WM8350_SW_RESET_CHIP_ID_MASK 0xFFFF | ||
71 | |||
72 | /* | ||
73 | * R1 (0x01) - ID | ||
74 | */ | ||
75 | #define WM8350_CHIP_REV_MASK 0x7000 | ||
76 | #define WM8350_CONF_STS_MASK 0x0C00 | ||
77 | #define WM8350_CUST_ID_MASK 0x00FF | ||
78 | |||
79 | /* | ||
80 | * R3 (0x03) - System Control 1 | ||
81 | */ | ||
82 | #define WM8350_CHIP_ON 0x8000 | ||
83 | #define WM8350_POWERCYCLE 0x2000 | ||
84 | #define WM8350_VCC_FAULT_OV 0x1000 | ||
85 | #define WM8350_REG_RSTB_TIME_MASK 0x0C00 | ||
86 | #define WM8350_BG_SLEEP 0x0200 | ||
87 | #define WM8350_MEM_VALID 0x0020 | ||
88 | #define WM8350_CHIP_SET_UP 0x0010 | ||
89 | #define WM8350_ON_DEB_T 0x0008 | ||
90 | #define WM8350_ON_POL 0x0002 | ||
91 | #define WM8350_IRQ_POL 0x0001 | ||
92 | |||
93 | /* | ||
94 | * R4 (0x04) - System Control 2 | ||
95 | */ | ||
96 | #define WM8350_USB_SUSPEND_8MA 0x8000 | ||
97 | #define WM8350_USB_SUSPEND 0x4000 | ||
98 | #define WM8350_USB_MSTR 0x2000 | ||
99 | #define WM8350_USB_MSTR_SRC 0x1000 | ||
100 | #define WM8350_USB_500MA 0x0800 | ||
101 | #define WM8350_USB_NOLIM 0x0400 | ||
102 | |||
103 | /* | ||
104 | * R5 (0x05) - System Hibernate | ||
105 | */ | ||
106 | #define WM8350_HIBERNATE 0x8000 | ||
107 | #define WM8350_WDOG_HIB_MODE 0x0080 | ||
108 | #define WM8350_REG_HIB_STARTUP_SEQ 0x0040 | ||
109 | #define WM8350_REG_RESET_HIB_MODE 0x0020 | ||
110 | #define WM8350_RST_HIB_MODE 0x0010 | ||
111 | #define WM8350_IRQ_HIB_MODE 0x0008 | ||
112 | #define WM8350_MEMRST_HIB_MODE 0x0004 | ||
113 | #define WM8350_PCCOMP_HIB_MODE 0x0002 | ||
114 | #define WM8350_TEMPMON_HIB_MODE 0x0001 | ||
115 | |||
116 | /* | ||
117 | * R6 (0x06) - Interface Control | ||
118 | */ | ||
119 | #define WM8350_USE_DEV_PINS 0x8000 | ||
120 | #define WM8350_USE_DEV_PINS_MASK 0x8000 | ||
121 | #define WM8350_USE_DEV_PINS_SHIFT 15 | ||
122 | #define WM8350_DEV_ADDR_MASK 0x6000 | ||
123 | #define WM8350_DEV_ADDR_SHIFT 13 | ||
124 | #define WM8350_CONFIG_DONE 0x1000 | ||
125 | #define WM8350_CONFIG_DONE_MASK 0x1000 | ||
126 | #define WM8350_CONFIG_DONE_SHIFT 12 | ||
127 | #define WM8350_RECONFIG_AT_ON 0x0800 | ||
128 | #define WM8350_RECONFIG_AT_ON_MASK 0x0800 | ||
129 | #define WM8350_RECONFIG_AT_ON_SHIFT 11 | ||
130 | #define WM8350_AUTOINC 0x0200 | ||
131 | #define WM8350_AUTOINC_MASK 0x0200 | ||
132 | #define WM8350_AUTOINC_SHIFT 9 | ||
133 | #define WM8350_ARA 0x0100 | ||
134 | #define WM8350_ARA_MASK 0x0100 | ||
135 | #define WM8350_ARA_SHIFT 8 | ||
136 | #define WM8350_SPI_CFG 0x0008 | ||
137 | #define WM8350_SPI_CFG_MASK 0x0008 | ||
138 | #define WM8350_SPI_CFG_SHIFT 3 | ||
139 | #define WM8350_SPI_4WIRE 0x0004 | ||
140 | #define WM8350_SPI_4WIRE_MASK 0x0004 | ||
141 | #define WM8350_SPI_4WIRE_SHIFT 2 | ||
142 | #define WM8350_SPI_3WIRE 0x0002 | ||
143 | #define WM8350_SPI_3WIRE_MASK 0x0002 | ||
144 | #define WM8350_SPI_3WIRE_SHIFT 1 | ||
145 | |||
146 | /* Bit values for R06 (0x06) */ | ||
147 | #define WM8350_USE_DEV_PINS_PRIMARY 0 | ||
148 | #define WM8350_USE_DEV_PINS_DEV 1 | ||
149 | |||
150 | #define WM8350_DEV_ADDR_34 0 | ||
151 | #define WM8350_DEV_ADDR_36 1 | ||
152 | #define WM8350_DEV_ADDR_3C 2 | ||
153 | #define WM8350_DEV_ADDR_3E 3 | ||
154 | |||
155 | #define WM8350_CONFIG_DONE_OFF 0 | ||
156 | #define WM8350_CONFIG_DONE_DONE 1 | ||
157 | |||
158 | #define WM8350_RECONFIG_AT_ON_OFF 0 | ||
159 | #define WM8350_RECONFIG_AT_ON_ON 1 | ||
160 | |||
161 | #define WM8350_AUTOINC_OFF 0 | ||
162 | #define WM8350_AUTOINC_ON 1 | ||
163 | |||
164 | #define WM8350_ARA_OFF 0 | ||
165 | #define WM8350_ARA_ON 1 | ||
166 | |||
167 | #define WM8350_SPI_CFG_CMOS 0 | ||
168 | #define WM8350_SPI_CFG_OD 1 | ||
169 | |||
170 | #define WM8350_SPI_4WIRE_3WIRE 0 | ||
171 | #define WM8350_SPI_4WIRE_4WIRE 1 | ||
172 | |||
173 | #define WM8350_SPI_3WIRE_I2C 0 | ||
174 | #define WM8350_SPI_3WIRE_SPI 1 | ||
175 | |||
176 | /* | ||
177 | * R8 (0x08) - Power mgmt (1) | ||
178 | */ | ||
179 | #define WM8350_CODEC_ISEL_MASK 0xC000 | ||
180 | #define WM8350_VBUFEN 0x2000 | ||
181 | #define WM8350_OUTPUT_DRAIN_EN 0x0400 | ||
182 | #define WM8350_MIC_DET_ENA 0x0100 | ||
183 | #define WM8350_BIASEN 0x0020 | ||
184 | #define WM8350_MICBEN 0x0010 | ||
185 | #define WM8350_VMIDEN 0x0004 | ||
186 | #define WM8350_VMID_MASK 0x0003 | ||
187 | #define WM8350_VMID_SHIFT 0 | ||
188 | |||
189 | /* | ||
190 | * R9 (0x09) - Power mgmt (2) | ||
191 | */ | ||
192 | #define WM8350_IN3R_ENA 0x0800 | ||
193 | #define WM8350_IN3L_ENA 0x0400 | ||
194 | #define WM8350_INR_ENA 0x0200 | ||
195 | #define WM8350_INL_ENA 0x0100 | ||
196 | #define WM8350_MIXINR_ENA 0x0080 | ||
197 | #define WM8350_MIXINL_ENA 0x0040 | ||
198 | #define WM8350_OUT4_ENA 0x0020 | ||
199 | #define WM8350_OUT3_ENA 0x0010 | ||
200 | #define WM8350_MIXOUTR_ENA 0x0002 | ||
201 | #define WM8350_MIXOUTL_ENA 0x0001 | ||
202 | |||
203 | /* | ||
204 | * R10 (0x0A) - Power mgmt (3) | ||
205 | */ | ||
206 | #define WM8350_IN3R_TO_OUT2R 0x0080 | ||
207 | #define WM8350_OUT2R_ENA 0x0008 | ||
208 | #define WM8350_OUT2L_ENA 0x0004 | ||
209 | #define WM8350_OUT1R_ENA 0x0002 | ||
210 | #define WM8350_OUT1L_ENA 0x0001 | ||
211 | |||
212 | /* | ||
213 | * R11 (0x0B) - Power mgmt (4) | ||
214 | */ | ||
215 | #define WM8350_SYSCLK_ENA 0x4000 | ||
216 | #define WM8350_ADC_HPF_ENA 0x2000 | ||
217 | #define WM8350_FLL_ENA 0x0800 | ||
218 | #define WM8350_FLL_OSC_ENA 0x0400 | ||
219 | #define WM8350_TOCLK_ENA 0x0100 | ||
220 | #define WM8350_DACR_ENA 0x0020 | ||
221 | #define WM8350_DACL_ENA 0x0010 | ||
222 | #define WM8350_ADCR_ENA 0x0008 | ||
223 | #define WM8350_ADCL_ENA 0x0004 | ||
224 | |||
225 | /* | ||
226 | * R12 (0x0C) - Power mgmt (5) | ||
227 | */ | ||
228 | #define WM8350_CODEC_ENA 0x1000 | ||
229 | #define WM8350_RTC_TICK_ENA 0x0800 | ||
230 | #define WM8350_OSC32K_ENA 0x0400 | ||
231 | #define WM8350_CHG_ENA 0x0200 | ||
232 | #define WM8350_ACC_DET_ENA 0x0100 | ||
233 | #define WM8350_AUXADC_ENA 0x0080 | ||
234 | #define WM8350_DCMP4_ENA 0x0008 | ||
235 | #define WM8350_DCMP3_ENA 0x0004 | ||
236 | #define WM8350_DCMP2_ENA 0x0002 | ||
237 | #define WM8350_DCMP1_ENA 0x0001 | ||
238 | |||
239 | /* | ||
240 | * R13 (0x0D) - Power mgmt (6) | ||
241 | */ | ||
242 | #define WM8350_LS_ENA 0x8000 | ||
243 | #define WM8350_LDO4_ENA 0x0800 | ||
244 | #define WM8350_LDO3_ENA 0x0400 | ||
245 | #define WM8350_LDO2_ENA 0x0200 | ||
246 | #define WM8350_LDO1_ENA 0x0100 | ||
247 | #define WM8350_DC6_ENA 0x0020 | ||
248 | #define WM8350_DC5_ENA 0x0010 | ||
249 | #define WM8350_DC4_ENA 0x0008 | ||
250 | #define WM8350_DC3_ENA 0x0004 | ||
251 | #define WM8350_DC2_ENA 0x0002 | ||
252 | #define WM8350_DC1_ENA 0x0001 | ||
253 | |||
254 | /* | ||
255 | * R14 (0x0E) - Power mgmt (7) | ||
256 | */ | ||
257 | #define WM8350_CS2_ENA 0x0002 | ||
258 | #define WM8350_CS1_ENA 0x0001 | ||
259 | |||
260 | /* | ||
261 | * R24 (0x18) - System Interrupts | ||
262 | */ | ||
263 | #define WM8350_OC_INT 0x2000 | ||
264 | #define WM8350_UV_INT 0x1000 | ||
265 | #define WM8350_PUTO_INT 0x0800 | ||
266 | #define WM8350_CS_INT 0x0200 | ||
267 | #define WM8350_EXT_INT 0x0100 | ||
268 | #define WM8350_CODEC_INT 0x0080 | ||
269 | #define WM8350_GP_INT 0x0040 | ||
270 | #define WM8350_AUXADC_INT 0x0020 | ||
271 | #define WM8350_RTC_INT 0x0010 | ||
272 | #define WM8350_SYS_INT 0x0008 | ||
273 | #define WM8350_CHG_INT 0x0004 | ||
274 | #define WM8350_USB_INT 0x0002 | ||
275 | #define WM8350_WKUP_INT 0x0001 | ||
276 | |||
277 | /* | ||
278 | * R25 (0x19) - Interrupt Status 1 | ||
279 | */ | ||
280 | #define WM8350_CHG_BAT_HOT_EINT 0x8000 | ||
281 | #define WM8350_CHG_BAT_COLD_EINT 0x4000 | ||
282 | #define WM8350_CHG_BAT_FAIL_EINT 0x2000 | ||
283 | #define WM8350_CHG_TO_EINT 0x1000 | ||
284 | #define WM8350_CHG_END_EINT 0x0800 | ||
285 | #define WM8350_CHG_START_EINT 0x0400 | ||
286 | #define WM8350_CHG_FAST_RDY_EINT 0x0200 | ||
287 | #define WM8350_RTC_PER_EINT 0x0080 | ||
288 | #define WM8350_RTC_SEC_EINT 0x0040 | ||
289 | #define WM8350_RTC_ALM_EINT 0x0020 | ||
290 | #define WM8350_CHG_VBATT_LT_3P9_EINT 0x0004 | ||
291 | #define WM8350_CHG_VBATT_LT_3P1_EINT 0x0002 | ||
292 | #define WM8350_CHG_VBATT_LT_2P85_EINT 0x0001 | ||
293 | |||
294 | /* | ||
295 | * R26 (0x1A) - Interrupt Status 2 | ||
296 | */ | ||
297 | #define WM8350_CS1_EINT 0x2000 | ||
298 | #define WM8350_CS2_EINT 0x1000 | ||
299 | #define WM8350_USB_LIMIT_EINT 0x0400 | ||
300 | #define WM8350_AUXADC_DATARDY_EINT 0x0100 | ||
301 | #define WM8350_AUXADC_DCOMP4_EINT 0x0080 | ||
302 | #define WM8350_AUXADC_DCOMP3_EINT 0x0040 | ||
303 | #define WM8350_AUXADC_DCOMP2_EINT 0x0020 | ||
304 | #define WM8350_AUXADC_DCOMP1_EINT 0x0010 | ||
305 | #define WM8350_SYS_HYST_COMP_FAIL_EINT 0x0008 | ||
306 | #define WM8350_SYS_CHIP_GT115_EINT 0x0004 | ||
307 | #define WM8350_SYS_CHIP_GT140_EINT 0x0002 | ||
308 | #define WM8350_SYS_WDOG_TO_EINT 0x0001 | ||
309 | |||
310 | /* | ||
311 | * R27 (0x1B) - Power Up Interrupt Status | ||
312 | */ | ||
313 | #define WM8350_PUTO_LDO4_EINT 0x0800 | ||
314 | #define WM8350_PUTO_LDO3_EINT 0x0400 | ||
315 | #define WM8350_PUTO_LDO2_EINT 0x0200 | ||
316 | #define WM8350_PUTO_LDO1_EINT 0x0100 | ||
317 | #define WM8350_PUTO_DC6_EINT 0x0020 | ||
318 | #define WM8350_PUTO_DC5_EINT 0x0010 | ||
319 | #define WM8350_PUTO_DC4_EINT 0x0008 | ||
320 | #define WM8350_PUTO_DC3_EINT 0x0004 | ||
321 | #define WM8350_PUTO_DC2_EINT 0x0002 | ||
322 | #define WM8350_PUTO_DC1_EINT 0x0001 | ||
323 | |||
324 | /* | ||
325 | * R28 (0x1C) - Under Voltage Interrupt status | ||
326 | */ | ||
327 | #define WM8350_UV_LDO4_EINT 0x0800 | ||
328 | #define WM8350_UV_LDO3_EINT 0x0400 | ||
329 | #define WM8350_UV_LDO2_EINT 0x0200 | ||
330 | #define WM8350_UV_LDO1_EINT 0x0100 | ||
331 | #define WM8350_UV_DC6_EINT 0x0020 | ||
332 | #define WM8350_UV_DC5_EINT 0x0010 | ||
333 | #define WM8350_UV_DC4_EINT 0x0008 | ||
334 | #define WM8350_UV_DC3_EINT 0x0004 | ||
335 | #define WM8350_UV_DC2_EINT 0x0002 | ||
336 | #define WM8350_UV_DC1_EINT 0x0001 | ||
337 | |||
338 | /* | ||
339 | * R29 (0x1D) - Over Current Interrupt status | ||
340 | */ | ||
341 | #define WM8350_OC_LS_EINT 0x8000 | ||
342 | |||
343 | /* | ||
344 | * R30 (0x1E) - GPIO Interrupt Status | ||
345 | */ | ||
346 | #define WM8350_GP12_EINT 0x1000 | ||
347 | #define WM8350_GP11_EINT 0x0800 | ||
348 | #define WM8350_GP10_EINT 0x0400 | ||
349 | #define WM8350_GP9_EINT 0x0200 | ||
350 | #define WM8350_GP8_EINT 0x0100 | ||
351 | #define WM8350_GP7_EINT 0x0080 | ||
352 | #define WM8350_GP6_EINT 0x0040 | ||
353 | #define WM8350_GP5_EINT 0x0020 | ||
354 | #define WM8350_GP4_EINT 0x0010 | ||
355 | #define WM8350_GP3_EINT 0x0008 | ||
356 | #define WM8350_GP2_EINT 0x0004 | ||
357 | #define WM8350_GP1_EINT 0x0002 | ||
358 | #define WM8350_GP0_EINT 0x0001 | ||
359 | |||
360 | /* | ||
361 | * R31 (0x1F) - Comparator Interrupt Status | ||
362 | */ | ||
363 | #define WM8350_EXT_USB_FB_EINT 0x8000 | ||
364 | #define WM8350_EXT_WALL_FB_EINT 0x4000 | ||
365 | #define WM8350_EXT_BAT_FB_EINT 0x2000 | ||
366 | #define WM8350_CODEC_JCK_DET_L_EINT 0x0800 | ||
367 | #define WM8350_CODEC_JCK_DET_R_EINT 0x0400 | ||
368 | #define WM8350_CODEC_MICSCD_EINT 0x0200 | ||
369 | #define WM8350_CODEC_MICD_EINT 0x0100 | ||
370 | #define WM8350_WKUP_OFF_STATE_EINT 0x0040 | ||
371 | #define WM8350_WKUP_HIB_STATE_EINT 0x0020 | ||
372 | #define WM8350_WKUP_CONV_FAULT_EINT 0x0010 | ||
373 | #define WM8350_WKUP_WDOG_RST_EINT 0x0008 | ||
374 | #define WM8350_WKUP_GP_PWR_ON_EINT 0x0004 | ||
375 | #define WM8350_WKUP_ONKEY_EINT 0x0002 | ||
376 | #define WM8350_WKUP_GP_WAKEUP_EINT 0x0001 | ||
377 | |||
378 | /* | ||
379 | * R32 (0x20) - System Interrupts Mask | ||
380 | */ | ||
381 | #define WM8350_IM_OC_INT 0x2000 | ||
382 | #define WM8350_IM_UV_INT 0x1000 | ||
383 | #define WM8350_IM_PUTO_INT 0x0800 | ||
384 | #define WM8350_IM_SPARE_INT 0x0400 | ||
385 | #define WM8350_IM_CS_INT 0x0200 | ||
386 | #define WM8350_IM_EXT_INT 0x0100 | ||
387 | #define WM8350_IM_CODEC_INT 0x0080 | ||
388 | #define WM8350_IM_GP_INT 0x0040 | ||
389 | #define WM8350_IM_AUXADC_INT 0x0020 | ||
390 | #define WM8350_IM_RTC_INT 0x0010 | ||
391 | #define WM8350_IM_SYS_INT 0x0008 | ||
392 | #define WM8350_IM_CHG_INT 0x0004 | ||
393 | #define WM8350_IM_USB_INT 0x0002 | ||
394 | #define WM8350_IM_WKUP_INT 0x0001 | ||
395 | |||
396 | /* | ||
397 | * R33 (0x21) - Interrupt Status 1 Mask | ||
398 | */ | ||
399 | #define WM8350_IM_CHG_BAT_HOT_EINT 0x8000 | ||
400 | #define WM8350_IM_CHG_BAT_COLD_EINT 0x4000 | ||
401 | #define WM8350_IM_CHG_BAT_FAIL_EINT 0x2000 | ||
402 | #define WM8350_IM_CHG_TO_EINT 0x1000 | ||
403 | #define WM8350_IM_CHG_END_EINT 0x0800 | ||
404 | #define WM8350_IM_CHG_START_EINT 0x0400 | ||
405 | #define WM8350_IM_CHG_FAST_RDY_EINT 0x0200 | ||
406 | #define WM8350_IM_RTC_PER_EINT 0x0080 | ||
407 | #define WM8350_IM_RTC_SEC_EINT 0x0040 | ||
408 | #define WM8350_IM_RTC_ALM_EINT 0x0020 | ||
409 | #define WM8350_IM_CHG_VBATT_LT_3P9_EINT 0x0004 | ||
410 | #define WM8350_IM_CHG_VBATT_LT_3P1_EINT 0x0002 | ||
411 | #define WM8350_IM_CHG_VBATT_LT_2P85_EINT 0x0001 | ||
412 | |||
413 | /* | ||
414 | * R34 (0x22) - Interrupt Status 2 Mask | ||
415 | */ | ||
416 | #define WM8350_IM_SPARE2_EINT 0x8000 | ||
417 | #define WM8350_IM_SPARE1_EINT 0x4000 | ||
418 | #define WM8350_IM_CS1_EINT 0x2000 | ||
419 | #define WM8350_IM_CS2_EINT 0x1000 | ||
420 | #define WM8350_IM_USB_LIMIT_EINT 0x0400 | ||
421 | #define WM8350_IM_AUXADC_DATARDY_EINT 0x0100 | ||
422 | #define WM8350_IM_AUXADC_DCOMP4_EINT 0x0080 | ||
423 | #define WM8350_IM_AUXADC_DCOMP3_EINT 0x0040 | ||
424 | #define WM8350_IM_AUXADC_DCOMP2_EINT 0x0020 | ||
425 | #define WM8350_IM_AUXADC_DCOMP1_EINT 0x0010 | ||
426 | #define WM8350_IM_SYS_HYST_COMP_FAIL_EINT 0x0008 | ||
427 | #define WM8350_IM_SYS_CHIP_GT115_EINT 0x0004 | ||
428 | #define WM8350_IM_SYS_CHIP_GT140_EINT 0x0002 | ||
429 | #define WM8350_IM_SYS_WDOG_TO_EINT 0x0001 | ||
430 | |||
431 | /* | ||
432 | * R35 (0x23) - Power Up Interrupt Status Mask | ||
433 | */ | ||
434 | #define WM8350_IM_PUTO_LDO4_EINT 0x0800 | ||
435 | #define WM8350_IM_PUTO_LDO3_EINT 0x0400 | ||
436 | #define WM8350_IM_PUTO_LDO2_EINT 0x0200 | ||
437 | #define WM8350_IM_PUTO_LDO1_EINT 0x0100 | ||
438 | #define WM8350_IM_PUTO_DC6_EINT 0x0020 | ||
439 | #define WM8350_IM_PUTO_DC5_EINT 0x0010 | ||
440 | #define WM8350_IM_PUTO_DC4_EINT 0x0008 | ||
441 | #define WM8350_IM_PUTO_DC3_EINT 0x0004 | ||
442 | #define WM8350_IM_PUTO_DC2_EINT 0x0002 | ||
443 | #define WM8350_IM_PUTO_DC1_EINT 0x0001 | ||
444 | |||
445 | /* | ||
446 | * R36 (0x24) - Under Voltage Interrupt status Mask | ||
447 | */ | ||
448 | #define WM8350_IM_UV_LDO4_EINT 0x0800 | ||
449 | #define WM8350_IM_UV_LDO3_EINT 0x0400 | ||
450 | #define WM8350_IM_UV_LDO2_EINT 0x0200 | ||
451 | #define WM8350_IM_UV_LDO1_EINT 0x0100 | ||
452 | #define WM8350_IM_UV_DC6_EINT 0x0020 | ||
453 | #define WM8350_IM_UV_DC5_EINT 0x0010 | ||
454 | #define WM8350_IM_UV_DC4_EINT 0x0008 | ||
455 | #define WM8350_IM_UV_DC3_EINT 0x0004 | ||
456 | #define WM8350_IM_UV_DC2_EINT 0x0002 | ||
457 | #define WM8350_IM_UV_DC1_EINT 0x0001 | ||
458 | |||
459 | /* | ||
460 | * R37 (0x25) - Over Current Interrupt status Mask | ||
461 | */ | ||
462 | #define WM8350_IM_OC_LS_EINT 0x8000 | ||
463 | |||
464 | /* | ||
465 | * R38 (0x26) - GPIO Interrupt Status Mask | ||
466 | */ | ||
467 | #define WM8350_IM_GP12_EINT 0x1000 | ||
468 | #define WM8350_IM_GP11_EINT 0x0800 | ||
469 | #define WM8350_IM_GP10_EINT 0x0400 | ||
470 | #define WM8350_IM_GP9_EINT 0x0200 | ||
471 | #define WM8350_IM_GP8_EINT 0x0100 | ||
472 | #define WM8350_IM_GP7_EINT 0x0080 | ||
473 | #define WM8350_IM_GP6_EINT 0x0040 | ||
474 | #define WM8350_IM_GP5_EINT 0x0020 | ||
475 | #define WM8350_IM_GP4_EINT 0x0010 | ||
476 | #define WM8350_IM_GP3_EINT 0x0008 | ||
477 | #define WM8350_IM_GP2_EINT 0x0004 | ||
478 | #define WM8350_IM_GP1_EINT 0x0002 | ||
479 | #define WM8350_IM_GP0_EINT 0x0001 | ||
480 | |||
481 | /* | ||
482 | * R39 (0x27) - Comparator Interrupt Status Mask | ||
483 | */ | ||
484 | #define WM8350_IM_EXT_USB_FB_EINT 0x8000 | ||
485 | #define WM8350_IM_EXT_WALL_FB_EINT 0x4000 | ||
486 | #define WM8350_IM_EXT_BAT_FB_EINT 0x2000 | ||
487 | #define WM8350_IM_CODEC_JCK_DET_L_EINT 0x0800 | ||
488 | #define WM8350_IM_CODEC_JCK_DET_R_EINT 0x0400 | ||
489 | #define WM8350_IM_CODEC_MICSCD_EINT 0x0200 | ||
490 | #define WM8350_IM_CODEC_MICD_EINT 0x0100 | ||
491 | #define WM8350_IM_WKUP_OFF_STATE_EINT 0x0040 | ||
492 | #define WM8350_IM_WKUP_HIB_STATE_EINT 0x0020 | ||
493 | #define WM8350_IM_WKUP_CONV_FAULT_EINT 0x0010 | ||
494 | #define WM8350_IM_WKUP_WDOG_RST_EINT 0x0008 | ||
495 | #define WM8350_IM_WKUP_GP_PWR_ON_EINT 0x0004 | ||
496 | #define WM8350_IM_WKUP_ONKEY_EINT 0x0002 | ||
497 | #define WM8350_IM_WKUP_GP_WAKEUP_EINT 0x0001 | ||
498 | |||
499 | /* | ||
500 | * R220 (0xDC) - RAM BIST 1 | ||
501 | */ | ||
502 | #define WM8350_READ_STATUS 0x0800 | ||
503 | #define WM8350_TSTRAM_CLK 0x0100 | ||
504 | #define WM8350_TSTRAM_CLK_ENA 0x0080 | ||
505 | #define WM8350_STARTSEQ 0x0040 | ||
506 | #define WM8350_READ_SRC 0x0020 | ||
507 | #define WM8350_COUNT_DIR 0x0010 | ||
508 | #define WM8350_TSTRAM_MODE_MASK 0x000E | ||
509 | #define WM8350_TSTRAM_ENA 0x0001 | ||
510 | |||
511 | /* | ||
512 | * R225 (0xE1) - DCDC/LDO status | ||
513 | */ | ||
514 | #define WM8350_LS_STS 0x8000 | ||
515 | #define WM8350_LDO4_STS 0x0800 | ||
516 | #define WM8350_LDO3_STS 0x0400 | ||
517 | #define WM8350_LDO2_STS 0x0200 | ||
518 | #define WM8350_LDO1_STS 0x0100 | ||
519 | #define WM8350_DC6_STS 0x0020 | ||
520 | #define WM8350_DC5_STS 0x0010 | ||
521 | #define WM8350_DC4_STS 0x0008 | ||
522 | #define WM8350_DC3_STS 0x0004 | ||
523 | #define WM8350_DC2_STS 0x0002 | ||
524 | #define WM8350_DC1_STS 0x0001 | ||
525 | |||
526 | /* WM8350 wake up conditions */ | ||
527 | #define WM8350_IRQ_WKUP_OFF_STATE 43 | ||
528 | #define WM8350_IRQ_WKUP_HIB_STATE 44 | ||
529 | #define WM8350_IRQ_WKUP_CONV_FAULT 45 | ||
530 | #define WM8350_IRQ_WKUP_WDOG_RST 46 | ||
531 | #define WM8350_IRQ_WKUP_GP_PWR_ON 47 | ||
532 | #define WM8350_IRQ_WKUP_ONKEY 48 | ||
533 | #define WM8350_IRQ_WKUP_GP_WAKEUP 49 | ||
534 | |||
535 | /* wm8350 chip revisions */ | ||
536 | #define WM8350_REV_E 0x4 | ||
537 | #define WM8350_REV_F 0x5 | ||
538 | #define WM8350_REV_G 0x6 | ||
539 | |||
540 | #define WM8350_NUM_IRQ 63 | ||
541 | |||
542 | struct wm8350_reg_access { | ||
543 | u16 readable; /* Mask of readable bits */ | ||
544 | u16 writable; /* Mask of writable bits */ | ||
545 | u16 vol; /* Mask of volatile bits */ | ||
546 | }; | ||
547 | extern const struct wm8350_reg_access wm8350_reg_io_map[]; | ||
548 | extern const u16 wm8350_mode0_defaults[]; | ||
549 | extern const u16 wm8350_mode1_defaults[]; | ||
550 | extern const u16 wm8350_mode2_defaults[]; | ||
551 | extern const u16 wm8350_mode3_defaults[]; | ||
552 | |||
553 | struct wm8350; | ||
554 | |||
555 | struct wm8350_irq { | ||
556 | void (*handler) (struct wm8350 *, int, void *); | ||
557 | void *data; | ||
558 | }; | ||
559 | |||
560 | struct wm8350 { | ||
561 | int rev; /* chip revision */ | ||
562 | |||
563 | struct device *dev; | ||
564 | |||
565 | /* device IO */ | ||
566 | union { | ||
567 | struct i2c_client *i2c_client; | ||
568 | struct spi_device *spi_device; | ||
569 | }; | ||
570 | int (*read_dev)(struct wm8350 *wm8350, char reg, int size, void *dest); | ||
571 | int (*write_dev)(struct wm8350 *wm8350, char reg, int size, | ||
572 | void *src); | ||
573 | u16 *reg_cache; | ||
574 | |||
575 | /* Interrupt handling */ | ||
576 | struct work_struct irq_work; | ||
577 | struct mutex irq_mutex; /* IRQ table mutex */ | ||
578 | struct wm8350_irq irq[WM8350_NUM_IRQ]; | ||
579 | int chip_irq; | ||
580 | |||
581 | /* Client devices */ | ||
582 | struct wm8350_codec codec; | ||
583 | struct wm8350_gpio gpio; | ||
584 | struct wm8350_pmic pmic; | ||
585 | struct wm8350_power power; | ||
586 | struct wm8350_rtc rtc; | ||
587 | struct wm8350_wdt wdt; | ||
588 | }; | ||
589 | |||
590 | /** | ||
591 | * Data to be supplied by the platform to initialise the WM8350. | ||
592 | * | ||
593 | * @init: Function called during driver initialisation. Should be | ||
594 | * used by the platform to configure GPIO functions and similar. | ||
595 | */ | ||
596 | struct wm8350_platform_data { | ||
597 | int (*init)(struct wm8350 *wm8350); | ||
598 | }; | ||
599 | |||
600 | |||
601 | /* | ||
602 | * WM8350 device initialisation and exit. | ||
603 | */ | ||
604 | int wm8350_device_init(struct wm8350 *wm8350, int irq, | ||
605 | struct wm8350_platform_data *pdata); | ||
606 | void wm8350_device_exit(struct wm8350 *wm8350); | ||
607 | |||
608 | /* | ||
609 | * WM8350 device IO | ||
610 | */ | ||
611 | int wm8350_clear_bits(struct wm8350 *wm8350, u16 reg, u16 mask); | ||
612 | int wm8350_set_bits(struct wm8350 *wm8350, u16 reg, u16 mask); | ||
613 | u16 wm8350_reg_read(struct wm8350 *wm8350, int reg); | ||
614 | int wm8350_reg_write(struct wm8350 *wm8350, int reg, u16 val); | ||
615 | int wm8350_reg_lock(struct wm8350 *wm8350); | ||
616 | int wm8350_reg_unlock(struct wm8350 *wm8350); | ||
617 | int wm8350_block_read(struct wm8350 *wm8350, int reg, int size, u16 *dest); | ||
618 | int wm8350_block_write(struct wm8350 *wm8350, int reg, int size, u16 *src); | ||
619 | |||
620 | /* | ||
621 | * WM8350 internal interrupts | ||
622 | */ | ||
623 | int wm8350_register_irq(struct wm8350 *wm8350, int irq, | ||
624 | void (*handler) (struct wm8350 *, int, void *), | ||
625 | void *data); | ||
626 | int wm8350_free_irq(struct wm8350 *wm8350, int irq); | ||
627 | int wm8350_mask_irq(struct wm8350 *wm8350, int irq); | ||
628 | int wm8350_unmask_irq(struct wm8350 *wm8350, int irq); | ||
629 | |||
630 | |||
631 | #endif | ||
diff --git a/include/linux/mfd/wm8350/gpio.h b/include/linux/mfd/wm8350/gpio.h new file mode 100644 index 000000000000..ed91e8f5d298 --- /dev/null +++ b/include/linux/mfd/wm8350/gpio.h | |||
@@ -0,0 +1,342 @@ | |||
1 | /* | ||
2 | * gpio.h -- GPIO Driver for Wolfson WM8350 PMIC | ||
3 | * | ||
4 | * Copyright 2007 Wolfson Microelectronics PLC | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_MFD_WM8350_GPIO_H_ | ||
14 | #define __LINUX_MFD_WM8350_GPIO_H_ | ||
15 | |||
16 | #include <linux/platform_device.h> | ||
17 | |||
18 | /* | ||
19 | * GPIO Registers. | ||
20 | */ | ||
21 | #define WM8350_GPIO_DEBOUNCE 0x80 | ||
22 | #define WM8350_GPIO_PIN_PULL_UP_CONTROL 0x81 | ||
23 | #define WM8350_GPIO_PULL_DOWN_CONTROL 0x82 | ||
24 | #define WM8350_GPIO_INT_MODE 0x83 | ||
25 | #define WM8350_GPIO_CONTROL 0x85 | ||
26 | #define WM8350_GPIO_CONFIGURATION_I_O 0x86 | ||
27 | #define WM8350_GPIO_PIN_POLARITY_TYPE 0x87 | ||
28 | #define WM8350_GPIO_FUNCTION_SELECT_1 0x8C | ||
29 | #define WM8350_GPIO_FUNCTION_SELECT_2 0x8D | ||
30 | #define WM8350_GPIO_FUNCTION_SELECT_3 0x8E | ||
31 | #define WM8350_GPIO_FUNCTION_SELECT_4 0x8F | ||
32 | |||
33 | /* | ||
34 | * GPIO Functions | ||
35 | */ | ||
36 | #define WM8350_GPIO0_GPIO_IN 0x0 | ||
37 | #define WM8350_GPIO0_GPIO_OUT 0x0 | ||
38 | #define WM8350_GPIO0_PWR_ON_IN 0x1 | ||
39 | #define WM8350_GPIO0_PWR_ON_OUT 0x1 | ||
40 | #define WM8350_GPIO0_LDO_EN_IN 0x2 | ||
41 | #define WM8350_GPIO0_VRTC_OUT 0x2 | ||
42 | #define WM8350_GPIO0_LPWR1_IN 0x3 | ||
43 | #define WM8350_GPIO0_POR_B_OUT 0x3 | ||
44 | |||
45 | #define WM8350_GPIO1_GPIO_IN 0x0 | ||
46 | #define WM8350_GPIO1_GPIO_OUT 0x0 | ||
47 | #define WM8350_GPIO1_PWR_ON_IN 0x1 | ||
48 | #define WM8350_GPIO1_DO_CONF_OUT 0x1 | ||
49 | #define WM8350_GPIO1_LDO_EN_IN 0x2 | ||
50 | #define WM8350_GPIO1_RESET_OUT 0x2 | ||
51 | #define WM8350_GPIO1_LPWR2_IN 0x3 | ||
52 | #define WM8350_GPIO1_MEMRST_OUT 0x3 | ||
53 | |||
54 | #define WM8350_GPIO2_GPIO_IN 0x0 | ||
55 | #define WM8350_GPIO2_GPIO_OUT 0x0 | ||
56 | #define WM8350_GPIO2_PWR_ON_IN 0x1 | ||
57 | #define WM8350_GPIO2_PWR_ON_OUT 0x1 | ||
58 | #define WM8350_GPIO2_WAKE_UP_IN 0x2 | ||
59 | #define WM8350_GPIO2_VRTC_OUT 0x2 | ||
60 | #define WM8350_GPIO2_32KHZ_IN 0x3 | ||
61 | #define WM8350_GPIO2_32KHZ_OUT 0x3 | ||
62 | |||
63 | #define WM8350_GPIO3_GPIO_IN 0x0 | ||
64 | #define WM8350_GPIO3_GPIO_OUT 0x0 | ||
65 | #define WM8350_GPIO3_PWR_ON_IN 0x1 | ||
66 | #define WM8350_GPIO3_P_CLK_OUT 0x1 | ||
67 | #define WM8350_GPIO3_LDO_EN_IN 0x2 | ||
68 | #define WM8350_GPIO3_VRTC_OUT 0x2 | ||
69 | #define WM8350_GPIO3_PWR_OFF_IN 0x3 | ||
70 | #define WM8350_GPIO3_32KHZ_OUT 0x3 | ||
71 | |||
72 | #define WM8350_GPIO4_GPIO_IN 0x0 | ||
73 | #define WM8350_GPIO4_GPIO_OUT 0x0 | ||
74 | #define WM8350_GPIO4_MR_IN 0x1 | ||
75 | #define WM8350_GPIO4_MEM_RST_OUT 0x1 | ||
76 | #define WM8350_GPIO4_FLASH_IN 0x2 | ||
77 | #define WM8350_GPIO4_ADA_OUT 0x2 | ||
78 | #define WM8350_GPIO4_HIBERNATE_IN 0x3 | ||
79 | #define WM8350_GPIO4_FLASH_OUT 0x3 | ||
80 | #define WM8350_GPIO4_MICDET_OUT 0x4 | ||
81 | #define WM8350_GPIO4_MICSHT_OUT 0x5 | ||
82 | |||
83 | #define WM8350_GPIO5_GPIO_IN 0x0 | ||
84 | #define WM8350_GPIO5_GPIO_OUT 0x0 | ||
85 | #define WM8350_GPIO5_LPWR1_IN 0x1 | ||
86 | #define WM8350_GPIO5_P_CLK_OUT 0x1 | ||
87 | #define WM8350_GPIO5_ADCLRCLK_IN 0x2 | ||
88 | #define WM8350_GPIO5_ADCLRCLK_OUT 0x2 | ||
89 | #define WM8350_GPIO5_HIBERNATE_IN 0x3 | ||
90 | #define WM8350_GPIO5_32KHZ_OUT 0x3 | ||
91 | #define WM8350_GPIO5_MICDET_OUT 0x4 | ||
92 | #define WM8350_GPIO5_MICSHT_OUT 0x5 | ||
93 | #define WM8350_GPIO5_ADA_OUT 0x6 | ||
94 | #define WM8350_GPIO5_OPCLK_OUT 0x7 | ||
95 | |||
96 | #define WM8350_GPIO6_GPIO_IN 0x0 | ||
97 | #define WM8350_GPIO6_GPIO_OUT 0x0 | ||
98 | #define WM8350_GPIO6_LPWR2_IN 0x1 | ||
99 | #define WM8350_GPIO6_MEMRST_OUT 0x1 | ||
100 | #define WM8350_GPIO6_FLASH_IN 0x2 | ||
101 | #define WM8350_GPIO6_ADA_OUT 0x2 | ||
102 | #define WM8350_GPIO6_HIBERNATE_IN 0x3 | ||
103 | #define WM8350_GPIO6_RTC_OUT 0x3 | ||
104 | #define WM8350_GPIO6_MICDET_OUT 0x4 | ||
105 | #define WM8350_GPIO6_MICSHT_OUT 0x5 | ||
106 | #define WM8350_GPIO6_ADCLRCLKB_OUT 0x6 | ||
107 | #define WM8350_GPIO6_SDOUT_OUT 0x7 | ||
108 | |||
109 | #define WM8350_GPIO7_GPIO_IN 0x0 | ||
110 | #define WM8350_GPIO7_GPIO_OUT 0x0 | ||
111 | #define WM8350_GPIO7_LPWR3_IN 0x1 | ||
112 | #define WM8350_GPIO7_P_CLK_OUT 0x1 | ||
113 | #define WM8350_GPIO7_MASK_IN 0x2 | ||
114 | #define WM8350_GPIO7_VCC_FAULT_OUT 0x2 | ||
115 | #define WM8350_GPIO7_HIBERNATE_IN 0x3 | ||
116 | #define WM8350_GPIO7_BATT_FAULT_OUT 0x3 | ||
117 | #define WM8350_GPIO7_MICDET_OUT 0x4 | ||
118 | #define WM8350_GPIO7_MICSHT_OUT 0x5 | ||
119 | #define WM8350_GPIO7_ADA_OUT 0x6 | ||
120 | #define WM8350_GPIO7_CSB_IN 0x7 | ||
121 | |||
122 | #define WM8350_GPIO8_GPIO_IN 0x0 | ||
123 | #define WM8350_GPIO8_GPIO_OUT 0x0 | ||
124 | #define WM8350_GPIO8_MR_IN 0x1 | ||
125 | #define WM8350_GPIO8_VCC_FAULT_OUT 0x1 | ||
126 | #define WM8350_GPIO8_ADCBCLK_IN 0x2 | ||
127 | #define WM8350_GPIO8_ADCBCLK_OUT 0x2 | ||
128 | #define WM8350_GPIO8_PWR_OFF_IN 0x3 | ||
129 | #define WM8350_GPIO8_BATT_FAULT_OUT 0x3 | ||
130 | #define WM8350_GPIO8_ALTSCL_IN 0xf | ||
131 | |||
132 | #define WM8350_GPIO9_GPIO_IN 0x0 | ||
133 | #define WM8350_GPIO9_GPIO_OUT 0x0 | ||
134 | #define WM8350_GPIO9_HEARTBEAT_IN 0x1 | ||
135 | #define WM8350_GPIO9_VCC_FAULT_OUT 0x1 | ||
136 | #define WM8350_GPIO9_MASK_IN 0x2 | ||
137 | #define WM8350_GPIO9_LINE_GT_BATT_OUT 0x2 | ||
138 | #define WM8350_GPIO9_PWR_OFF_IN 0x3 | ||
139 | #define WM8350_GPIO9_BATT_FAULT_OUT 0x3 | ||
140 | #define WM8350_GPIO9_ALTSDA_OUT 0xf | ||
141 | |||
142 | #define WM8350_GPIO10_GPIO_IN 0x0 | ||
143 | #define WM8350_GPIO10_GPIO_OUT 0x0 | ||
144 | #define WM8350_GPIO10_ISINKC_OUT 0x1 | ||
145 | #define WM8350_GPIO10_PWR_OFF_IN 0x2 | ||
146 | #define WM8350_GPIO10_LINE_GT_BATT_OUT 0x2 | ||
147 | #define WM8350_GPIO10_CHD_IND_IN 0x3 | ||
148 | |||
149 | #define WM8350_GPIO11_GPIO_IN 0x0 | ||
150 | #define WM8350_GPIO11_GPIO_OUT 0x0 | ||
151 | #define WM8350_GPIO11_ISINKD_OUT 0x1 | ||
152 | #define WM8350_GPIO11_WAKEUP_IN 0x2 | ||
153 | #define WM8350_GPIO11_LINE_GT_BATT_OUT 0x2 | ||
154 | #define WM8350_GPIO11_CHD_IND_IN 0x3 | ||
155 | |||
156 | #define WM8350_GPIO12_GPIO_IN 0x0 | ||
157 | #define WM8350_GPIO12_GPIO_OUT 0x0 | ||
158 | #define WM8350_GPIO12_ISINKE_OUT 0x1 | ||
159 | #define WM8350_GPIO12_LINE_GT_BATT_OUT 0x2 | ||
160 | #define WM8350_GPIO12_LINE_EN_OUT 0x3 | ||
161 | #define WM8350_GPIO12_32KHZ_OUT 0x4 | ||
162 | |||
163 | #define WM8350_GPIO_DIR_IN 0 | ||
164 | #define WM8350_GPIO_DIR_OUT 1 | ||
165 | #define WM8350_GPIO_ACTIVE_LOW 0 | ||
166 | #define WM8350_GPIO_ACTIVE_HIGH 1 | ||
167 | #define WM8350_GPIO_PULL_NONE 0 | ||
168 | #define WM8350_GPIO_PULL_UP 1 | ||
169 | #define WM8350_GPIO_PULL_DOWN 2 | ||
170 | #define WM8350_GPIO_INVERT_OFF 0 | ||
171 | #define WM8350_GPIO_INVERT_ON 1 | ||
172 | #define WM8350_GPIO_DEBOUNCE_OFF 0 | ||
173 | #define WM8350_GPIO_DEBOUNCE_ON 1 | ||
174 | |||
175 | /* | ||
176 | * R128 (0x80) - GPIO Debounce | ||
177 | */ | ||
178 | #define WM8350_GP12_DB 0x1000 | ||
179 | #define WM8350_GP11_DB 0x0800 | ||
180 | #define WM8350_GP10_DB 0x0400 | ||
181 | #define WM8350_GP9_DB 0x0200 | ||
182 | #define WM8350_GP8_DB 0x0100 | ||
183 | #define WM8350_GP7_DB 0x0080 | ||
184 | #define WM8350_GP6_DB 0x0040 | ||
185 | #define WM8350_GP5_DB 0x0020 | ||
186 | #define WM8350_GP4_DB 0x0010 | ||
187 | #define WM8350_GP3_DB 0x0008 | ||
188 | #define WM8350_GP2_DB 0x0004 | ||
189 | #define WM8350_GP1_DB 0x0002 | ||
190 | #define WM8350_GP0_DB 0x0001 | ||
191 | |||
192 | /* | ||
193 | * R129 (0x81) - GPIO Pin pull up Control | ||
194 | */ | ||
195 | #define WM8350_GP12_PU 0x1000 | ||
196 | #define WM8350_GP11_PU 0x0800 | ||
197 | #define WM8350_GP10_PU 0x0400 | ||
198 | #define WM8350_GP9_PU 0x0200 | ||
199 | #define WM8350_GP8_PU 0x0100 | ||
200 | #define WM8350_GP7_PU 0x0080 | ||
201 | #define WM8350_GP6_PU 0x0040 | ||
202 | #define WM8350_GP5_PU 0x0020 | ||
203 | #define WM8350_GP4_PU 0x0010 | ||
204 | #define WM8350_GP3_PU 0x0008 | ||
205 | #define WM8350_GP2_PU 0x0004 | ||
206 | #define WM8350_GP1_PU 0x0002 | ||
207 | #define WM8350_GP0_PU 0x0001 | ||
208 | |||
209 | /* | ||
210 | * R130 (0x82) - GPIO Pull down Control | ||
211 | */ | ||
212 | #define WM8350_GP12_PD 0x1000 | ||
213 | #define WM8350_GP11_PD 0x0800 | ||
214 | #define WM8350_GP10_PD 0x0400 | ||
215 | #define WM8350_GP9_PD 0x0200 | ||
216 | #define WM8350_GP8_PD 0x0100 | ||
217 | #define WM8350_GP7_PD 0x0080 | ||
218 | #define WM8350_GP6_PD 0x0040 | ||
219 | #define WM8350_GP5_PD 0x0020 | ||
220 | #define WM8350_GP4_PD 0x0010 | ||
221 | #define WM8350_GP3_PD 0x0008 | ||
222 | #define WM8350_GP2_PD 0x0004 | ||
223 | #define WM8350_GP1_PD 0x0002 | ||
224 | #define WM8350_GP0_PD 0x0001 | ||
225 | |||
226 | /* | ||
227 | * R131 (0x83) - GPIO Interrupt Mode | ||
228 | */ | ||
229 | #define WM8350_GP12_INTMODE 0x1000 | ||
230 | #define WM8350_GP11_INTMODE 0x0800 | ||
231 | #define WM8350_GP10_INTMODE 0x0400 | ||
232 | #define WM8350_GP9_INTMODE 0x0200 | ||
233 | #define WM8350_GP8_INTMODE 0x0100 | ||
234 | #define WM8350_GP7_INTMODE 0x0080 | ||
235 | #define WM8350_GP6_INTMODE 0x0040 | ||
236 | #define WM8350_GP5_INTMODE 0x0020 | ||
237 | #define WM8350_GP4_INTMODE 0x0010 | ||
238 | #define WM8350_GP3_INTMODE 0x0008 | ||
239 | #define WM8350_GP2_INTMODE 0x0004 | ||
240 | #define WM8350_GP1_INTMODE 0x0002 | ||
241 | #define WM8350_GP0_INTMODE 0x0001 | ||
242 | |||
243 | /* | ||
244 | * R133 (0x85) - GPIO Control | ||
245 | */ | ||
246 | #define WM8350_GP_DBTIME_MASK 0x00C0 | ||
247 | |||
248 | /* | ||
249 | * R134 (0x86) - GPIO Configuration (i/o) | ||
250 | */ | ||
251 | #define WM8350_GP12_DIR 0x1000 | ||
252 | #define WM8350_GP11_DIR 0x0800 | ||
253 | #define WM8350_GP10_DIR 0x0400 | ||
254 | #define WM8350_GP9_DIR 0x0200 | ||
255 | #define WM8350_GP8_DIR 0x0100 | ||
256 | #define WM8350_GP7_DIR 0x0080 | ||
257 | #define WM8350_GP6_DIR 0x0040 | ||
258 | #define WM8350_GP5_DIR 0x0020 | ||
259 | #define WM8350_GP4_DIR 0x0010 | ||
260 | #define WM8350_GP3_DIR 0x0008 | ||
261 | #define WM8350_GP2_DIR 0x0004 | ||
262 | #define WM8350_GP1_DIR 0x0002 | ||
263 | #define WM8350_GP0_DIR 0x0001 | ||
264 | |||
265 | /* | ||
266 | * R135 (0x87) - GPIO Pin Polarity / Type | ||
267 | */ | ||
268 | #define WM8350_GP12_CFG 0x1000 | ||
269 | #define WM8350_GP11_CFG 0x0800 | ||
270 | #define WM8350_GP10_CFG 0x0400 | ||
271 | #define WM8350_GP9_CFG 0x0200 | ||
272 | #define WM8350_GP8_CFG 0x0100 | ||
273 | #define WM8350_GP7_CFG 0x0080 | ||
274 | #define WM8350_GP6_CFG 0x0040 | ||
275 | #define WM8350_GP5_CFG 0x0020 | ||
276 | #define WM8350_GP4_CFG 0x0010 | ||
277 | #define WM8350_GP3_CFG 0x0008 | ||
278 | #define WM8350_GP2_CFG 0x0004 | ||
279 | #define WM8350_GP1_CFG 0x0002 | ||
280 | #define WM8350_GP0_CFG 0x0001 | ||
281 | |||
282 | /* | ||
283 | * R140 (0x8C) - GPIO Function Select 1 | ||
284 | */ | ||
285 | #define WM8350_GP3_FN_MASK 0xF000 | ||
286 | #define WM8350_GP2_FN_MASK 0x0F00 | ||
287 | #define WM8350_GP1_FN_MASK 0x00F0 | ||
288 | #define WM8350_GP0_FN_MASK 0x000F | ||
289 | |||
290 | /* | ||
291 | * R141 (0x8D) - GPIO Function Select 2 | ||
292 | */ | ||
293 | #define WM8350_GP7_FN_MASK 0xF000 | ||
294 | #define WM8350_GP6_FN_MASK 0x0F00 | ||
295 | #define WM8350_GP5_FN_MASK 0x00F0 | ||
296 | #define WM8350_GP4_FN_MASK 0x000F | ||
297 | |||
298 | /* | ||
299 | * R142 (0x8E) - GPIO Function Select 3 | ||
300 | */ | ||
301 | #define WM8350_GP11_FN_MASK 0xF000 | ||
302 | #define WM8350_GP10_FN_MASK 0x0F00 | ||
303 | #define WM8350_GP9_FN_MASK 0x00F0 | ||
304 | #define WM8350_GP8_FN_MASK 0x000F | ||
305 | |||
306 | /* | ||
307 | * R143 (0x8F) - GPIO Function Select 4 | ||
308 | */ | ||
309 | #define WM8350_GP12_FN_MASK 0x000F | ||
310 | |||
311 | /* | ||
312 | * R230 (0xE6) - GPIO Pin Status | ||
313 | */ | ||
314 | #define WM8350_GP12_LVL 0x1000 | ||
315 | #define WM8350_GP11_LVL 0x0800 | ||
316 | #define WM8350_GP10_LVL 0x0400 | ||
317 | #define WM8350_GP9_LVL 0x0200 | ||
318 | #define WM8350_GP8_LVL 0x0100 | ||
319 | #define WM8350_GP7_LVL 0x0080 | ||
320 | #define WM8350_GP6_LVL 0x0040 | ||
321 | #define WM8350_GP5_LVL 0x0020 | ||
322 | #define WM8350_GP4_LVL 0x0010 | ||
323 | #define WM8350_GP3_LVL 0x0008 | ||
324 | #define WM8350_GP2_LVL 0x0004 | ||
325 | #define WM8350_GP1_LVL 0x0002 | ||
326 | #define WM8350_GP0_LVL 0x0001 | ||
327 | |||
328 | struct wm8350; | ||
329 | |||
330 | int wm8350_gpio_config(struct wm8350 *wm8350, int gpio, int dir, int func, | ||
331 | int pol, int pull, int invert, int debounce); | ||
332 | |||
333 | struct wm8350_gpio { | ||
334 | struct platform_device *pdev; | ||
335 | }; | ||
336 | |||
337 | /* | ||
338 | * GPIO Interrupts | ||
339 | */ | ||
340 | #define WM8350_IRQ_GPIO(x) (50 + x) | ||
341 | |||
342 | #endif | ||
diff --git a/include/linux/mfd/wm8350/pmic.h b/include/linux/mfd/wm8350/pmic.h new file mode 100644 index 000000000000..69b69e07f62f --- /dev/null +++ b/include/linux/mfd/wm8350/pmic.h | |||
@@ -0,0 +1,741 @@ | |||
1 | /* | ||
2 | * pmic.h -- Power Managment Driver for Wolfson WM8350 PMIC | ||
3 | * | ||
4 | * Copyright 2007 Wolfson Microelectronics PLC | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_MFD_WM8350_PMIC_H | ||
14 | #define __LINUX_MFD_WM8350_PMIC_H | ||
15 | |||
16 | /* | ||
17 | * Register values. | ||
18 | */ | ||
19 | |||
20 | #define WM8350_CURRENT_SINK_DRIVER_A 0xAC | ||
21 | #define WM8350_CSA_FLASH_CONTROL 0xAD | ||
22 | #define WM8350_CURRENT_SINK_DRIVER_B 0xAE | ||
23 | #define WM8350_CSB_FLASH_CONTROL 0xAF | ||
24 | #define WM8350_DCDC_LDO_REQUESTED 0xB0 | ||
25 | #define WM8350_DCDC_ACTIVE_OPTIONS 0xB1 | ||
26 | #define WM8350_DCDC_SLEEP_OPTIONS 0xB2 | ||
27 | #define WM8350_POWER_CHECK_COMPARATOR 0xB3 | ||
28 | #define WM8350_DCDC1_CONTROL 0xB4 | ||
29 | #define WM8350_DCDC1_TIMEOUTS 0xB5 | ||
30 | #define WM8350_DCDC1_LOW_POWER 0xB6 | ||
31 | #define WM8350_DCDC2_CONTROL 0xB7 | ||
32 | #define WM8350_DCDC2_TIMEOUTS 0xB8 | ||
33 | #define WM8350_DCDC3_CONTROL 0xBA | ||
34 | #define WM8350_DCDC3_TIMEOUTS 0xBB | ||
35 | #define WM8350_DCDC3_LOW_POWER 0xBC | ||
36 | #define WM8350_DCDC4_CONTROL 0xBD | ||
37 | #define WM8350_DCDC4_TIMEOUTS 0xBE | ||
38 | #define WM8350_DCDC4_LOW_POWER 0xBF | ||
39 | #define WM8350_DCDC5_CONTROL 0xC0 | ||
40 | #define WM8350_DCDC5_TIMEOUTS 0xC1 | ||
41 | #define WM8350_DCDC6_CONTROL 0xC3 | ||
42 | #define WM8350_DCDC6_TIMEOUTS 0xC4 | ||
43 | #define WM8350_DCDC6_LOW_POWER 0xC5 | ||
44 | #define WM8350_LIMIT_SWITCH_CONTROL 0xC7 | ||
45 | #define WM8350_LDO1_CONTROL 0xC8 | ||
46 | #define WM8350_LDO1_TIMEOUTS 0xC9 | ||
47 | #define WM8350_LDO1_LOW_POWER 0xCA | ||
48 | #define WM8350_LDO2_CONTROL 0xCB | ||
49 | #define WM8350_LDO2_TIMEOUTS 0xCC | ||
50 | #define WM8350_LDO2_LOW_POWER 0xCD | ||
51 | #define WM8350_LDO3_CONTROL 0xCE | ||
52 | #define WM8350_LDO3_TIMEOUTS 0xCF | ||
53 | #define WM8350_LDO3_LOW_POWER 0xD0 | ||
54 | #define WM8350_LDO4_CONTROL 0xD1 | ||
55 | #define WM8350_LDO4_TIMEOUTS 0xD2 | ||
56 | #define WM8350_LDO4_LOW_POWER 0xD3 | ||
57 | #define WM8350_VCC_FAULT_MASKS 0xD7 | ||
58 | #define WM8350_MAIN_BANDGAP_CONTROL 0xD8 | ||
59 | #define WM8350_OSC_CONTROL 0xD9 | ||
60 | #define WM8350_RTC_TICK_CONTROL 0xDA | ||
61 | #define WM8350_SECURITY 0xDB | ||
62 | #define WM8350_RAM_BIST_1 0xDC | ||
63 | #define WM8350_DCDC_LDO_STATUS 0xE1 | ||
64 | #define WM8350_GPIO_PIN_STATUS 0xE6 | ||
65 | |||
66 | #define WM8350_DCDC1_FORCE_PWM 0xF8 | ||
67 | #define WM8350_DCDC3_FORCE_PWM 0xFA | ||
68 | #define WM8350_DCDC4_FORCE_PWM 0xFB | ||
69 | #define WM8350_DCDC6_FORCE_PWM 0xFD | ||
70 | |||
71 | /* | ||
72 | * R172 (0xAC) - Current Sink Driver A | ||
73 | */ | ||
74 | #define WM8350_CS1_HIB_MODE 0x1000 | ||
75 | #define WM8350_CS1_HIB_MODE_MASK 0x1000 | ||
76 | #define WM8350_CS1_HIB_MODE_SHIFT 12 | ||
77 | #define WM8350_CS1_ISEL_MASK 0x003F | ||
78 | #define WM8350_CS1_ISEL_SHIFT 0 | ||
79 | |||
80 | /* Bit values for R172 (0xAC) */ | ||
81 | #define WM8350_CS1_HIB_MODE_DISABLE 0 | ||
82 | #define WM8350_CS1_HIB_MODE_LEAVE 1 | ||
83 | |||
84 | #define WM8350_CS1_ISEL_220M 0x3F | ||
85 | |||
86 | /* | ||
87 | * R173 (0xAD) - CSA Flash control | ||
88 | */ | ||
89 | #define WM8350_CS1_FLASH_MODE 0x8000 | ||
90 | #define WM8350_CS1_TRIGSRC 0x4000 | ||
91 | #define WM8350_CS1_DRIVE 0x2000 | ||
92 | #define WM8350_CS1_FLASH_DUR_MASK 0x0300 | ||
93 | #define WM8350_CS1_OFF_RAMP_MASK 0x0030 | ||
94 | #define WM8350_CS1_ON_RAMP_MASK 0x0003 | ||
95 | |||
96 | /* | ||
97 | * R174 (0xAE) - Current Sink Driver B | ||
98 | */ | ||
99 | #define WM8350_CS2_HIB_MODE 0x1000 | ||
100 | #define WM8350_CS2_ISEL_MASK 0x003F | ||
101 | |||
102 | /* | ||
103 | * R175 (0xAF) - CSB Flash control | ||
104 | */ | ||
105 | #define WM8350_CS2_FLASH_MODE 0x8000 | ||
106 | #define WM8350_CS2_TRIGSRC 0x4000 | ||
107 | #define WM8350_CS2_DRIVE 0x2000 | ||
108 | #define WM8350_CS2_FLASH_DUR_MASK 0x0300 | ||
109 | #define WM8350_CS2_OFF_RAMP_MASK 0x0030 | ||
110 | #define WM8350_CS2_ON_RAMP_MASK 0x0003 | ||
111 | |||
112 | /* | ||
113 | * R176 (0xB0) - DCDC/LDO requested | ||
114 | */ | ||
115 | #define WM8350_LS_ENA 0x8000 | ||
116 | #define WM8350_LDO4_ENA 0x0800 | ||
117 | #define WM8350_LDO3_ENA 0x0400 | ||
118 | #define WM8350_LDO2_ENA 0x0200 | ||
119 | #define WM8350_LDO1_ENA 0x0100 | ||
120 | #define WM8350_DC6_ENA 0x0020 | ||
121 | #define WM8350_DC5_ENA 0x0010 | ||
122 | #define WM8350_DC4_ENA 0x0008 | ||
123 | #define WM8350_DC3_ENA 0x0004 | ||
124 | #define WM8350_DC2_ENA 0x0002 | ||
125 | #define WM8350_DC1_ENA 0x0001 | ||
126 | |||
127 | /* | ||
128 | * R177 (0xB1) - DCDC Active options | ||
129 | */ | ||
130 | #define WM8350_PUTO_MASK 0x3000 | ||
131 | #define WM8350_PWRUP_DELAY_MASK 0x0300 | ||
132 | #define WM8350_DC6_ACTIVE 0x0020 | ||
133 | #define WM8350_DC4_ACTIVE 0x0008 | ||
134 | #define WM8350_DC3_ACTIVE 0x0004 | ||
135 | #define WM8350_DC1_ACTIVE 0x0001 | ||
136 | |||
137 | /* | ||
138 | * R178 (0xB2) - DCDC Sleep options | ||
139 | */ | ||
140 | #define WM8350_DC6_SLEEP 0x0020 | ||
141 | #define WM8350_DC4_SLEEP 0x0008 | ||
142 | #define WM8350_DC3_SLEEP 0x0004 | ||
143 | #define WM8350_DC1_SLEEP 0x0001 | ||
144 | |||
145 | /* | ||
146 | * R179 (0xB3) - Power-check comparator | ||
147 | */ | ||
148 | #define WM8350_PCCMP_ERRACT 0x4000 | ||
149 | #define WM8350_PCCMP_RAIL 0x0100 | ||
150 | #define WM8350_PCCMP_OFF_THR_MASK 0x0070 | ||
151 | #define WM8350_PCCMP_ON_THR_MASK 0x0007 | ||
152 | |||
153 | /* | ||
154 | * R180 (0xB4) - DCDC1 Control | ||
155 | */ | ||
156 | #define WM8350_DC1_OPFLT 0x0400 | ||
157 | #define WM8350_DC1_VSEL_MASK 0x007F | ||
158 | #define WM8350_DC1_VSEL_SHIFT 0 | ||
159 | |||
160 | /* | ||
161 | * R181 (0xB5) - DCDC1 Timeouts | ||
162 | */ | ||
163 | #define WM8350_DC1_ERRACT_MASK 0xC000 | ||
164 | #define WM8350_DC1_ERRACT_SHIFT 14 | ||
165 | #define WM8350_DC1_ENSLOT_MASK 0x3C00 | ||
166 | #define WM8350_DC1_ENSLOT_SHIFT 10 | ||
167 | #define WM8350_DC1_SDSLOT_MASK 0x03C0 | ||
168 | #define WM8350_DC1_UVTO_MASK 0x0030 | ||
169 | #define WM8350_DC1_SDSLOT_SHIFT 6 | ||
170 | |||
171 | /* Bit values for R181 (0xB5) */ | ||
172 | #define WM8350_DC1_ERRACT_NONE 0 | ||
173 | #define WM8350_DC1_ERRACT_SHUTDOWN_CONV 1 | ||
174 | #define WM8350_DC1_ERRACT_SHUTDOWN_SYS 2 | ||
175 | |||
176 | /* | ||
177 | * R182 (0xB6) - DCDC1 Low Power | ||
178 | */ | ||
179 | #define WM8350_DC1_HIB_MODE_MASK 0x7000 | ||
180 | #define WM8350_DC1_HIB_TRIG_MASK 0x0300 | ||
181 | #define WM8350_DC1_VIMG_MASK 0x007F | ||
182 | |||
183 | /* | ||
184 | * R183 (0xB7) - DCDC2 Control | ||
185 | */ | ||
186 | #define WM8350_DC2_MODE 0x4000 | ||
187 | #define WM8350_DC2_MODE_MASK 0x4000 | ||
188 | #define WM8350_DC2_MODE_SHIFT 14 | ||
189 | #define WM8350_DC2_HIB_MODE 0x1000 | ||
190 | #define WM8350_DC2_HIB_MODE_MASK 0x1000 | ||
191 | #define WM8350_DC2_HIB_MODE_SHIFT 12 | ||
192 | #define WM8350_DC2_HIB_TRIG_MASK 0x0300 | ||
193 | #define WM8350_DC2_HIB_TRIG_SHIFT 8 | ||
194 | #define WM8350_DC2_ILIM 0x0040 | ||
195 | #define WM8350_DC2_ILIM_MASK 0x0040 | ||
196 | #define WM8350_DC2_ILIM_SHIFT 6 | ||
197 | #define WM8350_DC2_RMP_MASK 0x0018 | ||
198 | #define WM8350_DC2_RMP_SHIFT 3 | ||
199 | #define WM8350_DC2_FBSRC_MASK 0x0003 | ||
200 | #define WM8350_DC2_FBSRC_SHIFT 0 | ||
201 | |||
202 | /* Bit values for R183 (0xB7) */ | ||
203 | #define WM8350_DC2_MODE_BOOST 0 | ||
204 | #define WM8350_DC2_MODE_SWITCH 1 | ||
205 | |||
206 | #define WM8350_DC2_HIB_MODE_ACTIVE 1 | ||
207 | #define WM8350_DC2_HIB_MODE_DISABLE 0 | ||
208 | |||
209 | #define WM8350_DC2_HIB_TRIG_NONE 0 | ||
210 | #define WM8350_DC2_HIB_TRIG_LPWR1 1 | ||
211 | #define WM8350_DC2_HIB_TRIG_LPWR2 2 | ||
212 | #define WM8350_DC2_HIB_TRIG_LPWR3 3 | ||
213 | |||
214 | #define WM8350_DC2_ILIM_HIGH 0 | ||
215 | #define WM8350_DC2_ILIM_LOW 1 | ||
216 | |||
217 | #define WM8350_DC2_RMP_30V 0 | ||
218 | #define WM8350_DC2_RMP_20V 1 | ||
219 | #define WM8350_DC2_RMP_10V 2 | ||
220 | #define WM8350_DC2_RMP_5V 3 | ||
221 | |||
222 | #define WM8350_DC2_FBSRC_FB2 0 | ||
223 | #define WM8350_DC2_FBSRC_ISINKA 1 | ||
224 | #define WM8350_DC2_FBSRC_ISINKB 2 | ||
225 | #define WM8350_DC2_FBSRC_USB 3 | ||
226 | |||
227 | /* | ||
228 | * R184 (0xB8) - DCDC2 Timeouts | ||
229 | */ | ||
230 | #define WM8350_DC2_ERRACT_MASK 0xC000 | ||
231 | #define WM8350_DC2_ERRACT_SHIFT 14 | ||
232 | #define WM8350_DC2_ENSLOT_MASK 0x3C00 | ||
233 | #define WM8350_DC2_ENSLOT_SHIFT 10 | ||
234 | #define WM8350_DC2_SDSLOT_MASK 0x03C0 | ||
235 | #define WM8350_DC2_UVTO_MASK 0x0030 | ||
236 | |||
237 | /* Bit values for R184 (0xB8) */ | ||
238 | #define WM8350_DC2_ERRACT_NONE 0 | ||
239 | #define WM8350_DC2_ERRACT_SHUTDOWN_CONV 1 | ||
240 | #define WM8350_DC2_ERRACT_SHUTDOWN_SYS 2 | ||
241 | |||
242 | /* | ||
243 | * R186 (0xBA) - DCDC3 Control | ||
244 | */ | ||
245 | #define WM8350_DC3_OPFLT 0x0400 | ||
246 | #define WM8350_DC3_VSEL_MASK 0x007F | ||
247 | #define WM8350_DC3_VSEL_SHIFT 0 | ||
248 | |||
249 | /* | ||
250 | * R187 (0xBB) - DCDC3 Timeouts | ||
251 | */ | ||
252 | #define WM8350_DC3_ERRACT_MASK 0xC000 | ||
253 | #define WM8350_DC3_ERRACT_SHIFT 14 | ||
254 | #define WM8350_DC3_ENSLOT_MASK 0x3C00 | ||
255 | #define WM8350_DC3_ENSLOT_SHIFT 10 | ||
256 | #define WM8350_DC3_SDSLOT_MASK 0x03C0 | ||
257 | #define WM8350_DC3_UVTO_MASK 0x0030 | ||
258 | #define WM8350_DC3_SDSLOT_SHIFT 6 | ||
259 | |||
260 | /* Bit values for R187 (0xBB) */ | ||
261 | #define WM8350_DC3_ERRACT_NONE 0 | ||
262 | #define WM8350_DC3_ERRACT_SHUTDOWN_CONV 1 | ||
263 | #define WM8350_DC3_ERRACT_SHUTDOWN_SYS 2 | ||
264 | /* | ||
265 | * R188 (0xBC) - DCDC3 Low Power | ||
266 | */ | ||
267 | #define WM8350_DC3_HIB_MODE_MASK 0x7000 | ||
268 | #define WM8350_DC3_HIB_TRIG_MASK 0x0300 | ||
269 | #define WM8350_DC3_VIMG_MASK 0x007F | ||
270 | |||
271 | /* | ||
272 | * R189 (0xBD) - DCDC4 Control | ||
273 | */ | ||
274 | #define WM8350_DC4_OPFLT 0x0400 | ||
275 | #define WM8350_DC4_VSEL_MASK 0x007F | ||
276 | #define WM8350_DC4_VSEL_SHIFT 0 | ||
277 | |||
278 | /* | ||
279 | * R190 (0xBE) - DCDC4 Timeouts | ||
280 | */ | ||
281 | #define WM8350_DC4_ERRACT_MASK 0xC000 | ||
282 | #define WM8350_DC4_ERRACT_SHIFT 14 | ||
283 | #define WM8350_DC4_ENSLOT_MASK 0x3C00 | ||
284 | #define WM8350_DC4_ENSLOT_SHIFT 10 | ||
285 | #define WM8350_DC4_SDSLOT_MASK 0x03C0 | ||
286 | #define WM8350_DC4_UVTO_MASK 0x0030 | ||
287 | #define WM8350_DC4_SDSLOT_SHIFT 6 | ||
288 | |||
289 | /* Bit values for R190 (0xBE) */ | ||
290 | #define WM8350_DC4_ERRACT_NONE 0 | ||
291 | #define WM8350_DC4_ERRACT_SHUTDOWN_CONV 1 | ||
292 | #define WM8350_DC4_ERRACT_SHUTDOWN_SYS 2 | ||
293 | |||
294 | /* | ||
295 | * R191 (0xBF) - DCDC4 Low Power | ||
296 | */ | ||
297 | #define WM8350_DC4_HIB_MODE_MASK 0x7000 | ||
298 | #define WM8350_DC4_HIB_TRIG_MASK 0x0300 | ||
299 | #define WM8350_DC4_VIMG_MASK 0x007F | ||
300 | |||
301 | /* | ||
302 | * R192 (0xC0) - DCDC5 Control | ||
303 | */ | ||
304 | #define WM8350_DC5_MODE 0x4000 | ||
305 | #define WM8350_DC5_MODE_MASK 0x4000 | ||
306 | #define WM8350_DC5_MODE_SHIFT 14 | ||
307 | #define WM8350_DC5_HIB_MODE 0x1000 | ||
308 | #define WM8350_DC5_HIB_MODE_MASK 0x1000 | ||
309 | #define WM8350_DC5_HIB_MODE_SHIFT 12 | ||
310 | #define WM8350_DC5_HIB_TRIG_MASK 0x0300 | ||
311 | #define WM8350_DC5_HIB_TRIG_SHIFT 8 | ||
312 | #define WM8350_DC5_ILIM 0x0040 | ||
313 | #define WM8350_DC5_ILIM_MASK 0x0040 | ||
314 | #define WM8350_DC5_ILIM_SHIFT 6 | ||
315 | #define WM8350_DC5_RMP_MASK 0x0018 | ||
316 | #define WM8350_DC5_RMP_SHIFT 3 | ||
317 | #define WM8350_DC5_FBSRC_MASK 0x0003 | ||
318 | #define WM8350_DC5_FBSRC_SHIFT 0 | ||
319 | |||
320 | /* Bit values for R192 (0xC0) */ | ||
321 | #define WM8350_DC5_MODE_BOOST 0 | ||
322 | #define WM8350_DC5_MODE_SWITCH 1 | ||
323 | |||
324 | #define WM8350_DC5_HIB_MODE_ACTIVE 1 | ||
325 | #define WM8350_DC5_HIB_MODE_DISABLE 0 | ||
326 | |||
327 | #define WM8350_DC5_HIB_TRIG_NONE 0 | ||
328 | #define WM8350_DC5_HIB_TRIG_LPWR1 1 | ||
329 | #define WM8350_DC5_HIB_TRIG_LPWR2 2 | ||
330 | #define WM8350_DC5_HIB_TRIG_LPWR3 3 | ||
331 | |||
332 | #define WM8350_DC5_ILIM_HIGH 0 | ||
333 | #define WM8350_DC5_ILIM_LOW 1 | ||
334 | |||
335 | #define WM8350_DC5_RMP_30V 0 | ||
336 | #define WM8350_DC5_RMP_20V 1 | ||
337 | #define WM8350_DC5_RMP_10V 2 | ||
338 | #define WM8350_DC5_RMP_5V 3 | ||
339 | |||
340 | #define WM8350_DC5_FBSRC_FB2 0 | ||
341 | #define WM8350_DC5_FBSRC_ISINKA 1 | ||
342 | #define WM8350_DC5_FBSRC_ISINKB 2 | ||
343 | #define WM8350_DC5_FBSRC_USB 3 | ||
344 | |||
345 | /* | ||
346 | * R193 (0xC1) - DCDC5 Timeouts | ||
347 | */ | ||
348 | #define WM8350_DC5_ERRACT_MASK 0xC000 | ||
349 | #define WM8350_DC5_ERRACT_SHIFT 14 | ||
350 | #define WM8350_DC5_ENSLOT_MASK 0x3C00 | ||
351 | #define WM8350_DC5_ENSLOT_SHIFT 10 | ||
352 | #define WM8350_DC5_SDSLOT_MASK 0x03C0 | ||
353 | #define WM8350_DC5_UVTO_MASK 0x0030 | ||
354 | #define WM8350_DC5_SDSLOT_SHIFT 6 | ||
355 | |||
356 | /* Bit values for R193 (0xC1) */ | ||
357 | #define WM8350_DC5_ERRACT_NONE 0 | ||
358 | #define WM8350_DC5_ERRACT_SHUTDOWN_CONV 1 | ||
359 | #define WM8350_DC5_ERRACT_SHUTDOWN_SYS 2 | ||
360 | |||
361 | /* | ||
362 | * R195 (0xC3) - DCDC6 Control | ||
363 | */ | ||
364 | #define WM8350_DC6_OPFLT 0x0400 | ||
365 | #define WM8350_DC6_VSEL_MASK 0x007F | ||
366 | #define WM8350_DC6_VSEL_SHIFT 0 | ||
367 | |||
368 | /* | ||
369 | * R196 (0xC4) - DCDC6 Timeouts | ||
370 | */ | ||
371 | #define WM8350_DC6_ERRACT_MASK 0xC000 | ||
372 | #define WM8350_DC6_ERRACT_SHIFT 14 | ||
373 | #define WM8350_DC6_ENSLOT_MASK 0x3C00 | ||
374 | #define WM8350_DC6_ENSLOT_SHIFT 10 | ||
375 | #define WM8350_DC6_SDSLOT_MASK 0x03C0 | ||
376 | #define WM8350_DC6_UVTO_MASK 0x0030 | ||
377 | #define WM8350_DC6_SDSLOT_SHIFT 6 | ||
378 | |||
379 | /* Bit values for R196 (0xC4) */ | ||
380 | #define WM8350_DC6_ERRACT_NONE 0 | ||
381 | #define WM8350_DC6_ERRACT_SHUTDOWN_CONV 1 | ||
382 | #define WM8350_DC6_ERRACT_SHUTDOWN_SYS 2 | ||
383 | |||
384 | /* | ||
385 | * R197 (0xC5) - DCDC6 Low Power | ||
386 | */ | ||
387 | #define WM8350_DC6_HIB_MODE_MASK 0x7000 | ||
388 | #define WM8350_DC6_HIB_TRIG_MASK 0x0300 | ||
389 | #define WM8350_DC6_VIMG_MASK 0x007F | ||
390 | |||
391 | /* | ||
392 | * R199 (0xC7) - Limit Switch Control | ||
393 | */ | ||
394 | #define WM8350_LS_ERRACT_MASK 0xC000 | ||
395 | #define WM8350_LS_ERRACT_SHIFT 14 | ||
396 | #define WM8350_LS_ENSLOT_MASK 0x3C00 | ||
397 | #define WM8350_LS_ENSLOT_SHIFT 10 | ||
398 | #define WM8350_LS_SDSLOT_MASK 0x03C0 | ||
399 | #define WM8350_LS_SDSLOT_SHIFT 6 | ||
400 | #define WM8350_LS_HIB_MODE 0x0010 | ||
401 | #define WM8350_LS_HIB_MODE_MASK 0x0010 | ||
402 | #define WM8350_LS_HIB_MODE_SHIFT 4 | ||
403 | #define WM8350_LS_HIB_PROT 0x0002 | ||
404 | #define WM8350_LS_HIB_PROT_MASK 0x0002 | ||
405 | #define WM8350_LS_HIB_PROT_SHIFT 1 | ||
406 | #define WM8350_LS_PROT 0x0001 | ||
407 | #define WM8350_LS_PROT_MASK 0x0001 | ||
408 | #define WM8350_LS_PROT_SHIFT 0 | ||
409 | |||
410 | /* Bit values for R199 (0xC7) */ | ||
411 | #define WM8350_LS_ERRACT_NONE 0 | ||
412 | #define WM8350_LS_ERRACT_SHUTDOWN_CONV 1 | ||
413 | #define WM8350_LS_ERRACT_SHUTDOWN_SYS 2 | ||
414 | |||
415 | /* | ||
416 | * R200 (0xC8) - LDO1 Control | ||
417 | */ | ||
418 | #define WM8350_LDO1_SWI 0x4000 | ||
419 | #define WM8350_LDO1_OPFLT 0x0400 | ||
420 | #define WM8350_LDO1_VSEL_MASK 0x001F | ||
421 | #define WM8350_LDO1_VSEL_SHIFT 0 | ||
422 | |||
423 | /* | ||
424 | * R201 (0xC9) - LDO1 Timeouts | ||
425 | */ | ||
426 | #define WM8350_LDO1_ERRACT_MASK 0xC000 | ||
427 | #define WM8350_LDO1_ERRACT_SHIFT 14 | ||
428 | #define WM8350_LDO1_ENSLOT_MASK 0x3C00 | ||
429 | #define WM8350_LDO1_ENSLOT_SHIFT 10 | ||
430 | #define WM8350_LDO1_SDSLOT_MASK 0x03C0 | ||
431 | #define WM8350_LDO1_UVTO_MASK 0x0030 | ||
432 | #define WM8350_LDO1_SDSLOT_SHIFT 6 | ||
433 | |||
434 | /* Bit values for R201 (0xC9) */ | ||
435 | #define WM8350_LDO1_ERRACT_NONE 0 | ||
436 | #define WM8350_LDO1_ERRACT_SHUTDOWN_CONV 1 | ||
437 | #define WM8350_LDO1_ERRACT_SHUTDOWN_SYS 2 | ||
438 | |||
439 | /* | ||
440 | * R202 (0xCA) - LDO1 Low Power | ||
441 | */ | ||
442 | #define WM8350_LDO1_HIB_MODE_MASK 0x3000 | ||
443 | #define WM8350_LDO1_HIB_TRIG_MASK 0x0300 | ||
444 | #define WM8350_LDO1_VIMG_MASK 0x001F | ||
445 | #define WM8350_LDO1_HIB_MODE_DIS (0x1 << 12) | ||
446 | |||
447 | |||
448 | /* | ||
449 | * R203 (0xCB) - LDO2 Control | ||
450 | */ | ||
451 | #define WM8350_LDO2_SWI 0x4000 | ||
452 | #define WM8350_LDO2_OPFLT 0x0400 | ||
453 | #define WM8350_LDO2_VSEL_MASK 0x001F | ||
454 | #define WM8350_LDO2_VSEL_SHIFT 0 | ||
455 | |||
456 | /* | ||
457 | * R204 (0xCC) - LDO2 Timeouts | ||
458 | */ | ||
459 | #define WM8350_LDO2_ERRACT_MASK 0xC000 | ||
460 | #define WM8350_LDO2_ERRACT_SHIFT 14 | ||
461 | #define WM8350_LDO2_ENSLOT_MASK 0x3C00 | ||
462 | #define WM8350_LDO2_ENSLOT_SHIFT 10 | ||
463 | #define WM8350_LDO2_SDSLOT_MASK 0x03C0 | ||
464 | #define WM8350_LDO2_SDSLOT_SHIFT 6 | ||
465 | |||
466 | /* Bit values for R204 (0xCC) */ | ||
467 | #define WM8350_LDO2_ERRACT_NONE 0 | ||
468 | #define WM8350_LDO2_ERRACT_SHUTDOWN_CONV 1 | ||
469 | #define WM8350_LDO2_ERRACT_SHUTDOWN_SYS 2 | ||
470 | |||
471 | /* | ||
472 | * R205 (0xCD) - LDO2 Low Power | ||
473 | */ | ||
474 | #define WM8350_LDO2_HIB_MODE_MASK 0x3000 | ||
475 | #define WM8350_LDO2_HIB_TRIG_MASK 0x0300 | ||
476 | #define WM8350_LDO2_VIMG_MASK 0x001F | ||
477 | |||
478 | /* | ||
479 | * R206 (0xCE) - LDO3 Control | ||
480 | */ | ||
481 | #define WM8350_LDO3_SWI 0x4000 | ||
482 | #define WM8350_LDO3_OPFLT 0x0400 | ||
483 | #define WM8350_LDO3_VSEL_MASK 0x001F | ||
484 | #define WM8350_LDO3_VSEL_SHIFT 0 | ||
485 | |||
486 | /* | ||
487 | * R207 (0xCF) - LDO3 Timeouts | ||
488 | */ | ||
489 | #define WM8350_LDO3_ERRACT_MASK 0xC000 | ||
490 | #define WM8350_LDO3_ERRACT_SHIFT 14 | ||
491 | #define WM8350_LDO3_ENSLOT_MASK 0x3C00 | ||
492 | #define WM8350_LDO3_ENSLOT_SHIFT 10 | ||
493 | #define WM8350_LDO3_SDSLOT_MASK 0x03C0 | ||
494 | #define WM8350_LDO3_UVTO_MASK 0x0030 | ||
495 | #define WM8350_LDO3_SDSLOT_SHIFT 6 | ||
496 | |||
497 | /* Bit values for R207 (0xCF) */ | ||
498 | #define WM8350_LDO3_ERRACT_NONE 0 | ||
499 | #define WM8350_LDO3_ERRACT_SHUTDOWN_CONV 1 | ||
500 | #define WM8350_LDO3_ERRACT_SHUTDOWN_SYS 2 | ||
501 | |||
502 | /* | ||
503 | * R208 (0xD0) - LDO3 Low Power | ||
504 | */ | ||
505 | #define WM8350_LDO3_HIB_MODE_MASK 0x3000 | ||
506 | #define WM8350_LDO3_HIB_TRIG_MASK 0x0300 | ||
507 | #define WM8350_LDO3_VIMG_MASK 0x001F | ||
508 | |||
509 | /* | ||
510 | * R209 (0xD1) - LDO4 Control | ||
511 | */ | ||
512 | #define WM8350_LDO4_SWI 0x4000 | ||
513 | #define WM8350_LDO4_OPFLT 0x0400 | ||
514 | #define WM8350_LDO4_VSEL_MASK 0x001F | ||
515 | #define WM8350_LDO4_VSEL_SHIFT 0 | ||
516 | |||
517 | /* | ||
518 | * R210 (0xD2) - LDO4 Timeouts | ||
519 | */ | ||
520 | #define WM8350_LDO4_ERRACT_MASK 0xC000 | ||
521 | #define WM8350_LDO4_ERRACT_SHIFT 14 | ||
522 | #define WM8350_LDO4_ENSLOT_MASK 0x3C00 | ||
523 | #define WM8350_LDO4_ENSLOT_SHIFT 10 | ||
524 | #define WM8350_LDO4_SDSLOT_MASK 0x03C0 | ||
525 | #define WM8350_LDO4_UVTO_MASK 0x0030 | ||
526 | #define WM8350_LDO4_SDSLOT_SHIFT 6 | ||
527 | |||
528 | /* Bit values for R210 (0xD2) */ | ||
529 | #define WM8350_LDO4_ERRACT_NONE 0 | ||
530 | #define WM8350_LDO4_ERRACT_SHUTDOWN_CONV 1 | ||
531 | #define WM8350_LDO4_ERRACT_SHUTDOWN_SYS 2 | ||
532 | |||
533 | /* | ||
534 | * R211 (0xD3) - LDO4 Low Power | ||
535 | */ | ||
536 | #define WM8350_LDO4_HIB_MODE_MASK 0x3000 | ||
537 | #define WM8350_LDO4_HIB_TRIG_MASK 0x0300 | ||
538 | #define WM8350_LDO4_VIMG_MASK 0x001F | ||
539 | |||
540 | /* | ||
541 | * R215 (0xD7) - VCC_FAULT Masks | ||
542 | */ | ||
543 | #define WM8350_LS_FAULT 0x8000 | ||
544 | #define WM8350_LDO4_FAULT 0x0800 | ||
545 | #define WM8350_LDO3_FAULT 0x0400 | ||
546 | #define WM8350_LDO2_FAULT 0x0200 | ||
547 | #define WM8350_LDO1_FAULT 0x0100 | ||
548 | #define WM8350_DC6_FAULT 0x0020 | ||
549 | #define WM8350_DC5_FAULT 0x0010 | ||
550 | #define WM8350_DC4_FAULT 0x0008 | ||
551 | #define WM8350_DC3_FAULT 0x0004 | ||
552 | #define WM8350_DC2_FAULT 0x0002 | ||
553 | #define WM8350_DC1_FAULT 0x0001 | ||
554 | |||
555 | /* | ||
556 | * R216 (0xD8) - Main Bandgap Control | ||
557 | */ | ||
558 | #define WM8350_MBG_LOAD_FUSES 0x8000 | ||
559 | #define WM8350_MBG_FUSE_WPREP 0x4000 | ||
560 | #define WM8350_MBG_FUSE_WRITE 0x2000 | ||
561 | #define WM8350_MBG_FUSE_TRIM_MASK 0x1F00 | ||
562 | #define WM8350_MBG_TRIM_SRC 0x0020 | ||
563 | #define WM8350_MBG_USER_TRIM_MASK 0x001F | ||
564 | |||
565 | /* | ||
566 | * R217 (0xD9) - OSC Control | ||
567 | */ | ||
568 | #define WM8350_OSC_LOAD_FUSES 0x8000 | ||
569 | #define WM8350_OSC_FUSE_WPREP 0x4000 | ||
570 | #define WM8350_OSC_FUSE_WRITE 0x2000 | ||
571 | #define WM8350_OSC_FUSE_TRIM_MASK 0x0F00 | ||
572 | #define WM8350_OSC_TRIM_SRC 0x0020 | ||
573 | #define WM8350_OSC_USER_TRIM_MASK 0x000F | ||
574 | |||
575 | /* | ||
576 | * R248 (0xF8) - DCDC1 Force PWM | ||
577 | */ | ||
578 | #define WM8350_DCDC1_FORCE_PWM_ENA 0x0010 | ||
579 | |||
580 | /* | ||
581 | * R250 (0xFA) - DCDC3 Force PWM | ||
582 | */ | ||
583 | #define WM8350_DCDC3_FORCE_PWM_ENA 0x0010 | ||
584 | |||
585 | /* | ||
586 | * R251 (0xFB) - DCDC4 Force PWM | ||
587 | */ | ||
588 | #define WM8350_DCDC4_FORCE_PWM_ENA 0x0010 | ||
589 | |||
590 | /* | ||
591 | * R253 (0xFD) - DCDC1 Force PWM | ||
592 | */ | ||
593 | #define WM8350_DCDC6_FORCE_PWM_ENA 0x0010 | ||
594 | |||
595 | /* | ||
596 | * DCDC's | ||
597 | */ | ||
598 | #define WM8350_DCDC_1 0 | ||
599 | #define WM8350_DCDC_2 1 | ||
600 | #define WM8350_DCDC_3 2 | ||
601 | #define WM8350_DCDC_4 3 | ||
602 | #define WM8350_DCDC_5 4 | ||
603 | #define WM8350_DCDC_6 5 | ||
604 | |||
605 | /* DCDC modes */ | ||
606 | #define WM8350_DCDC_ACTIVE_STANDBY 0 | ||
607 | #define WM8350_DCDC_ACTIVE_PULSE 1 | ||
608 | #define WM8350_DCDC_SLEEP_NORMAL 0 | ||
609 | #define WM8350_DCDC_SLEEP_LOW 1 | ||
610 | |||
611 | /* DCDC Low power (Hibernate) mode */ | ||
612 | #define WM8350_DCDC_HIB_MODE_CUR (0 << 12) | ||
613 | #define WM8350_DCDC_HIB_MODE_IMAGE (1 << 12) | ||
614 | #define WM8350_DCDC_HIB_MODE_STANDBY (2 << 12) | ||
615 | #define WM8350_DCDC_HIB_MODE_LDO (4 << 12) | ||
616 | #define WM8350_DCDC_HIB_MODE_LDO_IM (5 << 12) | ||
617 | #define WM8350_DCDC_HIB_MODE_DIS (7 << 12) | ||
618 | #define WM8350_DCDC_HIB_MODE_MASK (7 << 12) | ||
619 | |||
620 | /* DCDC Low Power (Hibernate) signal */ | ||
621 | #define WM8350_DCDC_HIB_SIG_REG (0 << 8) | ||
622 | #define WM8350_DCDC_HIB_SIG_LPWR1 (1 << 8) | ||
623 | #define WM8350_DCDC_HIB_SIG_LPWR2 (2 << 8) | ||
624 | #define WM8350_DCDC_HIB_SIG_LPWR3 (3 << 8) | ||
625 | |||
626 | /* LDO Low power (Hibernate) mode */ | ||
627 | #define WM8350_LDO_HIB_MODE_IMAGE (0 << 0) | ||
628 | #define WM8350_LDO_HIB_MODE_DIS (1 << 0) | ||
629 | |||
630 | /* LDO Low Power (Hibernate) signal */ | ||
631 | #define WM8350_LDO_HIB_SIG_REG (0 << 8) | ||
632 | #define WM8350_LDO_HIB_SIG_LPWR1 (1 << 8) | ||
633 | #define WM8350_LDO_HIB_SIG_LPWR2 (2 << 8) | ||
634 | #define WM8350_LDO_HIB_SIG_LPWR3 (3 << 8) | ||
635 | |||
636 | /* | ||
637 | * LDOs | ||
638 | */ | ||
639 | #define WM8350_LDO_1 6 | ||
640 | #define WM8350_LDO_2 7 | ||
641 | #define WM8350_LDO_3 8 | ||
642 | #define WM8350_LDO_4 9 | ||
643 | |||
644 | /* | ||
645 | * ISINKs | ||
646 | */ | ||
647 | #define WM8350_ISINK_A 10 | ||
648 | #define WM8350_ISINK_B 11 | ||
649 | |||
650 | #define WM8350_ISINK_MODE_BOOST 0 | ||
651 | #define WM8350_ISINK_MODE_SWITCH 1 | ||
652 | #define WM8350_ISINK_ILIM_NORMAL 0 | ||
653 | #define WM8350_ISINK_ILIM_LOW 1 | ||
654 | |||
655 | #define WM8350_ISINK_FLASH_DISABLE 0 | ||
656 | #define WM8350_ISINK_FLASH_ENABLE 1 | ||
657 | #define WM8350_ISINK_FLASH_TRIG_BIT 0 | ||
658 | #define WM8350_ISINK_FLASH_TRIG_GPIO 1 | ||
659 | #define WM8350_ISINK_FLASH_MODE_EN (1 << 13) | ||
660 | #define WM8350_ISINK_FLASH_MODE_DIS (0 << 13) | ||
661 | #define WM8350_ISINK_FLASH_DUR_32MS (0 << 8) | ||
662 | #define WM8350_ISINK_FLASH_DUR_64MS (1 << 8) | ||
663 | #define WM8350_ISINK_FLASH_DUR_96MS (2 << 8) | ||
664 | #define WM8350_ISINK_FLASH_DUR_1024MS (3 << 8) | ||
665 | #define WM8350_ISINK_FLASH_ON_INSTANT (0 << 4) | ||
666 | #define WM8350_ISINK_FLASH_ON_0_25S (1 << 4) | ||
667 | #define WM8350_ISINK_FLASH_ON_0_50S (2 << 4) | ||
668 | #define WM8350_ISINK_FLASH_ON_1_00S (3 << 4) | ||
669 | #define WM8350_ISINK_FLASH_ON_1_95S (1 << 4) | ||
670 | #define WM8350_ISINK_FLASH_ON_3_91S (2 << 4) | ||
671 | #define WM8350_ISINK_FLASH_ON_7_80S (3 << 4) | ||
672 | #define WM8350_ISINK_FLASH_OFF_INSTANT (0 << 0) | ||
673 | #define WM8350_ISINK_FLASH_OFF_0_25S (1 << 0) | ||
674 | #define WM8350_ISINK_FLASH_OFF_0_50S (2 << 0) | ||
675 | #define WM8350_ISINK_FLASH_OFF_1_00S (3 << 0) | ||
676 | #define WM8350_ISINK_FLASH_OFF_1_95S (1 << 0) | ||
677 | #define WM8350_ISINK_FLASH_OFF_3_91S (2 << 0) | ||
678 | #define WM8350_ISINK_FLASH_OFF_7_80S (3 << 0) | ||
679 | |||
680 | /* | ||
681 | * Regulator Interrupts. | ||
682 | */ | ||
683 | #define WM8350_IRQ_CS1 13 | ||
684 | #define WM8350_IRQ_CS2 14 | ||
685 | #define WM8350_IRQ_UV_LDO4 25 | ||
686 | #define WM8350_IRQ_UV_LDO3 26 | ||
687 | #define WM8350_IRQ_UV_LDO2 27 | ||
688 | #define WM8350_IRQ_UV_LDO1 28 | ||
689 | #define WM8350_IRQ_UV_DC6 29 | ||
690 | #define WM8350_IRQ_UV_DC5 30 | ||
691 | #define WM8350_IRQ_UV_DC4 31 | ||
692 | #define WM8350_IRQ_UV_DC3 32 | ||
693 | #define WM8350_IRQ_UV_DC2 33 | ||
694 | #define WM8350_IRQ_UV_DC1 34 | ||
695 | #define WM8350_IRQ_OC_LS 35 | ||
696 | |||
697 | #define NUM_WM8350_REGULATORS 12 | ||
698 | |||
699 | struct wm8350; | ||
700 | struct platform_device; | ||
701 | struct regulator_init_data; | ||
702 | |||
703 | struct wm8350_pmic { | ||
704 | /* ISINK to DCDC mapping */ | ||
705 | int isink_A_dcdc; | ||
706 | int isink_B_dcdc; | ||
707 | |||
708 | /* hibernate configs */ | ||
709 | u16 dcdc1_hib_mode; | ||
710 | u16 dcdc3_hib_mode; | ||
711 | u16 dcdc4_hib_mode; | ||
712 | u16 dcdc6_hib_mode; | ||
713 | |||
714 | /* regulator devices */ | ||
715 | struct platform_device *pdev[NUM_WM8350_REGULATORS]; | ||
716 | }; | ||
717 | |||
718 | int wm8350_register_regulator(struct wm8350 *wm8350, int reg, | ||
719 | struct regulator_init_data *initdata); | ||
720 | |||
721 | /* | ||
722 | * Additional DCDC control not supported via regulator API | ||
723 | */ | ||
724 | int wm8350_dcdc_set_slot(struct wm8350 *wm8350, int dcdc, u16 start, | ||
725 | u16 stop, u16 fault); | ||
726 | int wm8350_dcdc25_set_mode(struct wm8350 *wm8350, int dcdc, u16 mode, | ||
727 | u16 ilim, u16 ramp, u16 feedback); | ||
728 | |||
729 | /* | ||
730 | * Additional LDO control not supported via regulator API | ||
731 | */ | ||
732 | int wm8350_ldo_set_slot(struct wm8350 *wm8350, int ldo, u16 start, u16 stop); | ||
733 | |||
734 | /* | ||
735 | * Additional ISINK control not supported via regulator API | ||
736 | */ | ||
737 | int wm8350_isink_set_flash(struct wm8350 *wm8350, int isink, u16 mode, | ||
738 | u16 trigger, u16 duration, u16 on_ramp, | ||
739 | u16 off_ramp, u16 drive); | ||
740 | |||
741 | #endif | ||
diff --git a/include/linux/mfd/wm8350/rtc.h b/include/linux/mfd/wm8350/rtc.h new file mode 100644 index 000000000000..24add2bef6c9 --- /dev/null +++ b/include/linux/mfd/wm8350/rtc.h | |||
@@ -0,0 +1,268 @@ | |||
1 | /* | ||
2 | * rtc.h -- RTC driver for Wolfson WM8350 PMIC | ||
3 | * | ||
4 | * Copyright 2007 Wolfson Microelectronics PLC | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef __LINUX_MFD_WM8350_RTC_H | ||
13 | #define __LINUX_MFD_WM8350_RTC_H | ||
14 | |||
15 | #include <linux/platform_device.h> | ||
16 | |||
17 | /* | ||
18 | * Register values. | ||
19 | */ | ||
20 | #define WM8350_RTC_SECONDS_MINUTES 0x10 | ||
21 | #define WM8350_RTC_HOURS_DAY 0x11 | ||
22 | #define WM8350_RTC_DATE_MONTH 0x12 | ||
23 | #define WM8350_RTC_YEAR 0x13 | ||
24 | #define WM8350_ALARM_SECONDS_MINUTES 0x14 | ||
25 | #define WM8350_ALARM_HOURS_DAY 0x15 | ||
26 | #define WM8350_ALARM_DATE_MONTH 0x16 | ||
27 | #define WM8350_RTC_TIME_CONTROL 0x17 | ||
28 | |||
29 | /* | ||
30 | * R16 (0x10) - RTC Seconds/Minutes | ||
31 | */ | ||
32 | #define WM8350_RTC_MINS_MASK 0x7F00 | ||
33 | #define WM8350_RTC_MINS_SHIFT 8 | ||
34 | #define WM8350_RTC_SECS_MASK 0x007F | ||
35 | #define WM8350_RTC_SECS_SHIFT 0 | ||
36 | |||
37 | /* | ||
38 | * R17 (0x11) - RTC Hours/Day | ||
39 | */ | ||
40 | #define WM8350_RTC_DAY_MASK 0x0700 | ||
41 | #define WM8350_RTC_DAY_SHIFT 8 | ||
42 | #define WM8350_RTC_HPM_MASK 0x0020 | ||
43 | #define WM8350_RTC_HPM_SHIFT 5 | ||
44 | #define WM8350_RTC_HRS_MASK 0x001F | ||
45 | #define WM8350_RTC_HRS_SHIFT 0 | ||
46 | |||
47 | /* Bit values for R21 (0x15) */ | ||
48 | #define WM8350_RTC_DAY_SUN 1 | ||
49 | #define WM8350_RTC_DAY_MON 2 | ||
50 | #define WM8350_RTC_DAY_TUE 3 | ||
51 | #define WM8350_RTC_DAY_WED 4 | ||
52 | #define WM8350_RTC_DAY_THU 5 | ||
53 | #define WM8350_RTC_DAY_FRI 6 | ||
54 | #define WM8350_RTC_DAY_SAT 7 | ||
55 | |||
56 | #define WM8350_RTC_HPM_AM 0 | ||
57 | #define WM8350_RTC_HPM_PM 1 | ||
58 | |||
59 | /* | ||
60 | * R18 (0x12) - RTC Date/Month | ||
61 | */ | ||
62 | #define WM8350_RTC_MTH_MASK 0x1F00 | ||
63 | #define WM8350_RTC_MTH_SHIFT 8 | ||
64 | #define WM8350_RTC_DATE_MASK 0x003F | ||
65 | #define WM8350_RTC_DATE_SHIFT 0 | ||
66 | |||
67 | /* Bit values for R22 (0x16) */ | ||
68 | #define WM8350_RTC_MTH_JAN 1 | ||
69 | #define WM8350_RTC_MTH_FEB 2 | ||
70 | #define WM8350_RTC_MTH_MAR 3 | ||
71 | #define WM8350_RTC_MTH_APR 4 | ||
72 | #define WM8350_RTC_MTH_MAY 5 | ||
73 | #define WM8350_RTC_MTH_JUN 6 | ||
74 | #define WM8350_RTC_MTH_JUL 7 | ||
75 | #define WM8350_RTC_MTH_AUG 8 | ||
76 | #define WM8350_RTC_MTH_SEP 9 | ||
77 | #define WM8350_RTC_MTH_OCT 10 | ||
78 | #define WM8350_RTC_MTH_NOV 11 | ||
79 | #define WM8350_RTC_MTH_DEC 12 | ||
80 | #define WM8350_RTC_MTH_JAN_BCD 0x01 | ||
81 | #define WM8350_RTC_MTH_FEB_BCD 0x02 | ||
82 | #define WM8350_RTC_MTH_MAR_BCD 0x03 | ||
83 | #define WM8350_RTC_MTH_APR_BCD 0x04 | ||
84 | #define WM8350_RTC_MTH_MAY_BCD 0x05 | ||
85 | #define WM8350_RTC_MTH_JUN_BCD 0x06 | ||
86 | #define WM8350_RTC_MTH_JUL_BCD 0x07 | ||
87 | #define WM8350_RTC_MTH_AUG_BCD 0x08 | ||
88 | #define WM8350_RTC_MTH_SEP_BCD 0x09 | ||
89 | #define WM8350_RTC_MTH_OCT_BCD 0x10 | ||
90 | #define WM8350_RTC_MTH_NOV_BCD 0x11 | ||
91 | #define WM8350_RTC_MTH_DEC_BCD 0x12 | ||
92 | |||
93 | /* | ||
94 | * R19 (0x13) - RTC Year | ||
95 | */ | ||
96 | #define WM8350_RTC_YHUNDREDS_MASK 0x3F00 | ||
97 | #define WM8350_RTC_YHUNDREDS_SHIFT 8 | ||
98 | #define WM8350_RTC_YUNITS_MASK 0x00FF | ||
99 | #define WM8350_RTC_YUNITS_SHIFT 0 | ||
100 | |||
101 | /* | ||
102 | * R20 (0x14) - Alarm Seconds/Minutes | ||
103 | */ | ||
104 | #define WM8350_RTC_ALMMINS_MASK 0x7F00 | ||
105 | #define WM8350_RTC_ALMMINS_SHIFT 8 | ||
106 | #define WM8350_RTC_ALMSECS_MASK 0x007F | ||
107 | #define WM8350_RTC_ALMSECS_SHIFT 0 | ||
108 | |||
109 | /* Bit values for R20 (0x14) */ | ||
110 | #define WM8350_RTC_ALMMINS_DONT_CARE -1 | ||
111 | #define WM8350_RTC_ALMSECS_DONT_CARE -1 | ||
112 | |||
113 | /* | ||
114 | * R21 (0x15) - Alarm Hours/Day | ||
115 | */ | ||
116 | #define WM8350_RTC_ALMDAY_MASK 0x0F00 | ||
117 | #define WM8350_RTC_ALMDAY_SHIFT 8 | ||
118 | #define WM8350_RTC_ALMHPM_MASK 0x0020 | ||
119 | #define WM8350_RTC_ALMHPM_SHIFT 5 | ||
120 | #define WM8350_RTC_ALMHRS_MASK 0x001F | ||
121 | #define WM8350_RTC_ALMHRS_SHIFT 0 | ||
122 | |||
123 | /* Bit values for R21 (0x15) */ | ||
124 | #define WM8350_RTC_ALMDAY_DONT_CARE -1 | ||
125 | #define WM8350_RTC_ALMDAY_SUN 1 | ||
126 | #define WM8350_RTC_ALMDAY_MON 2 | ||
127 | #define WM8350_RTC_ALMDAY_TUE 3 | ||
128 | #define WM8350_RTC_ALMDAY_WED 4 | ||
129 | #define WM8350_RTC_ALMDAY_THU 5 | ||
130 | #define WM8350_RTC_ALMDAY_FRI 6 | ||
131 | #define WM8350_RTC_ALMDAY_SAT 7 | ||
132 | |||
133 | #define WM8350_RTC_ALMHPM_AM 0 | ||
134 | #define WM8350_RTC_ALMHPM_PM 1 | ||
135 | |||
136 | #define WM8350_RTC_ALMHRS_DONT_CARE -1 | ||
137 | |||
138 | /* | ||
139 | * R22 (0x16) - Alarm Date/Month | ||
140 | */ | ||
141 | #define WM8350_RTC_ALMMTH_MASK 0x1F00 | ||
142 | #define WM8350_RTC_ALMMTH_SHIFT 8 | ||
143 | #define WM8350_RTC_ALMDATE_MASK 0x003F | ||
144 | #define WM8350_RTC_ALMDATE_SHIFT 0 | ||
145 | |||
146 | /* Bit values for R22 (0x16) */ | ||
147 | #define WM8350_RTC_ALMDATE_DONT_CARE -1 | ||
148 | |||
149 | #define WM8350_RTC_ALMMTH_DONT_CARE -1 | ||
150 | #define WM8350_RTC_ALMMTH_JAN 1 | ||
151 | #define WM8350_RTC_ALMMTH_FEB 2 | ||
152 | #define WM8350_RTC_ALMMTH_MAR 3 | ||
153 | #define WM8350_RTC_ALMMTH_APR 4 | ||
154 | #define WM8350_RTC_ALMMTH_MAY 5 | ||
155 | #define WM8350_RTC_ALMMTH_JUN 6 | ||
156 | #define WM8350_RTC_ALMMTH_JUL 7 | ||
157 | #define WM8350_RTC_ALMMTH_AUG 8 | ||
158 | #define WM8350_RTC_ALMMTH_SEP 9 | ||
159 | #define WM8350_RTC_ALMMTH_OCT 10 | ||
160 | #define WM8350_RTC_ALMMTH_NOV 11 | ||
161 | #define WM8350_RTC_ALMMTH_DEC 12 | ||
162 | #define WM8350_RTC_ALMMTH_JAN_BCD 0x01 | ||
163 | #define WM8350_RTC_ALMMTH_FEB_BCD 0x02 | ||
164 | #define WM8350_RTC_ALMMTH_MAR_BCD 0x03 | ||
165 | #define WM8350_RTC_ALMMTH_APR_BCD 0x04 | ||
166 | #define WM8350_RTC_ALMMTH_MAY_BCD 0x05 | ||
167 | #define WM8350_RTC_ALMMTH_JUN_BCD 0x06 | ||
168 | #define WM8350_RTC_ALMMTH_JUL_BCD 0x07 | ||
169 | #define WM8350_RTC_ALMMTH_AUG_BCD 0x08 | ||
170 | #define WM8350_RTC_ALMMTH_SEP_BCD 0x09 | ||
171 | #define WM8350_RTC_ALMMTH_OCT_BCD 0x10 | ||
172 | #define WM8350_RTC_ALMMTH_NOV_BCD 0x11 | ||
173 | #define WM8350_RTC_ALMMTH_DEC_BCD 0x12 | ||
174 | |||
175 | /* | ||
176 | * R23 (0x17) - RTC Time Control | ||
177 | */ | ||
178 | #define WM8350_RTC_BCD 0x8000 | ||
179 | #define WM8350_RTC_BCD_MASK 0x8000 | ||
180 | #define WM8350_RTC_BCD_SHIFT 15 | ||
181 | #define WM8350_RTC_12HR 0x4000 | ||
182 | #define WM8350_RTC_12HR_MASK 0x4000 | ||
183 | #define WM8350_RTC_12HR_SHIFT 14 | ||
184 | #define WM8350_RTC_DST 0x2000 | ||
185 | #define WM8350_RTC_DST_MASK 0x2000 | ||
186 | #define WM8350_RTC_DST_SHIFT 13 | ||
187 | #define WM8350_RTC_SET 0x0800 | ||
188 | #define WM8350_RTC_SET_MASK 0x0800 | ||
189 | #define WM8350_RTC_SET_SHIFT 11 | ||
190 | #define WM8350_RTC_STS 0x0400 | ||
191 | #define WM8350_RTC_STS_MASK 0x0400 | ||
192 | #define WM8350_RTC_STS_SHIFT 10 | ||
193 | #define WM8350_RTC_ALMSET 0x0200 | ||
194 | #define WM8350_RTC_ALMSET_MASK 0x0200 | ||
195 | #define WM8350_RTC_ALMSET_SHIFT 9 | ||
196 | #define WM8350_RTC_ALMSTS 0x0100 | ||
197 | #define WM8350_RTC_ALMSTS_MASK 0x0100 | ||
198 | #define WM8350_RTC_ALMSTS_SHIFT 8 | ||
199 | #define WM8350_RTC_PINT 0x0070 | ||
200 | #define WM8350_RTC_PINT_MASK 0x0070 | ||
201 | #define WM8350_RTC_PINT_SHIFT 4 | ||
202 | #define WM8350_RTC_DSW 0x000F | ||
203 | #define WM8350_RTC_DSW_MASK 0x000F | ||
204 | #define WM8350_RTC_DSW_SHIFT 0 | ||
205 | |||
206 | /* Bit values for R23 (0x17) */ | ||
207 | #define WM8350_RTC_BCD_BINARY 0 | ||
208 | #define WM8350_RTC_BCD_BCD 1 | ||
209 | |||
210 | #define WM8350_RTC_12HR_24HR 0 | ||
211 | #define WM8350_RTC_12HR_12HR 1 | ||
212 | |||
213 | #define WM8350_RTC_DST_DISABLED 0 | ||
214 | #define WM8350_RTC_DST_ENABLED 1 | ||
215 | |||
216 | #define WM8350_RTC_SET_RUN 0 | ||
217 | #define WM8350_RTC_SET_SET 1 | ||
218 | |||
219 | #define WM8350_RTC_STS_RUNNING 0 | ||
220 | #define WM8350_RTC_STS_STOPPED 1 | ||
221 | |||
222 | #define WM8350_RTC_ALMSET_RUN 0 | ||
223 | #define WM8350_RTC_ALMSET_SET 1 | ||
224 | |||
225 | #define WM8350_RTC_ALMSTS_RUNNING 0 | ||
226 | #define WM8350_RTC_ALMSTS_STOPPED 1 | ||
227 | |||
228 | #define WM8350_RTC_PINT_DISABLED 0 | ||
229 | #define WM8350_RTC_PINT_SECS 1 | ||
230 | #define WM8350_RTC_PINT_MINS 2 | ||
231 | #define WM8350_RTC_PINT_HRS 3 | ||
232 | #define WM8350_RTC_PINT_DAYS 4 | ||
233 | #define WM8350_RTC_PINT_MTHS 5 | ||
234 | |||
235 | #define WM8350_RTC_DSW_DISABLED 0 | ||
236 | #define WM8350_RTC_DSW_1HZ 1 | ||
237 | #define WM8350_RTC_DSW_2HZ 2 | ||
238 | #define WM8350_RTC_DSW_4HZ 3 | ||
239 | #define WM8350_RTC_DSW_8HZ 4 | ||
240 | #define WM8350_RTC_DSW_16HZ 5 | ||
241 | #define WM8350_RTC_DSW_32HZ 6 | ||
242 | #define WM8350_RTC_DSW_64HZ 7 | ||
243 | #define WM8350_RTC_DSW_128HZ 8 | ||
244 | #define WM8350_RTC_DSW_256HZ 9 | ||
245 | #define WM8350_RTC_DSW_512HZ 10 | ||
246 | #define WM8350_RTC_DSW_1024HZ 11 | ||
247 | |||
248 | /* | ||
249 | * R218 (0xDA) - RTC Tick Control | ||
250 | */ | ||
251 | #define WM8350_RTC_TICKSTS 0x4000 | ||
252 | #define WM8350_RTC_CLKSRC 0x2000 | ||
253 | #define WM8350_RTC_TRIM_MASK 0x03FF | ||
254 | |||
255 | /* | ||
256 | * RTC Interrupts. | ||
257 | */ | ||
258 | #define WM8350_IRQ_RTC_PER 7 | ||
259 | #define WM8350_IRQ_RTC_SEC 8 | ||
260 | #define WM8350_IRQ_RTC_ALM 9 | ||
261 | |||
262 | struct wm8350_rtc { | ||
263 | struct platform_device *pdev; | ||
264 | struct rtc_device *rtc; | ||
265 | int alarm_enabled; /* used over suspend/resume */ | ||
266 | }; | ||
267 | |||
268 | #endif | ||
diff --git a/include/linux/mfd/wm8350/supply.h b/include/linux/mfd/wm8350/supply.h new file mode 100644 index 000000000000..1c8f3cde79b0 --- /dev/null +++ b/include/linux/mfd/wm8350/supply.h | |||
@@ -0,0 +1,111 @@ | |||
1 | /* | ||
2 | * supply.h -- Power Supply Driver for Wolfson WM8350 PMIC | ||
3 | * | ||
4 | * Copyright 2007 Wolfson Microelectronics PLC | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_MFD_WM8350_SUPPLY_H_ | ||
14 | #define __LINUX_MFD_WM8350_SUPPLY_H_ | ||
15 | |||
16 | #include <linux/platform_device.h> | ||
17 | |||
18 | /* | ||
19 | * Charger registers | ||
20 | */ | ||
21 | #define WM8350_BATTERY_CHARGER_CONTROL_1 0xA8 | ||
22 | #define WM8350_BATTERY_CHARGER_CONTROL_2 0xA9 | ||
23 | #define WM8350_BATTERY_CHARGER_CONTROL_3 0xAA | ||
24 | |||
25 | /* | ||
26 | * R168 (0xA8) - Battery Charger Control 1 | ||
27 | */ | ||
28 | #define WM8350_CHG_ENA_R168 0x8000 | ||
29 | #define WM8350_CHG_THR 0x2000 | ||
30 | #define WM8350_CHG_EOC_SEL_MASK 0x1C00 | ||
31 | #define WM8350_CHG_TRICKLE_TEMP_CHOKE 0x0200 | ||
32 | #define WM8350_CHG_TRICKLE_USB_CHOKE 0x0100 | ||
33 | #define WM8350_CHG_RECOVER_T 0x0080 | ||
34 | #define WM8350_CHG_END_ACT 0x0040 | ||
35 | #define WM8350_CHG_FAST 0x0020 | ||
36 | #define WM8350_CHG_FAST_USB_THROTTLE 0x0010 | ||
37 | #define WM8350_CHG_NTC_MON 0x0008 | ||
38 | #define WM8350_CHG_BATT_HOT_MON 0x0004 | ||
39 | #define WM8350_CHG_BATT_COLD_MON 0x0002 | ||
40 | #define WM8350_CHG_CHIP_TEMP_MON 0x0001 | ||
41 | |||
42 | /* | ||
43 | * R169 (0xA9) - Battery Charger Control 2 | ||
44 | */ | ||
45 | #define WM8350_CHG_ACTIVE 0x8000 | ||
46 | #define WM8350_CHG_PAUSE 0x4000 | ||
47 | #define WM8350_CHG_STS_MASK 0x3000 | ||
48 | #define WM8350_CHG_TIME_MASK 0x0F00 | ||
49 | #define WM8350_CHG_MASK_WALL_FB 0x0080 | ||
50 | #define WM8350_CHG_TRICKLE_SEL 0x0040 | ||
51 | #define WM8350_CHG_VSEL_MASK 0x0030 | ||
52 | #define WM8350_CHG_ISEL_MASK 0x000F | ||
53 | #define WM8350_CHG_STS_OFF 0x0000 | ||
54 | #define WM8350_CHG_STS_TRICKLE 0x1000 | ||
55 | #define WM8350_CHG_STS_FAST 0x2000 | ||
56 | |||
57 | /* | ||
58 | * R170 (0xAA) - Battery Charger Control 3 | ||
59 | */ | ||
60 | #define WM8350_CHG_THROTTLE_T_MASK 0x0060 | ||
61 | #define WM8350_CHG_SMART 0x0010 | ||
62 | #define WM8350_CHG_TIMER_ADJT_MASK 0x000F | ||
63 | |||
64 | /* | ||
65 | * Charger Interrupts | ||
66 | */ | ||
67 | #define WM8350_IRQ_CHG_BAT_HOT 0 | ||
68 | #define WM8350_IRQ_CHG_BAT_COLD 1 | ||
69 | #define WM8350_IRQ_CHG_BAT_FAIL 2 | ||
70 | #define WM8350_IRQ_CHG_TO 3 | ||
71 | #define WM8350_IRQ_CHG_END 4 | ||
72 | #define WM8350_IRQ_CHG_START 5 | ||
73 | #define WM8350_IRQ_CHG_FAST_RDY 6 | ||
74 | #define WM8350_IRQ_CHG_VBATT_LT_3P9 10 | ||
75 | #define WM8350_IRQ_CHG_VBATT_LT_3P1 11 | ||
76 | #define WM8350_IRQ_CHG_VBATT_LT_2P85 12 | ||
77 | |||
78 | /* | ||
79 | * Charger Policy | ||
80 | */ | ||
81 | #define WM8350_CHG_TRICKLE_50mA (0 << 6) | ||
82 | #define WM8350_CHG_TRICKLE_100mA (1 << 6) | ||
83 | #define WM8350_CHG_4_05V (0 << 4) | ||
84 | #define WM8350_CHG_4_10V (1 << 4) | ||
85 | #define WM8350_CHG_4_15V (2 << 4) | ||
86 | #define WM8350_CHG_4_20V (3 << 4) | ||
87 | #define WM8350_CHG_FAST_LIMIT_mA(x) ((x / 50) & 0xf) | ||
88 | #define WM8350_CHG_EOC_mA(x) (((x - 10) & 0x7) << 10) | ||
89 | #define WM8350_CHG_TRICKLE_3_1V (0 << 13) | ||
90 | #define WM8350_CHG_TRICKLE_3_9V (1 << 13) | ||
91 | |||
92 | /* | ||
93 | * Supply Registers. | ||
94 | */ | ||
95 | #define WM8350_USB_VOLTAGE_READBACK 0x9C | ||
96 | #define WM8350_LINE_VOLTAGE_READBACK 0x9D | ||
97 | #define WM8350_BATT_VOLTAGE_READBACK 0x9E | ||
98 | |||
99 | /* | ||
100 | * Supply Interrupts. | ||
101 | */ | ||
102 | #define WM8350_IRQ_USB_LIMIT 15 | ||
103 | #define WM8350_IRQ_EXT_USB_FB 36 | ||
104 | #define WM8350_IRQ_EXT_WALL_FB 37 | ||
105 | #define WM8350_IRQ_EXT_BAT_FB 38 | ||
106 | |||
107 | struct wm8350_power { | ||
108 | struct platform_device *pdev; | ||
109 | }; | ||
110 | |||
111 | #endif | ||
diff --git a/include/linux/mfd/wm8350/wdt.h b/include/linux/mfd/wm8350/wdt.h new file mode 100644 index 000000000000..f6135b5e5ef4 --- /dev/null +++ b/include/linux/mfd/wm8350/wdt.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * wdt.h -- Watchdog Driver for Wolfson WM8350 PMIC | ||
3 | * | ||
4 | * Copyright 2007, 2008 Wolfson Microelectronics PLC | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef __LINUX_MFD_WM8350_WDT_H_ | ||
13 | #define __LINUX_MFD_WM8350_WDT_H_ | ||
14 | |||
15 | #include <linux/platform_device.h> | ||
16 | |||
17 | #define WM8350_WDOG_HIB_MODE 0x0080 | ||
18 | #define WM8350_WDOG_DEBUG 0x0040 | ||
19 | #define WM8350_WDOG_MODE_MASK 0x0030 | ||
20 | #define WM8350_WDOG_TO_MASK 0x0007 | ||
21 | |||
22 | #define WM8350_IRQ_SYS_WDOG_TO 24 | ||
23 | |||
24 | struct wm8350_wdt { | ||
25 | struct platform_device *pdev; | ||
26 | }; | ||
27 | |||
28 | #endif | ||
diff --git a/include/linux/mfd/wm8400-audio.h b/include/linux/mfd/wm8400-audio.h new file mode 100644 index 000000000000..b6640e018046 --- /dev/null +++ b/include/linux/mfd/wm8400-audio.h | |||
@@ -0,0 +1,1186 @@ | |||
1 | /* | ||
2 | * wm8400 private definitions for audio | ||
3 | * | ||
4 | * Copyright 2008 Wolfson Microelectronics plc | ||
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., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef __LINUX_MFD_WM8400_AUDIO_H | ||
22 | #define __LINUX_MFD_WM8400_AUDIO_H | ||
23 | |||
24 | #include <linux/mfd/wm8400-audio.h> | ||
25 | |||
26 | /* | ||
27 | * R2 (0x02) - Power Management (1) | ||
28 | */ | ||
29 | #define WM8400_CODEC_ENA 0x8000 /* CODEC_ENA */ | ||
30 | #define WM8400_CODEC_ENA_MASK 0x8000 /* CODEC_ENA */ | ||
31 | #define WM8400_CODEC_ENA_SHIFT 15 /* CODEC_ENA */ | ||
32 | #define WM8400_CODEC_ENA_WIDTH 1 /* CODEC_ENA */ | ||
33 | #define WM8400_SYSCLK_ENA 0x4000 /* SYSCLK_ENA */ | ||
34 | #define WM8400_SYSCLK_ENA_MASK 0x4000 /* SYSCLK_ENA */ | ||
35 | #define WM8400_SYSCLK_ENA_SHIFT 14 /* SYSCLK_ENA */ | ||
36 | #define WM8400_SYSCLK_ENA_WIDTH 1 /* SYSCLK_ENA */ | ||
37 | #define WM8400_SPK_MIX_ENA 0x2000 /* SPK_MIX_ENA */ | ||
38 | #define WM8400_SPK_MIX_ENA_MASK 0x2000 /* SPK_MIX_ENA */ | ||
39 | #define WM8400_SPK_MIX_ENA_SHIFT 13 /* SPK_MIX_ENA */ | ||
40 | #define WM8400_SPK_MIX_ENA_WIDTH 1 /* SPK_MIX_ENA */ | ||
41 | #define WM8400_SPK_ENA 0x1000 /* SPK_ENA */ | ||
42 | #define WM8400_SPK_ENA_MASK 0x1000 /* SPK_ENA */ | ||
43 | #define WM8400_SPK_ENA_SHIFT 12 /* SPK_ENA */ | ||
44 | #define WM8400_SPK_ENA_WIDTH 1 /* SPK_ENA */ | ||
45 | #define WM8400_OUT3_ENA 0x0800 /* OUT3_ENA */ | ||
46 | #define WM8400_OUT3_ENA_MASK 0x0800 /* OUT3_ENA */ | ||
47 | #define WM8400_OUT3_ENA_SHIFT 11 /* OUT3_ENA */ | ||
48 | #define WM8400_OUT3_ENA_WIDTH 1 /* OUT3_ENA */ | ||
49 | #define WM8400_OUT4_ENA 0x0400 /* OUT4_ENA */ | ||
50 | #define WM8400_OUT4_ENA_MASK 0x0400 /* OUT4_ENA */ | ||
51 | #define WM8400_OUT4_ENA_SHIFT 10 /* OUT4_ENA */ | ||
52 | #define WM8400_OUT4_ENA_WIDTH 1 /* OUT4_ENA */ | ||
53 | #define WM8400_LOUT_ENA 0x0200 /* LOUT_ENA */ | ||
54 | #define WM8400_LOUT_ENA_MASK 0x0200 /* LOUT_ENA */ | ||
55 | #define WM8400_LOUT_ENA_SHIFT 9 /* LOUT_ENA */ | ||
56 | #define WM8400_LOUT_ENA_WIDTH 1 /* LOUT_ENA */ | ||
57 | #define WM8400_ROUT_ENA 0x0100 /* ROUT_ENA */ | ||
58 | #define WM8400_ROUT_ENA_MASK 0x0100 /* ROUT_ENA */ | ||
59 | #define WM8400_ROUT_ENA_SHIFT 8 /* ROUT_ENA */ | ||
60 | #define WM8400_ROUT_ENA_WIDTH 1 /* ROUT_ENA */ | ||
61 | #define WM8400_MIC1BIAS_ENA 0x0010 /* MIC1BIAS_ENA */ | ||
62 | #define WM8400_MIC1BIAS_ENA_MASK 0x0010 /* MIC1BIAS_ENA */ | ||
63 | #define WM8400_MIC1BIAS_ENA_SHIFT 4 /* MIC1BIAS_ENA */ | ||
64 | #define WM8400_MIC1BIAS_ENA_WIDTH 1 /* MIC1BIAS_ENA */ | ||
65 | #define WM8400_VMID_MODE_MASK 0x0006 /* VMID_MODE - [2:1] */ | ||
66 | #define WM8400_VMID_MODE_SHIFT 1 /* VMID_MODE - [2:1] */ | ||
67 | #define WM8400_VMID_MODE_WIDTH 2 /* VMID_MODE - [2:1] */ | ||
68 | #define WM8400_VREF_ENA 0x0001 /* VREF_ENA */ | ||
69 | #define WM8400_VREF_ENA_MASK 0x0001 /* VREF_ENA */ | ||
70 | #define WM8400_VREF_ENA_SHIFT 0 /* VREF_ENA */ | ||
71 | #define WM8400_VREF_ENA_WIDTH 1 /* VREF_ENA */ | ||
72 | |||
73 | /* | ||
74 | * R3 (0x03) - Power Management (2) | ||
75 | */ | ||
76 | #define WM8400_FLL_ENA 0x8000 /* FLL_ENA */ | ||
77 | #define WM8400_FLL_ENA_MASK 0x8000 /* FLL_ENA */ | ||
78 | #define WM8400_FLL_ENA_SHIFT 15 /* FLL_ENA */ | ||
79 | #define WM8400_FLL_ENA_WIDTH 1 /* FLL_ENA */ | ||
80 | #define WM8400_TSHUT_ENA 0x4000 /* TSHUT_ENA */ | ||
81 | #define WM8400_TSHUT_ENA_MASK 0x4000 /* TSHUT_ENA */ | ||
82 | #define WM8400_TSHUT_ENA_SHIFT 14 /* TSHUT_ENA */ | ||
83 | #define WM8400_TSHUT_ENA_WIDTH 1 /* TSHUT_ENA */ | ||
84 | #define WM8400_TSHUT_OPDIS 0x2000 /* TSHUT_OPDIS */ | ||
85 | #define WM8400_TSHUT_OPDIS_MASK 0x2000 /* TSHUT_OPDIS */ | ||
86 | #define WM8400_TSHUT_OPDIS_SHIFT 13 /* TSHUT_OPDIS */ | ||
87 | #define WM8400_TSHUT_OPDIS_WIDTH 1 /* TSHUT_OPDIS */ | ||
88 | #define WM8400_OPCLK_ENA 0x0800 /* OPCLK_ENA */ | ||
89 | #define WM8400_OPCLK_ENA_MASK 0x0800 /* OPCLK_ENA */ | ||
90 | #define WM8400_OPCLK_ENA_SHIFT 11 /* OPCLK_ENA */ | ||
91 | #define WM8400_OPCLK_ENA_WIDTH 1 /* OPCLK_ENA */ | ||
92 | #define WM8400_AINL_ENA 0x0200 /* AINL_ENA */ | ||
93 | #define WM8400_AINL_ENA_MASK 0x0200 /* AINL_ENA */ | ||
94 | #define WM8400_AINL_ENA_SHIFT 9 /* AINL_ENA */ | ||
95 | #define WM8400_AINL_ENA_WIDTH 1 /* AINL_ENA */ | ||
96 | #define WM8400_AINR_ENA 0x0100 /* AINR_ENA */ | ||
97 | #define WM8400_AINR_ENA_MASK 0x0100 /* AINR_ENA */ | ||
98 | #define WM8400_AINR_ENA_SHIFT 8 /* AINR_ENA */ | ||
99 | #define WM8400_AINR_ENA_WIDTH 1 /* AINR_ENA */ | ||
100 | #define WM8400_LIN34_ENA 0x0080 /* LIN34_ENA */ | ||
101 | #define WM8400_LIN34_ENA_MASK 0x0080 /* LIN34_ENA */ | ||
102 | #define WM8400_LIN34_ENA_SHIFT 7 /* LIN34_ENA */ | ||
103 | #define WM8400_LIN34_ENA_WIDTH 1 /* LIN34_ENA */ | ||
104 | #define WM8400_LIN12_ENA 0x0040 /* LIN12_ENA */ | ||
105 | #define WM8400_LIN12_ENA_MASK 0x0040 /* LIN12_ENA */ | ||
106 | #define WM8400_LIN12_ENA_SHIFT 6 /* LIN12_ENA */ | ||
107 | #define WM8400_LIN12_ENA_WIDTH 1 /* LIN12_ENA */ | ||
108 | #define WM8400_RIN34_ENA 0x0020 /* RIN34_ENA */ | ||
109 | #define WM8400_RIN34_ENA_MASK 0x0020 /* RIN34_ENA */ | ||
110 | #define WM8400_RIN34_ENA_SHIFT 5 /* RIN34_ENA */ | ||
111 | #define WM8400_RIN34_ENA_WIDTH 1 /* RIN34_ENA */ | ||
112 | #define WM8400_RIN12_ENA 0x0010 /* RIN12_ENA */ | ||
113 | #define WM8400_RIN12_ENA_MASK 0x0010 /* RIN12_ENA */ | ||
114 | #define WM8400_RIN12_ENA_SHIFT 4 /* RIN12_ENA */ | ||
115 | #define WM8400_RIN12_ENA_WIDTH 1 /* RIN12_ENA */ | ||
116 | #define WM8400_ADCL_ENA 0x0002 /* ADCL_ENA */ | ||
117 | #define WM8400_ADCL_ENA_MASK 0x0002 /* ADCL_ENA */ | ||
118 | #define WM8400_ADCL_ENA_SHIFT 1 /* ADCL_ENA */ | ||
119 | #define WM8400_ADCL_ENA_WIDTH 1 /* ADCL_ENA */ | ||
120 | #define WM8400_ADCR_ENA 0x0001 /* ADCR_ENA */ | ||
121 | #define WM8400_ADCR_ENA_MASK 0x0001 /* ADCR_ENA */ | ||
122 | #define WM8400_ADCR_ENA_SHIFT 0 /* ADCR_ENA */ | ||
123 | #define WM8400_ADCR_ENA_WIDTH 1 /* ADCR_ENA */ | ||
124 | |||
125 | /* | ||
126 | * R4 (0x04) - Power Management (3) | ||
127 | */ | ||
128 | #define WM8400_LON_ENA 0x2000 /* LON_ENA */ | ||
129 | #define WM8400_LON_ENA_MASK 0x2000 /* LON_ENA */ | ||
130 | #define WM8400_LON_ENA_SHIFT 13 /* LON_ENA */ | ||
131 | #define WM8400_LON_ENA_WIDTH 1 /* LON_ENA */ | ||
132 | #define WM8400_LOP_ENA 0x1000 /* LOP_ENA */ | ||
133 | #define WM8400_LOP_ENA_MASK 0x1000 /* LOP_ENA */ | ||
134 | #define WM8400_LOP_ENA_SHIFT 12 /* LOP_ENA */ | ||
135 | #define WM8400_LOP_ENA_WIDTH 1 /* LOP_ENA */ | ||
136 | #define WM8400_RON_ENA 0x0800 /* RON_ENA */ | ||
137 | #define WM8400_RON_ENA_MASK 0x0800 /* RON_ENA */ | ||
138 | #define WM8400_RON_ENA_SHIFT 11 /* RON_ENA */ | ||
139 | #define WM8400_RON_ENA_WIDTH 1 /* RON_ENA */ | ||
140 | #define WM8400_ROP_ENA 0x0400 /* ROP_ENA */ | ||
141 | #define WM8400_ROP_ENA_MASK 0x0400 /* ROP_ENA */ | ||
142 | #define WM8400_ROP_ENA_SHIFT 10 /* ROP_ENA */ | ||
143 | #define WM8400_ROP_ENA_WIDTH 1 /* ROP_ENA */ | ||
144 | #define WM8400_LOPGA_ENA 0x0080 /* LOPGA_ENA */ | ||
145 | #define WM8400_LOPGA_ENA_MASK 0x0080 /* LOPGA_ENA */ | ||
146 | #define WM8400_LOPGA_ENA_SHIFT 7 /* LOPGA_ENA */ | ||
147 | #define WM8400_LOPGA_ENA_WIDTH 1 /* LOPGA_ENA */ | ||
148 | #define WM8400_ROPGA_ENA 0x0040 /* ROPGA_ENA */ | ||
149 | #define WM8400_ROPGA_ENA_MASK 0x0040 /* ROPGA_ENA */ | ||
150 | #define WM8400_ROPGA_ENA_SHIFT 6 /* ROPGA_ENA */ | ||
151 | #define WM8400_ROPGA_ENA_WIDTH 1 /* ROPGA_ENA */ | ||
152 | #define WM8400_LOMIX_ENA 0x0020 /* LOMIX_ENA */ | ||
153 | #define WM8400_LOMIX_ENA_MASK 0x0020 /* LOMIX_ENA */ | ||
154 | #define WM8400_LOMIX_ENA_SHIFT 5 /* LOMIX_ENA */ | ||
155 | #define WM8400_LOMIX_ENA_WIDTH 1 /* LOMIX_ENA */ | ||
156 | #define WM8400_ROMIX_ENA 0x0010 /* ROMIX_ENA */ | ||
157 | #define WM8400_ROMIX_ENA_MASK 0x0010 /* ROMIX_ENA */ | ||
158 | #define WM8400_ROMIX_ENA_SHIFT 4 /* ROMIX_ENA */ | ||
159 | #define WM8400_ROMIX_ENA_WIDTH 1 /* ROMIX_ENA */ | ||
160 | #define WM8400_DACL_ENA 0x0002 /* DACL_ENA */ | ||
161 | #define WM8400_DACL_ENA_MASK 0x0002 /* DACL_ENA */ | ||
162 | #define WM8400_DACL_ENA_SHIFT 1 /* DACL_ENA */ | ||
163 | #define WM8400_DACL_ENA_WIDTH 1 /* DACL_ENA */ | ||
164 | #define WM8400_DACR_ENA 0x0001 /* DACR_ENA */ | ||
165 | #define WM8400_DACR_ENA_MASK 0x0001 /* DACR_ENA */ | ||
166 | #define WM8400_DACR_ENA_SHIFT 0 /* DACR_ENA */ | ||
167 | #define WM8400_DACR_ENA_WIDTH 1 /* DACR_ENA */ | ||
168 | |||
169 | /* | ||
170 | * R5 (0x05) - Audio Interface (1) | ||
171 | */ | ||
172 | #define WM8400_AIFADCL_SRC 0x8000 /* AIFADCL_SRC */ | ||
173 | #define WM8400_AIFADCL_SRC_MASK 0x8000 /* AIFADCL_SRC */ | ||
174 | #define WM8400_AIFADCL_SRC_SHIFT 15 /* AIFADCL_SRC */ | ||
175 | #define WM8400_AIFADCL_SRC_WIDTH 1 /* AIFADCL_SRC */ | ||
176 | #define WM8400_AIFADCR_SRC 0x4000 /* AIFADCR_SRC */ | ||
177 | #define WM8400_AIFADCR_SRC_MASK 0x4000 /* AIFADCR_SRC */ | ||
178 | #define WM8400_AIFADCR_SRC_SHIFT 14 /* AIFADCR_SRC */ | ||
179 | #define WM8400_AIFADCR_SRC_WIDTH 1 /* AIFADCR_SRC */ | ||
180 | #define WM8400_AIFADC_TDM 0x2000 /* AIFADC_TDM */ | ||
181 | #define WM8400_AIFADC_TDM_MASK 0x2000 /* AIFADC_TDM */ | ||
182 | #define WM8400_AIFADC_TDM_SHIFT 13 /* AIFADC_TDM */ | ||
183 | #define WM8400_AIFADC_TDM_WIDTH 1 /* AIFADC_TDM */ | ||
184 | #define WM8400_AIFADC_TDM_CHAN 0x1000 /* AIFADC_TDM_CHAN */ | ||
185 | #define WM8400_AIFADC_TDM_CHAN_MASK 0x1000 /* AIFADC_TDM_CHAN */ | ||
186 | #define WM8400_AIFADC_TDM_CHAN_SHIFT 12 /* AIFADC_TDM_CHAN */ | ||
187 | #define WM8400_AIFADC_TDM_CHAN_WIDTH 1 /* AIFADC_TDM_CHAN */ | ||
188 | #define WM8400_AIF_BCLK_INV 0x0100 /* AIF_BCLK_INV */ | ||
189 | #define WM8400_AIF_BCLK_INV_MASK 0x0100 /* AIF_BCLK_INV */ | ||
190 | #define WM8400_AIF_BCLK_INV_SHIFT 8 /* AIF_BCLK_INV */ | ||
191 | #define WM8400_AIF_BCLK_INV_WIDTH 1 /* AIF_BCLK_INV */ | ||
192 | #define WM8400_AIF_LRCLK_INV 0x0080 /* AIF_LRCLK_INV */ | ||
193 | #define WM8400_AIF_LRCLK_INV_MASK 0x0080 /* AIF_LRCLK_INV */ | ||
194 | #define WM8400_AIF_LRCLK_INV_SHIFT 7 /* AIF_LRCLK_INV */ | ||
195 | #define WM8400_AIF_LRCLK_INV_WIDTH 1 /* AIF_LRCLK_INV */ | ||
196 | #define WM8400_AIF_WL_MASK 0x0060 /* AIF_WL - [6:5] */ | ||
197 | #define WM8400_AIF_WL_SHIFT 5 /* AIF_WL - [6:5] */ | ||
198 | #define WM8400_AIF_WL_WIDTH 2 /* AIF_WL - [6:5] */ | ||
199 | #define WM8400_AIF_WL_16BITS (0 << 5) | ||
200 | #define WM8400_AIF_WL_20BITS (1 << 5) | ||
201 | #define WM8400_AIF_WL_24BITS (2 << 5) | ||
202 | #define WM8400_AIF_WL_32BITS (3 << 5) | ||
203 | #define WM8400_AIF_FMT_MASK 0x0018 /* AIF_FMT - [4:3] */ | ||
204 | #define WM8400_AIF_FMT_SHIFT 3 /* AIF_FMT - [4:3] */ | ||
205 | #define WM8400_AIF_FMT_WIDTH 2 /* AIF_FMT - [4:3] */ | ||
206 | #define WM8400_AIF_FMT_RIGHTJ (0 << 3) | ||
207 | #define WM8400_AIF_FMT_LEFTJ (1 << 3) | ||
208 | #define WM8400_AIF_FMT_I2S (2 << 3) | ||
209 | #define WM8400_AIF_FMT_DSP (3 << 3) | ||
210 | |||
211 | /* | ||
212 | * R6 (0x06) - Audio Interface (2) | ||
213 | */ | ||
214 | #define WM8400_DACL_SRC 0x8000 /* DACL_SRC */ | ||
215 | #define WM8400_DACL_SRC_MASK 0x8000 /* DACL_SRC */ | ||
216 | #define WM8400_DACL_SRC_SHIFT 15 /* DACL_SRC */ | ||
217 | #define WM8400_DACL_SRC_WIDTH 1 /* DACL_SRC */ | ||
218 | #define WM8400_DACR_SRC 0x4000 /* DACR_SRC */ | ||
219 | #define WM8400_DACR_SRC_MASK 0x4000 /* DACR_SRC */ | ||
220 | #define WM8400_DACR_SRC_SHIFT 14 /* DACR_SRC */ | ||
221 | #define WM8400_DACR_SRC_WIDTH 1 /* DACR_SRC */ | ||
222 | #define WM8400_AIFDAC_TDM 0x2000 /* AIFDAC_TDM */ | ||
223 | #define WM8400_AIFDAC_TDM_MASK 0x2000 /* AIFDAC_TDM */ | ||
224 | #define WM8400_AIFDAC_TDM_SHIFT 13 /* AIFDAC_TDM */ | ||
225 | #define WM8400_AIFDAC_TDM_WIDTH 1 /* AIFDAC_TDM */ | ||
226 | #define WM8400_AIFDAC_TDM_CHAN 0x1000 /* AIFDAC_TDM_CHAN */ | ||
227 | #define WM8400_AIFDAC_TDM_CHAN_MASK 0x1000 /* AIFDAC_TDM_CHAN */ | ||
228 | #define WM8400_AIFDAC_TDM_CHAN_SHIFT 12 /* AIFDAC_TDM_CHAN */ | ||
229 | #define WM8400_AIFDAC_TDM_CHAN_WIDTH 1 /* AIFDAC_TDM_CHAN */ | ||
230 | #define WM8400_DAC_BOOST_MASK 0x0C00 /* DAC_BOOST - [11:10] */ | ||
231 | #define WM8400_DAC_BOOST_SHIFT 10 /* DAC_BOOST - [11:10] */ | ||
232 | #define WM8400_DAC_BOOST_WIDTH 2 /* DAC_BOOST - [11:10] */ | ||
233 | #define WM8400_DAC_COMP 0x0010 /* DAC_COMP */ | ||
234 | #define WM8400_DAC_COMP_MASK 0x0010 /* DAC_COMP */ | ||
235 | #define WM8400_DAC_COMP_SHIFT 4 /* DAC_COMP */ | ||
236 | #define WM8400_DAC_COMP_WIDTH 1 /* DAC_COMP */ | ||
237 | #define WM8400_DAC_COMPMODE 0x0008 /* DAC_COMPMODE */ | ||
238 | #define WM8400_DAC_COMPMODE_MASK 0x0008 /* DAC_COMPMODE */ | ||
239 | #define WM8400_DAC_COMPMODE_SHIFT 3 /* DAC_COMPMODE */ | ||
240 | #define WM8400_DAC_COMPMODE_WIDTH 1 /* DAC_COMPMODE */ | ||
241 | #define WM8400_ADC_COMP 0x0004 /* ADC_COMP */ | ||
242 | #define WM8400_ADC_COMP_MASK 0x0004 /* ADC_COMP */ | ||
243 | #define WM8400_ADC_COMP_SHIFT 2 /* ADC_COMP */ | ||
244 | #define WM8400_ADC_COMP_WIDTH 1 /* ADC_COMP */ | ||
245 | #define WM8400_ADC_COMPMODE 0x0002 /* ADC_COMPMODE */ | ||
246 | #define WM8400_ADC_COMPMODE_MASK 0x0002 /* ADC_COMPMODE */ | ||
247 | #define WM8400_ADC_COMPMODE_SHIFT 1 /* ADC_COMPMODE */ | ||
248 | #define WM8400_ADC_COMPMODE_WIDTH 1 /* ADC_COMPMODE */ | ||
249 | #define WM8400_LOOPBACK 0x0001 /* LOOPBACK */ | ||
250 | #define WM8400_LOOPBACK_MASK 0x0001 /* LOOPBACK */ | ||
251 | #define WM8400_LOOPBACK_SHIFT 0 /* LOOPBACK */ | ||
252 | #define WM8400_LOOPBACK_WIDTH 1 /* LOOPBACK */ | ||
253 | |||
254 | /* | ||
255 | * R7 (0x07) - Clocking (1) | ||
256 | */ | ||
257 | #define WM8400_TOCLK_RATE 0x8000 /* TOCLK_RATE */ | ||
258 | #define WM8400_TOCLK_RATE_MASK 0x8000 /* TOCLK_RATE */ | ||
259 | #define WM8400_TOCLK_RATE_SHIFT 15 /* TOCLK_RATE */ | ||
260 | #define WM8400_TOCLK_RATE_WIDTH 1 /* TOCLK_RATE */ | ||
261 | #define WM8400_TOCLK_ENA 0x4000 /* TOCLK_ENA */ | ||
262 | #define WM8400_TOCLK_ENA_MASK 0x4000 /* TOCLK_ENA */ | ||
263 | #define WM8400_TOCLK_ENA_SHIFT 14 /* TOCLK_ENA */ | ||
264 | #define WM8400_TOCLK_ENA_WIDTH 1 /* TOCLK_ENA */ | ||
265 | #define WM8400_OPCLKDIV_MASK 0x1E00 /* OPCLKDIV - [12:9] */ | ||
266 | #define WM8400_OPCLKDIV_SHIFT 9 /* OPCLKDIV - [12:9] */ | ||
267 | #define WM8400_OPCLKDIV_WIDTH 4 /* OPCLKDIV - [12:9] */ | ||
268 | #define WM8400_DCLKDIV_MASK 0x01C0 /* DCLKDIV - [8:6] */ | ||
269 | #define WM8400_DCLKDIV_SHIFT 6 /* DCLKDIV - [8:6] */ | ||
270 | #define WM8400_DCLKDIV_WIDTH 3 /* DCLKDIV - [8:6] */ | ||
271 | #define WM8400_BCLK_DIV_MASK 0x001E /* BCLK_DIV - [4:1] */ | ||
272 | #define WM8400_BCLK_DIV_SHIFT 1 /* BCLK_DIV - [4:1] */ | ||
273 | #define WM8400_BCLK_DIV_WIDTH 4 /* BCLK_DIV - [4:1] */ | ||
274 | |||
275 | /* | ||
276 | * R8 (0x08) - Clocking (2) | ||
277 | */ | ||
278 | #define WM8400_MCLK_SRC 0x8000 /* MCLK_SRC */ | ||
279 | #define WM8400_MCLK_SRC_MASK 0x8000 /* MCLK_SRC */ | ||
280 | #define WM8400_MCLK_SRC_SHIFT 15 /* MCLK_SRC */ | ||
281 | #define WM8400_MCLK_SRC_WIDTH 1 /* MCLK_SRC */ | ||
282 | #define WM8400_SYSCLK_SRC 0x4000 /* SYSCLK_SRC */ | ||
283 | #define WM8400_SYSCLK_SRC_MASK 0x4000 /* SYSCLK_SRC */ | ||
284 | #define WM8400_SYSCLK_SRC_SHIFT 14 /* SYSCLK_SRC */ | ||
285 | #define WM8400_SYSCLK_SRC_WIDTH 1 /* SYSCLK_SRC */ | ||
286 | #define WM8400_CLK_FORCE 0x2000 /* CLK_FORCE */ | ||
287 | #define WM8400_CLK_FORCE_MASK 0x2000 /* CLK_FORCE */ | ||
288 | #define WM8400_CLK_FORCE_SHIFT 13 /* CLK_FORCE */ | ||
289 | #define WM8400_CLK_FORCE_WIDTH 1 /* CLK_FORCE */ | ||
290 | #define WM8400_MCLK_DIV_MASK 0x1800 /* MCLK_DIV - [12:11] */ | ||
291 | #define WM8400_MCLK_DIV_SHIFT 11 /* MCLK_DIV - [12:11] */ | ||
292 | #define WM8400_MCLK_DIV_WIDTH 2 /* MCLK_DIV - [12:11] */ | ||
293 | #define WM8400_MCLK_INV 0x0400 /* MCLK_INV */ | ||
294 | #define WM8400_MCLK_INV_MASK 0x0400 /* MCLK_INV */ | ||
295 | #define WM8400_MCLK_INV_SHIFT 10 /* MCLK_INV */ | ||
296 | #define WM8400_MCLK_INV_WIDTH 1 /* MCLK_INV */ | ||
297 | #define WM8400_ADC_CLKDIV_MASK 0x00E0 /* ADC_CLKDIV - [7:5] */ | ||
298 | #define WM8400_ADC_CLKDIV_SHIFT 5 /* ADC_CLKDIV - [7:5] */ | ||
299 | #define WM8400_ADC_CLKDIV_WIDTH 3 /* ADC_CLKDIV - [7:5] */ | ||
300 | #define WM8400_DAC_CLKDIV_MASK 0x001C /* DAC_CLKDIV - [4:2] */ | ||
301 | #define WM8400_DAC_CLKDIV_SHIFT 2 /* DAC_CLKDIV - [4:2] */ | ||
302 | #define WM8400_DAC_CLKDIV_WIDTH 3 /* DAC_CLKDIV - [4:2] */ | ||
303 | |||
304 | /* | ||
305 | * R9 (0x09) - Audio Interface (3) | ||
306 | */ | ||
307 | #define WM8400_AIF_MSTR1 0x8000 /* AIF_MSTR1 */ | ||
308 | #define WM8400_AIF_MSTR1_MASK 0x8000 /* AIF_MSTR1 */ | ||
309 | #define WM8400_AIF_MSTR1_SHIFT 15 /* AIF_MSTR1 */ | ||
310 | #define WM8400_AIF_MSTR1_WIDTH 1 /* AIF_MSTR1 */ | ||
311 | #define WM8400_AIF_MSTR2 0x4000 /* AIF_MSTR2 */ | ||
312 | #define WM8400_AIF_MSTR2_MASK 0x4000 /* AIF_MSTR2 */ | ||
313 | #define WM8400_AIF_MSTR2_SHIFT 14 /* AIF_MSTR2 */ | ||
314 | #define WM8400_AIF_MSTR2_WIDTH 1 /* AIF_MSTR2 */ | ||
315 | #define WM8400_AIF_SEL 0x2000 /* AIF_SEL */ | ||
316 | #define WM8400_AIF_SEL_MASK 0x2000 /* AIF_SEL */ | ||
317 | #define WM8400_AIF_SEL_SHIFT 13 /* AIF_SEL */ | ||
318 | #define WM8400_AIF_SEL_WIDTH 1 /* AIF_SEL */ | ||
319 | #define WM8400_ADCLRC_DIR 0x0800 /* ADCLRC_DIR */ | ||
320 | #define WM8400_ADCLRC_DIR_MASK 0x0800 /* ADCLRC_DIR */ | ||
321 | #define WM8400_ADCLRC_DIR_SHIFT 11 /* ADCLRC_DIR */ | ||
322 | #define WM8400_ADCLRC_DIR_WIDTH 1 /* ADCLRC_DIR */ | ||
323 | #define WM8400_ADCLRC_RATE_MASK 0x07FF /* ADCLRC_RATE - [10:0] */ | ||
324 | #define WM8400_ADCLRC_RATE_SHIFT 0 /* ADCLRC_RATE - [10:0] */ | ||
325 | #define WM8400_ADCLRC_RATE_WIDTH 11 /* ADCLRC_RATE - [10:0] */ | ||
326 | |||
327 | /* | ||
328 | * R10 (0x0A) - Audio Interface (4) | ||
329 | */ | ||
330 | #define WM8400_ALRCGPIO1 0x8000 /* ALRCGPIO1 */ | ||
331 | #define WM8400_ALRCGPIO1_MASK 0x8000 /* ALRCGPIO1 */ | ||
332 | #define WM8400_ALRCGPIO1_SHIFT 15 /* ALRCGPIO1 */ | ||
333 | #define WM8400_ALRCGPIO1_WIDTH 1 /* ALRCGPIO1 */ | ||
334 | #define WM8400_ALRCBGPIO6 0x4000 /* ALRCBGPIO6 */ | ||
335 | #define WM8400_ALRCBGPIO6_MASK 0x4000 /* ALRCBGPIO6 */ | ||
336 | #define WM8400_ALRCBGPIO6_SHIFT 14 /* ALRCBGPIO6 */ | ||
337 | #define WM8400_ALRCBGPIO6_WIDTH 1 /* ALRCBGPIO6 */ | ||
338 | #define WM8400_AIF_TRIS 0x2000 /* AIF_TRIS */ | ||
339 | #define WM8400_AIF_TRIS_MASK 0x2000 /* AIF_TRIS */ | ||
340 | #define WM8400_AIF_TRIS_SHIFT 13 /* AIF_TRIS */ | ||
341 | #define WM8400_AIF_TRIS_WIDTH 1 /* AIF_TRIS */ | ||
342 | #define WM8400_DACLRC_DIR 0x0800 /* DACLRC_DIR */ | ||
343 | #define WM8400_DACLRC_DIR_MASK 0x0800 /* DACLRC_DIR */ | ||
344 | #define WM8400_DACLRC_DIR_SHIFT 11 /* DACLRC_DIR */ | ||
345 | #define WM8400_DACLRC_DIR_WIDTH 1 /* DACLRC_DIR */ | ||
346 | #define WM8400_DACLRC_RATE_MASK 0x07FF /* DACLRC_RATE - [10:0] */ | ||
347 | #define WM8400_DACLRC_RATE_SHIFT 0 /* DACLRC_RATE - [10:0] */ | ||
348 | #define WM8400_DACLRC_RATE_WIDTH 11 /* DACLRC_RATE - [10:0] */ | ||
349 | |||
350 | /* | ||
351 | * R11 (0x0B) - DAC CTRL | ||
352 | */ | ||
353 | #define WM8400_DAC_SDMCLK_RATE 0x2000 /* DAC_SDMCLK_RATE */ | ||
354 | #define WM8400_DAC_SDMCLK_RATE_MASK 0x2000 /* DAC_SDMCLK_RATE */ | ||
355 | #define WM8400_DAC_SDMCLK_RATE_SHIFT 13 /* DAC_SDMCLK_RATE */ | ||
356 | #define WM8400_DAC_SDMCLK_RATE_WIDTH 1 /* DAC_SDMCLK_RATE */ | ||
357 | #define WM8400_AIF_LRCLKRATE 0x0400 /* AIF_LRCLKRATE */ | ||
358 | #define WM8400_AIF_LRCLKRATE_MASK 0x0400 /* AIF_LRCLKRATE */ | ||
359 | #define WM8400_AIF_LRCLKRATE_SHIFT 10 /* AIF_LRCLKRATE */ | ||
360 | #define WM8400_AIF_LRCLKRATE_WIDTH 1 /* AIF_LRCLKRATE */ | ||
361 | #define WM8400_DAC_MONO 0x0200 /* DAC_MONO */ | ||
362 | #define WM8400_DAC_MONO_MASK 0x0200 /* DAC_MONO */ | ||
363 | #define WM8400_DAC_MONO_SHIFT 9 /* DAC_MONO */ | ||
364 | #define WM8400_DAC_MONO_WIDTH 1 /* DAC_MONO */ | ||
365 | #define WM8400_DAC_SB_FILT 0x0100 /* DAC_SB_FILT */ | ||
366 | #define WM8400_DAC_SB_FILT_MASK 0x0100 /* DAC_SB_FILT */ | ||
367 | #define WM8400_DAC_SB_FILT_SHIFT 8 /* DAC_SB_FILT */ | ||
368 | #define WM8400_DAC_SB_FILT_WIDTH 1 /* DAC_SB_FILT */ | ||
369 | #define WM8400_DAC_MUTERATE 0x0080 /* DAC_MUTERATE */ | ||
370 | #define WM8400_DAC_MUTERATE_MASK 0x0080 /* DAC_MUTERATE */ | ||
371 | #define WM8400_DAC_MUTERATE_SHIFT 7 /* DAC_MUTERATE */ | ||
372 | #define WM8400_DAC_MUTERATE_WIDTH 1 /* DAC_MUTERATE */ | ||
373 | #define WM8400_DAC_MUTEMODE 0x0040 /* DAC_MUTEMODE */ | ||
374 | #define WM8400_DAC_MUTEMODE_MASK 0x0040 /* DAC_MUTEMODE */ | ||
375 | #define WM8400_DAC_MUTEMODE_SHIFT 6 /* DAC_MUTEMODE */ | ||
376 | #define WM8400_DAC_MUTEMODE_WIDTH 1 /* DAC_MUTEMODE */ | ||
377 | #define WM8400_DEEMP_MASK 0x0030 /* DEEMP - [5:4] */ | ||
378 | #define WM8400_DEEMP_SHIFT 4 /* DEEMP - [5:4] */ | ||
379 | #define WM8400_DEEMP_WIDTH 2 /* DEEMP - [5:4] */ | ||
380 | #define WM8400_DAC_MUTE 0x0004 /* DAC_MUTE */ | ||
381 | #define WM8400_DAC_MUTE_MASK 0x0004 /* DAC_MUTE */ | ||
382 | #define WM8400_DAC_MUTE_SHIFT 2 /* DAC_MUTE */ | ||
383 | #define WM8400_DAC_MUTE_WIDTH 1 /* DAC_MUTE */ | ||
384 | #define WM8400_DACL_DATINV 0x0002 /* DACL_DATINV */ | ||
385 | #define WM8400_DACL_DATINV_MASK 0x0002 /* DACL_DATINV */ | ||
386 | #define WM8400_DACL_DATINV_SHIFT 1 /* DACL_DATINV */ | ||
387 | #define WM8400_DACL_DATINV_WIDTH 1 /* DACL_DATINV */ | ||
388 | #define WM8400_DACR_DATINV 0x0001 /* DACR_DATINV */ | ||
389 | #define WM8400_DACR_DATINV_MASK 0x0001 /* DACR_DATINV */ | ||
390 | #define WM8400_DACR_DATINV_SHIFT 0 /* DACR_DATINV */ | ||
391 | #define WM8400_DACR_DATINV_WIDTH 1 /* DACR_DATINV */ | ||
392 | |||
393 | /* | ||
394 | * R12 (0x0C) - Left DAC Digital Volume | ||
395 | */ | ||
396 | #define WM8400_DAC_VU 0x0100 /* DAC_VU */ | ||
397 | #define WM8400_DAC_VU_MASK 0x0100 /* DAC_VU */ | ||
398 | #define WM8400_DAC_VU_SHIFT 8 /* DAC_VU */ | ||
399 | #define WM8400_DAC_VU_WIDTH 1 /* DAC_VU */ | ||
400 | #define WM8400_DACL_VOL_MASK 0x00FF /* DACL_VOL - [7:0] */ | ||
401 | #define WM8400_DACL_VOL_SHIFT 0 /* DACL_VOL - [7:0] */ | ||
402 | #define WM8400_DACL_VOL_WIDTH 8 /* DACL_VOL - [7:0] */ | ||
403 | |||
404 | /* | ||
405 | * R13 (0x0D) - Right DAC Digital Volume | ||
406 | */ | ||
407 | #define WM8400_DAC_VU 0x0100 /* DAC_VU */ | ||
408 | #define WM8400_DAC_VU_MASK 0x0100 /* DAC_VU */ | ||
409 | #define WM8400_DAC_VU_SHIFT 8 /* DAC_VU */ | ||
410 | #define WM8400_DAC_VU_WIDTH 1 /* DAC_VU */ | ||
411 | #define WM8400_DACR_VOL_MASK 0x00FF /* DACR_VOL - [7:0] */ | ||
412 | #define WM8400_DACR_VOL_SHIFT 0 /* DACR_VOL - [7:0] */ | ||
413 | #define WM8400_DACR_VOL_WIDTH 8 /* DACR_VOL - [7:0] */ | ||
414 | |||
415 | /* | ||
416 | * R14 (0x0E) - Digital Side Tone | ||
417 | */ | ||
418 | #define WM8400_ADCL_DAC_SVOL_MASK 0x1E00 /* ADCL_DAC_SVOL - [12:9] */ | ||
419 | #define WM8400_ADCL_DAC_SVOL_SHIFT 9 /* ADCL_DAC_SVOL - [12:9] */ | ||
420 | #define WM8400_ADCL_DAC_SVOL_WIDTH 4 /* ADCL_DAC_SVOL - [12:9] */ | ||
421 | #define WM8400_ADCR_DAC_SVOL_MASK 0x01E0 /* ADCR_DAC_SVOL - [8:5] */ | ||
422 | #define WM8400_ADCR_DAC_SVOL_SHIFT 5 /* ADCR_DAC_SVOL - [8:5] */ | ||
423 | #define WM8400_ADCR_DAC_SVOL_WIDTH 4 /* ADCR_DAC_SVOL - [8:5] */ | ||
424 | #define WM8400_ADC_TO_DACL_MASK 0x000C /* ADC_TO_DACL - [3:2] */ | ||
425 | #define WM8400_ADC_TO_DACL_SHIFT 2 /* ADC_TO_DACL - [3:2] */ | ||
426 | #define WM8400_ADC_TO_DACL_WIDTH 2 /* ADC_TO_DACL - [3:2] */ | ||
427 | #define WM8400_ADC_TO_DACR_MASK 0x0003 /* ADC_TO_DACR - [1:0] */ | ||
428 | #define WM8400_ADC_TO_DACR_SHIFT 0 /* ADC_TO_DACR - [1:0] */ | ||
429 | #define WM8400_ADC_TO_DACR_WIDTH 2 /* ADC_TO_DACR - [1:0] */ | ||
430 | |||
431 | /* | ||
432 | * R15 (0x0F) - ADC CTRL | ||
433 | */ | ||
434 | #define WM8400_ADC_HPF_ENA 0x0100 /* ADC_HPF_ENA */ | ||
435 | #define WM8400_ADC_HPF_ENA_MASK 0x0100 /* ADC_HPF_ENA */ | ||
436 | #define WM8400_ADC_HPF_ENA_SHIFT 8 /* ADC_HPF_ENA */ | ||
437 | #define WM8400_ADC_HPF_ENA_WIDTH 1 /* ADC_HPF_ENA */ | ||
438 | #define WM8400_ADC_HPF_CUT_MASK 0x0060 /* ADC_HPF_CUT - [6:5] */ | ||
439 | #define WM8400_ADC_HPF_CUT_SHIFT 5 /* ADC_HPF_CUT - [6:5] */ | ||
440 | #define WM8400_ADC_HPF_CUT_WIDTH 2 /* ADC_HPF_CUT - [6:5] */ | ||
441 | #define WM8400_ADCL_DATINV 0x0002 /* ADCL_DATINV */ | ||
442 | #define WM8400_ADCL_DATINV_MASK 0x0002 /* ADCL_DATINV */ | ||
443 | #define WM8400_ADCL_DATINV_SHIFT 1 /* ADCL_DATINV */ | ||
444 | #define WM8400_ADCL_DATINV_WIDTH 1 /* ADCL_DATINV */ | ||
445 | #define WM8400_ADCR_DATINV 0x0001 /* ADCR_DATINV */ | ||
446 | #define WM8400_ADCR_DATINV_MASK 0x0001 /* ADCR_DATINV */ | ||
447 | #define WM8400_ADCR_DATINV_SHIFT 0 /* ADCR_DATINV */ | ||
448 | #define WM8400_ADCR_DATINV_WIDTH 1 /* ADCR_DATINV */ | ||
449 | |||
450 | /* | ||
451 | * R16 (0x10) - Left ADC Digital Volume | ||
452 | */ | ||
453 | #define WM8400_ADC_VU 0x0100 /* ADC_VU */ | ||
454 | #define WM8400_ADC_VU_MASK 0x0100 /* ADC_VU */ | ||
455 | #define WM8400_ADC_VU_SHIFT 8 /* ADC_VU */ | ||
456 | #define WM8400_ADC_VU_WIDTH 1 /* ADC_VU */ | ||
457 | #define WM8400_ADCL_VOL_MASK 0x00FF /* ADCL_VOL - [7:0] */ | ||
458 | #define WM8400_ADCL_VOL_SHIFT 0 /* ADCL_VOL - [7:0] */ | ||
459 | #define WM8400_ADCL_VOL_WIDTH 8 /* ADCL_VOL - [7:0] */ | ||
460 | |||
461 | /* | ||
462 | * R17 (0x11) - Right ADC Digital Volume | ||
463 | */ | ||
464 | #define WM8400_ADC_VU 0x0100 /* ADC_VU */ | ||
465 | #define WM8400_ADC_VU_MASK 0x0100 /* ADC_VU */ | ||
466 | #define WM8400_ADC_VU_SHIFT 8 /* ADC_VU */ | ||
467 | #define WM8400_ADC_VU_WIDTH 1 /* ADC_VU */ | ||
468 | #define WM8400_ADCR_VOL_MASK 0x00FF /* ADCR_VOL - [7:0] */ | ||
469 | #define WM8400_ADCR_VOL_SHIFT 0 /* ADCR_VOL - [7:0] */ | ||
470 | #define WM8400_ADCR_VOL_WIDTH 8 /* ADCR_VOL - [7:0] */ | ||
471 | |||
472 | /* | ||
473 | * R24 (0x18) - Left Line Input 1&2 Volume | ||
474 | */ | ||
475 | #define WM8400_IPVU 0x0100 /* IPVU */ | ||
476 | #define WM8400_IPVU_MASK 0x0100 /* IPVU */ | ||
477 | #define WM8400_IPVU_SHIFT 8 /* IPVU */ | ||
478 | #define WM8400_IPVU_WIDTH 1 /* IPVU */ | ||
479 | #define WM8400_LI12MUTE 0x0080 /* LI12MUTE */ | ||
480 | #define WM8400_LI12MUTE_MASK 0x0080 /* LI12MUTE */ | ||
481 | #define WM8400_LI12MUTE_SHIFT 7 /* LI12MUTE */ | ||
482 | #define WM8400_LI12MUTE_WIDTH 1 /* LI12MUTE */ | ||
483 | #define WM8400_LI12ZC 0x0040 /* LI12ZC */ | ||
484 | #define WM8400_LI12ZC_MASK 0x0040 /* LI12ZC */ | ||
485 | #define WM8400_LI12ZC_SHIFT 6 /* LI12ZC */ | ||
486 | #define WM8400_LI12ZC_WIDTH 1 /* LI12ZC */ | ||
487 | #define WM8400_LIN12VOL_MASK 0x001F /* LIN12VOL - [4:0] */ | ||
488 | #define WM8400_LIN12VOL_SHIFT 0 /* LIN12VOL - [4:0] */ | ||
489 | #define WM8400_LIN12VOL_WIDTH 5 /* LIN12VOL - [4:0] */ | ||
490 | |||
491 | /* | ||
492 | * R25 (0x19) - Left Line Input 3&4 Volume | ||
493 | */ | ||
494 | #define WM8400_IPVU 0x0100 /* IPVU */ | ||
495 | #define WM8400_IPVU_MASK 0x0100 /* IPVU */ | ||
496 | #define WM8400_IPVU_SHIFT 8 /* IPVU */ | ||
497 | #define WM8400_IPVU_WIDTH 1 /* IPVU */ | ||
498 | #define WM8400_LI34MUTE 0x0080 /* LI34MUTE */ | ||
499 | #define WM8400_LI34MUTE_MASK 0x0080 /* LI34MUTE */ | ||
500 | #define WM8400_LI34MUTE_SHIFT 7 /* LI34MUTE */ | ||
501 | #define WM8400_LI34MUTE_WIDTH 1 /* LI34MUTE */ | ||
502 | #define WM8400_LI34ZC 0x0040 /* LI34ZC */ | ||
503 | #define WM8400_LI34ZC_MASK 0x0040 /* LI34ZC */ | ||
504 | #define WM8400_LI34ZC_SHIFT 6 /* LI34ZC */ | ||
505 | #define WM8400_LI34ZC_WIDTH 1 /* LI34ZC */ | ||
506 | #define WM8400_LIN34VOL_MASK 0x001F /* LIN34VOL - [4:0] */ | ||
507 | #define WM8400_LIN34VOL_SHIFT 0 /* LIN34VOL - [4:0] */ | ||
508 | #define WM8400_LIN34VOL_WIDTH 5 /* LIN34VOL - [4:0] */ | ||
509 | |||
510 | /* | ||
511 | * R26 (0x1A) - Right Line Input 1&2 Volume | ||
512 | */ | ||
513 | #define WM8400_IPVU 0x0100 /* IPVU */ | ||
514 | #define WM8400_IPVU_MASK 0x0100 /* IPVU */ | ||
515 | #define WM8400_IPVU_SHIFT 8 /* IPVU */ | ||
516 | #define WM8400_IPVU_WIDTH 1 /* IPVU */ | ||
517 | #define WM8400_RI12MUTE 0x0080 /* RI12MUTE */ | ||
518 | #define WM8400_RI12MUTE_MASK 0x0080 /* RI12MUTE */ | ||
519 | #define WM8400_RI12MUTE_SHIFT 7 /* RI12MUTE */ | ||
520 | #define WM8400_RI12MUTE_WIDTH 1 /* RI12MUTE */ | ||
521 | #define WM8400_RI12ZC 0x0040 /* RI12ZC */ | ||
522 | #define WM8400_RI12ZC_MASK 0x0040 /* RI12ZC */ | ||
523 | #define WM8400_RI12ZC_SHIFT 6 /* RI12ZC */ | ||
524 | #define WM8400_RI12ZC_WIDTH 1 /* RI12ZC */ | ||
525 | #define WM8400_RIN12VOL_MASK 0x001F /* RIN12VOL - [4:0] */ | ||
526 | #define WM8400_RIN12VOL_SHIFT 0 /* RIN12VOL - [4:0] */ | ||
527 | #define WM8400_RIN12VOL_WIDTH 5 /* RIN12VOL - [4:0] */ | ||
528 | |||
529 | /* | ||
530 | * R27 (0x1B) - Right Line Input 3&4 Volume | ||
531 | */ | ||
532 | #define WM8400_IPVU 0x0100 /* IPVU */ | ||
533 | #define WM8400_IPVU_MASK 0x0100 /* IPVU */ | ||
534 | #define WM8400_IPVU_SHIFT 8 /* IPVU */ | ||
535 | #define WM8400_IPVU_WIDTH 1 /* IPVU */ | ||
536 | #define WM8400_RI34MUTE 0x0080 /* RI34MUTE */ | ||
537 | #define WM8400_RI34MUTE_MASK 0x0080 /* RI34MUTE */ | ||
538 | #define WM8400_RI34MUTE_SHIFT 7 /* RI34MUTE */ | ||
539 | #define WM8400_RI34MUTE_WIDTH 1 /* RI34MUTE */ | ||
540 | #define WM8400_RI34ZC 0x0040 /* RI34ZC */ | ||
541 | #define WM8400_RI34ZC_MASK 0x0040 /* RI34ZC */ | ||
542 | #define WM8400_RI34ZC_SHIFT 6 /* RI34ZC */ | ||
543 | #define WM8400_RI34ZC_WIDTH 1 /* RI34ZC */ | ||
544 | #define WM8400_RIN34VOL_MASK 0x001F /* RIN34VOL - [4:0] */ | ||
545 | #define WM8400_RIN34VOL_SHIFT 0 /* RIN34VOL - [4:0] */ | ||
546 | #define WM8400_RIN34VOL_WIDTH 5 /* RIN34VOL - [4:0] */ | ||
547 | |||
548 | /* | ||
549 | * R28 (0x1C) - Left Output Volume | ||
550 | */ | ||
551 | #define WM8400_OPVU 0x0100 /* OPVU */ | ||
552 | #define WM8400_OPVU_MASK 0x0100 /* OPVU */ | ||
553 | #define WM8400_OPVU_SHIFT 8 /* OPVU */ | ||
554 | #define WM8400_OPVU_WIDTH 1 /* OPVU */ | ||
555 | #define WM8400_LOZC 0x0080 /* LOZC */ | ||
556 | #define WM8400_LOZC_MASK 0x0080 /* LOZC */ | ||
557 | #define WM8400_LOZC_SHIFT 7 /* LOZC */ | ||
558 | #define WM8400_LOZC_WIDTH 1 /* LOZC */ | ||
559 | #define WM8400_LOUTVOL_MASK 0x007F /* LOUTVOL - [6:0] */ | ||
560 | #define WM8400_LOUTVOL_SHIFT 0 /* LOUTVOL - [6:0] */ | ||
561 | #define WM8400_LOUTVOL_WIDTH 7 /* LOUTVOL - [6:0] */ | ||
562 | |||
563 | /* | ||
564 | * R29 (0x1D) - Right Output Volume | ||
565 | */ | ||
566 | #define WM8400_OPVU 0x0100 /* OPVU */ | ||
567 | #define WM8400_OPVU_MASK 0x0100 /* OPVU */ | ||
568 | #define WM8400_OPVU_SHIFT 8 /* OPVU */ | ||
569 | #define WM8400_OPVU_WIDTH 1 /* OPVU */ | ||
570 | #define WM8400_ROZC 0x0080 /* ROZC */ | ||
571 | #define WM8400_ROZC_MASK 0x0080 /* ROZC */ | ||
572 | #define WM8400_ROZC_SHIFT 7 /* ROZC */ | ||
573 | #define WM8400_ROZC_WIDTH 1 /* ROZC */ | ||
574 | #define WM8400_ROUTVOL_MASK 0x007F /* ROUTVOL - [6:0] */ | ||
575 | #define WM8400_ROUTVOL_SHIFT 0 /* ROUTVOL - [6:0] */ | ||
576 | #define WM8400_ROUTVOL_WIDTH 7 /* ROUTVOL - [6:0] */ | ||
577 | |||
578 | /* | ||
579 | * R30 (0x1E) - Line Outputs Volume | ||
580 | */ | ||
581 | #define WM8400_LONMUTE 0x0040 /* LONMUTE */ | ||
582 | #define WM8400_LONMUTE_MASK 0x0040 /* LONMUTE */ | ||
583 | #define WM8400_LONMUTE_SHIFT 6 /* LONMUTE */ | ||
584 | #define WM8400_LONMUTE_WIDTH 1 /* LONMUTE */ | ||
585 | #define WM8400_LOPMUTE 0x0020 /* LOPMUTE */ | ||
586 | #define WM8400_LOPMUTE_MASK 0x0020 /* LOPMUTE */ | ||
587 | #define WM8400_LOPMUTE_SHIFT 5 /* LOPMUTE */ | ||
588 | #define WM8400_LOPMUTE_WIDTH 1 /* LOPMUTE */ | ||
589 | #define WM8400_LOATTN 0x0010 /* LOATTN */ | ||
590 | #define WM8400_LOATTN_MASK 0x0010 /* LOATTN */ | ||
591 | #define WM8400_LOATTN_SHIFT 4 /* LOATTN */ | ||
592 | #define WM8400_LOATTN_WIDTH 1 /* LOATTN */ | ||
593 | #define WM8400_RONMUTE 0x0004 /* RONMUTE */ | ||
594 | #define WM8400_RONMUTE_MASK 0x0004 /* RONMUTE */ | ||
595 | #define WM8400_RONMUTE_SHIFT 2 /* RONMUTE */ | ||
596 | #define WM8400_RONMUTE_WIDTH 1 /* RONMUTE */ | ||
597 | #define WM8400_ROPMUTE 0x0002 /* ROPMUTE */ | ||
598 | #define WM8400_ROPMUTE_MASK 0x0002 /* ROPMUTE */ | ||
599 | #define WM8400_ROPMUTE_SHIFT 1 /* ROPMUTE */ | ||
600 | #define WM8400_ROPMUTE_WIDTH 1 /* ROPMUTE */ | ||
601 | #define WM8400_ROATTN 0x0001 /* ROATTN */ | ||
602 | #define WM8400_ROATTN_MASK 0x0001 /* ROATTN */ | ||
603 | #define WM8400_ROATTN_SHIFT 0 /* ROATTN */ | ||
604 | #define WM8400_ROATTN_WIDTH 1 /* ROATTN */ | ||
605 | |||
606 | /* | ||
607 | * R31 (0x1F) - Out3/4 Volume | ||
608 | */ | ||
609 | #define WM8400_OUT3MUTE 0x0020 /* OUT3MUTE */ | ||
610 | #define WM8400_OUT3MUTE_MASK 0x0020 /* OUT3MUTE */ | ||
611 | #define WM8400_OUT3MUTE_SHIFT 5 /* OUT3MUTE */ | ||
612 | #define WM8400_OUT3MUTE_WIDTH 1 /* OUT3MUTE */ | ||
613 | #define WM8400_OUT3ATTN 0x0010 /* OUT3ATTN */ | ||
614 | #define WM8400_OUT3ATTN_MASK 0x0010 /* OUT3ATTN */ | ||
615 | #define WM8400_OUT3ATTN_SHIFT 4 /* OUT3ATTN */ | ||
616 | #define WM8400_OUT3ATTN_WIDTH 1 /* OUT3ATTN */ | ||
617 | #define WM8400_OUT4MUTE 0x0002 /* OUT4MUTE */ | ||
618 | #define WM8400_OUT4MUTE_MASK 0x0002 /* OUT4MUTE */ | ||
619 | #define WM8400_OUT4MUTE_SHIFT 1 /* OUT4MUTE */ | ||
620 | #define WM8400_OUT4MUTE_WIDTH 1 /* OUT4MUTE */ | ||
621 | #define WM8400_OUT4ATTN 0x0001 /* OUT4ATTN */ | ||
622 | #define WM8400_OUT4ATTN_MASK 0x0001 /* OUT4ATTN */ | ||
623 | #define WM8400_OUT4ATTN_SHIFT 0 /* OUT4ATTN */ | ||
624 | #define WM8400_OUT4ATTN_WIDTH 1 /* OUT4ATTN */ | ||
625 | |||
626 | /* | ||
627 | * R32 (0x20) - Left OPGA Volume | ||
628 | */ | ||
629 | #define WM8400_OPVU 0x0100 /* OPVU */ | ||
630 | #define WM8400_OPVU_MASK 0x0100 /* OPVU */ | ||
631 | #define WM8400_OPVU_SHIFT 8 /* OPVU */ | ||
632 | #define WM8400_OPVU_WIDTH 1 /* OPVU */ | ||
633 | #define WM8400_LOPGAZC 0x0080 /* LOPGAZC */ | ||
634 | #define WM8400_LOPGAZC_MASK 0x0080 /* LOPGAZC */ | ||
635 | #define WM8400_LOPGAZC_SHIFT 7 /* LOPGAZC */ | ||
636 | #define WM8400_LOPGAZC_WIDTH 1 /* LOPGAZC */ | ||
637 | #define WM8400_LOPGAVOL_MASK 0x007F /* LOPGAVOL - [6:0] */ | ||
638 | #define WM8400_LOPGAVOL_SHIFT 0 /* LOPGAVOL - [6:0] */ | ||
639 | #define WM8400_LOPGAVOL_WIDTH 7 /* LOPGAVOL - [6:0] */ | ||
640 | |||
641 | /* | ||
642 | * R33 (0x21) - Right OPGA Volume | ||
643 | */ | ||
644 | #define WM8400_OPVU 0x0100 /* OPVU */ | ||
645 | #define WM8400_OPVU_MASK 0x0100 /* OPVU */ | ||
646 | #define WM8400_OPVU_SHIFT 8 /* OPVU */ | ||
647 | #define WM8400_OPVU_WIDTH 1 /* OPVU */ | ||
648 | #define WM8400_ROPGAZC 0x0080 /* ROPGAZC */ | ||
649 | #define WM8400_ROPGAZC_MASK 0x0080 /* ROPGAZC */ | ||
650 | #define WM8400_ROPGAZC_SHIFT 7 /* ROPGAZC */ | ||
651 | #define WM8400_ROPGAZC_WIDTH 1 /* ROPGAZC */ | ||
652 | #define WM8400_ROPGAVOL_MASK 0x007F /* ROPGAVOL - [6:0] */ | ||
653 | #define WM8400_ROPGAVOL_SHIFT 0 /* ROPGAVOL - [6:0] */ | ||
654 | #define WM8400_ROPGAVOL_WIDTH 7 /* ROPGAVOL - [6:0] */ | ||
655 | |||
656 | /* | ||
657 | * R34 (0x22) - Speaker Volume | ||
658 | */ | ||
659 | #define WM8400_SPKATTN_MASK 0x0003 /* SPKATTN - [1:0] */ | ||
660 | #define WM8400_SPKATTN_SHIFT 0 /* SPKATTN - [1:0] */ | ||
661 | #define WM8400_SPKATTN_WIDTH 2 /* SPKATTN - [1:0] */ | ||
662 | |||
663 | /* | ||
664 | * R35 (0x23) - ClassD1 | ||
665 | */ | ||
666 | #define WM8400_CDMODE 0x0100 /* CDMODE */ | ||
667 | #define WM8400_CDMODE_MASK 0x0100 /* CDMODE */ | ||
668 | #define WM8400_CDMODE_SHIFT 8 /* CDMODE */ | ||
669 | #define WM8400_CDMODE_WIDTH 1 /* CDMODE */ | ||
670 | #define WM8400_CLASSD_CLK_SEL 0x0080 /* CLASSD_CLK_SEL */ | ||
671 | #define WM8400_CLASSD_CLK_SEL_MASK 0x0080 /* CLASSD_CLK_SEL */ | ||
672 | #define WM8400_CLASSD_CLK_SEL_SHIFT 7 /* CLASSD_CLK_SEL */ | ||
673 | #define WM8400_CLASSD_CLK_SEL_WIDTH 1 /* CLASSD_CLK_SEL */ | ||
674 | #define WM8400_CD_SRCTRL 0x0040 /* CD_SRCTRL */ | ||
675 | #define WM8400_CD_SRCTRL_MASK 0x0040 /* CD_SRCTRL */ | ||
676 | #define WM8400_CD_SRCTRL_SHIFT 6 /* CD_SRCTRL */ | ||
677 | #define WM8400_CD_SRCTRL_WIDTH 1 /* CD_SRCTRL */ | ||
678 | #define WM8400_SPKNOPOP 0x0020 /* SPKNOPOP */ | ||
679 | #define WM8400_SPKNOPOP_MASK 0x0020 /* SPKNOPOP */ | ||
680 | #define WM8400_SPKNOPOP_SHIFT 5 /* SPKNOPOP */ | ||
681 | #define WM8400_SPKNOPOP_WIDTH 1 /* SPKNOPOP */ | ||
682 | #define WM8400_DBLERATE 0x0010 /* DBLERATE */ | ||
683 | #define WM8400_DBLERATE_MASK 0x0010 /* DBLERATE */ | ||
684 | #define WM8400_DBLERATE_SHIFT 4 /* DBLERATE */ | ||
685 | #define WM8400_DBLERATE_WIDTH 1 /* DBLERATE */ | ||
686 | #define WM8400_LOOPTEST 0x0008 /* LOOPTEST */ | ||
687 | #define WM8400_LOOPTEST_MASK 0x0008 /* LOOPTEST */ | ||
688 | #define WM8400_LOOPTEST_SHIFT 3 /* LOOPTEST */ | ||
689 | #define WM8400_LOOPTEST_WIDTH 1 /* LOOPTEST */ | ||
690 | #define WM8400_HALFABBIAS 0x0004 /* HALFABBIAS */ | ||
691 | #define WM8400_HALFABBIAS_MASK 0x0004 /* HALFABBIAS */ | ||
692 | #define WM8400_HALFABBIAS_SHIFT 2 /* HALFABBIAS */ | ||
693 | #define WM8400_HALFABBIAS_WIDTH 1 /* HALFABBIAS */ | ||
694 | #define WM8400_TRIDEL_MASK 0x0003 /* TRIDEL - [1:0] */ | ||
695 | #define WM8400_TRIDEL_SHIFT 0 /* TRIDEL - [1:0] */ | ||
696 | #define WM8400_TRIDEL_WIDTH 2 /* TRIDEL - [1:0] */ | ||
697 | |||
698 | /* | ||
699 | * R37 (0x25) - ClassD3 | ||
700 | */ | ||
701 | #define WM8400_DCGAIN_MASK 0x0038 /* DCGAIN - [5:3] */ | ||
702 | #define WM8400_DCGAIN_SHIFT 3 /* DCGAIN - [5:3] */ | ||
703 | #define WM8400_DCGAIN_WIDTH 3 /* DCGAIN - [5:3] */ | ||
704 | #define WM8400_ACGAIN_MASK 0x0007 /* ACGAIN - [2:0] */ | ||
705 | #define WM8400_ACGAIN_SHIFT 0 /* ACGAIN - [2:0] */ | ||
706 | #define WM8400_ACGAIN_WIDTH 3 /* ACGAIN - [2:0] */ | ||
707 | |||
708 | /* | ||
709 | * R39 (0x27) - Input Mixer1 | ||
710 | */ | ||
711 | #define WM8400_AINLMODE_MASK 0x000C /* AINLMODE - [3:2] */ | ||
712 | #define WM8400_AINLMODE_SHIFT 2 /* AINLMODE - [3:2] */ | ||
713 | #define WM8400_AINLMODE_WIDTH 2 /* AINLMODE - [3:2] */ | ||
714 | #define WM8400_AINRMODE_MASK 0x0003 /* AINRMODE - [1:0] */ | ||
715 | #define WM8400_AINRMODE_SHIFT 0 /* AINRMODE - [1:0] */ | ||
716 | #define WM8400_AINRMODE_WIDTH 2 /* AINRMODE - [1:0] */ | ||
717 | |||
718 | /* | ||
719 | * R40 (0x28) - Input Mixer2 | ||
720 | */ | ||
721 | #define WM8400_LMP4 0x0080 /* LMP4 */ | ||
722 | #define WM8400_LMP4_MASK 0x0080 /* LMP4 */ | ||
723 | #define WM8400_LMP4_SHIFT 7 /* LMP4 */ | ||
724 | #define WM8400_LMP4_WIDTH 1 /* LMP4 */ | ||
725 | #define WM8400_LMN3 0x0040 /* LMN3 */ | ||
726 | #define WM8400_LMN3_MASK 0x0040 /* LMN3 */ | ||
727 | #define WM8400_LMN3_SHIFT 6 /* LMN3 */ | ||
728 | #define WM8400_LMN3_WIDTH 1 /* LMN3 */ | ||
729 | #define WM8400_LMP2 0x0020 /* LMP2 */ | ||
730 | #define WM8400_LMP2_MASK 0x0020 /* LMP2 */ | ||
731 | #define WM8400_LMP2_SHIFT 5 /* LMP2 */ | ||
732 | #define WM8400_LMP2_WIDTH 1 /* LMP2 */ | ||
733 | #define WM8400_LMN1 0x0010 /* LMN1 */ | ||
734 | #define WM8400_LMN1_MASK 0x0010 /* LMN1 */ | ||
735 | #define WM8400_LMN1_SHIFT 4 /* LMN1 */ | ||
736 | #define WM8400_LMN1_WIDTH 1 /* LMN1 */ | ||
737 | #define WM8400_RMP4 0x0008 /* RMP4 */ | ||
738 | #define WM8400_RMP4_MASK 0x0008 /* RMP4 */ | ||
739 | #define WM8400_RMP4_SHIFT 3 /* RMP4 */ | ||
740 | #define WM8400_RMP4_WIDTH 1 /* RMP4 */ | ||
741 | #define WM8400_RMN3 0x0004 /* RMN3 */ | ||
742 | #define WM8400_RMN3_MASK 0x0004 /* RMN3 */ | ||
743 | #define WM8400_RMN3_SHIFT 2 /* RMN3 */ | ||
744 | #define WM8400_RMN3_WIDTH 1 /* RMN3 */ | ||
745 | #define WM8400_RMP2 0x0002 /* RMP2 */ | ||
746 | #define WM8400_RMP2_MASK 0x0002 /* RMP2 */ | ||
747 | #define WM8400_RMP2_SHIFT 1 /* RMP2 */ | ||
748 | #define WM8400_RMP2_WIDTH 1 /* RMP2 */ | ||
749 | #define WM8400_RMN1 0x0001 /* RMN1 */ | ||
750 | #define WM8400_RMN1_MASK 0x0001 /* RMN1 */ | ||
751 | #define WM8400_RMN1_SHIFT 0 /* RMN1 */ | ||
752 | #define WM8400_RMN1_WIDTH 1 /* RMN1 */ | ||
753 | |||
754 | /* | ||
755 | * R41 (0x29) - Input Mixer3 | ||
756 | */ | ||
757 | #define WM8400_L34MNB 0x0100 /* L34MNB */ | ||
758 | #define WM8400_L34MNB_MASK 0x0100 /* L34MNB */ | ||
759 | #define WM8400_L34MNB_SHIFT 8 /* L34MNB */ | ||
760 | #define WM8400_L34MNB_WIDTH 1 /* L34MNB */ | ||
761 | #define WM8400_L34MNBST 0x0080 /* L34MNBST */ | ||
762 | #define WM8400_L34MNBST_MASK 0x0080 /* L34MNBST */ | ||
763 | #define WM8400_L34MNBST_SHIFT 7 /* L34MNBST */ | ||
764 | #define WM8400_L34MNBST_WIDTH 1 /* L34MNBST */ | ||
765 | #define WM8400_L12MNB 0x0020 /* L12MNB */ | ||
766 | #define WM8400_L12MNB_MASK 0x0020 /* L12MNB */ | ||
767 | #define WM8400_L12MNB_SHIFT 5 /* L12MNB */ | ||
768 | #define WM8400_L12MNB_WIDTH 1 /* L12MNB */ | ||
769 | #define WM8400_L12MNBST 0x0010 /* L12MNBST */ | ||
770 | #define WM8400_L12MNBST_MASK 0x0010 /* L12MNBST */ | ||
771 | #define WM8400_L12MNBST_SHIFT 4 /* L12MNBST */ | ||
772 | #define WM8400_L12MNBST_WIDTH 1 /* L12MNBST */ | ||
773 | #define WM8400_LDBVOL_MASK 0x0007 /* LDBVOL - [2:0] */ | ||
774 | #define WM8400_LDBVOL_SHIFT 0 /* LDBVOL - [2:0] */ | ||
775 | #define WM8400_LDBVOL_WIDTH 3 /* LDBVOL - [2:0] */ | ||
776 | |||
777 | /* | ||
778 | * R42 (0x2A) - Input Mixer4 | ||
779 | */ | ||
780 | #define WM8400_R34MNB 0x0100 /* R34MNB */ | ||
781 | #define WM8400_R34MNB_MASK 0x0100 /* R34MNB */ | ||
782 | #define WM8400_R34MNB_SHIFT 8 /* R34MNB */ | ||
783 | #define WM8400_R34MNB_WIDTH 1 /* R34MNB */ | ||
784 | #define WM8400_R34MNBST 0x0080 /* R34MNBST */ | ||
785 | #define WM8400_R34MNBST_MASK 0x0080 /* R34MNBST */ | ||
786 | #define WM8400_R34MNBST_SHIFT 7 /* R34MNBST */ | ||
787 | #define WM8400_R34MNBST_WIDTH 1 /* R34MNBST */ | ||
788 | #define WM8400_R12MNB 0x0020 /* R12MNB */ | ||
789 | #define WM8400_R12MNB_MASK 0x0020 /* R12MNB */ | ||
790 | #define WM8400_R12MNB_SHIFT 5 /* R12MNB */ | ||
791 | #define WM8400_R12MNB_WIDTH 1 /* R12MNB */ | ||
792 | #define WM8400_R12MNBST 0x0010 /* R12MNBST */ | ||
793 | #define WM8400_R12MNBST_MASK 0x0010 /* R12MNBST */ | ||
794 | #define WM8400_R12MNBST_SHIFT 4 /* R12MNBST */ | ||
795 | #define WM8400_R12MNBST_WIDTH 1 /* R12MNBST */ | ||
796 | #define WM8400_RDBVOL_MASK 0x0007 /* RDBVOL - [2:0] */ | ||
797 | #define WM8400_RDBVOL_SHIFT 0 /* RDBVOL - [2:0] */ | ||
798 | #define WM8400_RDBVOL_WIDTH 3 /* RDBVOL - [2:0] */ | ||
799 | |||
800 | /* | ||
801 | * R43 (0x2B) - Input Mixer5 | ||
802 | */ | ||
803 | #define WM8400_LI2BVOL_MASK 0x01C0 /* LI2BVOL - [8:6] */ | ||
804 | #define WM8400_LI2BVOL_SHIFT 6 /* LI2BVOL - [8:6] */ | ||
805 | #define WM8400_LI2BVOL_WIDTH 3 /* LI2BVOL - [8:6] */ | ||
806 | #define WM8400_LR4BVOL_MASK 0x0038 /* LR4BVOL - [5:3] */ | ||
807 | #define WM8400_LR4BVOL_SHIFT 3 /* LR4BVOL - [5:3] */ | ||
808 | #define WM8400_LR4BVOL_WIDTH 3 /* LR4BVOL - [5:3] */ | ||
809 | #define WM8400_LL4BVOL_MASK 0x0007 /* LL4BVOL - [2:0] */ | ||
810 | #define WM8400_LL4BVOL_SHIFT 0 /* LL4BVOL - [2:0] */ | ||
811 | #define WM8400_LL4BVOL_WIDTH 3 /* LL4BVOL - [2:0] */ | ||
812 | |||
813 | /* | ||
814 | * R44 (0x2C) - Input Mixer6 | ||
815 | */ | ||
816 | #define WM8400_RI2BVOL_MASK 0x01C0 /* RI2BVOL - [8:6] */ | ||
817 | #define WM8400_RI2BVOL_SHIFT 6 /* RI2BVOL - [8:6] */ | ||
818 | #define WM8400_RI2BVOL_WIDTH 3 /* RI2BVOL - [8:6] */ | ||
819 | #define WM8400_RL4BVOL_MASK 0x0038 /* RL4BVOL - [5:3] */ | ||
820 | #define WM8400_RL4BVOL_SHIFT 3 /* RL4BVOL - [5:3] */ | ||
821 | #define WM8400_RL4BVOL_WIDTH 3 /* RL4BVOL - [5:3] */ | ||
822 | #define WM8400_RR4BVOL_MASK 0x0007 /* RR4BVOL - [2:0] */ | ||
823 | #define WM8400_RR4BVOL_SHIFT 0 /* RR4BVOL - [2:0] */ | ||
824 | #define WM8400_RR4BVOL_WIDTH 3 /* RR4BVOL - [2:0] */ | ||
825 | |||
826 | /* | ||
827 | * R45 (0x2D) - Output Mixer1 | ||
828 | */ | ||
829 | #define WM8400_LRBLO 0x0080 /* LRBLO */ | ||
830 | #define WM8400_LRBLO_MASK 0x0080 /* LRBLO */ | ||
831 | #define WM8400_LRBLO_SHIFT 7 /* LRBLO */ | ||
832 | #define WM8400_LRBLO_WIDTH 1 /* LRBLO */ | ||
833 | #define WM8400_LLBLO 0x0040 /* LLBLO */ | ||
834 | #define WM8400_LLBLO_MASK 0x0040 /* LLBLO */ | ||
835 | #define WM8400_LLBLO_SHIFT 6 /* LLBLO */ | ||
836 | #define WM8400_LLBLO_WIDTH 1 /* LLBLO */ | ||
837 | #define WM8400_LRI3LO 0x0020 /* LRI3LO */ | ||
838 | #define WM8400_LRI3LO_MASK 0x0020 /* LRI3LO */ | ||
839 | #define WM8400_LRI3LO_SHIFT 5 /* LRI3LO */ | ||
840 | #define WM8400_LRI3LO_WIDTH 1 /* LRI3LO */ | ||
841 | #define WM8400_LLI3LO 0x0010 /* LLI3LO */ | ||
842 | #define WM8400_LLI3LO_MASK 0x0010 /* LLI3LO */ | ||
843 | #define WM8400_LLI3LO_SHIFT 4 /* LLI3LO */ | ||
844 | #define WM8400_LLI3LO_WIDTH 1 /* LLI3LO */ | ||
845 | #define WM8400_LR12LO 0x0008 /* LR12LO */ | ||
846 | #define WM8400_LR12LO_MASK 0x0008 /* LR12LO */ | ||
847 | #define WM8400_LR12LO_SHIFT 3 /* LR12LO */ | ||
848 | #define WM8400_LR12LO_WIDTH 1 /* LR12LO */ | ||
849 | #define WM8400_LL12LO 0x0004 /* LL12LO */ | ||
850 | #define WM8400_LL12LO_MASK 0x0004 /* LL12LO */ | ||
851 | #define WM8400_LL12LO_SHIFT 2 /* LL12LO */ | ||
852 | #define WM8400_LL12LO_WIDTH 1 /* LL12LO */ | ||
853 | #define WM8400_LDLO 0x0001 /* LDLO */ | ||
854 | #define WM8400_LDLO_MASK 0x0001 /* LDLO */ | ||
855 | #define WM8400_LDLO_SHIFT 0 /* LDLO */ | ||
856 | #define WM8400_LDLO_WIDTH 1 /* LDLO */ | ||
857 | |||
858 | /* | ||
859 | * R46 (0x2E) - Output Mixer2 | ||
860 | */ | ||
861 | #define WM8400_RLBRO 0x0080 /* RLBRO */ | ||
862 | #define WM8400_RLBRO_MASK 0x0080 /* RLBRO */ | ||
863 | #define WM8400_RLBRO_SHIFT 7 /* RLBRO */ | ||
864 | #define WM8400_RLBRO_WIDTH 1 /* RLBRO */ | ||
865 | #define WM8400_RRBRO 0x0040 /* RRBRO */ | ||
866 | #define WM8400_RRBRO_MASK 0x0040 /* RRBRO */ | ||
867 | #define WM8400_RRBRO_SHIFT 6 /* RRBRO */ | ||
868 | #define WM8400_RRBRO_WIDTH 1 /* RRBRO */ | ||
869 | #define WM8400_RLI3RO 0x0020 /* RLI3RO */ | ||
870 | #define WM8400_RLI3RO_MASK 0x0020 /* RLI3RO */ | ||
871 | #define WM8400_RLI3RO_SHIFT 5 /* RLI3RO */ | ||
872 | #define WM8400_RLI3RO_WIDTH 1 /* RLI3RO */ | ||
873 | #define WM8400_RRI3RO 0x0010 /* RRI3RO */ | ||
874 | #define WM8400_RRI3RO_MASK 0x0010 /* RRI3RO */ | ||
875 | #define WM8400_RRI3RO_SHIFT 4 /* RRI3RO */ | ||
876 | #define WM8400_RRI3RO_WIDTH 1 /* RRI3RO */ | ||
877 | #define WM8400_RL12RO 0x0008 /* RL12RO */ | ||
878 | #define WM8400_RL12RO_MASK 0x0008 /* RL12RO */ | ||
879 | #define WM8400_RL12RO_SHIFT 3 /* RL12RO */ | ||
880 | #define WM8400_RL12RO_WIDTH 1 /* RL12RO */ | ||
881 | #define WM8400_RR12RO 0x0004 /* RR12RO */ | ||
882 | #define WM8400_RR12RO_MASK 0x0004 /* RR12RO */ | ||
883 | #define WM8400_RR12RO_SHIFT 2 /* RR12RO */ | ||
884 | #define WM8400_RR12RO_WIDTH 1 /* RR12RO */ | ||
885 | #define WM8400_RDRO 0x0001 /* RDRO */ | ||
886 | #define WM8400_RDRO_MASK 0x0001 /* RDRO */ | ||
887 | #define WM8400_RDRO_SHIFT 0 /* RDRO */ | ||
888 | #define WM8400_RDRO_WIDTH 1 /* RDRO */ | ||
889 | |||
890 | /* | ||
891 | * R47 (0x2F) - Output Mixer3 | ||
892 | */ | ||
893 | #define WM8400_LLI3LOVOL_MASK 0x01C0 /* LLI3LOVOL - [8:6] */ | ||
894 | #define WM8400_LLI3LOVOL_SHIFT 6 /* LLI3LOVOL - [8:6] */ | ||
895 | #define WM8400_LLI3LOVOL_WIDTH 3 /* LLI3LOVOL - [8:6] */ | ||
896 | #define WM8400_LR12LOVOL_MASK 0x0038 /* LR12LOVOL - [5:3] */ | ||
897 | #define WM8400_LR12LOVOL_SHIFT 3 /* LR12LOVOL - [5:3] */ | ||
898 | #define WM8400_LR12LOVOL_WIDTH 3 /* LR12LOVOL - [5:3] */ | ||
899 | #define WM8400_LL12LOVOL_MASK 0x0007 /* LL12LOVOL - [2:0] */ | ||
900 | #define WM8400_LL12LOVOL_SHIFT 0 /* LL12LOVOL - [2:0] */ | ||
901 | #define WM8400_LL12LOVOL_WIDTH 3 /* LL12LOVOL - [2:0] */ | ||
902 | |||
903 | /* | ||
904 | * R48 (0x30) - Output Mixer4 | ||
905 | */ | ||
906 | #define WM8400_RRI3ROVOL_MASK 0x01C0 /* RRI3ROVOL - [8:6] */ | ||
907 | #define WM8400_RRI3ROVOL_SHIFT 6 /* RRI3ROVOL - [8:6] */ | ||
908 | #define WM8400_RRI3ROVOL_WIDTH 3 /* RRI3ROVOL - [8:6] */ | ||
909 | #define WM8400_RL12ROVOL_MASK 0x0038 /* RL12ROVOL - [5:3] */ | ||
910 | #define WM8400_RL12ROVOL_SHIFT 3 /* RL12ROVOL - [5:3] */ | ||
911 | #define WM8400_RL12ROVOL_WIDTH 3 /* RL12ROVOL - [5:3] */ | ||
912 | #define WM8400_RR12ROVOL_MASK 0x0007 /* RR12ROVOL - [2:0] */ | ||
913 | #define WM8400_RR12ROVOL_SHIFT 0 /* RR12ROVOL - [2:0] */ | ||
914 | #define WM8400_RR12ROVOL_WIDTH 3 /* RR12ROVOL - [2:0] */ | ||
915 | |||
916 | /* | ||
917 | * R49 (0x31) - Output Mixer5 | ||
918 | */ | ||
919 | #define WM8400_LRI3LOVOL_MASK 0x01C0 /* LRI3LOVOL - [8:6] */ | ||
920 | #define WM8400_LRI3LOVOL_SHIFT 6 /* LRI3LOVOL - [8:6] */ | ||
921 | #define WM8400_LRI3LOVOL_WIDTH 3 /* LRI3LOVOL - [8:6] */ | ||
922 | #define WM8400_LRBLOVOL_MASK 0x0038 /* LRBLOVOL - [5:3] */ | ||
923 | #define WM8400_LRBLOVOL_SHIFT 3 /* LRBLOVOL - [5:3] */ | ||
924 | #define WM8400_LRBLOVOL_WIDTH 3 /* LRBLOVOL - [5:3] */ | ||
925 | #define WM8400_LLBLOVOL_MASK 0x0007 /* LLBLOVOL - [2:0] */ | ||
926 | #define WM8400_LLBLOVOL_SHIFT 0 /* LLBLOVOL - [2:0] */ | ||
927 | #define WM8400_LLBLOVOL_WIDTH 3 /* LLBLOVOL - [2:0] */ | ||
928 | |||
929 | /* | ||
930 | * R50 (0x32) - Output Mixer6 | ||
931 | */ | ||
932 | #define WM8400_RLI3ROVOL_MASK 0x01C0 /* RLI3ROVOL - [8:6] */ | ||
933 | #define WM8400_RLI3ROVOL_SHIFT 6 /* RLI3ROVOL - [8:6] */ | ||
934 | #define WM8400_RLI3ROVOL_WIDTH 3 /* RLI3ROVOL - [8:6] */ | ||
935 | #define WM8400_RLBROVOL_MASK 0x0038 /* RLBROVOL - [5:3] */ | ||
936 | #define WM8400_RLBROVOL_SHIFT 3 /* RLBROVOL - [5:3] */ | ||
937 | #define WM8400_RLBROVOL_WIDTH 3 /* RLBROVOL - [5:3] */ | ||
938 | #define WM8400_RRBROVOL_MASK 0x0007 /* RRBROVOL - [2:0] */ | ||
939 | #define WM8400_RRBROVOL_SHIFT 0 /* RRBROVOL - [2:0] */ | ||
940 | #define WM8400_RRBROVOL_WIDTH 3 /* RRBROVOL - [2:0] */ | ||
941 | |||
942 | /* | ||
943 | * R51 (0x33) - Out3/4 Mixer | ||
944 | */ | ||
945 | #define WM8400_VSEL_MASK 0x0180 /* VSEL - [8:7] */ | ||
946 | #define WM8400_VSEL_SHIFT 7 /* VSEL - [8:7] */ | ||
947 | #define WM8400_VSEL_WIDTH 2 /* VSEL - [8:7] */ | ||
948 | #define WM8400_LI4O3 0x0020 /* LI4O3 */ | ||
949 | #define WM8400_LI4O3_MASK 0x0020 /* LI4O3 */ | ||
950 | #define WM8400_LI4O3_SHIFT 5 /* LI4O3 */ | ||
951 | #define WM8400_LI4O3_WIDTH 1 /* LI4O3 */ | ||
952 | #define WM8400_LPGAO3 0x0010 /* LPGAO3 */ | ||
953 | #define WM8400_LPGAO3_MASK 0x0010 /* LPGAO3 */ | ||
954 | #define WM8400_LPGAO3_SHIFT 4 /* LPGAO3 */ | ||
955 | #define WM8400_LPGAO3_WIDTH 1 /* LPGAO3 */ | ||
956 | #define WM8400_RI4O4 0x0002 /* RI4O4 */ | ||
957 | #define WM8400_RI4O4_MASK 0x0002 /* RI4O4 */ | ||
958 | #define WM8400_RI4O4_SHIFT 1 /* RI4O4 */ | ||
959 | #define WM8400_RI4O4_WIDTH 1 /* RI4O4 */ | ||
960 | #define WM8400_RPGAO4 0x0001 /* RPGAO4 */ | ||
961 | #define WM8400_RPGAO4_MASK 0x0001 /* RPGAO4 */ | ||
962 | #define WM8400_RPGAO4_SHIFT 0 /* RPGAO4 */ | ||
963 | #define WM8400_RPGAO4_WIDTH 1 /* RPGAO4 */ | ||
964 | |||
965 | /* | ||
966 | * R52 (0x34) - Line Mixer1 | ||
967 | */ | ||
968 | #define WM8400_LLOPGALON 0x0040 /* LLOPGALON */ | ||
969 | #define WM8400_LLOPGALON_MASK 0x0040 /* LLOPGALON */ | ||
970 | #define WM8400_LLOPGALON_SHIFT 6 /* LLOPGALON */ | ||
971 | #define WM8400_LLOPGALON_WIDTH 1 /* LLOPGALON */ | ||
972 | #define WM8400_LROPGALON 0x0020 /* LROPGALON */ | ||
973 | #define WM8400_LROPGALON_MASK 0x0020 /* LROPGALON */ | ||
974 | #define WM8400_LROPGALON_SHIFT 5 /* LROPGALON */ | ||
975 | #define WM8400_LROPGALON_WIDTH 1 /* LROPGALON */ | ||
976 | #define WM8400_LOPLON 0x0010 /* LOPLON */ | ||
977 | #define WM8400_LOPLON_MASK 0x0010 /* LOPLON */ | ||
978 | #define WM8400_LOPLON_SHIFT 4 /* LOPLON */ | ||
979 | #define WM8400_LOPLON_WIDTH 1 /* LOPLON */ | ||
980 | #define WM8400_LR12LOP 0x0004 /* LR12LOP */ | ||
981 | #define WM8400_LR12LOP_MASK 0x0004 /* LR12LOP */ | ||
982 | #define WM8400_LR12LOP_SHIFT 2 /* LR12LOP */ | ||
983 | #define WM8400_LR12LOP_WIDTH 1 /* LR12LOP */ | ||
984 | #define WM8400_LL12LOP 0x0002 /* LL12LOP */ | ||
985 | #define WM8400_LL12LOP_MASK 0x0002 /* LL12LOP */ | ||
986 | #define WM8400_LL12LOP_SHIFT 1 /* LL12LOP */ | ||
987 | #define WM8400_LL12LOP_WIDTH 1 /* LL12LOP */ | ||
988 | #define WM8400_LLOPGALOP 0x0001 /* LLOPGALOP */ | ||
989 | #define WM8400_LLOPGALOP_MASK 0x0001 /* LLOPGALOP */ | ||
990 | #define WM8400_LLOPGALOP_SHIFT 0 /* LLOPGALOP */ | ||
991 | #define WM8400_LLOPGALOP_WIDTH 1 /* LLOPGALOP */ | ||
992 | |||
993 | /* | ||
994 | * R53 (0x35) - Line Mixer2 | ||
995 | */ | ||
996 | #define WM8400_RROPGARON 0x0040 /* RROPGARON */ | ||
997 | #define WM8400_RROPGARON_MASK 0x0040 /* RROPGARON */ | ||
998 | #define WM8400_RROPGARON_SHIFT 6 /* RROPGARON */ | ||
999 | #define WM8400_RROPGARON_WIDTH 1 /* RROPGARON */ | ||
1000 | #define WM8400_RLOPGARON 0x0020 /* RLOPGARON */ | ||
1001 | #define WM8400_RLOPGARON_MASK 0x0020 /* RLOPGARON */ | ||
1002 | #define WM8400_RLOPGARON_SHIFT 5 /* RLOPGARON */ | ||
1003 | #define WM8400_RLOPGARON_WIDTH 1 /* RLOPGARON */ | ||
1004 | #define WM8400_ROPRON 0x0010 /* ROPRON */ | ||
1005 | #define WM8400_ROPRON_MASK 0x0010 /* ROPRON */ | ||
1006 | #define WM8400_ROPRON_SHIFT 4 /* ROPRON */ | ||
1007 | #define WM8400_ROPRON_WIDTH 1 /* ROPRON */ | ||
1008 | #define WM8400_RL12ROP 0x0004 /* RL12ROP */ | ||
1009 | #define WM8400_RL12ROP_MASK 0x0004 /* RL12ROP */ | ||
1010 | #define WM8400_RL12ROP_SHIFT 2 /* RL12ROP */ | ||
1011 | #define WM8400_RL12ROP_WIDTH 1 /* RL12ROP */ | ||
1012 | #define WM8400_RR12ROP 0x0002 /* RR12ROP */ | ||
1013 | #define WM8400_RR12ROP_MASK 0x0002 /* RR12ROP */ | ||
1014 | #define WM8400_RR12ROP_SHIFT 1 /* RR12ROP */ | ||
1015 | #define WM8400_RR12ROP_WIDTH 1 /* RR12ROP */ | ||
1016 | #define WM8400_RROPGAROP 0x0001 /* RROPGAROP */ | ||
1017 | #define WM8400_RROPGAROP_MASK 0x0001 /* RROPGAROP */ | ||
1018 | #define WM8400_RROPGAROP_SHIFT 0 /* RROPGAROP */ | ||
1019 | #define WM8400_RROPGAROP_WIDTH 1 /* RROPGAROP */ | ||
1020 | |||
1021 | /* | ||
1022 | * R54 (0x36) - Speaker Mixer | ||
1023 | */ | ||
1024 | #define WM8400_LB2SPK 0x0080 /* LB2SPK */ | ||
1025 | #define WM8400_LB2SPK_MASK 0x0080 /* LB2SPK */ | ||
1026 | #define WM8400_LB2SPK_SHIFT 7 /* LB2SPK */ | ||
1027 | #define WM8400_LB2SPK_WIDTH 1 /* LB2SPK */ | ||
1028 | #define WM8400_RB2SPK 0x0040 /* RB2SPK */ | ||
1029 | #define WM8400_RB2SPK_MASK 0x0040 /* RB2SPK */ | ||
1030 | #define WM8400_RB2SPK_SHIFT 6 /* RB2SPK */ | ||
1031 | #define WM8400_RB2SPK_WIDTH 1 /* RB2SPK */ | ||
1032 | #define WM8400_LI2SPK 0x0020 /* LI2SPK */ | ||
1033 | #define WM8400_LI2SPK_MASK 0x0020 /* LI2SPK */ | ||
1034 | #define WM8400_LI2SPK_SHIFT 5 /* LI2SPK */ | ||
1035 | #define WM8400_LI2SPK_WIDTH 1 /* LI2SPK */ | ||
1036 | #define WM8400_RI2SPK 0x0010 /* RI2SPK */ | ||
1037 | #define WM8400_RI2SPK_MASK 0x0010 /* RI2SPK */ | ||
1038 | #define WM8400_RI2SPK_SHIFT 4 /* RI2SPK */ | ||
1039 | #define WM8400_RI2SPK_WIDTH 1 /* RI2SPK */ | ||
1040 | #define WM8400_LOPGASPK 0x0008 /* LOPGASPK */ | ||
1041 | #define WM8400_LOPGASPK_MASK 0x0008 /* LOPGASPK */ | ||
1042 | #define WM8400_LOPGASPK_SHIFT 3 /* LOPGASPK */ | ||
1043 | #define WM8400_LOPGASPK_WIDTH 1 /* LOPGASPK */ | ||
1044 | #define WM8400_ROPGASPK 0x0004 /* ROPGASPK */ | ||
1045 | #define WM8400_ROPGASPK_MASK 0x0004 /* ROPGASPK */ | ||
1046 | #define WM8400_ROPGASPK_SHIFT 2 /* ROPGASPK */ | ||
1047 | #define WM8400_ROPGASPK_WIDTH 1 /* ROPGASPK */ | ||
1048 | #define WM8400_LDSPK 0x0002 /* LDSPK */ | ||
1049 | #define WM8400_LDSPK_MASK 0x0002 /* LDSPK */ | ||
1050 | #define WM8400_LDSPK_SHIFT 1 /* LDSPK */ | ||
1051 | #define WM8400_LDSPK_WIDTH 1 /* LDSPK */ | ||
1052 | #define WM8400_RDSPK 0x0001 /* RDSPK */ | ||
1053 | #define WM8400_RDSPK_MASK 0x0001 /* RDSPK */ | ||
1054 | #define WM8400_RDSPK_SHIFT 0 /* RDSPK */ | ||
1055 | #define WM8400_RDSPK_WIDTH 1 /* RDSPK */ | ||
1056 | |||
1057 | /* | ||
1058 | * R55 (0x37) - Additional Control | ||
1059 | */ | ||
1060 | #define WM8400_VROI 0x0001 /* VROI */ | ||
1061 | #define WM8400_VROI_MASK 0x0001 /* VROI */ | ||
1062 | #define WM8400_VROI_SHIFT 0 /* VROI */ | ||
1063 | #define WM8400_VROI_WIDTH 1 /* VROI */ | ||
1064 | |||
1065 | /* | ||
1066 | * R56 (0x38) - AntiPOP1 | ||
1067 | */ | ||
1068 | #define WM8400_DIS_LLINE 0x0020 /* DIS_LLINE */ | ||
1069 | #define WM8400_DIS_LLINE_MASK 0x0020 /* DIS_LLINE */ | ||
1070 | #define WM8400_DIS_LLINE_SHIFT 5 /* DIS_LLINE */ | ||
1071 | #define WM8400_DIS_LLINE_WIDTH 1 /* DIS_LLINE */ | ||
1072 | #define WM8400_DIS_RLINE 0x0010 /* DIS_RLINE */ | ||
1073 | #define WM8400_DIS_RLINE_MASK 0x0010 /* DIS_RLINE */ | ||
1074 | #define WM8400_DIS_RLINE_SHIFT 4 /* DIS_RLINE */ | ||
1075 | #define WM8400_DIS_RLINE_WIDTH 1 /* DIS_RLINE */ | ||
1076 | #define WM8400_DIS_OUT3 0x0008 /* DIS_OUT3 */ | ||
1077 | #define WM8400_DIS_OUT3_MASK 0x0008 /* DIS_OUT3 */ | ||
1078 | #define WM8400_DIS_OUT3_SHIFT 3 /* DIS_OUT3 */ | ||
1079 | #define WM8400_DIS_OUT3_WIDTH 1 /* DIS_OUT3 */ | ||
1080 | #define WM8400_DIS_OUT4 0x0004 /* DIS_OUT4 */ | ||
1081 | #define WM8400_DIS_OUT4_MASK 0x0004 /* DIS_OUT4 */ | ||
1082 | #define WM8400_DIS_OUT4_SHIFT 2 /* DIS_OUT4 */ | ||
1083 | #define WM8400_DIS_OUT4_WIDTH 1 /* DIS_OUT4 */ | ||
1084 | #define WM8400_DIS_LOUT 0x0002 /* DIS_LOUT */ | ||
1085 | #define WM8400_DIS_LOUT_MASK 0x0002 /* DIS_LOUT */ | ||
1086 | #define WM8400_DIS_LOUT_SHIFT 1 /* DIS_LOUT */ | ||
1087 | #define WM8400_DIS_LOUT_WIDTH 1 /* DIS_LOUT */ | ||
1088 | #define WM8400_DIS_ROUT 0x0001 /* DIS_ROUT */ | ||
1089 | #define WM8400_DIS_ROUT_MASK 0x0001 /* DIS_ROUT */ | ||
1090 | #define WM8400_DIS_ROUT_SHIFT 0 /* DIS_ROUT */ | ||
1091 | #define WM8400_DIS_ROUT_WIDTH 1 /* DIS_ROUT */ | ||
1092 | |||
1093 | /* | ||
1094 | * R57 (0x39) - AntiPOP2 | ||
1095 | */ | ||
1096 | #define WM8400_SOFTST 0x0040 /* SOFTST */ | ||
1097 | #define WM8400_SOFTST_MASK 0x0040 /* SOFTST */ | ||
1098 | #define WM8400_SOFTST_SHIFT 6 /* SOFTST */ | ||
1099 | #define WM8400_SOFTST_WIDTH 1 /* SOFTST */ | ||
1100 | #define WM8400_BUFIOEN 0x0008 /* BUFIOEN */ | ||
1101 | #define WM8400_BUFIOEN_MASK 0x0008 /* BUFIOEN */ | ||
1102 | #define WM8400_BUFIOEN_SHIFT 3 /* BUFIOEN */ | ||
1103 | #define WM8400_BUFIOEN_WIDTH 1 /* BUFIOEN */ | ||
1104 | #define WM8400_BUFDCOPEN 0x0004 /* BUFDCOPEN */ | ||
1105 | #define WM8400_BUFDCOPEN_MASK 0x0004 /* BUFDCOPEN */ | ||
1106 | #define WM8400_BUFDCOPEN_SHIFT 2 /* BUFDCOPEN */ | ||
1107 | #define WM8400_BUFDCOPEN_WIDTH 1 /* BUFDCOPEN */ | ||
1108 | #define WM8400_POBCTRL 0x0002 /* POBCTRL */ | ||
1109 | #define WM8400_POBCTRL_MASK 0x0002 /* POBCTRL */ | ||
1110 | #define WM8400_POBCTRL_SHIFT 1 /* POBCTRL */ | ||
1111 | #define WM8400_POBCTRL_WIDTH 1 /* POBCTRL */ | ||
1112 | #define WM8400_VMIDTOG 0x0001 /* VMIDTOG */ | ||
1113 | #define WM8400_VMIDTOG_MASK 0x0001 /* VMIDTOG */ | ||
1114 | #define WM8400_VMIDTOG_SHIFT 0 /* VMIDTOG */ | ||
1115 | #define WM8400_VMIDTOG_WIDTH 1 /* VMIDTOG */ | ||
1116 | |||
1117 | /* | ||
1118 | * R58 (0x3A) - MICBIAS | ||
1119 | */ | ||
1120 | #define WM8400_MCDSCTH_MASK 0x00C0 /* MCDSCTH - [7:6] */ | ||
1121 | #define WM8400_MCDSCTH_SHIFT 6 /* MCDSCTH - [7:6] */ | ||
1122 | #define WM8400_MCDSCTH_WIDTH 2 /* MCDSCTH - [7:6] */ | ||
1123 | #define WM8400_MCDTHR_MASK 0x0038 /* MCDTHR - [5:3] */ | ||
1124 | #define WM8400_MCDTHR_SHIFT 3 /* MCDTHR - [5:3] */ | ||
1125 | #define WM8400_MCDTHR_WIDTH 3 /* MCDTHR - [5:3] */ | ||
1126 | #define WM8400_MCD 0x0004 /* MCD */ | ||
1127 | #define WM8400_MCD_MASK 0x0004 /* MCD */ | ||
1128 | #define WM8400_MCD_SHIFT 2 /* MCD */ | ||
1129 | #define WM8400_MCD_WIDTH 1 /* MCD */ | ||
1130 | #define WM8400_MBSEL 0x0001 /* MBSEL */ | ||
1131 | #define WM8400_MBSEL_MASK 0x0001 /* MBSEL */ | ||
1132 | #define WM8400_MBSEL_SHIFT 0 /* MBSEL */ | ||
1133 | #define WM8400_MBSEL_WIDTH 1 /* MBSEL */ | ||
1134 | |||
1135 | /* | ||
1136 | * R60 (0x3C) - FLL Control 1 | ||
1137 | */ | ||
1138 | #define WM8400_FLL_REF_FREQ 0x1000 /* FLL_REF_FREQ */ | ||
1139 | #define WM8400_FLL_REF_FREQ_MASK 0x1000 /* FLL_REF_FREQ */ | ||
1140 | #define WM8400_FLL_REF_FREQ_SHIFT 12 /* FLL_REF_FREQ */ | ||
1141 | #define WM8400_FLL_REF_FREQ_WIDTH 1 /* FLL_REF_FREQ */ | ||
1142 | #define WM8400_FLL_CLK_SRC_MASK 0x0C00 /* FLL_CLK_SRC - [11:10] */ | ||
1143 | #define WM8400_FLL_CLK_SRC_SHIFT 10 /* FLL_CLK_SRC - [11:10] */ | ||
1144 | #define WM8400_FLL_CLK_SRC_WIDTH 2 /* FLL_CLK_SRC - [11:10] */ | ||
1145 | #define WM8400_FLL_FRAC 0x0200 /* FLL_FRAC */ | ||
1146 | #define WM8400_FLL_FRAC_MASK 0x0200 /* FLL_FRAC */ | ||
1147 | #define WM8400_FLL_FRAC_SHIFT 9 /* FLL_FRAC */ | ||
1148 | #define WM8400_FLL_FRAC_WIDTH 1 /* FLL_FRAC */ | ||
1149 | #define WM8400_FLL_OSC_ENA 0x0100 /* FLL_OSC_ENA */ | ||
1150 | #define WM8400_FLL_OSC_ENA_MASK 0x0100 /* FLL_OSC_ENA */ | ||
1151 | #define WM8400_FLL_OSC_ENA_SHIFT 8 /* FLL_OSC_ENA */ | ||
1152 | #define WM8400_FLL_OSC_ENA_WIDTH 1 /* FLL_OSC_ENA */ | ||
1153 | #define WM8400_FLL_CTRL_RATE_MASK 0x00E0 /* FLL_CTRL_RATE - [7:5] */ | ||
1154 | #define WM8400_FLL_CTRL_RATE_SHIFT 5 /* FLL_CTRL_RATE - [7:5] */ | ||
1155 | #define WM8400_FLL_CTRL_RATE_WIDTH 3 /* FLL_CTRL_RATE - [7:5] */ | ||
1156 | #define WM8400_FLL_FRATIO_MASK 0x001F /* FLL_FRATIO - [4:0] */ | ||
1157 | #define WM8400_FLL_FRATIO_SHIFT 0 /* FLL_FRATIO - [4:0] */ | ||
1158 | #define WM8400_FLL_FRATIO_WIDTH 5 /* FLL_FRATIO - [4:0] */ | ||
1159 | |||
1160 | /* | ||
1161 | * R61 (0x3D) - FLL Control 2 | ||
1162 | */ | ||
1163 | #define WM8400_FLL_K_MASK 0xFFFF /* FLL_K - [15:0] */ | ||
1164 | #define WM8400_FLL_K_SHIFT 0 /* FLL_K - [15:0] */ | ||
1165 | #define WM8400_FLL_K_WIDTH 16 /* FLL_K - [15:0] */ | ||
1166 | |||
1167 | /* | ||
1168 | * R62 (0x3E) - FLL Control 3 | ||
1169 | */ | ||
1170 | #define WM8400_FLL_N_MASK 0x03FF /* FLL_N - [9:0] */ | ||
1171 | #define WM8400_FLL_N_SHIFT 0 /* FLL_N - [9:0] */ | ||
1172 | #define WM8400_FLL_N_WIDTH 10 /* FLL_N - [9:0] */ | ||
1173 | |||
1174 | /* | ||
1175 | * R63 (0x3F) - FLL Control 4 | ||
1176 | */ | ||
1177 | #define WM8400_FLL_TRK_GAIN_MASK 0x0078 /* FLL_TRK_GAIN - [6:3] */ | ||
1178 | #define WM8400_FLL_TRK_GAIN_SHIFT 3 /* FLL_TRK_GAIN - [6:3] */ | ||
1179 | #define WM8400_FLL_TRK_GAIN_WIDTH 4 /* FLL_TRK_GAIN - [6:3] */ | ||
1180 | #define WM8400_FLL_OUTDIV_MASK 0x0007 /* FLL_OUTDIV - [2:0] */ | ||
1181 | #define WM8400_FLL_OUTDIV_SHIFT 0 /* FLL_OUTDIV - [2:0] */ | ||
1182 | #define WM8400_FLL_OUTDIV_WIDTH 3 /* FLL_OUTDIV - [2:0] */ | ||
1183 | |||
1184 | void wm8400_reset_codec_reg_cache(struct wm8400 *wm8400); | ||
1185 | |||
1186 | #endif | ||
diff --git a/include/linux/mfd/wm8400-private.h b/include/linux/mfd/wm8400-private.h new file mode 100644 index 000000000000..2aab4e93a5c9 --- /dev/null +++ b/include/linux/mfd/wm8400-private.h | |||
@@ -0,0 +1,936 @@ | |||
1 | /* | ||
2 | * wm8400 private definitions. | ||
3 | * | ||
4 | * Copyright 2008 Wolfson Microelectronics plc | ||
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., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef __LINUX_MFD_WM8400_PRIV_H | ||
22 | #define __LINUX_MFD_WM8400_PRIV_H | ||
23 | |||
24 | #include <linux/mfd/wm8400.h> | ||
25 | #include <linux/mutex.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | |||
28 | #define WM8400_REGISTER_COUNT 0x55 | ||
29 | |||
30 | struct wm8400 { | ||
31 | struct device *dev; | ||
32 | |||
33 | int (*read_dev)(void *data, char reg, int count, u16 *dst); | ||
34 | int (*write_dev)(void *data, char reg, int count, const u16 *src); | ||
35 | |||
36 | struct mutex io_lock; | ||
37 | void *io_data; | ||
38 | |||
39 | u16 reg_cache[WM8400_REGISTER_COUNT]; | ||
40 | |||
41 | struct platform_device regulators[6]; | ||
42 | }; | ||
43 | |||
44 | /* | ||
45 | * Register values. | ||
46 | */ | ||
47 | #define WM8400_RESET_ID 0x00 | ||
48 | #define WM8400_ID 0x01 | ||
49 | #define WM8400_POWER_MANAGEMENT_1 0x02 | ||
50 | #define WM8400_POWER_MANAGEMENT_2 0x03 | ||
51 | #define WM8400_POWER_MANAGEMENT_3 0x04 | ||
52 | #define WM8400_AUDIO_INTERFACE_1 0x05 | ||
53 | #define WM8400_AUDIO_INTERFACE_2 0x06 | ||
54 | #define WM8400_CLOCKING_1 0x07 | ||
55 | #define WM8400_CLOCKING_2 0x08 | ||
56 | #define WM8400_AUDIO_INTERFACE_3 0x09 | ||
57 | #define WM8400_AUDIO_INTERFACE_4 0x0A | ||
58 | #define WM8400_DAC_CTRL 0x0B | ||
59 | #define WM8400_LEFT_DAC_DIGITAL_VOLUME 0x0C | ||
60 | #define WM8400_RIGHT_DAC_DIGITAL_VOLUME 0x0D | ||
61 | #define WM8400_DIGITAL_SIDE_TONE 0x0E | ||
62 | #define WM8400_ADC_CTRL 0x0F | ||
63 | #define WM8400_LEFT_ADC_DIGITAL_VOLUME 0x10 | ||
64 | #define WM8400_RIGHT_ADC_DIGITAL_VOLUME 0x11 | ||
65 | #define WM8400_GPIO_CTRL_1 0x12 | ||
66 | #define WM8400_GPIO1_GPIO2 0x13 | ||
67 | #define WM8400_GPIO3_GPIO4 0x14 | ||
68 | #define WM8400_GPIO5_GPIO6 0x15 | ||
69 | #define WM8400_GPIOCTRL_2 0x16 | ||
70 | #define WM8400_GPIO_POL 0x17 | ||
71 | #define WM8400_LEFT_LINE_INPUT_1_2_VOLUME 0x18 | ||
72 | #define WM8400_LEFT_LINE_INPUT_3_4_VOLUME 0x19 | ||
73 | #define WM8400_RIGHT_LINE_INPUT_1_2_VOLUME 0x1A | ||
74 | #define WM8400_RIGHT_LINE_INPUT_3_4_VOLUME 0x1B | ||
75 | #define WM8400_LEFT_OUTPUT_VOLUME 0x1C | ||
76 | #define WM8400_RIGHT_OUTPUT_VOLUME 0x1D | ||
77 | #define WM8400_LINE_OUTPUTS_VOLUME 0x1E | ||
78 | #define WM8400_OUT3_4_VOLUME 0x1F | ||
79 | #define WM8400_LEFT_OPGA_VOLUME 0x20 | ||
80 | #define WM8400_RIGHT_OPGA_VOLUME 0x21 | ||
81 | #define WM8400_SPEAKER_VOLUME 0x22 | ||
82 | #define WM8400_CLASSD1 0x23 | ||
83 | #define WM8400_CLASSD3 0x25 | ||
84 | #define WM8400_INPUT_MIXER1 0x27 | ||
85 | #define WM8400_INPUT_MIXER2 0x28 | ||
86 | #define WM8400_INPUT_MIXER3 0x29 | ||
87 | #define WM8400_INPUT_MIXER4 0x2A | ||
88 | #define WM8400_INPUT_MIXER5 0x2B | ||
89 | #define WM8400_INPUT_MIXER6 0x2C | ||
90 | #define WM8400_OUTPUT_MIXER1 0x2D | ||
91 | #define WM8400_OUTPUT_MIXER2 0x2E | ||
92 | #define WM8400_OUTPUT_MIXER3 0x2F | ||
93 | #define WM8400_OUTPUT_MIXER4 0x30 | ||
94 | #define WM8400_OUTPUT_MIXER5 0x31 | ||
95 | #define WM8400_OUTPUT_MIXER6 0x32 | ||
96 | #define WM8400_OUT3_4_MIXER 0x33 | ||
97 | #define WM8400_LINE_MIXER1 0x34 | ||
98 | #define WM8400_LINE_MIXER2 0x35 | ||
99 | #define WM8400_SPEAKER_MIXER 0x36 | ||
100 | #define WM8400_ADDITIONAL_CONTROL 0x37 | ||
101 | #define WM8400_ANTIPOP1 0x38 | ||
102 | #define WM8400_ANTIPOP2 0x39 | ||
103 | #define WM8400_MICBIAS 0x3A | ||
104 | #define WM8400_FLL_CONTROL_1 0x3C | ||
105 | #define WM8400_FLL_CONTROL_2 0x3D | ||
106 | #define WM8400_FLL_CONTROL_3 0x3E | ||
107 | #define WM8400_FLL_CONTROL_4 0x3F | ||
108 | #define WM8400_LDO1_CONTROL 0x41 | ||
109 | #define WM8400_LDO2_CONTROL 0x42 | ||
110 | #define WM8400_LDO3_CONTROL 0x43 | ||
111 | #define WM8400_LDO4_CONTROL 0x44 | ||
112 | #define WM8400_DCDC1_CONTROL_1 0x46 | ||
113 | #define WM8400_DCDC1_CONTROL_2 0x47 | ||
114 | #define WM8400_DCDC2_CONTROL_1 0x48 | ||
115 | #define WM8400_DCDC2_CONTROL_2 0x49 | ||
116 | #define WM8400_INTERFACE 0x4B | ||
117 | #define WM8400_PM_GENERAL 0x4C | ||
118 | #define WM8400_PM_SHUTDOWN_CONTROL 0x4E | ||
119 | #define WM8400_INTERRUPT_STATUS_1 0x4F | ||
120 | #define WM8400_INTERRUPT_STATUS_1_MASK 0x50 | ||
121 | #define WM8400_INTERRUPT_LEVELS 0x51 | ||
122 | #define WM8400_SHUTDOWN_REASON 0x52 | ||
123 | #define WM8400_LINE_CIRCUITS 0x54 | ||
124 | |||
125 | /* | ||
126 | * Field Definitions. | ||
127 | */ | ||
128 | |||
129 | /* | ||
130 | * R0 (0x00) - Reset/ID | ||
131 | */ | ||
132 | #define WM8400_SW_RESET_CHIP_ID_MASK 0xFFFF /* SW_RESET/CHIP_ID - [15:0] */ | ||
133 | #define WM8400_SW_RESET_CHIP_ID_SHIFT 0 /* SW_RESET/CHIP_ID - [15:0] */ | ||
134 | #define WM8400_SW_RESET_CHIP_ID_WIDTH 16 /* SW_RESET/CHIP_ID - [15:0] */ | ||
135 | |||
136 | /* | ||
137 | * R1 (0x01) - ID | ||
138 | */ | ||
139 | #define WM8400_CHIP_REV_MASK 0x7000 /* CHIP_REV - [14:12] */ | ||
140 | #define WM8400_CHIP_REV_SHIFT 12 /* CHIP_REV - [14:12] */ | ||
141 | #define WM8400_CHIP_REV_WIDTH 3 /* CHIP_REV - [14:12] */ | ||
142 | |||
143 | /* | ||
144 | * R18 (0x12) - GPIO CTRL 1 | ||
145 | */ | ||
146 | #define WM8400_IRQ 0x1000 /* IRQ */ | ||
147 | #define WM8400_IRQ_MASK 0x1000 /* IRQ */ | ||
148 | #define WM8400_IRQ_SHIFT 12 /* IRQ */ | ||
149 | #define WM8400_IRQ_WIDTH 1 /* IRQ */ | ||
150 | #define WM8400_TEMPOK 0x0800 /* TEMPOK */ | ||
151 | #define WM8400_TEMPOK_MASK 0x0800 /* TEMPOK */ | ||
152 | #define WM8400_TEMPOK_SHIFT 11 /* TEMPOK */ | ||
153 | #define WM8400_TEMPOK_WIDTH 1 /* TEMPOK */ | ||
154 | #define WM8400_MIC1SHRT 0x0400 /* MIC1SHRT */ | ||
155 | #define WM8400_MIC1SHRT_MASK 0x0400 /* MIC1SHRT */ | ||
156 | #define WM8400_MIC1SHRT_SHIFT 10 /* MIC1SHRT */ | ||
157 | #define WM8400_MIC1SHRT_WIDTH 1 /* MIC1SHRT */ | ||
158 | #define WM8400_MIC1DET 0x0200 /* MIC1DET */ | ||
159 | #define WM8400_MIC1DET_MASK 0x0200 /* MIC1DET */ | ||
160 | #define WM8400_MIC1DET_SHIFT 9 /* MIC1DET */ | ||
161 | #define WM8400_MIC1DET_WIDTH 1 /* MIC1DET */ | ||
162 | #define WM8400_FLL_LCK 0x0100 /* FLL_LCK */ | ||
163 | #define WM8400_FLL_LCK_MASK 0x0100 /* FLL_LCK */ | ||
164 | #define WM8400_FLL_LCK_SHIFT 8 /* FLL_LCK */ | ||
165 | #define WM8400_FLL_LCK_WIDTH 1 /* FLL_LCK */ | ||
166 | #define WM8400_GPIO_STATUS_MASK 0x00FF /* GPIO_STATUS - [7:0] */ | ||
167 | #define WM8400_GPIO_STATUS_SHIFT 0 /* GPIO_STATUS - [7:0] */ | ||
168 | #define WM8400_GPIO_STATUS_WIDTH 8 /* GPIO_STATUS - [7:0] */ | ||
169 | |||
170 | /* | ||
171 | * R19 (0x13) - GPIO1 & GPIO2 | ||
172 | */ | ||
173 | #define WM8400_GPIO2_DEB_ENA 0x8000 /* GPIO2_DEB_ENA */ | ||
174 | #define WM8400_GPIO2_DEB_ENA_MASK 0x8000 /* GPIO2_DEB_ENA */ | ||
175 | #define WM8400_GPIO2_DEB_ENA_SHIFT 15 /* GPIO2_DEB_ENA */ | ||
176 | #define WM8400_GPIO2_DEB_ENA_WIDTH 1 /* GPIO2_DEB_ENA */ | ||
177 | #define WM8400_GPIO2_IRQ_ENA 0x4000 /* GPIO2_IRQ_ENA */ | ||
178 | #define WM8400_GPIO2_IRQ_ENA_MASK 0x4000 /* GPIO2_IRQ_ENA */ | ||
179 | #define WM8400_GPIO2_IRQ_ENA_SHIFT 14 /* GPIO2_IRQ_ENA */ | ||
180 | #define WM8400_GPIO2_IRQ_ENA_WIDTH 1 /* GPIO2_IRQ_ENA */ | ||
181 | #define WM8400_GPIO2_PU 0x2000 /* GPIO2_PU */ | ||
182 | #define WM8400_GPIO2_PU_MASK 0x2000 /* GPIO2_PU */ | ||
183 | #define WM8400_GPIO2_PU_SHIFT 13 /* GPIO2_PU */ | ||
184 | #define WM8400_GPIO2_PU_WIDTH 1 /* GPIO2_PU */ | ||
185 | #define WM8400_GPIO2_PD 0x1000 /* GPIO2_PD */ | ||
186 | #define WM8400_GPIO2_PD_MASK 0x1000 /* GPIO2_PD */ | ||
187 | #define WM8400_GPIO2_PD_SHIFT 12 /* GPIO2_PD */ | ||
188 | #define WM8400_GPIO2_PD_WIDTH 1 /* GPIO2_PD */ | ||
189 | #define WM8400_GPIO2_SEL_MASK 0x0F00 /* GPIO2_SEL - [11:8] */ | ||
190 | #define WM8400_GPIO2_SEL_SHIFT 8 /* GPIO2_SEL - [11:8] */ | ||
191 | #define WM8400_GPIO2_SEL_WIDTH 4 /* GPIO2_SEL - [11:8] */ | ||
192 | #define WM8400_GPIO1_DEB_ENA 0x0080 /* GPIO1_DEB_ENA */ | ||
193 | #define WM8400_GPIO1_DEB_ENA_MASK 0x0080 /* GPIO1_DEB_ENA */ | ||
194 | #define WM8400_GPIO1_DEB_ENA_SHIFT 7 /* GPIO1_DEB_ENA */ | ||
195 | #define WM8400_GPIO1_DEB_ENA_WIDTH 1 /* GPIO1_DEB_ENA */ | ||
196 | #define WM8400_GPIO1_IRQ_ENA 0x0040 /* GPIO1_IRQ_ENA */ | ||
197 | #define WM8400_GPIO1_IRQ_ENA_MASK 0x0040 /* GPIO1_IRQ_ENA */ | ||
198 | #define WM8400_GPIO1_IRQ_ENA_SHIFT 6 /* GPIO1_IRQ_ENA */ | ||
199 | #define WM8400_GPIO1_IRQ_ENA_WIDTH 1 /* GPIO1_IRQ_ENA */ | ||
200 | #define WM8400_GPIO1_PU 0x0020 /* GPIO1_PU */ | ||
201 | #define WM8400_GPIO1_PU_MASK 0x0020 /* GPIO1_PU */ | ||
202 | #define WM8400_GPIO1_PU_SHIFT 5 /* GPIO1_PU */ | ||
203 | #define WM8400_GPIO1_PU_WIDTH 1 /* GPIO1_PU */ | ||
204 | #define WM8400_GPIO1_PD 0x0010 /* GPIO1_PD */ | ||
205 | #define WM8400_GPIO1_PD_MASK 0x0010 /* GPIO1_PD */ | ||
206 | #define WM8400_GPIO1_PD_SHIFT 4 /* GPIO1_PD */ | ||
207 | #define WM8400_GPIO1_PD_WIDTH 1 /* GPIO1_PD */ | ||
208 | #define WM8400_GPIO1_SEL_MASK 0x000F /* GPIO1_SEL - [3:0] */ | ||
209 | #define WM8400_GPIO1_SEL_SHIFT 0 /* GPIO1_SEL - [3:0] */ | ||
210 | #define WM8400_GPIO1_SEL_WIDTH 4 /* GPIO1_SEL - [3:0] */ | ||
211 | |||
212 | /* | ||
213 | * R20 (0x14) - GPIO3 & GPIO4 | ||
214 | */ | ||
215 | #define WM8400_GPIO4_DEB_ENA 0x8000 /* GPIO4_DEB_ENA */ | ||
216 | #define WM8400_GPIO4_DEB_ENA_MASK 0x8000 /* GPIO4_DEB_ENA */ | ||
217 | #define WM8400_GPIO4_DEB_ENA_SHIFT 15 /* GPIO4_DEB_ENA */ | ||
218 | #define WM8400_GPIO4_DEB_ENA_WIDTH 1 /* GPIO4_DEB_ENA */ | ||
219 | #define WM8400_GPIO4_IRQ_ENA 0x4000 /* GPIO4_IRQ_ENA */ | ||
220 | #define WM8400_GPIO4_IRQ_ENA_MASK 0x4000 /* GPIO4_IRQ_ENA */ | ||
221 | #define WM8400_GPIO4_IRQ_ENA_SHIFT 14 /* GPIO4_IRQ_ENA */ | ||
222 | #define WM8400_GPIO4_IRQ_ENA_WIDTH 1 /* GPIO4_IRQ_ENA */ | ||
223 | #define WM8400_GPIO4_PU 0x2000 /* GPIO4_PU */ | ||
224 | #define WM8400_GPIO4_PU_MASK 0x2000 /* GPIO4_PU */ | ||
225 | #define WM8400_GPIO4_PU_SHIFT 13 /* GPIO4_PU */ | ||
226 | #define WM8400_GPIO4_PU_WIDTH 1 /* GPIO4_PU */ | ||
227 | #define WM8400_GPIO4_PD 0x1000 /* GPIO4_PD */ | ||
228 | #define WM8400_GPIO4_PD_MASK 0x1000 /* GPIO4_PD */ | ||
229 | #define WM8400_GPIO4_PD_SHIFT 12 /* GPIO4_PD */ | ||
230 | #define WM8400_GPIO4_PD_WIDTH 1 /* GPIO4_PD */ | ||
231 | #define WM8400_GPIO4_SEL_MASK 0x0F00 /* GPIO4_SEL - [11:8] */ | ||
232 | #define WM8400_GPIO4_SEL_SHIFT 8 /* GPIO4_SEL - [11:8] */ | ||
233 | #define WM8400_GPIO4_SEL_WIDTH 4 /* GPIO4_SEL - [11:8] */ | ||
234 | #define WM8400_GPIO3_DEB_ENA 0x0080 /* GPIO3_DEB_ENA */ | ||
235 | #define WM8400_GPIO3_DEB_ENA_MASK 0x0080 /* GPIO3_DEB_ENA */ | ||
236 | #define WM8400_GPIO3_DEB_ENA_SHIFT 7 /* GPIO3_DEB_ENA */ | ||
237 | #define WM8400_GPIO3_DEB_ENA_WIDTH 1 /* GPIO3_DEB_ENA */ | ||
238 | #define WM8400_GPIO3_IRQ_ENA 0x0040 /* GPIO3_IRQ_ENA */ | ||
239 | #define WM8400_GPIO3_IRQ_ENA_MASK 0x0040 /* GPIO3_IRQ_ENA */ | ||
240 | #define WM8400_GPIO3_IRQ_ENA_SHIFT 6 /* GPIO3_IRQ_ENA */ | ||
241 | #define WM8400_GPIO3_IRQ_ENA_WIDTH 1 /* GPIO3_IRQ_ENA */ | ||
242 | #define WM8400_GPIO3_PU 0x0020 /* GPIO3_PU */ | ||
243 | #define WM8400_GPIO3_PU_MASK 0x0020 /* GPIO3_PU */ | ||
244 | #define WM8400_GPIO3_PU_SHIFT 5 /* GPIO3_PU */ | ||
245 | #define WM8400_GPIO3_PU_WIDTH 1 /* GPIO3_PU */ | ||
246 | #define WM8400_GPIO3_PD 0x0010 /* GPIO3_PD */ | ||
247 | #define WM8400_GPIO3_PD_MASK 0x0010 /* GPIO3_PD */ | ||
248 | #define WM8400_GPIO3_PD_SHIFT 4 /* GPIO3_PD */ | ||
249 | #define WM8400_GPIO3_PD_WIDTH 1 /* GPIO3_PD */ | ||
250 | #define WM8400_GPIO3_SEL_MASK 0x000F /* GPIO3_SEL - [3:0] */ | ||
251 | #define WM8400_GPIO3_SEL_SHIFT 0 /* GPIO3_SEL - [3:0] */ | ||
252 | #define WM8400_GPIO3_SEL_WIDTH 4 /* GPIO3_SEL - [3:0] */ | ||
253 | |||
254 | /* | ||
255 | * R21 (0x15) - GPIO5 & GPIO6 | ||
256 | */ | ||
257 | #define WM8400_GPIO6_DEB_ENA 0x8000 /* GPIO6_DEB_ENA */ | ||
258 | #define WM8400_GPIO6_DEB_ENA_MASK 0x8000 /* GPIO6_DEB_ENA */ | ||
259 | #define WM8400_GPIO6_DEB_ENA_SHIFT 15 /* GPIO6_DEB_ENA */ | ||
260 | #define WM8400_GPIO6_DEB_ENA_WIDTH 1 /* GPIO6_DEB_ENA */ | ||
261 | #define WM8400_GPIO6_IRQ_ENA 0x4000 /* GPIO6_IRQ_ENA */ | ||
262 | #define WM8400_GPIO6_IRQ_ENA_MASK 0x4000 /* GPIO6_IRQ_ENA */ | ||
263 | #define WM8400_GPIO6_IRQ_ENA_SHIFT 14 /* GPIO6_IRQ_ENA */ | ||
264 | #define WM8400_GPIO6_IRQ_ENA_WIDTH 1 /* GPIO6_IRQ_ENA */ | ||
265 | #define WM8400_GPIO6_PU 0x2000 /* GPIO6_PU */ | ||
266 | #define WM8400_GPIO6_PU_MASK 0x2000 /* GPIO6_PU */ | ||
267 | #define WM8400_GPIO6_PU_SHIFT 13 /* GPIO6_PU */ | ||
268 | #define WM8400_GPIO6_PU_WIDTH 1 /* GPIO6_PU */ | ||
269 | #define WM8400_GPIO6_PD 0x1000 /* GPIO6_PD */ | ||
270 | #define WM8400_GPIO6_PD_MASK 0x1000 /* GPIO6_PD */ | ||
271 | #define WM8400_GPIO6_PD_SHIFT 12 /* GPIO6_PD */ | ||
272 | #define WM8400_GPIO6_PD_WIDTH 1 /* GPIO6_PD */ | ||
273 | #define WM8400_GPIO6_SEL_MASK 0x0F00 /* GPIO6_SEL - [11:8] */ | ||
274 | #define WM8400_GPIO6_SEL_SHIFT 8 /* GPIO6_SEL - [11:8] */ | ||
275 | #define WM8400_GPIO6_SEL_WIDTH 4 /* GPIO6_SEL - [11:8] */ | ||
276 | #define WM8400_GPIO5_DEB_ENA 0x0080 /* GPIO5_DEB_ENA */ | ||
277 | #define WM8400_GPIO5_DEB_ENA_MASK 0x0080 /* GPIO5_DEB_ENA */ | ||
278 | #define WM8400_GPIO5_DEB_ENA_SHIFT 7 /* GPIO5_DEB_ENA */ | ||
279 | #define WM8400_GPIO5_DEB_ENA_WIDTH 1 /* GPIO5_DEB_ENA */ | ||
280 | #define WM8400_GPIO5_IRQ_ENA 0x0040 /* GPIO5_IRQ_ENA */ | ||
281 | #define WM8400_GPIO5_IRQ_ENA_MASK 0x0040 /* GPIO5_IRQ_ENA */ | ||
282 | #define WM8400_GPIO5_IRQ_ENA_SHIFT 6 /* GPIO5_IRQ_ENA */ | ||
283 | #define WM8400_GPIO5_IRQ_ENA_WIDTH 1 /* GPIO5_IRQ_ENA */ | ||
284 | #define WM8400_GPIO5_PU 0x0020 /* GPIO5_PU */ | ||
285 | #define WM8400_GPIO5_PU_MASK 0x0020 /* GPIO5_PU */ | ||
286 | #define WM8400_GPIO5_PU_SHIFT 5 /* GPIO5_PU */ | ||
287 | #define WM8400_GPIO5_PU_WIDTH 1 /* GPIO5_PU */ | ||
288 | #define WM8400_GPIO5_PD 0x0010 /* GPIO5_PD */ | ||
289 | #define WM8400_GPIO5_PD_MASK 0x0010 /* GPIO5_PD */ | ||
290 | #define WM8400_GPIO5_PD_SHIFT 4 /* GPIO5_PD */ | ||
291 | #define WM8400_GPIO5_PD_WIDTH 1 /* GPIO5_PD */ | ||
292 | #define WM8400_GPIO5_SEL_MASK 0x000F /* GPIO5_SEL - [3:0] */ | ||
293 | #define WM8400_GPIO5_SEL_SHIFT 0 /* GPIO5_SEL - [3:0] */ | ||
294 | #define WM8400_GPIO5_SEL_WIDTH 4 /* GPIO5_SEL - [3:0] */ | ||
295 | |||
296 | /* | ||
297 | * R22 (0x16) - GPIOCTRL 2 | ||
298 | */ | ||
299 | #define WM8400_TEMPOK_IRQ_ENA 0x0800 /* TEMPOK_IRQ_ENA */ | ||
300 | #define WM8400_TEMPOK_IRQ_ENA_MASK 0x0800 /* TEMPOK_IRQ_ENA */ | ||
301 | #define WM8400_TEMPOK_IRQ_ENA_SHIFT 11 /* TEMPOK_IRQ_ENA */ | ||
302 | #define WM8400_TEMPOK_IRQ_ENA_WIDTH 1 /* TEMPOK_IRQ_ENA */ | ||
303 | #define WM8400_MIC1SHRT_IRQ_ENA 0x0400 /* MIC1SHRT_IRQ_ENA */ | ||
304 | #define WM8400_MIC1SHRT_IRQ_ENA_MASK 0x0400 /* MIC1SHRT_IRQ_ENA */ | ||
305 | #define WM8400_MIC1SHRT_IRQ_ENA_SHIFT 10 /* MIC1SHRT_IRQ_ENA */ | ||
306 | #define WM8400_MIC1SHRT_IRQ_ENA_WIDTH 1 /* MIC1SHRT_IRQ_ENA */ | ||
307 | #define WM8400_MIC1DET_IRQ_ENA 0x0200 /* MIC1DET_IRQ_ENA */ | ||
308 | #define WM8400_MIC1DET_IRQ_ENA_MASK 0x0200 /* MIC1DET_IRQ_ENA */ | ||
309 | #define WM8400_MIC1DET_IRQ_ENA_SHIFT 9 /* MIC1DET_IRQ_ENA */ | ||
310 | #define WM8400_MIC1DET_IRQ_ENA_WIDTH 1 /* MIC1DET_IRQ_ENA */ | ||
311 | #define WM8400_FLL_LCK_IRQ_ENA 0x0100 /* FLL_LCK_IRQ_ENA */ | ||
312 | #define WM8400_FLL_LCK_IRQ_ENA_MASK 0x0100 /* FLL_LCK_IRQ_ENA */ | ||
313 | #define WM8400_FLL_LCK_IRQ_ENA_SHIFT 8 /* FLL_LCK_IRQ_ENA */ | ||
314 | #define WM8400_FLL_LCK_IRQ_ENA_WIDTH 1 /* FLL_LCK_IRQ_ENA */ | ||
315 | #define WM8400_GPI8_DEB_ENA 0x0080 /* GPI8_DEB_ENA */ | ||
316 | #define WM8400_GPI8_DEB_ENA_MASK 0x0080 /* GPI8_DEB_ENA */ | ||
317 | #define WM8400_GPI8_DEB_ENA_SHIFT 7 /* GPI8_DEB_ENA */ | ||
318 | #define WM8400_GPI8_DEB_ENA_WIDTH 1 /* GPI8_DEB_ENA */ | ||
319 | #define WM8400_GPI8_IRQ_ENA 0x0040 /* GPI8_IRQ_ENA */ | ||
320 | #define WM8400_GPI8_IRQ_ENA_MASK 0x0040 /* GPI8_IRQ_ENA */ | ||
321 | #define WM8400_GPI8_IRQ_ENA_SHIFT 6 /* GPI8_IRQ_ENA */ | ||
322 | #define WM8400_GPI8_IRQ_ENA_WIDTH 1 /* GPI8_IRQ_ENA */ | ||
323 | #define WM8400_GPI8_ENA 0x0010 /* GPI8_ENA */ | ||
324 | #define WM8400_GPI8_ENA_MASK 0x0010 /* GPI8_ENA */ | ||
325 | #define WM8400_GPI8_ENA_SHIFT 4 /* GPI8_ENA */ | ||
326 | #define WM8400_GPI8_ENA_WIDTH 1 /* GPI8_ENA */ | ||
327 | #define WM8400_GPI7_DEB_ENA 0x0008 /* GPI7_DEB_ENA */ | ||
328 | #define WM8400_GPI7_DEB_ENA_MASK 0x0008 /* GPI7_DEB_ENA */ | ||
329 | #define WM8400_GPI7_DEB_ENA_SHIFT 3 /* GPI7_DEB_ENA */ | ||
330 | #define WM8400_GPI7_DEB_ENA_WIDTH 1 /* GPI7_DEB_ENA */ | ||
331 | #define WM8400_GPI7_IRQ_ENA 0x0004 /* GPI7_IRQ_ENA */ | ||
332 | #define WM8400_GPI7_IRQ_ENA_MASK 0x0004 /* GPI7_IRQ_ENA */ | ||
333 | #define WM8400_GPI7_IRQ_ENA_SHIFT 2 /* GPI7_IRQ_ENA */ | ||
334 | #define WM8400_GPI7_IRQ_ENA_WIDTH 1 /* GPI7_IRQ_ENA */ | ||
335 | #define WM8400_GPI7_ENA 0x0001 /* GPI7_ENA */ | ||
336 | #define WM8400_GPI7_ENA_MASK 0x0001 /* GPI7_ENA */ | ||
337 | #define WM8400_GPI7_ENA_SHIFT 0 /* GPI7_ENA */ | ||
338 | #define WM8400_GPI7_ENA_WIDTH 1 /* GPI7_ENA */ | ||
339 | |||
340 | /* | ||
341 | * R23 (0x17) - GPIO_POL | ||
342 | */ | ||
343 | #define WM8400_IRQ_INV 0x1000 /* IRQ_INV */ | ||
344 | #define WM8400_IRQ_INV_MASK 0x1000 /* IRQ_INV */ | ||
345 | #define WM8400_IRQ_INV_SHIFT 12 /* IRQ_INV */ | ||
346 | #define WM8400_IRQ_INV_WIDTH 1 /* IRQ_INV */ | ||
347 | #define WM8400_TEMPOK_POL 0x0800 /* TEMPOK_POL */ | ||
348 | #define WM8400_TEMPOK_POL_MASK 0x0800 /* TEMPOK_POL */ | ||
349 | #define WM8400_TEMPOK_POL_SHIFT 11 /* TEMPOK_POL */ | ||
350 | #define WM8400_TEMPOK_POL_WIDTH 1 /* TEMPOK_POL */ | ||
351 | #define WM8400_MIC1SHRT_POL 0x0400 /* MIC1SHRT_POL */ | ||
352 | #define WM8400_MIC1SHRT_POL_MASK 0x0400 /* MIC1SHRT_POL */ | ||
353 | #define WM8400_MIC1SHRT_POL_SHIFT 10 /* MIC1SHRT_POL */ | ||
354 | #define WM8400_MIC1SHRT_POL_WIDTH 1 /* MIC1SHRT_POL */ | ||
355 | #define WM8400_MIC1DET_POL 0x0200 /* MIC1DET_POL */ | ||
356 | #define WM8400_MIC1DET_POL_MASK 0x0200 /* MIC1DET_POL */ | ||
357 | #define WM8400_MIC1DET_POL_SHIFT 9 /* MIC1DET_POL */ | ||
358 | #define WM8400_MIC1DET_POL_WIDTH 1 /* MIC1DET_POL */ | ||
359 | #define WM8400_FLL_LCK_POL 0x0100 /* FLL_LCK_POL */ | ||
360 | #define WM8400_FLL_LCK_POL_MASK 0x0100 /* FLL_LCK_POL */ | ||
361 | #define WM8400_FLL_LCK_POL_SHIFT 8 /* FLL_LCK_POL */ | ||
362 | #define WM8400_FLL_LCK_POL_WIDTH 1 /* FLL_LCK_POL */ | ||
363 | #define WM8400_GPIO_POL_MASK 0x00FF /* GPIO_POL - [7:0] */ | ||
364 | #define WM8400_GPIO_POL_SHIFT 0 /* GPIO_POL - [7:0] */ | ||
365 | #define WM8400_GPIO_POL_WIDTH 8 /* GPIO_POL - [7:0] */ | ||
366 | |||
367 | /* | ||
368 | * R65 (0x41) - LDO 1 Control | ||
369 | */ | ||
370 | #define WM8400_LDO1_ENA 0x8000 /* LDO1_ENA */ | ||
371 | #define WM8400_LDO1_ENA_MASK 0x8000 /* LDO1_ENA */ | ||
372 | #define WM8400_LDO1_ENA_SHIFT 15 /* LDO1_ENA */ | ||
373 | #define WM8400_LDO1_ENA_WIDTH 1 /* LDO1_ENA */ | ||
374 | #define WM8400_LDO1_SWI 0x4000 /* LDO1_SWI */ | ||
375 | #define WM8400_LDO1_SWI_MASK 0x4000 /* LDO1_SWI */ | ||
376 | #define WM8400_LDO1_SWI_SHIFT 14 /* LDO1_SWI */ | ||
377 | #define WM8400_LDO1_SWI_WIDTH 1 /* LDO1_SWI */ | ||
378 | #define WM8400_LDO1_OPFLT 0x1000 /* LDO1_OPFLT */ | ||
379 | #define WM8400_LDO1_OPFLT_MASK 0x1000 /* LDO1_OPFLT */ | ||
380 | #define WM8400_LDO1_OPFLT_SHIFT 12 /* LDO1_OPFLT */ | ||
381 | #define WM8400_LDO1_OPFLT_WIDTH 1 /* LDO1_OPFLT */ | ||
382 | #define WM8400_LDO1_ERRACT 0x0800 /* LDO1_ERRACT */ | ||
383 | #define WM8400_LDO1_ERRACT_MASK 0x0800 /* LDO1_ERRACT */ | ||
384 | #define WM8400_LDO1_ERRACT_SHIFT 11 /* LDO1_ERRACT */ | ||
385 | #define WM8400_LDO1_ERRACT_WIDTH 1 /* LDO1_ERRACT */ | ||
386 | #define WM8400_LDO1_HIB_MODE 0x0400 /* LDO1_HIB_MODE */ | ||
387 | #define WM8400_LDO1_HIB_MODE_MASK 0x0400 /* LDO1_HIB_MODE */ | ||
388 | #define WM8400_LDO1_HIB_MODE_SHIFT 10 /* LDO1_HIB_MODE */ | ||
389 | #define WM8400_LDO1_HIB_MODE_WIDTH 1 /* LDO1_HIB_MODE */ | ||
390 | #define WM8400_LDO1_VIMG_MASK 0x03E0 /* LDO1_VIMG - [9:5] */ | ||
391 | #define WM8400_LDO1_VIMG_SHIFT 5 /* LDO1_VIMG - [9:5] */ | ||
392 | #define WM8400_LDO1_VIMG_WIDTH 5 /* LDO1_VIMG - [9:5] */ | ||
393 | #define WM8400_LDO1_VSEL_MASK 0x001F /* LDO1_VSEL - [4:0] */ | ||
394 | #define WM8400_LDO1_VSEL_SHIFT 0 /* LDO1_VSEL - [4:0] */ | ||
395 | #define WM8400_LDO1_VSEL_WIDTH 5 /* LDO1_VSEL - [4:0] */ | ||
396 | |||
397 | /* | ||
398 | * R66 (0x42) - LDO 2 Control | ||
399 | */ | ||
400 | #define WM8400_LDO2_ENA 0x8000 /* LDO2_ENA */ | ||
401 | #define WM8400_LDO2_ENA_MASK 0x8000 /* LDO2_ENA */ | ||
402 | #define WM8400_LDO2_ENA_SHIFT 15 /* LDO2_ENA */ | ||
403 | #define WM8400_LDO2_ENA_WIDTH 1 /* LDO2_ENA */ | ||
404 | #define WM8400_LDO2_SWI 0x4000 /* LDO2_SWI */ | ||
405 | #define WM8400_LDO2_SWI_MASK 0x4000 /* LDO2_SWI */ | ||
406 | #define WM8400_LDO2_SWI_SHIFT 14 /* LDO2_SWI */ | ||
407 | #define WM8400_LDO2_SWI_WIDTH 1 /* LDO2_SWI */ | ||
408 | #define WM8400_LDO2_OPFLT 0x1000 /* LDO2_OPFLT */ | ||
409 | #define WM8400_LDO2_OPFLT_MASK 0x1000 /* LDO2_OPFLT */ | ||
410 | #define WM8400_LDO2_OPFLT_SHIFT 12 /* LDO2_OPFLT */ | ||
411 | #define WM8400_LDO2_OPFLT_WIDTH 1 /* LDO2_OPFLT */ | ||
412 | #define WM8400_LDO2_ERRACT 0x0800 /* LDO2_ERRACT */ | ||
413 | #define WM8400_LDO2_ERRACT_MASK 0x0800 /* LDO2_ERRACT */ | ||
414 | #define WM8400_LDO2_ERRACT_SHIFT 11 /* LDO2_ERRACT */ | ||
415 | #define WM8400_LDO2_ERRACT_WIDTH 1 /* LDO2_ERRACT */ | ||
416 | #define WM8400_LDO2_HIB_MODE 0x0400 /* LDO2_HIB_MODE */ | ||
417 | #define WM8400_LDO2_HIB_MODE_MASK 0x0400 /* LDO2_HIB_MODE */ | ||
418 | #define WM8400_LDO2_HIB_MODE_SHIFT 10 /* LDO2_HIB_MODE */ | ||
419 | #define WM8400_LDO2_HIB_MODE_WIDTH 1 /* LDO2_HIB_MODE */ | ||
420 | #define WM8400_LDO2_VIMG_MASK 0x03E0 /* LDO2_VIMG - [9:5] */ | ||
421 | #define WM8400_LDO2_VIMG_SHIFT 5 /* LDO2_VIMG - [9:5] */ | ||
422 | #define WM8400_LDO2_VIMG_WIDTH 5 /* LDO2_VIMG - [9:5] */ | ||
423 | #define WM8400_LDO2_VSEL_MASK 0x001F /* LDO2_VSEL - [4:0] */ | ||
424 | #define WM8400_LDO2_VSEL_SHIFT 0 /* LDO2_VSEL - [4:0] */ | ||
425 | #define WM8400_LDO2_VSEL_WIDTH 5 /* LDO2_VSEL - [4:0] */ | ||
426 | |||
427 | /* | ||
428 | * R67 (0x43) - LDO 3 Control | ||
429 | */ | ||
430 | #define WM8400_LDO3_ENA 0x8000 /* LDO3_ENA */ | ||
431 | #define WM8400_LDO3_ENA_MASK 0x8000 /* LDO3_ENA */ | ||
432 | #define WM8400_LDO3_ENA_SHIFT 15 /* LDO3_ENA */ | ||
433 | #define WM8400_LDO3_ENA_WIDTH 1 /* LDO3_ENA */ | ||
434 | #define WM8400_LDO3_SWI 0x4000 /* LDO3_SWI */ | ||
435 | #define WM8400_LDO3_SWI_MASK 0x4000 /* LDO3_SWI */ | ||
436 | #define WM8400_LDO3_SWI_SHIFT 14 /* LDO3_SWI */ | ||
437 | #define WM8400_LDO3_SWI_WIDTH 1 /* LDO3_SWI */ | ||
438 | #define WM8400_LDO3_OPFLT 0x1000 /* LDO3_OPFLT */ | ||
439 | #define WM8400_LDO3_OPFLT_MASK 0x1000 /* LDO3_OPFLT */ | ||
440 | #define WM8400_LDO3_OPFLT_SHIFT 12 /* LDO3_OPFLT */ | ||
441 | #define WM8400_LDO3_OPFLT_WIDTH 1 /* LDO3_OPFLT */ | ||
442 | #define WM8400_LDO3_ERRACT 0x0800 /* LDO3_ERRACT */ | ||
443 | #define WM8400_LDO3_ERRACT_MASK 0x0800 /* LDO3_ERRACT */ | ||
444 | #define WM8400_LDO3_ERRACT_SHIFT 11 /* LDO3_ERRACT */ | ||
445 | #define WM8400_LDO3_ERRACT_WIDTH 1 /* LDO3_ERRACT */ | ||
446 | #define WM8400_LDO3_HIB_MODE 0x0400 /* LDO3_HIB_MODE */ | ||
447 | #define WM8400_LDO3_HIB_MODE_MASK 0x0400 /* LDO3_HIB_MODE */ | ||
448 | #define WM8400_LDO3_HIB_MODE_SHIFT 10 /* LDO3_HIB_MODE */ | ||
449 | #define WM8400_LDO3_HIB_MODE_WIDTH 1 /* LDO3_HIB_MODE */ | ||
450 | #define WM8400_LDO3_VIMG_MASK 0x03E0 /* LDO3_VIMG - [9:5] */ | ||
451 | #define WM8400_LDO3_VIMG_SHIFT 5 /* LDO3_VIMG - [9:5] */ | ||
452 | #define WM8400_LDO3_VIMG_WIDTH 5 /* LDO3_VIMG - [9:5] */ | ||
453 | #define WM8400_LDO3_VSEL_MASK 0x001F /* LDO3_VSEL - [4:0] */ | ||
454 | #define WM8400_LDO3_VSEL_SHIFT 0 /* LDO3_VSEL - [4:0] */ | ||
455 | #define WM8400_LDO3_VSEL_WIDTH 5 /* LDO3_VSEL - [4:0] */ | ||
456 | |||
457 | /* | ||
458 | * R68 (0x44) - LDO 4 Control | ||
459 | */ | ||
460 | #define WM8400_LDO4_ENA 0x8000 /* LDO4_ENA */ | ||
461 | #define WM8400_LDO4_ENA_MASK 0x8000 /* LDO4_ENA */ | ||
462 | #define WM8400_LDO4_ENA_SHIFT 15 /* LDO4_ENA */ | ||
463 | #define WM8400_LDO4_ENA_WIDTH 1 /* LDO4_ENA */ | ||
464 | #define WM8400_LDO4_SWI 0x4000 /* LDO4_SWI */ | ||
465 | #define WM8400_LDO4_SWI_MASK 0x4000 /* LDO4_SWI */ | ||
466 | #define WM8400_LDO4_SWI_SHIFT 14 /* LDO4_SWI */ | ||
467 | #define WM8400_LDO4_SWI_WIDTH 1 /* LDO4_SWI */ | ||
468 | #define WM8400_LDO4_OPFLT 0x1000 /* LDO4_OPFLT */ | ||
469 | #define WM8400_LDO4_OPFLT_MASK 0x1000 /* LDO4_OPFLT */ | ||
470 | #define WM8400_LDO4_OPFLT_SHIFT 12 /* LDO4_OPFLT */ | ||
471 | #define WM8400_LDO4_OPFLT_WIDTH 1 /* LDO4_OPFLT */ | ||
472 | #define WM8400_LDO4_ERRACT 0x0800 /* LDO4_ERRACT */ | ||
473 | #define WM8400_LDO4_ERRACT_MASK 0x0800 /* LDO4_ERRACT */ | ||
474 | #define WM8400_LDO4_ERRACT_SHIFT 11 /* LDO4_ERRACT */ | ||
475 | #define WM8400_LDO4_ERRACT_WIDTH 1 /* LDO4_ERRACT */ | ||
476 | #define WM8400_LDO4_HIB_MODE 0x0400 /* LDO4_HIB_MODE */ | ||
477 | #define WM8400_LDO4_HIB_MODE_MASK 0x0400 /* LDO4_HIB_MODE */ | ||
478 | #define WM8400_LDO4_HIB_MODE_SHIFT 10 /* LDO4_HIB_MODE */ | ||
479 | #define WM8400_LDO4_HIB_MODE_WIDTH 1 /* LDO4_HIB_MODE */ | ||
480 | #define WM8400_LDO4_VIMG_MASK 0x03E0 /* LDO4_VIMG - [9:5] */ | ||
481 | #define WM8400_LDO4_VIMG_SHIFT 5 /* LDO4_VIMG - [9:5] */ | ||
482 | #define WM8400_LDO4_VIMG_WIDTH 5 /* LDO4_VIMG - [9:5] */ | ||
483 | #define WM8400_LDO4_VSEL_MASK 0x001F /* LDO4_VSEL - [4:0] */ | ||
484 | #define WM8400_LDO4_VSEL_SHIFT 0 /* LDO4_VSEL - [4:0] */ | ||
485 | #define WM8400_LDO4_VSEL_WIDTH 5 /* LDO4_VSEL - [4:0] */ | ||
486 | |||
487 | /* | ||
488 | * R70 (0x46) - DCDC1 Control 1 | ||
489 | */ | ||
490 | #define WM8400_DC1_ENA 0x8000 /* DC1_ENA */ | ||
491 | #define WM8400_DC1_ENA_MASK 0x8000 /* DC1_ENA */ | ||
492 | #define WM8400_DC1_ENA_SHIFT 15 /* DC1_ENA */ | ||
493 | #define WM8400_DC1_ENA_WIDTH 1 /* DC1_ENA */ | ||
494 | #define WM8400_DC1_ACTIVE 0x4000 /* DC1_ACTIVE */ | ||
495 | #define WM8400_DC1_ACTIVE_MASK 0x4000 /* DC1_ACTIVE */ | ||
496 | #define WM8400_DC1_ACTIVE_SHIFT 14 /* DC1_ACTIVE */ | ||
497 | #define WM8400_DC1_ACTIVE_WIDTH 1 /* DC1_ACTIVE */ | ||
498 | #define WM8400_DC1_SLEEP 0x2000 /* DC1_SLEEP */ | ||
499 | #define WM8400_DC1_SLEEP_MASK 0x2000 /* DC1_SLEEP */ | ||
500 | #define WM8400_DC1_SLEEP_SHIFT 13 /* DC1_SLEEP */ | ||
501 | #define WM8400_DC1_SLEEP_WIDTH 1 /* DC1_SLEEP */ | ||
502 | #define WM8400_DC1_OPFLT 0x1000 /* DC1_OPFLT */ | ||
503 | #define WM8400_DC1_OPFLT_MASK 0x1000 /* DC1_OPFLT */ | ||
504 | #define WM8400_DC1_OPFLT_SHIFT 12 /* DC1_OPFLT */ | ||
505 | #define WM8400_DC1_OPFLT_WIDTH 1 /* DC1_OPFLT */ | ||
506 | #define WM8400_DC1_ERRACT 0x0800 /* DC1_ERRACT */ | ||
507 | #define WM8400_DC1_ERRACT_MASK 0x0800 /* DC1_ERRACT */ | ||
508 | #define WM8400_DC1_ERRACT_SHIFT 11 /* DC1_ERRACT */ | ||
509 | #define WM8400_DC1_ERRACT_WIDTH 1 /* DC1_ERRACT */ | ||
510 | #define WM8400_DC1_HIB_MODE 0x0400 /* DC1_HIB_MODE */ | ||
511 | #define WM8400_DC1_HIB_MODE_MASK 0x0400 /* DC1_HIB_MODE */ | ||
512 | #define WM8400_DC1_HIB_MODE_SHIFT 10 /* DC1_HIB_MODE */ | ||
513 | #define WM8400_DC1_HIB_MODE_WIDTH 1 /* DC1_HIB_MODE */ | ||
514 | #define WM8400_DC1_SOFTST_MASK 0x0300 /* DC1_SOFTST - [9:8] */ | ||
515 | #define WM8400_DC1_SOFTST_SHIFT 8 /* DC1_SOFTST - [9:8] */ | ||
516 | #define WM8400_DC1_SOFTST_WIDTH 2 /* DC1_SOFTST - [9:8] */ | ||
517 | #define WM8400_DC1_OV_PROT 0x0080 /* DC1_OV_PROT */ | ||
518 | #define WM8400_DC1_OV_PROT_MASK 0x0080 /* DC1_OV_PROT */ | ||
519 | #define WM8400_DC1_OV_PROT_SHIFT 7 /* DC1_OV_PROT */ | ||
520 | #define WM8400_DC1_OV_PROT_WIDTH 1 /* DC1_OV_PROT */ | ||
521 | #define WM8400_DC1_VSEL_MASK 0x007F /* DC1_VSEL - [6:0] */ | ||
522 | #define WM8400_DC1_VSEL_SHIFT 0 /* DC1_VSEL - [6:0] */ | ||
523 | #define WM8400_DC1_VSEL_WIDTH 7 /* DC1_VSEL - [6:0] */ | ||
524 | |||
525 | /* | ||
526 | * R71 (0x47) - DCDC1 Control 2 | ||
527 | */ | ||
528 | #define WM8400_DC1_FRC_PWM 0x2000 /* DC1_FRC_PWM */ | ||
529 | #define WM8400_DC1_FRC_PWM_MASK 0x2000 /* DC1_FRC_PWM */ | ||
530 | #define WM8400_DC1_FRC_PWM_SHIFT 13 /* DC1_FRC_PWM */ | ||
531 | #define WM8400_DC1_FRC_PWM_WIDTH 1 /* DC1_FRC_PWM */ | ||
532 | #define WM8400_DC1_STBY_LIM_MASK 0x0300 /* DC1_STBY_LIM - [9:8] */ | ||
533 | #define WM8400_DC1_STBY_LIM_SHIFT 8 /* DC1_STBY_LIM - [9:8] */ | ||
534 | #define WM8400_DC1_STBY_LIM_WIDTH 2 /* DC1_STBY_LIM - [9:8] */ | ||
535 | #define WM8400_DC1_ACT_LIM 0x0080 /* DC1_ACT_LIM */ | ||
536 | #define WM8400_DC1_ACT_LIM_MASK 0x0080 /* DC1_ACT_LIM */ | ||
537 | #define WM8400_DC1_ACT_LIM_SHIFT 7 /* DC1_ACT_LIM */ | ||
538 | #define WM8400_DC1_ACT_LIM_WIDTH 1 /* DC1_ACT_LIM */ | ||
539 | #define WM8400_DC1_VIMG_MASK 0x007F /* DC1_VIMG - [6:0] */ | ||
540 | #define WM8400_DC1_VIMG_SHIFT 0 /* DC1_VIMG - [6:0] */ | ||
541 | #define WM8400_DC1_VIMG_WIDTH 7 /* DC1_VIMG - [6:0] */ | ||
542 | |||
543 | /* | ||
544 | * R72 (0x48) - DCDC2 Control 1 | ||
545 | */ | ||
546 | #define WM8400_DC2_ENA 0x8000 /* DC2_ENA */ | ||
547 | #define WM8400_DC2_ENA_MASK 0x8000 /* DC2_ENA */ | ||
548 | #define WM8400_DC2_ENA_SHIFT 15 /* DC2_ENA */ | ||
549 | #define WM8400_DC2_ENA_WIDTH 1 /* DC2_ENA */ | ||
550 | #define WM8400_DC2_ACTIVE 0x4000 /* DC2_ACTIVE */ | ||
551 | #define WM8400_DC2_ACTIVE_MASK 0x4000 /* DC2_ACTIVE */ | ||
552 | #define WM8400_DC2_ACTIVE_SHIFT 14 /* DC2_ACTIVE */ | ||
553 | #define WM8400_DC2_ACTIVE_WIDTH 1 /* DC2_ACTIVE */ | ||
554 | #define WM8400_DC2_SLEEP 0x2000 /* DC2_SLEEP */ | ||
555 | #define WM8400_DC2_SLEEP_MASK 0x2000 /* DC2_SLEEP */ | ||
556 | #define WM8400_DC2_SLEEP_SHIFT 13 /* DC2_SLEEP */ | ||
557 | #define WM8400_DC2_SLEEP_WIDTH 1 /* DC2_SLEEP */ | ||
558 | #define WM8400_DC2_OPFLT 0x1000 /* DC2_OPFLT */ | ||
559 | #define WM8400_DC2_OPFLT_MASK 0x1000 /* DC2_OPFLT */ | ||
560 | #define WM8400_DC2_OPFLT_SHIFT 12 /* DC2_OPFLT */ | ||
561 | #define WM8400_DC2_OPFLT_WIDTH 1 /* DC2_OPFLT */ | ||
562 | #define WM8400_DC2_ERRACT 0x0800 /* DC2_ERRACT */ | ||
563 | #define WM8400_DC2_ERRACT_MASK 0x0800 /* DC2_ERRACT */ | ||
564 | #define WM8400_DC2_ERRACT_SHIFT 11 /* DC2_ERRACT */ | ||
565 | #define WM8400_DC2_ERRACT_WIDTH 1 /* DC2_ERRACT */ | ||
566 | #define WM8400_DC2_HIB_MODE 0x0400 /* DC2_HIB_MODE */ | ||
567 | #define WM8400_DC2_HIB_MODE_MASK 0x0400 /* DC2_HIB_MODE */ | ||
568 | #define WM8400_DC2_HIB_MODE_SHIFT 10 /* DC2_HIB_MODE */ | ||
569 | #define WM8400_DC2_HIB_MODE_WIDTH 1 /* DC2_HIB_MODE */ | ||
570 | #define WM8400_DC2_SOFTST_MASK 0x0300 /* DC2_SOFTST - [9:8] */ | ||
571 | #define WM8400_DC2_SOFTST_SHIFT 8 /* DC2_SOFTST - [9:8] */ | ||
572 | #define WM8400_DC2_SOFTST_WIDTH 2 /* DC2_SOFTST - [9:8] */ | ||
573 | #define WM8400_DC2_OV_PROT 0x0080 /* DC2_OV_PROT */ | ||
574 | #define WM8400_DC2_OV_PROT_MASK 0x0080 /* DC2_OV_PROT */ | ||
575 | #define WM8400_DC2_OV_PROT_SHIFT 7 /* DC2_OV_PROT */ | ||
576 | #define WM8400_DC2_OV_PROT_WIDTH 1 /* DC2_OV_PROT */ | ||
577 | #define WM8400_DC2_VSEL_MASK 0x007F /* DC2_VSEL - [6:0] */ | ||
578 | #define WM8400_DC2_VSEL_SHIFT 0 /* DC2_VSEL - [6:0] */ | ||
579 | #define WM8400_DC2_VSEL_WIDTH 7 /* DC2_VSEL - [6:0] */ | ||
580 | |||
581 | /* | ||
582 | * R73 (0x49) - DCDC2 Control 2 | ||
583 | */ | ||
584 | #define WM8400_DC2_FRC_PWM 0x2000 /* DC2_FRC_PWM */ | ||
585 | #define WM8400_DC2_FRC_PWM_MASK 0x2000 /* DC2_FRC_PWM */ | ||
586 | #define WM8400_DC2_FRC_PWM_SHIFT 13 /* DC2_FRC_PWM */ | ||
587 | #define WM8400_DC2_FRC_PWM_WIDTH 1 /* DC2_FRC_PWM */ | ||
588 | #define WM8400_DC2_STBY_LIM_MASK 0x0300 /* DC2_STBY_LIM - [9:8] */ | ||
589 | #define WM8400_DC2_STBY_LIM_SHIFT 8 /* DC2_STBY_LIM - [9:8] */ | ||
590 | #define WM8400_DC2_STBY_LIM_WIDTH 2 /* DC2_STBY_LIM - [9:8] */ | ||
591 | #define WM8400_DC2_ACT_LIM 0x0080 /* DC2_ACT_LIM */ | ||
592 | #define WM8400_DC2_ACT_LIM_MASK 0x0080 /* DC2_ACT_LIM */ | ||
593 | #define WM8400_DC2_ACT_LIM_SHIFT 7 /* DC2_ACT_LIM */ | ||
594 | #define WM8400_DC2_ACT_LIM_WIDTH 1 /* DC2_ACT_LIM */ | ||
595 | #define WM8400_DC2_VIMG_MASK 0x007F /* DC2_VIMG - [6:0] */ | ||
596 | #define WM8400_DC2_VIMG_SHIFT 0 /* DC2_VIMG - [6:0] */ | ||
597 | #define WM8400_DC2_VIMG_WIDTH 7 /* DC2_VIMG - [6:0] */ | ||
598 | |||
599 | /* | ||
600 | * R75 (0x4B) - Interface | ||
601 | */ | ||
602 | #define WM8400_AUTOINC 0x0008 /* AUTOINC */ | ||
603 | #define WM8400_AUTOINC_MASK 0x0008 /* AUTOINC */ | ||
604 | #define WM8400_AUTOINC_SHIFT 3 /* AUTOINC */ | ||
605 | #define WM8400_AUTOINC_WIDTH 1 /* AUTOINC */ | ||
606 | #define WM8400_ARA_ENA 0x0004 /* ARA_ENA */ | ||
607 | #define WM8400_ARA_ENA_MASK 0x0004 /* ARA_ENA */ | ||
608 | #define WM8400_ARA_ENA_SHIFT 2 /* ARA_ENA */ | ||
609 | #define WM8400_ARA_ENA_WIDTH 1 /* ARA_ENA */ | ||
610 | #define WM8400_SPI_CFG 0x0002 /* SPI_CFG */ | ||
611 | #define WM8400_SPI_CFG_MASK 0x0002 /* SPI_CFG */ | ||
612 | #define WM8400_SPI_CFG_SHIFT 1 /* SPI_CFG */ | ||
613 | #define WM8400_SPI_CFG_WIDTH 1 /* SPI_CFG */ | ||
614 | |||
615 | /* | ||
616 | * R76 (0x4C) - PM GENERAL | ||
617 | */ | ||
618 | #define WM8400_CODEC_SOFTST 0x8000 /* CODEC_SOFTST */ | ||
619 | #define WM8400_CODEC_SOFTST_MASK 0x8000 /* CODEC_SOFTST */ | ||
620 | #define WM8400_CODEC_SOFTST_SHIFT 15 /* CODEC_SOFTST */ | ||
621 | #define WM8400_CODEC_SOFTST_WIDTH 1 /* CODEC_SOFTST */ | ||
622 | #define WM8400_CODEC_SOFTSD 0x4000 /* CODEC_SOFTSD */ | ||
623 | #define WM8400_CODEC_SOFTSD_MASK 0x4000 /* CODEC_SOFTSD */ | ||
624 | #define WM8400_CODEC_SOFTSD_SHIFT 14 /* CODEC_SOFTSD */ | ||
625 | #define WM8400_CODEC_SOFTSD_WIDTH 1 /* CODEC_SOFTSD */ | ||
626 | #define WM8400_CHIP_SOFTSD 0x2000 /* CHIP_SOFTSD */ | ||
627 | #define WM8400_CHIP_SOFTSD_MASK 0x2000 /* CHIP_SOFTSD */ | ||
628 | #define WM8400_CHIP_SOFTSD_SHIFT 13 /* CHIP_SOFTSD */ | ||
629 | #define WM8400_CHIP_SOFTSD_WIDTH 1 /* CHIP_SOFTSD */ | ||
630 | #define WM8400_DSLEEP1_POL 0x0008 /* DSLEEP1_POL */ | ||
631 | #define WM8400_DSLEEP1_POL_MASK 0x0008 /* DSLEEP1_POL */ | ||
632 | #define WM8400_DSLEEP1_POL_SHIFT 3 /* DSLEEP1_POL */ | ||
633 | #define WM8400_DSLEEP1_POL_WIDTH 1 /* DSLEEP1_POL */ | ||
634 | #define WM8400_DSLEEP2_POL 0x0004 /* DSLEEP2_POL */ | ||
635 | #define WM8400_DSLEEP2_POL_MASK 0x0004 /* DSLEEP2_POL */ | ||
636 | #define WM8400_DSLEEP2_POL_SHIFT 2 /* DSLEEP2_POL */ | ||
637 | #define WM8400_DSLEEP2_POL_WIDTH 1 /* DSLEEP2_POL */ | ||
638 | #define WM8400_PWR_STATE_MASK 0x0003 /* PWR_STATE - [1:0] */ | ||
639 | #define WM8400_PWR_STATE_SHIFT 0 /* PWR_STATE - [1:0] */ | ||
640 | #define WM8400_PWR_STATE_WIDTH 2 /* PWR_STATE - [1:0] */ | ||
641 | |||
642 | /* | ||
643 | * R78 (0x4E) - PM Shutdown Control | ||
644 | */ | ||
645 | #define WM8400_CHIP_GT150_ERRACT 0x0200 /* CHIP_GT150_ERRACT */ | ||
646 | #define WM8400_CHIP_GT150_ERRACT_MASK 0x0200 /* CHIP_GT150_ERRACT */ | ||
647 | #define WM8400_CHIP_GT150_ERRACT_SHIFT 9 /* CHIP_GT150_ERRACT */ | ||
648 | #define WM8400_CHIP_GT150_ERRACT_WIDTH 1 /* CHIP_GT150_ERRACT */ | ||
649 | #define WM8400_CHIP_GT115_ERRACT 0x0100 /* CHIP_GT115_ERRACT */ | ||
650 | #define WM8400_CHIP_GT115_ERRACT_MASK 0x0100 /* CHIP_GT115_ERRACT */ | ||
651 | #define WM8400_CHIP_GT115_ERRACT_SHIFT 8 /* CHIP_GT115_ERRACT */ | ||
652 | #define WM8400_CHIP_GT115_ERRACT_WIDTH 1 /* CHIP_GT115_ERRACT */ | ||
653 | #define WM8400_LINE_CMP_ERRACT 0x0080 /* LINE_CMP_ERRACT */ | ||
654 | #define WM8400_LINE_CMP_ERRACT_MASK 0x0080 /* LINE_CMP_ERRACT */ | ||
655 | #define WM8400_LINE_CMP_ERRACT_SHIFT 7 /* LINE_CMP_ERRACT */ | ||
656 | #define WM8400_LINE_CMP_ERRACT_WIDTH 1 /* LINE_CMP_ERRACT */ | ||
657 | #define WM8400_UVLO_ERRACT 0x0040 /* UVLO_ERRACT */ | ||
658 | #define WM8400_UVLO_ERRACT_MASK 0x0040 /* UVLO_ERRACT */ | ||
659 | #define WM8400_UVLO_ERRACT_SHIFT 6 /* UVLO_ERRACT */ | ||
660 | #define WM8400_UVLO_ERRACT_WIDTH 1 /* UVLO_ERRACT */ | ||
661 | |||
662 | /* | ||
663 | * R79 (0x4F) - Interrupt Status 1 | ||
664 | */ | ||
665 | #define WM8400_MICD_CINT 0x8000 /* MICD_CINT */ | ||
666 | #define WM8400_MICD_CINT_MASK 0x8000 /* MICD_CINT */ | ||
667 | #define WM8400_MICD_CINT_SHIFT 15 /* MICD_CINT */ | ||
668 | #define WM8400_MICD_CINT_WIDTH 1 /* MICD_CINT */ | ||
669 | #define WM8400_MICSCD_CINT 0x4000 /* MICSCD_CINT */ | ||
670 | #define WM8400_MICSCD_CINT_MASK 0x4000 /* MICSCD_CINT */ | ||
671 | #define WM8400_MICSCD_CINT_SHIFT 14 /* MICSCD_CINT */ | ||
672 | #define WM8400_MICSCD_CINT_WIDTH 1 /* MICSCD_CINT */ | ||
673 | #define WM8400_JDL_CINT 0x2000 /* JDL_CINT */ | ||
674 | #define WM8400_JDL_CINT_MASK 0x2000 /* JDL_CINT */ | ||
675 | #define WM8400_JDL_CINT_SHIFT 13 /* JDL_CINT */ | ||
676 | #define WM8400_JDL_CINT_WIDTH 1 /* JDL_CINT */ | ||
677 | #define WM8400_JDR_CINT 0x1000 /* JDR_CINT */ | ||
678 | #define WM8400_JDR_CINT_MASK 0x1000 /* JDR_CINT */ | ||
679 | #define WM8400_JDR_CINT_SHIFT 12 /* JDR_CINT */ | ||
680 | #define WM8400_JDR_CINT_WIDTH 1 /* JDR_CINT */ | ||
681 | #define WM8400_CODEC_SEQ_END_EINT 0x0800 /* CODEC_SEQ_END_EINT */ | ||
682 | #define WM8400_CODEC_SEQ_END_EINT_MASK 0x0800 /* CODEC_SEQ_END_EINT */ | ||
683 | #define WM8400_CODEC_SEQ_END_EINT_SHIFT 11 /* CODEC_SEQ_END_EINT */ | ||
684 | #define WM8400_CODEC_SEQ_END_EINT_WIDTH 1 /* CODEC_SEQ_END_EINT */ | ||
685 | #define WM8400_CDEL_TO_EINT 0x0400 /* CDEL_TO_EINT */ | ||
686 | #define WM8400_CDEL_TO_EINT_MASK 0x0400 /* CDEL_TO_EINT */ | ||
687 | #define WM8400_CDEL_TO_EINT_SHIFT 10 /* CDEL_TO_EINT */ | ||
688 | #define WM8400_CDEL_TO_EINT_WIDTH 1 /* CDEL_TO_EINT */ | ||
689 | #define WM8400_CHIP_GT150_EINT 0x0200 /* CHIP_GT150_EINT */ | ||
690 | #define WM8400_CHIP_GT150_EINT_MASK 0x0200 /* CHIP_GT150_EINT */ | ||
691 | #define WM8400_CHIP_GT150_EINT_SHIFT 9 /* CHIP_GT150_EINT */ | ||
692 | #define WM8400_CHIP_GT150_EINT_WIDTH 1 /* CHIP_GT150_EINT */ | ||
693 | #define WM8400_CHIP_GT115_EINT 0x0100 /* CHIP_GT115_EINT */ | ||
694 | #define WM8400_CHIP_GT115_EINT_MASK 0x0100 /* CHIP_GT115_EINT */ | ||
695 | #define WM8400_CHIP_GT115_EINT_SHIFT 8 /* CHIP_GT115_EINT */ | ||
696 | #define WM8400_CHIP_GT115_EINT_WIDTH 1 /* CHIP_GT115_EINT */ | ||
697 | #define WM8400_LINE_CMP_EINT 0x0080 /* LINE_CMP_EINT */ | ||
698 | #define WM8400_LINE_CMP_EINT_MASK 0x0080 /* LINE_CMP_EINT */ | ||
699 | #define WM8400_LINE_CMP_EINT_SHIFT 7 /* LINE_CMP_EINT */ | ||
700 | #define WM8400_LINE_CMP_EINT_WIDTH 1 /* LINE_CMP_EINT */ | ||
701 | #define WM8400_UVLO_EINT 0x0040 /* UVLO_EINT */ | ||
702 | #define WM8400_UVLO_EINT_MASK 0x0040 /* UVLO_EINT */ | ||
703 | #define WM8400_UVLO_EINT_SHIFT 6 /* UVLO_EINT */ | ||
704 | #define WM8400_UVLO_EINT_WIDTH 1 /* UVLO_EINT */ | ||
705 | #define WM8400_DC2_UV_EINT 0x0020 /* DC2_UV_EINT */ | ||
706 | #define WM8400_DC2_UV_EINT_MASK 0x0020 /* DC2_UV_EINT */ | ||
707 | #define WM8400_DC2_UV_EINT_SHIFT 5 /* DC2_UV_EINT */ | ||
708 | #define WM8400_DC2_UV_EINT_WIDTH 1 /* DC2_UV_EINT */ | ||
709 | #define WM8400_DC1_UV_EINT 0x0010 /* DC1_UV_EINT */ | ||
710 | #define WM8400_DC1_UV_EINT_MASK 0x0010 /* DC1_UV_EINT */ | ||
711 | #define WM8400_DC1_UV_EINT_SHIFT 4 /* DC1_UV_EINT */ | ||
712 | #define WM8400_DC1_UV_EINT_WIDTH 1 /* DC1_UV_EINT */ | ||
713 | #define WM8400_LDO4_UV_EINT 0x0008 /* LDO4_UV_EINT */ | ||
714 | #define WM8400_LDO4_UV_EINT_MASK 0x0008 /* LDO4_UV_EINT */ | ||
715 | #define WM8400_LDO4_UV_EINT_SHIFT 3 /* LDO4_UV_EINT */ | ||
716 | #define WM8400_LDO4_UV_EINT_WIDTH 1 /* LDO4_UV_EINT */ | ||
717 | #define WM8400_LDO3_UV_EINT 0x0004 /* LDO3_UV_EINT */ | ||
718 | #define WM8400_LDO3_UV_EINT_MASK 0x0004 /* LDO3_UV_EINT */ | ||
719 | #define WM8400_LDO3_UV_EINT_SHIFT 2 /* LDO3_UV_EINT */ | ||
720 | #define WM8400_LDO3_UV_EINT_WIDTH 1 /* LDO3_UV_EINT */ | ||
721 | #define WM8400_LDO2_UV_EINT 0x0002 /* LDO2_UV_EINT */ | ||
722 | #define WM8400_LDO2_UV_EINT_MASK 0x0002 /* LDO2_UV_EINT */ | ||
723 | #define WM8400_LDO2_UV_EINT_SHIFT 1 /* LDO2_UV_EINT */ | ||
724 | #define WM8400_LDO2_UV_EINT_WIDTH 1 /* LDO2_UV_EINT */ | ||
725 | #define WM8400_LDO1_UV_EINT 0x0001 /* LDO1_UV_EINT */ | ||
726 | #define WM8400_LDO1_UV_EINT_MASK 0x0001 /* LDO1_UV_EINT */ | ||
727 | #define WM8400_LDO1_UV_EINT_SHIFT 0 /* LDO1_UV_EINT */ | ||
728 | #define WM8400_LDO1_UV_EINT_WIDTH 1 /* LDO1_UV_EINT */ | ||
729 | |||
730 | /* | ||
731 | * R80 (0x50) - Interrupt Status 1 Mask | ||
732 | */ | ||
733 | #define WM8400_IM_MICD_CINT 0x8000 /* IM_MICD_CINT */ | ||
734 | #define WM8400_IM_MICD_CINT_MASK 0x8000 /* IM_MICD_CINT */ | ||
735 | #define WM8400_IM_MICD_CINT_SHIFT 15 /* IM_MICD_CINT */ | ||
736 | #define WM8400_IM_MICD_CINT_WIDTH 1 /* IM_MICD_CINT */ | ||
737 | #define WM8400_IM_MICSCD_CINT 0x4000 /* IM_MICSCD_CINT */ | ||
738 | #define WM8400_IM_MICSCD_CINT_MASK 0x4000 /* IM_MICSCD_CINT */ | ||
739 | #define WM8400_IM_MICSCD_CINT_SHIFT 14 /* IM_MICSCD_CINT */ | ||
740 | #define WM8400_IM_MICSCD_CINT_WIDTH 1 /* IM_MICSCD_CINT */ | ||
741 | #define WM8400_IM_JDL_CINT 0x2000 /* IM_JDL_CINT */ | ||
742 | #define WM8400_IM_JDL_CINT_MASK 0x2000 /* IM_JDL_CINT */ | ||
743 | #define WM8400_IM_JDL_CINT_SHIFT 13 /* IM_JDL_CINT */ | ||
744 | #define WM8400_IM_JDL_CINT_WIDTH 1 /* IM_JDL_CINT */ | ||
745 | #define WM8400_IM_JDR_CINT 0x1000 /* IM_JDR_CINT */ | ||
746 | #define WM8400_IM_JDR_CINT_MASK 0x1000 /* IM_JDR_CINT */ | ||
747 | #define WM8400_IM_JDR_CINT_SHIFT 12 /* IM_JDR_CINT */ | ||
748 | #define WM8400_IM_JDR_CINT_WIDTH 1 /* IM_JDR_CINT */ | ||
749 | #define WM8400_IM_CODEC_SEQ_END_EINT 0x0800 /* IM_CODEC_SEQ_END_EINT */ | ||
750 | #define WM8400_IM_CODEC_SEQ_END_EINT_MASK 0x0800 /* IM_CODEC_SEQ_END_EINT */ | ||
751 | #define WM8400_IM_CODEC_SEQ_END_EINT_SHIFT 11 /* IM_CODEC_SEQ_END_EINT */ | ||
752 | #define WM8400_IM_CODEC_SEQ_END_EINT_WIDTH 1 /* IM_CODEC_SEQ_END_EINT */ | ||
753 | #define WM8400_IM_CDEL_TO_EINT 0x0400 /* IM_CDEL_TO_EINT */ | ||
754 | #define WM8400_IM_CDEL_TO_EINT_MASK 0x0400 /* IM_CDEL_TO_EINT */ | ||
755 | #define WM8400_IM_CDEL_TO_EINT_SHIFT 10 /* IM_CDEL_TO_EINT */ | ||
756 | #define WM8400_IM_CDEL_TO_EINT_WIDTH 1 /* IM_CDEL_TO_EINT */ | ||
757 | #define WM8400_IM_CHIP_GT150_EINT 0x0200 /* IM_CHIP_GT150_EINT */ | ||
758 | #define WM8400_IM_CHIP_GT150_EINT_MASK 0x0200 /* IM_CHIP_GT150_EINT */ | ||
759 | #define WM8400_IM_CHIP_GT150_EINT_SHIFT 9 /* IM_CHIP_GT150_EINT */ | ||
760 | #define WM8400_IM_CHIP_GT150_EINT_WIDTH 1 /* IM_CHIP_GT150_EINT */ | ||
761 | #define WM8400_IM_CHIP_GT115_EINT 0x0100 /* IM_CHIP_GT115_EINT */ | ||
762 | #define WM8400_IM_CHIP_GT115_EINT_MASK 0x0100 /* IM_CHIP_GT115_EINT */ | ||
763 | #define WM8400_IM_CHIP_GT115_EINT_SHIFT 8 /* IM_CHIP_GT115_EINT */ | ||
764 | #define WM8400_IM_CHIP_GT115_EINT_WIDTH 1 /* IM_CHIP_GT115_EINT */ | ||
765 | #define WM8400_IM_LINE_CMP_EINT 0x0080 /* IM_LINE_CMP_EINT */ | ||
766 | #define WM8400_IM_LINE_CMP_EINT_MASK 0x0080 /* IM_LINE_CMP_EINT */ | ||
767 | #define WM8400_IM_LINE_CMP_EINT_SHIFT 7 /* IM_LINE_CMP_EINT */ | ||
768 | #define WM8400_IM_LINE_CMP_EINT_WIDTH 1 /* IM_LINE_CMP_EINT */ | ||
769 | #define WM8400_IM_UVLO_EINT 0x0040 /* IM_UVLO_EINT */ | ||
770 | #define WM8400_IM_UVLO_EINT_MASK 0x0040 /* IM_UVLO_EINT */ | ||
771 | #define WM8400_IM_UVLO_EINT_SHIFT 6 /* IM_UVLO_EINT */ | ||
772 | #define WM8400_IM_UVLO_EINT_WIDTH 1 /* IM_UVLO_EINT */ | ||
773 | #define WM8400_IM_DC2_UV_EINT 0x0020 /* IM_DC2_UV_EINT */ | ||
774 | #define WM8400_IM_DC2_UV_EINT_MASK 0x0020 /* IM_DC2_UV_EINT */ | ||
775 | #define WM8400_IM_DC2_UV_EINT_SHIFT 5 /* IM_DC2_UV_EINT */ | ||
776 | #define WM8400_IM_DC2_UV_EINT_WIDTH 1 /* IM_DC2_UV_EINT */ | ||
777 | #define WM8400_IM_DC1_UV_EINT 0x0010 /* IM_DC1_UV_EINT */ | ||
778 | #define WM8400_IM_DC1_UV_EINT_MASK 0x0010 /* IM_DC1_UV_EINT */ | ||
779 | #define WM8400_IM_DC1_UV_EINT_SHIFT 4 /* IM_DC1_UV_EINT */ | ||
780 | #define WM8400_IM_DC1_UV_EINT_WIDTH 1 /* IM_DC1_UV_EINT */ | ||
781 | #define WM8400_IM_LDO4_UV_EINT 0x0008 /* IM_LDO4_UV_EINT */ | ||
782 | #define WM8400_IM_LDO4_UV_EINT_MASK 0x0008 /* IM_LDO4_UV_EINT */ | ||
783 | #define WM8400_IM_LDO4_UV_EINT_SHIFT 3 /* IM_LDO4_UV_EINT */ | ||
784 | #define WM8400_IM_LDO4_UV_EINT_WIDTH 1 /* IM_LDO4_UV_EINT */ | ||
785 | #define WM8400_IM_LDO3_UV_EINT 0x0004 /* IM_LDO3_UV_EINT */ | ||
786 | #define WM8400_IM_LDO3_UV_EINT_MASK 0x0004 /* IM_LDO3_UV_EINT */ | ||
787 | #define WM8400_IM_LDO3_UV_EINT_SHIFT 2 /* IM_LDO3_UV_EINT */ | ||
788 | #define WM8400_IM_LDO3_UV_EINT_WIDTH 1 /* IM_LDO3_UV_EINT */ | ||
789 | #define WM8400_IM_LDO2_UV_EINT 0x0002 /* IM_LDO2_UV_EINT */ | ||
790 | #define WM8400_IM_LDO2_UV_EINT_MASK 0x0002 /* IM_LDO2_UV_EINT */ | ||
791 | #define WM8400_IM_LDO2_UV_EINT_SHIFT 1 /* IM_LDO2_UV_EINT */ | ||
792 | #define WM8400_IM_LDO2_UV_EINT_WIDTH 1 /* IM_LDO2_UV_EINT */ | ||
793 | #define WM8400_IM_LDO1_UV_EINT 0x0001 /* IM_LDO1_UV_EINT */ | ||
794 | #define WM8400_IM_LDO1_UV_EINT_MASK 0x0001 /* IM_LDO1_UV_EINT */ | ||
795 | #define WM8400_IM_LDO1_UV_EINT_SHIFT 0 /* IM_LDO1_UV_EINT */ | ||
796 | #define WM8400_IM_LDO1_UV_EINT_WIDTH 1 /* IM_LDO1_UV_EINT */ | ||
797 | |||
798 | /* | ||
799 | * R81 (0x51) - Interrupt Levels | ||
800 | */ | ||
801 | #define WM8400_MICD_LVL 0x8000 /* MICD_LVL */ | ||
802 | #define WM8400_MICD_LVL_MASK 0x8000 /* MICD_LVL */ | ||
803 | #define WM8400_MICD_LVL_SHIFT 15 /* MICD_LVL */ | ||
804 | #define WM8400_MICD_LVL_WIDTH 1 /* MICD_LVL */ | ||
805 | #define WM8400_MICSCD_LVL 0x4000 /* MICSCD_LVL */ | ||
806 | #define WM8400_MICSCD_LVL_MASK 0x4000 /* MICSCD_LVL */ | ||
807 | #define WM8400_MICSCD_LVL_SHIFT 14 /* MICSCD_LVL */ | ||
808 | #define WM8400_MICSCD_LVL_WIDTH 1 /* MICSCD_LVL */ | ||
809 | #define WM8400_JDL_LVL 0x2000 /* JDL_LVL */ | ||
810 | #define WM8400_JDL_LVL_MASK 0x2000 /* JDL_LVL */ | ||
811 | #define WM8400_JDL_LVL_SHIFT 13 /* JDL_LVL */ | ||
812 | #define WM8400_JDL_LVL_WIDTH 1 /* JDL_LVL */ | ||
813 | #define WM8400_JDR_LVL 0x1000 /* JDR_LVL */ | ||
814 | #define WM8400_JDR_LVL_MASK 0x1000 /* JDR_LVL */ | ||
815 | #define WM8400_JDR_LVL_SHIFT 12 /* JDR_LVL */ | ||
816 | #define WM8400_JDR_LVL_WIDTH 1 /* JDR_LVL */ | ||
817 | #define WM8400_CODEC_SEQ_END_LVL 0x0800 /* CODEC_SEQ_END_LVL */ | ||
818 | #define WM8400_CODEC_SEQ_END_LVL_MASK 0x0800 /* CODEC_SEQ_END_LVL */ | ||
819 | #define WM8400_CODEC_SEQ_END_LVL_SHIFT 11 /* CODEC_SEQ_END_LVL */ | ||
820 | #define WM8400_CODEC_SEQ_END_LVL_WIDTH 1 /* CODEC_SEQ_END_LVL */ | ||
821 | #define WM8400_CDEL_TO_LVL 0x0400 /* CDEL_TO_LVL */ | ||
822 | #define WM8400_CDEL_TO_LVL_MASK 0x0400 /* CDEL_TO_LVL */ | ||
823 | #define WM8400_CDEL_TO_LVL_SHIFT 10 /* CDEL_TO_LVL */ | ||
824 | #define WM8400_CDEL_TO_LVL_WIDTH 1 /* CDEL_TO_LVL */ | ||
825 | #define WM8400_CHIP_GT150_LVL 0x0200 /* CHIP_GT150_LVL */ | ||
826 | #define WM8400_CHIP_GT150_LVL_MASK 0x0200 /* CHIP_GT150_LVL */ | ||
827 | #define WM8400_CHIP_GT150_LVL_SHIFT 9 /* CHIP_GT150_LVL */ | ||
828 | #define WM8400_CHIP_GT150_LVL_WIDTH 1 /* CHIP_GT150_LVL */ | ||
829 | #define WM8400_CHIP_GT115_LVL 0x0100 /* CHIP_GT115_LVL */ | ||
830 | #define WM8400_CHIP_GT115_LVL_MASK 0x0100 /* CHIP_GT115_LVL */ | ||
831 | #define WM8400_CHIP_GT115_LVL_SHIFT 8 /* CHIP_GT115_LVL */ | ||
832 | #define WM8400_CHIP_GT115_LVL_WIDTH 1 /* CHIP_GT115_LVL */ | ||
833 | #define WM8400_LINE_CMP_LVL 0x0080 /* LINE_CMP_LVL */ | ||
834 | #define WM8400_LINE_CMP_LVL_MASK 0x0080 /* LINE_CMP_LVL */ | ||
835 | #define WM8400_LINE_CMP_LVL_SHIFT 7 /* LINE_CMP_LVL */ | ||
836 | #define WM8400_LINE_CMP_LVL_WIDTH 1 /* LINE_CMP_LVL */ | ||
837 | #define WM8400_UVLO_LVL 0x0040 /* UVLO_LVL */ | ||
838 | #define WM8400_UVLO_LVL_MASK 0x0040 /* UVLO_LVL */ | ||
839 | #define WM8400_UVLO_LVL_SHIFT 6 /* UVLO_LVL */ | ||
840 | #define WM8400_UVLO_LVL_WIDTH 1 /* UVLO_LVL */ | ||
841 | #define WM8400_DC2_UV_LVL 0x0020 /* DC2_UV_LVL */ | ||
842 | #define WM8400_DC2_UV_LVL_MASK 0x0020 /* DC2_UV_LVL */ | ||
843 | #define WM8400_DC2_UV_LVL_SHIFT 5 /* DC2_UV_LVL */ | ||
844 | #define WM8400_DC2_UV_LVL_WIDTH 1 /* DC2_UV_LVL */ | ||
845 | #define WM8400_DC1_UV_LVL 0x0010 /* DC1_UV_LVL */ | ||
846 | #define WM8400_DC1_UV_LVL_MASK 0x0010 /* DC1_UV_LVL */ | ||
847 | #define WM8400_DC1_UV_LVL_SHIFT 4 /* DC1_UV_LVL */ | ||
848 | #define WM8400_DC1_UV_LVL_WIDTH 1 /* DC1_UV_LVL */ | ||
849 | #define WM8400_LDO4_UV_LVL 0x0008 /* LDO4_UV_LVL */ | ||
850 | #define WM8400_LDO4_UV_LVL_MASK 0x0008 /* LDO4_UV_LVL */ | ||
851 | #define WM8400_LDO4_UV_LVL_SHIFT 3 /* LDO4_UV_LVL */ | ||
852 | #define WM8400_LDO4_UV_LVL_WIDTH 1 /* LDO4_UV_LVL */ | ||
853 | #define WM8400_LDO3_UV_LVL 0x0004 /* LDO3_UV_LVL */ | ||
854 | #define WM8400_LDO3_UV_LVL_MASK 0x0004 /* LDO3_UV_LVL */ | ||
855 | #define WM8400_LDO3_UV_LVL_SHIFT 2 /* LDO3_UV_LVL */ | ||
856 | #define WM8400_LDO3_UV_LVL_WIDTH 1 /* LDO3_UV_LVL */ | ||
857 | #define WM8400_LDO2_UV_LVL 0x0002 /* LDO2_UV_LVL */ | ||
858 | #define WM8400_LDO2_UV_LVL_MASK 0x0002 /* LDO2_UV_LVL */ | ||
859 | #define WM8400_LDO2_UV_LVL_SHIFT 1 /* LDO2_UV_LVL */ | ||
860 | #define WM8400_LDO2_UV_LVL_WIDTH 1 /* LDO2_UV_LVL */ | ||
861 | #define WM8400_LDO1_UV_LVL 0x0001 /* LDO1_UV_LVL */ | ||
862 | #define WM8400_LDO1_UV_LVL_MASK 0x0001 /* LDO1_UV_LVL */ | ||
863 | #define WM8400_LDO1_UV_LVL_SHIFT 0 /* LDO1_UV_LVL */ | ||
864 | #define WM8400_LDO1_UV_LVL_WIDTH 1 /* LDO1_UV_LVL */ | ||
865 | |||
866 | /* | ||
867 | * R82 (0x52) - Shutdown Reason | ||
868 | */ | ||
869 | #define WM8400_SDR_CHIP_SOFTSD 0x2000 /* SDR_CHIP_SOFTSD */ | ||
870 | #define WM8400_SDR_CHIP_SOFTSD_MASK 0x2000 /* SDR_CHIP_SOFTSD */ | ||
871 | #define WM8400_SDR_CHIP_SOFTSD_SHIFT 13 /* SDR_CHIP_SOFTSD */ | ||
872 | #define WM8400_SDR_CHIP_SOFTSD_WIDTH 1 /* SDR_CHIP_SOFTSD */ | ||
873 | #define WM8400_SDR_NPDN 0x0800 /* SDR_NPDN */ | ||
874 | #define WM8400_SDR_NPDN_MASK 0x0800 /* SDR_NPDN */ | ||
875 | #define WM8400_SDR_NPDN_SHIFT 11 /* SDR_NPDN */ | ||
876 | #define WM8400_SDR_NPDN_WIDTH 1 /* SDR_NPDN */ | ||
877 | #define WM8400_SDR_CHIP_GT150 0x0200 /* SDR_CHIP_GT150 */ | ||
878 | #define WM8400_SDR_CHIP_GT150_MASK 0x0200 /* SDR_CHIP_GT150 */ | ||
879 | #define WM8400_SDR_CHIP_GT150_SHIFT 9 /* SDR_CHIP_GT150 */ | ||
880 | #define WM8400_SDR_CHIP_GT150_WIDTH 1 /* SDR_CHIP_GT150 */ | ||
881 | #define WM8400_SDR_CHIP_GT115 0x0100 /* SDR_CHIP_GT115 */ | ||
882 | #define WM8400_SDR_CHIP_GT115_MASK 0x0100 /* SDR_CHIP_GT115 */ | ||
883 | #define WM8400_SDR_CHIP_GT115_SHIFT 8 /* SDR_CHIP_GT115 */ | ||
884 | #define WM8400_SDR_CHIP_GT115_WIDTH 1 /* SDR_CHIP_GT115 */ | ||
885 | #define WM8400_SDR_LINE_CMP 0x0080 /* SDR_LINE_CMP */ | ||
886 | #define WM8400_SDR_LINE_CMP_MASK 0x0080 /* SDR_LINE_CMP */ | ||
887 | #define WM8400_SDR_LINE_CMP_SHIFT 7 /* SDR_LINE_CMP */ | ||
888 | #define WM8400_SDR_LINE_CMP_WIDTH 1 /* SDR_LINE_CMP */ | ||
889 | #define WM8400_SDR_UVLO 0x0040 /* SDR_UVLO */ | ||
890 | #define WM8400_SDR_UVLO_MASK 0x0040 /* SDR_UVLO */ | ||
891 | #define WM8400_SDR_UVLO_SHIFT 6 /* SDR_UVLO */ | ||
892 | #define WM8400_SDR_UVLO_WIDTH 1 /* SDR_UVLO */ | ||
893 | #define WM8400_SDR_DC2_UV 0x0020 /* SDR_DC2_UV */ | ||
894 | #define WM8400_SDR_DC2_UV_MASK 0x0020 /* SDR_DC2_UV */ | ||
895 | #define WM8400_SDR_DC2_UV_SHIFT 5 /* SDR_DC2_UV */ | ||
896 | #define WM8400_SDR_DC2_UV_WIDTH 1 /* SDR_DC2_UV */ | ||
897 | #define WM8400_SDR_DC1_UV 0x0010 /* SDR_DC1_UV */ | ||
898 | #define WM8400_SDR_DC1_UV_MASK 0x0010 /* SDR_DC1_UV */ | ||
899 | #define WM8400_SDR_DC1_UV_SHIFT 4 /* SDR_DC1_UV */ | ||
900 | #define WM8400_SDR_DC1_UV_WIDTH 1 /* SDR_DC1_UV */ | ||
901 | #define WM8400_SDR_LDO4_UV 0x0008 /* SDR_LDO4_UV */ | ||
902 | #define WM8400_SDR_LDO4_UV_MASK 0x0008 /* SDR_LDO4_UV */ | ||
903 | #define WM8400_SDR_LDO4_UV_SHIFT 3 /* SDR_LDO4_UV */ | ||
904 | #define WM8400_SDR_LDO4_UV_WIDTH 1 /* SDR_LDO4_UV */ | ||
905 | #define WM8400_SDR_LDO3_UV 0x0004 /* SDR_LDO3_UV */ | ||
906 | #define WM8400_SDR_LDO3_UV_MASK 0x0004 /* SDR_LDO3_UV */ | ||
907 | #define WM8400_SDR_LDO3_UV_SHIFT 2 /* SDR_LDO3_UV */ | ||
908 | #define WM8400_SDR_LDO3_UV_WIDTH 1 /* SDR_LDO3_UV */ | ||
909 | #define WM8400_SDR_LDO2_UV 0x0002 /* SDR_LDO2_UV */ | ||
910 | #define WM8400_SDR_LDO2_UV_MASK 0x0002 /* SDR_LDO2_UV */ | ||
911 | #define WM8400_SDR_LDO2_UV_SHIFT 1 /* SDR_LDO2_UV */ | ||
912 | #define WM8400_SDR_LDO2_UV_WIDTH 1 /* SDR_LDO2_UV */ | ||
913 | #define WM8400_SDR_LDO1_UV 0x0001 /* SDR_LDO1_UV */ | ||
914 | #define WM8400_SDR_LDO1_UV_MASK 0x0001 /* SDR_LDO1_UV */ | ||
915 | #define WM8400_SDR_LDO1_UV_SHIFT 0 /* SDR_LDO1_UV */ | ||
916 | #define WM8400_SDR_LDO1_UV_WIDTH 1 /* SDR_LDO1_UV */ | ||
917 | |||
918 | /* | ||
919 | * R84 (0x54) - Line Circuits | ||
920 | */ | ||
921 | #define WM8400_BG_LINE_COMP 0x8000 /* BG_LINE_COMP */ | ||
922 | #define WM8400_BG_LINE_COMP_MASK 0x8000 /* BG_LINE_COMP */ | ||
923 | #define WM8400_BG_LINE_COMP_SHIFT 15 /* BG_LINE_COMP */ | ||
924 | #define WM8400_BG_LINE_COMP_WIDTH 1 /* BG_LINE_COMP */ | ||
925 | #define WM8400_LINE_CMP_VTHI_MASK 0x00F0 /* LINE_CMP_VTHI - [7:4] */ | ||
926 | #define WM8400_LINE_CMP_VTHI_SHIFT 4 /* LINE_CMP_VTHI - [7:4] */ | ||
927 | #define WM8400_LINE_CMP_VTHI_WIDTH 4 /* LINE_CMP_VTHI - [7:4] */ | ||
928 | #define WM8400_LINE_CMP_VTHD_MASK 0x000F /* LINE_CMP_VTHD - [3:0] */ | ||
929 | #define WM8400_LINE_CMP_VTHD_SHIFT 0 /* LINE_CMP_VTHD - [3:0] */ | ||
930 | #define WM8400_LINE_CMP_VTHD_WIDTH 4 /* LINE_CMP_VTHD - [3:0] */ | ||
931 | |||
932 | u16 wm8400_reg_read(struct wm8400 *wm8400, u8 reg); | ||
933 | int wm8400_block_read(struct wm8400 *wm8400, u8 reg, int count, u16 *data); | ||
934 | int wm8400_set_bits(struct wm8400 *wm8400, u8 reg, u16 mask, u16 val); | ||
935 | |||
936 | #endif | ||
diff --git a/include/linux/mfd/wm8400.h b/include/linux/mfd/wm8400.h new file mode 100644 index 000000000000..b46b566ac1ac --- /dev/null +++ b/include/linux/mfd/wm8400.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * wm8400 client interface | ||
3 | * | ||
4 | * Copyright 2008 Wolfson Microelectronics plc | ||
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., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef __LINUX_MFD_WM8400_H | ||
22 | #define __LINUX_MFD_WM8400_H | ||
23 | |||
24 | #include <linux/regulator/machine.h> | ||
25 | |||
26 | #define WM8400_LDO1 0 | ||
27 | #define WM8400_LDO2 1 | ||
28 | #define WM8400_LDO3 2 | ||
29 | #define WM8400_LDO4 3 | ||
30 | #define WM8400_DCDC1 4 | ||
31 | #define WM8400_DCDC2 5 | ||
32 | |||
33 | struct wm8400_platform_data { | ||
34 | int (*platform_init)(struct device *dev); | ||
35 | }; | ||
36 | |||
37 | int wm8400_register_regulator(struct device *dev, int reg, | ||
38 | struct regulator_init_data *initdata); | ||
39 | |||
40 | #endif | ||
diff --git a/include/linux/migrate.h b/include/linux/migrate.h index 03aea612d284..3f34005068d4 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h | |||
@@ -7,7 +7,6 @@ | |||
7 | typedef struct page *new_page_t(struct page *, unsigned long private, int **); | 7 | typedef struct page *new_page_t(struct page *, unsigned long private, int **); |
8 | 8 | ||
9 | #ifdef CONFIG_MIGRATION | 9 | #ifdef CONFIG_MIGRATION |
10 | extern int isolate_lru_page(struct page *p, struct list_head *pagelist); | ||
11 | extern int putback_lru_pages(struct list_head *l); | 10 | extern int putback_lru_pages(struct list_head *l); |
12 | extern int migrate_page(struct address_space *, | 11 | extern int migrate_page(struct address_space *, |
13 | struct page *, struct page *); | 12 | struct page *, struct page *); |
@@ -21,8 +20,6 @@ extern int migrate_vmas(struct mm_struct *mm, | |||
21 | const nodemask_t *from, const nodemask_t *to, | 20 | const nodemask_t *from, const nodemask_t *to, |
22 | unsigned long flags); | 21 | unsigned long flags); |
23 | #else | 22 | #else |
24 | static inline int isolate_lru_page(struct page *p, struct list_head *list) | ||
25 | { return -ENOSYS; } | ||
26 | static inline int putback_lru_pages(struct list_head *l) { return 0; } | 23 | static inline int putback_lru_pages(struct list_head *l) { return 0; } |
27 | static inline int migrate_pages(struct list_head *l, new_page_t x, | 24 | static inline int migrate_pages(struct list_head *l, new_page_t x, |
28 | unsigned long private) { return -ENOSYS; } | 25 | unsigned long private) { return -ENOSYS; } |
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h index 77323a72dd3c..cf9c679ab38b 100644 --- a/include/linux/mlx4/cmd.h +++ b/include/linux/mlx4/cmd.h | |||
@@ -132,6 +132,15 @@ enum { | |||
132 | MLX4_MAILBOX_SIZE = 4096 | 132 | MLX4_MAILBOX_SIZE = 4096 |
133 | }; | 133 | }; |
134 | 134 | ||
135 | enum { | ||
136 | /* set port opcode modifiers */ | ||
137 | MLX4_SET_PORT_GENERAL = 0x0, | ||
138 | MLX4_SET_PORT_RQP_CALC = 0x1, | ||
139 | MLX4_SET_PORT_MAC_TABLE = 0x2, | ||
140 | MLX4_SET_PORT_VLAN_TABLE = 0x3, | ||
141 | MLX4_SET_PORT_PRIO_MAP = 0x4, | ||
142 | }; | ||
143 | |||
135 | struct mlx4_dev; | 144 | struct mlx4_dev; |
136 | 145 | ||
137 | struct mlx4_cmd_mailbox { | 146 | struct mlx4_cmd_mailbox { |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index b2f944468313..bd9977b89490 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -60,6 +60,7 @@ enum { | |||
60 | MLX4_DEV_CAP_FLAG_IPOIB_CSUM = 1 << 7, | 60 | MLX4_DEV_CAP_FLAG_IPOIB_CSUM = 1 << 7, |
61 | MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1 << 8, | 61 | MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1 << 8, |
62 | MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1 << 9, | 62 | MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1 << 9, |
63 | MLX4_DEV_CAP_FLAG_DPDP = 1 << 12, | ||
63 | MLX4_DEV_CAP_FLAG_MEM_WINDOW = 1 << 16, | 64 | MLX4_DEV_CAP_FLAG_MEM_WINDOW = 1 << 16, |
64 | MLX4_DEV_CAP_FLAG_APM = 1 << 17, | 65 | MLX4_DEV_CAP_FLAG_APM = 1 << 17, |
65 | MLX4_DEV_CAP_FLAG_ATOMIC = 1 << 18, | 66 | MLX4_DEV_CAP_FLAG_ATOMIC = 1 << 18, |
@@ -145,6 +146,29 @@ enum { | |||
145 | MLX4_MTT_FLAG_PRESENT = 1 | 146 | MLX4_MTT_FLAG_PRESENT = 1 |
146 | }; | 147 | }; |
147 | 148 | ||
149 | enum mlx4_qp_region { | ||
150 | MLX4_QP_REGION_FW = 0, | ||
151 | MLX4_QP_REGION_ETH_ADDR, | ||
152 | MLX4_QP_REGION_FC_ADDR, | ||
153 | MLX4_QP_REGION_FC_EXCH, | ||
154 | MLX4_NUM_QP_REGION | ||
155 | }; | ||
156 | |||
157 | enum mlx4_port_type { | ||
158 | MLX4_PORT_TYPE_IB = 1 << 0, | ||
159 | MLX4_PORT_TYPE_ETH = 1 << 1, | ||
160 | }; | ||
161 | |||
162 | enum mlx4_special_vlan_idx { | ||
163 | MLX4_NO_VLAN_IDX = 0, | ||
164 | MLX4_VLAN_MISS_IDX, | ||
165 | MLX4_VLAN_REGULAR | ||
166 | }; | ||
167 | |||
168 | enum { | ||
169 | MLX4_NUM_FEXCH = 64 * 1024, | ||
170 | }; | ||
171 | |||
148 | static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) | 172 | static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) |
149 | { | 173 | { |
150 | return (major << 32) | (minor << 16) | subminor; | 174 | return (major << 32) | (minor << 16) | subminor; |
@@ -154,7 +178,9 @@ struct mlx4_caps { | |||
154 | u64 fw_ver; | 178 | u64 fw_ver; |
155 | int num_ports; | 179 | int num_ports; |
156 | int vl_cap[MLX4_MAX_PORTS + 1]; | 180 | int vl_cap[MLX4_MAX_PORTS + 1]; |
157 | int mtu_cap[MLX4_MAX_PORTS + 1]; | 181 | int ib_mtu_cap[MLX4_MAX_PORTS + 1]; |
182 | u64 def_mac[MLX4_MAX_PORTS + 1]; | ||
183 | int eth_mtu_cap[MLX4_MAX_PORTS + 1]; | ||
158 | int gid_table_len[MLX4_MAX_PORTS + 1]; | 184 | int gid_table_len[MLX4_MAX_PORTS + 1]; |
159 | int pkey_table_len[MLX4_MAX_PORTS + 1]; | 185 | int pkey_table_len[MLX4_MAX_PORTS + 1]; |
160 | int local_ca_ack_delay; | 186 | int local_ca_ack_delay; |
@@ -169,7 +195,6 @@ struct mlx4_caps { | |||
169 | int max_rq_desc_sz; | 195 | int max_rq_desc_sz; |
170 | int max_qp_init_rdma; | 196 | int max_qp_init_rdma; |
171 | int max_qp_dest_rdma; | 197 | int max_qp_dest_rdma; |
172 | int reserved_qps; | ||
173 | int sqp_start; | 198 | int sqp_start; |
174 | int num_srqs; | 199 | int num_srqs; |
175 | int max_srq_wqes; | 200 | int max_srq_wqes; |
@@ -201,6 +226,15 @@ struct mlx4_caps { | |||
201 | u16 stat_rate_support; | 226 | u16 stat_rate_support; |
202 | u8 port_width_cap[MLX4_MAX_PORTS + 1]; | 227 | u8 port_width_cap[MLX4_MAX_PORTS + 1]; |
203 | int max_gso_sz; | 228 | int max_gso_sz; |
229 | int reserved_qps_cnt[MLX4_NUM_QP_REGION]; | ||
230 | int reserved_qps; | ||
231 | int reserved_qps_base[MLX4_NUM_QP_REGION]; | ||
232 | int log_num_macs; | ||
233 | int log_num_vlans; | ||
234 | int log_num_prios; | ||
235 | enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1]; | ||
236 | u8 supported_type[MLX4_MAX_PORTS + 1]; | ||
237 | u32 port_mask; | ||
204 | }; | 238 | }; |
205 | 239 | ||
206 | struct mlx4_buf_list { | 240 | struct mlx4_buf_list { |
@@ -355,6 +389,11 @@ struct mlx4_init_port_param { | |||
355 | u64 si_guid; | 389 | u64 si_guid; |
356 | }; | 390 | }; |
357 | 391 | ||
392 | #define mlx4_foreach_port(port, dev, type) \ | ||
393 | for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ | ||
394 | if (((type) == MLX4_PORT_TYPE_IB ? (dev)->caps.port_mask : \ | ||
395 | ~(dev)->caps.port_mask) & 1 << ((port) - 1)) | ||
396 | |||
358 | int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, | 397 | int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, |
359 | struct mlx4_buf *buf); | 398 | struct mlx4_buf *buf); |
360 | void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf); | 399 | void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf); |
@@ -400,7 +439,10 @@ int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, | |||
400 | int collapsed); | 439 | int collapsed); |
401 | void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); | 440 | void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); |
402 | 441 | ||
403 | int mlx4_qp_alloc(struct mlx4_dev *dev, int sqpn, struct mlx4_qp *qp); | 442 | int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base); |
443 | void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt); | ||
444 | |||
445 | int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp); | ||
404 | void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp); | 446 | void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp); |
405 | 447 | ||
406 | int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, struct mlx4_mtt *mtt, | 448 | int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, struct mlx4_mtt *mtt, |
@@ -416,6 +458,12 @@ int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], | |||
416 | int block_mcast_loopback); | 458 | int block_mcast_loopback); |
417 | int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]); | 459 | int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]); |
418 | 460 | ||
461 | int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *index); | ||
462 | void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, int index); | ||
463 | |||
464 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); | ||
465 | void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index); | ||
466 | |||
419 | int mlx4_map_phys_fmr(struct mlx4_dev *dev, struct mlx4_fmr *fmr, u64 *page_list, | 467 | int mlx4_map_phys_fmr(struct mlx4_dev *dev, struct mlx4_fmr *fmr, u64 *page_list, |
420 | int npages, u64 iova, u32 *lkey, u32 *rkey); | 468 | int npages, u64 iova, u32 *lkey, u32 *rkey); |
421 | int mlx4_fmr_alloc(struct mlx4_dev *dev, u32 pd, u32 access, int max_pages, | 469 | int mlx4_fmr_alloc(struct mlx4_dev *dev, u32 pd, u32 access, int max_pages, |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 72a15dc26bbf..ffee2f743418 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -7,6 +7,7 @@ | |||
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> | ||
10 | #include <linux/mmzone.h> | 11 | #include <linux/mmzone.h> |
11 | #include <linux/rbtree.h> | 12 | #include <linux/rbtree.h> |
12 | #include <linux/prio_tree.h> | 13 | #include <linux/prio_tree.h> |
@@ -131,6 +132,11 @@ extern unsigned int kobjsize(const void *objp); | |||
131 | #define VM_RandomReadHint(v) ((v)->vm_flags & VM_RAND_READ) | 132 | #define VM_RandomReadHint(v) ((v)->vm_flags & VM_RAND_READ) |
132 | 133 | ||
133 | /* | 134 | /* |
135 | * special vmas that are non-mergable, non-mlock()able | ||
136 | */ | ||
137 | #define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_RESERVED | VM_PFNMAP) | ||
138 | |||
139 | /* | ||
134 | * mapping from the currently active vm_flags protection bits (the | 140 | * mapping from the currently active vm_flags protection bits (the |
135 | * low four bits) to a page protection mask.. | 141 | * low four bits) to a page protection mask.. |
136 | */ | 142 | */ |
@@ -219,12 +225,6 @@ struct inode; | |||
219 | */ | 225 | */ |
220 | #include <linux/page-flags.h> | 226 | #include <linux/page-flags.h> |
221 | 227 | ||
222 | #ifdef CONFIG_DEBUG_VM | ||
223 | #define VM_BUG_ON(cond) BUG_ON(cond) | ||
224 | #else | ||
225 | #define VM_BUG_ON(condition) do { } while(0) | ||
226 | #endif | ||
227 | |||
228 | /* | 228 | /* |
229 | * Methods to modify the page usage count. | 229 | * Methods to modify the page usage count. |
230 | * | 230 | * |
@@ -705,10 +705,10 @@ static inline int page_mapped(struct page *page) | |||
705 | extern void show_free_areas(void); | 705 | extern void show_free_areas(void); |
706 | 706 | ||
707 | #ifdef CONFIG_SHMEM | 707 | #ifdef CONFIG_SHMEM |
708 | int shmem_lock(struct file *file, int lock, struct user_struct *user); | 708 | extern int shmem_lock(struct file *file, int lock, struct user_struct *user); |
709 | #else | 709 | #else |
710 | static inline int shmem_lock(struct file *file, int lock, | 710 | static inline int shmem_lock(struct file *file, int lock, |
711 | struct user_struct *user) | 711 | struct user_struct *user) |
712 | { | 712 | { |
713 | return 0; | 713 | return 0; |
714 | } | 714 | } |
@@ -919,7 +919,7 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a | |||
919 | } | 919 | } |
920 | #endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */ | 920 | #endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */ |
921 | 921 | ||
922 | #if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS | 922 | #if USE_SPLIT_PTLOCKS |
923 | /* | 923 | /* |
924 | * We tuck a spinlock to guard each pagetable page into its struct page, | 924 | * We tuck a spinlock to guard each pagetable page into its struct page, |
925 | * at page->private, with BUILD_BUG_ON to make sure that this will not | 925 | * at page->private, with BUILD_BUG_ON to make sure that this will not |
@@ -932,14 +932,14 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a | |||
932 | } while (0) | 932 | } while (0) |
933 | #define pte_lock_deinit(page) ((page)->mapping = NULL) | 933 | #define pte_lock_deinit(page) ((page)->mapping = NULL) |
934 | #define pte_lockptr(mm, pmd) ({(void)(mm); __pte_lockptr(pmd_page(*(pmd)));}) | 934 | #define pte_lockptr(mm, pmd) ({(void)(mm); __pte_lockptr(pmd_page(*(pmd)));}) |
935 | #else | 935 | #else /* !USE_SPLIT_PTLOCKS */ |
936 | /* | 936 | /* |
937 | * We use mm->page_table_lock to guard all pagetable pages of the mm. | 937 | * We use mm->page_table_lock to guard all pagetable pages of the mm. |
938 | */ | 938 | */ |
939 | #define pte_lock_init(page) do {} while (0) | 939 | #define pte_lock_init(page) do {} while (0) |
940 | #define pte_lock_deinit(page) do {} while (0) | 940 | #define pte_lock_deinit(page) do {} while (0) |
941 | #define pte_lockptr(mm, pmd) ({(void)(pmd); &(mm)->page_table_lock;}) | 941 | #define pte_lockptr(mm, pmd) ({(void)(pmd); &(mm)->page_table_lock;}) |
942 | #endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ | 942 | #endif /* USE_SPLIT_PTLOCKS */ |
943 | 943 | ||
944 | static inline void pgtable_page_ctor(struct page *page) | 944 | static inline void pgtable_page_ctor(struct page *page) |
945 | { | 945 | { |
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h index 895bc4e93039..c948350c378e 100644 --- a/include/linux/mm_inline.h +++ b/include/linux/mm_inline.h | |||
@@ -1,40 +1,100 @@ | |||
1 | static inline void | 1 | #ifndef LINUX_MM_INLINE_H |
2 | add_page_to_active_list(struct zone *zone, struct page *page) | 2 | #define LINUX_MM_INLINE_H |
3 | { | ||
4 | list_add(&page->lru, &zone->active_list); | ||
5 | __inc_zone_state(zone, NR_ACTIVE); | ||
6 | } | ||
7 | 3 | ||
8 | static inline void | 4 | /** |
9 | add_page_to_inactive_list(struct zone *zone, struct page *page) | 5 | * page_is_file_cache - should the page be on a file LRU or anon LRU? |
6 | * @page: the page to test | ||
7 | * | ||
8 | * Returns LRU_FILE if @page is page cache page backed by a regular filesystem, | ||
9 | * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed. | ||
10 | * Used by functions that manipulate the LRU lists, to sort a page | ||
11 | * onto the right LRU list. | ||
12 | * | ||
13 | * We would like to get this info without a page flag, but the state | ||
14 | * needs to survive until the page is last deleted from the LRU, which | ||
15 | * could be as far down as __page_cache_release. | ||
16 | */ | ||
17 | static inline int page_is_file_cache(struct page *page) | ||
10 | { | 18 | { |
11 | list_add(&page->lru, &zone->inactive_list); | 19 | if (PageSwapBacked(page)) |
12 | __inc_zone_state(zone, NR_INACTIVE); | 20 | return 0; |
21 | |||
22 | /* The page is page cache backed by a normal filesystem. */ | ||
23 | return LRU_FILE; | ||
13 | } | 24 | } |
14 | 25 | ||
15 | static inline void | 26 | static inline void |
16 | del_page_from_active_list(struct zone *zone, struct page *page) | 27 | add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l) |
17 | { | 28 | { |
18 | list_del(&page->lru); | 29 | list_add(&page->lru, &zone->lru[l].list); |
19 | __dec_zone_state(zone, NR_ACTIVE); | 30 | __inc_zone_state(zone, NR_LRU_BASE + l); |
20 | } | 31 | } |
21 | 32 | ||
22 | static inline void | 33 | static inline void |
23 | del_page_from_inactive_list(struct zone *zone, struct page *page) | 34 | del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l) |
24 | { | 35 | { |
25 | list_del(&page->lru); | 36 | list_del(&page->lru); |
26 | __dec_zone_state(zone, NR_INACTIVE); | 37 | __dec_zone_state(zone, NR_LRU_BASE + l); |
27 | } | 38 | } |
28 | 39 | ||
29 | static inline void | 40 | static inline void |
30 | del_page_from_lru(struct zone *zone, struct page *page) | 41 | del_page_from_lru(struct zone *zone, struct page *page) |
31 | { | 42 | { |
43 | enum lru_list l = LRU_BASE; | ||
44 | |||
32 | list_del(&page->lru); | 45 | list_del(&page->lru); |
33 | if (PageActive(page)) { | 46 | if (PageUnevictable(page)) { |
34 | __ClearPageActive(page); | 47 | __ClearPageUnevictable(page); |
35 | __dec_zone_state(zone, NR_ACTIVE); | 48 | l = LRU_UNEVICTABLE; |
36 | } else { | 49 | } else { |
37 | __dec_zone_state(zone, NR_INACTIVE); | 50 | if (PageActive(page)) { |
51 | __ClearPageActive(page); | ||
52 | l += LRU_ACTIVE; | ||
53 | } | ||
54 | l += page_is_file_cache(page); | ||
55 | } | ||
56 | __dec_zone_state(zone, NR_LRU_BASE + l); | ||
57 | } | ||
58 | |||
59 | /** | ||
60 | * page_lru - which LRU list should a page be on? | ||
61 | * @page: the page to test | ||
62 | * | ||
63 | * Returns the LRU list a page should be on, as an index | ||
64 | * into the array of LRU lists. | ||
65 | */ | ||
66 | static inline enum lru_list page_lru(struct page *page) | ||
67 | { | ||
68 | enum lru_list lru = LRU_BASE; | ||
69 | |||
70 | if (PageUnevictable(page)) | ||
71 | lru = LRU_UNEVICTABLE; | ||
72 | else { | ||
73 | if (PageActive(page)) | ||
74 | lru += LRU_ACTIVE; | ||
75 | lru += page_is_file_cache(page); | ||
38 | } | 76 | } |
77 | |||
78 | return lru; | ||
39 | } | 79 | } |
40 | 80 | ||
81 | /** | ||
82 | * inactive_anon_is_low - check if anonymous pages need to be deactivated | ||
83 | * @zone: zone to check | ||
84 | * | ||
85 | * Returns true if the zone does not have enough inactive anon pages, | ||
86 | * meaning some active anon pages need to be deactivated. | ||
87 | */ | ||
88 | static inline int inactive_anon_is_low(struct zone *zone) | ||
89 | { | ||
90 | unsigned long active, inactive; | ||
91 | |||
92 | active = zone_page_state(zone, NR_ACTIVE_ANON); | ||
93 | inactive = zone_page_state(zone, NR_INACTIVE_ANON); | ||
94 | |||
95 | if (inactive * zone->inactive_ratio < active) | ||
96 | return 1; | ||
97 | |||
98 | return 0; | ||
99 | } | ||
100 | #endif | ||
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index bf334138c7c1..fe825471d5aa 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
@@ -21,11 +21,13 @@ | |||
21 | 21 | ||
22 | struct address_space; | 22 | struct address_space; |
23 | 23 | ||
24 | #if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS | 24 | #define USE_SPLIT_PTLOCKS (NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS) |
25 | |||
26 | #if USE_SPLIT_PTLOCKS | ||
25 | typedef atomic_long_t mm_counter_t; | 27 | typedef atomic_long_t mm_counter_t; |
26 | #else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ | 28 | #else /* !USE_SPLIT_PTLOCKS */ |
27 | typedef unsigned long mm_counter_t; | 29 | typedef unsigned long mm_counter_t; |
28 | #endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ | 30 | #endif /* !USE_SPLIT_PTLOCKS */ |
29 | 31 | ||
30 | /* | 32 | /* |
31 | * Each physical page in the system has a struct page associated with | 33 | * Each physical page in the system has a struct page associated with |
@@ -65,7 +67,7 @@ struct page { | |||
65 | * see PAGE_MAPPING_ANON below. | 67 | * see PAGE_MAPPING_ANON below. |
66 | */ | 68 | */ |
67 | }; | 69 | }; |
68 | #if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS | 70 | #if USE_SPLIT_PTLOCKS |
69 | spinlock_t ptl; | 71 | spinlock_t ptl; |
70 | #endif | 72 | #endif |
71 | struct kmem_cache *slab; /* SLUB: Pointer to slab */ | 73 | struct kmem_cache *slab; /* SLUB: Pointer to slab */ |
@@ -92,9 +94,6 @@ struct page { | |||
92 | void *virtual; /* Kernel virtual address (NULL if | 94 | void *virtual; /* Kernel virtual address (NULL if |
93 | not kmapped, ie. highmem) */ | 95 | not kmapped, ie. highmem) */ |
94 | #endif /* WANT_PAGE_VIRTUAL */ | 96 | #endif /* WANT_PAGE_VIRTUAL */ |
95 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | ||
96 | unsigned long page_cgroup; | ||
97 | #endif | ||
98 | }; | 97 | }; |
99 | 98 | ||
100 | /* | 99 | /* |
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index ee6e822d5994..403aa505f27e 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
@@ -130,7 +130,7 @@ struct mmc_card { | |||
130 | #define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) | 130 | #define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) |
131 | 131 | ||
132 | #define mmc_card_name(c) ((c)->cid.prod_name) | 132 | #define mmc_card_name(c) ((c)->cid.prod_name) |
133 | #define mmc_card_id(c) ((c)->dev.bus_id) | 133 | #define mmc_card_id(c) (dev_name(&(c)->dev)) |
134 | 134 | ||
135 | #define mmc_list_to_card(l) container_of(l, struct mmc_card, node) | 135 | #define mmc_list_to_card(l) container_of(l, struct mmc_card, node) |
136 | #define mmc_get_drvdata(c) dev_get_drvdata(&(c)->dev) | 136 | #define mmc_get_drvdata(c) dev_get_drvdata(&(c)->dev) |
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 9c288c909878..f842f234e44f 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
@@ -65,7 +65,7 @@ struct mmc_host_ops { | |||
65 | * -ENOSYS when not supported (equal to NULL callback) | 65 | * -ENOSYS when not supported (equal to NULL callback) |
66 | * or a negative errno value when something bad happened | 66 | * or a negative errno value when something bad happened |
67 | * | 67 | * |
68 | * Return values for the get_ro callback should be: | 68 | * Return values for the get_cd callback should be: |
69 | * 0 for a absent card | 69 | * 0 for a absent card |
70 | * 1 for a present card | 70 | * 1 for a present card |
71 | * -ENOSYS when not supported (equal to NULL callback) | 71 | * -ENOSYS when not supported (equal to NULL callback) |
@@ -176,7 +176,7 @@ static inline void *mmc_priv(struct mmc_host *host) | |||
176 | 176 | ||
177 | #define mmc_dev(x) ((x)->parent) | 177 | #define mmc_dev(x) ((x)->parent) |
178 | #define mmc_classdev(x) (&(x)->class_dev) | 178 | #define mmc_classdev(x) (&(x)->class_dev) |
179 | #define mmc_hostname(x) ((x)->class_dev.bus_id) | 179 | #define mmc_hostname(x) (dev_name(&(x)->class_dev)) |
180 | 180 | ||
181 | extern int mmc_suspend_host(struct mmc_host *, pm_message_t); | 181 | extern int mmc_suspend_host(struct mmc_host *, pm_message_t); |
182 | extern int mmc_resume_host(struct mmc_host *); | 182 | extern int mmc_resume_host(struct mmc_host *); |
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h index 07bee4a0d457..451bdfc85830 100644 --- a/include/linux/mmc/sdio_func.h +++ b/include/linux/mmc/sdio_func.h | |||
@@ -63,7 +63,7 @@ struct sdio_func { | |||
63 | 63 | ||
64 | #define sdio_func_set_present(f) ((f)->state |= SDIO_STATE_PRESENT) | 64 | #define sdio_func_set_present(f) ((f)->state |= SDIO_STATE_PRESENT) |
65 | 65 | ||
66 | #define sdio_func_id(f) ((f)->dev.bus_id) | 66 | #define sdio_func_id(f) (dev_name(&(f)->dev)) |
67 | 67 | ||
68 | #define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev) | 68 | #define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev) |
69 | #define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d) | 69 | #define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d) |
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h new file mode 100644 index 000000000000..8a5509877192 --- /dev/null +++ b/include/linux/mmdebug.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef LINUX_MM_DEBUG_H | ||
2 | #define LINUX_MM_DEBUG_H 1 | ||
3 | |||
4 | #include <linux/autoconf.h> | ||
5 | |||
6 | #ifdef CONFIG_DEBUG_VM | ||
7 | #define VM_BUG_ON(cond) BUG_ON(cond) | ||
8 | #else | ||
9 | #define VM_BUG_ON(cond) do { } while (0) | ||
10 | #endif | ||
11 | |||
12 | #ifdef CONFIG_DEBUG_VIRTUAL | ||
13 | #define VIRTUAL_BUG_ON(cond) BUG_ON(cond) | ||
14 | #else | ||
15 | #define VIRTUAL_BUG_ON(cond) do { } while (0) | ||
16 | #endif | ||
17 | |||
18 | #endif | ||
diff --git a/include/linux/mmiotrace.h b/include/linux/mmiotrace.h index 61d19e1b7a0b..139d7c88d9c9 100644 --- a/include/linux/mmiotrace.h +++ b/include/linux/mmiotrace.h | |||
@@ -34,11 +34,15 @@ extern void unregister_kmmio_probe(struct kmmio_probe *p); | |||
34 | /* Called from page fault handler. */ | 34 | /* Called from page fault handler. */ |
35 | extern int kmmio_handler(struct pt_regs *regs, unsigned long addr); | 35 | extern int kmmio_handler(struct pt_regs *regs, unsigned long addr); |
36 | 36 | ||
37 | /* Called from ioremap.c */ | ||
38 | #ifdef CONFIG_MMIOTRACE | 37 | #ifdef CONFIG_MMIOTRACE |
38 | /* Called from ioremap.c */ | ||
39 | extern void mmiotrace_ioremap(resource_size_t offset, unsigned long size, | 39 | extern void mmiotrace_ioremap(resource_size_t offset, unsigned long size, |
40 | void __iomem *addr); | 40 | void __iomem *addr); |
41 | extern void mmiotrace_iounmap(volatile void __iomem *addr); | 41 | extern void mmiotrace_iounmap(volatile void __iomem *addr); |
42 | |||
43 | /* For anyone to insert markers. Remember trailing newline. */ | ||
44 | extern int mmiotrace_printk(const char *fmt, ...) | ||
45 | __attribute__ ((format (printf, 1, 2))); | ||
42 | #else | 46 | #else |
43 | static inline void mmiotrace_ioremap(resource_size_t offset, | 47 | static inline void mmiotrace_ioremap(resource_size_t offset, |
44 | unsigned long size, void __iomem *addr) | 48 | unsigned long size, void __iomem *addr) |
@@ -48,15 +52,22 @@ static inline void mmiotrace_ioremap(resource_size_t offset, | |||
48 | static inline void mmiotrace_iounmap(volatile void __iomem *addr) | 52 | static inline void mmiotrace_iounmap(volatile void __iomem *addr) |
49 | { | 53 | { |
50 | } | 54 | } |
51 | #endif /* CONFIG_MMIOTRACE_HOOKS */ | 55 | |
56 | static inline int mmiotrace_printk(const char *fmt, ...) | ||
57 | __attribute__ ((format (printf, 1, 0))); | ||
58 | |||
59 | static inline int mmiotrace_printk(const char *fmt, ...) | ||
60 | { | ||
61 | return 0; | ||
62 | } | ||
63 | #endif /* CONFIG_MMIOTRACE */ | ||
52 | 64 | ||
53 | enum mm_io_opcode { | 65 | enum mm_io_opcode { |
54 | MMIO_READ = 0x1, /* struct mmiotrace_rw */ | 66 | MMIO_READ = 0x1, /* struct mmiotrace_rw */ |
55 | MMIO_WRITE = 0x2, /* struct mmiotrace_rw */ | 67 | MMIO_WRITE = 0x2, /* struct mmiotrace_rw */ |
56 | MMIO_PROBE = 0x3, /* struct mmiotrace_map */ | 68 | MMIO_PROBE = 0x3, /* struct mmiotrace_map */ |
57 | MMIO_UNPROBE = 0x4, /* struct mmiotrace_map */ | 69 | MMIO_UNPROBE = 0x4, /* struct mmiotrace_map */ |
58 | MMIO_MARKER = 0x5, /* raw char data */ | 70 | MMIO_UNKNOWN_OP = 0x5, /* struct mmiotrace_rw */ |
59 | MMIO_UNKNOWN_OP = 0x6, /* struct mmiotrace_rw */ | ||
60 | }; | 71 | }; |
61 | 72 | ||
62 | struct mmiotrace_rw { | 73 | struct mmiotrace_rw { |
@@ -81,5 +92,6 @@ extern void enable_mmiotrace(void); | |||
81 | extern void disable_mmiotrace(void); | 92 | extern void disable_mmiotrace(void); |
82 | extern void mmio_trace_rw(struct mmiotrace_rw *rw); | 93 | extern void mmio_trace_rw(struct mmiotrace_rw *rw); |
83 | extern void mmio_trace_mapping(struct mmiotrace_map *map); | 94 | extern void mmio_trace_mapping(struct mmiotrace_map *map); |
95 | extern int mmio_trace_printk(const char *fmt, va_list args); | ||
84 | 96 | ||
85 | #endif /* MMIOTRACE_H */ | 97 | #endif /* MMIOTRACE_H */ |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 428328a05fa1..35a7b5e19465 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -81,21 +81,31 @@ struct zone_padding { | |||
81 | enum zone_stat_item { | 81 | enum zone_stat_item { |
82 | /* First 128 byte cacheline (assuming 64 bit words) */ | 82 | /* First 128 byte cacheline (assuming 64 bit words) */ |
83 | NR_FREE_PAGES, | 83 | NR_FREE_PAGES, |
84 | NR_INACTIVE, | 84 | NR_LRU_BASE, |
85 | NR_ACTIVE, | 85 | NR_INACTIVE_ANON = NR_LRU_BASE, /* must match order of LRU_[IN]ACTIVE */ |
86 | NR_ACTIVE_ANON, /* " " " " " */ | ||
87 | NR_INACTIVE_FILE, /* " " " " " */ | ||
88 | NR_ACTIVE_FILE, /* " " " " " */ | ||
89 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
90 | NR_UNEVICTABLE, /* " " " " " */ | ||
91 | 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 | ||
86 | NR_ANON_PAGES, /* Mapped anonymous pages */ | 96 | NR_ANON_PAGES, /* Mapped anonymous pages */ |
87 | NR_FILE_MAPPED, /* pagecache pages mapped into pagetables. | 97 | NR_FILE_MAPPED, /* pagecache pages mapped into pagetables. |
88 | only modified from process context */ | 98 | only modified from process context */ |
89 | NR_FILE_PAGES, | 99 | NR_FILE_PAGES, |
90 | NR_FILE_DIRTY, | 100 | NR_FILE_DIRTY, |
91 | NR_WRITEBACK, | 101 | NR_WRITEBACK, |
92 | /* Second 128 byte cacheline */ | ||
93 | NR_SLAB_RECLAIMABLE, | 102 | NR_SLAB_RECLAIMABLE, |
94 | NR_SLAB_UNRECLAIMABLE, | 103 | NR_SLAB_UNRECLAIMABLE, |
95 | NR_PAGETABLE, /* used for pagetables */ | 104 | NR_PAGETABLE, /* used for pagetables */ |
96 | NR_UNSTABLE_NFS, /* NFS unstable pages */ | 105 | NR_UNSTABLE_NFS, /* NFS unstable pages */ |
97 | NR_BOUNCE, | 106 | NR_BOUNCE, |
98 | NR_VMSCAN_WRITE, | 107 | NR_VMSCAN_WRITE, |
108 | /* Second 128 byte cacheline */ | ||
99 | NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */ | 109 | NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */ |
100 | #ifdef CONFIG_NUMA | 110 | #ifdef CONFIG_NUMA |
101 | NUMA_HIT, /* allocated in intended node */ | 111 | NUMA_HIT, /* allocated in intended node */ |
@@ -107,6 +117,55 @@ enum zone_stat_item { | |||
107 | #endif | 117 | #endif |
108 | NR_VM_ZONE_STAT_ITEMS }; | 118 | NR_VM_ZONE_STAT_ITEMS }; |
109 | 119 | ||
120 | /* | ||
121 | * We do arithmetic on the LRU lists in various places in the code, | ||
122 | * so it is important to keep the active lists LRU_ACTIVE higher in | ||
123 | * the array than the corresponding inactive lists, and to keep | ||
124 | * the *_FILE lists LRU_FILE higher than the corresponding _ANON lists. | ||
125 | * | ||
126 | * This has to be kept in sync with the statistics in zone_stat_item | ||
127 | * above and the descriptions in vmstat_text in mm/vmstat.c | ||
128 | */ | ||
129 | #define LRU_BASE 0 | ||
130 | #define LRU_ACTIVE 1 | ||
131 | #define LRU_FILE 2 | ||
132 | |||
133 | enum lru_list { | ||
134 | LRU_INACTIVE_ANON = LRU_BASE, | ||
135 | LRU_ACTIVE_ANON = LRU_BASE + LRU_ACTIVE, | ||
136 | LRU_INACTIVE_FILE = LRU_BASE + LRU_FILE, | ||
137 | LRU_ACTIVE_FILE = LRU_BASE + LRU_FILE + LRU_ACTIVE, | ||
138 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
139 | LRU_UNEVICTABLE, | ||
140 | #else | ||
141 | LRU_UNEVICTABLE = LRU_ACTIVE_FILE, /* avoid compiler errors in dead code */ | ||
142 | #endif | ||
143 | NR_LRU_LISTS | ||
144 | }; | ||
145 | |||
146 | #define for_each_lru(l) for (l = 0; l < NR_LRU_LISTS; l++) | ||
147 | |||
148 | #define for_each_evictable_lru(l) for (l = 0; l <= LRU_ACTIVE_FILE; l++) | ||
149 | |||
150 | static inline int is_file_lru(enum lru_list l) | ||
151 | { | ||
152 | return (l == LRU_INACTIVE_FILE || l == LRU_ACTIVE_FILE); | ||
153 | } | ||
154 | |||
155 | static inline int is_active_lru(enum lru_list l) | ||
156 | { | ||
157 | return (l == LRU_ACTIVE_ANON || l == LRU_ACTIVE_FILE); | ||
158 | } | ||
159 | |||
160 | static inline int is_unevictable_lru(enum lru_list l) | ||
161 | { | ||
162 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
163 | return (l == LRU_UNEVICTABLE); | ||
164 | #else | ||
165 | return 0; | ||
166 | #endif | ||
167 | } | ||
168 | |||
110 | struct per_cpu_pages { | 169 | struct per_cpu_pages { |
111 | int count; /* number of pages in the list */ | 170 | int count; /* number of pages in the list */ |
112 | int high; /* high watermark, emptying needed */ | 171 | int high; /* high watermark, emptying needed */ |
@@ -251,10 +310,22 @@ struct zone { | |||
251 | 310 | ||
252 | /* Fields commonly accessed by the page reclaim scanner */ | 311 | /* Fields commonly accessed by the page reclaim scanner */ |
253 | spinlock_t lru_lock; | 312 | spinlock_t lru_lock; |
254 | struct list_head active_list; | 313 | struct { |
255 | struct list_head inactive_list; | 314 | struct list_head list; |
256 | unsigned long nr_scan_active; | 315 | unsigned long nr_scan; |
257 | unsigned long nr_scan_inactive; | 316 | } lru[NR_LRU_LISTS]; |
317 | |||
318 | /* | ||
319 | * The pageout code in vmscan.c keeps track of how many of the | ||
320 | * mem/swap backed and file backed pages are refeferenced. | ||
321 | * The higher the rotated/scanned ratio, the more valuable | ||
322 | * that cache is. | ||
323 | * | ||
324 | * The anon LRU stats live in [0], file LRU stats in [1] | ||
325 | */ | ||
326 | unsigned long recent_rotated[2]; | ||
327 | unsigned long recent_scanned[2]; | ||
328 | |||
258 | unsigned long pages_scanned; /* since last reclaim */ | 329 | unsigned long pages_scanned; /* since last reclaim */ |
259 | unsigned long flags; /* zone flags, see below */ | 330 | unsigned long flags; /* zone flags, see below */ |
260 | 331 | ||
@@ -276,6 +347,12 @@ struct zone { | |||
276 | */ | 347 | */ |
277 | int prev_priority; | 348 | int prev_priority; |
278 | 349 | ||
350 | /* | ||
351 | * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on | ||
352 | * this zone's LRU. Maintained by the pageout code. | ||
353 | */ | ||
354 | unsigned int inactive_ratio; | ||
355 | |||
279 | 356 | ||
280 | ZONE_PADDING(_pad2_) | 357 | ZONE_PADDING(_pad2_) |
281 | /* Rarely used or read-mostly fields */ | 358 | /* Rarely used or read-mostly fields */ |
@@ -524,8 +601,11 @@ typedef struct pglist_data { | |||
524 | struct zone node_zones[MAX_NR_ZONES]; | 601 | struct zone node_zones[MAX_NR_ZONES]; |
525 | struct zonelist node_zonelists[MAX_ZONELISTS]; | 602 | struct zonelist node_zonelists[MAX_ZONELISTS]; |
526 | int nr_zones; | 603 | int nr_zones; |
527 | #ifdef CONFIG_FLAT_NODE_MEM_MAP | 604 | #ifdef CONFIG_FLAT_NODE_MEM_MAP /* means !SPARSEMEM */ |
528 | struct page *node_mem_map; | 605 | struct page *node_mem_map; |
606 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | ||
607 | struct page_cgroup *node_page_cgroup; | ||
608 | #endif | ||
529 | #endif | 609 | #endif |
530 | struct bootmem_data *bdata; | 610 | struct bootmem_data *bdata; |
531 | #ifdef CONFIG_MEMORY_HOTPLUG | 611 | #ifdef CONFIG_MEMORY_HOTPLUG |
@@ -854,6 +934,7 @@ static inline unsigned long early_pfn_to_nid(unsigned long pfn) | |||
854 | #endif | 934 | #endif |
855 | 935 | ||
856 | struct page; | 936 | struct page; |
937 | struct page_cgroup; | ||
857 | struct mem_section { | 938 | struct mem_section { |
858 | /* | 939 | /* |
859 | * This is, logically, a pointer to an array of struct | 940 | * This is, logically, a pointer to an array of struct |
@@ -871,6 +952,14 @@ struct mem_section { | |||
871 | 952 | ||
872 | /* See declaration of similar field in struct zone */ | 953 | /* See declaration of similar field in struct zone */ |
873 | unsigned long *pageblock_flags; | 954 | unsigned long *pageblock_flags; |
955 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | ||
956 | /* | ||
957 | * If !SPARSEMEM, pgdat doesn't have page_cgroup pointer. We use | ||
958 | * section. (see memcontrol.h/page_cgroup.h about this.) | ||
959 | */ | ||
960 | struct page_cgroup *page_cgroup; | ||
961 | unsigned long pad; | ||
962 | #endif | ||
874 | }; | 963 | }; |
875 | 964 | ||
876 | #ifdef CONFIG_SPARSEMEM_EXTREME | 965 | #ifdef CONFIG_SPARSEMEM_EXTREME |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index c4db5827963d..97b91d1abb43 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -131,6 +131,17 @@ struct usb_device_id { | |||
131 | #define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100 | 131 | #define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100 |
132 | #define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 | 132 | #define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 |
133 | 133 | ||
134 | #define HID_ANY_ID (~0) | ||
135 | |||
136 | struct hid_device_id { | ||
137 | __u16 bus; | ||
138 | __u16 pad1; | ||
139 | __u32 vendor; | ||
140 | __u32 product; | ||
141 | kernel_ulong_t driver_data | ||
142 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | ||
143 | }; | ||
144 | |||
134 | /* s390 CCW devices */ | 145 | /* s390 CCW devices */ |
135 | struct ccw_device_id { | 146 | struct ccw_device_id { |
136 | __u16 match_flags; /* which fields to match against */ | 147 | __u16 match_flags; /* which fields to match against */ |
@@ -274,7 +285,7 @@ struct pcmcia_device_id { | |||
274 | /* Input */ | 285 | /* Input */ |
275 | #define INPUT_DEVICE_ID_EV_MAX 0x1f | 286 | #define INPUT_DEVICE_ID_EV_MAX 0x1f |
276 | #define INPUT_DEVICE_ID_KEY_MIN_INTERESTING 0x71 | 287 | #define INPUT_DEVICE_ID_KEY_MIN_INTERESTING 0x71 |
277 | #define INPUT_DEVICE_ID_KEY_MAX 0x1ff | 288 | #define INPUT_DEVICE_ID_KEY_MAX 0x2ff |
278 | #define INPUT_DEVICE_ID_REL_MAX 0x0f | 289 | #define INPUT_DEVICE_ID_REL_MAX 0x0f |
279 | #define INPUT_DEVICE_ID_ABS_MAX 0x3f | 290 | #define INPUT_DEVICE_ID_ABS_MAX 0x3f |
280 | #define INPUT_DEVICE_ID_MSC_MAX 0x07 | 291 | #define INPUT_DEVICE_ID_MSC_MAX 0x07 |
@@ -388,5 +399,52 @@ struct i2c_device_id { | |||
388 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | 399 | __attribute__((aligned(sizeof(kernel_ulong_t)))); |
389 | }; | 400 | }; |
390 | 401 | ||
402 | /* dmi */ | ||
403 | enum dmi_field { | ||
404 | DMI_NONE, | ||
405 | DMI_BIOS_VENDOR, | ||
406 | DMI_BIOS_VERSION, | ||
407 | DMI_BIOS_DATE, | ||
408 | DMI_SYS_VENDOR, | ||
409 | DMI_PRODUCT_NAME, | ||
410 | DMI_PRODUCT_VERSION, | ||
411 | DMI_PRODUCT_SERIAL, | ||
412 | DMI_PRODUCT_UUID, | ||
413 | DMI_BOARD_VENDOR, | ||
414 | DMI_BOARD_NAME, | ||
415 | DMI_BOARD_VERSION, | ||
416 | DMI_BOARD_SERIAL, | ||
417 | DMI_BOARD_ASSET_TAG, | ||
418 | DMI_CHASSIS_VENDOR, | ||
419 | DMI_CHASSIS_TYPE, | ||
420 | DMI_CHASSIS_VERSION, | ||
421 | DMI_CHASSIS_SERIAL, | ||
422 | DMI_CHASSIS_ASSET_TAG, | ||
423 | DMI_STRING_MAX, | ||
424 | }; | ||
425 | |||
426 | struct dmi_strmatch { | ||
427 | unsigned char slot; | ||
428 | char substr[79]; | ||
429 | }; | ||
430 | |||
431 | #ifndef __KERNEL__ | ||
432 | struct dmi_system_id { | ||
433 | kernel_ulong_t callback; | ||
434 | kernel_ulong_t ident; | ||
435 | struct dmi_strmatch matches[4]; | ||
436 | kernel_ulong_t driver_data | ||
437 | __attribute__((aligned(sizeof(kernel_ulong_t)))); | ||
438 | }; | ||
439 | #else | ||
440 | struct dmi_system_id { | ||
441 | int (*callback)(const struct dmi_system_id *); | ||
442 | const char *ident; | ||
443 | struct dmi_strmatch matches[4]; | ||
444 | void *driver_data; | ||
445 | }; | ||
446 | #endif | ||
447 | |||
448 | #define DMI_MATCH(a, b) { a, b } | ||
391 | 449 | ||
392 | #endif /* LINUX_MOD_DEVICETABLE_H */ | 450 | #endif /* LINUX_MOD_DEVICETABLE_H */ |
diff --git a/include/linux/module.h b/include/linux/module.h index 68e09557c951..3bfed013350b 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/kobject.h> | 16 | #include <linux/kobject.h> |
17 | #include <linux/moduleparam.h> | 17 | #include <linux/moduleparam.h> |
18 | #include <linux/marker.h> | 18 | #include <linux/marker.h> |
19 | #include <linux/tracepoint.h> | ||
19 | #include <asm/local.h> | 20 | #include <asm/local.h> |
20 | 21 | ||
21 | #include <asm/module.h> | 22 | #include <asm/module.h> |
@@ -28,7 +29,7 @@ | |||
28 | #define MODULE_SYMBOL_PREFIX "" | 29 | #define MODULE_SYMBOL_PREFIX "" |
29 | #endif | 30 | #endif |
30 | 31 | ||
31 | #define MODULE_NAME_LEN (64 - sizeof(unsigned long)) | 32 | #define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN |
32 | 33 | ||
33 | struct kernel_symbol | 34 | struct kernel_symbol |
34 | { | 35 | { |
@@ -59,6 +60,7 @@ struct module_kobject | |||
59 | struct kobject kobj; | 60 | struct kobject kobj; |
60 | struct module *mod; | 61 | struct module *mod; |
61 | struct kobject *drivers_dir; | 62 | struct kobject *drivers_dir; |
63 | struct module_param_attrs *mp; | ||
62 | }; | 64 | }; |
63 | 65 | ||
64 | /* These are either module local, or the kernel's dummy ones. */ | 66 | /* These are either module local, or the kernel's dummy ones. */ |
@@ -241,7 +243,6 @@ struct module | |||
241 | 243 | ||
242 | /* Sysfs stuff. */ | 244 | /* Sysfs stuff. */ |
243 | struct module_kobject mkobj; | 245 | struct module_kobject mkobj; |
244 | struct module_param_attrs *param_attrs; | ||
245 | struct module_attribute *modinfo_attrs; | 246 | struct module_attribute *modinfo_attrs; |
246 | const char *version; | 247 | const char *version; |
247 | const char *srcversion; | 248 | const char *srcversion; |
@@ -276,7 +277,7 @@ struct module | |||
276 | 277 | ||
277 | /* Exception table */ | 278 | /* Exception table */ |
278 | unsigned int num_exentries; | 279 | unsigned int num_exentries; |
279 | const struct exception_table_entry *extable; | 280 | struct exception_table_entry *extable; |
280 | 281 | ||
281 | /* Startup function. */ | 282 | /* Startup function. */ |
282 | int (*init)(void); | 283 | int (*init)(void); |
@@ -331,6 +332,10 @@ struct module | |||
331 | struct marker *markers; | 332 | struct marker *markers; |
332 | unsigned int num_markers; | 333 | unsigned int num_markers; |
333 | #endif | 334 | #endif |
335 | #ifdef CONFIG_TRACEPOINTS | ||
336 | struct tracepoint *tracepoints; | ||
337 | unsigned int num_tracepoints; | ||
338 | #endif | ||
334 | 339 | ||
335 | #ifdef CONFIG_MODULE_UNLOAD | 340 | #ifdef CONFIG_MODULE_UNLOAD |
336 | /* What modules depend on me? */ | 341 | /* What modules depend on me? */ |
@@ -345,7 +350,6 @@ struct module | |||
345 | /* Reference counts */ | 350 | /* Reference counts */ |
346 | struct module_ref ref[NR_CPUS]; | 351 | struct module_ref ref[NR_CPUS]; |
347 | #endif | 352 | #endif |
348 | |||
349 | }; | 353 | }; |
350 | #ifndef MODULE_ARCH_INIT | 354 | #ifndef MODULE_ARCH_INIT |
351 | #define MODULE_ARCH_INIT {} | 355 | #define MODULE_ARCH_INIT {} |
@@ -454,6 +458,9 @@ extern void print_modules(void); | |||
454 | 458 | ||
455 | extern void module_update_markers(void); | 459 | extern void module_update_markers(void); |
456 | 460 | ||
461 | extern void module_update_tracepoints(void); | ||
462 | extern int module_get_iter_tracepoints(struct tracepoint_iter *iter); | ||
463 | |||
457 | #else /* !CONFIG_MODULES... */ | 464 | #else /* !CONFIG_MODULES... */ |
458 | #define EXPORT_SYMBOL(sym) | 465 | #define EXPORT_SYMBOL(sym) |
459 | #define EXPORT_SYMBOL_GPL(sym) | 466 | #define EXPORT_SYMBOL_GPL(sym) |
@@ -558,6 +565,15 @@ static inline void module_update_markers(void) | |||
558 | { | 565 | { |
559 | } | 566 | } |
560 | 567 | ||
568 | static inline void module_update_tracepoints(void) | ||
569 | { | ||
570 | } | ||
571 | |||
572 | static inline int module_get_iter_tracepoints(struct tracepoint_iter *iter) | ||
573 | { | ||
574 | return 0; | ||
575 | } | ||
576 | |||
561 | #endif /* CONFIG_MODULES */ | 577 | #endif /* CONFIG_MODULES */ |
562 | 578 | ||
563 | struct device_driver; | 579 | struct device_driver; |
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index ec624381c844..e4af3399ef48 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
@@ -13,6 +13,9 @@ | |||
13 | #define MODULE_PARAM_PREFIX KBUILD_MODNAME "." | 13 | #define MODULE_PARAM_PREFIX KBUILD_MODNAME "." |
14 | #endif | 14 | #endif |
15 | 15 | ||
16 | /* Chosen so that structs with an unsigned long line up. */ | ||
17 | #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) | ||
18 | |||
16 | #ifdef MODULE | 19 | #ifdef MODULE |
17 | #define ___module_cat(a,b) __mod_ ## a ## b | 20 | #define ___module_cat(a,b) __mod_ ## a ## b |
18 | #define __module_cat(a,b) ___module_cat(a,b) | 21 | #define __module_cat(a,b) ___module_cat(a,b) |
@@ -79,7 +82,8 @@ struct kparam_array | |||
79 | #define __module_param_call(prefix, name, set, get, arg, perm) \ | 82 | #define __module_param_call(prefix, name, set, get, arg, perm) \ |
80 | /* Default value instead of permissions? */ \ | 83 | /* Default value instead of permissions? */ \ |
81 | static int __param_perm_check_##name __attribute__((unused)) = \ | 84 | static int __param_perm_check_##name __attribute__((unused)) = \ |
82 | BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \ | 85 | BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ |
86 | + BUILD_BUG_ON_ZERO(sizeof(""prefix) > MAX_PARAM_PREFIX_LEN); \ | ||
83 | static const char __param_str_##name[] = prefix #name; \ | 87 | static const char __param_str_##name[] = prefix #name; \ |
84 | static struct kernel_param __moduleparam_const __param_##name \ | 88 | static struct kernel_param __moduleparam_const __param_##name \ |
85 | __used \ | 89 | __used \ |
@@ -100,6 +104,25 @@ struct kparam_array | |||
100 | #define module_param(name, type, perm) \ | 104 | #define module_param(name, type, perm) \ |
101 | module_param_named(name, name, type, perm) | 105 | module_param_named(name, name, type, perm) |
102 | 106 | ||
107 | #ifndef MODULE | ||
108 | /** | ||
109 | * core_param - define a historical core kernel parameter. | ||
110 | * @name: the name of the cmdline and sysfs parameter (often the same as var) | ||
111 | * @var: the variable | ||
112 | * @type: the type (for param_set_##type and param_get_##type) | ||
113 | * @perm: visibility in sysfs | ||
114 | * | ||
115 | * core_param is just like module_param(), but cannot be modular and | ||
116 | * doesn't add a prefix (such as "printk."). This is for compatibility | ||
117 | * with __setup(), and it makes sense as truly core parameters aren't | ||
118 | * tied to the particular file they're in. | ||
119 | */ | ||
120 | #define core_param(name, var, type, perm) \ | ||
121 | param_check_##type(name, &(var)); \ | ||
122 | __module_param_call("", name, param_set_##type, param_get_##type, \ | ||
123 | &var, perm) | ||
124 | #endif /* !MODULE */ | ||
125 | |||
103 | /* Actually copy string: maxlen param is usually sizeof(string). */ | 126 | /* Actually copy string: maxlen param is usually sizeof(string). */ |
104 | #define module_param_string(name, string, len, perm) \ | 127 | #define module_param_string(name, string, len, perm) \ |
105 | static const struct kparam_string __param_string_##name \ | 128 | static const struct kparam_string __param_string_##name \ |
diff --git a/include/linux/mount.h b/include/linux/mount.h index 30a1d63b6fb5..cab2a85e2ee8 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h | |||
@@ -5,8 +5,6 @@ | |||
5 | * | 5 | * |
6 | * Author: Marco van Wieringen <mvw@planets.elm.net> | 6 | * Author: Marco van Wieringen <mvw@planets.elm.net> |
7 | * | 7 | * |
8 | * Version: $Id: mount.h,v 2.0 1996/11/17 16:48:14 mvw Exp mvw $ | ||
9 | * | ||
10 | */ | 8 | */ |
11 | #ifndef _LINUX_MOUNT_H | 9 | #ifndef _LINUX_MOUNT_H |
12 | #define _LINUX_MOUNT_H | 10 | #define _LINUX_MOUNT_H |
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h index ba63858056c7..e0a9b207920d 100644 --- a/include/linux/msdos_fs.h +++ b/include/linux/msdos_fs.h | |||
@@ -46,11 +46,6 @@ | |||
46 | #define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */ | 46 | #define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */ |
47 | #define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG) | 47 | #define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG) |
48 | 48 | ||
49 | /* valid file mode bits */ | ||
50 | #define MSDOS_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO) | ||
51 | /* Convert attribute bits and a mask to the UNIX mode. */ | ||
52 | #define MSDOS_MKMODE(a, m) (m & (a & ATTR_RO ? S_IRUGO|S_IXUGO : S_IRWXUGO)) | ||
53 | |||
54 | #define MSDOS_NAME 11 /* maximum name length */ | 49 | #define MSDOS_NAME 11 /* maximum name length */ |
55 | #define MSDOS_LONGNAME 256 /* maximum name length */ | 50 | #define MSDOS_LONGNAME 256 /* maximum name length */ |
56 | #define MSDOS_SLOTS 21 /* max # of slots for short and long names */ | 51 | #define MSDOS_SLOTS 21 /* max # of slots for short and long names */ |
@@ -167,282 +162,10 @@ struct msdos_dir_slot { | |||
167 | }; | 162 | }; |
168 | 163 | ||
169 | #ifdef __KERNEL__ | 164 | #ifdef __KERNEL__ |
170 | |||
171 | #include <linux/buffer_head.h> | ||
172 | #include <linux/string.h> | ||
173 | #include <linux/nls.h> | ||
174 | #include <linux/fs.h> | ||
175 | #include <linux/mutex.h> | ||
176 | |||
177 | /* | ||
178 | * vfat shortname flags | ||
179 | */ | ||
180 | #define VFAT_SFN_DISPLAY_LOWER 0x0001 /* convert to lowercase for display */ | ||
181 | #define VFAT_SFN_DISPLAY_WIN95 0x0002 /* emulate win95 rule for display */ | ||
182 | #define VFAT_SFN_DISPLAY_WINNT 0x0004 /* emulate winnt rule for display */ | ||
183 | #define VFAT_SFN_CREATE_WIN95 0x0100 /* emulate win95 rule for create */ | ||
184 | #define VFAT_SFN_CREATE_WINNT 0x0200 /* emulate winnt rule for create */ | ||
185 | |||
186 | struct fat_mount_options { | ||
187 | uid_t fs_uid; | ||
188 | gid_t fs_gid; | ||
189 | unsigned short fs_fmask; | ||
190 | unsigned short fs_dmask; | ||
191 | unsigned short codepage; /* Codepage for shortname conversions */ | ||
192 | char *iocharset; /* Charset used for filename input/display */ | ||
193 | unsigned short shortname; /* flags for shortname display/create rule */ | ||
194 | unsigned char name_check; /* r = relaxed, n = normal, s = strict */ | ||
195 | unsigned short allow_utime;/* permission for setting the [am]time */ | ||
196 | unsigned quiet:1, /* set = fake successful chmods and chowns */ | ||
197 | showexec:1, /* set = only set x bit for com/exe/bat */ | ||
198 | sys_immutable:1, /* set = system files are immutable */ | ||
199 | dotsOK:1, /* set = hidden and system files are named '.filename' */ | ||
200 | isvfat:1, /* 0=no vfat long filename support, 1=vfat support */ | ||
201 | utf8:1, /* Use of UTF-8 character set (Default) */ | ||
202 | unicode_xlate:1, /* create escape sequences for unhandled Unicode */ | ||
203 | numtail:1, /* Does first alias have a numeric '~1' type tail? */ | ||
204 | flush:1, /* write things quickly */ | ||
205 | nocase:1, /* Does this need case conversion? 0=need case conversion*/ | ||
206 | usefree:1, /* Use free_clusters for FAT32 */ | ||
207 | tz_utc:1; /* Filesystem timestamps are in UTC */ | ||
208 | }; | ||
209 | |||
210 | #define FAT_HASH_BITS 8 | ||
211 | #define FAT_HASH_SIZE (1UL << FAT_HASH_BITS) | ||
212 | #define FAT_HASH_MASK (FAT_HASH_SIZE-1) | ||
213 | |||
214 | /* | ||
215 | * MS-DOS file system in-core superblock data | ||
216 | */ | ||
217 | struct msdos_sb_info { | ||
218 | unsigned short sec_per_clus; /* sectors/cluster */ | ||
219 | unsigned short cluster_bits; /* log2(cluster_size) */ | ||
220 | unsigned int cluster_size; /* cluster size */ | ||
221 | unsigned char fats,fat_bits; /* number of FATs, FAT bits (12 or 16) */ | ||
222 | unsigned short fat_start; | ||
223 | unsigned long fat_length; /* FAT start & length (sec.) */ | ||
224 | unsigned long dir_start; | ||
225 | unsigned short dir_entries; /* root dir start & entries */ | ||
226 | unsigned long data_start; /* first data sector */ | ||
227 | unsigned long max_cluster; /* maximum cluster number */ | ||
228 | unsigned long root_cluster; /* first cluster of the root directory */ | ||
229 | unsigned long fsinfo_sector; /* sector number of FAT32 fsinfo */ | ||
230 | struct mutex fat_lock; | ||
231 | unsigned int prev_free; /* previously allocated cluster number */ | ||
232 | unsigned int free_clusters; /* -1 if undefined */ | ||
233 | unsigned int free_clus_valid; /* is free_clusters valid? */ | ||
234 | struct fat_mount_options options; | ||
235 | struct nls_table *nls_disk; /* Codepage used on disk */ | ||
236 | struct nls_table *nls_io; /* Charset used for input and display */ | ||
237 | const void *dir_ops; /* Opaque; default directory operations */ | ||
238 | int dir_per_block; /* dir entries per block */ | ||
239 | int dir_per_block_bits; /* log2(dir_per_block) */ | ||
240 | |||
241 | int fatent_shift; | ||
242 | struct fatent_operations *fatent_ops; | ||
243 | |||
244 | spinlock_t inode_hash_lock; | ||
245 | struct hlist_head inode_hashtable[FAT_HASH_SIZE]; | ||
246 | }; | ||
247 | |||
248 | #define FAT_CACHE_VALID 0 /* special case for valid cache */ | ||
249 | |||
250 | /* | ||
251 | * MS-DOS file system inode data in memory | ||
252 | */ | ||
253 | struct msdos_inode_info { | ||
254 | spinlock_t cache_lru_lock; | ||
255 | struct list_head cache_lru; | ||
256 | int nr_caches; | ||
257 | /* for avoiding the race between fat_free() and fat_get_cluster() */ | ||
258 | unsigned int cache_valid_id; | ||
259 | |||
260 | loff_t mmu_private; | ||
261 | int i_start; /* first cluster or 0 */ | ||
262 | int i_logstart; /* logical first cluster */ | ||
263 | int i_attrs; /* unused attribute bits */ | ||
264 | loff_t i_pos; /* on-disk position of directory entry or 0 */ | ||
265 | struct hlist_node i_fat_hash; /* hash by i_location */ | ||
266 | struct inode vfs_inode; | ||
267 | }; | ||
268 | |||
269 | struct fat_slot_info { | ||
270 | loff_t i_pos; /* on-disk position of directory entry */ | ||
271 | loff_t slot_off; /* offset for slot or de start */ | ||
272 | int nr_slots; /* number of slots + 1(de) in filename */ | ||
273 | struct msdos_dir_entry *de; | ||
274 | struct buffer_head *bh; | ||
275 | }; | ||
276 | |||
277 | static inline struct msdos_sb_info *MSDOS_SB(struct super_block *sb) | ||
278 | { | ||
279 | return sb->s_fs_info; | ||
280 | } | ||
281 | |||
282 | static inline struct msdos_inode_info *MSDOS_I(struct inode *inode) | ||
283 | { | ||
284 | return container_of(inode, struct msdos_inode_info, vfs_inode); | ||
285 | } | ||
286 | |||
287 | /* Return the FAT attribute byte for this inode */ | ||
288 | static inline u8 fat_attr(struct inode *inode) | ||
289 | { | ||
290 | return ((inode->i_mode & S_IWUGO) ? ATTR_NONE : ATTR_RO) | | ||
291 | (S_ISDIR(inode->i_mode) ? ATTR_DIR : ATTR_NONE) | | ||
292 | MSDOS_I(inode)->i_attrs; | ||
293 | } | ||
294 | |||
295 | static inline unsigned char fat_checksum(const __u8 *name) | ||
296 | { | ||
297 | unsigned char s = name[0]; | ||
298 | s = (s<<7) + (s>>1) + name[1]; s = (s<<7) + (s>>1) + name[2]; | ||
299 | s = (s<<7) + (s>>1) + name[3]; s = (s<<7) + (s>>1) + name[4]; | ||
300 | s = (s<<7) + (s>>1) + name[5]; s = (s<<7) + (s>>1) + name[6]; | ||
301 | s = (s<<7) + (s>>1) + name[7]; s = (s<<7) + (s>>1) + name[8]; | ||
302 | s = (s<<7) + (s>>1) + name[9]; s = (s<<7) + (s>>1) + name[10]; | ||
303 | return s; | ||
304 | } | ||
305 | |||
306 | static inline sector_t fat_clus_to_blknr(struct msdos_sb_info *sbi, int clus) | ||
307 | { | ||
308 | return ((sector_t)clus - FAT_START_ENT) * sbi->sec_per_clus | ||
309 | + sbi->data_start; | ||
310 | } | ||
311 | |||
312 | static inline void fat16_towchar(wchar_t *dst, const __u8 *src, size_t len) | ||
313 | { | ||
314 | #ifdef __BIG_ENDIAN | ||
315 | while (len--) { | ||
316 | *dst++ = src[0] | (src[1] << 8); | ||
317 | src += 2; | ||
318 | } | ||
319 | #else | ||
320 | memcpy(dst, src, len * 2); | ||
321 | #endif | ||
322 | } | ||
323 | |||
324 | static inline void fatwchar_to16(__u8 *dst, const wchar_t *src, size_t len) | ||
325 | { | ||
326 | #ifdef __BIG_ENDIAN | ||
327 | while (len--) { | ||
328 | dst[0] = *src & 0x00FF; | ||
329 | dst[1] = (*src & 0xFF00) >> 8; | ||
330 | dst += 2; | ||
331 | src++; | ||
332 | } | ||
333 | #else | ||
334 | memcpy(dst, src, len * 2); | ||
335 | #endif | ||
336 | } | ||
337 | |||
338 | /* media of boot sector */ | 165 | /* media of boot sector */ |
339 | static inline int fat_valid_media(u8 media) | 166 | static inline int fat_valid_media(u8 media) |
340 | { | 167 | { |
341 | return 0xf8 <= media || media == 0xf0; | 168 | return 0xf8 <= media || media == 0xf0; |
342 | } | 169 | } |
343 | 170 | #endif /* !__KERNEL__ */ | |
344 | /* fat/cache.c */ | 171 | #endif /* !_LINUX_MSDOS_FS_H */ |
345 | extern void fat_cache_inval_inode(struct inode *inode); | ||
346 | extern int fat_get_cluster(struct inode *inode, int cluster, | ||
347 | int *fclus, int *dclus); | ||
348 | extern int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys, | ||
349 | unsigned long *mapped_blocks); | ||
350 | |||
351 | /* fat/dir.c */ | ||
352 | extern const struct file_operations fat_dir_operations; | ||
353 | extern int fat_search_long(struct inode *inode, const unsigned char *name, | ||
354 | int name_len, struct fat_slot_info *sinfo); | ||
355 | extern int fat_dir_empty(struct inode *dir); | ||
356 | extern int fat_subdirs(struct inode *dir); | ||
357 | extern int fat_scan(struct inode *dir, const unsigned char *name, | ||
358 | struct fat_slot_info *sinfo); | ||
359 | extern int fat_get_dotdot_entry(struct inode *dir, struct buffer_head **bh, | ||
360 | struct msdos_dir_entry **de, loff_t *i_pos); | ||
361 | extern int fat_alloc_new_dir(struct inode *dir, struct timespec *ts); | ||
362 | extern int fat_add_entries(struct inode *dir, void *slots, int nr_slots, | ||
363 | struct fat_slot_info *sinfo); | ||
364 | extern int fat_remove_entries(struct inode *dir, struct fat_slot_info *sinfo); | ||
365 | |||
366 | /* fat/fatent.c */ | ||
367 | struct fat_entry { | ||
368 | int entry; | ||
369 | union { | ||
370 | u8 *ent12_p[2]; | ||
371 | __le16 *ent16_p; | ||
372 | __le32 *ent32_p; | ||
373 | } u; | ||
374 | int nr_bhs; | ||
375 | struct buffer_head *bhs[2]; | ||
376 | }; | ||
377 | |||
378 | static inline void fatent_init(struct fat_entry *fatent) | ||
379 | { | ||
380 | fatent->nr_bhs = 0; | ||
381 | fatent->entry = 0; | ||
382 | fatent->u.ent32_p = NULL; | ||
383 | fatent->bhs[0] = fatent->bhs[1] = NULL; | ||
384 | } | ||
385 | |||
386 | static inline void fatent_set_entry(struct fat_entry *fatent, int entry) | ||
387 | { | ||
388 | fatent->entry = entry; | ||
389 | fatent->u.ent32_p = NULL; | ||
390 | } | ||
391 | |||
392 | static inline void fatent_brelse(struct fat_entry *fatent) | ||
393 | { | ||
394 | int i; | ||
395 | fatent->u.ent32_p = NULL; | ||
396 | for (i = 0; i < fatent->nr_bhs; i++) | ||
397 | brelse(fatent->bhs[i]); | ||
398 | fatent->nr_bhs = 0; | ||
399 | fatent->bhs[0] = fatent->bhs[1] = NULL; | ||
400 | } | ||
401 | |||
402 | extern void fat_ent_access_init(struct super_block *sb); | ||
403 | extern int fat_ent_read(struct inode *inode, struct fat_entry *fatent, | ||
404 | int entry); | ||
405 | extern int fat_ent_write(struct inode *inode, struct fat_entry *fatent, | ||
406 | int new, int wait); | ||
407 | extern int fat_alloc_clusters(struct inode *inode, int *cluster, | ||
408 | int nr_cluster); | ||
409 | extern int fat_free_clusters(struct inode *inode, int cluster); | ||
410 | extern int fat_count_free_clusters(struct super_block *sb); | ||
411 | |||
412 | /* fat/file.c */ | ||
413 | extern int fat_generic_ioctl(struct inode *inode, struct file *filp, | ||
414 | unsigned int cmd, unsigned long arg); | ||
415 | extern const struct file_operations fat_file_operations; | ||
416 | extern const struct inode_operations fat_file_inode_operations; | ||
417 | extern int fat_setattr(struct dentry * dentry, struct iattr * attr); | ||
418 | extern void fat_truncate(struct inode *inode); | ||
419 | extern int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, | ||
420 | struct kstat *stat); | ||
421 | |||
422 | /* fat/inode.c */ | ||
423 | extern void fat_attach(struct inode *inode, loff_t i_pos); | ||
424 | extern void fat_detach(struct inode *inode); | ||
425 | extern struct inode *fat_iget(struct super_block *sb, loff_t i_pos); | ||
426 | extern struct inode *fat_build_inode(struct super_block *sb, | ||
427 | struct msdos_dir_entry *de, loff_t i_pos); | ||
428 | extern int fat_sync_inode(struct inode *inode); | ||
429 | extern int fat_fill_super(struct super_block *sb, void *data, int silent, | ||
430 | const struct inode_operations *fs_dir_inode_ops, int isvfat); | ||
431 | |||
432 | extern int fat_flush_inodes(struct super_block *sb, struct inode *i1, | ||
433 | struct inode *i2); | ||
434 | /* fat/misc.c */ | ||
435 | extern void fat_fs_panic(struct super_block *s, const char *fmt, ...); | ||
436 | extern void fat_clusters_flush(struct super_block *sb); | ||
437 | extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster); | ||
438 | extern int date_dos2unix(unsigned short time, unsigned short date, int tz_utc); | ||
439 | extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date, | ||
440 | int tz_utc); | ||
441 | extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs); | ||
442 | |||
443 | int fat_cache_init(void); | ||
444 | void fat_cache_destroy(void); | ||
445 | |||
446 | #endif /* __KERNEL__ */ | ||
447 | |||
448 | #endif | ||
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h index 310e61606415..8b4aa0523db7 100644 --- a/include/linux/mtd/blktrans.h +++ b/include/linux/mtd/blktrans.h | |||
@@ -41,6 +41,8 @@ struct mtd_blktrans_ops { | |||
41 | unsigned long block, char *buffer); | 41 | unsigned long block, char *buffer); |
42 | int (*writesect)(struct mtd_blktrans_dev *dev, | 42 | int (*writesect)(struct mtd_blktrans_dev *dev, |
43 | unsigned long block, char *buffer); | 43 | unsigned long block, char *buffer); |
44 | int (*discard)(struct mtd_blktrans_dev *dev, | ||
45 | unsigned long block, unsigned nr_blocks); | ||
44 | 46 | ||
45 | /* Block layer ioctls */ | 47 | /* Block layer ioctls */ |
46 | int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo); | 48 | int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo); |
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index d6fb115f5a07..00e2b575021f 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/mtd/flashchip.h> | 12 | #include <linux/mtd/flashchip.h> |
13 | #include <linux/mtd/map.h> | 13 | #include <linux/mtd/map.h> |
14 | #include <linux/mtd/cfi_endian.h> | 14 | #include <linux/mtd/cfi_endian.h> |
15 | #include <linux/mtd/xip.h> | ||
15 | 16 | ||
16 | #ifdef CONFIG_MTD_CFI_I1 | 17 | #ifdef CONFIG_MTD_CFI_I1 |
17 | #define cfi_interleave(cfi) 1 | 18 | #define cfi_interleave(cfi) 1 |
@@ -281,9 +282,25 @@ struct cfi_private { | |||
281 | /* | 282 | /* |
282 | * Returns the command address according to the given geometry. | 283 | * Returns the command address according to the given geometry. |
283 | */ | 284 | */ |
284 | static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs, int interleave, int type) | 285 | static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs, |
286 | struct map_info *map, struct cfi_private *cfi) | ||
285 | { | 287 | { |
286 | return (cmd_ofs * type) * interleave; | 288 | unsigned bankwidth = map_bankwidth(map); |
289 | unsigned interleave = cfi_interleave(cfi); | ||
290 | unsigned type = cfi->device_type; | ||
291 | uint32_t addr; | ||
292 | |||
293 | addr = (cmd_ofs * type) * interleave; | ||
294 | |||
295 | /* Modify the unlock address if we are in compatiblity mode. | ||
296 | * For 16bit devices on 8 bit busses | ||
297 | * and 32bit devices on 16 bit busses | ||
298 | * set the low bit of the alternating bit sequence of the address. | ||
299 | */ | ||
300 | if (((type * interleave) > bankwidth) && ((uint8_t)cmd_ofs == 0xaa)) | ||
301 | addr |= (type >> 1)*interleave; | ||
302 | |||
303 | return addr; | ||
287 | } | 304 | } |
288 | 305 | ||
289 | /* | 306 | /* |
@@ -429,8 +446,7 @@ static inline uint32_t cfi_send_gen_cmd(u_char cmd, uint32_t cmd_addr, uint32_t | |||
429 | int type, map_word *prev_val) | 446 | int type, map_word *prev_val) |
430 | { | 447 | { |
431 | map_word val; | 448 | map_word val; |
432 | uint32_t addr = base + cfi_build_cmd_addr(cmd_addr, cfi_interleave(cfi), type); | 449 | uint32_t addr = base + cfi_build_cmd_addr(cmd_addr, map, cfi); |
433 | |||
434 | val = cfi_build_cmd(cmd, map, cfi); | 450 | val = cfi_build_cmd(cmd, map, cfi); |
435 | 451 | ||
436 | if (prev_val) | 452 | if (prev_val) |
@@ -483,6 +499,13 @@ static inline void cfi_udelay(int us) | |||
483 | } | 499 | } |
484 | } | 500 | } |
485 | 501 | ||
502 | int __xipram cfi_qry_present(struct map_info *map, __u32 base, | ||
503 | struct cfi_private *cfi); | ||
504 | int __xipram cfi_qry_mode_on(uint32_t base, struct map_info *map, | ||
505 | struct cfi_private *cfi); | ||
506 | void __xipram cfi_qry_mode_off(uint32_t base, struct map_info *map, | ||
507 | struct cfi_private *cfi); | ||
508 | |||
486 | struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t size, | 509 | struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t size, |
487 | const char* name); | 510 | const char* name); |
488 | struct cfi_fixup { | 511 | struct cfi_fixup { |
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h index 08dd131301c1..d4f38c5fd44e 100644 --- a/include/linux/mtd/flashchip.h +++ b/include/linux/mtd/flashchip.h | |||
@@ -73,6 +73,10 @@ struct flchip { | |||
73 | int buffer_write_time; | 73 | int buffer_write_time; |
74 | int erase_time; | 74 | int erase_time; |
75 | 75 | ||
76 | int word_write_time_max; | ||
77 | int buffer_write_time_max; | ||
78 | int erase_time_max; | ||
79 | |||
76 | void *priv; | 80 | void *priv; |
77 | }; | 81 | }; |
78 | 82 | ||
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 922636548558..eae26bb6430a 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -25,8 +25,10 @@ | |||
25 | #define MTD_ERASE_DONE 0x08 | 25 | #define MTD_ERASE_DONE 0x08 |
26 | #define MTD_ERASE_FAILED 0x10 | 26 | #define MTD_ERASE_FAILED 0x10 |
27 | 27 | ||
28 | #define MTD_FAIL_ADDR_UNKNOWN 0xffffffff | ||
29 | |||
28 | /* If the erase fails, fail_addr might indicate exactly which block failed. If | 30 | /* If the erase fails, fail_addr might indicate exactly which block failed. If |
29 | fail_addr = 0xffffffff, the failure was not at the device level or was not | 31 | fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not at the device level or was not |
30 | specific to any particular block. */ | 32 | specific to any particular block. */ |
31 | struct erase_info { | 33 | struct erase_info { |
32 | struct mtd_info *mtd; | 34 | struct mtd_info *mtd; |
diff --git a/include/linux/mtd/nand-gpio.h b/include/linux/mtd/nand-gpio.h new file mode 100644 index 000000000000..51534e50f7fc --- /dev/null +++ b/include/linux/mtd/nand-gpio.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef __LINUX_MTD_NAND_GPIO_H | ||
2 | #define __LINUX_MTD_NAND_GPIO_H | ||
3 | |||
4 | #include <linux/mtd/nand.h> | ||
5 | |||
6 | struct gpio_nand_platdata { | ||
7 | int gpio_nce; | ||
8 | int gpio_nwp; | ||
9 | int gpio_cle; | ||
10 | int gpio_ale; | ||
11 | int gpio_rdy; | ||
12 | void (*adjust_parts)(struct gpio_nand_platdata *, size_t); | ||
13 | struct mtd_partition *parts; | ||
14 | unsigned int num_parts; | ||
15 | unsigned int options; | ||
16 | int chip_delay; | ||
17 | }; | ||
18 | |||
19 | #endif | ||
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 81774e5facf4..733d3f3b4eb8 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -248,6 +248,7 @@ struct nand_hw_control { | |||
248 | * @read_page_raw: function to read a raw page without ECC | 248 | * @read_page_raw: function to read a raw page without ECC |
249 | * @write_page_raw: function to write a raw page without ECC | 249 | * @write_page_raw: function to write a raw page without ECC |
250 | * @read_page: function to read a page according to the ecc generator requirements | 250 | * @read_page: function to read a page according to the ecc generator requirements |
251 | * @read_subpage: function to read parts of the page covered by ECC. | ||
251 | * @write_page: function to write a page according to the ecc generator requirements | 252 | * @write_page: function to write a page according to the ecc generator requirements |
252 | * @read_oob: function to read chip OOB data | 253 | * @read_oob: function to read chip OOB data |
253 | * @write_oob: function to write chip OOB data | 254 | * @write_oob: function to write chip OOB data |
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h index d1b310c92eb4..0c6bbe28f38c 100644 --- a/include/linux/mtd/onenand_regs.h +++ b/include/linux/mtd/onenand_regs.h | |||
@@ -152,6 +152,8 @@ | |||
152 | #define ONENAND_SYS_CFG1_INT (1 << 6) | 152 | #define ONENAND_SYS_CFG1_INT (1 << 6) |
153 | #define ONENAND_SYS_CFG1_IOBE (1 << 5) | 153 | #define ONENAND_SYS_CFG1_IOBE (1 << 5) |
154 | #define ONENAND_SYS_CFG1_RDY_CONF (1 << 4) | 154 | #define ONENAND_SYS_CFG1_RDY_CONF (1 << 4) |
155 | #define ONENAND_SYS_CFG1_HF (1 << 2) | ||
156 | #define ONENAND_SYS_CFG1_SYNC_WRITE (1 << 1) | ||
155 | 157 | ||
156 | /* | 158 | /* |
157 | * Controller Status Register F240h (R) | 159 | * Controller Status Register F240h (R) |
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h index 5014f7a9f5df..c92b4d439609 100644 --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h | |||
@@ -73,7 +73,6 @@ struct device; | |||
73 | struct device_node; | 73 | struct device_node; |
74 | 74 | ||
75 | int __devinit of_mtd_parse_partitions(struct device *dev, | 75 | int __devinit of_mtd_parse_partitions(struct device *dev, |
76 | struct mtd_info *mtd, | ||
77 | struct device_node *node, | 76 | struct device_node *node, |
78 | struct mtd_partition **pparts); | 77 | struct mtd_partition **pparts); |
79 | 78 | ||
diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h new file mode 100644 index 000000000000..e77c1cea404d --- /dev/null +++ b/include/linux/mtd/sh_flctl.h | |||
@@ -0,0 +1,125 @@ | |||
1 | /* | ||
2 | * SuperH FLCTL nand controller | ||
3 | * | ||
4 | * Copyright © 2008 Renesas Solutions Corp. | ||
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; version 2 of the License. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | */ | ||
19 | |||
20 | #ifndef __SH_FLCTL_H__ | ||
21 | #define __SH_FLCTL_H__ | ||
22 | |||
23 | #include <linux/mtd/mtd.h> | ||
24 | #include <linux/mtd/nand.h> | ||
25 | #include <linux/mtd/partitions.h> | ||
26 | |||
27 | /* FLCTL registers */ | ||
28 | #define FLCMNCR(f) (f->reg + 0x0) | ||
29 | #define FLCMDCR(f) (f->reg + 0x4) | ||
30 | #define FLCMCDR(f) (f->reg + 0x8) | ||
31 | #define FLADR(f) (f->reg + 0xC) | ||
32 | #define FLADR2(f) (f->reg + 0x3C) | ||
33 | #define FLDATAR(f) (f->reg + 0x10) | ||
34 | #define FLDTCNTR(f) (f->reg + 0x14) | ||
35 | #define FLINTDMACR(f) (f->reg + 0x18) | ||
36 | #define FLBSYTMR(f) (f->reg + 0x1C) | ||
37 | #define FLBSYCNT(f) (f->reg + 0x20) | ||
38 | #define FLDTFIFO(f) (f->reg + 0x24) | ||
39 | #define FLECFIFO(f) (f->reg + 0x28) | ||
40 | #define FLTRCR(f) (f->reg + 0x2C) | ||
41 | #define FL4ECCRESULT0(f) (f->reg + 0x80) | ||
42 | #define FL4ECCRESULT1(f) (f->reg + 0x84) | ||
43 | #define FL4ECCRESULT2(f) (f->reg + 0x88) | ||
44 | #define FL4ECCRESULT3(f) (f->reg + 0x8C) | ||
45 | #define FL4ECCCR(f) (f->reg + 0x90) | ||
46 | #define FL4ECCCNT(f) (f->reg + 0x94) | ||
47 | #define FLERRADR(f) (f->reg + 0x98) | ||
48 | |||
49 | /* FLCMNCR control bits */ | ||
50 | #define ECCPOS2 (0x1 << 25) | ||
51 | #define _4ECCCNTEN (0x1 << 24) | ||
52 | #define _4ECCEN (0x1 << 23) | ||
53 | #define _4ECCCORRECT (0x1 << 22) | ||
54 | #define SNAND_E (0x1 << 18) /* SNAND (0=512 1=2048)*/ | ||
55 | #define QTSEL_E (0x1 << 17) | ||
56 | #define ENDIAN (0x1 << 16) /* 1 = little endian */ | ||
57 | #define FCKSEL_E (0x1 << 15) | ||
58 | #define ECCPOS_00 (0x00 << 12) | ||
59 | #define ECCPOS_01 (0x01 << 12) | ||
60 | #define ECCPOS_02 (0x02 << 12) | ||
61 | #define ACM_SACCES_MODE (0x01 << 10) | ||
62 | #define NANWF_E (0x1 << 9) | ||
63 | #define SE_D (0x1 << 8) /* Spare area disable */ | ||
64 | #define CE1_ENABLE (0x1 << 4) /* Chip Enable 1 */ | ||
65 | #define CE0_ENABLE (0x1 << 3) /* Chip Enable 0 */ | ||
66 | #define TYPESEL_SET (0x1 << 0) | ||
67 | |||
68 | /* FLCMDCR control bits */ | ||
69 | #define ADRCNT2_E (0x1 << 31) /* 5byte address enable */ | ||
70 | #define ADRMD_E (0x1 << 26) /* Sector address access */ | ||
71 | #define CDSRC_E (0x1 << 25) /* Data buffer selection */ | ||
72 | #define DOSR_E (0x1 << 24) /* Status read check */ | ||
73 | #define SELRW (0x1 << 21) /* 0:read 1:write */ | ||
74 | #define DOADR_E (0x1 << 20) /* Address stage execute */ | ||
75 | #define ADRCNT_1 (0x00 << 18) /* Address data bytes: 1byte */ | ||
76 | #define ADRCNT_2 (0x01 << 18) /* Address data bytes: 2byte */ | ||
77 | #define ADRCNT_3 (0x02 << 18) /* Address data bytes: 3byte */ | ||
78 | #define ADRCNT_4 (0x03 << 18) /* Address data bytes: 4byte */ | ||
79 | #define DOCMD2_E (0x1 << 17) /* 2nd cmd stage execute */ | ||
80 | #define DOCMD1_E (0x1 << 16) /* 1st cmd stage execute */ | ||
81 | |||
82 | /* FLTRCR control bits */ | ||
83 | #define TRSTRT (0x1 << 0) /* translation start */ | ||
84 | #define TREND (0x1 << 1) /* translation end */ | ||
85 | |||
86 | /* FL4ECCCR control bits */ | ||
87 | #define _4ECCFA (0x1 << 2) /* 4 symbols correct fault */ | ||
88 | #define _4ECCEND (0x1 << 1) /* 4 symbols end */ | ||
89 | #define _4ECCEXST (0x1 << 0) /* 4 symbols exist */ | ||
90 | |||
91 | #define INIT_FL4ECCRESULT_VAL 0x03FF03FF | ||
92 | #define LOOP_TIMEOUT_MAX 0x00010000 | ||
93 | |||
94 | #define mtd_to_flctl(mtd) container_of(mtd, struct sh_flctl, mtd) | ||
95 | |||
96 | struct sh_flctl { | ||
97 | struct mtd_info mtd; | ||
98 | struct nand_chip chip; | ||
99 | void __iomem *reg; | ||
100 | |||
101 | uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */ | ||
102 | int read_bytes; | ||
103 | int index; | ||
104 | int seqin_column; /* column in SEQIN cmd */ | ||
105 | int seqin_page_addr; /* page_addr in SEQIN cmd */ | ||
106 | uint32_t seqin_read_cmd; /* read cmd in SEQIN cmd */ | ||
107 | int erase1_page_addr; /* page_addr in ERASE1 cmd */ | ||
108 | uint32_t erase_ADRCNT; /* bits of FLCMDCR in ERASE1 cmd */ | ||
109 | uint32_t rw_ADRCNT; /* bits of FLCMDCR in READ WRITE cmd */ | ||
110 | |||
111 | int hwecc_cant_correct[4]; | ||
112 | |||
113 | unsigned page_size:1; /* NAND page size (0 = 512, 1 = 2048) */ | ||
114 | unsigned hwecc:1; /* Hardware ECC (0 = disabled, 1 = enabled) */ | ||
115 | }; | ||
116 | |||
117 | struct sh_flctl_platform_data { | ||
118 | struct mtd_partition *parts; | ||
119 | int nr_parts; | ||
120 | unsigned long flcmncr_val; | ||
121 | |||
122 | unsigned has_hwecc:1; | ||
123 | }; | ||
124 | |||
125 | #endif /* __SH_FLCTL_H__ */ | ||
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h index 12078577aef6..cbbbe9bfecad 100644 --- a/include/linux/mv643xx_eth.h +++ b/include/linux/mv643xx_eth.h | |||
@@ -17,9 +17,14 @@ | |||
17 | 17 | ||
18 | struct mv643xx_eth_shared_platform_data { | 18 | struct mv643xx_eth_shared_platform_data { |
19 | struct mbus_dram_target_info *dram; | 19 | struct mbus_dram_target_info *dram; |
20 | struct platform_device *shared_smi; | ||
20 | unsigned int t_clk; | 21 | unsigned int t_clk; |
21 | }; | 22 | }; |
22 | 23 | ||
24 | #define MV643XX_ETH_PHY_ADDR_DEFAULT 0 | ||
25 | #define MV643XX_ETH_PHY_ADDR(x) (0x80 | (x)) | ||
26 | #define MV643XX_ETH_PHY_NONE 0xff | ||
27 | |||
23 | struct mv643xx_eth_platform_data { | 28 | struct mv643xx_eth_platform_data { |
24 | /* | 29 | /* |
25 | * Pointer back to our parent instance, and our port number. | 30 | * Pointer back to our parent instance, and our port number. |
@@ -30,8 +35,6 @@ struct mv643xx_eth_platform_data { | |||
30 | /* | 35 | /* |
31 | * Whether a PHY is present, and if yes, at which address. | 36 | * Whether a PHY is present, and if yes, at which address. |
32 | */ | 37 | */ |
33 | struct platform_device *shared_smi; | ||
34 | int force_phy_addr; | ||
35 | int phy_addr; | 38 | int phy_addr; |
36 | 39 | ||
37 | /* | 40 | /* |
@@ -49,10 +52,10 @@ struct mv643xx_eth_platform_data { | |||
49 | int duplex; | 52 | int duplex; |
50 | 53 | ||
51 | /* | 54 | /* |
52 | * Which RX/TX queues to use. | 55 | * How many RX/TX queues to use. |
53 | */ | 56 | */ |
54 | int rx_queue_mask; | 57 | int rx_queue_count; |
55 | int tx_queue_mask; | 58 | int tx_queue_count; |
56 | 59 | ||
57 | /* | 60 | /* |
58 | * Override default RX/TX queue sizes if nonzero. | 61 | * Override default RX/TX queue sizes if nonzero. |
diff --git a/include/linux/namei.h b/include/linux/namei.h index 68f8c3203c89..99eb80306dc5 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h | |||
@@ -51,8 +51,10 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND}; | |||
51 | /* | 51 | /* |
52 | * Intent data | 52 | * Intent data |
53 | */ | 53 | */ |
54 | #define LOOKUP_OPEN (0x0100) | 54 | #define LOOKUP_OPEN 0x0100 |
55 | #define LOOKUP_CREATE (0x0200) | 55 | #define LOOKUP_CREATE 0x0200 |
56 | #define LOOKUP_EXCL 0x0400 | ||
57 | #define LOOKUP_RENAME_TARGET 0x0800 | ||
56 | 58 | ||
57 | extern int user_path_at(int, const char __user *, unsigned, struct path *); | 59 | extern int user_path_at(int, const char __user *, unsigned, struct path *); |
58 | 60 | ||
@@ -61,6 +63,8 @@ extern int user_path_at(int, const char __user *, unsigned, struct path *); | |||
61 | #define user_path_dir(name, path) \ | 63 | #define user_path_dir(name, path) \ |
62 | user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, path) | 64 | user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, path) |
63 | 65 | ||
66 | extern int kern_path(const char *, unsigned, struct path *); | ||
67 | |||
64 | extern int path_lookup(const char *, unsigned, struct nameidata *); | 68 | extern int path_lookup(const char *, unsigned, struct nameidata *); |
65 | extern int vfs_path_lookup(struct dentry *, struct vfsmount *, | 69 | extern int vfs_path_lookup(struct dentry *, struct vfsmount *, |
66 | const char *, unsigned int, struct nameidata *); | 70 | const char *, unsigned int, struct nameidata *); |
diff --git a/include/linux/net.h b/include/linux/net.h index 6dc14a240042..4515efae4c39 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -40,7 +40,7 @@ | |||
40 | #define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */ | 40 | #define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */ |
41 | #define SYS_SENDMSG 16 /* sys_sendmsg(2) */ | 41 | #define SYS_SENDMSG 16 /* sys_sendmsg(2) */ |
42 | #define SYS_RECVMSG 17 /* sys_recvmsg(2) */ | 42 | #define SYS_RECVMSG 17 /* sys_recvmsg(2) */ |
43 | #define SYS_PACCEPT 18 /* sys_paccept(2) */ | 43 | #define SYS_ACCEPT4 18 /* sys_accept4(2) */ |
44 | 44 | ||
45 | typedef enum { | 45 | typedef enum { |
46 | SS_FREE = 0, /* not allocated */ | 46 | SS_FREE = 0, /* not allocated */ |
@@ -100,7 +100,7 @@ enum sock_type { | |||
100 | * remaining bits are used as flags. */ | 100 | * remaining bits are used as flags. */ |
101 | #define SOCK_TYPE_MASK 0xf | 101 | #define SOCK_TYPE_MASK 0xf |
102 | 102 | ||
103 | /* Flags for socket, socketpair, paccept */ | 103 | /* Flags for socket, socketpair, accept4 */ |
104 | #define SOCK_CLOEXEC O_CLOEXEC | 104 | #define SOCK_CLOEXEC O_CLOEXEC |
105 | #ifndef SOCK_NONBLOCK | 105 | #ifndef SOCK_NONBLOCK |
106 | #define SOCK_NONBLOCK O_NONBLOCK | 106 | #define SOCK_NONBLOCK O_NONBLOCK |
@@ -223,8 +223,6 @@ extern int sock_map_fd(struct socket *sock, int flags); | |||
223 | extern struct socket *sockfd_lookup(int fd, int *err); | 223 | extern struct socket *sockfd_lookup(int fd, int *err); |
224 | #define sockfd_put(sock) fput(sock->file) | 224 | #define sockfd_put(sock) fput(sock->file) |
225 | extern int net_ratelimit(void); | 225 | extern int net_ratelimit(void); |
226 | extern long do_accept(int fd, struct sockaddr __user *upeer_sockaddr, | ||
227 | int __user *upeer_addrlen, int flags); | ||
228 | 226 | ||
229 | #define net_random() random32() | 227 | #define net_random() random32() |
230 | #define net_srandom(seed) srandom32((__force u32)seed) | 228 | #define net_srandom(seed) srandom32((__force u32)seed) |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 488c56e649b5..9d77b1d7dca8 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -11,7 +11,7 @@ | |||
11 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | 11 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
12 | * Corey Minyard <wf-rch!minyard@relay.EU.net> | 12 | * Corey Minyard <wf-rch!minyard@relay.EU.net> |
13 | * Donald J. Becker, <becker@cesdis.gsfc.nasa.gov> | 13 | * Donald J. Becker, <becker@cesdis.gsfc.nasa.gov> |
14 | * Alan Cox, <Alan.Cox@linux.org> | 14 | * Alan Cox, <alan@lxorguk.ukuu.org.uk> |
15 | * Bjorn Ekwall. <bj0rn@blox.se> | 15 | * Bjorn Ekwall. <bj0rn@blox.se> |
16 | * Pekka Riikonen <priikone@poseidon.pspt.fi> | 16 | * Pekka Riikonen <priikone@poseidon.pspt.fi> |
17 | * | 17 | * |
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/workqueue.h> | 42 | #include <linux/workqueue.h> |
43 | 43 | ||
44 | #include <net/net_namespace.h> | 44 | #include <net/net_namespace.h> |
45 | #include <net/dsa.h> | ||
45 | 46 | ||
46 | struct vlan_group; | 47 | struct vlan_group; |
47 | struct ethtool_ops; | 48 | struct ethtool_ops; |
@@ -471,6 +472,8 @@ struct net_device | |||
471 | char name[IFNAMSIZ]; | 472 | char name[IFNAMSIZ]; |
472 | /* device name hash chain */ | 473 | /* device name hash chain */ |
473 | struct hlist_node name_hlist; | 474 | struct hlist_node name_hlist; |
475 | /* snmp alias */ | ||
476 | char *ifalias; | ||
474 | 477 | ||
475 | /* | 478 | /* |
476 | * I/O specific fields | 479 | * I/O specific fields |
@@ -538,6 +541,14 @@ struct net_device | |||
538 | #define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM) | 541 | #define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM) |
539 | #define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM) | 542 | #define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM) |
540 | 543 | ||
544 | /* | ||
545 | * If one device supports one of these features, then enable them | ||
546 | * for all in netdev_increment_features. | ||
547 | */ | ||
548 | #define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \ | ||
549 | NETIF_F_SG | NETIF_F_HIGHDMA | \ | ||
550 | NETIF_F_FRAGLIST) | ||
551 | |||
541 | /* Interface index. Unique device identifier */ | 552 | /* Interface index. Unique device identifier */ |
542 | int ifindex; | 553 | int ifindex; |
543 | int iflink; | 554 | int iflink; |
@@ -605,6 +616,9 @@ struct net_device | |||
605 | 616 | ||
606 | /* Protocol specific pointers */ | 617 | /* Protocol specific pointers */ |
607 | 618 | ||
619 | #ifdef CONFIG_NET_DSA | ||
620 | void *dsa_ptr; /* dsa specific data */ | ||
621 | #endif | ||
608 | void *atalk_ptr; /* AppleTalk link */ | 622 | void *atalk_ptr; /* AppleTalk link */ |
609 | void *ip_ptr; /* IPv4 specific data */ | 623 | void *ip_ptr; /* IPv4 specific data */ |
610 | void *dn_ptr; /* DECnet specific data */ | 624 | void *dn_ptr; /* DECnet specific data */ |
@@ -796,6 +810,26 @@ void dev_net_set(struct net_device *dev, struct net *net) | |||
796 | #endif | 810 | #endif |
797 | } | 811 | } |
798 | 812 | ||
813 | static inline bool netdev_uses_dsa_tags(struct net_device *dev) | ||
814 | { | ||
815 | #ifdef CONFIG_NET_DSA_TAG_DSA | ||
816 | if (dev->dsa_ptr != NULL) | ||
817 | return dsa_uses_dsa_tags(dev->dsa_ptr); | ||
818 | #endif | ||
819 | |||
820 | return 0; | ||
821 | } | ||
822 | |||
823 | static inline bool netdev_uses_trailer_tags(struct net_device *dev) | ||
824 | { | ||
825 | #ifdef CONFIG_NET_DSA_TAG_TRAILER | ||
826 | if (dev->dsa_ptr != NULL) | ||
827 | return dsa_uses_trailer_tags(dev->dsa_ptr); | ||
828 | #endif | ||
829 | |||
830 | return 0; | ||
831 | } | ||
832 | |||
799 | /** | 833 | /** |
800 | * netdev_priv - access network device private data | 834 | * netdev_priv - access network device private data |
801 | * @dev: network device | 835 | * @dev: network device |
@@ -1223,7 +1257,8 @@ extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); | |||
1223 | extern int dev_ethtool(struct net *net, struct ifreq *); | 1257 | extern int dev_ethtool(struct net *net, struct ifreq *); |
1224 | extern unsigned dev_get_flags(const struct net_device *); | 1258 | extern unsigned dev_get_flags(const struct net_device *); |
1225 | extern int dev_change_flags(struct net_device *, unsigned); | 1259 | extern int dev_change_flags(struct net_device *, unsigned); |
1226 | extern int dev_change_name(struct net_device *, char *); | 1260 | extern int dev_change_name(struct net_device *, const char *); |
1261 | extern int dev_set_alias(struct net_device *, const char *, size_t); | ||
1227 | extern int dev_change_net_namespace(struct net_device *, | 1262 | extern int dev_change_net_namespace(struct net_device *, |
1228 | struct net *, const char *); | 1263 | struct net *, const char *); |
1229 | extern int dev_set_mtu(struct net_device *, int); | 1264 | extern int dev_set_mtu(struct net_device *, int); |
@@ -1502,7 +1537,6 @@ static inline void __netif_tx_unlock_bh(struct netdev_queue *txq) | |||
1502 | /** | 1537 | /** |
1503 | * netif_tx_lock - grab network device transmit lock | 1538 | * netif_tx_lock - grab network device transmit lock |
1504 | * @dev: network device | 1539 | * @dev: network device |
1505 | * @cpu: cpu number of lock owner | ||
1506 | * | 1540 | * |
1507 | * Get network device transmit lock | 1541 | * Get network device transmit lock |
1508 | */ | 1542 | */ |
@@ -1667,11 +1701,13 @@ extern void dev_seq_stop(struct seq_file *seq, void *v); | |||
1667 | extern int netdev_class_create_file(struct class_attribute *class_attr); | 1701 | extern int netdev_class_create_file(struct class_attribute *class_attr); |
1668 | extern void netdev_class_remove_file(struct class_attribute *class_attr); | 1702 | extern void netdev_class_remove_file(struct class_attribute *class_attr); |
1669 | 1703 | ||
1670 | extern char *netdev_drivername(struct net_device *dev, char *buffer, int len); | 1704 | extern char *netdev_drivername(const struct net_device *dev, char *buffer, int len); |
1671 | 1705 | ||
1672 | extern void linkwatch_run_queue(void); | 1706 | extern void linkwatch_run_queue(void); |
1673 | 1707 | ||
1674 | extern int netdev_compute_features(unsigned long all, unsigned long one); | 1708 | unsigned long netdev_increment_features(unsigned long all, unsigned long one, |
1709 | unsigned long mask); | ||
1710 | unsigned long netdev_fix_features(unsigned long features, const char *name); | ||
1675 | 1711 | ||
1676 | static inline int net_gso_ok(int features, int gso_type) | 1712 | static inline int net_gso_ok(int features, int gso_type) |
1677 | { | 1713 | { |
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 0c5eb7ed8b3f..48cfe51bfddc 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -5,13 +5,11 @@ | |||
5 | #include <linux/init.h> | 5 | #include <linux/init.h> |
6 | #include <linux/skbuff.h> | 6 | #include <linux/skbuff.h> |
7 | #include <linux/net.h> | 7 | #include <linux/net.h> |
8 | #include <linux/netdevice.h> | ||
9 | #include <linux/if.h> | 8 | #include <linux/if.h> |
10 | #include <linux/in.h> | 9 | #include <linux/in.h> |
11 | #include <linux/in6.h> | 10 | #include <linux/in6.h> |
12 | #include <linux/wait.h> | 11 | #include <linux/wait.h> |
13 | #include <linux/list.h> | 12 | #include <linux/list.h> |
14 | #include <net/net_namespace.h> | ||
15 | #endif | 13 | #endif |
16 | #include <linux/types.h> | 14 | #include <linux/types.h> |
17 | #include <linux/compiler.h> | 15 | #include <linux/compiler.h> |
@@ -52,6 +50,16 @@ enum nf_inet_hooks { | |||
52 | NF_INET_NUMHOOKS | 50 | NF_INET_NUMHOOKS |
53 | }; | 51 | }; |
54 | 52 | ||
53 | enum { | ||
54 | NFPROTO_UNSPEC = 0, | ||
55 | NFPROTO_IPV4 = 2, | ||
56 | NFPROTO_ARP = 3, | ||
57 | NFPROTO_BRIDGE = 7, | ||
58 | NFPROTO_IPV6 = 10, | ||
59 | NFPROTO_DECNET = 12, | ||
60 | NFPROTO_NUMPROTO, | ||
61 | }; | ||
62 | |||
55 | union nf_inet_addr { | 63 | union nf_inet_addr { |
56 | __u32 all[4]; | 64 | __u32 all[4]; |
57 | __be32 ip; | 65 | __be32 ip; |
@@ -92,8 +100,8 @@ struct nf_hook_ops | |||
92 | /* User fills in from here down. */ | 100 | /* User fills in from here down. */ |
93 | nf_hookfn *hook; | 101 | nf_hookfn *hook; |
94 | struct module *owner; | 102 | struct module *owner; |
95 | int pf; | 103 | u_int8_t pf; |
96 | int hooknum; | 104 | unsigned int hooknum; |
97 | /* Hooks are ordered in ascending priority. */ | 105 | /* Hooks are ordered in ascending priority. */ |
98 | int priority; | 106 | int priority; |
99 | }; | 107 | }; |
@@ -102,7 +110,7 @@ struct nf_sockopt_ops | |||
102 | { | 110 | { |
103 | struct list_head list; | 111 | struct list_head list; |
104 | 112 | ||
105 | int pf; | 113 | u_int8_t pf; |
106 | 114 | ||
107 | /* Non-inclusive ranges: use 0/0/NULL to never get called. */ | 115 | /* Non-inclusive ranges: use 0/0/NULL to never get called. */ |
108 | int set_optmin; | 116 | int set_optmin; |
@@ -138,9 +146,9 @@ extern struct ctl_path nf_net_netfilter_sysctl_path[]; | |||
138 | extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[]; | 146 | extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[]; |
139 | #endif /* CONFIG_SYSCTL */ | 147 | #endif /* CONFIG_SYSCTL */ |
140 | 148 | ||
141 | extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS]; | 149 | extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; |
142 | 150 | ||
143 | int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb, | 151 | int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb, |
144 | struct net_device *indev, struct net_device *outdev, | 152 | struct net_device *indev, struct net_device *outdev, |
145 | int (*okfn)(struct sk_buff *), int thresh); | 153 | int (*okfn)(struct sk_buff *), int thresh); |
146 | 154 | ||
@@ -151,7 +159,7 @@ int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb, | |||
151 | * okfn must be invoked by the caller in this case. Any other return | 159 | * okfn must be invoked by the caller in this case. Any other return |
152 | * value indicates the packet has been consumed by the hook. | 160 | * value indicates the packet has been consumed by the hook. |
153 | */ | 161 | */ |
154 | static inline int nf_hook_thresh(int pf, unsigned int hook, | 162 | static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook, |
155 | struct sk_buff *skb, | 163 | struct sk_buff *skb, |
156 | struct net_device *indev, | 164 | struct net_device *indev, |
157 | struct net_device *outdev, | 165 | struct net_device *outdev, |
@@ -167,7 +175,7 @@ static inline int nf_hook_thresh(int pf, unsigned int hook, | |||
167 | return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh); | 175 | return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh); |
168 | } | 176 | } |
169 | 177 | ||
170 | static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb, | 178 | static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, |
171 | struct net_device *indev, struct net_device *outdev, | 179 | struct net_device *indev, struct net_device *outdev, |
172 | int (*okfn)(struct sk_buff *)) | 180 | int (*okfn)(struct sk_buff *)) |
173 | { | 181 | { |
@@ -212,14 +220,14 @@ __ret;}) | |||
212 | NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN) | 220 | NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN) |
213 | 221 | ||
214 | /* Call setsockopt() */ | 222 | /* Call setsockopt() */ |
215 | int nf_setsockopt(struct sock *sk, int pf, int optval, char __user *opt, | 223 | int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, |
216 | int len); | 224 | int len); |
217 | int nf_getsockopt(struct sock *sk, int pf, int optval, char __user *opt, | 225 | int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, |
218 | int *len); | 226 | int *len); |
219 | 227 | ||
220 | int compat_nf_setsockopt(struct sock *sk, int pf, int optval, | 228 | int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, |
221 | char __user *opt, int len); | 229 | char __user *opt, int len); |
222 | int compat_nf_getsockopt(struct sock *sk, int pf, int optval, | 230 | int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, |
223 | char __user *opt, int *len); | 231 | char __user *opt, int *len); |
224 | 232 | ||
225 | /* Call this before modifying an existing packet: ensures it is | 233 | /* Call this before modifying an existing packet: ensures it is |
@@ -247,7 +255,7 @@ struct nf_afinfo { | |||
247 | int route_key_size; | 255 | int route_key_size; |
248 | }; | 256 | }; |
249 | 257 | ||
250 | extern const struct nf_afinfo *nf_afinfo[NPROTO]; | 258 | extern const struct nf_afinfo *nf_afinfo[NFPROTO_NUMPROTO]; |
251 | static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family) | 259 | static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family) |
252 | { | 260 | { |
253 | return rcu_dereference(nf_afinfo[family]); | 261 | return rcu_dereference(nf_afinfo[family]); |
@@ -292,7 +300,7 @@ extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo); | |||
292 | extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); | 300 | extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); |
293 | 301 | ||
294 | static inline void | 302 | static inline void |
295 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) | 303 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family) |
296 | { | 304 | { |
297 | #ifdef CONFIG_NF_NAT_NEEDED | 305 | #ifdef CONFIG_NF_NAT_NEEDED |
298 | void (*decodefn)(struct sk_buff *, struct flowi *); | 306 | void (*decodefn)(struct sk_buff *, struct flowi *); |
@@ -315,7 +323,7 @@ extern struct proc_dir_entry *proc_net_netfilter; | |||
315 | #else /* !CONFIG_NETFILTER */ | 323 | #else /* !CONFIG_NETFILTER */ |
316 | #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) | 324 | #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) |
317 | #define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb) | 325 | #define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb) |
318 | static inline int nf_hook_thresh(int pf, unsigned int hook, | 326 | static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook, |
319 | struct sk_buff *skb, | 327 | struct sk_buff *skb, |
320 | struct net_device *indev, | 328 | struct net_device *indev, |
321 | struct net_device *outdev, | 329 | struct net_device *outdev, |
@@ -324,7 +332,7 @@ static inline int nf_hook_thresh(int pf, unsigned int hook, | |||
324 | { | 332 | { |
325 | return okfn(skb); | 333 | return okfn(skb); |
326 | } | 334 | } |
327 | static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb, | 335 | static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, |
328 | struct net_device *indev, struct net_device *outdev, | 336 | struct net_device *indev, struct net_device *outdev, |
329 | int (*okfn)(struct sk_buff *)) | 337 | int (*okfn)(struct sk_buff *)) |
330 | { | 338 | { |
@@ -332,7 +340,9 @@ static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb, | |||
332 | } | 340 | } |
333 | struct flowi; | 341 | struct flowi; |
334 | static inline void | 342 | static inline void |
335 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {} | 343 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family) |
344 | { | ||
345 | } | ||
336 | #endif /*CONFIG_NETFILTER*/ | 346 | #endif /*CONFIG_NETFILTER*/ |
337 | 347 | ||
338 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | 348 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
@@ -343,56 +353,5 @@ extern void (*nf_ct_destroy)(struct nf_conntrack *); | |||
343 | static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} | 353 | static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} |
344 | #endif | 354 | #endif |
345 | 355 | ||
346 | static inline struct net *nf_pre_routing_net(const struct net_device *in, | ||
347 | const struct net_device *out) | ||
348 | { | ||
349 | #ifdef CONFIG_NET_NS | ||
350 | return in->nd_net; | ||
351 | #else | ||
352 | return &init_net; | ||
353 | #endif | ||
354 | } | ||
355 | |||
356 | static inline struct net *nf_local_in_net(const struct net_device *in, | ||
357 | const struct net_device *out) | ||
358 | { | ||
359 | #ifdef CONFIG_NET_NS | ||
360 | return in->nd_net; | ||
361 | #else | ||
362 | return &init_net; | ||
363 | #endif | ||
364 | } | ||
365 | |||
366 | static inline struct net *nf_forward_net(const struct net_device *in, | ||
367 | const struct net_device *out) | ||
368 | { | ||
369 | #ifdef CONFIG_NET_NS | ||
370 | BUG_ON(in->nd_net != out->nd_net); | ||
371 | return in->nd_net; | ||
372 | #else | ||
373 | return &init_net; | ||
374 | #endif | ||
375 | } | ||
376 | |||
377 | static inline struct net *nf_local_out_net(const struct net_device *in, | ||
378 | const struct net_device *out) | ||
379 | { | ||
380 | #ifdef CONFIG_NET_NS | ||
381 | return out->nd_net; | ||
382 | #else | ||
383 | return &init_net; | ||
384 | #endif | ||
385 | } | ||
386 | |||
387 | static inline struct net *nf_post_routing_net(const struct net_device *in, | ||
388 | const struct net_device *out) | ||
389 | { | ||
390 | #ifdef CONFIG_NET_NS | ||
391 | return out->nd_net; | ||
392 | #else | ||
393 | return &init_net; | ||
394 | #endif | ||
395 | } | ||
396 | |||
397 | #endif /*__KERNEL__*/ | 356 | #endif /*__KERNEL__*/ |
398 | #endif /*__LINUX_NETFILTER_H*/ | 357 | #endif /*__LINUX_NETFILTER_H*/ |
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild index 3aff513d12c8..5a8af875bce2 100644 --- a/include/linux/netfilter/Kbuild +++ b/include/linux/netfilter/Kbuild | |||
@@ -32,6 +32,7 @@ header-y += xt_owner.h | |||
32 | header-y += xt_pkttype.h | 32 | header-y += xt_pkttype.h |
33 | header-y += xt_rateest.h | 33 | header-y += xt_rateest.h |
34 | header-y += xt_realm.h | 34 | header-y += xt_realm.h |
35 | header-y += xt_recent.h | ||
35 | header-y += xt_sctp.h | 36 | header-y += xt_sctp.h |
36 | header-y += xt_state.h | 37 | header-y += xt_state.h |
37 | header-y += xt_statistic.h | 38 | header-y += xt_statistic.h |
diff --git a/include/linux/netfilter/nf_conntrack_proto_gre.h b/include/linux/netfilter/nf_conntrack_proto_gre.h index 535e4219d2bb..2a10efda17fb 100644 --- a/include/linux/netfilter/nf_conntrack_proto_gre.h +++ b/include/linux/netfilter/nf_conntrack_proto_gre.h | |||
@@ -87,7 +87,7 @@ int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir, | |||
87 | /* delete keymap entries */ | 87 | /* delete keymap entries */ |
88 | void nf_ct_gre_keymap_destroy(struct nf_conn *ct); | 88 | void nf_ct_gre_keymap_destroy(struct nf_conn *ct); |
89 | 89 | ||
90 | extern void nf_ct_gre_keymap_flush(void); | 90 | extern void nf_ct_gre_keymap_flush(struct net *net); |
91 | extern void nf_nat_need_gre(void); | 91 | extern void nf_nat_need_gre(void); |
92 | 92 | ||
93 | #endif /* __KERNEL__ */ | 93 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index 0d8424f76899..7d8e0455ccac 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h | |||
@@ -78,6 +78,9 @@ extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, | |||
78 | int echo); | 78 | int echo); |
79 | extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags); | 79 | extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags); |
80 | 80 | ||
81 | extern void nfnl_lock(void); | ||
82 | extern void nfnl_unlock(void); | ||
83 | |||
81 | #define MODULE_ALIAS_NFNL_SUBSYS(subsys) \ | 84 | #define MODULE_ALIAS_NFNL_SUBSYS(subsys) \ |
82 | MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys)) | 85 | MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys)) |
83 | 86 | ||
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h index 2326296b6f25..be41b609c88f 100644 --- a/include/linux/netfilter/x_tables.h +++ b/include/linux/netfilter/x_tables.h | |||
@@ -173,6 +173,98 @@ struct xt_counters_info | |||
173 | 173 | ||
174 | #include <linux/netdevice.h> | 174 | #include <linux/netdevice.h> |
175 | 175 | ||
176 | /** | ||
177 | * struct xt_match_param - parameters for match extensions' match functions | ||
178 | * | ||
179 | * @in: input netdevice | ||
180 | * @out: output netdevice | ||
181 | * @match: struct xt_match through which this function was invoked | ||
182 | * @matchinfo: per-match data | ||
183 | * @fragoff: packet is a fragment, this is the data offset | ||
184 | * @thoff: position of transport header relative to skb->data | ||
185 | * @hotdrop: drop packet if we had inspection problems | ||
186 | * @family: Actual NFPROTO_* through which the function is invoked | ||
187 | * (helpful when match->family == NFPROTO_UNSPEC) | ||
188 | */ | ||
189 | struct xt_match_param { | ||
190 | const struct net_device *in, *out; | ||
191 | const struct xt_match *match; | ||
192 | const void *matchinfo; | ||
193 | int fragoff; | ||
194 | unsigned int thoff; | ||
195 | bool *hotdrop; | ||
196 | u_int8_t family; | ||
197 | }; | ||
198 | |||
199 | /** | ||
200 | * struct xt_mtchk_param - parameters for match extensions' | ||
201 | * checkentry functions | ||
202 | * | ||
203 | * @table: table the rule is tried to be inserted into | ||
204 | * @entryinfo: the family-specific rule data | ||
205 | * (struct ipt_ip, ip6t_ip, ebt_entry) | ||
206 | * @match: struct xt_match through which this function was invoked | ||
207 | * @matchinfo: per-match data | ||
208 | * @hook_mask: via which hooks the new rule is reachable | ||
209 | */ | ||
210 | struct xt_mtchk_param { | ||
211 | const char *table; | ||
212 | const void *entryinfo; | ||
213 | const struct xt_match *match; | ||
214 | void *matchinfo; | ||
215 | unsigned int hook_mask; | ||
216 | u_int8_t family; | ||
217 | }; | ||
218 | |||
219 | /* Match destructor parameters */ | ||
220 | struct xt_mtdtor_param { | ||
221 | const struct xt_match *match; | ||
222 | void *matchinfo; | ||
223 | u_int8_t family; | ||
224 | }; | ||
225 | |||
226 | /** | ||
227 | * struct xt_target_param - parameters for target extensions' target functions | ||
228 | * | ||
229 | * @hooknum: hook through which this target was invoked | ||
230 | * @target: struct xt_target through which this function was invoked | ||
231 | * @targinfo: per-target data | ||
232 | * | ||
233 | * Other fields see above. | ||
234 | */ | ||
235 | struct xt_target_param { | ||
236 | const struct net_device *in, *out; | ||
237 | unsigned int hooknum; | ||
238 | const struct xt_target *target; | ||
239 | const void *targinfo; | ||
240 | u_int8_t family; | ||
241 | }; | ||
242 | |||
243 | /** | ||
244 | * struct xt_tgchk_param - parameters for target extensions' | ||
245 | * checkentry functions | ||
246 | * | ||
247 | * @entryinfo: the family-specific rule data | ||
248 | * (struct ipt_entry, ip6t_entry, arpt_entry, ebt_entry) | ||
249 | * | ||
250 | * Other fields see above. | ||
251 | */ | ||
252 | struct xt_tgchk_param { | ||
253 | const char *table; | ||
254 | void *entryinfo; | ||
255 | const struct xt_target *target; | ||
256 | void *targinfo; | ||
257 | unsigned int hook_mask; | ||
258 | u_int8_t family; | ||
259 | }; | ||
260 | |||
261 | /* Target destructor parameters */ | ||
262 | struct xt_tgdtor_param { | ||
263 | const struct xt_target *target; | ||
264 | void *targinfo; | ||
265 | u_int8_t family; | ||
266 | }; | ||
267 | |||
176 | struct xt_match | 268 | struct xt_match |
177 | { | 269 | { |
178 | struct list_head list; | 270 | struct list_head list; |
@@ -185,24 +277,13 @@ struct xt_match | |||
185 | non-linear skb, using skb_header_pointer and | 277 | non-linear skb, using skb_header_pointer and |
186 | skb_ip_make_writable. */ | 278 | skb_ip_make_writable. */ |
187 | bool (*match)(const struct sk_buff *skb, | 279 | bool (*match)(const struct sk_buff *skb, |
188 | const struct net_device *in, | 280 | const struct xt_match_param *); |
189 | const struct net_device *out, | ||
190 | const struct xt_match *match, | ||
191 | const void *matchinfo, | ||
192 | int offset, | ||
193 | unsigned int protoff, | ||
194 | bool *hotdrop); | ||
195 | 281 | ||
196 | /* Called when user tries to insert an entry of this type. */ | 282 | /* Called when user tries to insert an entry of this type. */ |
197 | /* Should return true or false. */ | 283 | bool (*checkentry)(const struct xt_mtchk_param *); |
198 | bool (*checkentry)(const char *tablename, | ||
199 | const void *ip, | ||
200 | const struct xt_match *match, | ||
201 | void *matchinfo, | ||
202 | unsigned int hook_mask); | ||
203 | 284 | ||
204 | /* Called when entry of this type deleted. */ | 285 | /* Called when entry of this type deleted. */ |
205 | void (*destroy)(const struct xt_match *match, void *matchinfo); | 286 | void (*destroy)(const struct xt_mtdtor_param *); |
206 | 287 | ||
207 | /* Called when userspace align differs from kernel space one */ | 288 | /* Called when userspace align differs from kernel space one */ |
208 | void (*compat_from_user)(void *dst, void *src); | 289 | void (*compat_from_user)(void *dst, void *src); |
@@ -235,24 +316,16 @@ struct xt_target | |||
235 | must now handle non-linear skbs, using skb_copy_bits and | 316 | must now handle non-linear skbs, using skb_copy_bits and |
236 | skb_ip_make_writable. */ | 317 | skb_ip_make_writable. */ |
237 | unsigned int (*target)(struct sk_buff *skb, | 318 | unsigned int (*target)(struct sk_buff *skb, |
238 | const struct net_device *in, | 319 | const struct xt_target_param *); |
239 | const struct net_device *out, | ||
240 | unsigned int hooknum, | ||
241 | const struct xt_target *target, | ||
242 | const void *targinfo); | ||
243 | 320 | ||
244 | /* Called when user tries to insert an entry of this type: | 321 | /* Called when user tries to insert an entry of this type: |
245 | hook_mask is a bitmask of hooks from which it can be | 322 | hook_mask is a bitmask of hooks from which it can be |
246 | called. */ | 323 | called. */ |
247 | /* Should return true or false. */ | 324 | /* Should return true or false. */ |
248 | bool (*checkentry)(const char *tablename, | 325 | bool (*checkentry)(const struct xt_tgchk_param *); |
249 | const void *entry, | ||
250 | const struct xt_target *target, | ||
251 | void *targinfo, | ||
252 | unsigned int hook_mask); | ||
253 | 326 | ||
254 | /* Called when entry of this type deleted. */ | 327 | /* Called when entry of this type deleted. */ |
255 | void (*destroy)(const struct xt_target *target, void *targinfo); | 328 | void (*destroy)(const struct xt_tgdtor_param *); |
256 | 329 | ||
257 | /* Called when userspace align differs from kernel space one */ | 330 | /* Called when userspace align differs from kernel space one */ |
258 | void (*compat_from_user)(void *dst, void *src); | 331 | void (*compat_from_user)(void *dst, void *src); |
@@ -292,7 +365,7 @@ struct xt_table | |||
292 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ | 365 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ |
293 | struct module *me; | 366 | struct module *me; |
294 | 367 | ||
295 | int af; /* address/protocol family */ | 368 | u_int8_t af; /* address/protocol family */ |
296 | }; | 369 | }; |
297 | 370 | ||
298 | #include <linux/netfilter_ipv4.h> | 371 | #include <linux/netfilter_ipv4.h> |
@@ -328,12 +401,10 @@ extern void xt_unregister_match(struct xt_match *target); | |||
328 | extern int xt_register_matches(struct xt_match *match, unsigned int n); | 401 | extern int xt_register_matches(struct xt_match *match, unsigned int n); |
329 | extern void xt_unregister_matches(struct xt_match *match, unsigned int n); | 402 | extern void xt_unregister_matches(struct xt_match *match, unsigned int n); |
330 | 403 | ||
331 | extern int xt_check_match(const struct xt_match *match, unsigned short family, | 404 | extern int xt_check_match(struct xt_mtchk_param *, |
332 | unsigned int size, const char *table, unsigned int hook, | 405 | unsigned int size, u_int8_t proto, bool inv_proto); |
333 | unsigned short proto, int inv_proto); | 406 | extern int xt_check_target(struct xt_tgchk_param *, |
334 | extern int xt_check_target(const struct xt_target *target, unsigned short family, | 407 | unsigned int size, u_int8_t proto, bool inv_proto); |
335 | unsigned int size, const char *table, unsigned int hook, | ||
336 | unsigned short proto, int inv_proto); | ||
337 | 408 | ||
338 | extern struct xt_table *xt_register_table(struct net *net, | 409 | extern struct xt_table *xt_register_table(struct net *net, |
339 | struct xt_table *table, | 410 | struct xt_table *table, |
@@ -346,19 +417,19 @@ extern struct xt_table_info *xt_replace_table(struct xt_table *table, | |||
346 | struct xt_table_info *newinfo, | 417 | struct xt_table_info *newinfo, |
347 | int *error); | 418 | int *error); |
348 | 419 | ||
349 | extern struct xt_match *xt_find_match(int af, const char *name, u8 revision); | 420 | extern struct xt_match *xt_find_match(u8 af, const char *name, u8 revision); |
350 | extern struct xt_target *xt_find_target(int af, const char *name, u8 revision); | 421 | extern struct xt_target *xt_find_target(u8 af, const char *name, u8 revision); |
351 | extern struct xt_target *xt_request_find_target(int af, const char *name, | 422 | extern struct xt_target *xt_request_find_target(u8 af, const char *name, |
352 | u8 revision); | 423 | u8 revision); |
353 | extern int xt_find_revision(int af, const char *name, u8 revision, int target, | 424 | extern int xt_find_revision(u8 af, const char *name, u8 revision, |
354 | int *err); | 425 | int target, int *err); |
355 | 426 | ||
356 | extern struct xt_table *xt_find_table_lock(struct net *net, int af, | 427 | extern struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af, |
357 | const char *name); | 428 | const char *name); |
358 | extern void xt_table_unlock(struct xt_table *t); | 429 | extern void xt_table_unlock(struct xt_table *t); |
359 | 430 | ||
360 | extern int xt_proto_init(struct net *net, int af); | 431 | extern int xt_proto_init(struct net *net, u_int8_t af); |
361 | extern void xt_proto_fini(struct net *net, int af); | 432 | extern void xt_proto_fini(struct net *net, u_int8_t af); |
362 | 433 | ||
363 | extern struct xt_table_info *xt_alloc_table_info(unsigned int size); | 434 | extern struct xt_table_info *xt_alloc_table_info(unsigned int size); |
364 | extern void xt_free_table_info(struct xt_table_info *info); | 435 | extern void xt_free_table_info(struct xt_table_info *info); |
@@ -423,12 +494,12 @@ struct compat_xt_counters_info | |||
423 | #define COMPAT_XT_ALIGN(s) (((s) + (__alignof__(struct compat_xt_counters)-1)) \ | 494 | #define COMPAT_XT_ALIGN(s) (((s) + (__alignof__(struct compat_xt_counters)-1)) \ |
424 | & ~(__alignof__(struct compat_xt_counters)-1)) | 495 | & ~(__alignof__(struct compat_xt_counters)-1)) |
425 | 496 | ||
426 | extern void xt_compat_lock(int af); | 497 | extern void xt_compat_lock(u_int8_t af); |
427 | extern void xt_compat_unlock(int af); | 498 | extern void xt_compat_unlock(u_int8_t af); |
428 | 499 | ||
429 | extern int xt_compat_add_offset(int af, unsigned int offset, short delta); | 500 | extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta); |
430 | extern void xt_compat_flush_offsets(int af); | 501 | extern void xt_compat_flush_offsets(u_int8_t af); |
431 | extern short xt_compat_calc_jump(int af, unsigned int offset); | 502 | extern short xt_compat_calc_jump(u_int8_t af, unsigned int offset); |
432 | 503 | ||
433 | extern int xt_compat_match_offset(const struct xt_match *match); | 504 | extern int xt_compat_match_offset(const struct xt_match *match); |
434 | extern int xt_compat_match_from_user(struct xt_entry_match *m, | 505 | extern int xt_compat_match_from_user(struct xt_entry_match *m, |
diff --git a/include/linux/netfilter/xt_TPROXY.h b/include/linux/netfilter/xt_TPROXY.h new file mode 100644 index 000000000000..152e8f97132b --- /dev/null +++ b/include/linux/netfilter/xt_TPROXY.h | |||
@@ -0,0 +1,14 @@ | |||
1 | #ifndef _XT_TPROXY_H_target | ||
2 | #define _XT_TPROXY_H_target | ||
3 | |||
4 | /* TPROXY target is capable of marking the packet to perform | ||
5 | * redirection. We can get rid of that whenever we get support for | ||
6 | * mutliple targets in the same rule. */ | ||
7 | struct xt_tproxy_target_info { | ||
8 | u_int32_t mark_mask; | ||
9 | u_int32_t mark_value; | ||
10 | __be32 laddr; | ||
11 | __be16 lport; | ||
12 | }; | ||
13 | |||
14 | #endif /* _XT_TPROXY_H_target */ | ||
diff --git a/include/linux/netfilter/xt_recent.h b/include/linux/netfilter/xt_recent.h new file mode 100644 index 000000000000..5cfeb81c6794 --- /dev/null +++ b/include/linux/netfilter/xt_recent.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef _LINUX_NETFILTER_XT_RECENT_H | ||
2 | #define _LINUX_NETFILTER_XT_RECENT_H 1 | ||
3 | |||
4 | enum { | ||
5 | XT_RECENT_CHECK = 1 << 0, | ||
6 | XT_RECENT_SET = 1 << 1, | ||
7 | XT_RECENT_UPDATE = 1 << 2, | ||
8 | XT_RECENT_REMOVE = 1 << 3, | ||
9 | XT_RECENT_TTL = 1 << 4, | ||
10 | |||
11 | XT_RECENT_SOURCE = 0, | ||
12 | XT_RECENT_DEST = 1, | ||
13 | |||
14 | XT_RECENT_NAME_LEN = 200, | ||
15 | }; | ||
16 | |||
17 | struct xt_recent_mtinfo { | ||
18 | u_int32_t seconds; | ||
19 | u_int32_t hit_count; | ||
20 | u_int8_t check_set; | ||
21 | u_int8_t invert; | ||
22 | char name[XT_RECENT_NAME_LEN]; | ||
23 | u_int8_t side; | ||
24 | }; | ||
25 | |||
26 | #endif /* _LINUX_NETFILTER_XT_RECENT_H */ | ||
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h index 892f5b7771c7..d45e29cd1cfb 100644 --- a/include/linux/netfilter_bridge/ebtables.h +++ b/include/linux/netfilter_bridge/ebtables.h | |||
@@ -31,6 +31,9 @@ | |||
31 | * The 4 lsb are more than enough to store the verdict. */ | 31 | * The 4 lsb are more than enough to store the verdict. */ |
32 | #define EBT_VERDICT_BITS 0x0000000F | 32 | #define EBT_VERDICT_BITS 0x0000000F |
33 | 33 | ||
34 | struct xt_match; | ||
35 | struct xt_target; | ||
36 | |||
34 | struct ebt_counter | 37 | struct ebt_counter |
35 | { | 38 | { |
36 | uint64_t pcnt; | 39 | uint64_t pcnt; |
@@ -121,7 +124,7 @@ struct ebt_entry_match | |||
121 | { | 124 | { |
122 | union { | 125 | union { |
123 | char name[EBT_FUNCTION_MAXNAMELEN]; | 126 | char name[EBT_FUNCTION_MAXNAMELEN]; |
124 | struct ebt_match *match; | 127 | struct xt_match *match; |
125 | } u; | 128 | } u; |
126 | /* size of data */ | 129 | /* size of data */ |
127 | unsigned int match_size; | 130 | unsigned int match_size; |
@@ -132,7 +135,7 @@ struct ebt_entry_watcher | |||
132 | { | 135 | { |
133 | union { | 136 | union { |
134 | char name[EBT_FUNCTION_MAXNAMELEN]; | 137 | char name[EBT_FUNCTION_MAXNAMELEN]; |
135 | struct ebt_watcher *watcher; | 138 | struct xt_target *watcher; |
136 | } u; | 139 | } u; |
137 | /* size of data */ | 140 | /* size of data */ |
138 | unsigned int watcher_size; | 141 | unsigned int watcher_size; |
@@ -143,7 +146,7 @@ struct ebt_entry_target | |||
143 | { | 146 | { |
144 | union { | 147 | union { |
145 | char name[EBT_FUNCTION_MAXNAMELEN]; | 148 | char name[EBT_FUNCTION_MAXNAMELEN]; |
146 | struct ebt_target *target; | 149 | struct xt_target *target; |
147 | } u; | 150 | } u; |
148 | /* size of data */ | 151 | /* size of data */ |
149 | unsigned int target_size; | 152 | unsigned int target_size; |
@@ -207,14 +210,17 @@ struct ebt_match | |||
207 | { | 210 | { |
208 | struct list_head list; | 211 | struct list_head list; |
209 | const char name[EBT_FUNCTION_MAXNAMELEN]; | 212 | const char name[EBT_FUNCTION_MAXNAMELEN]; |
210 | /* 0 == it matches */ | 213 | bool (*match)(const struct sk_buff *skb, const struct net_device *in, |
211 | int (*match)(const struct sk_buff *skb, const struct net_device *in, | 214 | const struct net_device *out, const struct xt_match *match, |
212 | const struct net_device *out, const void *matchdata, | 215 | const void *matchinfo, int offset, unsigned int protoff, |
213 | unsigned int datalen); | 216 | bool *hotdrop); |
214 | /* 0 == let it in */ | 217 | bool (*checkentry)(const char *table, const void *entry, |
215 | int (*check)(const char *tablename, unsigned int hookmask, | 218 | const struct xt_match *match, void *matchinfo, |
216 | const struct ebt_entry *e, void *matchdata, unsigned int datalen); | 219 | unsigned int hook_mask); |
217 | void (*destroy)(void *matchdata, unsigned int datalen); | 220 | void (*destroy)(const struct xt_match *match, void *matchinfo); |
221 | unsigned int matchsize; | ||
222 | u_int8_t revision; | ||
223 | u_int8_t family; | ||
218 | struct module *me; | 224 | struct module *me; |
219 | }; | 225 | }; |
220 | 226 | ||
@@ -222,13 +228,17 @@ struct ebt_watcher | |||
222 | { | 228 | { |
223 | struct list_head list; | 229 | struct list_head list; |
224 | const char name[EBT_FUNCTION_MAXNAMELEN]; | 230 | const char name[EBT_FUNCTION_MAXNAMELEN]; |
225 | void (*watcher)(const struct sk_buff *skb, unsigned int hooknr, | 231 | unsigned int (*target)(struct sk_buff *skb, |
226 | const struct net_device *in, const struct net_device *out, | 232 | const struct net_device *in, const struct net_device *out, |
227 | const void *watcherdata, unsigned int datalen); | 233 | unsigned int hook_num, const struct xt_target *target, |
228 | /* 0 == let it in */ | 234 | const void *targinfo); |
229 | int (*check)(const char *tablename, unsigned int hookmask, | 235 | bool (*checkentry)(const char *table, const void *entry, |
230 | const struct ebt_entry *e, void *watcherdata, unsigned int datalen); | 236 | const struct xt_target *target, void *targinfo, |
231 | void (*destroy)(void *watcherdata, unsigned int datalen); | 237 | unsigned int hook_mask); |
238 | void (*destroy)(const struct xt_target *target, void *targinfo); | ||
239 | unsigned int targetsize; | ||
240 | u_int8_t revision; | ||
241 | u_int8_t family; | ||
232 | struct module *me; | 242 | struct module *me; |
233 | }; | 243 | }; |
234 | 244 | ||
@@ -236,14 +246,18 @@ struct ebt_target | |||
236 | { | 246 | { |
237 | struct list_head list; | 247 | struct list_head list; |
238 | const char name[EBT_FUNCTION_MAXNAMELEN]; | 248 | const char name[EBT_FUNCTION_MAXNAMELEN]; |
239 | /* returns one of the standard verdicts */ | 249 | /* returns one of the standard EBT_* verdicts */ |
240 | int (*target)(struct sk_buff *skb, unsigned int hooknr, | 250 | unsigned int (*target)(struct sk_buff *skb, |
241 | const struct net_device *in, const struct net_device *out, | 251 | const struct net_device *in, const struct net_device *out, |
242 | const void *targetdata, unsigned int datalen); | 252 | unsigned int hook_num, const struct xt_target *target, |
243 | /* 0 == let it in */ | 253 | const void *targinfo); |
244 | int (*check)(const char *tablename, unsigned int hookmask, | 254 | bool (*checkentry)(const char *table, const void *entry, |
245 | const struct ebt_entry *e, void *targetdata, unsigned int datalen); | 255 | const struct xt_target *target, void *targinfo, |
246 | void (*destroy)(void *targetdata, unsigned int datalen); | 256 | unsigned int hook_mask); |
257 | void (*destroy)(const struct xt_target *target, void *targinfo); | ||
258 | unsigned int targetsize; | ||
259 | u_int8_t revision; | ||
260 | u_int8_t family; | ||
247 | struct module *me; | 261 | struct module *me; |
248 | }; | 262 | }; |
249 | 263 | ||
@@ -288,12 +302,6 @@ struct ebt_table | |||
288 | ~(__alignof__(struct ebt_replace)-1)) | 302 | ~(__alignof__(struct ebt_replace)-1)) |
289 | extern int ebt_register_table(struct ebt_table *table); | 303 | extern int ebt_register_table(struct ebt_table *table); |
290 | extern void ebt_unregister_table(struct ebt_table *table); | 304 | extern void ebt_unregister_table(struct ebt_table *table); |
291 | extern int ebt_register_match(struct ebt_match *match); | ||
292 | extern void ebt_unregister_match(struct ebt_match *match); | ||
293 | extern int ebt_register_watcher(struct ebt_watcher *watcher); | ||
294 | extern void ebt_unregister_watcher(struct ebt_watcher *watcher); | ||
295 | extern int ebt_register_target(struct ebt_target *target); | ||
296 | extern void ebt_unregister_target(struct ebt_target *target); | ||
297 | extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, | 305 | extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, |
298 | const struct net_device *in, const struct net_device *out, | 306 | const struct net_device *in, const struct net_device *out, |
299 | struct ebt_table *table); | 307 | struct ebt_table *table); |
@@ -302,9 +310,9 @@ extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, | |||
302 | #define FWINV(bool,invflg) ((bool) ^ !!(info->invflags & invflg)) | 310 | #define FWINV(bool,invflg) ((bool) ^ !!(info->invflags & invflg)) |
303 | /* True if the hook mask denotes that the rule is in a base chain, | 311 | /* True if the hook mask denotes that the rule is in a base chain, |
304 | * used in the check() functions */ | 312 | * used in the check() functions */ |
305 | #define BASE_CHAIN (hookmask & (1 << NF_BR_NUMHOOKS)) | 313 | #define BASE_CHAIN (par->hook_mask & (1 << NF_BR_NUMHOOKS)) |
306 | /* Clear the bit in the hook mask that tells if the rule is on a base chain */ | 314 | /* Clear the bit in the hook mask that tells if the rule is on a base chain */ |
307 | #define CLEAR_BASE_CHAIN_BIT (hookmask &= ~(1 << NF_BR_NUMHOOKS)) | 315 | #define CLEAR_BASE_CHAIN_BIT (par->hook_mask &= ~(1 << NF_BR_NUMHOOKS)) |
308 | /* True if the target is not a standard target */ | 316 | /* True if the target is not a standard target */ |
309 | #define INVALID_TARGET (info->target < -NUM_STANDARD_TARGETS || info->target >= 0) | 317 | #define INVALID_TARGET (info->target < -NUM_STANDARD_TARGETS || info->target >= 0) |
310 | 318 | ||
diff --git a/include/linux/netfilter_ipv4/ipt_recent.h b/include/linux/netfilter_ipv4/ipt_recent.h index 6508a4592651..d636cca133c2 100644 --- a/include/linux/netfilter_ipv4/ipt_recent.h +++ b/include/linux/netfilter_ipv4/ipt_recent.h | |||
@@ -1,27 +1,21 @@ | |||
1 | #ifndef _IPT_RECENT_H | 1 | #ifndef _IPT_RECENT_H |
2 | #define _IPT_RECENT_H | 2 | #define _IPT_RECENT_H |
3 | 3 | ||
4 | #define RECENT_NAME "ipt_recent" | 4 | #include <linux/netfilter/xt_recent.h> |
5 | #define RECENT_VER "v0.3.1" | ||
6 | 5 | ||
7 | #define IPT_RECENT_CHECK 1 | 6 | #define ipt_recent_info xt_recent_mtinfo |
8 | #define IPT_RECENT_SET 2 | ||
9 | #define IPT_RECENT_UPDATE 4 | ||
10 | #define IPT_RECENT_REMOVE 8 | ||
11 | #define IPT_RECENT_TTL 16 | ||
12 | 7 | ||
13 | #define IPT_RECENT_SOURCE 0 | 8 | enum { |
14 | #define IPT_RECENT_DEST 1 | 9 | IPT_RECENT_CHECK = XT_RECENT_CHECK, |
10 | IPT_RECENT_SET = XT_RECENT_SET, | ||
11 | IPT_RECENT_UPDATE = XT_RECENT_UPDATE, | ||
12 | IPT_RECENT_REMOVE = XT_RECENT_REMOVE, | ||
13 | IPT_RECENT_TTL = XT_RECENT_TTL, | ||
15 | 14 | ||
16 | #define IPT_RECENT_NAME_LEN 200 | 15 | IPT_RECENT_SOURCE = XT_RECENT_SOURCE, |
16 | IPT_RECENT_DEST = XT_RECENT_DEST, | ||
17 | 17 | ||
18 | struct ipt_recent_info { | 18 | IPT_RECENT_NAME_LEN = XT_RECENT_NAME_LEN, |
19 | u_int32_t seconds; | ||
20 | u_int32_t hit_count; | ||
21 | u_int8_t check_set; | ||
22 | u_int8_t invert; | ||
23 | char name[IPT_RECENT_NAME_LEN]; | ||
24 | u_int8_t side; | ||
25 | }; | 19 | }; |
26 | 20 | ||
27 | #endif /*_IPT_RECENT_H*/ | 21 | #endif /*_IPT_RECENT_H*/ |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 78a5922a2f11..4eaa8347a0d9 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -137,7 +137,7 @@ struct nfs_inode { | |||
137 | unsigned long attrtimeo_timestamp; | 137 | unsigned long attrtimeo_timestamp; |
138 | __u64 change_attr; /* v4 only */ | 138 | __u64 change_attr; /* v4 only */ |
139 | 139 | ||
140 | unsigned long last_updated; | 140 | unsigned long attr_gencount; |
141 | /* "Generation counter" for the attribute cache. This is | 141 | /* "Generation counter" for the attribute cache. This is |
142 | * bumped whenever we update the metadata on the | 142 | * bumped whenever we update the metadata on the |
143 | * server. | 143 | * server. |
@@ -200,11 +200,10 @@ struct nfs_inode { | |||
200 | /* | 200 | /* |
201 | * Bit offsets in flags field | 201 | * Bit offsets in flags field |
202 | */ | 202 | */ |
203 | #define NFS_INO_REVALIDATING (0) /* revalidating attrs */ | 203 | #define NFS_INO_ADVISE_RDPLUS (0) /* advise readdirplus */ |
204 | #define NFS_INO_ADVISE_RDPLUS (1) /* advise readdirplus */ | 204 | #define NFS_INO_STALE (1) /* possible stale inode */ |
205 | #define NFS_INO_STALE (2) /* possible stale inode */ | 205 | #define NFS_INO_ACL_LRU_SET (2) /* Inode is on the LRU list */ |
206 | #define NFS_INO_ACL_LRU_SET (3) /* Inode is on the LRU list */ | 206 | #define NFS_INO_MOUNTPOINT (3) /* inode is remote mountpoint */ |
207 | #define NFS_INO_MOUNTPOINT (4) /* inode is remote mountpoint */ | ||
208 | 207 | ||
209 | static inline struct nfs_inode *NFS_I(const struct inode *inode) | 208 | static inline struct nfs_inode *NFS_I(const struct inode *inode) |
210 | { | 209 | { |
@@ -345,15 +344,11 @@ extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ct | |||
345 | extern void put_nfs_open_context(struct nfs_open_context *ctx); | 344 | extern void put_nfs_open_context(struct nfs_open_context *ctx); |
346 | extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); | 345 | extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); |
347 | extern u64 nfs_compat_user_ino64(u64 fileid); | 346 | extern u64 nfs_compat_user_ino64(u64 fileid); |
347 | extern void nfs_fattr_init(struct nfs_fattr *fattr); | ||
348 | 348 | ||
349 | /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ | 349 | /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ |
350 | extern __be32 root_nfs_parse_addr(char *name); /*__init*/ | 350 | extern __be32 root_nfs_parse_addr(char *name); /*__init*/ |
351 | 351 | extern unsigned long nfs_inc_attr_generation_counter(void); | |
352 | static inline void nfs_fattr_init(struct nfs_fattr *fattr) | ||
353 | { | ||
354 | fattr->valid = 0; | ||
355 | fattr->time_start = jiffies; | ||
356 | } | ||
357 | 352 | ||
358 | /* | 353 | /* |
359 | * linux/fs/nfs/file.c | 354 | * linux/fs/nfs/file.c |
@@ -372,8 +367,12 @@ static inline struct nfs_open_context *nfs_file_open_context(struct file *filp) | |||
372 | 367 | ||
373 | static inline struct rpc_cred *nfs_file_cred(struct file *file) | 368 | static inline struct rpc_cred *nfs_file_cred(struct file *file) |
374 | { | 369 | { |
375 | if (file != NULL) | 370 | if (file != NULL) { |
376 | return nfs_file_open_context(file)->cred; | 371 | struct nfs_open_context *ctx = |
372 | nfs_file_open_context(file); | ||
373 | if (ctx) | ||
374 | return ctx->cred; | ||
375 | } | ||
377 | return NULL; | 376 | return NULL; |
378 | } | 377 | } |
379 | 378 | ||
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index c9beacd16c00..4e477ae58699 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
@@ -119,7 +119,6 @@ struct nfs_server { | |||
119 | void (*destroy)(struct nfs_server *); | 119 | void (*destroy)(struct nfs_server *); |
120 | 120 | ||
121 | atomic_t active; /* Keep trace of any activity to this server */ | 121 | atomic_t active; /* Keep trace of any activity to this server */ |
122 | wait_queue_head_t active_wq; /* Wait for any activity to stop */ | ||
123 | 122 | ||
124 | /* mountd-related mount options */ | 123 | /* mountd-related mount options */ |
125 | struct sockaddr_storage mountd_address; | 124 | struct sockaddr_storage mountd_address; |
diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h index df7c6b7a7ebb..6549a06ac16e 100644 --- a/include/linux/nfs_mount.h +++ b/include/linux/nfs_mount.h | |||
@@ -65,4 +65,8 @@ struct nfs_mount_data { | |||
65 | #define NFS_MOUNT_UNSHARED 0x8000 /* 5 */ | 65 | #define NFS_MOUNT_UNSHARED 0x8000 /* 5 */ |
66 | #define NFS_MOUNT_FLAGMASK 0xFFFF | 66 | #define NFS_MOUNT_FLAGMASK 0xFFFF |
67 | 67 | ||
68 | /* The following are for internal use only */ | ||
69 | #define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000 | ||
70 | #define NFS_MOUNT_LOOKUP_CACHE_NONE 0x20000 | ||
71 | |||
68 | #endif | 72 | #endif |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 8c77c11224d1..c1c31acb8a2b 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -36,6 +36,7 @@ struct nfs_fattr { | |||
36 | __u32 nlink; | 36 | __u32 nlink; |
37 | __u32 uid; | 37 | __u32 uid; |
38 | __u32 gid; | 38 | __u32 gid; |
39 | dev_t rdev; | ||
39 | __u64 size; | 40 | __u64 size; |
40 | union { | 41 | union { |
41 | struct { | 42 | struct { |
@@ -46,7 +47,6 @@ struct nfs_fattr { | |||
46 | __u64 used; | 47 | __u64 used; |
47 | } nfs3; | 48 | } nfs3; |
48 | } du; | 49 | } du; |
49 | dev_t rdev; | ||
50 | struct nfs_fsid fsid; | 50 | struct nfs_fsid fsid; |
51 | __u64 fileid; | 51 | __u64 fileid; |
52 | struct timespec atime; | 52 | struct timespec atime; |
@@ -56,6 +56,7 @@ struct nfs_fattr { | |||
56 | __u64 change_attr; /* NFSv4 change attribute */ | 56 | __u64 change_attr; /* NFSv4 change attribute */ |
57 | __u64 pre_change_attr;/* pre-op NFSv4 change attribute */ | 57 | __u64 pre_change_attr;/* pre-op NFSv4 change attribute */ |
58 | unsigned long time_start; | 58 | unsigned long time_start; |
59 | unsigned long gencount; | ||
59 | }; | 60 | }; |
60 | 61 | ||
61 | #define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */ | 62 | #define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */ |
@@ -672,16 +673,16 @@ struct nfs4_rename_res { | |||
672 | struct nfs_fattr * new_fattr; | 673 | struct nfs_fattr * new_fattr; |
673 | }; | 674 | }; |
674 | 675 | ||
675 | #define NFS4_SETCLIENTID_NAMELEN (56) | 676 | #define NFS4_SETCLIENTID_NAMELEN (127) |
676 | struct nfs4_setclientid { | 677 | struct nfs4_setclientid { |
677 | const nfs4_verifier * sc_verifier; | 678 | const nfs4_verifier * sc_verifier; |
678 | unsigned int sc_name_len; | 679 | unsigned int sc_name_len; |
679 | char sc_name[NFS4_SETCLIENTID_NAMELEN]; | 680 | char sc_name[NFS4_SETCLIENTID_NAMELEN + 1]; |
680 | u32 sc_prog; | 681 | u32 sc_prog; |
681 | unsigned int sc_netid_len; | 682 | unsigned int sc_netid_len; |
682 | char sc_netid[RPCBIND_MAXNETIDLEN]; | 683 | char sc_netid[RPCBIND_MAXNETIDLEN + 1]; |
683 | unsigned int sc_uaddr_len; | 684 | unsigned int sc_uaddr_len; |
684 | char sc_uaddr[RPCBIND_MAXUADDRLEN]; | 685 | char sc_uaddr[RPCBIND_MAXUADDRLEN + 1]; |
685 | u32 sc_cb_ident; | 686 | u32 sc_cb_ident; |
686 | }; | 687 | }; |
687 | 688 | ||
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index 108f47e5fd95..21269405ffe2 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h | |||
@@ -38,6 +38,7 @@ | |||
38 | #define NFSD_MAY_LOCK 32 | 38 | #define NFSD_MAY_LOCK 32 |
39 | #define NFSD_MAY_OWNER_OVERRIDE 64 | 39 | #define NFSD_MAY_OWNER_OVERRIDE 64 |
40 | #define NFSD_MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/ | 40 | #define NFSD_MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/ |
41 | #define NFSD_MAY_BYPASS_GSS_ON_ROOT 256 | ||
41 | 42 | ||
42 | #define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE) | 43 | #define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE) |
43 | #define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC) | 44 | #define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC) |
@@ -125,7 +126,7 @@ int nfsd_truncate(struct svc_rqst *, struct svc_fh *, | |||
125 | __be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, | 126 | __be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, |
126 | loff_t *, struct readdir_cd *, filldir_t); | 127 | loff_t *, struct readdir_cd *, filldir_t); |
127 | __be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, | 128 | __be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, |
128 | struct kstatfs *); | 129 | struct kstatfs *, int access); |
129 | 130 | ||
130 | int nfsd_notify_change(struct inode *, struct iattr *); | 131 | int nfsd_notify_change(struct inode *, struct iattr *); |
131 | __be32 nfsd_permission(struct svc_rqst *, struct svc_export *, | 132 | __be32 nfsd_permission(struct svc_rqst *, struct svc_export *, |
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 2be7c63bc0f2..9bad65400fba 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -89,6 +89,22 @@ | |||
89 | * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC | 89 | * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC |
90 | * or, if no MAC address given, all mesh paths, on the interface identified | 90 | * or, if no MAC address given, all mesh paths, on the interface identified |
91 | * by %NL80211_ATTR_IFINDEX. | 91 | * by %NL80211_ATTR_IFINDEX. |
92 | * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by | ||
93 | * %NL80211_ATTR_IFINDEX. | ||
94 | * | ||
95 | * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command | ||
96 | * after being queried by the kernel. CRDA replies by sending a regulatory | ||
97 | * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our | ||
98 | * current alpha2 if it found a match. It also provides | ||
99 | * NL80211_ATTR_REG_RULE_FLAGS, and a set of regulatory rules. Each | ||
100 | * regulatory rule is a nested set of attributes given by | ||
101 | * %NL80211_ATTR_REG_RULE_FREQ_[START|END] and | ||
102 | * %NL80211_ATTR_FREQ_RANGE_MAX_BW with an attached power rule given by | ||
103 | * %NL80211_ATTR_REG_RULE_POWER_MAX_ANT_GAIN and | ||
104 | * %NL80211_ATTR_REG_RULE_POWER_MAX_EIRP. | ||
105 | * @NL80211_CMD_REQ_SET_REG: ask the wireless core to set the regulatory domain | ||
106 | * to the the specified ISO/IEC 3166-1 alpha2 country code. The core will | ||
107 | * store this as a valid request and then query userspace for it. | ||
92 | * | 108 | * |
93 | * @NL80211_CMD_MAX: highest used command number | 109 | * @NL80211_CMD_MAX: highest used command number |
94 | * @__NL80211_CMD_AFTER_LAST: internal use | 110 | * @__NL80211_CMD_AFTER_LAST: internal use |
@@ -127,13 +143,23 @@ enum nl80211_commands { | |||
127 | NL80211_CMD_NEW_MPATH, | 143 | NL80211_CMD_NEW_MPATH, |
128 | NL80211_CMD_DEL_MPATH, | 144 | NL80211_CMD_DEL_MPATH, |
129 | 145 | ||
130 | /* add commands here */ | 146 | NL80211_CMD_SET_BSS, |
147 | |||
148 | NL80211_CMD_SET_REG, | ||
149 | NL80211_CMD_REQ_SET_REG, | ||
150 | |||
151 | /* add new commands above here */ | ||
131 | 152 | ||
132 | /* used to define NL80211_CMD_MAX below */ | 153 | /* used to define NL80211_CMD_MAX below */ |
133 | __NL80211_CMD_AFTER_LAST, | 154 | __NL80211_CMD_AFTER_LAST, |
134 | NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 | 155 | NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 |
135 | }; | 156 | }; |
136 | 157 | ||
158 | /* | ||
159 | * Allow user space programs to use #ifdef on new commands by defining them | ||
160 | * here | ||
161 | */ | ||
162 | #define NL80211_CMD_SET_BSS NL80211_CMD_SET_BSS | ||
137 | 163 | ||
138 | /** | 164 | /** |
139 | * enum nl80211_attrs - nl80211 netlink attributes | 165 | * enum nl80211_attrs - nl80211 netlink attributes |
@@ -188,10 +214,34 @@ enum nl80211_commands { | |||
188 | * info given for %NL80211_CMD_GET_MPATH, nested attribute described at | 214 | * info given for %NL80211_CMD_GET_MPATH, nested attribute described at |
189 | * &enum nl80211_mpath_info. | 215 | * &enum nl80211_mpath_info. |
190 | * | 216 | * |
191 | * | ||
192 | * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of | 217 | * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of |
193 | * &enum nl80211_mntr_flags. | 218 | * &enum nl80211_mntr_flags. |
194 | * | 219 | * |
220 | * @NL80211_ATTR_REG_ALPHA2: an ISO-3166-alpha2 country code for which the | ||
221 | * current regulatory domain should be set to or is already set to. | ||
222 | * For example, 'CR', for Costa Rica. This attribute is used by the kernel | ||
223 | * to query the CRDA to retrieve one regulatory domain. This attribute can | ||
224 | * also be used by userspace to query the kernel for the currently set | ||
225 | * regulatory domain. We chose an alpha2 as that is also used by the | ||
226 | * IEEE-802.11d country information element to identify a country. | ||
227 | * Users can also simply ask the wireless core to set regulatory domain | ||
228 | * to a specific alpha2. | ||
229 | * @NL80211_ATTR_REG_RULES: a nested array of regulatory domain regulatory | ||
230 | * rules. | ||
231 | * | ||
232 | * @NL80211_ATTR_BSS_CTS_PROT: whether CTS protection is enabled (u8, 0 or 1) | ||
233 | * @NL80211_ATTR_BSS_SHORT_PREAMBLE: whether short preamble is enabled | ||
234 | * (u8, 0 or 1) | ||
235 | * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled | ||
236 | * (u8, 0 or 1) | ||
237 | * | ||
238 | * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from | ||
239 | * association request when used with NL80211_CMD_NEW_STATION) | ||
240 | * | ||
241 | * @NL80211_ATTR_SUPPORTED_IFTYPES: nested attribute containing all | ||
242 | * supported interface types, each a flag attribute with the number | ||
243 | * of the interface mode. | ||
244 | * | ||
195 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 245 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
196 | * @__NL80211_ATTR_AFTER_LAST: internal use | 246 | * @__NL80211_ATTR_AFTER_LAST: internal use |
197 | */ | 247 | */ |
@@ -235,16 +285,35 @@ enum nl80211_attrs { | |||
235 | NL80211_ATTR_MPATH_NEXT_HOP, | 285 | NL80211_ATTR_MPATH_NEXT_HOP, |
236 | NL80211_ATTR_MPATH_INFO, | 286 | NL80211_ATTR_MPATH_INFO, |
237 | 287 | ||
288 | NL80211_ATTR_BSS_CTS_PROT, | ||
289 | NL80211_ATTR_BSS_SHORT_PREAMBLE, | ||
290 | NL80211_ATTR_BSS_SHORT_SLOT_TIME, | ||
291 | |||
292 | NL80211_ATTR_HT_CAPABILITY, | ||
293 | |||
294 | NL80211_ATTR_SUPPORTED_IFTYPES, | ||
295 | |||
296 | NL80211_ATTR_REG_ALPHA2, | ||
297 | NL80211_ATTR_REG_RULES, | ||
298 | |||
238 | /* add attributes here, update the policy in nl80211.c */ | 299 | /* add attributes here, update the policy in nl80211.c */ |
239 | 300 | ||
240 | __NL80211_ATTR_AFTER_LAST, | 301 | __NL80211_ATTR_AFTER_LAST, |
241 | NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 | 302 | NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 |
242 | }; | 303 | }; |
243 | 304 | ||
305 | /* | ||
306 | * Allow user space programs to use #ifdef on new attributes by defining them | ||
307 | * here | ||
308 | */ | ||
309 | #define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY | ||
310 | |||
244 | #define NL80211_MAX_SUPP_RATES 32 | 311 | #define NL80211_MAX_SUPP_RATES 32 |
312 | #define NL80211_MAX_SUPP_REG_RULES 32 | ||
245 | #define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 | 313 | #define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 |
246 | #define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 | 314 | #define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 |
247 | #define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24 | 315 | #define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24 |
316 | #define NL80211_HT_CAPABILITY_LEN 26 | ||
248 | 317 | ||
249 | /** | 318 | /** |
250 | * enum nl80211_iftype - (virtual) interface types | 319 | * enum nl80211_iftype - (virtual) interface types |
@@ -436,6 +505,66 @@ enum nl80211_bitrate_attr { | |||
436 | }; | 505 | }; |
437 | 506 | ||
438 | /** | 507 | /** |
508 | * enum nl80211_reg_rule_attr - regulatory rule attributes | ||
509 | * @NL80211_ATTR_REG_RULE_FLAGS: a set of flags which specify additional | ||
510 | * considerations for a given frequency range. These are the | ||
511 | * &enum nl80211_reg_rule_flags. | ||
512 | * @NL80211_ATTR_FREQ_RANGE_START: starting frequencry for the regulatory | ||
513 | * rule in KHz. This is not a center of frequency but an actual regulatory | ||
514 | * band edge. | ||
515 | * @NL80211_ATTR_FREQ_RANGE_END: ending frequency for the regulatory rule | ||
516 | * in KHz. This is not a center a frequency but an actual regulatory | ||
517 | * band edge. | ||
518 | * @NL80211_ATTR_FREQ_RANGE_MAX_BW: maximum allowed bandwidth for this | ||
519 | * frequency range, in KHz. | ||
520 | * @NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN: the maximum allowed antenna gain | ||
521 | * for a given frequency range. The value is in mBi (100 * dBi). | ||
522 | * If you don't have one then don't send this. | ||
523 | * @NL80211_ATTR_POWER_RULE_MAX_EIRP: the maximum allowed EIRP for | ||
524 | * a given frequency range. The value is in mBm (100 * dBm). | ||
525 | */ | ||
526 | enum nl80211_reg_rule_attr { | ||
527 | __NL80211_REG_RULE_ATTR_INVALID, | ||
528 | NL80211_ATTR_REG_RULE_FLAGS, | ||
529 | |||
530 | NL80211_ATTR_FREQ_RANGE_START, | ||
531 | NL80211_ATTR_FREQ_RANGE_END, | ||
532 | NL80211_ATTR_FREQ_RANGE_MAX_BW, | ||
533 | |||
534 | NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN, | ||
535 | NL80211_ATTR_POWER_RULE_MAX_EIRP, | ||
536 | |||
537 | /* keep last */ | ||
538 | __NL80211_REG_RULE_ATTR_AFTER_LAST, | ||
539 | NL80211_REG_RULE_ATTR_MAX = __NL80211_REG_RULE_ATTR_AFTER_LAST - 1 | ||
540 | }; | ||
541 | |||
542 | /** | ||
543 | * enum nl80211_reg_rule_flags - regulatory rule flags | ||
544 | * | ||
545 | * @NL80211_RRF_NO_OFDM: OFDM modulation not allowed | ||
546 | * @NL80211_RRF_NO_CCK: CCK modulation not allowed | ||
547 | * @NL80211_RRF_NO_INDOOR: indoor operation not allowed | ||
548 | * @NL80211_RRF_NO_OUTDOOR: outdoor operation not allowed | ||
549 | * @NL80211_RRF_DFS: DFS support is required to be used | ||
550 | * @NL80211_RRF_PTP_ONLY: this is only for Point To Point links | ||
551 | * @NL80211_RRF_PTMP_ONLY: this is only for Point To Multi Point links | ||
552 | * @NL80211_RRF_PASSIVE_SCAN: passive scan is required | ||
553 | * @NL80211_RRF_NO_IBSS: no IBSS is allowed | ||
554 | */ | ||
555 | enum nl80211_reg_rule_flags { | ||
556 | NL80211_RRF_NO_OFDM = 1<<0, | ||
557 | NL80211_RRF_NO_CCK = 1<<1, | ||
558 | NL80211_RRF_NO_INDOOR = 1<<2, | ||
559 | NL80211_RRF_NO_OUTDOOR = 1<<3, | ||
560 | NL80211_RRF_DFS = 1<<4, | ||
561 | NL80211_RRF_PTP_ONLY = 1<<5, | ||
562 | NL80211_RRF_PTMP_ONLY = 1<<6, | ||
563 | NL80211_RRF_PASSIVE_SCAN = 1<<7, | ||
564 | NL80211_RRF_NO_IBSS = 1<<8, | ||
565 | }; | ||
566 | |||
567 | /** | ||
439 | * enum nl80211_mntr_flags - monitor configuration flags | 568 | * enum nl80211_mntr_flags - monitor configuration flags |
440 | * | 569 | * |
441 | * Monitor configuration flags. | 570 | * Monitor configuration flags. |
diff --git a/include/linux/notifier.h b/include/linux/notifier.h index da2698b0fdd1..b86fa2ffca0c 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h | |||
@@ -213,9 +213,16 @@ static inline int notifier_to_errno(int ret) | |||
213 | #define CPU_DOWN_FAILED 0x0006 /* CPU (unsigned)v NOT going down */ | 213 | #define CPU_DOWN_FAILED 0x0006 /* CPU (unsigned)v NOT going down */ |
214 | #define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */ | 214 | #define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */ |
215 | #define CPU_DYING 0x0008 /* CPU (unsigned)v not running any task, | 215 | #define CPU_DYING 0x0008 /* CPU (unsigned)v not running any task, |
216 | * not handling interrupts, soon dead */ | 216 | * not handling interrupts, soon dead. |
217 | * Called on the dying cpu, interrupts | ||
218 | * are already disabled. Must not | ||
219 | * sleep, must not fail */ | ||
217 | #define CPU_POST_DEAD 0x0009 /* CPU (unsigned)v dead, cpu_hotplug | 220 | #define CPU_POST_DEAD 0x0009 /* CPU (unsigned)v dead, cpu_hotplug |
218 | * lock is dropped */ | 221 | * lock is dropped */ |
222 | #define CPU_STARTING 0x000A /* CPU (unsigned)v soon running. | ||
223 | * Called on the new cpu, just before | ||
224 | * enabling interrupts. Must not sleep, | ||
225 | * must not fail */ | ||
219 | 226 | ||
220 | /* Used for CPU hotplug events occuring while tasks are frozen due to a suspend | 227 | /* Used for CPU hotplug events occuring while tasks are frozen due to a suspend |
221 | * operation in progress | 228 | * operation in progress |
@@ -229,6 +236,7 @@ static inline int notifier_to_errno(int ret) | |||
229 | #define CPU_DOWN_FAILED_FROZEN (CPU_DOWN_FAILED | CPU_TASKS_FROZEN) | 236 | #define CPU_DOWN_FAILED_FROZEN (CPU_DOWN_FAILED | CPU_TASKS_FROZEN) |
230 | #define CPU_DEAD_FROZEN (CPU_DEAD | CPU_TASKS_FROZEN) | 237 | #define CPU_DEAD_FROZEN (CPU_DEAD | CPU_TASKS_FROZEN) |
231 | #define CPU_DYING_FROZEN (CPU_DYING | CPU_TASKS_FROZEN) | 238 | #define CPU_DYING_FROZEN (CPU_DYING | CPU_TASKS_FROZEN) |
239 | #define CPU_STARTING_FROZEN (CPU_STARTING | CPU_TASKS_FROZEN) | ||
232 | 240 | ||
233 | /* Hibernation and suspend events */ | 241 | /* Hibernation and suspend events */ |
234 | #define PM_HIBERNATION_PREPARE 0x0001 /* Going to hibernate */ | 242 | #define PM_HIBERNATION_PREPARE 0x0001 /* Going to hibernate */ |
diff --git a/include/linux/of.h b/include/linux/of.h index 79886ade070f..e2488f5e7cb2 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -71,5 +71,8 @@ extern int of_n_size_cells(struct device_node *np); | |||
71 | extern const struct of_device_id *of_match_node( | 71 | extern const struct of_device_id *of_match_node( |
72 | const struct of_device_id *matches, const struct device_node *node); | 72 | const struct of_device_id *matches, const struct device_node *node); |
73 | extern int of_modalias_node(struct device_node *node, char *modalias, int len); | 73 | extern int of_modalias_node(struct device_node *node, char *modalias, int len); |
74 | extern int of_parse_phandles_with_args(struct device_node *np, | ||
75 | const char *list_name, const char *cells_name, int index, | ||
76 | struct device_node **out_node, const void **out_args); | ||
74 | 77 | ||
75 | #endif /* _LINUX_OF_H */ | 78 | #endif /* _LINUX_OF_H */ |
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h index 041bb31100f4..5231861f357d 100644 --- a/include/linux/oprofile.h +++ b/include/linux/oprofile.h | |||
@@ -36,6 +36,8 @@ | |||
36 | #define XEN_ENTER_SWITCH_CODE 10 | 36 | #define XEN_ENTER_SWITCH_CODE 10 |
37 | #define SPU_PROFILING_CODE 11 | 37 | #define SPU_PROFILING_CODE 11 |
38 | #define SPU_CTX_SWITCH_CODE 12 | 38 | #define SPU_CTX_SWITCH_CODE 12 |
39 | #define IBS_FETCH_CODE 13 | ||
40 | #define IBS_OP_CODE 14 | ||
39 | 41 | ||
40 | struct super_block; | 42 | struct super_block; |
41 | struct dentry; | 43 | struct dentry; |
@@ -84,13 +86,6 @@ int oprofile_arch_init(struct oprofile_operations * ops); | |||
84 | void oprofile_arch_exit(void); | 86 | void oprofile_arch_exit(void); |
85 | 87 | ||
86 | /** | 88 | /** |
87 | * Add data to the event buffer. | ||
88 | * The data passed is free-form, but typically consists of | ||
89 | * file offsets, dcookies, context information, and ESCAPE codes. | ||
90 | */ | ||
91 | void add_event_entry(unsigned long data); | ||
92 | |||
93 | /** | ||
94 | * Add a sample. This may be called from any context. Pass | 89 | * Add a sample. This may be called from any context. Pass |
95 | * smp_processor_id() as cpu. | 90 | * smp_processor_id() as cpu. |
96 | */ | 91 | */ |
@@ -160,5 +155,14 @@ int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, siz | |||
160 | 155 | ||
161 | /** lock for read/write safety */ | 156 | /** lock for read/write safety */ |
162 | extern spinlock_t oprofilefs_lock; | 157 | extern spinlock_t oprofilefs_lock; |
158 | |||
159 | /** | ||
160 | * Add the contents of a circular buffer to the event buffer. | ||
161 | */ | ||
162 | void oprofile_put_buff(unsigned long *buf, unsigned int start, | ||
163 | unsigned int stop, unsigned int max); | ||
164 | |||
165 | unsigned long oprofile_get_cpu_buffer_size(void); | ||
166 | void oprofile_cpu_buffer_inc_smpl_lost(void); | ||
163 | 167 | ||
164 | #endif /* OPROFILE_H */ | 168 | #endif /* OPROFILE_H */ |
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index c74d3e875314..b12f93a3c345 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
@@ -93,6 +93,11 @@ enum pageflags { | |||
93 | PG_mappedtodisk, /* Has blocks allocated on-disk */ | 93 | PG_mappedtodisk, /* Has blocks allocated on-disk */ |
94 | PG_reclaim, /* To be reclaimed asap */ | 94 | PG_reclaim, /* To be reclaimed asap */ |
95 | PG_buddy, /* Page is free, on buddy lists */ | 95 | PG_buddy, /* Page is free, on buddy lists */ |
96 | PG_swapbacked, /* Page is backed by RAM/swap */ | ||
97 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
98 | PG_unevictable, /* Page is "unevictable" */ | ||
99 | PG_mlocked, /* Page is vma mlocked */ | ||
100 | #endif | ||
96 | #ifdef CONFIG_IA64_UNCACHED_ALLOCATOR | 101 | #ifdef CONFIG_IA64_UNCACHED_ALLOCATOR |
97 | PG_uncached, /* Page has been mapped as uncached */ | 102 | PG_uncached, /* Page has been mapped as uncached */ |
98 | #endif | 103 | #endif |
@@ -161,6 +166,18 @@ static inline int Page##uname(struct page *page) \ | |||
161 | #define TESTSCFLAG(uname, lname) \ | 166 | #define TESTSCFLAG(uname, lname) \ |
162 | TESTSETFLAG(uname, lname) TESTCLEARFLAG(uname, lname) | 167 | TESTSETFLAG(uname, lname) TESTCLEARFLAG(uname, lname) |
163 | 168 | ||
169 | #define SETPAGEFLAG_NOOP(uname) \ | ||
170 | static inline void SetPage##uname(struct page *page) { } | ||
171 | |||
172 | #define CLEARPAGEFLAG_NOOP(uname) \ | ||
173 | static inline void ClearPage##uname(struct page *page) { } | ||
174 | |||
175 | #define __CLEARPAGEFLAG_NOOP(uname) \ | ||
176 | static inline void __ClearPage##uname(struct page *page) { } | ||
177 | |||
178 | #define TESTCLEARFLAG_FALSE(uname) \ | ||
179 | static inline int TestClearPage##uname(struct page *page) { return 0; } | ||
180 | |||
164 | struct page; /* forward declaration */ | 181 | struct page; /* forward declaration */ |
165 | 182 | ||
166 | TESTPAGEFLAG(Locked, locked) | 183 | TESTPAGEFLAG(Locked, locked) |
@@ -169,6 +186,7 @@ PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced) | |||
169 | PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) | 186 | PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) |
170 | PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru) | 187 | PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru) |
171 | PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active) | 188 | PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active) |
189 | TESTCLEARFLAG(Active, active) | ||
172 | __PAGEFLAG(Slab, slab) | 190 | __PAGEFLAG(Slab, slab) |
173 | PAGEFLAG(Checked, checked) /* Used by some filesystems */ | 191 | PAGEFLAG(Checked, checked) /* Used by some filesystems */ |
174 | PAGEFLAG(Pinned, pinned) TESTSCFLAG(Pinned, pinned) /* Xen */ | 192 | PAGEFLAG(Pinned, pinned) TESTSCFLAG(Pinned, pinned) /* Xen */ |
@@ -176,6 +194,7 @@ PAGEFLAG(SavePinned, savepinned); /* Xen */ | |||
176 | PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) | 194 | PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) |
177 | PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private) | 195 | PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private) |
178 | __SETPAGEFLAG(Private, private) | 196 | __SETPAGEFLAG(Private, private) |
197 | PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked) | ||
179 | 198 | ||
180 | __PAGEFLAG(SlobPage, slob_page) | 199 | __PAGEFLAG(SlobPage, slob_page) |
181 | __PAGEFLAG(SlobFree, slob_free) | 200 | __PAGEFLAG(SlobFree, slob_free) |
@@ -211,6 +230,25 @@ PAGEFLAG(SwapCache, swapcache) | |||
211 | PAGEFLAG_FALSE(SwapCache) | 230 | PAGEFLAG_FALSE(SwapCache) |
212 | #endif | 231 | #endif |
213 | 232 | ||
233 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
234 | PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable) | ||
235 | TESTCLEARFLAG(Unevictable, unevictable) | ||
236 | |||
237 | #define MLOCK_PAGES 1 | ||
238 | PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked) | ||
239 | TESTSCFLAG(Mlocked, mlocked) | ||
240 | |||
241 | #else | ||
242 | |||
243 | #define MLOCK_PAGES 0 | ||
244 | PAGEFLAG_FALSE(Mlocked) | ||
245 | SETPAGEFLAG_NOOP(Mlocked) TESTCLEARFLAG_FALSE(Mlocked) | ||
246 | |||
247 | PAGEFLAG_FALSE(Unevictable) TESTCLEARFLAG_FALSE(Unevictable) | ||
248 | SETPAGEFLAG_NOOP(Unevictable) CLEARPAGEFLAG_NOOP(Unevictable) | ||
249 | __CLEARPAGEFLAG_NOOP(Unevictable) | ||
250 | #endif | ||
251 | |||
214 | #ifdef CONFIG_IA64_UNCACHED_ALLOCATOR | 252 | #ifdef CONFIG_IA64_UNCACHED_ALLOCATOR |
215 | PAGEFLAG(Uncached, uncached) | 253 | PAGEFLAG(Uncached, uncached) |
216 | #else | 254 | #else |
@@ -326,15 +364,25 @@ static inline void __ClearPageTail(struct page *page) | |||
326 | 364 | ||
327 | #endif /* !PAGEFLAGS_EXTENDED */ | 365 | #endif /* !PAGEFLAGS_EXTENDED */ |
328 | 366 | ||
367 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
368 | #define __PG_UNEVICTABLE (1 << PG_unevictable) | ||
369 | #define __PG_MLOCKED (1 << PG_mlocked) | ||
370 | #else | ||
371 | #define __PG_UNEVICTABLE 0 | ||
372 | #define __PG_MLOCKED 0 | ||
373 | #endif | ||
374 | |||
329 | #define PAGE_FLAGS (1 << PG_lru | 1 << PG_private | 1 << PG_locked | \ | 375 | #define PAGE_FLAGS (1 << PG_lru | 1 << PG_private | 1 << PG_locked | \ |
330 | 1 << PG_buddy | 1 << PG_writeback | \ | 376 | 1 << PG_buddy | 1 << PG_writeback | \ |
331 | 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active) | 377 | 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \ |
378 | __PG_UNEVICTABLE | __PG_MLOCKED) | ||
332 | 379 | ||
333 | /* | 380 | /* |
334 | * Flags checked in bad_page(). Pages on the free list should not have | 381 | * Flags checked in bad_page(). Pages on the free list should not have |
335 | * these flags set. It they are, there is a problem. | 382 | * these flags set. It they are, there is a problem. |
336 | */ | 383 | */ |
337 | #define PAGE_FLAGS_CLEAR_WHEN_BAD (PAGE_FLAGS | 1 << PG_reclaim | 1 << PG_dirty) | 384 | #define PAGE_FLAGS_CLEAR_WHEN_BAD (PAGE_FLAGS | \ |
385 | 1 << PG_reclaim | 1 << PG_dirty | 1 << PG_swapbacked) | ||
338 | 386 | ||
339 | /* | 387 | /* |
340 | * Flags checked when a page is freed. Pages being freed should not have | 388 | * Flags checked when a page is freed. Pages being freed should not have |
@@ -347,7 +395,8 @@ static inline void __ClearPageTail(struct page *page) | |||
347 | * Pages being prepped should not have these flags set. It they are, there | 395 | * Pages being prepped should not have these flags set. It they are, there |
348 | * is a problem. | 396 | * is a problem. |
349 | */ | 397 | */ |
350 | #define PAGE_FLAGS_CHECK_AT_PREP (PAGE_FLAGS | 1 << PG_reserved | 1 << PG_dirty) | 398 | #define PAGE_FLAGS_CHECK_AT_PREP (PAGE_FLAGS | \ |
399 | 1 << PG_reserved | 1 << PG_dirty | 1 << PG_swapbacked) | ||
351 | 400 | ||
352 | #endif /* !__GENERATING_BOUNDS_H */ | 401 | #endif /* !__GENERATING_BOUNDS_H */ |
353 | #endif /* PAGE_FLAGS_H */ | 402 | #endif /* PAGE_FLAGS_H */ |
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h new file mode 100644 index 000000000000..f546ad6fc028 --- /dev/null +++ b/include/linux/page_cgroup.h | |||
@@ -0,0 +1,108 @@ | |||
1 | #ifndef __LINUX_PAGE_CGROUP_H | ||
2 | #define __LINUX_PAGE_CGROUP_H | ||
3 | |||
4 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | ||
5 | #include <linux/bit_spinlock.h> | ||
6 | /* | ||
7 | * Page Cgroup can be considered as an extended mem_map. | ||
8 | * A page_cgroup page is associated with every page descriptor. The | ||
9 | * page_cgroup helps us identify information about the cgroup | ||
10 | * All page cgroups are allocated at boot or memory hotplug event, | ||
11 | * then the page cgroup for pfn always exists. | ||
12 | */ | ||
13 | struct page_cgroup { | ||
14 | unsigned long flags; | ||
15 | struct mem_cgroup *mem_cgroup; | ||
16 | struct page *page; | ||
17 | struct list_head lru; /* per cgroup LRU list */ | ||
18 | }; | ||
19 | |||
20 | void __init pgdat_page_cgroup_init(struct pglist_data *pgdat); | ||
21 | void __init page_cgroup_init(void); | ||
22 | struct page_cgroup *lookup_page_cgroup(struct page *page); | ||
23 | |||
24 | enum { | ||
25 | /* flags for mem_cgroup */ | ||
26 | PCG_LOCK, /* page cgroup is locked */ | ||
27 | PCG_CACHE, /* charged as cache */ | ||
28 | PCG_USED, /* this object is in use. */ | ||
29 | /* flags for LRU placement */ | ||
30 | PCG_ACTIVE, /* page is active in this cgroup */ | ||
31 | PCG_FILE, /* page is file system backed */ | ||
32 | PCG_UNEVICTABLE, /* page is unevictableable */ | ||
33 | }; | ||
34 | |||
35 | #define TESTPCGFLAG(uname, lname) \ | ||
36 | static inline int PageCgroup##uname(struct page_cgroup *pc) \ | ||
37 | { return test_bit(PCG_##lname, &pc->flags); } | ||
38 | |||
39 | #define SETPCGFLAG(uname, lname) \ | ||
40 | static inline void SetPageCgroup##uname(struct page_cgroup *pc)\ | ||
41 | { set_bit(PCG_##lname, &pc->flags); } | ||
42 | |||
43 | #define CLEARPCGFLAG(uname, lname) \ | ||
44 | static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \ | ||
45 | { clear_bit(PCG_##lname, &pc->flags); } | ||
46 | |||
47 | /* Cache flag is set only once (at allocation) */ | ||
48 | TESTPCGFLAG(Cache, CACHE) | ||
49 | |||
50 | TESTPCGFLAG(Used, USED) | ||
51 | CLEARPCGFLAG(Used, USED) | ||
52 | |||
53 | /* LRU management flags (from global-lru definition) */ | ||
54 | TESTPCGFLAG(File, FILE) | ||
55 | SETPCGFLAG(File, FILE) | ||
56 | CLEARPCGFLAG(File, FILE) | ||
57 | |||
58 | TESTPCGFLAG(Active, ACTIVE) | ||
59 | SETPCGFLAG(Active, ACTIVE) | ||
60 | CLEARPCGFLAG(Active, ACTIVE) | ||
61 | |||
62 | TESTPCGFLAG(Unevictable, UNEVICTABLE) | ||
63 | SETPCGFLAG(Unevictable, UNEVICTABLE) | ||
64 | CLEARPCGFLAG(Unevictable, UNEVICTABLE) | ||
65 | |||
66 | static inline int page_cgroup_nid(struct page_cgroup *pc) | ||
67 | { | ||
68 | return page_to_nid(pc->page); | ||
69 | } | ||
70 | |||
71 | static inline enum zone_type page_cgroup_zid(struct page_cgroup *pc) | ||
72 | { | ||
73 | return page_zonenum(pc->page); | ||
74 | } | ||
75 | |||
76 | static inline void lock_page_cgroup(struct page_cgroup *pc) | ||
77 | { | ||
78 | bit_spin_lock(PCG_LOCK, &pc->flags); | ||
79 | } | ||
80 | |||
81 | static inline int trylock_page_cgroup(struct page_cgroup *pc) | ||
82 | { | ||
83 | return bit_spin_trylock(PCG_LOCK, &pc->flags); | ||
84 | } | ||
85 | |||
86 | static inline void unlock_page_cgroup(struct page_cgroup *pc) | ||
87 | { | ||
88 | bit_spin_unlock(PCG_LOCK, &pc->flags); | ||
89 | } | ||
90 | |||
91 | #else /* CONFIG_CGROUP_MEM_RES_CTLR */ | ||
92 | struct page_cgroup; | ||
93 | |||
94 | static inline void pgdat_page_cgroup_init(struct pglist_data *pgdat) | ||
95 | { | ||
96 | } | ||
97 | |||
98 | static inline struct page_cgroup *lookup_page_cgroup(struct page *page) | ||
99 | { | ||
100 | return NULL; | ||
101 | } | ||
102 | |||
103 | static inline void page_cgroup_init(void) | ||
104 | { | ||
105 | } | ||
106 | |||
107 | #endif | ||
108 | #endif | ||
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 5da31c12101c..709742be02f0 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h | |||
@@ -32,6 +32,34 @@ static inline void mapping_set_error(struct address_space *mapping, int error) | |||
32 | } | 32 | } |
33 | } | 33 | } |
34 | 34 | ||
35 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
36 | #define AS_UNEVICTABLE (__GFP_BITS_SHIFT + 2) /* e.g., ramdisk, SHM_LOCK */ | ||
37 | |||
38 | static inline void mapping_set_unevictable(struct address_space *mapping) | ||
39 | { | ||
40 | set_bit(AS_UNEVICTABLE, &mapping->flags); | ||
41 | } | ||
42 | |||
43 | static inline void mapping_clear_unevictable(struct address_space *mapping) | ||
44 | { | ||
45 | clear_bit(AS_UNEVICTABLE, &mapping->flags); | ||
46 | } | ||
47 | |||
48 | static inline int mapping_unevictable(struct address_space *mapping) | ||
49 | { | ||
50 | if (likely(mapping)) | ||
51 | return test_bit(AS_UNEVICTABLE, &mapping->flags); | ||
52 | return !!mapping; | ||
53 | } | ||
54 | #else | ||
55 | static inline void mapping_set_unevictable(struct address_space *mapping) { } | ||
56 | static inline void mapping_clear_unevictable(struct address_space *mapping) { } | ||
57 | static inline int mapping_unevictable(struct address_space *mapping) | ||
58 | { | ||
59 | return 0; | ||
60 | } | ||
61 | #endif | ||
62 | |||
35 | static inline gfp_t mapping_gfp_mask(struct address_space * mapping) | 63 | static inline gfp_t mapping_gfp_mask(struct address_space * mapping) |
36 | { | 64 | { |
37 | return (__force gfp_t)mapping->flags & __GFP_BITS_MASK; | 65 | return (__force gfp_t)mapping->flags & __GFP_BITS_MASK; |
@@ -271,19 +299,19 @@ extern int __lock_page_killable(struct page *page); | |||
271 | extern void __lock_page_nosync(struct page *page); | 299 | extern void __lock_page_nosync(struct page *page); |
272 | extern void unlock_page(struct page *page); | 300 | extern void unlock_page(struct page *page); |
273 | 301 | ||
274 | static inline void set_page_locked(struct page *page) | 302 | static inline void __set_page_locked(struct page *page) |
275 | { | 303 | { |
276 | set_bit(PG_locked, &page->flags); | 304 | __set_bit(PG_locked, &page->flags); |
277 | } | 305 | } |
278 | 306 | ||
279 | static inline void clear_page_locked(struct page *page) | 307 | static inline void __clear_page_locked(struct page *page) |
280 | { | 308 | { |
281 | clear_bit(PG_locked, &page->flags); | 309 | __clear_bit(PG_locked, &page->flags); |
282 | } | 310 | } |
283 | 311 | ||
284 | static inline int trylock_page(struct page *page) | 312 | static inline int trylock_page(struct page *page) |
285 | { | 313 | { |
286 | return !test_and_set_bit(PG_locked, &page->flags); | 314 | return (likely(!test_and_set_bit_lock(PG_locked, &page->flags))); |
287 | } | 315 | } |
288 | 316 | ||
289 | /* | 317 | /* |
@@ -410,17 +438,17 @@ extern void __remove_from_page_cache(struct page *page); | |||
410 | 438 | ||
411 | /* | 439 | /* |
412 | * Like add_to_page_cache_locked, but used to add newly allocated pages: | 440 | * Like add_to_page_cache_locked, but used to add newly allocated pages: |
413 | * the page is new, so we can just run set_page_locked() against it. | 441 | * the page is new, so we can just run __set_page_locked() against it. |
414 | */ | 442 | */ |
415 | static inline int add_to_page_cache(struct page *page, | 443 | static inline int add_to_page_cache(struct page *page, |
416 | struct address_space *mapping, pgoff_t offset, gfp_t gfp_mask) | 444 | struct address_space *mapping, pgoff_t offset, gfp_t gfp_mask) |
417 | { | 445 | { |
418 | int error; | 446 | int error; |
419 | 447 | ||
420 | set_page_locked(page); | 448 | __set_page_locked(page); |
421 | error = add_to_page_cache_locked(page, mapping, offset, gfp_mask); | 449 | error = add_to_page_cache_locked(page, mapping, offset, gfp_mask); |
422 | if (unlikely(error)) | 450 | if (unlikely(error)) |
423 | clear_page_locked(page); | 451 | __clear_page_locked(page); |
424 | return error; | 452 | return error; |
425 | } | 453 | } |
426 | 454 | ||
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h index 8eb7fa76c1d0..e90a2cb02915 100644 --- a/include/linux/pagevec.h +++ b/include/linux/pagevec.h | |||
@@ -23,9 +23,9 @@ struct pagevec { | |||
23 | void __pagevec_release(struct pagevec *pvec); | 23 | void __pagevec_release(struct pagevec *pvec); |
24 | void __pagevec_release_nonlru(struct pagevec *pvec); | 24 | void __pagevec_release_nonlru(struct pagevec *pvec); |
25 | void __pagevec_free(struct pagevec *pvec); | 25 | void __pagevec_free(struct pagevec *pvec); |
26 | void __pagevec_lru_add(struct pagevec *pvec); | 26 | void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru); |
27 | void __pagevec_lru_add_active(struct pagevec *pvec); | ||
28 | void pagevec_strip(struct pagevec *pvec); | 27 | void pagevec_strip(struct pagevec *pvec); |
28 | void pagevec_swap_free(struct pagevec *pvec); | ||
29 | unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, | 29 | unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, |
30 | pgoff_t start, unsigned nr_pages); | 30 | pgoff_t start, unsigned nr_pages); |
31 | unsigned pagevec_lookup_tag(struct pagevec *pvec, | 31 | unsigned pagevec_lookup_tag(struct pagevec *pvec, |
@@ -81,10 +81,36 @@ static inline void pagevec_free(struct pagevec *pvec) | |||
81 | __pagevec_free(pvec); | 81 | __pagevec_free(pvec); |
82 | } | 82 | } |
83 | 83 | ||
84 | static inline void pagevec_lru_add(struct pagevec *pvec) | 84 | static inline void __pagevec_lru_add_anon(struct pagevec *pvec) |
85 | { | ||
86 | ____pagevec_lru_add(pvec, LRU_INACTIVE_ANON); | ||
87 | } | ||
88 | |||
89 | static inline void __pagevec_lru_add_active_anon(struct pagevec *pvec) | ||
90 | { | ||
91 | ____pagevec_lru_add(pvec, LRU_ACTIVE_ANON); | ||
92 | } | ||
93 | |||
94 | static inline void __pagevec_lru_add_file(struct pagevec *pvec) | ||
95 | { | ||
96 | ____pagevec_lru_add(pvec, LRU_INACTIVE_FILE); | ||
97 | } | ||
98 | |||
99 | static inline void __pagevec_lru_add_active_file(struct pagevec *pvec) | ||
100 | { | ||
101 | ____pagevec_lru_add(pvec, LRU_ACTIVE_FILE); | ||
102 | } | ||
103 | |||
104 | static inline void pagevec_lru_add_file(struct pagevec *pvec) | ||
105 | { | ||
106 | if (pagevec_count(pvec)) | ||
107 | __pagevec_lru_add_file(pvec); | ||
108 | } | ||
109 | |||
110 | static inline void pagevec_lru_add_anon(struct pagevec *pvec) | ||
85 | { | 111 | { |
86 | if (pagevec_count(pvec)) | 112 | if (pagevec_count(pvec)) |
87 | __pagevec_lru_add(pvec); | 113 | __pagevec_lru_add_anon(pvec); |
88 | } | 114 | } |
89 | 115 | ||
90 | #endif /* _LINUX_PAGEVEC_H */ | 116 | #endif /* _LINUX_PAGEVEC_H */ |
diff --git a/include/linux/parport.h b/include/linux/parport.h index 6a0d7cdb5774..e1f83c5065c5 100644 --- a/include/linux/parport.h +++ b/include/linux/parport.h | |||
@@ -1,5 +1,3 @@ | |||
1 | /* $Id: parport.h,v 1.1 1998/05/17 10:57:52 andrea Exp andrea $ */ | ||
2 | |||
3 | /* | 1 | /* |
4 | * Any part of this program may be used in documents licensed under | 2 | * Any part of this program may be used in documents licensed under |
5 | * the GNU Free Documentation License, Version 1.1 or any later version | 3 | * the GNU Free Documentation License, Version 1.1 or any later version |
diff --git a/include/linux/parser.h b/include/linux/parser.h index 7dcd05075756..ea2281e726f6 100644 --- a/include/linux/parser.h +++ b/include/linux/parser.h | |||
@@ -25,7 +25,7 @@ typedef struct { | |||
25 | char *to; | 25 | char *to; |
26 | } substring_t; | 26 | } substring_t; |
27 | 27 | ||
28 | int match_token(char *, match_table_t table, substring_t args[]); | 28 | int match_token(char *, const match_table_t table, substring_t args[]); |
29 | int match_int(substring_t *, int *result); | 29 | int match_int(substring_t *, int *result); |
30 | int match_octal(substring_t *, int *result); | 30 | int match_octal(substring_t *, int *result); |
31 | int match_hex(substring_t *, int *result); | 31 | int match_hex(substring_t *, int *result); |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 98dc6243a706..feb4657bb043 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <linux/kobject.h> | 51 | #include <linux/kobject.h> |
52 | #include <asm/atomic.h> | 52 | #include <asm/atomic.h> |
53 | #include <linux/device.h> | 53 | #include <linux/device.h> |
54 | #include <linux/io.h> | ||
54 | 55 | ||
55 | /* Include the ID list */ | 56 | /* Include the ID list */ |
56 | #include <linux/pci_ids.h> | 57 | #include <linux/pci_ids.h> |
@@ -64,6 +65,11 @@ struct pci_slot { | |||
64 | struct kobject kobj; | 65 | struct kobject kobj; |
65 | }; | 66 | }; |
66 | 67 | ||
68 | static inline const char *pci_slot_name(const struct pci_slot *slot) | ||
69 | { | ||
70 | return kobject_name(&slot->kobj); | ||
71 | } | ||
72 | |||
67 | /* File state for mmap()s on /proc/bus/pci/X/Y */ | 73 | /* File state for mmap()s on /proc/bus/pci/X/Y */ |
68 | enum pci_mmap_state { | 74 | enum pci_mmap_state { |
69 | pci_mmap_io, | 75 | pci_mmap_io, |
@@ -214,6 +220,7 @@ struct pci_dev { | |||
214 | unsigned int broken_parity_status:1; /* Device generates false positive parity */ | 220 | unsigned int broken_parity_status:1; /* Device generates false positive parity */ |
215 | unsigned int msi_enabled:1; | 221 | unsigned int msi_enabled:1; |
216 | unsigned int msix_enabled:1; | 222 | unsigned int msix_enabled:1; |
223 | unsigned int ari_enabled:1; /* ARI forwarding */ | ||
217 | unsigned int is_managed:1; | 224 | unsigned int is_managed:1; |
218 | unsigned int is_pcie:1; | 225 | unsigned int is_pcie:1; |
219 | pci_dev_flags_t dev_flags; | 226 | pci_dev_flags_t dev_flags; |
@@ -347,7 +354,6 @@ struct pci_bus_region { | |||
347 | struct pci_dynids { | 354 | struct pci_dynids { |
348 | spinlock_t lock; /* protects list, index */ | 355 | spinlock_t lock; /* protects list, index */ |
349 | struct list_head list; /* for IDs added at runtime */ | 356 | struct list_head list; /* for IDs added at runtime */ |
350 | unsigned int use_driver_data:1; /* pci_device_id->driver_data is used */ | ||
351 | }; | 357 | }; |
352 | 358 | ||
353 | /* ---------------------------------------------------------------- */ | 359 | /* ---------------------------------------------------------------- */ |
@@ -456,8 +462,8 @@ struct pci_driver { | |||
456 | 462 | ||
457 | /** | 463 | /** |
458 | * PCI_VDEVICE - macro used to describe a specific pci device in short form | 464 | * PCI_VDEVICE - macro used to describe a specific pci device in short form |
459 | * @vend: the vendor name | 465 | * @vendor: the vendor name |
460 | * @dev: the 16 bit PCI Device ID | 466 | * @device: the 16 bit PCI Device ID |
461 | * | 467 | * |
462 | * This macro is used to create a struct pci_device_id that matches a | 468 | * This macro is used to create a struct pci_device_id that matches a |
463 | * specific PCI device. The subvendor, and subdevice fields will be set | 469 | * specific PCI device. The subvendor, and subdevice fields will be set |
@@ -509,9 +515,10 @@ struct pci_bus *pci_create_bus(struct device *parent, int bus, | |||
509 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, | 515 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, |
510 | int busnr); | 516 | int busnr); |
511 | struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, | 517 | struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, |
512 | const char *name); | 518 | const char *name, |
519 | struct hotplug_slot *hotplug); | ||
513 | void pci_destroy_slot(struct pci_slot *slot); | 520 | void pci_destroy_slot(struct pci_slot *slot); |
514 | void pci_update_slot_number(struct pci_slot *slot, int slot_nr); | 521 | void pci_renumber_slot(struct pci_slot *slot, int slot_nr); |
515 | int pci_scan_slot(struct pci_bus *bus, int devfn); | 522 | int pci_scan_slot(struct pci_bus *bus, int devfn); |
516 | struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); | 523 | struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); |
517 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); | 524 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); |
@@ -539,6 +546,13 @@ struct pci_dev __deprecated *pci_find_slot(unsigned int bus, | |||
539 | unsigned int devfn); | 546 | unsigned int devfn); |
540 | #endif /* CONFIG_PCI_LEGACY */ | 547 | #endif /* CONFIG_PCI_LEGACY */ |
541 | 548 | ||
549 | enum pci_lost_interrupt_reason { | ||
550 | PCI_LOST_IRQ_NO_INFORMATION = 0, | ||
551 | PCI_LOST_IRQ_DISABLE_MSI, | ||
552 | PCI_LOST_IRQ_DISABLE_MSIX, | ||
553 | PCI_LOST_IRQ_DISABLE_ACPI, | ||
554 | }; | ||
555 | enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *dev); | ||
542 | int pci_find_capability(struct pci_dev *dev, int cap); | 556 | int pci_find_capability(struct pci_dev *dev, int cap); |
543 | int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); | 557 | int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); |
544 | int pci_find_ext_capability(struct pci_dev *dev, int cap); | 558 | int pci_find_ext_capability(struct pci_dev *dev, int cap); |
@@ -626,11 +640,15 @@ int pcix_get_mmrbc(struct pci_dev *dev); | |||
626 | int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); | 640 | int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); |
627 | int pcie_get_readrq(struct pci_dev *dev); | 641 | int pcie_get_readrq(struct pci_dev *dev); |
628 | int pcie_set_readrq(struct pci_dev *dev, int rq); | 642 | int pcie_set_readrq(struct pci_dev *dev, int rq); |
643 | int pci_reset_function(struct pci_dev *dev); | ||
644 | int pci_execute_reset_function(struct pci_dev *dev); | ||
629 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); | 645 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); |
630 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); | 646 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); |
631 | int pci_select_bars(struct pci_dev *dev, unsigned long flags); | 647 | int pci_select_bars(struct pci_dev *dev, unsigned long flags); |
632 | 648 | ||
633 | /* ROM control related routines */ | 649 | /* ROM control related routines */ |
650 | int pci_enable_rom(struct pci_dev *pdev); | ||
651 | void pci_disable_rom(struct pci_dev *pdev); | ||
634 | void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); | 652 | void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); |
635 | void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); | 653 | void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); |
636 | size_t pci_get_rom_size(void __iomem *rom, size_t size); | 654 | size_t pci_get_rom_size(void __iomem *rom, size_t size); |
@@ -643,6 +661,7 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); | |||
643 | bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); | 661 | bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); |
644 | void pci_pme_active(struct pci_dev *dev, bool enable); | 662 | void pci_pme_active(struct pci_dev *dev, bool enable); |
645 | int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); | 663 | int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); |
664 | int pci_wake_from_d3(struct pci_dev *dev, bool enable); | ||
646 | pci_power_t pci_target_state(struct pci_dev *dev); | 665 | pci_power_t pci_target_state(struct pci_dev *dev); |
647 | int pci_prepare_to_sleep(struct pci_dev *dev); | 666 | int pci_prepare_to_sleep(struct pci_dev *dev); |
648 | int pci_back_from_sleep(struct pci_dev *dev); | 667 | int pci_back_from_sleep(struct pci_dev *dev); |
@@ -723,7 +742,7 @@ enum pci_dma_burst_strategy { | |||
723 | }; | 742 | }; |
724 | 743 | ||
725 | struct msix_entry { | 744 | struct msix_entry { |
726 | u16 vector; /* kernel uses to write allocated vector */ | 745 | u32 vector; /* kernel uses to write allocated vector */ |
727 | u16 entry; /* driver uses to specify entry, OS writes */ | 746 | u16 entry; /* driver uses to specify entry, OS writes */ |
728 | }; | 747 | }; |
729 | 748 | ||
@@ -1116,5 +1135,20 @@ static inline void pci_mmcfg_early_init(void) { } | |||
1116 | static inline void pci_mmcfg_late_init(void) { } | 1135 | static inline void pci_mmcfg_late_init(void) { } |
1117 | #endif | 1136 | #endif |
1118 | 1137 | ||
1138 | #ifdef CONFIG_HAS_IOMEM | ||
1139 | static inline void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar) | ||
1140 | { | ||
1141 | /* | ||
1142 | * Make sure the BAR is actually a memory resource, not an IO resource | ||
1143 | */ | ||
1144 | if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) { | ||
1145 | WARN_ON(1); | ||
1146 | return NULL; | ||
1147 | } | ||
1148 | return ioremap_nocache(pci_resource_start(pdev, bar), | ||
1149 | pci_resource_len(pdev, bar)); | ||
1150 | } | ||
1151 | #endif | ||
1152 | |||
1119 | #endif /* __KERNEL__ */ | 1153 | #endif /* __KERNEL__ */ |
1120 | #endif /* LINUX_PCI_H */ | 1154 | #endif /* LINUX_PCI_H */ |
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h index a08cd06b541a..a00bd1a0f156 100644 --- a/include/linux/pci_hotplug.h +++ b/include/linux/pci_hotplug.h | |||
@@ -142,8 +142,6 @@ struct hotplug_slot_info { | |||
142 | 142 | ||
143 | /** | 143 | /** |
144 | * struct hotplug_slot - used to register a physical slot with the hotplug pci core | 144 | * struct hotplug_slot - used to register a physical slot with the hotplug pci core |
145 | * @name: the name of the slot being registered. This string must | ||
146 | * be unique amoung slots registered on this system. | ||
147 | * @ops: pointer to the &struct hotplug_slot_ops to be used for this slot | 145 | * @ops: pointer to the &struct hotplug_slot_ops to be used for this slot |
148 | * @info: pointer to the &struct hotplug_slot_info for the initial values for | 146 | * @info: pointer to the &struct hotplug_slot_info for the initial values for |
149 | * this slot. | 147 | * this slot. |
@@ -153,7 +151,6 @@ struct hotplug_slot_info { | |||
153 | * needs. | 151 | * needs. |
154 | */ | 152 | */ |
155 | struct hotplug_slot { | 153 | struct hotplug_slot { |
156 | char *name; | ||
157 | struct hotplug_slot_ops *ops; | 154 | struct hotplug_slot_ops *ops; |
158 | struct hotplug_slot_info *info; | 155 | struct hotplug_slot_info *info; |
159 | void (*release) (struct hotplug_slot *slot); | 156 | void (*release) (struct hotplug_slot *slot); |
@@ -165,7 +162,13 @@ struct hotplug_slot { | |||
165 | }; | 162 | }; |
166 | #define to_hotplug_slot(n) container_of(n, struct hotplug_slot, kobj) | 163 | #define to_hotplug_slot(n) container_of(n, struct hotplug_slot, kobj) |
167 | 164 | ||
168 | extern int pci_hp_register(struct hotplug_slot *, struct pci_bus *, int nr); | 165 | static inline const char *hotplug_slot_name(const struct hotplug_slot *slot) |
166 | { | ||
167 | return pci_slot_name(slot->pci_slot); | ||
168 | } | ||
169 | |||
170 | extern int pci_hp_register(struct hotplug_slot *, struct pci_bus *, int nr, | ||
171 | const char *name); | ||
169 | extern int pci_hp_deregister(struct hotplug_slot *slot); | 172 | extern int pci_hp_deregister(struct hotplug_slot *slot); |
170 | extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, | 173 | extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, |
171 | struct hotplug_slot_info *info); | 174 | struct hotplug_slot_info *info); |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index f1624b396754..1800f1d6e40d 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -497,6 +497,16 @@ | |||
497 | #define PCI_DEVICE_ID_AMD_K8_NB_ADDRMAP 0x1101 | 497 | #define PCI_DEVICE_ID_AMD_K8_NB_ADDRMAP 0x1101 |
498 | #define PCI_DEVICE_ID_AMD_K8_NB_MEMCTL 0x1102 | 498 | #define PCI_DEVICE_ID_AMD_K8_NB_MEMCTL 0x1102 |
499 | #define PCI_DEVICE_ID_AMD_K8_NB_MISC 0x1103 | 499 | #define PCI_DEVICE_ID_AMD_K8_NB_MISC 0x1103 |
500 | #define PCI_DEVICE_ID_AMD_10H_NB_HT 0x1200 | ||
501 | #define PCI_DEVICE_ID_AMD_10H_NB_MAP 0x1201 | ||
502 | #define PCI_DEVICE_ID_AMD_10H_NB_DRAM 0x1202 | ||
503 | #define PCI_DEVICE_ID_AMD_10H_NB_MISC 0x1203 | ||
504 | #define PCI_DEVICE_ID_AMD_10H_NB_LINK 0x1204 | ||
505 | #define PCI_DEVICE_ID_AMD_11H_NB_HT 0x1300 | ||
506 | #define PCI_DEVICE_ID_AMD_11H_NB_MAP 0x1301 | ||
507 | #define PCI_DEVICE_ID_AMD_11H_NB_DRAM 0x1302 | ||
508 | #define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303 | ||
509 | #define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304 | ||
500 | #define PCI_DEVICE_ID_AMD_LANCE 0x2000 | 510 | #define PCI_DEVICE_ID_AMD_LANCE 0x2000 |
501 | #define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 | 511 | #define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 |
502 | #define PCI_DEVICE_ID_AMD_SCSI 0x2020 | 512 | #define PCI_DEVICE_ID_AMD_SCSI 0x2020 |
@@ -577,6 +587,7 @@ | |||
577 | #define PCI_DEVICE_ID_MATROX_G200_PCI 0x0520 | 587 | #define PCI_DEVICE_ID_MATROX_G200_PCI 0x0520 |
578 | #define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521 | 588 | #define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521 |
579 | #define PCI_DEVICE_ID_MATROX_G400 0x0525 | 589 | #define PCI_DEVICE_ID_MATROX_G400 0x0525 |
590 | #define PCI_DEVICE_ID_MATROX_G200EV_PCI 0x0530 | ||
580 | #define PCI_DEVICE_ID_MATROX_G550 0x2527 | 591 | #define PCI_DEVICE_ID_MATROX_G550 0x2527 |
581 | #define PCI_DEVICE_ID_MATROX_VIA 0x4536 | 592 | #define PCI_DEVICE_ID_MATROX_VIA 0x4536 |
582 | 593 | ||
@@ -1411,6 +1422,8 @@ | |||
1411 | #define PCI_DEVICE_ID_EICON_MAESTRAQ_U 0xe013 | 1422 | #define PCI_DEVICE_ID_EICON_MAESTRAQ_U 0xe013 |
1412 | #define PCI_DEVICE_ID_EICON_MAESTRAP 0xe014 | 1423 | #define PCI_DEVICE_ID_EICON_MAESTRAP 0xe014 |
1413 | 1424 | ||
1425 | #define PCI_VENDOR_ID_CISCO 0x1137 | ||
1426 | |||
1414 | #define PCI_VENDOR_ID_ZIATECH 0x1138 | 1427 | #define PCI_VENDOR_ID_ZIATECH 0x1138 |
1415 | #define PCI_DEVICE_ID_ZIATECH_5550_HC 0x5550 | 1428 | #define PCI_DEVICE_ID_ZIATECH_5550_HC 0x5550 |
1416 | 1429 | ||
@@ -1521,7 +1534,9 @@ | |||
1521 | #define PCI_DEVICE_ID_MARVELL_GT64260 0x6430 | 1534 | #define PCI_DEVICE_ID_MARVELL_GT64260 0x6430 |
1522 | #define PCI_DEVICE_ID_MARVELL_MV64360 0x6460 | 1535 | #define PCI_DEVICE_ID_MARVELL_MV64360 0x6460 |
1523 | #define PCI_DEVICE_ID_MARVELL_MV64460 0x6480 | 1536 | #define PCI_DEVICE_ID_MARVELL_MV64460 0x6480 |
1524 | #define PCI_DEVICE_ID_MARVELL_CAFE_SD 0x4101 | 1537 | #define PCI_DEVICE_ID_MARVELL_88ALP01_NAND 0x4100 |
1538 | #define PCI_DEVICE_ID_MARVELL_88ALP01_SD 0x4101 | ||
1539 | #define PCI_DEVICE_ID_MARVELL_88ALP01_CCIC 0x4102 | ||
1525 | 1540 | ||
1526 | #define PCI_VENDOR_ID_V3 0x11b0 | 1541 | #define PCI_VENDOR_ID_V3 0x11b0 |
1527 | #define PCI_DEVICE_ID_V3_V960 0x0001 | 1542 | #define PCI_DEVICE_ID_V3_V960 0x0001 |
@@ -1929,6 +1944,14 @@ | |||
1929 | 1944 | ||
1930 | #define PCI_VENDOR_ID_OXSEMI 0x1415 | 1945 | #define PCI_VENDOR_ID_OXSEMI 0x1415 |
1931 | #define PCI_DEVICE_ID_OXSEMI_12PCI840 0x8403 | 1946 | #define PCI_DEVICE_ID_OXSEMI_12PCI840 0x8403 |
1947 | #define PCI_DEVICE_ID_OXSEMI_PCIe840 0xC000 | ||
1948 | #define PCI_DEVICE_ID_OXSEMI_PCIe840_G 0xC004 | ||
1949 | #define PCI_DEVICE_ID_OXSEMI_PCIe952_0 0xC100 | ||
1950 | #define PCI_DEVICE_ID_OXSEMI_PCIe952_0_G 0xC104 | ||
1951 | #define PCI_DEVICE_ID_OXSEMI_PCIe952_1 0xC110 | ||
1952 | #define PCI_DEVICE_ID_OXSEMI_PCIe952_1_G 0xC114 | ||
1953 | #define PCI_DEVICE_ID_OXSEMI_PCIe952_1_U 0xC118 | ||
1954 | #define PCI_DEVICE_ID_OXSEMI_PCIe952_1_GU 0xC11C | ||
1932 | #define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501 | 1955 | #define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501 |
1933 | #define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511 | 1956 | #define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511 |
1934 | #define PCI_DEVICE_ID_OXSEMI_16PCI954PP 0x9513 | 1957 | #define PCI_DEVICE_ID_OXSEMI_16PCI954PP 0x9513 |
@@ -2213,6 +2236,7 @@ | |||
2213 | 2236 | ||
2214 | #define PCI_VENDOR_ID_ATTANSIC 0x1969 | 2237 | #define PCI_VENDOR_ID_ATTANSIC 0x1969 |
2215 | #define PCI_DEVICE_ID_ATTANSIC_L1 0x1048 | 2238 | #define PCI_DEVICE_ID_ATTANSIC_L1 0x1048 |
2239 | #define PCI_DEVICE_ID_ATTANSIC_L2 0x2048 | ||
2216 | 2240 | ||
2217 | #define PCI_VENDOR_ID_JMICRON 0x197B | 2241 | #define PCI_VENDOR_ID_JMICRON 0x197B |
2218 | #define PCI_DEVICE_ID_JMICRON_JMB360 0x2360 | 2242 | #define PCI_DEVICE_ID_JMICRON_JMB360 0x2360 |
@@ -2244,6 +2268,16 @@ | |||
2244 | #define PCI_DEVICE_ID_3DLABS_PERMEDIA2 0x0007 | 2268 | #define PCI_DEVICE_ID_3DLABS_PERMEDIA2 0x0007 |
2245 | #define PCI_DEVICE_ID_3DLABS_PERMEDIA2V 0x0009 | 2269 | #define PCI_DEVICE_ID_3DLABS_PERMEDIA2V 0x0009 |
2246 | 2270 | ||
2271 | #define PCI_VENDOR_ID_NETXEN 0x4040 | ||
2272 | #define PCI_DEVICE_ID_NX2031_10GXSR 0x0001 | ||
2273 | #define PCI_DEVICE_ID_NX2031_10GCX4 0x0002 | ||
2274 | #define PCI_DEVICE_ID_NX2031_4GCU 0x0003 | ||
2275 | #define PCI_DEVICE_ID_NX2031_IMEZ 0x0004 | ||
2276 | #define PCI_DEVICE_ID_NX2031_HMEZ 0x0005 | ||
2277 | #define PCI_DEVICE_ID_NX2031_XG_MGMT 0x0024 | ||
2278 | #define PCI_DEVICE_ID_NX2031_XG_MGMT2 0x0025 | ||
2279 | #define PCI_DEVICE_ID_NX3031 0x0100 | ||
2280 | |||
2247 | #define PCI_VENDOR_ID_AKS 0x416c | 2281 | #define PCI_VENDOR_ID_AKS 0x416c |
2248 | #define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100 | 2282 | #define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100 |
2249 | 2283 | ||
@@ -2422,15 +2456,16 @@ | |||
2422 | #define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a | 2456 | #define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a |
2423 | #define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e | 2457 | #define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e |
2424 | #define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b | 2458 | #define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b |
2459 | #define PCI_DEVICE_ID_INTEL_FBD_CNB 0x360c | ||
2425 | #define PCI_DEVICE_ID_INTEL_ICH10_0 0x3a14 | 2460 | #define PCI_DEVICE_ID_INTEL_ICH10_0 0x3a14 |
2426 | #define PCI_DEVICE_ID_INTEL_ICH10_1 0x3a16 | 2461 | #define PCI_DEVICE_ID_INTEL_ICH10_1 0x3a16 |
2427 | #define PCI_DEVICE_ID_INTEL_ICH10_2 0x3a18 | 2462 | #define PCI_DEVICE_ID_INTEL_ICH10_2 0x3a18 |
2428 | #define PCI_DEVICE_ID_INTEL_ICH10_3 0x3a1a | 2463 | #define PCI_DEVICE_ID_INTEL_ICH10_3 0x3a1a |
2429 | #define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30 | 2464 | #define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30 |
2430 | #define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 | 2465 | #define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 |
2431 | #define PCI_DEVICE_ID_INTEL_PCH_0 0x3b10 | 2466 | #define PCI_DEVICE_ID_INTEL_PCH_LPC_MIN 0x3b00 |
2432 | #define PCI_DEVICE_ID_INTEL_PCH_1 0x3b11 | 2467 | #define PCI_DEVICE_ID_INTEL_PCH_LPC_MAX 0x3b1f |
2433 | #define PCI_DEVICE_ID_INTEL_PCH_2 0x3b30 | 2468 | #define PCI_DEVICE_ID_INTEL_PCH_SMBUS 0x3b30 |
2434 | #define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f | 2469 | #define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f |
2435 | #define PCI_DEVICE_ID_INTEL_5100_16 0x65f0 | 2470 | #define PCI_DEVICE_ID_INTEL_5100_16 0x65f0 |
2436 | #define PCI_DEVICE_ID_INTEL_5100_21 0x65f5 | 2471 | #define PCI_DEVICE_ID_INTEL_5100_21 0x65f5 |
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index 450684f7eaac..e5effd47ed74 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
@@ -377,6 +377,7 @@ | |||
377 | #define PCI_EXP_DEVCAP_RBER 0x8000 /* Role-Based Error Reporting */ | 377 | #define PCI_EXP_DEVCAP_RBER 0x8000 /* Role-Based Error Reporting */ |
378 | #define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ | 378 | #define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ |
379 | #define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ | 379 | #define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ |
380 | #define PCI_EXP_DEVCAP_FLR 0x10000000 /* Function Level Reset */ | ||
380 | #define PCI_EXP_DEVCTL 8 /* Device Control */ | 381 | #define PCI_EXP_DEVCTL 8 /* Device Control */ |
381 | #define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */ | 382 | #define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */ |
382 | #define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */ | 383 | #define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */ |
@@ -389,6 +390,7 @@ | |||
389 | #define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ | 390 | #define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ |
390 | #define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */ | 391 | #define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */ |
391 | #define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ | 392 | #define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ |
393 | #define PCI_EXP_DEVCTL_BCR_FLR 0x8000 /* Bridge Configuration Retry / FLR */ | ||
392 | #define PCI_EXP_DEVSTA 10 /* Device Status */ | 394 | #define PCI_EXP_DEVSTA 10 /* Device Status */ |
393 | #define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */ | 395 | #define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */ |
394 | #define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */ | 396 | #define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */ |
@@ -419,6 +421,10 @@ | |||
419 | #define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */ | 421 | #define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */ |
420 | #define PCI_EXP_RTCAP 30 /* Root Capabilities */ | 422 | #define PCI_EXP_RTCAP 30 /* Root Capabilities */ |
421 | #define PCI_EXP_RTSTA 32 /* Root Status */ | 423 | #define PCI_EXP_RTSTA 32 /* Root Status */ |
424 | #define PCI_EXP_DEVCAP2 36 /* Device Capabilities 2 */ | ||
425 | #define PCI_EXP_DEVCAP2_ARI 0x20 /* Alternative Routing-ID */ | ||
426 | #define PCI_EXP_DEVCTL2 40 /* Device Control 2 */ | ||
427 | #define PCI_EXP_DEVCTL2_ARI 0x20 /* Alternative Routing-ID */ | ||
422 | 428 | ||
423 | /* Extended Capabilities (PCI-X 2.0 and Express) */ | 429 | /* Extended Capabilities (PCI-X 2.0 and Express) */ |
424 | #define PCI_EXT_CAP_ID(header) (header & 0x0000ffff) | 430 | #define PCI_EXT_CAP_ID(header) (header & 0x0000ffff) |
@@ -429,6 +435,7 @@ | |||
429 | #define PCI_EXT_CAP_ID_VC 2 | 435 | #define PCI_EXT_CAP_ID_VC 2 |
430 | #define PCI_EXT_CAP_ID_DSN 3 | 436 | #define PCI_EXT_CAP_ID_DSN 3 |
431 | #define PCI_EXT_CAP_ID_PWR 4 | 437 | #define PCI_EXT_CAP_ID_PWR 4 |
438 | #define PCI_EXT_CAP_ID_ARI 14 | ||
432 | 439 | ||
433 | /* Advanced Error Reporting */ | 440 | /* Advanced Error Reporting */ |
434 | #define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ | 441 | #define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ |
@@ -536,5 +543,14 @@ | |||
536 | #define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 hypertransport configuration */ | 543 | #define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 hypertransport configuration */ |
537 | #define HT_CAPTYPE_PM 0xE0 /* Hypertransport powermanagement configuration */ | 544 | #define HT_CAPTYPE_PM 0xE0 /* Hypertransport powermanagement configuration */ |
538 | 545 | ||
546 | /* Alternative Routing-ID Interpretation */ | ||
547 | #define PCI_ARI_CAP 0x04 /* ARI Capability Register */ | ||
548 | #define PCI_ARI_CAP_MFVC 0x0001 /* MFVC Function Groups Capability */ | ||
549 | #define PCI_ARI_CAP_ACS 0x0002 /* ACS Function Groups Capability */ | ||
550 | #define PCI_ARI_CAP_NFN(x) (((x) >> 8) & 0xff) /* Next Function Number */ | ||
551 | #define PCI_ARI_CTRL 0x06 /* ARI Control Register */ | ||
552 | #define PCI_ARI_CTRL_MFVC 0x0001 /* MFVC Function Groups Enable */ | ||
553 | #define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ | ||
554 | #define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ | ||
539 | 555 | ||
540 | #endif /* LINUX_PCI_REGS_H */ | 556 | #endif /* LINUX_PCI_REGS_H */ |
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index fac3337547eb..9f2a3751873a 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -23,12 +23,19 @@ | |||
23 | __attribute__((__section__(SHARED_ALIGNED_SECTION))) \ | 23 | __attribute__((__section__(SHARED_ALIGNED_SECTION))) \ |
24 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \ | 24 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \ |
25 | ____cacheline_aligned_in_smp | 25 | ____cacheline_aligned_in_smp |
26 | |||
27 | #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ | ||
28 | __attribute__((__section__(".data.percpu.page_aligned"))) \ | ||
29 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | ||
26 | #else | 30 | #else |
27 | #define DEFINE_PER_CPU(type, name) \ | 31 | #define DEFINE_PER_CPU(type, name) \ |
28 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | 32 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name |
29 | 33 | ||
30 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ | 34 | #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ |
31 | DEFINE_PER_CPU(type, name) | 35 | DEFINE_PER_CPU(type, name) |
36 | |||
37 | #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ | ||
38 | DEFINE_PER_CPU(type, name) | ||
32 | #endif | 39 | #endif |
33 | 40 | ||
34 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) | 41 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) |
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h index 208388835357..9007ccdfc112 100644 --- a/include/linux/percpu_counter.h +++ b/include/linux/percpu_counter.h | |||
@@ -35,7 +35,7 @@ int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount); | |||
35 | void percpu_counter_destroy(struct percpu_counter *fbc); | 35 | void percpu_counter_destroy(struct percpu_counter *fbc); |
36 | void percpu_counter_set(struct percpu_counter *fbc, s64 amount); | 36 | void percpu_counter_set(struct percpu_counter *fbc, s64 amount); |
37 | void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); | 37 | void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); |
38 | s64 __percpu_counter_sum(struct percpu_counter *fbc, int set); | 38 | s64 __percpu_counter_sum(struct percpu_counter *fbc); |
39 | 39 | ||
40 | static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount) | 40 | static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount) |
41 | { | 41 | { |
@@ -44,19 +44,13 @@ static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount) | |||
44 | 44 | ||
45 | static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc) | 45 | static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc) |
46 | { | 46 | { |
47 | s64 ret = __percpu_counter_sum(fbc, 0); | 47 | s64 ret = __percpu_counter_sum(fbc); |
48 | return ret < 0 ? 0 : ret; | 48 | return ret < 0 ? 0 : ret; |
49 | } | 49 | } |
50 | 50 | ||
51 | static inline s64 percpu_counter_sum_and_set(struct percpu_counter *fbc) | ||
52 | { | ||
53 | return __percpu_counter_sum(fbc, 1); | ||
54 | } | ||
55 | |||
56 | |||
57 | static inline s64 percpu_counter_sum(struct percpu_counter *fbc) | 51 | static inline s64 percpu_counter_sum(struct percpu_counter *fbc) |
58 | { | 52 | { |
59 | return __percpu_counter_sum(fbc, 0); | 53 | return __percpu_counter_sum(fbc); |
60 | } | 54 | } |
61 | 55 | ||
62 | static inline s64 percpu_counter_read(struct percpu_counter *fbc) | 56 | static inline s64 percpu_counter_read(struct percpu_counter *fbc) |
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h index 700725ddcaae..01b262959f2e 100644 --- a/include/linux/pfkeyv2.h +++ b/include/linux/pfkeyv2.h | |||
@@ -226,6 +226,15 @@ struct sadb_x_sec_ctx { | |||
226 | } __attribute__((packed)); | 226 | } __attribute__((packed)); |
227 | /* sizeof(struct sadb_sec_ctx) = 8 */ | 227 | /* sizeof(struct sadb_sec_ctx) = 8 */ |
228 | 228 | ||
229 | /* Used by MIGRATE to pass addresses IKE will use to perform | ||
230 | * negotiation with the peer */ | ||
231 | struct sadb_x_kmaddress { | ||
232 | uint16_t sadb_x_kmaddress_len; | ||
233 | uint16_t sadb_x_kmaddress_exttype; | ||
234 | uint32_t sadb_x_kmaddress_reserved; | ||
235 | } __attribute__((packed)); | ||
236 | /* sizeof(struct sadb_x_kmaddress) == 8 */ | ||
237 | |||
229 | /* Message types */ | 238 | /* Message types */ |
230 | #define SADB_RESERVED 0 | 239 | #define SADB_RESERVED 0 |
231 | #define SADB_GETSPI 1 | 240 | #define SADB_GETSPI 1 |
@@ -346,7 +355,9 @@ struct sadb_x_sec_ctx { | |||
346 | #define SADB_X_EXT_NAT_T_DPORT 22 | 355 | #define SADB_X_EXT_NAT_T_DPORT 22 |
347 | #define SADB_X_EXT_NAT_T_OA 23 | 356 | #define SADB_X_EXT_NAT_T_OA 23 |
348 | #define SADB_X_EXT_SEC_CTX 24 | 357 | #define SADB_X_EXT_SEC_CTX 24 |
349 | #define SADB_EXT_MAX 24 | 358 | /* Used with MIGRATE to pass @ to IKE for negotiation */ |
359 | #define SADB_X_EXT_KMADDRESS 25 | ||
360 | #define SADB_EXT_MAX 25 | ||
350 | 361 | ||
351 | /* Identity Extension values */ | 362 | /* Identity Extension values */ |
352 | #define SADB_IDENTTYPE_RESERVED 0 | 363 | #define SADB_IDENTTYPE_RESERVED 0 |
diff --git a/include/linux/pfn.h b/include/linux/pfn.h index bb01f8b92b56..7646637221f3 100644 --- a/include/linux/pfn.h +++ b/include/linux/pfn.h | |||
@@ -1,9 +1,13 @@ | |||
1 | #ifndef _LINUX_PFN_H_ | 1 | #ifndef _LINUX_PFN_H_ |
2 | #define _LINUX_PFN_H_ | 2 | #define _LINUX_PFN_H_ |
3 | 3 | ||
4 | #ifndef __ASSEMBLY__ | ||
5 | #include <linux/types.h> | ||
6 | #endif | ||
7 | |||
4 | #define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK) | 8 | #define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK) |
5 | #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) | 9 | #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) |
6 | #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) | 10 | #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) |
7 | #define PFN_PHYS(x) ((x) << PAGE_SHIFT) | 11 | #define PFN_PHYS(x) ((phys_addr_t)(x) << PAGE_SHIFT) |
8 | 12 | ||
9 | #endif | 13 | #endif |
diff --git a/include/linux/phonet.h b/include/linux/phonet.h new file mode 100644 index 000000000000..4157faa857b6 --- /dev/null +++ b/include/linux/phonet.h | |||
@@ -0,0 +1,171 @@ | |||
1 | /** | ||
2 | * file phonet.h | ||
3 | * | ||
4 | * Phonet sockets kernel interface | ||
5 | * | ||
6 | * Copyright (C) 2008 Nokia Corporation. All rights reserved. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * 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 | ||
20 | * 02110-1301 USA | ||
21 | */ | ||
22 | |||
23 | #ifndef LINUX_PHONET_H | ||
24 | #define LINUX_PHONET_H | ||
25 | |||
26 | /* Automatic protocol selection */ | ||
27 | #define PN_PROTO_TRANSPORT 0 | ||
28 | /* Phonet datagram socket */ | ||
29 | #define PN_PROTO_PHONET 1 | ||
30 | /* Phonet pipe */ | ||
31 | #define PN_PROTO_PIPE 2 | ||
32 | #define PHONET_NPROTO 3 | ||
33 | |||
34 | /* Socket options for SOL_PNPIPE level */ | ||
35 | #define PNPIPE_ENCAP 1 | ||
36 | #define PNPIPE_IFINDEX 2 | ||
37 | |||
38 | #define PNADDR_ANY 0 | ||
39 | #define PNPORT_RESOURCE_ROUTING 0 | ||
40 | |||
41 | /* Values for PNPIPE_ENCAP option */ | ||
42 | #define PNPIPE_ENCAP_NONE 0 | ||
43 | #define PNPIPE_ENCAP_IP 1 | ||
44 | |||
45 | /* ioctls */ | ||
46 | #define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0) | ||
47 | |||
48 | /* Phonet protocol header */ | ||
49 | struct phonethdr { | ||
50 | __u8 pn_rdev; | ||
51 | __u8 pn_sdev; | ||
52 | __u8 pn_res; | ||
53 | __be16 pn_length; | ||
54 | __u8 pn_robj; | ||
55 | __u8 pn_sobj; | ||
56 | } __attribute__((packed)); | ||
57 | |||
58 | /* Common Phonet payload header */ | ||
59 | struct phonetmsg { | ||
60 | __u8 pn_trans_id; /* transaction ID */ | ||
61 | __u8 pn_msg_id; /* message type */ | ||
62 | union { | ||
63 | struct { | ||
64 | __u8 pn_submsg_id; /* message subtype */ | ||
65 | __u8 pn_data[5]; | ||
66 | } base; | ||
67 | struct { | ||
68 | __u16 pn_e_res_id; /* extended resource ID */ | ||
69 | __u8 pn_e_submsg_id; /* message subtype */ | ||
70 | __u8 pn_e_data[3]; | ||
71 | } ext; | ||
72 | } pn_msg_u; | ||
73 | }; | ||
74 | #define PN_COMMON_MESSAGE 0xF0 | ||
75 | #define PN_COMMGR 0x10 | ||
76 | #define PN_PREFIX 0xE0 /* resource for extended messages */ | ||
77 | #define pn_submsg_id pn_msg_u.base.pn_submsg_id | ||
78 | #define pn_e_submsg_id pn_msg_u.ext.pn_e_submsg_id | ||
79 | #define pn_e_res_id pn_msg_u.ext.pn_e_res_id | ||
80 | #define pn_data pn_msg_u.base.pn_data | ||
81 | #define pn_e_data pn_msg_u.ext.pn_e_data | ||
82 | |||
83 | /* data for unreachable errors */ | ||
84 | #define PN_COMM_SERVICE_NOT_IDENTIFIED_RESP 0x01 | ||
85 | #define PN_COMM_ISA_ENTITY_NOT_REACHABLE_RESP 0x14 | ||
86 | #define pn_orig_msg_id pn_data[0] | ||
87 | #define pn_status pn_data[1] | ||
88 | #define pn_e_orig_msg_id pn_e_data[0] | ||
89 | #define pn_e_status pn_e_data[1] | ||
90 | |||
91 | /* Phonet socket address structure */ | ||
92 | struct sockaddr_pn { | ||
93 | sa_family_t spn_family; | ||
94 | __u8 spn_obj; | ||
95 | __u8 spn_dev; | ||
96 | __u8 spn_resource; | ||
97 | __u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3]; | ||
98 | } __attribute__ ((packed)); | ||
99 | |||
100 | static inline __u16 pn_object(__u8 addr, __u16 port) | ||
101 | { | ||
102 | return (addr << 8) | (port & 0x3ff); | ||
103 | } | ||
104 | |||
105 | static inline __u8 pn_obj(__u16 handle) | ||
106 | { | ||
107 | return handle & 0xff; | ||
108 | } | ||
109 | |||
110 | static inline __u8 pn_dev(__u16 handle) | ||
111 | { | ||
112 | return handle >> 8; | ||
113 | } | ||
114 | |||
115 | static inline __u16 pn_port(__u16 handle) | ||
116 | { | ||
117 | return handle & 0x3ff; | ||
118 | } | ||
119 | |||
120 | static inline __u8 pn_addr(__u16 handle) | ||
121 | { | ||
122 | return (handle >> 8) & 0xfc; | ||
123 | } | ||
124 | |||
125 | static inline void pn_sockaddr_set_addr(struct sockaddr_pn *spn, __u8 addr) | ||
126 | { | ||
127 | spn->spn_dev &= 0x03; | ||
128 | spn->spn_dev |= addr & 0xfc; | ||
129 | } | ||
130 | |||
131 | static inline void pn_sockaddr_set_port(struct sockaddr_pn *spn, __u16 port) | ||
132 | { | ||
133 | spn->spn_dev &= 0xfc; | ||
134 | spn->spn_dev |= (port >> 8) & 0x03; | ||
135 | spn->spn_obj = port & 0xff; | ||
136 | } | ||
137 | |||
138 | static inline void pn_sockaddr_set_object(struct sockaddr_pn *spn, | ||
139 | __u16 handle) | ||
140 | { | ||
141 | spn->spn_dev = pn_dev(handle); | ||
142 | spn->spn_obj = pn_obj(handle); | ||
143 | } | ||
144 | |||
145 | static inline void pn_sockaddr_set_resource(struct sockaddr_pn *spn, | ||
146 | __u8 resource) | ||
147 | { | ||
148 | spn->spn_resource = resource; | ||
149 | } | ||
150 | |||
151 | static inline __u8 pn_sockaddr_get_addr(const struct sockaddr_pn *spn) | ||
152 | { | ||
153 | return spn->spn_dev & 0xfc; | ||
154 | } | ||
155 | |||
156 | static inline __u16 pn_sockaddr_get_port(const struct sockaddr_pn *spn) | ||
157 | { | ||
158 | return ((spn->spn_dev & 0x03) << 8) | spn->spn_obj; | ||
159 | } | ||
160 | |||
161 | static inline __u16 pn_sockaddr_get_object(const struct sockaddr_pn *spn) | ||
162 | { | ||
163 | return pn_object(spn->spn_dev, spn->spn_obj); | ||
164 | } | ||
165 | |||
166 | static inline __u8 pn_sockaddr_get_resource(const struct sockaddr_pn *spn) | ||
167 | { | ||
168 | return spn->spn_resource; | ||
169 | } | ||
170 | |||
171 | #endif | ||
diff --git a/include/linux/phy.h b/include/linux/phy.h index 7224c4099a28..77c4ed60b982 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
@@ -99,7 +99,14 @@ struct mii_bus { | |||
99 | */ | 99 | */ |
100 | struct mutex mdio_lock; | 100 | struct mutex mdio_lock; |
101 | 101 | ||
102 | struct device *dev; | 102 | struct device *parent; |
103 | enum { | ||
104 | MDIOBUS_ALLOCATED = 1, | ||
105 | MDIOBUS_REGISTERED, | ||
106 | MDIOBUS_UNREGISTERED, | ||
107 | MDIOBUS_RELEASED, | ||
108 | } state; | ||
109 | struct device dev; | ||
103 | 110 | ||
104 | /* list of all PHYs on bus */ | 111 | /* list of all PHYs on bus */ |
105 | struct phy_device *phy_map[PHY_MAX_ADDR]; | 112 | struct phy_device *phy_map[PHY_MAX_ADDR]; |
@@ -113,6 +120,16 @@ struct mii_bus { | |||
113 | */ | 120 | */ |
114 | int *irq; | 121 | int *irq; |
115 | }; | 122 | }; |
123 | #define to_mii_bus(d) container_of(d, struct mii_bus, dev) | ||
124 | |||
125 | struct mii_bus *mdiobus_alloc(void); | ||
126 | int mdiobus_register(struct mii_bus *bus); | ||
127 | void mdiobus_unregister(struct mii_bus *bus); | ||
128 | void mdiobus_free(struct mii_bus *bus); | ||
129 | struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); | ||
130 | int mdiobus_read(struct mii_bus *bus, int addr, u16 regnum); | ||
131 | int mdiobus_write(struct mii_bus *bus, int addr, u16 regnum, u16 val); | ||
132 | |||
116 | 133 | ||
117 | #define PHY_INTERRUPT_DISABLED 0x0 | 134 | #define PHY_INTERRUPT_DISABLED 0x0 |
118 | #define PHY_INTERRUPT_ENABLED 0x80000000 | 135 | #define PHY_INTERRUPT_ENABLED 0x80000000 |
@@ -391,8 +408,35 @@ struct phy_fixup { | |||
391 | int (*run)(struct phy_device *phydev); | 408 | int (*run)(struct phy_device *phydev); |
392 | }; | 409 | }; |
393 | 410 | ||
394 | int phy_read(struct phy_device *phydev, u16 regnum); | 411 | /** |
395 | int phy_write(struct phy_device *phydev, u16 regnum, u16 val); | 412 | * phy_read - Convenience function for reading a given PHY register |
413 | * @phydev: the phy_device struct | ||
414 | * @regnum: register number to read | ||
415 | * | ||
416 | * NOTE: MUST NOT be called from interrupt context, | ||
417 | * because the bus read/write functions may wait for an interrupt | ||
418 | * to conclude the operation. | ||
419 | */ | ||
420 | static inline int phy_read(struct phy_device *phydev, u16 regnum) | ||
421 | { | ||
422 | return mdiobus_read(phydev->bus, phydev->addr, regnum); | ||
423 | } | ||
424 | |||
425 | /** | ||
426 | * phy_write - Convenience function for writing a given PHY register | ||
427 | * @phydev: the phy_device struct | ||
428 | * @regnum: register number to write | ||
429 | * @val: value to write to @regnum | ||
430 | * | ||
431 | * NOTE: MUST NOT be called from interrupt context, | ||
432 | * because the bus read/write functions may wait for an interrupt | ||
433 | * to conclude the operation. | ||
434 | */ | ||
435 | static inline int phy_write(struct phy_device *phydev, u16 regnum, u16 val) | ||
436 | { | ||
437 | return mdiobus_write(phydev->bus, phydev->addr, regnum, val); | ||
438 | } | ||
439 | |||
396 | int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id); | 440 | int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id); |
397 | struct phy_device* get_phy_device(struct mii_bus *bus, int addr); | 441 | struct phy_device* get_phy_device(struct mii_bus *bus, int addr); |
398 | int phy_clear_interrupt(struct phy_device *phydev); | 442 | int phy_clear_interrupt(struct phy_device *phydev); |
@@ -408,8 +452,6 @@ void phy_start(struct phy_device *phydev); | |||
408 | void phy_stop(struct phy_device *phydev); | 452 | void phy_stop(struct phy_device *phydev); |
409 | int phy_start_aneg(struct phy_device *phydev); | 453 | int phy_start_aneg(struct phy_device *phydev); |
410 | 454 | ||
411 | int mdiobus_register(struct mii_bus *bus); | ||
412 | void mdiobus_unregister(struct mii_bus *bus); | ||
413 | void phy_sanitize_settings(struct phy_device *phydev); | 455 | void phy_sanitize_settings(struct phy_device *phydev); |
414 | int phy_stop_interrupts(struct phy_device *phydev); | 456 | int phy_stop_interrupts(struct phy_device *phydev); |
415 | int phy_enable_interrupts(struct phy_device *phydev); | 457 | int phy_enable_interrupts(struct phy_device *phydev); |
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h index 1af82c4e17d4..d82fe825d62f 100644 --- a/include/linux/pid_namespace.h +++ b/include/linux/pid_namespace.h | |||
@@ -84,12 +84,6 @@ static inline struct pid_namespace *task_active_pid_ns(struct task_struct *tsk) | |||
84 | return tsk->nsproxy->pid_ns; | 84 | return tsk->nsproxy->pid_ns; |
85 | } | 85 | } |
86 | 86 | ||
87 | static inline struct task_struct *task_child_reaper(struct task_struct *tsk) | ||
88 | { | ||
89 | BUG_ON(tsk != current); | ||
90 | return tsk->nsproxy->pid_ns->child_reaper; | ||
91 | } | ||
92 | |||
93 | void pidhash_init(void); | 87 | void pidhash_init(void); |
94 | void pidmap_init(void); | 88 | void pidmap_init(void); |
95 | 89 | ||
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h index e5de421ac7b4..5d921fa91a5b 100644 --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h | |||
@@ -123,6 +123,13 @@ struct tc_prio_qopt | |||
123 | __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ | 123 | __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ |
124 | }; | 124 | }; |
125 | 125 | ||
126 | /* MULTIQ section */ | ||
127 | |||
128 | struct tc_multiq_qopt { | ||
129 | __u16 bands; /* Number of bands */ | ||
130 | __u16 max_bands; /* Maximum number of queues */ | ||
131 | }; | ||
132 | |||
126 | /* TBF section */ | 133 | /* TBF section */ |
127 | 134 | ||
128 | struct tc_tbf_qopt | 135 | struct tc_tbf_qopt |
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 95ac21ab3a09..4b8cc6a32479 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
@@ -37,6 +37,8 @@ extern int platform_add_devices(struct platform_device **, int); | |||
37 | 37 | ||
38 | extern struct platform_device *platform_device_register_simple(const char *, int id, | 38 | extern struct platform_device *platform_device_register_simple(const char *, int id, |
39 | struct resource *, unsigned int); | 39 | struct resource *, unsigned int); |
40 | extern struct platform_device *platform_device_register_data(struct device *, | ||
41 | const char *, int, const void *, size_t); | ||
40 | 42 | ||
41 | extern struct platform_device *platform_device_alloc(const char *name, int id); | 43 | extern struct platform_device *platform_device_alloc(const char *name, int id); |
42 | extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num); | 44 | extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num); |
diff --git a/include/linux/pm.h b/include/linux/pm.h index 4dcce54b6d76..42de4003c4ee 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -419,7 +419,7 @@ extern void __suspend_report_result(const char *function, void *fn, int ret); | |||
419 | 419 | ||
420 | #define suspend_report_result(fn, ret) \ | 420 | #define suspend_report_result(fn, ret) \ |
421 | do { \ | 421 | do { \ |
422 | __suspend_report_result(__FUNCTION__, fn, ret); \ | 422 | __suspend_report_result(__func__, fn, ret); \ |
423 | } while (0) | 423 | } while (0) |
424 | 424 | ||
425 | #else /* !CONFIG_PM_SLEEP */ | 425 | #else /* !CONFIG_PM_SLEEP */ |
diff --git a/include/linux/pnp.h b/include/linux/pnp.h index be764e514e35..ca3c88773028 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h | |||
@@ -22,9 +22,11 @@ struct pnp_dev; | |||
22 | * Resource Management | 22 | * Resource Management |
23 | */ | 23 | */ |
24 | #ifdef CONFIG_PNP | 24 | #ifdef CONFIG_PNP |
25 | struct resource *pnp_get_resource(struct pnp_dev *, unsigned int, unsigned int); | 25 | struct resource *pnp_get_resource(struct pnp_dev *dev, unsigned long type, |
26 | unsigned int num); | ||
26 | #else | 27 | #else |
27 | static inline struct resource *pnp_get_resource(struct pnp_dev *dev, unsigned int type, unsigned int num) | 28 | static inline struct resource *pnp_get_resource(struct pnp_dev *dev, |
29 | unsigned long type, unsigned int num) | ||
28 | { | 30 | { |
29 | return NULL; | 31 | return NULL; |
30 | } | 32 | } |
@@ -483,14 +485,4 @@ static inline void pnp_unregister_driver(struct pnp_driver *drv) { } | |||
483 | 485 | ||
484 | #endif /* CONFIG_PNP */ | 486 | #endif /* CONFIG_PNP */ |
485 | 487 | ||
486 | #define pnp_err(format, arg...) printk(KERN_ERR "pnp: " format "\n" , ## arg) | ||
487 | #define pnp_info(format, arg...) printk(KERN_INFO "pnp: " format "\n" , ## arg) | ||
488 | #define pnp_warn(format, arg...) printk(KERN_WARNING "pnp: " format "\n" , ## arg) | ||
489 | |||
490 | #ifdef CONFIG_PNP_DEBUG | ||
491 | #define pnp_dbg(format, arg...) printk(KERN_DEBUG "pnp: " format "\n" , ## arg) | ||
492 | #else | ||
493 | #define pnp_dbg(format, arg...) do {} while (0) | ||
494 | #endif | ||
495 | |||
496 | #endif /* _LINUX_PNP_H */ | 488 | #endif /* _LINUX_PNP_H */ |
diff --git a/include/linux/poll.h b/include/linux/poll.h index ef453828877a..badd98ab06f6 100644 --- a/include/linux/poll.h +++ b/include/linux/poll.h | |||
@@ -114,11 +114,13 @@ void zero_fd_set(unsigned long nr, unsigned long *fdset) | |||
114 | 114 | ||
115 | #define MAX_INT64_SECONDS (((s64)(~((u64)0)>>1)/HZ)-1) | 115 | #define MAX_INT64_SECONDS (((s64)(~((u64)0)>>1)/HZ)-1) |
116 | 116 | ||
117 | extern int do_select(int n, fd_set_bits *fds, s64 *timeout); | 117 | extern int do_select(int n, fd_set_bits *fds, struct timespec *end_time); |
118 | extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds, | 118 | extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds, |
119 | s64 *timeout); | 119 | struct timespec *end_time); |
120 | extern int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp, | 120 | extern int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp, |
121 | fd_set __user *exp, s64 *timeout); | 121 | fd_set __user *exp, struct timespec *end_time); |
122 | |||
123 | extern int poll_select_set_timeout(struct timespec *to, long sec, long nsec); | ||
122 | 124 | ||
123 | #endif /* KERNEL */ | 125 | #endif /* KERNEL */ |
124 | 126 | ||
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index a7dd38f30ade..a7c721355549 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h | |||
@@ -45,8 +45,6 @@ struct k_itimer { | |||
45 | int it_requeue_pending; /* waiting to requeue this timer */ | 45 | int it_requeue_pending; /* waiting to requeue this timer */ |
46 | #define REQUEUE_PENDING 1 | 46 | #define REQUEUE_PENDING 1 |
47 | int it_sigev_notify; /* notify word of sigevent struct */ | 47 | int it_sigev_notify; /* notify word of sigevent struct */ |
48 | int it_sigev_signo; /* signo word of sigevent struct */ | ||
49 | sigval_t it_sigev_value; /* value word of sigevent struct */ | ||
50 | struct task_struct *it_process; /* process to send signal to */ | 48 | struct task_struct *it_process; /* process to send signal to */ |
51 | struct sigqueue *sigq; /* signal queue entry. */ | 49 | struct sigqueue *sigq; /* signal queue entry. */ |
52 | union { | 50 | union { |
@@ -115,4 +113,6 @@ void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx, | |||
115 | 113 | ||
116 | long clock_nanosleep_restart(struct restart_block *restart_block); | 114 | long clock_nanosleep_restart(struct restart_block *restart_block); |
117 | 115 | ||
116 | void update_rlimit_cpu(unsigned long rlim_new); | ||
117 | |||
118 | #endif | 118 | #endif |
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index ea96ead1d39d..f9348cba6dc1 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
@@ -165,6 +165,12 @@ struct power_supply_info { | |||
165 | extern void power_supply_changed(struct power_supply *psy); | 165 | extern void power_supply_changed(struct power_supply *psy); |
166 | extern int power_supply_am_i_supplied(struct power_supply *psy); | 166 | extern int power_supply_am_i_supplied(struct power_supply *psy); |
167 | 167 | ||
168 | #if defined(CONFIG_POWER_SUPPLY) || defined(CONFIG_POWER_SUPPLY_MODULE) | ||
169 | extern int power_supply_is_system_supplied(void); | ||
170 | #else | ||
171 | static inline int power_supply_is_system_supplied(void) { return -ENOSYS; } | ||
172 | #endif | ||
173 | |||
168 | extern int power_supply_register(struct device *parent, | 174 | extern int power_supply_register(struct device *parent, |
169 | struct power_supply *psy); | 175 | struct power_supply *psy); |
170 | extern void power_supply_unregister(struct power_supply *psy); | 176 | extern void power_supply_unregister(struct power_supply *psy); |
diff --git a/include/linux/prctl.h b/include/linux/prctl.h index 5ad79198d6f9..48d887e3c6e7 100644 --- a/include/linux/prctl.h +++ b/include/linux/prctl.h | |||
@@ -78,4 +78,11 @@ | |||
78 | #define PR_GET_SECUREBITS 27 | 78 | #define PR_GET_SECUREBITS 27 |
79 | #define PR_SET_SECUREBITS 28 | 79 | #define PR_SET_SECUREBITS 28 |
80 | 80 | ||
81 | /* | ||
82 | * Get/set the timerslack as used by poll/select/nanosleep | ||
83 | * A value of 0 means "use default" | ||
84 | */ | ||
85 | #define PR_SET_TIMERSLACK 29 | ||
86 | #define PR_GET_TIMERSLACK 30 | ||
87 | |||
81 | #endif /* _LINUX_PRCTL_H */ | 88 | #endif /* _LINUX_PRCTL_H */ |
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index fb61850d1cfc..b8bdb96eff78 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -97,12 +97,9 @@ struct vmcore { | |||
97 | 97 | ||
98 | #ifdef CONFIG_PROC_FS | 98 | #ifdef CONFIG_PROC_FS |
99 | 99 | ||
100 | extern struct proc_dir_entry *proc_root_kcore; | ||
101 | |||
102 | extern spinlock_t proc_subdir_lock; | 100 | extern spinlock_t proc_subdir_lock; |
103 | 101 | ||
104 | extern void proc_root_init(void); | 102 | extern void proc_root_init(void); |
105 | extern void proc_misc_init(void); | ||
106 | 103 | ||
107 | void proc_flush_task(struct task_struct *task); | 104 | void proc_flush_task(struct task_struct *task); |
108 | struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *); | 105 | struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *); |
@@ -138,9 +135,6 @@ extern struct inode *proc_get_inode(struct super_block *, unsigned int, struct p | |||
138 | extern int proc_readdir(struct file *, void *, filldir_t); | 135 | extern int proc_readdir(struct file *, void *, filldir_t); |
139 | extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *); | 136 | extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *); |
140 | 137 | ||
141 | extern const struct file_operations proc_kcore_operations; | ||
142 | extern const struct file_operations ppc_htab_operations; | ||
143 | |||
144 | extern int pid_ns_prepare_proc(struct pid_namespace *ns); | 138 | extern int pid_ns_prepare_proc(struct pid_namespace *ns); |
145 | extern void pid_ns_release_proc(struct pid_namespace *ns); | 139 | extern void pid_ns_release_proc(struct pid_namespace *ns); |
146 | 140 | ||
diff --git a/include/linux/profile.h b/include/linux/profile.h index 7e7087239af5..a0fc32279fc0 100644 --- a/include/linux/profile.h +++ b/include/linux/profile.h | |||
@@ -19,10 +19,16 @@ struct notifier_block; | |||
19 | 19 | ||
20 | #if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS) | 20 | #if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS) |
21 | void create_prof_cpu_mask(struct proc_dir_entry *de); | 21 | void create_prof_cpu_mask(struct proc_dir_entry *de); |
22 | int create_proc_profile(void); | ||
22 | #else | 23 | #else |
23 | static inline void create_prof_cpu_mask(struct proc_dir_entry *de) | 24 | static inline void create_prof_cpu_mask(struct proc_dir_entry *de) |
24 | { | 25 | { |
25 | } | 26 | } |
27 | |||
28 | static inline int create_proc_profile(void) | ||
29 | { | ||
30 | return 0; | ||
31 | } | ||
26 | #endif | 32 | #endif |
27 | 33 | ||
28 | enum profile_type { | 34 | enum profile_type { |
@@ -35,7 +41,8 @@ enum profile_type { | |||
35 | extern int prof_on __read_mostly; | 41 | extern int prof_on __read_mostly; |
36 | 42 | ||
37 | /* init basic kernel profiler */ | 43 | /* init basic kernel profiler */ |
38 | void __init profile_init(void); | 44 | int profile_init(void); |
45 | int profile_setup(char *str); | ||
39 | void profile_tick(int type); | 46 | void profile_tick(int type); |
40 | 47 | ||
41 | /* | 48 | /* |
@@ -84,9 +91,9 @@ struct pt_regs; | |||
84 | 91 | ||
85 | #define prof_on 0 | 92 | #define prof_on 0 |
86 | 93 | ||
87 | static inline void profile_init(void) | 94 | static inline int profile_init(void) |
88 | { | 95 | { |
89 | return; | 96 | return 0; |
90 | } | 97 | } |
91 | 98 | ||
92 | static inline void profile_tick(int type) | 99 | static inline void profile_tick(int type) |
diff --git a/include/linux/proportions.h b/include/linux/proportions.h index 5afc1b23346d..cf793bbbd05e 100644 --- a/include/linux/proportions.h +++ b/include/linux/proportions.h | |||
@@ -104,8 +104,8 @@ struct prop_local_single { | |||
104 | * snapshot of the last seen global state | 104 | * snapshot of the last seen global state |
105 | * and a lock protecting this state | 105 | * and a lock protecting this state |
106 | */ | 106 | */ |
107 | int shift; | ||
108 | unsigned long period; | 107 | unsigned long period; |
108 | int shift; | ||
109 | spinlock_t lock; /* protect the snapshot state */ | 109 | spinlock_t lock; /* protect the snapshot state */ |
110 | }; | 110 | }; |
111 | 111 | ||
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index ea7416c901d1..22641d5d45df 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
@@ -94,7 +94,6 @@ extern void ptrace_notify(int exit_code); | |||
94 | extern void __ptrace_link(struct task_struct *child, | 94 | extern void __ptrace_link(struct task_struct *child, |
95 | struct task_struct *new_parent); | 95 | struct task_struct *new_parent); |
96 | extern void __ptrace_unlink(struct task_struct *child); | 96 | extern void __ptrace_unlink(struct task_struct *child); |
97 | extern void ptrace_untrace(struct task_struct *child); | ||
98 | #define PTRACE_MODE_READ 1 | 97 | #define PTRACE_MODE_READ 1 |
99 | #define PTRACE_MODE_ATTACH 2 | 98 | #define PTRACE_MODE_ATTACH 2 |
100 | /* Returns 0 on success, -errno on denial. */ | 99 | /* Returns 0 on success, -errno on denial. */ |
diff --git a/include/linux/quota.h b/include/linux/quota.h index 376a05048bc5..40401b554484 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
@@ -28,8 +28,6 @@ | |||
28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
30 | * SUCH DAMAGE. | 30 | * SUCH DAMAGE. |
31 | * | ||
32 | * Version: $Id: quota.h,v 2.0 1996/11/17 16:48:14 mvw Exp mvw $ | ||
33 | */ | 31 | */ |
34 | 32 | ||
35 | #ifndef _LINUX_QUOTA_ | 33 | #ifndef _LINUX_QUOTA_ |
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index ca6b9b5c8d52..a558a4c1d35a 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -3,9 +3,6 @@ | |||
3 | * macros expand to the right source-code. | 3 | * macros expand to the right source-code. |
4 | * | 4 | * |
5 | * Author: Marco van Wieringen <mvw@planets.elm.net> | 5 | * Author: Marco van Wieringen <mvw@planets.elm.net> |
6 | * | ||
7 | * Version: $Id: quotaops.h,v 1.2 1998/01/15 16:22:26 ecd Exp $ | ||
8 | * | ||
9 | */ | 6 | */ |
10 | #ifndef _LINUX_QUOTAOPS_ | 7 | #ifndef _LINUX_QUOTAOPS_ |
11 | #define _LINUX_QUOTAOPS_ | 8 | #define _LINUX_QUOTAOPS_ |
diff --git a/include/linux/raid/linear.h b/include/linux/raid/linear.h index 7e375111d007..f38b9c586afb 100644 --- a/include/linux/raid/linear.h +++ b/include/linux/raid/linear.h | |||
@@ -5,8 +5,8 @@ | |||
5 | 5 | ||
6 | struct dev_info { | 6 | struct dev_info { |
7 | mdk_rdev_t *rdev; | 7 | mdk_rdev_t *rdev; |
8 | sector_t size; | 8 | sector_t num_sectors; |
9 | sector_t offset; | 9 | sector_t start_sector; |
10 | }; | 10 | }; |
11 | 11 | ||
12 | typedef struct dev_info dev_info_t; | 12 | typedef struct dev_info dev_info_t; |
@@ -15,9 +15,11 @@ struct linear_private_data | |||
15 | { | 15 | { |
16 | struct linear_private_data *prev; /* earlier version */ | 16 | struct linear_private_data *prev; /* earlier version */ |
17 | dev_info_t **hash_table; | 17 | dev_info_t **hash_table; |
18 | sector_t hash_spacing; | 18 | sector_t spacing; |
19 | sector_t array_sectors; | 19 | sector_t array_sectors; |
20 | int preshift; /* shift before dividing by hash_spacing */ | 20 | int sector_shift; /* shift before dividing |
21 | * by spacing | ||
22 | */ | ||
21 | dev_info_t disks[0]; | 23 | dev_info_t disks[0]; |
22 | }; | 24 | }; |
23 | 25 | ||
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h index dc0e3fcb9f28..82bea14cae1a 100644 --- a/include/linux/raid/md.h +++ b/include/linux/raid/md.h | |||
@@ -19,27 +19,7 @@ | |||
19 | #define _MD_H | 19 | #define _MD_H |
20 | 20 | ||
21 | #include <linux/blkdev.h> | 21 | #include <linux/blkdev.h> |
22 | #include <linux/major.h> | ||
23 | #include <linux/ioctl.h> | ||
24 | #include <linux/types.h> | ||
25 | #include <linux/bitops.h> | ||
26 | #include <linux/module.h> | ||
27 | #include <linux/hdreg.h> | ||
28 | #include <linux/proc_fs.h> | ||
29 | #include <linux/seq_file.h> | 22 | #include <linux/seq_file.h> |
30 | #include <linux/smp_lock.h> | ||
31 | #include <linux/delay.h> | ||
32 | #include <net/checksum.h> | ||
33 | #include <linux/random.h> | ||
34 | #include <linux/kernel_stat.h> | ||
35 | #include <asm/io.h> | ||
36 | #include <linux/completion.h> | ||
37 | #include <linux/mempool.h> | ||
38 | #include <linux/list.h> | ||
39 | #include <linux/reboot.h> | ||
40 | #include <linux/vmalloc.h> | ||
41 | #include <linux/blkpg.h> | ||
42 | #include <linux/bio.h> | ||
43 | 23 | ||
44 | /* | 24 | /* |
45 | * 'md_p.h' holds the 'physical' layout of RAID devices | 25 | * 'md_p.h' holds the 'physical' layout of RAID devices |
@@ -74,19 +54,17 @@ | |||
74 | 54 | ||
75 | extern int mdp_major; | 55 | extern int mdp_major; |
76 | 56 | ||
77 | extern int register_md_personality (struct mdk_personality *p); | 57 | extern int register_md_personality(struct mdk_personality *p); |
78 | extern int unregister_md_personality (struct mdk_personality *p); | 58 | extern int unregister_md_personality(struct mdk_personality *p); |
79 | extern mdk_thread_t * md_register_thread (void (*run) (mddev_t *mddev), | 59 | extern mdk_thread_t * md_register_thread(void (*run) (mddev_t *mddev), |
80 | mddev_t *mddev, const char *name); | 60 | mddev_t *mddev, const char *name); |
81 | extern void md_unregister_thread (mdk_thread_t *thread); | 61 | extern void md_unregister_thread(mdk_thread_t *thread); |
82 | extern void md_wakeup_thread(mdk_thread_t *thread); | 62 | extern void md_wakeup_thread(mdk_thread_t *thread); |
83 | extern void md_check_recovery(mddev_t *mddev); | 63 | extern void md_check_recovery(mddev_t *mddev); |
84 | extern void md_write_start(mddev_t *mddev, struct bio *bi); | 64 | extern void md_write_start(mddev_t *mddev, struct bio *bi); |
85 | extern void md_write_end(mddev_t *mddev); | 65 | extern void md_write_end(mddev_t *mddev); |
86 | extern void md_handle_safemode(mddev_t *mddev); | ||
87 | extern void md_done_sync(mddev_t *mddev, int blocks, int ok); | 66 | extern void md_done_sync(mddev_t *mddev, int blocks, int ok); |
88 | extern void md_error (mddev_t *mddev, mdk_rdev_t *rdev); | 67 | extern void md_error(mddev_t *mddev, mdk_rdev_t *rdev); |
89 | extern void md_unplug_mddev(mddev_t *mddev); | ||
90 | 68 | ||
91 | extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, | 69 | extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, |
92 | sector_t sector, int size, struct page *page); | 70 | sector_t sector, int size, struct page *page); |
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index c200b9a34aff..8fc909ef6787 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h | |||
@@ -115,6 +115,9 @@ struct mdk_rdev_s | |||
115 | * in superblock. | 115 | * in superblock. |
116 | */ | 116 | */ |
117 | struct work_struct del_work; /* used for delayed sysfs removal */ | 117 | struct work_struct del_work; /* used for delayed sysfs removal */ |
118 | |||
119 | struct sysfs_dirent *sysfs_state; /* handle for 'state' | ||
120 | * sysfs entry */ | ||
118 | }; | 121 | }; |
119 | 122 | ||
120 | struct mddev_s | 123 | struct mddev_s |
@@ -128,7 +131,6 @@ struct mddev_s | |||
128 | #define MD_CHANGE_DEVS 0 /* Some device status has changed */ | 131 | #define MD_CHANGE_DEVS 0 /* Some device status has changed */ |
129 | #define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */ | 132 | #define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */ |
130 | #define MD_CHANGE_PENDING 2 /* superblock update in progress */ | 133 | #define MD_CHANGE_PENDING 2 /* superblock update in progress */ |
131 | #define MD_NOTIFY_ARRAY_STATE 3 /* atomic context wants to notify userspace */ | ||
132 | 134 | ||
133 | int ro; | 135 | int ro; |
134 | 136 | ||
@@ -239,6 +241,10 @@ struct mddev_s | |||
239 | sector_t resync_max; /* resync should pause | 241 | sector_t resync_max; /* resync should pause |
240 | * when it gets here */ | 242 | * when it gets here */ |
241 | 243 | ||
244 | struct sysfs_dirent *sysfs_state; /* handle for 'array_state' | ||
245 | * file in sysfs. | ||
246 | */ | ||
247 | |||
242 | spinlock_t write_lock; | 248 | spinlock_t write_lock; |
243 | wait_queue_head_t sb_wait; /* for waiting on superblock updates */ | 249 | wait_queue_head_t sb_wait; /* for waiting on superblock updates */ |
244 | atomic_t pending_writes; /* number of active superblock writes */ | 250 | atomic_t pending_writes; /* number of active superblock writes */ |
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h index b160fb18e8d6..37aaf2b39863 100644 --- a/include/linux/ramfs.h +++ b/include/linux/ramfs.h | |||
@@ -6,6 +6,7 @@ extern int ramfs_get_sb(struct file_system_type *fs_type, | |||
6 | int flags, const char *dev_name, void *data, struct vfsmount *mnt); | 6 | int flags, const char *dev_name, void *data, struct vfsmount *mnt); |
7 | 7 | ||
8 | #ifndef CONFIG_MMU | 8 | #ifndef CONFIG_MMU |
9 | extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize); | ||
9 | extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file, | 10 | extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file, |
10 | unsigned long addr, | 11 | unsigned long addr, |
11 | unsigned long len, | 12 | unsigned long len, |
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h index 18a5b9ba9d40..00044b856453 100644 --- a/include/linux/ratelimit.h +++ b/include/linux/ratelimit.h | |||
@@ -17,11 +17,4 @@ struct ratelimit_state { | |||
17 | struct ratelimit_state name = {interval, burst,} | 17 | struct ratelimit_state name = {interval, burst,} |
18 | 18 | ||
19 | extern int __ratelimit(struct ratelimit_state *rs); | 19 | extern int __ratelimit(struct ratelimit_state *rs); |
20 | |||
21 | static inline int ratelimit(void) | ||
22 | { | ||
23 | static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL, | ||
24 | DEFAULT_RATELIMIT_BURST); | ||
25 | return __ratelimit(&rs); | ||
26 | } | ||
27 | #endif | 20 | #endif |
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h index 4ab843622727..5f89b62e6983 100644 --- a/include/linux/rcuclassic.h +++ b/include/linux/rcuclassic.h | |||
@@ -40,12 +40,21 @@ | |||
40 | #include <linux/cpumask.h> | 40 | #include <linux/cpumask.h> |
41 | #include <linux/seqlock.h> | 41 | #include <linux/seqlock.h> |
42 | 42 | ||
43 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR | ||
44 | #define RCU_SECONDS_TILL_STALL_CHECK ( 3 * HZ) /* for rcp->jiffies_stall */ | ||
45 | #define RCU_SECONDS_TILL_STALL_RECHECK (30 * HZ) /* for rcp->jiffies_stall */ | ||
46 | #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ | ||
43 | 47 | ||
44 | /* Global control variables for rcupdate callback mechanism. */ | 48 | /* Global control variables for rcupdate callback mechanism. */ |
45 | struct rcu_ctrlblk { | 49 | struct rcu_ctrlblk { |
46 | long cur; /* Current batch number. */ | 50 | long cur; /* Current batch number. */ |
47 | long completed; /* Number of the last completed batch */ | 51 | long completed; /* Number of the last completed batch */ |
48 | int next_pending; /* Is the next batch already waiting? */ | 52 | long pending; /* Number of the last pending batch */ |
53 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR | ||
54 | unsigned long gp_start; /* Time at which GP started in jiffies. */ | ||
55 | unsigned long jiffies_stall; | ||
56 | /* Time at which to check for CPU stalls. */ | ||
57 | #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ | ||
49 | 58 | ||
50 | int signaled; | 59 | int signaled; |
51 | 60 | ||
@@ -66,11 +75,7 @@ static inline int rcu_batch_after(long a, long b) | |||
66 | return (a - b) > 0; | 75 | return (a - b) > 0; |
67 | } | 76 | } |
68 | 77 | ||
69 | /* | 78 | /* Per-CPU data for Read-Copy UPdate. */ |
70 | * Per-CPU data for Read-Copy UPdate. | ||
71 | * nxtlist - new callbacks are added here | ||
72 | * curlist - current batch for which quiescent cycle started if any | ||
73 | */ | ||
74 | struct rcu_data { | 79 | struct rcu_data { |
75 | /* 1) quiescent state handling : */ | 80 | /* 1) quiescent state handling : */ |
76 | long quiescbatch; /* Batch # for grace period */ | 81 | long quiescbatch; /* Batch # for grace period */ |
@@ -78,12 +83,24 @@ struct rcu_data { | |||
78 | int qs_pending; /* core waits for quiesc state */ | 83 | int qs_pending; /* core waits for quiesc state */ |
79 | 84 | ||
80 | /* 2) batch handling */ | 85 | /* 2) batch handling */ |
81 | long batch; /* Batch # for current RCU batch */ | 86 | /* |
87 | * if nxtlist is not NULL, then: | ||
88 | * batch: | ||
89 | * The batch # for the last entry of nxtlist | ||
90 | * [*nxttail[1], NULL = *nxttail[2]): | ||
91 | * Entries that batch # <= batch | ||
92 | * [*nxttail[0], *nxttail[1]): | ||
93 | * Entries that batch # <= batch - 1 | ||
94 | * [nxtlist, *nxttail[0]): | ||
95 | * Entries that batch # <= batch - 2 | ||
96 | * The grace period for these entries has completed, and | ||
97 | * the other grace-period-completed entries may be moved | ||
98 | * here temporarily in rcu_process_callbacks(). | ||
99 | */ | ||
100 | long batch; | ||
82 | struct rcu_head *nxtlist; | 101 | struct rcu_head *nxtlist; |
83 | struct rcu_head **nxttail; | 102 | struct rcu_head **nxttail[3]; |
84 | long qlen; /* # of queued callbacks */ | 103 | long qlen; /* # of queued callbacks */ |
85 | struct rcu_head *curlist; | ||
86 | struct rcu_head **curtail; | ||
87 | struct rcu_head *donelist; | 104 | struct rcu_head *donelist; |
88 | struct rcu_head **donetail; | 105 | struct rcu_head **donetail; |
89 | long blimit; /* Upper limit on a processed batch */ | 106 | long blimit; /* Upper limit on a processed batch */ |
diff --git a/include/linux/rculist.h b/include/linux/rculist.h index eb4443c7e05b..e649bd3f2c97 100644 --- a/include/linux/rculist.h +++ b/include/linux/rculist.h | |||
@@ -198,20 +198,6 @@ static inline void list_splice_init_rcu(struct list_head *list, | |||
198 | at->prev = last; | 198 | at->prev = last; |
199 | } | 199 | } |
200 | 200 | ||
201 | /** | ||
202 | * list_for_each_rcu - iterate over an rcu-protected list | ||
203 | * @pos: the &struct list_head to use as a loop cursor. | ||
204 | * @head: the head for your list. | ||
205 | * | ||
206 | * This list-traversal primitive may safely run concurrently with | ||
207 | * the _rcu list-mutation primitives such as list_add_rcu() | ||
208 | * as long as the traversal is guarded by rcu_read_lock(). | ||
209 | */ | ||
210 | #define list_for_each_rcu(pos, head) \ | ||
211 | for (pos = rcu_dereference((head)->next); \ | ||
212 | prefetch(pos->next), pos != (head); \ | ||
213 | pos = rcu_dereference(pos->next)) | ||
214 | |||
215 | #define __list_for_each_rcu(pos, head) \ | 201 | #define __list_for_each_rcu(pos, head) \ |
216 | for (pos = rcu_dereference((head)->next); \ | 202 | for (pos = rcu_dereference((head)->next); \ |
217 | pos != (head); \ | 203 | pos != (head); \ |
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index e8b4039cfb2f..86f1f5e43e33 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -133,6 +133,26 @@ struct rcu_head { | |||
133 | #define rcu_read_unlock_bh() __rcu_read_unlock_bh() | 133 | #define rcu_read_unlock_bh() __rcu_read_unlock_bh() |
134 | 134 | ||
135 | /** | 135 | /** |
136 | * rcu_read_lock_sched - mark the beginning of a RCU-classic critical section | ||
137 | * | ||
138 | * Should be used with either | ||
139 | * - synchronize_sched() | ||
140 | * or | ||
141 | * - call_rcu_sched() and rcu_barrier_sched() | ||
142 | * on the write-side to insure proper synchronization. | ||
143 | */ | ||
144 | #define rcu_read_lock_sched() preempt_disable() | ||
145 | |||
146 | /* | ||
147 | * rcu_read_unlock_sched - marks the end of a RCU-classic critical section | ||
148 | * | ||
149 | * See rcu_read_lock_sched for more information. | ||
150 | */ | ||
151 | #define rcu_read_unlock_sched() preempt_enable() | ||
152 | |||
153 | |||
154 | |||
155 | /** | ||
136 | * rcu_dereference - fetch an RCU-protected pointer in an | 156 | * rcu_dereference - fetch an RCU-protected pointer in an |
137 | * RCU read-side critical section. This pointer may later | 157 | * RCU read-side critical section. This pointer may later |
138 | * be safely dereferenced. | 158 | * be safely dereferenced. |
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h index 0967f03b0705..3e05c09b54a2 100644 --- a/include/linux/rcupreempt.h +++ b/include/linux/rcupreempt.h | |||
@@ -57,7 +57,13 @@ static inline void rcu_qsctr_inc(int cpu) | |||
57 | rdssp->sched_qs++; | 57 | rdssp->sched_qs++; |
58 | } | 58 | } |
59 | #define rcu_bh_qsctr_inc(cpu) | 59 | #define rcu_bh_qsctr_inc(cpu) |
60 | #define call_rcu_bh(head, rcu) call_rcu(head, rcu) | 60 | |
61 | /* | ||
62 | * Someone might want to pass call_rcu_bh as a function pointer. | ||
63 | * So this needs to just be a rename and not a macro function. | ||
64 | * (no parentheses) | ||
65 | */ | ||
66 | #define call_rcu_bh call_rcu | ||
61 | 67 | ||
62 | /** | 68 | /** |
63 | * call_rcu_sched - Queue RCU callback for invocation after sched grace period. | 69 | * call_rcu_sched - Queue RCU callback for invocation after sched grace period. |
@@ -111,7 +117,6 @@ extern struct rcupreempt_trace *rcupreempt_trace_cpu(int cpu); | |||
111 | struct softirq_action; | 117 | struct softirq_action; |
112 | 118 | ||
113 | #ifdef CONFIG_NO_HZ | 119 | #ifdef CONFIG_NO_HZ |
114 | DECLARE_PER_CPU(struct rcu_dyntick_sched, rcu_dyntick_sched); | ||
115 | 120 | ||
116 | static inline void rcu_enter_nohz(void) | 121 | static inline void rcu_enter_nohz(void) |
117 | { | 122 | { |
@@ -126,8 +131,8 @@ static inline void rcu_exit_nohz(void) | |||
126 | { | 131 | { |
127 | static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1); | 132 | static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1); |
128 | 133 | ||
129 | smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */ | ||
130 | __get_cpu_var(rcu_dyntick_sched).dynticks++; | 134 | __get_cpu_var(rcu_dyntick_sched).dynticks++; |
135 | smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */ | ||
131 | WARN_ON_RATELIMIT(!(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1), | 136 | WARN_ON_RATELIMIT(!(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1), |
132 | &rs); | 137 | &rs); |
133 | } | 138 | } |
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 1d712c7172a2..e37d80561985 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h | |||
@@ -18,8 +18,8 @@ | |||
18 | #include <linux/device.h> | 18 | #include <linux/device.h> |
19 | #include <linux/regulator/consumer.h> | 19 | #include <linux/regulator/consumer.h> |
20 | 20 | ||
21 | struct regulator_constraints; | ||
22 | struct regulator_dev; | 21 | struct regulator_dev; |
22 | struct regulator_init_data; | ||
23 | 23 | ||
24 | /** | 24 | /** |
25 | * struct regulator_ops - regulator operations. | 25 | * struct regulator_ops - regulator operations. |
@@ -51,7 +51,7 @@ struct regulator_ops { | |||
51 | int output_uV, int load_uA); | 51 | int output_uV, int load_uA); |
52 | 52 | ||
53 | /* the operations below are for configuration of regulator state when | 53 | /* the operations below are for configuration of regulator state when |
54 | * it's parent PMIC enters a global STANBY/HIBERNATE state */ | 54 | * its parent PMIC enters a global STANDBY/HIBERNATE state */ |
55 | 55 | ||
56 | /* set regulator suspend voltage */ | 56 | /* set regulator suspend voltage */ |
57 | int (*set_suspend_voltage) (struct regulator_dev *, int uV); | 57 | int (*set_suspend_voltage) (struct regulator_dev *, int uV); |
@@ -85,15 +85,17 @@ struct regulator_desc { | |||
85 | struct module *owner; | 85 | struct module *owner; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | |||
89 | struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, | 88 | struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, |
90 | void *reg_data); | 89 | struct device *dev, void *driver_data); |
91 | void regulator_unregister(struct regulator_dev *rdev); | 90 | void regulator_unregister(struct regulator_dev *rdev); |
92 | 91 | ||
93 | int regulator_notifier_call_chain(struct regulator_dev *rdev, | 92 | int regulator_notifier_call_chain(struct regulator_dev *rdev, |
94 | unsigned long event, void *data); | 93 | unsigned long event, void *data); |
95 | 94 | ||
96 | void *rdev_get_drvdata(struct regulator_dev *rdev); | 95 | void *rdev_get_drvdata(struct regulator_dev *rdev); |
96 | struct device *rdev_get_dev(struct regulator_dev *rdev); | ||
97 | int rdev_get_id(struct regulator_dev *rdev); | 97 | int rdev_get_id(struct regulator_dev *rdev); |
98 | 98 | ||
99 | void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data); | ||
100 | |||
99 | #endif | 101 | #endif |
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index 11e737dbfcf2..c6d69331a81e 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h | |||
@@ -89,15 +89,33 @@ struct regulation_constraints { | |||
89 | unsigned apply_uV:1; /* apply uV constraint iff min == max */ | 89 | unsigned apply_uV:1; /* apply uV constraint iff min == max */ |
90 | }; | 90 | }; |
91 | 91 | ||
92 | int regulator_set_supply(const char *regulator, const char *regulator_supply); | 92 | /** |
93 | * struct regulator_consumer_supply - supply -> device mapping | ||
94 | * | ||
95 | * This maps a supply name to a device. | ||
96 | */ | ||
97 | struct regulator_consumer_supply { | ||
98 | struct device *dev; /* consumer */ | ||
99 | const char *supply; /* consumer supply - e.g. "vcc" */ | ||
100 | }; | ||
93 | 101 | ||
94 | const char *regulator_get_supply(const char *regulator); | 102 | /** |
103 | * struct regulator_init_data - regulator platform initialisation data. | ||
104 | * | ||
105 | * Initialisation constraints, our supply and consumers supplies. | ||
106 | */ | ||
107 | struct regulator_init_data { | ||
108 | struct device *supply_regulator_dev; /* or NULL for LINE */ | ||
95 | 109 | ||
96 | int regulator_set_machine_constraints(const char *regulator, | 110 | struct regulation_constraints constraints; |
97 | struct regulation_constraints *constraints); | ||
98 | 111 | ||
99 | int regulator_set_device_supply(const char *regulator, struct device *dev, | 112 | int num_consumer_supplies; |
100 | const char *supply); | 113 | struct regulator_consumer_supply *consumer_supplies; |
114 | |||
115 | /* optional regulator machine specific init */ | ||
116 | int (*regulator_init)(void *driver_data); | ||
117 | void *driver_data; /* core does not touch this */ | ||
118 | }; | ||
101 | 119 | ||
102 | int regulator_suspend_prepare(suspend_state_t state); | 120 | int regulator_suspend_prepare(suspend_state_t state); |
103 | 121 | ||
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index e9963af16cda..bc5114d35e99 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -87,7 +87,7 @@ void reiserfs_warning(struct super_block *s, const char *fmt, ...); | |||
87 | if( !( cond ) ) \ | 87 | if( !( cond ) ) \ |
88 | reiserfs_panic( NULL, "reiserfs[%i]: assertion " scond " failed at " \ | 88 | reiserfs_panic( NULL, "reiserfs[%i]: assertion " scond " failed at " \ |
89 | __FILE__ ":%i:%s: " format "\n", \ | 89 | __FILE__ ":%i:%s: " format "\n", \ |
90 | in_interrupt() ? -1 : task_pid_nr(current), __LINE__ , __FUNCTION__ , ##args ) | 90 | in_interrupt() ? -1 : task_pid_nr(current), __LINE__ , __func__ , ##args ) |
91 | 91 | ||
92 | #define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args) | 92 | #define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args) |
93 | 93 | ||
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h index 315517e8bfa1..bda6b562a1e0 100644 --- a/include/linux/reiserfs_fs_sb.h +++ b/include/linux/reiserfs_fs_sb.h | |||
@@ -178,6 +178,7 @@ struct reiserfs_journal { | |||
178 | struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */ | 178 | struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */ |
179 | 179 | ||
180 | struct block_device *j_dev_bd; | 180 | struct block_device *j_dev_bd; |
181 | fmode_t j_dev_mode; | ||
181 | int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ | 182 | int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ |
182 | 183 | ||
183 | unsigned long j_state; | 184 | unsigned long j_state; |
diff --git a/include/linux/resource.h b/include/linux/resource.h index aaa423a6f3d9..40fc7e626082 100644 --- a/include/linux/resource.h +++ b/include/linux/resource.h | |||
@@ -59,10 +59,10 @@ struct rlimit { | |||
59 | #define _STK_LIM (8*1024*1024) | 59 | #define _STK_LIM (8*1024*1024) |
60 | 60 | ||
61 | /* | 61 | /* |
62 | * GPG wants 32kB of mlocked memory, to make sure pass phrases | 62 | * GPG2 wants 64kB of mlocked memory, to make sure pass phrases |
63 | * and other sensitive information are never written to disk. | 63 | * and other sensitive information are never written to disk. |
64 | */ | 64 | */ |
65 | #define MLOCK_LIMIT (8 * PAGE_SIZE) | 65 | #define MLOCK_LIMIT ((PAGE_SIZE > 64*1024) ? PAGE_SIZE : 64*1024) |
66 | 66 | ||
67 | /* | 67 | /* |
68 | * Due to binary compatibility, the actual resource numbers | 68 | * Due to binary compatibility, the actual resource numbers |
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h index 741d1a62cc3f..4cd64b0d9825 100644 --- a/include/linux/rfkill.h +++ b/include/linux/rfkill.h | |||
@@ -49,6 +49,7 @@ enum rfkill_state { | |||
49 | RFKILL_STATE_SOFT_BLOCKED = 0, /* Radio output blocked */ | 49 | RFKILL_STATE_SOFT_BLOCKED = 0, /* Radio output blocked */ |
50 | RFKILL_STATE_UNBLOCKED = 1, /* Radio output allowed */ | 50 | RFKILL_STATE_UNBLOCKED = 1, /* Radio output allowed */ |
51 | RFKILL_STATE_HARD_BLOCKED = 2, /* Output blocked, non-overrideable */ | 51 | RFKILL_STATE_HARD_BLOCKED = 2, /* Output blocked, non-overrideable */ |
52 | RFKILL_STATE_MAX, /* marker for last valid state */ | ||
52 | }; | 53 | }; |
53 | 54 | ||
54 | /* | 55 | /* |
@@ -110,12 +111,14 @@ struct rfkill { | |||
110 | }; | 111 | }; |
111 | #define to_rfkill(d) container_of(d, struct rfkill, dev) | 112 | #define to_rfkill(d) container_of(d, struct rfkill, dev) |
112 | 113 | ||
113 | struct rfkill *rfkill_allocate(struct device *parent, enum rfkill_type type); | 114 | struct rfkill * __must_check rfkill_allocate(struct device *parent, |
115 | enum rfkill_type type); | ||
114 | void rfkill_free(struct rfkill *rfkill); | 116 | void rfkill_free(struct rfkill *rfkill); |
115 | int rfkill_register(struct rfkill *rfkill); | 117 | int __must_check rfkill_register(struct rfkill *rfkill); |
116 | void rfkill_unregister(struct rfkill *rfkill); | 118 | void rfkill_unregister(struct rfkill *rfkill); |
117 | 119 | ||
118 | int rfkill_force_state(struct rfkill *rfkill, enum rfkill_state state); | 120 | int rfkill_force_state(struct rfkill *rfkill, enum rfkill_state state); |
121 | int rfkill_set_default(enum rfkill_type type, enum rfkill_state state); | ||
119 | 122 | ||
120 | /** | 123 | /** |
121 | * rfkill_state_complement - return complementar state | 124 | * rfkill_state_complement - return complementar state |
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h new file mode 100644 index 000000000000..e097c2e6b6dc --- /dev/null +++ b/include/linux/ring_buffer.h | |||
@@ -0,0 +1,130 @@ | |||
1 | #ifndef _LINUX_RING_BUFFER_H | ||
2 | #define _LINUX_RING_BUFFER_H | ||
3 | |||
4 | #include <linux/mm.h> | ||
5 | #include <linux/seq_file.h> | ||
6 | |||
7 | struct ring_buffer; | ||
8 | struct ring_buffer_iter; | ||
9 | |||
10 | /* | ||
11 | * Don't reference this struct directly, use functions below. | ||
12 | */ | ||
13 | struct ring_buffer_event { | ||
14 | u32 type:2, len:3, time_delta:27; | ||
15 | u32 array[]; | ||
16 | }; | ||
17 | |||
18 | /** | ||
19 | * enum ring_buffer_type - internal ring buffer types | ||
20 | * | ||
21 | * @RINGBUF_TYPE_PADDING: Left over page padding | ||
22 | * array is ignored | ||
23 | * size is variable depending on how much | ||
24 | * padding is needed | ||
25 | * | ||
26 | * @RINGBUF_TYPE_TIME_EXTEND: Extend the time delta | ||
27 | * array[0] = time delta (28 .. 59) | ||
28 | * size = 8 bytes | ||
29 | * | ||
30 | * @RINGBUF_TYPE_TIME_STAMP: Sync time stamp with external clock | ||
31 | * array[0] = tv_nsec | ||
32 | * array[1] = tv_sec | ||
33 | * size = 16 bytes | ||
34 | * | ||
35 | * @RINGBUF_TYPE_DATA: Data record | ||
36 | * If len is zero: | ||
37 | * array[0] holds the actual length | ||
38 | * array[1..(length+3)/4-1] holds data | ||
39 | * else | ||
40 | * length = len << 2 | ||
41 | * array[0..(length+3)/4] holds data | ||
42 | */ | ||
43 | enum ring_buffer_type { | ||
44 | RINGBUF_TYPE_PADDING, | ||
45 | RINGBUF_TYPE_TIME_EXTEND, | ||
46 | /* FIXME: RINGBUF_TYPE_TIME_STAMP not implemented */ | ||
47 | RINGBUF_TYPE_TIME_STAMP, | ||
48 | RINGBUF_TYPE_DATA, | ||
49 | }; | ||
50 | |||
51 | unsigned ring_buffer_event_length(struct ring_buffer_event *event); | ||
52 | void *ring_buffer_event_data(struct ring_buffer_event *event); | ||
53 | |||
54 | /** | ||
55 | * ring_buffer_event_time_delta - return the delta timestamp of the event | ||
56 | * @event: the event to get the delta timestamp of | ||
57 | * | ||
58 | * The delta timestamp is the 27 bit timestamp since the last event. | ||
59 | */ | ||
60 | static inline unsigned | ||
61 | ring_buffer_event_time_delta(struct ring_buffer_event *event) | ||
62 | { | ||
63 | return event->time_delta; | ||
64 | } | ||
65 | |||
66 | /* | ||
67 | * size is in bytes for each per CPU buffer. | ||
68 | */ | ||
69 | struct ring_buffer * | ||
70 | ring_buffer_alloc(unsigned long size, unsigned flags); | ||
71 | void ring_buffer_free(struct ring_buffer *buffer); | ||
72 | |||
73 | int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size); | ||
74 | |||
75 | struct ring_buffer_event * | ||
76 | ring_buffer_lock_reserve(struct ring_buffer *buffer, | ||
77 | unsigned long length, | ||
78 | unsigned long *flags); | ||
79 | int ring_buffer_unlock_commit(struct ring_buffer *buffer, | ||
80 | struct ring_buffer_event *event, | ||
81 | unsigned long flags); | ||
82 | int ring_buffer_write(struct ring_buffer *buffer, | ||
83 | unsigned long length, void *data); | ||
84 | |||
85 | struct ring_buffer_event * | ||
86 | ring_buffer_peek(struct ring_buffer *buffer, int cpu, u64 *ts); | ||
87 | struct ring_buffer_event * | ||
88 | ring_buffer_consume(struct ring_buffer *buffer, int cpu, u64 *ts); | ||
89 | |||
90 | struct ring_buffer_iter * | ||
91 | ring_buffer_read_start(struct ring_buffer *buffer, int cpu); | ||
92 | void ring_buffer_read_finish(struct ring_buffer_iter *iter); | ||
93 | |||
94 | struct ring_buffer_event * | ||
95 | ring_buffer_iter_peek(struct ring_buffer_iter *iter, u64 *ts); | ||
96 | struct ring_buffer_event * | ||
97 | ring_buffer_read(struct ring_buffer_iter *iter, u64 *ts); | ||
98 | void ring_buffer_iter_reset(struct ring_buffer_iter *iter); | ||
99 | int ring_buffer_iter_empty(struct ring_buffer_iter *iter); | ||
100 | |||
101 | unsigned long ring_buffer_size(struct ring_buffer *buffer); | ||
102 | |||
103 | void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu); | ||
104 | void ring_buffer_reset(struct ring_buffer *buffer); | ||
105 | |||
106 | int ring_buffer_swap_cpu(struct ring_buffer *buffer_a, | ||
107 | struct ring_buffer *buffer_b, int cpu); | ||
108 | |||
109 | int ring_buffer_empty(struct ring_buffer *buffer); | ||
110 | int ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu); | ||
111 | |||
112 | void ring_buffer_record_disable(struct ring_buffer *buffer); | ||
113 | void ring_buffer_record_enable(struct ring_buffer *buffer); | ||
114 | void ring_buffer_record_disable_cpu(struct ring_buffer *buffer, int cpu); | ||
115 | void ring_buffer_record_enable_cpu(struct ring_buffer *buffer, int cpu); | ||
116 | |||
117 | unsigned long ring_buffer_entries(struct ring_buffer *buffer); | ||
118 | unsigned long ring_buffer_overruns(struct ring_buffer *buffer); | ||
119 | |||
120 | u64 ring_buffer_time_stamp(int cpu); | ||
121 | void ring_buffer_normalize_time_stamp(int cpu, u64 *ts); | ||
122 | |||
123 | void tracing_on(void); | ||
124 | void tracing_off(void); | ||
125 | |||
126 | enum ring_buffer_flags { | ||
127 | RB_FL_OVERWRITE = 1 << 0, | ||
128 | }; | ||
129 | |||
130 | #endif /* _LINUX_RING_BUFFER_H */ | ||
diff --git a/include/linux/rmap.h b/include/linux/rmap.h index fed6f5e0b411..89f0564b10c8 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h | |||
@@ -39,18 +39,6 @@ struct anon_vma { | |||
39 | 39 | ||
40 | #ifdef CONFIG_MMU | 40 | #ifdef CONFIG_MMU |
41 | 41 | ||
42 | extern struct kmem_cache *anon_vma_cachep; | ||
43 | |||
44 | static inline struct anon_vma *anon_vma_alloc(void) | ||
45 | { | ||
46 | return kmem_cache_alloc(anon_vma_cachep, GFP_KERNEL); | ||
47 | } | ||
48 | |||
49 | static inline void anon_vma_free(struct anon_vma *anon_vma) | ||
50 | { | ||
51 | kmem_cache_free(anon_vma_cachep, anon_vma); | ||
52 | } | ||
53 | |||
54 | static inline void anon_vma_lock(struct vm_area_struct *vma) | 42 | static inline void anon_vma_lock(struct vm_area_struct *vma) |
55 | { | 43 | { |
56 | struct anon_vma *anon_vma = vma->anon_vma; | 44 | struct anon_vma *anon_vma = vma->anon_vma; |
@@ -75,6 +63,9 @@ void anon_vma_unlink(struct vm_area_struct *); | |||
75 | void anon_vma_link(struct vm_area_struct *); | 63 | void anon_vma_link(struct vm_area_struct *); |
76 | void __anon_vma_link(struct vm_area_struct *); | 64 | void __anon_vma_link(struct vm_area_struct *); |
77 | 65 | ||
66 | extern struct anon_vma *page_lock_anon_vma(struct page *page); | ||
67 | extern void page_unlock_anon_vma(struct anon_vma *anon_vma); | ||
68 | |||
78 | /* | 69 | /* |
79 | * rmap interfaces called when adding or removing pte of page | 70 | * rmap interfaces called when adding or removing pte of page |
80 | */ | 71 | */ |
@@ -117,6 +108,19 @@ unsigned long page_address_in_vma(struct page *, struct vm_area_struct *); | |||
117 | */ | 108 | */ |
118 | int page_mkclean(struct page *); | 109 | int page_mkclean(struct page *); |
119 | 110 | ||
111 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
112 | /* | ||
113 | * called in munlock()/munmap() path to check for other vmas holding | ||
114 | * the page mlocked. | ||
115 | */ | ||
116 | int try_to_munlock(struct page *); | ||
117 | #else | ||
118 | static inline int try_to_munlock(struct page *page) | ||
119 | { | ||
120 | return 0; /* a.k.a. SWAP_SUCCESS */ | ||
121 | } | ||
122 | #endif | ||
123 | |||
120 | #else /* !CONFIG_MMU */ | 124 | #else /* !CONFIG_MMU */ |
121 | 125 | ||
122 | #define anon_vma_init() do {} while (0) | 126 | #define anon_vma_init() do {} while (0) |
@@ -140,5 +144,6 @@ static inline int page_mkclean(struct page *page) | |||
140 | #define SWAP_SUCCESS 0 | 144 | #define SWAP_SUCCESS 0 |
141 | #define SWAP_AGAIN 1 | 145 | #define SWAP_AGAIN 1 |
142 | #define SWAP_FAIL 2 | 146 | #define SWAP_FAIL 2 |
147 | #define SWAP_MLOCK 3 | ||
143 | 148 | ||
144 | #endif /* _LINUX_RMAP_H */ | 149 | #endif /* _LINUX_RMAP_H */ |
diff --git a/include/linux/rtc/m48t59.h b/include/linux/rtc/m48t59.h index e8c7c21ceb1f..6fc961459b4a 100644 --- a/include/linux/rtc/m48t59.h +++ b/include/linux/rtc/m48t59.h | |||
@@ -18,40 +18,47 @@ | |||
18 | /* | 18 | /* |
19 | * M48T59 Register Offset | 19 | * M48T59 Register Offset |
20 | */ | 20 | */ |
21 | #define M48T59_YEAR 0x1fff | 21 | #define M48T59_YEAR 0xf |
22 | #define M48T59_MONTH 0x1ffe | 22 | #define M48T59_MONTH 0xe |
23 | #define M48T59_MDAY 0x1ffd /* Day of Month */ | 23 | #define M48T59_MDAY 0xd /* Day of Month */ |
24 | #define M48T59_WDAY 0x1ffc /* Day of Week */ | 24 | #define M48T59_WDAY 0xc /* Day of Week */ |
25 | #define M48T59_WDAY_CB 0x20 /* Century Bit */ | 25 | #define M48T59_WDAY_CB 0x20 /* Century Bit */ |
26 | #define M48T59_WDAY_CEB 0x10 /* Century Enable Bit */ | 26 | #define M48T59_WDAY_CEB 0x10 /* Century Enable Bit */ |
27 | #define M48T59_HOUR 0x1ffb | 27 | #define M48T59_HOUR 0xb |
28 | #define M48T59_MIN 0x1ffa | 28 | #define M48T59_MIN 0xa |
29 | #define M48T59_SEC 0x1ff9 | 29 | #define M48T59_SEC 0x9 |
30 | #define M48T59_CNTL 0x1ff8 | 30 | #define M48T59_CNTL 0x8 |
31 | #define M48T59_CNTL_READ 0x40 | 31 | #define M48T59_CNTL_READ 0x40 |
32 | #define M48T59_CNTL_WRITE 0x80 | 32 | #define M48T59_CNTL_WRITE 0x80 |
33 | #define M48T59_WATCHDOG 0x1ff7 | 33 | #define M48T59_WATCHDOG 0x7 |
34 | #define M48T59_INTR 0x1ff6 | 34 | #define M48T59_INTR 0x6 |
35 | #define M48T59_INTR_AFE 0x80 /* Alarm Interrupt Enable */ | 35 | #define M48T59_INTR_AFE 0x80 /* Alarm Interrupt Enable */ |
36 | #define M48T59_INTR_ABE 0x20 | 36 | #define M48T59_INTR_ABE 0x20 |
37 | #define M48T59_ALARM_DATE 0x1ff5 | 37 | #define M48T59_ALARM_DATE 0x5 |
38 | #define M48T59_ALARM_HOUR 0x1ff4 | 38 | #define M48T59_ALARM_HOUR 0x4 |
39 | #define M48T59_ALARM_MIN 0x1ff3 | 39 | #define M48T59_ALARM_MIN 0x3 |
40 | #define M48T59_ALARM_SEC 0x1ff2 | 40 | #define M48T59_ALARM_SEC 0x2 |
41 | #define M48T59_UNUSED 0x1ff1 | 41 | #define M48T59_UNUSED 0x1 |
42 | #define M48T59_FLAGS 0x1ff0 | 42 | #define M48T59_FLAGS 0x0 |
43 | #define M48T59_FLAGS_WDT 0x80 /* watchdog timer expired */ | 43 | #define M48T59_FLAGS_WDT 0x80 /* watchdog timer expired */ |
44 | #define M48T59_FLAGS_AF 0x40 /* alarm */ | 44 | #define M48T59_FLAGS_AF 0x40 /* alarm */ |
45 | #define M48T59_FLAGS_BF 0x10 /* low battery */ | 45 | #define M48T59_FLAGS_BF 0x10 /* low battery */ |
46 | 46 | ||
47 | #define M48T59_NVRAM_SIZE 0x1ff0 | 47 | #define M48T59RTC_TYPE_M48T59 0 /* to keep compatibility */ |
48 | #define M48T59RTC_TYPE_M48T02 1 | ||
49 | #define M48T59RTC_TYPE_M48T08 2 | ||
48 | 50 | ||
49 | struct m48t59_plat_data { | 51 | struct m48t59_plat_data { |
50 | /* The method to access M48T59 registers, | 52 | /* The method to access M48T59 registers */ |
51 | * NOTE: The 'ofs' should be 0x00~0x1fff | ||
52 | */ | ||
53 | void (*write_byte)(struct device *dev, u32 ofs, u8 val); | 53 | void (*write_byte)(struct device *dev, u32 ofs, u8 val); |
54 | unsigned char (*read_byte)(struct device *dev, u32 ofs); | 54 | unsigned char (*read_byte)(struct device *dev, u32 ofs); |
55 | |||
56 | int type; /* RTC model */ | ||
57 | |||
58 | /* ioaddr mapped externally */ | ||
59 | void __iomem *ioaddr; | ||
60 | /* offset to RTC registers, automatically set according to the type */ | ||
61 | unsigned int offset; | ||
55 | }; | 62 | }; |
56 | 63 | ||
57 | #endif /* _LINUX_RTC_M48T59_H_ */ | 64 | #endif /* _LINUX_RTC_M48T59_H_ */ |
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h index 382bb7951166..f19b00b7d530 100644 --- a/include/linux/rtmutex.h +++ b/include/linux/rtmutex.h | |||
@@ -54,7 +54,7 @@ struct hrtimer_sleeper; | |||
54 | #ifdef CONFIG_DEBUG_RT_MUTEXES | 54 | #ifdef CONFIG_DEBUG_RT_MUTEXES |
55 | # define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \ | 55 | # define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \ |
56 | , .name = #mutexname, .file = __FILE__, .line = __LINE__ | 56 | , .name = #mutexname, .file = __FILE__, .line = __LINE__ |
57 | # define rt_mutex_init(mutex) __rt_mutex_init(mutex, __FUNCTION__) | 57 | # define rt_mutex_init(mutex) __rt_mutex_init(mutex, __func__) |
58 | extern void rt_mutex_debug_task_free(struct task_struct *tsk); | 58 | extern void rt_mutex_debug_task_free(struct task_struct *tsk); |
59 | #else | 59 | #else |
60 | # define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) | 60 | # define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) |
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index ca643b13b026..2b3d51c6ec9c 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -582,6 +582,10 @@ enum rtnetlink_groups { | |||
582 | #define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE | 582 | #define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE |
583 | RTNLGRP_ND_USEROPT, | 583 | RTNLGRP_ND_USEROPT, |
584 | #define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT | 584 | #define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT |
585 | RTNLGRP_PHONET_IFADDR, | ||
586 | #define RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_IFADDR | ||
587 | RTNLGRP_PHONET_ROUTE, | ||
588 | #define RTNLGRP_PHONET_ROUTE RTNLGRP_PHONET_ROUTE | ||
585 | __RTNLGRP_MAX | 589 | __RTNLGRP_MAX |
586 | }; | 590 | }; |
587 | #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) | 591 | #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 3d9120c5ad15..644ffbda17ca 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -247,6 +247,7 @@ extern void init_idle(struct task_struct *idle, int cpu); | |||
247 | extern void init_idle_bootup_task(struct task_struct *idle); | 247 | extern void init_idle_bootup_task(struct task_struct *idle); |
248 | 248 | ||
249 | extern int runqueue_is_locked(void); | 249 | extern int runqueue_is_locked(void); |
250 | extern void task_rq_unlock_wait(struct task_struct *p); | ||
250 | 251 | ||
251 | extern cpumask_t nohz_cpu_mask; | 252 | extern cpumask_t nohz_cpu_mask; |
252 | #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) | 253 | #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) |
@@ -287,7 +288,6 @@ extern void trap_init(void); | |||
287 | extern void account_process_tick(struct task_struct *task, int user); | 288 | extern void account_process_tick(struct task_struct *task, int user); |
288 | extern void update_process_times(int user); | 289 | extern void update_process_times(int user); |
289 | extern void scheduler_tick(void); | 290 | extern void scheduler_tick(void); |
290 | extern void hrtick_resched(void); | ||
291 | 291 | ||
292 | extern void sched_show_task(struct task_struct *p); | 292 | extern void sched_show_task(struct task_struct *p); |
293 | 293 | ||
@@ -352,7 +352,7 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, | |||
352 | extern void arch_unmap_area(struct mm_struct *, unsigned long); | 352 | extern void arch_unmap_area(struct mm_struct *, unsigned long); |
353 | extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); | 353 | extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); |
354 | 354 | ||
355 | #if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS | 355 | #if USE_SPLIT_PTLOCKS |
356 | /* | 356 | /* |
357 | * The mm counters are not protected by its page_table_lock, | 357 | * The mm counters are not protected by its page_table_lock, |
358 | * so must be incremented atomically. | 358 | * so must be incremented atomically. |
@@ -363,7 +363,7 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); | |||
363 | #define inc_mm_counter(mm, member) atomic_long_inc(&(mm)->_##member) | 363 | #define inc_mm_counter(mm, member) atomic_long_inc(&(mm)->_##member) |
364 | #define dec_mm_counter(mm, member) atomic_long_dec(&(mm)->_##member) | 364 | #define dec_mm_counter(mm, member) atomic_long_dec(&(mm)->_##member) |
365 | 365 | ||
366 | #else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ | 366 | #else /* !USE_SPLIT_PTLOCKS */ |
367 | /* | 367 | /* |
368 | * The mm counters are protected by its page_table_lock, | 368 | * The mm counters are protected by its page_table_lock, |
369 | * so can be incremented directly. | 369 | * so can be incremented directly. |
@@ -374,7 +374,7 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); | |||
374 | #define inc_mm_counter(mm, member) (mm)->_##member++ | 374 | #define inc_mm_counter(mm, member) (mm)->_##member++ |
375 | #define dec_mm_counter(mm, member) (mm)->_##member-- | 375 | #define dec_mm_counter(mm, member) (mm)->_##member-- |
376 | 376 | ||
377 | #endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ | 377 | #endif /* !USE_SPLIT_PTLOCKS */ |
378 | 378 | ||
379 | #define get_mm_rss(mm) \ | 379 | #define get_mm_rss(mm) \ |
380 | (get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss)) | 380 | (get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss)) |
@@ -403,12 +403,21 @@ extern int get_dumpable(struct mm_struct *mm); | |||
403 | #define MMF_DUMP_MAPPED_PRIVATE 4 | 403 | #define MMF_DUMP_MAPPED_PRIVATE 4 |
404 | #define MMF_DUMP_MAPPED_SHARED 5 | 404 | #define MMF_DUMP_MAPPED_SHARED 5 |
405 | #define MMF_DUMP_ELF_HEADERS 6 | 405 | #define MMF_DUMP_ELF_HEADERS 6 |
406 | #define MMF_DUMP_HUGETLB_PRIVATE 7 | ||
407 | #define MMF_DUMP_HUGETLB_SHARED 8 | ||
406 | #define MMF_DUMP_FILTER_SHIFT MMF_DUMPABLE_BITS | 408 | #define MMF_DUMP_FILTER_SHIFT MMF_DUMPABLE_BITS |
407 | #define MMF_DUMP_FILTER_BITS 5 | 409 | #define MMF_DUMP_FILTER_BITS 7 |
408 | #define MMF_DUMP_FILTER_MASK \ | 410 | #define MMF_DUMP_FILTER_MASK \ |
409 | (((1 << MMF_DUMP_FILTER_BITS) - 1) << MMF_DUMP_FILTER_SHIFT) | 411 | (((1 << MMF_DUMP_FILTER_BITS) - 1) << MMF_DUMP_FILTER_SHIFT) |
410 | #define MMF_DUMP_FILTER_DEFAULT \ | 412 | #define MMF_DUMP_FILTER_DEFAULT \ |
411 | ((1 << MMF_DUMP_ANON_PRIVATE) | (1 << MMF_DUMP_ANON_SHARED)) | 413 | ((1 << MMF_DUMP_ANON_PRIVATE) | (1 << MMF_DUMP_ANON_SHARED) |\ |
414 | (1 << MMF_DUMP_HUGETLB_PRIVATE) | MMF_DUMP_MASK_DEFAULT_ELF) | ||
415 | |||
416 | #ifdef CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS | ||
417 | # define MMF_DUMP_MASK_DEFAULT_ELF (1 << MMF_DUMP_ELF_HEADERS) | ||
418 | #else | ||
419 | # define MMF_DUMP_MASK_DEFAULT_ELF 0 | ||
420 | #endif | ||
412 | 421 | ||
413 | struct sighand_struct { | 422 | struct sighand_struct { |
414 | atomic_t count; | 423 | atomic_t count; |
@@ -425,6 +434,39 @@ struct pacct_struct { | |||
425 | unsigned long ac_minflt, ac_majflt; | 434 | unsigned long ac_minflt, ac_majflt; |
426 | }; | 435 | }; |
427 | 436 | ||
437 | /** | ||
438 | * struct task_cputime - collected CPU time counts | ||
439 | * @utime: time spent in user mode, in &cputime_t units | ||
440 | * @stime: time spent in kernel mode, in &cputime_t units | ||
441 | * @sum_exec_runtime: total time spent on the CPU, in nanoseconds | ||
442 | * | ||
443 | * This structure groups together three kinds of CPU time that are | ||
444 | * tracked for threads and thread groups. Most things considering | ||
445 | * CPU time want to group these counts together and treat all three | ||
446 | * of them in parallel. | ||
447 | */ | ||
448 | struct task_cputime { | ||
449 | cputime_t utime; | ||
450 | cputime_t stime; | ||
451 | unsigned long long sum_exec_runtime; | ||
452 | }; | ||
453 | /* Alternate field names when used to cache expirations. */ | ||
454 | #define prof_exp stime | ||
455 | #define virt_exp utime | ||
456 | #define sched_exp sum_exec_runtime | ||
457 | |||
458 | /** | ||
459 | * struct thread_group_cputime - thread group interval timer counts | ||
460 | * @totals: thread group interval timers; substructure for | ||
461 | * uniprocessor kernel, per-cpu for SMP kernel. | ||
462 | * | ||
463 | * This structure contains the version of task_cputime, above, that is | ||
464 | * used for thread group CPU clock calculations. | ||
465 | */ | ||
466 | struct thread_group_cputime { | ||
467 | struct task_cputime *totals; | ||
468 | }; | ||
469 | |||
428 | /* | 470 | /* |
429 | * NOTE! "signal_struct" does not have it's own | 471 | * NOTE! "signal_struct" does not have it's own |
430 | * locking, because a shared signal_struct always | 472 | * locking, because a shared signal_struct always |
@@ -451,8 +493,8 @@ struct signal_struct { | |||
451 | * - everyone except group_exit_task is stopped during signal delivery | 493 | * - everyone except group_exit_task is stopped during signal delivery |
452 | * of fatal signals, group_exit_task processes the signal. | 494 | * of fatal signals, group_exit_task processes the signal. |
453 | */ | 495 | */ |
454 | struct task_struct *group_exit_task; | ||
455 | int notify_count; | 496 | int notify_count; |
497 | struct task_struct *group_exit_task; | ||
456 | 498 | ||
457 | /* thread group stop support, overloads group_exit_code too */ | 499 | /* thread group stop support, overloads group_exit_code too */ |
458 | int group_stop_count; | 500 | int group_stop_count; |
@@ -470,6 +512,17 @@ struct signal_struct { | |||
470 | cputime_t it_prof_expires, it_virt_expires; | 512 | cputime_t it_prof_expires, it_virt_expires; |
471 | cputime_t it_prof_incr, it_virt_incr; | 513 | cputime_t it_prof_incr, it_virt_incr; |
472 | 514 | ||
515 | /* | ||
516 | * Thread group totals for process CPU clocks. | ||
517 | * See thread_group_cputime(), et al, for details. | ||
518 | */ | ||
519 | struct thread_group_cputime cputime; | ||
520 | |||
521 | /* Earliest-expiration cache. */ | ||
522 | struct task_cputime cputime_expires; | ||
523 | |||
524 | struct list_head cpu_timers[3]; | ||
525 | |||
473 | /* job control IDs */ | 526 | /* job control IDs */ |
474 | 527 | ||
475 | /* | 528 | /* |
@@ -500,7 +553,7 @@ struct signal_struct { | |||
500 | * Live threads maintain their own counters and add to these | 553 | * Live threads maintain their own counters and add to these |
501 | * in __exit_signal, except for the group leader. | 554 | * in __exit_signal, except for the group leader. |
502 | */ | 555 | */ |
503 | cputime_t utime, stime, cutime, cstime; | 556 | cputime_t cutime, cstime; |
504 | cputime_t gtime; | 557 | cputime_t gtime; |
505 | cputime_t cgtime; | 558 | cputime_t cgtime; |
506 | unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; | 559 | unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; |
@@ -509,14 +562,6 @@ struct signal_struct { | |||
509 | struct task_io_accounting ioac; | 562 | struct task_io_accounting ioac; |
510 | 563 | ||
511 | /* | 564 | /* |
512 | * Cumulative ns of scheduled CPU time for dead threads in the | ||
513 | * group, not including a zombie group leader. (This only differs | ||
514 | * from jiffies_to_ns(utime + stime) if sched_clock uses something | ||
515 | * other than jiffies.) | ||
516 | */ | ||
517 | unsigned long long sum_sched_runtime; | ||
518 | |||
519 | /* | ||
520 | * We don't bother to synchronize most readers of this at all, | 565 | * We don't bother to synchronize most readers of this at all, |
521 | * because there is no reader checking a limit that actually needs | 566 | * because there is no reader checking a limit that actually needs |
522 | * to get both rlim_cur and rlim_max atomically, and either one | 567 | * to get both rlim_cur and rlim_max atomically, and either one |
@@ -527,8 +572,6 @@ struct signal_struct { | |||
527 | */ | 572 | */ |
528 | struct rlimit rlim[RLIM_NLIMITS]; | 573 | struct rlimit rlim[RLIM_NLIMITS]; |
529 | 574 | ||
530 | struct list_head cpu_timers[3]; | ||
531 | |||
532 | /* keep the process-shared keyrings here so that they do the right | 575 | /* keep the process-shared keyrings here so that they do the right |
533 | * thing in threads created with CLONE_THREAD */ | 576 | * thing in threads created with CLONE_THREAD */ |
534 | #ifdef CONFIG_KEYS | 577 | #ifdef CONFIG_KEYS |
@@ -638,10 +681,6 @@ struct sched_info { | |||
638 | }; | 681 | }; |
639 | #endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ | 682 | #endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ |
640 | 683 | ||
641 | #ifdef CONFIG_SCHEDSTATS | ||
642 | extern const struct file_operations proc_schedstat_operations; | ||
643 | #endif /* CONFIG_SCHEDSTATS */ | ||
644 | |||
645 | #ifdef CONFIG_TASK_DELAY_ACCT | 684 | #ifdef CONFIG_TASK_DELAY_ACCT |
646 | struct task_delay_info { | 685 | struct task_delay_info { |
647 | spinlock_t lock; | 686 | spinlock_t lock; |
@@ -824,6 +863,9 @@ struct sched_domain { | |||
824 | unsigned int ttwu_move_affine; | 863 | unsigned int ttwu_move_affine; |
825 | unsigned int ttwu_move_balance; | 864 | unsigned int ttwu_move_balance; |
826 | #endif | 865 | #endif |
866 | #ifdef CONFIG_SCHED_DEBUG | ||
867 | char *name; | ||
868 | #endif | ||
827 | }; | 869 | }; |
828 | 870 | ||
829 | extern void partition_sched_domains(int ndoms_new, cpumask_t *doms_new, | 871 | extern void partition_sched_domains(int ndoms_new, cpumask_t *doms_new, |
@@ -895,14 +937,15 @@ struct sched_class { | |||
895 | void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup); | 937 | void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup); |
896 | void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep); | 938 | void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep); |
897 | void (*yield_task) (struct rq *rq); | 939 | void (*yield_task) (struct rq *rq); |
898 | int (*select_task_rq)(struct task_struct *p, int sync); | ||
899 | 940 | ||
900 | void (*check_preempt_curr) (struct rq *rq, struct task_struct *p); | 941 | void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int sync); |
901 | 942 | ||
902 | struct task_struct * (*pick_next_task) (struct rq *rq); | 943 | struct task_struct * (*pick_next_task) (struct rq *rq); |
903 | void (*put_prev_task) (struct rq *rq, struct task_struct *p); | 944 | void (*put_prev_task) (struct rq *rq, struct task_struct *p); |
904 | 945 | ||
905 | #ifdef CONFIG_SMP | 946 | #ifdef CONFIG_SMP |
947 | int (*select_task_rq)(struct task_struct *p, int sync); | ||
948 | |||
906 | unsigned long (*load_balance) (struct rq *this_rq, int this_cpu, | 949 | unsigned long (*load_balance) (struct rq *this_rq, int this_cpu, |
907 | struct rq *busiest, unsigned long max_load_move, | 950 | struct rq *busiest, unsigned long max_load_move, |
908 | struct sched_domain *sd, enum cpu_idle_type idle, | 951 | struct sched_domain *sd, enum cpu_idle_type idle, |
@@ -914,16 +957,17 @@ struct sched_class { | |||
914 | void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); | 957 | void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); |
915 | void (*post_schedule) (struct rq *this_rq); | 958 | void (*post_schedule) (struct rq *this_rq); |
916 | void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); | 959 | void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); |
917 | #endif | ||
918 | 960 | ||
919 | void (*set_curr_task) (struct rq *rq); | ||
920 | void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); | ||
921 | void (*task_new) (struct rq *rq, struct task_struct *p); | ||
922 | void (*set_cpus_allowed)(struct task_struct *p, | 961 | void (*set_cpus_allowed)(struct task_struct *p, |
923 | const cpumask_t *newmask); | 962 | const cpumask_t *newmask); |
924 | 963 | ||
925 | void (*rq_online)(struct rq *rq); | 964 | void (*rq_online)(struct rq *rq); |
926 | void (*rq_offline)(struct rq *rq); | 965 | void (*rq_offline)(struct rq *rq); |
966 | #endif | ||
967 | |||
968 | void (*set_curr_task) (struct rq *rq); | ||
969 | void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); | ||
970 | void (*task_new) (struct rq *rq, struct task_struct *p); | ||
927 | 971 | ||
928 | void (*switched_from) (struct rq *this_rq, struct task_struct *task, | 972 | void (*switched_from) (struct rq *this_rq, struct task_struct *task, |
929 | int running); | 973 | int running); |
@@ -1010,8 +1054,8 @@ struct sched_entity { | |||
1010 | 1054 | ||
1011 | struct sched_rt_entity { | 1055 | struct sched_rt_entity { |
1012 | struct list_head run_list; | 1056 | struct list_head run_list; |
1013 | unsigned int time_slice; | ||
1014 | unsigned long timeout; | 1057 | unsigned long timeout; |
1058 | unsigned int time_slice; | ||
1015 | int nr_cpus_allowed; | 1059 | int nr_cpus_allowed; |
1016 | 1060 | ||
1017 | struct sched_rt_entity *back; | 1061 | struct sched_rt_entity *back; |
@@ -1134,8 +1178,7 @@ struct task_struct { | |||
1134 | /* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */ | 1178 | /* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */ |
1135 | unsigned long min_flt, maj_flt; | 1179 | unsigned long min_flt, maj_flt; |
1136 | 1180 | ||
1137 | cputime_t it_prof_expires, it_virt_expires; | 1181 | struct task_cputime cputime_expires; |
1138 | unsigned long long it_sched_expires; | ||
1139 | struct list_head cpu_timers[3]; | 1182 | struct list_head cpu_timers[3]; |
1140 | 1183 | ||
1141 | /* process credentials */ | 1184 | /* process credentials */ |
@@ -1301,6 +1344,14 @@ struct task_struct { | |||
1301 | int latency_record_count; | 1344 | int latency_record_count; |
1302 | struct latency_record latency_record[LT_SAVECOUNT]; | 1345 | struct latency_record latency_record[LT_SAVECOUNT]; |
1303 | #endif | 1346 | #endif |
1347 | /* | ||
1348 | * time slack values; these are used to round up poll() and | ||
1349 | * select() etc timeout values. These are in nanoseconds. | ||
1350 | */ | ||
1351 | unsigned long timer_slack_ns; | ||
1352 | unsigned long default_timer_slack_ns; | ||
1353 | |||
1354 | struct list_head *scm_work_list; | ||
1304 | }; | 1355 | }; |
1305 | 1356 | ||
1306 | /* | 1357 | /* |
@@ -1585,6 +1636,7 @@ extern unsigned long long cpu_clock(int cpu); | |||
1585 | 1636 | ||
1586 | extern unsigned long long | 1637 | extern unsigned long long |
1587 | task_sched_runtime(struct task_struct *task); | 1638 | task_sched_runtime(struct task_struct *task); |
1639 | extern unsigned long long thread_group_sched_runtime(struct task_struct *task); | ||
1588 | 1640 | ||
1589 | /* sched_exec is called by processes performing an exec */ | 1641 | /* sched_exec is called by processes performing an exec */ |
1590 | #ifdef CONFIG_SMP | 1642 | #ifdef CONFIG_SMP |
@@ -1619,6 +1671,7 @@ extern unsigned int sysctl_sched_features; | |||
1619 | extern unsigned int sysctl_sched_migration_cost; | 1671 | extern unsigned int sysctl_sched_migration_cost; |
1620 | extern unsigned int sysctl_sched_nr_migrate; | 1672 | extern unsigned int sysctl_sched_nr_migrate; |
1621 | extern unsigned int sysctl_sched_shares_ratelimit; | 1673 | extern unsigned int sysctl_sched_shares_ratelimit; |
1674 | extern unsigned int sysctl_sched_shares_thresh; | ||
1622 | 1675 | ||
1623 | int sched_nr_latency_handler(struct ctl_table *table, int write, | 1676 | int sched_nr_latency_handler(struct ctl_table *table, int write, |
1624 | struct file *file, void __user *buffer, size_t *length, | 1677 | struct file *file, void __user *buffer, size_t *length, |
@@ -2082,6 +2135,30 @@ static inline int spin_needbreak(spinlock_t *lock) | |||
2082 | } | 2135 | } |
2083 | 2136 | ||
2084 | /* | 2137 | /* |
2138 | * Thread group CPU time accounting. | ||
2139 | */ | ||
2140 | |||
2141 | extern int thread_group_cputime_alloc(struct task_struct *); | ||
2142 | extern void thread_group_cputime(struct task_struct *, struct task_cputime *); | ||
2143 | |||
2144 | static inline void thread_group_cputime_init(struct signal_struct *sig) | ||
2145 | { | ||
2146 | sig->cputime.totals = NULL; | ||
2147 | } | ||
2148 | |||
2149 | static inline int thread_group_cputime_clone_thread(struct task_struct *curr) | ||
2150 | { | ||
2151 | if (curr->signal->cputime.totals) | ||
2152 | return 0; | ||
2153 | return thread_group_cputime_alloc(curr); | ||
2154 | } | ||
2155 | |||
2156 | static inline void thread_group_cputime_free(struct signal_struct *sig) | ||
2157 | { | ||
2158 | free_percpu(sig->cputime.totals); | ||
2159 | } | ||
2160 | |||
2161 | /* | ||
2085 | * Reevaluate whether the task has signals pending delivery. | 2162 | * Reevaluate whether the task has signals pending delivery. |
2086 | * Wake the task if so. | 2163 | * Wake the task if so. |
2087 | * This is required every time the blocked sigset_t changes. | 2164 | * This is required every time the blocked sigset_t changes. |
diff --git a/include/linux/security.h b/include/linux/security.h index 80c4d002864c..c13f1cec9abb 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -1560,11 +1560,6 @@ struct security_operations { | |||
1560 | extern int security_init(void); | 1560 | extern int security_init(void); |
1561 | extern int security_module_enable(struct security_operations *ops); | 1561 | extern int security_module_enable(struct security_operations *ops); |
1562 | extern int register_security(struct security_operations *ops); | 1562 | extern int register_security(struct security_operations *ops); |
1563 | extern struct dentry *securityfs_create_file(const char *name, mode_t mode, | ||
1564 | struct dentry *parent, void *data, | ||
1565 | const struct file_operations *fops); | ||
1566 | extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent); | ||
1567 | extern void securityfs_remove(struct dentry *dentry); | ||
1568 | 1563 | ||
1569 | /* Security operations */ | 1564 | /* Security operations */ |
1570 | int security_ptrace_may_access(struct task_struct *child, unsigned int mode); | 1565 | int security_ptrace_may_access(struct task_struct *child, unsigned int mode); |
@@ -1590,6 +1585,7 @@ int security_syslog(int type); | |||
1590 | int security_settime(struct timespec *ts, struct timezone *tz); | 1585 | int security_settime(struct timespec *ts, struct timezone *tz); |
1591 | int security_vm_enough_memory(long pages); | 1586 | int security_vm_enough_memory(long pages); |
1592 | int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); | 1587 | int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); |
1588 | int security_vm_enough_memory_kern(long pages); | ||
1593 | int security_bprm_alloc(struct linux_binprm *bprm); | 1589 | int security_bprm_alloc(struct linux_binprm *bprm); |
1594 | void security_bprm_free(struct linux_binprm *bprm); | 1590 | void security_bprm_free(struct linux_binprm *bprm); |
1595 | void security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe); | 1591 | void security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe); |
@@ -1825,6 +1821,11 @@ static inline int security_vm_enough_memory(long pages) | |||
1825 | return cap_vm_enough_memory(current->mm, pages); | 1821 | return cap_vm_enough_memory(current->mm, pages); |
1826 | } | 1822 | } |
1827 | 1823 | ||
1824 | static inline int security_vm_enough_memory_kern(long pages) | ||
1825 | { | ||
1826 | return cap_vm_enough_memory(current->mm, pages); | ||
1827 | } | ||
1828 | |||
1828 | static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages) | 1829 | static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages) |
1829 | { | 1830 | { |
1830 | return cap_vm_enough_memory(mm, pages); | 1831 | return cap_vm_enough_memory(mm, pages); |
@@ -2424,25 +2425,6 @@ static inline int security_netlink_recv(struct sk_buff *skb, int cap) | |||
2424 | return cap_netlink_recv(skb, cap); | 2425 | return cap_netlink_recv(skb, cap); |
2425 | } | 2426 | } |
2426 | 2427 | ||
2427 | static inline struct dentry *securityfs_create_dir(const char *name, | ||
2428 | struct dentry *parent) | ||
2429 | { | ||
2430 | return ERR_PTR(-ENODEV); | ||
2431 | } | ||
2432 | |||
2433 | static inline struct dentry *securityfs_create_file(const char *name, | ||
2434 | mode_t mode, | ||
2435 | struct dentry *parent, | ||
2436 | void *data, | ||
2437 | const struct file_operations *fops) | ||
2438 | { | ||
2439 | return ERR_PTR(-ENODEV); | ||
2440 | } | ||
2441 | |||
2442 | static inline void securityfs_remove(struct dentry *dentry) | ||
2443 | { | ||
2444 | } | ||
2445 | |||
2446 | static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) | 2428 | static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) |
2447 | { | 2429 | { |
2448 | return -EOPNOTSUPP; | 2430 | return -EOPNOTSUPP; |
@@ -2806,5 +2788,35 @@ static inline void security_audit_rule_free(void *lsmrule) | |||
2806 | #endif /* CONFIG_SECURITY */ | 2788 | #endif /* CONFIG_SECURITY */ |
2807 | #endif /* CONFIG_AUDIT */ | 2789 | #endif /* CONFIG_AUDIT */ |
2808 | 2790 | ||
2791 | #ifdef CONFIG_SECURITYFS | ||
2792 | |||
2793 | extern struct dentry *securityfs_create_file(const char *name, mode_t mode, | ||
2794 | struct dentry *parent, void *data, | ||
2795 | const struct file_operations *fops); | ||
2796 | extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent); | ||
2797 | extern void securityfs_remove(struct dentry *dentry); | ||
2798 | |||
2799 | #else /* CONFIG_SECURITYFS */ | ||
2800 | |||
2801 | static inline struct dentry *securityfs_create_dir(const char *name, | ||
2802 | struct dentry *parent) | ||
2803 | { | ||
2804 | return ERR_PTR(-ENODEV); | ||
2805 | } | ||
2806 | |||
2807 | static inline struct dentry *securityfs_create_file(const char *name, | ||
2808 | mode_t mode, | ||
2809 | struct dentry *parent, | ||
2810 | void *data, | ||
2811 | const struct file_operations *fops) | ||
2812 | { | ||
2813 | return ERR_PTR(-ENODEV); | ||
2814 | } | ||
2815 | |||
2816 | static inline void securityfs_remove(struct dentry *dentry) | ||
2817 | {} | ||
2818 | |||
2819 | #endif | ||
2820 | |||
2809 | #endif /* ! __LINUX_SECURITY_H */ | 2821 | #endif /* ! __LINUX_SECURITY_H */ |
2810 | 2822 | ||
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index a1783b229ef4..dc50bcc282a8 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
@@ -60,6 +60,19 @@ static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask) | |||
60 | return seq_bitmap(m, mask->bits, MAX_NUMNODES); | 60 | return seq_bitmap(m, mask->bits, MAX_NUMNODES); |
61 | } | 61 | } |
62 | 62 | ||
63 | int seq_bitmap_list(struct seq_file *m, unsigned long *bits, | ||
64 | unsigned int nr_bits); | ||
65 | |||
66 | static inline int seq_cpumask_list(struct seq_file *m, cpumask_t *mask) | ||
67 | { | ||
68 | return seq_bitmap_list(m, mask->bits, NR_CPUS); | ||
69 | } | ||
70 | |||
71 | static inline int seq_nodemask_list(struct seq_file *m, nodemask_t *mask) | ||
72 | { | ||
73 | return seq_bitmap_list(m, mask->bits, MAX_NUMNODES); | ||
74 | } | ||
75 | |||
63 | int single_open(struct file *, int (*)(struct seq_file *, void *), void *); | 76 | int single_open(struct file *, int (*)(struct seq_file *, void *), void *); |
64 | int single_release(struct inode *, struct file *); | 77 | int single_release(struct inode *, struct file *); |
65 | void *__seq_open_private(struct file *, const struct seq_operations *, int); | 78 | void *__seq_open_private(struct file *, const struct seq_operations *, int); |
diff --git a/include/linux/serial.h b/include/linux/serial.h index deb714314fb1..1ea8d9265bf6 100644 --- a/include/linux/serial.h +++ b/include/linux/serial.h | |||
@@ -173,6 +173,22 @@ struct serial_icounter_struct { | |||
173 | int reserved[9]; | 173 | int reserved[9]; |
174 | }; | 174 | }; |
175 | 175 | ||
176 | /* | ||
177 | * Serial interface for controlling RS485 settings on chips with suitable | ||
178 | * support. Set with TIOCSRS485 and get with TIOCGRS485 if supported by your | ||
179 | * platform. The set function returns the new state, with any unsupported bits | ||
180 | * reverted appropriately. | ||
181 | */ | ||
182 | |||
183 | struct serial_rs485 { | ||
184 | __u32 flags; /* RS485 feature flags */ | ||
185 | #define SER_RS485_ENABLED (1 << 0) | ||
186 | #define SER_RS485_RTS_ON_SEND (1 << 1) | ||
187 | #define SER_RS485_RTS_AFTER_SEND (1 << 2) | ||
188 | __u32 delay_rts_before_send; /* Milliseconds */ | ||
189 | __u32 padding[6]; /* Memory is cheap, new structs | ||
190 | are a royal PITA .. */ | ||
191 | }; | ||
176 | 192 | ||
177 | #ifdef __KERNEL__ | 193 | #ifdef __KERNEL__ |
178 | #include <linux/compiler.h> | 194 | #include <linux/compiler.h> |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 3b2f6c04855e..4e4f1277f3bf 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
@@ -155,6 +155,9 @@ | |||
155 | 155 | ||
156 | #define PORT_SC26XX 82 | 156 | #define PORT_SC26XX 82 |
157 | 157 | ||
158 | /* SH-SCI */ | ||
159 | #define PORT_SCIFA 83 | ||
160 | |||
158 | #ifdef __KERNEL__ | 161 | #ifdef __KERNEL__ |
159 | 162 | ||
160 | #include <linux/compiler.h> | 163 | #include <linux/compiler.h> |
@@ -241,7 +244,7 @@ typedef unsigned int __bitwise__ upf_t; | |||
241 | 244 | ||
242 | struct uart_port { | 245 | struct uart_port { |
243 | spinlock_t lock; /* port lock */ | 246 | spinlock_t lock; /* port lock */ |
244 | unsigned int iobase; /* in/out[bwl] */ | 247 | unsigned long iobase; /* in/out[bwl] */ |
245 | unsigned char __iomem *membase; /* read/write[bwl] */ | 248 | unsigned char __iomem *membase; /* read/write[bwl] */ |
246 | unsigned int irq; /* irq number */ | 249 | unsigned int irq; /* irq number */ |
247 | unsigned int uartclk; /* base uart clock */ | 250 | unsigned int uartclk; /* base uart clock */ |
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h new file mode 100644 index 000000000000..68e212ff9dde --- /dev/null +++ b/include/linux/sh_intc.h | |||
@@ -0,0 +1,91 @@ | |||
1 | #ifndef __SH_INTC_H | ||
2 | #define __SH_INTC_H | ||
3 | |||
4 | typedef unsigned char intc_enum; | ||
5 | |||
6 | struct intc_vect { | ||
7 | intc_enum enum_id; | ||
8 | unsigned short vect; | ||
9 | }; | ||
10 | |||
11 | #define INTC_VECT(enum_id, vect) { enum_id, vect } | ||
12 | #define INTC_IRQ(enum_id, irq) INTC_VECT(enum_id, irq2evt(irq)) | ||
13 | |||
14 | struct intc_group { | ||
15 | intc_enum enum_id; | ||
16 | intc_enum enum_ids[32]; | ||
17 | }; | ||
18 | |||
19 | #define INTC_GROUP(enum_id, ids...) { enum_id, { ids } } | ||
20 | |||
21 | struct intc_mask_reg { | ||
22 | unsigned long set_reg, clr_reg, reg_width; | ||
23 | intc_enum enum_ids[32]; | ||
24 | #ifdef CONFIG_SMP | ||
25 | unsigned long smp; | ||
26 | #endif | ||
27 | }; | ||
28 | |||
29 | struct intc_prio_reg { | ||
30 | unsigned long set_reg, clr_reg, reg_width, field_width; | ||
31 | intc_enum enum_ids[16]; | ||
32 | #ifdef CONFIG_SMP | ||
33 | unsigned long smp; | ||
34 | #endif | ||
35 | }; | ||
36 | |||
37 | struct intc_sense_reg { | ||
38 | unsigned long reg, reg_width, field_width; | ||
39 | intc_enum enum_ids[16]; | ||
40 | }; | ||
41 | |||
42 | #ifdef CONFIG_SMP | ||
43 | #define INTC_SMP(stride, nr) .smp = (stride) | ((nr) << 8) | ||
44 | #else | ||
45 | #define INTC_SMP(stride, nr) | ||
46 | #endif | ||
47 | |||
48 | struct intc_desc { | ||
49 | struct intc_vect *vectors; | ||
50 | unsigned int nr_vectors; | ||
51 | struct intc_group *groups; | ||
52 | unsigned int nr_groups; | ||
53 | struct intc_mask_reg *mask_regs; | ||
54 | unsigned int nr_mask_regs; | ||
55 | struct intc_prio_reg *prio_regs; | ||
56 | unsigned int nr_prio_regs; | ||
57 | struct intc_sense_reg *sense_regs; | ||
58 | unsigned int nr_sense_regs; | ||
59 | char *name; | ||
60 | #if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A) | ||
61 | struct intc_mask_reg *ack_regs; | ||
62 | unsigned int nr_ack_regs; | ||
63 | #endif | ||
64 | }; | ||
65 | |||
66 | #define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a) | ||
67 | #define DECLARE_INTC_DESC(symbol, chipname, vectors, groups, \ | ||
68 | mask_regs, prio_regs, sense_regs) \ | ||
69 | struct intc_desc symbol __initdata = { \ | ||
70 | _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \ | ||
71 | _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \ | ||
72 | _INTC_ARRAY(sense_regs), \ | ||
73 | chipname, \ | ||
74 | } | ||
75 | |||
76 | #if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A) | ||
77 | #define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \ | ||
78 | mask_regs, prio_regs, sense_regs, ack_regs) \ | ||
79 | struct intc_desc symbol __initdata = { \ | ||
80 | _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \ | ||
81 | _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \ | ||
82 | _INTC_ARRAY(sense_regs), \ | ||
83 | chipname, \ | ||
84 | _INTC_ARRAY(ack_regs), \ | ||
85 | } | ||
86 | #endif | ||
87 | |||
88 | void __init register_intc_controller(struct intc_desc *desc); | ||
89 | int intc_set_priority(unsigned int irq, unsigned int prio); | ||
90 | |||
91 | #endif /* __SH_INTC_H */ | ||
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 909923717830..2725f4e5a9bf 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -146,8 +146,14 @@ struct skb_shared_info { | |||
146 | unsigned short gso_segs; | 146 | unsigned short gso_segs; |
147 | unsigned short gso_type; | 147 | unsigned short gso_type; |
148 | __be32 ip6_frag_id; | 148 | __be32 ip6_frag_id; |
149 | #ifdef CONFIG_HAS_DMA | ||
150 | unsigned int num_dma_maps; | ||
151 | #endif | ||
149 | struct sk_buff *frag_list; | 152 | struct sk_buff *frag_list; |
150 | skb_frag_t frags[MAX_SKB_FRAGS]; | 153 | skb_frag_t frags[MAX_SKB_FRAGS]; |
154 | #ifdef CONFIG_HAS_DMA | ||
155 | dma_addr_t dma_maps[MAX_SKB_FRAGS + 1]; | ||
156 | #endif | ||
151 | }; | 157 | }; |
152 | 158 | ||
153 | /* We divide dataref into two halves. The higher 16 bits hold references | 159 | /* We divide dataref into two halves. The higher 16 bits hold references |
@@ -353,6 +359,14 @@ struct sk_buff { | |||
353 | 359 | ||
354 | #include <asm/system.h> | 360 | #include <asm/system.h> |
355 | 361 | ||
362 | #ifdef CONFIG_HAS_DMA | ||
363 | #include <linux/dma-mapping.h> | ||
364 | extern int skb_dma_map(struct device *dev, struct sk_buff *skb, | ||
365 | enum dma_data_direction dir); | ||
366 | extern void skb_dma_unmap(struct device *dev, struct sk_buff *skb, | ||
367 | enum dma_data_direction dir); | ||
368 | #endif | ||
369 | |||
356 | extern void kfree_skb(struct sk_buff *skb); | 370 | extern void kfree_skb(struct sk_buff *skb); |
357 | extern void __kfree_skb(struct sk_buff *skb); | 371 | extern void __kfree_skb(struct sk_buff *skb); |
358 | extern struct sk_buff *__alloc_skb(unsigned int size, | 372 | extern struct sk_buff *__alloc_skb(unsigned int size, |
@@ -369,6 +383,8 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size, | |||
369 | return __alloc_skb(size, priority, 1, -1); | 383 | return __alloc_skb(size, priority, 1, -1); |
370 | } | 384 | } |
371 | 385 | ||
386 | extern int skb_recycle_check(struct sk_buff *skb, int skb_size); | ||
387 | |||
372 | extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); | 388 | extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); |
373 | extern struct sk_buff *skb_clone(struct sk_buff *skb, | 389 | extern struct sk_buff *skb_clone(struct sk_buff *skb, |
374 | gfp_t priority); | 390 | gfp_t priority); |
@@ -459,6 +475,37 @@ static inline int skb_queue_empty(const struct sk_buff_head *list) | |||
459 | } | 475 | } |
460 | 476 | ||
461 | /** | 477 | /** |
478 | * skb_queue_is_last - check if skb is the last entry in the queue | ||
479 | * @list: queue head | ||
480 | * @skb: buffer | ||
481 | * | ||
482 | * Returns true if @skb is the last buffer on the list. | ||
483 | */ | ||
484 | static inline bool skb_queue_is_last(const struct sk_buff_head *list, | ||
485 | const struct sk_buff *skb) | ||
486 | { | ||
487 | return (skb->next == (struct sk_buff *) list); | ||
488 | } | ||
489 | |||
490 | /** | ||
491 | * skb_queue_next - return the next packet in the queue | ||
492 | * @list: queue head | ||
493 | * @skb: current buffer | ||
494 | * | ||
495 | * Return the next packet in @list after @skb. It is only valid to | ||
496 | * call this if skb_queue_is_last() evaluates to false. | ||
497 | */ | ||
498 | static inline struct sk_buff *skb_queue_next(const struct sk_buff_head *list, | ||
499 | const struct sk_buff *skb) | ||
500 | { | ||
501 | /* This BUG_ON may seem severe, but if we just return then we | ||
502 | * are going to dereference garbage. | ||
503 | */ | ||
504 | BUG_ON(skb_queue_is_last(list, skb)); | ||
505 | return skb->next; | ||
506 | } | ||
507 | |||
508 | /** | ||
462 | * skb_get - reference buffer | 509 | * skb_get - reference buffer |
463 | * @skb: buffer to reference | 510 | * @skb: buffer to reference |
464 | * | 511 | * |
@@ -646,6 +693,22 @@ static inline __u32 skb_queue_len(const struct sk_buff_head *list_) | |||
646 | return list_->qlen; | 693 | return list_->qlen; |
647 | } | 694 | } |
648 | 695 | ||
696 | /** | ||
697 | * __skb_queue_head_init - initialize non-spinlock portions of sk_buff_head | ||
698 | * @list: queue to initialize | ||
699 | * | ||
700 | * This initializes only the list and queue length aspects of | ||
701 | * an sk_buff_head object. This allows to initialize the list | ||
702 | * aspects of an sk_buff_head without reinitializing things like | ||
703 | * the spinlock. It can also be used for on-stack sk_buff_head | ||
704 | * objects where the spinlock is known to not be used. | ||
705 | */ | ||
706 | static inline void __skb_queue_head_init(struct sk_buff_head *list) | ||
707 | { | ||
708 | list->prev = list->next = (struct sk_buff *)list; | ||
709 | list->qlen = 0; | ||
710 | } | ||
711 | |||
649 | /* | 712 | /* |
650 | * This function creates a split out lock class for each invocation; | 713 | * This function creates a split out lock class for each invocation; |
651 | * this is needed for now since a whole lot of users of the skb-queue | 714 | * this is needed for now since a whole lot of users of the skb-queue |
@@ -657,8 +720,7 @@ static inline __u32 skb_queue_len(const struct sk_buff_head *list_) | |||
657 | static inline void skb_queue_head_init(struct sk_buff_head *list) | 720 | static inline void skb_queue_head_init(struct sk_buff_head *list) |
658 | { | 721 | { |
659 | spin_lock_init(&list->lock); | 722 | spin_lock_init(&list->lock); |
660 | list->prev = list->next = (struct sk_buff *)list; | 723 | __skb_queue_head_init(list); |
661 | list->qlen = 0; | ||
662 | } | 724 | } |
663 | 725 | ||
664 | static inline void skb_queue_head_init_class(struct sk_buff_head *list, | 726 | static inline void skb_queue_head_init_class(struct sk_buff_head *list, |
@@ -685,6 +747,83 @@ static inline void __skb_insert(struct sk_buff *newsk, | |||
685 | list->qlen++; | 747 | list->qlen++; |
686 | } | 748 | } |
687 | 749 | ||
750 | static inline void __skb_queue_splice(const struct sk_buff_head *list, | ||
751 | struct sk_buff *prev, | ||
752 | struct sk_buff *next) | ||
753 | { | ||
754 | struct sk_buff *first = list->next; | ||
755 | struct sk_buff *last = list->prev; | ||
756 | |||
757 | first->prev = prev; | ||
758 | prev->next = first; | ||
759 | |||
760 | last->next = next; | ||
761 | next->prev = last; | ||
762 | } | ||
763 | |||
764 | /** | ||
765 | * skb_queue_splice - join two skb lists, this is designed for stacks | ||
766 | * @list: the new list to add | ||
767 | * @head: the place to add it in the first list | ||
768 | */ | ||
769 | static inline void skb_queue_splice(const struct sk_buff_head *list, | ||
770 | struct sk_buff_head *head) | ||
771 | { | ||
772 | if (!skb_queue_empty(list)) { | ||
773 | __skb_queue_splice(list, (struct sk_buff *) head, head->next); | ||
774 | head->qlen += list->qlen; | ||
775 | } | ||
776 | } | ||
777 | |||
778 | /** | ||
779 | * skb_queue_splice - join two skb lists and reinitialise the emptied list | ||
780 | * @list: the new list to add | ||
781 | * @head: the place to add it in the first list | ||
782 | * | ||
783 | * The list at @list is reinitialised | ||
784 | */ | ||
785 | static inline void skb_queue_splice_init(struct sk_buff_head *list, | ||
786 | struct sk_buff_head *head) | ||
787 | { | ||
788 | if (!skb_queue_empty(list)) { | ||
789 | __skb_queue_splice(list, (struct sk_buff *) head, head->next); | ||
790 | head->qlen += list->qlen; | ||
791 | __skb_queue_head_init(list); | ||
792 | } | ||
793 | } | ||
794 | |||
795 | /** | ||
796 | * skb_queue_splice_tail - join two skb lists, each list being a queue | ||
797 | * @list: the new list to add | ||
798 | * @head: the place to add it in the first list | ||
799 | */ | ||
800 | static inline void skb_queue_splice_tail(const struct sk_buff_head *list, | ||
801 | struct sk_buff_head *head) | ||
802 | { | ||
803 | if (!skb_queue_empty(list)) { | ||
804 | __skb_queue_splice(list, head->prev, (struct sk_buff *) head); | ||
805 | head->qlen += list->qlen; | ||
806 | } | ||
807 | } | ||
808 | |||
809 | /** | ||
810 | * skb_queue_splice_tail - join two skb lists and reinitialise the emptied list | ||
811 | * @list: the new list to add | ||
812 | * @head: the place to add it in the first list | ||
813 | * | ||
814 | * Each of the lists is a queue. | ||
815 | * The list at @list is reinitialised | ||
816 | */ | ||
817 | static inline void skb_queue_splice_tail_init(struct sk_buff_head *list, | ||
818 | struct sk_buff_head *head) | ||
819 | { | ||
820 | if (!skb_queue_empty(list)) { | ||
821 | __skb_queue_splice(list, head->prev, (struct sk_buff *) head); | ||
822 | head->qlen += list->qlen; | ||
823 | __skb_queue_head_init(list); | ||
824 | } | ||
825 | } | ||
826 | |||
688 | /** | 827 | /** |
689 | * __skb_queue_after - queue a buffer at the list head | 828 | * __skb_queue_after - queue a buffer at the list head |
690 | * @list: list to use | 829 | * @list: list to use |
@@ -829,6 +968,9 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i, | |||
829 | skb_shinfo(skb)->nr_frags = i + 1; | 968 | skb_shinfo(skb)->nr_frags = i + 1; |
830 | } | 969 | } |
831 | 970 | ||
971 | extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, | ||
972 | int off, int size); | ||
973 | |||
832 | #define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) | 974 | #define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) |
833 | #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) | 975 | #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) |
834 | #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) | 976 | #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) |
@@ -1243,6 +1385,26 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev, | |||
1243 | return __netdev_alloc_skb(dev, length, GFP_ATOMIC); | 1385 | return __netdev_alloc_skb(dev, length, GFP_ATOMIC); |
1244 | } | 1386 | } |
1245 | 1387 | ||
1388 | extern struct page *__netdev_alloc_page(struct net_device *dev, gfp_t gfp_mask); | ||
1389 | |||
1390 | /** | ||
1391 | * netdev_alloc_page - allocate a page for ps-rx on a specific device | ||
1392 | * @dev: network device to receive on | ||
1393 | * | ||
1394 | * Allocate a new page node local to the specified device. | ||
1395 | * | ||
1396 | * %NULL is returned if there is no free memory. | ||
1397 | */ | ||
1398 | static inline struct page *netdev_alloc_page(struct net_device *dev) | ||
1399 | { | ||
1400 | return __netdev_alloc_page(dev, GFP_ATOMIC); | ||
1401 | } | ||
1402 | |||
1403 | static inline void netdev_free_page(struct net_device *dev, struct page *page) | ||
1404 | { | ||
1405 | __free_page(page); | ||
1406 | } | ||
1407 | |||
1246 | /** | 1408 | /** |
1247 | * skb_clone_writable - is the header of a clone writable | 1409 | * skb_clone_writable - is the header of a clone writable |
1248 | * @skb: buffer to check | 1410 | * @skb: buffer to check |
@@ -1434,6 +1596,15 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) | |||
1434 | skb != (struct sk_buff *)(queue); \ | 1596 | skb != (struct sk_buff *)(queue); \ |
1435 | skb = tmp, tmp = skb->next) | 1597 | skb = tmp, tmp = skb->next) |
1436 | 1598 | ||
1599 | #define skb_queue_walk_from(queue, skb) \ | ||
1600 | for (; prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \ | ||
1601 | skb = skb->next) | ||
1602 | |||
1603 | #define skb_queue_walk_from_safe(queue, skb, tmp) \ | ||
1604 | for (tmp = skb->next; \ | ||
1605 | skb != (struct sk_buff *)(queue); \ | ||
1606 | skb = tmp, tmp = skb->next) | ||
1607 | |||
1437 | #define skb_queue_reverse_walk(queue, skb) \ | 1608 | #define skb_queue_reverse_walk(queue, skb) \ |
1438 | for (skb = (queue)->prev; \ | 1609 | for (skb = (queue)->prev; \ |
1439 | prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \ | 1610 | prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \ |
diff --git a/include/linux/slab.h b/include/linux/slab.h index 5ff9676c1e2c..000da12b5cf0 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -23,6 +23,34 @@ | |||
23 | #define SLAB_CACHE_DMA 0x00004000UL /* Use GFP_DMA memory */ | 23 | #define SLAB_CACHE_DMA 0x00004000UL /* Use GFP_DMA memory */ |
24 | #define SLAB_STORE_USER 0x00010000UL /* DEBUG: Store the last owner for bug hunting */ | 24 | #define SLAB_STORE_USER 0x00010000UL /* DEBUG: Store the last owner for bug hunting */ |
25 | #define SLAB_PANIC 0x00040000UL /* Panic if kmem_cache_create() fails */ | 25 | #define SLAB_PANIC 0x00040000UL /* Panic if kmem_cache_create() fails */ |
26 | /* | ||
27 | * SLAB_DESTROY_BY_RCU - **WARNING** READ THIS! | ||
28 | * | ||
29 | * This delays freeing the SLAB page by a grace period, it does _NOT_ | ||
30 | * delay object freeing. This means that if you do kmem_cache_free() | ||
31 | * that memory location is free to be reused at any time. Thus it may | ||
32 | * be possible to see another object there in the same RCU grace period. | ||
33 | * | ||
34 | * This feature only ensures the memory location backing the object | ||
35 | * stays valid, the trick to using this is relying on an independent | ||
36 | * object validation pass. Something like: | ||
37 | * | ||
38 | * rcu_read_lock() | ||
39 | * again: | ||
40 | * obj = lockless_lookup(key); | ||
41 | * if (obj) { | ||
42 | * if (!try_get_ref(obj)) // might fail for free objects | ||
43 | * goto again; | ||
44 | * | ||
45 | * if (obj->key != key) { // not the object we expected | ||
46 | * put_ref(obj); | ||
47 | * goto again; | ||
48 | * } | ||
49 | * } | ||
50 | * rcu_read_unlock(); | ||
51 | * | ||
52 | * See also the comment on struct slab_rcu in mm/slab.c. | ||
53 | */ | ||
26 | #define SLAB_DESTROY_BY_RCU 0x00080000UL /* Defer freeing slabs to RCU */ | 54 | #define SLAB_DESTROY_BY_RCU 0x00080000UL /* Defer freeing slabs to RCU */ |
27 | #define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ | 55 | #define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ |
28 | #define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */ | 56 | #define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */ |
@@ -288,9 +316,4 @@ static inline void *kzalloc_node(size_t size, gfp_t flags, int node) | |||
288 | return kmalloc_node(size, flags | __GFP_ZERO, node); | 316 | return kmalloc_node(size, flags | __GFP_ZERO, node); |
289 | } | 317 | } |
290 | 318 | ||
291 | #ifdef CONFIG_SLABINFO | ||
292 | extern const struct seq_operations slabinfo_op; | ||
293 | ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *); | ||
294 | #endif | ||
295 | |||
296 | #endif /* _LINUX_SLAB_H */ | 319 | #endif /* _LINUX_SLAB_H */ |
diff --git a/include/linux/smc911x.h b/include/linux/smc911x.h index b58f54c24183..521f37143fae 100644 --- a/include/linux/smc911x.h +++ b/include/linux/smc911x.h | |||
@@ -7,6 +7,7 @@ | |||
7 | struct smc911x_platdata { | 7 | struct smc911x_platdata { |
8 | unsigned long flags; | 8 | unsigned long flags; |
9 | unsigned long irq_flags; /* IRQF_... */ | 9 | unsigned long irq_flags; /* IRQF_... */ |
10 | int irq_polarity; | ||
10 | }; | 11 | }; |
11 | 12 | ||
12 | #endif /* __SMC911X_H__ */ | 13 | #endif /* __SMC911X_H__ */ |
diff --git a/include/linux/smc91x.h b/include/linux/smc91x.h index 3827b922ba1f..bc21db598c06 100644 --- a/include/linux/smc91x.h +++ b/include/linux/smc91x.h | |||
@@ -16,8 +16,19 @@ | |||
16 | 16 | ||
17 | #define SMC91X_USE_DMA (1 << 6) | 17 | #define SMC91X_USE_DMA (1 << 6) |
18 | 18 | ||
19 | #define RPC_LED_100_10 (0x00) /* LED = 100Mbps OR's with 10Mbps link detect */ | ||
20 | #define RPC_LED_RES (0x01) /* LED = Reserved */ | ||
21 | #define RPC_LED_10 (0x02) /* LED = 10Mbps link detect */ | ||
22 | #define RPC_LED_FD (0x03) /* LED = Full Duplex Mode */ | ||
23 | #define RPC_LED_TX_RX (0x04) /* LED = TX or RX packet occurred */ | ||
24 | #define RPC_LED_100 (0x05) /* LED = 100Mbps link dectect */ | ||
25 | #define RPC_LED_TX (0x06) /* LED = TX packet occurred */ | ||
26 | #define RPC_LED_RX (0x07) /* LED = RX packet occurred */ | ||
27 | |||
19 | struct smc91x_platdata { | 28 | struct smc91x_platdata { |
20 | unsigned long flags; | 29 | unsigned long flags; |
30 | unsigned char leda; | ||
31 | unsigned char ledb; | ||
21 | }; | 32 | }; |
22 | 33 | ||
23 | #endif /* __SMC91X_H__ */ | 34 | #endif /* __SMC91X_H__ */ |
diff --git a/include/linux/smp.h b/include/linux/smp.h index 66484d4a8459..3f9a60043a97 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/errno.h> | 9 | #include <linux/errno.h> |
10 | #include <linux/types.h> | ||
10 | #include <linux/list.h> | 11 | #include <linux/list.h> |
11 | #include <linux/cpumask.h> | 12 | #include <linux/cpumask.h> |
12 | 13 | ||
@@ -16,7 +17,8 @@ struct call_single_data { | |||
16 | struct list_head list; | 17 | struct list_head list; |
17 | void (*func) (void *info); | 18 | void (*func) (void *info); |
18 | void *info; | 19 | void *info; |
19 | unsigned int flags; | 20 | u16 flags; |
21 | u16 priv; | ||
20 | }; | 22 | }; |
21 | 23 | ||
22 | #ifdef CONFIG_SMP | 24 | #ifdef CONFIG_SMP |
@@ -62,8 +64,17 @@ extern void smp_cpus_done(unsigned int max_cpus); | |||
62 | * Call a function on all other processors | 64 | * Call a function on all other processors |
63 | */ | 65 | */ |
64 | int smp_call_function(void(*func)(void *info), void *info, int wait); | 66 | int smp_call_function(void(*func)(void *info), void *info, int wait); |
67 | /* Deprecated: use smp_call_function_many() which uses a cpumask ptr. */ | ||
65 | int smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info, | 68 | int smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info, |
66 | int wait); | 69 | int wait); |
70 | |||
71 | static inline void smp_call_function_many(const struct cpumask *mask, | ||
72 | void (*func)(void *info), void *info, | ||
73 | int wait) | ||
74 | { | ||
75 | smp_call_function_mask(*mask, func, info, wait); | ||
76 | } | ||
77 | |||
67 | int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, | 78 | int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, |
68 | int wait); | 79 | int wait); |
69 | void __smp_call_function_single(int cpuid, struct call_single_data *data); | 80 | void __smp_call_function_single(int cpuid, struct call_single_data *data); |
diff --git a/include/linux/socket.h b/include/linux/socket.h index dc5086fe7736..20fc4bbfca42 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
@@ -190,7 +190,8 @@ struct ucred { | |||
190 | #define AF_IUCV 32 /* IUCV sockets */ | 190 | #define AF_IUCV 32 /* IUCV sockets */ |
191 | #define AF_RXRPC 33 /* RxRPC sockets */ | 191 | #define AF_RXRPC 33 /* RxRPC sockets */ |
192 | #define AF_ISDN 34 /* mISDN sockets */ | 192 | #define AF_ISDN 34 /* mISDN sockets */ |
193 | #define AF_MAX 35 /* For now.. */ | 193 | #define AF_PHONET 35 /* Phonet sockets */ |
194 | #define AF_MAX 36 /* For now.. */ | ||
194 | 195 | ||
195 | /* Protocol families, same as address families. */ | 196 | /* Protocol families, same as address families. */ |
196 | #define PF_UNSPEC AF_UNSPEC | 197 | #define PF_UNSPEC AF_UNSPEC |
@@ -227,6 +228,7 @@ struct ucred { | |||
227 | #define PF_IUCV AF_IUCV | 228 | #define PF_IUCV AF_IUCV |
228 | #define PF_RXRPC AF_RXRPC | 229 | #define PF_RXRPC AF_RXRPC |
229 | #define PF_ISDN AF_ISDN | 230 | #define PF_ISDN AF_ISDN |
231 | #define PF_PHONET AF_PHONET | ||
230 | #define PF_MAX AF_MAX | 232 | #define PF_MAX AF_MAX |
231 | 233 | ||
232 | /* Maximum queue length specifiable by listen. */ | 234 | /* Maximum queue length specifiable by listen. */ |
@@ -295,6 +297,7 @@ struct ucred { | |||
295 | #define SOL_RXRPC 272 | 297 | #define SOL_RXRPC 272 |
296 | #define SOL_PPPOL2TP 273 | 298 | #define SOL_PPPOL2TP 273 |
297 | #define SOL_BLUETOOTH 274 | 299 | #define SOL_BLUETOOTH 274 |
300 | #define SOL_PNPIPE 275 | ||
298 | 301 | ||
299 | /* IPX options */ | 302 | /* IPX options */ |
300 | #define IPX_TYPE 1 | 303 | #define IPX_TYPE 1 |
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h index daf744017a31..05eab2f11e63 100644 --- a/include/linux/spi/ads7846.h +++ b/include/linux/spi/ads7846.h | |||
@@ -43,6 +43,9 @@ struct ads7846_platform_data { | |||
43 | u16 debounce_tol; /* tolerance used for filtering */ | 43 | u16 debounce_tol; /* tolerance used for filtering */ |
44 | u16 debounce_rep; /* additional consecutive good readings | 44 | u16 debounce_rep; /* additional consecutive good readings |
45 | * required after the first two */ | 45 | * required after the first two */ |
46 | int gpio_pendown; /* the GPIO used to decide the pendown | ||
47 | * state if get_pendown_state == NULL | ||
48 | */ | ||
46 | int (*get_pendown_state)(void); | 49 | int (*get_pendown_state)(void); |
47 | int (*filter_init) (struct ads7846_platform_data *pdata, | 50 | int (*filter_init) (struct ads7846_platform_data *pdata, |
48 | void **filter_data); | 51 | void **filter_data); |
diff --git a/include/linux/spi/corgi_lcd.h b/include/linux/spi/corgi_lcd.h new file mode 100644 index 000000000000..6692b3418ccf --- /dev/null +++ b/include/linux/spi/corgi_lcd.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef __LINUX_SPI_CORGI_LCD_H | ||
2 | #define __LINUX_SPI_CORGI_LCD_H | ||
3 | |||
4 | #define CORGI_LCD_MODE_QVGA 1 | ||
5 | #define CORGI_LCD_MODE_VGA 2 | ||
6 | |||
7 | struct corgi_lcd_platform_data { | ||
8 | int init_mode; | ||
9 | int max_intensity; | ||
10 | int default_intensity; | ||
11 | int limit_mask; | ||
12 | |||
13 | int gpio_backlight_on; /* -1 if n/a */ | ||
14 | int gpio_backlight_cont; /* -1 if n/a */ | ||
15 | |||
16 | void (*notify)(int intensity); | ||
17 | void (*kick_battery)(void); | ||
18 | }; | ||
19 | |||
20 | #endif /* __LINUX_SPI_CORGI_LCD_H */ | ||
diff --git a/include/linux/spi/orion_spi.h b/include/linux/spi/orion_spi.h index b4d9fa6f797c..decf6d8c77b7 100644 --- a/include/linux/spi/orion_spi.h +++ b/include/linux/spi/orion_spi.h | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | struct orion_spi_info { | 12 | struct orion_spi_info { |
13 | u32 tclk; /* no <linux/clk.h> support yet */ | 13 | u32 tclk; /* no <linux/clk.h> support yet */ |
14 | u32 enable_clock_fix; | ||
14 | }; | 15 | }; |
15 | 16 | ||
16 | 17 | ||
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h index b8db32cea1de..bf8de281b4ed 100644 --- a/include/linux/spi/spi_bitbang.h +++ b/include/linux/spi/spi_bitbang.h | |||
@@ -18,6 +18,9 @@ | |||
18 | * duplex (MicroWire) controllers. Provide chipslect() and txrx_bufs(), | 18 | * duplex (MicroWire) controllers. Provide chipslect() and txrx_bufs(), |
19 | * and custom setup()/cleanup() methods. | 19 | * and custom setup()/cleanup() methods. |
20 | */ | 20 | */ |
21 | |||
22 | #include <linux/workqueue.h> | ||
23 | |||
21 | struct spi_bitbang { | 24 | struct spi_bitbang { |
22 | struct workqueue_struct *workqueue; | 25 | struct workqueue_struct *workqueue; |
23 | struct work_struct work; | 26 | struct work_struct work; |
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index e530026eedf7..17d9b58f6379 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h | |||
@@ -427,12 +427,16 @@ static inline int ssb_dma_mapping_error(struct ssb_device *dev, dma_addr_t addr) | |||
427 | { | 427 | { |
428 | switch (dev->bus->bustype) { | 428 | switch (dev->bus->bustype) { |
429 | case SSB_BUSTYPE_PCI: | 429 | case SSB_BUSTYPE_PCI: |
430 | #ifdef CONFIG_SSB_PCIHOST | ||
430 | return pci_dma_mapping_error(dev->bus->host_pci, addr); | 431 | return pci_dma_mapping_error(dev->bus->host_pci, addr); |
432 | #endif | ||
433 | break; | ||
431 | case SSB_BUSTYPE_SSB: | 434 | case SSB_BUSTYPE_SSB: |
432 | return dma_mapping_error(dev->dev, addr); | 435 | return dma_mapping_error(dev->dev, addr); |
433 | default: | 436 | default: |
434 | __ssb_dma_not_implemented(dev); | 437 | break; |
435 | } | 438 | } |
439 | __ssb_dma_not_implemented(dev); | ||
436 | return -ENOSYS; | 440 | return -ENOSYS; |
437 | } | 441 | } |
438 | 442 | ||
@@ -441,12 +445,16 @@ static inline dma_addr_t ssb_dma_map_single(struct ssb_device *dev, void *p, | |||
441 | { | 445 | { |
442 | switch (dev->bus->bustype) { | 446 | switch (dev->bus->bustype) { |
443 | case SSB_BUSTYPE_PCI: | 447 | case SSB_BUSTYPE_PCI: |
448 | #ifdef CONFIG_SSB_PCIHOST | ||
444 | return pci_map_single(dev->bus->host_pci, p, size, dir); | 449 | return pci_map_single(dev->bus->host_pci, p, size, dir); |
450 | #endif | ||
451 | break; | ||
445 | case SSB_BUSTYPE_SSB: | 452 | case SSB_BUSTYPE_SSB: |
446 | return dma_map_single(dev->dev, p, size, dir); | 453 | return dma_map_single(dev->dev, p, size, dir); |
447 | default: | 454 | default: |
448 | __ssb_dma_not_implemented(dev); | 455 | break; |
449 | } | 456 | } |
457 | __ssb_dma_not_implemented(dev); | ||
450 | return 0; | 458 | return 0; |
451 | } | 459 | } |
452 | 460 | ||
@@ -455,14 +463,18 @@ static inline void ssb_dma_unmap_single(struct ssb_device *dev, dma_addr_t dma_a | |||
455 | { | 463 | { |
456 | switch (dev->bus->bustype) { | 464 | switch (dev->bus->bustype) { |
457 | case SSB_BUSTYPE_PCI: | 465 | case SSB_BUSTYPE_PCI: |
466 | #ifdef CONFIG_SSB_PCIHOST | ||
458 | pci_unmap_single(dev->bus->host_pci, dma_addr, size, dir); | 467 | pci_unmap_single(dev->bus->host_pci, dma_addr, size, dir); |
459 | return; | 468 | return; |
469 | #endif | ||
470 | break; | ||
460 | case SSB_BUSTYPE_SSB: | 471 | case SSB_BUSTYPE_SSB: |
461 | dma_unmap_single(dev->dev, dma_addr, size, dir); | 472 | dma_unmap_single(dev->dev, dma_addr, size, dir); |
462 | return; | 473 | return; |
463 | default: | 474 | default: |
464 | __ssb_dma_not_implemented(dev); | 475 | break; |
465 | } | 476 | } |
477 | __ssb_dma_not_implemented(dev); | ||
466 | } | 478 | } |
467 | 479 | ||
468 | static inline void ssb_dma_sync_single_for_cpu(struct ssb_device *dev, | 480 | static inline void ssb_dma_sync_single_for_cpu(struct ssb_device *dev, |
@@ -472,15 +484,19 @@ static inline void ssb_dma_sync_single_for_cpu(struct ssb_device *dev, | |||
472 | { | 484 | { |
473 | switch (dev->bus->bustype) { | 485 | switch (dev->bus->bustype) { |
474 | case SSB_BUSTYPE_PCI: | 486 | case SSB_BUSTYPE_PCI: |
487 | #ifdef CONFIG_SSB_PCIHOST | ||
475 | pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr, | 488 | pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr, |
476 | size, dir); | 489 | size, dir); |
477 | return; | 490 | return; |
491 | #endif | ||
492 | break; | ||
478 | case SSB_BUSTYPE_SSB: | 493 | case SSB_BUSTYPE_SSB: |
479 | dma_sync_single_for_cpu(dev->dev, dma_addr, size, dir); | 494 | dma_sync_single_for_cpu(dev->dev, dma_addr, size, dir); |
480 | return; | 495 | return; |
481 | default: | 496 | default: |
482 | __ssb_dma_not_implemented(dev); | 497 | break; |
483 | } | 498 | } |
499 | __ssb_dma_not_implemented(dev); | ||
484 | } | 500 | } |
485 | 501 | ||
486 | static inline void ssb_dma_sync_single_for_device(struct ssb_device *dev, | 502 | static inline void ssb_dma_sync_single_for_device(struct ssb_device *dev, |
@@ -490,15 +506,19 @@ static inline void ssb_dma_sync_single_for_device(struct ssb_device *dev, | |||
490 | { | 506 | { |
491 | switch (dev->bus->bustype) { | 507 | switch (dev->bus->bustype) { |
492 | case SSB_BUSTYPE_PCI: | 508 | case SSB_BUSTYPE_PCI: |
509 | #ifdef CONFIG_SSB_PCIHOST | ||
493 | pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr, | 510 | pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr, |
494 | size, dir); | 511 | size, dir); |
495 | return; | 512 | return; |
513 | #endif | ||
514 | break; | ||
496 | case SSB_BUSTYPE_SSB: | 515 | case SSB_BUSTYPE_SSB: |
497 | dma_sync_single_for_device(dev->dev, dma_addr, size, dir); | 516 | dma_sync_single_for_device(dev->dev, dma_addr, size, dir); |
498 | return; | 517 | return; |
499 | default: | 518 | default: |
500 | __ssb_dma_not_implemented(dev); | 519 | break; |
501 | } | 520 | } |
521 | __ssb_dma_not_implemented(dev); | ||
502 | } | 522 | } |
503 | 523 | ||
504 | static inline void ssb_dma_sync_single_range_for_cpu(struct ssb_device *dev, | 524 | static inline void ssb_dma_sync_single_range_for_cpu(struct ssb_device *dev, |
@@ -509,17 +529,21 @@ static inline void ssb_dma_sync_single_range_for_cpu(struct ssb_device *dev, | |||
509 | { | 529 | { |
510 | switch (dev->bus->bustype) { | 530 | switch (dev->bus->bustype) { |
511 | case SSB_BUSTYPE_PCI: | 531 | case SSB_BUSTYPE_PCI: |
532 | #ifdef CONFIG_SSB_PCIHOST | ||
512 | /* Just sync everything. That's all the PCI API can do. */ | 533 | /* Just sync everything. That's all the PCI API can do. */ |
513 | pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr, | 534 | pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr, |
514 | offset + size, dir); | 535 | offset + size, dir); |
515 | return; | 536 | return; |
537 | #endif | ||
538 | break; | ||
516 | case SSB_BUSTYPE_SSB: | 539 | case SSB_BUSTYPE_SSB: |
517 | dma_sync_single_range_for_cpu(dev->dev, dma_addr, offset, | 540 | dma_sync_single_range_for_cpu(dev->dev, dma_addr, offset, |
518 | size, dir); | 541 | size, dir); |
519 | return; | 542 | return; |
520 | default: | 543 | default: |
521 | __ssb_dma_not_implemented(dev); | 544 | break; |
522 | } | 545 | } |
546 | __ssb_dma_not_implemented(dev); | ||
523 | } | 547 | } |
524 | 548 | ||
525 | static inline void ssb_dma_sync_single_range_for_device(struct ssb_device *dev, | 549 | static inline void ssb_dma_sync_single_range_for_device(struct ssb_device *dev, |
@@ -530,17 +554,21 @@ static inline void ssb_dma_sync_single_range_for_device(struct ssb_device *dev, | |||
530 | { | 554 | { |
531 | switch (dev->bus->bustype) { | 555 | switch (dev->bus->bustype) { |
532 | case SSB_BUSTYPE_PCI: | 556 | case SSB_BUSTYPE_PCI: |
557 | #ifdef CONFIG_SSB_PCIHOST | ||
533 | /* Just sync everything. That's all the PCI API can do. */ | 558 | /* Just sync everything. That's all the PCI API can do. */ |
534 | pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr, | 559 | pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr, |
535 | offset + size, dir); | 560 | offset + size, dir); |
536 | return; | 561 | return; |
562 | #endif | ||
563 | break; | ||
537 | case SSB_BUSTYPE_SSB: | 564 | case SSB_BUSTYPE_SSB: |
538 | dma_sync_single_range_for_device(dev->dev, dma_addr, offset, | 565 | dma_sync_single_range_for_device(dev->dev, dma_addr, offset, |
539 | size, dir); | 566 | size, dir); |
540 | return; | 567 | return; |
541 | default: | 568 | default: |
542 | __ssb_dma_not_implemented(dev); | 569 | break; |
543 | } | 570 | } |
571 | __ssb_dma_not_implemented(dev); | ||
544 | } | 572 | } |
545 | 573 | ||
546 | 574 | ||
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h index ebad0bac9801..99a0f991e850 100644 --- a/include/linux/ssb/ssb_regs.h +++ b/include/linux/ssb/ssb_regs.h | |||
@@ -245,8 +245,6 @@ | |||
245 | 245 | ||
246 | /* SPROM Revision 3 (inherits most data from rev 2) */ | 246 | /* SPROM Revision 3 (inherits most data from rev 2) */ |
247 | #define SSB_SPROM3_IL0MAC 0x104A /* 6 bytes MAC address for 802.11b/g */ | 247 | #define SSB_SPROM3_IL0MAC 0x104A /* 6 bytes MAC address for 802.11b/g */ |
248 | #define SSB_SPROM3_ET0MAC 0x1050 /* 6 bytes MAC address for Ethernet ?? */ | ||
249 | #define SSB_SPROM3_ET1MAC 0x1050 /* 6 bytes MAC address for 802.11a ?? */ | ||
250 | #define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */ | 248 | #define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */ |
251 | #define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */ | 249 | #define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */ |
252 | #define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */ | 250 | #define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */ |
@@ -267,8 +265,6 @@ | |||
267 | 265 | ||
268 | /* SPROM Revision 4 */ | 266 | /* SPROM Revision 4 */ |
269 | #define SSB_SPROM4_IL0MAC 0x104C /* 6 byte MAC address for a/b/g/n */ | 267 | #define SSB_SPROM4_IL0MAC 0x104C /* 6 byte MAC address for a/b/g/n */ |
270 | #define SSB_SPROM4_ET0MAC 0x1018 /* 6 bytes MAC address for Ethernet ?? */ | ||
271 | #define SSB_SPROM4_ET1MAC 0x1018 /* 6 bytes MAC address for 802.11a ?? */ | ||
272 | #define SSB_SPROM4_ETHPHY 0x105A /* Ethernet PHY settings ?? */ | 268 | #define SSB_SPROM4_ETHPHY 0x105A /* Ethernet PHY settings ?? */ |
273 | #define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */ | 269 | #define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */ |
274 | #define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */ | 270 | #define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */ |
@@ -316,6 +312,21 @@ | |||
316 | #define SSB_SPROM4_PA1B1 0x1090 | 312 | #define SSB_SPROM4_PA1B1 0x1090 |
317 | #define SSB_SPROM4_PA1B2 0x1092 | 313 | #define SSB_SPROM4_PA1B2 0x1092 |
318 | 314 | ||
315 | /* SPROM Revision 5 (inherits most data from rev 4) */ | ||
316 | #define SSB_SPROM5_BFLLO 0x104A /* Boardflags (low 16 bits) */ | ||
317 | #define SSB_SPROM5_BFLHI 0x104C /* Board Flags Hi */ | ||
318 | #define SSB_SPROM5_IL0MAC 0x1052 /* 6 byte MAC address for a/b/g/n */ | ||
319 | #define SSB_SPROM5_CCODE 0x1044 /* Country Code (2 bytes) */ | ||
320 | #define SSB_SPROM5_GPIOA 0x1076 /* Gen. Purpose IO # 0 and 1 */ | ||
321 | #define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */ | ||
322 | #define SSB_SPROM5_GPIOA_P1 0xFF00 /* Pin 1 */ | ||
323 | #define SSB_SPROM5_GPIOA_P1_SHIFT 8 | ||
324 | #define SSB_SPROM5_GPIOB 0x1078 /* Gen. Purpose IO # 2 and 3 */ | ||
325 | #define SSB_SPROM5_GPIOB_P2 0x00FF /* Pin 2 */ | ||
326 | #define SSB_SPROM5_GPIOB_P3 0xFF00 /* Pin 3 */ | ||
327 | #define SSB_SPROM5_GPIOB_P3_SHIFT 8 | ||
328 | |||
329 | |||
319 | /* Values for SSB_SPROM1_BINF_CCODE */ | 330 | /* Values for SSB_SPROM1_BINF_CCODE */ |
320 | enum { | 331 | enum { |
321 | SSB_SPROM1CCODE_WORLD = 0, | 332 | SSB_SPROM1CCODE_WORLD = 0, |
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h index 5da9794b2d78..b106fd8e0d5c 100644 --- a/include/linux/stacktrace.h +++ b/include/linux/stacktrace.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef __LINUX_STACKTRACE_H | 1 | #ifndef __LINUX_STACKTRACE_H |
2 | #define __LINUX_STACKTRACE_H | 2 | #define __LINUX_STACKTRACE_H |
3 | 3 | ||
4 | struct task_struct; | ||
5 | |||
4 | #ifdef CONFIG_STACKTRACE | 6 | #ifdef CONFIG_STACKTRACE |
5 | struct stack_trace { | 7 | struct stack_trace { |
6 | unsigned int nr_entries, max_entries; | 8 | unsigned int nr_entries, max_entries; |
diff --git a/include/linux/string.h b/include/linux/string.h index 810d80df0a1d..d18fc198aa2f 100644 --- a/include/linux/string.h +++ b/include/linux/string.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef _LINUX_STRING_H_ | 1 | #ifndef _LINUX_STRING_H_ |
2 | #define _LINUX_STRING_H_ | 2 | #define _LINUX_STRING_H_ |
3 | 3 | ||
4 | /* We don't want strings.h stuff being user by user stuff by accident */ | 4 | /* We don't want strings.h stuff being used by user stuff by accident */ |
5 | 5 | ||
6 | #ifndef __KERNEL__ | 6 | #ifndef __KERNEL__ |
7 | #include <string.h> | 7 | #include <string.h> |
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h new file mode 100644 index 000000000000..a3eb2f65b656 --- /dev/null +++ b/include/linux/string_helpers.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _LINUX_STRING_HELPERS_H_ | ||
2 | #define _LINUX_STRING_HELPERS_H_ | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* Descriptions of the types of units to | ||
7 | * print in */ | ||
8 | enum string_size_units { | ||
9 | STRING_UNITS_10, /* use powers of 10^3 (standard SI) */ | ||
10 | STRING_UNITS_2, /* use binary powers of 2^10 */ | ||
11 | }; | ||
12 | |||
13 | int string_get_size(u64 size, enum string_size_units units, | ||
14 | char *buf, int len); | ||
15 | |||
16 | #endif | ||
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index e5bfe01ee305..6f0ee1b84a4f 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -104,6 +104,7 @@ struct rpc_create_args { | |||
104 | const struct rpc_timeout *timeout; | 104 | const struct rpc_timeout *timeout; |
105 | char *servername; | 105 | char *servername; |
106 | struct rpc_program *program; | 106 | struct rpc_program *program; |
107 | u32 prognumber; /* overrides program->number */ | ||
107 | u32 version; | 108 | u32 version; |
108 | rpc_authflavor_t authflavor; | 109 | rpc_authflavor_t authflavor; |
109 | unsigned long flags; | 110 | unsigned long flags; |
@@ -124,10 +125,10 @@ struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); | |||
124 | void rpc_shutdown_client(struct rpc_clnt *); | 125 | void rpc_shutdown_client(struct rpc_clnt *); |
125 | void rpc_release_client(struct rpc_clnt *); | 126 | void rpc_release_client(struct rpc_clnt *); |
126 | 127 | ||
127 | int rpcb_register(u32, u32, int, unsigned short, int *); | 128 | int rpcb_register(u32, u32, int, unsigned short); |
128 | int rpcb_v4_register(const u32 program, const u32 version, | 129 | int rpcb_v4_register(const u32 program, const u32 version, |
129 | const struct sockaddr *address, | 130 | const struct sockaddr *address, |
130 | const char *netid, int *result); | 131 | const char *netid); |
131 | int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int); | 132 | int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int); |
132 | void rpcb_getport_async(struct rpc_task *); | 133 | void rpcb_getport_async(struct rpc_task *); |
133 | 134 | ||
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index dc69068d94c7..3afe7fb403b2 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
@@ -66,6 +66,7 @@ struct svc_serv { | |||
66 | struct list_head sv_tempsocks; /* all temporary sockets */ | 66 | struct list_head sv_tempsocks; /* all temporary sockets */ |
67 | int sv_tmpcnt; /* count of temporary sockets */ | 67 | int sv_tmpcnt; /* count of temporary sockets */ |
68 | struct timer_list sv_temptimer; /* timer for aging temporary sockets */ | 68 | struct timer_list sv_temptimer; /* timer for aging temporary sockets */ |
69 | sa_family_t sv_family; /* listener's address family */ | ||
69 | 70 | ||
70 | char * sv_name; /* service name */ | 71 | char * sv_name; /* service name */ |
71 | 72 | ||
@@ -265,17 +266,17 @@ struct svc_rqst { | |||
265 | /* | 266 | /* |
266 | * Rigorous type checking on sockaddr type conversions | 267 | * Rigorous type checking on sockaddr type conversions |
267 | */ | 268 | */ |
268 | static inline struct sockaddr_in *svc_addr_in(struct svc_rqst *rqst) | 269 | static inline struct sockaddr_in *svc_addr_in(const struct svc_rqst *rqst) |
269 | { | 270 | { |
270 | return (struct sockaddr_in *) &rqst->rq_addr; | 271 | return (struct sockaddr_in *) &rqst->rq_addr; |
271 | } | 272 | } |
272 | 273 | ||
273 | static inline struct sockaddr_in6 *svc_addr_in6(struct svc_rqst *rqst) | 274 | static inline struct sockaddr_in6 *svc_addr_in6(const struct svc_rqst *rqst) |
274 | { | 275 | { |
275 | return (struct sockaddr_in6 *) &rqst->rq_addr; | 276 | return (struct sockaddr_in6 *) &rqst->rq_addr; |
276 | } | 277 | } |
277 | 278 | ||
278 | static inline struct sockaddr *svc_addr(struct svc_rqst *rqst) | 279 | static inline struct sockaddr *svc_addr(const struct svc_rqst *rqst) |
279 | { | 280 | { |
280 | return (struct sockaddr *) &rqst->rq_addr; | 281 | return (struct sockaddr *) &rqst->rq_addr; |
281 | } | 282 | } |
@@ -381,18 +382,20 @@ struct svc_procedure { | |||
381 | /* | 382 | /* |
382 | * Function prototypes. | 383 | * Function prototypes. |
383 | */ | 384 | */ |
384 | struct svc_serv * svc_create(struct svc_program *, unsigned int, | 385 | struct svc_serv *svc_create(struct svc_program *, unsigned int, sa_family_t, |
385 | void (*shutdown)(struct svc_serv*)); | 386 | void (*shutdown)(struct svc_serv *)); |
386 | struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, | 387 | struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, |
387 | struct svc_pool *pool); | 388 | struct svc_pool *pool); |
388 | void svc_exit_thread(struct svc_rqst *); | 389 | void svc_exit_thread(struct svc_rqst *); |
389 | struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, | 390 | struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, |
390 | void (*shutdown)(struct svc_serv*), svc_thread_fn, | 391 | sa_family_t, void (*shutdown)(struct svc_serv *), |
391 | struct module *); | 392 | svc_thread_fn, struct module *); |
392 | int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); | 393 | int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); |
393 | void svc_destroy(struct svc_serv *); | 394 | void svc_destroy(struct svc_serv *); |
394 | int svc_process(struct svc_rqst *); | 395 | int svc_process(struct svc_rqst *); |
395 | int svc_register(struct svc_serv *, int, unsigned short); | 396 | int svc_register(const struct svc_serv *, const unsigned short, |
397 | const unsigned short); | ||
398 | |||
396 | void svc_wake_up(struct svc_serv *); | 399 | void svc_wake_up(struct svc_serv *); |
397 | void svc_reserve(struct svc_rqst *rqstp, int space); | 400 | void svc_reserve(struct svc_rqst *rqstp, int space); |
398 | struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); | 401 | struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); |
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h index dc05b54bd3a3..c14fe86dac59 100644 --- a/include/linux/sunrpc/svc_rdma.h +++ b/include/linux/sunrpc/svc_rdma.h | |||
@@ -72,6 +72,7 @@ extern atomic_t rdma_stat_sq_prod; | |||
72 | */ | 72 | */ |
73 | struct svc_rdma_op_ctxt { | 73 | struct svc_rdma_op_ctxt { |
74 | struct svc_rdma_op_ctxt *read_hdr; | 74 | struct svc_rdma_op_ctxt *read_hdr; |
75 | struct svc_rdma_fastreg_mr *frmr; | ||
75 | int hdr_count; | 76 | int hdr_count; |
76 | struct xdr_buf arg; | 77 | struct xdr_buf arg; |
77 | struct list_head dto_q; | 78 | struct list_head dto_q; |
@@ -103,16 +104,30 @@ struct svc_rdma_chunk_sge { | |||
103 | int start; /* sge no for this chunk */ | 104 | int start; /* sge no for this chunk */ |
104 | int count; /* sge count for this chunk */ | 105 | int count; /* sge count for this chunk */ |
105 | }; | 106 | }; |
107 | struct svc_rdma_fastreg_mr { | ||
108 | struct ib_mr *mr; | ||
109 | void *kva; | ||
110 | struct ib_fast_reg_page_list *page_list; | ||
111 | int page_list_len; | ||
112 | unsigned long access_flags; | ||
113 | unsigned long map_len; | ||
114 | enum dma_data_direction direction; | ||
115 | struct list_head frmr_list; | ||
116 | }; | ||
106 | struct svc_rdma_req_map { | 117 | struct svc_rdma_req_map { |
118 | struct svc_rdma_fastreg_mr *frmr; | ||
107 | unsigned long count; | 119 | unsigned long count; |
108 | union { | 120 | union { |
109 | struct kvec sge[RPCSVC_MAXPAGES]; | 121 | struct kvec sge[RPCSVC_MAXPAGES]; |
110 | struct svc_rdma_chunk_sge ch[RPCSVC_MAXPAGES]; | 122 | struct svc_rdma_chunk_sge ch[RPCSVC_MAXPAGES]; |
111 | }; | 123 | }; |
112 | }; | 124 | }; |
113 | 125 | #define RDMACTXT_F_FAST_UNREG 1 | |
114 | #define RDMACTXT_F_LAST_CTXT 2 | 126 | #define RDMACTXT_F_LAST_CTXT 2 |
115 | 127 | ||
128 | #define SVCRDMA_DEVCAP_FAST_REG 1 /* fast mr registration */ | ||
129 | #define SVCRDMA_DEVCAP_READ_W_INV 2 /* read w/ invalidate */ | ||
130 | |||
116 | struct svcxprt_rdma { | 131 | struct svcxprt_rdma { |
117 | struct svc_xprt sc_xprt; /* SVC transport structure */ | 132 | struct svc_xprt sc_xprt; /* SVC transport structure */ |
118 | struct rdma_cm_id *sc_cm_id; /* RDMA connection id */ | 133 | struct rdma_cm_id *sc_cm_id; /* RDMA connection id */ |
@@ -136,6 +151,11 @@ struct svcxprt_rdma { | |||
136 | struct ib_cq *sc_rq_cq; | 151 | struct ib_cq *sc_rq_cq; |
137 | struct ib_cq *sc_sq_cq; | 152 | struct ib_cq *sc_sq_cq; |
138 | struct ib_mr *sc_phys_mr; /* MR for server memory */ | 153 | struct ib_mr *sc_phys_mr; /* MR for server memory */ |
154 | u32 sc_dev_caps; /* distilled device caps */ | ||
155 | u32 sc_dma_lkey; /* local dma key */ | ||
156 | unsigned int sc_frmr_pg_list_len; | ||
157 | struct list_head sc_frmr_q; | ||
158 | spinlock_t sc_frmr_q_lock; | ||
139 | 159 | ||
140 | spinlock_t sc_lock; /* transport lock */ | 160 | spinlock_t sc_lock; /* transport lock */ |
141 | 161 | ||
@@ -192,8 +212,13 @@ extern int svc_rdma_post_recv(struct svcxprt_rdma *); | |||
192 | extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *); | 212 | extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *); |
193 | extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *); | 213 | extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *); |
194 | extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int); | 214 | extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int); |
215 | extern void svc_rdma_unmap_dma(struct svc_rdma_op_ctxt *ctxt); | ||
195 | extern struct svc_rdma_req_map *svc_rdma_get_req_map(void); | 216 | extern struct svc_rdma_req_map *svc_rdma_get_req_map(void); |
196 | extern void svc_rdma_put_req_map(struct svc_rdma_req_map *); | 217 | extern void svc_rdma_put_req_map(struct svc_rdma_req_map *); |
218 | extern int svc_rdma_fastreg(struct svcxprt_rdma *, struct svc_rdma_fastreg_mr *); | ||
219 | extern struct svc_rdma_fastreg_mr *svc_rdma_get_frmr(struct svcxprt_rdma *); | ||
220 | extern void svc_rdma_put_frmr(struct svcxprt_rdma *, | ||
221 | struct svc_rdma_fastreg_mr *); | ||
197 | extern void svc_sq_reap(struct svcxprt_rdma *); | 222 | extern void svc_sq_reap(struct svcxprt_rdma *); |
198 | extern void svc_rq_reap(struct svcxprt_rdma *); | 223 | extern void svc_rq_reap(struct svcxprt_rdma *); |
199 | extern struct svc_xprt_class svc_rdma_class; | 224 | extern struct svc_xprt_class svc_rdma_class; |
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h index 8cff696dedf5..483e10380aae 100644 --- a/include/linux/sunrpc/svcsock.h +++ b/include/linux/sunrpc/svcsock.h | |||
@@ -39,10 +39,7 @@ int svc_send(struct svc_rqst *); | |||
39 | void svc_drop(struct svc_rqst *); | 39 | void svc_drop(struct svc_rqst *); |
40 | void svc_sock_update_bufs(struct svc_serv *serv); | 40 | void svc_sock_update_bufs(struct svc_serv *serv); |
41 | int svc_sock_names(char *buf, struct svc_serv *serv, char *toclose); | 41 | int svc_sock_names(char *buf, struct svc_serv *serv, char *toclose); |
42 | int svc_addsock(struct svc_serv *serv, | 42 | int svc_addsock(struct svc_serv *serv, int fd, char *name_return); |
43 | int fd, | ||
44 | char *name_return, | ||
45 | int *proto); | ||
46 | void svc_init_xprt_sock(void); | 43 | void svc_init_xprt_sock(void); |
47 | void svc_cleanup_xprt_sock(void); | 44 | void svc_cleanup_xprt_sock(void); |
48 | 45 | ||
diff --git a/include/linux/sunrpc/xprtrdma.h b/include/linux/sunrpc/xprtrdma.h index 4de56b1d372b..54a379c9e8eb 100644 --- a/include/linux/sunrpc/xprtrdma.h +++ b/include/linux/sunrpc/xprtrdma.h | |||
@@ -66,9 +66,6 @@ | |||
66 | 66 | ||
67 | #define RPCRDMA_INLINE_PAD_THRESH (512)/* payload threshold to pad (bytes) */ | 67 | #define RPCRDMA_INLINE_PAD_THRESH (512)/* payload threshold to pad (bytes) */ |
68 | 68 | ||
69 | #define RDMA_RESOLVE_TIMEOUT (5*HZ) /* TBD 5 seconds */ | ||
70 | #define RDMA_CONNECT_RETRY_MAX (2) /* retries if no listener backlog */ | ||
71 | |||
72 | /* memory registration strategies */ | 69 | /* memory registration strategies */ |
73 | #define RPCRDMA_PERSISTENT_REGISTRATION (1) | 70 | #define RPCRDMA_PERSISTENT_REGISTRATION (1) |
74 | 71 | ||
@@ -78,6 +75,7 @@ enum rpcrdma_memreg { | |||
78 | RPCRDMA_MEMWINDOWS, | 75 | RPCRDMA_MEMWINDOWS, |
79 | RPCRDMA_MEMWINDOWS_ASYNC, | 76 | RPCRDMA_MEMWINDOWS_ASYNC, |
80 | RPCRDMA_MTHCAFMR, | 77 | RPCRDMA_MTHCAFMR, |
78 | RPCRDMA_FRMR, | ||
81 | RPCRDMA_ALLPHYSICAL, | 79 | RPCRDMA_ALLPHYSICAL, |
82 | RPCRDMA_LAST | 80 | RPCRDMA_LAST |
83 | }; | 81 | }; |
diff --git a/include/linux/swab.h b/include/linux/swab.h index 270d5c208a89..bbed279f3b32 100644 --- a/include/linux/swab.h +++ b/include/linux/swab.h | |||
@@ -47,8 +47,6 @@ static inline __attribute_const__ __u16 ___swab16(__u16 val) | |||
47 | { | 47 | { |
48 | #ifdef __arch_swab16 | 48 | #ifdef __arch_swab16 |
49 | return __arch_swab16(val); | 49 | return __arch_swab16(val); |
50 | #elif defined(__arch_swab16p) | ||
51 | return __arch_swab16p(&val); | ||
52 | #else | 50 | #else |
53 | return __const_swab16(val); | 51 | return __const_swab16(val); |
54 | #endif | 52 | #endif |
@@ -58,8 +56,6 @@ static inline __attribute_const__ __u32 ___swab32(__u32 val) | |||
58 | { | 56 | { |
59 | #ifdef __arch_swab32 | 57 | #ifdef __arch_swab32 |
60 | return __arch_swab32(val); | 58 | return __arch_swab32(val); |
61 | #elif defined(__arch_swab32p) | ||
62 | return __arch_swab32p(&val); | ||
63 | #else | 59 | #else |
64 | return __const_swab32(val); | 60 | return __const_swab32(val); |
65 | #endif | 61 | #endif |
@@ -69,8 +65,6 @@ static inline __attribute_const__ __u64 ___swab64(__u64 val) | |||
69 | { | 65 | { |
70 | #ifdef __arch_swab64 | 66 | #ifdef __arch_swab64 |
71 | return __arch_swab64(val); | 67 | return __arch_swab64(val); |
72 | #elif defined(__arch_swab64p) | ||
73 | return __arch_swab64p(&val); | ||
74 | #elif defined(__SWAB_64_THRU_32__) | 68 | #elif defined(__SWAB_64_THRU_32__) |
75 | __u32 h = val >> 32; | 69 | __u32 h = val >> 32; |
76 | __u32 l = val & ((1ULL << 32) - 1); | 70 | __u32 l = val & ((1ULL << 32) - 1); |
@@ -84,8 +78,6 @@ static inline __attribute_const__ __u32 ___swahw32(__u32 val) | |||
84 | { | 78 | { |
85 | #ifdef __arch_swahw32 | 79 | #ifdef __arch_swahw32 |
86 | return __arch_swahw32(val); | 80 | return __arch_swahw32(val); |
87 | #elif defined(__arch_swahw32p) | ||
88 | return __arch_swahw32p(&val); | ||
89 | #else | 81 | #else |
90 | return __const_swahw32(val); | 82 | return __const_swahw32(val); |
91 | #endif | 83 | #endif |
@@ -95,8 +87,6 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val) | |||
95 | { | 87 | { |
96 | #ifdef __arch_swahb32 | 88 | #ifdef __arch_swahb32 |
97 | return __arch_swahb32(val); | 89 | return __arch_swahb32(val); |
98 | #elif defined(__arch_swahb32p) | ||
99 | return __arch_swahb32p(&val); | ||
100 | #else | 90 | #else |
101 | return __const_swahb32(val); | 91 | return __const_swahb32(val); |
102 | #endif | 92 | #endif |
diff --git a/include/linux/swap.h b/include/linux/swap.h index de40f169a4e4..a3af95b2cb6d 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/list.h> | 7 | #include <linux/list.h> |
8 | #include <linux/memcontrol.h> | 8 | #include <linux/memcontrol.h> |
9 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
10 | #include <linux/node.h> | ||
10 | 11 | ||
11 | #include <asm/atomic.h> | 12 | #include <asm/atomic.h> |
12 | #include <asm/page.h> | 13 | #include <asm/page.h> |
@@ -171,8 +172,10 @@ extern unsigned int nr_free_pagecache_pages(void); | |||
171 | 172 | ||
172 | 173 | ||
173 | /* linux/mm/swap.c */ | 174 | /* linux/mm/swap.c */ |
174 | extern void lru_cache_add(struct page *); | 175 | extern void __lru_cache_add(struct page *, enum lru_list lru); |
175 | extern void lru_cache_add_active(struct page *); | 176 | extern void lru_cache_add_lru(struct page *, enum lru_list lru); |
177 | extern void lru_cache_add_active_or_unevictable(struct page *, | ||
178 | struct vm_area_struct *); | ||
176 | extern void activate_page(struct page *); | 179 | extern void activate_page(struct page *); |
177 | extern void mark_page_accessed(struct page *); | 180 | extern void mark_page_accessed(struct page *); |
178 | extern void lru_add_drain(void); | 181 | extern void lru_add_drain(void); |
@@ -180,12 +183,38 @@ extern int lru_add_drain_all(void); | |||
180 | extern void rotate_reclaimable_page(struct page *page); | 183 | extern void rotate_reclaimable_page(struct page *page); |
181 | extern void swap_setup(void); | 184 | extern void swap_setup(void); |
182 | 185 | ||
186 | extern void add_page_to_unevictable_list(struct page *page); | ||
187 | |||
188 | /** | ||
189 | * lru_cache_add: add a page to the page lists | ||
190 | * @page: the page to add | ||
191 | */ | ||
192 | static inline void lru_cache_add_anon(struct page *page) | ||
193 | { | ||
194 | __lru_cache_add(page, LRU_INACTIVE_ANON); | ||
195 | } | ||
196 | |||
197 | static inline void lru_cache_add_active_anon(struct page *page) | ||
198 | { | ||
199 | __lru_cache_add(page, LRU_ACTIVE_ANON); | ||
200 | } | ||
201 | |||
202 | static inline void lru_cache_add_file(struct page *page) | ||
203 | { | ||
204 | __lru_cache_add(page, LRU_INACTIVE_FILE); | ||
205 | } | ||
206 | |||
207 | static inline void lru_cache_add_active_file(struct page *page) | ||
208 | { | ||
209 | __lru_cache_add(page, LRU_ACTIVE_FILE); | ||
210 | } | ||
211 | |||
183 | /* linux/mm/vmscan.c */ | 212 | /* linux/mm/vmscan.c */ |
184 | extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, | 213 | extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, |
185 | gfp_t gfp_mask); | 214 | gfp_t gfp_mask); |
186 | extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, | 215 | extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, |
187 | gfp_t gfp_mask); | 216 | gfp_t gfp_mask); |
188 | extern int __isolate_lru_page(struct page *page, int mode); | 217 | extern int __isolate_lru_page(struct page *page, int mode, int file); |
189 | extern unsigned long shrink_all_memory(unsigned long nr_pages); | 218 | extern unsigned long shrink_all_memory(unsigned long nr_pages); |
190 | extern int vm_swappiness; | 219 | extern int vm_swappiness; |
191 | extern int remove_mapping(struct address_space *mapping, struct page *page); | 220 | extern int remove_mapping(struct address_space *mapping, struct page *page); |
@@ -204,6 +233,34 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order) | |||
204 | } | 233 | } |
205 | #endif | 234 | #endif |
206 | 235 | ||
236 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
237 | extern int page_evictable(struct page *page, struct vm_area_struct *vma); | ||
238 | extern void scan_mapping_unevictable_pages(struct address_space *); | ||
239 | |||
240 | extern unsigned long scan_unevictable_pages; | ||
241 | extern int scan_unevictable_handler(struct ctl_table *, int, struct file *, | ||
242 | void __user *, size_t *, loff_t *); | ||
243 | extern int scan_unevictable_register_node(struct node *node); | ||
244 | extern void scan_unevictable_unregister_node(struct node *node); | ||
245 | #else | ||
246 | static inline int page_evictable(struct page *page, | ||
247 | struct vm_area_struct *vma) | ||
248 | { | ||
249 | return 1; | ||
250 | } | ||
251 | |||
252 | static inline void scan_mapping_unevictable_pages(struct address_space *mapping) | ||
253 | { | ||
254 | } | ||
255 | |||
256 | static inline int scan_unevictable_register_node(struct node *node) | ||
257 | { | ||
258 | return 0; | ||
259 | } | ||
260 | |||
261 | static inline void scan_unevictable_unregister_node(struct node *node) { } | ||
262 | #endif | ||
263 | |||
207 | extern int kswapd_run(int nid); | 264 | extern int kswapd_run(int nid); |
208 | 265 | ||
209 | #ifdef CONFIG_MMU | 266 | #ifdef CONFIG_MMU |
@@ -251,6 +308,7 @@ extern sector_t swapdev_block(int, pgoff_t); | |||
251 | extern struct swap_info_struct *get_swap_info_struct(unsigned); | 308 | extern struct swap_info_struct *get_swap_info_struct(unsigned); |
252 | extern int can_share_swap_page(struct page *); | 309 | extern int can_share_swap_page(struct page *); |
253 | extern int remove_exclusive_swap_page(struct page *); | 310 | extern int remove_exclusive_swap_page(struct page *); |
311 | extern int remove_exclusive_swap_page_ref(struct page *); | ||
254 | struct backing_dev_info; | 312 | struct backing_dev_info; |
255 | 313 | ||
256 | /* linux/mm/thrash.c */ | 314 | /* linux/mm/thrash.c */ |
@@ -339,6 +397,11 @@ static inline int remove_exclusive_swap_page(struct page *p) | |||
339 | return 0; | 397 | return 0; |
340 | } | 398 | } |
341 | 399 | ||
400 | static inline int remove_exclusive_swap_page_ref(struct page *page) | ||
401 | { | ||
402 | return 0; | ||
403 | } | ||
404 | |||
342 | static inline swp_entry_t get_swap_page(void) | 405 | static inline swp_entry_t get_swap_page(void) |
343 | { | 406 | { |
344 | swp_entry_t entry; | 407 | swp_entry_t entry; |
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h new file mode 100644 index 000000000000..b18ec5533e8c --- /dev/null +++ b/include/linux/swiotlb.h | |||
@@ -0,0 +1,83 @@ | |||
1 | #ifndef __LINUX_SWIOTLB_H | ||
2 | #define __LINUX_SWIOTLB_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | struct device; | ||
7 | struct dma_attrs; | ||
8 | struct scatterlist; | ||
9 | |||
10 | extern void | ||
11 | swiotlb_init(void); | ||
12 | |||
13 | extern void | ||
14 | *swiotlb_alloc_coherent(struct device *hwdev, size_t size, | ||
15 | dma_addr_t *dma_handle, gfp_t flags); | ||
16 | |||
17 | extern void | ||
18 | swiotlb_free_coherent(struct device *hwdev, size_t size, | ||
19 | void *vaddr, dma_addr_t dma_handle); | ||
20 | |||
21 | extern dma_addr_t | ||
22 | swiotlb_map_single(struct device *hwdev, void *ptr, size_t size, int dir); | ||
23 | |||
24 | extern void | ||
25 | swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr, | ||
26 | size_t size, int dir); | ||
27 | |||
28 | extern dma_addr_t | ||
29 | swiotlb_map_single_attrs(struct device *hwdev, void *ptr, size_t size, | ||
30 | int dir, struct dma_attrs *attrs); | ||
31 | |||
32 | extern void | ||
33 | swiotlb_unmap_single_attrs(struct device *hwdev, dma_addr_t dev_addr, | ||
34 | size_t size, int dir, struct dma_attrs *attrs); | ||
35 | |||
36 | extern int | ||
37 | swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, | ||
38 | int direction); | ||
39 | |||
40 | extern void | ||
41 | swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents, | ||
42 | int direction); | ||
43 | |||
44 | extern int | ||
45 | swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems, | ||
46 | int dir, struct dma_attrs *attrs); | ||
47 | |||
48 | extern void | ||
49 | swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl, | ||
50 | int nelems, int dir, struct dma_attrs *attrs); | ||
51 | |||
52 | extern void | ||
53 | swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr, | ||
54 | size_t size, int dir); | ||
55 | |||
56 | extern void | ||
57 | swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg, | ||
58 | int nelems, int dir); | ||
59 | |||
60 | extern void | ||
61 | swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr, | ||
62 | size_t size, int dir); | ||
63 | |||
64 | extern void | ||
65 | swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg, | ||
66 | int nelems, int dir); | ||
67 | |||
68 | extern void | ||
69 | swiotlb_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dev_addr, | ||
70 | unsigned long offset, size_t size, int dir); | ||
71 | |||
72 | extern void | ||
73 | swiotlb_sync_single_range_for_device(struct device *hwdev, dma_addr_t dev_addr, | ||
74 | unsigned long offset, size_t size, | ||
75 | int dir); | ||
76 | |||
77 | extern int | ||
78 | swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr); | ||
79 | |||
80 | extern int | ||
81 | swiotlb_dma_supported(struct device *hwdev, u64 mask); | ||
82 | |||
83 | #endif /* __LINUX_SWIOTLB_H */ | ||
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index d6ff145919ca..04fb47bfb920 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -410,8 +410,7 @@ asmlinkage long sys_getsockopt(int fd, int level, int optname, | |||
410 | asmlinkage long sys_bind(int, struct sockaddr __user *, int); | 410 | asmlinkage long sys_bind(int, struct sockaddr __user *, int); |
411 | asmlinkage long sys_connect(int, struct sockaddr __user *, int); | 411 | asmlinkage long sys_connect(int, struct sockaddr __user *, int); |
412 | asmlinkage long sys_accept(int, struct sockaddr __user *, int __user *); | 412 | asmlinkage long sys_accept(int, struct sockaddr __user *, int __user *); |
413 | asmlinkage long sys_paccept(int, struct sockaddr __user *, int __user *, | 413 | asmlinkage long sys_accept4(int, struct sockaddr __user *, int __user *, int); |
414 | const __user sigset_t *, size_t, int); | ||
415 | asmlinkage long sys_getsockname(int, struct sockaddr __user *, int __user *); | 414 | asmlinkage long sys_getsockname(int, struct sockaddr __user *, int __user *); |
416 | asmlinkage long sys_getpeername(int, struct sockaddr __user *, int __user *); | 415 | asmlinkage long sys_getpeername(int, struct sockaddr __user *, int __user *); |
417 | asmlinkage long sys_send(int, void __user *, size_t, unsigned); | 416 | asmlinkage long sys_send(int, void __user *, size_t, unsigned); |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index d0437f36921f..39d471d1163b 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -972,7 +972,7 @@ extern int sysctl_perm(struct ctl_table_root *root, | |||
972 | 972 | ||
973 | typedef struct ctl_table ctl_table; | 973 | typedef struct ctl_table ctl_table; |
974 | 974 | ||
975 | typedef int ctl_handler (struct ctl_table *table, int __user *name, int nlen, | 975 | typedef int ctl_handler (struct ctl_table *table, |
976 | void __user *oldval, size_t __user *oldlenp, | 976 | void __user *oldval, size_t __user *oldlenp, |
977 | void __user *newval, size_t newlen); | 977 | void __user *newval, size_t newlen); |
978 | 978 | ||
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 37fa24152bd8..9d68fed50f11 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -21,8 +21,9 @@ struct kobject; | |||
21 | struct module; | 21 | struct module; |
22 | 22 | ||
23 | /* FIXME | 23 | /* FIXME |
24 | * The *owner field is no longer used, but leave around | 24 | * The *owner field is no longer used. |
25 | * until the tree gets cleaned up fully. | 25 | * x86 tree has been cleaned up. The owner |
26 | * attribute is still left for other arches. | ||
26 | */ | 27 | */ |
27 | struct attribute { | 28 | struct attribute { |
28 | const char *name; | 29 | const char *name; |
@@ -78,6 +79,8 @@ struct sysfs_ops { | |||
78 | ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); | 79 | ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); |
79 | }; | 80 | }; |
80 | 81 | ||
82 | struct sysfs_dirent; | ||
83 | |||
81 | #ifdef CONFIG_SYSFS | 84 | #ifdef CONFIG_SYSFS |
82 | 85 | ||
83 | int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), | 86 | int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), |
@@ -117,9 +120,14 @@ int sysfs_add_file_to_group(struct kobject *kobj, | |||
117 | void sysfs_remove_file_from_group(struct kobject *kobj, | 120 | void sysfs_remove_file_from_group(struct kobject *kobj, |
118 | const struct attribute *attr, const char *group); | 121 | const struct attribute *attr, const char *group); |
119 | 122 | ||
120 | void sysfs_notify(struct kobject *kobj, char *dir, char *attr); | 123 | void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); |
121 | 124 | void sysfs_notify_dirent(struct sysfs_dirent *sd); | |
122 | extern int __must_check sysfs_init(void); | 125 | struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, |
126 | const unsigned char *name); | ||
127 | struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd); | ||
128 | void sysfs_put(struct sysfs_dirent *sd); | ||
129 | void sysfs_printk_last_file(void); | ||
130 | int __must_check sysfs_init(void); | ||
123 | 131 | ||
124 | #else /* CONFIG_SYSFS */ | 132 | #else /* CONFIG_SYSFS */ |
125 | 133 | ||
@@ -222,7 +230,24 @@ static inline void sysfs_remove_file_from_group(struct kobject *kobj, | |||
222 | { | 230 | { |
223 | } | 231 | } |
224 | 232 | ||
225 | static inline void sysfs_notify(struct kobject *kobj, char *dir, char *attr) | 233 | static inline void sysfs_notify(struct kobject *kobj, const char *dir, |
234 | const char *attr) | ||
235 | { | ||
236 | } | ||
237 | static inline void sysfs_notify_dirent(struct sysfs_dirent *sd) | ||
238 | { | ||
239 | } | ||
240 | static inline | ||
241 | struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, | ||
242 | const unsigned char *name) | ||
243 | { | ||
244 | return NULL; | ||
245 | } | ||
246 | static inline struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd) | ||
247 | { | ||
248 | return NULL; | ||
249 | } | ||
250 | static inline void sysfs_put(struct sysfs_dirent *sd) | ||
226 | { | 251 | { |
227 | } | 252 | } |
228 | 253 | ||
@@ -231,6 +256,10 @@ static inline int __must_check sysfs_init(void) | |||
231 | return 0; | 256 | return 0; |
232 | } | 257 | } |
233 | 258 | ||
259 | static inline void sysfs_printk_last_file(void) | ||
260 | { | ||
261 | } | ||
262 | |||
234 | #endif /* CONFIG_SYSFS */ | 263 | #endif /* CONFIG_SYSFS */ |
235 | 264 | ||
236 | #endif /* _SYSFS_H_ */ | 265 | #endif /* _SYSFS_H_ */ |
diff --git a/include/linux/task_io_accounting.h b/include/linux/task_io_accounting.h index 5e88afc9a2fb..bdf855c2856f 100644 --- a/include/linux/task_io_accounting.h +++ b/include/linux/task_io_accounting.h | |||
@@ -5,7 +5,7 @@ | |||
5 | * Don't include this header file directly - it is designed to be dragged in via | 5 | * Don't include this header file directly - it is designed to be dragged in via |
6 | * sched.h. | 6 | * sched.h. |
7 | * | 7 | * |
8 | * Blame akpm@osdl.org for all this. | 8 | * Blame Andrew Morton for all this. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | struct task_io_accounting { | 11 | struct task_io_accounting { |
diff --git a/include/linux/tc_act/Kbuild b/include/linux/tc_act/Kbuild index 6dac0d7365cc..76990937f4c9 100644 --- a/include/linux/tc_act/Kbuild +++ b/include/linux/tc_act/Kbuild | |||
@@ -3,3 +3,4 @@ header-y += tc_ipt.h | |||
3 | header-y += tc_mirred.h | 3 | header-y += tc_mirred.h |
4 | header-y += tc_pedit.h | 4 | header-y += tc_pedit.h |
5 | header-y += tc_nat.h | 5 | header-y += tc_nat.h |
6 | header-y += tc_skbedit.h | ||
diff --git a/include/linux/tc_act/tc_skbedit.h b/include/linux/tc_act/tc_skbedit.h new file mode 100644 index 000000000000..a14e461a7af7 --- /dev/null +++ b/include/linux/tc_act/tc_skbedit.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2008, Intel Corporation. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License along with | ||
14 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
15 | * Place - Suite 330, Boston, MA 02111-1307 USA. | ||
16 | * | ||
17 | * Author: Alexander Duyck <alexander.h.duyck@intel.com> | ||
18 | */ | ||
19 | |||
20 | #ifndef __LINUX_TC_SKBEDIT_H | ||
21 | #define __LINUX_TC_SKBEDIT_H | ||
22 | |||
23 | #include <linux/pkt_cls.h> | ||
24 | |||
25 | #define TCA_ACT_SKBEDIT 11 | ||
26 | |||
27 | #define SKBEDIT_F_PRIORITY 0x1 | ||
28 | #define SKBEDIT_F_QUEUE_MAPPING 0x2 | ||
29 | |||
30 | struct tc_skbedit { | ||
31 | tc_gen; | ||
32 | }; | ||
33 | |||
34 | enum { | ||
35 | TCA_SKBEDIT_UNSPEC, | ||
36 | TCA_SKBEDIT_TM, | ||
37 | TCA_SKBEDIT_PARMS, | ||
38 | TCA_SKBEDIT_PRIORITY, | ||
39 | TCA_SKBEDIT_QUEUE_MAPPING, | ||
40 | __TCA_SKBEDIT_MAX | ||
41 | }; | ||
42 | #define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1) | ||
43 | |||
44 | #endif | ||
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 2e2557388e36..fe77e1499ab7 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -312,8 +312,11 @@ struct tcp_sock { | |||
312 | u32 retrans_out; /* Retransmitted packets out */ | 312 | u32 retrans_out; /* Retransmitted packets out */ |
313 | 313 | ||
314 | u16 urg_data; /* Saved octet of OOB data and control flags */ | 314 | u16 urg_data; /* Saved octet of OOB data and control flags */ |
315 | u8 urg_mode; /* In urgent mode */ | ||
316 | u8 ecn_flags; /* ECN status bits. */ | 315 | u8 ecn_flags; /* ECN status bits. */ |
316 | u8 reordering; /* Packet reordering metric. */ | ||
317 | u32 snd_up; /* Urgent pointer */ | ||
318 | |||
319 | u8 keepalive_probes; /* num of allowed keep alive probes */ | ||
317 | /* | 320 | /* |
318 | * Options received (usually on last packet, some only on SYN packets). | 321 | * Options received (usually on last packet, some only on SYN packets). |
319 | */ | 322 | */ |
@@ -342,7 +345,6 @@ struct tcp_sock { | |||
342 | struct sk_buff* lost_skb_hint; | 345 | struct sk_buff* lost_skb_hint; |
343 | struct sk_buff *scoreboard_skb_hint; | 346 | struct sk_buff *scoreboard_skb_hint; |
344 | struct sk_buff *retransmit_skb_hint; | 347 | struct sk_buff *retransmit_skb_hint; |
345 | struct sk_buff *forward_skb_hint; | ||
346 | 348 | ||
347 | struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ | 349 | struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ |
348 | 350 | ||
@@ -358,12 +360,10 @@ struct tcp_sock { | |||
358 | */ | 360 | */ |
359 | 361 | ||
360 | int lost_cnt_hint; | 362 | int lost_cnt_hint; |
361 | int retransmit_cnt_hint; | 363 | u32 retransmit_high; /* L-bits may be on up to this seqno */ |
362 | 364 | ||
363 | u32 lost_retrans_low; /* Sent seq after any rxmit (lowest) */ | 365 | u32 lost_retrans_low; /* Sent seq after any rxmit (lowest) */ |
364 | 366 | ||
365 | u8 reordering; /* Packet reordering metric. */ | ||
366 | u8 keepalive_probes; /* num of allowed keep alive probes */ | ||
367 | u32 prior_ssthresh; /* ssthresh saved at recovery start */ | 367 | u32 prior_ssthresh; /* ssthresh saved at recovery start */ |
368 | u32 high_seq; /* snd_nxt at onset of congestion */ | 368 | u32 high_seq; /* snd_nxt at onset of congestion */ |
369 | 369 | ||
@@ -375,8 +375,6 @@ struct tcp_sock { | |||
375 | u32 total_retrans; /* Total retransmits for entire connection */ | 375 | u32 total_retrans; /* Total retransmits for entire connection */ |
376 | 376 | ||
377 | u32 urg_seq; /* Seq of received urgent pointer */ | 377 | u32 urg_seq; /* Seq of received urgent pointer */ |
378 | u32 snd_up; /* Urgent pointer */ | ||
379 | |||
380 | unsigned int keepalive_time; /* time before keep alive takes place */ | 378 | unsigned int keepalive_time; /* time before keep alive takes place */ |
381 | unsigned int keepalive_intvl; /* time interval between keep alive probes */ | 379 | unsigned int keepalive_intvl; /* time interval between keep alive probes */ |
382 | 380 | ||
diff --git a/include/linux/telephony.h b/include/linux/telephony.h index 0d0cf2a1e7bc..f63afe330add 100644 --- a/include/linux/telephony.h +++ b/include/linux/telephony.h | |||
@@ -14,7 +14,7 @@ | |||
14 | * Authors: Ed Okerson, <eokerson@quicknet.net> | 14 | * Authors: Ed Okerson, <eokerson@quicknet.net> |
15 | * Greg Herlein, <gherlein@quicknet.net> | 15 | * Greg Herlein, <gherlein@quicknet.net> |
16 | * | 16 | * |
17 | * Contributors: Alan Cox, <alan@redhat.com> | 17 | * Contributors: Alan Cox, <alan@lxorguk.ukuu.org.uk> |
18 | * David W. Erhart, <derhart@quicknet.net> | 18 | * David W. Erhart, <derhart@quicknet.net> |
19 | * | 19 | * |
20 | * IN NO EVENT SHALL QUICKNET TECHNOLOGIES, INC. BE LIABLE TO ANY PARTY FOR | 20 | * IN NO EVENT SHALL QUICKNET TECHNOLOGIES, INC. BE LIABLE TO ANY PARTY FOR |
@@ -28,10 +28,6 @@ | |||
28 | * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION | 28 | * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION |
29 | * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 29 | * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
30 | * | 30 | * |
31 | * Version: $Revision: 4.2 $ | ||
32 | * | ||
33 | * $Id: telephony.h,v 4.2 2001/08/06 07:09:43 craigs Exp $ | ||
34 | * | ||
35 | *****************************************************************************/ | 31 | *****************************************************************************/ |
36 | 32 | ||
37 | #ifndef TELEPHONY_H | 33 | #ifndef TELEPHONY_H |
diff --git a/include/linux/termios.h b/include/linux/termios.h index 478662889f48..2acd0c1f8a2a 100644 --- a/include/linux/termios.h +++ b/include/linux/termios.h | |||
@@ -4,4 +4,19 @@ | |||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <asm/termios.h> | 5 | #include <asm/termios.h> |
6 | 6 | ||
7 | #define NFF 5 | ||
8 | |||
9 | struct termiox | ||
10 | { | ||
11 | __u16 x_hflag; | ||
12 | __u16 x_cflag; | ||
13 | __u16 x_rflag[NFF]; | ||
14 | __u16 x_sflag; | ||
15 | }; | ||
16 | |||
17 | #define RTSXOFF 0x0001 /* RTS flow control on input */ | ||
18 | #define CTSXON 0x0002 /* CTS flow control on output */ | ||
19 | #define DTRXOFF 0x0004 /* DTR flow control on input */ | ||
20 | #define DSRXON 0x0008 /* DCD flow control on output */ | ||
21 | |||
7 | #endif | 22 | #endif |
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index 38a56477f27a..e6b820f8b56b 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h | |||
@@ -38,6 +38,14 @@ struct restart_block { | |||
38 | #endif | 38 | #endif |
39 | u64 expires; | 39 | u64 expires; |
40 | } nanosleep; | 40 | } nanosleep; |
41 | /* For poll */ | ||
42 | struct { | ||
43 | struct pollfd __user *ufds; | ||
44 | int nfds; | ||
45 | int has_timeout; | ||
46 | unsigned long tv_sec; | ||
47 | unsigned long tv_nsec; | ||
48 | } poll; | ||
41 | }; | 49 | }; |
42 | }; | 50 | }; |
43 | 51 | ||
diff --git a/include/linux/tick.h b/include/linux/tick.h index 8cf8cfe2cc97..b6ec8189ac0c 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h | |||
@@ -96,9 +96,11 @@ extern cpumask_t *tick_get_broadcast_oneshot_mask(void); | |||
96 | extern void tick_clock_notify(void); | 96 | extern void tick_clock_notify(void); |
97 | extern int tick_check_oneshot_change(int allow_nohz); | 97 | extern int tick_check_oneshot_change(int allow_nohz); |
98 | extern struct tick_sched *tick_get_tick_sched(int cpu); | 98 | extern struct tick_sched *tick_get_tick_sched(int cpu); |
99 | extern void tick_check_idle(int cpu); | ||
99 | # else | 100 | # else |
100 | static inline void tick_clock_notify(void) { } | 101 | static inline void tick_clock_notify(void) { } |
101 | static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } | 102 | static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } |
103 | static inline void tick_check_idle(int cpu) { } | ||
102 | # endif | 104 | # endif |
103 | 105 | ||
104 | #else /* CONFIG_GENERIC_CLOCKEVENTS */ | 106 | #else /* CONFIG_GENERIC_CLOCKEVENTS */ |
@@ -106,27 +108,24 @@ static inline void tick_init(void) { } | |||
106 | static inline void tick_cancel_sched_timer(int cpu) { } | 108 | static inline void tick_cancel_sched_timer(int cpu) { } |
107 | static inline void tick_clock_notify(void) { } | 109 | static inline void tick_clock_notify(void) { } |
108 | static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } | 110 | static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } |
111 | static inline void tick_check_idle(int cpu) { } | ||
109 | #endif /* !CONFIG_GENERIC_CLOCKEVENTS */ | 112 | #endif /* !CONFIG_GENERIC_CLOCKEVENTS */ |
110 | 113 | ||
111 | # ifdef CONFIG_NO_HZ | 114 | # ifdef CONFIG_NO_HZ |
112 | extern void tick_nohz_stop_sched_tick(int inidle); | 115 | extern void tick_nohz_stop_sched_tick(int inidle); |
113 | extern void tick_nohz_restart_sched_tick(void); | 116 | extern void tick_nohz_restart_sched_tick(void); |
114 | extern void tick_nohz_update_jiffies(void); | ||
115 | extern ktime_t tick_nohz_get_sleep_length(void); | 117 | extern ktime_t tick_nohz_get_sleep_length(void); |
116 | extern void tick_nohz_stop_idle(int cpu); | ||
117 | extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); | 118 | extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); |
118 | # else | 119 | # else |
119 | static inline void tick_nohz_stop_sched_tick(int inidle) { } | 120 | static inline void tick_nohz_stop_sched_tick(int inidle) { } |
120 | static inline void tick_nohz_restart_sched_tick(void) { } | 121 | static inline void tick_nohz_restart_sched_tick(void) { } |
121 | static inline void tick_nohz_update_jiffies(void) { } | ||
122 | static inline ktime_t tick_nohz_get_sleep_length(void) | 122 | static inline ktime_t tick_nohz_get_sleep_length(void) |
123 | { | 123 | { |
124 | ktime_t len = { .tv64 = NSEC_PER_SEC/HZ }; | 124 | ktime_t len = { .tv64 = NSEC_PER_SEC/HZ }; |
125 | 125 | ||
126 | return len; | 126 | return len; |
127 | } | 127 | } |
128 | static inline void tick_nohz_stop_idle(int cpu) { } | 128 | static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; } |
129 | static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return 0; } | ||
130 | # endif /* !NO_HZ */ | 129 | # endif /* !NO_HZ */ |
131 | 130 | ||
132 | #endif | 131 | #endif |
diff --git a/include/linux/time.h b/include/linux/time.h index e15206a7e82e..ce321ac5c8f8 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -29,6 +29,8 @@ struct timezone { | |||
29 | 29 | ||
30 | #ifdef __KERNEL__ | 30 | #ifdef __KERNEL__ |
31 | 31 | ||
32 | extern struct timezone sys_tz; | ||
33 | |||
32 | /* Parameters used to convert the timespec values: */ | 34 | /* Parameters used to convert the timespec values: */ |
33 | #define MSEC_PER_SEC 1000L | 35 | #define MSEC_PER_SEC 1000L |
34 | #define USEC_PER_MSEC 1000L | 36 | #define USEC_PER_MSEC 1000L |
@@ -38,6 +40,8 @@ struct timezone { | |||
38 | #define NSEC_PER_SEC 1000000000L | 40 | #define NSEC_PER_SEC 1000000000L |
39 | #define FSEC_PER_SEC 1000000000000000L | 41 | #define FSEC_PER_SEC 1000000000000000L |
40 | 42 | ||
43 | #define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) | ||
44 | |||
41 | static inline int timespec_equal(const struct timespec *a, | 45 | static inline int timespec_equal(const struct timespec *a, |
42 | const struct timespec *b) | 46 | const struct timespec *b) |
43 | { | 47 | { |
@@ -72,6 +76,8 @@ extern unsigned long mktime(const unsigned int year, const unsigned int mon, | |||
72 | const unsigned int min, const unsigned int sec); | 76 | const unsigned int min, const unsigned int sec); |
73 | 77 | ||
74 | extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec); | 78 | extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec); |
79 | extern struct timespec timespec_add_safe(const struct timespec lhs, | ||
80 | const struct timespec rhs); | ||
75 | 81 | ||
76 | /* | 82 | /* |
77 | * sub = lhs - rhs, in normalized form | 83 | * sub = lhs - rhs, in normalized form |
@@ -117,6 +123,7 @@ extern int do_setitimer(int which, struct itimerval *value, | |||
117 | extern unsigned int alarm_setitimer(unsigned int seconds); | 123 | extern unsigned int alarm_setitimer(unsigned int seconds); |
118 | extern int do_getitimer(int which, struct itimerval *value); | 124 | extern int do_getitimer(int which, struct itimerval *value); |
119 | extern void getnstimeofday(struct timespec *tv); | 125 | extern void getnstimeofday(struct timespec *tv); |
126 | extern void getrawmonotonic(struct timespec *ts); | ||
120 | extern void getboottime(struct timespec *ts); | 127 | extern void getboottime(struct timespec *ts); |
121 | extern void monotonic_to_bootbased(struct timespec *ts); | 128 | extern void monotonic_to_bootbased(struct timespec *ts); |
122 | 129 | ||
@@ -125,6 +132,9 @@ extern int timekeeping_valid_for_hres(void); | |||
125 | extern void update_wall_time(void); | 132 | extern void update_wall_time(void); |
126 | extern void update_xtime_cache(u64 nsec); | 133 | extern void update_xtime_cache(u64 nsec); |
127 | 134 | ||
135 | struct tms; | ||
136 | extern void do_sys_times(struct tms *); | ||
137 | |||
128 | /** | 138 | /** |
129 | * timespec_to_ns - Convert timespec to nanoseconds | 139 | * timespec_to_ns - Convert timespec to nanoseconds |
130 | * @ts: pointer to the timespec variable to be converted | 140 | * @ts: pointer to the timespec variable to be converted |
@@ -214,6 +224,7 @@ struct itimerval { | |||
214 | #define CLOCK_MONOTONIC 1 | 224 | #define CLOCK_MONOTONIC 1 |
215 | #define CLOCK_PROCESS_CPUTIME_ID 2 | 225 | #define CLOCK_PROCESS_CPUTIME_ID 2 |
216 | #define CLOCK_THREAD_CPUTIME_ID 3 | 226 | #define CLOCK_THREAD_CPUTIME_ID 3 |
227 | #define CLOCK_MONOTONIC_RAW 4 | ||
217 | 228 | ||
218 | /* | 229 | /* |
219 | * The IDs of various hardware clocks: | 230 | * The IDs of various hardware clocks: |
diff --git a/include/linux/timer.h b/include/linux/timer.h index d4ba79248a27..daf9685b861c 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h | |||
@@ -186,4 +186,9 @@ unsigned long __round_jiffies_relative(unsigned long j, int cpu); | |||
186 | unsigned long round_jiffies(unsigned long j); | 186 | unsigned long round_jiffies(unsigned long j); |
187 | unsigned long round_jiffies_relative(unsigned long j); | 187 | unsigned long round_jiffies_relative(unsigned long j); |
188 | 188 | ||
189 | unsigned long __round_jiffies_up(unsigned long j, int cpu); | ||
190 | unsigned long __round_jiffies_up_relative(unsigned long j, int cpu); | ||
191 | unsigned long round_jiffies_up(unsigned long j); | ||
192 | unsigned long round_jiffies_up_relative(unsigned long j); | ||
193 | |||
189 | #endif | 194 | #endif |
diff --git a/include/linux/timex.h b/include/linux/timex.h index fc6035d29d56..9007313b5b71 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h | |||
@@ -82,7 +82,7 @@ | |||
82 | */ | 82 | */ |
83 | #define SHIFT_USEC 16 /* frequency offset scale (shift) */ | 83 | #define SHIFT_USEC 16 /* frequency offset scale (shift) */ |
84 | #define PPM_SCALE (NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC)) | 84 | #define PPM_SCALE (NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC)) |
85 | #define PPM_SCALE_INV_SHIFT 20 | 85 | #define PPM_SCALE_INV_SHIFT 19 |
86 | #define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \ | 86 | #define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \ |
87 | PPM_SCALE + 1) | 87 | PPM_SCALE + 1) |
88 | 88 | ||
@@ -141,8 +141,15 @@ struct timex { | |||
141 | #define ADJ_MICRO 0x1000 /* select microsecond resolution */ | 141 | #define ADJ_MICRO 0x1000 /* select microsecond resolution */ |
142 | #define ADJ_NANO 0x2000 /* select nanosecond resolution */ | 142 | #define ADJ_NANO 0x2000 /* select nanosecond resolution */ |
143 | #define ADJ_TICK 0x4000 /* tick value */ | 143 | #define ADJ_TICK 0x4000 /* tick value */ |
144 | |||
145 | #ifdef __KERNEL__ | ||
146 | #define ADJ_ADJTIME 0x8000 /* switch between adjtime/adjtimex modes */ | ||
147 | #define ADJ_OFFSET_SINGLESHOT 0x0001 /* old-fashioned adjtime */ | ||
148 | #define ADJ_OFFSET_READONLY 0x2000 /* read-only adjtime */ | ||
149 | #else | ||
144 | #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ | 150 | #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ |
145 | #define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ | 151 | #define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ |
152 | #endif | ||
146 | 153 | ||
147 | /* xntp 3.4 compatibility names */ | 154 | /* xntp 3.4 compatibility names */ |
148 | #define MOD_OFFSET ADJ_OFFSET | 155 | #define MOD_OFFSET ADJ_OFFSET |
diff --git a/include/linux/topology.h b/include/linux/topology.h index 2158fc0d5a56..117f1b7405cf 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h | |||
@@ -99,7 +99,7 @@ void arch_update_cpu_topology(void); | |||
99 | | SD_BALANCE_FORK \ | 99 | | SD_BALANCE_FORK \ |
100 | | SD_BALANCE_EXEC \ | 100 | | SD_BALANCE_EXEC \ |
101 | | SD_WAKE_AFFINE \ | 101 | | SD_WAKE_AFFINE \ |
102 | | SD_WAKE_IDLE \ | 102 | | SD_WAKE_BALANCE \ |
103 | | SD_SHARE_CPUPOWER, \ | 103 | | SD_SHARE_CPUPOWER, \ |
104 | .last_balance = jiffies, \ | 104 | .last_balance = jiffies, \ |
105 | .balance_interval = 1, \ | 105 | .balance_interval = 1, \ |
@@ -120,10 +120,10 @@ void arch_update_cpu_topology(void); | |||
120 | .wake_idx = 1, \ | 120 | .wake_idx = 1, \ |
121 | .forkexec_idx = 1, \ | 121 | .forkexec_idx = 1, \ |
122 | .flags = SD_LOAD_BALANCE \ | 122 | .flags = SD_LOAD_BALANCE \ |
123 | | SD_BALANCE_NEWIDLE \ | ||
124 | | SD_BALANCE_FORK \ | 123 | | SD_BALANCE_FORK \ |
125 | | SD_BALANCE_EXEC \ | 124 | | SD_BALANCE_EXEC \ |
126 | | SD_WAKE_AFFINE \ | 125 | | SD_WAKE_AFFINE \ |
126 | | SD_WAKE_BALANCE \ | ||
127 | | SD_SHARE_PKG_RESOURCES\ | 127 | | SD_SHARE_PKG_RESOURCES\ |
128 | | BALANCE_FOR_MC_POWER, \ | 128 | | BALANCE_FOR_MC_POWER, \ |
129 | .last_balance = jiffies, \ | 129 | .last_balance = jiffies, \ |
@@ -146,10 +146,10 @@ void arch_update_cpu_topology(void); | |||
146 | .wake_idx = 1, \ | 146 | .wake_idx = 1, \ |
147 | .forkexec_idx = 1, \ | 147 | .forkexec_idx = 1, \ |
148 | .flags = SD_LOAD_BALANCE \ | 148 | .flags = SD_LOAD_BALANCE \ |
149 | | SD_BALANCE_NEWIDLE \ | ||
150 | | SD_BALANCE_FORK \ | ||
151 | | SD_BALANCE_EXEC \ | 149 | | SD_BALANCE_EXEC \ |
150 | | SD_BALANCE_FORK \ | ||
152 | | SD_WAKE_AFFINE \ | 151 | | SD_WAKE_AFFINE \ |
152 | | SD_WAKE_BALANCE \ | ||
153 | | BALANCE_FOR_PKG_POWER,\ | 153 | | BALANCE_FOR_PKG_POWER,\ |
154 | .last_balance = jiffies, \ | 154 | .last_balance = jiffies, \ |
155 | .balance_interval = 1, \ | 155 | .balance_interval = 1, \ |
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h new file mode 100644 index 000000000000..c5bb39c7a770 --- /dev/null +++ b/include/linux/tracepoint.h | |||
@@ -0,0 +1,137 @@ | |||
1 | #ifndef _LINUX_TRACEPOINT_H | ||
2 | #define _LINUX_TRACEPOINT_H | ||
3 | |||
4 | /* | ||
5 | * Kernel Tracepoint API. | ||
6 | * | ||
7 | * See Documentation/tracepoint.txt. | ||
8 | * | ||
9 | * (C) Copyright 2008 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> | ||
10 | * | ||
11 | * Heavily inspired from the Linux Kernel Markers. | ||
12 | * | ||
13 | * This file is released under the GPLv2. | ||
14 | * See the file COPYING for more details. | ||
15 | */ | ||
16 | |||
17 | #include <linux/types.h> | ||
18 | #include <linux/rcupdate.h> | ||
19 | |||
20 | struct module; | ||
21 | struct tracepoint; | ||
22 | |||
23 | struct tracepoint { | ||
24 | const char *name; /* Tracepoint name */ | ||
25 | int state; /* State. */ | ||
26 | void **funcs; | ||
27 | } __attribute__((aligned(8))); | ||
28 | |||
29 | |||
30 | #define TPPROTO(args...) args | ||
31 | #define TPARGS(args...) args | ||
32 | |||
33 | #ifdef CONFIG_TRACEPOINTS | ||
34 | |||
35 | /* | ||
36 | * it_func[0] is never NULL because there is at least one element in the array | ||
37 | * when the array itself is non NULL. | ||
38 | */ | ||
39 | #define __DO_TRACE(tp, proto, args) \ | ||
40 | do { \ | ||
41 | void **it_func; \ | ||
42 | \ | ||
43 | rcu_read_lock_sched(); \ | ||
44 | it_func = rcu_dereference((tp)->funcs); \ | ||
45 | if (it_func) { \ | ||
46 | do { \ | ||
47 | ((void(*)(proto))(*it_func))(args); \ | ||
48 | } while (*(++it_func)); \ | ||
49 | } \ | ||
50 | rcu_read_unlock_sched(); \ | ||
51 | } while (0) | ||
52 | |||
53 | /* | ||
54 | * Make sure the alignment of the structure in the __tracepoints section will | ||
55 | * not add unwanted padding between the beginning of the section and the | ||
56 | * structure. Force alignment to the same alignment as the section start. | ||
57 | */ | ||
58 | #define DEFINE_TRACE(name, proto, args) \ | ||
59 | static inline void trace_##name(proto) \ | ||
60 | { \ | ||
61 | static const char __tpstrtab_##name[] \ | ||
62 | __attribute__((section("__tracepoints_strings"))) \ | ||
63 | = #name ":" #proto; \ | ||
64 | static struct tracepoint __tracepoint_##name \ | ||
65 | __attribute__((section("__tracepoints"), aligned(8))) = \ | ||
66 | { __tpstrtab_##name, 0, NULL }; \ | ||
67 | if (unlikely(__tracepoint_##name.state)) \ | ||
68 | __DO_TRACE(&__tracepoint_##name, \ | ||
69 | TPPROTO(proto), TPARGS(args)); \ | ||
70 | } \ | ||
71 | static inline int register_trace_##name(void (*probe)(proto)) \ | ||
72 | { \ | ||
73 | return tracepoint_probe_register(#name ":" #proto, \ | ||
74 | (void *)probe); \ | ||
75 | } \ | ||
76 | static inline void unregister_trace_##name(void (*probe)(proto))\ | ||
77 | { \ | ||
78 | tracepoint_probe_unregister(#name ":" #proto, \ | ||
79 | (void *)probe); \ | ||
80 | } | ||
81 | |||
82 | extern void tracepoint_update_probe_range(struct tracepoint *begin, | ||
83 | struct tracepoint *end); | ||
84 | |||
85 | #else /* !CONFIG_TRACEPOINTS */ | ||
86 | #define DEFINE_TRACE(name, proto, args) \ | ||
87 | static inline void _do_trace_##name(struct tracepoint *tp, proto) \ | ||
88 | { } \ | ||
89 | static inline void trace_##name(proto) \ | ||
90 | { } \ | ||
91 | static inline int register_trace_##name(void (*probe)(proto)) \ | ||
92 | { \ | ||
93 | return -ENOSYS; \ | ||
94 | } \ | ||
95 | static inline void unregister_trace_##name(void (*probe)(proto))\ | ||
96 | { } | ||
97 | |||
98 | static inline void tracepoint_update_probe_range(struct tracepoint *begin, | ||
99 | struct tracepoint *end) | ||
100 | { } | ||
101 | #endif /* CONFIG_TRACEPOINTS */ | ||
102 | |||
103 | /* | ||
104 | * Connect a probe to a tracepoint. | ||
105 | * Internal API, should not be used directly. | ||
106 | */ | ||
107 | extern int tracepoint_probe_register(const char *name, void *probe); | ||
108 | |||
109 | /* | ||
110 | * Disconnect a probe from a tracepoint. | ||
111 | * Internal API, should not be used directly. | ||
112 | */ | ||
113 | extern int tracepoint_probe_unregister(const char *name, void *probe); | ||
114 | |||
115 | struct tracepoint_iter { | ||
116 | struct module *module; | ||
117 | struct tracepoint *tracepoint; | ||
118 | }; | ||
119 | |||
120 | extern void tracepoint_iter_start(struct tracepoint_iter *iter); | ||
121 | extern void tracepoint_iter_next(struct tracepoint_iter *iter); | ||
122 | extern void tracepoint_iter_stop(struct tracepoint_iter *iter); | ||
123 | extern void tracepoint_iter_reset(struct tracepoint_iter *iter); | ||
124 | extern int tracepoint_get_iter_range(struct tracepoint **tracepoint, | ||
125 | struct tracepoint *begin, struct tracepoint *end); | ||
126 | |||
127 | /* | ||
128 | * tracepoint_synchronize_unregister must be called between the last tracepoint | ||
129 | * probe unregistration and the end of module exit to make sure there is no | ||
130 | * caller executing a probe when it is freed. | ||
131 | */ | ||
132 | static inline void tracepoint_synchronize_unregister(void) | ||
133 | { | ||
134 | synchronize_sched(); | ||
135 | } | ||
136 | |||
137 | #endif | ||
diff --git a/include/linux/tty.h b/include/linux/tty.h index 0cbec74ec086..3b8121d4e36f 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | #define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ | 24 | #define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ |
25 | #define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ | 25 | #define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ |
26 | #define NR_LDISCS 18 | 26 | #define NR_LDISCS 19 |
27 | 27 | ||
28 | /* line disciplines */ | 28 | /* line disciplines */ |
29 | #define N_TTY 0 | 29 | #define N_TTY 0 |
@@ -45,6 +45,7 @@ | |||
45 | #define N_HCI 15 /* Bluetooth HCI UART */ | 45 | #define N_HCI 15 /* Bluetooth HCI UART */ |
46 | #define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */ | 46 | #define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */ |
47 | #define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */ | 47 | #define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */ |
48 | #define N_PPS 18 /* Pulse per Second */ | ||
48 | 49 | ||
49 | /* | 50 | /* |
50 | * This character is the same as _POSIX_VDISABLE: it cannot be used as | 51 | * This character is the same as _POSIX_VDISABLE: it cannot be used as |
@@ -181,6 +182,7 @@ struct signal_struct; | |||
181 | 182 | ||
182 | struct tty_port { | 183 | struct tty_port { |
183 | struct tty_struct *tty; /* Back pointer */ | 184 | struct tty_struct *tty; /* Back pointer */ |
185 | spinlock_t lock; /* Lock protecting tty field */ | ||
184 | int blocked_open; /* Waiting to open */ | 186 | int blocked_open; /* Waiting to open */ |
185 | int count; /* Usage count */ | 187 | int count; /* Usage count */ |
186 | wait_queue_head_t open_wait; /* Open waiters */ | 188 | wait_queue_head_t open_wait; /* Open waiters */ |
@@ -208,6 +210,7 @@ struct tty_operations; | |||
208 | 210 | ||
209 | struct tty_struct { | 211 | struct tty_struct { |
210 | int magic; | 212 | int magic; |
213 | struct kref kref; | ||
211 | struct tty_driver *driver; | 214 | struct tty_driver *driver; |
212 | const struct tty_operations *ops; | 215 | const struct tty_operations *ops; |
213 | int index; | 216 | int index; |
@@ -217,6 +220,7 @@ struct tty_struct { | |||
217 | spinlock_t ctrl_lock; | 220 | spinlock_t ctrl_lock; |
218 | /* Termios values are protected by the termios mutex */ | 221 | /* Termios values are protected by the termios mutex */ |
219 | struct ktermios *termios, *termios_locked; | 222 | struct ktermios *termios, *termios_locked; |
223 | struct termiox *termiox; /* May be NULL for unsupported */ | ||
220 | char name[64]; | 224 | char name[64]; |
221 | struct pid *pgrp; /* Protected by ctrl lock */ | 225 | struct pid *pgrp; /* Protected by ctrl lock */ |
222 | struct pid *session; | 226 | struct pid *session; |
@@ -310,6 +314,25 @@ extern int kmsg_redirect; | |||
310 | extern void console_init(void); | 314 | extern void console_init(void); |
311 | extern int vcs_init(void); | 315 | extern int vcs_init(void); |
312 | 316 | ||
317 | extern struct class *tty_class; | ||
318 | |||
319 | /** | ||
320 | * tty_kref_get - get a tty reference | ||
321 | * @tty: tty device | ||
322 | * | ||
323 | * Return a new reference to a tty object. The caller must hold | ||
324 | * sufficient locks/counts to ensure that their existing reference cannot | ||
325 | * go away | ||
326 | */ | ||
327 | |||
328 | extern inline struct tty_struct *tty_kref_get(struct tty_struct *tty) | ||
329 | { | ||
330 | if (tty) | ||
331 | kref_get(&tty->kref); | ||
332 | return tty; | ||
333 | } | ||
334 | extern void tty_kref_put(struct tty_struct *tty); | ||
335 | |||
313 | extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, | 336 | extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, |
314 | const char *routine); | 337 | const char *routine); |
315 | extern char *tty_name(struct tty_struct *tty, char *buf); | 338 | extern char *tty_name(struct tty_struct *tty, char *buf); |
@@ -333,13 +356,15 @@ extern void tty_throttle(struct tty_struct *tty); | |||
333 | extern void tty_unthrottle(struct tty_struct *tty); | 356 | extern void tty_unthrottle(struct tty_struct *tty); |
334 | extern int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty, | 357 | extern int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty, |
335 | struct winsize *ws); | 358 | struct winsize *ws); |
336 | 359 | extern void tty_shutdown(struct tty_struct *tty); | |
360 | extern void tty_free_termios(struct tty_struct *tty); | ||
337 | extern int is_current_pgrp_orphaned(void); | 361 | extern int is_current_pgrp_orphaned(void); |
338 | extern struct pid *tty_get_pgrp(struct tty_struct *tty); | 362 | extern struct pid *tty_get_pgrp(struct tty_struct *tty); |
339 | extern int is_ignored(int sig); | 363 | extern int is_ignored(int sig); |
340 | extern int tty_signal(int sig, struct tty_struct *tty); | 364 | extern int tty_signal(int sig, struct tty_struct *tty); |
341 | extern void tty_hangup(struct tty_struct *tty); | 365 | extern void tty_hangup(struct tty_struct *tty); |
342 | extern void tty_vhangup(struct tty_struct *tty); | 366 | extern void tty_vhangup(struct tty_struct *tty); |
367 | extern void tty_vhangup_self(void); | ||
343 | extern void tty_unhangup(struct file *filp); | 368 | extern void tty_unhangup(struct file *filp); |
344 | extern int tty_hung_up_p(struct file *filp); | 369 | extern int tty_hung_up_p(struct file *filp); |
345 | extern void do_SAK(struct tty_struct *tty); | 370 | extern void do_SAK(struct tty_struct *tty); |
@@ -347,6 +372,9 @@ extern void __do_SAK(struct tty_struct *tty); | |||
347 | extern void disassociate_ctty(int priv); | 372 | extern void disassociate_ctty(int priv); |
348 | extern void no_tty(void); | 373 | extern void no_tty(void); |
349 | extern void tty_flip_buffer_push(struct tty_struct *tty); | 374 | extern void tty_flip_buffer_push(struct tty_struct *tty); |
375 | extern void tty_buffer_free_all(struct tty_struct *tty); | ||
376 | extern void tty_buffer_flush(struct tty_struct *tty); | ||
377 | extern void tty_buffer_init(struct tty_struct *tty); | ||
350 | extern speed_t tty_get_baud_rate(struct tty_struct *tty); | 378 | extern speed_t tty_get_baud_rate(struct tty_struct *tty); |
351 | extern speed_t tty_termios_baud_rate(struct ktermios *termios); | 379 | extern speed_t tty_termios_baud_rate(struct ktermios *termios); |
352 | extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); | 380 | extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); |
@@ -372,6 +400,15 @@ extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); | |||
372 | extern dev_t tty_devnum(struct tty_struct *tty); | 400 | extern dev_t tty_devnum(struct tty_struct *tty); |
373 | extern void proc_clear_tty(struct task_struct *p); | 401 | extern void proc_clear_tty(struct task_struct *p); |
374 | extern struct tty_struct *get_current_tty(void); | 402 | extern struct tty_struct *get_current_tty(void); |
403 | extern void tty_default_fops(struct file_operations *fops); | ||
404 | extern struct tty_struct *alloc_tty_struct(void); | ||
405 | extern void free_tty_struct(struct tty_struct *tty); | ||
406 | extern void initialize_tty_struct(struct tty_struct *tty, | ||
407 | struct tty_driver *driver, int idx); | ||
408 | extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, | ||
409 | int first_ok); | ||
410 | extern void tty_release_dev(struct file *filp); | ||
411 | extern int tty_init_termios(struct tty_struct *tty); | ||
375 | 412 | ||
376 | extern struct mutex tty_mutex; | 413 | extern struct mutex tty_mutex; |
377 | 414 | ||
@@ -382,6 +419,8 @@ extern int tty_write_lock(struct tty_struct *tty, int ndelay); | |||
382 | extern void tty_port_init(struct tty_port *port); | 419 | extern void tty_port_init(struct tty_port *port); |
383 | extern int tty_port_alloc_xmit_buf(struct tty_port *port); | 420 | extern int tty_port_alloc_xmit_buf(struct tty_port *port); |
384 | extern void tty_port_free_xmit_buf(struct tty_port *port); | 421 | extern void tty_port_free_xmit_buf(struct tty_port *port); |
422 | extern struct tty_struct *tty_port_tty_get(struct tty_port *port); | ||
423 | extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty); | ||
385 | 424 | ||
386 | extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc); | 425 | extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc); |
387 | extern int tty_unregister_ldisc(int disc); | 426 | extern int tty_unregister_ldisc(int disc); |
@@ -427,7 +466,7 @@ static inline void tty_audit_push_task(struct task_struct *tsk, | |||
427 | #endif | 466 | #endif |
428 | 467 | ||
429 | /* tty_ioctl.c */ | 468 | /* tty_ioctl.c */ |
430 | extern int n_tty_ioctl(struct tty_struct *tty, struct file *file, | 469 | extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file, |
431 | unsigned int cmd, unsigned long arg); | 470 | unsigned int cmd, unsigned long arg); |
432 | 471 | ||
433 | /* serial.c */ | 472 | /* serial.c */ |
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 16d27944c321..78416b901589 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h | |||
@@ -7,6 +7,28 @@ | |||
7 | * defined; unless noted otherwise, they are optional, and can be | 7 | * defined; unless noted otherwise, they are optional, and can be |
8 | * filled in with a null pointer. | 8 | * filled in with a null pointer. |
9 | * | 9 | * |
10 | * struct tty_struct * (*lookup)(struct tty_driver *self, int idx) | ||
11 | * | ||
12 | * Return the tty device corresponding to idx, NULL if there is not | ||
13 | * one currently in use and an ERR_PTR value on error. Called under | ||
14 | * tty_mutex (for now!) | ||
15 | * | ||
16 | * Optional method. Default behaviour is to use the ttys array | ||
17 | * | ||
18 | * int (*install)(struct tty_driver *self, struct tty_struct *tty) | ||
19 | * | ||
20 | * Install a new tty into the tty driver internal tables. Used in | ||
21 | * conjunction with lookup and remove methods. | ||
22 | * | ||
23 | * Optional method. Default behaviour is to use the ttys array | ||
24 | * | ||
25 | * void (*remove)(struct tty_driver *self, struct tty_struct *tty) | ||
26 | * | ||
27 | * Remove a closed tty from the tty driver internal tables. Used in | ||
28 | * conjunction with lookup and remove methods. | ||
29 | * | ||
30 | * Optional method. Default behaviour is to use the ttys array | ||
31 | * | ||
10 | * int (*open)(struct tty_struct * tty, struct file * filp); | 32 | * int (*open)(struct tty_struct * tty, struct file * filp); |
11 | * | 33 | * |
12 | * This routine is called when a particular tty device is opened. | 34 | * This routine is called when a particular tty device is opened. |
@@ -21,6 +43,11 @@ | |||
21 | * | 43 | * |
22 | * Required method. | 44 | * Required method. |
23 | * | 45 | * |
46 | * void (*shutdown)(struct tty_struct * tty); | ||
47 | * | ||
48 | * This routine is called when a particular tty device is closed for | ||
49 | * the last time freeing up the resources. | ||
50 | * | ||
24 | * int (*write)(struct tty_struct * tty, | 51 | * int (*write)(struct tty_struct * tty, |
25 | * const unsigned char *buf, int count); | 52 | * const unsigned char *buf, int count); |
26 | * | 53 | * |
@@ -180,6 +207,14 @@ | |||
180 | * not force errors here if they are not resizable objects (eg a serial | 207 | * not force errors here if they are not resizable objects (eg a serial |
181 | * line). See tty_do_resize() if you need to wrap the standard method | 208 | * line). See tty_do_resize() if you need to wrap the standard method |
182 | * in your own logic - the usual case. | 209 | * in your own logic - the usual case. |
210 | * | ||
211 | * void (*set_termiox)(struct tty_struct *tty, struct termiox *new); | ||
212 | * | ||
213 | * Called when the device receives a termiox based ioctl. Passes down | ||
214 | * the requested data from user space. This method will not be invoked | ||
215 | * unless the tty also has a valid tty->termiox pointer. | ||
216 | * | ||
217 | * Optional: Called under the termios lock | ||
183 | */ | 218 | */ |
184 | 219 | ||
185 | #include <linux/fs.h> | 220 | #include <linux/fs.h> |
@@ -190,8 +225,13 @@ struct tty_struct; | |||
190 | struct tty_driver; | 225 | struct tty_driver; |
191 | 226 | ||
192 | struct tty_operations { | 227 | struct tty_operations { |
228 | struct tty_struct * (*lookup)(struct tty_driver *driver, | ||
229 | struct inode *inode, int idx); | ||
230 | int (*install)(struct tty_driver *driver, struct tty_struct *tty); | ||
231 | void (*remove)(struct tty_driver *driver, struct tty_struct *tty); | ||
193 | int (*open)(struct tty_struct * tty, struct file * filp); | 232 | int (*open)(struct tty_struct * tty, struct file * filp); |
194 | void (*close)(struct tty_struct * tty, struct file * filp); | 233 | void (*close)(struct tty_struct * tty, struct file * filp); |
234 | void (*shutdown)(struct tty_struct *tty); | ||
195 | int (*write)(struct tty_struct * tty, | 235 | int (*write)(struct tty_struct * tty, |
196 | const unsigned char *buf, int count); | 236 | const unsigned char *buf, int count); |
197 | int (*put_char)(struct tty_struct *tty, unsigned char ch); | 237 | int (*put_char)(struct tty_struct *tty, unsigned char ch); |
@@ -220,6 +260,7 @@ struct tty_operations { | |||
220 | unsigned int set, unsigned int clear); | 260 | unsigned int set, unsigned int clear); |
221 | int (*resize)(struct tty_struct *tty, struct tty_struct *real_tty, | 261 | int (*resize)(struct tty_struct *tty, struct tty_struct *real_tty, |
222 | struct winsize *ws); | 262 | struct winsize *ws); |
263 | int (*set_termiox)(struct tty_struct *tty, struct termiox *tnew); | ||
223 | #ifdef CONFIG_CONSOLE_POLL | 264 | #ifdef CONFIG_CONSOLE_POLL |
224 | int (*poll_init)(struct tty_driver *driver, int line, char *options); | 265 | int (*poll_init)(struct tty_driver *driver, int line, char *options); |
225 | int (*poll_get_char)(struct tty_driver *driver, int line); | 266 | int (*poll_get_char)(struct tty_driver *driver, int line); |
@@ -229,6 +270,7 @@ struct tty_operations { | |||
229 | 270 | ||
230 | struct tty_driver { | 271 | struct tty_driver { |
231 | int magic; /* magic number for this structure */ | 272 | int magic; /* magic number for this structure */ |
273 | struct kref kref; /* Reference management */ | ||
232 | struct cdev cdev; | 274 | struct cdev cdev; |
233 | struct module *owner; | 275 | struct module *owner; |
234 | const char *driver_name; | 276 | const char *driver_name; |
@@ -242,7 +284,6 @@ struct tty_driver { | |||
242 | short subtype; /* subtype of tty driver */ | 284 | short subtype; /* subtype of tty driver */ |
243 | struct ktermios init_termios; /* Initial termios */ | 285 | struct ktermios init_termios; /* Initial termios */ |
244 | int flags; /* tty driver flags */ | 286 | int flags; /* tty driver flags */ |
245 | int refcount; /* for loadable tty drivers */ | ||
246 | struct proc_dir_entry *proc_entry; /* /proc fs entry */ | 287 | struct proc_dir_entry *proc_entry; /* /proc fs entry */ |
247 | struct tty_driver *other; /* only used for the PTY driver */ | 288 | struct tty_driver *other; /* only used for the PTY driver */ |
248 | 289 | ||
@@ -264,12 +305,19 @@ struct tty_driver { | |||
264 | 305 | ||
265 | extern struct list_head tty_drivers; | 306 | extern struct list_head tty_drivers; |
266 | 307 | ||
267 | struct tty_driver *alloc_tty_driver(int lines); | 308 | extern struct tty_driver *alloc_tty_driver(int lines); |
268 | void put_tty_driver(struct tty_driver *driver); | 309 | extern void put_tty_driver(struct tty_driver *driver); |
269 | void tty_set_operations(struct tty_driver *driver, | 310 | extern void tty_set_operations(struct tty_driver *driver, |
270 | const struct tty_operations *op); | 311 | const struct tty_operations *op); |
271 | extern struct tty_driver *tty_find_polling_driver(char *name, int *line); | 312 | extern struct tty_driver *tty_find_polling_driver(char *name, int *line); |
272 | 313 | ||
314 | extern void tty_driver_kref_put(struct tty_driver *driver); | ||
315 | extern inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d) | ||
316 | { | ||
317 | kref_get(&d->kref); | ||
318 | return d; | ||
319 | } | ||
320 | |||
273 | /* tty driver magic number */ | 321 | /* tty driver magic number */ |
274 | #define TTY_DRIVER_MAGIC 0x5402 | 322 | #define TTY_DRIVER_MAGIC 0x5402 |
275 | 323 | ||
diff --git a/include/linux/types.h b/include/linux/types.h index d4a9ce6e2760..1d98330b1f2c 100644 --- a/include/linux/types.h +++ b/include/linux/types.h | |||
@@ -190,13 +190,16 @@ typedef __u32 __bitwise __wsum; | |||
190 | 190 | ||
191 | #ifdef __KERNEL__ | 191 | #ifdef __KERNEL__ |
192 | typedef unsigned __bitwise__ gfp_t; | 192 | typedef unsigned __bitwise__ gfp_t; |
193 | typedef unsigned __bitwise__ fmode_t; | ||
193 | 194 | ||
194 | #ifdef CONFIG_RESOURCES_64BIT | 195 | #ifdef CONFIG_PHYS_ADDR_T_64BIT |
195 | typedef u64 resource_size_t; | 196 | typedef u64 phys_addr_t; |
196 | #else | 197 | #else |
197 | typedef u32 resource_size_t; | 198 | typedef u32 phys_addr_t; |
198 | #endif | 199 | #endif |
199 | 200 | ||
201 | typedef phys_addr_t resource_size_t; | ||
202 | |||
200 | struct ustat { | 203 | struct ustat { |
201 | __kernel_daddr_t f_tfree; | 204 | __kernel_daddr_t f_tfree; |
202 | __kernel_ino_t f_tinode; | 205 | __kernel_ino_t f_tinode; |
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h new file mode 100644 index 000000000000..970473bf8d5a --- /dev/null +++ b/include/linux/ucb1400.h | |||
@@ -0,0 +1,161 @@ | |||
1 | /* | ||
2 | * Register definitions and functions for: | ||
3 | * Philips UCB1400 driver | ||
4 | * | ||
5 | * Based on ucb1400_ts: | ||
6 | * Author: Nicolas Pitre | ||
7 | * Created: September 25, 2006 | ||
8 | * Copyright: MontaVista Software, Inc. | ||
9 | * | ||
10 | * Spliting done by: Marek Vasut <marek.vasut@gmail.com> | ||
11 | * If something doesnt work and it worked before spliting, e-mail me, | ||
12 | * dont bother Nicolas please ;-) | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License version 2 as | ||
16 | * published by the Free Software Foundation. | ||
17 | * | ||
18 | * This code is heavily based on ucb1x00-*.c copyrighted by Russell King | ||
19 | * covering the UCB1100, UCB1200 and UCB1300.. Support for the UCB1400 has | ||
20 | * been made separate from ucb1x00-core/ucb1x00-ts on Russell's request. | ||
21 | */ | ||
22 | |||
23 | #ifndef _LINUX__UCB1400_H | ||
24 | #define _LINUX__UCB1400_H | ||
25 | |||
26 | #include <sound/ac97_codec.h> | ||
27 | #include <linux/mutex.h> | ||
28 | #include <linux/platform_device.h> | ||
29 | |||
30 | /* | ||
31 | * UCB1400 AC-link registers | ||
32 | */ | ||
33 | |||
34 | #define UCB_IO_DATA 0x5a | ||
35 | #define UCB_IO_DIR 0x5c | ||
36 | #define UCB_IE_RIS 0x5e | ||
37 | #define UCB_IE_FAL 0x60 | ||
38 | #define UCB_IE_STATUS 0x62 | ||
39 | #define UCB_IE_CLEAR 0x62 | ||
40 | #define UCB_IE_ADC (1 << 11) | ||
41 | #define UCB_IE_TSPX (1 << 12) | ||
42 | |||
43 | #define UCB_TS_CR 0x64 | ||
44 | #define UCB_TS_CR_TSMX_POW (1 << 0) | ||
45 | #define UCB_TS_CR_TSPX_POW (1 << 1) | ||
46 | #define UCB_TS_CR_TSMY_POW (1 << 2) | ||
47 | #define UCB_TS_CR_TSPY_POW (1 << 3) | ||
48 | #define UCB_TS_CR_TSMX_GND (1 << 4) | ||
49 | #define UCB_TS_CR_TSPX_GND (1 << 5) | ||
50 | #define UCB_TS_CR_TSMY_GND (1 << 6) | ||
51 | #define UCB_TS_CR_TSPY_GND (1 << 7) | ||
52 | #define UCB_TS_CR_MODE_INT (0 << 8) | ||
53 | #define UCB_TS_CR_MODE_PRES (1 << 8) | ||
54 | #define UCB_TS_CR_MODE_POS (2 << 8) | ||
55 | #define UCB_TS_CR_BIAS_ENA (1 << 11) | ||
56 | #define UCB_TS_CR_TSPX_LOW (1 << 12) | ||
57 | #define UCB_TS_CR_TSMX_LOW (1 << 13) | ||
58 | |||
59 | #define UCB_ADC_CR 0x66 | ||
60 | #define UCB_ADC_SYNC_ENA (1 << 0) | ||
61 | #define UCB_ADC_VREFBYP_CON (1 << 1) | ||
62 | #define UCB_ADC_INP_TSPX (0 << 2) | ||
63 | #define UCB_ADC_INP_TSMX (1 << 2) | ||
64 | #define UCB_ADC_INP_TSPY (2 << 2) | ||
65 | #define UCB_ADC_INP_TSMY (3 << 2) | ||
66 | #define UCB_ADC_INP_AD0 (4 << 2) | ||
67 | #define UCB_ADC_INP_AD1 (5 << 2) | ||
68 | #define UCB_ADC_INP_AD2 (6 << 2) | ||
69 | #define UCB_ADC_INP_AD3 (7 << 2) | ||
70 | #define UCB_ADC_EXT_REF (1 << 5) | ||
71 | #define UCB_ADC_START (1 << 7) | ||
72 | #define UCB_ADC_ENA (1 << 15) | ||
73 | |||
74 | #define UCB_ADC_DATA 0x68 | ||
75 | #define UCB_ADC_DAT_VALID (1 << 15) | ||
76 | #define UCB_ADC_DAT_MASK 0x3ff | ||
77 | |||
78 | #define UCB_ID 0x7e | ||
79 | #define UCB_ID_1400 0x4304 | ||
80 | |||
81 | struct ucb1400_ts { | ||
82 | struct input_dev *ts_idev; | ||
83 | struct task_struct *ts_task; | ||
84 | int id; | ||
85 | wait_queue_head_t ts_wait; | ||
86 | unsigned int ts_restart:1; | ||
87 | int irq; | ||
88 | unsigned int irq_pending; /* not bit field shared */ | ||
89 | struct snd_ac97 *ac97; | ||
90 | }; | ||
91 | |||
92 | struct ucb1400 { | ||
93 | struct platform_device *ucb1400_ts; | ||
94 | }; | ||
95 | |||
96 | static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg) | ||
97 | { | ||
98 | return ac97->bus->ops->read(ac97, reg); | ||
99 | } | ||
100 | |||
101 | static inline void ucb1400_reg_write(struct snd_ac97 *ac97, u16 reg, u16 val) | ||
102 | { | ||
103 | ac97->bus->ops->write(ac97, reg, val); | ||
104 | } | ||
105 | |||
106 | static inline u16 ucb1400_gpio_get_value(struct snd_ac97 *ac97, u16 gpio) | ||
107 | { | ||
108 | return ucb1400_reg_read(ac97, UCB_IO_DATA) & (1 << gpio); | ||
109 | } | ||
110 | |||
111 | static inline void ucb1400_gpio_set_value(struct snd_ac97 *ac97, u16 gpio, | ||
112 | u16 val) | ||
113 | { | ||
114 | ucb1400_reg_write(ac97, UCB_IO_DATA, val ? | ||
115 | ucb1400_reg_read(ac97, UCB_IO_DATA) | (1 << gpio) : | ||
116 | ucb1400_reg_read(ac97, UCB_IO_DATA) & ~(1 << gpio)); | ||
117 | } | ||
118 | |||
119 | static inline u16 ucb1400_gpio_get_direction(struct snd_ac97 *ac97, u16 gpio) | ||
120 | { | ||
121 | return ucb1400_reg_read(ac97, UCB_IO_DIR) & (1 << gpio); | ||
122 | } | ||
123 | |||
124 | static inline void ucb1400_gpio_set_direction(struct snd_ac97 *ac97, u16 gpio, | ||
125 | u16 dir) | ||
126 | { | ||
127 | ucb1400_reg_write(ac97, UCB_IO_DIR, dir ? | ||
128 | ucb1400_reg_read(ac97, UCB_IO_DIR) | (1 << gpio) : | ||
129 | ucb1400_reg_read(ac97, UCB_IO_DIR) & ~(1 << gpio)); | ||
130 | } | ||
131 | |||
132 | static inline void ucb1400_adc_enable(struct snd_ac97 *ac97) | ||
133 | { | ||
134 | ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA); | ||
135 | } | ||
136 | |||
137 | static unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel, | ||
138 | int adcsync) | ||
139 | { | ||
140 | unsigned int val; | ||
141 | |||
142 | if (adcsync) | ||
143 | adc_channel |= UCB_ADC_SYNC_ENA; | ||
144 | |||
145 | ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel); | ||
146 | ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel | | ||
147 | UCB_ADC_START); | ||
148 | |||
149 | while (!((val = ucb1400_reg_read(ac97, UCB_ADC_DATA)) | ||
150 | & UCB_ADC_DAT_VALID)) | ||
151 | schedule_timeout_uninterruptible(1); | ||
152 | |||
153 | return val & UCB_ADC_DAT_MASK; | ||
154 | } | ||
155 | |||
156 | static inline void ucb1400_adc_disable(struct snd_ac97 *ac97) | ||
157 | { | ||
158 | ucb1400_reg_write(ac97, UCB_ADC_CR, 0); | ||
159 | } | ||
160 | |||
161 | #endif | ||
diff --git a/include/linux/usb.h b/include/linux/usb.h index 94ac74aba6b6..f72aa51f7bcd 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -108,6 +108,7 @@ enum usb_interface_condition { | |||
108 | * (in probe()), bound to a driver, or unbinding (in disconnect()) | 108 | * (in probe()), bound to a driver, or unbinding (in disconnect()) |
109 | * @is_active: flag set when the interface is bound and not suspended. | 109 | * @is_active: flag set when the interface is bound and not suspended. |
110 | * @sysfs_files_created: sysfs attributes exist | 110 | * @sysfs_files_created: sysfs attributes exist |
111 | * @unregistering: flag set when the interface is being unregistered | ||
111 | * @needs_remote_wakeup: flag set when the driver requires remote-wakeup | 112 | * @needs_remote_wakeup: flag set when the driver requires remote-wakeup |
112 | * capability during autosuspend. | 113 | * capability during autosuspend. |
113 | * @needs_altsetting0: flag set when a set-interface request for altsetting 0 | 114 | * @needs_altsetting0: flag set when a set-interface request for altsetting 0 |
@@ -163,6 +164,7 @@ struct usb_interface { | |||
163 | enum usb_interface_condition condition; /* state of binding */ | 164 | enum usb_interface_condition condition; /* state of binding */ |
164 | unsigned is_active:1; /* the interface is not suspended */ | 165 | unsigned is_active:1; /* the interface is not suspended */ |
165 | unsigned sysfs_files_created:1; /* the sysfs attributes exist */ | 166 | unsigned sysfs_files_created:1; /* the sysfs attributes exist */ |
167 | unsigned unregistering:1; /* unregistration is in progress */ | ||
166 | unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ | 168 | unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ |
167 | unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */ | 169 | unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */ |
168 | unsigned needs_binding:1; /* needs delayed unbind/rebind */ | 170 | unsigned needs_binding:1; /* needs delayed unbind/rebind */ |
@@ -1135,6 +1137,7 @@ struct usb_anchor { | |||
1135 | struct list_head urb_list; | 1137 | struct list_head urb_list; |
1136 | wait_queue_head_t wait; | 1138 | wait_queue_head_t wait; |
1137 | spinlock_t lock; | 1139 | spinlock_t lock; |
1140 | unsigned int poisoned:1; | ||
1138 | }; | 1141 | }; |
1139 | 1142 | ||
1140 | static inline void init_usb_anchor(struct usb_anchor *anchor) | 1143 | static inline void init_usb_anchor(struct usb_anchor *anchor) |
@@ -1459,12 +1462,18 @@ extern struct urb *usb_get_urb(struct urb *urb); | |||
1459 | extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags); | 1462 | extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags); |
1460 | extern int usb_unlink_urb(struct urb *urb); | 1463 | extern int usb_unlink_urb(struct urb *urb); |
1461 | extern void usb_kill_urb(struct urb *urb); | 1464 | extern void usb_kill_urb(struct urb *urb); |
1465 | extern void usb_poison_urb(struct urb *urb); | ||
1466 | extern void usb_unpoison_urb(struct urb *urb); | ||
1462 | extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); | 1467 | extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); |
1468 | extern void usb_poison_anchored_urbs(struct usb_anchor *anchor); | ||
1463 | extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor); | 1469 | extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor); |
1464 | extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); | 1470 | extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); |
1465 | extern void usb_unanchor_urb(struct urb *urb); | 1471 | extern void usb_unanchor_urb(struct urb *urb); |
1466 | extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, | 1472 | extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, |
1467 | unsigned int timeout); | 1473 | unsigned int timeout); |
1474 | extern struct urb *usb_get_from_anchor(struct usb_anchor *anchor); | ||
1475 | extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor); | ||
1476 | extern int usb_anchor_empty(struct usb_anchor *anchor); | ||
1468 | 1477 | ||
1469 | /** | 1478 | /** |
1470 | * usb_urb_dir_in - check if an URB describes an IN transfer | 1479 | * usb_urb_dir_in - check if an URB describes an IN transfer |
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild index 42e84fc315e3..54c446309a2a 100644 --- a/include/linux/usb/Kbuild +++ b/include/linux/usb/Kbuild | |||
@@ -4,4 +4,5 @@ header-y += ch9.h | |||
4 | header-y += gadgetfs.h | 4 | header-y += gadgetfs.h |
5 | header-y += midi.h | 5 | header-y += midi.h |
6 | header-y += g_printer.h | 6 | header-y += g_printer.h |
7 | 7 | header-y += tmc.h | |
8 | header-y += vstusb.h | ||
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h index ca228bb94218..18a729343ffa 100644 --- a/include/linux/usb/cdc.h +++ b/include/linux/usb/cdc.h | |||
@@ -160,6 +160,15 @@ struct usb_cdc_mdlm_detail_desc { | |||
160 | __u8 bDetailData[0]; | 160 | __u8 bDetailData[0]; |
161 | } __attribute__ ((packed)); | 161 | } __attribute__ ((packed)); |
162 | 162 | ||
163 | /* "OBEX Control Model Functional Descriptor" */ | ||
164 | struct usb_cdc_obex_desc { | ||
165 | __u8 bLength; | ||
166 | __u8 bDescriptorType; | ||
167 | __u8 bDescriptorSubType; | ||
168 | |||
169 | __le16 bcdVersion; | ||
170 | } __attribute__ ((packed)); | ||
171 | |||
163 | /*-------------------------------------------------------------------------*/ | 172 | /*-------------------------------------------------------------------------*/ |
164 | 173 | ||
165 | /* | 174 | /* |
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index c932390c6da0..935c380ffe47 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
@@ -130,6 +130,9 @@ struct usb_function { | |||
130 | 130 | ||
131 | int usb_add_function(struct usb_configuration *, struct usb_function *); | 131 | int usb_add_function(struct usb_configuration *, struct usb_function *); |
132 | 132 | ||
133 | int usb_function_deactivate(struct usb_function *); | ||
134 | int usb_function_activate(struct usb_function *); | ||
135 | |||
133 | int usb_interface_id(struct usb_configuration *, struct usb_function *); | 136 | int usb_interface_id(struct usb_configuration *, struct usb_function *); |
134 | 137 | ||
135 | /** | 138 | /** |
@@ -316,9 +319,13 @@ struct usb_composite_dev { | |||
316 | struct usb_composite_driver *driver; | 319 | struct usb_composite_driver *driver; |
317 | u8 next_string_id; | 320 | u8 next_string_id; |
318 | 321 | ||
319 | spinlock_t lock; | 322 | /* the gadget driver won't enable the data pullup |
323 | * while the deactivation count is nonzero. | ||
324 | */ | ||
325 | unsigned deactivations; | ||
320 | 326 | ||
321 | /* REVISIT use and existence of lock ... */ | 327 | /* protects at least deactivation count */ |
328 | spinlock_t lock; | ||
322 | }; | 329 | }; |
323 | 330 | ||
324 | extern int usb_string_id(struct usb_composite_dev *c); | 331 | extern int usb_string_id(struct usb_composite_dev *c); |
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h new file mode 100644 index 000000000000..5b88e36c9103 --- /dev/null +++ b/include/linux/usb/ehci_def.h | |||
@@ -0,0 +1,160 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2001-2002 by David Brownell | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but | ||
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
12 | * 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 Foundation, | ||
16 | * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
17 | */ | ||
18 | |||
19 | #ifndef __LINUX_USB_EHCI_DEF_H | ||
20 | #define __LINUX_USB_EHCI_DEF_H | ||
21 | |||
22 | /* EHCI register interface, corresponds to EHCI Revision 0.95 specification */ | ||
23 | |||
24 | /* Section 2.2 Host Controller Capability Registers */ | ||
25 | struct ehci_caps { | ||
26 | /* these fields are specified as 8 and 16 bit registers, | ||
27 | * but some hosts can't perform 8 or 16 bit PCI accesses. | ||
28 | */ | ||
29 | u32 hc_capbase; | ||
30 | #define HC_LENGTH(p) (((p)>>00)&0x00ff) /* bits 7:0 */ | ||
31 | #define HC_VERSION(p) (((p)>>16)&0xffff) /* bits 31:16 */ | ||
32 | u32 hcs_params; /* HCSPARAMS - offset 0x4 */ | ||
33 | #define HCS_DEBUG_PORT(p) (((p)>>20)&0xf) /* bits 23:20, debug port? */ | ||
34 | #define HCS_INDICATOR(p) ((p)&(1 << 16)) /* true: has port indicators */ | ||
35 | #define HCS_N_CC(p) (((p)>>12)&0xf) /* bits 15:12, #companion HCs */ | ||
36 | #define HCS_N_PCC(p) (((p)>>8)&0xf) /* bits 11:8, ports per CC */ | ||
37 | #define HCS_PORTROUTED(p) ((p)&(1 << 7)) /* true: port routing */ | ||
38 | #define HCS_PPC(p) ((p)&(1 << 4)) /* true: port power control */ | ||
39 | #define HCS_N_PORTS(p) (((p)>>0)&0xf) /* bits 3:0, ports on HC */ | ||
40 | |||
41 | u32 hcc_params; /* HCCPARAMS - offset 0x8 */ | ||
42 | #define HCC_EXT_CAPS(p) (((p)>>8)&0xff) /* for pci extended caps */ | ||
43 | #define HCC_ISOC_CACHE(p) ((p)&(1 << 7)) /* true: can cache isoc frame */ | ||
44 | #define HCC_ISOC_THRES(p) (((p)>>4)&0x7) /* bits 6:4, uframes cached */ | ||
45 | #define HCC_CANPARK(p) ((p)&(1 << 2)) /* true: can park on async qh */ | ||
46 | #define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/ | ||
47 | #define HCC_64BIT_ADDR(p) ((p)&(1)) /* true: can use 64-bit addr */ | ||
48 | u8 portroute [8]; /* nibbles for routing - offset 0xC */ | ||
49 | } __attribute__ ((packed)); | ||
50 | |||
51 | |||
52 | /* Section 2.3 Host Controller Operational Registers */ | ||
53 | struct ehci_regs { | ||
54 | |||
55 | /* USBCMD: offset 0x00 */ | ||
56 | u32 command; | ||
57 | /* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */ | ||
58 | #define CMD_PARK (1<<11) /* enable "park" on async qh */ | ||
59 | #define CMD_PARK_CNT(c) (((c)>>8)&3) /* how many transfers to park for */ | ||
60 | #define CMD_LRESET (1<<7) /* partial reset (no ports, etc) */ | ||
61 | #define CMD_IAAD (1<<6) /* "doorbell" interrupt async advance */ | ||
62 | #define CMD_ASE (1<<5) /* async schedule enable */ | ||
63 | #define CMD_PSE (1<<4) /* periodic schedule enable */ | ||
64 | /* 3:2 is periodic frame list size */ | ||
65 | #define CMD_RESET (1<<1) /* reset HC not bus */ | ||
66 | #define CMD_RUN (1<<0) /* start/stop HC */ | ||
67 | |||
68 | /* USBSTS: offset 0x04 */ | ||
69 | u32 status; | ||
70 | #define STS_ASS (1<<15) /* Async Schedule Status */ | ||
71 | #define STS_PSS (1<<14) /* Periodic Schedule Status */ | ||
72 | #define STS_RECL (1<<13) /* Reclamation */ | ||
73 | #define STS_HALT (1<<12) /* Not running (any reason) */ | ||
74 | /* some bits reserved */ | ||
75 | /* these STS_* flags are also intr_enable bits (USBINTR) */ | ||
76 | #define STS_IAA (1<<5) /* Interrupted on async advance */ | ||
77 | #define STS_FATAL (1<<4) /* such as some PCI access errors */ | ||
78 | #define STS_FLR (1<<3) /* frame list rolled over */ | ||
79 | #define STS_PCD (1<<2) /* port change detect */ | ||
80 | #define STS_ERR (1<<1) /* "error" completion (overflow, ...) */ | ||
81 | #define STS_INT (1<<0) /* "normal" completion (short, ...) */ | ||
82 | |||
83 | /* USBINTR: offset 0x08 */ | ||
84 | u32 intr_enable; | ||
85 | |||
86 | /* FRINDEX: offset 0x0C */ | ||
87 | u32 frame_index; /* current microframe number */ | ||
88 | /* CTRLDSSEGMENT: offset 0x10 */ | ||
89 | u32 segment; /* address bits 63:32 if needed */ | ||
90 | /* PERIODICLISTBASE: offset 0x14 */ | ||
91 | u32 frame_list; /* points to periodic list */ | ||
92 | /* ASYNCLISTADDR: offset 0x18 */ | ||
93 | u32 async_next; /* address of next async queue head */ | ||
94 | |||
95 | u32 reserved [9]; | ||
96 | |||
97 | /* CONFIGFLAG: offset 0x40 */ | ||
98 | u32 configured_flag; | ||
99 | #define FLAG_CF (1<<0) /* true: we'll support "high speed" */ | ||
100 | |||
101 | /* PORTSC: offset 0x44 */ | ||
102 | u32 port_status [0]; /* up to N_PORTS */ | ||
103 | /* 31:23 reserved */ | ||
104 | #define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */ | ||
105 | #define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ | ||
106 | #define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */ | ||
107 | /* 19:16 for port testing */ | ||
108 | #define PORT_LED_OFF (0<<14) | ||
109 | #define PORT_LED_AMBER (1<<14) | ||
110 | #define PORT_LED_GREEN (2<<14) | ||
111 | #define PORT_LED_MASK (3<<14) | ||
112 | #define PORT_OWNER (1<<13) /* true: companion hc owns this port */ | ||
113 | #define PORT_POWER (1<<12) /* true: has power (see PPC) */ | ||
114 | #define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */ | ||
115 | /* 11:10 for detecting lowspeed devices (reset vs release ownership) */ | ||
116 | /* 9 reserved */ | ||
117 | #define PORT_RESET (1<<8) /* reset port */ | ||
118 | #define PORT_SUSPEND (1<<7) /* suspend port */ | ||
119 | #define PORT_RESUME (1<<6) /* resume it */ | ||
120 | #define PORT_OCC (1<<5) /* over current change */ | ||
121 | #define PORT_OC (1<<4) /* over current active */ | ||
122 | #define PORT_PEC (1<<3) /* port enable change */ | ||
123 | #define PORT_PE (1<<2) /* port enable */ | ||
124 | #define PORT_CSC (1<<1) /* connect status change */ | ||
125 | #define PORT_CONNECT (1<<0) /* device connected */ | ||
126 | #define PORT_RWC_BITS (PORT_CSC | PORT_PEC | PORT_OCC) | ||
127 | } __attribute__ ((packed)); | ||
128 | |||
129 | #define USBMODE 0x68 /* USB Device mode */ | ||
130 | #define USBMODE_SDIS (1<<3) /* Stream disable */ | ||
131 | #define USBMODE_BE (1<<2) /* BE/LE endianness select */ | ||
132 | #define USBMODE_CM_HC (3<<0) /* host controller mode */ | ||
133 | #define USBMODE_CM_IDLE (0<<0) /* idle state */ | ||
134 | |||
135 | /* Appendix C, Debug port ... intended for use with special "debug devices" | ||
136 | * that can help if there's no serial console. (nonstandard enumeration.) | ||
137 | */ | ||
138 | struct ehci_dbg_port { | ||
139 | u32 control; | ||
140 | #define DBGP_OWNER (1<<30) | ||
141 | #define DBGP_ENABLED (1<<28) | ||
142 | #define DBGP_DONE (1<<16) | ||
143 | #define DBGP_INUSE (1<<10) | ||
144 | #define DBGP_ERRCODE(x) (((x)>>7)&0x07) | ||
145 | # define DBGP_ERR_BAD 1 | ||
146 | # define DBGP_ERR_SIGNAL 2 | ||
147 | #define DBGP_ERROR (1<<6) | ||
148 | #define DBGP_GO (1<<5) | ||
149 | #define DBGP_OUT (1<<4) | ||
150 | #define DBGP_LEN(x) (((x)>>0)&0x0f) | ||
151 | u32 pids; | ||
152 | #define DBGP_PID_GET(x) (((x)>>16)&0xff) | ||
153 | #define DBGP_PID_SET(data, tok) (((data)<<8)|(tok)) | ||
154 | u32 data03; | ||
155 | u32 data47; | ||
156 | u32 address; | ||
157 | #define DBGP_EPADDR(dev, ep) (((dev)<<8)|(ep)) | ||
158 | } __attribute__ ((packed)); | ||
159 | |||
160 | #endif /* __LINUX_USB_EHCI_DEF_H */ | ||
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 655341d0f534..0b8617a9176d 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -192,7 +192,7 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data) | |||
192 | * The driver.owner field should be set to the module owner of this driver. | 192 | * The driver.owner field should be set to the module owner of this driver. |
193 | * The driver.name field should be set to the name of this driver (remember | 193 | * The driver.name field should be set to the name of this driver (remember |
194 | * it will show up in sysfs, so it needs to be short and to the point. | 194 | * it will show up in sysfs, so it needs to be short and to the point. |
195 | * Useing the module name is a good idea.) | 195 | * Using the module name is a good idea.) |
196 | */ | 196 | */ |
197 | struct usb_serial_driver { | 197 | struct usb_serial_driver { |
198 | const char *description; | 198 | const char *description; |
diff --git a/include/linux/usb/tmc.h b/include/linux/usb/tmc.h new file mode 100644 index 000000000000..c045ae12556c --- /dev/null +++ b/include/linux/usb/tmc.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007 Stefan Kopp, Gechingen, Germany | ||
3 | * Copyright (C) 2008 Novell, Inc. | ||
4 | * Copyright (C) 2008 Greg Kroah-Hartman <gregkh@suse.de> | ||
5 | * | ||
6 | * This file holds USB constants defined by the USB Device Class | ||
7 | * Definition for Test and Measurement devices published by the USB-IF. | ||
8 | * | ||
9 | * It also has the ioctl definitions for the usbtmc kernel driver that | ||
10 | * userspace needs to know about. | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_USB_TMC_H | ||
14 | #define __LINUX_USB_TMC_H | ||
15 | |||
16 | /* USB TMC status values */ | ||
17 | #define USBTMC_STATUS_SUCCESS 0x01 | ||
18 | #define USBTMC_STATUS_PENDING 0x02 | ||
19 | #define USBTMC_STATUS_FAILED 0x80 | ||
20 | #define USBTMC_STATUS_TRANSFER_NOT_IN_PROGRESS 0x81 | ||
21 | #define USBTMC_STATUS_SPLIT_NOT_IN_PROGRESS 0x82 | ||
22 | #define USBTMC_STATUS_SPLIT_IN_PROGRESS 0x83 | ||
23 | |||
24 | /* USB TMC requests values */ | ||
25 | #define USBTMC_REQUEST_INITIATE_ABORT_BULK_OUT 1 | ||
26 | #define USBTMC_REQUEST_CHECK_ABORT_BULK_OUT_STATUS 2 | ||
27 | #define USBTMC_REQUEST_INITIATE_ABORT_BULK_IN 3 | ||
28 | #define USBTMC_REQUEST_CHECK_ABORT_BULK_IN_STATUS 4 | ||
29 | #define USBTMC_REQUEST_INITIATE_CLEAR 5 | ||
30 | #define USBTMC_REQUEST_CHECK_CLEAR_STATUS 6 | ||
31 | #define USBTMC_REQUEST_GET_CAPABILITIES 7 | ||
32 | #define USBTMC_REQUEST_INDICATOR_PULSE 64 | ||
33 | |||
34 | /* Request values for USBTMC driver's ioctl entry point */ | ||
35 | #define USBTMC_IOC_NR 91 | ||
36 | #define USBTMC_IOCTL_INDICATOR_PULSE _IO(USBTMC_IOC_NR, 1) | ||
37 | #define USBTMC_IOCTL_CLEAR _IO(USBTMC_IOC_NR, 2) | ||
38 | #define USBTMC_IOCTL_ABORT_BULK_OUT _IO(USBTMC_IOC_NR, 3) | ||
39 | #define USBTMC_IOCTL_ABORT_BULK_IN _IO(USBTMC_IOC_NR, 4) | ||
40 | #define USBTMC_IOCTL_CLEAR_OUT_HALT _IO(USBTMC_IOC_NR, 6) | ||
41 | #define USBTMC_IOCTL_CLEAR_IN_HALT _IO(USBTMC_IOC_NR, 7) | ||
42 | |||
43 | #endif | ||
diff --git a/include/linux/usb/vstusb.h b/include/linux/usb/vstusb.h new file mode 100644 index 000000000000..1cfac67191ff --- /dev/null +++ b/include/linux/usb/vstusb.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /***************************************************************************** | ||
2 | * File: drivers/usb/misc/vstusb.h | ||
3 | * | ||
4 | * Purpose: Support for the bulk USB Vernier Spectrophotometers | ||
5 | * | ||
6 | * Author: EQware Engineering, Inc. | ||
7 | * Oregon City, OR, USA 97045 | ||
8 | * | ||
9 | * Copyright: 2007, 2008 | ||
10 | * Vernier Software & Technology | ||
11 | * Beaverton, OR, USA 97005 | ||
12 | * | ||
13 | * Web: www.vernier.com | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify | ||
16 | * it under the terms of the GNU General Public License version 2 as | ||
17 | * published by the Free Software Foundation. | ||
18 | * | ||
19 | *****************************************************************************/ | ||
20 | /***************************************************************************** | ||
21 | * | ||
22 | * The vstusb module is a standard usb 'client' driver running on top of the | ||
23 | * standard usb host controller stack. | ||
24 | * | ||
25 | * In general, vstusb supports standard bulk usb pipes. It supports multiple | ||
26 | * devices and multiple pipes per device. | ||
27 | * | ||
28 | * The vstusb driver supports two interfaces: | ||
29 | * 1 - ioctl SEND_PIPE/RECV_PIPE - a general bulk write/read msg | ||
30 | * interface to any pipe with timeout support; | ||
31 | * 2 - standard read/write with ioctl config - offers standard read/write | ||
32 | * interface with ioctl configured pipes and timeouts. | ||
33 | * | ||
34 | * Both interfaces can be signal from other process and will abort its i/o | ||
35 | * operation. | ||
36 | * | ||
37 | * A timeout of 0 means NO timeout. The user can still terminate the read via | ||
38 | * signal. | ||
39 | * | ||
40 | * If using multiple threads with this driver, the user should ensure that | ||
41 | * any reads, writes, or ioctls are complete before closing the device. | ||
42 | * Changing read/write timeouts or pipes takes effect on next read/write. | ||
43 | * | ||
44 | *****************************************************************************/ | ||
45 | |||
46 | struct vstusb_args { | ||
47 | union { | ||
48 | /* this struct is used for IOCTL_VSTUSB_SEND_PIPE, * | ||
49 | * IOCTL_VSTUSB_RECV_PIPE, and read()/write() fops */ | ||
50 | struct { | ||
51 | void __user *buffer; | ||
52 | size_t count; | ||
53 | unsigned int timeout_ms; | ||
54 | int pipe; | ||
55 | }; | ||
56 | |||
57 | /* this one is used for IOCTL_VSTUSB_CONFIG_RW */ | ||
58 | struct { | ||
59 | int rd_pipe; | ||
60 | int rd_timeout_ms; | ||
61 | int wr_pipe; | ||
62 | int wr_timeout_ms; | ||
63 | }; | ||
64 | }; | ||
65 | }; | ||
66 | |||
67 | #define VST_IOC_MAGIC 'L' | ||
68 | #define VST_IOC_FIRST 0x20 | ||
69 | #define IOCTL_VSTUSB_SEND_PIPE _IO(VST_IOC_MAGIC, VST_IOC_FIRST) | ||
70 | #define IOCTL_VSTUSB_RECV_PIPE _IO(VST_IOC_MAGIC, VST_IOC_FIRST + 1) | ||
71 | #define IOCTL_VSTUSB_CONFIG_RW _IO(VST_IOC_MAGIC, VST_IOC_FIRST + 2) | ||
diff --git a/include/linux/usb/wusb-wa.h b/include/linux/usb/wusb-wa.h new file mode 100644 index 000000000000..a102561e7026 --- /dev/null +++ b/include/linux/usb/wusb-wa.h | |||
@@ -0,0 +1,271 @@ | |||
1 | /* | ||
2 | * Wireless USB Wire Adapter constants and structures. | ||
3 | * | ||
4 | * Copyright (C) 2005-2006 Intel Corporation. | ||
5 | * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License version | ||
9 | * 2 as published by the Free Software Foundation. | ||
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., 51 Franklin Street, Fifth Floor, Boston, MA | ||
19 | * 02110-1301, USA. | ||
20 | * | ||
21 | * | ||
22 | * FIXME: docs | ||
23 | * FIXME: organize properly, group logically | ||
24 | * | ||
25 | * All the event structures are defined in uwb/spec.h, as they are | ||
26 | * common to the WHCI and WUSB radio control interfaces. | ||
27 | * | ||
28 | * References: | ||
29 | * [WUSB] Wireless Universal Serial Bus Specification, revision 1.0, ch8 | ||
30 | */ | ||
31 | #ifndef __LINUX_USB_WUSB_WA_H | ||
32 | #define __LINUX_USB_WUSB_WA_H | ||
33 | |||
34 | /** | ||
35 | * Radio Command Request for the Radio Control Interface | ||
36 | * | ||
37 | * Radio Control Interface command and event codes are the same as | ||
38 | * WHCI, and listed in include/linux/uwb.h:UWB_RC_{CMD,EVT}_* | ||
39 | */ | ||
40 | enum { | ||
41 | WA_EXEC_RC_CMD = 40, /* Radio Control command Request */ | ||
42 | }; | ||
43 | |||
44 | /* Wireless Adapter Requests ([WUSB] table 8-51) */ | ||
45 | enum { | ||
46 | WUSB_REQ_ADD_MMC_IE = 20, | ||
47 | WUSB_REQ_REMOVE_MMC_IE = 21, | ||
48 | WUSB_REQ_SET_NUM_DNTS = 22, | ||
49 | WUSB_REQ_SET_CLUSTER_ID = 23, | ||
50 | WUSB_REQ_SET_DEV_INFO = 24, | ||
51 | WUSB_REQ_GET_TIME = 25, | ||
52 | WUSB_REQ_SET_STREAM_IDX = 26, | ||
53 | WUSB_REQ_SET_WUSB_MAS = 27, | ||
54 | }; | ||
55 | |||
56 | |||
57 | /* Wireless Adapter WUSB Channel Time types ([WUSB] table 8-52) */ | ||
58 | enum { | ||
59 | WUSB_TIME_ADJ = 0, | ||
60 | WUSB_TIME_BPST = 1, | ||
61 | WUSB_TIME_WUSB = 2, | ||
62 | }; | ||
63 | |||
64 | enum { | ||
65 | WA_ENABLE = 0x01, | ||
66 | WA_RESET = 0x02, | ||
67 | RPIPE_PAUSE = 0x1, | ||
68 | }; | ||
69 | |||
70 | /* Responses from Get Status request ([WUSB] section 8.3.1.6) */ | ||
71 | enum { | ||
72 | WA_STATUS_ENABLED = 0x01, | ||
73 | WA_STATUS_RESETTING = 0x02 | ||
74 | }; | ||
75 | |||
76 | enum rpipe_crs { | ||
77 | RPIPE_CRS_CTL = 0x01, | ||
78 | RPIPE_CRS_ISO = 0x02, | ||
79 | RPIPE_CRS_BULK = 0x04, | ||
80 | RPIPE_CRS_INTR = 0x08 | ||
81 | }; | ||
82 | |||
83 | /** | ||
84 | * RPipe descriptor ([WUSB] section 8.5.2.11) | ||
85 | * | ||
86 | * FIXME: explain rpipes | ||
87 | */ | ||
88 | struct usb_rpipe_descriptor { | ||
89 | u8 bLength; | ||
90 | u8 bDescriptorType; | ||
91 | __le16 wRPipeIndex; | ||
92 | __le16 wRequests; | ||
93 | __le16 wBlocks; /* rw if 0 */ | ||
94 | __le16 wMaxPacketSize; /* rw? */ | ||
95 | u8 bHSHubAddress; /* reserved: 0 */ | ||
96 | u8 bHSHubPort; /* ??? FIXME ??? */ | ||
97 | u8 bSpeed; /* rw: xfer rate 'enum uwb_phy_rate' */ | ||
98 | u8 bDeviceAddress; /* rw: Target device address */ | ||
99 | u8 bEndpointAddress; /* rw: Target EP address */ | ||
100 | u8 bDataSequence; /* ro: Current Data sequence */ | ||
101 | __le32 dwCurrentWindow; /* ro */ | ||
102 | u8 bMaxDataSequence; /* ro?: max supported seq */ | ||
103 | u8 bInterval; /* rw: */ | ||
104 | u8 bOverTheAirInterval; /* rw: */ | ||
105 | u8 bmAttribute; /* ro? */ | ||
106 | u8 bmCharacteristics; /* ro? enum rpipe_attr, supported xsactions */ | ||
107 | u8 bmRetryOptions; /* rw? */ | ||
108 | __le16 wNumTransactionErrors; /* rw */ | ||
109 | } __attribute__ ((packed)); | ||
110 | |||
111 | /** | ||
112 | * Wire Adapter Notification types ([WUSB] sections 8.4.5 & 8.5.4) | ||
113 | * | ||
114 | * These are the notifications coming on the notification endpoint of | ||
115 | * an HWA and a DWA. | ||
116 | */ | ||
117 | enum wa_notif_type { | ||
118 | DWA_NOTIF_RWAKE = 0x91, | ||
119 | DWA_NOTIF_PORTSTATUS = 0x92, | ||
120 | WA_NOTIF_TRANSFER = 0x93, | ||
121 | HWA_NOTIF_BPST_ADJ = 0x94, | ||
122 | HWA_NOTIF_DN = 0x95, | ||
123 | }; | ||
124 | |||
125 | /** | ||
126 | * Wire Adapter notification header | ||
127 | * | ||
128 | * Notifications coming from a wire adapter use a common header | ||
129 | * defined in [WUSB] sections 8.4.5 & 8.5.4. | ||
130 | */ | ||
131 | struct wa_notif_hdr { | ||
132 | u8 bLength; | ||
133 | u8 bNotifyType; /* enum wa_notif_type */ | ||
134 | } __attribute__((packed)); | ||
135 | |||
136 | /** | ||
137 | * HWA DN Received notification [(WUSB] section 8.5.4.2) | ||
138 | * | ||
139 | * The DNData is specified in WUSB1.0[7.6]. For each device | ||
140 | * notification we received, we just need to dispatch it. | ||
141 | * | ||
142 | * @dndata: this is really an array of notifications, but all start | ||
143 | * with the same header. | ||
144 | */ | ||
145 | struct hwa_notif_dn { | ||
146 | struct wa_notif_hdr hdr; | ||
147 | u8 bSourceDeviceAddr; /* from errata 2005/07 */ | ||
148 | u8 bmAttributes; | ||
149 | struct wusb_dn_hdr dndata[]; | ||
150 | } __attribute__((packed)); | ||
151 | |||
152 | /* [WUSB] section 8.3.3 */ | ||
153 | enum wa_xfer_type { | ||
154 | WA_XFER_TYPE_CTL = 0x80, | ||
155 | WA_XFER_TYPE_BI = 0x81, /* bulk/interrupt */ | ||
156 | WA_XFER_TYPE_ISO = 0x82, | ||
157 | WA_XFER_RESULT = 0x83, | ||
158 | WA_XFER_ABORT = 0x84, | ||
159 | }; | ||
160 | |||
161 | /* [WUSB] section 8.3.3 */ | ||
162 | struct wa_xfer_hdr { | ||
163 | u8 bLength; /* 0x18 */ | ||
164 | u8 bRequestType; /* 0x80 WA_REQUEST_TYPE_CTL */ | ||
165 | __le16 wRPipe; /* RPipe index */ | ||
166 | __le32 dwTransferID; /* Host-assigned ID */ | ||
167 | __le32 dwTransferLength; /* Length of data to xfer */ | ||
168 | u8 bTransferSegment; | ||
169 | } __attribute__((packed)); | ||
170 | |||
171 | struct wa_xfer_ctl { | ||
172 | struct wa_xfer_hdr hdr; | ||
173 | u8 bmAttribute; | ||
174 | __le16 wReserved; | ||
175 | struct usb_ctrlrequest baSetupData; | ||
176 | } __attribute__((packed)); | ||
177 | |||
178 | struct wa_xfer_bi { | ||
179 | struct wa_xfer_hdr hdr; | ||
180 | u8 bReserved; | ||
181 | __le16 wReserved; | ||
182 | } __attribute__((packed)); | ||
183 | |||
184 | struct wa_xfer_hwaiso { | ||
185 | struct wa_xfer_hdr hdr; | ||
186 | u8 bReserved; | ||
187 | __le16 wPresentationTime; | ||
188 | __le32 dwNumOfPackets; | ||
189 | /* FIXME: u8 pktdata[]? */ | ||
190 | } __attribute__((packed)); | ||
191 | |||
192 | /* [WUSB] section 8.3.3.5 */ | ||
193 | struct wa_xfer_abort { | ||
194 | u8 bLength; | ||
195 | u8 bRequestType; | ||
196 | __le16 wRPipe; /* RPipe index */ | ||
197 | __le32 dwTransferID; /* Host-assigned ID */ | ||
198 | } __attribute__((packed)); | ||
199 | |||
200 | /** | ||
201 | * WA Transfer Complete notification ([WUSB] section 8.3.3.3) | ||
202 | * | ||
203 | */ | ||
204 | struct wa_notif_xfer { | ||
205 | struct wa_notif_hdr hdr; | ||
206 | u8 bEndpoint; | ||
207 | u8 Reserved; | ||
208 | } __attribute__((packed)); | ||
209 | |||
210 | /** Transfer result basic codes [WUSB] table 8-15 */ | ||
211 | enum { | ||
212 | WA_XFER_STATUS_SUCCESS, | ||
213 | WA_XFER_STATUS_HALTED, | ||
214 | WA_XFER_STATUS_DATA_BUFFER_ERROR, | ||
215 | WA_XFER_STATUS_BABBLE, | ||
216 | WA_XFER_RESERVED, | ||
217 | WA_XFER_STATUS_NOT_FOUND, | ||
218 | WA_XFER_STATUS_INSUFFICIENT_RESOURCE, | ||
219 | WA_XFER_STATUS_TRANSACTION_ERROR, | ||
220 | WA_XFER_STATUS_ABORTED, | ||
221 | WA_XFER_STATUS_RPIPE_NOT_READY, | ||
222 | WA_XFER_INVALID_FORMAT, | ||
223 | WA_XFER_UNEXPECTED_SEGMENT_NUMBER, | ||
224 | WA_XFER_STATUS_RPIPE_TYPE_MISMATCH, | ||
225 | }; | ||
226 | |||
227 | /** [WUSB] section 8.3.3.4 */ | ||
228 | struct wa_xfer_result { | ||
229 | struct wa_notif_hdr hdr; | ||
230 | __le32 dwTransferID; | ||
231 | __le32 dwTransferLength; | ||
232 | u8 bTransferSegment; | ||
233 | u8 bTransferStatus; | ||
234 | __le32 dwNumOfPackets; | ||
235 | } __attribute__((packed)); | ||
236 | |||
237 | /** | ||
238 | * Wire Adapter Class Descriptor ([WUSB] section 8.5.2.7). | ||
239 | * | ||
240 | * NOTE: u16 fields are read Little Endian from the hardware. | ||
241 | * | ||
242 | * @bNumPorts is the original max number of devices that the host can | ||
243 | * connect; we might chop this so the stack can handle | ||
244 | * it. In case you need to access it, use wusbhc->ports_max | ||
245 | * if it is a Wireless USB WA. | ||
246 | */ | ||
247 | struct usb_wa_descriptor { | ||
248 | u8 bLength; | ||
249 | u8 bDescriptorType; | ||
250 | u16 bcdWAVersion; | ||
251 | u8 bNumPorts; /* don't use!! */ | ||
252 | u8 bmAttributes; /* Reserved == 0 */ | ||
253 | u16 wNumRPipes; | ||
254 | u16 wRPipeMaxBlock; | ||
255 | u8 bRPipeBlockSize; | ||
256 | u8 bPwrOn2PwrGood; | ||
257 | u8 bNumMMCIEs; | ||
258 | u8 DeviceRemovable; /* FIXME: in DWA this is up to 16 bytes */ | ||
259 | } __attribute__((packed)); | ||
260 | |||
261 | /** | ||
262 | * HWA Device Information Buffer (WUSB1.0[T8.54]) | ||
263 | */ | ||
264 | struct hwa_dev_info { | ||
265 | u8 bmDeviceAvailability[32]; /* FIXME: ignored for now */ | ||
266 | u8 bDeviceAddress; | ||
267 | __le16 wPHYRates; | ||
268 | u8 bmDeviceAttribute; | ||
269 | } __attribute__((packed)); | ||
270 | |||
271 | #endif /* #ifndef __LINUX_USB_WUSB_WA_H */ | ||
diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h new file mode 100644 index 000000000000..5f401b644ed5 --- /dev/null +++ b/include/linux/usb/wusb.h | |||
@@ -0,0 +1,376 @@ | |||
1 | /* | ||
2 | * Wireless USB Standard Definitions | ||
3 | * Event Size Tables | ||
4 | * | ||
5 | * Copyright (C) 2005-2006 Intel Corporation | ||
6 | * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License version | ||
10 | * 2 as published by the Free Software Foundation. | ||
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 Street, Fifth Floor, Boston, MA | ||
20 | * 02110-1301, USA. | ||
21 | * | ||
22 | * | ||
23 | * FIXME: docs | ||
24 | * FIXME: organize properly, group logically | ||
25 | * | ||
26 | * All the event structures are defined in uwb/spec.h, as they are | ||
27 | * common to the WHCI and WUSB radio control interfaces. | ||
28 | */ | ||
29 | |||
30 | #ifndef __WUSB_H__ | ||
31 | #define __WUSB_H__ | ||
32 | |||
33 | #include <linux/types.h> | ||
34 | #include <linux/kernel.h> | ||
35 | #include <linux/uwb/spec.h> | ||
36 | #include <linux/usb/ch9.h> | ||
37 | #include <linux/param.h> | ||
38 | |||
39 | /** | ||
40 | * WUSB Information Element header | ||
41 | * | ||
42 | * I don't know why, they decided to make it different to the MBOA MAC | ||
43 | * IE Header; beats me. | ||
44 | */ | ||
45 | struct wuie_hdr { | ||
46 | u8 bLength; | ||
47 | u8 bIEIdentifier; | ||
48 | } __attribute__((packed)); | ||
49 | |||
50 | enum { | ||
51 | WUIE_ID_WCTA = 0x80, | ||
52 | WUIE_ID_CONNECTACK, | ||
53 | WUIE_ID_HOST_INFO, | ||
54 | WUIE_ID_CHANGE_ANNOUNCE, | ||
55 | WUIE_ID_DEVICE_DISCONNECT, | ||
56 | WUIE_ID_HOST_DISCONNECT, | ||
57 | WUIE_ID_KEEP_ALIVE = 0x89, | ||
58 | WUIE_ID_ISOCH_DISCARD, | ||
59 | WUIE_ID_RESET_DEVICE, | ||
60 | }; | ||
61 | |||
62 | /** | ||
63 | * Maximum number of array elements in a WUSB IE. | ||
64 | * | ||
65 | * WUSB1.0[7.5 before table 7-38] says that in WUSB IEs that | ||
66 | * are "arrays" have to limited to 4 elements. So we define it | ||
67 | * like that to ease up and submit only the neeed size. | ||
68 | */ | ||
69 | #define WUIE_ELT_MAX 4 | ||
70 | |||
71 | /** | ||
72 | * Wrapper for the data that defines a CHID, a CDID or a CK | ||
73 | * | ||
74 | * WUSB defines that CHIDs, CDIDs and CKs are a 16 byte string of | ||
75 | * data. In order to avoid confusion and enforce types, we wrap it. | ||
76 | * | ||
77 | * Make it packed, as we use it in some hw defintions. | ||
78 | */ | ||
79 | struct wusb_ckhdid { | ||
80 | u8 data[16]; | ||
81 | } __attribute__((packed)); | ||
82 | |||
83 | const static | ||
84 | struct wusb_ckhdid wusb_ckhdid_zero = { .data = { 0 } }; | ||
85 | |||
86 | #define WUSB_CKHDID_STRSIZE (3 * sizeof(struct wusb_ckhdid) + 1) | ||
87 | |||
88 | /** | ||
89 | * WUSB IE: Host Information (WUSB1.0[7.5.2]) | ||
90 | * | ||
91 | * Used to provide information about the host to the Wireless USB | ||
92 | * devices in range (CHID can be used as an ASCII string). | ||
93 | */ | ||
94 | struct wuie_host_info { | ||
95 | struct wuie_hdr hdr; | ||
96 | __le16 attributes; | ||
97 | struct wusb_ckhdid CHID; | ||
98 | } __attribute__((packed)); | ||
99 | |||
100 | /** | ||
101 | * WUSB IE: Connect Ack (WUSB1.0[7.5.1]) | ||
102 | * | ||
103 | * Used to acknowledge device connect requests. See note for | ||
104 | * WUIE_ELT_MAX. | ||
105 | */ | ||
106 | struct wuie_connect_ack { | ||
107 | struct wuie_hdr hdr; | ||
108 | struct { | ||
109 | struct wusb_ckhdid CDID; | ||
110 | u8 bDeviceAddress; /* 0 means unused */ | ||
111 | u8 bReserved; | ||
112 | } blk[WUIE_ELT_MAX]; | ||
113 | } __attribute__((packed)); | ||
114 | |||
115 | /** | ||
116 | * WUSB IE Host Information Element, Connect Availability | ||
117 | * | ||
118 | * WUSB1.0[7.5.2], bmAttributes description | ||
119 | */ | ||
120 | enum { | ||
121 | WUIE_HI_CAP_RECONNECT = 0, | ||
122 | WUIE_HI_CAP_LIMITED, | ||
123 | WUIE_HI_CAP_RESERVED, | ||
124 | WUIE_HI_CAP_ALL, | ||
125 | }; | ||
126 | |||
127 | /** | ||
128 | * WUSB IE: Channel Stop (WUSB1.0[7.5.8]) | ||
129 | * | ||
130 | * Tells devices the host is going to stop sending MMCs and will dissapear. | ||
131 | */ | ||
132 | struct wuie_channel_stop { | ||
133 | struct wuie_hdr hdr; | ||
134 | u8 attributes; | ||
135 | u8 timestamp[3]; | ||
136 | } __attribute__((packed)); | ||
137 | |||
138 | /** | ||
139 | * WUSB IE: Keepalive (WUSB1.0[7.5.9]) | ||
140 | * | ||
141 | * Ask device(s) to send keepalives. | ||
142 | */ | ||
143 | struct wuie_keep_alive { | ||
144 | struct wuie_hdr hdr; | ||
145 | u8 bDeviceAddress[WUIE_ELT_MAX]; | ||
146 | } __attribute__((packed)); | ||
147 | |||
148 | /** | ||
149 | * WUSB IE: Reset device (WUSB1.0[7.5.11]) | ||
150 | * | ||
151 | * Tell device to reset; in all truth, we can fit 4 CDIDs, but we only | ||
152 | * use it for one at the time... | ||
153 | * | ||
154 | * In any case, this request is a wee bit silly: why don't they target | ||
155 | * by address?? | ||
156 | */ | ||
157 | struct wuie_reset { | ||
158 | struct wuie_hdr hdr; | ||
159 | struct wusb_ckhdid CDID; | ||
160 | } __attribute__((packed)); | ||
161 | |||
162 | /** | ||
163 | * WUSB IE: Disconnect device (WUSB1.0[7.5.11]) | ||
164 | * | ||
165 | * Tell device to disconnect; we can fit 4 addresses, but we only use | ||
166 | * it for one at the time... | ||
167 | */ | ||
168 | struct wuie_disconnect { | ||
169 | struct wuie_hdr hdr; | ||
170 | u8 bDeviceAddress; | ||
171 | u8 padding; | ||
172 | } __attribute__((packed)); | ||
173 | |||
174 | /** | ||
175 | * WUSB IE: Host disconnect ([WUSB] section 7.5.5) | ||
176 | * | ||
177 | * Tells all connected devices to disconnect. | ||
178 | */ | ||
179 | struct wuie_host_disconnect { | ||
180 | struct wuie_hdr hdr; | ||
181 | } __attribute__((packed)); | ||
182 | |||
183 | /** | ||
184 | * WUSB Device Notification header (WUSB1.0[7.6]) | ||
185 | */ | ||
186 | struct wusb_dn_hdr { | ||
187 | u8 bType; | ||
188 | u8 notifdata[]; | ||
189 | } __attribute__((packed)); | ||
190 | |||
191 | /** Device Notification codes (WUSB1.0[Table 7-54]) */ | ||
192 | enum WUSB_DN { | ||
193 | WUSB_DN_CONNECT = 0x01, | ||
194 | WUSB_DN_DISCONNECT = 0x02, | ||
195 | WUSB_DN_EPRDY = 0x03, | ||
196 | WUSB_DN_MASAVAILCHANGED = 0x04, | ||
197 | WUSB_DN_RWAKE = 0x05, | ||
198 | WUSB_DN_SLEEP = 0x06, | ||
199 | WUSB_DN_ALIVE = 0x07, | ||
200 | }; | ||
201 | |||
202 | /** WUSB Device Notification Connect */ | ||
203 | struct wusb_dn_connect { | ||
204 | struct wusb_dn_hdr hdr; | ||
205 | __le16 attributes; | ||
206 | struct wusb_ckhdid CDID; | ||
207 | } __attribute__((packed)); | ||
208 | |||
209 | static inline int wusb_dn_connect_prev_dev_addr(const struct wusb_dn_connect *dn) | ||
210 | { | ||
211 | return le16_to_cpu(dn->attributes) & 0xff; | ||
212 | } | ||
213 | |||
214 | static inline int wusb_dn_connect_new_connection(const struct wusb_dn_connect *dn) | ||
215 | { | ||
216 | return (le16_to_cpu(dn->attributes) >> 8) & 0x1; | ||
217 | } | ||
218 | |||
219 | static inline int wusb_dn_connect_beacon_behavior(const struct wusb_dn_connect *dn) | ||
220 | { | ||
221 | return (le16_to_cpu(dn->attributes) >> 9) & 0x03; | ||
222 | } | ||
223 | |||
224 | /** Device is alive (aka: pong) (WUSB1.0[7.6.7]) */ | ||
225 | struct wusb_dn_alive { | ||
226 | struct wusb_dn_hdr hdr; | ||
227 | } __attribute__((packed)); | ||
228 | |||
229 | /** Device is disconnecting (WUSB1.0[7.6.2]) */ | ||
230 | struct wusb_dn_disconnect { | ||
231 | struct wusb_dn_hdr hdr; | ||
232 | } __attribute__((packed)); | ||
233 | |||
234 | /* General constants */ | ||
235 | enum { | ||
236 | WUSB_TRUST_TIMEOUT_MS = 4000, /* [WUSB] section 4.15.1 */ | ||
237 | }; | ||
238 | |||
239 | static inline size_t ckhdid_printf(char *pr_ckhdid, size_t size, | ||
240 | const struct wusb_ckhdid *ckhdid) | ||
241 | { | ||
242 | return scnprintf(pr_ckhdid, size, | ||
243 | "%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx " | ||
244 | "%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx", | ||
245 | ckhdid->data[0], ckhdid->data[1], | ||
246 | ckhdid->data[2], ckhdid->data[3], | ||
247 | ckhdid->data[4], ckhdid->data[5], | ||
248 | ckhdid->data[6], ckhdid->data[7], | ||
249 | ckhdid->data[8], ckhdid->data[9], | ||
250 | ckhdid->data[10], ckhdid->data[11], | ||
251 | ckhdid->data[12], ckhdid->data[13], | ||
252 | ckhdid->data[14], ckhdid->data[15]); | ||
253 | } | ||
254 | |||
255 | /* | ||
256 | * WUSB Crypto stuff (WUSB1.0[6]) | ||
257 | */ | ||
258 | |||
259 | extern const char *wusb_et_name(u8); | ||
260 | |||
261 | /** | ||
262 | * WUSB key index WUSB1.0[7.3.2.4], for usage when setting keys for | ||
263 | * the host or the device. | ||
264 | */ | ||
265 | static inline u8 wusb_key_index(int index, int type, int originator) | ||
266 | { | ||
267 | return (originator << 6) | (type << 4) | index; | ||
268 | } | ||
269 | |||
270 | #define WUSB_KEY_INDEX_TYPE_PTK 0 /* for HWA only */ | ||
271 | #define WUSB_KEY_INDEX_TYPE_ASSOC 1 | ||
272 | #define WUSB_KEY_INDEX_TYPE_GTK 2 | ||
273 | #define WUSB_KEY_INDEX_ORIGINATOR_HOST 0 | ||
274 | #define WUSB_KEY_INDEX_ORIGINATOR_DEVICE 1 | ||
275 | |||
276 | /* A CCM Nonce, defined in WUSB1.0[6.4.1] */ | ||
277 | struct aes_ccm_nonce { | ||
278 | u8 sfn[6]; /* Little Endian */ | ||
279 | u8 tkid[3]; /* LE */ | ||
280 | struct uwb_dev_addr dest_addr; | ||
281 | struct uwb_dev_addr src_addr; | ||
282 | } __attribute__((packed)); | ||
283 | |||
284 | /* A CCM operation label, defined on WUSB1.0[6.5.x] */ | ||
285 | struct aes_ccm_label { | ||
286 | u8 data[14]; | ||
287 | } __attribute__((packed)); | ||
288 | |||
289 | /* | ||
290 | * Input to the key derivation sequence defined in | ||
291 | * WUSB1.0[6.5.1]. Rest of the data is in the CCM Nonce passed to the | ||
292 | * PRF function. | ||
293 | */ | ||
294 | struct wusb_keydvt_in { | ||
295 | u8 hnonce[16]; | ||
296 | u8 dnonce[16]; | ||
297 | } __attribute__((packed)); | ||
298 | |||
299 | /* | ||
300 | * Output from the key derivation sequence defined in | ||
301 | * WUSB1.0[6.5.1]. | ||
302 | */ | ||
303 | struct wusb_keydvt_out { | ||
304 | u8 kck[16]; | ||
305 | u8 ptk[16]; | ||
306 | } __attribute__((packed)); | ||
307 | |||
308 | /* Pseudo Random Function WUSB1.0[6.5] */ | ||
309 | extern int wusb_crypto_init(void); | ||
310 | extern void wusb_crypto_exit(void); | ||
311 | extern ssize_t wusb_prf(void *out, size_t out_size, | ||
312 | const u8 key[16], const struct aes_ccm_nonce *_n, | ||
313 | const struct aes_ccm_label *a, | ||
314 | const void *b, size_t blen, size_t len); | ||
315 | |||
316 | static inline int wusb_prf_64(void *out, size_t out_size, const u8 key[16], | ||
317 | const struct aes_ccm_nonce *n, | ||
318 | const struct aes_ccm_label *a, | ||
319 | const void *b, size_t blen) | ||
320 | { | ||
321 | return wusb_prf(out, out_size, key, n, a, b, blen, 64); | ||
322 | } | ||
323 | |||
324 | static inline int wusb_prf_128(void *out, size_t out_size, const u8 key[16], | ||
325 | const struct aes_ccm_nonce *n, | ||
326 | const struct aes_ccm_label *a, | ||
327 | const void *b, size_t blen) | ||
328 | { | ||
329 | return wusb_prf(out, out_size, key, n, a, b, blen, 128); | ||
330 | } | ||
331 | |||
332 | static inline int wusb_prf_256(void *out, size_t out_size, const u8 key[16], | ||
333 | const struct aes_ccm_nonce *n, | ||
334 | const struct aes_ccm_label *a, | ||
335 | const void *b, size_t blen) | ||
336 | { | ||
337 | return wusb_prf(out, out_size, key, n, a, b, blen, 256); | ||
338 | } | ||
339 | |||
340 | /* Key derivation WUSB1.0[6.5.1] */ | ||
341 | static inline int wusb_key_derive(struct wusb_keydvt_out *keydvt_out, | ||
342 | const u8 key[16], | ||
343 | const struct aes_ccm_nonce *n, | ||
344 | const struct wusb_keydvt_in *keydvt_in) | ||
345 | { | ||
346 | const struct aes_ccm_label a = { .data = "Pair-wise keys" }; | ||
347 | return wusb_prf_256(keydvt_out, sizeof(*keydvt_out), key, n, &a, | ||
348 | keydvt_in, sizeof(*keydvt_in)); | ||
349 | } | ||
350 | |||
351 | /* | ||
352 | * Out-of-band MIC Generation WUSB1.0[6.5.2] | ||
353 | * | ||
354 | * Compute the MIC over @key, @n and @hs and place it in @mic_out. | ||
355 | * | ||
356 | * @mic_out: Where to place the 8 byte MIC tag | ||
357 | * @key: KCK from the derivation process | ||
358 | * @n: CCM nonce, n->sfn == 0, TKID as established in the | ||
359 | * process. | ||
360 | * @hs: Handshake struct for phase 2 of the 4-way. | ||
361 | * hs->bStatus and hs->bReserved are zero. | ||
362 | * hs->bMessageNumber is 2 (WUSB1.0[7.3.2.5.2] | ||
363 | * hs->dest_addr is the device's USB address padded with 0 | ||
364 | * hs->src_addr is the hosts's UWB device address | ||
365 | * hs->mic is ignored (as we compute that value). | ||
366 | */ | ||
367 | static inline int wusb_oob_mic(u8 mic_out[8], const u8 key[16], | ||
368 | const struct aes_ccm_nonce *n, | ||
369 | const struct usb_handshake *hs) | ||
370 | { | ||
371 | const struct aes_ccm_label a = { .data = "out-of-bandMIC" }; | ||
372 | return wusb_prf_64(mic_out, 8, key, n, &a, | ||
373 | hs, sizeof(*hs) - sizeof(hs->MIC)); | ||
374 | } | ||
375 | |||
376 | #endif /* #ifndef __WUSB_H__ */ | ||
diff --git a/include/linux/uwb.h b/include/linux/uwb.h new file mode 100644 index 000000000000..f9ccbd9a2ced --- /dev/null +++ b/include/linux/uwb.h | |||
@@ -0,0 +1,765 @@ | |||
1 | /* | ||
2 | * Ultra Wide Band | ||
3 | * UWB API | ||
4 | * | ||
5 | * Copyright (C) 2005-2006 Intel Corporation | ||
6 | * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License version | ||
10 | * 2 as published by the Free Software Foundation. | ||
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 Street, Fifth Floor, Boston, MA | ||
20 | * 02110-1301, USA. | ||
21 | * | ||
22 | * | ||
23 | * FIXME: doc: overview of the API, different parts and pointers | ||
24 | */ | ||
25 | |||
26 | #ifndef __LINUX__UWB_H__ | ||
27 | #define __LINUX__UWB_H__ | ||
28 | |||
29 | #include <linux/limits.h> | ||
30 | #include <linux/device.h> | ||
31 | #include <linux/mutex.h> | ||
32 | #include <linux/timer.h> | ||
33 | #include <linux/workqueue.h> | ||
34 | #include <linux/uwb/spec.h> | ||
35 | |||
36 | struct uwb_dev; | ||
37 | struct uwb_beca_e; | ||
38 | struct uwb_rc; | ||
39 | struct uwb_rsv; | ||
40 | struct uwb_dbg; | ||
41 | |||
42 | /** | ||
43 | * struct uwb_dev - a UWB Device | ||
44 | * @rc: UWB Radio Controller that discovered the device (kind of its | ||
45 | * parent). | ||
46 | * @bce: a beacon cache entry for this device; or NULL if the device | ||
47 | * is a local radio controller. | ||
48 | * @mac_addr: the EUI-48 address of this device. | ||
49 | * @dev_addr: the current DevAddr used by this device. | ||
50 | * @beacon_slot: the slot number the beacon is using. | ||
51 | * @streams: bitmap of streams allocated to reservations targeted at | ||
52 | * this device. For an RC, this is the streams allocated for | ||
53 | * reservations targeted at DevAddrs. | ||
54 | * | ||
55 | * A UWB device may either by a neighbor or part of a local radio | ||
56 | * controller. | ||
57 | */ | ||
58 | struct uwb_dev { | ||
59 | struct mutex mutex; | ||
60 | struct list_head list_node; | ||
61 | struct device dev; | ||
62 | struct uwb_rc *rc; /* radio controller */ | ||
63 | struct uwb_beca_e *bce; /* Beacon Cache Entry */ | ||
64 | |||
65 | struct uwb_mac_addr mac_addr; | ||
66 | struct uwb_dev_addr dev_addr; | ||
67 | int beacon_slot; | ||
68 | DECLARE_BITMAP(streams, UWB_NUM_STREAMS); | ||
69 | }; | ||
70 | #define to_uwb_dev(d) container_of(d, struct uwb_dev, dev) | ||
71 | |||
72 | /** | ||
73 | * UWB HWA/WHCI Radio Control {Command|Event} Block context IDs | ||
74 | * | ||
75 | * RC[CE]Bs have a 'context ID' field that matches the command with | ||
76 | * the event received to confirm it. | ||
77 | * | ||
78 | * Maximum number of context IDs | ||
79 | */ | ||
80 | enum { UWB_RC_CTX_MAX = 256 }; | ||
81 | |||
82 | |||
83 | /** Notification chain head for UWB generated events to listeners */ | ||
84 | struct uwb_notifs_chain { | ||
85 | struct list_head list; | ||
86 | struct mutex mutex; | ||
87 | }; | ||
88 | |||
89 | /** | ||
90 | * struct uwb_mas_bm - a bitmap of all MAS in a superframe | ||
91 | * @bm: a bitmap of length #UWB_NUM_MAS | ||
92 | */ | ||
93 | struct uwb_mas_bm { | ||
94 | DECLARE_BITMAP(bm, UWB_NUM_MAS); | ||
95 | }; | ||
96 | |||
97 | /** | ||
98 | * uwb_rsv_state - UWB Reservation state. | ||
99 | * | ||
100 | * NONE - reservation is not active (no DRP IE being transmitted). | ||
101 | * | ||
102 | * Owner reservation states: | ||
103 | * | ||
104 | * INITIATED - owner has sent an initial DRP request. | ||
105 | * PENDING - target responded with pending Reason Code. | ||
106 | * MODIFIED - reservation manager is modifying an established | ||
107 | * reservation with a different MAS allocation. | ||
108 | * ESTABLISHED - the reservation has been successfully negotiated. | ||
109 | * | ||
110 | * Target reservation states: | ||
111 | * | ||
112 | * DENIED - request is denied. | ||
113 | * ACCEPTED - request is accepted. | ||
114 | * PENDING - PAL has yet to make a decision to whether to accept or | ||
115 | * deny. | ||
116 | * | ||
117 | * FIXME: further target states TBD. | ||
118 | */ | ||
119 | enum uwb_rsv_state { | ||
120 | UWB_RSV_STATE_NONE, | ||
121 | UWB_RSV_STATE_O_INITIATED, | ||
122 | UWB_RSV_STATE_O_PENDING, | ||
123 | UWB_RSV_STATE_O_MODIFIED, | ||
124 | UWB_RSV_STATE_O_ESTABLISHED, | ||
125 | UWB_RSV_STATE_T_ACCEPTED, | ||
126 | UWB_RSV_STATE_T_DENIED, | ||
127 | UWB_RSV_STATE_T_PENDING, | ||
128 | |||
129 | UWB_RSV_STATE_LAST, | ||
130 | }; | ||
131 | |||
132 | enum uwb_rsv_target_type { | ||
133 | UWB_RSV_TARGET_DEV, | ||
134 | UWB_RSV_TARGET_DEVADDR, | ||
135 | }; | ||
136 | |||
137 | /** | ||
138 | * struct uwb_rsv_target - the target of a reservation. | ||
139 | * | ||
140 | * Reservations unicast and targeted at a single device | ||
141 | * (UWB_RSV_TARGET_DEV); or (e.g., in the case of WUSB) targeted at a | ||
142 | * specific (private) DevAddr (UWB_RSV_TARGET_DEVADDR). | ||
143 | */ | ||
144 | struct uwb_rsv_target { | ||
145 | enum uwb_rsv_target_type type; | ||
146 | union { | ||
147 | struct uwb_dev *dev; | ||
148 | struct uwb_dev_addr devaddr; | ||
149 | }; | ||
150 | }; | ||
151 | |||
152 | /* | ||
153 | * Number of streams reserved for reservations targeted at DevAddrs. | ||
154 | */ | ||
155 | #define UWB_NUM_GLOBAL_STREAMS 1 | ||
156 | |||
157 | typedef void (*uwb_rsv_cb_f)(struct uwb_rsv *rsv); | ||
158 | |||
159 | /** | ||
160 | * struct uwb_rsv - a DRP reservation | ||
161 | * | ||
162 | * Data structure management: | ||
163 | * | ||
164 | * @rc: the radio controller this reservation is for | ||
165 | * (as target or owner) | ||
166 | * @rc_node: a list node for the RC | ||
167 | * @pal_node: a list node for the PAL | ||
168 | * | ||
169 | * Owner and target parameters: | ||
170 | * | ||
171 | * @owner: the UWB device owning this reservation | ||
172 | * @target: the target UWB device | ||
173 | * @type: reservation type | ||
174 | * | ||
175 | * Owner parameters: | ||
176 | * | ||
177 | * @max_mas: maxiumum number of MAS | ||
178 | * @min_mas: minimum number of MAS | ||
179 | * @sparsity: owner selected sparsity | ||
180 | * @is_multicast: true iff multicast | ||
181 | * | ||
182 | * @callback: callback function when the reservation completes | ||
183 | * @pal_priv: private data for the PAL making the reservation | ||
184 | * | ||
185 | * Reservation status: | ||
186 | * | ||
187 | * @status: negotiation status | ||
188 | * @stream: stream index allocated for this reservation | ||
189 | * @mas: reserved MAS | ||
190 | * @drp_ie: the DRP IE | ||
191 | * @ie_valid: true iff the DRP IE matches the reservation parameters | ||
192 | * | ||
193 | * DRP reservations are uniquely identified by the owner, target and | ||
194 | * stream index. However, when using a DevAddr as a target (e.g., for | ||
195 | * a WUSB cluster reservation) the responses may be received from | ||
196 | * devices with different DevAddrs. In this case, reservations are | ||
197 | * uniquely identified by just the stream index. A number of stream | ||
198 | * indexes (UWB_NUM_GLOBAL_STREAMS) are reserved for this. | ||
199 | */ | ||
200 | struct uwb_rsv { | ||
201 | struct uwb_rc *rc; | ||
202 | struct list_head rc_node; | ||
203 | struct list_head pal_node; | ||
204 | |||
205 | struct uwb_dev *owner; | ||
206 | struct uwb_rsv_target target; | ||
207 | enum uwb_drp_type type; | ||
208 | int max_mas; | ||
209 | int min_mas; | ||
210 | int sparsity; | ||
211 | bool is_multicast; | ||
212 | |||
213 | uwb_rsv_cb_f callback; | ||
214 | void *pal_priv; | ||
215 | |||
216 | enum uwb_rsv_state state; | ||
217 | u8 stream; | ||
218 | struct uwb_mas_bm mas; | ||
219 | struct uwb_ie_drp *drp_ie; | ||
220 | bool ie_valid; | ||
221 | struct timer_list timer; | ||
222 | bool expired; | ||
223 | }; | ||
224 | |||
225 | static const | ||
226 | struct uwb_mas_bm uwb_mas_bm_zero = { .bm = { 0 } }; | ||
227 | |||
228 | static inline void uwb_mas_bm_copy_le(void *dst, const struct uwb_mas_bm *mas) | ||
229 | { | ||
230 | bitmap_copy_le(dst, mas->bm, UWB_NUM_MAS); | ||
231 | } | ||
232 | |||
233 | /** | ||
234 | * struct uwb_drp_avail - a radio controller's view of MAS usage | ||
235 | * @global: MAS unused by neighbors (excluding reservations targetted | ||
236 | * or owned by the local radio controller) or the beaon period | ||
237 | * @local: MAS unused by local established reservations | ||
238 | * @pending: MAS unused by local pending reservations | ||
239 | * @ie: DRP Availability IE to be included in the beacon | ||
240 | * @ie_valid: true iff @ie is valid and does not need to regenerated from | ||
241 | * @global and @local | ||
242 | * | ||
243 | * Each radio controller maintains a view of MAS usage or | ||
244 | * availability. MAS available for a new reservation are determined | ||
245 | * from the intersection of @global, @local, and @pending. | ||
246 | * | ||
247 | * The radio controller must transmit a DRP Availability IE that's the | ||
248 | * intersection of @global and @local. | ||
249 | * | ||
250 | * A set bit indicates the MAS is unused and available. | ||
251 | * | ||
252 | * rc->rsvs_mutex should be held before accessing this data structure. | ||
253 | * | ||
254 | * [ECMA-368] section 17.4.3. | ||
255 | */ | ||
256 | struct uwb_drp_avail { | ||
257 | DECLARE_BITMAP(global, UWB_NUM_MAS); | ||
258 | DECLARE_BITMAP(local, UWB_NUM_MAS); | ||
259 | DECLARE_BITMAP(pending, UWB_NUM_MAS); | ||
260 | struct uwb_ie_drp_avail ie; | ||
261 | bool ie_valid; | ||
262 | }; | ||
263 | |||
264 | |||
265 | const char *uwb_rsv_state_str(enum uwb_rsv_state state); | ||
266 | const char *uwb_rsv_type_str(enum uwb_drp_type type); | ||
267 | |||
268 | struct uwb_rsv *uwb_rsv_create(struct uwb_rc *rc, uwb_rsv_cb_f cb, | ||
269 | void *pal_priv); | ||
270 | void uwb_rsv_destroy(struct uwb_rsv *rsv); | ||
271 | |||
272 | int uwb_rsv_establish(struct uwb_rsv *rsv); | ||
273 | int uwb_rsv_modify(struct uwb_rsv *rsv, | ||
274 | int max_mas, int min_mas, int sparsity); | ||
275 | void uwb_rsv_terminate(struct uwb_rsv *rsv); | ||
276 | |||
277 | void uwb_rsv_accept(struct uwb_rsv *rsv, uwb_rsv_cb_f cb, void *pal_priv); | ||
278 | |||
279 | /** | ||
280 | * Radio Control Interface instance | ||
281 | * | ||
282 | * | ||
283 | * Life cycle rules: those of the UWB Device. | ||
284 | * | ||
285 | * @index: an index number for this radio controller, as used in the | ||
286 | * device name. | ||
287 | * @version: version of protocol supported by this device | ||
288 | * @priv: Backend implementation; rw with uwb_dev.dev.sem taken. | ||
289 | * @cmd: Backend implementation to execute commands; rw and call | ||
290 | * only with uwb_dev.dev.sem taken. | ||
291 | * @reset: Hardware reset of radio controller and any PAL controllers. | ||
292 | * @filter: Backend implementation to manipulate data to and from device | ||
293 | * to be compliant to specification assumed by driver (WHCI | ||
294 | * 0.95). | ||
295 | * | ||
296 | * uwb_dev.dev.mutex is used to execute commands and update | ||
297 | * the corresponding structures; can't use a spinlock | ||
298 | * because rc->cmd() can sleep. | ||
299 | * @ies: This is a dynamically allocated array cacheing the | ||
300 | * IEs (settable by the host) that the beacon of this | ||
301 | * radio controller is currently sending. | ||
302 | * | ||
303 | * In reality, we store here the full command we set to | ||
304 | * the radio controller (which is basically a command | ||
305 | * prefix followed by all the IEs the beacon currently | ||
306 | * contains). This way we don't have to realloc and | ||
307 | * memcpy when setting it. | ||
308 | * | ||
309 | * We set this up in uwb_rc_ie_setup(), where we alloc | ||
310 | * this struct, call get_ie() [so we know which IEs are | ||
311 | * currently being sent, if any]. | ||
312 | * | ||
313 | * @ies_capacity:Amount of space (in bytes) allocated in @ies. The | ||
314 | * amount used is given by sizeof(*ies) plus ies->wIELength | ||
315 | * (which is a little endian quantity all the time). | ||
316 | * @ies_mutex: protect the IE cache | ||
317 | * @dbg: information for the debug interface | ||
318 | */ | ||
319 | struct uwb_rc { | ||
320 | struct uwb_dev uwb_dev; | ||
321 | int index; | ||
322 | u16 version; | ||
323 | |||
324 | struct module *owner; | ||
325 | void *priv; | ||
326 | int (*start)(struct uwb_rc *rc); | ||
327 | void (*stop)(struct uwb_rc *rc); | ||
328 | int (*cmd)(struct uwb_rc *, const struct uwb_rccb *, size_t); | ||
329 | int (*reset)(struct uwb_rc *rc); | ||
330 | int (*filter_cmd)(struct uwb_rc *, struct uwb_rccb **, size_t *); | ||
331 | int (*filter_event)(struct uwb_rc *, struct uwb_rceb **, const size_t, | ||
332 | size_t *, size_t *); | ||
333 | |||
334 | spinlock_t neh_lock; /* protects neh_* and ctx_* */ | ||
335 | struct list_head neh_list; /* Open NE handles */ | ||
336 | unsigned long ctx_bm[UWB_RC_CTX_MAX / 8 / sizeof(unsigned long)]; | ||
337 | u8 ctx_roll; | ||
338 | |||
339 | int beaconing; /* Beaconing state [channel number] */ | ||
340 | int scanning; | ||
341 | enum uwb_scan_type scan_type:3; | ||
342 | unsigned ready:1; | ||
343 | struct uwb_notifs_chain notifs_chain; | ||
344 | |||
345 | struct uwb_drp_avail drp_avail; | ||
346 | struct list_head reservations; | ||
347 | struct mutex rsvs_mutex; | ||
348 | struct workqueue_struct *rsv_workq; | ||
349 | struct work_struct rsv_update_work; | ||
350 | |||
351 | struct mutex ies_mutex; | ||
352 | struct uwb_rc_cmd_set_ie *ies; | ||
353 | size_t ies_capacity; | ||
354 | |||
355 | spinlock_t pal_lock; | ||
356 | struct list_head pals; | ||
357 | |||
358 | struct uwb_dbg *dbg; | ||
359 | }; | ||
360 | |||
361 | |||
362 | /** | ||
363 | * struct uwb_pal - a UWB PAL | ||
364 | * @name: descriptive name for this PAL (wushc, wlp, etc.). | ||
365 | * @device: a device for the PAL. Used to link the PAL and the radio | ||
366 | * controller in sysfs. | ||
367 | * @new_rsv: called when a peer requests a reservation (may be NULL if | ||
368 | * the PAL cannot accept reservation requests). | ||
369 | * | ||
370 | * A Protocol Adaptation Layer (PAL) is a user of the WiMedia UWB | ||
371 | * radio platform (e.g., WUSB, WLP or Bluetooth UWB AMP). | ||
372 | * | ||
373 | * The PALs using a radio controller must register themselves to | ||
374 | * permit the UWB stack to coordinate usage of the radio between the | ||
375 | * various PALs or to allow PALs to response to certain requests from | ||
376 | * peers. | ||
377 | * | ||
378 | * A struct uwb_pal should be embedded in a containing structure | ||
379 | * belonging to the PAL and initialized with uwb_pal_init()). Fields | ||
380 | * should be set appropriately by the PAL before registering the PAL | ||
381 | * with uwb_pal_register(). | ||
382 | */ | ||
383 | struct uwb_pal { | ||
384 | struct list_head node; | ||
385 | const char *name; | ||
386 | struct device *device; | ||
387 | void (*new_rsv)(struct uwb_rsv *rsv); | ||
388 | }; | ||
389 | |||
390 | void uwb_pal_init(struct uwb_pal *pal); | ||
391 | int uwb_pal_register(struct uwb_rc *rc, struct uwb_pal *pal); | ||
392 | void uwb_pal_unregister(struct uwb_rc *rc, struct uwb_pal *pal); | ||
393 | |||
394 | /* | ||
395 | * General public API | ||
396 | * | ||
397 | * This API can be used by UWB device drivers or by those implementing | ||
398 | * UWB Radio Controllers | ||
399 | */ | ||
400 | struct uwb_dev *uwb_dev_get_by_devaddr(struct uwb_rc *rc, | ||
401 | const struct uwb_dev_addr *devaddr); | ||
402 | struct uwb_dev *uwb_dev_get_by_rc(struct uwb_dev *, struct uwb_rc *); | ||
403 | static inline void uwb_dev_get(struct uwb_dev *uwb_dev) | ||
404 | { | ||
405 | get_device(&uwb_dev->dev); | ||
406 | } | ||
407 | static inline void uwb_dev_put(struct uwb_dev *uwb_dev) | ||
408 | { | ||
409 | put_device(&uwb_dev->dev); | ||
410 | } | ||
411 | struct uwb_dev *uwb_dev_try_get(struct uwb_rc *rc, struct uwb_dev *uwb_dev); | ||
412 | |||
413 | /** | ||
414 | * Callback function for 'uwb_{dev,rc}_foreach()'. | ||
415 | * | ||
416 | * @dev: Linux device instance | ||
417 | * 'uwb_dev = container_of(dev, struct uwb_dev, dev)' | ||
418 | * @priv: Data passed by the caller to 'uwb_{dev,rc}_foreach()'. | ||
419 | * | ||
420 | * @returns: 0 to continue the iterations, any other val to stop | ||
421 | * iterating and return the value to the caller of | ||
422 | * _foreach(). | ||
423 | */ | ||
424 | typedef int (*uwb_dev_for_each_f)(struct device *dev, void *priv); | ||
425 | int uwb_dev_for_each(struct uwb_rc *rc, uwb_dev_for_each_f func, void *priv); | ||
426 | |||
427 | struct uwb_rc *uwb_rc_alloc(void); | ||
428 | struct uwb_rc *uwb_rc_get_by_dev(const struct uwb_dev_addr *); | ||
429 | struct uwb_rc *uwb_rc_get_by_grandpa(const struct device *); | ||
430 | void uwb_rc_put(struct uwb_rc *rc); | ||
431 | |||
432 | typedef void (*uwb_rc_cmd_cb_f)(struct uwb_rc *rc, void *arg, | ||
433 | struct uwb_rceb *reply, ssize_t reply_size); | ||
434 | |||
435 | int uwb_rc_cmd_async(struct uwb_rc *rc, const char *cmd_name, | ||
436 | struct uwb_rccb *cmd, size_t cmd_size, | ||
437 | u8 expected_type, u16 expected_event, | ||
438 | uwb_rc_cmd_cb_f cb, void *arg); | ||
439 | ssize_t uwb_rc_cmd(struct uwb_rc *rc, const char *cmd_name, | ||
440 | struct uwb_rccb *cmd, size_t cmd_size, | ||
441 | struct uwb_rceb *reply, size_t reply_size); | ||
442 | ssize_t uwb_rc_vcmd(struct uwb_rc *rc, const char *cmd_name, | ||
443 | struct uwb_rccb *cmd, size_t cmd_size, | ||
444 | u8 expected_type, u16 expected_event, | ||
445 | struct uwb_rceb **preply); | ||
446 | ssize_t uwb_rc_get_ie(struct uwb_rc *, struct uwb_rc_evt_get_ie **); | ||
447 | int uwb_bg_joined(struct uwb_rc *rc); | ||
448 | |||
449 | size_t __uwb_addr_print(char *, size_t, const unsigned char *, int); | ||
450 | |||
451 | int uwb_rc_dev_addr_set(struct uwb_rc *, const struct uwb_dev_addr *); | ||
452 | int uwb_rc_dev_addr_get(struct uwb_rc *, struct uwb_dev_addr *); | ||
453 | int uwb_rc_mac_addr_set(struct uwb_rc *, const struct uwb_mac_addr *); | ||
454 | int uwb_rc_mac_addr_get(struct uwb_rc *, struct uwb_mac_addr *); | ||
455 | int __uwb_mac_addr_assigned_check(struct device *, void *); | ||
456 | int __uwb_dev_addr_assigned_check(struct device *, void *); | ||
457 | |||
458 | /* Print in @buf a pretty repr of @addr */ | ||
459 | static inline size_t uwb_dev_addr_print(char *buf, size_t buf_size, | ||
460 | const struct uwb_dev_addr *addr) | ||
461 | { | ||
462 | return __uwb_addr_print(buf, buf_size, addr->data, 0); | ||
463 | } | ||
464 | |||
465 | /* Print in @buf a pretty repr of @addr */ | ||
466 | static inline size_t uwb_mac_addr_print(char *buf, size_t buf_size, | ||
467 | const struct uwb_mac_addr *addr) | ||
468 | { | ||
469 | return __uwb_addr_print(buf, buf_size, addr->data, 1); | ||
470 | } | ||
471 | |||
472 | /* @returns 0 if device addresses @addr2 and @addr1 are equal */ | ||
473 | static inline int uwb_dev_addr_cmp(const struct uwb_dev_addr *addr1, | ||
474 | const struct uwb_dev_addr *addr2) | ||
475 | { | ||
476 | return memcmp(addr1, addr2, sizeof(*addr1)); | ||
477 | } | ||
478 | |||
479 | /* @returns 0 if MAC addresses @addr2 and @addr1 are equal */ | ||
480 | static inline int uwb_mac_addr_cmp(const struct uwb_mac_addr *addr1, | ||
481 | const struct uwb_mac_addr *addr2) | ||
482 | { | ||
483 | return memcmp(addr1, addr2, sizeof(*addr1)); | ||
484 | } | ||
485 | |||
486 | /* @returns !0 if a MAC @addr is a broadcast address */ | ||
487 | static inline int uwb_mac_addr_bcast(const struct uwb_mac_addr *addr) | ||
488 | { | ||
489 | struct uwb_mac_addr bcast = { | ||
490 | .data = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } | ||
491 | }; | ||
492 | return !uwb_mac_addr_cmp(addr, &bcast); | ||
493 | } | ||
494 | |||
495 | /* @returns !0 if a MAC @addr is all zeroes*/ | ||
496 | static inline int uwb_mac_addr_unset(const struct uwb_mac_addr *addr) | ||
497 | { | ||
498 | struct uwb_mac_addr unset = { | ||
499 | .data = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } | ||
500 | }; | ||
501 | return !uwb_mac_addr_cmp(addr, &unset); | ||
502 | } | ||
503 | |||
504 | /* @returns !0 if the address is in use. */ | ||
505 | static inline unsigned __uwb_dev_addr_assigned(struct uwb_rc *rc, | ||
506 | struct uwb_dev_addr *addr) | ||
507 | { | ||
508 | return uwb_dev_for_each(rc, __uwb_dev_addr_assigned_check, addr); | ||
509 | } | ||
510 | |||
511 | /* | ||
512 | * UWB Radio Controller API | ||
513 | * | ||
514 | * This API is used (in addition to the general API) to implement UWB | ||
515 | * Radio Controllers. | ||
516 | */ | ||
517 | void uwb_rc_init(struct uwb_rc *); | ||
518 | int uwb_rc_add(struct uwb_rc *, struct device *dev, void *rc_priv); | ||
519 | void uwb_rc_rm(struct uwb_rc *); | ||
520 | void uwb_rc_neh_grok(struct uwb_rc *, void *, size_t); | ||
521 | void uwb_rc_neh_error(struct uwb_rc *, int); | ||
522 | void uwb_rc_reset_all(struct uwb_rc *rc); | ||
523 | |||
524 | /** | ||
525 | * uwb_rsv_is_owner - is the owner of this reservation the RC? | ||
526 | * @rsv: the reservation | ||
527 | */ | ||
528 | static inline bool uwb_rsv_is_owner(struct uwb_rsv *rsv) | ||
529 | { | ||
530 | return rsv->owner == &rsv->rc->uwb_dev; | ||
531 | } | ||
532 | |||
533 | /** | ||
534 | * Events generated by UWB that can be passed to any listeners | ||
535 | * | ||
536 | * Higher layers can register callback functions with the radio | ||
537 | * controller using uwb_notifs_register(). The radio controller | ||
538 | * maintains a list of all registered handlers and will notify all | ||
539 | * nodes when an event occurs. | ||
540 | */ | ||
541 | enum uwb_notifs { | ||
542 | UWB_NOTIF_BG_JOIN = 0, /* radio controller joined a beacon group */ | ||
543 | UWB_NOTIF_BG_LEAVE = 1, /* radio controller left a beacon group */ | ||
544 | UWB_NOTIF_ONAIR, | ||
545 | UWB_NOTIF_OFFAIR, | ||
546 | }; | ||
547 | |||
548 | /* Callback function registered with UWB */ | ||
549 | struct uwb_notifs_handler { | ||
550 | struct list_head list_node; | ||
551 | void (*cb)(void *, struct uwb_dev *, enum uwb_notifs); | ||
552 | void *data; | ||
553 | }; | ||
554 | |||
555 | int uwb_notifs_register(struct uwb_rc *, struct uwb_notifs_handler *); | ||
556 | int uwb_notifs_deregister(struct uwb_rc *, struct uwb_notifs_handler *); | ||
557 | |||
558 | |||
559 | /** | ||
560 | * UWB radio controller Event Size Entry (for creating entry tables) | ||
561 | * | ||
562 | * WUSB and WHCI define events and notifications, and they might have | ||
563 | * fixed or variable size. | ||
564 | * | ||
565 | * Each event/notification has a size which is not necessarily known | ||
566 | * in advance based on the event code. As well, vendor specific | ||
567 | * events/notifications will have a size impossible to determine | ||
568 | * unless we know about the device's specific details. | ||
569 | * | ||
570 | * It was way too smart of the spec writers not to think that it would | ||
571 | * be impossible for a generic driver to skip over vendor specific | ||
572 | * events/notifications if there are no LENGTH fields in the HEADER of | ||
573 | * each message...the transaction size cannot be counted on as the | ||
574 | * spec does not forbid to pack more than one event in a single | ||
575 | * transaction. | ||
576 | * | ||
577 | * Thus, we guess sizes with tables (or for events, when you know the | ||
578 | * size ahead of time you can use uwb_rc_neh_extra_size*()). We | ||
579 | * register tables with the known events and their sizes, and then we | ||
580 | * traverse those tables. For those with variable length, we provide a | ||
581 | * way to lookup the size inside the event/notification's | ||
582 | * payload. This allows device-specific event size tables to be | ||
583 | * registered. | ||
584 | * | ||
585 | * @size: Size of the payload | ||
586 | * | ||
587 | * @offset: if != 0, at offset @offset-1 starts a field with a length | ||
588 | * that has to be added to @size. The format of the field is | ||
589 | * given by @type. | ||
590 | * | ||
591 | * @type: Type and length of the offset field. Most common is LE 16 | ||
592 | * bits (that's why that is zero); others are there mostly to | ||
593 | * cover for bugs and weirdos. | ||
594 | */ | ||
595 | struct uwb_est_entry { | ||
596 | size_t size; | ||
597 | unsigned offset; | ||
598 | enum { UWB_EST_16 = 0, UWB_EST_8 = 1 } type; | ||
599 | }; | ||
600 | |||
601 | int uwb_est_register(u8 type, u8 code_high, u16 vendor, u16 product, | ||
602 | const struct uwb_est_entry *, size_t entries); | ||
603 | int uwb_est_unregister(u8 type, u8 code_high, u16 vendor, u16 product, | ||
604 | const struct uwb_est_entry *, size_t entries); | ||
605 | ssize_t uwb_est_find_size(struct uwb_rc *rc, const struct uwb_rceb *rceb, | ||
606 | size_t len); | ||
607 | |||
608 | /* -- Misc */ | ||
609 | |||
610 | enum { | ||
611 | EDC_MAX_ERRORS = 10, | ||
612 | EDC_ERROR_TIMEFRAME = HZ, | ||
613 | }; | ||
614 | |||
615 | /* error density counter */ | ||
616 | struct edc { | ||
617 | unsigned long timestart; | ||
618 | u16 errorcount; | ||
619 | }; | ||
620 | |||
621 | static inline | ||
622 | void edc_init(struct edc *edc) | ||
623 | { | ||
624 | edc->timestart = jiffies; | ||
625 | } | ||
626 | |||
627 | /* Called when an error occured. | ||
628 | * This is way to determine if the number of acceptable errors per time | ||
629 | * period has been exceeded. It is not accurate as there are cases in which | ||
630 | * this scheme will not work, for example if there are periodic occurences | ||
631 | * of errors that straddle updates to the start time. This scheme is | ||
632 | * sufficient for our usage. | ||
633 | * | ||
634 | * @returns 1 if maximum acceptable errors per timeframe has been exceeded. | ||
635 | */ | ||
636 | static inline int edc_inc(struct edc *err_hist, u16 max_err, u16 timeframe) | ||
637 | { | ||
638 | unsigned long now; | ||
639 | |||
640 | now = jiffies; | ||
641 | if (now - err_hist->timestart > timeframe) { | ||
642 | err_hist->errorcount = 1; | ||
643 | err_hist->timestart = now; | ||
644 | } else if (++err_hist->errorcount > max_err) { | ||
645 | err_hist->errorcount = 0; | ||
646 | err_hist->timestart = now; | ||
647 | return 1; | ||
648 | } | ||
649 | return 0; | ||
650 | } | ||
651 | |||
652 | |||
653 | /* Information Element handling */ | ||
654 | |||
655 | /* For representing the state of writing to a buffer when iterating */ | ||
656 | struct uwb_buf_ctx { | ||
657 | char *buf; | ||
658 | size_t bytes, size; | ||
659 | }; | ||
660 | |||
661 | typedef int (*uwb_ie_f)(struct uwb_dev *, const struct uwb_ie_hdr *, | ||
662 | size_t, void *); | ||
663 | struct uwb_ie_hdr *uwb_ie_next(void **ptr, size_t *len); | ||
664 | ssize_t uwb_ie_for_each(struct uwb_dev *uwb_dev, uwb_ie_f fn, void *data, | ||
665 | const void *buf, size_t size); | ||
666 | int uwb_ie_dump_hex(struct uwb_dev *, const struct uwb_ie_hdr *, | ||
667 | size_t, void *); | ||
668 | int uwb_rc_set_ie(struct uwb_rc *, struct uwb_rc_cmd_set_ie *); | ||
669 | struct uwb_ie_hdr *uwb_ie_next(void **ptr, size_t *len); | ||
670 | |||
671 | |||
672 | /* | ||
673 | * Transmission statistics | ||
674 | * | ||
675 | * UWB uses LQI and RSSI (one byte values) for reporting radio signal | ||
676 | * strength and line quality indication. We do quick and dirty | ||
677 | * averages of those. They are signed values, btw. | ||
678 | * | ||
679 | * For 8 bit quantities, we keep the min, the max, an accumulator | ||
680 | * (@sigma) and a # of samples. When @samples gets to 255, we compute | ||
681 | * the average (@sigma / @samples), place it in @sigma and reset | ||
682 | * @samples to 1 (so we use it as the first sample). | ||
683 | * | ||
684 | * Now, statistically speaking, probably I am kicking the kidneys of | ||
685 | * some books I have in my shelves collecting dust, but I just want to | ||
686 | * get an approx, not the Nobel. | ||
687 | * | ||
688 | * LOCKING: there is no locking per se, but we try to keep a lockless | ||
689 | * schema. Only _add_samples() modifies the values--as long as you | ||
690 | * have other locking on top that makes sure that no two calls of | ||
691 | * _add_sample() happen at the same time, then we are fine. Now, for | ||
692 | * resetting the values we just set @samples to 0 and that makes the | ||
693 | * next _add_sample() to start with defaults. Reading the values in | ||
694 | * _show() currently can race, so you need to make sure the calls are | ||
695 | * under the same lock that protects calls to _add_sample(). FIXME: | ||
696 | * currently unlocked (It is not ultraprecise but does the trick. Bite | ||
697 | * me). | ||
698 | */ | ||
699 | struct stats { | ||
700 | s8 min, max; | ||
701 | s16 sigma; | ||
702 | atomic_t samples; | ||
703 | }; | ||
704 | |||
705 | static inline | ||
706 | void stats_init(struct stats *stats) | ||
707 | { | ||
708 | atomic_set(&stats->samples, 0); | ||
709 | wmb(); | ||
710 | } | ||
711 | |||
712 | static inline | ||
713 | void stats_add_sample(struct stats *stats, s8 sample) | ||
714 | { | ||
715 | s8 min, max; | ||
716 | s16 sigma; | ||
717 | unsigned samples = atomic_read(&stats->samples); | ||
718 | if (samples == 0) { /* it was zero before, so we initialize */ | ||
719 | min = 127; | ||
720 | max = -128; | ||
721 | sigma = 0; | ||
722 | } else { | ||
723 | min = stats->min; | ||
724 | max = stats->max; | ||
725 | sigma = stats->sigma; | ||
726 | } | ||
727 | |||
728 | if (sample < min) /* compute new values */ | ||
729 | min = sample; | ||
730 | else if (sample > max) | ||
731 | max = sample; | ||
732 | sigma += sample; | ||
733 | |||
734 | stats->min = min; /* commit */ | ||
735 | stats->max = max; | ||
736 | stats->sigma = sigma; | ||
737 | if (atomic_add_return(1, &stats->samples) > 255) { | ||
738 | /* wrapped around! reset */ | ||
739 | stats->sigma = sigma / 256; | ||
740 | atomic_set(&stats->samples, 1); | ||
741 | } | ||
742 | } | ||
743 | |||
744 | static inline ssize_t stats_show(struct stats *stats, char *buf) | ||
745 | { | ||
746 | int min, max, avg; | ||
747 | int samples = atomic_read(&stats->samples); | ||
748 | if (samples == 0) | ||
749 | min = max = avg = 0; | ||
750 | else { | ||
751 | min = stats->min; | ||
752 | max = stats->max; | ||
753 | avg = stats->sigma / samples; | ||
754 | } | ||
755 | return scnprintf(buf, PAGE_SIZE, "%d %d %d\n", min, max, avg); | ||
756 | } | ||
757 | |||
758 | static inline ssize_t stats_store(struct stats *stats, const char *buf, | ||
759 | size_t size) | ||
760 | { | ||
761 | stats_init(stats); | ||
762 | return size; | ||
763 | } | ||
764 | |||
765 | #endif /* #ifndef __LINUX__UWB_H__ */ | ||
diff --git a/include/linux/uwb/debug-cmd.h b/include/linux/uwb/debug-cmd.h new file mode 100644 index 000000000000..1141f41bab5c --- /dev/null +++ b/include/linux/uwb/debug-cmd.h | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * Ultra Wide Band | ||
3 | * Debug interface commands | ||
4 | * | ||
5 | * Copyright (C) 2008 Cambridge Silicon Radio Ltd. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License version | ||
9 | * 2 as published by the Free Software Foundation. | ||
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, see <http://www.gnu.org/licenses/>. | ||
18 | */ | ||
19 | #ifndef __LINUX__UWB__DEBUG_CMD_H__ | ||
20 | #define __LINUX__UWB__DEBUG_CMD_H__ | ||
21 | |||
22 | #include <linux/types.h> | ||
23 | |||
24 | /* | ||
25 | * Debug interface commands | ||
26 | * | ||
27 | * UWB_DBG_CMD_RSV_ESTABLISH: Establish a new unicast reservation. | ||
28 | * | ||
29 | * UWB_DBG_CMD_RSV_TERMINATE: Terminate the Nth reservation. | ||
30 | */ | ||
31 | |||
32 | enum uwb_dbg_cmd_type { | ||
33 | UWB_DBG_CMD_RSV_ESTABLISH = 1, | ||
34 | UWB_DBG_CMD_RSV_TERMINATE = 2, | ||
35 | }; | ||
36 | |||
37 | struct uwb_dbg_cmd_rsv_establish { | ||
38 | __u8 target[6]; | ||
39 | __u8 type; | ||
40 | __u16 max_mas; | ||
41 | __u16 min_mas; | ||
42 | __u8 sparsity; | ||
43 | }; | ||
44 | |||
45 | struct uwb_dbg_cmd_rsv_terminate { | ||
46 | int index; | ||
47 | }; | ||
48 | |||
49 | struct uwb_dbg_cmd { | ||
50 | __u32 type; | ||
51 | union { | ||
52 | struct uwb_dbg_cmd_rsv_establish rsv_establish; | ||
53 | struct uwb_dbg_cmd_rsv_terminate rsv_terminate; | ||
54 | }; | ||
55 | }; | ||
56 | |||
57 | #endif /* #ifndef __LINUX__UWB__DEBUG_CMD_H__ */ | ||
diff --git a/include/linux/uwb/debug.h b/include/linux/uwb/debug.h new file mode 100644 index 000000000000..a86a73fe303f --- /dev/null +++ b/include/linux/uwb/debug.h | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | * Ultra Wide Band | ||
3 | * Debug Support | ||
4 | * | ||
5 | * Copyright (C) 2005-2006 Intel Corporation | ||
6 | * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License version | ||
10 | * 2 as published by the Free Software Foundation. | ||
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 Street, Fifth Floor, Boston, MA | ||
20 | * 02110-1301, USA. | ||
21 | * | ||
22 | * | ||
23 | * FIXME: doc | ||
24 | * Invoke like: | ||
25 | * | ||
26 | * #define D_LOCAL 4 | ||
27 | * #include <linux/uwb/debug.h> | ||
28 | * | ||
29 | * At the end of your include files. | ||
30 | */ | ||
31 | #include <linux/types.h> | ||
32 | |||
33 | struct device; | ||
34 | extern void dump_bytes(struct device *dev, const void *_buf, size_t rsize); | ||
35 | |||
36 | /* Master debug switch; !0 enables, 0 disables */ | ||
37 | #define D_MASTER (!0) | ||
38 | |||
39 | /* Local (per-file) debug switch; #define before #including */ | ||
40 | #ifndef D_LOCAL | ||
41 | #define D_LOCAL 0 | ||
42 | #endif | ||
43 | |||
44 | #undef __d_printf | ||
45 | #undef d_fnstart | ||
46 | #undef d_fnend | ||
47 | #undef d_printf | ||
48 | #undef d_dump | ||
49 | |||
50 | #define __d_printf(l, _tag, _dev, f, a...) \ | ||
51 | do { \ | ||
52 | struct device *__dev = (_dev); \ | ||
53 | if (D_MASTER && D_LOCAL >= (l)) { \ | ||
54 | char __head[64] = ""; \ | ||
55 | if (_dev != NULL) { \ | ||
56 | if ((unsigned long)__dev < 4096) \ | ||
57 | printk(KERN_ERR "E: Corrupt dev %p\n", \ | ||
58 | __dev); \ | ||
59 | else \ | ||
60 | snprintf(__head, sizeof(__head), \ | ||
61 | "%s %s: ", \ | ||
62 | dev_driver_string(__dev), \ | ||
63 | __dev->bus_id); \ | ||
64 | } \ | ||
65 | printk(KERN_ERR "%s%s" _tag ": " f, __head, \ | ||
66 | __func__, ## a); \ | ||
67 | } \ | ||
68 | } while (0 && _dev) | ||
69 | |||
70 | #define d_fnstart(l, _dev, f, a...) \ | ||
71 | __d_printf(l, " FNSTART", _dev, f, ## a) | ||
72 | #define d_fnend(l, _dev, f, a...) \ | ||
73 | __d_printf(l, " FNEND", _dev, f, ## a) | ||
74 | #define d_printf(l, _dev, f, a...) \ | ||
75 | __d_printf(l, "", _dev, f, ## a) | ||
76 | #define d_dump(l, _dev, ptr, size) \ | ||
77 | do { \ | ||
78 | struct device *__dev = _dev; \ | ||
79 | if (D_MASTER && D_LOCAL >= (l)) \ | ||
80 | dump_bytes(__dev, ptr, size); \ | ||
81 | } while (0 && _dev) | ||
82 | #define d_test(l) (D_MASTER && D_LOCAL >= (l)) | ||
diff --git a/include/linux/uwb/spec.h b/include/linux/uwb/spec.h new file mode 100644 index 000000000000..198c15f8e251 --- /dev/null +++ b/include/linux/uwb/spec.h | |||
@@ -0,0 +1,727 @@ | |||
1 | /* | ||
2 | * Ultra Wide Band | ||
3 | * UWB Standard definitions | ||
4 | * | ||
5 | * Copyright (C) 2005-2006 Intel Corporation | ||
6 | * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License version | ||
10 | * 2 as published by the Free Software Foundation. | ||
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 Street, Fifth Floor, Boston, MA | ||
20 | * 02110-1301, USA. | ||
21 | * | ||
22 | * | ||
23 | * All these definitions are based on the ECMA-368 standard. | ||
24 | * | ||
25 | * Note all definitions are Little Endian in the wire, and we will | ||
26 | * convert them to host order before operating on the bitfields (that | ||
27 | * yes, we use extensively). | ||
28 | */ | ||
29 | |||
30 | #ifndef __LINUX__UWB_SPEC_H__ | ||
31 | #define __LINUX__UWB_SPEC_H__ | ||
32 | |||
33 | #include <linux/types.h> | ||
34 | #include <linux/bitmap.h> | ||
35 | |||
36 | #define i1480_FW 0x00000303 | ||
37 | /* #define i1480_FW 0x00000302 */ | ||
38 | |||
39 | /** | ||
40 | * Number of Medium Access Slots in a superframe. | ||
41 | * | ||
42 | * UWB divides time in SuperFrames, each one divided in 256 pieces, or | ||
43 | * Medium Access Slots. See MBOA MAC[5.4.5] for details. The MAS is the | ||
44 | * basic bandwidth allocation unit in UWB. | ||
45 | */ | ||
46 | enum { UWB_NUM_MAS = 256 }; | ||
47 | |||
48 | /** | ||
49 | * Number of Zones in superframe. | ||
50 | * | ||
51 | * UWB divides the superframe into zones with numbering starting from BPST. | ||
52 | * See MBOA MAC[16.8.6] | ||
53 | */ | ||
54 | enum { UWB_NUM_ZONES = 16 }; | ||
55 | |||
56 | /* | ||
57 | * Number of MAS in a zone. | ||
58 | */ | ||
59 | #define UWB_MAS_PER_ZONE (UWB_NUM_MAS / UWB_NUM_ZONES) | ||
60 | |||
61 | /* | ||
62 | * Number of streams per DRP reservation between a pair of devices. | ||
63 | * | ||
64 | * [ECMA-368] section 16.8.6. | ||
65 | */ | ||
66 | enum { UWB_NUM_STREAMS = 8 }; | ||
67 | |||
68 | /* | ||
69 | * mMasLength | ||
70 | * | ||
71 | * The length of a MAS in microseconds. | ||
72 | * | ||
73 | * [ECMA-368] section 17.16. | ||
74 | */ | ||
75 | enum { UWB_MAS_LENGTH_US = 256 }; | ||
76 | |||
77 | /* | ||
78 | * mBeaconSlotLength | ||
79 | * | ||
80 | * The length of the beacon slot in microseconds. | ||
81 | * | ||
82 | * [ECMA-368] section 17.16 | ||
83 | */ | ||
84 | enum { UWB_BEACON_SLOT_LENGTH_US = 85 }; | ||
85 | |||
86 | /* | ||
87 | * mMaxLostBeacons | ||
88 | * | ||
89 | * The number beacons missing in consecutive superframes before a | ||
90 | * device can be considered as unreachable. | ||
91 | * | ||
92 | * [ECMA-368] section 17.16 | ||
93 | */ | ||
94 | enum { UWB_MAX_LOST_BEACONS = 3 }; | ||
95 | |||
96 | /* | ||
97 | * Length of a superframe in microseconds. | ||
98 | */ | ||
99 | #define UWB_SUPERFRAME_LENGTH_US (UWB_MAS_LENGTH_US * UWB_NUM_MAS) | ||
100 | |||
101 | /** | ||
102 | * UWB MAC address | ||
103 | * | ||
104 | * It is *imperative* that this struct is exactly 6 packed bytes (as | ||
105 | * it is also used to define headers sent down and up the wire/radio). | ||
106 | */ | ||
107 | struct uwb_mac_addr { | ||
108 | u8 data[6]; | ||
109 | } __attribute__((packed)); | ||
110 | |||
111 | |||
112 | /** | ||
113 | * UWB device address | ||
114 | * | ||
115 | * It is *imperative* that this struct is exactly 6 packed bytes (as | ||
116 | * it is also used to define headers sent down and up the wire/radio). | ||
117 | */ | ||
118 | struct uwb_dev_addr { | ||
119 | u8 data[2]; | ||
120 | } __attribute__((packed)); | ||
121 | |||
122 | |||
123 | /** | ||
124 | * Types of UWB addresses | ||
125 | * | ||
126 | * Order matters (by size). | ||
127 | */ | ||
128 | enum uwb_addr_type { | ||
129 | UWB_ADDR_DEV = 0, | ||
130 | UWB_ADDR_MAC = 1, | ||
131 | }; | ||
132 | |||
133 | |||
134 | /** Size of a char buffer for printing a MAC/device address */ | ||
135 | enum { UWB_ADDR_STRSIZE = 32 }; | ||
136 | |||
137 | |||
138 | /** UWB WiMedia protocol IDs. */ | ||
139 | enum uwb_prid { | ||
140 | UWB_PRID_WLP_RESERVED = 0x0000, | ||
141 | UWB_PRID_WLP = 0x0001, | ||
142 | UWB_PRID_WUSB_BOT = 0x0010, | ||
143 | UWB_PRID_WUSB = 0x0010, | ||
144 | UWB_PRID_WUSB_TOP = 0x001F, | ||
145 | }; | ||
146 | |||
147 | |||
148 | /** PHY Rate (MBOA MAC[7.8.12, Table 61]) */ | ||
149 | enum uwb_phy_rate { | ||
150 | UWB_PHY_RATE_53 = 0, | ||
151 | UWB_PHY_RATE_80, | ||
152 | UWB_PHY_RATE_106, | ||
153 | UWB_PHY_RATE_160, | ||
154 | UWB_PHY_RATE_200, | ||
155 | UWB_PHY_RATE_320, | ||
156 | UWB_PHY_RATE_400, | ||
157 | UWB_PHY_RATE_480, | ||
158 | UWB_PHY_RATE_INVALID | ||
159 | }; | ||
160 | |||
161 | |||
162 | /** | ||
163 | * Different ways to scan (MBOA MAC[6.2.2, Table 8], WUSB[Table 8-78]) | ||
164 | */ | ||
165 | enum uwb_scan_type { | ||
166 | UWB_SCAN_ONLY = 0, | ||
167 | UWB_SCAN_OUTSIDE_BP, | ||
168 | UWB_SCAN_WHILE_INACTIVE, | ||
169 | UWB_SCAN_DISABLED, | ||
170 | UWB_SCAN_ONLY_STARTTIME, | ||
171 | UWB_SCAN_TOP | ||
172 | }; | ||
173 | |||
174 | |||
175 | /** ACK Policy types (MBOA MAC[7.2.1.3]) */ | ||
176 | enum uwb_ack_pol { | ||
177 | UWB_ACK_NO = 0, | ||
178 | UWB_ACK_INM = 1, | ||
179 | UWB_ACK_B = 2, | ||
180 | UWB_ACK_B_REQ = 3, | ||
181 | }; | ||
182 | |||
183 | |||
184 | /** DRP reservation types ([ECMA-368 table 106) */ | ||
185 | enum uwb_drp_type { | ||
186 | UWB_DRP_TYPE_ALIEN_BP = 0, | ||
187 | UWB_DRP_TYPE_HARD, | ||
188 | UWB_DRP_TYPE_SOFT, | ||
189 | UWB_DRP_TYPE_PRIVATE, | ||
190 | UWB_DRP_TYPE_PCA, | ||
191 | }; | ||
192 | |||
193 | |||
194 | /** DRP Reason Codes ([ECMA-368] table 107) */ | ||
195 | enum uwb_drp_reason { | ||
196 | UWB_DRP_REASON_ACCEPTED = 0, | ||
197 | UWB_DRP_REASON_CONFLICT, | ||
198 | UWB_DRP_REASON_PENDING, | ||
199 | UWB_DRP_REASON_DENIED, | ||
200 | UWB_DRP_REASON_MODIFIED, | ||
201 | }; | ||
202 | |||
203 | /** | ||
204 | * DRP Notification Reason Codes (WHCI 0.95 [3.1.4.9]) | ||
205 | */ | ||
206 | enum uwb_drp_notif_reason { | ||
207 | UWB_DRP_NOTIF_DRP_IE_RCVD = 0, | ||
208 | UWB_DRP_NOTIF_CONFLICT, | ||
209 | UWB_DRP_NOTIF_TERMINATE, | ||
210 | }; | ||
211 | |||
212 | |||
213 | /** Allocation of MAS slots in a DRP request MBOA MAC[7.8.7] */ | ||
214 | struct uwb_drp_alloc { | ||
215 | __le16 zone_bm; | ||
216 | __le16 mas_bm; | ||
217 | } __attribute__((packed)); | ||
218 | |||
219 | |||
220 | /** General MAC Header format (ECMA-368[16.2]) */ | ||
221 | struct uwb_mac_frame_hdr { | ||
222 | __le16 Frame_Control; | ||
223 | struct uwb_dev_addr DestAddr; | ||
224 | struct uwb_dev_addr SrcAddr; | ||
225 | __le16 Sequence_Control; | ||
226 | __le16 Access_Information; | ||
227 | } __attribute__((packed)); | ||
228 | |||
229 | |||
230 | /** | ||
231 | * uwb_beacon_frame - a beacon frame including MAC headers | ||
232 | * | ||
233 | * [ECMA] section 16.3. | ||
234 | */ | ||
235 | struct uwb_beacon_frame { | ||
236 | struct uwb_mac_frame_hdr hdr; | ||
237 | struct uwb_mac_addr Device_Identifier; /* may be a NULL EUI-48 */ | ||
238 | u8 Beacon_Slot_Number; | ||
239 | u8 Device_Control; | ||
240 | u8 IEData[]; | ||
241 | } __attribute__((packed)); | ||
242 | |||
243 | |||
244 | /** Information Element codes (MBOA MAC[T54]) */ | ||
245 | enum uwb_ie { | ||
246 | UWB_PCA_AVAILABILITY = 2, | ||
247 | UWB_IE_DRP_AVAILABILITY = 8, | ||
248 | UWB_IE_DRP = 9, | ||
249 | UWB_BP_SWITCH_IE = 11, | ||
250 | UWB_MAC_CAPABILITIES_IE = 12, | ||
251 | UWB_PHY_CAPABILITIES_IE = 13, | ||
252 | UWB_APP_SPEC_PROBE_IE = 15, | ||
253 | UWB_IDENTIFICATION_IE = 19, | ||
254 | UWB_MASTER_KEY_ID_IE = 20, | ||
255 | UWB_IE_WLP = 250, /* WiMedia Logical Link Control Protocol WLP 0.99 */ | ||
256 | UWB_APP_SPEC_IE = 255, | ||
257 | }; | ||
258 | |||
259 | |||
260 | /** | ||
261 | * Header common to all Information Elements (IEs) | ||
262 | */ | ||
263 | struct uwb_ie_hdr { | ||
264 | u8 element_id; /* enum uwb_ie */ | ||
265 | u8 length; | ||
266 | } __attribute__((packed)); | ||
267 | |||
268 | |||
269 | /** Dynamic Reservation Protocol IE (MBOA MAC[7.8.6]) */ | ||
270 | struct uwb_ie_drp { | ||
271 | struct uwb_ie_hdr hdr; | ||
272 | __le16 drp_control; | ||
273 | struct uwb_dev_addr dev_addr; | ||
274 | struct uwb_drp_alloc allocs[]; | ||
275 | } __attribute__((packed)); | ||
276 | |||
277 | static inline int uwb_ie_drp_type(struct uwb_ie_drp *ie) | ||
278 | { | ||
279 | return (le16_to_cpu(ie->drp_control) >> 0) & 0x7; | ||
280 | } | ||
281 | |||
282 | static inline int uwb_ie_drp_stream_index(struct uwb_ie_drp *ie) | ||
283 | { | ||
284 | return (le16_to_cpu(ie->drp_control) >> 3) & 0x7; | ||
285 | } | ||
286 | |||
287 | static inline int uwb_ie_drp_reason_code(struct uwb_ie_drp *ie) | ||
288 | { | ||
289 | return (le16_to_cpu(ie->drp_control) >> 6) & 0x7; | ||
290 | } | ||
291 | |||
292 | static inline int uwb_ie_drp_status(struct uwb_ie_drp *ie) | ||
293 | { | ||
294 | return (le16_to_cpu(ie->drp_control) >> 9) & 0x1; | ||
295 | } | ||
296 | |||
297 | static inline int uwb_ie_drp_owner(struct uwb_ie_drp *ie) | ||
298 | { | ||
299 | return (le16_to_cpu(ie->drp_control) >> 10) & 0x1; | ||
300 | } | ||
301 | |||
302 | static inline int uwb_ie_drp_tiebreaker(struct uwb_ie_drp *ie) | ||
303 | { | ||
304 | return (le16_to_cpu(ie->drp_control) >> 11) & 0x1; | ||
305 | } | ||
306 | |||
307 | static inline int uwb_ie_drp_unsafe(struct uwb_ie_drp *ie) | ||
308 | { | ||
309 | return (le16_to_cpu(ie->drp_control) >> 12) & 0x1; | ||
310 | } | ||
311 | |||
312 | static inline void uwb_ie_drp_set_type(struct uwb_ie_drp *ie, enum uwb_drp_type type) | ||
313 | { | ||
314 | u16 drp_control = le16_to_cpu(ie->drp_control); | ||
315 | drp_control = (drp_control & ~(0x7 << 0)) | (type << 0); | ||
316 | ie->drp_control = cpu_to_le16(drp_control); | ||
317 | } | ||
318 | |||
319 | static inline void uwb_ie_drp_set_stream_index(struct uwb_ie_drp *ie, int stream_index) | ||
320 | { | ||
321 | u16 drp_control = le16_to_cpu(ie->drp_control); | ||
322 | drp_control = (drp_control & ~(0x7 << 3)) | (stream_index << 3); | ||
323 | ie->drp_control = cpu_to_le16(drp_control); | ||
324 | } | ||
325 | |||
326 | static inline void uwb_ie_drp_set_reason_code(struct uwb_ie_drp *ie, | ||
327 | enum uwb_drp_reason reason_code) | ||
328 | { | ||
329 | u16 drp_control = le16_to_cpu(ie->drp_control); | ||
330 | drp_control = (ie->drp_control & ~(0x7 << 6)) | (reason_code << 6); | ||
331 | ie->drp_control = cpu_to_le16(drp_control); | ||
332 | } | ||
333 | |||
334 | static inline void uwb_ie_drp_set_status(struct uwb_ie_drp *ie, int status) | ||
335 | { | ||
336 | u16 drp_control = le16_to_cpu(ie->drp_control); | ||
337 | drp_control = (drp_control & ~(0x1 << 9)) | (status << 9); | ||
338 | ie->drp_control = cpu_to_le16(drp_control); | ||
339 | } | ||
340 | |||
341 | static inline void uwb_ie_drp_set_owner(struct uwb_ie_drp *ie, int owner) | ||
342 | { | ||
343 | u16 drp_control = le16_to_cpu(ie->drp_control); | ||
344 | drp_control = (drp_control & ~(0x1 << 10)) | (owner << 10); | ||
345 | ie->drp_control = cpu_to_le16(drp_control); | ||
346 | } | ||
347 | |||
348 | static inline void uwb_ie_drp_set_tiebreaker(struct uwb_ie_drp *ie, int tiebreaker) | ||
349 | { | ||
350 | u16 drp_control = le16_to_cpu(ie->drp_control); | ||
351 | drp_control = (drp_control & ~(0x1 << 11)) | (tiebreaker << 11); | ||
352 | ie->drp_control = cpu_to_le16(drp_control); | ||
353 | } | ||
354 | |||
355 | static inline void uwb_ie_drp_set_unsafe(struct uwb_ie_drp *ie, int unsafe) | ||
356 | { | ||
357 | u16 drp_control = le16_to_cpu(ie->drp_control); | ||
358 | drp_control = (drp_control & ~(0x1 << 12)) | (unsafe << 12); | ||
359 | ie->drp_control = cpu_to_le16(drp_control); | ||
360 | } | ||
361 | |||
362 | /** Dynamic Reservation Protocol IE (MBOA MAC[7.8.7]) */ | ||
363 | struct uwb_ie_drp_avail { | ||
364 | struct uwb_ie_hdr hdr; | ||
365 | DECLARE_BITMAP(bmp, UWB_NUM_MAS); | ||
366 | } __attribute__((packed)); | ||
367 | |||
368 | /** | ||
369 | * The Vendor ID is set to an OUI that indicates the vendor of the device. | ||
370 | * ECMA-368 [16.8.10] | ||
371 | */ | ||
372 | struct uwb_vendor_id { | ||
373 | u8 data[3]; | ||
374 | } __attribute__((packed)); | ||
375 | |||
376 | /** | ||
377 | * The device type ID | ||
378 | * FIXME: clarify what this means | ||
379 | * ECMA-368 [16.8.10] | ||
380 | */ | ||
381 | struct uwb_device_type_id { | ||
382 | u8 data[3]; | ||
383 | } __attribute__((packed)); | ||
384 | |||
385 | |||
386 | /** | ||
387 | * UWB device information types | ||
388 | * ECMA-368 [16.8.10] | ||
389 | */ | ||
390 | enum uwb_dev_info_type { | ||
391 | UWB_DEV_INFO_VENDOR_ID = 0, | ||
392 | UWB_DEV_INFO_VENDOR_TYPE, | ||
393 | UWB_DEV_INFO_NAME, | ||
394 | }; | ||
395 | |||
396 | /** | ||
397 | * UWB device information found in Identification IE | ||
398 | * ECMA-368 [16.8.10] | ||
399 | */ | ||
400 | struct uwb_dev_info { | ||
401 | u8 type; /* enum uwb_dev_info_type */ | ||
402 | u8 length; | ||
403 | u8 data[]; | ||
404 | } __attribute__((packed)); | ||
405 | |||
406 | /** | ||
407 | * UWB Identification IE | ||
408 | * ECMA-368 [16.8.10] | ||
409 | */ | ||
410 | struct uwb_identification_ie { | ||
411 | struct uwb_ie_hdr hdr; | ||
412 | struct uwb_dev_info info[]; | ||
413 | } __attribute__((packed)); | ||
414 | |||
415 | /* | ||
416 | * UWB Radio Controller | ||
417 | * | ||
418 | * These definitions are common to the Radio Control layers as | ||
419 | * exported by the WUSB1.0 HWA and WHCI interfaces. | ||
420 | */ | ||
421 | |||
422 | /** Radio Control Command Block (WUSB1.0[Table 8-65] and WHCI 0.95) */ | ||
423 | struct uwb_rccb { | ||
424 | u8 bCommandType; /* enum hwa_cet */ | ||
425 | __le16 wCommand; /* Command code */ | ||
426 | u8 bCommandContext; /* Context ID */ | ||
427 | } __attribute__((packed)); | ||
428 | |||
429 | |||
430 | /** Radio Control Event Block (WUSB[table 8-66], WHCI 0.95) */ | ||
431 | struct uwb_rceb { | ||
432 | u8 bEventType; /* enum hwa_cet */ | ||
433 | __le16 wEvent; /* Event code */ | ||
434 | u8 bEventContext; /* Context ID */ | ||
435 | } __attribute__((packed)); | ||
436 | |||
437 | |||
438 | enum { | ||
439 | UWB_RC_CET_GENERAL = 0, /* General Command/Event type */ | ||
440 | UWB_RC_CET_EX_TYPE_1 = 1, /* Extended Type 1 Command/Event type */ | ||
441 | }; | ||
442 | |||
443 | /* Commands to the radio controller */ | ||
444 | enum uwb_rc_cmd { | ||
445 | UWB_RC_CMD_CHANNEL_CHANGE = 16, | ||
446 | UWB_RC_CMD_DEV_ADDR_MGMT = 17, /* Device Address Management */ | ||
447 | UWB_RC_CMD_GET_IE = 18, /* GET Information Elements */ | ||
448 | UWB_RC_CMD_RESET = 19, | ||
449 | UWB_RC_CMD_SCAN = 20, /* Scan management */ | ||
450 | UWB_RC_CMD_SET_BEACON_FILTER = 21, | ||
451 | UWB_RC_CMD_SET_DRP_IE = 22, /* Dynamic Reservation Protocol IEs */ | ||
452 | UWB_RC_CMD_SET_IE = 23, /* Information Element management */ | ||
453 | UWB_RC_CMD_SET_NOTIFICATION_FILTER = 24, | ||
454 | UWB_RC_CMD_SET_TX_POWER = 25, | ||
455 | UWB_RC_CMD_SLEEP = 26, | ||
456 | UWB_RC_CMD_START_BEACON = 27, | ||
457 | UWB_RC_CMD_STOP_BEACON = 28, | ||
458 | UWB_RC_CMD_BP_MERGE = 29, | ||
459 | UWB_RC_CMD_SEND_COMMAND_FRAME = 30, | ||
460 | UWB_RC_CMD_SET_ASIE_NOTIF = 31, | ||
461 | }; | ||
462 | |||
463 | /* Notifications from the radio controller */ | ||
464 | enum uwb_rc_evt { | ||
465 | UWB_RC_EVT_IE_RCV = 0, | ||
466 | UWB_RC_EVT_BEACON = 1, | ||
467 | UWB_RC_EVT_BEACON_SIZE = 2, | ||
468 | UWB_RC_EVT_BPOIE_CHANGE = 3, | ||
469 | UWB_RC_EVT_BP_SLOT_CHANGE = 4, | ||
470 | UWB_RC_EVT_BP_SWITCH_IE_RCV = 5, | ||
471 | UWB_RC_EVT_DEV_ADDR_CONFLICT = 6, | ||
472 | UWB_RC_EVT_DRP_AVAIL = 7, | ||
473 | UWB_RC_EVT_DRP = 8, | ||
474 | UWB_RC_EVT_BP_SWITCH_STATUS = 9, | ||
475 | UWB_RC_EVT_CMD_FRAME_RCV = 10, | ||
476 | UWB_RC_EVT_CHANNEL_CHANGE_IE_RCV = 11, | ||
477 | /* Events (command responses) use the same code as the command */ | ||
478 | UWB_RC_EVT_UNKNOWN_CMD_RCV = 65535, | ||
479 | }; | ||
480 | |||
481 | enum uwb_rc_extended_type_1_cmd { | ||
482 | UWB_RC_SET_DAA_ENERGY_MASK = 32, | ||
483 | UWB_RC_SET_NOTIFICATION_FILTER_EX = 33, | ||
484 | }; | ||
485 | |||
486 | enum uwb_rc_extended_type_1_evt { | ||
487 | UWB_RC_DAA_ENERGY_DETECTED = 0, | ||
488 | }; | ||
489 | |||
490 | /* Radio Control Result Code. [WHCI] table 3-3. */ | ||
491 | enum { | ||
492 | UWB_RC_RES_SUCCESS = 0, | ||
493 | UWB_RC_RES_FAIL, | ||
494 | UWB_RC_RES_FAIL_HARDWARE, | ||
495 | UWB_RC_RES_FAIL_NO_SLOTS, | ||
496 | UWB_RC_RES_FAIL_BEACON_TOO_LARGE, | ||
497 | UWB_RC_RES_FAIL_INVALID_PARAMETER, | ||
498 | UWB_RC_RES_FAIL_UNSUPPORTED_PWR_LEVEL, | ||
499 | UWB_RC_RES_FAIL_INVALID_IE_DATA, | ||
500 | UWB_RC_RES_FAIL_BEACON_SIZE_EXCEEDED, | ||
501 | UWB_RC_RES_FAIL_CANCELLED, | ||
502 | UWB_RC_RES_FAIL_INVALID_STATE, | ||
503 | UWB_RC_RES_FAIL_INVALID_SIZE, | ||
504 | UWB_RC_RES_FAIL_ACK_NOT_RECEIVED, | ||
505 | UWB_RC_RES_FAIL_NO_MORE_ASIE_NOTIF, | ||
506 | UWB_RC_RES_FAIL_TIME_OUT = 255, | ||
507 | }; | ||
508 | |||
509 | /* Confirm event. [WHCI] section 3.1.3.1 etc. */ | ||
510 | struct uwb_rc_evt_confirm { | ||
511 | struct uwb_rceb rceb; | ||
512 | u8 bResultCode; | ||
513 | } __attribute__((packed)); | ||
514 | |||
515 | /* Device Address Management event. [WHCI] section 3.1.3.2. */ | ||
516 | struct uwb_rc_evt_dev_addr_mgmt { | ||
517 | struct uwb_rceb rceb; | ||
518 | u8 baAddr[6]; | ||
519 | u8 bResultCode; | ||
520 | } __attribute__((packed)); | ||
521 | |||
522 | |||
523 | /* Get IE Event. [WHCI] section 3.1.3.3. */ | ||
524 | struct uwb_rc_evt_get_ie { | ||
525 | struct uwb_rceb rceb; | ||
526 | __le16 wIELength; | ||
527 | u8 IEData[]; | ||
528 | } __attribute__((packed)); | ||
529 | |||
530 | /* Set DRP IE Event. [WHCI] section 3.1.3.7. */ | ||
531 | struct uwb_rc_evt_set_drp_ie { | ||
532 | struct uwb_rceb rceb; | ||
533 | __le16 wRemainingSpace; | ||
534 | u8 bResultCode; | ||
535 | } __attribute__((packed)); | ||
536 | |||
537 | /* Set IE Event. [WHCI] section 3.1.3.8. */ | ||
538 | struct uwb_rc_evt_set_ie { | ||
539 | struct uwb_rceb rceb; | ||
540 | __le16 RemainingSpace; | ||
541 | u8 bResultCode; | ||
542 | } __attribute__((packed)); | ||
543 | |||
544 | /* Scan command. [WHCI] 3.1.3.5. */ | ||
545 | struct uwb_rc_cmd_scan { | ||
546 | struct uwb_rccb rccb; | ||
547 | u8 bChannelNumber; | ||
548 | u8 bScanState; | ||
549 | __le16 wStartTime; | ||
550 | } __attribute__((packed)); | ||
551 | |||
552 | /* Set DRP IE command. [WHCI] section 3.1.3.7. */ | ||
553 | struct uwb_rc_cmd_set_drp_ie { | ||
554 | struct uwb_rccb rccb; | ||
555 | __le16 wIELength; | ||
556 | struct uwb_ie_drp IEData[]; | ||
557 | } __attribute__((packed)); | ||
558 | |||
559 | /* Set IE command. [WHCI] section 3.1.3.8. */ | ||
560 | struct uwb_rc_cmd_set_ie { | ||
561 | struct uwb_rccb rccb; | ||
562 | __le16 wIELength; | ||
563 | u8 IEData[]; | ||
564 | } __attribute__((packed)); | ||
565 | |||
566 | /* Set DAA Energy Mask event. [WHCI 0.96] section 3.1.3.17. */ | ||
567 | struct uwb_rc_evt_set_daa_energy_mask { | ||
568 | struct uwb_rceb rceb; | ||
569 | __le16 wLength; | ||
570 | u8 result; | ||
571 | } __attribute__((packed)); | ||
572 | |||
573 | /* Set Notification Filter Extended event. [WHCI 0.96] section 3.1.3.18. */ | ||
574 | struct uwb_rc_evt_set_notification_filter_ex { | ||
575 | struct uwb_rceb rceb; | ||
576 | __le16 wLength; | ||
577 | u8 result; | ||
578 | } __attribute__((packed)); | ||
579 | |||
580 | /* IE Received notification. [WHCI] section 3.1.4.1. */ | ||
581 | struct uwb_rc_evt_ie_rcv { | ||
582 | struct uwb_rceb rceb; | ||
583 | struct uwb_dev_addr SrcAddr; | ||
584 | __le16 wIELength; | ||
585 | u8 IEData[]; | ||
586 | } __attribute__((packed)); | ||
587 | |||
588 | /* Type of the received beacon. [WHCI] section 3.1.4.2. */ | ||
589 | enum uwb_rc_beacon_type { | ||
590 | UWB_RC_BEACON_TYPE_SCAN = 0, | ||
591 | UWB_RC_BEACON_TYPE_NEIGHBOR, | ||
592 | UWB_RC_BEACON_TYPE_OL_ALIEN, | ||
593 | UWB_RC_BEACON_TYPE_NOL_ALIEN, | ||
594 | }; | ||
595 | |||
596 | /* Beacon received notification. [WHCI] 3.1.4.2. */ | ||
597 | struct uwb_rc_evt_beacon { | ||
598 | struct uwb_rceb rceb; | ||
599 | u8 bChannelNumber; | ||
600 | u8 bBeaconType; | ||
601 | __le16 wBPSTOffset; | ||
602 | u8 bLQI; | ||
603 | u8 bRSSI; | ||
604 | __le16 wBeaconInfoLength; | ||
605 | u8 BeaconInfo[]; | ||
606 | } __attribute__((packed)); | ||
607 | |||
608 | |||
609 | /* Beacon Size Change notification. [WHCI] section 3.1.4.3 */ | ||
610 | struct uwb_rc_evt_beacon_size { | ||
611 | struct uwb_rceb rceb; | ||
612 | __le16 wNewBeaconSize; | ||
613 | } __attribute__((packed)); | ||
614 | |||
615 | |||
616 | /* BPOIE Change notification. [WHCI] section 3.1.4.4. */ | ||
617 | struct uwb_rc_evt_bpoie_change { | ||
618 | struct uwb_rceb rceb; | ||
619 | __le16 wBPOIELength; | ||
620 | u8 BPOIE[]; | ||
621 | } __attribute__((packed)); | ||
622 | |||
623 | |||
624 | /* Beacon Slot Change notification. [WHCI] section 3.1.4.5. */ | ||
625 | struct uwb_rc_evt_bp_slot_change { | ||
626 | struct uwb_rceb rceb; | ||
627 | u8 slot_info; | ||
628 | } __attribute__((packed)); | ||
629 | |||
630 | static inline int uwb_rc_evt_bp_slot_change_slot_num( | ||
631 | const struct uwb_rc_evt_bp_slot_change *evt) | ||
632 | { | ||
633 | return evt->slot_info & 0x7f; | ||
634 | } | ||
635 | |||
636 | static inline int uwb_rc_evt_bp_slot_change_no_slot( | ||
637 | const struct uwb_rc_evt_bp_slot_change *evt) | ||
638 | { | ||
639 | return (evt->slot_info & 0x80) >> 7; | ||
640 | } | ||
641 | |||
642 | /* BP Switch IE Received notification. [WHCI] section 3.1.4.6. */ | ||
643 | struct uwb_rc_evt_bp_switch_ie_rcv { | ||
644 | struct uwb_rceb rceb; | ||
645 | struct uwb_dev_addr wSrcAddr; | ||
646 | __le16 wIELength; | ||
647 | u8 IEData[]; | ||
648 | } __attribute__((packed)); | ||
649 | |||
650 | /* DevAddr Conflict notification. [WHCI] section 3.1.4.7. */ | ||
651 | struct uwb_rc_evt_dev_addr_conflict { | ||
652 | struct uwb_rceb rceb; | ||
653 | } __attribute__((packed)); | ||
654 | |||
655 | /* DRP notification. [WHCI] section 3.1.4.9. */ | ||
656 | struct uwb_rc_evt_drp { | ||
657 | struct uwb_rceb rceb; | ||
658 | struct uwb_dev_addr src_addr; | ||
659 | u8 reason; | ||
660 | u8 beacon_slot_number; | ||
661 | __le16 ie_length; | ||
662 | u8 ie_data[]; | ||
663 | } __attribute__((packed)); | ||
664 | |||
665 | static inline enum uwb_drp_notif_reason uwb_rc_evt_drp_reason(struct uwb_rc_evt_drp *evt) | ||
666 | { | ||
667 | return evt->reason & 0x0f; | ||
668 | } | ||
669 | |||
670 | |||
671 | /* DRP Availability Change notification. [WHCI] section 3.1.4.8. */ | ||
672 | struct uwb_rc_evt_drp_avail { | ||
673 | struct uwb_rceb rceb; | ||
674 | DECLARE_BITMAP(bmp, UWB_NUM_MAS); | ||
675 | } __attribute__((packed)); | ||
676 | |||
677 | /* BP switch status notification. [WHCI] section 3.1.4.10. */ | ||
678 | struct uwb_rc_evt_bp_switch_status { | ||
679 | struct uwb_rceb rceb; | ||
680 | u8 status; | ||
681 | u8 slot_offset; | ||
682 | __le16 bpst_offset; | ||
683 | u8 move_countdown; | ||
684 | } __attribute__((packed)); | ||
685 | |||
686 | /* Command Frame Received notification. [WHCI] section 3.1.4.11. */ | ||
687 | struct uwb_rc_evt_cmd_frame_rcv { | ||
688 | struct uwb_rceb rceb; | ||
689 | __le16 receive_time; | ||
690 | struct uwb_dev_addr wSrcAddr; | ||
691 | struct uwb_dev_addr wDstAddr; | ||
692 | __le16 control; | ||
693 | __le16 reserved; | ||
694 | __le16 dataLength; | ||
695 | u8 data[]; | ||
696 | } __attribute__((packed)); | ||
697 | |||
698 | /* Channel Change IE Received notification. [WHCI] section 3.1.4.12. */ | ||
699 | struct uwb_rc_evt_channel_change_ie_rcv { | ||
700 | struct uwb_rceb rceb; | ||
701 | struct uwb_dev_addr wSrcAddr; | ||
702 | __le16 wIELength; | ||
703 | u8 IEData[]; | ||
704 | } __attribute__((packed)); | ||
705 | |||
706 | /* DAA Energy Detected notification. [WHCI 0.96] section 3.1.4.14. */ | ||
707 | struct uwb_rc_evt_daa_energy_detected { | ||
708 | struct uwb_rceb rceb; | ||
709 | __le16 wLength; | ||
710 | u8 bandID; | ||
711 | u8 reserved; | ||
712 | u8 toneBmp[16]; | ||
713 | } __attribute__((packed)); | ||
714 | |||
715 | |||
716 | /** | ||
717 | * Radio Control Interface Class Descriptor | ||
718 | * | ||
719 | * WUSB 1.0 [8.6.1.2] | ||
720 | */ | ||
721 | struct uwb_rc_control_intf_class_desc { | ||
722 | u8 bLength; | ||
723 | u8 bDescriptorType; | ||
724 | __le16 bcdRCIVersion; | ||
725 | } __attribute__((packed)); | ||
726 | |||
727 | #endif /* #ifndef __LINUX__UWB_SPEC_H__ */ | ||
diff --git a/include/linux/uwb/umc.h b/include/linux/uwb/umc.h new file mode 100644 index 000000000000..36a39e34f8d7 --- /dev/null +++ b/include/linux/uwb/umc.h | |||
@@ -0,0 +1,194 @@ | |||
1 | /* | ||
2 | * UWB Multi-interface Controller support. | ||
3 | * | ||
4 | * Copyright (C) 2007 Cambridge Silicon Radio Ltd. | ||
5 | * | ||
6 | * This file is released under the GPLv2 | ||
7 | * | ||
8 | * UMC (UWB Multi-interface Controller) capabilities (e.g., radio | ||
9 | * controller, host controller) are presented as devices on the "umc" | ||
10 | * bus. | ||
11 | * | ||
12 | * The radio controller is not strictly a UMC capability but it's | ||
13 | * useful to present it as such. | ||
14 | * | ||
15 | * References: | ||
16 | * | ||
17 | * [WHCI] Wireless Host Controller Interface Specification for | ||
18 | * Certified Wireless Universal Serial Bus, revision 0.95. | ||
19 | * | ||
20 | * How this works is kind of convoluted but simple. The whci.ko driver | ||
21 | * loads when WHCI devices are detected. These WHCI devices expose | ||
22 | * many devices in the same PCI function (they couldn't have reused | ||
23 | * functions, no), so for each PCI function that exposes these many | ||
24 | * devices, whci ceates a umc_dev [whci_probe() -> whci_add_cap()] | ||
25 | * with umc_device_create() and adds it to the bus with | ||
26 | * umc_device_register(). | ||
27 | * | ||
28 | * umc_device_register() calls device_register() which will push the | ||
29 | * bus management code to load your UMC driver's somehting_probe() | ||
30 | * that you have registered for that capability code. | ||
31 | * | ||
32 | * Now when the WHCI device is removed, whci_remove() will go over | ||
33 | * each umc_dev assigned to each of the PCI function's capabilities | ||
34 | * and through whci_del_cap() call umc_device_unregister() each | ||
35 | * created umc_dev. Of course, if you are bound to the device, your | ||
36 | * driver's something_remove() will be called. | ||
37 | */ | ||
38 | |||
39 | #ifndef _LINUX_UWB_UMC_H_ | ||
40 | #define _LINUX_UWB_UMC_H_ | ||
41 | |||
42 | #include <linux/device.h> | ||
43 | #include <linux/pci.h> | ||
44 | |||
45 | /* | ||
46 | * UMC capability IDs. | ||
47 | * | ||
48 | * 0x00 is reserved so use it for the radio controller device. | ||
49 | * | ||
50 | * [WHCI] table 2-8 | ||
51 | */ | ||
52 | #define UMC_CAP_ID_WHCI_RC 0x00 /* radio controller */ | ||
53 | #define UMC_CAP_ID_WHCI_WUSB_HC 0x01 /* WUSB host controller */ | ||
54 | |||
55 | /** | ||
56 | * struct umc_dev - UMC capability device | ||
57 | * | ||
58 | * @version: version of the specification this capability conforms to. | ||
59 | * @cap_id: capability ID. | ||
60 | * @bar: PCI Bar (64 bit) where the resource lies | ||
61 | * @resource: register space resource. | ||
62 | * @irq: interrupt line. | ||
63 | */ | ||
64 | struct umc_dev { | ||
65 | u16 version; | ||
66 | u8 cap_id; | ||
67 | u8 bar; | ||
68 | struct resource resource; | ||
69 | unsigned irq; | ||
70 | struct device dev; | ||
71 | }; | ||
72 | |||
73 | #define to_umc_dev(d) container_of(d, struct umc_dev, dev) | ||
74 | |||
75 | /** | ||
76 | * struct umc_driver - UMC capability driver | ||
77 | * @cap_id: supported capability ID. | ||
78 | * @match: driver specific capability matching function. | ||
79 | * @match_data: driver specific data for match() (e.g., a | ||
80 | * table of pci_device_id's if umc_match_pci_id() is used). | ||
81 | */ | ||
82 | struct umc_driver { | ||
83 | char *name; | ||
84 | u8 cap_id; | ||
85 | int (*match)(struct umc_driver *, struct umc_dev *); | ||
86 | const void *match_data; | ||
87 | |||
88 | int (*probe)(struct umc_dev *); | ||
89 | void (*remove)(struct umc_dev *); | ||
90 | int (*suspend)(struct umc_dev *, pm_message_t state); | ||
91 | int (*resume)(struct umc_dev *); | ||
92 | |||
93 | struct device_driver driver; | ||
94 | }; | ||
95 | |||
96 | #define to_umc_driver(d) container_of(d, struct umc_driver, driver) | ||
97 | |||
98 | extern struct bus_type umc_bus_type; | ||
99 | |||
100 | struct umc_dev *umc_device_create(struct device *parent, int n); | ||
101 | int __must_check umc_device_register(struct umc_dev *umc); | ||
102 | void umc_device_unregister(struct umc_dev *umc); | ||
103 | |||
104 | int __must_check __umc_driver_register(struct umc_driver *umc_drv, | ||
105 | struct module *mod, | ||
106 | const char *mod_name); | ||
107 | |||
108 | /** | ||
109 | * umc_driver_register - register a UMC capabiltity driver. | ||
110 | * @umc_drv: pointer to the driver. | ||
111 | */ | ||
112 | static inline int __must_check umc_driver_register(struct umc_driver *umc_drv) | ||
113 | { | ||
114 | return __umc_driver_register(umc_drv, THIS_MODULE, KBUILD_MODNAME); | ||
115 | } | ||
116 | void umc_driver_unregister(struct umc_driver *umc_drv); | ||
117 | |||
118 | /* | ||
119 | * Utility function you can use to match (umc_driver->match) against a | ||
120 | * null-terminated array of 'struct pci_device_id' in | ||
121 | * umc_driver->match_data. | ||
122 | */ | ||
123 | int umc_match_pci_id(struct umc_driver *umc_drv, struct umc_dev *umc); | ||
124 | |||
125 | /** | ||
126 | * umc_parent_pci_dev - return the UMC's parent PCI device or NULL if none | ||
127 | * @umc_dev: UMC device whose parent PCI device we are looking for | ||
128 | * | ||
129 | * DIRTY!!! DON'T RELY ON THIS | ||
130 | * | ||
131 | * FIXME: This is as dirty as it gets, but we need some way to check | ||
132 | * the correct type of umc_dev->parent (so that for example, we can | ||
133 | * cast to pci_dev). Casting to pci_dev is necesary because at some | ||
134 | * point we need to request resources from the device. Mapping is | ||
135 | * easily over come (ioremap and stuff are bus agnostic), but hooking | ||
136 | * up to some error handlers (such as pci error handlers) might need | ||
137 | * this. | ||
138 | * | ||
139 | * THIS might (probably will) be removed in the future, so don't count | ||
140 | * on it. | ||
141 | */ | ||
142 | static inline struct pci_dev *umc_parent_pci_dev(struct umc_dev *umc_dev) | ||
143 | { | ||
144 | struct pci_dev *pci_dev = NULL; | ||
145 | if (umc_dev->dev.parent->bus == &pci_bus_type) | ||
146 | pci_dev = to_pci_dev(umc_dev->dev.parent); | ||
147 | return pci_dev; | ||
148 | } | ||
149 | |||
150 | /** | ||
151 | * umc_dev_get() - reference a UMC device. | ||
152 | * @umc_dev: Pointer to UMC device. | ||
153 | * | ||
154 | * NOTE: we are assuming in this whole scheme that the parent device | ||
155 | * is referenced at _probe() time and unreferenced at _remove() | ||
156 | * time by the parent's subsystem. | ||
157 | */ | ||
158 | static inline struct umc_dev *umc_dev_get(struct umc_dev *umc_dev) | ||
159 | { | ||
160 | get_device(&umc_dev->dev); | ||
161 | return umc_dev; | ||
162 | } | ||
163 | |||
164 | /** | ||
165 | * umc_dev_put() - unreference a UMC device. | ||
166 | * @umc_dev: Pointer to UMC device. | ||
167 | */ | ||
168 | static inline void umc_dev_put(struct umc_dev *umc_dev) | ||
169 | { | ||
170 | put_device(&umc_dev->dev); | ||
171 | } | ||
172 | |||
173 | /** | ||
174 | * umc_set_drvdata - set UMC device's driver data. | ||
175 | * @umc_dev: Pointer to UMC device. | ||
176 | * @data: Data to set. | ||
177 | */ | ||
178 | static inline void umc_set_drvdata(struct umc_dev *umc_dev, void *data) | ||
179 | { | ||
180 | dev_set_drvdata(&umc_dev->dev, data); | ||
181 | } | ||
182 | |||
183 | /** | ||
184 | * umc_get_drvdata - recover UMC device's driver data. | ||
185 | * @umc_dev: Pointer to UMC device. | ||
186 | */ | ||
187 | static inline void *umc_get_drvdata(struct umc_dev *umc_dev) | ||
188 | { | ||
189 | return dev_get_drvdata(&umc_dev->dev); | ||
190 | } | ||
191 | |||
192 | int umc_controller_reset(struct umc_dev *umc); | ||
193 | |||
194 | #endif /* #ifndef _LINUX_UWB_UMC_H_ */ | ||
diff --git a/include/linux/uwb/whci.h b/include/linux/uwb/whci.h new file mode 100644 index 000000000000..915ec23042d4 --- /dev/null +++ b/include/linux/uwb/whci.h | |||
@@ -0,0 +1,117 @@ | |||
1 | /* | ||
2 | * Wireless Host Controller Interface for Ultra-Wide-Band and Wireless USB | ||
3 | * | ||
4 | * Copyright (C) 2005-2006 Intel Corporation | ||
5 | * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License version | ||
9 | * 2 as published by the Free Software Foundation. | ||
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., 51 Franklin Street, Fifth Floor, Boston, MA | ||
19 | * 02110-1301, USA. | ||
20 | * | ||
21 | * | ||
22 | * | ||
23 | * References: | ||
24 | * [WHCI] Wireless Host Controller Interface Specification for | ||
25 | * Certified Wireless Universal Serial Bus, revision 0.95. | ||
26 | */ | ||
27 | #ifndef _LINUX_UWB_WHCI_H_ | ||
28 | #define _LINUX_UWB_WHCI_H_ | ||
29 | |||
30 | #include <linux/pci.h> | ||
31 | |||
32 | /* | ||
33 | * UWB interface capability registers (offsets from UWBBASE) | ||
34 | * | ||
35 | * [WHCI] section 2.2 | ||
36 | */ | ||
37 | #define UWBCAPINFO 0x00 /* == UWBCAPDATA(0) */ | ||
38 | # define UWBCAPINFO_TO_N_CAPS(c) (((c) >> 0) & 0xFull) | ||
39 | #define UWBCAPDATA(n) (8*(n)) | ||
40 | # define UWBCAPDATA_TO_VERSION(c) (((c) >> 32) & 0xFFFFull) | ||
41 | # define UWBCAPDATA_TO_OFFSET(c) (((c) >> 18) & 0x3FFFull) | ||
42 | # define UWBCAPDATA_TO_BAR(c) (((c) >> 16) & 0x3ull) | ||
43 | # define UWBCAPDATA_TO_SIZE(c) ((((c) >> 8) & 0xFFull) * sizeof(u32)) | ||
44 | # define UWBCAPDATA_TO_CAP_ID(c) (((c) >> 0) & 0xFFull) | ||
45 | |||
46 | /* Size of the WHCI capability data (including the RC capability) for | ||
47 | a device with n capabilities. */ | ||
48 | #define UWBCAPDATA_SIZE(n) (8 + 8*(n)) | ||
49 | |||
50 | |||
51 | /* | ||
52 | * URC registers (offsets from URCBASE) | ||
53 | * | ||
54 | * [WHCI] section 2.3 | ||
55 | */ | ||
56 | #define URCCMD 0x00 | ||
57 | # define URCCMD_RESET (1 << 31) /* UMC Hardware reset */ | ||
58 | # define URCCMD_RS (1 << 30) /* Run/Stop */ | ||
59 | # define URCCMD_EARV (1 << 29) /* Event Address Register Valid */ | ||
60 | # define URCCMD_ACTIVE (1 << 15) /* Command is active */ | ||
61 | # define URCCMD_IWR (1 << 14) /* Interrupt When Ready */ | ||
62 | # define URCCMD_SIZE_MASK 0x00000fff /* Command size mask */ | ||
63 | #define URCSTS 0x04 | ||
64 | # define URCSTS_EPS (1 << 17) /* Event Processing Status */ | ||
65 | # define URCSTS_HALTED (1 << 16) /* RC halted */ | ||
66 | # define URCSTS_HSE (1 << 10) /* Host System Error...fried */ | ||
67 | # define URCSTS_ER (1 << 9) /* Event Ready */ | ||
68 | # define URCSTS_RCI (1 << 8) /* Ready for Command Interrupt */ | ||
69 | # define URCSTS_INT_MASK 0x00000700 /* URC interrupt sources */ | ||
70 | # define URCSTS_ISI 0x000000ff /* Interrupt Source Identification */ | ||
71 | #define URCINTR 0x08 | ||
72 | # define URCINTR_EN_ALL 0x000007ff /* Enable all interrupt sources */ | ||
73 | #define URCCMDADDR 0x10 | ||
74 | #define URCEVTADDR 0x18 | ||
75 | # define URCEVTADDR_OFFSET_MASK 0xfff /* Event pointer offset mask */ | ||
76 | |||
77 | |||
78 | /** Write 32 bit @value to little endian register at @addr */ | ||
79 | static inline | ||
80 | void le_writel(u32 value, void __iomem *addr) | ||
81 | { | ||
82 | iowrite32(value, addr); | ||
83 | } | ||
84 | |||
85 | |||
86 | /** Read from 32 bit little endian register at @addr */ | ||
87 | static inline | ||
88 | u32 le_readl(void __iomem *addr) | ||
89 | { | ||
90 | return ioread32(addr); | ||
91 | } | ||
92 | |||
93 | |||
94 | /** Write 64 bit @value to little endian register at @addr */ | ||
95 | static inline | ||
96 | void le_writeq(u64 value, void __iomem *addr) | ||
97 | { | ||
98 | iowrite32(value, addr); | ||
99 | iowrite32(value >> 32, addr + 4); | ||
100 | } | ||
101 | |||
102 | |||
103 | /** Read from 64 bit little endian register at @addr */ | ||
104 | static inline | ||
105 | u64 le_readq(void __iomem *addr) | ||
106 | { | ||
107 | u64 value; | ||
108 | value = ioread32(addr); | ||
109 | value |= (u64)ioread32(addr + 4) << 32; | ||
110 | return value; | ||
111 | } | ||
112 | |||
113 | extern int whci_wait_for(struct device *dev, u32 __iomem *reg, | ||
114 | u32 mask, u32 result, | ||
115 | unsigned long max_ms, const char *tag); | ||
116 | |||
117 | #endif /* #ifndef _LINUX_UWB_WHCI_H_ */ | ||
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 303d93ffd6b2..4669d7e72e75 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -315,6 +315,13 @@ struct v4l2_pix_format { | |||
315 | /* see http://www.siliconimaging.com/RGB%20Bayer.htm */ | 315 | /* see http://www.siliconimaging.com/RGB%20Bayer.htm */ |
316 | #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ | 316 | #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ |
317 | #define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ | 317 | #define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ |
318 | /* | ||
319 | * 10bit raw bayer, expanded to 16 bits | ||
320 | * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb... | ||
321 | */ | ||
322 | #define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') | ||
323 | /* 10bit raw bayer DPCM compressed to 8 bits */ | ||
324 | #define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') | ||
318 | #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */ | 325 | #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */ |
319 | 326 | ||
320 | /* compressed formats */ | 327 | /* compressed formats */ |
@@ -910,6 +917,8 @@ enum v4l2_mpeg_audio_encoding { | |||
910 | V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0, | 917 | V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0, |
911 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1, | 918 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1, |
912 | V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2, | 919 | V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2, |
920 | V4L2_MPEG_AUDIO_ENCODING_AAC = 3, | ||
921 | V4L2_MPEG_AUDIO_ENCODING_AC3 = 4, | ||
913 | }; | 922 | }; |
914 | #define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102) | 923 | #define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102) |
915 | enum v4l2_mpeg_audio_l1_bitrate { | 924 | enum v4l2_mpeg_audio_l1_bitrate { |
@@ -988,12 +997,36 @@ enum v4l2_mpeg_audio_crc { | |||
988 | V4L2_MPEG_AUDIO_CRC_CRC16 = 1, | 997 | V4L2_MPEG_AUDIO_CRC_CRC16 = 1, |
989 | }; | 998 | }; |
990 | #define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) | 999 | #define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) |
1000 | #define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110) | ||
1001 | #define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111) | ||
1002 | enum v4l2_mpeg_audio_ac3_bitrate { | ||
1003 | V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0, | ||
1004 | V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1, | ||
1005 | V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2, | ||
1006 | V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3, | ||
1007 | V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4, | ||
1008 | V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5, | ||
1009 | V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6, | ||
1010 | V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7, | ||
1011 | V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8, | ||
1012 | V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9, | ||
1013 | V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10, | ||
1014 | V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11, | ||
1015 | V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12, | ||
1016 | V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13, | ||
1017 | V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14, | ||
1018 | V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15, | ||
1019 | V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16, | ||
1020 | V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17, | ||
1021 | V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, | ||
1022 | }; | ||
991 | 1023 | ||
992 | /* MPEG video */ | 1024 | /* MPEG video */ |
993 | #define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) | 1025 | #define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) |
994 | enum v4l2_mpeg_video_encoding { | 1026 | enum v4l2_mpeg_video_encoding { |
995 | V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0, | 1027 | V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0, |
996 | V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1, | 1028 | V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1, |
1029 | V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2, | ||
997 | }; | 1030 | }; |
998 | #define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201) | 1031 | #define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201) |
999 | enum v4l2_mpeg_video_aspect { | 1032 | enum v4l2_mpeg_video_aspect { |
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 328eb4022727..307b88577eaa 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _LINUX_VMALLOC_H | 2 | #define _LINUX_VMALLOC_H |
3 | 3 | ||
4 | #include <linux/spinlock.h> | 4 | #include <linux/spinlock.h> |
5 | #include <linux/init.h> | ||
5 | #include <asm/page.h> /* pgprot_t */ | 6 | #include <asm/page.h> /* pgprot_t */ |
6 | 7 | ||
7 | struct vm_area_struct; /* vma defining user mapping in mm_types.h */ | 8 | struct vm_area_struct; /* vma defining user mapping in mm_types.h */ |
@@ -23,7 +24,6 @@ struct vm_area_struct; /* vma defining user mapping in mm_types.h */ | |||
23 | #endif | 24 | #endif |
24 | 25 | ||
25 | struct vm_struct { | 26 | struct vm_struct { |
26 | /* keep next,addr,size together to speedup lookups */ | ||
27 | struct vm_struct *next; | 27 | struct vm_struct *next; |
28 | void *addr; | 28 | void *addr; |
29 | unsigned long size; | 29 | unsigned long size; |
@@ -37,6 +37,19 @@ struct vm_struct { | |||
37 | /* | 37 | /* |
38 | * Highlevel APIs for driver use | 38 | * Highlevel APIs for driver use |
39 | */ | 39 | */ |
40 | extern void vm_unmap_ram(const void *mem, unsigned int count); | ||
41 | extern void *vm_map_ram(struct page **pages, unsigned int count, | ||
42 | int node, pgprot_t prot); | ||
43 | extern void vm_unmap_aliases(void); | ||
44 | |||
45 | #ifdef CONFIG_MMU | ||
46 | extern void __init vmalloc_init(void); | ||
47 | #else | ||
48 | static inline void vmalloc_init(void) | ||
49 | { | ||
50 | } | ||
51 | #endif | ||
52 | |||
40 | extern void *vmalloc(unsigned long size); | 53 | extern void *vmalloc(unsigned long size); |
41 | extern void *vmalloc_user(unsigned long size); | 54 | extern void *vmalloc_user(unsigned long size); |
42 | extern void *vmalloc_node(unsigned long size, int node); | 55 | extern void *vmalloc_node(unsigned long size, int node); |
@@ -90,6 +103,4 @@ extern void free_vm_area(struct vm_struct *area); | |||
90 | extern rwlock_t vmlist_lock; | 103 | extern rwlock_t vmlist_lock; |
91 | extern struct vm_struct *vmlist; | 104 | extern struct vm_struct *vmlist; |
92 | 105 | ||
93 | extern const struct seq_operations vmalloc_op; | ||
94 | |||
95 | #endif /* _LINUX_VMALLOC_H */ | 106 | #endif /* _LINUX_VMALLOC_H */ |
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 58334d439516..524cd1b28ecb 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h | |||
@@ -41,13 +41,19 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, | |||
41 | #ifdef CONFIG_HUGETLB_PAGE | 41 | #ifdef CONFIG_HUGETLB_PAGE |
42 | HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL, | 42 | HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL, |
43 | #endif | 43 | #endif |
44 | #ifdef CONFIG_UNEVICTABLE_LRU | ||
45 | UNEVICTABLE_PGCULLED, /* culled to noreclaim list */ | ||
46 | UNEVICTABLE_PGSCANNED, /* scanned for reclaimability */ | ||
47 | UNEVICTABLE_PGRESCUED, /* rescued from noreclaim list */ | ||
48 | UNEVICTABLE_PGMLOCKED, | ||
49 | UNEVICTABLE_PGMUNLOCKED, | ||
50 | UNEVICTABLE_PGCLEARED, /* on COW, page truncate */ | ||
51 | UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */ | ||
52 | UNEVICTABLE_MLOCKFREED, | ||
53 | #endif | ||
44 | NR_VM_EVENT_ITEMS | 54 | NR_VM_EVENT_ITEMS |
45 | }; | 55 | }; |
46 | 56 | ||
47 | extern const struct seq_operations fragmentation_op; | ||
48 | extern const struct seq_operations pagetypeinfo_op; | ||
49 | extern const struct seq_operations zoneinfo_op; | ||
50 | extern const struct seq_operations vmstat_op; | ||
51 | extern int sysctl_stat_interval; | 57 | extern int sysctl_stat_interval; |
52 | 58 | ||
53 | #ifdef CONFIG_VM_EVENT_COUNTERS | 59 | #ifdef CONFIG_VM_EVENT_COUNTERS |
@@ -159,6 +165,16 @@ static inline unsigned long zone_page_state(struct zone *zone, | |||
159 | return x; | 165 | return x; |
160 | } | 166 | } |
161 | 167 | ||
168 | extern unsigned long global_lru_pages(void); | ||
169 | |||
170 | static inline unsigned long zone_lru_pages(struct zone *zone) | ||
171 | { | ||
172 | return (zone_page_state(zone, NR_ACTIVE_ANON) | ||
173 | + zone_page_state(zone, NR_ACTIVE_FILE) | ||
174 | + zone_page_state(zone, NR_INACTIVE_ANON) | ||
175 | + zone_page_state(zone, NR_INACTIVE_FILE)); | ||
176 | } | ||
177 | |||
162 | #ifdef CONFIG_NUMA | 178 | #ifdef CONFIG_NUMA |
163 | /* | 179 | /* |
164 | * Determine the per node value of a stat item. This function | 180 | * Determine the per node value of a stat item. This function |
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h index 1cbd0a7db4e6..2f1113467f70 100644 --- a/include/linux/vt_kern.h +++ b/include/linux/vt_kern.h | |||
@@ -96,7 +96,7 @@ void change_console(struct vc_data *new_vc); | |||
96 | void reset_vc(struct vc_data *vc); | 96 | void reset_vc(struct vc_data *vc); |
97 | extern int unbind_con_driver(const struct consw *csw, int first, int last, | 97 | extern int unbind_con_driver(const struct consw *csw, int first, int last, |
98 | int deflt); | 98 | int deflt); |
99 | int vty_init(void); | 99 | int vty_init(const struct file_operations *console_fops); |
100 | 100 | ||
101 | /* | 101 | /* |
102 | * vc_screen.c shares this temporary buffer with the console write code so that | 102 | * vc_screen.c shares this temporary buffer with the console write code so that |
diff --git a/include/linux/wait.h b/include/linux/wait.h index 0081147a9fe8..ef609f842fac 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
@@ -108,15 +108,6 @@ static inline int waitqueue_active(wait_queue_head_t *q) | |||
108 | return !list_empty(&q->task_list); | 108 | return !list_empty(&q->task_list); |
109 | } | 109 | } |
110 | 110 | ||
111 | /* | ||
112 | * Used to distinguish between sync and async io wait context: | ||
113 | * sync i/o typically specifies a NULL wait queue entry or a wait | ||
114 | * queue entry bound to a task (current task) to wake up. | ||
115 | * aio specifies a wait queue entry with an async notification | ||
116 | * callback routine, not associated with any task. | ||
117 | */ | ||
118 | #define is_sync_wait(wait) (!(wait) || ((wait)->private)) | ||
119 | |||
120 | extern void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait); | 111 | extern void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait); |
121 | extern void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait); | 112 | extern void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait); |
122 | extern void remove_wait_queue(wait_queue_head_t *q, wait_queue_t *wait); | 113 | extern void remove_wait_queue(wait_queue_head_t *q, wait_queue_t *wait); |
diff --git a/include/linux/wlp.h b/include/linux/wlp.h new file mode 100644 index 000000000000..033545e145c7 --- /dev/null +++ b/include/linux/wlp.h | |||
@@ -0,0 +1,735 @@ | |||
1 | /* | ||
2 | * WiMedia Logical Link Control Protocol (WLP) | ||
3 | * | ||
4 | * Copyright (C) 2005-2006 Intel Corporation | ||
5 | * Reinette Chatre <reinette.chatre@intel.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License version | ||
9 | * 2 as published by the Free Software Foundation. | ||
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., 51 Franklin Street, Fifth Floor, Boston, MA | ||
19 | * 02110-1301, USA. | ||
20 | * | ||
21 | * | ||
22 | * FIXME: docs | ||
23 | * | ||
24 | * - Does not (yet) include support for WLP control frames | ||
25 | * WLP Draft 0.99 [6.5]. | ||
26 | * | ||
27 | * A visual representation of the data structures. | ||
28 | * | ||
29 | * wssidB wssidB | ||
30 | * ^ ^ | ||
31 | * | | | ||
32 | * wssidA wssidA | ||
33 | * wlp interface { ^ ^ | ||
34 | * ... | | | ||
35 | * ... ... wssid wssid ... | ||
36 | * wlp --- ... | | | ||
37 | * }; neighbors --> neighbA --> neighbB | ||
38 | * ... | ||
39 | * wss | ||
40 | * ... | ||
41 | * eda cache --> neighborA --> neighborB --> neighborC ... | ||
42 | */ | ||
43 | |||
44 | #ifndef __LINUX__WLP_H_ | ||
45 | #define __LINUX__WLP_H_ | ||
46 | |||
47 | #include <linux/netdevice.h> | ||
48 | #include <linux/skbuff.h> | ||
49 | #include <linux/list.h> | ||
50 | #include <linux/uwb.h> | ||
51 | |||
52 | /** | ||
53 | * WLP Protocol ID | ||
54 | * WLP Draft 0.99 [6.2] | ||
55 | * | ||
56 | * The MUX header for all WLP frames | ||
57 | */ | ||
58 | #define WLP_PROTOCOL_ID 0x0100 | ||
59 | |||
60 | /** | ||
61 | * WLP Version | ||
62 | * WLP version placed in the association frames (WLP 0.99 [6.6]) | ||
63 | */ | ||
64 | #define WLP_VERSION 0x10 | ||
65 | |||
66 | /** | ||
67 | * Bytes needed to print UUID as string | ||
68 | */ | ||
69 | #define WLP_WSS_UUID_STRSIZE 48 | ||
70 | |||
71 | /** | ||
72 | * Bytes needed to print nonce as string | ||
73 | */ | ||
74 | #define WLP_WSS_NONCE_STRSIZE 48 | ||
75 | |||
76 | |||
77 | /** | ||
78 | * Size used for WLP name size | ||
79 | * | ||
80 | * The WSS name is set to 65 bytes, 1 byte larger than the maximum | ||
81 | * allowed by the WLP spec. This is to have a null terminated string | ||
82 | * for display to the user. A maximum of 64 bytes will still be used | ||
83 | * when placing the WSS name field in association frames. | ||
84 | */ | ||
85 | #define WLP_WSS_NAME_SIZE 65 | ||
86 | |||
87 | /** | ||
88 | * Number of bytes added by WLP to data frame | ||
89 | * | ||
90 | * A data frame transmitted from a host will be placed in a Standard or | ||
91 | * Abbreviated WLP frame. These have an extra 4 bytes of header (struct | ||
92 | * wlp_frame_std_abbrv_hdr). | ||
93 | * When the stack sends this data frame for transmission it needs to ensure | ||
94 | * there is enough headroom for this header. | ||
95 | */ | ||
96 | #define WLP_DATA_HLEN 4 | ||
97 | |||
98 | /** | ||
99 | * State of device regarding WLP Service Set | ||
100 | * | ||
101 | * WLP_WSS_STATE_NONE: the host does not participate in any WSS | ||
102 | * WLP_WSS_STATE_PART_ENROLLED: used as part of the enrollment sequence | ||
103 | * ("Partial Enroll"). This state is used to | ||
104 | * indicate the first part of enrollment that is | ||
105 | * unsecure. If the WSS is unsecure then the | ||
106 | * state will promptly go to WLP_WSS_STATE_ENROLLED, | ||
107 | * if the WSS is not secure then the enrollment | ||
108 | * procedure is a few more steps before we are | ||
109 | * enrolled. | ||
110 | * WLP_WSS_STATE_ENROLLED: the host is enrolled in a WSS | ||
111 | * WLP_WSS_STATE_ACTIVE: WSS is activated | ||
112 | * WLP_WSS_STATE_CONNECTED: host is connected to neighbor in WSS | ||
113 | * | ||
114 | */ | ||
115 | enum wlp_wss_state { | ||
116 | WLP_WSS_STATE_NONE = 0, | ||
117 | WLP_WSS_STATE_PART_ENROLLED, | ||
118 | WLP_WSS_STATE_ENROLLED, | ||
119 | WLP_WSS_STATE_ACTIVE, | ||
120 | WLP_WSS_STATE_CONNECTED, | ||
121 | }; | ||
122 | |||
123 | /** | ||
124 | * WSS Secure status | ||
125 | * WLP 0.99 Table 6 | ||
126 | * | ||
127 | * Set to one if the WSS is secure, zero if it is not secure | ||
128 | */ | ||
129 | enum wlp_wss_sec_status { | ||
130 | WLP_WSS_UNSECURE = 0, | ||
131 | WLP_WSS_SECURE, | ||
132 | }; | ||
133 | |||
134 | /** | ||
135 | * WLP frame type | ||
136 | * WLP Draft 0.99 [6.2 Table 1] | ||
137 | */ | ||
138 | enum wlp_frame_type { | ||
139 | WLP_FRAME_STANDARD = 0, | ||
140 | WLP_FRAME_ABBREVIATED, | ||
141 | WLP_FRAME_CONTROL, | ||
142 | WLP_FRAME_ASSOCIATION, | ||
143 | }; | ||
144 | |||
145 | /** | ||
146 | * WLP Association Message Type | ||
147 | * WLP Draft 0.99 [6.6.1.2 Table 8] | ||
148 | */ | ||
149 | enum wlp_assoc_type { | ||
150 | WLP_ASSOC_D1 = 2, | ||
151 | WLP_ASSOC_D2 = 3, | ||
152 | WLP_ASSOC_M1 = 4, | ||
153 | WLP_ASSOC_M2 = 5, | ||
154 | WLP_ASSOC_M3 = 7, | ||
155 | WLP_ASSOC_M4 = 8, | ||
156 | WLP_ASSOC_M5 = 9, | ||
157 | WLP_ASSOC_M6 = 10, | ||
158 | WLP_ASSOC_M7 = 11, | ||
159 | WLP_ASSOC_M8 = 12, | ||
160 | WLP_ASSOC_F0 = 14, | ||
161 | WLP_ASSOC_E1 = 32, | ||
162 | WLP_ASSOC_E2 = 33, | ||
163 | WLP_ASSOC_C1 = 34, | ||
164 | WLP_ASSOC_C2 = 35, | ||
165 | WLP_ASSOC_C3 = 36, | ||
166 | WLP_ASSOC_C4 = 37, | ||
167 | }; | ||
168 | |||
169 | /** | ||
170 | * WLP Attribute Type | ||
171 | * WLP Draft 0.99 [6.6.1 Table 6] | ||
172 | */ | ||
173 | enum wlp_attr_type { | ||
174 | WLP_ATTR_AUTH = 0x1005, /* Authenticator */ | ||
175 | WLP_ATTR_DEV_NAME = 0x1011, /* Device Name */ | ||
176 | WLP_ATTR_DEV_PWD_ID = 0x1012, /* Device Password ID */ | ||
177 | WLP_ATTR_E_HASH1 = 0x1014, /* E-Hash1 */ | ||
178 | WLP_ATTR_E_HASH2 = 0x1015, /* E-Hash2 */ | ||
179 | WLP_ATTR_E_SNONCE1 = 0x1016, /* E-SNonce1 */ | ||
180 | WLP_ATTR_E_SNONCE2 = 0x1017, /* E-SNonce2 */ | ||
181 | WLP_ATTR_ENCR_SET = 0x1018, /* Encrypted Settings */ | ||
182 | WLP_ATTR_ENRL_NONCE = 0x101A, /* Enrollee Nonce */ | ||
183 | WLP_ATTR_KEYWRAP_AUTH = 0x101E, /* Key Wrap Authenticator */ | ||
184 | WLP_ATTR_MANUF = 0x1021, /* Manufacturer */ | ||
185 | WLP_ATTR_MSG_TYPE = 0x1022, /* Message Type */ | ||
186 | WLP_ATTR_MODEL_NAME = 0x1023, /* Model Name */ | ||
187 | WLP_ATTR_MODEL_NR = 0x1024, /* Model Number */ | ||
188 | WLP_ATTR_PUB_KEY = 0x1032, /* Public Key */ | ||
189 | WLP_ATTR_REG_NONCE = 0x1039, /* Registrar Nonce */ | ||
190 | WLP_ATTR_R_HASH1 = 0x103D, /* R-Hash1 */ | ||
191 | WLP_ATTR_R_HASH2 = 0x103E, /* R-Hash2 */ | ||
192 | WLP_ATTR_R_SNONCE1 = 0x103F, /* R-SNonce1 */ | ||
193 | WLP_ATTR_R_SNONCE2 = 0x1040, /* R-SNonce2 */ | ||
194 | WLP_ATTR_SERIAL = 0x1042, /* Serial number */ | ||
195 | WLP_ATTR_UUID_E = 0x1047, /* UUID-E */ | ||
196 | WLP_ATTR_UUID_R = 0x1048, /* UUID-R */ | ||
197 | WLP_ATTR_PRI_DEV_TYPE = 0x1054, /* Primary Device Type */ | ||
198 | WLP_ATTR_SEC_DEV_TYPE = 0x1055, /* Secondary Device Type */ | ||
199 | WLP_ATTR_PORT_DEV = 0x1056, /* Portable Device */ | ||
200 | WLP_ATTR_APP_EXT = 0x1058, /* Application Extension */ | ||
201 | WLP_ATTR_WLP_VER = 0x2000, /* WLP Version */ | ||
202 | WLP_ATTR_WSSID = 0x2001, /* WSSID */ | ||
203 | WLP_ATTR_WSS_NAME = 0x2002, /* WSS Name */ | ||
204 | WLP_ATTR_WSS_SEC_STAT = 0x2003, /* WSS Secure Status */ | ||
205 | WLP_ATTR_WSS_BCAST = 0x2004, /* WSS Broadcast Address */ | ||
206 | WLP_ATTR_WSS_M_KEY = 0x2005, /* WSS Master Key */ | ||
207 | WLP_ATTR_ACC_ENRL = 0x2006, /* Accepting Enrollment */ | ||
208 | WLP_ATTR_WSS_INFO = 0x2007, /* WSS Information */ | ||
209 | WLP_ATTR_WSS_SEL_MTHD = 0x2008, /* WSS Selection Method */ | ||
210 | WLP_ATTR_ASSC_MTHD_LIST = 0x2009, /* Association Methods List */ | ||
211 | WLP_ATTR_SEL_ASSC_MTHD = 0x200A, /* Selected Association Method */ | ||
212 | WLP_ATTR_ENRL_HASH_COMM = 0x200B, /* Enrollee Hash Commitment */ | ||
213 | WLP_ATTR_WSS_TAG = 0x200C, /* WSS Tag */ | ||
214 | WLP_ATTR_WSS_VIRT = 0x200D, /* WSS Virtual EUI-48 */ | ||
215 | WLP_ATTR_WLP_ASSC_ERR = 0x200E, /* WLP Association Error */ | ||
216 | WLP_ATTR_VNDR_EXT = 0x200F, /* Vendor Extension */ | ||
217 | }; | ||
218 | |||
219 | /** | ||
220 | * WLP Category ID of primary/secondary device | ||
221 | * WLP Draft 0.99 [6.6.1.8 Table 12] | ||
222 | */ | ||
223 | enum wlp_dev_category_id { | ||
224 | WLP_DEV_CAT_COMPUTER = 1, | ||
225 | WLP_DEV_CAT_INPUT, | ||
226 | WLP_DEV_CAT_PRINT_SCAN_FAX_COPIER, | ||
227 | WLP_DEV_CAT_CAMERA, | ||
228 | WLP_DEV_CAT_STORAGE, | ||
229 | WLP_DEV_CAT_INFRASTRUCTURE, | ||
230 | WLP_DEV_CAT_DISPLAY, | ||
231 | WLP_DEV_CAT_MULTIM, | ||
232 | WLP_DEV_CAT_GAMING, | ||
233 | WLP_DEV_CAT_TELEPHONE, | ||
234 | WLP_DEV_CAT_OTHER = 65535, | ||
235 | }; | ||
236 | |||
237 | /** | ||
238 | * WLP WSS selection method | ||
239 | * WLP Draft 0.99 [6.6.1.6 Table 10] | ||
240 | */ | ||
241 | enum wlp_wss_sel_mthd { | ||
242 | WLP_WSS_ENRL_SELECT = 1, /* Enrollee selects */ | ||
243 | WLP_WSS_REG_SELECT, /* Registrar selects */ | ||
244 | }; | ||
245 | |||
246 | /** | ||
247 | * WLP association error values | ||
248 | * WLP Draft 0.99 [6.6.1.5 Table 9] | ||
249 | */ | ||
250 | enum wlp_assc_error { | ||
251 | WLP_ASSOC_ERROR_NONE, | ||
252 | WLP_ASSOC_ERROR_AUTH, /* Authenticator Failure */ | ||
253 | WLP_ASSOC_ERROR_ROGUE, /* Rogue activity suspected */ | ||
254 | WLP_ASSOC_ERROR_BUSY, /* Device busy */ | ||
255 | WLP_ASSOC_ERROR_LOCK, /* Setup Locked */ | ||
256 | WLP_ASSOC_ERROR_NOT_READY, /* Registrar not ready */ | ||
257 | WLP_ASSOC_ERROR_INV, /* Invalid WSS selection */ | ||
258 | WLP_ASSOC_ERROR_MSG_TIME, /* Message timeout */ | ||
259 | WLP_ASSOC_ERROR_ENR_TIME, /* Enrollment session timeout */ | ||
260 | WLP_ASSOC_ERROR_PW, /* Device password invalid */ | ||
261 | WLP_ASSOC_ERROR_VER, /* Unsupported version */ | ||
262 | WLP_ASSOC_ERROR_INT, /* Internal error */ | ||
263 | WLP_ASSOC_ERROR_UNDEF, /* Undefined error */ | ||
264 | WLP_ASSOC_ERROR_NUM, /* Numeric comparison failure */ | ||
265 | WLP_ASSOC_ERROR_WAIT, /* Waiting for user input */ | ||
266 | }; | ||
267 | |||
268 | /** | ||
269 | * WLP Parameters | ||
270 | * WLP 0.99 [7.7] | ||
271 | */ | ||
272 | enum wlp_parameters { | ||
273 | WLP_PER_MSG_TIMEOUT = 15, /* Seconds to wait for response to | ||
274 | association message. */ | ||
275 | }; | ||
276 | |||
277 | /** | ||
278 | * WLP IE | ||
279 | * | ||
280 | * The WLP IE should be included in beacons by all devices. | ||
281 | * | ||
282 | * The driver can set only a few of the fields in this information element, | ||
283 | * most fields are managed by the device self. When the driver needs to set | ||
284 | * a field it will only provide values for the fields of interest, the rest | ||
285 | * will be filled with zeroes. The fields of interest are: | ||
286 | * | ||
287 | * Element ID | ||
288 | * Length | ||
289 | * Capabilities (only to include WSSID Hash list length) | ||
290 | * WSSID Hash List fields | ||
291 | * | ||
292 | * WLP 0.99 [6.7] | ||
293 | * | ||
294 | * Only the fields that will be used are detailed in this structure, rest | ||
295 | * are not detailed or marked as "notused". | ||
296 | */ | ||
297 | struct wlp_ie { | ||
298 | struct uwb_ie_hdr hdr; | ||
299 | __le16 capabilities; | ||
300 | __le16 cycle_param; | ||
301 | __le16 acw_anchor_addr; | ||
302 | u8 wssid_hash_list[]; | ||
303 | } __attribute__((packed)); | ||
304 | |||
305 | static inline int wlp_ie_hash_length(struct wlp_ie *ie) | ||
306 | { | ||
307 | return (le16_to_cpu(ie->capabilities) >> 12) & 0xf; | ||
308 | } | ||
309 | |||
310 | static inline void wlp_ie_set_hash_length(struct wlp_ie *ie, int hash_length) | ||
311 | { | ||
312 | u16 caps = le16_to_cpu(ie->capabilities); | ||
313 | caps = (caps & ~(0xf << 12)) | (hash_length << 12); | ||
314 | ie->capabilities = cpu_to_le16(caps); | ||
315 | } | ||
316 | |||
317 | /** | ||
318 | * WLP nonce | ||
319 | * WLP Draft 0.99 [6.6.1 Table 6] | ||
320 | * | ||
321 | * A 128-bit random number often used (E-SNonce1, E-SNonce2, Enrollee | ||
322 | * Nonce, Registrar Nonce, R-SNonce1, R-SNonce2). It is passed to HW so | ||
323 | * it is packed. | ||
324 | */ | ||
325 | struct wlp_nonce { | ||
326 | u8 data[16]; | ||
327 | } __attribute__((packed)); | ||
328 | |||
329 | /** | ||
330 | * WLP UUID | ||
331 | * WLP Draft 0.99 [6.6.1 Table 6] | ||
332 | * | ||
333 | * Universally Unique Identifier (UUID) encoded as an octet string in the | ||
334 | * order the octets are shown in string representation in RFC4122. A UUID | ||
335 | * is often used (UUID-E, UUID-R, WSSID). It is passed to HW so it is packed. | ||
336 | */ | ||
337 | struct wlp_uuid { | ||
338 | u8 data[16]; | ||
339 | } __attribute__((packed)); | ||
340 | |||
341 | |||
342 | /** | ||
343 | * Primary and secondary device type attributes | ||
344 | * WLP Draft 0.99 [6.6.1.8] | ||
345 | */ | ||
346 | struct wlp_dev_type { | ||
347 | enum wlp_dev_category_id category:16; | ||
348 | u8 OUI[3]; | ||
349 | u8 OUIsubdiv; | ||
350 | __le16 subID; | ||
351 | } __attribute__((packed)); | ||
352 | |||
353 | /** | ||
354 | * WLP frame header | ||
355 | * WLP Draft 0.99 [6.2] | ||
356 | */ | ||
357 | struct wlp_frame_hdr { | ||
358 | __le16 mux_hdr; /* WLP_PROTOCOL_ID */ | ||
359 | enum wlp_frame_type type:8; | ||
360 | } __attribute__((packed)); | ||
361 | |||
362 | /** | ||
363 | * WLP attribute field header | ||
364 | * WLP Draft 0.99 [6.6.1] | ||
365 | * | ||
366 | * Header of each attribute found in an association frame | ||
367 | */ | ||
368 | struct wlp_attr_hdr { | ||
369 | __le16 type; | ||
370 | __le16 length; | ||
371 | } __attribute__((packed)); | ||
372 | |||
373 | /** | ||
374 | * Device information commonly used together | ||
375 | * | ||
376 | * Each of these device information elements has a specified range in which it | ||
377 | * should fit (WLP 0.99 [Table 6]). This range provided in the spec does not | ||
378 | * include the termination null '\0' character (when used in the | ||
379 | * association protocol the attribute fields are accompanied | ||
380 | * with a "length" field so the full range from the spec can be used for | ||
381 | * the value). We thus allocate an extra byte to be able to store a string | ||
382 | * of max length with a terminating '\0'. | ||
383 | */ | ||
384 | struct wlp_device_info { | ||
385 | char name[33]; | ||
386 | char model_name[33]; | ||
387 | char manufacturer[65]; | ||
388 | char model_nr[33]; | ||
389 | char serial[33]; | ||
390 | struct wlp_dev_type prim_dev_type; | ||
391 | }; | ||
392 | |||
393 | /** | ||
394 | * Macros for the WLP attributes | ||
395 | * | ||
396 | * There are quite a few attributes (total is 43). The attribute layout can be | ||
397 | * in one of three categories: one value, an array, an enum forced to 8 bits. | ||
398 | * These macros help with their definitions. | ||
399 | */ | ||
400 | #define wlp_attr(type, name) \ | ||
401 | struct wlp_attr_##name { \ | ||
402 | struct wlp_attr_hdr hdr; \ | ||
403 | type name; \ | ||
404 | } __attribute__((packed)); | ||
405 | |||
406 | #define wlp_attr_array(type, name) \ | ||
407 | struct wlp_attr_##name { \ | ||
408 | struct wlp_attr_hdr hdr; \ | ||
409 | type name[]; \ | ||
410 | } __attribute__((packed)); | ||
411 | |||
412 | /** | ||
413 | * WLP association attribute fields | ||
414 | * WLP Draft 0.99 [6.6.1 Table 6] | ||
415 | * | ||
416 | * Attributes appear in same order as the Table in the spec | ||
417 | * FIXME Does not define all attributes yet | ||
418 | */ | ||
419 | |||
420 | /* Device name: Friendly name of sending device */ | ||
421 | wlp_attr_array(u8, dev_name) | ||
422 | |||
423 | /* Enrollee Nonce: Random number generated by enrollee for an enrollment | ||
424 | * session */ | ||
425 | wlp_attr(struct wlp_nonce, enonce) | ||
426 | |||
427 | /* Manufacturer name: Name of manufacturer of the sending device */ | ||
428 | wlp_attr_array(u8, manufacturer) | ||
429 | |||
430 | /* WLP Message Type */ | ||
431 | wlp_attr(u8, msg_type) | ||
432 | |||
433 | /* WLP Model name: Model name of sending device */ | ||
434 | wlp_attr_array(u8, model_name) | ||
435 | |||
436 | /* WLP Model number: Model number of sending device */ | ||
437 | wlp_attr_array(u8, model_nr) | ||
438 | |||
439 | /* Registrar Nonce: Random number generated by registrar for an enrollment | ||
440 | * session */ | ||
441 | wlp_attr(struct wlp_nonce, rnonce) | ||
442 | |||
443 | /* Serial number of device */ | ||
444 | wlp_attr_array(u8, serial) | ||
445 | |||
446 | /* UUID of enrollee */ | ||
447 | wlp_attr(struct wlp_uuid, uuid_e) | ||
448 | |||
449 | /* UUID of registrar */ | ||
450 | wlp_attr(struct wlp_uuid, uuid_r) | ||
451 | |||
452 | /* WLP Primary device type */ | ||
453 | wlp_attr(struct wlp_dev_type, prim_dev_type) | ||
454 | |||
455 | /* WLP Secondary device type */ | ||
456 | wlp_attr(struct wlp_dev_type, sec_dev_type) | ||
457 | |||
458 | /* WLP protocol version */ | ||
459 | wlp_attr(u8, version) | ||
460 | |||
461 | /* WLP service set identifier */ | ||
462 | wlp_attr(struct wlp_uuid, wssid) | ||
463 | |||
464 | /* WLP WSS name */ | ||
465 | wlp_attr_array(u8, wss_name) | ||
466 | |||
467 | /* WLP WSS Secure Status */ | ||
468 | wlp_attr(u8, wss_sec_status) | ||
469 | |||
470 | /* WSS Broadcast Address */ | ||
471 | wlp_attr(struct uwb_mac_addr, wss_bcast) | ||
472 | |||
473 | /* WLP Accepting Enrollment */ | ||
474 | wlp_attr(u8, accept_enrl) | ||
475 | |||
476 | /** | ||
477 | * WSS information attributes | ||
478 | * WLP Draft 0.99 [6.6.3 Table 15] | ||
479 | */ | ||
480 | struct wlp_wss_info { | ||
481 | struct wlp_attr_wssid wssid; | ||
482 | struct wlp_attr_wss_name name; | ||
483 | struct wlp_attr_accept_enrl accept; | ||
484 | struct wlp_attr_wss_sec_status sec_stat; | ||
485 | struct wlp_attr_wss_bcast bcast; | ||
486 | } __attribute__((packed)); | ||
487 | |||
488 | /* WLP WSS Information */ | ||
489 | wlp_attr_array(struct wlp_wss_info, wss_info) | ||
490 | |||
491 | /* WLP WSS Selection method */ | ||
492 | wlp_attr(u8, wss_sel_mthd) | ||
493 | |||
494 | /* WLP WSS tag */ | ||
495 | wlp_attr(u8, wss_tag) | ||
496 | |||
497 | /* WSS Virtual Address */ | ||
498 | wlp_attr(struct uwb_mac_addr, wss_virt) | ||
499 | |||
500 | /* WLP association error */ | ||
501 | wlp_attr(u8, wlp_assc_err) | ||
502 | |||
503 | /** | ||
504 | * WLP standard and abbreviated frames | ||
505 | * | ||
506 | * WLP Draft 0.99 [6.3] and [6.4] | ||
507 | * | ||
508 | * The difference between the WLP standard frame and the WLP | ||
509 | * abbreviated frame is that the standard frame includes the src | ||
510 | * and dest addresses from the Ethernet header, the abbreviated frame does | ||
511 | * not. | ||
512 | * The src/dest (as well as the type/length and client data) are already | ||
513 | * defined as part of the Ethernet header, we do not do this here. | ||
514 | * From this perspective the standard and abbreviated frames appear the | ||
515 | * same - they will be treated differently though. | ||
516 | * | ||
517 | * The size of this header is also captured in WLP_DATA_HLEN to enable | ||
518 | * interfaces to prepare their headroom. | ||
519 | */ | ||
520 | struct wlp_frame_std_abbrv_hdr { | ||
521 | struct wlp_frame_hdr hdr; | ||
522 | u8 tag; | ||
523 | } __attribute__((packed)); | ||
524 | |||
525 | /** | ||
526 | * WLP association frames | ||
527 | * | ||
528 | * WLP Draft 0.99 [6.6] | ||
529 | */ | ||
530 | struct wlp_frame_assoc { | ||
531 | struct wlp_frame_hdr hdr; | ||
532 | enum wlp_assoc_type type:8; | ||
533 | struct wlp_attr_version version; | ||
534 | struct wlp_attr_msg_type msg_type; | ||
535 | u8 attr[]; | ||
536 | } __attribute__((packed)); | ||
537 | |||
538 | /* Ethernet to dev address mapping */ | ||
539 | struct wlp_eda { | ||
540 | spinlock_t lock; | ||
541 | struct list_head cache; /* Eth<->Dev Addr cache */ | ||
542 | }; | ||
543 | |||
544 | /** | ||
545 | * WSS information temporary storage | ||
546 | * | ||
547 | * This information is only stored temporarily during discovery. It should | ||
548 | * not be stored unless the device is enrolled in the advertised WSS. This | ||
549 | * is done mainly because we follow the letter of the spec in this regard. | ||
550 | * See WLP 0.99 [7.2.3]. | ||
551 | * When the device does become enrolled in a WSS the WSS information will | ||
552 | * be stored as part of the more comprehensive struct wlp_wss. | ||
553 | */ | ||
554 | struct wlp_wss_tmp_info { | ||
555 | char name[WLP_WSS_NAME_SIZE]; | ||
556 | u8 accept_enroll; | ||
557 | u8 sec_status; | ||
558 | struct uwb_mac_addr bcast; | ||
559 | }; | ||
560 | |||
561 | struct wlp_wssid_e { | ||
562 | struct list_head node; | ||
563 | struct wlp_uuid wssid; | ||
564 | struct wlp_wss_tmp_info *info; | ||
565 | }; | ||
566 | |||
567 | /** | ||
568 | * A cache entry of WLP neighborhood | ||
569 | * | ||
570 | * @node: head of list is wlp->neighbors | ||
571 | * @wssid: list of wssids of this neighbor, element is wlp_wssid_e | ||
572 | * @info: temporary storage for information learned during discovery. This | ||
573 | * storage is used together with the wssid_e temporary storage | ||
574 | * during discovery. | ||
575 | */ | ||
576 | struct wlp_neighbor_e { | ||
577 | struct list_head node; | ||
578 | struct wlp_uuid uuid; | ||
579 | struct uwb_dev *uwb_dev; | ||
580 | struct list_head wssid; /* Elements are wlp_wssid_e */ | ||
581 | struct wlp_device_info *info; | ||
582 | }; | ||
583 | |||
584 | struct wlp; | ||
585 | /** | ||
586 | * Information for an association session in progress. | ||
587 | * | ||
588 | * @exp_message: The type of the expected message. Both this message and a | ||
589 | * F0 message (which can be sent in response to any | ||
590 | * association frame) will be accepted as a valid message for | ||
591 | * this session. | ||
592 | * @cb: The function that will be called upon receipt of this | ||
593 | * message. | ||
594 | * @cb_priv: Private data of callback | ||
595 | * @data: Data used in association process (always a sk_buff?) | ||
596 | * @neighbor: Address of neighbor with which association session is in | ||
597 | * progress. | ||
598 | */ | ||
599 | struct wlp_session { | ||
600 | enum wlp_assoc_type exp_message; | ||
601 | void (*cb)(struct wlp *); | ||
602 | void *cb_priv; | ||
603 | void *data; | ||
604 | struct uwb_dev_addr neighbor_addr; | ||
605 | }; | ||
606 | |||
607 | /** | ||
608 | * WLP Service Set | ||
609 | * | ||
610 | * @mutex: used to protect entire WSS structure. | ||
611 | * | ||
612 | * @name: The WSS name is set to 65 bytes, 1 byte larger than the maximum | ||
613 | * allowed by the WLP spec. This is to have a null terminated string | ||
614 | * for display to the user. A maximum of 64 bytes will still be used | ||
615 | * when placing the WSS name field in association frames. | ||
616 | * | ||
617 | * @accept_enroll: Accepting enrollment: Set to one if registrar is | ||
618 | * accepting enrollment in WSS, or zero otherwise. | ||
619 | * | ||
620 | * Global and local information for each WSS in which we are enrolled. | ||
621 | * WLP 0.99 Section 7.2.1 and Section 7.2.2 | ||
622 | */ | ||
623 | struct wlp_wss { | ||
624 | struct mutex mutex; | ||
625 | struct kobject kobj; | ||
626 | /* Global properties. */ | ||
627 | struct wlp_uuid wssid; | ||
628 | u8 hash; | ||
629 | char name[WLP_WSS_NAME_SIZE]; | ||
630 | struct uwb_mac_addr bcast; | ||
631 | u8 secure_status:1; | ||
632 | u8 master_key[16]; | ||
633 | /* Local properties. */ | ||
634 | u8 tag; | ||
635 | struct uwb_mac_addr virtual_addr; | ||
636 | /* Extra */ | ||
637 | u8 accept_enroll:1; | ||
638 | enum wlp_wss_state state; | ||
639 | }; | ||
640 | |||
641 | /** | ||
642 | * WLP main structure | ||
643 | * @mutex: protect changes to WLP structure. We only allow changes to the | ||
644 | * uuid, so currently this mutex only protects this field. | ||
645 | */ | ||
646 | struct wlp { | ||
647 | struct mutex mutex; | ||
648 | struct uwb_rc *rc; /* UWB radio controller */ | ||
649 | struct uwb_pal pal; | ||
650 | struct wlp_eda eda; | ||
651 | struct wlp_uuid uuid; | ||
652 | struct wlp_session *session; | ||
653 | struct wlp_wss wss; | ||
654 | struct mutex nbmutex; /* Neighbor mutex protects neighbors list */ | ||
655 | struct list_head neighbors; /* Elements are wlp_neighbor_e */ | ||
656 | struct uwb_notifs_handler uwb_notifs_handler; | ||
657 | struct wlp_device_info *dev_info; | ||
658 | void (*fill_device_info)(struct wlp *wlp, struct wlp_device_info *info); | ||
659 | int (*xmit_frame)(struct wlp *, struct sk_buff *, | ||
660 | struct uwb_dev_addr *); | ||
661 | void (*stop_queue)(struct wlp *); | ||
662 | void (*start_queue)(struct wlp *); | ||
663 | }; | ||
664 | |||
665 | /* sysfs */ | ||
666 | |||
667 | |||
668 | struct wlp_wss_attribute { | ||
669 | struct attribute attr; | ||
670 | ssize_t (*show)(struct wlp_wss *wss, char *buf); | ||
671 | ssize_t (*store)(struct wlp_wss *wss, const char *buf, size_t count); | ||
672 | }; | ||
673 | |||
674 | #define WSS_ATTR(_name, _mode, _show, _store) \ | ||
675 | static struct wlp_wss_attribute wss_attr_##_name = __ATTR(_name, _mode, \ | ||
676 | _show, _store) | ||
677 | |||
678 | extern int wlp_setup(struct wlp *, struct uwb_rc *); | ||
679 | extern void wlp_remove(struct wlp *); | ||
680 | extern ssize_t wlp_neighborhood_show(struct wlp *, char *); | ||
681 | extern int wlp_wss_setup(struct net_device *, struct wlp_wss *); | ||
682 | extern void wlp_wss_remove(struct wlp_wss *); | ||
683 | extern ssize_t wlp_wss_activate_show(struct wlp_wss *, char *); | ||
684 | extern ssize_t wlp_wss_activate_store(struct wlp_wss *, const char *, size_t); | ||
685 | extern ssize_t wlp_eda_show(struct wlp *, char *); | ||
686 | extern ssize_t wlp_eda_store(struct wlp *, const char *, size_t); | ||
687 | extern ssize_t wlp_uuid_show(struct wlp *, char *); | ||
688 | extern ssize_t wlp_uuid_store(struct wlp *, const char *, size_t); | ||
689 | extern ssize_t wlp_dev_name_show(struct wlp *, char *); | ||
690 | extern ssize_t wlp_dev_name_store(struct wlp *, const char *, size_t); | ||
691 | extern ssize_t wlp_dev_manufacturer_show(struct wlp *, char *); | ||
692 | extern ssize_t wlp_dev_manufacturer_store(struct wlp *, const char *, size_t); | ||
693 | extern ssize_t wlp_dev_model_name_show(struct wlp *, char *); | ||
694 | extern ssize_t wlp_dev_model_name_store(struct wlp *, const char *, size_t); | ||
695 | extern ssize_t wlp_dev_model_nr_show(struct wlp *, char *); | ||
696 | extern ssize_t wlp_dev_model_nr_store(struct wlp *, const char *, size_t); | ||
697 | extern ssize_t wlp_dev_serial_show(struct wlp *, char *); | ||
698 | extern ssize_t wlp_dev_serial_store(struct wlp *, const char *, size_t); | ||
699 | extern ssize_t wlp_dev_prim_category_show(struct wlp *, char *); | ||
700 | extern ssize_t wlp_dev_prim_category_store(struct wlp *, const char *, | ||
701 | size_t); | ||
702 | extern ssize_t wlp_dev_prim_OUI_show(struct wlp *, char *); | ||
703 | extern ssize_t wlp_dev_prim_OUI_store(struct wlp *, const char *, size_t); | ||
704 | extern ssize_t wlp_dev_prim_OUI_sub_show(struct wlp *, char *); | ||
705 | extern ssize_t wlp_dev_prim_OUI_sub_store(struct wlp *, const char *, | ||
706 | size_t); | ||
707 | extern ssize_t wlp_dev_prim_subcat_show(struct wlp *, char *); | ||
708 | extern ssize_t wlp_dev_prim_subcat_store(struct wlp *, const char *, | ||
709 | size_t); | ||
710 | extern int wlp_receive_frame(struct device *, struct wlp *, struct sk_buff *, | ||
711 | struct uwb_dev_addr *); | ||
712 | extern int wlp_prepare_tx_frame(struct device *, struct wlp *, | ||
713 | struct sk_buff *, struct uwb_dev_addr *); | ||
714 | void wlp_reset_all(struct wlp *wlp); | ||
715 | |||
716 | /** | ||
717 | * Initialize WSS | ||
718 | */ | ||
719 | static inline | ||
720 | void wlp_wss_init(struct wlp_wss *wss) | ||
721 | { | ||
722 | mutex_init(&wss->mutex); | ||
723 | } | ||
724 | |||
725 | static inline | ||
726 | void wlp_init(struct wlp *wlp) | ||
727 | { | ||
728 | INIT_LIST_HEAD(&wlp->neighbors); | ||
729 | mutex_init(&wlp->mutex); | ||
730 | mutex_init(&wlp->nbmutex); | ||
731 | wlp_wss_init(&wlp->wss); | ||
732 | } | ||
733 | |||
734 | |||
735 | #endif /* #ifndef __LINUX__WLP_H_ */ | ||
diff --git a/include/linux/wm97xx_batt.h b/include/linux/wm97xx_batt.h new file mode 100644 index 000000000000..9681d1ab0e4f --- /dev/null +++ b/include/linux/wm97xx_batt.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef _LINUX_WM97XX_BAT_H | ||
2 | #define _LINUX_WM97XX_BAT_H | ||
3 | |||
4 | #include <linux/wm97xx.h> | ||
5 | |||
6 | struct wm97xx_batt_info { | ||
7 | int batt_aux; | ||
8 | int temp_aux; | ||
9 | int charge_gpio; | ||
10 | int min_voltage; | ||
11 | int max_voltage; | ||
12 | int batt_div; | ||
13 | int batt_mult; | ||
14 | int temp_div; | ||
15 | int temp_mult; | ||
16 | int batt_tech; | ||
17 | char *batt_name; | ||
18 | }; | ||
19 | |||
20 | #ifdef CONFIG_BATTERY_WM97XX | ||
21 | void __init wm97xx_bat_set_pdata(struct wm97xx_batt_info *data); | ||
22 | #else | ||
23 | static inline void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data) {} | ||
24 | #endif | ||
25 | |||
26 | #endif | ||
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 5c158c477ac7..b36291130f22 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -149,11 +149,11 @@ struct execute_work { | |||
149 | 149 | ||
150 | extern struct workqueue_struct * | 150 | extern struct workqueue_struct * |
151 | __create_workqueue_key(const char *name, int singlethread, | 151 | __create_workqueue_key(const char *name, int singlethread, |
152 | int freezeable, struct lock_class_key *key, | 152 | int freezeable, int rt, struct lock_class_key *key, |
153 | const char *lock_name); | 153 | const char *lock_name); |
154 | 154 | ||
155 | #ifdef CONFIG_LOCKDEP | 155 | #ifdef CONFIG_LOCKDEP |
156 | #define __create_workqueue(name, singlethread, freezeable) \ | 156 | #define __create_workqueue(name, singlethread, freezeable, rt) \ |
157 | ({ \ | 157 | ({ \ |
158 | static struct lock_class_key __key; \ | 158 | static struct lock_class_key __key; \ |
159 | const char *__lock_name; \ | 159 | const char *__lock_name; \ |
@@ -164,17 +164,19 @@ __create_workqueue_key(const char *name, int singlethread, | |||
164 | __lock_name = #name; \ | 164 | __lock_name = #name; \ |
165 | \ | 165 | \ |
166 | __create_workqueue_key((name), (singlethread), \ | 166 | __create_workqueue_key((name), (singlethread), \ |
167 | (freezeable), &__key, \ | 167 | (freezeable), (rt), &__key, \ |
168 | __lock_name); \ | 168 | __lock_name); \ |
169 | }) | 169 | }) |
170 | #else | 170 | #else |
171 | #define __create_workqueue(name, singlethread, freezeable) \ | 171 | #define __create_workqueue(name, singlethread, freezeable, rt) \ |
172 | __create_workqueue_key((name), (singlethread), (freezeable), NULL, NULL) | 172 | __create_workqueue_key((name), (singlethread), (freezeable), (rt), \ |
173 | NULL, NULL) | ||
173 | #endif | 174 | #endif |
174 | 175 | ||
175 | #define create_workqueue(name) __create_workqueue((name), 0, 0) | 176 | #define create_workqueue(name) __create_workqueue((name), 0, 0, 0) |
176 | #define create_freezeable_workqueue(name) __create_workqueue((name), 1, 1) | 177 | #define create_rt_workqueue(name) __create_workqueue((name), 0, 0, 1) |
177 | #define create_singlethread_workqueue(name) __create_workqueue((name), 1, 0) | 178 | #define create_freezeable_workqueue(name) __create_workqueue((name), 1, 1, 0) |
179 | #define create_singlethread_workqueue(name) __create_workqueue((name), 1, 0, 0) | ||
178 | 180 | ||
179 | extern void destroy_workqueue(struct workqueue_struct *wq); | 181 | extern void destroy_workqueue(struct workqueue_struct *wq); |
180 | 182 | ||
@@ -238,4 +240,12 @@ void cancel_rearming_delayed_work(struct delayed_work *work) | |||
238 | cancel_delayed_work_sync(work); | 240 | cancel_delayed_work_sync(work); |
239 | } | 241 | } |
240 | 242 | ||
243 | #ifndef CONFIG_SMP | ||
244 | static inline long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) | ||
245 | { | ||
246 | return fn(arg); | ||
247 | } | ||
248 | #else | ||
249 | long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg); | ||
250 | #endif /* CONFIG_SMP */ | ||
241 | #endif | 251 | #endif |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 12b15c561a1f..e585657e9831 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -63,7 +63,15 @@ struct writeback_control { | |||
63 | unsigned for_writepages:1; /* This is a writepages() call */ | 63 | unsigned for_writepages:1; /* This is a writepages() call */ |
64 | unsigned range_cyclic:1; /* range_start is cyclic */ | 64 | unsigned range_cyclic:1; /* range_start is cyclic */ |
65 | unsigned more_io:1; /* more io to be dispatched */ | 65 | unsigned more_io:1; /* more io to be dispatched */ |
66 | unsigned range_cont:1; | 66 | /* |
67 | * write_cache_pages() won't update wbc->nr_to_write and | ||
68 | * mapping->writeback_index if no_nrwrite_index_update | ||
69 | * is set. write_cache_pages() may write more than we | ||
70 | * requested and we want to make sure nr_to_write and | ||
71 | * writeback_index are updated in a consistent manner | ||
72 | * so we use a single control to update them | ||
73 | */ | ||
74 | unsigned no_nrwrite_index_update:1; | ||
67 | }; | 75 | }; |
68 | 76 | ||
69 | /* | 77 | /* |
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h index fb0c215a3051..4bc1e6b86cb2 100644 --- a/include/linux/xfrm.h +++ b/include/linux/xfrm.h | |||
@@ -279,6 +279,7 @@ enum xfrm_attr_type_t { | |||
279 | XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ | 279 | XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ |
280 | XFRMA_MIGRATE, | 280 | XFRMA_MIGRATE, |
281 | XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ | 281 | XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ |
282 | XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */ | ||
282 | __XFRMA_MAX | 283 | __XFRMA_MAX |
283 | 284 | ||
284 | #define XFRMA_MAX (__XFRMA_MAX - 1) | 285 | #define XFRMA_MAX (__XFRMA_MAX - 1) |
@@ -415,6 +416,15 @@ struct xfrm_user_report { | |||
415 | struct xfrm_selector sel; | 416 | struct xfrm_selector sel; |
416 | }; | 417 | }; |
417 | 418 | ||
419 | /* Used by MIGRATE to pass addresses IKE should use to perform | ||
420 | * SA negotiation with the peer */ | ||
421 | struct xfrm_user_kmaddress { | ||
422 | xfrm_address_t local; | ||
423 | xfrm_address_t remote; | ||
424 | __u32 reserved; | ||
425 | __u16 family; | ||
426 | }; | ||
427 | |||
418 | struct xfrm_user_migrate { | 428 | struct xfrm_user_migrate { |
419 | xfrm_address_t old_daddr; | 429 | xfrm_address_t old_daddr; |
420 | xfrm_address_t old_saddr; | 430 | xfrm_address_t old_saddr; |